[PATCH libreoffice-4-0] Filter search results by type and keyword in Template Manage...
Rafael Dominguez (via Code Review)
gerrit at gerrit.libreoffice.org
Sun Apr 7 11:52:09 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3244
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/44/3244/1
Filter search results by type and keyword in Template Manager.
Change-Id: I612b0b87340a50f0e5ec69ec4e8b2beba13cab36
---
M sfx2/source/doc/templatedlg.cxx
1 file changed, 44 insertions(+), 4 deletions(-)
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 @@
{
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 @@
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)
{
--
To view, visit https://gerrit.libreoffice.org/3244
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I612b0b87340a50f0e5ec69ec4e8b2beba13cab36
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Rafael Dominguez <venccsralph at gmail.com>
More information about the LibreOffice
mailing list