office-gobmx/cppuhelper/source/shlib.cxx

613 lines
20 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-12-19 08:01:16 -06:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-12-19 08:01:16 -06:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-12-19 08:01:16 -06:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-12-19 08:01:16 -06:00
*
* This file is part of OpenOffice.org.
2000-12-19 08:01:16 -06:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-12-19 08:01:16 -06:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-12-19 08:01:16 -06:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-12-19 08:01:16 -06:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppuhelper.hxx"
#include "osl/diagnose.h"
#include "osl/file.hxx"
#include "osl/mutex.hxx"
#include "osl/module.hxx"
#include "rtl/unload.h"
#include "rtl/ustrbuf.hxx"
#include "uno/environment.h"
#include "uno/mapping.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/shlib.hxx"
2000-12-19 08:01:16 -06:00
#include "com/sun/star/beans/XPropertySet.hpp"
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
#endif
#include <vector>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
2000-12-19 08:01:16 -06:00
using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star;
2000-12-19 08:01:16 -06:00
using namespace ::com::sun::star::uno;
namespace cppu
{
#if OSL_DEBUG_LEVEL > 1
//------------------------------------------------------------------------------
static inline void out( const char * p ) SAL_THROW( () )
2000-12-19 08:01:16 -06:00
{
printf( p );
2000-12-19 08:01:16 -06:00
}
static inline void out( const OUString & r ) throw ()
{
OString s( OUStringToOString( r, RTL_TEXTENCODING_ASCII_US ) );
out( s.getStr() );
}
#endif
//------------------------------------------------------------------------------
static const ::std::vector< OUString > * getAccessDPath() SAL_THROW( () )
2000-12-19 08:01:16 -06:00
{
static ::std::vector< OUString > * s_p = 0;
static bool s_bInit = false;
if (! s_bInit)
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if (! s_bInit)
{
const char * pEnv = ::getenv( "CPLD_ACCESSPATH" );
if (pEnv)
{
static ::std::vector< OUString > s_v;
OString aEnv( pEnv );
2001-05-10 14:29:53 -05:00
sal_Int32 nIndex = 0;
do
2000-12-19 08:01:16 -06:00
{
OUString aStr( OStringToOUString(
aEnv.getToken( 0, ';', nIndex ),
RTL_TEXTENCODING_ASCII_US ) );
OUString aFileUrl;
if (FileBase::getFileURLFromSystemPath(aStr, aFileUrl)
!= FileBase::E_None)
{
OSL_ASSERT(false);
}
s_v.push_back( aFileUrl );
2001-05-10 14:29:53 -05:00
} while( nIndex != -1 );
#if OSL_DEBUG_LEVEL > 1
2000-12-19 08:01:16 -06:00
out( "> cpld: acknowledged following access path(s): \"" );
::std::vector< OUString >::const_iterator iPos( s_v.begin() );
while (iPos != s_v.end())
{
out( *iPos );
++iPos;
if (iPos != s_v.end())
out( ";" );
}
out( "\"\n" );
#endif
s_p = & s_v;
}
else
{
// no access path env set
#if OSL_DEBUG_LEVEL > 1
out( "=> no CPLD_ACCESSPATH set.\n" );
#endif
}
2000-12-19 08:01:16 -06:00
s_bInit = true;
}
}
return s_p;
}
//------------------------------------------------------------------------------
2000-12-19 08:01:16 -06:00
static bool checkAccessPath( OUString * pComp ) throw ()
{
const ::std::vector< OUString > * pPath = getAccessDPath();
if (pPath)
{
sal_Bool bAbsolute = (pComp->compareToAscii( "file://" , 7 ) == 0);
2000-12-19 08:01:16 -06:00
for ( ::std::vector< OUString >::const_iterator iPos( pPath->begin() );
iPos != pPath->end(); ++iPos )
{
OUString aBaseDir( *iPos );
OUString aAbs;
if ( bAbsolute )
2000-12-19 08:01:16 -06:00
{
aAbs = *pComp;
#if OSL_DEBUG_LEVEL > 1
2000-12-19 08:01:16 -06:00
out( "> taking path: \"" );
out( aAbs );
#endif
}
else
{
if (osl_File_E_None !=
::osl_getAbsoluteFileURL(
aBaseDir.pData, pComp->pData, &aAbs.pData ))
2000-12-19 08:01:16 -06:00
{
continue;
}
#if OSL_DEBUG_LEVEL > 1
2000-12-19 08:01:16 -06:00
out( "> found path: \"" );
out( aBaseDir );
out( "\" + \"" );
out( *pComp );
out( "\" => \"" );
out( aAbs );
#endif
}
if (0 == aAbs.indexOf( aBaseDir ) && // still part of it?
aBaseDir.getLength() < aAbs.getLength() &&
(aBaseDir[ aBaseDir.getLength() -1 ] == (sal_Unicode)'/' ||
// dir boundary
aAbs[ aBaseDir.getLength() ] == (sal_Unicode)'/'))
2000-12-19 08:01:16 -06:00
{
#if OSL_DEBUG_LEVEL > 1
2000-12-19 08:01:16 -06:00
out( ": ok.\n" );
#endif
// load from absolute path
*pComp = aAbs;
return true;
}
#if OSL_DEBUG_LEVEL > 1
2000-12-19 08:01:16 -06:00
else
{
out( "\" ...does not match given path \"" );
out( aBaseDir );
out( "\".\n" );
}
#endif
}
return false;
}
else
{
// no access path env set
return true;
}
}
//------------------------------------------------------------------------------
static inline sal_Int32 endsWith(
const OUString & rText, const OUString & rEnd ) SAL_THROW( () )
2000-12-19 08:01:16 -06:00
{
if (rText.getLength() >= rEnd.getLength() &&
rEnd.equalsIgnoreAsciiCase(
rText.copy( rText.getLength() - rEnd.getLength() ) ))
2000-12-19 08:01:16 -06:00
{
return rText.getLength() - rEnd.getLength();
}
return -1;
}
//------------------------------------------------------------------------------
static OUString makeComponentPath(
const OUString & rLibName, const OUString & rPath )
2000-12-19 08:01:16 -06:00
{
#if OSL_DEBUG_LEVEL > 0
// No system path allowed here !
{
OUString aComp;
OSL_ASSERT( FileBase::E_None ==
FileBase::getSystemPathFromFileURL( rLibName, aComp ) );
OSL_ASSERT(
! rPath.getLength() ||
FileBase::E_None ==
FileBase::getSystemPathFromFileURL( rPath, aComp ) );
}
#endif
2000-12-19 08:01:16 -06:00
OUStringBuffer buf( rPath.getLength() + rLibName.getLength() + 12 );
if (0 != rPath.getLength())
2000-12-19 08:01:16 -06:00
{
buf.append( rPath );
if (rPath[ rPath.getLength() -1 ] != '/')
buf.append( (sal_Unicode) '/' );
2000-12-19 08:01:16 -06:00
}
sal_Int32 nEnd = endsWith( rLibName, OUSTR(SAL_DLLEXTENSION) );
2000-12-19 08:01:16 -06:00
if (nEnd < 0) // !endsWith
{
#ifndef OS2
//this is always triggered with .uno components
#if (OSL_DEBUG_LEVEL >= 2)
OSL_ENSURE(
!"### library name has no proper extension!",
OUStringToOString( rLibName, RTL_TEXTENCODING_ASCII_US ).getStr() );
#endif
#endif // OS2
#if defined SAL_DLLPREFIX
nEnd = endsWith( rLibName, OUSTR(".uno") );
if (nEnd < 0) // !endsWith
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(SAL_DLLPREFIX) );
#endif
2000-12-19 08:01:16 -06:00
buf.append( rLibName );
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(SAL_DLLEXTENSION) );
2000-12-19 08:01:16 -06:00
}
else // name is completely pre/postfixed
{
buf.append( rLibName );
}
OUString out( buf.makeStringAndClear() );
#if OSL_DEBUG_LEVEL > 1
OString str( OUStringToOString( out, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE( "component path=%s\n", str.getStr() );
#endif
return out;
2000-12-19 08:01:16 -06:00
}
//==============================================================================
static OUString getLibEnv(OUString const & aModulePath,
oslModule lib,
uno::Environment * pEnv,
OUString * pSourceEnv_name,
uno::Environment const & cTargetEnv,
OUString const & cImplName = OUString())
{
OUString aExcMsg;
sal_Char const * pEnvTypeName = NULL;
OUString aGetEnvNameExt = OUSTR(COMPONENT_GETENVEXT);
component_getImplementationEnvironmentExtFunc pGetImplEnvExt =
(component_getImplementationEnvironmentExtFunc)osl_getFunctionSymbol(lib, aGetEnvNameExt.pData);
if (pGetImplEnvExt)
{
OString implName(OUStringToOString(cImplName, RTL_TEXTENCODING_ASCII_US));
pGetImplEnvExt(&pEnvTypeName, (uno_Environment **)pEnv, implName.getStr(), cTargetEnv.get());
}
else
{
OUString aGetEnvName = OUSTR(COMPONENT_GETENV);
component_getImplementationEnvironmentFunc pGetImplEnv =
(component_getImplementationEnvironmentFunc)osl_getFunctionSymbol(
lib, aGetEnvName.pData );
if (pGetImplEnv)
pGetImplEnv(&pEnvTypeName, (uno_Environment **)pEnv);
else
{
aExcMsg = aModulePath;
aExcMsg += OUSTR(": cannot get symbol: ");
aExcMsg += aGetEnvName;
aExcMsg += OUSTR("- nor: ");
}
}
if (!pEnv->is() && pEnvTypeName)
CWS-TOOLING: integrate CWS dba32e 2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected 2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte 2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name 2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard 2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus 2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up 2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up 2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct 2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0 2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected 2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string 2009-07-20 11:40:39 +0200 fs r274117 : removed unused include 2009-07-20 11:40:01 +0200 fs r274116 : class name corrected 2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path 2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst 2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar 2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well 2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths 2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality 2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52) 2009-07-01 21:41:50 +0200 fs r273614 : #i10000# 2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents 2009-07-01 12:10:31 +0200 fs r273562 : updated 2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names 2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays 2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder 2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb 2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d 2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions 2009-06-29 10:01:13 +0200 fs r273453 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays 2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899# 2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes 2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes 2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log 2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts 2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string 2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime 2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata 2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge 2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved 2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set 2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge 2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge 2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing 2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d 2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries? 2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed 2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix 2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section 2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox 2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop 2009-06-19 13:18:26 +0200 oj r273157 : remove unused param 2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50) 2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e 2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e 2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e 2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50 2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text 2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any 2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid 2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ... 2009-06-10 09:53:20 +0200 oj r272797 : add lic text 2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618 2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed 2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property 2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases 2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases 2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases 2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid 2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing 2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType 2009-06-08 13:51:20 +0200 oj r272730 : add tests 2009-06-05 14:38:01 +0200 oj r272686 : add dep 2009-06-05 14:35:00 +0200 oj r272684 : add new tests 2009-06-05 13:41:18 +0200 oj r272681 : code clean ups 2009-06-05 12:40:51 +0200 oj r272678 : code cleanup 2009-06-05 12:02:57 +0200 oj r272677 : code cleanup 2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML 2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard 2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 05:09:17 -05:00
{
*pSourceEnv_name = OUString::createFromAscii(pEnvTypeName);
CWS-TOOLING: integrate CWS dba32e 2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected 2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte 2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name 2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard 2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus 2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up 2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up 2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct 2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0 2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected 2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string 2009-07-20 11:40:39 +0200 fs r274117 : removed unused include 2009-07-20 11:40:01 +0200 fs r274116 : class name corrected 2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path 2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst 2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar 2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well 2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths 2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality 2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52) 2009-07-01 21:41:50 +0200 fs r273614 : #i10000# 2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents 2009-07-01 12:10:31 +0200 fs r273562 : updated 2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names 2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays 2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder 2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb 2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d 2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions 2009-06-29 10:01:13 +0200 fs r273453 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays 2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899# 2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes 2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes 2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log 2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts 2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string 2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime 2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata 2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge 2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved 2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set 2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge 2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge 2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing 2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d 2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries? 2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed 2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix 2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section 2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox 2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop 2009-06-19 13:18:26 +0200 oj r273157 : remove unused param 2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50) 2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e 2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e 2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e 2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50 2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text 2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any 2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid 2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ... 2009-06-10 09:53:20 +0200 oj r272797 : add lic text 2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618 2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed 2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property 2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases 2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases 2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases 2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid 2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing 2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType 2009-06-08 13:51:20 +0200 oj r272730 : add tests 2009-06-05 14:38:01 +0200 oj r272686 : add dep 2009-06-05 14:35:00 +0200 oj r272684 : add new tests 2009-06-05 13:41:18 +0200 oj r272681 : code clean ups 2009-06-05 12:40:51 +0200 oj r272678 : code cleanup 2009-06-05 12:02:57 +0200 oj r272677 : code cleanup 2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML 2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard 2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 05:09:17 -05:00
const char * pUNO_ENV_LOG = ::getenv( "UNO_ENV_LOG" );
if (pUNO_ENV_LOG && rtl_str_getLength(pUNO_ENV_LOG) )
{
OString implName(OUStringToOString(cImplName, RTL_TEXTENCODING_ASCII_US));
OString aEnv( pUNO_ENV_LOG );
sal_Int32 nIndex = 0;
do
{
const OString aStr( aEnv.getToken( 0, ';', nIndex ) );
if ( aStr.equals(implName) )
{
*pSourceEnv_name += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":log"));
break;
}
} while( nIndex != -1 );
}
}
return aExcMsg;
}
extern "C" {static void s_getFactory(va_list * pParam)
{
component_getFactoryFunc pSym = va_arg(*pParam, component_getFactoryFunc);
OString const * pImplName = va_arg(*pParam, OString const *);
void * pSMgr = va_arg(*pParam, void *);
void * pKey = va_arg(*pParam, void *);
void ** ppSSF = va_arg(*pParam, void **);
*ppSSF = pSym(pImplName->getStr(), pSMgr, pKey);
}}
Reference< XInterface > SAL_CALL loadSharedLibComponentFactory(
2000-12-19 08:01:16 -06:00
OUString const & rLibName, OUString const & rPath,
OUString const & rImplName,
Reference< lang::XMultiServiceFactory > const & xMgr,
Reference< registry::XRegistryKey > const & xKey )
SAL_THROW( (loader::CannotActivateFactoryException) )
2000-12-19 08:01:16 -06:00
{
OUString aModulePath( makeComponentPath( rLibName, rPath ) );
if (! checkAccessPath( &aModulePath ))
{
throw loader::CannotActivateFactoryException(
OUSTR("permission denied to load component library: ") +
aModulePath,
Reference< XInterface >() );
2000-12-19 08:01:16 -06:00
}
oslModule lib = osl_loadModule(
aModulePath.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
2000-12-19 08:01:16 -06:00
if (! lib)
{
throw loader::CannotActivateFactoryException(
OUSTR("loading component library failed: ") + aModulePath,
Reference< XInterface >() );
2000-12-19 08:01:16 -06:00
}
Reference< XInterface > xRet;
2000-12-19 08:01:16 -06:00
uno::Environment currentEnv(Environment::getCurrent());
uno::Environment env;
2000-12-19 08:01:16 -06:00
OUString aEnvTypeName;
2000-12-19 08:01:16 -06:00
OUString aExcMsg = getLibEnv(aModulePath, lib, &env, &aEnvTypeName, currentEnv, rImplName);
if (!aExcMsg.getLength())
{
OUString aGetFactoryName = OUSTR(COMPONENT_GETFACTORY);
oslGenericFunction pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData );
if (pSym != 0)
2000-12-19 08:01:16 -06:00
{
OString aImplName(
OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
if (!env.is())
env = uno::Environment(aEnvTypeName);
if (env.is() && currentEnv.is())
{
#if OSL_DEBUG_LEVEL > 1
{
rtl::OString libName(rtl::OUStringToOString(rLibName, RTL_TEXTENCODING_ASCII_US));
rtl::OString implName(rtl::OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US));
rtl::OString envDcp(rtl::OUStringToOString(env.getTypeName(), RTL_TEXTENCODING_ASCII_US));
2000-12-19 08:01:16 -06:00
fprintf(stderr, "loadSharedLibComponentFactory envDcp: %-12.12s implName: %30.30s libName: %-15.15s\n", envDcp.getStr(), implName.getStr() + (implName.getLength() > 30 ? implName.getLength() - 30 : 0), libName.getStr());
}
#endif
2000-12-19 08:01:16 -06:00
Mapping aCurrent2Env( currentEnv, env );
Mapping aEnv2Current( env, currentEnv );
2000-12-19 08:01:16 -06:00
if (aCurrent2Env.is() && aEnv2Current.is())
{
void * pSMgr = aCurrent2Env.mapInterface(
xMgr.get(), ::getCppuType( &xMgr ) );
void * pKey = aCurrent2Env.mapInterface(
xKey.get(), ::getCppuType( &xKey ) );
2000-12-19 08:01:16 -06:00
void * pSSF = NULL;
env.invoke(s_getFactory, pSym, &aImplName, pSMgr, pKey, &pSSF);
if (pKey)
{
(env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pKey );
}
if (pSMgr)
{
(*env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pSMgr );
}
if (pSSF)
{
aEnv2Current.mapInterface(
reinterpret_cast< void ** >( &xRet ),
pSSF, ::getCppuType( &xRet ) );
(env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pSSF );
2000-12-19 08:01:16 -06:00
}
else
{
aExcMsg = aModulePath;
aExcMsg += OUSTR(": cannot get factory of "
"demanded implementation: ");
aExcMsg += OStringToOUString(
aImplName, RTL_TEXTENCODING_ASCII_US );
2000-12-19 08:01:16 -06:00
}
}
else
{
aExcMsg =
OUSTR("cannot get uno mappings: C++ <=> UNO!");
2000-12-19 08:01:16 -06:00
}
}
else
{
aExcMsg = OUSTR("cannot get uno environments!");
2000-12-19 08:01:16 -06:00
}
}
else
{
aExcMsg = aModulePath;
aExcMsg += OUSTR(": cannot get symbol: ");
2000-12-19 08:01:16 -06:00
aExcMsg += aGetFactoryName;
}
}
if (! xRet.is())
{
osl_unloadModule( lib );
#if OSL_DEBUG_LEVEL > 1
out( "### cannot activate factory: " );
2000-12-19 08:01:16 -06:00
out( aExcMsg );
out( "\n" );
2000-12-19 08:01:16 -06:00
#endif
throw loader::CannotActivateFactoryException(
aExcMsg,
Reference< XInterface >() );
2000-12-19 08:01:16 -06:00
}
rtl_registerModuleForUnloading( lib);
2000-12-19 08:01:16 -06:00
return xRet;
}
//==============================================================================
extern "C" { static void s_writeInfo(va_list * pParam)
{
component_writeInfoFunc pSym = va_arg(*pParam, component_writeInfoFunc);
void * pSMgr = va_arg(*pParam, void *);
void * pKey = va_arg(*pParam, void *);
sal_Bool * pbRet = va_arg(*pParam, sal_Bool *);
*pbRet = pSym(pSMgr, pKey);
}}
2000-12-19 08:01:16 -06:00
void SAL_CALL writeSharedLibComponentInfo(
OUString const & rLibName, OUString const & rPath,
Reference< lang::XMultiServiceFactory > const & xMgr,
Reference< registry::XRegistryKey > const & xKey )
SAL_THROW( (registry::CannotRegisterImplementationException) )
2000-12-19 08:01:16 -06:00
{
OUString aModulePath( makeComponentPath( rLibName, rPath ) );
if (! checkAccessPath( &aModulePath ))
{
throw registry::CannotRegisterImplementationException(
OUSTR("permission denied to load component library: ") +
aModulePath,
Reference< XInterface >() );
2000-12-19 08:01:16 -06:00
}
oslModule lib = osl_loadModule(
aModulePath.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
2000-12-19 08:01:16 -06:00
if (! lib)
{
throw registry::CannotRegisterImplementationException(
OUSTR("loading component library failed: ") + aModulePath,
Reference< XInterface >() );
2000-12-19 08:01:16 -06:00
}
sal_Bool bRet = sal_False;
uno::Environment currentEnv(Environment::getCurrent());
uno::Environment env;
2000-12-19 08:01:16 -06:00
OUString aEnvTypeName;
OUString aExcMsg = getLibEnv(aModulePath, lib, &env, &aEnvTypeName, currentEnv);
if (!aExcMsg.getLength())
{
OUString aWriteInfoName = OUSTR(COMPONENT_WRITEINFO);
oslGenericFunction pSym = osl_getFunctionSymbol( lib, aWriteInfoName.pData );
if (pSym != 0)
2000-12-19 08:01:16 -06:00
{
if (!env.is())
env = uno::Environment(aEnvTypeName);
if (env.is() && currentEnv.is())
2000-12-19 08:01:16 -06:00
{
Mapping aCurrent2Env( currentEnv, env );
if (aCurrent2Env.is())
2000-12-19 08:01:16 -06:00
{
void * pSMgr = aCurrent2Env.mapInterface(
xMgr.get(), ::getCppuType( &xMgr ) );
void * pKey = aCurrent2Env.mapInterface(
xKey.get(), ::getCppuType( &xKey ) );
if (pKey)
2000-12-19 08:01:16 -06:00
{
env.invoke(s_writeInfo, pSym, pSMgr, pKey, &bRet);
(*env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pKey );
if (! bRet)
{
2000-12-19 08:01:16 -06:00
aExcMsg = aModulePath;
aExcMsg += OUSTR(": component_writeInfo() "
"returned false!");
}
2000-12-19 08:01:16 -06:00
}
else
{
// key is mandatory
aExcMsg = aModulePath;
aExcMsg += OUSTR(": registry is mandatory to invoke"
" component_writeInfo()!");
}
if (pSMgr)
{
(*env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pSMgr );
2000-12-19 08:01:16 -06:00
}
}
else
{
aExcMsg = OUSTR("cannot get uno mapping: C++ <=> UNO!");
2000-12-19 08:01:16 -06:00
}
}
else
{
aExcMsg = OUSTR("cannot get uno environments!");
2000-12-19 08:01:16 -06:00
}
}
else
{
aExcMsg = aModulePath;
aExcMsg += OUSTR(": cannot get symbol: ");
2000-12-19 08:01:16 -06:00
aExcMsg += aWriteInfoName;
}
}
2001-06-28 03:37:48 -05:00
//!
//! OK: please look at #88219#
//!
//! ::osl_unloadModule( lib);
if (! bRet)
{
#if OSL_DEBUG_LEVEL > 1
out( "### cannot write component info: " );
2000-12-19 08:01:16 -06:00
out( aExcMsg );
out( "\n" );
2000-12-19 08:01:16 -06:00
#endif
throw registry::CannotRegisterImplementationException(
aExcMsg, Reference< XInterface >() );
2000-12-19 08:01:16 -06:00
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */