summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
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/ww8
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/ww8')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx60
-rw-r--r--sw/source/filter/ww8/ww8par.hxx13
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx15
3 files changed, 0 insertions, 88 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 7f5b8d543875..93b2027b30bf 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1306,33 +1306,6 @@ const SwNumFormat* SwWW8FltControlStack::GetNumFormatFromStack(const SwPosition
return pRet;
}
-sal_Int32 SwWW8FltControlStack::GetCurrAttrCP() const
-{
- return rReader.GetCurrAttrCP();
-}
-
-bool SwWW8FltControlStack::IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD) const
-{
- return rReader.IsParaEndInCPs(nStart,nEnd,bSdOD);
-}
-
-/**
- * Clear the para end position recorded in reader intermittently
- * for the least impact on loading performance.
- */
-void SwWW8FltControlStack::ClearParaEndPosition()
-{
- if ( !empty() )
- return;
-
- rReader.ClearParaEndPosition();
-}
-
-bool SwWW8FltControlStack::CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd)
-{
- return rReader.IsParaEndInCPs(nStart,nEnd);
-}
-
void SwWW8ReferencedFltEndStack::SetAttrInDoc( const SwPosition& rTmpPos,
SwFltStackEntry& rEntry )
{
@@ -3974,31 +3947,6 @@ tools::Long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, tools::Long nTextEnd
return nNext;
}
-//Revised 2012.8.16 for the complex attribute presentation of 0x0D in MS
-bool SwWW8ImplReader::IsParaEndInCPs(sal_Int32 nStart, sal_Int32 nEnd,bool bSdOD) const
-{
- //Revised for performance consideration
- if (nStart == -1 || nEnd == -1 || nEnd < nStart )
- return false;
-
- return std::any_of(m_aEndParaPos.rbegin(), m_aEndParaPos.rend(),
- [=](const WW8_CP& rPos) {
- //Revised 2012.8.16,to the 0x0D,the attribute will have two situations
- //*********within***********exact******
- //*********but also sample with only left and the position of 0x0d is the edge of the right side***********
- return (bSdOD && ((nStart < rPos && nEnd > rPos) || (nStart == nEnd && rPos == nStart))) ||
- (!bSdOD && (nStart < rPos && nEnd >= rPos));
- }
- );
-}
-
-//Clear the para end position recorded in reader intermittently for the least impact on loading performance
-void SwWW8ImplReader::ClearParaEndPosition()
-{
- if ( !m_aEndParaPos.empty() )
- m_aEndParaPos.clear();
-}
-
void SwWW8ImplReader::ReadAttrs(WW8_CP& rTextPos, WW8_CP& rNext, tools::Long nTextEnd, bool& rbStartLine)
{
// Do we have attributes?
@@ -4006,7 +3954,6 @@ void SwWW8ImplReader::ReadAttrs(WW8_CP& rTextPos, WW8_CP& rNext, tools::Long nTe
{
do
{
- m_aCurrAttrCP = rTextPos;
rNext = ReadTextAttr(rTextPos, nTextEnd, rbStartLine);
if (rTextPos == rNext && rTextPos >= nTextEnd)
break;
@@ -4119,9 +4066,6 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
}
if (bSplit)
{
- // We will record the CP of a paragraph end ('0x0D'), if current loading contents is from main stream;
- if (m_bOnLoadingMain)
- m_aEndParaPos.push_back(l-1);
AppendTextNode(*m_pPaM->GetPoint());
}
}
@@ -4361,8 +4305,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
, m_bCareFirstParaEndInToc(false)
, m_bCareLastParaEndInToc(false)
, m_aTOXEndCps()
- , m_aCurrAttrCP(-1)
- , m_bOnLoadingMain(false)
, m_bNotifyMacroEventRead(false)
{
m_pStrm->SetEndian( SvStreamEndian::LITTLE );
@@ -5274,9 +5216,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
StoreMacroCmds();
}
- m_bOnLoadingMain = true;
ReadText(0, m_xWwFib->m_ccpText, MAN_MAINTEXT);
- m_bOnLoadingMain = false;
}
m_xProgress->Update(m_nProgress); // Update
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index d2ad5f67b6c7..430ae7d10a9a 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -376,12 +376,6 @@ protected:
virtual void SetAttrInDoc(const SwPosition& rTmpPos,
SwFltStackEntry& rEntry) override;
- virtual sal_Int32 GetCurrAttrCP() const override;
- virtual bool IsParaEndInCPs(sal_Int32 nStart, sal_Int32 nEnd, bool bSdOD) const override;
- //Clear the para end position recorded in reader intermittently for the least impact on loading performance
- virtual void ClearParaEndPosition() override;
- virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd) override;
-
public:
SwWW8FltControlStack(SwDoc& rDo, sal_uLong nFieldFl, SwWW8ImplReader& rReader_ )
: SwFltControlStack( rDo, nFieldFl ), rReader( rReader_ ),
@@ -1382,9 +1376,6 @@ private:
bool m_bCareLastParaEndInToc;
cp_set m_aTOXEndCps;
- std::vector<WW8_CP> m_aEndParaPos;
- WW8_CP m_aCurrAttrCP;
- bool m_bOnLoadingMain:1;
bool m_bNotifyMacroEventRead:1;
const SprmReadInfo& GetSprmReadInfo(sal_uInt16 nId) const;
@@ -1707,10 +1698,6 @@ public: // really private, but can only be done public
sal_uInt16 GetToggleBiDiAttrFlags() const;
void SetToggleAttrFlags(sal_uInt16 nFlags);
void SetToggleBiDiAttrFlags(sal_uInt16 nFlags);
- WW8_CP GetCurrAttrCP() const {return m_aCurrAttrCP;}
- bool IsParaEndInCPs(sal_Int32 , sal_Int32,bool bSdOD=true) const;
- //Clear the para end position recorded in reader intermittently for the least impact on loading performance
- void ClearParaEndPosition();
tools::Long Read_Footnote(WW8PLCFManResult* pRes);
sal_uInt16 End_Footnote();
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 02dd2f139d0b..a5f363e9bbf2 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1039,21 +1039,6 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
aNumFormat.SetCharFormat( pFormat );
}
- //Ensure the default char fmt is initialized for any level of num ruler if no customized attr
- else
- {
- SwCharFormat* pFormat = aNumFormat.GetCharFormat();
- if ( !pFormat)
- {
- const OUString aName( (!sPrefix.isEmpty() ? sPrefix : rNumRule.GetName())
- + "z" + OUString::number( nLevel ) );
-
- pFormat = rDoc.MakeCharFormat(aName, rDoc.GetDfltCharFormat());
- bNewCharFormatCreated = true;
- rCharFormat[ nLevel ] = pFormat;
- aNumFormat.SetCharFormat( pFormat );
- }
- }
// if necessary: Append Bullet Font to NumFormat