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 
38 namespace drawinglayer
39 {
40  namespace primitive2d
41  {
43  {
44  private:
45  // The text model data; this should later just be the OutlinerParaObject or
46  // something equal
48 
49  // #i97628#
50  // The text content; now as local OutlinerParaObject copy (internally RefCounted and
51  // COW) and in exclusive, local form as needed in a primitive
53 
54  // remember last VisualizingPage for which a decomposition was made. If the new target
55  // is not given or different, the decomposition needs to be potentially removed
56  // for supporting e.g. page number change on MasterPage objects or the different
57  // field renderings in SubGeometry and MasterPage node
58  css::uno::Reference< css::drawing::XDrawPage > mxLastVisualizingPage;
59 
60  // remember last PageNumber for which a decomposition was made. This is only used
61  // when mbContainsPageField is true, else it is 0
62  sal_Int16 mnLastPageNumber;
63 
64  // remember last PageCount for which a decomposition was made. This is only used
65  // when mbContainsPageCountField is true, else it is 0
66  sal_Int16 mnLastPageCount;
67 
68  // #i101443# remember last TextBackgroundColor to decide if a new decomposition is
69  // needed because of background color change
71 
72  // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction
76 
77  protected:
78  // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
80 
81  public:
83  const SdrText* pSdrText,
84  const OutlinerParaObject& rOutlinerParaObjectPtr);
85 
86  // get data
87  const SdrText* getSdrText() const;
89 
90  // compare operator
91  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
92 
93  // own get2DDecomposition to take aspect of decomposition with or without spell checker
94  // into account
95  virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
96 
97  // transformed clone operator
98  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0;
99  };
100  } // end of namespace primitive2d
101 } // end of namespace drawinglayer
102 
103 
104 namespace drawinglayer
105 {
106  namespace primitive2d
107  {
109  {
110  private:
111  // unit contour polygon (scaled to [0.0 .. 1.0])
113 
114  // complete contour polygon transform (scale, rotate, shear, translate)
116 
117  // local decomposition.
118  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
119 
120  public:
122  const SdrText* pSdrText,
123  const OutlinerParaObject& rOutlinerParaObjectPtr,
124  const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
125  const basegfx::B2DHomMatrix& rObjectTransform);
126 
127  // get data
130 
131  // compare operator
132  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
133 
134  // transformed clone operator
135  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
136 
137  // provide unique ID
138  virtual sal_uInt32 getPrimitive2DID() const override;
139  };
140  } // end of namespace primitive2d
141 } // end of namespace drawinglayer
142 
143 
144 namespace drawinglayer
145 {
146  namespace primitive2d
147  {
149  {
150  private:
151  // the path to use. Each paragraph will use one Polygon.
153 
154  // the Fontwork parameters
156 
157  // local decomposition.
158  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
159 
160  public:
162  const SdrText* pSdrText,
163  const OutlinerParaObject& rOutlinerParaObjectPtr,
164  const basegfx::B2DPolyPolygon& rPathPolyPolygon,
165  const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
166 
167  // get data
170 
171  // compare operator
172  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
173 
174  // transformed clone operator
175  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
176 
177  // provide unique ID
178  virtual sal_uInt32 getPrimitive2DID() const override;
179  };
180  } // end of namespace primitive2d
181 } // end of namespace drawinglayer
182 
183 
184 namespace drawinglayer
185 {
186  namespace primitive2d
187  {
189  {
190  private:
191  // text range transformation from unit range ([0.0 .. 1.0]) to text range
193 
194  // text alignments
197 
199  bool mbUnlimitedPage : 1; // force layout with no text break
200  bool mbCellText : 1; // this is a cell text as block text
201  bool mbWordWrap : 1; // for CustomShapes text layout
202 
203  // local decomposition.
204  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
205 
206  public:
208  const SdrText* pSdrText,
209  const OutlinerParaObject& rOutlinerParaObjectPtr,
210  const basegfx::B2DHomMatrix& rTextRangeTransform,
211  SdrTextHorzAdjust aSdrTextHorzAdjust,
212  SdrTextVertAdjust aSdrTextVertAdjust,
213  bool bFixedCellHeight,
214  bool bUnlimitedPage,
215  bool bCellText,
216  bool bWordWrap);
217 
218  // get data
222  bool isFixedCellHeight() const { return mbFixedCellHeight; }
223  bool getUnlimitedPage() const { return mbUnlimitedPage; }
224  bool getCellText() const { return mbCellText; }
225  bool getWordWrap() const { return mbWordWrap; }
226 
227  // compare operator
228  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
229 
230  // transformed clone operator
231  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
232 
233  // provide unique ID
234  virtual sal_uInt32 getPrimitive2DID() const override;
235  };
236  } // end of namespace primitive2d
237 } // end of namespace drawinglayer
238 
239 
240 namespace drawinglayer
241 {
242  namespace primitive2d
243  {
245  {
246  private:
247  // text range transformation from unit range ([0.0 .. 1.0]) to text range
249 
251 
252  // local decomposition.
253  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
254 
255  public:
257  const SdrText* pSdrText,
258  const OutlinerParaObject& rOutlinerParaObjectPtr,
259  const basegfx::B2DHomMatrix& rTextRangeTransform,
260  bool bFixedCellHeight);
261 
262  // get data
264  bool isFixedCellHeight() const { return mbFixedCellHeight; }
265 
266  // compare operator
267  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
268 
269  // transformed clone operator
270  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
271 
272  // provide unique ID
273  virtual sal_uInt32 getPrimitive2DID() const override;
274  };
275  } // end of namespace primitive2d
276 } // end of namespace drawinglayer
277 
278 
279 namespace drawinglayer
280 {
281  namespace primitive2d
282  {
284  {
285  private:
286  ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
287 
288  bool mbWordWrap : 1; // for CustomShapes text layout
289 
290  // local decomposition.
291  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
292 
293  public:
295  const SdrText* pSdrText,
296  const OutlinerParaObject& rOutlinerParaObjectPtr,
297  const ::basegfx::B2DHomMatrix& rTextRangeTransform,
298  bool bWordWrap);
299 
300  // get data
302  bool getWordWrap() const { return mbWordWrap; }
303 
304  // compare operator
305  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
306 
307  // transformed clone operator
308  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const override;
309 
310  // provide unique ID
311  virtual sal_uInt32 getPrimitive2DID() const override;
312  };
313  } // end of namespace primitive2d
314 } // end of namespace drawinglayer
315 
316 namespace drawinglayer
317 {
318  namespace primitive2d
319  {
321  {
322  private:
323  // XXX: might have position of overflowing text
324 
325  ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
326 
327  // local decomposition.
328  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
329 
330  public:
332  const SdrText* pSdrText,
333  const OutlinerParaObject& rOutlinerParaObjectPtrs,
334  const ::basegfx::B2DHomMatrix& rTextRangeTransform);
335 
336  // get data
338  //bool getWordWrap() const { return true; } // XXX: Hack! Should have a proper implementation//
339 
340  // compare operator
341  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
342 
343  // transformed clone operator
344  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
345 
346  // provide unique ID
347  virtual sal_uInt32 getPrimitive2DID() const override;
348  };
349  } // end of namespace primitive2d
350 } // end of namespace drawinglayer
351 
352 
353 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
354 
355 /* 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