diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-08-19 22:14:41 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-08-19 22:14:41 +0000 |
commit | 18cb4e55fa1a39ab3d59c6f19721caa6b8a86930 (patch) | |
tree | c6c39b20c78e4b6db68a658432798a827093e39e /svx/source/sdr/primitive2d | |
parent | INTEGRATION: CWS aw033 (1.1.2); FILE ADDED (diff) | |
download | core-18cb4e55fa1a39ab3d59c6f19721caa6b8a86930.tar.gz core-18cb4e55fa1a39ab3d59c6f19721caa6b8a86930.zip |
INTEGRATION: CWS aw033 (1.1.2); FILE ADDED
2008/08/19 16:46:29 cl 1.1.2.7: fixed license files
2008/05/27 14:49:59 aw 1.1.2.6: #i39532# changes DEV300 m12 resync corrections
2007/10/08 09:23:22 aw 1.1.2.5: #i39532# modification for unxlngi6 build
2007/08/13 15:34:33 aw 1.1.2.4: #i39532# changes after resync
2007/07/06 13:43:08 aw 1.1.2.3: #i39532# moved from Primitive2DReference to Primitive2DSequence where possible to avoid extra-group primitive creations and deeper hierarchies as necessary
2006/12/12 10:14:27 aw 1.1.2.2: #i39532# changes after resync
2006/11/07 15:51:52 aw 1.1.2.1: #i39532# added implementation of XPrimitiveFactory2D
Diffstat (limited to 'svx/source/sdr/primitive2d')
-rw-r--r-- | svx/source/sdr/primitive2d/primitivefactory2d.cxx | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/svx/source/sdr/primitive2d/primitivefactory2d.cxx b/svx/source/sdr/primitive2d/primitivefactory2d.cxx new file mode 100644 index 000000000000..7a7e30778f7d --- /dev/null +++ b/svx/source/sdr/primitive2d/primitivefactory2d.cxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: primitivefactory2d.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <svx/sdr/primitive2d/primitiveFactory2d.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdpage.hxx> +#include <unoapi.hxx> +#include <svx/sdr/contact/viewcontact.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// +// UNO API helper methods + +namespace drawinglayer +{ + namespace primitive2d + { + uno::Reference< uno::XInterface > SAL_CALL XPrimitiveFactory2DProvider_createInstance( + const uno::Reference< lang::XMultiServiceFactory >& /*rSMgr*/) throw( uno::Exception ) + { + return *(new PrimitiveFactory2D()); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// UNO API helper methods + +namespace drawinglayer +{ + namespace primitive2d + { + PrimitiveFactory2D::PrimitiveFactory2D() + : PrimitiveFactory2DImplBase(m_aMutex) + { + } + + Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXShape( + const uno::Reference< drawing::XShape >& xShape, + const uno::Sequence< beans::PropertyValue >& /*aParms*/ ) throw (uno::RuntimeException) + { + Primitive2DSequence aRetval; + + if(xShape.is()) + { + SdrObject* pSource = GetSdrObjectFromXShape(xShape); + + if(pSource) + { + const sdr::contact::ViewContact& rSource(pSource->GetViewContact()); + aRetval = rSource.getViewIndependentPrimitive2DSequence(); + } + } + + return aRetval; + } + + Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXDrawPage( + const uno::Reference< drawing::XDrawPage >& xDrawPage, + const uno::Sequence< beans::PropertyValue >& /*aParms*/ ) throw (uno::RuntimeException) + { + Primitive2DSequence aRetval; + + if(xDrawPage.is()) + { + SdrPage* pSource = GetSdrPageFromXDrawPage(xDrawPage); + + if(pSource) + { + const sdr::contact::ViewContact& rSource(pSource->GetViewContact()); + + aRetval = rSource.getViewIndependentPrimitive2DSequence(); + } + } + + return aRetval; + } + + rtl::OUString PrimitiveFactory2D::getImplementationName_Static() + { + static rtl::OUString aRetval(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D")); + return aRetval; + } + + uno::Sequence< rtl::OUString > PrimitiveFactory2D::getSupportedServiceNames_Static() + { + static uno::Sequence< rtl::OUString > aSeq; + osl::Mutex aMutex; + osl::MutexGuard aGuard( aMutex ); + + if(!aSeq.getLength()) + { + aSeq.realloc(1L); + aSeq.getArray()[0L] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.PrimitiveFactory2D")); + } + + return aSeq; + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof |