Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


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@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.