diff options
32 files changed, 660 insertions, 13 deletions
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 4f1a89dffa83..2b9663a7cc93 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -91,7 +91,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/dialogs/about \ cui/source/dialogs/colorpicker \ cui/source/dialogs/cuicharmap \ - cui/source/dialogs/charwin \ cui/source/dialogs/cuifmsearch \ cui/source/dialogs/cuigaldlg \ cui/source/dialogs/cuigrfflt \ diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx index f3618bc9d51e..9d4f5604fb17 100644 --- a/cui/source/inc/cuicharmap.hxx +++ b/cui/source/inc/cuicharmap.hxx @@ -26,7 +26,7 @@ #include <vcl/lstbox.hxx> #include <sfx2/basedlgs.hxx> #include <svx/charmap.hxx> -#include "charwin.hxx" +#include <sfx2/charwin.hxx> using namespace ::com::sun::star; class SubsetMap; diff --git a/icon-themes/breeze/cmd/lc_charmapcontrol.png b/icon-themes/breeze/cmd/lc_charmapcontrol.png Binary files differnew file mode 100644 index 000000000000..00a81c1bbc11 --- /dev/null +++ b/icon-themes/breeze/cmd/lc_charmapcontrol.png diff --git a/icon-themes/breeze/cmd/sc_charmapcontrol.png b/icon-themes/breeze/cmd/sc_charmapcontrol.png Binary files differnew file mode 100644 index 000000000000..d61735c3505d --- /dev/null +++ b/icon-themes/breeze/cmd/sc_charmapcontrol.png diff --git a/icon-themes/galaxy/cmd/lc_charmapcontrol.png b/icon-themes/galaxy/cmd/lc_charmapcontrol.png Binary files differnew file mode 100644 index 000000000000..f0020188ef09 --- /dev/null +++ b/icon-themes/galaxy/cmd/lc_charmapcontrol.png diff --git a/icon-themes/galaxy/cmd/sc_charmapcontrol.png b/icon-themes/galaxy/cmd/sc_charmapcontrol.png Binary files differnew file mode 100644 index 000000000000..bf0e63a7a522 --- /dev/null +++ b/icon-themes/galaxy/cmd/sc_charmapcontrol.png diff --git a/include/sfx2/charmapcontrol.hxx b/include/sfx2/charmapcontrol.hxx new file mode 100644 index 000000000000..643978dc13eb --- /dev/null +++ b/include/sfx2/charmapcontrol.hxx @@ -0,0 +1,58 @@ +/* -*- 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_CHARMAPCONTROL_HXX +#define INCLUDED_SFX2_INC_CHARMAPCONTROL_HXX + +#include <sal/config.h> +#include <sfx2/dllapi.h> +#include <sfx2/tbxctrl.hxx> +#include <com/sun/star/frame/XFrame.hpp> +#include <sfx2/charwin.hxx> +#include <vcl/button.hxx> + +class SvxCharView; + +class SFX2_DLLPUBLIC SfxCharmapCtrl : public SfxPopupWindow +{ +public: + explicit SfxCharmapCtrl(sal_uInt16 nId, const css::uno::Reference< css::frame::XFrame >& rFrame); + + virtual ~SfxCharmapCtrl() override; + + virtual void dispose() override; + +private: + VclPtr<SvxCharView> m_pRecentCharView[16]; + std::deque<OUString> maRecentCharList; + std::deque<OUString> maRecentCharFontList; + VclPtr<Button> maDlgBtn; + + DECL_LINK(RecentClickHdl, SvxCharView*, void); + DECL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, void); + DECL_LINK(OpenDlgHdl, Button*, void); + + void getRecentCharacterList(); //gets both recent char and recent char font list + void updateRecentCharacterList(const OUString& rChar, const OUString& rFont); + void updateRecentCharControl(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/charmappopup.hxx b/include/sfx2/charmappopup.hxx new file mode 100644 index 000000000000..f35e4febc113 --- /dev/null +++ b/include/sfx2/charmappopup.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_CHARMAPPOPUP_HXX +#define INCLUDED_SFX2_INC_CHARMAPPOPUP_HXX + +#include <sfx2/tbxctrl.hxx> +#include <sfx2/dllapi.h> + +#include <functional> + +class SFX2_DLLPUBLIC CharmapPopup : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + CharmapPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + virtual ~CharmapPopup() override; + + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/charwin.hxx b/include/sfx2/charwin.hxx index 7feb06800fe5..563d6ac54959 100644 --- a/cui/source/inc/charwin.hxx +++ b/include/sfx2/charwin.hxx @@ -17,12 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CUI_SOURCE_INC_CHARWIN_HXX -#define INCLUDED_CUI_SOURCE_INC_CHARWIN_HXX +#ifndef INCLUDED_SFX2_INC_CHARWIN_HXX +#define INCLUDED_SFX2_INC_CHARWIN_HXX -#include <vcl/ctrl.hxx> +#include <sfx2/tbxctrl.hxx> +#include <sfx2/dllapi.h> -class SvxCharView : public Control +class SFX2_DLLPUBLIC SvxCharView : public Control { public: SvxCharView(vcl::Window* pParent); diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 9d800e917613..eff5e36acbac 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -81,6 +81,7 @@ #define SID_HELPBALLOONS (SID_SFX_START + 403) #define SID_HELPTIPS (SID_SFX_START + 404) #define SID_EMOJI_CONTROL (SID_SFX_START + 405) +#define SID_CHARMAP_CONTROL (SID_SFX_START + 406) #define SID_HELPMENU (SID_SFX_START + 410) #define SID_SEND_FEEDBACK (SID_SFX_START + 421) #define SID_Q_AND_A (SID_SFX_START + 422) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 3daa07530731..e8488ad6de45 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -4003,6 +4003,17 @@ <value>true</value> </prop> </node> + <node oor:name=".uno:CharmapControl" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Charmap</value> + </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string"> + <value xml:lang="en-US">Insert Special Characters</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> diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index e85c12457988..ba52f0f12b34 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -187,6 +187,7 @@ interface CellSelection FID_INPUTLINE_MATRIX [ ExecMethod = Execute; StateMethod = GetState; ] SID_CHARMAP [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] SID_EMOJI_CONTROL [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] + SID_CHARMAP_CONTROL [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] SID_INSERT_POSTIT [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] SID_EDIT_POSTIT [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 0432fb12051a..2ba4c89e8699 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -56,6 +56,7 @@ interface TableDrawText 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_CHARMAP_CONTROL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_THES [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_THESAURUS [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] // attribute: diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi index 6e05f4bf6e72..4cb27b5bc4e0 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -36,6 +36,7 @@ interface TableText 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_CHARMAP_CONTROL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] FID_INSERT_NAME [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_THES [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index d75a481b1a3d..0d062b10a1be 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -86,6 +86,7 @@ #include "tbzoomsliderctrl.hxx" #include <svx/zoomsliderctrl.hxx> #include <sfx2/emojipopup.hxx> +#include <sfx2/charmappopup.hxx> #include <svx/xmlsecctrl.hxx> // Child windows @@ -193,6 +194,7 @@ void ScDLL::Init() SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod); EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod ); + CharmapPopup::RegisterControl(SID_CHARMAP_CONTROL, pMod ); // Media Controller ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod ); diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index a83b0149db19..0e9d8eee12e5 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -303,6 +303,11 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + SID_CHARMAP_CONTROL // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] FN_INSERT_SOFT_HYPHEN // status(final|play) [ ExecMethod = FuTemporary ; diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi index 888808137b46..daea2d72e014 100644 --- a/sd/sdi/outlnvsh.sdi +++ b/sd/sdi/outlnvsh.sdi @@ -141,6 +141,11 @@ interface OutlineView ExecMethod = FuTemporaryModify ; StateMethod = GetMenuState ; ] + SID_CHARMAP_CONTROL // ole : no, status : ? + [ + ExecMethod = FuTemporaryModify ; + StateMethod = GetMenuState ; + ] FN_INSERT_SOFT_HYPHEN // status(final|play) [ ExecMethod = FuTemporaryModify ; diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index fb744b74877d..f1f59ad48f00 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -92,6 +92,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/emojipopup.hxx> +#include <sfx2/charmappopup.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> #include <vcl/FilterConfigItem.hxx> #include <comphelper/processfactory.hxx> @@ -236,6 +237,7 @@ void SdDLL::RegisterControllers(SdModule* pMod) SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod ); EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod ); + CharmapPopup::RegisterControl(SID_CHARMAP_CONTROL, pMod ); } void SdDLL::Init() diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 16f52bab5b57..75755fb7d3bf 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -161,6 +161,8 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/control/emojiview \ sfx2/source/control/emojicontrol \ sfx2/source/control/emojipopup \ + sfx2/source/control/charmapcontrol \ + sfx2/source/control/charwin \ sfx2/source/control/unoctitm \ sfx2/source/dialog/alienwarn \ sfx2/source/dialog/backingcomp \ @@ -168,6 +170,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/dialog/basedlgs \ sfx2/source/dialog/checkin \ sfx2/source/dialog/dialoghelper \ + sfx2/source/dialog/charmappopup \ sfx2/source/dialog/dinfdlg \ sfx2/source/dialog/dockwin \ sfx2/source/dialog/documentfontsdialog \ diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index c976d89369cd..b62db558fb6b 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -13,6 +13,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/alienwarndialog \ sfx2/uiconfig/ui/bookmarkdialog \ sfx2/uiconfig/ui/bookmarkmenu \ + sfx2/uiconfig/ui/charmapcontrol \ sfx2/uiconfig/ui/checkin \ sfx2/uiconfig/ui/cmisinfopage \ sfx2/uiconfig/ui/cmisline \ diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index c69d7699410b..a9d281bd2089 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -247,6 +247,24 @@ SfxStringItem AddDirect SID_NEWDOCDIRECT ] +SfxVoidItem CharmapControl SID_CHARMAP_CONTROL + +[ + AutoUpdate = FALSE, + FastCall = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_SPECIAL; +] + + SfxVoidItem AddressBookSource SID_TEMPLATE_ADDRESSBOKSOURCE () [ diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx new file mode 100644 index 000000000000..8a2af88d63c0 --- /dev/null +++ b/sfx2/source/control/charmapcontrol.cxx @@ -0,0 +1,192 @@ +/* -*- 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 <comphelper/propertysequence.hxx> +#include <comphelper/dispatchcommand.hxx> +#include <officecfg/Office/Common.hxx> +#include <sfx2/charmapcontrol.hxx> + +using namespace css; + +SfxCharmapCtrl::SfxCharmapCtrl(sal_uInt16 nId, const css::uno::Reference< css::frame::XFrame >& rFrame) + : SfxPopupWindow(nId, "charmapctrl", "sfx/ui/charmapcontrol.ui", rFrame) +{ + get( m_pRecentCharView[0], "viewchar1" ); + get( m_pRecentCharView[1], "viewchar2" ); + get( m_pRecentCharView[2], "viewchar3" ); + get( m_pRecentCharView[3], "viewchar4" ); + get( m_pRecentCharView[4], "viewchar5" ); + get( m_pRecentCharView[5], "viewchar6" ); + get( m_pRecentCharView[6], "viewchar7" ); + get( m_pRecentCharView[7], "viewchar8" ); + get( m_pRecentCharView[8], "viewchar9" ); + get( m_pRecentCharView[9], "viewchar10" ); + get( m_pRecentCharView[10], "viewchar11" ); + get( m_pRecentCharView[11], "viewchar12" ); + get( m_pRecentCharView[12], "viewchar13" ); + get( m_pRecentCharView[13], "viewchar14" ); + get( m_pRecentCharView[14], "viewchar15" ); + get( m_pRecentCharView[15], "viewchar16" ); + get( maDlgBtn, "specialchardlg"); + + for(int i = 0; i < 16; i++) + { + m_pRecentCharView[i]->setMouseClickHdl(LINK(this,SfxCharmapCtrl, RecentClickHdl)); + m_pRecentCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, LoseFocusHdl)); + } + + maDlgBtn->SetClickHdl(LINK(this, SfxCharmapCtrl, OpenDlgHdl)); + + getRecentCharacterList(); + updateRecentCharControl(); +} + +SfxCharmapCtrl::~SfxCharmapCtrl() +{ + disposeOnce(); +} + + +void SfxCharmapCtrl::dispose() +{ + for(int i = 0; i < 16; i++) + m_pRecentCharView[i].clear(); + + maRecentCharList.clear(); + maRecentCharFontList.clear(); + maDlgBtn.clear(); + + SfxPopupWindow::dispose(); +} + + +void SfxCharmapCtrl::getRecentCharacterList() +{ + //retrieve recent character list + css::uno::Sequence< OUString > rRecentCharList( officecfg::Office::Common::RecentCharacters::RecentCharacterList::get() ); + for (int i = 0; i < rRecentCharList.getLength(); ++i) + { + maRecentCharList.push_back(rRecentCharList[i]); + } + + //retrieve recent character font list + css::uno::Sequence< OUString > rRecentCharFontList( officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::get() ); + for (int i = 0; i < rRecentCharFontList.getLength(); ++i) + { + maRecentCharFontList.push_back(rRecentCharFontList[i]); + } +} + +void SfxCharmapCtrl::updateRecentCharControl() +{ + int i = 0; + for ( std::deque< OUString >::iterator it = maRecentCharList.begin(), it2 = maRecentCharFontList.begin(); + it != maRecentCharList.end() || it2 != maRecentCharFontList.end(); + ++it, ++it2, i++) + { + m_pRecentCharView[i]->SetText(*it); + vcl::Font rFont = m_pRecentCharView[i]->GetControlFont(); + rFont.SetFamilyName( *it2 ); + m_pRecentCharView[i]->SetFont(rFont); + m_pRecentCharView[i]->Show(); + } + + for(; i < 16 ; i++) + { + m_pRecentCharView[i]->SetText(OUString()); + m_pRecentCharView[i]->Hide(); + } +} + +void SfxCharmapCtrl::updateRecentCharacterList(const OUString& sTitle, const OUString& rFont) +{ + auto itChar = std::find_if(maRecentCharList.begin(), + maRecentCharList.end(), + [sTitle] (const OUString & a) { return a == sTitle; }); + + auto itChar2 = std::find_if(maRecentCharFontList.begin(), + maRecentCharFontList.end(), + [rFont] (const OUString & a) { return a == rFont; }); + + // if recent char to be added is already in list, remove it + if( itChar != maRecentCharList.end() && itChar2 != maRecentCharFontList.end() ) + { + maRecentCharList.erase( itChar ); + maRecentCharFontList.erase( itChar2); + } + + if (maRecentCharList.size() == 16) + { + maRecentCharList.pop_back(); + maRecentCharFontList.pop_back(); + } + + maRecentCharList.push_front(sTitle); + maRecentCharFontList.push_front(rFont); + + css::uno::Sequence< OUString > aRecentCharList(maRecentCharList.size()); + css::uno::Sequence< OUString > aRecentCharFontList(maRecentCharFontList.size()); + + for (size_t i = 0; i < maRecentCharList.size(); ++i) + { + aRecentCharList[i] = maRecentCharList[i]; + aRecentCharFontList[i] = maRecentCharFontList[i]; + } + + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(comphelper::getProcessComponentContext())); + officecfg::Office::Common::RecentCharacters::RecentCharacterList::set(aRecentCharList, batch); + officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::set(aRecentCharFontList, batch); + batch->commit(); + + updateRecentCharControl(); +} + + +IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void) +{ + pItem.Invalidate(); +} + + +IMPL_LINK(SfxCharmapCtrl, RecentClickHdl, SvxCharView*, rView, void) +{ + rView->GrabFocus(); + rView->Invalidate(); + rView->InsertCharToDoc(); + + Close(); +} + +IMPL_LINK_NOARG(SfxCharmapCtrl, OpenDlgHdl, Button*, void) +{ + Close(); + + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + + uno::Sequence<beans::PropertyValue> aArgs(2); + aArgs[0].Name = OUString::fromUtf8("Symbols"); + aArgs[0].Value <<= OUString(); + + aArgs[1].Name = OUString::fromUtf8("FontName"); + aArgs[1].Value <<= OUString(); + //shortcut to launch dialog.. call uno command with empty arguments + comphelper::dispatchCommand(".uno:InsertSymbol", aArgs); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/charwin.cxx b/sfx2/source/control/charwin.cxx index 5f9a7fa49765..9749543af6da 100644 --- a/cui/source/dialogs/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -19,12 +19,11 @@ #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> -#include "charwin.hxx" +#include <sfx2/charwin.hxx> #include <comphelper/propertysequence.hxx> #include <comphelper/dispatchcommand.hxx> +#include <comphelper/processfactory.hxx> #include <sfx2/app.hxx> -#include "cuicharmap.hxx" -#include "macroass.hxx" using namespace com::sun::star; @@ -39,16 +38,17 @@ VCL_BUILDER_FACTORY(SvxCharView) void SvxCharView::MouseButtonDown( const MouseEvent& rMEvt ) { + Control::MouseButtonDown(rMEvt); + if ( rMEvt.IsLeft() ) { - maMouseClickHdl.Call(this); if ( !(rMEvt.GetClicks() % 2) ) { InsertCharToDoc(); } - } - Control::MouseButtonDown(rMEvt); + maMouseClickHdl.Call(this); + } } void SvxCharView::KeyInput( const KeyEvent& rKEvt ) diff --git a/sfx2/source/dialog/charmappopup.cxx b/sfx2/source/dialog/charmappopup.cxx new file mode 100644 index 000000000000..49c047dc7ee5 --- /dev/null +++ b/sfx2/source/dialog/charmappopup.cxx @@ -0,0 +1,47 @@ +/* -*- 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/charmappopup.hxx> +#include <sfx2/charmapcontrol.hxx> +#include <unotools/viewoptions.hxx> +#include <vcl/toolbox.hxx> + +SFX_IMPL_TOOLBOX_CONTROL(CharmapPopup, SfxVoidItem); + +CharmapPopup::CharmapPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) + : SfxToolBoxControl(nSlotId, nId, rTbx) +{ + rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId)); +} + +CharmapPopup::~CharmapPopup() +{ +} + +VclPtr<SfxPopupWindow> CharmapPopup::CreatePopupWindow() +{ + VclPtr<SfxCharmapCtrl> pControl = VclPtr<SfxCharmapCtrl>::Create(GetSlotId(), m_xFrame); + + pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); + + SetPopupWindow(pControl); + + return pControl; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/uiconfig/ui/charmapcontrol.ui b/sfx2/uiconfig/ui/charmapcontrol.ui new file mode 100644 index 000000000000..cc96bdc63837 --- /dev/null +++ b/sfx2/uiconfig/ui/charmapcontrol.ui @@ -0,0 +1,236 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.12"/> + <object class="GtkWindow" id="charmapctrl"> + <property name="can_focus">False</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">popup-menu</property> + <property name="skip_pager_hint">True</property> + <property name="deletable">False</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="resize_mode">queue</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Recent Characters</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_homogeneous">True</property> + <property name="column_homogeneous">True</property> + <child> + <object class="cuilo-SvxCharView" id="viewchar1"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar2"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar4"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar3"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar12"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar11"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar10"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar9"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar5"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">4</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar6"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">5</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar7"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">6</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar8"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">7</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar13"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">4</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar14"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">5</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar15"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">6</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="cuilo-SvxCharView" id="viewchar16"> + <property name="width_request">35</property> + <property name="height_request">35</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">7</property> + <property name="top_attach">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="specialchardlg"> + <property name="label" translatable="yes">Launch Dialog</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> +</interface> diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index 58c5c9581c10..27c200944c0f 100644 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -184,6 +184,11 @@ interface _Annotation DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + SID_CHARMAP_CONTROL + [ + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + SID_ATTR_PARA_LRSPACE [ ExecMethod = Exec; diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index b15de6f2cfeb..b592cb0495dc 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -175,6 +175,13 @@ interface BaseText StateMethod = GetState ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + + SID_CHARMAP_CONTROL + [ + StateMethod = GetState ; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + FN_INSERT_PAGEHEADER // status(final|play|rec) [ ExecMethod = Execute ; diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 2705712edb93..b24f0e8e43f2 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -108,6 +108,11 @@ interface TextDrawText DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + SID_CHARMAP_CONTROL + [ + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + FN_INSERT_STRING [ ExecMethod = ExecDraw ; diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index e9b4cb53b571..41b2712d87fb 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -51,6 +51,7 @@ #include <svx/hyperdlg.hxx> #include <svx/modctrl.hxx> #include <sfx2/emojipopup.hxx> +#include <sfx2/charmappopup.hxx> #include <com/sun/star/scanner/ScannerManager.hpp> #include <com/sun/star/linguistic2/LanguageGuessing.hpp> #include <comphelper/processfactory.hxx> @@ -357,6 +358,8 @@ void SwDLL::RegisterControls() SvxRubyChildWindow::RegisterChildWindow( false, pMod); SwSpellDialogChildWindow::RegisterChildWindow(false, pMod); + CharmapPopup::RegisterControl(SID_CHARMAP_CONTROL, pMod ); + SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod ); SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod ); SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod ); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 028180000f42..508c50232003 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1444,6 +1444,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case FN_EDIT_FORMULA: case SID_CHARMAP: case SID_EMOJI_CONTROL: + case SID_CHARMAP_CONTROL: { const SelectionType nType = rSh.GetSelectionType(); if (!(nType & SelectionType::Text) && diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index a0eda8b5d33f..da2bf45e39f5 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -552,7 +552,7 @@ void SwView::CheckReadonlyState() SID_REDO, SID_REPEAT, SID_PASTE, SID_PASTE_UNFORMATTED, SID_PASTE_SPECIAL, SID_SBA_BRW_INSERT, - SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK, + SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK, SID_CHARMAP_CONTROL, SID_CHARMAP, SID_EMOJI_CONTROL, FN_INSERT_SOFT_HYPHEN, FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_BREAK, FN_INSERT_LINEBREAK, FN_INSERT_COLUMN_BREAK, FN_INSERT_BREAK_DLG, diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml index 025ebbb0cd42..58caadc73193 100644 --- a/sw/uiconfig/swriter/toolbar/standardbar.xml +++ b/sw/uiconfig/swriter/toolbar/standardbar.xml @@ -61,6 +61,7 @@ <toolbar:toolbaritem xlink:href=".uno:InsertFieldCtrl"/> <toolbar:toolbaritem xlink:href=".uno:InsertSymbol"/> <toolbar:toolbaritem xlink:href=".uno:EmojiControl" toolbar:visible="false"/> + <toolbar:toolbaritem xlink:href=".uno:CharmapControl"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:HyperlinkDialog"/> <toolbar:toolbaritem xlink:href=".uno:InsertFootnote"/> |