sfx2/inc/sfx2/templateinfodlg.hxx | 4 sfx2/inc/sfx2/templatelocalview.hxx | 14 +++ sfx2/inc/templatedlg.hxx | 8 + sfx2/source/control/templatelocalview.cxx | 42 ++++++++- sfx2/source/control/templatelocalviewitem.cxx | 52 ++++++----- sfx2/source/dialog/templateinfodlg.cxx | 8 + sfx2/source/doc/objserv.cxx | 2 sfx2/source/doc/templatedlg.cxx | 119 ++++++++++++++++++++++---- sfx2/source/doc/templatedlg.hrc | 6 + sfx2/source/doc/templatedlg.src | 17 +++ 10 files changed, 234 insertions(+), 38 deletions(-)
New commits: commit f7ca0e46532ba10d91d0e814938423e5995fdf91 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 22:42:21 2012 -0430 Dont draw thumbnail border if theres no thumbnail to paint. Change-Id: I6ca934ccf2e1fa34e60cae3feb1564c87e69254b diff --git a/sfx2/source/control/templatelocalviewitem.cxx b/sfx2/source/control/templatelocalviewitem.cxx index f337df8..7ba1183 100644 --- a/sfx2/source/control/templatelocalviewitem.cxx +++ b/sfx2/source/control/templatelocalviewitem.cxx @@ -39,7 +39,10 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p const ThumbnailItemAttributes *pAttrs) { int nCount = 0; - int nSeqSize = 7; + int nSeqSize = 2; + + if (!maPreview1.IsEmpty()) + nSeqSize += 5; if (!maPreview2.IsEmpty()) nSeqSize += 5; @@ -91,28 +94,31 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p B2DPoint(fPosX,fPosY))); } - aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D( - createScaleTranslateB2DHomMatrix(fScaleX,fScaleY,aPos.X(),aPos.Y()), - FillBitmapAttribute(maPreview1, - B2DPoint(0,0), - B2DVector(aImageSize.Width(),aImageSize.Height()), - false) - )); - - // draw thumbnail borders - float fWidth = aImageSize.Width()*fScaleX; - float fHeight = aImageSize.Height()*fScaleY; - float fPosX = aPos.getX(); - float fPosY = aPos.getY(); - - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY), - B2DPoint(fPosX+fWidth,fPosY))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY), - B2DPoint(fPosX+fWidth,fPosY+fHeight))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY+fHeight), - B2DPoint(fPosX,fPosY+fHeight))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY+fHeight), - B2DPoint(fPosX,fPosY))); + if (!maPreview1.IsEmpty()) + { + aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D( + createScaleTranslateB2DHomMatrix(fScaleX,fScaleY,aPos.X(),aPos.Y()), + FillBitmapAttribute(maPreview1, + B2DPoint(0,0), + B2DVector(aImageSize.Width(),aImageSize.Height()), + false) + )); + + // draw thumbnail borders + float fWidth = aImageSize.Width()*fScaleX; + float fHeight = aImageSize.Height()*fScaleY; + float fPosX = aPos.getX(); + float fPosY = aPos.getY(); + + aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY), + B2DPoint(fPosX+fWidth,fPosY))); + aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY), + B2DPoint(fPosX+fWidth,fPosY+fHeight))); + aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY+fHeight), + B2DPoint(fPosX,fPosY+fHeight))); + aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY+fHeight), + B2DPoint(fPosX,fPosY))); + } // Draw centered text below thumbnail aPos = maTextPos; commit 223506761c5cf01c2a114afc2156e94f80464dce Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 22:16:50 2012 -0430 Disable general manager actions while in save mode. Change-Id: I46496f75b7a9f441c989f8a750ecc675781162af diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 75fc4cf..7d6940c 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -41,6 +41,8 @@ public: ~SfxTemplateManagerDlg (); + void setSaveMode (bool bMode); + void setDocumentModel (const com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel); DECL_LINK(ViewAllHdl, void*); @@ -138,6 +140,7 @@ private: std::set<const ThumbnailViewItem*> maSelTemplates; std::set<const ThumbnailViewItem*> maSelFolders; + bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not. com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; com::sun::star::uno::Reference< com::sun::star::frame::XComponentLoader > mxDesktop; }; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 5f6bd77..6a25743 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -805,6 +805,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) { SfxTemplateManagerDlg aDlg(NULL); aDlg.setDocumentModel(GetModel()); + aDlg.setSaveMode(true); aDlg.Execute(); } else diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index a4a39cd..9e17da4 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -114,6 +114,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpSearchView(new TemplateSearchView(this)), maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))), mpOnlineView(new TemplateOnlineView(this, WB_VSCROLL,false)), + mbIsSaveMode(false), mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ) { maButtonSelMode.SetStyle(maButtonSelMode.GetStyle() | WB_TOGGLE); @@ -271,6 +272,24 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg () delete mpTemplateDefaultMenu; } +void SfxTemplateManagerDlg::setSaveMode(bool bMode) +{ + mbIsSaveMode = bMode; + + if (bMode) + { + mpViewBar->ShowItem(TBI_TEMPLATE_SAVE); + mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); + mpViewBar->HideItem(TBI_TEMPLATE_REPOSITORY); + } + else + { + mpViewBar->HideItem(TBI_TEMPLATE_SAVE); + mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT); + mpViewBar->ShowItem(TBI_TEMPLATE_REPOSITORY); + } +} + void SfxTemplateManagerDlg::setDocumentModel(const uno::Reference<frame::XModel> &rModel) { m_xModel = rModel; @@ -468,7 +487,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt { if (pItem->isSelected()) { - if (maSelFolders.empty()) + if (maSelFolders.empty() && !mbIsSaveMode) { mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT); mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL); @@ -480,7 +499,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt { maSelFolders.erase(pItem); - if (maSelFolders.empty()) + if (maSelFolders.empty() && !mbIsSaveMode) { mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL); @@ -494,17 +513,20 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p { if (pItem->isSelected()) { - if (maSelTemplates.empty()) - { - mpViewBar->Show(false); - mpActionBar->Show(false); - mpTemplateBar->Show(); - } - else + if (!mbIsSaveMode) { - mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); - mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); - mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + if (maSelTemplates.empty()) + { + mpViewBar->Show(false); + mpActionBar->Show(false); + mpTemplateBar->Show(); + } + else + { + mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + } } maSelTemplates.insert(pItem); @@ -515,17 +537,20 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p { maSelTemplates.erase(pItem); - if (maSelTemplates.empty()) + if (!mbIsSaveMode) { - mpTemplateBar->Show(false); - mpViewBar->Show(); - mpActionBar->Show(); - } - else if (maSelTemplates.size() == 1) - { - mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); - mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); - mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + if (maSelTemplates.empty()) + { + mpTemplateBar->Show(false); + mpViewBar->Show(); + mpActionBar->Show(); + } + else if (maSelTemplates.size() == 1) + { + mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + } } } } diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 5b33147..db28abc 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -215,6 +215,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER ToolBoxItem { Identifier = TBI_TEMPLATE_SAVE; + Hide = TRUE; Text [ en-US ] = "Save"; }; }; commit 5fedb166239a69a407459254a68ddfad0e034126 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 21:43:30 2012 -0430 Save template in the currently open overlay. Change-Id: I8b577ee7ab73384486b4756dd303e595da9210f8 diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx index 207e1e4..03c4558 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -63,6 +63,10 @@ public: bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName); + bool saveTemplateAs (sal_uInt16 nItemId, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, + const OUString &rName); + bool saveTemplateAs (const TemplateLocalViewItem *pDstItem, com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, const OUString &rName); diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index ec8b3dc..b1d5092 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -644,6 +644,24 @@ bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nReg return false; } +bool TemplateLocalView::saveTemplateAs (sal_uInt16 nItemId, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, + const OUString &rName) +{ + bool bRet = false; + + for (size_t i = 0, n = mItemList.size(); i < n; ++i) + { + if (mItemList[i]->mnId == nItemId) + { + bRet = saveTemplateAs((const TemplateLocalViewItem*)mItemList[i],rModel,rName); + break; + } + } + + return bRet; +} + bool TemplateLocalView::saveTemplateAs(const TemplateLocalViewItem *pDstItem, com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, const OUString &rName) diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index c99cec3..a4a39cd 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -1126,6 +1126,8 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() if (maView->isOverlayVisible()) { + if (!maView->saveTemplateAs(maView->getOverlayRegionId()+1,m_xModel,aName)) + aFolderList = maView->getOverlayName(); } else { commit e7721a2312b6bc81dbb33919feb065f33e2e61f6 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 21:17:51 2012 -0430 Save a template to selected folders. Change-Id: I16969fa0b28ff5f1e5abe7e58ad8522c03b3ea4e diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx index d595196..207e1e4 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -18,6 +18,12 @@ class SfxDocumentTemplates; class TemplateLocalViewItem; +namespace com { + namespace sun { namespace star { namespace frame { + class XModel; + } } } +} + class SFX2_DLLPUBLIC TemplateLocalView : public TemplateAbstractView { public: @@ -57,6 +63,10 @@ public: bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName); + bool saveTemplateAs (const TemplateLocalViewItem *pDstItem, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, + const OUString &rName); + private: virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem); diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 17596d9..75fc4cf 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -29,6 +29,7 @@ class ToolBox; namespace com { namespace sun { namespace star { namespace frame { class XComponentLoader; + class XModel; } } } } @@ -40,6 +41,8 @@ public: ~SfxTemplateManagerDlg (); + void setDocumentModel (const com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel); + DECL_LINK(ViewAllHdl, void*); DECL_LINK(ViewDocsHdl, void*); DECL_LINK(ViewPresentsHdl, void*); @@ -135,6 +138,7 @@ private: std::set<const ThumbnailViewItem*> maSelTemplates; std::set<const ThumbnailViewItem*> maSelFolders; + com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; com::sun::star::uno::Reference< com::sun::star::frame::XComponentLoader > mxDesktop; }; diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 4e47e1f..ec8b3dc 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -22,10 +22,15 @@ #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/frame/DocumentTemplates.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XDocumentTemplates.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> +using namespace ::com::sun::star; +using namespace ::com::sun::star::frame; + void lcl_updateThumbnails (TemplateLocalViewItem *pItem); class FolderFilter_Application @@ -639,6 +644,23 @@ bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nReg return false; } +bool TemplateLocalView::saveTemplateAs(const TemplateLocalViewItem *pDstItem, + com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, + const OUString &rName) +{ + uno::Reference< frame::XStorable > xStorable(rModel, uno::UNO_QUERY_THROW ); + + uno::Reference< frame::XDocumentTemplates > xTemplates( + frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) ); + + sal_uInt16 nRegionId = pDstItem->mnId-1; + + if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(nRegionId),rName, xStorable )) + return false; + + return true; +} + void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem) { // Fill templates diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 352245a..5f6bd77 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -804,6 +804,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( aMiscOptions.IsExperimentalMode() ) { SfxTemplateManagerDlg aDlg(NULL); + aDlg.setDocumentModel(GetModel()); aDlg.Execute(); } else diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index f392feb..c99cec3 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -271,6 +271,11 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg () delete mpTemplateDefaultMenu; } +void SfxTemplateManagerDlg::setDocumentModel(const uno::Reference<frame::XModel> &rModel) +{ + m_xModel = rModel; +} + IMPL_LINK_NOARG(SfxTemplateManagerDlg,ViewAllHdl) { mpCurView->filterTemplatesByApp(FILTER_APP_NONE); @@ -1101,6 +1106,8 @@ void SfxTemplateManagerDlg::OnRepositoryDelete() void SfxTemplateManagerDlg::OnTemplateSaveAs() { + assert(m_xModel); + if (!maView->isOverlayVisible() && maSelFolders.empty()) { ErrorBox(this, WB_OK,SfxResId(STR_MSG_ERROR_SELECT_FOLDER).toString()).Execute(); @@ -1115,6 +1122,32 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() if (!aName.isEmpty()) { + OUString aFolderList; + + if (maView->isOverlayVisible()) + { + } + else + { + std::set<const ThumbnailViewItem*>::const_iterator pIter; + for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) + { + TemplateLocalViewItem *pItem = (TemplateLocalViewItem*)(*pIter); + if (!maView->saveTemplateAs(pItem,m_xModel,aName)) + { + if (aFolderList.isEmpty()) + aFolderList = (*pIter)->maTitle; + else + aFolderList = aFolderList + "\n" + (*pIter)->maTitle; + } + } + } + + maView->reload(); + + if (!aFolderList.isEmpty()) + { + } } } } commit c5b01492200b19875c1976ee6621102a7ebff1ef Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 20:39:23 2012 -0430 Show error message when trying to save without a destination folder Change-Id: Ib0ac72b5adb8544b2bd488bd3c3701898df2877d diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 14a8eab..f392feb 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -1103,6 +1103,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() { if (!maView->isOverlayVisible() && maSelFolders.empty()) { + ErrorBox(this, WB_OK,SfxResId(STR_MSG_ERROR_SELECT_FOLDER).toString()).Execute(); return; } diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc index 89a022e..9871199 100644 --- a/sfx2/source/doc/templatedlg.hrc +++ b/sfx2/source/doc/templatedlg.hrc @@ -65,6 +65,7 @@ #define STR_MSG_ERROR_DELETE_FOLDER 283 #define STR_MSG_ERROR_REPOSITORY_NAME 284 #define STR_MSG_ERROR_SAVE_SELECT 285 +#define STR_MSG_ERROR_SELECT_FOLDER 286 #define STR_INPUT_TEMPLATE_NEW 288 diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 65f7f55..5b33147 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -80,6 +80,11 @@ String STR_MSG_ERROR_REPOSITORY_NAME Text [ en-US ] = "Failed to create repository \"$1\".\nA repository with this name may already exist."; }; +String STR_MSG_ERROR_SELECT_FOLDER +{ + Text [ en-US ] = "Select the destination folder(s) to save the template."; +}; + String STR_INPUT_TEMPLATE_NEW { Text [ en-US ] = "Enter template name:"; commit 6072d114977421da17127610e4a1a5103fecb20a Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 19:02:27 2012 -0430 Add save templates command to manager. Change-Id: Ic538f23f1d8c4ba8f1a47386e1d16337cf2650c9 diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 40fa0bf..17596d9 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -82,6 +82,7 @@ private: void OnTemplateExport (); void OnFolderDelete (); void OnRepositoryDelete (); + void OnTemplateSaveAs (); void centerTopButtons (); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 403c767..14a8eab 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -347,6 +347,9 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl) else OnRepositoryDelete(); break; + case TBI_TEMPLATE_SAVE: + OnTemplateSaveAs(); + break; default: break; } @@ -1096,6 +1099,25 @@ void SfxTemplateManagerDlg::OnRepositoryDelete() } } +void SfxTemplateManagerDlg::OnTemplateSaveAs() +{ + if (!maView->isOverlayVisible() && maSelFolders.empty()) + { + return; + } + + InputDialog aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this); + + if (aDlg.Execute()) + { + OUString aName = aDlg.getEntryText(); + + if (!aName.isEmpty()) + { + } + } +} + void SfxTemplateManagerDlg::centerTopButtons() { Point aFirstBtnPos = aButtonAll.GetPosPixel(); diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc index 0b82219..89a022e 100644 --- a/sfx2/source/doc/templatedlg.hrc +++ b/sfx2/source/doc/templatedlg.hrc @@ -38,6 +38,8 @@ #define MNI_ACTION_DEFAULT 27 +#define TBI_TEMPLATE_SAVE 28 + #define STR_ACTION_REFRESH 263 #define STR_ACTION_SORT_NAME 264 @@ -62,6 +64,9 @@ #define STR_MSG_ERROR_DELETE_TEMPLATE 282 #define STR_MSG_ERROR_DELETE_FOLDER 283 #define STR_MSG_ERROR_REPOSITORY_NAME 284 +#define STR_MSG_ERROR_SAVE_SELECT 285 + +#define STR_INPUT_TEMPLATE_NEW 288 #define IMG_ACTION_SORT 304 #define IMG_ACTION_REFRESH 305 diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 60d0580..65f7f55 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -80,6 +80,11 @@ String STR_MSG_ERROR_REPOSITORY_NAME Text [ en-US ] = "Failed to create repository \"$1\".\nA repository with this name may already exist."; }; +String STR_INPUT_TEMPLATE_NEW +{ + Text [ en-US ] = "Enter template name:"; +}; + ModelessDialog DLG_TEMPLATE_MANAGER { OutputSize = TRUE; @@ -201,6 +206,12 @@ ModelessDialog DLG_TEMPLATE_MANAGER Hide = TRUE; Text [ en-US ] = "Delete"; }; + + ToolBoxItem + { + Identifier = TBI_TEMPLATE_SAVE; + Text [ en-US ] = "Save"; + }; }; }; commit e626da3c527812adcd23916489cf95f995c6ec6f Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 19:01:52 2012 -0430 Show empty folders when display all templates. Change-Id: Id78a18b00213a3963be583c2ae1b3534eb27df57 diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 53624b9..4e47e1f 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -63,7 +63,7 @@ public: } } - return nVisCount; + return meApp != FILTER_APP_NONE ? nVisCount : true ; } bool isValid (const rtl::OUString &rType) const commit 1e8ad45394fed750f893a3de0f83ff75fd8aa14e Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 17:05:39 2012 -0430 Hide commands that are only for one selected template. Change-Id: Ib785e13402ec56bdc30a554c4fef6c81803db90f diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 04bbddc..403c767 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -493,7 +493,11 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p mpTemplateBar->Show(); } else + { + mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + } maSelTemplates.insert(pItem); } @@ -510,7 +514,11 @@ IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, p mpActionBar->Show(); } else if (maSelTemplates.size() == 1) + { + mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + } } } commit 7f2dd9ce821923f4f1bb3fe5034c902cc76c372a Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Aug 14 16:49:02 2012 -0430 Close dialog when clicking the close button. Change-Id: Idc07559a2635a3fb19cfba07e564c90fad913c12 diff --git a/sfx2/inc/sfx2/templateinfodlg.hxx b/sfx2/inc/sfx2/templateinfodlg.hxx index 8fe7998..db5c11d 100644 --- a/sfx2/inc/sfx2/templateinfodlg.hxx +++ b/sfx2/inc/sfx2/templateinfodlg.hxx @@ -30,6 +30,10 @@ public: void loadDocument (const OUString &rURL); +protected: + + DECL_LINK (CloseHdl, void*); + private: PushButton maBtnClose; diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx index 40e3f14..b12d3b3 100644 --- a/sfx2/source/dialog/templateinfodlg.cxx +++ b/sfx2/source/dialog/templateinfodlg.cxx @@ -42,6 +42,8 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (Window *pParent) mpPreviewView(new Window(this)), mpInfoView(new svtools::ODocumentInfoPreview(this,WB_LEFT | WB_VSCROLL | WB_READONLY | WB_BORDER | WB_3DLOOK)) { + maBtnClose.SetClickHdl(LINK(this,SfxTemplateInfoDlg,CloseHdl)); + Size aWinSize = GetOutputSizePixel(); aWinSize.setHeight( aWinSize.getHeight() - 3*DLG_BORDER_SIZE - maBtnClose.GetOutputHeightPixel() ); aWinSize.setWidth( (aWinSize.getWidth() - 3*DLG_BORDER_SIZE)/2 ); @@ -127,4 +129,10 @@ void SfxTemplateInfoDlg::loadDocument(const OUString &rURL) } } +IMPL_LINK_NOARG (SfxTemplateInfoDlg, CloseHdl) +{ + Close(); + return 0; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits