diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2017-07-10 16:27:57 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-07-19 10:15:47 +0200 |
commit | f9efee1f87262b0088c249b2c306fb53ca729b53 (patch) | |
tree | a7cfddf1a3a3f3681633310c5767f0bb00a05c7b /sfx2 | |
parent | 30f7ce30c92e1add033cdea0a78cea5563758513 (diff) |
Favourites feature in Special characters
Change-Id: I8273b95132d48a51e841ec3792139007b4e7b55a
Reviewed-on: https://gerrit.libreoffice.org/39752
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/charmapcontrol.cxx | 67 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/charmapcontrol.ui | 201 |
2 files changed, 265 insertions, 3 deletions
diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx index 8a2af88d63c0..d8535065621b 100644 --- a/sfx2/source/control/charmapcontrol.cxx +++ b/sfx2/source/control/charmapcontrol.cxx @@ -43,18 +43,40 @@ SfxCharmapCtrl::SfxCharmapCtrl(sal_uInt16 nId, const css::uno::Reference< css::f get( m_pRecentCharView[13], "viewchar14" ); get( m_pRecentCharView[14], "viewchar15" ); get( m_pRecentCharView[15], "viewchar16" ); + + get( m_pFavCharView[0], "favchar1" ); + get( m_pFavCharView[1], "favchar2" ); + get( m_pFavCharView[2], "favchar3" ); + get( m_pFavCharView[3], "favchar4" ); + get( m_pFavCharView[4], "favchar5" ); + get( m_pFavCharView[5], "favchar6" ); + get( m_pFavCharView[6], "favchar7" ); + get( m_pFavCharView[7], "favchar8" ); + get( m_pFavCharView[8], "favchar9" ); + get( m_pFavCharView[9], "favchar10" ); + get( m_pFavCharView[10], "favchar11" ); + get( m_pFavCharView[11], "favchar12" ); + get( m_pFavCharView[12], "favchar13" ); + get( m_pFavCharView[13], "favchar14" ); + get( m_pFavCharView[14], "favchar15" ); + get( m_pFavCharView[15], "favchar16" ); + get( maDlgBtn, "specialchardlg"); for(int i = 0; i < 16; i++) { - m_pRecentCharView[i]->setMouseClickHdl(LINK(this,SfxCharmapCtrl, RecentClickHdl)); + m_pRecentCharView[i]->setMouseClickHdl(LINK(this,SfxCharmapCtrl, CharClickHdl)); m_pRecentCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, LoseFocusHdl)); + m_pFavCharView[i]->setMouseClickHdl(LINK(this,SfxCharmapCtrl, CharClickHdl)); + m_pFavCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, LoseFocusHdl)); } maDlgBtn->SetClickHdl(LINK(this, SfxCharmapCtrl, OpenDlgHdl)); getRecentCharacterList(); updateRecentCharControl(); + getFavCharacterList(); + updateFavCharControl(); } SfxCharmapCtrl::~SfxCharmapCtrl() @@ -76,6 +98,46 @@ void SfxCharmapCtrl::dispose() } +void SfxCharmapCtrl::getFavCharacterList() +{ + //retrieve recent character list + css::uno::Sequence< OUString > rFavCharList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::get() ); + for (int i = 0; i < rFavCharList.getLength(); ++i) + { + maFavCharList.push_back(rFavCharList[i]); + } + + //retrieve recent character font list + css::uno::Sequence< OUString > rFavCharFontList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::get() ); + for (int i = 0; i < rFavCharFontList.getLength(); ++i) + { + maFavCharFontList.push_back(rFavCharFontList[i]); + } +} + + +void SfxCharmapCtrl::updateFavCharControl() +{ + int i = 0; + for ( std::deque< OUString >::iterator it = maFavCharList.begin(), it2 = maFavCharFontList.begin(); + it != maFavCharList.end() || it2 != maFavCharFontList.end(); + ++it, ++it2, i++) + { + m_pFavCharView[i]->SetText(*it); + vcl::Font rFont = m_pFavCharView[i]->GetControlFont(); + rFont.SetFamilyName( *it2 ); + m_pFavCharView[i]->SetFont(rFont); + m_pFavCharView[i]->Show(); + } + + for(; i < 16 ; i++) + { + m_pFavCharView[i]->SetText(OUString()); + m_pFavCharView[i]->Hide(); + } +} + + void SfxCharmapCtrl::getRecentCharacterList() { //retrieve recent character list @@ -93,6 +155,7 @@ void SfxCharmapCtrl::getRecentCharacterList() } } + void SfxCharmapCtrl::updateRecentCharControl() { int i = 0; @@ -164,7 +227,7 @@ IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void) } -IMPL_LINK(SfxCharmapCtrl, RecentClickHdl, SvxCharView*, rView, void) +IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharView*, rView, void) { rView->GrabFocus(); rView->Invalidate(); diff --git a/sfx2/uiconfig/ui/charmapcontrol.ui b/sfx2/uiconfig/ui/charmapcontrol.ui index cc96bdc63837..defc9220c92b 100644 --- a/sfx2/uiconfig/ui/charmapcontrol.ui +++ b/sfx2/uiconfig/ui/charmapcontrol.ui @@ -218,6 +218,205 @@ </packing> </child> <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Favourites</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="cuilo-SvxCharView" id="favchar1"> + <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="favchar2"> + <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="favchar4"> + <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="favchar3"> + <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="favchar12"> + <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="favchar11"> + <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="favchar10"> + <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="favchar9"> + <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="favchar5"> + <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="favchar6"> + <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="favchar7"> + <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="favchar8"> + <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="favchar13"> + <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="favchar14"> + <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="favchar15"> + <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="favchar16"> + <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">3</property> + </packing> + </child> + <child> <object class="GtkButton" id="specialchardlg"> <property name="label" translatable="yes">Launch Dialog</property> <property name="visible">True</property> @@ -227,7 +426,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">4</property> </packing> </child> </object> |