diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-10-01 16:12:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-01 22:53:07 +0200 |
commit | d7397d36b3c801681a802f4f2f16aec0c01a76db (patch) | |
tree | 1d231755115f6c9ebde8067affd52edaf2c5ea92 /svx/source/fmcomp | |
parent | 7abf811bcbb92562a8da965d2ff03b9d53853e09 (diff) |
tdf#141633 use OutputDevice::DrawText for multiline text too
m_bFastPaint is only false for the multiline text, where it then tries
to use a textview widget to render the text onto the OutputDevice while
for simpleline text it just uses OutputDevice::DrawText.
This isn't working particuarly well anymore for print output and
DrawText can be used with flags of DrawTextFlags::Top |
DrawTextFlags::MultiLine | DrawTextFlags::WordBreak to render text
equivalently to the multiple line textview which seems a saner approach.
Change-Id: I3c96f837aaeba82ebf5956ab2ba35210c978f255
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122953
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/fmcomp')
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 45362a0e7140..a513784d35f9 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -3562,7 +3562,7 @@ void FmXDataCell::UpdateFromColumn() FmXTextCell::FmXTextCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl ) :FmXDataCell( pColumn, std::move(pControl) ) - ,m_bFastPaint( true ) + ,m_bIsMultiLineText(false) { } @@ -3572,13 +3572,7 @@ void FmXTextCell::PaintFieldToCell(OutputDevice& rDev, const Reference< css::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter) { - if ( !m_bFastPaint ) - { - FmXDataCell::PaintFieldToCell( rDev, rRect, _rxField, xFormatter ); - return; - } - - DrawTextFlags nStyle = DrawTextFlags::Clip | DrawTextFlags::VCenter; + DrawTextFlags nStyle = DrawTextFlags::Clip; if ( ( rDev.GetOutDevType() == OUTDEV_WINDOW ) && !rDev.GetOwnerWindow()->IsEnabled() ) nStyle |= DrawTextFlags::Disable; @@ -3594,6 +3588,11 @@ void FmXTextCell::PaintFieldToCell(OutputDevice& rDev, nStyle |= DrawTextFlags::Left; } + if (!m_bIsMultiLineText) + nStyle |= DrawTextFlags::VCenter; + else + nStyle |= DrawTextFlags::Top | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak; + try { const Color* pColor = nullptr; @@ -3627,8 +3626,7 @@ FmXEditCell::FmXEditCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> { m_pEditImplementation = pTextField->GetEditImplementation(); - if (pTextField->IsMultiLineEdit()) - m_bFastPaint = false; + m_bIsMultiLineText = pTextField->IsMultiLineEdit(); } else { |