FreeCAD C++
Public Member Functions | List of all members
Gui::Document Class Reference

#include <Gui/Document.h>

Detailed Description

The Gui Document This is the document on GUI level. Its main responsibility is keeping track off open windows for a document and warning on unsaved closes. All handled views on the document must inherit from MDIView

See also
App::Document
MDIView
Author
Jürgen Riegel

Public Member Functions

void setModified (bool)
 Observer message from the App doc.
 
App::DocumentgetDocument (void) const
 Getter for the App Document.
 
bool canClose ()
 handles the application close event
 
methods for View handling
Gui::MDIViewgetActiveView (void) const
 Getter for the active view.
 
void setActiveWindow (Gui::MDIView *view)
 
Gui::MDIViewgetEditingViewOfViewProvider (Gui::ViewProvider *) const
 
Gui::MDIViewgetViewOfViewProvider (Gui::ViewProvider *) const
 
Gui::MDIViewgetViewOfNode (SoNode *) const
 
void createView (const Base::Type &typeId)
 Create a new view.
 
Gui::MDIViewcloneView (Gui::MDIView *)
 Create a clone of the given view.
 
bool sendMsgToViews (const char *pMsg)
 send Messages to all views More...
 
bool sendMsgToFirstView (const Base::Type &typeId, const char *pMsg, const char **ppReturn)
 
void attachView (Gui::BaseView *pcView, bool bPassiv=false)
 Attach a view (get called by the MDIView constructor)
 
void detachView (Gui::BaseView *pcView, bool bPassiv=false)
 Detach a view (get called by the MDIView destructor)
 
ViewProvidergetViewProviderByPathFromTail (SoPath *path) const
 helper for selection
 
void onUpdate (void)
 call update on all attached views
 
void onRelabel (void)
 call relabel to all attached views
 
std::list< MDIView * > getMDIViews () const
 returns a list of all attached MDI views
 
std::list< MDIView * > getMDIViewsOfType (const Base::Type &typeId) const
 returns a list of all MDI views of a certain type
 
View provider handling
ViewProvidergetViewProvider (const App::DocumentObject *) const
 Get the view provider for that object.
 
void setAnnotationViewProvider (const char *name, ViewProvider *pcProvider)
 set an annotation view provider
 
ViewProvidergetAnnotationViewProvider (const char *name) const
 get an annotation view provider
 
void removeAnnotationViewProvider (const char *name)
 remove an annotation view provider
 
bool isShow (const char *name)
 test if the feature is in show
 
void setShow (const char *name)
 put the feature in show
 
void setHide (const char *name)
 set the feature in Noshow
 
void setPos (const char *name, const Base::Matrix4D &rclMtrx)
 set the feature transformation (only viewing)
 
std::vector< ViewProvider * > getViewProvidersOfType (const Base::Type &typeId) const
 
ViewProvidergetViewProviderByName (const char *name) const
 
bool setEdit (Gui::ViewProvider *p, int ModNum=0)
 set the ViewProvider in special edit mode
 
void resetEdit (void)
 reset from edit mode
 
ViewProvidergetInEdit (void) const
 get the in edit ViewProvider or NULL
 
methods for the UNDO REDO handling
void openCommand (const char *sName=0)
 Open a new Undo transaction on the document.
 
void commitCommand (void)
 Commit the Undo transaction on the document.
 
void abortCommand (void)
 Abort the Undo transaction on the document.
 
bool hasPendingCommand (void) const
 Check if an Undo transaction is open.
 
std::vector< std::string > getUndoVector (void) const
 Get an Undo string vector with the Undo names.
 
std::vector< std::string > getRedoVector (void) const
 Get an Redo string vector with the Redo names.
 
void undo (int iSteps)
 Will UNDO one or more steps.
 
void redo (int iSteps)
 Will REDO one or more steps.
 
- Public Member Functions inherited from Base::BaseClass
 BaseClass ()
 Construction.
 
virtual ~BaseClass ()
 Destruction.
 

Public Attributes

Signals of the document
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalNewObject
 signal on new Object
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalDeletedObject
 signal on deleted Object
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &, const App::Property &)> signalChangedObject
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalRelabelObject
 signal on renamed Object
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalActivatedObject
 signal on activated Object
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalInEdit
 signal on entering in edit mode
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalResetEdit
 signal on leaving edit mode
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &, const Gui::HighlightMode &, bool)> signalHighlightObject
 signal on changed Object, the 2nd argument is the highlite mode to use
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &, const Gui::TreeItemMode &)> signalExpandObject
 signal on changed Object, the 2nd argument is the highlite mode to use
 
boost::signals2::signal< void(const Gui::ViewProviderDocumentObject &)> signalScrollToObject
 signal on scrolling to an object
 
boost::signals2::signal< void(const Gui::Document &doc)> signalUndoDocument
 signal on undo Document
 
boost::signals2::signal< void(const Gui::Document &doc)> signalRedoDocument
 signal on redo Document
 
boost::signals2::signal< void(const Gui::Document &doc)> signalDeleteDocument
 signal on deleting Document
 

I/O of the document

unsigned int getMemSize (void) const
 
bool save (void)
 Save the document.
 
bool saveAs (void)
 Save the document under a new file name.
 
bool saveCopy (void)
 Save a copy of the document under a new file name.
 
virtual void Save (Base::Writer &writer) const
 This method is used to save properties or very small amounts of data to an XML document.
 
virtual void Restore (Base::XMLReader &reader)
 This method is used to restore properties from an XML document.
 
virtual void SaveDocFile (Base::Writer &writer) const
 This method is used to save large amounts of data to a binary file.
 
virtual void RestoreDocFile (Base::Reader &reader)
 This method is used to restore large amounts of data from a binary file.
 
void exportObjects (const std::vector< App::DocumentObject * > &, Base::Writer &)
 
void importObjects (const std::vector< App::DocumentObject * > &, Base::Reader &, const std::map< std::string, std::string > &nameMapping)
 
void addRootObjectsToGroup (const std::vector< App::DocumentObject * > &, App::DocumentObjectGroup *)
 Add all root objects of the given array to a group.
 
void slotNewObject (const App::DocumentObject &)
 This slot is connected to the App::Document::signalNewObject(...)
 
void slotDeletedObject (const App::DocumentObject &)
 
void slotChangedObject (const App::DocumentObject &, const App::Property &)
 
void slotRelabelObject (const App::DocumentObject &)
 
void slotTransactionAppend (const App::DocumentObject &, App::Transaction *)
 
void slotTransactionRemove (const App::DocumentObject &, App::Transaction *)
 
void slotActivatedObject (const App::DocumentObject &)
 
void slotStartRestoreDocument (const App::Document &)
 
void slotFinishRestoreDocument (const App::Document &)
 
void slotUndoDocument (const App::Document &)
 
void slotRedoDocument (const App::Document &)
 

Additional Inherited Members

- Static Public Member Functions inherited from Base::Persistence
static std::string encodeAttribute (const std::string &)
 Encodes an attribute upon saving.
 

Member Function Documentation

◆ sendMsgToFirstView()

bool Gui::Document::sendMsgToFirstView ( const Base::Type typeId,
const char *  pMsg,
const char **  ppReturn 
)

Sends the message pMsg to the views of type typeid and stops with the first view that supports the message and returns ppReturn. The very first checked view is the current active view. If a view supports the message true is returned and false otherwise.

◆ sendMsgToViews()

bool Gui::Document::sendMsgToViews ( const char *  pMsg)

send Messages to all views

send messages to the active view Send a specific massage to the active view and is able to receive a return message

Member Data Documentation

◆ signalChangedObject

boost::signals2::signal<void (const Gui::ViewProviderDocumentObject&, const App::Property&)> Gui::Document::signalChangedObject
mutable

signal on changed Object, the 2nd argument is the changed property of the referenced document object, not of the view provider