merge the formfield patch from ooo-build
[ooovba.git] / svtools / inc / scriptedtext.hxx
blobb515badb131664c0a91d34f610475c2b66f4e267
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scriptedtext.hxx,v $
10 * $Revision: 1.5 $
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; }
40 class OutputDevice;
41 class Font;
42 class SvtScriptedTextHelper_Impl;
45 //_____________________________________________________________________________
47 /**
48 This class provides drawing text with different script types on any output devices.
50 class SVT_DLLPUBLIC SvtScriptedTextHelper
52 private:
53 SvtScriptedTextHelper_Impl* mpImpl; /// Implementation of class functionality.
55 /** Assignment operator not implemented to prevent usage. */
56 SvtScriptedTextHelper& operator=( const SvtScriptedTextHelper& );
58 public:
59 /** Constructor sets an output device and no fonts.
60 @param _rOutDevice
61 A reference to an output device. */
62 SvtScriptedTextHelper( OutputDevice& _rOutDevice );
64 /** Constructor sets an output device and fonts for all script types.
65 @param _rOutDevice
66 A reference to an output device.
67 @param _pLatinFont
68 The font for latin characters.
69 @param _pAsianFont
70 The font for asian characters.
71 @param _pCmplxFont
72 The font for complex text layout. */
73 SvtScriptedTextHelper(
74 OutputDevice& _rOutDevice,
75 Font* _pLatinFont,
76 Font* _pAsianFont,
77 Font* _pCmplxFont );
79 /** Copy constructor. */
80 SvtScriptedTextHelper(
81 const SvtScriptedTextHelper& _rCopy );
83 /** Destructor. */
84 virtual ~SvtScriptedTextHelper();
86 /** Sets new fonts and recalculates the text width.
87 @param _pLatinFont
88 The font for latin characters.
89 @param _pAsianFont
90 The font for asian characters.
91 @param _pCmplxFont
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.
99 @param _rText
100 The new text.
101 @param _xBreakIter
102 The break iterator for iterating through the script portions. */
103 void SetText(
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.
124 @param _rPos
125 The position of the top left edge of the text. */
126 void DrawText( const Point& _rPos );
129 //_____________________________________________________________________________
131 #endif