summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-03-02 20:31:48 +0100
committerMichael Stahl <mstahl@redhat.com>2018-03-05 10:17:32 +0100
commit2ebda414bfc5b4961ddb41e5512de215476a31a2 (patch)
tree13e02748f82d9a892be1bf5da907bbd9556dece8
parentbab7cef648025038055d3284773d33f102d42f13 (diff)
Resolves: tdf#114675 return new EditPaM of insert position from SvxReadXML()
Change-Id: I77027d74a0addaafaf19e2c2a8e9759d560951eb (cherry picked from commit a44e62b82c7598471da9a5254953067613806337) Reviewed-on: https://gerrit.libreoffice.org/50646 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--editeng/inc/editxml.hxx3
-rw-r--r--editeng/source/editeng/impedit4.cxx4
-rw-r--r--editeng/source/xml/xmltxtimp.cxx11
3 files changed, 12 insertions, 6 deletions
diff --git a/editeng/inc/editxml.hxx b/editeng/inc/editxml.hxx
index 6e3a3de26a47..a3918e1c5397 100644
--- a/editeng/inc/editxml.hxx
+++ b/editeng/inc/editxml.hxx
@@ -23,12 +23,13 @@
class EditEngine;
class SvStream;
struct ESelection;
+class EditPaM;
/** this function exports the selected content of an edit engine into a xml stream*/
extern void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );
/** this function imports xml from the stream into the selected of an edit engine */
-extern void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );
+extern EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel );
#endif
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 4b09582b99d1..71895e9945e3 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -135,9 +135,7 @@ EditPaM ImpEditEngine::ReadXML( SvStream& rInput, EditSelection aSel )
ESelection aESel = CreateESel( aSel );
- ::SvxReadXML( *GetEditEnginePtr(), rInput, aESel );
-
- return aSel.Max();
+ return ::SvxReadXML( *GetEditEnginePtr(), rInput, aESel );
}
EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel )
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
index 91c61b1f5a8c..0e55bb3b12c2 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -136,7 +136,7 @@ SvxXMLXTextImportComponent::SvxXMLXTextImportComponent(
SvXMLImport::setTargetDocument(new SvxSimpleUnoModel);
}
-void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel )
+EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel )
{
SvxEditEngineSource aEditSource( &rEditEngine );
@@ -157,6 +157,9 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r
rEditEngine.InsertParaBreak( rEditEngine.CreateSelection( rSel ).Max() );
rEditEngine.InsertParaBreak( rEditEngine.CreateSelection( rSel ).Max() );
+ // Init return PaM.
+ EditPaM aPaM( rEditEngine.CreateSelection( rSel ).Max());
+
ESelection aSel(rSel.nStartPara+1, 0, rSel.nEndPara+1, 0);
uno::Reference<text::XText > xParent;
SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
@@ -225,12 +228,16 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r
rEditEngine.ParaAttribsToCharAttribs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ) );
rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ),
pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara -1 ), true );
- rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ),
+
+ // The final join is to be returned.
+ aPaM = rEditEngine.ConnectParagraphs( pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara - 2 ),
pDoc.GetObject( pDoc.Count() - initialParaCount + aSel.nEndPara -1 ), true );
}
catch( const uno::Exception& )
{
}
+
+ return aPaM;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */