diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-25 15:53:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-27 06:08:51 +0000 |
commit | a7ea18ffe715776cb0e2b39e98569c75605ee332 (patch) | |
tree | 1e32da87f2ad0e8d111ba8ed99180bb6b4cf2a77 /sw/source/core | |
parent | eca5ea9f79181d45cd7fbabe2313617d3025818a (diff) |
loplugin:expandablemethods in sw
Change-Id: Ibc9edc28f4041235ab30c026bd3774bd74b7e960
Reviewed-on: https://gerrit.libreoffice.org/30287
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core')
26 files changed, 88 insertions, 222 deletions
diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx b/sw/source/core/SwNumberTree/SwNumberTree.cxx index 49be27e7bdb9..69564bfb5416 100644 --- a/sw/source/core/SwNumberTree/SwNumberTree.cxx +++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx @@ -1070,21 +1070,14 @@ void SwNumberTreeNode::SetLastValid ++aIt; } - SetLastValid(bValidating); + if (mpParent) + { + mpParent->SetLastValid(mpParent->GetIterator(this), bValidating); + } } } } -void SwNumberTreeNode::SetLastValid(bool bValidating) const -{ - if (mpParent) - { - tSwNumberTreeChildren::const_iterator aIt = mpParent->GetIterator(this); - - mpParent->SetLastValid(aIt, bValidating); - } -} - void SwNumberTreeNode::InvalidateTree() const { // do not call SetInvalid, would cause loop !!! diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 2efc1f6d4cf3..a98098a202df 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -267,11 +267,6 @@ bool SwAccessiblePortionData::IsSpecialPortion( size_t nPortionNo ) const return IsPortionAttrSet(nPortionNo, PORATTR_SPECIAL); } -bool SwAccessiblePortionData::IsReadOnlyPortion( size_t nPortionNo ) const -{ - return IsPortionAttrSet(nPortionNo, PORATTR_READONLY); -} - bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const { // gray portions? @@ -729,7 +724,7 @@ bool SwAccessiblePortionData::GetEditableRange( for( size_t nPor = nStartPortion; nPor <= nLastPortion; nPor++ ) { - bIsEditable &= ! IsReadOnlyPortion( nPor ); + bIsEditable &= ! IsPortionAttrSet(nPor, PORATTR_READONLY); } return bIsEditable; diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx index 70ffd53349bd..bd84e2cbf4bd 100644 --- a/sw/source/core/access/accportions.hxx +++ b/sw/source/core/access/accportions.hxx @@ -84,7 +84,6 @@ class SwAccessiblePortionData : public SwPortionHandler /// Access to portion attributes bool IsPortionAttrSet( size_t nPortionNo, sal_uInt8 nAttr ) const; bool IsSpecialPortion( size_t nPortionNo ) const; - bool IsReadOnlyPortion( size_t nPortionNo ) const; bool IsGrayPortionType( sal_uInt16 nType ) const; // helper method for GetEditableRange(...): diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 69de007de8d7..fa9b732b8e2c 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -167,7 +167,7 @@ bool SwCursor::IsSkipOverProtectSections() const // own SaveObjects if needed and validate them in the virtual check routines. void SwCursor::SaveState() { - SwCursor_SavePos* pNew = CreateNewSavePos(); + SwCursor_SavePos* pNew = new SwCursor_SavePos( *this ); pNew->pNext = m_pSavePos; m_pSavePos = pNew; } @@ -182,11 +182,6 @@ void SwCursor::RestoreState() } } -SwCursor_SavePos* SwCursor::CreateNewSavePos() const -{ - return new SwCursor_SavePos( *this ); -} - /// determine if point is outside of the node-array's content area bool SwCursor::IsNoContent() const { diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index e96c431c347c..ac85fe589b96 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1227,7 +1227,7 @@ SwTextFormatColl* SwDoc::CopyTextColl( const SwTextFormatColl& rColl ) /// copy the graphic nodes SwGrfFormatColl* SwDoc::CopyGrfColl( const SwGrfFormatColl& rColl ) { - SwGrfFormatColl* pNewColl = FindGrfFormatCollByName( rColl.GetName() ); + SwGrfFormatColl* pNewColl = static_cast<SwGrfFormatColl*>(FindFormatByName( (SwFormatsBase&)*mpGrfFormatCollTable, rColl.GetName() )); if( pNewColl ) return pNewColl; diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 033379339b14..21e1726900be 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2300,18 +2300,11 @@ void SwDoc::MarkListLevel( const OUString& sListId, if ( pList ) { - MarkListLevel( *pList, nListLevel, bValue ); + // Set new marked list level and notify all affected nodes of the changed mark. + pList->MarkListLevel( nListLevel, bValue ); } } -void SwDoc::MarkListLevel( SwList& rList, - const int nListLevel, - const bool bValue ) -{ - // Set new marked list level and notify all affected nodes of the changed mark. - rList.MarkListLevel( nListLevel, bValue ); -} - bool SwDoc::IsFirstOfNumRuleAtPos( const SwPosition & rPos ) { bool bResult = false; diff --git a/sw/source/core/docnode/threadmanager.cxx b/sw/source/core/docnode/threadmanager.cxx index d82d84fdc7c7..89f97e575b7f 100644 --- a/sw/source/core/docnode/threadmanager.cxx +++ b/sw/source/core/docnode/threadmanager.cxx @@ -74,7 +74,7 @@ oslInterlockedCount ThreadManager::AddThread( // create new thread tThreadData aThreadData; - oslInterlockedCount nNewThreadID( RetrieveNewThreadID() ); + oslInterlockedCount nNewThreadID( osl_atomic_increment( &mnThreadIDCounter ) ); { aThreadData.nThreadID = nNewThreadID; diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index c282108e1a6a..c60b09022062 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1939,7 +1939,7 @@ void SwDrawContact::ChkPage() if ( GetPageFrame() ) GetPageFrame()->RemoveDrawObjFromPage( maAnchoredDrawObj ); pPg->AppendDrawObjToPage( maAnchoredDrawObj ); - SetPageFrame( pPg ); + maAnchoredDrawObj.SetPageFrame( pPg ); } } } diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index b313d9cc2a92..3f78a1db9b39 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -1146,30 +1146,6 @@ void SwInputField::SetFormatField( SwFormatField& rFormatField ) } -void SwInputField::LockNotifyContentChange() -{ - if ( GetFormatField() != nullptr ) - { - SwTextInputField* pTextInputField = dynamic_cast< SwTextInputField* >(GetFormatField()->GetTextField()); - if ( pTextInputField != nullptr ) - { - pTextInputField->LockNotifyContentChange(); - } - } -} - -void SwInputField::UnlockNotifyContentChange() -{ - if ( GetFormatField() != nullptr ) - { - SwTextInputField* pTextInputField = dynamic_cast< SwTextInputField* >(GetFormatField()->GetTextField()); - if ( pTextInputField != nullptr ) - { - pTextInputField->UnlockNotifyContentChange(); - } - } -} - void SwInputField::applyFieldContent( const OUString& rNewFieldContent ) { if ( (nSubType & 0x00ff) == INP_TXT ) @@ -1185,10 +1161,22 @@ void SwInputField::applyFieldContent( const OUString& rNewFieldContent ) pUserTyp->SetContent( rNewFieldContent ); // trigger update of the corresponding User Fields and other related Input Fields + if ( GetFormatField() != nullptr ) + { + SwTextInputField* pTextInputField = dynamic_cast< SwTextInputField* >(GetFormatField()->GetTextField()); + if ( pTextInputField != nullptr ) + { + pTextInputField->LockNotifyContentChange(); + } + } + pUserTyp->UpdateFields(); + if ( GetFormatField() != nullptr ) { - LockNotifyContentChange(); - pUserTyp->UpdateFields(); - UnlockNotifyContentChange(); + SwTextInputField* pTextInputField = dynamic_cast< SwTextInputField* >(GetFormatField()->GetTextField()); + if ( pTextInputField != nullptr ) + { + pTextInputField->UnlockNotifyContentChange(); + } } } } diff --git a/sw/source/core/inc/anchoredobjectposition.hxx b/sw/source/core/inc/anchoredobjectposition.hxx index f4fc3b72a314..afe6717c3de4 100644 --- a/sw/source/core/inc/anchoredobjectposition.hxx +++ b/sw/source/core/inc/anchoredobjectposition.hxx @@ -100,10 +100,6 @@ namespace objectpositioning { return *mpAnchorFrame; } - inline SwContact& GetContact() const - { - return *mpContact; - } inline const SwFrameFormat& GetFrameFormat() const { return *mpFrameFormat; diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx index ea2dba49861e..5826ca4ff9b9 100644 --- a/sw/source/core/inc/cntfrm.hxx +++ b/sw/source/core/inc/cntfrm.hxx @@ -76,7 +76,6 @@ public: inline const SwContentFrame *GetFollow() const; inline SwContentFrame *GetFollow(); - inline const SwContentFrame *GetPrecede() const; SwTextFrame* FindMaster() const; // layout dependent cursor travelling @@ -134,11 +133,6 @@ inline SwContentFrame *SwContentFrame::GetFollow() return static_cast<SwContentFrame*>(SwFlowFrame::GetFollow()); } -inline const SwContentFrame *SwContentFrame::GetPrecede() const -{ - return static_cast<const SwContentFrame*>(SwFlowFrame::GetPrecede()); -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index d207bb0f6f43..37b6ba8f7950 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -125,7 +125,6 @@ protected: void Unlock() { m_bLocked = false; } Size CalcRel( const SwFormatFrameSize &rSz ) const; - SwTwips CalcAutoWidth() const; SwFlyFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor ); diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 6885a6b9bbd3..168ed121dfe9 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -192,8 +192,6 @@ class SwLayNotify : public SwFrameNotify { bool bLowersComplete; - SwLayoutFrame *GetLay() { return static_cast<SwLayoutFrame*>(mpFrame); } - public: SwLayNotify( SwLayoutFrame *pLayFrame ); ~SwLayNotify(); @@ -206,7 +204,6 @@ class SwFlyNotify : public SwLayNotify { SwPageFrame *pOldPage; const SwRect aFrameAndSpace; - SwFlyFrame *GetFly() { return static_cast<SwFlyFrame*>(mpFrame); } public: SwFlyNotify( SwFlyFrame *pFlyFrame ); @@ -224,8 +221,6 @@ private: bool mbInvalidatePrevPrtArea; bool mbBordersJoinedWithPrev; - SwContentFrame *GetCnt(); - public: SwContentNotify( SwContentFrame *pContentFrame ); ~SwContentNotify(); diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index 857719bf9863..fd41e411aca9 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -993,13 +993,8 @@ public: sal_uInt16 nDrawStretchText; sal_uInt16 nChangeFont; - inline void Reset() - { - nGetTextSize = nDrawText = nGetStretchTextSize = - nDrawStretchText = nChangeFont = 0; - } - - inline SvStatistics() { Reset(); } + SvStatistics() + { nGetTextSize = nDrawText = nGetStretchTextSize = nDrawStretchText = nChangeFont = 0; } }; // global variable, implemented in swfont.cxx diff --git a/sw/source/core/inc/threadmanager.hxx b/sw/source/core/inc/threadmanager.hxx index 126973bb58be..83ea7bae6b6d 100644 --- a/sw/source/core/inc/threadmanager.hxx +++ b/sw/source/core/inc/threadmanager.hxx @@ -139,11 +139,6 @@ class ThreadManager } }; - inline oslInterlockedCount RetrieveNewThreadID() - { - return osl_atomic_increment( &mnThreadIDCounter ); - } - bool StartWaitingThread(); bool StartThread( const tThreadData& aThreadData ); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 4c4a655b06b1..772d4cc8a918 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -653,7 +653,7 @@ SwTextFrame* SwContentFrame::FindMaster() const { OSL_ENSURE( IsFollow(), "SwContentFrame::FindMaster(): !IsFollow" ); - const SwContentFrame* pPrec = GetPrecede(); + const SwContentFrame* pPrec = static_cast<const SwContentFrame*>(SwFlowFrame::GetPrecede()); if ( pPrec && pPrec->HasFollow() && pPrec->GetFollow() == this ) { diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 2e7649782a12..8eb91011c6de 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -66,6 +66,7 @@ using namespace ::com::sun::star; +static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame ); SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch ) : SwLayoutFrame( pFormat, pSib ), @@ -1328,7 +1329,7 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if ( rFrameSz.GetWidthSizeType() != ATT_FIX_SIZE ) { // #i9046# Autowidth for fly frames - const SwTwips nAutoWidth = CalcAutoWidth(); + const SwTwips nAutoWidth = lcl_CalcAutoWidth( *this ); if ( nAutoWidth ) { if( ATT_MIN_SIZE == rFrameSz.GetWidthSizeType() ) @@ -2437,11 +2438,6 @@ static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame ) return nRet; } -SwTwips SwFlyFrame::CalcAutoWidth() const -{ - return lcl_CalcAutoWidth( *this ); -} - /// OD 16.04.2003 #i13147# - If called for paint and the <SwNoTextFrame> contains /// a graphic, load of intrinsic graphic has to be avoided. bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour, diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 874c77cd7bea..ade02ed453f3 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -444,7 +444,7 @@ static void lcl_InvalidatePosOfLowers( SwLayoutFrame& _rLayoutFrame ) SwLayNotify::~SwLayNotify() { - SwLayoutFrame *pLay = GetLay(); + SwLayoutFrame *pLay = static_cast<SwLayoutFrame*>(mpFrame); SwRectFnSet aRectFnSet(pLay); bool bNotify = false; if ( pLay->Prt().SSize() != maPrt.SSize() ) @@ -623,7 +623,7 @@ SwFlyNotify::SwFlyNotify( SwFlyFrame *pFlyFrame ) : SwFlyNotify::~SwFlyNotify() { - SwFlyFrame *pFly = GetFly(); + SwFlyFrame *pFly = static_cast<SwFlyFrame*>(mpFrame); if ( pFly->IsNotifyBack() ) { SwViewShell *pSh = pFly->getRootFrame()->GetCurrShell(); @@ -717,11 +717,6 @@ SwFlyNotify::~SwFlyNotify() } } -SwContentFrame *SwContentNotify::GetCnt() -{ - return static_cast<SwContentFrame*>(mpFrame); -} - SwContentNotify::SwContentNotify( SwContentFrame *pContentFrame ) : SwFrameNotify( pContentFrame ), // OD 08.01.2004 #i11859# @@ -750,7 +745,7 @@ SwContentNotify::SwContentNotify( SwContentFrame *pContentFrame ) : SwContentNotify::~SwContentNotify() { - SwContentFrame *pCnt = GetCnt(); + SwContentFrame *pCnt = static_cast<SwContentFrame*>(mpFrame); if ( bSetCompletePaintOnInvalidate ) pCnt->SetCompletePaint(); diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 9bbe93573edc..4b300ce8bf3f 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -859,7 +859,7 @@ SwTwips SwAnchoredObjectPosition::CalcRelPosX( // it has to be drawn aside another object, which have the same horizontal // position and lay below it. if ( dynamic_cast<const SwFlyFrame*>( &GetAnchoredObj() ) != nullptr && - ( GetContact().ObjAnchoredAtPara() || GetContact().ObjAnchoredAtChar() ) && + ( mpContact->ObjAnchoredAtPara() || mpContact->ObjAnchoredAtChar() ) && ( eHoriOrient == text::HoriOrientation::LEFT || eHoriOrient == text::HoriOrientation::RIGHT ) && eRelOrient != text::RelOrientation::CHAR ) { diff --git a/sw/source/core/text/txtpaint.cxx b/sw/source/core/text/txtpaint.cxx index 8f1106f71f68..dc34ca0d1fd3 100644 --- a/sw/source/core/text/txtpaint.cxx +++ b/sw/source/core/text/txtpaint.cxx @@ -21,7 +21,7 @@ #include "swrect.hxx" #include "rootfrm.hxx" -void SwSaveClip::Reset() +SwSaveClip::~SwSaveClip() { // We recover the old state if( pOut && bChg ) diff --git a/sw/source/core/text/txtpaint.hxx b/sw/source/core/text/txtpaint.hxx index 29435b1cacb7..d520edceeda6 100644 --- a/sw/source/core/text/txtpaint.hxx +++ b/sw/source/core/text/txtpaint.hxx @@ -40,19 +40,14 @@ public: { } - inline ~SwSaveClip(); + ~SwSaveClip(); inline void ChgClip( const SwRect &rRect, const SwTextFrame* pFrame = nullptr, bool bEnlargeRect = false) { if( pOut ) ChgClip_( rRect, pFrame, bEnlargeRect ); } - void Reset(); inline bool IsOn() const { return bOn; } inline bool IsChg() const { return bChg; } }; -inline SwSaveClip::~SwSaveClip() -{ - Reset(); -} #ifdef DBG_UTIL diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 53cd81afd46e..ec463aec97a0 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -653,8 +653,9 @@ SwTextMeta * Meta::GetTextAttr() const } -void Meta::NotifyChangeTextNodeImpl() +void Meta::NotifyChangeTextNode(SwTextNode *const pTextNode) { + m_pTextNode = pTextNode; if (m_pTextNode && (GetRegisteredIn() != m_pTextNode)) { m_pTextNode->Add(this); @@ -663,12 +664,6 @@ void Meta::NotifyChangeTextNodeImpl() { GetRegisteredInNonConst()->Remove(this); } -} - -void Meta::NotifyChangeTextNode(SwTextNode *const pTextNode) -{ - m_pTextNode = pTextNode; - NotifyChangeTextNodeImpl(); if (!pTextNode) // text node gone? invalidate UNO object! { SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 83370a6b9919..dca6d1b9764b 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -93,6 +93,36 @@ using namespace ::com::sun::star::smarttags; extern const SwTextNode *pLinguNode; extern SwTextFrame *pLinguFrame; +struct SwParaIdleData_Impl +{ + SwWrongList* pWrong; // for spell checking + SwGrammarMarkUp* pGrammarCheck; // for grammar checking / proof reading + SwWrongList* pSmartTags; + sal_uLong nNumberOfWords; + sal_uLong nNumberOfAsianWords; + sal_uLong nNumberOfChars; + sal_uLong nNumberOfCharsExcludingSpaces; + bool bWordCountDirty; + SwTextNode::WrongState eWrongDirty; ///< online spell checking needed/done? + bool bGrammarCheckDirty; + bool bSmartTagDirty; + bool bAutoComplDirty; // die ACompl-Liste muss angepasst werden + + SwParaIdleData_Impl() : + pWrong ( nullptr ), + pGrammarCheck ( nullptr ), + pSmartTags ( nullptr ), + nNumberOfWords ( 0 ), + nNumberOfAsianWords ( 0 ), + nNumberOfChars ( 0 ), + nNumberOfCharsExcludingSpaces ( 0 ), + bWordCountDirty ( true ), + eWrongDirty ( SwTextNode::WrongState::TODO ), + bGrammarCheckDirty ( true ), + bSmartTagDirty ( true ), + bAutoComplDirty ( true ) {}; +}; + /* * This has basically the same function as SwScriptInfo::MaskHiddenRanges, * only for deleted redlines @@ -2000,10 +2030,13 @@ bool SwTextNode::CountWords( SwDocStat& rStat, if ( bCountAll && !IsWordCountDirty() ) { // accumulate into DocStat record to return the values - rStat.nWord += GetParaNumberOfWords(); - rStat.nAsianWord += GetParaNumberOfAsianWords(); - rStat.nChar += GetParaNumberOfChars(); - rStat.nCharExcludingSpaces += GetParaNumberOfCharsExcludingSpaces(); + if (m_pParaIdleData_Impl) + { + rStat.nWord += m_pParaIdleData_Impl->nNumberOfWords; + rStat.nAsianWord += m_pParaIdleData_Impl->nNumberOfAsianWords; + rStat.nChar += m_pParaIdleData_Impl->nNumberOfChars; + rStat.nCharExcludingSpaces += m_pParaIdleData_Impl->nNumberOfCharsExcludingSpaces; + } return false; } @@ -2093,10 +2126,13 @@ bool SwTextNode::CountWords( SwDocStat& rStat, // If counting the whole para then update cached values and mark clean if ( bCountAll ) { - SetParaNumberOfWords( nTmpWords ); - SetParaNumberOfAsianWords( nTmpAsianWords ); - SetParaNumberOfChars( nTmpChars ); - SetParaNumberOfCharsExcludingSpaces( nTmpCharsExcludingSpaces ); + if ( m_pParaIdleData_Impl ) + { + m_pParaIdleData_Impl->nNumberOfWords = nTmpWords; + m_pParaIdleData_Impl->nNumberOfAsianWords = nTmpAsianWords; + m_pParaIdleData_Impl->nNumberOfChars = nTmpChars; + m_pParaIdleData_Impl->nNumberOfCharsExcludingSpaces = nTmpCharsExcludingSpaces; + } SetWordCountDirty( false ); } // accumulate into DocStat record to return the values @@ -2110,36 +2146,6 @@ bool SwTextNode::CountWords( SwDocStat& rStat, // Paragraph statistics start --> -struct SwParaIdleData_Impl -{ - SwWrongList* pWrong; // for spell checking - SwGrammarMarkUp* pGrammarCheck; // for grammar checking / proof reading - SwWrongList* pSmartTags; - sal_uLong nNumberOfWords; - sal_uLong nNumberOfAsianWords; - sal_uLong nNumberOfChars; - sal_uLong nNumberOfCharsExcludingSpaces; - bool bWordCountDirty; - SwTextNode::WrongState eWrongDirty; ///< online spell checking needed/done? - bool bGrammarCheckDirty; - bool bSmartTagDirty; - bool bAutoComplDirty; // die ACompl-Liste muss angepasst werden - - SwParaIdleData_Impl() : - pWrong ( nullptr ), - pGrammarCheck ( nullptr ), - pSmartTags ( nullptr ), - nNumberOfWords ( 0 ), - nNumberOfAsianWords ( 0 ), - nNumberOfChars ( 0 ), - nNumberOfCharsExcludingSpaces ( 0 ), - bWordCountDirty ( true ), - eWrongDirty ( SwTextNode::WrongState::TODO ), - bGrammarCheckDirty ( true ), - bSmartTagDirty ( true ), - bAutoComplDirty ( true ) {}; -}; - void SwTextNode::InitSwParaStatistics( bool bNew ) { if ( bNew ) @@ -2216,45 +2222,6 @@ SwWrongList* SwTextNode::GetSmartTags() return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->pSmartTags : nullptr; } -void SwTextNode::SetParaNumberOfWords( sal_uLong nNew ) const -{ - if ( m_pParaIdleData_Impl ) - { - m_pParaIdleData_Impl->nNumberOfWords = nNew; - } -} - -sal_uLong SwTextNode::GetParaNumberOfWords() const -{ - return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->nNumberOfWords : 0; -} - -void SwTextNode::SetParaNumberOfAsianWords( sal_uLong nNew ) const -{ - if ( m_pParaIdleData_Impl ) - { - m_pParaIdleData_Impl->nNumberOfAsianWords = nNew; - } -} - -sal_uLong SwTextNode::GetParaNumberOfAsianWords() const -{ - return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->nNumberOfAsianWords : 0; -} - -void SwTextNode::SetParaNumberOfChars( sal_uLong nNew ) const -{ - if ( m_pParaIdleData_Impl ) - { - m_pParaIdleData_Impl->nNumberOfChars = nNew; - } -} - -sal_uLong SwTextNode::GetParaNumberOfChars() const -{ - return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->nNumberOfChars : 0; -} - void SwTextNode::SetWordCountDirty( bool bNew ) const { if ( m_pParaIdleData_Impl ) @@ -2263,19 +2230,6 @@ void SwTextNode::SetWordCountDirty( bool bNew ) const } } -sal_uLong SwTextNode::GetParaNumberOfCharsExcludingSpaces() const -{ - return m_pParaIdleData_Impl ? m_pParaIdleData_Impl->nNumberOfCharsExcludingSpaces : 0; -} - -void SwTextNode::SetParaNumberOfCharsExcludingSpaces( sal_uLong nNew ) const -{ - if ( m_pParaIdleData_Impl ) - { - m_pParaIdleData_Impl->nNumberOfCharsExcludingSpaces = nNew; - } -} - bool SwTextNode::IsWordCountDirty() const { return m_pParaIdleData_Impl && m_pParaIdleData_Impl->bWordCountDirty; diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 334e75ffb48f..e630254389d6 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -249,21 +249,15 @@ void SwUndo::Repeat(SfxRepeatTarget & rContext) bool SwUndo::CanRepeat(SfxRepeatTarget & rContext) const { - ::sw::RepeatContext *const pRepeatContext( - dynamic_cast< ::sw::RepeatContext * >(& rContext)); - assert(pRepeatContext); - return CanRepeatImpl(*pRepeatContext); + assert(dynamic_cast< ::sw::RepeatContext * >(& rContext)); + (void)rContext; + return (REPEAT_START <= GetId()) && (GetId() < REPEAT_END); } void SwUndo::RepeatImpl( ::sw::RepeatContext & ) { } -bool SwUndo::CanRepeatImpl( ::sw::RepeatContext & ) const -{ - return ((REPEAT_START <= GetId()) && (GetId() < REPEAT_END)); -} - OUString SwUndo::GetComment() const { OUString aResult; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 5734c6de05ff..d56428d96c49 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -3626,7 +3626,7 @@ void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ ) SolarMutexGuard aGuard; SwOLENode* pNd = nullptr; - SwFormat* pFormat = GetFormat(); + SwFormat* pFormat = const_cast<SwFormat*>(static_cast<const SwFormat*>(GetRegisteredIn())); if(pFormat) {const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx(); if(pIdx) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 676ea7be0239..75cfdea7bdf4 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1202,7 +1202,7 @@ SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox2) double SwXCell::GetForcedNumericalValue() const { - if(table::CellContentType_TEXT != getType()) + if(table::CellContentType_TEXT != const_cast<SwXCell*>(this)->getType()) return getValue(); // now we'll try to get a useful numerical value // from the text in the cell... |