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 /sw | |
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 'sw')
27 files changed, 139 insertions, 143 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index d074f0d552a7..a3070642aa16 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -535,7 +535,7 @@ public: bool EnterDrawTextMode(const Point& aDocPos); /// Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position. bool EnterShapeDrawTextMode(SdrObject* pObject); - void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear(); m_eFormObjKind = OBJ_NONE; } + void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear(); m_eFormObjKind = SdrObjKind::NONE; } bool IsDrawMode() const { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); } bool IsFormMode() const; bool IsBezierEditMode() const; diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index abb6d02556f8..3463f850d3dd 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2360,7 +2360,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) // Start creating a custom shape that overlaps with the rounded rectangle // already present in the document. Point aStartPos(8000, 3000); - pWrtShell->BeginCreate(OBJ_CUSTOMSHAPE, aStartPos); + pWrtShell->BeginCreate(SdrObjKind::CustomShape, aStartPos); // Set its size. Point aMovePos(10000, 5000); diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index bae2c4ab350a..ef4cea15476b 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment) SwDoc* pDoc = createSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); Point aStartPos(1000, 1000); - pWrtShell->BeginCreate(OBJ_RECT, aStartPos); + pWrtShell->BeginCreate(SdrObjKind::Rectangle, aStartPos); Point aMovePos(2000, 2000); pWrtShell->MoveCreate(aMovePos); pWrtShell->EndCreate(SdrCreateCmd::ForceEnd); diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 03162a0a33ad..626e3e0463f1 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -893,7 +893,8 @@ void AccessibilityCheck::checkObject(SdrObject* pObject) && FindFrameFormat(pObject)->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) lclAddIssue(m_aIssueCollection, SwResId(STR_FLOATING_TEXT)); - if (pObject->GetObjIdentifier() == OBJ_CUSTOMSHAPE || pObject->GetObjIdentifier() == OBJ_TEXT) + if (pObject->GetObjIdentifier() == SdrObjKind::CustomShape + || pObject->GetObjIdentifier() == SdrObjKind::Text) { OUString sAlternative = pObject->GetTitle(); if (sAlternative.isEmpty()) diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 48c29c519434..f4f463294087 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -182,7 +182,7 @@ SwContact* GetUserCall( const SdrObject* pObj ) bool IsMarqueeTextObj( const SdrObject& rObj ) { if (SdrInventor::Default != rObj.GetObjInventor() || - OBJ_TEXT != rObj.GetObjIdentifier()) + SdrObjKind::Text != rObj.GetObjIdentifier()) return false; SdrTextAniKind eTKind = static_cast<const SdrTextObj&>(rObj).GetTextAniKind(); return ( SdrTextAniKind::Scroll == eTKind diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 5e945db1bd3e..dd8ee2dab586 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -141,7 +141,7 @@ SdrInventor SwFlyDrawObj::GetObjInventor() const SdrObjKind SwFlyDrawObj::GetObjIdentifier() const { - return SwFlyDrawObjIdentifier; + return SdrObjKind::SwFlyDrawObjIdentifier; } // TODO: Need own primitive to get the FlyFrame paint working diff --git a/sw/source/core/draw/dobjfac.cxx b/sw/source/core/draw/dobjfac.cxx index fb08ba595984..818b870da72a 100644 --- a/sw/source/core/draw/dobjfac.cxx +++ b/sw/source/core/draw/dobjfac.cxx @@ -29,7 +29,7 @@ IMPL_STATIC_LINK( if ( aParams.nInventor == SdrInventor::Swg ) { // No switch, there's only one at the moment - OSL_ENSURE( aParams.nObjIdentifier == SwFlyDrawObjIdentifier, + OSL_ENSURE( aParams.nObjIdentifier == SdrObjKind::SwFlyDrawObjIdentifier, "Wrong inventor or identifier" ); return new SwFlyDrawObj(aParams.rSdrModel); } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index adc55dbfe9d2..985e9907ee92 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1530,7 +1530,7 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) pObj->ImpSetAnchorPos( aNull ); } - pView->SetCurrentObj( OBJ_GRUP ); + pView->SetCurrentObj( SdrObjKind::Group ); if ( nCnt > 1 ) pView->GroupMarked(); SdrObject *pObj = pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index e0212c28d57c..2e285cbe4dd0 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1782,7 +1782,7 @@ bool SwFEShell::BeginCreate( SdrObjKind eSdrObjectKind, const Point &rPos ) if ( GetPageNumber( rPos ) ) { Imp()->GetDrawView()->SetCurrentObj( eSdrObjectKind ); - if ( eSdrObjectKind == OBJ_CAPTION ) + if ( eSdrObjectKind == SdrObjKind::Caption ) bRet = Imp()->GetDrawView()->BegCreateCaptionObj( rPos, Size( lMinBorder - MINFLY, lMinBorder - MINFLY ), GetOut() ); @@ -1886,12 +1886,6 @@ bool SwFEShell::ImpEndCreate() const tools::Rectangle &rBound = rSdrObj.GetSnapRect(); Point aPt( rBound.TopRight() ); - // alien identifier should end up on defaults - // duplications possible!! - sal_uInt16 nIdent = SdrInventor::Default == rSdrObj.GetObjInventor() - ? rSdrObj.GetObjIdentifier() - : 0xFFFF; - // default for controls character bound, otherwise paragraph bound. SwFormatAnchor aAnch; const SwFrame *pAnch = nullptr; @@ -1943,7 +1937,7 @@ bool SwFEShell::ImpEndCreate() // of <nIdent> - value <0xFFFF> indicates control objects, which aren't // allowed in header/footer. //bool bBodyOnly = OBJ_NONE != nIdent; - bool bBodyOnly = 0xFFFF == nIdent; + bool bBodyOnly = SdrInventor::Default != rSdrObj.GetObjInventor(); bool bAtPage = false; const SwFrame* pPage = nullptr; SwCursorMoveState aState( CursorMoveState::SetOnlyText ); @@ -2065,7 +2059,7 @@ bool SwFEShell::ImpEndCreate() } } - if( OBJ_NONE == nIdent ) + if( SdrInventor::Default == rSdrObj.GetObjInventor() && rSdrObj.GetObjIdentifier() == SdrObjKind::NONE ) { // For OBJ_NONE a fly is inserted. const tools::Long nWidth = rBound.Right() - rBound.Left(); @@ -3034,7 +3028,7 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect if(pObj) { tools::Rectangle aRect(rRect); - if(OBJ_CARC == eSdrObjectKind || OBJ_CCUT == eSdrObjectKind) + if(SdrObjKind::CircleArc == eSdrObjectKind || SdrObjKind::CircleCut == eSdrObjectKind) { // force quadratic if(aRect.GetWidth() > aRect.GetHeight()) @@ -3068,8 +3062,8 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect switch(eSdrObjectKind) { - case OBJ_PATHLINE: - case OBJ_PATHFILL: + case SdrObjKind::PathLine: + case SdrObjKind::PathFill: { basegfx::B2DPolygon aInnerPoly; @@ -3091,8 +3085,8 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect aPoly.append(aInnerPoly); } break; - case OBJ_FREELINE: - case OBJ_FREEFILL: + case SdrObjKind::FreehandLine: + case SdrObjKind::FreehandFill: { basegfx::B2DPolygon aInnerPoly; @@ -3113,8 +3107,8 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect aPoly.append(aInnerPoly); } break; - case OBJ_POLY: - case OBJ_PLIN: + case SdrObjKind::Polygon: + case SdrObjKind::PolyLine: { basegfx::B2DPolygon aInnerPoly; sal_Int32 nWdt(aRect.GetWidth()); @@ -3129,7 +3123,7 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect aInnerPoly.append(basegfx::B2DPoint(aRect.Left() + (nWdt * 80) / 100, aRect.Top() + (nHgt * 75) / 100)); aInnerPoly.append(basegfx::B2DPoint(aRect.Bottom(), aRect.Right())); - if(OBJ_PLIN == eSdrObjectKind) + if(SdrObjKind::PolyLine == eSdrObjectKind) { aInnerPoly.append(basegfx::B2DPoint(aRect.Center().getX(), aRect.Bottom())); } @@ -3141,7 +3135,7 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect aPoly.append(aInnerPoly); } break; - case OBJ_LINE : + case SdrObjKind::Line : { sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); basegfx::B2DPolygon aTempPoly; diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index 2839a2febe4d..a6f42fc7f42c 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -352,7 +352,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) m_pMarquee = SdrObjFactory::MakeNewObject( *pModel, SdrInventor::Default, - OBJ_TEXT); + SdrObjKind::Text); if( !m_pMarquee ) return; @@ -525,7 +525,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) void SwHTMLParser::EndMarquee() { - OSL_ENSURE( m_pMarquee && OBJ_TEXT==m_pMarquee->GetObjIdentifier(), + OSL_ENSURE( m_pMarquee && SdrObjKind::Text==m_pMarquee->GetObjIdentifier(), "no marquee or wrong type" ); if( m_bFixMarqueeWidth ) @@ -553,7 +553,7 @@ void SwHTMLParser::EndMarquee() void SwHTMLParser::InsertMarqueeText() { - OSL_ENSURE( m_pMarquee && OBJ_TEXT==m_pMarquee->GetObjIdentifier(), + OSL_ENSURE( m_pMarquee && SdrObjKind::Text==m_pMarquee->GetObjIdentifier(), "no marquee or wrong type" ); // append the current text part to the text @@ -562,10 +562,10 @@ void SwHTMLParser::InsertMarqueeText() void SwHTMLParser::ResizeDrawObject( SdrObject* pObj, SwTwips nWidth ) { - OSL_ENSURE( OBJ_TEXT==pObj->GetObjIdentifier(), + OSL_ENSURE( SdrObjKind::Text==pObj->GetObjIdentifier(), "no marquee or wrong type" ); - if( OBJ_TEXT!=pObj->GetObjIdentifier() ) + if( SdrObjKind::Text!=pObj->GetObjIdentifier() ) return; // the old size diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 7166ed49565f..4541714fdf00 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -144,11 +144,11 @@ bool lcl_IsRotateAngleValid(const SdrObject& rObj) // have been incorporated. switch (rObj.GetObjIdentifier()) { - case OBJ_GRUP: - case OBJ_LINE: - case OBJ_PLIN: - case OBJ_PATHLINE: - case OBJ_PATHFILL: + case SdrObjKind::Group: + case SdrObjKind::Line: + case SdrObjKind::PolyLine: + case SdrObjKind::PathLine: + case SdrObjKind::PathFill: return false; default: return true; @@ -302,7 +302,7 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) basegfx::B2DPolyPolygon aPolyPolygon; switch (pSdrObj->GetObjIdentifier()) { - case OBJ_CUSTOMSHAPE: + case SdrObjKind::CustomShape: { // EnhancedCustomShapeEngine::GetLineGeometry() is not directly usable, because the wrap // polygon acts on the untransformed shape in Word. We do here similar as in @@ -371,19 +371,19 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) aPolyPolygon.transform(aTranslateToCenter); break; } // end case OBJ_CUSTOMSHAPE - case OBJ_LINE: + case SdrObjKind::Line: { aContour.Insert(0, Point(0, 0)); aContour.Insert(1, Point(21600, 21600)); aContour.Insert(2, Point(0, 0)); return aContour; } - case OBJ_PATHFILL: - case OBJ_PATHLINE: - case OBJ_FREEFILL: - case OBJ_FREELINE: - case OBJ_PATHPOLY: - case OBJ_PATHPLIN: + case SdrObjKind::PathFill: + case SdrObjKind::PathLine: + case SdrObjKind::FreehandFill: + case SdrObjKind::FreehandLine: + case SdrObjKind::PathPoly: + case SdrObjKind::PathPolyLine: // case OBJ_POLY: FixMe: Creating wrap polygon would work, but export to DML is currently // case OBJ_PLIN: disabled for unknown reason; related bug 75254. { @@ -424,7 +424,7 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) aPolyPolygon.transform(aTranslateToCenter); break; } - case OBJ_NONE: + case SdrObjKind::NONE: default: break; } @@ -736,7 +736,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons sal_Int32 nTopExt(0); sal_Int32 nBottomExt(0); - if ((!pObj) || (pObj && (pObj->GetObjIdentifier() == SwFlyDrawObjIdentifier))) + if ((!pObj) || (pObj && (pObj->GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier))) { // Frame objects have a restricted shadow and no further effects. They have border instead of // stroke. LO includes shadow and border in the object size, but Word not. @@ -804,7 +804,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons { // Word 2007 makes no width-height-swap for images. Detect this situation. sal_Int32 nMode = m_pImpl->getExport().getWordCompatibilityModeFromGrabBag(); - bool bIsWord2007Image(nMode > 0 && nMode < 14 && pObj->GetObjIdentifier() == OBJ_GRAF); + bool bIsWord2007Image(nMode > 0 && nMode < 14 + && pObj->GetObjIdentifier() == SdrObjKind::Graphic); // Word cannot handle negative EffectExtent although allowed in OOXML, the 'dist' attributes // may not be negative. Take care of that. @@ -926,7 +927,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons aPos.X += nPosXDiff; // Make the postponed position move of frames. aPos.Y += nPosYDiff; if (pObj && lcl_IsRotateAngleValid(*pObj) - && pObj->GetObjIdentifier() != SwFlyDrawObjIdentifier) + && pObj->GetObjIdentifier() != SdrObjKind::SwFlyDrawObjIdentifier) lclMovePositionWithRotation(aPos, rSize, pObj->GetRotateAngle()); const char* relativeFromH; diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 69528309fdd2..60c8e9f4c352 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -680,7 +680,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const // rotating to vertical means swapping height and width as seen in SvxMSDffManager::ImportShape const Degree100 nAngle = NormAngle36000( pObj->GetRotateAngle() ); - const bool bAllowSwap = pObj->GetObjIdentifier() != OBJ_LINE && pObj->GetObjIdentifier() != OBJ_GRUP; + const bool bAllowSwap = pObj->GetObjIdentifier() != SdrObjKind::Line && pObj->GetObjIdentifier() != SdrObjKind::Group; if ( bAllowSwap && (( nAngle > 4500_deg100 && nAngle <= 13500_deg100 ) || ( nAngle > 22500_deg100 && nAngle <= 31500_deg100 )) ) { const tools::Long nWidth = aRect.getWidth(); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index edd44eb3cfd5..c4f3bf269ce9 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -332,7 +332,7 @@ SdrObject* SwWW8ImplReader::ReadLine(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet aPolygon.append(::basegfx::B2DPoint(aP[1].X(), aP[1].Y())); SdrObject* pObj = new SdrPathObj( *m_pDrawModel, - OBJ_LINE, + SdrObjKind::Line, ::basegfx::B2DPolyPolygon(aPolygon)); SetStdAttr( rSet, aLine.aLnt, aLine.aShd ); @@ -454,7 +454,7 @@ SdrObject* SwWW8ImplReader::ReadPolyLine(WW8_DPHEAD const * pHd, SfxAllItemSet & SdrObject* pObj = new SdrPathObj( *m_pDrawModel, - (SVBT16ToUInt16(aPoly.aBits1) & 0x1) ? OBJ_POLY : OBJ_PLIN, + (SVBT16ToUInt16(aPoly.aBits1) & 0x1) ? SdrObjKind::Polygon : SdrObjKind::PolyLine, ::basegfx::B2DPolyPolygon(aP.getB2DPolygon())); SetStdAttr( rSet, aPoly.aLnt, aPoly.aShd ); @@ -1255,7 +1255,7 @@ SdrObject* SwWW8ImplReader::ReadTextBox(WW8_DPHEAD const * pHd, SfxAllItemSet &r SdrRectObj* pObj = new SdrRectObj( *m_pDrawModel, - OBJ_TEXT, + SdrObjKind::Text, tools::Rectangle(aP0, aP1)); pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1)); @@ -2605,11 +2605,11 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( tools::Long nGrafAnchorCp ) switch (pObject->GetObjIdentifier()) { - case OBJ_GRAF: + case SdrObjKind::Graphic: bReplaceable = true; bDone = true; break; - case OBJ_OLE2: + case SdrObjKind::OLE2: bReplaceable = true; break; default: @@ -2886,7 +2886,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SvxMSDffImportRec& rRecord, // the group for holding the text. pSdrTextObj = new SdrRectObj( *m_pDrawModel, - OBJ_TEXT, + SdrObjKind::Text, pThisGroup->GetCurrentBoundRect()); SfxItemSet aSet(m_pDrawModel->GetItemPool()); @@ -3120,7 +3120,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ImportReplaceableDrawables(SdrObject* &rpObje MatchEscherMirrorIntoFlySet(rRecord, aGrSet); OUString aObjectName(rpObject->GetName()); - if (OBJ_OLE2 == rpObject->GetObjIdentifier()) + if (SdrObjKind::OLE2 == rpObject->GetObjIdentifier()) pRetFrameFormat = InsertOle(*static_cast<SdrOle2Obj*>(rpObject), rFlySet, &aGrSet); else { @@ -3155,7 +3155,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ImportReplaceableDrawables(SdrObject* &rpObje if (pRetFrameFormat) { - if (OBJ_OLE2 != rpObject->GetObjIdentifier()) + if (SdrObjKind::OLE2 != rpObject->GetObjIdentifier()) SetAttributesAtGrfNode(rRecord, *pRetFrameFormat, &rF); // avoid multiple occurrences of the same graphic name m_aGrfNameGenerator.SetUniqueGraphName(pRetFrameFormat, aObjectName); diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 8de703570f9f..5ec3a93a5059 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -652,7 +652,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj, ReplaceObj(*pTextObj, *pObject); else { - if (sal_uInt16(OBJ_OLE2) == pObject->GetObjIdentifier()) + if (SdrObjKind::OLE2 == pObject->GetObjIdentifier()) { // the size from BLIP, if there is any, should be already set pRet = InsertOle(*static_cast<SdrOle2Obj*>(pObject), aAttrSet, &aGrSet); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index be454d9e8ce2..ba06e730a70d 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -784,7 +784,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, SdrObject::Free( pObj ); pObj = new SdrRectObj( *pSdrModel, - OBJ_TEXT, + SdrObjKind::Text, rTextRect); } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 5b765f4f7816..91b4d970f5ad 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -719,7 +719,7 @@ inline void SwEditWin::EnterArea() */ void SwEditWin::InsFrame(sal_uInt16 nCols) { - StdDrawMode( OBJ_NONE, false ); + StdDrawMode( SdrObjKind::NONE, false ); m_bInsFrame = true; m_nInsFrameColCount = nCols; } @@ -4537,7 +4537,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) { rSh.EnterSelFrameMode(); if (!m_rView.GetDrawFuncPtr()) - StdDrawMode( OBJ_NONE, true ); + StdDrawMode( SdrObjKind::NONE, true ); } else if ( rSh.IsFrameSelected() ) { @@ -5157,7 +5157,7 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView): m_eBezierMode(SID_BEZIER_INSERT), m_nInsFrameColCount( 1 ), - m_eDrawMode(OBJ_NONE), + m_eDrawMode(SdrObjKind::NONE), m_bMBPressed(false), m_bInsDraw(false), diff --git a/sw/source/uibase/ribbar/conarc.cxx b/sw/source/uibase/ribbar/conarc.cxx index 8be117f13c99..4e55dc59ce1f 100644 --- a/sw/source/uibase/ribbar/conarc.cxx +++ b/sw/source/uibase/ribbar/conarc.cxx @@ -75,16 +75,16 @@ void ConstArc::Activate(const sal_uInt16 nSlotId) switch (nSlotId) { case SID_DRAW_ARC: - m_pWin->SetSdrDrawMode(OBJ_CARC); + m_pWin->SetSdrDrawMode(SdrObjKind::CircleArc); break; case SID_DRAW_PIE: - m_pWin->SetSdrDrawMode(OBJ_SECT); + m_pWin->SetSdrDrawMode(SdrObjKind::CircleSection); break; case SID_DRAW_CIRCLECUT: - m_pWin->SetSdrDrawMode(OBJ_CCUT); + m_pWin->SetSdrDrawMode(SdrObjKind::CircleCut); break; default: - m_pWin->SetSdrDrawMode(OBJ_NONE); + m_pWin->SetSdrDrawMode(SdrObjKind::NONE); break; } diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index a38f5584f3f7..da15182d17f0 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -91,7 +91,7 @@ bool ConstCustomShape::MouseButtonDown(const MouseEvent& rMEvt) void ConstCustomShape::Activate(const sal_uInt16 nSlotId) { - m_pWin->SetSdrDrawMode( OBJ_CUSTOMSHAPE ); + m_pWin->SetSdrDrawMode( SdrObjKind::CustomShape ); SwDrawBase::Activate(nSlotId); } diff --git a/sw/source/uibase/ribbar/conpoly.cxx b/sw/source/uibase/ribbar/conpoly.cxx index 481722734702..c4a245fda8af 100644 --- a/sw/source/uibase/ribbar/conpoly.cxx +++ b/sw/source/uibase/ribbar/conpoly.cxx @@ -38,8 +38,8 @@ bool ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt) if (m_pSh->IsDrawCreate()) { if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 && - m_pWin->GetSdrDrawMode() != OBJ_FREELINE && - m_pWin->GetSdrDrawMode() != OBJ_FREEFILL) + m_pWin->GetSdrDrawMode() != SdrObjKind::FreehandLine && + m_pWin->GetSdrDrawMode() != SdrObjKind::FreehandFill) { if (!m_pSh->EndCreate(SdrCreateCmd::NextPoint)) { @@ -69,28 +69,28 @@ void ConstPolygon::Activate(const sal_uInt16 nSlotId) { case SID_DRAW_POLYGON_NOFILL: case SID_DRAW_XPOLYGON_NOFILL: - m_pWin->SetSdrDrawMode(OBJ_PLIN); + m_pWin->SetSdrDrawMode(SdrObjKind::PolyLine); break; case SID_DRAW_POLYGON: case SID_DRAW_XPOLYGON: - m_pWin->SetSdrDrawMode(OBJ_POLY); + m_pWin->SetSdrDrawMode(SdrObjKind::Polygon); break; case SID_DRAW_BEZIER_NOFILL: - m_pWin->SetSdrDrawMode(OBJ_PATHLINE); + m_pWin->SetSdrDrawMode(SdrObjKind::PathLine); break; case SID_DRAW_BEZIER_FILL: - m_pWin->SetSdrDrawMode(OBJ_PATHFILL); + m_pWin->SetSdrDrawMode(SdrObjKind::PathFill); break; case SID_DRAW_FREELINE_NOFILL: - m_pWin->SetSdrDrawMode(OBJ_FREELINE); + m_pWin->SetSdrDrawMode(SdrObjKind::FreehandLine); break; case SID_DRAW_FREELINE: - m_pWin->SetSdrDrawMode(OBJ_FREEFILL); + m_pWin->SetSdrDrawMode(SdrObjKind::FreehandFill); break; default: diff --git a/sw/source/uibase/ribbar/conrect.cxx b/sw/source/uibase/ribbar/conrect.cxx index 59630eef8389..589db379e660 100644 --- a/sw/source/uibase/ribbar/conrect.cxx +++ b/sw/source/uibase/ribbar/conrect.cxx @@ -50,7 +50,7 @@ bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) if (bReturn) { - if (m_pWin->GetSdrDrawMode() == OBJ_CAPTION) + if (m_pWin->GetSdrDrawMode() == SdrObjKind::Caption) { m_pView->NoRotate(); if (m_pView->IsDrawSelMode()) @@ -85,7 +85,7 @@ bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) : nullptr; switch( m_pWin->GetSdrDrawMode() ) { - case OBJ_TEXT: + case SdrObjKind::Text: if( bMarquee ) { m_pSh->ChgAnchor(RndStdIds::FLY_AS_CHAR); @@ -133,7 +133,7 @@ bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); break; - case OBJ_CAPTION: + case SdrObjKind::Caption: { SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj); if( bCapVertical && pCaptObj ) @@ -167,44 +167,44 @@ void ConstRectangle::Activate(const sal_uInt16 nSlotId) case SID_LINE_ARROWS: case SID_DRAW_LINE: case SID_DRAW_XLINE: - m_pWin->SetSdrDrawMode(OBJ_LINE); + m_pWin->SetSdrDrawMode(SdrObjKind::Line); break; case SID_DRAW_MEASURELINE: - m_pWin->SetSdrDrawMode(OBJ_MEASURE); + m_pWin->SetSdrDrawMode(SdrObjKind::Measure); break; case SID_DRAW_RECT: - m_pWin->SetSdrDrawMode(OBJ_RECT); + m_pWin->SetSdrDrawMode(SdrObjKind::Rectangle); break; case SID_DRAW_ELLIPSE: - m_pWin->SetSdrDrawMode(OBJ_CIRC); + m_pWin->SetSdrDrawMode(SdrObjKind::CircleOrEllipse); break; case SID_DRAW_TEXT_MARQUEE: bMarquee = true; - m_pWin->SetSdrDrawMode(OBJ_TEXT); + m_pWin->SetSdrDrawMode(SdrObjKind::Text); break; case SID_DRAW_TEXT_VERTICAL: mbVertical = true; - m_pWin->SetSdrDrawMode(OBJ_TEXT); + m_pWin->SetSdrDrawMode(SdrObjKind::Text); break; case SID_DRAW_TEXT: - m_pWin->SetSdrDrawMode(OBJ_TEXT); + m_pWin->SetSdrDrawMode(SdrObjKind::Text); break; case SID_DRAW_CAPTION_VERTICAL: bCapVertical = true; [[fallthrough]]; case SID_DRAW_CAPTION: - m_pWin->SetSdrDrawMode(OBJ_CAPTION); + m_pWin->SetSdrDrawMode(SdrObjKind::Caption); break; default: - m_pWin->SetSdrDrawMode(OBJ_NONE); + m_pWin->SetSdrDrawMode(SdrObjKind::NONE); break; } diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx index 2072ee25a12b..b88c964aa7f2 100644 --- a/sw/source/uibase/ribbar/drawbase.cxx +++ b/sw/source/uibase/ribbar/drawbase.cxx @@ -248,12 +248,12 @@ bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) { const SdrObjKind nDrawMode = m_pWin->GetSdrDrawMode(); //objects with multiple point may end at the start position - bool bMultiPoint = OBJ_PLIN == nDrawMode || - OBJ_POLY == nDrawMode || - OBJ_PATHLINE == nDrawMode || - OBJ_PATHFILL == nDrawMode || - OBJ_FREELINE == nDrawMode || - OBJ_FREEFILL == nDrawMode; + bool bMultiPoint = SdrObjKind::PolyLine == nDrawMode || + SdrObjKind::Polygon == nDrawMode || + SdrObjKind::PathLine == nDrawMode || + SdrObjKind::PathFill == nDrawMode || + SdrObjKind::FreehandLine == nDrawMode || + SdrObjKind::FreehandFill == nDrawMode; if(rMEvt.IsRight() || (aPnt == m_aStartPos && !bMultiPoint)) { m_pSh->BreakCreate(); @@ -261,7 +261,7 @@ bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) } else { - if (OBJ_NONE == nDrawMode) + if (SdrObjKind::NONE == nDrawMode) { SwRewriter aRewriter; @@ -270,7 +270,7 @@ bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) } m_pSh->EndCreate(SdrCreateCmd::ForceEnd); - if (OBJ_NONE == nDrawMode) // Text border inserted + if (SdrObjKind::NONE == nDrawMode) // Text border inserted { uno::Reference< frame::XDispatchRecorder > xRecorder = m_pSh->GetView().GetViewFrame()->GetBindings().GetRecorder(); @@ -298,7 +298,7 @@ bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) m_pSh->SetFlyFrameAttr( aSet ); } } - if (m_pWin->GetSdrDrawMode() == OBJ_NONE) + if (m_pWin->GetSdrDrawMode() == SdrObjKind::NONE) { m_pSh->EndUndo(); } diff --git a/sw/source/uibase/ribbar/dselect.cxx b/sw/source/uibase/ribbar/dselect.cxx index 4758934a34e9..205cb81fa5f5 100644 --- a/sw/source/uibase/ribbar/dselect.cxx +++ b/sw/source/uibase/ribbar/dselect.cxx @@ -34,7 +34,7 @@ DrawSelection::DrawSelection(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* void DrawSelection::Activate(const sal_uInt16 nSlotId) { - m_pWin->SetSdrDrawMode(OBJ_NONE); + m_pWin->SetSdrDrawMode(SdrObjKind::NONE); m_pWin->SetObjectSelect(true); SwDrawBase::Activate(nSlotId); diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index ff8579368812..dbc8aba00740 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -83,7 +83,7 @@ SwDrawBaseShell::SwDrawBaseShell(SwView &_rView) rWin.SetBezierMode(SID_BEZIER_MOVE); if ( !_rView.GetDrawFuncPtr() ) - _rView.GetEditWin().StdDrawMode( OBJ_NONE, true ); + _rView.GetEditWin().StdDrawMode( SdrObjKind::NONE, true ); SwTransferable::CreateSelection( GetShell() ); } @@ -184,7 +184,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) if ( pSh->IsFlyInFly() ) nAllowedAnchors |= SvxAnchorIds::Fly; - if (pObj->GetObjIdentifier() == OBJ_CAPTION ) + if (pObj->GetObjIdentifier() == SdrObjKind::Caption ) bCaption = true; if (bCaption) @@ -861,23 +861,23 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet) const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - sal_uInt16 nObjType = pObj->GetObjIdentifier(); + SdrObjKind nObjType = pObj->GetObjIdentifier(); // Only enable hyperlink for the following types switch (nObjType) { - case OBJ_PATHFILL: - case OBJ_SECT: - case OBJ_LINE: - case OBJ_CUSTOMSHAPE: - case OBJ_TEXT: - case OBJ_RECT: - case OBJ_CAPTION: - case OBJ_POLY: - case OBJ_PLIN: - case E3D_SCENE_ID: - case OBJ_MEASURE: - case OBJ_EDGE: + case SdrObjKind::PathFill: + case SdrObjKind::CircleSection: + case SdrObjKind::Line: + case SdrObjKind::CustomShape: + case SdrObjKind::Text: + case SdrObjKind::Rectangle: + case SdrObjKind::Caption: + case SdrObjKind::Polygon: + case SdrObjKind::PolyLine: + case SdrObjKind::E3D_Scene: + case SdrObjKind::Measure: + case SdrObjKind::Edge: break; default: rSet.DisableItem(nWhich); @@ -954,18 +954,18 @@ void SwDrawBaseShell::DisableState( 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/sw/source/uibase/shells/textdrw.cxx b/sw/source/uibase/shells/textdrw.cxx index b5b81e3f2228..881468c5d717 100644 --- a/sw/source/uibase/shells/textdrw.cxx +++ b/sw/source/uibase/shells/textdrw.cxx @@ -50,14 +50,14 @@ void SwBaseShell::InsertURLButton(const OUString& rURL, const OUString& rTarget, // OBJ_FM_BUTTON pSdrView->SetDesignMode(); - pSdrView->SetCurrentObj(OBJ_FM_BUTTON); + pSdrView->SetCurrentObj(SdrObjKind::FormButton); pSdrView->SetEditMode(false); Point aStartPos(rSh.GetCharRect().Pos() + Point(0, 1)); rSh.StartAction(); rSh.StartUndo( SwUndoId::UI_INSERT_URLBTN ); - if (rSh.BeginCreate(OBJ_FM_BUTTON, SdrInventor::FmForm, aStartPos)) + if (rSh.BeginCreate(SdrObjKind::FormButton, SdrInventor::FmForm, aStartPos)) { pSdrView->SetOrtho(false); Size aSz(GetView().GetEditWin().PixelToLogic(Size(140, 20))); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 094f3b92cad7..aa0a4738ee55 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -736,7 +736,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_nPageCnt(0), m_nDrawSfxId( USHRT_MAX ), m_nFormSfxId( USHRT_MAX ), - m_eFormObjKind(OBJ_NONE), + m_eFormObjKind(SdrObjKind::NONE), m_nLastPasteDestination( static_cast<SotExchangeDest>(0xFFFF) ), m_nLeftBorderDistance( 0 ), m_nRightBorderDistance( 0 ), diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 5b5799123708..c0214b893f19 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -82,7 +82,7 @@ void SwView::ExecDraw(const SfxRequest& rReq) if(pArgs && SfxItemState::SET == pArgs->GetItemState(GetPool().GetWhich(nSlotId), false, &pItem)) pStringItem = dynamic_cast< const SfxStringItem*>(pItem); - SdrObjKind eNewFormObjKind = OBJ_NONE; + SdrObjKind eNewFormObjKind = SdrObjKind::NONE; if (nSlotId == SID_FM_CREATE_CONTROL) { const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER); @@ -96,7 +96,7 @@ void SwView::ExecDraw(const SfxRequest& rReq) } else if (nSlotId == SID_FM_CREATE_CONTROL) { - if (eNewFormObjKind == m_eFormObjKind || eNewFormObjKind == OBJ_NONE) + if (eNewFormObjKind == m_eFormObjKind || eNewFormObjKind == SdrObjKind::NONE) { bDeselect = true; GetViewFrame()->GetDispatcher()->Execute(SID_FM_LEAVE_CREATE); // Button should popping out diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 11fa8afc92ab..0be83743b438 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -4224,24 +4224,24 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool) bool bMark = pDrawView->IsObjMarked(pTemp); switch( pTemp->GetObjIdentifier() ) { - case OBJ_GRUP: - case OBJ_TEXT: - case OBJ_LINE: - case OBJ_RECT: - case OBJ_CIRC: - case OBJ_SECT: - case OBJ_CARC: - case OBJ_CCUT: - case OBJ_POLY: - case OBJ_PLIN: - case OBJ_PATHLINE: - case OBJ_PATHFILL: - case OBJ_FREELINE: - case OBJ_FREEFILL: - case OBJ_PATHPOLY: - case OBJ_PATHPLIN: - case OBJ_CAPTION: - case OBJ_CUSTOMSHAPE: + case SdrObjKind::Group: + case SdrObjKind::Text: + case SdrObjKind::Line: + case SdrObjKind::Rectangle: + case SdrObjKind::CircleOrEllipse: + case SdrObjKind::CircleSection: + case SdrObjKind::CircleArc: + case SdrObjKind::CircleCut: + case SdrObjKind::Polygon: + case SdrObjKind::PolyLine: + case SdrObjKind::PathLine: + case SdrObjKind::PathFill: + case SdrObjKind::FreehandLine: + case SdrObjKind::FreehandFill: + case SdrObjKind::PathPoly: + case SdrObjKind::PathPolyLine: + case SdrObjKind::Caption: + case SdrObjKind::CustomShape: if( bMark ) hasObjectMarked = true; break; |