1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/beans/XPropertySet.hpp>
21 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
22 #include <com/sun/star/container/XIdentifierContainer.hpp>
23 #include <com/sun/star/xml/dom/XDocument.hpp>
24 #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
26 #include <oox/shape/ShapeContextHandler.hxx>
27 #include <oox/shape/ShapeDrawingFragmentHandler.hxx>
28 #include "LockedCanvasContext.hxx"
29 #include "WordprocessingCanvasContext.hxx"
30 #include "WpsContext.hxx"
31 #include "WpgContext.hxx"
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 #include <oox/vml/vmldrawingfragment.hxx>
34 #include <oox/vml/vmlshape.hxx>
35 #include <oox/vml/vmlshapecontainer.hxx>
36 #include <oox/shape/ShapeFilterBase.hxx>
37 #include <oox/token/namespaces.hxx>
38 #include <oox/token/tokens.hxx>
39 #include <oox/drawingml/theme.hxx>
40 #include <oox/drawingml/themefragmenthandler.hxx>
41 #include <svx/svdogrp.hxx>
42 #include <svx/svdoedge.hxx>
43 #include <svx/svdobj.hxx>
45 #include <drawingml/connectorhelper.hxx>
50 using namespace ::com::sun::star
;
52 namespace oox::shape
{
54 using namespace drawingml
;
56 ShapeContextHandler::ShapeContextHandler(rtl::Reference
<ShapeFilterBase
> xFilterBase
) :
57 m_bFullWPGSUpport(false),
58 mxShapeFilterBase(std::move(xFilterBase
))
63 ShapeContextHandler::~ShapeContextHandler()
67 uno::Reference
<xml::sax::XFastContextHandler
> ShapeContextHandler::getLockedCanvasContext(sal_Int32 nElement
)
69 if (!mxLockedCanvasContext
.is())
71 FragmentHandler2Ref
rFragmentHandler(new ShapeFragmentHandler(*mxShapeFilterBase
, msRelationFragmentPath
));
73 switch (nElement
& 0xffff)
75 case XML_lockedCanvas
:
76 mxLockedCanvasContext
.set(new LockedCanvasContext(*rFragmentHandler
));
83 return static_cast<ContextHandler
*>(mxLockedCanvasContext
.get());
87 * This method creates new ChartGraphicDataContext Object.
89 uno::Reference
<xml::sax::XFastContextHandler
> ShapeContextHandler::getChartShapeContext(sal_Int32 nElement
)
91 if (!mxChartShapeContext
.is())
93 switch (nElement
& 0xffff)
97 std::unique_ptr
<ContextHandler2Helper
> pFragmentHandler(
98 new ShapeFragmentHandler(*mxShapeFilterBase
, msRelationFragmentPath
));
99 mpShape
= std::make_shared
<Shape
>("com.sun.star.drawing.OLE2Shape" );
100 mxChartShapeContext
.set(new ChartGraphicDataContext(*pFragmentHandler
, mpShape
, true));
108 return mxChartShapeContext
;
111 uno::Reference
<xml::sax::XFastContextHandler
> ShapeContextHandler::getWpsContext(sal_Int32 nStartElement
, sal_Int32 nElement
)
113 if (!mxWpsContext
.is())
115 FragmentHandler2Ref
rFragmentHandler(new ShapeFragmentHandler(*mxShapeFilterBase
, msRelationFragmentPath
));
116 ShapePtr pMasterShape
;
118 uno::Reference
<drawing::XShape
> xShape
;
119 // No element happens in case of pretty-printed XML, bodyPr is the case when we are called again after <wps:txbx>.
120 if (!nElement
|| nElement
== WPS_TOKEN(bodyPr
))
121 // Assume that this is just a continuation of the previous shape.
122 xShape
= mxSavedShape
;
124 switch (getBaseToken(nStartElement
))
127 mxWpsContext
.set(new WpsContext(
131 std::make_shared
<oox::drawingml::Shape
>(
132 "com.sun.star.drawing.CustomShape")));
142 uno::Reference
<xml::sax::XFastContextHandler
> ShapeContextHandler::getWpgContext(sal_Int32 nElement
)
144 if (!mxWpgContext
.is())
146 FragmentHandler2Ref
rFragmentHandler(new ShapeFragmentHandler(*mxShapeFilterBase
, msRelationFragmentPath
));
148 switch (getBaseToken(nElement
))
152 mxWpgContext
.set(new WpgContext(*rFragmentHandler
, oox::drawingml::ShapePtr()));
153 mxWpgContext
->setFullWPGSupport(m_bFullWPGSUpport
);
161 return static_cast<ContextHandler
*>(mxWpgContext
.get());
164 uno::Reference
<xml::sax::XFastContextHandler
> const &
165 ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element
)
167 if (! mxGraphicShapeContext
.is())
169 auto pFragmentHandler
= std::make_shared
<ShapeFragmentHandler
>(*mxShapeFilterBase
, msRelationFragmentPath
);
170 ShapePtr pMasterShape
;
172 switch (Element
& 0xffff)
175 mpShape
= std::make_shared
<Shape
>("com.sun.star.drawing.GraphicObjectShape" );
176 mxGraphicShapeContext
.set
177 (new GraphicalObjectFrameContext(*pFragmentHandler
, pMasterShape
, mpShape
, true));
180 mpShape
= std::make_shared
<Shape
>("com.sun.star.drawing.GraphicObjectShape" );
181 mxGraphicShapeContext
.set
182 (new GraphicShapeContext(*pFragmentHandler
, pMasterShape
, mpShape
));
189 return mxGraphicShapeContext
;
192 uno::Reference
<xml::sax::XFastContextHandler
>
193 ShapeContextHandler::getDrawingShapeContext()
195 if (!mxDrawingFragmentHandler
.is())
197 mpDrawing
= std::make_shared
<oox::vml::Drawing
>( *mxShapeFilterBase
, mxDrawPage
, oox::vml::VMLDRAWING_WORD
);
198 mxDrawingFragmentHandler
.set
199 (new oox::vml::DrawingFragment
200 ( *mxShapeFilterBase
, msRelationFragmentPath
, *mpDrawing
));
204 // Reset the handler if fragment path has changed
205 OUString sHandlerFragmentPath
= mxDrawingFragmentHandler
->getFragmentPath();
206 if ( msRelationFragmentPath
!= sHandlerFragmentPath
)
208 mxDrawingFragmentHandler
.clear();
209 mxDrawingFragmentHandler
.set
210 (new oox::vml::DrawingFragment
211 ( *mxShapeFilterBase
, msRelationFragmentPath
, *mpDrawing
));
214 return static_cast<ContextHandler
*>(mxDrawingFragmentHandler
.get());
217 uno::Reference
<xml::sax::XFastContextHandler
>
218 ShapeContextHandler::getDiagramShapeContext()
220 if (!mxDiagramShapeContext
.is())
222 auto pFragmentHandler
= std::make_shared
<ShapeFragmentHandler
>(*mxShapeFilterBase
, msRelationFragmentPath
);
223 mpShape
= std::make_shared
<Shape
>();
224 mpShape
->setSize(maSize
);
225 mxDiagramShapeContext
.set(new DiagramGraphicDataContext(*pFragmentHandler
, mpShape
));
228 return mxDiagramShapeContext
;
231 uno::Reference
<xml::sax::XFastContextHandler
> ShapeContextHandler::getWordprocessingCanvasContext(sal_Int32 nElement
)
233 if (!mxWordprocessingCanvasContext
.is())
235 FragmentHandler2Ref
rFragmentHandler(new ShapeFragmentHandler(*mxShapeFilterBase
, msRelationFragmentPath
));
237 switch (getBaseToken(nElement
))
240 mxWordprocessingCanvasContext
.set(new WordprocessingCanvasContext(*rFragmentHandler
, maSize
));
247 return static_cast<ContextHandler
*>(mxWordprocessingCanvasContext
.get());
250 uno::Reference
<xml::sax::XFastContextHandler
>
251 ShapeContextHandler::getContextHandler(sal_Int32 nElement
)
253 uno::Reference
<xml::sax::XFastContextHandler
> xResult
;
254 const sal_uInt32 nStartToken
= getStartToken();
256 switch (getNamespace( nStartToken
))
260 xResult
.set(getDrawingShapeContext());
262 case NMSP_dmlDiagram
:
263 xResult
.set(getDiagramShapeContext());
265 case NMSP_dmlLockedCanvas
:
266 xResult
.set(getLockedCanvasContext(nStartToken
));
269 xResult
.set(getChartShapeContext(nStartToken
));
272 xResult
.set(getWpsContext(nStartToken
, nElement
));
275 xResult
.set(getWpgContext(nStartToken
));
278 xResult
.set(getWordprocessingCanvasContext(nStartToken
));
281 xResult
.set(getGraphicShapeContext(nStartToken
));
288 // css::xml::sax::XFastContextHandler:
289 void SAL_CALL
ShapeContextHandler::startFastElement
290 (::sal_Int32 Element
,
291 const uno::Reference
< xml::sax::XFastAttributeList
> & Attribs
)
293 mxShapeFilterBase
->filter(maMediaDescriptor
);
295 if (Element
== DGM_TOKEN(relIds
) || Element
== LC_TOKEN(lockedCanvas
) || Element
== C_TOKEN(chart
) ||
296 Element
== WPS_TOKEN(wsp
) || Element
== WPG_TOKEN(wgp
) || Element
== OOX_TOKEN(dmlPicture
, pic
)
297 || Element
== WPC_TOKEN(wpc
))
299 // Parse the theme relation, if available; the diagram won't have colors without it.
300 if (!mpThemePtr
&& !msRelationFragmentPath
.isEmpty())
302 // Get Target for Type = "officeDocument" from _rels/.rels file
303 // aOfficeDocumentFragmentPath is pointing to "word/document.xml" for docx & to "ppt/presentation.xml" for pptx
304 FragmentHandlerRef
rFragmentHandlerRef(new ShapeFragmentHandler(*mxShapeFilterBase
, u
"/"_ustr
));
305 OUString aOfficeDocumentFragmentPath
= rFragmentHandlerRef
->getFragmentPathFromFirstTypeFromOfficeDoc( u
"officeDocument" );
307 // Get the theme DO NOT use msRelationFragmentPath for getting theme as for a document there is a single theme in document.xml.rels
308 // and the same is used by header and footer as well.
309 FragmentHandlerRef
rFragmentHandler(new ShapeFragmentHandler(*mxShapeFilterBase
, aOfficeDocumentFragmentPath
));
310 OUString aThemeFragmentPath
= rFragmentHandler
->getFragmentPathFromFirstTypeFromOfficeDoc( u
"theme" );
312 if (!aThemeFragmentPath
.isEmpty())
314 mpThemePtr
= std::make_shared
<Theme
>();
315 auto pTheme
= std::make_shared
<model::Theme
>();
316 mpThemePtr
->setTheme(pTheme
);
317 uno::Reference
<xml::sax::XFastSAXSerializable
> xDoc(mxShapeFilterBase
->importFragment(aThemeFragmentPath
), uno::UNO_QUERY_THROW
);
318 mxShapeFilterBase
->importFragment(new ThemeFragmentHandler(*mxShapeFilterBase
, aThemeFragmentPath
, *mpThemePtr
, *pTheme
), xDoc
);
319 mxShapeFilterBase
->setCurrentTheme(mpThemePtr
);
322 else if (mpThemePtr
&& !mxShapeFilterBase
->getCurrentTheme())
324 mxShapeFilterBase
->setCurrentTheme(mpThemePtr
);
327 createFastChildContext(Element
, Attribs
);
330 // Entering VML block (startFastElement() is called for the outermost tag),
331 // handle possible recursion.
332 if ( getContextHandler() == getDrawingShapeContext() )
333 mpDrawing
->getShapes().pushMark();
335 uno::Reference
<XFastContextHandler
> xContextHandler(getContextHandler());
337 if (xContextHandler
.is())
338 xContextHandler
->startFastElement(Element
, Attribs
);
341 void SAL_CALL
ShapeContextHandler::startUnknownElement
342 (const OUString
& Namespace
, const OUString
& Name
,
343 const uno::Reference
< xml::sax::XFastAttributeList
> & Attribs
)
345 if ( getContextHandler() == getDrawingShapeContext() )
346 mpDrawing
->getShapes().pushMark();
348 uno::Reference
<XFastContextHandler
> xContextHandler(getContextHandler());
350 if (xContextHandler
.is())
351 xContextHandler
->startUnknownElement(Namespace
, Name
, Attribs
);
354 void SAL_CALL
ShapeContextHandler::endFastElement(::sal_Int32 Element
)
356 uno::Reference
<XFastContextHandler
> xContextHandler(getContextHandler());
358 if (xContextHandler
.is())
359 xContextHandler
->endFastElement(Element
);
360 // In case a textbox is sent, and later we get additional properties for
361 // the textbox, then the wps context is not cleared, so do that here.
362 if (Element
!= (NMSP_wps
| XML_wsp
))
365 uno::Reference
<lang::XServiceInfo
> xServiceInfo(mxSavedShape
, uno::UNO_QUERY
);
366 bool bTextFrame
= xServiceInfo
.is() && xServiceInfo
->supportsService(u
"com.sun.star.text.TextFrame"_ustr
);
367 bool bTextBox
= false;
370 uno::Reference
<beans::XPropertySet
> xPropertySet(mxSavedShape
, uno::UNO_QUERY
);
371 if (xPropertySet
.is())
372 xPropertySet
->getPropertyValue(u
"TextBox"_ustr
) >>= bTextBox
;
374 if (bTextFrame
|| bTextBox
)
375 mxWpsContext
.clear();
376 mxSavedShape
.clear();
379 void SAL_CALL
ShapeContextHandler::endUnknownElement
380 (const OUString
& Namespace
,
381 const OUString
& Name
)
383 uno::Reference
<XFastContextHandler
> xContextHandler(getContextHandler());
385 if (xContextHandler
.is())
386 xContextHandler
->endUnknownElement(Namespace
, Name
);
389 uno::Reference
< xml::sax::XFastContextHandler
> SAL_CALL
390 ShapeContextHandler::createFastChildContext
391 (::sal_Int32 Element
,
392 const uno::Reference
< xml::sax::XFastAttributeList
> & Attribs
)
394 uno::Reference
< xml::sax::XFastContextHandler
> xResult
;
395 uno::Reference
< xml::sax::XFastContextHandler
> xContextHandler(getContextHandler(Element
));
397 if (xContextHandler
.is())
398 xResult
.set(xContextHandler
->createFastChildContext
404 uno::Reference
< xml::sax::XFastContextHandler
> SAL_CALL
405 ShapeContextHandler::createUnknownChildContext
406 (const OUString
& Namespace
,
407 const OUString
& Name
,
408 const uno::Reference
< xml::sax::XFastAttributeList
> & Attribs
)
410 uno::Reference
<XFastContextHandler
> xContextHandler(getContextHandler());
412 if (xContextHandler
.is())
413 return xContextHandler
->createUnknownChildContext
414 (Namespace
, Name
, Attribs
);
416 return uno::Reference
< xml::sax::XFastContextHandler
>();
419 void SAL_CALL
ShapeContextHandler::characters(const OUString
& aChars
)
421 uno::Reference
<XFastContextHandler
> xContextHandler(getContextHandler());
423 if (xContextHandler
.is())
424 xContextHandler
->characters(aChars
);
427 namespace // helpers for case mxWordprocessingCanvasContext
429 void lcl_createShapeMap(oox::drawingml::ShapePtr rShapePtr
,
430 oox::drawingml::ShapeIdMap
& rShapeMap
)
432 std::vector
< ShapePtr
>& rChildren
= rShapePtr
->getChildren();
433 if (rChildren
.empty())
435 for (auto& pIt
: rChildren
)
437 rShapeMap
[pIt
->getId()] = pIt
; // add child itself
438 lcl_createShapeMap(pIt
, rShapeMap
); // and all its descendants
442 } // end anonymous namespace
444 uno::Reference
< drawing::XShape
>
445 ShapeContextHandler::getShape()
447 uno::Reference
< drawing::XShape
> xResult
;
448 uno::Reference
< drawing::XShapes
> xShapes
= mxDrawPage
;
450 if (mxShapeFilterBase
&& xShapes
.is())
452 if ( getContextHandler() == getDrawingShapeContext() )
454 mpDrawing
->finalizeFragmentImport();
455 if( std::shared_ptr
< vml::ShapeBase
> pShape
= mpDrawing
->getShapes().takeLastShape() )
456 xResult
= pShape
->convertAndInsert( xShapes
);
457 // Only now remove the recursion mark, because getShape() is called in writerfilter
458 // after endFastElement().
459 mpDrawing
->getShapes().popMark();
461 else if (mxDiagramShapeContext
.is())
463 basegfx::B2DHomMatrix aMatrix
;
464 if (mpShape
->getExtDrawings().empty())
466 mpShape
->addShape( *mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, mpShape
->getFillProperties() );
467 xResult
= mpShape
->getXShape();
471 // Prerendered diagram output is available, then use that, and throw away the original result.
472 for (auto const& extDrawing
: mpShape
->getExtDrawings())
474 OUString
aFragmentPath(mxDiagramShapeContext
->getFragmentPathFromRelId(extDrawing
));
475 oox::drawingml::ShapePtr pShapePtr
= std::make_shared
<Shape
>( "com.sun.star.drawing.GroupShape" );
476 pShapePtr
->setDiagramType();
477 mxShapeFilterBase
->importFragment(new ShapeDrawingFragmentHandler(*mxShapeFilterBase
, aFragmentPath
, pShapePtr
));
478 pShapePtr
->setDiagramDoms(mpShape
->getDiagramDoms());
479 pShapePtr
->keepDiagramDrawing(*mxShapeFilterBase
, aFragmentPath
);
481 if (mpShape
->getFontRefColorForNodes().isUsed())
482 applyFontRefColor(pShapePtr
, mpShape
->getFontRefColorForNodes());
484 // migrate IDiagramHelper to new oox::Shape (from mpShape which was loaded
485 // to pShapePtr where the geometry is now constructed)
486 mpShape
->migrateDiagramHelperToNewShape(pShapePtr
);
488 if (!mpShape
->getChildren().empty())
490 // first child is diagram background - we want to keep it, as drawingML fallback doesn't contain it
491 auto& aChildren
= pShapePtr
->getChildren();
492 ShapePtr pBackground
= mpShape
->getChildren().front();
493 aChildren
.insert(aChildren
.begin(), pBackground
);
496 pShapePtr
->addShape( *mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, pShapePtr
->getFillProperties() );
497 xResult
= pShapePtr
->getXShape();
501 mxDiagramShapeContext
.clear();
503 else if (mxLockedCanvasContext
.is())
505 ShapePtr pShape
= mxLockedCanvasContext
->getShape();
508 basegfx::B2DHomMatrix aMatrix
;
509 pShape
->addShape(*mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, pShape
->getFillProperties());
510 xResult
= pShape
->getXShape();
511 mxLockedCanvasContext
.clear();
514 else if (mxWordprocessingCanvasContext
.is())
516 // group which represents the drawing canvas
517 ShapePtr pShape
= mxWordprocessingCanvasContext
->getShape();
520 basegfx::B2DHomMatrix aMatrix
;
521 pShape
->addShape(*mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, pShape
->getFillProperties());
523 // create a flat map of all shapes in the drawing canvas group.
524 oox::drawingml::ShapeIdMap aShapeMap
;
525 lcl_createShapeMap(pShape
, aShapeMap
);
527 // Traverse aShapeMap and generate edge related properties.
528 for (auto& rIt
: aShapeMap
)
530 if ((rIt
.second
)->getServiceName() == "com.sun.star.drawing.ConnectorShape")
532 ConnectorHelper::applyConnections(rIt
.second
, aShapeMap
);
534 if (rIt
.second
->getConnectorName() == u
"bentConnector3"_ustr
535 || rIt
.second
->getConnectorName() == u
"bentConnector4"_ustr
536 || rIt
.second
->getConnectorName() == u
"bentConnector5"_ustr
)
538 ConnectorHelper::applyBentHandleAdjustments(rIt
.second
);
540 else if (rIt
.second
->getConnectorName() == u
"curvedConnector3"_ustr
541 || rIt
.second
->getConnectorName() == u
"curvedConnector4"_ustr
542 || rIt
.second
->getConnectorName() == u
"curvedConnector5"_ustr
)
544 ConnectorHelper::applyCurvedHandleAdjustments(rIt
.second
);
546 // else use the default path of LibreOffice.
547 // curveConnector2 and bentConnector2 do not have handles.
550 xResult
= pShape
->getXShape();
551 mxWordprocessingCanvasContext
.clear();
554 //NMSP_dmlChart == getNamespace( mnStartToken ) check is introduced to make sure that
555 //mnStartToken is set as NMSP_dmlChart in setStartToken.
556 //Only in case it is set then only the below block of code for ChartShapeContext should be executed.
557 else if (mxChartShapeContext
.is() && (NMSP_dmlChart
== getNamespace( getStartToken() )))
559 basegfx::B2DHomMatrix aMatrix
;
560 oox::drawingml::ShapePtr
xShapePtr( mxChartShapeContext
->getShape());
561 // See SwXTextDocument::createInstance(), ODF import uses the same hack.
562 xShapePtr
->setServiceName(u
"com.sun.star.drawing.temporaryForXMLImportOLE2Shape"_ustr
);
563 xShapePtr
->addShape( *mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, xShapePtr
->getFillProperties() );
564 xResult
= xShapePtr
->getXShape();
565 mxChartShapeContext
.clear();
567 else if (mxWpsContext
.is())
569 ShapePtr pShape
= mxWpsContext
->getShape();
572 basegfx::B2DHomMatrix aMatrix
;
573 pShape
->setPosition(maPosition
);
574 pShape
->addShape(*mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, pShape
->getFillProperties());
575 xResult
= pShape
->getXShape();
576 mxSavedShape
= xResult
;
577 mxWpsContext
.clear();
580 else if (mxWpgContext
.is())
582 ShapePtr pShape
= mxWpgContext
->getShape();
585 basegfx::B2DHomMatrix aMatrix
;
586 pShape
->setPosition(maPosition
);
587 pShape
->addShape(*mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aMatrix
, pShape
->getFillProperties());
588 xResult
= pShape
->getXShape();
589 mxSavedShape
= xResult
;
590 mxWpgContext
.clear();
595 basegfx::B2DHomMatrix aTransformation
;
597 if (maPosition
.X
!= 0 || maPosition
.Y
!= 0)
599 // We got a position from writerfilter/, store that in the shape, otherwise the
600 // position won't be set.
601 mpShape
->setWps(true);
602 mpShape
->setPosition(maPosition
);
605 mpShape
->addShape(*mxShapeFilterBase
, mpThemePtr
.get(), xShapes
, aTransformation
, mpShape
->getFillProperties() );
606 xResult
.set(mpShape
->getXShape());
607 mxGraphicShapeContext
.clear( );
616 void ShapeContextHandler::setDrawPage(const css::uno::Reference
< css::drawing::XDrawPage
> & the_value
)
618 mxDrawPage
= the_value
;
621 void ShapeContextHandler::setModel(const css::uno::Reference
< css::frame::XModel
> & the_value
)
623 if( !mxShapeFilterBase
.is() )
624 throw uno::RuntimeException();
625 uno::Reference
<lang::XComponent
> xComp(the_value
, uno::UNO_QUERY_THROW
);
626 mxShapeFilterBase
->setTargetDocument(xComp
);
629 void ShapeContextHandler::setRelationFragmentPath(const OUString
& the_value
)
631 msRelationFragmentPath
= the_value
;
634 sal_Int32
ShapeContextHandler::getStartToken() const
636 assert(mnStartTokenStack
.size() && "This stack must not be empty!");
637 return mnStartTokenStack
.top();
640 void ShapeContextHandler::popStartToken()
642 if (mnStartTokenStack
.size() > 1)
643 mnStartTokenStack
.pop();
646 void ShapeContextHandler::pushStartToken( sal_Int32 _starttoken
)
648 mnStartTokenStack
.push(_starttoken
);
651 void ShapeContextHandler::setPosition(const awt::Point
& rPosition
)
653 maPosition
= rPosition
;
656 void ShapeContextHandler::setSize(const awt::Size
& rSize
)
661 void ShapeContextHandler::setDocumentProperties(const uno::Reference
<document::XDocumentProperties
>& xDocProps
)
663 mxDocumentProperties
= xDocProps
;
664 mxShapeFilterBase
->checkDocumentProperties(mxDocumentProperties
);
667 void ShapeContextHandler::setMediaDescriptor(const uno::Sequence
<beans::PropertyValue
>& rMediaDescriptor
)
669 maMediaDescriptor
= rMediaDescriptor
;
672 void ShapeContextHandler::setGraphicMapper(css::uno::Reference
<css::graphic::XGraphicMapper
> const & rxGraphicMapper
)
674 mxShapeFilterBase
->setGraphicMapper(rxGraphicMapper
);
677 void ShapeContextHandler::applyFontRefColor(const oox::drawingml::ShapePtr
& pShape
,
678 const oox::drawingml::Color
& rFontRefColor
)
680 pShape
->getShapeStyleRefs()[XML_fontRef
].maPhClr
= rFontRefColor
;
681 std::vector
<oox::drawingml::ShapePtr
>& vChildren
= pShape
->getChildren();
682 for (auto const& child
: vChildren
)
684 applyFontRefColor(child
, rFontRefColor
);
689 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */