[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/source

Serge Krot (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 20 14:24:05 UTC 2020


 sw/source/core/text/portxt.cxx |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

New commits:
commit c19bc04920df332a2c1f89b7e5ee4ef70e028bf5
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Fri Jun 19 13:06:33 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Jun 20 16:23:34 2020 +0200

    tdf#101830 sw: highlight empty 'invisible' input fields
    
    Change-Id: Ibcf4f7ce88c7bf364510c522e224028aa4737790
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96717
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 63d4e8aa10186b4ed0e3106c116ad25c5fb5ed6d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96709

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index ea16142b9f33..84bbee847d72 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -37,6 +37,7 @@
 #include <pam.hxx>
 #include <doc.hxx>
 #include <xmloff/odffields.hxx>
+#include <viewopt.hxx>
 
 using namespace ::sw::mark;
 using namespace ::com::sun::star;
@@ -689,6 +690,28 @@ void SwTextInputFieldPortion::Paint( const SwTextPaintInfo &rInf ) const
         SwTextSlot aPaintText( &rInf, this, true, true, OUString() );
         SwTextPortion::Paint( rInf );
     }
+    else
+    {
+        // highlight empty input field, elsewhere they are completely invisible for the user
+        SwRect aIntersect;
+        rInf.CalcRect(*this, &aIntersect);
+        const sal_uInt16 aAreaWidth = rInf.GetTextSize(OUString(' ')).Width();
+        aIntersect.Left(aIntersect.Left() - aAreaWidth/2);
+        aIntersect.Width(aAreaWidth);
+
+        if (aIntersect.HasArea()
+            && rInf.OnWin()
+            && SwViewOption::IsFieldShadings()
+            && !rInf.GetOpt().IsPagePreview())
+        {
+            OutputDevice* pOut = const_cast<OutputDevice*>(rInf.GetOut());
+            pOut->Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
+            pOut->SetFillColor(SwViewOption::GetFieldShadingsColor());
+            pOut->SetLineColor();
+            pOut->DrawRect(aIntersect.SVRect());
+            pOut->Pop();
+        }
+    }
 }
 
 bool SwTextInputFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const


More information about the Libreoffice-commits mailing list