Esempio n. 1
0
int xlw::XlfOper4::ConvertToRef(XlfRef& r) const throw()
{
    int xlret;

    if (lpxloper_ == 0)
        return xlretInvXloper;

    if (lpxloper_->xltype & xltypeRef)
    {
        const XLREF& ref=lpxloper_->val.mref.lpmref->reftbl[0];
        r = XlfRef (ref.rwFirst,  // top
                    ref.colFirst, // left
                    ref.rwLast,   // bottom
                    ref.colLast,  // right
                    lpxloper_->val.mref.idSheet); // sheet id
        xlret = xlretSuccess;
    }
    else
    {
        // see AsDouble
        XLOPER tmp;
        // Function Coerce calls function Call which sets bit xlbitFreeAuxMem of variable cast,
        // so that the memory which Excel allocates to that variable (the reference) is freed
        // when the variable goes out of scope.
        XlfOper4 cast(&tmp);
        xlret = Coerce(xltypeRef,cast);
        if (xlret == xlretSuccess)
            xlret = cast.ConvertToRef(r);
    }
    return xlret;
}
Esempio n. 2
0
/*!
\note In debug build, generates a message if the request is in the range.
*/
XlfOper XlfRef::operator()(WORD r, BYTE c) const
{
#if !defined(NDEBUG)
	if (rowbegin_ + r > rowend_ || colbegin_ + c > colend_)
  {
    std::cerr << __HERE__ << "XlfRef access out of range" << std::endl;
  }
#endif
	XlfOper res;
	res.Set(XlfRef(rowbegin_ + r, colbegin_ + c, sheetId_));
	return res;
}