LibreOffice Module svtools (master) 1
|
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 Size & | GetTextSize () 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::Font & | GetFont (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 | |
OutputDevice & | mrOutDevice |
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... | |
Definition at line 34 of file scriptedtext.cxx.
|
explicit |
This constructor sets an output device and fonts for all script types.
Definition at line 82 of file scriptedtext.cxx.
References GetFont().
|
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().
|
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().
void SvtScriptedTextHelper_Impl::DrawText | ( | const Point & | _rPos | ) |
Draws the text in the current output device.
Definition at line 241 of file scriptedtext.cxx.
References Point::AdjustX(), COL_AUTO(), COL_BLACK(), COL_WHITE(), DBG_ASSERT, OutputDevice::DrawText(), vcl::FONT, vcl::Font::GetColor(), OutputDevice::GetFillColor(), GetFont(), OutputDevice::GetTextHeight(), Color::IsDark(), maPosVec, maScriptVec, maText, maWidthVec, mrOutDevice, OutputDevice::Pop(), OutputDevice::Push(), OutputDevice::SetFont(), OutputDevice::SetTextColor(), and vcl::TEXTCOLOR.
|
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().
|
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.
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.
|
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().
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.
|
private |
The font for latin text portions.
Definition at line 39 of file scriptedtext.cxx.
Referenced by GetFont(), and SetFonts().
|
private |
The font for asian text portions.
Definition at line 40 of file scriptedtext.cxx.
Referenced by GetFont(), and SetFonts().
|
private |
The font for complex text portions.
Definition at line 41 of file scriptedtext.cxx.
Referenced by GetFont(), and SetFonts().
|
private |
The output device for drawing the text.
Definition at line 38 of file scriptedtext.cxx.
Referenced by GetFont(), and SetFonts().
|
private |
The text.
Definition at line 44 of file scriptedtext.cxx.
Referenced by CalculateBreaks(), CalculateSizes(), and DrawText().
|
private |
The start position of each text portion.
Definition at line 45 of file scriptedtext.cxx.
Referenced by CalculateBreaks(), CalculateSizes(), and DrawText().
|
private |
The default font of the output device.
Definition at line 42 of file scriptedtext.cxx.
Referenced by CalculateBreaks(), CalculateSizes(), DrawText(), and SetText().
|
private |
The output width of each text portion.
Definition at line 47 of file scriptedtext.cxx.
Referenced by CalculateSizes(), and GetTextSize().
|
private |
The script type of each text portion.
Definition at line 46 of file scriptedtext.cxx.
Referenced by CalculateSizes(), and DrawText().
|
private |
Definition at line 37 of file scriptedtext.cxx.
Referenced by CalculateBreaks(), CalculateSizes(), DrawText(), and SetOutDevFont().