LCOV - code coverage report
Current view: top level - include/basegfx/tools - unopolypolygon.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 6 16.7 %
Date: 2014-11-03 Functions: 2 4 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_BASEGFX_TOOLS_UNOPOLYPOLYGON_HXX
      21             : #define INCLUDED_BASEGFX_TOOLS_UNOPOLYPOLYGON_HXX
      22             : 
      23             : #include <cppuhelper/basemutex.hxx>
      24             : #include <cppuhelper/compbase3.hxx>
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : #include <com/sun/star/rendering/FillRule.hpp>
      27             : #include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
      28             : #include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
      29             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      30             : #include <basegfx/basegfxdllapi.h>
      31             : #include <boost/utility.hpp>
      32             : 
      33             : 
      34             : namespace basegfx
      35             : {
      36             : namespace unotools
      37             : {
      38             :     typedef ::cppu::WeakComponentImplHelper3<
      39             :              ::com::sun::star::rendering::XLinePolyPolygon2D,
      40             :           ::com::sun::star::rendering::XBezierPolyPolygon2D,
      41             :           ::com::sun::star::lang::XServiceInfo > UnoPolyPolygonBase;
      42             : 
      43          60 :     class BASEGFX_DLLPUBLIC UnoPolyPolygon
      44             :         : private cppu::BaseMutex
      45             :         , private boost::noncopyable
      46             :         , public UnoPolyPolygonBase
      47             :     {
      48             :     public:
      49             :         explicit UnoPolyPolygon( const B2DPolyPolygon& );
      50             : 
      51             :         // XPolyPolygon2D
      52             :         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, std::exception) SAL_OVERRIDE;
      53             :         virtual ::sal_Int32 SAL_CALL getNumberOfPolygons(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      54             :         virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      55             :         virtual ::com::sun::star::rendering::FillRule SAL_CALL getFillRule(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      56             :         virtual void SAL_CALL setFillRule( ::com::sun::star::rendering::FillRule fillRule ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      57             :         virtual sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      58             :         virtual void SAL_CALL setClosed( ::sal_Int32 index, sal_Bool closedState ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      59             : 
      60             :         // XLinePolyPolygon2D
      61             :         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, std::exception) SAL_OVERRIDE;
      62             :         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, std::exception) SAL_OVERRIDE;
      63             :         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, std::exception) SAL_OVERRIDE;
      64             :         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, std::exception) SAL_OVERRIDE;
      65             : 
      66             :         // XBezierPolyPolygon2D
      67             :         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, std::exception) SAL_OVERRIDE;
      68             :         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, std::exception) SAL_OVERRIDE;
      69             :         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, std::exception) SAL_OVERRIDE;
      70             :         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, std::exception) SAL_OVERRIDE;
      71             : 
      72             :         // XServiceInfo
      73             :         virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      74             :         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      75             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()  throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      76             : 
      77             :         B2DPolyPolygon getPolyPolygon() const;
      78             : 
      79             :     protected:
      80             :         /// Check whether index is a valid polygon index
      81           0 :         void checkIndex( sal_Int32 nIndex ) const // throw (::com::sun::star::lang::IndexOutOfBoundsException);
      82             :         {
      83           0 :             if( nIndex < 0 || nIndex >= static_cast<sal_Int32>(maPolyPoly.count()) )
      84           0 :                 throw ::com::sun::star::lang::IndexOutOfBoundsException();
      85           0 :         }
      86             : 
      87             :         B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex,
      88             :                                              sal_Int32 nNumberOfPolygons,
      89             :                                              sal_Int32 nPointIndex,
      90             :                                              sal_Int32 nNumberOfPoints ) const;
      91             : 
      92             :         /// Get cow copy of internal polygon. not thread-safe outside this object.
      93             :         B2DPolyPolygon getPolyPolygonUnsafe() const
      94             :         {
      95             :             return maPolyPoly;
      96             :         }
      97             : 
      98             :         /// Called whenever internal polypolygon gets modified
      99           0 :         virtual void modifying() const {}
     100             : 
     101             :     private:
     102             :         B2DPolyPolygon                        maPolyPoly;
     103             :         ::com::sun::star::rendering::FillRule meFillRule;
     104             :     };
     105             : }
     106             : }
     107             : 
     108             : #endif // INCLUDED_BASEGFX_TOOLS_UNOPOLYPOLYGON_HXX
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10