1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: primitivefactory2d.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #include "precompiled_svx.hxx"
33 #include <svx/sdr/primitive2d/primitiveFactory2d.hxx>
34 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 #include <svx/svdobj.hxx>
36 #include <svx/svdpage.hxx>
38 #include <svx/sdr/contact/viewcontact.hxx>
40 //////////////////////////////////////////////////////////////////////////////
42 using namespace com::sun::star
;
44 //////////////////////////////////////////////////////////////////////////////
45 // UNO API helper methods
47 namespace drawinglayer
51 uno::Reference
< uno::XInterface
> SAL_CALL
XPrimitiveFactory2DProvider_createInstance(
52 const uno::Reference
< lang::XMultiServiceFactory
>& /*rSMgr*/) throw( uno::Exception
)
54 return *(new PrimitiveFactory2D());
56 } // end of namespace primitive2d
57 } // end of namespace drawinglayer
59 //////////////////////////////////////////////////////////////////////////////
60 // UNO API helper methods
62 namespace drawinglayer
66 PrimitiveFactory2D::PrimitiveFactory2D()
67 : PrimitiveFactory2DImplBase(m_aMutex
)
71 Primitive2DSequence SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXShape(
72 const uno::Reference
< drawing::XShape
>& xShape
,
73 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ ) throw (uno::RuntimeException
)
75 Primitive2DSequence aRetval
;
79 SdrObject
* pSource
= GetSdrObjectFromXShape(xShape
);
83 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
84 aRetval
= rSource
.getViewIndependentPrimitive2DSequence();
91 Primitive2DSequence SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXDrawPage(
92 const uno::Reference
< drawing::XDrawPage
>& xDrawPage
,
93 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ ) throw (uno::RuntimeException
)
95 Primitive2DSequence aRetval
;
99 SdrPage
* pSource
= GetSdrPageFromXDrawPage(xDrawPage
);
103 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
105 aRetval
= rSource
.getViewIndependentPrimitive2DSequence();
112 rtl::OUString
PrimitiveFactory2D::getImplementationName_Static()
114 static rtl::OUString
aRetval(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D"));
118 uno::Sequence
< rtl::OUString
> PrimitiveFactory2D::getSupportedServiceNames_Static()
120 static uno::Sequence
< rtl::OUString
> aSeq
;
122 osl::MutexGuard
aGuard( aMutex
);
124 if(!aSeq
.getLength())
127 aSeq
.getArray()[0L] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.PrimitiveFactory2D"));
132 } // end of namespace primitive2d
133 } // end of namespace drawinglayer
135 //////////////////////////////////////////////////////////////////////////////