summaryrefslogtreecommitdiff
path: root/sfx2/source/control
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/control')
-rw-r--r--sfx2/source/control/templateabstractview.cxx28
-rw-r--r--sfx2/source/control/templatelocalview.cxx29
2 files changed, 20 insertions, 37 deletions
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index a93ccdce3c66..613f0da18536 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -12,6 +12,7 @@
#include <comphelper/processfactory.hxx>
#include <sfx2/templateview.hxx>
#include <sfx2/templateviewitem.hxx>
+#include <tools/urlobj.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/pngread.hxx>
@@ -22,32 +23,37 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-bool ViewFilter_Application::operator () (const ThumbnailViewItem *pItem)
+bool ViewFilter_Application::isValid (const OUString &rPath) const
{
- const TemplateViewItem *pTempItem = static_cast<const TemplateViewItem*>(pItem);
+ bool bRet = true;
+ INetURLObject aUrl(rPath);
+ OUString aExt = aUrl.getExtension();
if (mApp == FILTER_APP_WRITER)
{
- return pTempItem->getFileType() == "OpenDocument Text" ||
- pTempItem->getFileType() == "OpenDocument Text Template";
+ bRet = aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx";
}
else if (mApp == FILTER_APP_CALC)
{
- return pTempItem->getFileType() == "OpenDocument Spreadsheet" ||
- pTempItem->getFileType() == "OpenDocument Spreadsheet Template";
+ bRet = aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx";
}
else if (mApp == FILTER_APP_IMPRESS)
{
- return pTempItem->getFileType() == "OpenDocument Presentation" ||
- pTempItem->getFileType() == "OpenDocument Presentation Template";
+ bRet = aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx";
}
else if (mApp == FILTER_APP_DRAW)
{
- return pTempItem->getFileType() == "OpenDocument Drawing" ||
- pTempItem->getFileType() == "OpenDocument Drawing Template";
+ bRet = aExt == "otg" || aExt == "std";
}
- return true;
+ return bRet;
+}
+
+bool ViewFilter_Application::operator () (const ThumbnailViewItem *pItem)
+{
+ const TemplateViewItem *pTempItem = static_cast<const TemplateViewItem*>(pItem);
+
+ return isValid(pTempItem->getPath());
}
bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 5147014135b9..b77a57421a63 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -33,12 +33,12 @@ using namespace ::com::sun::star::frame;
static void lcl_updateThumbnails (TemplateLocalViewItem *pItem);
-class FolderFilter_Application
+class FolderFilter_Application : public ViewFilter_Application
{
public:
FolderFilter_Application (FILTER_APPLICATION eApp)
- : meApp(eApp)
+ : ViewFilter_Application(eApp)
{
}
@@ -56,7 +56,7 @@ public:
for (size_t i = 0, n = rTemplates.size(); i < n; ++i)
{
- if (isValid(rTemplates[i].aType))
+ if (isValid(rTemplates[i].aPath))
{
++nVisCount;
if ( pFolderItem->maPreview1.IsEmpty( ) )
@@ -77,29 +77,6 @@ public:
return meApp != FILTER_APP_NONE ? nVisCount : true ;
}
- bool isValid (const OUString &rType) const
- {
- bool bRet = true;
-
- if (meApp == FILTER_APP_WRITER)
- {
- bRet = rType == "OpenDocument Text" || rType == "OpenDocument Text Template";
- }
- else if (meApp == FILTER_APP_CALC)
- {
- bRet = rType == "OpenDocument Spreadsheet" || rType == "OpenDocument Spreadsheet Template";
- }
- else if (meApp == FILTER_APP_IMPRESS)
- {
- bRet = rType == "OpenDocument Presentation" || rType == "OpenDocument Presentation Template";
- }
- else if (meApp == FILTER_APP_DRAW)
- {
- bRet = rType == "OpenDocument Drawing" || rType == "OpenDocument Drawing Template";
- }
-
- return bRet;
- }
private: