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_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
30 : : #define INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
33 : : #include <basegfx/polygon/b2dpolypolygon.hxx>
34 : : #include <basegfx/matrix/b2dhommatrix.hxx>
35 : : #include <com/sun/star/drawing/XDrawPage.hpp>
36 : : #include <editeng/outlobj.hxx>
37 : : #include <tools/color.hxx>
38 : : #include <svx/sdr/attribute/sdrformtextattribute.hxx>
39 : : #include <tools/weakbase.hxx>
40 : : #include <svx/sdtaitm.hxx>
41 : :
42 : : //////////////////////////////////////////////////////////////////////////////
43 : : // predefines
44 : : class SdrText;
45 : :
46 : : //////////////////////////////////////////////////////////////////////////////
47 : :
48 : : namespace drawinglayer
49 : : {
50 : : namespace primitive2d
51 : : {
52 [ + - ][ + - ]: 13498 : class SdrTextPrimitive2D : public BufferedDecompositionPrimitive2D
[ - + ]
53 : : {
54 : : private:
55 : : // The text model data; this sould later just be the OutlinerParaObject or
56 : : // something equal
57 : : ::tools::WeakReference< SdrText > mrSdrText;
58 : :
59 : : // #i97628#
60 : : // The text content; now as local OutlinerParaObject copy (internally RefCounted and
61 : : // COW) and in exclusive, local form as needed in a primitive
62 : : const OutlinerParaObject maOutlinerParaObject;
63 : :
64 : : // remeber last VisualizingPage for which a decomposition was made. If the new target
65 : : // is not given or different, the decomposition needs to be potentially removed
66 : : // for supporting e.g. page number change on MasterPage objects or the different
67 : : // field renderings in SubGeometry and MasterPage mnode
68 : : com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxLastVisualizingPage;
69 : :
70 : : // remember last PageNumber for which a decomposition was made. This is only used
71 : : // when mbContainsPageField is true, else it is 0
72 : : sal_Int16 mnLastPageNumber;
73 : :
74 : : // remember last PageCount for which a decomposition was made. This is only used
75 : : // when mbContainsPageCountField is true, else it is 0
76 : : sal_Int16 mnLastPageCount;
77 : :
78 : : // #i101443# remember last TextBackgroundColor to decide if a new decomposition is
79 : : // needed because of background color change
80 : : Color maLastTextBackgroundColor;
81 : :
82 : : // bitfield
83 : : // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction
84 : : unsigned mbContainsPageField : 1;
85 : : unsigned mbContainsPageCountField : 1;
86 : : unsigned mbContainsOtherFields : 1;
87 : :
88 : : protected:
89 : : // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
90 : : Primitive2DSequence encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const;
91 : :
92 : : public:
93 : : SdrTextPrimitive2D(
94 : : const SdrText* pSdrText,
95 : : const OutlinerParaObject& rOutlinerParaObjectPtr);
96 : :
97 : : // get data
98 : 399231 : const SdrText* getSdrText() const { return mrSdrText.get(); }
99 : 27330 : const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
100 : :
101 : : // compare operator
102 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
103 : :
104 : : // own get2DDecomposition to take aspect of decomposition with or without spell checker
105 : : // into account
106 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
107 : :
108 : : // transformed clone operator
109 : : virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0;
110 : : };
111 : : } // end of namespace primitive2d
112 : : } // end of namespace drawinglayer
113 : :
114 : : //////////////////////////////////////////////////////////////////////////////
115 : :
116 : : namespace drawinglayer
117 : : {
118 : : namespace primitive2d
119 : : {
120 [ # # ][ # # ]: 0 : class SdrContourTextPrimitive2D : public SdrTextPrimitive2D
[ # # ]
121 : : {
122 : : private:
123 : : // unit contour polygon (scaled to [0.0 .. 1.0])
124 : : basegfx::B2DPolyPolygon maUnitPolyPolygon;
125 : :
126 : : // complete contour polygon transform (scale, rotate, shear, translate)
127 : : basegfx::B2DHomMatrix maObjectTransform;
128 : :
129 : : protected:
130 : : // local decomposition.
131 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
132 : :
133 : : public:
134 : : SdrContourTextPrimitive2D(
135 : : const SdrText* pSdrText,
136 : : const OutlinerParaObject& rOutlinerParaObjectPtr,
137 : : const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
138 : : const basegfx::B2DHomMatrix& rObjectTransform);
139 : :
140 : : // get data
141 : 0 : const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
142 : 0 : const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; }
143 : :
144 : : // compare operator
145 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
146 : :
147 : : // transformed clone operator
148 : : virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
149 : :
150 : : // provide unique ID
151 : : DeclPrimitrive2DIDBlock()
152 : : };
153 : : } // end of namespace primitive2d
154 : : } // end of namespace drawinglayer
155 : :
156 : : //////////////////////////////////////////////////////////////////////////////
157 : :
158 : : namespace drawinglayer
159 : : {
160 : : namespace primitive2d
161 : : {
162 [ # # ][ # # ]: 0 : class SdrPathTextPrimitive2D : public SdrTextPrimitive2D
[ # # ]
163 : : {
164 : : private:
165 : : // the path to use. Each paragraph will use one Polygon.
166 : : basegfx::B2DPolyPolygon maPathPolyPolygon;
167 : :
168 : : // the Fontwork parameters
169 : : attribute::SdrFormTextAttribute maSdrFormTextAttribute;
170 : :
171 : : protected:
172 : : // local decomposition.
173 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
174 : :
175 : : public:
176 : : SdrPathTextPrimitive2D(
177 : : const SdrText* pSdrText,
178 : : const OutlinerParaObject& rOutlinerParaObjectPtr,
179 : : const basegfx::B2DPolyPolygon& rPathPolyPolygon,
180 : : const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
181 : :
182 : : // get data
183 : 0 : const basegfx::B2DPolyPolygon& getPathPolyPolygon() const { return maPathPolyPolygon; }
184 : 0 : const attribute::SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; }
185 : :
186 : : // compare operator
187 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
188 : :
189 : : // transformed clone operator
190 : : virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
191 : :
192 : : // provide unique ID
193 : : DeclPrimitrive2DIDBlock()
194 : : };
195 : : } // end of namespace primitive2d
196 : : } // end of namespace drawinglayer
197 : :
198 : : //////////////////////////////////////////////////////////////////////////////
199 : :
200 : : namespace drawinglayer
201 : : {
202 : : namespace primitive2d
203 : : {
204 [ + - ][ - + ]: 26905 : class SdrBlockTextPrimitive2D : public SdrTextPrimitive2D
205 : : {
206 : : private:
207 : : // text range transformation from unit range ([0.0 .. 1.0]) to text range
208 : : basegfx::B2DHomMatrix maTextRangeTransform;
209 : :
210 : : // text alignments
211 : : SdrTextHorzAdjust maSdrTextHorzAdjust;
212 : : SdrTextVertAdjust maSdrTextVertAdjust;
213 : :
214 : : // bitfield
215 : : unsigned mbFixedCellHeight : 1;
216 : : unsigned mbUnlimitedPage : 1; // force layout with no text break
217 : : unsigned mbCellText : 1; // this is a cell text as block text
218 : : unsigned mbWordWrap : 1; // for CustomShapes text layout
219 : : unsigned mbClipOnBounds : 1; // for CustomShapes text layout
220 : :
221 : : protected:
222 : : // local decomposition.
223 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
224 : :
225 : : public:
226 : : SdrBlockTextPrimitive2D(
227 : : const SdrText* pSdrText,
228 : : const OutlinerParaObject& rOutlinerParaObjectPtr,
229 : : const basegfx::B2DHomMatrix& rTextRangeTransform,
230 : : SdrTextHorzAdjust aSdrTextHorzAdjust,
231 : : SdrTextVertAdjust aSdrTextVertAdjust,
232 : : bool bFixedCellHeight,
233 : : bool bUnlimitedPage,
234 : : bool bCellText,
235 : : bool bWordWrap,
236 : : bool bClipOnBounds);
237 : :
238 : : // get data
239 : 13665 : const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
240 : 13665 : SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; }
241 : 13665 : SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; }
242 : 13665 : bool isFixedCellHeight() const { return mbFixedCellHeight; }
243 : 13657 : bool getUnlimitedPage() const { return mbUnlimitedPage; }
244 : 13665 : bool getCellText() const { return mbCellText; }
245 : 13665 : bool getWordWrap() const { return mbWordWrap; }
246 : 13665 : bool getClipOnBounds() const { return mbClipOnBounds; }
247 : :
248 : : // compare operator
249 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
250 : :
251 : : // transformed clone operator
252 : : virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
253 : :
254 : : // provide unique ID
255 : : DeclPrimitrive2DIDBlock()
256 : : };
257 : : } // end of namespace primitive2d
258 : : } // end of namespace drawinglayer
259 : :
260 : : //////////////////////////////////////////////////////////////////////////////
261 : :
262 : : namespace drawinglayer
263 : : {
264 : : namespace primitive2d
265 : : {
266 [ # # ][ # # ]: 0 : class SdrStretchTextPrimitive2D : public SdrTextPrimitive2D
267 : : {
268 : : private:
269 : : // text range transformation from unit range ([0.0 .. 1.0]) to text range
270 : : basegfx::B2DHomMatrix maTextRangeTransform;
271 : :
272 : : // bitfield
273 : : unsigned mbFixedCellHeight : 1;
274 : :
275 : : protected:
276 : : // local decomposition.
277 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
278 : :
279 : : public:
280 : : SdrStretchTextPrimitive2D(
281 : : const SdrText* pSdrText,
282 : : const OutlinerParaObject& rOutlinerParaObjectPtr,
283 : : const basegfx::B2DHomMatrix& rTextRangeTransform,
284 : : bool bFixedCellHeight);
285 : :
286 : : // get data
287 : 0 : const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
288 : 0 : bool isFixedCellHeight() const { return mbFixedCellHeight; }
289 : :
290 : : // compare operator
291 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
292 : :
293 : : // transformed clone operator
294 : : virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
295 : :
296 : : // provide unique ID
297 : : DeclPrimitrive2DIDBlock()
298 : : };
299 : : } // end of namespace primitive2d
300 : : } // end of namespace drawinglayer
301 : :
302 : : //////////////////////////////////////////////////////////////////////////////
303 : :
304 : : namespace drawinglayer
305 : : {
306 : : namespace primitive2d
307 : : {
308 [ + - ][ - + ]: 58 : class SdrAutoFitTextPrimitive2D : public SdrTextPrimitive2D
309 : : {
310 : : private:
311 : : ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
312 : :
313 : : // bitfield
314 : : unsigned mbWordWrap : 1; // for CustomShapes text layout
315 : :
316 : : protected:
317 : : // local decomposition.
318 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
319 : :
320 : : public:
321 : : SdrAutoFitTextPrimitive2D(
322 : : const SdrText* pSdrText,
323 : : const OutlinerParaObject& rOutlinerParaObjectPtr,
324 : : const ::basegfx::B2DHomMatrix& rTextRangeTransform,
325 : : bool bWordWrap);
326 : :
327 : : // get data
328 : 31 : const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
329 : 31 : bool getWordWrap() const { return mbWordWrap; }
330 : :
331 : : // compare operator
332 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
333 : :
334 : : // transformed clone operator
335 : : virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
336 : :
337 : : // provide unique ID
338 : : DeclPrimitrive2DIDBlock()
339 : : };
340 : : } // end of namespace primitive2d
341 : : } // end of namespace drawinglayer
342 : :
343 : : //////////////////////////////////////////////////////////////////////////////
344 : :
345 : : #endif //INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
346 : :
347 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|