summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-26 14:14:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-27 08:20:00 +0200
commitcca4d9ab39499562614f0f778a2fffe5a40fde88 (patch)
tree79f2482d1f1bf8acd8bd7e00769f259d8fb70825
parent49e39c9225cc9be201231d3a02fa49b6a7214d93 (diff)
convert WB_PASSWORD to a bool field on Edit
Change-Id: Ie1e03bcdf57e6ba3e2a6ba8596d70a2d7a88eaba Reviewed-on: https://gerrit.libreoffice.org/53520 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--accessibility/source/standard/vclxaccessibleedit.cxx2
-rw-r--r--include/svtools/ivctrl.hxx2
-rw-r--r--include/tools/wintypes.hxx1
-rw-r--r--include/vcl/edit.hxx6
-rw-r--r--vcl/source/control/edit.cxx19
-rw-r--r--vcl/source/window/accessibility.cxx2
6 files changed, 17 insertions, 15 deletions
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index 850238c55a94..118c9d85f6d0 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -214,7 +214,7 @@ sal_Int16 VCLXAccessibleEdit::implGetAccessibleRole( )
{
sal_Int16 nRole;
VclPtr< Edit > pEdit = GetAs< Edit >();
- if ( pEdit && ( ( pEdit->GetStyle() & WB_PASSWORD ) || pEdit->GetEchoChar() ) )
+ if ( pEdit && ( pEdit->IsPassword() || pEdit->GetEchoChar() ) )
nRole = AccessibleRole::PASSWORD_TEXT;
else if ( pEdit && ( pEdit->GetStyle() & WB_READONLY ) )
nRole = AccessibleRole::LABEL;
diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx
index 18641b419422..11ba7f1dee1f 100644
--- a/include/svtools/ivctrl.hxx
+++ b/include/svtools/ivctrl.hxx
@@ -176,7 +176,7 @@ public:
#define WB_NOVSCROLL WB_DRAG
#define WB_NOSELECTION WB_REPEAT
#define WB_NODRAGSELECTION WB_PATHELLIPSIS
-#define WB_SMART_ARRANGE WB_PASSWORD
+#define WB_SMART_ARRANGE 0x01000000 // used to be WB_PASSWORD
#define WB_ALIGN_TOP WB_TOP
#define WB_ALIGN_LEFT WB_LEFT
#define WB_NOCOLUMNHEADER WB_CENTER
diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx
index 897e63e520e1..f80334966b76 100644
--- a/include/tools/wintypes.hxx
+++ b/include/tools/wintypes.hxx
@@ -195,7 +195,6 @@ WinBits const WB_NOMULTILINE = 0x10000000;
WinBits const WB_EARLYTOGGLE = SAL_CONST_INT64(0x4000000000);
// Window-Bits for Edit
-WinBits const WB_PASSWORD = 0x01000000;
WinBits const WB_READONLY = 0x02000000;
WinBits const WB_NOHIDESELECTION = SAL_CONST_INT64(0x1000000000);
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 0d353c379f35..72e3e2273581 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -93,7 +93,8 @@ private:
mbClickedInSelection:1,
mbIsSubEdit:1,
mbActivePopup:1,
- mbForceControlBackground:1;
+ mbForceControlBackground:1,
+ mbPassword;
Link<Edit&,void> maModifyHdl;
Link<Edit&,void> maUpdateDataHdl;
Link<Edit&,void> maAutocompleteHdl;
@@ -275,6 +276,9 @@ public:
static Size GetMinimumEditSize();
void SetForceControlBackground(bool b) { mbForceControlBackground = b; }
+
+ void SetPassword(bool b) { mbPassword = b; }
+ bool IsPassword() const { return mbPassword; }
};
#endif // INCLUDED_VCL_EDIT_HXX
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 2effdcd3594a..9d5204b82760 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -206,11 +206,9 @@ bool Edit::set_property(const OString &rKey, const OUString &rValue)
}
else if (rKey == "visibility")
{
- WinBits nBits = GetStyle();
- nBits &= ~WB_PASSWORD;
+ mbPassword = false;
if (!toBool(rValue))
- nBits |= WB_PASSWORD;
- SetStyle(nBits);
+ mbPassword = true;
}
else if (rKey == "placeholder-text")
SetPlaceholderText(rValue);
@@ -281,6 +279,7 @@ void Edit::ImplInitEditData()
mbActivePopup = false;
mbIsSubEdit = false;
mbForceControlBackground = false;
+ mbPassword = false;
mpDDInfo = nullptr;
mpIMEInfos = nullptr;
mcEchoChar = 0;
@@ -431,7 +430,7 @@ long Edit::ImplGetExtraYOffset() const
OUString Edit::ImplGetText() const
{
- if ( mcEchoChar || (GetStyle() & WB_PASSWORD) )
+ if ( mcEchoChar || mbPassword )
{
sal_Unicode cEchoChar;
if ( mcEchoChar )
@@ -1406,7 +1405,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
{
case KeyFuncType::CUT:
{
- if ( !mbReadOnly && maSelection.Len() && !(GetStyle() & WB_PASSWORD) )
+ if ( !mbReadOnly && maSelection.Len() && !mbPassword )
{
Cut();
ImplModified();
@@ -1417,7 +1416,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
case KeyFuncType::COPY:
{
- if ( !(GetStyle() & WB_PASSWORD) )
+ if ( !mbPassword )
{
Copy();
bDone = true;
@@ -2564,7 +2563,7 @@ OUString Edit::GetSelected() const
void Edit::Cut()
{
- if ( !(GetStyle() & WB_PASSWORD ) )
+ if ( !mbPassword )
{
Copy();
ReplaceSelected( OUString() );
@@ -2573,7 +2572,7 @@ void Edit::Cut()
void Edit::Copy()
{
- if ( !(GetStyle() & WB_PASSWORD ) )
+ if ( !mbPassword )
{
css::uno::Reference<css::datatransfer::clipboard::XClipboard> aClipboard(GetClipboard());
ImplCopy( aClipboard );
@@ -2811,7 +2810,7 @@ void Edit::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent
SolarMutexGuard aVclGuard;
if ( !IsTracking() && maSelection.Len() &&
- !(GetStyle() & WB_PASSWORD) && (!mpDDInfo || !mpDDInfo->bStarterOfDD) ) // no repeated D&D
+ !mbPassword && (!mpDDInfo || !mpDDInfo->bStarterOfDD) ) // no repeated D&D
{
Selection aSel( maSelection );
aSel.Justify();
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index 22698064a399..37ff8ddcff82 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -318,7 +318,7 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
case WindowType::PATTERNFIELD:
case WindowType::CALCINPUTLINE:
- case WindowType::EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? accessibility::AccessibleRole::PASSWORD_TEXT : accessibility::AccessibleRole::TEXT; break;
+ case WindowType::EDIT: nRole = static_cast<Edit const *>(this)->IsPassword() ? accessibility::AccessibleRole::PASSWORD_TEXT : accessibility::AccessibleRole::TEXT; break;
case WindowType::PATTERNBOX:
case WindowType::NUMERICBOX: