| 3380 | } |
| 3381 | |
| 3382 | Range RangeExpression::getRange() const |
| 3383 | { |
| 3384 | auto c1 = stringToAddress(begin.c_str(),true); |
| 3385 | auto c2 = stringToAddress(end.c_str(),true); |
| 3386 | if(c1.isValid() && c2.isValid()) |
| 3387 | return Range(c1,c2); |
| 3388 | |
| 3389 | Base::PyGILStateLocker lock; |
| 3390 | static const std::string attr("getCellFromAlias"); |
| 3391 | Py::Object pyobj(owner->getPyObject(),true); |
| 3392 | if(!pyobj.hasAttr(attr)) |
| 3393 | EXPR_THROW("Invalid cell range " << begin << ':' << end); |
| 3394 | Py::Callable callable(pyobj.getAttr(attr)); |
| 3395 | if(!c1.isValid()) { |
| 3396 | try { |
| 3397 | Py::Tuple arg(1); |
| 3398 | arg.setItem(0,Py::String(begin)); |
| 3399 | c1 = CellAddress(callable.apply(arg).as_string().c_str()); |
| 3400 | } catch(Py::Exception &) { |
| 3401 | _EXPR_PY_THROW("Invalid cell address '" << begin << "': ",this); |
| 3402 | } catch(Base::Exception &e) { |
| 3403 | _EXPR_RETHROW(e,"Invalid cell address '" << begin << "': ",this); |
| 3404 | } |
| 3405 | } |
| 3406 | if(!c2.isValid()) { |
| 3407 | try { |
| 3408 | Py::Tuple arg(1); |
| 3409 | arg.setItem(0,Py::String(end)); |
| 3410 | c2 = CellAddress(callable.apply(arg).as_string().c_str()); |
| 3411 | } catch(Py::Exception &) { |
| 3412 | _EXPR_PY_THROW("Invalid cell address '" << end << "': ", this); |
| 3413 | } catch(Base::Exception &e) { |
| 3414 | _EXPR_RETHROW(e,"Invalid cell address '" << end << "': ", this); |
| 3415 | } |
| 3416 | } |
| 3417 | return Range(c1,c2); |
| 3418 | } |
| 3419 | |
| 3420 | bool RangeExpression::_renameObjectIdentifier( |
| 3421 | const std::map<ObjectIdentifier,ObjectIdentifier> &paths, |
no test coverage detected