[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4a' - 13 commits - sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 20 18:08:03 UTC 2018
Rebased ref, commits from common ancestor:
commit 5042226b2bba8dc9d9ea24e699f46bbb85684041
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:51:31 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 18:52:49 2018 +0100
MoveLeftMargin
Change-Id: I670491dfef2756a17e3b4f44d25eaa75de8368af
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 2a259413a5f3..a12024ffbd36 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1378,7 +1378,8 @@ public:
/** Adjust left margin via object bar (similar to adjustment of numerations).
One can either change the margin "by" adding or subtracting a given
offset or set it "to" this position (bModulus = true). */
- void MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus );
+ void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
+ SwRootFrame const* pLayout = nullptr);
// Query NumberFormatter.
inline SvNumberFormatter* GetNumberFormatter( bool bCreate = true );
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index e88f986d5b70..0b7d3a170ba1 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1638,7 +1638,8 @@ SwFormat* SwDoc::FindFormatByName( const SwFormatsBase& rFormatArr,
return pFnd;
}
-void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
+void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
+ SwRootFrame const*const pLayout)
{
SwHistory* pHistory = nullptr;
if (GetIDocumentUndoRedo().DoesUndo())
@@ -1658,6 +1659,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
if( pTNd )
{
+ pTNd = sw::GetParaPropsNode(*pLayout, aIdx);
SvxLRSpaceItem aLS( static_cast<const SvxLRSpaceItem&>(pTNd->SwContentNode::GetAttr( RES_LR_SPACE )) );
// #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
@@ -1693,6 +1695,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
SwRegHistory aRegH( pTNd, *pTNd, pHistory );
pTNd->SetAttr( aLS );
+ aIdx = *sw::GetFirstAndLastNode(*pLayout, aIdx).second;
}
++aIdx;
}
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index e26d39007726..b2c2eab75197 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -564,10 +564,10 @@ void SwEditShell::MoveLeftMargin( bool bRight, bool bModulus )
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->MoveLeftMargin( aRangeArr.SetPam( n, aPam ),
- bRight, bModulus );
+ bRight, bModulus, GetLayout() );
}
else
- GetDoc()->MoveLeftMargin( *pCursor, bRight, bModulus );
+ GetDoc()->MoveLeftMargin( *pCursor, bRight, bModulus, GetLayout() );
EndUndo( SwUndoId::END );
EndAllAction();
commit 166886d1d3efb4e84d337c5663d438d926411515
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:26:18 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 18:26:18 2018 +0100
SwEditShell::IsMoveLeftMargin()
Change-Id: I2bc29816af93ae265c0f0d11977b2d694e00ad6c
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 53712252e315..e26d39007726 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -524,6 +524,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
for( sal_uLong n = nSttNd; bRet && n <= nEndNd; ++n )
if( nullptr != ( pCNd = GetDoc()->GetNodes()[ n ]->GetTextNode() ))
{
+ pCNd = sw::GetParaPropsNode(*GetLayout(), *pCNd);
const SvxLRSpaceItem& rLS = static_cast<const SvxLRSpaceItem&>(
pCNd->GetAttr( RES_LR_SPACE ));
if( bRight )
commit fa006e92b03bc332304f0e1589c91d9a3b6b409b
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:26:12 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 18:26:12 2018 +0100
SwEditShell::GetPaMTextFormatColl()
Change-Id: I10dcee40b98b752a30942a64c1115116dfc668be
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index efd9b459146c..53712252e315 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -299,6 +299,7 @@ SwTextFormatColl* SwEditShell::GetPaMTextFormatColl( SwPaM* pPaM ) const
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell::GetItemWithPaM( sal_uInt16 nWhich )
{
+ assert(isCHRATR(nWhich)); // sw_redlinehide: only thing that works
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItem;
for(SwPaM& rCurrentPaM : GetCursor()->GetRingContainer())
{ // for all the point and mark (selections)
commit 0900de0eb3489f2e53e928787c50ea31591d042d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 18:00:27 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 18:00:27 2018 +0100
adapt SwEditShell::GetPaMParAttr()
Change-Id: I97a2081a142fd1f74a5d6be534f094fdc4db45ab
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 2171a4230115..efd9b459146c 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -216,10 +216,16 @@ bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
// get the node
SwNode* pNd = GetDoc()->GetNodes()[ n ];
+ if (GetLayout()->IsHideRedlines()
+ && pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ continue;
+ }
+
if( pNd->IsTextNode() )
{
// get the node (paragraph) attributes
- static_cast<SwContentNode*>(pNd)->GetAttr(*pSet);
+ sw::GetAttrMerged(*pSet, *pNd->GetTextNode(), GetLayout());
if( pSet != &rSet && aSet.Count() )
{
commit ab26344643a527eeab6de4e7afffd71fa7d6493f
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 17:59:34 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 17:59:59 2018 +0100
move that into a function
Change-Id: I90ed52d5e23da82b9194946be2997de70223d07b
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..1bdc051665c4 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -368,6 +368,53 @@ 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));
+ 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 142cbe61ab09..83aa88513688 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2068,51 +2068,11 @@ bool SwTextNode::GetParaAttr(SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
SfxItemSet aFormatSet( *rSet.GetPool(), rSet.GetRanges() );
if (!bOnlyTextAttr)
{
- SwTextNode const* pParaPropsNode(this);
- SwContentNode::GetAttr( aFormatSet );
- if (pLayout && pLayout->IsHideRedlines())
- {
- if (sw::MergedPara const*const pMerged =
- static_cast<SwTextFrame*>(getLayoutFrame(pLayout))->GetMergedPara())
- {
- if (pMerged->pFirstNode != this)
- {
- aFormatSet.ClearItem(RES_PAGEDESC);
- aFormatSet.ClearItem(RES_BREAK);
- static_assert(RES_PAGEDESC + 1 == sal_uInt16(RES_BREAK));
- SfxItemSet firstSet(*rSet.GetPool(),
- svl::Items<RES_PAGEDESC, RES_BREAK>{});
- pMerged->pFirstNode->SwContentNode::GetAttr(firstSet);
- aFormatSet.Put(firstSet);
-
- }
- if (pMerged->pParaPropsNode != this)
- {
- for (sal_uInt16 i = RES_PARATR_BEGIN; i != RES_FRMATR_END; ++i)
- {
- if (i != RES_PAGEDESC && i != RES_BREAK)
- {
- aFormatSet.ClearItem(i);
- }
- }
- for (sal_uInt16 i = XATTR_FILL_FIRST; i <= XATTR_FILL_LAST; ++i)
- {
- aFormatSet.ClearItem(i);
- }
- SfxItemSet propsSet(*rSet.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);
- aFormatSet.Put(propsSet);
- pParaPropsNode = pMerged->pParaPropsNode;
- }
- // keep all the CHRATR/UNKNOWNATR anyway...
- }
- }
+ SwTextNode const& rParaPropsNode(
+ sw::GetAttrMerged(aFormatSet, *this, pLayout));
if (bMergeIndentValuesOfNumRule)
{
- lcl_MergeListLevelIndentAsLRSpaceItem(*pParaPropsNode, aFormatSet);
+ lcl_MergeListLevelIndentAsLRSpaceItem(rParaPropsNode, aFormatSet);
}
}
commit e1af07ce05556171ec86d772c396f6573a06348e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 16:32:04 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 16:32:04 2018 +0100
sw_redlinehide_4a: adapt SwEditShell::FillByEx()
Change-Id: I8a85d1fe580ce8c8a52d0ee00d36e499b5e903dc
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 7454156c2362..a38e5e70fdbe 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -77,6 +77,7 @@
#include <unoprnms.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
+#include <txtfrm.hxx>
#include <rdfhelper.hxx>
#include <sfx2/watermarkitem.hxx>
@@ -2203,6 +2204,10 @@ void SwEditShell::FillByEx(SwTextFormatColl* pColl)
{
SwPaM * pCursor = GetCursor();
SwContentNode * pCnt = pCursor->GetContentNode();
+ if (pCnt->IsTextNode()) // uhm... what nonsense would happen if not?
+ { // only need properties-node because BREAK/PAGEDESC filtered anyway!
+ pCnt = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
+ }
const SfxItemSet* pSet = pCnt->GetpSwAttrSet();
if( pSet )
{
commit c59855a3228dd919517ac3392477bd1356b2c176
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 16:19:56 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 16:19:56 2018 +0100
RstAttr
Change-Id: I452f3e6d249a4ef8837b7fcb4a641a03d7de325d
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index d45effa22171..e88f986d5b70 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -104,6 +104,11 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
{
const sw::DocumentContentOperationsManager::ParaRstFormat* pPara = static_cast<sw::DocumentContentOperationsManager::ParaRstFormat*>(pArgs);
SwContentNode* pNode = rpNd->GetContentNode();
+ if (pPara->pLayout && pPara->pLayout->IsHideRedlines()
+ && pNode && pNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return true;
+ }
if( pNode && pNode->HasSwAttrSet() )
{
const bool bLocked = pNode->IsModifyLocked();
commit 682c35a333ab9a28667f2f9f29f1c316c7378f9e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 15:28:38 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 15:28:38 2018 +0100
SwEditShell::ResetAttr()
Change-Id: I5131f5a3ff261a4d86e65b4afff3eb8cdd98cebf
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 964d8ffe1361..14b0b48f9676 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -42,7 +42,7 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
}
for(SwPaM& rCurrentCursor : pCursor->GetRingContainer())
- GetDoc()->ResetAttrs(rCurrentCursor, true, attrs);
+ GetDoc()->ResetAttrs(rCurrentCursor, true, attrs, GetLayout());
if( bUndoGroup )
{
commit 7bdfdb548a72593cb703b2d02f0e7be85d2b6531
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 15:27:45 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 15:28:14 2018 +0100
more SetCounted / SetNumRule
Change-Id: I4dd3973a758f4afcc30f905b7351e9687d050e33
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4905ede420ee..2a259413a5f3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1030,7 +1030,7 @@ public:
const OUString& sContinuedListId = OUString(),
bool bSetItem = true,
const bool bResetIndentAttrs = false );
- void SetCounted( const SwPaM&, bool bCounted);
+ void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
void MakeUniqueNumRules(const SwPaM & rPaM);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 58491be5e587..ca221414f81c 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -64,7 +64,8 @@
namespace {
- void lcl_ResetIndentAttrs(SwDoc *pDoc, const SwPaM &rPam, sal_uInt16 marker )
+ void lcl_ResetIndentAttrs(SwDoc *pDoc, const SwPaM &rPam, sal_uInt16 marker,
+ SwRootFrame const*const pLayout)
{
std::set<sal_uInt16> aResetAttrsArray;
aResetAttrsArray.insert( marker );
@@ -78,11 +79,11 @@ namespace {
rPam.End()->nNode );
aPam.Start()->nContent = 0;
aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTextNode()->Len();
- pDoc->ResetAttrs( aPam, false, aResetAttrsArray );
+ pDoc->ResetAttrs( aPam, false, aResetAttrsArray, pLayout );
}
else
{
- pDoc->ResetAttrs( rPam, false, aResetAttrsArray );
+ pDoc->ResetAttrs( rPam, false, aResetAttrsArray, pLayout );
}
}
@@ -913,7 +914,9 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
}
if (!sListId.isEmpty())
{
- getIDocumentContentOperations().InsertPoolItem(aPam, SfxStringItem(RES_PARATR_LIST_ID, sListId));
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ SfxStringItem(RES_PARATR_LIST_ID, sListId),
+ SetAttrMode::DEFAULT, pLayout);
}
}
@@ -954,13 +957,15 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
if ( bSetItem )
{
- getIDocumentContentOperations().InsertPoolItem(aPam, SwNumRuleItem(pNewOrChangedNumRule->GetName()));
+ getIDocumentContentOperations().InsertPoolItem(aPam,
+ SwNumRuleItem(pNewOrChangedNumRule->GetName()),
+ SetAttrMode::DEFAULT, pLayout);
}
if ( bResetIndentAttrs
&& pNewOrChangedNumRule->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- ::lcl_ResetIndentAttrs(this, aPam, RES_LR_SPACE);
+ ::lcl_ResetIndentAttrs(this, aPam, RES_LR_SPACE, pLayout);
}
if (GetIDocumentUndoRedo().DoesUndo())
@@ -973,15 +978,18 @@ OUString SwDoc::SetNumRule( const SwPaM& rPam,
return sListId;
}
-void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
+void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted,
+ SwRootFrame const*const pLayout)
{
if ( bCounted )
{
- ::lcl_ResetIndentAttrs(this, rPam, RES_PARATR_LIST_ISCOUNTED);
+ ::lcl_ResetIndentAttrs(this, rPam, RES_PARATR_LIST_ISCOUNTED, pLayout);
}
else
{
- getIDocumentContentOperations().InsertPoolItem( rPam, SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, false ) );
+ getIDocumentContentOperations().InsertPoolItem(rPam,
+ SfxBoolItem(RES_PARATR_LIST_ISCOUNTED, false),
+ SetAttrMode::DEFAULT, pLayout);
}
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index ee35d6e8be8e..8a484b085406 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -798,7 +798,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
bCreateNewList = false;
}
- GetDoc()->SetCounted( aPam, true );
+ GetDoc()->SetCounted(aPam, true, GetLayout());
}
}
else
@@ -806,7 +806,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
GetDoc()->SetNumRule( *pCursor, rRule,
bCreateNewList, GetLayout(), rContinuedListId,
true, bResetIndentAttrs );
- GetDoc()->SetCounted( *pCursor, true );
+ GetDoc()->SetCounted( *pCursor, true, GetLayout() );
}
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
commit e2da7f7eb74f1d898c943a95d70539b20a476f24
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 14:38:55 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 14:39:08 2018 +0100
Reset
Change-Id: I1bcbf209bdf5bf4ab8eb9f42d61eb0fe94b6f88b
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 196bea0a202d..4905ede420ee 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -692,8 +692,10 @@ public:
void ResetAttrs( const SwPaM &rRg,
bool bTextAttr = true,
const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
- const bool bSendDataChangedEvents = true );
- void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false, bool bExactRange = false );
+ const bool bSendDataChangedEvents = true,
+ SwRootFrame const* pLayout = nullptr);
+ void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false,
+ bool bExactRange = false, SwRootFrame const* pLayout = nullptr);
/** Set attribute in given format.1y
* If Undo is enabled, the old values is added to the Undo history. */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 116e170cc124..d45effa22171 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -52,6 +52,7 @@
#include <IDocumentStylePoolAccess.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
+#include <txtfrm.hxx>
#include <hints.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
@@ -224,7 +225,8 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
return true;
}
-void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark, bool bExactRange )
+void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark,
+ bool bExactRange, SwRootFrame const*const pLayout)
{
SwHistory* pHst = nullptr;
SwDataChanged aTmp( rRg );
@@ -235,7 +237,8 @@ void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark, bool bExactRang
GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
}
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
- sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHst );
+ sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHst, nullptr, pLayout );
aPara.bInclRefToxMark = bInclRefToxMark;
aPara.bExactRange = bExactRange;
GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
@@ -246,7 +249,8 @@ void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark, bool bExactRang
void SwDoc::ResetAttrs( const SwPaM &rRg,
bool bTextAttr,
const std::set<sal_uInt16> &rAttrs,
- const bool bSendDataChangedEvents )
+ const bool bSendDataChangedEvents,
+ SwRootFrame const*const pLayout)
{
SwPaM* pPam = const_cast<SwPaM*>(&rRg);
if( !bTextAttr && !rAttrs.empty() && RES_TXTATR_END > *(rAttrs.begin()) )
@@ -318,7 +322,8 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
}
const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
- sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHst );
+ sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHst, nullptr, pLayout);
// mst: not including META here; it seems attrs with CH_TXTATR are omitted
sal_uInt16 const aResetableSetRange[] {
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 3a4f94d280fd..7454156c2362 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2177,7 +2177,7 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat,
aPaM.Start()->nContent = 0;
aPaM.End()->nContent = pEndTextNode->GetText().getLength();
}
- GetDoc()->RstTextAttrs(aPaM, /*bInclRefToxMark=*/false, /*bExactRange=*/true);
+ GetDoc()->RstTextAttrs(aPaM, /*bInclRefToxMark=*/false, /*bExactRange=*/true, GetLayout());
}
}
commit 0aa1a97341930c7d9011cc314468e593fa108244
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 14:37:40 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 14:37:40 2018 +0100
SwEditShell::SetTextFormatColl()
Change-Id: I9c511e87c431bd39dc6efdcddf2cad9bbf18c592
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 1230304fae5e..196bea0a202d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -782,7 +782,8 @@ public:
that <bReset = true> and the paragraph style has a list style attribute set. */
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
const bool bReset = true,
- const bool bResetListAttrs = false);
+ const bool bResetListAttrs = false,
+ SwRootFrame const* pLayout = nullptr);
SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const
{ return static_cast<SwTextFormatColl*>(FindFormatByName( *mpTextFormatCollTable, rName )); }
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 59960e71e700..116e170cc124 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1008,6 +1008,18 @@ static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
sw::DocumentContentOperationsManager::ParaRstFormat* pPara = static_cast<sw::DocumentContentOperationsManager::ParaRstFormat*>(pArgs);
+ if (pPara->pLayout && pPara->pLayout->IsHideRedlines())
+ {
+ if (pCNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return true;
+ }
+ if (pCNd->IsTextNode())
+ {
+ pCNd = sw::GetParaPropsNode(*pPara->pLayout, SwNodeIndex(*pCNd));
+ }
+ }
+
SwTextFormatColl* pFormat = static_cast<SwTextFormatColl*>(pPara->pFormatColl);
if ( pPara->bReset )
{
@@ -1070,7 +1082,8 @@ static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
bool SwDoc::SetTextFormatColl(const SwPaM &rRg,
SwTextFormatColl *pFormat,
const bool bReset,
- const bool bResetListAttrs)
+ const bool bResetListAttrs,
+ SwRootFrame const*const pLayout)
{
SwDataChanged aTmp( rRg );
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
@@ -1086,7 +1099,8 @@ bool SwDoc::SetTextFormatColl(const SwPaM &rRg,
GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
}
- sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHst );
+ sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHst, nullptr, pLayout);
aPara.pFormatColl = pFormat;
aPara.bReset = bReset;
// #i62675#
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 5da40eb2555b..3a4f94d280fd 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2168,7 +2168,7 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat,
if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) )
{
// Change the paragraph style to pLocal and remove all direct paragraph formatting.
- GetDoc()->SetTextFormatColl( rPaM, pLocal, true, bResetListAttrs );
+ GetDoc()->SetTextFormatColl(rPaM, pLocal, true, bResetListAttrs, GetLayout());
// If there are hints on the nodes which cover the whole node, then remove those, too.
SwPaM aPaM(*rPaM.Start(), *rPaM.End());
commit 5422b0cde2f3a9c850ef2a117774bfb0672bd377
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Nov 20 11:04:41 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 13:23:27 2018 +0100
sw_redlinehide_4a: adapt SwEditShell::ReplaceDropText()/GetDropText()
Change-Id: Iaf6101f02bd5dbeb9a07e796932186b5e2b1a563
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 111fec2ae91f..47a12d6756d9 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -490,12 +490,17 @@ OUString SwEditShell::GetDropText( const sal_Int32 nChars ) const
}
}
- SwTextNode* pTextNd = pCursor->GetNode( !pCursor->HasMark() ).GetTextNode();
+ SwTextNode const*const pTextNd = pCursor->GetNode(false).GetTextNode();
if( pTextNd )
{
- sal_Int32 nDropLen = pTextNd->GetDropLen( nChars );
- if( nDropLen )
- aText = pTextNd->GetText().copy(0, nDropLen);
+ SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
+ pTextNd->getLayoutFrame(GetLayout())));
+ SAL_WARN_IF(!pTextFrame, "sw.core", "GetDropText cursor has no frame?");
+ if (pTextFrame)
+ {
+ TextFrameIndex const nDropLen(pTextFrame->GetDropLen(nChars));
+ aText = pTextFrame->GetText().copy(0, sal_Int32(nDropLen));
+ }
}
return aText;
@@ -511,6 +516,14 @@ void SwEditShell::ReplaceDropText( const OUString &rStr, SwPaM* pPaM )
const SwNodeIndex& rNd = pCursor->GetPoint()->nNode;
SwPaM aPam( rNd, rStr.getLength(), rNd, 0 );
+ SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
+ rNd.GetNode().GetTextNode()->getLayoutFrame(GetLayout())));
+ if (pTextFrame)
+ {
+ *aPam.GetPoint() = pTextFrame->MapViewToModelPos(TextFrameIndex(0));
+ *aPam.GetMark() = pTextFrame->MapViewToModelPos(TextFrameIndex(
+ std::min(rStr.getLength(), pTextFrame->GetText().getLength())));
+ }
if( !GetDoc()->getIDocumentContentOperations().Overwrite( aPam, rStr ) )
{
OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
commit 1040b111a1e9bead9e7eda674779379b7cd8d615
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Nov 19 17:44:37 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Nov 20 13:23:26 2018 +0100
sw_redlinehide_4a: InsertItemSet/InsertPoolItem
It's really quite annoying to have RES_BREAK applied to all nodes; so
apply the node-items only to the first-/properties-node and skip hidden
nodes.
Keep applying text/character items as before, except skip over hidden
nodes.
Change-Id: I085afd59af78caf1ca8dac4080c53bdbdb4e56a1
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index fb4006334a15..f761b27aa331 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -37,6 +37,7 @@ class SwFrameFormat;
class SwDrawFrameFormat;
class SwFlyFrameFormat;
class SwNodeIndex;
+class SwRootFrame;
namespace utl { class TransliterationWrapper; }
namespace svt { class EmbeddedObjectRef; }
@@ -212,10 +213,13 @@ public:
false.
*/
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT, bool bExpandCharToPara=false) = 0;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr,
+ bool bExpandCharToPara=false) = 0;
virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT) = 0;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr) = 0;
/** Removes any leading white space from the paragraph
*/
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 2727b3e39274..ceb468b7b1ae 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -45,6 +45,7 @@
#include <SwStyleNameMapper.hxx>
#include <redline.hxx>
#include <txtfrm.hxx>
+#include <rootfrm.hxx>
#include <unocrsr.hxx>
#include <mvsave.hxx>
#include <ndtxt.hxx>
@@ -1013,6 +1014,81 @@ namespace
namespace //local functions originally from docfmt.cxx
{
+
+ bool lcl_ApplyOtherSet(
+ SwContentNode & rNode,
+ SwHistory *const pHistory,
+ SfxItemSet const& rOtherSet,
+ SfxItemSet const& rFirstSet,
+ SfxItemSet const& rPropsSet,
+ SwRootFrame const*const pLayout,
+ SwNodeIndex *const o_pIndex = nullptr)
+ {
+ assert(rOtherSet.Count());
+
+ bool ret(false);
+ SwTextNode *const pTNd = rNode.GetTextNode();
+ sw::MergedPara const* pMerged(nullptr);
+ if (pLayout && pLayout->IsHideRedlines() && pTNd)
+ {
+ SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(
+ pTNd->getLayoutFrame(pLayout)));
+ if (pTextFrame)
+ {
+ pMerged = pTextFrame->GetMergedPara();
+ }
+ if (pMerged)
+ {
+ if (rFirstSet.Count())
+ {
+ if (pHistory)
+ {
+ SwRegHistory aRegH(pMerged->pFirstNode, *pMerged->pFirstNode, pHistory);
+ ret = pMerged->pFirstNode->SetAttr(rFirstSet);
+ }
+ else
+ {
+ ret = pMerged->pFirstNode->SetAttr(rFirstSet);
+ }
+ }
+ if (rPropsSet.Count())
+ {
+ if (pHistory)
+ {
+ SwRegHistory aRegH(pMerged->pParaPropsNode, *pMerged->pParaPropsNode, pHistory);
+ ret = pMerged->pParaPropsNode->SetAttr(rPropsSet) || ret;
+ }
+ else
+ {
+ ret = pMerged->pParaPropsNode->SetAttr(rPropsSet) || ret;
+ }
+ }
+ if (o_pIndex)
+ {
+ *o_pIndex = *pMerged->pLastNode; // skip hidden
+ }
+ }
+ }
+
+ // input cursor can't be on hidden node, and iteration skips them
+ assert(!pLayout || !pLayout->IsHideRedlines()
+ || rNode.GetRedlineMergeFlag() != SwNode::Merge::Hidden);
+
+ if (!pMerged)
+ {
+ if (pHistory)
+ {
+ SwRegHistory aRegH(&rNode, rNode, pHistory);
+ ret = rNode.SetAttr( rOtherSet );
+ }
+ else
+ {
+ ret = rNode.SetAttr( rOtherSet );
+ }
+ }
+ return ret;
+ }
+
#define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; }
/// Insert Hints according to content types;
@@ -1024,6 +1100,7 @@ namespace //local functions originally from docfmt.cxx
const SfxItemSet& rChgSet,
const SetAttrMode nFlags,
SwUndoAttr *const pUndo,
+ SwRootFrame const*const pLayout,
const bool bExpandCharToPara=false)
{
// Divide the Sets (for selections in Nodes)
@@ -1106,6 +1183,10 @@ namespace //local functions originally from docfmt.cxx
if (rRg.IsInFrontOfLabel())
{
SwTextNode * pTextNd = pNode->GetTextNode();
+ if (pLayout)
+ {
+ pTextNd = sw::GetParaPropsNode(*pLayout, *pTextNd);
+ }
SwNumRule * pNumRule = pTextNd->GetNumRule();
if ( !pNumRule )
@@ -1246,8 +1327,13 @@ namespace //local functions originally from docfmt.cxx
}
else
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
- bRet = pNode->SetAttr( aNew ) || bRet;
+ SwContentNode * pFirstNode(pNode);
+ if (pLayout && pLayout->IsHideRedlines())
+ {
+ pFirstNode = sw::GetFirstAndLastNode(*pLayout, pStt->nNode).first;
+ }
+ SwRegHistory aRegH( pFirstNode, *pFirstNode, pHistory );
+ bRet = pFirstNode->SetAttr( aNew ) || bRet;
}
}
@@ -1309,6 +1395,21 @@ namespace //local functions originally from docfmt.cxx
}
}
+ SfxItemSet firstSet(pDoc->GetAttrPool(),
+ svl::Items<RES_PAGEDESC, RES_BREAK>{});
+ if (pOtherSet && pOtherSet->Count())
+ { // actually only RES_BREAK is possible here...
+ firstSet.Put(*pOtherSet);
+ }
+ SfxItemSet propsSet(pDoc->GetAttrPool(),
+ svl::Items<RES_PARATR_BEGIN, RES_PAGEDESC,
+ RES_BREAK+1, RES_FRMATR_END,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST+1>{});
+ if (pOtherSet && pOtherSet->Count())
+ {
+ propsSet.Put(*pOtherSet);
+ }
+
if( !rRg.HasMark() ) // no range
{
if( !pNode )
@@ -1387,15 +1488,13 @@ namespace //local functions originally from docfmt.cxx
}
if( pOtherSet && pOtherSet->Count() )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
-
// Need to check for unique item for DrawingLayer items of type NameOrIndex
// and evtl. correct that item to ensure unique names for that type. This call may
// modify/correct entries inside of the given SfxItemSet
SfxItemSet aTempLocalCopy(*pOtherSet);
pDoc->CheckForUniqueItemForLineFillNameOrIndex(aTempLocalCopy);
- bRet = pNode->SetAttr(aTempLocalCopy) || bRet;
+ bRet = lcl_ApplyOtherSet(*pNode, pHistory, aTempLocalCopy, firstSet, propsSet, pLayout) || bRet;
}
DELETECHARSETS
@@ -1435,8 +1534,7 @@ namespace //local functions originally from docfmt.cxx
if( pOtherSet && pOtherSet->Count() )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
- bRet = pNode->SetAttr( *pOtherSet ) || bRet;
+ bRet = lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout) || bRet;
}
// Only selection in a Node.
@@ -1495,8 +1593,7 @@ namespace //local functions originally from docfmt.cxx
if( pOtherSet && pOtherSet->Count() )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
- pNode->SetAttr( *pOtherSet );
+ lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout);
}
++nNodes;
@@ -1517,7 +1614,8 @@ namespace //local functions originally from docfmt.cxx
// Reset all attributes from the set!
if( pCharSet && pCharSet->Count() && !( SetAttrMode::DONTREPLACE & nFlags ) )
{
- ::sw::DocumentContentOperationsManager::ParaRstFormat aPara( pStt, pEnd, pHistory, pCharSet );
+ ::sw::DocumentContentOperationsManager::ParaRstFormat aPara(
+ pStt, pEnd, pHistory, pCharSet, pLayout);
pDoc->GetNodes().ForEach( aSt, aEnd, ::sw::DocumentContentOperationsManager::lcl_RstTextAttr, &aPara );
}
@@ -1525,18 +1623,23 @@ namespace //local functions originally from docfmt.cxx
SfxItemState::SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, false ) ||
SfxItemState::SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, false ) );
- for(; aSt < aEnd; ++aSt )
+ for (SwNodeIndex current = aSt; current < aEnd; ++current)
{
- pNode = aSt.GetNode().GetContentNode();
- if( !pNode )
+ SwTextNode *const pTNd = current.GetNode().GetTextNode();
+ if (!pTNd)
continue;
- SwTextNode* pTNd = pNode->GetTextNode();
+ if (pLayout && pLayout->IsHideRedlines()
+ && pTNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ { // not really sure what to do here, but applying to hidden
+ continue; // nodes doesn't make sense...
+ }
+
if( pHistory )
{
- SwRegHistory aRegH( pNode, *pNode, pHistory );
+ SwRegHistory aRegH( pTNd, *pTNd, pHistory );
- if( pTNd && pCharSet && pCharSet->Count() )
+ if (pCharSet && pCharSet->Count())
{
SwpHints *pSwpHints = bCreateSwpHints ? &pTNd->GetOrCreateSwpHints()
: pTNd->GetpSwpHints();
@@ -1547,19 +1650,28 @@ namespace //local functions originally from docfmt.cxx
if( pSwpHints )
pSwpHints->DeRegister();
}
- if( pOtherSet && pOtherSet->Count() )
- pNode->SetAttr( *pOtherSet );
}
else
{
- if( pTNd && pCharSet && pCharSet->Count() )
+ if (pCharSet && pCharSet->Count())
pTNd->SetAttr(*pCharSet, 0, pTNd->GetText().getLength(), nFlags);
- if( pOtherSet && pOtherSet->Count() )
- pNode->SetAttr( *pOtherSet );
}
++nNodes;
}
+ if (pOtherSet && pOtherSet->Count())
+ {
+ for (; aSt < aEnd; ++aSt)
+ {
+ pNode = aSt.GetNode().GetContentNode();
+ if (!pNode)
+ continue;
+
+ lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout, &aSt);
+ ++nNodes;
+ }
+ }
+
//The data parameter flag: bExpandCharToPara, comes from the data member of SwDoc,
//which is set in SW MS Word Binary filter WW8ImplRreader. With this flag on, means that
//current setting attribute set is a character range properties set and comes from a MS Word
@@ -3101,6 +3213,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
const SwPaM &rRg,
const SfxPoolItem &rHt,
const SetAttrMode nFlags,
+ SwRootFrame const*const pLayout,
const bool bExpandCharToPara)
{
if (utl::ConfigManager::IsFuzzing())
@@ -3116,7 +3229,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
SfxItemSet aSet( m_rDoc.GetAttrPool(), {{rHt.Which(), rHt.Which()}} );
aSet.Put( rHt );
- const bool bRet = lcl_InsAttr( &m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), bExpandCharToPara );
+ const bool bRet = lcl_InsAttr(&m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), pLayout, bExpandCharToPara);
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
@@ -3131,7 +3244,7 @@ bool DocumentContentOperationsManager::InsertPoolItem(
}
void DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet,
- const SetAttrMode nFlags )
+ const SetAttrMode nFlags, SwRootFrame const*const pLayout)
{
SwDataChanged aTmp( rRg );
std::unique_ptr<SwUndoAttr> pUndoAttr;
@@ -3141,7 +3254,7 @@ void DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const S
pUndoAttr.reset(new SwUndoAttr( rRg, rSet, nFlags ));
}
- bool bRet = lcl_InsAttr( &m_rDoc, rRg, rSet, nFlags, pUndoAttr.get() );
+ bool bRet = lcl_InsAttr(&m_rDoc, rRg, rSet, nFlags, pUndoAttr.get(), pLayout);
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
@@ -3531,6 +3644,11 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
bool DocumentContentOperationsManager::lcl_RstTextAttr( const SwNodePtr& rpNd, void* pArgs )
{
ParaRstFormat* pPara = static_cast<ParaRstFormat*>(pArgs);
+ if (pPara->pLayout && pPara->pLayout->IsHideRedlines()
+ && rpNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ return true; // skip hidden, since new items aren't applied
+ }
SwTextNode * pTextNode = rpNd->GetTextNode();
if( pTextNode && pTextNode->GetpSwpHints() )
{
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 6e58be8cee1e..964d8ffe1361 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -110,7 +110,7 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, SetAttrMode nFlags )
if( rPaM.HasMark() && ( bIsTableMode ||
*rPaM.GetPoint() != *rPaM.GetMark() ))
{
- GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, rHint, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, rHint, nFlags, GetLayout());
}
}
@@ -120,7 +120,7 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, SetAttrMode nFlags )
{
if( !HasSelection() )
UpdateAttr();
- GetDoc()->getIDocumentContentOperations().InsertPoolItem( *pCursor, rHint, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertPoolItem(*pCursor, rHint, nFlags, GetLayout());
}
EndAllAction();
}
@@ -141,7 +141,7 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, SwPaM*
if( rTmpCursor.HasMark() && ( bIsTableMode ||
*rTmpCursor.GetPoint() != *rTmpCursor.GetMark() ))
{
- GetDoc()->getIDocumentContentOperations().InsertItemSet(rTmpCursor, rSet, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertItemSet(rTmpCursor, rSet, nFlags, GetLayout());
}
}
@@ -151,7 +151,7 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, SwPaM*
{
if( !HasSelection() )
UpdateAttr();
- GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCursor, rSet, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertItemSet(*pCursor, rSet, nFlags, GetLayout());
}
EndAllAction();
}
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index c60676617b78..e276d4e61238 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -87,10 +87,13 @@ public:
// Add a para for the char attribute exp...
bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT, bool bExpandCharToPara=false) override;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr,
+ bool bExpandCharToPara=false) override;
void InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
- const SetAttrMode nFlags = SetAttrMode::DEFAULT) override;
+ const SetAttrMode nFlags = SetAttrMode::DEFAULT,
+ SwRootFrame const* pLayout = nullptr) override;
void RemoveLeadingWhiteSpace(const SwPosition & rPos ) override;
@@ -117,6 +120,7 @@ public:
SwHistory* pHistory;
const SwPosition *pSttNd, *pEndNd;
const SfxItemSet* pDelSet;
+ SwRootFrame const*const pLayout;
sal_uInt16 nWhich;
bool bReset;
bool bResetListAttrs; // #i62575#
@@ -126,12 +130,14 @@ public:
bool bExactRange;
ParaRstFormat(const SwPosition* pStt, const SwPosition* pEnd,
- SwHistory* pHst, const SfxItemSet* pSet = nullptr)
+ SwHistory* pHst, const SfxItemSet* pSet = nullptr,
+ SwRootFrame const*const pLay = nullptr)
: pFormatColl(nullptr)
, pHistory(pHst)
, pSttNd(pStt)
, pEndNd(pEnd)
, pDelSet(pSet)
+ , pLayout(pLay)
, nWhich(0)
, bReset(false) // #i62675#
, bResetListAttrs(false)
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 8b219d2b60b3..e737167c5c1f 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -795,7 +795,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
if (rEntry.IsParaEnd())
{
- pDoc->getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.pAttr, SetAttrMode::DEFAULT, true);
+ pDoc->getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.pAttr, SetAttrMode::DEFAULT, nullptr, true);
}
else
{
More information about the Libreoffice-commits
mailing list