xref: /aoo42x/main/ucb/source/ucp/odma/odma_lib.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_ucb.hxx"
30*cdf0e10cSrcweir //#ifndef _OSL_PROCESS_H_
31*cdf0e10cSrcweir //#include <osl/process.h>
32*cdf0e10cSrcweir //#endif
33*cdf0e10cSrcweir #include <osl/module.h>
34*cdf0e10cSrcweir #include <rtl/ustring.hxx>
35*cdf0e10cSrcweir #include "odma_lib.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace odma
39*cdf0e10cSrcweir {
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 	TODMRegisterApp			pODMRegisterApp;
42*cdf0e10cSrcweir 	TODMUnRegisterApp		pODMUnRegisterApp;
43*cdf0e10cSrcweir 	TODMSelectDoc			pODMSelectDoc;
44*cdf0e10cSrcweir 	TODMOpenDoc				pODMOpenDoc;
45*cdf0e10cSrcweir 	TODMSaveDoc				pODMSaveDoc;
46*cdf0e10cSrcweir 	TODMCloseDoc			pODMCloseDoc;
47*cdf0e10cSrcweir 	TODMNewDoc				pODMNewDoc;
48*cdf0e10cSrcweir 	TODMSaveAs				pODMSaveAs;
49*cdf0e10cSrcweir 	TODMActivate			pODMActivate;
50*cdf0e10cSrcweir 	TODMGetDocInfo			pODMGetDocInfo;
51*cdf0e10cSrcweir 	TODMSetDocInfo			pODMSetDocInfo;
52*cdf0e10cSrcweir 	TODMGetDMSInfo			pODMGetDMSInfo;
53*cdf0e10cSrcweir 	TODMGetDMSCount			pODMGetDMSCount;
54*cdf0e10cSrcweir 	TODMGetDMSList			pODMGetDMSList;
55*cdf0e10cSrcweir 	TODMGetDMS				pODMGetDMS;
56*cdf0e10cSrcweir 	TODMSetDMS				pODMSetDMS;
57*cdf0e10cSrcweir 	TODMQueryExecute		pODMQueryExecute;
58*cdf0e10cSrcweir 	TODMQueryGetResults		pODMQueryGetResults;
59*cdf0e10cSrcweir 	TODMQueryClose			pODMQueryClose;
60*cdf0e10cSrcweir 	TODMCloseDocEx			pODMCloseDocEx;
61*cdf0e10cSrcweir 	TODMSaveAsEx			pODMSaveAsEx;
62*cdf0e10cSrcweir 	TODMSaveDocEx			pODMSaveDocEx;
63*cdf0e10cSrcweir 	TODMSelectDocEx			pODMSelectDocEx;
64*cdf0e10cSrcweir 	TODMQueryCapability		pODMQueryCapability;
65*cdf0e10cSrcweir 	TODMSetDocEvent			pODMSetDocEvent;
66*cdf0e10cSrcweir 	TODMGetAlternateContent pODMGetAlternateContent;
67*cdf0e10cSrcweir 	TODMSetAlternateContent pODMSetAlternateContent;
68*cdf0e10cSrcweir 	TODMGetDocRelation		pODMGetDocRelation;
69*cdf0e10cSrcweir 	TODMSetDocRelation		pODMSetDocRelation;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	sal_Bool LoadFunctions(oslModule _pODMA);
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 	sal_Bool LoadLibrary()
74*cdf0e10cSrcweir 	{
75*cdf0e10cSrcweir 		static sal_Bool bLoaded = sal_False;
76*cdf0e10cSrcweir 		static oslModule pODMA = NULL;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 		if (bLoaded)
79*cdf0e10cSrcweir 			return sal_True;
80*cdf0e10cSrcweir 		::rtl::OUString sPath;
81*cdf0e10cSrcweir 	#ifdef WNT
82*cdf0e10cSrcweir 		sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
83*cdf0e10cSrcweir 	#endif
84*cdf0e10cSrcweir 	#ifdef UNX
85*cdf0e10cSrcweir 		sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodma.so"));
86*cdf0e10cSrcweir 	#endif
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 		pODMA = osl_loadModule( sPath.pData,SAL_LOADMODULE_NOW );
89*cdf0e10cSrcweir 		if( !pODMA)
90*cdf0e10cSrcweir 			return sal_False;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 		return bLoaded = LoadFunctions(pODMA);
93*cdf0e10cSrcweir 	}
94*cdf0e10cSrcweir 	// -------------------------------------------------------------------------
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	sal_Bool LoadFunctions(oslModule pODMA)
97*cdf0e10cSrcweir 	{
98*cdf0e10cSrcweir 		if ( ( pODMRegisterApp = (TODMRegisterApp)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMRegisterApp")).pData)) == NULL ) return sal_False;
99*cdf0e10cSrcweir 		if ( ( pODMUnRegisterApp = (TODMUnRegisterApp)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMUnRegisterApp")).pData)) == NULL ) return sal_False;
100*cdf0e10cSrcweir 		if ( ( pODMSelectDoc = (TODMSelectDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDoc")).pData)) == NULL ) return sal_False;
101*cdf0e10cSrcweir 		if ( ( pODMOpenDoc = (TODMOpenDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMOpenDoc")).pData)) == NULL ) return sal_False;
102*cdf0e10cSrcweir 		if ( ( pODMSaveDoc = (TODMSaveDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDoc")).pData)) == NULL ) return sal_False;
103*cdf0e10cSrcweir 		if ( ( pODMCloseDoc = (TODMCloseDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDoc")).pData)) == NULL ) return sal_False;
104*cdf0e10cSrcweir 		if ( ( pODMNewDoc = (TODMNewDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMNewDoc")).pData)) == NULL ) return sal_False;
105*cdf0e10cSrcweir 		if ( ( pODMSaveAs = (TODMSaveAs)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAs")).pData)) == NULL ) return sal_False;
106*cdf0e10cSrcweir 		if ( ( pODMActivate = (TODMActivate)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMActivate")).pData)) == NULL ) return sal_False;
107*cdf0e10cSrcweir 		if ( ( pODMGetDocInfo = (TODMGetDocInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocInfo")).pData)) == NULL ) return sal_False;
108*cdf0e10cSrcweir 		if ( ( pODMSetDocInfo = (TODMSetDocInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocInfo")).pData)) == NULL ) return sal_False;
109*cdf0e10cSrcweir 		if ( ( pODMGetDMSInfo = (TODMGetDMSInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSInfo")).pData)) == NULL ) return sal_False;
110*cdf0e10cSrcweir 		if ( ( pODMGetDMSCount = (TODMGetDMSCount)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSCount")).pData)) == NULL ) return sal_False;
111*cdf0e10cSrcweir 		if ( ( pODMGetDMSList = (TODMGetDMSList)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSList")).pData)) == NULL ) return sal_False;
112*cdf0e10cSrcweir 		if ( ( pODMGetDMS = (TODMGetDMS)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMS")).pData)) == NULL ) return sal_False;
113*cdf0e10cSrcweir 		if ( ( pODMSetDMS = (TODMSetDMS)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDMS")).pData)) == NULL ) return sal_False;
114*cdf0e10cSrcweir 		if ( ( pODMQueryExecute = (TODMQueryExecute)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryExecute")).pData)) == NULL ) return sal_False;
115*cdf0e10cSrcweir 		if ( ( pODMQueryGetResults = (TODMQueryGetResults)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryGetResults")).pData)) == NULL ) return sal_False;
116*cdf0e10cSrcweir 		if ( ( pODMQueryClose = (TODMQueryClose)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryClose")).pData)) == NULL ) return sal_False;
117*cdf0e10cSrcweir 		if ( ( pODMCloseDocEx = (TODMCloseDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDocEx")).pData)) == NULL ) return sal_False;
118*cdf0e10cSrcweir 		if ( ( pODMSaveAsEx = (TODMSaveAsEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAsEx")).pData)) == NULL ) return sal_False;
119*cdf0e10cSrcweir 		if ( ( pODMSaveDocEx = (TODMSaveDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDocEx")).pData)) == NULL ) return sal_False;
120*cdf0e10cSrcweir 		if ( ( pODMSelectDocEx = (TODMSelectDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDocEx")).pData)) == NULL ) return sal_False;
121*cdf0e10cSrcweir 		if ( ( pODMQueryCapability = (TODMQueryCapability)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryCapability")).pData)) == NULL ) return sal_False;
122*cdf0e10cSrcweir 		if ( ( pODMSetDocEvent = (TODMSetDocEvent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocEvent")).pData)) == NULL ) return sal_False;
123*cdf0e10cSrcweir 		if ( ( pODMGetAlternateContent = (TODMGetAlternateContent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetAlternateContent")).pData)) == NULL ) return sal_False;
124*cdf0e10cSrcweir 		if ( ( pODMSetAlternateContent = (TODMSetAlternateContent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetAlternateContent")).pData)) == NULL ) return sal_False;
125*cdf0e10cSrcweir 		if ( ( pODMGetDocRelation = (TODMGetDocRelation)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocRelation")).pData)) == NULL ) return sal_False;
126*cdf0e10cSrcweir 		if ( ( pODMSetDocRelation = (TODMSetDocRelation)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocRelation")).pData)) == NULL ) return sal_False;
127*cdf0e10cSrcweir 		return sal_True;
128*cdf0e10cSrcweir 	}
129*cdf0e10cSrcweir }
130