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 <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>
27 //////////////////////////////////////////////////////////////////////////////
29 using namespace com::sun::star
;
31 //////////////////////////////////////////////////////////////////////////////
32 // UNO API helper methods
34 namespace drawinglayer
38 uno::Reference
< uno::XInterface
> SAL_CALL
XPrimitiveFactory2DProvider_createInstance(
39 const uno::Reference
< lang::XMultiServiceFactory
>& /*rSMgr*/) throw( uno::Exception
)
41 return *(new PrimitiveFactory2D());
43 } // end of namespace primitive2d
44 } // end of namespace drawinglayer
46 //////////////////////////////////////////////////////////////////////////////
47 // UNO API helper methods
49 namespace drawinglayer
53 PrimitiveFactory2D::PrimitiveFactory2D()
54 : PrimitiveFactory2DImplBase(m_aMutex
)
58 Primitive2DSequence SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXShape(
59 const uno::Reference
< drawing::XShape
>& xShape
,
60 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ ) throw (uno::RuntimeException
)
62 Primitive2DSequence aRetval
;
66 SdrObject
* pSource
= GetSdrObjectFromXShape(xShape
);
70 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
71 aRetval
= rSource
.getViewIndependentPrimitive2DSequence();
78 Primitive2DSequence SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXDrawPage(
79 const uno::Reference
< drawing::XDrawPage
>& xDrawPage
,
80 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ ) throw (uno::RuntimeException
)
82 Primitive2DSequence aRetval
;
86 SdrPage
* pSource
= GetSdrPageFromXDrawPage(xDrawPage
);
90 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
92 aRetval
= rSource
.getViewIndependentPrimitive2DSequence();
99 OUString
PrimitiveFactory2D::getImplementationName_Static()
101 static OUString
aRetval("com.sun.star.comp.graphic.PrimitiveFactory2D");
105 uno::Sequence
< OUString
> PrimitiveFactory2D::getSupportedServiceNames_Static()
107 static uno::Sequence
< OUString
> aSeq
;
109 osl::MutexGuard
aGuard( aMutex
);
111 if(!aSeq
.getLength())
114 aSeq
.getArray()[0L] = OUString("com.sun.star.graphic.PrimitiveFactory2D");
119 } // end of namespace primitive2d
120 } // end of namespace drawinglayer
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */