2001-02-21 16:45:58 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 10:44:51 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2005-09-29 11:39:23 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2005-09-29 11:39:23 +00:00
|
|
|
*
|
2008-04-11 10:44:51 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-02-21 16:45:58 +00:00
|
|
|
*
|
2008-04-11 10:44:51 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-02-21 16:45:58 +00:00
|
|
|
*
|
2008-04-11 10:44:51 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-02-21 16:45:58 +00:00
|
|
|
*
|
2008-04-11 10:44:51 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-02-21 16:45:58 +00:00
|
|
|
*
|
2008-04-11 10:44:51 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-02-21 16:45:58 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 08:59:25 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_basic.hxx"
|
|
|
|
|
2001-02-21 16:45:58 +00:00
|
|
|
//#include <stl_queue.h>
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
#include <com/sun/star/script/XEventAttacher.hpp>
|
|
|
|
#include <com/sun/star/script/XAllListener.hpp>
|
|
|
|
#include <com/sun/star/script/XScriptEventsSupplier.hpp>
|
|
|
|
#include <com/sun/star/script/XScriptEventsAttacher.hpp>
|
|
|
|
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
|
2008-06-06 12:28:21 +00:00
|
|
|
#include <com/sun/star/script/XLibraryContainer.hpp>
|
2001-02-21 16:45:58 +00:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
2007-01-29 15:27:08 +00:00
|
|
|
#include <com/sun/star/resource/XStringResourceSupplier.hpp>
|
|
|
|
#include <com/sun/star/resource/XStringResourceManager.hpp>
|
2001-02-21 16:45:58 +00:00
|
|
|
#include <com/sun/star/awt/XControlContainer.hpp>
|
|
|
|
#include <com/sun/star/awt/XControlModel.hpp>
|
|
|
|
#include <com/sun/star/awt/XControl.hpp>
|
|
|
|
#include <com/sun/star/awt/XDialog.hpp>
|
|
|
|
#include <com/sun/star/awt/XWindow.hpp>
|
2004-11-15 12:28:41 +00:00
|
|
|
#include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
|
2001-02-21 16:45:58 +00:00
|
|
|
|
2004-10-25 07:06:18 +00:00
|
|
|
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
|
|
|
|
#include <com/sun/star/script/provider/XScriptProvider.hpp>
|
2008-05-05 14:57:50 +00:00
|
|
|
#include <com/sun/star/awt/XDialogProvider.hpp>
|
2003-11-18 16:00:17 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/frame/XModel.hpp>
|
2001-03-03 15:19:45 +00:00
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
2007-10-15 12:03:12 +00:00
|
|
|
#include <xmlscript/xmldlg_imexp.hxx>
|
2001-03-03 15:19:45 +00:00
|
|
|
#include <sbunoobj.hxx>
|
2007-06-27 13:17:52 +00:00
|
|
|
#include <basic/sbstar.hxx>
|
|
|
|
#include <basic/sbmeth.hxx>
|
2001-05-07 11:50:59 +00:00
|
|
|
#include <runtime.hxx>
|
|
|
|
#include <sbintern.hxx>
|
2001-02-21 16:45:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
2003-11-18 16:00:17 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
2007-01-29 15:27:08 +00:00
|
|
|
using namespace ::com::sun::star::script;
|
|
|
|
using namespace ::com::sun::star::resource;
|
2003-11-18 16:00:17 +00:00
|
|
|
|
2001-02-21 16:45:58 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::script;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::reflection;
|
|
|
|
using namespace ::com::sun::star::awt;
|
2001-03-19 11:42:53 +00:00
|
|
|
using namespace ::com::sun::star::io;
|
2001-02-21 16:45:58 +00:00
|
|
|
using namespace ::cppu;
|
|
|
|
using namespace ::osl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===================================================================
|
2003-11-18 16:00:17 +00:00
|
|
|
void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
|
|
|
|
Any sbxToUnoValue( SbxVariable* pVar );
|
|
|
|
|
|
|
|
|
|
|
|
Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic )
|
|
|
|
{
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
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 )
|
2003-11-18 16:00:17 +00:00
|
|
|
{
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT );
|
|
|
|
pLookup = pLookup->GetParent();
|
2003-11-18 16:00:17 +00:00
|
|
|
}
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
if ( !pThisComponent )
|
2003-11-18 16:00:17 +00:00
|
|
|
{
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
OSL_TRACE("Failed to get ThisComponent");
|
|
|
|
// the application Basic, at the latest, should have this variable
|
|
|
|
return NULL;
|
2003-11-18 16:00:17 +00:00
|
|
|
}
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
|
|
|
|
Any aThisComponent( sbxToUnoValue( pThisComponent ) );
|
|
|
|
Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY );
|
|
|
|
if ( !xModel.is() )
|
2003-11-18 16:00:17 +00:00
|
|
|
{
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
// 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();
|
2003-11-18 16:00:17 +00:00
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
if ( !xModel.is() )
|
|
|
|
return NULL;
|
2003-11-18 16:00:17 +00:00
|
|
|
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 09:53:35 +00:00
|
|
|
#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
|
2003-11-18 16:00:17 +00:00
|
|
|
|
|
|
|
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",
|
|
|
|
::rtl::OUStringToOString( aScriptEvent.ScriptCode,
|
|
|
|
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
|
|
|
|
try
|
|
|
|
{
|
2004-11-15 12:28:41 +00:00
|
|
|
Reference< provider::XScriptProvider > xScriptProvider;
|
|
|
|
if ( xModel.is() )
|
2003-11-18 16:00:17 +00:00
|
|
|
{
|
2004-11-15 12:28:41 +00:00
|
|
|
Reference< provider::XScriptProviderSupplier > xSupplier( xModel, UNO_QUERY );
|
|
|
|
OSL_ENSURE( xSupplier.is(), "SFURL_firing_impl: failed to get script provider supplier" );
|
|
|
|
if ( xSupplier.is() )
|
|
|
|
xScriptProvider.set( xSupplier->getScriptProvider() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Reference< XComponentContext > xContext;
|
|
|
|
Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
|
|
|
|
OSL_ASSERT( xProps.is() );
|
|
|
|
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "DefaultContext" ) ) >>= xContext );
|
|
|
|
if ( xContext.is() )
|
|
|
|
{
|
|
|
|
Reference< provider::XScriptProviderFactory > xFactory(
|
|
|
|
xContext->getValueByName(
|
|
|
|
::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory" ) ),
|
|
|
|
UNO_QUERY );
|
|
|
|
OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
|
|
|
|
if ( xFactory.is() )
|
|
|
|
{
|
|
|
|
Any aCtx;
|
|
|
|
aCtx <<= ::rtl::OUString::createFromAscii( "user" );
|
|
|
|
xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
|
|
|
|
}
|
|
|
|
}
|
2003-11-18 16:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !xScriptProvider.is() )
|
|
|
|
{
|
|
|
|
OSL_TRACE("SFURL_firing_impl() Failed to create msp");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Sequence< Any > inArgs( 0 );
|
|
|
|
Sequence< Any > outArgs( 0 );
|
|
|
|
Sequence< sal_Int16 > outIndex;
|
|
|
|
|
|
|
|
// get Arguments for script
|
|
|
|
inArgs = aScriptEvent.Arguments;
|
|
|
|
|
|
|
|
Reference< provider::XScript > xScript = xScriptProvider->getScript( aScriptEvent.ScriptCode );
|
|
|
|
|
|
|
|
if ( !xScript.is() )
|
|
|
|
{
|
|
|
|
OSL_TRACE("SFURL_firing_impl() Failed to obtain XScript");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Any result = xScript->invoke( inArgs, outIndex, outArgs );
|
|
|
|
if ( pRet )
|
|
|
|
{
|
|
|
|
*pRet = result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch ( RuntimeException& re )
|
|
|
|
{
|
|
|
|
OSL_TRACE("SFURL_firing_impl() Caught RuntimeException reason %s.",
|
|
|
|
::rtl::OUStringToOString( re.Message,
|
|
|
|
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
|
|
|
|
}
|
|
|
|
catch ( Exception& e )
|
|
|
|
{
|
|
|
|
OSL_TRACE("SFURL_firing_impl() Caught Exception reason %s.",
|
|
|
|
::rtl::OUStringToOString( e.Message,
|
|
|
|
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2001-02-21 16:45:58 +00:00
|
|
|
|
|
|
|
class BasicScriptListener_Impl : public WeakImplHelper1< XScriptListener >
|
|
|
|
{
|
|
|
|
StarBASICRef maBasicRef;
|
2003-11-18 16:00:17 +00:00
|
|
|
Reference< frame::XModel > m_xModel;
|
2001-02-21 16:45:58 +00:00
|
|
|
|
|
|
|
virtual void firing_impl(const ScriptEvent& aScriptEvent, Any* pRet);
|
|
|
|
|
|
|
|
public:
|
2003-11-18 16:00:17 +00:00
|
|
|
BasicScriptListener_Impl( StarBASIC* pBasic, const Reference< frame::XModel >& xModel )
|
|
|
|
: maBasicRef( pBasic ), m_xModel( xModel ) {}
|
2001-02-21 16:45:58 +00:00
|
|
|
|
2009-04-25 00:18:20 +00:00
|
|
|
// Methods of XAllListener
|
2001-02-21 16:45:58 +00:00
|
|
|
virtual void SAL_CALL firing(const ScriptEvent& aScriptEvent)
|
|
|
|
throw( RuntimeException );
|
|
|
|
virtual Any SAL_CALL approveFiring(const ScriptEvent& aScriptEvent)
|
|
|
|
throw( InvocationTargetException, RuntimeException );
|
|
|
|
|
2009-04-25 00:18:20 +00:00
|
|
|
// Methods of XEventListener
|
2001-02-21 16:45:58 +00:00
|
|
|
virtual void SAL_CALL disposing(const EventObject& Source)
|
|
|
|
throw( RuntimeException );
|
|
|
|
};
|
|
|
|
|
|
|
|
// Methods XAllListener
|
|
|
|
void BasicScriptListener_Impl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
|
|
|
|
{
|
|
|
|
firing_impl( aScriptEvent, NULL );
|
|
|
|
}
|
|
|
|
|
2001-02-22 14:40:19 +00:00
|
|
|
Any BasicScriptListener_Impl::approveFiring( const ScriptEvent& aScriptEvent )
|
|
|
|
throw ( InvocationTargetException, RuntimeException )
|
2001-02-21 16:45:58 +00:00
|
|
|
{
|
|
|
|
Any aRetAny;
|
|
|
|
firing_impl( aScriptEvent, &aRetAny );
|
|
|
|
return aRetAny;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Methods XEventListener
|
|
|
|
void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeException )
|
|
|
|
{
|
|
|
|
// TODO: ???
|
|
|
|
//NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
|
|
|
|
//xSbxObj.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
|
|
|
|
{
|
|
|
|
//Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
|
|
|
|
//{
|
|
|
|
if( aScriptEvent.ScriptType.compareToAscii( "StarBasic" ) == 0 )
|
|
|
|
{
|
|
|
|
// Full qualified name?
|
|
|
|
String aMacro( aScriptEvent.ScriptCode );
|
2001-09-19 08:00:07 +00:00
|
|
|
String aLibName;
|
2001-08-20 06:29:09 +00:00
|
|
|
String aLocation;
|
2001-02-21 16:45:58 +00:00
|
|
|
if( aMacro.GetTokenCount( '.' ) == 3 )
|
|
|
|
{
|
|
|
|
sal_uInt16 nLast = 0;
|
2008-06-24 15:01:59 +00:00
|
|
|
::rtl::OUString aFullLibName = aMacro.GetToken( 0, '.', nLast );
|
2001-08-20 06:29:09 +00:00
|
|
|
|
|
|
|
sal_Int32 nIndex = aFullLibName.indexOf( (sal_Unicode)':' );
|
|
|
|
if (nIndex >= 0)
|
2001-09-19 08:00:07 +00:00
|
|
|
{
|
2001-08-20 06:29:09 +00:00
|
|
|
aLocation = aFullLibName.copy( 0, nIndex );
|
2001-09-19 08:00:07 +00:00
|
|
|
aLibName = aFullLibName.copy( nIndex + 1 );
|
|
|
|
}
|
2001-08-20 06:29:09 +00:00
|
|
|
|
2001-02-21 16:45:58 +00:00
|
|
|
String aModul = aMacro.GetToken( 0, '.', nLast );
|
|
|
|
aMacro.Erase( 0, nLast );
|
|
|
|
}
|
|
|
|
|
2001-09-19 08:00:07 +00:00
|
|
|
SbxObject* p = maBasicRef;
|
|
|
|
SbxObject* pParent = p->GetParent();
|
|
|
|
SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
|
|
|
|
|
|
|
|
StarBASICRef xAppStandardBasic;
|
|
|
|
StarBASICRef xDocStandardBasic;
|
|
|
|
if( pParentParent )
|
|
|
|
{
|
|
|
|
// Own basic must be document library
|
|
|
|
xAppStandardBasic = (StarBASIC*)pParentParent;
|
|
|
|
xDocStandardBasic = (StarBASIC*)pParent;
|
|
|
|
}
|
|
|
|
else if( pParent )
|
|
|
|
{
|
|
|
|
String aName = p->GetName();
|
|
|
|
if( aName.EqualsAscii("Standard") )
|
|
|
|
{
|
|
|
|
// Own basic is doc standard lib
|
|
|
|
xDocStandardBasic = (StarBASIC*)p;
|
|
|
|
}
|
|
|
|
xAppStandardBasic = (StarBASIC*)pParent;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xAppStandardBasic = (StarBASIC*)p;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool bSearchLib = true;
|
|
|
|
StarBASICRef xLibSearchBasic;
|
2001-08-20 06:29:09 +00:00
|
|
|
if( aLocation.EqualsAscii("application") )
|
2001-09-19 08:00:07 +00:00
|
|
|
xLibSearchBasic = xAppStandardBasic;
|
2001-08-20 06:29:09 +00:00
|
|
|
else if( aLocation.EqualsAscii("document") )
|
2001-09-19 08:00:07 +00:00
|
|
|
xLibSearchBasic = xDocStandardBasic;
|
|
|
|
else
|
|
|
|
bSearchLib = false;
|
2001-08-20 06:29:09 +00:00
|
|
|
|
|
|
|
SbxVariable* pMethVar = NULL;
|
2001-09-19 08:00:07 +00:00
|
|
|
// Be still tolerant and make default search if no search basic exists
|
|
|
|
if( bSearchLib && xLibSearchBasic.Is() )
|
2001-08-20 06:29:09 +00:00
|
|
|
{
|
2001-09-19 08:00:07 +00:00
|
|
|
StarBASICRef xLibBasic;
|
|
|
|
sal_Int16 nCount = xLibSearchBasic->GetObjects()->Count();
|
|
|
|
for( sal_Int16 nObj = -1; nObj < nCount ; nObj++ )
|
|
|
|
{
|
|
|
|
StarBASIC* pBasic;
|
|
|
|
if( nObj == -1 )
|
|
|
|
{
|
|
|
|
pBasic = (StarBASIC*)xLibSearchBasic;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SbxVariable* pVar = xLibSearchBasic->GetObjects()->Get( nObj );
|
|
|
|
pBasic = PTR_CAST(StarBASIC,pVar);
|
|
|
|
}
|
|
|
|
if( pBasic )
|
|
|
|
{
|
|
|
|
String aName = pBasic->GetName();
|
|
|
|
if( aName == aLibName )
|
|
|
|
{
|
|
|
|
// Search only in the lib, not automatically in application basic
|
|
|
|
USHORT nFlags = pBasic->GetFlags();
|
|
|
|
pBasic->ResetFlag( SBX_GBLSEARCH );
|
|
|
|
pMethVar = pBasic->Find( aMacro, SbxCLASS_DONTCARE );
|
|
|
|
pBasic->SetFlags( nFlags );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-08-20 06:29:09 +00:00
|
|
|
}
|
2001-09-19 08:00:07 +00:00
|
|
|
|
|
|
|
// Default: Be tolerant and search everywhere
|
|
|
|
if( (!pMethVar || !pMethVar->ISA(SbMethod)) && maBasicRef.Is() )
|
|
|
|
pMethVar = maBasicRef->FindQualified( aMacro, SbxCLASS_DONTCARE );
|
|
|
|
|
2001-02-21 16:45:58 +00:00
|
|
|
SbMethod* pMeth = PTR_CAST(SbMethod,pMethVar);
|
|
|
|
if( !pMeth )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Setup parameters
|
|
|
|
SbxArrayRef xArray;
|
|
|
|
String aTmp;
|
|
|
|
sal_Int32 nCnt = aScriptEvent.Arguments.getLength();
|
|
|
|
if( nCnt )
|
|
|
|
{
|
|
|
|
xArray = new SbxArray;
|
|
|
|
const Any *pArgs = aScriptEvent.Arguments.getConstArray();
|
|
|
|
for( sal_Int32 i = 0; i < nCnt; i++ )
|
|
|
|
{
|
|
|
|
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
|
|
|
|
unoToSbxValue( (SbxVariable*)xVar, pArgs[i] );
|
2006-10-12 13:24:55 +00:00
|
|
|
xArray->Put( xVar, sal::static_int_cast< USHORT >(i+1) );
|
2001-02-21 16:45:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call method
|
|
|
|
SbxVariableRef xValue = pRet ? new SbxVariable : 0;
|
|
|
|
if( xArray.Is() )
|
|
|
|
pMeth->SetParameters( xArray );
|
2006-06-19 16:39:01 +00:00
|
|
|
pMeth->Call( xValue );
|
2001-02-21 16:45:58 +00:00
|
|
|
if( pRet )
|
|
|
|
*pRet = sbxToUnoValue( xValue );
|
2001-12-03 14:43:58 +00:00
|
|
|
pMeth->SetParameters( NULL );
|
2001-02-21 16:45:58 +00:00
|
|
|
}
|
2003-11-18 16:00:17 +00:00
|
|
|
else // scripting framework script
|
|
|
|
{
|
|
|
|
//callBasic via scripting framework
|
|
|
|
SFURL_firing_impl( aScriptEvent, pRet, m_xModel );
|
|
|
|
|
|
|
|
}
|
2001-02-21 16:45:58 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 15:27:08 +00:00
|
|
|
Any implFindDialogLibForDialog( const Any& rDlgAny, SbxObject* pBasic )
|
|
|
|
{
|
|
|
|
Any aRetDlgLibAny;
|
|
|
|
|
|
|
|
SbxVariable* pDlgLibContVar = pBasic->Find
|
|
|
|
( String::CreateFromAscii("DialogLibraries"), SbxCLASS_OBJECT );
|
|
|
|
if( pDlgLibContVar && pDlgLibContVar->ISA(SbUnoObject) )
|
|
|
|
{
|
|
|
|
SbUnoObject* pDlgLibContUnoObj = (SbUnoObject*)(SbxBase*)pDlgLibContVar;
|
|
|
|
Any aDlgLibContAny = pDlgLibContUnoObj->getUnoAny();
|
|
|
|
|
2008-06-06 12:28:21 +00:00
|
|
|
Reference< XLibraryContainer > xDlgLibContNameAccess( aDlgLibContAny, UNO_QUERY );
|
|
|
|
OSL_ENSURE( xDlgLibContNameAccess.is(), "implFindDialogLibForDialog: no lib container for the given dialog!" );
|
2007-01-29 15:27:08 +00:00
|
|
|
if( xDlgLibContNameAccess.is() )
|
|
|
|
{
|
2008-06-24 15:01:59 +00:00
|
|
|
Sequence< ::rtl::OUString > aLibNames = xDlgLibContNameAccess->getElementNames();
|
|
|
|
const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
|
2007-01-29 15:27:08 +00:00
|
|
|
sal_Int32 nLibNameCount = aLibNames.getLength();
|
|
|
|
|
|
|
|
for( sal_Int32 iLib = 0 ; iLib < nLibNameCount ; iLib++ )
|
|
|
|
{
|
2008-06-06 12:28:21 +00:00
|
|
|
if ( !xDlgLibContNameAccess->isLibraryLoaded( pLibNames[ iLib ] ) )
|
|
|
|
// if the library isn't loaded, then the dialog cannot originate from this lib
|
|
|
|
continue;
|
|
|
|
|
2007-01-29 15:27:08 +00:00
|
|
|
Any aDlgLibAny = xDlgLibContNameAccess->getByName( pLibNames[ iLib ] );
|
|
|
|
|
2008-06-06 12:28:21 +00:00
|
|
|
Reference< XNameAccess > xDlgLibNameAccess( aDlgLibAny, UNO_QUERY );
|
|
|
|
OSL_ENSURE( xDlgLibNameAccess.is(), "implFindDialogLibForDialog: invalid dialog lib!" );
|
2007-01-29 15:27:08 +00:00
|
|
|
if( xDlgLibNameAccess.is() )
|
|
|
|
{
|
2008-06-24 15:01:59 +00:00
|
|
|
Sequence< ::rtl::OUString > aDlgNames = xDlgLibNameAccess->getElementNames();
|
|
|
|
const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
|
2007-01-29 15:27:08 +00:00
|
|
|
sal_Int32 nDlgNameCount = aDlgNames.getLength();
|
|
|
|
|
|
|
|
for( sal_Int32 iDlg = 0 ; iDlg < nDlgNameCount ; iDlg++ )
|
|
|
|
{
|
|
|
|
Any aDlgAny = xDlgLibNameAccess->getByName( pDlgNames[ iDlg ] );
|
|
|
|
if( aDlgAny == rDlgAny )
|
|
|
|
{
|
|
|
|
aRetDlgLibAny = aDlgLibAny;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRetDlgLibAny;
|
|
|
|
}
|
|
|
|
|
2008-01-28 12:59:47 +00:00
|
|
|
static ::rtl::OUString aDecorationPropName =
|
|
|
|
::rtl::OUString::createFromAscii( "Decoration" );
|
|
|
|
static ::rtl::OUString aTitlePropName =
|
|
|
|
::rtl::OUString::createFromAscii( "Title" );
|
|
|
|
|
2001-03-03 15:19:45 +00:00
|
|
|
void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
|
2001-02-21 16:45:58 +00:00
|
|
|
{
|
2008-06-24 15:01:59 +00:00
|
|
|
static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
|
2007-01-29 15:27:08 +00:00
|
|
|
|
2006-06-19 16:39:01 +00:00
|
|
|
(void)pBasic;
|
|
|
|
(void)bWrite;
|
|
|
|
|
2001-03-19 11:42:53 +00:00
|
|
|
Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() );
|
|
|
|
if( !xMSF.is() )
|
2001-02-21 16:45:58 +00:00
|
|
|
return;
|
|
|
|
|
2001-06-13 09:38:27 +00:00
|
|
|
// We need at least 1 parameter
|
|
|
|
if ( rPar.Count() < 2 )
|
2001-02-21 16:45:58 +00:00
|
|
|
{
|
|
|
|
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-06-13 09:38:27 +00:00
|
|
|
// Get dialog
|
2001-03-03 15:19:45 +00:00
|
|
|
SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject();
|
|
|
|
if( !(pObj && pObj->ISA(SbUnoObject)) )
|
|
|
|
{
|
|
|
|
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
|
|
|
return;
|
|
|
|
}
|
2007-01-29 15:27:08 +00:00
|
|
|
SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
|
|
|
|
Any aAnyISP = pUnoObj->getUnoAny();
|
2001-06-13 09:38:27 +00:00
|
|
|
TypeClass eType = aAnyISP.getValueType().getTypeClass();
|
2001-02-21 16:45:58 +00:00
|
|
|
|
2001-06-13 09:38:27 +00:00
|
|
|
if( eType != TypeClass_INTERFACE )
|
2001-02-21 16:45:58 +00:00
|
|
|
{
|
2001-03-03 15:19:45 +00:00
|
|
|
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
|
|
|
return;
|
2001-02-21 16:45:58 +00:00
|
|
|
}
|
|
|
|
|
2001-03-19 11:42:53 +00:00
|
|
|
// Create new uno dialog
|
|
|
|
Reference< XNameContainer > xDialogModel( xMSF->createInstance
|
2008-06-24 15:01:59 +00:00
|
|
|
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ),
|
2001-03-19 11:42:53 +00:00
|
|
|
UNO_QUERY );
|
2002-01-18 10:53:30 +00:00
|
|
|
if( !xDialogModel.is() )
|
|
|
|
return;
|
2001-03-19 11:42:53 +00:00
|
|
|
|
|
|
|
Reference< XInputStreamProvider > xISP;
|
2001-06-13 09:38:27 +00:00
|
|
|
aAnyISP >>= xISP;
|
2001-03-27 16:04:56 +00:00
|
|
|
if( !xISP.is() )
|
|
|
|
return;
|
2001-02-21 16:45:58 +00:00
|
|
|
|
2001-09-20 08:07:32 +00:00
|
|
|
Reference< XComponentContext > xContext;
|
|
|
|
Reference< XPropertySet > xProps( xMSF, UNO_QUERY );
|
|
|
|
OSL_ASSERT( xProps.is() );
|
|
|
|
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
|
|
|
|
|
2002-01-18 10:53:30 +00:00
|
|
|
// Import the DialogModel
|
2001-03-19 11:42:53 +00:00
|
|
|
Reference< XInputStream > xInput( xISP->createInputStream() );
|
2002-01-18 10:53:30 +00:00
|
|
|
|
2008-01-28 12:59:47 +00:00
|
|
|
// i83963 Force decoration
|
|
|
|
uno::Reference< beans::XPropertySet > xDlgModPropSet( xDialogModel, uno::UNO_QUERY );
|
|
|
|
if( xDlgModPropSet.is() )
|
|
|
|
{
|
|
|
|
bool bDecoration = true;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName );
|
|
|
|
aDecorationAny >>= bDecoration;
|
|
|
|
if( !bDecoration )
|
|
|
|
{
|
|
|
|
xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) );
|
|
|
|
xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( UnknownPropertyException& )
|
|
|
|
{}
|
|
|
|
}
|
|
|
|
|
2007-01-29 15:27:08 +00:00
|
|
|
// Find dialog library for dialog, direct access is not possible here
|
|
|
|
StarBASIC* pStartedBasic = pINST->GetBasic();
|
|
|
|
SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
|
|
|
|
SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
|
|
|
|
|
|
|
|
SbxObject* pSearchBasic1 = NULL;
|
|
|
|
SbxObject* pSearchBasic2 = NULL;
|
|
|
|
if( pParentParentBasic )
|
|
|
|
{
|
|
|
|
pSearchBasic1 = pParentBasic;
|
|
|
|
pSearchBasic2 = pParentParentBasic;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pSearchBasic1 = pStartedBasic;
|
|
|
|
pSearchBasic2 = pParentBasic;
|
|
|
|
}
|
|
|
|
|
|
|
|
Any aDlgLibAny;
|
|
|
|
if( pSearchBasic1 )
|
|
|
|
{
|
|
|
|
aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
|
|
|
|
if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
|
|
|
|
aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
|
|
|
|
}
|
|
|
|
|
2003-11-18 16:00:17 +00:00
|
|
|
|
2007-01-29 15:27:08 +00:00
|
|
|
OSL_TRACE("About to try get a hold of ThisComponent");
|
|
|
|
Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ;
|
2008-11-20 14:05:36 +00:00
|
|
|
Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pStartedBasic, xModel );
|
2008-05-05 14:57:50 +00:00
|
|
|
|
|
|
|
Sequence< Any > aArgs( 4 );
|
|
|
|
aArgs[ 0 ] <<= xModel;
|
|
|
|
aArgs[ 1 ] <<= xInput;
|
|
|
|
aArgs[ 2 ] = aDlgLibAny;
|
|
|
|
aArgs[ 3 ] <<= xScriptListener;
|
|
|
|
// Create a "living" Dialog
|
|
|
|
Reference< XControl > xCntrl;
|
|
|
|
try
|
|
|
|
{
|
2008-06-24 15:01:59 +00:00
|
|
|
Reference< XDialogProvider > xDlgProv( xMSF->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.DialogProvider" ) ), aArgs ), UNO_QUERY );
|
2008-05-05 14:57:50 +00:00
|
|
|
xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
|
|
|
|
// Add dialog model to dispose vector
|
|
|
|
Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
|
|
|
|
pINST->getComponentVector().push_back( xDlgComponent );
|
|
|
|
// need ThisCompoent from calling script
|
|
|
|
}
|
|
|
|
// preserve existing bad behaviour, it's possible... but probably
|
|
|
|
// illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
|
|
|
|
// create dialog fails. So, in this case let's not throw, just leave basic
|
|
|
|
// detect the unset object.
|
|
|
|
catch( uno::Exception& )
|
|
|
|
{
|
|
|
|
}
|
2001-02-21 16:45:58 +00:00
|
|
|
|
|
|
|
// Return dialog
|
2001-03-03 15:19:45 +00:00
|
|
|
Any aRetVal;
|
2008-05-05 14:57:50 +00:00
|
|
|
aRetVal <<= xCntrl;
|
2001-02-21 16:45:58 +00:00
|
|
|
SbxVariableRef refVar = rPar.Get(0);
|
2001-03-03 15:19:45 +00:00
|
|
|
unoToSbxValue( (SbxVariable*)refVar, aRetVal );
|
2001-02-21 16:45:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===================================================================
|
2008-06-24 15:01:59 +00:00
|
|
|
|