cui/source/options/fontsubs.cxx | 2 cui/source/options/optfltr.cxx | 4 - cui/source/tabpages/autocdlg.cxx | 2 cui/source/tabpages/page.cxx | 8 +-- editeng/source/items/frmitems.cxx | 10 ++-- formula/source/core/api/FormulaCompiler.cxx | 8 +-- formula/source/core/api/token.cxx | 10 ++-- include/editeng/shaditem.hxx | 8 --- include/formula/tokenarray.hxx | 59 +++++++++++++++------------- include/svtools/svlbitm.hxx | 54 ++++++++++++++----------- sc/inc/address.hxx | 2 sc/inc/formulacell.hxx | 2 sc/source/core/data/documen7.cxx | 2 sc/source/core/data/formulacell.cxx | 10 ++-- sc/source/filter/excel/excform.cxx | 2 sc/source/filter/lotus/lotimpop.cxx | 2 sc/source/filter/lotus/op.cxx | 4 - sc/source/filter/qpro/qpro.cxx | 2 sc/source/ui/view/printfun.cxx | 52 ++++++++++++------------ svtools/source/contnr/svlbitm.cxx | 56 +++++++++++--------------- svtools/source/contnr/svtabbx.cxx | 4 - svtools/source/contnr/treelistbox.cxx | 2 sw/source/core/docnode/ndtbl.cxx | 4 - sw/source/core/inc/swfont.hxx | 3 - sw/source/core/layout/frmtool.cxx | 8 +-- sw/source/core/layout/paintfrm.cxx | 8 +-- sw/source/core/layout/ssfrm.cxx | 4 - sw/source/core/table/swtable.cxx | 4 - sw/source/core/text/inftxt.cxx | 8 +-- sw/source/core/txtnode/swfont.cxx | 10 ++-- sw/source/uibase/frmdlg/frmmgr.cxx | 8 +-- 31 files changed, 184 insertions(+), 178 deletions(-)
New commits: commit 216fdcbdb4c17f349ffd68abd1f372bea3287fad Author: Noel Grandin <n...@peralex.com> Date: Wed Apr 8 09:06:49 2015 +0200 convert RECALCMODE_ constants to scoped enum Change-Id: Ice2e45a3db59adc34a160b4b410cc51c750835f2 diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index af4fcfa..78861b8 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1198,12 +1198,12 @@ void FormulaCompiler::Factor() // Functions recalculated on every document load. // Don't use SetExclusiveRecalcModeOnLoad() which would // override ModeAlways, use - // AddRecalcMode(RECALCMODE_ONLOAD) instead. + // AddRecalcMode(ScRecalcMode::ONLOAD) instead. case ocConvert : case ocDde: case ocMacro: case ocExternal: - pArr->AddRecalcMode( RECALCMODE_ONLOAD ); + pArr->AddRecalcMode( ScRecalcMode::ONLOAD ); break; // If the referred cell is moved the value changes. case ocColumn : @@ -1214,12 +1214,12 @@ void FormulaCompiler::Factor() // and recalc mode on load, fdo#60646 case ocCell : pArr->SetRecalcModeOnRefMove(); - pArr->AddRecalcMode( RECALCMODE_ONLOAD ); + pArr->AddRecalcMode( ScRecalcMode::ONLOAD ); break; case ocHyperLink : // cell with hyperlink needs to be calculated on load to // get its matrix result generated. - pArr->AddRecalcMode( RECALCMODE_ONLOAD ); + pArr->AddRecalcMode( ScRecalcMode::ONLOAD ); pArr->SetHyperLink( true); break; default: diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 39067e2..08a129a 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -699,7 +699,7 @@ FormulaTokenArray::FormulaTokenArray() : nRPN(0), nIndex(0), nError(0), - nMode(RECALCMODE_NORMAL), + nMode(ScRecalcMode::NORMAL), bHyperLink(false) { } @@ -929,13 +929,13 @@ FormulaToken* FormulaTokenArray::AddStringXML( const OUString& rStr ) void FormulaTokenArray::AddRecalcMode( ScRecalcMode nBits ) { //! Order is important. - if ( nBits & RECALCMODE_ALWAYS ) + if ( nBits & ScRecalcMode::ALWAYS ) SetExclusiveRecalcModeAlways(); else if ( !IsRecalcModeAlways() ) { - if ( nBits & RECALCMODE_ONLOAD ) + if ( nBits & ScRecalcMode::ONLOAD ) SetExclusiveRecalcModeOnLoad(); - else if ( nBits & RECALCMODE_ONLOAD_ONCE && !IsRecalcModeOnLoad() ) + else if ( nBits & ScRecalcMode::ONLOAD_ONCE && !IsRecalcModeOnLoad() ) SetExclusiveRecalcModeOnLoadOnce(); } SetCombinedBitsRecalcMode( nBits ); @@ -1357,7 +1357,7 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( const MissingConvention & int nOcas = 0; FormulaTokenArray *pNewArr = new FormulaTokenArray; - // At least RECALCMODE_ALWAYS needs to be set. + // At least ScRecalcMode::ALWAYS needs to be set. pNewArr->AddRecalcMode( GetRecalcMode()); for ( FormulaToken *pCur = First(); pCur; pCur = Next() ) diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index c70e6c1d..52edc66 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -24,6 +24,7 @@ #include <formula/token.hxx> #include <formula/ExternalReferenceHelper.hxx> #include <o3tl/underlying_type.hxx> +#include <o3tl/typed_flags_set.hxx> #include <limits.h> #include <unordered_set> @@ -35,22 +36,28 @@ class SharedStringPool; } -namespace formula -{ - // RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode... -typedef sal_uInt8 ScRecalcMode; // Only one of the exclusive bits can be set, // handled by TokenArray SetRecalcMode... methods -#define RECALCMODE_NORMAL 0x01 // exclusive -#define RECALCMODE_ALWAYS 0x02 // exclusive, always -#define RECALCMODE_ONLOAD 0x04 // exclusive, always after load -#define RECALCMODE_ONLOAD_ONCE 0x08 // exclusive, once after load -#define RECALCMODE_FORCED 0x10 // combined, also if cell isn't visible -#define RECALCMODE_ONREFMOVE 0x20 // combined, if reference was moved -#define RECALCMODE_EMASK 0x0F // mask of exclusive bits +enum class ScRecalcMode : sal_uInt8 +{ + NORMAL = 0x01, // exclusive + ALWAYS = 0x02, // exclusive, always + ONLOAD = 0x04, // exclusive, always after load + ONLOAD_ONCE = 0x08, // exclusive, once after load + FORCED = 0x10, // combined, also if cell isn't visible + ONREFMOVE = 0x20, // combined, if reference was moved +}; // If new bits are to be defined, AddRecalcMode has to be adjusted! +namespace o3tl +{ + template<> struct typed_flags<ScRecalcMode> : is_typed_flags<ScRecalcMode, 0x3f> {}; +} +#define RECALCMODE_EMASK (ScRecalcMode(ScRecalcMode::NORMAL | ScRecalcMode::ALWAYS | ScRecalcMode::ONLOAD | ScRecalcMode::ONLOAD_ONCE)) // mask of exclusive bits + +namespace formula +{ class FormulaMissingContext; @@ -191,35 +198,35 @@ public: than one exclusive bit was set. */ void AddRecalcMode( ScRecalcMode nBits ); - inline void ClearRecalcMode() { nMode = RECALCMODE_NORMAL; } + inline void ClearRecalcMode() { nMode = ScRecalcMode::NORMAL; } inline void SetExclusiveRecalcModeNormal() - { SetMaskedRecalcMode( RECALCMODE_NORMAL ); } + { SetMaskedRecalcMode( ScRecalcMode::NORMAL ); } inline void SetExclusiveRecalcModeAlways() - { SetMaskedRecalcMode( RECALCMODE_ALWAYS ); } + { SetMaskedRecalcMode( ScRecalcMode::ALWAYS ); } inline void SetExclusiveRecalcModeOnLoad() - { SetMaskedRecalcMode( RECALCMODE_ONLOAD ); } + { SetMaskedRecalcMode( ScRecalcMode::ONLOAD ); } inline void SetExclusiveRecalcModeOnLoadOnce() - { SetMaskedRecalcMode( RECALCMODE_ONLOAD_ONCE ); } + { SetMaskedRecalcMode( ScRecalcMode::ONLOAD_ONCE ); } inline void SetRecalcModeForced() - { nMode |= RECALCMODE_FORCED; } + { nMode |= ScRecalcMode::FORCED; } inline void ClearRecalcModeForced() - { nMode &= ~RECALCMODE_FORCED; } + { nMode &= ~ScRecalcMode::FORCED; } inline void SetRecalcModeOnRefMove() - { nMode |= RECALCMODE_ONREFMOVE; } + { nMode |= ScRecalcMode::ONREFMOVE; } inline void ClearRecalcModeOnRefMove() - { nMode &= ~RECALCMODE_ONREFMOVE; } + { nMode &= ~ScRecalcMode::ONREFMOVE; } inline bool IsRecalcModeNormal() const - { return (nMode & RECALCMODE_NORMAL) != 0; } + { return bool(nMode & ScRecalcMode::NORMAL); } inline bool IsRecalcModeAlways() const - { return (nMode & RECALCMODE_ALWAYS) != 0; } + { return bool(nMode & ScRecalcMode::ALWAYS); } inline bool IsRecalcModeOnLoad() const - { return (nMode & RECALCMODE_ONLOAD) != 0; } + { return bool(nMode & ScRecalcMode::ONLOAD); } inline bool IsRecalcModeOnLoadOnce() const - { return (nMode & RECALCMODE_ONLOAD_ONCE) != 0; } + { return bool(nMode & ScRecalcMode::ONLOAD_ONCE); } inline bool IsRecalcModeForced() const - { return (nMode & RECALCMODE_FORCED) != 0; } + { return bool(nMode & ScRecalcMode::FORCED); } inline bool IsRecalcModeOnRefMove() const - { return (nMode & RECALCMODE_ONREFMOVE) != 0; } + { return bool(nMode & ScRecalcMode::ONREFMOVE); } /** Get OpCode of the most outer function */ inline OpCode GetOuterFuncOpCode(); diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index ecb5110..f6650d4 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -840,7 +840,7 @@ inline bool ScRefAddress::operator==( const ScRefAddress& rRefAddress ) const // Global functions -// Special values for cells always broadcasting or listening (RECALCMODE_ALWAYS +// Special values for cells always broadcasting or listening (ScRecalcMode::ALWAYS // and the like). #define BCA_BRDCST_ALWAYS ScAddress( 0, SCROW_MAX, 0 ) #define BCA_LISTEN_ALWAYS ScRange( BCA_BRDCST_ALWAYS, BCA_BRDCST_ALWAYS ) diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 7b7ed09..8e84e00 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -346,7 +346,7 @@ public: bool IsInChangeTrack() const { return bInChangeTrack;} // For import filters! - void AddRecalcMode( formula::ScRecalcMode ); + void AddRecalcMode( ScRecalcMode ); /** For import only: set a double result. */ void SetHybridDouble( double n ); /** For import only: set a string result. diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 36b0223..d89ea62 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -452,7 +452,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet while ( pCell ) { // Interpret resets bDirty and calls Remove, also the referenced! - // the Cell remains when RECALCMODE_ALWAYS. + // the Cell remains when ScRecalcMode::ALWAYS. if ( bOnlyForced ) { if ( pCell->GetCode()->IsRecalcModeForced() ) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 3ba5fc2..3e8e160 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1397,7 +1397,7 @@ void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartL } // Do the cells need to be calculated? After Load cells can contain an error code, and then start - // the listener and Recalculate (if needed) if not RECALCMODE_NORMAL + // the listener and Recalculate (if needed) if not ScRecalcMode::NORMAL if( !bNewCompiled || !pCode->GetCodeError() ) { if (bStartListening) @@ -2101,7 +2101,7 @@ void ScFormulaCell::Notify( const SfxHint& rHint ) } // Don't remove from FormulaTree to put in FormulaTrack to // put in FormulaTree again and again, only if necessary. - // Any other means except RECALCMODE_ALWAYS by which a cell could + // Any other means except ScRecalcMode::ALWAYS by which a cell could // be in FormulaTree if it would notify other cells through // FormulaTrack which weren't in FormulaTrack/FormulaTree before?!? // Yes. The new TableOpDirty made it necessary to have a @@ -2255,11 +2255,11 @@ void ScFormulaCell::SetResultError( sal_uInt16 n ) void ScFormulaCell::AddRecalcMode( ScRecalcMode nBits ) { - if ( (nBits & RECALCMODE_EMASK) != RECALCMODE_NORMAL ) + if ( (nBits & RECALCMODE_EMASK) != ScRecalcMode::NORMAL ) SetDirtyVar(); - if ( nBits & RECALCMODE_ONLOAD_ONCE ) + if ( nBits & ScRecalcMode::ONLOAD_ONCE ) { // OnLoadOnce nur zum Dirty setzen nach Filter-Import - nBits = (nBits & ~RECALCMODE_EMASK) | RECALCMODE_NORMAL; + nBits = (nBits & ~RECALCMODE_EMASK) | ScRecalcMode::NORMAL; } pCode->AddRecalcMode( nBits ); } diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 2068551..4e5ad52 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -165,7 +165,7 @@ void ImportExcel::Formula( { pCell = rDoc.getDoc().GetFormulaCell(aScPos); if (pCell) - pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); + pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE ); } if (pCell) diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index 6c6d2ec..a8a3026 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -282,7 +282,7 @@ ScFormulaCell *ImportLotus::Formulacell( sal_uInt16 n ) aConv.Convert( pErg, nRest ); ScFormulaCell* pCell = pErg ? new ScFormulaCell(pD, aAddr, *pErg) : new ScFormulaCell(pD, aAddr); - pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); + pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE ); pD->EnsureTable(aAddr.Tab()); pD->SetFormulaCell(aAddr, pCell); diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index 69a9214..bc5b690 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -157,7 +157,7 @@ void OP_Formula(LotusContext &rContext, SvStream& r, sal_uInt16 /*n*/) if (ValidColRow(nCol, nRow)) { ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg); - pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); + pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE ); rContext.pDoc->EnsureTable(0); rContext.pDoc->SetFormulaCell(ScAddress(nCol, nRow, 0), pCell); @@ -404,7 +404,7 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n) if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber()) { ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg); - pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); + pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE ); rContext.pDoc->EnsureTable(nTab); rContext.pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell); } diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx index 0d8829b..7a73b2e 100644 --- a/sc/source/filter/qpro/qpro.cxx +++ b/sc/source/filter/qpro/qpro.cxx @@ -115,7 +115,7 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt { ScFormulaCell* pFormula = new ScFormulaCell(pDoc, aAddr, *pArray); nStyle = nStyle >> 3; - pFormula->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); + pFormula->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE ); pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle ); pDoc->EnsureTable(nTab); pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pFormula); commit 27e8eb73c17bedbf200091ec45c5eddf55a5d8d5 Author: Noel Grandin <n...@peralex.com> Date: Tue Apr 7 15:14:57 2015 +0200 convert SV_ITEMSTATE constants to SvItemState scoped enum Change-Id: I7d7d516f37cbb5e28a842bbc6bff54916d450dbb diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index 5dab12a..099f903 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -516,7 +516,7 @@ SvButtonState SvxFontSubstCheckListBox::GetCheckButtonState( SvTreeListEntry* pE if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); } diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index 51cfc2d..1216c4a 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -214,7 +214,7 @@ bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* ) SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem( nCol )); if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); bCheck = SV_BUTTON_CHECKED == pCheckButtonData->ConvertToButtonState( nButtonFlags ); @@ -397,7 +397,7 @@ SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState( if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); } diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index ca6c61f..ceec6fc 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -791,7 +791,7 @@ SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvTreeListEntry* pEntry if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); } diff --git a/include/svtools/svlbitm.hxx b/include/svtools/svlbitm.hxx index 46e5df4..4c49f3b 100644 --- a/include/svtools/svlbitm.hxx +++ b/include/svtools/svlbitm.hxx @@ -25,6 +25,7 @@ #include <tools/link.hxx> #include <vcl/image.hxx> #include <svtools/treelistbox.hxx> +#include <o3tl/typed_flags_set.hxx> class SvTreeListEntry; @@ -40,6 +41,19 @@ enum class SvBmp STATICIMAGE = 6 }; +enum class SvItemStateFlags +{ + NONE = 0x00, + UNCHECKED = 0x01, + CHECKED = 0x02, + TRISTATE = 0x04, + HILIGHTED = 0x08 +}; +namespace o3tl +{ + template<> struct typed_flags<SvItemStateFlags> : is_typed_flags<SvItemStateFlags, 0x0f> {}; +} + struct SvLBoxButtonData_Impl; class SVT_DLLPUBLIC SvLBoxButtonData @@ -63,7 +77,7 @@ public: ~SvLBoxButtonData(); - SvBmp GetIndex( sal_uInt16 nItemState ); + SvBmp GetIndex( SvItemStateFlags nItemState ); long Width(); long Height(); void SetLink( const Link& rLink) { aLink=rLink; } @@ -72,8 +86,8 @@ public: // as buttons are not derived from LinkHdl void CallLink(); - void StoreButtonState( SvTreeListEntry* pEntry, sal_uInt16 nItemFlags ); - SvButtonState ConvertToButtonState( sal_uInt16 nItemFlags ) const; + void StoreButtonState( SvTreeListEntry* pEntry, SvItemStateFlags nItemFlags ); + SvButtonState ConvertToButtonState( SvItemStateFlags nItemFlags ) const; SvButtonState GetActButtonState() const { return eState; } @@ -126,18 +140,12 @@ public: }; -#define SV_ITEMSTATE_UNCHECKED 0x0001 -#define SV_ITEMSTATE_CHECKED 0x0002 -#define SV_ITEMSTATE_TRISTATE 0x0004 -#define SV_ITEMSTATE_HILIGHTED 0x0008 -#define SV_STATE_MASK 0xFFF8 // for deletion of UNCHECKED,CHECKED,TRISTATE - class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem { bool isVis; SvLBoxButtonData* pData; SvLBoxButtonKind eKind; - sal_uInt16 nItemFlags; + SvItemStateFlags nItemFlags; void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, vcl::Window* pParent ); public: @@ -158,11 +166,11 @@ public: const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; virtual SvLBoxItem* Create() const SAL_OVERRIDE; virtual void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; - sal_uInt16 GetButtonFlags() const { return nItemFlags; } - bool IsStateChecked() const { return (nItemFlags & SV_ITEMSTATE_CHECKED)!=0; } - bool IsStateUnchecked() const { return (nItemFlags & SV_ITEMSTATE_UNCHECKED)!=0; } - bool IsStateTristate() const { return (nItemFlags & SV_ITEMSTATE_TRISTATE)!=0; } - bool IsStateHilighted() const { return (nItemFlags & SV_ITEMSTATE_HILIGHTED)!=0; } + SvItemStateFlags GetButtonFlags() const { return nItemFlags; } + bool IsStateChecked() const { return bool(nItemFlags & SvItemStateFlags::CHECKED); } + bool IsStateUnchecked() const { return bool(nItemFlags & SvItemStateFlags::UNCHECKED); } + bool IsStateTristate() const { return bool(nItemFlags & SvItemStateFlags::TRISTATE); } + bool IsStateHilighted() const { return bool(nItemFlags & SvItemStateFlags::HILIGHTED); } void SetStateChecked(); void SetStateUnchecked(); void SetStateTristate(); @@ -178,25 +186,25 @@ public: inline void SvLBoxButton::SetStateChecked() { - nItemFlags &= SV_STATE_MASK; - nItemFlags |= SV_ITEMSTATE_CHECKED; + nItemFlags &= SvItemStateFlags::HILIGHTED; + nItemFlags |= SvItemStateFlags::CHECKED; } inline void SvLBoxButton::SetStateUnchecked() { - nItemFlags &= SV_STATE_MASK; - nItemFlags |= SV_ITEMSTATE_UNCHECKED; + nItemFlags &= SvItemStateFlags::HILIGHTED; + nItemFlags |= SvItemStateFlags::UNCHECKED; } inline void SvLBoxButton::SetStateTristate() { - nItemFlags &= SV_STATE_MASK; - nItemFlags |= SV_ITEMSTATE_TRISTATE; + nItemFlags &= SvItemStateFlags::HILIGHTED; + nItemFlags |= SvItemStateFlags::TRISTATE; } inline void SvLBoxButton::SetStateHilighted( bool bHilight ) { if ( bHilight ) - nItemFlags |= SV_ITEMSTATE_HILIGHTED; + nItemFlags |= SvItemStateFlags::HILIGHTED; else - nItemFlags &= ~SV_ITEMSTATE_HILIGHTED; + nItemFlags &= ~SvItemStateFlags::HILIGHTED; } diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 2e88f57..00e65e3 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -76,27 +76,23 @@ void SvLBoxButtonData::CallLink() aLink.Call( this ); } -SvBmp SvLBoxButtonData::GetIndex( sal_uInt16 nItemState ) +SvBmp SvLBoxButtonData::GetIndex( SvItemStateFlags nItemState ) { - nItemState &= 0x000F; SvBmp nIdx; - switch( nItemState ) - { - case SV_ITEMSTATE_UNCHECKED: - nIdx = SvBmp::UNCHECKED; break; - case SV_ITEMSTATE_CHECKED: - nIdx = SvBmp::CHECKED; break; - case SV_ITEMSTATE_TRISTATE: - nIdx = SvBmp::TRISTATE; break; - case SV_ITEMSTATE_UNCHECKED | SV_ITEMSTATE_HILIGHTED: - nIdx = SvBmp::HIUNCHECKED; break; - case SV_ITEMSTATE_CHECKED | SV_ITEMSTATE_HILIGHTED: - nIdx = SvBmp::HICHECKED; break; - case SV_ITEMSTATE_TRISTATE | SV_ITEMSTATE_HILIGHTED: - nIdx = SvBmp::HITRISTATE; break; - default: - nIdx = SvBmp::UNCHECKED; - } + if (nItemState == SvItemStateFlags::UNCHECKED) + nIdx = SvBmp::UNCHECKED; + else if (nItemState == SvItemStateFlags::CHECKED) + nIdx = SvBmp::CHECKED; + else if (nItemState == SvItemStateFlags::TRISTATE) + nIdx = SvBmp::TRISTATE; + else if (nItemState == (SvItemStateFlags::UNCHECKED | SvItemStateFlags::HILIGHTED)) + nIdx = SvBmp::HIUNCHECKED; + else if (nItemState == (SvItemStateFlags::CHECKED | SvItemStateFlags::HILIGHTED)) + nIdx = SvBmp::HICHECKED; + else if (nItemState == (SvItemStateFlags::TRISTATE | SvItemStateFlags::HILIGHTED)) + nIdx = SvBmp::HITRISTATE; + else + nIdx = SvBmp::UNCHECKED; return nIdx; } @@ -109,26 +105,24 @@ void SvLBoxButtonData::SetWidthAndHeight() } -void SvLBoxButtonData::StoreButtonState( SvTreeListEntry* pActEntry, sal_uInt16 nItemFlags ) +void SvLBoxButtonData::StoreButtonState( SvTreeListEntry* pActEntry, SvItemStateFlags nItemFlags ) { pImpl->pEntry = pActEntry; eState = ConvertToButtonState( nItemFlags ); } -SvButtonState SvLBoxButtonData::ConvertToButtonState( sal_uInt16 nItemFlags ) const +SvButtonState SvLBoxButtonData::ConvertToButtonState( SvItemStateFlags nItemFlags ) const { - nItemFlags &= (SV_ITEMSTATE_UNCHECKED | - SV_ITEMSTATE_CHECKED | - SV_ITEMSTATE_TRISTATE); + nItemFlags &= (SvItemStateFlags::UNCHECKED | + SvItemStateFlags::CHECKED | + SvItemStateFlags::TRISTATE); switch( nItemFlags ) { - case SV_ITEMSTATE_UNCHECKED: + case SvItemStateFlags::UNCHECKED: return SV_BUTTON_UNCHECKED; - - case SV_ITEMSTATE_CHECKED: + case SvItemStateFlags::CHECKED: return SV_BUTTON_CHECKED; - - case SV_ITEMSTATE_TRISTATE: + case SvItemStateFlags::TRISTATE: return SV_BUTTON_TRISTATE; default: return SV_BUTTON_UNCHECKED; @@ -305,7 +299,7 @@ SvLBoxButton::SvLBoxButton( SvTreeListEntry* pEntry, SvLBoxButtonKind eTheKind, , isVis(true) , pData(pBData) , eKind(eTheKind) - , nItemFlags(0) + , nItemFlags(SvItemStateFlags::NONE) { SetStateUnchecked(); } @@ -315,7 +309,7 @@ SvLBoxButton::SvLBoxButton() , isVis(false) , pData(0) , eKind(SvLBoxButtonKind_enabledCheckbox) - , nItemFlags(0) + , nItemFlags(SvItemStateFlags::NONE) { SetStateUnchecked(); } diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index bf59a71..94e237df 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -554,7 +554,7 @@ bool SvHeaderTabListBox::IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); } @@ -686,7 +686,7 @@ bool SvHeaderTabListBox::IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriSta if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) { bRet = true; - _rState = ( ( pItem->GetButtonFlags() & SV_ITEMSTATE_UNCHECKED ) == 0 ) + _rState = ( ( pItem->GetButtonFlags() & SvItemStateFlags::UNCHECKED ) == SvItemStateFlags::NONE ) ? TRISTATE_TRUE : TRISTATE_FALSE; } } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 9505f84..bc58e2d 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -2006,7 +2006,7 @@ SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) cons SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON)); if(!pItem) return SV_BUTTON_TRISTATE; - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); + SvItemStateFlags nButtonFlags = pItem->GetButtonFlags(); eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); } return eState; commit 90dc63a8ddda7d09635bdf60fcaafc5d0fdbbeeb Author: Noel Grandin <n...@peralex.com> Date: Tue Apr 7 14:28:22 2015 +0200 convert SHADOW_ constants to enum class Change-Id: I1d3c144b2438776a31a246a2d0d4fe57b0caeaa3 diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 25ab875..c69f732 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -113,10 +113,10 @@ sal_uInt16 PosToPageUsage_Impl( sal_uInt16 nPos ) Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) { Size aSz; - aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ); - aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( SvxBoxItemLine::TOP ); - aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( SvxBoxItemLine::LEFT ); - aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ); + aSz.Height() = rShadow.CalcShadowSpace( SvxShadowItemSide::BOTTOM ) + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ); + aSz.Height() += rShadow.CalcShadowSpace( SvxShadowItemSide::TOP ) + rBox.CalcLineSpace( SvxBoxItemLine::TOP ); + aSz.Width() = rShadow.CalcShadowSpace( SvxShadowItemSide::LEFT ) + rBox.CalcLineSpace( SvxBoxItemLine::LEFT ); + aSz.Width() += rShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT ) + rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ); return aSz; } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 2029a85..a25bc0a 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1429,31 +1429,31 @@ SfxPoolItem* SvxShadowItem::Clone( SfxItemPool* ) const -sal_uInt16 SvxShadowItem::CalcShadowSpace( sal_uInt16 nShadow ) const +sal_uInt16 SvxShadowItem::CalcShadowSpace( SvxShadowItemSide nShadow ) const { sal_uInt16 nSpace = 0; switch ( nShadow ) { - case SHADOW_TOP: + case SvxShadowItemSide::TOP: if ( eLocation == SVX_SHADOW_TOPLEFT || eLocation == SVX_SHADOW_TOPRIGHT ) nSpace = nWidth; break; - case SHADOW_BOTTOM: + case SvxShadowItemSide::BOTTOM: if ( eLocation == SVX_SHADOW_BOTTOMLEFT || eLocation == SVX_SHADOW_BOTTOMRIGHT ) nSpace = nWidth; break; - case SHADOW_LEFT: + case SvxShadowItemSide::LEFT: if ( eLocation == SVX_SHADOW_TOPLEFT || eLocation == SVX_SHADOW_BOTTOMLEFT ) nSpace = nWidth; break; - case SHADOW_RIGHT: + case SvxShadowItemSide::RIGHT: if ( eLocation == SVX_SHADOW_TOPRIGHT || eLocation == SVX_SHADOW_BOTTOMRIGHT ) nSpace = nWidth; diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx index 1e9209b..e022cff 100644 --- a/include/editeng/shaditem.hxx +++ b/include/editeng/shaditem.hxx @@ -31,11 +31,7 @@ This item describes the shadow attribute (color, width and position). */ - -#define SHADOW_TOP ((sal_uInt16)0) -#define SHADOW_BOTTOM ((sal_uInt16)1) -#define SHADOW_LEFT ((sal_uInt16)2) -#define SHADOW_RIGHT ((sal_uInt16)3) +enum class SvxShadowItemSide { TOP, BOTTOM, LEFT, RIGHT }; class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface { @@ -77,7 +73,7 @@ public: void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; } // Calculate width of the shadow on the page. - sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const; + sal_uInt16 CalcShadowSpace( SvxShadowItemSide nShadow ) const; virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE; virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index f975939..9db4ecc 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -749,8 +749,8 @@ void ScPrintFunc::UpdateHFHeight( ScPrintHFParam& rParam ) lcl_LineTotal(rParam.pBorder->GetRight()) ) * 100 / nZoom; if (rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE) - nPaperWidth -= ( rParam.pShadow->CalcShadowSpace(SHADOW_LEFT) + - rParam.pShadow->CalcShadowSpace(SHADOW_RIGHT) ) * 100L / nZoom; + nPaperWidth -= ( rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) + + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) ) * 100L / nZoom; pEditEngine->SetPaperSize( Size( nPaperWidth, 10000 ) ); @@ -775,8 +775,8 @@ void ScPrintFunc::UpdateHFHeight( ScPrintHFParam& rParam ) lcl_LineTotal( rParam.pBorder->GetTop() ) + lcl_LineTotal( rParam.pBorder->GetBottom() ); if (rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE) - rParam.nHeight += rParam.pShadow->CalcShadowSpace(SHADOW_TOP) + - rParam.pShadow->CalcShadowSpace(SHADOW_BOTTOM); + rParam.nHeight += rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) + + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM); if (rParam.nHeight < rParam.nManHeight) rParam.nHeight = rParam.nManHeight; // configured minimum @@ -1237,10 +1237,10 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, // aFrameRect - ouside around frame, without shadow if ( pShadow && pShadow->GetLocation() != SVX_SHADOW_NONE ) { - nLeft += (long) ( pShadow->CalcShadowSpace(SHADOW_LEFT) * nScaleX ); - nRight += (long) ( pShadow->CalcShadowSpace(SHADOW_RIGHT) * nScaleX ); - nTop += (long) ( pShadow->CalcShadowSpace(SHADOW_TOP) * nScaleY ); - nBottom += (long) ( pShadow->CalcShadowSpace(SHADOW_BOTTOM) * nScaleY ); + nLeft += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX ); + nRight += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX ); + nTop += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY ); + nBottom += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY ); } Rectangle aFrameRect( Point(nScrX+nLeft, nScrY+nTop), Size(nScrW-nLeft-nRight, nScrH-nTop-nBottom) ); @@ -1731,12 +1731,12 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, if ( rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE ) { - long nLeft = rParam.pShadow->CalcShadowSpace(SHADOW_LEFT); - long nTop = rParam.pShadow->CalcShadowSpace(SHADOW_TOP); + long nLeft = rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT); + long nTop = rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::TOP); aStart.X() += nLeft; aStart.Y() += nTop; - aPaperSize.Width() -= nLeft + rParam.pShadow->CalcShadowSpace(SHADOW_RIGHT); - aPaperSize.Height() -= nTop + rParam.pShadow->CalcShadowSpace(SHADOW_BOTTOM); + aPaperSize.Width() -= nLeft + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT); + aPaperSize.Height() -= nTop + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM); } aFieldData.nPageNo = nPageNo+aTableParam.nFirstPageNo; @@ -1763,8 +1763,8 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, rParam.pBorder->GetDistance(SvxBoxItemLine::TOP) + rParam.pBorder->GetDistance(SvxBoxItemLine::BOTTOM); if (rParam.pShadow && rParam.pShadow->GetLocation() != SVX_SHADOW_NONE) - nMaxHeight += rParam.pShadow->CalcShadowSpace(SHADOW_TOP) + - rParam.pShadow->CalcShadowSpace(SHADOW_BOTTOM); + nMaxHeight += rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) + + rParam.pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM); if (nMaxHeight < rParam.nManHeight-rParam.nDistance) nMaxHeight = rParam.nManHeight-rParam.nDistance; // configured Minimum @@ -2072,8 +2072,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO nDataWidth += pBorderItem->GetDistance(SvxBoxItemLine::LEFT) + pBorderItem->GetDistance(SvxBoxItemLine::RIGHT); //! Line width? if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) - nDataWidth += pShadowItem->CalcShadowSpace(SHADOW_LEFT) + - pShadowItem->CalcShadowSpace(SHADOW_RIGHT); + nDataWidth += pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) + + pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT); if ( bCenterHor ) { nLeftSpace += ( aPageRect.GetWidth() - nDataWidth ) / 2; // LTR or RTL @@ -2095,8 +2095,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO nDataHeight += pBorderItem->GetDistance(SvxBoxItemLine::TOP) + pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM); //! Line width? if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) - nDataHeight += pShadowItem->CalcShadowSpace(SHADOW_TOP) + - pShadowItem->CalcShadowSpace(SHADOW_BOTTOM); + nDataHeight += pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) + + pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM); nTopSpace += ( aPageRect.GetHeight() - nDataHeight ) / 2; if (pBorderItem) nTopSpace -= lcl_LineTotal(pBorderItem->GetTop()); @@ -2142,8 +2142,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO } if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) { - nInnerStartX += (long) ( pShadowItem->CalcShadowSpace(SHADOW_LEFT) * nScaleX ); - nInnerStartY += (long) ( pShadowItem->CalcShadowSpace(SHADOW_TOP) * nScaleY ); + nInnerStartX += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX ); + nInnerStartY += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY ); } if ( bLayoutRTL ) @@ -2196,8 +2196,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO } if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) { - nBorderEndX += (long) ( pShadowItem->CalcShadowSpace(SHADOW_RIGHT) * nScaleX ); - nBorderEndY += (long) ( pShadowItem->CalcShadowSpace(SHADOW_BOTTOM) * nScaleY ); + nBorderEndX += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX ); + nBorderEndY += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY ); } if ( bDoPrint ) @@ -2920,10 +2920,10 @@ Size ScPrintFunc::GetDocPageSize() } if (pShadowItem && pShadowItem->GetLocation() != SVX_SHADOW_NONE) { - aDocPageSize.Width() -= pShadowItem->CalcShadowSpace(SHADOW_LEFT) + - pShadowItem->CalcShadowSpace(SHADOW_RIGHT); - aDocPageSize.Height() -= pShadowItem->CalcShadowSpace(SHADOW_TOP) + - pShadowItem->CalcShadowSpace(SHADOW_BOTTOM); + aDocPageSize.Width() -= pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) + + pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT); + aDocPageSize.Height() -= pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) + + pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM); } return aDocPageSize; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index eac0891..8401666 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2718,8 +2718,8 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, SwTwips nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)(); { SvxShadowItem aShadow( rTab.GetFrmFmt()->GetShadow() ); - nPrtWidth += aShadow.CalcShadowSpace( SHADOW_LEFT ) + - aShadow.CalcShadowSpace( SHADOW_RIGHT ); + nPrtWidth += aShadow.CalcShadowSpace( SvxShadowItemSide::LEFT ) + + aShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT ); } if( nPrtWidth != rTblFrmSz.GetWidth() ) { diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index 1750d7f..14cb4c8 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -37,6 +37,7 @@ class SwScriptInfo; // _GetTxtSize class SwViewShell; class IDocumentSettingAccess; typedef struct _xmlTextWriter *xmlTextWriterPtr; +enum class SvxShadowItemSide; const sal_Unicode CH_BLANK = ' '; // ' ' blank spaces const sal_Unicode CH_BREAK = 0x0A; @@ -448,7 +449,7 @@ public: * @return the shadow space **/ sal_uInt16 CalcShadowSpace( - const sal_uInt16 nShadow, const bool bVertLayout, + const SvxShadowItemSide nShadow, const bool bVertLayout, const bool bSkipLeft, const bool bSkipRight ) const; void dumpAsXml( xmlTextWriterPtr writer = NULL ) const; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 78d3612..4b15cee 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1992,7 +1992,7 @@ void SwBorderAttrs::_CalcTopLine() nTopLine = (bBorderDist && !rBox.GetTop()) ? rBox.GetDistance (SvxBoxItemLine::TOP) : rBox.CalcLineSpace(SvxBoxItemLine::TOP); - nTopLine = nTopLine + rShadow.CalcShadowSpace(SHADOW_TOP); + nTopLine = nTopLine + rShadow.CalcShadowSpace(SvxShadowItemSide::TOP); bTopLine = false; } @@ -2001,7 +2001,7 @@ void SwBorderAttrs::_CalcBottomLine() nBottomLine = (bBorderDist && !rBox.GetBottom()) ? rBox.GetDistance (SvxBoxItemLine::BOTTOM) : rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); - nBottomLine = nBottomLine + rShadow.CalcShadowSpace(SHADOW_BOTTOM); + nBottomLine = nBottomLine + rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM); bBottomLine = false; } @@ -2010,7 +2010,7 @@ void SwBorderAttrs::_CalcLeftLine() nLeftLine = (bBorderDist && !rBox.GetLeft()) ? rBox.GetDistance (SvxBoxItemLine::LEFT) : rBox.CalcLineSpace(SvxBoxItemLine::LEFT); - nLeftLine = nLeftLine + rShadow.CalcShadowSpace(SHADOW_LEFT); + nLeftLine = nLeftLine + rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT); bLeftLine = false; } @@ -2019,7 +2019,7 @@ void SwBorderAttrs::_CalcRightLine() nRightLine = (bBorderDist && !rBox.GetRight()) ? rBox.GetDistance (SvxBoxItemLine::RIGHT) : rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); - nRightLine = nRightLine + rShadow.CalcShadowSpace(SHADOW_RIGHT); + nRightLine = nRightLine + rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT); bRightLine = false; } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index bb724f8..2f129a3 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1498,12 +1498,12 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm, { const SvxShadowItem &rShadow = rAttrs.GetShadow(); if ( bTop ) - (rRect.*fnRect->fnSubTop)(rShadow.CalcShadowSpace(SHADOW_TOP)); - (rRect.*fnRect->fnSubLeft)(rShadow.CalcShadowSpace(SHADOW_LEFT)); + (rRect.*fnRect->fnSubTop)(rShadow.CalcShadowSpace(SvxShadowItemSide::TOP)); + (rRect.*fnRect->fnSubLeft)(rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT)); if ( bBottom ) (rRect.*fnRect->fnAddBottom) - (rShadow.CalcShadowSpace( SHADOW_BOTTOM )); - (rRect.*fnRect->fnAddRight)(rShadow.CalcShadowSpace(SHADOW_RIGHT)); + (rShadow.CalcShadowSpace( SvxShadowItemSide::BOTTOM )); + (rRect.*fnRect->fnAddRight)(rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT)); } } } diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 74cb35ee..663733e 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -666,8 +666,8 @@ const SwRect SwFrm::UnionFrm( bool bBorder ) const if( rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE ) { const SvxShadowItem &rShadow = rAttrs.GetShadow(); - nLeft -= rShadow.CalcShadowSpace( SHADOW_LEFT ); - nAdd += rShadow.CalcShadowSpace( SHADOW_RIGHT ); + nLeft -= rShadow.CalcShadowSpace( SvxShadowItemSide::LEFT ); + nAdd += rShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT ); } } if( IsTxtFrm() && static_cast<const SwTxtFrm*>(this)->HasPara() ) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index ab6522e..9c2a5ae 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -902,8 +902,8 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, SvxLRSpaceItem aLR( pFmt->GetLRSpace() ); SvxShadowItem aSh( pFmt->GetShadow() ); - SwTwips nShRight = aSh.CalcShadowSpace( SHADOW_RIGHT ); - SwTwips nShLeft = aSh.CalcShadowSpace( SHADOW_LEFT ); + SwTwips nShRight = aSh.CalcShadowSpace( SvxShadowItemSide::RIGHT ); + SwTwips nShLeft = aSh.CalcShadowSpace( SvxShadowItemSide::LEFT ); aLR.SetLeft ( rNew.GetLeft() - nShLeft ); aLR.SetRight( rNew.GetRightMax() - rNew.GetRight() - nShRight ); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index b738d9f..768ad63 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -759,10 +759,10 @@ void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor, const bool bJoinWithNext = static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithNext(); const bool bIsVert = GetTxtFrm()->IsVertical(); - aRect.Top(aRect.Top() + GetFont()->CalcShadowSpace(SHADOW_TOP, bIsVert, bJoinWithPrev, bJoinWithNext )); - aRect.Bottom(aRect.Bottom() - GetFont()->CalcShadowSpace(SHADOW_BOTTOM, bIsVert, bJoinWithPrev, bJoinWithNext )); - aRect.Left(aRect.Left() + GetFont()->CalcShadowSpace(SHADOW_LEFT, bIsVert, bJoinWithPrev, bJoinWithNext )); - aRect.Right(aRect.Right() - GetFont()->CalcShadowSpace(SHADOW_RIGHT, bIsVert, bJoinWithPrev, bJoinWithNext )); + aRect.Top(aRect.Top() + GetFont()->CalcShadowSpace(SvxShadowItemSide::TOP, bIsVert, bJoinWithPrev, bJoinWithNext )); + aRect.Bottom(aRect.Bottom() - GetFont()->CalcShadowSpace(SvxShadowItemSide::BOTTOM, bIsVert, bJoinWithPrev, bJoinWithNext )); + aRect.Left(aRect.Left() + GetFont()->CalcShadowSpace(SvxShadowItemSide::LEFT, bIsVert, bJoinWithPrev, bJoinWithNext )); + aRect.Right(aRect.Right() - GetFont()->CalcShadowSpace(SvxShadowItemSide::RIGHT, bIsVert, bJoinWithPrev, bJoinWithNext )); } if ( pRect ) diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index db618f9..a33b8ec 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -306,7 +306,7 @@ SvxShadowLocation SwFont::GetAbsShadowLocation( const bool bVertLayout ) const } sal_uInt16 SwFont::CalcShadowSpace( - const sal_uInt16 nShadow, const bool bVertLayout, + const SvxShadowItemSide nShadow, const bool bVertLayout, const bool bSkipLeft, const bool bSkipRight ) const { sal_uInt16 nSpace = 0; @@ -314,7 +314,7 @@ sal_uInt16 SwFont::CalcShadowSpace( const SvxShadowLocation aLoc = GetAbsShadowLocation( bVertLayout ); switch( nShadow ) { - case SHADOW_TOP: + case SvxShadowItemSide::TOP: if(( aLoc == SVX_SHADOW_TOPLEFT || aLoc == SVX_SHADOW_TOPRIGHT ) && ( nOrient == 0 || nOrient == 1800 || @@ -325,7 +325,7 @@ sal_uInt16 SwFont::CalcShadowSpace( } break; - case SHADOW_BOTTOM: + case SvxShadowItemSide::BOTTOM: if(( aLoc == SVX_SHADOW_BOTTOMLEFT || aLoc == SVX_SHADOW_BOTTOMRIGHT ) && ( nOrient == 0 || nOrient == 1800 || @@ -336,7 +336,7 @@ sal_uInt16 SwFont::CalcShadowSpace( } break; - case SHADOW_LEFT: + case SvxShadowItemSide::LEFT: if(( aLoc == SVX_SHADOW_TOPLEFT || aLoc == SVX_SHADOW_BOTTOMLEFT ) && ( nOrient == 900 || nOrient == 2700 || @@ -347,7 +347,7 @@ sal_uInt16 SwFont::CalcShadowSpace( } break; - case SHADOW_RIGHT: + case SvxShadowItemSide::RIGHT: if(( aLoc == SVX_SHADOW_TOPRIGHT || aLoc == SVX_SHADOW_BOTTOMRIGHT ) && ( nOrient == 900 || nOrient == 2700 || diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx index df0dbf6..925bd67 100644 --- a/sw/source/uibase/frmdlg/frmmgr.cxx +++ b/sw/source/uibase/frmdlg/frmmgr.cxx @@ -483,28 +483,28 @@ SwTwips SwFlyFrmAttrMgr::CalcTopSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(SvxBoxItemLine::TOP); + return rShadow.CalcShadowSpace(SvxShadowItemSide::TOP ) + rBox.CalcLineSpace(SvxBoxItemLine::TOP); } SwTwips SwFlyFrmAttrMgr::CalcBottomSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); + return rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM) + rBox.CalcLineSpace(SvxBoxItemLine::BOTTOM); } SwTwips SwFlyFrmAttrMgr::CalcLeftSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::LEFT); + return rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT) + rBox.CalcLineSpace(SvxBoxItemLine::LEFT); } SwTwips SwFlyFrmAttrMgr::CalcRightSpace() { const SvxShadowItem& rShadow = GetShadow(); const SvxBoxItem& rBox = GetBox(); - return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); + return rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT) + rBox.CalcLineSpace(SvxBoxItemLine::RIGHT); } // erase attribute from the set _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits