[ooo-build-commit] .: 2 commits - filter/inc filter/source oox/inc oox/source writerfilter/inc writerfilter/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Oct 6 14:41:36 PDT 2010


 filter/inc/filter/msfilter/msdffimp.hxx               |    8 +
 filter/source/msfilter/msdffimp.cxx                   |   36 ++++++-
 oox/inc/oox/helper/helper.hxx                         |    4 
 oox/inc/oox/vml/vmlshape.hxx                          |    2 
 oox/inc/oox/vml/vmlshapecontainer.hxx                 |    2 
 oox/inc/oox/vml/vmlshapecontext.hxx                   |   17 +++
 oox/source/shape/ShapeContextHandler.cxx              |    3 
 oox/source/vml/vmldrawingfragment.cxx                 |    2 
 oox/source/vml/vmlshape.cxx                           |   83 ++++++++++++++++--
 oox/source/vml/vmlshapecontext.cxx                    |   23 ++++
 writerfilter/inc/ooxml/OOXMLDocument.hxx              |    3 
 writerfilter/source/dmapper/OLEHandler.cxx            |    2 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx       |   10 ++
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx       |    3 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   20 ++--
 15 files changed, 194 insertions(+), 24 deletions(-)

New commits:
commit 99d27f6c355694b7a785dec96abe45b8b9f867e8
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Wed Oct 6 23:34:50 2010 +0200

    Misc improvements for docx VML import

diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx
index 047f842..67a5f16 100644
--- a/oox/inc/oox/helper/helper.hxx
+++ b/oox/inc/oox/helper/helper.hxx
@@ -94,8 +94,8 @@ const sal_uInt8 WINDOWS_CHARSET_OEM         = 255;
 // ----------------------------------------------------------------------------
 
 const sal_Int32 API_RGB_TRANSPARENT         = -1;       /// Transparent color for API calls.
-const sal_Int32 API_RGB_BLACK               = 0x00000;  /// Black color for API calls.
-const sal_Int32 API_RGB_WHITE               = 0xFFFFF;  /// White color for API calls.
+const sal_Int32 API_RGB_BLACK               = 0x000000;  /// Black color for API calls.
+const sal_Int32 API_RGB_WHITE               = 0xFFFFFF;  /// White color for API calls.
 
 const sal_Int16 API_LINE_NONE               = 0;
 const sal_Int16 API_LINE_HAIR               = 2;
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 328d1d0..eb9463e 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -209,6 +209,8 @@ class SimpleShape : public ShapeBase
 public:
     explicit            SimpleShape( Drawing& rDrawing, const ::rtl::OUString& rService );
 
+    void setService( rtl::OUString aService ) { maService = aService; }
+
 protected:
     /** Creates the corresponding XShape and inserts it into the passed container. */
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx
index c5fedd7..edf7cb4 100644
--- a/oox/inc/oox/vml/vmlshapecontainer.hxx
+++ b/oox/inc/oox/vml/vmlshapecontainer.hxx
@@ -95,6 +95,8 @@ public:
                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
                             const ShapeParentAnchor* pParentAnchor = 0 ) const;
 
+    inline void                clearShapes( ) { maShapes.clear( ); }
+
 private:
     typedef RefVector< ShapeType >                  ShapeTypeVector;
     typedef RefVector< ShapeBase >                  ShapeVector;
diff --git a/oox/inc/oox/vml/vmlshapecontext.hxx b/oox/inc/oox/vml/vmlshapecontext.hxx
index 0ad3b57..f0199d8 100644
--- a/oox/inc/oox/vml/vmlshapecontext.hxx
+++ b/oox/inc/oox/vml/vmlshapecontext.hxx
@@ -40,6 +40,7 @@ struct ShapeClientData;
 struct ShapeModel;
 class ShapeBase;
 class GroupShape;
+class RectangleShape;
 
 class ShapeContainer;
 
@@ -118,6 +119,9 @@ private:
     /** Processes the 'points' attribute. */
     void                setPoints( const ::rtl::OUString& rPoints );
 
+protected:
+    ShapeBase&          mrShape;
+
 private:
     ShapeModel&         mrShapeModel;
 };
@@ -141,6 +145,19 @@ private:
 
 // ============================================================================
 
+class RectangleShapeContext : public ShapeContext
+{
+public:
+    explicit            RectangleShapeContext(
+                            ::oox::core::ContextHandler2Helper& rParent,
+                            const AttributeList& rAttribs,
+                            RectangleShape& rShape );
+
+    virtual ::oox::core::ContextHandlerRef
+                        onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+// ============================================================================
+
 } // namespace vml
 } // namespace oox
 
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index a39508f..7790a20 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -226,7 +226,10 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
         {
             mpDrawing->finalizeFragmentImport();
             if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().getFirstShape() )
+            {
+                mpDrawing->getShapes( ).clearShapes( );
                 xResult = pShape->convertAndInsert( xShapes );
+            }
         }
         else if (mpShape.get() != NULL)
         {
diff --git a/oox/source/vml/vmldrawingfragment.cxx b/oox/source/vml/vmldrawingfragment.cxx
index 2d2af76..2aee246 100644
--- a/oox/source/vml/vmldrawingfragment.cxx
+++ b/oox/source/vml/vmldrawingfragment.cxx
@@ -60,7 +60,7 @@ ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const At
     {
         // DOCX filter handles plain shape elements with this fragment handler
         case VMLDRAWING_WORD:
-            if( isRootElement() )
+            if ( getNamespace( nElement ) == NMSP_VML )
                 return ShapeContextBase::createShapeContext( *this, nElement, rAttribs, mrDrawing.getShapes() );
         break;
 
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index a5907f6..a799020 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -29,12 +29,20 @@
 #include <rtl/math.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/awt/XControlModel.hpp>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
 #include "properties.hxx"
 #include "oox/helper/graphichelper.hxx"
 #include "oox/helper/propertymap.hxx"
@@ -47,6 +55,8 @@
 #include "oox/vml/vmlshapecontainer.hxx"
 
 using ::rtl::OUString;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::UNO_QUERY;
@@ -65,6 +75,8 @@ using ::com::sun::star::drawing::XShape;
 using ::com::sun::star::drawing::XShapes;
 using ::oox::core::XmlFilterBase;
 
+using namespace ::com::sun::star::text;
+
 namespace oox {
 namespace vml {
 
@@ -124,13 +136,62 @@ void lclInsertXShape( const Reference< XShapes >& rxShapes, const Reference< XSh
     }
 }
 
+void lclInsertTextFrame( const XmlFilterBase& rFilter, const Reference< XShape >& rxShape )
+{
+    OSL_ENSURE( rxShape.is(), "lclInsertTextFrame - missing XShape" );
+    if ( rxShape.is( ) )
+    {
+        try
+        {
+            Reference< XTextDocument > xDoc( rFilter.getModel( ), UNO_QUERY_THROW );
+            Reference< XTextContent > xCtnt( rxShape, UNO_QUERY_THROW );
+            xCtnt->attach( xDoc->getText( )->getStart( ) );
+        }
+        catch( Exception& )
+        {
+        }
+    }
+}
+
 void lclSetXShapeRect( const Reference< XShape >& rxShape, const Rectangle& rShapeRect )
 {
     OSL_ENSURE( rxShape.is(), "lclSetXShapeRect - missing XShape" );
     if( rxShape.is() )
     {
-        rxShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) );
-        rxShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) );
+        Reference< XTextFrame > xTextFrame( rxShape, UNO_QUERY );
+        if ( !xTextFrame.is( ) )
+        {
+            rxShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) );
+            rxShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) );
+        }
+        else
+        {
+            Reference< XPropertySet > xProps( xTextFrame, UNO_QUERY_THROW );
+            try
+            {
+                // The size
+                xProps->setPropertyValue( OUString::createFromAscii( "SizeType" ), Any( SizeType::FIX ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "FrameIsAutomaticHeight" ), Any( sal_False ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "Height" ), Any( rShapeRect.Height ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "Width" ), Any( rShapeRect.Width ) );
+
+                // The position
+                xProps->setPropertyValue( OUString::createFromAscii( "HoriOrientPosition" ), Any( rShapeRect.X ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "HoriOrientRelation" ),
+                        Any( RelOrientation::FRAME ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "HoriOrient" ),
+                        Any( HoriOrientation::NONE ) );
+
+                xProps->setPropertyValue( OUString::createFromAscii( "VertOrientPosition" ), Any( rShapeRect.Y ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "VertOrientRelation" ),
+                        Any( RelOrientation::FRAME ) );
+                xProps->setPropertyValue( OUString::createFromAscii( "VertOrient" ),
+                        Any( VertOrientation::NONE ) );
+            }
+            catch ( Exception& )
+            {
+            }
+        }
     }
 }
 
@@ -138,8 +199,12 @@ Reference< XShape > lclCreateAndInsertXShape( const XmlFilterBase& rFilter,
         const Reference< XShapes >& rxShapes, const OUString& rService, const Rectangle& rShapeRect )
 {
     Reference< XShape > xShape = lclCreateXShape( rFilter, rService );
-    lclInsertXShape( rxShapes, xShape );
+    if ( rService.equalsAscii( "com.sun.star.text.TextFrame" ) )
+        lclInsertTextFrame( rFilter, xShape );
+    else
+        lclInsertXShape( rxShapes, xShape );
     lclSetXShapeRect( xShape, rShapeRect );
+
     return xShape;
 }
 
@@ -197,11 +262,19 @@ Rectangle ShapeType::getRectangle( const ShapeParentAnchor* pParentAnchor ) cons
 Rectangle ShapeType::getAbsRectangle() const
 {
     const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
+
+    sal_Int32 nWidth = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maWidth, 0, true, true );
+    if ( nWidth == 0 )
+        nWidth = 1;
+
+    sal_Int32 nHeight = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maHeight, 0, true, true );
+    if ( nHeight == 0 )
+        nHeight = 1;
+
     return Rectangle(
         ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maLeft, 0, true, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true ),
         ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maTop, 0, false, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginTop, 0, false, true ),
-        ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maWidth, 0, true, true ),
-        ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maHeight, 0, false, true ) );
+        nWidth, nHeight );
 }
 
 Rectangle ShapeType::getRelRectangle() const
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index bcfcf40..9ee7dfa 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -155,6 +155,7 @@ ShapeContextBase::ShapeContextBase( ContextHandler2Helper& rParent ) :
         case VML_TOKEN( shape ):
             return new ShapeContext( rParent, rAttribs, rShapes.createShape< ComplexShape >() );
         case VML_TOKEN( rect ):
+            return new RectangleShapeContext( rParent, rAttribs, rShapes.createShape< RectangleShape >() );
         case VML_TOKEN( roundrect ):
             return new ShapeContext( rParent, rAttribs, rShapes.createShape< RectangleShape >() );
         case VML_TOKEN( oval ):
@@ -278,6 +279,7 @@ void ShapeTypeContext::setStyle( const OUString& rStyle )
 
 ShapeContext::ShapeContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, ShapeBase& rShape ) :
     ShapeTypeContext( rParent, rAttribs, rShape ),
+    mrShape( rShape ),
     mrShapeModel( rShape.getShapeModel() )
 {
     // collect shape specific attributes
@@ -288,6 +290,11 @@ ShapeContext::ShapeContext( ContextHandler2Helper& rParent, const AttributeList&
 
 ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
 {
+    // Custom shape in Writer with a textbox are transformed into a frame
+    if ( nElement == ( NMSP_VML + XML_textbox ) )
+        dynamic_cast<SimpleShape&>( mrShape ).setService(
+            OUString::createFromAscii( "com.sun.star.text.TextFrame" ) );
+
     // Excel specific shape client data
     if( isRootElement() && (nElement == VMLX_TOKEN( ClientData )) )
         return new ShapeClientDataContext( *this, rAttribs, mrShapeModel.createClientData() );
@@ -325,6 +332,22 @@ ContextHandlerRef GroupShapeContext::onCreateContext( sal_Int32 nElement, const
 
 // ============================================================================
 
+RectangleShapeContext::RectangleShapeContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, RectangleShape& rShape ) :
+    ShapeContext( rParent, rAttribs, rShape )
+{
+}
+
+ContextHandlerRef RectangleShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+    if ( nElement == ( NMSP_VML + XML_textbox ) )
+        dynamic_cast< SimpleShape &>( mrShape ).setService(
+            OUString::createFromAscii( "com.sun.star.text.TextFrame" ) );
+
+    // The parent class's context is fine
+    return ShapeContext::onCreateContext( nElement, rAttribs );
+}
+// ============================================================================
+
 } // namespace vml
 } // namespace oox
 
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index ff6fe55..14649ae 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/xml/sax/XFastParser.hpp>
 #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <com/sun/star/xml/sax/XFastShapeContextHandler.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 
@@ -244,6 +245,8 @@ public:
     virtual void setXNoteType(const Id & nId) = 0;
     virtual const Id & getXNoteType() const = 0;
     virtual const ::rtl::OUString & getTarget() const = 0;
+    virtual uno::Reference<xml::sax::XFastShapeContextHandler> getShapeContext( ) = 0;
+    virtual void setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext ) = 0;
 };
 
 
diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx
index ed4305d..e9a393d 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -54,7 +54,7 @@ using namespace ::com::sun::star;
 OLEHandler::OLEHandler() :
     m_nDxaOrig(0),
     m_nDyaOrig(0),
-    m_nWrapMode(0)
+    m_nWrapMode(1)
 {
 }
 /*-- 23.04.2008 10:46:14---------------------------------------------------
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 7d292db..615b726 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -400,6 +400,16 @@ uno::Reference<io::XInputStream> OOXMLDocumentImpl::getStorageStream()
     return mpStream->getStorageStream();
 }
 
+void OOXMLDocumentImpl::setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext )
+{
+    mxShapeContext = xContext;
+}
+
+uno::Reference<xml::sax::XFastShapeContextHandler> OOXMLDocumentImpl::getShapeContext( )
+{
+    return mxShapeContext;
+}
+
 OOXMLDocument *
 OOXMLDocumentFactory::createDocument
 (OOXMLStream::Pointer_t pStream)
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index 233b8f0..284a650 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -47,6 +47,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
 
     uno::Reference<frame::XModel> mxModel;
     uno::Reference<drawing::XDrawPage> mxDrawPage;
+    uno::Reference<xml::sax::XFastShapeContextHandler> mxShapeContext;
 
     bool mbIsSubstream;
 
@@ -109,6 +110,8 @@ public:
     virtual void setXNoteType(const Id & rId);
     virtual const Id & getXNoteType() const;
     virtual const ::rtl::OUString & getTarget() const;
+    virtual uno::Reference<xml::sax::XFastShapeContextHandler> getShapeContext( );
+    virtual void setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext );
 };
 }}
 #endif // OOXML_DOCUMENT_IMPL_HXX
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 8c8ffaf..b9a360d 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1913,13 +1913,19 @@ OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
         uno::Reference<XMultiComponentFactory> rServiceManager
             (xContext->getServiceManager());
 
-        mrShapeContext.set
-            (rServiceManager->
-              createInstanceWithContext
-              (::rtl::OUString
-               (RTL_CONSTASCII_USTRINGPARAM
-                ("com.sun.star.xml.sax.FastShapeContextHandler")), xContext),
-              uno::UNO_QUERY);
+        mrShapeContext.set( getDocument( )->getShapeContext( ) );
+        if ( !mrShapeContext.is( ) )
+        {
+            // Define the shape context for the whole document
+            mrShapeContext.set
+                (rServiceManager->
+                  createInstanceWithContext
+                  (::rtl::OUString
+                   (RTL_CONSTASCII_USTRINGPARAM
+                    ("com.sun.star.xml.sax.FastShapeContextHandler")), xContext),
+                  uno::UNO_QUERY);
+            getDocument()->setShapeContext( mrShapeContext );
+        }
 
         if (mrShapeContext.is())
         {
commit 37d8341f3a68ce6b218e4d163690ada2bc983083
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Wed Oct 6 23:29:18 2010 +0200

    n#532920: Fixed some text position bug in ww8 import

diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index ab8c591..31ac69f 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -257,6 +257,8 @@ struct MSDffTxId
 
 struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
 {
+    static const int RELTO_DEFAULT = 2;
+
     SdrObject*	pObj;
     Polygon*	pWrapPolygon;
     char*		pClientAnchorBuffer;
@@ -264,9 +266,9 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
     char*		pClientDataBuffer;
     UINT32		nClientDataLen;
     UINT32		nXAlign;
-    UINT32		nXRelTo;
+    UINT32		*pXRelTo;
     UINT32		nYAlign;
-    UINT32		nYRelTo;
+    UINT32	 	*pYRelTo;
     UINT32		nLayoutInTableCell;
     UINT32      nFlags;
     long		nTextRotationAngle;
@@ -303,6 +305,8 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
     {   return nShapeId == rEntry.nShapeId; }
     BOOL operator<( const SvxMSDffImportRec& rEntry ) const
     {   return nShapeId < rEntry.nShapeId;  }
+private:
+    SvxMSDffImportRec &operator=(const SvxMSDffImportRec&);
 };
 typedef SvxMSDffImportRec* MSDffImportRec_Ptr;
 
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 6e079a4..410cfae 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5605,9 +5605,19 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
                 switch( nPID )
                 {
                     case 0x038F: pImpRec->nXAlign = nUDData; break;
-                    case 0x0390: pImpRec->nXRelTo = nUDData; break;
+                    case 0x0390:
+                        if (pImpRec->pXRelTo)
+                            delete pImpRec->pXRelTo;
+                        pImpRec->pXRelTo = new UINT32;
+                        *(pImpRec->pXRelTo) = nUDData;
+                        break;
                     case 0x0391: pImpRec->nYAlign = nUDData; break;
-                    case 0x0392: pImpRec->nYRelTo = nUDData; break;
+                    case 0x0392:
+                        if (pImpRec->pYRelTo)
+                            delete pImpRec->pYRelTo;
+                        pImpRec->pYRelTo = new UINT32;
+                        *(pImpRec->pYRelTo) = nUDData;
+                        break;
                     case 0x03BF: pImpRec->nLayoutInTableCell = nUDData; break;
                 }
                 if ( rSt.GetError() != 0 )
@@ -7995,9 +8005,9 @@ SvxMSDffImportRec::SvxMSDffImportRec()
       pClientDataBuffer( 0 ),
       nClientDataLen(    0 ),
       nXAlign( 0 ),	// position n cm from left
-      nXRelTo( 2 ), //   relative to column
+      pXRelTo( NULL ), //   relative to column
       nYAlign( 0 ), // position n cm below
-      nYRelTo( 2 ), //   relative to paragraph
+      pYRelTo( NULL ), //   relative to paragraph
       nLayoutInTableCell( 0 ), // element is laid out in table cell
       nTextRotationAngle( 0 ),
       nDxTextLeft( 144 ),
@@ -8031,9 +8041,9 @@ SvxMSDffImportRec::SvxMSDffImportRec()
 SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
     : pObj(	rCopy.pObj ),
       nXAlign( rCopy.nXAlign ),
-      nXRelTo( rCopy.nXRelTo ),
+      pXRelTo( NULL ),
       nYAlign( rCopy.nYAlign ),
-      nYRelTo( rCopy.nYRelTo ),
+      pYRelTo( NULL ),
       nLayoutInTableCell( rCopy.nLayoutInTableCell ),
       nTextRotationAngle( rCopy.nTextRotationAngle ),
       nDxTextLeft( rCopy.nDxTextLeft	),
@@ -8053,6 +8063,16 @@ SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
       nShapeId( rCopy.nShapeId ),
       eShapeType( rCopy.eShapeType )
 {
+    if (rCopy.pXRelTo)
+    {
+       pXRelTo = new UINT32;
+       *pXRelTo = *(rCopy.pXRelTo);
+    }
+    if (rCopy.pYRelTo)
+    {
+       pYRelTo = new UINT32;
+       *pYRelTo = *(rCopy.pYRelTo);
+    }
     eLineStyle       = rCopy.eLineStyle; // GPF-Bug #66227#
     bDrawHell        = rCopy.bDrawHell;
     bHidden          = rCopy.bHidden;
@@ -8098,6 +8118,10 @@ SvxMSDffImportRec::~SvxMSDffImportRec()
         delete[] pClientDataBuffer;
     if (pWrapPolygon)
         delete pWrapPolygon;
+    if (pXRelTo)
+        delete pXRelTo;
+    if (pYRelTo)
+        delete pYRelTo;
 }
 
 void SvxMSDffManager::insertShapeId( sal_Int32 nShapeId, SdrObject* pShape )


More information about the ooo-build-commit mailing list