Kaydet (Commit) cca4d9ab authored tarafından Noel Grandin's avatar Noel Grandin

convert WB_PASSWORD to a bool field on Edit

Change-Id: Ie1e03bcdf57e6ba3e2a6ba8596d70a2d7a88eaba
Reviewed-on: https://gerrit.libreoffice.org/53520Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 49e39c92
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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();
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment