diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-04-22 09:37:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-22 10:00:53 +0100 |
commit | 95c04e218782cb198f7851a1d9536058f98cff2a (patch) | |
tree | f4b1b5475ab7e1af6c921070d79a55f8f47a0811 /svx | |
parent | dd7778a76915685d9b334e1f0718f556f6309687 (diff) |
SfxControllerItems shouldn't be SAL_WARN_UNUSED
unwind some removals and some other cleanup
Change-Id: I81a734ed07a05a5922c31003928c493c2df1652f
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/_bmpmask.cxx | 38 | ||||
-rw-r--r-- | svx/source/dialog/_contdlg.cxx | 25 | ||||
-rw-r--r-- | svx/source/dialog/contimp.hxx | 18 |
3 files changed, 79 insertions, 2 deletions
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 0a621c300c12..bda7ae2b1c01 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -25,8 +25,6 @@ #include <sfx2/dispatch.hxx> #include <svtools/colrdlg.hxx> -#define BMPMASK_PRIVATE - #include <svx/dialmgr.hxx> #include <svx/bmpmask.hxx> #include <svx/dialogs.hrc> @@ -170,6 +168,8 @@ class MaskData public: MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind ); + bool IsCbxReady() const { return bIsReady; } + void SetExecState( bool bState ) { bExecState = bState; } bool IsExecReady() const { return bExecState; } DECL_LINK( PipetteHdl, ToolBox* pTbx ); @@ -335,6 +335,27 @@ void ColorWindow::Paint( const Rectangle &/*Rect*/ ) SetFillColor( rOldFillColor ); } +SvxBmpMaskSelectItem::SvxBmpMaskSelectItem( sal_uInt16 nId_, SvxBmpMask& rMask, + SfxBindings& rBindings ) : + SfxControllerItem ( nId_, rBindings ), + rBmpMask ( rMask) +{ +} + + + +void SvxBmpMaskSelectItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, + const SfxPoolItem* pItem ) +{ + if ( ( nSID == SID_BMPMASK_EXEC ) && pItem ) + { + const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem ); + assert(pStateItem); //SfxBoolItem erwartet + if (pStateItem) + rBmpMask.SetExecState( pStateItem->GetValue() ); + } +} + SvxBmpMaskChildWindow::SvxBmpMaskChildWindow(vcl::Window* pParent_, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo) @@ -354,6 +375,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* "svx/ui/dockingcolorreplace.ui" ) , pData(new MaskData(this, *pBindinx)) , aPipetteColor(COL_WHITE) + , aSelItem(SID_BMPMASK_EXEC, *this, *pBindinx) { get(m_pTbxPipette, "toolbar"); m_pTbxPipette->SetItemBits(m_pTbxPipette->GetItemId(0), @@ -565,6 +587,18 @@ void SvxBmpMask::PipetteClicked() pData->PipetteHdl(m_pTbxPipette); } +void SvxBmpMask::SetExecState( bool bEnable ) +{ + pData->SetExecState( bEnable ); + + if ( pData->IsExecReady() && pData->IsCbxReady() ) + m_pBtnExec->Enable(); + else + m_pBtnExec->Disable(); +} + + + sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uIntPtr* pTols ) { sal_uInt16 nCount = 0; diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index 157c88d6ad40..c94ed569173f 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -46,6 +46,23 @@ SFX_IMPL_FLOATINGWINDOW_WITHID( SvxContourDlgChildWindow, SID_CONTOUR_DLG ); +SvxContourDlgItem::SvxContourDlgItem( sal_uInt16 _nId, SvxSuperContourDlg& rContourDlg, SfxBindings& rBindings ) : + SfxControllerItem ( _nId, rBindings ), + rDlg ( rContourDlg ) +{ +} + +void SvxContourDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, const SfxPoolItem* pItem ) +{ + if ( pItem && ( SID_CONTOUR_EXEC == nSID ) ) + { + const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem ); + assert(pStateItem); //SfxBoolItem expected + if (pStateItem) + rDlg.SetExecState(!pStateItem->GetValue()); + } +} + SvxContourDlgChildWindow::SvxContourDlgChildWindow( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) @@ -186,6 +203,7 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow * SvxContourDlg ( _pBindings, pCW, _pParent ), pUpdateEditingObject( NULL ), pCheckObj ( NULL ), + aContourItem ( SID_CONTOUR_EXEC, *this, *_pBindings ), nGrfChanged ( 0UL ), bExecState ( false ), bUpdateGraphicLinked( false ), @@ -291,6 +309,13 @@ bool SvxSuperContourDlg::Close() return( bRet ? SfxFloatingWindow::Close() : sal_False ); } +// Enabled or disabled all Controls + +void SvxSuperContourDlg::SetExecState( bool bEnable ) +{ + bExecState = bEnable; +} + void SvxSuperContourDlg::SetGraphic( const Graphic& rGraphic ) { aUndoGraphic = aRedoGraphic = Graphic(); diff --git a/svx/source/dialog/contimp.hxx b/svx/source/dialog/contimp.hxx index 899998f849c4..c667544cbd46 100644 --- a/svx/source/dialog/contimp.hxx +++ b/svx/source/dialog/contimp.hxx @@ -27,6 +27,21 @@ #define CONT_RESID(nId) ResId( nId, DIALOG_MGR() ) +class SvxSuperContourDlg; + +class SvxContourDlgItem : public SfxControllerItem +{ + SvxSuperContourDlg& rDlg; + +protected: + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; + +public: + + SvxContourDlgItem( sal_uInt16 nId, SvxSuperContourDlg& rDlg, SfxBindings& rBindings ); +}; + class SvxSuperContourDlg : public SvxContourDlg { using SvxContourDlg::GetPolyPolygon; @@ -41,6 +56,7 @@ class SvxSuperContourDlg : public SvxContourDlg Size aLastSize; void* pUpdateEditingObject; void* pCheckObj; + SvxContourDlgItem aContourItem; ToolBox* m_pTbx1; MetricField* m_pMtfTolerance; ContourWindow* m_pContourWnd; @@ -84,6 +100,8 @@ public: vcl::Window* pParent); virtual ~SvxSuperContourDlg(); + void SetExecState( bool bEnable ); + void SetGraphic( const Graphic& rGraphic ); void SetGraphicLinked( bool bLinked ) { bGraphicLinked = bLinked; } const Graphic& GetGraphic() const { return aGraphic; } |