LibreOffice Module basegfx (master) 1
unopolypolygon.hxx
Go to the documentation of this file.
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#pragma once
21
23#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/rendering/FillRule.hpp>
26#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
27#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
30#include <o3tl/safeint.hxx>
31
32namespace basegfx::unotools
33{
35 css::rendering::XLinePolyPolygon2D,
36 css::rendering::XBezierPolyPolygon2D,
37 css::lang::XServiceInfo > UnoPolyPolygonBase;
38
40 : public UnoPolyPolygonBase
41 {
42 public:
44
45 // XPolyPolygon2D
46 SAL_DLLPRIVATE virtual void SAL_CALL addPolyPolygon( const css::geometry::RealPoint2D& position, const css::uno::Reference< css::rendering::XPolyPolygon2D >& polyPolygon ) override;
47 SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getNumberOfPolygons( ) override;
48 SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) override;
49 SAL_DLLPRIVATE virtual css::rendering::FillRule SAL_CALL getFillRule( ) override;
50 SAL_DLLPRIVATE virtual void SAL_CALL setFillRule( css::rendering::FillRule fillRule ) override;
51 SAL_DLLPRIVATE virtual sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) override;
52 SAL_DLLPRIVATE virtual void SAL_CALL setClosed( ::sal_Int32 index, sal_Bool closedState ) override;
53
54 // XLinePolyPolygon2D
55 SAL_DLLPRIVATE virtual css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > > SAL_CALL getPoints( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) override;
56 SAL_DLLPRIVATE virtual void SAL_CALL setPoints( const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > >& points, ::sal_Int32 nPolygonIndex ) override;
57 SAL_DLLPRIVATE virtual css::geometry::RealPoint2D SAL_CALL getPoint( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
58 SAL_DLLPRIVATE virtual void SAL_CALL setPoint( const css::geometry::RealPoint2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
59
60 // XBezierPolyPolygon2D
61 SAL_DLLPRIVATE virtual css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > > SAL_CALL getBezierSegments( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) override;
62 SAL_DLLPRIVATE virtual void SAL_CALL setBezierSegments( const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > >& points, ::sal_Int32 nPolygonIndex ) override;
63 SAL_DLLPRIVATE virtual css::geometry::RealBezierSegment2D SAL_CALL getBezierSegment( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
64 SAL_DLLPRIVATE virtual void SAL_CALL setBezierSegment( const css::geometry::RealBezierSegment2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) override;
65
66 // XServiceInfo
67 SAL_DLLPRIVATE virtual OUString SAL_CALL getImplementationName() override;
68 SAL_DLLPRIVATE virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
69 SAL_DLLPRIVATE virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
70
71 SAL_DLLPRIVATE B2DPolyPolygon getPolyPolygon() const;
72
73 protected:
75 void checkIndex( sal_Int32 nIndex ) const // throw (css::lang::IndexOutOfBoundsException);
76 {
77 if( nIndex < 0 || o3tl::make_unsigned(nIndex) >= maPolyPoly.count() )
78 throw css::lang::IndexOutOfBoundsException();
79 }
80
81 SAL_DLLPRIVATE B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex,
82 sal_Int32 nNumberOfPolygons,
83 sal_Int32 nPointIndex,
84 sal_Int32 nNumberOfPoints ) const;
85
88 {
89 return maPolyPoly;
90 }
91
93 virtual void modifying() const {}
94
95 private:
98
100 css::rendering::FillRule meFillRule;
101 };
102}
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BASEGFX_DLLPUBLIC
Definition: basegfxdllapi.h:35
const B2DPolyPolygon & getPolyPolygonUnsafe() const
Get cow copy of internal polygon. not thread-safe outside this object.
virtual void modifying() const
Called whenever internal polypolygon gets modified.
void checkIndex(sal_Int32 nIndex) const
Check whether index is a valid polygon index.
UnoPolyPolygon & operator=(const UnoPolyPolygon &)=delete
UnoPolyPolygon(const UnoPolyPolygon &)=delete
css::rendering::FillRule meFillRule
sal_Int32 nIndex
def position(n=-1)
def point()
comphelper::WeakComponentImplHelper< css::rendering::XLinePolyPolygon2D, css::rendering::XBezierPolyPolygon2D, css::lang::XServiceInfo > UnoPolyPolygonBase
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
index
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
unsigned char sal_Bool