#include <Sheet.h>

Public Member Functions

void clear (App::CellAddress address, bool all=true)
 Clear the cell at address. More...
 
void clearAll ()
 Clear all cells in the sheet. More...
 
std::set< std::string > dependsOn (App::CellAddress address) const
 Return a set of dependencies links for cell at address. More...
 
App::DocumentObjectExecReturnexecute (void)
 Update the document properties. More...
 
bool exportToFile (const std::string &filename, char delimiter='\t', char quoteChar='\0', char escapeChar='\\') const
 Export spreadsheet data to file. More...
 
std::string getAddressFromAlias (const std::string &alias) const
 Get cell given an alias string. More...
 
CellgetCell (App::CellAddress address)
 Get contents of the cell specified by address, or 0 if it is not defined. More...
 
bool getCellAddress (const App::Property *prop, App::CellAddress &address)
 Get the address as address of the Property prop. More...
 
PropertySheetgetCells ()
 
std::string getColumn (int offset=0) const
 
int getColumnWidth (int col) const
 Get column with of column at index col. More...
 
std::map< int, int > getColumnWidths () const
 Get a map with column indices and widths. More...
 
CellgetNewCell (App::CellAddress address)
 Get cell contents specified by address. More...
 
App::PropertygetPropertyByName (const char *name) const
 Retrieve a specific Property given by name. More...
 
PyObjectgetPyObject ()
 Get the Python object for the Sheet. More...
 
std::string getRow (int offset=0) const
 
int getRowHeight (int row) const
 Get height of row at index row. More...
 
std::map< int, int > getRowHeights () const
 Get a map with row indices and heights. More...
 
void getSpans (App::CellAddress address, int &rows, int &cols) const
 Get row an column span for the cell at (row, col). More...
 
std::vector< std::string > getUsedCells () const
 Get a vector of strings with addresses of all used cells. More...
 
virtual const char * getViewProviderName (void) const
 returns the type name of the ViewProvider More...
 
bool hasCell (const std::vector< App::Range > &ranges) const
 
bool importFromFile (const std::string &filename, char delimiter='\t', char quoteChar='\0', char escapeChar='\\')
 Import a file into the spreadsheet object. More...
 
void insertColumns (int col, int count)
 Insert count columns at before column col in the spreadsheet. More...
 
void insertRows (int row, int count)
 Inser count rows at row row. More...
 
bool isMergedCell (App::CellAddress address) const
 Determine whether this cell is merged with another or not. More...
 
bool isValidAlias (const std::string &candidate)
 Determine whether a given alias candidate is valid or not. More...
 
bool mergeCells (const App::Range &range)
 Merge a rectangle specified by range into one logical cell. More...
 
virtual short mustExecute (void) const
 Determine whether this object needs to be executed to update internal structures. More...
 
void observeDocument (App::Document *document)
 Create a document observer for this sheet. More...
 
void providesTo (App::CellAddress address, std::set< std::string > &result) const
 Compute links to cells that cell at address provides input to. More...
 
void removeColumns (int col, int count)
 Remove count columns at column col. More...
 
void removeRows (int row, int count)
 Remove count rows starting at row from the spreadsheet. More...
 
virtual void renameObjectIdentifiers (const std::map< App::ObjectIdentifier, App::ObjectIdentifier > &paths)
 
void setAlias (App::CellAddress address, const std::string &alias)
 Set alias for cell at address address to alias. More...
 
void setAlignment (App::CellAddress address, int alignment)
 Set alignment of content in cell at address to alignment. More...
 
void setBackground (App::CellAddress address, const App::Color &color)
 Set background color of cell at address address to color. More...
 
void setCell (App::CellAddress address, const char *value)
 Set cell at address to value. More...
 
void setCell (const char *address, const char *value)
 Set cell given by address to contents. More...
 
void setColumnWidth (int col, int width)
 Set column with of column col to width-. More...
 
void setComputedUnit (App::CellAddress address, const Base::Unit &unit)
 Set computed unit for cell at address address to unit. More...
 
void setContent (App::CellAddress address, const char *value)
 Set content of cell at address to value. More...
 
void setDisplayUnit (App::CellAddress address, const std::string &unit)
 Set display unit of cell at address address to unit. More...
 
void setForeground (App::CellAddress address, const App::Color &color)
 Set foreground (text color) of cell at address address to color. More...
 
void setRowHeight (int row, int height)
 Set row height of row given by index in row to height. More...
 
void setSpans (App::CellAddress address, int rows, int columns)
 Set row and column span for the cell at address address to rows and columns. More...
 
void setStyle (App::CellAddress address, const std::set< std::string > &style)
 Set style of cell at address to style. More...
 
 Sheet ()
 Constructor. More...
 
void splitCell (App::CellAddress address)
 Split a previously merged cell specified by address into its individual cells. More...
 
void touchCells (App::Range range)
 
virtual ~Sheet ()
 Sheet::~Sheet. More...
 
- Public Member Functions inherited from App::DocumentObject
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) override
 
virtual bool adjustRelativeLinks (const std::set< App::DocumentObject * > &inList, std::set< App::DocumentObject * > *visited=0)
 Called to adjust link properties to avoid cyclic links. More...
 
virtual bool allowDuplicateLabel () const
 
virtual bool canLinkProperties () const
 
virtual int canLoadPartial () const
 allow partial loading of dependent objects More...
 
void clearOutListCache () const
 clear internal out list cache More...
 
virtual const char * detachFromDocument () override
 
 DocumentObject (void)
 Constructor. More...
 
void enforceRecompute ()
 Enforce this document object to be recomputed. More...
 
App::DocumentgetDocument (void) const
 gets the document in which this Object is handled More...
 
std::string getExportName (bool forced=false) const
 returns the name that is safe to be exported to other document More...
 
virtual const PropertyExpressionEngine::ExpressionInfo getExpression (const ObjectIdentifier &path) const
 
virtual std::string getFullName () const override
 Return the object full name of the form DocName::ObjName. More...
 
DocumentObjectGroupgetGroup () const
 get group if object is part of a group, otherwise 0 is returned More...
 
long getID () const
 Return the object ID that is unique within its owner document. More...
 
const std::vector< App::DocumentObject * > & getInList (void) const
 
std::set< App::DocumentObject * > getInListEx (bool recursive) const
 Return a set of all objects linking to this object, including possible external parent objects. More...
 
void getInListEx (std::set< App::DocumentObject * > &inSet, bool recursive, std::vector< App::DocumentObject * > *inList=0) const
 Get a set of all objects linking to this object, including possible external parent objects. More...
 
std::vector< App::DocumentObject * > getInListRecursive (void) const
 get all objects link directly or indirectly to this object More...
 
virtual DocumentObjectgetLinkedObject (bool recurse=true, Base::Matrix4D *mat=0, bool transform=false, int depth=0) const
 Return the linked object with optional transformation. More...
 
const char * getNameInDocument (void) const
 returns the name which is set in the document for this object (not the name property!) More...
 
const std::string & getOldLabel () const
 
const std::vector< App::DocumentObject * > & getOutList () const
 returns a list of objects this object is pointing to by Links More...
 
std::vector< App::DocumentObject * > getOutList (int option) const
 
void getOutList (int option, std::vector< App::DocumentObject * > &res) const
 
std::vector< App::DocumentObject * > getOutListOfProperty (App::Property *) const
 returns a list of objects linked by the property More...
 
std::vector< App::DocumentObject * > getOutListRecursive (void) const
 returns a list of objects this object is pointing to by Links and all further descended More...
 
std::vector< std::pair< App::DocumentObject *, std::string > > getParents (int depth=0) const
 Obtain top parents and subnames of this object using its InList. More...
 
std::vector< std::list< App::DocumentObject * > > getPathsByOutList (App::DocumentObject *to) const
 get all possible paths from this to another object following the OutList More...
 
unsigned long getStatus () const
 return the status bits More...
 
const char * getStatusString (void) const
 get the status Message More...
 
virtual DocumentObjectgetSubObject (const char *subname, PyObject **pyObj=0, Base::Matrix4D *mat=0, bool transform=true, int depth=0) const
 Get the sub element/object by name. More...
 
std::vector< DocumentObject * > getSubObjectList (const char *subname) const
 Return a list of objects referenced by a given subname including this object. More...
 
virtual std::vector< std::string > getSubObjects (int reason=0) const
 Return name reference of all sub-objects. More...
 
virtual const char * getViewProviderNameOverride () const
 This function is introduced to allow Python feature override its view provider. More...
 
const char * getViewProviderNameStored () const
 
virtual bool hasChildElement () const
 return true to activate tree view group object handling and element visibility More...
 
virtual bool isAttachedToDocument () const override
 
virtual int isElementVisible (const char *element) const
 Get sub-element visibility. More...
 
bool isError (void) const
 set this feature to error More...
 
int isExporting () const
 
bool isInInList (DocumentObject *objToTest) const
 test if this object is directly (non recursive) in the InList More...
 
bool isInInListRecursive (DocumentObject *objToTest) const
 test if this object is in the InList and recursive further down More...
 
bool isInOutList (DocumentObject *objToTest) const
 test if this object is directly (non recursive) in the OutList More...
 
bool isInOutListRecursive (DocumentObject *objToTest) const
 test if the given object is in the OutList and recursive further down More...
 
bool isRecomputing () const
 returns true if this objects is currently recomputing More...
 
bool isRemoving () const
 returns true if this objects is currently removed from the document More...
 
bool isRestoring () const
 returns true if this objects is currently restoring from file More...
 
bool isTouched (void) const
 test if this document object is touched More...
 
bool isValid (void) const
 
bool mustRecompute (void) const
 Test if this document object must be recomputed. More...
 
virtual void onBeforeChangeLabel (std::string &newLabel)
 
virtual void onLostLinkToObject (DocumentObject *)
 Called in case of losing a link Get called by the document when a object got deleted a link property of this object ist pointing to. More...
 
virtual void onUpdateElementReference (const Property *)
 
void purgeError (void)
 remove the error from the object More...
 
void purgeTouched (void)
 reset this document object touched More...
 
bool recomputeFeature (bool recursive=false)
 Recompute only this feature. More...
 
virtual bool redirectSubName (std::ostringstream &ss, DocumentObject *topParent, DocumentObject *child) const
 Allow object to redirect a subname path. More...
 
virtual bool removeDynamicProperty (const char *prop) override
 
App::DocumentObjectresolve (const char *subname, App::DocumentObject **parent=0, std::string *childName=0, const char **subElement=0, PyObject **pyObj=0, Base::Matrix4D *mat=0, bool transform=true, int depth=0) const
 Resolve the last document object referenced in the subname. More...
 
App::DocumentObjectresolveRelativeLink (std::string &subname, App::DocumentObject *&link, std::string &linkSub) const
 Resolve a link reference that is relative to this object reference. More...
 
virtual void Save (Base::Writer &writer) const override
 This method is used to save properties to an XML document. More...
 
virtual int setElementVisible (const char *element, bool visible)
 Child element handling. More...
 
virtual void setExpression (const ObjectIdentifier &path, boost::shared_ptr< App::Expression > expr)
 
void setStatus (ObjectStatus pos, bool on)
 
bool testIfLinkDAGCompatible (App::PropertyLinkSub &linkTo) const
 
bool testIfLinkDAGCompatible (App::PropertyLinkSubList &linksTo) const
 
bool testIfLinkDAGCompatible (const std::vector< DocumentObject * > &linksTo) const
 
bool testIfLinkDAGCompatible (DocumentObject *linkTo) const
 testIfLinkIsDAG tests a link that is about to be created for circular references. More...
 
bool testStatus (ObjectStatus pos) const
 
void touch (bool noRecompute=false)
 Set the property touched -> changed, cause recomputation in Update() More...
 
virtual ~DocumentObject ()
 
- Public Member Functions inherited from App::TransactionalObject
 TransactionalObject (void)
 Constructor. More...
 
virtual ~TransactionalObject ()
 
- Public Member Functions inherited from App::ExtensionContainer
ExtensionIterator extensionBegin ()
 
 ExtensionContainer ()
 
ExtensionIterator extensionEnd ()
 
App::ExtensiongetExtension (Base::Type, bool derived=true, bool no_except=false) const
 
App::ExtensiongetExtension (const std::string &name) const
 
template<typename ExtensionT >
ExtensionTgetExtensionByType (bool no_except=false, bool derived=true) const
 
std::vector< Extension * > getExtensionsDerivedFrom (Base::Type type) const
 
template<typename ExtensionT >
std::vector< ExtensionT * > getExtensionsDerivedFromType () const
 
bool hasExtension (Base::Type, bool derived=true) const
 
bool hasExtension (const std::string &name) const
 
bool hasExtensions () const
 
void registerExtension (Base::Type extension, App::Extension *ext)
 
virtual ~ExtensionContainer ()
 
virtual const char * getPropertyName (const Property *prop) const override
 get the name of a property More...
 
virtual void getPropertyMap (std::map< std::string, Property * > &Map) const override
 get all properties of the class (including properties of the parent) More...
 
virtual void getPropertyList (std::vector< Property * > &List) const override
 get all properties of the class (including properties of the parent) More...
 
virtual short getPropertyType (const Property *prop) const override
 get the Type of a Property More...
 
virtual short getPropertyType (const char *name) const override
 get the Type of a named Property More...
 
virtual const char * getPropertyGroup (const Property *prop) const override
 get the Group of a Property More...
 
virtual const char * getPropertyGroup (const char *name) const override
 get the Group of a named Property More...
 
virtual const char * getPropertyDocumentation (const Property *prop) const override
 get the Group of a Property More...
 
virtual const char * getPropertyDocumentation (const char *name) const override
 get the Group of a named Property More...
 
virtual void Restore (Base::XMLReader &reader) override
 This method is used to restore properties from an XML document. More...
 
void saveExtensions (Base::Writer &writer) const
 
void restoreExtensions (Base::XMLReader &reader)
 
- Public Member Functions inherited from App::PropertyContainer
virtual App::PropertygetDynamicPropertyByName (const char *name) const
 
DynamicProperty::PropData getDynamicPropertyData (const Property *prop) const
 
virtual std::vector< std::string > getDynamicPropertyNames () const
 
virtual unsigned int getMemSize (void) const
 This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? More...
 
const char * getPropertyPrefix () const
 
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...
 
 PropertyContainer ()
 A constructor. More...
 
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

boost::signals2::signal< void(App::CellAddress)> cellSpanChanged
 
boost::signals2::signal< void(App::CellAddress)> cellUpdated
 
boost::signals2::signal< void(int, int)> columnWidthChanged
 
boost::signals2::signal< void(int, int)> rowHeightChanged
 
- Public Attributes inherited from App::DocumentObject
PropertyExpressionEngine ExpressionEngine
 
PropertyString Label
 
PropertyString Label2
 
boost::signals2::signal< void(const App::DocumentObject &, const App::Property &)> signalBeforeChange
 signal before changing a property of this object More...
 
boost::signals2::signal< void(const App::DocumentObject &, const App::Property &)> signalChanged
 signal on changed property of this object More...
 
PropertyBool Visibility
 Allow control visibility status in App name space. More...
 

Protected Types

typedef std::map< std::string, SheetObserver * > ObserverMap
 

Protected Member Functions

void aliasRemoved (App::CellAddress address, const std::string &alias)
 Called when alias alias at address is removed. More...
 
App::PropertygetProperty (App::CellAddress key) const
 Get the Cell Property for the cell at key. More...
 
App::PropertygetProperty (const char *addr) const
 Get a dynamic property. More...
 
void onDocumentRestored ()
 get called after a document has been fully restored More...
 
virtual void onSettingDocument ()
 Update internal structure when document is set for this property. More...
 
std::set< App::CellAddressprovidesTo (App::CellAddress address) const
 Compute links to cells that cell at address provides input to. More...
 
void recomputeCell (App::CellAddress p)
 Recompute cell at address p. More...
 
void removeAliases ()
 Remove all aliases. More...
 
App::PropertysetFloatProperty (App::CellAddress key, double value)
 Set the property for cell key to a PropertyFloat with the value value. More...
 
App::PropertysetIntegerProperty (App::CellAddress key, long value)
 
App::PropertysetObjectProperty (App::CellAddress key, Py::Object obj)
 
App::PropertysetQuantityProperty (App::CellAddress key, double value, const Base::Unit &unit)
 Set the property for cell key to a PropertyQuantity with value and unit. More...
 
App::PropertysetStringProperty (App::CellAddress key, const std::string &value)
 Set the property for cell key to a PropertyString with value. More...
 
void updateAlias (App::CellAddress key)
 Update the alias for the cell at key. More...
 
void updateColumnsOrRows (bool horizontal, int section, int count)
 
void updateProperty (App::CellAddress key)
 Update the Property given by key. More...
 
- Protected Member Functions inherited from App::DocumentObject
App::DocumentObjectExecReturnexecuteExtensions ()
 Executes the extensions of a document object. More...
 
virtual void onBeforeChange (const Property *prop) override
 get called before the value is changed More...
 
virtual void onChanged (const Property *prop) override
 get called by the container when a property was changed More...
 
virtual void onPropertyStatusChanged (const Property &prop, unsigned long oldStatus) override
 get called when a property status has changed More...
 
virtual void onUndoRedoFinished ()
 get called after an undo/redo transaction is finished More...
 
virtual App::DocumentObjectExecReturnrecompute (void)
 recompute only this object More...
 
void resetError (void)
 
void setDocument (App::Document *doc)
 
void setError (void)
 
virtual void setupObject ()
 get called after a brand new object was created More...
 
virtual void unsetupObject ()
 get called when object is going to be removed from the document More...
 
- Protected Member Functions inherited from App::TransactionalObject
void onBeforeChangeProperty (Document *doc, const Property *prop)
 
- 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...
 

Protected Attributes

std::set< App::CellAddresscellErrors
 
PropertySheet cells
 
PropertyColumnWidths columnWidths
 
int currentCol = -1
 
int currentRow = -1
 
ObserverMap observers
 
std::map< const App::Property *, App::CellAddresspropAddress
 
App::DynamicPropertyprops
 
std::map< App::CellAddress, std::string > removedAliases
 
PropertyRowHeights rowHeights
 
- Protected Attributes inherited from App::DocumentObject
std::string oldLabel
 Old label; used for renaming expressions. More...
 
const std::string * pcNameInDocument
 
Py::Object PythonObject
 python object of this class and all descendent More...
 
std::bitset< 32 > StatusBits
 Status bits of the document object The first 8 bits are used for the base system the rest can be used in descendent classes to mark special statuses on the objects. More...
 
- Protected Attributes inherited from App::PropertyContainer
DynamicProperty dynamicProps
 

Friends

class PropertySheet
 
class SheetObserver
 

Additional Inherited Members

- Public Types inherited from App::DocumentObject
enum  GSReason { GS_DEFAULT , GS_SELECT }
 reason of calling getSubObjects() More...
 
enum  OutListOption { OutListNoExpression = 1 , OutListNoHidden = 2 , OutListNoXLinked = 4 }
 DAG handling This part of the interface deals with viewing the document as a DAG (directed acyclic graph). More...
 
- Public Types inherited from App::ExtensionContainer
typedef std::map< Base::Type, App::Extension * >::iterator ExtensionIterator
 
- Static Public Member Functions inherited from App::DocumentObject
static const char * hasHiddenMarker (const char *subname)
 Check if the subname reference ends with hidden marker. More...
 
static const std::string & hiddenMarker ()
 Special marker to mark the object as hidden. More...
 
- 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)
 
- Static Public Attributes inherited from App::DocumentObject
static DocumentObjectExecReturnStdReturn
 
- 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)
 

Member Typedef Documentation

◆ ObserverMap

typedef std::map<std::string, SheetObserver* > Spreadsheet::Sheet::ObserverMap
protected

Constructor & Destructor Documentation

◆ Sheet()

Sheet::Sheet ( )

Constructor.

Construct a new Sheet object.

References App::Prop_Hidden, App::Prop_Output, and App::Prop_ReadOnly.

◆ ~Sheet()

Sheet::~Sheet ( )
virtual

Sheet::~Sheet.

The destructor; clear properties to release all memory.

References clearAll().

Member Function Documentation

◆ aliasRemoved()

void Sheet::aliasRemoved ( App::CellAddress  address,
const std::string &  alias 
)
protected

Called when alias alias at address is removed.

Parameters
addressAddress of alias.
aliasRemoved alias.

References removedAliases.

Referenced by Spreadsheet::PropertySheet::setAlias().

◆ clear()

void Sheet::clear ( App::CellAddress  address,
bool  all = true 
)

Clear the cell at address.

If all is false, only the text or expression contents are cleared. If all is true everything in the cell is cleared, including color, style, etc.

Parameters
addressAddress of cell to clear
allWhether we should clear all or not.

References cells, Spreadsheet::PropertySheet::clear(), Spreadsheet::Cell::getAlias(), getCell(), propAddress, and App::DocumentObject::removeDynamicProperty().

Referenced by Spreadsheet::PropertySheet::pasteCells(), setCell(), and updateProperty().

◆ clearAll()

◆ dependsOn()

std::set< std::string > Sheet::dependsOn ( App::CellAddress  address) const

Return a set of dependencies links for cell at address.

Parameters
addressAddress of cell
Returns
Set of dependencies.

References cells, and Spreadsheet::PropertySheet::getDeps().

Referenced by SpreadsheetGui::SheetModel::data().

◆ execute()

DocumentObjectExecReturn * Sheet::execute ( void  )
virtual

Update the document properties.

Reimplemented from App::DocumentObject.

References cellErrors, cells, cellUpdated, Spreadsheet::PropertyColumnWidths::clearDirty(), Spreadsheet::PropertyRowHeights::clearDirty(), columnWidthChanged, columnWidths, Spreadsheet::PropertySheet::getDirty(), Spreadsheet::PropertyColumnWidths::getDirty(), Spreadsheet::PropertyRowHeights::getDirty(), App::DocumentObject::getFullName(), Spreadsheet::PropertySheet::getValue(), Spreadsheet::PropertyColumnWidths::getValue(), Spreadsheet::PropertyRowHeights::getValue(), providesTo(), recomputeCell(), Spreadsheet::PropertySheet::recomputeDependencies(), removeAliases(), rowHeightChanged, rowHeights, and Spreadsheet::Cell::setException().

Referenced by draftobjects.facebinder.Facebinder::addSubobjects(), PathScripts.PathDressupDogbone.ObjectDressup::boneStateList(), ArchSite.Compass::buildCoordinates(), PathScripts.PathDressupHoldingTags.ObjectTagDressup::generateTags(), ArchPanel.PanelCut::getWires(), ArchSchedule.CommandArchSchedule::IsActive(), Mod.PartDesign.Scripts.DistanceBolt.DistanceBolt::onChanged(), Mod.PartDesign.Scripts.Epitrochoid.Epitrochoid::onChanged(), Mod.PartDesign.Scripts.Parallelepiped.Parallelepiped::onChanged(), Mod.PartDesign.Scripts.Parallelepiped.BoxCylinder::onChanged(), Mod.PartDesign.Scripts.Spring.MySpring::onChanged(), FeaturePython.DistanceBolt::onChanged(), PathScripts.PathStock.StockFromBase::onChanged(), PathScripts.PathStock.StockCreateBox::onChanged(), PathScripts.PathStock.StockCreateCylinder::onChanged(), onDocumentRestored(), draftobjects.draftlink.DraftLink::onDocumentRestored(), draftobjects.patharray.PathArray::onDocumentRestored(), and draftobjects.pathtwistedarray.PathTwistedArray::onDocumentRestored().

◆ exportToFile()

bool Sheet::exportToFile ( const std::string &  filename,
char  delimiter = '\t',
char  quoteChar = '\0',
char  escapeChar = '\\' 
) const

Export spreadsheet data to file.

Parameters
filenameFilename to store data to.
delimiterField delimiter
quoteCharQuote character ('\0' to disable)
escapeCharEscape character ('\0' to disable)
Returns
True if store is successful, false if something failed.

References cells, getProperty(), Spreadsheet::PropertySheet::getUsedCells(), and Base::BaseClass::isDerivedFrom().

◆ getAddressFromAlias()

std::string Sheet::getAddressFromAlias ( const std::string &  alias) const

Get cell given an alias string.

Parameters
aliasAlias for cell
Returns
Name of cell, or empty string if not defined

References cells, Spreadsheet::Cell::getAddress(), Spreadsheet::PropertySheet::getValueFromAlias(), and App::CellAddress::toString().

Referenced by isValidAlias(), Spreadsheet::SheetPy::set(), and setAlias().

◆ getCell()

Cell * Sheet::getCell ( App::CellAddress  address)

Get contents of the cell specified by address, or 0 if it is not defined.

Returns
A CellContent object or 0.

References cells, and Spreadsheet::PropertySheet::getValue().

Referenced by clear(), SpreadsheetGui::SheetModel::data(), Drawing::FeatureViewSpreadsheet::execute(), getNewCell(), TechDraw::DrawViewSpreadsheet::getSheetImage(), removeColumns(), removeRows(), updateAlias(), and updateProperty().

◆ getCellAddress()

bool Sheet::getCellAddress ( const App::Property prop,
App::CellAddress address 
)

Get the address as address of the Property prop.

This function throws an exception if the property is not found.

References propAddress.

◆ getCells()

◆ getColumn()

std::string Sheet::getColumn ( int  offset = 0) const

◆ getColumnWidth()

int Sheet::getColumnWidth ( int  col) const

◆ getColumnWidths()

std::map< int, int > Sheet::getColumnWidths ( ) const

Get a map with column indices and widths.

Returns
Map with results.

References columnWidths, and Spreadsheet::PropertyColumnWidths::getValues().

Referenced by SpreadsheetGui::SheetTableView::setSheet().

◆ getNewCell()

Cell * Sheet::getNewCell ( App::CellAddress  address)

Get cell contents specified by address.

Parameters
address

References cells, Spreadsheet::PropertySheet::createCell(), and getCell().

Referenced by Spreadsheet::PropertySheet::pasteCells(), and SpreadsheetGui::PropertiesDialog::PropertiesDialog().

◆ getProperty() [1/2]

Property * Sheet::getProperty ( App::CellAddress  key) const
protected

Get the Cell Property for the cell at key.

Returns
The Property object.

Referenced by exportToFile(), and getPropertyByName().

◆ getProperty() [2/2]

Property * Sheet::getProperty ( const char *  addr) const
protected

Get a dynamic property.

Parameters
addrName of dynamic propeerty.
Returns
Pointer to property, or 0 if it does not exist.

◆ getPropertyByName()

Property * Sheet::getPropertyByName ( const char *  name) const
virtual

Retrieve a specific Property given by name.

This function might throw an exception if something fails, but might also return 0 in case the property is not found.

Returns
The property, or 0 if not found.

Reimplemented from App::ExtensionContainer.

References getProperty(), and App::CellAddress::toString().

Referenced by SpreadsheetGui::SheetModel::data(), Drawing::FeatureViewSpreadsheet::execute(), Spreadsheet::Cell::getFormattedQuantity(), TechDraw::DrawViewSpreadsheet::getSheetImage(), and isValidAlias().

◆ getPyObject()

PyObject * Sheet::getPyObject ( void  )
virtual

Get the Python object for the Sheet.

Returns
The Python object.

Reimplemented from App::DocumentObject.

References App::DocumentObject::PythonObject.

◆ getRow()

std::string Sheet::getRow ( int  offset = 0) const

◆ getRowHeight()

int Sheet::getRowHeight ( int  row) const

◆ getRowHeights()

std::map< int, int > Sheet::getRowHeights ( ) const

Get a map with row indices and heights.

Returns
Map with results

References Spreadsheet::PropertyRowHeights::getValues(), and rowHeights.

Referenced by SpreadsheetGui::SheetTableView::setSheet().

◆ getSpans()

void Sheet::getSpans ( App::CellAddress  address,
int &  rows,
int &  cols 
) const

Get row an column span for the cell at (row, col).

Parameters
addressAddress of cell
rowsThe number of unit cells this cell spans
colsThe number of unit rows this cell spans

References cells, and Spreadsheet::PropertySheet::getSpans().

Referenced by SpreadsheetGui::SheetTableView::updateCellSpan().

◆ getUsedCells()

std::vector< std::string > Sheet::getUsedCells ( ) const

Get a vector of strings with addresses of all used cells.

Returns
vector of strings.

References cells, and Spreadsheet::PropertySheet::getUsedCells().

Referenced by SpreadsheetGui::SheetTableView::setSheet().

◆ getViewProviderName()

virtual const char* Spreadsheet::Sheet::getViewProviderName ( void  ) const
virtual

returns the type name of the ViewProvider

Reimplemented from App::DocumentObject.

◆ hasCell()

bool Sheet::hasCell ( const std::vector< App::Range > &  ranges) const

◆ importFromFile()

bool Sheet::importFromFile ( const std::string &  filename,
char  delimiter = '\t',
char  quoteChar = '\0',
char  escapeChar = '\\' 
)

Import a file into the spreadsheet object.

Parameters
filenameName of file to import
delimiterThe field delimiter character used.
quoteCharQuote character, if any (set to '\0' to disable).
escapeCharThe escape character used, if any (set to '0' to disable).
Returns
True if successful, false if something failed.

References Spreadsheet::PropertySheet::AtomicPropertyChange, cells, clearAll(), and setCell().

◆ insertColumns()

void Sheet::insertColumns ( int  col,
int  count 
)

Insert count columns at before column col in the spreadsheet.

Parameters
colAddress of column where the columns are inserted.
countNumber of columns to insert

References cells, Spreadsheet::PropertySheet::insertColumns(), and updateColumnsOrRows().

◆ insertRows()

void Sheet::insertRows ( int  row,
int  count 
)

Inser count rows at row row.

Parameters
rowAddress of row where the rows are inserted.
countNumber of rows to insert.

References cells, Spreadsheet::PropertySheet::insertRows(), and updateColumnsOrRows().

◆ isMergedCell()

bool Sheet::isMergedCell ( App::CellAddress  address) const

Determine whether this cell is merged with another or not.

Parameters
address
Returns
True if cell is merged, false if not.

References cells, and Spreadsheet::PropertySheet::isMergedCell().

Referenced by SpreadsheetGui::SheetTableView::setSheet().

◆ isValidAlias()

bool Sheet::isValidAlias ( const std::string &  candidate)

Determine whether a given alias candidate is valid or not.

A candidate is valid is the string is syntactically correct, and the alias does not conflict with an existing property.

References cells, getAddressFromAlias(), getPropertyByName(), and Spreadsheet::PropertySheet::isValidAlias().

Referenced by setAlias().

◆ mergeCells()

bool Sheet::mergeCells ( const App::Range range)

Merge a rectangle specified by range into one logical cell.

Data in all but the upper right cell are cleared when the cells are merged.

Parameters
rangeRange to merge.
Returns
True if the cells were merged, false if the merge was unsuccessful.

References cells, and Spreadsheet::PropertySheet::mergeCells().

◆ mustExecute()

short Sheet::mustExecute ( void  ) const
virtual

Determine whether this object needs to be executed to update internal structures.

Reimplemented from App::DocumentObject.

References cellErrors, cells, and Spreadsheet::PropertySheet::isDirty().

◆ observeDocument()

void Sheet::observeDocument ( App::Document document)

Create a document observer for this sheet.

Used to track changes.

Parameters
documentdocument to observer.

References cells, App::Document::getName(), observers, and SheetObserver.

◆ onDocumentRestored()

void Sheet::onDocumentRestored ( )
protectedvirtual

get called after a document has been fully restored

Reimplemented from App::DocumentObject.

References execute(), and App::DocumentObject::getFullName().

◆ onSettingDocument()

void Sheet::onSettingDocument ( void  )
protectedvirtual

Update internal structure when document is set for this property.

Reimplemented from App::DocumentObject.

References cells, and Spreadsheet::PropertySheet::documentSet().

◆ providesTo() [1/2]

std::set< CellAddress > Sheet::providesTo ( App::CellAddress  address) const
protected

Compute links to cells that cell at address provides input to.

Parameters
addressAddress of cell
resultSet of links.

References cells, Spreadsheet::PropertySheet::getDeps(), and App::DocumentObject::getFullName().

◆ providesTo() [2/2]

void Sheet::providesTo ( App::CellAddress  address,
std::set< std::string > &  result 
) const

Compute links to cells that cell at address provides input to.

Parameters
addressAddress of cell
resultSet of links.

References cells, Spreadsheet::PropertySheet::getDeps(), and App::DocumentObject::getFullName().

Referenced by SpreadsheetGui::SheetModel::data(), and execute().

◆ recomputeCell()

◆ removeAliases()

void Sheet::removeAliases ( )
protected

Remove all aliases.

References removedAliases, and App::DocumentObject::removeDynamicProperty().

Referenced by execute().

◆ removeColumns()

void Sheet::removeColumns ( int  col,
int  count 
)

Remove count columns at column col.

Parameters
colAddress of first column to remove.
countNumber of columns to remove.

References cells, getCell(), Spreadsheet::PropertySheet::getColumns(), Spreadsheet::PropertySheet::removeColumns(), App::DocumentObject::removeDynamicProperty(), and updateColumnsOrRows().

◆ removeRows()

void Sheet::removeRows ( int  row,
int  count 
)

Remove count rows starting at row from the spreadsheet.

Parameters
rowAddress of first row to remove.
countNumber of rows to remove.

References cells, getCell(), Spreadsheet::PropertySheet::getRows(), App::DocumentObject::removeDynamicProperty(), Spreadsheet::PropertySheet::removeRows(), and updateColumnsOrRows().

◆ renameObjectIdentifiers()

void Sheet::renameObjectIdentifiers ( const std::map< App::ObjectIdentifier, App::ObjectIdentifier > &  paths)
virtual

◆ setAlias()

void Sheet::setAlias ( App::CellAddress  address,
const std::string &  alias 
)

Set alias for cell at address address to alias.

If the alias is an empty string, the existing alias is removed.

Parameters
addressAddress of cell
aliasNew alias.

References cells, getAddressFromAlias(), isValidAlias(), and Spreadsheet::PropertySheet::setAlias().

◆ setAlignment()

void Sheet::setAlignment ( App::CellAddress  address,
int  alignment 
)

Set alignment of content in cell at address to alignment.

Parameters
addressAddress of cell
alignmentNew alignment

References cells, and Spreadsheet::PropertySheet::setAlignment().

◆ setBackground()

void Sheet::setBackground ( App::CellAddress  address,
const App::Color color 
)

Set background color of cell at address address to color.

Parameters
addressAddress of cell
colorNew color

References cells, and Spreadsheet::PropertySheet::setBackground().

◆ setCell() [1/2]

void Sheet::setCell ( App::CellAddress  address,
const char *  value 
)

Set cell at address to value.

If a merged cell is specified, the upper right corner of the merged cell must be specified.

Parameters
addressRow position of cell.
valueString value of expression.

References clear(), and setContent().

◆ setCell() [2/2]

void Sheet::setCell ( const char *  address,
const char *  contents 
)

Set cell given by address to contents.

Parameters
addressAddress of cell to set.
contentsNew contents of given cell.

Referenced by importFromFile(), and Spreadsheet::SheetPy::set().

◆ setColumnWidth()

void Sheet::setColumnWidth ( int  col,
int  width 
)

Set column with of column col to width-.

Parameters
colIndex of column.
widthNew width of column.

References columnWidths, and Spreadsheet::PropertyColumnWidths::setValue().

◆ setComputedUnit()

void Sheet::setComputedUnit ( App::CellAddress  address,
const Base::Unit unit 
)

Set computed unit for cell at address address to unit.

Parameters
addressAddress of cell
unitNew unit.

References cells, and Spreadsheet::PropertySheet::setComputedUnit().

◆ setContent()

void Sheet::setContent ( App::CellAddress  address,
const char *  value 
)

Set content of cell at address to value.

Parameters
addressAddress of cell
valueNew value

References cells, and Spreadsheet::PropertySheet::setContent().

Referenced by setCell(), and SpreadsheetGui::SheetModel::setData().

◆ setDisplayUnit()

void Sheet::setDisplayUnit ( App::CellAddress  address,
const std::string &  unit 
)

Set display unit of cell at address address to unit.

Parameters
addressAddress of cell
unitNew unit

References cells, and Spreadsheet::PropertySheet::setDisplayUnit().

◆ setFloatProperty()

Property * Sheet::setFloatProperty ( App::CellAddress  key,
double  value 
)
protected

Set the property for cell key to a PropertyFloat with the value value.

If the Property exists, but of wrong type, the previous Property is destroyed and recreated as the correct type.

Parameters
keyThe address of the cell we want to create a Property for
valueThe value we want to assign to the Property.

References App::DocumentObject::addDynamicProperty(), Base::Persistence::getTypeId(), App::Prop_Hidden, App::Prop_NoPersist, App::Prop_ReadOnly, propAddress, App::DocumentObject::removeDynamicProperty(), App::PropertyFloat::setValue(), and App::CellAddress::toString().

Referenced by updateProperty().

◆ setForeground()

void Sheet::setForeground ( App::CellAddress  address,
const App::Color color 
)

Set foreground (text color) of cell at address address to color.

Parameters
addressAddress of cell
colorNew color

References cells, and Spreadsheet::PropertySheet::setForeground().

◆ setIntegerProperty()

◆ setObjectProperty()

◆ setQuantityProperty()

Property * Sheet::setQuantityProperty ( App::CellAddress  key,
double  value,
const Base::Unit unit 
)
protected

Set the property for cell key to a PropertyQuantity with value and unit.

If the Property exists, but of wrong type, the previous Property is destroyed and recreated as the correct type.

Parameters
keyThe address of the cell we want to create a Property for
valueThe value we want to assign to the Property.
unitThe associated unit for value.

References App::DocumentObject::addDynamicProperty(), cells, Base::Persistence::getClassTypeId(), Base::Persistence::getTypeId(), App::Prop_Hidden, App::Prop_NoPersist, App::Prop_ReadOnly, propAddress, App::DocumentObject::removeDynamicProperty(), Spreadsheet::PropertySheet::setComputedUnit(), App::PropertyQuantity::setUnit(), App::PropertyQuantity::setValue(), and App::CellAddress::toString().

Referenced by updateProperty().

◆ setRowHeight()

void Sheet::setRowHeight ( int  row,
int  height 
)

Set row height of row given by index in row to height.

Parameters
rowRow index.
heightNew height of row.

References rowHeights, and Spreadsheet::PropertyRowHeights::setValue().

◆ setSpans()

void Sheet::setSpans ( App::CellAddress  address,
int  rows,
int  columns 
)

Set row and column span for the cell at address address to rows and columns.

Parameters
addressAddress to upper right corner of cell
rowsRows to span
columnsColumns to span

References cells, and Spreadsheet::PropertySheet::setSpans().

◆ setStringProperty()

Property * Sheet::setStringProperty ( App::CellAddress  key,
const std::string &  value 
)
protected

Set the property for cell key to a PropertyString with value.

If the Property exists, but of wrong type, the previous Property is destroyed and recreated as the correct type.

Parameters
keyThe address of the cell we want to create a Property for
valueThe value we want to assign to the Property.

References App::DocumentObject::addDynamicProperty(), App::Prop_Hidden, App::Prop_NoPersist, App::Prop_ReadOnly, propAddress, App::DocumentObject::removeDynamicProperty(), App::PropertyString::setValue(), and App::CellAddress::toString().

Referenced by recomputeCell(), and updateProperty().

◆ setStyle()

void Sheet::setStyle ( App::CellAddress  address,
const std::set< std::string > &  style 
)

Set style of cell at address to style.

Parameters
addressAddress of cell
styleNew style

References cells, and Spreadsheet::PropertySheet::setStyle().

◆ splitCell()

void Sheet::splitCell ( App::CellAddress  address)

Split a previously merged cell specified by address into its individual cells.

The address can point to any of the cells that make up the merged cell.

Parameters
addressAddress of cell to split

References cells, and Spreadsheet::PropertySheet::splitCell().

◆ touchCells()

void Sheet::touchCells ( App::Range  range)

◆ updateAlias()

◆ updateColumnsOrRows()

◆ updateProperty()

void Sheet::updateProperty ( App::CellAddress  key)
protected

Update the Property given by key.

This will also eventually trigger recomputations of cells depending on key.

Parameters
keyThe address of the cell we want to recompute.

References cellUpdated, clear(), currentCol, currentRow, getCell(), Spreadsheet::Cell::getExpression(), Spreadsheet::Cell::getStringContent(), setFloatProperty(), setIntegerProperty(), setObjectProperty(), setQuantityProperty(), and setStringProperty().

Referenced by recomputeCell().

Friends And Related Function Documentation

◆ PropertySheet

friend class PropertySheet
friend

◆ SheetObserver

friend class SheetObserver
friend

Referenced by observeDocument().

Member Data Documentation

◆ cellErrors

std::set<App::CellAddress> Spreadsheet::Sheet::cellErrors
protected

◆ cells

◆ cellSpanChanged

boost::signals2::signal<void (App::CellAddress)> Spreadsheet::Sheet::cellSpanChanged

◆ cellUpdated

boost::signals2::signal<void (App::CellAddress)> Spreadsheet::Sheet::cellUpdated

◆ columnWidthChanged

boost::signals2::signal<void (int, int)> Spreadsheet::Sheet::columnWidthChanged

Referenced by execute().

◆ columnWidths

PropertyColumnWidths Spreadsheet::Sheet::columnWidths
protected

◆ currentCol

int Spreadsheet::Sheet::currentCol = -1
protected

Referenced by getColumn(), and updateProperty().

◆ currentRow

int Spreadsheet::Sheet::currentRow = -1
protected

Referenced by getRow(), and updateProperty().

◆ observers

ObserverMap Spreadsheet::Sheet::observers
protected

Referenced by clearAll(), and observeDocument().

◆ propAddress

◆ props

◆ removedAliases

std::map<App::CellAddress, std::string> Spreadsheet::Sheet::removedAliases
protected

◆ rowHeightChanged

boost::signals2::signal<void (int, int)> Spreadsheet::Sheet::rowHeightChanged

Referenced by execute().

◆ rowHeights

PropertyRowHeights Spreadsheet::Sheet::rowHeights
protected

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