summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 10:03:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 13:06:13 +0100
commit5f4938d89d641681346001746f3762dffcb831b4 (patch)
tree5e5f8d5bbf505cc9dafd7e9b2358f874c6f41774 /xmloff
parent5b74eb68113d3721e1a3f9fa40024bf9b2a15f0c (diff)
loplugin:flatten in xmloff
Change-Id: I782278b8a633094b96788f81ae7066a45d45b5fe Reviewed-on: https://gerrit.libreoffice.org/44750 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx196
-rw-r--r--xmloff/source/core/xmlexp.cxx107
-rw-r--r--xmloff/source/draw/XMLImageMapExport.cxx213
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx35
-rw-r--r--xmloff/source/draw/shapeexport.cxx1493
-rw-r--r--xmloff/source/draw/xexptran.cxx45
-rw-r--r--xmloff/source/draw/ximpshap.cxx81
-rw-r--r--xmloff/source/forms/elementimport.cxx167
-rw-r--r--xmloff/source/style/prstylei.cxx128
-rw-r--r--xmloff/source/style/xmlaustp.cxx125
-rw-r--r--xmloff/source/text/XMLFootnoteImportContext.cxx115
-rw-r--r--xmloff/source/text/XMLIndexMarkExport.cxx151
-rw-r--r--xmloff/source/text/XMLIndexTOCContext.cxx199
-rw-r--r--xmloff/source/text/XMLSectionSourceDDEImportContext.cxx41
-rw-r--r--xmloff/source/text/txtimp.cxx145
-rw-r--r--xmloff/source/text/txtparae.cxx117
-rw-r--r--xmloff/source/text/txtstyli.cxx375
17 files changed, 1880 insertions, 1853 deletions
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) );
+
+ 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 );
+ 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;
- }
-
- if (newStreamURL != aStreamURL)
- {
- xPropSet->setPropertyValue("GraphicStreamURL", uno::Any(newStreamURL));
- }
+ newStreamURL += aStr.copy( 1, aStr.getLength() - 1 );
+ }
+ else
+ {
+ newStreamURL += 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 );
+ if (newStreamURL != aStreamURL)
+ {
+ xPropSet->setPropertyValue("GraphicStreamURL", uno::Any(newStreamURL));
+ }
}
- }
- 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) );
- const bool bSaveBackwardsCompatible = bool( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE );
+ 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 );
- if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
+ const bool bSaveBackwardsCompatible = bool( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE );
+
+ 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 mime-type
- xPropSet->getPropertyValue("PluginMimeType") >>= aStr;
- if(!aStr.isEmpty())
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
+ // 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 );
+
+ {
+ // 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() );
- if ( xPropSetInfo.is() )
+ // Transformation
+ ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
+
+ if ( xPropSetInfo.is() )
+ {
+ if ( xPropSetInfo->hasPropertyByName( "CustomShapeEngine" ) )
{
- if ( xPropSetInfo->hasPropertyByName( "CustomShapeEngine" ) )
- {
- uno::Any aEngine( xPropSet->getPropertyValue( "CustomShapeEngine" ) );
- if ( ( aEngine >>= aStr ) && !aStr.isEmpty() )
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENGINE, aStr );
- }
- if ( xPropSetInfo->hasPropertyByName( "CustomShapeData" ) )
- {
- uno::Any aData( xPropSet->getPropertyValue( "CustomShapeData" ) );
- if ( ( aData >>= aStr ) && !aStr.isEmpty() )
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DATA, aStr );
- }
+ uno::Any aEngine( xPropSet->getPropertyValue( "CustomShapeEngine" ) );
+ if ( ( aEngine >>= aStr ) && !aStr.isEmpty() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENGINE, aStr );
+ }
+ if ( xPropSetInfo->hasPropertyByName( "CustomShapeData" ) )
+ {
+ uno::Any aData( xPropSet->getPropertyValue( "CustomShapeData" ) );
+ if ( ( aData >>= aStr ) && !aStr.isEmpty() )
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DATA, aStr );
}
- bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
- SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, true );
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- ImpExportEnhancedGeometry( mrExport, xPropSet );
}
+ bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
+ SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, true );
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ ImpExportEnhancedGeometry( mrExport, xPropSet );
+
}
void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint )
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index b03240851516..4601f35b485d 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -1021,36 +1021,37 @@ SdXMLImExViewBox::SdXMLImExViewBox(const OUString& rNew, const SvXMLUnitConverte
mfW( 1000.0 ),
mfH( 1000.0 )
{
- if(!msString.isEmpty())
- {
- const OUString aStr = msString;
- const sal_Int32 nLen(aStr.getLength());
- sal_Int32 nPos(0);
+ if(msString.isEmpty())
+ return;
- // skip starting spaces
- Imp_SkipSpaces(aStr, nPos, nLen);
+ const OUString aStr = msString;
+ const sal_Int32 nLen(aStr.getLength());
+ sal_Int32 nPos(0);
- // get mX, #100617# be prepared for doubles
- mfX = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfX);
+ // skip starting spaces
+ Imp_SkipSpaces(aStr, nPos, nLen);
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ // get mX, #100617# be prepared for doubles
+ mfX = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfX);
- // get mY, #100617# be prepared for doubles
- mfY = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfY);
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ // get mY, #100617# be prepared for doubles
+ mfY = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfY);
- // get mW, #100617# be prepared for doubles
- mfW = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfW);
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+ // get mW, #100617# be prepared for doubles
+ mfW = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfW);
+
+ // skip spaces and commas
+ Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+
+ // get mH, #100617# be prepared for doubles
+ mfH = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfH);
- // get mH, #100617# be prepared for doubles
- mfH = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfH);
- }
}
const OUString& SdXMLImExViewBox::GetExportString()
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index c0864e683761..2f4f873a9cf4 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1051,55 +1051,56 @@ void SdXMLLineShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib
// create necessary shape (Line Shape)
AddShape("com.sun.star.drawing.PolyLineShape");
- if(mxShape.is())
- {
- // Add, set Style and properties from base shape
- SetStyle();
- SetLayer();
+ if(!mxShape.is())
+ return;
- // get sizes and offsets
- awt::Point aTopLeft(mnX1, mnY1);
- awt::Point aBottomRight(mnX2, mnY2);
+ // Add, set Style and properties from base shape
+ SetStyle();
+ SetLayer();
- if(mnX1 > mnX2)
- {
- aTopLeft.X = mnX2;
- aBottomRight.X = mnX1;
- }
+ // get sizes and offsets
+ awt::Point aTopLeft(mnX1, mnY1);
+ awt::Point aBottomRight(mnX2, mnY2);
- if(mnY1 > mnY2)
- {
- aTopLeft.Y = mnY2;
- aBottomRight.Y = mnY1;
- }
+ if(mnX1 > mnX2)
+ {
+ aTopLeft.X = mnX2;
+ aBottomRight.X = mnX1;
+ }
- // set local parameters on shape
- uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
- if(xPropSet.is())
- {
- drawing::PointSequenceSequence aPolyPoly(1);
- drawing::PointSequence* pOuterSequence = aPolyPoly.getArray();
- pOuterSequence->realloc(2);
- awt::Point* pInnerSequence = pOuterSequence->getArray();
+ if(mnY1 > mnY2)
+ {
+ aTopLeft.Y = mnY2;
+ aBottomRight.Y = mnY1;
+ }
- *pInnerSequence = awt::Point( mnX1 - aTopLeft.X, mnY1 - aTopLeft.Y);
- pInnerSequence++;
- *pInnerSequence = awt::Point( mnX2 - aTopLeft.X, mnY2 - aTopLeft.Y);
+ // set local parameters on shape
+ uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ drawing::PointSequenceSequence aPolyPoly(1);
+ drawing::PointSequence* pOuterSequence = aPolyPoly.getArray();
+ pOuterSequence->realloc(2);
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
- xPropSet->setPropertyValue("Geometry", Any(aPolyPoly));
- }
+ *pInnerSequence = awt::Point( mnX1 - aTopLeft.X, mnY1 - aTopLeft.Y);
+ pInnerSequence++;
+ *pInnerSequence = awt::Point( mnX2 - aTopLeft.X, mnY2 - aTopLeft.Y);
- // set sizes for transformation
- maSize.Width = aBottomRight.X - aTopLeft.X;
- maSize.Height = aBottomRight.Y - aTopLeft.Y;
- maPosition.X = aTopLeft.X;
- maPosition.Y = aTopLeft.Y;
+ xPropSet->setPropertyValue("Geometry", Any(aPolyPoly));
+ }
- // set pos, size, shear and rotate and get copy of matrix
- SetTransformation();
+ // set sizes for transformation
+ maSize.Width = aBottomRight.X - aTopLeft.X;
+ maSize.Height = aBottomRight.Y - aTopLeft.Y;
+ maPosition.X = aTopLeft.X;
+ maPosition.Y = aTopLeft.Y;
+
+ // set pos, size, shear and rotate and get copy of matrix
+ SetTransformation();
+
+ SdXMLShapeContext::StartElement(xAttrList);
- SdXMLShapeContext::StartElement(xAttrList);
- }
}
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 66e436c37f11..74775302105e 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -807,111 +807,112 @@ namespace xmloff
// let the base class handle all the attributes
OElementImport::StartElement(xAttributes);
- if ( !m_aValueProperties.empty() && m_xElement.is())
+ if ( m_aValueProperties.empty() || !m_xElement.is())
+ return;
+
+ // get the property set info
+ if (!m_xInfo.is())
{
- // get the property set info
- if (!m_xInfo.is())
- {
- OSL_FAIL("OControlImport::StartElement: no PropertySetInfo!");
- return;
- }
+ OSL_FAIL("OControlImport::StartElement: no PropertySetInfo!");
+ return;
+ }
- const sal_Char* pValueProperty = nullptr;
- const sal_Char* pCurrentValueProperty = nullptr;
- const sal_Char* pMinValueProperty = nullptr;
- const sal_Char* pMaxValueProperty = nullptr;
+ const sal_Char* pValueProperty = nullptr;
+ const sal_Char* pCurrentValueProperty = nullptr;
+ const sal_Char* pMinValueProperty = nullptr;
+ const sal_Char* pMaxValueProperty = nullptr;
- bool bRetrievedValues = false;
- bool bRetrievedValueLimits = false;
+ bool bRetrievedValues = false;
+ bool bRetrievedValueLimits = false;
- // get the class id of our element
- sal_Int16 nClassId = FormComponentType::CONTROL;
- m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
+ // get the class id of our element
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
- // translate the value properties we collected in handleAttributes
- PropertyValueArray::iterator aEnd = m_aValueProperties.end();
- for ( PropertyValueArray::iterator aValueProps = m_aValueProperties.begin();
- aValueProps != aEnd;
- ++aValueProps
- )
+ // translate the value properties we collected in handleAttributes
+ PropertyValueArray::iterator aEnd = m_aValueProperties.end();
+ for ( PropertyValueArray::iterator aValueProps = m_aValueProperties.begin();
+ aValueProps != aEnd;
+ ++aValueProps
+ )
+ {
+ bool bSuccess = false;
+ switch (aValueProps->Handle)
{
- bool bSuccess = false;
- switch (aValueProps->Handle)
+ case PROPID_VALUE:
+ case PROPID_CURRENT_VALUE:
{
- case PROPID_VALUE:
- case PROPID_CURRENT_VALUE:
+ // get the property names
+ if (!bRetrievedValues)
{
- // get the property names
- if (!bRetrievedValues)
- {
- getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty);
- if ( !pCurrentValueProperty && !pValueProperty )
- {
- SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value property names!" );
- break;
- }
-
- bRetrievedValues = true;
- }
- if ( PROPID_VALUE == aValueProps->Handle && !pValueProperty )
+ getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty);
+ if ( !pCurrentValueProperty && !pValueProperty )
{
- SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a value property!");
+ SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value property names!" );
break;
}
- if ( PROPID_CURRENT_VALUE == aValueProps->Handle && !pCurrentValueProperty )
- {
- SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a current-value property!");
- break;
- }
+ bRetrievedValues = true;
+ }
+ if ( PROPID_VALUE == aValueProps->Handle && !pValueProperty )
+ {
+ SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a value property!");
+ break;
+ }
- // transfer the name
- if (PROPID_VALUE == aValueProps->Handle)
- aValueProps->Name = OUString::createFromAscii(pValueProperty);
- else
- aValueProps->Name = OUString::createFromAscii(pCurrentValueProperty);
- bSuccess = true;
+ if ( PROPID_CURRENT_VALUE == aValueProps->Handle && !pCurrentValueProperty )
+ {
+ SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a current-value property!");
+ break;
}
- break;
- case PROPID_MIN_VALUE:
- case PROPID_MAX_VALUE:
+
+ // transfer the name
+ if (PROPID_VALUE == aValueProps->Handle)
+ aValueProps->Name = OUString::createFromAscii(pValueProperty);
+ else
+ aValueProps->Name = OUString::createFromAscii(pCurrentValueProperty);
+ bSuccess = true;
+ }
+ break;
+ case PROPID_MIN_VALUE:
+ case PROPID_MAX_VALUE:
+ {
+ // get the property names
+ if (!bRetrievedValueLimits)
{
- // get the property names
- if (!bRetrievedValueLimits)
+ getValueLimitPropertyNames(nClassId, pMinValueProperty, pMaxValueProperty);
+ if ( !pMinValueProperty || !pMaxValueProperty )
{
- getValueLimitPropertyNames(nClassId, pMinValueProperty, pMaxValueProperty);
- if ( !pMinValueProperty || !pMaxValueProperty )
- {
- SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value limit property names!" );
- break;
- }
-
- bRetrievedValueLimits = true;
+ SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value limit property names!" );
+ break;
}
- OSL_ENSURE((PROPID_MIN_VALUE != aValueProps->Handle) || pMinValueProperty,
- "OControlImport::StartElement: the control does not have a value property!");
- OSL_ENSURE((PROPID_MAX_VALUE != aValueProps->Handle) || pMaxValueProperty,
- "OControlImport::StartElement: the control does not have a current-value property!");
-
- // transfer the name
- if (PROPID_MIN_VALUE == aValueProps->Handle)
- aValueProps->Name = OUString::createFromAscii(pMinValueProperty);
- else
- aValueProps->Name = OUString::createFromAscii(pMaxValueProperty);
- bSuccess = true;
+
+ bRetrievedValueLimits = true;
}
- break;
+ OSL_ENSURE((PROPID_MIN_VALUE != aValueProps->Handle) || pMinValueProperty,
+ "OControlImport::StartElement: the control does not have a value property!");
+ OSL_ENSURE((PROPID_MAX_VALUE != aValueProps->Handle) || pMaxValueProperty,
+ "OControlImport::StartElement: the control does not have a current-value property!");
+
+ // transfer the name
+ if (PROPID_MIN_VALUE == aValueProps->Handle)
+ aValueProps->Name = OUString::createFromAscii(pMinValueProperty);
+ else
+ aValueProps->Name = OUString::createFromAscii(pMaxValueProperty);
+ bSuccess = true;
}
+ break;
+ }
- if ( !bSuccess )
- continue;
+ if ( !bSuccess )
+ continue;
- // translate the value
- implTranslateValueProperty(m_xInfo, *aValueProps);
- // add the property to the base class' array
- implPushBackPropertyValue(*aValueProps);
- }
+ // translate the value
+ implTranslateValueProperty(m_xInfo, *aValueProps);
+ // add the property to the base class' array
+ implPushBackPropertyValue(*aValueProps);
}
+
}
void OControlImport::implTranslateValueProperty(const Reference< XPropertySetInfo >& _rxPropInfo,
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 51b3578029af..a3d4ca85292a 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -453,80 +453,80 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
void XMLPropStyleContext::Finish( bool bOverwrite )
{
- if( mxStyle.is() && (IsNew() || bOverwrite) )
+ if( !mxStyle.is() || !(IsNew() || bOverwrite) )
+ return;
+
+ // The families container must exist
+ Reference < XNameContainer > xFamilies =
+ static_cast<SvXMLStylesContext *>(mxStyles.get())->GetStylesContainer( GetFamily() );
+ SAL_WARN_IF( !xFamilies.is(), "xmloff", "Families lost" );
+ if( !xFamilies.is() )
+ return;
+
+ // connect parent
+ OUString sParent( GetParentName() );
+ if( !sParent.isEmpty() )
+ sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
+ if( !sParent.isEmpty() && !xFamilies->hasByName( sParent ) )
+ sParent.clear();
+
+ if( sParent != mxStyle->getParentStyle() )
{
- // The families container must exist
- Reference < XNameContainer > xFamilies =
- static_cast<SvXMLStylesContext *>(mxStyles.get())->GetStylesContainer( GetFamily() );
- SAL_WARN_IF( !xFamilies.is(), "xmloff", "Families lost" );
- if( !xFamilies.is() )
- return;
-
- // connect parent
- OUString sParent( GetParentName() );
- if( !sParent.isEmpty() )
- sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
- if( !sParent.isEmpty() && !xFamilies->hasByName( sParent ) )
- sParent.clear();
-
- if( sParent != mxStyle->getParentStyle() )
+ // this may except if setting the parent style forms a
+ // circle in the style dependencies; especially if the parent
+ // style is the same as the current style
+ try
{
- // this may except if setting the parent style forms a
- // circle in the style dependencies; especially if the parent
- // style is the same as the current style
- try
- {
- mxStyle->setParentStyle( sParent );
- }
- catch(const uno::Exception& e)
- {
- // according to the API definition, I would expect a
- // container::NoSuchElementException. But it throws an
- // uno::RuntimeException instead. I catch
- // uno::Exception in order to process both of them.
-
- // We can't set the parent style. For a proper
- // Error-Message, we should pass in the name of the
- // style, as well as the desired parent style.
- Sequence<OUString> aSequence(2);
-
- // getName() throws no non-Runtime exception:
- aSequence[0] = mxStyle->getName();
- aSequence[1] = sParent;
-
- GetImport().SetError(
- XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
- aSequence, e.Message, nullptr );
- }
+ mxStyle->setParentStyle( sParent );
}
-
- // connect follow
- OUString sFollow( GetFollow() );
- if( !sFollow.isEmpty() )
- sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
- if( sFollow.isEmpty() || !xFamilies->hasByName( sFollow ) )
- sFollow = mxStyle->getName();
-
- Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo =
- xPropSet->getPropertySetInfo();
- if( xPropSetInfo->hasPropertyByName( msFollowStyle ) )
+ catch(const uno::Exception& e)
{
- Any aAny = xPropSet->getPropertyValue( msFollowStyle );
- OUString sCurrFollow;
- aAny >>= sCurrFollow;
- if( sCurrFollow != sFollow )
- {
- xPropSet->setPropertyValue( msFollowStyle, Any(sFollow) );
- }
+ // according to the API definition, I would expect a
+ // container::NoSuchElementException. But it throws an
+ // uno::RuntimeException instead. I catch
+ // uno::Exception in order to process both of them.
+
+ // We can't set the parent style. For a proper
+ // Error-Message, we should pass in the name of the
+ // style, as well as the desired parent style.
+ Sequence<OUString> aSequence(2);
+
+ // getName() throws no non-Runtime exception:
+ aSequence[0] = mxStyle->getName();
+ aSequence[1] = sParent;
+
+ GetImport().SetError(
+ XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
+ aSequence, e.Message, nullptr );
}
+ }
- if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
+ // connect follow
+ OUString sFollow( GetFollow() );
+ if( !sFollow.isEmpty() )
+ sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
+ if( sFollow.isEmpty() || !xFamilies->hasByName( sFollow ) )
+ sFollow = mxStyle->getName();
+
+ Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( msFollowStyle ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( msFollowStyle );
+ OUString sCurrFollow;
+ aAny >>= sCurrFollow;
+ if( sCurrFollow != sFollow )
{
- xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
+ xPropSet->setPropertyValue( msFollowStyle, Any(sFollow) );
}
+ }
+ if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
+ {
+ xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
}
+
}
bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index 01abf07b6987..863f740b24b8 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -182,82 +182,83 @@ void SvXMLAutoStylePoolP::exportStyleContent(
const SvXMLNamespaceMap&
) const
{
- if( nFamily == XML_STYLE_FAMILY_PAGE_MASTER )
+ if( nFamily != XML_STYLE_FAMILY_PAGE_MASTER )
+ return;
+
+ sal_Int32 nHeaderStartIndex(-1);
+ sal_Int32 nHeaderEndIndex(-1);
+ sal_Int32 nFooterStartIndex(-1);
+ sal_Int32 nFooterEndIndex(-1);
+ bool bHeaderStartIndex(false);
+ bool bHeaderEndIndex(false);
+ bool bFooterStartIndex(false);
+ bool bFooterEndIndex(false);
+
+ const rtl::Reference< XMLPropertySetMapper >& aPropMapper = rPropExp.getPropertySetMapper();
+
+ sal_Int32 nIndex(0);
+ while(nIndex < aPropMapper->GetEntryCount())
{
- sal_Int32 nHeaderStartIndex(-1);
- sal_Int32 nHeaderEndIndex(-1);
- sal_Int32 nFooterStartIndex(-1);
- sal_Int32 nFooterEndIndex(-1);
- bool bHeaderStartIndex(false);
- bool bHeaderEndIndex(false);
- bool bFooterStartIndex(false);
- bool bFooterEndIndex(false);
-
- const rtl::Reference< XMLPropertySetMapper >& aPropMapper = rPropExp.getPropertySetMapper();
-
- sal_Int32 nIndex(0);
- while(nIndex < aPropMapper->GetEntryCount())
+ switch( aPropMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK )
{
- switch( aPropMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK )
+ case CTF_PM_HEADERFLAG:
{
- case CTF_PM_HEADERFLAG:
+ if (!bHeaderStartIndex)
{
- if (!bHeaderStartIndex)
- {
- nHeaderStartIndex = nIndex;
- bHeaderStartIndex = true;
- }
- if (bFooterStartIndex && !bFooterEndIndex)
- {
- nFooterEndIndex = nIndex;
- bFooterEndIndex = true;
- }
+ nHeaderStartIndex = nIndex;
+ bHeaderStartIndex = true;
}
- break;
- case CTF_PM_FOOTERFLAG:
+ if (bFooterStartIndex && !bFooterEndIndex)
{
- if (!bFooterStartIndex)
- {
- nFooterStartIndex = nIndex;
- bFooterStartIndex = true;
- }
- if (bHeaderStartIndex && !bHeaderEndIndex)
- {
- nHeaderEndIndex = nIndex;
- bHeaderEndIndex = true;
- }
+ nFooterEndIndex = nIndex;
+ bFooterEndIndex = true;
+ }
+ }
+ break;
+ case CTF_PM_FOOTERFLAG:
+ {
+ if (!bFooterStartIndex)
+ {
+ nFooterStartIndex = nIndex;
+ bFooterStartIndex = true;
+ }
+ if (bHeaderStartIndex && !bHeaderEndIndex)
+ {
+ nHeaderEndIndex = nIndex;
+ bHeaderEndIndex = true;
}
- break;
}
- nIndex++;
+ break;
}
- if (!bHeaderEndIndex)
- nHeaderEndIndex = nIndex;
- if (!bFooterEndIndex)
- nFooterEndIndex = nIndex;
+ nIndex++;
+ }
+ if (!bHeaderEndIndex)
+ nHeaderEndIndex = nIndex;
+ if (!bFooterEndIndex)
+ nFooterEndIndex = nIndex;
- // export header style element
- {
- SvXMLElementExport aElem(
- GetExport(), XML_NAMESPACE_STYLE, XML_HEADER_STYLE,
- true, true );
+ // export header style element
+ {
+ SvXMLElementExport aElem(
+ GetExport(), XML_NAMESPACE_STYLE, XML_HEADER_STYLE,
+ true, true );
- rPropExp.exportXML(
- GetExport(), rProperties,
- nHeaderStartIndex, nHeaderEndIndex, SvXmlExportFlags::IGN_WS);
- }
+ rPropExp.exportXML(
+ GetExport(), rProperties,
+ nHeaderStartIndex, nHeaderEndIndex, SvXmlExportFlags::IGN_WS);
+ }
- // export footer style
- {
- SvXMLElementExport aElem(
- GetExport(), XML_NAMESPACE_STYLE, XML_FOOTER_STYLE,
- true, true );
+ // export footer style
+ {
+ SvXMLElementExport aElem(
+ GetExport(), XML_NAMESPACE_STYLE, XML_FOOTER_STYLE,
+ true, true );
- rPropExp.exportXML(
- GetExport(), rProperties,
- nFooterStartIndex, nFooterEndIndex, SvXmlExportFlags::IGN_WS);
- }
+ rPropExp.exportXML(
+ GetExport(), rProperties,
+ nFooterStartIndex, nFooterEndIndex, SvXmlExportFlags::IGN_WS);
}
+
}
SvXMLAutoStylePoolP::SvXMLAutoStylePoolP( SvXMLExport& rExport )
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx
index 0da84c109b34..dd4cfdd6f499 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.cxx
@@ -76,74 +76,75 @@ void XMLFootnoteImportContext::StartElement(
// create footnote
Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
UNO_QUERY);
- if( xFactory.is() )
+ if( !xFactory.is() )
+ return;
+
+ // create endnote or footnote
+ bool bIsEndnote = false;
+ sal_Int16 nLength = xAttrList->getLength();
+ for(sal_Int16 nAttr1 = 0; nAttr1 < nLength; nAttr1++)
{
- // create endnote or footnote
- bool bIsEndnote = false;
- sal_Int16 nLength = xAttrList->getLength();
- for(sal_Int16 nAttr1 = 0; nAttr1 < nLength; nAttr1++)
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr1),
+ &sLocalName );
+ if( XML_NAMESPACE_TEXT == nPrefix && IsXMLToken( sLocalName,
+ XML_NOTE_CLASS ) )
{
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr1),
- &sLocalName );
- if( XML_NAMESPACE_TEXT == nPrefix && IsXMLToken( sLocalName,
- XML_NOTE_CLASS ) )
- {
- const OUString& rValue = xAttrList->getValueByIndex( nAttr1 );
- if( IsXMLToken( rValue, XML_ENDNOTE ) )
- bIsEndnote = true;
- break;
- }
+ const OUString& rValue = xAttrList->getValueByIndex( nAttr1 );
+ if( IsXMLToken( rValue, XML_ENDNOTE ) )
+ bIsEndnote = true;
+ break;
}
+ }
- Reference<XInterface> xIfc = xFactory->createInstance(
- bIsEndnote ?
- OUString("com.sun.star.text.Endnote") :
- OUString("com.sun.star.text.Footnote") );
+ Reference<XInterface> xIfc = xFactory->createInstance(
+ bIsEndnote ?
+ OUString("com.sun.star.text.Endnote") :
+ OUString("com.sun.star.text.Footnote") );
- // attach footnote to document
- Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
- rHelper.InsertTextContent(xTextContent);
+ // attach footnote to document
+ Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ rHelper.InsertTextContent(xTextContent);
- // process id attribute
- for(sal_Int16 nAttr2 = 0; nAttr2 < nLength; nAttr2++)
- {
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr2),
- &sLocalName );
+ // process id attribute
+ for(sal_Int16 nAttr2 = 0; nAttr2 < nLength; nAttr2++)
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr2),
+ &sLocalName );
- if ( (XML_NAMESPACE_TEXT == nPrefix) &&
- IsXMLToken( sLocalName, XML_ID ) )
- {
- // get ID ...
- Reference<XPropertySet> xPropertySet(xTextContent, UNO_QUERY);
- Any aAny =xPropertySet->getPropertyValue("ReferenceId");
- sal_Int16 nID = 0;
- aAny >>= nID;
-
- // ... and insert into map
- rHelper.InsertFootnoteID(
- xAttrList->getValueByIndex(nAttr2),
- nID);
- }
+ if ( (XML_NAMESPACE_TEXT == nPrefix) &&
+ IsXMLToken( sLocalName, XML_ID ) )
+ {
+ // get ID ...
+ Reference<XPropertySet> xPropertySet(xTextContent, UNO_QUERY);
+ Any aAny =xPropertySet->getPropertyValue("ReferenceId");
+ sal_Int16 nID = 0;
+ aAny >>= nID;
+
+ // ... and insert into map
+ rHelper.InsertFootnoteID(
+ xAttrList->getValueByIndex(nAttr2),
+ nID);
}
+ }
- // save old cursor and install new one
- xOldCursor = rHelper.GetCursor();
- Reference<XText> xText(xTextContent, UNO_QUERY);
- rHelper.SetCursor(xText->createTextCursor());
+ // save old cursor and install new one
+ xOldCursor = rHelper.GetCursor();
+ Reference<XText> xText(xTextContent, UNO_QUERY);
+ rHelper.SetCursor(xText->createTextCursor());
- // remember old list item and block (#89891#) and reset them
- // for the footnote
- rHelper.PushListContext();
- mbListContextPushed = true;
+ // remember old list item and block (#89891#) and reset them
+ // for the footnote
+ rHelper.PushListContext();
+ mbListContextPushed = true;
+
+ // remember footnote (for CreateChildContext)
+ Reference<XFootnote> xNote(xTextContent, UNO_QUERY);
+ xFootnote = xNote;
- // remember footnote (for CreateChildContext)
- Reference<XFootnote> xNote(xTextContent, UNO_QUERY);
- xFootnote = xNote;
- }
// else: ignore footnote! Content will be merged into document.
}
diff --git a/xmloff/source/text/XMLIndexMarkExport.cxx b/xmloff/source/text/XMLIndexMarkExport.cxx
index 08ae8f57ef2d..70c2327491e8 100644
--- a/xmloff/source/text/XMLIndexMarkExport.cxx
+++ b/xmloff/source/text/XMLIndexMarkExport.cxx
@@ -76,94 +76,95 @@ void XMLIndexMarkExport::ExportIndexMark(
bool bAutoStyles)
{
/// index marks have no styles!
- if (!bAutoStyles)
- {
- const enum XMLTokenEnum * pElements = nullptr;
- sal_Int8 nElementNo = -1;
+ if (bAutoStyles)
+ return;
- // get index mark
- Any aAny;
- aAny = rPropSet->getPropertyValue(sDocumentIndexMark);
- Reference<XPropertySet> xIndexMarkPropSet;
- aAny >>= xIndexMarkPropSet;
+ const enum XMLTokenEnum * pElements = nullptr;
+ sal_Int8 nElementNo = -1;
- // common: handling of start, end, collapsed entries and
- // alternative text
+ // get index mark
+ Any aAny;
+ aAny = rPropSet->getPropertyValue(sDocumentIndexMark);
+ Reference<XPropertySet> xIndexMarkPropSet;
+ aAny >>= xIndexMarkPropSet;
- // collapsed/alternative text entry?
- aAny = rPropSet->getPropertyValue(sIsCollapsed);
- if (*o3tl::doAccess<bool>(aAny))
- {
- // collapsed entry: needs alternative text
- nElementNo = 0;
-
- aAny = xIndexMarkPropSet->getPropertyValue(sAlternativeText);
- OUString sTmp;
- aAny >>= sTmp;
- DBG_ASSERT(!sTmp.isEmpty(),
- "collapsed index mark without alternative text");
- rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STRING_VALUE, sTmp);
- }
- else
- {
- // start and end entries: has ID
- aAny = rPropSet->getPropertyValue(sIsStart);
- nElementNo = *o3tl::doAccess<bool>(aAny) ? 1 : 2;
-
- // generate ID
- OUStringBuffer sBuf;
- GetID(sBuf, xIndexMarkPropSet);
- rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_ID,
- sBuf.makeStringAndClear());
- }
+ // common: handling of start, end, collapsed entries and
+ // alternative text
+
+ // collapsed/alternative text entry?
+ aAny = rPropSet->getPropertyValue(sIsCollapsed);
+ if (*o3tl::doAccess<bool>(aAny))
+ {
+ // collapsed entry: needs alternative text
+ nElementNo = 0;
+
+ aAny = xIndexMarkPropSet->getPropertyValue(sAlternativeText);
+ OUString sTmp;
+ aAny >>= sTmp;
+ DBG_ASSERT(!sTmp.isEmpty(),
+ "collapsed index mark without alternative text");
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STRING_VALUE, sTmp);
+ }
+ else
+ {
+ // start and end entries: has ID
+ aAny = rPropSet->getPropertyValue(sIsStart);
+ nElementNo = *o3tl::doAccess<bool>(aAny) ? 1 : 2;
+
+ // generate ID
+ OUStringBuffer sBuf;
+ GetID(sBuf, xIndexMarkPropSet);
+ rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_ID,
+ sBuf.makeStringAndClear());
+ }
- // distinguish between TOC, user, alphab. index marks by
- // asking for specific properties
- // Export attributes for -mark-start and -mark elements,
- // but not for -mark-end
- Reference<XPropertySetInfo> xPropertySetInfo =
- xIndexMarkPropSet->getPropertySetInfo();
- if (xPropertySetInfo->hasPropertyByName(sUserIndexName))
+ // distinguish between TOC, user, alphab. index marks by
+ // asking for specific properties
+ // Export attributes for -mark-start and -mark elements,
+ // but not for -mark-end
+ Reference<XPropertySetInfo> xPropertySetInfo =
+ xIndexMarkPropSet->getPropertySetInfo();
+ if (xPropertySetInfo->hasPropertyByName(sUserIndexName))
+ {
+ // user index mark
+ pElements = lcl_pUserIndexMarkName;
+ if (nElementNo != 2)
{
- // user index mark
- pElements = lcl_pUserIndexMarkName;
- if (nElementNo != 2)
- {
- ExportUserIndexMarkAttributes(xIndexMarkPropSet);
- }
+ ExportUserIndexMarkAttributes(xIndexMarkPropSet);
}
- else if (xPropertySetInfo->hasPropertyByName(sPrimaryKey))
+ }
+ else if (xPropertySetInfo->hasPropertyByName(sPrimaryKey))
+ {
+ // alphabetical index mark
+ pElements = lcl_pAlphaIndexMarkName;
+ if (nElementNo != 2)
{
- // alphabetical index mark
- pElements = lcl_pAlphaIndexMarkName;
- if (nElementNo != 2)
- {
- ExportAlphabeticalIndexMarkAttributes(xIndexMarkPropSet);
- }
+ ExportAlphabeticalIndexMarkAttributes(xIndexMarkPropSet);
}
- else
+ }
+ else
+ {
+ // table of content:
+ pElements = lcl_pTocMarkNames;
+ if (nElementNo != 2)
{
- // table of content:
- pElements = lcl_pTocMarkNames;
- if (nElementNo != 2)
- {
- ExportTOCMarkAttributes(xIndexMarkPropSet);
- }
+ ExportTOCMarkAttributes(xIndexMarkPropSet);
}
+ }
- // export element
- DBG_ASSERT(pElements != nullptr, "illegal element array");
- DBG_ASSERT(nElementNo >= 0, "illegal name array index");
- DBG_ASSERT(nElementNo <= 2, "illegal name array index");
+ // export element
+ DBG_ASSERT(pElements != nullptr, "illegal element array");
+ DBG_ASSERT(nElementNo >= 0, "illegal name array index");
+ DBG_ASSERT(nElementNo <= 2, "illegal name array index");
- if ((pElements != nullptr) && (nElementNo != -1))
- {
- SvXMLElementExport aElem(rExport,
- XML_NAMESPACE_TEXT,
- pElements[nElementNo],
- false, false);
- }
+ if ((pElements != nullptr) && (nElementNo != -1))
+ {
+ SvXMLElementExport aElem(rExport,
+ XML_NAMESPACE_TEXT,
+ pElements[nElementNo],
+ false, false);
}
+
}
void XMLIndexMarkExport::ExportTOCMarkAttributes(
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx
index afdb6158c6d3..cd1f17010fbd 100644
--- a/xmloff/source/text/XMLIndexTOCContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -120,128 +120,129 @@ XMLIndexTOCContext::~XMLIndexTOCContext()
void XMLIndexTOCContext::StartElement(
const Reference<XAttributeList> & xAttrList)
{
- if (bValid)
+ if (!bValid)
+ return;
+
+ // find text:style-name attribute and set section style
+ // find text:protected and set value
+ // find text:name and set value (if not empty)
+ sal_Int16 nCount = xAttrList->getLength();
+ bool bProtected = false;
+ OUString sIndexName;
+ OUString sXmlId;
+ XMLPropStyleContext* pStyle(nullptr);
+ for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
{
- // find text:style-name attribute and set section style
- // find text:protected and set value
- // find text:name and set value (if not empty)
- sal_Int16 nCount = xAttrList->getLength();
- bool bProtected = false;
- OUString sIndexName;
- OUString sXmlId;
- XMLPropStyleContext* pStyle(nullptr);
- for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
+ &sLocalName );
+ if ( XML_NAMESPACE_TEXT == nPrefix)
{
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
- &sLocalName );
- if ( XML_NAMESPACE_TEXT == nPrefix)
+ if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
{
- if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
- {
- pStyle = GetImport().GetTextImport()->FindSectionStyle(
- xAttrList->getValueByIndex(nAttr));
- }
- else if ( IsXMLToken( sLocalName, XML_PROTECTED ) )
- {
- bool bTmp(false);
- if (::sax::Converter::convertBool(
- bTmp, xAttrList->getValueByIndex(nAttr)))
- {
- bProtected = bTmp;
- }
- }
- else if ( IsXMLToken( sLocalName, XML_NAME ) )
- {
- sIndexName = xAttrList->getValueByIndex(nAttr);
- }
+ pStyle = GetImport().GetTextImport()->FindSectionStyle(
+ xAttrList->getValueByIndex(nAttr));
}
- else if ( XML_NAMESPACE_XML == nPrefix)
+ else if ( IsXMLToken( sLocalName, XML_PROTECTED ) )
{
- if ( IsXMLToken( sLocalName, XML_ID ) )
+ bool bTmp(false);
+ if (::sax::Converter::convertBool(
+ bTmp, xAttrList->getValueByIndex(nAttr)))
{
- sXmlId = xAttrList->getValueByIndex(nAttr);
+ bProtected = bTmp;
}
}
+ else if ( IsXMLToken( sLocalName, XML_NAME ) )
+ {
+ sIndexName = xAttrList->getValueByIndex(nAttr);
+ }
}
-
- // create table of content (via MultiServiceFactory)
- Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
- UNO_QUERY);
- if( xFactory.is() )
+ else if ( XML_NAMESPACE_XML == nPrefix)
{
- Reference<XInterface> xIfc =
- xFactory->createInstance(
- OUString::createFromAscii(aIndexServiceMap[eIndexType]));
- if( xIfc.is() )
+ if ( IsXMLToken( sLocalName, XML_ID ) )
{
- // get Property set
- Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
- xTOCPropertySet = xPropSet;
-
- // insert section
- // a) insert section
- // The inserted index consists of an empty paragraph
- // only, as well as an empty paragraph *after* the index
- // b) insert marker after index, and put Cursor inside of the
- // index
-
- // preliminaries
+ sXmlId = xAttrList->getValueByIndex(nAttr);
+ }
+ }
+ }
+
+ // create table of content (via MultiServiceFactory)
+ Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
+ UNO_QUERY);
+ if( xFactory.is() )
+ {
+ Reference<XInterface> xIfc =
+ xFactory->createInstance(
+ OUString::createFromAscii(aIndexServiceMap[eIndexType]));
+ if( xIfc.is() )
+ {
+ // get Property set
+ Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
+ xTOCPropertySet = xPropSet;
+
+ // insert section
+ // a) insert section
+ // The inserted index consists of an empty paragraph
+ // only, as well as an empty paragraph *after* the index
+ // b) insert marker after index, and put Cursor inside of the
+ // index
+
+ // preliminaries
#ifndef DBG_UTIL
- OUString const sMarker(" ");
+ OUString const sMarker(" ");
#else
- OUString const sMarker("Y");
+ OUString const sMarker("Y");
#endif
- rtl::Reference<XMLTextImportHelper> rImport =
- GetImport().GetTextImport();
+ rtl::Reference<XMLTextImportHelper> rImport =
+ GetImport().GetTextImport();
- // a) insert index
- Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
- try
- {
- GetImport().GetTextImport()->InsertTextContent(
- xTextContent);
- }
- catch(const IllegalArgumentException& e)
- {
- // illegal argument? Then we can't accept indices here!
- Sequence<OUString> aSeq { GetLocalName() };
- GetImport().SetError(
- XMLERROR_FLAG_ERROR | XMLERROR_NO_INDEX_ALLOWED_HERE,
- aSeq, e.Message, nullptr );
-
- // set bValid to false, and return prematurely
- bValid = false;
- return;
- }
+ // a) insert index
+ Reference<XTextContent> xTextContent(xIfc, UNO_QUERY);
+ try
+ {
+ GetImport().GetTextImport()->InsertTextContent(
+ xTextContent);
+ }
+ catch(const IllegalArgumentException& e)
+ {
+ // illegal argument? Then we can't accept indices here!
+ Sequence<OUString> aSeq { GetLocalName() };
+ GetImport().SetError(
+ XMLERROR_FLAG_ERROR | XMLERROR_NO_INDEX_ALLOWED_HERE,
+ aSeq, e.Message, nullptr );
+
+ // set bValid to false, and return prematurely
+ bValid = false;
+ return;
+ }
- // xml:id for RDF metadata
- GetImport().SetXmlId(xIfc, sXmlId);
+ // xml:id for RDF metadata
+ GetImport().SetXmlId(xIfc, sXmlId);
- // b) insert marker and move cursor
- rImport->InsertString(sMarker);
- rImport->GetCursor()->goLeft(2, false);
- }
+ // b) insert marker and move cursor
+ rImport->InsertString(sMarker);
+ rImport->GetCursor()->goLeft(2, false);
}
+ }
- // finally, check for redlines that should start at
- // the section start node
- if( bValid )
- GetImport().GetTextImport()->RedlineAdjustStartNodeCursor(true);
+ // finally, check for redlines that should start at
+ // the section start node
+ if( bValid )
+ GetImport().GetTextImport()->RedlineAdjustStartNodeCursor(true);
- if (pStyle != nullptr)
- {
- pStyle->FillPropertySet( xTOCPropertySet );
- }
+ if (pStyle != nullptr)
+ {
+ pStyle->FillPropertySet( xTOCPropertySet );
+ }
- xTOCPropertySet->setPropertyValue( "IsProtected", Any(bProtected) );
+ xTOCPropertySet->setPropertyValue( "IsProtected", Any(bProtected) );
- if (!sIndexName.isEmpty())
- {
- xTOCPropertySet->setPropertyValue( "Name", Any(sIndexName) );
- }
+ if (!sIndexName.isEmpty())
+ {
+ xTOCPropertySet->setPropertyValue( "Name", Any(sIndexName) );
}
+
}
void XMLIndexTOCContext::EndElement()
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
index b9ceba3b47e1..7c21b0749d0e 100644
--- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -120,32 +120,33 @@ void XMLSectionSourceDDEImportContext::StartElement(
}
// DDE not supported on all platforms; query property first
- if (rSectionPropertySet->getPropertySetInfo()->
+ if (!rSectionPropertySet->getPropertySetInfo()->
hasPropertyByName("DDECommandFile"))
- {
- // use multi property set to force single update of connection #83654#
- Sequence<OUString> aNames(4);
- Sequence<Any> aValues(4);
+ return;
- aValues[0] <<= sApplication;
- aNames[0] = "DDECommandFile";
+ // use multi property set to force single update of connection #83654#
+ Sequence<OUString> aNames(4);
+ Sequence<Any> aValues(4);
- aValues[1] <<= sTopic;
- aNames[1] = "DDECommandType";
+ aValues[0] <<= sApplication;
+ aNames[0] = "DDECommandFile";
- aValues[2] <<= sItem;
- aNames[2] = "DDECommandElement";
+ aValues[1] <<= sTopic;
+ aNames[1] = "DDECommandType";
- aValues[3] <<= bAutomaticUpdate;
- aNames[3] = "IsAutomaticUpdate";
+ aValues[2] <<= sItem;
+ aNames[2] = "DDECommandElement";
+
+ aValues[3] <<= bAutomaticUpdate;
+ aNames[3] = "IsAutomaticUpdate";
+
+ Reference<XMultiPropertySet> rMultiPropSet(rSectionPropertySet,
+ UNO_QUERY);
+ DBG_ASSERT(rMultiPropSet.is(), "we'd really like a XMultiPropertySet");
+ if (rMultiPropSet.is())
+ rMultiPropSet->setPropertyValues(aNames, aValues);
+ // else: ignore
- Reference<XMultiPropertySet> rMultiPropSet(rSectionPropertySet,
- UNO_QUERY);
- DBG_ASSERT(rMultiPropSet.is(), "we'd really like a XMultiPropertySet");
- if (rMultiPropSet.is())
- rMultiPropSet->setPropertyValues(aNames, aValues);
- // else: ignore
- }
}
void XMLSectionSourceDDEImportContext::EndElement()
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 87586098ec17..fe75012bd407 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1991,98 +1991,99 @@ void XMLTextImportHelper::AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel
void XMLTextImportHelper::SetOutlineStyles( bool bSetEmptyLevels )
{
- if ((m_xImpl->m_xOutlineStylesCandidates != nullptr || bSetEmptyLevels) &&
- m_xImpl->m_xChapterNumbering.is() &&
- !IsInsertMode())
+ if (!(m_xImpl->m_xOutlineStylesCandidates != nullptr || bSetEmptyLevels) ||
+ !m_xImpl->m_xChapterNumbering.is() ||
+ IsInsertMode())
+ return;
+
+ bool bChooseLastOne( false );
{
- bool bChooseLastOne( false );
+ if ( GetXMLImport().IsTextDocInOOoFileFormat() )
+ {
+ bChooseLastOne = true;
+ }
+ else
{
- if ( GetXMLImport().IsTextDocInOOoFileFormat() )
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ if ( GetXMLImport().getBuildIds( nUPD, nBuild ) )
{
- bChooseLastOne = true;
- }
- else
- {
- sal_Int32 nUPD( 0 );
- sal_Int32 nBuild( 0 );
- if ( GetXMLImport().getBuildIds( nUPD, nBuild ) )
- {
- // check explicitly on certain versions
- bChooseLastOne = ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
- ( nUPD == 680 && nBuild <= 9073 ); // OOo 2.0 - OOo 2.0.4
- }
+ // check explicitly on certain versions
+ bChooseLastOne = ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0
+ ( nUPD == 680 && nBuild <= 9073 ); // OOo 2.0 - OOo 2.0.4
}
}
+ }
- OUString sOutlineStyleName;
- {
- Reference<XPropertySet> xChapterNumRule(
- m_xImpl->m_xChapterNumbering, UNO_QUERY);
- const OUString sName("Name");
- xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName;
- }
+ OUString sOutlineStyleName;
+ {
+ Reference<XPropertySet> xChapterNumRule(
+ m_xImpl->m_xChapterNumbering, UNO_QUERY);
+ const OUString sName("Name");
+ xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName;
+ }
- const sal_Int32 nCount = m_xImpl->m_xChapterNumbering->getCount();
- /* First collect all paragraph styles chosen for assignment to each
- list level of the outline style, then perform the intrinsic assignment.
- Reason: The assignment of a certain paragraph style to a list level
- of the outline style causes side effects on the children
- paragraph styles in Writer. (#i106218#)
- */
- ::std::vector<OUString> sChosenStyles(nCount);
- for( sal_Int32 i=0; i < nCount; ++i )
+ const sal_Int32 nCount = m_xImpl->m_xChapterNumbering->getCount();
+ /* First collect all paragraph styles chosen for assignment to each
+ list level of the outline style, then perform the intrinsic assignment.
+ Reason: The assignment of a certain paragraph style to a list level
+ of the outline style causes side effects on the children
+ paragraph styles in Writer. (#i106218#)
+ */
+ ::std::vector<OUString> sChosenStyles(nCount);
+ for( sal_Int32 i=0; i < nCount; ++i )
+ {
+ if ( bSetEmptyLevels ||
+ (m_xImpl->m_xOutlineStylesCandidates &&
+ !m_xImpl->m_xOutlineStylesCandidates[i].empty()))
{
- if ( bSetEmptyLevels ||
- (m_xImpl->m_xOutlineStylesCandidates &&
- !m_xImpl->m_xOutlineStylesCandidates[i].empty()))
+ // determine, which candidate is one to be assigned to the list
+ // level of the outline style
+ if (m_xImpl->m_xOutlineStylesCandidates &&
+ !m_xImpl->m_xOutlineStylesCandidates[i].empty())
{
- // determine, which candidate is one to be assigned to the list
- // level of the outline style
- if (m_xImpl->m_xOutlineStylesCandidates &&
- !m_xImpl->m_xOutlineStylesCandidates[i].empty())
+ if ( bChooseLastOne )
{
- if ( bChooseLastOne )
- {
- sChosenStyles[i] =
- m_xImpl->m_xOutlineStylesCandidates[i].back();
- }
- else
+ sChosenStyles[i] =
+ m_xImpl->m_xOutlineStylesCandidates[i].back();
+ }
+ else
+ {
+ for (size_t j = 0;
+ j < m_xImpl->m_xOutlineStylesCandidates[i].size();
+ ++j)
{
- for (size_t j = 0;
- j < m_xImpl->m_xOutlineStylesCandidates[i].size();
- ++j)
+ if (!lcl_HasListStyle(
+ m_xImpl->m_xOutlineStylesCandidates[i][j],
+ m_xImpl->m_xParaStyles,
+ GetXMLImport(),
+ "NumberingStyleName",
+ sOutlineStyleName))
{
- if (!lcl_HasListStyle(
- m_xImpl->m_xOutlineStylesCandidates[i][j],
- m_xImpl->m_xParaStyles,
- GetXMLImport(),
- "NumberingStyleName",
- sOutlineStyleName))
- {
- sChosenStyles[i] =
- m_xImpl->m_xOutlineStylesCandidates[i][j];
- break;
- }
+ sChosenStyles[i] =
+ m_xImpl->m_xOutlineStylesCandidates[i][j];
+ break;
}
}
}
}
}
- // Trashed outline numbering in ODF 1.1 text document created by OOo 3.x (#i106218#)
- Sequence < PropertyValue > aProps( 1 );
- PropertyValue *pProps = aProps.getArray();
- pProps->Name = "HeadingStyleName";
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ }
+ // Trashed outline numbering in ODF 1.1 text document created by OOo 3.x (#i106218#)
+ Sequence < PropertyValue > aProps( 1 );
+ PropertyValue *pProps = aProps.getArray();
+ pProps->Name = "HeadingStyleName";
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ // Paragraph style assignments in Outline of template lost from second level on (#i107610#)
+ if ( bSetEmptyLevels || !sChosenStyles[i].isEmpty() )
{
- // Paragraph style assignments in Outline of template lost from second level on (#i107610#)
- if ( bSetEmptyLevels || !sChosenStyles[i].isEmpty() )
- {
- pProps->Value <<= sChosenStyles[i];
- m_xImpl->m_xChapterNumbering->replaceByIndex(i,
- makeAny( aProps ));
- }
+ pProps->Value <<= sChosenStyles[i];
+ m_xImpl->m_xChapterNumbering->replaceByIndex(i,
+ makeAny( aProps ));
}
}
+
}
void XMLTextImportHelper::SetHyperlink(
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 65d072b240b8..ccbb11b4d2c2 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1063,72 +1063,73 @@ void XMLTextParagraphExport::exportListChange(
bEndElement = pListElements && pListElements->size() >= 2;
}
- if (bEndElement)
+ if (!bEndElement)
+ return;
+
+ // close previous list-item
+ GetExport().EndElement(pListElements->back(), true );
+ pListElements->pop_back();
+
+ // Only for sub lists (#i103745#)
+ if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() &&
+ rNextInfo.GetLevel() != 1 )
{
- // close previous list-item
+ // start new sub list respectively list on same list level
GetExport().EndElement(pListElements->back(), true );
- pListElements->pop_back();
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement(pListElements->back(), false);
+ }
- // Only for sub lists (#i103745#)
- if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() &&
- rNextInfo.GetLevel() != 1 )
+ // open new list-item
+ GetExport().CheckAttrList();
+ if( rNextInfo.HasStartValue() )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ }
+ // Handle restart without start value on list level 1 (#i103745#)
+ else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/
+ rNextInfo.GetLevel() == 1 )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.append( (sal_Int32)rNextInfo.GetListLevelStartValue() );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
+ aBuffer.makeStringAndClear() );
+ }
+ if ( ( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
+ GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
+ {
+ const OUString& sListStyleName( rNextInfo.GetNumRulesName() );
+ if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
{
- // start new sub list respectively list on same list level
- GetExport().EndElement(pListElements->back(), true );
- GetExport().IgnorableWhitespace();
- GetExport().StartElement(pListElements->back(), false);
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT,
+ XML_STYLE_OVERRIDE,
+ GetExport().EncodeStyleName( sListStyleName ) );
}
+ }
+ OUString aElem( GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(XML_LIST_ITEM) ) );
+ GetExport().IgnorableWhitespace();
+ GetExport().StartElement(aElem, false );
+ pListElements->push_back(aElem);
- // open new list-item
- GetExport().CheckAttrList();
- if( rNextInfo.HasStartValue() )
- {
- OUStringBuffer aBuffer;
- aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
- aBuffer.makeStringAndClear() );
- }
- // Handle restart without start value on list level 1 (#i103745#)
- else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/
- rNextInfo.GetLevel() == 1 )
- {
- OUStringBuffer aBuffer;
- aBuffer.append( (sal_Int32)rNextInfo.GetListLevelStartValue() );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
- aBuffer.makeStringAndClear() );
- }
- if ( ( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
- GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
- {
- const OUString& sListStyleName( rNextInfo.GetNumRulesName() );
- if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
- {
- GetExport().AddAttribute( XML_NAMESPACE_TEXT,
- XML_STYLE_OVERRIDE,
- GetExport().EncodeStyleName( sListStyleName ) );
- }
- }
- OUString aElem( GetExport().GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_TEXT,
- GetXMLToken(XML_LIST_ITEM) ) );
+ // export of <text:number> element for <text:list-item>, if requested
+ if ( GetExport().exportTextNumberElement() &&
+ !rNextInfo.ListLabelString().isEmpty() )
+ {
+ const OUString aTextNumberElem =
+ GetExport().GetNamespaceMap().GetQNameByKey(
+ XML_NAMESPACE_TEXT,
+ GetXMLToken(XML_NUMBER) );
GetExport().IgnorableWhitespace();
- GetExport().StartElement(aElem, false );
- pListElements->push_back(aElem);
-
- // export of <text:number> element for <text:list-item>, if requested
- if ( GetExport().exportTextNumberElement() &&
- !rNextInfo.ListLabelString().isEmpty() )
- {
- const OUString aTextNumberElem =
- GetExport().GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_TEXT,
- GetXMLToken(XML_NUMBER) );
- GetExport().IgnorableWhitespace();
- GetExport().StartElement( aTextNumberElem, false );
- GetExport().Characters( rNextInfo.ListLabelString() );
- GetExport().EndElement( aTextNumberElem, true );
- }
+ GetExport().StartElement( aTextNumberElem, false );
+ GetExport().Characters( rNextInfo.ListLabelString() );
+ GetExport().EndElement( aTextNumberElem, true );
}
+
}
struct XMLTextParagraphExport::Impl
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 5f0a9fb2231d..2d4746a77ad3 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -387,179 +387,226 @@ void XMLTextStyleContext::FillPropertySet(
rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
DBG_ASSERT(xImpPrMap.is(),"Where is the import prop mapper?");
- if(xImpPrMap.is())
+ if(!xImpPrMap.is())
+ return;
+
+ // imitate SvXMLImportPropertyMapper::FillPropertySet(...)
+ // The reason for this is that we have no other way to
+ // efficiently intercept the value of combined characters. To
+ // get that value, we could iterate through the map once more,
+ // but instead we chose to insert the code into this
+ // iteration. I haven't been able to come up with a much more
+ // intelligent solution.
+ struct ContextID_Index_Pair aContextIDs[] =
{
- // imitate SvXMLImportPropertyMapper::FillPropertySet(...)
- // The reason for this is that we have no other way to
- // efficiently intercept the value of combined characters. To
- // get that value, we could iterate through the map once more,
- // but instead we chose to insert the code into this
- // iteration. I haven't been able to come up with a much more
- // intelligent solution.
- struct ContextID_Index_Pair aContextIDs[] =
- {
- { CTF_COMBINED_CHARACTERS_FIELD, -1 },
- { CTF_KEEP_TOGETHER, -1 },
- { CTF_BORDER_MODEL, -1 },
- { CTF_TEXT_DISPLAY, -1 },
- { CTF_FONTFAMILYNAME, -1 },
- { CTF_FONTFAMILYNAME_CJK, -1 },
- { CTF_FONTFAMILYNAME_CTL, -1 },
-
- //UUU need special handling for DrawingLayer FillStyle names
- { CTF_FILLGRADIENTNAME, -1 },
- { CTF_FILLTRANSNAME, -1 },
- { CTF_FILLHATCHNAME, -1 },
- { CTF_FILLBITMAPNAME, -1 },
-
- { -1, -1 }
- };
-
- // the style families associated with the same index modulo 4
- static sal_uInt16 aFamilies[] =
- {
- XML_STYLE_FAMILY_SD_GRADIENT_ID,
- XML_STYLE_FAMILY_SD_GRADIENT_ID,
- XML_STYLE_FAMILY_SD_HATCH_ID,
- XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
- };
-
- // get property set info
- Reference< XPropertySetInfo > xInfo;
- rtl::Reference< XMLPropertySetMapper > rPropMapper;
- bool bAutomatic = false;
-
- if(pSvXMLStylesContext->IsAutomaticStyle() &&
- (XML_STYLE_FAMILY_TEXT_TEXT == GetFamily() || XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily()))
+ { CTF_COMBINED_CHARACTERS_FIELD, -1 },
+ { CTF_KEEP_TOGETHER, -1 },
+ { CTF_BORDER_MODEL, -1 },
+ { CTF_TEXT_DISPLAY, -1 },
+ { CTF_FONTFAMILYNAME, -1 },
+ { CTF_FONTFAMILYNAME_CJK, -1 },
+ { CTF_FONTFAMILYNAME_CTL, -1 },
+
+ //UUU need special handling for DrawingLayer FillStyle names
+ { CTF_FILLGRADIENTNAME, -1 },
+ { CTF_FILLTRANSNAME, -1 },
+ { CTF_FILLHATCHNAME, -1 },
+ { CTF_FILLBITMAPNAME, -1 },
+
+ { -1, -1 }
+ };
+
+ // the style families associated with the same index modulo 4
+ static sal_uInt16 aFamilies[] =
+ {
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_HATCH_ID,
+ XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
+ };
+
+ // get property set info
+ Reference< XPropertySetInfo > xInfo;
+ rtl::Reference< XMLPropertySetMapper > rPropMapper;
+ bool bAutomatic = false;
+
+ if(pSvXMLStylesContext->IsAutomaticStyle() &&
+ (XML_STYLE_FAMILY_TEXT_TEXT == GetFamily() || XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily()))
+ {
+ bAutomatic = true;
+
+ if( !GetAutoName().isEmpty() )
{
- bAutomatic = true;
+ OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
+ OUString( "CharAutoStyleName" ):
+ OUString( "ParaAutoStyleName" );
- if( !GetAutoName().isEmpty() )
+ try
{
- OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
- OUString( "CharAutoStyleName" ):
- OUString( "ParaAutoStyleName" );
-
- try
+ if(!xInfo.is())
{
- if(!xInfo.is())
- {
- xInfo = rPropSet->getPropertySetInfo();
- }
+ xInfo = rPropSet->getPropertySetInfo();
+ }
- if ( xInfo->hasPropertyByName( sAutoProp ) )
- {
- rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
- }
- else
- {
- bAutomatic = false;
- }
+ if ( xInfo->hasPropertyByName( sAutoProp ) )
+ {
+ rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
}
- catch( const RuntimeException& ) { throw; }
- catch( const Exception& )
+ else
{
- DBG_UNHANDLED_EXCEPTION();
bAutomatic = false;
}
}
+ catch( const RuntimeException& ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ bAutomatic = false;
+ }
}
+ }
- if( bAutomatic )
- {
- xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
- }
- else
- {
- xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
- }
+ if( bAutomatic )
+ {
+ xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
+ }
+ else
+ {
+ xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+ }
- sal_Int32 nIndex = aContextIDs[0].nIndex;
+ sal_Int32 nIndex = aContextIDs[0].nIndex;
- // have we found a combined characters
- if ( nIndex != -1 )
- {
- Any& rAny = GetProperties()[nIndex].maValue;
- bool bVal = *o3tl::doAccess<bool>(rAny);
- m_bHasCombinedCharactersLetter = bVal;
- }
+ // have we found a combined characters
+ if ( nIndex != -1 )
+ {
+ Any& rAny = GetProperties()[nIndex].maValue;
+ bool bVal = *o3tl::doAccess<bool>(rAny);
+ m_bHasCombinedCharactersLetter = bVal;
+ }
- // keep-together: the application default is different from
- // the file format default. Hence, if we always set this
- // value; if we didn't find one, we'll set to false, the file
- // format default.
- // border-model: same
- if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_ROW == GetFamily())
- {
- OUString sIsSplitAllowed("IsSplitAllowed");
- SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "xmloff", "property missing?" );
- rPropSet->setPropertyValue(
- sIsSplitAllowed,
- (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue );
- }
+ // keep-together: the application default is different from
+ // the file format default. Hence, if we always set this
+ // value; if we didn't find one, we'll set to false, the file
+ // format default.
+ // border-model: same
+ if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_ROW == GetFamily())
+ {
+ OUString sIsSplitAllowed("IsSplitAllowed");
+ SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "xmloff", "property missing?" );
+ rPropSet->setPropertyValue(
+ sIsSplitAllowed,
+ (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue );
+ }
- if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_TABLE == GetFamily())
- {
- OUString sCollapsingBorders("CollapsingBorders");
- SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "xmloff", "property missing?" );
- rPropSet->setPropertyValue(
- sCollapsingBorders,
- (aContextIDs[2].nIndex == -1)
- ? makeAny( false )
- : GetProperties()[aContextIDs[2].nIndex].maValue );
- }
+ if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_TABLE == GetFamily())
+ {
+ OUString sCollapsingBorders("CollapsingBorders");
+ SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "xmloff", "property missing?" );
+ rPropSet->setPropertyValue(
+ sCollapsingBorders,
+ (aContextIDs[2].nIndex == -1)
+ ? makeAny( false )
+ : GetProperties()[aContextIDs[2].nIndex].maValue );
+ }
- // iterate over aContextIDs entries, start with 3, prev ones are already used above
- for(sal_uInt16 i(3); aContextIDs[i].nContextID != -1; i++)
+ // iterate over aContextIDs entries, start with 3, prev ones are already used above
+ for(sal_uInt16 i(3); aContextIDs[i].nContextID != -1; i++)
+ {
+ nIndex = aContextIDs[i].nIndex;
+
+ if ( nIndex != -1 )
{
- nIndex = aContextIDs[i].nIndex;
+ // Found!
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
- if ( nIndex != -1 )
+ switch(aContextIDs[i].nContextID)
{
- // Found!
- struct XMLPropertyState& rState = GetProperties()[nIndex];
-
- switch(aContextIDs[i].nContextID)
+ case CTF_FILLGRADIENTNAME:
+ case CTF_FILLTRANSNAME:
+ case CTF_FILLHATCHNAME:
+ case CTF_FILLBITMAPNAME:
{
- case CTF_FILLGRADIENTNAME:
- case CTF_FILLTRANSNAME:
- case CTF_FILLHATCHNAME:
- case CTF_FILLBITMAPNAME:
+ // DrawingLayer FillStyle name needs to be mapped to DisplayName
+ rtl::OUString sStyleName;
+ rState.maValue >>= sStyleName;
+
+ // translate the used name from ODF intern to the name used in the Model
+ sStyleName = GetImport().GetStyleDisplayName(aFamilies[i - 7], sStyleName);
+
+ if(bAutomatic)
{
- // DrawingLayer FillStyle name needs to be mapped to DisplayName
- rtl::OUString sStyleName;
- rState.maValue >>= sStyleName;
+ // in this case the rPropSet got not really filled since above the call to
+ // CheckSpecialContext was used and not FillPropertySet, thus the below call to
+ // setPropertyValue can fail/will not be useful (e.g. when the rPropSet
+ // is a SwXTextCursor).
+ // This happens for AutoStyles which are already filled in XMLPropStyleContext::CreateAndInsert,
+ // thus the whole mechanism based on _ContextID_Index_Pair will not work
+ // in that case. Thus the slots which need to be converted already get
+ // converted there (its called first) and not here (see
+ // translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames)
+ // For convenience, still Write back the corrected value to the XMLPropertyState entry
+ rState.maValue <<= sStyleName;
+ break;
+ }
+
+ // Still needed if it's not an AutomaticStyle (!)
+ try
+ {
+ if(!rPropMapper.is())
+ {
+ rPropMapper = xImpPrMap->getPropertySetMapper();
+ }
- // translate the used name from ODF intern to the name used in the Model
- sStyleName = GetImport().GetStyleDisplayName(aFamilies[i - 7], sStyleName);
+ // set property
+ const rtl::OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.mnIndex);
- if(bAutomatic)
+ if(!xInfo.is())
{
- // in this case the rPropSet got not really filled since above the call to
- // CheckSpecialContext was used and not FillPropertySet, thus the below call to
- // setPropertyValue can fail/will not be useful (e.g. when the rPropSet
- // is a SwXTextCursor).
- // This happens for AutoStyles which are already filled in XMLPropStyleContext::CreateAndInsert,
- // thus the whole mechanism based on _ContextID_Index_Pair will not work
- // in that case. Thus the slots which need to be converted already get
- // converted there (its called first) and not here (see
- // translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames)
- // For convenience, still Write back the corrected value to the XMLPropertyState entry
- rState.maValue <<= sStyleName;
- break;
+ xInfo = rPropSet->getPropertySetInfo();
}
- // Still needed if it's not an AutomaticStyle (!)
- try
+ if(xInfo->hasPropertyByName(rPropertyName))
+ {
+ rPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
+ }
+ }
+ catch(css::lang::IllegalArgumentException& e)
+ {
+ Sequence<OUString> aSeq { sStyleName };
+ GetImport().SetError(XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, aSeq, e.Message, nullptr);
+ }
+ break;
+ }
+ default:
+ {
+ // check for StarBats and StarMath fonts
+ Any rAny = rState.maValue;
+ sal_Int32 nMapperIndex = rState.mnIndex;
+
+ // Now check for font name in rState and set corrected value,
+ // if necessary.
+ OUString sFontName;
+ rAny >>= sFontName;
+
+ if ( !sFontName.isEmpty() )
+ {
+ if ( sFontName.equalsIgnoreAsciiCase( "StarBats" ) ||
+ sFontName.equalsIgnoreAsciiCase( "StarMath" ) )
{
+ // construct new value
+ sFontName = "StarSymbol";
+ Any aAny(rAny);
+ aAny <<= sFontName;
+
if(!rPropMapper.is())
{
rPropMapper = xImpPrMap->getPropertySetMapper();
}
// set property
- const rtl::OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.mnIndex);
+ OUString rPropertyName(rPropMapper->GetEntryAPIName(nMapperIndex));
if(!xInfo.is())
{
@@ -568,63 +615,17 @@ void XMLTextStyleContext::FillPropertySet(
if(xInfo->hasPropertyByName(rPropertyName))
{
- rPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
+ rPropSet->setPropertyValue(rPropertyName,aAny);
}
}
- catch(css::lang::IllegalArgumentException& e)
- {
- Sequence<OUString> aSeq { sStyleName };
- GetImport().SetError(XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, aSeq, e.Message, nullptr);
- }
- break;
- }
- default:
- {
- // check for StarBats and StarMath fonts
- Any rAny = rState.maValue;
- sal_Int32 nMapperIndex = rState.mnIndex;
-
- // Now check for font name in rState and set corrected value,
- // if necessary.
- OUString sFontName;
- rAny >>= sFontName;
-
- if ( !sFontName.isEmpty() )
- {
- if ( sFontName.equalsIgnoreAsciiCase( "StarBats" ) ||
- sFontName.equalsIgnoreAsciiCase( "StarMath" ) )
- {
- // construct new value
- sFontName = "StarSymbol";
- Any aAny(rAny);
- aAny <<= sFontName;
-
- if(!rPropMapper.is())
- {
- rPropMapper = xImpPrMap->getPropertySetMapper();
- }
-
- // set property
- OUString rPropertyName(rPropMapper->GetEntryAPIName(nMapperIndex));
-
- if(!xInfo.is())
- {
- xInfo = rPropSet->getPropertySetInfo();
- }
-
- if(xInfo->hasPropertyByName(rPropertyName))
- {
- rPropSet->setPropertyValue(rPropertyName,aAny);
- }
- }
- // else: "normal" style name -> no correction is necessary
- }
- // else: no style name found -> illegal value -> ignore
+ // else: "normal" style name -> no correction is necessary
}
+ // else: no style name found -> illegal value -> ignore
}
}
}
}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */