editeng/inc/editxml.hxx             |    3 ++-
 editeng/source/editeng/impedit4.cxx |    4 +---
 editeng/source/xml/xmltxtimp.cxx    |   11 +++++++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit a44e62b82c7598471da9a5254953067613806337
Author: Eike Rathke <er...@redhat.com>
Date:   Fri Mar 2 20:31:48 2018 +0100

    Resolves: tdf#114675 return new EditPaM of insert position from SvxReadXML()
    
    Change-Id: I77027d74a0addaafaf19e2c2a8e9759d560951eb

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 81f329cf999d..38d627b2142c 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 7fad6fa1419d..fa7e84546609 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -138,7 +138,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 );
 
@@ -159,6 +159,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 );
@@ -227,12 +230,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: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to