LibreOffice Module svx (master)  1
sdrtextprimitive2d.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
21 #define INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
22 
26 #include <com/sun/star/drawing/XDrawPage.hpp>
27 #include <editeng/outlobj.hxx>
28 #include <tools/color.hxx>
30 #include <tools/weakbase.h>
31 #include <svx/sdtaitm.hxx>
32 
33 
34 // predefines
35 class SdrText;
36 
37 
39  {
41  {
42  private:
43  // The text model data; this should later just be the OutlinerParaObject or
44  // something equal
46 
47  // #i97628#
48  // The text content; now as local OutlinerParaObject copy (internally RefCounted and
49  // COW) and in exclusive, local form as needed in a primitive
51 
52  // remember last VisualizingPage for which a decomposition was made. If the new target
53  // is not given or different, the decomposition needs to be potentially removed
54  // for supporting e.g. page number change on MasterPage objects or the different
55  // field renderings in SubGeometry and MasterPage node
56  css::uno::Reference< css::drawing::XDrawPage > mxLastVisualizingPage;
57 
58  // remember last PageNumber for which a decomposition was made. This is only used
59  // when mbContainsPageField is true, else it is 0
60  sal_Int16 mnLastPageNumber;
61 
62  // remember last PageCount for which a decomposition was made. This is only used
63  // when mbContainsPageCountField is true, else it is 0
64  sal_Int16 mnLastPageCount;
65 
66  // #i101443# remember last TextBackgroundColor to decide if a new decomposition is
67  // needed because of background color change
69 
70  // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction
74 
75  protected:
76  // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
78 
79  public:
81  const SdrText* pSdrText,
82  const OutlinerParaObject& rOutlinerParaObjectPtr);
83 
84  // get data
85  const SdrText* getSdrText() const;
87 
88  // compare operator
89  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
90 
91  // own get2DDecomposition to take aspect of decomposition with or without spell checker
92  // into account
93  virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
94 
95  // transformed clone operator
96  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0;
97  };
98 } // end of namespace drawinglayer::primitive2d
99 
100 
102  {
104  {
105  private:
106  // unit contour polygon (scaled to [0.0 .. 1.0])
108 
109  // complete contour polygon transform (scale, rotate, shear, translate)
111 
112  // local decomposition.
113  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
114 
115  public:
117  const SdrText* pSdrText,
118  const OutlinerParaObject& rOutlinerParaObjectPtr,
119  const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
120  const basegfx::B2DHomMatrix& rObjectTransform);
121 
122  // get data
125 
126  // compare operator
127  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
128 
129  // transformed clone operator
130  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
131 
132  // provide unique ID
133  virtual sal_uInt32 getPrimitive2DID() const override;
134  };
135 } // end of namespace drawinglayer::primitive2d
136 
137 
139  {
141  {
142  private:
143  // the path to use. Each paragraph will use one Polygon.
145 
146  // the Fontwork parameters
148 
149  // local decomposition.
150  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
151 
152  public:
154  const SdrText* pSdrText,
155  const OutlinerParaObject& rOutlinerParaObjectPtr,
156  const basegfx::B2DPolyPolygon& rPathPolyPolygon,
157  const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
158 
159  // get data
162 
163  // compare operator
164  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
165 
166  // transformed clone operator
167  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
168 
169  // provide unique ID
170  virtual sal_uInt32 getPrimitive2DID() const override;
171  };
172 } // end of namespace drawinglayer::primitive2d
173 
174 
176  {
178  {
179  private:
180  // text range transformation from unit range ([0.0 .. 1.0]) to text range
182 
183  // text alignments
186 
188  bool mbUnlimitedPage : 1; // force layout with no text break
189  bool mbCellText : 1; // this is a cell text as block text
190  bool mbWordWrap : 1; // for CustomShapes text layout
191 
192  // local decomposition.
193  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
194 
195  public:
197  const SdrText* pSdrText,
198  const OutlinerParaObject& rOutlinerParaObjectPtr,
199  const basegfx::B2DHomMatrix& rTextRangeTransform,
200  SdrTextHorzAdjust aSdrTextHorzAdjust,
201  SdrTextVertAdjust aSdrTextVertAdjust,
202  bool bFixedCellHeight,
203  bool bUnlimitedPage,
204  bool bCellText,
205  bool bWordWrap);
206 
207  // get data
211  bool isFixedCellHeight() const { return mbFixedCellHeight; }
212  bool getUnlimitedPage() const { return mbUnlimitedPage; }
213  bool getCellText() const { return mbCellText; }
214  bool getWordWrap() const { return mbWordWrap; }
215 
216  // compare operator
217  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
218 
219  // transformed clone operator
220  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
221 
222  // provide unique ID
223  virtual sal_uInt32 getPrimitive2DID() const override;
224  };
225 } // end of namespace drawinglayer::primitive2d
226 
227 
229  {
231  {
232  private:
233  // text range transformation from unit range ([0.0 .. 1.0]) to text range
235 
237 
238  // local decomposition.
239  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
240 
241  public:
243  const SdrText* pSdrText,
244  const OutlinerParaObject& rOutlinerParaObjectPtr,
245  const basegfx::B2DHomMatrix& rTextRangeTransform,
246  bool bFixedCellHeight);
247 
248  // get data
250  bool isFixedCellHeight() const { return mbFixedCellHeight; }
251 
252  // compare operator
253  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
254 
255  // transformed clone operator
256  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
257 
258  // provide unique ID
259  virtual sal_uInt32 getPrimitive2DID() const override;
260  };
261 } // end of namespace drawinglayer::primitive2d
262 
263 
265  {
267  {
268  private:
269  ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
270 
271  bool mbWordWrap : 1; // for CustomShapes text layout
272 
273  // local decomposition.
274  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
275 
276  public:
278  const SdrText* pSdrText,
279  const OutlinerParaObject& rOutlinerParaObjectPtr,
280  const ::basegfx::B2DHomMatrix& rTextRangeTransform,
281  bool bWordWrap);
282 
283  // get data
285  bool getWordWrap() const { return mbWordWrap; }
286 
287  // compare operator
288  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
289 
290  // transformed clone operator
291  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const override;
292 
293  // provide unique ID
294  virtual sal_uInt32 getPrimitive2DID() const override;
295  };
296 } // end of namespace drawinglayer::primitive2d
297 
299  {
301  {
302  private:
303  // XXX: might have position of overflowing text
304 
305  ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
306 
307  // local decomposition.
308  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
309 
310  public:
312  const SdrText* pSdrText,
313  const OutlinerParaObject& rOutlinerParaObjectPtrs,
314  const ::basegfx::B2DHomMatrix& rTextRangeTransform);
315 
316  // get data
318  //bool getWordWrap() const { return true; } // XXX: Hack! Should have a proper implementation//
319 
320  // compare operator
321  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
322 
323  // transformed clone operator
324  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
325 
326  // provide unique ID
327  virtual sal_uInt32 getPrimitive2DID() const override;
328  };
329 } // end of namespace drawinglayer::primitive2d
330 
331 
332 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
333 
334 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const =0
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
const basegfx::B2DHomMatrix & getTextRangeTransform() const
const OutlinerParaObject & getOutlinerParaObject() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
virtual sal_uInt32 getPrimitive2DID() const override
SdrChainedTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtrs, const ::basegfx::B2DHomMatrix &rTextRangeTransform)
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const ::basegfx::B2DHomMatrix &rTransform) const override
virtual sal_uInt32 getPrimitive2DID() const override
virtual sal_uInt32 getPrimitive2DID() const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
SdrBlockTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const basegfx::B2DHomMatrix &rTextRangeTransform, SdrTextHorzAdjust aSdrTextHorzAdjust, SdrTextVertAdjust aSdrTextVertAdjust, bool bFixedCellHeight, bool bUnlimitedPage, bool bCellText, bool bWordWrap)
const basegfx::B2DPolyPolygon & getUnitPolyPolygon() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual sal_uInt32 getPrimitive2DID() const override
virtual sal_uInt32 getPrimitive2DID() const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
static void encapsulateWithTextHierarchyBlockPrimitive2D(Primitive2DContainer &rContainer, const Primitive2DContainer &rCandidate)
const attribute::SdrFormTextAttribute & getSdrFormTextAttribute() const
SdrPathTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const basegfx::B2DPolyPolygon &rPathPolyPolygon, const attribute::SdrFormTextAttribute &rSdrFormTextAttribute)
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
virtual sal_uInt32 getPrimitive2DID() const override
const basegfx::B2DPolyPolygon & getPathPolyPolygon() const
SdrAutoFitTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const ::basegfx::B2DHomMatrix &rTextRangeTransform, bool bWordWrap)
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
css::uno::Reference< css::drawing::XDrawPage > mxLastVisualizingPage
SdrStretchTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const basegfx::B2DHomMatrix &rTextRangeTransform, bool bFixedCellHeight)
const basegfx::B2DHomMatrix & getObjectTransform() const
SdrContourTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const basegfx::B2DPolyPolygon &rUnitPolyPolygon, const basegfx::B2DHomMatrix &rObjectTransform)
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
attribute::SdrFormTextAttribute maSdrFormTextAttribute
::tools::WeakReference< SdrText > mrSdrText
const basegfx::B2DHomMatrix & getTextRangeTransform() const
const basegfx::B2DHomMatrix & getTextRangeTransform() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
SdrTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr)
const basegfx::B2DHomMatrix & getTextRangeTransform() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
SdrTextVertAdjust
Definition: sdtaitm.hxx:29