include/sfx2/templatedlg.hxx | 1 sfx2/source/doc/templatedlg.cxx | 48 ++++++++++---------------------- sfx2/uiconfig/ui/templatedlg.ui | 60 +++++++++++++++------------------------- 3 files changed, 38 insertions(+), 71 deletions(-)
New commits: commit f402a06a6abd011b2be024ce3b847edfbcb82908 Author: Akshay Deep <akshaydeepi...@gmail.com> Date: Thu Jun 2 20:37:42 2016 +0530 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 <c...@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx index e404e88..d9730d1 100644 --- a/include/sfx2/templatedlg.hxx +++ b/include/sfx2/templatedlg.hxx @@ -148,7 +148,6 @@ protected: VclPtr<PushButton> mpExportButton; VclPtr<PushButton> mpImportButton; VclPtr<PushButton> mpLinkButton; - VclPtr<ToolBox> mpViewBar; VclPtr<ToolBox> mpActionBar; VclPtr<TemplateSearchView> mpSearchView; VclPtr<TemplateAbstractView> mpCurView; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 907e4c8..a05a304 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 385b833..ca7134e 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> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits