Kaydet (Commit) c9d7d201 authored tarafından Noel Grandin's avatar Noel Grandin

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/43085Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e5c91797
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
class GraphCtrlUserCall; class GraphCtrlUserCall;
class SvxGraphCtrlAccessibleContext; class SvxGraphCtrlAccessibleContext;
#define WB_SDRMODE ((WinBits)0x0080)
class SVX_DLLPUBLIC GraphCtrl : public Control class SVX_DLLPUBLIC GraphCtrl : public Control
{ {
friend class GraphCtrlView; friend class GraphCtrlView;
...@@ -45,11 +43,10 @@ class SVX_DLLPUBLIC GraphCtrl : public Control ...@@ -45,11 +43,10 @@ class SVX_DLLPUBLIC GraphCtrl : public Control
Size aGraphSize; Size aGraphSize;
Point aMousePos; Point aMousePos;
GraphCtrlUserCall* pUserCall; GraphCtrlUserCall* pUserCall;
WinBits nWinStyle;
SdrObjKind eObjKind; SdrObjKind eObjKind;
sal_uInt16 nPolyEdit; sal_uInt16 nPolyEdit;
bool bEditMode; bool bEditMode;
bool bSdrMode; bool mbSdrMode;
bool mbInIdleUpdate; bool mbInIdleUpdate;
DECL_LINK( UpdateHdl, Timer*, void ); DECL_LINK( UpdateHdl, Timer*, void );
...@@ -82,8 +79,6 @@ public: ...@@ -82,8 +79,6 @@ public:
virtual ~GraphCtrl() override; virtual ~GraphCtrl() override;
virtual void dispose() override; virtual void dispose() override;
void SetWinStyle( WinBits nWinBits );
void SetGraphic( const Graphic& rGraphic, bool bNewModel = true ); void SetGraphic( const Graphic& rGraphic, bool bNewModel = true );
const Graphic& GetGraphic() const { return aGraphic; } const Graphic& GetGraphic() const { return aGraphic; }
const Size& GetGraphicSize() const { return aGraphSize; } const Size& GetGraphicSize() const { return aGraphSize; }
...@@ -100,7 +95,7 @@ public: ...@@ -100,7 +95,7 @@ public:
SdrModel* GetSdrModel() const { return pModel; } SdrModel* GetSdrModel() const { return pModel; }
SdrView* GetSdrView() const { return pView; } SdrView* GetSdrView() const { return pView; }
SdrObject* GetSelectedSdrObject() const; 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; } void SetMousePosLink( const Link<GraphCtrl*,void>& rLink ) { aMousePosLink = rLink; }
...@@ -109,6 +104,8 @@ public: ...@@ -109,6 +104,8 @@ public:
void SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { aUpdateLink = rLink; } void SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { aUpdateLink = rLink; }
void QueueIdleUpdate(); void QueueIdleUpdate();
void SetSdrMode(bool b);
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
}; };
......
...@@ -40,7 +40,7 @@ ContourWindow::ContourWindow(vcl::Window* pParent, WinBits nBits) ...@@ -40,7 +40,7 @@ ContourWindow::ContourWindow(vcl::Window* pParent, WinBits nBits)
, bWorkplaceMode(false) , bWorkplaceMode(false)
, bClickValid(false) , bClickValid(false)
{ {
SetWinStyle(WB_SDRMODE); SetSdrMode(true);
} }
void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly) void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
......
...@@ -58,11 +58,10 @@ GraphCtrl::GraphCtrl( vcl::Window* pParent, WinBits nStyle ) : ...@@ -58,11 +58,10 @@ GraphCtrl::GraphCtrl( vcl::Window* pParent, WinBits nStyle ) :
Control ( pParent, nStyle ), Control ( pParent, nStyle ),
aUpdateIdle ( "svx GraphCtrl Update" ), aUpdateIdle ( "svx GraphCtrl Update" ),
aMap100 ( MapUnit::Map100thMM ), aMap100 ( MapUnit::Map100thMM ),
nWinStyle ( 0 ),
eObjKind ( OBJ_NONE ), eObjKind ( OBJ_NONE ),
nPolyEdit ( 0 ), nPolyEdit ( 0 ),
bEditMode ( false ), bEditMode ( false ),
bSdrMode ( false ), mbSdrMode ( false ),
mbInIdleUpdate ( false ), mbInIdleUpdate ( false ),
pModel ( nullptr ), pModel ( nullptr ),
pView ( nullptr ) pView ( nullptr )
...@@ -99,10 +98,9 @@ void GraphCtrl::dispose() ...@@ -99,10 +98,9 @@ void GraphCtrl::dispose()
Control::dispose(); Control::dispose();
} }
void GraphCtrl::SetWinStyle( WinBits nWinBits ) void GraphCtrl::SetSdrMode(bool bSdrMode)
{ {
nWinStyle = nWinBits; mbSdrMode = bSdrMode;
bSdrMode = ( nWinStyle & WB_SDRMODE ) == WB_SDRMODE;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) ); SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
...@@ -114,7 +112,7 @@ void GraphCtrl::SetWinStyle( WinBits nWinBits ) ...@@ -114,7 +112,7 @@ void GraphCtrl::SetWinStyle( WinBits nWinBits )
delete pModel; delete pModel;
pModel = nullptr; pModel = nullptr;
if ( bSdrMode ) if ( mbSdrMode )
InitSdrModel(); InitSdrModel();
QueueIdleUpdate(); QueueIdleUpdate();
...@@ -190,7 +188,7 @@ void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel ) ...@@ -190,7 +188,7 @@ void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
else else
aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 ); aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
if ( bSdrMode && bNewModel ) if ( mbSdrMode && bNewModel )
InitSdrModel(); InitSdrModel();
aGraphSizeLink.Call( this ); aGraphSizeLink.Call( this );
...@@ -247,7 +245,7 @@ void GraphCtrl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl ...@@ -247,7 +245,7 @@ void GraphCtrl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl
// even to the buffered view // even to the buffered view
const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType()); const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
if (bSdrMode) if (mbSdrMode)
{ {
SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext); SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
...@@ -302,7 +300,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt ) ...@@ -302,7 +300,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
case KEY_DELETE: case KEY_DELETE:
case KEY_BACKSPACE: case KEY_BACKSPACE:
{ {
if ( bSdrMode ) if ( mbSdrMode )
{ {
pView->DeleteMarked(); pView->DeleteMarked();
bProc = true; bProc = true;
...@@ -314,7 +312,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt ) ...@@ -314,7 +312,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
case KEY_ESCAPE: case KEY_ESCAPE:
{ {
if ( bSdrMode ) if ( mbSdrMode )
{ {
bool bGrabFocusToFirstControl = true; bool bGrabFocusToFirstControl = true;
if ( pView->IsAction() ) if ( pView->IsAction() )
...@@ -343,7 +341,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt ) ...@@ -343,7 +341,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
case KEY_F11: case KEY_F11:
case KEY_TAB: case KEY_TAB:
{ {
if( bSdrMode ) if( mbSdrMode )
{ {
if( !aCode.IsMod1() && !aCode.IsMod2() ) if( !aCode.IsMod1() && !aCode.IsMod2() )
{ {
...@@ -606,7 +604,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt ) ...@@ -606,7 +604,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
void GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt ) void GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt )
{ {
if ( bSdrMode && ( rMEvt.GetClicks() < 2 ) ) if ( mbSdrMode && ( rMEvt.GetClicks() < 2 ) )
{ {
const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) ); const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
...@@ -649,7 +647,7 @@ void GraphCtrl::MouseMove(const MouseEvent& rMEvt) ...@@ -649,7 +647,7 @@ void GraphCtrl::MouseMove(const MouseEvent& rMEvt)
{ {
const Point aLogPos( PixelToLogic( rMEvt.GetPosPixel() ) ); const Point aLogPos( PixelToLogic( rMEvt.GetPosPixel() ) );
if ( bSdrMode ) if ( mbSdrMode )
{ {
pView->MouseMove( rMEvt, this ); pView->MouseMove( rMEvt, this );
...@@ -680,7 +678,7 @@ void GraphCtrl::MouseMove(const MouseEvent& rMEvt) ...@@ -680,7 +678,7 @@ void GraphCtrl::MouseMove(const MouseEvent& rMEvt)
void GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt) void GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt)
{ {
if ( bSdrMode ) if ( mbSdrMode )
{ {
if ( pView->IsInsObjPoint() ) if ( pView->IsInsObjPoint() )
pView->EndInsObjPoint( SdrCreateCmd::ForceEnd ); pView->EndInsObjPoint( SdrCreateCmd::ForceEnd );
...@@ -700,7 +698,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const ...@@ -700,7 +698,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const
{ {
SdrObject* pSdrObj = nullptr; SdrObject* pSdrObj = nullptr;
if ( bSdrMode ) if ( mbSdrMode )
{ {
const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
...@@ -713,7 +711,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const ...@@ -713,7 +711,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const
void GraphCtrl::SetEditMode( const bool _bEditMode ) void GraphCtrl::SetEditMode( const bool _bEditMode )
{ {
if ( bSdrMode ) if ( mbSdrMode )
{ {
bEditMode = _bEditMode; bEditMode = _bEditMode;
pView->SetEditMode( bEditMode ); pView->SetEditMode( bEditMode );
...@@ -728,7 +726,7 @@ void GraphCtrl::SetEditMode( const bool _bEditMode ) ...@@ -728,7 +726,7 @@ void GraphCtrl::SetEditMode( const bool _bEditMode )
void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit ) void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
{ {
if ( bSdrMode && ( _nPolyEdit != nPolyEdit ) ) if ( mbSdrMode && ( _nPolyEdit != nPolyEdit ) )
{ {
nPolyEdit = _nPolyEdit; nPolyEdit = _nPolyEdit;
pView->SetFrameDragSingles( nPolyEdit == 0 ); pView->SetFrameDragSingles( nPolyEdit == 0 );
...@@ -741,7 +739,7 @@ void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit ) ...@@ -741,7 +739,7 @@ void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind ) void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
{ {
if ( bSdrMode ) if ( mbSdrMode )
{ {
bEditMode = false; bEditMode = false;
pView->SetEditMode( bEditMode ); pView->SetEditMode( bEditMode );
......
...@@ -60,7 +60,7 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF ...@@ -60,7 +60,7 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF
DropTargetHelper( this ), DropTargetHelper( this ),
mxDocumentFrame( rxDocumentFrame ) mxDocumentFrame( rxDocumentFrame )
{ {
SetWinStyle( WB_SDRMODE ); SetSdrMode(true);
pItemInfo = new SfxItemInfo[ 1 ]; pItemInfo = new SfxItemInfo[ 1 ];
memset( pItemInfo, 0, sizeof( SfxItemInfo ) ); memset( pItemInfo, 0, sizeof( SfxItemInfo ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment