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

convert PROPERTY_FLAG to o3tl::typed_flags

Change-Id: Ib652b83b1beed048cabce91aee22fc98605fd654
üst 76ab8c76
...@@ -49,21 +49,11 @@ namespace svt ...@@ -49,21 +49,11 @@ namespace svt
namespace namespace
{ {
#define PROPERTY_FLAG_TEXT 0x00000001
#define PROPERTY_FLAG_ENDBALED 0x00000002
#define PROPERTY_FLAG_VISIBLE 0x00000004
#define PROPERTY_FLAG_HELPURL 0x00000008
#define PROPERTY_FLAG_LISTITEMS 0x00000010
#define PROPERTY_FLAG_SELECTEDITEM 0x00000020
#define PROPERTY_FLAG_SELECTEDITEMINDEX 0x00000040
#define PROPERTY_FLAG_CHECKED 0x00000080
struct ControlDescription struct ControlDescription
{ {
const sal_Char* pControlName; const sal_Char* pControlName;
sal_Int16 nControlId; sal_Int16 nControlId;
sal_Int32 nPropertyFlags; PropFlags nPropertyFlags;
}; };
...@@ -71,38 +61,38 @@ namespace svt ...@@ -71,38 +61,38 @@ namespace svt
typedef ::std::pair< ControlDescIterator, ControlDescIterator > ControlDescRange; typedef ::std::pair< ControlDescIterator, ControlDescIterator > ControlDescRange;
#define PROPERTY_FLAGS_COMMON ( PROPERTY_FLAG_ENDBALED | PROPERTY_FLAG_VISIBLE | PROPERTY_FLAG_HELPURL ) #define PROPERTY_FLAGS_COMMON ( PropFlags::Enabled | PropFlags::Visible | PropFlags::HelpUrl )
#define PROPERTY_FLAGS_LISTBOX ( PROPERTY_FLAG_LISTITEMS | PROPERTY_FLAG_SELECTEDITEM | PROPERTY_FLAG_SELECTEDITEMINDEX ) #define PROPERTY_FLAGS_LISTBOX ( PropFlags::ListItems | PropFlags::SelectedItem | PropFlags::SelectedItemIndex )
#define PROPERTY_FLAGS_CHECKBOX ( PROPERTY_FLAG_CHECKED | PROPERTY_FLAG_TEXT ) #define PROPERTY_FLAGS_CHECKBOX ( PropFlags::Checked | PropFlags::Text )
// Note: this array MUST be sorted by name! // Note: this array MUST be sorted by name!
static const ControlDescription aDescriptions[] = { static const ControlDescription aDescriptions[] = {
{ "AutoExtensionBox", CHECKBOX_AUTOEXTENSION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "AutoExtensionBox", CHECKBOX_AUTOEXTENSION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "CancelButton", PUSHBUTTON_CANCEL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "CancelButton", PUSHBUTTON_CANCEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "CurrentFolderText", FIXEDTEXT_CURRENTFOLDER, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "CurrentFolderText", FIXEDTEXT_CURRENTFOLDER, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "DefaultLocationButton", TOOLBOXBUTOON_DEFAULT_LOCATION, PROPERTY_FLAGS_COMMON }, { "DefaultLocationButton", TOOLBOXBUTOON_DEFAULT_LOCATION, PROPERTY_FLAGS_COMMON },
{ "FileURLEdit", EDIT_FILEURL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "FileURLEdit", EDIT_FILEURL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "FileURLEditLabel", EDIT_FILEURL_LABEL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "FileURLEditLabel", EDIT_FILEURL_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "FileView", CONTROL_FILEVIEW, PROPERTY_FLAGS_COMMON }, { "FileView", CONTROL_FILEVIEW, PROPERTY_FLAGS_COMMON },
{ "FilterList", LISTBOX_FILTER, PROPERTY_FLAGS_COMMON }, { "FilterList", LISTBOX_FILTER, PROPERTY_FLAGS_COMMON },
{ "FilterListLabel", LISTBOX_FILTER_LABEL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "FilterListLabel", LISTBOX_FILTER_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "FilterOptionsBox", CHECKBOX_FILTEROPTIONS, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "FilterOptionsBox", CHECKBOX_FILTEROPTIONS, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "HelpButton", PUSHBUTTON_HELP, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "HelpButton", PUSHBUTTON_HELP, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "ImageTemplateList", LISTBOX_IMAGE_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX }, { "ImageTemplateList", LISTBOX_IMAGE_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX },
{ "ImageTemplateListLabel", LISTBOX_IMAGE_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "ImageTemplateListLabel", LISTBOX_IMAGE_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "LevelUpButton", TOOLBOXBUTOON_LEVEL_UP, PROPERTY_FLAGS_COMMON }, { "LevelUpButton", TOOLBOXBUTOON_LEVEL_UP, PROPERTY_FLAGS_COMMON },
{ "LinkBox", CHECKBOX_LINK, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "LinkBox", CHECKBOX_LINK, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "NewFolderButton", TOOLBOXBUTOON_NEW_FOLDER, PROPERTY_FLAGS_COMMON }, { "NewFolderButton", TOOLBOXBUTOON_NEW_FOLDER, PROPERTY_FLAGS_COMMON },
{ "OkButton", PUSHBUTTON_OK , PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "OkButton", PUSHBUTTON_OK , PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "PasswordBox", CHECKBOX_PASSWORD, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "PasswordBox", CHECKBOX_PASSWORD, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "PlayButton", PUSHBUTTON_PLAY, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "PlayButton", PUSHBUTTON_PLAY, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "PreviewBox", CHECKBOX_PREVIEW, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "PreviewBox", CHECKBOX_PREVIEW, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "ReadOnlyBox", CHECKBOX_READONLY, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "ReadOnlyBox", CHECKBOX_READONLY, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "SelectionBox", CHECKBOX_SELECTION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "SelectionBox", CHECKBOX_SELECTION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX },
{ "TemplateList", LISTBOX_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX }, { "TemplateList", LISTBOX_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX },
{ "TemplateListLabel", LISTBOX_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT }, { "TemplateListLabel", LISTBOX_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text },
{ "VersionList", LISTBOX_VERSION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX }, { "VersionList", LISTBOX_VERSION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX },
{ "VersionListLabel", LISTBOX_VERSION_LABEL, PROPERTY_FLAGS_COMMON | PROPERTY_FLAG_TEXT } { "VersionListLabel", LISTBOX_VERSION_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }
}; };
...@@ -124,21 +114,21 @@ namespace svt ...@@ -124,21 +114,21 @@ namespace svt
struct ControlProperty struct ControlProperty
{ {
const sal_Char* pPropertyName; const sal_Char* pPropertyName;
sal_Int16 nPropertyId; PropFlags nPropertyId;
}; };
typedef const ControlProperty* ControlPropertyIterator; typedef const ControlProperty* ControlPropertyIterator;
static const ControlProperty aProperties[] = { static const ControlProperty aProperties[] = {
{ "Text", PROPERTY_FLAG_TEXT }, { "Text", PropFlags::Text },
{ "Enabled", PROPERTY_FLAG_ENDBALED }, { "Enabled", PropFlags::Enabled },
{ "Visible", PROPERTY_FLAG_VISIBLE }, { "Visible", PropFlags::Visible },
{ "HelpURL", PROPERTY_FLAG_HELPURL }, { "HelpURL", PropFlags::HelpUrl },
{ "ListItems", PROPERTY_FLAG_LISTITEMS }, { "ListItems", PropFlags::ListItems },
{ "SelectedItem", PROPERTY_FLAG_SELECTEDITEM }, { "SelectedItem", PropFlags::SelectedItem },
{ "SelectedItemIndex", PROPERTY_FLAG_SELECTEDITEMINDEX }, { "SelectedItemIndex", PropFlags::SelectedItemIndex },
{ "Checked", PROPERTY_FLAG_CHECKED } { "Checked", PropFlags::Checked }
}; };
...@@ -217,7 +207,7 @@ namespace svt ...@@ -217,7 +207,7 @@ namespace svt
{ {
// look up the control // look up the control
sal_Int16 nControlId = -1; sal_Int16 nControlId = -1;
sal_Int32 nPropertyMask = 0; PropFlags nPropertyMask = PropFlags::NONE;
Control* pControl = implGetControl( _rControlName, &nControlId, &nPropertyMask ); Control* pControl = implGetControl( _rControlName, &nControlId, &nPropertyMask );
// will throw an IllegalArgumentException if the name is not valid // will throw an IllegalArgumentException if the name is not valid
...@@ -227,7 +217,7 @@ namespace svt ...@@ -227,7 +217,7 @@ namespace svt
// it's a completely unknown property // it's a completely unknown property
lcl_throwIllegalArgumentException(); lcl_throwIllegalArgumentException();
if ( 0 == ( nPropertyMask & aPropDesc->nPropertyId ) ) if ( !( nPropertyMask & aPropDesc->nPropertyId ) )
// it's a property which is known, but not allowed for this control // it's a property which is known, but not allowed for this control
lcl_throwIllegalArgumentException(); lcl_throwIllegalArgumentException();
...@@ -235,7 +225,7 @@ namespace svt ...@@ -235,7 +225,7 @@ namespace svt
} }
Control* OControlAccess::implGetControl( const OUString& _rControlName, sal_Int16* _pId, sal_Int32* _pPropertyMask ) const Control* OControlAccess::implGetControl( const OUString& _rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask ) const
{ {
Control* pControl = nullptr; Control* pControl = nullptr;
ControlDescription tmpDesc; ControlDescription tmpDesc;
...@@ -301,7 +291,7 @@ namespace svt ...@@ -301,7 +291,7 @@ namespace svt
Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& _rControlName ) Sequence< OUString > OControlAccess::getSupportedControlProperties( const OUString& _rControlName )
{ {
sal_Int16 nControlId = -1; sal_Int16 nControlId = -1;
sal_Int32 nPropertyMask = 0; PropFlags nPropertyMask = PropFlags::NONE;
implGetControl( _rControlName, &nControlId, &nPropertyMask ); implGetControl( _rControlName, &nControlId, &nPropertyMask );
// will throw an IllegalArgumentException if the name is not valid // will throw an IllegalArgumentException if the name is not valid
...@@ -310,7 +300,7 @@ namespace svt ...@@ -310,7 +300,7 @@ namespace svt
OUString* pProperty = aProps.getArray(); OUString* pProperty = aProps.getArray();
for ( ControlPropertyIterator aProp = s_pProperties; aProp != s_pPropertiesEnd; ++aProp ) for ( ControlPropertyIterator aProp = s_pProperties; aProp != s_pPropertiesEnd; ++aProp )
if ( 0 != ( nPropertyMask & aProp->nPropertyId ) ) if ( nPropertyMask & aProp->nPropertyId )
*pProperty++ = OUString::createFromAscii( aProp->pPropertyName ); *pProperty++ = OUString::createFromAscii( aProp->pPropertyName );
aProps.realloc( pProperty - aProps.getArray() ); aProps.realloc( pProperty - aProps.getArray() );
...@@ -331,7 +321,7 @@ namespace svt ...@@ -331,7 +321,7 @@ namespace svt
{ {
// look up the control // look up the control
sal_Int16 nControlId = -1; sal_Int16 nControlId = -1;
sal_Int32 nPropertyMask = 0; PropFlags nPropertyMask = PropFlags::NONE;
implGetControl( _rControlName, &nControlId, &nPropertyMask ); implGetControl( _rControlName, &nControlId, &nPropertyMask );
// will throw an IllegalArgumentException if the name is not valid // will throw an IllegalArgumentException if the name is not valid
...@@ -341,7 +331,7 @@ namespace svt ...@@ -341,7 +331,7 @@ namespace svt
// it's a property which is completely unknown // it's a property which is completely unknown
return false; return false;
return 0 != ( aPropDesc->nPropertyId & nPropertyMask ); return bool( aPropDesc->nPropertyId & nPropertyMask );
} }
...@@ -351,10 +341,10 @@ namespace svt ...@@ -351,10 +341,10 @@ namespace svt
DBG_ASSERT( pControl, "OControlAccess::SetValue: don't have this control in the current mode!" ); DBG_ASSERT( pControl, "OControlAccess::SetValue: don't have this control in the current mode!" );
if ( pControl ) if ( pControl )
{ {
sal_Int16 nPropertyId = -1; PropFlags nPropertyId = PropFlags::Unknown;
if ( ControlActions::SET_HELP_URL == _nControlAction ) if ( ControlActions::SET_HELP_URL == _nControlAction )
{ {
nPropertyId = PROPERTY_FLAG_HELPURL; nPropertyId = PropFlags::HelpUrl;
} }
else else
{ {
...@@ -367,7 +357,7 @@ namespace svt ...@@ -367,7 +357,7 @@ namespace svt
case CHECKBOX_LINK: case CHECKBOX_LINK:
case CHECKBOX_PREVIEW: case CHECKBOX_PREVIEW:
case CHECKBOX_SELECTION: case CHECKBOX_SELECTION:
nPropertyId = PROPERTY_FLAG_CHECKED; nPropertyId = PropFlags::Checked;
break; break;
case LISTBOX_FILTER: case LISTBOX_FILTER:
...@@ -379,7 +369,7 @@ namespace svt ...@@ -379,7 +369,7 @@ namespace svt
case LISTBOX_IMAGE_TEMPLATE: case LISTBOX_IMAGE_TEMPLATE:
if ( ControlActions::SET_SELECT_ITEM == _nControlAction ) if ( ControlActions::SET_SELECT_ITEM == _nControlAction )
{ {
nPropertyId = PROPERTY_FLAG_SELECTEDITEMINDEX; nPropertyId = PropFlags::SelectedItemIndex;
} }
else else
{ {
...@@ -390,7 +380,7 @@ namespace svt ...@@ -390,7 +380,7 @@ namespace svt
} }
} }
if ( -1 != nPropertyId ) if ( PropFlags::Unknown != nPropertyId )
implSetControlProperty( _nControlId, pControl, nPropertyId, _rValue ); implSetControlProperty( _nControlId, pControl, nPropertyId, _rValue );
} }
} }
...@@ -404,10 +394,10 @@ namespace svt ...@@ -404,10 +394,10 @@ namespace svt
DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" ); DBG_ASSERT( pControl, "OControlAccess::GetValue: don't have this control in the current mode!" );
if ( pControl ) if ( pControl )
{ {
sal_Int16 nPropertyId = -1; PropFlags nPropertyId = PropFlags::Unknown;
if ( ControlActions::SET_HELP_URL == _nControlAction ) if ( ControlActions::SET_HELP_URL == _nControlAction )
{ {
nPropertyId = PROPERTY_FLAG_HELPURL; nPropertyId = PropFlags::HelpUrl;
} }
else else
{ {
...@@ -420,7 +410,7 @@ namespace svt ...@@ -420,7 +410,7 @@ namespace svt
case CHECKBOX_LINK: case CHECKBOX_LINK:
case CHECKBOX_PREVIEW: case CHECKBOX_PREVIEW:
case CHECKBOX_SELECTION: case CHECKBOX_SELECTION:
nPropertyId = PROPERTY_FLAG_CHECKED; nPropertyId = PropFlags::Checked;
break; break;
case LISTBOX_FILTER: case LISTBOX_FILTER:
...@@ -440,13 +430,13 @@ namespace svt ...@@ -440,13 +430,13 @@ namespace svt
switch ( _nControlAction ) switch ( _nControlAction )
{ {
case ControlActions::GET_SELECTED_ITEM: case ControlActions::GET_SELECTED_ITEM:
nPropertyId = PROPERTY_FLAG_SELECTEDITEM; nPropertyId = PropFlags::SelectedItem;
break; break;
case ControlActions::GET_SELECTED_ITEM_INDEX: case ControlActions::GET_SELECTED_ITEM_INDEX:
nPropertyId = PROPERTY_FLAG_SELECTEDITEMINDEX; nPropertyId = PropFlags::SelectedItemIndex;
break; break;
case ControlActions::GET_ITEMS: case ControlActions::GET_ITEMS:
nPropertyId = PROPERTY_FLAG_LISTITEMS; nPropertyId = PropFlags::ListItems;
break; break;
default: default:
SAL_WARN( "fpicker.office", "OControlAccess::GetValue: invalid control action for the listbox!" ); SAL_WARN( "fpicker.office", "OControlAccess::GetValue: invalid control action for the listbox!" );
...@@ -456,7 +446,7 @@ namespace svt ...@@ -456,7 +446,7 @@ namespace svt
} }
} }
if ( -1 != nPropertyId ) if ( PropFlags::Unknown != nPropertyId )
aRet = implGetControlProperty( pControl, nPropertyId ); aRet = implGetControlProperty( pControl, nPropertyId );
} }
...@@ -536,7 +526,7 @@ namespace svt ...@@ -536,7 +526,7 @@ namespace svt
} }
void OControlAccess::implSetControlProperty( sal_Int16 _nControlId, Control* _pControl, sal_Int16 _nProperty, const Any& _rValue, bool _bIgnoreIllegalArgument ) void OControlAccess::implSetControlProperty( sal_Int16 _nControlId, Control* _pControl, PropFlags _nProperty, const Any& _rValue, bool _bIgnoreIllegalArgument )
{ {
if ( !_pControl ) if ( !_pControl )
_pControl = m_pFilePickerController->getControl( _nControlId ); _pControl = m_pFilePickerController->getControl( _nControlId );
...@@ -549,7 +539,7 @@ namespace svt ...@@ -549,7 +539,7 @@ namespace svt
switch ( _nProperty ) switch ( _nProperty )
{ {
case PROPERTY_FLAG_TEXT: case PropFlags::Text:
{ {
OUString sText; OUString sText;
if ( _rValue >>= sText ) if ( _rValue >>= sText )
...@@ -563,7 +553,7 @@ namespace svt ...@@ -563,7 +553,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_ENDBALED: case PropFlags::Enabled:
{ {
bool bEnabled = false; bool bEnabled = false;
if ( _rValue >>= bEnabled ) if ( _rValue >>= bEnabled )
...@@ -577,7 +567,7 @@ namespace svt ...@@ -577,7 +567,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_VISIBLE: case PropFlags::Visible:
{ {
bool bVisible = false; bool bVisible = false;
if ( _rValue >>= bVisible ) if ( _rValue >>= bVisible )
...@@ -591,7 +581,7 @@ namespace svt ...@@ -591,7 +581,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_HELPURL: case PropFlags::HelpUrl:
{ {
OUString sHelpURL; OUString sHelpURL;
if ( _rValue >>= sHelpURL ) if ( _rValue >>= sHelpURL )
...@@ -605,7 +595,7 @@ namespace svt ...@@ -605,7 +595,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_LISTITEMS: case PropFlags::ListItems:
{ {
DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" ); "OControlAccess::implSetControlProperty: invalid control/property combination!" );
...@@ -635,7 +625,7 @@ namespace svt ...@@ -635,7 +625,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_SELECTEDITEM: case PropFlags::SelectedItem:
{ {
DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" ); "OControlAccess::implSetControlProperty: invalid control/property combination!" );
...@@ -652,7 +642,7 @@ namespace svt ...@@ -652,7 +642,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_SELECTEDITEMINDEX: case PropFlags::SelectedItemIndex:
{ {
DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" ); "OControlAccess::implSetControlProperty: invalid control/property combination!" );
...@@ -669,7 +659,7 @@ namespace svt ...@@ -669,7 +659,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_CHECKED: case PropFlags::Checked:
{ {
DBG_ASSERT( WINDOW_CHECKBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_CHECKBOX == _pControl->GetType(),
"OControlAccess::implSetControlProperty: invalid control/property combination!" ); "OControlAccess::implSetControlProperty: invalid control/property combination!" );
...@@ -692,30 +682,30 @@ namespace svt ...@@ -692,30 +682,30 @@ namespace svt
} }
Any OControlAccess::implGetControlProperty( Control* _pControl, sal_Int16 _nProperty ) const Any OControlAccess::implGetControlProperty( Control* _pControl, PropFlags _nProperty ) const
{ {
DBG_ASSERT( _pControl, "OControlAccess::implGetControlProperty: invalid argument, this will crash!" ); DBG_ASSERT( _pControl, "OControlAccess::implGetControlProperty: invalid argument, this will crash!" );
Any aReturn; Any aReturn;
switch ( _nProperty ) switch ( _nProperty )
{ {
case PROPERTY_FLAG_TEXT: case PropFlags::Text:
aReturn <<= OUString( _pControl->GetText() ); aReturn <<= OUString( _pControl->GetText() );
break; break;
case PROPERTY_FLAG_ENDBALED: case PropFlags::Enabled:
aReturn <<= _pControl->IsEnabled(); aReturn <<= _pControl->IsEnabled();
break; break;
case PROPERTY_FLAG_VISIBLE: case PropFlags::Visible:
aReturn <<= _pControl->IsVisible(); aReturn <<= _pControl->IsVisible();
break; break;
case PROPERTY_FLAG_HELPURL: case PropFlags::HelpUrl:
aReturn <<= getHelpURL( _pControl, m_pFileView == _pControl ); aReturn <<= getHelpURL( _pControl, m_pFileView == _pControl );
break; break;
case PROPERTY_FLAG_LISTITEMS: case PropFlags::ListItems:
{ {
DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" ); "OControlAccess::implGetControlProperty: invalid control/property combination!" );
...@@ -729,7 +719,7 @@ namespace svt ...@@ -729,7 +719,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_SELECTEDITEM: case PropFlags::SelectedItem:
{ {
DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" ); "OControlAccess::implGetControlProperty: invalid control/property combination!" );
...@@ -742,7 +732,7 @@ namespace svt ...@@ -742,7 +732,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_SELECTEDITEMINDEX: case PropFlags::SelectedItemIndex:
{ {
DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_LISTBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" ); "OControlAccess::implGetControlProperty: invalid control/property combination!" );
...@@ -755,7 +745,7 @@ namespace svt ...@@ -755,7 +745,7 @@ namespace svt
} }
break; break;
case PROPERTY_FLAG_CHECKED: case PropFlags::Checked:
DBG_ASSERT( WINDOW_CHECKBOX == _pControl->GetType(), DBG_ASSERT( WINDOW_CHECKBOX == _pControl->GetType(),
"OControlAccess::implGetControlProperty: invalid control/property combination!" ); "OControlAccess::implGetControlProperty: invalid control/property combination!" );
......
...@@ -24,6 +24,24 @@ ...@@ -24,6 +24,24 @@
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
#include "pickercallbacks.hxx" #include "pickercallbacks.hxx"
#include <o3tl/typed_flags_set.hxx>
enum class PropFlags {
Unknown = -1, // used as an error sentinel
NONE = 0x0000,
Text = 0x0001,
Enabled = 0x0002,
Visible = 0x0004,
HelpUrl = 0x0008,
ListItems = 0x0010,
SelectedItem = 0x0020,
SelectedItemIndex = 0x0040,
Checked = 0x0080,
};
namespace o3tl {
template<> struct typed_flags<PropFlags> : is_typed_flags<PropFlags, 0x00ff> {};
}
namespace svt namespace svt
...@@ -79,7 +97,7 @@ namespace svt ...@@ -79,7 +97,7 @@ namespace svt
the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL. the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL.
@param _nProperty @param _nProperty
the property to set the property to set
See PROPERTY_FLAG_* See PropFlags::*
@param _rValue @param _rValue
the value to set the value to set
@param _bIgnoreIllegalArgument @param _bIgnoreIllegalArgument
...@@ -87,10 +105,10 @@ namespace svt ...@@ -87,10 +105,10 @@ namespace svt
*/ */
void implSetControlProperty( void implSetControlProperty(
sal_Int16 _nControlId, sal_Int16 _nControlId,
Control* _pControl, sal_Int16 _nProperty, const css::uno::Any& _rValue, Control* _pControl, PropFlags _nProperty, const css::uno::Any& _rValue,
bool _bIgnoreIllegalArgument = true ); bool _bIgnoreIllegalArgument = true );
Control* implGetControl( const OUString& _rControlName, sal_Int16* _pId, sal_Int32* _pPropertyMask = nullptr ) const; Control* implGetControl( const OUString& _rControlName, sal_Int16* _pId, PropFlags* _pPropertyMask = nullptr ) const;
/** implements the various methods for retrieving properties from controls /** implements the various methods for retrieving properties from controls
...@@ -99,10 +117,10 @@ namespace svt ...@@ -99,10 +117,10 @@ namespace svt
@PRECOND not <NULL/> @PRECOND not <NULL/>
@param _nProperty @param _nProperty
the property to retrieve the property to retrieve
See PROPERTY_FLAG_* See PropFlags::*
@return @return
*/ */
css::uno::Any implGetControlProperty( Control* _pControl, sal_Int16 _nProperty ) const; css::uno::Any implGetControlProperty( Control* _pControl, PropFlags _nProperty ) const;
static void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const css::uno::Any& _rValue ); static void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const css::uno::Any& _rValue );
......
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