xref: /AOO41X/main/svtools/source/control/scriptedtext.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svtools.hxx"
30*cdf0e10cSrcweir #include <svtools/scriptedtext.hxx>
31*cdf0e10cSrcweir #include <vector>
32*cdf0e10cSrcweir #include <rtl/ustring.hxx>
33*cdf0e10cSrcweir #include <vcl/outdev.hxx>
34*cdf0e10cSrcweir #include <vcl/font.hxx>
35*cdf0e10cSrcweir #include <tools/debug.hxx>
36*cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir using namespace ::std;
40*cdf0e10cSrcweir using namespace ::rtl;
41*cdf0e10cSrcweir using namespace ::com::sun::star;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir //_____________________________________________________________________________
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir class SvtScriptedTextHelper_Impl
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir private:
49*cdf0e10cSrcweir     OutputDevice&               mrOutDevice;        /// The output device for drawing the text.
50*cdf0e10cSrcweir     Font                        maLatinFont;        /// The font for latin text portions.
51*cdf0e10cSrcweir     Font                        maAsianFont;        /// The font for asian text portions.
52*cdf0e10cSrcweir     Font                        maCmplxFont;        /// The font for complex text portions.
53*cdf0e10cSrcweir     Font                        maDefltFont;        /// The default font of the output device.
54*cdf0e10cSrcweir     OUString                    maText;             /// The text.
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     vector< sal_Int32 >         maPosVec;           /// The start position of each text portion.
57*cdf0e10cSrcweir     vector< sal_Int16 >         maScriptVec;        /// The script type of each text portion.
58*cdf0e10cSrcweir     vector< sal_Int32 >         maWidthVec;         /// The output width of each text portion.
59*cdf0e10cSrcweir     Size                        maTextSize;         /// The size the text will take in the current output device.
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir                                 /** Assignment operator not implemented to prevent usage. */
62*cdf0e10cSrcweir     SvtScriptedTextHelper_Impl& operator=( const SvtScriptedTextHelper_Impl& );
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir                                 /** Gets the font of the given script type. */
65*cdf0e10cSrcweir     const Font&                 GetFont( sal_uInt16 _nScript ) const;
66*cdf0e10cSrcweir                                 /** Sets a font on the output device depending on the script type. */
67*cdf0e10cSrcweir     inline void                 SetOutDevFont( sal_uInt16 _nScript )
68*cdf0e10cSrcweir                                     { mrOutDevice.SetFont( GetFont( _nScript ) ); }
69*cdf0e10cSrcweir                                 /** Fills maPosVec with positions of all changes of script type.
70*cdf0e10cSrcweir                                     This method expects correctly initialized maPosVec and maScriptVec. */
71*cdf0e10cSrcweir     void                        CalculateSizes();
72*cdf0e10cSrcweir                                 /** Fills maPosVec with positions of all changes of script type and
73*cdf0e10cSrcweir                                     maScriptVec with the script type of each portion. */
74*cdf0e10cSrcweir     void                        CalculateBreaks(
75*cdf0e10cSrcweir                                     const uno::Reference< i18n::XBreakIterator >& _xBreakIter );
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir public:
78*cdf0e10cSrcweir                                 /** This constructor sets an output device and fonts for all script types. */
79*cdf0e10cSrcweir                                 SvtScriptedTextHelper_Impl(
80*cdf0e10cSrcweir                                     OutputDevice& _rOutDevice,
81*cdf0e10cSrcweir                                     Font* _pLatinFont,
82*cdf0e10cSrcweir                                     Font* _pAsianFont,
83*cdf0e10cSrcweir                                     Font* _pCmplxFont );
84*cdf0e10cSrcweir                                 /** Copy constructor. */
85*cdf0e10cSrcweir                                 SvtScriptedTextHelper_Impl(
86*cdf0e10cSrcweir                                     const SvtScriptedTextHelper_Impl& _rCopy );
87*cdf0e10cSrcweir                                 /** Destructor. */
88*cdf0e10cSrcweir                                 ~SvtScriptedTextHelper_Impl();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir                                 /** Sets new fonts and recalculates the text width. */
91*cdf0e10cSrcweir     void                        SetFonts( Font* _pLatinFont, Font* _pAsianFont, Font* _pCmplxFont );
92*cdf0e10cSrcweir                                 /** Sets a new text and calculates all script breaks and the text width. */
93*cdf0e10cSrcweir     void                        SetText(
94*cdf0e10cSrcweir                                     const OUString& _rText,
95*cdf0e10cSrcweir                                     const uno::Reference< i18n::XBreakIterator >& _xBreakIter );
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir                                 /** Returns the previously set text. */
98*cdf0e10cSrcweir     const OUString&             GetText() const;
99*cdf0e10cSrcweir                                 /** Returns a size struct containing the width and height of the text in the current output device. */
100*cdf0e10cSrcweir     const Size&                 GetTextSize() const;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir                                 /** Draws the text in the current output device. */
103*cdf0e10cSrcweir     void                        DrawText( const Point& _rPos );
104*cdf0e10cSrcweir };
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir SvtScriptedTextHelper_Impl::SvtScriptedTextHelper_Impl(
108*cdf0e10cSrcweir         OutputDevice& _rOutDevice,
109*cdf0e10cSrcweir         Font* _pLatinFont, Font* _pAsianFont, Font* _pCmplxFont ) :
110*cdf0e10cSrcweir     mrOutDevice( _rOutDevice ),
111*cdf0e10cSrcweir     maLatinFont( _pLatinFont ? *_pLatinFont : _rOutDevice.GetFont() ),
112*cdf0e10cSrcweir     maAsianFont( _pAsianFont ? *_pAsianFont : _rOutDevice.GetFont() ),
113*cdf0e10cSrcweir     maCmplxFont( _pCmplxFont ? *_pCmplxFont : _rOutDevice.GetFont() ),
114*cdf0e10cSrcweir     maDefltFont( _rOutDevice.GetFont() )
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir SvtScriptedTextHelper_Impl::SvtScriptedTextHelper_Impl( const SvtScriptedTextHelper_Impl& _rCopy ) :
119*cdf0e10cSrcweir     mrOutDevice( _rCopy.mrOutDevice ),
120*cdf0e10cSrcweir     maLatinFont( _rCopy.maLatinFont ),
121*cdf0e10cSrcweir     maAsianFont( _rCopy.maAsianFont ),
122*cdf0e10cSrcweir     maCmplxFont( _rCopy.maCmplxFont ),
123*cdf0e10cSrcweir     maDefltFont( _rCopy.maDefltFont ),
124*cdf0e10cSrcweir     maText( _rCopy.maText ),
125*cdf0e10cSrcweir     maPosVec( _rCopy.maPosVec ),
126*cdf0e10cSrcweir     maScriptVec( _rCopy.maScriptVec ),
127*cdf0e10cSrcweir     maWidthVec( _rCopy.maWidthVec ),
128*cdf0e10cSrcweir     maTextSize( _rCopy.maTextSize )
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir SvtScriptedTextHelper_Impl::~SvtScriptedTextHelper_Impl()
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir const Font& SvtScriptedTextHelper_Impl::GetFont( sal_uInt16 _nScript ) const
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir     switch( _nScript )
139*cdf0e10cSrcweir     {
140*cdf0e10cSrcweir         case i18n::ScriptType::LATIN:       return maLatinFont;
141*cdf0e10cSrcweir         case i18n::ScriptType::ASIAN:       return maAsianFont;
142*cdf0e10cSrcweir         case i18n::ScriptType::COMPLEX:     return maCmplxFont;
143*cdf0e10cSrcweir     }
144*cdf0e10cSrcweir     return maDefltFont;
145*cdf0e10cSrcweir }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir void SvtScriptedTextHelper_Impl::CalculateSizes()
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir     maTextSize.Width() = maTextSize.Height() = 0;
150*cdf0e10cSrcweir     maDefltFont = mrOutDevice.GetFont();
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     // calculate text portion widths and total width
153*cdf0e10cSrcweir     maWidthVec.clear();
154*cdf0e10cSrcweir     if( !maPosVec.empty() )
155*cdf0e10cSrcweir     {
156*cdf0e10cSrcweir         DBG_ASSERT( maPosVec.size() - 1 == maScriptVec.size(),
157*cdf0e10cSrcweir             "SvtScriptedTextHelper_Impl::CalculateWidth - invalid vectors" );
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir         xub_StrLen nThisPos = static_cast< xub_StrLen >( maPosVec[ 0 ] );
160*cdf0e10cSrcweir         xub_StrLen nNextPos;
161*cdf0e10cSrcweir         sal_Int32 nPosVecSize = maPosVec.size();
162*cdf0e10cSrcweir         sal_Int32 nPosVecIndex = 1;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir         sal_Int16 nScript;
165*cdf0e10cSrcweir         sal_Int32 nScriptVecIndex = 0;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir         sal_Int32 nCurrWidth;
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir         while( nPosVecIndex < nPosVecSize )
170*cdf0e10cSrcweir         {
171*cdf0e10cSrcweir             nNextPos = static_cast< xub_StrLen >( maPosVec[ nPosVecIndex++ ] );
172*cdf0e10cSrcweir             nScript = maScriptVec[ nScriptVecIndex++ ];
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir             SetOutDevFont( nScript );
175*cdf0e10cSrcweir             nCurrWidth = mrOutDevice.GetTextWidth( maText, nThisPos, nNextPos - nThisPos );
176*cdf0e10cSrcweir             maWidthVec.push_back( nCurrWidth );
177*cdf0e10cSrcweir             maTextSize.Width() += nCurrWidth;
178*cdf0e10cSrcweir             nThisPos = nNextPos;
179*cdf0e10cSrcweir         }
180*cdf0e10cSrcweir     }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     // calculate maximum font height
183*cdf0e10cSrcweir     SetOutDevFont( i18n::ScriptType::LATIN );
184*cdf0e10cSrcweir     maTextSize.Height() = Max( maTextSize.Height(), mrOutDevice.GetTextHeight() );
185*cdf0e10cSrcweir     SetOutDevFont( i18n::ScriptType::ASIAN );
186*cdf0e10cSrcweir     maTextSize.Height() = Max( maTextSize.Height(), mrOutDevice.GetTextHeight() );
187*cdf0e10cSrcweir     SetOutDevFont( i18n::ScriptType::COMPLEX );
188*cdf0e10cSrcweir     maTextSize.Height() = Max( maTextSize.Height(), mrOutDevice.GetTextHeight() );
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     mrOutDevice.SetFont( maDefltFont );
191*cdf0e10cSrcweir }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir void SvtScriptedTextHelper_Impl::CalculateBreaks( const uno::Reference< i18n::XBreakIterator >& _xBreakIter )
194*cdf0e10cSrcweir {
195*cdf0e10cSrcweir     maPosVec.clear();
196*cdf0e10cSrcweir     maScriptVec.clear();
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir     DBG_ASSERT( _xBreakIter.is(), "SvtScriptedTextHelper_Impl::CalculateBreaks - no break iterator" );
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     sal_Int32 nLen = maText.getLength();
201*cdf0e10cSrcweir     if( nLen )
202*cdf0e10cSrcweir     {
203*cdf0e10cSrcweir         if( _xBreakIter.is() )
204*cdf0e10cSrcweir         {
205*cdf0e10cSrcweir             sal_Int32 nThisPos = 0;         // first position of this portion
206*cdf0e10cSrcweir             sal_Int32 nNextPos = 0;         // first position of next portion
207*cdf0e10cSrcweir             sal_Int16 nPortScript;          // script type of this portion
208*cdf0e10cSrcweir             do
209*cdf0e10cSrcweir             {
210*cdf0e10cSrcweir                 nPortScript = _xBreakIter->getScriptType( maText, nThisPos );
211*cdf0e10cSrcweir                 nNextPos = _xBreakIter->endOfScript( maText, nThisPos, nPortScript );
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir                 switch( nPortScript )
214*cdf0e10cSrcweir                 {
215*cdf0e10cSrcweir                     case i18n::ScriptType::LATIN:
216*cdf0e10cSrcweir                     case i18n::ScriptType::ASIAN:
217*cdf0e10cSrcweir                     case i18n::ScriptType::COMPLEX:
218*cdf0e10cSrcweir                         maPosVec.push_back( nThisPos );
219*cdf0e10cSrcweir                         maScriptVec.push_back( nPortScript );
220*cdf0e10cSrcweir                     break;
221*cdf0e10cSrcweir                     default:
222*cdf0e10cSrcweir                     {
223*cdf0e10cSrcweir /* *** handling of weak characters ***
224*cdf0e10cSrcweir - first portion is weak: Use OutputDevice::HasGlyphs() to find the correct font
225*cdf0e10cSrcweir - weak portion follows another portion: Script type of preceding portion is used */
226*cdf0e10cSrcweir                         if( maPosVec.empty() )
227*cdf0e10cSrcweir                         {
228*cdf0e10cSrcweir                             sal_Int32 nCharIx = 0;
229*cdf0e10cSrcweir                             sal_Int32 nNextCharIx = 0;
230*cdf0e10cSrcweir                             sal_Int16 nScript;
231*cdf0e10cSrcweir                             do
232*cdf0e10cSrcweir                             {
233*cdf0e10cSrcweir                                 nScript = i18n::ScriptType::LATIN;
234*cdf0e10cSrcweir                                 while( (nScript != i18n::ScriptType::WEAK) && (nCharIx == nNextCharIx) )
235*cdf0e10cSrcweir                                 {
236*cdf0e10cSrcweir                                     nNextCharIx = mrOutDevice.HasGlyphs( GetFont( nScript ), maText, sal::static_int_cast< sal_uInt16 >(nCharIx), sal::static_int_cast< sal_uInt16 >(nNextPos - nCharIx) );
237*cdf0e10cSrcweir                                     if( nCharIx == nNextCharIx )
238*cdf0e10cSrcweir                                         ++nScript;
239*cdf0e10cSrcweir                                 }
240*cdf0e10cSrcweir                                 if( nNextCharIx == nCharIx )
241*cdf0e10cSrcweir                                     ++nNextCharIx;
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir                                 maPosVec.push_back( nCharIx );
244*cdf0e10cSrcweir                                 maScriptVec.push_back( nScript );
245*cdf0e10cSrcweir                                 nCharIx = nNextCharIx;
246*cdf0e10cSrcweir                             }
247*cdf0e10cSrcweir                             while( nCharIx < nNextPos );
248*cdf0e10cSrcweir                         }
249*cdf0e10cSrcweir                         // nothing to do for following portions
250*cdf0e10cSrcweir                     }
251*cdf0e10cSrcweir                 }
252*cdf0e10cSrcweir                 nThisPos = nNextPos;
253*cdf0e10cSrcweir             }
254*cdf0e10cSrcweir             while( (0 <= nThisPos) && (nThisPos < nLen) );
255*cdf0e10cSrcweir         }
256*cdf0e10cSrcweir         else            // no break iterator: whole text LATIN
257*cdf0e10cSrcweir         {
258*cdf0e10cSrcweir             maPosVec.push_back( 0 );
259*cdf0e10cSrcweir             maScriptVec.push_back( i18n::ScriptType::LATIN );
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         // push end position of last portion
263*cdf0e10cSrcweir         if( !maPosVec.empty() )
264*cdf0e10cSrcweir             maPosVec.push_back( nLen );
265*cdf0e10cSrcweir     }
266*cdf0e10cSrcweir     CalculateSizes();
267*cdf0e10cSrcweir }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir void SvtScriptedTextHelper_Impl::SetFonts( Font* _pLatinFont, Font* _pAsianFont, Font* _pCmplxFont )
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir     maLatinFont = _pLatinFont ? *_pLatinFont : maDefltFont;
272*cdf0e10cSrcweir     maAsianFont = _pAsianFont ? *_pAsianFont : maDefltFont;
273*cdf0e10cSrcweir     maCmplxFont = _pCmplxFont ? *_pCmplxFont : maDefltFont;
274*cdf0e10cSrcweir     CalculateSizes();
275*cdf0e10cSrcweir }
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir void SvtScriptedTextHelper_Impl::SetText( const OUString& _rText, const uno::Reference< i18n::XBreakIterator >& _xBreakIter )
278*cdf0e10cSrcweir {
279*cdf0e10cSrcweir     maText = _rText;
280*cdf0e10cSrcweir     CalculateBreaks( _xBreakIter );
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir const OUString& SvtScriptedTextHelper_Impl::GetText() const
284*cdf0e10cSrcweir {
285*cdf0e10cSrcweir     return maText;
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir const Size& SvtScriptedTextHelper_Impl::GetTextSize() const
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir     return maTextSize;
291*cdf0e10cSrcweir }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir void SvtScriptedTextHelper_Impl::DrawText( const Point& _rPos )
294*cdf0e10cSrcweir {
295*cdf0e10cSrcweir     if( !maText.getLength() || maPosVec.empty() )
296*cdf0e10cSrcweir         return;
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir     DBG_ASSERT( maPosVec.size() - 1 == maScriptVec.size(), "SvtScriptedTextHelper_Impl::DrawText - invalid vectors" );
299*cdf0e10cSrcweir     DBG_ASSERT( maScriptVec.size() == maWidthVec.size(), "SvtScriptedTextHelper_Impl::DrawText - invalid vectors" );
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir     maDefltFont = mrOutDevice.GetFont();
302*cdf0e10cSrcweir     Point aCurrPos( _rPos );
303*cdf0e10cSrcweir     xub_StrLen nThisPos = static_cast< xub_StrLen >( maPosVec[ 0 ] );
304*cdf0e10cSrcweir     xub_StrLen nNextPos;
305*cdf0e10cSrcweir     sal_Int32 nPosVecSize = maPosVec.size();
306*cdf0e10cSrcweir     sal_Int32 nPosVecIndex = 1;
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir     sal_Int16 nScript;
309*cdf0e10cSrcweir     sal_Int32 nVecIndex = 0;
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir     while( nPosVecIndex < nPosVecSize )
312*cdf0e10cSrcweir     {
313*cdf0e10cSrcweir         nNextPos = static_cast< xub_StrLen >( maPosVec[ nPosVecIndex++ ] );
314*cdf0e10cSrcweir         nScript = maScriptVec[ nVecIndex ];
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir         SetOutDevFont( nScript );
317*cdf0e10cSrcweir         mrOutDevice.DrawText( aCurrPos, maText, nThisPos, nNextPos - nThisPos );
318*cdf0e10cSrcweir         aCurrPos.X() += maWidthVec[ nVecIndex++ ];
319*cdf0e10cSrcweir         aCurrPos.X() += mrOutDevice.GetTextHeight() / 5;   // add 20% of font height as portion spacing
320*cdf0e10cSrcweir         nThisPos = nNextPos;
321*cdf0e10cSrcweir     }
322*cdf0e10cSrcweir     mrOutDevice.SetFont( maDefltFont );
323*cdf0e10cSrcweir }
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir //_____________________________________________________________________________
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir SvtScriptedTextHelper::SvtScriptedTextHelper( OutputDevice& _rOutDevice ) :
329*cdf0e10cSrcweir     mpImpl( new SvtScriptedTextHelper_Impl( _rOutDevice, NULL, NULL, NULL ) )
330*cdf0e10cSrcweir {
331*cdf0e10cSrcweir }
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir SvtScriptedTextHelper::SvtScriptedTextHelper(
334*cdf0e10cSrcweir         OutputDevice& _rOutDevice,
335*cdf0e10cSrcweir         Font* _pLatinFont, Font* _pAsianFont, Font* _pCmplxFont ) :
336*cdf0e10cSrcweir     mpImpl( new SvtScriptedTextHelper_Impl( _rOutDevice, _pLatinFont, _pAsianFont, _pCmplxFont ) )
337*cdf0e10cSrcweir {
338*cdf0e10cSrcweir }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir SvtScriptedTextHelper::SvtScriptedTextHelper( const SvtScriptedTextHelper& _rCopy ) :
341*cdf0e10cSrcweir     mpImpl( new SvtScriptedTextHelper_Impl( *_rCopy.mpImpl ) )
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir SvtScriptedTextHelper::~SvtScriptedTextHelper()
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir     delete mpImpl;
348*cdf0e10cSrcweir }
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir void SvtScriptedTextHelper::SetFonts( Font* _pLatinFont, Font* _pAsianFont, Font* _pCmplxFont )
351*cdf0e10cSrcweir {
352*cdf0e10cSrcweir     mpImpl->SetFonts( _pLatinFont, _pAsianFont, _pCmplxFont );
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir void SvtScriptedTextHelper::SetDefaultFont()
356*cdf0e10cSrcweir {
357*cdf0e10cSrcweir     mpImpl->SetFonts( NULL, NULL, NULL );
358*cdf0e10cSrcweir }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir void SvtScriptedTextHelper::SetText( const OUString& _rText, const uno::Reference< i18n::XBreakIterator >& _xBreakIter )
361*cdf0e10cSrcweir {
362*cdf0e10cSrcweir     mpImpl->SetText( _rText, _xBreakIter );
363*cdf0e10cSrcweir }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir const OUString& SvtScriptedTextHelper::GetText() const
366*cdf0e10cSrcweir {
367*cdf0e10cSrcweir     return mpImpl->GetText();
368*cdf0e10cSrcweir }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir sal_Int32 SvtScriptedTextHelper::GetTextWidth() const
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir     return mpImpl->GetTextSize().Width();
373*cdf0e10cSrcweir }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir sal_Int32 SvtScriptedTextHelper::GetTextHeight() const
376*cdf0e10cSrcweir {
377*cdf0e10cSrcweir     return mpImpl->GetTextSize().Height();
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir const Size& SvtScriptedTextHelper::GetTextSize() const
381*cdf0e10cSrcweir {
382*cdf0e10cSrcweir     return mpImpl->GetTextSize();
383*cdf0e10cSrcweir }
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir void SvtScriptedTextHelper::DrawText( const Point& _rPos )
386*cdf0e10cSrcweir {
387*cdf0e10cSrcweir     mpImpl->DrawText( _rPos );
388*cdf0e10cSrcweir }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir //_____________________________________________________________________________
392*cdf0e10cSrcweir 
393