Update of /cvsroot/objecthandler/ObjectHandler/ohxl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16507/ohxl
Modified Files:
functioncall.cpp functioncall.hpp
Log Message:
new XML tag "noXlWizardRecalc" to suppress execution of function when called from Function Wizard
Index: functioncall.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/functioncall.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** functioncall.cpp 11 Jun 2006 12:38:22 -0000 1.6
--- functioncall.cpp 14 Jun 2006 15:25:57 -0000 1.7
***************
*** 2,5 ****
--- 2,6 ----
/*
Copyright (C) 2006 Eric Ehlers
+ Copyright (C) 1998, 1999, 2001, 2002 Jérôme Lecomte
This file is part of QuantLib, a free-software/open-source library
***************
*** 121,123 ****
--- 122,163 ----
}
+
+ // code to determine whether we've been called from the Excel function wizard
+ // taken from xlw by Jérôme Lecomte
+
+ typedef struct _EnumStruct {
+ bool bFuncWiz;
+ short hwndXLMain;
+ }
+ EnumStruct, FAR * LPEnumStruct;
+
+ bool CALLBACK EnumProc(HWND hwnd, LPEnumStruct pEnum) {
+ const size_t CLASS_NAME_BUFFER = 50;
+ // first check the class of the window. Will be szXLDialogClass
+ // if function wizard dialog is up in Excel
+ char rgsz[CLASS_NAME_BUFFER];
+ GetClassName(hwnd, (LPSTR)rgsz, CLASS_NAME_BUFFER);
+ if (2 == CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH,
+ SUBLANG_ENGLISH_US),SORT_DEFAULT), NORM_IGNORECASE,
+ (LPSTR)rgsz, (lstrlen((LPSTR)rgsz)>lstrlen("bosa_sdm_XL"))
+ ? lstrlen("bosa_sdm_XL"):-1, "bosa_sdm_XL", -1)) {
+ if(LOWORD((DWORD) GetParent(hwnd)) == pEnum->hwndXLMain) {
+ pEnum->bFuncWiz = TRUE;
+ return false;
+ }
+ }
+ // no luck - continue the enumeration
+ return true;
+ }
+
+ bool FunctionCall::IsCalledByFuncWiz() {
+ XLOPER xHwndMain;
+ EnumStruct enm;
+ Excel(xlGetHwnd, &xHwndMain, 0);
+ enm.bFuncWiz = false;
+ enm.hwndXLMain = xHwndMain.val.w;
+ EnumWindows((WNDENUMPROC) EnumProc, (LPARAM) ((LPEnumStruct) &enm));
+ return enm.bFuncWiz;
+ }
+
}
Index: functioncall.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/functioncall.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** functioncall.hpp 11 Jun 2006 12:38:22 -0000 1.4
--- functioncall.hpp 14 Jun 2006 15:25:57 -0000 1.5
***************
*** 2,5 ****
--- 2,6 ----
/*
Copyright (C) 2006 Eric Ehlers
+ Copyright (C) 1998, 1999, 2001, 2002 Jérôme Lecomte
This file is part of QuantLib, a free-software/open-source library
***************
*** 50,53 ****
--- 51,55 ----
//bool outerFunction();
CallerDimensions getCallerDimensions();
+ bool IsCalledByFuncWiz();
private:
static FunctionCall *instance_;
|