jl160 merge with DEV300m96
This commit is contained in:
commit
7508b11431
@ -28,19 +28,17 @@
|
||||
#ifndef _AVMEDIA_HELPIDS_HRC
|
||||
#define _AVMEDIA_HELPIDS_HRC
|
||||
|
||||
#include <svl/solar.hrc>
|
||||
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_PLAY (HID_AVMEDIA_START+0)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_PAUSE (HID_AVMEDIA_START+1)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_STOP (HID_AVMEDIA_START+2)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_MUTE (HID_AVMEDIA_START+3)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_LOOP (HID_AVMEDIA_START+4)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_OPEN (HID_AVMEDIA_START+5)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_INSERT (HID_AVMEDIA_START+6)
|
||||
#define HID_AVMEDIA_ZOOMLISTBOX (HID_AVMEDIA_START+7)
|
||||
#define HID_AVMEDIA_TIMESLIDER (HID_AVMEDIA_START+8)
|
||||
#define HID_AVMEDIA_TIMEEDIT (HID_AVMEDIA_START+9)
|
||||
#define HID_AVMEDIA_VOLUMESLIDER (HID_AVMEDIA_START+10)
|
||||
#define HID_AVMEDIA_PLAYERWINDOW (HID_AVMEDIA_START+11)
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_PLAY "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_PLAY"
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_PAUSE "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_PAUSE"
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_STOP "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_STOP"
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_MUTE "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_MUTE"
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_LOOP "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_LOOP"
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_OPEN "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_OPEN"
|
||||
#define HID_AVMEDIA_TOOLBOXITEM_INSERT "AVMEDIA_HID_AVMEDIA_TOOLBOXITEM_INSERT"
|
||||
#define HID_AVMEDIA_ZOOMLISTBOX "AVMEDIA_HID_AVMEDIA_ZOOMLISTBOX"
|
||||
#define HID_AVMEDIA_TIMESLIDER "AVMEDIA_HID_AVMEDIA_TIMESLIDER"
|
||||
#define HID_AVMEDIA_TIMEEDIT "AVMEDIA_HID_AVMEDIA_TIMEEDIT"
|
||||
#define HID_AVMEDIA_VOLUMESLIDER "AVMEDIA_HID_AVMEDIA_VOLUMESLIDER"
|
||||
#define HID_AVMEDIA_PLAYERWINDOW "AVMEDIA_HID_AVMEDIA_PLAYERWINDOW"
|
||||
|
||||
#endif // _AVMEDIA_HELPIDS_HRC
|
||||
|
@ -1,4 +1,4 @@
|
||||
av avmedia : l10n tools sfx2 NULL
|
||||
av avmedia : l10n tools sfx2 LIBXSLT:libxslt NULL
|
||||
av avmedia usr1 - all av_mkout NULL
|
||||
av avmedia\prj get - all av_prj NULL
|
||||
av avmedia\inc get - all av_inv NULL
|
||||
|
@ -16,3 +16,8 @@ mkdir: %_DEST%\inc%_EXT%\avmedia
|
||||
..\inc\avmedia\mediatoolbox.hxx %_DEST%\inc%_EXT%\avmedia\mediatoolbox.hxx
|
||||
|
||||
..\%__SRC%\class\avmedia.jar %_DEST%\bin%_EXT%\avmedia.jar
|
||||
..\%__SRC%\misc\avmedia.component %_DEST%\xml%_EXT%\avmedia.component
|
||||
..\%__SRC%\misc\avmedia.jar.component %_DEST%\xml%_EXT%\avmedia.jar.component
|
||||
..\%__SRC%\misc\avmediaQuickTime.component %_DEST%\xml%_EXT%\avmediaQuickTime.component
|
||||
..\%__SRC%\misc\avmediagst.component %_DEST%\xml%_EXT%\avmediagst.component
|
||||
..\%__SRC%\misc\avmediawin.component %_DEST%\xml%_EXT%\avmediawin.component
|
||||
|
@ -497,44 +497,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char
|
||||
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// - component_writeInfo -
|
||||
// -----------------------
|
||||
|
||||
extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
|
||||
if( pRegistryKey )
|
||||
{
|
||||
try
|
||||
{
|
||||
rtl::OUString sKeyName = DECLARE_ASCII( "/" );
|
||||
sKeyName += avmedia::SoundHandler::impl_getStaticImplementationName();
|
||||
sKeyName += DECLARE_ASCII( "/UNO/SERVICES" );
|
||||
css::uno::Reference< css::registry::XRegistryKey > xNewKey(
|
||||
static_cast< css::registry::XRegistryKey* >( pRegistryKey )->createKey(sKeyName));
|
||||
|
||||
if ( xNewKey.is() == sal_True )
|
||||
{
|
||||
css::uno::Sequence< ::rtl::OUString > seqServiceNames = avmedia::SoundHandler::impl_getStaticSupportedServiceNames();
|
||||
const ::rtl::OUString* pArray = seqServiceNames.getArray();
|
||||
sal_Int32 nLength = seqServiceNames.getLength();
|
||||
for ( sal_Int32 nCounter = 0; nCounter < nLength; ++nCounter )
|
||||
xNewKey->createKey( pArray[nCounter] );
|
||||
}
|
||||
|
||||
bRet = sal_True;
|
||||
}
|
||||
catch( css::registry::InvalidRegistryException& )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// - component_getFactory -
|
||||
// ------------------------
|
||||
|
34
avmedia/source/gstreamer/avmediagst.component
Normal file
34
avmedia/source/gstreamer/avmediagst.component
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.avmedia.Manager_GStreamer">
|
||||
<service name="com.sun.star.media.Manager_GStreamer"/>
|
||||
</implementation>
|
||||
</component>
|
@ -1,3 +1,2 @@
|
||||
component_getImplementationEnvironment
|
||||
component_writeInfo
|
||||
component_getFactory
|
||||
|
@ -48,35 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char
|
||||
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// - component_writeInfo -
|
||||
// -----------------------
|
||||
|
||||
extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
|
||||
if( pRegistryKey )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< registry::XRegistryKey > xNewKey1(
|
||||
static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
|
||||
::rtl::OUString::createFromAscii(
|
||||
"/" AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/"
|
||||
AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) );
|
||||
|
||||
bRet = sal_True;
|
||||
}
|
||||
catch( registry::InvalidRegistryException& )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// - component_getFactory -
|
||||
// ------------------------
|
||||
|
@ -69,3 +69,11 @@ DEF1EXPORTFILE=exports.dxp
|
||||
.ENDIF
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
||||
ALLTAR : $(MISC)/avmediagst.component
|
||||
|
||||
$(MISC)/avmediagst.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
|
||||
avmediagst.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmediagst.component
|
||||
|
@ -64,13 +64,4 @@ public class MediaUno
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public static boolean __writeRegistryServiceInfo(
|
||||
com.sun.star.registry.XRegistryKey regKey )
|
||||
{
|
||||
return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
|
||||
s_implName, s_serviceName, regKey );
|
||||
}
|
||||
}
|
||||
|
34
avmedia/source/java/avmedia.jar.component
Normal file
34
avmedia/source/java/avmedia.jar.component
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.Java2"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.media.Manager_Java">
|
||||
<service name="com.sun.star.media.Manager_Java"/>
|
||||
</implementation>
|
||||
</component>
|
@ -59,3 +59,11 @@ CUSTOMMANIFESTFILE = manifest
|
||||
# --- Targets ------------------------------------------------------
|
||||
|
||||
.INCLUDE: target.mk
|
||||
|
||||
ALLTAR : $(MISC)/avmedia.jar.component
|
||||
|
||||
$(MISC)/avmedia.jar.component .ERRREMOVE : \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmedia.jar.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_JAVA)avmedia.jar' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmedia.jar.component
|
||||
|
34
avmedia/source/quicktime/avmediaQuickTime.component
Normal file
34
avmedia/source/quicktime/avmediaQuickTime.component
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.avmedia.Manager_QuickTime">
|
||||
<service name="com.sun.star.media.Manager_QuickTime"/>
|
||||
</implementation>
|
||||
</component>
|
@ -83,3 +83,11 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map
|
||||
dummy:
|
||||
@echo " Nothing to build for GUIBASE=$(GUIBASE)"
|
||||
.ENDIF
|
||||
|
||||
ALLTAR : $(MISC)/avmediaQuickTime.component
|
||||
|
||||
$(MISC)/avmediaQuickTime.component .ERRREMOVE : \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmediaQuickTime.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmediaQuickTime.component
|
||||
|
@ -48,35 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char
|
||||
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// - component_writeInfo -
|
||||
// -----------------------
|
||||
|
||||
extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
|
||||
if( pRegistryKey )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< registry::XRegistryKey > xNewKey1(
|
||||
static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
|
||||
::rtl::OUString::createFromAscii(
|
||||
"/" AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/"
|
||||
AVMEDIA_QUICKTIME_MANAGER_SERVICENAME ) ) );
|
||||
|
||||
bRet = sal_True;
|
||||
}
|
||||
catch( registry::InvalidRegistryException& )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// - component_getFactory -
|
||||
// ------------------------
|
||||
|
34
avmedia/source/win/avmediawin.component
Normal file
34
avmedia/source/win/avmediawin.component
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.avmedia.Manager_DirectX">
|
||||
<service name="com.sun.star.media.Manager_DirectX"/>
|
||||
</implementation>
|
||||
</component>
|
@ -1,4 +1,3 @@
|
||||
component_getImplementationEnvironment
|
||||
component_writeInfo
|
||||
component_getFactory
|
||||
|
||||
|
@ -80,3 +80,11 @@ SHL1STDLIBS += dxguid.lib
|
||||
.ENDIF
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
||||
ALLTAR : $(MISC)/avmediawin.component
|
||||
|
||||
$(MISC)/avmediawin.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
|
||||
avmediawin.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmediawin.component
|
||||
|
@ -48,33 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char
|
||||
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// - component_writeInfo -
|
||||
// -----------------------
|
||||
|
||||
extern "C" sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
|
||||
if( pRegistryKey )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< registry::XRegistryKey > xNewKey1(
|
||||
static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
|
||||
::rtl::OUString::createFromAscii( "/com.sun.star.comp.avmedia.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) );
|
||||
|
||||
bRet = sal_True;
|
||||
}
|
||||
catch( registry::InvalidRegistryException& )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// - component_getFactory -
|
||||
// ------------------------
|
||||
|
@ -1,4 +1,3 @@
|
||||
component_getImplementationEnvironment
|
||||
component_writeInfo
|
||||
component_getFactory
|
||||
|
||||
|
@ -48,35 +48,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char
|
||||
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// - component_writeInfo -
|
||||
// -----------------------
|
||||
|
||||
extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
|
||||
if( pRegistryKey )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< registry::XRegistryKey > xNewKey1(
|
||||
static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
|
||||
::rtl::OUString::createFromAscii(
|
||||
"/" AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/"
|
||||
AVMEDIA_XINE_MANAGER_SERVICENAME ) ) );
|
||||
|
||||
bRet = sal_True;
|
||||
}
|
||||
catch( registry::InvalidRegistryException& )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// - component_getFactory -
|
||||
// ------------------------
|
||||
|
34
avmedia/util/avmedia.component
Normal file
34
avmedia/util/avmedia.component
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.framework.SoundHandler">
|
||||
<service name="com.sun.star.frame.ContentHandler"/>
|
||||
</implementation>
|
||||
</component>
|
@ -77,3 +77,11 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk
|
||||
@echo LibMain>>$@
|
||||
@echo CT>>$@
|
||||
.ENDIF
|
||||
|
||||
ALLTAR : $(MISC)/avmedia.component
|
||||
|
||||
$(MISC)/avmedia.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
|
||||
avmedia.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt avmedia.component
|
||||
|
@ -35,15 +35,18 @@
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <vector>
|
||||
|
||||
#include <deque>
|
||||
|
||||
class SbMethod;
|
||||
class SbProperty;
|
||||
class SbiRuntime;
|
||||
class SbiBreakpoints;
|
||||
typedef std::deque< USHORT > SbiBreakpoints;
|
||||
class SbiImage;
|
||||
class SbProcedureProperty;
|
||||
class SbIfaceMapperMethod;
|
||||
class SbClassModuleObject;
|
||||
|
||||
class ModuleInitDependencyMap;
|
||||
struct ClassModuleRunInitItem;
|
||||
struct SbClassData;
|
||||
class SbModuleImpl;
|
||||
@ -60,6 +63,8 @@ class SbModule : public SbxObject
|
||||
SbModuleImpl* mpSbModuleImpl; // Impl data
|
||||
std::vector< String > mModuleVariableNames;
|
||||
|
||||
void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
|
||||
|
||||
protected:
|
||||
com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
|
||||
::rtl::OUString aOUSource;
|
||||
@ -72,7 +77,7 @@ protected:
|
||||
SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
|
||||
bool bIsProxyModule;
|
||||
|
||||
static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem );
|
||||
static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem );
|
||||
void StartDefinitions();
|
||||
SbMethod* GetMethod( const String&, SbxDataType );
|
||||
SbProperty* GetProperty( const String&, SbxDataType );
|
||||
@ -82,6 +87,7 @@ protected:
|
||||
USHORT Run( SbMethod* );
|
||||
void RunInit();
|
||||
void ClearPrivateVars();
|
||||
void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic );
|
||||
void GlobalRunInit( BOOL bBasicStart ); // for all modules
|
||||
void GlobalRunDeInit( void );
|
||||
const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT& ) const;
|
||||
@ -92,6 +98,7 @@ protected:
|
||||
virtual BOOL LoadCompleted();
|
||||
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
|
||||
const SfxHint& rHint, const TypeId& rHintType );
|
||||
void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint );
|
||||
virtual ~SbModule();
|
||||
public:
|
||||
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
|
||||
@ -115,8 +122,8 @@ public:
|
||||
const SbxObject* FindType( String aTypeName ) const;
|
||||
|
||||
virtual BOOL IsBreakable( USHORT nLine ) const;
|
||||
virtual USHORT GetBPCount() const;
|
||||
virtual USHORT GetBP( USHORT n ) const;
|
||||
virtual size_t GetBPCount() const;
|
||||
virtual USHORT GetBP( size_t n ) const;
|
||||
virtual BOOL IsBP( USHORT nLine ) const;
|
||||
virtual BOOL SetBP( USHORT nLine );
|
||||
virtual BOOL ClearBP( USHORT nLine );
|
||||
|
@ -52,10 +52,18 @@ class SbObjModule : public SbModule
|
||||
{
|
||||
SbObjModule( const SbObjModule& );
|
||||
SbObjModule();
|
||||
|
||||
protected:
|
||||
virtual ~SbObjModule();
|
||||
|
||||
public:
|
||||
TYPEINFO();
|
||||
SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
|
||||
virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
|
||||
|
||||
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
|
||||
const SfxHint& rHint, const TypeId& rHintType );
|
||||
|
||||
using SbxValue::GetObject;
|
||||
SbxVariable* GetObject();
|
||||
void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
|
||||
@ -81,7 +89,7 @@ public:
|
||||
SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
|
||||
virtual ~SbUserFormModule();
|
||||
virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
|
||||
void ResetApiObj();
|
||||
void ResetApiObj( bool bTriggerTerminateEvent = true );
|
||||
void Unload();
|
||||
void Load();
|
||||
void triggerMethod( const String& );
|
||||
@ -93,6 +101,11 @@ public:
|
||||
void triggerLayoutEvent();
|
||||
void triggerResizeEvent();
|
||||
|
||||
bool getInitState( void )
|
||||
{ return mbInit; }
|
||||
void setInitState( bool bInit )
|
||||
{ mbInit = bInit; }
|
||||
|
||||
class SbUserFormModuleInstance* CreateInstance();
|
||||
};
|
||||
|
||||
|
@ -38,13 +38,13 @@
|
||||
#include <basic/sbdef.hxx>
|
||||
#include <basic/sberrors.hxx>
|
||||
#include <com/sun/star/script/ModuleInfo.hpp>
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
|
||||
class SbModule; // completed module
|
||||
class SbiInstance; // runtime instance
|
||||
class SbiRuntime; // currently running procedure
|
||||
class SbiImage; // compiled image
|
||||
class BasicLibInfo; // info block for basic manager
|
||||
class SbiBreakpoints;
|
||||
class SbTextPortions;
|
||||
class SbMethod;
|
||||
class BasicManager;
|
||||
@ -78,6 +78,8 @@ class StarBASIC : public SbxObject
|
||||
SbxObjectRef pVBAGlobals;
|
||||
SbxObject* getVBAGlobals( );
|
||||
|
||||
void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
|
||||
|
||||
protected:
|
||||
BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen );
|
||||
private:
|
||||
@ -207,6 +209,9 @@ public:
|
||||
bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
|
||||
void QuitAndExitApplication();
|
||||
BOOL IsQuitApplication() { return bQuit; };
|
||||
|
||||
static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
|
||||
GetModelFromBasic( SbxObject* pBasic );
|
||||
};
|
||||
|
||||
#ifndef __SB_SBSTARBASICREF_HXX
|
||||
|
@ -106,6 +106,7 @@ enum SbxDataType {
|
||||
};
|
||||
|
||||
const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
|
||||
const UINT32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
|
||||
const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
|
||||
|
||||
#endif
|
||||
@ -317,6 +318,8 @@ enum SbxError { // Ergebnis einer Rechenoperation/Konversion
|
||||
#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
|
||||
#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
|
||||
#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
|
||||
#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
|
||||
// is used for objects, the other for variables only
|
||||
|
||||
// Broadcaster-IDs:
|
||||
#define SBX_HINT_DYING SFX_HINT_DYING
|
||||
|
@ -439,6 +439,7 @@ SV_DECL_REF(SbxInfo)
|
||||
class SfxBroadcaster;
|
||||
|
||||
class SbxVariableImpl;
|
||||
class StarBASIC;
|
||||
|
||||
class SbxVariable : public SbxValue
|
||||
{
|
||||
@ -499,7 +500,9 @@ public:
|
||||
|
||||
const String& GetDeclareClassName( void );
|
||||
void SetDeclareClassName( const String& );
|
||||
void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener );
|
||||
void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
|
||||
StarBASIC* pParentBasic );
|
||||
void ClearComListener( void );
|
||||
|
||||
static USHORT MakeHashCode( const String& rName );
|
||||
};
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
#define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) )
|
||||
#define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) )
|
||||
#define Str2Id( Str ) rtl::OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US )
|
||||
#define Id2Str( Id ) String( rtl::OStringToOUString( Id, RTL_TEXTENCODING_ASCII_US ) )
|
||||
|
||||
#define StartKenn CUniString("%")
|
||||
#define EndKenn CUniString("%")
|
||||
@ -42,7 +44,7 @@
|
||||
#define TabKenn ( StartKenn.AppendAscii("Tab") )
|
||||
#define MakeStringParam(Type,aText) ( Type.AppendAscii("=").Append( aText ).Append( EndKenn ) )
|
||||
#define MakeStringNumber(Type,nNumber) MakeStringParam (Type, UniString::CreateFromInt32(nNumber))
|
||||
#define UIdString(aID) MakeStringParam(UIdKenn,aID.GetText())
|
||||
#define UIdString(aID) MakeStringParam(UIdKenn,String(rtl::OStringToOUString( aID, RTL_TEXTENCODING_ASCII_US )))
|
||||
#define MethodString(nNumber) MakeStringNumber(MethodKenn,nNumber)
|
||||
#define TypeString(nNumber) MakeStringNumber(TypeKenn,nNumber)
|
||||
#define SlotString(nNumber) MakeStringNumber(SlotKenn,nNumber)
|
||||
|
2
basic/prj/build.lst
Executable file → Normal file
2
basic/prj/build.lst
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper NULL
|
||||
sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper LIBXSLT:libxslt NULL
|
||||
sb basic usr1 - all sb_mkout NULL
|
||||
sb basic\inc nmake - all sb_inc NULL
|
||||
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL
|
||||
|
@ -20,40 +20,10 @@ mkdir: %COMMON_DEST%\res%_EXT%
|
||||
..\%__SRC%\lib\libsample.a %_DEST%\lib%_EXT%\libsample.a
|
||||
|
||||
mkdir: %_DEST%\inc%_EXT%\basic
|
||||
..\inc\testtool.hrc %_DEST%\inc%_EXT%\basic\testtool.hrc
|
||||
..\inc\ttmsg.hrc %_DEST%\inc%_EXT%\basic\ttmsg.hrc
|
||||
..\inc\basic\ttglobal.hrc %_DEST%\inc%_EXT%\basic\ttglobal.hrc
|
||||
..\inc\svtmsg.hrc %_DEST%\inc%_EXT%\basic\svtmsg.hrc
|
||||
..\inc\basic\*.hxx %_DEST%\inc%_EXT%\basic\*.hxx
|
||||
..\inc\basic\*.hrc %_DEST%\inc%_EXT%\basic\*.hrc
|
||||
..\inc\basic\*.h %_DEST%\inc%_EXT%\basic\*.h
|
||||
|
||||
..\inc\basic\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx
|
||||
..\inc\basic\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx
|
||||
..\inc\basic\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx
|
||||
..\inc\basic\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx
|
||||
..\inc\basic\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx
|
||||
..\inc\basic\sbstar.hxx %_DEST%\inc%_EXT%\basic\sbstar.hxx
|
||||
..\inc\basic\sbuno.hxx %_DEST%\inc%_EXT%\basic\sbuno.hxx
|
||||
..\inc\basic\basmgr.hxx %_DEST%\inc%_EXT%\basic\basmgr.hxx
|
||||
..\inc\basic\sberrors.hxx %_DEST%\inc%_EXT%\basic\sberrors.hxx
|
||||
..\inc\basic\basrdll.hxx %_DEST%\inc%_EXT%\basic\basrdll.hxx
|
||||
..\inc\basic\sbstdobj.hxx %_DEST%\inc%_EXT%\basic\sbstdobj.hxx
|
||||
..\inc\basic\process.hxx %_DEST%\inc%_EXT%\basic\process.hxx
|
||||
..\inc\basic\mybasic.hxx %_DEST%\inc%_EXT%\basic\mybasic.hxx
|
||||
..\inc\basic\testtool.hxx %_DEST%\inc%_EXT%\basic\testtool.hxx
|
||||
..\inc\basic\basicrt.hxx %_DEST%\inc%_EXT%\basic\basicrt.hxx
|
||||
..\inc\basic\dispdefs.hxx %_DEST%\inc%_EXT%\basic\dispdefs.hxx
|
||||
..\inc\basic\ttstrhlp.hxx %_DEST%\inc%_EXT%\basic\ttstrhlp.hxx
|
||||
|
||||
..\inc\basic\sbx.hxx %_DEST%\inc%_EXT%\basic\sbx.hxx
|
||||
..\inc\basic\sbxcore.hxx %_DEST%\inc%_EXT%\basic\sbxcore.hxx
|
||||
..\inc\basic\sbxdef.hxx %_DEST%\inc%_EXT%\basic\sbxdef.hxx
|
||||
..\inc\basic\sbxform.hxx %_DEST%\inc%_EXT%\basic\sbxform.hxx
|
||||
..\inc\basic\sbxmeth.hxx %_DEST%\inc%_EXT%\basic\sbxmeth.hxx
|
||||
..\inc\basic\sbxobj.hxx %_DEST%\inc%_EXT%\basic\sbxobj.hxx
|
||||
..\inc\basic\sbxprop.hxx %_DEST%\inc%_EXT%\basic\sbxprop.hxx
|
||||
..\inc\basic\sbxvar.hxx %_DEST%\inc%_EXT%\basic\sbxvar.hxx
|
||||
..\inc\basic\sbxbase.hxx %_DEST%\inc%_EXT%\basic\sbxbase.hxx
|
||||
..\inc\basic\sbxfac.hxx %_DEST%\inc%_EXT%\basic\sbxfac.hxx
|
||||
..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx
|
||||
|
||||
..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx
|
||||
..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx
|
||||
..\%__SRC%\misc\sb.component %_DEST%\xml%_EXT%\sb.component
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "resids.hrc"
|
||||
|
||||
ModalDialog RID_CALLDLG {
|
||||
HelpID = "basic:ModalDialog:RID_CALLDLG";
|
||||
PosSize = MAP_SYSFONT (18,18,142,142);
|
||||
SVLook = TRUE;
|
||||
MOVEABLE = TRUE;
|
||||
@ -43,11 +44,13 @@ ModalDialog RID_CALLDLG {
|
||||
PosSize = MAP_SYSFONT (10,70,120,8);
|
||||
};
|
||||
Edit RID_RETVAL {
|
||||
HelpID = "basic:Edit:RID_CALLDLG:RID_RETVAL";
|
||||
PosSize = MAP_SYSFONT (10,85,120,12);
|
||||
Border = TRUE;
|
||||
TabStop = TRUE;
|
||||
};
|
||||
ListBox RID_PARAMS {
|
||||
HelpID = "basic:ListBox:RID_CALLDLG:RID_PARAMS";
|
||||
PosSize = MAP_SYSFONT (10,25,120,40);
|
||||
TabStop = TRUE;
|
||||
Border = TRUE;
|
||||
@ -61,6 +64,7 @@ ModalDialog RID_CALLDLG {
|
||||
};
|
||||
|
||||
ModalDialog IDD_ABOUT_DIALOG {
|
||||
HelpID = "basic:ModalDialog:IDD_ABOUT_DIALOG";
|
||||
Pos = MAP_APPFONT( 58, 17 );
|
||||
Size = MAP_APPFONT( 155, 106 );
|
||||
SVLook = TRUE;
|
||||
@ -107,6 +111,7 @@ ModalDialog IDD_ABOUT_DIALOG {
|
||||
};
|
||||
|
||||
ModalDialog IDD_TT_ABOUT_DIALOG {
|
||||
HelpID = "basic:ModalDialog:IDD_TT_ABOUT_DIALOG";
|
||||
Pos = MAP_APPFONT( 58, 17 );
|
||||
Size = MAP_APPFONT( 120, 81 );
|
||||
SVLook = TRUE;
|
||||
@ -138,6 +143,7 @@ ModalDialog IDD_TT_ABOUT_DIALOG {
|
||||
};
|
||||
|
||||
ModalDialog IDD_FIND_DIALOG {
|
||||
HelpID = "basic:ModalDialog:IDD_FIND_DIALOG";
|
||||
Pos = MAP_APPFONT( 69, 30 );
|
||||
Size = MAP_APPFONT( 185, 70 );
|
||||
SVLook = TRUE;
|
||||
@ -150,6 +156,7 @@ ModalDialog IDD_FIND_DIALOG {
|
||||
TEXT[ en-US ] = "~Text";
|
||||
};
|
||||
Edit RID_FIND {
|
||||
HelpID = "basic:Edit:IDD_FIND_DIALOG:RID_FIND";
|
||||
BORDER = TRUE;
|
||||
Pos = MAP_APPFONT( 40, 8 );
|
||||
Size = MAP_APPFONT( 135, 12 );
|
||||
@ -172,6 +179,7 @@ ModalDialog IDD_FIND_DIALOG {
|
||||
};
|
||||
|
||||
ModalDialog IDD_REPLACE_DIALOG {
|
||||
HelpID = "basic:ModalDialog:IDD_REPLACE_DIALOG";
|
||||
Pos = MAP_APPFONT( 69, 30 );
|
||||
Size = MAP_APPFONT( 185, 88 );
|
||||
SVLook = TRUE;
|
||||
@ -188,12 +196,14 @@ ModalDialog IDD_REPLACE_DIALOG {
|
||||
TEXT[ en-US ] = "~Replace by";
|
||||
};
|
||||
Edit RID_FIND {
|
||||
HelpID = "basic:Edit:IDD_REPLACE_DIALOG:RID_FIND";
|
||||
BORDER = TRUE;
|
||||
Pos = MAP_APPFONT( 65, 8 );
|
||||
Size = MAP_APPFONT( 110, 12 );
|
||||
TABSTOP = TRUE;
|
||||
};
|
||||
Edit RID_REPLACE {
|
||||
HelpID = "basic:Edit:IDD_REPLACE_DIALOG:RID_REPLACE";
|
||||
BORDER = TRUE;
|
||||
Pos = MAP_APPFONT( 65, 28 );
|
||||
Size = MAP_APPFONT( 110, 12 );
|
||||
@ -718,6 +728,7 @@ Menu RID_HELP {
|
||||
};
|
||||
};
|
||||
ModelessDialog IDD_PRINT_DIALOG {
|
||||
HelpID = "basic:ModelessDialog:IDD_PRINT_DIALOG";
|
||||
Pos = MAP_APPFONT( 83, 42 );
|
||||
Size = MAP_APPFONT( 171, 94 );
|
||||
MOVEABLE = TRUE;
|
||||
@ -784,6 +795,7 @@ TabDialog IDD_OPTIONS_DLG
|
||||
|
||||
|
||||
TabPage RID_TP_GENERIC {
|
||||
HelpID = "basic:TabPage:RID_TP_GENERIC";
|
||||
Hide = TRUE ;
|
||||
SVLook = TRUE ;
|
||||
Size = MAP_APPFONT( 244, 100 );
|
||||
@ -793,6 +805,7 @@ TabPage RID_TP_GENERIC {
|
||||
Text[ en-US ] = "Area";
|
||||
};
|
||||
ComboBox RID_CB_AREA {
|
||||
HelpID = "basic:ComboBox:RID_TP_GENERIC:RID_CB_AREA";
|
||||
HScroll = TRUE;
|
||||
VScroll = TRUE;
|
||||
AutoHScroll = TRUE;
|
||||
@ -803,12 +816,14 @@ TabPage RID_TP_GENERIC {
|
||||
DropDown = TRUE;
|
||||
};
|
||||
PushButton RID_PB_NEW_AREA {
|
||||
HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_NEW_AREA";
|
||||
Pos = MAP_APPFONT( 144, 12 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "New";
|
||||
};
|
||||
PushButton RID_PD_DEL_AREA {
|
||||
HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PD_DEL_AREA";
|
||||
Pos = MAP_APPFONT( 188, 12 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -820,6 +835,7 @@ TabPage RID_TP_GENERIC {
|
||||
Text[ en-US ] = "Setting";
|
||||
};
|
||||
ComboBox RID_CB_VALUE {
|
||||
HelpID = "basic:ComboBox:RID_TP_GENERIC:RID_CB_VALUE";
|
||||
HScroll = TRUE;
|
||||
VScroll = TRUE;
|
||||
AutoHScroll = TRUE;
|
||||
@ -829,6 +845,7 @@ TabPage RID_TP_GENERIC {
|
||||
TabStop = TRUE;
|
||||
};
|
||||
PushButton RID_PB_SELECT_FILE {
|
||||
HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_SELECT_FILE";
|
||||
Pos = MAP_APPFONT( 188, 48 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -837,12 +854,14 @@ TabPage RID_TP_GENERIC {
|
||||
Hide = TRUE;
|
||||
};
|
||||
PushButton RID_PB_NEW_VALUE {
|
||||
HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_NEW_VALUE";
|
||||
Pos = MAP_APPFONT( 188, 48 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "New";
|
||||
};
|
||||
PushButton RID_PB_DEL_VALUE {
|
||||
HelpID = "basic:PushButton:RID_TP_GENERIC:RID_PB_DEL_VALUE";
|
||||
Pos = MAP_APPFONT( 188, 64 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -852,6 +871,7 @@ TabPage RID_TP_GENERIC {
|
||||
|
||||
|
||||
TabPage RID_TP_PROFILE {
|
||||
HelpID = "basic:TabPage:RID_TP_PROFILE";
|
||||
Hide = TRUE ;
|
||||
SVLook = TRUE ;
|
||||
Size = MAP_APPFONT( 244, 100 );
|
||||
@ -861,6 +881,7 @@ TabPage RID_TP_PROFILE {
|
||||
Text[ en-US ] = "Profile";
|
||||
};
|
||||
ComboBox RID_CB_PROFILE {
|
||||
HelpID = "basic:ComboBox:RID_TP_PROFILE:RID_CB_PROFILE";
|
||||
HScroll = TRUE;
|
||||
VScroll = TRUE;
|
||||
AutoHScroll = TRUE;
|
||||
@ -871,12 +892,14 @@ TabPage RID_TP_PROFILE {
|
||||
DropDown = TRUE;
|
||||
};
|
||||
PushButton RID_PB_NEW_PROFILE {
|
||||
HelpID = "basic:PushButton:RID_TP_PROFILE:RID_PB_NEW_PROFILE";
|
||||
Pos = MAP_APPFONT( 144, 2 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "New";
|
||||
};
|
||||
PushButton RID_PD_DEL_PROFILE {
|
||||
HelpID = "basic:PushButton:RID_TP_PROFILE:RID_PD_DEL_PROFILE";
|
||||
Pos = MAP_APPFONT( 188, 2 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -898,6 +921,7 @@ TabPage RID_TP_PROFILE {
|
||||
Text[ en-US ] = "Base directory";
|
||||
};
|
||||
CheckBox HID_CHECK {
|
||||
HelpID = "basic:CheckBox:RID_TP_PROFILE:HID_CHECK";
|
||||
Pos = MAP_APPFONT( 7, 58 );
|
||||
Size = MAP_APPFONT( 86, 12 );
|
||||
Text[ en-US ] = "Default HID directory";
|
||||
@ -905,52 +929,61 @@ TabPage RID_TP_PROFILE {
|
||||
Hide = FALSE;
|
||||
};
|
||||
Edit LOG_NAME {
|
||||
HelpID = "basic:Edit:RID_TP_PROFILE:LOG_NAME";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 97, 26 );
|
||||
Size = MAP_APPFONT( 116, 12 );
|
||||
TabStop = TRUE;
|
||||
};
|
||||
Edit BASIS_NAME {
|
||||
HelpID = "basic:Edit:RID_TP_PROFILE:BASIS_NAME";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 97, 42 );
|
||||
Size = MAP_APPFONT( 116, 12 );
|
||||
TabStop = TRUE;
|
||||
};
|
||||
Edit HID_NAME {
|
||||
HelpID = "basic:Edit:RID_TP_PROFILE:HID_NAME";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 97, 58 );
|
||||
Size = MAP_APPFONT( 116, 12 );
|
||||
TabStop = TRUE;
|
||||
};
|
||||
PushButton LOG_SET {
|
||||
HelpID = "basic:PushButton:RID_TP_PROFILE:LOG_SET";
|
||||
Pos = MAP_APPFONT( 217, 26 );
|
||||
Size = MAP_APPFONT( 12, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "...";
|
||||
};
|
||||
PushButton BASIS_SET {
|
||||
HelpID = "basic:PushButton:RID_TP_PROFILE:BASIS_SET";
|
||||
Pos = MAP_APPFONT( 217, 42 );
|
||||
Size = MAP_APPFONT( 12, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "...";
|
||||
};
|
||||
PushButton HID_SET {
|
||||
HelpID = "basic:PushButton:RID_TP_PROFILE:HID_SET";
|
||||
Pos = MAP_APPFONT( 217, 58 );
|
||||
Size = MAP_APPFONT( 12, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "...";
|
||||
};
|
||||
CheckBox CB_AUTORELOAD {
|
||||
HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_AUTORELOAD";
|
||||
Pos = MAP_APPFONT( 7, 74 );
|
||||
Size = MAP_APPFONT( 115, 12 );
|
||||
Text[ en-US ] = "AutoReload";
|
||||
};
|
||||
CheckBox CB_AUTOSAVE {
|
||||
HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_AUTOSAVE";
|
||||
Pos = MAP_APPFONT( 7, 87 );
|
||||
Size = MAP_APPFONT( 115, 12 );
|
||||
Text[ en-US ] = "Save before execute";
|
||||
};
|
||||
CheckBox CB_STOPONSYNTAXERRORS {
|
||||
HelpID = "basic:CheckBox:RID_TP_PROFILE:CB_STOPONSYNTAXERRORS";
|
||||
Pos = MAP_APPFONT( 132, 74 );
|
||||
Size = MAP_APPFONT( 115, 12 );
|
||||
Text[ en-US ] = "Stop on Syntax Errors";
|
||||
@ -958,6 +991,7 @@ TabPage RID_TP_PROFILE {
|
||||
};
|
||||
|
||||
TabPage RID_TP_CRASH {
|
||||
HelpID = "basic:TabPage:RID_TP_CRASH";
|
||||
Hide = TRUE ;
|
||||
SVLook = TRUE ;
|
||||
Size = MAP_APPFONT( 244, 100 );
|
||||
@ -967,6 +1001,7 @@ TabPage RID_TP_CRASH {
|
||||
Text[ en-US ] = "Crashreport";
|
||||
};
|
||||
CheckBox CB_USEPROXY {
|
||||
HelpID = "basic:CheckBox:RID_TP_CRASH:CB_USEPROXY";
|
||||
Pos = MAP_APPFONT( 8, 12 );
|
||||
Size = MAP_APPFONT( 120, 12 );
|
||||
Text[ en-US ] = "Use Proxy";
|
||||
@ -977,6 +1012,7 @@ TabPage RID_TP_CRASH {
|
||||
Text[ en-US ] = "Host";
|
||||
};
|
||||
Edit ED_CRHOST {
|
||||
HelpID = "basic:Edit:RID_TP_CRASH:ED_CRHOST";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 43+12, 12+13 );
|
||||
Size = MAP_APPFONT( 80, 12 );
|
||||
@ -988,6 +1024,7 @@ TabPage RID_TP_CRASH {
|
||||
Text[ en-US ] = "Port";
|
||||
};
|
||||
NumericField NF_CRPORT {
|
||||
HelpID = "basic:NumericField:RID_TP_CRASH:NF_CRPORT";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 43+12, 12+13+16 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1001,6 +1038,7 @@ TabPage RID_TP_CRASH {
|
||||
Last = 0xffff;
|
||||
};
|
||||
CheckBox CB_ALLOWCONTACT {
|
||||
HelpID = "basic:CheckBox:RID_TP_CRASH:CB_ALLOWCONTACT";
|
||||
Pos = MAP_APPFONT( 8, 12+13+16+16 );
|
||||
Size = MAP_APPFONT( 120, 12 );
|
||||
Text[ en-US ] = "Allow Contact";
|
||||
@ -1011,6 +1049,7 @@ TabPage RID_TP_CRASH {
|
||||
Text[ en-US ] = "EMail";
|
||||
};
|
||||
Edit ED_EMAIL {
|
||||
HelpID = "basic:Edit:RID_TP_CRASH:ED_EMAIL";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 43+12, 12+13+16+16+13 );
|
||||
Size = MAP_APPFONT( 80, 12 );
|
||||
@ -1020,6 +1059,7 @@ TabPage RID_TP_CRASH {
|
||||
|
||||
|
||||
TabPage RID_TP_MISC {
|
||||
HelpID = "basic:TabPage:RID_TP_MISC";
|
||||
Hide = TRUE ;
|
||||
SVLook = TRUE ;
|
||||
Size = MAP_APPFONT( 244, 100 );
|
||||
@ -1034,6 +1074,7 @@ TabPage RID_TP_MISC {
|
||||
Text[ en-US ] = "Host";
|
||||
};
|
||||
Edit ED_HOST {
|
||||
HelpID = "basic:Edit:RID_TP_MISC:ED_HOST";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 43, 12);
|
||||
Size = MAP_APPFONT( 80, 12 );
|
||||
@ -1045,6 +1086,7 @@ TabPage RID_TP_MISC {
|
||||
Text[ en-US ] = "Testtool Port";
|
||||
};
|
||||
NumericField NF_TTPORT {
|
||||
HelpID = "basic:NumericField:RID_TP_MISC:NF_TTPORT";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 191, 12);
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1063,6 +1105,7 @@ TabPage RID_TP_MISC {
|
||||
Text[ en-US ] = "Remote UNO Port";
|
||||
};
|
||||
NumericField NF_UNOPORT {
|
||||
HelpID = "basic:NumericField:RID_TP_MISC:NF_UNOPORT";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 191, 12+15);
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1087,6 +1130,7 @@ TabPage RID_TP_MISC {
|
||||
Text[ en-US ] = "Server Timeout";
|
||||
};
|
||||
TimeField SERVER_TIMEOUT {
|
||||
HelpID = "basic:TimeField:RID_TP_MISC:SERVER_TIMEOUT";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 83, 50 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1102,6 +1146,7 @@ TabPage RID_TP_MISC {
|
||||
Text[ en-US ] = "Max LRU Files";
|
||||
};
|
||||
NumericField TF_MAX_LRU {
|
||||
HelpID = "basic:NumericField:RID_TP_MISC:TF_MAX_LRU";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 191, 50);
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1118,12 +1163,14 @@ TabPage RID_TP_MISC {
|
||||
Text[ en-US ] = "OOo Program Dir";
|
||||
};
|
||||
Edit ED_PROGDIR {
|
||||
HelpID = "basic:Edit:RID_TP_MISC:ED_PROGDIR";
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 83, 50+15 );
|
||||
Size = MAP_APPFONT( 219-83-4, 12 );
|
||||
TabStop = TRUE;
|
||||
};
|
||||
PushButton PB_PROGDIR {
|
||||
HelpID = "basic:PushButton:RID_TP_MISC:PB_PROGDIR";
|
||||
Pos = MAP_APPFONT( 219, 50+15 );
|
||||
Size = MAP_APPFONT( 12, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -1133,6 +1180,7 @@ TabPage RID_TP_MISC {
|
||||
|
||||
|
||||
TabPage RID_TP_FONT {
|
||||
HelpID = "basic:TabPage:RID_TP_FONT";
|
||||
Hide = TRUE ;
|
||||
SVLook = TRUE ;
|
||||
Size = MAP_APPFONT( 244, 100 );
|
||||
@ -1142,6 +1190,7 @@ TabPage RID_TP_FONT {
|
||||
Text[ en-US ] = "Type";
|
||||
};
|
||||
ComboBox CB_FONTNAME {
|
||||
HelpID = "basic:ComboBox:RID_TP_FONT:CB_FONTNAME";
|
||||
Pos = MAP_APPFONT( 4, 12 );
|
||||
Size = MAP_APPFONT( 123, 12*4 );
|
||||
Sort = TRUE;
|
||||
@ -1153,6 +1202,7 @@ TabPage RID_TP_FONT {
|
||||
Text[ en-US ] = "Typeface";
|
||||
};
|
||||
ComboBox CB_FONTSTYLE {
|
||||
HelpID = "basic:ComboBox:RID_TP_FONT:CB_FONTSTYLE";
|
||||
Pos = MAP_APPFONT( 131, 12 );
|
||||
Size = MAP_APPFONT( 65, 12*4 );
|
||||
AutoHScroll = TRUE;
|
||||
@ -1163,6 +1213,7 @@ TabPage RID_TP_FONT {
|
||||
Text[ en-US ] = "Size";
|
||||
};
|
||||
MetricBox MB_FONTSIZE {
|
||||
HelpID = "basic:MetricBox:RID_TP_FONT:MB_FONTSIZE";
|
||||
Pos = MAP_APPFONT( 200, 12 );
|
||||
Size = MAP_APPFONT( 29, 12*4 );
|
||||
AutoHScroll = TRUE;
|
||||
@ -1178,6 +1229,7 @@ TabPage RID_TP_FONT {
|
||||
|
||||
|
||||
FloatingWindow IDD_DISPLAY_HID {
|
||||
HelpID = "basic:FloatingWindow:IDD_DISPLAY_HID";
|
||||
OutputSize = TRUE;
|
||||
SVLook = TRUE;
|
||||
Size = MAP_APPFONT( 261, 160 );
|
||||
@ -1204,6 +1256,7 @@ FloatingWindow IDD_DISPLAY_HID {
|
||||
Text[ en-US ] = "Controls";
|
||||
};
|
||||
MultiListBox RID_MLB_CONTROLS {
|
||||
HelpID = "basic:MultiListBox:IDD_DISPLAY_HID:RID_MLB_CONTROLS";
|
||||
Border = TRUE;
|
||||
AutoHScroll = TRUE;
|
||||
Pos = MAP_APPFONT( 4, 28 );
|
||||
@ -1216,6 +1269,7 @@ FloatingWindow IDD_DISPLAY_HID {
|
||||
Text[ en-US ] = "Slots";
|
||||
};
|
||||
MultiListBox RID_MLB_SLOTS {
|
||||
HelpID = "basic:MultiListBox:IDD_DISPLAY_HID:RID_MLB_SLOTS";
|
||||
Border = TRUE;
|
||||
AutoHScroll = TRUE;
|
||||
Pos = MAP_APPFONT( 4, 132 );
|
||||
@ -1223,12 +1277,14 @@ FloatingWindow IDD_DISPLAY_HID {
|
||||
TabStop = TRUE;
|
||||
};
|
||||
PushButton RID_PB_KOPIEREN {
|
||||
HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_KOPIEREN";
|
||||
Pos = MAP_APPFONT( 216, 28 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
Text[ en-US ] = "Copy";
|
||||
};
|
||||
PushButton RID_PB_BENENNEN {
|
||||
HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_BENENNEN";
|
||||
Pos = MAP_APPFONT( 216, 44 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -1236,6 +1292,7 @@ FloatingWindow IDD_DISPLAY_HID {
|
||||
Text[ en-US ] = "Name";
|
||||
};
|
||||
PushButton RID_PB_SELECTALL {
|
||||
HelpID = "basic:PushButton:IDD_DISPLAY_HID:RID_PB_SELECTALL";
|
||||
Pos = MAP_APPFONT( 216, 44 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
TabStop = TRUE;
|
||||
@ -1356,6 +1413,7 @@ ImageList RID_IMGLST_LAYOUT
|
||||
};
|
||||
|
||||
ModelessDialog IDD_EDIT_VAR {
|
||||
HelpID = "basic:ModelessDialog:IDD_EDIT_VAR";
|
||||
Pos = MAP_APPFONT( 0, 0 );
|
||||
Size = MAP_APPFONT( 171, 87 );
|
||||
Moveable = TRUE;
|
||||
@ -1386,6 +1444,7 @@ ModelessDialog IDD_EDIT_VAR {
|
||||
Text[ en-US ] = "Previous contents";
|
||||
};
|
||||
RadioButton RID_RB_NEW_BOOL_T {
|
||||
HelpID = "basic:RadioButton:IDD_EDIT_VAR:RID_RB_NEW_BOOL_T";
|
||||
Hide = TRUE;
|
||||
Pos = MAP_APPFONT( 53, 37 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1393,6 +1452,7 @@ ModelessDialog IDD_EDIT_VAR {
|
||||
Text[ en-US ] = "True";
|
||||
};
|
||||
RadioButton RID_RB_NEW_BOOL_F {
|
||||
HelpID = "basic:RadioButton:IDD_EDIT_VAR:RID_RB_NEW_BOOL_F";
|
||||
Hide = TRUE;
|
||||
Pos = MAP_APPFONT( 98, 37 );
|
||||
Size = MAP_APPFONT( 40, 12 );
|
||||
@ -1400,6 +1460,7 @@ ModelessDialog IDD_EDIT_VAR {
|
||||
Text[ en-US ] = "False";
|
||||
};
|
||||
NumericField RID_NF_NEW_INTEGER {
|
||||
HelpID = "basic:NumericField:IDD_EDIT_VAR:RID_NF_NEW_INTEGER";
|
||||
Border = TRUE;
|
||||
Hide = TRUE;
|
||||
Pos = MAP_APPFONT( 53, 37 );
|
||||
@ -1414,6 +1475,7 @@ ModelessDialog IDD_EDIT_VAR {
|
||||
SpinSize = 10;
|
||||
};
|
||||
NumericField RID_NF_NEW_LONG {
|
||||
HelpID = "basic:NumericField:IDD_EDIT_VAR:RID_NF_NEW_LONG";
|
||||
Border = TRUE;
|
||||
Hide = TRUE;
|
||||
Pos = MAP_APPFONT( 53, 37 );
|
||||
@ -1428,6 +1490,7 @@ ModelessDialog IDD_EDIT_VAR {
|
||||
SpinSize = 10;
|
||||
};
|
||||
Edit RID_ED_NEW_STRING {
|
||||
HelpID = "basic:Edit:IDD_EDIT_VAR:RID_ED_NEW_STRING";
|
||||
Hide = TRUE;
|
||||
Border = TRUE;
|
||||
Pos = MAP_APPFONT( 53, 37 );
|
||||
@ -1449,6 +1512,7 @@ ModelessDialog IDD_EDIT_VAR {
|
||||
};
|
||||
|
||||
FloatingWindow LOAD_CONF {
|
||||
HelpID = "basic:FloatingWindow:LOAD_CONF";
|
||||
SVLook = TRUE;
|
||||
Pos = MAP_APPFONT( 66, 23 );
|
||||
Size = MAP_APPFONT( 156, 51 );
|
||||
|
@ -24,7 +24,7 @@
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
#include "svtmsg.hrc"
|
||||
#include "basic/svtmsg.hrc"
|
||||
|
||||
|
||||
// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
|
||||
|
@ -24,7 +24,7 @@
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
#include "testtool.hrc"
|
||||
#include "basic/testtool.hrc"
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
|
@ -24,7 +24,7 @@
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
#include "ttmsg.hrc"
|
||||
#include "basic/ttmsg.hrc"
|
||||
|
||||
|
||||
// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten
|
||||
|
@ -139,9 +139,17 @@ namespace basic
|
||||
impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel );
|
||||
|
||||
/** creates a new BasicManager instance for the given model
|
||||
|
||||
@param _out_rpBasicManager
|
||||
reference to the pointer variable that will hold the new
|
||||
BasicManager.
|
||||
|
||||
@param _rxDocumentModel
|
||||
the model whose BasicManager will be created. Must not be <NULL/>.
|
||||
*/
|
||||
BasicManagerPointer
|
||||
impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel );
|
||||
void impl_createManagerForModel(
|
||||
BasicManagerPointer& _out_rpBasicManager,
|
||||
const Reference< XModel >& _rxDocumentModel );
|
||||
|
||||
/** creates the application-wide BasicManager
|
||||
*/
|
||||
@ -244,9 +252,17 @@ namespace basic
|
||||
{
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
/* #163556# (DR) - This function may be called recursively while
|
||||
constructing the Basic manager and loading the Basic storage. By
|
||||
passing the map entry received from impl_getLocationForModel() to
|
||||
the function impl_createManagerForModel(), the new Basic manager
|
||||
will be put immediately into the map of existing Basic managers,
|
||||
thus a recursive call of this function will find and return it
|
||||
without creating another instance.
|
||||
*/
|
||||
BasicManagerPointer& pBasicManager = impl_getLocationForModel( _rxDocumentModel );
|
||||
if ( pBasicManager == NULL )
|
||||
pBasicManager = impl_createManagerForModel( _rxDocumentModel );
|
||||
impl_createManagerForModel( pBasicManager, _rxDocumentModel );
|
||||
|
||||
return pBasicManager;
|
||||
}
|
||||
@ -408,21 +424,21 @@ namespace basic
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
BasicManagerPointer ImplRepository::impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel )
|
||||
void ImplRepository::impl_createManagerForModel( BasicManagerPointer& _out_rpBasicManager, const Reference< XModel >& _rxDocumentModel )
|
||||
{
|
||||
StarBASIC* pAppBasic = impl_getDefaultAppBasicLibrary();
|
||||
|
||||
BasicManager* pBasicManager( NULL );
|
||||
_out_rpBasicManager = 0;
|
||||
Reference< XStorage > xStorage;
|
||||
if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) )
|
||||
// the document is not able to provide the storage it is based on.
|
||||
return pBasicManager;
|
||||
return;
|
||||
|
||||
Reference< XPersistentLibraryContainer > xBasicLibs;
|
||||
Reference< XPersistentLibraryContainer > xDialogLibs;
|
||||
if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) )
|
||||
// the document does not have BasicLibraries and DialogLibraries
|
||||
return pBasicManager;
|
||||
return;
|
||||
|
||||
if ( xStorage.is() )
|
||||
{
|
||||
@ -433,24 +449,24 @@ namespace basic
|
||||
|
||||
// Storage and BaseURL are only needed by binary documents!
|
||||
SotStorageRef xDummyStor = new SotStorage( ::rtl::OUString() );
|
||||
pBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */,
|
||||
_out_rpBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */,
|
||||
pAppBasic,
|
||||
&aAppBasicDir, TRUE );
|
||||
if ( pBasicManager->HasErrors() )
|
||||
if ( _out_rpBasicManager->HasErrors() )
|
||||
{
|
||||
// handle errors
|
||||
BasicError* pErr = pBasicManager->GetFirstError();
|
||||
BasicError* pErr = _out_rpBasicManager->GetFirstError();
|
||||
while ( pErr )
|
||||
{
|
||||
// show message to user
|
||||
if ( ERRCODE_BUTTON_CANCEL == ErrorHandler::HandleError( pErr->GetErrorId() ) )
|
||||
{
|
||||
// user wants to break loading of BASIC-manager
|
||||
BasicManagerCleaner::deleteBasicManager( pBasicManager );
|
||||
BasicManagerCleaner::deleteBasicManager( _out_rpBasicManager );
|
||||
xStorage.clear();
|
||||
break;
|
||||
}
|
||||
pErr = pBasicManager->GetNextError();
|
||||
pErr = _out_rpBasicManager->GetNextError();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -461,14 +477,14 @@ namespace basic
|
||||
// create new BASIC-manager
|
||||
StarBASIC* pBasic = new StarBASIC( pAppBasic );
|
||||
pBasic->SetFlag( SBX_EXTSEARCH );
|
||||
pBasicManager = new BasicManager( pBasic, NULL, TRUE );
|
||||
_out_rpBasicManager = new BasicManager( pBasic, NULL, TRUE );
|
||||
}
|
||||
|
||||
// knit the containers with the BasicManager
|
||||
LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< OldBasicPassword* >( xBasicLibs.get() ) );
|
||||
OSL_ENSURE( aInfo.mpOldBasicPassword, "ImplRepository::impl_createManagerForModel: wrong BasicLibraries implementation!" );
|
||||
pBasicManager->SetLibraryContainerInfo( aInfo );
|
||||
//pBasicCont->setBasicManager( pBasicManager );
|
||||
_out_rpBasicManager->SetLibraryContainerInfo( aInfo );
|
||||
//pBasicCont->setBasicManager( _out_rpBasicManager );
|
||||
// that's not needed anymore today. The containers will retrieve their associated
|
||||
// BasicManager from the BasicManagerRepository, when needed.
|
||||
|
||||
@ -476,13 +492,13 @@ namespace basic
|
||||
impl_initDocLibraryContainers_nothrow( xBasicLibs, xDialogLibs );
|
||||
|
||||
// damit auch Dialoge etc. 'qualifiziert' angesprochen werden k"onnen
|
||||
pBasicManager->GetLib(0)->SetParent( pAppBasic );
|
||||
_out_rpBasicManager->GetLib(0)->SetParent( pAppBasic );
|
||||
|
||||
// global properties in the document's Basic
|
||||
pBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) );
|
||||
_out_rpBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) );
|
||||
|
||||
// notify
|
||||
impl_notifyCreationListeners( _rxDocumentModel, *pBasicManager );
|
||||
impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager );
|
||||
|
||||
// register as listener for this model being disposed/closed
|
||||
Reference< XComponent > xDocumentComponent( _rxDocumentModel, UNO_QUERY );
|
||||
@ -490,9 +506,7 @@ namespace basic
|
||||
startComponentListening( xDocumentComponent );
|
||||
|
||||
// register as listener for the BasicManager being destroyed
|
||||
StartListening( *pBasicManager );
|
||||
|
||||
return pBasicManager;
|
||||
StartListening( *_out_rpBasicManager );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -88,54 +88,6 @@ using namespace ::cppu;
|
||||
using namespace ::osl;
|
||||
|
||||
|
||||
|
||||
Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic )
|
||||
{
|
||||
OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" );
|
||||
if ( !pBasic )
|
||||
return NULL;
|
||||
|
||||
// look for the ThisComponent variable, first in the parent (which
|
||||
// might be the document's Basic), then in the parent's parent (which might be
|
||||
// the application Basic)
|
||||
const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) );
|
||||
SbxVariable* pThisComponent = NULL;
|
||||
|
||||
SbxObject* pLookup = pBasic->GetParent();
|
||||
while ( pLookup && !pThisComponent )
|
||||
{
|
||||
pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT );
|
||||
pLookup = pLookup->GetParent();
|
||||
}
|
||||
if ( !pThisComponent )
|
||||
{
|
||||
OSL_TRACE("Failed to get ThisComponent");
|
||||
// the application Basic, at the latest, should have this variable
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Any aThisComponent( sbxToUnoValue( pThisComponent ) );
|
||||
Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY );
|
||||
if ( !xModel.is() )
|
||||
{
|
||||
// it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller.
|
||||
Reference< frame::XController > xController( aThisComponent, UNO_QUERY );
|
||||
if ( xController.is() )
|
||||
xModel = xController->getModel();
|
||||
}
|
||||
|
||||
if ( !xModel.is() )
|
||||
return NULL;
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
OSL_TRACE("Have model ThisComponent points to url %s",
|
||||
::rtl::OUStringToOString( xModel->getURL(),
|
||||
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
|
||||
#endif
|
||||
|
||||
return xModel;
|
||||
}
|
||||
|
||||
void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel )
|
||||
{
|
||||
OSL_TRACE("SFURL_firing_impl() processing script url %s",
|
||||
@ -569,7 +521,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
|
||||
bool bDocDialog = false;
|
||||
StarBASIC* pFoundBasic = NULL;
|
||||
OSL_TRACE("About to try get a hold of ThisComponent");
|
||||
Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
|
||||
Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ;
|
||||
aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
|
||||
// If we found the dialog then it belongs to the Search basic
|
||||
if ( !pFoundBasic )
|
||||
|
@ -71,6 +71,7 @@ TYPEINIT1(StarBASIC,SbxObject)
|
||||
|
||||
#define RTLNAME "@SBRTL"
|
||||
// i#i68894#
|
||||
using namespace ::com::sun::star;
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::uno::Any;
|
||||
using com::sun::star::uno::UNO_QUERY;
|
||||
@ -346,7 +347,18 @@ SbxObject* SbFormFactory::CreateObject( const String& rClassName )
|
||||
{
|
||||
if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) )
|
||||
{
|
||||
pFormModule->Load();
|
||||
bool bInitState = pFormModule->getInitState();
|
||||
if( bInitState )
|
||||
{
|
||||
// Not the first instantiate, reset
|
||||
bool bTriggerTerminateEvent = false;
|
||||
pFormModule->ResetApiObj( bTriggerTerminateEvent );
|
||||
pFormModule->setInitState( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
pFormModule->Load();
|
||||
}
|
||||
return pFormModule->CreateInstance();
|
||||
}
|
||||
}
|
||||
@ -564,7 +576,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
|
||||
if( pObj != NULL )
|
||||
{
|
||||
String aObjClass = pObj->GetClassName();
|
||||
(void)aObjClass;
|
||||
|
||||
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
|
||||
if( pClassModuleObj != NULL )
|
||||
@ -611,93 +622,7 @@ SbClassModuleObject::~SbClassModuleObject()
|
||||
void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
|
||||
const SfxHint& rHint, const TypeId& rHintType )
|
||||
{
|
||||
bool bDone = false;
|
||||
|
||||
const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
|
||||
if( pHint )
|
||||
{
|
||||
SbxVariable* pVar = pHint->GetVar();
|
||||
SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
|
||||
if( pProcProperty )
|
||||
{
|
||||
bDone = true;
|
||||
|
||||
if( pHint->GetId() == SBX_HINT_DATAWANTED )
|
||||
{
|
||||
String aProcName;
|
||||
aProcName.AppendAscii( "Property Get " );
|
||||
aProcName += pProcProperty->GetName();
|
||||
|
||||
SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
|
||||
if( pMeth )
|
||||
{
|
||||
SbxValues aVals;
|
||||
aVals.eType = SbxVARIANT;
|
||||
|
||||
SbxArray* pArg = pVar->GetParameters();
|
||||
USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
|
||||
if( nVarParCount > 1 )
|
||||
{
|
||||
SbxArrayRef xMethParameters = new SbxArray;
|
||||
xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
|
||||
for( USHORT i = 1 ; i < nVarParCount ; ++i )
|
||||
{
|
||||
SbxVariable* pPar = pArg->Get( i );
|
||||
xMethParameters->Put( pPar, i );
|
||||
}
|
||||
|
||||
pMeth->SetParameters( xMethParameters );
|
||||
pMeth->Get( aVals );
|
||||
pMeth->SetParameters( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
pMeth->Get( aVals );
|
||||
}
|
||||
|
||||
pVar->Put( aVals );
|
||||
}
|
||||
}
|
||||
else if( pHint->GetId() == SBX_HINT_DATACHANGED )
|
||||
{
|
||||
SbxVariable* pMeth = NULL;
|
||||
|
||||
bool bSet = pProcProperty->isSet();
|
||||
if( bSet )
|
||||
{
|
||||
pProcProperty->setSet( false );
|
||||
|
||||
String aProcName;
|
||||
aProcName.AppendAscii( "Property Set " );
|
||||
aProcName += pProcProperty->GetName();
|
||||
pMeth = Find( aProcName, SbxCLASS_METHOD );
|
||||
}
|
||||
if( !pMeth ) // Let
|
||||
{
|
||||
String aProcName;
|
||||
aProcName.AppendAscii( "Property Let " );
|
||||
aProcName += pProcProperty->GetName();
|
||||
pMeth = Find( aProcName, SbxCLASS_METHOD );
|
||||
}
|
||||
|
||||
if( pMeth )
|
||||
{
|
||||
// Setup parameters
|
||||
SbxArrayRef xArray = new SbxArray;
|
||||
xArray->Put( pMeth, 0 ); // Method as parameter 0
|
||||
xArray->Put( pVar, 1 );
|
||||
pMeth->SetParameters( xArray );
|
||||
|
||||
SbxValues aVals;
|
||||
pMeth->Get( aVals );
|
||||
pMeth->SetParameters( NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !bDone )
|
||||
SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
|
||||
handleProcedureProperties( rBC, rHint );
|
||||
}
|
||||
|
||||
SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
|
||||
@ -809,6 +734,9 @@ SbModule* SbClassFactory::FindClass( const String& rClassName )
|
||||
return pMod;
|
||||
}
|
||||
|
||||
typedef std::vector< StarBASIC* > DocBasicVector;
|
||||
static DocBasicVector GaDocBasics;
|
||||
|
||||
StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
|
||||
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic )
|
||||
{
|
||||
@ -822,8 +750,6 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
|
||||
{
|
||||
pSBFAC = new SbiFactory;
|
||||
AddFactory( pSBFAC );
|
||||
pUNOFAC = new SbUnoFactory;
|
||||
AddFactory( pUNOFAC );
|
||||
pTYPEFAC = new SbTypeFactory;
|
||||
AddFactory( pTYPEFAC );
|
||||
pCLASSFAC = new SbClassFactory;
|
||||
@ -832,12 +758,17 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
|
||||
AddFactory( pOLEFAC );
|
||||
pFORMFAC = new SbFormFactory;
|
||||
AddFactory( pFORMFAC );
|
||||
pUNOFAC = new SbUnoFactory;
|
||||
AddFactory( pUNOFAC );
|
||||
}
|
||||
pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
|
||||
// Search via StarBasic is always global
|
||||
SetFlag( SBX_GBLSEARCH );
|
||||
pVBAGlobals = NULL;
|
||||
bQuit = FALSE;
|
||||
|
||||
if( bDocBasic )
|
||||
GaDocBasics.push_back( this );
|
||||
}
|
||||
|
||||
// #51727 Override SetModified so that the modified state
|
||||
@ -877,6 +808,29 @@ StarBASIC::~StarBASIC()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if( bDocBasic )
|
||||
{
|
||||
SbxError eOld = SbxBase::GetError();
|
||||
|
||||
DocBasicVector::iterator it;
|
||||
for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
|
||||
{
|
||||
if( *it == this )
|
||||
{
|
||||
GaDocBasics.erase( it );
|
||||
break;
|
||||
}
|
||||
}
|
||||
for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
|
||||
{
|
||||
StarBASIC* pBasic = *it;
|
||||
pBasic->implClearDependingVarsOnDelete( this );
|
||||
}
|
||||
|
||||
SbxBase::ResetError();
|
||||
if( eOld != SbxERR_OK )
|
||||
SbxBase::SetError( eOld );
|
||||
}
|
||||
|
||||
// #100326 Set Parent NULL in registered listeners
|
||||
if( xUnoListeners.Is() )
|
||||
@ -889,6 +843,9 @@ StarBASIC::~StarBASIC()
|
||||
}
|
||||
xUnoListeners = NULL;
|
||||
}
|
||||
|
||||
clearUnoMethodsForBasic( this );
|
||||
disposeComVariablesForBasic( this );
|
||||
}
|
||||
|
||||
// Override new() operator, so that everyone can create a new instance
|
||||
@ -907,6 +864,27 @@ void StarBASIC::operator delete( void* p )
|
||||
::operator delete( p );
|
||||
}
|
||||
|
||||
void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic )
|
||||
{
|
||||
if( this != pDeletedBasic )
|
||||
{
|
||||
for( USHORT i = 0; i < pModules->Count(); i++ )
|
||||
{
|
||||
SbModule* p = (SbModule*)pModules->Get( i );
|
||||
p->ClearVarsDependingOnDeletedBasic( pDeletedBasic );
|
||||
}
|
||||
}
|
||||
|
||||
for( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ )
|
||||
{
|
||||
SbxVariable* pVar = pObjs->Get( nObj );
|
||||
StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
|
||||
if( pBasic && pBasic != pDeletedBasic )
|
||||
pBasic->implClearDependingVarsOnDelete( pDeletedBasic );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Creation/Managment of modules
|
||||
@ -1036,15 +1014,15 @@ struct ClassModuleRunInitItem
|
||||
{}
|
||||
};
|
||||
|
||||
typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
|
||||
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap;
|
||||
// Derive from has_map type instead of typedef
|
||||
// to allow forward declaration in sbmod.hxx
|
||||
class ModuleInitDependencyMap : public
|
||||
std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
|
||||
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
|
||||
{};
|
||||
|
||||
static ModuleInitDependencyMap* GpMIDMap = NULL;
|
||||
|
||||
void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
|
||||
void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem )
|
||||
{
|
||||
ModuleInitDependencyMap& rMIDMap = *GpMIDMap;
|
||||
|
||||
rItem.m_bProcessing = true;
|
||||
|
||||
//bool bAnyDependencies = true;
|
||||
@ -1059,8 +1037,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
|
||||
String& rStr = *it;
|
||||
|
||||
// Is required type a class module?
|
||||
ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr );
|
||||
if( itFind != rMIDMap.end() )
|
||||
ModuleInitDependencyMap::iterator itFind = rMap.find( rStr );
|
||||
if( itFind != rMap.end() )
|
||||
{
|
||||
ClassModuleRunInitItem& rParentItem = itFind->second;
|
||||
if( rParentItem.m_bProcessing )
|
||||
@ -1071,7 +1049,7 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
|
||||
}
|
||||
|
||||
if( !rParentItem.m_bRunInitDone )
|
||||
implProcessModuleRunInit( rParentItem );
|
||||
implProcessModuleRunInit( rMap, rParentItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1085,6 +1063,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
|
||||
// Run Init-Code of all modules (including inserted libraries)
|
||||
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
|
||||
{
|
||||
::vos::OGuard guard( Application::GetSolarMutex() );
|
||||
|
||||
// Init own modules
|
||||
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
|
||||
{
|
||||
@ -1099,7 +1079,6 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
|
||||
// Consider required types to init in right order. Class modules
|
||||
// that are required by other modules have to be initialized first.
|
||||
ModuleInitDependencyMap aMIDMap;
|
||||
GpMIDMap = &aMIDMap;
|
||||
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
|
||||
{
|
||||
SbModule* pModule = (SbModule*)pModules->Get( nMod );
|
||||
@ -1112,9 +1091,8 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
|
||||
for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it )
|
||||
{
|
||||
ClassModuleRunInitItem& rItem = it->second;
|
||||
SbModule::implProcessModuleRunInit( rItem );
|
||||
SbModule::implProcessModuleRunInit( aMIDMap, rItem );
|
||||
}
|
||||
GpMIDMap = NULL;
|
||||
|
||||
// Call RunInit on standard modules
|
||||
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
|
||||
@ -1143,7 +1121,7 @@ void StarBASIC::DeInitAllModules( void )
|
||||
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
|
||||
{
|
||||
SbModule* pModule = (SbModule*)pModules->Get( nMod );
|
||||
if( pModule->pImage )
|
||||
if( pModule->pImage && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
|
||||
pModule->pImage->bInit = false;
|
||||
}
|
||||
|
||||
@ -1849,6 +1827,54 @@ bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::u
|
||||
return bRes;
|
||||
}
|
||||
|
||||
Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
|
||||
{
|
||||
OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" );
|
||||
if ( !pBasic )
|
||||
return NULL;
|
||||
|
||||
// look for the ThisComponent variable, first in the parent (which
|
||||
// might be the document's Basic), then in the parent's parent (which might be
|
||||
// the application Basic)
|
||||
const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) );
|
||||
SbxVariable* pThisComponent = NULL;
|
||||
|
||||
SbxObject* pLookup = pBasic->GetParent();
|
||||
while ( pLookup && !pThisComponent )
|
||||
{
|
||||
pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT );
|
||||
pLookup = pLookup->GetParent();
|
||||
}
|
||||
if ( !pThisComponent )
|
||||
{
|
||||
OSL_TRACE("Failed to get ThisComponent");
|
||||
// the application Basic, at the latest, should have this variable
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Any aThisComponentAny( sbxToUnoValue( pThisComponent ) );
|
||||
Reference< frame::XModel > xModel( aThisComponentAny, UNO_QUERY );
|
||||
if ( !xModel.is() )
|
||||
{
|
||||
// it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller.
|
||||
Reference< frame::XController > xController( aThisComponentAny, UNO_QUERY );
|
||||
if ( xController.is() )
|
||||
xModel = xController->getModel();
|
||||
}
|
||||
|
||||
if ( !xModel.is() )
|
||||
return NULL;
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
OSL_TRACE("Have model ThisComponent points to url %s",
|
||||
::rtl::OUStringToOString( xModel->getURL(),
|
||||
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
|
||||
#endif
|
||||
|
||||
return xModel;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// #118116 Implementation Collection object
|
||||
|
||||
|
@ -36,15 +36,18 @@
|
||||
#include <svl/hint.hxx>
|
||||
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
#include <cppuhelper/typeprovider.hxx>
|
||||
#include <cppuhelper/extract.hxx>
|
||||
#include <cppuhelper/interfacecontainer.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <rtl/strbuf.hxx>
|
||||
|
||||
#include <com/sun/star/script/ArrayWrapper.hpp>
|
||||
#include <com/sun/star/script/NativeObjectWrapper.hpp>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/uno/DeploymentException.hpp>
|
||||
@ -61,6 +64,7 @@
|
||||
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
|
||||
#include <com/sun/star/script/XTypeConverter.hpp>
|
||||
#include <com/sun/star/script/XDefaultProperty.hpp>
|
||||
#include <com/sun/star/script/XDirectInvocation.hpp>
|
||||
#include <com/sun/star/container/XNameAccess.hpp>
|
||||
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
|
||||
#include <com/sun/star/reflection/XIdlArray.hpp>
|
||||
@ -512,6 +516,44 @@ static void implHandleAnyException( const Any& _rCaughtException )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NativeObjectWrapper handling
|
||||
struct ObjectItem
|
||||
{
|
||||
SbxObjectRef m_xNativeObj;
|
||||
|
||||
ObjectItem( void )
|
||||
{}
|
||||
ObjectItem( SbxObject* pNativeObj )
|
||||
: m_xNativeObj( pNativeObj )
|
||||
{}
|
||||
};
|
||||
static std::vector< ObjectItem > GaNativeObjectWrapperVector;
|
||||
|
||||
void clearNativeObjectWrapperVector( void )
|
||||
{
|
||||
GaNativeObjectWrapperVector.clear();
|
||||
}
|
||||
|
||||
sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj )
|
||||
{
|
||||
sal_uInt32 nIndex = GaNativeObjectWrapperVector.size();
|
||||
GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) );
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
|
||||
{
|
||||
SbxObjectRef xRetObj;
|
||||
if( nIndex < GaNativeObjectWrapperVector.size() )
|
||||
{
|
||||
ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ];
|
||||
xRetObj = rItem.m_xNativeObj;
|
||||
}
|
||||
return xRetObj;
|
||||
}
|
||||
|
||||
|
||||
// Von Uno nach Sbx wandeln
|
||||
SbxDataType unoToSbxType( TypeClass eType )
|
||||
{
|
||||
@ -698,6 +740,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
|
||||
if( eTypeClass == TypeClass_STRUCT )
|
||||
{
|
||||
ArrayWrapper aWrap;
|
||||
NativeObjectWrapper aNativeObjectWrapper;
|
||||
if ( (aValue >>= aWrap) )
|
||||
{
|
||||
SbxDimArray* pArray = NULL;
|
||||
@ -717,6 +760,18 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
|
||||
pVar->PutEmpty();
|
||||
break;
|
||||
}
|
||||
else if ( (aValue >>= aNativeObjectWrapper) )
|
||||
{
|
||||
sal_uInt32 nIndex = 0;
|
||||
if( (aNativeObjectWrapper.ObjectId >>= nIndex) )
|
||||
{
|
||||
SbxObject* pObj = lcl_getNativeObject( nIndex );
|
||||
pVar->PutObject( pObj );
|
||||
}
|
||||
else
|
||||
pVar->PutEmpty();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
SbiInstance* pInst = pINST;
|
||||
@ -1093,6 +1148,20 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
|
||||
if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
|
||||
return aRetAny;
|
||||
}
|
||||
if( !xObj->ISA(SbUnoObject) )
|
||||
{
|
||||
// Create NativeObjectWrapper to identify object in case of callbacks
|
||||
SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject());
|
||||
if( pObj != NULL )
|
||||
{
|
||||
NativeObjectWrapper aNativeObjectWrapper;
|
||||
sal_uInt32 nIndex = lcl_registerNativeObjectWrapper( pObj );
|
||||
aNativeObjectWrapper.ObjectId <<= nIndex;
|
||||
Any aRetAny;
|
||||
aRetAny <<= aNativeObjectWrapper;
|
||||
return aRetAny;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2223,26 +2292,36 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
|
||||
}
|
||||
else if( bInvocation && mxInvocation.is() )
|
||||
{
|
||||
Sequence< INT16 > OutParamIndex;
|
||||
Sequence< Any > OutParam;
|
||||
Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
|
||||
Reference< XDirectInvocation > xDirectInvoke;
|
||||
if ( pMeth->needsDirectInvocation() )
|
||||
xDirectInvoke.set( mxInvocation, UNO_QUERY );
|
||||
|
||||
Any aRetAny;
|
||||
if ( xDirectInvoke.is() )
|
||||
aRetAny = xDirectInvoke->directInvoke( pMeth->GetName(), args );
|
||||
else
|
||||
{
|
||||
Sequence< INT16 > OutParamIndex;
|
||||
Sequence< Any > OutParam;
|
||||
aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
|
||||
|
||||
const INT16* pIndices = OutParamIndex.getConstArray();
|
||||
UINT32 nLen = OutParamIndex.getLength();
|
||||
if( nLen )
|
||||
{
|
||||
const Any* pNewValues = OutParam.getConstArray();
|
||||
for( UINT32 j = 0 ; j < nLen ; j++ )
|
||||
{
|
||||
INT16 iTarget = pIndices[ j ];
|
||||
if( iTarget >= (INT16)nParamCount )
|
||||
break;
|
||||
unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wert von Uno nach Sbx uebernehmen
|
||||
unoToSbxValue( pVar, aRetAny );
|
||||
|
||||
const INT16* pIndices = OutParamIndex.getConstArray();
|
||||
UINT32 nLen = OutParamIndex.getLength();
|
||||
if( nLen )
|
||||
{
|
||||
const Any* pNewValues = OutParam.getConstArray();
|
||||
for( UINT32 j = 0 ; j < nLen ; j++ )
|
||||
{
|
||||
INT16 iTarget = pIndices[ j ];
|
||||
if( iTarget >= (INT16)nParamCount )
|
||||
break;
|
||||
unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #55460, Parameter hier weghauen, da das in unoToSbxValue()
|
||||
@ -2271,7 +2350,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
|
||||
SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
|
||||
: SbxObject( aName_ )
|
||||
, bNeedIntrospection( TRUE )
|
||||
, bIgnoreNativeCOMObjectMembers( FALSE )
|
||||
, bNativeCOMObject( FALSE )
|
||||
{
|
||||
static Reference< XIntrospection > xIntrospection;
|
||||
|
||||
@ -2322,7 +2401,7 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
|
||||
// hiding of equally named COM symbols, e.g. XInvocation::getValue
|
||||
Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY );
|
||||
if( xAutomationObject.is() )
|
||||
bIgnoreNativeCOMObjectMembers = TRUE;
|
||||
bNativeCOMObject = TRUE;
|
||||
}
|
||||
|
||||
maTmpUnoObj = aUnoObj_;
|
||||
@ -2446,6 +2525,47 @@ void SbUnoObject::doIntrospection( void )
|
||||
// #67781 Start einer Liste aller SbUnoMethod-Instanzen
|
||||
static SbUnoMethod* pFirst = NULL;
|
||||
|
||||
void clearUnoMethodsForBasic( StarBASIC* pBasic )
|
||||
{
|
||||
SbUnoMethod* pMeth = pFirst;
|
||||
while( pMeth )
|
||||
{
|
||||
SbxObject* pObject = dynamic_cast< SbxObject* >( pMeth->GetParent() );
|
||||
if ( pObject )
|
||||
{
|
||||
StarBASIC* pModBasic = dynamic_cast< StarBASIC* >( pObject->GetParent() );
|
||||
if ( pModBasic == pBasic )
|
||||
{
|
||||
// for now the solution is to remove the method from the list and to clear it,
|
||||
// but in case the element should be correctly transfered to another StarBASIC,
|
||||
// we should either set module parent to NULL without clearing it, or even
|
||||
// set the new StarBASIC as the parent of the module
|
||||
// pObject->SetParent( NULL );
|
||||
|
||||
if( pMeth == pFirst )
|
||||
pFirst = pMeth->pNext;
|
||||
else if( pMeth->pPrev )
|
||||
pMeth->pPrev->pNext = pMeth->pNext;
|
||||
if( pMeth->pNext )
|
||||
pMeth->pNext->pPrev = pMeth->pPrev;
|
||||
|
||||
pMeth->pPrev = NULL;
|
||||
pMeth->pNext = NULL;
|
||||
|
||||
pMeth->SbxValue::Clear();
|
||||
pObject->SbxValue::Clear();
|
||||
|
||||
// start from the beginning after object clearing, the cycle will end since the method is removed each time
|
||||
pMeth = pFirst;
|
||||
}
|
||||
else
|
||||
pMeth = pMeth->pNext;
|
||||
}
|
||||
else
|
||||
pMeth = pMeth->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
void clearUnoMethods( void )
|
||||
{
|
||||
SbUnoMethod* pMeth = pFirst;
|
||||
@ -2462,10 +2582,12 @@ SbUnoMethod::SbUnoMethod
|
||||
const String& aName_,
|
||||
SbxDataType eSbxType,
|
||||
Reference< XIdlMethod > xUnoMethod_,
|
||||
bool bInvocation
|
||||
bool bInvocation,
|
||||
bool bDirect
|
||||
)
|
||||
: SbxMethod( aName_, eSbxType )
|
||||
, mbInvocation( bInvocation )
|
||||
, mbDirectInvocation( bDirect )
|
||||
{
|
||||
m_xUnoMethod = xUnoMethod_;
|
||||
pParamInfoSeq = NULL;
|
||||
@ -2566,7 +2688,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
|
||||
if( !pRes )
|
||||
{
|
||||
::rtl::OUString aUName( rName );
|
||||
if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers )
|
||||
if( mxUnoAccess.is() && !bNativeCOMObject )
|
||||
{
|
||||
if( mxExactName.is() )
|
||||
{
|
||||
@ -2667,6 +2789,17 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
|
||||
QuickInsert( (SbxVariable*)xMethRef );
|
||||
pRes = xMethRef;
|
||||
}
|
||||
else
|
||||
{
|
||||
Reference< XDirectInvocation > xDirectInvoke( mxInvocation, UNO_QUERY );
|
||||
if ( xDirectInvoke.is() && xDirectInvoke->hasMember( aUName ) )
|
||||
{
|
||||
SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod, true, true );
|
||||
QuickInsert( (SbxVariable*)xMethRef );
|
||||
pRes = xMethRef;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch( RuntimeException& e )
|
||||
{
|
||||
@ -2726,11 +2859,11 @@ void SbUnoObject::implCreateAll( void )
|
||||
|
||||
// Instrospection besorgen
|
||||
Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
|
||||
if( !xAccess.is() || bIgnoreNativeCOMObjectMembers )
|
||||
if( !xAccess.is() || bNativeCOMObject )
|
||||
{
|
||||
if( mxInvocation.is() )
|
||||
xAccess = mxInvocation->getIntrospection();
|
||||
else if( bIgnoreNativeCOMObjectMembers )
|
||||
else if( bNativeCOMObject )
|
||||
return;
|
||||
}
|
||||
if( !xAccess.is() )
|
||||
@ -4170,14 +4303,26 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
|
||||
|
||||
//==========================================================================
|
||||
|
||||
typedef WeakImplHelper1< XInvocation > ModuleInvocationProxyHelper;
|
||||
namespace {
|
||||
class OMutexBasis
|
||||
{
|
||||
protected:
|
||||
// this mutex is necessary for OInterfaceContainerHelper
|
||||
::osl::Mutex m_aMutex;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
class ModuleInvocationProxy : public ModuleInvocationProxyHelper
|
||||
typedef WeakImplHelper2< XInvocation, XComponent > ModuleInvocationProxyHelper;
|
||||
|
||||
class ModuleInvocationProxy : public OMutexBasis,
|
||||
public ModuleInvocationProxyHelper
|
||||
{
|
||||
::rtl::OUString m_aPrefix;
|
||||
SbxObjectRef m_xScopeObj;
|
||||
bool m_bProxyIsClassModuleObject;
|
||||
|
||||
::cppu::OInterfaceContainerHelper m_aListeners;
|
||||
|
||||
public:
|
||||
ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
|
||||
~ModuleInvocationProxy()
|
||||
@ -4197,11 +4342,17 @@ public:
|
||||
Sequence< sal_Int16 >& rOutParamIndex,
|
||||
Sequence< Any >& rOutParam )
|
||||
throw( CannotConvertException, InvocationTargetException );
|
||||
|
||||
// XComponent
|
||||
virtual void SAL_CALL dispose() throw(RuntimeException);
|
||||
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
|
||||
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
|
||||
};
|
||||
|
||||
ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
|
||||
: m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) )
|
||||
, m_xScopeObj( xScopeObj )
|
||||
, m_aListeners( m_aMutex )
|
||||
{
|
||||
m_bProxyIsClassModuleObject = xScopeObj.Is() ? xScopeObj->ISA(SbClassModuleObject) : false;
|
||||
}
|
||||
@ -4298,13 +4449,27 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
|
||||
vos::OGuard guard( Application::GetSolarMutex() );
|
||||
|
||||
Any aRet;
|
||||
if( !m_xScopeObj.Is() )
|
||||
SbxObjectRef xScopeObj = m_xScopeObj;
|
||||
if( !xScopeObj.Is() )
|
||||
return aRet;
|
||||
|
||||
::rtl::OUString aFunctionName = m_aPrefix;
|
||||
aFunctionName += rFunction;
|
||||
|
||||
SbxVariable* p = m_xScopeObj->Find( aFunctionName, SbxCLASS_METHOD );
|
||||
sal_Bool bSetRescheduleBack = sal_False;
|
||||
sal_Bool bOldReschedule = sal_True;
|
||||
SbiInstance* pInst = pINST;
|
||||
if( pInst && pInst->IsCompatibility() )
|
||||
{
|
||||
bOldReschedule = pInst->IsReschedule();
|
||||
if ( bOldReschedule )
|
||||
{
|
||||
pInst->EnableReschedule( sal_False );
|
||||
bSetRescheduleBack = sal_True;
|
||||
}
|
||||
}
|
||||
|
||||
SbxVariable* p = xScopeObj->Find( aFunctionName, SbxCLASS_METHOD );
|
||||
SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL;
|
||||
if( pMeth == NULL )
|
||||
{
|
||||
@ -4336,11 +4501,38 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
|
||||
aRet = sbxToUnoValue( xValue );
|
||||
pMeth->SetParameters( NULL );
|
||||
|
||||
if( bSetRescheduleBack )
|
||||
pInst->EnableReschedule( bOldReschedule );
|
||||
|
||||
// TODO: OutParameter?
|
||||
|
||||
return aRet;
|
||||
}
|
||||
|
||||
void SAL_CALL ModuleInvocationProxy::dispose()
|
||||
throw(RuntimeException)
|
||||
{
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
EventObject aEvent( (XComponent*)this );
|
||||
m_aListeners.disposeAndClear( aEvent );
|
||||
|
||||
m_xScopeObj = NULL;
|
||||
}
|
||||
|
||||
void SAL_CALL ModuleInvocationProxy::addEventListener( const Reference< XEventListener >& xListener )
|
||||
throw (RuntimeException)
|
||||
{
|
||||
m_aListeners.addInterface( xListener );
|
||||
}
|
||||
|
||||
void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEventListener >& xListener )
|
||||
throw (RuntimeException)
|
||||
{
|
||||
m_aListeners.removeInterface( xListener );
|
||||
}
|
||||
|
||||
|
||||
Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
|
||||
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
|
||||
{
|
||||
@ -4370,6 +4562,97 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
|
||||
return xRet;
|
||||
}
|
||||
|
||||
typedef std::vector< WeakReference< XComponent > > ComponentRefVector;
|
||||
|
||||
struct StarBasicDisposeItem
|
||||
{
|
||||
StarBASIC* m_pBasic;
|
||||
SbxArrayRef m_pRegisteredVariables;
|
||||
ComponentRefVector m_vComImplementsObjects;
|
||||
|
||||
StarBasicDisposeItem( StarBASIC* pBasic )
|
||||
: m_pBasic( pBasic )
|
||||
{
|
||||
m_pRegisteredVariables = new SbxArray();
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector< StarBasicDisposeItem* > DisposeItemVector;
|
||||
|
||||
static DisposeItemVector GaDisposeItemVector;
|
||||
|
||||
DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic )
|
||||
{
|
||||
DisposeItemVector::iterator it;
|
||||
for( it = GaDisposeItemVector.begin() ; it != GaDisposeItemVector.end() ; ++it )
|
||||
{
|
||||
StarBasicDisposeItem* pItem = *it;
|
||||
if( pItem->m_pBasic == pBasic )
|
||||
return it;
|
||||
}
|
||||
return GaDisposeItemVector.end();
|
||||
}
|
||||
|
||||
StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic )
|
||||
{
|
||||
DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic );
|
||||
StarBasicDisposeItem* pItem = (it != GaDisposeItemVector.end()) ? *it : NULL;
|
||||
if( pItem == NULL )
|
||||
{
|
||||
pItem = new StarBasicDisposeItem( pBasic );
|
||||
GaDisposeItemVector.push_back( pItem );
|
||||
}
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void registerComponentToBeDisposedForBasic
|
||||
( Reference< XComponent > xComponent, StarBASIC* pBasic )
|
||||
{
|
||||
StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
|
||||
pItem->m_vComImplementsObjects.push_back( xComponent );
|
||||
}
|
||||
|
||||
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic )
|
||||
{
|
||||
StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
|
||||
SbxArray* pArray = pItem->m_pRegisteredVariables;
|
||||
pArray->Put( pVar, pArray->Count() );
|
||||
}
|
||||
|
||||
void disposeComVariablesForBasic( StarBASIC* pBasic )
|
||||
{
|
||||
DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic );
|
||||
if( it != GaDisposeItemVector.end() )
|
||||
{
|
||||
StarBasicDisposeItem* pItem = *it;
|
||||
|
||||
SbxArray* pArray = pItem->m_pRegisteredVariables;
|
||||
USHORT nCount = pArray->Count();
|
||||
for( USHORT i = 0 ; i < nCount ; ++i )
|
||||
{
|
||||
SbxVariable* pVar = pArray->Get( i );
|
||||
pVar->ClearComListener();
|
||||
}
|
||||
|
||||
ComponentRefVector& rv = pItem->m_vComImplementsObjects;
|
||||
ComponentRefVector::iterator itCRV;
|
||||
for( itCRV = rv.begin() ; itCRV != rv.end() ; ++itCRV )
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< XComponent > xComponent( (*itCRV).get(), UNO_QUERY_THROW );
|
||||
xComponent->dispose();
|
||||
}
|
||||
catch( Exception& )
|
||||
{}
|
||||
}
|
||||
|
||||
delete pItem;
|
||||
GaDisposeItemVector.erase( it );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle module implements mechanism for OLE types
|
||||
bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject )
|
||||
{
|
||||
@ -4423,6 +4706,23 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
|
||||
|
||||
if( bSuccess )
|
||||
{
|
||||
Reference< XComponent > xComponent( xProxy, UNO_QUERY );
|
||||
if( xComponent.is() )
|
||||
{
|
||||
StarBASIC* pParentBasic = NULL;
|
||||
SbxObject* pCurObject = this;
|
||||
do
|
||||
{
|
||||
SbxObject* pObjParent = pCurObject->GetParent();
|
||||
pParentBasic = PTR_CAST( StarBASIC, pObjParent );
|
||||
pCurObject = pObjParent;
|
||||
}
|
||||
while( pParentBasic == NULL && pCurObject != NULL );
|
||||
|
||||
OSL_ASSERT( pParentBasic != NULL );
|
||||
registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
|
||||
}
|
||||
|
||||
o_rRetAny <<= xRet;
|
||||
break;
|
||||
}
|
||||
@ -4432,3 +4732,30 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
|
||||
// Due to an incorrect behavior IE returns an object instead of a string
|
||||
// in some scenarios. Calling toString at the object may correct this.
|
||||
// Helper function used in sbxvalue.cxx
|
||||
bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal )
|
||||
{
|
||||
bool bSuccess = false;
|
||||
|
||||
SbUnoObject* pUnoObj = NULL;
|
||||
if( pObj != NULL && (pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj)) != NULL )
|
||||
{
|
||||
// Only for native COM objects
|
||||
if( pUnoObj->isNativeCOMObject() )
|
||||
{
|
||||
SbxVariableRef pMeth = pObj->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "toString" ) ), SbxCLASS_METHOD );
|
||||
if ( pMeth.Is() )
|
||||
{
|
||||
SbxValues aRes;
|
||||
pMeth->Get( aRes );
|
||||
pVal->Put( aRes );
|
||||
bSuccess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
|
278
basic/source/classes/sbxmod.cxx
Normal file → Executable file
278
basic/source/classes/sbxmod.cxx
Normal file → Executable file
@ -444,11 +444,7 @@ TYPEINIT1(SbJScriptMethod,SbMethod)
|
||||
TYPEINIT1(SbObjModule,SbModule)
|
||||
TYPEINIT1(SbUserFormModule,SbObjModule)
|
||||
|
||||
SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
|
||||
SV_IMPL_VARARR(SbiBreakpoints,USHORT)
|
||||
|
||||
|
||||
SV_IMPL_VARARR(HighlightPortions, HighlightPortion)
|
||||
typedef std::vector<HighlightPortion> HighlightPortions;
|
||||
|
||||
bool getDefaultVBAMode( StarBASIC* pb )
|
||||
{
|
||||
@ -500,33 +496,26 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
|
||||
return 0L;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool UnlockControllerHack( StarBASIC* pBasic )
|
||||
bool VBAUnlockControllers( StarBASIC* pBasic )
|
||||
{
|
||||
bool bRes = false;
|
||||
if ( pBasic && pBasic->IsDocBasic() )
|
||||
{
|
||||
uno::Any aUnoVar;
|
||||
::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) );
|
||||
SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) );
|
||||
if ( pGlobs )
|
||||
aUnoVar = pGlobs->getUnoAny();
|
||||
uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY);
|
||||
if ( xModel.is() )
|
||||
SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) );
|
||||
if ( pGlobs ) try
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
|
||||
if ( xModel->hasControllersLocked() )
|
||||
xModel->unlockControllers();
|
||||
bRes = true;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
bRes = true;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
|
||||
@ -1180,6 +1169,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
|
||||
// beim Programm-Ende freigeben, damit nichts gehalten wird.
|
||||
ClearUnoObjectsInRTL_Impl( xBasic );
|
||||
|
||||
clearNativeObjectWrapperVector();
|
||||
|
||||
DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0");
|
||||
delete pINST, pINST = NULL, bDelInst = FALSE;
|
||||
|
||||
@ -1188,6 +1179,14 @@ USHORT SbModule::Run( SbMethod* pMeth )
|
||||
SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth );
|
||||
|
||||
GlobalRunDeInit();
|
||||
|
||||
// VBA always ensures screenupdating is enabled after completing
|
||||
if ( mbVBACompat )
|
||||
VBAUnlockControllers( PTR_CAST( StarBASIC, GetParent() ) );
|
||||
|
||||
#ifdef DBG_TRACE_BASIC
|
||||
dbg_DeInitTrace();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1199,12 +1198,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
|
||||
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
|
||||
}
|
||||
|
||||
// VBA always ensure screenupdating is enabled after completing
|
||||
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
|
||||
#if 0
|
||||
if ( pBasic && pBasic->IsDocBasic() && !pINST )
|
||||
UnlockControllerHack( pBasic );
|
||||
#endif
|
||||
if( bDelInst )
|
||||
{
|
||||
// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
|
||||
@ -1336,6 +1330,61 @@ void SbModule::ClearPrivateVars()
|
||||
}
|
||||
}
|
||||
|
||||
void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic )
|
||||
{
|
||||
if( pVar->SbxValue::GetType() != SbxOBJECT || pVar->ISA( SbProcedureProperty ) )
|
||||
return;
|
||||
|
||||
SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject());
|
||||
if( pObj != NULL )
|
||||
{
|
||||
SbxObject* p = pObj;
|
||||
|
||||
SbModule* pMod = PTR_CAST( SbModule, p );
|
||||
if( pMod != NULL )
|
||||
pMod->ClearVarsDependingOnDeletedBasic( pDeletedBasic );
|
||||
|
||||
while( (p = p->GetParent()) != NULL )
|
||||
{
|
||||
StarBASIC* pBasic = PTR_CAST( StarBASIC, p );
|
||||
if( pBasic != NULL && pBasic == pDeletedBasic )
|
||||
{
|
||||
pVar->SbxValue::Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
|
||||
{
|
||||
(void)pDeletedBasic;
|
||||
|
||||
for( USHORT i = 0 ; i < pProps->Count() ; i++ )
|
||||
{
|
||||
SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) );
|
||||
if( p )
|
||||
{
|
||||
if( p->GetType() & SbxARRAY )
|
||||
{
|
||||
SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject());
|
||||
if( pArray )
|
||||
{
|
||||
for( USHORT j = 0 ; j < pArray->Count() ; j++ )
|
||||
{
|
||||
SbxVariable* pVar = PTR_CAST(SbxVariable,pArray->Get( j ));
|
||||
implClearIfVarDependsOnDeletedBasic( pVar, pDeletedBasic );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
implClearIfVarDependsOnDeletedBasic( p, pDeletedBasic );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Zunaechst in dieses Modul, um 358-faehig zu bleiben
|
||||
// (Branch in sb.cxx vermeiden)
|
||||
void StarBASIC::ClearAllModuleVars( void )
|
||||
@ -1345,7 +1394,7 @@ void StarBASIC::ClearAllModuleVars( void )
|
||||
{
|
||||
SbModule* pModule = (SbModule*)pModules->Get( nMod );
|
||||
// Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde
|
||||
if( pModule->pImage && pModule->pImage->bInit )
|
||||
if( pModule->pImage && pModule->pImage->bInit && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
|
||||
pModule->ClearPrivateVars();
|
||||
}
|
||||
|
||||
@ -1478,15 +1527,15 @@ BOOL SbModule::IsBreakable( USHORT nLine ) const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
USHORT SbModule::GetBPCount() const
|
||||
size_t SbModule::GetBPCount() const
|
||||
{
|
||||
return pBreaks ? pBreaks->Count() : 0;
|
||||
return pBreaks ? pBreaks->size() : 0;
|
||||
}
|
||||
|
||||
USHORT SbModule::GetBP( USHORT n ) const
|
||||
USHORT SbModule::GetBP( size_t n ) const
|
||||
{
|
||||
if( pBreaks && n < pBreaks->Count() )
|
||||
return pBreaks->GetObject( n );
|
||||
if( pBreaks && n < pBreaks->size() )
|
||||
return pBreaks->operator[]( n );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@ -1495,11 +1544,9 @@ BOOL SbModule::IsBP( USHORT nLine ) const
|
||||
{
|
||||
if( pBreaks )
|
||||
{
|
||||
const USHORT* p = pBreaks->GetData();
|
||||
USHORT n = pBreaks->Count();
|
||||
for( USHORT i = 0; i < n; i++, p++ )
|
||||
for( size_t i = 0; i < pBreaks->size(); i++ )
|
||||
{
|
||||
USHORT b = *p;
|
||||
USHORT b = pBreaks->operator[]( i );
|
||||
if( b == nLine )
|
||||
return TRUE;
|
||||
if( b < nLine )
|
||||
@ -1515,18 +1562,16 @@ BOOL SbModule::SetBP( USHORT nLine )
|
||||
return FALSE;
|
||||
if( !pBreaks )
|
||||
pBreaks = new SbiBreakpoints;
|
||||
const USHORT* p = pBreaks->GetData();
|
||||
USHORT n = pBreaks->Count();
|
||||
USHORT i;
|
||||
for( i = 0; i < n; i++, p++ )
|
||||
size_t i;
|
||||
for( i = 0; i < pBreaks->size(); i++ )
|
||||
{
|
||||
USHORT b = *p;
|
||||
USHORT b = pBreaks->operator[]( i );
|
||||
if( b == nLine )
|
||||
return TRUE;
|
||||
if( b < nLine )
|
||||
break;
|
||||
}
|
||||
pBreaks->Insert( &nLine, 1, i );
|
||||
pBreaks->insert( pBreaks->begin() + i, nLine );
|
||||
|
||||
// #38568: Zur Laufzeit auch hier SbDEBUG_BREAK setzen
|
||||
if( pINST && pINST->pRun )
|
||||
@ -1540,19 +1585,19 @@ BOOL SbModule::ClearBP( USHORT nLine )
|
||||
BOOL bRes = FALSE;
|
||||
if( pBreaks )
|
||||
{
|
||||
const USHORT* p = pBreaks->GetData();
|
||||
USHORT n = pBreaks->Count();
|
||||
for( USHORT i = 0; i < n; i++, p++ )
|
||||
for( size_t i = 0; i < pBreaks->size(); i++ )
|
||||
{
|
||||
USHORT b = *p;
|
||||
USHORT b = pBreaks->operator[]( i );
|
||||
if( b == nLine )
|
||||
{
|
||||
pBreaks->Remove( i, 1 ); bRes = TRUE; break;
|
||||
pBreaks->erase( pBreaks->begin() + i );
|
||||
bRes = TRUE;
|
||||
break;
|
||||
}
|
||||
if( b < nLine )
|
||||
break;
|
||||
}
|
||||
if( !pBreaks->Count() )
|
||||
if( pBreaks->empty() )
|
||||
delete pBreaks, pBreaks = NULL;
|
||||
}
|
||||
return bRes;
|
||||
@ -1560,7 +1605,8 @@ BOOL SbModule::ClearBP( USHORT nLine )
|
||||
|
||||
void SbModule::ClearAllBP()
|
||||
{
|
||||
delete pBreaks; pBreaks = NULL;
|
||||
delete pBreaks;
|
||||
pBreaks = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1588,7 +1634,7 @@ BOOL SbModule::LoadData( SvStream& rStrm, USHORT nVer )
|
||||
Clear();
|
||||
if( !SbxObject::LoadData( rStrm, 1 ) )
|
||||
return FALSE;
|
||||
// Sicherheitshalber...
|
||||
// Precaution...
|
||||
SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
|
||||
BYTE bImage;
|
||||
rStrm >> bImage;
|
||||
@ -1746,6 +1792,98 @@ BOOL SbModule::LoadCompleted()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint )
|
||||
{
|
||||
bool bDone = false;
|
||||
|
||||
const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
|
||||
if( pHint )
|
||||
{
|
||||
SbxVariable* pVar = pHint->GetVar();
|
||||
SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
|
||||
if( pProcProperty )
|
||||
{
|
||||
bDone = true;
|
||||
|
||||
if( pHint->GetId() == SBX_HINT_DATAWANTED )
|
||||
{
|
||||
String aProcName;
|
||||
aProcName.AppendAscii( "Property Get " );
|
||||
aProcName += pProcProperty->GetName();
|
||||
|
||||
SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
|
||||
if( pMeth )
|
||||
{
|
||||
SbxValues aVals;
|
||||
aVals.eType = SbxVARIANT;
|
||||
|
||||
SbxArray* pArg = pVar->GetParameters();
|
||||
USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
|
||||
if( nVarParCount > 1 )
|
||||
{
|
||||
SbxArrayRef xMethParameters = new SbxArray;
|
||||
xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
|
||||
for( USHORT i = 1 ; i < nVarParCount ; ++i )
|
||||
{
|
||||
SbxVariable* pPar = pArg->Get( i );
|
||||
xMethParameters->Put( pPar, i );
|
||||
}
|
||||
|
||||
pMeth->SetParameters( xMethParameters );
|
||||
pMeth->Get( aVals );
|
||||
pMeth->SetParameters( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
pMeth->Get( aVals );
|
||||
}
|
||||
|
||||
pVar->Put( aVals );
|
||||
}
|
||||
}
|
||||
else if( pHint->GetId() == SBX_HINT_DATACHANGED )
|
||||
{
|
||||
SbxVariable* pMeth = NULL;
|
||||
|
||||
bool bSet = pProcProperty->isSet();
|
||||
if( bSet )
|
||||
{
|
||||
pProcProperty->setSet( false );
|
||||
|
||||
String aProcName;
|
||||
aProcName.AppendAscii( "Property Set " );
|
||||
aProcName += pProcProperty->GetName();
|
||||
pMeth = Find( aProcName, SbxCLASS_METHOD );
|
||||
}
|
||||
if( !pMeth ) // Let
|
||||
{
|
||||
String aProcName;
|
||||
aProcName.AppendAscii( "Property Let " );
|
||||
aProcName += pProcProperty->GetName();
|
||||
pMeth = Find( aProcName, SbxCLASS_METHOD );
|
||||
}
|
||||
|
||||
if( pMeth )
|
||||
{
|
||||
// Setup parameters
|
||||
SbxArrayRef xArray = new SbxArray;
|
||||
xArray->Put( pMeth, 0 ); // Method as parameter 0
|
||||
xArray->Put( pVar, 1 );
|
||||
pMeth->SetParameters( xArray );
|
||||
|
||||
SbxValues aVals;
|
||||
pMeth->Get( aVals );
|
||||
pMeth->SetParameters( NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !bDone )
|
||||
SbModule::Notify( rBC, rHint );
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen)
|
||||
SbJScriptModule::SbJScriptModule( const String& rName )
|
||||
@ -1976,6 +2114,11 @@ SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::Mod
|
||||
else if ( mInfo.ModuleObject.is() )
|
||||
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
|
||||
}
|
||||
|
||||
SbObjModule::~SbObjModule()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
|
||||
{
|
||||
@ -2012,6 +2155,13 @@ SbObjModule::Find( const XubString& rName, SbxClassType t )
|
||||
return pVar;
|
||||
}
|
||||
|
||||
void SbObjModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
|
||||
const SfxHint& rHint, const TypeId& rHintType )
|
||||
{
|
||||
SbModule::handleProcedureProperties( rBC, rHint );
|
||||
}
|
||||
|
||||
|
||||
typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE;
|
||||
|
||||
class FormObjEventListenerImpl : public FormObjEventListener_BASE
|
||||
@ -2199,9 +2349,9 @@ SbUserFormModule::~SbUserFormModule()
|
||||
{
|
||||
}
|
||||
|
||||
void SbUserFormModule::ResetApiObj()
|
||||
void SbUserFormModule::ResetApiObj( bool bTriggerTerminateEvent )
|
||||
{
|
||||
if ( m_xDialog.is() ) // probably someone close the dialog window
|
||||
if ( bTriggerTerminateEvent && m_xDialog.is() ) // probably someone close the dialog window
|
||||
{
|
||||
triggerTerminateEvent();
|
||||
}
|
||||
@ -2386,11 +2536,12 @@ void SbUserFormModule::Unload()
|
||||
}
|
||||
//liuchen
|
||||
|
||||
void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic );
|
||||
|
||||
void SbUserFormModule::InitObject()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
|
||||
SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
|
||||
if ( m_xModel.is() && pGlobs )
|
||||
@ -2417,6 +2568,25 @@ void SbUserFormModule::InitObject()
|
||||
aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
|
||||
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
|
||||
uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
|
||||
|
||||
// the dialog must be disposed at the end!
|
||||
if( xComponent.is() )
|
||||
{
|
||||
StarBASIC* pParentBasic = NULL;
|
||||
SbxObject* pCurObject = this;
|
||||
do
|
||||
{
|
||||
SbxObject* pObjParent = pCurObject->GetParent();
|
||||
pParentBasic = PTR_CAST( StarBASIC, pObjParent );
|
||||
pCurObject = pObjParent;
|
||||
}
|
||||
while( pParentBasic == NULL && pCurObject != NULL );
|
||||
|
||||
OSL_ASSERT( pParentBasic != NULL );
|
||||
registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
|
||||
}
|
||||
|
||||
|
||||
// remove old listener if it exists
|
||||
if ( m_DialogListener.get() )
|
||||
m_DialogListener->removeListener();
|
||||
|
@ -375,6 +375,9 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
|
||||
if( pDef->IsWithEvents() )
|
||||
nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG;
|
||||
|
||||
if( bCompatible && pDef->IsNew() )
|
||||
nOpnd2 |= SBX_TYPE_DIM_AS_NEW_FLAG;
|
||||
|
||||
short nFixedStringLength = pDef->GetFixedStringLength();
|
||||
if( nFixedStringLength >= 0 )
|
||||
nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (UINT32(nFixedStringLength) << 17)); // len = all bits above 0x10000
|
||||
|
@ -578,10 +578,20 @@ SbiExprNode* SbiExpression::Unary()
|
||||
{
|
||||
case MINUS:
|
||||
eTok = NEG;
|
||||
case NOT:
|
||||
pParser->Next();
|
||||
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
|
||||
break;
|
||||
case NOT:
|
||||
if( pParser->IsVBASupportOn() )
|
||||
{
|
||||
pNd = Operand();
|
||||
}
|
||||
else
|
||||
{
|
||||
pParser->Next();
|
||||
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
|
||||
}
|
||||
break;
|
||||
case PLUS:
|
||||
pParser->Next();
|
||||
pNd = Unary();
|
||||
@ -725,9 +735,26 @@ SbiExprNode* SbiExpression::Comp()
|
||||
return pNd;
|
||||
}
|
||||
|
||||
SbiExprNode* SbiExpression::VBA_Not()
|
||||
{
|
||||
SbiExprNode* pNd = NULL;
|
||||
|
||||
SbiToken eTok = pParser->Peek();
|
||||
if( eTok == NOT )
|
||||
{
|
||||
pParser->Next();
|
||||
pNd = new SbiExprNode( pParser, VBA_Not(), eTok, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
pNd = Comp();
|
||||
}
|
||||
return pNd;
|
||||
}
|
||||
|
||||
SbiExprNode* SbiExpression::Like()
|
||||
{
|
||||
SbiExprNode* pNd = Comp();
|
||||
SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp();
|
||||
if( m_eMode != EXPRMODE_EMPTY_PAREN )
|
||||
{
|
||||
short nCount = 0;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "sbcomp.hxx"
|
||||
#include "image.hxx"
|
||||
#include "sbtrace.hxx"
|
||||
#include <basic/sbobjmod.hxx>
|
||||
|
||||
|
||||
//==========================================================================
|
||||
@ -42,11 +43,145 @@
|
||||
|
||||
#include <hash_map>
|
||||
|
||||
// Trace Settings
|
||||
static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt";
|
||||
static const bool GbIncludePCodes = false;
|
||||
static const int GnIndentPerCallLevel = 4;
|
||||
static const int GnIndentForPCode = 2;
|
||||
// Trace ini file (set NULL to ignore)
|
||||
static char GpTraceIniFile[] = "d:\\zBasic.Asm\\BasicTrace.ini";
|
||||
//static char* GpTraceIniFile = NULL;
|
||||
|
||||
|
||||
// Trace Settings, used if no ini file / not found in ini file
|
||||
static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt";
|
||||
static char* GpTraceFileName = GpTraceFileNameDefault;
|
||||
|
||||
// GbTraceOn:
|
||||
// true = tracing is active, false = tracing is disabled, default = true
|
||||
// Set to false initially if you want to activate tracing on demand with
|
||||
// TraceCommand( "TraceOn" ), see below
|
||||
static bool GbTraceOn = true;
|
||||
|
||||
// GbIncludePCodes:
|
||||
// true = PCodes are written to trace, default = false, correspondents
|
||||
// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below
|
||||
static bool GbIncludePCodes = false;
|
||||
|
||||
static int GnIndentPerCallLevel = 4;
|
||||
static int GnIndentForPCode = 2;
|
||||
|
||||
/*
|
||||
With trace enabled the runtime function TraceCommand
|
||||
can be used to influence the trace functionality
|
||||
from within the running Basic macro.
|
||||
|
||||
Format: TraceCommand( command as String [, param as Variant] )
|
||||
|
||||
Supported commands (command is NOT case sensitive):
|
||||
TraceCommand "TraceOn" sets GbTraceOn = true
|
||||
TraceCommand "TraceOff" sets GbTraceOn = false
|
||||
|
||||
TraceCommand "PCodeOn" sets GbIncludePCodes = true
|
||||
TraceCommand "PCodeOff" sets GbIncludePCodes = false
|
||||
|
||||
TraceCommand "Print", aVal writes aVal into the trace file as
|
||||
long as it can be converted to string
|
||||
*/
|
||||
|
||||
static void lcl_skipWhites( char*& rpc )
|
||||
{
|
||||
while( *rpc == ' ' || *rpc == '\t' )
|
||||
++rpc;
|
||||
}
|
||||
|
||||
inline void lcl_findNextLine( char*& rpc, char* pe )
|
||||
{
|
||||
// Find line end
|
||||
while( rpc < pe && *rpc != 13 && *rpc != 10 )
|
||||
++rpc;
|
||||
|
||||
// Read all
|
||||
while( rpc < pe && (*rpc == 13 || *rpc == 10) )
|
||||
++rpc;
|
||||
}
|
||||
|
||||
inline bool lcl_isAlpha( char c )
|
||||
{
|
||||
bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
return bRet;
|
||||
}
|
||||
|
||||
static void lcl_ReadIniFile( const char* pIniFileName )
|
||||
{
|
||||
const int BUF_SIZE = 1000;
|
||||
static sal_Char TraceFileNameBuffer[BUF_SIZE];
|
||||
sal_Char Buffer[BUF_SIZE];
|
||||
sal_Char VarNameBuffer[BUF_SIZE];
|
||||
sal_Char ValBuffer[BUF_SIZE];
|
||||
|
||||
FILE* pFile = fopen( pIniFileName ,"rb" );
|
||||
if( pFile == NULL )
|
||||
return;
|
||||
|
||||
size_t nRead = fread( Buffer, 1, BUF_SIZE, pFile );
|
||||
|
||||
// Scan
|
||||
char* pc = Buffer;
|
||||
char* pe = Buffer + nRead;
|
||||
while( pc < pe )
|
||||
{
|
||||
lcl_skipWhites( pc ); if( pc == pe ) break;
|
||||
|
||||
// Read variable
|
||||
char* pVarStart = pc;
|
||||
while( pc < pe && lcl_isAlpha( *pc ) )
|
||||
++pc;
|
||||
int nVarLen = pc - pVarStart;
|
||||
if( nVarLen == 0 )
|
||||
{
|
||||
lcl_findNextLine( pc, pe );
|
||||
continue;
|
||||
}
|
||||
strncpy( VarNameBuffer, pVarStart, nVarLen );
|
||||
VarNameBuffer[nVarLen] = '\0';
|
||||
|
||||
// Check =
|
||||
lcl_skipWhites( pc ); if( pc == pe ) break;
|
||||
if( *pc != '=' )
|
||||
continue;
|
||||
++pc;
|
||||
lcl_skipWhites( pc ); if( pc == pe ) break;
|
||||
|
||||
// Read value
|
||||
char* pValStart = pc;
|
||||
while( pc < pe && *pc != 13 && *pc != 10 )
|
||||
++pc;
|
||||
int nValLen = pc - pValStart;
|
||||
if( nValLen == 0 )
|
||||
{
|
||||
lcl_findNextLine( pc, pe );
|
||||
continue;
|
||||
}
|
||||
strncpy( ValBuffer, pValStart, nValLen );
|
||||
ValBuffer[nValLen] = '\0';
|
||||
|
||||
// Match variables
|
||||
if( strcmp( VarNameBuffer, "GpTraceFileName") == 0 )
|
||||
{
|
||||
strcpy( TraceFileNameBuffer, ValBuffer );
|
||||
GpTraceFileName = TraceFileNameBuffer;
|
||||
}
|
||||
else
|
||||
if( strcmp( VarNameBuffer, "GbTraceOn") == 0 )
|
||||
GbTraceOn = (strcmp( ValBuffer, "true" ) == 0);
|
||||
else
|
||||
if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 )
|
||||
GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0);
|
||||
else
|
||||
if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 )
|
||||
GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 );
|
||||
else
|
||||
if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 )
|
||||
GnIndentForPCode = strtol( ValBuffer, NULL, 10 );
|
||||
}
|
||||
fclose( pFile );
|
||||
}
|
||||
|
||||
struct TraceTextData
|
||||
{
|
||||
@ -122,7 +257,7 @@ static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
|
||||
return aORetStr;
|
||||
}
|
||||
|
||||
String dumpMethodParameters( SbMethod* pMethod )
|
||||
String lcl_dumpMethodParameters( SbMethod* pMethod )
|
||||
{
|
||||
String aStr;
|
||||
if( pMethod == NULL )
|
||||
@ -149,9 +284,10 @@ String dumpMethodParameters( SbMethod* pMethod )
|
||||
aStr += pParam->aName;
|
||||
}
|
||||
aStr += '=';
|
||||
if( pVar->GetType() & SbxARRAY )
|
||||
SbxDataType eType = pVar->GetType();
|
||||
if( eType & SbxARRAY )
|
||||
aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
|
||||
else
|
||||
else if( eType != SbxOBJECT )
|
||||
aStr += pVar->GetString();
|
||||
if ( nParam < ( pParams->Count() - 1 ) )
|
||||
aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
|
||||
@ -166,16 +302,36 @@ String dumpMethodParameters( SbMethod* pMethod )
|
||||
return aStr;
|
||||
}
|
||||
|
||||
|
||||
// Public functions
|
||||
|
||||
static bool GbSavTraceOn = false;
|
||||
void dbg_InitTrace( void )
|
||||
{
|
||||
if( GpTraceIniFile != NULL )
|
||||
lcl_ReadIniFile( GpTraceIniFile );
|
||||
|
||||
FILE* pFile = fopen( GpTraceFileName, "w" );
|
||||
if( pFile != NULL )
|
||||
fclose( pFile );
|
||||
GbSavTraceOn = GbTraceOn;
|
||||
if( !GbTraceOn )
|
||||
lcl_lineOut( GpTraceFileName, "### Program started with trace off ###" );
|
||||
}
|
||||
|
||||
void dbg_DeInitTrace( void )
|
||||
{
|
||||
GbTraceOn = GbSavTraceOn;
|
||||
}
|
||||
|
||||
static INT32 GnLastCallLvl = 0;
|
||||
|
||||
void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
|
||||
{
|
||||
if( !GbTraceOn )
|
||||
return;
|
||||
GnLastCallLvl = nCallLvl;
|
||||
|
||||
SbModule* pTraceMod = pModule;
|
||||
if( pTraceMod->ISA(SbClassModuleObject) )
|
||||
{
|
||||
@ -206,14 +362,11 @@ void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
|
||||
{
|
||||
const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
|
||||
char Buffer[200];
|
||||
sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr );
|
||||
sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", (int)nPC, pModuleNameStr );
|
||||
lcl_lineOut( GpTraceFileName, Buffer );
|
||||
return;
|
||||
}
|
||||
|
||||
//nCallLvl--;
|
||||
//if( nCallLvl < 0 )
|
||||
// nCallLvl = 0;
|
||||
int nIndent = nCallLvl * GnIndentPerCallLevel;
|
||||
|
||||
const TraceTextData& rTraceTextData = itInner->second;
|
||||
@ -234,6 +387,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
|
||||
{
|
||||
static const char* pSeparator = "' ================================================================================";
|
||||
|
||||
if( !GbTraceOn )
|
||||
return;
|
||||
GnLastCallLvl = nCallLvl;
|
||||
|
||||
SbModule* pTraceMod = pModule;
|
||||
SbClassModuleObject* pClassModuleObj = NULL;
|
||||
if( pTraceMod->ISA(SbClassModuleObject) )
|
||||
@ -281,7 +438,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
|
||||
aStr.AppendAscii( "]" );
|
||||
}
|
||||
if( !bLeave )
|
||||
aStr += dumpMethodParameters( pMethod );
|
||||
aStr += lcl_dumpMethodParameters( pMethod );
|
||||
|
||||
lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
|
||||
if( !bLeave )
|
||||
@ -293,6 +450,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
|
||||
|
||||
void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl )
|
||||
{
|
||||
if( !GbTraceOn )
|
||||
return;
|
||||
GnLastCallLvl = nCallLvl;
|
||||
|
||||
rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
|
||||
|
||||
char Buffer[200];
|
||||
@ -329,6 +490,63 @@ void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
|
||||
(*pInnerMap)[nPC] = aData;
|
||||
}
|
||||
|
||||
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
|
||||
{
|
||||
(void)pBasic;
|
||||
(void)bWrite;
|
||||
|
||||
if ( rPar.Count() < 2 )
|
||||
{
|
||||
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
||||
return;
|
||||
}
|
||||
|
||||
String aCommand = rPar.Get(1)->GetString();
|
||||
|
||||
if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) )
|
||||
GbTraceOn = true;
|
||||
else
|
||||
if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) )
|
||||
GbTraceOn = false;
|
||||
else
|
||||
if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) )
|
||||
GbIncludePCodes = true;
|
||||
else
|
||||
if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) )
|
||||
GbIncludePCodes = false;
|
||||
else
|
||||
if( aCommand.EqualsIgnoreCaseAscii( "Print" ) )
|
||||
{
|
||||
if ( rPar.Count() < 3 )
|
||||
{
|
||||
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
||||
return;
|
||||
}
|
||||
|
||||
SbxError eOld = SbxBase::GetError();
|
||||
if( eOld != SbxERR_OK )
|
||||
SbxBase::ResetError();
|
||||
|
||||
String aValStr = rPar.Get(2)->GetString();
|
||||
SbxError eErr = SbxBase::GetError();
|
||||
if( eErr != SbxERR_OK )
|
||||
{
|
||||
aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) );
|
||||
SbxBase::ResetError();
|
||||
}
|
||||
|
||||
char Buffer[500];
|
||||
const char* pValStr = OUStringToOString( rtl::OUString( aValStr ), RTL_TEXTENCODING_ASCII_US ).getStr();
|
||||
|
||||
sprintf( Buffer, "### TRACE_PRINT: %s ###", pValStr );
|
||||
int nIndent = GnLastCallLvl * GnIndentPerCallLevel;
|
||||
lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
|
||||
|
||||
if( eOld != SbxERR_OK )
|
||||
SbxBase::SetError( eOld );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -431,7 +649,8 @@ BOOL SbModule::Compile()
|
||||
BOOL bRet = IsCompiled();
|
||||
if( bRet )
|
||||
{
|
||||
pBasic->ClearAllModuleVars();
|
||||
if( !this->ISA(SbObjModule) )
|
||||
pBasic->ClearAllModuleVars();
|
||||
RemoveVars(); // remove 'this' Modules variables
|
||||
// clear all method statics
|
||||
for( USHORT i = 0; i < pMethods->Count(); i++ )
|
||||
|
@ -224,6 +224,30 @@ BOOL SbiScanner::NextSym()
|
||||
for ( ; (BasicSimpleCharClass::isAlphaNumeric( *pLine, bCompatible ) || ( *pLine == '_' ) ); pLine++ )
|
||||
nCol++;
|
||||
aSym = aLine.copy( n, nCol - n );
|
||||
|
||||
// Special handling for "go to"
|
||||
if( bCompatible && *pLine && aSym.EqualsIgnoreCaseAscii( "go" ) )
|
||||
{
|
||||
const sal_Unicode* pTestLine = pLine;
|
||||
short nTestCol = nCol;
|
||||
while( *pTestLine && (( *pTestLine == ' ' ) || ( *pTestLine == '\t' )) )
|
||||
{
|
||||
pTestLine++;
|
||||
nTestCol++;
|
||||
}
|
||||
|
||||
if( *pTestLine && *(pTestLine + 1) )
|
||||
{
|
||||
String aTestSym = aLine.copy( nTestCol, 2 );
|
||||
if( aTestSym.EqualsIgnoreCaseAscii( "to" ) )
|
||||
{
|
||||
aSym = String::CreateFromAscii( "goto" );
|
||||
pLine = pTestLine + 2;
|
||||
nCol = nTestCol + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt
|
||||
// (sonst falsche Zeilenfortsetzung)
|
||||
if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' )
|
||||
|
@ -206,9 +206,10 @@ void SbiSymPool::Add( SbiSymDef* pDef )
|
||||
|
||||
SbiSymDef* SbiSymPool::Find( const String& rName ) const
|
||||
{
|
||||
for( USHORT i = 0; i < aData.Count(); i++ )
|
||||
USHORT nCount = aData.Count();
|
||||
for( USHORT i = 0; i < nCount; i++ )
|
||||
{
|
||||
SbiSymDef* p = aData.GetObject( i );
|
||||
SbiSymDef* p = aData.GetObject( nCount - i - 1 );
|
||||
if( ( !p->nProcId || ( p->nProcId == nProcId ) )
|
||||
&& ( p->aName.EqualsIgnoreCaseAscii( rName ) ) )
|
||||
return p;
|
||||
|
@ -188,6 +188,7 @@ protected:
|
||||
SbiExprNode* AddSub();
|
||||
SbiExprNode* Cat();
|
||||
SbiExprNode* Like();
|
||||
SbiExprNode* VBA_Not();
|
||||
SbiExprNode* Comp();
|
||||
SbiExprNode* Boolean();
|
||||
public:
|
||||
|
@ -276,6 +276,8 @@ struct RefSaveItem
|
||||
|
||||
class SbiRuntime
|
||||
{
|
||||
friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
|
||||
|
||||
typedef void( SbiRuntime::*pStep0 )();
|
||||
typedef void( SbiRuntime::*pStep1 )( UINT32 nOp1 );
|
||||
typedef void( SbiRuntime::*pStep2 )( UINT32 nOp1, UINT32 nOp2 );
|
||||
@ -434,7 +436,7 @@ class SbiRuntime
|
||||
void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32);
|
||||
void StepFIND_CM( UINT32, UINT32 );
|
||||
void StepFIND_STATIC( UINT32, UINT32 );
|
||||
void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 );
|
||||
void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 );
|
||||
public:
|
||||
void SetVBAEnabled( bool bEnabled );
|
||||
USHORT GetImageFlag( USHORT n ) const;
|
||||
|
@ -28,15 +28,17 @@
|
||||
#ifndef _SBTRACE_HXX
|
||||
#define _SBTRACE_HXX
|
||||
|
||||
// #define DBG_TRACE_BASIC
|
||||
//#define DBG_TRACE_BASIC
|
||||
|
||||
#ifdef DBG_TRACE_BASIC
|
||||
void dbg_InitTrace( void );
|
||||
void dbg_DeInitTrace( void );
|
||||
void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl );
|
||||
void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false );
|
||||
void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl );
|
||||
void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
|
||||
const String& aTraceStr_STMNT, const String& aTraceStr_PCode );
|
||||
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ class SbUnoObject: public SbxObject
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
|
||||
BOOL bNeedIntrospection;
|
||||
BOOL bIgnoreNativeCOMObjectMembers;
|
||||
BOOL bNativeCOMObject;
|
||||
::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
|
||||
|
||||
// Hilfs-Methode zum Anlegen der dbg_-Properties
|
||||
@ -84,17 +84,22 @@ public:
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > getInvocation( void ) { return mxInvocation; }
|
||||
|
||||
void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
|
||||
|
||||
bool isNativeCOMObject( void )
|
||||
{ return bNativeCOMObject; }
|
||||
};
|
||||
SV_DECL_IMPL_REF(SbUnoObject);
|
||||
|
||||
|
||||
// #67781 Rueckgabewerte der Uno-Methoden loeschen
|
||||
void clearUnoMethods( void );
|
||||
void clearUnoMethodsForBasic( StarBASIC* pBasic );
|
||||
|
||||
class SbUnoMethod : public SbxMethod
|
||||
{
|
||||
friend class SbUnoObject;
|
||||
friend void clearUnoMethods( void );
|
||||
friend void clearUnoMethodsForBasic( StarBASIC* pBasic );
|
||||
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod;
|
||||
::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq;
|
||||
@ -103,13 +108,15 @@ class SbUnoMethod : public SbxMethod
|
||||
SbUnoMethod* pPrev;
|
||||
SbUnoMethod* pNext;
|
||||
|
||||
bool mbInvocation; // Method is based on invocation
|
||||
bool mbInvocation; // Method is based on invocation
|
||||
bool mbDirectInvocation; // Method should be used with XDirectInvocation interface
|
||||
|
||||
public:
|
||||
TYPEINFO();
|
||||
|
||||
SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
|
||||
bool bInvocation );
|
||||
bool bInvocation,
|
||||
bool bDirect = false );
|
||||
virtual ~SbUnoMethod();
|
||||
virtual SbxInfo* GetInfo();
|
||||
|
||||
@ -117,6 +124,8 @@ public:
|
||||
|
||||
bool isInvocationBased( void )
|
||||
{ return mbInvocation; }
|
||||
bool needsDirectInvocation( void )
|
||||
{ return mbDirectInvocation; }
|
||||
};
|
||||
|
||||
|
||||
@ -293,6 +302,9 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
|
||||
void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
|
||||
void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
|
||||
|
||||
void disposeComVariablesForBasic( StarBASIC* pBasic );
|
||||
void clearNativeObjectWrapperVector( void );
|
||||
|
||||
|
||||
//========================================================================
|
||||
// #118116 Collection object
|
||||
|
@ -43,6 +43,7 @@ namespace basic
|
||||
class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
|
||||
{
|
||||
::rtl::OUString maScriptLanguage;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxCodeNameAccess;
|
||||
|
||||
// Methods to distinguish between deffirent library types
|
||||
virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
|
||||
|
81
basic/source/runtime/comenumwrapper.cxx
Normal file
81
basic/source/runtime/comenumwrapper.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "precompiled_basic.hxx"
|
||||
#include "comenumwrapper.hxx"
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements()
|
||||
throw ( uno::RuntimeException )
|
||||
{
|
||||
sal_Bool bResult = sal_False;
|
||||
|
||||
try
|
||||
{
|
||||
if ( m_xInvocation.is() )
|
||||
{
|
||||
sal_Int32 nLength = 0;
|
||||
bResult =
|
||||
( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength )
|
||||
&& nLength > m_nCurInd );
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
|
||||
throw ( container::NoSuchElementException,
|
||||
lang::WrappedTargetException,
|
||||
uno::RuntimeException )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( m_xInvocation.is() )
|
||||
{
|
||||
uno::Sequence< sal_Int16 > aNamedParamIndex;
|
||||
uno::Sequence< uno::Any > aNamedParam;
|
||||
uno::Sequence< uno::Any > aArgs( 1 );
|
||||
|
||||
aArgs[0] <<= m_nCurInd++;
|
||||
|
||||
return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ),
|
||||
aArgs,
|
||||
aNamedParamIndex,
|
||||
aNamedParam );
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
|
||||
throw container::NoSuchElementException();
|
||||
}
|
||||
|
||||
|
54
basic/source/runtime/comenumwrapper.hxx
Normal file
54
basic/source/runtime/comenumwrapper.hxx
Normal file
@ -0,0 +1,54 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _COMENUMWRAPPER_HXX
|
||||
#define _COMENUMWRAPPER_HXX
|
||||
|
||||
#include <com/sun/star/container/XEnumeration.hpp>
|
||||
#include <com/sun/star/script/XInvocation.hpp>
|
||||
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
|
||||
class ComEnumerationWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >
|
||||
{
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > m_xInvocation;
|
||||
sal_Int32 m_nCurInd;
|
||||
|
||||
public:
|
||||
ComEnumerationWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation >& xInvocation )
|
||||
: m_xInvocation( xInvocation )
|
||||
, m_nCurInd( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
// container::XEnumeration
|
||||
virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
|
||||
};
|
||||
|
||||
#endif // _COMENUMWRAPPER_HXX
|
||||
|
@ -41,6 +41,7 @@ ENABLE_EXCEPTIONS = TRUE
|
||||
|
||||
SLOFILES= \
|
||||
$(SLO)$/basrdll.obj \
|
||||
$(SLO)$/comenumwrapper.obj \
|
||||
$(SLO)$/inputbox.obj \
|
||||
$(SLO)$/runtime.obj \
|
||||
$(SLO)$/step0.obj \
|
||||
|
127
basic/source/runtime/methods1.cxx
Normal file → Executable file
127
basic/source/runtime/methods1.cxx
Normal file → Executable file
@ -112,6 +112,126 @@ static Reference< XCalendar > getLocaleCalendar( void )
|
||||
return xCalendar;
|
||||
}
|
||||
|
||||
RTLFUNC(CallByName)
|
||||
{
|
||||
(void)pBasic;
|
||||
(void)bWrite;
|
||||
|
||||
const INT16 vbGet = 2;
|
||||
const INT16 vbLet = 4;
|
||||
const INT16 vbMethod = 1;
|
||||
const INT16 vbSet = 8;
|
||||
|
||||
// At least 3 parameter needed plus function itself -> 4
|
||||
USHORT nParCount = rPar.Count();
|
||||
if ( nParCount < 4 )
|
||||
{
|
||||
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. parameter is object
|
||||
SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject();
|
||||
SbxObject* pObj = NULL;
|
||||
if( pObjVar )
|
||||
pObj = PTR_CAST(SbxObject,pObjVar);
|
||||
if( !pObj && pObjVar && pObjVar->ISA(SbxVariable) )
|
||||
{
|
||||
SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject();
|
||||
pObj = PTR_CAST(SbxObject,pObjVarObj);
|
||||
}
|
||||
if( !pObj )
|
||||
{
|
||||
StarBASIC::Error( SbERR_BAD_PARAMETER );
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. parameter is ProcedureName
|
||||
String aNameStr = rPar.Get(2)->GetString();
|
||||
|
||||
// 3. parameter is CallType
|
||||
INT16 nCallType = rPar.Get(3)->GetInteger();
|
||||
|
||||
//SbxObject* pFindObj = NULL;
|
||||
SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_DONTCARE );
|
||||
if( pFindVar == NULL )
|
||||
{
|
||||
StarBASIC::Error( SbERR_PROC_UNDEFINED );
|
||||
return;
|
||||
}
|
||||
|
||||
switch( nCallType )
|
||||
{
|
||||
case vbGet:
|
||||
{
|
||||
SbxValues aVals;
|
||||
aVals.eType = SbxVARIANT;
|
||||
pFindVar->Get( aVals );
|
||||
|
||||
SbxVariableRef refVar = rPar.Get(0);
|
||||
refVar->Put( aVals );
|
||||
}
|
||||
break;
|
||||
case vbLet:
|
||||
case vbSet:
|
||||
{
|
||||
if ( nParCount != 5 )
|
||||
{
|
||||
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
||||
return;
|
||||
}
|
||||
SbxVariableRef pValVar = rPar.Get(4);
|
||||
if( nCallType == vbLet )
|
||||
{
|
||||
SbxValues aVals;
|
||||
aVals.eType = SbxVARIANT;
|
||||
pValVar->Get( aVals );
|
||||
pFindVar->Put( aVals );
|
||||
}
|
||||
else
|
||||
{
|
||||
SbxVariableRef rFindVar = pFindVar;
|
||||
SbiInstance* pInst = pINST;
|
||||
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
|
||||
if( pRT != NULL )
|
||||
pRT->StepSET_Impl( pValVar, rFindVar, false );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case vbMethod:
|
||||
{
|
||||
SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar);
|
||||
if( pMeth == NULL )
|
||||
{
|
||||
StarBASIC::Error( SbERR_PROC_UNDEFINED );
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup parameters
|
||||
SbxArrayRef xArray;
|
||||
USHORT nMethParamCount = nParCount - 4;
|
||||
if( nMethParamCount > 0 )
|
||||
{
|
||||
xArray = new SbxArray;
|
||||
for( USHORT i = 0 ; i < nMethParamCount ; i++ )
|
||||
{
|
||||
SbxVariable* pPar = rPar.Get( i + 4 );
|
||||
xArray->Put( pPar, i + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// Call method
|
||||
SbxVariableRef refVar = rPar.Get(0);
|
||||
if( xArray.Is() )
|
||||
pMeth->SetParameters( xArray );
|
||||
pMeth->Call( refVar );
|
||||
pMeth->SetParameters( NULL );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
StarBASIC::Error( SbERR_PROC_UNDEFINED );
|
||||
}
|
||||
}
|
||||
|
||||
RTLFUNC(CBool) // JSM
|
||||
{
|
||||
@ -527,6 +647,7 @@ RTLFUNC(DoEvents)
|
||||
//aTimer.Start();
|
||||
//while ( aTimer.IsActive() )
|
||||
// Application::Reschedule();
|
||||
Application::Reschedule( true );
|
||||
}
|
||||
|
||||
RTLFUNC(GetGUIVersion)
|
||||
@ -1513,6 +1634,12 @@ RTLFUNC(GetDefaultContext)
|
||||
RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite );
|
||||
}
|
||||
|
||||
#ifdef DBG_TRACE_BASIC
|
||||
RTLFUNC(TraceCommand)
|
||||
{
|
||||
RTL_Impl_TraceCommand( pBasic, rPar, bWrite );
|
||||
}
|
||||
#endif
|
||||
|
||||
RTLFUNC(Join)
|
||||
{
|
||||
|
@ -26,6 +26,7 @@
|
||||
************************************************************************/
|
||||
|
||||
#include <basic/sbstar.hxx>
|
||||
#include "sbtrace.hxx"
|
||||
|
||||
#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
|
||||
#define RTLNAME( name ) &SbRtl_##name
|
||||
@ -271,6 +272,7 @@ extern RTLFUNC(AboutStarBasic);
|
||||
extern RTLFUNC(LoadPicture);
|
||||
extern RTLFUNC(SavePicture);
|
||||
|
||||
extern RTLFUNC(CallByName);
|
||||
extern RTLFUNC(CBool); // JSM
|
||||
extern RTLFUNC(CByte); // JSM
|
||||
extern RTLFUNC(CCur); // JSM
|
||||
@ -345,5 +347,9 @@ extern RTLFUNC(CDec);
|
||||
|
||||
extern RTLFUNC(Partition); // Fong
|
||||
|
||||
#ifdef DBG_TRACE_BASIC
|
||||
extern RTLFUNC(TraceCommand);
|
||||
#endif
|
||||
|
||||
extern double Now_Impl();
|
||||
extern void Wait_Impl( bool bDurationBased, SbxArray& rPar );
|
||||
|
23
basic/source/runtime/runtime.cxx
Executable file → Normal file
23
basic/source/runtime/runtime.cxx
Executable file → Normal file
@ -45,6 +45,7 @@
|
||||
#include "sbunoobj.hxx"
|
||||
#include "errobject.hxx"
|
||||
#include "sbtrace.hxx"
|
||||
#include "comenumwrapper.hxx"
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
@ -890,11 +891,12 @@ void SbiRuntime::Error( SbError _errCode, const String& _details )
|
||||
{
|
||||
if ( _errCode )
|
||||
{
|
||||
OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
|
||||
// Not correct for class module usage, remove for now
|
||||
//OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
|
||||
if ( pInst->pRun == this )
|
||||
{
|
||||
pInst->Error( _errCode, _details );
|
||||
OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
|
||||
//OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1176,6 +1178,23 @@ void SbiRuntime::PushForEach()
|
||||
p->xEnumeration = xEnumerationAccess->createEnumeration();
|
||||
p->eForType = FOR_EACH_XENUMERATION;
|
||||
}
|
||||
else if ( isVBAEnabled() && pUnoObj->isNativeCOMObject() )
|
||||
{
|
||||
uno::Reference< script::XInvocation > xInvocation;
|
||||
if ( ( aAny >>= xInvocation ) && xInvocation.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
p->xEnumeration = new ComEnumerationWrapper( xInvocation );
|
||||
p->eForType = FOR_EACH_XENUMERATION;
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{}
|
||||
}
|
||||
|
||||
if ( !p->xEnumeration.is() )
|
||||
bError_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bError_ = true;
|
||||
|
@ -94,6 +94,10 @@ static Methods aMethods[] = {
|
||||
{ "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 },
|
||||
{ "RGB-Value", SbxLONG, 0,NULL,0 },
|
||||
|
||||
{ "CallByName", SbxVARIANT, 3 | _FUNCTION, RTLNAME(CallByName),0 },
|
||||
{ "Object", SbxOBJECT, 0,NULL,0 },
|
||||
{ "ProcedureName",SbxSTRING, 0,NULL,0 },
|
||||
{ "CallType", SbxINTEGER, 0,NULL,0 },
|
||||
{ "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool),0 },
|
||||
{ "expression", SbxVARIANT, 0,NULL,0 },
|
||||
{ "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 },
|
||||
@ -531,6 +535,10 @@ static Methods aMethods[] = {
|
||||
{ "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 },
|
||||
{ "String", SbxSTRING, 0,NULL,0 },
|
||||
{ "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE),0 },
|
||||
#ifdef DBG_TRACE_BASIC
|
||||
{ "TraceCommand", SbxNULL, 1 | _FUNCTION, RTLNAME(TraceCommand),0 },
|
||||
{ "Command", SbxSTRING, 0,NULL,0 },
|
||||
#endif
|
||||
{ "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim),0 },
|
||||
{ "String", SbxSTRING, 0,NULL,0 },
|
||||
{ "True", SbxBOOL, _CPROP, RTLNAME(True),0 },
|
||||
|
@ -47,6 +47,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
|
||||
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
|
||||
|
||||
#include <algorithm>
|
||||
#include <hash_map>
|
||||
|
||||
SbxVariable* getDefaultProp( SbxVariable* pRef );
|
||||
|
||||
@ -418,9 +419,53 @@ void SbiRuntime::StepPUT()
|
||||
}
|
||||
|
||||
|
||||
// VBA Dim As New behavior handling, save init object information
|
||||
struct DimAsNewRecoverItem
|
||||
{
|
||||
String m_aObjClass;
|
||||
String m_aObjName;
|
||||
SbxObject* m_pObjParent;
|
||||
SbModule* m_pClassModule;
|
||||
|
||||
DimAsNewRecoverItem( void )
|
||||
: m_pObjParent( NULL )
|
||||
, m_pClassModule( NULL )
|
||||
{}
|
||||
|
||||
DimAsNewRecoverItem( const String& rObjClass, const String& rObjName,
|
||||
SbxObject* pObjParent, SbModule* pClassModule )
|
||||
: m_aObjClass( rObjClass )
|
||||
, m_aObjName( rObjName )
|
||||
, m_pObjParent( pObjParent )
|
||||
, m_pClassModule( pClassModule )
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct SbxVariablePtrHash
|
||||
{
|
||||
size_t operator()( SbxVariable* pVar ) const
|
||||
{ return (size_t)pVar; }
|
||||
};
|
||||
|
||||
typedef std::hash_map< SbxVariable*, DimAsNewRecoverItem, SbxVariablePtrHash > DimAsNewRecoverHash;
|
||||
|
||||
static DimAsNewRecoverHash GaDimAsNewRecoverHash;
|
||||
|
||||
void removeDimAsNewRecoverItem( SbxVariable* pVar )
|
||||
{
|
||||
DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar );
|
||||
if( it != GaDimAsNewRecoverHash.end() )
|
||||
GaDimAsNewRecoverHash.erase( it );
|
||||
}
|
||||
|
||||
|
||||
// Speichern Objektvariable
|
||||
// Nicht-Objekt-Variable fuehren zu Fehlern
|
||||
|
||||
static const char pCollectionStr[] = "Collection";
|
||||
|
||||
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
|
||||
{
|
||||
// #67733 Typen mit Array-Flag sind auch ok
|
||||
@ -523,6 +568,12 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Dim As New
|
||||
BOOL bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW );
|
||||
SbxBaseRef xPrevVarObj;
|
||||
if( bDimAsNew )
|
||||
xPrevVarObj = refVar->GetObject();
|
||||
|
||||
// Handle withevents
|
||||
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
|
||||
if ( bWithEvents )
|
||||
@ -541,7 +592,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
|
||||
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
|
||||
|
||||
refVal->SetDeclareClassName( aDeclareClassName );
|
||||
refVal->SetComListener( xComListener ); // Hold reference
|
||||
refVal->SetComListener( xComListener, &rBasic ); // Hold reference
|
||||
}
|
||||
|
||||
*refVar = *refVal;
|
||||
@ -551,6 +602,68 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
|
||||
*refVar = *refVal;
|
||||
}
|
||||
|
||||
if ( bDimAsNew )
|
||||
{
|
||||
if( !refVar->ISA(SbxObject) )
|
||||
{
|
||||
SbxBase* pValObjBase = refVal->GetObject();
|
||||
if( pValObjBase == NULL )
|
||||
{
|
||||
if( xPrevVarObj.Is() )
|
||||
{
|
||||
// Object is overwritten with NULL, instantiate init object
|
||||
DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar );
|
||||
if( it != GaDimAsNewRecoverHash.end() )
|
||||
{
|
||||
const DimAsNewRecoverItem& rItem = it->second;
|
||||
if( rItem.m_pClassModule != NULL )
|
||||
{
|
||||
SbClassModuleObject* pNewObj = new SbClassModuleObject( rItem.m_pClassModule );
|
||||
pNewObj->SetName( rItem.m_aObjName );
|
||||
pNewObj->SetParent( rItem.m_pObjParent );
|
||||
refVar->PutObject( pNewObj );
|
||||
}
|
||||
else if( rItem.m_aObjClass.EqualsIgnoreCaseAscii( pCollectionStr ) )
|
||||
{
|
||||
BasicCollection* pNewCollection = new BasicCollection( String( RTL_CONSTASCII_USTRINGPARAM(pCollectionStr) ) );
|
||||
pNewCollection->SetName( rItem.m_aObjName );
|
||||
pNewCollection->SetParent( rItem.m_pObjParent );
|
||||
refVar->PutObject( pNewCollection );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Does old value exist?
|
||||
bool bFirstInit = !xPrevVarObj.Is();
|
||||
if( bFirstInit )
|
||||
{
|
||||
// Store information to instantiate object later
|
||||
SbxObject* pValObj = PTR_CAST(SbxObject,pValObjBase);
|
||||
if( pValObj != NULL )
|
||||
{
|
||||
String aObjClass = pValObj->GetClassName();
|
||||
|
||||
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase);
|
||||
if( pClassModuleObj != NULL )
|
||||
{
|
||||
SbModule* pClassModule = pClassModuleObj->getClassModule();
|
||||
GaDimAsNewRecoverHash[refVar] =
|
||||
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
|
||||
}
|
||||
else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
|
||||
{
|
||||
GaDimAsNewRecoverHash[refVar] =
|
||||
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
|
||||
// in this case if there is a default prop involved the value of the
|
||||
// default property may infact be void so the type will also be SbxEMPTY
|
||||
|
@ -143,15 +143,19 @@ SbxVariable* SbiRuntime::FindElement
|
||||
else
|
||||
pElem = getVBAConstant( aName );
|
||||
}
|
||||
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
|
||||
// Modulen IMMER ein Ergebnis!
|
||||
SbUnoClass* pUnoClass = findUnoClass( aName );
|
||||
if( pUnoClass )
|
||||
|
||||
if( !pElem )
|
||||
{
|
||||
pElem = new SbxVariable( t );
|
||||
SbxValues aRes( SbxOBJECT );
|
||||
aRes.pObj = pUnoClass;
|
||||
pElem->SbxVariable::Put( aRes );
|
||||
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
|
||||
// Modulen IMMER ein Ergebnis!
|
||||
SbUnoClass* pUnoClass = findUnoClass( aName );
|
||||
if( pUnoClass )
|
||||
{
|
||||
pElem = new SbxVariable( t );
|
||||
SbxValues aRes( SbxOBJECT );
|
||||
aRes.pObj = pUnoClass;
|
||||
pElem->SbxVariable::Put( aRes );
|
||||
}
|
||||
}
|
||||
|
||||
// #62939 Wenn eine Uno-Klasse gefunden wurde, muss
|
||||
@ -407,6 +411,34 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( bVBAEnabled && p->GetType() == SbxOBJECT && (!p->ISA(SbxMethod) || !p->IsBroadcaster()) )
|
||||
{
|
||||
// Check for default method with named parameters
|
||||
SbxBaseRef pObj = (SbxBase*)p->GetObject();
|
||||
if( pObj && pObj->ISA(SbUnoObject) )
|
||||
{
|
||||
SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
|
||||
Any aAny = pUnoObj->getUnoAny();
|
||||
|
||||
if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE )
|
||||
{
|
||||
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
|
||||
Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY );
|
||||
|
||||
rtl::OUString sDefaultMethod;
|
||||
if ( xDfltMethod.is() )
|
||||
sDefaultMethod = xDfltMethod->getDefaultMethodName();
|
||||
if ( sDefaultMethod.getLength() )
|
||||
{
|
||||
SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD );
|
||||
if( meth != NULL )
|
||||
pInfo = meth->GetInfo();
|
||||
if( pInfo )
|
||||
bError_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( bError_ )
|
||||
Error( SbERR_NO_NAMED_ARGS );
|
||||
}
|
||||
@ -489,7 +521,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
|
||||
pPar->Put( NULL, 0 );
|
||||
}
|
||||
// Index-Access bei UnoObjekten beruecksichtigen
|
||||
else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) )
|
||||
else if( pElem->GetType() == SbxOBJECT && (!pElem->ISA(SbxMethod) || !pElem->IsBroadcaster()) )
|
||||
{
|
||||
pPar = pElem->GetParameters();
|
||||
if ( pPar )
|
||||
@ -589,6 +621,12 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
|
||||
pCol->CollItem( pPar );
|
||||
}
|
||||
}
|
||||
else if( bVBAEnabled ) // !pObj
|
||||
{
|
||||
SbxArray* pParam = pElem->GetParameters();
|
||||
if( pParam != NULL )
|
||||
Error( SbERR_NO_OBJECT );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1085,12 +1123,24 @@ void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 )
|
||||
PushVar( pNew );
|
||||
}
|
||||
|
||||
void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 )
|
||||
void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 )
|
||||
{
|
||||
USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000
|
||||
String aStr;
|
||||
aStr.Fill( nCount, 0 );
|
||||
pStrVar->PutString( aStr );
|
||||
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
|
||||
if( bWithEvents )
|
||||
pVar->SetFlag( SBX_WITH_EVENTS );
|
||||
|
||||
bool bDimAsNew = ((nOp2 & SBX_TYPE_DIM_AS_NEW_FLAG) != 0);
|
||||
if( bDimAsNew )
|
||||
pVar->SetFlag( SBX_DIM_AS_NEW );
|
||||
|
||||
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
|
||||
if( bFixedString )
|
||||
{
|
||||
USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000
|
||||
String aStr;
|
||||
aStr.Fill( nCount, 0 );
|
||||
pVar->PutString( aStr );
|
||||
}
|
||||
}
|
||||
|
||||
// Einrichten einer lokalen Variablen (+StringID+Typ)
|
||||
@ -1105,12 +1155,7 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
|
||||
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
|
||||
SbxVariable* p = new SbxVariable( t );
|
||||
p->SetName( aName );
|
||||
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
|
||||
if( bWithEvents )
|
||||
p->SetFlag( SBX_WITH_EVENTS );
|
||||
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
|
||||
if( bFixedString )
|
||||
implCreateFixedString( p, nOp2 );
|
||||
implHandleSbxFlags( p, t, nOp2 );
|
||||
refLocals->Put( p, refLocals->Count() );
|
||||
}
|
||||
}
|
||||
@ -1137,12 +1182,7 @@ void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassMo
|
||||
// AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
|
||||
pProp->SetFlag( SBX_NO_MODIFY);
|
||||
|
||||
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
|
||||
if( bWithEvents )
|
||||
pProp->SetFlag( SBX_WITH_EVENTS );
|
||||
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
|
||||
if( bFixedString )
|
||||
implCreateFixedString( p, nOp2 );
|
||||
implHandleSbxFlags( pProp, t, nOp2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
|
||||
{
|
||||
if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) )
|
||||
nRes = SbxTRUE;
|
||||
else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
|
||||
else if( !p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
|
||||
{
|
||||
// Jetzt kann es noch in eine Zahl konvertierbar sein
|
||||
BOOL bError = TRUE;
|
||||
|
@ -112,6 +112,9 @@ SbxObject::~SbxObject()
|
||||
CheckParentsOnDelete( this, pProps );
|
||||
CheckParentsOnDelete( this, pMethods );
|
||||
CheckParentsOnDelete( this, pObjs );
|
||||
|
||||
// avoid handling in ~SbxVariable as SBX_DIM_AS_NEW == SBX_GBLSEARCH
|
||||
ResetFlag( SBX_DIM_AS_NEW );
|
||||
}
|
||||
|
||||
SbxDataType SbxObject::GetType() const
|
||||
|
10
basic/source/sbx/sbxvalue.cxx
Normal file → Executable file
10
basic/source/sbx/sbxvalue.cxx
Normal file → Executable file
@ -436,6 +436,8 @@ SbxValue* SbxValue::TheRealValue() const
|
||||
}
|
||||
|
||||
// #55226 Zusaetzliche Info transportieren
|
||||
bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx
|
||||
|
||||
SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
|
||||
{
|
||||
SbxValue* p = (SbxValue*) this;
|
||||
@ -461,8 +463,12 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
|
||||
((SbxValue*) pObj)->aData.eType == SbxOBJECT &&
|
||||
((SbxValue*) pObj)->aData.pObj == pObj )
|
||||
{
|
||||
SetError( SbxERR_BAD_PROP_VALUE );
|
||||
p = NULL;
|
||||
bool bSuccess = handleToStringForCOMObjects( pObj, p );
|
||||
if( !bSuccess )
|
||||
{
|
||||
SetError( SbxERR_BAD_PROP_VALUE );
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
else if( pDflt )
|
||||
p = pDflt;
|
||||
|
@ -59,13 +59,17 @@ class SbxVariableImpl
|
||||
friend class SbxVariable;
|
||||
String m_aDeclareClassName;
|
||||
Reference< XInterface > m_xComListener;
|
||||
StarBASIC* m_pComListenerParentBasic;
|
||||
|
||||
SbxVariableImpl( void )
|
||||
: m_pComListenerParentBasic( NULL )
|
||||
{}
|
||||
SbxVariableImpl( const SbxVariableImpl& r )
|
||||
: m_aDeclareClassName( r.m_aDeclareClassName )
|
||||
, m_xComListener( r.m_xComListener )
|
||||
{}
|
||||
, m_pComListenerParentBasic( r.m_pComListenerParentBasic )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -84,12 +88,18 @@ SbxVariable::SbxVariable() : SbxValue()
|
||||
#endif
|
||||
}
|
||||
|
||||
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic );
|
||||
|
||||
SbxVariable::SbxVariable( const SbxVariable& r )
|
||||
: SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo )
|
||||
{
|
||||
mpSbxVariableImpl = NULL;
|
||||
if( r.mpSbxVariableImpl != NULL )
|
||||
{
|
||||
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
|
||||
if( mpSbxVariableImpl->m_xComListener.is() )
|
||||
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
|
||||
}
|
||||
pCst = NULL;
|
||||
if( r.CanRead() )
|
||||
{
|
||||
@ -126,6 +136,8 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
|
||||
#endif
|
||||
}
|
||||
|
||||
void removeDimAsNewRecoverItem( SbxVariable* pVar );
|
||||
|
||||
SbxVariable::~SbxVariable()
|
||||
{
|
||||
#ifdef DBG_UTIL
|
||||
@ -136,6 +148,8 @@ SbxVariable::~SbxVariable()
|
||||
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
|
||||
GetSbxData_Impl()->aVars.Remove( this );
|
||||
#endif
|
||||
if( IsSet( SBX_DIM_AS_NEW ))
|
||||
removeDimAsNewRecoverItem( this );
|
||||
delete mpSbxVariableImpl;
|
||||
delete pCst;
|
||||
}
|
||||
@ -315,7 +329,11 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
|
||||
SbxValue::operator=( r );
|
||||
delete mpSbxVariableImpl;
|
||||
if( r.mpSbxVariableImpl != NULL )
|
||||
{
|
||||
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
|
||||
if( mpSbxVariableImpl->m_xComListener.is() )
|
||||
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
|
||||
}
|
||||
else
|
||||
mpSbxVariableImpl = NULL;
|
||||
return *this;
|
||||
@ -396,10 +414,19 @@ void SbxVariable::SetDeclareClassName( const String& rDeclareClassName )
|
||||
pImpl->m_aDeclareClassName = rDeclareClassName;
|
||||
}
|
||||
|
||||
void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener )
|
||||
void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
|
||||
StarBASIC* pParentBasic )
|
||||
{
|
||||
SbxVariableImpl* pImpl = getImpl();
|
||||
pImpl->m_xComListener = xComListener;
|
||||
pImpl->m_pComListenerParentBasic = pParentBasic;
|
||||
registerComListenerVariableForBasic( this, pParentBasic );
|
||||
}
|
||||
|
||||
void SbxVariable::ClearComListener( void )
|
||||
{
|
||||
SbxVariableImpl* pImpl = getImpl();
|
||||
pImpl->m_xComListener.clear();
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_basic.hxx"
|
||||
#include "modsizeexceeded.hxx"
|
||||
#include "basic/modsizeexceeded.hxx"
|
||||
|
||||
#include <framework/interaction.hxx>
|
||||
#include <comphelper/interaction.hxx>
|
||||
#include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
|
||||
|
||||
using namespace com::sun::star;
|
||||
@ -44,8 +44,8 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >&
|
||||
|
||||
m_aRequest <<= aReq;
|
||||
|
||||
m_xAbort.set( uno::Reference< task::XInteractionAbort >(new framework::ContinuationAbort), uno::UNO_QUERY );
|
||||
m_xApprove.set( uno::Reference< task::XInteractionApprove >(new framework::ContinuationApprove ), uno::UNO_QUERY );
|
||||
m_xAbort.set( uno::Reference< task::XInteractionAbort >(new comphelper::OInteractionAbort), uno::UNO_QUERY );
|
||||
m_xApprove.set( uno::Reference< task::XInteractionApprove >(new comphelper::OInteractionApprove ), uno::UNO_QUERY );
|
||||
m_lContinuations.realloc( 2 );
|
||||
m_lContinuations[0] = m_xApprove;
|
||||
m_lContinuations[1] = m_xAbort;
|
||||
@ -54,15 +54,15 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >&
|
||||
sal_Bool
|
||||
ModuleSizeExceeded::isAbort() const
|
||||
{
|
||||
framework::ContinuationAbort* pBase = static_cast< framework::ContinuationAbort* >( m_xAbort.get() );
|
||||
return pBase->isSelected();
|
||||
comphelper::OInteractionAbort* pBase = static_cast< comphelper::OInteractionAbort* >( m_xAbort.get() );
|
||||
return pBase->wasSelected();
|
||||
}
|
||||
|
||||
sal_Bool
|
||||
ModuleSizeExceeded::isApprove() const
|
||||
{
|
||||
framework::ContinuationApprove* pBase = static_cast< framework::ContinuationApprove* >( m_xApprove.get() );
|
||||
return pBase->isSelected();
|
||||
comphelper::OInteractionApprove* pBase = static_cast< comphelper::OInteractionApprove* >( m_xApprove.get() );
|
||||
return pBase->wasSelected();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2815,19 +2815,37 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
|
||||
|
||||
void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
|
||||
{
|
||||
BasicManager* pBasMgr = getBasicManager();
|
||||
if( pBasMgr )
|
||||
/* The member variable mbVBACompat must be set first, the following call
|
||||
to getBasicManager() may call getVBACompatibilityMode() which returns
|
||||
this value. */
|
||||
mbVBACompat = _vbacompatmodeon;
|
||||
if( BasicManager* pBasMgr = getBasicManager() )
|
||||
{
|
||||
// get the standard library
|
||||
String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
|
||||
if ( pBasMgr->GetName().Len() )
|
||||
aLibName = pBasMgr->GetName();
|
||||
String aLibName = pBasMgr->GetName();
|
||||
if ( aLibName.Len() == 0 )
|
||||
aLibName = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
|
||||
|
||||
StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
|
||||
if( pBasic )
|
||||
if( StarBASIC* pBasic = pBasMgr->GetLib( aLibName ) )
|
||||
pBasic->SetVBAEnabled( _vbacompatmodeon );
|
||||
|
||||
/* If in VBA compatibility mode, force creation of the VBA Globals
|
||||
object. Each application will create an instance of its own
|
||||
implementation and store it in its Basic manager. Implementations
|
||||
will do all necessary additional initialization, such as
|
||||
registering the global "This***Doc" UNO constant, starting the
|
||||
document events processor etc.
|
||||
*/
|
||||
if( mbVBACompat ) try
|
||||
{
|
||||
Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
|
||||
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
|
||||
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
mbVBACompat = _vbacompatmodeon;
|
||||
}
|
||||
|
||||
// Methods XServiceInfo
|
||||
|
@ -62,7 +62,7 @@
|
||||
#include <basic/basmgr.hxx>
|
||||
#include <basic/sbmod.hxx>
|
||||
#include <basic/basicmanagerrepository.hxx>
|
||||
#include "modsizeexceeded.hxx"
|
||||
#include "basic/modsizeexceeded.hxx"
|
||||
#include <xmlscript/xmlmod_imexp.hxx>
|
||||
#include <cppuhelper/factory.hxx>
|
||||
#include <com/sun/star/util/VetoException.hpp>
|
||||
@ -80,10 +80,9 @@ using namespace com::sun::star::script;
|
||||
using namespace com::sun::star::xml::sax;
|
||||
using namespace com::sun::star;
|
||||
using namespace cppu;
|
||||
using namespace rtl;
|
||||
using namespace osl;
|
||||
|
||||
using com::sun::star::uno::Reference;
|
||||
using ::rtl::OUString;
|
||||
|
||||
//============================================================================
|
||||
// Implementation class SfxScriptLibraryContainer
|
||||
@ -311,24 +310,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
|
||||
// aMod.aName ignored
|
||||
if( aMod.aModuleType.getLength() > 0 )
|
||||
{
|
||||
if( !getVBACompatibilityMode() )
|
||||
/* If in VBA compatibility mode, force creation of the VBA Globals
|
||||
object. Each application will create an instance of its own
|
||||
implementation and store it in its Basic manager. Implementations
|
||||
will do all necessary additional initialization, such as
|
||||
registering the global "This***Doc" UNO constant, starting the
|
||||
document events processor etc.
|
||||
*/
|
||||
if( getVBACompatibilityMode() ) try
|
||||
{
|
||||
Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
|
||||
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
|
||||
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
setVBACompatibilityMode( sal_True );
|
||||
|
||||
Any aGlobs;
|
||||
Sequence< Any > aArgs(1);
|
||||
Reference<frame::XModel > xModel( mxOwnerDocument );
|
||||
aArgs[ 0 ] <<= xModel;
|
||||
|
||||
BasicManager* pBasicMgr = getBasicManager();
|
||||
if( pBasicMgr )
|
||||
{
|
||||
aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
|
||||
pBasicMgr->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
|
||||
}
|
||||
pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False );
|
||||
if( pBasicMgr )
|
||||
pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] );
|
||||
}
|
||||
|
||||
script::ModuleInfo aModInfo;
|
||||
@ -353,25 +349,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
|
||||
RTL_CONSTASCII_STRINGPARAM("document") ))
|
||||
{
|
||||
aModInfo.ModuleType = ModuleType::DOCUMENT;
|
||||
Reference<frame::XModel > xModel( mxOwnerDocument );
|
||||
Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY);
|
||||
Reference< container::XNameAccess > xVBACodeNameAccess;
|
||||
if( xSF.is() )
|
||||
|
||||
// #163691# use the same codename access instance for all document modules
|
||||
if( !mxCodeNameAccess.is() ) try
|
||||
{
|
||||
try
|
||||
{
|
||||
xVBACodeNameAccess.set( xSF->createInstance(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
||||
"ooo.vba.VBAObjectModuleObjectProvider"))),
|
||||
UNO_QUERY );
|
||||
}
|
||||
catch(uno::Exception&) {}
|
||||
Reference<frame::XModel > xModel( mxOwnerDocument );
|
||||
Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY_THROW );
|
||||
mxCodeNameAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider" ) ) ), UNO_QUERY );
|
||||
}
|
||||
if( xVBACodeNameAccess.is() )
|
||||
catch( Exception& ) {}
|
||||
|
||||
if( mxCodeNameAccess.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
aModInfo.ModuleObject.set( xVBACodeNameAccess->getByName( aElementName), uno::UNO_QUERY );
|
||||
aModInfo.ModuleObject.set( mxCodeNameAccess->getByName( aElementName), uno::UNO_QUERY );
|
||||
}
|
||||
catch(uno::Exception&)
|
||||
{
|
||||
|
@ -143,4 +143,10 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk
|
||||
$(SRS)$/basic.srs:
|
||||
$(TYPE) $(SRS)$/classes.srs + $(SRS)$/runtime.srs + $(SRS)$/sbx.srs > $@
|
||||
|
||||
ALLTAR : $(MISC)/sb.component
|
||||
|
||||
$(MISC)/sb.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
|
||||
sb.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt sb.component
|
||||
|
39
basic/util/sb.component
Normal file
39
basic/util/sb.component
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.sfx2.DialogLibraryContainer">
|
||||
<service name="com.sun.star.script.DialogLibraryContainer"/>
|
||||
<service name="com.sun.star.script.DocumentDialogLibraryContainer"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.sfx2.ScriptLibraryContainer">
|
||||
<service name="com.sun.star.script.DocumentScriptLibraryContainer"/>
|
||||
<service name="com.sun.star.script.ScriptLibraryContainer"/>
|
||||
</implementation>
|
||||
</component>
|
@ -1,4 +1,4 @@
|
||||
cg configmgr : BOOST:boost comphelper cppu cppuhelper offuh sal salhelper stlport NULL
|
||||
cg configmgr : BOOST:boost LIBXSLT:libxslt comphelper cppu cppuhelper offuh sal salhelper stlport xmlreader NULL
|
||||
cg configmgr\inc nmake - all cg_inc NULL
|
||||
cg configmgr\source nmake - all cg_source cg_inc NULL
|
||||
cg configmgr\qa\unoapi nmake - all cg_qa_unoapi NULL
|
||||
|
@ -1,3 +1,4 @@
|
||||
..\%__SRC%\bin\configmgr.uno.dll %_DEST%\bin%_EXT%\configmgr.uno.dll
|
||||
..\%__SRC%\lib\configmgr.uno.dylib %_DEST%\lib%_EXT%\configmgr.uno.dylib
|
||||
..\%__SRC%\lib\configmgr.uno.so %_DEST%\lib%_EXT%\configmgr.uno.so
|
||||
..\%__SRC%\misc\configmgr.component %_DEST%\xml%_EXT%\configmgr.component
|
||||
|
@ -51,16 +51,13 @@ propertynode.cxx
|
||||
setnode.cxx
|
||||
Internal representations of data nodes.
|
||||
|
||||
pad.cxx
|
||||
parsemanager.cxx
|
||||
parser.hxx
|
||||
span.hxx
|
||||
valueparser.cxx
|
||||
xcdparser.cxx
|
||||
xcsparser.cxx
|
||||
xcuparser.cxx
|
||||
xmldata.cxx
|
||||
xmlreader.cxx
|
||||
XML file reading.
|
||||
|
||||
modifications.cxx
|
||||
|
@ -909,11 +909,8 @@ rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException)
|
||||
OSL_ASSERT(thisIs(IS_ANY));
|
||||
osl::MutexGuard g(lock);
|
||||
checkLocalizedPropertyAccess();
|
||||
throw css::uno::RuntimeException(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"configmgr Access has no service implementation name")),
|
||||
static_cast< cppu::OWeakObject * >(this));
|
||||
return rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM("org.openoffice-configmgr::Access"));
|
||||
}
|
||||
|
||||
sal_Bool Access::supportsService(rtl::OUString const & ServiceName)
|
||||
@ -2092,7 +2089,8 @@ css::beans::Property Access::asProperty() {
|
||||
default:
|
||||
type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct?
|
||||
nillable = false;
|
||||
removable = getParentNode()->kind() == Node::KIND_SET;
|
||||
rtl::Reference< Node > parent(getParentNode());
|
||||
removable = parent.is() && parent->kind() == Node::KIND_SET;
|
||||
break;
|
||||
}
|
||||
return css::beans::Property(
|
||||
|
@ -282,9 +282,10 @@ css::uno::Any ChildAccess::asValue() {
|
||||
if (!Components::allLocales(locale)) {
|
||||
// Find best match using an adaption of RFC 4647 lookup matching
|
||||
// rules, removing "-" or "_" delimited segments from the end;
|
||||
// defaults are the empty string locale, the "en-US" locale, the
|
||||
// first child (if any), or a nil value (even though it may be
|
||||
// illegal for the given property), in that order:
|
||||
// defaults are the "en-US" locale, the "en" locale, the empty
|
||||
// string locale, the first child (if any), or a nil value (even
|
||||
// though it may be illegal for the given property), in that
|
||||
// order:
|
||||
rtl::Reference< ChildAccess > child;
|
||||
for (;;) {
|
||||
child = getChild(locale);
|
||||
@ -295,16 +296,26 @@ css::uno::Any ChildAccess::asValue() {
|
||||
while (i > 0 && locale[i] != '-' && locale[i] != '_') {
|
||||
--i;
|
||||
}
|
||||
if (i == 0) {
|
||||
break;
|
||||
}
|
||||
locale = locale.copy(0, i);
|
||||
}
|
||||
if (!child.is()) {
|
||||
child = getChild(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")));
|
||||
if (!child.is()) {
|
||||
std::vector< rtl::Reference< ChildAccess > > all(
|
||||
getAllChildren());
|
||||
if (!all.empty()) {
|
||||
child = all.front();
|
||||
child = getChild(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")));
|
||||
if (!child.is()) {
|
||||
child = getChild(rtl::OUString());
|
||||
if (!child.is()) {
|
||||
std::vector< rtl::Reference< ChildAccess > >
|
||||
all(getAllChildren());
|
||||
if (!all.empty()) {
|
||||
child = all.front();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "sal/config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <list>
|
||||
|
||||
#include "com/sun/star/beans/Optional.hpp"
|
||||
@ -43,8 +44,11 @@
|
||||
#include "com/sun/star/uno/RuntimeException.hpp"
|
||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||
#include "com/sun/star/uno/XInterface.hpp"
|
||||
#include "osl/conditn.hxx"
|
||||
#include "osl/diagnose.h"
|
||||
#include "osl/file.hxx"
|
||||
#include "osl/mutex.hxx"
|
||||
#include "osl/thread.hxx"
|
||||
#include "rtl/bootstrap.hxx"
|
||||
#include "rtl/logfile.h"
|
||||
#include "rtl/ref.hxx"
|
||||
@ -53,10 +57,12 @@
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "sal/types.h"
|
||||
#include "salhelper/simplereferenceobject.hxx"
|
||||
|
||||
#include "additions.hxx"
|
||||
#include "components.hxx"
|
||||
#include "data.hxx"
|
||||
#include "lock.hxx"
|
||||
#include "modifications.hxx"
|
||||
#include "node.hxx"
|
||||
#include "nodemap.hxx"
|
||||
@ -148,7 +154,67 @@ static Components * singleton = 0;
|
||||
|
||||
}
|
||||
|
||||
void Components::initSingleton(
|
||||
class Components::WriteThread:
|
||||
public osl::Thread, public salhelper::SimpleReferenceObject
|
||||
{
|
||||
public:
|
||||
static void * operator new(std::size_t size)
|
||||
{ return Thread::operator new(size); }
|
||||
|
||||
static void operator delete(void * pointer)
|
||||
{ Thread::operator delete(pointer); }
|
||||
|
||||
WriteThread(
|
||||
rtl::Reference< WriteThread > * reference, Components & components,
|
||||
rtl::OUString const & url, Data const & data);
|
||||
|
||||
void flush() { delay_.set(); }
|
||||
|
||||
private:
|
||||
virtual ~WriteThread() {}
|
||||
|
||||
virtual void SAL_CALL run();
|
||||
|
||||
virtual void SAL_CALL onTerminated() { release(); }
|
||||
|
||||
rtl::Reference< WriteThread > * reference_;
|
||||
Components & components_;
|
||||
rtl::OUString url_;
|
||||
Data const & data_;
|
||||
osl::Condition delay_;
|
||||
};
|
||||
|
||||
Components::WriteThread::WriteThread(
|
||||
rtl::Reference< WriteThread > * reference, Components & components,
|
||||
rtl::OUString const & url, Data const & data):
|
||||
reference_(reference), components_(components), url_(url), data_(data)
|
||||
{
|
||||
OSL_ASSERT(reference != 0);
|
||||
acquire();
|
||||
}
|
||||
|
||||
void Components::WriteThread::run() {
|
||||
TimeValue t = { 1, 0 }; // 1 sec
|
||||
delay_.wait(&t); // must not throw; result_error is harmless and ignored
|
||||
osl::MutexGuard g(lock); // must not throw
|
||||
try {
|
||||
try {
|
||||
writeModFile(components_, url_, data_);
|
||||
} catch (css::uno::RuntimeException & e) {
|
||||
// Silently ignore write errors, instead of aborting:
|
||||
OSL_TRACE(
|
||||
"configmgr error writing modifications: %s",
|
||||
rtl::OUStringToOString(
|
||||
e.Message, RTL_TEXTENCODING_UTF8).getStr());
|
||||
}
|
||||
} catch (...) {
|
||||
reference_->clear();
|
||||
throw;
|
||||
}
|
||||
reference_->clear();
|
||||
}
|
||||
|
||||
Components & Components::getSingleton(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & context)
|
||||
{
|
||||
OSL_ASSERT(context.is());
|
||||
@ -157,10 +223,6 @@ void Components::initSingleton(
|
||||
static Components theSingleton(context);
|
||||
singleton = &theSingleton;
|
||||
}
|
||||
}
|
||||
|
||||
Components & Components::getSingleton() {
|
||||
OSL_ASSERT(singletonCreated);
|
||||
if (singleton == 0) {
|
||||
throw css::uno::RuntimeException(
|
||||
rtl::OUString(
|
||||
@ -238,7 +300,23 @@ void Components::addModification(Path const & path) {
|
||||
}
|
||||
|
||||
void Components::writeModifications() {
|
||||
writeModFile(*this, getModificationFileUrl(), data_);
|
||||
if (!writeThread_.is()) {
|
||||
writeThread_ = new WriteThread(
|
||||
&writeThread_, *this, getModificationFileUrl(), data_);
|
||||
writeThread_->create();
|
||||
}
|
||||
}
|
||||
|
||||
void Components::flushModifications() {
|
||||
rtl::Reference< WriteThread > thread;
|
||||
{
|
||||
osl::MutexGuard g(lock);
|
||||
thread = writeThread_;
|
||||
}
|
||||
if (thread.is()) {
|
||||
thread->flush();
|
||||
thread->join();
|
||||
}
|
||||
}
|
||||
|
||||
void Components::insertExtensionXcsFile(
|
||||
@ -334,12 +412,14 @@ void Components::insertModificationXcuFile(
|
||||
Modifications * modifications)
|
||||
{
|
||||
OSL_ASSERT(modifications != 0);
|
||||
Partial part(includedPaths, excludedPaths);
|
||||
try {
|
||||
Partial part(includedPaths, excludedPaths);
|
||||
parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications, 0);
|
||||
} catch (css::uno::Exception & e) { //TODO: more specific exception catching
|
||||
parseFileLeniently(
|
||||
&parseXcuFile, fileUri, Data::NO_LAYER, data_, &part, modifications,
|
||||
0);
|
||||
} catch (css::container::NoSuchElementException & e) {
|
||||
OSL_TRACE(
|
||||
"configmgr error inserting %s: %s",
|
||||
"configmgr error inserting non-existing %s: %s",
|
||||
rtl::OUStringToOString(fileUri, RTL_TEXTENCODING_UTF8).getStr(),
|
||||
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
|
||||
}
|
||||
@ -492,20 +572,32 @@ Components::Components(
|
||||
"com.sun.star.comp.deployment.configuration."
|
||||
"PackageRegistryBackend/configmgr.ini"))),
|
||||
true);
|
||||
try {
|
||||
parseModificationLayer();
|
||||
} catch (css::uno::Exception & e) { //TODO: more specific exception catching
|
||||
// Silently ignore unreadable parts of a corrupted user modification
|
||||
// layer, instead of completely preventing OOo from starting:
|
||||
OSL_TRACE(
|
||||
"configmgr error reading user modification layer: %s",
|
||||
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
|
||||
}
|
||||
parseModificationLayer();
|
||||
RTL_LOGFILE_TRACE_AUTHOR("configmgr", "sb", "end parsing");
|
||||
}
|
||||
|
||||
Components::~Components() {}
|
||||
|
||||
void Components::parseFileLeniently(
|
||||
FileParser * parseFile, rtl::OUString const & url, int layer, Data & data,
|
||||
Partial const * partial, Modifications * modifications,
|
||||
Additions * additions)
|
||||
{
|
||||
OSL_ASSERT(parseFile != 0);
|
||||
try {
|
||||
(*parseFile)(url, layer, data, partial, modifications, additions);
|
||||
} catch (css::container::NoSuchElementException &) {
|
||||
throw;
|
||||
} catch (css::uno::Exception & e) { //TODO: more specific exception catching
|
||||
// Silently ignore invalid XML files, instead of completely preventing
|
||||
// OOo from starting:
|
||||
OSL_TRACE(
|
||||
"configmgr error reading %s: %s",
|
||||
rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr(),
|
||||
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
|
||||
}
|
||||
}
|
||||
|
||||
void Components::parseFiles(
|
||||
int layer, rtl::OUString const & extension, FileParser * parseFile,
|
||||
rtl::OUString const & url, bool recursive)
|
||||
@ -557,7 +649,8 @@ void Components::parseFiles(
|
||||
file.match(extension, file.getLength() - extension.getLength()))
|
||||
{
|
||||
try {
|
||||
(*parseFile)(stat.getFileURL(), layer, data_, 0, 0, 0);
|
||||
parseFileLeniently(
|
||||
parseFile, stat.getFileURL(), layer, data_, 0, 0, 0);
|
||||
} catch (css::container::NoSuchElementException & e) {
|
||||
throw css::uno::RuntimeException(
|
||||
(rtl::OUString(
|
||||
@ -584,7 +677,7 @@ void Components::parseFileList(
|
||||
adds = data_.addExtensionXcuAdditions(url, layer);
|
||||
}
|
||||
try {
|
||||
(*parseFile)(url, layer, data_, 0, 0, adds);
|
||||
parseFileLeniently(parseFile, url, layer, data_, 0, 0, adds);
|
||||
} catch (css::container::NoSuchElementException & e) {
|
||||
OSL_TRACE(
|
||||
"configmgr file does not exist: %s",
|
||||
@ -746,13 +839,15 @@ rtl::OUString Components::getModificationFileUrl() const {
|
||||
|
||||
void Components::parseModificationLayer() {
|
||||
try {
|
||||
parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0, 0);
|
||||
parseFileLeniently(
|
||||
&parseXcuFile, getModificationFileUrl(), Data::NO_LAYER, data_, 0,
|
||||
0, 0);
|
||||
} catch (css::container::NoSuchElementException &) {
|
||||
OSL_TRACE(
|
||||
"configmgr user registrymodifications.xcu does not (yet) exist");
|
||||
// Migrate old user layer data (can be removed once migration is no
|
||||
// longer relevant, probably OOo 4; also see hack for xsi namespace in
|
||||
// XmlReader constructor):
|
||||
// xmlreader::XmlReader::registerNamespaceIri):
|
||||
parseFiles(
|
||||
Data::NO_LAYER, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".xcu")),
|
||||
&parseXcuFile,
|
||||
|
@ -65,12 +65,10 @@ class RootAccess;
|
||||
|
||||
class Components: private boost::noncopyable {
|
||||
public:
|
||||
static void initSingleton(
|
||||
static Components & getSingleton(
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
|
||||
const & context);
|
||||
|
||||
static Components & getSingleton();
|
||||
|
||||
static bool allLocales(rtl::OUString const & locale);
|
||||
|
||||
rtl::Reference< Node > resolvePathRepresentation(
|
||||
@ -94,6 +92,11 @@ public:
|
||||
|
||||
void writeModifications();
|
||||
|
||||
void flushModifications();
|
||||
// must be called with configmgr::lock unaquired; must be called before
|
||||
// shutdown if writeModifications has ever been called (probably
|
||||
// indirectly, via removeExtensionXcuFile)
|
||||
|
||||
void insertExtensionXcsFile(bool shared, rtl::OUString const & fileUri);
|
||||
|
||||
void insertExtensionXcuFile(
|
||||
@ -123,6 +126,11 @@ private:
|
||||
|
||||
~Components();
|
||||
|
||||
void parseFileLeniently(
|
||||
FileParser * parseFile, rtl::OUString const & url, int layer,
|
||||
Data & data, Partial const * partial, Modifications * modifications,
|
||||
Additions * additions);
|
||||
|
||||
void parseFiles(
|
||||
int layer, rtl::OUString const & extension, FileParser * parseFile,
|
||||
rtl::OUString const & url, bool recursive);
|
||||
@ -155,11 +163,14 @@ private:
|
||||
com::sun::star::beans::XPropertySet > >
|
||||
ExternalServices;
|
||||
|
||||
class WriteThread;
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
|
||||
context_;
|
||||
Data data_;
|
||||
WeakRootSet roots_;
|
||||
ExternalServices externalServices_;
|
||||
rtl::Reference< WriteThread > writeThread_;
|
||||
};
|
||||
|
||||
}
|
||||
|
45
configmgr/source/configmgr.component
Normal file
45
configmgr/source/configmgr.component
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--**********************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.configuration.ConfigurationProvider">
|
||||
<service name="com.sun.star.configuration.ConfigurationProvider"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.configuration.ConfigurationRegistry">
|
||||
<service name="com.sun.star.configuration.ConfigurationRegistry"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.configuration.DefaultProvider">
|
||||
<service name="com.sun.star.configuration.DefaultProvider"/>
|
||||
<singleton name="com.sun.star.configuration.theDefaultProvider"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.configuration.Update">
|
||||
<service name="com.sun.star.configuration.Update_Service"/>
|
||||
<singleton name="com.sun.star.configuration.Update"/>
|
||||
</implementation>
|
||||
</component>
|
@ -55,7 +55,7 @@
|
||||
#include "cppu/unotype.hxx"
|
||||
#include "cppuhelper/compbase5.hxx"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implbase1.hxx"
|
||||
#include "cppuhelper/implbase2.hxx"
|
||||
#include "cppuhelper/interfacecontainer.hxx"
|
||||
#include "cppuhelper/weak.hxx"
|
||||
#include "osl/diagnose.h"
|
||||
@ -114,6 +114,8 @@ public:
|
||||
private:
|
||||
virtual ~Service() {}
|
||||
|
||||
virtual void SAL_CALL disposing() { flushModifications(); }
|
||||
|
||||
virtual rtl::OUString SAL_CALL getImplementationName()
|
||||
throw (css::uno::RuntimeException)
|
||||
{ return configuration_provider::getImplementationName(); }
|
||||
@ -125,7 +127,6 @@ private:
|
||||
virtual css::uno::Sequence< rtl::OUString > SAL_CALL
|
||||
getSupportedServiceNames() throw (css::uno::RuntimeException)
|
||||
{ return configuration_provider::getSupportedServiceNames(); }
|
||||
//TODO: DefaultProvider?
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
|
||||
rtl::OUString const & aServiceSpecifier)
|
||||
@ -166,6 +167,8 @@ private:
|
||||
virtual css::lang::Locale SAL_CALL getLocale()
|
||||
throw (css::uno::RuntimeException);
|
||||
|
||||
void flushModifications() const;
|
||||
|
||||
css::uno::Reference< css::uno::XComponentContext > context_;
|
||||
rtl::OUString locale_;
|
||||
};
|
||||
@ -241,7 +244,7 @@ Service::createInstanceWithArguments(
|
||||
if (nodepath.getLength() == 0) {
|
||||
badNodePath();
|
||||
}
|
||||
// For backwards compatibility, allow a notepath that misses the leading
|
||||
// For backwards compatibility, allow a nodepath that misses the leading
|
||||
// slash:
|
||||
if (nodepath[0] != '/') {
|
||||
nodepath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + nodepath;
|
||||
@ -272,8 +275,7 @@ Service::createInstanceWithArguments(
|
||||
static_cast< cppu::OWeakObject * >(this));
|
||||
}
|
||||
osl::MutexGuard guard(lock);
|
||||
Components::initSingleton(context_);
|
||||
Components & components = Components::getSingleton();
|
||||
Components & components = Components::getSingleton(context_);
|
||||
rtl::Reference< RootAccess > root(
|
||||
new RootAccess(components, nodepath, locale, update));
|
||||
if (root->isValue()) {
|
||||
@ -326,7 +328,7 @@ void Service::removeRefreshListener(
|
||||
}
|
||||
|
||||
void Service::flush() throw (css::uno::RuntimeException) {
|
||||
//TODO
|
||||
flushModifications();
|
||||
cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer(
|
||||
cppu::UnoType< css::util::XFlushListener >::get());
|
||||
if (cont != 0) {
|
||||
@ -380,8 +382,18 @@ css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) {
|
||||
return loc;
|
||||
}
|
||||
|
||||
void Service::flushModifications() const {
|
||||
Components * components;
|
||||
{
|
||||
osl::MutexGuard guard(lock);
|
||||
components = &Components::getSingleton(context_);
|
||||
}
|
||||
components->flushModifications();
|
||||
}
|
||||
|
||||
class Factory:
|
||||
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
|
||||
public cppu::WeakImplHelper2<
|
||||
css::lang::XSingleComponentFactory, css::lang::XServiceInfo >,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -400,6 +412,18 @@ private:
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
|
||||
virtual rtl::OUString SAL_CALL getImplementationName()
|
||||
throw (css::uno::RuntimeException)
|
||||
{ return configuration_provider::getImplementationName(); }
|
||||
|
||||
virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
|
||||
throw (css::uno::RuntimeException)
|
||||
{ return ServiceName == getSupportedServiceNames()[0]; } //TODO
|
||||
|
||||
virtual css::uno::Sequence< rtl::OUString > SAL_CALL
|
||||
getSupportedServiceNames() throw (css::uno::RuntimeException)
|
||||
{ return configuration_provider::getSupportedServiceNames(); }
|
||||
};
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
|
||||
@ -456,7 +480,8 @@ Factory::createInstanceWithArgumentsAndContext(
|
||||
" arguments")),
|
||||
0);
|
||||
}
|
||||
// For backwards compatibility, allow "Locale" in any case:
|
||||
// For backwards compatibility, allow "Locale" and (ignored)
|
||||
// "EnableAsync" in any case:
|
||||
if (name.equalsIgnoreAsciiCaseAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM("locale")))
|
||||
{
|
||||
@ -471,8 +496,9 @@ Factory::createInstanceWithArgumentsAndContext(
|
||||
" one, non-empty, string Locale argument")),
|
||||
0);
|
||||
}
|
||||
} else {
|
||||
//TODO
|
||||
} else if (!name.equalsIgnoreAsciiCaseAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM("enableasync")))
|
||||
{
|
||||
throw css::uno::Exception(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
|
||||
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
||||
#include "com/sun/star/lang/XServiceInfo.hpp"
|
||||
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
|
||||
#include "com/sun/star/registry/InvalidRegistryException.hpp"
|
||||
#include "com/sun/star/registry/InvalidValueException.hpp"
|
||||
#include "com/sun/star/registry/MergeConflictException.hpp"
|
||||
@ -56,13 +55,11 @@
|
||||
#include "com/sun/star/uno/XInterface.hpp"
|
||||
#include "com/sun/star/util/XFlushable.hpp"
|
||||
#include "cppu/unotype.hxx"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implbase1.hxx"
|
||||
#include "cppuhelper/implbase3.hxx"
|
||||
#include "cppuhelper/weak.hxx"
|
||||
#include "osl/diagnose.h"
|
||||
#include "osl/mutex.hxx"
|
||||
#include "rtl/unload.h"
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "sal/types.h"
|
||||
@ -877,53 +874,12 @@ rtl::OUString RegistryKey::getResolvedName(rtl::OUString const & aKeyName)
|
||||
return aKeyName;
|
||||
}
|
||||
|
||||
class Factory:
|
||||
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
Factory() {}
|
||||
|
||||
private:
|
||||
virtual ~Factory() {}
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
createInstanceWithContext(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
};
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||
{
|
||||
return createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any >(), Context);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::uno::XInterface >
|
||||
Factory::createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||
css::uno::Reference< css::uno::XInterface > create(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & context)
|
||||
{
|
||||
if (Arguments.getLength() != 0) {
|
||||
throw css::uno::Exception(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.configuration.ConfigurationRegistry must be"
|
||||
" instantiated without arguments")),
|
||||
static_cast< cppu::OWeakObject * >(this));
|
||||
}
|
||||
return static_cast< cppu::OWeakObject * >(new Service(Context));
|
||||
}
|
||||
|
||||
return static_cast< cppu::OWeakObject * >(new Service(context));
|
||||
}
|
||||
|
||||
rtl::OUString getImplementationName() {
|
||||
@ -939,12 +895,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
|
||||
return css::uno::Sequence< rtl::OUString >(&name, 1);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::lang::XSingleComponentFactory > createFactory(
|
||||
cppu::ComponentFactoryFunc, rtl::OUString const &,
|
||||
css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
|
||||
SAL_THROW(())
|
||||
{
|
||||
return new Factory;
|
||||
}
|
||||
|
||||
} }
|
||||
|
@ -30,28 +30,28 @@
|
||||
|
||||
#include "com/sun/star/uno/Reference.hxx"
|
||||
#include "com/sun/star/uno/Sequence.hxx"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "rtl/unload.h"
|
||||
#include "sal/types.h"
|
||||
|
||||
namespace com { namespace sun { namespace star { namespace lang {
|
||||
class XSingleComponentFactory;
|
||||
} } } }
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace uno {
|
||||
class XComponentContext;
|
||||
class XInterface;
|
||||
}
|
||||
} } }
|
||||
namespace rtl { class OUString; }
|
||||
|
||||
namespace configmgr { namespace configuration_registry {
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
|
||||
create(
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
|
||||
const & context);
|
||||
|
||||
rtl::OUString SAL_CALL getImplementationName();
|
||||
|
||||
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
|
||||
getSupportedServiceNames();
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
|
||||
SAL_CALL createFactory(
|
||||
cppu::ComponentFactoryFunc, rtl::OUString const &,
|
||||
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
|
||||
SAL_THROW(());
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
@ -28,24 +28,16 @@
|
||||
#include "precompiled_configmgr.hxx"
|
||||
#include "sal/config.h"
|
||||
|
||||
#include "boost/noncopyable.hpp"
|
||||
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
|
||||
#include "com/sun/star/uno/Any.hxx"
|
||||
#include "com/sun/star/uno/Exception.hpp"
|
||||
#include "com/sun/star/uno/Reference.hxx"
|
||||
#include "com/sun/star/uno/RuntimeException.hpp"
|
||||
#include "com/sun/star/uno/Sequence.hxx"
|
||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||
#include "com/sun/star/uno/XInterface.hpp"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implbase1.hxx"
|
||||
#include "cppuhelper/weak.hxx"
|
||||
#include "sal/types.h"
|
||||
#include "rtl/unload.h"
|
||||
#include "osl/mutex.hxx"
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
|
||||
#include "configurationprovider.hxx"
|
||||
#include "defaultprovider.hxx"
|
||||
#include "lock.hxx"
|
||||
|
||||
namespace configmgr { namespace default_provider {
|
||||
@ -54,58 +46,17 @@ namespace {
|
||||
|
||||
namespace css = com::sun::star;
|
||||
|
||||
class Factory:
|
||||
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
Factory() {}
|
||||
|
||||
private:
|
||||
virtual ~Factory() {}
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
createInstanceWithContext(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
};
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||
{
|
||||
return createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any >(), Context);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::uno::XInterface >
|
||||
Factory::createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||
css::uno::Reference< css::uno::XInterface > create(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & context)
|
||||
{
|
||||
if (Arguments.getLength() != 0) {
|
||||
throw css::uno::Exception(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.configuration.DefaultProvider must be"
|
||||
" instantiated without arguments")),
|
||||
static_cast< cppu::OWeakObject * >(this));
|
||||
}
|
||||
osl::MutexGuard guard(lock);
|
||||
static css::uno::Reference< css::uno::XInterface > singleton(
|
||||
configuration_provider::createDefault(Context));
|
||||
configuration_provider::createDefault(context));
|
||||
return singleton;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rtl::OUString getImplementationName() {
|
||||
return rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
@ -119,13 +70,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
|
||||
return css::uno::Sequence< rtl::OUString >(&name, 1);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::lang::XSingleComponentFactory >
|
||||
SAL_CALL createFactory(
|
||||
cppu::ComponentFactoryFunc, rtl::OUString const &,
|
||||
css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
|
||||
SAL_THROW(())
|
||||
{
|
||||
return new Factory;
|
||||
}
|
||||
|
||||
} }
|
||||
|
@ -32,28 +32,28 @@
|
||||
|
||||
#include "com/sun/star/uno/Reference.hxx"
|
||||
#include "com/sun/star/uno/Sequence.hxx"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "rtl/unload.h"
|
||||
#include "sal/types.h"
|
||||
|
||||
namespace com { namespace sun { namespace star { namespace lang {
|
||||
class XSingleComponentFactory;
|
||||
} } } }
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace uno {
|
||||
class XComponentContext;
|
||||
class XInterface;
|
||||
}
|
||||
} } }
|
||||
namespace rtl { class OUString; }
|
||||
|
||||
namespace configmgr { namespace default_provider {
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
|
||||
create(
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
|
||||
const & context);
|
||||
|
||||
rtl::OUString SAL_CALL getImplementationName();
|
||||
|
||||
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
|
||||
getSupportedServiceNames();
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
|
||||
SAL_CALL createFactory(
|
||||
cppu::ComponentFactoryFunc, rtl::OUString const &,
|
||||
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
|
||||
SAL_THROW(());
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,6 @@ SLOFILES = \
|
||||
$(SLO)/modifications.obj \
|
||||
$(SLO)/node.obj \
|
||||
$(SLO)/nodemap.obj \
|
||||
$(SLO)/pad.obj \
|
||||
$(SLO)/parsemanager.obj \
|
||||
$(SLO)/partial.obj \
|
||||
$(SLO)/propertynode.obj \
|
||||
@ -66,8 +65,7 @@ SLOFILES = \
|
||||
$(SLO)/xcdparser.obj \
|
||||
$(SLO)/xcsparser.obj \
|
||||
$(SLO)/xcuparser.obj \
|
||||
$(SLO)/xmldata.obj \
|
||||
$(SLO)/xmlreader.obj
|
||||
$(SLO)/xmldata.obj
|
||||
|
||||
SHL1IMPLIB = i$(SHL1TARGET)
|
||||
SHL1OBJS = $(SLOFILES)
|
||||
@ -76,9 +74,18 @@ SHL1STDLIBS = \
|
||||
$(CPPUHELPERLIB) \
|
||||
$(CPPULIB) \
|
||||
$(SALHELPERLIB) \
|
||||
$(SALLIB)
|
||||
$(SALLIB) \
|
||||
$(XMLREADERLIB)
|
||||
SHL1TARGET = configmgr.uno
|
||||
SHL1USE_EXPORTS = name
|
||||
DEF1NAME = $(SHL1TARGET)
|
||||
|
||||
.INCLUDE: target.mk
|
||||
|
||||
ALLTAR : $(MISC)/configmgr.component
|
||||
|
||||
$(MISC)/configmgr.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
|
||||
configmgr.component
|
||||
$(XSLTPROC) --nonet --stringparam uri \
|
||||
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
|
||||
$(SOLARENV)/bin/createcomponent.xslt configmgr.component
|
||||
|
@ -101,8 +101,4 @@ Node::~Node() {}
|
||||
|
||||
void Node::clear() {}
|
||||
|
||||
rtl::Reference< Node > Node::findMember(rtl::OUString const &) {
|
||||
return rtl::Reference< Node >();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,11 +31,12 @@
|
||||
#include "sal/config.h"
|
||||
|
||||
#include "rtl/ref.hxx"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "salhelper/simplereferenceobject.hxx"
|
||||
|
||||
#include "nodemap.hxx"
|
||||
|
||||
namespace rtl { class OUString; }
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
class Node: public salhelper::SimpleReferenceObject {
|
||||
@ -75,8 +76,6 @@ protected:
|
||||
|
||||
virtual void clear();
|
||||
|
||||
virtual rtl::Reference< Node > findMember(rtl::OUString const & name);
|
||||
|
||||
int layer_;
|
||||
int finalized_;
|
||||
};
|
||||
|
@ -1,91 +0,0 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "precompiled_configmgr.hxx"
|
||||
#include "sal/config.h"
|
||||
|
||||
#include "osl/diagnose.h"
|
||||
#include "rtl/string.h"
|
||||
#include "sal/types.h"
|
||||
|
||||
#include "pad.hxx"
|
||||
#include "span.hxx"
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
void Pad::add(char const * begin, sal_Int32 length) {
|
||||
OSL_ASSERT(
|
||||
begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
|
||||
if (length != 0) {
|
||||
flushSpan();
|
||||
if (buffer_.getLength() == 0) {
|
||||
span_ = Span(begin, length);
|
||||
} else {
|
||||
buffer_.append(begin, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pad::addEphemeral(char const * begin, sal_Int32 length) {
|
||||
OSL_ASSERT(
|
||||
begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
|
||||
if (length != 0) {
|
||||
flushSpan();
|
||||
buffer_.append(begin, length);
|
||||
}
|
||||
}
|
||||
|
||||
void Pad::clear() {
|
||||
OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
|
||||
span_.clear();
|
||||
buffer_.setLength(0);
|
||||
}
|
||||
|
||||
bool Pad::is() const {
|
||||
OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
|
||||
return span_.is() || buffer_.getLength() != 0;
|
||||
}
|
||||
|
||||
Span Pad::get() const {
|
||||
OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
|
||||
if (span_.is()) {
|
||||
return span_;
|
||||
} else if (buffer_.getLength() == 0) {
|
||||
return Span(RTL_CONSTASCII_STRINGPARAM(""));
|
||||
} else {
|
||||
return Span(buffer_.getStr(), buffer_.getLength());
|
||||
}
|
||||
}
|
||||
|
||||
void Pad::flushSpan() {
|
||||
if (span_.is()) {
|
||||
buffer_.append(span_.begin, span_.length);
|
||||
span_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -32,10 +32,11 @@
|
||||
#include "com/sun/star/uno/RuntimeException.hpp"
|
||||
#include "osl/diagnose.h"
|
||||
#include "sal/types.h"
|
||||
#include "xmlreader/span.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "parsemanager.hxx"
|
||||
#include "parser.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
@ -52,28 +53,42 @@ ParseManager::ParseManager(
|
||||
reader_(url), parser_(parser)
|
||||
{
|
||||
OSL_ASSERT(parser.is());
|
||||
int id;
|
||||
id = reader_.registerNamespaceIri(
|
||||
xmlreader::Span(
|
||||
RTL_CONSTASCII_STRINGPARAM("http://openoffice.org/2001/registry")));
|
||||
OSL_ASSERT(id == NAMESPACE_OOR);
|
||||
id = reader_.registerNamespaceIri(
|
||||
xmlreader::Span(
|
||||
RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/2001/XMLSchema")));
|
||||
OSL_ASSERT(id == NAMESPACE_XS);
|
||||
id = reader_.registerNamespaceIri(
|
||||
xmlreader::Span(
|
||||
RTL_CONSTASCII_STRINGPARAM(
|
||||
"http://www.w3.org/2001/XMLSchema-instance")));
|
||||
OSL_ASSERT(id == NAMESPACE_XSI);
|
||||
}
|
||||
|
||||
bool ParseManager::parse() {
|
||||
for (;;) {
|
||||
switch (itemData_.is()
|
||||
? XmlReader::RESULT_BEGIN
|
||||
? xmlreader::XmlReader::RESULT_BEGIN
|
||||
: reader_.nextItem(
|
||||
parser_->getTextMode(), &itemData_, &itemNamespace_))
|
||||
parser_->getTextMode(), &itemData_, &itemNamespaceId_))
|
||||
{
|
||||
case XmlReader::RESULT_BEGIN:
|
||||
if (!parser_->startElement(reader_, itemNamespace_, itemData_))
|
||||
case xmlreader::XmlReader::RESULT_BEGIN:
|
||||
if (!parser_->startElement(reader_, itemNamespaceId_, itemData_))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case XmlReader::RESULT_END:
|
||||
case xmlreader::XmlReader::RESULT_END:
|
||||
parser_->endElement(reader_);
|
||||
break;
|
||||
case XmlReader::RESULT_TEXT:
|
||||
case xmlreader::XmlReader::RESULT_TEXT:
|
||||
parser_->characters(itemData_);
|
||||
break;
|
||||
case XmlReader::RESULT_DONE:
|
||||
case xmlreader::XmlReader::RESULT_DONE:
|
||||
return true;
|
||||
}
|
||||
itemData_.clear();
|
||||
|
@ -35,9 +35,8 @@
|
||||
#include "rtl/ref.hxx"
|
||||
#include "sal/types.h"
|
||||
#include "salhelper/simplereferenceobject.hxx"
|
||||
|
||||
#include "span.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
#include "xmlreader/span.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
namespace rtl { class OUString; }
|
||||
|
||||
@ -55,13 +54,15 @@ public:
|
||||
|
||||
bool parse();
|
||||
|
||||
enum { NAMESPACE_OOR = 1, NAMESPACE_XS = 2, NAMESPACE_XSI = 3 };
|
||||
|
||||
private:
|
||||
virtual ~ParseManager();
|
||||
|
||||
XmlReader reader_;
|
||||
xmlreader::XmlReader reader_;
|
||||
rtl::Reference< Parser > parser_;
|
||||
Span itemData_;
|
||||
XmlReader::Namespace itemNamespace_;
|
||||
xmlreader::Span itemData_;
|
||||
int itemNamespaceId_;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -33,23 +33,23 @@
|
||||
#include <memory>
|
||||
|
||||
#include "salhelper/simplereferenceobject.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "xmlreader.hxx"
|
||||
namespace xmlreader { struct Span; }
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
struct Span;
|
||||
|
||||
class Parser: public salhelper::SimpleReferenceObject {
|
||||
public:
|
||||
virtual XmlReader::Text getTextMode() = 0;
|
||||
virtual xmlreader::XmlReader::Text getTextMode() = 0;
|
||||
|
||||
virtual bool startElement(
|
||||
XmlReader & reader, XmlReader::Namespace ns, Span const & name) = 0;
|
||||
xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name)
|
||||
= 0;
|
||||
|
||||
virtual void endElement(XmlReader const & reader) = 0;
|
||||
virtual void endElement(xmlreader::XmlReader const & reader) = 0;
|
||||
|
||||
virtual void characters(Span const & text) = 0;
|
||||
virtual void characters(xmlreader::Span const & text) = 0;
|
||||
|
||||
protected:
|
||||
Parser() {}
|
||||
|
@ -28,17 +28,14 @@
|
||||
#include "precompiled_configmgr.hxx"
|
||||
#include "sal/config.h"
|
||||
|
||||
#include "com/sun/star/registry/XRegistryKey.hpp"
|
||||
#include "com/sun/star/uno/Exception.hpp"
|
||||
#include "com/sun/star/uno/Reference.hxx"
|
||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||
#include "com/sun/star/uno/XInterface.hpp"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implementationentry.hxx"
|
||||
#include "osl/diagnose.h"
|
||||
#include "uno/lbnames.h"
|
||||
#include "rtl/textenc.h"
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "sal/types.h"
|
||||
|
||||
#include "configurationprovider.hxx"
|
||||
@ -62,15 +59,17 @@ static cppu::ImplementationEntry const services[] = {
|
||||
{ &dummy, &configmgr::configuration_provider::getImplementationName,
|
||||
&configmgr::configuration_provider::getSupportedServiceNames,
|
||||
&configmgr::configuration_provider::createFactory, 0, 0 },
|
||||
{ &dummy, &configmgr::default_provider::getImplementationName,
|
||||
{ &configmgr::default_provider::create,
|
||||
&configmgr::default_provider::getImplementationName,
|
||||
&configmgr::default_provider::getSupportedServiceNames,
|
||||
&configmgr::default_provider::createFactory, 0, 0 },
|
||||
{ &dummy, &configmgr::configuration_registry::getImplementationName,
|
||||
&cppu::createSingleComponentFactory, 0, 0 },
|
||||
{ &configmgr::configuration_registry::create,
|
||||
&configmgr::configuration_registry::getImplementationName,
|
||||
&configmgr::configuration_registry::getSupportedServiceNames,
|
||||
&configmgr::configuration_registry::createFactory, 0, 0 },
|
||||
{ &dummy, &configmgr::update::getImplementationName,
|
||||
&cppu::createSingleComponentFactory, 0, 0 },
|
||||
{ &configmgr::update::create, &configmgr::update::getImplementationName,
|
||||
&configmgr::update::getSupportedServiceNames,
|
||||
&configmgr::update::createFactory, 0, 0 },
|
||||
&cppu::createSingleComponentFactory, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@ -89,47 +88,3 @@ component_getImplementationEnvironment(
|
||||
{
|
||||
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
|
||||
void * pServiceManager, void * pRegistryKey)
|
||||
{
|
||||
if (!component_writeInfoHelper(pServiceManager, pRegistryKey, services)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
css::uno::Reference< css::registry::XRegistryKey >(
|
||||
(css::uno::Reference< css::registry::XRegistryKey >(
|
||||
static_cast< css::registry::XRegistryKey * >(pRegistryKey))->
|
||||
createKey(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"/com.sun.star.comp.configuration.DefaultProvider/UNO/"
|
||||
"SINGLETONS/"
|
||||
"com.sun.star.configuration.theDefaultProvider")))),
|
||||
css::uno::UNO_SET_THROW)->
|
||||
setStringValue(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.configuration.DefaultProvider")));
|
||||
css::uno::Reference< css::registry::XRegistryKey >(
|
||||
(css::uno::Reference< css::registry::XRegistryKey >(
|
||||
static_cast< css::registry::XRegistryKey * >(pRegistryKey))->
|
||||
createKey(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"/com.sun.star.comp.configuration.Update/UNO/"
|
||||
"SINGLETONS/com.sun.star.configuration.Update")))),
|
||||
css::uno::UNO_SET_THROW)->
|
||||
setStringValue(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.configuration.Update_Service")));
|
||||
} catch (css::uno::Exception & e) {
|
||||
(void) e;
|
||||
OSL_TRACE(
|
||||
"configmgr component_writeInfo exception: %s",
|
||||
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -32,20 +32,15 @@
|
||||
|
||||
#include "boost/noncopyable.hpp"
|
||||
#include "com/sun/star/configuration/XUpdate.hpp"
|
||||
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
|
||||
#include "com/sun/star/uno/Any.hxx"
|
||||
#include "com/sun/star/uno/Exception.hpp"
|
||||
#include "com/sun/star/uno/Reference.hxx"
|
||||
#include "com/sun/star/uno/RuntimeException.hpp"
|
||||
#include "com/sun/star/uno/Sequence.hxx"
|
||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||
#include "com/sun/star/uno/XInterface.hpp"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implbase1.hxx"
|
||||
#include "cppuhelper/weak.hxx"
|
||||
#include "osl/mutex.hxx"
|
||||
#include "rtl/ref.hxx"
|
||||
#include "rtl/unload.h"
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "sal/types.h"
|
||||
@ -76,7 +71,11 @@ class Service:
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
Service() {}
|
||||
Service(css::uno::Reference< css::uno::XComponentContext > const context):
|
||||
context_(context)
|
||||
{
|
||||
OSL_ASSERT(context.is());
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~Service() {}
|
||||
@ -97,6 +96,8 @@ private:
|
||||
css::uno::Sequence< rtl::OUString > const & includedPaths,
|
||||
css::uno::Sequence< rtl::OUString > const & excludedPaths)
|
||||
throw (css::uno::RuntimeException);
|
||||
|
||||
css::uno::Reference< css::uno::XComponentContext > context_;
|
||||
};
|
||||
|
||||
void Service::insertExtensionXcsFile(
|
||||
@ -104,7 +105,7 @@ void Service::insertExtensionXcsFile(
|
||||
throw (css::uno::RuntimeException)
|
||||
{
|
||||
osl::MutexGuard g(lock);
|
||||
Components::getSingleton().insertExtensionXcsFile(shared, fileUri);
|
||||
Components::getSingleton(context_).insertExtensionXcsFile(shared, fileUri);
|
||||
}
|
||||
|
||||
void Service::insertExtensionXcuFile(
|
||||
@ -114,10 +115,10 @@ void Service::insertExtensionXcuFile(
|
||||
Broadcaster bc;
|
||||
{
|
||||
osl::MutexGuard g(lock);
|
||||
Components & components = Components::getSingleton(context_);
|
||||
Modifications mods;
|
||||
Components::getSingleton().insertExtensionXcuFile(
|
||||
shared, fileUri, &mods);
|
||||
Components::getSingleton().initGlobalBroadcaster(
|
||||
components.insertExtensionXcuFile(shared, fileUri, &mods);
|
||||
components.initGlobalBroadcaster(
|
||||
mods, rtl::Reference< RootAccess >(), &bc);
|
||||
}
|
||||
bc.send();
|
||||
@ -129,9 +130,10 @@ void Service::removeExtensionXcuFile(rtl::OUString const & fileUri)
|
||||
Broadcaster bc;
|
||||
{
|
||||
osl::MutexGuard g(lock);
|
||||
Components & components = Components::getSingleton(context_);
|
||||
Modifications mods;
|
||||
Components::getSingleton().removeExtensionXcuFile(fileUri, &mods);
|
||||
Components::getSingleton().initGlobalBroadcaster(
|
||||
components.removeExtensionXcuFile(fileUri, &mods);
|
||||
components.initGlobalBroadcaster(
|
||||
mods, rtl::Reference< RootAccess >(), &bc);
|
||||
}
|
||||
bc.send();
|
||||
@ -146,62 +148,22 @@ void Service::insertModificationXcuFile(
|
||||
Broadcaster bc;
|
||||
{
|
||||
osl::MutexGuard g(lock);
|
||||
Components & components = Components::getSingleton(context_);
|
||||
Modifications mods;
|
||||
Components::getSingleton().insertModificationXcuFile(
|
||||
components.insertModificationXcuFile(
|
||||
fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods);
|
||||
Components::getSingleton().initGlobalBroadcaster(
|
||||
components.initGlobalBroadcaster(
|
||||
mods, rtl::Reference< RootAccess >(), &bc);
|
||||
}
|
||||
bc.send();
|
||||
}
|
||||
|
||||
class Factory:
|
||||
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
Factory() {}
|
||||
|
||||
private:
|
||||
virtual ~Factory() {}
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
createInstanceWithContext(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
|
||||
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException);
|
||||
};
|
||||
|
||||
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & Context)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||
{
|
||||
return createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any >(), Context);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::uno::XInterface >
|
||||
Factory::createInstanceWithArgumentsAndContext(
|
||||
css::uno::Sequence< css::uno::Any > const & Arguments,
|
||||
css::uno::Reference< css::uno::XComponentContext > const &)
|
||||
throw (css::uno::Exception, css::uno::RuntimeException)
|
||||
css::uno::Reference< css::uno::XInterface > create(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & context)
|
||||
{
|
||||
if (Arguments.getLength() != 0) {
|
||||
throw css::uno::Exception(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"com.sun.star.comp.configuration.Update must be"
|
||||
" instantiated without arguments")),
|
||||
static_cast< cppu::OWeakObject * >(this));
|
||||
}
|
||||
return static_cast< cppu::OWeakObject * >(new Service);
|
||||
}
|
||||
|
||||
return static_cast< cppu::OWeakObject * >(new Service(context));
|
||||
}
|
||||
|
||||
rtl::OUString getImplementationName() {
|
||||
@ -216,12 +178,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
|
||||
return css::uno::Sequence< rtl::OUString >(&name, 1);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::lang::XSingleComponentFactory > createFactory(
|
||||
cppu::ComponentFactoryFunc, rtl::OUString const &,
|
||||
css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
|
||||
SAL_THROW(())
|
||||
{
|
||||
return new Factory;
|
||||
}
|
||||
|
||||
} }
|
||||
|
@ -32,28 +32,28 @@
|
||||
|
||||
#include "com/sun/star/uno/Reference.hxx"
|
||||
#include "com/sun/star/uno/Sequence.hxx"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "rtl/unload.h"
|
||||
#include "sal/types.h"
|
||||
|
||||
namespace com { namespace sun { namespace star { namespace lang {
|
||||
class XSingleComponentFactory;
|
||||
} } } }
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace uno {
|
||||
class XComponentContext;
|
||||
class XInterface;
|
||||
}
|
||||
} } }
|
||||
namespace rtl { class OUString; }
|
||||
|
||||
namespace configmgr { namespace update {
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
|
||||
create(
|
||||
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
|
||||
const &);
|
||||
|
||||
rtl::OUString SAL_CALL getImplementationName();
|
||||
|
||||
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
|
||||
getSupportedServiceNames();
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
|
||||
SAL_CALL createFactory(
|
||||
cppu::ComponentFactoryFunc, rtl::OUString const &,
|
||||
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
|
||||
SAL_THROW(());
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
@ -40,16 +40,17 @@
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "sal/types.h"
|
||||
#include "xmlreader/span.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "localizedvaluenode.hxx"
|
||||
#include "node.hxx"
|
||||
#include "nodemap.hxx"
|
||||
#include "parsemanager.hxx"
|
||||
#include "propertynode.hxx"
|
||||
#include "span.hxx"
|
||||
#include "type.hxx"
|
||||
#include "valueparser.hxx"
|
||||
#include "xmldata.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
@ -74,7 +75,7 @@ bool parseHexDigit(char c, int * value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, sal_Bool * value) {
|
||||
bool parseValue(xmlreader::Span const & text, sal_Bool * value) {
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
if (text.equals(RTL_CONSTASCII_STRINGPARAM("true")) ||
|
||||
text.equals(RTL_CONSTASCII_STRINGPARAM("1")))
|
||||
@ -91,7 +92,7 @@ bool parseValue(Span const & text, sal_Bool * value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, sal_Int16 * value) {
|
||||
bool parseValue(xmlreader::Span const & text, sal_Int16 * value) {
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
// For backwards compatibility, support hexadecimal values:
|
||||
sal_Int32 n =
|
||||
@ -110,7 +111,7 @@ bool parseValue(Span const & text, sal_Int16 * value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, sal_Int32 * value) {
|
||||
bool parseValue(xmlreader::Span const & text, sal_Int32 * value) {
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
// For backwards compatibility, support hexadecimal values:
|
||||
*value =
|
||||
@ -125,7 +126,7 @@ bool parseValue(Span const & text, sal_Int32 * value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, sal_Int64 * value) {
|
||||
bool parseValue(xmlreader::Span const & text, sal_Int64 * value) {
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
// For backwards compatibility, support hexadecimal values:
|
||||
*value =
|
||||
@ -140,20 +141,22 @@ bool parseValue(Span const & text, sal_Int64 * value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, double * value) {
|
||||
bool parseValue(xmlreader::Span const & text, double * value) {
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
*value = rtl::OString(text.begin, text.length).toDouble();
|
||||
//TODO: check valid lexical representation
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, rtl::OUString * value) {
|
||||
bool parseValue(xmlreader::Span const & text, rtl::OUString * value) {
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
*value = xmldata::convertFromUtf8(text);
|
||||
*value = text.convertFromUtf8();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseValue(Span const & text, css::uno::Sequence< sal_Int8 > * value) {
|
||||
bool parseValue(
|
||||
xmlreader::Span const & text, css::uno::Sequence< sal_Int8 > * value)
|
||||
{
|
||||
OSL_ASSERT(text.is() && value != 0);
|
||||
if ((text.length & 1) != 0) {
|
||||
return false;
|
||||
@ -173,7 +176,9 @@ bool parseValue(Span const & text, css::uno::Sequence< sal_Int8 > * value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template< typename T > css::uno::Any parseSingleValue(Span const & text) {
|
||||
template< typename T > css::uno::Any parseSingleValue(
|
||||
xmlreader::Span const & text)
|
||||
{
|
||||
T val;
|
||||
if (!parseValue(text, &val)) {
|
||||
throw css::uno::RuntimeException(
|
||||
@ -184,21 +189,23 @@ template< typename T > css::uno::Any parseSingleValue(Span const & text) {
|
||||
}
|
||||
|
||||
template< typename T > css::uno::Any parseListValue(
|
||||
rtl::OString const & separator, Span const & text)
|
||||
rtl::OString const & separator, xmlreader::Span const & text)
|
||||
{
|
||||
comphelper::SequenceAsVector< T > seq;
|
||||
Span sep;
|
||||
xmlreader::Span sep;
|
||||
if (separator.getLength() == 0) {
|
||||
sep = Span(RTL_CONSTASCII_STRINGPARAM(" "));
|
||||
sep = xmlreader::Span(RTL_CONSTASCII_STRINGPARAM(" "));
|
||||
} else {
|
||||
sep = Span(separator.getStr(), separator.getLength());
|
||||
sep = xmlreader::Span(separator.getStr(), separator.getLength());
|
||||
}
|
||||
if (text.length != 0) {
|
||||
for (Span t(text);;) {
|
||||
for (xmlreader::Span t(text);;) {
|
||||
sal_Int32 i = rtl_str_indexOfStr_WithLength(
|
||||
t.begin, t.length, sep.begin, sep.length);
|
||||
T val;
|
||||
if (!parseValue(Span(t.begin, i == -1 ? t.length : i), &val)) {
|
||||
if (!parseValue(
|
||||
xmlreader::Span(t.begin, i == -1 ? t.length : i), &val))
|
||||
{
|
||||
throw css::uno::RuntimeException(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("invalid value")),
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
@ -215,7 +222,7 @@ template< typename T > css::uno::Any parseListValue(
|
||||
}
|
||||
|
||||
css::uno::Any parseValue(
|
||||
rtl::OString const & separator, Span const & text, Type type)
|
||||
rtl::OString const & separator, xmlreader::Span const & text, Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case TYPE_ANY:
|
||||
@ -266,7 +273,7 @@ ValueParser::ValueParser(int layer): layer_(layer) {}
|
||||
|
||||
ValueParser::~ValueParser() {}
|
||||
|
||||
XmlReader::Text ValueParser::getTextMode() const {
|
||||
xmlreader::XmlReader::Text ValueParser::getTextMode() const {
|
||||
if (node_.is()) {
|
||||
switch (state_) {
|
||||
case STATE_TEXT:
|
||||
@ -278,23 +285,24 @@ XmlReader::Text ValueParser::getTextMode() const {
|
||||
return
|
||||
(type_ == TYPE_STRING || type_ == TYPE_STRING_LIST ||
|
||||
separator_.getLength() != 0)
|
||||
? XmlReader::TEXT_RAW : XmlReader::TEXT_NORMALIZED;
|
||||
? xmlreader::XmlReader::TEXT_RAW
|
||||
: xmlreader::XmlReader::TEXT_NORMALIZED;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return XmlReader::TEXT_NONE;
|
||||
return xmlreader::XmlReader::TEXT_NONE;
|
||||
}
|
||||
|
||||
bool ValueParser::startElement(
|
||||
XmlReader & reader, XmlReader::Namespace ns, Span const & name)
|
||||
xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name)
|
||||
{
|
||||
if (!node_.is()) {
|
||||
return false;
|
||||
}
|
||||
switch (state_) {
|
||||
case STATE_TEXT:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("it")) &&
|
||||
isListType(type_) && separator_.getLength() == 0)
|
||||
{
|
||||
@ -306,18 +314,18 @@ bool ValueParser::startElement(
|
||||
}
|
||||
// fall through
|
||||
case STATE_IT:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("unicode")) &&
|
||||
(type_ == TYPE_STRING || type_ == TYPE_STRING_LIST))
|
||||
{
|
||||
sal_Int32 scalar = -1;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("scalar")))
|
||||
{
|
||||
if (!parseValue(reader.getAttributeValue(true), &scalar)) {
|
||||
@ -352,7 +360,7 @@ bool ValueParser::startElement(
|
||||
}
|
||||
throw css::uno::RuntimeException(
|
||||
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) +
|
||||
xmldata::convertFromUtf8(name) +
|
||||
name.convertFromUtf8() +
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()),
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
@ -439,7 +447,7 @@ bool ValueParser::endElement() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ValueParser::characters(Span const & text) {
|
||||
void ValueParser::characters(xmlreader::Span const & text) {
|
||||
if (node_.is()) {
|
||||
OSL_ASSERT(state_ == STATE_TEXT || state_ == STATE_IT);
|
||||
pad_.add(text.begin, text.length);
|
||||
|
@ -36,19 +36,19 @@
|
||||
#include "rtl/ref.hxx"
|
||||
#include "rtl/string.hxx"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "xmlreader/pad.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "pad.hxx"
|
||||
#include "type.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
|
||||
namespace com { namespace sun { namespace star { namespace uno {
|
||||
class Any;
|
||||
} } } }
|
||||
namespace xmlreader { struct Span; }
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
class Node;
|
||||
struct Span;
|
||||
|
||||
class ValueParser: private boost::noncopyable {
|
||||
public:
|
||||
@ -56,14 +56,14 @@ public:
|
||||
|
||||
~ValueParser();
|
||||
|
||||
XmlReader::Text getTextMode() const;
|
||||
xmlreader::XmlReader::Text getTextMode() const;
|
||||
|
||||
bool startElement(
|
||||
XmlReader & reader, XmlReader::Namespace ns, Span const & name);
|
||||
xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name);
|
||||
|
||||
bool endElement();
|
||||
|
||||
void characters(Span const & text);
|
||||
void characters(xmlreader::Span const & text);
|
||||
|
||||
void start(
|
||||
rtl::Reference< Node > const & property,
|
||||
@ -83,7 +83,7 @@ private:
|
||||
rtl::Reference< Node > node_;
|
||||
rtl::OUString localizedName_;
|
||||
State state_;
|
||||
Pad pad_;
|
||||
xmlreader::Pad pad_;
|
||||
std::vector< com::sun::star::uno::Any > items_;
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "sal/types.h"
|
||||
#include "xmlreader/span.hxx"
|
||||
|
||||
#include "data.hxx"
|
||||
#include "groupnode.hxx"
|
||||
@ -54,7 +55,6 @@
|
||||
#include "node.hxx"
|
||||
#include "nodemap.hxx"
|
||||
#include "propertynode.hxx"
|
||||
#include "span.hxx"
|
||||
#include "type.hxx"
|
||||
#include "writemodfile.hxx"
|
||||
|
||||
@ -341,22 +341,23 @@ void writeNode(
|
||||
rtl::Reference< Node > const & parent, rtl::OUString const & name,
|
||||
rtl::Reference< Node > const & node)
|
||||
{
|
||||
static Span const typeNames[] = {
|
||||
Span(), Span(), Span(), // TYPE_ERROR, TYPE_NIL, TYPE_ANY
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:boolean")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:short")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:int")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:long")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:double")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:string")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("xs:hexBinary")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:boolean-list")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:short-list")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:int-list")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:long-list")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:double-list")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:string-list")),
|
||||
Span(RTL_CONSTASCII_STRINGPARAM("oor:hexBinary-list")) };
|
||||
static xmlreader::Span const typeNames[] = {
|
||||
xmlreader::Span(), xmlreader::Span(), xmlreader::Span(),
|
||||
// TYPE_ERROR, TYPE_NIL, TYPE_ANY
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:boolean")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:short")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:int")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:long")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:double")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:string")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:hexBinary")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:boolean-list")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:short-list")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:int-list")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:long-list")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:double-list")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:string-list")),
|
||||
xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:hexBinary-list")) };
|
||||
switch (node->kind()) {
|
||||
case Node::KIND_PROPERTY:
|
||||
{
|
||||
|
@ -37,13 +37,14 @@
|
||||
#include "rtl/string.h"
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "xmlreader/span.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "span.hxx"
|
||||
#include "parsemanager.hxx"
|
||||
#include "xcdparser.hxx"
|
||||
#include "xcsparser.hxx"
|
||||
#include "xcuparser.hxx"
|
||||
#include "xmldata.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
@ -59,22 +60,22 @@ XcdParser::XcdParser(int layer, Dependencies const & dependencies, Data & data):
|
||||
|
||||
XcdParser::~XcdParser() {}
|
||||
|
||||
XmlReader::Text XcdParser::getTextMode() {
|
||||
xmlreader::XmlReader::Text XcdParser::getTextMode() {
|
||||
return nestedParser_.is()
|
||||
? nestedParser_->getTextMode() : XmlReader::TEXT_NONE;
|
||||
? nestedParser_->getTextMode() : xmlreader::XmlReader::TEXT_NONE;
|
||||
}
|
||||
|
||||
bool XcdParser::startElement(
|
||||
XmlReader & reader, XmlReader::Namespace ns, Span const & name)
|
||||
xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name)
|
||||
{
|
||||
if (nestedParser_.is()) {
|
||||
OSL_ASSERT(nesting_ != LONG_MAX);
|
||||
++nesting_;
|
||||
return nestedParser_->startElement(reader, ns, name);
|
||||
return nestedParser_->startElement(reader, nsId, name);
|
||||
}
|
||||
switch (state_) {
|
||||
case STATE_START:
|
||||
if (ns == XmlReader::NAMESPACE_OOR &&
|
||||
if (nsId == ParseManager::NAMESPACE_OOR &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("data")))
|
||||
{
|
||||
state_ = STATE_DEPENDENCIES;
|
||||
@ -82,18 +83,19 @@ bool XcdParser::startElement(
|
||||
}
|
||||
break;
|
||||
case STATE_DEPENDENCIES:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("dependency")))
|
||||
{
|
||||
if (dependency_.getLength() == 0) {
|
||||
Span attrFile;
|
||||
xmlreader::Span attrFile;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_NONE && //TODO: _OOR
|
||||
if (attrNsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
//TODO: _OOR
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("file")))
|
||||
{
|
||||
attrFile = reader.getAttributeValue(false);
|
||||
@ -107,7 +109,7 @@ bool XcdParser::startElement(
|
||||
reader.getUrl()),
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
dependency_ = xmldata::convertFromUtf8(attrFile);
|
||||
dependency_ = attrFile.convertFromUtf8();
|
||||
if (dependency_.getLength() == 0) {
|
||||
throw css::uno::RuntimeException(
|
||||
(rtl::OUString(
|
||||
@ -127,19 +129,19 @@ bool XcdParser::startElement(
|
||||
state_ = STATE_COMPONENTS;
|
||||
// fall through
|
||||
case STATE_COMPONENTS:
|
||||
if (ns == XmlReader::NAMESPACE_OOR &&
|
||||
if (nsId == ParseManager::NAMESPACE_OOR &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("component-schema")))
|
||||
{
|
||||
nestedParser_ = new XcsParser(layer_, data_);
|
||||
nesting_ = 1;
|
||||
return nestedParser_->startElement(reader, ns, name);
|
||||
return nestedParser_->startElement(reader, nsId, name);
|
||||
}
|
||||
if (ns == XmlReader::NAMESPACE_OOR &&
|
||||
if (nsId == ParseManager::NAMESPACE_OOR &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("component-data")))
|
||||
{
|
||||
nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0);
|
||||
nesting_ = 1;
|
||||
return nestedParser_->startElement(reader, ns, name);
|
||||
return nestedParser_->startElement(reader, nsId, name);
|
||||
}
|
||||
break;
|
||||
default: // STATE_DEPENDENCY
|
||||
@ -148,12 +150,12 @@ bool XcdParser::startElement(
|
||||
}
|
||||
throw css::uno::RuntimeException(
|
||||
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) +
|
||||
xmldata::convertFromUtf8(name) +
|
||||
name.convertFromUtf8() +
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()),
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
|
||||
void XcdParser::endElement(XmlReader const & reader) {
|
||||
void XcdParser::endElement(xmlreader::XmlReader const & reader) {
|
||||
if (nestedParser_.is()) {
|
||||
nestedParser_->endElement(reader);
|
||||
if (--nesting_ == 0) {
|
||||
@ -174,7 +176,7 @@ void XcdParser::endElement(XmlReader const & reader) {
|
||||
}
|
||||
}
|
||||
|
||||
void XcdParser::characters(Span const & text) {
|
||||
void XcdParser::characters(xmlreader::Span const & text) {
|
||||
if (nestedParser_.is()) {
|
||||
nestedParser_->characters(text);
|
||||
}
|
||||
|
@ -34,14 +34,15 @@
|
||||
|
||||
#include "rtl/ref.hxx"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "parser.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
|
||||
namespace xmlreader { struct Span; }
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
struct Data;
|
||||
struct Span;
|
||||
|
||||
class XcdParser: public Parser {
|
||||
public:
|
||||
@ -52,14 +53,14 @@ public:
|
||||
private:
|
||||
virtual ~XcdParser();
|
||||
|
||||
virtual XmlReader::Text getTextMode();
|
||||
virtual xmlreader::XmlReader::Text getTextMode();
|
||||
|
||||
virtual bool startElement(
|
||||
XmlReader & reader, XmlReader::Namespace ns, Span const & name);
|
||||
xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name);
|
||||
|
||||
virtual void endElement(XmlReader const & reader);
|
||||
virtual void endElement(xmlreader::XmlReader const & reader);
|
||||
|
||||
virtual void characters(Span const & text);
|
||||
virtual void characters(xmlreader::Span const & text);
|
||||
|
||||
enum State {
|
||||
STATE_START, STATE_DEPENDENCIES, STATE_DEPENDENCY, STATE_COMPONENTS };
|
||||
|
@ -41,18 +41,19 @@
|
||||
#include "rtl/string.hxx"
|
||||
#include "rtl/ustring.h"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "xmlreader/span.hxx"
|
||||
#include "xmlreader/xmlreader.hxx"
|
||||
|
||||
#include "data.hxx"
|
||||
#include "localizedpropertynode.hxx"
|
||||
#include "groupnode.hxx"
|
||||
#include "node.hxx"
|
||||
#include "nodemap.hxx"
|
||||
#include "parsemanager.hxx"
|
||||
#include "propertynode.hxx"
|
||||
#include "setnode.hxx"
|
||||
#include "span.hxx"
|
||||
#include "xcsparser.hxx"
|
||||
#include "xmldata.hxx"
|
||||
#include "xmlreader.hxx"
|
||||
|
||||
namespace configmgr {
|
||||
|
||||
@ -125,18 +126,18 @@ XcsParser::XcsParser(int layer, Data & data):
|
||||
|
||||
XcsParser::~XcsParser() {}
|
||||
|
||||
XmlReader::Text XcsParser::getTextMode() {
|
||||
xmlreader::XmlReader::Text XcsParser::getTextMode() {
|
||||
return valueParser_.getTextMode();
|
||||
}
|
||||
|
||||
bool XcsParser::startElement(
|
||||
XmlReader & reader, XmlReader::Namespace ns, Span const & name)
|
||||
xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name)
|
||||
{
|
||||
if (valueParser_.startElement(reader, ns, name)) {
|
||||
if (valueParser_.startElement(reader, nsId, name)) {
|
||||
return true;
|
||||
}
|
||||
if (state_ == STATE_START) {
|
||||
if (ns == XmlReader::NAMESPACE_OOR &&
|
||||
if (nsId == ParseManager::NAMESPACE_OOR &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("component-schema"))) {
|
||||
handleComponentSchema(reader);
|
||||
state_ = STATE_COMPONENT_SCHEMA;
|
||||
@ -148,7 +149,7 @@ bool XcsParser::startElement(
|
||||
// prop constraints; accepting all four at illegal places (and with
|
||||
// illegal content):
|
||||
if (ignoring_ > 0 ||
|
||||
(ns == XmlReader::NAMESPACE_NONE &&
|
||||
(nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
(name.equals(RTL_CONSTASCII_STRINGPARAM("info")) ||
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("import")) ||
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("uses")) ||
|
||||
@ -160,7 +161,7 @@ bool XcsParser::startElement(
|
||||
}
|
||||
switch (state_) {
|
||||
case STATE_COMPONENT_SCHEMA:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("templates")))
|
||||
{
|
||||
state_ = STATE_TEMPLATES;
|
||||
@ -168,7 +169,7 @@ bool XcsParser::startElement(
|
||||
}
|
||||
// fall through
|
||||
case STATE_TEMPLATES_DONE:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("component")))
|
||||
{
|
||||
state_ = STATE_COMPONENT;
|
||||
@ -183,13 +184,13 @@ bool XcsParser::startElement(
|
||||
break;
|
||||
case STATE_TEMPLATES:
|
||||
if (elements_.empty()) {
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("group")))
|
||||
{
|
||||
handleGroup(reader, true);
|
||||
return true;
|
||||
}
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("set")))
|
||||
{
|
||||
handleSet(reader, true);
|
||||
@ -203,7 +204,7 @@ bool XcsParser::startElement(
|
||||
switch (elements_.top().node->kind()) {
|
||||
case Node::KIND_PROPERTY:
|
||||
case Node::KIND_LOCALIZED_PROPERTY:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("value")))
|
||||
{
|
||||
handlePropValue(reader, elements_.top().node);
|
||||
@ -211,25 +212,25 @@ bool XcsParser::startElement(
|
||||
}
|
||||
break;
|
||||
case Node::KIND_GROUP:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("prop")))
|
||||
{
|
||||
handleProp(reader);
|
||||
return true;
|
||||
}
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("node-ref")))
|
||||
{
|
||||
handleNodeRef(reader);
|
||||
return true;
|
||||
}
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("group")))
|
||||
{
|
||||
handleGroup(reader, false);
|
||||
return true;
|
||||
}
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("set")))
|
||||
{
|
||||
handleSet(reader, false);
|
||||
@ -237,7 +238,7 @@ bool XcsParser::startElement(
|
||||
}
|
||||
break;
|
||||
case Node::KIND_SET:
|
||||
if (ns == XmlReader::NAMESPACE_NONE &&
|
||||
if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
|
||||
name.equals(RTL_CONSTASCII_STRINGPARAM("item")))
|
||||
{
|
||||
handleSetItem(
|
||||
@ -260,12 +261,12 @@ bool XcsParser::startElement(
|
||||
}
|
||||
throw css::uno::RuntimeException(
|
||||
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) +
|
||||
xmldata::convertFromUtf8(name) +
|
||||
name.convertFromUtf8() +
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()),
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
|
||||
void XcsParser::endElement(XmlReader const & reader) {
|
||||
void XcsParser::endElement(xmlreader::XmlReader const & reader) {
|
||||
if (valueParser_.endElement()) {
|
||||
return;
|
||||
}
|
||||
@ -342,23 +343,23 @@ void XcsParser::endElement(XmlReader const & reader) {
|
||||
}
|
||||
}
|
||||
|
||||
void XcsParser::characters(Span const & text) {
|
||||
void XcsParser::characters(xmlreader::Span const & text) {
|
||||
valueParser_.characters(text);
|
||||
}
|
||||
|
||||
void XcsParser::handleComponentSchema(XmlReader & reader) {
|
||||
void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) {
|
||||
//TODO: oor:version, xml:lang attributes
|
||||
rtl::OStringBuffer buf;
|
||||
buf.append('.');
|
||||
bool hasPackage = false;
|
||||
bool hasName = false;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("package")))
|
||||
{
|
||||
if (hasPackage) {
|
||||
@ -371,9 +372,9 @@ void XcsParser::handleComponentSchema(XmlReader & reader) {
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
hasPackage = true;
|
||||
Span s(reader.getAttributeValue(false));
|
||||
xmlreader::Span s(reader.getAttributeValue(false));
|
||||
buf.insert(0, s.begin, s.length);
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
||||
{
|
||||
if (hasName) {
|
||||
@ -385,7 +386,7 @@ void XcsParser::handleComponentSchema(XmlReader & reader) {
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
hasName = true;
|
||||
Span s(reader.getAttributeValue(false));
|
||||
xmlreader::Span s(reader.getAttributeValue(false));
|
||||
buf.append(s.begin, s.length);
|
||||
}
|
||||
}
|
||||
@ -405,38 +406,36 @@ void XcsParser::handleComponentSchema(XmlReader & reader) {
|
||||
reader.getUrl()),
|
||||
css::uno::Reference< css::uno::XInterface >());
|
||||
}
|
||||
componentName_ = xmldata::convertFromUtf8(
|
||||
Span(buf.getStr(), buf.getLength()));
|
||||
componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()).
|
||||
convertFromUtf8();
|
||||
}
|
||||
|
||||
void XcsParser::handleNodeRef(XmlReader & reader) {
|
||||
void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) {
|
||||
bool hasName = false;
|
||||
rtl::OUString name;
|
||||
rtl::OUString component(componentName_);
|
||||
bool hasNodeType = false;
|
||||
rtl::OUString nodeType;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
||||
{
|
||||
hasName = true;
|
||||
name = xmldata::convertFromUtf8(reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
name = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component")))
|
||||
{
|
||||
component = xmldata::convertFromUtf8(
|
||||
reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
component = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type")))
|
||||
{
|
||||
hasNodeType = true;
|
||||
nodeType = xmldata::convertFromUtf8(
|
||||
reader.getAttributeValue(false));
|
||||
nodeType = reader.getAttributeValue(false).convertFromUtf8();
|
||||
}
|
||||
}
|
||||
if (!hasName) {
|
||||
@ -465,33 +464,33 @@ void XcsParser::handleNodeRef(XmlReader & reader) {
|
||||
elements_.push(Element(node, name));
|
||||
}
|
||||
|
||||
void XcsParser::handleProp(XmlReader & reader) {
|
||||
void XcsParser::handleProp(xmlreader::XmlReader & reader) {
|
||||
bool hasName = false;
|
||||
rtl::OUString name;
|
||||
valueParser_.type_ = TYPE_ERROR;
|
||||
bool localized = false;
|
||||
bool nillable = true;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
||||
{
|
||||
hasName = true;
|
||||
name = xmldata::convertFromUtf8(reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
name = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type")))
|
||||
{
|
||||
valueParser_.type_ = xmldata::parseType(
|
||||
reader, reader.getAttributeValue(true));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("localized")))
|
||||
{
|
||||
localized = xmldata::parseBoolean(reader.getAttributeValue(true));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nillable")))
|
||||
{
|
||||
nillable = xmldata::parseBoolean(reader.getAttributeValue(true));
|
||||
@ -525,16 +524,16 @@ void XcsParser::handleProp(XmlReader & reader) {
|
||||
}
|
||||
|
||||
void XcsParser::handlePropValue(
|
||||
XmlReader & reader, rtl::Reference< Node > const & property)
|
||||
xmlreader::XmlReader & reader, rtl::Reference< Node > const & property)
|
||||
{
|
||||
Span attrSeparator;
|
||||
xmlreader::Span attrSeparator;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator")))
|
||||
{
|
||||
attrSeparator = reader.getAttributeValue(false);
|
||||
@ -553,22 +552,22 @@ void XcsParser::handlePropValue(
|
||||
valueParser_.start(property);
|
||||
}
|
||||
|
||||
void XcsParser::handleGroup(XmlReader & reader, bool isTemplate) {
|
||||
void XcsParser::handleGroup(xmlreader::XmlReader & reader, bool isTemplate) {
|
||||
bool hasName = false;
|
||||
rtl::OUString name;
|
||||
bool extensible = false;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
||||
{
|
||||
hasName = true;
|
||||
name = xmldata::convertFromUtf8(reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
name = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("extensible")))
|
||||
{
|
||||
extensible = xmldata::parseBoolean(reader.getAttributeValue(true));
|
||||
@ -592,34 +591,32 @@ void XcsParser::handleGroup(XmlReader & reader, bool isTemplate) {
|
||||
name));
|
||||
}
|
||||
|
||||
void XcsParser::handleSet(XmlReader & reader, bool isTemplate) {
|
||||
void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) {
|
||||
bool hasName = false;
|
||||
rtl::OUString name;
|
||||
rtl::OUString component(componentName_);
|
||||
bool hasNodeType = false;
|
||||
rtl::OUString nodeType;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
||||
{
|
||||
hasName = true;
|
||||
name = xmldata::convertFromUtf8(reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
name = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component")))
|
||||
{
|
||||
component = xmldata::convertFromUtf8(
|
||||
reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
component = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type")))
|
||||
{
|
||||
hasNodeType = true;
|
||||
nodeType = xmldata::convertFromUtf8(
|
||||
reader.getAttributeValue(false));
|
||||
nodeType = reader.getAttributeValue(false).convertFromUtf8();
|
||||
}
|
||||
}
|
||||
if (!hasName) {
|
||||
@ -642,27 +639,25 @@ void XcsParser::handleSet(XmlReader & reader, bool isTemplate) {
|
||||
name));
|
||||
}
|
||||
|
||||
void XcsParser::handleSetItem(XmlReader & reader, SetNode * set) {
|
||||
void XcsParser::handleSetItem(xmlreader::XmlReader & reader, SetNode * set) {
|
||||
rtl::OUString component(componentName_);
|
||||
bool hasNodeType = false;
|
||||
rtl::OUString nodeType;
|
||||
for (;;) {
|
||||
XmlReader::Namespace attrNs;
|
||||
Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNs, &attrLn)) {
|
||||
int attrNsId;
|
||||
xmlreader::Span attrLn;
|
||||
if (!reader.nextAttribute(&attrNsId, &attrLn)) {
|
||||
break;
|
||||
}
|
||||
if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component")))
|
||||
{
|
||||
component = xmldata::convertFromUtf8(
|
||||
reader.getAttributeValue(false));
|
||||
} else if (attrNs == XmlReader::NAMESPACE_OOR &&
|
||||
component = reader.getAttributeValue(false).convertFromUtf8();
|
||||
} else if (attrNsId == ParseManager::NAMESPACE_OOR &&
|
||||
attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type")))
|
||||
{
|
||||
hasNodeType = true;
|
||||
nodeType = xmldata::convertFromUtf8(
|
||||
reader.getAttributeValue(false));
|
||||
nodeType = reader.getAttributeValue(false).convertFromUtf8();
|
||||
}
|
||||
}
|
||||
set->getAdditionalTemplateNames().push_back(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user