1 --- /dev/null 2008-06-07 03:39:59.000000000 +0800
2 +++ offapi/com/sun/star/script/XVBACompat.idl 2008-09-01 15:40:32.000000000 +0800
4 +/*************************************************************************
6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 + * Copyright 2008 by Sun Microsystems, Inc.
10 + * OpenOffice.org - a multi-platform office productivity suite
12 + * $RCSfile: XLibraryContainer.idl,v $
15 + * This file is part of OpenOffice.org.
17 + * OpenOffice.org is free software: you can redistribute it and/or modify
18 + * it under the terms of the GNU Lesser General Public License version 3
19 + * only, as published by the Free Software Foundation.
21 + * OpenOffice.org is distributed in the hope that it will be useful,
22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 + * GNU Lesser General Public License version 3 for more details
25 + * (a copy is included in the LICENSE file that accompanied this code).
27 + * You should have received a copy of the GNU Lesser General Public License
28 + * version 3 along with OpenOffice.org. If not, see
29 + * <http://www.openoffice.org/license.html>
30 + * for a copy of the LGPLv3 License.
32 + ************************************************************************/
33 +#ifndef __com_sun_star_script_XVBACompat_idl__
34 +#define __com_sun_star_script_XVBACompat_idl__
36 +#ifndef __com_sun_star_uno_XInterface_idl__
37 +#include <com/sun/star/uno/XInterface.idl>
40 +//=============================================================================
42 +module com { module sun { module star { module script {
44 +interface XVBACompat: com::sun::star::uno::XInterface
47 +//=============================================================================
48 + [attribute ] boolean VBACompatModeOn;
53 --- offapi/com/sun/star/script/makefile.mk.orig 2008-09-02 14:58:12.000000000 +0800
54 +++ offapi/com/sun/star/script/makefile.mk 2008-09-01 15:40:32.000000000 +0800
55 @@ -52,6 +52,7 @@ IDLFILES=\
56 XPersistentLibraryContainer.idl\
57 XStorageBasedLibraryContainer.idl\
58 XLibraryQueryExecutable.idl \
60 ModuleSizeExceededRequest.idl\
62 # ------------------------------------------------------------------
63 --- basic/source/inc/namecont.hxx.orig 2008-09-02 14:40:13.000000000 +0800
64 +++ basic/source/inc/namecont.hxx 2008-09-01 16:06:08.000000000 +0800
66 #include <cppuhelper/implbase2.hxx>
67 #include <cppuhelper/compbase6.hxx>
68 #include <cppuhelper/compbase7.hxx>
69 +#include <cppuhelper/compbase8.hxx>
70 #include <cppuhelper/interfacecontainer.hxx>
71 +#include <com/sun/star/script/XVBACompat.hpp>
78 -typedef ::cppu::WeakComponentImplHelper7<
79 +typedef ::cppu::WeakComponentImplHelper8<
80 ::com::sun::star::lang::XInitialization,
81 ::com::sun::star::script::XStorageBasedLibraryContainer,
82 ::com::sun::star::script::XLibraryContainerPassword,
83 ::com::sun::star::script::XLibraryContainerExport,
84 ::com::sun::star::container::XContainer,
85 ::com::sun::star::script::XLibraryQueryExecutable,
86 + ::com::sun::star::script::XVBACompat,
87 ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
89 typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
90 @@ -499,6 +502,10 @@ public:
91 throw (::com::sun::star::uno::RuntimeException);
92 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
93 throw (::com::sun::star::uno::RuntimeException) = 0;
95 + // Methods XVBACompat
96 + virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
97 + virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
100 class LibraryContainerMethodGuard
101 --- basic/source/uno/namecont.cxx.orig 2008-09-03 14:13:47.000000000 +0800
102 +++ basic/source/uno/namecont.cxx 2008-09-03 14:40:52.000000000 +0800
103 @@ -2681,6 +2681,35 @@ OUString SfxLibraryContainer::expand_url
107 +::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
109 + sal_Bool bVBACompat = sal_False;
110 + BasicManager* pBasMgr = getBasicManager();
113 + // get the standard library
114 + String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
115 + StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
117 + bVBACompat = pBasic->isVBAEnabled();
123 +void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
125 + BasicManager* pBasMgr = getBasicManager();
128 + // get the standard library
129 + String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
130 + StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
132 + pBasic->SetVBAEnabled( _vbacompatmodeon );
136 // Methods XServiceInfo
137 ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
138 throw (RuntimeException)
139 --- xmlscript/source/xmldlg_imexp/imp_share.hxx.orig 2008-09-05 15:24:41.000000000 +0800
140 +++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2008-09-05 15:25:18.000000000 +0800
142 #include <com/sun/star/awt/FontEmphasisMark.hpp>
143 #include <com/sun/star/awt/FontRelief.hpp>
144 #include <com/sun/star/xml/input/XRoot.hpp>
145 +#include <com/sun/star/script/XLibraryContainer.hpp>
149 @@ -132,6 +133,7 @@ struct DialogImport
150 css::uno::Reference< css::container::XNameContainer > _xDialogModel;
151 css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
152 css::uno::Reference< css::frame::XModel > _xDoc;
153 + css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
155 sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
157 @@ -177,6 +179,8 @@ public:
160 inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
162 + css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
164 virtual void SAL_CALL startDocument(
165 css::uno::Reference< css::xml::input::XNamespaceMapping >
166 --- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx.orig 2008-09-05 15:24:30.000000000 +0800
167 +++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx 2008-09-05 15:25:18.000000000 +0800
169 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
171 #include <com/sun/star/view/SelectionType.hpp>
172 +#include <com/sun/star/document/XStorageBasedDocument.hpp>
173 +#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
175 using namespace ::com::sun::star;
176 using namespace ::com::sun::star::uno;
177 @@ -1874,6 +1876,26 @@ Reference< xml::input::XElement > Dialog
181 +//__________________________________________________________________________________________________
182 +Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
184 + if( !_xScriptLibraryContainer.is() )
188 + Reference< document::XStorageBasedDocument > xStorageDoc( _xDoc, UNO_QUERY );
189 + if( xStorageDoc.is() )
190 + _xScriptLibraryContainer.set(
191 + script::DocumentScriptLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc ),
194 + catch( const Exception& )
199 + return _xScriptLibraryContainer;
202 //##################################################################################################
204 --- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.orig 2008-09-05 15:24:41.000000000 +0800
205 +++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2008-09-05 15:25:18.000000000 +0800
207 #include <com/sun/star/beans/XPropertyState.hpp>
208 #include <com/sun/star/document/XStorageBasedDocument.hpp>
209 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
210 +#include <com/sun/star/script/XVBACompat.hpp>
212 #include <comphelper/componentcontext.hxx>
213 #include <comphelper/processfactory.hxx>
214 @@ -96,7 +97,7 @@ bool IsPackageURL( const ::rtl::OUString
216 void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
218 - Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
219 + Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
220 if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
223 @@ -145,6 +146,18 @@ void importBindableAndListRangeBits( Dia
228 +sal_Bool isVBACompatModeOn( DialogImport* _pImport )
230 + sal_Bool bVBAMode = sal_False;
231 + Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
232 + if( xVBACompat.is() )
234 + bVBAMode = xVBACompat->getVBACompatModeOn();
240 //__________________________________________________________________________________________________
241 Reference< xml::input::XElement > ProgressBarElement::startChildElement(
242 @@ -1475,7 +1488,7 @@ void TitledBoxElement::endElement()
244 sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
245 // we should probably limit this to vba mode also ( leave for now )
246 - if ( _pImport->getDocOwner().is() )
247 + if ( isVBACompatModeOn( _pImport ) )
248 sService = OUSTR("com.sun.star.form.component.RadioButton");
250 catch( Exception& /*e*/ )
251 @@ -1620,7 +1633,7 @@ void RadioGroupElement::endElement()
253 sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
254 // we should probably limit this to vba mode also ( leave for now )
255 - if ( _pImport->getDocOwner().is() )
256 + if ( isVBACompatModeOn( _pImport ) )
257 sService = OUSTR("com.sun.star.form.component.RadioButton");
259 catch( Exception& /*e*/ )
260 @@ -1807,7 +1820,7 @@ void MenuListElement::endElement()
261 OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
263 // we should probably limit this to vba mode also ( leave for now )
264 - if ( _pImport->getDocOwner().is() )
265 + if ( isVBACompatModeOn( _pImport ) )
266 sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
269 @@ -1912,7 +1925,7 @@ void ComboBoxElement::endElement()
270 OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
272 // we should probably limit this to vba mode also ( leave for now )
273 - if ( _pImport->getDocOwner().is() )
274 + if ( isVBACompatModeOn( _pImport ) )
275 sService = OUSTR("com.sun.star.form.component.ComboBox");
277 OUString sLinkedCell;