Branch data Line data Source code
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 <svx/sdr/primitive2d/primitiveFactory2d.hxx>
21 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
22 : : #include <svx/svdobj.hxx>
23 : : #include <svx/svdpage.hxx>
24 : : #include <svx/unoapi.hxx>
25 : : #include <svx/sdr/contact/viewcontact.hxx>
26 : :
27 : : //////////////////////////////////////////////////////////////////////////////
28 : :
29 : : using namespace com::sun::star;
30 : :
31 : : //////////////////////////////////////////////////////////////////////////////
32 : : // UNO API helper methods
33 : :
34 : : namespace drawinglayer
35 : : {
36 : : namespace primitive2d
37 : : {
38 : 0 : uno::Reference< uno::XInterface > SAL_CALL XPrimitiveFactory2DProvider_createInstance(
39 : : const uno::Reference< lang::XMultiServiceFactory >& /*rSMgr*/) throw( uno::Exception )
40 : : {
41 [ # # ]: 0 : return *(new PrimitiveFactory2D());
42 : : }
43 : : } // end of namespace primitive2d
44 : : } // end of namespace drawinglayer
45 : :
46 : : //////////////////////////////////////////////////////////////////////////////
47 : : // UNO API helper methods
48 : :
49 : : namespace drawinglayer
50 : : {
51 : : namespace primitive2d
52 : : {
53 : 0 : PrimitiveFactory2D::PrimitiveFactory2D()
54 : 0 : : PrimitiveFactory2DImplBase(m_aMutex)
55 : : {
56 : 0 : }
57 : :
58 : 0 : Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXShape(
59 : : const uno::Reference< drawing::XShape >& xShape,
60 : : const uno::Sequence< beans::PropertyValue >& /*aParms*/ ) throw (uno::RuntimeException)
61 : : {
62 : 0 : Primitive2DSequence aRetval;
63 : :
64 [ # # ]: 0 : if(xShape.is())
65 : : {
66 : 0 : SdrObject* pSource = GetSdrObjectFromXShape(xShape);
67 : :
68 [ # # ]: 0 : if(pSource)
69 : : {
70 [ # # ]: 0 : const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
71 [ # # ][ # # ]: 0 : aRetval = rSource.getViewIndependentPrimitive2DSequence();
[ # # ]
72 : : }
73 : : }
74 : :
75 : 0 : return aRetval;
76 : : }
77 : :
78 : 0 : Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXDrawPage(
79 : : const uno::Reference< drawing::XDrawPage >& xDrawPage,
80 : : const uno::Sequence< beans::PropertyValue >& /*aParms*/ ) throw (uno::RuntimeException)
81 : : {
82 : 0 : Primitive2DSequence aRetval;
83 : :
84 [ # # ]: 0 : if(xDrawPage.is())
85 : : {
86 : 0 : SdrPage* pSource = GetSdrPageFromXDrawPage(xDrawPage);
87 : :
88 [ # # ]: 0 : if(pSource)
89 : : {
90 [ # # ]: 0 : const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
91 : :
92 [ # # ][ # # ]: 0 : aRetval = rSource.getViewIndependentPrimitive2DSequence();
[ # # ]
93 : : }
94 : : }
95 : :
96 : 0 : return aRetval;
97 : : }
98 : :
99 : 7 : rtl::OUString PrimitiveFactory2D::getImplementationName_Static()
100 : : {
101 [ + - ][ + - ]: 7 : static rtl::OUString aRetval(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D"));
[ + - ][ # # ]
102 : 7 : return aRetval;
103 : : }
104 : :
105 : 0 : uno::Sequence< rtl::OUString > PrimitiveFactory2D::getSupportedServiceNames_Static()
106 : : {
107 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aSeq;
[ # # ][ # # ]
108 [ # # ]: 0 : osl::Mutex aMutex;
109 [ # # ]: 0 : osl::MutexGuard aGuard( aMutex );
110 : :
111 [ # # ]: 0 : if(!aSeq.getLength())
112 : : {
113 [ # # ]: 0 : aSeq.realloc(1L);
114 [ # # ][ # # ]: 0 : aSeq.getArray()[0L] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.PrimitiveFactory2D"));
115 : : }
116 : :
117 [ # # ][ # # ]: 0 : return aSeq;
[ # # ]
118 : : }
119 : : } // end of namespace primitive2d
120 : : } // end of namespace drawinglayer
121 : :
122 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|