From 3cbdf64ad5240e6d9a73d4f7e005f7110d5e4002 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 19 May 2015 10:43:01 +0200 Subject: convert DRAWMODE constants to scoped enum Change-Id: I36cbe8057d09226f8b302963bdd94dc5600b686f --- sd/source/ui/dlg/animobjs.cxx | 8 ++--- sd/source/ui/dlg/docprev.cxx | 4 +-- sd/source/ui/docshell/docshel4.cxx | 6 ++-- sd/source/ui/inc/FrameView.hxx | 32 +++++++++---------- sd/source/ui/inc/ViewShell.hxx | 26 ++++++++-------- .../controller/SlideSorterController.cxx | 30 ++++++++---------- sd/source/ui/tools/PreviewRenderer.cxx | 12 ++++---- sd/source/ui/view/DocumentRenderer.cxx | 36 +++++++++++----------- sd/source/ui/view/sdwindow.cxx | 12 ++++---- sd/source/ui/view/viewshel.cxx | 2 +- 10 files changed, 81 insertions(+), 87 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 2137f5657574..46b9e5122555 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -117,8 +117,8 @@ void SdDisplay::DataChanged( const DataChangedEvent& rDCEvt ) const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR ); + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR ); } } @@ -560,8 +560,8 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls) const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); pVD->SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); pVD->SetDrawMode( rStyles.GetHighContrastMode() - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR ); + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR ); pVD->Erase(); pObject->SingleObjectPainter( *pVD.get() ); aBmp = BitmapEx( pVD->GetBitmap( aObjRect.TopLeft(), aObjSize ) ); diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index a9e219425dfa..4d6325384ab8 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -158,8 +158,8 @@ void SdDocPreviewWin::Paint( vcl::RenderContext& /*rRenderContext*/, const Recta SvtAccessibilityOptions aAccOptions; bool bUseContrast = aAccOptions.GetIsForPagePreviews() && Application::GetSettings().GetStyleSettings().GetHighContrastMode(); SetDrawMode( bUseContrast - ? ::sd::ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ::sd::ViewShell::OUTPUT_DRAWMODE_COLOR ); + ? ::sd::OUTPUT_DRAWMODE_CONTRAST + : ::sd::OUTPUT_DRAWMODE_COLOR ); ImpPaint( pMetaFile, this ); } diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index a11e109dd197..bed2fd7b4e97 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -115,12 +115,12 @@ SfxPrinter* DrawDocShell::GetPrinter(bool bCreate) // set output quality sal_uInt16 nQuality = aPrintItem.GetOptionsPrint().GetOutputQuality(); - sal_uLong nMode = DRAWMODE_DEFAULT; + DrawModeFlags nMode = DrawModeFlags::Default; // 1 == Grayscale, 2 == Black & White (with grayscale images) if( nQuality == 1 ) - nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT; + nMode = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill | DrawModeFlags::GrayText | DrawModeFlags::GrayBitmap | DrawModeFlags::GrayGradient; else if( nQuality == 2 ) - nMode = DRAWMODE_BLACKLINE | DRAWMODE_WHITEFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT; + nMode = DrawModeFlags::BlackLine | DrawModeFlags::WhiteFill | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap | DrawModeFlags::WhiteGradient; mpPrinter->SetDrawMode( nMode ); diff --git a/sd/source/ui/inc/FrameView.hxx b/sd/source/ui/inc/FrameView.hxx index 2aa665224ae4..1cfe9d1c5fa4 100644 --- a/sd/source/ui/inc/FrameView.hxx +++ b/sd/source/ui/inc/FrameView.hxx @@ -160,8 +160,8 @@ public: void SetSlidesPerRow(sal_uInt16 nSlides) { mnSlidesPerRow = nSlides; } sal_uInt16 GetSlidesPerRow() const { return mnSlidesPerRow; } - void SetDrawMode(sal_uLong nNewDrawMode) { mnDrawMode = nNewDrawMode; }; - sal_uLong GetDrawMode() const { return mnDrawMode; }; + void SetDrawMode(DrawModeFlags nNewDrawMode) { mnDrawMode = nNewDrawMode; }; + DrawModeFlags GetDrawMode() const { return mnDrawMode; }; void SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes); bool IsNavigatorShowingAllShapes() const { return mbIsNavigatorShowingAllShapes;} @@ -171,15 +171,15 @@ public: private: sal_uInt16 mnRefCount; - bool mbRuler; - SetOfByte maVisibleLayers; - SetOfByte maLockedLayers; - SetOfByte maPrintableLayers; - SdrHelpLineList maStandardHelpLines; - SdrHelpLineList maNotesHelpLines; - SdrHelpLineList maHandoutHelpLines; - bool mbNoColors; ///< structuring mode - bool mbNoAttribs; ///< structuring mode + bool mbRuler; + SetOfByte maVisibleLayers; + SetOfByte maLockedLayers; + SetOfByte maPrintableLayers; + SdrHelpLineList maStandardHelpLines; + SdrHelpLineList maNotesHelpLines; + SdrHelpLineList maHandoutHelpLines; + bool mbNoColors; ///< structuring mode + bool mbNoAttribs; ///< structuring mode Rectangle maVisArea; ///< visible area PageKind mePageKind; ///< kind of page (standard, notes, handout) sal_uInt16 mnSelectedPage; @@ -189,14 +189,14 @@ private: EditMode meNotesEditMode; ///< edit mode in notes mode (Page/MasterPage) EditMode meHandoutEditMode; ///< edit mode in handout mode (Page/MasterPage) EditMode meEditModeOnLoad; - bool mbLayerMode; ///< layer on/off - bool mbQuickEdit; ///< QuickEdit on/off - bool mbDoubleClickTextEdit; ///< text mode after double click - bool mbClickChangeRotation; ///< single click switches between selection/rotation mode + bool mbLayerMode; ///< layer on/off + bool mbQuickEdit; ///< QuickEdit on/off + bool mbDoubleClickTextEdit; ///< text mode after double click + bool mbClickChangeRotation; ///< single click switches between selection/rotation mode sal_uInt16 mnPresViewShellId; ///< ViewShell from which the presentation was started sal_uInt16 mnSlotId; ///< SlotId, which was initial mentioned sal_uInt16 mnSlidesPerRow; ///< slides per row on the slide-desk - sal_uLong mnDrawMode; ///< draw mode for the normal window + DrawModeFlags mnDrawMode; ///< draw mode for the normal window /** Remember whether the navigator shows all shapes () or only the names ones (). Not persistent. */ diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 5019f3cca85e..49417b642797 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -64,6 +64,19 @@ class ZoomList; #undef OUTPUT_DRAWMODE_COLOR #undef OUTPUT_DRAWMODE_CONTRAST +static const DrawModeFlags OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default; +static const DrawModeFlags OUTPUT_DRAWMODE_GRAYSCALE + = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill + | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap + | DrawModeFlags::GrayGradient; +static const DrawModeFlags OUTPUT_DRAWMODE_BLACKWHITE + = DrawModeFlags::BlackLine | DrawModeFlags::BlackText + | DrawModeFlags::WhiteFill | DrawModeFlags::GrayBitmap + | DrawModeFlags::WhiteGradient; +static const DrawModeFlags OUTPUT_DRAWMODE_CONTRAST + = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill + | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient; + /** Base class of the stacked shell hierarchy.

Despite its name this class is not a descendant of SfxViewShell @@ -98,19 +111,6 @@ public: static const int MAX_VSPLIT_CNT = 1; static const int MIN_SCROLLBAR_SIZE = 50; - static const sal_uLong OUTPUT_DRAWMODE_COLOR = DRAWMODE_DEFAULT; - static const sal_uLong OUTPUT_DRAWMODE_GRAYSCALE - = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL - | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP - | DRAWMODE_GRAYGRADIENT; - static const int OUTPUT_DRAWMODE_BLACKWHITE - = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT - | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP - | DRAWMODE_WHITEGRADIENT; - static const int OUTPUT_DRAWMODE_CONTRAST - = DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL - | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT; - TYPEINFO_OVERRIDE(); ViewShell ( diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index a8412772b79b..316189fd0c2e 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -581,9 +581,9 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent*, pEvent) cache::PageCacheManager::Instance()->InvalidateAllCaches(); // Update the draw mode. - sal_uLong nDrawMode (Application::GetSettings().GetStyleSettings().GetHighContrastMode() - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR); + DrawModeFlags nDrawMode (Application::GetSettings().GetStyleSettings().GetHighContrastMode() + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR); if (mrSlideSorter.GetViewShell() != NULL) mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode); if (pActiveWindow != nullptr) @@ -635,23 +635,17 @@ void SlideSorterController::GetCtrlState (SfxItemSet& rSet) { if (mrSlideSorter.GetContentWindow()) { - sal_uLong nMode = mrSlideSorter.GetContentWindow()->GetDrawMode(); + DrawModeFlags nMode = mrSlideSorter.GetContentWindow()->GetDrawMode(); sal_uInt16 nQuality = 0; - switch (nMode) - { - case ViewShell::OUTPUT_DRAWMODE_COLOR: - nQuality = 0; - break; - case ViewShell::OUTPUT_DRAWMODE_GRAYSCALE: - nQuality = 1; - break; - case ViewShell::OUTPUT_DRAWMODE_BLACKWHITE: - nQuality = 2; - break; - case ViewShell::OUTPUT_DRAWMODE_CONTRAST: - nQuality = 3; - break; + if (nMode == sd::OUTPUT_DRAWMODE_COLOR) { + nQuality = 0; + } else if (nMode == sd::OUTPUT_DRAWMODE_GRAYSCALE) { + nQuality = 1; + } else if (nMode == sd::OUTPUT_DRAWMODE_BLACKWHITE) { + nQuality = 2; + } else if (nMode == sd::OUTPUT_DRAWMODE_CONTRAST) { + nQuality = 3; } rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_COLOR, nQuality==0)); diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index e6034a87482c..66032635a626 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -164,8 +164,8 @@ Image PreviewRenderer::RenderSubstitution ( const bool bUseContrast ( Application::GetSettings().GetStyleSettings().GetHighContrastMode()); mpPreviewDevice->SetDrawMode (bUseContrast - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR); + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR); // Set a map mode that makes a typical substitution text completely // visible. @@ -234,8 +234,8 @@ bool PreviewRenderer::Initialize ( bool bUseContrast (bObeyHighContrastMode && Application::GetSettings().GetStyleSettings().GetHighContrastMode()); mpPreviewDevice->SetDrawMode (bUseContrast - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR); + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR); mpPreviewDevice->SetSettings(Application::GetSettings()); // Tell the view to show the given page. @@ -447,8 +447,8 @@ Image PreviewRenderer::ScaleBitmap ( bool bUseContrast = Application::GetSettings().GetStyleSettings(). GetHighContrastMode(); mpPreviewDevice->SetDrawMode (bUseContrast - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR); + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR); // Set output size. Size aSize (rBitmapEx.GetSizePixel()); diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index c9b38a6c6b99..05b164a72ec7 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -259,7 +259,7 @@ namespace { Printer* pPrinter, const bool bPrintMarkedOnly) : mpPrinter(pPrinter), - mnDrawMode(DRAWMODE_DEFAULT), + mnDrawMode(DrawModeFlags::Default), msTimeDate(), msPageString(), maPrintSize(0,0), @@ -270,7 +270,7 @@ namespace { {} const VclPtr mpPrinter; - sal_uLong mnDrawMode; + DrawModeFlags mnDrawMode; OUString msTimeDate; OUString msPageString; Size maPrintSize; @@ -653,7 +653,7 @@ namespace { const bool bPrintMarkedOnly, const OUString& rsPageString, const Point& rPageStringOffset, - const sal_uLong nDrawMode, + const DrawModeFlags nDrawMode, const Orientation eOrientation, const sal_uInt16 nPaperTray) : mePageKind(ePageKind), @@ -678,7 +678,7 @@ namespace { const SetOfByte& rVisibleLayers, const SetOfByte& rPrintableLayers) const = 0; - sal_uLong GetDrawMode() const { return mnDrawMode; } + DrawModeFlags GetDrawMode() const { return mnDrawMode; } Orientation GetOrientation() const { return meOrientation; } sal_uInt16 GetPaperTray() const { return mnPaperTray; } @@ -688,7 +688,7 @@ namespace { const bool mbPrintMarkedOnly; const OUString msPageString; const Point maPageStringOffset; - const sal_uLong mnDrawMode; + const DrawModeFlags mnDrawMode; const Orientation meOrientation; const sal_uInt16 mnPaperTray; }; @@ -706,7 +706,7 @@ namespace { const bool bPrintMarkedOnly, const OUString& rsPageString, const Point& rPageStringOffset, - const sal_uLong nDrawMode, + const DrawModeFlags nDrawMode, const Orientation eOrientation, const sal_uInt16 nPaperTray) : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, rsPageString, @@ -760,7 +760,7 @@ namespace { const bool bPrintMarkedOnly, const OUString& rsPageString, const Point& rPageStringOffset, - const sal_uLong nDrawMode, + const DrawModeFlags nDrawMode, const Orientation eOrientation, const sal_uInt16 nPaperTray) : PrinterPage(ePageKind, MapMode(), bPrintMarkedOnly, rsPageString, @@ -843,7 +843,7 @@ namespace { const PageKind ePageKind, const MapMode& rMapMode, const bool bPrintMarkedOnly, - const sal_uLong nDrawMode, + const DrawModeFlags nDrawMode, const Orientation eOrientation, const sal_uInt16 nPaperTray) : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, "", @@ -917,7 +917,7 @@ namespace { const MapMode& rMapMode, const OUString& rsPageString, const Point& rPageStringOffset, - const sal_uLong nDrawMode, + const DrawModeFlags nDrawMode, const Orientation eOrientation, const sal_uInt16 nPaperTray) : PrinterPage(PK_HANDOUT, rMapMode, false, rsPageString, @@ -1059,7 +1059,7 @@ namespace { const MapMode& rMapMode, const OUString& rsPageString, const Point& rPageStringOffset, - const sal_uLong nDrawMode, + const DrawModeFlags nDrawMode, const Orientation eOrientation, const sal_uInt16 nPaperTray) : PrinterPage(PK_HANDOUT, rMapMode, false, rsPageString, @@ -1269,7 +1269,7 @@ public: return; const Orientation eSavedOrientation (rPrinter.GetOrientation()); - const sal_uLong nSavedDrawMode (rPrinter.GetDrawMode()); + const DrawModeFlags nSavedDrawMode (rPrinter.GetDrawMode()); const MapMode aSavedMapMode (rPrinter.GetMapMode()); const sal_uInt16 nSavedPaperBin (rPrinter.GetPaperBin()); @@ -1452,19 +1452,19 @@ private: switch (mpOptions->GetOutputQuality()) { case 1: // Grayscale - aInfo.mnDrawMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL - | DRAWMODE_GRAYTEXT | DRAWMODE_GRAYBITMAP - | DRAWMODE_GRAYGRADIENT; + aInfo.mnDrawMode = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill + | DrawModeFlags::GrayText | DrawModeFlags::GrayBitmap + | DrawModeFlags::GrayGradient; break; case 2: // Black & White - aInfo.mnDrawMode = DRAWMODE_BLACKLINE | DRAWMODE_WHITEFILL - | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP - | DRAWMODE_WHITEGRADIENT; + aInfo.mnDrawMode = DrawModeFlags::BlackLine | DrawModeFlags::WhiteFill + | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap + | DrawModeFlags::WhiteGradient; break; default: - aInfo.mnDrawMode = DRAWMODE_DEFAULT; + aInfo.mnDrawMode = DrawModeFlags::Default; } if (mpOptions->IsDraw()) diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 2cacce07f01b..c9c4bfe15b61 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -81,8 +81,8 @@ Window::Window(vcl::Window* pParent) // adjust contrast mode initially bool bUseContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); SetDrawMode( bUseContrast - ? ViewShell::OUTPUT_DRAWMODE_CONTRAST - : ViewShell::OUTPUT_DRAWMODE_COLOR ); + ? sd::OUTPUT_DRAWMODE_CONTRAST + : sd::OUTPUT_DRAWMODE_COLOR ); // set Help ID // SetHelpId(HID_SD_WIN_DOCUMENT); @@ -777,13 +777,13 @@ void Window::DataChanged( const DataChangedEvent& rDCEvt ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); SvtAccessibilityOptions aAccOptions; - sal_uLong nOutputMode; - sal_uInt16 nPreviewSlot; + DrawModeFlags nOutputMode; + sal_uInt16 nPreviewSlot; if( rStyleSettings.GetHighContrastMode() ) - nOutputMode = ViewShell::OUTPUT_DRAWMODE_CONTRAST; + nOutputMode = sd::OUTPUT_DRAWMODE_CONTRAST; else - nOutputMode = ViewShell::OUTPUT_DRAWMODE_COLOR; + nOutputMode = sd::OUTPUT_DRAWMODE_COLOR; if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() ) nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST; diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index b7b0694dc69a..402c9a05d409 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1300,7 +1300,7 @@ void ViewShell::ExecReq( SfxRequest& rReq ) case SID_OUTPUT_QUALITY_BLACKWHITE: case SID_OUTPUT_QUALITY_CONTRAST: { - sal_uLong nMode = OUTPUT_DRAWMODE_COLOR; + DrawModeFlags nMode = OUTPUT_DRAWMODE_COLOR; switch( nSlot ) { -- cgit