1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: odma_lib.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_ucb.hxx"
33 //#ifndef _OSL_PROCESS_H_
34 //#include <osl/process.h>
36 #include <osl/module.h>
37 #include <rtl/ustring.hxx>
38 #include <tools/prewin.h>
39 #include <tools/postwin.h>
40 #include "odma_lib.hxx"
46 TODMRegisterApp pODMRegisterApp
;
47 TODMUnRegisterApp pODMUnRegisterApp
;
48 TODMSelectDoc pODMSelectDoc
;
49 TODMOpenDoc pODMOpenDoc
;
50 TODMSaveDoc pODMSaveDoc
;
51 TODMCloseDoc pODMCloseDoc
;
52 TODMNewDoc pODMNewDoc
;
53 TODMSaveAs pODMSaveAs
;
54 TODMActivate pODMActivate
;
55 TODMGetDocInfo pODMGetDocInfo
;
56 TODMSetDocInfo pODMSetDocInfo
;
57 TODMGetDMSInfo pODMGetDMSInfo
;
58 TODMGetDMSCount pODMGetDMSCount
;
59 TODMGetDMSList pODMGetDMSList
;
60 TODMGetDMS pODMGetDMS
;
61 TODMSetDMS pODMSetDMS
;
62 TODMQueryExecute pODMQueryExecute
;
63 TODMQueryGetResults pODMQueryGetResults
;
64 TODMQueryClose pODMQueryClose
;
65 TODMCloseDocEx pODMCloseDocEx
;
66 TODMSaveAsEx pODMSaveAsEx
;
67 TODMSaveDocEx pODMSaveDocEx
;
68 TODMSelectDocEx pODMSelectDocEx
;
69 TODMQueryCapability pODMQueryCapability
;
70 TODMSetDocEvent pODMSetDocEvent
;
71 TODMGetAlternateContent pODMGetAlternateContent
;
72 TODMSetAlternateContent pODMSetAlternateContent
;
73 TODMGetDocRelation pODMGetDocRelation
;
74 TODMSetDocRelation pODMSetDocRelation
;
76 sal_Bool
LoadFunctions(oslModule _pODMA
);
78 sal_Bool
DMSsAvailable()
80 static sal_Bool bLoaded
= sal_False
;
81 static sal_Bool bBeenHere
= sal_False
;
82 oslModule pODMA
= NULL
;
87 ::rtl::OUString sPath
;
89 sPath
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL"));
92 sPath
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
95 sPath
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodma.so"));
100 pODMA
= osl_loadModule( sPath
.pData
,SAL_LOADMODULE_NOW
);
104 if (!LoadFunctions(pODMA
))
107 bLoaded
= (NODMGetDMSCount() > 0);
109 if (getenv ("NO_ODMA"))
114 // -------------------------------------------------------------------------
116 sal_Bool
LoadFunctions(oslModule pODMA
)
118 if ( ( pODMRegisterApp
= (TODMRegisterApp
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMRegisterApp")).pData
)) == NULL
) return sal_False
;
119 if ( ( pODMUnRegisterApp
= (TODMUnRegisterApp
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMUnRegisterApp")).pData
)) == NULL
) return sal_False
;
120 if ( ( pODMSelectDoc
= (TODMSelectDoc
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDoc")).pData
)) == NULL
) return sal_False
;
121 if ( ( pODMOpenDoc
= (TODMOpenDoc
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMOpenDoc")).pData
)) == NULL
) return sal_False
;
122 if ( ( pODMSaveDoc
= (TODMSaveDoc
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDoc")).pData
)) == NULL
) return sal_False
;
123 if ( ( pODMCloseDoc
= (TODMCloseDoc
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDoc")).pData
)) == NULL
) return sal_False
;
124 if ( ( pODMNewDoc
= (TODMNewDoc
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMNewDoc")).pData
)) == NULL
) return sal_False
;
125 if ( ( pODMSaveAs
= (TODMSaveAs
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAs")).pData
)) == NULL
) return sal_False
;
126 if ( ( pODMActivate
= (TODMActivate
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMActivate")).pData
)) == NULL
) return sal_False
;
127 if ( ( pODMGetDocInfo
= (TODMGetDocInfo
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocInfo")).pData
)) == NULL
) return sal_False
;
128 if ( ( pODMSetDocInfo
= (TODMSetDocInfo
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocInfo")).pData
)) == NULL
) return sal_False
;
129 if ( ( pODMGetDMSInfo
= (TODMGetDMSInfo
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSInfo")).pData
)) == NULL
) return sal_False
;
130 if ( ( pODMGetDMSCount
= (TODMGetDMSCount
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSCount")).pData
)) == NULL
) return sal_False
;
131 if ( ( pODMGetDMSList
= (TODMGetDMSList
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSList")).pData
)) == NULL
) return sal_False
;
132 if ( ( pODMGetDMS
= (TODMGetDMS
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMS")).pData
)) == NULL
) return sal_False
;
133 if ( ( pODMSetDMS
= (TODMSetDMS
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDMS")).pData
)) == NULL
) return sal_False
;
134 if ( ( pODMQueryExecute
= (TODMQueryExecute
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryExecute")).pData
)) == NULL
) return sal_False
;
135 if ( ( pODMQueryGetResults
= (TODMQueryGetResults
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryGetResults")).pData
)) == NULL
) return sal_False
;
136 if ( ( pODMQueryClose
= (TODMQueryClose
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryClose")).pData
)) == NULL
) return sal_False
;
137 if ( ( pODMCloseDocEx
= (TODMCloseDocEx
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDocEx")).pData
)) == NULL
) return sal_False
;
138 if ( ( pODMSaveAsEx
= (TODMSaveAsEx
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAsEx")).pData
)) == NULL
) return sal_False
;
139 if ( ( pODMSaveDocEx
= (TODMSaveDocEx
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDocEx")).pData
)) == NULL
) return sal_False
;
140 if ( ( pODMSelectDocEx
= (TODMSelectDocEx
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDocEx")).pData
)) == NULL
) return sal_False
;
141 if ( ( pODMQueryCapability
= (TODMQueryCapability
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryCapability")).pData
)) == NULL
) return sal_False
;
142 if ( ( pODMSetDocEvent
= (TODMSetDocEvent
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocEvent")).pData
)) == NULL
) return sal_False
;
143 if ( ( pODMGetAlternateContent
= (TODMGetAlternateContent
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetAlternateContent")).pData
)) == NULL
) return sal_False
;
144 if ( ( pODMSetAlternateContent
= (TODMSetAlternateContent
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetAlternateContent")).pData
)) == NULL
) return sal_False
;
145 if ( ( pODMGetDocRelation
= (TODMGetDocRelation
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocRelation")).pData
)) == NULL
) return sal_False
;
146 if ( ( pODMSetDocRelation
= (TODMSetDocRelation
)osl_getSymbol(pODMA
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocRelation")).pData
)) == NULL
) return sal_False
;