diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-19 15:37:17 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-20 07:55:53 +0000 |
commit | 9bbd828f81b9139dfeaf5e211d476f1b2f72e7c2 (patch) | |
tree | a41aedbf433f6c3c609aac293008121ea4b56940 /reportdesign | |
parent | d09af095b52b0d9f2733ac139e6ced16837b8e4b (diff) |
Convert PROP_FLAG to scoped enum
Change-Id: Ia08a22cffa07c6c3a82497671d0e246fc5aa88a0
Reviewed-on: https://gerrit.libreoffice.org/25163
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/ui/inc/metadata.hxx | 36 | ||||
-rw-r--r-- | reportdesign/source/ui/inspection/DataProviderHandler.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/inspection/GeometryHandler.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/inspection/metadata.cxx | 102 |
4 files changed, 72 insertions, 70 deletions
diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index ab1c7dc9e4ae..7be6d024d463 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -23,6 +23,24 @@ #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <o3tl/typed_flags_set.hxx> + + //= UI flags (for all browseable properties) +enum class PropUIFlags { + NONE = 0x0001, // no special flag + Enum = 0x0002, // the property is some kind of enum property, i.e. its // value is chosen from a fixed list of possible values + EnumOne = 0x0004, // the property is an enum property starting with 1 + // (note that this includes PropUIFlags::Enum) + Composeable = 0x0008, // the property is "composeable", i.e. an intersection of property + // sets should expose it, if all elements do + Experimental = 0x0010, // the property is experimental, i.e. should not appear in the + // UI, unless experimental properties are enabled by a configuraiton + // option + DataProperty = 0x0020 // the property is to appear on the "Data" page +}; +namespace o3tl { + template<> struct typed_flags<PropUIFlags> : is_typed_flags<PropUIFlags, 0x003f> {}; +} namespace rptui @@ -50,7 +68,7 @@ namespace rptui static sal_Int32 getPropertyId(const OUString& _rName); static OUString getPropertyTranslation(sal_Int32 _nId); static OString getPropertyHelpId(sal_Int32 _nId); - static sal_uInt32 getPropertyUIFlags(sal_Int32 _nId); + static PropUIFlags getPropertyUIFlags(sal_Int32 _nId); static void getExcludeProperties(::std::vector< css::beans::Property >& _rExcludeProperties,const css::uno::Reference< css::inspection::XPropertyHandler >& _xFormComponentHandler); static bool isComposable( @@ -76,22 +94,6 @@ namespace rptui }; - //= UI flags (for all browseable properties) - - -#define PROP_FLAG_NONE 0x00000001 // no special flag -#define PROP_FLAG_ENUM 0x00000002 // the property is some kind of enum property, i.e. its - // value is chosen from a fixed list of possible values -#define PROP_FLAG_ENUM_ONE 0x00000004 // the property is an enum property starting with 1 - // (note that this includes PROP_FLAG_ENUM) -#define PROP_FLAG_COMPOSEABLE 0x00000008 // the property is "composeable", i.e. an intersection of property - // sets should expose it, if all elements do -#define PROP_FLAG_EXPERIMENTAL 0x00000010 // the property is experimental, i.e. should not appear in the - // UI, unless experimental properties are enabled by a configuraiton - // option -#define PROP_FLAG_DATA_PROPERTY 0x00000020 // the property is to appear on the "Data" page - - //= property ids (for all browseable properties) //= The ID is used for the view order in the property browser. diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index bdcca01828c3..0d4dff5affbb 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -280,7 +280,7 @@ inspection::LineDescriptor SAL_CALL DataProviderHandler::describePropertyLine(co } if ( nId != -1 ) { - aOut.Category = ((OPropertyInfoService::getPropertyUIFlags(nId ) & PROP_FLAG_DATA_PROPERTY) != 0) ? + aOut.Category = (OPropertyInfoService::getPropertyUIFlags(nId ) & PropUIFlags::DataProperty) ? OUString("Data") : OUString("General"); diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 9ed84a2c871d..de42f1fb5bfe 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -844,7 +844,7 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const if ( nId != -1 ) { - aOut.Category = ((OPropertyInfoService::getPropertyUIFlags(nId ) & PROP_FLAG_DATA_PROPERTY) != 0) ? + aOut.Category = (OPropertyInfoService::getPropertyUIFlags(nId ) & PropUIFlags::DataProperty) ? OUString("Data") : OUString("General"); diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index b0c6c4cbf975..e9882d71937e 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -44,19 +44,19 @@ namespace rptui OUString sTranslation; OString sHelpId; sal_Int32 nId; - sal_uInt32 nUIFlags; + PropUIFlags nUIFlags; OPropertyInfoImpl( const OUString& rName, sal_Int32 _nId, const OUString& aTranslation, const OString& _sHelpId, - sal_uInt32 _nUIFlags); + PropUIFlags _nUIFlags); }; OPropertyInfoImpl::OPropertyInfoImpl(const OUString& _rName, sal_Int32 _nId, - const OUString& aString, const OString& sHid, sal_uInt32 _nUIFlags) + const OUString& aString, const OString& sHid, PropUIFlags _nUIFlags) :sName(_rName) ,sTranslation(aString) ,sHelpId(sHid) @@ -83,10 +83,10 @@ namespace rptui OUString( ModuleRes( RID_STR_##uinameres ) ), HID_RPT_PROP_##helpid, flags ) #define DEF_INFO_1( ident, uinameres, helpid, flag1 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 ) + DEF_INFO( ident, uinameres, helpid, PropUIFlags::flag1 ) #define DEF_INFO_2( ident, uinameres, helpid, flag1, flag2 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 ) + DEF_INFO( ident, uinameres, helpid, PropUIFlags::flag1 | PropUIFlags::flag2 ) sal_uInt16 OPropertyInfoService::s_nCount = 0; OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = nullptr; @@ -104,48 +104,48 @@ namespace rptui /* DEF_INFO_?( propname and id, resoure id, help id, flags ), */ - DEF_INFO_1( FORCENEWPAGE, FORCENEWPAGE, FORCENEWPAGE, COMPOSEABLE ) - ,DEF_INFO_1( NEWROWORCOL, NEWROWORCOL, NEWROWORCOL, COMPOSEABLE ) - ,DEF_INFO_1( KEEPTOGETHER, KEEPTOGETHER, KEEPTOGETHER, COMPOSEABLE ) - ,DEF_INFO_1( CANGROW, CANGROW, CANGROW, COMPOSEABLE ) - ,DEF_INFO_1( CANSHRINK, CANSHRINK, CANSHRINK, COMPOSEABLE ) - ,DEF_INFO_1( REPEATSECTION, REPEATSECTION, REPEATSECTION, COMPOSEABLE ) - ,DEF_INFO_1( PRINTREPEATEDVALUES, PRINTREPEATEDVALUES, PRINTREPEATEDVALUES, COMPOSEABLE ) - ,DEF_INFO_1( CONDITIONALPRINTEXPRESSION, CONDITIONALPRINTEXPRESSION, CONDITIONALPRINTEXPRESSION, COMPOSEABLE ) - ,DEF_INFO_1( STARTNEWCOLUMN, STARTNEWCOLUMN, STARTNEWCOLUMN, COMPOSEABLE ) - ,DEF_INFO_1( RESETPAGENUMBER, RESETPAGENUMBER, RESETPAGENUMBER, COMPOSEABLE ) - ,DEF_INFO_1( PRINTWHENGROUPCHANGE, PRINTWHENGROUPCHANGE, PRINTWHENGROUPCHANGE, COMPOSEABLE ) - ,DEF_INFO_1( VISIBLE, VISIBLE, VISIBLE, COMPOSEABLE ) - ,DEF_INFO_1( GROUPKEEPTOGETHER, GROUPKEEPTOGETHER, GROUPKEEPTOGETHER, COMPOSEABLE ) - ,DEF_INFO_1( PAGEHEADEROPTION, PAGEHEADEROPTION, PAGEHEADEROPTION, COMPOSEABLE ) - ,DEF_INFO_1( PAGEFOOTEROPTION, PAGEFOOTEROPTION, PAGEFOOTEROPTION, COMPOSEABLE ) - ,DEF_INFO_1( POSITIONX, POSITIONX, RPT_POSITIONX, COMPOSEABLE ) - ,DEF_INFO_1( POSITIONY, POSITIONY, RPT_POSITIONY, COMPOSEABLE ) - ,DEF_INFO_1( WIDTH, WIDTH, RPT_WIDTH, COMPOSEABLE ) - ,DEF_INFO_1( HEIGHT, HEIGHT, RPT_HEIGHT, COMPOSEABLE ) - ,DEF_INFO_1( FONT, FONT, RPT_FONT, COMPOSEABLE ) - ,DEF_INFO_1( PREEVALUATED, PREEVALUATED, PREEVALUATED, COMPOSEABLE ) - ,DEF_INFO_1( DEEPTRAVERSING, DEEPTRAVERSING, DEEPTRAVERSING, COMPOSEABLE ) - ,DEF_INFO_1( FORMULA, FORMULA, FORMULA, COMPOSEABLE ) - ,DEF_INFO_1( INITIALFORMULA, INITIALFORMULA, INITIALFORMULA, COMPOSEABLE ) - ,DEF_INFO_2( TYPE, TYPE, TYPE, COMPOSEABLE,DATA_PROPERTY ) - ,DEF_INFO_2( DATAFIELD, DATAFIELD, DATAFIELD, COMPOSEABLE,DATA_PROPERTY ) - ,DEF_INFO_2( FORMULALIST, FORMULALIST, FORMULALIST, COMPOSEABLE,DATA_PROPERTY ) - ,DEF_INFO_2( SCOPE, SCOPE, SCOPE, COMPOSEABLE,DATA_PROPERTY ) - ,DEF_INFO_1( PRESERVEIRI, PRESERVEIRI, PRESERVEIRI, COMPOSEABLE ) - ,DEF_INFO_1( BACKCOLOR, BACKCOLOR, BACKCOLOR, COMPOSEABLE ) - ,DEF_INFO_1( CONTROLBACKGROUND, BACKCOLOR, BACKCOLOR, COMPOSEABLE ) - ,DEF_INFO_1( BACKTRANSPARENT, BACKTRANSPARENT, BACKTRANSPARENT, COMPOSEABLE ) + DEF_INFO_1( FORCENEWPAGE, FORCENEWPAGE, FORCENEWPAGE, Composeable ) + ,DEF_INFO_1( NEWROWORCOL, NEWROWORCOL, NEWROWORCOL, Composeable ) + ,DEF_INFO_1( KEEPTOGETHER, KEEPTOGETHER, KEEPTOGETHER, Composeable ) + ,DEF_INFO_1( CANGROW, CANGROW, CANGROW, Composeable ) + ,DEF_INFO_1( CANSHRINK, CANSHRINK, CANSHRINK, Composeable ) + ,DEF_INFO_1( REPEATSECTION, REPEATSECTION, REPEATSECTION, Composeable ) + ,DEF_INFO_1( PRINTREPEATEDVALUES, PRINTREPEATEDVALUES, PRINTREPEATEDVALUES, Composeable ) + ,DEF_INFO_1( CONDITIONALPRINTEXPRESSION, CONDITIONALPRINTEXPRESSION, CONDITIONALPRINTEXPRESSION, Composeable ) + ,DEF_INFO_1( STARTNEWCOLUMN, STARTNEWCOLUMN, STARTNEWCOLUMN, Composeable ) + ,DEF_INFO_1( RESETPAGENUMBER, RESETPAGENUMBER, RESETPAGENUMBER, Composeable ) + ,DEF_INFO_1( PRINTWHENGROUPCHANGE, PRINTWHENGROUPCHANGE, PRINTWHENGROUPCHANGE, Composeable ) + ,DEF_INFO_1( VISIBLE, VISIBLE, VISIBLE, Composeable ) + ,DEF_INFO_1( GROUPKEEPTOGETHER, GROUPKEEPTOGETHER, GROUPKEEPTOGETHER, Composeable ) + ,DEF_INFO_1( PAGEHEADEROPTION, PAGEHEADEROPTION, PAGEHEADEROPTION, Composeable ) + ,DEF_INFO_1( PAGEFOOTEROPTION, PAGEFOOTEROPTION, PAGEFOOTEROPTION, Composeable ) + ,DEF_INFO_1( POSITIONX, POSITIONX, RPT_POSITIONX, Composeable ) + ,DEF_INFO_1( POSITIONY, POSITIONY, RPT_POSITIONY, Composeable ) + ,DEF_INFO_1( WIDTH, WIDTH, RPT_WIDTH, Composeable ) + ,DEF_INFO_1( HEIGHT, HEIGHT, RPT_HEIGHT, Composeable ) + ,DEF_INFO_1( FONT, FONT, RPT_FONT, Composeable ) + ,DEF_INFO_1( PREEVALUATED, PREEVALUATED, PREEVALUATED, Composeable ) + ,DEF_INFO_1( DEEPTRAVERSING, DEEPTRAVERSING, DEEPTRAVERSING, Composeable ) + ,DEF_INFO_1( FORMULA, FORMULA, FORMULA, Composeable ) + ,DEF_INFO_1( INITIALFORMULA, INITIALFORMULA, INITIALFORMULA, Composeable ) + ,DEF_INFO_2( TYPE, TYPE, TYPE, Composeable,DataProperty ) + ,DEF_INFO_2( DATAFIELD, DATAFIELD, DATAFIELD, Composeable,DataProperty ) + ,DEF_INFO_2( FORMULALIST, FORMULALIST, FORMULALIST, Composeable,DataProperty ) + ,DEF_INFO_2( SCOPE, SCOPE, SCOPE, Composeable,DataProperty ) + ,DEF_INFO_1( PRESERVEIRI, PRESERVEIRI, PRESERVEIRI, Composeable ) + ,DEF_INFO_1( BACKCOLOR, BACKCOLOR, BACKCOLOR, Composeable ) + ,DEF_INFO_1( CONTROLBACKGROUND, BACKCOLOR, BACKCOLOR, Composeable ) + ,DEF_INFO_1( BACKTRANSPARENT, BACKTRANSPARENT, BACKTRANSPARENT, Composeable ) ,DEF_INFO_1( CONTROLBACKGROUNDTRANSPARENT, CONTROLBACKGROUNDTRANSPARENT, - CONTROLBACKGROUNDTRANSPARENT, COMPOSEABLE ) - ,DEF_INFO_1( CHARTTYPE, CHARTTYPE, CHARTTYPE, COMPOSEABLE ) - ,DEF_INFO_1( PREVIEW_COUNT, PREVIEW_COUNT, PREVIEW_COUNT, COMPOSEABLE ) - ,DEF_INFO_2( MASTERFIELDS, MASTERFIELDS, MASTERFIELDS, COMPOSEABLE,DATA_PROPERTY ) - ,DEF_INFO_2( DETAILFIELDS, DETAILFIELDS, DETAILFIELDS, COMPOSEABLE,DATA_PROPERTY) - ,DEF_INFO_1( AREA, AREA, AREA, COMPOSEABLE ) - ,DEF_INFO_2( MIMETYPE, MIMETYPE, MIMETYPE, COMPOSEABLE,DATA_PROPERTY ) - ,DEF_INFO_1( PARAADJUST, PARAADJUST, PARAADJUST, COMPOSEABLE ) - ,DEF_INFO_1( VERTICALALIGN, VERTICALALIGN, VERTICALALIGN, COMPOSEABLE ) + CONTROLBACKGROUNDTRANSPARENT, Composeable ) + ,DEF_INFO_1( CHARTTYPE, CHARTTYPE, CHARTTYPE, Composeable ) + ,DEF_INFO_1( PREVIEW_COUNT, PREVIEW_COUNT, PREVIEW_COUNT, Composeable ) + ,DEF_INFO_2( MASTERFIELDS, MASTERFIELDS, MASTERFIELDS, Composeable,DataProperty ) + ,DEF_INFO_2( DETAILFIELDS, DETAILFIELDS, DETAILFIELDS, Composeable,DataProperty) + ,DEF_INFO_1( AREA, AREA, AREA, Composeable ) + ,DEF_INFO_2( MIMETYPE, MIMETYPE, MIMETYPE, Composeable,DataProperty ) + ,DEF_INFO_1( PARAADJUST, PARAADJUST, PARAADJUST, Composeable ) + ,DEF_INFO_1( VERTICALALIGN, VERTICALALIGN, VERTICALALIGN, Composeable ) }; s_pPropertyInfos = aPropertyInfos; @@ -177,10 +177,10 @@ namespace rptui } - sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) + PropUIFlags OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) { const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->nUIFlags : 0; + return (pInfo) ? pInfo->nUIFlags : PropUIFlags::NONE; } @@ -189,7 +189,7 @@ namespace rptui // intialisierung if(!s_pPropertyInfos) getPropertyInfo(); - OPropertyInfoImpl aSearch(_rName, 0L, OUString(), "", 0); + OPropertyInfoImpl aSearch(_rName, 0L, OUString(), "", PropUIFlags::NONE); const OPropertyInfoImpl* pPropInfo = ::std::lower_bound( s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() ); @@ -221,8 +221,8 @@ namespace rptui sal_Int32 nId = getPropertyId( _rPropertyName ); if ( nId != -1 ) { - sal_uInt32 nFlags = getPropertyUIFlags( nId ); - return ( nFlags & PROP_FLAG_COMPOSEABLE ) != 0; + PropUIFlags nFlags = getPropertyUIFlags( nId ); + return bool( nFlags & PropUIFlags::Composeable ); } return _rxFormComponentHandler->isComposable( _rPropertyName ); |