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