[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - editeng/inc editeng/source
Eike Rathke
erack at redhat.com
Mon Mar 5 09:17:56 UTC 2018
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 2ebda414bfc5b4961ddb41e5512de215476a31a2
Author: Eike Rathke <erack at 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
(cherry picked from commit a44e62b82c7598471da9a5254953067613806337)
Reviewed-on: https://gerrit.libreoffice.org/50646
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
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: */
More information about the Libreoffice-commits
mailing list