summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAkshay Deep <akshaydeepiitr@gmail.com>2016-06-27 16:15:23 +0530
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-07-28 20:54:44 +0000
commit72e6f08c692c0625db5ce377fb478a99660adb0d (patch)
treea5db439b850782ed2245462361107522a9ed9b5a /include
parent6dcd231892d80d2f130d1b9ebb9cf7dfa1115df1 (diff)
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/26700 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Akshay Deep <akshaydeepiitr@gmail.com> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'include')
-rw-r--r--include/sfx2/emojicontrol.hxx49
-rw-r--r--include/sfx2/emojipopup.hxx41
-rw-r--r--include/sfx2/emojiview.hxx84
-rw-r--r--include/sfx2/emojiviewitem.hxx38
-rw-r--r--include/sfx2/sfxsids.hrc1
5 files changed, 213 insertions, 0 deletions
diff --git a/include/sfx2/emojicontrol.hxx b/include/sfx2/emojicontrol.hxx
new file mode 100644
index 000000000000..48c2aa5be3ea
--- /dev/null
+++ b/include/sfx2/emojicontrol.hxx
@@ -0,0 +1,49 @@
+/* -*- 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: */
diff --git a/include/sfx2/emojipopup.hxx b/include/sfx2/emojipopup.hxx
new file mode 100644
index 000000000000..a6ebc7051383
--- /dev/null
+++ b/include/sfx2/emojipopup.hxx
@@ -0,0 +1,41 @@
+/* -*- 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: */
diff --git a/include/sfx2/emojiview.hxx b/include/sfx2/emojiview.hxx
new file mode 100644
index 000000000000..0eac5adf1fd7
--- /dev/null
+++ b/include/sfx2/emojiview.hxx
@@ -0,0 +1,84 @@
+/* -*- 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: */
diff --git a/include/sfx2/emojiviewitem.hxx b/include/sfx2/emojiviewitem.hxx
new file mode 100644
index 000000000000..6e38f17da442
--- /dev/null
+++ b/include/sfx2/emojiviewitem.hxx
@@ -0,0 +1,38 @@
+/* -*- 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: */
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index cb461ee89ea8..09462483414f 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -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)