summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-05 14:04:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-06 17:16:09 +0100
commitde78304d92140901d19a6ea17bdc1d568df955c4 (patch)
treef0494ee90a4d7493e2381bbd17f5c1f337a35f0e /sc
parent8c9b8c5970a08c2ef0ccddb7a691f3731d39175a (diff)
make SdrObject Identifiers SdrObjKind enum members
with unique values so that, e.g. if (pObj->GetObjIdentifier() == OBJ_LINE) is only true if pObj is a SdrPathObj and not a E3dScene Change-Id: I30c91e57eb27141390c644dec42e2a4bee96edf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105374 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/drwlayer.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuconarc.cxx2
-rw-r--r--sc/source/ui/drawfunc/fuconpol.cxx2
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx2
-rw-r--r--sc/source/ui/drawfunc/fuconuno.cxx4
-rw-r--r--sc/source/ui/inc/fuconuno.hxx2
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/view/tabvwsh2.cxx10
-rw-r--r--sc/source/ui/view/tabvwshg.cxx2
9 files changed, 14 insertions, 17 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 4ef2e7d492c4..a9e177f01567 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -910,16 +910,13 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat
const ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObj);
if (aAnchorType == SCA_CELL_RESIZE)
{
- SdrPathObj* pLineObj = nullptr;
if (pObj->GetObjIdentifier() == OBJ_LINE)
- pLineObj = dynamic_cast<SdrPathObj*>(pObj);
- if (pLineObj)
{
// 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
// object are correct. Use them for recreating the anchor.
const basegfx::B2DPolygon aPoly(
- pLineObj->GetPathPoly().getB2DPolygon(0));
+ static_cast<SdrPathObj*>(pObj)->GetPathPoly().getB2DPolygon(0));
const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0));
const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1));
const Point aPointLT(FRound(std::min(aB2DPoint0.getX(), aB2DPoint1.getX())),
diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx
index 8ae2002b0b49..368a1fd68c06 100644
--- a/sc/source/ui/drawfunc/fuconarc.cxx
+++ b/sc/source/ui/drawfunc/fuconarc.cxx
@@ -95,7 +95,7 @@ void FuConstArc::Activate()
break;
}
- pView->SetCurrentObj( sal::static_int_cast<sal_uInt16>( aObjKind ) );
+ pView->SetCurrentObj(aObjKind);
aOldPointer = pWindow->GetPointer();
rViewShell.SetActivePointer( aNewPointer );
diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx
index e622a3e84fb4..bdb6807dcd56 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -150,7 +150,7 @@ void FuConstPolygon::Activate()
break;
}
- pView->SetCurrentObj(sal::static_int_cast<sal_uInt16>(eKind));
+ pView->SetCurrentObj(eKind);
pView->SetEditMode(SdrViewEditMode::Create);
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index edb82a66d32a..3ef1a03752cb 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -195,7 +195,7 @@ void FuConstRectangle::Activate()
break;
}
- pView->SetCurrentObj(sal::static_int_cast<sal_uInt16>(aObjKind));
+ pView->SetCurrentObj(aObjKind);
aOldPointer = pWindow->GetPointer();
rViewShell.SetActivePointer( aNewPointer );
diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx
index 6614b93776ca..6f543e516878 100644
--- a/sc/source/ui/drawfunc/fuconuno.cxx
+++ b/sc/source/ui/drawfunc/fuconuno.cxx
@@ -27,14 +27,14 @@ FuConstUnoControl::FuConstUnoControl(ScTabViewShell& rViewSh, vcl::Window* pWin,
SdrModel* pDoc, const SfxRequest& rReq)
: FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq)
, nInventor(SdrInventor::Unknown)
- , nIdentifier(0)
+ , nIdentifier(OBJ_NONE)
{
const SfxUInt32Item* pInventorItem = rReq.GetArg<SfxUInt32Item>(SID_FM_CONTROL_INVENTOR);
const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER);
if( pInventorItem )
nInventor = static_cast<SdrInventor>(pInventorItem->GetValue());
if( pIdentifierItem )
- nIdentifier = pIdentifierItem->GetValue();
+ nIdentifier = static_cast<SdrObjKind>(pIdentifierItem->GetValue());
}
FuConstUnoControl::~FuConstUnoControl()
diff --git a/sc/source/ui/inc/fuconuno.hxx b/sc/source/ui/inc/fuconuno.hxx
index 80bce194635d..4353243eef6c 100644
--- a/sc/source/ui/inc/fuconuno.hxx
+++ b/sc/source/ui/inc/fuconuno.hxx
@@ -28,7 +28,7 @@ enum class SdrInventor : sal_uInt32;
class FuConstUnoControl final : public FuConstruct
{
SdrInventor nInventor;
- sal_uInt16 nIdentifier;
+ SdrObjKind nIdentifier;
public:
FuConstUnoControl(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pView,
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 02b27c5cd2e3..480f4ca9c73b 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -94,7 +94,7 @@ class SC_DLLPUBLIC ScTabViewShell: public SfxViewShell, public ScDBFunc
private:
ObjectSelectionType eCurOST;
sal_uInt16 nDrawSfxId;
- sal_uInt16 nFormSfxId;
+ SdrObjKind eFormObjKind;
OUString sDrawCustom; // current custom shape type
std::unique_ptr<ScDrawShell> pDrawShell;
std::unique_ptr<ScDrawTextObjectBar> pDrawTextShell;
diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 9e0a81600e8f..5a7bcc2088b6 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -94,12 +94,12 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
if ( nNewId == SID_DRAW_SELECT )
nNewId = SID_OBJECT_SELECT;
- sal_uInt16 nNewFormId = 0;
+ SdrObjKind eNewFormObjKind = OBJ_NONE;
if (nNewId == SID_FM_CREATE_CONTROL)
{
const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER);
if (pIdentifierItem)
- nNewFormId = pIdentifierItem->GetValue();
+ eNewFormObjKind = static_cast<SdrObjKind>(pIdentifierItem->GetValue());
}
OUString sStringItemValue;
@@ -128,12 +128,12 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
bEx = true;
}
else if ( nNewId == nDrawSfxId && ( nNewId != SID_FM_CREATE_CONTROL ||
- nNewFormId == nFormSfxId || nNewFormId == 0 ) && !bSwitchCustom )
+ eNewFormObjKind == eFormObjKind || eNewFormObjKind == OBJ_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.
- // SID_FM_CREATE_CONTROL with nNewFormId==0 (without parameter) comes
+ // SID_FM_CREATE_CONTROL with eNewFormObjKind==OBJ_NONE (without parameter) comes
// from FuConstruct::SimpleMouseButtonUp when deactivating
// Execute for the form shell, to deselect the controller
if ( nNewId == SID_FM_CREATE_CONTROL )
@@ -265,7 +265,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
case SID_FM_CREATE_CONTROL:
SetDrawFormShell(true);
pTabView->SetDrawFuncPtr(new FuConstUnoControl(*this, pWin, pView, pDoc, aNewReq));
- nFormSfxId = nNewFormId;
+ eFormObjKind = eNewFormObjKind;
break;
case SID_DRAWTBX_CS_BASIC :
diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx
index 007d437b7833..fa939bb6317c 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -20,7 +20,7 @@
#include <config_features.h>
#include <tools/urlobj.hxx>
-#include <svx/fmglob.hxx>
+#include <svx/svdobjkind.hxx>
#include <svx/svdouno.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>