diff options
author | sj <sj@openoffice.org> | 2010-11-15 17:45:29 +0100 |
---|---|---|
committer | sj <sj@openoffice.org> | 2010-11-15 17:45:29 +0100 |
commit | 296edcbb71fa4f55ffb46a0250aeef5cc6696b87 (patch) | |
tree | d5dfd369ea94c9de2a2c988f7b5fe4f702e9de53 /oox | |
parent | 32d199dcdb1009e5e1ea8995d5728fed75dfdd0a (diff) | |
parent | 9c16b686c71855df1bbcbf1bcc4b175c48abb49c (diff) |
impress202: rebasing
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/core/facreg.cxx | 39 | ||||
-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 | 25 | ||||
-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 |
13 files changed, 144 insertions, 41 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 37002940cb17..1c112efcf923 100644 --- a/oox/inc/oox/helper/graphichelper.hxx +++ b/oox/inc/oox/helper/graphichelper.hxx @@ -148,6 +148,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 31156a56ee84..bcb0c5803d61 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -91,6 +91,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; } @@ -130,6 +131,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 f20db064d7b2..ff13b324d65c 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -40,3 +40,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/core/facreg.cxx b/oox/source/core/facreg.cxx index de6212984093..ed54ae81e7e5 100644 --- a/oox/source/core/facreg.cxx +++ b/oox/source/core/facreg.cxx @@ -77,45 +77,6 @@ OOX_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Ch *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void SAL_CALL writeInfo( registry::XRegistryKey * pRegistryKey, const OUString& rImplementationName, const uno::Sequence< OUString >& rServices ) -{ - uno::Reference< registry::XRegistryKey > xNewKey( - pRegistryKey->createKey( - OUString( sal_Unicode( '/' ) ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) ); - - for( sal_Int32 i = 0; i < rServices.getLength(); i++ ) - xNewKey->createKey( rServices.getConstArray()[i]); -} - -#define WRITEINFO(className)\ - writeInfo( pKey, className##_getImplementationName(), className##_getSupportedServiceNames() ) - -OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKey ) -{ - if( pRegistryKey ) - { - try - { - registry::XRegistryKey *pKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey ); - - WRITEINFO( ::oox::core::FilterDetect ); - WRITEINFO( ::oox::ppt::PowerPointImport ); - WRITEINFO( ::oox::xls::BiffDetector ); - WRITEINFO( ::oox::xls::ExcelFilter ); - WRITEINFO( ::oox::xls::ExcelBiffFilter ); - WRITEINFO( ::oox::shape::ShapeContextHandler ); - WRITEINFO( ::oox::shape::FastTokenHandlerService ); - WRITEINFO( ::oox::docprop::OOXMLDocPropImportImpl ); - WRITEINFO( ::oox::xls::OOXMLFormulaParser ); - } - catch (registry::InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_True; -} - #define SINGLEFACTORY(classname)\ if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\ {\ diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 168055935104..08d001f09a62 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> @@ -435,6 +436,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 b9d7fa7e1142..cb2037294786 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -225,7 +225,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 455778f939f7..ae664cf86668 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -38,6 +38,7 @@ #include <comphelper/seqstream.hxx> #include "tokens.hxx" #include "oox/helper/containerhelper.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> using ::rtl::OUString; using ::com::sun::star::awt::DeviceInfo; @@ -52,6 +53,7 @@ using ::com::sun::star::graphic::GraphicObject; using ::com::sun::star::graphic::XGraphic; using ::com::sun::star::graphic::XGraphicObject; using ::com::sun::star::graphic::XGraphicProvider; +using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::io::XInputStream; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::uno::Exception; @@ -352,6 +354,29 @@ OUString GraphicHelper::importEmbeddedGraphicObject( const OUString& rStreamName return xGraphic.is() ? createGraphicObject( xGraphic ) : OUString(); } +Size GraphicHelper::getOriginalSize( const Reference< XGraphic >& xGraphic ) const +{ + Size aSize100thMM( 0, 0 ); + Reference< XPropertySet > xGraphicPropertySet( xGraphic, UNO_QUERY_THROW ); + if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size100thMM" ) ) ) >>= aSize100thMM ) + { + if ( !aSize100thMM.Width && !aSize100thMM.Height ) + { // MAPMODE_PIXEL USED :-( + Size aSourceSizePixel( 0, 0 ); + if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSourceSizePixel ) + { + const DeviceInfo& rDeviceInfo = getDeviceInfo(); + if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY ) + { + aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX ); + aSize100thMM.Height = static_cast< sal_Int32 >( ( aSourceSizePixel.Height * 100000.0 ) / rDeviceInfo.PixelPerMeterY ); + } + } + } + } + return aSize100thMM; +} + // ============================================================================ } // namespace oox diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 69f32e01e7eb..7e77f5a54938 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -145,7 +145,14 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); } break; + case NMSP_PPT|XML_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 NMSP_PPT|XML_clrMap: // CT_ColorMapping diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index ce99ffc49f19..8555ba371b77 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -173,12 +173,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 da1aeb2ed265..ba51c3577a8e 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -166,6 +166,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> |