[Libreoffice-commits] core.git: svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 1 20:53:41 UTC 2021
svx/source/fmcomp/gridcell.cxx | 18 ++++++++----------
svx/source/inc/gridcell.hxx | 15 +--------------
2 files changed, 9 insertions(+), 24 deletions(-)
New commits:
commit d7397d36b3c801681a802f4f2f16aec0c01a76db
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 1 16:12:37 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 1 22:53:07 2021 +0200
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 at redhat.com>
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
{
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 081f7a4bc684..b2aa1140006f 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -816,20 +816,7 @@ protected:
class FmXTextCell : public FmXDataCell
{
protected:
- /** determines whether the text of this cell can be painted directly, without
- using the painter control
-
- If this is <TRUE/>, the <member>PaintCell</member> method will simply use the text as returned
- by <member>GetText</member>, and draw it onto the device passed to <member>PaintFieldToCell</member>,
- while respecting the current alignment settings.
-
- If this is <FALSE/>, the <member>PaintFieldToCell</member> request will be forwarded to the painter
- control (<member>m_pPainter</member>). This is more expensive, but the only option
- if your painting involves more that a simple DrawText.
-
- This member is <TRUE/> by default, and can be modified by derived classes.
- */
- bool m_bFastPaint;
+ bool m_bIsMultiLineText;
public:
FmXTextCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
More information about the Libreoffice-commits
mailing list