[Libreoffice-commits] core.git: xmloff/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Nov 15 12:06:54 UTC 2017
xmloff/source/chart/SchXMLPlotAreaContext.cxx | 196 +-
xmloff/source/core/xmlexp.cxx | 107 -
xmloff/source/draw/XMLImageMapExport.cxx | 213 +-
xmloff/source/draw/sdxmlexp.cxx | 35
xmloff/source/draw/shapeexport.cxx | 1493 ++++++++--------
xmloff/source/draw/xexptran.cxx | 45
xmloff/source/draw/ximpshap.cxx | 81
xmloff/source/forms/elementimport.cxx | 167 -
xmloff/source/style/prstylei.cxx | 128 -
xmloff/source/style/xmlaustp.cxx | 125 -
xmloff/source/text/XMLFootnoteImportContext.cxx | 115 -
xmloff/source/text/XMLIndexMarkExport.cxx | 151 -
xmloff/source/text/XMLIndexTOCContext.cxx | 199 +-
xmloff/source/text/XMLSectionSourceDDEImportContext.cxx | 41
xmloff/source/text/txtimp.cxx | 145 -
xmloff/source/text/txtparae.cxx | 117 -
xmloff/source/text/txtstyli.cxx | 375 ++--
17 files changed, 1880 insertions(+), 1853 deletions(-)
New commits:
commit 5f4938d89d641681346001746f3762dffcb831b4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Nov 15 10:03:54 2017 +0200
loplugin:flatten in xmloff
Change-Id: I782278b8a633094b96788f81ae7066a45d45b5fe
Reviewed-on: https://gerrit.libreoffice.org/44750
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 9209efa07ce0..875d3468fb49 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -869,45 +869,46 @@ static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocume
uno::Reference< chart2::data::XDataSequence > xNewSequence(
xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
- if( xNewSequence.is())
- {
- SchXMLTools::setXMLRangePropertyAtDataSequence(xNewSequence,aXMLRange);
+ if( !xNewSequence.is())
+ return;
- OUStringBuffer aRoleBuffer("error-bars-");
- if( bYError )
- aRoleBuffer.append( 'y' );
- else
- aRoleBuffer.append( 'x');
+ SchXMLTools::setXMLRangePropertyAtDataSequence(xNewSequence,aXMLRange);
- aRoleBuffer.append( '-' );
+ OUStringBuffer aRoleBuffer("error-bars-");
+ if( bYError )
+ aRoleBuffer.append( 'y' );
+ else
+ aRoleBuffer.append( 'x');
- if( bPositiveValue )
- aRoleBuffer = aRoleBuffer.append( "positive" );
- else
- aRoleBuffer = aRoleBuffer.append( "negative" );
+ aRoleBuffer.append( '-' );
- OUString aRole = aRoleBuffer.makeStringAndClear();
+ if( bPositiveValue )
+ aRoleBuffer = aRoleBuffer.append( "positive" );
+ else
+ aRoleBuffer = aRoleBuffer.append( "negative" );
- Reference< beans::XPropertySet > xSeqProp( xNewSequence, uno::UNO_QUERY );
+ OUString aRole = aRoleBuffer.makeStringAndClear();
- xSeqProp->setPropertyValue("Role", uno::makeAny( aRole ));
+ Reference< beans::XPropertySet > xSeqProp( xNewSequence, uno::UNO_QUERY );
- Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ xSeqProp->setPropertyValue("Role", uno::makeAny( aRole ));
- Reference< chart2::data::XLabeledDataSequence > xLabelSeq( chart2::data::LabeledDataSequence::create(xContext),
- uno::UNO_QUERY_THROW );
+ Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- rSequences.emplace( tSchXMLIndexWithPart( -2, SCH_XML_PART_ERROR_BARS ), xLabelSeq );
+ Reference< chart2::data::XLabeledDataSequence > xLabelSeq( chart2::data::LabeledDataSequence::create(xContext),
+ uno::UNO_QUERY_THROW );
- xLabelSeq->setValues( xNewSequence );
+ rSequences.emplace( tSchXMLIndexWithPart( -2, SCH_XML_PART_ERROR_BARS ), xLabelSeq );
- uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
- xDataSource->getDataSequences());
+ xLabelSeq->setValues( xNewSequence );
+
+ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
+ xDataSource->getDataSequences());
+
+ aSequences.realloc( aSequences.getLength() + 1 );
+ aSequences[ aSequences.getLength() - 1 ] = xLabelSeq;
+ xDataSink->setData( aSequences );
- aSequences.realloc( aSequences.getLength() + 1 );
- aSequences[ aSequences.getLength() - 1 ] = xLabelSeq;
- xDataSink->setData( aSequences );
- }
}
SchXMLStatisticsObjectContext::SchXMLStatisticsObjectContext(
@@ -962,100 +963,101 @@ void SetErrorBarPropertiesFromStyleName( const OUString& aStyleName, const uno::
uno::Any aAny = SchXMLTools::getPropertyFromContext("ErrorBarStyle",
pSeriesStyleContext,pStylesCtxt);
- if ( aAny.hasValue() )
- {
- sal_Int32 aBarStyle = css::chart::ErrorBarStyle::NONE;
- aAny >>= aBarStyle;
- xBarProp->setPropertyValue("ErrorBarStyle", aAny);
+ if ( !aAny.hasValue() )
+ return;
- aAny = SchXMLTools::getPropertyFromContext("ShowPositiveError",
- pSeriesStyleContext,pStylesCtxt);
+ sal_Int32 aBarStyle = css::chart::ErrorBarStyle::NONE;
+ aAny >>= aBarStyle;
+ xBarProp->setPropertyValue("ErrorBarStyle", aAny);
- if(aAny.hasValue())
- xBarProp->setPropertyValue("ShowPositiveError",aAny);
+ aAny = SchXMLTools::getPropertyFromContext("ShowPositiveError",
+ pSeriesStyleContext,pStylesCtxt);
- aAny = SchXMLTools::getPropertyFromContext("ShowNegativeError",
- pSeriesStyleContext,pStylesCtxt);
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("ShowPositiveError",aAny);
- if(aAny.hasValue())
- xBarProp->setPropertyValue("ShowNegativeError",aAny);
+ aAny = SchXMLTools::getPropertyFromContext("ShowNegativeError",
+ pSeriesStyleContext,pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("ShowNegativeError",aAny);
+
+ aAny = SchXMLTools::getPropertyFromContext("PositiveError",
+ pSeriesStyleContext, pStylesCtxt);
- aAny = SchXMLTools::getPropertyFromContext("PositiveError",
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("PositiveError", aAny);
+ else
+ {
+ aAny = SchXMLTools::getPropertyFromContext("ConstantErrorHigh",
pSeriesStyleContext, pStylesCtxt);
if(aAny.hasValue())
xBarProp->setPropertyValue("PositiveError", aAny);
- else
- {
- aAny = SchXMLTools::getPropertyFromContext("ConstantErrorHigh",
- pSeriesStyleContext, pStylesCtxt);
+ }
- if(aAny.hasValue())
- xBarProp->setPropertyValue("PositiveError", aAny);
- }
+ aAny = SchXMLTools::getPropertyFromContext("NegativeError",
+ pSeriesStyleContext, pStylesCtxt);
- aAny = SchXMLTools::getPropertyFromContext("NegativeError",
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("NegativeError", aAny);
+ else
+ {
+ aAny = SchXMLTools::getPropertyFromContext("ConstantErrorLow",
pSeriesStyleContext, pStylesCtxt);
if(aAny.hasValue())
xBarProp->setPropertyValue("NegativeError", aAny);
- else
- {
- aAny = SchXMLTools::getPropertyFromContext("ConstantErrorLow",
- pSeriesStyleContext, pStylesCtxt);
-
- if(aAny.hasValue())
- xBarProp->setPropertyValue("NegativeError", aAny);
- }
+ }
- aAny = SchXMLTools::getPropertyFromContext("ErrorBarRangePositive",
- pSeriesStyleContext, pStylesCtxt);
- if( aAny.hasValue() )
- {
- aAny >>= aPosRange;
- }
+ aAny = SchXMLTools::getPropertyFromContext("ErrorBarRangePositive",
+ pSeriesStyleContext, pStylesCtxt);
+ if( aAny.hasValue() )
+ {
+ aAny >>= aPosRange;
+ }
- aAny = SchXMLTools::getPropertyFromContext("ErrorBarRangeNegative",
- pSeriesStyleContext, pStylesCtxt);
- if( aAny.hasValue() )
- {
- aAny >>= aNegRange;
- }
+ aAny = SchXMLTools::getPropertyFromContext("ErrorBarRangeNegative",
+ pSeriesStyleContext, pStylesCtxt);
+ if( aAny.hasValue() )
+ {
+ aAny >>= aNegRange;
+ }
- aAny = SchXMLTools::getPropertyFromContext("Weight",
- pSeriesStyleContext, pStylesCtxt);
- if( aAny.hasValue() )
- {
- xBarProp->setPropertyValue("Weight", aAny);
- }
+ aAny = SchXMLTools::getPropertyFromContext("Weight",
+ pSeriesStyleContext, pStylesCtxt);
+ if( aAny.hasValue() )
+ {
+ xBarProp->setPropertyValue("Weight", aAny);
+ }
- aAny = SchXMLTools::getPropertyFromContext("PercentageError",
- pSeriesStyleContext, pStylesCtxt);
- if( aAny.hasValue() && aBarStyle == css::chart::ErrorBarStyle::RELATIVE )
- {
- xBarProp->setPropertyValue("PositiveError", aAny);
- xBarProp->setPropertyValue("NegativeError", aAny);
- }
+ aAny = SchXMLTools::getPropertyFromContext("PercentageError",
+ pSeriesStyleContext, pStylesCtxt);
+ if( aAny.hasValue() && aBarStyle == css::chart::ErrorBarStyle::RELATIVE )
+ {
+ xBarProp->setPropertyValue("PositiveError", aAny);
+ xBarProp->setPropertyValue("NegativeError", aAny);
+ }
- switch(aBarStyle)
- {
- case css::chart::ErrorBarStyle::ERROR_MARGIN:
- {
- aAny = SchXMLTools::getPropertyFromContext("NegativeError",
- pSeriesStyleContext,pStylesCtxt);
+ switch(aBarStyle)
+ {
+ case css::chart::ErrorBarStyle::ERROR_MARGIN:
+ {
+ aAny = SchXMLTools::getPropertyFromContext("NegativeError",
+ pSeriesStyleContext,pStylesCtxt);
- xBarProp->setPropertyValue("NegativeError",aAny);
+ xBarProp->setPropertyValue("NegativeError",aAny);
- aAny = SchXMLTools::getPropertyFromContext("PositiveError",
- pSeriesStyleContext,pStylesCtxt);
+ aAny = SchXMLTools::getPropertyFromContext("PositiveError",
+ pSeriesStyleContext,pStylesCtxt);
- xBarProp->setPropertyValue("PositiveError",aAny);
- }
- break;
- default:
- break;
- }
+ xBarProp->setPropertyValue("PositiveError",aAny);
+ }
+ break;
+ default:
+ break;
}
+
}
}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 9df9e78f410c..3dc185ba9a83 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -702,65 +702,66 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen
mxExportInfo = xTmpPropertySet;
}
- if( mxExportInfo.is() )
+ if( !mxExportInfo.is() )
+ return;
+
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo =
+ mxExportInfo->getPropertySetInfo();
+ OUString sPropName(
+ "BaseURI" );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
{
- uno::Reference< beans::XPropertySetInfo > xPropertySetInfo =
- mxExportInfo->getPropertySetInfo();
- OUString sPropName(
- "BaseURI" );
- if( xPropertySetInfo->hasPropertyByName(sPropName) )
- {
- uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
- aAny >>= msOrigFileName;
- mpImpl->msPackageURI = msOrigFileName;
- mpImpl->SetSchemeOf( msOrigFileName );
- }
- OUString sRelPath;
- sPropName = "StreamRelPath";
- if( xPropertySetInfo->hasPropertyByName(sPropName) )
- {
- uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
- aAny >>= sRelPath;
- }
- OUString sName;
- sPropName = "StreamName";
- if( xPropertySetInfo->hasPropertyByName(sPropName) )
- {
- uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
- aAny >>= sName;
- }
- if( !msOrigFileName.isEmpty() && !sName.isEmpty() )
- {
- INetURLObject aBaseURL( msOrigFileName );
- if( !sRelPath.isEmpty() )
- aBaseURL.insertName( sRelPath );
- aBaseURL.insertName( sName );
- msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
- }
- mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= msOrigFileName;
+ mpImpl->msPackageURI = msOrigFileName;
+ mpImpl->SetSchemeOf( msOrigFileName );
+ }
+ OUString sRelPath;
+ sPropName = "StreamRelPath";
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= sRelPath;
+ }
+ OUString sName;
+ sPropName = "StreamName";
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= sName;
+ }
+ if( !msOrigFileName.isEmpty() && !sName.isEmpty() )
+ {
+ INetURLObject aBaseURL( msOrigFileName );
+ if( !sRelPath.isEmpty() )
+ aBaseURL.insertName( sRelPath );
+ aBaseURL.insertName( sName );
+ msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
+ }
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
- // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
- const OUString sOutlineStyleAsNormalListStyle(
- "OutlineStyleAsNormalListStyle" );
- if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) )
- {
- uno::Any aAny = mxExportInfo->getPropertyValue( sOutlineStyleAsNormalListStyle );
- aAny >>= (mpImpl->mbOutlineStyleAsNormalListStyle);
- }
+ // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
+ const OUString sOutlineStyleAsNormalListStyle(
+ "OutlineStyleAsNormalListStyle" );
+ if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue( sOutlineStyleAsNormalListStyle );
+ aAny >>= (mpImpl->mbOutlineStyleAsNormalListStyle);
+ }
- OUString sTargetStorage( "TargetStorage" );
- if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) )
- mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage;
+ OUString sTargetStorage( "TargetStorage" );
+ if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) )
+ mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage;
- const OUString sExportTextNumberElement(
- "ExportTextNumberElement" );
- if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) )
- {
- uno::Any aAny = mxExportInfo->getPropertyValue( sExportTextNumberElement );
- aAny >>= (mpImpl->mbExportTextNumberElement);
- }
+ const OUString sExportTextNumberElement(
+ "ExportTextNumberElement" );
+ if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue( sExportTextNumberElement );
+ aAny >>= (mpImpl->mbExportTextNumberElement);
}
+
}
// XFilter
diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx
index b7de2e30e373..e05ccd1aabee 100644
--- a/xmloff/source/draw/XMLImageMapExport.cxx
+++ b/xmloff/source/draw/XMLImageMapExport.cxx
@@ -127,128 +127,129 @@ void XMLImageMapExport::ExportMapEntry(
const Reference<XPropertySet> & rPropertySet)
{
Reference<XServiceInfo> xServiceInfo(rPropertySet, UNO_QUERY);
- if (xServiceInfo.is())
- {
- enum XMLTokenEnum eType = XML_TOKEN_INVALID;
-
- // distinguish map entries by their service name
- Sequence<OUString> sServiceNames =
- xServiceInfo->getSupportedServiceNames();
- sal_Int32 nLength = sServiceNames.getLength();
- for( sal_Int32 i=0; i<nLength; i++ )
- {
- OUString& rName = sServiceNames[i];
-
- if ( rName == "com.sun.star.image.ImageMapRectangleObject" )
- {
- eType = XML_AREA_RECTANGLE;
- break;
- }
- else if ( rName == "com.sun.star.image.ImageMapCircleObject" )
- {
- eType = XML_AREA_CIRCLE;
- break;
- }
- else if ( rName == "com.sun.star.image.ImageMapPolygonObject" )
- {
- eType = XML_AREA_POLYGON;
- break;
- }
- }
+ if (!xServiceInfo.is())
+ return;
- // return from method if no proper service is found!
- DBG_ASSERT(XML_TOKEN_INVALID != eType,
- "Image map element doesn't support appropriate service!");
- if (XML_TOKEN_INVALID == eType)
- return;
+ enum XMLTokenEnum eType = XML_TOKEN_INVALID;
- // now: handle ImageMapObject properties (those for all types)
+ // distinguish map entries by their service name
+ Sequence<OUString> sServiceNames =
+ xServiceInfo->getSupportedServiceNames();
+ sal_Int32 nLength = sServiceNames.getLength();
+ for( sal_Int32 i=0; i<nLength; i++ )
+ {
+ OUString& rName = sServiceNames[i];
- // XLINK (URL property)
- Any aAny = rPropertySet->getPropertyValue(msURL);
- OUString sHref;
- aAny >>= sHref;
- if (!sHref.isEmpty())
+ if ( rName == "com.sun.star.image.ImageMapRectangleObject" )
{
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(sHref));
+ eType = XML_AREA_RECTANGLE;
+ break;
}
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
-
- // Target property (and xlink:show)
- aAny = rPropertySet->getPropertyValue(msTarget);
- OUString sTargt;
- aAny >>= sTargt;
- if (!sTargt.isEmpty())
+ else if ( rName == "com.sun.star.image.ImageMapCircleObject" )
{
- mrExport.AddAttribute(
- XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, sTargt);
-
- mrExport.AddAttribute(
- XML_NAMESPACE_XLINK, XML_SHOW,
- sTargt == "_blank" ? XML_NEW : XML_REPLACE );
+ eType = XML_AREA_CIRCLE;
+ break;
}
-
- // name
- aAny = rPropertySet->getPropertyValue(msName);
- OUString sItemName;
- aAny >>= sItemName;
- if (!sItemName.isEmpty())
+ else if ( rName == "com.sun.star.image.ImageMapPolygonObject" )
{
- mrExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, sItemName);
+ eType = XML_AREA_POLYGON;
+ break;
}
+ }
- // is-active
- aAny = rPropertySet->getPropertyValue(msIsActive);
- if (! *o3tl::doAccess<bool>(aAny))
- {
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NOHREF, XML_NOHREF);
- }
+ // return from method if no proper service is found!
+ DBG_ASSERT(XML_TOKEN_INVALID != eType,
+ "Image map element doesn't support appropriate service!");
+ if (XML_TOKEN_INVALID == eType)
+ return;
- // call specific rectangle/circle/... method
- // also prepare element name
- switch (eType)
- {
- case XML_AREA_RECTANGLE:
- ExportRectangle(rPropertySet);
- break;
- case XML_AREA_CIRCLE:
- ExportCircle(rPropertySet);
- break;
- case XML_AREA_POLYGON:
- ExportPolygon(rPropertySet);
- break;
- default:
- break;
- }
+ // now: handle ImageMapObject properties (those for all types)
+
+ // XLINK (URL property)
+ Any aAny = rPropertySet->getPropertyValue(msURL);
+ OUString sHref;
+ aAny >>= sHref;
+ if (!sHref.isEmpty())
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(sHref));
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- // write element
- DBG_ASSERT(XML_TOKEN_INVALID != eType,
- "No name?! How did this happen?");
- SvXMLElementExport aAreaElement(mrExport, XML_NAMESPACE_DRAW, eType,
- true/*bWhiteSpace*/, true/*bWhiteSpace*/);
+ // Target property (and xlink:show)
+ aAny = rPropertySet->getPropertyValue(msTarget);
+ OUString sTargt;
+ aAny >>= sTargt;
+ if (!sTargt.isEmpty())
+ {
+ mrExport.AddAttribute(
+ XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, sTargt);
- // title property (as <svg:title> element)
- OUString sTitle;
- rPropertySet->getPropertyValue(msTitle) >>= sTitle;
- if(!sTitle.isEmpty())
- {
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, true/*bWhiteSpace*/, false);
- mrExport.Characters(sTitle);
- }
+ mrExport.AddAttribute(
+ XML_NAMESPACE_XLINK, XML_SHOW,
+ sTargt == "_blank" ? XML_NEW : XML_REPLACE );
+ }
- // description property (as <svg:desc> element)
- OUString sDescription;
- rPropertySet->getPropertyValue(msDescription) >>= sDescription;
- if (!sDescription.isEmpty())
- {
- SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, true/*bWhiteSpace*/, false);
- mrExport.Characters(sDescription);
- }
+ // name
+ aAny = rPropertySet->getPropertyValue(msName);
+ OUString sItemName;
+ aAny >>= sItemName;
+ if (!sItemName.isEmpty())
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, sItemName);
+ }
+
+ // is-active
+ aAny = rPropertySet->getPropertyValue(msIsActive);
+ if (! *o3tl::doAccess<bool>(aAny))
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NOHREF, XML_NOHREF);
+ }
+
+ // call specific rectangle/circle/... method
+ // also prepare element name
+ switch (eType)
+ {
+ case XML_AREA_RECTANGLE:
+ ExportRectangle(rPropertySet);
+ break;
+ case XML_AREA_CIRCLE:
+ ExportCircle(rPropertySet);
+ break;
+ case XML_AREA_POLYGON:
+ ExportPolygon(rPropertySet);
+ break;
+ default:
+ break;
+ }
+
+ // write element
+ DBG_ASSERT(XML_TOKEN_INVALID != eType,
+ "No name?! How did this happen?");
+ SvXMLElementExport aAreaElement(mrExport, XML_NAMESPACE_DRAW, eType,
+ true/*bWhiteSpace*/, true/*bWhiteSpace*/);
- // export events attached to this
- Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
- mrExport.GetEventExport().Export(xSupplier);
+ // title property (as <svg:title> element)
+ OUString sTitle;
+ rPropertySet->getPropertyValue(msTitle) >>= sTitle;
+ if(!sTitle.isEmpty())
+ {
+ SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, true/*bWhiteSpace*/, false);
+ mrExport.Characters(sTitle);
}
+
+ // description property (as <svg:desc> element)
+ OUString sDescription;
+ rPropertySet->getPropertyValue(msDescription) >>= sDescription;
+ if (!sDescription.isEmpty())
+ {
+ SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, true/*bWhiteSpace*/, false);
+ mrExport.Characters(sDescription);
+ }
+
+ // export events attached to this
+ Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
+ mrExport.GetEventExport().Export(xSupplier);
+
// else: no service info -> can't determine type -> ignore entry
}
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index c9734530a2ee..86370e8a118b 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2455,25 +2455,26 @@ void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
{
rProps.realloc(4);
beans::PropertyValue* pProps = rProps.getArray();
- if(pProps)
- {
- Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
- if( !xPropSet.is() )
- return;
+ if(!pProps)
+ return;
- awt::Rectangle aVisArea;
- xPropSet->getPropertyValue("VisibleArea") >>= aVisArea;
+ Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
+ if( !xPropSet.is() )
+ return;
+
+ awt::Rectangle aVisArea;
+ xPropSet->getPropertyValue("VisibleArea") >>= aVisArea;
+
+ sal_uInt16 i = 0;
+ pProps[i].Name = "VisibleAreaTop";
+ pProps[i++].Value <<= aVisArea.Y;
+ pProps[i].Name = "VisibleAreaLeft";
+ pProps[i++].Value <<= aVisArea.X;
+ pProps[i].Name = "VisibleAreaWidth";
+ pProps[i++].Value <<= aVisArea.Width;
+ pProps[i].Name = "VisibleAreaHeight";
+ pProps[i++].Value <<= aVisArea.Height;
- sal_uInt16 i = 0;
- pProps[i].Name = "VisibleAreaTop";
- pProps[i++].Value <<= aVisArea.Y;
- pProps[i].Name = "VisibleAreaLeft";
- pProps[i++].Value <<= aVisArea.X;
- pProps[i].Name = "VisibleAreaWidth";
- pProps[i++].Value <<= aVisArea.Width;
- pProps[i].Name = "VisibleAreaHeight";
- pProps[i++].Value <<= aVisArea.Height;
- }
}
void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 88cc1efd9782..3f7f1d54ec18 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1855,99 +1855,100 @@ void XMLShapeExport::ImpExportTextBoxShape(
XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- // presentation attribute (if presentation)
- bool bIsPresShape(false);
- bool bIsEmptyPresObj(false);
- OUString aStr;
+ if(!xPropSet.is())
+ return;
- switch(eShapeType)
+ // presentation attribute (if presentation)
+ bool bIsPresShape(false);
+ bool bIsEmptyPresObj(false);
+ OUString aStr;
+
+ switch(eShapeType)
+ {
+ case XmlShapeTypePresSubtitleShape:
{
- case XmlShapeTypePresSubtitleShape:
- {
- aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresTitleTextShape:
- {
- aStr = GetXMLToken(XML_PRESENTATION_TITLE);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresOutlinerShape:
- {
- aStr = GetXMLToken(XML_PRESENTATION_OUTLINE);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresNotesShape:
- {
- aStr = GetXMLToken(XML_PRESENTATION_NOTES);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresHeaderShape:
- {
- aStr = GetXMLToken(XML_HEADER);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresFooterShape:
- {
- aStr = GetXMLToken(XML_FOOTER);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresSlideNumberShape:
- {
- aStr = GetXMLToken(XML_PAGE_NUMBER);
- bIsPresShape = true;
- break;
- }
- case XmlShapeTypePresDateTimeShape:
- {
- aStr = GetXMLToken(XML_DATE_TIME);
- bIsPresShape = true;
- break;
- }
- default:
- break;
+ aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE);
+ bIsPresShape = true;
+ break;
}
-
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
-
- if(bIsPresShape)
- bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
-
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
-
- // evtl. corner radius?
- sal_Int32 nCornerRadius(0);
- xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
- if(nCornerRadius)
+ case XmlShapeTypePresTitleTextShape:
{
- OUStringBuffer sStringBuffer;
- mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- nCornerRadius);
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ aStr = GetXMLToken(XML_PRESENTATION_TITLE);
+ bIsPresShape = true;
+ break;
}
-
+ case XmlShapeTypePresOutlinerShape:
{
- // write text-box
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, true, true);
- if(!bIsEmptyPresObj)
- ImpExportText( xShape );
+ aStr = GetXMLToken(XML_PRESENTATION_OUTLINE);
+ bIsPresShape = true;
+ break;
+ }
+ case XmlShapeTypePresNotesShape:
+ {
+ aStr = GetXMLToken(XML_PRESENTATION_NOTES);
+ bIsPresShape = true;
+ break;
+ }
+ case XmlShapeTypePresHeaderShape:
+ {
+ aStr = GetXMLToken(XML_HEADER);
+ bIsPresShape = true;
+ break;
+ }
+ case XmlShapeTypePresFooterShape:
+ {
+ aStr = GetXMLToken(XML_FOOTER);
+ bIsPresShape = true;
+ break;
+ }
+ case XmlShapeTypePresSlideNumberShape:
+ {
+ aStr = GetXMLToken(XML_PAGE_NUMBER);
+ bIsPresShape = true;
+ break;
+ }
+ case XmlShapeTypePresDateTimeShape:
+ {
+ aStr = GetXMLToken(XML_DATE_TIME);
+ bIsPresShape = true;
+ break;
}
+ default:
+ break;
+ }
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ if(bIsPresShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
+
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0);
+ xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
+ if(nCornerRadius)
+ {
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
+ nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
}
+
+ {
+ // write text-box
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, true, true);
+ if(!bIsEmptyPresObj)
+ ImpExportText( xShape );
+ }
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
}
void XMLShapeExport::ImpExportRectangleShape(
@@ -1987,110 +1988,111 @@ void XMLShapeExport::ImpExportLineShape(
XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
+ if(!xPropSet.is())
+ return;
+
+ OUString aStr;
+ OUStringBuffer sStringBuffer;
+ awt::Point aStart(0,0);
+ awt::Point aEnd(1,1);
+
+ // #85920# use 'Geometry' to get the points of the line
+ // since this slot take anchor pos into account.
+
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+ // decompose and correct about pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+ // create base position
+ awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
+
+ // get the two points
+ uno::Any aAny(xPropSet->getPropertyValue("Geometry"));
+ if (auto pSourcePolyPolygon
+ = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
{
- OUString aStr;
- OUStringBuffer sStringBuffer;
- awt::Point aStart(0,0);
- awt::Point aEnd(1,1);
-
- // #85920# use 'Geometry' to get the points of the line
- // since this slot take anchor pos into account.
-
- // get matrix
- ::basegfx::B2DHomMatrix aMatrix;
- ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
-
- // decompose and correct about pRefPoint
- ::basegfx::B2DTuple aTRScale;
- double fTRShear(0.0);
- double fTRRotate(0.0);
- ::basegfx::B2DTuple aTRTranslate;
- ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
-
- // create base position
- awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
-
- // get the two points
- uno::Any aAny(xPropSet->getPropertyValue("Geometry"));
- if (auto pSourcePolyPolygon
- = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
+ drawing::PointSequence* pOuterSequence = const_cast<css::drawing::PointSequenceSequence *>(pSourcePolyPolygon)->getArray();
+ if(pOuterSequence)
{
- drawing::PointSequence* pOuterSequence = const_cast<css::drawing::PointSequenceSequence *>(pSourcePolyPolygon)->getArray();
- if(pOuterSequence)
+ drawing::PointSequence* pInnerSequence = pOuterSequence++;
+ if(pInnerSequence)
{
- drawing::PointSequence* pInnerSequence = pOuterSequence++;
- if(pInnerSequence)
+ awt::Point* pArray = pInnerSequence->getArray();
+ if(pArray)
{
- awt::Point* pArray = pInnerSequence->getArray();
- if(pArray)
+ if(pInnerSequence->getLength() > 0)
{
- if(pInnerSequence->getLength() > 0)
- {
- aStart = awt::Point(
- pArray->X + aBasePosition.X,
- pArray->Y + aBasePosition.Y);
- pArray++;
- }
+ aStart = awt::Point(
+ pArray->X + aBasePosition.X,
+ pArray->Y + aBasePosition.Y);
+ pArray++;
+ }
- if(pInnerSequence->getLength() > 1)
- {
- aEnd = awt::Point(
- pArray->X + aBasePosition.X,
- pArray->Y + aBasePosition.Y);
- }
+ if(pInnerSequence->getLength() > 1)
+ {
+ aEnd = awt::Point(
+ pArray->X + aBasePosition.X,
+ pArray->Y + aBasePosition.Y);
}
}
}
}
+ }
- if( nFeatures & XMLShapeExportFlags::X )
- {
- // svg: x1
- mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- aStart.X);
- aStr = sStringBuffer.makeStringAndClear();
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
- }
- else
- {
- aEnd.X -= aStart.X;
- }
-
- if( nFeatures & XMLShapeExportFlags::Y )
- {
- // svg: y1
- mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- aStart.Y);
- aStr = sStringBuffer.makeStringAndClear();
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
- }
- else
- {
- aEnd.Y -= aStart.Y;
- }
-
- // svg: x2
+ if( nFeatures & XMLShapeExportFlags::X )
+ {
+ // svg: x1
mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- aEnd.X);
+ aStart.X);
aStr = sStringBuffer.makeStringAndClear();
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
+ }
+ else
+ {
+ aEnd.X -= aStart.X;
+ }
- // svg: y2
+ if( nFeatures & XMLShapeExportFlags::Y )
+ {
+ // svg: y1
mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- aEnd.Y);
+ aStart.Y);
aStr = sStringBuffer.makeStringAndClear();
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
+ }
+ else
+ {
+ aEnd.Y -= aStart.Y;
+ }
- // write line
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, true);
+ // svg: x2
+ mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
+ aEnd.X);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
+
+ // svg: y2
+ mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
+ aEnd.Y);
+ aStr = sStringBuffer.makeStringAndClear();
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
+
+ // write line
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, true);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
}
void XMLShapeExport::ImpExportEllipseShape(
@@ -2098,56 +2100,56 @@ void XMLShapeExport::ImpExportEllipseShape(
XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- // get size to decide between Circle and Ellipse
- awt::Size aSize = xShape->getSize();
- sal_Int32 nRx((aSize.Width + 1) / 2);
- sal_Int32 nRy((aSize.Height + 1) / 2);
- bool bCircle(nRx == nRy);
+ if(!xPropSet.is())
+ return;
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ // get size to decide between Circle and Ellipse
+ awt::Size aSize = xShape->getSize();
+ sal_Int32 nRx((aSize.Width + 1) / 2);
+ sal_Int32 nRy((aSize.Height + 1) / 2);
+ bool bCircle(nRx == nRy);
- drawing::CircleKind eKind = drawing::CircleKind_FULL;
- xPropSet->getPropertyValue("CircleKind") >>= eKind;
- if( eKind != drawing::CircleKind_FULL )
- {
- OUStringBuffer sStringBuffer;
- sal_Int32 nStartAngle = 0;
- sal_Int32 nEndAngle = 0;
- xPropSet->getPropertyValue("CircleStartAngle") >>= nStartAngle;
- xPropSet->getPropertyValue("CircleEndAngle") >>= nEndAngle;
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- const double dStartAngle = nStartAngle / 100.0;
- const double dEndAngle = nEndAngle / 100.0;
+ drawing::CircleKind eKind = drawing::CircleKind_FULL;
+ xPropSet->getPropertyValue("CircleKind") >>= eKind;
+ if( eKind != drawing::CircleKind_FULL )
+ {
+ OUStringBuffer sStringBuffer;
+ sal_Int32 nStartAngle = 0;
+ sal_Int32 nEndAngle = 0;
+ xPropSet->getPropertyValue("CircleStartAngle") >>= nStartAngle;
+ xPropSet->getPropertyValue("CircleEndAngle") >>= nEndAngle;
- // export circle kind
- SvXMLUnitConverter::convertEnum( sStringBuffer, eKind, aXML_CircleKind_EnumMap );
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
+ const double dStartAngle = nStartAngle / 100.0;
+ const double dEndAngle = nEndAngle / 100.0;
- // export start angle
- ::sax::Converter::convertDouble( sStringBuffer, dStartAngle );
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
+ // export circle kind
+ SvXMLUnitConverter::convertEnum( sStringBuffer, eKind, aXML_CircleKind_EnumMap );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
- // export end angle
- ::sax::Converter::convertDouble( sStringBuffer, dEndAngle );
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
- }
+ // export start angle
+ ::sax::Converter::convertDouble( sStringBuffer, dStartAngle );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ // export end angle
+ ::sax::Converter::convertDouble( sStringBuffer, dEndAngle );
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
+ }
- // write ellipse or circle
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
- bCircle ? XML_CIRCLE : XML_ELLIPSE,
- bCreateNewline, true);
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
+ // write ellipse or circle
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
+ bCircle ? XML_CIRCLE : XML_ELLIPSE,
+ bCreateNewline, true);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
- }
}
void XMLShapeExport::ImpExportPolygonShape(
@@ -2155,105 +2157,106 @@ void XMLShapeExport::ImpExportPolygonShape(
XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
- || eShapeType == XmlShapeTypeDrawOpenBezierShape);
+ if(!xPropSet.is())
+ return;
- // get matrix
- ::basegfx::B2DHomMatrix aMatrix;
- ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+ bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
+ || eShapeType == XmlShapeTypeDrawOpenBezierShape);
- // decompose and correct abour pRefPoint
- ::basegfx::B2DTuple aTRScale;
- double fTRShear(0.0);
- double fTRRotate(0.0);
- ::basegfx::B2DTuple aTRTranslate;
- ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+ // get matrix
+ ::basegfx::B2DHomMatrix aMatrix;
+ ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
- // use features and write
- ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
+ // decompose and correct abour pRefPoint
+ ::basegfx::B2DTuple aTRScale;
+ double fTRShear(0.0);
+ double fTRRotate(0.0);
+ ::basegfx::B2DTuple aTRTranslate;
+ ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
- // create and export ViewBox
- awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
- SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+ // use features and write
+ ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ // create and export ViewBox
+ awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
+ SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
- // prepare name (with most used)
- enum ::xmloff::token::XMLTokenEnum eName(XML_PATH);
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- if(bBezier)
- {
- // get PolygonBezier
- uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
- const basegfx::B2DPolyPolygon aPolyPolygon(
- basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*o3tl::doAccess<drawing::PolyPolygonBezierCoords>(aAny)));
+ // prepare name (with most used)
+ enum ::xmloff::token::XMLTokenEnum eName(XML_PATH);
- if(aPolyPolygon.count())
- {
- // complex polygon shape, write as svg:d
- const OUString aPolygonString(
- basegfx::utils::exportToSvgD(
- aPolyPolygon,
- true, // bUseRelativeCoordinates
- false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
- true)); // bHandleRelativeNextPointCompatible
+ if(bBezier)
+ {
+ // get PolygonBezier
+ uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*o3tl::doAccess<drawing::PolyPolygonBezierCoords>(aAny)));
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
- }
- }
- else
+ if(aPolyPolygon.count())
{
- // get non-bezier polygon
- uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
- const basegfx::B2DPolyPolygon aPolyPolygon(
- basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(*o3tl::doAccess<drawing::PointSequenceSequence>(aAny)));
-
- if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
- {
- // simple polygon shape, can be written as svg:points sequence
- const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
- const OUString aPointString(basegfx::utils::exportToSvgPoints(aPolygon));
+ // complex polygon shape, write as svg:d
+ const OUString aPolygonString(
+ basegfx::utils::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+ }
+ }
+ else
+ {
+ // get non-bezier polygon
+ uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(*o3tl::doAccess<drawing::PointSequenceSequence>(aAny)));
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
+ if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
+ {
+ // simple polygon shape, can be written as svg:points sequence
+ const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
+ const OUString aPointString(basegfx::utils::exportToSvgPoints(aPolygon));
- // set name
- eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE;
- }
- else
- {
- // complex polygon shape, write as svg:d
- const OUString aPolygonString(
- basegfx::utils::exportToSvgD(
- aPolyPolygon,
- true, // bUseRelativeCoordinates
- false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
- true)); // bHandleRelativeNextPointCompatible
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
- }
+ // set name
+ eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE;
+ }
+ else
+ {
+ // complex polygon shape, write as svg:d
+ const OUString aPolygonString(
+ basegfx::utils::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
+
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
}
+ }
- // write object, but after attributes are added since this call will
- // consume all of these added attributes and the destructor will close the
- // scope. Also before text is added; this may add sub-scopes as needed
- SvXMLElementExport aOBJ(
- mrExport,
- XML_NAMESPACE_DRAW,
- eName,
- bCreateNewline,
- true);
+ // write object, but after attributes are added since this call will
+ // consume all of these added attributes and the destructor will close the
+ // scope. Also before text is added; this may add sub-scopes as needed
+ SvXMLElementExport aOBJ(
+ mrExport,
+ XML_NAMESPACE_DRAW,
+ eName,
+ bCreateNewline,
+ true);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
}
void XMLShapeExport::ImpExportGraphicObjectShape(
@@ -2261,140 +2264,141 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- bool bIsEmptyPresObj = false;
+ if(!xPropSet.is())
+ return;
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ bool bIsEmptyPresObj = false;
- OUString sImageURL;
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- if(eShapeType == XmlShapeTypePresGraphicObjectShape)
- bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) );
+ OUString sImageURL;
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
+ if(eShapeType == XmlShapeTypePresGraphicObjectShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) );
- const bool bSaveBackwardsCompatible = bool( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE );
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
+
+ const bool bSaveBackwardsCompatible = bool( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE );
- if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ {
+ if( !bIsEmptyPresObj )
{
- if( !bIsEmptyPresObj )
- {
- OUString aStreamURL;
+ OUString aStreamURL;
- xPropSet->getPropertyValue("GraphicStreamURL") >>= aStreamURL;
- xPropSet->getPropertyValue("GraphicURL") >>= sImageURL;
+ xPropSet->getPropertyValue("GraphicStreamURL") >>= aStreamURL;
+ xPropSet->getPropertyValue("GraphicURL") >>= sImageURL;
- OUString aResolveURL( sImageURL );
- const OUString sPackageURL( "vnd.sun.star.Package:" );
+ OUString aResolveURL( sImageURL );
+ const OUString sPackageURL( "vnd.sun.star.Package:" );
- // trying to preserve the filename for embedded images which already have its stream inside the package
- bool bIsEmbeddedImageWithExistingStreamInPackage = false;
- if ( aStreamURL.match( sPackageURL ) )
+ // trying to preserve the filename for embedded images which already have its stream inside the package
+ bool bIsEmbeddedImageWithExistingStreamInPackage = false;
+ if ( aStreamURL.match( sPackageURL ) )
+ {
+ bIsEmbeddedImageWithExistingStreamInPackage = true;
+
+ OUString sRequestedName = aStreamURL.copy( sPackageURL.getLength() );
+ sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
+ if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
+ sRequestedName = sRequestedName.copy( nLastIndex );
+ nLastIndex = sRequestedName.lastIndexOf( '.' );
+ if ( nLastIndex >= 0 )
+ sRequestedName = sRequestedName.copy( 0, nLastIndex );
+ if ( !sRequestedName.isEmpty() )
{
- bIsEmbeddedImageWithExistingStreamInPackage = true;
-
- OUString sRequestedName = aStreamURL.copy( sPackageURL.getLength() );
- sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
- if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
- sRequestedName = sRequestedName.copy( nLastIndex );
- nLastIndex = sRequestedName.lastIndexOf( '.' );
- if ( nLastIndex >= 0 )
- sRequestedName = sRequestedName.copy( 0, nLastIndex );
- if ( !sRequestedName.isEmpty() )
- {
- aResolveURL += "?requestedName=" + sRequestedName;
- }
+ aResolveURL += "?requestedName=" + sRequestedName;
}
+ }
- const OUString aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
+ const OUString aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
- if( !aStr.isEmpty() )
+ if( !aStr.isEmpty() )
+ {
+ // apply possible changed stream URL to embedded image object
+ if ( bIsEmbeddedImageWithExistingStreamInPackage )
{
- // apply possible changed stream URL to embedded image object
- if ( bIsEmbeddedImageWithExistingStreamInPackage )
+ OUString newStreamURL = sPackageURL;
+ if ( aStr[0] == '#' )
{
- OUString newStreamURL = sPackageURL;
- if ( aStr[0] == '#' )
- {
- newStreamURL += aStr.copy( 1, aStr.getLength() - 1 );
- }
- else
- {
- newStreamURL += aStr;
- }
+ newStreamURL += aStr.copy( 1, aStr.getLength() - 1 );
+ }
+ else
+ {
+ newStreamURL += aStr;
+ }
- if (newStreamURL != aStreamURL)
- {
- xPropSet->setPropertyValue("GraphicStreamURL", uno::Any(newStreamURL));
- }
+ if (newStreamURL != aStreamURL)
+ {
+ xPropSet->setPropertyValue("GraphicStreamURL", uno::Any(newStreamURL));
}
-
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
}
- }
- else
- {
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, OUString() );
+
mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
}
+ }
+ else
+ {
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, OUString() );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
- {
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true);
+ {
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true);
- if( !sImageURL.isEmpty() )
- {
- // optional office:binary-data
- mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
- }
- if( !bIsEmptyPresObj )
- ImpExportText( xShape );
+ if( !sImageURL.isEmpty() )
+ {
+ // optional office:binary-data
+ mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
}
-
- //Resolves: fdo#62461 put preferred image first above, followed by
- //fallback here
if( !bIsEmptyPresObj )
+ ImpExportText( xShape );
+ }
+
+ //Resolves: fdo#62461 put preferred image first above, followed by
+ //fallback here
+ if( !bIsEmptyPresObj )
+ {
+ OUString aReplacementUrl;
+ xPropSet->getPropertyValue("ReplacementGraphicURL") >>= aReplacementUrl;
+
+ // If there is no url, then the graphic is empty
+ if(!aReplacementUrl.isEmpty())
{
- OUString aReplacementUrl;
- xPropSet->getPropertyValue("ReplacementGraphicURL") >>= aReplacementUrl;
+ const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl);
- // If there is no url, then the graphic is empty
- if(!aReplacementUrl.isEmpty())
+ if(aStr.getLength())
{
- const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl);
-
- if(aStr.getLength())
- {
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr);
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr);
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
- // xlink:href for replacement, only written for Svg content
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true);
+ // xlink:href for replacement, only written for Svg content
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true);
- // optional office:binary-data
- mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl);
- }
+ // optional office:binary-data
+ mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl);
}
}
}
+ }
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+
+ // image map
+ GetExport().GetImageMapExport().Export( xPropSet );
+ ImpExportDescription( xShape ); // #i68101#
- // image map
- GetExport().GetImageMapExport().Export( xPropSet );
- ImpExportDescription( xShape ); // #i68101#
- }
}
void XMLShapeExport::ImpExportChartShape(
@@ -2749,149 +2753,150 @@ void XMLShapeExport::ImpExportOLE2Shape(
uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
SAL_WARN_IF( !xPropSet.is() || !xNamed.is(), "xmloff", "ole shape is not implementing needed interfaces");
- if(xPropSet.is() && xNamed.is())
- {
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ if(!(xPropSet.is() && xNamed.is()))
+ return;
- bool bIsEmptyPresObj = false;
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- // presentation settings
- if(eShapeType == XmlShapeTypePresOLE2Shape)
- bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
- else if(eShapeType == XmlShapeTypePresChartShape)
- bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
- else if(eShapeType == XmlShapeTypePresSheetShape)
- bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
+ bool bIsEmptyPresObj = false;
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- bool bExportEmbedded(mrExport.getExportFlags() & SvXMLExportFlags::EMBEDDED);
- OUString sPersistName;
- SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
+ // presentation settings
+ if(eShapeType == XmlShapeTypePresOLE2Shape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
+ else if(eShapeType == XmlShapeTypePresChartShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
+ else if(eShapeType == XmlShapeTypePresSheetShape)
+ bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
+
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ bool bExportEmbedded(mrExport.getExportFlags() & SvXMLExportFlags::EMBEDDED);
+ OUString sPersistName;
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
- const bool bSaveBackwardsCompatible = bool( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE );
+ const bool bSaveBackwardsCompatible = bool( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE );
- if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ {
+ if (pAttrList)
{
- if (pAttrList)
- {
- mrExport.AddAttributeList(pAttrList);
- }
+ mrExport.AddAttributeList(pAttrList);
+ }
- OUString sClassId;
- OUString sURL;
- bool bInternal = false;
- xPropSet->getPropertyValue("IsInternal") >>= bInternal;
+ OUString sClassId;
+ OUString sURL;
+ bool bInternal = false;
+ xPropSet->getPropertyValue("IsInternal") >>= bInternal;
- if( !bIsEmptyPresObj )
- {
+ if( !bIsEmptyPresObj )
+ {
- if ( bInternal )
- {
- // OOo internal links have no storage persistence, URL is stored in the XML file
- // the result LinkURL is empty in case the object is not a link
- xPropSet->getPropertyValue("LinkURL") >>= sURL;
- }
+ if ( bInternal )
+ {
+ // OOo internal links have no storage persistence, URL is stored in the XML file
+ // the result LinkURL is empty in case the object is not a link
+ xPropSet->getPropertyValue("LinkURL") >>= sURL;
+ }
- xPropSet->getPropertyValue("PersistName") >>= sPersistName;
- if ( sURL.isEmpty() )
+ xPropSet->getPropertyValue("PersistName") >>= sPersistName;
+ if ( sURL.isEmpty() )
+ {
+ if( !sPersistName.isEmpty() )
{
- if( !sPersistName.isEmpty() )
- {
- sURL = "vnd.sun.star.EmbeddedObject:" + sPersistName;
- }
+ sURL = "vnd.sun.star.EmbeddedObject:" + sPersistName;
}
+ }
- if( !bInternal )
- xPropSet->getPropertyValue("CLSID") >>= sClassId;
+ if( !bInternal )
+ xPropSet->getPropertyValue("CLSID") >>= sClassId;
- if( !sClassId.isEmpty() )
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
+ if( !sClassId.isEmpty() )
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
- if(!bExportEmbedded)
+ if(!bExportEmbedded)
+ {
+ // xlink:href
+ if( !sURL.isEmpty() )
{
- // xlink:href
- if( !sURL.isEmpty() )
- {
- // #96717# in theorie, if we don't have a url we shouldn't even
- // export this ole shape. But practical its to risky right now
- // to change this so we better dispose this on load
- sURL = mrExport.AddEmbeddedObject( sURL );
-
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
- }
+ // #96717# in theorie, if we don't have a url we shouldn't even
+ // export this ole shape. But practical its to risky right now
+ // to change this so we better dispose this on load
+ sURL = mrExport.AddEmbeddedObject( sURL );
+
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
}
}
- else
- {
- // export empty href for empty placeholders to be valid ODF
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, "" );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
- }
+ }
+ else
+ {
+ // export empty href for empty placeholders to be valid ODF
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, "" );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ }
+
+ enum XMLTokenEnum eElem = sClassId.isEmpty() ? XML_OBJECT : XML_OBJECT_OLE ;
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, true, true );
- enum XMLTokenEnum eElem = sClassId.isEmpty() ? XML_OBJECT : XML_OBJECT_OLE ;
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, true, true );
+ // tdf#112547 export text as child of draw:object, where import expects it
+ if (!bIsEmptyPresObj && supportsText(eShapeType))
+ {
+ // #i118485# Add text export, the draw OLE shape allows text now
+ ImpExportText( xShape, TextPNS::EXTENSION );
+ }
- // tdf#112547 export text as child of draw:object, where import expects it
- if (!bIsEmptyPresObj && supportsText(eShapeType))
+ if(bExportEmbedded && !bIsEmptyPresObj)
+ {
+ if(bInternal)
{
- // #i118485# Add text export, the draw OLE shape allows text now
- ImpExportText( xShape, TextPNS::EXTENSION );
+ // embedded XML
+ uno::Reference< lang::XComponent > xComp;
+ xPropSet->getPropertyValue("Model") >>= xComp;
+ SAL_WARN_IF( !xComp.is(), "xmloff", "no xModel for own OLE format" );
+ mrExport.ExportEmbeddedOwnObject( xComp );
}
-
- if(bExportEmbedded && !bIsEmptyPresObj)
+ else
{
- if(bInternal)
- {
- // embedded XML
- uno::Reference< lang::XComponent > xComp;
- xPropSet->getPropertyValue("Model") >>= xComp;
- SAL_WARN_IF( !xComp.is(), "xmloff", "no xModel for own OLE format" );
- mrExport.ExportEmbeddedOwnObject( xComp );
- }
- else
- {
- // embed as Base64
- // this is an alien object ( currently MSOLE is the only supported type of such objects )
- // in case it is not an OASIS format the object should be asked to store replacement image if possible
-
- OUString sURLRequest( sURL );
- if ( !( mrExport.getExportFlags() & SvXMLExportFlags::OASIS ) )
- sURLRequest += "?oasis=false";
- mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
- }
+ // embed as Base64
+ // this is an alien object ( currently MSOLE is the only supported type of such objects )
+ // in case it is not an OASIS format the object should be asked to store replacement image if possible
+
+ OUString sURLRequest( sURL );
+ if ( !( mrExport.getExportFlags() & SvXMLExportFlags::OASIS ) )
+ sURLRequest += "?oasis=false";
+ mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
}
}
- if( !bIsEmptyPresObj )
+ }
+ if( !bIsEmptyPresObj )
+ {
+ OUString sURL( "vnd.sun.star.GraphicObject:" );
+ sURL += sPersistName;
+ if( !bExportEmbedded )
{
- OUString sURL( "vnd.sun.star.GraphicObject:" );
- sURL += sPersistName;
- if( !bExportEmbedded )
- {
- sURL = GetExport().AddEmbeddedObject( sURL );
- mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
- }
-
- SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
- XML_IMAGE, false, true );
-
- if( bExportEmbedded )
- GetExport().AddEmbeddedObjectAsBase64( sURL );
+ sURL = GetExport().AddEmbeddedObject( sURL );
+ mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
}
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportDescription( xShape ); // #i68101#
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
+ XML_IMAGE, false, true );
+
+ if( bExportEmbedded )
+ GetExport().AddEmbeddedObjectAsBase64( sURL );
}
+
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportDescription( xShape ); // #i68101#
+
}
void XMLShapeExport::ImpExportPageShape(
@@ -2935,49 +2940,50 @@ void XMLShapeExport::ImpExportCaptionShape(
XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
+ if(!xPropSet.is())
+ return;
+
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+
+ // evtl. corner radius?
+ sal_Int32 nCornerRadius(0);
+ xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
+ if(nCornerRadius)
{
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ OUStringBuffer sStringBuffer;
+ mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
+ nCornerRadius);
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
+ }
- // evtl. corner radius?
- sal_Int32 nCornerRadius(0);
- xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
- if(nCornerRadius)
- {
- OUStringBuffer sStringBuffer;
- mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
- nCornerRadius);
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
- }
+ awt::Point aCaptionPoint;
+ xPropSet->getPropertyValue("CaptionPoint") >>= aCaptionPoint;
- awt::Point aCaptionPoint;
- xPropSet->getPropertyValue("CaptionPoint") >>= aCaptionPoint;
+ mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
+ aCaptionPoint.X);
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
+ aCaptionPoint.Y);
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
- mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
- aCaptionPoint.X);
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
- mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
- aCaptionPoint.Y);
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
+ // write Caption shape. Add export later.
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ bool bAnnotation( (nFeatures & XMLShapeExportFlags::ANNOTATION) == XMLShapeExportFlags::ANNOTATION );
- // write Caption shape. Add export later.
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- bool bAnnotation( (nFeatures & XMLShapeExportFlags::ANNOTATION) == XMLShapeExportFlags::ANNOTATION );
+ SvXMLElementExport aObj( mrExport,
+ (bAnnotation ? XML_NAMESPACE_OFFICE
+ : XML_NAMESPACE_DRAW),
+ (bAnnotation ? XML_ANNOTATION : XML_CAPTION),
+ bCreateNewline, true );
- SvXMLElementExport aObj( mrExport,
- (bAnnotation ? XML_NAMESPACE_OFFICE
- : XML_NAMESPACE_DRAW),
- (bAnnotation ? XML_ANNOTATION : XML_CAPTION),
- bCreateNewline, true );
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ if( bAnnotation )
+ mrExport.exportAnnotationMeta( xShape );
+ ImpExportText( xShape );
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- if( bAnnotation )
- mrExport.exportAnnotationMeta( xShape );
- ImpExportText( xShape );
- }
}
void XMLShapeExport::ImpExportFrameShape(
@@ -2985,33 +2991,34 @@ void XMLShapeExport::ImpExportFrameShape(
XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ if(!xPropSet.is())
+ return;
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- // export frame url
- OUString aStr;
- xPropSet->getPropertyValue("FrameURL") >>= aStr;
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
-
- // export name
- xPropSet->getPropertyValue("FrameName") >>= aStr;
- if( !aStr.isEmpty() )
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
-
- // write floating frame
- {
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, true, true);
- }
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
+
+ // export frame url
+ OUString aStr;
+ xPropSet->getPropertyValue("FrameURL") >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export name
+ xPropSet->getPropertyValue("FrameName") >>= aStr;
+ if( !aStr.isEmpty() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
+
+ // write floating frame
+ {
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, true, true);
}
+
}
void XMLShapeExport::ImpExportAppletShape(
@@ -3019,54 +3026,55 @@ void XMLShapeExport::ImpExportAppletShape(
XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ if(!xPropSet.is())
+ return;
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- // export frame url
- OUString aStr;
- xPropSet->getPropertyValue("AppletCodeBase") >>= aStr;
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
-
- // export draw:applet-name
- xPropSet->getPropertyValue("AppletName") >>= aStr;
- if( !aStr.isEmpty() )
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
-
- // export draw:code
- xPropSet->getPropertyValue("AppletCode") >>= aStr;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
-
- // export draw:may-script
- bool bIsScript = false;
- xPropSet->getPropertyValue("AppletIsScript") >>= bIsScript;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
+
+ // export frame url
+ OUString aStr;
+ xPropSet->getPropertyValue("AppletCodeBase") >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export draw:applet-name
+ xPropSet->getPropertyValue("AppletName") >>= aStr;
+ if( !aStr.isEmpty() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
+
+ // export draw:code
+ xPropSet->getPropertyValue("AppletCode") >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
+
+ // export draw:may-script
+ bool bIsScript = false;
+ xPropSet->getPropertyValue("AppletIsScript") >>= bIsScript;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
+ {
+ // write applet
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, true, true);
+
+ // export parameters
+ uno::Sequence< beans::PropertyValue > aCommands;
+ xPropSet->getPropertyValue("AppletCommands") >>= aCommands;
+ const sal_Int32 nCount = aCommands.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
{
- // write applet
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, true, true);
-
- // export parameters
- uno::Sequence< beans::PropertyValue > aCommands;
- xPropSet->getPropertyValue("AppletCommands") >>= aCommands;
- const sal_Int32 nCount = aCommands.getLength();
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- aCommands[nIndex].Value >>= aStr;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
- }
+ aCommands[nIndex].Value >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
}
}
+
}
void XMLShapeExport::ImpExportPluginShape(
@@ -3074,45 +3082,46 @@ void XMLShapeExport::ImpExportPluginShape(
XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
+ if(!xPropSet.is())
+ return;
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- // export plugin url
- OUString aStr;
- xPropSet->getPropertyValue("PluginURL") >>= aStr;
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
+
+ // export plugin url
+ OUString aStr;
+ xPropSet->getPropertyValue("PluginURL") >>= aStr;
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
- // export mime-type
- xPropSet->getPropertyValue("PluginMimeType") >>= aStr;
- if(!aStr.isEmpty())
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
+ // export mime-type
+ xPropSet->getPropertyValue("PluginMimeType") >>= aStr;
+ if(!aStr.isEmpty())
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
+ {
+ // write plugin
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, true, true);
+
+ // export parameters
+ uno::Sequence< beans::PropertyValue > aCommands;
+ xPropSet->getPropertyValue("PluginCommands") >>= aCommands;
+ const sal_Int32 nCount = aCommands.getLength();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
{
- // write plugin
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, true, true);
-
- // export parameters
- uno::Sequence< beans::PropertyValue > aCommands;
- xPropSet->getPropertyValue("PluginCommands") >>= aCommands;
- const sal_Int32 nCount = aCommands.getLength();
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- aCommands[nIndex].Value >>= aStr;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
- }
+ aCommands[nIndex].Value >>= aStr;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
}
}
+
}
static void lcl_CopyStream(
@@ -3188,89 +3197,90 @@ void XMLShapeExport::ImpExportMediaShape(
XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
-
- if(eShapeType == XmlShapeTypePresMediaShape)
- {
- (void)ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
- }
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
- XML_FRAME, bCreateNewline, true );
-
- // export media url
- OUString aMediaURL;
- xPropSet->getPropertyValue("MediaURL") >>= aMediaURL;
- OUString sMimeType;
- xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
-
- OUString const persistentURL =
- lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType);
-
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, persistentURL );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
- mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
-
- // export mime-type
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, sMimeType );
-
- // write plugin
- auto pPluginOBJ = o3tl::make_unique<SvXMLElementExport>(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & XMLShapeExportFlags::NO_WS ), true);
+ if(!xPropSet.is())
+ return;
- // export parameters
- const OUString aFalseStr( "false" ), aTrueStr( "true" );
+ // Transformation
+ ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
- bool bLoop = false;
- const OUString aLoopStr( "Loop" );
- xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
- delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
+ if(eShapeType == XmlShapeTypePresMediaShape)
+ {
+ (void)ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
+ }
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
+ XML_FRAME, bCreateNewline, true );
+
+ // export media url
+ OUString aMediaURL;
+ xPropSet->getPropertyValue("MediaURL") >>= aMediaURL;
+ OUString sMimeType;
+ xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
+
+ OUString const persistentURL =
+ lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType);
+
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, persistentURL );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+ mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+
+ // export mime-type
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, sMimeType );
+
+ // write plugin
+ auto pPluginOBJ = o3tl::make_unique<SvXMLElementExport>(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & XMLShapeExportFlags::NO_WS ), true);
+
+ // export parameters
+ const OUString aFalseStr( "false" ), aTrueStr( "true" );
+
+ bool bLoop = false;
+ const OUString aLoopStr( "Loop" );
+ xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
+
+ bool bMute = false;
+ const OUString aMuteStr( "Mute" );
+ xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
+
+ sal_Int16 nVolumeDB = 0;
+ const OUString aVolumeDBStr( "VolumeDB" );
+ xPropSet->getPropertyValue("VolumeDB") >>= nVolumeDB;
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::number( nVolumeDB ) );
+ delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
+
+ media::ZoomLevel eZoom;
+ const OUString aZoomStr( "Zoom" );
+ OUString aZoomValue;
+ xPropSet->getPropertyValue("Zoom") >>= eZoom;
+ switch( eZoom )
+ {
+ case media::ZoomLevel_ZOOM_1_TO_4 : aZoomValue = "25%"; break;
+ case media::ZoomLevel_ZOOM_1_TO_2 : aZoomValue = "50%"; break;
+ case media::ZoomLevel_ORIGINAL : aZoomValue = "100%"; break;
+ case media::ZoomLevel_ZOOM_2_TO_1 : aZoomValue = "200%"; break;
+ case media::ZoomLevel_ZOOM_4_TO_1 : aZoomValue = "400%"; break;
+ case media::ZoomLevel_FIT_TO_WINDOW: aZoomValue = "fit"; break;
+ case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: aZoomValue = "fixedfit"; break;
+ case media::ZoomLevel_FULLSCREEN : aZoomValue = "fullscreen"; break;
- bool bMute = false;
- const OUString aMuteStr( "Mute" );
- xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
- delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
+ default:
+ break;
+ }
- sal_Int16 nVolumeDB = 0;
- const OUString aVolumeDBStr( "VolumeDB" );
- xPropSet->getPropertyValue("VolumeDB") >>= nVolumeDB;
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::number( nVolumeDB ) );
+ if( !aZoomValue.isEmpty() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
-
- media::ZoomLevel eZoom;
- const OUString aZoomStr( "Zoom" );
- OUString aZoomValue;
- xPropSet->getPropertyValue("Zoom") >>= eZoom;
- switch( eZoom )
- {
- case media::ZoomLevel_ZOOM_1_TO_4 : aZoomValue = "25%"; break;
- case media::ZoomLevel_ZOOM_1_TO_2 : aZoomValue = "50%"; break;
- case media::ZoomLevel_ORIGINAL : aZoomValue = "100%"; break;
- case media::ZoomLevel_ZOOM_2_TO_1 : aZoomValue = "200%"; break;
- case media::ZoomLevel_ZOOM_4_TO_1 : aZoomValue = "400%"; break;
- case media::ZoomLevel_FIT_TO_WINDOW: aZoomValue = "fit"; break;
- case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: aZoomValue = "fixedfit"; break;
- case media::ZoomLevel_FULLSCREEN : aZoomValue = "fullscreen"; break;
-
- default:
- break;
- }
-
- if( !aZoomValue.isEmpty() )
- {
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
- delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) );
- }
}
+
}
void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShape >& xShape, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
@@ -4705,37 +4715,38 @@ void XMLShapeExport::ImpExportCustomShape(
XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint )
{
const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if ( xPropSet.is() )
- {
- OUString aStr;
- uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ if ( !xPropSet.is() )
+ return;
- // Transformation
- ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
+ OUString aStr;
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // Transformation
+ ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
- if ( xPropSetInfo.is() )
+ if ( xPropSetInfo.is() )
+ {
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list