Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
30 : : #include <rtl/oustringostreaminserter.hxx>
31 : : #include <com/sun/star/text/XText.hpp>
32 : : #include <com/sun/star/container/XNamed.hpp>
33 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
34 : : #include <com/sun/star/drawing/CircleKind.hpp>
35 : : #include <com/sun/star/drawing/ConnectorType.hpp>
36 : : #include <com/sun/star/drawing/XControlShape.hpp>
37 : : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
38 : : #include <com/sun/star/document/XEventsSupplier.hpp>
39 : : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
40 : : #include <com/sun/star/embed/ElementModes.hpp>
41 : : #include <com/sun/star/embed/XTransactedObject.hpp>
42 : : #include <com/sun/star/media/ZoomLevel.hpp>
43 : :
44 : : #include <sax/tools/converter.hxx>
45 : :
46 : : #include <comphelper/storagehelper.hxx>
47 : :
48 : : #include "anim.hxx"
49 : :
50 : : #include <xmloff/shapeexport.hxx>
51 : : #include "sdpropls.hxx"
52 : : #include <tools/debug.hxx>
53 : : #include <tools/helpers.hxx>
54 : : #include <rtl/ustrbuf.hxx>
55 : : #include <xmloff/xmlexp.hxx>
56 : : #include <xmloff/xmluconv.hxx>
57 : : #include "XMLImageMapExport.hxx"
58 : : #include "xexptran.hxx"
59 : : #include <xmloff/xmltoken.hxx>
60 : : #include <xmloff/nmspmap.hxx>
61 : :
62 : : #include "xmloff/xmlnmspe.hxx"
63 : : #include <basegfx/matrix/b2dhommatrix.hxx>
64 : : #include <basegfx/tuple/b2dtuple.hxx>
65 : :
66 : : using ::rtl::OUString;
67 : : using ::rtl::OUStringBuffer;
68 : :
69 : : using namespace ::com::sun::star;
70 : : using namespace ::xmloff::token;
71 : :
72 : :
73 : : //////////////////////////////////////////////////////////////////////////////
74 : :
75 : 100 : void XMLShapeExport::ImpExportNewTrans(const uno::Reference< beans::XPropertySet >& xPropSet,
76 : : sal_Int32 nFeatures, awt::Point* pRefPoint)
77 : : {
78 : : // get matrix
79 [ + - ]: 100 : ::basegfx::B2DHomMatrix aMatrix;
80 [ + - ]: 100 : ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
81 : :
82 : : // decompose and correct abour pRefPoint
83 : 100 : ::basegfx::B2DTuple aTRScale;
84 : 100 : double fTRShear(0.0);
85 : 100 : double fTRRotate(0.0);
86 : 100 : ::basegfx::B2DTuple aTRTranslate;
87 [ + - ]: 100 : ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
88 : :
89 : : // use features and write
90 [ + - ][ + - ]: 100 : ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
91 : 100 : }
92 : :
93 : 100 : void XMLShapeExport::ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix,
94 : : const uno::Reference< beans::XPropertySet >& xPropSet)
95 : : {
96 : : /* Get <TransformationInHoriL2R>, if it exist
97 : : and if the document is exported into the OpenOffice.org file format.
98 : : This property only exists at service com::sun::star::text::Shape - the
99 : : Writer UNO service for shapes.
100 : : This code is needed, because the positioning attributes in the
101 : : OpenOffice.org file format are given in horizontal left-to-right layout
102 : : regardless the layout direction the shape is in. In the OASIS Open Office
103 : : file format the positioning attributes are correctly given in the layout
104 : : direction the shape is in. Thus, this code provides the conversion from
105 : : the OASIS Open Office file format to the OpenOffice.org file format. (#i28749#)
106 : : */
107 : 100 : uno::Any aAny;
108 [ - + ][ - + ]: 250 : if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
[ + + ]
109 [ + - ][ + - ]: 150 : xPropSet->getPropertySetInfo()->hasPropertyByName(
[ + - ][ + + ]
[ # # ]
110 [ + - ][ + + ]: 150 : OUString("TransformationInHoriL2R")) )
[ + + ]
[ # # # # ]
111 : : {
112 [ # # ][ # # ]: 0 : aAny = xPropSet->getPropertyValue(OUString("TransformationInHoriL2R"));
113 : : }
114 : : else
115 : : {
116 [ + - ][ + - ]: 100 : aAny = xPropSet->getPropertyValue(OUString("Transformation"));
117 : : }
118 : 100 : drawing::HomogenMatrix3 aMatrix;
119 [ + - ]: 100 : aAny >>= aMatrix;
120 : :
121 [ + - ]: 100 : rMatrix.set(0, 0, aMatrix.Line1.Column1);
122 [ + - ]: 100 : rMatrix.set(0, 1, aMatrix.Line1.Column2);
123 [ + - ]: 100 : rMatrix.set(0, 2, aMatrix.Line1.Column3);
124 [ + - ]: 100 : rMatrix.set(1, 0, aMatrix.Line2.Column1);
125 [ + - ]: 100 : rMatrix.set(1, 1, aMatrix.Line2.Column2);
126 [ + - ]: 100 : rMatrix.set(1, 2, aMatrix.Line2.Column3);
127 [ + - ]: 100 : rMatrix.set(2, 0, aMatrix.Line3.Column1);
128 [ + - ]: 100 : rMatrix.set(2, 1, aMatrix.Line3.Column2);
129 [ + - ]: 100 : rMatrix.set(2, 2, aMatrix.Line3.Column3);
130 : 100 : }
131 : :
132 : 100 : void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale,
133 : : double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint)
134 : : {
135 : : // decompose matrix
136 : 100 : rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
137 : :
138 : : // correct translation about pRefPoint
139 [ - + ]: 100 : if(pRefPoint)
140 : : {
141 : 0 : rTRTranslate -= ::basegfx::B2DTuple(pRefPoint->X, pRefPoint->Y);
142 : : }
143 : 100 : }
144 : :
145 : 100 : void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear,
146 : : double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures)
147 : : {
148 : : // allways write Size (rTRScale) since this statement carries the union
149 : : // of the object
150 : 100 : OUString aStr;
151 : 100 : OUStringBuffer sStringBuffer;
152 : 100 : ::basegfx::B2DTuple aTRScale(rTRScale);
153 : :
154 : : // svg: width
155 [ - + ]: 100 : if(!(nFeatures & SEF_EXPORT_WIDTH))
156 : : {
157 : 0 : aTRScale.setX(1.0);
158 : : }
159 : : else
160 : : {
161 [ + - ]: 100 : if( aTRScale.getX() > 0.0 )
162 : 100 : aTRScale.setX(aTRScale.getX() - 1.0);
163 [ # # ]: 0 : else if( aTRScale.getX() < 0.0 )
164 : 0 : aTRScale.setX(aTRScale.getX() + 1.0);
165 : : }
166 : :
167 : 100 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
168 [ + - ]: 200 : FRound(aTRScale.getX()));
169 [ + - ]: 100 : aStr = sStringBuffer.makeStringAndClear();
170 [ + - ]: 100 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
171 : :
172 : : // svg: height
173 [ - + ]: 100 : if(!(nFeatures & SEF_EXPORT_HEIGHT))
174 : : {
175 : 0 : aTRScale.setY(1.0);
176 : : }
177 : : else
178 : : {
179 [ + - ]: 100 : if( aTRScale.getY() > 0.0 )
180 : 100 : aTRScale.setY(aTRScale.getY() - 1.0);
181 [ # # ]: 0 : else if( aTRScale.getY() < 0.0 )
182 : 0 : aTRScale.setY(aTRScale.getY() + 1.0);
183 : : }
184 : :
185 : 100 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
186 [ + - ]: 200 : FRound(aTRScale.getY()));
187 [ + - ]: 100 : aStr = sStringBuffer.makeStringAndClear();
188 [ + - ]: 100 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
189 : :
190 : : // decide if transformation is neccessary
191 [ + - ][ - + ]: 100 : sal_Bool bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0);
192 : :
193 [ - + ]: 100 : if(bTransformationIsNeccessary)
194 : : {
195 : : // write transformation, but WITHOUT scale which is exported as size above
196 [ # # ]: 0 : SdXMLImExTransform2D aTransform;
197 : :
198 [ # # ]: 0 : aTransform.AddSkewX(atan(fTRShear));
199 : :
200 : : // #i78696#
201 : : // fTRRotate is mathematically correct, but due to the error
202 : : // we export/import it mirrored. Since the API implementation is fixed and
203 : : // uses the correctly oriented angle, it is necessary for compatibility to
204 : : // mirror the angle here to stay at the old behaviour. There is a follow-up
205 : : // task (#i78698#) to fix this in the next ODF FileFormat version
206 [ # # ]: 0 : aTransform.AddRotate(-fTRRotate);
207 : :
208 [ # # ]: 0 : aTransform.AddTranslate(rTRTranslate);
209 : :
210 : : // does transformation need to be exported?
211 [ # # ]: 0 : if(aTransform.NeedsAction())
212 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
[ # # ]
213 : : }
214 : : else
215 : : {
216 : : // no shear, no rotate; just add object position to export and we are done
217 [ + - ]: 100 : if(nFeatures & SEF_EXPORT_X)
218 : : {
219 : : // svg: x
220 : 100 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
221 [ + - ]: 200 : FRound(rTRTranslate.getX()));
222 [ + - ]: 100 : aStr = sStringBuffer.makeStringAndClear();
223 [ + - ]: 100 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
224 : : }
225 : :
226 [ + - ]: 100 : if(nFeatures & SEF_EXPORT_Y)
227 : : {
228 : : // svg: y
229 : 100 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
230 [ + - ]: 200 : FRound(rTRTranslate.getY()));
231 [ + - ]: 100 : aStr = sStringBuffer.makeStringAndClear();
232 [ + - ]: 100 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
233 : : }
234 : 100 : }
235 : 100 : }
236 : :
237 : : //////////////////////////////////////////////////////////////////////////////
238 : :
239 : 68 : sal_Bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< beans::XPropertySet >& xPropSet, const rtl::OUString& rClass )
240 : : {
241 : 68 : sal_Bool bIsEmpty = sal_False;
242 : :
243 : 68 : OUStringBuffer sStringBuffer;
244 : :
245 : : // write presentation class entry
246 [ + - ]: 68 : mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, rClass);
247 : :
248 [ + - ]: 68 : if( xPropSet.is() )
249 : : {
250 [ + - ][ + - ]: 68 : uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
251 : :
252 : 68 : sal_Bool bTemp = false;
253 : :
254 : : // is empty pes shape?
255 [ + - ][ + - ]: 68 : if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString("IsEmptyPresentationObject")))
[ + - ][ + - ]
[ + - ][ + - ]
[ + - # #
# # ]
256 : : {
257 [ + - ][ + - ]: 68 : xPropSet->getPropertyValue(OUString("IsEmptyPresentationObject")) >>= bIsEmpty;
258 [ + + ]: 68 : if( bIsEmpty )
259 [ + - ]: 24 : mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TRUE);
260 : : }
261 : :
262 : : // is user-transformed?
263 [ + - ][ + - ]: 68 : if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString("IsPlaceholderDependent")))
[ + - ][ + - ]
[ + - ][ + - ]
[ + - # #
# # ]
264 : : {
265 [ + - ][ + - ]: 68 : xPropSet->getPropertyValue(OUString("IsPlaceholderDependent")) >>= bTemp;
266 [ - + ]: 68 : if(!bTemp)
267 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TRUE);
268 : 68 : }
269 : : }
270 : :
271 : 68 : return bIsEmpty;
272 : : }
273 : :
274 : : //////////////////////////////////////////////////////////////////////////////
275 : :
276 : 44 : void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape )
277 : : {
278 [ + - ]: 44 : uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
279 [ + - ]: 44 : if( xText.is() )
280 : : {
281 [ + - ]: 44 : uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
282 [ + - ][ + - ]: 44 : if( xEnumAccess.is() && xEnumAccess->hasElements() )
[ + - ][ + - ]
[ + - ]
283 [ + - ][ + - ]: 44 : mrExport.GetTextParagraphExport()->exportText( xText );
[ + - ][ + - ]
284 : 44 : }
285 : 44 : }
286 : :
287 : : //////////////////////////////////////////////////////////////////////////////
288 : : #include <com/sun/star/presentation/ClickAction.hpp>
289 : : #include <com/sun/star/presentation/AnimationSpeed.hpp>
290 : :
291 : : namespace {
292 : :
293 : : const sal_Int32 FOUND_CLICKACTION = 0x00000001;
294 : : const sal_Int32 FOUND_BOOKMARK = 0x00000002;
295 : : const sal_Int32 FOUND_EFFECT = 0x00000004;
296 : : const sal_Int32 FOUND_PLAYFULL = 0x00000008;
297 : : const sal_Int32 FOUND_VERB = 0x00000010;
298 : : const sal_Int32 FOUND_SOUNDURL = 0x00000020;
299 : : const sal_Int32 FOUND_SPEED = 0x00000040;
300 : : const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
301 : : const sal_Int32 FOUND_MACRO = 0x00000100;
302 : : const sal_Int32 FOUND_LIBRARY = 0x00000200;
303 : : const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
304 : :
305 : : } // namespace
306 : :
307 : 68 : void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
308 : : {
309 [ + - ]: 68 : uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
310 [ - + ]: 68 : if( !xEventsSupplier.is() )
311 : : return;
312 : :
313 [ + - ][ + - ]: 68 : uno::Reference< container::XNameAccess > xEvents( xEventsSupplier->getEvents(), uno::UNO_QUERY );
[ + - ]
314 : : DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
315 [ - + ]: 68 : if( !xEvents.is() )
316 : : return;
317 : :
318 : 68 : sal_Int32 nFound = 0;
319 : :
320 : : // extract properties from "OnClick" event --------------------------------
321 : :
322 : 68 : OUString aClickEventType;
323 : 68 : presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
324 : 68 : presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
325 : 68 : presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
326 : 68 : OUString aStrSoundURL;
327 : 68 : sal_Bool bPlayFull = false;
328 : 68 : sal_Int32 nVerb = 0;
329 : 68 : OUString aStrMacro;
330 : 68 : OUString aStrLibrary;
331 : 68 : OUString aStrBookmark;
332 : :
333 [ + - ]: 68 : uno::Sequence< beans::PropertyValue > aClickProperties;
334 [ + - ][ + - ]: 68 : if( xEvents->hasByName( msOnClick ) && (xEvents->getByName( msOnClick ) >>= aClickProperties) )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - # # ]
335 : : {
336 : 68 : const beans::PropertyValue* pProperty = aClickProperties.getConstArray();
337 : 68 : const beans::PropertyValue* pPropertyEnd = pProperty + aClickProperties.getLength();
338 [ + + ]: 204 : for( ; pProperty != pPropertyEnd; ++pProperty )
339 : : {
340 [ + + ][ + - ]: 136 : if( ( ( nFound & FOUND_CLICKEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
[ + + ]
341 : : {
342 [ + - ]: 68 : if( pProperty->Value >>= aClickEventType )
343 : 68 : nFound |= FOUND_CLICKEVENTTYPE;
344 : : }
345 [ + - ][ + - ]: 68 : else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperty->Name == msClickAction )
[ + - ]
346 : : {
347 [ + - ][ + - ]: 68 : if( pProperty->Value >>= eClickAction )
348 : 68 : nFound |= FOUND_CLICKACTION;
349 : : }
350 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperty->Name == msMacroName || pProperty->Name == msScript ) )
[ # # ][ # # ]
351 : : {
352 [ # # ]: 0 : if( pProperty->Value >>= aStrMacro )
353 : 0 : nFound |= FOUND_MACRO;
354 : : }
355 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperty->Name == msLibrary )
[ # # ]
356 : : {
357 [ # # ]: 0 : if( pProperty->Value >>= aStrLibrary )
358 : 0 : nFound |= FOUND_LIBRARY;
359 : : }
360 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperty->Name == msEffect )
[ # # ]
361 : : {
362 [ # # ][ # # ]: 0 : if( pProperty->Value >>= eEffect )
363 : 0 : nFound |= FOUND_EFFECT;
364 : : }
365 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperty->Name == msBookmark )
[ # # ]
366 : : {
367 [ # # ]: 0 : if( pProperty->Value >>= aStrBookmark )
368 : 0 : nFound |= FOUND_BOOKMARK;
369 : : }
370 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperty->Name == msSpeed )
[ # # ]
371 : : {
372 [ # # ][ # # ]: 0 : if( pProperty->Value >>= eSpeed )
373 : 0 : nFound |= FOUND_SPEED;
374 : : }
375 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperty->Name == msSoundURL )
[ # # ]
376 : : {
377 [ # # ]: 0 : if( pProperty->Value >>= aStrSoundURL )
378 : 0 : nFound |= FOUND_SOUNDURL;
379 : : }
380 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperty->Name == msPlayFull )
[ # # ]
381 : : {
382 [ # # ]: 0 : if( pProperty->Value >>= bPlayFull )
383 : 0 : nFound |= FOUND_PLAYFULL;
384 : : }
385 [ # # ][ # # ]: 0 : else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperty->Name == msVerb )
[ # # ]
386 : : {
387 [ # # ]: 0 : if( pProperty->Value >>= nVerb )
388 : 0 : nFound |= FOUND_VERB;
389 : : }
390 : : }
391 : : }
392 : :
393 : : // create the XML elements
394 : :
395 [ + - ]: 68 : if( aClickEventType == msPresentation )
396 : : {
397 [ + - ][ - + ]: 68 : if( ((nFound & FOUND_CLICKACTION) == 0) || (eClickAction == presentation::ClickAction_NONE) )
398 : : return;
399 : :
400 [ # # ]: 0 : SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
401 : :
402 : : enum XMLTokenEnum eStrAction;
403 : :
404 [ # # # # : 0 : switch( eClickAction )
# # # # #
# # # #
# ]
405 : : {
406 : 0 : case presentation::ClickAction_PREVPAGE: eStrAction = XML_PREVIOUS_PAGE; break;
407 : 0 : case presentation::ClickAction_NEXTPAGE: eStrAction = XML_NEXT_PAGE; break;
408 : 0 : case presentation::ClickAction_FIRSTPAGE: eStrAction = XML_FIRST_PAGE; break;
409 : 0 : case presentation::ClickAction_LASTPAGE: eStrAction = XML_LAST_PAGE; break;
410 : 0 : case presentation::ClickAction_INVISIBLE: eStrAction = XML_HIDE; break;
411 : 0 : case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
412 : 0 : case presentation::ClickAction_PROGRAM: eStrAction = XML_EXECUTE; break;
413 : 0 : case presentation::ClickAction_BOOKMARK: eStrAction = XML_SHOW; break;
414 : 0 : case presentation::ClickAction_DOCUMENT: eStrAction = XML_SHOW; break;
415 : 0 : case presentation::ClickAction_MACRO: eStrAction = XML_EXECUTE_MACRO; break;
416 : 0 : case presentation::ClickAction_VERB: eStrAction = XML_VERB; break;
417 : 0 : case presentation::ClickAction_VANISH: eStrAction = XML_FADE_OUT; break;
418 : 0 : case presentation::ClickAction_SOUND: eStrAction = XML_SOUND; break;
419 : : default:
420 : : OSL_FAIL( "unknown presentation::ClickAction found!" );
421 : 0 : eStrAction = XML_UNKNOWN;
422 : : }
423 : :
424 : : OUString aEventQName(
425 : 0 : mrExport.GetNamespaceMap().GetQNameByKey(
426 [ # # ]: 0 : XML_NAMESPACE_DOM, OUString( "click" ) ) );
427 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
428 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction );
429 : :
430 [ # # ]: 0 : if( eClickAction == presentation::ClickAction_VANISH )
431 : : {
432 [ # # ]: 0 : if( nFound & FOUND_EFFECT )
433 : : {
434 : : XMLEffect eKind;
435 : : XMLEffectDirection eDirection;
436 : : sal_Int16 nStartScale;
437 : : sal_Bool bIn;
438 : :
439 [ # # ]: 0 : SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
440 : :
441 [ # # ]: 0 : if( eKind != EK_none )
442 : : {
443 [ # # ]: 0 : SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap );
444 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() );
445 : : }
446 : :
447 [ # # ]: 0 : if( eDirection != ED_none )
448 : : {
449 [ # # ]: 0 : SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap );
450 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() );
451 : : }
452 : :
453 [ # # ]: 0 : if( nStartScale != -1 )
454 : : {
455 [ # # ]: 0 : ::sax::Converter::convertPercent( msBuffer, nStartScale );
456 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() );
457 : : }
458 : : }
459 : :
460 [ # # ][ # # ]: 0 : if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE )
461 : : {
462 [ # # ]: 0 : if( eSpeed != presentation::AnimationSpeed_MEDIUM )
463 : : {
464 [ # # ]: 0 : SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap );
465 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() );
466 : : }
467 : : }
468 : : }
469 : :
470 [ # # ][ # # ]: 0 : if( eClickAction == presentation::ClickAction_PROGRAM ||
[ # # ]
471 : : eClickAction == presentation::ClickAction_BOOKMARK ||
472 : : eClickAction == presentation::ClickAction_DOCUMENT )
473 : : {
474 [ # # ]: 0 : if( eClickAction == presentation::ClickAction_BOOKMARK )
475 [ # # ]: 0 : msBuffer.append( sal_Unicode('#') );
476 : :
477 [ # # ]: 0 : msBuffer.append( aStrBookmark );
478 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
[ # # ]
479 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
480 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
481 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
482 : : }
483 : :
484 [ # # ][ # # ]: 0 : if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB )
485 : : {
486 [ # # ]: 0 : msBuffer.append( nVerb );
487 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear());
488 : : }
489 : :
490 [ # # ]: 0 : SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
491 : :
492 [ # # ][ # # ]: 0 : if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
493 : : {
494 [ # # ][ # # ]: 0 : if( ( nFound & FOUND_SOUNDURL ) && !aStrSoundURL.isEmpty() )
[ # # ]
495 : : {
496 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
497 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
498 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
499 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
500 [ # # ][ # # ]: 0 : if( nFound & FOUND_PLAYFULL && bPlayFull )
501 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
502 : :
503 [ # # ][ # # ]: 0 : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
504 : : }
505 [ # # ][ # # ]: 68 : }
506 : : }
507 [ # # ]: 0 : else if( aClickEventType == msStarBasic )
508 : : {
509 [ # # ]: 0 : if( nFound & FOUND_MACRO )
510 : : {
511 [ # # ]: 0 : SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
512 : :
513 : : mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
514 : 0 : mrExport.GetNamespaceMap().GetQNameByKey(
515 : : XML_NAMESPACE_OOO,
516 [ # # ][ # # ]: 0 : OUString( "starbasic" ) ) );
517 : : OUString aEventQName(
518 : 0 : mrExport.GetNamespaceMap().GetQNameByKey(
519 [ # # ]: 0 : XML_NAMESPACE_DOM, OUString( "click" ) ) );
520 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
521 : :
522 [ # # ]: 0 : if( nFound & FOUND_LIBRARY )
523 : : {
524 : : OUString sLocation( GetXMLToken(
525 : 0 : (aStrLibrary.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("StarOffice")) ||
526 : 0 : aStrLibrary.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("application")) ) ? XML_APPLICATION
527 [ # # ]: 0 : : XML_DOCUMENT ) );
[ # # # # ]
528 : 0 : OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
529 [ # # ][ # # ]: 0 : sTmp = sLocation;
530 [ # # ]: 0 : sTmp.append( sal_Unicode( ':' ) );
531 [ # # ]: 0 : sTmp.append( aStrMacro );
532 : : mrExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
533 [ # # ][ # # ]: 0 : sTmp.makeStringAndClear());
534 : : }
535 : : else
536 : : {
537 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro );
538 : : }
539 : :
540 [ # # ][ # # ]: 0 : SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
[ # # ]
541 : : }
542 : : }
543 [ # # ]: 0 : else if( aClickEventType == msScript )
544 : : {
545 [ # # ]: 0 : if( nFound & FOUND_MACRO )
546 : : {
547 [ # # ]: 0 : SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
548 [ # # ]: 0 : if ( nFound & FOUND_MACRO )
549 : : {
550 : 0 : mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey(
551 [ # # # # ]: 0 : XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
[ # # ]
552 : : OUString aEventQName(
553 : 0 : mrExport.GetNamespaceMap().GetQNameByKey(
554 [ # # ]: 0 : XML_NAMESPACE_DOM, OUString( "click" ) ) );
555 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
556 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
557 : :
558 [ # # ][ # # ]: 0 : SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
559 [ # # ]: 0 : }
560 : : }
561 [ + - ][ + - ]: 68 : }
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ - + ]
562 : : }
563 : :
564 : : //////////////////////////////////////////////////////////////////////////////
565 : :
566 : : /** #i68101# export shape Title and Description */
567 : 68 : void XMLShapeExport::ImpExportDescription( const uno::Reference< drawing::XShape >& xShape )
568 : : {
569 : : try
570 : : {
571 : 68 : OUString aTitle;
572 : 68 : OUString aDescription;
573 : :
574 [ + - ]: 68 : uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
575 [ + - ][ + - ]: 68 : xProps->getPropertyValue( OUString( "Title" ) ) >>= aTitle;
576 [ + - ][ + - ]: 68 : xProps->getPropertyValue( OUString( "Description" ) ) >>= aDescription;
577 : :
578 [ - + ]: 68 : if(!aTitle.isEmpty())
579 : : {
580 [ # # ]: 0 : SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
581 [ # # ][ # # ]: 0 : mrExport.Characters( aTitle );
582 : : }
583 : :
584 [ - + ]: 68 : if(!aDescription.isEmpty())
585 : : {
586 [ # # ]: 0 : SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False );
587 [ # # ][ # # ]: 0 : mrExport.Characters( aDescription );
588 [ # # ]: 68 : }
589 : : }
590 : 0 : catch( uno::Exception& )
591 : : {
592 : : OSL_FAIL( "could not export Title and/or Description for shape!" );
593 : : }
594 : 68 : }
595 : :
596 : : //////////////////////////////////////////////////////////////////////////////
597 : :
598 : 0 : void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
599 : : {
600 [ # # ]: 0 : uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
601 [ # # ][ # # ]: 0 : if(xShapes.is() && xShapes->getCount())
[ # # ][ # # ]
[ # # ]
602 : : {
603 : : // write group shape
604 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
605 [ # # ]: 0 : SvXMLElementExport aPGR(mrExport, XML_NAMESPACE_DRAW, XML_G, bCreateNewline, sal_True);
606 : :
607 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
608 [ # # ]: 0 : ImpExportEvents( xShape );
609 [ # # ]: 0 : ImpExportGluePoints( xShape );
610 : :
611 : : // #89764# if export of position is supressed for group shape,
612 : : // positions of contained objects should be written relative to
613 : : // the upper left edge of the group.
614 : 0 : awt::Point aUpperLeft;
615 : :
616 [ # # ]: 0 : if(!(nFeatures & SEF_EXPORT_POSITION))
617 : : {
618 : 0 : nFeatures |= SEF_EXPORT_POSITION;
619 [ # # ][ # # ]: 0 : aUpperLeft = xShape->getPosition();
620 : 0 : pRefPoint = &aUpperLeft;
621 : : }
622 : :
623 : : // write members
624 [ # # ][ # # ]: 0 : exportShapes( xShapes, nFeatures, pRefPoint );
625 : 0 : }
626 : 0 : }
627 : :
628 : : //////////////////////////////////////////////////////////////////////////////
629 : :
630 : 68 : void XMLShapeExport::ImpExportTextBoxShape(
631 : : const uno::Reference< drawing::XShape >& xShape,
632 : : XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
633 : : {
634 [ + - ]: 68 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
635 [ + - ]: 68 : if(xPropSet.is())
636 : : {
637 [ + - ][ + - ]: 68 : uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
638 : :
639 : : // presentation attribute (if presentation)
640 : 68 : sal_Bool bIsPresShape(sal_False);
641 : 68 : sal_Bool bIsEmptyPresObj(sal_False);
642 : 68 : OUString aStr;
643 : :
644 [ + + + + : 68 : switch(eShapeType)
+ + + +
- ]
645 : : {
646 : : case XmlShapeTypePresSubtitleShape:
647 : : {
648 [ + - ]: 4 : aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE);
649 : 4 : bIsPresShape = sal_True;
650 : 4 : break;
651 : : }
652 : : case XmlShapeTypePresTitleTextShape:
653 : : {
654 [ + - ]: 8 : aStr = GetXMLToken(XML_PRESENTATION_TITLE);
655 : 8 : bIsPresShape = sal_True;
656 : 8 : break;
657 : : }
658 : : case XmlShapeTypePresOutlinerShape:
659 : : {
660 [ + - ]: 4 : aStr = GetXMLToken(XML_PRESENTATION_OUTLINE);
661 : 4 : bIsPresShape = sal_True;
662 : 4 : break;
663 : : }
664 : : case XmlShapeTypePresNotesShape:
665 : : {
666 [ + - ]: 8 : aStr = GetXMLToken(XML_PRESENTATION_NOTES);
667 : 8 : bIsPresShape = sal_True;
668 : 8 : break;
669 : : }
670 : : case XmlShapeTypePresHeaderShape:
671 : : {
672 [ + - ]: 8 : aStr = GetXMLToken(XML_HEADER);
673 : 8 : bIsPresShape = sal_True;
674 : 8 : break;
675 : : }
676 : : case XmlShapeTypePresFooterShape:
677 : : {
678 [ + - ]: 12 : aStr = GetXMLToken(XML_FOOTER);
679 : 12 : bIsPresShape = sal_True;
680 : 12 : break;
681 : : }
682 : : case XmlShapeTypePresSlideNumberShape:
683 : : {
684 [ + - ]: 12 : aStr = GetXMLToken(XML_PAGE_NUMBER);
685 : 12 : bIsPresShape = sal_True;
686 : 12 : break;
687 : : }
688 : : case XmlShapeTypePresDateTimeShape:
689 : : {
690 [ + - ]: 12 : aStr = GetXMLToken(XML_DATE_TIME);
691 : 12 : bIsPresShape = sal_True;
692 : 12 : break;
693 : : }
694 : : default:
695 : 0 : break;
696 : : }
697 : :
698 : : // Transformation
699 [ + - ]: 68 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
700 : :
701 [ + - ]: 68 : if(bIsPresShape)
702 [ + - ]: 68 : bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
703 : :
704 : :
705 : 68 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
706 : : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
707 [ + - ]: 68 : XML_FRAME, bCreateNewline, sal_True );
708 : :
709 : : // evtl. corner radius?
710 : 68 : sal_Int32 nCornerRadius(0L);
711 [ + - ][ + - ]: 68 : xPropSet->getPropertyValue(OUString("CornerRadius")) >>= nCornerRadius;
712 [ - + ]: 68 : if(nCornerRadius)
713 : : {
714 : 0 : OUStringBuffer sStringBuffer;
715 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
716 [ # # ]: 0 : nCornerRadius);
717 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
718 : : }
719 : :
720 : : {
721 : : // write text-box
722 [ + - ]: 68 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, sal_True, sal_True);
723 [ + + ]: 68 : if(!bIsEmptyPresObj)
724 [ + - ][ + - ]: 68 : ImpExportText( xShape );
725 : : }
726 : :
727 [ + - ]: 68 : ImpExportDescription( xShape ); // #i68101#
728 [ + - ]: 68 : ImpExportEvents( xShape );
729 [ + - ][ + - ]: 68 : ImpExportGluePoints( xShape );
730 : 68 : }
731 : 68 : }
732 : :
733 : : //////////////////////////////////////////////////////////////////////////////
734 : :
735 : 0 : void XMLShapeExport::ImpExportRectangleShape(
736 : : const uno::Reference< drawing::XShape >& xShape,
737 : : XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
738 : : {
739 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
740 [ # # ]: 0 : if(xPropSet.is())
741 : : {
742 : : // Transformation
743 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
744 : :
745 : : // evtl. corner radius?
746 : 0 : sal_Int32 nCornerRadius(0L);
747 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue(OUString("CornerRadius")) >>= nCornerRadius;
748 [ # # ]: 0 : if(nCornerRadius)
749 : : {
750 : 0 : OUStringBuffer sStringBuffer;
751 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
752 [ # # ]: 0 : nCornerRadius);
753 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
754 : : }
755 : :
756 : : // write rectangle
757 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
758 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_RECT, bCreateNewline, sal_True);
759 : :
760 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
761 [ # # ]: 0 : ImpExportEvents( xShape );
762 [ # # ]: 0 : ImpExportGluePoints( xShape );
763 [ # # ][ # # ]: 0 : ImpExportText( xShape );
764 : 0 : }
765 : 0 : }
766 : :
767 : : //////////////////////////////////////////////////////////////////////////////
768 : :
769 : 0 : void XMLShapeExport::ImpExportLineShape(
770 : : const uno::Reference< drawing::XShape >& xShape,
771 : : XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
772 : : {
773 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
774 [ # # ]: 0 : if(xPropSet.is())
775 : : {
776 : 0 : OUString aStr;
777 : 0 : OUStringBuffer sStringBuffer;
778 : 0 : awt::Point aStart(0,0);
779 : 0 : awt::Point aEnd(1,1);
780 : :
781 : : // #85920# use 'Geometry' to get the points of the line
782 : : // since this slot take anchor pos into account.
783 : :
784 : : // get matrix
785 [ # # ]: 0 : ::basegfx::B2DHomMatrix aMatrix;
786 [ # # ]: 0 : ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
787 : :
788 : : // decompose and correct about pRefPoint
789 : 0 : ::basegfx::B2DTuple aTRScale;
790 : 0 : double fTRShear(0.0);
791 : 0 : double fTRRotate(0.0);
792 : 0 : ::basegfx::B2DTuple aTRTranslate;
793 [ # # ]: 0 : ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
794 : :
795 : : // create base position
796 : 0 : awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
797 : :
798 : : // get the two points
799 [ # # ][ # # ]: 0 : uno::Any aAny(xPropSet->getPropertyValue(OUString("Geometry")));
800 : 0 : drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
801 : :
802 [ # # ]: 0 : if(pSourcePolyPolygon)
803 : : {
804 [ # # ]: 0 : drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
805 [ # # ]: 0 : if(pOuterSequence)
806 : : {
807 : 0 : drawing::PointSequence* pInnerSequence = pOuterSequence++;
808 [ # # ]: 0 : if(pInnerSequence)
809 : : {
810 [ # # ]: 0 : awt::Point* pArray = pInnerSequence->getArray();
811 [ # # ]: 0 : if(pArray)
812 : : {
813 [ # # ]: 0 : if(pInnerSequence->getLength() > 0)
814 : : {
815 : : aStart = awt::Point(
816 : : pArray->X + aBasePosition.X,
817 : 0 : pArray->Y + aBasePosition.Y);
818 : 0 : pArray++;
819 : : }
820 : :
821 [ # # ]: 0 : if(pInnerSequence->getLength() > 1)
822 : : {
823 : : aEnd = awt::Point(
824 : : pArray->X + aBasePosition.X,
825 : 0 : pArray->Y + aBasePosition.Y);
826 : : }
827 : : }
828 : : }
829 : : }
830 : : }
831 : :
832 [ # # ]: 0 : if( nFeatures & SEF_EXPORT_X )
833 : : {
834 : : // svg: x1
835 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
836 [ # # ]: 0 : aStart.X);
837 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
838 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
839 : : }
840 : : else
841 : : {
842 : 0 : aEnd.X -= aStart.X;
843 : : }
844 : :
845 [ # # ]: 0 : if( nFeatures & SEF_EXPORT_Y )
846 : : {
847 : : // svg: y1
848 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
849 [ # # ]: 0 : aStart.Y);
850 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
851 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
852 : : }
853 : : else
854 : : {
855 : 0 : aEnd.Y -= aStart.Y;
856 : : }
857 : :
858 : : // svg: x2
859 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
860 [ # # ]: 0 : aEnd.X);
861 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
862 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
863 : :
864 : : // svg: y2
865 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
866 [ # # ]: 0 : aEnd.Y);
867 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
868 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
869 : :
870 : : // write line
871 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
872 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, sal_True);
873 : :
874 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
875 [ # # ]: 0 : ImpExportEvents( xShape );
876 [ # # ]: 0 : ImpExportGluePoints( xShape );
877 [ # # ][ # # ]: 0 : ImpExportText( xShape );
[ # # ]
878 : 0 : }
879 : 0 : }
880 : :
881 : : //////////////////////////////////////////////////////////////////////////////
882 : :
883 : 0 : void XMLShapeExport::ImpExportEllipseShape(
884 : : const uno::Reference< drawing::XShape >& xShape,
885 : : XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
886 : : {
887 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
888 [ # # ]: 0 : if(xPropSet.is())
889 : : {
890 : : // get size to decide between Circle and Ellipse
891 [ # # ][ # # ]: 0 : awt::Size aSize = xShape->getSize();
892 : 0 : sal_Int32 nRx((aSize.Width + 1) / 2);
893 : 0 : sal_Int32 nRy((aSize.Height + 1) / 2);
894 : 0 : sal_Bool bCircle(nRx == nRy);
895 : :
896 : : // Transformation
897 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
898 : :
899 : 0 : drawing::CircleKind eKind = drawing::CircleKind_FULL;
900 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString("CircleKind") ) >>= eKind;
[ # # ]
901 [ # # ]: 0 : if( eKind != drawing::CircleKind_FULL )
902 : : {
903 : 0 : OUStringBuffer sStringBuffer;
904 : 0 : sal_Int32 nStartAngle = 0;
905 : 0 : sal_Int32 nEndAngle = 0;
906 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString("CircleStartAngle") ) >>= nStartAngle;
907 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString("CircleEndAngle") ) >>= nEndAngle;
908 : :
909 : 0 : const double dStartAngle = nStartAngle / 100.0;
910 : 0 : const double dEndAngle = nEndAngle / 100.0;
911 : :
912 : : // export circle kind
913 [ # # ]: 0 : SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eKind, aXML_CircleKind_EnumMap );
914 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
915 : :
916 : : // export start angle
917 [ # # ]: 0 : ::sax::Converter::convertDouble( sStringBuffer, dStartAngle );
918 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
919 : :
920 : : // export end angle
921 [ # # ]: 0 : ::sax::Converter::convertDouble( sStringBuffer, dEndAngle );
922 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
923 : : }
924 : :
925 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
926 : :
927 [ # # ]: 0 : if(bCircle)
928 : : {
929 : : // write circle
930 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True);
931 : :
932 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
933 [ # # ]: 0 : ImpExportEvents( xShape );
934 [ # # ]: 0 : ImpExportGluePoints( xShape );
935 [ # # ][ # # ]: 0 : ImpExportText( xShape );
936 : : }
937 : : else
938 : : {
939 : : // write ellipse
940 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True);
941 : :
942 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
943 [ # # ]: 0 : ImpExportEvents( xShape );
944 [ # # ]: 0 : ImpExportGluePoints( xShape );
945 [ # # ][ # # ]: 0 : ImpExportText( xShape );
946 : : }
947 : 0 : }
948 : 0 : }
949 : :
950 : : //////////////////////////////////////////////////////////////////////////////
951 : :
952 : 0 : void XMLShapeExport::ImpExportPolygonShape(
953 : : const uno::Reference< drawing::XShape >& xShape,
954 : : XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
955 : : {
956 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
957 [ # # ]: 0 : if(xPropSet.is())
958 : : {
959 : : sal_Bool bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape
960 [ # # ][ # # ]: 0 : || eShapeType == XmlShapeTypeDrawClosedBezierShape);
961 : : sal_Bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
962 [ # # ][ # # ]: 0 : || eShapeType == XmlShapeTypeDrawOpenBezierShape);
963 : :
964 : : // get matrix
965 [ # # ]: 0 : ::basegfx::B2DHomMatrix aMatrix;
966 [ # # ]: 0 : ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
967 : :
968 : : // decompose and correct abour pRefPoint
969 : 0 : ::basegfx::B2DTuple aTRScale;
970 : 0 : double fTRShear(0.0);
971 : 0 : double fTRRotate(0.0);
972 : 0 : ::basegfx::B2DTuple aTRTranslate;
973 [ # # ]: 0 : ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
974 : :
975 : : // use features and write
976 [ # # ]: 0 : ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
977 : :
978 : : // create and export ViewBox
979 : 0 : awt::Point aPoint(0, 0);
980 : 0 : awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
981 [ # # ]: 0 : SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
982 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
983 : :
984 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
985 : :
986 [ # # ]: 0 : if(bBezier)
987 : : {
988 : : // get PolygonBezier
989 [ # # ][ # # ]: 0 : uno::Any aAny( xPropSet->getPropertyValue(OUString("Geometry")) );
990 : : drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
991 : 0 : (drawing::PolyPolygonBezierCoords*)aAny.getValue();
992 : :
993 [ # # ][ # # ]: 0 : if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
[ # # ]
994 : : {
995 : 0 : sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
996 [ # # ]: 0 : drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
997 [ # # ]: 0 : drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
998 : :
999 [ # # ][ # # ]: 0 : if(pOuterSequence && pOuterFlags)
1000 : : {
1001 : : // prepare svx:d element export
1002 [ # # ]: 0 : SdXMLImExSvgDElement aSvgDElement(aViewBox, GetExport());
1003 : :
1004 [ # # ]: 0 : for(sal_Int32 a(0L); a < nOuterCnt; a++)
1005 : : {
1006 : 0 : drawing::PointSequence* pSequence = pOuterSequence++;
1007 : 0 : drawing::FlagSequence* pFlags = pOuterFlags++;
1008 : :
1009 [ # # ][ # # ]: 0 : if(pSequence && pFlags)
1010 : : {
1011 : : aSvgDElement.AddPolygon(pSequence, pFlags,
1012 [ # # ]: 0 : aPoint, aSize, bClosed);
1013 : : }
1014 : : }
1015 : :
1016 : : // write point array
1017 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
1018 : : }
1019 : :
1020 : : // write object now
1021 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
1022 : :
1023 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1024 [ # # ]: 0 : ImpExportEvents( xShape );
1025 [ # # ]: 0 : ImpExportGluePoints( xShape );
1026 [ # # ][ # # ]: 0 : ImpExportText( xShape );
1027 : 0 : }
1028 : : }
1029 : : else
1030 : : {
1031 : : // get non-bezier polygon
1032 [ # # ][ # # ]: 0 : uno::Any aAny( xPropSet->getPropertyValue(OUString("Geometry")) );
1033 : 0 : drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
1034 : :
1035 [ # # ][ # # ]: 0 : if(pSourcePolyPolygon && pSourcePolyPolygon->getLength())
[ # # ]
1036 : : {
1037 : 0 : sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength());
1038 : :
1039 [ # # ][ # # ]: 0 : if(1L == nOuterCnt && !bBezier)
1040 : : {
1041 : : // simple polygon shape, can be written as svg:points sequence
1042 [ # # ]: 0 : drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray();
1043 [ # # ]: 0 : if(pSequence)
1044 : : {
1045 : : SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize,
1046 : : // #96328#
1047 [ # # ]: 0 : bClosed);
1048 : :
1049 : : // write point array
1050 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString());
1051 : : }
1052 : :
1053 : : // write object now
1054 : : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
1055 [ # # ][ # # ]: 0 : bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True);
1056 : :
1057 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1058 [ # # ]: 0 : ImpExportEvents( xShape );
1059 [ # # ]: 0 : ImpExportGluePoints( xShape );
1060 [ # # ][ # # ]: 0 : ImpExportText( xShape );
1061 : : }
1062 : : else
1063 : : {
1064 : : // polypolygon or bezier, needs to be written as a svg:path sequence
1065 [ # # ]: 0 : drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
1066 [ # # ]: 0 : if(pOuterSequence)
1067 : : {
1068 : : // prepare svx:d element export
1069 [ # # ]: 0 : SdXMLImExSvgDElement aSvgDElement(aViewBox, GetExport());
1070 : :
1071 [ # # ]: 0 : for(sal_Int32 a(0L); a < nOuterCnt; a++)
1072 : : {
1073 : 0 : drawing::PointSequence* pSequence = pOuterSequence++;
1074 [ # # ]: 0 : if(pSequence)
1075 : : {
1076 : : aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
1077 [ # # ]: 0 : aSize, bClosed);
1078 : : }
1079 : : }
1080 : :
1081 : : // write point array
1082 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
1083 : : }
1084 : :
1085 : : // write object now
1086 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
1087 : :
1088 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1089 [ # # ]: 0 : ImpExportEvents( xShape );
1090 [ # # ]: 0 : ImpExportGluePoints( xShape );
1091 [ # # ][ # # ]: 0 : ImpExportText( xShape );
1092 : : }
1093 : 0 : }
1094 [ # # ]: 0 : }
1095 : 0 : }
1096 : 0 : }
1097 : :
1098 : : //////////////////////////////////////////////////////////////////////////////
1099 : :
1100 : 0 : void XMLShapeExport::ImpExportGraphicObjectShape(
1101 : : const uno::Reference< drawing::XShape >& xShape,
1102 : : XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
1103 : : {
1104 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1105 [ # # ]: 0 : if(xPropSet.is())
1106 : : {
1107 : 0 : sal_Bool bIsEmptyPresObj = sal_False;
1108 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1109 : :
1110 : : // Transformation
1111 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1112 : :
1113 : 0 : OUString sImageURL;
1114 : :
1115 [ # # ]: 0 : if(eShapeType == XmlShapeTypePresGraphicObjectShape)
1116 [ # # ][ # # ]: 0 : bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) );
1117 : :
1118 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1119 : : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1120 [ # # ]: 0 : XML_FRAME, bCreateNewline, sal_True );
1121 : :
1122 : 0 : const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1123 : :
1124 [ # # ][ # # ]: 0 : if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
1125 : : {
1126 [ # # ]: 0 : if( !bIsEmptyPresObj )
1127 : : {
1128 : 0 : OUString aStreamURL;
1129 : 0 : OUString aStr;
1130 : :
1131 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString("GraphicStreamURL")) >>= aStreamURL;
1132 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString("GraphicURL")) >>= sImageURL;
1133 : :
1134 : 0 : OUString aResolveURL( sImageURL );
1135 : 0 : const rtl::OUString sPackageURL( "vnd.sun.star.Package:" );
1136 : :
1137 : : // sj: trying to preserve the filename
1138 [ # # ]: 0 : if ( aStreamURL.match( sPackageURL, 0 ) )
1139 : : {
1140 : 0 : rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
1141 : 0 : sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
1142 [ # # ][ # # ]: 0 : if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
[ # # ]
1143 : 0 : sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
1144 : 0 : nLastIndex = sRequestedName.lastIndexOf( '.' );
1145 [ # # ]: 0 : if ( nLastIndex >= 0 )
1146 : 0 : sRequestedName = sRequestedName.copy( 0, nLastIndex );
1147 [ # # ]: 0 : if ( !sRequestedName.isEmpty() )
1148 : : {
1149 : 0 : aResolveURL = aResolveURL.concat( OUString("?requestedName="));
1150 : 0 : aResolveURL = aResolveURL.concat( sRequestedName );
1151 : 0 : }
1152 : : }
1153 : :
1154 [ # # ]: 0 : aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
1155 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
1156 : :
1157 [ # # ]: 0 : if( !aStr.isEmpty() )
1158 : : {
1159 [ # # ]: 0 : if( aStr[ 0 ] == '#' )
1160 : : {
1161 : 0 : aStreamURL = OUString( "vnd.sun.star.Package:" );
1162 : 0 : aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
1163 : : }
1164 : :
1165 : : // update stream URL for load on demand
1166 : 0 : uno::Any aAny;
1167 [ # # ]: 0 : aAny <<= aStreamURL;
1168 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("GraphicStreamURL"), aAny );
1169 : :
1170 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1171 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1172 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1173 : 0 : }
1174 : : }
1175 : : else
1176 : : {
1177 : 0 : OUString aStr;
1178 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
1179 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1180 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1181 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1182 : : }
1183 : :
1184 : : {
1185 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True);
1186 : :
1187 [ # # ]: 0 : if( !sImageURL.isEmpty() )
1188 : : {
1189 : : // optional office:binary-data
1190 [ # # ]: 0 : mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
1191 : : }
1192 [ # # ]: 0 : if( !bIsEmptyPresObj )
1193 [ # # ][ # # ]: 0 : ImpExportText( xShape );
1194 : : }
1195 : : }
1196 : :
1197 [ # # ]: 0 : ImpExportEvents( xShape );
1198 [ # # ]: 0 : ImpExportGluePoints( xShape );
1199 : :
1200 : : // image map
1201 [ # # ][ # # ]: 0 : GetExport().GetImageMapExport().Export( xPropSet );
1202 [ # # ][ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1203 : 0 : }
1204 : 0 : }
1205 : :
1206 : : //////////////////////////////////////////////////////////////////////////////
1207 : :
1208 : 0 : void XMLShapeExport::ImpExportChartShape(
1209 : : const uno::Reference< drawing::XShape >& xShape,
1210 : : XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint,
1211 : : SvXMLAttributeList* pAttrList )
1212 : : {
1213 : 0 : ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
1214 : 0 : }
1215 : :
1216 : : //////////////////////////////////////////////////////////////////////////////
1217 : :
1218 : 0 : void XMLShapeExport::ImpExportControlShape(
1219 : : const uno::Reference< drawing::XShape >& xShape,
1220 : : XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
1221 : : {
1222 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1223 [ # # ]: 0 : if(xPropSet.is())
1224 : : {
1225 : : // Transformation
1226 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1227 : : }
1228 : :
1229 [ # # ]: 0 : uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
1230 : : DBG_ASSERT( xControl.is(), "Control shape is not supporting XControlShape" );
1231 [ # # ]: 0 : if( xControl.is() )
1232 : : {
1233 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
[ # # ]
1234 : : DBG_ASSERT( xControlModel.is(), "Control shape has not XControlModel" );
1235 [ # # ]: 0 : if( xControlModel.is() )
1236 : : {
1237 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) );
[ # # ][ # # ]
[ # # ]
1238 : 0 : }
1239 : : }
1240 : :
1241 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1242 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, sal_True);
1243 : :
1244 [ # # ][ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1245 : 0 : }
1246 : :
1247 : : //////////////////////////////////////////////////////////////////////////////
1248 : :
1249 : 0 : void XMLShapeExport::ImpExportConnectorShape(
1250 : : const uno::Reference< drawing::XShape >& xShape,
1251 : : XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1252 : : {
1253 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
1254 : :
1255 : 0 : OUString aStr;
1256 : 0 : OUStringBuffer sStringBuffer;
1257 : :
1258 : : // export connection kind
1259 : 0 : drawing::ConnectorType eType = drawing::ConnectorType_STANDARD;
1260 [ # # ][ # # ]: 0 : uno::Any aAny = xProps->getPropertyValue(OUString("EdgeKind"));
1261 [ # # ]: 0 : aAny >>= eType;
1262 : :
1263 [ # # ]: 0 : if( eType != drawing::ConnectorType_STANDARD )
1264 : : {
1265 [ # # ]: 0 : SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eType, aXML_ConnectionKind_EnumMap );
1266 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1267 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TYPE, aStr);
1268 : : }
1269 : :
1270 : : // export line skew
1271 : 0 : sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
1272 : :
1273 [ # # ][ # # ]: 0 : aAny = xProps->getPropertyValue(OUString("EdgeLine1Delta"));
1274 : 0 : aAny >>= nDelta1;
1275 [ # # ][ # # ]: 0 : aAny = xProps->getPropertyValue(OUString("EdgeLine2Delta"));
1276 : 0 : aAny >>= nDelta2;
1277 [ # # ][ # # ]: 0 : aAny = xProps->getPropertyValue(OUString("EdgeLine3Delta"));
1278 : 0 : aAny >>= nDelta3;
1279 : :
1280 [ # # ][ # # ]: 0 : if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
[ # # ]
1281 : : {
1282 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1283 [ # # ]: 0 : nDelta1);
1284 [ # # ][ # # ]: 0 : if( nDelta2 != 0 || nDelta3 != 0 )
1285 : : {
1286 : 0 : const char aSpace = ' ';
1287 [ # # ]: 0 : sStringBuffer.appendAscii( &aSpace, 1 );
1288 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1289 [ # # ]: 0 : nDelta2);
1290 [ # # ]: 0 : if( nDelta3 != 0 )
1291 : : {
1292 [ # # ]: 0 : sStringBuffer.appendAscii( &aSpace, 1 );
1293 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(
1294 [ # # ]: 0 : sStringBuffer, nDelta3);
1295 : : }
1296 : : }
1297 : :
1298 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1299 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LINE_SKEW, aStr);
1300 : : }
1301 : :
1302 : : // export start and end point
1303 : 0 : awt::Point aStart(0,0);
1304 : 0 : awt::Point aEnd(1,1);
1305 : :
1306 : : /* Get <StartPositionInHoriL2R> and
1307 : : <EndPositionInHoriL2R>, if they exist and if the document is exported
1308 : : into the OpenOffice.org file format.
1309 : : These properties only exist at service com::sun::star::text::Shape - the
1310 : : Writer UNO service for shapes.
1311 : : This code is needed, because the positioning attributes in the
1312 : : OpenOffice.org file format are given in horizontal left-to-right layout
1313 : : regardless the layout direction the shape is in. In the OASIS Open Office
1314 : : file format the positioning attributes are correctly given in the layout
1315 : : direction the shape is in. Thus, this code provides the conversion from
1316 : : the OASIS Open Office file format to the OpenOffice.org file format. (#i36248#)
1317 : : */
1318 [ # # ][ # # ]: 0 : if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
[ # # ][ # # ]
1319 [ # # ][ # # ]: 0 : xProps->getPropertySetInfo()->hasPropertyByName(
[ # # ][ # # ]
[ # # ]
1320 [ # # ][ # # ]: 0 : OUString("StartPositionInHoriL2R")) &&
[ # # ]
[ # # # # ]
1321 [ # # ][ # # ]: 0 : xProps->getPropertySetInfo()->hasPropertyByName(
[ # # ][ # # ]
[ # # ]
1322 [ # # ][ # # ]: 0 : OUString("EndPositionInHoriL2R")) )
[ # # ]
[ # # # # ]
1323 : : {
1324 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("StartPositionInHoriL2R")) >>= aStart;
[ # # ]
1325 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("EndPositionInHoriL2R")) >>= aEnd;
[ # # ]
1326 : : }
1327 : : else
1328 : : {
1329 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("StartPosition")) >>= aStart;
[ # # ]
1330 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("EndPosition")) >>= aEnd;
[ # # ]
1331 : : }
1332 : :
1333 [ # # ]: 0 : if( pRefPoint )
1334 : : {
1335 : 0 : aStart.X -= pRefPoint->X;
1336 : 0 : aStart.Y -= pRefPoint->Y;
1337 : 0 : aEnd.X -= pRefPoint->X;
1338 : 0 : aEnd.Y -= pRefPoint->Y;
1339 : : }
1340 : :
1341 [ # # ]: 0 : if( nFeatures & SEF_EXPORT_X )
1342 : : {
1343 : : // svg: x1
1344 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1345 [ # # ]: 0 : aStart.X);
1346 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1347 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
1348 : : }
1349 : : else
1350 : : {
1351 : 0 : aEnd.X -= aStart.X;
1352 : : }
1353 : :
1354 [ # # ]: 0 : if( nFeatures & SEF_EXPORT_Y )
1355 : : {
1356 : : // svg: y1
1357 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1358 [ # # ]: 0 : aStart.Y);
1359 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1360 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
1361 : : }
1362 : : else
1363 : : {
1364 : 0 : aEnd.Y -= aStart.Y;
1365 : : }
1366 : :
1367 : : // svg: x2
1368 [ # # ]: 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.X);
1369 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1370 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
1371 : :
1372 : : // svg: y2
1373 [ # # ]: 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.Y);
1374 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1375 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
1376 : :
1377 : : // #i39320#
1378 : 0 : uno::Reference< uno::XInterface > xRefS;
1379 : 0 : uno::Reference< uno::XInterface > xRefE;
1380 : :
1381 : : // export start connection
1382 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("StartShape" ) ) >>= xRefS;
[ # # ]
1383 [ # # ]: 0 : if( xRefS.is() )
1384 : : {
1385 [ # # ][ # # ]: 0 : const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS );
1386 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_SHAPE, rShapeId);
1387 : :
1388 [ # # ][ # # ]: 0 : aAny = xProps->getPropertyValue(OUString("StartGluePointIndex") );
1389 : 0 : sal_Int32 nGluePointId = 0;
1390 [ # # ]: 0 : if( aAny >>= nGluePointId )
1391 : : {
1392 [ # # ]: 0 : if( nGluePointId != -1 )
1393 : : {
1394 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::valueOf( nGluePointId ));
1395 : : }
1396 : : }
1397 : : }
1398 : :
1399 : : // export end connection
1400 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("EndShape") ) >>= xRefE;
[ # # ]
1401 [ # # ]: 0 : if( xRefE.is() )
1402 : : {
1403 [ # # ][ # # ]: 0 : const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE );
1404 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_SHAPE, rShapeId);
1405 : :
1406 [ # # ][ # # ]: 0 : aAny = xProps->getPropertyValue(OUString("EndGluePointIndex") );
1407 : 0 : sal_Int32 nGluePointId = 0;
1408 [ # # ]: 0 : if( aAny >>= nGluePointId )
1409 : : {
1410 [ # # ]: 0 : if( nGluePointId != -1 )
1411 : : {
1412 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::valueOf( nGluePointId ));
1413 : : }
1414 : : }
1415 : : }
1416 : :
1417 [ # # ][ # # ]: 0 : if( xProps->getPropertyValue( OUString( "PolyPolygonBezier" ) ) >>= aAny )
[ # # ]
1418 : : {
1419 : : // get PolygonBezier
1420 : : drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
1421 : 0 : (drawing::PolyPolygonBezierCoords*)aAny.getValue();
1422 : :
1423 [ # # ][ # # ]: 0 : if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
[ # # ]
1424 : : {
1425 : 0 : sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
1426 [ # # ]: 0 : drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
1427 [ # # ]: 0 : drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
1428 : :
1429 [ # # ][ # # ]: 0 : if(pOuterSequence && pOuterFlags)
1430 : : {
1431 : : // prepare svx:d element export
1432 : 0 : awt::Point aPoint( 0, 0 );
1433 : 0 : awt::Size aSize( 1, 1 );
1434 [ # # ]: 0 : SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
1435 [ # # ]: 0 : SdXMLImExSvgDElement aSvgDElement(aViewBox, GetExport());
1436 : :
1437 [ # # ]: 0 : for(sal_Int32 a(0L); a < nOuterCnt; a++)
1438 : : {
1439 : 0 : drawing::PointSequence* pSequence = pOuterSequence++;
1440 : 0 : drawing::FlagSequence* pFlags = pOuterFlags++;
1441 : :
1442 [ # # ][ # # ]: 0 : if(pSequence && pFlags)
1443 : : {
1444 : : aSvgDElement.AddPolygon(pSequence, pFlags,
1445 [ # # ]: 0 : aPoint, aSize, sal_False );
1446 : : }
1447 : : }
1448 : :
1449 : : // write point array
1450 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
1451 : : }
1452 : : }
1453 : : }
1454 : :
1455 : : // write connector shape. Add Export later.
1456 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1457 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, sal_True);
1458 : :
1459 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1460 [ # # ]: 0 : ImpExportEvents( xShape );
1461 [ # # ]: 0 : ImpExportGluePoints( xShape );
1462 [ # # ][ # # ]: 0 : ImpExportText( xShape );
1463 : 0 : }
1464 : :
1465 : : //////////////////////////////////////////////////////////////////////////////
1466 : :
1467 : 0 : void XMLShapeExport::ImpExportMeasureShape(
1468 : : const uno::Reference< drawing::XShape >& xShape,
1469 : : XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1470 : : {
1471 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
1472 : :
1473 : 0 : OUString aStr;
1474 : 0 : OUStringBuffer sStringBuffer;
1475 : :
1476 : : // export start and end point
1477 : 0 : awt::Point aStart(0,0);
1478 : 0 : awt::Point aEnd(1,1);
1479 : :
1480 : : /* Get <StartPositionInHoriL2R> and
1481 : : <EndPositionInHoriL2R>, if they exist and if the document is exported
1482 : : into the OpenOffice.org file format.
1483 : : These properties only exist at service com::sun::star::text::Shape - the
1484 : : Writer UNO service for shapes.
1485 : : This code is needed, because the positioning attributes in the
1486 : : OpenOffice.org file format are given in horizontal left-to-right layout
1487 : : regardless the layout direction the shape is in. In the OASIS Open Office
1488 : : file format the positioning attributes are correctly given in the layout
1489 : : direction the shape is in. Thus, this code provides the conversion from
1490 : : the OASIS Open Office file format to the OpenOffice.org file format. (#i36248#)
1491 : : */
1492 [ # # ][ # # ]: 0 : if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
[ # # ][ # # ]
1493 [ # # ][ # # ]: 0 : xProps->getPropertySetInfo()->hasPropertyByName(
[ # # ][ # # ]
[ # # ]
1494 [ # # ][ # # ]: 0 : OUString("StartPositionInHoriL2R")) &&
[ # # ]
[ # # # # ]
1495 [ # # ][ # # ]: 0 : xProps->getPropertySetInfo()->hasPropertyByName(
[ # # ][ # # ]
[ # # ]
1496 [ # # ][ # # ]: 0 : OUString("EndPositionInHoriL2R")) )
[ # # ]
[ # # # # ]
1497 : : {
1498 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("StartPositionInHoriL2R")) >>= aStart;
[ # # ]
1499 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("EndPositionInHoriL2R")) >>= aEnd;
[ # # ]
1500 : : }
1501 : : else
1502 : : {
1503 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("StartPosition")) >>= aStart;
[ # # ]
1504 [ # # ][ # # ]: 0 : xProps->getPropertyValue(OUString("EndPosition")) >>= aEnd;
[ # # ]
1505 : : }
1506 : :
1507 [ # # ]: 0 : if( pRefPoint )
1508 : : {
1509 : 0 : aStart.X -= pRefPoint->X;
1510 : 0 : aStart.Y -= pRefPoint->Y;
1511 : 0 : aEnd.X -= pRefPoint->X;
1512 : 0 : aEnd.Y -= pRefPoint->Y;
1513 : : }
1514 : :
1515 [ # # ]: 0 : if( nFeatures & SEF_EXPORT_X )
1516 : : {
1517 : : // svg: x1
1518 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1519 [ # # ]: 0 : aStart.X);
1520 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1521 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
1522 : : }
1523 : : else
1524 : : {
1525 : 0 : aEnd.X -= aStart.X;
1526 : : }
1527 : :
1528 [ # # ]: 0 : if( nFeatures & SEF_EXPORT_Y )
1529 : : {
1530 : : // svg: y1
1531 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1532 [ # # ]: 0 : aStart.Y);
1533 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1534 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
1535 : : }
1536 : : else
1537 : : {
1538 : 0 : aEnd.Y -= aStart.Y;
1539 : : }
1540 : :
1541 : : // svg: x2
1542 [ # # ]: 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.X);
1543 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1544 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
1545 : :
1546 : : // svg: y2
1547 [ # # ]: 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.Y);
1548 [ # # ]: 0 : aStr = sStringBuffer.makeStringAndClear();
1549 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
1550 : :
1551 : : // write measure shape
1552 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1553 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, sal_True);
1554 : :
1555 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1556 [ # # ]: 0 : ImpExportEvents( xShape );
1557 [ # # ]: 0 : ImpExportGluePoints( xShape );
1558 : :
1559 [ # # ]: 0 : uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1560 [ # # ]: 0 : if( xText.is() )
1561 [ # # ][ # # ]: 0 : mrExport.GetTextParagraphExport()->exportText( xText );
[ # # ][ # # ]
[ # # ]
1562 : 0 : }
1563 : :
1564 : : //////////////////////////////////////////////////////////////////////////////
1565 : :
1566 : 0 : void XMLShapeExport::ImpExportOLE2Shape(
1567 : : const uno::Reference< drawing::XShape >& xShape,
1568 : : XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */,
1569 : : SvXMLAttributeList* pAttrList /* = NULL */ )
1570 : : {
1571 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1572 [ # # ]: 0 : uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
1573 : :
1574 : : DBG_ASSERT( xPropSet.is() && xNamed.is(), "ole shape is not implementing needed interfaces");
1575 [ # # ][ # # ]: 0 : if(xPropSet.is() && xNamed.is())
[ # # ]
1576 : : {
1577 : : // Transformation
1578 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1579 : :
1580 : 0 : sal_Bool bIsEmptyPresObj = sal_False;
1581 : :
1582 : : // presentation settings
1583 [ # # ]: 0 : if(eShapeType == XmlShapeTypePresOLE2Shape)
1584 [ # # ][ # # ]: 0 : bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
1585 [ # # ]: 0 : else if(eShapeType == XmlShapeTypePresChartShape)
1586 [ # # ][ # # ]: 0 : bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
1587 [ # # ]: 0 : else if(eShapeType == XmlShapeTypePresSheetShape)
1588 [ # # ][ # # ]: 0 : bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
1589 : :
1590 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1591 : 0 : sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
1592 : 0 : OUString sPersistName;
1593 : : SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1594 [ # # ]: 0 : XML_FRAME, bCreateNewline, sal_True );
1595 : :
1596 : 0 : const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1597 : :
1598 [ # # ][ # # ]: 0 : if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
1599 : : {
1600 [ # # ]: 0 : if (pAttrList)
1601 : : {
1602 [ # # ][ # # ]: 0 : mrExport.AddAttributeList(pAttrList);
[ # # ]
1603 : : }
1604 : :
1605 : 0 : OUString sClassId;
1606 : 0 : OUString sURL;
1607 : 0 : sal_Bool bInternal = false;
1608 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue(OUString("IsInternal")) >>= bInternal;
1609 : :
1610 [ # # ]: 0 : if( !bIsEmptyPresObj )
1611 : : {
1612 : :
1613 [ # # ]: 0 : if ( bInternal )
1614 : : {
1615 : : // OOo internal links have no storage persistance, URL is stored in the XML file
1616 : : // the result LinkURL is empty in case the object is not a link
1617 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "LinkURL" ) ) >>= sURL;
1618 : : }
1619 : :
1620 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "PersistName" ) ) >>= sPersistName;
1621 [ # # ]: 0 : if ( sURL.isEmpty() )
1622 : : {
1623 [ # # ]: 0 : if( !sPersistName.isEmpty() )
1624 : : {
1625 : 0 : sURL = OUString( "vnd.sun.star.EmbeddedObject:" );
1626 : 0 : sURL += sPersistName;
1627 : : }
1628 : : }
1629 : :
1630 [ # # ]: 0 : if( !bInternal )
1631 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue(OUString("CLSID")) >>= sClassId;
1632 : :
1633 [ # # ]: 0 : if( !sClassId.isEmpty() )
1634 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
1635 [ # # ]: 0 : if(!bExportEmbedded)
1636 : : {
1637 : : // xlink:href
1638 [ # # ]: 0 : if( !sURL.isEmpty() )
1639 : : {
1640 : : // #96717# in theorie, if we don't have a url we shouldn't even
1641 : : // export this ole shape. But practical its to risky right now
1642 : : // to change this so we better dispose this on load
1643 [ # # ]: 0 : sURL = mrExport.AddEmbeddedObject( sURL );
1644 : :
1645 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1646 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1647 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1648 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1649 : : }
1650 : : }
1651 : : }
1652 : : else
1653 : : {
1654 : : // export empty href for empty placeholders to be valid odf
1655 : 0 : OUString sEmptyURL;
1656 : :
1657 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sEmptyURL );
1658 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1659 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1660 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1661 : : }
1662 : :
1663 [ # # ]: 0 : enum XMLTokenEnum eElem = sClassId.isEmpty() ? XML_OBJECT : XML_OBJECT_OLE ;
1664 [ # # ]: 0 : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True );
1665 : :
1666 [ # # ][ # # ]: 0 : if(bExportEmbedded && !bIsEmptyPresObj)
1667 : : {
1668 : : // #100592#
1669 [ # # ]: 0 : if(bInternal)
1670 : : {
1671 : : // embedded XML
1672 : 0 : uno::Reference< lang::XComponent > xComp;
1673 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString("Model" ) ) >>= xComp;
[ # # ]
1674 : : DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
1675 [ # # ]: 0 : mrExport.ExportEmbeddedOwnObject( xComp );
1676 : : }
1677 : : else
1678 : : {
1679 : : // embed as Base64
1680 : : // this is an alien object ( currently MSOLE is the only supported type of such objects )
1681 : : // in case it is not an OASIS format the object should be asked to store replacement image if possible
1682 : :
1683 : 0 : ::rtl::OUString sURLRequest( sURL );
1684 [ # # ]: 0 : if ( ( mrExport.getExportFlags() & EXPORT_OASIS ) == 0 )
1685 : 0 : sURLRequest += ::rtl::OUString( "?oasis=false" );
1686 [ # # ]: 0 : mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
1687 : : }
1688 [ # # ]: 0 : }
1689 : : }
1690 [ # # ]: 0 : if( !bIsEmptyPresObj )
1691 : : {
1692 : 0 : OUString sURL( "vnd.sun.star.GraphicObject:" );
1693 : 0 : sURL += sPersistName;
1694 [ # # ]: 0 : if( !bExportEmbedded )
1695 : : {
1696 [ # # ]: 0 : sURL = GetExport().AddEmbeddedObject( sURL );
1697 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1698 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1699 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1700 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1701 : : }
1702 : :
1703 : 0 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
1704 [ # # ]: 0 : XML_IMAGE, sal_False, sal_True );
1705 : :
1706 [ # # ]: 0 : if( bExportEmbedded )
1707 [ # # ][ # # ]: 0 : GetExport().AddEmbeddedObjectAsBase64( sURL );
1708 : : }
1709 : :
1710 [ # # ]: 0 : ImpExportEvents( xShape );
1711 [ # # ]: 0 : ImpExportGluePoints( xShape );
1712 [ # # ][ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1713 : 0 : }
1714 : 0 : }
1715 : :
1716 : : //////////////////////////////////////////////////////////////////////////////
1717 : :
1718 : 32 : void XMLShapeExport::ImpExportPageShape(
1719 : : const uno::Reference< drawing::XShape >& xShape,
1720 : : XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1721 : : {
1722 [ + - ]: 32 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1723 [ + - ]: 32 : if(xPropSet.is())
1724 : : {
1725 : : // #86163# Transformation
1726 [ + - ]: 32 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1727 : :
1728 : : // export page number used for this page
1729 [ + - ][ + - ]: 32 : uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1730 : 32 : const OUString aPageNumberStr("PageNumber");
1731 [ + - ][ + - ]: 32 : if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
[ + + ][ + + ]
[ + - ]
1732 : : {
1733 : 28 : sal_Int32 nPageNumber = 0;
1734 [ + - ][ + - ]: 28 : xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
1735 [ + + ]: 28 : if( nPageNumber )
1736 [ + - ]: 28 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::valueOf(nPageNumber));
1737 : : }
1738 : :
1739 : : // a presentation page shape, normally used on notes pages only. If
1740 : : // it is used not as presentation shape, it may have been created with
1741 : : // copy-paste exchange between draw and impress (this IS possible...)
1742 [ + + ]: 32 : if(eShapeType == XmlShapeTypePresPageShape)
1743 : : {
1744 : : mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS,
1745 [ + - ]: 8 : XML_PRESENTATION_PAGE);
1746 : : }
1747 : :
1748 : : // write Page shape
1749 : 32 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1750 [ + - ][ + - ]: 32 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, bCreateNewline, sal_True);
1751 : 32 : }
1752 : 32 : }
1753 : :
1754 : : //////////////////////////////////////////////////////////////////////////////
1755 : :
1756 : 0 : void XMLShapeExport::ImpExportCaptionShape(
1757 : : const uno::Reference< drawing::XShape >& xShape,
1758 : : XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1759 : : {
1760 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1761 [ # # ]: 0 : if(xPropSet.is())
1762 : : {
1763 : : // Transformation
1764 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1765 : :
1766 : : // evtl. corner radius?
1767 : 0 : sal_Int32 nCornerRadius(0L);
1768 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue(OUString("CornerRadius")) >>= nCornerRadius;
1769 [ # # ]: 0 : if(nCornerRadius)
1770 : : {
1771 : 0 : OUStringBuffer sStringBuffer;
1772 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1773 [ # # ]: 0 : nCornerRadius);
1774 [ # # ][ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
1775 : : }
1776 : :
1777 : 0 : awt::Point aCaptionPoint;
1778 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "CaptionPoint" ) ) >>= aCaptionPoint;
[ # # ]
1779 : :
1780 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
1781 [ # # ]: 0 : aCaptionPoint.X);
1782 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
1783 : 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
1784 [ # # ]: 0 : aCaptionPoint.Y);
1785 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
1786 : :
1787 : : // write Caption shape. Add export later.
1788 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1789 : 0 : sal_Bool bAnnotation( (nFeatures & SEF_EXPORT_ANNOTATION) == SEF_EXPORT_ANNOTATION );
1790 : :
1791 : : SvXMLElementExport aObj( mrExport,
1792 : : (bAnnotation ? XML_NAMESPACE_OFFICE
1793 : : : XML_NAMESPACE_DRAW),
1794 : : (bAnnotation ? XML_ANNOTATION : XML_CAPTION),
1795 [ # # ][ # # ]: 0 : bCreateNewline, sal_True );
[ # # ]
1796 : :
1797 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1798 [ # # ]: 0 : ImpExportEvents( xShape );
1799 [ # # ]: 0 : ImpExportGluePoints( xShape );
1800 [ # # ]: 0 : if( bAnnotation )
1801 [ # # ]: 0 : mrExport.exportAnnotationMeta( xShape );
1802 [ # # ][ # # ]: 0 : ImpExportText( xShape );
1803 : 0 : }
1804 : 0 : }
1805 : :
1806 : : //////////////////////////////////////////////////////////////////////////////
1807 : :
1808 : 0 : void XMLShapeExport::ImpExportFrameShape(
1809 : : const uno::Reference< drawing::XShape >& xShape,
1810 : : XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1811 : : {
1812 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1813 [ # # ]: 0 : if(xPropSet.is())
1814 : : {
1815 : : // Transformation
1816 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1817 : :
1818 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1819 : : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1820 [ # # ]: 0 : XML_FRAME, bCreateNewline, sal_True );
1821 : :
1822 : : // export frame url
1823 : 0 : OUString aStr;
1824 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "FrameURL" ) ) >>= aStr;
1825 [ # # ][ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1826 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1827 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1828 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1829 : :
1830 : : // export name
1831 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "FrameName" ) ) >>= aStr;
1832 [ # # ]: 0 : if( !aStr.isEmpty() )
1833 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
1834 : :
1835 : : // write floating frame
1836 : : {
1837 [ # # ][ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, sal_True, sal_True);
1838 [ # # ]: 0 : }
1839 : 0 : }
1840 : 0 : }
1841 : :
1842 : : //////////////////////////////////////////////////////////////////////////////
1843 : :
1844 : 0 : void XMLShapeExport::ImpExportAppletShape(
1845 : : const uno::Reference< drawing::XShape >& xShape,
1846 : : XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1847 : : {
1848 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1849 [ # # ]: 0 : if(xPropSet.is())
1850 : : {
1851 : : // Transformation
1852 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1853 : :
1854 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1855 : : SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1856 [ # # ]: 0 : XML_FRAME, bCreateNewline, sal_True );
1857 : :
1858 : : // export frame url
1859 : 0 : OUString aStr;
1860 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "AppletCodeBase" ) ) >>= aStr;
1861 [ # # ][ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1862 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1863 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1864 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1865 : :
1866 : : // export draw:applet-name
1867 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "AppletName" ) ) >>= aStr;
1868 [ # # ]: 0 : if( !aStr.isEmpty() )
1869 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
1870 : :
1871 : : // export draw:code
1872 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "AppletCode" ) ) >>= aStr;
1873 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
1874 : :
1875 : : // export draw:may-script
1876 : 0 : sal_Bool bIsScript = false;
1877 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "AppletIsScript" ) ) >>= bIsScript;
1878 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
1879 : :
1880 : : {
1881 : : // write applet
1882 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, sal_True, sal_True);
1883 : :
1884 : : // export parameters
1885 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aCommands;
1886 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "AppletCommands" ) ) >>= aCommands;
[ # # ]
1887 : 0 : const sal_Int32 nCount = aCommands.getLength();
1888 [ # # ]: 0 : for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1889 : : {
1890 [ # # ]: 0 : aCommands[nIndex].Value >>= aStr;
1891 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
1892 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
1893 [ # # ]: 0 : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
1894 [ # # ][ # # ]: 0 : }
[ # # ]
1895 [ # # ]: 0 : }
1896 : 0 : }
1897 : 0 : }
1898 : :
1899 : : //////////////////////////////////////////////////////////////////////////////
1900 : :
1901 : 0 : void XMLShapeExport::ImpExportPluginShape(
1902 : : const uno::Reference< drawing::XShape >& xShape,
1903 : : XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1904 : : {
1905 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1906 [ # # ]: 0 : if(xPropSet.is())
1907 : : {
1908 : : // Transformation
1909 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1910 : :
1911 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1912 : : SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1913 [ # # ]: 0 : XML_FRAME, bCreateNewline, sal_True );
1914 : :
1915 : : // export plugin url
1916 : 0 : OUString aStr;
1917 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "PluginURL" ) ) >>= aStr;
1918 [ # # ][ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1919 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1920 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1921 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1922 : :
1923 : :
1924 : : // export mime-type
1925 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "PluginMimeType" ) ) >>= aStr;
1926 [ # # ]: 0 : if(!aStr.isEmpty())
1927 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
1928 : :
1929 : : {
1930 : : // write plugin
1931 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, sal_True, sal_True);
1932 : :
1933 : : // export parameters
1934 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aCommands;
1935 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "PluginCommands" ) ) >>= aCommands;
[ # # ]
1936 : 0 : const sal_Int32 nCount = aCommands.getLength();
1937 [ # # ]: 0 : for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1938 : : {
1939 [ # # ]: 0 : aCommands[nIndex].Value >>= aStr;
1940 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
1941 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
1942 [ # # ]: 0 : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
1943 [ # # ][ # # ]: 0 : }
[ # # ]
1944 [ # # ]: 0 : }
1945 : 0 : }
1946 : 0 : }
1947 : :
1948 : : //////////////////////////////////////////////////////////////////////////////
1949 : :
1950 : 0 : static void lcl_CopyStream(
1951 : : uno::Reference<io::XInputStream> const& xInStream,
1952 : : uno::Reference<embed::XStorage> const& xTarget,
1953 : : ::rtl::OUString const& rPath)
1954 : : {
1955 [ # # ]: 0 : ::comphelper::LifecycleProxy proxy;
1956 : : uno::Reference<io::XStream> const xStream(
1957 : : ::comphelper::OStorageHelper::GetStreamAtPackageURL(xTarget, rPath,
1958 [ # # ]: 0 : embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, proxy));
1959 : : uno::Reference<io::XOutputStream> const xOutStream(
1960 [ # # ][ # # ]: 0 : (xStream.is()) ? xStream->getOutputStream() : 0);
[ # # ][ # # ]
1961 [ # # ]: 0 : if (!xOutStream.is())
1962 : : {
1963 : : SAL_WARN("xmloff", "no output stream");
1964 : : throw uno::Exception(
1965 [ # # ][ # # ]: 0 : ::rtl::OUString("no output stream"),0);
1966 : : }
1967 : : uno::Reference< beans::XPropertySet > const xStreamProps(xStream,
1968 [ # # ]: 0 : uno::UNO_QUERY);
1969 [ # # ]: 0 : if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage
1970 [ # # ]: 0 : xStreamProps->setPropertyValue(
1971 : : ::rtl::OUString("MediaType"),
1972 : : uno::makeAny(::rtl::OUString(
1973 : : //FIXME how to detect real media type?
1974 : : //but currently xmloff has this one hardcoded anyway...
1975 [ # # ][ # # ]: 0 : "application/vnd.sun.star.media")));
1976 [ # # ]: 0 : xStreamProps->setPropertyValue( // turn off compression
1977 : : ::rtl::OUString("Compressed"),
1978 [ # # ][ # # ]: 0 : uno::makeAny(sal_False));
1979 : : }
1980 [ # # ]: 0 : ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
1981 [ # # ][ # # ]: 0 : xOutStream->closeOutput();
1982 [ # # ][ # # ]: 0 : proxy.commitStorages();
1983 : 0 : }
1984 : :
1985 : : static char const s_PkgScheme[] = "vnd.sun.star.Package:";
1986 : :
1987 : : static ::rtl::OUString
1988 : 0 : lcl_StoreMediaAndGetURL(SvXMLExport & rExport,
1989 : : uno::Reference<beans::XPropertySet> const& xPropSet,
1990 : : ::rtl::OUString const& rURL)
1991 : : {
1992 [ # # ]: 0 : if (0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
1993 : : rURL.getStr(), rURL.getLength(),
1994 : 0 : s_PkgScheme, SAL_N_ELEMENTS(s_PkgScheme) - 1))
1995 : : {
1996 : : try // video is embedded
1997 : : {
1998 : : uno::Reference<embed::XStorage> const xTarget(
1999 [ # # ][ # # ]: 0 : rExport.GetTargetStorage(), uno::UNO_QUERY_THROW);
2000 : 0 : uno::Reference<io::XInputStream> xInStream;
2001 [ # # ]: 0 : xPropSet->getPropertyValue(
2002 : 0 : ::rtl::OUString("PrivateStream"))
2003 [ # # ][ # # ]: 0 : >>= xInStream;
2004 : :
2005 [ # # ]: 0 : if (!xInStream.is())
2006 : : {
2007 : : SAL_WARN("xmloff", "no input stream");
2008 : 0 : return ::rtl::OUString();
2009 : : }
2010 : :
2011 : : ::rtl::OUString const urlPath(
2012 : 0 : rURL.copy(SAL_N_ELEMENTS(s_PkgScheme)-1));
2013 : :
2014 [ # # ]: 0 : lcl_CopyStream(xInStream, xTarget, rURL);
2015 : :
2016 [ # # ]: 0 : return urlPath;
2017 : : }
2018 : 0 : catch (uno::Exception const& e)
2019 : : {
2020 : : SAL_INFO("xmloff", "exception while storing embedded media: '"
2021 : : << e.Message << "'");
2022 : : }
2023 : 0 : return ::rtl::OUString();
2024 : : }
2025 : : else
2026 : : {
2027 : 0 : return rExport.GetRelativeReference(rURL); // linked
2028 : : }
2029 : : }
2030 : :
2031 : 0 : void XMLShapeExport::ImpExportMediaShape(
2032 : : const uno::Reference< drawing::XShape >& xShape,
2033 : : XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
2034 : : {
2035 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2036 [ # # ]: 0 : if(xPropSet.is())
2037 : : {
2038 : : // Transformation
2039 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2040 : :
2041 [ # # ]: 0 : if(eShapeType == XmlShapeTypePresMediaShape)
2042 [ # # ][ # # ]: 0 : ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
2043 : :
2044 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
2045 : : SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
2046 [ # # ]: 0 : XML_FRAME, bCreateNewline, sal_True );
2047 : :
2048 : : // export media url
2049 : 0 : OUString aMediaURL;
2050 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "MediaURL" ) ) >>= aMediaURL;
2051 : : OUString const persistentURL =
2052 [ # # ]: 0 : lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL);
2053 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, persistentURL );
2054 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
2055 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
2056 [ # # ]: 0 : mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
2057 : :
2058 : : // export mime-type
2059 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, OUString( "application/vnd.sun.star.media" ) );
2060 : :
2061 : : // write plugin
2062 [ # # ]: 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), sal_True);
2063 : :
2064 : : // export parameters
2065 : 0 : const OUString aFalseStr( "false" ), aTrueStr( "true" );
2066 : :
2067 : 0 : sal_Bool bLoop = false;
2068 : 0 : const OUString aLoopStr( "Loop" );
2069 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
2070 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
2071 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
2072 [ # # ][ # # ]: 0 : delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
[ # # ][ # # ]
2073 : :
2074 : 0 : sal_Bool bMute = false;
2075 : 0 : const OUString aMuteStr( "Mute" );
2076 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
2077 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
2078 [ # # ][ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
2079 [ # # ][ # # ]: 0 : delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
[ # # ][ # # ]
2080 : :
2081 : 0 : sal_Int16 nVolumeDB = 0;
2082 : 0 : const OUString aVolumeDBStr( "VolumeDB" );
2083 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "VolumeDB" ) ) >>= nVolumeDB;
2084 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
2085 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::valueOf( static_cast< sal_Int32 >( nVolumeDB ) ) );
2086 [ # # ][ # # ]: 0 : delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
[ # # ][ # # ]
2087 : :
2088 : : media::ZoomLevel eZoom;
2089 : 0 : const OUString aZoomStr( "Zoom" );
2090 : 0 : OUString aZoomValue;
2091 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( OUString( "Zoom" ) ) >>= eZoom;
[ # # ]
2092 [ # # # # : 0 : switch( eZoom )
# # # #
# ]
2093 : : {
2094 : 0 : case( media::ZoomLevel_ZOOM_1_TO_4 ): aZoomValue = OUString( "25%" ); break;
2095 : 0 : case( media::ZoomLevel_ZOOM_1_TO_2 ): aZoomValue = OUString( "50%" ); break;
2096 : 0 : case( media::ZoomLevel_ORIGINAL ): aZoomValue = OUString( "100%" ); break;
2097 : 0 : case( media::ZoomLevel_ZOOM_2_TO_1 ): aZoomValue = OUString( "200%" ); break;
2098 : 0 : case( media::ZoomLevel_ZOOM_4_TO_1 ): aZoomValue = OUString( "400%" ); break;
2099 : 0 : case( media::ZoomLevel_FIT_TO_WINDOW ): aZoomValue = OUString( "fit" ); break;
2100 : 0 : case( media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): aZoomValue = OUString( "fixedfit" ); break;
2101 : 0 : case( media::ZoomLevel_FULLSCREEN ): aZoomValue = OUString( "fullscreen" ); break;
2102 : :
2103 : : default:
2104 : 0 : break;
2105 : : }
2106 : :
2107 [ # # ]: 0 : if( !aZoomValue.isEmpty() )
2108 : : {
2109 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
2110 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
2111 [ # # ][ # # ]: 0 : delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
[ # # ][ # # ]
2112 [ # # ][ # # ]: 0 : }
2113 : 0 : }
2114 : 0 : }
2115 : :
2116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|