dev/null |binary sfx2/inc/sfx2/templateonlineview.hxx | 5 + sfx2/inc/templatedlg.hxx | 1 sfx2/source/control/templateonlineview.cxx | 37 +++++++++++++ sfx2/source/doc/templatedlg.cxx | 79 +++++------------------------ sfx2/source/doc/templatedlg.hrc | 11 ---- sfx2/source/doc/templatedlg.src | 63 ----------------------- 7 files changed, 56 insertions(+), 140 deletions(-)
New commits: commit 7eaabb2db296e2bdb67d633dd68209f23167243e Author: Rafael Dominguez <[email protected]> Date: Sun Aug 5 07:59:38 2012 -0430 Remove create template menu and associated icons. Change-Id: Ifb2c2a640de7961ef215c9359f53218cee9c9c0e diff --git a/icon-themes/galaxy/sfx2/res/create_draw.png b/icon-themes/galaxy/sfx2/res/create_draw.png deleted file mode 100644 index f99e503..0000000 Binary files a/icon-themes/galaxy/sfx2/res/create_draw.png and /dev/null differ diff --git a/icon-themes/galaxy/sfx2/res/create_present.png b/icon-themes/galaxy/sfx2/res/create_present.png deleted file mode 100644 index f3e7e26..0000000 Binary files a/icon-themes/galaxy/sfx2/res/create_present.png and /dev/null differ diff --git a/icon-themes/galaxy/sfx2/res/create_sheet.png b/icon-themes/galaxy/sfx2/res/create_sheet.png deleted file mode 100644 index e317659..0000000 Binary files a/icon-themes/galaxy/sfx2/res/create_sheet.png and /dev/null differ diff --git a/icon-themes/galaxy/sfx2/res/create_text.png b/icon-themes/galaxy/sfx2/res/create_text.png deleted file mode 100644 index 35bc877..0000000 Binary files a/icon-themes/galaxy/sfx2/res/create_text.png and /dev/null differ diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index e22fe8c..ffbfc31 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -120,7 +120,6 @@ private: TemplateAbstractView *mpCurView; TemplateLocalView *maView; TemplateOnlineView *mpOnlineView; - PopupMenu *mpCreateMenu; PopupMenu *mpActionMenu; PopupMenu *mpRepositoryMenu; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 0b851a2..5c1b666 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -109,13 +109,6 @@ 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(),SfxResId(IMG_CREATE_TEXT)); - mpCreateMenu->InsertItem(MNI_CREATE_SHEET,SfxResId(STR_CREATE_SHEET).toString(),SfxResId(IMG_CREATE_SHEET)); - mpCreateMenu->InsertItem(MNI_CREATE_PRESENT,SfxResId(STR_CREATE_PRESENT).toString(),SfxResId(IMG_CREATE_PRESENT)); - mpCreateMenu->InsertItem(MNI_CREATE_DRAW,SfxResId(STR_CREATE_DRAW).toString(),SfxResId(IMG_CREATE_DRAW)); - mpCreateMenu->SetSelectHdl(LINK(this, SfxTemplateManagerDlg, MenuSelectHdl)); - mpActionMenu = new PopupMenu; mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT)); mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl)); @@ -154,7 +147,6 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) // Set toolbox button bits mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false); - mpViewBar->SetItemBits(TBI_TEMPLATE_CREATE, TIB_DROPDOWNONLY); mpViewBar->SetItemBits(TBI_TEMPLATE_REPOSITORY, TIB_DROPDOWNONLY); mpActionBar->SetItemBits(TBI_TEMPLATE_ACTION, TIB_DROPDOWNONLY); mpTemplateBar->SetItemBits(TBI_TEMPLATE_MOVE,TIB_DROPDOWNONLY); @@ -268,7 +260,6 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg () delete mpSearchView; delete maView; delete mpOnlineView; - delete mpCreateMenu; delete mpActionMenu; delete mpRepositoryMenu; } @@ -398,16 +389,6 @@ IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox) 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; case TBI_TEMPLATE_ACTION: pBox->SetItemDown( nCurItemId, true ); @@ -527,22 +508,6 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu) switch(nMenuId) { - case MNI_CREATE_TEXT: - lcl_createTemplate(mxDesktop,FILTER_APP_WRITER); - Close( ); - break; - case MNI_CREATE_SHEET: - lcl_createTemplate(mxDesktop,FILTER_APP_CALC); - Close( ); - break; - case MNI_CREATE_PRESENT: - lcl_createTemplate(mxDesktop,FILTER_APP_IMPRESS); - Close( ); - break; - case MNI_CREATE_DRAW: - lcl_createTemplate(mxDesktop,FILTER_APP_DRAW); - Close( ); - break; case MNI_ACTION_SORT_NAME: if (maView->isOverlayVisible()) maView->sortOverlayItems(SortView_Name()); @@ -1087,34 +1052,4 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) SearchUpdateHdl(mpSearchEdit); } -void lcl_createTemplate(uno::Reference< com::sun::star::frame::XComponentLoader > xDesktop, - const FILTER_APPLICATION eApp) -{ - rtl::OUString aURL; - - switch(eApp) - { - case FILTER_APP_WRITER: - aURL = "private:factory/swriter"; - break; - case FILTER_APP_CALC: - aURL = "private:factory/scalc"; - break; - case FILTER_APP_IMPRESS: - aURL = "private:factory/simpress"; - break; - case FILTER_APP_DRAW: - aURL = "private:factory/sdraw"; - break; - default: - break; - } - - if (!aURL.isEmpty()) - { - uno::Sequence<PropertyValue> aArgs; - xDesktop->loadComponentFromURL(aURL,rtl::OUString("_default"), 0, aArgs ); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc index c489a30..810d03d 100644 --- a/sfx2/source/doc/templatedlg.hrc +++ b/sfx2/source/doc/templatedlg.hrc @@ -16,7 +16,6 @@ #define TEMPLATE_VIEW 7 #define TBX_ACTION_VIEW 8 -#define TBI_TEMPLATE_CREATE 9 #define TBI_TEMPLATE_IMPORT 10 #define TBX_ACTION_ACTION 11 @@ -29,11 +28,6 @@ #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 MNI_ACTION_SORT_NAME 23 #define BTN_TEMPLATE_CLOSE 24 @@ -41,11 +35,6 @@ #define TBI_TEMPLATE_FOLDER_DEL 25 #define TBI_TEMPLATE_REPOSITORY 26 -#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 MNI_MOVE_NEW 265 diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index f396bac..d973e46 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -10,26 +10,6 @@ #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"; -}; - String STR_ACTION_SORT_NAME { Text [ en-US ] = "Sort by name"; @@ -135,38 +115,6 @@ ModelessDialog DLG_TEMPLATE_MANAGER TabStop = TRUE; }; - Image IMG_CREATE_TEXT - { - ImageBitmap = Bitmap - { - File = "create_text.png"; - }; - }; - - Image IMG_CREATE_SHEET - { - ImageBitmap = Bitmap - { - File = "create_sheet.png"; - }; - }; - - Image IMG_CREATE_PRESENT - { - ImageBitmap = Bitmap - { - File = "create_present.png"; - }; - }; - - Image IMG_CREATE_DRAW - { - ImageBitmap = Bitmap - { - File = "create_draw.png"; - }; - }; - Image IMG_ACTION_SORT { ImageBitmap = Bitmap @@ -186,17 +134,6 @@ ModelessDialog DLG_TEMPLATE_MANAGER { ToolBoxItem { - Identifier = TBI_TEMPLATE_CREATE; - Text [ en-US ] = "Create" ; - - ItemImage = Image - { - ImageBitmap = Bitmap { File = "create_text.png" ; }; - }; - }; - - ToolBoxItem - { Identifier = TBI_TEMPLATE_REPOSITORY; Text [ en-US ] = "Repository"; }; commit 77cb1de56a48fcc03fe8ae10964ae0cba9b5b7eb Author: Rafael Dominguez <[email protected]> Date: Sat Aug 4 15:12:53 2012 -0430 Sync template repository list with user-stored settings. Change-Id: Ia9927e637fd99a9ae97c45c930b7c5b23409ad41 diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx index 91453de..a37d762 100644 --- a/sfx2/inc/sfx2/templateonlineview.hxx +++ b/sfx2/inc/sfx2/templateonlineview.hxx @@ -38,10 +38,13 @@ public: void insertRepository (const OUString &rName, const OUString &rURL); + void syncRepositories () const; + void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding); private: + bool mbIsSynced; std::vector<TemplateOnlineViewItem*> maRepositories; com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; }; diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx index 07e79b7..bb085c6 100644 --- a/sfx2/source/control/templateonlineview.cxx +++ b/sfx2/source/control/templateonlineview.cxx @@ -53,6 +53,7 @@ enum TemplateOnlineView::TemplateOnlineView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren) : TemplateAbstractView(pParent,nWinStyle,bDisableTransientChildren) + , mbIsSynced(true) { mpItemView->SetColor(Color(COL_WHITE)); @@ -251,6 +252,31 @@ void TemplateOnlineView::insertRepository(const OUString &rName, const OUString pItem->setURL(rURL); maRepositories.push_back(pItem); + + mbIsSynced = false; +} + +void TemplateOnlineView::syncRepositories() const +{ + if (!mbIsSynced) + { + uno::Reference < uno::XComponentContext > pContext(comphelper::getProcessComponentContext()); + boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(pContext)); + + size_t nSize = maRepositories.size(); + uno::Sequence<OUString> aUrls(nSize); + uno::Sequence<OUString> aNames(nSize); + + for(size_t i = 0; i < nSize; ++i) + { + aUrls[i] = maRepositories[i]->getURL(); + aNames[i] = maRepositories[i]->maTitle; + } + + officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(aUrls, batch, pContext); + officecfg::Office::Common::Misc::FilePickerPlacesNames::set(aNames, batch, pContext); + batch->commit(); + } } void TemplateOnlineView::setItemDimensions(long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding) diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index b28d5a1..0b851a2 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -259,6 +259,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) SfxTemplateManagerDlg::~SfxTemplateManagerDlg () { + mpOnlineView->syncRepositories(); + delete mpSearchEdit; delete mpViewBar; delete mpActionBar; commit 69a748f1f085963f21c178769c97fba8bfed4db9 Author: Rafael Dominguez <[email protected]> Date: Sat Aug 4 11:27:08 2012 -0430 Implement adding new repositories through the toolbar. Change-Id: Ic16d48fb6efe3ef38c199fd62ca5c48199530d12 diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx index a3b1373..91453de 100644 --- a/sfx2/inc/sfx2/templateonlineview.hxx +++ b/sfx2/inc/sfx2/templateonlineview.hxx @@ -36,6 +36,8 @@ public: const std::vector<TemplateOnlineViewItem*>& getRepositories () const { return maRepositories; } + void insertRepository (const OUString &rName, const OUString &rURL); + void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding); private: diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx index 7fce193..07e79b7 100644 --- a/sfx2/source/control/templateonlineview.cxx +++ b/sfx2/source/control/templateonlineview.cxx @@ -242,6 +242,17 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bR return true; } +void TemplateOnlineView::insertRepository(const OUString &rName, const OUString &rURL) +{ + TemplateOnlineViewItem *pItem = new TemplateOnlineViewItem(*this,this); + + pItem->mnId = maRepositories.size()+1; + pItem->maTitle = rName; + pItem->setURL(rURL); + + maRepositories.push_back(pItem); +} + void TemplateOnlineView::setItemDimensions(long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding) { ThumbnailView::setItemDimensions(ItemWidth,ThumbnailHeight,DisplayHeight,itemPadding); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 96ab14b..b28d5a1 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -22,6 +22,7 @@ #include <sfx2/templateonlineviewitem.hxx> #include <sfx2/templateviewitem.hxx> #include <sfx2/thumbnailviewitem.hxx> +#include <svtools/PlaceEditDialog.hxx> #include <tools/urlobj.hxx> #include <unotools/moduleoptions.hxx> #include <vcl/edit.hxx> @@ -585,6 +586,17 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu) } else if (nMenuId == MNI_REPOSITORY_NEW) { + PlaceEditDialog dlg(this); + + if (dlg.Execute()) + { + boost::shared_ptr<Place> pPlace = dlg.GetPlace(); + + mpOnlineView->insertRepository(pPlace->GetName(),pPlace->GetUrl()); + + // update repository list menu. + createRepositoryMenu(); + } } else { _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
