LibreOffice Module xmloff (master) 1
shapeexport.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <config_wasm_strip.h>
21
31
32#include <com/sun/star/beans/XPropertyState.hpp>
33#include <com/sun/star/beans/PropertyValues.hpp>
34#include <com/sun/star/container/XChild.hpp>
35#include <com/sun/star/container/XEnumerationAccess.hpp>
36#include <com/sun/star/container/XIdentifierAccess.hpp>
37#include <com/sun/star/container/XNamed.hpp>
38#include <com/sun/star/document/XEventsSupplier.hpp>
39#include <com/sun/star/drawing/Alignment.hpp>
40#include <com/sun/star/drawing/CameraGeometry.hpp>
41#include <com/sun/star/drawing/CircleKind.hpp>
42#include <com/sun/star/drawing/ConnectorType.hpp>
43#include <com/sun/star/drawing/Direction3D.hpp>
44#include <com/sun/star/drawing/EscapeDirection.hpp>
45#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
46#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
47#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
48#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
49#include <com/sun/star/drawing/EnhancedCustomShapeMetalType.hpp>
50#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
51#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
52#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
53#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
54#include <com/sun/star/drawing/GluePoint2.hpp>
55#include <com/sun/star/drawing/HomogenMatrix.hpp>
56#include <com/sun/star/drawing/HomogenMatrix3.hpp>
57#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
58#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
59#include <com/sun/star/drawing/Position3D.hpp>
60#include <com/sun/star/drawing/ProjectionMode.hpp>
61#include <com/sun/star/drawing/ShadeMode.hpp>
62#include <com/sun/star/drawing/XControlShape.hpp>
63#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
64#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
65#include <com/sun/star/drawing/BarCode.hpp>
66#include <com/sun/star/drawing/BarCodeErrorCorrection.hpp>
67#include <com/sun/star/drawing/XShapes3.hpp>
68#include <com/sun/star/embed/ElementModes.hpp>
69#include <com/sun/star/embed/XStorage.hpp>
70#include <com/sun/star/embed/XTransactedObject.hpp>
71#include <com/sun/star/graphic/XGraphic.hpp>
72#include <com/sun/star/graphic/GraphicProvider.hpp>
73#include <com/sun/star/graphic/XGraphicProvider.hpp>
74#include <com/sun/star/io/XSeekableInputStream.hpp>
75#include <com/sun/star/io/XStream.hpp>
76#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
77#include <com/sun/star/lang/XMultiServiceFactory.hpp>
78#include <com/sun/star/media/ZoomLevel.hpp>
79#include <com/sun/star/presentation/AnimationSpeed.hpp>
80#include <com/sun/star/presentation/ClickAction.hpp>
81#include <com/sun/star/style/XStyle.hpp>
82#include <com/sun/star/table/XColumnRowRange.hpp>
83#include <com/sun/star/text/WritingMode2.hpp>
84#include <com/sun/star/text/XText.hpp>
85
90#include <officecfg/Office/Common.hxx>
91
92#include <o3tl/any.hxx>
94#include <o3tl/string_view.hxx>
95
96#include <rtl/math.hxx>
97#include <rtl/ustrbuf.hxx>
98#include <rtl/ustring.hxx>
99#include <sal/log.hxx>
100
102
103#include <tools/debug.hxx>
104#include <tools/globname.hxx>
105#include <tools/helpers.hxx>
107#include <vcl/graph.hxx>
108
109#include <xmloff/contextid.hxx>
110#include <xmloff/families.hxx>
112#include <xmloff/shapeexport.hxx>
114#include <xmloff/xmlexp.hxx>
116#include <xmloff/xmltoken.hxx>
117#include <xmloff/xmluconv.hxx>
120
121#include <anim.hxx>
123#include "sdpropls.hxx"
124#include <xexptran.hxx>
125#include "ximpshap.hxx"
126#include <XMLBase64Export.hxx>
127#include <XMLImageMapExport.hxx>
128#include <memory>
129
130using namespace ::com::sun::star;
131using namespace ::xmloff::EnhancedCustomShapeToken;
132using namespace ::xmloff::token;
133
134constexpr OUStringLiteral XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE = u"vnd.sun.star.GraphicObject:";
135
136namespace {
137
138bool supportsText(XmlShapeType eShapeType)
139{
140 return eShapeType != XmlShapeType::PresChartShape &&
141 eShapeType != XmlShapeType::PresOLE2Shape &&
142 eShapeType != XmlShapeType::DrawSheetShape &&
143 eShapeType != XmlShapeType::PresSheetShape &&
144 eShapeType != XmlShapeType::Draw3DSceneObject &&
145 eShapeType != XmlShapeType::Draw3DCubeObject &&
146 eShapeType != XmlShapeType::Draw3DSphereObject &&
147 eShapeType != XmlShapeType::Draw3DLatheObject &&
148 eShapeType != XmlShapeType::Draw3DExtrudeObject &&
149 eShapeType != XmlShapeType::DrawPageShape &&
150 eShapeType != XmlShapeType::PresPageShape &&
151 eShapeType != XmlShapeType::DrawGroupShape;
152
153}
154
155}
156
157constexpr OUStringLiteral gsZIndex( u"ZOrder" );
158constexpr OUStringLiteral gsPrintable( u"Printable" );
159constexpr OUStringLiteral gsVisible( u"Visible" );
160constexpr OUStringLiteral gsModel( u"Model" );
161constexpr OUStringLiteral gsStartShape( u"StartShape" );
162constexpr OUStringLiteral gsEndShape( u"EndShape" );
163constexpr OUStringLiteral gsOnClick( u"OnClick" );
164constexpr OUStringLiteral gsEventType( u"EventType" );
165constexpr OUStringLiteral gsPresentation( u"Presentation" );
166constexpr OUStringLiteral gsMacroName( u"MacroName" );
167constexpr OUStringLiteral gsScript( u"Script" );
168constexpr OUStringLiteral gsLibrary( u"Library" );
169constexpr OUStringLiteral gsClickAction( u"ClickAction" );
170constexpr OUStringLiteral gsBookmark( u"Bookmark" );
171constexpr OUStringLiteral gsEffect( u"Effect" );
172constexpr OUStringLiteral gsPlayFull( u"PlayFull" );
173constexpr OUStringLiteral gsVerb( u"Verb" );
174constexpr OUStringLiteral gsSoundURL( u"SoundURL" );
175constexpr OUStringLiteral gsSpeed( u"Speed" );
176constexpr OUStringLiteral gsStarBasic( u"StarBasic" );
177constexpr OUStringLiteral gsHyperlink( u"Hyperlink" );
178
180 SvXMLExportPropertyMapper *pExtMapper )
181: mrExport( rExp ),
182 maCurrentShapesIter(maShapesInfos.end()),
183 mbExportLayer( false ),
184 // #88546# init to sal_False
185 mbHandleProgressBar( false )
186{
187 // construct PropertySetMapper
189 if( pExtMapper )
190 {
191 rtl::Reference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper );
192 mxPropertySetMapper->ChainExportMapper( xExtMapper );
193 }
194
195/*
196 // chain text attributes
197 xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
198*/
199
200 mrExport.GetAutoStylePool()->AddFamily(
205 mrExport.GetAutoStylePool()->AddFamily(
210
211 // create table export helper and let him add his families in time
213}
214
216{
217}
218
219// sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format
220uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement( const uno::Reference< drawing::XShape >& xShape )
221{
222 uno::Reference< drawing::XShape > xCustomShapeReplacement;
223
224 if( !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) )
225 {
226 OUString aType( xShape->getShapeType() );
227 if( aType == "com.sun.star.drawing.CustomShape" )
228 {
229 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
230 if( xSet.is() )
231 {
232 OUString aEngine;
233 xSet->getPropertyValue("CustomShapeEngine") >>= aEngine;
234 if ( aEngine.isEmpty() )
235 {
236 aEngine = "com.sun.star.drawing.EnhancedCustomShapeEngine";
237 }
238 uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
239
240 if ( !aEngine.isEmpty() )
241 {
242 uno::Sequence< beans::PropertyValue > aPropValues{
243 comphelper::makePropertyValue("CustomShape", xShape),
244 comphelper::makePropertyValue("ForceGroupWithText", true)
245 };
246 uno::Sequence< uno::Any > aArgument = { uno::Any(aPropValues) };
247 uno::Reference< uno::XInterface > xInterface(
248 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext) );
249 if ( xInterface.is() )
250 {
251 uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
252 uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
253 if ( xCustomShapeEngine.is() )
254 xCustomShapeReplacement = xCustomShapeEngine->render();
255 }
256 }
257 }
258 }
259 }
260 return xCustomShapeReplacement;
261}
262
263// This method collects all automatic styles for the given XShape
264void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape )
265{
267 {
268 OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
269 return;
270 }
271 sal_Int32 nZIndex = 0;
272 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
273 if( xPropSet.is() )
274 xPropSet->getPropertyValue(gsZIndex) >>= nZIndex;
275
276 ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
277
278 if( static_cast<sal_Int32>(aShapeInfoVector.size()) <= nZIndex )
279 {
280 OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
281 return;
282 }
283
284 ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
285
286 uno::Reference< drawing::XShape > xCustomShapeReplacement = checkForCustomShapeReplacement( xShape );
287 if ( xCustomShapeReplacement.is() )
288 aShapeInfo.xCustomShapeReplacement = xCustomShapeReplacement;
289
290 // first compute the shapes type
291 ImpCalcShapeType(xShape, aShapeInfo.meShapeType);
292
293 // #i118485# enabled XmlShapeType::DrawChartShape and XmlShapeType::DrawOLE2Shape
294 // to have text
295 const bool bObjSupportsText =
296 supportsText(aShapeInfo.meShapeType);
297
298 const bool bObjSupportsStyle =
300
301 bool bIsEmptyPresObj = false;
302
303 if ( aShapeInfo.xCustomShapeReplacement.is() )
304 xPropSet.clear();
305
306 // prep text styles
307 if( xPropSet.is() && bObjSupportsText )
308 {
309 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
310 if (xText.is())
311 {
312 try
313 {
314 // tdf#153161: it seems that the call to XTextRange::getString flushes the changes
315 // for some objects, that otherwise fail to get exported correctly. Maybe at some
316 // point it would make sense to find a better place for more targeted flush.
317 xText->getString();
318 }
319 catch (uno::RuntimeException const&)
320 {
321 // E.g., SwXTextFrame that contains only a table will throw; this is not an error
322 }
323
324 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
325
326 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsEmptyPresentationObject") )
327 {
328 uno::Any aAny = xPropSet->getPropertyValue("IsEmptyPresentationObject");
329 aAny >>= bIsEmptyPresObj;
330 }
331
332 if(!bIsEmptyPresObj)
333 {
334 GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText );
335 }
336 }
337 }
338
339 // compute the shape parent style
340 if( xPropSet.is() )
341 {
342 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
343
344 OUString aParentName;
345 uno::Reference< style::XStyle > xStyle;
346
347 if( bObjSupportsStyle )
348 {
349 if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName("Style") )
350 xPropSet->getPropertyValue("Style") >>= xStyle;
351
352 if(xStyle.is())
353 {
354 // get family ID
355 uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
356 SAL_WARN_IF( !xStylePropSet.is(), "xmloff", "style without a XPropertySet?" );
357 try
358 {
359 if(xStylePropSet.is())
360 {
361 OUString aFamilyName;
362 xStylePropSet->getPropertyValue("Family") >>= aFamilyName;
363 if( !aFamilyName.isEmpty() && aFamilyName != "graphics" )
365 }
366 }
367 catch(const beans::UnknownPropertyException&)
368 {
369 // Ignored.
370 SAL_WARN( "xmloff",
371 "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
372 }
373
374 // get parent-style name
376 {
377 aParentName = msPresentationStylePrefix;
378 }
379
380 aParentName += xStyle->getName();
381 }
382 }
383
384 if (aParentName.isEmpty() && xPropertySetInfo->hasPropertyByName("TextBox") && xPropSet->getPropertyValue("TextBox").hasValue() && xPropSet->getPropertyValue("TextBox").get<bool>())
385 {
386 // Shapes with a Writer TextBox always have a parent style.
387 // If there would be none, then assign the default one.
388 aParentName = "Frame";
389 }
390
391 // filter propset
392 std::vector< XMLPropertyState > aPropStates;
393
394 sal_Int32 nCount = 0;
395 if( !bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeType::PresPageShape) )
396 {
397 aPropStates = GetPropertySetMapper()->Filter(mrExport, xPropSet);
398
400 {
401 // for control shapes, we additionally need the number format style (if any)
402 uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
403 DBG_ASSERT(xControl.is(), "XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
404 if (xControl.is())
405 {
406 uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
407 DBG_ASSERT(xControlModel.is(), "XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
408
409 OUString sNumberStyle = mrExport.GetFormExport()->getControlNumberStyle(xControlModel);
410 if (!sNumberStyle.isEmpty())
411 {
412 sal_Int32 nIndex = GetPropertySetMapper()->getPropertySetMapper()->FindEntryIndex(CTF_SD_CONTROL_SHAPE_DATA_STYLE);
413 // TODO : this retrieval of the index could be moved into the ctor, holding the index
414 // as member, thus saving time.
415 DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
416
417 XMLPropertyState aNewState(nIndex, uno::Any(sNumberStyle));
418 aPropStates.push_back(aNewState);
419 }
420 }
421 }
422
423 nCount = std::count_if(aPropStates.cbegin(), aPropStates.cend(),
424 [](const XMLPropertyState& rProp) { return rProp.mnIndex != -1; });
425 }
426
427 if(nCount == 0)
428 {
429 // no hard attributes, use parent style name for export
430 aShapeInfo.msStyleName = aParentName;
431 }
432 else
433 {
434 // there are filtered properties -> hard attributes
435 // try to find this style in AutoStylePool
436 aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Find(aShapeInfo.mnFamily, aParentName, aPropStates);
437
438 if(aShapeInfo.msStyleName.isEmpty())
439 {
440 // Style did not exist, add it to AutoStalePool
441 aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Add(aShapeInfo.mnFamily, aParentName, std::move(aPropStates));
442 }
443 }
444
445 // optionally generate auto style for text attributes
446 if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeType::PresPageShape)) && bObjSupportsText )
447 {
448 aPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(mrExport, xPropSet);
449
450 // yet more additionally, we need to care for the ParaAdjust property
452 {
453 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
454 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
455 if ( xPropSetInfo.is() && xPropState.is() )
456 {
457 // this is because:
458 // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model
459 // * control models are allowed to have an Align of "void"
460 // * the Default for control model's Align is TextAlign_LEFT
461 // * defaults for style properties are not written, but we need to write the "left",
462 // because we need to distinguish this "left" from the case where not align attribute
463 // is present which means "void"
464 if ( xPropSetInfo->hasPropertyByName( "ParaAdjust" )
465 && ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( "ParaAdjust" ) )
466 )
467 {
468 sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST );
469 // TODO : this retrieval of the index should be moved into the ctor, holding the index
470 // as member, thus saving time.
471 DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
472
473 uno::Any aParaAdjustValue = xPropSet->getPropertyValue( "ParaAdjust" );
474 XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue );
475
476 aPropStates.push_back( aAlignDefaultState );
477 }
478 }
479 }
480
481 nCount = std::count_if(aPropStates.cbegin(), aPropStates.cend(),
482 [](const XMLPropertyState& rProp) { return rProp.mnIndex != -1; });
483
484 if( nCount )
485 {
486 aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XmlStyleFamily::TEXT_PARAGRAPH, "", aPropStates );
487 if(aShapeInfo.msTextStyleName.isEmpty())
488 {
489 // Style did not exist, add it to AutoStalePool
490 aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XmlStyleFamily::TEXT_PARAGRAPH, "", std::move(aPropStates));
491 }
492 }
493 }
494 }
495
496 // prepare animation information if needed
497 if( mxAnimationsExporter.is() )
499
500 // check for special shapes
501
502 switch( aShapeInfo.meShapeType )
503 {
505 {
506 uno::Reference< uno::XInterface > xConnection;
507
508 // create shape ids for export later
509 xPropSet->getPropertyValue( gsStartShape ) >>= xConnection;
510 if( xConnection.is() )
512
513 xPropSet->getPropertyValue( gsEndShape ) >>= xConnection;
514 if( xConnection.is() )
516 break;
517 }
520 {
521 try
522 {
523 uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( gsModel ), uno::UNO_QUERY_THROW );
524 GetShapeTableExport()->collectTableAutoStyles( xRange );
525 }
526 catch(const uno::Exception&)
527 {
528 DBG_UNHANDLED_EXCEPTION( "xmloff", "collecting auto styles for a table" );
529 }
530 break;
531 }
532 default:
533 break;
534 }
535
536 // check for shape collections (group shape or 3d scene)
537 // and collect contained shapes style infos
538 const uno::Reference< drawing::XShape >& xCollection = aShapeInfo.xCustomShapeReplacement.is()
539 ? aShapeInfo.xCustomShapeReplacement : xShape;
540 {
541 uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
542 if( xShapes.is() )
543 {
544 collectShapesAutoStyles( xShapes );
545 }
546 }
547}
548
549namespace
550{
551 class NewTextListsHelper
552 {
553 public:
554 explicit NewTextListsHelper( SvXMLExport& rExp )
555 : mrExport( rExp )
556 {
557 mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
558 }
559
560 ~NewTextListsHelper()
561 {
562 mrExport.GetTextParagraphExport()->PopTextListsHelper();
563 }
564
565 private:
566 SvXMLExport& mrExport;
567 };
568}
569// This method exports the given XShape
570void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape,
571 XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */,
572 css::awt::Point* pRefPoint /* = NULL */,
573 comphelper::AttributeList* pAttrList /* = NULL */ )
574{
575 SAL_INFO("xmloff", xShape->getShapeType());
577 {
578 SAL_WARN( "xmloff", "XMLShapeExport::exportShape(): no auto styles where collected before export" );
579 return;
580 }
581 sal_Int32 nZIndex = 0;
582 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
583 OUString sHyperlink;
584 try
585 {
586 xSet->getPropertyValue(gsHyperlink) >>= sHyperlink;
587 }
588 catch (beans::UnknownPropertyException)
589 {
590 }
591
592 std::unique_ptr< SvXMLElementExport > pHyperlinkElement;
593
594 // Need to stash the attributes that are pre-loaded for the shape export
595 // (otherwise they will become attributes of the draw:a element)
596 uno::Reference<xml::sax::XAttributeList> xSaveAttribs(
597 new comphelper::AttributeList(GetExport().GetAttrList()));
599 if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::EFactory::DRAW) )
600 {
601 // export hyperlinks with <a><shape/></a>. Currently only in draw since draw
602 // does not support document events
603 try
604 {
605 presentation::ClickAction eAction = presentation::ClickAction_NONE;
606 xSet->getPropertyValue(gsOnClick) >>= eAction;
607
608 if( (eAction == presentation::ClickAction_DOCUMENT) ||
609 (eAction == presentation::ClickAction_BOOKMARK) )
610 {
611 OUString sURL;
612 xSet->getPropertyValue(gsBookmark) >>= sURL;
613
614 if( !sURL.isEmpty() )
615 {
619 pHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, true, true) );
620 }
621 }
622 }
623 catch(const uno::Exception&)
624 {
625 TOOLS_WARN_EXCEPTION("xmloff", "XMLShapeExport::exportShape(): exception during hyperlink export");
626 }
627 }
628 else if (xSet.is() && !sHyperlink.isEmpty())
629 {
632 pHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, true, true) );
633 }
634 // re-add stashed attributes
635 GetExport().AddAttributeList(xSaveAttribs);
636
637 if( xSet.is() )
638 xSet->getPropertyValue(gsZIndex) >>= nZIndex;
639
640 ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
641
642 if( static_cast<sal_Int32>(aShapeInfoVector.size()) <= nZIndex )
643 {
644 SAL_WARN( "xmloff", "XMLShapeExport::exportShape(): no shape info collected for a given shape" );
645 return;
646 }
647
648 NewTextListsHelper aNewTextListsHelper( mrExport );
649
650 const ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
651
652#ifdef DBG_UTIL
653 // check if this is the correct ShapesInfo
654 uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
655 if( xChild.is() )
656 {
657 uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
658 SAL_WARN_IF( !xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(), "xmloff", "XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
659 }
660
661 // first compute the shapes type
662 {
664 ImpCalcShapeType(xShape, eShapeType);
665
666 SAL_WARN_IF( eShapeType != aShapeInfo.meShapeType, "xmloff", "exportShape callings do not correspond to collectShapeAutoStyles calls!: " << xShape->getShapeType() );
667 }
668#endif
669
670 // collect animation information if needed
671 if( mxAnimationsExporter.is() )
672 mxAnimationsExporter->collect( xShape, mrExport );
673
674 /* Export shapes name if he has one (#i51726#)
675 Export of the shape name for text documents only if the OpenDocument
676 file format is written - exceptions are group shapes.
677 Note: Writer documents in OpenOffice.org file format doesn't contain
678 any names for shapes, except for group shapes.
679 */
680 {
681 if ( ( GetExport().GetModelType() != SvtModuleOptions::EFactory::WRITER &&
684 ( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) ||
687 aShapeInfo.xCustomShapeReplacement.is() ) )
688 {
689 uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
690 if( xNamed.is() )
691 {
692 const OUString aName( xNamed->getName() );
693 if( !aName.isEmpty() )
695 }
696 }
697 }
698
699 // export style name
700 if( !aShapeInfo.msStyleName.isEmpty() )
701 {
704 else
706 }
707
708 // export text style name
709 if( !aShapeInfo.msTextStyleName.isEmpty() )
710 {
712 }
713
714 // export shapes id if needed
715 {
716 uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
717 const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
718 if( !rShapeId.isEmpty() )
719 {
721 }
722 }
723
724 // export layer information
725 if( mbExportLayer )
726 {
727 // check for group or scene shape and not export layer if this is one
728 uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
729 if( !xShapes.is() )
730 {
731 try
732 {
733 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
734 OUString aLayerName;
735 xProps->getPropertyValue("LayerName") >>= aLayerName;
737
738 }
739 catch(const uno::Exception&)
740 {
741 DBG_UNHANDLED_EXCEPTION( "xmloff", "exporting layer name for shape" );
742 }
743 }
744 }
745
746 // export draw:display (do not export in ODF 1.3 or older)
748 {
751 try
752 {
753 bool bVisible = true;
754 bool bPrintable = true;
755
756 xSet->getPropertyValue(gsVisible) >>= bVisible;
757 xSet->getPropertyValue(gsPrintable) >>= bPrintable;
758
759 XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
760 const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
761 switch( nDisplay )
762 {
763 case 0: eDisplayToken = XML_NONE; break;
764 case 1: eDisplayToken = XML_PRINTER; break;
765 case 2: eDisplayToken = XML_SCREEN; break;
766 // case 3: eDisplayToken = XML_ALWAYS break; this is the default
767 }
768
769 if( eDisplayToken != XML_TOKEN_INVALID )
771 }
772 catch(const uno::Exception&)
773 {
774 DBG_UNHANDLED_EXCEPTION("xmloff.draw");
775 }
776 }
777
778 // #82003# test export count
779 // #91587# ALWAYS increment since now ALL to be exported shapes are counted.
780 if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled())
781 {
783 }
784
785 onExport( xShape );
786
787 // export shape element
788 switch(aShapeInfo.meShapeType)
789 {
791 {
792 ImpExportRectangleShape(xShape, nFeatures, pRefPoint );
793 break;
794 }
796 {
797 ImpExportEllipseShape(xShape, nFeatures, pRefPoint );
798 break;
799 }
801 {
802 ImpExportLineShape(xShape, nFeatures, pRefPoint );
803 break;
804 }
805 case XmlShapeType::DrawPolyPolygonShape: // closed PolyPolygon
806 case XmlShapeType::DrawPolyLineShape: // open PolyPolygon
807 case XmlShapeType::DrawClosedBezierShape: // closed tools::PolyPolygon containing curves
808 case XmlShapeType::DrawOpenBezierShape: // open tools::PolyPolygon containing curves
809 {
810 ImpExportPolygonShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
811 break;
812 }
813
823 {
824 ImpExportTextBoxShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
825 break;
826 }
827
830 {
831 ImpExportGraphicObjectShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
832 break;
833 }
834
837 {
838 ImpExportChartShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint, pAttrList );
839 break;
840 }
841
843 {
844 ImpExportControlShape(xShape, nFeatures, pRefPoint );
845 break;
846 }
847
849 {
850 ImpExportConnectorShape(xShape, nFeatures, pRefPoint );
851 break;
852 }
853
855 {
856 ImpExportMeasureShape(xShape, nFeatures, pRefPoint );
857 break;
858 }
859
864 {
865 ImpExportOLE2Shape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
866 break;
867 }
868
871 {
872 ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
873 break;
874 }
875
879 {
880 ImpExportPageShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
881 break;
882 }
883
885 {
886 ImpExportCaptionShape(xShape, nFeatures, pRefPoint );
887 break;
888 }
889
894 {
895 ImpExport3DShape(xShape, aShapeInfo.meShapeType);
896 break;
897 }
898
900 {
901 ImpExport3DSceneShape( xShape, nFeatures, pRefPoint );
902 break;
903 }
904
906 {
907 // empty group
908 ImpExportGroupShape( xShape, nFeatures, pRefPoint );
909 break;
910 }
911
913 {
914 ImpExportFrameShape(xShape, nFeatures, pRefPoint );
915 break;
916 }
917
919 {
920 ImpExportAppletShape(xShape, nFeatures, pRefPoint );
921 break;
922 }
923
925 {
926 ImpExportPluginShape(xShape, nFeatures, pRefPoint );
927 break;
928 }
929
931 {
932 if ( aShapeInfo.xCustomShapeReplacement.is() )
933 ImpExportGroupShape( aShapeInfo.xCustomShapeReplacement, nFeatures, pRefPoint );
934 else
935 ImpExportCustomShape( xShape, nFeatures, pRefPoint );
936 break;
937 }
938
941 {
942 ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
943 break;
944 }
945
949 default:
950 {
951 // this should never happen and is an error
952 OSL_FAIL("XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
953 break;
954 }
955 }
956
957 pHyperlinkElement.reset();
958
959 // #97489# #97111#
960 // if there was an error and no element for the shape was exported
961 // we need to clear the attribute list or the attributes will be
962 // set on the next exported element, which can result in corrupt
963 // xml files due to duplicate attributes
964
965 mrExport.CheckAttrList(); // asserts in non pro if we have attributes left
966 mrExport.ClearAttrList(); // clears the attributes
967}
968
969// This method collects all automatic styles for the shapes inside the given XShapes collection
970void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XShapes >& xShapes )
971{
972 ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
973 seekShapes( xShapes );
974
975 uno::Reference< drawing::XShape > xShape;
976 const sal_Int32 nShapeCount(xShapes->getCount());
977 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
978 {
979 xShapes->getByIndex(nShapeId) >>= xShape;
980 SAL_WARN_IF( !xShape.is(), "xmloff", "Shape without a XShape?" );
981 if(!xShape.is())
982 continue;
983
984 collectShapeAutoStyles( xShape );
985 }
986
987 maCurrentShapesIter = aOldCurrentShapesIter;
988}
989
990// This method exports all XShape inside the given XShapes collection
991void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xShapes, XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */ )
992{
993 ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
994 seekShapes( xShapes );
995
996 uno::Reference< drawing::XShape > xShape;
997 const sal_Int32 nShapeCount(xShapes->getCount());
998 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
999 {
1000 xShapes->getByIndex(nShapeId) >>= xShape;
1001 SAL_WARN_IF( !xShape.is(), "xmloff", "Shape without a XShape?" );
1002 if(!xShape.is())
1003 continue;
1004
1005 exportShape( xShape, nFeatures, pRefPoint );
1006 }
1007
1008 maCurrentShapesIter = aOldCurrentShapesIter;
1009}
1010
1011namespace xmloff {
1012
1013void FixZOrder(uno::Reference<drawing::XShapes> const& xShapes,
1014 std::function<unsigned int (uno::Reference<beans::XPropertySet> const&)> const& rGetLayer)
1015{
1016 uno::Reference<drawing::XShapes3> const xShapes3(xShapes, uno::UNO_QUERY);
1017 assert(xShapes3.is());
1018 if (!xShapes3.is())
1019 {
1020 return; // only SvxDrawPage implements this
1021 }
1022 struct Layer { std::vector<sal_Int32> shapes; sal_Int32 nMin = SAL_MAX_INT32; sal_Int32 nMax = 0; };
1023 std::vector<Layer> layers;
1024 // shapes are sorted by ZOrder
1025 sal_Int32 const nCount(xShapes->getCount());
1026 for (sal_Int32 i = 0; i < nCount; ++i)
1027 {
1028 uno::Reference<beans::XPropertySet> const xShape(xShapes->getByIndex(i), uno::UNO_QUERY);
1029 if (!xShape.is())
1030 {
1031 SAL_WARN("xmloff", "FixZOrder: null shape, cannot sort");
1032 return;
1033 }
1034 unsigned int const nLayer(rGetLayer(xShape));
1035 if (layers.size() <= nLayer)
1036 {
1037 layers.resize(nLayer + 1);
1038 }
1039 layers[nLayer].shapes.emplace_back(i);
1040 if (i < layers[nLayer].nMin)
1041 {
1042 layers[nLayer].nMin = i;
1043 }
1044 if (layers[nLayer].nMax < i)
1045 {
1046 layers[nLayer].nMax = i;
1047 }
1048 }
1049 layers.erase(std::remove_if(layers.begin(), layers.end(),
1050 [](Layer const& rLayer) { return rLayer.shapes.empty(); }),
1051 layers.end());
1052 bool isSorted(true);
1053 for (size_t i = 1; i < layers.size(); ++i)
1054 {
1055 assert(layers[i].nMin != layers[i-1].nMax); // unique!
1056 if (layers[i].nMin < layers[i-1].nMax)
1057 {
1058 isSorted = false;
1059 break;
1060 }
1061 }
1062 if (isSorted)
1063 {
1064 return; // nothing to do
1065 }
1066 uno::Sequence<sal_Int32> aNewOrder(nCount);
1067 auto iterInsert(aNewOrder.getArray());
1068 for (auto const& rLayer : layers)
1069 {
1070 assert(rLayer.nMin <= rLayer.nMax); // empty layers have been removed
1071 iterInsert = std::copy(rLayer.shapes.begin(), rLayer.shapes.end(), iterInsert);
1072 }
1073 try
1074 {
1075 xShapes3->sort(aNewOrder);
1076 }
1077 catch (uno::Exception const&)
1078 {
1079 SAL_WARN("xmloff", "FixZOrder: exception");
1080 }
1081}
1082
1083} // namespace xmloff
1084
1085void XMLShapeExport::seekShapes( const uno::Reference< drawing::XShapes >& xShapes ) noexcept
1086{
1087 if( xShapes.is() )
1088 {
1089 maCurrentShapesIter = maShapesInfos.find( xShapes );
1090 if( maCurrentShapesIter == maShapesInfos.end() )
1091 {
1092 auto itPair = maShapesInfos.emplace( xShapes, ImplXMLShapeExportInfoVector( static_cast<ShapesInfos::size_type>(xShapes->getCount()) ) );
1093
1094 maCurrentShapesIter = itPair.first;
1095
1096 SAL_WARN_IF( maCurrentShapesIter == maShapesInfos.end(), "xmloff", "XMLShapeExport::seekShapes(): insert into stl::map failed" );
1097 }
1098
1099 SAL_WARN_IF( (*maCurrentShapesIter).second.size() != static_cast<ShapesInfos::size_type>(xShapes->getCount()), "xmloff", "XMLShapeExport::seekShapes(): XShapes size varied between calls" );
1100
1101 }
1102 else
1103 {
1104 maCurrentShapesIter = maShapesInfos.end();
1105 }
1106}
1107
1109{
1110 // export all autostyle infos
1111
1112 // ...for graphic
1113 {
1115 }
1116
1117 // ...for presentation
1118 {
1120 }
1121
1122 if( mxShapeTableExport.is() )
1123 mxShapeTableExport->exportAutoStyles();
1124}
1125
1128 SvXMLExport& rExport )
1129{
1132 rExport.GetTextParagraphExport(); // get or create text paragraph export
1133 SvXMLExportPropertyMapper* pResult =
1134 new XMLShapeExportPropertyMapper( xMapper, rExport );
1135 // chain text attributes
1136 return pResult;
1137}
1138
1139void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& xShape,
1140 XmlShapeType& eShapeType)
1141{
1142 // set in every case, so init here
1143 eShapeType = XmlShapeType::Unknown;
1144
1145 if(!xShape.is())
1146 return;
1147
1148 OUString aType(xShape->getShapeType());
1149
1150 if(!aType.match("com.sun.star."))
1151 return;
1152
1153 if(aType.match("drawing.", 13))
1154 {
1155 // drawing shapes
1156 if (aType.match("Rectangle", 21)) { eShapeType = XmlShapeType::DrawRectangleShape; }
1157
1158 // #i72177# Note: Correcting CustomShape, CustomShape->Custom, len from 9 (was wrong anyways) to 6.
1159 // As can be seen at the other compares, the appendix "Shape" is left out of the comparison.
1160 else if(aType.match("Custom", 21)) { eShapeType = XmlShapeType::DrawCustomShape; }
1161
1162 else if(aType.match("Ellipse", 21)) { eShapeType = XmlShapeType::DrawEllipseShape; }
1163 else if(aType.match("Control", 21)) { eShapeType = XmlShapeType::DrawControlShape; }
1164 else if(aType.match("Connector", 21)) { eShapeType = XmlShapeType::DrawConnectorShape; }
1165 else if(aType.match("Measure", 21)) { eShapeType = XmlShapeType::DrawMeasureShape; }
1166 else if(aType.match("Line", 21)) { eShapeType = XmlShapeType::DrawLineShape; }
1167
1168 // #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape
1169 else if(aType.match("PolyPolygon", 21)) { eShapeType = XmlShapeType::DrawPolyPolygonShape; }
1170
1171 // #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape
1172 else if(aType.match("PolyLine", 21)) { eShapeType = XmlShapeType::DrawPolyLineShape; }
1173
1174 else if(aType.match("OpenBezier", 21)) { eShapeType = XmlShapeType::DrawOpenBezierShape; }
1175 else if(aType.match("ClosedBezier", 21)) { eShapeType = XmlShapeType::DrawClosedBezierShape; }
1176
1177 // #i72177# FreeHand (opened and closed) now supports the types OpenFreeHandShape and
1178 // ClosedFreeHandShape respectively. Represent them as bezier shapes
1179 else if(aType.match("OpenFreeHand", 21)) { eShapeType = XmlShapeType::DrawOpenBezierShape; }
1180 else if(aType.match("ClosedFreeHand", 21)) { eShapeType = XmlShapeType::DrawClosedBezierShape; }
1181
1182 else if(aType.match("GraphicObject", 21)) { eShapeType = XmlShapeType::DrawGraphicObjectShape; }
1183 else if(aType.match("Group", 21)) { eShapeType = XmlShapeType::DrawGroupShape; }
1184 else if(aType.match("Text", 21)) { eShapeType = XmlShapeType::DrawTextShape; }
1185 else if(aType.match("OLE2", 21))
1186 {
1187 eShapeType = XmlShapeType::DrawOLE2Shape;
1188
1189 // get info about presentation shape
1190 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1191
1192 if(xPropSet.is())
1193 {
1194 OUString sCLSID;
1195 if(xPropSet->getPropertyValue("CLSID") >>= sCLSID)
1196 {
1197#if !ENABLE_WASM_STRIP_CHART
1198 // WASM_CHART change
1199 // TODO: With Chart extracted this cannot really happen since
1200 // no Chart could've been added at all
1201 if (sCLSID == mrExport.GetChartExport()->getChartCLSID() ||
1202#else
1203 if(
1204#endif
1205 sCLSID == SvGlobalName( SO3_RPTCH_CLASSID ).GetHexName() )
1206 {
1207 eShapeType = XmlShapeType::DrawChartShape;
1208 }
1209 else if (sCLSID == SvGlobalName( SO3_SC_CLASSID ).GetHexName() )
1210 {
1211 eShapeType = XmlShapeType::DrawSheetShape;
1212 }
1213 else
1214 {
1215 // general OLE2 Object
1216 }
1217 }
1218 }
1219 }
1220 else if(aType.match("Page", 21)) { eShapeType = XmlShapeType::DrawPageShape; }
1221 else if(aType.match("Frame", 21)) { eShapeType = XmlShapeType::DrawFrameShape; }
1222 else if(aType.match("Caption", 21)) { eShapeType = XmlShapeType::DrawCaptionShape; }
1223 else if(aType.match("Plugin", 21)) { eShapeType = XmlShapeType::DrawPluginShape; }
1224 else if(aType.match("Applet", 21)) { eShapeType = XmlShapeType::DrawAppletShape; }
1225 else if(aType.match("MediaShape", 21)) { eShapeType = XmlShapeType::DrawMediaShape; }
1226 else if(aType.match("TableShape", 21)) { eShapeType = XmlShapeType::DrawTableShape; }
1227
1228 // 3D shapes
1229 else if(aType.match("Scene", 21 + 7)) { eShapeType = XmlShapeType::Draw3DSceneObject; }
1230 else if(aType.match("Cube", 21 + 7)) { eShapeType = XmlShapeType::Draw3DCubeObject; }
1231 else if(aType.match("Sphere", 21 + 7)) { eShapeType = XmlShapeType::Draw3DSphereObject; }
1232 else if(aType.match("Lathe", 21 + 7)) { eShapeType = XmlShapeType::Draw3DLatheObject; }
1233 else if(aType.match("Extrude", 21 + 7)) { eShapeType = XmlShapeType::Draw3DExtrudeObject; }
1234 }
1235 else if(aType.match("presentation.", 13))
1236 {
1237 // presentation shapes
1238 if (aType.match("TitleText", 26)) { eShapeType = XmlShapeType::PresTitleTextShape; }
1239 else if(aType.match("Outliner", 26)) { eShapeType = XmlShapeType::PresOutlinerShape; }
1240 else if(aType.match("Subtitle", 26)) { eShapeType = XmlShapeType::PresSubtitleShape; }
1241 else if(aType.match("GraphicObject", 26)) { eShapeType = XmlShapeType::PresGraphicObjectShape; }
1242 else if(aType.match("Page", 26)) { eShapeType = XmlShapeType::PresPageShape; }
1243 else if(aType.match("OLE2", 26))
1244 {
1245 eShapeType = XmlShapeType::PresOLE2Shape;
1246
1247 // get info about presentation shape
1248 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1249
1250 if(xPropSet.is()) try
1251 {
1252 OUString sCLSID;
1253 if(xPropSet->getPropertyValue("CLSID") >>= sCLSID)
1254 {
1255 if( sCLSID == SvGlobalName( SO3_SC_CLASSID ).GetHexName() )
1256 {
1257 eShapeType = XmlShapeType::PresSheetShape;
1258 }
1259 }
1260 }
1261 catch(const uno::Exception&)
1262 {
1263 SAL_WARN( "xmloff", "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
1264 }
1265 }
1266 else if(aType.match("Chart", 26)) { eShapeType = XmlShapeType::PresChartShape; }
1267 else if(aType.match("OrgChart", 26)) { eShapeType = XmlShapeType::PresOrgChartShape; }
1268 else if(aType.match("CalcShape", 26)) { eShapeType = XmlShapeType::PresSheetShape; }
1269 else if(aType.match("TableShape", 26)) { eShapeType = XmlShapeType::PresTableShape; }
1270 else if(aType.match("Notes", 26)) { eShapeType = XmlShapeType::PresNotesShape; }
1271 else if(aType.match("HandoutShape", 26)) { eShapeType = XmlShapeType::HandoutShape; }
1272 else if(aType.match("HeaderShape", 26)) { eShapeType = XmlShapeType::PresHeaderShape; }
1273 else if(aType.match("FooterShape", 26)) { eShapeType = XmlShapeType::PresFooterShape; }
1274 else if(aType.match("SlideNumberShape", 26)) { eShapeType = XmlShapeType::PresSlideNumberShape; }
1275 else if(aType.match("DateTimeShape", 26)) { eShapeType = XmlShapeType::PresDateTimeShape; }
1276 else if(aType.match("MediaShape", 26)) { eShapeType = XmlShapeType::PresMediaShape; }
1277 }
1278}
1279
1281void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape >& xShape )
1282{
1283 uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
1284 if( !xSupplier.is() )
1285 return;
1286
1287 uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
1288 if( !xGluePoints.is() )
1289 return;
1290
1291 drawing::GluePoint2 aGluePoint;
1292
1293 const uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
1294
1295 for( const sal_Int32 nIdentifier : aIdSequence )
1296 {
1297 if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
1298 {
1299 // export only user defined gluepoints
1300
1301 const OUString sId( OUString::number( nIdentifier ) );
1303
1305 aGluePoint.Position.X);
1306 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear());
1307
1309 aGluePoint.Position.Y);
1310 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear());
1311
1312 if( !aGluePoint.IsRelative )
1313 {
1315 mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ALIGN, msBuffer.makeStringAndClear() );
1316 }
1317
1318 if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
1319 {
1322 }
1323
1325 }
1326 }
1327}
1328
1329void XMLShapeExport::ImpExportSignatureLine(const uno::Reference<drawing::XShape>& xShape)
1330{
1331 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1332
1333 bool bIsSignatureLine = false;
1334 xPropSet->getPropertyValue("IsSignatureLine") >>= bIsSignatureLine;
1335 if (!bIsSignatureLine)
1336 return;
1337
1338 OUString aSignatureLineId;
1339 xPropSet->getPropertyValue("SignatureLineId") >>= aSignatureLineId;
1341
1342 OUString aSuggestedSignerName;
1343 xPropSet->getPropertyValue("SignatureLineSuggestedSignerName") >>= aSuggestedSignerName;
1344 if (!aSuggestedSignerName.isEmpty())
1346
1347 OUString aSuggestedSignerTitle;
1348 xPropSet->getPropertyValue("SignatureLineSuggestedSignerTitle") >>= aSuggestedSignerTitle;
1349 if (!aSuggestedSignerTitle.isEmpty())
1351
1352 OUString aSuggestedSignerEmail;
1353 xPropSet->getPropertyValue("SignatureLineSuggestedSignerEmail") >>= aSuggestedSignerEmail;
1354 if (!aSuggestedSignerEmail.isEmpty())
1356
1357 OUString aSigningInstructions;
1358 xPropSet->getPropertyValue("SignatureLineSigningInstructions") >>= aSigningInstructions;
1359 if (!aSigningInstructions.isEmpty())
1361
1362 bool bShowSignDate = false;
1363 xPropSet->getPropertyValue("SignatureLineShowSignDate") >>= bShowSignDate;
1365 bShowSignDate ? XML_TRUE : XML_FALSE);
1366
1367 bool bCanAddComment = false;
1368 xPropSet->getPropertyValue("SignatureLineCanAddComment") >>= bCanAddComment;
1370 bCanAddComment ? XML_TRUE : XML_FALSE);
1371
1373 true);
1374}
1375
1376void XMLShapeExport::ImpExportQRCode(const uno::Reference<drawing::XShape>& xShape)
1377{
1378 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1379
1380 uno::Any aAny = xPropSet->getPropertyValue("BarCodeProperties");
1381
1382 css::drawing::BarCode aBarCode;
1383 if(!(aAny >>= aBarCode))
1384 return;
1385
1387 /* Export QR Code as per customised schema, @see OpenDocument-schema-v1.3+libreoffice */
1388 OUString temp;
1389 switch(aBarCode.ErrorCorrection){
1390 case css::drawing::BarCodeErrorCorrection::LOW :
1391 temp = "low";
1392 break;
1393 case css::drawing::BarCodeErrorCorrection::MEDIUM:
1394 temp = "medium";
1395 break;
1396 case css::drawing::BarCodeErrorCorrection::QUARTILE:
1397 temp = "quartile";
1398 break;
1399 case css::drawing::BarCodeErrorCorrection::HIGH:
1400 temp = "high";
1401 break;
1402 }
1404 mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_QRCODE_BORDER, OUStringBuffer(20).append(aBarCode.Border).makeStringAndClear());
1405 mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_QRCODE_TYPE, OUStringBuffer(20).append(aBarCode.Type).makeStringAndClear());
1406
1408 true);
1409}
1410
1412{
1414
1415 // construct PropertySetMapper
1417 static_cast<XMLShapeExportPropertyMapper*>(xPropertySetMapper.get())->SetAutoStyles( false );
1418
1419 // chain text attributes
1420 xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(mrExport));
1421
1422 // chain special Writer/text frame default attributes
1423 xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaDefaultExtPropMapper(mrExport));
1424
1425 // write graphic family default style
1426 uno::Reference< lang::XMultiServiceFactory > xFact( mrExport.GetModel(), uno::UNO_QUERY );
1427 if( !xFact.is() )
1428 return;
1429
1430 try
1431 {
1432 uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance("com.sun.star.drawing.Defaults"), uno::UNO_QUERY );
1433 if( xDefaults.is() )
1434 {
1435 aStEx->exportDefaultStyle( xDefaults, XML_STYLE_FAMILY_SD_GRAPHICS_NAME, xPropertySetMapper );
1436
1437 // write graphic styles (family name differs depending on the module)
1438 aStEx->exportStyleFamily("graphics", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, false, XmlStyleFamily::SD_GRAPHICS_ID);
1439 aStEx->exportStyleFamily("GraphicStyles", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, false, XmlStyleFamily::SD_GRAPHICS_ID);
1440 }
1441 }
1442 catch(const lang::ServiceNotRegisteredException&)
1443 {
1444 }
1445}
1446
1447void XMLShapeExport::onExport( const css::uno::Reference < css::drawing::XShape >& )
1448{
1449}
1450
1452{
1453 if( !mxShapeTableExport.is() )
1454 {
1457 mrExport.GetTextParagraphExport(); // get or create text paragraph export
1459 mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory );
1460 }
1461
1462 return mxShapeTableExport;
1463}
1464
1465void XMLShapeExport::ImpExportNewTrans(const uno::Reference< beans::XPropertySet >& xPropSet,
1466 XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
1467{
1468 // get matrix
1470 ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
1471
1472 // decompose and correct about pRefPoint
1473 ::basegfx::B2DTuple aTRScale;
1474 double fTRShear(0.0);
1475 double fTRRotate(0.0);
1476 ::basegfx::B2DTuple aTRTranslate;
1477 ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
1478
1479 // use features and write
1480 ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
1481}
1482
1484 const uno::Reference< beans::XPropertySet >& xPropSet)
1485{
1486 /* Get <TransformationInHoriL2R>, if it exist
1487 and if the document is exported into the OpenOffice.org file format.
1488 This property only exists at service css::text::Shape - the
1489 Writer UNO service for shapes.
1490 This code is needed, because the positioning attributes in the
1491 OpenOffice.org file format are given in horizontal left-to-right layout
1492 regardless the layout direction the shape is in. In the OASIS Open Office
1493 file format the positioning attributes are correctly given in the layout
1494 direction the shape is in. Thus, this code provides the conversion from
1495 the OASIS Open Office file format to the OpenOffice.org file format. (#i28749#)
1496 */
1497 uno::Any aAny;
1498 if ( !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
1499 xPropSet->getPropertySetInfo()->hasPropertyByName("TransformationInHoriL2R") )
1500 {
1501 aAny = xPropSet->getPropertyValue("TransformationInHoriL2R");
1502 }
1503 else
1504 {
1505 aAny = xPropSet->getPropertyValue("Transformation");
1506 }
1507 drawing::HomogenMatrix3 aMatrix;
1508 aAny >>= aMatrix;
1509
1510 rMatrix.set(0, 0, aMatrix.Line1.Column1);
1511 rMatrix.set(0, 1, aMatrix.Line1.Column2);
1512 rMatrix.set(0, 2, aMatrix.Line1.Column3);
1513 rMatrix.set(1, 0, aMatrix.Line2.Column1);
1514 rMatrix.set(1, 1, aMatrix.Line2.Column2);
1515 rMatrix.set(1, 2, aMatrix.Line2.Column3);
1516 // For this to be a valid 2D transform matrix, the last row must be [0,0,1]
1517 assert( aMatrix.Line3.Column1 == 0 );
1518 assert( aMatrix.Line3.Column2 == 0 );
1519 assert( aMatrix.Line3.Column3 == 1 );
1520}
1521
1522void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale,
1523 double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, css::awt::Point* pRefPoint)
1524{
1525 // decompose matrix
1526 rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
1527
1528 // correct translation about pRefPoint
1529 if(pRefPoint)
1530 {
1531 rTRTranslate -= ::basegfx::B2DTuple(pRefPoint->X, pRefPoint->Y);
1532 }
1533}
1534
1536 double fTRRotate, ::basegfx::B2DTuple const & rTRTranslate, const XMLShapeExportFlags nFeatures)
1537{
1538 // always write Size (rTRScale) since this statement carries the union
1539 // of the object
1540 OUString aStr;
1541 OUStringBuffer sStringBuffer;
1542 ::basegfx::B2DTuple aTRScale(rTRScale);
1543
1544 // svg: width
1545 if(!(nFeatures & XMLShapeExportFlags::WIDTH))
1546 {
1547 aTRScale.setX(1.0);
1548 }
1549 else
1550 {
1551 if( aTRScale.getX() > 0.0 )
1552 aTRScale.setX(aTRScale.getX() - 1.0);
1553 else if( aTRScale.getX() < 0.0 )
1554 aTRScale.setX(aTRScale.getX() + 1.0);
1555 }
1556
1558 FRound(aTRScale.getX()));
1559 aStr = sStringBuffer.makeStringAndClear();
1561
1562 // svg: height
1563 if(!(nFeatures & XMLShapeExportFlags::HEIGHT))
1564 {
1565 aTRScale.setY(1.0);
1566 }
1567 else
1568 {
1569 if( aTRScale.getY() > 0.0 )
1570 aTRScale.setY(aTRScale.getY() - 1.0);
1571 else if( aTRScale.getY() < 0.0 )
1572 aTRScale.setY(aTRScale.getY() + 1.0);
1573 }
1574
1576 FRound(aTRScale.getY()));
1577 aStr = sStringBuffer.makeStringAndClear();
1579
1580 // decide if transformation is necessary
1581 bool bTransformationIsNecessary(fTRShear != 0.0 || fTRRotate != 0.0);
1582
1583 if(bTransformationIsNecessary)
1584 {
1585 // write transformation, but WITHOUT scale which is exported as size above
1586 SdXMLImExTransform2D aTransform;
1587
1588 aTransform.AddSkewX(atan(fTRShear));
1589
1590 // #i78696#
1591 // fTRRotate is mathematically correct, but due to the error
1592 // we export/import it mirrored. Since the API implementation is fixed and
1593 // uses the correctly oriented angle, it is necessary for compatibility to
1594 // mirror the angle here to stay at the old behaviour. There is a follow-up
1595 // task (#i78698#) to fix this in the next ODF FileFormat version
1596 aTransform.AddRotate(-fTRRotate);
1597
1598 aTransform.AddTranslate(rTRTranslate);
1599
1600 // does transformation need to be exported?
1601 if(aTransform.NeedsAction())
1603 }
1604 else
1605 {
1606 // no shear, no rotate; just add object position to export and we are done
1607 if(nFeatures & XMLShapeExportFlags::X)
1608 {
1609 // svg: x
1611 FRound(rTRTranslate.getX()));
1612 aStr = sStringBuffer.makeStringAndClear();
1614 }
1615
1616 if(nFeatures & XMLShapeExportFlags::Y)
1617 {
1618 // svg: y
1620 FRound(rTRTranslate.getY()));
1621 aStr = sStringBuffer.makeStringAndClear();
1623 }
1624 }
1625}
1626
1627bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< beans::XPropertySet >& xPropSet, const OUString& rClass )
1628{
1629 bool bIsEmpty = false;
1630
1631 // write presentation class entry
1633
1634 if( xPropSet.is() )
1635 {
1636 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1637
1638
1639 // is empty pres. shape?
1640 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsEmptyPresentationObject"))
1641 {
1642 xPropSet->getPropertyValue("IsEmptyPresentationObject") >>= bIsEmpty;
1643 if( bIsEmpty )
1645 }
1646
1647 // is user-transformed?
1648 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsPlaceholderDependent"))
1649 {
1650 bool bTemp = false;
1651 xPropSet->getPropertyValue("IsPlaceholderDependent") >>= bTemp;
1652 if(!bTemp)
1654 }
1655 }
1656
1657 return bIsEmpty;
1658}
1659
1660void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape, TextPNS eExtensionNS )
1661{
1662 if (eExtensionNS == TextPNS::EXTENSION)
1663 {
1665 {
1666 return; // do not export to ODF 1.1/1.2/1.3
1667 }
1668 }
1669 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1670 if( xText.is() )
1671 {
1672 uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
1673 if( xEnumAccess.is() && xEnumAccess->hasElements() )
1674 mrExport.GetTextParagraphExport()->exportText( xText, false, true, eExtensionNS );
1675 }
1676}
1677
1678namespace {
1679
1680enum class Found {
1681 NONE = 0x0000,
1682 CLICKACTION = 0x0001,
1683 BOOKMARK = 0x0002,
1684 EFFECT = 0x0004,
1685 PLAYFULL = 0x0008,
1686 VERB = 0x0010,
1687 SOUNDURL = 0x0020,
1688 SPEED = 0x0040,
1689 CLICKEVENTTYPE = 0x0080,
1690 MACRO = 0x0100,
1691 LIBRARY = 0x0200,
1692};
1693
1694}
1695
1696namespace o3tl {
1697 template<> struct typed_flags<Found> : is_typed_flags<Found, 0x03ff> {};
1698}
1699
1700void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
1701{
1702 uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
1703 if( !xEventsSupplier.is() )
1704 return;
1705
1706 uno::Reference< container::XNameAccess > xEvents = xEventsSupplier->getEvents();
1707 SAL_WARN_IF( !xEvents.is(), "xmloff", "XEventsSupplier::getEvents() returned NULL" );
1708 if( !xEvents.is() )
1709 return;
1710
1711 Found nFound = Found::NONE;
1712
1713 OUString aClickEventType;
1714 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1715 presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1716 presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
1717 OUString aStrSoundURL;
1718 bool bPlayFull = false;
1719 sal_Int32 nVerb = 0;
1720 OUString aStrMacro;
1721 OUString aStrLibrary;
1722 OUString aStrBookmark;
1723
1724 uno::Sequence< beans::PropertyValue > aClickProperties;
1725 if( xEvents->hasByName( gsOnClick ) && (xEvents->getByName( gsOnClick ) >>= aClickProperties) )
1726 {
1727 for( const auto& rProperty : std::as_const(aClickProperties) )
1728 {
1729 if( !( nFound & Found::CLICKEVENTTYPE ) && rProperty.Name == gsEventType )
1730 {
1731 if( rProperty.Value >>= aClickEventType )
1732 nFound |= Found::CLICKEVENTTYPE;
1733 }
1734 else if( !( nFound & Found::CLICKACTION ) && rProperty.Name == gsClickAction )
1735 {
1736 if( rProperty.Value >>= eClickAction )
1737 nFound |= Found::CLICKACTION;
1738 }
1739 else if( !( nFound & Found::MACRO ) && ( rProperty.Name == gsMacroName || rProperty.Name == gsScript ) )
1740 {
1741 if( rProperty.Value >>= aStrMacro )
1742 nFound |= Found::MACRO;
1743 }
1744 else if( !( nFound & Found::LIBRARY ) && rProperty.Name == gsLibrary )
1745 {
1746 if( rProperty.Value >>= aStrLibrary )
1747 nFound |= Found::LIBRARY;
1748 }
1749 else if( !( nFound & Found::EFFECT ) && rProperty.Name == gsEffect )
1750 {
1751 if( rProperty.Value >>= eEffect )
1752 nFound |= Found::EFFECT;
1753 }
1754 else if( !( nFound & Found::BOOKMARK ) && rProperty.Name == gsBookmark )
1755 {
1756 if( rProperty.Value >>= aStrBookmark )
1757 nFound |= Found::BOOKMARK;
1758 }
1759 else if( !( nFound & Found::SPEED ) && rProperty.Name == gsSpeed )
1760 {
1761 if( rProperty.Value >>= eSpeed )
1762 nFound |= Found::SPEED;
1763 }
1764 else if( !( nFound & Found::SOUNDURL ) && rProperty.Name == gsSoundURL )
1765 {
1766 if( rProperty.Value >>= aStrSoundURL )
1767 nFound |= Found::SOUNDURL;
1768 }
1769 else if( !( nFound & Found::PLAYFULL ) && rProperty.Name == gsPlayFull )
1770 {
1771 if( rProperty.Value >>= bPlayFull )
1772 nFound |= Found::PLAYFULL;
1773 }
1774 else if( !( nFound & Found::VERB ) && rProperty.Name == gsVerb )
1775 {
1776 if( rProperty.Value >>= nVerb )
1777 nFound |= Found::VERB;
1778 }
1779 }
1780 }
1781
1782 // create the XML elements
1783
1784 if( aClickEventType == gsPresentation )
1785 {
1786 if( !(nFound & Found::CLICKACTION) || (eClickAction == presentation::ClickAction_NONE) )
1787 return;
1788
1790
1791 enum XMLTokenEnum eStrAction;
1792
1793 switch( eClickAction )
1794 {
1795 case presentation::ClickAction_PREVPAGE: eStrAction = XML_PREVIOUS_PAGE; break;
1796 case presentation::ClickAction_NEXTPAGE: eStrAction = XML_NEXT_PAGE; break;
1797 case presentation::ClickAction_FIRSTPAGE: eStrAction = XML_FIRST_PAGE; break;
1798 case presentation::ClickAction_LASTPAGE: eStrAction = XML_LAST_PAGE; break;
1799 case presentation::ClickAction_INVISIBLE: eStrAction = XML_HIDE; break;
1800 case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
1801 case presentation::ClickAction_PROGRAM: eStrAction = XML_EXECUTE; break;
1802 case presentation::ClickAction_BOOKMARK: eStrAction = XML_SHOW; break;
1803 case presentation::ClickAction_DOCUMENT: eStrAction = XML_SHOW; break;
1804 case presentation::ClickAction_MACRO: eStrAction = XML_EXECUTE_MACRO; break;
1805 case presentation::ClickAction_VERB: eStrAction = XML_VERB; break;
1806 case presentation::ClickAction_VANISH: eStrAction = XML_FADE_OUT; break;
1807 case presentation::ClickAction_SOUND: eStrAction = XML_SOUND; break;
1808 default:
1809 OSL_FAIL( "unknown presentation::ClickAction found!" );
1810 eStrAction = XML_UNKNOWN;
1811 }
1812
1813 OUString aEventQName(
1815 XML_NAMESPACE_DOM, "click" ) );
1818
1819 if( eClickAction == presentation::ClickAction_VANISH )
1820 {
1821 if( nFound & Found::EFFECT )
1822 {
1823 XMLEffect eKind;
1824 XMLEffectDirection eDirection;
1825 sal_Int16 nStartScale;
1826 bool bIn;
1827
1828 SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
1829
1830 if( eKind != EK_none )
1831 {
1834 }
1835
1836 if( eDirection != ED_none )
1837 {
1840 }
1841
1842 if( nStartScale != -1 )
1843 {
1846 }
1847 }
1848
1849 if( nFound & Found::SPEED && eEffect != presentation::AnimationEffect_NONE )
1850 {
1851 if( eSpeed != presentation::AnimationSpeed_MEDIUM )
1852 {
1855 }
1856 }
1857 }
1858
1859 if( eClickAction == presentation::ClickAction_PROGRAM ||
1860 eClickAction == presentation::ClickAction_BOOKMARK ||
1861 eClickAction == presentation::ClickAction_DOCUMENT )
1862 {
1863 if( eClickAction == presentation::ClickAction_BOOKMARK )
1864 msBuffer.append( '#' );
1865
1866 msBuffer.append( aStrBookmark );
1867 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
1871 }
1872
1873 if( ( nFound & Found::VERB ) && eClickAction == presentation::ClickAction_VERB )
1874 {
1875 msBuffer.append( nVerb );
1877 }
1878
1880
1881 if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
1882 {
1883 if( ( nFound & Found::SOUNDURL ) && !aStrSoundURL.isEmpty() )
1884 {
1885 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
1889 if( nFound & Found::PLAYFULL && bPlayFull )
1891
1893 }
1894 }
1895 }
1896 else if( aClickEventType == gsStarBasic )
1897 {
1898 if( nFound & Found::MACRO )
1899 {
1901
1905 "starbasic" ) );
1906 OUString aEventQName(
1908 XML_NAMESPACE_DOM, "click" ) );
1910
1911 if( nFound & Found::LIBRARY )
1912 {
1913 const OUString& sLocation( GetXMLToken(
1914 (aStrLibrary.equalsIgnoreAsciiCase("StarOffice") ||
1915 aStrLibrary.equalsIgnoreAsciiCase("application") ) ? XML_APPLICATION
1916 : XML_DOCUMENT ) );
1918 sLocation + ":" + aStrMacro);
1919 }
1920 else
1921 {
1923 }
1924
1926 }
1927 }
1928 else if( aClickEventType == gsScript )
1929 {
1930 if( nFound & Found::MACRO )
1931 {
1933
1936 OUString aEventQName(
1938 XML_NAMESPACE_DOM, "click" ) );
1942
1944 }
1945 }
1946}
1947
1949void XMLShapeExport::ImpExportDescription( const uno::Reference< drawing::XShape >& xShape )
1950{
1951 try
1952 {
1953 OUString aTitle;
1954 OUString aDescription;
1955
1956 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
1957 xProps->getPropertyValue("Title") >>= aTitle;
1958 xProps->getPropertyValue("Description") >>= aDescription;
1959
1960 if(!aTitle.isEmpty())
1961 {
1962 SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, true, false);
1963 mrExport.Characters( aTitle );
1964 }
1965
1966 if(!aDescription.isEmpty())
1967 {
1968 SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_DESC, true, false );
1969 mrExport.Characters( aDescription );
1970 }
1971 }
1972 catch( uno::Exception& )
1973 {
1974 DBG_UNHANDLED_EXCEPTION( "xmloff", "exporting Title and/or Description for shape" );
1975 }
1976}
1977
1978void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
1979{
1980 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
1981 if(!(xShapes.is() && xShapes->getCount()))
1982 return;
1983
1984 // write group shape
1985 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
1986 SvXMLElementExport aPGR(mrExport, XML_NAMESPACE_DRAW, XML_G, bCreateNewline, true);
1987
1988 ImpExportDescription( xShape ); // #i68101#
1989 ImpExportEvents( xShape );
1990 ImpExportGluePoints( xShape );
1991
1992 // #89764# if export of position is suppressed for group shape,
1993 // positions of contained objects should be written relative to
1994 // the upper left edge of the group.
1995 awt::Point aUpperLeft;
1996
1997 if(!(nFeatures & XMLShapeExportFlags::POSITION))
1998 {
1999 nFeatures |= XMLShapeExportFlags::POSITION;
2000 aUpperLeft = xShape->getPosition();
2001 pRefPoint = &aUpperLeft;
2002 }
2003
2004 // write members
2005 exportShapes( xShapes, nFeatures, pRefPoint );
2006}
2007
2009 const uno::Reference< drawing::XShape >& xShape,
2010 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
2011{
2012 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2013 if(!xPropSet.is())
2014 return;
2015
2016 // presentation attribute (if presentation)
2017 bool bIsPresShape(false);
2018 bool bIsEmptyPresObj(false);
2019 OUString aStr;
2020
2021 switch(eShapeType)
2022 {
2024 {
2026 bIsPresShape = true;
2027 break;
2028 }
2030 {
2032 bIsPresShape = true;
2033 break;
2034 }
2036 {
2038 bIsPresShape = true;
2039 break;
2040 }
2042 {
2044 bIsPresShape = true;
2045 break;
2046 }
2048 {
2050 bIsPresShape = true;
2051 break;
2052 }
2054 {
2056 bIsPresShape = true;
2057 break;
2058 }
2060 {
2062 bIsPresShape = true;
2063 break;
2064 }
2066 {
2068 bIsPresShape = true;
2069 break;
2070 }
2071 default:
2072 break;
2073 }
2074
2075 // Transformation
2076 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2077
2078 if(bIsPresShape)
2079 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
2080
2081 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2083 XML_FRAME, bCreateNewline, true );
2084
2085 // evtl. corner radius?
2086 sal_Int32 nCornerRadius(0);
2087 xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
2088 if(nCornerRadius)
2089 {
2090 OUStringBuffer sStringBuffer;
2092 nCornerRadius);
2093 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
2094 }
2095
2096 {
2097 // write text-box
2099 if(!bIsEmptyPresObj)
2100 ImpExportText( xShape );
2101 }
2102
2103 ImpExportDescription( xShape ); // #i68101#
2104 ImpExportEvents( xShape );
2105 ImpExportGluePoints( xShape );
2106
2107}
2108
2110 const uno::Reference< drawing::XShape >& xShape,
2111 XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
2112{
2113 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2114 if(!xPropSet.is())
2115 return;
2116
2117 // Transformation
2118 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2119
2120 // evtl. corner radius?
2121 sal_Int32 nCornerRadius(0);
2122 xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
2123 if(nCornerRadius)
2124 {
2125 OUStringBuffer sStringBuffer;
2127 nCornerRadius);
2128 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
2129 }
2130
2131 // write rectangle
2132 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2133 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_RECT, bCreateNewline, true);
2134
2135 ImpExportDescription( xShape ); // #i68101#
2136 ImpExportEvents( xShape );
2137 ImpExportGluePoints( xShape );
2138 ImpExportText( xShape );
2139}
2140
2142 const uno::Reference< drawing::XShape >& xShape,
2143 XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
2144{
2145 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2146 if(!xPropSet.is())
2147 return;
2148
2149 OUString aStr;
2150 OUStringBuffer sStringBuffer;
2151 awt::Point aStart(0,0);
2152 awt::Point aEnd(1,1);
2153
2154 // #85920# use 'Geometry' to get the points of the line
2155 // since this slot take anchor pos into account.
2156
2157 // get matrix
2159 ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
2160
2161 // decompose and correct about pRefPoint
2162 ::basegfx::B2DTuple aTRScale;
2163 double fTRShear(0.0);
2164 double fTRRotate(0.0);
2165 ::basegfx::B2DTuple aTRTranslate;
2166 ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
2167
2168 // create base position
2169 awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
2170
2171 if (xPropSet->getPropertySetInfo()->hasPropertyByName("Geometry"))
2172 {
2173 // get the two points
2174 uno::Any aAny(xPropSet->getPropertyValue("Geometry"));
2175 if (auto pSourcePolyPolygon
2176 = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
2177 {
2178 if (pSourcePolyPolygon->getLength() > 0)
2179 {
2180 const drawing::PointSequence& rInnerSequence = (*pSourcePolyPolygon)[0];
2181 if (rInnerSequence.hasElements())
2182 {
2183 const awt::Point& rPoint = rInnerSequence[0];
2184 aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2185 }
2186 if (rInnerSequence.getLength() > 1)
2187 {
2188 const awt::Point& rPoint = rInnerSequence[1];
2189 aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2190 }
2191 }
2192 }
2193 }
2194
2195 if( nFeatures & XMLShapeExportFlags::X )
2196 {
2197 // svg: x1
2199 aStart.X);
2200 aStr = sStringBuffer.makeStringAndClear();
2202 }
2203 else
2204 {
2205 aEnd.X -= aStart.X;
2206 }
2207
2208 if( nFeatures & XMLShapeExportFlags::Y )
2209 {
2210 // svg: y1
2212 aStart.Y);
2213 aStr = sStringBuffer.makeStringAndClear();
2215 }
2216 else
2217 {
2218 aEnd.Y -= aStart.Y;
2219 }
2220
2221 // svg: x2
2223 aEnd.X);
2224 aStr = sStringBuffer.makeStringAndClear();
2226
2227 // svg: y2
2229 aEnd.Y);
2230 aStr = sStringBuffer.makeStringAndClear();
2232
2233 // write line
2234 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2235 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, true);
2236
2237 ImpExportDescription( xShape ); // #i68101#
2238 ImpExportEvents( xShape );
2239 ImpExportGluePoints( xShape );
2240 ImpExportText( xShape );
2241
2242}
2243
2245 const uno::Reference< drawing::XShape >& xShape,
2246 XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
2247{
2248 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2249 if(!xPropSet.is())
2250 return;
2251
2252 // get size to decide between Circle and Ellipse
2253 awt::Size aSize = xShape->getSize();
2254 sal_Int32 nRx((aSize.Width + 1) / 2);
2255 sal_Int32 nRy((aSize.Height + 1) / 2);
2256 bool bCircle(nRx == nRy);
2257
2258 // Transformation
2259 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2260
2261 drawing::CircleKind eKind = drawing::CircleKind_FULL;
2262 xPropSet->getPropertyValue("CircleKind") >>= eKind;
2263 if( eKind != drawing::CircleKind_FULL )
2264 {
2265 OUStringBuffer sStringBuffer;
2266 sal_Int32 nStartAngle = 0;
2267 sal_Int32 nEndAngle = 0;
2268 xPropSet->getPropertyValue("CircleStartAngle") >>= nStartAngle;
2269 xPropSet->getPropertyValue("CircleEndAngle") >>= nEndAngle;
2270
2271 const double dStartAngle = nStartAngle / 100.0;
2272 const double dEndAngle = nEndAngle / 100.0;
2273
2274 // export circle kind
2276 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
2277
2278 // export start angle
2279 ::sax::Converter::convertDouble( sStringBuffer, dStartAngle );
2280 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
2281
2282 // export end angle
2283 ::sax::Converter::convertDouble( sStringBuffer, dEndAngle );
2284 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
2285 }
2286
2287 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2288
2289 // write ellipse or circle
2291 bCircle ? XML_CIRCLE : XML_ELLIPSE,
2292 bCreateNewline, true);
2293
2294 ImpExportDescription( xShape ); // #i68101#
2295 ImpExportEvents( xShape );
2296 ImpExportGluePoints( xShape );
2297 ImpExportText( xShape );
2298
2299}
2300
2302 const uno::Reference< drawing::XShape >& xShape,
2303 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
2304{
2305 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2306 if(!xPropSet.is())
2307 return;
2308
2309 bool bBezier(eShapeType == XmlShapeType::DrawClosedBezierShape
2310 || eShapeType == XmlShapeType::DrawOpenBezierShape);
2311
2312 // get matrix
2314 ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
2315
2316 // decompose and correct about pRefPoint
2317 ::basegfx::B2DTuple aTRScale;
2318 double fTRShear(0.0);
2319 double fTRRotate(0.0);
2320 ::basegfx::B2DTuple aTRTranslate;
2321 ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
2322
2323 // use features and write
2324 ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
2325
2326 // create and export ViewBox
2327 awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
2328 SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
2330
2331 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2332
2333 // prepare name (with most used)
2335
2336 uno::Any aAny( xPropSet->getPropertyValue("Geometry") );
2337 basegfx::B2DPolyPolygon aPolyPolygon;
2338
2339 // tdf#145240 the Any can contain PolyPolygonBezierCoords or PointSequenceSequence
2340 // (see OWN_ATTR_BASE_GEOMETRY in SvxShapePolyPolygon::getPropertyValueImpl),
2341 // so be more flexible in interpreting it. Try to access bezier first:
2342 {
2343 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
2344
2345 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
2346 {
2347 aPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*pSourcePolyPolygon);
2348 }
2349 }
2350
2351 // if received no data, try to access point sequence second:
2352 if(0 == aPolyPolygon.count())
2353 {
2354 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny);
2355
2356 if(pSourcePolyPolygon)
2357 {
2358 aPolyPolygon = basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(*pSourcePolyPolygon);
2359 }
2360 }
2361
2362 if(aPolyPolygon.count())
2363 {
2364 if(!bBezier && !aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
2365 {
2366 // simple polygon shape, can be written as svg:points sequence
2367 const basegfx::B2DPolygon& aPolygon(aPolyPolygon.getB2DPolygon(0));
2368 const OUString aPointString(basegfx::utils::exportToSvgPoints(aPolygon));
2369
2370 // write point array
2372
2373 // set name
2374 eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE;
2375 }
2376 else
2377 {
2378 // complex polygon shape, write as svg:d
2379 const OUString aPolygonString(
2381 aPolyPolygon,
2382 true, // bUseRelativeCoordinates
2383 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
2384 true)); // bHandleRelativeNextPointCompatible
2385
2386 // write point array
2387 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
2388 }
2389 }
2390
2391 // write object, but after attributes are added since this call will
2392 // consume all of these added attributes and the destructor will close the
2393 // scope. Also before text is added; this may add sub-scopes as needed
2394 SvXMLElementExport aOBJ(
2395 mrExport,
2397 eName,
2398 bCreateNewline,
2399 true);
2400
2401 ImpExportDescription( xShape ); // #i68101#
2402 ImpExportEvents( xShape );
2403 ImpExportGluePoints( xShape );
2404 ImpExportText( xShape );
2405
2406}
2407
2408namespace
2409{
2410
2411OUString getNameFromStreamURL(std::u16string_view rURL)
2412{
2413 static constexpr std::u16string_view sPackageURL(u"vnd.sun.star.Package:");
2414
2415 OUString sResult;
2416
2417 if (o3tl::starts_with(rURL, sPackageURL))
2418 {
2419 std::u16string_view sRequestedName = rURL.substr(sPackageURL.size());
2420 size_t nLastIndex = sRequestedName.rfind('/') + 1;
2421 if ((nLastIndex > 0) && (nLastIndex < sRequestedName.size()))
2422 sRequestedName = sRequestedName.substr(nLastIndex);
2423 nLastIndex = sRequestedName.rfind('.');
2424 if (nLastIndex != std::u16string_view::npos)
2425 sRequestedName = sRequestedName.substr(0, nLastIndex);
2426 if (!sRequestedName.empty())
2427 sResult = sRequestedName;
2428 }
2429
2430 return sResult;
2431}
2432
2433} // end anonymous namespace
2434
2436 const uno::Reference< drawing::XShape >& xShape,
2437 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
2438{
2439 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2440 if(!xPropSet.is())
2441 return;
2442
2443 bool bIsEmptyPresObj = false;
2444
2445 // Transformation
2446 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2447
2448 if(eShapeType == XmlShapeType::PresGraphicObjectShape)
2449 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_GRAPHIC) );
2450
2451 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2453 XML_FRAME, bCreateNewline, true );
2454
2455 if (!bIsEmptyPresObj)
2456 {
2457 uno::Reference<graphic::XGraphic> xGraphic;
2458 OUString sOutMimeType;
2459
2460 {
2461 OUString aStreamURL;
2462 xPropSet->getPropertyValue("GraphicStreamURL") >>= aStreamURL;
2463 OUString sRequestedName = getNameFromStreamURL(aStreamURL);
2464
2465 xPropSet->getPropertyValue("Graphic") >>= xGraphic;
2466
2467 OUString sInternalURL;
2468
2469 if (xGraphic.is())
2470 sInternalURL = mrExport.AddEmbeddedXGraphic(xGraphic, sOutMimeType, sRequestedName);
2471
2472 if (!sInternalURL.isEmpty())
2473 {
2474 // apply possible changed stream URL to embedded image object
2475 if (!sRequestedName.isEmpty())
2476 {
2477 OUString newStreamURL = "vnd.sun.star.Package:";
2478 if (sInternalURL[0] == '#')
2479 {
2480 newStreamURL += sInternalURL.subView(1, sInternalURL.getLength() - 1);
2481 }
2482 else
2483 {
2484 newStreamURL += sInternalURL;
2485 }
2486
2487 if (newStreamURL != aStreamURL)
2488 {
2489 xPropSet->setPropertyValue("GraphicStreamURL", uno::Any(newStreamURL));
2490 }
2491 }
2492
2497 }
2498 }
2499
2500 {
2501 if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
2502 {
2503 if (sOutMimeType.isEmpty())
2504 {
2505 GetExport().GetGraphicMimeTypeFromStream(xGraphic, sOutMimeType);
2506 }
2507 if (!sOutMimeType.isEmpty())
2508 { // ODF 1.3 OFFICE-3943
2510 SvtSaveOptions::ODFSVER_013 <= GetExport().getSaneDefaultVersion()
2513 "mime-type", sOutMimeType);
2514 }
2515 }
2516
2518
2519 // optional office:binary-data
2520 if (xGraphic.is())
2521 {
2523 }
2524 if (!bIsEmptyPresObj)
2525 ImpExportText(xShape);
2526 }
2527
2528 //Resolves: fdo#62461 put preferred image first above, followed by
2529 //fallback here
2530 const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get();
2531 if( !bIsEmptyPresObj && bAddReplacementImages)
2532 {
2533 uno::Reference<graphic::XGraphic> xReplacementGraphic;
2534 xPropSet->getPropertyValue("ReplacementGraphic") >>= xReplacementGraphic;
2535
2536 // If there is no url, then the graphic is empty
2537 if (xReplacementGraphic.is())
2538 {
2539 OUString aMimeType;
2540 const OUString aHref = mrExport.AddEmbeddedXGraphic(xReplacementGraphic, aMimeType);
2541
2542 if (aMimeType.isEmpty())
2543 mrExport.GetGraphicMimeTypeFromStream(xReplacementGraphic, aMimeType);
2544
2545 if (!aHref.isEmpty())
2546 {
2551 }
2552
2553 if (!aMimeType.isEmpty() && GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
2554 { // ODF 1.3 OFFICE-3943
2556 SvtSaveOptions::ODFSVER_013 <= GetExport().getSaneDefaultVersion()
2559 "mime-type", aMimeType);
2560 }
2561
2563
2564 // optional office:binary-data
2565 mrExport.AddEmbeddedXGraphicAsBase64(xReplacementGraphic);
2566 }
2567 }
2568 }
2569
2570 ImpExportEvents( xShape );
2571 ImpExportGluePoints( xShape );
2572
2573 // image map
2574 GetExport().GetImageMapExport().Export( xPropSet );
2575 ImpExportDescription( xShape ); // #i68101#
2576
2577 // Signature Line, QR Code - needs to be after the images!
2578 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
2579 {
2580 ImpExportSignatureLine(xShape);
2581 ImpExportQRCode(xShape);
2582 }
2583}
2584
2586 const uno::Reference< drawing::XShape >& xShape,
2587 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint,
2588 comphelper::AttributeList* pAttrList )
2589{
2590 ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
2591}
2592
2594 const uno::Reference< drawing::XShape >& xShape,
2595 XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
2596{
2597 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2598 if(xPropSet.is())
2599 {
2600 // Transformation
2601 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2602 }
2603
2604 uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
2605 SAL_WARN_IF( !xControl.is(), "xmloff", "Control shape is not supporting XControlShape" );
2606 if( xControl.is() )
2607 {
2608 uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
2609 SAL_WARN_IF( !xControlModel.is(), "xmloff", "Control shape has not XControlModel" );
2610 if( xControlModel.is() )
2611 {
2612 OUString sControlId = mrExport.GetFormExport()->getControlId( xControlModel );
2614 }
2615 }
2616
2617 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2618 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, true);
2619
2620 ImpExportDescription( xShape ); // #i68101#
2621}
2622
2624 const uno::Reference< drawing::XShape >& xShape,
2625 XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
2626{
2627 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
2628
2629 OUString aStr;
2630 OUStringBuffer sStringBuffer;
2631
2632 // export connection kind
2633 drawing::ConnectorType eType = drawing::ConnectorType_STANDARD;
2634 uno::Any aAny = xProps->getPropertyValue("EdgeKind");
2635 aAny >>= eType;
2636
2637 if( eType != drawing::ConnectorType_STANDARD )
2638 {
2640 aStr = sStringBuffer.makeStringAndClear();
2642 }
2643
2644 // export line skew
2645 sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
2646
2647 aAny = xProps->getPropertyValue("EdgeLine1Delta");
2648 aAny >>= nDelta1;
2649 aAny = xProps->getPropertyValue("EdgeLine2Delta");
2650 aAny >>= nDelta2;
2651 aAny = xProps->getPropertyValue("EdgeLine3Delta");
2652 aAny >>= nDelta3;
2653
2654 if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
2655 {
2657 nDelta1);
2658 if( nDelta2 != 0 || nDelta3 != 0 )
2659 {
2660 sStringBuffer.append( ' ' );
2662 nDelta2);
2663 if( nDelta3 != 0 )
2664 {
2665 sStringBuffer.append( ' ' );
2667 sStringBuffer, nDelta3);
2668 }
2669 }
2670
2671 aStr = sStringBuffer.makeStringAndClear();
2673 }
2674
2675 // export start and end point
2676 awt::Point aStart(0,0);
2677 awt::Point aEnd(1,1);
2678
2679 /* Get <StartPositionInHoriL2R> and
2680 <EndPositionInHoriL2R>, if they exist and if the document is exported
2681 into the OpenOffice.org file format.
2682 These properties only exist at service css::text::Shape - the
2683 Writer UNO service for shapes.
2684 This code is needed, because the positioning attributes in the
2685 OpenOffice.org file format are given in horizontal left-to-right layout
2686 regardless the layout direction the shape is in. In the OASIS Open Office
2687 file format the positioning attributes are correctly given in the layout
2688 direction the shape is in. Thus, this code provides the conversion from
2689 the OASIS Open Office file format to the OpenOffice.org file format. (#i36248#)
2690 */
2691 if ( !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
2692 xProps->getPropertySetInfo()->hasPropertyByName("StartPositionInHoriL2R") &&
2693 xProps->getPropertySetInfo()->hasPropertyByName("EndPositionInHoriL2R") )
2694 {
2695 xProps->getPropertyValue("StartPositionInHoriL2R") >>= aStart;
2696 xProps->getPropertyValue("EndPositionInHoriL2R") >>= aEnd;
2697 }
2698 else
2699 {
2700 xProps->getPropertyValue("StartPosition") >>= aStart;
2701 xProps->getPropertyValue("EndPosition") >>= aEnd;
2702 }
2703
2704 if( pRefPoint )
2705 {
2706 aStart.X -= pRefPoint->X;
2707 aStart.Y -= pRefPoint->Y;
2708 aEnd.X -= pRefPoint->X;
2709 aEnd.Y -= pRefPoint->Y;
2710 }
2711
2712 if( nFeatures & XMLShapeExportFlags::X )
2713 {
2714 // svg: x1
2716 aStart.X);
2717 aStr = sStringBuffer.makeStringAndClear();
2719 }
2720 else
2721 {
2722 aEnd.X -= aStart.X;
2723 }
2724
2725 if( nFeatures & XMLShapeExportFlags::Y )
2726 {
2727 // svg: y1
2729 aStart.Y);
2730 aStr = sStringBuffer.makeStringAndClear();
2732 }
2733 else
2734 {
2735 aEnd.Y -= aStart.Y;
2736 }
2737
2738 // svg: x2
2739 mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.X);
2740 aStr = sStringBuffer.makeStringAndClear();
2742
2743 // svg: y2
2744 mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.Y);
2745 aStr = sStringBuffer.makeStringAndClear();
2747
2748 // #i39320#
2749 uno::Reference< uno::XInterface > xRefS;
2750 uno::Reference< uno::XInterface > xRefE;
2751
2752 // export start connection
2753 xProps->getPropertyValue("StartShape") >>= xRefS;
2754 if( xRefS.is() )
2755 {
2756 const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS );
2758
2759 aAny = xProps->getPropertyValue("StartGluePointIndex");
2760 sal_Int32 nGluePointId = 0;
2761 if( aAny >>= nGluePointId )
2762 {
2763 if( nGluePointId != -1 )
2764 {
2765 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::number( nGluePointId ));
2766 }
2767 }
2768 }
2769
2770 // export end connection
2771 xProps->getPropertyValue("EndShape") >>= xRefE;
2772 if( xRefE.is() )
2773 {
2774 const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE );
2776
2777 aAny = xProps->getPropertyValue("EndGluePointIndex");
2778 sal_Int32 nGluePointId = 0;
2779 if( aAny >>= nGluePointId )
2780 {
2781 if( nGluePointId != -1 )
2782 {
2783 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::number( nGluePointId ));
2784 }
2785 }
2786 }
2787
2788 // get PolygonBezier
2789 aAny = xProps->getPropertyValue("PolyPolygonBezier");
2790 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
2791 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
2792 {
2793 const basegfx::B2DPolyPolygon aPolyPolygon(
2795 *pSourcePolyPolygon));
2796 const OUString aPolygonString(
2798 aPolyPolygon,
2799 true, // bUseRelativeCoordinates
2800 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
2801 true)); // bHandleRelativeNextPointCompatible
2802
2803 // write point array
2804 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
2805 }
2806
2807 // get matrix
2809 ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xProps);
2810
2811 // decompose and correct about pRefPoint
2812 ::basegfx::B2DTuple aTRScale;
2813 double fTRShear(0.0);
2814 double fTRRotate(0.0);
2815 ::basegfx::B2DTuple aTRTranslate;
2816 ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear,
2817 fTRRotate, aTRTranslate, pRefPoint);
2818
2819 // fdo#49678: create and export ViewBox
2820 awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
2821 SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
2823
2824 // write connector shape. Add Export later.
2825 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2826 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, true);
2827
2828 ImpExportDescription( xShape ); // #i68101#
2829 ImpExportEvents( xShape );
2830 ImpExportGluePoints( xShape );
2831 ImpExportText( xShape );
2832}
2833
2835 const uno::Reference< drawing::XShape >& xShape,
2836 XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point const * pRefPoint /* = NULL */)
2837{
2838 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
2839
2840 OUString aStr;
2841 OUStringBuffer sStringBuffer;
2842
2843 // export start and end point
2844 awt::Point aStart(0,0);
2845 awt::Point aEnd(1,1);
2846
2847 /* Get <StartPositionInHoriL2R> and
2848 <EndPositionInHoriL2R>, if they exist and if the document is exported
2849 into the OpenOffice.org file format.
2850 These properties only exist at service css::text::Shape - the
2851 Writer UNO service for shapes.
2852 This code is needed, because the positioning attributes in the
2853 OpenOffice.org file format are given in horizontal left-to-right layout
2854 regardless the layout direction the shape is in. In the OASIS Open Office
2855 file format the positioning attributes are correctly given in the layout
2856 direction the shape is in. Thus, this code provides the conversion from
2857 the OASIS Open Office file format to the OpenOffice.org file format. (#i36248#)
2858 */
2859 if ( !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
2860 xProps->getPropertySetInfo()->hasPropertyByName("StartPositionInHoriL2R") &&
2861 xProps->getPropertySetInfo()->hasPropertyByName("EndPositionInHoriL2R") )
2862 {
2863 xProps->getPropertyValue("StartPositionInHoriL2R") >>= aStart;
2864 xProps->getPropertyValue("EndPositionInHoriL2R") >>= aEnd;
2865 }
2866 else
2867 {
2868 xProps->getPropertyValue("StartPosition") >>= aStart;
2869 xProps->getPropertyValue("EndPosition") >>= aEnd;
2870 }
2871
2872 if( pRefPoint )
2873 {
2874 aStart.X -= pRefPoint->X;
2875 aStart.Y -= pRefPoint->Y;
2876 aEnd.X -= pRefPoint->X;
2877 aEnd.Y -= pRefPoint->Y;
2878 }
2879
2880 if( nFeatures & XMLShapeExportFlags::X )
2881 {
2882 // svg: x1
2884 aStart.X);
2885 aStr = sStringBuffer.makeStringAndClear();
2887 }
2888 else
2889 {
2890 aEnd.X -= aStart.X;
2891 }
2892
2893 if( nFeatures & XMLShapeExportFlags::Y )
2894 {
2895 // svg: y1
2897 aStart.Y);
2898 aStr = sStringBuffer.makeStringAndClear();
2900 }
2901 else
2902 {
2903 aEnd.Y -= aStart.Y;
2904 }
2905
2906 // svg: x2
2907 mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.X);
2908 aStr = sStringBuffer.makeStringAndClear();
2910
2911 // svg: y2
2912 mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.Y);
2913 aStr = sStringBuffer.makeStringAndClear();
2915
2916 // write measure shape
2917 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2918 SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, true);
2919
2920 ImpExportDescription( xShape ); // #i68101#
2921 ImpExportEvents( xShape );
2922 ImpExportGluePoints( xShape );
2923
2924 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
2925 if( xText.is() )
2926 mrExport.GetTextParagraphExport()->exportText( xText );
2927}
2928
2930 const uno::Reference< drawing::XShape >& xShape,
2931 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */,
2932 comphelper::AttributeList* pAttrList /* = NULL */ )
2933{
2934 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2935 uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
2936
2937 SAL_WARN_IF( !xPropSet.is() || !xNamed.is(), "xmloff", "ole shape is not implementing needed interfaces");
2938 if(!(xPropSet.is() && xNamed.is()))
2939 return;
2940
2941 // Transformation
2942 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
2943
2944 bool bIsEmptyPresObj = false;
2945
2946 // presentation settings
2947 if(eShapeType == XmlShapeType::PresOLE2Shape)
2948 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_OBJECT) );
2949 else if(eShapeType == XmlShapeType::PresChartShape)
2950 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_CHART) );
2951 else if(eShapeType == XmlShapeType::PresSheetShape)
2952 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_TABLE) );
2953
2954 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
2955 bool bExportEmbedded(mrExport.getExportFlags() & SvXMLExportFlags::EMBEDDED);
2956 OUString sPersistName;
2958 XML_FRAME, bCreateNewline, true );
2959
2960 if (!bIsEmptyPresObj)
2961 {
2962 if (pAttrList)
2963 {
2964 mrExport.AddAttributeList(pAttrList);
2965 }
2966
2967 OUString sClassId;
2968 OUString sURL;
2969 bool bInternal = false;
2970 xPropSet->getPropertyValue("IsInternal") >>= bInternal;
2971
2972 {
2973
2974 if ( bInternal )
2975 {
2976 // OOo internal links have no storage persistence, URL is stored in the XML file
2977 // the result LinkURL is empty in case the object is not a link
2978 xPropSet->getPropertyValue("LinkURL") >>= sURL;
2979 }
2980
2981 xPropSet->getPropertyValue("PersistName") >>= sPersistName;
2982 if ( sURL.isEmpty() )
2983 {
2984 if( !sPersistName.isEmpty() )
2985 {
2986 sURL = "vnd.sun.star.EmbeddedObject:" + sPersistName;
2987 }
2988 }
2989
2990 if( !bInternal )
2991 xPropSet->getPropertyValue("CLSID") >>= sClassId;
2992
2993 if( !sClassId.isEmpty() )
2995
2996 if(!bExportEmbedded)
2997 {
2998 // xlink:href
2999 if( !sURL.isEmpty() )
3000 {
3001 // #96717# in theorie, if we don't have a URL we shouldn't even
3002 // export this OLE shape. But practically it's too risky right now
3003 // to change this so we better dispose this on load
3004 sURL = mrExport.AddEmbeddedObject( sURL );
3005
3010 }
3011 else
3012 {
3013 // tdf#153179 Export the preview graphic of the object if the object is missing.
3014 uno::Reference<graphic::XGraphic> xGraphic;
3015 xPropSet->getPropertyValue("Graphic") >>= xGraphic;
3016
3017 if (xGraphic.is())
3018 {
3019 OUString aMimeType;
3020 const OUString aHref = mrExport.AddEmbeddedXGraphic(xGraphic, aMimeType);
3021
3022 if (aMimeType.isEmpty())
3024
3025 if (!aHref.isEmpty())
3026 {
3031 }
3032
3033 if (!aMimeType.isEmpty()
3034 && GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
3035 { // ODF 1.3 OFFICE-3943
3037 <= GetExport().getSaneDefaultVersion()
3040 "mime-type", aMimeType);
3041 }
3042
3044 true);
3045
3046 // optional office:binary-data
3048
3049 ImpExportEvents(xShape);
3050 ImpExportGluePoints(xShape);
3051 ImpExportDescription(xShape);
3052
3053 return;
3054 }
3055 }
3056 }
3057 }
3058
3059 enum XMLTokenEnum eElem = sClassId.isEmpty() ? XML_OBJECT : XML_OBJECT_OLE ;
3060 SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, true, true );
3061
3062 // tdf#112547 export text as child of draw:object, where import expects it
3063 if (!bIsEmptyPresObj && supportsText(eShapeType))
3064 {
3065 // #i118485# Add text export, the draw OLE shape allows text now
3067 }
3068
3069 if(bExportEmbedded && !bIsEmptyPresObj)
3070 {
3071 if(bInternal)
3072 {
3073 // embedded XML
3074 uno::Reference< lang::XComponent > xComp;
3075 xPropSet->getPropertyValue("Model") >>= xComp;
3076 SAL_WARN_IF( !xComp.is(), "xmloff", "no xModel for own OLE format" );
3078 }
3079 else
3080 {
3081 // embed as Base64
3082 // this is an alien object ( currently MSOLE is the only supported type of such objects )
3083 // in case it is not an OASIS format the object should be asked to store replacement image if possible
3084
3085 OUString sURLRequest( sURL );
3087 sURLRequest += "?oasis=false";
3088 mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
3089 }
3090 }
3091 }
3092 if( !bIsEmptyPresObj )
3093 {
3094 OUString sURL = XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE + sPersistName;
3095 if( !bExportEmbedded )
3096 {
3097 sURL = GetExport().AddEmbeddedObject( sURL );
3102 }
3103
3105 XML_IMAGE, false, true );
3106
3107 if( bExportEmbedded )
3109 }
3110
3111 ImpExportEvents( xShape );
3112 ImpExportGluePoints( xShape );
3113 ImpExportDescription( xShape ); // #i68101#
3114
3115}
3116
3118 const uno::Reference< drawing::XShape >& xShape,
3119 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
3120{
3121 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3122 if(!xPropSet.is())
3123 return;
3124
3125 // #86163# Transformation
3126 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3127
3128 // export page number used for this page
3129 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
3130 static constexpr OUStringLiteral aPageNumberStr(u"PageNumber");
3131 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
3132 {
3133 sal_Int32 nPageNumber = 0;
3134 xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
3135 if( nPageNumber )
3136 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::number(nPageNumber));
3137 }
3138
3139 // a presentation page shape, normally used on notes pages only. If
3140 // it is used not as presentation shape, it may have been created with
3141 // copy-paste exchange between draw and impress (this IS possible...)
3142 if(eShapeType == XmlShapeType::PresPageShape)
3143 {
3145 XML_PAGE);
3146 }
3147
3148 // write Page shape
3149 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3151}
3152
3154 const uno::Reference< drawing::XShape >& xShape,
3155 XMLShapeExportFlags nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
3156{
3157 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3158 if(!xPropSet.is())
3159 return;
3160
3161 // Transformation
3162 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3163
3164 // evtl. corner radius?
3165 sal_Int32 nCornerRadius(0);
3166 xPropSet->getPropertyValue("CornerRadius") >>= nCornerRadius;
3167 if(nCornerRadius)
3168 {
3169 OUStringBuffer sStringBuffer;
3171 nCornerRadius);
3172 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
3173 }
3174
3175 awt::Point aCaptionPoint;
3176 xPropSet->getPropertyValue("CaptionPoint") >>= aCaptionPoint;
3177
3179 aCaptionPoint.X);
3182 aCaptionPoint.Y);
3184
3185 // write Caption shape. Add export later.
3186 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3187 bool bAnnotation( (nFeatures & XMLShapeExportFlags::ANNOTATION) == XMLShapeExportFlags::ANNOTATION );
3188
3190 (bAnnotation ? XML_NAMESPACE_OFFICE
3192 (bAnnotation ? XML_ANNOTATION : XML_CAPTION),
3193 bCreateNewline, true );
3194
3195 ImpExportDescription( xShape ); // #i68101#
3196 ImpExportEvents( xShape );
3197 ImpExportGluePoints( xShape );
3198 if( bAnnotation )
3200 ImpExportText( xShape );
3201
3202}
3203
3205 const uno::Reference< drawing::XShape >& xShape,
3206 XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
3207{
3208 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3209 if(!xPropSet.is())
3210 return;
3211
3212 // Transformation
3213 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3214
3215 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3217 XML_FRAME, bCreateNewline, true );
3218
3219 // export frame url
3220 OUString aStr;
3221 xPropSet->getPropertyValue("FrameURL") >>= aStr;
3222 mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
3226
3227 // export name
3228 xPropSet->getPropertyValue("FrameName") >>= aStr;
3229 if( !aStr.isEmpty() )
3231
3232 // write floating frame
3233 {
3235 }
3236
3237 ImpExportDescription(xShape);
3238}
3239
3241 const uno::Reference< drawing::XShape >& xShape,
3242 XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
3243{
3244 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3245 if(!xPropSet.is())
3246 return;
3247
3248 // Transformation
3249 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3250
3251 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3253 XML_FRAME, bCreateNewline, true );
3254
3255 // export frame url
3256 OUString aStr;
3257 xPropSet->getPropertyValue("AppletCodeBase") >>= aStr;
3258 mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
3262
3263 // export draw:applet-name
3264 xPropSet->getPropertyValue("AppletName") >>= aStr;
3265 if( !aStr.isEmpty() )
3267
3268 // export draw:code
3269 xPropSet->getPropertyValue("AppletCode") >>= aStr;
3271
3272 // export draw:may-script
3273 bool bIsScript = false;
3274 xPropSet->getPropertyValue("AppletIsScript") >>= bIsScript;
3276
3277 {
3278 // write applet
3280
3281 // export parameters
3282 uno::Sequence< beans::PropertyValue > aCommands;
3283 xPropSet->getPropertyValue("AppletCommands") >>= aCommands;
3284 for( const auto& rCommand : std::as_const(aCommands) )
3285 {
3286 rCommand.Value >>= aStr;
3290 }
3291 }
3292
3293 ImpExportDescription(xShape);
3294}
3295
3297 const uno::Reference< drawing::XShape >& xShape,
3298 XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
3299{
3300 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3301 if(!xPropSet.is())
3302 return;
3303
3304 // Transformation
3305 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3306
3307 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3309 XML_FRAME, bCreateNewline, true );
3310
3311 // export plugin url
3312 OUString aStr;
3313 xPropSet->getPropertyValue("PluginURL") >>= aStr;
3314 mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
3318
3319 // export mime-type
3320 xPropSet->getPropertyValue("PluginMimeType") >>= aStr;
3321 if(!aStr.isEmpty())
3323
3324 {
3325 // write plugin
3327
3328 // export parameters
3329 uno::Sequence< beans::PropertyValue > aCommands;
3330 xPropSet->getPropertyValue("PluginCommands") >>= aCommands;
3331 for( const auto& rCommand : std::as_const(aCommands) )
3332 {
3333 rCommand.Value >>= aStr;
3337 }
3338 }
3339
3340 ImpExportDescription(xShape);
3341}
3342
3343static void lcl_CopyStream(
3344 uno::Reference<io::XInputStream> const& xInStream,
3345 uno::Reference<embed::XStorage> const& xTarget,
3346 OUString const& rPath, const OUString& rMimeType)
3347{
3349 uno::Reference<io::XStream> const xStream(
3351 embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, proxy));
3352 uno::Reference<io::XOutputStream> const xOutStream(
3353 (xStream.is()) ? xStream->getOutputStream() : nullptr);
3354 if (!xOutStream.is())
3355 {
3356 SAL_WARN("xmloff", "no output stream");
3357 throw uno::Exception("no output stream",nullptr);
3358 }
3359 uno::Reference< beans::XPropertySet > const xStreamProps(xStream,
3360 uno::UNO_QUERY);
3361 if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage
3362 xStreamProps->setPropertyValue("MediaType",
3363 uno::Any(rMimeType));
3364 xStreamProps->setPropertyValue( // turn off compression
3365 "Compressed",
3366 uno::Any(false));
3367 }
3369 xOutStream->closeOutput();
3370 proxy.commitStorages();
3371}
3372
3373static OUString
3375 uno::Reference<beans::XPropertySet> const& xPropSet,
3376 OUString const& rURL, const OUString& rMimeType)
3377{
3378 OUString urlPath;
3379 if (rURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:", &urlPath))
3380 {
3381 try // video is embedded
3382 {
3383 uno::Reference<embed::XStorage> const xTarget(
3384 rExport.GetTargetStorage(), uno::UNO_SET_THROW);
3385 uno::Reference<io::XInputStream> xInStream;
3386 xPropSet->getPropertyValue("PrivateStream")
3387 >>= xInStream;
3388
3389 if (!xInStream.is())
3390 {
3391 SAL_WARN("xmloff", "no input stream");
3392 return OUString();
3393 }
3394
3395 lcl_CopyStream(xInStream, xTarget, rURL, rMimeType);
3396
3397 return urlPath;
3398 }
3399 catch (uno::Exception const&)
3400 {
3401 TOOLS_INFO_EXCEPTION("xmloff", "exception while storing embedded media");
3402 }
3403 return OUString();
3404 }
3405 else
3406 {
3407 return rExport.GetRelativeReference(rURL); // linked
3408 }
3409}
3410
3411namespace
3412{
3413void ExportGraphicPreview(const uno::Reference<graphic::XGraphic>& xGraphic, SvXMLExport& rExport, const std::u16string_view& rPrefix, const std::u16string_view& rExtension, const OUString& rMimeType)
3414{
3415 const bool bExportEmbedded(rExport.getExportFlags() & SvXMLExportFlags::EMBEDDED);
3416
3417 if( xGraphic.is() ) try
3418 {
3419 uno::Reference< uno::XComponentContext > xContext = rExport.getComponentContext();
3420
3421 uno::Reference< embed::XStorage > xPictureStorage;
3422 uno::Reference< embed::XStorage > xStorage;
3423 uno::Reference< io::XStream > xPictureStream;
3424
3425 OUString sPictureName;
3426 if( bExportEmbedded )
3427 {
3428 xPictureStream.set( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.comp.MemoryStream", xContext), uno::UNO_QUERY_THROW );
3429 }
3430 else
3431 {
3432 xStorage.set( rExport.GetTargetStorage(), uno::UNO_SET_THROW );
3433
3434 xPictureStorage.set( xStorage->openStorageElement( "Pictures" , ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
3435
3436 sal_Int32 nIndex = 0;
3437 do
3438 {
3439 sPictureName = rPrefix + OUString::number( ++nIndex ) + rExtension;
3440 }
3441 while( xPictureStorage->hasByName( sPictureName ) );
3442
3443 xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
3444 }
3445
3446 uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) );
3447 uno::Sequence< beans::PropertyValue > aArgs{
3448 comphelper::makePropertyValue("MimeType", rMimeType ),
3449 comphelper::makePropertyValue("OutputStream", xPictureStream->getOutputStream())
3450 };
3451 xProvider->storeGraphic( xGraphic, aArgs );
3452
3453 if( xPictureStorage.is() )
3454 {
3455 uno::Reference< embed::XTransactedObject > xTrans( xPictureStorage, uno::UNO_QUERY );
3456 if( xTrans.is() )
3457 xTrans->commit();
3458 }
3459
3460 if( !bExportEmbedded )
3461 {
3462 OUString sURL = "Pictures/" + sPictureName;
3463 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
3467 }
3468
3469 SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_IMAGE, false, true );
3470
3471 if( bExportEmbedded )
3472 {
3473 uno::Reference< io::XSeekableInputStream > xSeekable( xPictureStream, uno::UNO_QUERY_THROW );
3474 xSeekable->seek(0);
3475
3476 XMLBase64Export aBase64Exp( rExport );
3477 aBase64Exp.exportOfficeBinaryDataElement( uno::Reference < io::XInputStream >( xPictureStream, uno::UNO_QUERY_THROW ) );
3478 }
3479 }
3480 catch( uno::Exception const & )
3481 {
3482 DBG_UNHANDLED_EXCEPTION("xmloff.draw");
3483 }
3484}
3485}
3486
3488 const uno::Reference< drawing::XShape >& xShape,
3489 XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint)
3490{
3491 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3492 if(!xPropSet.is())
3493 return;
3494
3495 // Transformation
3496 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3497
3498 if(eShapeType == XmlShapeType::PresMediaShape)
3499 {
3501 }
3502 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3504 XML_FRAME, bCreateNewline, true );
3505
3506 // export media url
3507 OUString aMediaURL;
3508 xPropSet->getPropertyValue("MediaURL") >>= aMediaURL;
3509 OUString sMimeType;
3510 xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
3511
3512 OUString const persistentURL =
3513 lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType);
3514
3519
3520 // export mime-type
3522
3523 // write plugin
3524 auto pPluginOBJ = std::make_unique<SvXMLElementExport>(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & XMLShapeExportFlags::NO_WS ), true);
3525
3526 // export parameters
3527 static constexpr OUStringLiteral aFalseStr( u"false" );
3528 static constexpr OUStringLiteral aTrueStr( u"true" );
3529
3530 bool bLoop = false;
3531 static constexpr OUStringLiteral aLoopStr( u"Loop" );
3532 xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
3534 mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? OUString(aTrueStr) : OUString(aFalseStr) );
3535 delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
3536
3537 bool bMute = false;
3538 static constexpr OUStringLiteral aMuteStr( u"Mute" );
3539 xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
3541 mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? OUString(aTrueStr) : OUString(aFalseStr) );
3542 delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
3543
3544 sal_Int16 nVolumeDB = 0;
3545 xPropSet->getPropertyValue("VolumeDB") >>= nVolumeDB;
3547 mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::number( nVolumeDB ) );
3548 delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
3549
3550 media::ZoomLevel eZoom;
3551 OUString aZoomValue;
3552 xPropSet->getPropertyValue("Zoom") >>= eZoom;
3553 switch( eZoom )
3554 {
3555 case media::ZoomLevel_ZOOM_1_TO_4 : aZoomValue = "25%"; break;
3556 case media::ZoomLevel_ZOOM_1_TO_2 : aZoomValue = "50%"; break;
3557 case media::ZoomLevel_ORIGINAL : aZoomValue = "100%"; break;
3558 case media::ZoomLevel_ZOOM_2_TO_1 : aZoomValue = "200%"; break;
3559 case media::ZoomLevel_ZOOM_4_TO_1 : aZoomValue = "400%"; break;
3560 case media::ZoomLevel_FIT_TO_WINDOW: aZoomValue = "fit"; break;
3561 case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: aZoomValue = "fixedfit"; break;
3562 case media::ZoomLevel_FULLSCREEN : aZoomValue = "fullscreen"; break;
3563
3564 default:
3565 break;
3566 }
3567
3568 if( !aZoomValue.isEmpty() )
3569 {
3572 delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
3573 }
3574
3575 pPluginOBJ.reset();
3576
3577 uno::Reference<graphic::XGraphic> xGraphic;
3578 xPropSet->getPropertyValue("Graphic") >>= xGraphic;
3579 Graphic aGraphic(xGraphic);
3580 if (!aGraphic.IsNone())
3581 {
3582 // The media has a preview, export it.
3583 ExportGraphicPreview(xGraphic, mrExport, u"MediaPreview", u".png", "image/png");
3584 }
3585
3586 ImpExportDescription(xShape);
3587}
3588
3589void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShape >& xShape, XMLShapeExportFlags nFeatures, awt::Point* pRefPoint)
3590{
3591 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
3592 if(!(xShapes.is() && xShapes->getCount()))
3593 return;
3594
3595 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
3596 SAL_WARN_IF( !xPropSet.is(), "xmloff", "XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
3597 if( !xPropSet.is() )
3598 return;
3599
3600 // Transformation
3601 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
3602
3603 // 3d attributes
3604 export3DSceneAttributes( xPropSet );
3605
3606 // write 3DScene shape
3607 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
3608 SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DR3D, XML_SCENE, bCreateNewline, true);
3609
3610 ImpExportDescription( xShape ); // #i68101#
3611 ImpExportEvents( xShape );
3612
3613 // write 3DSceneLights
3614 export3DLamps( xPropSet );
3615
3616 // #89764# if export of position is suppressed for group shape,
3617 // positions of contained objects should be written relative to
3618 // the upper left edge of the group.
3619 awt::Point aUpperLeft;
3620
3621 if(!(nFeatures & XMLShapeExportFlags::POSITION))
3622 {
3623 nFeatures |= XMLShapeExportFlags::POSITION;
3624 aUpperLeft = xShape->getPosition();
3625 pRefPoint = &aUpperLeft;
3626 }
3627
3628 // write members
3629 exportShapes( xShapes, nFeatures, pRefPoint );
3630}
3631
3633 const uno::Reference< drawing::XShape >& xShape,
3634 XmlShapeType eShapeType)
3635{
3636 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3637 if(!xPropSet.is())
3638 return;
3639
3640 OUString aStr;
3641 OUStringBuffer sStringBuffer;
3642
3643 // transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
3644 uno::Any aAny = xPropSet->getPropertyValue("D3DTransformMatrix");
3645 drawing::HomogenMatrix aHomMat;
3646 aAny >>= aHomMat;
3647 SdXMLImExTransform3D aTransform;
3648 aTransform.AddHomogenMatrix(aHomMat);
3649 if(aTransform.NeedsAction())
3651
3652 switch(eShapeType)
3653 {
3655 {
3656 // minEdge
3657 aAny = xPropSet->getPropertyValue("D3DPosition");
3658 drawing::Position3D aPosition3D;
3659 aAny >>= aPosition3D;
3660 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3661
3662 // maxEdge
3663 aAny = xPropSet->getPropertyValue("D3DSize");
3664 drawing::Direction3D aDirection3D;
3665 aAny >>= aDirection3D;
3666 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3667
3668 // transform maxEdge from distance to pos
3669 aDir3D = aPos3D + aDir3D;
3670
3671 // write minEdge
3672 if(aPos3D != ::basegfx::B3DVector(-2500.0, -2500.0, -2500.0)) // write only when not default
3673 {
3674 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aPos3D);
3675 aStr = sStringBuffer.makeStringAndClear();
3677 }
3678
3679 // write maxEdge
3680 if(aDir3D != ::basegfx::B3DVector(2500.0, 2500.0, 2500.0)) // write only when not default
3681 {
3682 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aDir3D);
3683 aStr = sStringBuffer.makeStringAndClear();
3685 }
3686
3687 // write 3DCube shape
3688 // #i123542# Do this *after* the attributes are added, else these will be lost since opening
3689 // the scope will clear the global attribute list at the exporter
3691
3692 break;
3693 }
3695 {
3696 // Center
3697 aAny = xPropSet->getPropertyValue("D3DPosition");
3698 drawing::Position3D aPosition3D;
3699 aAny >>= aPosition3D;
3700 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3701
3702 // Size
3703 aAny = xPropSet->getPropertyValue("D3DSize");
3704 drawing::Direction3D aDirection3D;
3705 aAny >>= aDirection3D;
3706 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3707
3708 // write Center
3709 if(aPos3D != ::basegfx::B3DVector(0.0, 0.0, 0.0)) // write only when not default
3710 {
3711 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aPos3D);
3712 aStr = sStringBuffer.makeStringAndClear();
3714 }
3715
3716 // write Size
3717 if(aDir3D != ::basegfx::B3DVector(5000.0, 5000.0, 5000.0)) // write only when not default
3718 {
3719 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aDir3D);
3720 aStr = sStringBuffer.makeStringAndClear();
3722 }
3723
3724 // write 3DSphere shape
3725 // #i123542# Do this *after* the attributes are added, else these will be lost since opening
3726 // the scope will clear the global attribute list at the exporter
3728
3729 break;
3730 }
3733 {
3734 // write special 3DLathe/3DExtrude attributes, get 3D tools::PolyPolygon as drawing::PolyPolygonShape3D
3735 aAny = xPropSet->getPropertyValue("D3DPolyPolygon3D");
3736 drawing::PolyPolygonShape3D aUnoPolyPolygon3D;
3737 aAny >>= aUnoPolyPolygon3D;
3738
3739 // convert to 3D PolyPolygon
3740 const basegfx::B3DPolyPolygon aPolyPolygon3D(
3742 aUnoPolyPolygon3D));
3743
3744 // convert to 2D tools::PolyPolygon using identity 3D transformation (just grep X and Y)
3745 const basegfx::B3DHomMatrix aB3DHomMatrixFor2DConversion;
3746 const basegfx::B2DPolyPolygon aPolyPolygon(
3748 aPolyPolygon3D,
3749 aB3DHomMatrixFor2DConversion));
3750
3751 // get 2D range of it
3752 const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
3753
3754 // export ViewBox
3755 SdXMLImExViewBox aViewBox(
3756 aPolyPolygonRange.getMinX(),
3757 aPolyPolygonRange.getMinY(),
3758 aPolyPolygonRange.getWidth(),
3759 aPolyPolygonRange.getHeight());
3760
3762
3763 // prepare svg:d string
3764 const OUString aPolygonString(
3766 aPolyPolygon,
3767 true, // bUseRelativeCoordinates
3768 false, // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now
3769 true)); // bHandleRelativeNextPointCompatible
3770
3771 // write point array
3772 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
3773
3774 if(eShapeType == XmlShapeType::Draw3DLatheObject)
3775 {
3776 // write 3DLathe shape
3778 }
3779 else
3780 {
3781 // write 3DExtrude shape
3783 }
3784 break;
3785 }
3786 default:
3787 break;
3788 }
3789}
3790
3792void XMLShapeExport::export3DSceneAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet )
3793{
3794 OUString aStr;
3795 OUStringBuffer sStringBuffer;
3796
3797 // world transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
3798 uno::Any aAny = xPropSet->getPropertyValue("D3DTransformMatrix");
3799 drawing::HomogenMatrix aHomMat;
3800 aAny >>= aHomMat;
3801 SdXMLImExTransform3D aTransform;
3802 aTransform.AddHomogenMatrix(aHomMat);
3803 if(aTransform.NeedsAction())
3805
3806 // VRP, VPN, VUP
3807 aAny = xPropSet->getPropertyValue("D3DCameraGeometry");
3808 drawing::CameraGeometry aCamGeo;
3809 aAny >>= aCamGeo;
3810
3811 ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
3812 if(aVRP != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
3813 {
3814 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aVRP);
3815 aStr = sStringBuffer.makeStringAndClear();
3817 }
3818
3819 ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
3820 if(aVPN != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
3821 {
3822 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aVPN);
3823 aStr = sStringBuffer.makeStringAndClear();
3825 }
3826
3827 ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
3828 if(aVUP != ::basegfx::B3DVector(0.0, 1.0, 0.0)) // write only when not default
3829 {
3830 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aVUP);
3831 aStr = sStringBuffer.makeStringAndClear();
3833 }
3834
3835 // projection "D3DScenePerspective" drawing::ProjectionMode
3836 aAny = xPropSet->getPropertyValue("D3DScenePerspective");
3837 drawing::ProjectionMode aPrjMode;
3838 aAny >>= aPrjMode;
3839 if(aPrjMode == drawing::ProjectionMode_PARALLEL)
3841 else
3844
3845 // distance
3846 aAny = xPropSet->getPropertyValue("D3DSceneDistance");
3847 sal_Int32 nDistance = 0;
3848 aAny >>= nDistance;
3850 nDistance);
3851 aStr = sStringBuffer.makeStringAndClear();
3853
3854 // focalLength
3855 aAny = xPropSet->getPropertyValue("D3DSceneFocalLength");
3856 sal_Int32 nFocalLength = 0;
3857 aAny >>= nFocalLength;
3859 nFocalLength);
3860 aStr = sStringBuffer.makeStringAndClear();
3862
3863 // shadowSlant
3864 aAny = xPropSet->getPropertyValue("D3DSceneShadowSlant");
3865 sal_Int16 nShadowSlant = 0;
3866 aAny >>= nShadowSlant;
3867 mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, OUString::number(static_cast<sal_Int32>(nShadowSlant)));
3868
3869 // shadeMode
3870 aAny = xPropSet->getPropertyValue("D3DSceneShadeMode");
3871 drawing::ShadeMode aShadeMode;
3872 if(aAny >>= aShadeMode)
3873 {
3874 if(aShadeMode == drawing::ShadeMode_FLAT)
3876 else if(aShadeMode == drawing::ShadeMode_PHONG)
3878 else if(aShadeMode == drawing::ShadeMode_SMOOTH)
3880 else
3882 }
3883 else
3884 {
3885 // ShadeMode enum not there, write default
3887 }
3889
3890 // ambientColor
3891 aAny = xPropSet->getPropertyValue("D3DSceneAmbientColor");
3892 sal_Int32 nAmbientColor = 0;
3893 aAny >>= nAmbientColor;
3894 ::sax::Converter::convertColor(sStringBuffer, nAmbientColor);
3895 aStr = sStringBuffer.makeStringAndClear();
3897
3898 // lightingMode
3899 aAny = xPropSet->getPropertyValue("D3DSceneTwoSidedLighting");
3900 bool bTwoSidedLighting = false;
3901 aAny >>= bTwoSidedLighting;
3902 ::sax::Converter::convertBool(sStringBuffer, bTwoSidedLighting);
3903 aStr = sStringBuffer.makeStringAndClear();
3905}
3906
3908void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet )
3909{
3910 // write lamps 1..8 as content
3911 OUString aStr;
3912 OUStringBuffer sStringBuffer;
3913
3914 static constexpr OUStringLiteral aColorPropName(u"D3DSceneLightColor");
3915 static constexpr OUStringLiteral aDirectionPropName(u"D3DSceneLightDirection");
3916 static constexpr OUStringLiteral aLightOnPropName(u"D3DSceneLightOn");
3917
3918 ::basegfx::B3DVector aLightDirection;
3919 drawing::Direction3D aLightDir;
3920 bool bLightOnOff = false;
3921 for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
3922 {
3923 OUString aIndexStr = OUString::number( nLamp );
3924
3925 // lightcolor
3926 OUString aPropName = aColorPropName + aIndexStr;
3927 sal_Int32 nLightColor = 0;
3928 xPropSet->getPropertyValue( aPropName ) >>= nLightColor;
3929 ::sax::Converter::convertColor(sStringBuffer, nLightColor);
3930 aStr = sStringBuffer.makeStringAndClear();
3932
3933 // lightdirection
3934 aPropName = aDirectionPropName + aIndexStr;
3935 xPropSet->getPropertyValue(aPropName) >>= aLightDir;
3936 aLightDirection = ::basegfx::B3DVector(aLightDir.DirectionX, aLightDir.DirectionY, aLightDir.DirectionZ);
3937 SvXMLUnitConverter::convertB3DVector(sStringBuffer, aLightDirection);
3938 aStr = sStringBuffer.makeStringAndClear();
3940
3941 // lighton
3942 aPropName = aLightOnPropName + aIndexStr;
3943 xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
3944 ::sax::Converter::convertBool(sStringBuffer, bLightOnOff);
3945 aStr = sStringBuffer.makeStringAndClear();
3947
3948 // specular
3950 nLamp == 1 ? XML_TRUE : XML_FALSE);
3951
3952 // write light entry
3954 }
3955}
3956
3957
3958// using namespace css::io;
3959// using namespace ::xmloff::EnhancedCustomShapeToken;
3960
3961
3962static void ExportParameter( OUStringBuffer& rStrBuffer, const css::drawing::EnhancedCustomShapeParameter& rParameter )
3963{
3964 if ( !rStrBuffer.isEmpty() )
3965 rStrBuffer.append( ' ' );
3966 if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
3967 {
3968 double fNumber = 0.0;
3969 rParameter.Value >>= fNumber;
3970 ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true );
3971 }
3972 else
3973 {
3974 sal_Int32 nValue = 0;
3975 rParameter.Value >>= nValue;
3976
3977 switch( rParameter.Type )
3978 {
3979 case css::drawing::EnhancedCustomShapeParameterType::EQUATION :
3980 {
3981 rStrBuffer.append( "?f" + OUString::number( nValue ) );
3982 }
3983 break;
3984
3985 case css::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
3986 {
3987 rStrBuffer.append( '$' );
3988 rStrBuffer.append( nValue );
3989 }
3990 break;
3991
3992 case css::drawing::EnhancedCustomShapeParameterType::BOTTOM :
3993 rStrBuffer.append( GetXMLToken( XML_BOTTOM ) ); break;
3994 case css::drawing::EnhancedCustomShapeParameterType::RIGHT :
3995 rStrBuffer.append( GetXMLToken( XML_RIGHT ) ); break;
3996 case css::drawing::EnhancedCustomShapeParameterType::TOP :
3997 rStrBuffer.append( GetXMLToken( XML_TOP ) ); break;
3998 case css::drawing::EnhancedCustomShapeParameterType::LEFT :
3999 rStrBuffer.append( GetXMLToken( XML_LEFT ) ); break;
4000 case css::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
4001 rStrBuffer.append( GetXMLToken( XML_XSTRETCH ) ); break;
4002 case css::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
4003 rStrBuffer.append( GetXMLToken( XML_YSTRETCH ) ); break;
4004 case css::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
4005 rStrBuffer.append( GetXMLToken( XML_HASSTROKE ) ); break;
4006 case css::drawing::EnhancedCustomShapeParameterType::HASFILL :
4007 rStrBuffer.append( GetXMLToken( XML_HASFILL ) ); break;
4008 case css::drawing::EnhancedCustomShapeParameterType::WIDTH :
4009 rStrBuffer.append( GetXMLToken( XML_WIDTH ) ); break;
4010 case css::drawing::EnhancedCustomShapeParameterType::HEIGHT :
4011 rStrBuffer.append( GetXMLToken( XML_HEIGHT ) ); break;
4012 case css::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
4013 rStrBuffer.append( GetXMLToken( XML_LOGWIDTH ) ); break;
4014 case css::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
4015 rStrBuffer.append( GetXMLToken( XML_LOGHEIGHT ) ); break;
4016 default :
4017 rStrBuffer.append( nValue );
4018 }
4019 }
4020}
4021
4022static void ImpExportEquations( SvXMLExport& rExport, const uno::Sequence< OUString >& rEquations )
4023{
4024 sal_Int32 i;
4025 for ( i = 0; i < rEquations.getLength(); i++ )
4026 {
4027 OUString aStr= "f" + OUString::number( i );
4029
4030 aStr = rEquations[ i ];
4031 sal_Int32 nIndex = 0;
4032 do
4033 {
4034 nIndex = aStr.indexOf( '?', nIndex );
4035 if ( nIndex != -1 )
4036 {
4037 aStr = OUString::Concat(aStr.subView(0, nIndex + 1)) + "f"
4038 + aStr.subView(nIndex + 1, aStr.getLength() - nIndex - 1);
4039 nIndex++;
4040 }
4041 } while( nIndex != -1 );
4043 SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_EQUATION, true, true );
4044 }
4045}
4046
4047static void ImpExportHandles( SvXMLExport& rExport, const uno::Sequence< beans::PropertyValues >& rHandles )
4048{
4049 if ( !rHandles.hasElements() )
4050 return;
4051
4052 OUString aStr;
4053 OUStringBuffer aStrBuffer;
4054
4055 for ( const uno::Sequence< beans::PropertyValue >& rPropSeq : rHandles )
4056 {
4057 bool bPosition = false;
4058 for ( const beans::PropertyValue& rPropVal : rPropSeq )
4059 {
4060 switch( EASGet( rPropVal.Name ) )
4061 {
4062 case EAS_Position :
4063 {
4064 css::drawing::EnhancedCustomShapeParameterPair aPosition;
4065 if ( rPropVal.Value >>= aPosition )
4066 {
4067 ExportParameter( aStrBuffer, aPosition.First );
4068 ExportParameter( aStrBuffer, aPosition.Second );
4069 aStr = aStrBuffer.makeStringAndClear();
4071 bPosition = true;
4072 }
4073 }
4074 break;
4075 case EAS_MirroredX :
4076 {
4077 bool bMirroredX;
4078 if ( rPropVal.Value >>= bMirroredX )
4080 bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4081 }
4082 break;
4083 case EAS_MirroredY :
4084 {
4085 bool bMirroredY;
4086 if ( rPropVal.Value >>= bMirroredY )
4088 bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4089 }
4090 break;
4091 case EAS_Switched :
4092 {
4093 bool bSwitched;
4094 if ( rPropVal.Value >>= bSwitched )
4096 bSwitched ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4097 }
4098 break;
4099 case EAS_Polar :
4100 {
4101 css::drawing::EnhancedCustomShapeParameterPair aPolar;
4102 if ( rPropVal.Value >>= aPolar )
4103 {
4104 ExportParameter( aStrBuffer, aPolar.First );
4105 ExportParameter( aStrBuffer, aPolar.Second );
4106 aStr = aStrBuffer.makeStringAndClear();
4108 }
4109 }
4110 break;
4112 {
4113 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
4114 if ( rPropVal.Value >>= aRadiusRangeMinimum )
4115 {
4116 ExportParameter( aStrBuffer, aRadiusRangeMinimum );
4117 aStr = aStrBuffer.makeStringAndClear();
4119 }
4120 }
4121 break;
4123 {
4124 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
4125 if ( rPropVal.Value >>= aRadiusRangeMaximum )
4126 {
4127 ExportParameter( aStrBuffer, aRadiusRangeMaximum );
4128 aStr = aStrBuffer.makeStringAndClear();
4130 }
4131 }
4132 break;
4133 case EAS_RangeXMinimum :
4134 {
4135 css::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
4136 if ( rPropVal.Value >>= aXRangeMinimum )
4137 {
4138 ExportParameter( aStrBuffer, aXRangeMinimum );
4139 aStr = aStrBuffer.makeStringAndClear();
4141 }
4142 }
4143 break;
4144 case EAS_RangeXMaximum :
4145 {
4146 css::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
4147 if ( rPropVal.Value >>= aXRangeMaximum )
4148 {
4149 ExportParameter( aStrBuffer, aXRangeMaximum );
4150 aStr = aStrBuffer.makeStringAndClear();
4152 }
4153 }
4154 break;
4155 case EAS_RangeYMinimum :
4156 {
4157 css::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
4158 if ( rPropVal.Value >>= aYRangeMinimum )
4159 {
4160 ExportParameter( aStrBuffer, aYRangeMinimum );
4161 aStr = aStrBuffer.makeStringAndClear();
4163 }
4164 }
4165 break;
4166 case EAS_RangeYMaximum :
4167 {
4168 css::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
4169 if ( rPropVal.Value >>= aYRangeMaximum )
4170 {
4171 ExportParameter( aStrBuffer, aYRangeMaximum );
4172 aStr = aStrBuffer.makeStringAndClear();
4174 }
4175 }
4176 break;
4177 default:
4178 break;
4179 }
4180 }
4181 if ( bPosition )
4182 SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_HANDLE, true, true );
4183 else
4184 rExport.ClearAttrList();
4185 }
4186}
4187
4189 const uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
4190 const uno::Sequence< css::drawing::EnhancedCustomShapeSegment >& rSegments,
4191 bool bExtended = false )
4192{
4193
4194 OUString aStr;
4195 OUStringBuffer aStrBuffer;
4196 bool bNeedExtended = false;
4197
4198 sal_Int32 i, j, k, l;
4199
4200 sal_Int32 nCoords = rCoordinates.getLength();
4201 sal_Int32 nSegments = rSegments.getLength();
4202 bool bSimpleSegments = nSegments == 0;
4203 if ( bSimpleSegments )
4204 nSegments = 4;
4205 for ( j = i = 0; j < nSegments; j++ )
4206 {
4207 css::drawing::EnhancedCustomShapeSegment aSegment;
4208 if ( bSimpleSegments )
4209 {
4210 // if there are not enough segments we will default them
4211 switch( j )
4212 {
4213 case 0 :
4214 {
4215 aSegment.Count = 1;
4216 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
4217 }
4218 break;
4219 case 1 :
4220 {
4221 aSegment.Count = static_cast<sal_Int16>(std::min( nCoords - 1, sal_Int32(32767) ));
4222 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4223 }
4224 break;
4225 case 2 :
4226 {
4227 aSegment.Count = 1;
4228 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
4229 }
4230 break;
4231 case 3 :
4232 {
4233 aSegment.Count = 1;
4234 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
4235 }
4236 break;
4237 }
4238 }
4239 else
4240 aSegment = rSegments[ j ];
4241
4242 if ( !aStrBuffer.isEmpty() )
4243 aStrBuffer.append( ' ' );
4244
4245 sal_Int32 nParameter = 0;
4246 switch( aSegment.Command )
4247 {
4248 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
4249 aStrBuffer.append( 'Z' ); break;
4250 case css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
4251 aStrBuffer.append( 'N' ); break;
4252 case css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
4253 aStrBuffer.append( 'F' ); break;
4254 case css::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
4255 aStrBuffer.append( 'S' ); break;
4256
4257 case css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
4258 aStrBuffer.append( 'M' ); nParameter = 1; break;
4259 case css::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
4260 aStrBuffer.append( 'L' ); nParameter = 1; break;
4261 case css::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
4262 aStrBuffer.append( 'C' ); nParameter = 3; break;
4263 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
4264 aStrBuffer.append( 'T' ); nParameter = 3; break;
4265 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
4266 aStrBuffer.append( 'U' ); nParameter = 3; break;
4267 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
4268 aStrBuffer.append( 'A' ); nParameter = 4; break;
4269 case css::drawing::EnhancedCustomShapeSegmentCommand::ARC :
4270 aStrBuffer.append( 'B' ); nParameter = 4; break;
4271 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
4272 aStrBuffer.append( 'W' ); nParameter = 4; break;
4273 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
4274 aStrBuffer.append( 'V' ); nParameter = 4; break;
4275 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
4276 aStrBuffer.append( 'X' ); nParameter = 1; break;
4277 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
4278 aStrBuffer.append( 'Y' ); nParameter = 1; break;
4279 case css::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
4280 aStrBuffer.append( 'Q' ); nParameter = 2; break;
4281 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
4282 if ( bExtended ) {
4283 aStrBuffer.append( 'G' );
4284 nParameter = 2;
4285 } else {
4286 aStrBuffer.setLength( aStrBuffer.getLength() - 1);
4287 bNeedExtended = true;
4288 i += 2;
4289 }
4290 break;
4291 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKEN :
4292 if ( bExtended )
4293 aStrBuffer.append( 'H' );
4294 else
4295 bNeedExtended = true;
4296 break;
4297 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS :
4298 if ( bExtended )
4299 aStrBuffer.append( 'I' );
4300 else
4301 bNeedExtended = true;
4302 break;
4303 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN :
4304 if ( bExtended )
4305 aStrBuffer.append( 'J' );
4306 else
4307 bNeedExtended = true;
4308 break;
4309 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS :
4310 if ( bExtended )
4311 aStrBuffer.append( 'K' );
4312 else
4313 bNeedExtended = true;
4314 break;
4315 default : // ups, seems to be something wrong
4316 {
4317 aSegment.Count = 1;
4318 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4319 }
4320 break;
4321 }
4322 if ( nParameter )
4323 {
4324 for ( k = 0; k < aSegment.Count; k++ )
4325 {
4326 if ( ( i + nParameter ) <= nCoords )
4327 {
4328 for ( l = 0; l < nParameter; l++ )
4329 {
4330 ExportParameter( aStrBuffer, rCoordinates[ i ].First );
4331 ExportParameter( aStrBuffer, rCoordinates[ i++ ].Second );
4332 }
4333 }
4334 else
4335 {
4336 j = nSegments; // error -> exiting
4337 break;
4338 }
4339 }
4340 }
4341 }
4342 aStr = aStrBuffer.makeStringAndClear();
4344 if (!bExtended && bNeedExtended && (rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED))
4345 ImpExportEnhancedPath( rExport, rCoordinates, rSegments, true );
4346}
4347
4348static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xPropSet )
4349{
4350 bool bEquations = false;
4351 uno::Sequence< OUString > aEquations;
4352
4353 bool bHandles = false;
4354 uno::Sequence< beans::PropertyValues > aHandles;
4355
4356 uno::Sequence< css::drawing::EnhancedCustomShapeSegment > aSegments;
4357 uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
4358
4359 uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
4360
4361 OUString aStr;
4362 OUStringBuffer aStrBuffer;
4363 double fTextRotateAngle(0.0);
4364 double fTextPreRotateAngle(0.0); // will be consolidated with fTextRotateAngle at the end
4365 SvXMLUnitConverter& rUnitConverter = rExport.GetMM100UnitConverter();
4366
4367 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
4368
4369 // geometry
4370 static constexpr OUStringLiteral sCustomShapeGeometry( u"CustomShapeGeometry" );
4371 if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
4372 {
4373 uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
4374 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
4375
4376 if ( aGeoPropSet >>= aGeoPropSeq )
4377 {
4378 bool bCoordinates = false;
4379 OUString aCustomShapeType( "non-primitive" );
4380
4381 for ( const beans::PropertyValue& rGeoProp : std::as_const(aGeoPropSeq) )
4382 {
4383 switch( EASGet( rGeoProp.Name ) )
4384 {
4385 case EAS_Type :
4386 {
4387 rGeoProp.Value >>= aCustomShapeType;
4388 }
4389 break;
4390 case EAS_MirroredX :
4391 {
4392 bool bMirroredX;
4393 if ( rGeoProp.Value >>= bMirroredX )
4395 bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4396 }
4397 break;
4398 case EAS_MirroredY :
4399 {
4400 bool bMirroredY;
4401 if ( rGeoProp.Value >>= bMirroredY )
4403 bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4404 }
4405 break;
4406 case EAS_ViewBox :
4407 {
4408 awt::Rectangle aRect;
4409 if ( rGeoProp.Value >>= aRect )
4410 {
4411 SdXMLImExViewBox aViewBox( aRect.X, aRect.Y, aRect.Width, aRect.Height );
4413 }
4414 }
4415 break;
4417 {
4418 rGeoProp.Value >>= fTextPreRotateAngle;
4419 }
4420 break;
4421 case EAS_TextRotateAngle :
4422 {
4423 rGeoProp.Value >>= fTextRotateAngle;
4424 }
4425 break;
4426 case EAS_Extrusion :
4427 {
4428 uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
4429 if ( rGeoProp.Value >>= aExtrusionPropSeq )
4430 {
4431 bool bSkewValuesProvided = false;
4432 for ( const beans::PropertyValue& rProp : std::as_const(aExtrusionPropSeq) )
4433 {
4434 switch( EASGet( rProp.Name ) )
4435 {
4436 case EAS_Extrusion :
4437 {
4438 bool bExtrusionOn;
4439 if ( rProp.Value >>= bExtrusionOn )
4441 bExtrusionOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4442 }
4443 break;
4444 case EAS_Brightness :
4445 {
4446 double fExtrusionBrightness = 0;
4447 if ( rProp.Value >>= fExtrusionBrightness )
4448 {
4450 aStrBuffer,
4451 fExtrusionBrightness,
4452 false,
4453 util::MeasureUnit::PERCENT,
4454 util::MeasureUnit::PERCENT);
4455 aStrBuffer.append( '%' );
4456 aStr = aStrBuffer.makeStringAndClear();
4458 }
4459 }
4460 break;
4461 case EAS_Depth :
4462 {
4463 css::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
4464 if ( rProp.Value >>= aDepthParaPair )
4465 {
4466 double fDepth = 0;
4467 if ( aDepthParaPair.First.Value >>= fDepth )
4468 {
4469 rExport.GetMM100UnitConverter().convertDouble( aStrBuffer, fDepth );
4470 ExportParameter( aStrBuffer, aDepthParaPair.Second );
4471 aStr = aStrBuffer.makeStringAndClear();
4473 }
4474 }
4475 }
4476 break;
4477 case EAS_Diffusion :
4478 {
4479 double fExtrusionDiffusion = 0;
4480 if ( rProp.Value >>= fExtrusionDiffusion )
4481 {
4483 aStrBuffer,
4484 fExtrusionDiffusion,
4485 false,
4486 util::MeasureUnit::PERCENT,
4487 util::MeasureUnit::PERCENT);
4488 aStrBuffer.append( '%' );
4489 aStr = aStrBuffer.makeStringAndClear();
4491 }
4492 }
4493 break;
4495 {
4496 sal_Int32 nExtrusionNumberOfLineSegments = 0;
4497 if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
4498 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS, OUString::number( nExtrusionNumberOfLineSegments ) );
4499 }
4500 break;
4501 case EAS_LightFace :
4502 {
4503 bool bExtrusionLightFace;
4504 if ( rProp.Value >>= bExtrusionLightFace )
4506 bExtrusionLightFace ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4507 }
4508 break;
4509 case EAS_FirstLightHarsh :
4510 {
4511 bool bExtrusionFirstLightHarsh;
4512 if ( rProp.Value >>= bExtrusionFirstLightHarsh )
4514 bExtrusionFirstLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4515 }
4516 break;
4518 {
4519 bool bExtrusionSecondLightHarsh;
4520 if ( rProp.Value >>= bExtrusionSecondLightHarsh )
4522 bExtrusionSecondLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4523 }
4524 break;
4525 case EAS_FirstLightLevel :
4526 {
4527 double fExtrusionFirstLightLevel = 0;
4528 if ( rProp.Value >>= fExtrusionFirstLightLevel )
4529 {
4531 aStrBuffer,
4532 fExtrusionFirstLightLevel,
4533 false,
4534 util::MeasureUnit::PERCENT,
4535 util::MeasureUnit::PERCENT);
4536 aStrBuffer.append( '%' );
4537 aStr = aStrBuffer.makeStringAndClear();
4539 }
4540 }
4541 break;
4543 {
4544 double fExtrusionSecondLightLevel = 0;
4545 if ( rProp.Value >>= fExtrusionSecondLightLevel )
4546 {
4548 aStrBuffer,
4549 fExtrusionSecondLightLevel,
4550 false,
4551 util::MeasureUnit::PERCENT,
4552 util::MeasureUnit::PERCENT);
4553 aStrBuffer.append( '%' );
4554 aStr = aStrBuffer.makeStringAndClear();
4556 }
4557 }
4558 break;
4560 {
4561 drawing::Direction3D aExtrusionFirstLightDirection;
4562 if ( rProp.Value >>= aExtrusionFirstLightDirection )
4563 {
4564 ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
4565 aExtrusionFirstLightDirection.DirectionZ );
4566 SvXMLUnitConverter::convertB3DVector( aStrBuffer, aVec3D );
4567 aStr = aStrBuffer.makeStringAndClear();
4569 }
4570 }
4571 break;
4573 {
4574 drawing::Direction3D aExtrusionSecondLightDirection;
4575 if ( rProp.Value >>= aExtrusionSecondLightDirection )
4576 {
4577 ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
4578 aExtrusionSecondLightDirection.DirectionZ );
4579 SvXMLUnitConverter::convertB3DVector( aStrBuffer, aVec3D );
4580 aStr = aStrBuffer.makeStringAndClear();
4582 }
4583 }
4584 break;
4585 case EAS_Metal :
4586 {
4587 bool bExtrusionMetal;
4588 if ( rProp.Value >>= bExtrusionMetal )
4590 bExtrusionMetal ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4591 }
4592 break;
4593 case EAS_MetalType :
4594 {
4595 // export only if ODF extensions are enabled
4596 sal_Int16 eMetalType;
4597 if (rProp.Value >>= eMetalType)
4598 {
4600 if (eVersion > SvtSaveOptions::ODFSVER_013
4601 && (eVersion & SvtSaveOptions::ODFSVER_EXTENDED))
4602 {
4603 if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible)
4604 aStr = "loext:MetalMSCompatible";
4605 else
4606 aStr = "draw:MetalODF";
4608 }
4609 }
4610 }
4611 break;
4612 case EAS_ShadeMode :
4613 {
4614 // shadeMode
4615 drawing::ShadeMode eShadeMode;
4616 if( rProp.Value >>= eShadeMode )
4617 {
4618 if( eShadeMode == drawing::ShadeMode_FLAT )
4620 else if( eShadeMode == drawing::ShadeMode_PHONG )
4622 else if( eShadeMode == drawing::ShadeMode_SMOOTH )
4624 else
4626 }
4627 else
4628 {
4629 // ShadeMode enum not there, write default
4631 }
4633 }
4634 break;
4635 case EAS_RotateAngle :
4636 {
4637 css::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
4638 if ( rProp.Value >>= aRotateAngleParaPair )
4639 {
4640 ExportParameter( aStrBuffer, aRotateAngleParaPair.First );
4641 ExportParameter( aStrBuffer, aRotateAngleParaPair.Second );
4642 aStr = aStrBuffer.makeStringAndClear();
4644 }
4645 }
4646 break;
4647 case EAS_RotationCenter :
4648 {
4649 drawing::Direction3D aExtrusionRotationCenter;
4650 if ( rProp.Value >>= aExtrusionRotationCenter )
4651 {
4652 ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
4653 aExtrusionRotationCenter.DirectionZ );
4654 SvXMLUnitConverter::convertB3DVector( aStrBuffer, aVec3D );
4655 aStr = aStrBuffer.makeStringAndClear();
4657 }
4658 }
4659 break;
4660 case EAS_Shininess :
4661 {
4662 double fExtrusionShininess = 0;
4663 if ( rProp.Value >>= fExtrusionShininess )
4664 {
4666 aStrBuffer,
4667 fExtrusionShininess,
4668 false,
4669 util::MeasureUnit::PERCENT,
4670 util::MeasureUnit::PERCENT);
4671 aStrBuffer.append( '%' );
4672 aStr = aStrBuffer.makeStringAndClear();
4674 }
4675 }
4676 break;
4677 case EAS_Skew :
4678 {
4679 css::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
4680 if ( rProp.Value >>= aSkewParaPair )
4681 {
4682 bSkewValuesProvided = true;
4683 ExportParameter( aStrBuffer, aSkewParaPair.First );
4684 ExportParameter( aStrBuffer, aSkewParaPair.Second );
4685 aStr = aStrBuffer.makeStringAndClear();
4687 }
4688 }
4689 break;
4690 case EAS_Specularity :
4691 {
4692 double fExtrusionSpecularity = 0;
4693 if ( rProp.Value >>= fExtrusionSpecularity )
4694 {
4696 if (fExtrusionSpecularity > 100.0 && eVersion >= SvtSaveOptions::ODFSVER_012
4697 && (eVersion & SvtSaveOptions::ODFSVER_EXTENDED))
4698 {
4699 // tdf#147580 write values > 100% in loext
4701 aStrBuffer,
4702 fExtrusionSpecularity,
4703 false,
4704 util::MeasureUnit::PERCENT,
4705 util::MeasureUnit::PERCENT);
4706 aStrBuffer.append( '%' );
4707 aStr = aStrBuffer.makeStringAndClear();
4709 }
4710 // tdf#147580 ODF 1 allows arbitrary percent, later versions not
4711 if (eVersion >= SvtSaveOptions::ODFSVER_012)
4712 {
4713 fExtrusionSpecularity = std::clamp<double>(fExtrusionSpecularity, 0.0, 100.0);
4714 }
4716 aStrBuffer,
4717 fExtrusionSpecularity,
4718 false,
4719 util::MeasureUnit::PERCENT,
4720 util::MeasureUnit::PERCENT);
4721 aStrBuffer.append( '%' );
4722 aStr = aStrBuffer.makeStringAndClear();
4724 }
4725 }
4726 break;
4727 case EAS_ProjectionMode :
4728 {
4729 drawing::ProjectionMode eProjectionMode;
4730 if ( rProp.Value >>= eProjectionMode )
4732 eProjectionMode == drawing::ProjectionMode_PARALLEL ? GetXMLToken( XML_PARALLEL ) : GetXMLToken( XML_PERSPECTIVE ) );
4733 }
4734 break;
4735 case EAS_ViewPoint :
4736 {
4737 drawing::Position3D aExtrusionViewPoint;
4738 if ( rProp.Value >>= aExtrusionViewPoint )
4739 {
4740 rUnitConverter.convertPosition3D( aStrBuffer, aExtrusionViewPoint );
4741 aStr = aStrBuffer.makeStringAndClear();
4743 }
4744 }
4745 break;
4746 case EAS_Origin :
4747 {
4748 css::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
4749 if ( rProp.Value >>= aOriginParaPair )
4750 {
4751 ExportParameter( aStrBuffer, aOriginParaPair.First );
4752 ExportParameter( aStrBuffer, aOriginParaPair.Second );
4753 aStr = aStrBuffer.makeStringAndClear();
4755 }
4756 }
4757 break;
4758 case EAS_Color :
4759 {
4760 bool bExtrusionColor;
4761 if ( rProp.Value >>= bExtrusionColor )
4762 {
4764 bExtrusionColor ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4765 }
4766 }
4767 break;
4768 default:
4769 break;
4770 }
4771 }
4772 // tdf#141301: no specific skew values provided
4773 if (!bSkewValuesProvided)
4774 {
4775 // so we need to export default values explicitly
4777 }
4778 }
4779 }
4780 break;
4781 case EAS_TextPath :
4782 {
4783 uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
4784 if ( rGeoProp.Value >>= aTextPathPropSeq )
4785 {
4786 for ( const beans::PropertyValue& rProp : std::as_const(aTextPathPropSeq) )
4787 {
4788 switch( EASGet( rProp.Name ) )
4789 {
4790 case EAS_TextPath :
4791 {
4792 bool bTextPathOn;
4793 if ( rProp.Value >>= bTextPathOn )
4795 bTextPathOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4796 }
4797 break;
4798 case EAS_TextPathMode :
4799 {
4800 css::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
4801 if ( rProp.Value >>= eTextPathMode )
4802 {
4803 switch ( eTextPathMode )
4804 {
4805 case css::drawing::EnhancedCustomShapeTextPathMode_NORMAL: aStr = GetXMLToken( XML_NORMAL ); break;
4806 case css::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr = GetXMLToken( XML_PATH ); break;
4807 case css::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr = GetXMLToken( XML_SHAPE ); break;
4808 default:
4809 break;
4810 }
4811 if ( !aStr.isEmpty() )
4813 }
4814 }
4815 break;
4816 case EAS_ScaleX :
4817 {
4818 bool bScaleX;
4819 if ( rProp.Value >>= bScaleX )
4820 {
4821 aStr = bScaleX ? GetXMLToken( XML_SHAPE ) : GetXMLToken( XML_PATH );
4823 }
4824 }
4825 break;
4827 {
4828 bool bSameLetterHeights;
4829 if ( rProp.Value >>= bSameLetterHeights )
4831 bSameLetterHeights ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4832 }
4833 break;
4834 default:
4835 break;
4836 }
4837 }
4838 }
4839 }
4840 break;
4841 case EAS_Path :
4842 {
4843 uno::Sequence< beans::PropertyValue > aPathPropSeq;
4844 if ( rGeoProp.Value >>= aPathPropSeq )
4845 {
4846 for ( const beans::PropertyValue& rProp : std::as_const(aPathPropSeq) )
4847 {
4848 switch( EASGet( rProp.Name ) )
4849 {
4850 case EAS_SubViewSize:
4851 {
4852 // export draw:sub-view-size (do not export in ODF 1.3 or older)
4854 {
4855 continue;
4856 }
4857 uno::Sequence< awt::Size > aSubViewSizes;
4858 rProp.Value >>= aSubViewSizes;
4859
4860 for ( int nIdx = 0; nIdx < aSubViewSizes.getLength(); nIdx++ )
4861 {
4862 if ( nIdx )
4863 aStrBuffer.append(' ');
4864 aStrBuffer.append( aSubViewSizes[nIdx].Width );
4865 aStrBuffer.append(' ');
4866 aStrBuffer.append( aSubViewSizes[nIdx].Height );
4867 }
4868 aStr = aStrBuffer.makeStringAndClear();
4870 }
4871 break;
4873 {
4874 bool bExtrusionAllowed;
4875 if ( rProp.Value >>= bExtrusionAllowed )
4877 bExtrusionAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4878 }
4879 break;
4881 {
4882 bool bConcentricGradientFillAllowed;
4883 if ( rProp.Value >>= bConcentricGradientFillAllowed )
4885 bConcentricGradientFillAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4886 }
4887 break;
4888 case EAS_TextPathAllowed :
4889 {
4890 bool bTextPathAllowed;
4891 if ( rProp.Value >>= bTextPathAllowed )
4893 bTextPathAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
4894 }
4895 break;
4896 case EAS_GluePoints :
4897 {
4898 css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
4899 if ( rProp.Value >>= aGluePoints )
4900 {
4901 if ( aGluePoints.hasElements() )
4902 {
4903 for( const auto& rGluePoint : std::as_const(aGluePoints) )
4904 {
4905 ExportParameter( aStrBuffer, rGluePoint.First );
4906 ExportParameter( aStrBuffer, rGluePoint.Second );
4907 }
4908 aStr = aStrBuffer.makeStringAndClear();
4909 }
4911 }
4912 }
4913 break;
4914 case EAS_GluePointType :
4915 {
4916 sal_Int16 nGluePointType = sal_Int16();
4917 if ( rProp.Value >>= nGluePointType )
4918 {
4919 switch ( nGluePointType )
4920 {
4921 case css::drawing::EnhancedCustomShapeGluePointType::NONE : aStr = GetXMLToken( XML_NONE ); break;
4922 case css::drawing::EnhancedCustomShapeGluePointType::SEGMENTS : aStr = GetXMLToken( XML_SEGMENTS ); break;
4923 case css::drawing::EnhancedCustomShapeGluePointType::RECT : aStr = GetXMLToken( XML_RECTANGLE ); break;
4924 }
4925 if ( !aStr.isEmpty() )
4927 }
4928 }
4929 break;
4930 case EAS_Coordinates :
4931 {
4932 bCoordinates = ( rProp.Value >>= aCoordinates );
4933 }
4934 break;
4935 case EAS_Segments :
4936 {
4937 rProp.Value >>= aSegments;
4938 }
4939 break;
4940 case EAS_StretchX :
4941 {
4942 sal_Int32 nStretchPoint = 0;
4943 if ( rProp.Value >>= nStretchPoint )
4944 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_X, OUString::number( nStretchPoint ) );
4945 }
4946 break;
4947 case EAS_StretchY :
4948 {
4949 sal_Int32 nStretchPoint = 0;
4950 if ( rProp.Value >>= nStretchPoint )
4951 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_Y, OUString::number( nStretchPoint ) );
4952 }
4953 break;
4954 case EAS_TextFrames :
4955 {
4956 css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
4957 if ( rProp.Value >>= aPathTextFrames )
4958 {
4959 if ( aPathTextFrames.hasElements() )
4960 {
4961 for ( const auto& rPathTextFrame : std::as_const(aPathTextFrames) )
4962 {
4963 ExportParameter( aStrBuffer, rPathTextFrame.TopLeft.First );
4964 ExportParameter( aStrBuffer, rPathTextFrame.TopLeft.Second );
4965 ExportParameter( aStrBuffer, rPathTextFrame.BottomRight.First );
4966 ExportParameter( aStrBuffer, rPathTextFrame.BottomRight.Second );
4967 }
4968 aStr = aStrBuffer.makeStringAndClear();
4969 }
4971 }
4972 }
4973 break;
4974 default:
4975 break;
4976 }
4977 }
4978 }
4979 }
4980 break;
4981 case EAS_Equations :
4982 {
4983 bEquations = ( rGeoProp.Value >>= aEquations );
4984 }
4985 break;
4986 case EAS_Handles :
4987 {
4988 bHandles = ( rGeoProp.Value >>= aHandles );
4989 }
4990 break;
4992 {
4993 rGeoProp.Value >>= aAdjustmentValues;
4994 }
4995 break;
4996 default:
4997 break;
4998 }
4999 } // for
5000
5001 // ToDo: Where is TextPreRotateAngle still used? We cannot save it in ODF.
5002 fTextRotateAngle += fTextPreRotateAngle;
5003 // Workaround for writing-mode bt-lr and tb-rl90 in ODF strict,
5004 // otherwise loext:writing-mode is used in style export.
5006 {
5007 if (xPropSetInfo->hasPropertyByName(u"WritingMode"))
5008 {
5009 sal_Int16 nDirection = -1;
5010 xPropSet->getPropertyValue(u"WritingMode") >>= nDirection;
5011 if (nDirection == text::WritingMode2::TB_RL90)
5012 fTextRotateAngle -= 90;
5013 else if (nDirection == text::WritingMode2::BT_LR)
5014 fTextRotateAngle -= 270;
5015 }
5016 }
5017 if (fTextRotateAngle != 0)
5018 {
5019 ::sax::Converter::convertDouble( aStrBuffer, fTextRotateAngle );
5020 aStr = aStrBuffer.makeStringAndClear();
5022 }
5023
5024 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TYPE, aCustomShapeType );
5025
5026 // adjustments
5027 sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength();
5028 if ( nAdjustmentValues )
5029 {
5030 sal_Int32 i, nValue = 0;
5031 for ( i = 0; i < nAdjustmentValues; i++ )
5032 {
5033 if ( i )
5034 aStrBuffer.append( ' ' );
5035
5036 const css::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ];
5037 if ( rAdj.State == beans::PropertyState_DIRECT_VALUE )
5038 {
5039 if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
5040 {
5041 double fValue = 0.0;
5042 rAdj.Value >>= fValue;
5043 ::sax::Converter::convertDouble(aStrBuffer, fValue);
5044 }
5045 else
5046 {
5047 rAdj.Value >>= nValue;
5048 aStrBuffer.append(nValue);
5049 }
5050 }
5051 else
5052 {
5053 // this should not be, but better than setting nothing
5054 aStrBuffer.append("0");
5055 }
5056 }
5057 aStr = aStrBuffer.makeStringAndClear();
5059 }
5060 if ( bCoordinates )
5061 ImpExportEnhancedPath( rExport, aCoordinates, aSegments );
5062 }
5063 }
5064 SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_ENHANCED_GEOMETRY, true, true );
5065 if ( bEquations )
5066 ImpExportEquations( rExport, aEquations );
5067 if ( bHandles )
5068 ImpExportHandles( rExport, aHandles );
5069}
5070
5072 const uno::Reference< drawing::XShape >& xShape,
5073 XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint )
5074{
5075 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
5076 if ( !xPropSet.is() )
5077 return;
5078
5079 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
5080
5081 // Transformation
5082 ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
5083
5084 if ( xPropSetInfo.is() )
5085 {
5086 OUString aStr;
5087 if ( xPropSetInfo->hasPropertyByName( "CustomShapeEngine" ) )
5088 {
5089 uno::Any aEngine( xPropSet->getPropertyValue( "CustomShapeEngine" ) );
5090 if ( ( aEngine >>= aStr ) && !aStr.isEmpty() )
5092 }
5093 if ( xPropSetInfo->hasPropertyByName( "CustomShapeData" ) )
5094 {
5095 uno::Any aData( xPropSet->getPropertyValue( "CustomShapeData" ) );
5096 if ( ( aData >>= aStr ) && !aStr.isEmpty() )
5098 }
5099 }
5100 bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210#
5101 SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, true );
5102 ImpExportDescription( xShape ); // #i68101#
5103 ImpExportEvents( xShape );
5104 ImpExportGluePoints( xShape );
5105 ImpExportText( xShape );
5107
5108}
5109
5110void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint )
5111{
5112 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
5113 uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
5114
5115 SAL_WARN_IF( !xPropSet.is() || !xNamed.is(), "xmloff", "xmloff::XMLShapeExport::ImpExportTableShape(), table shape is not implementing needed interfaces");
5116 if(!(xPropSet.is() && xNamed.is()))
5117 return;
5118
5119 try
5120 {
5121 // Transformation
5122 ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
5123
5124 bool bIsEmptyPresObj = false;
5125
5126 // presentation settings
5127 if(eShapeType == XmlShapeType::PresTableShape)
5128 bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_TABLE) );
5129
5130 const bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE );
5131
5132 SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, true );
5133
5134 // do not export in ODF 1.1 or older
5136 {
5137 if( !bIsEmptyPresObj )
5138 {
5139 uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue("TableTemplate"), uno::UNO_QUERY );
5140 if( xTemplate.is() )
5141 {
5142 const OUString sTemplate( xTemplate->getName() );
5143 if( !sTemplate.isEmpty() )
5144 {
5146
5147 for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; !pEntry->IsEnd(); pEntry++ )
5148 {
5149 try
5150 {
5151 bool bBool = false;
5152 xPropSet->getPropertyValue( pEntry->getApiName() ) >>= bBool;
5153 if( bBool )
5154 mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
5155 }
5156 catch( uno::Exception& )
5157 {
5158 DBG_UNHANDLED_EXCEPTION("xmloff.draw");
5159 }
5160 }
5161 }
5162 }
5163
5164 uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( gsModel ), uno::UNO_QUERY_THROW );
5165 GetShapeTableExport()->exportTable( xRange );
5166 }
5167 }
5168
5169 if( !bIsEmptyPresObj )
5170 {
5171 uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue("ReplacementGraphic"), uno::UNO_QUERY );
5172 ExportGraphicPreview(xGraphic, mrExport, u"TablePreview", u".svm", "image/x-vclgraphic");
5173 }
5174
5175 ImpExportEvents( xShape );
5176 ImpExportGluePoints( xShape );
5177 ImpExportDescription( xShape ); // #i68101#
5178 }
5179 catch( uno::Exception const & )
5180 {
5181 DBG_UNHANDLED_EXCEPTION("xmloff.draw");
5182 }
5183}
5184
5185/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XInputStream > xStream
XMLEffectDirection
Definition: anim.hxx:50
@ ED_none
Definition: anim.hxx:51
XMLEffect
Definition: anim.hxx:27
@ EK_none
Definition: anim.hxx:28
void SdXMLImplSetEffect(AnimationEffect eEffect, XMLEffect &eKind, XMLEffectDirection &eDirection, sal_Int16 &nStartScale, bool &bIn)
Definition: animexp.cxx:177
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
Definition: animimp.cxx:77
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
Definition: animimp.cxx:110
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
Definition: animimp.cxx:55
bool IsNone() const
void Increment(sal_Int32 nInc=1)
void AddTranslate(const ::basegfx::B2DTuple &rNew)
Definition: xexptran.cxx:232
void AddSkewX(double fNew)
Definition: xexptran.cxx:238
void AddRotate(double fNew)
Definition: xexptran.cxx:226
const OUString & GetExportString(const SvXMLUnitConverter &rConv)
Definition: xexptran.cxx:245
bool NeedsAction() const
Definition: xexptran.hxx:55
const OUString & GetExportString(const SvXMLUnitConverter &rConv)
Definition: xexptran.cxx:618
bool NeedsAction() const
Definition: xexptran.hxx:75
void AddHomogenMatrix(const css::drawing::HomogenMatrix &xHomMat)
Definition: xexptran.cxx:612
const OUString & GetExportString()
Definition: xexptran.cxx:1034
const SvXMLNamespaceMap & GetNamespaceMap() const
Definition: xmlexp.hxx:385
ProgressBarHelper * GetProgressBarHelper()
Definition: xmlexp.cxx:1941
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
Definition: xmlexp.cxx:2248
OUString GetRelativeReference(const OUString &rValue)
Definition: xmlexp.cxx:2057
void AddAttributeList(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Definition: xmlexp.cxx:1000
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
Definition: xmlexp.hxx:557
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:907
void Characters(const OUString &rChars)
Definition: xmlexp.cxx:2126
SvXMLExportFlags getExportFlags() const
Definition: xmlexp.hxx:473
bool GetGraphicMimeTypeFromStream(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType)
Definition: xmlexp.cxx:1860
virtual void exportAnnotationMeta(const css::uno::Reference< css::drawing::XShape > &xShape)
Definition: xmlexp.cxx:1828
OUString AddEmbeddedObject(const OUString &rEmbeddedObjectURL)
Definition: xmlexp.cxx:1895
rtl::Reference< SchXMLExportHelper > const & GetChartExport()
Definition: xmlexp.hxx:581
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlexp.hxx:411
void ClearAttrList()
Definition: xmlexp.cxx:1006
void SAL_DLLPRIVATE AddAttributeIdLegacy(sal_uInt16 const nLegacyPrefix, OUString const &rValue)
add xml:id and legacy namespace id
Definition: xmlexp.cxx:2274
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
returns the deterministic version for odf export
Definition: xmlexp.cxx:2264
rtl::Reference< XMLShapeExport > const & GetShapeExport()
Definition: xmlexp.hxx:565
rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool()
Definition: xmlexp.hxx:573
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
Definition: xmlexp.cxx:1934
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
Definition: xmlexp.cxx:1875
css::uno::Reference< css::embed::XStorage > const & GetTargetStorage() const
Definition: xmlexp.cxx:2259
void CheckAttrList()
Definition: xmlexp.cxx:1012
XMLImageMapExport & GetImageMapExport()
get the export for image maps
Definition: xmlexp.cxx:2005
void ExportEmbeddedOwnObject(css::uno::Reference< css::lang::XComponent > const &rComp)
Definition: xmlexp.cxx:2016
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
Definition: xmlexp.hxx:517
rtl::Reference< xmloff::OFormLayerXMLExport > const & GetFormExport()
Definition: xmlexp.hxx:605
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:391
bool AddEmbeddedObjectAsBase64(const OUString &rEmbeddedObjectURL)
Definition: xmlexp.cxx:1910
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
Definition: xmlexp.cxx:1838
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:83
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:145
bool convertPosition3D(css::drawing::Position3D &rPosition, std::string_view rValue) const
convert string to Position3D
void convertDouble(OUStringBuffer &rBuffer, double fNumber) const
convert double number to string (using ::rtl::math) and DO convert to export MapUnit using meCoreMeas...
Definition: xmluconv.cxx:335
static bool convertB3DVector(::basegfx::B3DVector &rVector, std::string_view rValue)
convert string to basegfx::B3DVector
Definition: xmluconv.cxx:588
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:208
static void prepare(const css::uno::Reference< css::drawing::XShape > &xShape)
Definition: animexp.cxx:258
void Export(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Get the ImageMap object from the "ImageMap" property and subsequently export the map (if present).
SAL_DLLPRIVATE void ImpExportFrameShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportTableShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportPageShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportMeasureShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point const *pRefPoint=nullptr)
void collectShapesAutoStyles(const css::uno::Reference< css::drawing::XShapes > &xShapes)
SvXMLExport & mrExport
SAL_DLLPRIVATE void ImpExportControlShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
ShapesInfos maShapesInfos
SAL_DLLPRIVATE void ImpExportChartShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr, comphelper::AttributeList *pAttrList=nullptr)
static SAL_DLLPRIVATE void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix &rMat, ::basegfx::B2DTuple &rTRScale, double &fTRShear, double &fTRRotate, ::basegfx::B2DTuple &rTRTranslate, css::awt::Point *pRefPoint)
SAL_DLLPRIVATE void ImpExportText(const css::uno::Reference< css::drawing::XShape > &xShape, TextPNS eExtensionNS=TextPNS::ODF)
virtual void onExport(const css::uno::Reference< css::drawing::XShape > &xShape)
is called before a shape element for the given XShape is exported
SAL_DLLPRIVATE void ImpExportSignatureLine(const css::uno::Reference< css::drawing::XShape > &xShape)
SAL_DLLPRIVATE void ImpExportLineShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportQRCode(const css::uno::Reference< css::drawing::XShape > &xShape)
SAL_DLLPRIVATE void ImpExportConnectorShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportDescription(const css::uno::Reference< css::drawing::XShape > &xShape)
#i68101# export shape Title and Description
const rtl::Reference< XMLTableExport > & GetShapeTableExport()
XMLShapeExport(SvXMLExport &rExp, SvXMLExportPropertyMapper *pExtMapper=nullptr)
SAL_DLLPRIVATE void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix &rMatrix, const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
OUString msPresentationStylePrefix
SAL_DLLPRIVATE bool ImpExportPresentationAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const OUString &rClass)
css::uno::Reference< css::drawing::XShape > checkForCustomShapeReplacement(const css::uno::Reference< css::drawing::XShape > &)
sj: replacing CustomShapes with standard objects that are also supported in OpenOffice....
SAL_DLLPRIVATE void ImpExportGluePoints(const css::uno::Reference< css::drawing::XShape > &xShape)
exports all user defined gluepoints
SAL_DLLPRIVATE void ImpExportGraphicObjectShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
void export3DSceneAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
helper for chart that adds all attributes of a 3d scene element to the export
void exportShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr, comphelper::AttributeList *pAttrList=nullptr)
SAL_DLLPRIVATE void ImpExportEvents(const css::uno::Reference< css::drawing::XShape > &xShape)
SAL_DLLPRIVATE void ImpExportPolygonShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple const &rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple const &rTRTranslate, const XMLShapeExportFlags nFeatures)
SAL_DLLPRIVATE void ImpExportGroupShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
rtl::Reference< XMLTableExport > mxShapeTableExport
SAL_DLLPRIVATE void ImpExportRectangleShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExport3DShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType)
void exportAutoStyles()
void ExportGraphicDefaults()
helper to export the style for graphic defaults
SAL_DLLPRIVATE void ImpExportCaptionShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
void collectShapeAutoStyles(const css::uno::Reference< css::drawing::XShape > &xShape)
SAL_DLLPRIVATE const rtl::Reference< SvXMLExportPropertyMapper > & GetPropertySetMapper() const
SAL_DLLPRIVATE void ImpExportOLE2Shape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr, comphelper::AttributeList *pAttrList=nullptr)
SAL_DLLPRIVATE void ImpExportTextBoxShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
rtl::Reference< SvXMLExportPropertyMapper > mxPropertySetMapper
OUStringBuffer msBuffer
SAL_DLLPRIVATE void ImpExportNewTrans(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, XMLShapeExportFlags nFeatures, css::awt::Point *pRefPoint)
void export3DLamps(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
helper for chart that exports all lamps from the propertyset
ShapesInfos::iterator maCurrentShapesIter
SAL_DLLPRIVATE void ImpExportAppletShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportPluginShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExportEllipseShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpExport3DSceneShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SAL_DLLPRIVATE void ImpCalcShapeType(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType &eShapeType)
void seekShapes(const css::uno::Reference< css::drawing::XShapes > &xShapes) noexcept
initializes some internal structures for fast access to the given XShapes collection
SAL_DLLPRIVATE void ImpExportMediaShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
virtual ~XMLShapeExport() override
static SvXMLExportPropertyMapper * CreateShapePropMapper(SvXMLExport &rExport)
returns the export property mapper for external chaining
rtl::Reference< XMLAnimationsExporter > mxAnimationsExporter
SAL_DLLPRIVATE void ImpExportCustomShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
SvXMLExport & GetExport()
void exportShapes(const css::uno::Reference< css::drawing::XShapes > &xShapes, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
static SvXMLExportPropertyMapper * CreateParaDefaultExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1550
static SvXMLExportPropertyMapper * CreateParaExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1542
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
B2DRange getB2DRange() const
bool areControlPointsUsed() const
sal_uInt32 count() const
bool isClosed() const
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
TYPE getHeight() const
TYPE getX() const
void setY(TYPE fY)
TYPE getY() const
void setX(TYPE fX)
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
static css::uno::Reference< css::io::XStream > GetStreamAtPackageURL(const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &rURL, sal_uInt32 const nOpenMode, LifecycleProxy const &rNastiness)
const OUString & getIdentifier(const css::uno::Reference< css::uno::XInterface > &rInterface) const
const OUString & registerReference(const css::uno::Reference< css::uno::XInterface > &rInterface)
returns a unique identifier for the given uno object.
#define SO3_SC_CLASSID
#define SO3_RPTCH_CLASSID
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
static bool convertBool(bool &rBool, std::u16string_view rString)
#define CTF_SD_CONTROL_SHAPE_DATA_STYLE
Definition: contextid.hxx:35
#define CTF_SD_SHAPE_PARA_ADJUST
Definition: contextid.hxx:37
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define TOOLS_INFO_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
float u
Reference< XInterface > xTarget
Reference< XSingleServiceFactory > xFactory
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX
Definition: families.hxx:41
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME
Definition: families.hxx:38
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX
Definition: families.hxx:39
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_NAME
Definition: families.hxx:40
DocumentType eType
sal_Int16 nValue
tools::Long FRound(double fVal)
sal_Int32 nIndex
OUString aName
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
aStr
constexpr OUStringLiteral aData
NONE
B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon &rCandidate, const B3DHomMatrix &rMat)
OUString exportToSvgD(const B2DPolyPolygon &rPolyPoly, bool bUseRelativeCoordinates, bool bDetectQuadraticBeziers, bool bHandleRelativeNextPointCompatible, bool bOOXMLMotionPath=false)
B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon(const css::drawing::PolyPolygonShape3D &rPolyPolygonShape3DSource)
OUString exportToSvgPoints(const B2DPolygon &rPoly)
B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(const css::drawing::PointSequenceSequence &rPointSequenceSequenceSource)
B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(const css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsSource)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
OUString aPropName
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
end
EnhancedCustomShapeTokenEnum EASGet(std::u16string_view rShapeType)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
@ XML_HANDLE_RANGE_X_MINIMUM
Definition: xmltoken.hxx:2536
@ XML_EXTRUSION_SPECULARITY
Definition: xmltoken.hxx:2505
@ XML_HANDLE_RADIUS_RANGE_MINIMUM
Definition: xmltoken.hxx:2541
@ XML_HANDLE_RANGE_Y_MINIMUM
Definition: xmltoken.hxx:2538
@ XML_QRCODE_ERROR_CORRECTION
Definition: xmltoken.hxx:1584
@ XML_EXTRUSION_SPECULARITY_LOEXT
Definition: xmltoken.hxx:2506
@ XML_EXTRUSION_VIEWPOINT
Definition: xmltoken.hxx:2508
@ XML_HANDLE_RANGE_Y_MAXIMUM
Definition: xmltoken.hxx:2539
@ XML_EXTRUSION_BRIGHTNESS
Definition: xmltoken.hxx:2488
@ XML_EXTRUSION_DIFFUSION
Definition: xmltoken.hxx:2490
@ XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS
Definition: xmltoken.hxx:2491
@ XML_SUGGESTED_SIGNER_TITLE
Definition: xmltoken.hxx:2053
@ XML_HANDLE_RADIUS_RANGE_MAXIMUM
Definition: xmltoken.hxx:2542
@ XML_EXTRUSION_METAL_TYPE
Definition: xmltoken.hxx:2500
@ XML_EXTRUSION_SECOND_LIGHT_HARSH
Definition: xmltoken.hxx:2494
@ XML_TEXT_PATH_SAME_LETTER_HEIGHTS
Definition: xmltoken.hxx:2522
@ XML_HANDLE_MIRROR_VERTICAL
Definition: xmltoken.hxx:2532
@ XML_EXTRUSION_SHININESS
Definition: xmltoken.hxx:2503
@ XML_HANDLE_MIRROR_HORIZONTAL
Definition: xmltoken.hxx:2533
@ XML_EXTRUSION_SECOND_LIGHT_DIRECTION
Definition: xmltoken.hxx:2498
@ XML_SUGGESTED_SIGNER_EMAIL
Definition: xmltoken.hxx:2051
@ XML_PATH_STRETCHPOINT_X
Definition: xmltoken.hxx:2513
@ XML_SIGNING_INSTRUCTIONS
Definition: xmltoken.hxx:2048
@ XML_CONCENTRIC_GRADIENT_FILL_ALLOWED
Definition: xmltoken.hxx:2486
@ XML_EXTRUSION_FIRST_LIGHT_HARSH
Definition: xmltoken.hxx:2493
@ XML_PRESENTATION_OUTLINE
Definition: xmltoken.hxx:1552
@ XML_EXTRUSION_ROTATION_ANGLE
Definition: xmltoken.hxx:2501
@ XML_EXTRUSION_ROTATION_CENTER
Definition: xmltoken.hxx:2502
@ XML_EXTRUSION_LIGHT_FACE
Definition: xmltoken.hxx:2492
@ XML_EXTRUSION_FIRST_LIGHT_LEVEL
Definition: xmltoken.hxx:2495
@ XML_HANDLE_RANGE_X_MAXIMUM
Definition: xmltoken.hxx:2537
@ XML_PATH_STRETCHPOINT_Y
Definition: xmltoken.hxx:2514
@ XML_EXTRUSION_SECOND_LIGHT_LEVEL
Definition: xmltoken.hxx:2496
@ XML_EXTRUSION_FIRST_LIGHT_DIRECTION
Definition: xmltoken.hxx:2497
@ XML_SUGGESTED_SIGNER_NAME
Definition: xmltoken.hxx:2052
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
void FixZOrder(uno::Reference< drawing::XShapes > const &xShapes, std::function< unsigned int(uno::Reference< beans::XPropertySet > const &)> const &rGetLayer)
constexpr OUStringLiteral aFalseStr
constexpr OUStringLiteral aTrueStr
const XMLPropertyMapEntry aXMLTableShapeAttributes[]
contains the attribute to property mapping for a drawing layer table WARNING: if attributes are added...
Definition: sdpropls.cxx:380
SvXMLEnumMapEntry< drawing::ConnectorType > const aXML_ConnectionKind_EnumMap[]
Definition: sdpropls.cxx:508
SvXMLEnumMapEntry< drawing::CircleKind > const aXML_CircleKind_EnumMap[]
Definition: sdpropls.cxx:580
constexpr OUStringLiteral gsPlayFull(u"PlayFull")
constexpr OUStringLiteral gsOnClick(u"OnClick")
constexpr OUStringLiteral gsClickAction(u"ClickAction")
constexpr OUStringLiteral gsBookmark(u"Bookmark")
constexpr OUStringLiteral gsLibrary(u"Library")
static void ImpExportEquations(SvXMLExport &rExport, const uno::Sequence< OUString > &rEquations)
static void lcl_CopyStream(uno::Reference< io::XInputStream > const &xInStream, uno::Reference< embed::XStorage > const &xTarget, OUString const &rPath, const OUString &rMimeType)
constexpr OUStringLiteral gsEffect(u"Effect")
constexpr OUStringLiteral gsStartShape(u"StartShape")
constexpr OUStringLiteral gsSoundURL(u"SoundURL")
static void ImpExportEnhancedPath(SvXMLExport &rExport, const uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > &rCoordinates, const uno::Sequence< css::drawing::EnhancedCustomShapeSegment > &rSegments, bool bExtended=false)
constexpr OUStringLiteral gsMacroName(u"MacroName")
static void ExportParameter(OUStringBuffer &rStrBuffer, const css::drawing::EnhancedCustomShapeParameter &rParameter)
constexpr OUStringLiteral gsEndShape(u"EndShape")
static OUString lcl_StoreMediaAndGetURL(SvXMLExport &rExport, uno::Reference< beans::XPropertySet > const &xPropSet, OUString const &rURL, const OUString &rMimeType)
constexpr OUStringLiteral gsZIndex(u"ZOrder")
constexpr OUStringLiteral gsStarBasic(u"StarBasic")
constexpr OUStringLiteral gsSpeed(u"Speed")
constexpr OUStringLiteral gsPrintable(u"Printable")
constexpr OUStringLiteral gsModel(u"Model")
constexpr OUStringLiteral XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE
constexpr OUStringLiteral gsScript(u"Script")
constexpr OUStringLiteral gsHyperlink(u"Hyperlink")
constexpr OUStringLiteral gsVerb(u"Verb")
static void ImpExportEnhancedGeometry(SvXMLExport &rExport, const uno::Reference< beans::XPropertySet > &xPropSet)
constexpr OUStringLiteral gsVisible(u"Visible")
static void ImpExportHandles(SvXMLExport &rExport, const uno::Sequence< beans::PropertyValues > &rHandles)
constexpr OUStringLiteral gsEventType(u"EventType")
constexpr OUStringLiteral gsPresentation(u"Presentation")
XmlShapeType
Definition: shapeexport.hxx:71
@ DrawGraphicObjectShape
@ PresGraphicObjectShape
std::vector< ImplXMLShapeExportInfo > ImplXMLShapeExportInfoVector
a vector for shape style and type cache information
XMLShapeExportFlags
Definition: shapeexport.hxx:49
const sal_Unicode *const aMimeType[]
caches style and type info after a collectShapeAutostyle for later use in exportShape
XmlShapeType meShapeType
XmlStyleFamily mnFamily
css::uno::Reference< css::drawing::XShape > xCustomShapeReplacement
Represents a property with its API-name, its XML-name and the type of its value.
Definition: maptype.hxx:33
bool IsEnd() const
Definition: maptype.hxx:132
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:140
bool bVisible
TextPNS
Definition: txtparae.hxx:74
#define SAL_MAX_INT32
OUString sId
std::vector< ISegmentProgressBarRef > aSegments
SvXMLEnumMapEntry< drawing::EscapeDirection > const aXML_GlueEscapeDirection_EnumMap[]
Definition: ximpshap.cxx:120
SvXMLEnumMapEntry< drawing::Alignment > const aXML_GlueAlignment_EnumMap[]
Definition: ximpshap.cxx:106
constexpr sal_uInt16 XML_NAMESPACE_DRAW
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_SVG
constexpr sal_uInt16 XML_NAMESPACE_DR3D
constexpr sal_uInt16 XML_NAMESPACE_DOM
constexpr sal_uInt16 XML_NAMESPACE_TABLE
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
constexpr sal_uInt16 XML_NAMESPACE_OOO
constexpr sal_uInt16 XML_NAMESPACE_DRAW_EXT
constexpr sal_uInt16 XML_NAMESPACE_SCRIPT