summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xmloff/txtimp.hxx4
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx44
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.hxx3
-rw-r--r--sw/source/filter/xml/xmltexti.cxx13
-rw-r--r--sw/source/filter/xml/xmltexti.hxx3
-rw-r--r--xmloff/source/text/txtimp.cxx8
-rw-r--r--xmloff/source/text/txtparai.cxx5
-rw-r--r--xmloff/source/text/txtparai.hxx3
8 files changed, 75 insertions, 8 deletions
diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 01045d048463..01b3f0a146be 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -678,7 +678,9 @@ public:
virtual bool CheckRedlineExists(
/// ID used to RedlineAdd() call
- const OUString& rId);
+ const OUString& rStartParaPos);
+
+ virtual void InsertRedlinesWithinParagraph(const OUString& rStartParaPos, bool bStart, bool bIsOutsideOfParagraph);
virtual void RedlineSetCursor(
/// ID used to RedlineAdd() call
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 686d606a6bc1..0767c5014e73 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -503,6 +503,50 @@ bool XMLRedlineImportHelper::Check(
return false;
}
+void XMLRedlineImportHelper::InsertWithinParagraph(const OUString& rParaPos, bool bStart,
+ Reference<XTextRange> & rRange, bool bIsOutsideOfParagraph)
+{
+ ::std::map<OUString, RedlineInfo*>::iterator aFind = aRedlineMap[rParaPos].begin();
+ for( ; aRedlineMap[rParaPos].end() != aFind; ++aFind )
+ {
+ // RedlineInfo found; now set Cursor
+ RedlineInfo* pInfo = aFind->second;
+ if (bIsOutsideOfParagraph)
+ {
+ // outside of paragraph: remember SwNodeIndex
+ if (bStart)
+ {
+ pInfo->aAnchorStart.SetAsNodeIndex(rRange);
+ }
+ else
+ {
+ pInfo->aAnchorEnd.SetAsNodeIndex(rRange);
+ }
+
+ // also remember that we expect an adjustment for this redline
+ pInfo->bNeedsAdjustment = true;
+ }
+ else
+ {
+ // inside of a paragraph: use regular XTextRanges (bookmarks)
+ if (bStart)
+ pInfo->aAnchorStart.Set(rRange);
+ else
+ pInfo->aAnchorEnd.Set(rRange);
+ }
+
+ // if this Cursor was the last missing info, we insert the
+ // node into the document
+ // then we can remove the entry from the map and destroy the object
+ if (IsReady(pInfo))
+ {
+ InsertIntoDocument(pInfo);
+ delete pInfo;
+ }
+ }
+ aRedlineMap[rParaPos].clear();
+}
+
void XMLRedlineImportHelper::SetCursor(
const OUString& rParaPos,
const OUString& rTextPos,
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.hxx b/sw/source/filter/xml/XMLRedlineImportHelper.hxx
index af3f6c965005..adb5695df9ad 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.hxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.hxx
@@ -86,6 +86,9 @@ public:
bool Check(
const OUString& rParaPos);
+ void InsertWithinParagraph(const OUString& rParaPos, bool bStart,
+ css::uno::Reference<css::text::XTextRange> & rRange, bool bIsOusideOfParagraph);
+
// Set start or end position for a redline in the text body.
// Accepts XTextRange objects.
void SetCursor(
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index 1c4b2c4701ea..05c1cb6a8720 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -1001,14 +1001,23 @@ uno::Reference<XTextCursor> SwXMLTextImportHelper::RedlineCreateText(
}
bool SwXMLTextImportHelper::CheckRedlineExists(
- const OUString& rId)
+ const OUString& rStartParaPos)
{
if(pRedlineHelper != nullptr)
- return pRedlineHelper->Check(rId);
+ return pRedlineHelper->Check(rStartParaPos);
return false;
// else: ignore redline (wasn't added before, else we'd have a helper)
}
+void SwXMLTextImportHelper::InsertRedlinesWithinParagraph(const OUString& rStartParaPos, bool bStart, bool bIsOutsideOfParagraph)
+{
+ if(pRedlineHelper != nullptr)
+ {
+ uno::Reference<XTextRange> xTextRange( GetCursor()->getStart() );
+ pRedlineHelper->InsertWithinParagraph(rStartParaPos, bStart, xTextRange, bIsOutsideOfParagraph);
+ }
+}
+
void SwXMLTextImportHelper::RedlineSetCursor(
const OUString& rParaPos,
const OUString& rTextPos,
diff --git a/sw/source/filter/xml/xmltexti.hxx b/sw/source/filter/xml/xmltexti.hxx
index 4b0980521222..79dae30ea328 100644
--- a/sw/source/filter/xml/xmltexti.hxx
+++ b/sw/source/filter/xml/xmltexti.hxx
@@ -97,7 +97,8 @@ public:
css::uno::Reference<css::text::XTextCursor> & rOldCursor, /// needed to get the document
const OUString& rParPos, const OUString& rTextPos) override; /// ID used to RedlineAdd() call
virtual bool CheckRedlineExists(
- const OUString& rId) override; /// ID used to RedlineAdd() call
+ const OUString& rStartParaPos) override; /// ID used to RedlineAdd() call
+ virtual void InsertRedlinesWithinParagraph(const OUString& rStartParaPos, bool bStart, bool bIsOutsideOfParagraph) override;
virtual void RedlineSetCursor(
const OUString& rStartParaPos,
const OUString& rStartTextPos,
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index e97901da7ba3..1e7c58e7c953 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2161,7 +2161,7 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext(
}
pContext = new XMLParaContext( rImport,
nPrefix, rLocalName,
- xAttrList, bHeading, bInsertRedline );
+ xAttrList, bHeading, bInsertRedline, sParaIdx );
if (m_xImpl->m_bProgress && XML_TEXT_TYPE_SHAPE != eType)
{
rImport.GetProgressBarHelper()->Increment();
@@ -2758,11 +2758,15 @@ Reference<XTextCursor> XMLTextImportHelper::RedlineCreateText(
}
bool XMLTextImportHelper::CheckRedlineExists(
- const OUString& /*rId*/)
+ const OUString& /*rStartParaPos*/)
{
return true;
}
+void XMLTextImportHelper::InsertRedlinesWithinParagraph(const OUString& /*rStartParaPos*/, bool /*bStart*/, bool /*bIsOutsideOfParagraph*/)
+{
+}
+
void XMLTextImportHelper::RedlineSetCursor(
const OUString& /*rParaPos*/,
const OUString& /*rTextPos*/,
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 86c5736a9071..f3c3c5800d03 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1820,7 +1820,8 @@ XMLParaContext::XMLParaContext(
const OUString& rLName,
const Reference< xml::sax::XAttributeList > & xAttrList,
bool bHead,
- bool bInsertRedln) :
+ bool bInsertRedln,
+ const OUString& rStartParaPos) :
SvXMLImportContext( rImport, nPrfx, rLName ),
xStart( rImport.GetTextImport()->GetCursorAsRange()->getStart() ),
m_bHaveAbout(false),
@@ -1831,6 +1832,7 @@ XMLParaContext::XMLParaContext(
bIgnoreLeadingSpace( true ),
bHeading( bHead ),
bInsertRedline( bInsertRedln ),
+ sStartParaPos(rStartParaPos),
bIsListHeader( false ),
bIsRestart (false),
nStartValue(0),
@@ -2232,6 +2234,7 @@ void XMLParaContext::Characters( const OUString& rChars )
if(bInsertRedline)
{
GetImport().GetTextImport()->InsertString( sChars, bIgnoreLeadingSpace );
+ GetImport().GetTextImport()->InsertRedlinesWithinParagraph(sStartParaPos, true, false);
}
else
GetImport().GetTextImport()->InsertString( sChars, bIgnoreLeadingSpace );
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 812480613518..e6fd5dcd4f7a 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -50,6 +50,7 @@ class XMLParaContext : public SvXMLImportContext
bool bIgnoreLeadingSpace;
bool bHeading;
bool bInsertRedline;
+ OUString sStartParaPos;
bool bIsListHeader;
bool bIsRestart;
sal_Int16 nStartValue;
@@ -63,7 +64,7 @@ public:
const OUString& rLName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
bool bHeading,
- bool bInsertRedln = false );
+ bool bInsertRedln = false, const OUString& rStartParaPos = OUString() );
virtual ~XMLParaContext();