14f506f19SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
34f506f19SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
44f506f19SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
54f506f19SAndrew Rist  * distributed with this work for additional information
64f506f19SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
74f506f19SAndrew Rist  * to you under the Apache License, Version 2.0 (the
84f506f19SAndrew Rist  * "License"); you may not use this file except in compliance
94f506f19SAndrew Rist  * with the License.  You may obtain a copy of the License at
104f506f19SAndrew Rist  *
114f506f19SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
124f506f19SAndrew Rist  *
134f506f19SAndrew Rist  * Unless required by applicable law or agreed to in writing,
144f506f19SAndrew Rist  * software distributed under the License is distributed on an
154f506f19SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
164f506f19SAndrew Rist  * KIND, either express or implied.  See the License for the
174f506f19SAndrew Rist  * specific language governing permissions and limitations
184f506f19SAndrew Rist  * under the License.
194f506f19SAndrew Rist  *
204f506f19SAndrew Rist  *************************************************************/
214f506f19SAndrew Rist 
224f506f19SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
26cdf0e10cSrcweir 
27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h>
28cdf0e10cSrcweir #include <drawinglayer/primitive2d/textprimitive2d.hxx>
29cdf0e10cSrcweir #include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir // predeclarations
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace basegfx { namespace tools {
35cdf0e10cSrcweir     class B2DHomMatrixBufferedOnDemandDecompose;
36cdf0e10cSrcweir }}
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
39cdf0e10cSrcweir 	struct Boundary;
40cdf0e10cSrcweir }}}}
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace drawinglayer
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 	namespace primitive2d
47cdf0e10cSrcweir 	{
48cdf0e10cSrcweir         /** TextDecoratedPortionPrimitive2D class
49cdf0e10cSrcweir 
50cdf0e10cSrcweir             This primitive expands the TextSimplePortionPrimitive2D by common
51cdf0e10cSrcweir             decorations used in the office. It can be decomposed and will create
52cdf0e10cSrcweir             a TextSimplePortionPrimitive2D and all the contained decorations (if used)
53cdf0e10cSrcweir             as geometry.
54cdf0e10cSrcweir          */
55090f0eb8SEike Rathke 		class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
56cdf0e10cSrcweir 		{
57cdf0e10cSrcweir 		private:
58cdf0e10cSrcweir             /// decoration definitions
59cdf0e10cSrcweir             basegfx::BColor                             maOverlineColor;
60cdf0e10cSrcweir             basegfx::BColor                             maTextlineColor;
61cdf0e10cSrcweir             TextLine                                    meFontOverline;
62cdf0e10cSrcweir             TextLine                                    meFontUnderline;
63cdf0e10cSrcweir 			TextStrikeout								meTextStrikeout;
64cdf0e10cSrcweir 			TextEmphasisMark							meTextEmphasisMark;
65cdf0e10cSrcweir 			TextRelief									meTextRelief;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 			/// bitfield
68cdf0e10cSrcweir 			unsigned									mbUnderlineAbove : 1;
69cdf0e10cSrcweir 			unsigned									mbWordLineMode : 1;
70cdf0e10cSrcweir 			unsigned									mbEmphasisMarkAbove : 1;
71cdf0e10cSrcweir 			unsigned									mbEmphasisMarkBelow : 1;
72cdf0e10cSrcweir 			unsigned									mbShadow : 1;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir             /// helper methods
75cdf0e10cSrcweir             void impCreateGeometryContent(
76cdf0e10cSrcweir                 std::vector< Primitive2DReference >& rTarget,
77cdf0e10cSrcweir                 basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
78cdf0e10cSrcweir                 const String& rText,
79cdf0e10cSrcweir 				xub_StrLen aTextPosition,
80cdf0e10cSrcweir 				xub_StrLen aTextLength,
81cdf0e10cSrcweir                 const ::std::vector< double >& rDXArray,
82cdf0e10cSrcweir                 const attribute::FontAttribute& rFontAttribute) const;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         protected:
85cdf0e10cSrcweir 			/// local decomposition.
86cdf0e10cSrcweir 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 		public:
89cdf0e10cSrcweir             /// constructor
90cdf0e10cSrcweir 			TextDecoratedPortionPrimitive2D(
91cdf0e10cSrcweir 
92cdf0e10cSrcweir                 /// TextSimplePortionPrimitive2D parameters
93cdf0e10cSrcweir 				const basegfx::B2DHomMatrix& rNewTransform,
94cdf0e10cSrcweir 				const String& rText,
95cdf0e10cSrcweir 				xub_StrLen aTextPosition,
96cdf0e10cSrcweir 				xub_StrLen aTextLength,
97cdf0e10cSrcweir 				const ::std::vector< double >& rDXArray,
98cdf0e10cSrcweir                 const attribute::FontAttribute& rFontAttribute,
99cdf0e10cSrcweir                 const ::com::sun::star::lang::Locale& rLocale,
100cdf0e10cSrcweir 				const basegfx::BColor& rFontColor,
101cdf0e10cSrcweir 
102cdf0e10cSrcweir                 /// local parameters
103cdf0e10cSrcweir                 const basegfx::BColor& rOverlineColor,
104cdf0e10cSrcweir                 const basegfx::BColor& rTextlineColor,
105cdf0e10cSrcweir                 TextLine eFontOverline = TEXT_LINE_NONE,
106cdf0e10cSrcweir                 TextLine eFontUnderline = TEXT_LINE_NONE,
107cdf0e10cSrcweir 				bool bUnderlineAbove = false,
108cdf0e10cSrcweir 				TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
109cdf0e10cSrcweir 				bool bWordLineMode = false,
110cdf0e10cSrcweir 				TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
111cdf0e10cSrcweir 				bool bEmphasisMarkAbove = true,
112cdf0e10cSrcweir 				bool bEmphasisMarkBelow = false,
113cdf0e10cSrcweir 				TextRelief eTextRelief = TEXT_RELIEF_NONE,
114cdf0e10cSrcweir 				bool bShadow = false);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 			/// data read access
getFontOverline() const117cdf0e10cSrcweir             TextLine getFontOverline() const { return meFontOverline; }
getFontUnderline() const118cdf0e10cSrcweir             TextLine getFontUnderline() const { return meFontUnderline; }
getTextStrikeout() const119cdf0e10cSrcweir 			TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
getTextEmphasisMark() const120cdf0e10cSrcweir 			TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
getTextRelief() const121cdf0e10cSrcweir 			TextRelief getTextRelief() const { return meTextRelief; }
getOverlineColor() const122cdf0e10cSrcweir             const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
getTextlineColor() const123cdf0e10cSrcweir             const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
getUnderlineAbove() const124cdf0e10cSrcweir             bool getUnderlineAbove() const { return mbUnderlineAbove; }
getWordLineMode() const125cdf0e10cSrcweir 			bool getWordLineMode() const { return mbWordLineMode; }
getEmphasisMarkAbove() const126cdf0e10cSrcweir 			bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
getEmphasisMarkBelow() const127cdf0e10cSrcweir 			bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
getShadow() const128cdf0e10cSrcweir 			bool getShadow() const { return mbShadow; }
129cdf0e10cSrcweir 
130*693be7f6SArmin Le Grand             /// check if this needs to be a TextDecoratedPortionPrimitive2D or
131*693be7f6SArmin Le Grand             /// if a TextSimplePortionPrimitive2D would be suficcient
132*693be7f6SArmin Le Grand             bool decoratedIsNeeded() const;
133*693be7f6SArmin Le Grand 
134cdf0e10cSrcweir 			/// compare operator
135cdf0e10cSrcweir 			virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 			/// get range
138cdf0e10cSrcweir 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir             /// provide unique ID
141cdf0e10cSrcweir 			DeclPrimitrive2DIDBlock()
142cdf0e10cSrcweir 		};
143cdf0e10cSrcweir 	} // end of namespace primitive2d
144cdf0e10cSrcweir } // end of namespace drawinglayer
145cdf0e10cSrcweir 
146cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
147cdf0e10cSrcweir 
148cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
149cdf0e10cSrcweir 
150cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
151cdf0e10cSrcweir // eof
152