Line data Source code
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_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <basegfx/matrix/b2dhommatrix.hxx>
27 :
28 :
29 :
30 : namespace drawinglayer
31 : {
32 : namespace primitive2d
33 : {
34 : /** TextEffectStyle2D definition */
35 : enum TextEffectStyle2D
36 : {
37 : TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT,
38 : TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT,
39 : TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED,
40 : TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED,
41 : TEXTEFFECTSTYLE2D_OUTLINE
42 : };
43 :
44 : /** TextEffectPrimitive2D class
45 :
46 : This primitive embeds text primitives (normally, as can be seen can
47 : also be used for any other primitives) which have some TextEffect applied
48 : and create the needed geometry and embedding on decomposition.
49 : */
50 3580 : class DRAWINGLAYER_DLLPUBLIC TextEffectPrimitive2D : public BufferedDecompositionPrimitive2D
51 : {
52 : private:
53 : /// the text (or other) content
54 : Primitive2DSequence maTextContent;
55 :
56 : /// the style to apply, the direction and the rotation center
57 : const basegfx::B2DPoint maRotationCenter;
58 : double mfDirection;
59 : TextEffectStyle2D meTextEffectStyle2D;
60 :
61 : /** the last used object to view transformtion used from getDecomposition
62 : for decide buffering
63 : */
64 : basegfx::B2DHomMatrix maLastObjectToViewTransformation;
65 :
66 : protected:
67 : /// create local decomposition
68 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
69 :
70 : public:
71 : /// construcor
72 : TextEffectPrimitive2D(
73 : const Primitive2DSequence& rTextContent,
74 : const basegfx::B2DPoint& rRotationCenter,
75 : double fDirection,
76 : TextEffectStyle2D eTextEffectStyle2D);
77 :
78 : /// data read access
79 8586 : const Primitive2DSequence& getTextContent() const { return maTextContent; }
80 712 : const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; }
81 356 : double getDirection() const { return mfDirection; }
82 728 : TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; }
83 :
84 : /// compare operator
85 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
86 :
87 : /** own get range implementation to solve more effective. Content is by definition displaced
88 : by a fixed discrete unit, thus the contained geometry needs only once be asked for its
89 : own basegfx::B2DRange
90 : */
91 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
92 :
93 : /// provide unique ID
94 : DeclPrimitive2DIDBlock()
95 :
96 : /// Overload standard getDecomposition call to be view-dependent here
97 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
98 : };
99 : } // end of namespace primitive2d
100 : } // end of namespace drawinglayer
101 :
102 :
103 :
104 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|