Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX
30 : : #define INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX
31 : :
32 : : #include <cppuhelper/basemutex.hxx>
33 : : #include <cppuhelper/compbase3.hxx>
34 : : #include <com/sun/star/lang/XServiceInfo.hpp>
35 : : #include <com/sun/star/rendering/FillRule.hpp>
36 : : #include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
37 : : #include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
38 : : #include <basegfx/polygon/b2dpolypolygon.hxx>
39 : : #include <basegfx/basegfxdllapi.h>
40 : : #include <boost/utility.hpp>
41 : :
42 : :
43 : : namespace basegfx
44 : : {
45 : : namespace unotools
46 : : {
47 : : typedef ::cppu::WeakComponentImplHelper3<
48 : : ::com::sun::star::rendering::XLinePolyPolygon2D,
49 : : ::com::sun::star::rendering::XBezierPolyPolygon2D,
50 : : ::com::sun::star::lang::XServiceInfo > UnoPolyPolygonBase;
51 : :
52 [ + - ][ + - ]: 90 : class BASEGFX_DLLPUBLIC UnoPolyPolygon
[ - + ]
53 : : : private cppu::BaseMutex
54 : : , private boost::noncopyable
55 : : , public UnoPolyPolygonBase
56 : : {
57 : : public:
58 : : explicit UnoPolyPolygon( const B2DPolyPolygon& );
59 : :
60 : : // XPolyPolygon2D
61 : : virtual void SAL_CALL addPolyPolygon( const ::com::sun::star::geometry::RealPoint2D& position, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& polyPolygon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
62 : : virtual ::sal_Int32 SAL_CALL getNumberOfPolygons( ) throw (::com::sun::star::uno::RuntimeException);
63 : : virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
64 : : virtual ::com::sun::star::rendering::FillRule SAL_CALL getFillRule( ) throw (::com::sun::star::uno::RuntimeException);
65 : : virtual void SAL_CALL setFillRule( ::com::sun::star::rendering::FillRule fillRule ) throw (::com::sun::star::uno::RuntimeException);
66 : : virtual ::sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
67 : : virtual void SAL_CALL setClosed( ::sal_Int32 index, ::sal_Bool closedState ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
68 : :
69 : : // XLinePolyPolygon2D
70 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > > SAL_CALL getPoints( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
71 : : virtual void SAL_CALL setPoints( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
72 : : virtual ::com::sun::star::geometry::RealPoint2D SAL_CALL getPoint( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
73 : : virtual void SAL_CALL setPoint( const ::com::sun::star::geometry::RealPoint2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
74 : :
75 : : // XBezierPolyPolygon2D
76 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > > SAL_CALL getBezierSegments( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
77 : : virtual void SAL_CALL setBezierSegments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
78 : : virtual ::com::sun::star::geometry::RealBezierSegment2D SAL_CALL getBezierSegment( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
79 : : virtual void SAL_CALL setBezierSegment( const ::com::sun::star::geometry::RealBezierSegment2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
80 : :
81 : : // XServiceInfo
82 : : virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
83 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
84 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
85 : :
86 : : B2DPolyPolygon getPolyPolygon() const;
87 : :
88 : : protected:
89 : : /// Check whether index is a valid polygon index
90 : 0 : void checkIndex( sal_Int32 nIndex ) const // throw (::com::sun::star::lang::IndexOutOfBoundsException);
91 : : {
92 [ # # ][ # # ]: 0 : if( nIndex < 0 || nIndex >= static_cast<sal_Int32>(maPolyPoly.count()) )
[ # # ]
93 [ # # ]: 0 : throw ::com::sun::star::lang::IndexOutOfBoundsException();
94 : 0 : }
95 : :
96 : : B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex,
97 : : sal_Int32 nNumberOfPolygons,
98 : : sal_Int32 nPointIndex,
99 : : sal_Int32 nNumberOfPoints ) const;
100 : :
101 : : /// Get cow copy of internal polygon. not thread-safe outside this object.
102 : : B2DPolyPolygon getPolyPolygonUnsafe() const
103 : : {
104 : : return maPolyPoly;
105 : : }
106 : :
107 : : /// Called whenever internal polypolygon gets modified
108 : 0 : virtual void modifying() const {}
109 : :
110 : : private:
111 : : B2DPolyPolygon maPolyPoly;
112 : : ::com::sun::star::rendering::FillRule meFillRule;
113 : : };
114 : : }
115 : : }
116 : :
117 : : #endif /* INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX */
118 : :
119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|