From d0b36b780dca966bc5e8682d8dff635072124603 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Fri, 9 Mar 2018 22:24:31 +0900 Subject: oox: remove unused methods that rely on GraphicObject URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie68ccfa8d802bb284da8bb4af69882f4b66a3dac Reviewed-on: https://gerrit.libreoffice.org/51010 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- oox/source/export/chartexport.cxx | 5 -- oox/source/export/drawingml.cxx | 142 ------------------------------------ oox/source/helper/graphichelper.cxx | 25 +------ 3 files changed, 1 insertion(+), 171 deletions(-) (limited to 'oox') diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 207aa722333f..b27aa98edde2 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1335,11 +1335,6 @@ void ChartExport::exportBitmapFill( const Reference< XPropertySet >& xPropSet ) WriteXGraphicBlipFill(xPropSet, xGraphic, XML_a, true, true); } } - else if (rValue.has()) // TODO: Remove, when not used anymore - { - OUString sBitmapURL = rValue.get(); - WriteBlipFill(xPropSet, sBitmapURL, XML_a, true, true); - } } catch (const uno::Exception & rEx) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0a41a7ddfd4a..0398ce49ea78 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -794,37 +794,6 @@ void DrawingML::WriteOutline( const Reference& rXPropSet ) mpFS->endElementNS( XML_a, XML_ln ); } -bool lcl_URLToGraphic(const OUString& rURL, Graphic& rGraphic) -{ - OString aURLBS(OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); - - const char aURLBegin[] = "vnd.sun.star.GraphicObject:"; - sal_Int32 index = aURLBS.indexOf(aURLBegin); - - if ( index != -1 ) - { - rGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic(); - return true; - } - - return false; -} - -OUString DrawingML::WriteImage( const OUString& rURL, bool bRelPathToMedia ) -{ - Graphic aGraphic; - if (lcl_URLToGraphic(rURL, aGraphic)) - { - return WriteImage( aGraphic , bRelPathToMedia ); - } - else - { - // add link to relations - } - - return OUString(); -} - const char* DrawingML::GetComponentDir() { switch ( meDocumentType ) @@ -1086,39 +1055,6 @@ void DrawingML::WriteImageBrightnessContrastTransparence(uno::Reference& rXPropSet, const OUString& rURL, bool bRelPathToMedia ) -{ - OUString sRelId; - BitmapChecksum nChecksum = 0; - if (!rURL.isEmpty() && mpTextExport) - { - Graphic aGraphic; - if (lcl_URLToGraphic(rURL, aGraphic)) - { - nChecksum = aGraphic.GetChecksum(); - sRelId = mpTextExport->FindRelId(nChecksum); - } - } - if (sRelId.isEmpty()) - { - sRelId = WriteImage( rURL, bRelPathToMedia ); - if (!rURL.isEmpty() && mpTextExport) - mpTextExport->CacheRelId(nChecksum, sRelId); - } - - mpFS->startElementNS( XML_a, XML_blip, - FSNS( XML_r, XML_embed), sRelId.toUtf8().getStr(), - FSEND ); - - WriteImageBrightnessContrastTransparence(rXPropSet); - - WriteArtisticEffect( rXPropSet ); - - mpFS->endElementNS( XML_a, XML_blip ); - - return sRelId; -} - OUString DrawingML::WriteXGraphicBlip(uno::Reference const & rXPropSet, uno::Reference const & rxGraphic, bool bRelPathToMedia) @@ -1157,27 +1093,6 @@ OUString DrawingML::WriteXGraphicBlip(uno::Reference const return sRelId; } -void DrawingML::WriteBlipMode( const Reference< XPropertySet >& rXPropSet, const OUString& rURL ) -{ - BitmapMode eBitmapMode( BitmapMode_NO_REPEAT ); - if (GetProperty( rXPropSet, "FillBitmapMode" ) ) - mAny >>= eBitmapMode; - - SAL_INFO("oox.shape", "fill bitmap mode: " << int(eBitmapMode)); - - switch (eBitmapMode) - { - case BitmapMode_REPEAT: - mpFS->singleElementNS( XML_a, XML_tile, FSEND ); - break; - case BitmapMode_STRETCH: - WriteStretch( rXPropSet, rURL ); - break; - default: - break; - } -} - void DrawingML::WriteXGraphicBlipMode(uno::Reference const & rXPropSet, uno::Reference const & rxGraphic) { @@ -1243,32 +1158,6 @@ void DrawingML::WriteBlipFill( const Reference< XPropertySet >& rXPropSet, const } } -void DrawingML::WriteBlipFill( const Reference< XPropertySet >& rXPropSet, const OUString& sBitmapURL, sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia ) -{ - if ( !sBitmapURL.isEmpty() ) - { - SAL_INFO("oox.shape", "URL: " << sBitmapURL); - - mpFS->startElementNS( nXmlNamespace , XML_blipFill, XML_rotWithShape, "0", FSEND ); - - WriteBlip( rXPropSet, sBitmapURL, bRelPathToMedia ); - - if( bWriteMode ) - { - WriteBlipMode( rXPropSet, sBitmapURL ); - } - else if( GetProperty( rXPropSet, "FillBitmapStretch" ) ) - { - bool bStretch = false; - mAny >>= bStretch; - - if( bStretch ) - WriteStretch( rXPropSet, sBitmapURL ); - } - mpFS->endElementNS( nXmlNamespace, XML_blipFill ); - } -} - void DrawingML::WriteXGraphicBlipFill(uno::Reference const & rXPropSet, uno::Reference const & rxGraphic, sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia) @@ -1373,37 +1262,6 @@ void DrawingML::WriteSrcRectXGraphic(uno::Reference const & WriteGraphicCropProperties(rxPropertySet, aOriginalSize, rMapMode); } -void DrawingML::WriteStretch( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& rURL ) -{ - mpFS->startElementNS( XML_a, XML_stretch, FSEND ); - - bool bCrop = false; - if ( GetProperty( rXPropSet, "GraphicCrop" ) ) - { - css::text::GraphicCrop aGraphicCropStruct; - mAny >>= aGraphicCropStruct; - - if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 != aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) ) - { - Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( rURL ).GetPrefSize() ); - mpFS->singleElementNS( XML_a, XML_fillRect, - XML_l, I32S(((aGraphicCropStruct.Left) * 100000)/aOriginalSize.Width()), - XML_t, I32S(((aGraphicCropStruct.Top) * 100000)/aOriginalSize.Height()), - XML_r, I32S(((aGraphicCropStruct.Right) * 100000)/aOriginalSize.Width()), - XML_b, I32S(((aGraphicCropStruct.Bottom) * 100000)/aOriginalSize.Height()), - FSEND ); - bCrop = true; - } - } - - if( !bCrop ) - { - mpFS->singleElementNS( XML_a, XML_fillRect, FSEND ); - } - - mpFS->endElementNS( XML_a, XML_stretch ); -} - void DrawingML::WriteXGraphicStretch(uno::Reference const & rXPropSet, uno::Reference const & rxGraphic) { diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index fdefc8ad2de6..7f4262de787c 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -64,8 +64,7 @@ inline sal_Int32 lclConvertScreenPixelToHmm( double fPixel, double fPixelPerHmm GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rxTargetFrame, const StorageRef& rxStorage ) : mxContext( rxContext ), - mxStorage( rxStorage ), - maGraphicObjScheme( "vnd.sun.star.GraphicObject:" ) + mxStorage( rxStorage ) { OSL_ENSURE( mxContext.is(), "GraphicHelper::GraphicHelper - missing component context" ); if( mxContext.is() ) @@ -350,28 +349,6 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr return xGraphic; } -OUString GraphicHelper::createGraphicObject( const Reference< XGraphic >& rxGraphic ) const -{ - OUString aGraphicObjUrl; - if( mxContext.is() && rxGraphic.is() ) try - { - Reference< XGraphicObject > xGraphicObj( graphic::GraphicObject::create( mxContext ), UNO_SET_THROW ); - xGraphicObj->setGraphic( rxGraphic ); - maGraphicObjects.push_back( xGraphicObj ); - aGraphicObjUrl = maGraphicObjScheme + xGraphicObj->getUniqueID(); - } - catch( Exception& ) - { - } - return aGraphicObjUrl; -} - -OUString GraphicHelper::importGraphicObject( const Reference< XInputStream >& rxInStrm, - const WmfExternal* pExtHeader ) const -{ - return createGraphicObject( importGraphic( rxInStrm, pExtHeader ) ); -} - awt::Size GraphicHelper::getOriginalSize( const Reference< XGraphic >& xGraphic ) const { awt::Size aSizeHmm; -- cgit