ooo-build r13764 - in trunk: . patches/dev300 patches/vba
- From: pflin svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13764 - in trunk: . patches/dev300 patches/vba
- Date: Wed, 3 Sep 2008 09:19:03 +0000 (UTC)
Author: pflin
Date: Wed Sep 3 09:19:03 2008
New Revision: 13764
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13764&view=rev
Log:
2008-09-03 Fong Lin <pflin novell com>
* patches/vba/vba-compatible-mode-uno.diff:
* patches/dev300/apply: uno interface of vba mode.
Added:
trunk/patches/vba/vba-compatible-mode-uno.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Wed Sep 3 09:19:03 2008
@@ -1568,6 +1568,8 @@
vba-userform-activate-fix.diff, i#91038
# support to display spinbutton in userform
vba-spinbutton-in-userform.diff, Fong
+# uno interface for vba mode
+vba-compatible-mode-uno.diff, Fong
vbaevents-services-sources.diff, i#68893
Added: trunk/patches/vba/vba-compatible-mode-uno.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-compatible-mode-uno.diff Wed Sep 3 09:19:03 2008
@@ -0,0 +1,303 @@
+--- /dev/null 2008-06-07 03:39:59.000000000 +0800
++++ offapi/com/sun/star/script/XVBACompat.idl 2008-09-01 15:40:32.000000000 +0800
+@@ -0,0 +1,49 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: XLibraryContainer.idl,v $
++ * $Revision: 1.4 $
++ *
++ * 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 __com_sun_star_script_XVBACompat_idl__
++#define __com_sun_star_script_XVBACompat_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++//=============================================================================
++
++module com { module sun { module star { module script {
++
++interface XVBACompat: com::sun::star::uno::XInterface
++{
++
++//=============================================================================
++ [attribute ] boolean VBACompatModeOn;
++
++}; }; }; };
++};
++#endif
+--- offapi/com/sun/star/script/makefile.mk.orig 2008-09-02 14:58:12.000000000 +0800
++++ offapi/com/sun/star/script/makefile.mk 2008-09-01 15:40:32.000000000 +0800
+@@ -52,6 +52,7 @@ IDLFILES=\
+ XPersistentLibraryContainer.idl\
+ XStorageBasedLibraryContainer.idl\
+ XLibraryQueryExecutable.idl \
++ XVBACompat.idl\
+ ModuleSizeExceededRequest.idl\
+
+ # ------------------------------------------------------------------
+--- basic/source/inc/namecont.hxx.orig 2008-09-02 14:40:13.000000000 +0800
++++ basic/source/inc/namecont.hxx 2008-09-01 16:06:08.000000000 +0800
+@@ -63,20 +63,23 @@
+ #include <cppuhelper/implbase2.hxx>
+ #include <cppuhelper/compbase6.hxx>
+ #include <cppuhelper/compbase7.hxx>
++#include <cppuhelper/compbase8.hxx>
+ #include <cppuhelper/interfacecontainer.hxx>
++#include <com/sun/star/script/XVBACompat.hpp>
+
+ class BasicManager;
+
+ namespace basic
+ {
+
+-typedef ::cppu::WeakComponentImplHelper7<
++typedef ::cppu::WeakComponentImplHelper8<
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::script::XStorageBasedLibraryContainer,
+ ::com::sun::star::script::XLibraryContainerPassword,
+ ::com::sun::star::script::XLibraryContainerExport,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XLibraryQueryExecutable,
++ ::com::sun::star::script::XVBACompat,
+ ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
+
+ typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
+@@ -499,6 +502,10 @@ public:
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
++
++ // Methods XVBACompat
++ virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
++ virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ class LibraryContainerMethodGuard
+--- basic/source/uno/namecont.cxx.orig 2008-09-03 14:13:47.000000000 +0800
++++ basic/source/uno/namecont.cxx 2008-09-03 14:40:52.000000000 +0800
+@@ -2681,6 +2681,35 @@ OUString SfxLibraryContainer::expand_url
+ }
+ }
+
++::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
++{
++ sal_Bool bVBACompat = sal_False;
++ BasicManager* pBasMgr = getBasicManager();
++ if( pBasMgr )
++ {
++ // get the standard library
++ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
++ StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
++ if( pBasic )
++ bVBACompat = pBasic->isVBAEnabled();
++ }
++
++ return bVBACompat;
++}
++
++void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
++{
++ BasicManager* pBasMgr = getBasicManager();
++ if( pBasMgr )
++ {
++ // get the standard library
++ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
++ StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
++ if( pBasic )
++ pBasic->SetVBAEnabled( _vbacompatmodeon );
++ }
++}
++
+ // Methods XServiceInfo
+ ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
+ throw (RuntimeException)
+--- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.orig 2008-09-03 13:17:42.000000000 +0800
++++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2008-09-03 16:45:22.000000000 +0800
+@@ -41,6 +41,7 @@
+ #include <com/sun/star/beans/XPropertyState.hpp>
+ #include <com/sun/star/document/XStorageBasedDocument.hpp>
+ #include <com/sun/star/document/XGraphicObjectResolver.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+
+ #include <comphelper/componentcontext.hxx>
+ #include <comphelper/processfactory.hxx>
+@@ -96,7 +97,7 @@ bool IsPackageURL( const ::rtl::OUString
+
+ void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
+ {
+- Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
++ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
+ {
+ // Set up Celllink
+@@ -145,6 +146,18 @@ void importBindableAndListRangeBits( Dia
+ }
+ }
+ }
++
++sal_Bool isVBACompatModeOn( DialogImport* _pImport )
++{
++ sal_Bool bVBAMode = sal_False;
++ Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
++ if( xVBACompat.is() )
++ {
++ bVBAMode = xVBACompat->getVBACompatModeOn();
++ }
++ return bVBAMode;
++}
++
+ // progessmeter
+ //__________________________________________________________________________________________________
+ Reference< xml::input::XElement > ProgressBarElement::startChildElement(
+@@ -301,9 +314,24 @@ Reference< xml::input::XElement > SpinBu
+ void SpinButtonElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+ {
++ OUString sService( OUSTR("com.sun.star.awt.UnoControlSpinButtonModel") );
++
++ // we should probably limit this to vba mode also ( leave for now )
++ if ( isVBACompatModeOn( _pImport ) )
++ sService = OUSTR("com.sun.star.form.component.SpinButton");
++
++ OUString sLinkedCell;
++ try
++ {
++ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
++ }
++ catch( Exception& /*e*/ )
++ {
++ }
++
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) );
++ sService );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+@@ -1545,7 +1573,7 @@ void TitledBoxElement::endElement()
+ {
+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ // we should probably limit this to vba mode also ( leave for now )
+- if ( _pImport->getDocOwner().is() )
++ if ( isVBACompatModeOn( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.RadioButton");
+ }
+ catch( Exception& /*e*/ )
+@@ -1690,7 +1718,7 @@ void RadioGroupElement::endElement()
+ {
+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ // we should probably limit this to vba mode also ( leave for now )
+- if ( _pImport->getDocOwner().is() )
++ if ( isVBACompatModeOn( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.RadioButton");
+ }
+ catch( Exception& /*e*/ )
+@@ -1877,7 +1905,7 @@ void MenuListElement::endElement()
+ OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
+
+ // we should probably limit this to vba mode also ( leave for now )
+- if ( _pImport->getDocOwner().is() )
++ if ( isVBACompatModeOn( _pImport ) )
+ sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
+
+ try
+@@ -1982,7 +2010,7 @@ void ComboBoxElement::endElement()
+ OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
+
+ // we should probably limit this to vba mode also ( leave for now )
+- if ( _pImport->getDocOwner().is() )
++ if ( isVBACompatModeOn( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.ComboBox");
+
+ OUString sLinkedCell;
+--- xmlscript/source/xmldlg_imexp/imp_share.hxx.orig 2008-09-03 15:53:46.000000000 +0800
++++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2008-09-03 16:43:24.000000000 +0800
+@@ -45,6 +45,7 @@
+ #include <com/sun/star/awt/FontEmphasisMark.hpp>
+ #include <com/sun/star/awt/FontRelief.hpp>
+ #include <com/sun/star/xml/input/XRoot.hpp>
++#include <com/sun/star/script/XLibraryContainer.hpp>
+ #include <vector>
+
+
+@@ -132,6 +133,7 @@ struct DialogImport
+ css::uno::Reference< css::container::XNameContainer > _xDialogModel;
+ css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
+ css::uno::Reference< css::frame::XModel > _xDoc;
++ css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
+
+ sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
+
+@@ -177,6 +179,8 @@ public:
+ SAL_THROW( () );
+
+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
++
++ css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
+ // XRoot
+ virtual void SAL_CALL startDocument(
+ css::uno::Reference< css::xml::input::XNamespaceMapping >
+--- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx.orig 2008-09-03 16:31:30.000000000 +0800
++++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx 2008-09-03 16:40:02.000000000 +0800
+@@ -59,6 +59,8 @@
+ #include <com/sun/star/script/ScriptEventDescriptor.hpp>
+
+ #include <com/sun/star/view/SelectionType.hpp>
++#include <com/sun/star/document/XStorageBasedDocument.hpp>
++#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+@@ -1874,6 +1876,26 @@ Reference< xml::input::XElement > Dialog
+ }
+ return 0;
+ }
++//__________________________________________________________________________________________________
++Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
++{
++ if( !_xScriptLibraryContainer.is() )
++ {
++ try
++ {
++ Reference< document::XStorageBasedDocument > xStorageDoc( _xDoc, UNO_QUERY );
++ if( xStorageDoc.is() )
++ _xScriptLibraryContainer.set(
++ script::DocumentScriptLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc ),
++ UNO_QUERY );
++ }
++ catch( const Exception& )
++ {
++ }
++ }
++
++ return _xScriptLibraryContainer;
++}
+
+ //##################################################################################################
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]