1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scriptedtext.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVTOOLS_SCRIPTEDTEXT_HXX
32 #define _SVTOOLS_SCRIPTEDTEXT_HXX
34 #include "svtools/svtdllapi.h"
35 #include <tools/gen.hxx>
36 #include <com/sun/star/i18n/XBreakIterator.hpp>
39 namespace rtl
{ class OUString
; }
42 class SvtScriptedTextHelper_Impl
;
45 //_____________________________________________________________________________
48 This class provides drawing text with different script types on any output devices.
50 class SVT_DLLPUBLIC SvtScriptedTextHelper
53 SvtScriptedTextHelper_Impl
* mpImpl
; /// Implementation of class functionality.
55 /** Assignment operator not implemented to prevent usage. */
56 SvtScriptedTextHelper
& operator=( const SvtScriptedTextHelper
& );
59 /** Constructor sets an output device and no fonts.
61 A reference to an output device. */
62 SvtScriptedTextHelper( OutputDevice
& _rOutDevice
);
64 /** Constructor sets an output device and fonts for all script types.
66 A reference to an output device.
68 The font for latin characters.
70 The font for asian characters.
72 The font for complex text layout. */
73 SvtScriptedTextHelper(
74 OutputDevice
& _rOutDevice
,
79 /** Copy constructor. */
80 SvtScriptedTextHelper(
81 const SvtScriptedTextHelper
& _rCopy
);
84 virtual ~SvtScriptedTextHelper();
86 /** Sets new fonts and recalculates the text width.
88 The font for latin characters.
90 The font for asian characters.
92 The font for complex text layout. */
93 void SetFonts( Font
* _pLatinFont
, Font
* _pAsianFont
, Font
* _pCmplxFont
);
95 /** Sets the default font of the current output device to all script types. */
96 void SetDefaultFont();
98 /** Sets a new text and calculates all script breaks and the text width.
102 The break iterator for iterating through the script portions. */
104 const ::rtl::OUString
& _rText
,
105 const ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XBreakIterator
>& _xBreakIter
);
107 /** Returns the previously set text.
108 @return The current text. */
109 const ::rtl::OUString
& GetText() const;
111 /** Returns the calculated width the text will take in the current output device.
112 @return The calculated text width. */
113 sal_Int32
GetTextWidth() const;
115 /** Returns the maximum height the text will take in the current output device.
116 @return The maximum text height. */
117 sal_Int32
GetTextHeight() const;
119 /** Returns a size struct containing the width and height of the text in the current output device.
120 @return A size struct with the text dimensions. */
121 const Size
& GetTextSize() const;
123 /** Draws the text in the current output device.
125 The position of the top left edge of the text. */
126 void DrawText( const Point
& _rPos
);
129 //_____________________________________________________________________________