diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-30 20:33:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-07 14:22:07 +0100 |
commit | 8295a3344704ce9a18489933c499a50c403f1a3d (patch) | |
tree | 92a10017311909e3010624b39acddfcf7d3eba00 /sc/source | |
parent | 8accfa30343195b5d7cfd111301677a6a9b6a21b (diff) |
remove E3D_INVENTOR_FLAG and convert SdrObjKind to scoped enum
We don't need E3D_INVENTOR_FLAG, we can just check if the SdrObjKind is
in the right range.
Which exposes some dodgy code in DrawViewShell::GetMenuStateSel
SfxItemState::DEFAULT == rSet.GetItemState( OBJ_TITLETEXT ) ||
SfxItemState::DEFAULT == rSet.GetItemState( OBJ_OUTLINETEXT ) ||
which has been there ever since
commit f47a9d9db3d06927380bb79b04bb6d4721a92d2b
Date: Mon Sep 18 16:07:07 2000 +0000
initial import
just remove that.
In SwFEShell::ImpEndCreate() move some logic around to avoid
using an out-of-range SdrObjKind value
Change-Id: I4620bfe61aca8f7415503debe3c84bfe5f4368a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127763
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
39 files changed, 143 insertions, 142 deletions
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index 67421451e99e..ba6bea3a6116 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -108,7 +108,7 @@ bool ScDocument::HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && pObject->GetCurrentBoundRect().Contains(rPos) ) { // also Chart-Objects that are not in the Collection @@ -152,7 +152,7 @@ uno::Reference< chart2::XChartDocument > ScDocument::GetChartByName( std::u16str SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->GetPersistName() == rChartName ) { xReturn.set( ScChartHelper::GetChartFromSdrObject( pObject ) ); @@ -219,7 +219,7 @@ void ScDocument::GetOldChartParameters( std::u16string_view rName, SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->GetPersistName() == rName ) { uno::Reference< chart2::XChartDocument > xChartDoc( ScChartHelper::GetChartFromSdrObject( pObject ) ); @@ -266,7 +266,7 @@ void ScDocument::UpdateChartArea( const OUString& rChartName, SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->GetPersistName() == rChartName ) { uno::Reference< chart2::XChartDocument > xChartDoc( ScChartHelper::GetChartFromSdrObject( pObject ) ); @@ -496,7 +496,7 @@ void ScDocument::SetChartRangeList( std::u16string_view rChartName, SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->GetPersistName() == rChartName ) { uno::Reference< chart2::XChartDocument > xChartDoc( ScChartHelper::GetChartFromSdrObject( pObject ) ); @@ -551,7 +551,7 @@ uno::Reference< embed::XEmbeddedObject > SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 ) { SdrOle2Obj * pOleObject ( dynamic_cast< SdrOle2Obj * >( pObject )); if( pOleObject && @@ -592,7 +592,7 @@ void ScDocument::UpdateChartListenerCollection() for (SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next()) { - if ( pObject->GetObjIdentifier() != OBJ_OLE2 ) + if ( pObject->GetObjIdentifier() != SdrObjKind::OLE2 ) continue; OUString aObjName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName(); diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 5a8f97bb36db..69c37888057b 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -203,7 +203,7 @@ void ScDocument::SetDrawPageSize(SCTAB nTab) bool ScDocument::IsChart( const SdrObject* pObject ) { // IsChart() implementation moved to svx drawinglayer - if(pObject && OBJ_OLE2 == pObject->GetObjIdentifier()) + if(pObject && SdrObjKind::OLE2 == pObject->GetObjIdentifier()) { return static_cast<const SdrOle2Obj*>(pObject)->IsChart(); } @@ -303,7 +303,7 @@ bool ScDocument::HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* p SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && aMMRect.Contains( pObject->GetCurrentBoundRect() ) ) return true; diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index b0436d407ddd..3503ae9cd949 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -689,7 +689,7 @@ bool lcl_AreRectanglesApproxEqual(const tools::Rectangle& rRectA, const tools::R bool lcl_NeedsMirrorYCorrection(const SdrObject* pObj) { - return pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE + return pObj->GetObjIdentifier() == SdrObjKind::CustomShape && static_cast<const SdrObjCustomShape*>(pObj)->IsMirroredY(); } @@ -942,7 +942,7 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat const ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObj); if (aAnchorType == SCA_CELL_RESIZE) { - if (pObj->GetObjIdentifier() == OBJ_LINE) + if (pObj->GetObjIdentifier() == SdrObjKind::Line) { // Horizontal lines might have wrong start and end anchor because of erroneously applied // 180deg rotation (tdf#137446). Other lines have wrong end anchor. Coordinates in @@ -959,7 +959,7 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat GetCellAnchorFromPosition(aObjRect, rNoRotatedAnchor, *pDoc, nTab1, false /*bHiddenAsZero*/); } - else if (pObj->GetObjIdentifier() == OBJ_MEASURE) + else if (pObj->GetObjIdentifier() == SdrObjKind::Measure) { // Measure lines might have got wrong start and end anchor from XML import. Recreate // anchor from start and end point. @@ -1209,7 +1209,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati } rData.setShapeRect(GetDocument(), lcl_makeSafeRectangle(rData.getShapeRect()), pObj->IsVisible()); - if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) + if (pObj->GetObjIdentifier() == SdrObjKind::CustomShape) pObj->AdjustToMaxRect(rData.getShapeRect()); else pObj->SetSnapRect(rData.getShapeRect()); @@ -1917,7 +1917,7 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const //#i110034# handle chart data references (after InsertObject) - if ( pNewObject->GetObjIdentifier() == OBJ_OLE2 ) + if ( pNewObject->GetObjIdentifier() == SdrObjKind::OLE2 ) { uno::Reference< embed::XEmbeddedObject > xIPObj = static_cast<SdrOle2Obj*>(pNewObject)->GetObjRef(); uno::Reference< embed::XClassifiedObject > xClassified = xIPObj; @@ -1996,11 +1996,11 @@ void ScDrawLayer::MirrorRTL( SdrObject* pObj ) if( !pDoc ) return; - sal_uInt16 nIdent = pObj->GetObjIdentifier(); + SdrObjKind nIdent = pObj->GetObjIdentifier(); // don't mirror OLE or graphics, otherwise ask the object // if it can be mirrored - bool bCanMirror = ( nIdent != OBJ_GRAF && nIdent != OBJ_OLE2 ); + bool bCanMirror = ( nIdent != SdrObjKind::Graphic && nIdent != SdrObjKind::OLE2 ); if (bCanMirror) { SdrObjTransformInfoRec aInfo; @@ -2145,7 +2145,7 @@ tools::Rectangle ScDrawLayer::GetCellRect( const ScDocument& rDoc, const ScAddre OUString ScDrawLayer::GetVisibleName( const SdrObject* pObj ) { OUString aName = pObj->GetName(); - if ( pObj->GetObjIdentifier() == OBJ_OLE2 ) + if ( pObj->GetObjIdentifier() == SdrObjKind::OLE2 ) { // For OLE, the user defined name (GetName) is used // if it's not empty (accepting possibly duplicate names), @@ -2164,11 +2164,11 @@ static bool IsNamedObject( const SdrObject* pObj, std::u16string_view rName ) // (used to find a named object) return ( pObj->GetName() == rName || - ( pObj->GetObjIdentifier() == OBJ_OLE2 && + ( pObj->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<const SdrOle2Obj*>(pObj)->GetPersistName() == rName ) ); } -SdrObject* ScDrawLayer::GetNamedObject( std::u16string_view rName, sal_uInt16 nId, SCTAB& rFoundTab ) const +SdrObject* ScDrawLayer::GetNamedObject( std::u16string_view rName, SdrObjKind nId, SCTAB& rFoundTab ) const { sal_uInt16 nTabCount = GetPageCount(); for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++) @@ -2181,7 +2181,7 @@ SdrObject* ScDrawLayer::GetNamedObject( std::u16string_view rName, sal_uInt16 nI SdrObject* pObject = aIter.Next(); while (pObject) { - if ( nId == 0 || pObject->GetObjIdentifier() == nId ) + if ( nId == SdrObjKind::NONE || pObject->GetObjIdentifier() == nId ) if ( IsNamedObject( pObject, rName ) ) { rFoundTab = static_cast<SCTAB>(nTab); @@ -2208,7 +2208,7 @@ OUString ScDrawLayer::GetNewGraphicName( tools::Long* pnCounter ) const { ++nId; aGraphicName = aBase + OUString::number( nId ); - bThere = ( GetNamedObject( aGraphicName, 0, nDummy ) != nullptr ); + bThere = ( GetNamedObject( aGraphicName, SdrObjKind::NONE, nDummy ) != nullptr ); } if ( pnCounter ) @@ -2238,7 +2238,7 @@ void ScDrawLayer::EnsureGraphicNames() while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_GRAF && pObject->GetName().isEmpty()) + if ( pObject->GetObjIdentifier() == SdrObjKind::Graphic && pObject->GetName().isEmpty()) pObject->SetName( GetNewGraphicName( &nCounter ) ); pObject = aIter.Next(); @@ -2332,7 +2332,7 @@ void ScDrawLayer::SetCellAnchoredFromPosition( SdrObject &rObj, const ScDocument aObjRect2 = rObj.GetLogicRect(); rObj.NbcMirror(aLeft, aRight); } - else if (rObj.GetObjIdentifier() == OBJ_MEASURE) + else if (rObj.GetObjIdentifier() == SdrObjKind::Measure) { // tdf#137576. A SdrMeasureObj might have a wrong logic rect here. TakeUnrotatedSnapRect // calculates the current unrotated snap rectangle, sets logic rectangle and returns it. diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index 32315565ace5..8470c83d5b04 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -60,7 +60,7 @@ sal_uInt16 lcl_DoUpdateCharts( ScDocument& rDoc ) SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart( pObject ) ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart( pObject ) ) { OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName(); rDoc.UpdateChart( aName ); @@ -125,7 +125,7 @@ void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSr SdrObject* pObject = aIter.Next(); while( pObject ) { - if( pObject->GetObjIdentifier() == OBJ_OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() ) + if( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() ) { OUString aChartName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName(); @@ -161,7 +161,7 @@ void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument& rDestDoc, const S SdrObject* pObject = aIter.Next(); while( pObject ) { - if( pObject->GetObjIdentifier() == OBJ_OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() ) + if( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() ) { OUString aChartName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName(); Reference< chart2::XChartDocument > xChartDoc( rDestDoc.GetChartByName( aChartName ) ); @@ -177,7 +177,7 @@ uno::Reference< chart2::XChartDocument > ScChartHelper::GetChartFromSdrObject( c uno::Reference< chart2::XChartDocument > xReturn; if( pObject ) { - if( pObject->GetObjIdentifier() == OBJ_OLE2 && static_cast<const SdrOle2Obj*>(pObject)->IsChart() ) + if( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<const SdrOle2Obj*>(pObject)->IsChart() ) { uno::Reference< embed::XEmbeddedObject > xIPObj = static_cast<const SdrOle2Obj*>(pObject)->GetObjRef(); if( xIPObj.is() ) @@ -281,7 +281,7 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, const ScDocument& rDocument, SdrObject* pObject ) { - if ( !(pObject && ( pObject->GetObjIdentifier() == OBJ_OLE2 )) ) + if ( !(pObject && ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 )) ) return; SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject ); @@ -344,7 +344,7 @@ void ScChartHelper::GetChartNames( ::std::vector< OUString >& rChartNames, const SdrObject* pObject = aIter.Next(); while ( pObject ) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 ) { SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject ); if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() ) @@ -368,7 +368,7 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument& rDoc, co SdrObject* pObject = aIter.Next(); while ( pObject ) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 ) { SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject ); if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() ) diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index d120b4e35ff0..eabc91a3c4bb 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -497,7 +497,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y())); SdrPathObj* pArrow = new SdrPathObj( *pModel, - OBJ_LINE, + SdrObjKind::Line, basegfx::B2DPolyPolygon(aTempPoly)); pArrow->NbcSetLogicRect(tools::Rectangle::Justify(aStartPos,aEndPos)); //TODO: needed ??? pArrow->SetMergedItemSetAndBroadcast(rAttrSet); @@ -566,7 +566,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y())); SdrPathObj* pArrow = new SdrPathObj( *pModel, - OBJ_LINE, + SdrObjKind::Line, basegfx::B2DPolyPolygon(aTempPoly)); pArrow->NbcSetLogicRect(tools::Rectangle::Justify(aStartPos,aEndPos)); //TODO: needed ??? diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 3d3d23520e94..a109f7b9c6db 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1598,7 +1598,7 @@ void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm ) css::uno::Reference<css::chart::XChartDocument> XclExpChartObj::GetChartDoc() const { SdrObject* pObj = SdrObject::getSdrObjectFromXShape(mxShape); - if (!pObj || pObj->GetObjIdentifier() != OBJ_OLE2) + if (!pObj || pObj->GetObjIdentifier() != SdrObjKind::OLE2) return {}; // May load here - makes sure that we are working with actually loaded OLE object return css::uno::Reference<css::chart::XChartDocument>( diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 298517b0f5b0..4b80fea99cfc 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1123,7 +1123,7 @@ SdrObjectUniquePtr XclImpLineObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, SdrObjectUniquePtr xSdrObj( new SdrPathObj( *GetDoc().GetDrawLayer(), - OBJ_LINE, + SdrObjKind::Line, ::basegfx::B2DPolyPolygon(aB2DPolygon))); ConvertLineStyle( *xSdrObj, maLineData ); @@ -1415,7 +1415,7 @@ SdrObjectUniquePtr XclImpPolygonObj::DoCreateSdrObj( XclImpDffConverter& rDffCon if( ::get_flag( mnPolyFlags, EXC_OBJ_POLY_CLOSED ) && (maCoords.front() != maCoords.back()) ) aB2DPolygon.append( lclGetPolyPoint( rAnchorRect, maCoords.front() ) ); // create the SdrObject - SdrObjKind eObjKind = maFillData.IsFilled() ? OBJ_PATHPOLY : OBJ_PATHPLIN; + SdrObjKind eObjKind = maFillData.IsFilled() ? SdrObjKind::PathPoly : SdrObjKind::PathPolyLine; xSdrObj.reset( new SdrPathObj( *GetDoc().GetDrawLayer(), diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx index 50ff33b6ffc8..c76f001fdf84 100644 --- a/sc/source/filter/html/htmlexp2.cxx +++ b/sc/source/filter/html/htmlexp2.cxx @@ -129,7 +129,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) OString aOpt = aBuf.makeStringAndClear(); switch ( pObject->GetObjIdentifier() ) { - case OBJ_GRAF: + case SdrObjKind::Graphic: { const SdrGrafObj* pSGO = static_cast<SdrGrafObj*>(pObject); std::unique_ptr<SdrGrafObjGeoData> pGeo(static_cast<SdrGrafObjGeoData*>(pSGO->GetGeoData().release())); @@ -149,7 +149,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) pE->bWritten = true; } break; - case OBJ_OLE2: + case SdrObjKind::OLE2: { const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pObject)->GetGraphic(); if ( pGraphic ) diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 7778944ccfd7..db0c7159000a 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -166,7 +166,7 @@ namespace { bool lcl_IsFontwork( const SdrObject* pObj ) { bool bIsFontwork = false; - if( pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) + if( pObj->GetObjIdentifier() == SdrObjKind::CustomShape ) { static const OUStringLiteral aTextPath = u"TextPath"; const SdrCustomShapeGeometryItem& rGeometryItem = @@ -202,9 +202,9 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape else { pCurrXclObj = nullptr; - sal_uInt16 nObjType = pObj->GetObjIdentifier(); + SdrObjKind nObjType = pObj->GetObjIdentifier(); - if( nObjType == OBJ_OLE2 ) + if( nObjType == SdrObjKind::OLE2 ) { // no OLE objects in embedded drawings (chart shapes) if( mbIsRootDff ) @@ -228,7 +228,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape else pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDoc() ); } - else if( nObjType == OBJ_UNO ) + else if( nObjType == SdrObjKind::UNO ) { //added for exporting OCX control Reference< XPropertySet > xPropSet( rxShape, UNO_QUERY ); @@ -280,7 +280,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape pCurrAppData->SetClientAnchor( pAnchor ); } const SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pObj ); - if( pTextObj && !lcl_IsFontwork( pTextObj ) && (pObj->GetObjIdentifier() != OBJ_CAPTION) ) + if( pTextObj && !lcl_IsFontwork( pTextObj ) && (pObj->GetObjIdentifier() != SdrObjKind::Caption) ) { const OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); if( pParaObj ) @@ -310,8 +310,8 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape //for OCX control import from MS office file,we need keep the id value as MS office file. //GetOldRoot().pObjRecs->Add( pCurrXclObj ) statement has generated the id value as obj id rule; //but we trick it here. - sal_uInt16 nObjType = pObj->GetObjIdentifier(); - if( nObjType == OBJ_UNO && pCurrXclObj ) + SdrObjKind nObjType = pObj->GetObjIdentifier(); + if( nObjType == SdrObjKind::UNO && pCurrXclObj ) { Reference< XPropertySet > xPropSet( rxShape, UNO_QUERY ); Any aAny; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 5ed6cccde2a2..243c7b27c630 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1106,9 +1106,9 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& // Do not adjust objects, which have rotation incorporated into their points // but report a rotation angle nevertheless. SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape); - if (pObj && pObj->GetObjIdentifier() != OBJ_LINE && pObj->GetObjIdentifier() != OBJ_PLIN - && pObj->GetObjIdentifier() != OBJ_PATHLINE && pObj->GetObjIdentifier() != OBJ_FREELINE - && pObj->GetObjIdentifier() != OBJ_PATHPLIN) + if (pObj && pObj->GetObjIdentifier() != SdrObjKind::Line && pObj->GetObjIdentifier() != SdrObjKind::PolyLine + && pObj->GetObjIdentifier() != SdrObjKind::PathLine && pObj->GetObjIdentifier() != SdrObjKind::FreehandLine + && pObj->GetObjIdentifier() != SdrObjKind::PathPolyLine) { Degree100 nRotation = NormAngle36000(pObj->GetRotateAngle()); if (nRotation) diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index bdae3a1f94d0..4d52fce1216e 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3571,7 +3571,7 @@ void ScXMLExport::WriteShapes(const ScMyCell& rMyCell) aPoint.X = aSnapRect.Left() + aSnapRect.Right() - aPoint.X; } else if (pObj && (pNRObjData = ScDrawLayer::GetNonRotatedObjData(pObj)) - && ((rShape.bResizeWithCell && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE + && ((rShape.bResizeWithCell && pObj->GetObjIdentifier() == SdrObjKind::CustomShape && static_cast<SdrObjCustomShape*>(pObj)->IsMirroredX()) || bNegativePage)) { diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx index 50cbadc567fa..0886fae89400 100644 --- a/sc/source/ui/app/client.cxx +++ b/sc/source/ui/app/client.cxx @@ -60,7 +60,7 @@ SdrOle2Obj* ScClient::GetDrawObj() SdrObject* pObject = aIter.Next(); while (pObject && !pOle2Obj) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 ) { // name from InfoObject is PersistName if ( static_cast<SdrOle2Obj*>(pObject)->GetPersistName() == aName ) diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 50075e80055f..8cd335b2e946 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -89,8 +89,8 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo // OLE object - sal_uInt16 nSdrObjKind = pObject->GetObjIdentifier(); - if (nSdrObjKind == OBJ_OLE2) + SdrObjKind nSdrObjKind = pObject->GetObjIdentifier(); + if (nSdrObjKind == SdrObjKind::OLE2) { // if object has no persistence it must be copied as a part of document try @@ -106,7 +106,7 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo // Graphic object - if (nSdrObjKind == OBJ_GRAF) + if (nSdrObjKind == SdrObjKind::Graphic) { m_bGraphic = true; if ( static_cast<SdrGrafObj*>(pObject)->GetGraphic().GetType() == GraphicType::Bitmap ) @@ -383,7 +383,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c { SdrObjListIter aIter( pPage, SdrIterMode::Flat ); SdrObject* pObject = aIter.Next(); - if (pObject && pObject->GetObjIdentifier() == OBJ_GRAF) + if (pObject && pObject->GetObjIdentifier() == SdrObjKind::Graphic) { SdrGrafObj* pGraphObj = static_cast<SdrGrafObj*>(pObject); bOK = SetGraphic( pGraphObj->GetGraphic() ); @@ -637,7 +637,7 @@ SdrOle2Obj* ScDrawTransferObj::GetSingleObject() { SdrObjListIter aIter( pPage, SdrIterMode::Flat ); SdrObject* pObject = aIter.Next(); - if (pObject && pObject->GetObjIdentifier() == OBJ_OLE2) + if (pObject && pObject->GetObjIdentifier() == SdrObjKind::OLE2) { return static_cast<SdrOle2Obj*>(pObject); } diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index 9b7b3caa0905..33405d447aa3 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -88,16 +88,16 @@ rtl::Reference<ScSelectionTransferObj> ScSelectionTransferObj::CreateFromView( S if ( nMarkCount == 1 ) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); + SdrObjKind nSdrObjKind = pObj->GetObjIdentifier(); - if ( nSdrObjKind == OBJ_GRAF ) + if ( nSdrObjKind == SdrObjKind::Graphic ) { if ( static_cast<SdrGrafObj*>(pObj)->GetGraphic().GetType() == GraphicType::Bitmap ) eMode = SC_SELTRANS_DRAW_BITMAP; else eMode = SC_SELTRANS_DRAW_GRAPHIC; } - else if ( nSdrObjKind == OBJ_OLE2 ) + else if ( nSdrObjKind == SdrObjKind::OLE2 ) eMode = SC_SELTRANS_DRAW_OLE; else if ( lcl_IsURLButton( pObj ) ) eMode = SC_SELTRANS_DRAW_BOOKMARK; diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 08be0531f2a5..f35f20caf84a 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -372,7 +372,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); std::shared_ptr<SfxRequest> pRequest = std::make_shared<SfxRequest>(rReq); - if( pObj->GetObjIdentifier() == OBJ_CAPTION ) + if( pObj->GetObjIdentifier() == SdrObjKind::Caption ) { // Caption Itemset SfxItemSet aNewAttr(pDoc->GetItemPool()); diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 7a288ecbd100..a3a0a9abb20a 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -241,8 +241,8 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions bCanRename = true; // #i51351# anything except internal objects can be renamed // #91929#; don't show original size entry if not possible - sal_uInt16 nObjType = pObj->GetObjIdentifier(); - if ( nObjType == OBJ_OLE2 ) + SdrObjKind nObjType = pObj->GetObjIdentifier(); + if ( nObjType == SdrObjKind::OLE2 ) { SdrOle2Obj* pOleObj = static_cast<SdrOle2Obj*>(rMarkList.GetMark( 0 )->GetMarkedSdrObj()); if (pOleObj->GetObjRef().is() && @@ -250,7 +250,7 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions //TODO/LATER: why different slots in Draw and Calc? rSet.DisableItem(SID_ORIGINALSIZE); } - else if ( nObjType == OBJ_CAPTION ) + else if ( nObjType == SdrObjKind::Caption ) { if ( nLayerID == SC_LAYER_INTERN ) { @@ -473,18 +473,18 @@ void ScDrawShell::GetAttrFuncState(SfxItemSet &rSet) for ( size_t i = 0; i < nMarkCount && i < 50; ++i ) { SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); - sal_uInt16 nObjType = pObj->GetObjIdentifier(); + SdrObjKind nObjType = pObj->GetObjIdentifier(); - if ( nObjType != OBJ_MEASURE ) + if ( nObjType != SdrObjKind::Measure ) bShowMeasure = false; // If marked object is 2D, disable format area command. - if ( nObjType == OBJ_PLIN || - nObjType == OBJ_LINE || - nObjType == OBJ_PATHLINE || - nObjType == OBJ_FREELINE || - nObjType == OBJ_EDGE || - nObjType == OBJ_CARC || + if ( nObjType == SdrObjKind::PolyLine || + nObjType == SdrObjKind::Line || + nObjType == SdrObjKind::PathLine || + nObjType == SdrObjKind::FreehandLine || + nObjType == SdrObjKind::Edge || + nObjType == SdrObjKind::CircleArc || bShowMeasure ) bShowArea = false; diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 70dff477d54e..d7c3ee434e0d 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -490,9 +490,9 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) if (aName != pSelected->GetName()) { // handle name change - const sal_uInt16 nObjType(pSelected->GetObjIdentifier()); + const SdrObjKind nObjType(pSelected->GetObjIdentifier()); - if (OBJ_GRAF == nObjType && aName.isEmpty()) + if (SdrObjKind::Graphic == nObjType && aName.isEmpty()) { // graphics objects must have names // (all graphics are supposed to be in the navigator) @@ -507,7 +507,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) // An undo action for renaming is missing in svdraw (99363). // For OLE objects (which can be identified using the persist name), // ScUndoRenameObject can be used until there is a common action for all objects. - if(OBJ_OLE2 == nObjType) + if(SdrObjKind::OLE2 == nObjType) { const OUString aPersistName = static_cast<SdrOle2Obj*>(pSelected)->GetPersistName(); @@ -616,7 +616,7 @@ IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bo if ( !aName.isEmpty() && pModel ) { SCTAB nDummyTab; - if ( pModel->GetNamedObject( aName, 0, nDummyTab ) ) + if ( pModel->GetNamedObject( aName, SdrObjKind::NONE, nDummyTab ) ) { // existing object found -> name invalid return false; diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx index 95e5785868d0..ef9b2c0fdd8e 100644 --- a/sc/source/ui/drawfunc/fuconarc.cxx +++ b/sc/source/ui/drawfunc/fuconarc.cxx @@ -77,22 +77,22 @@ void FuConstArc::Activate() { case SID_DRAW_ARC: aNewPointer = PointerStyle::DrawArc; - aObjKind = OBJ_CARC; + aObjKind = SdrObjKind::CircleArc; break; case SID_DRAW_PIE: aNewPointer = PointerStyle::DrawPie; - aObjKind = OBJ_SECT; + aObjKind = SdrObjKind::CircleSection; break; case SID_DRAW_CIRCLECUT: aNewPointer = PointerStyle::DrawCircleCut; - aObjKind = OBJ_CCUT; + aObjKind = SdrObjKind::CircleCut; break; default: aNewPointer = PointerStyle::Cross; - aObjKind = OBJ_CARC; + aObjKind = SdrObjKind::CircleArc; break; } diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx index 2e7a506f77f1..ed4522fb85e8 100644 --- a/sc/source/ui/drawfunc/fuconcustomshape.cxx +++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx @@ -97,7 +97,7 @@ bool FuConstCustomShape::MouseButtonUp(const MouseEvent& rMEvt) void FuConstCustomShape::Activate() { - pView->SetCurrentObj( OBJ_CUSTOMSHAPE ); + pView->SetCurrentObj( SdrObjKind::CustomShape ); aNewPointer = PointerStyle::DrawRect; aOldPointer = pWindow->GetPointer(); diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx index 22b94acfad43..6ce044ad9d5a 100644 --- a/sc/source/ui/drawfunc/fuconpol.cxx +++ b/sc/source/ui/drawfunc/fuconpol.cxx @@ -109,44 +109,44 @@ void FuConstPolygon::Activate() case SID_DRAW_POLYGON_NOFILL: case SID_DRAW_XPOLYGON_NOFILL: { - eKind = OBJ_PLIN; + eKind = SdrObjKind::PolyLine; } break; case SID_DRAW_POLYGON: case SID_DRAW_XPOLYGON: { - eKind = OBJ_POLY; + eKind = SdrObjKind::Polygon; } break; case SID_DRAW_BEZIER_NOFILL: { - eKind = OBJ_PATHLINE; + eKind = SdrObjKind::PathLine; } break; case SID_DRAW_BEZIER_FILL: { - eKind = OBJ_PATHFILL; + eKind = SdrObjKind::PathFill; } break; case SID_DRAW_FREELINE_NOFILL: { - eKind = OBJ_FREELINE; + eKind = SdrObjKind::FreehandLine; } break; case SID_DRAW_FREELINE: { - eKind = OBJ_FREEFILL; + eKind = SdrObjKind::FreehandFill; } break; default: { - eKind = OBJ_PATHLINE; + eKind = SdrObjKind::PathLine; } break; } diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx index c112617652b4..8e31015e8ae3 100644 --- a/sc/source/ui/drawfunc/fuconrec.cxx +++ b/sc/source/ui/drawfunc/fuconrec.cxx @@ -94,7 +94,7 @@ bool FuConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); pWindow->CaptureMouse(); - if ( pView->GetCurrentObjIdentifier() == OBJ_CAPTION ) + if ( pView->GetCurrentObjIdentifier() == SdrObjKind::Caption ) { Size aCaptionSize ( 2268, 1134 ); // 4x2cm @@ -166,33 +166,33 @@ void FuConstRectangle::Activate() case SID_LINE_SQUARE_ARROW: case SID_LINE_ARROWS: aNewPointer = PointerStyle::DrawLine; - aObjKind = OBJ_LINE; + aObjKind = SdrObjKind::Line; break; case SID_DRAW_MEASURELINE: aNewPointer = PointerStyle::DrawLine; - aObjKind = OBJ_MEASURE; + aObjKind = SdrObjKind::Measure; break; case SID_DRAW_RECT: aNewPointer = PointerStyle::DrawRect; - aObjKind = OBJ_RECT; + aObjKind = SdrObjKind::Rectangle; break; case SID_DRAW_ELLIPSE: aNewPointer = PointerStyle::DrawEllipse; - aObjKind = OBJ_CIRC; + aObjKind = SdrObjKind::CircleOrEllipse; break; case SID_DRAW_CAPTION: case SID_DRAW_CAPTION_VERTICAL: aNewPointer = PointerStyle::DrawCaption; - aObjKind = OBJ_CAPTION; + aObjKind = SdrObjKind::Caption; break; default: aNewPointer = PointerStyle::Cross; - aObjKind = OBJ_RECT; + aObjKind = SdrObjKind::Rectangle; break; } diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx index e0257f97feec..e4e3c3e3764b 100644 --- a/sc/source/ui/drawfunc/fuconuno.cxx +++ b/sc/source/ui/drawfunc/fuconuno.cxx @@ -27,7 +27,7 @@ FuConstUnoControl::FuConstUnoControl(ScTabViewShell& rViewSh, vcl::Window* pWin, SdrModel* pDoc, const SfxRequest& rReq) : FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq) , nInventor(SdrInventor::Unknown) - , nIdentifier(OBJ_NONE) + , nIdentifier(SdrObjKind::NONE) { const SfxUInt32Item* pInventorItem = rReq.GetArg<SfxUInt32Item>(SID_FM_CONTROL_INVENTOR); const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER); diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx index a7fb3f38bd24..decfacebe85c 100644 --- a/sc/source/ui/drawfunc/fupoor.cxx +++ b/sc/source/ui/drawfunc/fupoor.cxx @@ -257,10 +257,10 @@ bool FuPoor::doConstructOrthogonal() const const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); if (rMarkList.GetMarkCount() == 1) { - sal_uInt16 aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier(); - bool bIsMediaSelected = aObjIdentifier == OBJ_GRAF || - aObjIdentifier == OBJ_MEDIA || - aObjIdentifier == OBJ_OLE2; + SdrObjKind aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier(); + bool bIsMediaSelected = aObjIdentifier == SdrObjKind::Graphic || + aObjIdentifier == SdrObjKind::Media || + aObjIdentifier == SdrObjKind::OLE2; SdrHdl* pHdl = pView->PickHandle(aMDPos); // Resize proportionally when media is selected and the user drags on a corner diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index b59059786d69..18ba12b792b9 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -459,11 +459,11 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ); if (eHit != SdrHitKind::NONE && aVEvt.mpObj == pObj) { - sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); + SdrObjKind nSdrObjKind = pObj->GetObjIdentifier(); // OLE: activate - if (nSdrObjKind == OBJ_OLE2) + if (nSdrObjKind == SdrObjKind::OLE2) { if (!bOle) { diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index ef853ef52078..d907a0a72bf8 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -509,7 +509,7 @@ void FuText::Activate() { // no text object in EditMode, therefore set CreateMode - pView->SetCurrentObj(OBJ_TEXT); + pView->SetCurrentObj(SdrObjKind::Text); pView->SetCreateMode(); } @@ -552,11 +552,11 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, if ( !pObj ) return; - sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); + SdrObjKind nSdrObjKind = pObj->GetObjIdentifier(); - if (!(nSdrObjKind == OBJ_TEXT || - nSdrObjKind == OBJ_TITLETEXT || - nSdrObjKind == OBJ_OUTLINETEXT || + if (!(nSdrObjKind == SdrObjKind::Text || + nSdrObjKind == SdrObjKind::TitleText || + nSdrObjKind == SdrObjKind::OutlineText || dynamic_cast<const SdrTextObj*>( pObj) != nullptr)) return; diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index c442df3f502f..2a31d1d38056 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -30,6 +30,7 @@ class ScDocument; class ScDocShell; class ScNavigatorDlg; struct ImplSVEvent; +enum class SdrObjKind : sal_uInt16; enum class ScContentId { ROOT, TABLE, RANGENAME, DBAREA, @@ -75,7 +76,7 @@ class ScContentTree void GetDrawingNames(); void GetNoteStrings(); - static bool IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier ); + static bool IsPartOfType( ScContentId nContentType, SdrObjKind nObjIdentifier ); bool DrawNamesChanged( ScContentId nType ); bool NoteStringsChanged(); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 39577acb5a00..c6fa3fcc7eab 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -793,19 +793,19 @@ void ScContentTree::GetDbNames() } } -bool ScContentTree::IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier ) +bool ScContentTree::IsPartOfType( ScContentId nContentType, SdrObjKind nObjIdentifier ) { bool bRet = false; switch ( nContentType ) { case ScContentId::GRAPHIC: - bRet = ( nObjIdentifier == OBJ_GRAF ); + bRet = ( nObjIdentifier == SdrObjKind::Graphic ); break; case ScContentId::OLEOBJECT: - bRet = ( nObjIdentifier == OBJ_OLE2 ); + bRet = ( nObjIdentifier == SdrObjKind::OLE2 ); break; case ScContentId::DRAWING: - bRet = ( nObjIdentifier != OBJ_GRAF && nObjIdentifier != OBJ_OLE2 ); // everything else + bRet = ( nObjIdentifier != SdrObjKind::Graphic && nObjIdentifier != SdrObjKind::OLE2 ); // everything else break; default: OSL_FAIL("unknown content type"); @@ -1108,7 +1108,7 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, std::u16string_view rName, { bool bOle = ( nType == ScContentId::OLEOBJECT ); bool bGraf = ( nType == ScContentId::GRAPHIC ); - sal_uInt16 nDrawId = sal::static_int_cast<sal_uInt16>( bOle ? OBJ_OLE2 : ( bGraf ? OBJ_GRAF : OBJ_GRUP ) ); + SdrObjKind nDrawId = bOle ? SdrObjKind::OLE2 : ( bGraf ? SdrObjKind::Graphic : SdrObjKind::Group ); SCTAB nTab = 0; SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab ); if (pObject) @@ -1124,7 +1124,7 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, std::u16string_view rName, // that the EmbeddedObjectContainer gets copied. We need no CheckOle // here, test is simpler. ScDocShellRef aDragShellRef; - if(OBJ_OLE2 == pObject->GetObjIdentifier()) + if(SdrObjKind::OLE2 == pObject->GetObjIdentifier()) { aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately aDragShellRef->DoInitNew(); diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 19b32fddfb8b..d1f3592cecf3 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -207,8 +207,8 @@ void ScGridWinUIObject::execute(const OUString& rAction, { SdrMark* pMark = rMarkList.GetMark(0); SdrObject* pObj = pMark->GetMarkedSdrObj(); - sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); - if (nSdrObjKind == OBJ_OLE2) + SdrObjKind nSdrObjKind = pObj->GetObjIdentifier(); + if (nSdrObjKind == SdrObjKind::OLE2) { ScTabViewShell* pViewShell = getViewShell(); pViewShell->ActivateObject(static_cast<SdrOle2Obj*>(pObj), css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY); @@ -373,7 +373,7 @@ std::set<OUString> collect_charts(VclPtr<ScGridWindow> const & xGridWindow) SdrObject* pObject = aIter.Next(); while (pObject) { - if (pObject->GetObjIdentifier() == OBJ_OLE2) + if (pObject->GetObjIdentifier() == SdrObjKind::OLE2) { aRet.insert(static_cast<SdrOle2Obj*>(pObject)->GetPersistName()); } diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 467e93cb7145..7ce4c23d17c2 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -1454,7 +1454,7 @@ SdrObject* ScUndoRenameObject::GetObject() SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->GetPersistName() == aPersistName ) { return pObject; diff --git a/sc/source/ui/unoobj/ChartTools.cxx b/sc/source/ui/unoobj/ChartTools.cxx index b405557d1c8b..6ce72bd9e792 100644 --- a/sc/source/ui/unoobj/ChartTools.cxx +++ b/sc/source/ui/unoobj/ChartTools.cxx @@ -78,7 +78,7 @@ SdrOle2Obj* ChartIterator::next() SdrObject* pObject = m_pIterator->Next(); while (pObject) { - if (pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart(pObject)) + if (pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject)) { SdrOle2Obj* pOleObject = static_cast<SdrOle2Obj*>(pObject); diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx index 291084b99500..e4d09f459f91 100644 --- a/sc/source/ui/unoobj/TablePivotCharts.cxx +++ b/sc/source/ui/unoobj/TablePivotCharts.cxx @@ -86,7 +86,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName, OUString aName = rName; SCTAB nDummy; - if (!aName.isEmpty() && pModel->GetNamedObject(aName, OBJ_OLE2, nDummy)) + if (!aName.isEmpty() && pModel->GetNamedObject(aName, SdrObjKind::OLE2, nDummy)) { // object exists - only RuntimeException is specified throw uno::RuntimeException(); diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 1de57336b2b4..9bf802f812d5 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -99,7 +99,7 @@ rtl::Reference<ScChartObj> ScChartsObj::GetObjectByIndex_Impl(tools::Long nIndex SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject) ) { if ( nPos == nIndex ) { @@ -153,7 +153,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, OUString aName = rName; SCTAB nDummy; - if ( !aName.isEmpty() && pModel->GetNamedObject( aName, OBJ_OLE2, nDummy ) ) + if ( !aName.isEmpty() && pModel->GetNamedObject( aName, SdrObjKind::OLE2, nDummy ) ) { // object exists - only RuntimeException is specified throw uno::RuntimeException(); @@ -309,7 +309,7 @@ sal_Int32 SAL_CALL ScChartsObj::getCount() SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject) ) ++nCount; pObject = aIter.Next(); } @@ -374,7 +374,7 @@ uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames() SdrObject* pObject = aIter.Next(); while (pObject) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart(pObject) ) + if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject) ) { OUString aName; uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(pObject)->GetObjRef(); diff --git a/sc/source/ui/view/dbfunc4.cxx b/sc/source/ui/view/dbfunc4.cxx index 64f444dbf51b..f13035b29108 100644 --- a/sc/source/ui/view/dbfunc4.cxx +++ b/sc/source/ui/view/dbfunc4.cxx @@ -46,7 +46,7 @@ sal_uInt16 ScDBFunc::DoUpdateCharts(const ScAddress& rPos, ScDocument& rDoc, boo SdrObject* pObject = aIter.Next(); while (pObject) { - if (pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart(pObject)) + if (pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject)) { OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName(); bool bHit = true; diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 2887f26811cd..9efc96a34e08 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -210,8 +210,8 @@ void getOleSourceRanges(const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneO if ( !pObj ) continue; - sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); - if (nSdrObjKind == OBJ_OLE2) + SdrObjKind nSdrObjKind = pObj->GetObjIdentifier(); + if (nSdrObjKind == SdrObjKind::OLE2) { rAnyOle = true; rOneOle = (nCount == 1); @@ -226,7 +226,7 @@ void getOleSourceRanges(const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneO SdrObject* pSubObj = aIter.Next(); while (pSubObj) { - if ( pSubObj->GetObjIdentifier() == OBJ_OLE2 ) + if ( pSubObj->GetObjIdentifier() == SdrObjKind::OLE2 ) { rAnyOle = true; // rOneOle remains false - a group isn't treated like a single OLE object @@ -438,10 +438,10 @@ void ScDrawView::SetMarkedOriginalSize() for (size_t i=0; i<nCount; ++i) { SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); - sal_uInt16 nIdent = pObj->GetObjIdentifier(); + SdrObjKind nIdent = pObj->GetObjIdentifier(); bool bDo = false; Size aOriginalSize; - if (nIdent == OBJ_OLE2) + if (nIdent == SdrObjKind::OLE2) { // TODO/LEAN: working with visual area can switch object to running state uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(pObj)->GetObjRef(); @@ -473,7 +473,7 @@ void ScDrawView::SetMarkedOriginalSize() } } } - else if (nIdent == OBJ_GRAF) + else if (nIdent == SdrObjKind::Graphic) { const Graphic& rGraphic = static_cast<SdrGrafObj*>(pObj)->GetGraphic(); @@ -565,7 +565,7 @@ void ScDrawView::FitToCellSize() } pUndoGroup->AddAction( std::make_unique<SdrUndoGeoObj>( *pObj ) ); - if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) + if (pObj->GetObjIdentifier() == SdrObjKind::CustomShape) pObj->AdjustToMaxRect(aCellRect); else pObj->SetSnapRect(aCellRect); diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 0254e62fb2be..71dd9809b0d0 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -402,7 +402,7 @@ void ScDrawView::MarkListHasChanged() if (nMarkCount == 1) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if (pObj->GetObjIdentifier() == OBJ_OLE2) + if (pObj->GetObjIdentifier() == SdrObjKind::OLE2) { pOle2Obj = static_cast<SdrOle2Obj*>(pObj); if (!ScDocument::IsChart(pObj) ) @@ -411,18 +411,18 @@ void ScDrawView::MarkListHasChanged() pViewSh->SetChartShell(true); bSubShellSet = true; } - else if (pObj->GetObjIdentifier() == OBJ_GRAF) + else if (pObj->GetObjIdentifier() == SdrObjKind::Graphic) { pGrafObj = static_cast<SdrGrafObj*>(pObj); pViewSh->SetGraphicShell(true); bSubShellSet = true; } - else if (pObj->GetObjIdentifier() == OBJ_MEDIA) + else if (pObj->GetObjIdentifier() == SdrObjKind::Media) { pViewSh->SetMediaShell(true); bSubShellSet = true; } - else if (pObj->GetObjIdentifier() != OBJ_TEXT // prevent switching to the drawing shell + else if (pObj->GetObjIdentifier() != SdrObjKind::Text // prevent switching to the drawing shell || !pViewSh->IsDrawTextShell()) // when creating a text object @#70206# { pViewSh->SetDrawShell(true); @@ -453,7 +453,7 @@ void ScDrawView::MarkListHasChanged() if (dynamic_cast<const SdrUnoObj*>( pSubObj) == nullptr) bOnlyControls = false; - if (pSubObj->GetObjIdentifier() != OBJ_GRAF) + if (pSubObj->GetObjIdentifier() != SdrObjKind::Graphic) bOnlyGraf = false; if ( !bOnlyControls && !bOnlyGraf ) break; @@ -463,7 +463,7 @@ void ScDrawView::MarkListHasChanged() { if (dynamic_cast<const SdrUnoObj*>( pObj) == nullptr) bOnlyControls = false; - if (pObj->GetObjIdentifier() != OBJ_GRAF) + if (pObj->GetObjIdentifier() != SdrObjKind::Graphic) bOnlyGraf = false; } diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index a096a766ea7d..0c3b35f56442 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -97,7 +97,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) if ( nNewId == SID_DRAW_SELECT ) nNewId = SID_OBJECT_SELECT; - SdrObjKind eNewFormObjKind = OBJ_NONE; + SdrObjKind eNewFormObjKind = SdrObjKind::NONE; if (nNewId == SID_FM_CREATE_CONTROL) { const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER); @@ -132,7 +132,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) bEx = true; } else if ( nNewId == nDrawSfxId && ( nNewId != SID_FM_CREATE_CONTROL || - eNewFormObjKind == eFormObjKind || eNewFormObjKind == OBJ_NONE ) && !bSwitchCustom ) + eNewFormObjKind == eFormObjKind || eNewFormObjKind == SdrObjKind::NONE ) && !bSwitchCustom ) { // #i52871# if a different custom shape is selected, the slot id can be the same, // so the custom shape type string has to be compared, too. diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 3d545dd109aa..374e8a667973 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -272,7 +272,7 @@ ErrCode ScTabViewShell::DoVerb(sal_Int32 nVerb) if (rMarkList.GetMarkCount() == 1) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if (pObj->GetObjIdentifier() == OBJ_OLE2) + if (pObj->GetObjIdentifier() == SdrObjKind::OLE2) pOle2Obj = static_cast<SdrOle2Obj*>(pObj); } @@ -450,9 +450,9 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) SdrMark* pMark = rMarkList.GetMark(0); SdrObject* pObj = pMark->GetMarkedSdrObj(); - sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); + SdrObjKind nSdrObjKind = pObj->GetObjIdentifier(); - if (nSdrObjKind == OBJ_OLE2) + if (nSdrObjKind == SdrObjKind::OLE2) { if ( static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() ) { diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx index 26d67585301b..365d51117292 100644 --- a/sc/source/ui/view/tabvwshg.cxx +++ b/sc/source/ui/view/tabvwshg.cxx @@ -63,7 +63,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR SdrObject* pObj = SdrObjFactory::MakeNewObject( *pModel, SdrInventor::FmForm, - OBJ_FM_BUTTON); + SdrObjKind::FormButton); SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj ); OSL_ENSURE( pUnoCtrl, "no SdrUnoObj"); diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index 8eb262187b0e..4e45f0153a21 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -141,7 +141,7 @@ static uno::Reference < embed::XEmbeddedObject > lcl_GetSelectedObj( const SdrVi if (rMarkList.GetMarkCount() == 1) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if (pObj->GetObjIdentifier() == OBJ_OLE2) + if (pObj->GetObjIdentifier() == SdrObjKind::OLE2) { SdrOle2Obj* pOle2Obj = static_cast<SdrOle2Obj*>(pObj); xRet = pOle2Obj->GetObjRef(); |