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/uno/XComponentContext.hpp>
21 #include <sdr/primitive2d/primitivefactory2d.hxx>
22 #include <svx/sdr/contact/viewcontact.hxx>
23 #include <svx/svdobj.hxx>
24 #include <svx/svdpage.hxx>
25 #include <svx/unoapi.hxx>
27 using namespace com::sun::star
;
29 css::uno::Sequence
< css::uno::Reference
< css::graphic::XPrimitive2D
> > SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXShape(
30 const uno::Reference
< drawing::XShape
>& xShape
,
31 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ )
33 css::uno::Sequence
< css::uno::Reference
< css::graphic::XPrimitive2D
> > aRetval
;
37 SdrObject
* pSource
= SdrObject::getSdrObjectFromXShape(xShape
);
41 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
42 drawinglayer::primitive2d::Primitive2DContainer aSourceVal
;
43 rSource
.getViewIndependentPrimitive2DContainer(aSourceVal
);
44 aRetval
= aSourceVal
.toSequence();
51 void PrimitiveFactory2D::createPrimitivesFromXShape(
52 const uno::Reference
< drawing::XShape
>& xShape
,
53 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/,
54 drawinglayer::primitive2d::Primitive2DDecompositionVisitor
& rVisitor
)
58 SdrObject
* pSource
= SdrObject::getSdrObjectFromXShape(xShape
);
62 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
63 rSource
.getViewIndependentPrimitive2DContainer(rVisitor
);
68 css::uno::Sequence
< css::uno::Reference
< css::graphic::XPrimitive2D
> > SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXDrawPage(
69 const uno::Reference
< drawing::XDrawPage
>& xDrawPage
,
70 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ )
72 css::uno::Sequence
< css::uno::Reference
< css::graphic::XPrimitive2D
> > aRetval
;
76 SdrPage
* pSource
= GetSdrPageFromXDrawPage(xDrawPage
);
80 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
81 drawinglayer::primitive2d::Primitive2DContainer aSourceRetval
;
82 rSource
.getViewIndependentPrimitive2DContainer(aSourceRetval
);
83 aRetval
= aSourceRetval
.toSequence();
90 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
91 com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation(
92 css::uno::XComponentContext
*,
93 css::uno::Sequence
<css::uno::Any
> const &)
95 return cppu::acquire(new PrimitiveFactory2D
);
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */