sw/inc/node.hxx | 5 --- sw/source/core/doc/notxtfrm.cxx | 2 - sw/source/core/docnode/node.cxx | 2 - sw/source/core/edit/autofmt.cxx | 53 ++++++++++++++++++-------------- sw/source/core/frmedt/fedesc.cxx | 3 + sw/source/core/frmedt/fews.cxx | 3 + sw/source/uibase/docvw/PageBreakWin.cxx | 3 + 7 files changed, 37 insertions(+), 34 deletions(-)
New commits: commit 27173249b3f5b005ec4fa07a4014be3ebaa83a4f Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 22 18:58:16 2018 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Nov 22 18:58:51 2018 +0100 sw: remove newly unused SwNode::m_nAFormatNumLvl Change-Id: I2a26d53ca5b8da3a413088e8b9319b9b04632df2 diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index 8f817d0b12bd..3c0842780c0f 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -83,8 +83,6 @@ class SW_DLLPUBLIC SwNode SwNodeType const m_nNodeType; - /// For text nodes: level of auto format. Was put here because we had still free bits. - sal_uInt8 m_nAFormatNumLvl : 3; bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag public: @@ -135,9 +133,6 @@ public: inline const SwEndNode* EndOfSectionNode() const; inline SwEndNode* EndOfSectionNode(); - sal_uInt8 GetAutoFormatLvl() const { return m_nAFormatNumLvl; } - void SetAutoFormatLvl( sal_uInt8 nVal ) { m_nAFormatNumLvl = nVal; } - bool IsIgnoreDontExpand() const { return m_bIgnoreDontExpand; } void SetIgnoreDontExpand( bool bNew ) { m_bIgnoreDontExpand = bNew; } diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 19cafd55a313..7104499d97ce 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -284,7 +284,6 @@ long SwNode::s_nSerial = 0; SwNode::SwNode( const SwNodeIndex &rWhere, const SwNodeType nNdType ) : m_nNodeType( nNdType ) - , m_nAFormatNumLvl( 0 ) , m_bIgnoreDontExpand( false) , m_eMerge(Merge::None) #ifdef DBG_UTIL @@ -317,7 +316,6 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const SwNodeType nNdType ) */ SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNdType ) : m_nNodeType( nNdType ) - , m_nAFormatNumLvl( 0 ) , m_bIgnoreDontExpand( false) , m_eMerge(Merge::None) #ifdef DBG_UTIL commit 56f0e1b1b713e68fa186a63403a3a6cfd8b885c3 Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 22 18:42:03 2018 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Nov 22 18:45:17 2018 +0100 sw: remove SetAutoFormatLvl calls in SwAutoFormat BuildTextIndent() calls SetAutoFormatLvl() if bAFormatByInput, while also setting the node's style to RES_POOLCOLL_TEXT_MOVE. Then CalcLevel short-cuts if the node has the style RES_POOLCOLL_TEXT_MOVE and bAFormatByInput is set, and it also resets via SetAutoFormatLvl(0). So BuildTextIndent() affects the next caller of CalcLevel() on that node, but not the 2nd or later callers. Of the callers of BuildTextIndent(), one of them will actually call CalcLevel() immediately, while the others all set the state to READ_NEXT_PARA; since the iteration is always forward, CalcLevel() will not be called on that node while the SwAutoFormat instance is alive. It doesn't make sense to affect the next SwAutoFormat invocation but not the one after that? So just replace this with a return value from BuildTextIndent() that is checked in the one immediate use location. Change-Id: I548358c508ac65cc07d13da6708e285c910e1663 diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index d60f9e53f6dc..fac1e373b1bb 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -164,7 +164,7 @@ class SwAutoFormat void BuildIndent(); void BuildText(); - void BuildTextIndent(); + sal_uInt16 BuildTextIndent(); void BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ); void BuildNegIndent( SwTwips nSpaces ); void BuildHeadLine( sal_uInt16 nLvl ); @@ -428,13 +428,6 @@ sal_uInt16 SwAutoFormat::CalcLevel( const SwTextNode& rNd, sal_uInt16 *pDigitLvl if( RES_POOLCOLL_TEXT_MOVE == rNd.GetTextColl()->GetPoolFormatId() ) { - if( m_aFlags.bAFormatByInput ) - { - nLvl = rNd.GetAutoFormatLvl(); - const_cast<SwTextNode&>(rNd).SetAutoFormatLvl( 0 ); - if( nLvl ) - return nLvl; - } ++nLvl; } @@ -1278,7 +1271,7 @@ void SwAutoFormat::BuildIndent() AutoCorrect(); } -void SwAutoFormat::BuildTextIndent() +sal_uInt16 SwAutoFormat::BuildTextIndent() { SetRedlineText( STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT); // read all succeeding paragraphs that belong to this indentation @@ -1290,8 +1283,11 @@ void SwAutoFormat::BuildTextIndent() IsBlanksInString( *m_pCurTextNd ) || IsSentenceAtEnd( *m_pCurTextNd ); + sal_uInt16 nRet(0); if( m_aFlags.bAFormatByInput ) - m_pCurTextNd->SetAutoFormatLvl( static_cast<sal_uInt8>(CalcLevel( *m_pCurTextNd )) ); + { + nRet = CalcLevel( *m_pCurTextNd ); + } SetColl( RES_POOLCOLL_TEXT_MOVE ); if( !bBreak ) @@ -1314,6 +1310,7 @@ void SwAutoFormat::BuildTextIndent() } DeleteLeadingTrailingBlanks(); AutoCorrect(); + return nRet; } void SwAutoFormat::BuildText() @@ -2252,6 +2249,8 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & break; } + sal_uInt16 nBuildTextIndentLevel(0); + // check for hard spaces or LRSpaces set by the template if( IsPoolUserFormat( nPoolId ) || RES_POOLCOLL_STANDARD == nPoolId ) @@ -2286,14 +2285,22 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & else if( 0 > nSz ) // negative 1st line indentation BuildNegIndent( aFInfo.GetLineStart() ); else if( pLRSpace->GetTextLeft() ) // is indentation - BuildTextIndent(); + nBuildTextIndentLevel = BuildTextIndent(); } eStat = READ_NEXT_PARA; break; } } - nLevel = CalcLevel( *m_pCurTextNd, &nDigitLvl ); + if (nBuildTextIndentLevel != 0) + { + nLevel = nBuildTextIndentLevel; + nDigitLvl = USHRT_MAX; + } + else + { + nLevel = CalcLevel( *m_pCurTextNd, &nDigitLvl ); + } m_bMoreLines = !IsOneLine( *m_pCurTextNd ); pNxtNd = GetNextNode(); if( pNxtNd ) commit 0928511681627057b3b0c538695e1b6de513fe96 Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 22 17:47:08 2018 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Nov 22 17:47:08 2018 +0100 sw: rename misleading DeleteCurrentParagraph() Change-Id: I0b874852a4c1aab8d5d3a55b9dfef360e313089c diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 37865d7c9a98..d60f9e53f6dc 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -174,7 +174,7 @@ class SwAutoFormat void DeleteSel( SwPaM& rPam ); bool DeleteCurNxtPara( const OUString& rNxtPara ); /// delete in the node start and/or end - void DeleteCurrentParagraph( bool bStart = true, bool bEnd = true ); + void DeleteLeadingTrailingBlanks( bool bStart = true, bool bEnd = true ); void DelEmptyLine( bool bTstNextPara = true ); /// when using multiline paragraphs delete the "left" and/or /// "right" margins @@ -333,7 +333,7 @@ OUString SwAutoFormat::GoNextPara() bool SwAutoFormat::HasObjects( const SwNode& rNd ) { // Is there something bound to the paragraph in the paragraph - // like borders, DrawObjects, ... + // like Frames, DrawObjects, ... bool bRet = false; const SwFrameFormats& rFormats = *m_pDoc->GetSpzFrameFormats(); for( auto pFrameFormat : rFormats ) @@ -1055,7 +1055,7 @@ bool SwAutoFormat::IsSentenceAtEnd( const SwTextNode& rTextNd ) } /// Delete beginning and/or end in a node -void SwAutoFormat::DeleteCurrentParagraph( bool bStart, bool bEnd ) +void SwAutoFormat::DeleteLeadingTrailingBlanks(bool bStart, bool bEnd) { if( m_aFlags.bAFormatByInput ? m_aFlags.bAFormatByInpDelSpacesAtSttEnd @@ -1274,7 +1274,7 @@ void SwAutoFormat::BuildIndent() !CalcLevel( *pNxtNd ) ); } } - DeleteCurrentParagraph(); + DeleteLeadingTrailingBlanks(); AutoCorrect(); } @@ -1312,7 +1312,7 @@ void SwAutoFormat::BuildTextIndent() pNxtNd = GetNextNode(); } } - DeleteCurrentParagraph(); + DeleteLeadingTrailingBlanks(); AutoCorrect(); } @@ -1349,7 +1349,7 @@ void SwAutoFormat::BuildText() break; } } - DeleteCurrentParagraph(); + DeleteLeadingTrailingBlanks(); AutoCorrect(); } @@ -1382,7 +1382,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) IsBlanksInString( *m_pCurTextNd ) || IsSentenceAtEnd( *m_pCurTextNd ); bool bRTL = m_pEditShell->IsInRightToLeftText(); - DeleteCurrentParagraph(); + DeleteLeadingTrailingBlanks(); bool bChgBullet = false, bChgEnum = false; sal_Int32 nAutoCorrPos = 0; @@ -1660,7 +1660,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) if(!pNxtNd || pCurrNode == pNxtNd) break; } - DeleteCurrentParagraph( false ); + DeleteLeadingTrailingBlanks( false ); AutoCorrect( nAutoCorrPos ); } @@ -1745,7 +1745,7 @@ void SwAutoFormat::BuildNegIndent( SwTwips nSpaces ) pNxtNd = GetNextNode(); } } - DeleteCurrentParagraph(); + DeleteLeadingTrailingBlanks(); AutoCorrect(); } @@ -1766,7 +1766,7 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl ) DelPrevPara(); - DeleteCurrentParagraph( true, false ); + DeleteLeadingTrailingBlanks( true, false ); (void)DeleteCurNxtPara( OUString() ); m_aDelPam.DeleteMark(); @@ -1776,7 +1776,7 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl ) } else { - DeleteCurrentParagraph(); + DeleteLeadingTrailingBlanks(); AutoCorrect(); } } commit 4f7e1f3fa200e5ef851a5450328ce03845ffd725 Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 22 15:59:35 2018 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Nov 22 15:59:35 2018 +0100 sw: remove nutso check from SwNoTextFrame::PaintPicture() This is a remnant of code that was removed with commits 2cbc57c8283d26924d95b77398f85e96ca4ea155 CWS swqbf91 and becf02e58637276ab80227ffb19aa01c86e4962d CWS swqbf89. The level counter was apparently abused to store the load status of SwGrfNode's image. Since the counter is always 0, the condition is always true and TriggerAsyncRetrieveInputStream() is always called here; let's hope not calling it isn't going to break anything. Change-Id: I4cef0ddab081ed2df1fc6e88230a8c19a5632d7e diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 51c43fa0e2a1..27d289092dcb 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1075,7 +1075,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr if( !pGrfObj || !pGrfObj->IsDataComplete() || !(aTmpSz = pGrfNd->GetTwipSize()).Width() || - !aTmpSz.Height() || !pGrfNd->GetAutoFormatLvl() ) + !aTmpSz.Height()) { pGrfNd->TriggerAsyncRetrieveInputStream(); // #i73788# } commit 8c1d0877daad9921d706dfa595d0e1ed52f02ee6 Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 22 11:57:15 2018 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Nov 22 11:57:15 2018 +0100 sw_redlinehide_4a: some page break calls in SwFEShell/PageBreakWin ... should use layout. Change-Id: Iabb29bb49558ef1c805ede3300042b815f62136a diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index 89c0af0b475b..f386ffece16f 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -102,7 +102,8 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) SwPaM aPaM( pFlow->IsTextFrame() ? *static_cast<SwTextFrame const*>(pFlow)->GetTextNodeFirst() // first, for PAGEDESC : *static_cast<const SwNoTextFrame*>(pFlow)->GetNode() ); - GetDoc()->getIDocumentContentOperations().InsertPoolItem( aPaM, aNew ); + GetDoc()->getIDocumentContentOperations().InsertPoolItem( + aPaM, aNew, SetAttrMode::DEFAULT, GetLayout()); } EndAllActionAndCall(); } diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 8b2dfc35fdd5..1ea8ac20ec4e 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -351,7 +351,8 @@ static void lcl_SetAPageOffset( sal_uInt16 nOffset, SwPageFrame* pPage, SwFEShel pThis->GetDoc()->SetAttr( aDesc, *pFrame->FindTabFrame()->GetFormat() ); else { - pThis->GetDoc()->getIDocumentContentOperations().InsertPoolItem( *pThis->GetCursor(), aDesc ); + pThis->GetDoc()->getIDocumentContentOperations().InsertPoolItem( + *pThis->GetCursor(), aDesc, SetAttrMode::DEFAULT, pThis->GetLayout()); } pThis->EndAllAction(); diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 87f2b1fb442f..f0b7048f19cf 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -292,7 +292,8 @@ void SwPageBreakWin::Select() aSet.Put( SwFormatPageDesc( nullptr ) ); SwPaM aPaM( *pNd ); - pNd->GetDoc()->getIDocumentContentOperations().InsertItemSet( aPaM, aSet ); + pNd->GetDoc()->getIDocumentContentOperations().InsertItemSet( + aPaM, aSet, SetAttrMode::DEFAULT, GetPageFrame()->getRootFrame()); pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr ); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
