summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-10-07 16:15:07 +0200
committerMichael Stahl <mstahl@redhat.com>2016-10-07 16:45:46 +0200
commit41c2c9ea02e6db37fd23012873fd30d665729122 (patch)
treeb019f40ebd9f50b1af3a4d8199d3bbe194c6a68e /sfx2
parent8fab6ab36589d0dcd75d45feab43a0b06b7f2a3e (diff)
sfx2: resolve "enum ApplicationType" conflict...
... with windows.h by putting our enum into a namespace, and while we're at it convert it to enum class etc. Change-Id: I804cd82565e77e6ab9a9d3a529f1ea43379fe0be
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/recentdocsview.cxx47
-rw-r--r--sfx2/source/control/recentdocsviewitem.cxx9
-rw-r--r--sfx2/source/dialog/backingwindow.cxx14
-rw-r--r--sfx2/source/dialog/backingwindow.hxx2
4 files changed, 39 insertions, 33 deletions
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index e58003efb844..623e261af0c1 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -52,9 +52,12 @@ void SetMessageFont(vcl::RenderContext& rRenderContext)
}
+namespace sfx2
+{
+
RecentDocsView::RecentDocsView( vcl::Window* pParent )
: ThumbnailView(pParent)
- , mnFileTypes(TYPE_NONE)
+ , mnFileTypes(ApplicationType::TYPE_NONE)
, mnTextHeight(30)
, mnItemPadding(5)
, mnItemMaxTextLength(30)
@@ -86,32 +89,32 @@ bool RecentDocsView::typeMatchesExtension(ApplicationType type, const OUString &
if (rExt == "odt" || rExt == "doc" || rExt == "docx" ||
rExt == "rtf" || rExt == "txt" || rExt == "odm" || rExt == "otm")
{
- bRet = type & TYPE_WRITER;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_WRITER);
}
else if (rExt == "ods" || rExt == "xls" || rExt == "xlsx")
{
- bRet = type & TYPE_CALC;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_CALC);
}
else if (rExt == "odp" || rExt == "pps" || rExt == "ppt" ||
rExt == "pptx")
{
- bRet = type & TYPE_IMPRESS;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_IMPRESS);
}
else if (rExt == "odg")
{
- bRet = type & TYPE_DRAW;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_DRAW);
}
else if (rExt == "odb")
{
- bRet = type & TYPE_DATABASE;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_DATABASE);
}
else if (rExt == "odf")
{
- bRet = type & TYPE_MATH;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_MATH);
}
else
{
- bRet = type & TYPE_OTHER;
+ bRet = static_cast<bool>(type & ApplicationType::TYPE_OTHER);
}
return bRet;
@@ -121,13 +124,13 @@ bool RecentDocsView::isAcceptedFile(const OUString &rURL) const
{
INetURLObject aUrl(rURL);
OUString aExt = aUrl.getExtension();
- return (mnFileTypes & TYPE_WRITER && typeMatchesExtension(TYPE_WRITER, aExt)) ||
- (mnFileTypes & TYPE_CALC && typeMatchesExtension(TYPE_CALC, aExt)) ||
- (mnFileTypes & TYPE_IMPRESS && typeMatchesExtension(TYPE_IMPRESS, aExt)) ||
- (mnFileTypes & TYPE_DRAW && typeMatchesExtension(TYPE_DRAW, aExt)) ||
- (mnFileTypes & TYPE_DATABASE && typeMatchesExtension(TYPE_DATABASE,aExt)) ||
- (mnFileTypes & TYPE_MATH && typeMatchesExtension(TYPE_MATH, aExt)) ||
- (mnFileTypes & TYPE_OTHER && typeMatchesExtension(TYPE_OTHER, aExt));
+ return (mnFileTypes & ApplicationType::TYPE_WRITER && typeMatchesExtension(ApplicationType::TYPE_WRITER, aExt)) ||
+ (mnFileTypes & ApplicationType::TYPE_CALC && typeMatchesExtension(ApplicationType::TYPE_CALC, aExt)) ||
+ (mnFileTypes & ApplicationType::TYPE_IMPRESS && typeMatchesExtension(ApplicationType::TYPE_IMPRESS, aExt)) ||
+ (mnFileTypes & ApplicationType::TYPE_DRAW && typeMatchesExtension(ApplicationType::TYPE_DRAW, aExt)) ||
+ (mnFileTypes & ApplicationType::TYPE_DATABASE && typeMatchesExtension(ApplicationType::TYPE_DATABASE,aExt)) ||
+ (mnFileTypes & ApplicationType::TYPE_MATH && typeMatchesExtension(ApplicationType::TYPE_MATH, aExt)) ||
+ (mnFileTypes & ApplicationType::TYPE_OTHER && typeMatchesExtension(ApplicationType::TYPE_OTHER, aExt));
}
BitmapEx RecentDocsView::getDefaultThumbnail(const OUString &rURL)
@@ -136,17 +139,17 @@ BitmapEx RecentDocsView::getDefaultThumbnail(const OUString &rURL)
INetURLObject aUrl(rURL);
OUString aExt = aUrl.getExtension();
- if ( typeMatchesExtension( TYPE_WRITER, aExt) )
+ if (typeMatchesExtension(ApplicationType::TYPE_WRITER, aExt))
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_TEXT ) );
- else if ( typeMatchesExtension( TYPE_CALC, aExt) )
+ else if (typeMatchesExtension(ApplicationType::TYPE_CALC, aExt))
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_SHEET ) );
- else if ( typeMatchesExtension( TYPE_IMPRESS, aExt) )
+ else if (typeMatchesExtension(ApplicationType::TYPE_IMPRESS, aExt))
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_PRESENTATION ) );
- else if ( typeMatchesExtension( TYPE_DRAW, aExt) )
+ else if (typeMatchesExtension(ApplicationType::TYPE_DRAW, aExt))
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_DRAWING ) );
- else if ( typeMatchesExtension( TYPE_DATABASE, aExt) )
+ else if (typeMatchesExtension(ApplicationType::TYPE_DATABASE, aExt))
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_DATABASE ) );
- else if ( typeMatchesExtension( TYPE_MATH, aExt) )
+ else if (typeMatchesExtension(ApplicationType::TYPE_MATH, aExt))
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_MATH ) );
else
aImg = BitmapEx ( SfxResId( SFX_FILE_THUMBNAIL_DEFAULT ) );
@@ -344,4 +347,6 @@ IMPL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, void*, p, void )
delete pLoadRecentFile;
}
+} // namespace sfx2
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index fa1392d3a67d..317f9f4700e3 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -59,13 +59,14 @@ RecentDocsViewItem::RecentDocsViewItem(ThumbnailView &rView, const OUString &rUR
if (aThumbnail.IsEmpty())
{
// Use the default thumbnail if we have nothing else
- BitmapEx aExt(RecentDocsView::getDefaultThumbnail(rURL));
+ BitmapEx aExt(sfx2::RecentDocsView::getDefaultThumbnail(rURL));
Size aExtSize(aExt.GetSizePixel());
// attempt to make it appear as if it is on a piece of paper
long nPaperHeight;
long nPaperWidth;
- if( RecentDocsView::typeMatchesExtension(TYPE_IMPRESS, aURLObj.getExtension()) )
+ if (sfx2::RecentDocsView::typeMatchesExtension(
+ sfx2::ApplicationType::TYPE_IMPRESS, aURLObj.getExtension()))
{
// Swap width and height (PAPER_SCREEN_4_3 definition make it needed)
PaperInfo aInfo(PAPER_SCREEN_4_3);
@@ -210,13 +211,13 @@ void RecentDocsViewItem::OpenDocument()
// Call dispatch asynchronously as we can be destroyed while dispatch is
// executed. VCL is not able to survive this as it wants to call listeners
// after select!!!
- LoadRecentFile* pLoadRecentFile = new LoadRecentFile;
+ sfx2::LoadRecentFile *const pLoadRecentFile = new sfx2::LoadRecentFile;
pLoadRecentFile->xDispatch = xDispatch;
pLoadRecentFile->aTargetURL = aTargetURL;
pLoadRecentFile->aArgSeq = aArgsList;
pLoadRecentFile->pView.set(&mrParent);
- Application::PostUserEvent(LINK(nullptr, RecentDocsView, ExecuteHdl_Impl), pLoadRecentFile, true);
+ Application::PostUserEvent(LINK(nullptr, sfx2::RecentDocsView, ExecuteHdl_Impl), pLoadRecentFile, true);
}
}
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index d022c2e02e55..52b45188be68 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -236,24 +236,24 @@ void BackingWindow::initControls()
}
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::WRITER))
- mpAllRecentThumbnails->mnFileTypes |= TYPE_WRITER;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_WRITER;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::CALC))
- mpAllRecentThumbnails->mnFileTypes |= TYPE_CALC;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_CALC;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::IMPRESS))
- mpAllRecentThumbnails->mnFileTypes |= TYPE_IMPRESS;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_IMPRESS;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DRAW))
- mpAllRecentThumbnails->mnFileTypes |= TYPE_DRAW;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DRAW;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DATABASE))
- mpAllRecentThumbnails->mnFileTypes |= TYPE_DATABASE;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DATABASE;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::MATH))
- mpAllRecentThumbnails->mnFileTypes |= TYPE_MATH;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_MATH;
- mpAllRecentThumbnails->mnFileTypes |= TYPE_OTHER;
+ mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_OTHER;
mpAllRecentThumbnails->Reload();
mpAllRecentThumbnails->ShowTooltips( true );
mpRecentButton->SetActive(true);
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 2469409cc483..5d3259b6f367 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -79,7 +79,7 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer
VclPtr<VclBox> mpButtonsBox;
VclPtr<VclBox> mpSmallButtonsBox;
- VclPtr<RecentDocsView> mpAllRecentThumbnails;
+ VclPtr<sfx2::RecentDocsView> mpAllRecentThumbnails;
VclPtr<TemplateDefaultView> mpLocalView;
bool mbLocalViewInitialized;