filter/source/svg/svgexport.cxx | 449 +++++++++++++++++------------------ filter/source/svg/svgfontexport.cxx | 36 +- filter/source/svg/svgwriter.cxx | 459 +++++++++++++++++------------------- 3 files changed, 463 insertions(+), 481 deletions(-)
New commits: commit e42a919c04de8c1772b626d38dcb73504cd535cd Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat May 31 21:43:14 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat May 31 21:51:16 2025 +0200 Remove XML_NAMESPACE_NONE noise from svg Change-Id: I0612af01d080c009c970672b9d265cdfc47ad10d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186093 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 28b9980d5f88..1ddc6b47b8b1 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -136,7 +136,7 @@ public: virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const = 0; virtual void elementExport( SVGExport* pSVGExport ) const { - pSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, getClassName() ); + pSVGExport->AddAttribute(u"class"_ustr, getClassName()); } void insertMasterPage( const Reference< css::drawing::XDrawPage>& xMasterPage ) { @@ -180,7 +180,7 @@ public: virtual void elementExport( SVGExport* pSVGExport ) const override { TextField::elementExport( pSVGExport ); - SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp(*pSVGExport, u"g"_ustr, true, true); pSVGExport->GetDocHandler()->characters( text ); } }; @@ -308,8 +308,8 @@ public: OUString sDateTimeFormat = sDateFormat + " " + sTimeFormat; - pSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "date-time-format"_ustr, sDateTimeFormat ); - SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + pSVGExport->AddAttribute(NSPREFIX "date-time-format"_ustr, sDateTimeFormat); + SvXMLElementExport aExp(*pSVGExport, u"g"_ustr, true, true); } virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const override { @@ -1065,25 +1065,22 @@ void SVGFilter::implExportDocumentHeaderImpressOrDraw(sal_Int32 nDocX, sal_Int32 xExtDocHandler->unknown( SVG_DTD_STRING ); } - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"version"_ustr, u"1.2"_ustr ); + mpSVGExport->AddAttribute(u"version"_ustr, u"1.2"_ustr); if( mpSVGExport->IsUseTinyProfile() ) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"baseProfile"_ustr, u"tiny"_ustr ); + mpSVGExport->AddAttribute(u"baseProfile"_ustr, u"tiny"_ustr); // The following if block means that the slide size is not adapted // to the size of the browser window, moreover the slide is top left aligned // instead of centered: - OUString aAttr; if( !mbPresentation ) { - aAttr = OUString::number( nDocWidth * 0.01 ) + "mm"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, aAttr ); - - aAttr = OUString::number( nDocHeight * 0.01 ) + "mm"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, aAttr ); + mpSVGExport->AddAttribute(u"width"_ustr, OUString::number(nDocWidth * 0.01) + "mm"); + mpSVGExport->AddAttribute(u"height"_ustr, OUString::number(nDocHeight * 0.01) + "mm"); } // #i124608# set viewBox explicitly to the exported content + OUString aAttr; if (mbExportShapeSelection) { aAttr = OUString::number(nDocX) + " " + OUString::number(nDocY) + " "; @@ -1095,57 +1092,57 @@ void SVGFilter::implExportDocumentHeaderImpressOrDraw(sal_Int32 nDocX, sal_Int32 aAttr += OUString::number(nDocWidth) + " " + OUString::number(nDocHeight); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"viewBox"_ustr, aAttr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"preserveAspectRatio"_ustr, u"xMidYMid"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"fill-rule"_ustr, u"evenodd"_ustr ); + mpSVGExport->AddAttribute(u"viewBox"_ustr, aAttr); + mpSVGExport->AddAttribute(u"preserveAspectRatio"_ustr, u"xMidYMid"_ustr); + mpSVGExport->AddAttribute(u"fill-rule"_ustr, u"evenodd"_ustr); - // standard line width is based on 1 pixel on a 90 DPI device (0.28222mmm) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"stroke-width"_ustr, OUString::number( 28.222 ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"stroke-linejoin"_ustr, u"round"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns"_ustr, constSvgNamespace ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:ooo"_ustr, u"http://xml.openoffice.org/svg/export"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:xlink"_ustr, u"http://www.w3.org/1999/xlink"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:presentation"_ustr, u"http://sun.com/xmlns/staroffice/presentation"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:smil"_ustr, u"http://www.w3.org/2001/SMIL20/"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:anim"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:animation:1.0"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:svg"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xml:space"_ustr, u"preserve"_ustr ); + // standard line width is based on 1 pixel on a 90 DPI device (0.28222mm) + mpSVGExport->AddAttribute( u"stroke-width"_ustr, u"28.222"_ustr ); + mpSVGExport->AddAttribute( u"stroke-linejoin"_ustr, u"round"_ustr ); + mpSVGExport->AddAttribute( u"xmlns"_ustr, constSvgNamespace ); + mpSVGExport->AddAttribute( u"xmlns:ooo"_ustr, u"http://xml.openoffice.org/svg/export"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:xlink"_ustr, u"http://www.w3.org/1999/xlink"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:presentation"_ustr, u"http://sun.com/xmlns/staroffice/presentation"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:smil"_ustr, u"http://www.w3.org/2001/SMIL20/"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:anim"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:animation:1.0"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:svg"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"_ustr ); + mpSVGExport->AddAttribute( u"xml:space"_ustr, u"preserve"_ustr ); - mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, u"svg"_ustr, true, true ); + mpSVGDoc = new SvXMLElementExport(*mpSVGExport, u"svg"_ustr, true, true); // Create a ClipPath element that will be used for cutting bitmaps and other elements that could exceed the page margins. if(mbExportShapeSelection) return; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"ClipPathGroup"_ustr ); - SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"ClipPathGroup"_ustr); + SvXMLElementExport aDefsElem(*mpSVGExport, u"defs"_ustr, true, true); { msClipPathId = "presentation_clip_path"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, msClipPathId ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"clipPathUnits"_ustr, u"userSpaceOnUse"_ustr ); - SvXMLElementExport aClipPathElem( *mpSVGExport, XML_NAMESPACE_NONE, u"clipPath"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, msClipPathId); + mpSVGExport->AddAttribute(u"clipPathUnits"_ustr, u"userSpaceOnUse"_ustr); + SvXMLElementExport aClipPathElem(*mpSVGExport, u"clipPath"_ustr, true, true); { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"x"_ustr, OUString::number( nDocX ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"y"_ustr, OUString::number( nDocY ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, OUString::number( nDocWidth ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, OUString::number( nDocHeight ) ); - SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, u"rect"_ustr, true, true ); + mpSVGExport->AddAttribute(u"x"_ustr, OUString::number(nDocX)); + mpSVGExport->AddAttribute(u"y"_ustr, OUString::number(nDocY)); + mpSVGExport->AddAttribute(u"width"_ustr, OUString::number(nDocWidth)); + mpSVGExport->AddAttribute(u"height"_ustr, OUString::number(nDocHeight)); + SvXMLElementExport aRectElem(*mpSVGExport, u"rect"_ustr, true, true); } } // Create a ClipPath element applied to the leaving slide in order // to avoid that slide borders are visible during transition { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, u"presentation_clip_path_shrink"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"clipPathUnits"_ustr, u"userSpaceOnUse"_ustr ); - SvXMLElementExport aClipPathElem( *mpSVGExport, XML_NAMESPACE_NONE, u"clipPath"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, u"presentation_clip_path_shrink"_ustr); + mpSVGExport->AddAttribute(u"clipPathUnits"_ustr, u"userSpaceOnUse"_ustr); + SvXMLElementExport aClipPathElem(*mpSVGExport, u"clipPath"_ustr, true, true); { sal_Int32 nDocWidthExt = nDocWidth / 500; sal_Int32 nDocHeightExt = nDocHeight / 500; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"x"_ustr, OUString::number( nDocX + nDocWidthExt / 2 ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"y"_ustr, OUString::number( nDocY + nDocHeightExt / 2) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, OUString::number( nDocWidth - nDocWidthExt ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, OUString::number( nDocHeight - nDocHeightExt ) ); - SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, u"rect"_ustr, true, true ); + mpSVGExport->AddAttribute(u"x"_ustr, OUString::number(nDocX + nDocWidthExt / 2)); + mpSVGExport->AddAttribute(u"y"_ustr, OUString::number(nDocY + nDocHeightExt / 2)); + mpSVGExport->AddAttribute(u"width"_ustr, OUString::number(nDocWidth - nDocWidthExt)); + mpSVGExport->AddAttribute(u"height"_ustr, OUString::number(nDocHeight - nDocHeightExt)); + SvXMLElementExport aRectElem(*mpSVGExport, u"rect"_ustr, true, true); } } } @@ -1153,33 +1150,29 @@ void SVGFilter::implExportDocumentHeaderImpressOrDraw(sal_Int32 nDocX, sal_Int32 void SVGFilter::implExportDocumentHeaderWriterOrCalc(sal_Int32 nDocX, sal_Int32 nDocY, sal_Int32 nDocWidth, sal_Int32 nDocHeight) { - OUString aAttr; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"version"_ustr, u"1.2"_ustr ); + mpSVGExport->AddAttribute(u"version"_ustr, u"1.2"_ustr); - aAttr = OUString::number( nDocWidth * 0.01 ) + "mm"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, aAttr ); + mpSVGExport->AddAttribute(u"width"_ustr, OUString::number(nDocWidth * 0.01) + "mm"); + mpSVGExport->AddAttribute(u"height"_ustr, OUString::number(nDocHeight * 0.01) + "mm"); - aAttr = OUString::number( nDocHeight * 0.01 ) + "mm"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, aAttr ); - - aAttr = OUString::number(nDocX) + " " + OUString::number(nDocY) + " " + + OUString aAttr = OUString::number(nDocX) + " " + OUString::number(nDocY) + " " + OUString::number(nDocWidth) + " " + OUString::number(nDocHeight); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"viewBox"_ustr, aAttr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"preserveAspectRatio"_ustr, u"xMidYMid"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"fill-rule"_ustr, u"evenodd"_ustr ); - - // standard line width is based on 1 pixel on a 90 DPI device (0.28222mmm) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"stroke-width"_ustr, OUString::number( 28.222 ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"stroke-linejoin"_ustr, u"round"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns"_ustr, constSvgNamespace ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:ooo"_ustr, u"http://xml.openoffice.org/svg/export"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:xlink"_ustr, u"http://www.w3.org/1999/xlink"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:office"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:office:1.0"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xmlns:smil"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xml:space"_ustr, u"preserve"_ustr ); - - mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, u"svg"_ustr, true, true ); + mpSVGExport->AddAttribute(u"viewBox"_ustr, aAttr); + mpSVGExport->AddAttribute(u"preserveAspectRatio"_ustr, u"xMidYMid"_ustr); + mpSVGExport->AddAttribute(u"fill-rule"_ustr, u"evenodd"_ustr); + + // standard line width is based on 1 pixel on a 90 DPI device (0.28222mm) + mpSVGExport->AddAttribute( u"stroke-width"_ustr, u"28.222"_ustr ); + mpSVGExport->AddAttribute( u"stroke-linejoin"_ustr, u"round"_ustr ); + mpSVGExport->AddAttribute( u"xmlns"_ustr, constSvgNamespace ); + mpSVGExport->AddAttribute( u"xmlns:ooo"_ustr, u"http://xml.openoffice.org/svg/export"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:xlink"_ustr, u"http://www.w3.org/1999/xlink"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:office"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:office:1.0"_ustr ); + mpSVGExport->AddAttribute( u"xmlns:smil"_ustr, u"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"_ustr ); + mpSVGExport->AddAttribute( u"xml:space"_ustr, u"preserve"_ustr ); + + mpSVGDoc = new SvXMLElementExport(*mpSVGExport, u"svg"_ustr, true, true); } /// Append aField to aFieldSet if it is not already present in the set and create the field id sFieldId @@ -1218,15 +1211,15 @@ void SVGFilter::implGenerateMetaData() return; // we wrap all meta presentation info into a svg:defs element - SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + SvXMLElementExport aDefsElem(*mpSVGExport, u"defs"_ustr, true, true); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, NSPREFIX "meta_slides"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "number-of-slides"_ustr, OUString::number( nCount ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "start-slide-number"_ustr, OUString::number( mnVisiblePage ) ); + mpSVGExport->AddAttribute( u"id"_ustr, NSPREFIX "meta_slides"_ustr ); + mpSVGExport->AddAttribute( NSPREFIX "number-of-slides"_ustr, OUString::number( nCount ) ); + mpSVGExport->AddAttribute( NSPREFIX "start-slide-number"_ustr, OUString::number( mnVisiblePage ) ); if( mpSVGExport->IsUsePositionedCharacters() ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "use-positioned-chars"_ustr, u"true"_ustr ); + mpSVGExport->AddAttribute(NSPREFIX "use-positioned-chars"_ustr, u"true"_ustr); } // Add a (global) Page Numbering Type attribute for the document @@ -1267,12 +1260,12 @@ void SVGFilter::implGenerateMetaData() break; } if( !sNumberingType.isEmpty() ) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "page-numbering-type"_ustr, sNumberingType ); + mpSVGExport->AddAttribute(NSPREFIX "page-numbering-type"_ustr, sNumberingType); } { - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp(*mpSVGExport, u"g"_ustr, true, true); const OUString aId( NSPREFIX "meta_slide"_ustr ); const OUString aElemTextFieldId( aOOOElemTextField ); std::vector< std::unique_ptr<TextField> > aFieldSet; @@ -1280,13 +1273,13 @@ void SVGFilter::implGenerateMetaData() // dummy slide - used as leaving slide for transition on the first slide if( mbPresentation ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, NSPREFIX "meta_dummy_slide"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, u"dummy-slide"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, u"dummy-master-page"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, u"hidden"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMasterObjectsVisibility, u"hidden"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrHasTransition, u"false"_ustr ); - SvXMLElementExport aMetaDummySlideElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, NSPREFIX "meta_dummy_slide"_ustr); + mpSVGExport->AddAttribute(aOOOAttrSlide, u"dummy-slide"_ustr); + mpSVGExport->AddAttribute(aOOOAttrMaster, u"dummy-master-page"_ustr); + mpSVGExport->AddAttribute(aOOOAttrBackgroundVisibility, u"hidden"_ustr); + mpSVGExport->AddAttribute(aOOOAttrMasterObjectsVisibility, u"hidden"_ustr); + mpSVGExport->AddAttribute(aOOOAttrHasTransition, u"false"_ustr); + SvXMLElementExport aMetaDummySlideElem(*mpSVGExport, u"g"_ustr, true, true); } for( sal_Int32 i = 0; i < nCount; ++i ) @@ -1298,9 +1291,9 @@ void SVGFilter::implGenerateMetaData() Reference< css::drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage(); OUString aSlideId(aId + "_" + OUString::number( i )); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, aSlideId ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, implGetValidIDFromInterface( xDrawPage ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, implGetValidIDFromInterface( xMasterPage ) ); + mpSVGExport->AddAttribute(u"id"_ustr, aSlideId); + mpSVGExport->AddAttribute(aOOOAttrSlide, implGetValidIDFromInterface(xDrawPage)); + mpSVGExport->AddAttribute(aOOOAttrMaster, implGetValidIDFromInterface(xMasterPage)); if( mbPresentation ) @@ -1312,7 +1305,7 @@ void SVGFilter::implGenerateMetaData() OUString sDisplayName; if (xPropSet->getPropertyValue(u"LinkDisplayName"_ustr) >>= sDisplayName) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDisplayName, sDisplayName); + mpSVGExport->AddAttribute(aOOOAttrDisplayName, sDisplayName); } bool bBackgroundVisibility = true; // default: visible @@ -1331,13 +1324,13 @@ void SVGFilter::implGenerateMetaData() bool assigned = ( xBackground->getPropertyValue( u"FillStyle"_ustr ) >>= aFillStyle ); // has a custom background ? if( assigned && aFillStyle != drawing::FillStyle_NONE ) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrHasCustomBackground, u"true"_ustr ); + mpSVGExport->AddAttribute(aOOOAttrHasCustomBackground, u"true"_ustr); } xPropSet->getPropertyValue( u"IsBackgroundVisible"_ustr ) >>= bBackgroundVisibility; // in case the attribute is set to its default value it is not appended to the meta-slide element if( !bBackgroundVisibility ) // visibility default value: 'visible' - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, u"hidden"_ustr ); + mpSVGExport->AddAttribute(aOOOAttrBackgroundVisibility, u"hidden"_ustr); // Page Number, DateTime, Footer and Header Fields are regarded as background objects. // So bBackgroundObjectsVisibility overrides visibility of master page text fields. @@ -1353,7 +1346,7 @@ void SVGFilter::implGenerateMetaData() bPageNumberVisibility = bPageNumberVisibility && ( nPageNumberingType != css::style::NumberingType::NUMBER_NONE ); if( bPageNumberVisibility ) // visibility default value: 'hidden' { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "page-number-visibility"_ustr, u"visible"_ustr ); + mpSVGExport->AddAttribute( NSPREFIX "page-number-visibility"_ustr, u"visible"_ustr ); } // DateTime Field @@ -1365,19 +1358,19 @@ void SVGFilter::implGenerateMetaData() if( !aFixedDateTimeField.text.isEmpty() ) { OUString sFieldId = implGenerateFieldId( aFieldSet, aFixedDateTimeField, aElemTextFieldId, xMasterPage ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId ); + mpSVGExport->AddAttribute(aOOOAttrDateTimeField, sFieldId); } } else // the inverse applies: we are interested only in the date/time format not in the field text { xPropSet->getPropertyValue( u"DateTimeFormat"_ustr ) >>= aVariableDateTimeField.format; OUString sFieldId = implGenerateFieldId( aFieldSet, aVariableDateTimeField, aElemTextFieldId, xMasterPage ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId ); + mpSVGExport->AddAttribute(aOOOAttrDateTimeField, sFieldId); } xPropSet->getPropertyValue( u"IsDateTimeVisible"_ustr ) >>= bDateTimeVisibility; if( !bDateTimeVisibility ) // visibility default value: 'visible' { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "date-time-visibility"_ustr, u"hidden"_ustr ); + mpSVGExport->AddAttribute( NSPREFIX "date-time-visibility"_ustr, u"hidden"_ustr ); } // Footer Field @@ -1385,17 +1378,17 @@ void SVGFilter::implGenerateMetaData() if( !aFooterField.text.isEmpty() ) { OUString sFieldId = implGenerateFieldId( aFieldSet, aFooterField, aElemTextFieldId, xMasterPage ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterField, sFieldId ); + mpSVGExport->AddAttribute(aOOOAttrFooterField, sFieldId); } xPropSet->getPropertyValue( u"IsFooterVisible"_ustr ) >>= bFooterVisibility; if( !bFooterVisibility ) // visibility default value: 'visible' { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "footer-visibility"_ustr, u"hidden"_ustr ); + mpSVGExport->AddAttribute( NSPREFIX "footer-visibility"_ustr, u"hidden"_ustr ); } } else { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMasterObjectsVisibility, u"hidden"_ustr ); + mpSVGExport->AddAttribute(aOOOAttrMasterObjectsVisibility, u"hidden"_ustr); } sal_Int32 nChange(0); @@ -1407,7 +1400,7 @@ void SVGFilter::implGenerateMetaData() if( xPropSet->getPropertySetInfo()->hasPropertyByName( u"HighResDuration"_ustr ) && (xPropSet->getPropertyValue( u"HighResDuration"_ustr ) >>= fSlideDuration) ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlideDuration, OUString::number(fSlideDuration) ); + mpSVGExport->AddAttribute( aOOOAttrSlideDuration, OUString::number(fSlideDuration) ); } } // We look for a slide transition. @@ -1419,7 +1412,7 @@ void SVGFilter::implGenerateMetaData() sal_Int16 nTransitionSubType(0); if( xPropSet->getPropertyValue( u"TransitionSubtype"_ustr ) >>= nTransitionSubType ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrHasTransition, u"true"_ustr ); + mpSVGExport->AddAttribute(aOOOAttrHasTransition, u"true"_ustr); } } @@ -1427,7 +1420,7 @@ void SVGFilter::implGenerateMetaData() } { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp2(*mpSVGExport, u"g"_ustr, true, true); } // when the aExp2 destructor is called the </g> tag is appended to the output file } @@ -1437,7 +1430,7 @@ void SVGFilter::implGenerateMetaData() for( sal_Int32 i = 0, nSize = aFieldSet.size(); i < nSize; ++i ) { OUString sElemId = OUString::Concat(aOOOElemTextField) + "_" + OUString::number( i ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sElemId ); + mpSVGExport->AddAttribute(u"id"_ustr, sElemId); aFieldSet[i]->elementExport( mpSVGExport.get() ); } if( mpSVGExport->IsEmbedFonts() && mpSVGExport->IsUsePositionedCharacters() ) @@ -1457,8 +1450,8 @@ void SVGFilter::implGenerateMetaData() void SVGFilter::implExportAnimations() { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, u"presentation-animations"_ustr ); - SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, u"presentation-animations"_ustr); + SvXMLElementExport aDefsContainerElem(*mpSVGExport, u"defs"_ustr, true, true); for(const uno::Reference<drawing::XDrawPage> & mSelectedPage : mSelectedPages) { @@ -1497,11 +1490,11 @@ void SVGFilter::implExportAnimations() if( bHasEffects ) { OUString sId = implGetValidIDFromInterface( mSelectedPage ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, sId ); + mpSVGExport->AddAttribute(aOOOAttrSlide, sId); sId += "-animations"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Animations"_ustr ); - SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, sId); + mpSVGExport->AddAttribute(u"class"_ustr, u"Animations"_ustr); + SvXMLElementExport aDefsElem(*mpSVGExport, u"defs"_ustr, true, true); rtl::Reference< xmloff::AnimationsExporter > xAnimationsExporter = new xmloff::AnimationsExporter( *mpSVGExport, xProps ); xAnimationsExporter->prepare( xRootNode ); @@ -1519,8 +1512,8 @@ void SVGFilter::implExportTextShapeIndex() if(mbExportShapeSelection) return; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"TextShapeIndex"_ustr ); - SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"TextShapeIndex"_ustr); + SvXMLElementExport aDefsContainerElem(*mpSVGExport, u"defs"_ustr, true, true); sal_Int32 nCount = mSelectedPages.size(); for( sal_Int32 i = 0; i < nCount; ++i ) @@ -1533,9 +1526,9 @@ void SVGFilter::implExportTextShapeIndex() const OUString& rPageId = implGetValidIDFromInterface( Reference<XInterface>(xDrawPage, UNO_QUERY) ); if( !rPageId.isEmpty() && !sTextShapeIdList.isEmpty() ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, rPageId ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "id-list"_ustr, sTextShapeIdList ); - SvXMLElementExport aGElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(aOOOAttrSlide, rPageId); + mpSVGExport->AddAttribute(NSPREFIX "id-list"_ustr, sTextShapeIdList); + SvXMLElementExport aGElem(*mpSVGExport, u"g"_ustr, true, true); } } } @@ -1544,8 +1537,8 @@ void SVGFilter::implExportTextShapeIndex() void SVGFilter::implEmbedBulletGlyphs() { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"EmbeddedBulletChars"_ustr ); - SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"EmbeddedBulletChars"_ustr); + SvXMLElementExport aDefsContainerElem(*mpSVGExport, u"defs"_ustr, true, true); OUString sPathData = u"M 580,1141 L 1163,571 580,0 -4,571 580,1141 Z"_ustr; implEmbedBulletGlyph( 57356, sPathData ); @@ -1573,16 +1566,16 @@ void SVGFilter::implEmbedBulletGlyphs() void SVGFilter::implEmbedBulletGlyph( sal_Unicode cBullet, const OUString & sPathData ) { OUString sId = "bullet-char-template-" + OUString::number( static_cast<sal_Int32>(cBullet) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); + mpSVGExport->AddAttribute(u"id"_ustr, sId); OUString sFactor = OUString::number( 1.0 / 2048 ); OUString sTransform = "scale(" + sFactor + ",-" + sFactor + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"transform"_ustr, sTransform ); + mpSVGExport->AddAttribute(u"transform"_ustr, sTransform); - SvXMLElementExport aGElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aGElem(*mpSVGExport, u"g"_ustr, true, true); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"d"_ustr, sPathData ); - SvXMLElementExport aPathElem( *mpSVGExport, XML_NAMESPACE_NONE, u"path"_ustr, true, true ); + mpSVGExport->AddAttribute(u"d"_ustr, sPathData); + SvXMLElementExport aPathElem(*mpSVGExport, u"path"_ustr, true, true); mpSVGExport->SetEmbeddedBulletGlyph(cBullet); } @@ -1592,8 +1585,8 @@ void SVGFilter::implExportBackgroundBitmaps() if (maBitmapActionMap.empty()) return; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BackgroundBitmaps"_ustr ); - SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"BackgroundBitmaps"_ustr); + SvXMLElementExport aDefsContainerElem(*mpSVGExport, u"defs"_ustr, true, true); OUString sId; for( const auto& rItem : maBitmapActionMap ) @@ -1604,7 +1597,7 @@ void SVGFilter::implExportBackgroundBitmaps() if( pBitmapAction ) { sId = "bitmap(" + OUString::number( nChecksum ) + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); + mpSVGExport->AddAttribute(u"id"_ustr, sId); const Point aPos; // (0, 0) const Size aSize = aEmbeddedBitmapMtf.GetPrefSize(); @@ -1618,8 +1611,8 @@ void SVGFilter::implExportTiledBackground() if( maPatterProps.empty() ) return; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BackgroundPatterns"_ustr ); - SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"BackgroundPatterns"_ustr); + SvXMLElementExport aDefsContainerElem(*mpSVGExport, u"defs"_ustr, true, true); for( const auto& [ rSlideId, rData ] : maPatterProps ) { @@ -1631,15 +1624,15 @@ void SVGFilter::implExportTiledBackground() // <pattern> <use> { // pattern element attributes - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sPatternId ); + mpSVGExport->AddAttribute(u"id"_ustr, sPatternId); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"x"_ustr, OUString::number( rData.aPos.X() ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"y"_ustr, OUString::number( rData.aPos.Y() ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, OUString::number( rData.aSize.Width() ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, OUString::number( rData.aSize.Height() ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"patternUnits"_ustr, u"userSpaceOnUse"_ustr ); + mpSVGExport->AddAttribute(u"x"_ustr, OUString::number(rData.aPos.X())); + mpSVGExport->AddAttribute(u"y"_ustr, OUString::number(rData.aPos.Y())); + mpSVGExport->AddAttribute(u"width"_ustr, OUString::number(rData.aSize.Width())); + mpSVGExport->AddAttribute(u"height"_ustr, OUString::number(rData.aSize.Height())); + mpSVGExport->AddAttribute(u"patternUnits"_ustr, u"userSpaceOnUse"_ustr); - SvXMLElementExport aPatternElem( *mpSVGExport, XML_NAMESPACE_NONE, u"pattern"_ustr, true, true ); + SvXMLElementExport aPatternElem(*mpSVGExport, u"pattern"_ustr, true, true); // use element attributes const Size& aOrigSize = aBitmapActionIt->second->GetPrefSize(); @@ -1652,33 +1645,33 @@ void SVGFilter::implExportTiledBackground() sTransform += " scale(" + OUString::number( double(aFractionX) ) + ", " + OUString::number( double(aFractionY) ) + ")"; if( !sTransform.isEmpty() ) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"transform"_ustr, sTransform ); + mpSVGExport->AddAttribute(u"transform"_ustr, sTransform); // referenced bitmap OUString sRefId = "#bitmap(" + OUString::number( rData.aBitmapChecksum ) + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xlink:href"_ustr, sRefId ); + mpSVGExport->AddAttribute(u"xlink:href"_ustr, sRefId); - SvXMLElementExport aUseElem( *mpSVGExport, XML_NAMESPACE_NONE, u"use"_ustr, true, true ); + SvXMLElementExport aUseElem(*mpSVGExport, u"use"_ustr, true, true); } // </use> </pattern> // <g> <rect> { // group const OUString sBgId = getIdForTiledBackground( rSlideId, rData.aBitmapChecksum ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sBgId ); + mpSVGExport->AddAttribute(u"id"_ustr, sBgId); - SvXMLElementExport aGroupElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aGroupElem(*mpSVGExport, u"g"_ustr, true, true); // rectangle const OUString sUrl = "url(#" + sPatternId + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"x"_ustr, u"0"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"y"_ustr, u"0"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, OUString::number( rData.aSlideSize.Width() ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, OUString::number( rData.aSlideSize.Height() ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"stroke"_ustr, u"none"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"fill"_ustr, sUrl ); - - SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, u"rect"_ustr, true, true ); + mpSVGExport->AddAttribute( u"x"_ustr, u"0"_ustr ); + mpSVGExport->AddAttribute( u"y"_ustr, u"0"_ustr ); + mpSVGExport->AddAttribute( u"width"_ustr, OUString::number( rData.aSlideSize.Width() ) ); + mpSVGExport->AddAttribute( u"height"_ustr, OUString::number( rData.aSlideSize.Height() ) ); + mpSVGExport->AddAttribute( u"stroke"_ustr, u"none"_ustr ); + mpSVGExport->AddAttribute( u"fill"_ustr, sUrl ); + + SvXMLElementExport aRectElem(*mpSVGExport, u"rect"_ustr, true, true); } // </g> </rect> } } @@ -1693,8 +1686,8 @@ void SVGFilter::implExportTextEmbeddedBitmaps() if (mEmbeddedBitmapActionSet.empty()) return; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"TextEmbeddedBitmaps"_ustr ); - SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"TextEmbeddedBitmaps"_ustr); + SvXMLElementExport aDefsContainerElem(*mpSVGExport, u"defs"_ustr, true, true); OUString sId; @@ -1709,7 +1702,7 @@ void SVGFilter::implExportTextEmbeddedBitmaps() { BitmapChecksum nId = GetBitmapChecksum( pAction ); sId = "bitmap(" + OUString::number( nId ) + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); + mpSVGExport->AddAttribute(u"id"_ustr, sId); const Reference< XInterface >& rxShape = embeddedBitmapAction.GetObject(); Reference< XPropertySet > xShapePropSet( rxShape, UNO_QUERY ); @@ -1754,10 +1747,10 @@ void SVGFilter::implExportTextEmbeddedBitmaps() void SVGFilter::implGenerateScript() { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"type"_ustr, u"text/ecmascript"_ustr ); + mpSVGExport->AddAttribute(u"type"_ustr, u"text/ecmascript"_ustr); { - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, u"script"_ustr, true, true ); + SvXMLElementExport aExp(*mpSVGExport, u"script"_ustr, true, true); Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); if( xExtDocHandler.is() ) @@ -1829,26 +1822,26 @@ bool SVGFilter::implExportMasterPages( const std::vector< Reference< css::drawin // When the exported slides are more than one we wrap master page elements // with a svg <defs> element. OUString aContainerTag = (!mbPresentation) ? u"g"_ustr : u"defs"_ustr; - SvXMLElementExport aContainerElement( *mpSVGExport, XML_NAMESPACE_NONE, aContainerTag, true, true ); + SvXMLElementExport aContainerElement(*mpSVGExport, aContainerTag, true, true); // dummy slide - used as leaving slide for transition on the first slide if( mbPresentation ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, u"dummy-master-page"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, u"dummy-master-page"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Master_Slide"_ustr ); - SvXMLElementExport aMasterSlideElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, u"dummy-master-page"_ustr); + mpSVGExport->AddAttribute(aOOOAttrName, u"dummy-master-page"_ustr); + mpSVGExport->AddAttribute(u"class"_ustr, u"Master_Slide"_ustr); + SvXMLElementExport aMasterSlideElem(*mpSVGExport, u"g"_ustr, true, true); { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, u"bg-dummy-master-page"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Background"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"visibility"_ustr, u"hidden"_ustr ); - SvXMLElementExport aBackgroundElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, u"bg-dummy-master-page"_ustr); + mpSVGExport->AddAttribute(u"class"_ustr, u"Background"_ustr); + mpSVGExport->AddAttribute(u"visibility"_ustr, u"hidden"_ustr); + SvXMLElementExport aBackgroundElem(*mpSVGExport, u"g"_ustr, true, true); } { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, u"bo-dummy-master-page"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BackgroundObjects"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"visibility"_ustr, u"hidden"_ustr ); - SvXMLElementExport aBackgroundObjectElem( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, u"bo-dummy-master-page"_ustr); + mpSVGExport->AddAttribute(u"class"_ustr, u"BackgroundObjects"_ustr); + mpSVGExport->AddAttribute(u"visibility"_ustr, u"hidden"_ustr); + SvXMLElementExport aBackgroundObjectElem(*mpSVGExport, u"g"_ustr, true, true); } } @@ -1859,7 +1852,7 @@ bool SVGFilter::implExportMasterPages( const std::vector< Reference< css::drawin { // add id attribute const OUString & sPageId = implGetValidIDFromInterface( rxPages[i] ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sPageId ); + mpSVGExport->AddAttribute(u"id"_ustr, sPageId); bRet = implExportPage( sPageId, rxPages[i], rxPages[i], true /* is a master page */ ) || bRet; } @@ -1877,20 +1870,20 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< css::drawing: // dummy slide - used as leaving slide for transition on the first slide if( mbPresentation && !mbExportShapeSelection) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"DummySlide"_ustr ); - SvXMLElementExport aDummySlideElement( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"DummySlide"_ustr); + SvXMLElementExport aDummySlideElement(*mpSVGExport, u"g"_ustr, true, true); { - SvXMLElementExport aGElement( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aGElement(*mpSVGExport, u"g"_ustr, true, true); { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, u"dummy-slide"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Slide"_ustr ); + mpSVGExport->AddAttribute(u"id"_ustr, u"dummy-slide"_ustr); + mpSVGExport->AddAttribute(u"class"_ustr, u"Slide"_ustr); OUString sClipPathAttrValue = "url(#" + msClipPathId + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"clip-path"_ustr, sClipPathAttrValue ); - SvXMLElementExport aSlideElement( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"clip-path"_ustr, sClipPathAttrValue); + SvXMLElementExport aSlideElement(*mpSVGExport, u"g"_ustr, true, true); { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, u"dummy-page"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Page"_ustr ); - SvXMLElementExport aPageElement( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(aOOOAttrName, u"dummy-page"_ustr); + mpSVGExport->AddAttribute(u"class"_ustr, u"Page"_ustr); + SvXMLElementExport aPageElement(*mpSVGExport, u"g"_ustr, true, true); } } } @@ -1899,8 +1892,8 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< css::drawing: if (!mbExportShapeSelection) { // We wrap all slide in a group element with class name "SlideGroup". - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"SlideGroup"_ustr ); - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, u"SlideGroup"_ustr); + SvXMLElementExport aExp(*mpSVGExport, u"g"_ustr, true, true); if (mxStatusIndicator) mxStatusIndicator->start(FilterResId(STR_FILTER_DOC_SAVING), nLastPage - nFirstPage + 1); @@ -1920,9 +1913,9 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< css::drawing: // visibility of each slide is set to 'hidden'. if( mbPresentation ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"visibility"_ustr, u"hidden"_ustr ); + mpSVGExport->AddAttribute(u"visibility"_ustr, u"hidden"_ustr); } - SvXMLElementExport aGElement( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aGElement(*mpSVGExport, u"g"_ustr, true, true); { @@ -1931,22 +1924,22 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< css::drawing: // when switching from the last to the first slide. const OUString & sPageId = implGetValidIDFromInterface( rxPages[i] ); OUString sContainerId = "container-" + sPageId; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sContainerId ); - SvXMLElementExport aContainerExp( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"id"_ustr, sContainerId); + SvXMLElementExport aContainerExp(*mpSVGExport, u"g"_ustr, true, true); { // add id attribute - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sPageId ); + mpSVGExport->AddAttribute(u"id"_ustr, sPageId); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Slide"_ustr ); + mpSVGExport->AddAttribute(u"class"_ustr, u"Slide"_ustr); // Adding a clip path to each exported slide , so in case // bitmaps or other elements exceed the slide margins, they are // trimmed, even when they are shown inside a thumbnail view. OUString sClipPathAttrValue = "url(#" + msClipPathId + ")"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"clip-path"_ustr, sClipPathAttrValue ); + mpSVGExport->AddAttribute(u"clip-path"_ustr, sClipPathAttrValue); - SvXMLElementExport aSlideElement( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aSlideElement(*mpSVGExport, u"g"_ustr, true, true); implExportPage( sPageId, rxPages[i], xShapes, false /* is not a master page */ ); } @@ -1978,7 +1971,7 @@ bool SVGFilter::implExportPage( std::u16string_view sPageId, { OUString sPageName = implGetInterfaceName( rxPage ); if( mbPresentation && !sPageName.isEmpty() ) - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, sPageName ); + mpSVGExport->AddAttribute(aOOOAttrName, sPageName); { Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); @@ -1992,12 +1985,12 @@ bool SVGFilter::implExportPage( std::u16string_view sPageId, else aDesc = "Page"; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, aDesc ); + mpSVGExport->AddAttribute(u"class"_ustr, aDesc); } } // insert the <g> open tag related to the DrawPage/MasterPage - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp(*mpSVGExport, u"g"_ustr, true, true); // In case the page has a background object we append it . if( mpObjects->find( rxPage ) != mpObjects->end() ) @@ -2012,13 +2005,13 @@ bool SVGFilter::implExportPage( std::u16string_view sPageId, std::unique_ptr<SvXMLElementExport> xDefsExp; if (!bMaster) // insert the <defs> open tag related to the slide background { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"SlideBackground"_ustr ); - xDefsExp.reset( new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ) ); + mpSVGExport->AddAttribute(u"class"_ustr, u"SlideBackground"_ustr); + xDefsExp.reset(new SvXMLElementExport(*mpSVGExport, u"defs"_ustr, true, true)); } { // background id = "bg-" + page id OUString sBackgroundId = OUString::Concat("bg-") + sPageId; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sBackgroundId ); + mpSVGExport->AddAttribute(u"id"_ustr, sBackgroundId); // At present (LibreOffice 3.4.0) the 'IsBackgroundVisible' property is not handled // by Impress; anyway we handle this property as referring only to the visibility @@ -2031,14 +2024,14 @@ bool SVGFilter::implExportPage( std::u16string_view sPageId, { if( !mVisiblePagePropSet.bIsBackgroundVisible ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"visibility"_ustr, u"hidden"_ustr ); + mpSVGExport->AddAttribute(u"visibility"_ustr, u"hidden"_ustr); } } - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Background"_ustr ); + mpSVGExport->AddAttribute(u"class"_ustr, u"Background"_ustr); // insert the <g> open tag related to the Background - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp2(*mpSVGExport, u"g"_ustr, true, true); // append all elements that make up the Background const Point aNullPt; @@ -2054,18 +2047,18 @@ bool SVGFilter::implExportPage( std::u16string_view sPageId, { // background objects id = "bo-" + page id OUString sBackgroundObjectsId = OUString::Concat("bo-") + sPageId; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sBackgroundObjectsId ); + mpSVGExport->AddAttribute(u"id"_ustr, sBackgroundObjectsId); if( !mbPresentation ) { if( !mVisiblePagePropSet.bAreBackgroundObjectsVisible ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"visibility"_ustr, u"hidden"_ustr ); + mpSVGExport->AddAttribute(u"visibility"_ustr, u"hidden"_ustr); } } - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BackgroundObjects"_ustr ); + mpSVGExport->AddAttribute(u"class"_ustr, u"BackgroundObjects"_ustr); // insert the <g> open tag related to the Background Objects - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp2(*mpSVGExport, u"g"_ustr, true, true); // append all shapes that make up the Master Slide bRet = implExportShapes( xShapes, true ) || bRet; @@ -2128,13 +2121,13 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap if( xShapes.is() ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"Group"_ustr ); + mpSVGExport->AddAttribute(u"class"_ustr, u"Group"_ustr); const OUString& rShapeId = implGetValidIDFromInterface( Reference<XInterface>(rxShape, UNO_QUERY) ); if( !rShapeId.isEmpty() ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, rShapeId ); + mpSVGExport->AddAttribute(u"id"_ustr, rShapeId); } - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp(*mpSVGExport, u"g"_ustr, true, true); bRet = implExportShapes( xShapes, bMaster ); } @@ -2167,7 +2160,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap // that we are dealing with a placeholder shape aElementId = sPlaceholderTag; - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"visibility"_ustr, u"hidden"_ustr ); + mpSVGExport->AddAttribute(u"visibility"_ustr, u"hidden"_ustr); } if( bTextField || ( aShapeClass == "TextShape" ) ) @@ -2190,11 +2183,11 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap default: break; } - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "text-adjust"_ustr, sTextAdjust ); + mpSVGExport->AddAttribute(NSPREFIX "text-adjust"_ustr, sTextAdjust); } } - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, aShapeClass ); - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + mpSVGExport->AddAttribute(u"class"_ustr, aShapeClass); + SvXMLElementExport aExp(*mpSVGExport, u"g"_ustr, true, true); Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); @@ -2202,7 +2195,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap xShapePropSet->getPropertyValue( u"Title"_ustr ) >>= aTitle; if( !aTitle.isEmpty() ) { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, u"title"_ustr, true, true ); + SvXMLElementExport aExp2(*mpSVGExport, u"title"_ustr, true, true); xExtDocHandler->characters( aTitle ); } @@ -2210,7 +2203,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap xShapePropSet->getPropertyValue( u"Description"_ustr ) >>= aDescription; if( !aDescription.isEmpty() ) { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, u"desc"_ustr, true, true ); + SvXMLElementExport aExp2(*mpSVGExport, u"desc"_ustr, true, true); xExtDocHandler->characters( aDescription ); } @@ -2218,7 +2211,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap const OUString& rShapeId = implGetValidIDFromInterface( Reference<XInterface>(rxShape, UNO_QUERY) ); if( !rShapeId.isEmpty() ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, rShapeId ); + mpSVGExport->AddAttribute(u"id"_ustr, rShapeId); } const GDIMetaFile* pEmbeddedBitmapsMtf = nullptr; @@ -2235,18 +2228,18 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap xShapePropSet->getPropertyValue( u"Bookmark"_ustr ) >>= aBookmark; } - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, u"g"_ustr, true, true ); + SvXMLElementExport aExp2(*mpSVGExport, u"g"_ustr, true, true); // export the shape bounding box { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BoundingBox"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"stroke"_ustr, u"none"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"fill"_ustr, u"none"_ustr ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"x"_ustr, OUString::number( aBoundRect.X ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"y"_ustr, OUString::number( aBoundRect.Y ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, OUString::number( aBoundRect.Width ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, OUString::number( aBoundRect.Height ) ); - SvXMLElementExport aBB( *mpSVGExport, XML_NAMESPACE_NONE, u"rect"_ustr, true, true ); + mpSVGExport->AddAttribute( u"class"_ustr, u"BoundingBox"_ustr ); + mpSVGExport->AddAttribute( u"stroke"_ustr, u"none"_ustr ); + mpSVGExport->AddAttribute( u"fill"_ustr, u"none"_ustr ); + mpSVGExport->AddAttribute( u"x"_ustr, OUString::number( aBoundRect.X ) ); + mpSVGExport->AddAttribute( u"y"_ustr, OUString::number( aBoundRect.Y ) ); + mpSVGExport->AddAttribute( u"width"_ustr, OUString::number( aBoundRect.Width ) ); + mpSVGExport->AddAttribute( u"height"_ustr, OUString::number( aBoundRect.Height ) ); + SvXMLElementExport aBB(*mpSVGExport, u"rect"_ustr, true, true); } if( !aBookmark.isEmpty() ) @@ -2255,8 +2248,8 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap if (!aINetURLObject.HasError() && aINetURLObject.GetProtocol() != INetProtocol::Javascript) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, u"xlink:href"_ustr, aBookmark); - SvXMLElementExport alinkA( *mpSVGExport, XML_NAMESPACE_NONE, u"a"_ustr, true, true ); + mpSVGExport->AddAttribute(u"xlink:href"_ustr, aBookmark); + SvXMLElementExport alinkA(*mpSVGExport, u"a"_ustr, true, true); mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, 0xffffffff, aElementId, @@ -2862,36 +2855,32 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void ) void SVGExport::writeMtf( const GDIMetaFile& rMtf ) { const Size aSize( OutputDevice::LogicToLogic(rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MapMode(MapUnit::MapMM)) ); - OUString aAttr; Reference< XExtendedDocumentHandler> xExtDocHandler( GetDocHandler(), UNO_QUERY ); if( xExtDocHandler.is() && IsUseDTDString() ) xExtDocHandler->unknown( SVG_DTD_STRING ); - aAttr = OUString::number( aSize.Width() ) + "mm"; - AddAttribute( XML_NAMESPACE_NONE, u"width"_ustr, aAttr ); - - aAttr = OUString::number( aSize.Height() ) + "mm"; - AddAttribute( XML_NAMESPACE_NONE, u"height"_ustr, aAttr ); + AddAttribute(u"width"_ustr, OUString::number(aSize.Width()) + "mm"); + AddAttribute(u"height"_ustr, OUString::number(aSize.Height()) + "mm"); - aAttr = "0 0 " + OUString::number( aSize.Width() * 100 ) + " " + + OUString aAttr = "0 0 " + OUString::number( aSize.Width() * 100 ) + " " + OUString::number( aSize.Height() * 100 ); - AddAttribute( XML_NAMESPACE_NONE, u"viewBox"_ustr, aAttr ); + AddAttribute(u"viewBox"_ustr, aAttr); - AddAttribute( XML_NAMESPACE_NONE, u"version"_ustr, u"1.1"_ustr ); + AddAttribute(u"version"_ustr, u"1.1"_ustr); if( IsUseTinyProfile() ) - AddAttribute( XML_NAMESPACE_NONE, u"baseProfile"_ustr, u"tiny"_ustr ); + AddAttribute(u"baseProfile"_ustr, u"tiny"_ustr); - AddAttribute( XML_NAMESPACE_NONE, u"xmlns"_ustr, constSvgNamespace ); + AddAttribute(u"xmlns"_ustr, constSvgNamespace); // For <image xlink:href="...">. AddAttribute(XML_NAMESPACE_XMLNS, u"xlink"_ustr, u"http://www.w3.org/1999/xlink"_ustr); - AddAttribute( XML_NAMESPACE_NONE, u"stroke-width"_ustr, OUString::number( 28.222 ) ); - AddAttribute( XML_NAMESPACE_NONE, u"stroke-linejoin"_ustr, u"round"_ustr ); - AddAttribute( XML_NAMESPACE_NONE, u"xml:space"_ustr, u"preserve"_ustr ); + AddAttribute(u"stroke-width"_ustr, OUString::number(28.222)); + AddAttribute(u"stroke-linejoin"_ustr, u"round"_ustr); + AddAttribute(u"xml:space"_ustr, u"preserve"_ustr); { - SvXMLElementExport aSVG( *this, XML_NAMESPACE_NONE, u"svg"_ustr, true, true ); + SvXMLElementExport aSVG(*this, u"svg"_ustr, true, true); std::vector< ObjectRepresentation > aObjects; diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index e6b514169ff8..fdaaf58c4469 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -183,7 +183,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) return; { - SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, u"defs"_ustr, true, true ); + SvXMLElementExport aExp(mrExport, u"defs"_ustr, true, true); OUString aCurIdStr( u"EmbeddedFont_"_ustr ); OUString aUnitsPerEM( OUString::number( nFontEM ) ); ScopedVclPtrInstance< VirtualDevice > pVDev; @@ -196,11 +196,11 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) pVDev->SetFont( aFont ); aCurIdStr += OUString::number( ++mnCurFontId ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, aCurIdStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"horiz-adv-x"_ustr, aUnitsPerEM ); + mrExport.AddAttribute(u"id"_ustr, aCurIdStr); + mrExport.AddAttribute(u"horiz-adv-x"_ustr, aUnitsPerEM); { - SvXMLElementExport aExp2( mrExport, XML_NAMESPACE_NONE, u"font"_ustr, true, true ); + SvXMLElementExport aExp2(mrExport, u"font"_ustr, true, true); OUString aFontWeight; OUString aFontStyle; const Size aSize( nFontEM, nFontEM ); @@ -217,27 +217,27 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) else aFontStyle = "normal"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"font-family"_ustr, GetMappedFontName( rFont.GetFamilyName() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"units-per-em"_ustr, aUnitsPerEM ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"font-weight"_ustr, aFontWeight ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"font-style"_ustr, aFontStyle ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"ascent"_ustr, OUString::number( pVDev->GetFontMetric().GetAscent() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"descent"_ustr, OUString::number( pVDev->GetFontMetric().GetDescent() ) ); + mrExport.AddAttribute( u"font-family"_ustr, GetMappedFontName( rFont.GetFamilyName() ) ); + mrExport.AddAttribute( u"units-per-em"_ustr, aUnitsPerEM ); + mrExport.AddAttribute( u"font-weight"_ustr, aFontWeight ); + mrExport.AddAttribute( u"font-style"_ustr, aFontStyle ); + mrExport.AddAttribute( u"ascent"_ustr, OUString::number( pVDev->GetFontMetric().GetAscent() ) ); + mrExport.AddAttribute( u"descent"_ustr, OUString::number( pVDev->GetFontMetric().GetDescent() ) ); { - SvXMLElementExport aExp3( mrExport, XML_NAMESPACE_NONE, u"font-face"_ustr, true, true ); + SvXMLElementExport aExp3(mrExport, u"font-face"_ustr, true, true); } - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"horiz-adv-x"_ustr, OUString::number( aSize.Width() ) ); + mrExport.AddAttribute(u"horiz-adv-x"_ustr, OUString::number(aSize.Width())); { const Point aPos; const tools::PolyPolygon aMissingGlyphPolyPoly( tools::Rectangle( aPos, aSize ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"d"_ustr, SVGActionWriter::GetPathString( aMissingGlyphPolyPoly, false ) ); + mrExport.AddAttribute( u"d"_ustr, SVGActionWriter::GetPathString( aMissingGlyphPolyPoly, false ) ); { - SvXMLElementExport aExp4( mrExport, XML_NAMESPACE_NONE, u"missing-glyph"_ustr, true, true ); + SvXMLElementExport aExp4(mrExport, u"missing-glyph"_ustr, true, true); } } for (auto const& glyph : rGlyphSet) @@ -263,17 +263,17 @@ void SVGFontExport::implEmbedGlyph( OutputDevice const & rOut, const OUString& r if (rCellStr == " " || !rOut.GetTextBoundRect(aBoundRect, rCellStr)) aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( rCellStr ), 0 ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"unicode"_ustr, rCellStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"horiz-adv-x"_ustr, OUString::number( aBoundRect.GetWidth() ) ); + mrExport.AddAttribute(u"unicode"_ustr, rCellStr); + mrExport.AddAttribute(u"horiz-adv-x"_ustr, OUString::number(aBoundRect.GetWidth())); const OUString aPathString( SVGActionWriter::GetPathString( aPolyPoly, false ) ); if( !aPathString.isEmpty() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"d"_ustr, aPathString ); + mrExport.AddAttribute(u"d"_ustr, aPathString); } { - SvXMLElementExport aExp( mrExport, XML_NAMESPACE_NONE, u"glyph"_ustr, true, true ); + SvXMLElementExport aExp(mrExport, u"glyph"_ustr, true, true); } } diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index c21729f01c1a..fd09508efd93 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -189,10 +189,10 @@ void SVGAttributeWriter::AddColorAttr( const OUString& pColorAttrName, if( rColor.GetAlpha() < 255 && rColor.GetAlpha() > 0 ) aColorOpacity = OUString::number( ImplRound( rColor.GetAlpha() / 255.0 ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorAttrName, aColor ); + mrExport.AddAttribute(pColorAttrName, aColor); if( !aColorOpacity.isEmpty() && mrExport.IsUseOpacity() ) - mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorOpacityAttrName, aColorOpacity ); + mrExport.AddAttribute(pColorOpacityAttrName, aColorOpacity); } @@ -209,7 +209,7 @@ void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFi if( !aGradientId.isEmpty() ) { OUString aGradientURL = "url(#" + aGradientId + ")"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFill, aGradientURL ); + mrExport.AddAttribute(aXMLAttrFill, aGradientURL); } } else @@ -226,7 +226,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const ( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL || rGradient.GetStyle() == css::awt::GradientStyle_RADIAL || rGradient.GetStyle() == css::awt::GradientStyle_ELLIPTICAL ) ) { - SvXMLElementExport aDesc( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, true, true ); + SvXMLElementExport aDesc(mrExport, aXMLElemDefs, true, true); Color aStartColor( rGradient.GetStartColor() ), aEndColor( rGradient.GetEndColor() ); Degree10 nAngle = rGradient.GetAngle() % 3600_deg10; Point aObjRectCenter( rObjRect.Center() ); @@ -246,7 +246,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const aEndColor.SetBlue( static_cast<sal_uInt8>( ( aEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100 ) ); rGradientId = "Gradient_" + OUString::number( nCurGradientId++ ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, rGradientId ); + mrExport.AddAttribute(aXMLAttrId, rGradientId); { std::unique_ptr< SvXMLElementExport > apGradient; @@ -261,34 +261,34 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const aLinePoly.Rotate( aObjRectCenter, nAngle ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits, u"userSpaceOnUse"_ustr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, OUString::number( aLinePoly[ 0 ].X() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, OUString::number( aLinePoly[ 0 ].Y() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, OUString::number( aLinePoly[ 1 ].X() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, OUString::number( aLinePoly[ 1 ].Y() ) ); + mrExport.AddAttribute(aXMLAttrGradientUnits, u"userSpaceOnUse"_ustr); + mrExport.AddAttribute(aXMLAttrX1, OUString::number(aLinePoly[0].X())); + mrExport.AddAttribute(aXMLAttrY1, OUString::number(aLinePoly[0].Y())); + mrExport.AddAttribute(aXMLAttrX2, OUString::number(aLinePoly[1].X())); + mrExport.AddAttribute(aXMLAttrY2, OUString::number(aLinePoly[1].Y())); - apGradient.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemLinearGradient, true, true ) ); + apGradient.reset( new SvXMLElementExport( mrExport, aXMLElemLinearGradient, true, true ) ); // write stop values double fBorder = static_cast< double >( rGradient.GetBorder() ) * ( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? 0.005 : 0.01 ); ImplGetColorStr( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? aEndColor : aStartColor, aColorStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( fBorder ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr ); + mrExport.AddAttribute(aXMLAttrOffset, OUString::number(fBorder)); + mrExport.AddAttribute(aXMLAttrStopColor, aColorStr); { - SvXMLElementExport aDesc2( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true ); + SvXMLElementExport aDesc2(mrExport, aXMLElemStop, true, true); } if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) { ImplGetColorStr( aStartColor, aColorStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( 0.5 ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr ); + mrExport.AddAttribute(aXMLAttrOffset, u"0.5"_ustr); + mrExport.AddAttribute(aXMLAttrStopColor, aColorStr); { - SvXMLElementExport aDesc3( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true ); + SvXMLElementExport aDesc3(mrExport, aXMLElemStop, true, true); } } @@ -296,11 +296,11 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const fBorder = 0.0; ImplGetColorStr( aEndColor, aColorStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( ImplRound( 1.0 - fBorder ) ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr ); + mrExport.AddAttribute(aXMLAttrOffset, OUString::number(ImplRound(1.0 - fBorder))); + mrExport.AddAttribute(aXMLAttrStopColor, aColorStr); { - SvXMLElementExport aDesc4( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true ); + SvXMLElementExport aDesc4(mrExport, aXMLElemStop, true, true); } } else @@ -309,29 +309,29 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const const double fCenterY = rObjRect.Top() + rObjRect.GetHeight() * rGradient.GetOfsY() * 0.01; const double fRadius = std::hypot(rObjRect.GetWidth(), rObjRect.GetHeight()) * 0.5; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits, u"userSpaceOnUse"_ustr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, OUString::number( ImplRound( fCenterX ) ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, OUString::number( ImplRound( fCenterY ) ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"r"_ustr, OUString::number( ImplRound( fRadius ) ) ); + mrExport.AddAttribute(aXMLAttrGradientUnits, u"userSpaceOnUse"_ustr); + mrExport.AddAttribute(aXMLAttrCX, OUString::number(ImplRound(fCenterX))); + mrExport.AddAttribute(aXMLAttrCY, OUString::number(ImplRound(fCenterY))); + mrExport.AddAttribute(u"r"_ustr, OUString::number(ImplRound(fRadius))); - apGradient.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, u"radialGradient"_ustr, true, true ) ); + apGradient.reset( new SvXMLElementExport( mrExport, u"radialGradient"_ustr, true, true ) ); // write stop values ImplGetColorStr( aEndColor, aColorStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( 0.0 ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr ); + mrExport.AddAttribute(aXMLAttrOffset, u"0"_ustr); + mrExport.AddAttribute(aXMLAttrStopColor, aColorStr); { - SvXMLElementExport aDesc5( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true ); + SvXMLElementExport aDesc5(mrExport, aXMLElemStop, true, true); } ImplGetColorStr( aStartColor, aColorStr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, + mrExport.AddAttribute( aXMLAttrOffset, OUString::number( ImplRound( 1.0 - rGradient.GetBorder() * 0.01 ) ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr ); + mrExport.AddAttribute(aXMLAttrStopColor, aColorStr); { - SvXMLElementExport aDesc6( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true ); + SvXMLElementExport aDesc6(mrExport, aXMLElemStop, true, true); } } } @@ -357,8 +357,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont ) setFontFamily(); // Font Size - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontSize, - OUString::number( rFont.GetFontHeight() ) + "px" ); + mrExport.AddAttribute(aXMLAttrFontSize, OUString::number(rFont.GetFontHeight()) + "px"); // Font Style if( rFont.GetItalic() != ITALIC_NONE ) @@ -371,7 +370,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont ) else aFontStyle = "normal"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontStyle, aFontStyle ); + mrExport.AddAttribute(aXMLAttrFontStyle, aFontStyle); // Font Weight switch( rFont.GetWeight() ) @@ -389,7 +388,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont ) default: nFontWeight = 400; break; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontWeight, OUString::number( nFontWeight ) ); + mrExport.AddAttribute(aXMLAttrFontWeight, OUString::number(nFontWeight)); if( mrExport.IsUseNativeTextDecoration() ) { @@ -405,7 +404,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont ) else aTextDecoration = "none"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, aTextDecoration ); + mrExport.AddAttribute(aXMLAttrTextDecoration, aTextDecoration); } startFontSettings(); @@ -417,11 +416,11 @@ void SVGAttributeWriter::startFontSettings() endFontSettings(); if( mrExport.IsUsePositionedCharacters() ) { - mpElemFont.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ) ); + mpElemFont.reset(new SvXMLElementExport(mrExport, aXMLElemG, true, true)); } else { - mpElemFont.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, true, true ) ); + mpElemFont.reset(new SvXMLElementExport(mrExport, aXMLElemTspan, true, true)); } } @@ -438,7 +437,7 @@ void SVGAttributeWriter::setFontFamily() if( mrExport.IsUsePositionedCharacters() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontFamily, mrFontExport.GetMappedFontName( rCurFont.GetFamilyName() ) ); + mrExport.AddAttribute( aXMLAttrFontFamily, mrFontExport.GetMappedFontName( rCurFont.GetFamilyName() ) ); } else { @@ -457,7 +456,7 @@ void SVGAttributeWriter::setFontFamily() else if( eFamily == FAMILY_SWISS ) sFontFamily += ", sans-serif"; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontFamily, sFontFamily ); + mrExport.AddAttribute(aXMLAttrFontFamily, sFontFamily); } } @@ -864,8 +863,7 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer ) // Font Size if( nCurFontSize != nParFontSize ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontSize, - OUString::number( nCurFontSize ) + "px" ); + mrExport.AddAttribute(aXMLAttrFontSize, OUString::number(nCurFontSize) + "px"); } // Font Style @@ -883,7 +881,7 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer ) { sFontStyle = "normal"; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontStyle, sFontStyle ); + mrExport.AddAttribute(aXMLAttrFontStyle, sFontStyle); } // Font Weight @@ -904,7 +902,7 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer ) case WEIGHT_BLACK: nFontWeight = 900; break; default: nFontWeight = 400; break; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontWeight, OUString::number( nFontWeight ) ); + mrExport.AddAttribute(aXMLAttrFontWeight, OUString::number(nFontWeight)); } @@ -937,12 +935,12 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer ) if( !sTextDecoration.isEmpty() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, sTextDecoration ); + mrExport.AddAttribute(aXMLAttrTextDecoration, sTextDecoration); } else if( bIsDecorationChanged ) { sTextDecoration = "none"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTextDecoration, sTextDecoration ); + mrExport.AddAttribute(aXMLAttrTextDecoration, sTextDecoration); } } @@ -968,7 +966,7 @@ void SVGTextWriter::implSetFontFamily() else if( eFamily == FAMILY_SWISS ) sFontFamily += ", sans-serif"; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontFamily, sFontFamily ); + mrExport.AddAttribute(aXMLAttrFontFamily, sFontFamily); } @@ -1026,7 +1024,7 @@ bool SVGTextWriter::nextParagraph() mbIsNewListItem = true; #if OSL_DEBUG_LEVEL > 0 sInfo = "NumberingLevel: " + OUString::number( nListLevel ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"style"_ustr, sInfo ); + mrExport.AddAttribute(u"style"_ustr, sInfo); #endif Reference< XIndexReplace > xNumRules; if( xPropSetInfo->hasPropertyByName( u"NumberingRules"_ustr ) ) @@ -1048,7 +1046,7 @@ bool SVGTextWriter::nextParagraph() if( bIsNumbered ) { sInfo = "true"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"is-numbered"_ustr, sInfo ); + mrExport.AddAttribute(u"is-numbered"_ustr, sInfo); } #endif } @@ -1093,7 +1091,7 @@ bool SVGTextWriter::nextParagraph() mcBulletChar = cBullet; #if OSL_DEBUG_LEVEL > 0 sInfo = OUString::number( static_cast<sal_Int32>(cBullet) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"bullet-char"_ustr, sInfo ); + mrExport.AddAttribute(u"bullet-char"_ustr, sInfo); #endif } @@ -1128,8 +1126,8 @@ bool SVGTextWriter::nextParagraph() return false; } #if OSL_DEBUG_LEVEL > 0 - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, sInfo ); - SvXMLElementExport aParaElem( mrExport, XML_NAMESPACE_NONE, u"desc"_ustr, mbIWS, mbIWS ); + mrExport.AddAttribute(u"class"_ustr, sInfo); + SvXMLElementExport aParaElem(mrExport, u"desc"_ustr, mbIWS, mbIWS); #endif } else @@ -1146,13 +1144,13 @@ bool SVGTextWriter::nextParagraph() if ( xRange.is() && xRange->getString().isEmpty() ) { endTextParagraph(); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"TextParagraph"_ustr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, rParagraphId ); - mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS )); + mrExport.AddAttribute(u"class"_ustr, u"TextParagraph"_ustr); + mrExport.AddAttribute(u"id"_ustr, rParagraphId); + mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, aXMLElemTspan, mbIWS, mbIWS )); } else { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, rParagraphId ); + mrExport.AddAttribute(u"id"_ustr, rParagraphId); } } return true; @@ -1301,8 +1299,8 @@ bool SVGTextWriter::nextTextPortion() } } #if OSL_DEBUG_LEVEL > 0 - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"TextPortion"_ustr ); - SvXMLElementExport aPortionElem( mrExport, XML_NAMESPACE_NONE, u"desc"_ustr, mbIWS, mbIWS ); + mrExport.AddAttribute(u"class"_ustr, u"TextPortion"_ustr); + SvXMLElementExport aPortionElem(mrExport, u"desc"_ustr, mbIWS, mbIWS); mrExport.GetDocHandler()->characters( sInfo ); #endif return true; @@ -1319,7 +1317,7 @@ void SVGTextWriter::startTextShape() { mbIsTextShapeStarted = true; maParentFont = vcl::Font(); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"SVGTextShape"_ustr ); + mrExport.AddAttribute(u"class"_ustr, u"SVGTextShape"_ustr); // if text is rotated, set transform matrix at text element const vcl::Font& rFont = mpVDev->GetFont(); @@ -1330,7 +1328,7 @@ void SVGTextWriter::startTextShape() OUString::number( rFont.GetOrientation().get() * -0.1 ) + " " + OUString::number( aRot.X() ) + " " + OUString::number( aRot.Y() ) + ")"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); + mrExport.AddAttribute(aXMLAttrTransform, aTransform); } // tdf#91315: Set text direction @@ -1339,10 +1337,10 @@ void SVGTextWriter::startTextShape() & (vcl::text::ComplexTextLayoutFlags::BiDiRtl | vcl::text::ComplexTextLayoutFlags::BiDiStrong)) { - mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrTextDirection, "rtl"); + mrExport.AddAttribute(aXMLAttrTextDirection, u"rtl"_ustr); } - mpTextShapeElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemText, true, mbIWS )); + mpTextShapeElem.reset(new SvXMLElementExport(mrExport, aXMLElemText, true, mbIWS)); startTextParagraph(); } } @@ -1384,15 +1382,15 @@ void SVGTextWriter::startTextParagraph() sNumberingType = "number-style"; break; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"ooo:numbering-type"_ustr, sNumberingType ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"ListItem"_ustr ); + mrExport.AddAttribute(u"ooo:numbering-type"_ustr, sNumberingType); + mrExport.AddAttribute(u"class"_ustr, u"ListItem"_ustr); } else { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"TextParagraph"_ustr ); + mrExport.AddAttribute(u"class"_ustr, u"TextParagraph"_ustr); } maParentFont = vcl::Font(); - mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS )); + mpTextParagraphElem.reset(new SvXMLElementExport(mrExport, aXMLElemTspan, mbIWS, mbIWS)); if( !mbIsListLevelStyleImage ) { @@ -1416,13 +1414,13 @@ void SVGTextWriter::startTextPosition( bool bExportX, bool bExportY ) { endTextPosition(); mnTextWidth = 0; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"TextPosition"_ustr ); + mrExport.AddAttribute(u"class"_ustr, u"TextPosition"_ustr); if( bExportX ) - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, OUString::number( maTextPos.X() ) ); + mrExport.AddAttribute(aXMLAttrX, OUString::number(maTextPos.X())); if( bExportY ) - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, OUString::number( maTextPos.Y() ) ); + mrExport.AddAttribute(aXMLAttrY, OUString::number(maTextPos.Y())); - mpTextPositionElem.reset( new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ) ); + mpTextPositionElem.reset(new SvXMLElementExport(mrExport, aXMLElemTspan, mbIWS, mbIWS)); } @@ -1439,8 +1437,8 @@ void SVGTextWriter::implExportHyperlinkIds() { if( !msHyperlinkIdList.isEmpty() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"HyperlinkIdList"_ustr ); - SvXMLElementExport aDescElem( mrExport, XML_NAMESPACE_NONE, u"desc"_ustr, true, false ); + mrExport.AddAttribute(u"class"_ustr, u"HyperlinkIdList"_ustr); + SvXMLElementExport aDescElem(mrExport, u"desc"_ustr, true, false); mrExport.GetDocHandler()->characters( msHyperlinkIdList.trim() ); msHyperlinkIdList.clear(); } @@ -1452,8 +1450,8 @@ void SVGTextWriter::implWriteBulletChars() if( maBulletListItemMap.empty() ) return; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BulletChars"_ustr ); - SvXMLElementExport aGroupElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ); + mrExport.AddAttribute(u"class"_ustr, u"BulletChars"_ustr); + SvXMLElementExport aGroupElem(mrExport, aXMLElemG, true, true); OUString sId, sPosition, sScaling, sRefId; for (auto const& bulletListItem : maBulletListItemMap) @@ -1462,9 +1460,9 @@ void SVGTextWriter::implWriteBulletChars() // As id we use the id of the text portion placeholder with prefix // bullet-char-* sId = "bullet-char-" + bulletListItem.first; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BulletChar"_ustr ); - SvXMLElementExport aBulletCharElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ); + mrExport.AddAttribute(u"id"_ustr, sId); + mrExport.AddAttribute(u"class"_ustr, u"BulletChar"_ustr); + SvXMLElementExport aBulletCharElem(mrExport, aXMLElemG, true, true); // <g transform="translate(x,y)" > { @@ -1474,11 +1472,11 @@ void SVGTextWriter::implWriteBulletChars() sPosition = "translate(" + OUString::number( rInfo.aPos.X() ) + "," + OUString::number( rInfo.aPos.Y() ) + ")"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"transform"_ustr, sPosition ); + mrExport.AddAttribute(u"transform"_ustr, sPosition); mrAttributeWriter.AddPaintAttr( COL_TRANSPARENT, rInfo.aColor ); - SvXMLElementExport aPositioningElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ); + SvXMLElementExport aPositioningElem(mrExport, aXMLElemG, true, true); if (mrExport.IsEmbeddedBulletGlyph(rInfo.cBulletChar)) { @@ -1486,14 +1484,14 @@ void SVGTextWriter::implWriteBulletChars() // Add size attribute through a scaling sScaling = "scale(" + OUString::number( rInfo.aFont.GetFontHeight() ) + "," + OUString::number( rInfo.aFont.GetFontHeight() )+ ")"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"transform"_ustr, sScaling ); + mrExport.AddAttribute(u"transform"_ustr, sScaling); // Add ref attribute sRefId = "#bullet-char-template-" + OUString::number( rInfo.cBulletChar ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, sRefId ); + mrExport.AddAttribute(aXMLAttrXLinkHRef, sRefId); - SvXMLElementExport aRefElem( mrExport, XML_NAMESPACE_NONE, u"use"_ustr, true, true ); + SvXMLElementExport aRefElem(mrExport, u"use"_ustr, true, true); } else { @@ -1505,8 +1503,8 @@ void SVGTextWriter::implWriteBulletChars() if (mpVDev->GetTextOutline(aPolyPolygon, aStr)) { OUString aPathString(SVGActionWriter::GetPathString(aPolyPolygon, false)); - mrExport.AddAttribute(XML_NAMESPACE_NONE, u"d"_ustr, aPathString); - SvXMLElementExport aPath(mrExport, XML_NAMESPACE_NONE, u"path"_ustr, true, true); + mrExport.AddAttribute(u"d"_ustr, aPathString); + SvXMLElementExport aPath(mrExport, u"path"_ustr, true, true); } mpVDev->Pop(); } @@ -1538,9 +1536,9 @@ void SVGTextWriter::writeBitmapPlaceholder( const MetaBitmapActionType* pAction OUString::number( nId ) + ")"; { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BitmapPlaceholder"_ustr ); - SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); + mrExport.AddAttribute(u"id"_ustr, sId); + mrExport.AddAttribute(u"class"_ustr, u"BitmapPlaceholder"_ustr); + SvXMLElementExport aSVGTspanElem(mrExport, aXMLElemTspan, mbIWS, mbIWS); } endTextPosition(); } @@ -1551,8 +1549,8 @@ void SVGTextWriter::implWriteEmbeddedBitmaps() if( !(mpTextEmbeddedBitmapMtf && mpTextEmbeddedBitmapMtf->GetActionSize()) ) return; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"EmbeddedBitmaps"_ustr ); - SvXMLElementExport aEmbBitmapGroupElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ); + mrExport.AddAttribute(u"class"_ustr, u"EmbeddedBitmaps"_ustr); + SvXMLElementExport aEmbBitmapGroupElem(mrExport, aXMLElemG, true, true); const GDIMetaFile& rMtf = *mpTextEmbeddedBitmapMtf; @@ -1597,10 +1595,10 @@ void SVGTextWriter::implWriteEmbeddedBitmaps() // embedded bitmap id nId = SVGActionWriter::GetChecksum( pAction ); OUString sId = "embedded-bitmap(" + msShapeId + "." + OUString::number( nId ) + ")"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"EmbeddedBitmap"_ustr ); + mrExport.AddAttribute(u"id"_ustr, sId); + mrExport.AddAttribute(u"class"_ustr, u"EmbeddedBitmap"_ustr); - SvXMLElementExport aEmbBitmapElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true ); + SvXMLElementExport aEmbBitmapElem(mrExport, aXMLElemG, true, true); // <use x="?" y="?" xlink:ref="?" > { @@ -1612,11 +1610,11 @@ void SVGTextWriter::implWriteEmbeddedBitmaps() implMap( aPt, aPoint ); implMap( aSz, aSize ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, OUString::number( aPoint.X() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, OUString::number( aPoint.Y() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, sRefId ); + mrExport.AddAttribute(aXMLAttrX, OUString::number(aPoint.X())); + mrExport.AddAttribute(aXMLAttrY, OUString::number(aPoint.Y())); + mrExport.AddAttribute(aXMLAttrXLinkHRef, sRefId); - SvXMLElementExport aRefElem( mrExport, XML_NAMESPACE_NONE, u"use"_ustr, true, true ); + SvXMLElementExport aRefElem(mrExport, u"use"_ustr, true, true); } } // close aEmbBitmapElem } @@ -1774,9 +1772,9 @@ void SVGTextWriter::implWriteTextPortion(const Point& rPos, const OUString& rTex aBulletListItemInfo.cBulletChar = mcBulletChar; // Make this text portion a bullet placeholder - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, sId ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"BulletPlaceholder"_ustr ); - SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); + mrExport.AddAttribute(u"id"_ustr, sId); + mrExport.AddAttribute(u"class"_ustr, u"BulletPlaceholder"_ustr); + SvXMLElementExport aSVGTspanElem(mrExport, aXMLElemTspan, mbIWS, mbIWS); return; } } @@ -1785,7 +1783,7 @@ void SVGTextWriter::implWriteTextPortion(const Point& rPos, const OUString& rTex const OUString& rTextPortionId = implGetValidIDFromInterface( Reference<XInterface>(mrCurrentTextPortion, UNO_QUERY) ); if( !rTextPortionId.isEmpty() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"id"_ustr, rTextPortionId ); + mrExport.AddAttribute(u"id"_ustr, rTextPortionId); } if( mbIsPlaceholderShape ) @@ -1801,7 +1799,7 @@ void SVGTextWriter::implWriteTextPortion(const Point& rPos, const OUString& rTex { sClass += " " + msTextFieldType; } - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, sClass ); + mrExport.AddAttribute(u"class"_ustr, sClass); } addFontAttributes( /* isTexTContainer: */ false ); @@ -1812,15 +1810,15 @@ void SVGTextWriter::implWriteTextPortion(const Point& rPos, const OUString& rTex Size size; implMap(Size(nWidth, 0), size); nTextWidth = size.Width(); - mrExport.AddAttribute(XML_NAMESPACE_NONE, u"lengthAdjust"_ustr, u"spacingAndGlyphs"_ustr); - mrExport.AddAttribute(XML_NAMESPACE_NONE, u"textLength"_ustr, OUString::number(nTextWidth)); + mrExport.AddAttribute(u"lengthAdjust"_ustr, u"spacingAndGlyphs"_ustr); + mrExport.AddAttribute(u"textLength"_ustr, OUString::number(nTextWidth)); } else nTextWidth = mpVDev->GetTextWidth(rText); if (!maTextOpacity.isEmpty()) { - mrExport.AddAttribute(XML_NAMESPACE_NONE, u"fill-opacity"_ustr, maTextOpacity); + mrExport.AddAttribute(u"fill-opacity"_ustr, maTextOpacity); } mrAttributeWriter.AddPaintAttr( COL_TRANSPARENT, aTextColor ); @@ -1828,28 +1826,28 @@ void SVGTextWriter::implWriteTextPortion(const Point& rPos, const OUString& rTex // <a> tag for link should be the innermost tag, inside <tspan> if( !mbIsPlaceholderShape && mbIsURLField && !msUrl.isEmpty() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"UrlField"_ustr ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, msUrl ); + mrExport.AddAttribute(u"class"_ustr, u"UrlField"_ustr); + mrExport.AddAttribute(aXMLAttrXLinkHRef, msUrl); - SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, msUrl ); + SvXMLElementExport aSVGTspanElem(mrExport, aXMLElemTspan, mbIWS, mbIWS); + mrExport.AddAttribute(aXMLAttrXLinkHRef, msUrl); { - SvXMLElementExport aSVGAElem( mrExport, XML_NAMESPACE_NONE, u"a"_ustr, mbIWS, mbIWS ); + SvXMLElementExport aSVGAElem(mrExport, u"a"_ustr, mbIWS, mbIWS); mrExport.GetDocHandler()->characters( rText ); } } else if ( !msPageCount.isEmpty() ) { - mrExport.AddAttribute( XML_NAMESPACE_NONE, u"class"_ustr, u"PageCount"_ustr ); - SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); + mrExport.AddAttribute(u"class"_ustr, u"PageCount"_ustr); -e ... etc. - the rest is truncated