From 5a4d6162f643050faf00ccf08d58feed00dcd781 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 5 Mar 2018 17:12:01 +0900 Subject: convert SymbolBitmapURL to SymbolBitmap used in chart2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib35ee5b5890ff5ca30796fc8608f00ff4b6b03e2 Reviewed-on: https://gerrit.libreoffice.org/50788 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- xmloff/source/chart/PropertyMap.hxx | 4 ++-- xmloff/source/chart/PropertyMaps.cxx | 21 +++++++++++++-------- xmloff/source/chart/XMLSymbolImageContext.cxx | 18 +++++++++--------- 3 files changed, 24 insertions(+), 19 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index 93285f84ae77..d81a11993082 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -121,7 +121,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = // if type=="named-symbol" => name of symbol (square, diamond, ...) MAP_ENTRY( "SymbolType", CHART, XML_SYMBOL_NAME, XML_SCH_TYPE_NAMED_SYMBOL | MID_FLAG_MULTI_PROPERTY ), // if type=="image" => an xlink:href element with a linked (package) URI - MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ), + MAP_SPECIAL( "SymbolBitmap", CHART, XML_SYMBOL_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ), MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_WIDTH, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH ), MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_HEIGHT, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT ), MAP_ENTRY( "Vertical", CHART, XML_VERTICAL, XML_TYPE_BOOL ), @@ -251,7 +251,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = MAP_ENTRY( "StackedText", STYLE, XML_DIRECTION, XML_SCH_TYPE_TEXT_ORIENTATION ), // for compatibility to pre 6.0beta documents -// MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE_NAME, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME ), +// MAP_SPECIAL( "SymbolBitmap", CHART, XML_SYMBOL_IMAGE_NAME, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME ), MAP_ENTRY( "ChartUserDefinedAttributes", TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM ), diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 76f4fda22a2b..7c97657f022f 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -289,15 +289,20 @@ void XMLChartExportPropertyMapper::handleElementItem( { case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE: { - OUString aURLStr; - rProperty.maValue >>= aURLStr; + uno::Reference xGraphic; + rProperty.maValue >>= xGraphic; + OUString sInternalURL; // export as XLink reference into the package // if embedding is off - OUString sTempURL( mrExport.AddEmbeddedGraphicObject( aURLStr )); - if( !sTempURL.isEmpty() ) + if (xGraphic.is()) { - mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sTempURL ); + OUString aOutMimeType; + sInternalURL = mrExport.AddEmbeddedXGraphic(xGraphic, aOutMimeType); + } + if (!sInternalURL.isEmpty()) + { + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sInternalURL); } { @@ -310,8 +315,8 @@ void XMLChartExportPropertyMapper::handleElementItem( // export as Base64 embedded graphic // if embedding is on - if( !aURLStr.isEmpty()) - mrExport.AddEmbeddedGraphicObjectAsBase64( aURLStr ); + if (xGraphic.is()) + mrExport.AddEmbeddedXGraphicAsBase64(xGraphic); } } break; @@ -639,7 +644,7 @@ bool XMLChartImportPropertyMapper::handleSpecialItem( // deprecated from 6.0 beta on case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME: - rProperty.maValue <<= mrImport.ResolveGraphicObjectURL( rValue, false ); + rProperty.maValue <<= mrImport.loadGraphicByURL(rValue); break; case XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE: diff --git a/xmloff/source/chart/XMLSymbolImageContext.cxx b/xmloff/source/chart/XMLSymbolImageContext.cxx index d90119809028..4e9fae4a9df5 100644 --- a/xmloff/source/chart/XMLSymbolImageContext.cxx +++ b/xmloff/source/chart/XMLSymbolImageContext.cxx @@ -25,9 +25,9 @@ #include #include #include +#include - -using namespace ::com::sun::star; +using namespace css; enum SvXMLTokenMapAttrs { @@ -115,22 +115,22 @@ SvXMLImportContextRef XMLSymbolImageContext::CreateChildContext( void XMLSymbolImageContext::EndElement() { - OUString sResolvedURL; + uno::Reference xGraphic; - if( !msURL.isEmpty() ) + if (!msURL.isEmpty()) { - sResolvedURL = GetImport().ResolveGraphicObjectURL( msURL, false ); + xGraphic = GetImport().loadGraphicByURL(msURL); } - else if( mxBase64Stream.is() ) + else if (mxBase64Stream.is()) { - sResolvedURL = GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream ); + xGraphic = GetImport().loadGraphicFromBase64(mxBase64Stream); mxBase64Stream = nullptr; } - if( !sResolvedURL.isEmpty()) + if (xGraphic.is()) { // aProp is a member of XMLElementPropertyContext - aProp.maValue <<= sResolvedURL; + aProp.maValue <<= xGraphic; SetInsert( true ); } -- cgit