[ObjectHandler-cvs] ObjectHandler/gensrc/stubs stub.excel.xladdin, NONE, 1.1
Brought to you by:
ericehlers,
nando
From: Eric E. <eri...@us...> - 2006-10-04 03:44:56
|
Update of /cvsroot/objecthandler/ObjectHandler/gensrc/stubs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26836/gensrc/stubs Added Files: stub.excel.xladdin Log Message: restore ohParseField()/ohPack() --- NEW FILE: stub.excel.xladdin --- #include <xlsdk/xlsdkdefines.hpp> #include <ohxl/objecthandlerxl.hpp> #include <ohxl/Register/register.hpp> #include <ohxl/export.hpp> #include <ohxl/conversions.hpp> #include <sstream> // instantiate the object handler singleton ObjHandler::ObjectHandlerXL objectHandler; DLLEXPORT int xlAutoOpen() { static XLOPER xDll; try { Excel(xlGetName, &xDll, 0); %(registerFunctions)s Excel(xlfRegister, 0, 11, &xDll, TempStrNoSize("\x06""ohPack"), // function code name TempStrNoSize("\x03""RP#"), // parameter codes TempStrNoSize("\x06""ohPack"), // function display name TempStrNoSize("\x10""inputRange"), // comma-delimited list of parameter names TempStrNoSize("\x01""1"), // function type (1 = worksheet function) TempStrNoSize("\x0D""ObjectHandler"), // function category TempStrNoSize("\x00"""), // shortcut text (command macros only) TempStrNoSize("\x00"""), // path to help file TempStrNoSize("\x3D""trim #ERR/empty values from bottom/right edges of input range"), // function description TempStrNoSize("\x1D""range of cells to be packed ")); // description of parameter 1 Excel(xlfRegister, 0, 14, &xDll, TempStrNoSize("\x0C""ohParseField"), // function code name TempStrNoSize("\x06""RCNCP#"), // parameter codes TempStrNoSize("\x0C""ohParseField"), // function display name TempStrNoSize("\x19""line,index,type,delimiter"), // comma-delimited list of parameter names TempStrNoSize("\x01""1"), // function type (1 = worksheet function) TempStrNoSize("\x0D""ObjectHandler"), // function category TempStrNoSize("\x00"""), // shortcut text (command macros only) TempStrNoSize("\x00"""), // path to help file TempStrNoSize("\x41""Extract the ith number from a whitespace-delimited list of fields"), // function description TempStrNoSize("\x11""text to be parsed"), // description of parameter 1 TempStrNoSize("\x20""index (1-based) of desired field"), // description of parameter 2 TempStrNoSize("\x21""required datatype (string/number)"), // description of parameter 3 TempStrNoSize("\x29""field delimiter (default is whitespace) ")); // description of parameter 3 Excel(xlFree, 0, 1, &xDll); return 1; } catch (const std::exception &e) { std::ostringstream err; err << "Error loading ObjectHandler: " << e.what(); Excel(xlcAlert, 0, 1, TempStrStl(err.str())); Excel(xlFree, 0, 1, &xDll); return 0; } catch (...) { Excel(xlFree, 0, 1, &xDll); return 0; } } DLLEXPORT int xlAutoClose() { static XLOPER xDll; try { // empty the ObjectHandler repository Excel(xlUDF, 0, 1, TempStrNoSize("\x12""ohDeleteAllObjects")); // unregister the addin functions Excel(xlGetName, &xDll, 0); %(registerFunctions)s Excel(xlfRegister, 0, 11, &xDll, TempStrNoSize("\x06""ohPack"), // function code name TempStrNoSize("\x03""RP#"), // parameter codes TempStrNoSize("\x06""ohPack"), // function display name TempStrNoSize("\x10""inputRange"), // comma-delimited list of parameter names TempStrNoSize("\x01""0"), // function type (0 = hidden function) TempStrNoSize("\x0D""ObjectHandler"), // function category TempStrNoSize("\x00"""), // shortcut text (command macros only) TempStrNoSize("\x00"""), // path to help file TempStrNoSize("\x3D""trim #ERR/empty values from bottom/right edges of input range"), // function description TempStrNoSize("\x1D""range of cells to be packed ")); // description of parameter 1 Excel4(xlfRegisterId, &xlRegID, 2, &xDll, TempStrNoSize("\x06""ohPack")); // function code name Excel4(xlfUnregister, 0, 1, &xlRegID); Excel(xlfRegister, 0, 14, &xDll, TempStrNoSize("\x0C""ohParseField"), // function code name TempStrNoSize("\x06""RCNCP#"), // parameter codes TempStrNoSize("\x0C""ohParseField"), // function display name TempStrNoSize("\x19""line,index,type,delimiter"), // comma-delimited list of parameter names TempStrNoSize("\x01""0"), // function type (0 = hidden function) TempStrNoSize("\x0D""ObjectHandler"), // function category TempStrNoSize("\x00"""), // shortcut text (command macros only) TempStrNoSize("\x00"""), // path to help file TempStrNoSize("\x41""Extract the ith number from a whitespace-delimited list of fields"), // function description TempStrNoSize("\x11""text to be parsed"), // description of parameter 1 TempStrNoSize("\x20""index (1-based) of desired field"), // description of parameter 2 TempStrNoSize("\x21""required datatype (string/number)"), // description of parameter 3 TempStrNoSize("\x29""field delimiter (default is whitespace) ")); // description of parameter 3 Excel4(xlfRegisterId, &xlRegID, 2, &xDll, TempStrNoSize("\x0C""ohParseField")); // function code name Excel4(xlfUnregister, 0, 1, &xlRegID); Excel(xlFree, 0, 1, &xDll); return 1; } catch (...) { Excel(xlFree, 0, 1, &xDll); return 0; } } DLLEXPORT void xlAutoFree(XLOPER *px) { if (px->xltype & xltypeStr && px->val.str) delete [] px->val.str; else if (px->xltype & xltypeMulti && px->val.array.lparray) { int size = px->val.array.rows * px->val.array.columns; for (int i=0; i<size; i++) if (px->val.array.lparray[i].xltype & xltypeStr && px->val.array.lparray[i].val.str) delete [] px->val.array.lparray[i].val.str; delete [] px->val.array.lparray; } } DLLEXPORT XLOPER *xlAddInManagerInfo(XLOPER *xlAction) { XLOPER xlReturn; static XLOPER xlLongName; // Coerce the argument XLOPER to an integer. Excel(xlCoerce, &xlReturn, 2, xlAction, TempInt(xltypeInt)); // The only valid argument value is 1. In this case we return the // long name for the XLL. Any other value should result in the // return of a #VALUE! error. if (1 == xlReturn.val.w) { ObjHandler::scalarToXloper(xlLongName, std::string("ObjectHandler 0.1.4")); } else { xlLongName.xltype = xltypeErr; xlLongName.val.err = xlerrValue; } return &xlLongName; } |