Kaydet (Commit) 72e6f08c authored tarafından Akshay Deep's avatar Akshay Deep Kaydeden (comit) Samuel Mehrbrodt

GSoC Emoji Control

Tab Window
Add emoji.json to installation directory
Read the JSON data from code
Filter emojis according to categories
Insert Emoji at cursor position
Toolbar control

Change-Id: Ia5a577ce41398132872914ebfa499e4d4077d57e
Reviewed-on: https://gerrit.libreoffice.org/26700Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAkshay Deep <akshaydeepiitr@gmail.com>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 6dcd2318
......@@ -770,6 +770,9 @@
<glade-widget-class title="Recent Documents View" name="sfxlo-RecentDocsView"
generic-name="Icon View" parent="GtkIconView"
icon-name="widget-gtk-iconview"/>
<glade-widget-class title="Emoji View" name="sfxlo-EmojiView"
generic-name="Template Icon View" parent="GtkIconView"
icon-name="widget-gtk-iconview"/>
<glade-widget-class title="Template Thumbnail View" name="sfxlo-TemplateDefaultView"
generic-name="Template Icon View" parent="GtkIconView"
icon-name="widget-gtk-iconview"/>
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SFX2_INC_EMOJICONTROL_HXX
#define INCLUDED_SFX2_INC_EMOJICONTROL_HXX
#include <sal/config.h>
#include <sfx2/dllapi.h>
#include <vcl/button.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <sfx2/tbxctrl.hxx>
#include <com/sun/star/frame/XFrame.hpp>
class EmojiView;
class ThumbnailViewItem;
enum class FILTER_CATEGORY;
class SFX2_DLLPUBLIC SfxEmojiControl : public SfxPopupWindow
{
public:
explicit SfxEmojiControl(sal_uInt16 nId, const css::uno::Reference< css::frame::XFrame >& rFrame);
virtual ~SfxEmojiControl();
virtual void dispose() override;
private:
void ConvertLabelToUnicode(sal_uInt16 nPageId);
/// Return filter according to the currently selected tab page.
FILTER_CATEGORY getCurrentFilter();
DECL_LINK_TYPED(ActivatePageHdl, TabControl*, void);
DECL_LINK_TYPED(InsertHdl, ThumbnailViewItem*, void);
VclPtr<TabControl> mpTabControl;
VclPtr<EmojiView> mpEmojiView;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SFX2_INC_EMOJIPOPUP_HXX
#define INCLUDED_SFX2_INC_EMOJIPOPUP_HXX
#include <sfx2/tbxctrl.hxx>
#include <sfx2/dllapi.h>
#include <functional>
class SFX2_DLLPUBLIC EmojiPopup : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
EmojiPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
virtual ~EmojiPopup();
virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SFX2_SOURCE_INC_EMOJIVIEW_HXX
#define INCLUDED_SFX2_SOURCE_INC_EMOJIVIEW_HXX
#include <sfx2/thumbnailview.hxx>
//unicode item defines
#define ITEM_MAX_WIDTH 20
#define ITEM_MAX_HEIGHT 20
#define ITEM_PADDING 5
#define ITEM_MAX_TEXT_LENGTH 10
class EmojiViewItem;
enum class FILTER_CATEGORY
{
PEOPLE,
NATURE,
FOOD,
ACTIVITY,
TRAVEL,
OBJECTS,
SYMBOLS,
FLAGS,
UNICODE9
};
// Display unicode emojis depending on the category
class ViewFilter_Category
{
public:
ViewFilter_Category (FILTER_CATEGORY rCategory)
: mCategory(rCategory)
{}
virtual ~ViewFilter_Category () {}
bool operator () (const ThumbnailViewItem *pItem);
static bool isFilteredCategory(FILTER_CATEGORY filter, const OUString &rCategory);
protected:
FILTER_CATEGORY mCategory;
};
class EmojiView : public ThumbnailView
{
public:
EmojiView ( vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP | WB_VSCROLL);
virtual ~EmojiView ();
// Fill view with emoji unicodes
void Populate ();
void setInsertEmojiHdl (const Link<ThumbnailViewItem*, void> &rLink);
void AppendItem(const OUString &rTitle, const OUString &rCategory );
protected:
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
protected:
std::string msJSONData;
Link<ThumbnailViewItem*, void> maInsertEmojiHdl;
};
#endif // INCLUDED_SFX2_SOURCE_INC_EMOJIVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SFX2_SOURCE_INC_EMOJIVIEWITEM_HXX
#define INCLUDED_SFX2_SOURCE_INC_EMOJIVIEWITEM_HXX
#include <sfx2/thumbnailviewitem.hxx>
class EmojiViewItem : public ThumbnailViewItem
{
public:
EmojiViewItem (ThumbnailView &rView, sal_uInt16 nId);
virtual ~EmojiViewItem ();
void setCategory (const OUString &rCategory) { msCategory = rCategory; }
const OUString& getCategory () const { return msCategory; }
virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
const ThumbnailItemAttributes *pAttrs) override;
virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
const long nPadding, sal_uInt32 nMaxTextLength,
const ThumbnailItemAttributes *pAttrs) override;
private:
OUString msCategory;
};
#endif // INCLUDED_SFX2_SOURCE_INC_EMOJIVIEWITEM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -85,6 +85,7 @@
#define SID_EXTENDEDHELP (SID_SFX_START + 402)
#define SID_HELPBALLOONS (SID_SFX_START + 403)
#define SID_HELPTIPS (SID_SFX_START + 404)
#define SID_EMOJI_CONTROL (SID_SFX_START + 405)
#define SID_HELPMENU (SID_SFX_START + 410)
#define SID_SEND_FEEDBACK (SID_SFX_START + 421)
#define SID_SHOW_LICENSE (SID_SFX_START + 1683)
......
......@@ -3779,6 +3779,14 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:EmojiControl" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Emojis</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
<node oor:name=".uno:TransformRotationX" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Rotation Pivot Point X</value>
......
......@@ -5506,6 +5506,13 @@
be open at the same time. NIL will be interpreted as infinite!</desc>
</info>
</prop>
<prop oor:name="EmojiFont" oor:type="xs:string" oor:nillable="false">
<!-- UIHints: Emoji Control -->
<info>
<desc>Special font for rendering of emojis</desc>
</info>
<value>Noto Emoji</value>
</prop>
<prop oor:name="PluginsEnabled" oor:type="xs:boolean" oor:nillable="false">
<!-- OldPath: ? -->
<!-- OldLocation: soffice.ini -->
......
......@@ -188,6 +188,7 @@ interface CellSelection
FID_INPUTLINE_BLOCK [ ExecMethod = Execute; StateMethod = GetState; ]
FID_INPUTLINE_MATRIX [ ExecMethod = Execute; StateMethod = GetState; ]
SID_CHARMAP [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
SID_EMOJI_CONTROL [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
SID_INSERT_POSTIT [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
SID_EDIT_POSTIT [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
......
......@@ -55,6 +55,7 @@ interface TableDrawText
SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_EMOJI_CONTROL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_THES [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_THESAURUS [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
// Attribute: --------------------------------------------------
......
......@@ -35,6 +35,7 @@ interface TableText
SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_EMOJI_CONTROL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
FID_INSERT_NAME [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_THES [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
......
......@@ -85,6 +85,7 @@
#include <svx/formatpaintbrushctrl.hxx>
#include "tbzoomsliderctrl.hxx"
#include <svx/zoomsliderctrl.hxx>
#include <sfx2/emojipopup.hxx>
#include <svx/xmlsecctrl.hxx>
// Child windows
......@@ -194,6 +195,8 @@ void ScDLL::Init()
SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod );
// Media Controller
::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
......
......@@ -63,6 +63,7 @@
<toolbar:toolbaritem xlink:href=".uno:GoalSeekDialog" toolbar:visible="false"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:InsertGraphic"/>
<toolbar:toolbaritem xlink:href=".uno:EmojiControl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:Gallery" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:InsertObjectChart"/>
<toolbar:toolbaritem xlink:href=".uno:InsertObjectStarMath" toolbar:visible="false"/>
......
......@@ -298,6 +298,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
SID_EMOJI_CONTROL // ole : no, status : ?
[
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
FN_INSERT_SOFT_HYPHEN // status(final|play)
[
ExecMethod = FuTemporary ;
......
......@@ -136,6 +136,11 @@ interface OutlineView
ExecMethod = FuTemporaryModify ;
StateMethod = GetMenuState ;
]
SID_EMOJI_CONTROL // ole : no, status : ?
[
ExecMethod = FuTemporaryModify ;
StateMethod = GetMenuState ;
]
FN_INSERT_SOFT_HYPHEN // status(final|play)
[
ExecMethod = FuTemporaryModify ;
......
......@@ -91,6 +91,7 @@
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/emojipopup.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <vcl/FilterConfigItem.hxx>
#include <comphelper/processfactory.hxx>
......@@ -238,6 +239,8 @@ void SdDLL::RegisterControllers(SdModule* pMod)
SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod );
SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod );
}
void SdDLL::Init()
......
......@@ -59,6 +59,7 @@
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:InsertTable"/>
<toolbar:toolbaritem xlink:href=".uno:InsertGraphic"/>
<toolbar:toolbaritem xlink:href=".uno:EmojiControl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:InsertAVMedia"/>
<toolbar:toolbaritem xlink:href=".uno:InsertObjectChart"/>
<toolbar:toolbarseparator/>
......
......@@ -79,6 +79,8 @@ $(eval $(call gb_Library_use_libraries,sfx,\
$(eval $(call gb_Library_use_externals,sfx,\
boost_headers \
libxml2 \
orcus \
orcus-parser\
))
$(eval $(call gb_Library_add_exception_objects,sfx,\
......@@ -158,6 +160,10 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/control/thumbnailviewitem \
sfx2/source/control/thumbnailviewacc \
sfx2/source/control/thumbnailview \
sfx2/source/control/emojiviewitem \
sfx2/source/control/emojiview \
sfx2/source/control/emojicontrol \
sfx2/source/control/emojipopup \
sfx2/source/control/unoctitm \
sfx2/source/dialog/alienwarn \
sfx2/source/dialog/backingcomp \
......
......@@ -23,6 +23,7 @@ $(eval $(call gb_Module_add_targets,sfx2,\
CustomTarget_classification \
Library_sfx \
Package_classification \
Package_emoji \
))
$(eval $(call gb_Module_add_l10n_targets,sfx2,\
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Package_Package,sfx2_emojiconfig,$(SRCDIR)/sfx2))
$(eval $(call gb_Package_add_files,sfx2_emojiconfig,$(LIBO_SHARE_FOLDER)/emojiconfig,\
emojiconfig/emoji.json \
))
# vim: set noet sw=4 ts=4:
......@@ -21,6 +21,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/documentinfopage \
sfx2/uiconfig/ui/documentpropertiesdialog \
sfx2/uiconfig/ui/editdurationdialog \
sfx2/uiconfig/ui/emojicontrol \
sfx2/uiconfig/ui/errorfindemaildialog \
sfx2/uiconfig/ui/floatingrecord \
sfx2/uiconfig/ui/helpbookmarkpage \
......
This diff is collapsed.
......@@ -1903,6 +1903,24 @@ SfxBoolItem HelpTip SID_HELPTIPS
]
SfxVoidItem EmojiControl SID_EMOJI_CONTROL
[
AutoUpdate = FALSE,
FastCall = TRUE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_SPECIAL;
]
SfxVoidItem HideCurPage SID_BASICIDE_HIDECURPAGE
()
[
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sfx2/emojiview.hxx>
#include <sfx2/emojiviewitem.hxx>
#include <sfx2/emojicontrol.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/dispatchcommand.hxx>
#include <officecfg/Office/Common.hxx>
const char FILTER_PEOPLE[] = "people";
const char FILTER_NATURE[] = "nature";
const char FILTER_FOOD[] = "food";
const char FILTER_ACTIVITY[] = "activity";
const char FILTER_TRAVEL[] = "travel";
const char FILTER_OBJECTS[] = "objects";
const char FILTER_SYMBOLS[] = "symbols";
const char FILTER_FLAGS[] = "flags";
const char FILTER_UNICODE9[] = "unicode9";
using namespace com::sun::star;
SfxEmojiControl::SfxEmojiControl(sal_uInt16 nId, const css::uno::Reference< css::frame::XFrame >& rFrame)
: SfxPopupWindow(nId, "emojictrl", "sfx/ui/emojicontrol.ui", rFrame)
{
get(mpTabControl, "tab_control");
get(mpEmojiView, "emoji_view");
sal_uInt16 nCurPageId = mpTabControl->GetPageId(FILTER_PEOPLE);
TabPage *pTabPage = mpTabControl->GetTabPage(nCurPageId);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_NATURE);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_FOOD);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_ACTIVITY);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_TRAVEL);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_OBJECTS);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_SYMBOLS);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_FLAGS);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
nCurPageId = mpTabControl->GetPageId(FILTER_UNICODE9);
mpTabControl->SetTabPage(nCurPageId, pTabPage);
ConvertLabelToUnicode(nCurPageId);
pTabPage->Show();
mpEmojiView->SetStyle(mpEmojiView->GetStyle() | WB_VSCROLL);
mpEmojiView->setItemMaxTextLength(ITEM_MAX_TEXT_LENGTH);
mpEmojiView->setItemDimensions(ITEM_MAX_WIDTH, 0, ITEM_MAX_HEIGHT, ITEM_PADDING);
mpEmojiView->Populate();
mpEmojiView->filterItems(ViewFilter_Category(FILTER_CATEGORY::PEOPLE));
mpEmojiView->setInsertEmojiHdl(LINK(this, SfxEmojiControl, InsertHdl));
mpEmojiView->Show();
mpTabControl->SetActivatePageHdl(LINK(this, SfxEmojiControl, ActivatePageHdl));
}
SfxEmojiControl::~SfxEmojiControl()
{
disposeOnce();
}
void SfxEmojiControl::dispose()
{
mpTabControl.clear();
mpEmojiView.clear();
SfxPopupWindow::dispose();
}
void SfxEmojiControl::ConvertLabelToUnicode(sal_uInt16 nPageId)
{
OUStringBuffer sHexText = "";
OUString sLabel = mpTabControl->GetPageText(nPageId);
sHexText.appendUtf32(sLabel.toUInt32(16));
mpTabControl->SetPageText(nPageId, sHexText.toString());
}
FILTER_CATEGORY SfxEmojiControl::getCurrentFilter()
{
const sal_uInt16 nCurPageId = mpTabControl->GetCurPageId();
if (nCurPageId == mpTabControl->GetPageId(FILTER_PEOPLE))
return FILTER_CATEGORY::PEOPLE;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_NATURE))
return FILTER_CATEGORY::NATURE;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_FOOD))
return FILTER_CATEGORY::FOOD;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_ACTIVITY))
return FILTER_CATEGORY::ACTIVITY;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_TRAVEL))
return FILTER_CATEGORY::TRAVEL;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_OBJECTS))
return FILTER_CATEGORY::OBJECTS;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_SYMBOLS))
return FILTER_CATEGORY::SYMBOLS;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_FLAGS))
return FILTER_CATEGORY::FLAGS;
else if (nCurPageId == mpTabControl->GetPageId(FILTER_UNICODE9))
return FILTER_CATEGORY::UNICODE9;
return FILTER_CATEGORY::PEOPLE;
}
IMPL_LINK_NOARG_TYPED(SfxEmojiControl, ActivatePageHdl, TabControl*, void)
{
mpEmojiView->filterItems(ViewFilter_Category(getCurrentFilter()));
}
IMPL_LINK_TYPED(SfxEmojiControl, InsertHdl, ThumbnailViewItem*, pItem, void)
{
OUStringBuffer sHexText = "";
sHexText.appendUtf32(OUString(pItem->getTitle()).toUInt32(16));
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
OUString sFontName(officecfg::Office::Common::Misc::EmojiFont::get(xContext));
uno::Sequence<beans::PropertyValue> aArgs(2);
aArgs[0].Name = OUString::fromUtf8("Symbols");
aArgs[0].Value = uno::makeAny(sHexText.toString());
//add font settings here
aArgs[1].Name = OUString::fromUtf8("FontName");
aArgs[1].Value = uno::makeAny(sFontName);
comphelper::dispatchCommand(".uno:InsertSymbol", aArgs);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sfx2/emojipopup.hxx>
#include <sfx2/emojicontrol.hxx>
#include <unotools/viewoptions.hxx>
#include <vcl/toolbox.hxx>
SFX_IMPL_TOOLBOX_CONTROL(EmojiPopup, SfxVoidItem);
EmojiPopup::EmojiPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
: SfxToolBoxControl(nSlotId, nId, rTbx)
{
rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId));
}
EmojiPopup::~EmojiPopup()
{
}
VclPtr<SfxPopupWindow> EmojiPopup::CreatePopupWindow()
{
VclPtr<SfxEmojiControl> pControl = VclPtr<SfxEmojiControl>::Create(GetSlotId(), m_xFrame);
pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
SetPopupWindow(pControl);
return pControl;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <sfx2/emojiview.hxx>
#include <sfx2/emojiviewitem.hxx>
#include <sfx2/templatelocalview.hxx>
#include <sfx2/sfxresid.hxx>
#include <tools/urlobj.hxx>
#include <vcl/layout.hxx>
#include <rtl/bootstrap.hxx>
#include <config_folders.h>
#include <officecfg/Office/Common.hxx>
#include <comphelper/processfactory.hxx>
#include <orcus/json_document_tree.hpp>
#include <orcus/config.hpp>
#include <orcus/pstring.hpp>
#include <string>
#include <fstream>
#include <streambuf>
#include "../doc/doc.hrc"
#include <vcl/builderfactory.hxx>
using namespace ::com::sun::star;
bool ViewFilter_Category::isFilteredCategory(FILTER_CATEGORY filter, const OUString &rCategory)
{
bool bRet = true;
if (filter == FILTER_CATEGORY::PEOPLE)
bRet = rCategory.match("people");
else if (filter == FILTER_CATEGORY::NATURE)
bRet = rCategory.match("nature");
else if (filter == FILTER_CATEGORY::FOOD)
bRet = rCategory.match("food");