[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 3 commits - sfx2/inc sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Dec 12 13:50:29 PST 2012
sfx2/inc/sfx2/templateabstractview.hxx | 8 ++++--
sfx2/inc/sfx2/templateproperties.hxx | 1
sfx2/inc/sfx2/templateviewitem.hxx | 5 ---
sfx2/source/control/templateabstractview.cxx | 28 ++++++++++++---------
sfx2/source/control/templatelocalview.cxx | 36 ++-------------------------
sfx2/source/control/templateremoteview.cxx | 2 -
sfx2/source/control/templateview.cxx | 1
sfx2/source/doc/docvor.cxx | 2 -
8 files changed, 27 insertions(+), 56 deletions(-)
New commits:
commit 63d9527d46d7afaf5e09f7fa0a7351dbe3059754
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Wed Dec 12 22:46:22 2012 +0100
Template manager: no need to extract file type description
Change-Id: I18d01542f009a5c6c1f688a8df04c14d3c8edc9e
diff --git a/sfx2/inc/sfx2/templateproperties.hxx b/sfx2/inc/sfx2/templateproperties.hxx
index ffa9003..0760f60 100644
--- a/sfx2/inc/sfx2/templateproperties.hxx
+++ b/sfx2/inc/sfx2/templateproperties.hxx
@@ -20,7 +20,6 @@ struct TemplateItemProperties
sal_uInt16 nRegionId;
rtl::OUString aName;
rtl::OUString aPath;
- rtl::OUString aType;
BitmapEx aThumbnail;
};
diff --git a/sfx2/inc/sfx2/templateviewitem.hxx b/sfx2/inc/sfx2/templateviewitem.hxx
index 9a7d358..b19a060 100644
--- a/sfx2/inc/sfx2/templateviewitem.hxx
+++ b/sfx2/inc/sfx2/templateviewitem.hxx
@@ -32,10 +32,6 @@ public:
const rtl::OUString& getKeywords () const { return maKeywords; }
- void setFileType (const rtl::OUString &rType) { maFileType = rType; }
-
- const rtl::OUString& getFileType () const { return maFileType; }
-
void setSubTitle (const rtl::OUString &rTitle) { maSubTitle = rTitle; }
const rtl::OUString& getSubTitle () const { return maSubTitle; }
@@ -51,7 +47,6 @@ private:
rtl::OUString maPath;
rtl::OUString maAuthor;
rtl::OUString maKeywords;
- rtl::OUString maFileType;
rtl::OUString maSubTitle;
Point maSubTitlePos;
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index b77a574..c5fb8a0 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -15,7 +15,6 @@
#include <sfx2/templateview.hxx>
#include <sfx2/templateviewitem.hxx>
#include <svl/inettype.hxx>
-#include <svtools/imagemgr.hxx>
#include <tools/urlobj.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/pngread.hxx>
@@ -122,7 +121,6 @@ void TemplateLocalView::Populate ()
{
OUString aName = mpDocTemplates->GetName(i,j);
OUString aURL = mpDocTemplates->GetPath(i,j);
- OUString aType = SvFileInformationManager::GetDescription(INetURLObject(aURL));
if ((sal_uInt32)aName.getLength() > mpItemAttrs->nMaxTextLenght)
{
@@ -136,7 +134,6 @@ void TemplateLocalView::Populate ()
aProperties.nRegionId = i;
aProperties.aName = aName;
aProperties.aPath = aURL;
- aProperties.aType = aType;
aProperties.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL,
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
@@ -372,7 +369,6 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
aTemplateItem.nRegionId = nTargetRegion;
aTemplateItem.aName = pViewItem->maTitle;
aTemplateItem.aPath = pViewItem->getPath();
- aTemplateItem.aType = pViewItem->getFileType();
aTemplateItem.aThumbnail = pViewItem->maPreview1;
pTarget->maTemplates.push_back(aTemplateItem);
@@ -467,7 +463,6 @@ bool TemplateLocalView::moveTemplates(std::set<const ThumbnailViewItem *> &rItem
aTemplateItem.nRegionId = nTargetRegion;
aTemplateItem.aName = pViewItem->maTitle;
aTemplateItem.aPath = pViewItem->getPath();
- aTemplateItem.aType = pViewItem->getFileType();
aTemplateItem.aThumbnail = pViewItem->maPreview1;
pTarget->maTemplates.push_back(aTemplateItem);
@@ -541,7 +536,6 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
aTemplate.aName = aPath;
aTemplate.aThumbnail = rThumbnail;
aTemplate.aPath = mpDocTemplates->GetPath(nRegionId,nDocId);
- aTemplate.aType = SvFileInformationManager::GetDescription(INetURLObject(aTemplate.aPath));
TemplateLocalViewItem *pItem =
static_cast<TemplateLocalViewItem*>(mItemList[i]);
@@ -584,7 +578,6 @@ bool TemplateLocalView::copyFrom (TemplateLocalViewItem *pItem, const OUString &
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
aTemplate.aPath = rPath;
- aTemplate.aType = SvFileInformationManager::GetDescription(INetURLObject(rPath));
pItem->maTemplates.push_back(aTemplate);
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 24ee41d..4f9f1e0 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -227,8 +227,6 @@ bool TemplateRemoteView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
{}
}
- aTemplateItem.aType = SvFileInformationManager::GetFileDescription(INetURLObject(sRealURL));
-
pItem->insertTemplate(aTemplateItem);
aItems.push_back(aTemplateItem);
++nIdx;
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index ff0e906..ce31003 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -126,7 +126,6 @@ void TemplateView::InsertItems (const std::vector<TemplateItemProperties> &rTemp
pItem->mnId = pCur->nId;
pItem->maTitle = pCur->aName;
pItem->setPath(pCur->aPath);
- pItem->setFileType(pCur->aType);
pItem->maPreview1 = pCur->aThumbnail;
pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected));
commit e52cec0850bf96fa324c4ed59b2329595c6df1dd
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Wed Dec 12 22:33:49 2012 +0100
Template manager: filter on extensions, file type is localized
Change-Id: I4b4a4f8aaf253e663bbeb4f061c6aa87411b730f
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 9194b8e..276b389 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -45,9 +45,13 @@ public:
: mApp(App)
{}
- bool operator () (const ThumbnailViewItem *pItem);
+ virtual ~ViewFilter_Application () {}
-private:
+ virtual bool operator () (const ThumbnailViewItem *pItem);
+
+ bool isValid (const rtl::OUString& rPath) const;
+
+protected:
FILTER_APPLICATION mApp;
};
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index a485fc2..22198f1 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>
@@ -21,32 +22,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 5147014..b77a574 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:
commit 36e0c9fa70b9bbc82688eaf8a4ef583c3a9151da
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Wed Dec 12 22:17:40 2012 +0100
oops, introduced some typos in the allowed templates extensions
Change-Id: I144141ade5ff8c719e9eb21e3b904cbbdca14f00
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index f086469..4ad9a10 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -1598,7 +1598,7 @@ String SfxOrganizeDlg_Impl::GetPath_Impl( sal_Bool bOpen, const String& rFileNam
{
if ( sFilterExt.Len() > 0 )
sFilterExt += ';';
- sFilterExt += DEFINE_CONST_UNICODE( "*.ots;*.stci;*.xlt;*.xltm;*.xltm" );
+ sFilterExt += DEFINE_CONST_UNICODE( "*.ots;*.stc;*.xlt;*.xltm;*.xltx" );
}
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
{
More information about the Libreoffice-commits
mailing list