1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SDR_POLYPOLYGONEDITOR_HXX_ 25 #define _SDR_POLYPOLYGONEDITOR_HXX_ 26 27 #include "svx/svxdllapi.h" 28 29 #include "svx/ipolypolygoneditorcontroller.hxx" 30 31 #include <basegfx/polygon/b2dpolypolygon.hxx> 32 #include <set> 33 34 class SdrUShortCont; 35 36 namespace sdr 37 { 38 39 /** this class implements some helper functions to edit a B2DPolyPolygon */ 40 class SVX_DLLPUBLIC PolyPolygonEditor 41 { 42 public: 43 PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed ); 44 GetPolyPolygon() const45 const basegfx::B2DPolyPolygon& GetPolyPolygon() const { return maPolyPolygon; } 46 47 /** returns true if the B2DPolyPolygon was changed. 48 Warning: B2DPolyPolygon can be empty after this operation! 49 */ 50 bool DeletePoints( const std::set< sal_uInt16 >& rAbsPoints ); 51 52 /** returns true if the B2DPolyPolygon was changed. 53 */ 54 bool SetSegmentsKind(SdrPathSegmentKind eKind, const std::set< sal_uInt16 >& rAbsPoints); 55 56 /** returns true if the B2DPolyPolygon was changed. 57 */ 58 bool SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const std::set< sal_uInt16 >& rAbsPoints); 59 60 /** Outputs the realative position ( polygon number and point number in that polygon ) from the absolut point number. 61 False is returned if the given absolute point is greater not inside this B2DPolyPolygon 62 */ 63 static bool GetRelativePolyPoint( const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum ); 64 65 private: 66 basegfx::B2DPolyPolygon maPolyPolygon; 67 bool mbIsClosed; 68 }; 69 70 } 71 72 #endif 73