summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-10-12 10:34:46 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-25 11:22:47 +0200
commit68f3bf394617a7d00d920694642f5a3e37fee629 (patch)
tree2bbc5f5b7aecf218c72690a9b643f4b8d25c2e53 /filter
parentbba6a4ed92a0feb288a9dedd648d623bee02a3ce (diff)
Converting pointer to reference in svgwriter
Previously, pElementId (old name) was either nullptr or a pointer to OUString created from sPlaceholderTag literal. In the methods that consumed it, it was checked for being nullptr. Now, this is checked with if the aElementId (new name) is empty or not. If the variable is an empty string, it implies that it should not be used. Change-Id: I560fd479f428341c834ee99b0f8a34e95862e3e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123439 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/svg/svgexport.cxx10
-rw-r--r--filter/source/svg/svgwriter.cxx35
-rw-r--r--filter/source/svg/svgwriter.hxx4
3 files changed, 26 insertions, 23 deletions
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 8eb8e8ccfe42..19e810f26956 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -2108,8 +2108,8 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
if( rMtf.GetActionSize() )
{ // for text field shapes we set up text-adjust attributes
// and set visibility to hidden
- const OUString aElementId(sPlaceholderTag);
- const OUString* pElementId = nullptr;
+ OUString aElementId;
+
if( mbPresentation )
{
bool bIsPageNumber = ( aShapeClass == "Slide_Number" );
@@ -2120,7 +2120,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
{
// to notify to the SVGActionWriter::ImplWriteActions method
// that we are dealing with a placeholder shape
- pElementId = &aElementId;
+ aElementId = sPlaceholderTag;
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
}
@@ -2214,7 +2214,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
SvXMLElementExport alinkA( *mpSVGExport, XML_NAMESPACE_NONE, "a", true, true );
mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
0xffffffff,
- pElementId,
+ aElementId,
&rxShape,
pEmbeddedBitmapsMtf );
}
@@ -2223,7 +2223,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
{
mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
0xffffffff,
- pElementId,
+ aElementId,
&rxShape,
pEmbeddedBitmapsMtf );
}
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 43386384cfcb..addf2897799c 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2262,7 +2262,7 @@ void SVGActionWriter::ImplWritePattern( const tools::PolyPolygon& rPolyPoly,
mpVDev->AddHatchActions( rPolyPoly, *pHatch, aTmpMtf );
else if ( pGradient )
mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), *pGradient, aTmpMtf );
- ImplWriteActions( aTmpMtf, nWriteFlags, nullptr );
+ ImplWriteActions( aTmpMtf, nWriteFlags, "" );
}
}
}
@@ -2529,7 +2529,7 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con
}
mpVDev->Push();
- ImplWriteActions( rMtf, nWriteFlags, nullptr );
+ ImplWriteActions( rMtf, nWriteFlags, "" );
mpVDev->Pop();
}
}
@@ -2949,7 +2949,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
sal_uInt32 nWriteFlags,
- const OUString* pElementId,
+ const OUString& aElementId,
const Reference< css::drawing::XShape >* pxShape,
const GDIMetaFile* pTextEmbeddedBitmapMtf )
{
@@ -2957,6 +2957,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
// generation
sal_Int32 nEntryCount(0);
+ bool bUseElementId = !aElementId.isEmpty();
+
#if OSL_DEBUG_LEVEL > 0
bool bIsTextShape = false;
if( !mrExport.IsUsePositionedCharacters() && pxShape
@@ -2966,11 +2968,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
#endif
mbIsPlaceholderShape = false;
- if( ( pElementId != nullptr ) && ( *pElementId == sPlaceholderTag ) )
+ if( bUseElementId && ( aElementId == sPlaceholderTag ) )
{
mbIsPlaceholderShape = true;
- // since we utilize pElementId in an improper way we reset it to NULL before to go on
- pElementId = nullptr;
+ // since we utilize aElementId in an improper way we reset the boolean
+ // control variable bUseElementId to false before to go on
+ bUseElementId = false;
}
for( size_t nCurAction = 0, nCount = rMtf.GetActionSize(); nCurAction < nCount; nCurAction++ )
@@ -3328,9 +3331,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
mapCurShape.reset( new SVGShapeDescriptor );
- if( pElementId )
+ if( bUseElementId )
{
- mapCurShape->maId = *pElementId + "_" + OUString::number(nEntryCount++);
+ mapCurShape->maId = aElementId + "_" + OUString::number(nEntryCount++);
}
mapCurShape->maShapePolyPoly = aShapePolyPoly;
@@ -3416,9 +3419,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
mapCurShape.reset( new SVGShapeDescriptor );
- if( pElementId )
+ if( bUseElementId )
{
- mapCurShape->maId = *pElementId + "_" + OUString::number(nEntryCount++);
+ mapCurShape->maId = aElementId + "_" + OUString::number(nEntryCount++);
}
mapCurShape->maShapePolyPoly = aPoly;
@@ -3484,9 +3487,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
mapCurShape->maShapePolyPoly = aStartArrow;
- if( pElementId ) // #i124825# pElementId is optional, may be zero
+ if( bUseElementId ) // #i124825# aElementId is optional, may be zero
{
- mapCurShape->maId = *pElementId + "_" + OUString::number(nEntryCount++);
+ mapCurShape->maId = aElementId + "_" + OUString::number(nEntryCount++);
}
ImplWriteShape( *mapCurShape );
@@ -3496,9 +3499,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
mapCurShape->maShapePolyPoly = aEndArrow;
- if( pElementId ) // #i124825# pElementId is optional, may be zero
+ if( bUseElementId ) // #i124825# aElementId is optional, may be zero
{
- mapCurShape->maId = *pElementId + "_" + OUString::number(nEntryCount++);
+ mapCurShape->maId = aElementId + "_" + OUString::number(nEntryCount++);
}
ImplWriteShape( *mapCurShape );
@@ -3934,7 +3937,7 @@ void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm,
const Size& rSize100thmm,
const GDIMetaFile& rMtf,
sal_uInt32 nWriteFlags,
- const OUString* pElementId,
+ const OUString& aElementId,
const Reference< css::drawing::XShape >* pXShape,
const GDIMetaFile* pTextEmbeddedBitmapMtf )
{
@@ -3959,7 +3962,7 @@ void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm,
mapCurShape.reset();
- ImplWriteActions( rMtf, nWriteFlags, pElementId, pXShape, pTextEmbeddedBitmapMtf );
+ ImplWriteActions( rMtf, nWriteFlags, aElementId, pXShape, pTextEmbeddedBitmapMtf );
maTextWriter.endTextParagraph();
ImplEndClipRegion();
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 348c77be1a86..2dd32bacca26 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -351,7 +351,7 @@ private:
void ImplWriteActions( const GDIMetaFile& rMtf,
sal_uInt32 nWriteFlags,
- const OUString* pElementId,
+ const OUString& aElementId,
const Reference< css::drawing::XShape >* pXShape = nullptr,
const GDIMetaFile* pTextEmbeddedBitmapMtf = nullptr );
@@ -370,7 +370,7 @@ public:
const Size& rSize100thmm,
const GDIMetaFile& rMtf,
sal_uInt32 nWriteFlags,
- const OUString* pElementId = nullptr,
+ const OUString& aElementId = "",
const Reference< css::drawing::XShape >* pXShape = nullptr,
const GDIMetaFile* pTextEmbeddedBitmapMtf = nullptr );