diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-12 01:58:52 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-12 05:21:24 +0000 |
commit | d0d64225d853d01bf601b3738c26fd8ada41650e (patch) | |
tree | 54f5d3c3fb553aa9cb95946092428bf42c51b299 | |
parent | 1361c56aab70e579623b69e67dd99edb4c7b8d89 (diff) |
convert SWFMTFLD_ #defines to an enum
Change-Id: I5daf6436fd049410c4863a4b065c9abd95b5d361
Reviewed-on: https://gerrit.libreoffice.org/11928
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | sw/inc/fmtfld.hxx | 25 | ||||
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/text/txtfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrfld.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/undo/SwUndoField.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 2 |
10 files changed, 35 insertions, 32 deletions
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 3c637414126b..9cc505d8c8bb 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -117,27 +117,30 @@ public: { m_wXTextField = xTextField; } }; -class SW_DLLPUBLIC SwFmtFldHint : public SfxHint +enum class SwFmtFldHintWhich { -#define SWFMTFLD_INSERTED 1 -#define SWFMTFLD_REMOVED 2 -#define SWFMTFLD_FOCUS 3 -#define SWFMTFLD_CHANGED 4 -#define SWFMTFLD_LANGUAGE 5 + INSERTED = 1, + REMOVED = 2, + FOCUS = 3, + CHANGED = 4, + LANGUAGE = 5 +}; - const SwFmtFld* pFld; - sal_Int16 nWhich; - const SwView* pView; +class SW_DLLPUBLIC SwFmtFldHint : public SfxHint +{ + const SwFmtFld* pFld; + SwFmtFldHintWhich nWhich; + const SwView* pView; public: - SwFmtFldHint( const SwFmtFld* p, sal_Int16 n, const SwView* pV = 0) + SwFmtFldHint( const SwFmtFld* p, SwFmtFldHintWhich n, const SwView* pV = 0) : pFld(p) , nWhich(n) , pView(pV) {} const SwFmtFld* GetField() const { return pFld; } - sal_Int16 Which() const { return nWhich; } + SwFmtFldHintWhich Which() const { return nWhich; } const SwView* GetView() const { return pView; } }; diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 253a7925513b..4873847f72f4 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -280,8 +280,8 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, SwFmtFldHint( &pTxtFld->GetFmtFld(), ( pTxtFld->GetFmtFld().IsFldInDoc() - ? SWFMTFLD_INSERTED - : SWFMTFLD_REMOVED ) ) ); + ? SwFmtFldHintWhich::INSERTED + : SwFmtFldHintWhich::REMOVED ) ) ); } else if( RES_DDEFLD == pTyp->Which() ) { @@ -1553,7 +1553,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) pEnd->nContent = pStt->nContent; rPam.DeleteMark(); GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0, - rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) ); + rNodes.IsDocNodes() ? SwFmtFldHintWhich::INSERTED : SwFmtFldHintWhich::REMOVED ) ); return; } @@ -1675,7 +1675,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) *pEnd = *pStt; rPam.DeleteMark(); GetDoc()->GetDocShell()->Broadcast( SwFmtFldHint( 0, - rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) ); + rNodes.IsDocNodes() ? SwFmtFldHintWhich::INSERTED : SwFmtFldHintWhich::REMOVED ) ); } ///@see SwNodes::_MoveNodes (TODO: seems to be C&P programming here) diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index b42397e9feea..8b925cf31ac1 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -86,7 +86,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, pFld->SetLanguage( GetFnt()->GetLanguage() ); // let the visual note know about its new language if (pFld->GetTyp()->Which()==RES_POSTITFLD) - const_cast<SwFmtFld*> (&pHint->GetFmtFld())->Broadcast( SwFmtFldHint( &pHint->GetFmtFld(), SWFMTFLD_LANGUAGE ) ); + const_cast<SwFmtFld*> (&pHint->GetFmtFld())->Broadcast( SwFmtFldHint( &pHint->GetFmtFld(), SwFmtFldHintWhich::LANGUAGE ) ); } SwViewShell *pSh = rInf.GetVsh(); diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 732b7220b9b8..828bc64b4a0f 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -119,7 +119,7 @@ SwFmtFld::~SwFmtFld() if (pType && pType->Which() == RES_DBFLD) pType = 0; // DB-Feldtypen zerstoeren sich selbst - Broadcast( SwFmtFldHint( this, SWFMTFLD_REMOVED ) ); + Broadcast( SwFmtFldHint( this, SwFmtFldHintWhich::REMOVED ) ); delete mpField; // bei einige FeldTypen muessen wir den FeldTypen noch loeschen @@ -170,7 +170,7 @@ void SwFmtFld::SetField(SwField * _pField) // see SwWrtShell::StartInputFldDlg static_cast<SwSetExpField *>(GetField())->SetFmtFld(*this); } - Broadcast( SwFmtFldHint( this, SWFMTFLD_CHANGED ) ); + Broadcast( SwFmtFldHint( this, SwFmtFldHintWhich::CHANGED ) ); } void SwFmtFld::SetTxtFld( SwTxtFld& rTxtFld ) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 12d93c369ab7..5e49b5a0df80 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1172,7 +1172,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr ) break; case RES_POSTITFLD: { - const_cast<SwFmtFld&>(pAttr->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pAttr)->GetFmtFld(), SWFMTFLD_REMOVED ) ); + const_cast<SwFmtFld&>(pAttr->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pAttr)->GetFmtFld(), SwFmtFldHintWhich::REMOVED ) ); break; } } @@ -3076,7 +3076,7 @@ bool SwpHints::TryInsertHint( case RES_POSTITFLD: if ( pDoc->GetDocShell() ) - pDoc->GetDocShell()->Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_INSERTED ) ); + pDoc->GetDocShell()->Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SwFmtFldHintWhich::INSERTED ) ); break; } if( bInsFldType ) @@ -3297,7 +3297,7 @@ void SwpHints::DeleteAtPos( const size_t nPos ) } else if ( pHint->Which() == RES_TXTATR_ANNOTATION ) { - const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SWFMTFLD_REMOVED ) ); + const_cast<SwFmtFld&>(((SwTxtFld*)pHint)->GetFmtFld()).Broadcast( SwFmtFldHint( &((SwTxtFld*)pHint)->GetFmtFld(), SwFmtFldHintWhich::REMOVED ) ); } CalcFlags(); diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index 7c11c9bef538..3e1557c3839a 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -98,7 +98,7 @@ void SwUndoFieldFromDoc::DoImpl() SwFmtFld* pDstFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld(); if ( pDoc->getIDocumentFieldsAccess().GetFldType(RES_POSTITFLD, aEmptyOUStr, false) == pDstFmtFld->GetField()->GetTyp() ) - pDoc->GetDocShell()->Broadcast( SwFmtFldHint( pDstFmtFld, SWFMTFLD_INSERTED ) ); + pDoc->GetDocShell()->Broadcast( SwFmtFldHint( pDstFmtFld, SwFmtFldHintWhich::INSERTED ) ); } } diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index e59fd8def0f8..a9d22f1e99a7 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2189,7 +2189,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, if (RES_POSTITFLD == nWhich && m_pImpl->m_pFmtFld) { const_cast<SwFmtFld*>(m_pImpl->m_pFmtFld)->Broadcast( - SwFmtFldHint( 0, SWFMTFLD_CHANGED )); + SwFmtFldHint( 0, SwFmtFldHintWhich::CHANGED )); } // fdo#42073 notify SwTxtFld about changes of the expanded string diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index f5e1f0c50bd4..539b5bab2177 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -134,7 +134,7 @@ void SwAnnotationWin::UpdateData() // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr().SetLayout(); // #i98686# if we have several views, all notes should update their text - mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED)); + mpFmtFld->Broadcast(SwFmtFldHint( 0, SwFmtFldHintWhich::CHANGED)); DocView().GetDocShell()->SetModified(); } Engine()->ClearModifyFlag(); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index fafcbcdd79ce..24880c94b6b5 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -318,7 +318,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SwFmtFld* pFld = const_cast <SwFmtFld*>( rFmtHint.GetField() ); switch ( rFmtHint.Which() ) { - case SWFMTFLD_INSERTED : + case SwFmtFldHintWhich::INSERTED : { if (!pFld) { @@ -339,7 +339,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } break; } - case SWFMTFLD_REMOVED: + case SwFmtFldHintWhich::REMOVED: { if (mbDeleteNote) { @@ -352,13 +352,13 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } break; } - case SWFMTFLD_FOCUS: + case SwFmtFldHintWhich::FOCUS: { if (rFmtHint.GetView()== mpView) Focus(rBC); break; } - case SWFMTFLD_CHANGED: + case SwFmtFldHintWhich::CHANGED: { SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC); for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i) @@ -376,7 +376,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } - case SWFMTFLD_LANGUAGE: + case SwFmtFldHintWhich::LANGUAGE: { SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC); for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i) @@ -1239,7 +1239,7 @@ class FieldDocWatchingStack : public SfxListener if (pHint) { bool bAllInvalidated = false; - if (pHint->Which() == SWFMTFLD_REMOVED) + if (pHint->Which() == SwFmtFldHintWhich::REMOVED) { const SwFmtFld* pFld = pHint->GetField(); bAllInvalidated = pFld == NULL; @@ -1249,7 +1249,7 @@ class FieldDocWatchingStack : public SfxListener v.erase(std::remove(v.begin(), v.end(), pFld), v.end()); } } - else if (pHint->Which() == SWFMTFLD_INSERTED) + else if (pHint->Which() == SwFmtFldHintWhich::INSERTED) { const SwFmtFld* pFld = pHint->GetField(); bAllInvalidated = pFld == NULL; diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 09decb8803bc..cde96b43d8d3 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -409,7 +409,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) { if ( pSwFmtFld->GetField() == pPostIt ) { - pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) ); + pSwFmtFld->Broadcast( SwFmtFldHint( 0, SwFmtFldHintWhich::FOCUS, &GetView() ) ); break; } pSwFmtFld = aIter.Next(); |