summaryrefslogtreecommitdiff
path: root/sw/source/filter/basflt
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2021-03-11 08:41:53 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-06-14 10:57:47 +0200
commit343d4d32f00053bd72cfe240125835fe25ce264f (patch)
tree1a97ba687c5715a49b958352c80e4559c5cf56d9 /sw/source/filter/basflt
parent859978445daeb848d033f64736709503ec44a7bb (diff)
tdf#108518 revert OOo hack: Fix issue #i119405: Numbering text style
...changed after importing the *.doc 2012 commit 1c22545edf9085b9f2656ca92781158b6b123db3 This hack has been made irrelevant by layout support for copying paragraph CR formatting to the numbering. It can be improved even more for DOC by supporting RES_PARATR_LIST_AUTOFMT. The OOo guys who made this knew it was a hack. They document in https://bz.apache.org/ooo/show_bug.cgi?id=119405#c11 > Negative Impact: > Although most common user scenarios can be met by the solution, > there are still negative impacts. Because the attributes of > paragraph end mark(0x0D) will be set to the character style > binding to the given level of a number rule, > it will have the global impact. > Other paragraphs that are applied with the same number rule's > level will also be changed. > Generally, MS Word users will have their numbering/bullets > the same attributes/style when using the same level's > of number rule, correspondingly,the impacted scenarios are rarely. So, the bad thing that was happening was that any paragraph's CR formatting could change every instance of the numbering level's formatting - not just that one paragraph's number. The first instance of the defined formatting won. tdf#133410: Also, it spammed a new char style for every numbering level. This patch depends on an earlier commit. The unit test ensures that this earlier commit exists. It was the only example I found where reverting the hack failed. Change-Id: I43b88b8219c9dbc882f57d1a282749d7c0ab2a19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112320 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/filter/basflt')
-rw-r--r--sw/source/filter/basflt/fltshell.cxx79
1 files changed, 5 insertions, 74 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index e81bcec11df4..e90e274f04c4 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -80,9 +80,6 @@ SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, std::unique_ptr<Sf
, m_aPtPos(rStartPos)
, m_pAttr( std::move(pHt) )
, m_isAnnotationOnEnd(false)
- , mnStartCP(-1)
- , mnEndCP(-1)
- , m_bIsParaEnd(false)
{
m_bOld = false; // used for marking Attributes *before* skipping field results
m_bOpen = true; // lock the attribute --> may first
@@ -105,15 +102,12 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos)
}
bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const eCheck,
- const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd,
+ const SwFltPosition &rMkPos, const SwFltPosition &rPtPos,
sal_uInt16 nWhich)
{
// does this range actually contain something?
// empty range is allowed if at start of empty paragraph
// fields are special: never have range, so leave them
-
- // The only position of 0x0D will not be able to make region in the old logic
- // because it is beyond the length of para...need special consideration here.
sal_uLong nMk = rMkPos.m_nNode.GetIndex() + 1;
const SwNodes& rMkNodes = rMkPos.m_nNode.GetNodes();
if (nMk >= rMkNodes.Count())
@@ -123,8 +117,7 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e
((0 != rPtPos.m_nContent) || (pContentNode && (0 != pContentNode->Len())))
&& ( RES_TXTATR_FIELD != nWhich
&& RES_TXTATR_ANNOTATION != nWhich
- && RES_TXTATR_INPUTFIELD != nWhich )
- && !(bIsParaEnd && pContentNode && pContentNode->IsTextNode() && 0 != pContentNode->Len() ))
+ && RES_TXTATR_INPUTFIELD != nWhich ))
{
return false;
}
@@ -168,12 +161,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e
bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode eCheck) const
{
- return MakeRegion(rDoc, rRegion, eCheck, m_aMkPos, m_aPtPos, m_bIsParaEnd,
- m_pAttr->Which());
+ return MakeRegion(rDoc, rRegion, eCheck, m_aMkPos, m_aPtPos, m_pAttr->Which());
}
SwFltControlStack::SwFltControlStack(SwDoc& rDo, sal_uLong nFieldFl)
- : m_nFieldFlags(nFieldFl),m_bHasSdOD(true), m_bSdODChecked(false), m_rDoc(rDo), m_bIsEndStack(false)
+ : m_nFieldFlags(nFieldFl), m_rDoc(rDo), m_bIsEndStack(false)
{
}
@@ -275,7 +267,6 @@ void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr
else
{
SwFltStackEntry *pTmp = new SwFltStackEntry(rPos, std::unique_ptr<SfxPoolItem>(rAttr.Clone()) );
- pTmp->SetStartCP(GetCurrAttrCP());
m_Entries.push_back(std::unique_ptr<SwFltStackEntry>(pTmp));
}
}
@@ -288,14 +279,6 @@ void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt)
auto aElement = m_Entries.begin() + nCnt;
m_Entries.erase(aElement);
}
- //Clear the para end position recorded in reader intermittently for the least impact on loading performance
- //Because the attributes handled based on the unit of para
- if ( empty() )
- {
- ClearParaEndPosition();
- m_bHasSdOD = true;
- m_bSdODChecked = false;
- }
}
// SwFltControlStack::StealAttr() removes attributes of the given type
@@ -395,7 +378,6 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
{
rEntry.m_bConsumedByField = consumedByField;
rEntry.SetEndPos(rPos);
- rEntry.SetEndCP(GetCurrAttrCP());
if (bLastEntry && nAttrId == rEntry.m_pAttr->Which())
{
//potential candidate for merging with an identical
@@ -506,28 +488,6 @@ static bool IterateNumrulePiece( const SwNodeIndex& rEnd,
return rTmpStart <= rTmpEnd; // valid ?
}
-//***This function will check whether there is existing individual attribute position for 0x0D***/
-//The check will happen only once for a paragraph during loading
-bool SwFltControlStack::HasSdOD()
-{
- bool bRet = false;
-
- for (auto const& it : m_Entries)
- {
- SwFltStackEntry& rEntry = *it;
- if ( rEntry.mnStartCP == rEntry.mnEndCP )
- {
- if ( CheckSdOD(rEntry.mnStartCP,rEntry.mnEndCP) )
- {
- bRet = true;
- break;
- }
- }
- }
-
- return bRet;
-}
-
void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
SwFltStackEntry& rEntry)
{
@@ -757,44 +717,15 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
break;
default:
{
- // Revised for more complex situations should be considered
- if ( !m_bSdODChecked )
- {
- m_bHasSdOD = HasSdOD();
- m_bSdODChecked = true;
- }
- sal_Int32 nStart = rEntry.GetStartCP();
- sal_Int32 nEnd = rEntry.GetEndCP();
- if (nStart != -1 && nEnd != -1 && nEnd >= nStart )
- {
- rEntry.SetIsParaEnd( IsParaEndInCPs(nStart,nEnd,m_bHasSdOD) );
- }
if (rEntry.MakeRegion(m_rDoc, aRegion, SwFltStackEntry::RegionMode::NoCheck))
{
- if (rEntry.IsParaEnd())
- {
- m_rDoc.getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.m_pAttr, SetAttrMode::DEFAULT, nullptr, true);
- }
- else
- {
- m_rDoc.getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.m_pAttr);
- }
+ m_rDoc.getIDocumentContentOperations().InsertPoolItem(aRegion, *rEntry.m_pAttr);
}
}
break;
}
}
-bool SwFltControlStack::IsParaEndInCPs(sal_Int32 /*nStart*/, sal_Int32 /*nEnd*/,bool /*bSdOD*/) const
-{
- return false;
-}
-
-bool SwFltControlStack::CheckSdOD(sal_Int32 /*nStart*/, sal_Int32 /*nEnd*/)
-{
- return false;
-}
-
SfxPoolItem* SwFltControlStack::GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos)
{
size_t nSize = m_Entries.size();