[Libreoffice-commits] core.git: xmloff/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Jun 2 09:27:47 PDT 2014


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

New commits:
commit c7c14abfd870d3849e74d379057503f16728a392
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 2 15:59:08 2014 +0200

    xmloff: fix import of tables inside textboxes inside shapes
    
    We already had the concept of having a XML_TEXT_TYPE_SHAPE type (for
    editeng-based text) and a XML_TEXT_TYPE_TEXTBOX (for Writer-based text),
    but in case of draw:custom-shape, the previous was always assumed,
    implicitly.
    
    Check if the shape is marked as having a textbox, and if so, use the
    XML_TEXT_TYPE_TEXTBOX handler, which makes e.g. the table import work.
    
    Change-Id: I45f28b36df1836eeba89e9eef44c7abd87fcbd56

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 3e34f2e..9a17bd2 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -158,6 +158,7 @@ SdXMLShapeContext::SdXMLShapeContext(
     , mbVisible(true)
     , mbPrintable(true)
     , mbHaveXmlId(false)
+    , mbTextBox(false)
 {
 }
 
@@ -220,6 +221,15 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
                 if( mxCursor.is() )
                 {
                     xTxtImport->SetCursor( mxCursor );
+
+                    // Check if this shape has a TextBox, so we can pass the right context type.
+                    uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
+                    if (xPropertySet.is())
+                    {
+                        uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
+                        if (xPropertySetInfo->hasPropertyByName("TextBox"))
+                            xPropertySet->getPropertyValue("TextBox") >>= mbTextBox;
+                    }
                 }
 
                 // remember old list item and block (#91964#) and reset them
@@ -233,7 +243,8 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
         if( mxCursor.is() )
         {
             pContext = GetImport().GetTextImport()->CreateTextChildContext(
-                GetImport(), p_nPrefix, rLocalName, xAttrList );
+                GetImport(), p_nPrefix, rLocalName, xAttrList,
+                ( mbTextBox ? XML_TEXT_TYPE_TEXTBOX : XML_TEXT_TYPE_SHAPE ) );
         }
     }
 
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index f3d4f90..4f987af 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -81,6 +81,7 @@ protected:
     bool                        mbVisible;
     bool                        mbPrintable;
     bool mbHaveXmlId;
+    bool mbTextBox; ///< If the text of this shape is handled by a Writer TextFrame.
 
     /** if bSupportsStyle is false, auto styles will be set but not a style */
     void SetStyle( bool bSupportsStyle = true );


More information about the Libreoffice-commits mailing list