diff options
author | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-06-02 20:37:42 +0530 |
---|---|---|
committer | Akshay Deep <akshaydeepiitr@gmail.com> | 2016-06-03 21:58:05 +0000 |
commit | b1cfb6622a415e042af27f04d6c85dba9cf02286 (patch) | |
tree | 2fc37d2ea4c37ca8da3878f8180e2961bd90a3d7 /sfx2 | |
parent | 57f8094fd312114d670ac4cdbdfd18b80b2c67e5 (diff) |
Reduce duplicate code in Template Manager
Remove ViewBar and put contents in ActionBar
Change-Id: I6551d36503f659f076ecf2b6766c6a14db771a1d
Reviewed-on: https://gerrit.libreoffice.org/25833
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit f402a06a6abd011b2be024ce3b847edfbcb82908)
Reviewed-on: https://gerrit.libreoffice.org/25876
Reviewed-by: Akshay Deep <akshaydeepiitr@gmail.com>
Tested-by: Akshay Deep <akshaydeepiitr@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 48 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/templatedlg.ui | 60 |
2 files changed, 38 insertions, 70 deletions
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 4d23086fd251..07811cf45f86 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -67,7 +67,7 @@ const char TM_SETTING_LASTAPPLICATION[] = "LastApplication"; const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess"; -const char VIEWBAR_REPOSITORY[] = "repository"; +const char ACTIONBAR_REPOSITORY[] = "repository"; const char ACTIONBAR_ACTION[] = "action_menu"; #define MNI_ACTION_NEW_FOLDER 1 @@ -170,7 +170,6 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) get(mpSearchFilter, "search_filter"); get(mpCBApp, "filter_application"); get(mpCBFolder, "filter_folder"); - get(mpViewBar, "action_view"); get(mpActionBar, "action_action"); get(mpLocalView, "template_view"); get(mpSearchView, "search_view"); @@ -205,14 +204,13 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) mpActionMenu->SetPopupMenu(MNI_ACTION_DEFAULT,mpTemplateDefaultMenu); // Set toolbox styles - mpViewBar->SetButtonType(ButtonType::SYMBOLTEXT); + mpActionBar->SetButtonType(ButtonType::SYMBOLTEXT); // Set toolbox button bits - mpViewBar->SetItemBits(mpViewBar->GetItemId(VIEWBAR_REPOSITORY), ToolBoxItemBits::DROPDOWNONLY); + mpActionBar->SetItemBits(mpActionBar->GetItemId(ACTIONBAR_REPOSITORY), ToolBoxItemBits::DROPDOWNONLY); mpActionBar->SetItemBits(mpActionBar->GetItemId(ACTIONBAR_ACTION), ToolBoxItemBits::DROPDOWNONLY); // Set toolbox handlers - mpViewBar->SetDropdownClickHdl(LINK(this,SfxTemplateManagerDlg,TBXDropdownHdl)); mpActionBar->SetDropdownClickHdl(LINK(this,SfxTemplateManagerDlg,TBXDropdownHdl)); mpLocalView->SetStyle(mpLocalView->GetStyle() | WB_VSCROLL); @@ -267,11 +265,10 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) SvtMiscOptions aMiscOptions; if ( !aMiscOptions.IsExperimentalMode() ) { - sal_uInt16 nPos = mpViewBar->GetItemPos(mpViewBar->GetItemId(VIEWBAR_REPOSITORY)); - mpViewBar->RemoveItem(nPos); + sal_uInt16 nPos = mpActionBar->GetItemPos(mpActionBar->GetItemId(ACTIONBAR_REPOSITORY)); + mpActionBar->RemoveItem(nPos); } - mpViewBar->Show(); mpActionBar->Show(); switchMainView(true); @@ -331,7 +328,6 @@ void SfxTemplateManagerDlg::dispose() mpSearchFilter.clear(); mpCBApp.clear(); mpCBFolder.clear(); - mpViewBar.clear(); mpActionBar.clear(); mpSearchView.clear(); mpCurView.clear(); @@ -527,30 +523,19 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, SelectRegionHdl, ListBox&, void) SearchUpdateHdl(*mpSearchFilter); } -IMPL_LINK_TYPED(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox, void) +IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, void) { - const sal_uInt16 nCurItemId = pBox->GetCurItemId(); + const sal_uInt16 nCurItemId = mpActionBar->GetCurItemId(); + mpActionBar->SetItemDown( nCurItemId, true ); - if (pBox == mpActionBar && nCurItemId == mpActionBar->GetItemId(ACTIONBAR_ACTION)) - { - pBox->SetItemDown( nCurItemId, true ); - - mpActionMenu->Execute(pBox, pBox->GetItemRect(nCurItemId), PopupMenuFlags::ExecuteDown); - - pBox->SetItemDown( nCurItemId, false ); - pBox->EndSelection(); - pBox->Invalidate(); - } - else if (pBox == mpViewBar && nCurItemId == mpViewBar->GetItemId(VIEWBAR_REPOSITORY)) - { - pBox->SetItemDown( nCurItemId, true ); + if (nCurItemId == mpActionBar->GetItemId(ACTIONBAR_ACTION)) + mpActionMenu->Execute(mpActionBar, mpActionBar->GetItemRect(nCurItemId), PopupMenuFlags::ExecuteDown); + else if (nCurItemId == mpActionBar->GetItemId(ACTIONBAR_REPOSITORY)) + mpRepositoryMenu->Execute(mpActionBar, mpActionBar->GetItemRect(nCurItemId), PopupMenuFlags::ExecuteDown); - mpRepositoryMenu->Execute(pBox, pBox->GetItemRect(nCurItemId), PopupMenuFlags::ExecuteDown); - - pBox->SetItemDown( nCurItemId, false ); - pBox->EndSelection(); - pBox->Invalidate(); - } + mpActionBar->SetItemDown( nCurItemId, false ); + mpActionBar->EndSelection(); + mpActionBar->Invalidate(); } IMPL_LINK_TYPED(SfxTemplateManagerDlg, TVItemStateHdl, const ThumbnailViewItem*, pItem, void) @@ -751,10 +736,7 @@ IMPL_STATIC_LINK_NOARG_TYPED(SfxTemplateManagerDlg, LinkClickHdl, Button*, void) IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, OpenRegionHdl, void*, void) { maSelTemplates.clear(); - mpOKButton->Disable(); - - mpViewBar->Show(); mpActionBar->Show(); } diff --git a/sfx2/uiconfig/ui/templatedlg.ui b/sfx2/uiconfig/ui/templatedlg.ui index 385b833019bc..ca7134ec91d4 100644 --- a/sfx2/uiconfig/ui/templatedlg.ui +++ b/sfx2/uiconfig/ui/templatedlg.ui @@ -3,21 +3,6 @@ <interface> <requires lib="gtk+" version="3.6"/> <requires lib="LibreOffice" version="1.0"/> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">sfx2/imglst/actiontemplates020.png</property> - </object> - <object class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">sfx2/imglst/actiontemplates017.png</property> - </object> - <object class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">sfx2/imglst/actionview010.png</property> - </object> <object class="GtkListStore" id="applist"> <columns> <!-- column-name gchararray1 --> @@ -41,7 +26,6 @@ </row> </data> </object> - <object class="GtkListStore" id="folderlist"> <columns> <!-- column-name gchararray1 --> @@ -53,6 +37,26 @@ </row> </data> </object> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sfx2/imglst/actiontemplates020.png</property> + </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sfx2/imglst/actiontemplates017.png</property> + </object> + <object class="GtkImage" id="image4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sfx2/imglst/actionview010.png</property> + </object> + <object class="GtkImage" id="image5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">cmd/lc_webhtml.png</property> + </object> <object class="GtkDialog" id="TemplateDialog"> <property name="width_request">800</property> <property name="height_request">600</property> @@ -291,9 +295,11 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="GtkToolbar" id="action_view"> + <object class="GtkToolbar" id="action_action"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="hexpand">True</property> <child> <object class="GtkToolButton" id="repository"> <property name="visible">True</property> @@ -308,26 +314,11 @@ <property name="homogeneous">True</property> </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkToolbar" id="action_action"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="hexpand">True</property> <child> <object class="GtkToolButton" id="action_menu"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="action_name">action_menu</property> - <property name="label" translatable="yes">Action Menu</property> - <property name="use_underline">True</property> <property name="icon_name">sfx2/imglst/actionaction013.png</property> </object> <packing> @@ -453,9 +444,4 @@ <action-widget response="0">cancel</action-widget> </action-widgets> </object> - <object class="GtkImage" id="image5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">cmd/lc_webhtml.png</property> - </object> </interface> |