[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 12 09:08:36 UTC 2021
sw/source/filter/inc/fltshell.hxx | 8 --------
sw/source/filter/ww8/ww8par.cxx | 15 +++++++++++++++
sw/source/filter/ww8/ww8par.hxx | 20 +++++++++++++++++++-
sw/source/filter/ww8/ww8par5.cxx | 10 ++++++----
4 files changed, 40 insertions(+), 13 deletions(-)
New commits:
commit ef6caa5de612c3c3f0a4fd9b7a30dfcb618cab29
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Mar 11 17:03:17 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 12 10:07:36 2021 +0100
Revert "merge sw::hack::Position and SwFltPosition"
This reverts commit 4f35958c64d5e63c30e67434936c3a0352f57698.
(which was an attempt at groundwork at fixing ofz#31538)
because ooo46246-1.doc fails to load in crashtesting
Change-Id: I334fc4ff1d1a934d92fe69eae63206c0a480e55e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112359
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index 4019c2c0ff9c..4fb13a48e06c 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -74,14 +74,6 @@ public:
m_nNode = rPos.nNode.GetIndex()-1;
m_nContent = rPos.nContent.GetIndex();
}
-
- SwPosition ToSwPosition() const
- {
- SwNodeIndex m_nCorrectNode(m_nNode, +1);
- SwPosition aRet(m_nCorrectNode);
- aRet.nContent.Assign(m_nCorrectNode.GetNode().GetContentNode(), m_nContent);
- return aRet;
- }
};
// Stack entry for the attributes. It is always pointers to new attributes that are passed.
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b95e5e2795af..66203d696493 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6651,6 +6651,21 @@ bool SwWW8ImplReader::InEqualApo(int nLvl) const
return m_aApos[nLvl];
}
+namespace sw::hack
+{
+ Position::Position(const SwPosition &rPos)
+ : maPtNode(rPos.nNode), mnPtContent(rPos.nContent.GetIndex())
+ {
+ }
+
+ Position::operator SwPosition() const
+ {
+ SwPosition aRet(maPtNode);
+ aRet.nContent.Assign(maPtNode.GetNode().GetContentNode(), mnPtContent);
+ return aRet;
+ }
+}
+
SwMacroInfo::SwMacroInfo()
: SdrObjUserData( SdrInventor::ScOrSwDraw, SW_UD_IMAPDATA )
, mnShapeId(-1)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index bb05228159fd..fcfac3503ad1 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -543,6 +543,21 @@ struct HyperLinksTable
namespace sw
{
+ namespace hack
+ {
+ class Position
+ {
+ private:
+ SwNodeIndex maPtNode;
+ sal_Int32 mnPtContent;
+ public:
+ explicit Position(const SwPosition &rPos);
+ operator SwPosition() const;
+ const SwNodeIndex& GetPtNode() const { return maPtNode; };
+ sal_Int32 GetPtContent() const { return mnPtContent; };
+ };
+ }
+
auto FilterControlChars(OUString const& rString) -> OUString;
}
@@ -555,7 +570,7 @@ class WW8FieldEntry
::sw::mark::IFieldmark::parameter_map_t maParams;
public:
- SwFltPosition maStartPos;
+ sw::hack::Position maStartPos;
sal_uInt16 mnFieldId;
sal_uLong mnObjLocFc;
WW8FieldEntry(SwPosition const &rPos, sal_uInt16 nFieldId) throw();
@@ -563,6 +578,9 @@ class WW8FieldEntry
WW8FieldEntry &operator=(const WW8FieldEntry &rOther) throw();
void Swap(WW8FieldEntry &rOther) throw();
+ SwNodeIndex GetPtNode() const { return maStartPos.GetPtNode(); };
+ sal_Int32 GetPtContent() const { return maStartPos.GetPtContent(); };
+
const OUString& GetBookmarkName() const { return msBookmarkName;}
const OUString& GetBookmarkCode() const { return msMarkCode;}
void SetBookmarkName(const OUString& bookmarkName);
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 202f9a2d629f..88b952099e6a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -220,7 +220,7 @@ tools::Long SwWW8ImplReader::Read_Book(WW8PLCFManResult*)
if (!m_aFieldStack.empty())
{
const WW8FieldEntry &rTest = m_aFieldStack.back();
- aStart = rTest.maStartPos.ToSwPosition();
+ aStart = rTest.maStartPos;
}
const OUString sOrigName = BookmarkToWriter(*pName);
@@ -522,7 +522,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
case ww::eFORMTEXT:
if (bUseEnhFields && m_pPaM!=nullptr && m_pPaM->GetPoint()!=nullptr) {
SwPosition aEndPos = *m_pPaM->GetPoint();
- SwPaM aFieldPam(m_aFieldStack.back().maStartPos.ToSwPosition(), aEndPos);
+ SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), m_aFieldStack.back().GetPtContent(), aEndPos.nNode, aEndPos.nContent.GetIndex());
IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( );
IFieldmark *pFieldmark = pMarksAccess->makeFieldBookmark(
aFieldPam, m_aFieldStack.back().GetBookmarkName(), ODF_FORMTEXT,
@@ -584,7 +584,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
case ww::eMERGEINC:
case ww::eINCLUDETEXT:
//Move outside the section associated with this type of field
- *m_pPaM->GetPoint() = m_aFieldStack.back().maStartPos.ToSwPosition();
+ *m_pPaM->GetPoint() = m_aFieldStack.back().maStartPos;
break;
case ww::eIF: // IF-field
{
@@ -616,7 +616,9 @@ sal_uInt16 SwWW8ImplReader::End_Field()
{
// Unhandled field with stored code
SwPosition aEndPos = *m_pPaM->GetPoint();
- SwPaM aFieldPam(m_aFieldStack.back().maStartPos.ToSwPosition(), aEndPos);
+ SwPaM aFieldPam(
+ m_aFieldStack.back().GetPtNode(), m_aFieldStack.back().GetPtContent(),
+ aEndPos.nNode, aEndPos.nContent.GetIndex());
IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( );
More information about the Libreoffice-commits
mailing list