summaryrefslogtreecommitdiff
path: root/extensions/source/activex/main
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2003-04-15 15:15:39 +0000
committerVladimir Glazounov <vg@openoffice.org>2003-04-15 15:15:39 +0000
commitb9c3f582d923218080707eea96edcc1763e5e0b4 (patch)
tree004b7af048e516f36298aae18211205b10a35040 /extensions/source/activex/main
parentdead77d548adf603c78e6b68a15a846decfc9b24 (diff)
INTEGRATION: CWS dbgmacros1 (1.6.68); FILE MERGED
2003/04/09 10:54:42 kso 1.6.68.1: #108413# - debug macro unification.
Diffstat (limited to 'extensions/source/activex/main')
-rw-r--r--extensions/source/activex/main/SOActiveX.cpp234
1 files changed, 117 insertions, 117 deletions
diff --git a/extensions/source/activex/main/SOActiveX.cpp b/extensions/source/activex/main/SOActiveX.cpp
index 51cbd2438..749f9b280 100644
--- a/extensions/source/activex/main/SOActiveX.cpp
+++ b/extensions/source/activex/main/SOActiveX.cpp
@@ -14,24 +14,24 @@
void OutputError_Impl( HWND hw, DWORD ErrorCode )
{
void* sMessage;
- FormatMessageA(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FormatMessageA(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &sMessage,
0,
- NULL
+ NULL
);
MessageBoxA( hw, (LPCTSTR)sMessage, NULL, MB_OK | MB_ICONINFORMATION );
LocalFree( sMessage );
}
-HRESULT ExecuteFunc( IDispatch* idispUnoObject,
- OLECHAR* sFuncName,
- CComVariant* params,
- unsigned int count,
+HRESULT ExecuteFunc( IDispatch* idispUnoObject,
+ OLECHAR* sFuncName,
+ CComVariant* params,
+ unsigned int count,
CComVariant* pResult )
{
if( !idispUnoObject )
@@ -45,14 +45,14 @@ HRESULT ExecuteFunc( IDispatch* idispUnoObject,
// DEBUG
EXCEPINFO myInfo;
- return idispUnoObject->Invoke( id, IID_NULL,LOCALE_USER_DEFAULT, DISPATCH_METHOD,
+ return idispUnoObject->Invoke( id, IID_NULL,LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dispparams, pResult, &myInfo, 0);
}
-HRESULT GetIDispByFunc( IDispatch* idispUnoObject,
- OLECHAR* sFuncName,
- CComVariant* params,
- unsigned int count,
+HRESULT GetIDispByFunc( IDispatch* idispUnoObject,
+ OLECHAR* sFuncName,
+ CComVariant* params,
+ unsigned int count,
CComPtr<IDispatch>& pdispResult )
{
if( !idispUnoObject )
@@ -70,9 +70,9 @@ HRESULT GetIDispByFunc( IDispatch* idispUnoObject,
return S_OK;
}
-HRESULT PutPropertiesToIDisp( IDispatch* pdispObject,
- OLECHAR** sMemberNames,
- CComVariant* pVariant,
+HRESULT PutPropertiesToIDisp( IDispatch* pdispObject,
+ OLECHAR** sMemberNames,
+ CComVariant* pVariant,
unsigned int count )
{
for( unsigned int ind = 0; ind < count; ind++ )
@@ -88,9 +88,9 @@ HRESULT PutPropertiesToIDisp( IDispatch* pdispObject,
return S_OK;
}
-HRESULT GetPropertiesFromIDisp( IDispatch* pdispObject,
- OLECHAR** sMemberNames,
- CComVariant* pVariant,
+HRESULT GetPropertiesFromIDisp( IDispatch* pdispObject,
+ OLECHAR** sMemberNames,
+ CComVariant* pVariant,
unsigned int count )
{
for( unsigned int ind = 0; ind < count; ind++ )
@@ -118,20 +118,20 @@ CSOActiveX::CSOActiveX()
, mpDispatchInterceptor( NULL )
, mnVersion( SO_NOT_DETECTED )
{
- CLSID clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}};
+ CLSID clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}};
HRESULT hr = CoCreateInstance( clsFactory, NULL, CLSCTX_ALL, __uuidof(IDispatch), (void**)&mpDispFactory);
if( !SUCCEEDED( hr ) )
OutputError_Impl( NULL, hr );
-
- mPWinClass.style = CS_HREDRAW|CS_VREDRAW;
- mPWinClass.lpfnWndProc = ::DefWindowProc;
- mPWinClass.cbClsExtra = 0;
- mPWinClass.cbWndExtra = 0;
- mPWinClass.hInstance = (HINSTANCE) GetModuleHandle(NULL); //myInstance;
- mPWinClass.hIcon = NULL;
- mPWinClass.hCursor = NULL;
- mPWinClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
- mPWinClass.lpszMenuName = NULL;
+
+ mPWinClass.style = CS_HREDRAW|CS_VREDRAW;
+ mPWinClass.lpfnWndProc = ::DefWindowProc;
+ mPWinClass.cbClsExtra = 0;
+ mPWinClass.cbWndExtra = 0;
+ mPWinClass.hInstance = (HINSTANCE) GetModuleHandle(NULL); //myInstance;
+ mPWinClass.hIcon = NULL;
+ mPWinClass.hCursor = NULL;
+ mPWinClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
+ mPWinClass.lpszMenuName = NULL;
mPWinClass.lpszClassName = STAROFFICE_WINDOWCLASS;
RegisterClass(&mPWinClass);
@@ -155,10 +155,10 @@ HRESULT CSOActiveX::Cleanup()
{
// remove dispatch interceptor
CComQIPtr< IDispatch, &IID_IDispatch > pIDispDispInter( mpDispatchInterceptor );
- ExecuteFunc( mpDispFrame,
- L"releaseDispatchProviderInterceptor",
- &CComVariant( pIDispDispInter ),
- 1,
+ ExecuteFunc( mpDispFrame,
+ L"releaseDispatchProviderInterceptor",
+ &CComVariant( pIDispDispInter ),
+ 1,
&dummyResult );
mpDispatchInterceptor->Release();
mpDispatchInterceptor = NULL;
@@ -194,7 +194,7 @@ STDMETHODIMP CSOActiveX::Load ( LPSTREAM pStm )
// may be later?
// for now just ignore
-
+
return S_OK;
}
@@ -204,25 +204,25 @@ STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog )
IPropertyBag2* pPropBag2;
HRESULT hr = pPropBag->QueryInterface( IID_IPropertyBag2, (void**)&pPropBag2 );
- ATLASSERT( hr >= 0 );
-
+ //ATLASSERT( hr >= 0 );
+
if( !SUCCEEDED( hr ) )
return hr;
-
+
unsigned long aNum;
hr = pPropBag2->CountProperties( &aNum );
- ATLASSERT( hr >= 0 );
+ //ATLASSERT( hr >= 0 );
if( !SUCCEEDED( hr ) )
return hr;
-
+
PROPBAG2* aPropNames = new PROPBAG2[aNum];
unsigned long aReaded;
-
+
hr = pPropBag2->GetPropertyInfo( 0,
aNum,
aPropNames,
&aReaded );
- ATLASSERT( hr >= 0 );
+ //ATLASSERT( hr >= 0 );
if( !SUCCEEDED( hr ) )
{
delete[] aPropNames;
@@ -234,9 +234,9 @@ STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog )
hr = pPropBag2->Read( aNum,
aPropNames,
NULL,
- aVal,
+ aVal,
hvs );
- ATLASSERT( hr >= 0 );
+ //ATLASSERT( hr >= 0 );
if( !SUCCEEDED( hr ) )
{
delete[] hvs;
@@ -253,7 +253,7 @@ STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog )
{
mCurFileUrl = wcsdup( aVal[ind].bstrVal );
}
- else if( aVal[ind].vt == VT_BSTR
+ else if( aVal[ind].vt == VT_BSTR
&& !strcmp( OLE2T( aPropNames[ind].pstrName ), "readonly" ) )
{
if( !strcmp( OLE2T( aVal[ind].bstrVal ), "true" ) )
@@ -274,10 +274,10 @@ STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog )
if( !mpDispFactory )
return hr;
-
+
mbLoad = TRUE;
- Invalidate();
+ Invalidate();
UpdateWindow();
return hr;
@@ -301,10 +301,10 @@ HRESULT CSOActiveX::GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl )
if( !SUCCEEDED( hr ) ) return hr;
CComPtr<IDispatch> pdispTransformer;
- hr = GetIDispByFunc( mpDispFactory,
- L"createInstance",
- &CComVariant( L"com.sun.star.util.URLTransformer" ),
- 1,
+ hr = GetIDispByFunc( mpDispFactory,
+ L"createInstance",
+ &CComVariant( L"com.sun.star.util.URLTransformer" ),
+ 1,
pdispTransformer );
if( !SUCCEEDED( hr ) ) return hr;
@@ -336,9 +336,9 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height )
HRESULT hr = GetUnoStruct( L"com.sun.star.awt.Rectangle", pdispRectangle );
if( !SUCCEEDED( hr ) ) return hr;
- OLECHAR* sRectMemberNames[4] = { L"X",
- L"Y",
- L"Width",
+ OLECHAR* sRectMemberNames[4] = { L"X",
+ L"Y",
+ L"Width",
L"Height" };
CComVariant pRectVariant[4];
pRectVariant[0] = pRectVariant[1] = pRectVariant[2] = pRectVariant[3] = CComVariant( 0 );
@@ -352,10 +352,10 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height )
if( !SUCCEEDED( hr ) ) return hr;
// fill in descriptor with info
- OLECHAR* sDescriptorMemberNames[6] = { L"Type",
- L"WindowServiceName",
- L"ParentIndex",
- L"Parent",
+ OLECHAR* sDescriptorMemberNames[6] = { L"Type",
+ L"WindowServiceName",
+ L"ParentIndex",
+ L"Parent",
L"Bounds",
L"WindowAttributes" };
CComVariant pDescriptorVar[6];
@@ -409,7 +409,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height )
// initialize window
hr = ExecuteFunc( mpDispWin, L"setBackground", &CComVariant( (long)0xFFFFFFFF ), 1, &dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
-
+
hr = ExecuteFunc( mpDispWin, L"setVisible", &CComVariant( TRUE ), 1, &dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
@@ -441,7 +441,7 @@ HRESULT CSOActiveX::CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArg
if( !SUCCEEDED( hr ) ) return hr;
SafeArrayPutElement( pPropVals, &ix, pdispPropVal );
-
+
CComVariant aDispArgs[4];
aDispArgs[3] = CComVariant( sUrl );
aDispArgs[2] = CComVariant( L"_self" );
@@ -456,9 +456,9 @@ HRESULT CSOActiveX::CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArg
return S_OK;
}
-HRESULT CSOActiveX::CallDispatchMethod( OLECHAR* sUrl,
- CComVariant* aArgNames,
- CComVariant* aArgVals,
+HRESULT CSOActiveX::CallDispatchMethod( OLECHAR* sUrl,
+ CComVariant* aArgNames,
+ CComVariant* aArgVals,
unsigned int count )
{
CComPtr<IDispatch> pdispURL;
@@ -470,10 +470,10 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR* sUrl,
aArgs[2] = CComVariant( pdispURL );
aArgs[1] = CComVariant( L"" );
aArgs[0] = CComVariant( (int)0 );
- hr = GetIDispByFunc( mpDispFrame,
- L"queryDispatch",
- aArgs,
- 3,
+ hr = GetIDispByFunc( mpDispFrame,
+ L"queryDispatch",
+ aArgs,
+ 3,
pdispXDispatch );
if( !SUCCEEDED( hr ) ) return hr;
@@ -493,7 +493,7 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR* sUrl,
SafeArrayPutElement( pPropVals, &ix, pdispPropVal );
}
-
+
CComVariant aDispArgs[2];
aDispArgs[1] = CComVariant( pdispURL );
// aDispArgs[0] = CComVariant( pPropVals ); such constructor is not defined ??!
@@ -520,7 +520,7 @@ HRESULT CSOActiveX::LoadURLToFrame( )
aBarVis.vt = VT_BOOL; aBarVis.boolVal = VARIANT_FALSE;
hr = CallDispatchMethod( L"slot:6661", &aBarName, &aBarVis, 1 );
if( !SUCCEEDED( hr ) ) return hr;
-
+
/*
// create dispatch interceptor
mpDispatchInterceptor = new CComObject< SODispatchInterceptor >();
@@ -530,10 +530,10 @@ HRESULT CSOActiveX::LoadURLToFrame( )
// register dispatch interceptor in the frame
CComVariant dummyResult;
- hr = ExecuteFunc( mpDispFrame,
- L"registerDispatchProviderInterceptor",
- &CComVariant( pIDispDispInter ),
- 1,
+ hr = ExecuteFunc( mpDispFrame,
+ L"registerDispatchProviderInterceptor",
+ &CComVariant( pIDispDispInter ),
+ 1,
&dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
@@ -541,7 +541,7 @@ HRESULT CSOActiveX::LoadURLToFrame( )
return S_OK;
}
-
+
SOVersion CSOActiveX::GetVersionConnected()
{
SOVersion bResult = SO_NOT_DETECTED;
@@ -549,12 +549,12 @@ SOVersion CSOActiveX::GetVersionConnected()
{
// create ConfigurationProvider instance
CComPtr<IDispatch> pdispConfProv;
- HRESULT hr = GetIDispByFunc( mpDispFactory,
- L"createInstance",
- &CComVariant( L"com.sun.star.configuration.ConfigurationProvider" ),
- 1,
+ HRESULT hr = GetIDispByFunc( mpDispFactory,
+ L"createInstance",
+ &CComVariant( L"com.sun.star.configuration.ConfigurationProvider" ),
+ 1,
pdispConfProv );
-
+
if( SUCCEEDED( hr ) && pdispConfProv )
{
CComPtr<IDispatch> pdispConfAccess;
@@ -566,37 +566,37 @@ SOVersion CSOActiveX::GetVersionConnected()
long ix = 0;
CComVariant aConfPath( L"org.openoffice.Setup" );
SafeArrayPutElement( pInitParams, &ix, &aConfPath );
-
+
CComVariant aArgs[2];
aArgs[1] = CComVariant( L"com.sun.star.configuration.ConfigurationAccess" );
aArgs[0].vt = VT_ARRAY | VT_VARIANT; aArgs[0].parray = pInitParams;
- hr = GetIDispByFunc( pdispConfProv,
+ hr = GetIDispByFunc( pdispConfProv,
L"createInstanceWithArguments",
aArgs,
- 2,
+ 2,
pdispConfAccess );
-
+
if( SUCCEEDED( hr ) && pdispConfAccess )
{
CComVariant aOfficeName;
- hr = ExecuteFunc( pdispConfAccess,
- L"getByHierarchicalName",
- &CComVariant( L"Product/ooName" ),
+ hr = ExecuteFunc( pdispConfAccess,
+ L"getByHierarchicalName",
+ &CComVariant( L"Product/ooName" ),
1,
&aOfficeName );
-
+
if( SUCCEEDED( hr ) && aOfficeName.vt == VT_BSTR )
{
CComVariant aOfficeVersion;
- hr = ExecuteFunc( pdispConfAccess,
- L"getByHierarchicalName",
- &CComVariant( L"Product/ooSetupVersion" ),
+ hr = ExecuteFunc( pdispConfAccess,
+ L"getByHierarchicalName",
+ &CComVariant( L"Product/ooSetupVersion" ),
1,
&aOfficeVersion );
-
+
if( SUCCEEDED( hr ) && aOfficeVersion.vt == VT_BSTR )
{
USES_CONVERSION;
@@ -608,7 +608,7 @@ SOVersion CSOActiveX::GetVersionConnected()
bResult = SO_60;
else if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "5.2", 3 ) )
bResult = SO_52;
- else
+ else
bResult = SO_UNKNOWN;
}
else // OpenOffice
@@ -617,7 +617,7 @@ SOVersion CSOActiveX::GetVersionConnected()
bResult = OO_11;
else if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "1.0", 3 ) )
bResult = OO_10;
- else
+ else
bResult = OO_UNKNOWN;
}
}
@@ -648,7 +648,7 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di )
}
mParentWin = hwnd;
- mOffWin = CreateWindow(
+ mOffWin = CreateWindow(
STAROFFICE_WINDOWCLASS,
"OfficeContainer",
WS_CHILD | WS_CLIPCHILDREN | WS_BORDER,
@@ -667,16 +667,16 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di )
{
RECT aRect;
::GetWindowRect( mOffWin, &aRect );
-
+
if( aRect.left != di.prcBounds->left || aRect.top != di.prcBounds->top
|| aRect.right != di.prcBounds->right || aRect.bottom != di.prcBounds->bottom )
{
// on this state the office window should exist already
::SetWindowPos( mOffWin,
HWND_TOP,
- di.prcBounds->left,
- di.prcBounds->top,
- di.prcBounds->right - di.prcBounds->left,
+ di.prcBounds->left,
+ di.prcBounds->top,
+ di.prcBounds->right - di.prcBounds->left,
di.prcBounds->bottom - di.prcBounds->top,
SWP_NOZORDER );
@@ -690,20 +690,20 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di )
hr = ExecuteFunc( mpDispWin, L"setPosSize", aPosArgs, 5, &dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
}
- }
+ }
if( !mnVersion )
{
OutputError_Impl( mOffWin, CS_E_INVALID_VERSION );
return E_FAIL;
}
-
+
if( ! mpDispFrame )
{
hr = CreateFrameOldWay( mOffWin,
di.prcBounds->right - di.prcBounds->left,
di.prcBounds->bottom - di.prcBounds->top );
- if( !SUCCEEDED( hr ) )
+ if( !SUCCEEDED( hr ) )
{
OutputError_Impl( mOffWin, STG_E_ABNORMALAPIEXIT );
return hr;
@@ -713,7 +713,7 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di )
if( mbLoad )
{
hr = LoadURLToFrame();
- if( !SUCCEEDED( hr ) )
+ if( !SUCCEEDED( hr ) )
{
OutputError_Impl( mOffWin, STG_E_ABNORMALAPIEXIT );
return hr;
@@ -732,7 +732,7 @@ STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aClientSite )
if( !aClientSite )
{
- ATLASSERT( mWebBrowser2 );
+ //ATLASSERT( mWebBrowser2 );
if( mWebBrowser2 )
AtlUnadvise( mWebBrowser2, DIID_DWebBrowserEvents2, mCookie );
return hr;
@@ -740,19 +740,19 @@ STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aClientSite )
CComPtr<IOleContainer> aContainer;
m_spClientSite->GetContainer( &aContainer );
- ATLASSERT( aContainer );
+// ATLASSERT( aContainer );
if( SUCCEEDED( hr ) && aContainer )
{
CComQIPtr<IServiceProvider, &IID_IServiceProvider> aServiceProvider( aContainer );
- ATLASSERT( aServiceProvider );
+ //ATLASSERT( aServiceProvider );
if( aServiceProvider )
{
aServiceProvider->QueryService( SID_SInternetExplorer,
IID_IWebBrowser,
(void**)&mWebBrowser2 );
- ATLASSERT( mWebBrowser2 );
+// ATLASSERT( mWebBrowser2 );
if( mWebBrowser2 )
AtlAdvise( mWebBrowser2, GetUnknown(), DIID_DWebBrowserEvents2, &mCookie );
}
@@ -761,12 +761,12 @@ STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aClientSite )
return hr;
}
-STDMETHODIMP CSOActiveX::Invoke(DISPID dispidMember,
- REFIID riid,
- LCID lcid,
- WORD wFlags,
+STDMETHODIMP CSOActiveX::Invoke(DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
DISPPARAMS* pDispParams,
- VARIANT* pvarResult,
+ VARIANT* pvarResult,
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
@@ -778,8 +778,8 @@ STDMETHODIMP CSOActiveX::Invoke(DISPID dispidMember,
if ( dispidMember == DISPID_ONQUIT )
Cleanup();
-
- IDispatchImpl<ISOActiveX, &IID_ISOActiveX,
+
+ IDispatchImpl<ISOActiveX, &IID_ISOActiveX,
&LIBID_SO_ACTIVEXLib>::Invoke(
dispidMember, riid, lcid, wFlags, pDispParams,
pvarResult, pExcepInfo, puArgErr);
@@ -787,13 +787,13 @@ STDMETHODIMP CSOActiveX::Invoke(DISPID dispidMember,
return S_OK;
}
-HRESULT CSOActiveX::GetURL( const OLECHAR* url,
+HRESULT CSOActiveX::GetURL( const OLECHAR* url,
const OLECHAR* target )
{
- return mWebBrowser2->Navigate2( &CComVariant( url ),
- &CComVariant(),
- &CComVariant( target ),
- &CComVariant(),
+ return mWebBrowser2->Navigate2( &CComVariant( url ),
+ &CComVariant(),
+ &CComVariant( target ),
+ &CComVariant(),
&CComVariant() );
}