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 INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX 25 #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <drawinglayer/processor2d/baseprocessor2d.hxx> 29 #include <basegfx/polygon/b2dpolypolygon.hxx> 30 #include <basegfx/color/bcolor.hxx> 31 #include <basegfx/color/bcolormodifier.hxx> 32 #include <vector> 33 34 ////////////////////////////////////////////////////////////////////////////// 35 36 namespace drawinglayer 37 { 38 namespace processor2d 39 { 40 /// helper data structure for returning the result 41 struct DRAWINGLAYER_DLLPUBLIC TextAsPolygonDataNode 42 { 43 private: 44 basegfx::B2DPolyPolygon maB2DPolyPolygon; 45 basegfx::BColor maBColor; 46 bool mbIsFilled; 47 48 public: TextAsPolygonDataNodedrawinglayer::processor2d::TextAsPolygonDataNode49 TextAsPolygonDataNode( 50 const basegfx::B2DPolyPolygon& rB2DPolyPolygon, 51 const basegfx::BColor& rBColor, 52 bool bIsFilled) 53 : maB2DPolyPolygon(rB2DPolyPolygon), 54 maBColor(rBColor), 55 mbIsFilled(bIsFilled) 56 { 57 } 58 59 // data read access getB2DPolyPolygondrawinglayer::processor2d::TextAsPolygonDataNode60 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maB2DPolyPolygon; } getBColordrawinglayer::processor2d::TextAsPolygonDataNode61 const basegfx::BColor& getBColor() const { return maBColor; } getIsFilleddrawinglayer::processor2d::TextAsPolygonDataNode62 bool getIsFilled() const { return mbIsFilled; } 63 }; 64 65 /// typedef for a vector of that helper data 66 typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector; 67 68 /** TextAsPolygonExtractor2D class 69 70 This processor extracts text in the feeded primitives to filled polygons 71 */ 72 class DRAWINGLAYER_DLLPUBLIC TextAsPolygonExtractor2D : public BaseProcessor2D 73 { 74 private: 75 // extraction target 76 TextAsPolygonDataNodeVector maTarget; 77 78 // the modifiedColorPrimitive stack 79 basegfx::BColorModifierStack maBColorModifierStack; 80 81 // flag if we are in a decomposed text 82 sal_uInt32 mnInText; 83 84 // tooling methods 85 void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); 86 87 public: 88 TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation); 89 virtual ~TextAsPolygonExtractor2D(); 90 91 // data read access getTarget() const92 const TextAsPolygonDataNodeVector& getTarget() const { return maTarget; } 93 }; 94 } // end of namespace processor2d 95 } // end of namespace drawinglayer 96 97 ////////////////////////////////////////////////////////////////////////////// 98 99 #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX 100 101 // eof 102