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.hxx>
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  protected:
118  // local decomposition.
119  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
120 
121  public:
123  const SdrText* pSdrText,
124  const OutlinerParaObject& rOutlinerParaObjectPtr,
125  const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
126  const basegfx::B2DHomMatrix& rObjectTransform);
127 
128  // get data
131 
132  // compare operator
133  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
134 
135  // transformed clone operator
136  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
137 
138  // provide unique ID
140  };
141  } // end of namespace primitive2d
142 } // end of namespace drawinglayer
143 
144 
145 namespace drawinglayer
146 {
147  namespace primitive2d
148  {
150  {
151  private:
152  // the path to use. Each paragraph will use one Polygon.
154 
155  // the Fontwork parameters
157 
158  protected:
159  // local decomposition.
160  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
161 
162  public:
164  const SdrText* pSdrText,
165  const OutlinerParaObject& rOutlinerParaObjectPtr,
166  const basegfx::B2DPolyPolygon& rPathPolyPolygon,
167  const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
168 
169  // get data
172 
173  // compare operator
174  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
175 
176  // transformed clone operator
177  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
178 
179  // provide unique ID
181  };
182  } // end of namespace primitive2d
183 } // end of namespace drawinglayer
184 
185 
186 namespace drawinglayer
187 {
188  namespace primitive2d
189  {
191  {
192  private:
193  // text range transformation from unit range ([0.0 .. 1.0]) to text range
195 
196  // text alignments
199 
200  bool const mbFixedCellHeight : 1;
201  bool const mbUnlimitedPage : 1; // force layout with no text break
202  bool const mbCellText : 1; // this is a cell text as block text
203  bool const mbWordWrap : 1; // for CustomShapes text layout
204  bool const mbClipOnBounds : 1; // for CustomShapes text layout
205 
206  protected:
207  // local decomposition.
208  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
209 
210  public:
212  const SdrText* pSdrText,
213  const OutlinerParaObject& rOutlinerParaObjectPtr,
214  const basegfx::B2DHomMatrix& rTextRangeTransform,
215  SdrTextHorzAdjust aSdrTextHorzAdjust,
216  SdrTextVertAdjust aSdrTextVertAdjust,
217  bool bFixedCellHeight,
218  bool bUnlimitedPage,
219  bool bCellText,
220  bool bWordWrap,
221  bool bClipOnBounds);
222 
223  // get data
227  bool isFixedCellHeight() const { return mbFixedCellHeight; }
228  bool getUnlimitedPage() const { return mbUnlimitedPage; }
229  bool getCellText() const { return mbCellText; }
230  bool getWordWrap() const { return mbWordWrap; }
231  bool getClipOnBounds() const { return mbClipOnBounds; }
232 
233  // compare operator
234  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
235 
236  // transformed clone operator
237  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
238 
239  // provide unique ID
241  };
242  } // end of namespace primitive2d
243 } // end of namespace drawinglayer
244 
245 
246 namespace drawinglayer
247 {
248  namespace primitive2d
249  {
251  {
252  private:
253  // text range transformation from unit range ([0.0 .. 1.0]) to text range
255 
256  bool const mbFixedCellHeight : 1;
257 
258  protected:
259  // local decomposition.
260  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
261 
262  public:
264  const SdrText* pSdrText,
265  const OutlinerParaObject& rOutlinerParaObjectPtr,
266  const basegfx::B2DHomMatrix& rTextRangeTransform,
267  bool bFixedCellHeight);
268 
269  // get data
271  bool isFixedCellHeight() const { return mbFixedCellHeight; }
272 
273  // compare operator
274  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
275 
276  // transformed clone operator
277  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
278 
279  // provide unique ID
281  };
282  } // end of namespace primitive2d
283 } // end of namespace drawinglayer
284 
285 
286 namespace drawinglayer
287 {
288  namespace primitive2d
289  {
291  {
292  private:
293  ::basegfx::B2DHomMatrix const maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
294 
295  bool const mbWordWrap : 1; // for CustomShapes text layout
296 
297  protected:
298  // local decomposition.
299  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
300 
301  public:
303  const SdrText* pSdrText,
304  const OutlinerParaObject& rOutlinerParaObjectPtr,
305  const ::basegfx::B2DHomMatrix& rTextRangeTransform,
306  bool bWordWrap);
307 
308  // get data
310  bool getWordWrap() const { return mbWordWrap; }
311 
312  // compare operator
313  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
314 
315  // transformed clone operator
316  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const override;
317 
318  // provide unique ID
320  };
321  } // end of namespace primitive2d
322 } // end of namespace drawinglayer
323 
324 namespace drawinglayer
325 {
326  namespace primitive2d
327  {
329  {
330  private:
331  // XXX: might have position of overflowing text
332 
333  ::basegfx::B2DHomMatrix const maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
334  protected:
335  // local decomposition.
336  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
337 
338  public:
340  const SdrText* pSdrText,
341  const OutlinerParaObject& rOutlinerParaObjectPtrs,
342  const ::basegfx::B2DHomMatrix& rTextRangeTransform);
343 
344  // get data
346  //bool getWordWrap() const { return true; } // XXX: Hack! Should have a proper implementation//
347 
348  // compare operator
349  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
350 
351  // transformed clone operator
352  virtual std::unique_ptr<SdrTextPrimitive2D> createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const override;
353 
354  // provide unique ID
356  };
357  } // end of namespace primitive2d
358 } // end of namespace drawinglayer
359 
360 
361 #endif // INCLUDED_SVX_INC_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
362 
363 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const =0
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &aViewInformation) const override
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
SdrBlockTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtr, const basegfx::B2DHomMatrix &rTextRangeTransform, SdrTextHorzAdjust aSdrTextHorzAdjust, SdrTextVertAdjust aSdrTextVertAdjust, bool bFixedCellHeight, bool bUnlimitedPage, bool bCellText, bool bWordWrap, bool bClipOnBounds)
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
#define DeclPrimitive2DIDBlock()
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
SdrChainedTextPrimitive2D(const SdrText *pSdrText, const OutlinerParaObject &rOutlinerParaObjectPtrs, const ::basegfx::B2DHomMatrix &rTextRangeTransform)
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const ::basegfx::B2DHomMatrix &rTransform) const override
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
const basegfx::B2DPolyPolygon & getUnitPolyPolygon() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) 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
const basegfx::B2DPolyPolygon & getPathPolyPolygon() const
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)
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
::tools::WeakReference< SdrText > mrSdrText
const basegfx::B2DHomMatrix & getTextRangeTransform() const
const basegfx::B2DHomMatrix & getTextRangeTransform() const
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
attribute::SdrFormTextAttribute const maSdrFormTextAttribute
virtual std::unique_ptr< SdrTextPrimitive2D > createTransformedClone(const basegfx::B2DHomMatrix &rTransform) const override
SdrTextVertAdjust
Definition: sdtaitm.hxx:29