sfx2/inc/templatedlg.hxx | 8 ++- sfx2/source/doc/templatedlg.cxx | 92 +++++++++++++++++++++++++++++++++++----- sfx2/source/doc/templatedlg.hrc | 14 ++++++ sfx2/source/doc/templatedlg.src | 33 +++++++++++--- 4 files changed, 128 insertions(+), 19 deletions(-)
New commits: commit 50e90e208e53f72434d555ab926bcdf380871381 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Jun 25 17:54:02 2012 -0430 Make sure to delete allocated attributes. Change-Id: Ie441653c3204d70ecf0c8a5e23d78f5e547d4b71 diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 8a2b2ac..ee4f3a2 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -142,8 +142,13 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) SfxTemplateManagerDlg::~SfxTemplateManagerDlg () { + delete mpSearchEdit; + delete mpViewBar; + delete mpActionBar; + delete mpTemplateBar; delete maView; delete mpCreateMenu; + delete mpActionMenu; } IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewAllHdl) commit 62a5cd79db903b2afcd4cb795bd57642127fe0f5 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Jun 25 17:52:13 2012 -0430 Remove unused methods. Change-Id: I1d70a462b29bec7dcac7e4d5c2cac9f8e3af6e2f diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index ea82d78..84b3315 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -57,10 +57,8 @@ private: DECL_LINK(MenuSelectHdl, Menu*); - void OnTemplateCreate (); void OnTemplateImport (); void OnTemplateSearch (); - void OnTemplateAction (); void OnTemplateEdit (); void OnTemplateProperties (); void OnTemplateMove (); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index cfacc3b..8a2b2ac 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -192,9 +192,6 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl) { switch(mpViewBar->GetCurItemId()) { - case TBI_TEMPLATE_CREATE: - OnTemplateCreate(); - break; case TBI_TEMPLATE_IMPORT: OnTemplateImport(); break; @@ -212,9 +209,6 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXActionHdl) case TBI_TEMPLATE_SEARCH: OnTemplateSearch(); break; - case TBI_TEMPLATE_ACTION: - OnTemplateAction(); - break; default: break; } @@ -350,10 +344,6 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu) return 0; } -void SfxTemplateManagerDlg::OnTemplateCreate () -{ -} - void SfxTemplateManagerDlg::OnTemplateImport () { sal_Int16 nDialogType = @@ -455,10 +445,6 @@ void SfxTemplateManagerDlg::OnTemplateSearch () mpSearchEdit->Show(!bVisible); } -void SfxTemplateManagerDlg::OnTemplateAction () -{ -} - void SfxTemplateManagerDlg::OnTemplateEdit () { uno::Sequence< PropertyValue > aArgs(1); commit f10e1e007a3e481298649733bf83eff7d32c48d8 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Jun 25 17:49:34 2012 -0430 Display action popup menu. Change-Id: I6916be0c62385bd020ce08b314ee836f3c331d14 diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index fdf458e..ea82d78 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -81,6 +81,7 @@ private: ToolBox *mpTemplateBar; TemplateFolderView *maView; PopupMenu *mpCreateMenu; + PopupMenu *mpActionMenu; int mnSelectionCount; std::set<const ThumbnailViewItem*> maSelTemplates; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 4a9215b..cfacc3b 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -69,6 +69,10 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpCreateMenu->InsertItem(MNI_CREATE_DRAW,SfxResId(STR_CREATE_DRAW).toString()); mpCreateMenu->SetSelectHdl(LINK(this, SfxTemplateManagerDlg, MenuSelectHdl)); + mpActionMenu = new PopupMenu; + mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString()); + mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl)); + // Calculate toolboxs size and positions Size aWinSize = GetOutputSize(); Size aViewSize = mpViewBar->CalcMinimumWindowSizePixel(); @@ -92,11 +96,13 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) // Set toolbox button bits mpViewBar->SetItemBits(TBI_TEMPLATE_CREATE, TIB_DROPDOWNONLY); + mpActionBar->SetItemBits(TBI_TEMPLATE_ACTION, TIB_DROPDOWNONLY); // Set toolbox handlers mpViewBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXViewHdl)); mpViewBar->SetDropdownClickHdl(LINK(this,SfxTemplateManagerDlg,TBXDropdownHdl)); mpActionBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXActionHdl)); + mpActionBar->SetDropdownClickHdl(LINK(this,SfxTemplateManagerDlg,TBXDropdownHdl)); mpTemplateBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXTemplateHdl)); // Set view position below toolbox @@ -255,6 +261,16 @@ IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox) pBox->EndSelection(); pBox->Invalidate(); break; + case TBI_TEMPLATE_ACTION: + pBox->SetItemDown( nCurItemId, true ); + + mpActionMenu->Execute(pBox,pBox->GetItemRect(TBI_TEMPLATE_ACTION), + POPUPMENU_EXECUTE_DOWN); + + pBox->SetItemDown( nCurItemId, false ); + pBox->EndSelection(); + pBox->Invalidate(); + break; default: break; } @@ -325,6 +341,8 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu) case MNI_CREATE_DRAW: lcl_createTemplate(mxDesktop,FILTER_APP_DRAW); break; + case MNI_ACTION_SORT_NAME: + break; default: break; } diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc index 500d2dd..064e85c 100644 --- a/sfx2/source/doc/templatedlg.hrc +++ b/sfx2/source/doc/templatedlg.hrc @@ -34,9 +34,13 @@ #define MNI_CREATE_PRESENT 21 #define MNI_CREATE_DRAW 22 +#define MNI_ACTION_SORT_NAME 23 + #define STR_CREATE_TEXT 260 #define STR_CREATE_SHEET 261 #define STR_CREATE_PRESENT 262 #define STR_CREATE_DRAW 263 +#define STR_ACTION_SORT_NAME 264 + #define IMG_ONLINE_REPOSITORY 100 diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 06f1c54..e98ca37 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -30,6 +30,11 @@ String STR_CREATE_DRAW Text [ en-US ] = "Drawing Template"; }; +String STR_ACTION_SORT_NAME +{ + Text [ en-US ] = "Sort by name"; +}; + ModalDialog DLG_TEMPLATE_MANAGER { HelpId = CMD_SID_TEMPLATE_MANAGER; commit 82e89e6491cacd7f9a588f1bcd02e60bc1272915 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Jun 25 17:36:48 2012 -0430 Remove unneeded entry in action toolbar src file. Change-Id: I97ff31c527482fdb0f36bcf45b5c75802107938d diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 013b51e..06f1c54 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -152,12 +152,6 @@ ModalDialog DLG_TEMPLATE_MANAGER Identifier = TBI_TEMPLATE_ACTION; Text [en-US] = "Action Menu"; }; - - ToolBoxItem - { - Identifier = TBI_TEMPLATE_IMPORT ; - Text [ en-US ] = "Import a template" ; - }; }; }; commit 2427f3e39ce578ad9bf1771db3da9adaea6a6c76 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Jun 25 16:36:20 2012 -0430 Display create template popup menu. Change-Id: Ifd1cae2e5d76f90305ceff97dee45407046251d7 diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index d606fd4..fdf458e 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -16,6 +16,7 @@ #include <vcl/button.hxx> class Edit; +class PopupMenu; class TemplateFolderView; class ThumbnailViewItem; class ToolBox; @@ -49,10 +50,13 @@ private: DECL_LINK(TBXViewHdl, void*); DECL_LINK(TBXActionHdl, void*); DECL_LINK(TBXTemplateHdl, void*); + DECL_LINK(TBXDropdownHdl, ToolBox*); DECL_LINK(TVFolderStateHdl, const ThumbnailViewItem*); DECL_LINK(TVTemplateStateHdl, const ThumbnailViewItem*); + DECL_LINK(MenuSelectHdl, Menu*); + void OnTemplateCreate (); void OnTemplateImport (); void OnTemplateSearch (); @@ -76,6 +80,7 @@ private: ToolBox *mpActionBar; ToolBox *mpTemplateBar; TemplateFolderView *maView; + PopupMenu *mpCreateMenu; int mnSelectionCount; std::set<const ThumbnailViewItem*> maSelTemplates; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 39796dd..4a9215b 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -61,6 +61,14 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) { maButtonSelMode.SetStyle(maButtonSelMode.GetStyle() | WB_TOGGLE); + // Create popup menus + mpCreateMenu = new PopupMenu; + mpCreateMenu->InsertItem(MNI_CREATE_TEXT,SfxResId(STR_CREATE_TEXT).toString()); + mpCreateMenu->InsertItem(MNI_CREATE_SHEET,SfxResId(STR_CREATE_SHEET).toString()); + mpCreateMenu->InsertItem(MNI_CREATE_PRESENT,SfxResId(STR_CREATE_PRESENT).toString()); + mpCreateMenu->InsertItem(MNI_CREATE_DRAW,SfxResId(STR_CREATE_DRAW).toString()); + mpCreateMenu->SetSelectHdl(LINK(this, SfxTemplateManagerDlg, MenuSelectHdl)); + // Calculate toolboxs size and positions Size aWinSize = GetOutputSize(); Size aViewSize = mpViewBar->CalcMinimumWindowSizePixel(); @@ -82,8 +90,12 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpViewBar->SetButtonType(BUTTON_SYMBOLTEXT); mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT); + // Set toolbox button bits + mpViewBar->SetItemBits(TBI_TEMPLATE_CREATE, TIB_DROPDOWNONLY); + // Set toolbox handlers mpViewBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXViewHdl)); + mpViewBar->SetDropdownClickHdl(LINK(this,SfxTemplateManagerDlg,TBXDropdownHdl)); mpActionBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXActionHdl)); mpTemplateBar->SetClickHdl(LINK(this,SfxTemplateManagerDlg,TBXTemplateHdl)); @@ -125,6 +137,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) SfxTemplateManagerDlg::~SfxTemplateManagerDlg () { delete maView; + delete mpCreateMenu; } IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewAllHdl) @@ -226,6 +239,29 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXTemplateHdl) return 0; } +IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox) +{ + const sal_uInt16 nCurItemId = pBox->GetCurItemId(); + + switch(nCurItemId) + { + case TBI_TEMPLATE_CREATE: + pBox->SetItemDown( nCurItemId, true ); + + mpCreateMenu->Execute(pBox,pBox->GetItemRect(TBI_TEMPLATE_CREATE), + POPUPMENU_EXECUTE_DOWN); + + pBox->SetItemDown( nCurItemId, false ); + pBox->EndSelection(); + pBox->Invalidate(); + break; + default: + break; + } + + return 0; +} + IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pItem) { if (pItem->isSelected()) @@ -271,6 +307,31 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p return 0; } +IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu) +{ + sal_uInt16 nMenuId = pMenu->GetCurItemId(); + + switch(nMenuId) + { + case MNI_CREATE_TEXT: + lcl_createTemplate(mxDesktop,FILTER_APP_WRITER); + break; + case MNI_CREATE_SHEET: + lcl_createTemplate(mxDesktop,FILTER_APP_CALC); + break; + case MNI_CREATE_PRESENT: + lcl_createTemplate(mxDesktop,FILTER_APP_IMPRESS); + break; + case MNI_CREATE_DRAW: + lcl_createTemplate(mxDesktop,FILTER_APP_DRAW); + break; + default: + break; + } + + return 0; +} + void SfxTemplateManagerDlg::OnTemplateCreate () { } diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc index 8afc9da..500d2dd 100644 --- a/sfx2/source/doc/templatedlg.hrc +++ b/sfx2/source/doc/templatedlg.hrc @@ -29,4 +29,14 @@ #define TBI_TEMPLATE_MOVE 17 #define TBI_TEMPLATE_DELETE 18 +#define MNI_CREATE_TEXT 19 +#define MNI_CREATE_SHEET 20 +#define MNI_CREATE_PRESENT 21 +#define MNI_CREATE_DRAW 22 + +#define STR_CREATE_TEXT 260 +#define STR_CREATE_SHEET 261 +#define STR_CREATE_PRESENT 262 +#define STR_CREATE_DRAW 263 + #define IMG_ONLINE_REPOSITORY 100 diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 41c1654..013b51e 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -10,6 +10,26 @@ #include "templatedlg.hrc" #include "helpid.hrc" +String STR_CREATE_TEXT +{ + Text [ en-US ] = "Text Document Template"; +}; + +String STR_CREATE_SHEET +{ + Text [ en-US ] = "Spreedsheet Template"; +}; + +String STR_CREATE_PRESENT +{ + Text [ en-US ] = "Presentation Template"; +}; + +String STR_CREATE_DRAW +{ + Text [ en-US ] = "Drawing Template"; +}; + ModalDialog DLG_TEMPLATE_MANAGER { HelpId = CMD_SID_TEMPLATE_MANAGER; commit 4d3d46efaa93848e13422a8be7b0e2c64ba3792c Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Jun 25 14:17:38 2012 -0430 Set selection mode button tooltip. Change-Id: I83471df87217f0f3102ec0696087e26f3129012a diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 610add4..41c1654 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -72,6 +72,8 @@ ModalDialog DLG_TEMPLATE_MANAGER { ImageBitmap = Bitmap { File = "select.png" ; }; }; + + QuickHelpText [en-US] = "Enables selecting items by just clicking in the thumbnail or title."; }; Control TEMPLATE_VIEW _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits