1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX 29 #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX 30 31 #include <drawinglayer/processor2d/baseprocessor2d.hxx> 32 #include <basegfx/polygon/b2dpolypolygon.hxx> 33 #include <basegfx/color/bcolor.hxx> 34 #include <basegfx/color/bcolormodifier.hxx> 35 #include <vector> 36 37 ////////////////////////////////////////////////////////////////////////////// 38 39 namespace drawinglayer 40 { 41 namespace processor2d 42 { 43 /// helper data structure for returning the result 44 struct TextAsPolygonDataNode 45 { 46 private: 47 basegfx::B2DPolyPolygon maB2DPolyPolygon; 48 basegfx::BColor maBColor; 49 bool mbIsFilled; 50 51 public: 52 TextAsPolygonDataNode( 53 const basegfx::B2DPolyPolygon& rB2DPolyPolygon, 54 const basegfx::BColor& rBColor, 55 bool bIsFilled) 56 : maB2DPolyPolygon(rB2DPolyPolygon), 57 maBColor(rBColor), 58 mbIsFilled(bIsFilled) 59 { 60 } 61 62 // data read access 63 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maB2DPolyPolygon; } 64 const basegfx::BColor& getBColor() const { return maBColor; } 65 bool getIsFilled() const { return mbIsFilled; } 66 }; 67 68 /// typedef for a vector of that helper data 69 typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector; 70 71 /** TextAsPolygonExtractor2D class 72 73 This processor extracts text in the feeded primitives to filled polygons 74 */ 75 class TextAsPolygonExtractor2D : public BaseProcessor2D 76 { 77 private: 78 // extraction target 79 TextAsPolygonDataNodeVector maTarget; 80 81 // the modifiedColorPrimitive stack 82 basegfx::BColorModifierStack maBColorModifierStack; 83 84 // flag if we are in a decomposed text 85 sal_uInt32 mnInText; 86 87 // tooling methods 88 void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); 89 90 public: 91 TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation); 92 virtual ~TextAsPolygonExtractor2D(); 93 94 // data read access 95 const TextAsPolygonDataNodeVector& getTarget() const { return maTarget; } 96 }; 97 } // end of namespace processor2d 98 } // end of namespace drawinglayer 99 100 ////////////////////////////////////////////////////////////////////////////// 101 102 #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX 103 104 // eof 105