xref: /trunk/main/xmloff/source/draw/XMLImageMapExport.cxx (revision 1f882ec4efd1041ce97c67afed4ef09e0da00c4a)
163bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
363bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
463bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
563bba73cSAndrew Rist  * distributed with this work for additional information
663bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
763bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
863bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
963bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1163bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1363bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1463bba73cSAndrew Rist  * software distributed under the License is distributed on an
1563bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1663bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
1763bba73cSAndrew Rist  * specific language governing permissions and limitations
1863bba73cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2063bba73cSAndrew Rist  *************************************************************/
2163bba73cSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
24cdf0e10cSrcweir #include "XMLImageMapExport.hxx"
25cdf0e10cSrcweir #include <rtl/ustring.hxx>
26cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
27cdf0e10cSrcweir #include <tools/debug.hxx>
28cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
33cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
37cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequence.hpp>
38cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
39cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
40cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
41cdf0e10cSrcweir #include <xmloff/XMLEventExport.hxx>
42cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
43cdf0e10cSrcweir #include "xexptran.hxx"
44*1f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolygon.hxx>
45*1f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolygontools.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir using namespace ::com::sun::star;
48cdf0e10cSrcweir using namespace ::xmloff::token;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir using ::rtl::OUString;
51cdf0e10cSrcweir using ::rtl::OUStringBuffer;
52cdf0e10cSrcweir using ::com::sun::star::uno::Any;
53cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY;
54cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
55cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
56cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet;
57cdf0e10cSrcweir using ::com::sun::star::container::XIndexContainer;
58cdf0e10cSrcweir using ::com::sun::star::document::XEventsSupplier;
59cdf0e10cSrcweir using ::com::sun::star::lang::XServiceInfo;
60cdf0e10cSrcweir using ::com::sun::star::drawing::PointSequence;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 
63cdf0e10cSrcweir const sal_Char sAPI_ImageMapRectangleObject[] = "com.sun.star.image.ImageMapRectangleObject";
64cdf0e10cSrcweir const sal_Char sAPI_ImageMapCircleObject[] = "com.sun.star.image.ImageMapCircleObject";
65cdf0e10cSrcweir const sal_Char sAPI_ImageMapPolygonObject[] = "com.sun.star.image.ImageMapPolygonObject";
66cdf0e10cSrcweir 
67cdf0e10cSrcweir XMLImageMapExport::XMLImageMapExport(SvXMLExport& rExp) :
68cdf0e10cSrcweir     msBoundary(RTL_CONSTASCII_USTRINGPARAM("Boundary")),
69cdf0e10cSrcweir     msCenter(RTL_CONSTASCII_USTRINGPARAM("Center")),
70cdf0e10cSrcweir     msDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
71cdf0e10cSrcweir     msImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
72cdf0e10cSrcweir     msIsActive(RTL_CONSTASCII_USTRINGPARAM("IsActive")),
73cdf0e10cSrcweir     msName(RTL_CONSTASCII_USTRINGPARAM("Name")),
74cdf0e10cSrcweir     msPolygon(RTL_CONSTASCII_USTRINGPARAM("Polygon")),
75cdf0e10cSrcweir     msRadius(RTL_CONSTASCII_USTRINGPARAM("Radius")),
76cdf0e10cSrcweir     msTarget(RTL_CONSTASCII_USTRINGPARAM("Target")),
77cdf0e10cSrcweir     msURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
78cdf0e10cSrcweir     msTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
79cdf0e10cSrcweir     mrExport(rExp),
80cdf0e10cSrcweir     mbWhiteSpace(sal_True)
81cdf0e10cSrcweir {
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir XMLImageMapExport::~XMLImageMapExport()
85cdf0e10cSrcweir {
86cdf0e10cSrcweir 
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir void XMLImageMapExport::Export(
90cdf0e10cSrcweir     const Reference<XPropertySet> & rPropertySet)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     if (rPropertySet->getPropertySetInfo()->hasPropertyByName(msImageMap))
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir         Any aAny = rPropertySet->getPropertyValue(msImageMap);
95cdf0e10cSrcweir         Reference<XIndexContainer> aContainer;
96cdf0e10cSrcweir         aAny >>= aContainer;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         Export(aContainer);
99cdf0e10cSrcweir     }
100cdf0e10cSrcweir     // else: no ImageMap property -> nothing to do
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir void XMLImageMapExport::Export(
104cdf0e10cSrcweir     const Reference<XIndexContainer> & rContainer)
105cdf0e10cSrcweir {
106cdf0e10cSrcweir     if (rContainer.is())
107cdf0e10cSrcweir     {
108cdf0e10cSrcweir         if (rContainer->hasElements())
109cdf0e10cSrcweir         {
110cdf0e10cSrcweir             // image map container element
111cdf0e10cSrcweir             SvXMLElementExport aImageMapElement(
112cdf0e10cSrcweir                 mrExport, XML_NAMESPACE_DRAW, XML_IMAGE_MAP,
113cdf0e10cSrcweir                 mbWhiteSpace, mbWhiteSpace);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir             // iterate over image map elements and call ExportMapEntry(...)
116cdf0e10cSrcweir             // for each
117cdf0e10cSrcweir             sal_Int32 nLength = rContainer->getCount();
118cdf0e10cSrcweir             for(sal_Int32 i = 0; i < nLength; i++)
119cdf0e10cSrcweir             {
120cdf0e10cSrcweir                 Any aAny = rContainer->getByIndex(i);
121cdf0e10cSrcweir                 Reference<XPropertySet> rElement;
122cdf0e10cSrcweir                 aAny >>= rElement;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir                 DBG_ASSERT(rElement.is(), "Image map element is empty!");
125cdf0e10cSrcweir                 if (rElement.is())
126cdf0e10cSrcweir                 {
127cdf0e10cSrcweir                     ExportMapEntry(rElement);
128cdf0e10cSrcweir                 }
129cdf0e10cSrcweir             }
130cdf0e10cSrcweir         }
131cdf0e10cSrcweir         // else: container is empty -> nothing to do
132cdf0e10cSrcweir     }
133cdf0e10cSrcweir     // else: no container -> nothign to do
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 
137cdf0e10cSrcweir void XMLImageMapExport::ExportMapEntry(
138cdf0e10cSrcweir     const Reference<XPropertySet> & rPropertySet)
139cdf0e10cSrcweir {
140cdf0e10cSrcweir     Reference<XServiceInfo> xServiceInfo(rPropertySet, UNO_QUERY);
141cdf0e10cSrcweir     if (xServiceInfo.is())
142cdf0e10cSrcweir     {
143cdf0e10cSrcweir         enum XMLTokenEnum eType = XML_TOKEN_INVALID;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         // distinguish map entries by their service name
146cdf0e10cSrcweir         Sequence<OUString> sServiceNames =
147cdf0e10cSrcweir             xServiceInfo->getSupportedServiceNames();
148cdf0e10cSrcweir         sal_Int32 nLength = sServiceNames.getLength();
149cdf0e10cSrcweir         for( sal_Int32 i=0; i<nLength; i++ )
150cdf0e10cSrcweir         {
151cdf0e10cSrcweir             OUString& rName = sServiceNames[i];
152cdf0e10cSrcweir 
153cdf0e10cSrcweir             if ( rName.equalsAsciiL(sAPI_ImageMapRectangleObject,
154cdf0e10cSrcweir                                     sizeof(sAPI_ImageMapRectangleObject)-1) )
155cdf0e10cSrcweir             {
156cdf0e10cSrcweir                 eType = XML_AREA_RECTANGLE;
157cdf0e10cSrcweir                 break;
158cdf0e10cSrcweir             }
159cdf0e10cSrcweir             else if ( rName.equalsAsciiL(sAPI_ImageMapCircleObject,
160cdf0e10cSrcweir                                          sizeof(sAPI_ImageMapCircleObject)-1) )
161cdf0e10cSrcweir             {
162cdf0e10cSrcweir                 eType = XML_AREA_CIRCLE;
163cdf0e10cSrcweir                 break;
164cdf0e10cSrcweir             }
165cdf0e10cSrcweir             else if ( rName.equalsAsciiL(sAPI_ImageMapPolygonObject,
166cdf0e10cSrcweir                                          sizeof(sAPI_ImageMapPolygonObject)-1))
167cdf0e10cSrcweir             {
168cdf0e10cSrcweir                 eType = XML_AREA_POLYGON;
169cdf0e10cSrcweir                 break;
170cdf0e10cSrcweir             }
171cdf0e10cSrcweir         }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir         // return from method if no proper service is found!
174cdf0e10cSrcweir         DBG_ASSERT(XML_TOKEN_INVALID != eType,
175cdf0e10cSrcweir                    "Image map element doesn't support appropriate service!");
176cdf0e10cSrcweir         if (XML_TOKEN_INVALID == eType)
177cdf0e10cSrcweir             return;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir         // now: handle ImageMapObject properties (those for all types)
180cdf0e10cSrcweir 
181cdf0e10cSrcweir         // XLINK (URL property)
182cdf0e10cSrcweir         Any aAny = rPropertySet->getPropertyValue(msURL);
183cdf0e10cSrcweir         OUString sHref;
184cdf0e10cSrcweir         aAny >>= sHref;
185cdf0e10cSrcweir         if (sHref.getLength() > 0)
186cdf0e10cSrcweir         {
187cdf0e10cSrcweir             mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference(sHref));
188cdf0e10cSrcweir         }
189cdf0e10cSrcweir         mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir         // Target property (and xlink:show)
192cdf0e10cSrcweir         aAny = rPropertySet->getPropertyValue(msTarget);
193cdf0e10cSrcweir         OUString sTargt;
194cdf0e10cSrcweir         aAny >>= sTargt;
195cdf0e10cSrcweir         if (sTargt.getLength() > 0)
196cdf0e10cSrcweir         {
197cdf0e10cSrcweir             mrExport.AddAttribute(
198cdf0e10cSrcweir                 XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, sTargt);
199cdf0e10cSrcweir 
200cdf0e10cSrcweir             mrExport.AddAttribute(
201cdf0e10cSrcweir                 XML_NAMESPACE_XLINK, XML_SHOW,
202cdf0e10cSrcweir                 sTargt.equalsAsciiL( "_blank", sizeof("_blank")-1 )
203cdf0e10cSrcweir                                         ? XML_NEW : XML_REPLACE );
204cdf0e10cSrcweir         }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir         // name
207cdf0e10cSrcweir         aAny = rPropertySet->getPropertyValue(msName);
208cdf0e10cSrcweir         OUString sItemName;
209cdf0e10cSrcweir         aAny >>= sItemName;
210cdf0e10cSrcweir         if (sItemName.getLength() > 0)
211cdf0e10cSrcweir         {
212cdf0e10cSrcweir             mrExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, sItemName);
213cdf0e10cSrcweir         }
214cdf0e10cSrcweir 
215cdf0e10cSrcweir         // is-active
216cdf0e10cSrcweir         aAny = rPropertySet->getPropertyValue(msIsActive);
217cdf0e10cSrcweir         if (! *(sal_Bool*)aAny.getValue())
218cdf0e10cSrcweir         {
219cdf0e10cSrcweir             mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NOHREF, XML_NOHREF);
220cdf0e10cSrcweir         }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir         // call specific rectangle/circle/... method
223cdf0e10cSrcweir         // also prepare element name
224cdf0e10cSrcweir         switch (eType)
225cdf0e10cSrcweir         {
226cdf0e10cSrcweir             case XML_AREA_RECTANGLE:
227cdf0e10cSrcweir                 ExportRectangle(rPropertySet);
228cdf0e10cSrcweir                 break;
229cdf0e10cSrcweir             case XML_AREA_CIRCLE:
230cdf0e10cSrcweir                 ExportCircle(rPropertySet);
231cdf0e10cSrcweir                 break;
232cdf0e10cSrcweir             case XML_AREA_POLYGON:
233cdf0e10cSrcweir                 ExportPolygon(rPropertySet);
234cdf0e10cSrcweir                 break;
235cdf0e10cSrcweir             default:
236cdf0e10cSrcweir                 break;
237cdf0e10cSrcweir         }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir         // write element
240cdf0e10cSrcweir         DBG_ASSERT(XML_TOKEN_INVALID != eType,
241cdf0e10cSrcweir                    "No name?! How did this happen?");
242cdf0e10cSrcweir         SvXMLElementExport aAreaElement(mrExport, XML_NAMESPACE_DRAW, eType,
243cdf0e10cSrcweir                                         mbWhiteSpace, mbWhiteSpace);
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         // title property (as <svg:title> element)
246cdf0e10cSrcweir         OUString sTitle;
247cdf0e10cSrcweir         rPropertySet->getPropertyValue(msTitle) >>= sTitle;
248cdf0e10cSrcweir         if(sTitle.getLength())
249cdf0e10cSrcweir         {
250cdf0e10cSrcweir             SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, mbWhiteSpace, sal_False);
251cdf0e10cSrcweir             mrExport.Characters(sTitle);
252cdf0e10cSrcweir         }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir         // description property (as <svg:desc> element)
255cdf0e10cSrcweir         OUString sDescription;
256cdf0e10cSrcweir         rPropertySet->getPropertyValue(msDescription) >>= sDescription;
257cdf0e10cSrcweir         if (sDescription.getLength() > 0)
258cdf0e10cSrcweir         {
259cdf0e10cSrcweir             SvXMLElementExport aDesc(mrExport, XML_NAMESPACE_SVG, XML_DESC, mbWhiteSpace, sal_False);
260cdf0e10cSrcweir             mrExport.Characters(sDescription);
261cdf0e10cSrcweir         }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir         // export events attached to this
264cdf0e10cSrcweir         Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
265cdf0e10cSrcweir         mrExport.GetEventExport().Export(xSupplier, mbWhiteSpace);
266cdf0e10cSrcweir     }
267cdf0e10cSrcweir     // else: no service info -> can't determine type -> ignore entry
268cdf0e10cSrcweir }
269cdf0e10cSrcweir 
270cdf0e10cSrcweir void XMLImageMapExport::ExportRectangle(
271cdf0e10cSrcweir     const Reference<XPropertySet> & rPropertySet)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir     // get boundary rectangle
274cdf0e10cSrcweir     Any aAny = rPropertySet->getPropertyValue(msBoundary);
275cdf0e10cSrcweir     awt::Rectangle aRectangle;
276cdf0e10cSrcweir     aAny >>= aRectangle;
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     // parameters svg:x, svg:y, svg:width, svg:height
279cdf0e10cSrcweir     OUStringBuffer aBuffer;
280cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.X);
281cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
282cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
283cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Y);
284cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
285cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
286cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Width);
287cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
288cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
289cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Height);
290cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
291cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir void XMLImageMapExport::ExportCircle(
295cdf0e10cSrcweir     const Reference<XPropertySet> & rPropertySet)
296cdf0e10cSrcweir {
297cdf0e10cSrcweir     // get boundary rectangle
298cdf0e10cSrcweir     Any aAny = rPropertySet->getPropertyValue(msCenter);
299cdf0e10cSrcweir     awt::Point aCenter;
300cdf0e10cSrcweir     aAny >>= aCenter;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     // parameters svg:cx, svg:cy
303cdf0e10cSrcweir     OUStringBuffer aBuffer;
304cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.X);
305cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CX,
306cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
307cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.Y);
308cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CY,
309cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     // radius
312cdf0e10cSrcweir     aAny = rPropertySet->getPropertyValue(msRadius);
313cdf0e10cSrcweir     sal_Int32 nRadius = 0;
314cdf0e10cSrcweir     aAny >>= nRadius;
315cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nRadius);
316cdf0e10cSrcweir     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_R,
317cdf0e10cSrcweir                           aBuffer.makeStringAndClear() );
318cdf0e10cSrcweir }
319cdf0e10cSrcweir 
320*1f882ec4SArmin Le Grand void XMLImageMapExport::ExportPolygon(const Reference<XPropertySet> & rPropertySet)
321cdf0e10cSrcweir {
322cdf0e10cSrcweir     // polygons get exported as bounding box, viewbox, and coordinate
323cdf0e10cSrcweir     // pair sequence. The bounding box is always the entire image.
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     // get polygon point sequence
326cdf0e10cSrcweir     Any aAny = rPropertySet->getPropertyValue(msPolygon);
327cdf0e10cSrcweir     PointSequence aPoly;
328cdf0e10cSrcweir     aAny >>= aPoly;
329cdf0e10cSrcweir 
330*1f882ec4SArmin Le Grand     const basegfx::B2DPolygon aPolygon(
331*1f882ec4SArmin Le Grand         basegfx::tools::UnoPointSequenceToB2DPolygon(
332*1f882ec4SArmin Le Grand             aPoly));
333*1f882ec4SArmin Le Grand     const basegfx::B2DRange aPolygonRange(aPolygon.getB2DRange());
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     // parameters svg:x, svg:y, svg:width, svg:height
336cdf0e10cSrcweir     OUStringBuffer aBuffer;
337*1f882ec4SArmin Le Grand 
338cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
339*1f882ec4SArmin Le Grand     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, aBuffer.makeStringAndClear() );
340cdf0e10cSrcweir     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
341*1f882ec4SArmin Le Grand     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, aBuffer.makeStringAndClear() );
342*1f882ec4SArmin Le Grand     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, basegfx::fround(aPolygonRange.getWidth()));
343*1f882ec4SArmin Le Grand     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aBuffer.makeStringAndClear() );
344*1f882ec4SArmin Le Grand     mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, basegfx::fround(aPolygonRange.getHeight()));
345*1f882ec4SArmin Le Grand     mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aBuffer.makeStringAndClear() );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir     // svg:viewbox
348*1f882ec4SArmin Le Grand     SdXMLImExViewBox aViewBox(0.0, 0.0, aPolygonRange.getWidth(), aPolygonRange.getHeight());
349*1f882ec4SArmin Le Grand     mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     // export point sequence
352*1f882ec4SArmin Le Grand     const ::rtl::OUString aPointString(
353*1f882ec4SArmin Le Grand         basegfx::tools::exportToSvgPoints(
354*1f882ec4SArmin Le Grand             aPolygon));
355*1f882ec4SArmin Le Grand 
356*1f882ec4SArmin Le Grand     mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
357cdf0e10cSrcweir }
358*1f882ec4SArmin Le Grand 
359*1f882ec4SArmin Le Grand // eof
360