sfx2/inc/sfx2/templatelocalview.hxx | 2 sfx2/inc/templatedlg.hxx | 4 + sfx2/source/control/templatelocalview.cxx | 12 +++ sfx2/source/doc/templatedlg.cxx | 118 ++++++++++++++++++++++++------ 4 files changed, 116 insertions(+), 20 deletions(-)
New commits: commit 11dcbe9a6d81b1f5f532570f6e7c3c37bb0d4e4a Author: Rafael Dominguez <[email protected]> Date: Sat Mar 30 13:28:44 2013 -0430 Dont show import action while in save mode. Change-Id: Iafe814382ed1b52c9119893851c98bd15812fa60 Reviewed-on: https://gerrit.libreoffice.org/3258 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index b091956..948de70 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -716,7 +716,8 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl) maSelFolders.clear(); maSelTemplates.clear(); - mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed()); + if (!mbIsSaveMode) + mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed()); mpTemplateBar->Hide(); mpViewBar->Show(); commit 115ef1143dcbeefa2e0b9a4217e211dd0a470e70 Author: Rafael Dominguez <[email protected]> Date: Thu Mar 28 23:33:59 2013 -0430 fdo#60844 Remember last open folder and filter in Template Manager. Change-Id: I4513428e10aad9b8b5c0d739bd763fb2a1f0bf81 Reviewed-on: https://gerrit.libreoffice.org/3257 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx index 8490e37..2e7e400 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -42,6 +42,8 @@ public: virtual void showRegion (ThumbnailViewItem *pItem); + void showRegion (const OUString &rName); + sal_uInt16 getCurRegionItemId () const; sal_uInt16 getRegionId (size_t pos) const; diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 0156824..343a9ef 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -54,6 +54,10 @@ public: private: + void readSettings (); + + void writeSettings (); + virtual void Resize (); DECL_LINK(TBXViewHdl, void*); diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 012fdba..7ac7b69 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -159,6 +159,18 @@ void TemplateLocalView::showRegion(ThumbnailViewItem *pItem) maOpenRegionHdl.Call(NULL); } +void TemplateLocalView::showRegion(const OUString &rName) +{ + for (int i = 0, n = maRegions.size(); i < n; ++i) + { + if (maRegions[i]->maTitle == rName) + { + showRegion(maRegions[i]); + break; + } + } +} + sal_uInt16 TemplateLocalView::getCurRegionItemId() const { for (size_t i = 0; i < maRegions.size(); ++i) diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 9c81d6d..b091956 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -35,6 +35,7 @@ #include <tools/urlobj.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/pathoptions.hxx> +#include <unotools/viewoptions.hxx> #include <vcl/edit.hxx> #include <vcl/msgbox.hxx> #include <vcl/toolbox.hxx> @@ -57,6 +58,10 @@ #define PADDING_DLG_BORDER 10 +#define TM_SETTING_MANAGER "TemplateManager" +#define TM_SETTING_LASTFOLDER "LastFolder" +#define TM_SETTING_FILTER "SelectedFilter" + using namespace ::com::sun::star; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::embed; @@ -250,16 +255,19 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) createDefaultTemplateMenu(); maView->Populate(); - maView->showRootRegion(); - maView->Show(); - mpCurView->filterItems(ViewFilter_Application(FILTER_APP_WRITER)); + readSettings(); + + maView->Show(); + FreeResource(); } SfxTemplateManagerDlg::~SfxTemplateManagerDlg () { + writeSettings(); + // Synchronize the config before deleting it syncRepositories(); for (size_t i = 0, n = maRepositories.size(); i < n; ++i) @@ -339,6 +347,81 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,ActivatePageHdl) return 0; } +void SfxTemplateManagerDlg::readSettings () +{ + OUString aLastFolder; + sal_uInt16 nPageId = FILTER_DOCS; + SvtViewOptions aViewSettings( E_DIALOG, TM_SETTING_MANAGER ); + + if ( aViewSettings.Exists() ) + { + sal_uInt16 nFilter; + aViewSettings.GetUserItem(TM_SETTING_LASTFOLDER) >>= aLastFolder; + aViewSettings.GetUserItem(TM_SETTING_FILTER) >>= nFilter; + + switch (nFilter) + { + case FILTER_APP_WRITER: + nPageId = FILTER_DOCS; + break; + case FILTER_APP_IMPRESS: + nPageId = FILTER_PRESENTATIONS; + break; + case FILTER_APP_CALC: + nPageId = FILTER_SHEETS; + break; + case FILTER_APP_DRAW: + nPageId = FILTER_DRAWS; + break; + } + } + + if (!aLastFolder.getLength()) + maView->showRootRegion(); + else + maView->showRegion(aLastFolder); + + maTabControl.SelectTabPage(nPageId); +} + +void SfxTemplateManagerDlg::writeSettings () +{ + Sequence< NamedValue > aSettings(2); + + OUString aLastFolder; + + if (mpCurView == maView && maView->getCurRegionId()) + aLastFolder = maView->getRegionName(maView->getCurRegionId()-1); + + // last folder + aSettings[0].Name = TM_SETTING_LASTFOLDER; + aSettings[0].Value <<= aLastFolder; + + sal_uInt16 nFilter = FILTER_APP_WRITER; + switch (maTabControl.GetCurPageId()) + { + case FILTER_DOCS: + nFilter = FILTER_APP_WRITER; + break; + case FILTER_PRESENTATIONS: + nFilter = FILTER_APP_IMPRESS; + break; + case FILTER_SHEETS: + nFilter = FILTER_APP_CALC; + break; + case FILTER_DRAWS: + nFilter = FILTER_APP_DRAW; + break; + } + + aSettings[1].Name = TM_SETTING_FILTER; + aSettings[1].Value <<= nFilter; + + // write + SvtViewOptions aViewSettings( E_DIALOG, TM_SETTING_MANAGER ); + aViewSettings.SetUserData( aSettings ); +} + void SfxTemplateManagerDlg::Resize() { // Fit the tab page control and the toolbars commit 7e2349d6431d86aff85c22937c7497bc5c89968e Author: Rafael Dominguez <[email protected]> Date: Thu Mar 28 21:40:17 2013 -0430 Position view below toolbox and search bar when resizing Template dialog. Change-Id: I94806487f4cebde965652997a595c7263d710338 Reviewed-on: https://gerrit.libreoffice.org/3256 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 9cf663c..9c81d6d 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -341,13 +341,9 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,ActivatePageHdl) void SfxTemplateManagerDlg::Resize() { - Size aWinSize = GetSizePixel(); - // Fit the tab page control and the toolbars - Size aTabSize = maTabControl.GetSizePixel(); - aTabSize.setWidth(aWinSize.getWidth()); - maTabControl.SetSizePixel(aTabSize); - maTabControl.SetTabPageSizePixel(aWinSize); + maTabControl.SetSizePixel(GetSizePixel()); + const Size aWinSize = maTabControl.GetTabPageSizePixel(); // Calculate toolboxes size and positions Size aViewSize = mpViewBar->CalcMinimumWindowSizePixel(); @@ -367,15 +363,9 @@ void SfxTemplateManagerDlg::Resize() mpActionBar->SetPosSizePixel(aActionPos,aActionSize); mpTemplateBar->SetSizePixel(aTemplateSize); - // Set view position below toolbox Point aViewPos = maView->GetPosPixel(); aViewPos.setY(nToolbarsHeight); aViewPos.setX(0); - Size aThumbSize(aWinSize.getWidth(), maTabControl.GetTabPageSizePixel().getHeight() - aViewPos.getY()); - maView->SetPosSizePixel(aViewPos, aThumbSize); - - if (aWinSize.getHeight() < aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER) - aWinSize.setHeight(aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER); // Set search box position and size Size aSearchSize = mpSearchEdit->CalcMinimumSize(); @@ -384,11 +374,15 @@ void SfxTemplateManagerDlg::Resize() mpSearchEdit->SetSizePixel(aSearchSize); mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aViewPos.Y())); - maView->SetSizePixel(aThumbSize); - mpOnlineView->SetPosSizePixel(aViewPos,aThumbSize); - mpSearchView->SetSizePixel(aThumbSize); + if (mpSearchEdit->IsVisible()) + aViewPos.setY(aViewPos.getY() + mpSearchEdit->GetSizePixel().getHeight() ); + + // Set view position below toolbox and search box + Size aThumbSize(aWinSize.getWidth(), aWinSize.getHeight() - aViewPos.getY()); - mpCurView->Resize(); + maView->SetPosSizePixel(aViewPos,aThumbSize); + mpOnlineView->SetPosSizePixel(aViewPos,aThumbSize); + mpSearchView->SetPosSizePixel(aViewPos,aThumbSize); ModelessDialog::Resize(); } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
