[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Oct 4 06:40:32 UTC 2017


 include/svx/graphctl.hxx       |   11 ++++-------
 svx/source/dialog/contwnd.cxx  |    2 +-
 svx/source/dialog/graphctl.cxx |   34 ++++++++++++++++------------------
 svx/source/dialog/imapwnd.cxx  |    2 +-
 4 files changed, 22 insertions(+), 27 deletions(-)

New commits:
commit c9d7d201749ebabe4c8a0d7e5051337b83b50ee7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Oct 3 16:01:41 2017 +0200

    drop WB_SDRMODE in favour of explicit method
    
    was the only style being used on the class anyhow, and there was already
    a field for it
    
    Change-Id: Icdbc9f312851e0476a8b1d21fd4dc9c8166d4e08
    Reviewed-on: https://gerrit.libreoffice.org/43085
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx
index 385d63d7e6d1..85ecc62e904f 100644
--- a/include/svx/graphctl.hxx
+++ b/include/svx/graphctl.hxx
@@ -29,8 +29,6 @@
 class GraphCtrlUserCall;
 class SvxGraphCtrlAccessibleContext;
 
-#define WB_SDRMODE      ((WinBits)0x0080)
-
 class SVX_DLLPUBLIC GraphCtrl : public Control
 {
     friend class GraphCtrlView;
@@ -45,11 +43,10 @@ class SVX_DLLPUBLIC GraphCtrl : public Control
     Size                aGraphSize;
     Point               aMousePos;
     GraphCtrlUserCall*  pUserCall;
-    WinBits             nWinStyle;
     SdrObjKind          eObjKind;
     sal_uInt16          nPolyEdit;
     bool                bEditMode;
-    bool                bSdrMode;
+    bool                mbSdrMode;
     bool                mbInIdleUpdate;
 
                         DECL_LINK( UpdateHdl, Timer*, void );
@@ -82,8 +79,6 @@ public:
     virtual ~GraphCtrl() override;
     virtual void dispose() override;
 
-    void                SetWinStyle( WinBits nWinBits );
-
     void                SetGraphic( const Graphic& rGraphic, bool bNewModel = true );
     const Graphic&      GetGraphic() const { return aGraphic; }
     const Size&         GetGraphicSize() const { return aGraphSize; }
@@ -100,7 +95,7 @@ public:
     SdrModel*           GetSdrModel() const { return pModel; }
     SdrView*            GetSdrView() const { return pView; }
     SdrObject*          GetSelectedSdrObject() const;
-    bool                IsChanged() const { return bSdrMode && pModel->IsChanged(); }
+    bool                IsChanged() const { return mbSdrMode && pModel->IsChanged(); }
 
     void                SetMousePosLink( const Link<GraphCtrl*,void>& rLink ) { aMousePosLink = rLink; }
 
@@ -109,6 +104,8 @@ public:
     void                SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { aUpdateLink = rLink; }
     void                QueueIdleUpdate();
 
+    void                SetSdrMode(bool b);
+
     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
 };
 
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
index c9cc5ab0346c..7130510e4489 100644
--- a/svx/source/dialog/contwnd.cxx
+++ b/svx/source/dialog/contwnd.cxx
@@ -40,7 +40,7 @@ ContourWindow::ContourWindow(vcl::Window* pParent, WinBits nBits)
     , bWorkplaceMode(false)
     , bClickValid(false)
 {
-    SetWinStyle(WB_SDRMODE);
+    SetSdrMode(true);
 }
 
 void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 68d6134378a9..d3843dc8cd0a 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -58,11 +58,10 @@ GraphCtrl::GraphCtrl( vcl::Window* pParent, WinBits nStyle ) :
             Control         ( pParent, nStyle ),
             aUpdateIdle     ( "svx GraphCtrl Update" ),
             aMap100         ( MapUnit::Map100thMM ),
-            nWinStyle       ( 0 ),
             eObjKind        ( OBJ_NONE ),
             nPolyEdit       ( 0 ),
             bEditMode       ( false ),
-            bSdrMode        ( false ),
+            mbSdrMode       ( false ),
             mbInIdleUpdate  ( false ),
             pModel          ( nullptr ),
             pView           ( nullptr )
@@ -99,10 +98,9 @@ void GraphCtrl::dispose()
     Control::dispose();
 }
 
-void GraphCtrl::SetWinStyle( WinBits nWinBits )
+void GraphCtrl::SetSdrMode(bool bSdrMode)
 {
-    nWinStyle = nWinBits;
-    bSdrMode = ( nWinStyle & WB_SDRMODE ) == WB_SDRMODE;
+    mbSdrMode = bSdrMode;
 
     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
@@ -114,7 +112,7 @@ void GraphCtrl::SetWinStyle( WinBits nWinBits )
     delete pModel;
     pModel = nullptr;
 
-    if ( bSdrMode )
+    if ( mbSdrMode )
         InitSdrModel();
 
     QueueIdleUpdate();
@@ -190,7 +188,7 @@ void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
     else
         aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
 
-    if ( bSdrMode && bNewModel )
+    if ( mbSdrMode && bNewModel )
         InitSdrModel();
 
     aGraphSizeLink.Call( this );
@@ -247,7 +245,7 @@ void GraphCtrl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl
     // even to the buffered view
     const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
 
-    if (bSdrMode)
+    if (mbSdrMode)
     {
         SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
 
@@ -302,7 +300,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
         case KEY_DELETE:
         case KEY_BACKSPACE:
         {
-            if ( bSdrMode )
+            if ( mbSdrMode )
             {
                 pView->DeleteMarked();
                 bProc = true;
@@ -314,7 +312,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
 
         case KEY_ESCAPE:
         {
-            if ( bSdrMode )
+            if ( mbSdrMode )
             {
                 bool bGrabFocusToFirstControl = true;
                 if ( pView->IsAction() )
@@ -343,7 +341,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
         case KEY_F11:
         case KEY_TAB:
         {
-            if( bSdrMode )
+            if( mbSdrMode )
             {
                 if( !aCode.IsMod1() && !aCode.IsMod2() )
                 {
@@ -606,7 +604,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
 
 void GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt )
 {
-    if ( bSdrMode && ( rMEvt.GetClicks() < 2 ) )
+    if ( mbSdrMode && ( rMEvt.GetClicks() < 2 ) )
     {
         const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
 
@@ -649,7 +647,7 @@ void GraphCtrl::MouseMove(const MouseEvent& rMEvt)
 {
     const Point aLogPos( PixelToLogic( rMEvt.GetPosPixel() ) );
 
-    if ( bSdrMode )
+    if ( mbSdrMode )
     {
         pView->MouseMove( rMEvt, this );
 
@@ -680,7 +678,7 @@ void GraphCtrl::MouseMove(const MouseEvent& rMEvt)
 
 void GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt)
 {
-    if ( bSdrMode )
+    if ( mbSdrMode )
     {
         if ( pView->IsInsObjPoint() )
             pView->EndInsObjPoint( SdrCreateCmd::ForceEnd );
@@ -700,7 +698,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const
 {
     SdrObject* pSdrObj = nullptr;
 
-    if ( bSdrMode )
+    if ( mbSdrMode )
     {
         const SdrMarkList&  rMarkList = pView->GetMarkedObjectList();
 
@@ -713,7 +711,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const
 
 void GraphCtrl::SetEditMode( const bool _bEditMode )
 {
-    if ( bSdrMode )
+    if ( mbSdrMode )
     {
         bEditMode = _bEditMode;
         pView->SetEditMode( bEditMode );
@@ -728,7 +726,7 @@ void GraphCtrl::SetEditMode( const bool _bEditMode )
 
 void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
 {
-    if ( bSdrMode && ( _nPolyEdit != nPolyEdit ) )
+    if ( mbSdrMode && ( _nPolyEdit != nPolyEdit ) )
     {
         nPolyEdit = _nPolyEdit;
         pView->SetFrameDragSingles( nPolyEdit == 0 );
@@ -741,7 +739,7 @@ void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
 
 void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
 {
-    if ( bSdrMode )
+    if ( mbSdrMode )
     {
         bEditMode = false;
         pView->SetEditMode( bEditMode );
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 910fdcfa85ca..59d3a7fd613f 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -60,7 +60,7 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF
             DropTargetHelper( this ),
             mxDocumentFrame( rxDocumentFrame )
 {
-    SetWinStyle( WB_SDRMODE );
+    SetSdrMode(true);
 
     pItemInfo = new SfxItemInfo[ 1 ];
     memset( pItemInfo, 0, sizeof( SfxItemInfo ) );


More information about the Libreoffice-commits mailing list