MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / _offsetCells

Method _offsetCells

src/App/Expression.cpp:3069–3091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3067}
3068
3069void VariableExpression::_offsetCells(int rowOffset, int colOffset, ExpressionVisitor &v) {
3070 if(var.hasDocumentObjectName(true))
3071 return;
3072
3073 int idx = 0;
3074 const auto &comp = var.getPropertyComponent(0,&idx);
3075 CellAddress addr = stringToAddress(comp.getName().c_str(),true);
3076 if(!addr.isValid() || (addr.isAbsoluteCol() && addr.isAbsoluteRow()))
3077 return;
3078
3079 if(!addr.isAbsoluteCol())
3080 addr.setCol(addr.col()+colOffset);
3081 if(!addr.isAbsoluteRow())
3082 addr.setRow(addr.row()+rowOffset);
3083 if(!addr.isValid()) {
3084 FC_WARN("Not changing relative cell reference '"
3085 << comp.getName() << "' due to invalid offset "
3086 << '(' << colOffset << ", " << rowOffset << ')');
3087 } else {
3088 v.aboutToChange();
3089 var.setComponent(idx,ObjectIdentifier::SimpleComponent(addr.toString()));
3090 }
3091}
3092
3093void VariableExpression::setPath(const ObjectIdentifier &path)
3094{

Callers 1

offsetCellsMethod · 0.80

Calls 12

SimpleComponentFunction · 0.85
hasDocumentObjectNameMethod · 0.80
colMethod · 0.80
setComponentMethod · 0.80
c_strMethod · 0.45
getNameMethod · 0.45
isValidMethod · 0.45
setColMethod · 0.45
setRowMethod · 0.45
rowMethod · 0.45
aboutToChangeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected