[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 13 commits - sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 25 15:52:29 UTC 2018
sw/inc/IDocumentOutlineNodes.hxx | 5
sw/inc/doc.hxx | 4
sw/inc/ndtxt.hxx | 2
sw/inc/node.hxx | 2
sw/source/core/crsr/crsrsh.cxx | 2
sw/source/core/crsr/crstrvl.cxx | 90 +++++++++++---
sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 2
sw/source/core/doc/DocumentOutlineNodesManager.cxx | 51 +++++++
sw/source/core/doc/docnum.cxx | 40 ++++--
sw/source/core/doc/ftnidx.cxx | 74 +++++++++--
sw/source/core/docnode/node.cxx | 45 ++++---
sw/source/core/edit/ednumber.cxx | 22 ++-
sw/source/core/inc/DocumentOutlineNodesManager.hxx | 3
sw/source/core/inc/txtfrm.hxx | 1
sw/source/core/layout/wsfrm.cxx | 9 +
sw/source/core/text/EnhancedPDFExportHelper.cxx | 7 -
sw/source/core/text/txtfld.cxx | 4
sw/source/core/text/txtfrm.cxx | 22 +++
sw/source/core/txtnode/ndtxt.cxx | 4
sw/source/ui/fldui/fldref.cxx | 8 -
sw/source/uibase/shells/listsh.cxx | 18 ++
sw/source/uibase/utlui/content.cxx | 25 ++-
22 files changed, 343 insertions(+), 97 deletions(-)
New commits:
commit b8711183cda6a1cfbe34b57291f8553a24917f15
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 16:35:07 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 16:35:07 2018 +0200
sw_redlinehide_3: update frames in SwDoc::MoveParagraph()
... for hidden mode.
Change-Id: I61f240ee7e4e3b61d53b07170be195c15fd679ae
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 4918abd8e651..78696475537f 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1996,6 +1996,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
aPam.GetBound(false).nContent.Assign( nullptr, 0 );
getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
+ sw::UpdateFramesForAddDeleteRedline(*this, *pNewRedline);
// Still NEEDS to be optimized!
getIDocumentRedlineAccess().SetRedlineFlags( eOld );
commit c6439a20b037806fc1302bae41125c6b5b1168b2
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 16:32:04 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 16:34:31 2018 +0200
sw_redlinehide_3: fix bad redlines in SwDoc::MoveParagraph()
Avoid creating a redline that ends on an EndNode (if the moved node is
the last in the body), and also ensure that the redline has valid
SwIndex nContent in its positions (because lcl_CheckPosition asserts
that).
Change-Id: I9b89d8cbc180453c24d9690ac937adb4512f0aeb
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index b9426acafe27..4918abd8e651 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1902,7 +1902,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
SwPosition aInsPos( aIdx );
aInsPos.nContent.Assign( aIdx.GetNode().GetContentNode(), 0 );
- SwPaM aPam( pStt->nNode, aMvRg.aEnd );
+ SwPaM aPam( pStt->nNode, 0, aMvRg.aEnd, 0 );
SwPaM& rOrigPam = const_cast<SwPaM&>(rPam);
rOrigPam.DeleteMark();
@@ -1967,6 +1967,14 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
++rOrigPam.GetPoint()->nNode;
rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 );
+ assert(*aPam.GetMark() < *aPam.GetPoint());
+ if (aPam.GetPoint()->nNode.GetNode().IsEndNode())
+ { // ensure redline ends on content node
+ --aPam.GetPoint()->nNode;
+ assert(aPam.GetPoint()->nNode.GetNode().IsTextNode());
+ SwTextNode *const pNode(aPam.GetPoint()->nNode.GetNode().GetTextNode());
+ aPam.GetPoint()->nContent.Assign(pNode, pNode->Len());
+ }
RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags();
GetDocumentRedlineManager().checkRedlining(eOld);
commit aa0b79bff2b328294ae837abef5e58d9feace514
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 13:25:59 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt SwTextNode::IsNumbered() & callers
Answer depends on layout.
Change-Id: Ibc7bddfa1b04630ddcfcfa429fbb507347073ce2
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 05bdb53b2f1f..d00b280abeb3 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -528,7 +528,7 @@ public:
@retval true This node is numbered.
@retval false else
*/
- bool IsNumbered() const;
+ bool IsNumbered(SwRootFrame const* pLayout = nullptr) const;
/** Returns if this text node has a marked label.
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 42febd5f6271..d170b3b4049d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -392,7 +392,7 @@ void SwCursorShell::UpdateMarkedListLevel()
if ( pTextNd )
{
- if ( !pTextNd->IsNumbered() )
+ if (!pTextNd->IsNumbered(GetLayout()))
{
m_pCurrentCursor->SetInFrontOfLabel_( false );
MarkListLevel( OUString(), 0 );
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index dca1ea5f0f09..108aa9efca97 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4345,7 +4345,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
pFrame->Broadcast(SfxHint()); // notify SwAccessibleParagraph
}
// all nodes, not just merged ones! it may be in the same list as
- if (rTextNode.IsNumbered()) // a preceding merged one...
+ if (rTextNode.IsNumbered(nullptr)) // a preceding merged one...
{ // notify frames so they reformat numbering portions
rTextNode.NumRuleChgd();
}
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index e7fd1223fe95..52b6c57e6c10 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -479,7 +479,9 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
const SwNumRule* pNumRule = pTextNd->GetNumRule();
// Has a "valid" number?
- if( pTextNd->IsNumbered() && pTextNd->IsCountedInList())
+ // sw_redlinehide: check that pParaPropsNode is the correct one
+ assert(pTextNd->IsNumbered(m_pFrame->getRootFrame()) == pTextNd->IsNumbered(nullptr));
+ if (pTextNd->IsNumbered(m_pFrame->getRootFrame()) && pTextNd->IsCountedInList())
{
int nLevel = pTextNd->GetActualListLevel();
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e876d5370f94..d550944252e0 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -3267,8 +3267,10 @@ void SwTextFrame::CalcAdditionalFirstLineOffset()
mnAdditionalFirstLineOffset = 0;
const SwTextNode* pTextNode( GetTextNodeForParaProps() );
- if ( pTextNode && pTextNode->IsNumbered() && pTextNode->IsCountedInList() &&
- pTextNode->GetNumRule() )
+ // sw_redlinehide: check that pParaPropsNode is the correct one
+ assert(pTextNode->IsNumbered(getRootFrame()) == pTextNode->IsNumbered(nullptr));
+ if (pTextNode && pTextNode->IsNumbered(getRootFrame()) &&
+ pTextNode->IsCountedInList() && pTextNode->GetNumRule())
{
int nListLevel = pTextNode->GetActualListLevel();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4caf635d7d33..97c89d2eae06 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2897,9 +2897,9 @@ void SwTextNode::NumRuleChgd()
}
// -> #i27615#
-bool SwTextNode::IsNumbered() const
+bool SwTextNode::IsNumbered(SwRootFrame const*const pLayout) const
{
- SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : nullptr;
+ SwNumRule* pRule = GetNum(pLayout) ? GetNum(pLayout)->GetNumRule() : nullptr;
return pRule && IsCountedInList();
}
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 17ff254b49b7..b465975a385a 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1871,7 +1871,7 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer,
const SwNumRule* pOutlRule = pWrtShell->GetOutlineNumRule();
const SwTextNode* pTextNd =
pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNode(nPos);
- if( pTextNd && pOutlRule && pTextNd->IsNumbered())
+ if (pTextNd && pOutlRule && pTextNd->IsNumbered(pWrtShell->GetLayout()))
{
SwNumberTree::tNumberVector aNumVector =
pTextNd->GetNumberVector(pWrtShell->GetLayout());
commit 77988cd900174627675399a0e16850c0fb3e018f
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 13:22:23 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: call UpdateAllFootnote() in UnHideRedlines()
... if the numbering is per-chapter, because only with a hidden layout
can the footnotes be numbered properly per-hidden-chapter.
Change-Id: I32732b7b8eec0adcbf4349aac3c87492802e38b6
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index a8486ef619ad..dca1ea5f0f09 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4488,8 +4488,13 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines)
}
}
+ SwFootnoteIdxs & rFootnotes(rDoc.GetFootnoteIdxs());
+ if (rDoc.GetFootnoteInfo().eNum == FTNNUM_CHAPTER)
+ {
+ // sadly determining which node is outline node requires hidden layout
+ rFootnotes.UpdateAllFootnote();
+ }
// invalidate all footnotes to reformat their numbers
- SwFootnoteIdxs const& rFootnotes(rDoc.GetFootnoteIdxs());
for (SwTextFootnote *const pFootnote : rFootnotes)
{
SwFormatFootnote const& rFootnote(pFootnote->GetFootnote());
commit 711ee8393aea8c9735b6c0d6fbb44e470669f1a8
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:54:54 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt SwFootnoteIdxs::UpdateFootnote()
... and UpdateAllFootnote() in the FTNNUM_CHAPTER case; the former is
particularly nasty since the hidden-chapter may effectively start
before and/or end after the "normal" chapter.
Change-Id: Ifd73dec28011c47c8b23319cb7d3bf16c84f0cfd
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index d4aad90404bc..85c35ecc51e7 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -30,6 +30,7 @@
#include <section.hxx>
#include <fmtftntx.hxx>
#include <rootfrm.hxx>
+#include <txtfrm.hxx>
static bool IsFootnoteDeleted(IDocumentRedlineAccess const& rIDRA,
SwTextFootnote const& rTextFootnote)
@@ -69,9 +70,23 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
// separately. For Endnotes we only have per-document numbering.
if( FTNNUM_CHAPTER == rFootnoteInfo.eNum )
{
+ SwRootFrame const* pLayout(nullptr);
+ std::set<SwRootFrame*> layouts = pDoc->GetAllLayouts();
+ // sw_redlinehide: here we need to know if there's *any* layout with
+ // IsHideRedlines(), because then the hidden-numbers have to be updated
+ for (SwRootFrame const* pTmp : layouts)
+ {
+ if (pTmp->IsHideRedlines())
+ {
+ pLayout = pTmp;
+ }
+ }
+
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
- const SwNode* pCapStt = &pDoc->GetNodes().GetEndOfExtras();
- sal_uLong nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex();
+ const SwNode *pChapterStartHidden(&pDoc->GetNodes().GetEndOfExtras());
+ sal_uLong nChapterStart(pChapterStartHidden->GetIndex());
+ sal_uLong nChapterEnd(pDoc->GetNodes().GetEndOfContent().GetIndex());
+ sal_uLong nChapterEndHidden(nChapterEnd);
if( !rOutlNds.empty() )
{
// Find the Chapter's start, which contains rStt
@@ -81,20 +96,37 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() )
break; // found it!
else if ( rOutlNds[ n ]->GetTextNode()->GetAttrOutlineLevel() == 1 )
- pCapStt = rOutlNds[ n ]; // Beginning of a new Chapter
+ {
+ nChapterStart = rOutlNds[ n ]->GetIndex();
+ if (!pLayout || sw::IsParaPropsNode(*pLayout, *rOutlNds[n]->GetTextNode()))
+ {
+ pChapterStartHidden = rOutlNds[ n ];
+ }
+ }
// now find the end of the range
for( ; n < rOutlNds.size(); ++n )
if ( rOutlNds[ n ]->GetTextNode()->GetAttrOutlineLevel() == 1 )
{
- nCapEnd = rOutlNds[ n ]->GetIndex(); // End of the found Chapter
+ nChapterEnd = rOutlNds[ n ]->GetIndex();
break;
}
+
+ // continue to find end of hidden-chapter
+ for ( ; n < rOutlNds.size(); ++n)
+ {
+ if (rOutlNds[n]->GetTextNode()->GetAttrOutlineLevel() == 1
+ && (!pLayout || sw::IsParaPropsNode(*pLayout, *rOutlNds[n]->GetTextNode())))
+ {
+ nChapterEndHidden = rOutlNds[n]->GetIndex();
+ break;
+ }
+ }
}
size_t nPos = 0;
size_t nFootnoteNo = 1;
size_t nFootnoteNoHidden = 1;
- if( SeekEntry( *pCapStt, &nPos ) && nPos )
+ if (SeekEntry( *pChapterStartHidden, &nPos ) && nPos)
{
// Step forward until the Index is not the same anymore
const SwNode* pCmpNd = &rStt.GetNode();
@@ -118,7 +150,8 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
for( ; nPos < size(); ++nPos )
{
pTextFootnote = (*this)[ nPos ];
- if( pTextFootnote->GetTextNode().GetIndex() >= nCapEnd )
+ sal_uLong const nNode(pTextFootnote->GetTextNode().GetIndex());
+ if (nChapterEndHidden <= nNode)
break;
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
@@ -126,10 +159,15 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
!SwUpdFootnoteEndNtAtEnd::FindSectNdWithEndAttr( *pTextFootnote ))
{
pTextFootnote->SetNumber(
- rFootnoteInfo.nFootnoteOffset + nFootnoteNo,
+ (nChapterStart <= nNode && nNode < nChapterEnd)
+ ? rFootnoteInfo.nFootnoteOffset + nFootnoteNo
+ : rFootnote.GetNumber(),
rFootnoteInfo.nFootnoteOffset + nFootnoteNoHidden,
rFootnote.GetNumStr() );
- ++nFootnoteNo;
+ if (nChapterStart <= nNode && nNode < nChapterEnd)
+ {
+ ++nFootnoteNo;
+ }
if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
{
++nFootnoteNoHidden;
@@ -234,12 +272,22 @@ void SwFootnoteIdxs::UpdateAllFootnote()
SwUpdFootnoteEndNtAtEnd aNumArr;
- SwRootFrame* pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwRootFrame const* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
std::set<SwRootFrame*> aAllLayouts = pDoc->GetAllLayouts();
// For normal Footnotes per-chapter and per-document numbering are treated separately.
// For Endnotes we only have document-wise numbering.
if( FTNNUM_CHAPTER == rFootnoteInfo.eNum )
{
+ // sw_redlinehide: here we need to know if there's *any* layout with
+ // IsHideRedlines(), because then the hidden-numbers have to be updated
+ for (SwRootFrame const* pTmp : aAllLayouts)
+ {
+ if (pTmp->IsHideRedlines())
+ {
+ pLayout = pTmp;
+ }
+ }
+
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
sal_uInt16 nNo = 1; // Number for the Footnotes
sal_uInt16 nNoNo = 1;
@@ -274,7 +322,11 @@ void SwFootnoteIdxs::UpdateAllFootnote()
if( nFootnoteIdx >= size() )
break; // ok, everything is updated
nNo = 1;
- nNoNo = 1;
+ // sw_redlinehide: this means the numbers are layout dependent in chapter case
+ if (!pLayout || sw::IsParaPropsNode(*pLayout, *rOutlNds[ n ]->GetTextNode()))
+ {
+ nNoNo = 1;
+ }
}
}
@@ -343,7 +395,7 @@ void SwFootnoteIdxs::UpdateAllFootnote()
}
}
- if( pTmpRoot && FTNNUM_PAGE == rFootnoteInfo.eNum )
+ if (pLayout && FTNNUM_PAGE == rFootnoteInfo.eNum)
for( auto aLayout : aAllLayouts )
aLayout->UpdateFootnoteNums();
}
commit c0c6d6faa0e39013a59d74f5e7aa8fbf32d1d558
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:53:12 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: filter outline nodes in SwListShell::Execute()
Change-Id: I31677211d0aa5637e0cce0034e29b9db724c791b
diff --git a/sw/source/uibase/shells/listsh.cxx b/sw/source/uibase/shells/listsh.cxx
index 220b1f3b0abf..4ed58717c1f9 100644
--- a/sw/source/uibase/shells/listsh.cxx
+++ b/sw/source/uibase/shells/listsh.cxx
@@ -80,8 +80,11 @@ static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bU
{
// Move down with subpoints:
while ( nActEndPos < pIDoc->getOutlineNodesCount() &&
- pIDoc->getOutlineLevel( nActEndPos ) > nActLevel )
+ (!pIDoc->isOutlineInLayout(nActEndPos, *rSh.GetLayout())
+ || nActLevel < pIDoc->getOutlineLevel(nActEndPos)))
+ {
++nActEndPos;
+ }
if ( nActEndPos < pIDoc->getOutlineNodesCount() )
{
@@ -90,8 +93,11 @@ static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bU
--nActEndPos;
SwOutlineNodes::size_type nDest = nActEndPos + 2;
while ( nDest < pIDoc->getOutlineNodesCount() &&
- pIDoc->getOutlineLevel( nDest ) > nActLevel )
+ (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
+ || nActLevel < pIDoc->getOutlineLevel(nDest)))
+ {
++nDest;
+ }
nDir = nDest - 1 - nActEndPos;
}
@@ -101,10 +107,14 @@ static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bU
// Move up with subpoints:
if ( nActPos > 0 )
{
- --nActEndPos;
+ nActEndPos = nActPos;
SwOutlineNodes::size_type nDest = nActPos - 1;
- while ( nDest > 0 && pIDoc->getOutlineLevel( nDest ) > nActLevel )
+ while (nDest > 0 &&
+ (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
+ || nActLevel < pIDoc->getOutlineLevel(nDest)))
+ {
--nDest;
+ }
nDir = nDest - nActPos;
}
commit 1492ce1894c2eb172d0a94aafc57ce0e6bc3853f
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:48:17 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt some SwEditShell functions
SwEditShell::IsOutlineCopyable(), IsOutlineMovable(),
IsProtectedOutlinePara(), GetCurrentParaOutlineLevel() all filter.
Change-Id: Ie5fb181e21d4bf606482bec9cb108dbd70f4209e
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 7734fd03c563..1ea0ace72e8d 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -24,6 +24,7 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentState.hxx>
#include <ndtxt.hxx>
+#include <txtfrm.hxx>
#include <paratr.hxx>
#include <swundo.hxx>
#include <numrule.hxx>
@@ -412,7 +413,7 @@ int SwEditShell::GetCurrentParaOutlineLevel( ) const
SwPaM* pCursor = GetCursor();
const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
- if( pTextNd )
+ if (pTextNd && sw::IsParaPropsNode(*GetLayout(), *pTextNd))
nLevel = pTextNd->GetAttrOutlineLevel();
return nLevel;
}
@@ -570,6 +571,11 @@ bool SwEditShell::IsProtectedOutlinePara() const
{
SwNodePtr pTmpNd = rOutlNd[ nPos ];
+ if (!sw::IsParaPropsNode(*GetLayout(), *pTmpNd->GetTextNode()))
+ {
+ continue;
+ }
+
int nTmpLvl = pTmpNd->GetTextNode()->GetAttrOutlineLevel();
OSL_ENSURE( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL,
@@ -606,23 +612,25 @@ bool SwEditShell::IsProtectedOutlinePara() const
* 2) outline must not be within table
* 3) if bCopy is set, outline must not be write protected
*/
-static bool lcl_IsOutlineMoveAndCopyable( const SwDoc* pDoc, SwOutlineNodes::size_type nIdx, bool bCopy )
+static bool lcl_IsOutlineMoveAndCopyable(SwEditShell const& rShell,
+ SwOutlineNodes::size_type const nIdx, bool const bCopy)
{
- const SwNodes& rNds = pDoc->GetNodes();
+ const SwNodes& rNds = rShell.GetDoc()->GetNodes();
const SwNode* pNd = rNds.GetOutLineNds()[ nIdx ];
return pNd->GetIndex() >= rNds.GetEndOfExtras().GetIndex() && // 1) body
!pNd->FindTableNode() && // 2) table
+ sw::IsParaPropsNode(*rShell.GetLayout(), *pNd->GetTextNode()) &&
( bCopy || !pNd->IsProtect() ); // 3) write
}
bool SwEditShell::IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const
{
- return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, false );
+ return lcl_IsOutlineMoveAndCopyable( *this, nIdx, false );
}
bool SwEditShell::IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const
{
- return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, true );
+ return lcl_IsOutlineMoveAndCopyable( *this, nIdx, true );
}
bool SwEditShell::NumOrNoNum(
commit cd8eb9816b6c4318107fa6fd3486abe13ac059a7
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 12:46:23 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt SwCursorShell::GetOutlinePos()
Filter merged outline nodes.
Change-Id: I959dd4bfd2e6b279b8476ffed6b3e6e70651ed49
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 864263adc25d..9b8f2e6c6bf3 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1156,9 +1156,11 @@ SwOutlineNodes::size_type SwCursorShell::GetOutlinePos( sal_uInt8 nLevel )
{
pNd = rNds.GetOutLineNds()[ nPos ];
- if( pNd->GetTextNode()->GetAttrOutlineLevel()-1 <= nLevel )
+ if (sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode())
+ && pNd->GetTextNode()->GetAttrOutlineLevel()-1 <= nLevel)
+ {
return nPos;
-
+ }
}
return SwOutlineNodes::npos; // no more left
}
commit 52269241eb9bd893f9c20da0d62834b72c6ee1d9
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 11:43:21 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt SwCursorShell::GetContentAtPos()
Have SwNode::FindOutlineNodeOfLevel() check if the outline node is
merged away in the layout.
Change-Id: I2da0bf8afe993f1bb60f488a015a33b5e15af217
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index b37d96ac1d04..8f817d0b12bd 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -281,7 +281,7 @@ public:
sal_uLong GetIndex() const { return GetPos(); }
- const SwTextNode* FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const;
+ const SwTextNode* FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const* pLayout = nullptr) const;
sal_uInt8 HasPrevNextLayNode() const;
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 13d97c8b3706..864263adc25d 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1285,7 +1285,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
&& IsAttrAtPos::Outline & rContentAtPos.eContentAtPos
&& !rNds.GetOutLineNds().empty() )
{
- const SwTextNode* pONd = pTextNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
+ const SwTextNode* pONd = pTextNd->FindOutlineNodeOfLevel(MAXLEVEL-1, GetLayout());
if( pONd )
{
rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index d592796fd248..fa30b94a25a8 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -763,7 +763,8 @@ SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp )
return eTyp == pTmp->GetStartNodeType() ? pTmp : nullptr;
}
-const SwTextNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
+const SwTextNode* SwNode::FindOutlineNodeOfLevel(sal_uInt8 const nLvl,
+ SwRootFrame const*const pLayout) const
{
const SwTextNode* pRet = nullptr;
const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
@@ -774,17 +775,31 @@ const SwTextNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
bool bCheckFirst = false;
if( !rONds.Seek_Entry( pNd, &nPos ))
{
- if( nPos )
- nPos = nPos-1;
- else
+ if (nPos == 0)
bCheckFirst = true;
}
+ else
+ {
+ ++nPos;
+ }
if( bCheckFirst )
{
- // The first OutlineNode comes after the one asking. Test if it points to the same node.
+ // The first OutlineNode comes after the one asking.
+ // Test if both are on the same page.
// If not it's invalid.
- pRet = rONds[0]->GetTextNode();
+ for (nPos = 0; nPos < rONds.size(); ++nPos)
+ {
+ pRet = rONds[nPos]->GetTextNode();
+ if (!pLayout || sw::IsParaPropsNode(*pLayout, *pRet))
+ {
+ break;
+ }
+ }
+ if (nPos == rONds.size())
+ {
+ return nullptr;
+ }
const SwContentNode* pCNd = GetContentNode();
@@ -802,14 +817,16 @@ const SwTextNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
}
else
{
- // Or at the Field and get it from there!
- while( nPos &&
- nLvl < ( pRet = rONds[nPos]->GetTextNode() )
- ->GetAttrOutlineLevel() - 1 )
- --nPos;
-
- if( !nPos ) // Get separately when 0
- pRet = rONds[0]->GetTextNode();
+ for ( ; 0 < nPos; --nPos)
+ {
+ SwTextNode const*const pNode = rONds[nPos - 1]->GetTextNode();
+ if ((nPos == 1 /*as before*/ || pNode->GetAttrOutlineLevel() <= nLvl)
+ && (!pLayout || sw::IsParaPropsNode(*pLayout, *pNode)))
+ {
+ pRet = pNode;
+ break;
+ }
+ }
}
}
return pRet;
commit e8141feedfb3c17b07147c47b62d231b31dd0b41
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 11:31:30 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt SwEditShell::OutlineUpDown()
Change-Id: I1d1f4604c580fe4dd764cfb908cd18657ea54255
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 851e64c95b2e..2670ff98bd03 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1002,7 +1002,7 @@ public:
void PropagateOutlineRule();
// Outline - promote / demote.
- bool OutlineUpDown( const SwPaM& rPam, short nOffset );
+ bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr);
/// Outline - move up / move down.
bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index e8483c2194f9..b9426acafe27 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -173,7 +173,8 @@ void SwDoc::PropagateOutlineRule()
}
// Increase/Decrease
-bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
+bool SwDoc::OutlineUpDown(const SwPaM& rPam, short nOffset,
+ SwRootFrame const*const pLayout)
{
if( GetNodes().GetOutLineNds().empty() || !nOffset )
return false;
@@ -336,6 +337,10 @@ bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
for (auto i = nSttPos; i < nEndPos; ++i)
{
SwTextNode* pTextNd = rOutlNds[ i ]->GetTextNode();
+ if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTextNd))
+ {
+ continue;
+ }
SwTextFormatColl* pColl = pTextNd->GetTextColl();
if( pColl->IsAssignedToListLevelOfOutlineStyle() )
@@ -371,6 +376,10 @@ bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
for (auto i = nSttPos; i < nEndPos; ++i)
{
SwTextNode* pTextNd = rOutlNds[ i ]->GetTextNode();
+ if (pLayout && !sw::IsParaPropsNode(*pLayout, *pTextNd))
+ {
+ continue;
+ }
SwTextFormatColl* pColl = pTextNd->GetTextColl();
if( pColl->IsAssignedToListLevelOfOutlineStyle() )
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 8f49775846c0..7734fd03c563 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -527,7 +527,7 @@ bool SwEditShell::OutlineUpDown( short nOffset )
bool bRet = true;
SwPaM* pCursor = GetCursor();
if( !pCursor->IsMultiSelection() )
- bRet = GetDoc()->OutlineUpDown( *pCursor, nOffset );
+ bRet = GetDoc()->OutlineUpDown(*pCursor, nOffset, GetLayout());
else
{
GetDoc()->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
@@ -535,7 +535,7 @@ bool SwEditShell::OutlineUpDown( short nOffset )
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->OutlineUpDown(
- aRangeArr.SetPam( n, aPam ), nOffset );
+ aRangeArr.SetPam(n, aPam), nOffset, GetLayout());
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
GetDoc()->getIDocumentState().SetModified();
commit db48536509677509448f13a4e620dc761e213d6c
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 11:06:38 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: adapt GotoOutline for SwCursrShell
Adapt SwDoc::GotoOutline(), SwCursorShell::GotoNextOutline(),
SwCursorShell::GotoPrevOutline() to skip over outline nodes that are
merged away in the layout.
Change-Id: Id6f6bb93177753ed21a438c89dc6d90098e11455
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 70eb61154c26..851e64c95b2e 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1007,7 +1007,7 @@ public:
/// Outline - move up / move down.
bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset);
- bool GotoOutline( SwPosition& rPos, const OUString& rName ) const;
+ bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const;
/** Accept changes of outline styles for OutlineRule.
@param bResetIndentAttrs Optional parameter - default value false:
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index b93ab75d4718..13d97c8b3706 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1001,7 +1001,8 @@ bool SwCursorShell::GotoOutline( const OUString& rName )
SwCursorSaveState aSaveState( *pCursor );
bool bRet = false;
- if( mxDoc->GotoOutline( *pCursor->GetPoint(), rName ) && !pCursor->IsSelOvr() )
+ if (mxDoc->GotoOutline(*pCursor->GetPoint(), rName, GetLayout())
+ && !pCursor->IsSelOvr())
{
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
bRet = true;
@@ -1023,18 +1024,45 @@ bool SwCursorShell::GotoNextOutline()
SwCursor* pCursor = getShellCursor( true );
SwNode* pNd = &(pCursor->GetNode());
SwOutlineNodes::size_type nPos;
- if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
- ++nPos;
+ bool bUseFirst = !rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
+ SwOutlineNodes::size_type const nStartPos(nPos);
+
+ do
+ {
+ if (nPos == rNds.GetOutLineNds().size())
+ {
+ nPos = 0;
+ }
+ else if (!bUseFirst)
+ {
+ ++nPos;
+ }
+
+ if (bUseFirst)
+ {
+ bUseFirst = false;
+ }
+ else
+ {
+ if (nPos == nStartPos)
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
+ return false;
+ }
+ }
- if( nPos == rNds.GetOutLineNds().size() )
+ pNd = rNds.GetOutLineNds()[ nPos ];
+ }
+ while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
+
+ if (nPos < nStartPos)
{
- nPos = 0;
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
}
else
+ {
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
-
- pNd = rNds.GetOutLineNds()[ nPos ];
+ }
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
@@ -1064,20 +1092,38 @@ bool SwCursorShell::GotoPrevOutline()
SwOutlineNodes::size_type nPos;
bool bRet = false;
(void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
- if ( nPos == 0 )
- {
- nPos = rNds.GetOutLineNds().size();
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
- }
- else
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ SwOutlineNodes::size_type const nStartPos(nPos);
- if (nPos)
+ do
{
- --nPos; // before
+ if (nPos == 0)
+ {
+ nPos = rNds.GetOutLineNds().size() - 1;
+ }
+ else
+ {
+ --nPos; // before
+ }
+ if (nPos == nStartPos)
+ {
+ pNd = nullptr;
+ break;
+ }
pNd = rNds.GetOutLineNds()[ nPos ];
+ }
+ while (!sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()));
+ if (pNd)
+ {
+ if (nStartPos < nPos)
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
+ }
+ else
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ }
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
SwCursorSaveState aSaveState( *pCursor );
@@ -1088,6 +1134,10 @@ bool SwCursorShell::GotoPrevOutline()
if( bRet )
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
}
+ else
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
+ }
return bRet;
}
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
index c30eeb382382..577db70611ff 100644
--- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
+++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
@@ -502,7 +502,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( const OUString& rStr,
else if( sCmp == "outline" )
{
SwPosition aPos( SwNodeIndex( m_rDoc.GetNodes() ));
- if( m_rDoc.GotoOutline( aPos, sName ))
+ if (m_rDoc.GotoOutline(aPos, sName, nullptr))
{
SwNode* pNd = &aPos.nNode.GetNode();
const int nLvl = pNd->GetTextNode()->GetAttrOutlineLevel()-1;
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index efd13d4fda10..e8483c2194f9 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -586,7 +586,8 @@ static SwTextNode* lcl_FindOutlineName( const SwOutlineNodes& rOutlNds, const OU
return pSavedNode;
}
-static SwTextNode* lcl_FindOutlineNum( const SwOutlineNodes& rOutlNds, OUString& rName )
+static SwTextNode* lcl_FindOutlineNum(const SwOutlineNodes& rOutlNds,
+ OUString& rName, SwRootFrame const*const pLayout)
{
// Valid numbers are (always just offsets!):
// ([Number]+\.)+ (as a regular expression!)
@@ -647,9 +648,9 @@ static SwTextNode* lcl_FindOutlineNum( const SwOutlineNodes& rOutlNds, OUString&
// #i51089#, #i68289#
// Assure, that text node has the correct numbering level. Otherwise,
// its number vector will not fit to the searched level.
- if ( pNd->GetNum() && pNd->GetActualListLevel() == nLevel - 1 )
+ if (pNd->GetNum(pLayout) && pNd->GetActualListLevel() == nLevel - 1)
{
- const SwNodeNum & rNdNum = *(pNd->GetNum());
+ const SwNodeNum & rNdNum = *(pNd->GetNum(pLayout));
SwNumberTree::tNumberVector aLevelVal = rNdNum.GetNumberVector();
// now compare with the one searched for
bool bEqual = true;
@@ -680,17 +681,14 @@ static SwTextNode* lcl_FindOutlineNum( const SwOutlineNodes& rOutlNds, OUString&
return nullptr;
}
-// Add this bullet point:
-
-// A Name can contain a Number and/or the Text.
-
+// rName can contain a Number and/or the Text.
// First, we try to find the correct Entry via the Number.
-// If it exists, we compare the Text, to see if it's the right one.
+// If it exists, we compare the Text to see if it's the right one.
// If that's not the case, we search again via the Text. If it is
// found, we got the right entry. Or else we use the one found by
// searching for the Number.
// If we don't have a Number, we search via the Text only.
-bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
+bool SwDoc::GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const*const pLayout) const
{
if( !rName.isEmpty() )
{
@@ -698,7 +696,7 @@ bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
// 1. step: via the Number:
OUString sName( rName );
- SwTextNode* pNd = ::lcl_FindOutlineNum( rOutlNds, sName );
+ SwTextNode* pNd = ::lcl_FindOutlineNum(rOutlNds, sName, pLayout);
if ( pNd )
{
OUString sExpandedText = pNd->GetExpandText();
commit 2fbcaff3edf102a3eb7a127a9c396e507cf6f7b4
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 10:31:48 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:55:25 2018 +0200
sw_redlinehide_3: hide deleted outline nodes in Navigator
Add sw::IsParaPropsNode() to check if the node's numbering attributes are
effective in the given layout.
Add IDocumentOutlineNodes::isOutlineInLayout() to expose this to UI code.
Adapt IDocumentOutlineNodes::getOutlineText() to produce the merged text
of the outline paragraph as seen in the layout.
Also adapt EnhancedPDFExport and SwFieldRefPage to interface changes.
Change-Id: I6fa95150ff0c5dc5eb4f366d218e8f0c4d4bb7ab
diff --git a/sw/inc/IDocumentOutlineNodes.hxx b/sw/inc/IDocumentOutlineNodes.hxx
index 32db18cb914d..f76276835c46 100644
--- a/sw/inc/IDocumentOutlineNodes.hxx
+++ b/sw/inc/IDocumentOutlineNodes.hxx
@@ -24,6 +24,7 @@
#include <vector>
class SwTextNode;
+class SwRootFrame;
/** Provides outline nodes of a document.
*/
@@ -36,11 +37,15 @@ public:
virtual int getOutlineLevel( const tSortedOutlineNodeList::size_type nIdx ) const = 0;
virtual OUString getOutlineText( const tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const* pLayout,
const bool bWithNumber = true,
const bool bWithSpacesForLevel = false,
const bool bWithFootnote = true ) const = 0;
virtual SwTextNode* getOutlineNode( const tSortedOutlineNodeList::size_type nIdx ) const = 0;
+ virtual bool isOutlineInLayout(tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const& rLayout) const = 0;
+
virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const = 0;
protected:
diff --git a/sw/source/core/doc/DocumentOutlineNodesManager.cxx b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
index db448ec4f609..3654c5032eb4 100644
--- a/sw/source/core/doc/DocumentOutlineNodesManager.cxx
+++ b/sw/source/core/doc/DocumentOutlineNodesManager.cxx
@@ -19,6 +19,8 @@
#include <DocumentOutlineNodesManager.hxx>
#include <doc.hxx>
#include <ndtxt.hxx>
+#include <txtfrm.hxx>
+#include <rootfrm.hxx>
#include <modeltoviewhelper.hxx>
namespace sw
@@ -39,13 +41,48 @@ int DocumentOutlineNodesManager::getOutlineLevel( const tSortedOutlineNodeList::
GetTextNode()->GetAttrOutlineLevel()-1;
}
-OUString DocumentOutlineNodesManager::getOutlineText( const tSortedOutlineNodeList::size_type nIdx,
+OUString DocumentOutlineNodesManager::getOutlineText(
+ const tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const*const pLayout,
const bool bWithNumber,
const bool bWithSpacesForLevel,
const bool bWithFootnote ) const
{
- return m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->
- GetTextNode()->GetExpandText( 0, -1, bWithNumber,
+ SwTextNode const*const pNode(m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode());
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pLayout)));
+ if (pFrame)
+ {
+ sw::MergedPara const*const pMerged = pFrame->GetMergedPara();
+ if (pMerged)
+ {
+ if (pNode != pMerged->pParaPropsNode)
+ {
+ return OUString();
+ }
+ else
+ {
+ ExpandMode const mode(ExpandMode::HideDeletions |
+ (bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0)));
+ OUStringBuffer ret(pNode->GetExpandText(0, -1, bWithNumber,
+ bWithNumber, bWithSpacesForLevel, mode));
+ for (sal_uLong i = pNode->GetIndex() + 1;
+ i <= pMerged->pLastNode->GetIndex(); ++i)
+ {
+ SwNode *const pTmp(pNode->GetNodes()[i]);
+ if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
+ {
+ ret.append(pTmp->GetTextNode()->GetExpandText(
+ 0, -1, false, false, false, mode));
+ }
+ }
+ return ret.makeStringAndClear();
+ }
+ }
+ }
+ }
+ return pNode->GetExpandText( 0, -1, bWithNumber,
bWithNumber, bWithSpacesForLevel,
bWithFootnote ? ExpandMode::ExpandFootnote : ExpandMode(0));
}
@@ -55,6 +92,14 @@ SwTextNode* DocumentOutlineNodesManager::getOutlineNode( const tSortedOutlineNod
return m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode();
}
+bool DocumentOutlineNodesManager::isOutlineInLayout(
+ const tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const& rLayout) const
+{
+ auto const pNode(m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode());
+ return sw::IsParaPropsNode(rLayout, *pNode);
+}
+
void DocumentOutlineNodesManager::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const
{
orOutlineNodeList.clear();
diff --git a/sw/source/core/inc/DocumentOutlineNodesManager.hxx b/sw/source/core/inc/DocumentOutlineNodesManager.hxx
index b2322d452e81..97cc231313d2 100644
--- a/sw/source/core/inc/DocumentOutlineNodesManager.hxx
+++ b/sw/source/core/inc/DocumentOutlineNodesManager.hxx
@@ -39,10 +39,13 @@ public:
int getOutlineLevel( const tSortedOutlineNodeList::size_type nIdx ) const override;
OUString getOutlineText( const tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const* pLayout,
const bool bWithNumber = true,
const bool bWithSpacesForLevel = false,
const bool bWithFootnote = true ) const override;
SwTextNode* getOutlineNode( const tSortedOutlineNodeList::size_type nIdx ) const override;
+ bool isOutlineInLayout(tSortedOutlineNodeList::size_type nIdx,
+ SwRootFrame const& rLayout) const override;
void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const override;
virtual ~DocumentOutlineNodesManager() override;
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 9e720cbb3260..7e2c2aef044c 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -100,6 +100,7 @@ enum class FrameMode { New, Existing };
std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, FrameMode eMode);
bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
+bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool isRealDelete,
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index a666da304538..f00a2af776af 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1107,7 +1107,8 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
// Heading: H1 - H6
- if ( pTextNd->IsOutline() )
+ if (pTextNd->IsOutline()
+ && sw::IsParaPropsNode(*pFrame->getRootFrame(), *pTextNd))
{
int nRealLevel = pTextNd->GetAttrOutlineLevel()-1;
nRealLevel = std::min(nRealLevel, 5);
@@ -2028,6 +2029,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
OSL_ENSURE( nullptr != pTNd, "Enhanced pdf export - text node is missing" );
if ( pTNd->IsHidden() ||
+ !sw::IsParaPropsNode(*mrSh.GetLayout(), *pTNd) ||
// #i40292# Skip empty outlines:
pTNd->GetText().isEmpty())
continue;
@@ -2061,7 +2063,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
pPDFExtOutDevData->CreateDest(aRect, nDestPageNum);
// Outline entry text
- const OUString& rEntry = mrSh.getIDocumentOutlineNodesAccess()->getOutlineText( i, true, false, false );
+ const OUString& rEntry = mrSh.getIDocumentOutlineNodesAccess()->getOutlineText(
+ i, mrSh.GetLayout(), true, false, false );
// Create a new outline item:
const sal_Int32 nOutlineId =
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 81aac678b427..e876d5370f94 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -311,6 +311,22 @@ namespace sw {
}
}
+ bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode)
+ {
+ if (rLayout.IsHideRedlines())
+ {
+ if (SwTextFrame const*const pFrame = static_cast<SwTextFrame*>(rNode.getLayoutFrame(&rLayout)))
+ {
+ sw::MergedPara const*const pMerged(pFrame->GetMergedPara());
+ if (pMerged && pMerged->pParaPropsNode != &rNode)
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
} // namespace sw
/// Switches width and height of the text frame
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index c9b0063d86d3..cd3919294a41 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -591,11 +591,15 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool bCertainTextNodeSelected( false );
for ( size_t nOutlIdx = 0; nOutlIdx < maOutlineNodes.size(); ++nOutlIdx )
{
- bool isSubstring = MatchSubstring(pIDoc->getOutlineText( nOutlIdx, true, true, false ), filterString);
+ if (!pIDoc->isOutlineInLayout(nOutlIdx, *pSh->GetLayout()))
+ {
+ continue; // skip it
+ }
+ bool isSubstring = MatchSubstring(pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false), filterString);
if(isSubstring)
{
SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
- pIDoc->getOutlineText( nOutlIdx, true, true, false ) );
+ pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false));
pEntry->SetUserData( reinterpret_cast<void*>(nOutlIdx) );
if ( ( IsFieldEdit() &&
pRefField->GetReferencedTextNode() == maOutlineNodes[nOutlIdx] ) ||
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 524e0719de39..17ff254b49b7 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -296,8 +296,11 @@ void SwContentType::Init(bool* pbInvalidateWindow)
const size_t nOutlineCount = nMemberCount;
for(size_t j = 0; j < nOutlineCount; ++j)
{
- if(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(j) > nOutlineLevel )
+ if (pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(j) > nOutlineLevel
+ || !pWrtShell->getIDocumentOutlineNodesAccess()->isOutlineInLayout(j, *pWrtShell->GetLayout()))
+ {
nMemberCount --;
+ }
}
}
bDelete = false;
@@ -545,8 +548,13 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
nMemberCount--;
else
{
+ if (!pWrtShell->getIDocumentOutlineNodesAccess()->isOutlineInLayout(i, *pWrtShell->GetLayout()))
+ {
+ --nMemberCount;
+ continue; // don't hide it, just skip it
+ }
OUString aEntry(comphelper::string::stripStart(
- pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i), ' '));
+ pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i, pWrtShell->GetLayout()), ' '));
aEntry = SwNavigationPI::CleanEntry(aEntry);
std::unique_ptr<SwOutlineContent> pCnt(new SwOutlineContent(this, aEntry, i, nLevel,
pWrtShell->IsOutlineMovable( i ), nPos ));
@@ -1876,8 +1884,8 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer,
sEntry += ".";
}
}
- sEntry += pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, false);
- sOutlineText = pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos);
+ sEntry += pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, pWrtShell->GetLayout(), false);
+ sOutlineText = pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, pWrtShell->GetLayout());
m_bIsOutlineMoveable = static_cast<SwOutlineContent*>(pCnt)->IsMoveable();
bOutline = true;
}
commit 7475936d83ee08009e2b5c665ba655d1bb9132bd
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 25 10:27:42 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Oct 25 13:40:34 2018 +0200
sw: remove unnecessary casts
Change-Id: I34e823bc9f57924851a70e04c295b1d2c6e11ab4
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 6b86090fbe4b..524e0719de39 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -553,7 +553,6 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
pMember->insert(std::move(pCnt));
// with the same number and existing "pOldMember" the
// old one is compared with the new OutlinePos.
- // cast for Win16
if (nOldMemberCount > nPos && static_cast<SwOutlineContent*>((*pOldMember)[nPos].get())->GetOutlineLevel() != nLevel)
*pbLevelOrVisibilityChanged = true;
@@ -2684,8 +2683,7 @@ TriState SwContentTree::NotifyMoving( SvTreeListEntry* pTarget,
nTargetPos = static_cast<SwOutlineContent*>(pNext->GetUserData())->GetOutlinePos() - 1;
}
else
- nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount())- 1;
-
+ nTargetPos = GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount() - 1;
}
OSL_ENSURE( pEntry &&
@@ -2729,8 +2727,7 @@ TriState SwContentTree::NotifyCopying( SvTreeListEntry* pTarget,
nTargetPos = static_cast<SwOutlineContent*>(pNext->GetUserData())->GetOutlinePos() - 1;
}
else
- nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount()) - 1;
-
+ nTargetPos = GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount() - 1;
}
OSL_ENSURE( pEntry &&
More information about the Libreoffice-commits
mailing list