[Libreoffice-commits] convert SfxItemState constants to a proper enum
Stephan Bergmann
sbergman at redhat.com
Fri Sep 5 02:44:27 PDT 2014
On 07/23/2014 01:26 PM, Noel Grandin wrote:
> commit 88a874fcb3a3735634c638f34dcb0cc7bd2260ac
> Author: Noel Grandin <noel at peralex.com>
> Date: Wed Jul 23 10:48:58 2014 +0200
>
> convert SfxItemState constants to a proper enum
>
> and while we're at it
> - use the enum type all over the place instead of passing around
> sal_uInt16
> - don't use bitwise logic on enum values
> - use enum values instead of numeric constants
>
> Change-Id: I7f24cb4d242e1c00703e7bbcf1a00c18ef1e9fd4
>
> diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
> index 14892aa..6bf9cab 100644
> --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
> +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
> @@ -153,7 +153,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
> bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
> m_pCbShowDescription->Check( bCheck );
>
> - if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
> + if( aState != SFX_ITEM_DEFAULT )
> m_pCbShowDescription->Hide();
> }
>
Is that change sound? If e.g. aState is SFX_ITEM_SET (0x0030), the
original condition was false while the new condition will be true.
Stephan
[...]
> diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
> index 892f2ad..718a78b 100644
> --- a/include/svl/poolitem.hxx
> +++ b/include/svl/poolitem.hxx
> @@ -130,16 +130,15 @@ enum SfxItemPresentation
>
>
>
> -typedef sal_uInt16 SfxItemState;
> -
> -#define SFX_ITEM_UNKNOWN 0x0000
> -
> -#define SFX_ITEM_DISABLED 0x0001
> -#define SFX_ITEM_READONLY 0x0002
> -
> -#define SFX_ITEM_DONTCARE 0x0010
> -#define SFX_ITEM_DEFAULT 0x0020
> -#define SFX_ITEM_SET 0x0030
> +enum SfxItemState {
> + // These values have to match the values in the com::sun::star::frame::status::ItemState IDL
> + SFX_ITEM_UNKNOWN = 0,
> + SFX_ITEM_DISABLED = 0x0001,
> + SFX_ITEM_READONLY = 0x0002,
> + SFX_ITEM_DONTCARE = 0x0010,
> + SFX_ITEM_DEFAULT = 0x0020,
> + SFX_ITEM_SET = 0x0030
> +};
>
> // old stuff - dont use!!!
> #define SFX_ITEM_AVAILABLE SFX_ITEM_DEFAULT
More information about the LibreOffice
mailing list