summaryrefslogtreecommitdiff
path: root/sw/source/core/text
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2020-06-19 13:06:33 +0200
committerAndras Timar <andras.timar@collabora.com>2020-06-23 08:55:49 +0200
commitcec306c2e2bff6cd70fc698a5026425f41c98ab7 (patch)
treea6c205847542c1a6746465cbf29f6395d70c602c /sw/source/core/text
parent470ca0d6dc8560a49e589eaf25bdc6df5d56b459 (diff)
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@CIB.de> (cherry picked from commit 63d4e8aa10186b4ed0e3106c116ad25c5fb5ed6d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96709 (cherry picked from commit 9733be8607fe36c7f69ff050a487ff0e6e88f79f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96790
Diffstat (limited to 'sw/source/core/text')
-rw-r--r--sw/source/core/text/portxt.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 0460cb343dd3..79963e311b29 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -43,6 +43,7 @@
#include <pam.hxx>
#include <doc.hxx>
#include <xmloff/odffields.hxx>
+#include <viewopt.hxx>
using namespace ::sw::mark;
using namespace ::com::sun::star;
@@ -695,6 +696,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