[Libreoffice-commits] .: Branch 'libreoffice-3-3' - 5 commits - filter/source oox/inc oox/prj oox/source

Tor Lillqvist tml at kemper.freedesktop.org
Sat Nov 13 02:25:34 PST 2010


 filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu          |    2 
 filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu |    2 
 filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu                    |    2 
 oox/inc/oox/export/drawingml.hxx                                                   |   13 
 oox/inc/oox/export/shapes.hxx                                                      |   26 +
 oox/inc/oox/ppt/pptimport.hxx                                                      |    3 
 oox/prj/d.lst                                                                      |    1 
 oox/source/export/drawingml.cxx                                                    |  148 ++++++++--
 oox/source/export/shapes.cxx                                                       |   32 +-
 oox/source/ppt/pptimport.cxx                                                       |   26 +
 10 files changed, 208 insertions(+), 47 deletions(-)

New commits:
commit 4673af783ad547490c280865eaa9079407870977
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Fri Nov 5 18:44:20 2010 +0200

    Apply oox-drawingml-fix-shapes-map-crash.diff

diff --git a/oox/inc/oox/export/shapes.hxx b/oox/inc/oox/export/shapes.hxx
index 6d12eb5..dfa5f59 100644
--- a/oox/inc/oox/export/shapes.hxx
+++ b/oox/inc/oox/export/shapes.hxx
@@ -50,16 +50,7 @@ namespace oox { namespace drawingml {
 
 class OOX_DLLPUBLIC ShapeExport : public DrawingML {
 
-protected:
-    sal_Int32           mnShapeIdMax, mnPictureIdMax;
-
 private:
-    sal_Int32           mnXmlNamespace;
-    Fraction            maFraction;
-    MapMode             maMapModeSrc, maMapModeDest;
-
-    ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
-
     struct ShapeCheck
     {
         bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
@@ -75,11 +66,25 @@ private:
         size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
     };
 
+public:
     typedef std::hash_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
-    static ShapeHashMap saShapeMap;
+
+protected:
+    sal_Int32           mnShapeIdMax, mnPictureIdMax;
+
+private:
+    sal_Int32           mnXmlNamespace;
+    Fraction            maFraction;
+    MapMode             maMapModeSrc, maMapModeDest;
+
+    ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
+
+    ShapeHashMap maShapeMap;
+    ShapeHashMap* mpShapeMap;
 
 public:
-    ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+
+    ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
     virtual ~ShapeExport() {}
 
     sal_Int32           GetXmlNamespace() const;
@@ -158,8 +163,9 @@ public:
                         WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
 
     sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
-    static sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
-    static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+    sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
+    sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+    static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap );
 };
 
 }}
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 5296d15..c86297e 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -365,7 +365,7 @@ namespace oox { namespace drawingml {
     if ( GETA(propName) ) \
         mAny >>= variable;
 
-ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, XmlFilterBase* pFB, DocumentType eDocumentType )
+ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType )
     : DrawingML( pFS, pFB, eDocumentType )
     , mnShapeIdMax( 1 )
     , mnPictureIdMax( 1 )
@@ -373,6 +373,7 @@ ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, XmlFilterBas
     , maFraction( 1, 576 )
     , maMapModeSrc( MAP_100TH_MM )
     , maMapModeDest( MAP_INCH, Point(), maFraction, maFraction )
+    , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap )
 {
 }
 
@@ -980,26 +981,29 @@ sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilt
 
     sal_Int32 nID = pFB->GetUniqueId();
 
-    saShapeMap[ rXShape ] = nID;
+    (*mpShapeMap)[ rXShape ] = nID;
 
     return nID;
 }
 
 sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape )
 {
+    return GetShapeID( rXShape, mpShapeMap );
+}
+
+sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape, ShapeHashMap* pShapeMap )
+{
     if( !rXShape.is() )
         return -1;
 
-    ShapeHashMap::const_iterator aIter = saShapeMap.find( rXShape );
+    ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
 
-    if( aIter == saShapeMap.end() )
+    if( aIter == pShapeMap->end() )
         return -1;
 
     return aIter->second;
 }
 
-ShapeExport::ShapeHashMap ShapeExport::saShapeMap;
-
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d93aa2c22b94204a9254fb6dae1f431e53cb1128
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Fri Nov 5 18:32:42 2010 +0200

    Apply pptx-fix-connector-crash.diff

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a2e86b9..d90ef29 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1460,14 +1460,16 @@ void DrawingML::WritePolyPolygon( const PolyPolygon& rPolyPolygon )
 
 void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID )
 {
-    mpFS->singleElementNS( XML_a, XML_stCxn,
-                           XML_id, I32S( nStartID ),
-                           XML_idx, I64S( rConnectorEntry.GetConnectorRule( TRUE ) ),
-                           FSEND );
-    mpFS->singleElementNS( XML_a, XML_endCxn,
-                           XML_id, I32S( nEndID ),
-                           XML_idx, I64S( rConnectorEntry.GetConnectorRule( FALSE ) ),
-                           FSEND );
+    if( nStartID != -1 )
+        mpFS->singleElementNS( XML_a, XML_stCxn,
+                               XML_id, I32S( nStartID ),
+                               XML_idx, I64S( rConnectorEntry.GetConnectorRule( TRUE ) ),
+                               FSEND );
+    if( nEndID != -1 )
+        mpFS->singleElementNS( XML_a, XML_endCxn,
+                               XML_id, I32S( nEndID ),
+                               XML_idx, I64S( rConnectorEntry.GetConnectorRule( FALSE ) ),
+                               FSEND );
 }
 
 // from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 44da51d..5296d15 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -975,6 +975,9 @@ sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape )
 
 sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilterBase* pFB )
 {
+    if( !rXShape.is() )
+        return -1;
+
     sal_Int32 nID = pFB->GetUniqueId();
 
     saShapeMap[ rXShape ] = nID;
@@ -984,6 +987,9 @@ sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilt
 
 sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape )
 {
+    if( !rXShape.is() )
+        return -1;
+
     ShapeHashMap::const_iterator aIter = saShapeMap.find( rXShape );
 
     if( aIter == saShapeMap.end() )
commit fd7e412d257632694936a972e493ed60cdf93e72
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Mon Nov 1 16:18:51 2010 +0200

    From hg changeset c94984deded153e8720faf14d1fc5c3a5b866381 in ooxml11
    
    ooxml11: intermediate commit, builds

diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 3fdf70f..92603af 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -45,9 +45,6 @@ public:
     enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
 
 private:
-    ::sax_fastparser::FSHelperPtr mpFS;
-    ::oox::core::XmlFilterBase* mpFB;
-
     static int mnImageCounter;
 
     /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
@@ -55,6 +52,8 @@ private:
 
 protected:
     ::com::sun::star::uno::Any mAny;
+    ::sax_fastparser::FSHelperPtr mpFS;
+    ::oox::core::XmlFilterBase* mpFB;
 
     bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String aName );
     bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
@@ -65,7 +64,7 @@ protected:
     rtl::OUString WriteImage( const rtl::OUString& rURL );
 
 public:
-    DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : mpFS( pFS ), mpFB( pFB ), meDocumentType( eDocumentType ) {}
+    DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
     void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
     ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
     ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
diff --git a/oox/inc/oox/export/shapes.hxx b/oox/inc/oox/export/shapes.hxx
index c27a464..6d12eb5 100644
--- a/oox/inc/oox/export/shapes.hxx
+++ b/oox/inc/oox/export/shapes.hxx
@@ -49,9 +49,12 @@ namespace drawing {
 namespace oox { namespace drawingml {
 
 class OOX_DLLPUBLIC ShapeExport : public DrawingML {
+
+protected:
+    sal_Int32           mnShapeIdMax, mnPictureIdMax;
+
 private:
     sal_Int32           mnXmlNamespace;
-    sal_Int32           mnShapeIdMax, mnPictureIdMax;
     Fraction            maFraction;
     MapMode             maMapModeSrc, maMapModeDest;
 
@@ -73,7 +76,7 @@ private:
     };
 
     typedef std::hash_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
-    ShapeHashMap maShapeMap;
+    static ShapeHashMap saShapeMap;
 
 public:
     ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
@@ -155,7 +158,8 @@ public:
                         WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
 
     sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
-    sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+    static sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
+    static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
 };
 
 }}
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 29051a5..44da51d 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -93,6 +93,7 @@ using ::com::sun::star::text::XText;
 using ::com::sun::star::text::XTextContent;
 using ::com::sun::star::text::XTextField;
 using ::com::sun::star::text::XTextRange;
+using ::oox::core::XmlFilterBase;
 using ::com::sun::star::chart2::XChartDocument;
 using ::com::sun::star::frame::XModel;
 using ::oox::core::XmlFilterBase;
@@ -364,11 +365,11 @@ namespace oox { namespace drawingml {
     if ( GETA(propName) ) \
         mAny >>= variable;
 
-ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType )
+ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, XmlFilterBase* pFB, DocumentType eDocumentType )
     : DrawingML( pFS, pFB, eDocumentType )
-    , mnXmlNamespace( nXmlNamespace )
     , mnShapeIdMax( 1 )
     , mnPictureIdMax( 1 )
+    , mnXmlNamespace( nXmlNamespace )
     , maFraction( 1, 576 )
     , maMapModeSrc( MAP_100TH_MM )
     , maMapModeDest( MAP_INCH, Point(), maFraction, maFraction )
@@ -969,23 +970,30 @@ size_t ShapeExport::ShapeHash::operator()( const ::com::sun::star::uno::Referenc
 
 sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape )
 {
-    sal_Int32 nID = GetFB()->GetUniqueId();
+    return GetNewShapeID( rXShape, GetFB() );
+}
 
-    maShapeMap[ rXShape ] = nID;
+sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilterBase* pFB )
+{
+    sal_Int32 nID = pFB->GetUniqueId();
+
+    saShapeMap[ rXShape ] = nID;
 
     return nID;
 }
 
 sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape )
 {
-    ShapeHashMap::const_iterator aIter = maShapeMap.find( rXShape );
+    ShapeHashMap::const_iterator aIter = saShapeMap.find( rXShape );
 
-    if( aIter == maShapeMap.end() )
+    if( aIter == saShapeMap.end() )
         return -1;
 
     return aIter->second;
 }
 
+ShapeExport::ShapeHashMap ShapeExport::saShapeMap;
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 406d7236858fcfb4f3dfb5627c09eda2367a89a1
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Mon Nov 1 14:53:53 2010 +0200

    From hg changeset 11bdb9c019c49df77306d1a9915b44e1f8dbf79e in ooxml11
    
    ooxml11: intermediate commit

diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
index 7fdcbd7..138d449 100644
--- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
@@ -1,5 +1,5 @@
 <node oor:name="Impress MS PowerPoint 2007 XML" oor:op="replace">
-    <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+    <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
     <prop oor:name="UIComponent"/>
     <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.oox.PowerPointImport</value></prop>
     <prop oor:name="UserData"/>
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
index 28b9ea8..eb9fea6 100644
--- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
@@ -1,5 +1,5 @@
 <node oor:name="Impress MS PowerPoint 2007 XML Template" oor:op="replace">
-    <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH PREFERRED</value></prop>
+    <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH PREFERRED</value></prop>
     <prop oor:name="UIComponent"/>
     <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.oox.PowerPointImport</value></prop>
     <prop oor:name="UserData"/>
diff --git a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
index 99f22ee..1cc12bf 100644
--- a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
+++ b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
@@ -1,7 +1,7 @@
 <node oor:name="MS PowerPoint 2007 XML" oor:op="replace" >
     <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
     <prop oor:name="URLPattern"/>
-    <prop oor:name="Extensions"><value>pptm pptx</value></prop>
+    <prop oor:name="Extensions"><value>pptx pptm</value></prop>
     <prop oor:name="MediaType"/>
     <prop oor:name="Preferred"><value>true</value></prop>
     <prop oor:name="PreferredFilter"><value>Impress MS PowerPoint 2007 XML</value></prop>
commit 3df0549192514c243cec4ec098355e03110460a2
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Mon Nov 1 14:13:53 2010 +0200

    From hg changeset 2b3eef7bad494312ee9c8c13c1b1014b22ba0451 in ooxml11
    
    ooxml11: merge with DEV300 m76 (I hope), plus intermediate commit of
    own changes

diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 0451f2c..3fdf70f 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -21,6 +21,9 @@ namespace beans {
 namespace drawing {
     class XShape;
 }
+namespace style {
+    struct LineSpacing;
+}
 namespace text {
     class XTextContent;
     class XTextRange;
@@ -82,8 +85,9 @@ public:
     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName );
     void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     void WriteStretch();
+    void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
 
-    ::rtl::OUString WriteBlip( ::rtl::OUString& rURL );
+    ::rtl::OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, ::rtl::OUString& rURL );
     void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
 
     void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
diff --git a/oox/inc/oox/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx
index c3a924e..2896923 100644
--- a/oox/inc/oox/ppt/pptimport.hxx
+++ b/oox/inc/oox/ppt/pptimport.hxx
@@ -65,6 +65,9 @@ public:
     std::vector< SlidePersistPtr >&							getMasterPages(){ return maMasterPages; };
     std::vector< SlidePersistPtr >&							getNotesPages(){ return maNotesPages; };
 
+    virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence<   ::com::sun::star::beans::PropertyValue >& rDescriptor )
+        throw( ::com::sun::star::uno::RuntimeException );
+
     sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
 
 private:
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index 70c7c1e..0cd6971 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -39,6 +39,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls
 ..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx
 ..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx
 ..\inc\oox\export\*.hxx %_DEST%\inc%_EXT%\oox\export\*.hxx
+..\inc\oox\ole\oleobjecthelper.hxx %_DEST%\inc%_EXT%\oox\ole\oleobjecthelper.hxx
 
 dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 240e31f..a2e86b9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -40,6 +40,8 @@
 #include <com/sun/star/awt/Gradient.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/drawing/BitmapMode.hpp>
@@ -54,7 +56,10 @@
 #include <com/sun/star/drawing/BitmapMode.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/text/XTextContent.hpp>
 #include <com/sun/star/text/XTextField.hpp>
@@ -73,9 +78,12 @@
 #include <editeng/svxenum.hxx>
 
 using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::drawing;
 using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
 using ::com::sun::star::beans::PropertyState;
 using ::com::sun::star::beans::PropertyValue;
 using ::com::sun::star::beans::XPropertySet;
@@ -84,6 +92,7 @@ using ::com::sun::star::container::XEnumeration;
 using ::com::sun::star::container::XEnumerationAccess;
 using ::com::sun::star::container::XIndexAccess;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::style::LineSpacing;
 using ::com::sun::star::text::XText;
 using ::com::sun::star::text::XTextContent;
 using ::com::sun::star::text::XTextField;
@@ -108,6 +117,44 @@ namespace drawingml {
 #define GET(variable, propName) \
     if ( GETA(propName) ) \
         mAny >>= variable;
+DBG(
+void lcl_dump_pset(Reference< XPropertySet > rXPropSet)
+{
+    Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
+    Sequence< beans::Property > props = info->getProperties ();
+
+    for (int i=0; i < props.getLength (); i++) {
+        OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
+        fprintf (stderr,"%30s = ", name.getStr() );
+
+    try {
+        Any value = rXPropSet->getPropertyValue( props [i].Name );
+
+        OUString strValue;
+        sal_Int32 intValue;
+        bool boolValue;
+    LineSpacing spacing;
+//         RectanglePoint pointValue;
+
+        if( value >>= strValue )
+            fprintf (stderr,"\"%s\"\n", USS( strValue ) );
+        else if( value >>= intValue )
+            fprintf (stderr,"%d            (hex: %x)\n", intValue, intValue);
+        else if( value >>= boolValue )
+            fprintf (stderr,"%d            (bool)\n", boolValue);
+    else if( value >>= spacing ) {
+        fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
+    }
+//         else if( value >>= pointValue )
+//             fprintf (stderr,"%d            (RectanglePoint)\n", pointValue);
+        else
+            fprintf (stderr,"???           <unhandled type>\n");
+    } catch(Exception e) {
+        fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
+    }
+    }
+}
+);
 
 // not thread safe
 int DrawingML::mnImageCounter = 1;
@@ -523,15 +570,27 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
     return sRelId;
 }
 
-OUString DrawingML::WriteBlip( OUString& rURL )
+OUString DrawingML::WriteBlip( Reference< XPropertySet > rXPropSet, OUString& rURL )
 {
         OUString sRelId = WriteImage( rURL );
+    sal_Int16 nBright = 0;
+    sal_Int32 nContrast = 0;
+
+    GET( nBright, AdjustLuminance );
+    GET( nContrast, AdjustContrast );
+
+        mpFS->startElementNS( XML_a, XML_blip,
+                  FSNS( XML_r, XML_embed), OUStringToOString( sRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
+                  FSEND );
+    if( nBright || nContrast )
+        mpFS->singleElementNS( XML_a, XML_lum,
+                   XML_bright, nBright ? I32S( nBright*1000 ) : NULL,
+                   XML_contrast, nContrast ? I32S( nContrast*1000 ) : NULL,
+                   FSEND );
 
-        mpFS->singleElementNS( XML_a, XML_blip,
-                               FSNS( XML_r, XML_embed), OUStringToOString( sRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
-                               FSEND );
+    mpFS->endElementNS( XML_a, XML_blip );
 
-        return sRelId;
+    return sRelId;
 }
 
 void DrawingML::WriteBlipMode( Reference< XPropertySet > rXPropSet )
@@ -569,7 +628,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, String sURLP
 
         mpFS->startElementNS( nXmlNamespace , XML_blipFill, FSEND );
 
-        WriteBlip( aURL );
+        WriteBlip( rXPropSet, aURL );
 
         if( sURLPropName == S( "FillBitmapURL" ) )
             WriteBlipMode( rXPropSet );
@@ -753,8 +812,6 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs
         else
             typeface = USS( usTypeface );
 
-
-
         mpFS->singleElementNS( XML_a, XML_latin,
                                XML_typeface, typeface,
                                XML_pitchFamily, pitch,
@@ -918,7 +975,6 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
                         else if( bSDot ) \
                             pAutoNumType = #x "Period";
 
-
 inline static const char* GetAutoNumType( sal_Int16 nNumberingType, bool bSDot, bool bPBehind, bool bPBoth )
 {
     const char* pAutoNumType = NULL;
@@ -964,7 +1020,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
             Sequence< PropertyValue > aPropertySequence;
             rXIndexAccess->getByIndex( nLevel ) >>= aPropertySequence;
 
-
             const PropertyValue* pPropValue = aPropertySequence.getArray();
 
             sal_Int32 nPropertyCount = aPropertySequence.getLength();
@@ -1086,14 +1141,30 @@ const char* DrawingML::GetAlignment( sal_Int32 nAlignment )
     return sAlignment;
 }
 
+void DrawingML::WriteLinespacing( LineSpacing& rSpacing )
+{
+    if( rSpacing.Mode == LineSpacingMode::PROP )
+        mpFS->singleElementNS( XML_a, XML_spcPct,
+                               XML_val, I32S( ((sal_Int32)rSpacing.Height)*1000 ),
+                               FSEND );
+    else
+        mpFS->singleElementNS( XML_a, XML_spcPts,
+                               XML_val, I32S( rSpacing.Height ),
+                               FSEND );
+}
+
 void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph )
 {
     Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
     Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
+    PropertyState eState;
 
     if( !rXPropSet.is() || !rXPropState.is() )
         return;
 
+    //OSL_TRACE("write paragraph properties pset");
+    //DBG(lcl_dump_pset(rXPropSet));
+
     sal_Int16 nLevel = -1;
     GET( nLevel, NumberingLevel );
 
@@ -1104,15 +1175,27 @@ void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph )
     sal_Int16 nAlignment( style::ParagraphAdjust_LEFT );
     GET( nAlignment, ParaAdjust );
 
+    sal_Bool bHasLinespacing = sal_False;
+    LineSpacing aLineSpacing;
+    if( GETAD( ParaLineSpacing ) )
+        bHasLinespacing = ( mAny >>= aLineSpacing );
+
     if( nLevel != -1
-            || nLeftMargin > 0
-            || nAlignment != style::ParagraphAdjust_LEFT ) {
+        || nLeftMargin > 0
+        || nAlignment != style::ParagraphAdjust_LEFT
+        || bHasLinespacing ) {
         mpFS->startElementNS( XML_a, XML_pPr,
                               XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL,
                               XML_marL, nLeftMargin > 0 ? IS( nLeftMargin ) : NULL,
                               XML_algn, GetAlignment( nAlignment ),
                               FSEND );
 
+        if( bHasLinespacing ) {
+            mpFS->startElementNS( XML_a, XML_lnSpc, FSEND );
+            WriteLinespacing( aLineSpacing );
+            mpFS->endElementNS( XML_a, XML_lnSpc );
+        }
+
         WriteParagraphNumbering( rXPropSet, nLevel );
 
         mpFS->endElementNS( XML_a, XML_pPr );
@@ -1185,11 +1268,24 @@ void DrawingML::WriteText( Reference< XShape > rXShape  )
             ;
     }
 
+    const char* sWritingMode = NULL;
+    sal_Bool bVertical = sal_False;
+    if( GETA( TextWritingMode ) ) {
+        WritingMode eMode;
+
+        if( ( mAny >>= eMode ) && eMode == WritingMode_TB_RL ) {
+            sWritingMode = "vert";
+            bVertical = sal_True;
+        }
+    }
+
     TextHorizontalAdjust eHorizontalAlignment( TextHorizontalAdjust_CENTER );
     bool bHorizontalCenter = false;
     GET( eHorizontalAlignment, TextHorizontalAdjust );
     if( eHorizontalAlignment == TextHorizontalAdjust_CENTER )
         bHorizontalCenter = true;
+    else if( bVertical && eHorizontalAlignment == TextHorizontalAdjust_LEFT )
+        sVerticalAlignment = "b";
 
     sal_Bool bHasWrap = FALSE;
     sal_Bool bWrap = FALSE;
@@ -1207,6 +1303,7 @@ void DrawingML::WriteText( Reference< XShape > rXShape  )
                            XML_bIns, (nBottom != DEFTBINS) ? IS( MM100toEMU( nBottom ) ) : NULL,
                            XML_anchor, sVerticalAlignment,
                            XML_anchorCtr, bHorizontalCenter ? "1" : NULL,
+                           XML_vert, sWritingMode,
                            FSEND );
 
     Reference< XEnumerationAccess > access( xXText, UNO_QUERY );
@@ -1244,7 +1341,10 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bo
     mpFS->startElementNS( XML_a, XML_avLst, FSEND );
 
     Sequence< drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
-    if ( rProp.Value >>= aAdjustmentSeq ) {
+    if ( ( rProp.Value >>= aAdjustmentSeq )
+         && eShapeType != mso_sptActionButtonForwardNext  // we have adjustments values for these type of shape, but MSO doesn't like them
+         && eShapeType != mso_sptActionButtonBackPrevious // so they are now disabled
+        ) {
         DBG(printf("adj seq len: %d\n", int( aAdjustmentSeq.getLength() )));
         if ( bPredefinedHandlesUsed )
             EscherPropertyContainer::LookForPolarHandles( eShapeType, nAdjustmentsWhichNeedsToBeConverted );
@@ -1481,8 +1581,6 @@ void DrawingML::WriteFill( Reference< XPropertySet > xPropSet )
     return;
 }
 
-
-
 }
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7986244..29051a5 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -621,7 +621,7 @@ ShapeExport& ShapeExport::WriteGraphicObjectShape( Reference< XShape > xShape )
 
     pFS->startElementNS( mnXmlNamespace, XML_blipFill, FSEND );
     
-    WriteBlip( sGraphicURL );
+    WriteBlip( xShapeProps, sGraphicURL );
 
     bool bStretch = false;
     if( ( xShapeProps->getPropertyValue( S( "FillBitmapStretch" ) ) >>= bStretch ) && bStretch )
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 1a09667..286041e 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -38,6 +38,9 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::xml::sax;
 using namespace oox::core;
 
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::lang::XComponent;
+
 namespace oox { namespace ppt {
 
 OUString SAL_CALL PowerPointImport_getImplementationName() throw()
@@ -131,6 +134,29 @@ const ::oox::drawingml::Theme* PowerPointImport::getCurrentTheme() const
     return mpActualSlidePersist ? mpActualSlidePersist->getTheme().get() : 0;
 }
 
+sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDescriptor ) throw( RuntimeException )
+{
+    if( XmlFilterBase::filter( rDescriptor ) )
+        return true;
+
+    if( isExportFilter() ) {
+        Reference< XExporter > xExporter( getGlobalFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.PowerPointExport" ) ), UNO_QUERY );
+
+        if( xExporter.is() ) {
+            Reference< XComponent > xDocument( getModel(), UNO_QUERY );
+            Reference< XFilter > xFilter( xExporter, UNO_QUERY );
+
+            if( xFilter.is() ) {
+                xExporter->setSourceDocument( xDocument );
+                if( xFilter->filter( rDescriptor ) )
+                    return true;
+            }
+        }
+    }
+
+    return false;
+}
+
 ::oox::vml::Drawing* PowerPointImport::getVmlDrawing()
 {
     return mpActualSlidePersist ? mpActualSlidePersist->getDrawing() : 0;


More information about the Libreoffice-commits mailing list