[Libreoffice-commits] core.git: basctl/source include/sfx2 sc/source sd/source sfx2/source starmath/source sw/source

Noel Grandin noel at peralex.com
Wed Apr 15 04:36:06 PDT 2015


 basctl/source/basicide/basidesh.cxx |    9 +--------
 include/sfx2/viewsh.hxx             |   21 +++++++++++++--------
 sc/source/ui/view/prevwsh.cxx       |    2 +-
 sc/source/ui/view/tabvwsh4.cxx      |    2 +-
 sd/source/ui/view/ViewShellBase.cxx |    4 ++--
 sfx2/source/view/viewimp.hxx        |    2 +-
 sfx2/source/view/viewsh.cxx         |   17 ++++++++---------
 starmath/source/view.cxx            |    2 +-
 sw/source/uibase/uiview/pview.cxx   |    2 +-
 sw/source/uibase/uiview/srcview.cxx |    3 +--
 sw/source/uibase/uiview/view.cxx    |    3 +--
 11 files changed, 31 insertions(+), 36 deletions(-)

New commits:
commit 9782438a5887c40246016c1f2b5fe12401d2c68d
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Apr 13 11:28:49 2015 +0200

    convert SFX_VIEW constants to scoped enum
    
    Change-Id: I327dc1ec722fa9445f13fc5168ad646e272ba9d4
    Reviewed-on: https://gerrit.libreoffice.org/15300
    Tested-by: Noel Grandin <noelgrandin at gmail.com>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 604a6a8..0f234ee 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -143,17 +143,10 @@ void basctl_Shell::InitInterface_Impl()
     GetStaticInterface()->RegisterPopupMenu(IDEResId(RID_POPUP_DLGED));
 }
 
-namespace
-{
-
-unsigned const ShellFlags = SFX_VIEW_CAN_PRINT | SFX_VIEW_NO_NEWWINDOW;
-
-}
-
 unsigned Shell::nShellCount = 0;
 
 Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
-    SfxViewShell( pFrame_, ShellFlags ),
+    SfxViewShell( pFrame_, SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::NO_NEWWINDOW ),
     m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
     aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
     aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 08d3682..5acc75a 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -89,13 +89,18 @@ namespace o3tl
 
 //  @[SfxViewShell-Flags]
 
-#define SFX_VIEW_HAS_PRINTOPTIONS  0x0010 /* Options-Button and Options-
-                                             Dialog in PrintDialog */
-#define SFX_VIEW_CAN_PRINT         0x0020 /* Printing enabled without having
-                                             to create a Printer */
-#define SFX_VIEW_NO_SHOW           0x0040 /* Window of the ViewShell shall
-                                             not be showed automatically */
-#define SFX_VIEW_NO_NEWWINDOW      0x0100 /* Allow N View */
+enum class SfxViewShellFlags
+{
+    NONE              = 0x0000,
+    HAS_PRINTOPTIONS  = 0x0010, /* Options-Button and Options-Dialog in PrintDialog */
+    CAN_PRINT         = 0x0020, /* Printing enabled without having to create a Printer */
+    NO_SHOW           = 0x0040, /* Window of the ViewShell shall not be showed automatically */
+    NO_NEWWINDOW      = 0x0100, /* Allow N View */
+};
+namespace o3tl
+{
+    template<> struct typed_flags<SfxViewShellFlags> : is_typed_flags<SfxViewShellFlags, 0x0170> {};
+}
 
 /*  [Description]
 
@@ -174,7 +179,7 @@ private:
 
 public:
 
-                                SfxViewShell( SfxViewFrame *pFrame, sal_uInt16 nFlags = 0 );
+                                SfxViewShell( SfxViewFrame *pFrame, SfxViewShellFlags nFlags = SfxViewShellFlags::NONE );
     virtual                     ~SfxViewShell();
 
     SfxInPlaceClient*           GetIPClient() const;
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 29398d4..9760de2 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -149,7 +149,7 @@ void ScPreviewShell::Construct( vcl::Window* pParent )
 
 ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
                                 SfxViewShell* pOldSh ) :
-    SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ),
+    SfxViewShell( pViewFrame, SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::HAS_PRINTOPTIONS ),
     pDocShell( static_cast<ScDocShell*>(pViewFrame->GetObjectShell()) ),
     mpFrameWindow(NULL),
     nSourceDesignMode( SC_FORCEMODE_NONE ),
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index b62648e..360e23b 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1647,7 +1647,7 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode )
 
 ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
                                 SfxViewShell* pOldSh ) :
-    SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ),
+    SfxViewShell( pViewFrame, SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::HAS_PRINTOPTIONS ),
     ScDBFunc( &pViewFrame->GetWindow(), static_cast<ScDocShell&>(*pViewFrame->GetObjectShell()), this ),
     eCurOST(OST_NONE),
     nDrawSfxId(0),
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 7f55add..480262f 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -231,8 +231,8 @@ ViewShellBase::ViewShellBase (
     SfxViewFrame* _pFrame,
     SfxViewShell*)
     : SfxViewShell (_pFrame,
-          SFX_VIEW_CAN_PRINT
-        | SFX_VIEW_HAS_PRINTOPTIONS),
+          SfxViewShellFlags::CAN_PRINT
+        | SfxViewShellFlags::HAS_PRINTOPTIONS),
       maMutex(),
       mpImpl(),
       mpDocShell (NULL),
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 5d1e848..43b25d0 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -65,7 +65,7 @@ struct SfxViewShell_Impl
 
     mutable SfxInPlaceClientList* mpIPClientList;
 
-    SfxViewShell_Impl(sal_uInt16 const nFlags);
+    SfxViewShell_Impl(SfxViewShellFlags const nFlags);
     ~SfxViewShell_Impl();
 
     SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index af454dd..111b09c 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -297,15 +297,14 @@ public:
     size_t size() const { return maData.size(); }
 };
 
-SfxViewShell_Impl::SfxViewShell_Impl(sal_uInt16 const nFlags)
+SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags)
 : aInterceptorContainer( aMutex )
 ,   m_bControllerSet(false)
 ,   m_nPrinterLocks(0)
-,   m_bCanPrint(SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT))
-,   m_bHasPrintOptions(
-        SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS))
+,   m_bCanPrint(nFlags & SfxViewShellFlags::CAN_PRINT)
+,   m_bHasPrintOptions(nFlags & SfxViewShellFlags::HAS_PRINTOPTIONS)
 ,   m_bPlugInsActive(true)
-,   m_bIsShowView(SFX_VIEW_NO_SHOW != (nFlags & SFX_VIEW_NO_SHOW))
+,   m_bIsShowView(!(nFlags & SfxViewShellFlags::NO_SHOW))
 ,   m_bGotOwnership(false)
 ,   m_bGotFrameOwnership(false)
 ,   m_nFamily(0xFFFF)   // undefined, default set by TemplateDialog
@@ -1247,9 +1246,9 @@ void SfxViewShell::SetWindow
 
 SfxViewShell::SfxViewShell
 (
-    SfxViewFrame*   pViewFrame,     /*  <SfxViewFrame>, which will be
-                                        displayed in this View */
-    sal_uInt16          nFlags          /*  See <SfxViewShell-Flags> */
+    SfxViewFrame*     pViewFrame,     /*  <SfxViewFrame>, which will be
+                                          displayed in this View */
+    SfxViewShellFlags nFlags          /*  See <SfxViewShell-Flags> */
 )
 
 :   SfxShell(this)
@@ -1257,7 +1256,7 @@ SfxViewShell::SfxViewShell
 ,   pFrame(pViewFrame)
 ,   pSubShell(0)
 ,   pWindow(0)
-,   bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) )
+,   bNoNewWindow( nFlags & SfxViewShellFlags::NO_NEWWINDOW )
 {
 
     if ( pViewFrame->GetParentViewFrame() )
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 5635f3c..8a8eb2d 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1938,7 +1938,7 @@ void SmViewShell::GetState(SfxItemSet &rSet)
 
 
 SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *)
-    : SfxViewShell(pFrame_, SFX_VIEW_HAS_PRINTOPTIONS | SFX_VIEW_CAN_PRINT)
+    : SfxViewShell(pFrame_, SfxViewShellFlags::HAS_PRINTOPTIONS | SfxViewShellFlags::CAN_PRINT)
     , pImpl(new SmViewShell_Impl)
     , aGraphic(this)
     , aGraphicController(aGraphic, SID_GAPHIC_SM, pFrame_->GetBindings())
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index fa80f75..973cc91 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -101,7 +101,7 @@ void SwPagePreview::InitInterface_Impl()
 
 TYPEINIT1(SwPagePreview,SfxViewShell)
 
-#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS )
+#define SWVIEWFLAGS ( SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::HAS_PRINTOPTIONS )
 
 #define MIN_PREVIEW_ZOOM 25
 #define MAX_PREVIEW_ZOOM 600
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 5582107..48989d5 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -98,8 +98,7 @@ using namespace ::com::sun::star::ui::dialogs;
 using namespace ::sfx2;
 using ::com::sun::star::util::SearchOptions;
 
-#define SWSRCVIEWFLAGS ( SFX_VIEW_CAN_PRINT|\
-                      SFX_VIEW_NO_NEWWINDOW )
+#define SWSRCVIEWFLAGS ( SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::NO_NEWWINDOW )
 
 #define SRC_SEARCHOPTIONS (0xFFFF & ~(SEARCH_OPTIONS_FORMAT|SEARCH_OPTIONS_FAMILIES|SEARCH_OPTIONS_SEARCH_ALL))
 
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index bc92905..16e497b 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -119,8 +119,7 @@ using namespace ::com::sun::star::scanner;
 
 extern bool g_bNoInterrupt;       // in swmodule.cxx
 
-#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|               \
-                      SFX_VIEW_HAS_PRINTOPTIONS)
+#define SWVIEWFLAGS ( SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::HAS_PRINTOPTIONS)
 
 // Statics. OMG.
 


More information about the Libreoffice-commits mailing list