/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// Options for InsertObject() enumclass SdrInsertFlags
{
NONE = 0x0000,
DONTMARK = 0x0001, /* object will not be marked (the actual marking remains) */
ADDMARK = 0x0002, /* object will be added an existing selection */
SETDEFATTR = 0x0004, /* actual attributes (+StyleSheet) are assigned to the object */
SETDEFLAYER = 0x0008, /* actual layer is assigned to the object */
}; namespace o3tl
{ template<> struct typed_flags<SdrInsertFlags> : is_typed_flags<SdrInsertFlags, 0x0f> {};
}
class SVXCORE_DLLPUBLIC SdrEditView : public SdrMarkView
{ friendclass SdrPageView; friendclass SdrDragDistort; friendclass SdrDragCrook;
// convert the objects marked in poly resp. bezier
SAL_DLLPRIVATE void ImpConvertTo(bool bPath, bool bLineToArea);
// converts an object, when positive it removes the old one from its List // and inserts the new one instead. including Undo. // Nor MarkEntry nor ModelChgBroadcast is created.
SAL_DLLPRIVATE rtl::Reference<SdrObject> ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLineToArea);
// set both flags: bToTopPossible and bToBtmPossible. // bToTopPossibleDirty and bToBtmPossibleDirty are reset at the same time
SAL_DLLPRIVATE void ImpCheckToTopBtmPossible();
// for CombineMarkedObjects and DismantleMarkedObjects
SAL_DLLPRIVATE void ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) const;
// Removes all objects of the MarkList from their ObjLists including Undo. // The entries in rMark remain. // @return a list of objects that must be deleted after the outermost EndUndo
SAL_DLLPRIVATE std::vector<rtl::Reference<SdrObject>> DeleteMarkedList(SdrMarkList const& rMark); // DeleteMarked -> DeleteMarkedList
// Check possibilities of all marked objects virtualvoid CheckPossibilities(); void ForcePossibilities() const { if (m_bPossibilitiesDirty || mbSomeObjChgdFlag) const_cast<SdrEditView*>(this)->CheckPossibilities(); }
protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
SAL_DLLPRIVATE SdrEditView(
SdrModel& rSdrModel,
OutputDevice* pOut);
SAL_DLLPRIVATE virtual ~SdrEditView() override;
public: // each call of an undo-capable method from its view, generates an undo action. // If one wishes to group method calls into one, these calls should be put // between BegUndo() and EndUndo() calls (unlimited). // The comment used for the UndoAction is the first BegUndo(String). // In this case NotifyNewUndoAction is called at the last EndUndo(). // NotifyNewUndoAction() is not called for an empty group void BegUndo()
{ // open undo-grouping
GetModel().BegUndo();
} void BegUndo(const OUString& rComment)
{ // open undo-grouping
GetModel().BegUndo(rComment);
} void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc=SdrRepeatFunc::NONE)
{ // open undo-grouping
GetModel().BegUndo(rComment,rObjDescr,eFunc);
}
void EndUndo(); // close undo-grouping (incl. BroadcastEdges)
// only after first BegUndo or before last EndUndo: void SetUndoComment(const OUString& rComment, const OUString& rObjDescr)
{
GetModel().SetUndoComment(rComment,rObjDescr);
}
bool IsUndoEnabled() const;
/** * Checks if this or other views have an active text edit, if true, end them.
*/ void EndTextEditAllViews() const; void EndTextEditCurrentView(bool bDontDeleteReally = false);
// Layermanagement with Undo. void InsertNewLayer(const OUString& rName, sal_uInt16 nPos); // Delete a layer including all objects contained void DeleteLayer(const OUString& rName);
// Marked objects which are outside a page // are assigned to another page; at the moment without undo!!! void ForceMarkedObjToAnotherPage(); void ForceMarkedToAnotherPage() { ForceMarkedObjToAnotherPage(); }
// delete all marked objects void DeleteMarkedObj();
// Set a logical enclosing rectangle for all marked objects. // It is not guaranteed if this succeeds, as a horizontal // line has always a height of 0 void SetMarkedObjRect(const tools::Rectangle& rRect); void MoveMarkedObj(const Size& rSiz, bool bCopy=false); void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false); bool IsMarkedObjSizeValid(const Size& aTargetSize);
SAL_DLLPRIVATE void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, constbool bWdh, constbool bHgt);
SAL_DLLPRIVATE Degree100 GetMarkedObjRotate() const; void RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCopy=false);
SAL_DLLPRIVATE void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, boolbCopy=false); void MirrorMarkedObjHorizontal(); void MirrorMarkedObjVertical();
SAL_DLLPRIVATE Degree100 GetMarkedObjShear() const;
SAL_DLLPRIVATE void ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShear=false, bool bCopy=false);
SAL_DLLPRIVATE void CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bCopy=false);
SAL_DLLPRIVATE void DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy=false);
// Consolidate the text from multiple, selected TextObjects, // attempting to identify paragraph fragments and join them together void CombineMarkedTextObjects();
// Unite several objects to a polygon: // - rectangles/circles/text... are implicitly converted. // - polygones are closed automatically // - attributes and layer are taken from the first object marked // (thus from lowest Z-order). // - group objects are included when all (!) member objects of // the group can be changed. If a group includes for example // a bitmap or an OLE-object, the complete group is not considered. // bNoPolyPoly=TRUE: all is grouped to one single polygon void CombineMarkedObjects(bool bNoPolyPoly = true);
// for combining multiple polygons, with direct support of the modes // SID_POLY_MERGE, SID_POLY_SUBSTRACT, SID_POLY_INTERSECT void MergeMarkedObjects(SdrMergeMode eMode);
// for distribution dialog function void DistributeMarkedObjects(sal_uInt16 SlotID);
// for setting either the width or height of all selected // objects to the width/height of the last selected object // of the selection void EqualizeMarkedObjects(bool bWidth);
// Decompose marked polypolygon objects into polygons. // Grouped objects are searched and decomposed, if all member objects are PathObjs. // bMakeLines=TRUE: all polygones are decomposed into single lines resp. bezier segments void DismantleMarkedObjects(bool bMakeLines=false); bool IsCombinePossible(bool bNoPolyPoly=false) const; bool IsDismantlePossible(bool bMakeLines=false) const;
// Inserts a new, completely constructed object. Subsequently the object belongs to // the model. After insertion the object is marked (if not prevented by nOptions). // Sometimes the object is not inserted, but deleted, this is the case when // the target layer is locked or not visible. In this case // the method returns FALSE. // Amongst others the method does not create an undo-action. bool InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE);
// Replace one drawing object by another. // *pNewObj belongs to me, *pOldObj is changed into Undo. // In any case an undo grouping is required and should be applied, e.g.: // aStr+=" replace"; // BegUndo(aStr); // ReplaceObject(...);
// geometrical attribute (position, size, rotation angle) // A PageOrigin set at a position is taken into account.
SfxItemSet GetGeoAttrFromMarked() const; // In LOK, interactive shape movement uses this function // in that case, margin is not taken into account // and the final position of the shape becomes incorrect // However, "Position and Size" dialog and other cases already add the margins. void SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin = false);
// Returns NULL if: // - nothing is marked, // - no stylesheet is set at the marked object // - point the marked objects to different StyleSheets for multiple selections
SfxStyleSheet* GetStyleSheetFromMarked() const;
// at the moment without undo :(
SAL_DLLPRIVATE void SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
// Group all marked objects to a single group. // Subsequently mark the new group . If the group spawns multiple // pages a group is created per page. // All groups created are subsequently marked. // The method creates SdrObjGroup-instances. void GroupMarked();
// All marked object groups are dissolved (1 level). // Now all previously marked member objects are marked. // Previously marked objects, which are not group objects, remain marked. void UnGroupMarked();
// Convert marked objects to polygones/Beziercurves. The bool-functions // return sal_True, if at least one marked object could be converted. // Also member objects of group objects are converted. // For a better description see: SdrObj.HXX bool IsConvertToPathObjPossible() const { ForcePossibilities(); return m_bCanConvToPath; } bool IsConvertToPolyObjPossible() const { ForcePossibilities(); return m_bCanConvToPoly; } bool IsConvertToContourPossible() const { ForcePossibilities(); return m_bCanConvToContour; } void ConvertMarkedToPathObj(bool bLineToArea);
SAL_DLLPRIVATE void ConvertMarkedToPolyObj();
// Align all marked objects vertically. Normally the SnapRect of an object is used. void AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert); bool IsAlignPossible() const;
// move marked immediately before the object passed // NULL -> as PutMarkedToTop(); void PutMarkedInFrontOfObj(const SdrObject* pRefObj);
// move marked immediately after object passed // NULL -> as PutMarkedToBtm(); void PutMarkedBehindObj(const SdrObject* pRefObj);
// swap Z-Order of marked objects void ReverseOrderOfMarked();
// Check if forward, backward is possible. // GetMaxToBtmObj() is only partly taken into account by these methods. // Which means it can happen that IsToTopPossible() returns sal_True, // but MovMarkedToTop() changes nothing (e.g. for multiple selections), // as restriction derived via a view by GetMaxToTopObj() prevents this. bool IsToTopPossible() const { ForcePossibilities(); return m_bToTopPossible; } bool IsToBtmPossible() const { ForcePossibilities(); return m_bToBtmPossible; } bool IsReverseOrderPossible() const { ForcePossibilities(); return m_bReverseOrderPossible; }
// Using this method the view determines how far an object // can be moved forward or backward (Z-order). // The object returned is not "obsolete". When NULL is // returned there is not such a restriction. virtual SdrObject* GetMaxToTopObj(SdrObject* pObj) const; virtual SdrObject* GetMaxToBtmObj(SdrObject* pObj) const;
// Next method is called, if via ToTop, ToBtm, ... the // sequence of object has been changed. It is called after // each SdrObjList::SetObjectOrdNum(nOldPos,nNewPos); virtualvoid ObjOrderChanged(SdrObject* pObj, size_t nOldPos, size_t nNewPos);
// If one or more objects of the type SdrGrafObj or SdrOle2Obj // are marked and these are capable to deliver a StarView-metafile, // this methods converts the metafile to a drawing object. // The SdrGrafObjs/SdrOle2Objs are replaced by the new objects. void DoImportMarkedMtf(SvdProgressInfo *pProgrInfo=nullptr); bool IsImportMtfPossible() const { ForcePossibilities(); return m_bImportMtfPossible; }
// override SdrMarkView, for internal use
SAL_DLLPRIVATE virtualvoid MarkListHasChanged() override;
SAL_DLLPRIVATE virtualvoid ModelHasChanged() override;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.