LibreOffice Module svx (master) 1
primitivefactory2d.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 <com/sun/star/uno/XComponentContext.hpp>
23#include <svx/svdobj.hxx>
24#include <svx/svdpage.hxx>
25#include <svx/unoapi.hxx>
26
27using namespace com::sun::star;
28
29css::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*/ )
32{
33 css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > aRetval;
34
35 if(xShape.is())
36 {
38
39 if(pSource)
40 {
41 const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
43 rSource.getViewIndependentPrimitive2DContainer(aSourceVal);
44 aRetval = aSourceVal.toSequence();
45 }
46 }
47
48 return aRetval;
49}
50
52 const uno::Reference< drawing::XShape >& xShape,
53 const uno::Sequence< beans::PropertyValue >& /*aParms*/,
55{
56 if(xShape.is())
57 {
59
60 if(pSource)
61 {
62 const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
63 rSource.getViewIndependentPrimitive2DContainer(rVisitor);
64 }
65 }
66}
67
68css::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*/ )
71{
72 css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > aRetval;
73
74 if(xDrawPage.is())
75 {
76 SdrPage* pSource = GetSdrPageFromXDrawPage(xDrawPage);
77
78 if(pSource)
79 {
80 const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
82 rSource.getViewIndependentPrimitive2DContainer(aSourceRetval);
83 aRetval = aSourceRetval.toSequence();
84 }
85 }
86
87 return aRetval;
88}
89
90extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
92 css::uno::XComponentContext *,
93 css::uno::Sequence<css::uno::Any> const &)
94{
95 return cppu::acquire(new PrimitiveFactory2D);
96}
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > SAL_CALL createPrimitivesFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape, const css::uno::Sequence< css::beans::PropertyValue > &aParms) override
virtual css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > SAL_CALL createPrimitivesFromXDrawPage(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage, const css::uno::Sequence< css::beans::PropertyValue > &aParms) override
Abstract DrawObject.
Definition: svdobj.hxx:261
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
Definition: unoshape.cxx:3996
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:261
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:377
const sdr::contact::ViewContact & GetViewContact() const
Definition: svdpage.cxx:1165
css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > toSequence() const
void getViewIndependentPrimitive2DContainer(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
SdrPage * GetSdrPageFromXDrawPage(const uno::Reference< drawing::XDrawPage > &xDrawPage) noexcept
returns the SdrObject from the given StarOffice API wrapper
Definition: unopage.cxx:886