diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-11-09 15:15:30 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-11-09 15:15:30 +0100 |
commit | eda18e5118fb3e7a128b0c43e465f1569c74cba3 (patch) | |
tree | 7f6c7df6972abf5f0e2b9de3140acdc341540500 /oox | |
parent | 8044a782c864a5572d236a01e8ac35b1f275b1dd (diff) | |
parent | 5b87db5f3e00ea6e04af2b514f5f869cea59af09 (diff) |
dr77: rebase to DEV300m92
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/drawingml/fillproperties.hxx | 2 | ||||
-rw-r--r-- | oox/inc/oox/helper/graphichelper.hxx | 4 | ||||
-rw-r--r-- | oox/inc/oox/ppt/slidepersist.hxx | 2 | ||||
-rw-r--r-- | oox/prj/d.lst | 1 | ||||
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 21 | ||||
-rw-r--r-- | oox/source/drawingml/fillpropertiesgroupcontext.cxx | 10 | ||||
-rw-r--r-- | oox/source/helper/graphichelper.cxx | 14 | ||||
-rw-r--r-- | oox/source/ppt/slidefragmenthandler.cxx | 7 | ||||
-rw-r--r-- | oox/source/ppt/slidepersist.cxx | 7 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/util/makefile.mk | 8 | ||||
-rw-r--r-- | oox/util/oox.component | 58 |
12 files changed, 133 insertions, 2 deletions
diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx index 42457e6f4dde..d62651ebdc20 100644 --- a/oox/inc/oox/drawingml/fillproperties.hxx +++ b/oox/inc/oox/drawingml/fillproperties.hxx @@ -117,6 +117,8 @@ struct BlipFillProperties OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillRect; /// Stretch fill offsets. + OptValue< ::com::sun::star::geometry::IntegerRectangle2D > + moClipRect; OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs). OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs). OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent). diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx index bfe19b5472ae..b2b9e1cd133b 100644 --- a/oox/inc/oox/helper/graphichelper.hxx +++ b/oox/inc/oox/helper/graphichelper.hxx @@ -147,6 +147,10 @@ public: @return The URL of the created and internally cached graphic object. */ ::rtl::OUString importEmbeddedGraphicObject( const ::rtl::OUString& rStreamName ) const; + /** calculates the orignal size of a graphic which is necessary to be able to calculate cropping values + @return The original Graphic size in 100thmm */ + ::com::sun::star::awt::Size getOriginalSize( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const; + // ------------------------------------------------------------------------ private: typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette; diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx index 29f857c8340e..a6561772ed3a 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -90,6 +90,7 @@ public: void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; } oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; } + oox::drawingml::Color& getBackgroundColorRef() { return maBackgroundColorRef; } sal_Bool isMasterPage() const { return mbMaster; } sal_Bool isNotesPage() const { return mbNotes; } @@ -129,6 +130,7 @@ private: SlidePersistPtr mpMasterPagePtr; oox::drawingml::ShapePtr maShapesPtr; + oox::drawingml::Color maBackgroundColorRef; oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; ::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList; diff --git a/oox/prj/d.lst b/oox/prj/d.lst index 360acef09111..69ff66b95bc5 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -43,3 +43,4 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" ..\xml\components.xml %_DEST%\xml%_EXT%\components.xml +..\%__SRC%\misc\oox.component %_DEST%\xml%_EXT%\oox.component diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 558ce2abdfc8..19700cd8199c 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/drawing/BitmapMode.hpp> #include <com/sun/star/drawing/ColorMode.hpp> @@ -434,6 +435,26 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic ); if( aGraphicUrl.getLength() > 0 ) rPropMap[ PROP_GraphicURL ] <<= aGraphicUrl; + + // cropping + if ( maBlipProps.moClipRect.has() ) + { + geometry::IntegerRectangle2D oClipRect( maBlipProps.moClipRect.get() ); + awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic ) ); + if ( aOriginalSize.Width && aOriginalSize.Height ) + { + text::GraphicCrop aGraphCrop( 0, 0, 0, 0 ); + if ( oClipRect.X1 ) + aGraphCrop.Left = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 ); + if ( oClipRect.Y1 ) + aGraphCrop.Top = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 ); + if ( oClipRect.X2 ) + aGraphCrop.Right = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 ); + if ( oClipRect.Y2 ) + aGraphCrop.Bottom = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 ); + rPropMap[ PROP_GraphicCrop ] <<= aGraphCrop; + } + } } // color effect diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index 508bba587add..15b1ef0f2404 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -224,7 +224,15 @@ Reference< XFastContextHandler > BlipFillContext::createFastChildContext( return new BlipContext( *this, rxAttribs, mrBlipProps ); case A_TOKEN( srcRect ): - // TODO + { + rtl::OUString aDefault( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "0" ) ) ); + ::com::sun::star::geometry::IntegerRectangle2D aClipRect; + aClipRect.X1 = GetPercent( aAttribs.getString( XML_l, aDefault ) ); + aClipRect.Y1 = GetPercent( aAttribs.getString( XML_t, aDefault ) ); + aClipRect.X2 = GetPercent( aAttribs.getString( XML_r, aDefault ) ); + aClipRect.Y2 = GetPercent( aAttribs.getString( XML_b, aDefault ) ); + mrBlipProps.moClipRect = aClipRect; + } break; case A_TOKEN( tile ): diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index abd8ae826243..50aeac9c884a 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XUnitConversion.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/graphic/GraphicObject.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> @@ -346,6 +347,19 @@ OUString GraphicHelper::importEmbeddedGraphicObject( const OUString& rStreamName return xGraphic.is() ? createGraphicObject( xGraphic ) : OUString(); } +Size GraphicHelper::getOriginalSize( const Reference< XGraphic >& xGraphic ) const +{ + Size aSizeHmm; + PropertySet aPropSet( xGraphic ); + if( aPropSet.getProperty( aSizeHmm, PROP_Size100thMM ) && (aSizeHmm.Width == 0) && (aSizeHmm.Height == 0) ) // MAPMODE_PIXEL used? + { + Size aSizePixel( 0, 0 ); + if( aPropSet.getProperty( aSizePixel, PROP_SizePixel ) ) + aSizeHmm = convertScreenPixelToHmm( aSizePixel ); + } + return aSizeHmm; +} + // ============================================================================ } // namespace oox diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index cfbb2db2bece..1d25abe5c941 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -142,7 +142,14 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); } break; + case PPT_TOKEN( bgRef ): // a:CT_StyleMatrixReference + { + FillPropertiesPtr pFillPropertiesPtr( new FillProperties( + *mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) ); + xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColorRef() ) ); + mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); + } break; case PPT_TOKEN( clrMap ): // CT_ColorMapping diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 6f1ba8757d21..7f8fba345bd6 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -171,12 +171,17 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase ) { try { + sal_Int32 nPhClr = API_RGB_TRANSPARENT; + if ( maBackgroundColorRef.isUsed() ) + nPhClr = maBackgroundColorRef.getColor( rFilterBase.getGraphicHelper() ); + PropertyMap aPropMap; static const rtl::OUString sBackground( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ); uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() ); PropertySet aPropSet( xPropertySet ); - mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() ); + mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), + rFilterBase.getGraphicHelper(), oox::drawingml::FillProperties::DEFAULT_IDS, 0, nPhClr ); xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) ); } catch( Exception ) diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index dbbc9de4e0eb..4a4f4c0e0e88 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -173,6 +173,7 @@ Geometry3D GradientName Graphic GraphicColorMode +GraphicCrop GraphicSize GraphicURL GridColor diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk index 8bbf8a3650f2..329ced792164 100644 --- a/oox/util/makefile.mk +++ b/oox/util/makefile.mk @@ -94,3 +94,11 @@ DEFLIB1NAME =$(TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/oox.component + +$(MISC)/oox.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + oox.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt oox.component diff --git a/oox/util/oox.component b/oox/util/oox.component new file mode 100644 index 000000000000..686ee6f1728e --- /dev/null +++ b/oox/util/oox.component @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Impress.oox.PowerPointImport"> + <service name="com.sun.star.comp.ooxpptx"/> + </implementation> + <implementation name="com.sun.star.comp.oox.BiffDetector"> + <service name="com.sun.star.frame.ExtendedTypeDetection"/> + </implementation> + <implementation name="com.sun.star.comp.oox.ExcelBiffFilter"> + <service name="com.sun.star.comp.oox.ExcelBiffFilter"/> + </implementation> + <implementation name="com.sun.star.comp.oox.ExcelFilter"> + <service name="com.sun.star.comp.oox.ExcelFilter"/> + </implementation> + <implementation name="com.sun.star.comp.oox.FastTokenHandlerService"> + <service name="com.sun.star.xml.sax.FastTokenHandler"/> + </implementation> + <implementation name="com.sun.star.comp.oox.FormatDetector"> + <service name="com.sun.star.frame.ExtendedTypeDetection"/> + </implementation> + <implementation name="com.sun.star.comp.oox.OOXMLFormulaParser"> + <service name="com.sun.star.sheet.FilterFormulaParser"/> + </implementation> + <implementation name="com.sun.star.comp.oox.ShapeContextHandler"> + <service name="com.sun.star.xml.sax.FastShapeContextHandler"/> + </implementation> + <implementation name="com.sun.star.comp.oox.docprop.OOXMLDocumentPropertiesImporter"> + <service name="com.sun.star.document.OOXMLDocumentPropertiesImporter"/> + </implementation> +</component> |