Go to the documentation of this file.
12 #include <boost/signals2/signal.hpp>
15 #define DIR_NAME_INTERNAL_CATALOG "__internalCatalog__"
16 #define DIR_NAME_WEBGL_GT "webgl"
17 #define DIR_NAME_GEOID "geoid"
18 #define DIR_NAME_BCF "Bcf"
19 #define FILE_NAME_CAMERA_ANIMATION "CameraAnimation.ivc"
27 class GlobalAttachment;
39 class PropertyLinkBase;
40 class CoreDocumentImpl;
43 class PropertyLinkBaseBase;
46 typedef std::unordered_set<Core::DocObject*>
ObjectSet;
47 typedef std::unordered_map<DocObject::IdType, Core::DocObject*>
ObjectMap;
50 typedef std::unordered_map<DocObject::IdType, Core::ExecObject*>
ExecObjectMap;
54 class LX_CORE_EXPORT
Link :
public std::vector<std::pair<Core::PropertyLinkBaseBase*,Core::DocObject*>>
85 typedef std::multimap<Base::String, Core::AttachmentEntry>
Attachments;
132 if (Why != RECOMPUTED)
return true;
137 if (!NewObjects.empty() || !DeletedObjects.empty())
140 for (
auto lObj : UpdatedObjects)
142 if (lObj->mustNotify())
153 for (
auto lObj : UpdatedObjects)
155 if (lObj->hasVisiblityChanged())
157 aDocObjects.emplace_back(lObj);
160 return (
bool)aDocObjects.size();
165 for (
auto lObj : UpdatedObjects)
167 if (!lObj->hasOnlyVisibilityChanged())
176 std::string MsgName =
"";
193 enum LX_CORE_EXPORT DocMessage
239 PropertyLinkDesc(std::string sourceDocObjectID, std::string sourcePropertyName,
Base::Type sourcePropertyTypeID, std::string targetDocObjectID,std::string propertyLinkName)
240 : m_SourceDocObjectID(sourceDocObjectID)
241 , m_SourcePropertyName(sourcePropertyName)
242 , m_SourcePropertyTypeID(sourcePropertyTypeID)
243 , m_TargetDocObjectID(targetDocObjectID)
244 , m_PropertyLinkName(propertyLinkName)
278 friend class ::App::ElementTool;
291 KeepTrailingDigits = 1,
298 AllowPartialRecompute = 8,
358 template <
typename Type>
362 assert(copy &&
"Document::copyObjectShallow could not copy object");
367 Type typedCopy =
dynamic_cast<Type
>(copy);
368 assert(typedCopy &&
"Document::copyObjectShallow could not cast object");
374 std::vector<Core::DocObject*>
getObjects(
bool includeDeletedObjects =
false)
const;
375 std::vector<const Core::DocObject*>
getObjectsConst(
bool includeDeletedObjects =
false)
const;
428 void setUndoMode(
int iMode);
510 boost::signals2::signal<void(
const std::vector<Core::DocObject*>&,
const std::vector<Core::DocObject*>&,
const std::vector<Core::DocObject*>&)>
signalRecomputed;
537 template <
typename T>
542 return static_cast<T*
>(o);
549 template <
typename T>
553 if (T::isMutableStatic())
557 Core::DocObject* check = getImmutableObjectWithSameValues(T::getClassTypeId(), po);
559 return static_cast<T*
>(check);
566 o->_setPropertyValues(po,
true);
568 addImmutableObjectMaterial(o);
569 return static_cast<T*
>(o);
577 template <
typename T>
581 if (T::isMutableStatic())
589 o->_setPropertyValues(po,
true);
591 addImmutableObjectMaterial(o);
592 return static_cast<T*
>(o);
599 template <
typename T>
604 std::set<Base::Type> typeset;
608 std::vector<T*> returnObjs{};
609 for (
const auto& type : typeset)
611 auto type2objects = getTypeMap().find(type);
612 if (type2objects == getTypeMap().end())
615 const auto& docObjects = type2objects->second;
616 for (
const auto& obj : docObjects)
618 if (!obj->isDeleted())
619 returnObjs.push_back(
static_cast<T*
>(obj));
627 template <
typename T>
630 const auto& objectMap = getObjectMap();
631 for (
const auto& it : objectMap)
633 if (!it.second->isDeleted() && it.second->isDerivedFrom<T>())
634 objs.push_back((T*)it.second);
646 std::vector<Core::LinkError>* errors =
nullptr);
648 const std::vector<const Core::DocObject*>& objToCheck,
649 std::vector<Core::LinkError>* errors=
nullptr);
651 std::vector<Core::LinkError>* errors);
656 const std::vector<const Core::DocObject*>& objToCheck,
657 std::vector<Core::LinkError>* errors);
698 bool saveFile(
bool toExport =
false,
bool saveBackupCopy =
false);
701 bool toExport =
false,
702 bool saveBackupCopy =
false,
711 bool toExport =
false,
712 bool saveBackupCopy =
false,
714 bool dontRename =
false);
824 virtual void saveDocument(std::shared_ptr<Base::AbstractWriter> writer,
int versionMajor2save,
int versionMinor2save,
bool showProgress);
828 virtual std::vector<Core::DocObject*>
build_savemap(std::vector<std::string>& delete_log);
923 bool _hasErrorObjectsInRecompute =
false;
924 bool _needRestoreBeforeRecompute =
false;
925 size_t _recomputeCnt = 0;
926 bool mSolvingEnabled =
true;
931 bool openFile(
const Base::String& filename,
bool savePath =
true);
936 bool close(
bool dontNotify =
false);
938 void _cleanTempDirectory_Helper(
const Base::String& dir);
940 bool _saveFile(
Base::String saveFileName,
int versionMajor2save,
int versionMinor2save,
bool toExport,
bool saveBackupCopy,
bool notify =
true);
942 void _saveDocFiles(std::shared_ptr<Base::AbstractWriter> writer,
bool notify =
true);
943 bool _docWrite(std::shared_ptr<Base::AbstractWriter> mainwriter,
949 std::vector<Base::String> tempFilesToDelete);
950 void cleanOldTempDirectories();
951 void dispatchMsg(
const int aMsgId);
959 bool restoreDocuments(
int& docVersion,
int& appVersion);
962 QString m_importedIFCFile;
963 QDateTime _lastBackupFileTime;
964 int _backupFilesCounter = 0;
965 int _numOfExistBackupFiles = 0;
966 bool _onSaveChangeToDefaultUser =
false;
967 bool _saveBlocksUntilFinished =
false;
971 std::map<Base::String, Base::GlobalId_Policy> _guidPolicyMap;
972 std::map<Base::String, Base::String> _additionalFiles;
974 std::list<Transaction*> mUndoTransactions;
975 std::map<int, Transaction*> mUndoMap;
976 std::list<Transaction*> mRedoTransactions;
977 std::map<int, Transaction*> mRedoMap;
979 CoreDocumentImpl* _pimpl{};
992 mOldEnableTimeStamps = mDoc->__getEnableTimeStamps__();
993 mDoc->__setEnableTimeStamps__(
false);
998 mDoc->__setEnableTimeStamps__(mOldEnableTimeStamps);
1001 bool mOldEnableTimeStamps =
true;
1012 static std::map<std::string, Core::DocumentFactory*>
registry;
1033 #define DECLARE_DOCUMENT_FACTORY(_factoryName_, _class_) \
1034 class _factoryName_ : public Core::DocumentFactory \
1037 virtual Core::CoreDocument* createByFactory() \
1039 Core::CoreDocument* doc = new _class_; \
1044 #define REGISTER_DOCUMENT_FACTORY(_factoryName_, _class_) Core::DocumentFactory::registry[#_class_] = (Core::DocumentFactory*)new _factoryName_();
Definition: GlobalId_Policy.h:7
virtual bool maybeSave()
Can be overwritten to check if the undo stack is clean etc.
Definition: CoreDocument.h:686
bool __getEnableTimeStamps__() const
std::string m_PropertyLinkName
Definition: CoreDocument.h:264
const int LEXOCAD_CORE_MSGID
Definition: CoreDocument.h:191
void removeLinkInProperties(const Core::DocObject *source, Core::DocObject *link)
std::unordered_set< Core::ExecObject * > ExecObjectSet
Definition: CoreDocument.h:49
virtual void initDocument(bool)
Initialize document.. Can be overwritten to do some custom initialization.
Definition: CoreDocument.h:857
std::vector< std::string > PropertyErrors
Definition: CoreDocument.h:229
bool isPerformingTransaction() const
returns true if the document is in an Transaction phase, e.g. currently performing a redo/undo or rol...
void removeBackLinkInProperties(const Core::DocObject *source, Core::DocObject *link)
void onAddBackLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
Core::PropertyText creationDate
Definition: CoreDocument.h:314
LinkStore(Core::DocObject *s, Core::PropertyLinkBaseBase *p, Core::DocObject *t)
Definition: CoreDocument.h:72
std::vector< T * > getObjectsByType() const
Return all object of given type and all derived classes.
Definition: CoreDocument.h:600
bool replaceLink(Core::DocObject *old, Core::DocObject *newLink)
static const Type badType(void)
Definition: Type.h:97
Core::PropertyText compatibleInfo
Definition: CoreDocument.h:305
static std::pair< int, int > getAppVersionFromDocument(Base::String filename)
GUID_Conflict
Definition: CoreDocument.h:206
virtual bool restoreGlobalAttachment(Base::GlobalAttachment *gAtta, std::istream *, uint64_t streamsize, const Base::String &entryName)
Core::PropertyIndex application_mainversion
Definition: CoreDocument.h:309
Core::DocObject * copyObject(Core::DocObject *o, DocObjectMap ©Map)
Creates a copy of 'o' and adds it to the document, provides map of pairs original-copy to see which o...
bool saveCopy(const Base::String &filename)
Saves a copy of the current document, no notify, only store the doc under this name.
Definition: CoreDocument.h:269
Core::DocObject * copyObject(Core::DocObject *o)
void setMaxUndoStackSize(unsigned int UndoMaxStackSize=20)
Set the Undo limit as stack size.
void setOnSaveChangeToDefaultUser(bool onoff)
If true: Change to default user on next change. Usually from IFC User to Lexocad User.
bool createBackupFile(const Base::String &path, bool savePath)
Core::DocObject * getObjectByUserName(const Base::String &s) const
Returns the object with this userName.
Rename
Definition: CoreDocument.h:196
std::map< long, Core::DocObject * > _ifcId_map
Definition: CoreDocument.h:921
std::vector< std::string > getAvailableUndoNames() const
Returns a list of the Undo names.
virtual Core::CoreDocument * createByFactory()=0
why
Definition: CoreDocument.h:124
CleanAll
Definition: CoreDocument.h:201
virtual void addNewObjectsToGraph()
Adds objects with status 'New' to the graph.
virtual void deleteObject(Core::DocObject *o)
Physically deletes an object without informing the object maps.
virtual void setStatus(Status status)
bool mustNotify() const
Definition: CoreDocument.h:130
void onChangedProperty(const Core::DocObject *Who, const Property *What)
callback from the Document objects after property was changed
boost::signals2::signal< void(const Core::DocObject &)> signalNewObject
signal on new Object
Definition: CoreDocument.h:498
unsigned long LastRecomputeTime
Definition: CoreDocument.h:231
Definition: PropertyLinkBaseBase.h:8
Export
Definition: CoreDocument.h:207
ObjectTypeMap _typeObjects
Definition: CoreDocument.h:914
void getAllChildren(std::set< Type > &children) const
ErrorCanNotOpenFile
Definition: CoreDocument.h:204
Core::PropertyText projectNumber
Definition: CoreDocument.h:319
void _abortTransaction()
Internally called by App::Application to abort the running transaction.
boost::signals2::signal< void()> signalBeforeRecompute
Signals before recompute.
Definition: CoreDocument.h:508
Base::Type getCopyType() const
std::vector< Core::DocObject * > NewObjects
Definition: CoreDocument.h:181
Core::PropertyLinkBaseBase * property
Definition: CoreDocument.h:75
bool createBackupFileAfterOpeningDoc(const Base::String &path, bool savePath)
void waitForSaveIsFinished()
Saving runs in Threads, wait for finish.
void removeObject(Core::DocObject *e)
Removes an object from the document.
bool checkDeletedObjectLinks(const std::vector< const Core::DocObject * > &objvec, const std::vector< const Core::DocObject * > &objToCheck, std::vector< Core::LinkError > *errors)
Base::GlobalId_Policy getGuidPolicy() const
Returns the default GUID policy.
Definition: GlobalId.h:28
virtual Core::DocObject * addImmutableObjectMaterial(Core::PropertyContainer *pc)
std::map< Core::DocObject *, std::vector< std::string > > ErroneousObjects
Definition: CoreDocument.h:184
unsigned int getMaxUndoStackSize(void) const
Set the Undo limit as stack size.
virtual bool convertFromOlderVersions(int docVersion, int appVersion)
std::vector< const Core::DocObject * > getBackLinksByProperties(const Core::DocObject *source) const
std::map< Core::DocObject *, Core::DocObject * > DocObjectMap
Definition: DocObject.h:50
DocumentState _state
Definition: CoreDocument.h:904
RecomputeFinished
Definition: CoreDocument.h:203
Core::DocObject * createObjectFromType(Base::Type type)
Creates an object from type and adds it to the document.
DocumentTimeStampSentinel()=delete
void clearUndos()
Remove all stored Undos and Redos.
bool hasErrorObjectsInRecompute()
get result of last recompute
bool isTransactionEmpty() const
const ObjectTypeMap & getTypeMap() const
bool hasOnlyVisibilityChanges() const
Definition: CoreDocument.h:163
Core::DocObject * source
Definition: CoreDocument.h:73
virtual void storeDirectory(const QString &, Base::AbstractWriter &)
Stores directory at given path to zip stream.
Definition: CoreDocument.h:852
DocChanges(Core::CoreDocument *doc)
Definition: CoreDocument.h:121
void __setEnableTimeStamps__(bool aOnOff)
bool getOnSaveChangeToDefaultUser() const
Return whether the user get changed to default user on next save.
std::unordered_map< DocObject::IdType, Core::ExecObject * > ExecObjectMap
Definition: CoreDocument.h:50
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.
std::set< Core::DocObject * > _references
Definition: CoreDocument.h:919
bool addObject(Core::DocObject *e)
Adds an existing object to the document.
void setStatusBits(Status pos, bool on)
set the status bits
Core::DocObject * createObjectFromTypeName(const char *typeName)
Creates an object from type name and adds it to the document.
std::vector< Core::DocObject * > getObjects(bool includeDeletedObjects=false) const
Returns all objects in the document.
void getObjectsByType(std::vector< T * > &objs) const
Returns all objects of type 'T'.
Definition: CoreDocument.h:628
Definition: CoreDocument.h:238
bool isActive() const
Returns 'true' if the Document is the active Document. Otherwise returns 'false'.
Core::PropertyText documentTypeName
Definition: CoreDocument.h:311
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.
@ MESSAGE_BY_NAME
Definition: CoreDocument.h:126
virtual std::vector< const Core::DocObject * > getBackLinksToMe(const Core::DocObject *o)
Returns all objects that directly linked to 'o'.
Definition: PropertyLinkBase.h:15
virtual void onFileOpened()
Is called when the file was opened, but before the message FileOpened gets emitted....
Definition: CoreDocument.h:336
virtual void checkBeforeObjectRestoring(int, int)
Is called before restoring objects of a document.
Definition: CoreDocument.h:838
void onRemoveBackLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
Core::DocObject::IdType getUniqueObjectId() const
Returns the next available unique id.
bool getGuidPolicy(const Base::String &suffix, Base::GlobalId_Policy &policy) const
Returns the GUID policy for a file suffix.
static void getPreviousVersionToSave(int &aMajorVersion, int &aMinorVersion)
Returns application's mainversion to be saved in the document saved as PREVIOUS version.
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:842
~DocumentFactory()
Definition: CoreDocument.h:1010
virtual void addToDocumentMaps(Core::DocObject *o)
Adds the object to all relevant maps.
Base::Type m_SourcePropertyTypeID
Definition: CoreDocument.h:261
std::vector< Core::DocObject * > getObjectsByTypeName(const std::string &typeName) const
Returns all objects of typeName.
virtual bool saveAs(const Base::String &filename)
Saves the document under this name*.
BeforeSave
Definition: CoreDocument.h:199
std::vector< std::string > getAvailableRedoNames() const
Returns a list of the Redo names.
std::map< Base::Type, ObjectSet > ObjectTypeMap
Definition: CoreDocument.h:51
void setFullFileName(const Base::String &fullfilename)
Sets the full file name including the path.
std::vector< PropertyLinkDesc > getLinkDescByProperties(const Core::DocObject *o) const
Core::PropertyText documentVersion
Definition: CoreDocument.h:304
std::string dumpGraph(void)
Returns a string representation of the graph.
virtual void emitAndNotify(Core::DocChanges &aDocChanges)
Core::PropertyText name
Definition: CoreDocument.h:303
void onRemoveLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
Definition: PropertyContainer.h:93
Core::DocObject * copySharedObject(Core::DocObject *o, DocObjectMap ©Map)
Copy shared object. This is violating of the share, but in some cases this is useful....
int _openTransaction(const char *name=0, int id=0)
std::multimap< Base::String, Core::AttachmentEntry > Attachments
Definition: CoreDocument.h:85
virtual bool onChangedDebug(Core::DocObject *o, Core::Property *p)
bool hasVisibilityChanges(std::vector< Core::DocObject * > &aDocObjects) const
Definition: CoreDocument.h:151
bool getImmutableObjects(Base::Type t, ObjectSet &set) const
void onAddBackLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
boost::signals2::signal< void()> signalNewFile
Signals new file.
Definition: CoreDocument.h:518
Core::PropertyText filename
Definition: CoreDocument.h:312
void getObjectsFromTypeMap(Base::Type t, std::vector< Core::DocObject * > &ret) const
Returns all objects of type 'T'.
int openTransaction(const char *name=0)
Definition: DocObject.h:54
RelGraph * _relGraph
Definition: CoreDocument.h:916
void onBeforeChangeProperty(const Core::DocObject *Who, const Property *What)
callback from the Document objects before property will be changed
void addReferenceFrom(Core::DocObject *from)
std::vector< Core::DocObject * > DeletedObjects
Definition: CoreDocument.h:183
boost::signals2::signal< void(const Core::DocObject &)> signalDeletedObject
signal on deleted Object
Definition: CoreDocument.h:500
bool restoreFileFromZip(const Base::String &entryName, const Base::String &targetpath, bool binaryMode)
Definition: CoreDocument.h:1006
Base::String getTmpDirectory()
Returns the temporary directory.
~DocumentTimeStampSentinel()
Definition: CoreDocument.h:996
void onRemoveLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
Status
Definition: CoreDocument.h:289
std::vector< const Core::DocObject * > getObjectsConst(bool includeDeletedObjects=false) const
Definition: Persistence.h:13
Core::Link getOutLinks(Core::DocObject *docObj)
int getUndoMode(void) const
switch the level of Undo/Redo
std::string m_SourceDocObjectID
Definition: CoreDocument.h:259
std::map< Core::DocObject *, std::vector< std::string > > DOCOBJECTS_ERROR_MAP
Definition: CoreDocument.h:22
static std::map< std::string, Core::DocumentFactory * > registry
Definition: CoreDocument.h:1012
void removeObjects(const std::vector< Core::DocObject * > &objects)
Removes objects from the document.
Definition: CoreDocument.h:218
bool checkDeletedObjectLinks(const std::vector< const Core::DocObject * > &objToCheck, std::vector< Core::LinkError > *errors)
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.
@ RECOMPUTED
Definition: CoreDocument.h:125
virtual std::vector< const Core::DocObject * > getOuter(const Core::DocObject *me)
Get ALL Links from me, also indirect.
void setRecommendFileNameForSave(const Base::String &s)
Core::PropertyIndex documentMaxID
Definition: CoreDocument.h:308
virtual bool isChanged()
Returns 'true' if the document is changed.
Core::Link getInLinks(Core::DocObject *docObj)
virtual void cleanUndoStack()
Cleans the undo stack. Must be overwritten.
Definition: CoreDocument.h:850
void onAddLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
void renameTransaction(const char *name, int id)
Rename the current transaction if the id matches.
virtual void createGroundPlate_deprecated()
To overwrite. Deprecated, do not use.
Definition: CoreDocument.h:729
std::vector< Core::DocObject * > UpdatedObjects
Definition: CoreDocument.h:182
std::vector< Core::DocObject * > ObjectVector
Definition: core_types.h:57
const char * getPendingTransactionName() const
Returns pending transaction name. Returns nullptr if there is no pending transaction.
virtual void checkAndConfigureOpenedDocument()
Is called when opening a document. Can be overwritten to do some custom check routines.
Definition: CoreDocument.h:840
#define LX_NODE_HEADER()
Definition: PropertyMacros.h:7
int getDocumentVersion() const
Returns the version of the document.
static Core::CoreDocument * create(const std::string &type)
Base::String Info
Definition: CoreDocument.h:83
ObjectMap _all_objects_map
Definition: CoreDocument.h:906
Core::PropertyIndex documentChanges
Definition: CoreDocument.h:307
void setSaveBlocksUntilFinished(bool onoff)
If true, saving will block until the whole save is finished and file is ready.
PropertyLinkDesc(std::string sourceDocObjectID, std::string sourcePropertyName, Base::Type sourcePropertyTypeID, std::string targetDocObjectID, std::string propertyLinkName)
Definition: CoreDocument.h:239
Core::PropertyText company
Definition: CoreDocument.h:317
void forceBackupOnNextSave()
Modifies the _lastBackupFileTime to force backup when the document is saved next time.
boost::signals2::signal< void(const Core::DocObject &, const Core::Property &)> signalChangedObject
signal on changed Object
Definition: CoreDocument.h:506
bool isCatalogFile() const
Returns true if this document's file is part of catalog.
void clearCopyType()
Sets the copy type to Base::Type::badType(), next copied object will be copied as its own type.
virtual void initDocObject()
std::vector< const Core::DocObject * > getLinksByProperties(const Core::DocObject *o) const
Base::String FeatName
Definition: CoreDocument.h:82
int getAvailableRedos(int id=0) const
Returns the number of stored Redos. If greater than 0 Redo will be effective.
Core::PropertyText comment
Definition: CoreDocument.h:318
void onAddLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
Definition: CoreApplication.h:71
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...
FileOpened
Definition: CoreDocument.h:198
Closing
Definition: CoreDocument.h:210
ChangeToDefaultUser
Definition: CoreDocument.h:205
ObjectVector _all_objects_vector
Definition: CoreDocument.h:908
Definition: AbstractXMLReader.h:7
std::string getDocXMLAsString()
void breakLinks(Core::DocObject *from)
virtual std::vector< std::string > check_graph()
void cleanTempDirectory()
Cleans the temporary directory.
T * addImmutableObject(const Core::PropertyBundle< T > *po)
Definition: CoreDocument.h:550
std::unordered_set< Core::DocObject * > ObjectSet
Definition: core_types.h:59
DocumentFactory()
Definition: CoreDocument.h:1009
std::vector< Core::DocObject * > DOCOBJECTS
Definition: CoreDocument.h:21
Core::Variant Value
Definition: CoreDocument.h:178
Definition: PropertyText.h:8
virtual bool getPatchedUserTypes(const Base::String &filename, std::map< QString, QString > &id2TypeMap)
virtual Core::DocObject * getObjectById(const DocObject::IdType &id) const
Returns the object with this id.
void setGuidPolicy(const Base::GlobalId_Policy &policy)
Sets the default GUID policy. This determines what should be done if identical GUIDs are imported.
Core::DocObject * getImmutableObjectWithSameValues(Base::Type t, const Core::PropertyContainer *pc) const
Returns the object that has the same values as 'pc'. Returns '0' if there is no such object.
bool undo(int id=0)
Will UNDO one step, returns False if no undo was done (Undos == 0).
Core::Link getOutBackLinks(Core::DocObject *docObj)
void onRemoveBackLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::unordered_set< Core::DocObject * > &linkSet)
Core::PropertyIndex application_minorversion
Definition: CoreDocument.h:310
PropertyLinkDesc(const PropertyLinkDesc &rhs)
Definition: CoreDocument.h:249
void setImportedIFCFile(QString a)
boost::signals2::signal< void(const Core::DocObject &, const Core::Property &)> signalBeforeChangeObject
signal on visibility changed Object
Definition: CoreDocument.h:504
Definition: CoreDocument.h:80
Core::PropertyText architect
Definition: CoreDocument.h:320
Definition: CoreDocument.h:119
void remove_GUID(const Base::GlobalId &guid, Core::DocObject *o)
Removes a guid without checking.
static QString getPreviousVersionToSaveStr()
Returns application's version as string to be displayed in the menu for action Save as PREVIOUS versi...
void add_GUID(const Base::GlobalId &guid, Core::DocObject *o)
Adds a guid without checking.
PriceCalculationChanged
Definition: CoreDocument.h:211
size_t getRecomputeCount() const
get count of recomputes()
bool getSaveBlocksUntilFinished() const
Returns whether saving will block until the whole save is finished and file is ready.
QString getImportedIFCFile()
virtual int restoreDocument(Base::XMLReader &reader, Core::Attachments &attachments)
Restores the document. Returns the doc version of the restored document.
DocumentState(const DocumentState &rhs)
Definition: CoreDocument.h:221
Core::Link getInBackLinks(Core::DocObject *docObj)
Core::Link getAllLinksByProperties(const Core::DocObject *source) const
Core::CoreDocument * mDoc
Definition: CoreDocument.h:1000
RecomputeError
Definition: CoreDocument.h:195
boost::signals2::signal< void(const std::map< Core::DocObject *, std::vector< std::string >> &)> signalRecomputedErrorObjects
Signals recomputed error DocObjects.
Definition: CoreDocument.h:514
void setUndoLimit(unsigned int UndoMemSize=0)
Set the Undo limit in Byte!
Base::String fileName
Definition: CoreDocument.h:322
T * createObject()
Definition: CoreDocument.h:538
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:510
boost::signals2::signal< void(const std::vector< Core::LinkError > &)> signalDefectLinks
Signals defect links from object1 to object2.
Definition: CoreDocument.h:516
static void getDefaultVersionToSave(int &aMajorVersion, int &aMinorVersion)
Returns application's mainversion to be saved in the document.
DocumentTimeStampSentinel(Core::CoreDocument *aDoc)
Definition: CoreDocument.h:990
LX_CORE_EXPORT Version & version
Core::DocObject * getObjectByGlobalId(const Base::GlobalId &guid) const
Returns the DocObject with this GUID.
SaveStart
Definition: CoreDocument.h:209
std::string IdType
Definition: DocObject.h:71
void onAddLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::unordered_set< Core::DocObject * > &linkSet)
unsigned long LastNotifyTime
Definition: CoreDocument.h:232
Core::PropertyText documentGUID
Definition: CoreDocument.h:306
bool checkObjectLinks(const std::vector< const Core::DocObject * > &objvec, std::vector< Core::LinkError > *errors=nullptr)
Checks the document for errors. Returns false if there is an error.
T * addImmutableObject_NoCheck(Core::PropertyBundle< T > *po)
Definition: CoreDocument.h:578
const ObjectMap & getObjectMap() const
Returns the object map.
bool redo(int id=0)
Will REDO one step, returns False if no redo was done (Redos == 0).
bool hasReferencesFrom(Core::DocObject *from) const
Definition: PropertyInteger.h:129
void commitTransaction()
Commit the Command transaction. Do nothing If there is no Command transaction open.
Definition: GlobalAttachment.h:8
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.
boost::signals2::signal< void()> signalRecomputeError
Signals a recompute error.
Definition: CoreDocument.h:512
std::string m_TargetDocObjectID
Definition: CoreDocument.h:263
Core::CoreDocument * Document
Definition: CoreDocument.h:179
int getAvailableUndos(int id=0) const
Returns the number of stored Undos. If greater than 0 Undo will be effective.
CoreDocument(const CoreDocument &rhs)
Definition: Property.h:72
virtual void recompute(std::function< void(DOCOBJECTS newObj, DOCOBJECTS updatedObj, DOCOBJECTS deletedObj, DOCOBJECTS_ERROR_MAP errorObj)> onRecomputedCB)
virtual std::vector< const Core::DocObject * > getLinksFromMe(const Core::DocObject *o)
Returns all objects 'o' directly linked from 'o'.
std::vector< Core::DocObject * > getObjectsToSave()
Returns all objects that will be saved in document. Basically interface for build_savemap().
void onAddBackLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::unordered_set< Core::DocObject * > &linkSet)
Type copyObjectShallow(Type o)
Creates a copy of 'o' and adds it to the document. Performs shallow copy.
Definition: CoreDocument.h:359
bool checkObjectLinks(std::vector< Core::LinkError > *errors)
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:727
void onRemoveLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::unordered_set< Core::DocObject * > &linkSet)
bool saveFile(bool toExport=false, bool saveBackupCopy=false)
Saves the file.
std::map< Core::DocObject *, std::vector< std::string > > LastErroneousObjects
Definition: CoreDocument.h:230
void abortTransaction()
Abort the actually running transaction.
Definition: CoreDocument.h:55
void addPropertyLinkError(const std::string &from, const std::string &to)
Base::String FileName
Definition: CoreDocument.h:81
std::string m_SourcePropertyName
Definition: CoreDocument.h:260
virtual DocObject * shallowCopy(Core::CoreDocument *toDoc)
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....
void resolveLinkInDocument(Core::PropertyLinkBase *link)
After opening a document this method restores the links declared in the document header.
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
virtual void setChanged(bool changed)
Definition: RelGraph.h:26
virtual void recompute()
Recomputes the document.
void setTransactionMode(int iMode)
switch the transaction mode
int getTransactionID(bool undo, unsigned pos=0) const
Return the undo/redo transaction ID starting from the back.
Definition: CoreDocument.h:987
Definition: CoreDocument.h:71
void _checkTransaction(Core::DocObject *pcDelObj, const Property *What, int line)
checks if a valid transaction is open
void createTempDirectory()
Creates the temporary directory.
virtual void restoreDirectory(const QString &)
Restores directory to temp.
Definition: CoreDocument.h:854
void onRemoveBackLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
virtual std::vector< Core::DocObject * > getObjectsSorted() const
Returns all objects topologically sorted.
const DocumentState & getDocumentState() const
virtual const char * subject_name(void)
Definition: CoreDocument.h:747
Core::PropertyText createdBy
Definition: CoreDocument.h:313
Core::DocObject * target
Definition: CoreDocument.h:74
bool checkObjectLinks(const std::vector< const Core::DocObject * > &objvec, const std::vector< const Core::DocObject * > &objToCheck, std::vector< Core::LinkError > *errors=nullptr)
virtual std::vector< const Core::DocObject * > getLinksToMe(const Core::DocObject *o)
Returns all objects that directly linked to 'o'.
Core::DocObject::IdType getUniqueObjectIdFromInteger(size_t input) const
Core::PropertyText lastModifiedDate
Definition: CoreDocument.h:316
virtual std::vector< const Core::DocObject * > getBackLinksFromMe(const Core::DocObject *o)
Returns all objects 'o' directly linked from 'o'.
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
std::map< Base::GlobalId, Core::DocObject * > _guid_map
Definition: CoreDocument.h:920
RelGraph * _relGraphBackLink
Definition: CoreDocument.h:917
bool addFileToZip(const Base::String &entryName, const Base::String &path)
Core::PropertyText lastModifiedBy
Definition: CoreDocument.h:315
bool isSameAs(const Link &rhs) const
void removeReferenceFrom(Core::DocObject *from)
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: CoreDocument.h:1021
virtual void removeObjectFinal(Core::DocObject *e, bool deep=false)
Removes an object from the document.
std::unordered_map< DocObject::IdType, Core::DocObject * > ObjectMap
Definition: CoreDocument.h:47
The PropertyGUID class saves and restores GUIDs. It also handles the management of GUIDs in the Docum...
Definition: PropertyGUID.h:21
ObjectTypeMap _immutableObjectsMap
Definition: CoreDocument.h:910
Definition: CoreDocument.h:63
void setGuidPolicy(const Base::String &suffix, const Base::GlobalId_Policy &policy)
Sets the GUID policy for a file suffix. This determines what should be done if identical GUIDs are im...
void setNew()
Sets the status to 'New'.
NewFile
Definition: CoreDocument.h:197
virtual 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.
virtual void saveDocument(std::shared_ptr< Base::AbstractWriter > writer, int versionMajor2save, int versionMinor2save, bool showProgress)
Saves the document.
void restoreProperty(Core::Property *property, const Base::String &name, Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
Restores property from from reader in specified version.
void setDocument(Core::CoreDocument *doc)
Sets the CoreDocument of this DocObject.
bool testStatusBits(Status pos) const
return the status bits
void _commitTransaction(bool notify=false)
Internally called by App::Application to commit the Command transaction.
AfterSave
Definition: CoreDocument.h:200
Definition: PropertyBundle.h:13
Definition: AbstractXMLReader.h:5
virtual bool renameTypeFromOlderVersions(int, Base::String &)
Definition: CoreDocument.h:836
AddDirectoryPath
Definition: CoreDocument.h:202
const std::set< Core::DocObject * > & getReferences() const
void resetHasErrorObjectsInRecompute()
reset result of last recompute();
bool hasPendingTransaction() const
Check if a transaction is open.
std::vector< Core::ExecObject * > ExecObjectVector
Definition: CoreDocument.h:48
Import
Definition: CoreDocument.h:208