1 'encoding UTF-8 Do not remove or change this line!
2 '*******************************************************************************
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: basic_delete_modules.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : Tools for OLE objects
38 '\******************************************************************************
40 private const VERBOSE = FALSE
42 '*******************************************************************************
44 function hGetOfficeVersion() as string
47 dim aItemList( 20 ) as string
49 const CFN = "global::tools::includes::optional::t_ole.inc::hGetOfficeVersion(): "
52 cPath = convertpath( gTesttoolPath & "global/input/officeinfo.txt" )
53 if ( VERBOSE ) then printlog( CFN & "Reading: " & cPath )
56 hGetDatafileSection( cPath, aItemList(), "", "", "" )
59 gOfficeVersion = hGetValueForKeyAsString( aItemList(), gProductName )
62 hGetOfficeVersion() = gOfficeVersion
66 '*******************************************************************************
68 function hGetOleObjectName( ObjectType as string ) as string
\r
70 dim oUnoOfficeConnection as object
\r
71 dim oUnoConfigurationAccess as object
\r
72 dim aPropertyValue(1) as new com.sun.star.beans.PropertyValue
\r
73 dim xViewRoot as object
74 dim cConfigString as string
75 dim cString as string
\r
77 const CFN = "global::tools::includes::optional::t_ole.inc::hGetOleObjectName(): "
79 ' Test function parameters. They are <> gApplication as the API is case sensitive
80 select case ObjectType
88 warnlog( CFN & "Invalid object type passed to function: " & ObjectType )
89 warnlog( CFN & "This function is case sensitive." )
90 warnlog( CFN & "Supported are: Writer, Calc, Impress, Draw, Math, Chart" )
91 hGetOleObjectName() = ""
95 if ( VERBOSE ) then printlog( CFN & "Retrieving OLE name for: " & ObjectType )
97 ' ...Embedding is physical path, ObjectNames the top node
\r
98 aPropertyValue( 0 ).Name = "nodepath"
\r
99 aPropertyValue( 0 ).Value = "/org.openoffice.Office.Embedding/ObjectNames/" & ObjectType
101 ' Connect to remote UNO
\r
102 oUnoOfficeConnection = hGetUnoService( TRUE )
\r
104 if ( isNull( oUnoOfficeConnection )) then
\r
105 warnlog( CFN & "Failed to establish UNO connection, hGetUnoService failed" )
\r
106 hGetOleObjectName() = ""
\r
108 ' Get a configuration provider
\r
109 oUnoConfigurationAccess = oUnoOfficeConnection.createInstance( "com.sun.star.configuration.ConfigurationProvider" )
112 xViewRoot = oUnoConfigurationAccess.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aPropertyValue() )
\r
113 cConfigString = xViewRoot.getByName( "ObjectUIName" )
115 ' The string contains placeholders %PRODUCTNAME and %PRODUCTVERSION which have to be replaced
116 if ( gOfficeVersion = "" ) then
117 warnlog( CFN & "gOOoBaseVersion is empty, run hGetOfficeVersion() first" )
118 cString = right( cConfigString, len( cConfigString ) - 29 )
120 cString = gProductName & " " & gOfficeVersion & " " & right( cConfigString, len( cConfigString ) - 29 )
125 hGetOleObjectName() = cString
\r
129 '*******************************************************************************
131 function GetOleDefaultNames()
133 const CFN = "global::tools::includes::optional::t_ole.inc::GetOleDefaultNames(): "
134 if ( VERBOSE ) then printlog( CFN & "Retrieving OLE names" )
137 gOLEWriter = hGetOleObjectName( "Writer" )
138 gOLECalc = hGetOleObjectName( "Calc" )
139 gOLEChart = hGetOleObjectName( "Chart" )
140 gOLEImpress = hGetOleObjectName( "Impress" )
141 gOLEDraw = hGetOleObjectName( "Draw" )
142 gOLEMath = hGetOleObjectName( "Math" )
\r
146 '*******************************************************************************