1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <svx/sdr/primitive2d/primitiveFactory2d.hxx>
30 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
31 #include <svx/svdobj.hxx>
32 #include <svx/svdpage.hxx>
33 #include <svx/unoapi.hxx>
34 #include <svx/sdr/contact/viewcontact.hxx>
36 //////////////////////////////////////////////////////////////////////////////
38 using namespace com::sun::star
;
40 //////////////////////////////////////////////////////////////////////////////
41 // UNO API helper methods
43 namespace drawinglayer
47 uno::Reference
< uno::XInterface
> SAL_CALL
XPrimitiveFactory2DProvider_createInstance(
48 const uno::Reference
< lang::XMultiServiceFactory
>& /*rSMgr*/) throw( uno::Exception
)
50 return *(new PrimitiveFactory2D());
52 } // end of namespace primitive2d
53 } // end of namespace drawinglayer
55 //////////////////////////////////////////////////////////////////////////////
56 // UNO API helper methods
58 namespace drawinglayer
62 PrimitiveFactory2D::PrimitiveFactory2D()
63 : PrimitiveFactory2DImplBase(m_aMutex
)
67 Primitive2DSequence SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXShape(
68 const uno::Reference
< drawing::XShape
>& xShape
,
69 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ ) throw (uno::RuntimeException
)
71 Primitive2DSequence aRetval
;
75 SdrObject
* pSource
= GetSdrObjectFromXShape(xShape
);
79 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
80 aRetval
= rSource
.getViewIndependentPrimitive2DSequence();
87 Primitive2DSequence SAL_CALL
PrimitiveFactory2D::createPrimitivesFromXDrawPage(
88 const uno::Reference
< drawing::XDrawPage
>& xDrawPage
,
89 const uno::Sequence
< beans::PropertyValue
>& /*aParms*/ ) throw (uno::RuntimeException
)
91 Primitive2DSequence aRetval
;
95 SdrPage
* pSource
= GetSdrPageFromXDrawPage(xDrawPage
);
99 const sdr::contact::ViewContact
& rSource(pSource
->GetViewContact());
101 aRetval
= rSource
.getViewIndependentPrimitive2DSequence();
108 rtl::OUString
PrimitiveFactory2D::getImplementationName_Static()
110 static rtl::OUString
aRetval(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D"));
114 uno::Sequence
< rtl::OUString
> PrimitiveFactory2D::getSupportedServiceNames_Static()
116 static uno::Sequence
< rtl::OUString
> aSeq
;
118 osl::MutexGuard
aGuard( aMutex
);
120 if(!aSeq
.getLength())
123 aSeq
.getArray()[0L] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.PrimitiveFactory2D"));
128 } // end of namespace primitive2d
129 } // end of namespace drawinglayer
131 //////////////////////////////////////////////////////////////////////////////
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */