diff options
-rw-r--r-- | sw/inc/IDocumentContentOperations.hxx | 1 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc | bin | 0 -> 63488 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 52 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentContentOperationsManager.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 61 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 79 | ||||
-rw-r--r-- | sw/source/filter/inc/fltshell.hxx | 23 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 60 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 15 |
13 files changed, 16 insertions, 299 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index 7b6960e1c074..1598c827cfcf 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -230,7 +230,6 @@ public: virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, const SetAttrMode nFlags = SetAttrMode::DEFAULT, SwRootFrame const* pLayout = nullptr, - bool bExpandCharToPara = false, SwTextAttr **ppNewTextAttr = nullptr) = 0; virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&, diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 9b7de4e89cb7..ad6a3c4ac27e 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -203,7 +203,6 @@ public: std::unique_ptr<SwWrongList> ReleaseSmartTags(); SwWrongList* GetSmartTags(); SwWrongList const* GetSmartTags() const; - void TryCharSetExpandToNum(const SfxItemSet& pCharSet); /// End: Data collected during idle time diff --git a/sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc b/sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc Binary files differnew file mode 100644 index 000000000000..536e92fd4729 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index ffdf64cf5f1c..2b87f12974ca 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -581,6 +581,13 @@ DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(defaultStyle, "TopMargin")); } +DECLARE_WW8EXPORT_TEST(testTdf108518_CRnumformatting, "tdf108518_CRnumformatting.doc") +{ + CPPUNIT_ASSERT_EQUAL(OUString("6.2.3."), parseDump("//body/txt[4]/Special[@nType='PortionType::Number']", "rText")); + //Without this fix in place, it would become 200 (and non-bold). + CPPUNIT_ASSERT_EQUAL(OUString("220"), parseDump("//body/txt[4]/Special[@nType='PortionType::Number']", "nHeight")); +} + DECLARE_WW8EXPORT_TEST(testTdf120711_joinedParagraphWithChangeTracking, "tdf120711.doc") { sal_Int16 numFormat = getNumberingTypeOfParagraph(5); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 2f1818a64a15..02a336e8a0e6 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1220,7 +1220,6 @@ namespace //local functions originally from docfmt.cxx const SetAttrMode nFlags, SwUndoAttr *const pUndo, SwRootFrame const*const pLayout, - const bool bExpandCharToPara, SwTextAttr **ppNewTextAttr) { // Divide the Sets (for selections in Nodes) @@ -1684,24 +1683,6 @@ namespace //local functions originally from docfmt.cxx // Only selection in a Node. if( pStt->nNode == pEnd->nNode ) { - //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 - //binary file, and the setting range include a paragraph end position (0X0D); - //more specifications, as such property inside the character range properties set recorded in - //MS Word binary file are dealt and inserted into data model (SwDoc) one by one, so we - //only dealing the scenario that the char properties set with 1 item inside; - - if (bExpandCharToPara && pCharSet && pCharSet->Count() ==1 ) - { - SwTextNode* pCurrentNd = pStt->nNode.GetNode().GetTextNode(); - - if (pCurrentNd) - { - pCurrentNd->TryCharSetExpandToNum(*pCharSet); - - } - } DELETECHARSETS return bRet; } @@ -1816,33 +1797,6 @@ namespace //local functions originally from docfmt.cxx } } - //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 - //binary file, and the setting range include a paragraph end position (0X0D); - //more specifications, as such property inside the character range properties set recorded in - //MS Word binary file are dealt and inserted into data model (SwDoc) one by one, so we - //only dealing the scenario that the char properties set with 1 item inside; - if (bExpandCharToPara && pCharSet && pCharSet->Count() ==1) - { - SwPosition aStartPos (*rRg.Start()); - SwPosition aEndPos (*rRg.End()); - - if (aEndPos.nNode.GetNode().GetTextNode() && aEndPos.nContent != aEndPos.nNode.GetNode().GetTextNode()->Len()) - aEndPos.nNode--; - - sal_uLong nStart = aStartPos.nNode.GetIndex(); - sal_uLong nEnd = aEndPos.nNode.GetIndex(); - for(; nStart <= nEnd; ++nStart) - { - SwNode* pNd = rDoc.GetNodes()[ nStart ]; - if (!pNd || !pNd->IsTextNode()) - continue; - SwTextNode *pCurrentNd = pNd->GetTextNode(); - pCurrentNd->TryCharSetExpandToNum(*pCharSet); - } - } - DELETECHARSETS return (nNodes != 0) || bRet; } @@ -3374,13 +3328,11 @@ bool DocumentContentOperationsManager::ReplaceRange( SwPaM& rPam, const OUString return bRet; } -///Add a para for the char attribute exp... bool DocumentContentOperationsManager::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, const SetAttrMode nFlags, SwRootFrame const*const pLayout, - const bool bExpandCharToPara, SwTextAttr **ppNewTextAttr) { if (utl::ConfigManager::IsFuzzing()) @@ -3396,7 +3348,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(), pLayout, bExpandCharToPara, ppNewTextAttr); + const bool bRet = lcl_InsAttr(m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), pLayout, ppNewTextAttr); if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { @@ -3421,7 +3373,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(), pLayout, /*bExpandCharToPara*/false, /*ppNewTextAttr*/nullptr ); + bool bRet = lcl_InsAttr(m_rDoc, rRg, rSet, nFlags, pUndoAttr.get(), pLayout, /*ppNewTextAttr*/nullptr ); if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index cc030690e1da..b3cabeb85dab 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -89,7 +89,6 @@ public: bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, const SetAttrMode nFlags = SetAttrMode::DEFAULT, SwRootFrame const* pLayout = nullptr, - bool bExpandCharToPara = false, SwTextAttr **ppNewTextAttr = nullptr) override; void InsertItemSet (const SwPaM &rRg, const SfxItemSet&, diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index bc49210e14f0..acf8ba4b9eeb 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1821,67 +1821,6 @@ bool SwTextNode::IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich, bool b || nWhich == RES_CHRATR_ESCAPEMENT); } -//In MS Word, following properties of the paragraph end position won't affect the formatting of bullets, so we ignore them: -//Font underline; -//Font Italic of Western, CJK and CTL; -//Font Bold of Wertern, CJK and CTL; -static bool lcl_IsIgnoredCharFormatForBullets(const sal_uInt16 nWhich) -{ - return (nWhich == RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_POSTURE || nWhich == RES_CHRATR_WEIGHT - || nWhich == RES_CHRATR_CJK_POSTURE || nWhich == RES_CHRATR_CJK_WEIGHT - || nWhich == RES_CHRATR_CTL_POSTURE || nWhich == RES_CHRATR_CTL_WEIGHT); -} - -//Condition for expanding char set to character style of specified number rule level: -//The item inside the set should not conflict to any exist and non-default item inside paragraph properties set (SwContentNode::SwPAttrSet); -//The node should have applied a number rule; -//The node should be counted in a list, if not, make it to be; -//The item should not conflict to any exist and non-default item inside the character of specified number rule level; -//The item should not be ignored depend on the exact number rule type; -void SwTextNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet) -{ - SfxItemIter aIter( aCharSet ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - if (!pItem) - return; - const sal_uInt16 nWhich = pItem->Which(); - - const SfxPoolItem& rInnerItem = GetAttr(nWhich,false); - - if (!IsDefaultItem(&rInnerItem) && !IsInvalidItem(&rInnerItem)) - return; - - if (!IsInList() && GetNumRule() && !GetListId().isEmpty()) - { - return; - } - - SwNumRule* pCurrNum = GetNumRule(false); - - int nLevel = GetActualListLevel(); - - if (!(nLevel != -1 && pCurrNum)) - return; - - const SwNumFormat* pCurrNumFormat = pCurrNum->GetNumFormat(o3tl::narrowing<sal_uInt16>(nLevel)); - if (!pCurrNumFormat) - return; - - if (pCurrNumFormat->IsItemize() && lcl_IsIgnoredCharFormatForBullets(nWhich)) - return; - if (pCurrNumFormat->IsEnumeration() && SwTextNode::IsIgnoredCharFormatForNumbering(nWhich)) - return; - SwCharFormat* pCurrCharFormat =pCurrNumFormat->GetCharFormat(); - - if (pCurrCharFormat && pCurrCharFormat->GetItemState(nWhich,false) != SfxItemState::SET) - { - pCurrCharFormat->SetFormatAttr(*pItem); - SwNumFormat aNewNumFormat(*pCurrNumFormat); - aNewNumFormat.SetCharFormat(pCurrCharFormat); - pCurrNum->Set(nLevel,aNewNumFormat); - } -} - // Set these attributes on SwTextNode. If they apply to the entire paragraph // text, set them in the SwTextNode's item set (SwContentNode::SetAttr). bool SwTextNode::SetAttr( diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 418dfce96797..d15dbc6cd0c1 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -1924,7 +1924,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark( // pNewTextAttr comes back with the real format SwTextAttr *pNewTextAttr = nullptr; rDoc.getIDocumentContentOperations().InsertPoolItem(rPam, rMark, nInsertFlags, - /*pLayout*/nullptr, /*bExpandCharToPara*/false, &pNewTextAttr); + /*pLayout*/nullptr, &pNewTextAttr); if (bMark && *rPam.GetPoint() > *rPam.GetMark()) { rPam.Exchange(); 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(); diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index d83349558b67..9f7ccd3ac2fd 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -94,10 +94,6 @@ public: bool m_bConsumedByField; bool m_isAnnotationOnEnd; ///< annotation already moved onto its end pos. - sal_Int32 mnStartCP; - sal_Int32 mnEndCP; - bool m_bIsParaEnd; - SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, std::unique_ptr<SfxPoolItem> pHt ); SW_DLLPUBLIC ~SwFltStackEntry(); @@ -105,15 +101,8 @@ public: SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos); SW_DLLPUBLIC bool MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode eCheck) const; SW_DLLPUBLIC static bool MakeRegion(SwDoc& rDoc, SwPaM& rRegion, - RegionMode eCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd=false, + RegionMode eCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, sal_uInt16 nWhich=0); - - void SetStartCP(sal_Int32 nCP) {mnStartCP = nCP;} - void SetEndCP(sal_Int32 nCP) {mnEndCP = nCP;} - sal_Int32 GetStartCP() const {return mnStartCP;} - sal_Int32 GetEndCP() const {return mnEndCP;} - bool IsParaEnd() const { return m_bIsParaEnd;} - void SetIsParaEnd(bool bArg){ m_bIsParaEnd = bArg;} }; template<> struct o3tl::typed_flags<SwFltStackEntry::RegionMode>: o3tl::is_typed_flags<SwFltStackEntry::RegionMode, 0x03> {}; @@ -129,21 +118,11 @@ private: sal_uLong m_nFieldFlags; - bool m_bHasSdOD; - bool m_bSdODChecked; - protected: SwDoc& m_rDoc; bool m_bIsEndStack; virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry); - virtual sal_Int32 GetCurrAttrCP() const {return -1;} - virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD) const; - - //Clear the para end position recorded in reader intermittently for the least impact on loading performance - virtual void ClearParaEndPosition(){}; - virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd); - bool HasSdOD(); public: enum class MoveAttrsMode { DEFAULT, POSTIT_INSERTED }; 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 |