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 #include <rtl/ref.hxx>
33 
34 
35 // predefines
36 class SdrText;
37 
38 
40  {
42  {
43  private:
44  // The text model data; this should later just be the OutlinerParaObject or
45  // something equal
47 
48  // #i97628#
49  // The text content; now as local OutlinerParaObject copy (internally RefCounted and
50  // COW) and in exclusive, local form as needed in a primitive
52 
53  // remember last VisualizingPage for which a decomposition was made. If the new target
54  // is not given or different, the decomposition needs to be potentially removed
55  // for supporting e.g. page number change on MasterPage objects or the different
56  // field renderings in SubGeometry and MasterPage node
57  css::uno::Reference< css::drawing::XDrawPage > mxLastVisualizingPage;
58 
59  // remember last PageNumber for which a decomposition was made. This is only used
60  // when mbContainsPageField is true, else it is 0
61  sal_Int16 mnLastPageNumber;
62 
63  // remember last PageCount for which a decomposition was made. This is only used
64  // when mbContainsPageCountField is true, else it is 0
65  sal_Int16 mnLastPageCount;
66 
67  // #i101443# remember last TextBackgroundColor to decide if a new decomposition is
68  // needed because of background color change
70 
71  // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction
75 
76  protected:
77  // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
79 
80  public:
82  const SdrText* pSdrText,
83  const OutlinerParaObject& rOutlinerParaObjectPtr);
84 
85  // get data
86  const SdrText* getSdrText() const;
88 
89  // compare operator
90  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
91 
92  // own get2DDecomposition to take aspect of decomposition with or without spell checker
93  // into account
94  virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
95 
96  // transformed clone operator
98  };
99 } // end of namespace drawinglayer::primitive2d
100 
101 
103  {
105  {
106  private:
107  // unit contour polygon (scaled to [0.0 .. 1.0])
109 
110  // complete contour polygon transform (scale, rotate, shear, translate)
112 
113  // local decomposition.
114  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
115 
116  public:
118  const SdrText* pSdrText,
119  const OutlinerParaObject& rOutlinerParaObjectPtr,
120  const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
121  const basegfx::B2DHomMatrix& rObjectTransform);
122 
123  // get data
126 
127  // compare operator
128  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
129 
130  // transformed clone operator
131  virtual rtl::Reference<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
132 
133  // provide unique ID
134  virtual sal_uInt32 getPrimitive2DID() const override;
135  };
136 } // end of namespace drawinglayer::primitive2d
137 
138 
140  {
142  {
143  private:
144  // the path to use. Each paragraph will use one Polygon.
146 
147  // the Fontwork parameters
149 
150  // local decomposition.
151  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
152 
153  public:
155  const SdrText* pSdrText,
156  const OutlinerParaObject& rOutlinerParaObjectPtr,
157  const basegfx::B2DPolyPolygon& rPathPolyPolygon,
158  const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
159 
160  // get data
163 
164  // compare operator
165  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
166 
167  // transformed clone operator
168  virtual rtl::Reference<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
169 
170  // provide unique ID
171  virtual sal_uInt32 getPrimitive2DID() const override;
172  };
173 } // end of namespace drawinglayer::primitive2d
174 
175 
177  {
179  {
180  private:
181  // text range transformation from unit range ([0.0 .. 1.0]) to text range
183 
184  // text alignments
187 
189  bool mbUnlimitedPage : 1; // force layout with no text break
190  bool mbCellText : 1; // this is a cell text as block text
191  bool mbWordWrap : 1; // for CustomShapes text layout
192 
193  // local decomposition.
194  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
195 
196  public:
198  const SdrText* pSdrText,
199  const OutlinerParaObject& rOutlinerParaObjectPtr,
200  const basegfx::B2DHomMatrix& rTextRangeTransform,
201  SdrTextHorzAdjust aSdrTextHorzAdjust,
202  SdrTextVertAdjust aSdrTextVertAdjust,
203  bool bFixedCellHeight,
204  bool bUnlimitedPage,
205  bool bCellText,
206  bool bWordWrap);
207 
208  // get data
212  bool isFixedCellHeight() const { return mbFixedCellHeight; }
213  bool getUnlimitedPage() const { return mbUnlimitedPage; }
214  bool getCellText() const { return mbCellText; }
215  bool getWordWrap() const { return mbWordWrap; }
216 
217  // compare operator
218  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
219 
220  // transformed clone operator
221  virtual rtl::Reference<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
222 
223  // provide unique ID
224  virtual sal_uInt32 getPrimitive2DID() const override;
225  };
226 } // end of namespace drawinglayer::primitive2d
227 
228 
230  {
232  {
233  private:
234  // text range transformation from unit range ([0.0 .. 1.0]) to text range
236 
238 
239  // local decomposition.
240  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
241 
242  public:
244  const SdrText* pSdrText,
245  const OutlinerParaObject& rOutlinerParaObjectPtr,
246  const basegfx::B2DHomMatrix& rTextRangeTransform,
247  bool bFixedCellHeight);
248 
249  // get data
251  bool isFixedCellHeight() const { return mbFixedCellHeight; }
252 
253  // compare operator
254  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
255 
256  // transformed clone operator
257  virtual rtl::Reference<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
258 
259  // provide unique ID
260  virtual sal_uInt32 getPrimitive2DID() const override;
261  };
262 } // end of namespace drawinglayer::primitive2d
263 
264 
266  {
268  {
269  private:
270  ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
271 
272  bool mbWordWrap : 1; // for CustomShapes text layout
273 
274  // local decomposition.
275  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
276 
277  public:
279  const SdrText* pSdrText,
280  const OutlinerParaObject& rOutlinerParaObjectPtr,
281  const ::basegfx::B2DHomMatrix& rTextRangeTransform,
282  bool bWordWrap);
283 
284  // get data
286  bool getWordWrap() const { return mbWordWrap; }
287 
288  // compare operator
289  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
290 
291  // transformed clone operator
292  virtual rtl::Reference<SdrTextPrimitive2D> createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const override;
293 
294  // provide unique ID
295  virtual sal_uInt32 getPrimitive2DID() const override;
296  };
297 } // end of namespace drawinglayer::primitive2d
298 
300  {
302  {
303  private:
304  // XXX: might have position of overflowing text
305 
306  ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
307 
308  // local decomposition.
309  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
310 
311  public:
313  const SdrText* pSdrText,
314  const OutlinerParaObject& rOutlinerParaObjectPtrs,
315  const ::basegfx::B2DHomMatrix& rTextRangeTransform);
316 
317  // get data
319  //bool getWordWrap() const { return true; } // XXX: Hack! Should have a proper implementation//
320 
321  // compare operator
322  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
323 
324  // transformed clone operator
325  virtual rtl::Reference<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
326 
327  // provide unique ID
328  virtual sal_uInt32 getPrimitive2DID() const override;
329  };
330 } // end of namespace drawinglayer::primitive2d
331 
332 
333 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
334 
335 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const ::basegfx::B2DHomMatrix &rTransform) const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
virtual sal_uInt32 getPrimitive2DID() 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 void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
static void encapsulateWithTextHierarchyBlockPrimitive2D(Primitive2DContainer &rContainer, Primitive2DContainer &&aCandidate)
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
SdrChainedTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtrs, const ::basegfx::B2DHomMatrix &rTextRangeTransform)
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) 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 bool operator==(const BasePrimitive2D &rPrimitive) const override
const attribute::SdrFormTextAttribute & getSdrFormTextAttribute() const
SdrPathTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const basegfx::B2DPolyPolygon &rPathPolyPolygon, const attribute::SdrFormTextAttribute &rSdrFormTextAttribute)
virtual sal_uInt32 getPrimitive2DID() const override
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const =0
const basegfx::B2DPolyPolygon & getPathPolyPolygon() const
virtual sal_uInt32 getPrimitive2DID() const override
virtual sal_uInt32 getPrimitive2DID() const override
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
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)
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
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 sal_uInt32 getPrimitive2DID() const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
virtual rtl::Reference< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
SdrTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr)
const basegfx::B2DHomMatrix & getTextRangeTransform() const
SdrTextVertAdjust
Definition: sdtaitm.hxx:29