diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2010-11-01 14:13:53 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@hemulen.(none)> | 2010-11-13 12:24:04 +0200 |
commit | ba0ab700b4cebd88e07ebe0662f560b2b9dfb918 (patch) | |
tree | 32b71bb58d8b7f0aa7c6900963fb1562ee899a6c /oox | |
parent | 89579fd0db5dcc728f756f94eb68de1b9df3efe1 (diff) |
From hg changeset 2b3eef7bad494312ee9c8c13c1b1014b22ba0451 in ooxml11
ooxml11: merge with DEV300 m76 (I hope), plus intermediate commit of
own changes
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/export/drawingml.hxx | 6 | ||||
-rw-r--r-- | oox/inc/oox/ppt/pptimport.hxx | 3 | ||||
-rw-r--r-- | oox/prj/d.lst | 1 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 130 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/pptimport.cxx | 26 |
6 files changed, 150 insertions, 18 deletions
diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx index 0451f2c9cbb5..3fdf70fb9592 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 6ca5cae5b1f3..0a71b4cbdf04 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 70c7c1ea52ef..0cd697108cdb 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 240e31fb079d..a2e86b922bce 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 ac86ae488790..626f8b7363c5 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 cc458d0f5cc2..a48977ae1f31 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; |