1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX 25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 29 #include <basegfx/matrix/b2dhommatrix.hxx> 30 31 ////////////////////////////////////////////////////////////////////////////// 32 33 namespace drawinglayer 34 { 35 namespace primitive2d 36 { 37 /** TextEffectStyle2D definition */ 38 enum TextEffectStyle2D 39 { 40 TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT, 41 TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT, 42 TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED, 43 TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED, 44 TEXTEFFECTSTYLE2D_OUTLINE 45 }; 46 47 /** TextEffectPrimitive2D class 48 49 This primitive embeds text primitives (normally, as can be seen can 50 also be used for any other primitives) which have some TextEffect applied 51 and create the needed geometry and embedding on decomposition. 52 */ 53 class DRAWINGLAYER_DLLPUBLIC TextEffectPrimitive2D : public BufferedDecompositionPrimitive2D 54 { 55 private: 56 /// the text (or other) content 57 Primitive2DSequence maTextContent; 58 59 /// the style to apply, the direction and the rotation center 60 const basegfx::B2DPoint maRotationCenter; 61 double mfDirection; 62 TextEffectStyle2D meTextEffectStyle2D; 63 64 /** the last used object to view transformtion used from getDecomposition 65 for decide buffering 66 */ 67 basegfx::B2DHomMatrix maLastObjectToViewTransformation; 68 69 protected: 70 /// create local decomposition 71 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 72 73 public: 74 /// construcor 75 TextEffectPrimitive2D( 76 const Primitive2DSequence& rTextContent, 77 const basegfx::B2DPoint& rRotationCenter, 78 double fDirection, 79 TextEffectStyle2D eTextEffectStyle2D); 80 81 /// data read access getTextContent() const82 const Primitive2DSequence& getTextContent() const { return maTextContent; } getRotationCenter() const83 const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } getDirection() const84 double getDirection() const { return mfDirection; } getTextEffectStyle2D() const85 TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } 86 87 /// compare operator 88 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 89 90 /** own get range implementation to solve more effective. Content is by definition displaced 91 by a fixed discrete unit, thus the contained geometry needs only once be asked for it's 92 own basegfx::B2DRange 93 */ 94 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 95 96 /// provide unique ID 97 DeclPrimitrive2DIDBlock() 98 99 /// Overload standard getDecomposition call to be view-dependent here 100 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 101 }; 102 } // end of namespace primitive2d 103 } // end of namespace drawinglayer 104 105 ////////////////////////////////////////////////////////////////////////////// 106 107 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX 108 109 ////////////////////////////////////////////////////////////////////////////// 110 // eof 111