/src/libreoffice/svx/source/sdr/primitive2d/primitivefactory2d.cxx
Line | Count | Source |
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> |
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> |
26 | | |
27 | | using namespace com::sun::star; |
28 | | |
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*/ ) |
32 | 0 | { |
33 | 0 | css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > aRetval; |
34 | |
|
35 | 0 | if(xShape.is()) |
36 | 0 | { |
37 | 0 | SdrObject* pSource = SdrObject::getSdrObjectFromXShape(xShape); |
38 | |
|
39 | 0 | if(pSource) |
40 | 0 | { |
41 | 0 | const sdr::contact::ViewContact& rSource(pSource->GetViewContact()); |
42 | 0 | drawinglayer::primitive2d::Primitive2DContainer aSourceVal; |
43 | 0 | rSource.getViewIndependentPrimitive2DContainer(aSourceVal); |
44 | 0 | aRetval = aSourceVal.toSequence(); |
45 | 0 | } |
46 | 0 | } |
47 | |
|
48 | 0 | return aRetval; |
49 | 0 | } |
50 | | |
51 | | void PrimitiveFactory2D::createPrimitivesFromXShape( |
52 | | const uno::Reference< drawing::XShape >& xShape, |
53 | | const uno::Sequence< beans::PropertyValue >& /*aParms*/, |
54 | | drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) |
55 | 0 | { |
56 | 0 | if(xShape.is()) |
57 | 0 | { |
58 | 0 | SdrObject* pSource = SdrObject::getSdrObjectFromXShape(xShape); |
59 | |
|
60 | 0 | if(pSource) |
61 | 0 | { |
62 | 0 | const sdr::contact::ViewContact& rSource(pSource->GetViewContact()); |
63 | 0 | rSource.getViewIndependentPrimitive2DContainer(rVisitor); |
64 | 0 | } |
65 | 0 | } |
66 | 0 | } |
67 | | |
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*/ ) |
71 | 0 | { |
72 | 0 | css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > aRetval; |
73 | |
|
74 | 0 | if(xDrawPage.is()) |
75 | 0 | { |
76 | 0 | SdrPage* pSource = GetSdrPageFromXDrawPage(xDrawPage); |
77 | |
|
78 | 0 | if(pSource) |
79 | 0 | { |
80 | 0 | const sdr::contact::ViewContact& rSource(pSource->GetViewContact()); |
81 | 0 | drawinglayer::primitive2d::Primitive2DContainer aSourceRetval; |
82 | 0 | rSource.getViewIndependentPrimitive2DContainer(aSourceRetval); |
83 | 0 | aRetval = aSourceRetval.toSequence(); |
84 | 0 | } |
85 | 0 | } |
86 | |
|
87 | 0 | return aRetval; |
88 | 0 | } |
89 | | |
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 &) |
94 | 0 | { |
95 | 0 | return cppu::acquire(new PrimitiveFactory2D); |
96 | 0 | } |
97 | | |
98 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |