diff options
author | Eike Rathke <erack@redhat.com> | 2018-03-02 20:31:48 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-03-02 20:32:41 +0100 |
commit | a44e62b82c7598471da9a5254953067613806337 (patch) | |
tree | 485fa00a7b61623cf738c8b92ad9bde1964358e3 /editeng | |
parent | ce4fc2fc08be8ea2773194e303ed42d2579e93a0 (diff) |
Resolves: tdf#114675 return new EditPaM of insert position from SvxReadXML()
Change-Id: I77027d74a0addaafaf19e2c2a8e9759d560951eb
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editxml.hxx | 3 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 4 | ||||
-rw-r--r-- | editeng/source/xml/xmltxtimp.cxx | 11 |
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 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: */ |