2 #pragma warning(disable : 4251) 15 #include <unordered_map> 16 #include <unordered_set> 25 #include <boost/signals2.hpp> 28 #define DIR_NAME_INTERNAL_CATALOG "__internalCatalog__" 29 #define DIR_NAME_WEBGL_GT "webgl" 30 #define DIR_NAME_GEOID "geoid" 31 #define FILE_NAME_CAMERA_ANIMATION "CameraAnimation.ivc" 52 class PropertyLinkBase;
53 class CoreDocumentImpl;
60 typedef std::unordered_set<Core::DocObject*>
ObjectSet;
61 typedef std::unordered_map<DocObject::IdType, Core::DocObject*>
ObjectMap;
64 typedef std::unordered_map<DocObject::IdType, Core::ExecObject*>
ExecObjectMap;
73 typedef std::multimap<Base::String, Core::AttachmentEntry>
Attachments;
118 std::string MsgName =
"";
135 enum LX_CORE_EXPORT DocMessage
159 struct LX_CORE_EXPORT DocumentState
162 DocumentState() =
default;
163 DocumentState(
const DocumentState& rhs)
165 PropertyErrors = rhs.PropertyErrors;
166 LastErroneousObjects = rhs.LastErroneousObjects;
167 LastRecomputeTime = rhs.LastRecomputeTime;
168 LastNotifyTime = rhs.LastNotifyTime;
171 std::vector<std::string> PropertyErrors;
172 std::map<Core::DocObject*, std::vector<std::string>> LastErroneousObjects;
173 unsigned long LastRecomputeTime;
174 unsigned long LastNotifyTime;
179 struct LX_CORE_EXPORT PropertyLinkDesc
181 PropertyLinkDesc(std::string sourceDocObjectID, std::string sourcePropertyName,
Base::Type sourcePropertyTypeID, std::string targetDocObjectID,std::string propertyLinkName)
182 : m_SourceDocObjectID(sourceDocObjectID)
183 , m_SourcePropertyName(sourcePropertyName)
184 , m_SourcePropertyTypeID(sourcePropertyTypeID)
185 , m_TargetDocObjectID(targetDocObjectID)
186 , m_PropertyLinkName(propertyLinkName)
220 friend class ::App::ElementTool;
297 template <
typename Type>
301 assert(copy &&
"Document::copyObjectShallow could not copy object");
306 Type typedCopy = dynamic_cast<Type>(copy);
307 assert(typedCopy &&
"Document::copyObjectShallow could not cast object");
313 std::vector<Core::DocObject*>
getObjects(
bool includeDeletedObjects =
false)
const;
314 std::vector<const Core::DocObject*>
getObjectsConst(
bool includeDeletedObjects =
false)
const;
408 bool undo(
int id = 0);
414 bool redo(
int id = 0);
443 boost::signals2::signal<void(
const std::vector<Core::DocObject*>&,
const std::vector<Core::DocObject*>&,
const std::vector<Core::DocObject*>&)>
signalRecomputed;
449 boost::signals2::signal<void(
const std::vector<std::pair<const Core::DocObject*, const Core::DocObject*>>&)>
signalDefectLinks;
470 template <
typename T>
475 return static_cast<T*>(o);
482 template <
typename T>
486 if (T::isMutableStatic())
492 return static_cast<T*>(check);
499 o->_setPropertyValues(po,
true);
502 return static_cast<T*>(o);
510 template <
typename T>
514 if (T::isMutableStatic())
522 o->_setPropertyValues(po,
true);
525 return static_cast<T*>(o);
532 template <
typename T>
537 std::set<Base::Type> typeset;
541 std::vector<T*> returnObjs{};
542 for (
const auto& type : typeset)
548 const auto& docObjects = type2objects->second;
549 for (
const auto& obj : docObjects)
551 if (!obj->isDeleted())
552 returnObjs.push_back(static_cast<T*>(obj));
560 template <
typename T>
564 for (
const auto& it : objectMap)
566 if (!it.second->isDeleted() && it.second->isDerivedFrom<T>())
567 objs.push_back((T*)it.second);
579 std::vector<std::pair<const Core::DocObject*, const Core::DocObject*>>* errors =
nullptr);
581 const std::vector<const Core::DocObject*>& objToCheck,
582 std::vector<std::pair<const Core::DocObject*, const Core::DocObject*>>* errors =
nullptr);
584 std::vector<std::pair<const Core::DocObject*, const Core::DocObject*>>* errors);
617 static void getDefaultVersionToSave(
int& aMajorVersion,
int& aMinorVersion);
619 static void getPreviousVersionToSave(
int& aMajorVersion,
int& aMinorVersion);
621 static QString getPreviousVersionToSaveStr();
624 bool saveFile(
bool toExport =
false,
bool saveBackupCopy =
false);
627 bool toExport =
false,
628 bool saveBackupCopy =
false,
637 bool toExport =
false,
638 bool saveBackupCopy =
false,
640 bool dontRename =
false);
747 virtual void saveDocument(std::shared_ptr<Base::AbstractWriter> writer,
int versionMajor2save,
int versionMinor2save,
bool showProgress);
751 virtual std::vector<Core::DocObject*>
build_savemap(std::vector<std::string>& delete_log);
755 const std::vector<const Core::DocObject*>& objToCheck,
756 std::vector<std::pair<const Core::DocObject*, const Core::DocObject*>>* errors);
861 bool close(
bool dontNotify =
false);
863 void _cleanTempDirectory_Helper(
const Base::String& dir);
865 bool _saveFile(
Base::String saveFileName,
int versionMajor2save,
int versionMinor2save,
bool toExport,
bool saveBackupCopy,
bool notify =
true);
867 void _saveDocFiles(std::shared_ptr<Base::AbstractWriter> writer,
bool notify =
true);
868 bool _docWrite(std::shared_ptr<Base::AbstractWriter> mainwriter,
874 std::vector<Base::String> tempFilesToDelete);
875 void cleanOldTempDirectories();
876 void dispatchMsg(
const int aMsgId);
884 bool restoreDocuments(
int& docVersion,
int& appVersion);
887 QString m_importedIFCFile;
888 QDateTime _lastBackupFileTime;
889 int _backupFilesCounter = 0;
890 int _numOfExistBackupFiles = 0;
891 bool _onSaveChangeToDefaultUser =
false;
892 bool _saveBlocksUntilFinished =
false;
896 std::map<Base::String, Base::GlobalId_Policy> _guidPolicyMap;
897 std::map<Base::String, Base::String> _additionalFiles;
900 std::map<int, Transaction*> mUndoMap;
902 std::map<int, Transaction*> mRedoMap;
904 CoreDocumentImpl* _pimpl{};
917 mOldEnableTimeStamps = mDoc->__getEnableTimeStamps__();
918 mDoc->__setEnableTimeStamps__(
false);
923 mDoc->__setEnableTimeStamps__(mOldEnableTimeStamps);
926 bool mOldEnableTimeStamps =
true;
937 static std::map<std::string, Core::DocumentFactory*>
registry;
958 #define DECLARE_DOCUMENT_FACTORY(_factoryName_, _class_) \ 959 class _factoryName_ : public Core::DocumentFactory \ 962 virtual Core::CoreDocument* createByFactory() \ 964 Core::CoreDocument* doc = new _class_; \ 969 #define REGISTER_DOCUMENT_FACTORY(_factoryName_, _class_) Core::DocumentFactory::registry[#_class_] = (Core::DocumentFactory*)new _factoryName_(); std::vector< std::pair< Core::PropertyLinkBaseBase *, Core::DocObject * > > getInBackLinks(Core::DocObject *docObj)
void breakLinks(Core::DocObject *from)
RelGraph * _relGraph
Definition: CoreDocument.h:841
std::unordered_set< Core::DocObject * > ObjectSet
Definition: core_gt.h:58
Definition: CoreApplication.h:94
bool mSolvingEnabled
Definition: CoreDocument.h:851
std::string getDocXMLAsString()
Core::PropertyText createdBy
Definition: CoreDocument.h:255
void removeObject(Core::DocObject *e)
Removes an object from the document.
std::vector< const Core::DocObject * > getBackLinksByProperties(const Core::DocObject *source) const
virtual void checkBeforeObjectRestoring(int, int)
Is called before restoring objects of a document.
Definition: CoreDocument.h:763
std::string m_PropertyLinkName
Definition: CoreDocument.h:206
Core::DocObject * copyToDifferentType(Core::DocObject *o, Base::Type typeToCreate, DocObjectMap ©Map)
Creates an object of type 'typeToCreate' and copy properties from 'o' to it. Provides map of pairs or...
DocumentState _state
Definition: CoreDocument.h:829
boost::signals2::signal< void(const Core::DocObject &)> signalDeletedObject
signal on deleted Object
Definition: CoreDocument.h:435
Core::PropertyText projectNumber
Definition: CoreDocument.h:261
void onAddLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
std::map< Core::DocObject *, std::vector< std::string > > DOCOBJECTS_ERROR_MAP
Definition: CoreDocument.h:34
boost::signals2::signal< void(const Core::DocObject &, const Core::Property &)> signalChangedObject
signal on changed Object
Definition: CoreDocument.h:439
std::map< Base::GlobalId, Core::DocObject * > _guid_map
Definition: CoreDocument.h:845
bool restoreFileFromZip(const Base::String &entryName, const Base::String &targetpath, bool binaryMode)
Core::PropertyText compatibleInfo
Definition: CoreDocument.h:169
std::vector< Core::DocObject * > ObjectVector
Definition: core_gt.h:56
std::vector< const Core::DocObject * > getLinksByProperties(const Core::DocObject *o) const
std::map< long, Core::DocObject * > _ifcId_map
Definition: CoreDocument.h:846
void commitTransaction()
Commit the Command transaction. Do nothing If there is no Command transaction open.
bool checkObjectLinks(const std::vector< const Core::DocObject * > &objvec, std::vector< std::pair< const Core::DocObject *, const Core::DocObject * >> *errors=nullptr)
Checks the document for errors. Returns false if there is an error.
virtual std::vector< Core::DocObject * > build_savemap(std::vector< std::string > &delete_log)
Build a map of the objects that get saved. Objects that are marked for delete get removed.
Definition: Persistence.h:14
Core::DocObject::IdType getUniqueObjectIdFromInteger(size_t input) const
virtual void initDocument(bool)
Initialize document.. Can be overwritten to do some custom initialization.
Definition: CoreDocument.h:782
boost::signals2::signal< void()> signalBeforeRecompute
Signals before recompute.
Definition: CoreDocument.h:441
Definition: CoreDocument.h:156
T * addImmutableObject(Core::PropertyBundle< T > *po)
Definition: CoreDocument.h:483
std::vector< std::pair< Core::PropertyLinkBaseBase *, Core::DocObject * > > getInLinks(Core::DocObject *docObj)
FileOpened
Definition: CoreDocument.h:140
void forceBackupOnNextSave()
Modifies the _lastBackupFileTime to force backup when the document is saved next time.
Closing
Definition: CoreDocument.h:152
Definition: CoreDocument.h:161
Definition: CoreDocument.h:162
std::unordered_set< Core::ExecObject * > ExecObjectSet
Definition: CoreDocument.h:63
boost::signals2::signal< void(const std::vector< Core::DocObject * > &, const std::vector< Core::DocObject * > &, const std::vector< Core::DocObject * > &)> signalRecomputed
Signals NewObjects, UpdatedObjects, DeletedObjects being recomputed.
Definition: CoreDocument.h:443
virtual int restoreDocument(Base::XMLReader &reader, Core::Attachments &attachments)
Restores the document. Returns the doc version of the restored document.
std::vector< Core::DocObject * > getObjectsSorted() const
Returns all objects topologically sorted.
Definition: CoreDocument.h:163
size_t getRecomputeCount() const
get count of recomputes()
T * addImmutableObject_NoCheck(Core::PropertyBundle< T > *po)
Definition: CoreDocument.h:511
void onAddBackLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
std::string dumpGraph(void)
Returns a string representation of the graph.
AfterSave
Definition: CoreDocument.h:142
AddDirectoryPath
Definition: CoreDocument.h:144
Core::PropertyText name
Definition: CoreDocument.h:245
bool _needRestoreBeforeRecompute
Definition: CoreDocument.h:849
std::unordered_map< DocObject::IdType, Core::ExecObject * > ExecObjectMap
Definition: CoreDocument.h:64
Definition: PropertyContainer.h:107
void onRemoveBackLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
Core::DocObject * copyObject(Core::DocObject *o, DocObjectMap ©Map=DocObjectMap())
Creates a copy of 'o' and adds it to the document, provides map of pairs original-copy to see which o...
std::multimap< Base::String, Core::AttachmentEntry > Attachments
Definition: CoreDocument.h:73
Core::PropertyIndex application_mainversion
Definition: CoreDocument.h:251
std::vector< Core::DocObject * > NewObjects
Definition: CoreDocument.h:123
void _commitTransaction(bool notify=false)
Internally called by App::Application to commit the Command transaction.
void clearCopyType()
Sets the copy type to Base::Type::badType(), next copied object will be copied as its own type.
void removeBackLinkInProperties(const Core::DocObject *source, Core::DocObject *link)
Definition: PropertyBundle.h:16
virtual bool convertFromOlderVersions(int docVersion, int appVersion)
Core::PropertyText documentTypeName
Definition: CoreDocument.h:253
GUID_Conflict
Definition: CoreDocument.h:148
virtual Core::DocObject * restoreObject(const std::string &typeName, const std::string &typeHierarchy, const std::string &id)
Tries to restore an object from a given type name.
Definition: CoreDocument.h:164
bool askAndSetNewFilename(QString &newFilename, const Base::String &initialDir=Base::String())
Ask user for filename (if not already passed in as newFilename) and set it to document....
Definition: CoreDocument.h:160
Core::PropertyText name
Definition: CoreDocument.h:167
virtual void addInventorDirectory(const Base::String &)
Inventor search directories - needs to be stored for IV/Z export, but SoInput is not OK....
Definition: CoreDocument.h:653
void onAddBackLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
std::vector< const Core::DocObject * > getInner(const Core::DocObject *me, std::function< bool(const Core::DocObject *)> *allowToAddObject=0)
Get ALL Links to me, also indirect.
void clearUndos()
Remove all stored Undos and Redos.
std::vector< std::string > getAvailableUndoNames() const
Returns a list of the Undo names.
PriceCalculationChanged
Definition: CoreDocument.h:153
Core::CoreDocument * Document
Definition: CoreDocument.h:121
DocumentFactory()
Definition: CoreDocument.h:934
The PropertyGUID class saves and restores GUIDs. It also handles the management of GUIDs in the Docum...
Definition: PropertyGUID.h:24
Definition: CoreDocument.h:154
const ObjectTypeMap & getTypeMap() const
Definition: CoreDocument.h:159
Base::String FileName
Definition: CoreDocument.h:69
int openTransaction(const char *name=0)
void renameTransaction(const char *name, int id)
Rename the current transaction if the id matches.
DocumentTimeStampSentinel(Core::CoreDocument *aDoc)
Definition: CoreDocument.h:915
void onChangedProperty(const Core::DocObject *Who, const Property *What)
callback from the Document objects after property was changed
Definition: PropertyText.h:11
bool __getEnableTimeStamps__() const
void resetHasErrorObjectsInRecompute()
reset result of last recompute();
virtual void setChanged(bool changed)
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:23
void waitForSaveIsFinished()
Saving runs in Threads, wait for finish.
virtual void deleteObject(Core::DocObject *o)
Physically deletes an object without informing the object maps.
boost::signals2::signal< void(const std::map< Core::DocObject *, std::vector< std::string >> &)> signalRecomputedErrorObjects
Signals recomputed error DocObjects.
Definition: CoreDocument.h:447
Definition: CoreDocument.h:159
virtual bool saveAs(const Base::String &filename)
Saves the document under this name.
void restoreProperty(Core::Property *property, const Base::String &name, Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
LX_CORE_EXPORT Version & version
virtual Core::DocObject * addImmutableObjectMaterial(Core::PropertyContainer *pc)
why
Definition: CoreDocument.h:111
boost::signals2::signal< void(const std::vector< std::pair< const Core::DocObject *, const Core::DocObject * >> &)> signalDefectLinks
Signals defect links from object1 to object2.
Definition: CoreDocument.h:449
void setImportedIFCFile(QString a)
void getObjectsFromTypeMap(Base::Type t, std::vector< Core::DocObject * > &ret) const
Returns all objects of type 'T'.
Definition: CoreDocument.h:210
bool saveAsFile(const Base::String &filename=Base::String(), bool toExport=false, bool saveBackupCopy=false, const Base::String &initialDir=Base::String())
Saves a new file under this name.
std::vector< Core::DocObject * > UpdatedObjects
Definition: CoreDocument.h:124
void cleanTempDirectory()
Cleans the temporary directory.
std::vector< Core::DocObject * > DOCOBJECTS
Definition: CoreDocument.h:33
RecomputeFinished
Definition: CoreDocument.h:145
Core::DocObject * getObjectByUserName(const Base::String &s) const
Returns the object with this userName.
Base::Type m_SourcePropertyTypeID
Definition: CoreDocument.h:203
void getAllChildren(std::set< Type > &children) const
bool addObject(Core::DocObject *e)
Adds an existing object to the document.
void setNew()
Sets the status to 'New'.
virtual bool getPatchedUserTypes(const Base::String &filename, std::map< QString, QString > &id2TypeMap)
void setSaveBlocksUntilFinished(bool onoff)
If true, saving will block until the whole save is finished and file is ready.
void setUndoLimit(unsigned int UndoMemSize=0)
Set the Undo limit in Byte!
Core::PropertyText documentVersion
Definition: CoreDocument.h:246
bool getImmutableObjects(Base::Type t, ObjectSet &set) const
virtual void createGroundPlate_deprecated()
To overwrite. Deprecated, do not use.
Definition: CoreDocument.h:655
const ObjectMap & getObjectMap() const
Returns the object map.
virtual void restoreDirectory(const QString &)
Restores directory to temp.
Definition: CoreDocument.h:779
void setTransactionMode(int iMode)
switch the transaction mode
void onRemoveBackLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
boost::signals2::signal< void(Core::DocChanges &)> signalDocChanges
Signals DocChanges (To be removed)
Definition: CoreDocument.h:431
ObjectTypeMap _immutableObjectsMap
Definition: CoreDocument.h:835
std::vector< std::pair< Core::PropertyLinkBaseBase *, Core::DocObject * > > getOutBackLinks(Core::DocObject *docObj)
Core::CoreDocument * mDoc
Definition: CoreDocument.h:925
std::vector< std::string > check_graph()
Core::PropertyIndex documentMaxID
Definition: CoreDocument.h:250
const DocumentState & getDocumentState() const
Core::PropertyText filename
Definition: CoreDocument.h:254
std::vector< PropertyLinkDesc > getLinkDescByProperties(const Core::DocObject *o) const
~DocumentTimeStampSentinel()
Definition: CoreDocument.h:921
Definition: AbstractXMLReader.h:7
ObjectMap _all_objects_map
Definition: CoreDocument.h:831
virtual void onFileOpened()
Is called when the file was opened, but before the message FileOpened gets emitted....
Definition: CoreDocument.h:276
virtual void cleanUndoStack()
Cleans the undo stack. Must be overwritten.
Definition: CoreDocument.h:775
Definition: PropertyLinkBase.h:15
Core::DocObject * getImmutableObjectWithSameValues(Base::Type t, Core::PropertyContainer *pc) const
Returns the object that has the same values as 'pc'. Returns '0' if there is no such object.
std::vector< Core::DocObject * > getObjectsByTypeName(const std::string &typeName) const
Returns all objects of typeName.
void remove_GUID(const Base::GlobalId &guid, Core::DocObject *o)
Removes a guid without checking.
Core::PropertyIndex documentChanges
Definition: CoreDocument.h:249
Core::PropertyText company
Definition: CoreDocument.h:259
Status
Definition: CoreDocument.h:230
Definition: GlobalId.h:29
void setMaxUndoStackSize(unsigned int UndoMaxStackSize=20)
Set the Undo limit as stack size.
ErrorCanNotOpenFile
Definition: CoreDocument.h:146
DocChanges(Core::CoreDocument *doc)
Definition: CoreDocument.h:109
virtual bool maybeSave()
Can be overwritten to check if the undo stack is clean etc.
Definition: CoreDocument.h:612
Core::Variant Value
Definition: CoreDocument.h:120
std::vector< const Core::DocObject * > getBackLinksFromMe(const Core::DocObject *o)
Returns all objects 'o' directly linked from 'o'.
bool isPerformingTransaction() const
returns true if the document is in an Transaction phase, e.g. currently performing a redo/undo or rol...
std::map< Base::Type, ObjectSet > ObjectTypeMap
Definition: CoreDocument.h:65
QString getImportedIFCFile()
Core::PropertyText architect
Definition: CoreDocument.h:262
virtual Core::DocObject * getObjectById(const DocObject::IdType &id) const
Returns the object with this id.
Definition: Observer.h:16
std::string m_SourceDocObjectID
Definition: CoreDocument.h:201
Definition: CoreDocument.h:106
SaveStart
Definition: CoreDocument.h:151
Core::PropertyText filename
Definition: CoreDocument.h:176
BeforeSave
Definition: CoreDocument.h:141
virtual void checkAndConfigureOpenedDocumentAfterRecompute(int, int)
Is called when opening a document after recompute. Can be overwritten to do some custom check routine...
Definition: CoreDocument.h:767
void onRemoveLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
bool saveAsFileVersion(int aMajorVersion, int aMinorVersion, const Base::String &filename=Base::String(), bool toExport=false, bool saveBackupCopy=false, const Base::String &initialDir=Base::String(), bool dontRename=false)
Saves a new file under this name.
bool hasErrorObjectsInRecompute()
get result of last recompute
std::vector< Core::DocObject * > DeletedObjects
Definition: CoreDocument.h:125
Base::String Info
Definition: CoreDocument.h:71
bool getSaveBlocksUntilFinished() const
Returns whether saving will block until the whole save is finished and file is ready.
virtual void storeDirectory(const QString &, Base::AbstractWriter &)
Stores directory at given path to zip stream.
Definition: CoreDocument.h:777
T * createObject()
Definition: CoreDocument.h:471
boost::signals2::signal< void()> signalNewFile
Signals new file.
Definition: CoreDocument.h:451
bool testStatusBits(Status pos) const
return the status bits
Definition: CoreDocument.h:911
void emitAndNotify(Core::DocChanges &aDocChanges)
Definition: GlobalId_Policy.h:7
std::vector< Core::DocObject * > getObjectsToSave()
Returns all objects that will be saved in document. Basically interface for build_savemap().
size_t _recomputeCnt
Definition: CoreDocument.h:850
bool maybe_add_GUID(const Base::GlobalId &guid, Core::DocObject *o)
Adds a guid to the map IF this id is not in use yet.
void addPropertyLinkError(const std::string &from, const std::string &to)
std::vector< const Core::DocObject * > getBackLinksToMe(const Core::DocObject *o)
Returns all objects that directly linked to 'o'.
std::set< Core::DocObject * > _references
Definition: CoreDocument.h:844
unsigned int getMaxUndoStackSize(void) const
Set the Undo limit as stack size.
bool createBackupFile(const Base::String &path, bool savePath)
Definition: CoreDocument.h:945
PropertyLinkDesc(const PropertyLinkDesc &rhs)
Definition: CoreDocument.h:191
RelGraph * _relGraphBackLink
Definition: CoreDocument.h:842
void createTempDirectory()
Creates the temporary directory.
const int LEXOCAD_CORE_MSGID
Definition: CoreDocument.h:133
int getUndoMode(void) const
switch the level of Undo/Redo
Base::String getTmpDirectory()
Returns the temporary directory.
virtual DocObject * shallowCopy(Core::CoreDocument *toDoc)
std::vector< const Core::DocObject * > getOuter(const Core::DocObject *me)
Get ALL Links from me, also indirect.
bool isTransactionEmpty() const
Definition: CoreDocument.h:158
Definition: GlobalAttachment.h:10
friend class DocumentTimeStampSentinel
Definition: CoreDocument.h:141
int getTransactionID(bool undo, unsigned pos=0) const
Return the undo/redo transaction ID starting from the back.
void removeObjectFinal(Core::DocObject *e, bool deep=false)
Removes an object from the document.
bool addFileToZip(const Base::String &entryName, const Base::String &path)
Import
Definition: CoreDocument.h:150
void add_GUID(const Base::GlobalId &guid, Core::DocObject *o)
Adds a guid without checking.
int getDocumentVersion() const
Returns the version of the document.
~DocumentFactory()
Definition: CoreDocument.h:935
virtual bool renameTypeFromOlderVersions(int, Base::String &)
Definition: CoreDocument.h:761
Definition: CoreDocument.h:157
virtual void setStatus(Status status)
Core::CoreDocument Core::PropertyContainer, Base::Subject recompute(std::function< void(DOCOBJECTS newObj, DOCOBJECTS updatedObj, DOCOBJECTS deletedObj, DOCOBJECTS_ERROR_MAP errorObj)> onRecomputedCB)
std::string IdType
Definition: DocObject.h:69
Definition: CoreDocument.h:155
void addReferenceFrom(Core::DocObject *from)
virtual bool isChanged()
Returns 'true' if the document is changed.
std::vector< T * > getObjectsByType() const
Return all object of given type and all derived classes.
Definition: CoreDocument.h:533
std::map< Core::DocObject *, std::vector< std::string > > ErroneousObjects
Definition: CoreDocument.h:126
bool undo(int id=0)
Will UNDO one step, returns False if no undo was done (Undos == 0).
const std::set< Core::DocObject * > & getReferences() const
boost::signals2::signal< void()> signalRecomputeError
Signals a recompute error.
Definition: CoreDocument.h:445
std::vector< std::pair< Core::PropertyLinkBaseBase *, Core::DocObject * > > getOutLinks(Core::DocObject *docObj)
Core::DocObject * createObjectFromType(Base::Type type)
Creates an object from type and adds it to the document.
int _openTransaction(const char *name=0, int id=0)
bool isCatalogFile() const
Returns true if this document's file is part of catalog.
Core::PropertyText documentGUID
Definition: CoreDocument.h:248
std::vector< const Core::DocObject * > getObjectsConst(bool includeDeletedObjects=false) const
Definition: CoreDocument.h:67
void onAddLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
Export
Definition: CoreDocument.h:149
Core::PropertyText comment
Definition: CoreDocument.h:260
void abortTransaction()
Abort the actually running transaction.
void _abortTransaction()
Internally called by App::Application to abort the running transaction.
Core::DocObject * copySharedObject(Core::DocObject *o, DocObjectMap ©Map)
Copy shared object. This is violating of the share, but in some cases this is useful....
bool hasReferencesFrom(Core::DocObject *from) const
ObjectVector _all_objects_vector
Definition: CoreDocument.h:833
Type copyObjectShallow(Type o)
Creates a copy of 'o' and adds it to the document. Performs shallow copy.
Definition: CoreDocument.h:298
bool _hasErrorObjectsInRecompute
Definition: CoreDocument.h:848
void onBeforeChangeProperty(const Core::DocObject *Who, const Property *What)
callback from the Document objects before property will be changed
NewFile
Definition: CoreDocument.h:139
Definition: CoreDocument.h:114
Base::String fileName
Definition: CoreDocument.h:264
Core::DocObject::IdType getUniqueObjectId() const
Returns the next available unique id.
std::unordered_map< DocObject::IdType, Core::DocObject * > ObjectMap
Definition: CoreDocument.h:61
Definition: CoreDocument.h:179
void setGuidPolicy(const Base::GlobalId_Policy &policy)
Sets the default GUID policy. This determines what should be done if identical GUIDs are imported.
bool isActive() const
Returns 'true' if the Document is the active Document. Otherwise returns 'false'.
std::string m_SourcePropertyName
Definition: CoreDocument.h:202
Definition: GraphBuilder.h:138
Core::DocObject * createObjectFromTypeName(const char *typeName)
Creates an object from type name and adds it to the document.
void addNewObjectsToGraph()
Adds objects with status 'New' to the graph.
static const Type badType(void)
Definition: Type.h:99
Core::PropertyIndex application_minorversion
Definition: CoreDocument.h:252
bool saveFile(bool toExport=false, bool saveBackupCopy=false)
Saves the file.
void _checkTransaction(Core::DocObject *pcDelObj, const Property *What, int line)
checks if a valid transaction is open
void addToDocumentMaps(Core::DocObject *o)
Adds the object to all relevant maps.
Definition: Property.h:77
virtual void initDocObject()
std::vector< std::string > getAvailableRedoNames() const
Returns a list of the Redo names.
Base::String FeatName
Definition: CoreDocument.h:70
bool redo(int id=0)
Will REDO one step, returns False if no redo was done (Redos == 0).
virtual const char * subject_name(void)
Definition: CoreDocument.h:673
std::string m_TargetDocObjectID
Definition: CoreDocument.h:205
void __setEnableTimeStamps__(bool aOnOff)
std::vector< const Core::DocObject * > getLinksFromMe(const Core::DocObject *o)
Returns all objects 'o' directly linked from 'o'.
bool getOnSaveChangeToDefaultUser() const
Return whether the user get changed to default user on next save.
bool createBackupFileAfterOpeningDoc(const Base::String &path, bool savePath)
void onRemoveLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
void setStatusBits(Status pos, bool on)
set the status bits
ObjectGraph * _graph
Definition: CoreDocument.h:837
boost::signals2::signal< void(const Core::DocObject &)> signalNewObject
signal on new Object
Definition: CoreDocument.h:433
std::vector< Core::DocObject * > getObjects(bool includeDeletedObjects=false) const
Returns all objects in the document.
void setUndoMode(int iMode)
switch the level of Undo/Redo
void setDocument(Core::CoreDocument *doc)
Sets the CoreDocument of this DocObject.
CleanAll
Definition: CoreDocument.h:143
Base::GlobalId_Policy getGuidPolicy() const
Returns the default GUID policy.
friend class CoreApplication
Definition: CoreDocument.h:138
Definition: PropertyInteger.h:150
static std::map< std::string, Core::DocumentFactory * > registry
Definition: CoreDocument.h:937
std::vector< const Core::DocObject * > getLinksToMe(const Core::DocObject *o)
Returns all objects that directly linked to 'o'.
RecomputeError
Definition: CoreDocument.h:137
Base::String fileName
Definition: CoreDocument.h:186
Base::Type getCopyType() const
Definition: CoreDocument.h:113
Rename
Definition: CoreDocument.h:138
bool saveCopy(const Base::String &filename)
Saves a copy of the current document, no notify, only store the doc under this name.
virtual bool onChangedDebug(Core::DocObject *o, Core::Property *p)
void setFullFileName(const Base::String &fullfilename)
Sets the full file name including the path.
std::map< Core::DocObject *, Core::DocObject * > DocObjectMap
Definition: DocObject.h:10
Core::DocObject * getObjectByGlobalId(const Base::GlobalId &guid) const
Returns the DocObject with this GUID.
bool checkDeletedObjectLinks(const std::vector< const Core::DocObject * > &objToCheck, std::vector< std::pair< const Core::DocObject *, const Core::DocObject * >> *errors)
virtual void checkAndConfigureOpenedDocument()
Is called when opening a document. Can be overwritten to do some custom check routines.
Definition: CoreDocument.h:765
int getAvailableUndos(int id=0) const
Returns the number of stored Undos. If greater than 0 Undo will be effective.
Definition: CoreDocument.h:930
Definition: GraphBuilder.h:52
void removeReferenceFrom(Core::DocObject *from)
Status
Definition: CoreDocument.h:152
void resolveLinkInDocument(Core::PropertyLinkBase *link)
After opening a document this method restores the links declared in the document header.
Core::PropertyText lastModifiedDate
Definition: CoreDocument.h:258
auto onRecomputedCB
Definition: CoreDocument.h:247
std::vector< Core::ExecObject * > ExecObjectVector
Definition: CoreDocument.h:62
boost::signals2::signal< void(const Core::DocObject &, const Core::Property &)> signalBeforeChangeObject
signal before changing an Object
Definition: CoreDocument.h:437
virtual bool restoreGlobalAttachment(Base::GlobalAttachment *gAtta, std::istream *, uint64_t streamsize, const Base::String &entryName)
Core::PropertyText lastModifiedBy
Definition: CoreDocument.h:257
Definition: DocObject.h:51
void setOnSaveChangeToDefaultUser(bool onoff)
If true: Change to default user on next change. Usually from IFC User to Lexocad User.
Core::PropertyText creationDate
Definition: CoreDocument.h:256
friend class PropertyGUID
Definition: CoreDocument.h:140
ChangeToDefaultUser
Definition: CoreDocument.h:147
int getAvailableRedos(int id=0) const
Returns the number of stored Redos. If greater than 0 Redo will be effective.
ObjectTypeMap _typeObjects
Definition: CoreDocument.h:839
bool hasPendingTransaction() const
Check if a transaction is open.
virtual void saveDocument(std::shared_ptr< Base::AbstractWriter > writer, int versionMajor2save, int versionMinor2save, bool showProgress)
Saves the document.
void removeLinkInProperties(const Core::DocObject *source, Core::DocObject *link)