[Libreoffice-commits] core.git: include/oox include/svtools oox/source svtools/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Sat Mar 10 01:12:26 UTC 2018
include/oox/export/drawingml.hxx | 13 ---
include/oox/helper/graphichelper.hxx | 20 ----
include/svtools/grfmgr.hxx | 1
oox/source/export/chartexport.cxx | 5 -
oox/source/export/drawingml.cxx | 142 -----------------------------------
oox/source/helper/graphichelper.cxx | 25 ------
svtools/source/graphic/grfmgr.cxx | 24 -----
7 files changed, 1 insertion(+), 229 deletions(-)
New commits:
commit d0b36b780dca966bc5e8682d8dff635072124603
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Mar 9 22:24:31 2018 +0900
oox: remove unused methods that rely on GraphicObject URL
Change-Id: Ie68ccfa8d802bb284da8bb4af69882f4b66a3dac
Reviewed-on: https://gerrit.libreoffice.org/51010
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 115f6d46148c..aa99c95c82e3 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -141,10 +141,6 @@ protected:
const OUString& aName, css::beans::PropertyState& eState );
OUString GetFieldValue( const css::uno::Reference< css::text::XTextRange >& rRun, bool& bIsURLField );
-
- /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
- OUString WriteImage( const OUString& rURL, bool bRelPathToMedia = false);
-
/// Output the media (including copying a video from vnd.sun.star.Package: to the output if necessary).
void WriteMediaNonVisualProperties(const css::uno::Reference<css::drawing::XShape>& xShape);
@@ -186,9 +182,6 @@ public:
void WriteBlipOrNormalFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
const OUString& rURLPropName );
void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
- const OUString& sBitmapURL, sal_Int32 nXmlNamespace,
- bool bWriteMode, bool bRelPathToMedia = false );
- void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
const OUString& sURLPropName );
void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
const OUString& sURLPropName, sal_Int32 nXmlNamespace );
@@ -208,24 +201,18 @@ public:
css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
void WriteOutline( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
- void WriteStretch( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& rURL );
void WriteXGraphicStretch(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
void WriteLinespacing( const css::style::LineSpacing& rLineSpacing );
- OUString WriteBlip( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,
- const OUString& rURL, bool bRelPathToMedia );
-
OUString WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
bool bRelPathToMedia);
void WriteImageBrightnessContrastTransparence(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet);
- void WriteBlipMode( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& rURL );
-
void WriteXGraphicBlipMode(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet,
css::uno::Reference<css::graphic::XGraphic> const & rxGraphic);
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index 84450c2a61b6..399999471442 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -52,14 +52,6 @@ namespace oox {
/** Provides helper functions for colors, device measurement conversion,
graphics, and graphic objects handling.
-
- All createGraphicObject() and importGraphicObject() functions create
- persistent graphic objects internally and store them in an internal
- container to prevent their early destruction. This makes it possible to use
- the returned URL of the graphic object in any way (e.g. insert it into a
- property map) without needing to store it immediately at an object that
- resolves the graphic object from the passed URL and thus prevents it from
- being destroyed.
*/
class OOX_DLLPUBLIC GraphicHelper
{
@@ -132,17 +124,6 @@ public:
/** Imports graphics from the storage with the passed stream names. */
void importEmbeddedGraphics(const std::vector<OUString>& rStreamNames) const;
- /** Creates a persistent graphic object from the passed graphic.
- @return The URL of the created and internally cached graphic object. */
- OUString createGraphicObject(
- const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ) const;
-
- /** Creates a persistent graphic object from the passed input stream.
- @return The URL of the created and internally cached graphic object. */
- OUString importGraphicObject(
- const css::uno::Reference< css::io::XInputStream >& rxInStrm,
- const WmfExternal* pExtHeader ) const;
-
/** calculates the original size of a graphic which is necessary to be able to calculate cropping values
@return The original Graphic size in 100thmm */
css::awt::Size getOriginalSize( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ) const;
@@ -160,7 +141,6 @@ private:
StorageRef mxStorage; ///< Storage containing embedded graphics.
mutable GraphicObjectDeque maGraphicObjects; ///< Caches all created graphic objects to keep them alive.
mutable EmbeddedGraphicMap maEmbeddedGraphics; ///< Maps all embedded graphics by their storage path.
- const OUString maGraphicObjScheme; ///< The URL scheme name for graphic objects.
double mfPixelPerHmmX; ///< Number of screen pixels per 1/100 mm in X direction.
double mfPixelPerHmmY; ///< Number of screen pixels per 1/100 mm in Y direction.
};
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index f4a9d88244b2..c2c70256ceaa 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -465,7 +465,6 @@ public:
void StopAnimation( OutputDevice* pOut = nullptr, long nExtraData = 0 );
static bool isGraphicObjectUniqueIdURL(OUString const & rURL);
- static GraphicObject CreateGraphicObjectFromURL(OUString const & rURL);
// will inspect an object ( e.g. a control ) for any 'ImageURL'
// properties and return these in a vector. Note: this implementation
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<OUString>()) // TODO: Remove, when not used anymore
- {
- OUString sBitmapURL = rValue.get<OUString>();
- 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<XPropertySet>& 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<beans::X
}
}
-OUString DrawingML::WriteBlip( const Reference< XPropertySet >& 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<beans::XPropertySet> const & rXPropSet,
uno::Reference<graphic::XGraphic> const & rxGraphic,
bool bRelPathToMedia)
@@ -1157,27 +1093,6 @@ OUString DrawingML::WriteXGraphicBlip(uno::Reference<beans::XPropertySet> 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<beans::XPropertySet> const & rXPropSet,
uno::Reference<graphic::XGraphic> 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<beans::XPropertySet> const & rXPropSet,
uno::Reference<graphic::XGraphic> const & rxGraphic,
sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia)
@@ -1373,37 +1262,6 @@ void DrawingML::WriteSrcRectXGraphic(uno::Reference<beans::XPropertySet> 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<beans::XPropertySet> const & rXPropSet,
uno::Reference<graphic::XGraphic> 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;
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 5e0c2e57a83b..d025275e39f8 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -1045,30 +1045,6 @@ bool GraphicObject::isGraphicObjectUniqueIdURL(OUString const & rURL)
return rURL.startsWith(aPrefix);
}
-GraphicObject GraphicObject::CreateGraphicObjectFromURL(OUString const & rURL)
-{
- if (GraphicObject::isGraphicObjectUniqueIdURL(rURL))
- {
- SAL_WARN("vcl", "Deprecated URL '" << rURL << "' was used to create a GraphicObject");
-
- // graphic manager url
- OString aUniqueID(OUStringToOString(rURL.copy(sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX) - 1), RTL_TEXTENCODING_UTF8));
- return GraphicObject( aUniqueID );
- }
- else
- {
- Graphic aGraphic;
- if ( !rURL.isEmpty() )
- {
- std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( rURL, StreamMode::READ ));
- if( pStream )
- GraphicConverter::Import( *pStream, aGraphic );
- }
-
- return GraphicObject( aGraphic );
- }
-}
-
void
GraphicObject::InspectForGraphicObjectImageURL( const Reference< XInterface >& xIf, std::vector< OUString >& rvEmbedImgUrls )
{
More information about the Libreoffice-commits
mailing list