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