App::Document Class Reference

The document class. More...

#include <Document.h>

Public Types

enum  Status {
  SkipRecompute = 0 , KeepTrailingDigits = 1 , Closable = 2 , Restoring = 3 ,
  Recomputing = 4 , PartialRestore = 5 , Importing = 6 , PartialDoc = 7 ,
  AllowPartialRecompute = 8 , TempDoc = 9 , RestoreError = 10
}
 

Public Member Functions

Object handling <br>
DocumentObjectaddObject (const char *sType, const char *pObjectName=0, bool isNew=true, const char *viewType=0, bool isPartial=false)
 Add a feature of sType with sName (ASCII) to this document and set it active. More...
 
std::vector< DocumentObject * > addObjects (const char *sType, const std::vector< std::string > &objectNames, bool isNew=true)
 Add an array of features of the given types and names. More...
 
void removeObject (const char *sName)
 Remove a feature out of the document. More...
 
void addObject (DocumentObject *, const char *pObjectName=0)
 Add an existing feature with sName (ASCII) to this document and set it active. More...
 
std::vector< DocumentObject * > copyObject (const std::vector< DocumentObject * > &objs, bool recursive=false, bool returnAll=false)
 Copy objects from another document to this document. More...
 
DocumentObjectmoveObject (DocumentObject *obj, bool recursive=false)
 Move an object from another document to this document If recursive is true then all objects this object depends on are moved as well. More...
 
DocumentObjectgetActiveObject (void) const
 Returns the active Object of this document. More...
 
DocumentObjectgetObject (const char *Name) const
 Returns a Object of this document. More...
 
DocumentObjectgetObjectByID (long id) const
 Returns a Object of this document by its id. More...
 
bool isIn (const DocumentObject *pFeat) const
 Returns true if the DocumentObject is contained in this document. More...
 
const char * getObjectName (DocumentObject *pFeat) const
 Returns a Name of an Object or 0. More...
 
std::string getUniqueObjectName (const char *Name) const
 Returns a Name of an Object or 0. More...
 
std::string getStandardObjectName (const char *Name, int d) const
 Returns a name of the form prefix_number. d specifies the number of digits. More...
 
std::vector< DocumentObject * > getDependingObjects () const
 Returns a list of document's objects including the dependencies. More...
 
const std::vector< DocumentObject * > & getObjects () const
 Returns a list of all Objects. More...
 
std::vector< DocumentObject * > getObjectsOfType (const Base::Type &typeId) const
 
std::vector< DocumentObject * > getObjectsWithExtension (const Base::Type &typeId, bool derived=true) const
 Returns all object with given extensions. If derived=true also all objects with extensions derived from the given one. More...
 
std::vector< DocumentObject * > findObjects (const Base::Type &typeId, const char *objname, const char *label) const
 
template<typename T >
std::vector< T * > getObjectsOfType () const
 Returns an array with the correct types already. More...
 
int countObjectsOfType (const Base::Type &typeId) const
 
int countObjects (void) const
 get the number of objects in the document More...
 
methods for modification and state handling
void purgeTouched ()
 Remove all modifications. After this call The document becomes Valid again. More...
 
bool isTouched (void) const
 check if there is any touched object in this document More...
 
bool mustExecute (void) const
 check if there is any object must execute in this document More...
 
std::vector< App::DocumentObject * > getTouched (void) const
 returns all touched objects More...
 
void setClosable (bool)
 set the document to be closable, this is on by default. More...
 
bool isClosable () const
 check whether the document can be closed More...
 
int recompute (const std::vector< App::DocumentObject * > &objs={}, bool force=false, bool *hasError=0, int options=0)
 Recompute touched features and return the number of recalculated features. More...
 
bool recomputeFeature (DocumentObject *Feat, bool recursive=false)
 Recompute only one feature. More...
 
const char * getErrorDescription (const App::DocumentObject *) const
 get the text of the error of a specified object More...
 
bool testStatus (Status pos) const
 return the status bits More...
 
void setStatus (Status pos, bool on)
 set the status bits More...
 
methods for the UNDO REDO and Transaction handling

Introduce a new concept of transaction ID.

Each transaction must be unique inside the document. Multiple transactions from different documents can be grouped together with the same transaction ID.

When undo, Gui component can query getAvailableUndo(id) to see if it is possible to undo with a given ID. If there more than one undo transactions, meaning that there are other transactions before the given ID. The Gui component shall ask user if he wants to undo multiple steps. And if the user agrees, call undo(id) to unroll all transaction before and including the the one with the give ID. Same applies for redo.

The new transaction ID describe here is fully backward compatible. Calling the APIs with a default id=0 gives the original behavior.

void setUndoMode (int iMode)
 switch the level of Undo/Redo More...
 
int getUndoMode (void) const
 switch the level of Undo/Redo More...
 
void setTransactionMode (int iMode)
 switch the transaction mode More...
 
void openTransaction (const char *name=0)
 Open a new command Undo/Redo, an UTF-8 name can be specified. More...
 
void renameTransaction (const char *name, int id)
 Rename the current transaction if the id matches. More...
 
void commitTransaction ()
 Commit the Command transaction. Do nothing If there is no Command transaction open. More...
 
void abortTransaction ()
 Abort the actually running transaction. More...
 
bool hasPendingTransaction () const
 Check if a transaction is open. More...
 
int getTransactionID (bool undo, unsigned pos=0) const
 Return the undo/redo transaction ID starting from the back. More...
 
bool isTransactionEmpty () const
 Check if a transaction is open and its list is empty. More...
 
void setUndoLimit (unsigned int UndoMemSize=0)
 Set the Undo limit in Byte! More...
 
unsigned int getUndoMemSize (void) const
 Returns the actual memory consumption of the Undo redo stuff. More...
 
void setMaxUndoStackSize (unsigned int UndoMaxStackSize=20)
 Set the Undo limit as stack size. More...
 
unsigned int getMaxUndoStackSize (void) const
 Set the Undo limit as stack size. More...
 
void clearUndos ()
 Remove all stored Undos and Redos. More...
 
int getAvailableUndos (int id=0) const
 Returns the number of stored Undos. If greater than 0 Undo will be effective. More...
 
std::vector< std::string > getAvailableUndoNames () const
 Returns a list of the Undo names. More...
 
bool undo (int id=0)
 Will UNDO one step, returns False if no undo was done (Undos == 0). More...
 
int getAvailableRedos (int id=0) const
 Returns the number of stored Redos. If greater than 0 Redo will be effective. More...
 
std::vector< std::string > getAvailableRedoNames () const
 Returns a list of the Redo names. More...
 
bool redo (int id=0)
 Will REDO one step, returns False if no redo was done (Redos == 0). More...
 
bool isPerformingTransaction () const
 returns true if the document is in an Transaction phase, e.g. currently performing a redo/undo or rollback More...
 
void addOrRemovePropertyOfObject (TransactionalObject *, Property *prop, bool add)
 
- Public Member Functions inherited from App::PropertyContainer
virtual App::PropertyaddDynamicProperty (const char *type, const char *name=0, const char *group=0, const char *doc=0, short attr=0, bool ro=false, bool hidden=false)
 
virtual App::PropertygetDynamicPropertyByName (const char *name) const
 
DynamicProperty::PropData getDynamicPropertyData (const Property *prop) const
 
virtual std::vector< std::string > getDynamicPropertyNames () const
 
virtual PropertygetPropertyByName (const char *name) const
 find a property by its name More...
 
virtual const char * getPropertyDocumentation (const char *name) const
 get the Group of a named Property More...
 
virtual const char * getPropertyDocumentation (const Property *prop) const
 get the Group of a Property More...
 
virtual const char * getPropertyGroup (const char *name) const
 get the Group of a named Property More...
 
virtual const char * getPropertyGroup (const Property *prop) const
 get the Group of a Property More...
 
virtual void getPropertyList (std::vector< Property * > &List) const
 get all properties of the class (including properties of the parent) More...
 
virtual void getPropertyMap (std::map< std::string, Property * > &Map) const
 get all properties of the class (including properties of the parent) More...
 
virtual const char * getPropertyName (const Property *prop) const
 get the name of a property More...
 
const char * getPropertyPrefix () const
 
virtual short getPropertyType (const char *name) const
 get the Type of a named Property More...
 
virtual short getPropertyType (const Property *prop) const
 get the Type of a Property More...
 
bool isHidden (const char *name) const
 check if the named property is hidden More...
 
bool isHidden (const Property *prop) const
 check if the property is hidden More...
 
bool isReadOnly (const char *name) const
 check if the named property is read-only More...
 
bool isReadOnly (const Property *prop) const
 check if the property is read-only More...
 
virtual void onPropertyStatusChanged (const Property &prop, unsigned long oldStatus)
 
 PropertyContainer ()
 A constructor. More...
 
virtual bool removeDynamicProperty (const char *name)
 
void setPropertyPrefix (const char *prefix)
 
void setPropertyStatus (unsigned char bit, bool value)
 set the Status bit of all properties at once More...
 
virtual ~PropertyContainer ()
 A destructor. More...
 
- Public Member Functions inherited from Base::Persistence
void dumpToStream (std::ostream &stream, int compression)
 
virtual Base::Type getTypeId (void) const
 
virtual void RestoreDocFile (Reader &)
 This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More...
 
void restoreFromStream (std::istream &stream)
 
virtual void SaveDocFile (Writer &) const
 This method is used to save large amounts of data to a binary file. More...
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction. More...
 
bool isDerivedFrom (const Type type) const
 
virtual void setPyObject (PyObject *)
 
virtual ~BaseClass ()
 Destruction. More...
 

Public Attributes

Properties
PropertyString Label
 holds the long name of the document (utf-8 coded) More...
 
PropertyString FileName
 full qualified (with path) file name (utf-8 coded) More...
 
PropertyString CreatedBy
 creators name (utf-8) More...
 
PropertyString CreationDate
 
PropertyString LastModifiedBy
 user last modified the document More...
 
PropertyString LastModifiedDate
 
PropertyString Company
 company name UTF8(optional) More...
 
PropertyString Comment
 long comment or description (UTF8 with line breaks) More...
 
PropertyString Id
 Id e.g. Part number. More...
 
PropertyUUID Uid
 unique identifier of the document More...
 
App::PropertyString License
 License string Holds the short license string for the Item, e.g. More...
 
App::PropertyString LicenseURL
 License description/contract URL. More...
 
App::PropertyMap Meta
 Meta descriptions. More...
 
App::PropertyMap Material
 Material descriptions, used and defined in the Material module. More...
 
PropertyString TransientDir
 read-only name of the temp dir created when the document is opened More...
 
PropertyLink Tip
 Tip object of the document (if any) More...
 
PropertyString TipName
 Tip object of the document (if any) More...
 
PropertyBool ShowHidden
 Whether to show hidden items in TreeView. More...
 

File handling of the document

enum  ExportStatus { NotExporting , Exporting }
 
bool save (void)
 Save the Document under a new Name. More...
 
bool saveAs (const char *file)
 
bool saveCopy (const char *file) const
 
void restore (const char *filename=0, bool delaySignal=false, const std::set< std::string > &objNames={})
 Restore the document from the file in Property Path. More...
 
void afterRestore (bool checkPartial=false)
 
bool afterRestore (const std::vector< App::DocumentObject * > &, bool checkPartial=false)
 
ExportStatus isExporting (const App::DocumentObject *obj) const
 
void exportObjects (const std::vector< App::DocumentObject * > &, std::ostream &)
 
void exportGraphviz (std::ostream &) const
 
std::vector< App::DocumentObject * > importObjects (Base::XMLReader &reader)
 
std::vector< App::DocumentObject * > importLinks (const std::vector< App::DocumentObject * > &objs={})
 Import any externally linked objects. More...
 
bool isSaved () const
 Opens the document from its file name. More...
 
const char * getName () const
 Get the document name. More...
 
const char * getProgramVersion () const
 Get program version the project file was created with. More...
 
const char * getFileName () const
 Returned filename. More...
 
virtual void Save (Base::Writer &writer) const override
 This method is used to save properties to an XML document. More...
 
virtual void Restore (Base::XMLReader &reader) override
 This method is used to restore properties from an XML document. More...
 
unsigned int getMemSize (void) const override
 returns the complete document memory consumption, including all managed DocObjects and Undo Redo. More...
 

dependency stuff

enum  DependencyOption { DepSort = 1 , DepNoXLinked = 2 , DepNoCycle = 4 }
 Option bit flags used by getDepenencyList() More...
 
class Application
 
class TransactionalObject
 because of transaction handling More...
 
class DocumentObject
 The DocumentObject that will own the expression. More...
 
class Transaction
 
class TransactionDocumentObject
 
void writeDependencyGraphViz (std::ostream &out)
 write GraphViz file More...
 
bool checkOnCycle (void)
 checks if the graph is directed and has no cycles More...
 
std::vector< App::DocumentObject * > getInList (const DocumentObject *me) const
 get a list of all objects linking to the given object More...
 
std::vector< App::Document * > getDependentDocuments (bool sort=true)
 
std::vector< App::DocumentObject * > topologicalSort () const
 get a list of topological sorted objects (https://en.wikipedia.org/wiki/Topological_sorting) More...
 
std::vector< App::DocumentObject * > getRootObjects () const
 get all root objects (objects no other one reference too) More...
 
std::vector< std::list< App::DocumentObject * > > getPathsByOutList (const App::DocumentObject *from, const App::DocumentObject *to) const
 get all possible paths from one object to another following the OutList More...
 
void getLinksTo (std::set< DocumentObject * > &links, const DocumentObject *obj, int options, int maxCount=0, const std::vector< DocumentObject * > &objs={}) const
 Return the links to a given object. More...
 
bool hasLinksTo (const DocumentObject *obj) const
 Check if there is any link to the given object. More...
 
void addRecomputeObject (DocumentObject *obj)
 Called by objects during restore to ask for recompute. More...
 
const std::string & getOldLabel () const
 
void renameObjectIdentifiers (const std::map< App::ObjectIdentifier, App::ObjectIdentifier > &paths, const std::function< bool(const App::DocumentObject *)> &selector=[](const App::DocumentObject *) { return true;})
 Function called to signal that an object identifier has been renamed. More...
 
virtual PyObjectgetPyObject (void) override
 This method returns the Python wrapper for a C++ object. More...
 
virtual std::string getFullName () const override
 
virtual ~Document ()
 Destruction. More...
 
static std::vector< App::DocumentObject * > getDependencyList (const std::vector< App::DocumentObject * > &objs, int options=0)
 Get a complete list of all objects the given objects depend on. More...
 
static std::vector< App::Document * > getDependentDocuments (std::vector< App::Document * > docs, bool sort)
 
static bool isAnyRestoring ()
 Indicate if there is any document restoring/importing. More...
 
 Document (const char *name="")
 Construction. More...
 
void breakDependency (DocumentObject *pcObject, bool clear)
 
std::vector< App::DocumentObject * > readObjects (Base::XMLReader &reader)
 
void writeObjects (const std::vector< App::DocumentObject * > &, Base::Writer &writer) const
 
bool saveToFile (const char *filename) const
 
void onBeforeChange (const Property *prop) override
 get called before the value is changed More...
 
void onChanged (const Property *prop) override
 get called by the container when a property has changed More...
 
void onBeforeChangeProperty (const TransactionalObject *Who, const Property *What)
 callback from the Document objects before property will be changed More...
 
void onChangedProperty (const DocumentObject *Who, const Property *What)
 callback from the Document objects after property was changed More...
 
std::string getTransientDirectoryName (const std::string &uuid, const std::string &filename) const
 

Signals of the document

boost::signals2::signal< void(const App::Document &, const App::Property &)> signalBeforeChange
 signal before changing an doc property More...
 
boost::signals2::signal< void(const App::Document &, const App::Property &)> signalChanged
 signal on changed doc property More...
 
boost::signals2::signal< void(const App::DocumentObject &)> signalNewObject
 signal on new Object More...
 
boost::signals2::signal< void(const App::DocumentObject &)> signalDeletedObject
 signal on deleted Object More...
 
boost::signals2::signal< void(const App::DocumentObject &, const App::Property &)> signalBeforeChangeObject
 signal before changing an Object More...
 
boost::signals2::signal< void(const App::DocumentObject &, const App::Property &)> signalChangedObject
 signal on changed Object More...
 
boost::signals2::signal< void(const App::DocumentObject &)> signalTouchedObject
 signal on manually called DocumentObject::touch() More...
 
boost::signals2::signal< void(const App::DocumentObject &)> signalRelabelObject
 signal on relabeled Object More...
 
boost::signals2::signal< void(const App::DocumentObject &)> signalActivatedObject
 signal on activated Object More...
 
boost::signals2::signal< void(const App::DocumentObject &, Transaction *)> signalTransactionAppend
 signal on created object More...
 
boost::signals2::signal< void(const App::DocumentObject &, Transaction *)> signalTransactionRemove
 signal on removed object More...
 
boost::signals2::signal< void(const App::Document &)> signalUndo
 signal on undo More...
 
boost::signals2::signal< void(const App::Document &)> signalRedo
 signal on redo More...
 
boost::signals2::signal< void(Base::Writer &)> signalSaveDocument
 signal on load/save document this signal is given when the document gets streamed. More...
 
boost::signals2::signal< void(Base::XMLReader &)> signalRestoreDocument
 
boost::signals2::signal< void(const std::vector< App::DocumentObject * > &, Base::Writer &)> signalExportObjects
 
boost::signals2::signal< void(const std::vector< App::DocumentObject * > &, Base::Writer &)> signalExportViewObjects
 
boost::signals2::signal< void(const std::vector< App::DocumentObject * > &, Base::XMLReader &)> signalImportObjects
 
boost::signals2::signal< void(const std::vector< App::DocumentObject * > &, Base::Reader &, const std::map< std::string, std::string > &)> signalImportViewObjects
 
boost::signals2::signal< void(const std::vector< App::DocumentObject * > &)> signalFinishImportObjects
 
boost::signals2::signal< void(const App::Document &, const std::string &)> signalStartSave
 
boost::signals2::signal< void(const App::Document &, const std::string &)> signalFinishSave
 
boost::signals2::signal< void(const App::Document &)> signalBeforeRecompute
 
boost::signals2::signal< void(const App::Document &, const std::vector< App::DocumentObject * > &)> signalRecomputed
 
boost::signals2::signal< void(const App::DocumentObject &)> signalRecomputedObject
 
boost::signals2::signal< void(const App::Document &, std::string)> signalOpenTransaction
 
boost::signals2::signal< void(const App::Document &)> signalCommitTransaction
 
boost::signals2::signal< void(const App::Document &)> signalAbortTransaction
 
boost::signals2::signal< void(const App::Document &, const std::vector< App::DocumentObject * > &)> signalSkipRecompute
 
boost::signals2::signal< void(const App::DocumentObject &)> signalFinishRestoreObject
 
boost::signals2::signal< void(const App::Document &, const App::Property &)> signalChangePropertyEditor
 
boost::signals2::signal< void(std::string)> signalLinkXsetValue
 
void clearDocument ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Base::Persistence
static void * create (void)
 
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving. More...
 
static Base::Type getClassTypeId (void)
 
static void init (void)
 
- Static Public Member Functions inherited from Base::BaseClass
static void * create (void)
 
static Type getClassTypeId (void)
 
static void init (void)
 
- Protected Member Functions inherited from App::PropertyContainer
virtual const PropertyDatagetPropertyData (void) const
 
virtual void handleChangedPropertyName (Base::XMLReader &reader, const char *TypeName, const char *PropName)
 PropertyContainer::handleChangedPropertyName is called during restore to possibly fix reading of older versions of this property container. More...
 
virtual void handleChangedPropertyType (Base::XMLReader &reader, const char *TypeName, Property *prop)
 PropertyContainer::handleChangedPropertyType is called during restore to possibly fix reading of older versions of the property container. More...
 
- Static Protected Member Functions inherited from App::PropertyContainer
static const PropertyDatagetPropertyDataPtr (void)
 
- Static Protected Member Functions inherited from Base::BaseClass
static void initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr)
 
- Protected Attributes inherited from App::PropertyContainer
DynamicProperty dynamicProps
 

Detailed Description

The document class.

This is besides the Application class the most important class in FreeCAD It contains all the data of the opened, saved or newly created FreeCAD Document. The Document manage the Undo and Redo mechanism and the linking of documents.

Note: the documents are not free objects. They are completely handled by the App::Application. Only the Application can Open or destroy a document.

Exception handling

As the document is the main data structure of FreeCAD we have to take a close look at how Exceptions affect the integrity of the App::Document.

Undo Redo an Transactions

Undo Redo handling is one of the major mechanism of a document in terms of user friendliness and speed (no one will wait for Undo too long).

Graph and dependency handling

The FreeCAD document handles the dependencies of its DocumentObjects with an adjacence list. This gives the opportunity to calculate the shortest recompute path. Also, it enables more complicated dependencies beyond trees.

See also
App::Application
App::DocumentObject

Member Enumeration Documentation

◆ DependencyOption

Option bit flags used by getDepenencyList()

Enumerator
DepSort 

Return topological sorted list.

DepNoXLinked 

Do no include object linked by PropertyXLink, as it can handle external link.

DepNoCycle 

Raise exception on cycles.

◆ ExportStatus

Enumerator
NotExporting 
Exporting 

◆ Status

Enumerator
SkipRecompute 
KeepTrailingDigits 
Closable 
Restoring 
Recomputing 
PartialRestore 
Importing 
PartialDoc 
AllowPartialRecompute 
TempDoc 
RestoreError 

Constructor & Destructor Documentation

◆ ~Document()

◆ Document()

Member Function Documentation

◆ abortTransaction()

◆ addObject() [1/2]

DocumentObject * Document::addObject ( const char *  sType,
const char *  pObjectName = 0,
bool  isNew = true,
const char *  viewType = 0,
bool  isPartial = false 
)

Add a feature of sType with sName (ASCII) to this document and set it active.

Unicode names are set through the Label property.

Parameters
sTypethe type of created object
pObjectNameif nonNULL use that name otherwise generate a new unique name based on the sType
isNewif false don't call the DocumentObject::setupObject() callback (default is true)
viewTypeoverride object's view provider name
isPartialindicate if this object is meant to be partially loaded

References App::DocumentP::activeObject, App::DocumentP::activeUndoTransaction, App::Transaction::addObjectDel(), Base::Type::createInstanceByName(), Base::Persistence::getClassTypeId(), getUniqueObjectName(), App::DocumentObject::getViewProviderNameOverride(), App::DocumentObject::Label, App::DocumentP::lastObjectId, App::DocumentP::objectArray, App::DocumentP::objectIdMap, App::DocumentP::objectMap, App::DocumentObject::pcNameInDocument, Restoring, App::DocumentP::rollback, App::DocumentObject::setDocument(), App::DocumentObject::setStatus(), App::DocumentObject::setupObject(), App::PropertyString::setValue(), signalActivatedObject, signalNewObject, signalTransactionAppend, App::DocumentP::StatusBits, and App::DocumentP::undoing.

Referenced by MeshGui::Segmentation::accept(), MeshGui::SegmentationBestFit::accept(), ReverseEngineeringGui::Segmentation::accept(), DraftUtils::DraftDxfRead::AddGraphics(), Import::ImpExpDxfRead::AddGraphics(), App::GroupExtension::addObject(), DraftUtils::DraftDxfRead::AddObject(), Import::ImpExpDxfRead::AddObject(), App::DocumentPy::addObject(), Fem::createObjectByType(), ReverseEngineeringGui::SegmentationManual::createSegment(), PartGui::DlgProjectionOnSurface::DlgProjectionOnSurface(), Sandbox::CustomAddObjectEvent::execute(), App::OriginGroupExtension::extensionOnChanged(), ArchPanel.NestTaskPanel::getContainer(), ArchPanel.NestTaskPanel::getShapes(), Part::ImportIgesParts(), Part::ImportStepParts(), Import::ImportOCAF2::loadShapes(), PartDesignGui::TaskFeaturePick::makeCopy(), PartDesign::Body::onChanged(), DraftUtils::DraftDxfRead::OnReadText(), Import::ImpExpDxfRead::OnReadText(), readObjects(), Fem::FemVTKTools::readResult(), Restore(), Path::Area::showShape(), MeshGui::ViewProviderMesh::splitMesh(), and App::LinkBaseExtension::update().

◆ addObject() [2/2]

void Document::addObject ( DocumentObject pcObject,
const char *  pObjectName = 0 
)

◆ addObjects()

◆ addOrRemovePropertyOfObject()

◆ addRecomputeObject()

void Document::addRecomputeObject ( DocumentObject obj)

Called by objects during restore to ask for recompute.

References testStatus(), and App::DocumentP::touchedObjs.

◆ afterRestore() [1/2]

void Document::afterRestore ( bool  checkPartial = false)

◆ afterRestore() [2/2]

◆ breakDependency()

void Document::breakDependency ( DocumentObject pcObject,
bool  clear 
)
protected

◆ checkOnCycle()

bool Document::checkOnCycle ( void  )

checks if the graph is directed and has no cycles

◆ clearDocument()

◆ clearUndos()

void Document::clearUndos ( )

◆ commitTransaction()

◆ copyObject()

std::vector< DocumentObject * > Document::copyObject ( const std::vector< DocumentObject * > &  objs,
bool  recursive = false,
bool  returnAll = false 
)

Copy objects from another document to this document.

Parameters
recursiveif true, then all objects this object depends on are copied as well. By default recursive is false.
returnAllif true, return all copied objects including those auto included by recursive searching. If false, then only return the copied object corresponding to the input objects.
Returns
Returns the list of objects copied.

References DepNoXLinked, DepSort, exportObjects(), getDependencyList(), App::Application::getTempFileName(), App::PropertyXLink::hasXLink(), App::MergeDocuments::importObjects(), isSaved(), App::MergeDocuments::setVerbose(), TempDoc, and testStatus().

Referenced by App::DocumentPy::copyObject(), Gui::TreeWidget::dropEvent(), and moveObject().

◆ countObjects()

int Document::countObjects ( void  ) const

get the number of objects in the document

References App::DocumentP::objectArray.

Referenced by StdCmdImport::activated(), and Gui::Application::open().

◆ countObjectsOfType()

int Document::countObjectsOfType ( const Base::Type typeId) const

◆ exportGraphviz()

void Document::exportGraphviz ( std::ostream &  out) const

The GraphCreator class

This class creates the dependency graph for a document.

getId returns a canonical string for a DocumentObject.

Parameters
docObjDocument object to get an ID from
Returns
A string

getId returns a canonical string for an ObjectIdentifier;

Parameters
path
Returns
A string

setGraphAttributes Set graph attributes on a subgraph for a DocumentObject node.

Parameters
objDocumentObject

setPropertyVertexAttributes Set vertex attributes for a Property node in a graph.

Parameters
gGraph
vertexProperty node
nameName of node

addExpressionSubgraphIfNeeded Add a subgraph to the main graph if it is needed, i.e. there are defined at least one expression in the document object, or other objects are referencing properties in it.

Parameters
objDocumentObject to assess.
CSSubgraphsBoolean if the GeoFeatureGroups are created as subgraphs

add Add @docObj to the graph, including all expressions (and dependencies) it includes.

Parameters
docObjThe document object to add.
nameName of node.

References App::DocumentObject::ExpressionEngine, DraftVecUtils::find(), App::GetApplication(), ParameterGrp::GetBool(), Base::Persistence::getClassTypeId(), App::PropertyExpressionEngine::getExpressions(), App::ExtensionContainer::getExtensionByType(), App::GeoFeatureGroupExtension::getGroupOfObject(), App::GeoFeatureGroupExtension::getInvalidLinkObjects(), getName(), App::DocumentObject::getNameInDocument(), App::OriginFeature::getOrigin(), App::DocumentObject::getOutList(), App::Application::GetParameterGroupByPath(), App::ExtensionContainer::hasExtension(), and Base::BaseClass::isDerivedFrom().

Referenced by App::DocumentPy::exportGraphviz(), and App::DocumentPy::getDependencyGraph().

◆ exportObjects()

void Document::exportObjects ( const std::vector< App::DocumentObject * > &  obj,
std::ostream &  out 
)

◆ findObjects()

std::vector< DocumentObject * > Document::findObjects ( const Base::Type typeId,
const char *  objname,
const char *  label 
) const

◆ getActiveObject()

◆ getAvailableRedoNames()

std::vector< std::string > Document::getAvailableRedoNames ( ) const

Returns a list of the Redo names.

Referenced by App::DocumentPy::getRedoNames(), and Gui::Document::getRedoVector().

◆ getAvailableRedos()

int Document::getAvailableRedos ( int  id = 0) const

Returns the number of stored Redos. If greater than 0 Redo will be effective.

◆ getAvailableUndoNames()

std::vector< std::string > Document::getAvailableUndoNames ( ) const

◆ getAvailableUndos()

int Document::getAvailableUndos ( int  id = 0) const

Returns the number of stored Undos. If greater than 0 Undo will be effective.

References App::DocumentP::activeUndoTransaction, and App::Transaction::getID().

◆ getDependencyList()

std::vector< App::DocumentObject * > Document::getDependencyList ( const std::vector< App::DocumentObject * > &  objs,
int  options = 0 
)
static

Get a complete list of all objects the given objects depend on.

This function is defined as static because it accepts objects from different documents, and the returned list will contain dependent objects from all relevant documents

Parameters
objsinput objects to query for dependency.
optionsSee DependencyOption

References DepNoCycle, DepSort, and App::DocumentP::partialTopologicalSort().

Referenced by StdCmdDuplicateSelection::activated(), afterRestore(), copyObject(), Gui::MainWindow::createMimeDataFromSelection(), Gui::DlgObjectSelection::DlgObjectSelection(), getDependingObjects(), importLinks(), Import::ImportOCAF2::loadShapes(), moveObject(), and recompute().

◆ getDependentDocuments() [1/2]

◆ getDependentDocuments() [2/2]

std::vector< App::Document * > Document::getDependentDocuments ( std::vector< App::Document * >  docs,
bool  sort 
)
static

◆ getDependingObjects()

std::vector< DocumentObject * > Document::getDependingObjects ( ) const

Returns a list of document's objects including the dependencies.

References getDependencyList(), and App::DocumentP::objectArray.

◆ getErrorDescription()

const char * Document::getErrorDescription ( const App::DocumentObject Obj) const

get the text of the error of a specified object

References App::DocumentP::findRecomputeLog().

Referenced by PartDesignGui::ViewProviderTransformed::recomputeFeature(), and writeObjects().

◆ getFileName()

const char * Document::getFileName ( ) const

Returned filename.

For saved document, this will be the content stored in property 'Filename'. For unsaved temporary file, this will be the content of property 'TransientDir'.

References FileName, App::PropertyString::getValue(), TempDoc, testStatus(), and TransientDir.

Referenced by App::DocInfo::getDocPath(), and App::PropertyXLink::setValue().

◆ getFullName()

std::string Document::getFullName ( ) const
overridevirtual

Reimplemented from App::PropertyContainer.

◆ getInList()

std::vector< App::DocumentObject * > Document::getInList ( const DocumentObject me) const

get a list of all objects linking to the given object

References App::DocumentP::objectMap.

◆ getLinksTo()

void Document::getLinksTo ( std::set< DocumentObject * > &  links,
const DocumentObject obj,
int  options,
int  maxCount = 0,
const std::vector< DocumentObject * > &  objs = {} 
) const

Return the links to a given object.

Parameters
linksholds the links found
objthe linked object. If NULL, then all links are returned.
option
See also
App::GetLinkOption
Parameters
maxCountlimit the number of links returned, 0 means no limit
objsoptional objects to search for, if empty, then all objects of this document are searched.

References App::GetApplication(), App::GetLinkArrayElement, App::GetLinkedObject, App::GetLinkExternal, App::GetLinkRecursive, draftfunctions.move::move(), and App::DocumentP::objectArray.

Referenced by App::DocumentPy::getLinksTo(), hasLinksTo(), and importLinks().

◆ getMaxUndoStackSize()

unsigned int Document::getMaxUndoStackSize ( void  ) const

Set the Undo limit as stack size.

References App::DocumentP::UndoMaxStackSize.

◆ getMemSize()

unsigned int Document::getMemSize ( void  ) const
overridevirtual

returns the complete document memory consumption, including all managed DocObjects and Undo Redo.

Reimplemented from App::PropertyContainer.

References App::PropertyContainer::getMemSize(), getUndoMemSize(), and App::DocumentP::objectArray.

◆ getName()

const char * Document::getName ( void  ) const

Get the document name.

Label is the visible name of a document shown e.g.

in the windows title or in the tree view. The label almost (but not always e.g. if you manually change it) matches with the file name where the document is stored to. In contrast to Label the method getName() returns the internal name of the document that only matches with Label when loading or creating a document because then both are set to the same value. Since the internal name cannot be changed during runtime it must differ from the Label after saving the document the first time or saving it under a new file name. @ note More than one document can have the same label name. @ note The internal is always guaranteed to be unique because Application::newDocument() checks for a document with the same name and makes it unique if needed. Hence you cannot rely on that the internal name matches with the name you passed to Application::newDoument(). You should use the method getName() instead.

Referenced by MeshPartGui::Tessellation::accept(), StdCmdSelectVisibleObjects::activated(), StdCmdToggleObjects::activated(), StdCmdShowObjects::activated(), StdCmdHideObjects::activated(), PartGui::FaceColors::Private::addFacesToSelection(), afterRestore(), Gui::ExpressionBinding::apply(), Gui::ViewProviderAnnotation::attach(), Gui::ViewProviderOriginFeature::attach(), MeshGui::ViewProviderMesh::attach(), PointsGui::ViewProviderScattered::attach(), PointsGui::ViewProviderStructured::attach(), Gui::ViewProviderVRMLObject::attach(), RobotGui::ViewProviderRobotObject::attach(), RobotGui::ViewProviderTrajectory::attach(), Gui::DAG::Model::contextMenuEvent(), App::PropertyXLink::copyTo(), App::DocInfo::deinit(), Gui::TreeWidget::dropEvent(), exportGraphviz(), PartGui::DlgExtrusion::findShapes(), Gui::LinkInfo::getDocName(), Gui::View3DInventorPy::getObjectInfo(), Gui::View3DInventorPy::getObjectsInfo(), App::PropertyLinkSubList::getPyReprString(), App::PropertyXLinkSubList::getPyReprString(), PartDesignGui::getReferencedSelection(), Gui::SelectionSingleton::isSelected(), Gui::DAG::Model::mousePressEvent(), Spreadsheet::Sheet::observeDocument(), SketcherGui::TaskSketcherConstrains::on_listWidgetConstraints_itemSelectionChanged(), SketcherGui::TaskSketcherElements::on_listWidgetElements_itemEntered(), SketcherGui::TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(), Gui::Application::onLastWindowClosed(), Gui::TreeWidget::onPreSelectTimer(), Gui::View3DInventor::onRename(), FemGui::TaskFemConstraintBearing::onSelectionChanged(), FemGui::TaskFemConstraintGear::onSelectionChanged(), PartDesignGui::TaskBooleanParameters::onSelectionChanged(), SketcherGui::TaskSketcherConstrains::onSelectionChanged(), SketcherGui::TaskSketcherElements::onSelectionChanged(), Gui::Application::open(), App::Application::openDocumentPrivate(), Gui::Dialog::Placement::Placement(), TechDrawGui::MDIViewPage::preSelectionChanged(), Gui::ElementColors::Private::Private(), recompute(), PartDesignGui::TaskDressUpParameters::referenceSelected(), PartDesignGui::TaskPipeParameters::referenceSelected(), PartDesignGui::TaskPipeOrientation::referenceSelected(), PartDesignGui::TaskPipeScaling::referenceSelected(), PartDesignGui::TaskShapeBinder::referenceSelected(), DrawSketchHandlerCoincident::releaseButton(), DrawSketchHandlerFillet::releaseButton(), removeObject(), App::ObjectIdentifier::resolve(), App::PropertyLinkList::Restore(), Gui::SelectionSingleton::sAddSelection(), TechDrawGui::QGVPage::saveSvg(), Gui::SelectionObserver::SelectionObserver(), Gui::DocumentItem::selectItems(), Gui::Application::setActiveDocument(), Gui::View3DInventorViewer::setDocument(), TechDrawGui::ViewProviderViewPart::setEdit(), PartDesignGui::TaskDressUpParameters::setSelection(), FemGui::TaskFemConstraint::setSelection(), TechDrawGui::MDIViewPage::setTreeToSceneSelect(), App::PropertyXLink::setValue(), Gui::AutoSaver::slotCreateDocument(), Gui::SelectionSingleton::slotDeletedObject(), Gui::Application::slotDeleteDocument(), Gui::AutoSaver::slotDeleteDocument(), Gui::ElementColors::slotDeleteDocument(), Gui::DocumentItem::slotNewObject(), Gui::SelectionSingleton::sRemoveSelection(), Gui::SelectionSingleton::sSetPreselection(), Gui::SelectionSingleton::sUpdateSelection(), PartDesignGui::TaskFeaturePick::TaskFeaturePick(), PartDesignGui::ViewProvider::unsetEdit(), Gui::ViewProviderInventorObject::updateData(), PartGui::DlgExtrusion::writeParametersToFeature(), and ~Document().

◆ getObject()

DocumentObject * Document::getObject ( const char *  Name) const

Returns a Object of this document.

References App::DocumentP::objectMap.

Referenced by PartGui::DlgBooleanOperation::accept(), PathGui::TaskDlgPathCompound::accept(), Sketcher::SketchObjectPy::addExternal(), Measure::MeasurementPy::addReference3D(), PartDesignGui::TaskFeaturePick::buildFeatures(), Sketcher::SketchObjectPy::carbonCopy(), Gui::View3DInventorViewer::checkGroupOnTop(), App::ObjectIdentifier::String::checkImport(), TechDrawGui::TaskActiveView::createActiveView(), TechDrawGui::TaskRichAnno::createAnnoFeature(), TechDrawGui::TaskDetail::createDetail(), TechDrawGui::TaskLeaderLine::createLeaderFeature(), TechDrawGui::TaskSectionView::createSectionView(), TechDrawGui::TaskWeldingSymbol::createWeldingSymbol(), Gui::TreeWidget::dropEvent(), PartGui::DlgExtrusion::getAxisLink(), PartGui::DlgRevolution::getAxisLink(), TechDrawGui::TaskDetail::getBaseFeat(), App::DocumentPy::getCustomAttributes(), TechDrawGui::TaskDetail::getDetailFeat(), PartDesignGui::TaskDraftParameters::getLine(), App::GroupExtension::getObject(), Gui::Command::getObject(), App::DocumentPy::getObject(), PartDesignGui::TaskDraftParameters::getPlane(), PartDesignGui::getReferencedSelection(), PartGui::getShapeFromStrings(), Gui::Document::getViewProviderByName(), Gui::Command::hasObject(), App::ObjectIdentifier::importSubNames(), PartDesignGui::TaskTransformedParameters::indexesMoved(), TechDrawGui::TaskSectionView::isBaseValid(), TechDrawGui::TaskSectionView::isSectionValid(), TechDrawGui::QGVPage::mouseReleaseEvent(), PartDesignGui::TaskSketchBasedParameters::onAddSelection(), FemGui::TaskFemConstraintBearing::onSelectionChanged(), FemGui::TaskFemConstraintGear::onSelectionChanged(), PartDesignGui::TaskBooleanParameters::onSelectionChanged(), DrawSketchHandlerExternal::onSelectionChanged(), DrawSketchHandlerCarbonCopy::onSelectionChanged(), PartDesignGui::TaskTransformedParameters::originalSelected(), readObjects(), PartDesignGui::TaskPipeParameters::referenceSelected(), PartDesignGui::TaskPipeOrientation::referenceSelected(), PartDesignGui::TaskPipeScaling::referenceSelected(), PartDesignGui::TaskShapeBinder::referenceSelected(), App::DocumentPy::removeObject(), App::ObjectIdentifier::resolve(), PartDesign::ProfileBased::Restore(), Restore(), App::PropertyLink::Restore(), App::PropertyLinkList::Restore(), App::PropertyLinkSub::Restore(), App::PropertyLinkSubList::Restore(), App::PropertyXLink::Restore(), App::DocumentPy::setCustomAttributes(), Gui::DocumentPy::setEdit(), Gui::SelectionSingleton::setPreselect(), PartDesignGui::TaskSketchBasedParameters::setUpToFace(), App::PropertyXLink::setValue(), and TechDrawGui::TaskLinkDim::updateDims().

◆ getObjectByID()

DocumentObject * Document::getObjectByID ( long  id) const

Returns a Object of this document by its id.

References App::DocumentP::objectIdMap.

Referenced by App::LinkBaseExtension::extensionExecute(), App::DocumentPy::getObject(), and moveObject().

◆ getObjectName()

const char * Document::getObjectName ( DocumentObject pFeat) const

Returns a Name of an Object or 0.

References App::DocumentP::objectMap.

◆ getObjects()

◆ getObjectsOfType() [1/2]

template<typename T >
std::vector< T * > Document::getObjectsOfType

Returns an array with the correct types already.

◆ getObjectsOfType() [2/2]

◆ getObjectsWithExtension()

std::vector< DocumentObject * > Document::getObjectsWithExtension ( const Base::Type typeId,
bool  derived = true 
) const

Returns all object with given extensions. If derived=true also all objects with extensions derived from the given one.

References App::DocumentP::objectArray.

◆ getOldLabel()

const std::string& App::Document::getOldLabel ( ) const

◆ getPathsByOutList()

std::vector< std::list< App::DocumentObject * > > Document::getPathsByOutList ( const App::DocumentObject from,
const App::DocumentObject to 
) const

get all possible paths from one object to another following the OutList

References draftfunctions.array::array(), DraftVecUtils::find(), App::DocumentP::findAllPathsAt(), and App::DocumentP::objectArray.

◆ getProgramVersion()

const char * Document::getProgramVersion ( ) const

Get program version the project file was created with.

References App::DocumentP::programVersion.

◆ getPyObject()

PyObject * Document::getPyObject ( void  )
overridevirtual

This method returns the Python wrapper for a C++ object.

It's in the responsibility of the programmer to do the correct reference counting. Basically there are two ways how to implement that: Either always return a new Python object then reference counting is not a matter or return always the same Python object then the reference counter must be incremented by one. However, it's absolutely forbidden to return always the same Python object without incrementing the reference counter.

The default implementation returns 'None'.

Reimplemented from Base::BaseClass.

Referenced by App::Application::setActiveDocument().

◆ getRootObjects()

std::vector< App::DocumentObject * > Document::getRootObjects ( ) const

get all root objects (objects no other one reference too)

References App::DocumentP::objectArray.

Referenced by App::DocumentPy::getRootObjects().

◆ getStandardObjectName()

std::string Document::getStandardObjectName ( const char *  Name,
int  d 
) const

Returns a name of the form prefix_number. d specifies the number of digits.

References getObjects(), and Base::Tools::getUniqueName().

◆ getTouched()

vector< DocumentObject * > Document::getTouched ( void  ) const

returns all touched objects

References App::DocumentP::objectArray.

◆ getTransactionID()

int Document::getTransactionID ( bool  undo,
unsigned  pos = 0 
) const

Return the undo/redo transaction ID starting from the back.

References App::DocumentP::activeUndoTransaction, App::Transaction::getID(), and undo().

◆ getTransientDirectoryName()

std::string Document::getTransientDirectoryName ( const std::string &  uuid,
const std::string &  filename 
) const
protected

◆ getUndoMemSize()

unsigned int Document::getUndoMemSize ( void  ) const

Returns the actual memory consumption of the Undo redo stuff.

References App::DocumentP::UndoMemSize.

Referenced by getMemSize().

◆ getUndoMode()

int Document::getUndoMode ( void  ) const

switch the level of Undo/Redo

References App::DocumentP::iUndoMode.

◆ getUniqueObjectName()

◆ hasLinksTo()

bool Document::hasLinksTo ( const DocumentObject obj) const

Check if there is any link to the given object.

References getLinksTo().

◆ hasPendingTransaction()

bool Document::hasPendingTransaction ( ) const

Check if a transaction is open.

References App::DocumentP::activeUndoTransaction.

Referenced by Gui::Document::hasPendingCommand().

◆ importLinks()

std::vector< App::DocumentObject * > Document::importLinks ( const std::vector< App::DocumentObject * > &  objs = {})

Import any externally linked objects.

Parameters
objsinput list of objects. Only objects belonging to this document will be checked for external links. And all found external linked object will be imported to this document. Link type properties of those input objects will be automatically reassigned to the imported objects. Note that the link properties of other objects in the document but not included in the input list, will not be affected even if they point to some object beining imported. To import all objects, simply pass in all objects of this document.
Returns
the list of imported objects

References Base::FileInfo::deleteFile(), exportObjects(), getDependencyList(), App::GetLinkExternal, getLinksTo(), App::MergeDocuments::getNameMap(), App::Application::getTempFileName(), App::Property::Immutable, App::MergeDocuments::importObjects(), and App::PartialObject.

Referenced by App::DocumentPy::importLinks().

◆ importObjects()

◆ isAnyRestoring()

bool Document::isAnyRestoring ( )
static

◆ isClosable()

bool Document::isClosable ( ) const

check whether the document can be closed

References Closable, and testStatus().

◆ isExporting()

Document::ExportStatus Document::isExporting ( const App::DocumentObject obj) const

◆ isIn()

◆ isPerformingTransaction()

bool Document::isPerformingTransaction ( ) const

returns true if the document is in an Transaction phase, e.g. currently performing a redo/undo or rollback

References App::DocumentP::rollback, and App::DocumentP::undoing.

Referenced by abortTransaction(), addOrRemovePropertyOfObject(), clearUndos(), commitTransaction(), openTransaction(), and App::LinkBaseExtension::update().

◆ isSaved()

bool Document::isSaved ( ) const

Opens the document from its file name.

Is the document already saved to a file?

References FileName, and App::PropertyString::getValue().

Referenced by copyObject(), Import::ImportOCAF2::ImportOCAF2(), and Import::ImportOCAF2::setMode().

◆ isTouched()

bool Document::isTouched ( void  ) const

check if there is any touched object in this document

References App::DocumentP::objectArray.

◆ isTransactionEmpty()

bool Document::isTransactionEmpty ( ) const

Check if a transaction is open and its list is empty.

If no transaction is open true is returned.

References App::DocumentP::activeUndoTransaction.

◆ moveObject()

DocumentObject * Document::moveObject ( DocumentObject obj,
bool  recursive = false 
)

Move an object from another document to this document If recursive is true then all objects this object depends on are moved as well.

By default recursive is false. Returns the moved object itself or 0 if the object is already part of this document..

References breakDependency(), copyObject(), DepNoXLinked, DepSort, getDependencyList(), getObjectByID(), getUniqueObjectName(), App::DocumentP::iUndoMode, removeObject(), and App::DocumentP::rollback.

Referenced by Gui::TreeWidget::dropEvent(), and App::DocumentPy::moveObject().

◆ mustExecute()

bool Document::mustExecute ( void  ) const

check if there is any object must execute in this document

References App::PropertyXLink::hasXLink(), and App::DocumentP::objectArray.

Referenced by StdCmdRefresh::isActive(), recompute(), and Gui::Document::save().

◆ onBeforeChange()

void Document::onBeforeChange ( const Property )
overrideprotectedvirtual

get called before the value is changed

Reimplemented from App::PropertyContainer.

References App::PropertyString::getValue(), Label, and signalBeforeChange.

Referenced by PathScripts.PathGui.QuantitySpinBox::updateProperty().

◆ onBeforeChangeProperty()

void Document::onBeforeChangeProperty ( const TransactionalObject Who,
const Property What 
)
protected

◆ onChanged()

◆ onChangedProperty()

void Document::onChangedProperty ( const DocumentObject Who,
const Property What 
)
protected

callback from the Document objects after property was changed

References signalChangedObject.

◆ openTransaction()

◆ purgeTouched()

void Document::purgeTouched ( )

Remove all modifications. After this call The document becomes Valid again.

Remove all modifications. After this call The document becomes valid again.

References App::DocumentP::objectArray.

◆ readObjects()

◆ recompute()

int Document::recompute ( const std::vector< App::DocumentObject * > &  objs = {},
bool  force = false,
bool hasError = 0,
int  options = 0 
)

Recompute touched features and return the number of recalculated features.

Parameters
objsspecify a sub set of objects to recompute. If empty, then all object in this document is checked for recompute

References App::DocumentP::clearRecomputeLog(), Base::Console(), DepSort, App::GetApplication(), ParameterGrp::GetBool(), getDependencyList(), getName(), App::Application::GetParameterGroupByPath(), App::PropertyString::getValue(), Label, Base::ConsoleSingleton::Log(), mustExecute(), App::DocumentP::objectArray, PartialDoc, App::DocumentP::partialTopologicalSort(), Recomputing, App::DocumentP::rollback, signalBeforeRecompute, signalRecomputed, signalRecomputedObject, signalSkipRecompute, SkipRecompute, testStatus(), topologicalSort(), and App::DocumentP::undoing.

Referenced by Gui::Dialog::DlgMacroExecuteImp::accept(), PartGui::DlgBooleanOperation::accept(), PartGui::DlgFilletEdges::accept(), PartGui::DlgRevolution::accept(), PartGui::Mirroring::accept(), TechDrawGui::TaskGeomHatch::accept(), TechDrawGui::TaskHatch::accept(), Gui::TaskCSysDragger::accept(), Gui::MacroCommand::activated(), Gui::RecentMacrosAction::activateFile(), FemGui::TaskDlgPost::clicked(), Gui::TreeWidget::dropEvent(), Sandbox::CustomRecomputeEvent::execute(), Gui::ManualAlignment::finish(), TechDrawGui::TaskHatch::onFileChanged(), SpreadsheetGui::SheetTableView::pasteClipboard(), Fem::FemVTKTools::readResult(), FemGui::TaskPostBox::recompute(), App::DocumentPy::recompute(), recomputeFeature(), TechDrawGui::TaskGeomHatch::reject(), TechDrawGui::TaskHatch::reject(), draftguitools.gui_trackers.arcTracker::setApertureAngle(), draftguitools.gui_trackers.arcTracker::setEndAngle(), draftguitools.gui_trackers.arcTracker::setStartAngle(), draftguitools.gui_trackers.bsplineTracker::update(), and draftguitools.gui_trackers.bezcurveTracker::update().

◆ recomputeFeature()

bool Document::recomputeFeature ( DocumentObject Feat,
bool  recursive = false 
)

Recompute only one feature.

References App::DocumentP::clearRecomputeLog(), App::DocumentObject::getNameInDocument(), App::DocumentObject::isValid(), recompute(), and signalRecomputedObject.

Referenced by PartDesignGui::TaskBoxPrimitives::onBoxHeightChanged(), PartDesignGui::TaskBoxPrimitives::onBoxLengthChanged(), PartDesignGui::TaskBoxPrimitives::onBoxWidthChanged(), PartDesignGui::TaskBoxPrimitives::onConeAngleChanged(), PartDesignGui::TaskBoxPrimitives::onConeHeightChanged(), PartDesignGui::TaskBoxPrimitives::onConeRadius1Changed(), PartDesignGui::TaskBoxPrimitives::onConeRadius2Changed(), PartDesignGui::TaskBoxPrimitives::onCylinderAngleChanged(), PartDesignGui::TaskBoxPrimitives::onCylinderHeightChanged(), PartDesignGui::TaskBoxPrimitives::onCylinderRadiusChanged(), PartDesignGui::TaskBoxPrimitives::onEllipsoidAngle1Changed(), PartDesignGui::TaskBoxPrimitives::onEllipsoidAngle2Changed(), PartDesignGui::TaskBoxPrimitives::onEllipsoidAngle3Changed(), PartDesignGui::TaskBoxPrimitives::onEllipsoidRadius1Changed(), PartDesignGui::TaskBoxPrimitives::onEllipsoidRadius2Changed(), PartDesignGui::TaskBoxPrimitives::onEllipsoidRadius3Changed(), PartDesignGui::TaskBoxPrimitives::onPrismCircumradiusChanged(), PartDesignGui::TaskBoxPrimitives::onPrismHeightChanged(), PartDesignGui::TaskBoxPrimitives::onPrismPolygonChanged(), PartDesignGui::TaskBoxPrimitives::onPrismXSkewChanged(), PartDesignGui::TaskBoxPrimitives::onPrismYSkewChanged(), PartDesignGui::TaskBooleanParameters::onSelectionChanged(), PartDesignGui::TaskDraftParameters::onSelectionChanged(), PartDesignGui::TaskBoxPrimitives::onSphereAngle1Changed(), PartDesignGui::TaskBoxPrimitives::onSphereAngle2Changed(), PartDesignGui::TaskBoxPrimitives::onSphereAngle3Changed(), PartDesignGui::TaskBoxPrimitives::onSphereRadiusChanged(), PartDesignGui::TaskBoxPrimitives::onTorusAngle1Changed(), PartDesignGui::TaskBoxPrimitives::onTorusAngle2Changed(), PartDesignGui::TaskBoxPrimitives::onTorusAngle3Changed(), PartDesignGui::TaskBoxPrimitives::onTorusRadius1Changed(), PartDesignGui::TaskBoxPrimitives::onTorusRadius2Changed(), PartDesignGui::TaskBoxPrimitives::onWedgeX2maxChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeX2minChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeXmaxChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeXminChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeYmaxChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeYminChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeZ2maxChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeZ2minChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeZmaxChanged(), PartDesignGui::TaskBoxPrimitives::onWedgeZminChanged(), TechDrawGui::TaskBalloon::recomputeFeature(), TechDrawGui::TaskDimension::recomputeFeature(), TechDrawGui::TaskLeaderLine::recomputeFeature(), and PartDesignGui::TaskDressUpParameters::referenceSelected().

◆ redo()

bool Document::redo ( int  id = 0)

◆ removeObject()

◆ renameObjectIdentifiers()

void Document::renameObjectIdentifiers ( const std::map< App::ObjectIdentifier, App::ObjectIdentifier > &  paths,
const std::function< bool(const App::DocumentObject *)> &  selector = [](const App::DocumentObject *) { return true; } 
)

Function called to signal that an object identifier has been renamed.

Signal that object identifiers, typically a property or document object has been renamed.

This function iterates through all document object in the document, and calls its renameObjectIdentifiers functions.

Parameters
pathsMap with current and new names

References App::DocumentP::objectArray.

Referenced by Spreadsheet::PropertySheet::insertColumns(), Spreadsheet::PropertySheet::insertRows(), Spreadsheet::PropertySheet::removeColumns(), Spreadsheet::PropertySheet::removeRows(), and Spreadsheet::PropertySheet::setAlias().

◆ renameTransaction()

void Document::renameTransaction ( const char *  name,
int  id 
)

Rename the current transaction if the id matches.

References App::DocumentP::activeUndoTransaction, App::Transaction::getID(), and App::Transaction::Name.

◆ Restore()

void Document::Restore ( Base::XMLReader )
overridevirtual

This method is used to restore properties from an XML document.

It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:

{
// read my Element
reader.readElement("PropertyVector");
// get the value of my Attribute
_cVec.x = reader.getAttributeAsFloat("valueX");
_cVec.y = reader.getAttributeAsFloat("valueY");
_cVec.z = reader.getAttributeAsFloat("valueZ");
}
virtual void Restore(Base::XMLReader &reader) override
This method is used to restore properties from an XML document.
Definition: PropertyGeo.cpp:170
The XML reader class This is an important helper class for the store and retrieval system of objects ...
Definition: Reader.h:118
void readElement(const char *ElementName=0)
read until a start element is found (<name>) or start-end element (<name/>) (with special name if giv...
Definition: Reader.cpp:240
double getAttributeAsFloat(const char *AttrName) const
return the named attribute as a double floating point (does type checking)
Definition: Reader.cpp:158

Reimplemented from App::PropertyContainer.

References addObject(), Base::Console(), Base::XMLReader::DocumentSchema, FileName, Base::XMLReader::FileVersion, Base::XMLReader::getAttribute(), Base::XMLReader::getAttributeAsInteger(), Base::XMLReader::getAttributeAsUnsigned(), getObject(), App::PropertyString::getValue(), Base::XMLReader::hasAttribute(), Label, Base::ConsoleSingleton::Message(), PartialDoc, Base::XMLReader::ProgramVersion, Base::XMLReader::readElement(), Base::XMLReader::readEndElement(), readObjects(), App::PropertyContainer::Restore(), App::ExtensionContainer::Restore(), App::DocumentObject::setStatus(), setStatus(), App::PropertyLink::setValue(), App::PropertyString::setValue(), Tip, TipName, and App::DocumentP::touchedObjs.

Referenced by restore().

◆ restore()

◆ Save()

void Document::Save ( Base::Writer ) const
overridevirtual

This method is used to save properties to an XML document.

A good example you'll find in PropertyStandard.cpp, e.g. the vector:

void PropertyVector::Save (Writer &writer) const
{
writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x <<
"\" valueY=\"" << _cVec.y <<
"\" valueZ=\"" << _cVec.z <<"\"/>" << endl;
}
virtual void Save(Base::Writer &writer) const override
This method is used to save properties to an XML document.
Definition: PropertyGeo.cpp:165

The writer.ind() expression writes the indentation, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.

See also
Base::Writer

Reimplemented from App::PropertyContainer.

References App::Application::Config(), Base::Writer::getFileVersion(), App::DocumentP::objectArray, App::PropertyContainer::Save(), Base::Writer::Stream(), and writeObjects().

Referenced by Sandbox::DocumentSaverThread::run(), and saveToFile().

◆ save()

◆ saveAs()

◆ saveCopy()

bool Document::saveCopy ( const char *  file) const

◆ saveToFile()

◆ setClosable()

void Document::setClosable ( bool  c)

set the document to be closable, this is on by default.

References Closable, and setStatus().

◆ setMaxUndoStackSize()

void Document::setMaxUndoStackSize ( unsigned int  UndoMaxStackSize = 20)

Set the Undo limit as stack size.

References App::DocumentP::UndoMaxStackSize.

◆ setStatus()

◆ setTransactionMode()

void Document::setTransactionMode ( int  iMode)

switch the transaction mode

References App::DocumentP::iTransactionMode.

◆ setUndoLimit()

void Document::setUndoLimit ( unsigned int  UndoMemSize = 0)

Set the Undo limit in Byte!

References App::DocumentP::UndoMemSize.

◆ setUndoMode()

void Document::setUndoMode ( int  iMode)

switch the level of Undo/Redo

References clearUndos(), and App::DocumentP::iUndoMode.

Referenced by App::DocumentPy::setUndoMode().

◆ testStatus()

◆ topologicalSort()

std::vector< App::DocumentObject * > Document::topologicalSort ( ) const

◆ undo()

◆ writeDependencyGraphViz()

void Document::writeDependencyGraphViz ( std::ostream &  out)

write GraphViz file

References App::DocumentP::objectMap.

◆ writeObjects()

Friends And Related Function Documentation

◆ Application

friend class Application
friend

◆ DocumentObject

friend class DocumentObject
friend

The DocumentObject that will own the expression.

◆ Transaction

friend class Transaction
friend

Referenced by redo(), and undo().

◆ TransactionalObject

friend class TransactionalObject
friend

because of transaction handling

◆ TransactionDocumentObject

friend class TransactionDocumentObject
friend

Member Data Documentation

◆ Comment

PropertyString App::Document::Comment

long comment or description (UTF8 with line breaks)

Referenced by Document().

◆ Company

PropertyString App::Document::Company

company name UTF8(optional)

Referenced by Document().

◆ CreatedBy

PropertyString App::Document::CreatedBy

creators name (utf-8)

Referenced by Document().

◆ CreationDate

PropertyString App::Document::CreationDate

Referenced by Document().

◆ FileName

◆ Id

PropertyString App::Document::Id

Id e.g. Part number.

Referenced by Document().

◆ Label

◆ LastModifiedBy

PropertyString App::Document::LastModifiedBy

user last modified the document

Referenced by Document(), and save().

◆ LastModifiedDate

PropertyString App::Document::LastModifiedDate

Referenced by Document(), and save().

◆ License

App::PropertyString App::Document::License

License string Holds the short license string for the Item, e.g.

CC-BY for the Creative Commons license suit.

Referenced by Document().

◆ LicenseURL

App::PropertyString App::Document::LicenseURL

License description/contract URL.

Referenced by Document().

◆ Material

App::PropertyMap App::Document::Material

Material descriptions, used and defined in the Material module.

◆ Meta

App::PropertyMap App::Document::Meta

Meta descriptions.

Referenced by Document().

◆ ShowHidden

PropertyBool App::Document::ShowHidden

Whether to show hidden items in TreeView.

Referenced by Document(), onChanged(), Gui::DocumentItem::setShowHidden(), and Gui::DocumentItem::showHidden().

◆ signalAbortTransaction

boost::signals2::signal<void (const App::Document&)> App::Document::signalAbortTransaction

◆ signalActivatedObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalActivatedObject

signal on activated Object

Referenced by addObject(), addObjects(), and Gui::Document::Document().

◆ signalBeforeChange

boost::signals2::signal<void (const App::Document&, const App::Property&)> App::Document::signalBeforeChange

signal before changing an doc property

Referenced by onBeforeChange().

◆ signalBeforeChangeObject

boost::signals2::signal<void (const App::DocumentObject&, const App::Property&)> App::Document::signalBeforeChangeObject

signal before changing an Object

Referenced by onBeforeChangeProperty().

◆ signalBeforeRecompute

boost::signals2::signal<void (const App::Document&)> App::Document::signalBeforeRecompute

Referenced by recompute().

◆ signalChanged

boost::signals2::signal<void (const App::Document&, const App::Property&)> App::Document::signalChanged

signal on changed doc property

Referenced by onChanged().

◆ signalChangedObject

◆ signalChangePropertyEditor

boost::signals2::signal<void (const App::Document&,const App::Property&)> App::Document::signalChangePropertyEditor

◆ signalCommitTransaction

boost::signals2::signal<void (const App::Document&)> App::Document::signalCommitTransaction

◆ signalDeletedObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalDeletedObject

◆ signalExportObjects

boost::signals2::signal<void (const std::vector<App::DocumentObject*>&, Base::Writer &)> App::Document::signalExportObjects

Referenced by exportObjects().

◆ signalExportViewObjects

boost::signals2::signal<void (const std::vector<App::DocumentObject*>&, Base::Writer &)> App::Document::signalExportViewObjects

◆ signalFinishImportObjects

boost::signals2::signal<void (const std::vector<App::DocumentObject*>&)> App::Document::signalFinishImportObjects

◆ signalFinishRestoreObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalFinishRestoreObject

◆ signalFinishSave

boost::signals2::signal<void (const App::Document&, const std::string&)> App::Document::signalFinishSave

Referenced by saveToFile().

◆ signalImportObjects

boost::signals2::signal<void (const std::vector<App::DocumentObject*>&, Base::XMLReader&)> App::Document::signalImportObjects

Referenced by importObjects().

◆ signalImportViewObjects

boost::signals2::signal<void (const std::vector<App::DocumentObject*>&, Base::Reader&, const std::map<std::string, std::string>&)> App::Document::signalImportViewObjects

◆ signalLinkXsetValue

boost::signals2::signal<void (std::string)> App::Document::signalLinkXsetValue

◆ signalNewObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalNewObject

signal on new Object

Referenced by addObject(), addObjects(), and Gui::Document::Document().

◆ signalOpenTransaction

boost::signals2::signal<void (const App::Document&, std::string)> App::Document::signalOpenTransaction

◆ signalRecomputed

boost::signals2::signal<void (const App::Document&, const std::vector<App::DocumentObject*>&)> App::Document::signalRecomputed

◆ signalRecomputedObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalRecomputedObject

◆ signalRedo

boost::signals2::signal<void (const App::Document&)> App::Document::signalRedo

◆ signalRelabelObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalRelabelObject

signal on relabeled Object

Referenced by Gui::Document::Document().

◆ signalRestoreDocument

boost::signals2::signal<void (Base::XMLReader&)> App::Document::signalRestoreDocument

Referenced by Gui::Document::Document(), and restore().

◆ signalSaveDocument

boost::signals2::signal<void (Base::Writer &)> App::Document::signalSaveDocument

signal on load/save document this signal is given when the document gets streamed.

you can use this hook to write additional information in the file (like the Gui::Document does).

Referenced by Gui::Document::Document(), Sandbox::DocumentSaverThread::run(), and saveToFile().

◆ signalSkipRecompute

boost::signals2::signal<void (const App::Document&, const std::vector<App::DocumentObject*>&)> App::Document::signalSkipRecompute

◆ signalStartSave

boost::signals2::signal<void (const App::Document&, const std::string&)> App::Document::signalStartSave

Referenced by saveToFile().

◆ signalTouchedObject

boost::signals2::signal<void (const App::DocumentObject&)> App::Document::signalTouchedObject

signal on manually called DocumentObject::touch()

Referenced by Gui::Document::Document().

◆ signalTransactionAppend

boost::signals2::signal<void (const App::DocumentObject&, Transaction*)> App::Document::signalTransactionAppend

signal on created object

Referenced by addObject(), addObjects(), and Gui::Document::Document().

◆ signalTransactionRemove

boost::signals2::signal<void (const App::DocumentObject&, Transaction*)> App::Document::signalTransactionRemove

signal on removed object

Referenced by Gui::Document::Document(), and removeObject().

◆ signalUndo

boost::signals2::signal<void (const App::Document&)> App::Document::signalUndo

◆ Tip

PropertyLink App::Document::Tip

Tip object of the document (if any)

Referenced by Document(), removeObject(), Restore(), and save().

◆ TipName

PropertyString App::Document::TipName

Tip object of the document (if any)

Referenced by Document(), removeObject(), Restore(), and save().

◆ TransientDir

PropertyString App::Document::TransientDir

◆ Uid

PropertyUUID App::Document::Uid

unique identifier of the document

Referenced by Document(), onChanged(), and saveAs().


The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/App/Document.h
  • Sources/FreeCAD/src/App/Document.cpp