LibreOffice Module svtools (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SvtScriptedTextHelper_Impl Class Reference
Collaboration diagram for SvtScriptedTextHelper_Impl:
[legend]

Public Member Functions

 SvtScriptedTextHelper_Impl (OutputDevice &_rOutDevice)
 This constructor sets an output device and fonts for all script types. More...
 
void SetFonts (vcl::Font const *_pLatinFont, vcl::Font const *_pAsianFont, vcl::Font const *_pCmplxFont)
 Sets new fonts and recalculates the text width. More...
 
void SetText (const OUString &_rText, const uno::Reference< i18n::XBreakIterator > &_xBreakIter)
 Sets a new text and calculates all script breaks and the text width. More...
 
const SizeGetTextSize () const
 Returns a size struct containing the width and height of the text in the current output device. More...
 
void DrawText (const Point &_rPos)
 Draws the text in the current output device. More...
 

Private Member Functions

const vcl::FontGetFont (sal_uInt16 _nScript) const
 The size the text will take in the current output device. More...
 
void SetOutDevFont (sal_uInt16 _nScript)
 Sets a font on the output device depending on the script type. More...
 
void CalculateSizes ()
 Fills maPosVec with positions of all changes of script type. More...
 
void CalculateBreaks (const uno::Reference< i18n::XBreakIterator > &_xBreakIter)
 Fills maPosVec with positions of all changes of script type and maScriptVec with the script type of each portion. More...
 

Private Attributes

OutputDevicemrOutDevice
 
vcl::Font maLatinFont
 The output device for drawing the text. More...
 
vcl::Font maAsianFont
 The font for latin text portions. More...
 
vcl::Font maCmplxFont
 The font for asian text portions. More...
 
vcl::Font maDefltFont
 The font for complex text portions. More...
 
OUString maText
 The default font of the output device. More...
 
std::vector< sal_Int32 > maPosVec
 The text. More...
 
std::vector< sal_Int16 > maScriptVec
 The start position of each text portion. More...
 
std::vector< sal_Int32 > maWidthVec
 The script type of each text portion. More...
 
Size maTextSize
 The output width of each text portion. More...
 

Detailed Description

Definition at line 34 of file scriptedtext.cxx.

Constructor & Destructor Documentation

◆ SvtScriptedTextHelper_Impl()

SvtScriptedTextHelper_Impl::SvtScriptedTextHelper_Impl ( OutputDevice _rOutDevice)
explicit

This constructor sets an output device and fonts for all script types.

Definition at line 82 of file scriptedtext.cxx.

References GetFont().

Member Function Documentation

◆ CalculateBreaks()

void SvtScriptedTextHelper_Impl::CalculateBreaks ( const uno::Reference< i18n::XBreakIterator > &  _xBreakIter)
private

Fills maPosVec with positions of all changes of script type and maScriptVec with the script type of each portion.

Definition at line 150 of file scriptedtext.cxx.

References CalculateSizes(), DBG_ASSERT, GetFont(), OutputDevice::HasGlyphs(), maPosVec, maScriptVec, maText, and mrOutDevice.

Referenced by SetText().

◆ CalculateSizes()

void SvtScriptedTextHelper_Impl::CalculateSizes ( )
private

Fills maPosVec with positions of all changes of script type.

This method expects correctly initialized maPosVec and maScriptVec.

Definition at line 103 of file scriptedtext.cxx.

References Size::AdjustWidth(), DBG_ASSERT, vcl::FONT, OutputDevice::GetTextHeight(), OutputDevice::GetTextWidth(), Size::Height(), maPosVec, maScriptVec, maText, maTextSize, maWidthVec, mrOutDevice, OutputDevice::Pop(), OutputDevice::Push(), Size::setHeight(), SetOutDevFont(), Size::setWidth(), and vcl::TEXTCOLOR.

Referenced by CalculateBreaks(), and SetFonts().

◆ DrawText()

void SvtScriptedTextHelper_Impl::DrawText ( const Point _rPos)

◆ GetFont()

const vcl::Font & SvtScriptedTextHelper_Impl::GetFont ( sal_uInt16  _nScript) const
private

The size the text will take in the current output device.

Gets the font of the given script type.

Definition at line 92 of file scriptedtext.cxx.

References maAsianFont, maCmplxFont, maDefltFont, and maLatinFont.

Referenced by CalculateBreaks(), DrawText(), and SetOutDevFont().

◆ GetTextSize()

const Size & SvtScriptedTextHelper_Impl::GetTextSize ( ) const
inline

Returns a size struct containing the width and height of the text in the current output device.

Definition at line 75 of file scriptedtext.cxx.

References maTextSize.

◆ SetFonts()

void SvtScriptedTextHelper_Impl::SetFonts ( vcl::Font const *  _pLatinFont,
vcl::Font const *  _pAsianFont,
vcl::Font const *  _pCmplxFont 
)

Sets new fonts and recalculates the text width.

Definition at line 226 of file scriptedtext.cxx.

References CalculateSizes(), maAsianFont, maCmplxFont, maDefltFont, and maLatinFont.

◆ SetOutDevFont()

void SvtScriptedTextHelper_Impl::SetOutDevFont ( sal_uInt16  _nScript)
inlineprivate

Sets a font on the output device depending on the script type.

Definition at line 52 of file scriptedtext.cxx.

References GetFont(), mrOutDevice, and OutputDevice::SetFont().

Referenced by CalculateSizes().

◆ SetText()

void SvtScriptedTextHelper_Impl::SetText ( const OUString &  _rText,
const uno::Reference< i18n::XBreakIterator > &  _xBreakIter 
)

Sets a new text and calculates all script breaks and the text width.

Definition at line 234 of file scriptedtext.cxx.

References CalculateBreaks(), and maText.

Member Data Documentation

◆ maAsianFont

vcl::Font SvtScriptedTextHelper_Impl::maAsianFont
private

The font for latin text portions.

Definition at line 39 of file scriptedtext.cxx.

Referenced by GetFont(), and SetFonts().

◆ maCmplxFont

vcl::Font SvtScriptedTextHelper_Impl::maCmplxFont
private

The font for asian text portions.

Definition at line 40 of file scriptedtext.cxx.

Referenced by GetFont(), and SetFonts().

◆ maDefltFont

vcl::Font SvtScriptedTextHelper_Impl::maDefltFont
private

The font for complex text portions.

Definition at line 41 of file scriptedtext.cxx.

Referenced by GetFont(), and SetFonts().

◆ maLatinFont

vcl::Font SvtScriptedTextHelper_Impl::maLatinFont
private

The output device for drawing the text.

Definition at line 38 of file scriptedtext.cxx.

Referenced by GetFont(), and SetFonts().

◆ maPosVec

std::vector< sal_Int32 > SvtScriptedTextHelper_Impl::maPosVec
private

The text.

Definition at line 44 of file scriptedtext.cxx.

Referenced by CalculateBreaks(), CalculateSizes(), and DrawText().

◆ maScriptVec

std::vector< sal_Int16 > SvtScriptedTextHelper_Impl::maScriptVec
private

The start position of each text portion.

Definition at line 45 of file scriptedtext.cxx.

Referenced by CalculateBreaks(), CalculateSizes(), and DrawText().

◆ maText

OUString SvtScriptedTextHelper_Impl::maText
private

The default font of the output device.

Definition at line 42 of file scriptedtext.cxx.

Referenced by CalculateBreaks(), CalculateSizes(), DrawText(), and SetText().

◆ maTextSize

Size SvtScriptedTextHelper_Impl::maTextSize
private

The output width of each text portion.

Definition at line 47 of file scriptedtext.cxx.

Referenced by CalculateSizes(), and GetTextSize().

◆ maWidthVec

std::vector< sal_Int32 > SvtScriptedTextHelper_Impl::maWidthVec
private

The script type of each text portion.

Definition at line 46 of file scriptedtext.cxx.

Referenced by CalculateSizes(), and DrawText().

◆ mrOutDevice

OutputDevice& SvtScriptedTextHelper_Impl::mrOutDevice
private

Definition at line 37 of file scriptedtext.cxx.

Referenced by CalculateBreaks(), CalculateSizes(), DrawText(), and SetOutDevFont().


The documentation for this class was generated from the following file: