diff options
Diffstat (limited to 'sfx2/source/control/templateabstractview.cxx')
-rw-r--r-- | sfx2/source/control/templateabstractview.cxx | 28 |
1 files changed, 17 insertions, 11 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) |