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