diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-10 13:52:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-12 09:54:23 +0200 |
commit | a651dbcfca9e198b5c2561076961504586bc6bea (patch) | |
tree | 812eee16af9bc3c4c75b8b45a4c126f99ad1bab3 /include/svx/svdsob.hxx | |
parent | 9b5ce4023d35c4cc82f7b17e79b8fedbcb1367dd (diff) |
convert SdrLayerId to strong_int
Also
- rename SetOfByte to SdrLayerIDSet
- add asserts in SdrLayerAdmin::GetUniqueLayerID so that we don't
allocate overlapping SdrLayerID values
- add a new constant SDRLAYERPOS_NOTFOUND to be returned from
SdrLayerAdmin::GetLayerPos
Change-Id: I3bb3489f9338e3d02c4040bcbd811744699941c8
Reviewed-on: https://gerrit.libreoffice.org/37467
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svx/svdsob.hxx')
-rw-r--r-- | include/svx/svdsob.hxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/include/svx/svdsob.hxx b/include/svx/svdsob.hxx index 510087c1914a..ac84a9bada1b 100644 --- a/include/svx/svdsob.hxx +++ b/include/svx/svdsob.hxx @@ -23,40 +23,40 @@ #include <com/sun/star/uno/Any.hxx> #include <svx/svxdllapi.h> +#include <svx/svdtypes.hxx> /* - Declaration of a static set type. The set can collect elements - from 0 to 255 and it takes always 32 Bytes. + Stores a bitfield of the layer values that have been set. */ -class SVX_DLLPUBLIC SetOfByte +class SVX_DLLPUBLIC SdrLayerIDSet { protected: sal_uInt8 aData[32]; public: - explicit SetOfByte(bool bInitVal = false) + explicit SdrLayerIDSet(bool bInitVal = false) { memset(aData, bInitVal ? 0xFF : 0x00, sizeof(aData)); } - bool operator!=(const SetOfByte& rCmpSet) const + bool operator!=(const SdrLayerIDSet& rCmpSet) const { return (memcmp(aData, rCmpSet.aData, sizeof(aData))!=0); } - void Set(sal_uInt8 a) + void Set(SdrLayerID a) { - aData[a/8] |= 1<<a%8; + aData[sal_uInt8(a)/8] |= 1 << (sal_uInt8(a) % 8); } - void Clear(sal_uInt8 a) + void Clear(SdrLayerID a) { - aData[a/8] &= ~(1<<a%8); + aData[sal_uInt8(a)/8] &= ~(1 << (sal_uInt8(a) % 8)); } - void Set(sal_uInt8 a, bool b) + void Set(SdrLayerID a, bool b) { if(b) Set(a); @@ -64,9 +64,9 @@ public: Clear(a); } - bool IsSet(sal_uInt8 a) const + bool IsSet(SdrLayerID a) const { - return (aData[a/8] & 1<<a%8) != 0; + return (aData[sal_uInt8(a)/8] & 1<<sal_uInt8(a)%8) != 0; } void SetAll() @@ -81,7 +81,7 @@ public: bool IsEmpty() const; - void operator&=(const SetOfByte& r2ndSet); + void operator&=(const SdrLayerIDSet& r2ndSet); // initialize this set with a uno sequence of sal_Int8 void PutValue(const css::uno::Any & rAny); |