29#include <svx/strings.hrc>
32#include <rtl/strbuf.hxx>
38#include <osl/diagnose.h>
40#include <com/sun/star/lang/XServiceInfo.hpp>
87 , m_bPossibilitiesDirty(true)
89 , m_bGroupPossible(false)
90 , m_bUnGroupPossible(false)
91 , m_bGrpEnterPossible(false)
92 , m_bToTopPossible(false)
93 , m_bToBtmPossible(false)
94 , m_bReverseOrderPossible(false)
95 , m_bImportMtfPossible(false)
96 , m_bCombinePossible(false)
97 , m_bDismantlePossible(false)
98 , m_bCombineNoPolyPolyPossible(false)
99 , m_bDismantleMakeLinesPossible(false)
100 , m_bOrthoDesiredOnMarked(false)
101 , m_bOneOrMoreMovable(false)
102 , m_bMoreThanOneNoMovRot(false)
103 , m_bContortionPossible(false)
104 , m_bMoveAllowed(false)
105 , m_bResizeFreeAllowed(false)
106 , m_bResizePropAllowed(false)
107 , m_bRotateFreeAllowed(false)
108 , m_bRotate90Allowed(false)
109 , m_bMirrorFreeAllowed(false)
110 , m_bMirror45Allowed(false)
111 , m_bMirror90Allowed(false)
112 , m_bShearAllowed(false)
113 , m_bEdgeRadiusAllowed(false)
114 , m_bTransparenceAllowed(false)
115 , m_bCropAllowed(false)
116 , m_bGradientAllowed(false)
117 , m_bCanConvToPath(false)
118 , m_bCanConvToPoly(false)
119 , m_bCanConvToContour(false)
120 , m_bMoveProtect(false)
121 , m_bResizeProtect(false)
146 for(
size_t nObjNum = pOL->
GetObjCount(); nObjNum > 0 && bDelAll;)
180 for(
size_t nObjNum = nObjCount; nObjNum > 0;)
193 AddUndo(
GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,
true));
206 AddUndo(
GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,
true));
230 for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++)
233 sal_uInt16 nPgCount(bMaPg ?
GetModel().GetMasterPageCount() :
GetModel().GetPageCount());
235 for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++)
245 for(
size_t nObjNum(nObjCount); nObjNum > 0;)
257 AddUndo(
GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,
true));
270 AddUndo(
GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,
true));
300 if(1 ==
GetModel().GetUndoBracketLevel())
313 std::vector<SdrObject*>::const_iterator iterPos;
320 for(
size_t a(0);
a < rAllMarkedObjects.size();
a++)
331 iterPos = std::find(rAllMarkedObjects.begin(),rAllMarkedObjects.end(),pObj1);
333 if (iterPos == rAllMarkedObjects.end())
343 iterPos = std::find(rAllMarkedObjects.begin(),rAllMarkedObjects.end(),pObj2);
345 if (iterPos == rAllMarkedObjects.end())
357 for (
size_t i=0;
i<nMarkedEdgeCnt; ++
i) {
361 if (pEdge!=
nullptr) {
497 size_t nMovableCount=0;
508 if (bGroup || bHasText) {
541 if(SfxItemState::DONTCARE != eState)
546 if(eFillStyle != drawing::FillStyle_GRADIENT)
553 bool bNoMovRotFound=
false;
556 for (
size_t nm=0; nm<nMarkCount; ++nm) {
628 if (pSdrGrafObj !=
nullptr)
665 if (pEdge!=
nullptr) {
677 if(
nullptr != pCandidate && pCandidate->
isDiagram())
717 std::vector<rtl::Reference<SdrObject>> ret;
729 std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
733 for(
size_t nm = nMarkCount; nm > 0;)
749 for(
size_t nm = nMarkCount; nm > 0;)
774 while(!aUpdaters.empty())
776 delete aUpdaters.back();
777 aUpdaters.pop_back();
790 while (!rLazyDelete.empty())
791 rLazyDelete.pop_back();
806 std::vector<rtl::Reference<SdrObject>> lazyDeleteObjects;
812 std::vector< SdrObject* > aParents;
827 if(!aParents.empty())
829 std::vector< SdrObject* >::iterator aFindResult =
830 std::find(aParents.begin(), aParents.end(), pParent);
832 if(aFindResult == aParents.end())
834 aParents.push_back(pParent);
839 aParents.push_back(pParent);
844 if(!aParents.empty())
854 std::vector< SdrObject* >::iterator aFindResult =
855 std::find(aParents.begin(), aParents.end(),
pObject);
857 if(aFindResult != aParents.end())
859 aParents.erase(aFindResult);
868 lazyDeleteObjects.insert(lazyDeleteObjects.end(), temp.begin(), temp.end());
910 for (
size_t nEdgeNum=0; nEdgeNum<nEdgeCnt; ++nEdgeNum) {
924 size_t nCloneErrCnt=0;
925 std::unordered_set<rtl::OUString> aNameSet;
926 const size_t nMarkCount=aSourceObjectsForCopy.
GetMarkCount();
927 for (
size_t nm=0; nm<nMarkCount; ++nm) {
958 OStringBuffer
aStr(
"SdrEditView::CopyMarkedObj(): Error when cloning ");
960 if(nCloneErrCnt == 1)
962 aStr.append(
"a drawing object.");
966 aStr.append(OString::number(
static_cast<sal_Int32
>(nCloneErrCnt))
967 +
" drawing objects.");
970 aStr.append(
" This object's/These objects's connections will not be copied.");
971 OSL_FAIL(
aStr.getStr());
997 bool bDontDeleteReally =
true;
1002 css::uno::Reference<lang::XServiceInfo> xServices(
GetModel().getUnoModel(),
1003 css::uno::UNO_QUERY);
1004 if (xServices.is() && (xServices->supportsService(
"com.sun.star.sheet.SpreadsheetDocument") ||
1005 xServices->supportsService(
"com.sun.star.text.TextDocument")))
1026 if (pTextObj->IsTextEditActive())
1027 OSL_ENSURE(
false,
"OldObject is in TextEdit mode, this has to be ended before replacing it using SdrEndTextEdit (!)");
1030 if (pTextObj->IsTextEditActive())
1031 OSL_ENSURE(
false,
"NewObject is in TextEdit mode, this has to be ended before replacing it using SdrEndTextEdit (!)");
1045 AddUndo(
GetModel().GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj));
1048 MarkObj( pOldObj, &rPV,
true );
1052 if (bMark)
MarkObj(pNewObj,&rPV);
void AddPair(const SdrObject *pOriginal, SdrObject *pClone)
void CopyConnections() const
Helper for 3d object changes affecting 2d geometry.
Utility class SdrEdgeObj.
void DisconnectFromNode(bool bTail1) override
SdrObject * GetConnectedNode(bool bTail1) const override
bool CheckNodeConnection(bool bTail1) const
virtual void CheckPossibilities()
bool IsEdgeRadiusAllowed() const
bool m_bContortionPossible
static bool ImpCanDismantle(const basegfx::B2DPolyPolygon &rPpolyPpolygon, bool bMakeLines)
bool IsResizeAllowed(bool bProp=false) const
void ReplaceObjectAtView(SdrObject *pOldObj, SdrPageView &rPV, SdrObject *pNewObj, bool bMark=true)
bool IsUndoEnabled() const
void ImpDelLayerDelObjs(SdrObjList *pOL, SdrLayerID nDelID)
virtual void MarkListHasChanged() override
bool m_bDismantleMakeLinesPossible
void ForceMarkedObjToAnotherPage()
bool m_bMoreThanOneNoMovRot
virtual ~SdrEditView() override
std::vector< rtl::Reference< SdrObject > > DeleteMarkedList(SdrMarkList const &rMark)
bool IsTransparenceAllowed() const
bool IsDismantlePossible(bool bMakeLines=false) const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
bool m_bCombineNoPolyPolyPossible
bool IsDistortAllowed(bool bNoContortion=false) const
void EndTextEditCurrentView(bool bDontDeleteReally=false)
bool IsCrookAllowed(bool bNoContortion=false) const
bool IsGradientAllowed() const
std::vector< std::unique_ptr< SdrUndoAction > > CreateConnectorUndo(const SdrObject &rO)
bool m_bImportMtfPossible
SVX_DLLPRIVATE void ImpResetPossibilityFlags()
bool IsCombinePossible(bool bNoPolyPoly=false) const
void ForcePossibilities() const
bool m_bMirrorFreeAllowed
SdrEditView(SdrModel &rSdrModel, OutputDevice *pOut)
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
virtual void ModelHasChanged() override
void AddUndoActions(std::vector< std::unique_ptr< SdrUndoAction > >)
bool IsCropAllowed() const
void InsertNewLayer(const OUString &rName, sal_uInt16 nPos)
bool IsShearAllowed() const
bool m_bOrthoDesiredOnMarked
void ImpCheckToTopBtmPossible()
bool IsRotateAllowed(bool b90Deg=false) const
bool m_bResizeFreeAllowed
bool m_bRotateFreeAllowed
void DeleteLayer(const OUString &rName)
bool m_bResizePropAllowed
static bool ImpCanConvertForCombine(const SdrObject *pObj)
bool m_bReverseOrderPossible
bool m_bEdgeRadiusAllowed
void EndTextEditAllViews() const
Checks if this or other views have an active text edit, if true, end them.
bool m_bPossibilitiesDirty
void ImpBroadcastEdgesOfMarkedNodes()
bool IsMirrorAllowed(bool b45Deg=false, bool b90Deg=false) const
bool m_bDismantlePossible
bool m_bTransparenceAllowed
bool ImpDelLayerCheck(SdrObjList const *pOL, SdrLayerID nDelID) const
This class represents an embedded or linked bitmap graphic object.
bool HasGDIMetaFile() const
bool isEmbeddedVectorGraphicData() const
std::unique_ptr< SdrLayer > RemoveLayer(sal_uInt16 nPos)
SdrLayer * NewLayer(const OUString &rName, sal_uInt16 nPos=0xFFFF)
sal_uInt16 GetLayerCount() const
SdrLayerID GetLayerID(const OUString &rName) const
SdrLayer * GetLayer(sal_uInt16 i)
sal_uInt16 GetLayerPos(const SdrLayer *pLayer) const
bool IsSet(SdrLayerID a) const
size_t GetMarkCount() const
void InsertEntry(const SdrMark &rMark, bool bChkSort=true)
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedEdgesOfMarkedNodes() const
const SdrMarkList & GetEdgesOfMarkedNodes() const
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
void SortMarkedObjects() const
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
SdrMarkList & GetMarkedObjectListWriteAccess()
size_t GetMarkedObjectCount() const
SdrMark * GetSdrMarkByIndex(size_t nNum) const
virtual void ModelHasChanged() override
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
OUString const & GetDescriptionOfMarkedObjects() const
virtual void BrkAction() override
virtual void MarkListHasChanged()
const std::vector< SdrObject * > & GetTransitiveHullOfMarkedObjects() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
Everything a View needs to know about a selected object.
void SetUser(sal_uInt16 nVal)
SdrPageView * GetPageView() const
void SetMarkedSdrObj(SdrObject *pNewObj)
sal_uInt16 GetUser() const
SdrObject * GetMarkedSdrObj() const
void SetPageView(SdrPageView *pNewPageView)
virtual void SetChanged(bool bFlg=true)
const SdrPage * GetMasterPage(sal_uInt16 nPgNum) const
void EnableUndo(bool bEnable)
enables (true) or disables (false) recording of undo actions If undo actions are added while undo is ...
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrLayerAdmin & GetLayerAdmin() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
virtual bool IsTextEdit() const final override
void InsertObjectThenMakeNameUnique(SdrObject *pObj)
virtual rtl::Reference< SdrObject > ReplaceObject(SdrObject *pNewObj, size_t nObjNum)
Replace existing object by different one.
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
sal_uInt32 GetOrdNumDirect() const
bool IsResizeProtect() const
virtual void NbcSetLayer(SdrLayerID nLayer)
bool IsMoveProtect() const
virtual OutlinerParaObject * GetOutlinerParaObject() const
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
virtual SdrObjList * GetSubList() const
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
void NbcSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
virtual const tools::Rectangle & GetCurrentBoundRect() const
SdrObjList * getParentSdrObjListFromSdrObject() const
SdrModel & getSdrModelFromSdrObject() const
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const =0
const SfxItemSet & GetMergedItemSet() const
virtual SdrLayerID GetLayer() const
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
const SdrLayerIDSet & GetVisibleLayers() const
tools::Rectangle GetPageRect() const
bool IsReadOnly() const
PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly.
SdrObjList * GetObjList() const
Return current List.
const SdrLayerIDSet & GetLockedLayers() const
SdrPage * GetPage() const
void LeaveOneGroup()
Leave an object group we entered previously.
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
const SdrLayerAdmin & GetLayerAdmin() const
changing the layers does not set the modified-flag!
virtual bool IsTextEdit() const
SfxStyleSheet * mpDefaultStyleSheet
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
void ForAllListeners(std::function< bool(SfxListener *)> f) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
OUString SvxResId(TranslateId aId)
EmbeddedObjectRef * pObject
static void lcl_LazyDelete(std::vector< rtl::Reference< SdrObject > > &rLazyDelete)
E3dObject * DynCastE3dObject(SdrObject *pObj)
SdrTextObj * DynCastSdrTextObj(SdrObject *pObj)
E3dScene * DynCastE3dScene(SdrObject *pObj)
o3tl::strong_int< sal_Int16, struct SdrLayerIDTag > SdrLayerID
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)