diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-18 13:36:39 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-20 09:52:08 +0200 |
commit | 25a47c5cd54c73e754de988bde8ec8a202d27717 (patch) | |
tree | 479c07ba52f718f03770fba60121d2a0ef3a3b08 /vcl | |
parent | 7a0af37989d1f1b508a61f28e785c5b1f27d58af (diff) |
convert TEXT_DRAW constants to scoped enum
Change-Id: Ic0f7f8fa236bb478b3598ae3fd3c1b30ebbf1a01
Diffstat (limited to 'vcl')
26 files changed, 227 insertions, 225 deletions
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index f019b699932e..bceba393ec53 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -359,7 +359,7 @@ public: void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; } bool IsReadOnly() const { return mbReadOnly; } - sal_uInt16 ImplGetTextStyle() const; + DrawTextFlags ImplGetTextStyle() const; /// pb: #106948# explicit mirroring for calc inline void EnableMirroring() { mbMirroring = true; } diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx index 3510df221a66..6b86aafc422a 100644 --- a/vcl/inc/textlayout.hxx +++ b/vcl/inc/textlayout.hxx @@ -93,7 +93,7 @@ namespace vcl virtual ~ControlTextRenderer(); Rectangle DrawText( const Rectangle& _rRect, - const OUString& _rText, sal_uInt16 _nStyle = 0, + const OUString& _rText, DrawTextFlags _nStyle = DrawTextFlags::NONE, MetricVector* _pVector = NULL, OUString* _pDisplayText = NULL ); private: diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index cc346f4e1fd7..7014a790f789 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -332,10 +332,10 @@ void HelpTextWindow::SetHelpText( const OUString& rHelpText ) long nWidth = GetTextWidth( aXXX ); Size aTmpSize( nWidth, 0x7FFFFFFF ); Rectangle aTry1( aTmpPoint, aTmpSize ); - sal_uInt16 nDrawFlags = TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK | - TEXT_DRAW_LEFT | TEXT_DRAW_TOP; + DrawTextFlags nDrawFlags = DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | + DrawTextFlags::Left | DrawTextFlags::Top; if ( mnStyle & QuickHelpFlags::CtrlText ) - nDrawFlags |= TEXT_DRAW_MNEMONIC; + nDrawFlags |= DrawTextFlags::Mnemonic; Rectangle aTextRect = GetTextRect( aTry1, maHelpText, nDrawFlags ); // get a better width later... @@ -380,10 +380,10 @@ void HelpTextWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& } else // HELPWINSTYLE_BALLOON { - sal_uInt16 nDrawFlags = TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK| - TEXT_DRAW_LEFT|TEXT_DRAW_TOP; + DrawTextFlags nDrawFlags = DrawTextFlags::MultiLine|DrawTextFlags::WordBreak| + DrawTextFlags::Left|DrawTextFlags::Top; if (mnStyle & QuickHelpFlags::CtrlText) - nDrawFlags |= TEXT_DRAW_MNEMONIC; + nDrawFlags |= DrawTextFlags::Mnemonic; rRenderContext.DrawText(maTextRect, maHelpText, nDrawFlags); } diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index fac1562bc2e7..f66067237494 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -207,30 +207,30 @@ void Button::ImplSetSeparatorX( long nX ) mpButtonData->mnSeparatorX = nX; } -sal_uInt16 Button::ImplGetTextStyle( OUString& rText, WinBits nWinStyle, +DrawTextFlags Button::ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags ) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle & ~WB_DEFBUTTON ); + DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle( nWinStyle & ~WB_DEFBUTTON ); if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) { - if ( nTextStyle & TEXT_DRAW_MNEMONIC ) + if ( nTextStyle & DrawTextFlags::Mnemonic ) { rText = GetNonMnemonicString( rText ); - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; } } if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) { if ( !IsEnabled() ) - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; } if ( (nDrawFlags & WINDOW_DRAW_MONO) || (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) - nTextStyle |= TEXT_DRAW_MONO; + nTextStyle |= DrawTextFlags::Mono; return nTextStyle; } @@ -238,7 +238,7 @@ sal_uInt16 Button::ImplGetTextStyle( OUString& rText, WinBits nWinStyle, void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, bool bLayout, sal_uLong nImageSep, sal_uLong nDrawFlags, - sal_uInt16 nTextStyle, Rectangle *pSymbolRect, + DrawTextFlags nTextStyle, Rectangle *pSymbolRect, bool bAddImageSep ) { OUString aText( GetText() ); @@ -258,10 +258,10 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size aImageSize = mpButtonData->maImage.GetSizePixel(); if ( ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) && - ( nTextStyle & TEXT_DRAW_MNEMONIC ) ) + ( nTextStyle & DrawTextFlags::Mnemonic ) ) { aText = GetNonMnemonicString( aText ); - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; } aImageSize.Width() = CalcZoom( aImageSize.Width() ); @@ -736,37 +736,37 @@ bool PushButton::ImplHitTestPushButton( vcl::Window* pDev, return aTestRect.IsInside( rPos ); } -sal_uInt16 PushButton::ImplGetTextStyle( sal_uLong nDrawFlags ) const +DrawTextFlags PushButton::ImplGetTextStyle( sal_uLong nDrawFlags ) const { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_MULTILINE | TEXT_DRAW_ENDELLIPSIS; + DrawTextFlags nTextStyle = DrawTextFlags::Mnemonic | DrawTextFlags::MultiLine | DrawTextFlags::EndEllipsis; if ( ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) || ( nDrawFlags & WINDOW_DRAW_MONO ) ) - nTextStyle |= TEXT_DRAW_MONO; + nTextStyle |= DrawTextFlags::Mono; if ( GetStyle() & WB_WORDBREAK ) - nTextStyle |= TEXT_DRAW_WORDBREAK; + nTextStyle |= DrawTextFlags::WordBreak; if ( GetStyle() & WB_NOLABEL ) - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; if ( GetStyle() & WB_LEFT ) - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; else if ( GetStyle() & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; + nTextStyle |= DrawTextFlags::Right; else - nTextStyle |= TEXT_DRAW_CENTER; + nTextStyle |= DrawTextFlags::Center; if ( GetStyle() & WB_TOP ) - nTextStyle |= TEXT_DRAW_TOP; + nTextStyle |= DrawTextFlags::Top; else if ( GetStyle() & WB_BOTTOM ) - nTextStyle |= TEXT_DRAW_BOTTOM; + nTextStyle |= DrawTextFlags::Bottom; else - nTextStyle |= TEXT_DRAW_VCENTER; + nTextStyle |= DrawTextFlags::VCenter; if ( ! ( (nDrawFlags & WINDOW_DRAW_NODISABLE) || IsEnabled() ) ) - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; return nTextStyle; } @@ -804,7 +804,7 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, sal_uLong nDrawFl Rectangle aInRect = rRect; Color aColor; OUString aText = PushButton::GetText(); // PushButton:: because of MoreButton - sal_uInt16 nTextStyle = ImplGetTextStyle( nDrawFlags ); + DrawTextFlags nTextStyle = ImplGetTextStyle( nDrawFlags ); DrawSymbolFlags nStyle; if( aInRect.Right() < aInRect.Left() || aInRect.Bottom() < aInRect.Top() ) @@ -2002,7 +2002,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) || ( HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) ) ) { - sal_uInt16 nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + DrawTextFlags nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); @@ -2015,8 +2015,8 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, if( (nWinStyle & (WB_TOP|WB_VCENTER|WB_BOTTOM)) == 0 && (rImageSize.Height() > rSize.Height() || ! (nWinStyle & WB_WORDBREAK) ) ) { - nTextStyle &= ~(TEXT_DRAW_TOP|TEXT_DRAW_BOTTOM); - nTextStyle |= TEXT_DRAW_VCENTER; + nTextStyle &= ~DrawTextFlags(DrawTextFlags::Top|DrawTextFlags::Bottom); + nTextStyle |= DrawTextFlags::VCenter; aSize.Height() = rImageSize.Height(); } @@ -2109,7 +2109,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, aTxtPos.X() += aImageRect.Right()+8; aTxtPos.Y() += (rSize.Height()-nTextHeight)/2; } - pDev->DrawCtrlText( aTxtPos, aText, 0, aText.getLength(), TEXT_DRAW_MNEMONIC, pVector, pDisplayText ); + pDev->DrawCtrlText( aTxtPos, aText, 0, aText.getLength(), DrawTextFlags::Mnemonic, pVector, pDisplayText ); } rMouseRect = aImageRect; @@ -3077,7 +3077,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) || ( HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) ) ) { - sal_uInt16 nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + DrawTextFlags nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); @@ -3090,8 +3090,8 @@ void CheckBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, if( (nWinStyle & (WB_TOP|WB_VCENTER|WB_BOTTOM)) == 0 && (rImageSize.Height() > rSize.Height() || ! (nWinStyle & WB_WORDBREAK) ) ) { - nTextStyle &= ~(TEXT_DRAW_TOP|TEXT_DRAW_BOTTOM); - nTextStyle |= TEXT_DRAW_VCENTER; + nTextStyle &= ~DrawTextFlags(DrawTextFlags::Top|DrawTextFlags::Bottom); + nTextStyle |= DrawTextFlags::VCenter; aSize.Height() = rImageSize.Height(); } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 787d3b2ad9ed..b30317ff816e 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1169,18 +1169,18 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, s long nOnePixel = GetDrawPixel( pDev, 1 ); long nTextHeight = pDev->GetTextHeight(); long nEditHeight = nTextHeight + 6*nOnePixel; - sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; + DrawTextFlags nTextStyle = DrawTextFlags::VCenter; // First, draw the edit part mpSubEdit->Draw( pDev, aPos, Size( aSize.Width(), nEditHeight ), nFlags ); // Second, draw the listbox if ( GetStyle() & WB_CENTER ) - nTextStyle |= TEXT_DRAW_CENTER; + nTextStyle |= DrawTextFlags::Center; else if ( GetStyle() & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; + nTextStyle |= DrawTextFlags::Right; else - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) ) { diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index a0aa05a6031b..38aa4168847a 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -450,7 +450,7 @@ void Control::ImplInitSettings( const bool _bFont, const bool _bForeground ) } void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr, - sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) const + DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) const { if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) ) { diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 19988dfc7bf5..edeb7baeac54 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -157,33 +157,33 @@ FixedText::FixedText( vcl::Window* pParent, const ResId& rResId ) Show(); } -sal_uInt16 FixedText::ImplGetTextStyle( WinBits nWinStyle ) +DrawTextFlags FixedText::ImplGetTextStyle( WinBits nWinStyle ) { - sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_ENDELLIPSIS; + DrawTextFlags nTextStyle = DrawTextFlags::Mnemonic | DrawTextFlags::EndEllipsis; if( ! (nWinStyle & WB_NOMULTILINE) ) - nTextStyle |= TEXT_DRAW_MULTILINE; + nTextStyle |= DrawTextFlags::MultiLine; if ( nWinStyle & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; + nTextStyle |= DrawTextFlags::Right; else if ( nWinStyle & WB_CENTER ) - nTextStyle |= TEXT_DRAW_CENTER; + nTextStyle |= DrawTextFlags::Center; else - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; if ( nWinStyle & WB_BOTTOM ) - nTextStyle |= TEXT_DRAW_BOTTOM; + nTextStyle |= DrawTextFlags::Bottom; else if ( nWinStyle & WB_VCENTER ) - nTextStyle |= TEXT_DRAW_VCENTER; + nTextStyle |= DrawTextFlags::VCenter; else - nTextStyle |= TEXT_DRAW_TOP; + nTextStyle |= DrawTextFlags::Top; if ( nWinStyle & WB_WORDBREAK ) { - nTextStyle |= TEXT_DRAW_WORDBREAK; + nTextStyle |= DrawTextFlags::WordBreak; if ( (nWinStyle & WB_HYPHENATION ) == WB_HYPHENATION ) - nTextStyle |= TEXT_DRAW_WORDBREAK_HYPHENATION; + nTextStyle |= DrawTextFlags::WordBreakHyphenation; } if ( nWinStyle & WB_NOLABEL ) - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; return nTextStyle; } @@ -195,7 +195,7 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags, const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); OUString aText(GetText()); - sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); + DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); Point aPos = rPos; if ( nWinStyle & WB_EXTRAOFFSET ) @@ -203,25 +203,25 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags, if ( nWinStyle & WB_PATHELLIPSIS ) { - nTextStyle &= ~(TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK); - nTextStyle |= TEXT_DRAW_PATHELLIPSIS; + nTextStyle &= ~DrawTextFlags(DrawTextFlags::EndEllipsis | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak); + nTextStyle |= DrawTextFlags::PathEllipsis; } if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) { - if ( nTextStyle & TEXT_DRAW_MNEMONIC ) + if ( nTextStyle & DrawTextFlags::Mnemonic ) { aText = GetNonMnemonicString( aText ); - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; } } if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) { if ( !IsEnabled() ) - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; } if ( (nDrawFlags & WINDOW_DRAW_MONO) || (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) - nTextStyle |= TEXT_DRAW_MONO; + nTextStyle |= DrawTextFlags::Mono; if( bFillLayout ) (mpControlData->mpLayoutData->m_aDisplayText).clear(); @@ -336,9 +336,9 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) Size FixedText::getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth) { - sal_uInt16 nStyle = ImplGetTextStyle( pControl->GetStyle() ); + DrawTextFlags nStyle = ImplGetTextStyle( pControl->GetStyle() ); if ( !( pControl->GetStyle() & WB_NOLABEL ) ) - nStyle |= TEXT_DRAW_MNEMONIC; + nStyle |= DrawTextFlags::Mnemonic; return pControl->GetTextRect(Rectangle( Point(), Size(nMaxWidth, 0x7fffffff)), rTxt, nStyle).GetSize(); @@ -589,18 +589,18 @@ void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) } else { - sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; + DrawTextFlags nStyle = DrawTextFlags::Mnemonic | DrawTextFlags::Left | DrawTextFlags::VCenter | DrawTextFlags::EndEllipsis; Rectangle aRect(0, 0, aOutSize.Width(), aOutSize.Height()); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); if (nWinStyle & WB_CENTER) - nStyle |= TEXT_DRAW_CENTER; + nStyle |= DrawTextFlags::Center; if (!IsEnabled()) - nStyle |= TEXT_DRAW_DISABLE; + nStyle |= DrawTextFlags::Disable; if (GetStyle() & WB_NOLABEL) - nStyle &= ~TEXT_DRAW_MNEMONIC; + nStyle &= ~DrawTextFlags::Mnemonic; if (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) - nStyle |= TEXT_DRAW_MONO; + nStyle |= DrawTextFlags::Mono; DrawControlText(*this, aRect, aText, nStyle, pVector, pDisplayText); diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx index 9d6de9fe488a..e1d871849553 100644 --- a/vcl/source/control/group.cxx +++ b/vcl/source/control/group.cxx @@ -100,27 +100,27 @@ void GroupBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); OUString aText( GetText() ); Rectangle aRect( rPos, rSize ); - sal_uInt16 nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MNEMONIC; + DrawTextFlags nTextStyle = DrawTextFlags::Left | DrawTextFlags::Top | DrawTextFlags::EndEllipsis | DrawTextFlags::Mnemonic; if ( GetStyle() & WB_NOLABEL ) - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) { - if ( nTextStyle & TEXT_DRAW_MNEMONIC ) + if ( nTextStyle & DrawTextFlags::Mnemonic ) { aText = GetNonMnemonicString( aText ); - nTextStyle &= ~TEXT_DRAW_MNEMONIC; + nTextStyle &= ~DrawTextFlags::Mnemonic; } } if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) { if ( !IsEnabled() ) - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; } if ( (nDrawFlags & WINDOW_DRAW_MONO) || (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) { - nTextStyle |= TEXT_DRAW_MONO; + nTextStyle |= DrawTextFlags::Mono; nDrawFlags |= WINDOW_DRAW_MONO; } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 40bba26acc1c..47bf65fccd59 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -43,7 +43,7 @@ #include <limits> -#define MULTILINE_ENTRY_DRAW_FLAGS ( TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_VCENTER ) +#define MULTILINE_ENTRY_DRAW_FLAGS ( DrawTextFlags::WordBreak | DrawTextFlags::MultiLine | DrawTextFlags::VCenter ) using namespace ::com::sun::star; @@ -661,7 +661,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) // GetTextRect should shrink it to the actual size aCurSize.Height() = 0x7fffff; Rectangle aTextRect( Point( 0, 0 ), aCurSize ); - aTextRect = GetTextRect( aTextRect, rEntry.maStr, TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE ); + aTextRect = GetTextRect( aTextRect, rEntry.maStr, DrawTextFlags::WordBreak | DrawTextFlags::MultiLine ); aMetrics.nTextWidth = aTextRect.GetWidth(); if( aMetrics.nTextWidth > mnMaxTxtWidth ) mnMaxTxtWidth = aMetrics.nTextWidth; @@ -1864,11 +1864,11 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 aTextRect.Left() -= (aImgSz.Width() + IMG_TXT_DISTANCE); } - sal_uInt16 nDrawStyle = ImplGetTextStyle(); + DrawTextFlags nDrawStyle = ImplGetTextStyle(); if ((pEntry->mnFlags & ListBoxEntryFlags::MultiLine)) nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS; if ((pEntry->mnFlags & ListBoxEntryFlags::DrawDisabled)) - nDrawStyle |= TEXT_DRAW_DISABLE; + nDrawStyle |= DrawTextFlags::Disable; rRenderContext.DrawText(aTextRect, aStr, nDrawStyle, pVector, pDisplayText); } @@ -2137,18 +2137,18 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) } } -sal_uInt16 ImplListBoxWindow::ImplGetTextStyle() const +DrawTextFlags ImplListBoxWindow::ImplGetTextStyle() const { - sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; + DrawTextFlags nTextStyle = DrawTextFlags::VCenter; if (mpEntryList->HasImages()) - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; else if (mbCenter) - nTextStyle |= TEXT_DRAW_CENTER; + nTextStyle |= DrawTextFlags::Center; else if (mbRight) - nTextStyle |= TEXT_DRAW_RIGHT; + nTextStyle |= DrawTextFlags::Right; else - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; return nTextStyle; } @@ -2884,16 +2884,16 @@ void ImplWin::DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImageP if( bDrawText && !maString.isEmpty() ) { - sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; + DrawTextFlags nTextStyle = DrawTextFlags::VCenter; if ( bDrawImage && bImage && !bLayout ) - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; else if ( GetStyle() & WB_CENTER ) - nTextStyle |= TEXT_DRAW_CENTER; + nTextStyle |= DrawTextFlags::Center; else if ( GetStyle() & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; + nTextStyle |= DrawTextFlags::Right; else - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; Rectangle aTextRect( Point( nBorder, 0 ), Size( aOutSz.Width()-2*nBorder, aOutSz.Height() ) ); diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 9050a9bd86c6..1ba4fcbf535b 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -86,10 +86,10 @@ void ImageControl::ImplDraw(OutputDevice& rDev, sal_uLong nDrawFlags, const Poin return; WinBits nWinStyle = GetStyle(); - sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); + DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) if ( !IsEnabled() ) - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; rDev.DrawText( aDrawRect, sText, nTextStyle ); return; diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 9f582144e0c0..3a4d63317692 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -421,15 +421,15 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sa } long nOnePixel = GetDrawPixel( pDev, 1 ); - sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER; + DrawTextFlags nTextStyle = DrawTextFlags::VCenter; Rectangle aTextRect( aPos, aSize ); if ( GetStyle() & WB_CENTER ) - nTextStyle |= TEXT_DRAW_CENTER; + nTextStyle |= DrawTextFlags::Center; else if ( GetStyle() & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; + nTextStyle |= DrawTextFlags::Right; else - nTextStyle |= TEXT_DRAW_LEFT; + nTextStyle |= DrawTextFlags::Left; aTextRect.Left() += 3*nOnePixel; aTextRect.Right() -= 3*nOnePixel; diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index c39b34deb257..86915d956f01 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -938,9 +938,9 @@ void TabControl::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* p long nYPos = aRect.Top() + ((aTabSize.Height() - nTextHeight) / 2) - nOff3; if (!pItem->maFormatText.isEmpty()) { - sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC; + DrawTextFlags nStyle = DrawTextFlags::Mnemonic; if (!pItem->mbEnabled) - nStyle |= TEXT_DRAW_DISABLE; + nStyle |= DrawTextFlags::Disable; Color aColor(rStyleSettings.GetTabTextColor()); if (nState & ControlState::SELECTED) diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 9395dabdb0e9..887bf7f621db 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1422,14 +1422,14 @@ void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) MetaTextRectAction::MetaTextRectAction() : MetaAction ( MetaActionType::TEXTRECT ), - mnStyle ( 0 ) + mnStyle ( DrawTextFlags::NONE ) {} MetaTextRectAction::~MetaTextRectAction() {} MetaTextRectAction::MetaTextRectAction( const Rectangle& rRect, - const OUString& rStr, sal_uInt16 nStyle ) : + const OUString& rStr, DrawTextFlags nStyle ) : MetaAction ( MetaActionType::TEXTRECT ), maRect ( rRect ), maStr ( rStr ), @@ -1471,7 +1471,7 @@ void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) VersionCompat aCompat(rOStm, StreamMode::WRITE, 2); WriteRectangle( rOStm, maRect ); rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet ); - rOStm.WriteUInt16( mnStyle ); + rOStm.WriteUInt16( static_cast<sal_uInt16>(mnStyle) ); write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm, maStr); // version 2 } @@ -1481,7 +1481,9 @@ void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) VersionCompat aCompat(rIStm, StreamMode::READ); ReadRectangle( rIStm, maRect ); maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet); - rIStm .ReadUInt16( mnStyle ); + sal_uInt16 nTmp; + rIStm .ReadUInt16( nTmp ); + mnStyle = static_cast<DrawTextFlags>(nTmp); if ( aCompat.GetVersion() >= 2 ) // Version 2 maStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 4701eded681f..85fae2d4b181 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -101,7 +101,7 @@ void PDFWriter::DrawStretchText( void PDFWriter::DrawText( const Rectangle& rRect, const OUString& rStr, - sal_uInt16 nStyle ) + DrawTextFlags nStyle ) { xImplementation->drawText( rRect, rStr, nStyle ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4848bf5d99d6..f995b78f1583 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -209,7 +209,7 @@ void doTestCode() aWriter.SetStructureAttribute( PDFWriter::TextDecorationType, PDFWriter::Underline ); aWriter.DrawText( Rectangle( Point( 4500, 10000 ), Size( 12000, 6000 ) ), "It was the best of PDF, it was the worst of PDF ... or so. This is a pretty nonsensical text to denote a paragraph. I suggest you stop reading it. Because if you read on you might get bored. So continue on your on risk. Hey, you're still here ? Why do you continue to read this as it is of no use at all ? OK, it's your time, but still... . Woah, i even get bored writing this, so let's end this here and now.", - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK + DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); aWriter.SetActualText( "It was the best of PDF, it was the worst of PDF ... or so. This is a pretty nonsensical text to denote a paragraph. I suggest you stop reading it. Because if you read on you might get bored. So continue on your on risk. Hey, you're still here ? Why do you continue to read this as it is of no use at all ? OK, it's your time, but still... . Woah, i even get bored writing this, so let's end this here and now." ); aWriter.SetAlternateText( "This paragraph contains some lengthy nonsense to test structural element emission of PDFWriter." ); @@ -218,7 +218,7 @@ void doTestCode() aWriter.SetStructureAttribute( PDFWriter::WritingMode, PDFWriter::LrTb ); aWriter.DrawText( Rectangle( Point( 4500, 19000 ), Size( 12000, 1000 ) ), "This paragraph is nothing special either but ends on the next page structurewise", - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK + DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); aWriter.NewPage( 595, 842 ); @@ -231,7 +231,7 @@ void doTestCode() aWriter.SetFont( Font( OUString( "Times" ), Size( 0, 500 ) ) ); aWriter.DrawText( Rectangle( Point( 4500, 1500 ), Size( 12000, 3000 ) ), "Here's where all things come to an end ... well at least the paragraph from the last page.", - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK + DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); aWriter.EndStructureElement(); @@ -287,7 +287,7 @@ void doTestCode() aWriter.SetTextColor( Color( COL_LIGHTBLUE ) ); aWriter.DrawText( aTranspRect, "Some transparent text", - TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + DrawTextFlags::Center | DrawTextFlags::VCenter | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); aWriter.EndTransparencyGroup( aTranspRect, 50 ); @@ -311,7 +311,7 @@ void doTestCode() aWriter.SetTextColor( Color( COL_LIGHTBLUE ) ); aWriter.DrawText( aTranspRect, "Some transparent text", - TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + DrawTextFlags::Center | DrawTextFlags::VCenter | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); aTranspRect = Rectangle( Point( 1500, 16500 ), Size( 4800, 3000 ) ); aWriter.SetFillColor( Color( COL_LIGHTRED ) ); aWriter.DrawRect( aTranspRect ); @@ -449,7 +449,7 @@ void doTestCode() aEditBox.Name = "testEdit"; aEditBox.Description = "A test edit field"; aEditBox.Text = "A little test text"; - aEditBox.TextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER; + aEditBox.TextStyle = DrawTextFlags::Left | DrawTextFlags::VCenter; aEditBox.Location = Rectangle( Point( 10000, 18000 ), Size( 5000, 1500 ) ); aEditBox.MaxLen = 100; aEditBox.Border = aEditBox.Background = true; @@ -5586,9 +5586,9 @@ bool PDFWriterImpl::emitWidgetAnnotations() aLine.append( "/DA" ); appendLiteralStringEncrypt( rWidget.m_aDAString, rWidget.m_nObject, aLine ); aLine.append( "\n" ); - if( rWidget.m_nTextStyle & TEXT_DRAW_CENTER ) + if( rWidget.m_nTextStyle & DrawTextFlags::Center ) aLine.append( "/Q 1\n" ); - else if( rWidget.m_nTextStyle & TEXT_DRAW_RIGHT ) + else if( rWidget.m_nTextStyle & DrawTextFlags::Right ) aLine.append( "/Q 2\n" ); } // appearance charactristics for terminal fields @@ -9343,7 +9343,7 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const } } -void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, bool bTextLines ) +void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, DrawTextFlags nStyle, bool bTextLines ) { long nWidth = rRect.GetWidth(); long nHeight = rRect.GetHeight(); @@ -9370,11 +9370,11 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_Int32 nMnemonicPos = -1; OUString aStr = rOrigStr; - if ( nStyle & TEXT_DRAW_MNEMONIC ) + if ( nStyle & DrawTextFlags::Mnemonic ) aStr = OutputDevice::GetNonMnemonicString( aStr, nMnemonicPos ); // multiline text - if ( nStyle & TEXT_DRAW_MULTILINE ) + if ( nStyle & DrawTextFlags::MultiLine ) { OUString aLastLine; ImplMultiTextLineInfo aMultiLineInfo; @@ -9393,7 +9393,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, nLines = 1; if ( nFormatLines > nLines ) { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + if ( nStyle & DrawTextFlags::EndEllipsis ) { // handle last line nFormatLines = nLines-1; @@ -9403,24 +9403,24 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, // replace line feed by space aLastLine = aLastLine.replace('\n', ' '); aLastLine = m_pReferenceDevice->GetEllipsisString( aLastLine, nWidth, nStyle ); - nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); - nStyle |= TEXT_DRAW_TOP; + nStyle &= ~DrawTextFlags(DrawTextFlags::VCenter | DrawTextFlags::Bottom); + nStyle |= DrawTextFlags::Top; } } // vertical alignment - if ( nStyle & TEXT_DRAW_BOTTOM ) + if ( nStyle & DrawTextFlags::Bottom ) aPos.Y() += nHeight-(nFormatLines*nTextHeight); - else if ( nStyle & TEXT_DRAW_VCENTER ) + else if ( nStyle & DrawTextFlags::VCenter ) aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2; // draw all lines excluding the last for ( i = 0; i < nFormatLines; i++ ) { pLineInfo = aMultiLineInfo.GetLine( i ); - if ( nStyle & TEXT_DRAW_RIGHT ) + if ( nStyle & DrawTextFlags::Right ) aPos.X() += nWidth-pLineInfo->GetWidth(); - else if ( nStyle & TEXT_DRAW_CENTER ) + else if ( nStyle & DrawTextFlags::Center ) aPos.X() += (nWidth-pLineInfo->GetWidth())/2; sal_Int32 nIndex = pLineInfo->GetIndex(); sal_Int32 nLineLen = pLineInfo->GetLen(); @@ -9443,24 +9443,24 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, // Evt. Text kuerzen if ( nTextWidth > nWidth ) { - if ( nStyle & (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS | TEXT_DRAW_NEWSELLIPSIS) ) + if ( nStyle & (DrawTextFlags::EndEllipsis | DrawTextFlags::PathEllipsis | DrawTextFlags::NewsEllipsis) ) { aStr = m_pReferenceDevice->GetEllipsisString( aStr, nWidth, nStyle ); - nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); - nStyle |= TEXT_DRAW_LEFT; + nStyle &= ~DrawTextFlags(DrawTextFlags::Center | DrawTextFlags::Right); + nStyle |= DrawTextFlags::Left; nTextWidth = m_pReferenceDevice->GetTextWidth( aStr ); } } // vertical alignment - if ( nStyle & TEXT_DRAW_RIGHT ) + if ( nStyle & DrawTextFlags::Right ) aPos.X() += nWidth-nTextWidth; - else if ( nStyle & TEXT_DRAW_CENTER ) + else if ( nStyle & DrawTextFlags::Center ) aPos.X() += (nWidth-nTextWidth)/2; - if ( nStyle & TEXT_DRAW_BOTTOM ) + if ( nStyle & DrawTextFlags::Bottom ) aPos.Y() += nHeight-nTextHeight; - else if ( nStyle & TEXT_DRAW_VCENTER ) + else if ( nStyle & DrawTextFlags::VCenter ) aPos.Y() += (nHeight-nTextHeight)/2; // mnemonics should be inserted here if the need arises @@ -13312,9 +13312,9 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa rNewWidget.m_aDescription = rControl.Description; rNewWidget.m_aText = rControl.Text; rNewWidget.m_nTextStyle = rControl.TextStyle & - ( TEXT_DRAW_LEFT | TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT | TEXT_DRAW_TOP | - TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM | - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + ( DrawTextFlags::Left | DrawTextFlags::Center | DrawTextFlags::Right | DrawTextFlags::Top | + DrawTextFlags::VCenter | DrawTextFlags::Bottom | + DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); rNewWidget.m_nTabOrder = rControl.TabOrder; // various properties are set via the flags (/Ff) property of the field dict @@ -13323,10 +13323,10 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa if( rControl.getType() == PDFWriter::PushButton ) { const PDFWriter::PushButtonWidget& rBtn = static_cast<const PDFWriter::PushButtonWidget&>(rControl); - if( rNewWidget.m_nTextStyle == 0 ) + if( rNewWidget.m_nTextStyle == DrawTextFlags::NONE ) rNewWidget.m_nTextStyle = - TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK; + DrawTextFlags::Center | DrawTextFlags::VCenter | + DrawTextFlags::MultiLine | DrawTextFlags::WordBreak; rNewWidget.m_nFlags |= 0x00010000; if( !rBtn.URL.isEmpty() ) @@ -13339,9 +13339,9 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa else if( rControl.getType() == PDFWriter::RadioButton ) { const PDFWriter::RadioButtonWidget& rBtn = static_cast<const PDFWriter::RadioButtonWidget&>(rControl); - if( rNewWidget.m_nTextStyle == 0 ) + if( rNewWidget.m_nTextStyle == DrawTextFlags::NONE ) rNewWidget.m_nTextStyle = - TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK; + DrawTextFlags::VCenter | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak; /* PDF sees a RadioButton group as one radio button with * children which are in turn check boxes * @@ -13375,9 +13375,9 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa else if( rControl.getType() == PDFWriter::CheckBox ) { const PDFWriter::CheckBoxWidget& rBox = static_cast<const PDFWriter::CheckBoxWidget&>(rControl); - if( rNewWidget.m_nTextStyle == 0 ) + if( rNewWidget.m_nTextStyle == DrawTextFlags::NONE ) rNewWidget.m_nTextStyle = - TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK; + DrawTextFlags::VCenter | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak; rNewWidget.m_aValue = rBox.Checked ? OUString("Yes") : OUString("Off" ); // create default appearance before m_aRect gets transformed @@ -13385,8 +13385,8 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa } else if( rControl.getType() == PDFWriter::ListBox ) { - if( rNewWidget.m_nTextStyle == 0 ) - rNewWidget.m_nTextStyle = TEXT_DRAW_VCENTER; + if( rNewWidget.m_nTextStyle == DrawTextFlags::NONE ) + rNewWidget.m_nTextStyle = DrawTextFlags::VCenter; const PDFWriter::ListBoxWidget& rLstBox = static_cast<const PDFWriter::ListBoxWidget&>(rControl); rNewWidget.m_aListEntries = rLstBox.Entries; @@ -13403,8 +13403,8 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa } else if( rControl.getType() == PDFWriter::ComboBox ) { - if( rNewWidget.m_nTextStyle == 0 ) - rNewWidget.m_nTextStyle = TEXT_DRAW_VCENTER; + if( rNewWidget.m_nTextStyle == DrawTextFlags::NONE ) + rNewWidget.m_nTextStyle = DrawTextFlags::VCenter; const PDFWriter::ComboBoxWidget& rBox = static_cast<const PDFWriter::ComboBoxWidget&>(rControl); rNewWidget.m_aValue = rBox.Text; @@ -13434,14 +13434,14 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa } else if( rControl.getType() == PDFWriter::Edit ) { - if( rNewWidget.m_nTextStyle == 0 ) - rNewWidget.m_nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER; + if( rNewWidget.m_nTextStyle == DrawTextFlags::NONE ) + rNewWidget.m_nTextStyle = DrawTextFlags::Left | DrawTextFlags::VCenter; const PDFWriter::EditWidget& rEdit = static_cast<const PDFWriter::EditWidget&>(rControl); if( rEdit.MultiLine ) { rNewWidget.m_nFlags |= 0x00001000; - rNewWidget.m_nTextStyle |= TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK; + rNewWidget.m_nTextStyle |= DrawTextFlags::MultiLine | DrawTextFlags::WordBreak; } if( rEdit.Password ) rNewWidget.m_nFlags |= 0x00002000; diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 60e12f58786b..ccd8ada7ce18 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -446,7 +446,7 @@ public: OString m_aName; OUString m_aDescription; OUString m_aText; - sal_uInt16 m_nTextStyle; + DrawTextFlags m_nTextStyle; OUString m_aValue; OString m_aDAString; OString m_aDRDict; @@ -472,7 +472,7 @@ public: PDFAppearanceMap m_aAppearances; PDFWidget() : m_eType( PDFWriter::PushButton ), - m_nTextStyle( 0 ), + m_nTextStyle( DrawTextFlags::NONE ), m_nFlags( 0 ), m_nParent( 0 ), m_nTabOrder( 0 ), @@ -1206,7 +1206,7 @@ public: void drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines = true ); - void drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true ); + void drawText( const Rectangle& rRect, const OUString& rOrigStr, DrawTextFlags nStyle, bool bTextLines = true ); void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove ); void drawWaveTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ); void drawStraightTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ); diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index f6a054518550..5b369b6f218b 100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -88,7 +88,7 @@ namespace vcl public: // equivalents to the respective OutputDevice methods, which take the reference device into account long GetTextArray( const OUString& _rText, long* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const; - Rectangle DrawText( const Rectangle& _rRect, const OUString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText ); + Rectangle DrawText( const Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ); protected: void onBeginDrawText() @@ -258,7 +258,7 @@ namespace vcl return true; } - Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const OUString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) + Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) { if ( _rText.isEmpty() ) return Rectangle(); @@ -317,7 +317,7 @@ namespace vcl { } - Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const OUString& _rText, sal_uInt16 _nStyle, + Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) { return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText ); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 832cdbc4d0a5..e860df14073c 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -52,7 +52,7 @@ #endif -#define TEXT_DRAW_ELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS | TEXT_DRAW_NEWSELLIPSIS) +#define TEXT_DRAW_ELLIPSIS (DrawTextFlags::EndEllipsis | DrawTextFlags::PathEllipsis | DrawTextFlags::NewsEllipsis) ImplMultiTextLineInfo::ImplMultiTextLineInfo() { @@ -494,7 +494,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, - sal_uInt16 nStyle, const vcl::ITextLayout& _rLayout ) + DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ) { DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); @@ -509,8 +509,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, // get service provider css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); - bool bHyphenate = (nStyle & TEXT_DRAW_WORDBREAK_HYPHENATION) - == TEXT_DRAW_WORDBREAK_HYPHENATION; + bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation) + == DrawTextFlags::WordBreakHyphenation; css::uno::Reference< css::linguistic2::XHyphenator > xHyph; if ( bHyphenate ) { @@ -528,7 +528,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, nBreakPos++; long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); - if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) ) + if ( ( nLineWidth > nWidth ) && ( nStyle & DrawTextFlags::WordBreak ) ) { if ( !xBI.is() ) xBI = vcl::unohelper::CreateBreakIterator(); @@ -1535,7 +1535,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, } void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, - const OUString& rOrigStr, sal_uInt16 nStyle, + const OUString& rOrigStr, DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout ) { @@ -1543,7 +1543,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r Color aOldTextColor; Color aOldTextFillColor; bool bRestoreFillColor = false; - if ( (nStyle & TEXT_DRAW_DISABLE) && ! pVector ) + if ( (nStyle & DrawTextFlags::Disable) && ! pVector ) { bool bHighContrastBlack = false; bool bHighContrastWhite = false; @@ -1584,7 +1584,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r long nWidth = rRect.GetWidth(); long nHeight = rRect.GetHeight(); - if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & TEXT_DRAW_CLIP) ) + if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & DrawTextFlags::Clip) ) return; Point aPos = rRect.TopLeft(); @@ -1594,13 +1594,13 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r sal_Int32 nMnemonicPos = -1; OUString aStr = rOrigStr; - if ( nStyle & TEXT_DRAW_MNEMONIC ) + if ( nStyle & DrawTextFlags::Mnemonic ) aStr = GetNonMnemonicString( aStr, nMnemonicPos ); const bool bDrawMnemonics = !(rTargetDevice.GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector; // We treat multiline text differently - if ( nStyle & TEXT_DRAW_MULTILINE ) + if ( nStyle & DrawTextFlags::MultiLine ) { OUString aLastLine; @@ -1619,7 +1619,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r nLines = 1; if ( nFormatLines > nLines ) { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + if ( nStyle & DrawTextFlags::EndEllipsis ) { // Create last line and shorten it nFormatLines = nLines-1; @@ -1636,31 +1636,31 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r } aLastLine = aLastLineBuffer.makeStringAndClear(); aLastLine = ImplGetEllipsisString( rTargetDevice, aLastLine, nWidth, nStyle, _rLayout ); - nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); - nStyle |= TEXT_DRAW_TOP; + nStyle &= ~DrawTextFlags(DrawTextFlags::VCenter | DrawTextFlags::Bottom); + nStyle |= DrawTextFlags::Top; } } else { if ( nMaxTextWidth <= nWidth ) - nStyle &= ~TEXT_DRAW_CLIP; + nStyle &= ~DrawTextFlags::Clip; } // Do we need to clip the height? if ( nFormatLines*nTextHeight > nHeight ) - nStyle |= TEXT_DRAW_CLIP; + nStyle |= DrawTextFlags::Clip; // Set clipping - if ( nStyle & TEXT_DRAW_CLIP ) + if ( nStyle & DrawTextFlags::Clip ) { rTargetDevice.Push( PushFlags::CLIPREGION ); rTargetDevice.IntersectClipRegion( rRect ); } // Vertical alignment - if ( nStyle & TEXT_DRAW_BOTTOM ) + if ( nStyle & DrawTextFlags::Bottom ) aPos.Y() += nHeight-(nFormatLines*nTextHeight); - else if ( nStyle & TEXT_DRAW_VCENTER ) + else if ( nStyle & DrawTextFlags::VCenter ) aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2; // Font alignment @@ -1673,9 +1673,9 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r for ( i = 0; i < nFormatLines; i++ ) { pLineInfo = aMultiLineInfo.GetLine( i ); - if ( nStyle & TEXT_DRAW_RIGHT ) + if ( nStyle & DrawTextFlags::Right ) aPos.X() += nWidth-pLineInfo->GetWidth(); - else if ( nStyle & TEXT_DRAW_CENTER ) + else if ( nStyle & DrawTextFlags::Center ) aPos.X() += (nWidth-pLineInfo->GetWidth())/2; sal_Int32 nIndex = pLineInfo->GetIndex(); sal_Int32 nLineLen = pLineInfo->GetLen(); @@ -1710,7 +1710,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r _rLayout.DrawText( aPos, aLastLine, 0, aLastLine.getLength(), pVector, pDisplayText ); // Reset clipping - if ( nStyle & TEXT_DRAW_CLIP ) + if ( nStyle & DrawTextFlags::Clip ) rTargetDevice.Pop(); } } @@ -1724,21 +1724,21 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r if ( nStyle & TEXT_DRAW_ELLIPSIS ) { aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, nStyle, _rLayout ); - nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); - nStyle |= TEXT_DRAW_LEFT; + nStyle &= ~DrawTextFlags(DrawTextFlags::Center | DrawTextFlags::Right); + nStyle |= DrawTextFlags::Left; nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.getLength() ); } } else { if ( nTextHeight <= nHeight ) - nStyle &= ~TEXT_DRAW_CLIP; + nStyle &= ~DrawTextFlags::Clip; } // horizontal text alignment - if ( nStyle & TEXT_DRAW_RIGHT ) + if ( nStyle & DrawTextFlags::Right ) aPos.X() += nWidth-nTextWidth; - else if ( nStyle & TEXT_DRAW_CENTER ) + else if ( nStyle & DrawTextFlags::Center ) aPos.X() += (nWidth-nTextWidth)/2; // vertical font alignment @@ -1747,9 +1747,9 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r else if ( eAlign == ALIGN_BASELINE ) aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); - if ( nStyle & TEXT_DRAW_BOTTOM ) + if ( nStyle & DrawTextFlags::Bottom ) aPos.Y() += nHeight-nTextHeight; - else if ( nStyle & TEXT_DRAW_VCENTER ) + else if ( nStyle & DrawTextFlags::VCenter ) aPos.Y() += (nHeight-nTextHeight)/2; long nMnemonicX = 0; @@ -1768,7 +1768,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); } - if ( nStyle & TEXT_DRAW_CLIP ) + if ( nStyle & DrawTextFlags::Clip ) { rTargetDevice.Push( PushFlags::CLIPREGION ); rTargetDevice.IntersectClipRegion( rRect ); @@ -1791,7 +1791,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r } } - if ( nStyle & TEXT_DRAW_DISABLE && !pVector ) + if ( nStyle & DrawTextFlags::Disable && !pVector ) { rTargetDevice.SetTextColor( aOldTextColor ); if ( bRestoreFillColor ) @@ -1801,7 +1801,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r void OutputDevice::AddTextRectActions( const Rectangle& rRect, const OUString& rOrigStr, - sal_uInt16 nStyle, + DrawTextFlags nStyle, GDIMetaFile& rMtf ) { @@ -1832,7 +1832,7 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, mpMetaFile = pMtf; } -void OutputDevice::DrawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, +void OutputDevice::DrawText( const Rectangle& rRect, const OUString& rOrigStr, DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText, vcl::ITextLayout* _pTextLayout ) { @@ -1876,7 +1876,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const OUString& rOrigStr, s } Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, - const OUString& rStr, sal_uInt16 nStyle, + const OUString& rStr, DrawTextFlags nStyle, TextRectInfo* pInfo, const vcl::ITextLayout* _pTextLayout ) const { @@ -1888,10 +1888,10 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, long nTextHeight = GetTextHeight(); OUString aStr = rStr; - if ( nStyle & TEXT_DRAW_MNEMONIC ) + if ( nStyle & DrawTextFlags::Mnemonic ) aStr = GetNonMnemonicString( aStr ); - if ( nStyle & TEXT_DRAW_MULTILINE ) + if ( nStyle & DrawTextFlags::MultiLine ) { ImplMultiTextLineInfo aMultiLineInfo; ImplTextLineInfo* pLineInfo; @@ -1913,7 +1913,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, nLines = nFormatLines; else { - if ( !(nStyle & TEXT_DRAW_ENDELLIPSIS) ) + if ( !(nStyle & DrawTextFlags::EndEllipsis) ) nLines = nFormatLines; else { @@ -1964,9 +1964,9 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, } } - if ( nStyle & TEXT_DRAW_RIGHT ) + if ( nStyle & DrawTextFlags::Right ) aRect.Left() = aRect.Right()-nMaxWidth+1; - else if ( nStyle & TEXT_DRAW_CENTER ) + else if ( nStyle & DrawTextFlags::Center ) { aRect.Left() += (nWidth-nMaxWidth)/2; aRect.Right() = aRect.Left()+nMaxWidth-1; @@ -1974,9 +1974,9 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, else aRect.Right() = aRect.Left()+nMaxWidth-1; - if ( nStyle & TEXT_DRAW_BOTTOM ) + if ( nStyle & DrawTextFlags::Bottom ) aRect.Top() = aRect.Bottom()-(nTextHeight*nLines)+1; - else if ( nStyle & TEXT_DRAW_VCENTER ) + else if ( nStyle & DrawTextFlags::VCenter ) { aRect.Top() += (aRect.GetHeight()-(nTextHeight*nLines))/2; aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1; @@ -1985,7 +1985,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1; // #99188# get rid of rounding problems when using this rect later - if (nStyle & TEXT_DRAW_RIGHT) + if (nStyle & DrawTextFlags::Right) aRect.Left()--; else aRect.Right()++; @@ -2005,21 +2005,21 @@ static bool ImplIsCharIn( sal_Unicode c, const sal_Char* pStr ) } OUString OutputDevice::GetEllipsisString( const OUString& rOrigStr, long nMaxWidth, - sal_uInt16 nStyle ) const + DrawTextFlags nStyle ) const { vcl::DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) ); return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, aTextLayout ); } OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rOrigStr, long nMaxWidth, - sal_uInt16 nStyle, const vcl::ITextLayout& _rLayout ) + DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ) { OUString aStr = rOrigStr; sal_Int32 nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.getLength() ); if ( nIndex != -1 ) { - if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS ) + if( (nStyle & DrawTextFlags::CenterEllipsis) == DrawTextFlags::CenterEllipsis ) { OUStringBuffer aTmpStr( aStr ); // speed it up by removing all but 1.33x as many as the break pos. @@ -2033,7 +2033,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, } aStr = aTmpStr.makeStringAndClear(); } - else if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + else if ( nStyle & DrawTextFlags::EndEllipsis ) { aStr = aStr.copy(0, nIndex); if ( nIndex > 1 ) @@ -2047,17 +2047,17 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, } } - if ( aStr.isEmpty() && (nStyle & TEXT_DRAW_CLIP) ) + if ( aStr.isEmpty() && (nStyle & DrawTextFlags::Clip) ) aStr += OUString(rOrigStr[ 0 ]); } - else if ( nStyle & TEXT_DRAW_PATHELLIPSIS ) + else if ( nStyle & DrawTextFlags::PathEllipsis ) { OUString aPath( rOrigStr ); OUString aAbbreviatedPath; osl_abbreviateSystemPath( aPath.pData, &aAbbreviatedPath.pData, nIndex, NULL ); aStr = aAbbreviatedPath; } - else if ( nStyle & TEXT_DRAW_NEWSELLIPSIS ) + else if ( nStyle & DrawTextFlags::NewsEllipsis ) { static sal_Char const pSepChars[] = "."; // Determine last section @@ -2076,7 +2076,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, OUString aTempLastStr1( "..." ); aTempLastStr1 += aLastStr; if ( _rLayout.GetTextWidth( aTempLastStr1, 0, aTempLastStr1.getLength() ) > nMaxWidth ) - aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout ); else { sal_Int32 nFirstContent = 0; @@ -2091,7 +2091,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, nFirstContent++; // MEM continue here if ( nFirstContent >= nLastContent ) - aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout ); else { if ( nFirstContent > 4 ) @@ -2100,7 +2100,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, aFirstStr += "..."; OUString aTempStr = aFirstStr + aLastStr; if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.getLength() ) > nMaxWidth ) - aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout ); else { do @@ -2140,7 +2140,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen, - sal_uInt16 nStyle, MetricVector* pVector, OUString* pDisplayText ) + DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText ) { if(nLen == 0x0FFFF) @@ -2178,7 +2178,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, long nMnemonicX = 0; long nMnemonicY = 0; long nMnemonicWidth = 0; - if ( (nStyle & TEXT_DRAW_MNEMONIC) && nLen > 1 ) + if ( (nStyle & DrawTextFlags::Mnemonic) && nLen > 1 ) { aStr = GetNonMnemonicString( aStr, nMnemonicPos ); if ( nMnemonicPos != -1 ) @@ -2222,7 +2222,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, } } - if ( nStyle & TEXT_DRAW_DISABLE && ! pVector ) + if ( nStyle & DrawTextFlags::Disable && ! pVector ) { Color aOldTextColor; Color aOldTextFillColor; @@ -2283,7 +2283,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, long OutputDevice::GetCtrlTextWidth( const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen, - sal_uInt16 nStyle ) const + DrawTextFlags nStyle ) const { if(nLen == 0x0FFFF) { @@ -2296,7 +2296,7 @@ long OutputDevice::GetCtrlTextWidth( const OUString& rStr, nLen = rStr.getLength() - nIndex; } - if ( nStyle & TEXT_DRAW_MNEMONIC ) + if ( nStyle & DrawTextFlags::Mnemonic ) { sal_Int32 nMnemonicPos; OUString aStr = GetNonMnemonicString( rStr, nMnemonicPos ); diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index d68c2e1e9aa8..0777ad34587a 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1664,7 +1664,7 @@ void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* p if (pOffset) aInRect.Move(pOffset->X(), pOffset->Y()); - sal_uInt16 nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP; + DrawTextFlags nTextStyle = DrawTextFlags::Left | DrawTextFlags::VCenter | DrawTextFlags::EndEllipsis | DrawTextFlags::Clip; // must show tooltip ? TextRectInfo aInfo; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 7a32856e920c..9cefd27c8f7d 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1745,7 +1745,7 @@ static OUString getShortenedString( const OUString& i_rLong, vcl::RenderContext& { sal_Int32 nPos = -1; OUString aNonMnem(OutputDevice::GetNonMnemonicString(i_rLong, nPos)); - aNonMnem = rRenderContext.GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS); + aNonMnem = rRenderContext.GetEllipsisString( aNonMnem, i_nMaxWidth, DrawTextFlags::CenterEllipsis); // re-insert mnemonic if (nPos != -1) { @@ -1861,7 +1861,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, long nTextOffsetY = ((pData->aSz.Height() - nFontHeight) / 2); if (IsMenuBar()) nTextOffsetY += (aOutSz.Height()-pData->aSz.Height()) / 2; - sal_uInt16 nTextStyle = 0; + DrawTextFlags nTextStyle = DrawTextFlags::NONE; DrawSymbolFlags nSymbolStyle = DrawSymbolFlags::NONE; sal_uInt16 nImageStyle = 0; @@ -1871,7 +1871,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, // asynchronous loading if (!pData->bEnabled) { - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; nSymbolStyle |= DrawSymbolFlags::Disable; nImageStyle |= IMAGE_DRAW_DISABLE; } @@ -2009,9 +2009,9 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, aTmpPos.X() = aPos.X() + nTextPos; aTmpPos.Y() = aPos.Y(); aTmpPos.Y() += nTextOffsetY; - sal_uInt16 nStyle = nTextStyle | TEXT_DRAW_MNEMONIC; + DrawTextFlags nStyle = nTextStyle | DrawTextFlags::Mnemonic; if (pData->bIsTemporary) - nStyle |= TEXT_DRAW_DISABLE; + nStyle |= DrawTextFlags::Disable; MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; OUString* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; if (bLayout) @@ -2022,7 +2022,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, } // #i47946# with NWF painted menus the background is transparent // since DrawCtrlText can depend on the background (e.g. for - // TEXT_DRAW_DISABLE), temporarily set a background which + // DrawTextFlags::Disable), temporarily set a background which // hopefully matches the NWF background since it is read // from the system style settings bool bSetTmpBackground = !rRenderContext.IsBackground() diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 0e7e08878184..659c3fe33449 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -194,7 +194,7 @@ void MessBox::ImplPosControls() long nMaxLineWidth; long nWidth; WinBits nWinStyle = WB_LEFT | WB_NOLABEL; - sal_uInt16 nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT; + DrawTextFlags nTextStyle = DrawTextFlags::MultiLine | DrawTextFlags::Top | DrawTextFlags::Left; mpVCLMultiLineEdit.disposeAndClear(); mpFixedImage.disposeAndClear(); @@ -245,7 +245,7 @@ void MessBox::ImplPosControls() // Determine maximum line length without wordbreak aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo ); nMaxLineWidth = aFormatRect.GetWidth(); - nTextStyle |= TEXT_DRAW_WORDBREAK; + nTextStyle |= DrawTextFlags::WordBreak; // Determine the width for text formatting if ( nMaxLineWidth > 450 ) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 2b13051b3a37..9901843401ca 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -179,8 +179,8 @@ void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, SetZoomedPointFont(rRenderContext, aFont); Rectangle aTextRect(aOffset + Point(2, 2), Size(maPreviewSize.Width() - 4, maPreviewSize.Height() - 4)); rRenderContext.DrawText(aTextRect, maReplacementString, - TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | - TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE); + DrawTextFlags::Center | DrawTextFlags::VCenter | + DrawTextFlags::WordBreak | DrawTextFlags::MultiLine); rRenderContext.Pop(); } else diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index a997130af601..a3273ece1047 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -396,12 +396,12 @@ void StatusBar::ImplDrawText(vcl::RenderContext& rRenderContext, bool bOffScreen mpImplData->mpVirDev->SetOutputSizePixel( aVirDevSize ); Rectangle aTempRect = aTextRect; aTempRect.SetPos(Point(0, 0)); - mpImplData->mpVirDev->DrawText( aTempRect, aStr, TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_CLIP | TEXT_DRAW_ENDELLIPSIS ); + mpImplData->mpVirDev->DrawText( aTempRect, aStr, DrawTextFlags::Left | DrawTextFlags::Top | DrawTextFlags::Clip | DrawTextFlags::EndEllipsis ); rRenderContext.DrawOutDev(aTextRect.TopLeft(), aVirDevSize, Point(), aVirDevSize, *mpImplData->mpVirDev); } else { - rRenderContext.DrawText(aTextRect, aStr, TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_CLIP | TEXT_DRAW_ENDELLIPSIS); + rRenderContext.DrawText(aTextRect, aStr, DrawTextFlags::Left | DrawTextFlags::Top | DrawTextFlags::Clip | DrawTextFlags::EndEllipsis); } } } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index e1a25f484c5c..438a405290cc 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3096,7 +3096,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, mpData->m_pLayoutData->m_aLineItemIds.push_back( pItem->mnId ); mpData->m_pLayoutData->m_aLineItemPositions.push_back( nPos ); } - DrawCtrlText( aPos, pItem->maText, 0, pItem->maText.getLength(), TEXT_DRAW_MNEMONIC, pVector, pDisplayText ); + DrawCtrlText( aPos, pItem->maText, 0, pItem->maText.getLength(), DrawTextFlags::Mnemonic, pVector, pDisplayText ); if (bClip) rRenderContext.SetClipRegion(); rRenderContext.SetFont(aOldFont); @@ -3250,9 +3250,9 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, ImplDrawButton(rRenderContext, pItem->maRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ); } - sal_uInt16 nTextStyle = 0; + DrawTextFlags nTextStyle = DrawTextFlags::NONE; if ( !pItem->mbEnabled ) - nTextStyle |= TEXT_DRAW_DISABLE; + nTextStyle |= DrawTextFlags::Disable; if( bLayout ) { mpData->m_pLayoutData->m_aLineIndices.push_back( mpData->m_pLayoutData->m_aDisplayText.getLength() ); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index fc44e8062aa5..2ebea2dc44c3 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -269,7 +269,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) rRenderContext.DrawText(Rectangle(Point((aPaperSize.Width() - 4000) / 2, 2000), Size(aPaperSize.Width() - 2100 - nMaxWidth, aPaperSize.Height() - 4000)), aPrintText.makeStringAndClear(), - TEXT_DRAW_MULTILINE); + DrawTextFlags::MultiLine); } rRenderContext.SetFillColor(); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 3bb2ccf99ac9..bbd135b4842a 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1545,8 +1545,8 @@ class DemoPopup : public FloatingWindow SetTextColor(COL_BLACK); SetTextAlign(ALIGN_TOP); DrawText(aTextRect, "This is a standalone help text test", - TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK| - TEXT_DRAW_LEFT|TEXT_DRAW_TOP); + DrawTextFlags::MultiLine|DrawTextFlags::WordBreak| + DrawTextFlags::Left|DrawTextFlags::Top); SetLineColor(COL_BLACK); SetFillColor(); |