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 /svx | |
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 'svx')
27 files changed, 86 insertions, 90 deletions
diff --git a/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx index 416ca0fb633b..af2dd6644998 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofgroup.hxx @@ -37,7 +37,7 @@ namespace sdr virtual drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const override; private: - virtual bool isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const override; + virtual bool isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const override; }; } // end of namespace contact } // end of namespace sdr diff --git a/svx/inc/sxlayitm.hxx b/svx/inc/sxlayitm.hxx index 47fba3a9b616..9516f4efb9de 100644 --- a/svx/inc/sxlayitm.hxx +++ b/svx/inc/sxlayitm.hxx @@ -26,8 +26,8 @@ class SdrLayerIdItem: public SfxUInt16Item { public: - SdrLayerIdItem(sal_uInt16 nId=0): SfxUInt16Item(SDRATTR_LAYERID,nId) {} - SdrLayerID GetValue() const { return (SdrLayerID)SfxUInt16Item::GetValue(); } + SdrLayerIdItem(SdrLayerID nId): SfxUInt16Item(SDRATTR_LAYERID,sal_uInt8(nId)) {} + SdrLayerID GetValue() const { return SdrLayerID(SfxUInt16Item::GetValue()); } virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override; }; diff --git a/svx/source/sdr/contact/displayinfo.cxx b/svx/source/sdr/contact/displayinfo.cxx index c3a219724d24..6a70a879fb88 100644 --- a/svx/source/sdr/contact/displayinfo.cxx +++ b/svx/source/sdr/contact/displayinfo.cxx @@ -39,7 +39,7 @@ namespace sdr } // Access to LayerInfos (which layers to process) - void DisplayInfo::SetProcessLayers(const SetOfByte& rSet) + void DisplayInfo::SetProcessLayers(const SdrLayerIDSet& rSet) { maProcessLayers = rSet; } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 75292d9b860f..f3e2a366a0f2 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -42,7 +42,7 @@ void createSubPrimitive3DVector( const sdr::contact::ViewContact& rCandidate, drawinglayer::primitive3d::Primitive3DContainer& o_rAllTarget, drawinglayer::primitive3d::Primitive3DContainer* o_pVisibleTarget, - const SetOfByte* pVisibleLayerSet, + const SdrLayerIDSet* pVisibleSdrLayerIDSet, const bool bTestSelectedVisibility) { const sdr::contact::ViewContactOfE3dScene* pViewContactOfE3dScene = dynamic_cast< const sdr::contact::ViewContactOfE3dScene* >(&rCandidate); @@ -64,7 +64,7 @@ void createSubPrimitive3DVector( rCandidate.GetViewContact(a), aNewAllTarget, o_pVisibleTarget ? &aNewVisibleTarget : nullptr, - pVisibleLayerSet, + pVisibleSdrLayerIDSet, bTestSelectedVisibility); } @@ -102,13 +102,13 @@ void createSubPrimitive3DVector( // test visibility. Primitive is visible when both tests are true (AND) bool bVisible(true); - if(pVisibleLayerSet) + if(pVisibleSdrLayerIDSet) { // test layer visibility const E3dObject& rE3dObject = pViewContactOfE3d->GetE3dObject(); const SdrLayerID aLayerID(rE3dObject.GetLayer()); - bVisible = pVisibleLayerSet->IsSet(aLayerID); + bVisible = pVisibleSdrLayerIDSet->IsSet(aLayerID); } if(bVisible && bTestSelectedVisibility) @@ -268,7 +268,7 @@ void ViewContactOfE3dScene::createSdrLightingAttribute() } drawinglayer::primitive2d::Primitive2DContainer ViewContactOfE3dScene::createScenePrimitive2DSequence( - const SetOfByte* pLayerVisibility) const + const SdrLayerIDSet* pLayerVisibility) const { drawinglayer::primitive2d::Primitive2DContainer xRetval; const sal_uInt32 nChildrenCount(GetObjectCount()); diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index 4a4a9e9e7d00..2cd53ba26509 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -82,7 +82,7 @@ namespace sdr // support ghosted for now. This is no problem currently but would need to be // added when sub-groups in 3d will be added one day. const ViewContactOfE3dScene& rViewContact = dynamic_cast< ViewContactOfE3dScene& >(GetViewContact()); - const SetOfByte& rVisibleLayers = rDisplayInfo.GetProcessLayers(); + const SdrLayerIDSet& rVisibleLayers = rDisplayInfo.GetProcessLayers(); drawinglayer::primitive2d::Primitive2DContainer xRetval(rViewContact.createScenePrimitive2DSequence(&rVisibleLayers)); if(!xRetval.empty()) diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index d67210f3b6e2..cb676b712f7f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -99,10 +99,10 @@ namespace sdr return xRetval; } - bool ViewObjectContactOfGroup::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const + bool ViewObjectContactOfGroup::isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const { - SetOfByte aObjectLayers; - getSdrObject().getMergedHierarchyLayerSet(aObjectLayers); + SdrLayerIDSet aObjectLayers; + getSdrObject().getMergedHierarchySdrLayerIDSet(aObjectLayers); aObjectLayers &= aLayers; return !aObjectLayers.IsEmpty(); } diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index cadd37c6b466..3c9aca92946b 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -72,15 +72,15 @@ namespace sdr rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); // Modify DisplayInfo for MasterPageContent collection; remember original layers and - // set combined LayerSet; set MasterPagePaint flag - const SetOfByte aRememberedLayers(rDisplayInfo.GetProcessLayers()); - SetOfByte aPreprocessedLayers(aRememberedLayers); + // set combined SdrLayerIDSet; set MasterPagePaint flag + const SdrLayerIDSet aRememberedLayers(rDisplayInfo.GetProcessLayers()); + SdrLayerIDSet aPreprocessedLayers(aRememberedLayers); aPreprocessedLayers &= rDescriptor.GetVisibleLayers(); rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); // check layer visibility (traditionally was member of layer 1) - if(aPreprocessedLayers.IsSet(1)) + if(aPreprocessedLayers.IsSet(SdrLayerID(1))) { // hide PageBackground for special DrawModes; historical reasons if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx index fca9e8d4017b..27216f237357 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx @@ -50,7 +50,7 @@ ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj() { } -bool ViewObjectContactOfSdrObj::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const +bool ViewObjectContactOfSdrObj::isPrimitiveVisibleOnAnyLayer(const SdrLayerIDSet& aLayers) const { return aLayers.IsSet(getSdrObject().GetLayer()); } diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx index ec3a4d21dba0..a1bdb47f8879 100644 --- a/svx/source/svdraw/sdrhittesthelper.cxx +++ b/svx/source/svdraw/sdrhittesthelper.cxx @@ -38,7 +38,7 @@ SdrObject* SdrObjectPrimitiveHit( const Point& rPnt, sal_uInt16 nTol, const SdrPageView& rSdrPageView, - const SetOfByte* pVisiLayer, + const SdrLayerIDSet* pVisiLayer, bool bTextOnly) { SdrObject* pResult = nullptr; @@ -95,7 +95,7 @@ SdrObject* SdrObjListPrimitiveHit( const Point& rPnt, sal_uInt16 nTol, const SdrPageView& rSdrPageView, - const SetOfByte* pVisiLayer, + const SdrLayerIDSet* pVisiLayer, bool bTextOnly) { size_t nObjNum(rList.GetObjCount()); diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index c35a8cd1aa20..a25cb3570c70 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -72,7 +72,7 @@ namespace sdr maOwnerPage.TRG_ClearMasterPage(); } - void MasterPageDescriptor::SetVisibleLayers(const SetOfByte& rNew) + void MasterPageDescriptor::SetVisibleLayers(const SdrLayerIDSet& rNew) { if(rNew != maVisibleLayers) { diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 76c903c15b92..85a0117df26f 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -307,7 +307,7 @@ void SdrPageWindow::RedrawAll( sdr::contact::ViewObjectContactRedirector* pRedir // get to be processed layers const bool bPrinter(GetPaintWindow().OutputToPrinter()); - SetOfByte aProcessLayers = bPrinter ? mpImpl->mrPageView.GetPrintableLayers() : mpImpl->mrPageView.GetVisibleLayers(); + SdrLayerIDSet aProcessLayers = bPrinter ? mpImpl->mrPageView.GetPrintableLayers() : mpImpl->mrPageView.GetVisibleLayers(); // create PaintInfoRec; use Rectangle only temporarily const vcl::Region& rRegion = GetPaintWindow().GetRedrawRegion(); @@ -361,7 +361,7 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId, // get the layers to process const bool bPrinter(GetPaintWindow().OutputToPrinter()); - SetOfByte aProcessLayers = bPrinter ? mpImpl->mrPageView.GetPrintableLayers() : mpImpl->mrPageView.GetVisibleLayers(); + SdrLayerIDSet aProcessLayers = bPrinter ? mpImpl->mrPageView.GetPrintableLayers() : mpImpl->mrPageView.GetVisibleLayers(); // is the given layer visible at all? if(aProcessLayers.IsSet(*pId)) diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 427242539cc3..ebac16e576af 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -205,7 +205,7 @@ SdrItemPool::SdrItemPool( rPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrYesNoItem(SDRATTR_OBJSIZEPROTECT, false); rPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem; rPoolDefaults[SDRATTR_OBJVISIBLE -SDRATTR_START]=new SdrObjVisibleItem; - rPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem; + rPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem(SdrLayerID(0)); rPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem; rPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SfxStringItem(SDRATTR_OBJECTNAME); rPoolDefaults[SDRATTR_ALLPOSITIONX -SDRATTR_START]=new SdrAllPositionXItem; diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 2a2b1e309446..2495c472c974 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -396,7 +396,7 @@ bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, sal_uInt16 nIdent, cons } SdrLayerID nLayer=pCreatePV->GetPage()->GetLayerAdmin().GetLayerID(aLay); - if (nLayer==SDRLAYER_NOTFOUND) nLayer=0; + if (nLayer==SDRLAYER_NOTFOUND) nLayer = SdrLayerID(0); if (!pCreatePV->GetLockedLayers().IsSet(nLayer) && pCreatePV->GetVisibleLayers().IsSet(nLayer)) { if(pPreparedFactoryObject) @@ -621,7 +621,7 @@ bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd) if(SDRLAYER_NOTFOUND == nLayer) { - nLayer=0; + nLayer = SdrLayerID(0); } pObj->SetLayer(nLayer); diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index ebbbf88b5aea..cdb208e571eb 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -197,11 +197,10 @@ void SdrEditView::DeleteLayer(const OUString& rName) { SdrLayerAdmin& rLA = mpModel->GetLayerAdmin(); SdrLayer* pLayer = rLA.GetLayer(rName); - sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer)); - if(SDRLAYER_NOTFOUND != nLayerNum) + if(pLayer) { - + sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer)); SdrLayerID nDelID = pLayer->GetID(); const bool bUndo = IsUndoEnabled(); @@ -955,7 +954,7 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInser { if (nOptions & SdrInsertFlags::SETDEFLAYER) { SdrLayerID nLayer=rPV.GetPage()->GetLayerAdmin().GetLayerID(maActualLayer); - if (nLayer==SDRLAYER_NOTFOUND) nLayer=0; + if (nLayer==SDRLAYER_NOTFOUND) nLayer=SdrLayerID(0); if (rPV.GetLockedLayers().IsSet(nLayer) || !rPV.GetVisibleLayers().IsSet(nLayer)) { SdrObject::Free( pObj ); // Layer locked or invisible return false; diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 67cd2d764c4e..062c828ca20c 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -789,7 +789,8 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr) const bool bSizProtect = false, bSizProtectDC = false; bool bPrintable = true, bPrintableDC = false; bool bVisible = true, bVisibleDC = false; - SdrLayerID nLayerId=0; bool bLayerDC=false; + SdrLayerID nLayerId(0); + bool bLayerDC=false; OUString aObjName; bool bObjNameDC=false,bObjNameSet=false; long nSnapPosX=0; bool bSnapPosXDC=false; diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index eeb7af14dd55..94e502646798 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -570,7 +570,7 @@ namespace const SdrObjList& rList, const Point& rPnt, const SdrPageView& rTextEditPV, - const SetOfByte& rVisLayers, + const SdrLayerIDSet& rVisLayers, Color& rCol) { if(!rList.GetModel()) @@ -614,7 +614,7 @@ namespace const SdrPage& rPage, const Point& rPnt, const SdrPageView& rTextEditPV, - const SetOfByte& rVisLayers, + const SdrLayerIDSet& rVisLayers, Color& rCol, bool bSkipBackgroundShape) { @@ -627,7 +627,7 @@ namespace { if(rPage.TRG_HasMasterPage()) { - SetOfByte aSet(rVisLayers); + SdrLayerIDSet aSet(rVisLayers); aSet &= rPage.TRG_GetMasterPageVisibleLayers(); SdrPage& rMasterPage = rPage.TRG_GetMasterPage(); diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx index a10c2aa14fcf..7027e004b5a9 100644 --- a/svx/source/svdraw/svdlayer.cxx +++ b/svx/source/svdraw/svdlayer.cxx @@ -24,7 +24,7 @@ #include "svdglob.hxx" #include "svx/svdstr.hrc" -bool SetOfByte::IsEmpty() const +bool SdrLayerIDSet::IsEmpty() const { for(sal_uInt8 i : aData) { @@ -35,7 +35,7 @@ bool SetOfByte::IsEmpty() const return true; } -void SetOfByte::operator&=(const SetOfByte& r2ndSet) +void SdrLayerIDSet::operator&=(const SdrLayerIDSet& r2ndSet) { for(sal_uInt16 i(0); i < 32; i++) { @@ -45,7 +45,7 @@ void SetOfByte::operator&=(const SetOfByte& r2ndSet) /** initialize this set with a uno sequence of sal_Int8 */ -void SetOfByte::PutValue( const css::uno::Any & rAny ) +void SdrLayerIDSet::PutValue( const css::uno::Any & rAny ) { css::uno::Sequence< sal_Int8 > aSeq; if( rAny >>= aSeq ) @@ -69,7 +69,7 @@ void SetOfByte::PutValue( const css::uno::Any & rAny ) /** returns a uno sequence of sal_Int8 */ -void SetOfByte::QueryValue( css::uno::Any & rAny ) const +void SdrLayerIDSet::QueryValue( css::uno::Any & rAny ) const { sal_Int16 nNumBytesSet = 0; sal_Int16 nIndex; @@ -229,16 +229,16 @@ void SdrLayerAdmin::NewStandardLayer(sal_uInt16 nPos) sal_uInt16 SdrLayerAdmin::GetLayerPos(SdrLayer* pLayer) const { - sal_uIntPtr nRet=SDRLAYER_NOTFOUND; + sal_uInt16 nRet=SDRLAYERPOS_NOTFOUND; if (pLayer!=nullptr) { std::vector<SdrLayer*>::const_iterator it = std::find(aLayer.begin(), aLayer.end(), pLayer); if (it==aLayer.end()) { - nRet=SDRLAYER_NOTFOUND; + nRet=SDRLAYERPOS_NOTFOUND; } else { nRet=it - aLayer.begin(); } } - return sal_uInt16(nRet); + return nRet; } SdrLayer* SdrLayerAdmin::GetLayer(const OUString& rName) @@ -275,15 +275,12 @@ SdrLayerID SdrLayerAdmin::GetLayerID(const OUString& rName) const return nRet; } -const SdrLayer* SdrLayerAdmin::GetLayerPerID(sal_uInt16 nID) const +const SdrLayer* SdrLayerAdmin::GetLayerPerID(SdrLayerID nID) const { - sal_uInt16 i=0; - const SdrLayer* pLay=nullptr; - while (i<GetLayerCount() && pLay==nullptr) { - if (nID==GetLayer(i)->GetID()) pLay=GetLayer(i); - else i++; - } - return pLay; + for (SdrLayer* pLayer : aLayer) + if (pLayer->GetID() == nID) + return pLayer; + return nullptr; } // Global LayerIDs begin at 0 and increase, @@ -292,31 +289,31 @@ const SdrLayer* SdrLayerAdmin::GetLayerPerID(sal_uInt16 nID) const SdrLayerID SdrLayerAdmin::GetUniqueLayerID() const { - SetOfByte aSet; - bool bDown = (pParent == nullptr); - sal_uInt16 j; - for (j=0; j<GetLayerCount(); j++) + SdrLayerIDSet aSet; + for (sal_uInt16 j=0; j<GetLayerCount(); j++) { aSet.Set(GetLayer(j)->GetID()); } - SdrLayerID i; - if (!bDown) + sal_uInt8 i; + if (pParent != nullptr) { - i=254; - while (i && aSet.IsSet(sal_uInt8(i))) + i = 254; + while (i && aSet.IsSet(SdrLayerID(i))) --i; + assert(i != 0); if (i == 0) - i=254; + i = 254; } else { - i=0; - while (i<=254 && aSet.IsSet(sal_uInt8(i))) + i = 0; + while (i<=254 && aSet.IsSet(SdrLayerID(i))) i++; + assert(i <= 254); if (i>254) - i=0; + i = 0; } - return i; + return SdrLayerID(i); } void SdrLayerAdmin::SetControlLayerName(const OUString& rNewName) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 478b0cbb65b7..d72bfbcf0bc8 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1621,7 +1621,7 @@ void SdrMarkView::SetMarkHdlSizePixel(sal_uInt16 nSiz) } } -SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay) const +SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const { if(((nOptions & SdrSearchOptions::IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible())) { @@ -1688,11 +1688,11 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT return pRet; } -SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const +SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj) const { return (*this).CheckSingleSdrObjectHit(rPnt,nTol,pOL,pPV,nOptions,pMVisLay,rpRootObj,nullptr); } -SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const +SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay, SdrObject*& rpRootObj,const SdrMarkList * pMarkList) const { SdrObject* pRet=nullptr; rpRootObj=nullptr; @@ -1797,7 +1797,7 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP while (pHitObj==nullptr && (bBack ? nPgNum<nPgAnz : nPgNum>0)) { SdrSearchOptions nTmpOptions=nOptions; if (!bBack) nPgNum--; - const SetOfByte* pMVisLay=nullptr; + const SdrLayerIDSet* pMVisLay=nullptr; SdrObjList* pObjList=nullptr; if (pbHitPassDirect!=nullptr) *pbHitPassDirect = true; if (nPgNum>=nPgAnz-1 || (bExtraPassForWholePage && nPgNum>=nPgAnz-2)) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 20edcb48e1fe..590262905d05 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -563,14 +563,14 @@ SdrLayerID SdrObject::GetLayer() const return mnLayerID; } -void SdrObject::getMergedHierarchyLayerSet(SetOfByte& rSet) const +void SdrObject::getMergedHierarchySdrLayerIDSet(SdrLayerIDSet& rSet) const { rSet.Set(GetLayer()); SdrObjList* pOL=GetSubList(); if (pOL!=nullptr) { const size_t nObjCount = pOL->GetObjCount(); for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) { - pOL->GetObj(nObjNum)->getMergedHierarchyLayerSet(rSet); + pOL->GetObj(nObjNum)->getMergedHierarchySdrLayerIDSet(rSet); } } } @@ -1721,8 +1721,7 @@ OString SdrObject::stringify() const append(bInserted). append(false). append(bVirtObj). - //append(maBLIPSizeRectangle). - append(mnLayerID); + append(sal_uInt8(mnLayerID)); aString.append(GetMergedItemSet().stringify()); diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index b6b4d7a7164d..a6d443c456ae 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -2095,7 +2095,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO if (pOut==nullptr) pOut=rPV.GetView().GetFirstOutputDevice(); if (pOut==nullptr) return false; SdrObjList* pOL=rPV.GetObjList(); - const SetOfByte& rVisLayer=rPV.GetVisibleLayers(); + const SdrLayerIDSet& rVisLayer=rPV.GetVisibleLayers(); // sensitive area of connectors is twice as large as the one of the handles sal_uInt16 nMarkHdSiz=rPV.GetView().GetMarkHdlSizePixel(); Size aHalfConSiz(nMarkHdSiz,nMarkHdSiz); diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 7be3f4e94887..02d6c50f0797 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -152,7 +152,7 @@ SdrLayerID SdrObjGroup::GetLayer() const for (size_t i=0; i<nObjCount; ++i) { SdrLayerID nLay1=pOL->GetObj(i)->GetLayer(); if (b1st) { nLay=nLay1; b1st = false; } - else if (nLay1!=nLay) return 0; + else if (nLay1!=nLay) return SdrLayerID(0); } return nLay; } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 83281d013a74..24e440fab2e0 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1584,13 +1584,13 @@ SdrPage& SdrPage::TRG_GetMasterPage() const return mpMasterPageDescriptor->GetUsedPage(); } -const SetOfByte& SdrPage::TRG_GetMasterPageVisibleLayers() const +const SdrLayerIDSet& SdrPage::TRG_GetMasterPageVisibleLayers() const { DBG_ASSERT(mpMasterPageDescriptor != nullptr, "TRG_GetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)"); return mpMasterPageDescriptor->GetVisibleLayers(); } -void SdrPage::TRG_SetMasterPageVisibleLayers(const SetOfByte& rNew) +void SdrPage::TRG_SetMasterPageVisibleLayers(const SdrLayerIDSet& rNew) { DBG_ASSERT(mpMasterPageDescriptor != nullptr, "TRG_SetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)"); mpMasterPageDescriptor->SetVisibleLayers(rNew); diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index b8fd9863cfde..fd94f4388877 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -605,7 +605,7 @@ void SdrPageView::AdjHdl() GetView().AdjustMarkHdl(); } -void SdrPageView::SetLayer(const OUString& rName, SetOfByte& rBS, bool bJa) +void SdrPageView::SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa) { if(!GetPage()) return; @@ -616,7 +616,7 @@ void SdrPageView::SetLayer(const OUString& rName, SetOfByte& rBS, bool bJa) rBS.Set(nID, bJa); } -bool SdrPageView::IsLayer(const OUString& rName, const SetOfByte& rBS) const +bool SdrPageView::IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const { if(!GetPage()) return false; @@ -674,9 +674,9 @@ bool SdrPageView::IsObjMarkable(SdrObject* pObj) const return false; // Obj suddenly in different Page // the layer has to be visible and must not be locked SdrLayerID nL = pObj->GetLayer(); - if (!aLayerVisi.IsSet(sal_uInt8(nL))) + if (!aLayerVisi.IsSet(nL)) return false; - if (aLayerLock.IsSet(sal_uInt8(nL))) + if (aLayerLock.IsSet(nL)) return false; return true; } diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx index ef00503274af..903992975f05 100644 --- a/svx/source/svdraw/svdviter.cxx +++ b/svx/source/svdraw/svdviter.cxx @@ -76,8 +76,8 @@ bool SdrViewIter::ImpCheckPageView(SdrPageView* pPV) const { // Looking for an object? First, determine if it visible in // this PageView. - SetOfByte aObjLay; - mpObject->getMergedHierarchyLayerSet(aObjLay); + SdrLayerIDSet aObjLay; + mpObject->getMergedHierarchySdrLayerIDSet(aObjLay); aObjLay &= pPV->GetVisibleLayers(); return !aObjLay.IsEmpty(); } @@ -99,8 +99,8 @@ bool SdrViewIter::ImpCheckPageView(SdrPageView* pPV) const { // Looking for an object? First, determine if it visible in // this PageView. - SetOfByte aObjLay; - mpObject->getMergedHierarchyLayerSet(aObjLay); + SdrLayerIDSet aObjLay; + mpObject->getMergedHierarchySdrLayerIDSet(aObjLay); aObjLay &= pPV->GetVisibleLayers(); aObjLay &= pPg->TRG_GetMasterPageVisibleLayers(); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 44ab7ac9da0e..0b0904ac70cb 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -110,12 +110,12 @@ void SdrExchangeView::ImpGetPasteObjList(Point& /*rPos*/, SdrObjList*& rpLst) bool SdrExchangeView::ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& rLayer) const { bool bRet=false; - rLayer=0; + rLayer=SdrLayerID(0); if (pObjList!=nullptr) { const SdrPage* pPg=pObjList->GetPage(); if (pPg!=nullptr) { rLayer=pPg->GetLayerAdmin().GetLayerID(maActualLayer); - if (rLayer==SDRLAYER_NOTFOUND) rLayer=0; + if (rLayer==SDRLAYER_NOTFOUND) rLayer=SdrLayerID(0); SdrPageView* pPV = GetSdrPageView(); if (pPV!=nullptr) { bRet=!pPV->GetLockedLayers().IsSet(rLayer) && pPV->GetVisibleLayers().IsSet(rLayer); @@ -336,7 +336,7 @@ bool SdrExchangeView::Paste( if(SDRLAYER_NOTFOUND == nLayer) { - nLayer = 0; + nLayer = SdrLayerID(0); } pNeuObj->SetLayer(nLayer); @@ -672,7 +672,7 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* ::std::vector< SdrMark* >& rObjVector1 = aObjVectors[ 0 ]; ::std::vector< SdrMark* >& rObjVector2 = aObjVectors[ 1 ]; const SdrLayerAdmin& rLayerAdmin = mpModel->GetLayerAdmin(); - const sal_uInt32 nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName() ); + const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName() ); for( size_t n = 0, nCount = GetMarkedObjectCount(); n < nCount; ++n ) { diff --git a/svx/source/uitest/sdrobject.cxx b/svx/source/uitest/sdrobject.cxx index bd31316a498f..7852d6a8bec7 100644 --- a/svx/source/uitest/sdrobject.cxx +++ b/svx/source/uitest/sdrobject.cxx @@ -29,7 +29,7 @@ StringMap SdrUIObject::get_state() aMap["Description"] = pObject->GetDescription(); aMap["Title"] = pObject->GetTitle(); aMap["Z-Order"] = OUString::number(pObject->GetOrdNum()); - aMap["Layer"] = OUString::number(pObject->GetLayer()); + aMap["Layer"] = OUString::number(sal_uInt8(pObject->GetLayer())); aMap["IsGroupObject"] = OUString::boolean(pObject->IsGroupObject()); aMap["IsPolyObject"] = OUString::boolean(pObject->IsPolyObj()); aMap["PointCount"] = OUString::number(pObject->GetPointCount()); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 591a9cadb391..7cc707c7f510 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2299,10 +2299,10 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl sal_Int16 nLayerId = sal_Int16(); if( rValue >>= nLayerId ) { - SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId); + SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID(SdrLayerID(nLayerId)); if( pLayer ) { - mpObj->SetLayer((unsigned char)nLayerId); + mpObj->SetLayer(SdrLayerID(nLayerId)); return true; } } @@ -2747,7 +2747,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl break; } case SDRATTR_LAYERID: - rValue <<= (sal_Int16)mpObj->GetLayer(); + rValue <<= sal_uInt16(sal_uInt8(mpObj->GetLayer())); break; case SDRATTR_LAYERNAME: |