sw/inc/ndtxt.hxx | 2 - sw/inc/swcrsr.hxx | 4 +-- sw/source/core/crsr/crsrsh.cxx | 23 +++++++++++------- sw/source/core/crsr/swcrsr.cxx | 16 +++++++----- sw/source/core/doc/docnum.cxx | 30 +++++++++++++----------- sw/source/core/edit/edattr.cxx | 9 ++++--- sw/source/core/inc/txtfrm.hxx | 3 ++ sw/source/core/text/EnhancedPDFExportHelper.cxx | 9 ++++--- sw/source/core/txtnode/ndtxt.cxx | 8 ------ 9 files changed, 56 insertions(+), 48 deletions(-)
New commits: commit fda71de2a01664c8294d357f2025666750f9c1ac Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Nov 6 16:57:15 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Nov 6 16:57:15 2018 +0100 sw_redlinehide_3: adapt SwEditShell::GetScriptType() Change-Id: Iffb09b9145b72a1ac8710e41a0a7d7ad3abe5c33 diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 579150a64000..0584a4d73471 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -565,7 +565,8 @@ static inline SvtScriptType lcl_SetScriptFlags( sal_uInt16 nType ) } } -static bool lcl_IsNoEndTextAttrAtPos( const SwTextNode& rTNd, sal_Int32 nPos, +static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout, + const SwTextNode& rTNd, sal_Int32 const nPos, SvtScriptType &rScrpt, bool bInSelection, bool bNum ) { bool bRet = false; @@ -576,7 +577,7 @@ static bool lcl_IsNoEndTextAttrAtPos( const SwTextNode& rTNd, sal_Int32 nPos, { bRet = false; - if ( rTNd.IsInList() ) + if (sw::IsParaPropsNode(rLayout, rTNd) && rTNd.IsInList()) { OSL_ENSURE( rTNd.GetNumRule(), "<lcl_IsNoEndTextAttrAtPos(..)> - no list style found at text node. Serious defect." ); @@ -686,7 +687,7 @@ SvtScriptType SwEditShell::GetScriptType() const else nScript = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); - if( !lcl_IsNoEndTextAttrAtPos( *pTNd, nPos, nRet, false, false )) + if (!lcl_IsNoEndTextAttrAtPos(*GetLayout(), *pTNd, nPos, nRet, false, false)) nRet |= lcl_SetScriptFlags( nScript ); } } @@ -728,7 +729,7 @@ SvtScriptType SwEditShell::GetScriptType() const g_pBreakIt->GetBreakIter()->getScriptType( rText, nChg ); - if( !lcl_IsNoEndTextAttrAtPos( *pTNd, nChg, nRet, true, + if (!lcl_IsNoEndTextAttrAtPos(*GetLayout(), *pTNd, nChg, nRet, true, 0 == nChg && rText.getLength() == nEndPos)) nRet |= lcl_SetScriptFlags( nScript ); commit 6977b5dbb1dafb5f87cfed31de2292d999785323 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Nov 6 16:38:44 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Nov 6 16:42:20 2018 +0100 sw_redlinehide_3: adapt PDFExport lcl_HasPreviousParaSameNumRule Reuse some formerly static functions in docnum.cxx Change-Id: I8d6bcca28a4f8a6e197a1c302acdf22ce6de01ff diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index b707c2aa631a..693e6fc27497 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1437,8 +1437,10 @@ static bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) return bRet; } -static void -lcl_GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) +namespace sw { + +void +GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (pLayout && pLayout->IsHideRedlines() && rIndex.GetNode().IsTextNode() @@ -1453,8 +1455,8 @@ lcl_GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayou } } -static void -lcl_GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) +void +GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (pLayout && pLayout->IsHideRedlines() && rIndex.GetNode().IsTextNode() @@ -1469,6 +1471,8 @@ lcl_GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayou } } +} // namespace sw + static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower, SwRootFrame const*const pLayout) @@ -1489,7 +1493,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, // If NO_NUMLEVEL is switched on, we search the preceding Node with Numbering bool bError = false; do { - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); if( aIdx.GetNode().IsTextNode() ) { pNd = aIdx.GetNode().GetTextNode(); @@ -1521,12 +1525,12 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, const SwTextNode* pLast; if( bNext ) { - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); pLast = pNd; } else { - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); pLast = nullptr; } @@ -1557,9 +1561,9 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, break; if( bNext ) - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); else - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); } if( !bRet && !bOverUpper && pLast ) // do not iterate over higher numbers, but still to the end @@ -1622,9 +1626,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, if ( !bInvestigateStartNode ) { if (bForward) - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); else - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); } if (aIdx.GetNode().IsTextNode()) @@ -1660,9 +1664,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, if ( bInvestigateStartNode ) { if (bForward) - lcl_GotoNextLayoutTextFrame(aIdx, pLayout); + sw::GotoNextLayoutTextFrame(aIdx, pLayout); else - lcl_GotoPrevLayoutTextFrame(aIdx, pLayout); + sw::GotoPrevLayoutTextFrame(aIdx, pLayout); } pNode = &aIdx.GetNode(); diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 9ecc04e38218..3798990abe92 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -107,6 +107,9 @@ SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos); std::pair<SwTextNode *, SwTextNode *> GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos); +void GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout); +void GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout); + TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged, bool isRealDelete, SwTextNode const& rNode, sal_Int32 nIndex, sal_Int32 nLen); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index f00a2af776af..cf94525a97a2 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -227,7 +227,7 @@ void* lcl_GetKeyFromFrame( const SwFrame& rFrame ) return pKey; } -bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode ) +bool lcl_HasPreviousParaSameNumRule(SwTextFrame const& rTextFrame, const SwTextNode& rNode) { bool bRet = false; SwNodeIndex aIdx( rNode ); @@ -238,11 +238,12 @@ bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode ) while (pNode != rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) ) { - --aIdx; + sw::GotoPrevLayoutTextFrame(aIdx, rTextFrame.getRootFrame()); if (aIdx.GetNode().IsTextNode()) { - const SwTextNode* pPrevTextNd = aIdx.GetNode().GetTextNode(); + const SwTextNode *const pPrevTextNd = sw::GetParaPropsNode( + *rTextFrame.getRootFrame(), *aIdx.GetNode().GetTextNode()); const SwNumRule * pPrevNumRule = pPrevTextNd->GetNumRule(); // We find the previous text node. Now check, if the previous text node @@ -849,7 +850,7 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements() return; const SwNumberTreeNode* pParent = pNodeNum->GetParent(); - const bool bSameNumbering = lcl_HasPreviousParaSameNumRule(*pTextNd); + const bool bSameNumbering = lcl_HasPreviousParaSameNumRule(rTextFrame, *pTextNd); // Second condition: current numbering is not 'interrupted' if ( bSameNumbering ) commit 4eec4494f282dfdfcb1181e5ea9d12d0bcba3ff0 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Nov 6 14:59:27 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Nov 6 14:59:27 2018 +0100 sw_redlinehide_3: adapt more SwCursorShell InFrontOfLabel funcs SwCursorShell::LeftRight() and SetCursor(). Change-Id: I71cd382f06a4050c4676864ac50fb268cd099226 diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 9b454ce1f4dc..73da4699b643 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -333,10 +333,15 @@ bool SwCursorShell::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, } // 2. CASE: Cursor is at beginning of numbered paragraph. A move // to the left will simply set the bInFrontOfLabel flag: - else if ( bLeft && 0 == pShellCursor->GetPoint()->nContent.GetIndex() && - !pShellCursor->IsInFrontOfLabel() && !pShellCursor->HasMark() && - nullptr != ( pTextNd = pShellCursor->GetNode().GetTextNode() ) && - pTextNd->HasVisibleNumberingOrBullet() ) + else if (bLeft + && pShellCursor->GetPoint()->nNode.GetNode().IsTextNode() + && static_cast<SwTextFrame const*>( + pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->getLayoutFrame(GetLayout()) + )->MapModelToViewPos(*pShellCursor->GetPoint()) == TextFrameIndex(0) + && !pShellCursor->IsInFrontOfLabel() + && !pShellCursor->HasMark() + && nullptr != (pTextNd = sw::GetParaPropsNode(*GetLayout(), pShellCursor->GetPoint()->nNode)) + && pTextNd->HasVisibleNumberingOrBullet()) { SetInFrontOfLabel( true ); bRet = true; @@ -751,7 +756,7 @@ int SwCursorShell::SetCursor( const Point &rLPt, bool bOnlyText, bool bBlock ) bOnlyText ? MV_SETONLYTEXT : MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - SwTextNode * pTextNd = pCursor->GetNode().GetTextNode(); + SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode); if ( pTextNd && !IsTableMode() && // #i37515# No bInFrontOfLabel during selection commit 7de87137b95c747799f3b4e429af7d598c83bc3d Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Nov 6 14:29:08 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Nov 6 14:29:08 2018 +0100 sw_redlinehide_3: adapt SwCursorShell::LRMargin/IsAtLRMargin Change-Id: I4576a464b37e786178a3cb31a0be922f1b55db88 diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 6eccacf8f1e3..5c9214dc2d00 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -159,8 +159,8 @@ public: bool bAllowVisual, bool bSkipHidden, bool bInsertCursor, SwRootFrame const* pLayout); bool UpDown(bool bUp, sal_uInt16 nCnt, Point const * pPt, long nUpDownX, SwRootFrame & rLayout); - bool LeftRightMargin( bool bLeftMargin, bool bAPI ); - bool IsAtLeftRightMargin( bool bLeftMargin, bool bAPI ) const; + bool LeftRightMargin(SwRootFrame const& rLayout, bool bLeftMargin, bool bAPI); + bool IsAtLeftRightMargin(SwRootFrame const& rLayout, bool bLeftMargin, bool bAPI) const; bool SttEndDoc( bool bSttDoc ); bool GoPrevNextCell( bool bNext, sal_uInt16 nCnt ); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 4d8631364ab8..9b454ce1f4dc 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -524,14 +524,14 @@ bool SwCursorShell::LRMargin( bool bLeft, bool bAPI) if( m_pBlockCursor ) m_pBlockCursor->clearPoints(); - const bool bWasAtLM = - ( 0 == GetCursor_()->GetPoint()->nContent.GetIndex() ); + const bool bWasAtLM = GetCursor_()->IsAtLeftRightMargin(*GetLayout(), true, bAPI); - bool bRet = pTmpCursor->LeftRightMargin( bLeft, bAPI ); + bool bRet = pTmpCursor->LeftRightMargin(*GetLayout(), bLeft, bAPI); if ( bLeft && !bTableMode && bRet && bWasAtLM && !GetCursor_()->HasMark() ) { const SwTextNode * pTextNd = GetCursor_()->GetNode().GetTextNode(); + assert(sw::GetParaPropsNode(*GetLayout(), GetCursor_()->GetPoint()->nNode) == pTextNd); if ( pTextNd && pTextNd->HasVisibleNumberingOrBullet() ) SetInFrontOfLabel( true ); } @@ -550,7 +550,7 @@ bool SwCursorShell::LRMargin( bool bLeft, bool bAPI) bool SwCursorShell::IsAtLRMargin( bool bLeft, bool bAPI ) const { const SwShellCursor* pTmpCursor = getShellCursor( true ); - return pTmpCursor->IsAtLeftRightMargin( bLeft, bAPI ); + return pTmpCursor->IsAtLeftRightMargin(*GetLayout(), bLeft, bAPI); } bool SwCursorShell::SttEndDoc( bool bStt ) diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 9b5922c62f8f..cd90dee7cf0f 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -2032,12 +2032,12 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, return bRet; } -bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI ) +bool SwCursor::LeftRightMargin(SwRootFrame const& rLayout, bool bLeft, bool bAPI) { Point aPt; std::pair<Point, bool> const tmp(aPt, true); - SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame( - GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); + SwContentFrame const*const pFrame = GetContentNode()->getLayoutFrame( + &rLayout, GetPoint(), &tmp); // calculate cursor bidi level if ( pFrame ) @@ -2049,13 +2049,13 @@ bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI ) && !IsSelOvr( SwCursorSelOverFlags::Toggle | SwCursorSelOverFlags::ChangePos ); } -bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const +bool SwCursor::IsAtLeftRightMargin(SwRootFrame const& rLayout, bool bLeft, bool bAPI) const { bool bRet = false; Point aPt; std::pair<Point, bool> const tmp(aPt, true); - SwContentFrame *const pFrame = GetContentNode()->getLayoutFrame( - GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); + SwContentFrame const*const pFrame = GetContentNode()->getLayoutFrame( + &rLayout, GetPoint(), &tmp); if( pFrame ) { SwPaM aPam( *GetPoint() ); @@ -2063,7 +2063,9 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const --aPam.GetPoint()->nContent; bRet = (bLeft ? pFrame->LeftMargin( &aPam ) : pFrame->RightMargin( &aPam, bAPI )) - && *aPam.GetPoint() == *GetPoint(); + && (!pFrame->IsTextFrame() + || static_cast<SwTextFrame const*>(pFrame)->MapModelToViewPos(*aPam.GetPoint()) + == static_cast<SwTextFrame const*>(pFrame)->MapModelToViewPos(*GetPoint())); } return bRet; } commit 2937a9f0bda40a81d8ec2aba5a3a43b1785f09bc Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Nov 6 12:59:21 2018 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Nov 6 12:59:21 2018 +0100 sw: remove pointless indirection to SwTextNode::GetNumRule_ Change-Id: I4b5d34d3efd4f49f8b1690ed4c2b063c782b9d20 diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index b483d7fc9e9d..10c227a0a056 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -156,8 +156,6 @@ class SW_DLLPUBLIC SwTextNode SAL_DLLPRIVATE void CalcHiddenCharFlags() const; - SAL_DLLPRIVATE SwNumRule * GetNumRule_(bool bInParent) const; - SAL_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM, LanguageType nLang, sal_uInt16 nLangWhichId, const vcl::Font *pFont, sal_uInt16 nFontWhichId ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 88399969cbbd..5e91fb33f995 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2819,8 +2819,7 @@ void SwTextNode::GCAttr() } } -// #i23726# -SwNumRule* SwTextNode::GetNumRule_(bool bInParent) const +SwNumRule* SwTextNode::GetNumRule(bool bInParent) const { SwNumRule* pRet = nullptr; @@ -2860,11 +2859,6 @@ SwNumRule* SwTextNode::GetNumRule_(bool bInParent) const return pRet; } -SwNumRule* SwTextNode::GetNumRule(bool bInParent) const -{ - return GetNumRule_(bInParent); -} - void SwTextNode::NumRuleChgd() { if ( IsInList() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits