[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - 3 commits - sfx2/inc sfx2/source
Rafael Dominguez
venccsralph at gmail.com
Mon Apr 8 00:38:12 PDT 2013
sfx2/inc/sfx2/templateabstractview.hxx | 3 +
sfx2/inc/sfx2/templatelocalview.hxx | 2 +
sfx2/inc/sfx2/templateremoteview.hxx | 2 +
sfx2/source/control/templatelocalview.cxx | 5 ++
sfx2/source/control/templateremoteview.cxx | 5 ++
sfx2/source/doc/templatedlg.cxx | 52 ++++++++++++++++++++++++++---
6 files changed, 65 insertions(+), 4 deletions(-)
New commits:
commit b6ec9b44fd7d4f6064f6eb407a75b1fcdb030ebf
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Mar 27 16:59:50 2013 -0430
Display create template folder only when its allowed.
Change-Id: I892cfd88907ac4588e882e3a89c4feb200ce6744
Reviewed-on: https://gerrit.libreoffice.org/3246
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 4eeafa0..1df856d 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -94,6 +94,9 @@ public:
virtual void showRegion (ThumbnailViewItem *pItem) = 0;
+ // Return if we can have regions inside the current region
+ virtual bool isNestedRegionAllowed () const = 0;
+
sal_uInt16 getCurRegionId () const;
const OUString& getCurRegionName () const;
diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index 9dccf51..762dbf5 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -55,6 +55,8 @@ public:
sal_uInt16 createRegion (const OUString &rName);
+ virtual bool isNestedRegionAllowed () const;
+
bool removeRegion (const sal_uInt16 nItemId);
bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
diff --git a/sfx2/inc/sfx2/templateremoteview.hxx b/sfx2/inc/sfx2/templateremoteview.hxx
index 3319022..0a89803 100644
--- a/sfx2/inc/sfx2/templateremoteview.hxx
+++ b/sfx2/inc/sfx2/templateremoteview.hxx
@@ -31,6 +31,8 @@ public:
bool loadRepository (TemplateRepository* pRepository, bool bRefresh);
+ virtual bool isNestedRegionAllowed () const;
+
private:
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index e7eaa98..dd472f2 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -258,6 +258,11 @@ sal_uInt16 TemplateLocalView::createRegion(const OUString &rName)
return pItem->mnId;
}
+bool TemplateLocalView::isNestedRegionAllowed() const
+{
+ return !mnCurRegionId;
+}
+
bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
{
sal_uInt16 nRegionId = USHRT_MAX;
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index a8d88f5..8fd2e87 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -190,4 +190,9 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres
return true;
}
+bool TemplateRemoteView::isNestedRegionAllowed() const
+{
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e40a7ee5768af7c65e0cea5cc619df313b749c74
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Mar 27 13:43:52 2013 -0430
Update search results when changing template type in Template Manager.
Change-Id: I52f79b5963e331332f02974dc739d631b9c359eb
Reviewed-on: https://gerrit.libreoffice.org/3245
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index f4465dd..99d083d 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -332,6 +332,10 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,ActivatePageHdl)
break;
}
mpCurView->filterItems(ViewFilter_Application(eFilter));
+
+ if (mpSearchView->IsVisible())
+ SearchUpdateHdl(NULL);
+
return 0;
}
commit de1da2122210c8bc4649071e231bbb0bd53e31d3
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Mar 27 13:38:57 2013 -0430
Filter search results by type and keyword in Template Manager.
Change-Id: I612b0b87340a50f0e5ec69ec4e8b2beba13cab36
Reviewed-on: https://gerrit.libreoffice.org/3244
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 825147a..f4465dd 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -85,18 +85,41 @@ class SearchView_Keyword
{
public:
- SearchView_Keyword (const OUString &rKeyword)
- : maKeyword(rKeyword)
+ SearchView_Keyword (const OUString &rKeyword, FILTER_APPLICATION App)
+ : maKeyword(rKeyword), meApp(App)
{}
bool operator() (const TemplateItemProperties &rItem)
{
- return rItem.aName.matchIgnoreAsciiCase(maKeyword);
+ bool bRet = true;
+
+ INetURLObject aUrl(rItem.aPath);
+ OUString aExt = aUrl.getExtension();
+
+ if (meApp == FILTER_APP_WRITER)
+ {
+ bRet = aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx";
+ }
+ else if (meApp == FILTER_APP_CALC)
+ {
+ bRet = aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx";
+ }
+ else if (meApp == FILTER_APP_IMPRESS)
+ {
+ bRet = aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx";
+ }
+ else if (meApp == FILTER_APP_DRAW)
+ {
+ bRet = aExt == "otg" || aExt == "std";
+ }
+
+ return bRet && rItem.aName.matchIgnoreAsciiCase(maKeyword);
}
private:
OUString maKeyword;
+ FILTER_APPLICATION meApp;
};
/***
@@ -664,8 +687,25 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, SearchUpdateHdl)
bool bDisplayFolder = !mpCurView->isNonRootRegionVisible();
+ FILTER_APPLICATION eFilter = FILTER_APP_NONE;
+ switch (maTabControl.GetCurPageId())
+ {
+ case FILTER_DOCS:
+ eFilter = FILTER_APP_WRITER;
+ break;
+ case FILTER_PRESENTATIONS:
+ eFilter = FILTER_APP_IMPRESS;
+ break;
+ case FILTER_SHEETS:
+ eFilter = FILTER_APP_CALC;
+ break;
+ case FILTER_DRAWS:
+ eFilter = FILTER_APP_DRAW;
+ break;
+ }
+
std::vector<TemplateItemProperties> aItems =
- maView->getFilteredItems(SearchView_Keyword(aKeyword));
+ maView->getFilteredItems(SearchView_Keyword(aKeyword,eFilter));
for (size_t i = 0; i < aItems.size(); ++i)
{
More information about the Libreoffice-commits
mailing list