xmloff/source/draw/ximpshap.cxx |   13 ++++++++++++-
 xmloff/source/draw/ximpshap.hxx |    2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit bafec47847a0b9697b3bbe9358e53f8118af3024
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Apr 17 16:53:44 2023 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Apr 18 21:53:35 2023 +0200

    create the FloatingFrameShape in a separate step to inserting it
    
    this is derived from the path taken by the AddShape(const OUString&)
    function for this case. No change in behavior is intended.
    
    Change-Id: Id09ae0c65a55a37743ad7c184070fb8dd97d8a7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150526
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 5b671ab1caf4..552414b06c9a 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3133,10 +3133,21 @@ 
SdXMLFloatingFrameShapeContext::~SdXMLFloatingFrameShapeContext()
 {
 }
 
+uno::Reference<drawing::XShape> 
SdXMLFloatingFrameShapeContext::CreateFloatingFrameShape() const
+{
+    uno::Reference<lang::XMultiServiceFactory> 
xServiceFact(GetImport().GetModel(), uno::UNO_QUERY);
+    if (!xServiceFact.is())
+        return nullptr;
+    uno::Reference<drawing::XShape> xShape(
+            xServiceFact->createInstance("com.sun.star.drawing.FrameShape"), 
uno::UNO_QUERY);
+    return xShape;
+}
+
 void SdXMLFloatingFrameShapeContext::startFastElement (sal_Int32 /*nElement*/,
     const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
/*xAttrList*/)
 {
-    AddShape("com.sun.star.drawing.FrameShape");
+    uno::Reference<drawing::XShape> 
xShape(SdXMLFloatingFrameShapeContext::CreateFloatingFrameShape());
+    AddShape(xShape);
 
     if( !mxShape.is() )
         return;
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index 217c773c9785..64b28df579a0 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -528,6 +528,8 @@ private:
     OUString maFrameName;
     OUString maHref;
 
+    css::uno::Reference<css::drawing::XShape> CreateFloatingFrameShape() const;
+
 public:
 
     SdXMLFloatingFrameShapeContext( SvXMLImport& rImport,

Reply via email to