summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-16 18:52:32 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-30 12:38:20 +0100
commit58e226a1ea94228dd7830f5c93cfbbe04a029918 (patch)
treeb8ad969758858e110168737c86f7e75eb1e27395
parent076b39aad2a81fe36ece4ecca193d7fc67466676 (diff)
sw_redlinehide_4a: add layout to SwTextNode::GetParaAttr()
Merge items from first-node and props-node, as they are used in the text formatting. Change-Id: I4cbab55bc3b0f8bc6dc5bd3577da53b3160018a3
-rw-r--r--sw/inc/ndtxt.hxx3
-rw-r--r--sw/source/core/edit/edattr.cxx3
-rw-r--r--sw/source/core/edit/edfmt.cxx2
-rw-r--r--sw/source/core/inc/txtfrm.hxx3
-rw-r--r--sw/source/core/text/txtfrm.cxx48
-rw-r--r--sw/source/core/txtnode/thints.cxx19
6 files changed, 71 insertions, 7 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 0818fde96434..64eef11f9221 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -305,7 +305,8 @@ public:
bool GetParaAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
const bool bOnlyTextAttr = false,
const bool bGetFromChrFormat = true,
- const bool bMergeIndentValuesOfNumRule = false ) const;
+ const bool bMergeIndentValuesOfNumRule = false,
+ SwRootFrame const* pLayout = nullptr) const;
/// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
void FormatToTextAttr( SwTextNode* pNd );
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 5fe78b683964..65da45aca713 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -143,7 +143,8 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
static_cast<SwTextNode*>(pNd)->GetParaAttr(*pSet, nStt, nEnd,
false, true,
- bMergeIndentValuesOfNumRule );
+ bMergeIndentValuesOfNumRule,
+ GetLayout());
}
break;
case SwNodeType::Grf:
diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx
index 6816bd84172a..a2142249b5c7 100644
--- a/sw/source/core/edit/edfmt.cxx
+++ b/sw/source/core/edit/edfmt.cxx
@@ -93,7 +93,7 @@ void SwEditShell::FillByEx(SwCharFormat* pCharFormat)
SfxItemSet aSet( mxDoc->GetAttrPool(),
pCharFormat->GetAttrSet().GetRanges() );
- pTextNode->GetParaAttr( aSet, nStt, nEnd );
+ pTextNode->GetParaAttr(aSet, nStt, nEnd, false, true, false, GetLayout());
pCharFormat->SetFormatAttr( aSet );
}
else if( pCNd->HasSwAttrSet() )
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 00bd58d12fe9..f0adb57b5bbb 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);
+SwTextNode const& GetAttrMerged(SfxItemSet & rFormatSet,
+ SwTextNode const& rNode, SwRootFrame const* pLayout);
+
void GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout);
void GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const* pLayout);
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 70d34dc4ff91..104a657d1242 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -368,6 +368,54 @@ namespace sw {
return std::make_pair(pTextNode, pTextNode);
}
+ SwTextNode const& GetAttrMerged(SfxItemSet & rFormatSet,
+ SwTextNode const& rNode, SwRootFrame const*const pLayout)
+ {
+ rNode.SwContentNode::GetAttr(rFormatSet);
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ if (sw::MergedPara const*const pMerged =
+ static_cast<SwTextFrame*>(rNode.getLayoutFrame(pLayout))->GetMergedPara())
+ {
+ if (pMerged->pFirstNode != &rNode)
+ {
+ rFormatSet.ClearItem(RES_PAGEDESC);
+ rFormatSet.ClearItem(RES_BREAK);
+ static_assert(RES_PAGEDESC + 1 == sal_uInt16(RES_BREAK),
+ "first-node items must be adjacent");
+ SfxItemSet firstSet(*rFormatSet.GetPool(),
+ svl::Items<RES_PAGEDESC, RES_BREAK>{});
+ pMerged->pFirstNode->SwContentNode::GetAttr(firstSet);
+ rFormatSet.Put(firstSet);
+
+ }
+ if (pMerged->pParaPropsNode != &rNode)
+ {
+ for (sal_uInt16 i = RES_PARATR_BEGIN; i != RES_FRMATR_END; ++i)
+ {
+ if (i != RES_PAGEDESC && i != RES_BREAK)
+ {
+ rFormatSet.ClearItem(i);
+ }
+ }
+ for (sal_uInt16 i = XATTR_FILL_FIRST; i <= XATTR_FILL_LAST; ++i)
+ {
+ rFormatSet.ClearItem(i);
+ }
+ SfxItemSet propsSet(*rFormatSet.GetPool(),
+ svl::Items<RES_PARATR_BEGIN, RES_PAGEDESC,
+ RES_BREAK+1, RES_FRMATR_END,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST+1>{});
+ pMerged->pParaPropsNode->SwContentNode::GetAttr(propsSet);
+ rFormatSet.Put(propsSet);
+ return *pMerged->pParaPropsNode;
+ }
+ // keep all the CHRATR/UNKNOWNATR anyway...
+ }
+ }
+ return rNode;
+ }
+
} // namespace sw
/// Switches width and height of the text frame
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index c319d135d93f..83aa88513688 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -65,6 +65,7 @@
#include <pam.hxx>
#include <ndtxt.hxx>
#include <txtfrm.hxx>
+#include <rootfrm.hxx>
#include <rolbck.hxx>
#include <ddefld.hxx>
#include <docufld.hxx>
@@ -2050,18 +2051,28 @@ static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode,
// request the attributes of the TextNode at the range
bool SwTextNode::GetParaAttr(SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
const bool bOnlyTextAttr, const bool bGetFromChrFormat,
- const bool bMergeIndentValuesOfNumRule ) const
+ const bool bMergeIndentValuesOfNumRule,
+ SwRootFrame const*const pLayout) const
{
assert(!rSet.Count()); // handled inconsistently, typically an error?
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ if (GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return false; // ignore deleted node
+ }
+ }
+
// get the node's automatic attributes
SfxItemSet aFormatSet( *rSet.GetPool(), rSet.GetRanges() );
if (!bOnlyTextAttr)
{
- SwContentNode::GetAttr( aFormatSet );
- if ( bMergeIndentValuesOfNumRule )
+ SwTextNode const& rParaPropsNode(
+ sw::GetAttrMerged(aFormatSet, *this, pLayout));
+ if (bMergeIndentValuesOfNumRule)
{
- lcl_MergeListLevelIndentAsLRSpaceItem( *this, aFormatSet );
+ lcl_MergeListLevelIndentAsLRSpaceItem(rParaPropsNode, aFormatSet);
}
}