diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-24 16:23:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-25 08:56:15 +0200 |
commit | c7c0723dd97e278edeb7686d350ffe6d8706ed66 (patch) | |
tree | e8c9c9635ddca3ecec98ab05b109922ab7fab861 | |
parent | abf60c4a0fd111985891e2faa30a1e32799fdf9c (diff) |
convert EV_CNTRL constants to enum class
Change-Id: I0ffc0e222c978ce7c734228f712e88422d3a615f
-rw-r--r-- | editeng/source/editeng/editview.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 32 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 4 | ||||
-rw-r--r-- | forms/source/richtext/richtextimplcontrol.cxx | 4 | ||||
-rw-r--r-- | include/editeng/editstat.hxx | 27 | ||||
-rw-r--r-- | include/editeng/editview.hxx | 5 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 16 |
12 files changed, 66 insertions, 58 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index e9ec245c51ea..fa77d3c3c0be 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -593,12 +593,12 @@ void EditView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, pImpEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData); } -void EditView::SetControlWord( sal_uInt32 nWord ) +void EditView::SetControlWord( EVControlBits nWord ) { pImpEditView->nControl = nWord; } -sal_uInt32 EditView::GetControlWord() const +EVControlBits EditView::GetControlWord() const { return pImpEditView->nControl; } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 7593b8094c18..0344f54c1ff4 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -90,7 +90,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo eAnchorMode = ANCHOR_TOP_LEFT; nInvMore = 1; nTravelXPos = TRAVEL_X_DONTKNOW; - nControl = EV_CNTRL_AUTOSCROLL | EV_CNTRL_ENABLEPASTE; + nControl = EVControlBits::AUTOSCROLL | EVControlBits::ENABLEPASTE; bActiveDragAndDropListener = false; aEditSelection.Min() = pEng->GetEditDoc().GetStartPaM(); @@ -1180,7 +1180,7 @@ void ImpEditView::SetInsertMode( bool bInsert ) { if ( bInsert != IsInsertMode() ) { - SetFlags( nControl, EV_CNTRL_OVERWRITE, !bInsert ); + SetFlags( nControl, EVControlBits::OVERWRITE, !bInsert ); ShowCursor( DoAutoScroll(), false ); } } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index febfd39745f8..dd2f6443883d 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -230,14 +230,14 @@ private: long nInvMore; - sal_uLong nControl; + EVControlBits nControl; sal_uInt32 nTravelXPos; sal_uInt16 nExtraCursorFlags; sal_uInt16 nCursorBidiLevel; sal_uInt16 nScrollDiffX; - bool bReadOnly; - bool bClickedInSelection; - bool bActiveDragAndDropListener; + bool bReadOnly; + bool bClickedInSelection; + bool bActiveDragAndDropListener; Point aAnchorPoint; Rectangle aOutArea; @@ -352,18 +352,18 @@ public: Pair Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck = RGCHK_NEG ); void SetInsertMode( bool bInsert ); - bool IsInsertMode() const { return ( ( nControl & EV_CNTRL_OVERWRITE ) == 0 ); } - - void EnablePaste( bool bEnable ) { SetFlags( nControl, EV_CNTRL_ENABLEPASTE, bEnable ); } - bool IsPasteEnabled() const { return ( ( nControl & EV_CNTRL_ENABLEPASTE ) != 0 ); } - - bool DoSingleLinePaste() const { return ( ( nControl & EV_CNTRL_SINGLELINEPASTE ) != 0 ); } - bool DoAutoScroll() const { return ( ( nControl & EV_CNTRL_AUTOSCROLL ) != 0 ); } - bool DoBigScroll() const { return ( ( nControl & EV_CNTRL_BIGSCROLL ) != 0 ); } - bool DoAutoSize() const { return ( ( nControl & EV_CNTRL_AUTOSIZE ) != 0 ); } - bool DoAutoWidth() const { return ( ( nControl & EV_CNTRL_AUTOSIZEX) != 0 ); } - bool DoAutoHeight() const { return ( ( nControl & EV_CNTRL_AUTOSIZEY) != 0 ); } - bool DoInvalidateMore() const { return ( ( nControl & EV_CNTRL_INVONEMORE ) != 0 ); } + bool IsInsertMode() const { return !( nControl & EVControlBits::OVERWRITE ); } + + void EnablePaste( bool bEnable ) { SetFlags( nControl, EVControlBits::ENABLEPASTE, bEnable ); } + bool IsPasteEnabled() const { return bool( nControl & EVControlBits::ENABLEPASTE ); } + + bool DoSingleLinePaste() const { return bool( nControl & EVControlBits::SINGLELINEPASTE ); } + bool DoAutoScroll() const { return bool( nControl & EVControlBits::AUTOSCROLL ); } + bool DoBigScroll() const { return bool( nControl & EVControlBits::BIGSCROLL ); } + bool DoAutoSize() const { return bool( nControl & EVControlBits::AUTOSIZE ); } + bool DoAutoWidth() const { return bool( nControl & EVControlBits::AUTOSIZEX); } + bool DoAutoHeight() const { return bool( nControl & EVControlBits::AUTOSIZEY); } + bool DoInvalidateMore() const { return bool( nControl & EVControlBits::INVONEMORE ); } void SetBackgroundColor( const Color& rColor ); const Color& GetBackgroundColor() const { diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 183aa1860575..09d1341ec691 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1313,12 +1313,12 @@ void OutlinerView::Scroll( long nHorzScroll, long nVertScroll ) pEditView->Scroll( nHorzScroll, nVertScroll ); } -void OutlinerView::SetControlWord( sal_uLong nWord ) +void OutlinerView::SetControlWord( EVControlBits nWord ) { pEditView->SetControlWord( nWord ); } -sal_uLong OutlinerView::GetControlWord() const +EVControlBits OutlinerView::GetControlWord() const { return pEditView->GetControlWord(); } diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index 0b65da26e7a4..bb8385455c10 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -72,8 +72,8 @@ namespace frm m_pEngine->registerEngineStatusListener( this ); { - sal_uLong nViewControlWord = m_pView->GetControlWord(); - nViewControlWord |= EV_CNTRL_AUTOSCROLL; + EVControlBits nViewControlWord = m_pView->GetControlWord(); + nViewControlWord |= EVControlBits::AUTOSCROLL; m_pView->SetControlWord( nViewControlWord ); } diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx index ba973a71fc2b..59461a0c2cfe 100644 --- a/include/editeng/editstat.hxx +++ b/include/editeng/editstat.hxx @@ -60,15 +60,22 @@ namespace o3tl template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x07ffffff> {}; } -#define EV_CNTRL_AUTOSCROLL 0x00000001 // Auto scrolling horizontally -#define EV_CNTRL_BIGSCROLL 0x00000002 // Scroll further to the cursor -#define EV_CNTRL_ENABLEPASTE 0x00000004 // Enable Paste -#define EV_CNTRL_SINGLELINEPASTE 0x00000008 // View: Paste in input line ... -#define EV_CNTRL_OVERWRITE 0x00000010 // Overwrite mode -#define EV_CNTRL_INVONEMORE 0x00000020 // Invalidate one pixel more -#define EV_CNTRL_AUTOSIZEX 0x00000040 // Automatically adapt to text width -#define EV_CNTRL_AUTOSIZEY 0x00000080 // Automatically adapt to Text width -#define EV_CNTRL_AUTOSIZE (EV_CNTRL_AUTOSIZEX|EV_CNTRL_AUTOSIZEY) +enum class EVControlBits +{ + AUTOSCROLL = 0x0001, // Auto scrolling horizontally + BIGSCROLL = 0x0002, // Scroll further to the cursor + ENABLEPASTE = 0x0004, // Enable Paste + SINGLELINEPASTE = 0x0008, // View: Paste in input line ... + OVERWRITE = 0x0010, // Overwrite mode + INVONEMORE = 0x0020, // Invalidate one pixel more + AUTOSIZEX = 0x0040, // Automatically adapt to text width + AUTOSIZEY = 0x0080, // Automatically adapt to Text width + AUTOSIZE = (AUTOSIZEX|AUTOSIZEY) +}; +namespace o3tl +{ + template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xff> {}; +} #define EE_STAT_HSCROLL 0x00000001 #define EE_STAT_VSCROLL 0x00000002 @@ -91,7 +98,7 @@ inline void SetFlags( EEControlBits& rBits, EEControlBits nMask, bool bOn ) rBits &= ~nMask; } -inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn ) +inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn ) { if ( bOn ) rBits |= nMask; diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index a1d05efe4ce1..3e2fb1a4d1f0 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -27,6 +27,7 @@ #include <tools/color.hxx> #include <tools/gen.hxx> #include <vcl/cursor.hxx> +#include <editeng/editstat.hxx> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitTypes.h> @@ -176,8 +177,8 @@ public: /// @see vcl::ITiledRenderable::registerCallback(). void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); - void SetControlWord( sal_uInt32 nWord ); - sal_uInt32 GetControlWord() const; + void SetControlWord( EVControlBits nWord ); + EVControlBits GetControlWord() const; EditTextObject* CreateTextObject(); void InsertText( const EditTextObject& rTextObject ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index d80263f1b74d..b973e64e1d79 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -284,8 +284,8 @@ public: const SfxStyleSheet* GetStyleSheet() const; SfxStyleSheet* GetStyleSheet(); - void SetControlWord( sal_uLong nWord ); - sal_uLong GetControlWord() const; + void SetControlWord( EVControlBits nWord ); + EVControlBits GetControlWord() const; void SetAnchorMode( EVAnchorMode eMode ); EVAnchorMode GetAnchorMode() const; diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 728e14e952ef..747ff2e69321 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1389,8 +1389,8 @@ void ScMultiTextWnd::InitEditEngine() pEditView->SetInsertMode(bIsInsertMode); // Text from Clipboard is taken over as ASCII in a single row - sal_uLong n = pEditView->GetControlWord(); - pEditView->SetControlWord( n | EV_CNTRL_SINGLELINEPASTE ); + EVControlBits n = pEditView->GetControlWord(); + pEditView->SetControlWord( n | EVControlBits::SINGLELINEPASTE ); pEditEngine->InsertView( pEditView, EE_APPEND ); @@ -1762,8 +1762,8 @@ void ScTextWnd::StartEditEngine() pEditView->SetInsertMode(bIsInsertMode); // The text from the Clipboard is taken over as ASCII in a single row - sal_uLong n = pEditView->GetControlWord(); - pEditView->SetControlWord( n | EV_CNTRL_SINGLELINEPASTE ); + EVControlBits n = pEditView->GetControlWord(); + pEditView->SetControlWord( n | EVControlBits::SINGLELINEPASTE ); pEditEngine->InsertView( pEditView, EE_APPEND ); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 5675d68e5720..5d7a93b9a355 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -945,8 +945,8 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, EEControlBits nEC = pNewEngine->GetControlWord(); pNewEngine->SetControlWord(nEC & ~EEControlBits::DOIDLEFORMAT); - sal_uLong nVC = pEditView[eWhich]->GetControlWord(); - pEditView[eWhich]->SetControlWord(nVC & ~EV_CNTRL_AUTOSCROLL); + EVControlBits nVC = pEditView[eWhich]->GetControlWord(); + pEditView[eWhich]->SetControlWord(nVC & ~EVControlBits::AUTOSCROLL); bEditActive[eWhich] = true; @@ -1315,8 +1315,8 @@ void ScViewData::EditGrowY( bool bInitial ) if ( !pCurView || !bEditActive[eWhich]) return; - sal_uLong nControl = pEditView[eWhich]->GetControlWord(); - if ( nControl & EV_CNTRL_AUTOSCROLL ) + EVControlBits nControl = pEditView[eWhich]->GetControlWord(); + if ( nControl & EVControlBits::AUTOSCROLL ) { // if end of screen had already been reached and scrolling enabled, // don't further try to grow the edit area @@ -1377,8 +1377,8 @@ void ScViewData::EditGrowY( bool bInitial ) if (nEditEndRow >= nBottom || bMaxReached) { - if ((nControl & EV_CNTRL_AUTOSCROLL) == 0) - pCurView->SetControlWord( nControl | EV_CNTRL_AUTOSCROLL ); + if (!(nControl & EVControlBits::AUTOSCROLL)) + pCurView->SetControlWord( nControl | EVControlBits::AUTOSCROLL ); } aArea.Top() = nOldBottom; diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 26d15c9c95e5..469d1f82905f 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1665,8 +1665,8 @@ void Outliner::Implementation::ProvideOutlinerView ( } else mpOutlineView->SetWindow(pWindow); - sal_uLong nStat = mpOutlineView->GetControlWord(); - nStat &= ~EV_CNTRL_AUTOSCROLL; + EVControlBits nStat = mpOutlineView->GetControlWord(); + nStat &= ~EVControlBits::AUTOSCROLL; mpOutlineView->SetControlWord(nStat); if (bInsert) rOutliner.InsertView( mpOutlineView ); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index f04c617b8a8b..0a61c42ed54d 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -219,11 +219,11 @@ void SdrObjEditView::ModelHasChanged() } for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++) { OutlinerView* pOLV=pTextEditOutliner->GetView(nOV); - sal_uIntPtr nStat0=pOLV->GetControlWord(); - sal_uIntPtr nStat=nStat0; + EVControlBits nStat0=pOLV->GetControlWord(); + EVControlBits nStat=nStat0; // AutoViewSize only if not ContourFrame. - if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE; - else nStat&=~EV_CNTRL_AUTOSIZE; + if (!bContourFrame) nStat|=EVControlBits::AUTOSIZE; + else nStat&=~EVControlBits::AUTOSIZE; if (nStat!=nStat0) pOLV->SetControlWord(nStat); } pTextEditOutliner->SetUpdateMode(true); @@ -435,13 +435,13 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP if (pOutlView==NULL) pOutlView = new OutlinerView(pTextEditOutliner,pWin); else pOutlView->SetWindow(pWin); // disallow scrolling - sal_uIntPtr nStat=pOutlView->GetControlWord(); - nStat&=~EV_CNTRL_AUTOSCROLL; + EVControlBits nStat=pOutlView->GetControlWord(); + nStat&=~EVControlBits::AUTOSCROLL; // AutoViewSize only if not ContourFrame. - if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE; + if (!bContourFrame) nStat|=EVControlBits::AUTOSIZE; if (bTextFrame) { sal_uInt16 nPixSiz=maHdlList.GetHdlSize()*2+1; - nStat|=EV_CNTRL_INVONEMORE; + nStat|=EVControlBits::INVONEMORE; pOutlView->SetInvalidateMore(nPixSiz); } pOutlView->SetControlWord(nStat); |