26#include <com/sun/star/awt/Rectangle.hpp>
27#include <com/sun/star/drawing/ColorMode.hpp>
28#include <com/sun/star/text/GraphicCrop.hpp>
29#include <com/sun/star/drawing/PointSequenceSequence.hpp>
30#include <com/sun/star/drawing/PointSequence.hpp>
31#include <com/sun/star/drawing/XLayerSupplier.hpp>
32#include <com/sun/star/drawing/XLayerManager.hpp>
33#include <com/sun/star/graphic/XGraphic.hpp>
34#include <com/sun/star/container/XNameAccess.hpp>
35#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
55std::unique_ptr<GraphicObject> importShapeGraphic(uno::Reference<beans::XPropertySet>
const& xPropSet)
57 std::unique_ptr<GraphicObject> xRet;
59 uno::Reference<graphic::XGraphic> xGraphic;
69 if (GraphicType::Default == xRet->GetType() || GraphicType::NONE == xRet->GetType())
79class ShapeOfGroup :
public Shape
83 uno::Reference<drawing::XShape> xShape,
84 uno::Reference<beans::XPropertySet>
const& xPropSet,
88 virtual uno::Reference<drawing::XShape> getXShape()
const override;
90 bool bRedrawLayer )
override;
92 virtual void clearAllViewLayers()
override;
93 virtual bool update()
const override;
94 virtual bool render()
const override;
95 virtual bool isContentChanged()
const override;
99 virtual bool isVisible()
const override;
100 virtual double getPriority()
const override;
101 virtual bool isBackgroundDetached()
const override;
105 uno::Reference<drawing::XShape>
const mxShape;
113 uno::Reference<drawing::XShape> xShape,
114 uno::Reference<beans::XPropertySet>
const& xPropSet,
121 uno::Any const aTmpRect_( xPropSet->getPropertyValue(
"BoundRect" ));
122 awt::Rectangle
const aTmpRect( aTmpRect_.get<awt::Rectangle>() );
125 aTmpRect.Y - groupPosSize.
getMinY() );
130uno::Reference<drawing::XShape> ShapeOfGroup::getXShape()
const
145void ShapeOfGroup::clearAllViewLayers()
149bool ShapeOfGroup::update()
const
154bool ShapeOfGroup::render()
const
159bool ShapeOfGroup::isContentChanged()
const
182bool ShapeOfGroup::isVisible()
const
187double ShapeOfGroup::getPriority()
const
192bool ShapeOfGroup::isBackgroundDetached()
const
202 std::u16string_view shapeType )
const
204 if( shapeType ==
u"com.sun.star.drawing.MediaShape" || shapeType ==
u"com.sun.star.presentation.MediaShape" )
211 else if( shapeType ==
u"com.sun.star.drawing.AppletShape" )
226 "com.sun.star.comp.sfx2.AppletObject",
231 else if( shapeType ==
u"com.sun.star.drawing.OLE2Shape" || shapeType ==
u"com.sun.star.presentation.OLE2Shape" )
235 return DrawShape::create( xCurrShape,
241 else if( shapeType ==
u"com.sun.star.drawing.GraphicObjectShape" || shapeType ==
u"com.sun.star.presentation.GraphicObjectShape" )
247 std::unique_ptr<GraphicObject> xGraphicObject(importShapeGraphic(xPropSet));
253 if (!xGraphicObject->IsAnimated())
260 return DrawShape::create( xCurrShape,
271 drawing::ColorMode eColorMode( drawing::ColorMode_STANDARD );
272 sal_Int16 nLuminance(0);
273 sal_Int16 nContrast(0);
278 sal_Int16 nTransparency(0);
279 sal_Int32 nRotation(0);
302 text::GraphicCrop aGraphCrop;
305 aGraphAttrs.
SetCrop( aGraphCrop.Left,
316 xGraphicObject->GetTransformedGraphic(
317 xGraphicObject->GetPrefSize(),
318 xGraphicObject->GetPrefMapMode(),
321 return DrawShape::create( xCurrShape,
329 return DrawShape::create( xCurrShape,
337bool ShapeImporter::isSkip(
339 std::u16string_view shapeType,
346 "IsEmptyPresentationObject") &&
356 const uno::Any&
a(xLayer->getPropertyValue(
"Name") );
357 bool const bRet = (
a >>= layerName);
360 if( layerName ==
"DrawnInSlideshow" )
363 importPolygons(xPropSet);
372 if(mbConvertingMasterPage)
374 if( shapeType ==
u"com.sun.star.presentation.TitleTextShape" || shapeType ==
u"com.sun.star.presentation.OutlinerShape" )
385 drawing::PointSequenceSequence aRetval;
386 sal_Int32 nLineColor=0;
392 const drawing::PointSequence* pOuterSequence = aRetval.getArray();
396 for(
const awt::Point& rPoint : *pOuterSequence )
398 aPoint.
setX(rPoint.X);
399 aPoint.
setY(rPoint.Y);
402 for(
const auto& pView :
mrContext.mrViewContainer )
409 pPolyPoly->setRGBALineColor(
unoColor2RGBColor( nLineColor ).getIntegerColor() );
410 pPolyPoly->setStrokeWidth(fLineWidth);
419 if( maShapesStack.empty() )
427 uno::UNO_QUERY_THROW),
429 mnAscendingPrio += 1.0;
437 bool bIsGroupShape =
false;
439 while( !maShapesStack.empty() && !pRet )
448 xCurrShape, uno::UNO_QUERY );
462 if(xLayerSupplier.is())
468 xDrawnInSlideshow = xLayerManager->getLayerForShape(xCurrShape);
471 OUString
const shapeType( xCurrShape->getShapeType());
474 if( !isSkip(xPropSet, shapeType, xDrawnInSlideshow) )
476 bIsGroupShape = shapeType ==
"com.sun.star.drawing.GroupShape";
480 pRet = std::make_shared<ShapeOfGroup>(
482 xCurrShape, xPropSet,
487 pRet =
createShape( xCurrShape, xPropSet, shapeType );
489 mnAscendingPrio += 1.0;
497 if( bIsGroupShape && pRet )
507bool ShapeImporter::isImportDone()
const
509 return maShapesStack.empty();
521 sal_Int32 nOrdNumStart,
522 bool bConvertingMasterPage ) :
523 mxPage(
std::move( xActualPage )),
524 mxPagesSupplier(
std::move( xPagesSupplier )),
528 mnAscendingPrio( nOrdNumStart ),
529 mbConvertingMasterPage( bConvertingMasterPage )
532 xPage, uno::UNO_QUERY_THROW );
PropertyValueVector_t aPropertyValues
const NodeContext & mrContext
void SetGamma(double fGamma)
void SetRotation(Degree10 nRotate10)
void SetChannelR(short nChannelRPercent)
void SetContrast(short nContrastPercent)
void SetChannelB(short nChannelBPercent)
void SetCrop(tools::Long nLeft_100TH_MM, tools::Long nTop_100TH_MM, tools::Long nRight_100TH_MM, tools::Long nBottom_100TH_MM)
void SetDrawMode(GraphicDrawMode eDrawMode)
void SetLuminance(short nLuminancePercent)
void SetAlpha(sal_uInt8 cAlpha)
void SetChannelG(short nChannelGPercent)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
static PolyPolygonSharedPtr createPolyPolygon(const CanvasSharedPtr &, const ::basegfx::B2DPolygon &rPoly)
::std::stack< XShapesEntry > maShapesStack
#define SAL_N_ELEMENTS(arr)
css::uno::Reference< css::drawing::XShape > OOO_DLLPUBLIC_TEST createShape(const css::uno::Reference< css::lang::XComponent > &r_xComponent, std::u16string_view r_aKind, const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nWidth, const sal_Int32 nHeight)
std::shared_ptr< PolyPolygon > PolyPolygonSharedPtr
::std::vector< ::cppcanvas::PolyPolygonSharedPtr > PolyPolygonVector
ShapeSharedPtr createMediaShape(const uno::Reference< drawing::XShape > &xShape, double nPrio, const SlideShowContext &rContext)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
std::shared_ptr< ViewLayer > ViewLayerSharedPtr
ShapeSharedPtr createBackgroundShape(const uno::Reference< drawing::XDrawPage > &xDrawPage, const uno::Reference< drawing::XDrawPage > &xMasterPage, const SlideShowContext &rContext)
RGBColor unoColor2RGBColor(sal_Int32)
Convert a plain UNO API 32 bit int to RGBColor.
::std::shared_ptr< Shape > ShapeSharedPtr
std::shared_ptr< Shape > createAppletShape(const uno::Reference< drawing::XShape > &xShape, double nPrio, const OUString &rServiceName, const char **pPropCopyTable, std::size_t nNumPropEntries, const SlideShowContext &rContext)
uno::Reference< drawing::XShape > const mxShape
basegfx::B2DPoint maPosOffset
ShapeSharedPtr const mpGroupShape
PolyPolygonVector maPolygons
This exception is thrown, when the Shape class was not able to convert an API object into our interna...
ShapeSharedPtr const mpGroupShape
css::uno::Reference< css::drawing::XShapes > const mxShapes
Common arguments for slideshow objects.