summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2018-11-14 12:50:55 +0100
committerJan Holesovsky <kendy@collabora.com>2018-12-10 12:29:11 +0100
commit8ade6298814a7223eb1b11d72534dd4bb4257a4d (patch)
treeab073e7dea903c1318586a000a067aa34911b5cc
parent8c998edfec9a18decb5793f5547339389b10fc68 (diff)
Avoid writing out unneeded data to SVG file in SelectionOnly mode
Change-Id: I6d0ce089be051667e965aff45a63f6b1a8342952
-rw-r--r--filter/source/svg/svgexport.cxx106
1 files changed, 60 insertions, 46 deletions
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 34bda25bdbe7..5322b17cda40 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -775,6 +775,7 @@ bool SVGFilter::implExportDocument()
mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", true, true );
// Create a ClipPath element that will be used for cutting bitmaps and other elements that could exceed the page margins.
+ if(!mbExportShapeSelection)
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "ClipPathGroup" );
SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", true, true );
@@ -793,7 +794,6 @@ bool SVGFilter::implExportDocument()
}
// Create a ClipPath element applied to the leaving slide in order
// to avoid that slide borders are visible during transition
- if(!mbExportShapeSelection)
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "presentation_clip_path_shrink" );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clipPathUnits", "userSpaceOnUse" );
@@ -1181,6 +1181,9 @@ void SVGFilter::implExportAnimations()
void SVGFilter::implExportTextShapeIndex()
{
+ if(mbExportShapeSelection)
+ return;
+
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "TextShapeIndex" );
SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", true, true );
@@ -1481,66 +1484,77 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< XDrawPage > >
}
}
- // We wrap all slide in a group element with class name "SlideGroup".
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "SlideGroup" );
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
-
- for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
+ if(!mbExportShapeSelection)
{
- Reference< XShapes > xShapes;
+ // We wrap all slide in a group element with class name "SlideGroup".
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "SlideGroup" );
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
- if (mbExportShapeSelection)
- {
- // #i124608# export a given object selection
- xShapes = maShapeSelection;
- }
- else
+ for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
{
- xShapes.set( rxPages[i], UNO_QUERY );
- }
+ Reference< XShapes > xShapes;
- if( xShapes.is() )
- {
- // Insert the <g> open tag related to the svg element for
- // handling a slide visibility.
- // In case the exported slides are more than one the initial
- // visibility of each slide is set to 'hidden'.
- if( mbPresentation )
+ if (mbExportShapeSelection)
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
+ // #i124608# export a given object selection
+ xShapes = maShapeSelection;
+ }
+ else
+ {
+ xShapes.set( rxPages[i], UNO_QUERY );
}
- SvXMLElementExport aGElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
-
+ if( xShapes.is() )
{
- // Insert a further inner the <g> open tag for handling elements
- // inserted before or after a slide: that is used for some
- // when switching from the last to the first slide.
- const OUString & sPageId = implGetValidIDFromInterface( rxPages[i] );
- OUString sContainerId = "container-";
- sContainerId += sPageId;
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sContainerId );
- SvXMLElementExport aContainerExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
+ // Insert the <g> open tag related to the svg element for
+ // handling a slide visibility.
+ // In case the exported slides are more than one the initial
+ // visibility of each slide is set to 'hidden'.
+ if( mbPresentation )
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
+ }
+ SvXMLElementExport aGElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
+
{
- // add id attribute
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sPageId );
+ // Insert a further inner the <g> open tag for handling elements
+ // inserted before or after a slide: that is used for some
+ // when switching from the last to the first slide.
+ const OUString & sPageId = implGetValidIDFromInterface( rxPages[i] );
+ OUString sContainerId = "container-";
+ sContainerId += sPageId;
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sContainerId );
+ SvXMLElementExport aContainerExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "Slide" );
+ {
+ // add id attribute
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sPageId );
- // 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, "clip-path", sClipPathAttrValue );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "Slide" );
- SvXMLElementExport aSlideElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
+ // 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, "clip-path", sClipPathAttrValue );
- implExportPage( sPageId, rxPages[i], xShapes, false /* is not a master page */ );
- }
- } // append the </g> closing tag related to inserted elements
- } // append the </g> closing tag related to the svg element handling the slide visibility
+ SvXMLElementExport aSlideElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
+
+ implExportPage( sPageId, rxPages[i], xShapes, false /* is not a master page */ );
+ }
+ } // append the </g> closing tag related to inserted elements
+ } // append the </g> closing tag related to the svg element handling the slide visibility
+ }
}
+ else
+ {
+ assert(maShapeSelection.is());
+ assert(rxPages.size() == 1);
+
+ const OUString & sPageId = implGetValidIDFromInterface( rxPages[0] );
+ implExportPage( sPageId, rxPages[0], maShapeSelection, false /* is not a master page */ );
+ }
}