summaryrefslogtreecommitdiffstats
path: root/sw/source/core/doc
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx89
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx21
-rw-r--r--sw/source/core/doc/docdraw.cxx12
-rw-r--r--sw/source/core/doc/docfmt.cxx10
-rw-r--r--sw/source/core/doc/docnum.cxx98
-rw-r--r--sw/source/core/doc/doctxm.cxx3
6 files changed, 173 insertions, 60 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 57b8e58310..234d73aecb 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -29,6 +29,7 @@
#include <IDocumentSettingAccess.hxx>
#include <UndoManager.hxx>
#include <docary.hxx>
+#include <pamtyp.hxx>
#include <textboxhelper.hxx>
#include <dcontact.hxx>
#include <grfatr.hxx>
@@ -5065,16 +5066,14 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// Move the PaM one node back from the insert position, so that
// the position doesn't get moved
pCopyPam->SetMark();
- bool bCanMoveBack = pCopyPam->Move(fnMoveBackward, GoInContent);
- // If the position was shifted from more than one node, an end node has been skipped
- bool bAfterTable = false;
- if ((rPos.GetNodeIndex() - pCopyPam->GetPoint()->GetNodeIndex()) > SwNodeOffset(1))
+ bool bCanMoveBack = false;
+ // First check if it will be able to move *to* first copied node.
+ // Note this doesn't just check IsStartNode() because SwDoc::AppendDoc()
+ // intentionally sets it to the body start node, perhaps it should just
+ // call SplitNode instead?
+ if (!pStt->GetNode().IsSectionNode() && !pStt->GetNode().IsTableNode())
{
- // First go back to the original place
- *(pCopyPam->GetPoint()) = rPos;
-
- bCanMoveBack = false;
- bAfterTable = true;
+ bCanMoveBack = pCopyPam->Move(fnMoveBackward, GoInContent);
}
if( !bCanMoveBack )
{
@@ -5084,6 +5083,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
SwNodeRange aRg( pStt->GetNode(), pEnd->GetNode() );
SwNodeIndex aInsPos( rPos.GetNode() );
+ ::std::optional<SwContentIndex> oInsContentIndex;
const bool bOneNode = pStt->GetNode() == pEnd->GetNode();
SwTextNode* pSttTextNd = pStt->GetNode().GetTextNode();
SwTextNode* pEndTextNd = pEnd->GetNode().GetTextNode();
@@ -5107,12 +5107,16 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// bullet list.
// Keep also the <ListId> value for possible propagation.
OUString aListIdToPropagate;
+ SvxTextLeftMarginItem const* pTextLeftMarginToPropagate{nullptr};
+ SvxFirstLineIndentItem const* pFirstLineIndentToPropagate{nullptr};
const SwNumRule* pNumRuleToPropagate =
- rDoc.SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, nullptr, true );
+ rDoc.SearchNumRule(rPos, false, true, false, 0, aListIdToPropagate, nullptr,
+ true, &pTextLeftMarginToPropagate, &pFirstLineIndentToPropagate);
if ( !pNumRuleToPropagate )
{
pNumRuleToPropagate =
- rDoc.SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, nullptr, true );
+ rDoc.SearchNumRule(rPos, false, false, false, 0, aListIdToPropagate, nullptr,
+ true, &pTextLeftMarginToPropagate, &pFirstLineIndentToPropagate);
}
// #i86492#
// Do not propagate previous found list, if
@@ -5236,8 +5240,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// We have to set the correct PaM for Undo, if this PaM starts in a textnode,
// the undo operation will try to merge this node after removing the table.
// If we didn't split a textnode, the PaM should start at the inserted table node
- if( rPos.GetContentIndex() == pDestTextNd->Len() )
- { // Insertion at the last position of a textnode (empty or not)
+ if (pDestTextNd->Len() && rPos.GetContentIndex() == pDestTextNd->Len())
+ { // Insertion at the last position of a textnode
++aInsPos; // The table will be inserted behind the text node
}
else if( rPos.GetContentIndex() )
@@ -5269,27 +5273,18 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
--aRg.aEnd;
}
}
- else if( bCanMoveBack )
- { // Insertion at the first position of a text node. It will not be split, the table
- // will be inserted before the text node.
- // See below, before the SetInsertRange function of the undo object will be called,
- // the CpyPam would be moved to the next content position. This has to be avoided
- // We want to be moved to the table node itself thus we have to set bCanMoveBack
- // and to manipulate pCopyPam.
- bCanMoveBack = false;
- pCopyPam->GetPoint()->Adjust(SwNodeOffset(-1));
- }
+ assert(!bCanMoveBack);
}
pDestTextNd = aInsPos.GetNode().GetTextNode();
if (pEndTextNd)
{
- SwContentIndex aDestIdx( aInsPos.GetNode().GetContentNode(), rPos.GetContentIndex() );
+ oInsContentIndex.emplace(aInsPos.GetNode().GetContentNode(), rPos.GetContentIndex());
if( !pDestTextNd )
{
pDestTextNd = rDoc.GetNodes().MakeTextNode( aInsPos.GetNode(),
rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
- aDestIdx.Assign( pDestTextNd, 0 );
+ oInsContentIndex->Assign(pDestTextNd, 0);
--aInsPos;
// if we have to insert an extra text node
@@ -5307,8 +5302,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
PUSH_NUMRULE_STATE
}
- pEndTextNd->CopyText( pDestTextNd, aDestIdx, SwContentIndex( pEndTextNd ),
- pEnd->GetContentIndex() );
+ pEndTextNd->CopyText(pDestTextNd, *oInsContentIndex,
+ SwContentIndex(pEndTextNd), pEnd->GetContentIndex());
// Also copy all format templates
if( bCopyCollFormat && ( bOneNode || bEmptyDestNd ))
@@ -5360,20 +5355,29 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
bCopyBookmarks = false;
}
+
+ // init *again* - because CopyWithFlyInFly moved startPos
+ SwPosition startPos(pCopyPam->GetPoint()->GetNode(), SwNodeOffset(+1));
// at-char anchors post SplitNode are on index 0 of 2nd node and will
// remain there - move them back to the start (end would also work?)
// ... also for at-para anchors; here start is preferable because
// it's consistent with SplitNode from SwUndoInserts::RedoImpl()
- if (pFlysAtInsPos)
+ if (pFlysAtInsPos
+ && (bCanMoveBack
+ || startPos.GetNode().IsTextNode()
+ || (pCopyPam->GetPoint()->GetNode().IsStartNode()
+ && startPos.GetNode().IsSectionNode()))) // not into table
{
- // init *again* - because CopyWithFlyInFly moved startPos
- SwPosition startPos(pCopyPam->GetPoint()->GetNode(), SwNodeOffset(+1));
if (bCanMoveBack)
{ // pCopyPam is actually 1 before the copy range so move it fwd
SwPaM temp(*pCopyPam->GetPoint());
temp.Move(fnMoveForward, GoInContent);
startPos = *temp.GetPoint();
}
+ else if (startPos.GetNode().IsSectionNode())
+ { // probably on top-level start node, so no CheckNodesRange here;
+ GoNextPos(&startPos, false); // SwFEShell::Paste() deletes node
+ }
assert(startPos.GetNode().IsContentNode());
SwPosition startPosAtPara(startPos);
startPosAtPara.nContent.Assign(nullptr, 0);
@@ -5456,26 +5460,31 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
}
else // incremented in (!pSttTextNd && pDestTextNd) above
{
- pCopyPam->GetMark()->Assign(aInsPos);
+ // assign also content index in this case, see testSectionAnchorCopyTableAtStart
+ assert(oInsContentIndex);
+ assert(oInsContentIndex->GetContentNode() == &aInsPos.GetNode());
+ pCopyPam->GetMark()->Assign(aInsPos, oInsContentIndex->GetIndex());
}
rPos = *pCopyPam->GetMark();
}
else
*pCopyPam->GetMark() = rPos;
- if ( !bAfterTable )
- pCopyPam->Move( fnMoveForward, bCanMoveBack ? GoInContent : GoInNode );
+ if (bCanMoveBack)
+ {
+ pCopyPam->Move(fnMoveForward, GoInContent);
+ }
else
{
// Reset the offset to 0 as it was before the insertion
pCopyPam->GetPoint()->Adjust(SwNodeOffset(+1));
- // If the next node is a start node, then step back: the start node
- // has been copied and needs to be in the selection for the undo
+ // If the next node is a start node, then step back: SetInsertRange()
+ // will add 1 in this case, but that is too much...
if (pCopyPam->GetPoint()->GetNode().IsStartNode())
pCopyPam->GetPoint()->Adjust(SwNodeOffset(-1));
-
}
+ oInsContentIndex.reset();
pCopyPam->Exchange();
// Also copy all bookmarks
@@ -5513,8 +5522,12 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// #i86492# - use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
// Don't reset indent attributes, that would mean loss of direct
// formatting.
- rDoc.SetNumRule( *pCopyPam, *pNumRuleToPropagate, false, nullptr,
- aListIdToPropagate, true, /*bResetIndentAttrs=*/false );
+ // It could be that pNumRuleToPropagate is already applied via
+ // the paragraph style, in that case applying it again in mpAttrSet could
+ // override indents, so avoid that.
+ rDoc.SetNumRule(*pCopyPam, *pNumRuleToPropagate,
+ SwDoc::SetNumRuleMode::DontSetIfAlreadyApplied, nullptr, aListIdToPropagate,
+ pTextLeftMarginToPropagate, pFirstLineIndentToPropagate);
}
rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index baa0f29326..14cfa5fd3c 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -250,10 +250,14 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
return mbAutoFirstLineIndentDisregardLineSpace;
case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs;
+ case DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH:
+ return mbApplyTextAttrToEmptyLineAtEndOfParagraph;
case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
return mbDoNotBreakWrappedTables;
case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
return mbAllowTextAfterFloatingTableBreak;
+ case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
+ return mbDoNotMirrorRtlDrawObjs;
case DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING:
return mbJustifyLinesWithShrinking;
case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return mbNoNumberingShowFollowBy;
@@ -444,6 +448,14 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
mbHyphenateURLs = value;
break;
+ case DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH:
+ mbApplyTextAttrToEmptyLineAtEndOfParagraph = value;
+ break;
+
+ case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS:
+ mbDoNotMirrorRtlDrawObjs = value;
+ break;
+
case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES:
mbDoNotBreakWrappedTables = value;
break;
@@ -1091,7 +1103,16 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("mnImagePreferredDPI"));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
BAD_CAST(OString::number(mnImagePreferredDPI).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbApplyTextAttrToEmptyLineAtEndOfParagraph"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+ BAD_CAST(OString::boolean(mbApplyTextAttrToEmptyLineAtEndOfParagraph).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbDoNotMirrorRtlDrawObjs"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+ BAD_CAST(OString::boolean(mbDoNotMirrorRtlDrawObjs).getStr()));
(void)xmlTextWriterEndElement(pWriter);
(void)xmlTextWriterEndElement(pWriter);
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 521ca2b0ba..09b1d9afb6 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -68,6 +68,9 @@ static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* _pFrameFormat,
const SwContact* pContact = GetUserCall( &_rSdrObj );
OSL_ENSURE( pContact, "<lcl_AdjustPositioningAttr(..)> - missing contact object." );
+ if (!pContact)
+ return;
+
// determine position of new group object relative to its anchor frame position
SwTwips nHoriRelPos = 0;
SwTwips nVertRelPos = 0;
@@ -195,6 +198,9 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
// Revoke anchor attribute.
SwDrawContact *pMyContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
+ if (!pMyContact)
+ return pNewContact;
+
const SwFormatAnchor aAnch( pMyContact->GetFormat()->GetAnchor() );
std::unique_ptr<SwUndoDrawGroup> pUndo;
@@ -216,6 +222,9 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
+ if (!pContact)
+ continue;
+
// #i53320#
#if OSL_DEBUG_LEVEL > 0
SwAnchoredDrawObject* pAnchoredDrawObj =
@@ -352,6 +361,9 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
{
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
+ if (!pContact)
+ continue;
+
std::shared_ptr<SwTextBoxNode> pTextBoxNode;
if (auto pGroupFormat = pContact->GetFormat())
pTextBoxNode = pGroupFormat->GetOtherTextBoxFormats();
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 1c696bebb6..3390a50605 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1040,14 +1040,12 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs )
}
}
+ std::optional<SwRegHistory> oRegH;
+ if (pPara->pHistory)
+ oRegH.emplace(&rTNd, rTNd, pPara->pHistory);
+
if ( bChangeOfListStyleAtParagraph )
{
- std::unique_ptr< SwRegHistory > pRegH;
- if ( pPara->pHistory )
- {
- pRegH.reset(new SwRegHistory(&rTNd, rTNd, pPara->pHistory));
- }
-
pCNd->ResetAttr( RES_PARATR_NUMRULE );
// reset all list attributes
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 0735380e5d..01c4a1b387 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -46,6 +46,7 @@
#include <SwNodeNum.hxx>
#include <list.hxx>
#include <calbck.hxx>
+#include <editeng/lrspitem.hxx>
#include <comphelper/string.hxx>
#include <comphelper/random.hxx>
#include <o3tl/safeint.hxx>
@@ -860,11 +861,11 @@ static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
OUString SwDoc::SetNumRule( const SwPaM& rPam,
const SwNumRule& rRule,
- const bool bCreateNewList,
+ SetNumRuleMode eMode,
SwRootFrame const*const pLayout,
const OUString& sContinuedListId,
- bool bSetItem,
- const bool bResetIndentAttrs )
+ SvxTextLeftMarginItem const*const pTextLeftMarginToPropagate,
+ SvxFirstLineIndentItem const*const pFirstLineIndentToPropagate)
{
OUString sListId;
@@ -902,9 +903,9 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
}
}
- if ( bSetItem )
+ if (!(eMode & SetNumRuleMode::DontSetItem))
{
- if ( bCreateNewList )
+ if (eMode & SetNumRuleMode::CreateNewList)
{
if ( bNewNumRuleCreated )
{
@@ -944,7 +945,7 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
if (pRule && pRule->GetName() == pNewOrChangedNumRule->GetName())
{
- bSetItem = false;
+ eMode |= SetNumRuleMode::DontSetItem;
if ( !pTextNd->IsInList() )
{
pTextNd->AddToList();
@@ -961,21 +962,67 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
if ( pCollRule && pCollRule->GetName() == pNewOrChangedNumRule->GetName() )
{
pTextNd->ResetAttr( RES_PARATR_NUMRULE );
- bSetItem = false;
+ eMode |= SetNumRuleMode::DontSetItem;
}
}
}
}
}
- if ( bSetItem )
+ if (!(eMode & SetNumRuleMode::DontSetItem))
{
- getIDocumentContentOperations().InsertPoolItem(aPam,
- SwNumRuleItem(pNewOrChangedNumRule->GetName()),
- SetAttrMode::DEFAULT, pLayout);
+ if (eMode & SetNumRuleMode::DontSetIfAlreadyApplied)
+ {
+ for (SwNodeIndex i = aPam.Start()->nNode; i <= aPam.End()->nNode; ++i)
+ {
+ if (SwTextNode const*const pNode = i.GetNode().GetTextNode())
+ {
+ if (pNode->GetNumRule(true) != pNewOrChangedNumRule)
+ {
+ // only apply if it doesn't already have it - to
+ // avoid overriding indents from style
+ SwPaM const temp(*pNode, 0, *pNode, pNode->Len());
+ getIDocumentContentOperations().InsertPoolItem(temp,
+ SwNumRuleItem(pNewOrChangedNumRule->GetName()),
+ SetAttrMode::DEFAULT, pLayout);
+ // apply provided margins to get visually same result
+ if (pTextLeftMarginToPropagate)
+ {
+ getIDocumentContentOperations().InsertPoolItem(temp,
+ *pTextLeftMarginToPropagate,
+ SetAttrMode::DEFAULT, pLayout);
+ }
+ if (pFirstLineIndentToPropagate)
+ {
+ getIDocumentContentOperations().InsertPoolItem(temp,
+ *pFirstLineIndentToPropagate,
+ SetAttrMode::DEFAULT, pLayout);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ SwNumRuleItem(pNewOrChangedNumRule->GetName()),
+ SetAttrMode::DEFAULT, pLayout);
+ if (pTextLeftMarginToPropagate)
+ {
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ *pTextLeftMarginToPropagate,
+ SetAttrMode::DEFAULT, pLayout);
+ }
+ if (pFirstLineIndentToPropagate)
+ {
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ *pFirstLineIndentToPropagate,
+ SetAttrMode::DEFAULT, pLayout);
+ }
+ }
}
- if ( bResetIndentAttrs
+ if ((eMode & SetNumRuleMode::ResetIndentAttrs)
&& pNewOrChangedNumRule->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
const o3tl::sorted_vector<sal_uInt16> attrs{ RES_MARGIN_FIRSTLINE, RES_MARGIN_TEXTLEFT, RES_MARGIN_RIGHT };
@@ -1275,7 +1322,7 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
SetNumRule( aPam,
*aListStyleData.pReplaceNumRule,
- aListStyleData.bCreateNewList,
+ aListStyleData.bCreateNewList ? SetNumRuleMode::CreateNewList : SetNumRuleMode::Default,
nullptr,
aListStyleData.sListId );
if ( aListStyleData.bCreateNewList )
@@ -1624,7 +1671,9 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
int nNonEmptyAllowed,
OUString& sListId,
SwRootFrame const* pLayout,
- const bool bInvestigateStartNode)
+ const bool bInvestigateStartNode,
+ SvxTextLeftMarginItem const** o_ppTextLeftMargin,
+ SvxFirstLineIndentItem const** o_ppFirstLineIndent)
{
const SwNumRule * pResult = nullptr;
SwTextNode * pTextNd = rPos.GetNode().GetTextNode();
@@ -1661,9 +1710,28 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
( ( bNum && pNumRule->Get(0).IsEnumeration()) ||
( !bNum && pNumRule->Get(0).IsItemize() ) ) ) // #i22362#, #i29560#
{
- pResult = pTextNd->GetNumRule();
+ pResult = pNumRule;
// provide also the list id, to which the text node belongs.
sListId = pTextNd->GetListId();
+ // also get the margins that override the numrule
+ int const nListLevel{pTextNd->GetActualListLevel()};
+ if ((o_ppTextLeftMargin || o_ppFirstLineIndent)
+ && 0 <= nListLevel
+ && pNumRule->Get(o3tl::narrowing<sal_uInt16>(nListLevel))
+ .GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
+ {
+ ::sw::ListLevelIndents const indents{pTextNd->AreListLevelIndentsApplicable()};
+ if (!(indents & ::sw::ListLevelIndents::LeftMargin)
+ && o_ppTextLeftMargin)
+ {
+ *o_ppTextLeftMargin = &pTextNd->SwContentNode::GetAttr(RES_MARGIN_TEXTLEFT);
+ }
+ if (!(indents & ::sw::ListLevelIndents::FirstLine)
+ && o_ppFirstLineIndent)
+ {
+ *o_ppFirstLineIndent = &pTextNd->SwContentNode::GetAttr(RES_MARGIN_FIRSTLINE);
+ }
+ }
}
break;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d29223050b..f9533b37f6 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1375,7 +1375,8 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode,
pTextNd->getLayoutFrame(pLayout) &&
pTextNd->GetNodes().IsDocNodes() &&
// tdf#40142 - consider level settings of the various text nodes
- o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= GetLevel() &&
+ (TOX_CONTENT != SwTOXBase::GetType() ||
+ o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= GetLevel()) &&
(!pLayout || !pLayout->HasMergedParas()
|| static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps() == pTextNd) &&
(!IsFromChapter() || IsHeadingContained(pOwnChapterNode, *pTextNd)))