1 --- basic/inc/basic/basmgr.hxx.old 2009-04-06 16:41:59.000000000 +0000
2 +++ basic/inc/basic/basmgr.hxx 2009-04-06 16:42:01.000000000 +0000
3 @@ -231,6 +231,8 @@ public:
4 ::com::sun::star::uno::Any
5 SetGlobalUNOConstant( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rValue );
7 + /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */
8 + bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
9 /** determines whether there are password-protected modules whose size exceedes the
11 @param _out_rModuleNames
12 --- basic/inc/basic/sbstar.hxx.old 2009-04-06 16:41:59.000000000 +0000
13 +++ basic/inc/basic/sbstar.hxx 2009-04-06 16:42:01.000000000 +0000
14 @@ -75,6 +75,10 @@ class StarBASIC : public SbxObject
16 BasicLibInfo* pLibInfo; // Infoblock fuer Basic-Manager
17 SbLanguageMode eLanguageMode; // LanguageMode des Basic-Objekts
19 + SbxObjectRef pVBAGlobals;
20 + SbxObject* getVBAGlobals( );
23 BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen );
25 @@ -199,6 +203,7 @@ public:
27 SbxObjectRef getRTL( void ) { return pRtl; }
28 BOOL IsDocBasic() { return bDocBasic; }
29 + SbxVariable* VBAFind( const String& rName, SbxClassType t );
32 #ifndef __SB_SBSTARBASICREF_HXX
33 --- basic/prj/d.lst.old 2009-04-02 10:49:18.000000000 +0000
34 +++ basic/prj/d.lst 2009-04-06 16:42:01.000000000 +0000
35 @@ -7,6 +7,8 @@ mkdir: %COMMON_DEST%\res%_EXT%
36 ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
37 ..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
38 ..\%__SRC%\slb\sb.lib %_DEST%\lib%_EXT%\xsb.lib
39 +..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
41 ..\%__SRC%\srs\classes.srs %_DEST%\res%_EXT%\basic.srs
42 ..\%COMMON_OUTDIR%\srs\classes_srs.hid %COMMON_DEST%\res%_EXT%\basic_srs.hid
43 ..\%__SRC%\bin\sb?????.dll %_DEST%\bin%_EXT%\sb?????.dll
44 @@ -56,4 +58,8 @@ mkdir: %_DEST%\inc%_EXT%\basic
45 ..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx
47 ..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx
48 +..\inc\basic\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\basic\vbacollectionimpl.hxx
49 +..\inc\basic\vbahelper.hxx %_DEST%\inc%_EXT%\basic\vbahelper.hxx
50 +..\inc\basic\helperdecl.hxx %_DEST%\inc%_EXT%\basic\helperdecl.hxx
51 +..\inc\basic\vbahelperinterface.hxx %_DEST%\inc%_EXT%\basic\vbahelperinterface.hxx
52 ..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx
53 --- basic/source/basmgr/basmgr.cxx.old 2009-04-06 16:41:59.000000000 +0000
54 +++ basic/source/basmgr/basmgr.cxx 2009-04-06 16:42:01.000000000 +0000
57 #include <basic/sbuno.hxx>
58 #include <basic/basmgr.hxx>
59 +#include <sbunoobj.hxx>
61 #include "sbintern.hxx"
63 @@ -1833,6 +1834,23 @@ BasicError* BasicManager::GetNextError()
64 DBG_CHKTHIS( BasicManager, 0 );
65 return pErrorMgr->GetNextError();
67 +bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut )
70 + StarBASIC* pStandardLib = GetStdLib();
71 + OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" );
74 + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
75 + SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pStandardLib->Find( sVarName, SbxCLASS_DONTCARE ) );
78 + aOut = pGlobs->getUnoAny();
85 Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const Any& _rValue )
87 --- basic/source/classes/sb.cxx.old 2009-04-06 16:41:59.000000000 +0000
88 +++ basic/source/classes/sb.cxx 2009-04-06 16:42:01.000000000 +0000
89 @@ -70,7 +70,29 @@ SV_IMPL_VARARR(SbTextPortions,SbTextPort
90 TYPEINIT1(StarBASIC,SbxObject)
92 #define RTLNAME "@SBRTL"
95 +const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
96 +const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
98 +SbxObject* StarBASIC::getVBAGlobals( )
100 + if ( !pVBAGlobals )
101 + pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE );
102 + return pVBAGlobals;
106 +SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t )
108 + if( rName == aThisComponent )
110 + // rename to init globals
111 + if ( getVBAGlobals( ) )
112 + return pVBAGlobals->Find( rName, t );
117 //========================================================================
118 // Array zur Umrechnung SFX <-> VB-Fehlercodes anlegen
119 @@ -609,6 +631,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL
120 pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
121 // Suche ueber StarBASIC ist immer global
122 SetFlag( SBX_GBLSEARCH );
123 + pVBAGlobals = NULL;
126 // #51727 SetModified ueberladen, damit der Modified-
127 --- basic/source/classes/sbxmod.cxx.old 2009-04-06 16:42:00.000000000 +0000
128 +++ basic/source/classes/sbxmod.cxx 2009-04-06 16:42:01.000000000 +0000
129 @@ -1781,13 +1781,20 @@ void SbUserFormModule::InitObject()
133 - if ( m_xModel.is() )
134 + String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
135 + SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
136 + if ( m_xModel.is() && pGlobs )
139 + uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
140 uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
141 uno::Sequence< uno::Any > aArgs(1);
142 aArgs[ 0 ] <<= m_xModel;
143 rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
144 - sDialogUrl = sDialogUrl.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
145 + rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
146 + if ( this->GetParent()->GetName().Len() )
147 + sProjectName = this->GetParent()->GetName();
148 + sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
150 uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
151 m_xDialog = xProvider->createDialog( sDialogUrl );
152 @@ -1797,7 +1804,7 @@ void SbUserFormModule::InitObject()
153 aArgs[ 0 ] = uno::Any();
154 aArgs[ 1 ] <<= m_xDialog;
155 aArgs[ 2 ] <<= m_xModel;
156 - pDocObject = new SbUnoObject( GetName(), uno::makeAny( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm")), aArgs ) ) );
157 + pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
158 uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
159 // remove old listener if it exists
160 FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
161 --- basic/source/inc/runtime.hxx.old 2009-04-06 16:42:00.000000000 +0000
162 +++ basic/source/inc/runtime.hxx 2009-04-06 16:42:01.000000000 +0000
163 @@ -206,7 +206,6 @@ class SbiInstance
164 BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
166 ComponentVector_t ComponentVector;
169 SbiRuntime* pRun; // Call-Stack
170 SbiInstance* pNext; // Instanzen-Chain
171 --- basic/source/runtime/methods.cxx.old 2009-04-06 16:42:00.000000000 +0000
172 +++ basic/source/runtime/methods.cxx 2009-04-06 16:42:01.000000000 +0000
173 @@ -844,6 +844,15 @@ RTLFUNC(SendKeys) // JSM
174 StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
177 +// Stub, basic already yields by default
183 + rPar.Get(0)->PutInteger( 0 );
189 --- basic/source/runtime/rtlproto.hxx.old 2009-04-06 16:42:00.000000000 +0000
190 +++ basic/source/runtime/rtlproto.hxx 2009-04-06 16:42:01.000000000 +0000
191 @@ -167,6 +167,7 @@ extern RTLFUNC(Kill); // JSM
192 extern RTLFUNC(MkDir); // JSM
193 extern RTLFUNC(RmDir); // JSM
194 extern RTLFUNC(SendKeys); // JSM
195 +extern RTLFUNC(DoEvents);
196 extern RTLFUNC(DimArray);
199 --- basic/source/runtime/stdobj.cxx.old 2009-04-06 16:42:00.000000000 +0000
200 +++ basic/source/runtime/stdobj.cxx 2009-04-06 16:42:01.000000000 +0000
201 @@ -478,6 +478,7 @@ static Methods aMethods[] = {
202 { "SendKeys", SbxNULL, 2 | _FUNCTION, RTLNAME(SendKeys),0 },
203 { "String", SbxSTRING, 0,NULL,0 },
204 { "Wait", SbxBOOL, _OPT, NULL,0 },
205 +{ "DoEvents", SbxINTEGER, 0 | _FUNCTION, RTLNAME(DoEvents),0 },
206 { "SetAttr", SbxNULL, 2 | _FUNCTION, RTLNAME(SetAttr),0 },
207 { "File" , SbxSTRING, 0,NULL,0 },
208 { "Attributes", SbxINTEGER, 0,NULL,0 },
209 --- basic/source/runtime/step2.cxx.old 2009-04-02 10:49:15.000000000 +0000
210 +++ basic/source/runtime/step2.cxx 2009-04-06 16:42:01.000000000 +0000
211 @@ -56,57 +56,6 @@ using com::sun::star::uno::Reference;
213 SbxVariable* getVBAConstant( const String& rName );
215 -const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
216 -const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
218 -SbxArray* getVBAGlobals( )
220 - static SbxArrayRef pArray;
221 - static bool isInitialised = false;
222 - if ( isInitialised )
224 - Reference < XComponentContext > xCtx;
225 - Reference < XPropertySet > xProps(
226 - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
227 - xCtx.set( xProps->getPropertyValue( rtl::OUString(
228 - RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
230 - SbUnoObject dGlobs( String( RTL_CONSTASCII_USTRINGPARAM("ExcelGlobals") ), xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) );
232 - SbxVariable *vba = dGlobs.Find( String( RTL_CONSTASCII_USTRINGPARAM("getGlobals") ) , SbxCLASS_DONTCARE );
236 - pArray = static_cast<SbxArray *>(vba->GetObject());
237 - isInitialised = true;
244 -SbxVariable* VBAFind( const String& rName, SbxClassType t )
246 - if( rName == aThisComponent )
249 - SbxArray *pVBAGlobals = getVBAGlobals( );
250 - for (USHORT i = 0; pVBAGlobals && i < pVBAGlobals->Count(); i++)
252 - SbxVariable *pElem = pVBAGlobals->Get( i );
253 - if (!pElem || !pElem->IsObject())
255 - SbxObject *pVba = static_cast<SbxObject *>(pElem->GetObject());
256 - SbxVariable *pVbaVar = pVba ? pVba->Find( rName, t ) : NULL;
266 // Suchen eines Elements
267 // Die Bits im String-ID:
268 // 0x8000 - Argv ist belegt
269 @@ -191,7 +140,7 @@ SbxVariable* SbiRuntime::FindElement
272 // Try Find in VBA symbols space
273 - pElem = VBAFind( aName, SbxCLASS_DONTCARE );
274 + pElem = rBasic.VBAFind( aName, SbxCLASS_DONTCARE );
276 bSetName = false; // don't overwrite uno name
278 --- forms/source/misc/InterfaceContainer.cxx.old 2009-04-06 16:41:59.000000000 +0000
279 +++ forms/source/misc/InterfaceContainer.cxx 2009-04-06 16:42:01.000000000 +0000
280 @@ -132,9 +132,8 @@ OInterfaceContainer::fakeVbaEventsHack(
281 // we'll ignore, we'll get called back here anyway )
282 Reference< XChild > xChild( xForm->getParent(), UNO_QUERY_THROW );
283 Reference< XModel > xDocOwner( xChild->getParent(), UNO_QUERY );
284 - Reference< XCodeNameQuery > xNameQuery( xDocOwner, UNO_QUERY );
285 OSL_TRACE(" Is DOC ????? %s", xDocOwner.is() ? "true" : "false" );
286 - if ( xDocOwner.is() && xNameQuery.is() )
287 + if ( xDocOwner.is() )
289 bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( _nIndex ) );
290 if ( hasVBABindings )
291 @@ -143,12 +142,14 @@ OInterfaceContainer::fakeVbaEventsHack(
294 Reference< XMultiServiceFactory > xFac( comphelper::getProcessServiceFactory(), UNO_QUERY );
296 + Reference< XMultiServiceFactory > xDocFac( xDocOwner, UNO_QUERY );
297 + if ( xFac.is() && xDocFac.is() )
301 Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW );
302 Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW );
303 + Reference< XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), UNO_QUERY_THROW );
304 rtl::OUString sCodeName;
305 sCodeName = xNameQuery->getCodeNameForObject( xIf );
306 Reference< XPropertySet > xProps( xIf, UNO_QUERY );
307 --- offapi/com/sun/star/document/XCompatWriterDocProperties.idl.old 1970-01-01 00:00:00.000000000 +0000
308 +++ offapi/com/sun/star/document/XCompatWriterDocProperties.idl 2009-04-06 16:42:01.000000000 +0000
310 +/*************************************************************************
312 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
314 + * Copyright 2008 by Sun Microsystems, Inc.
316 + * OpenOffice.org - a multi-platform office productivity suite
318 + * $RCSfile: XDocumentProperties.idl,v $
321 + * This file is part of OpenOffice.org.
323 + * OpenOffice.org is free software: you can redistribute it and/or modify
324 + * it under the terms of the GNU Lesser General Public License version 3
325 + * only, as published by the Free Software Foundation.
327 + * OpenOffice.org is distributed in the hope that it will be useful,
328 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
329 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
330 + * GNU Lesser General Public License version 3 for more details
331 + * (a copy is included in the LICENSE file that accompanied this code).
333 + * You should have received a copy of the GNU Lesser General Public License
334 + * version 3 along with OpenOffice.org. If not, see
335 + * <http://www.openoffice.org/license.html>
336 + * for a copy of the LGPLv3 License.
338 + ************************************************************************/
339 +#ifndef __com_sun_star_document_XCompatWriterDocProperties_idl__
340 +#define __com_sun_star_document_XCompatWriterDocProperties_idl__
342 +#ifndef __com_sun_star_document_XDocumentProperties_idl__
343 +#include <com/sun/star/document/XDocumentProperties.idl>
345 +//=============================================================================
347 +module com { module sun { module star { module document {
348 +interface XCompatWriterDocProperties
350 +// interface ::com::sun::star::document::XDocumentProperties;
351 + [attribute] string Manager;
352 + [attribute] string Category;
353 + [attribute] string Company;
359 --- offapi/com/sun/star/document/makefile.mk.old 2009-04-06 16:42:00.000000000 +0000
360 +++ offapi/com/sun/star/document/makefile.mk 2009-04-06 16:42:01.000000000 +0000
361 @@ -118,6 +118,7 @@ IDLFILES=\
362 XDocumentLanguages.idl \
364 XDocumentEventCompatibleHelper.idl \
365 + XCompatWriterDocProperties.idl \
367 XVbaEventsHelper.idl \
368 VbaEventsHelper.idl \
369 --- oovbaapi/ooo/vba/ControlProvider.idl.old 1970-01-01 00:00:00.000000000 +0000
370 +++ oovbaapi/ooo/vba/ControlProvider.idl 2009-04-06 16:42:01.000000000 +0000
372 +/*************************************************************************
374 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
376 + * Copyright 2008 by Sun Microsystems, Inc.
378 + * OpenOffice.org - a multi-platform office productivity suite
380 + * $RCSfile: XGlobals.idl,v $
383 + * This file is part of OpenOffice.org.
385 + * OpenOffice.org is free software: you can redistribute it and/or modify
386 + * it under the terms of the GNU Lesser General Public License version 3
387 + * only, as published by the Free Software Foundation.
389 + * OpenOffice.org is distributed in the hope that it will be useful,
390 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
391 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
392 + * GNU Lesser General Public License version 3 for more details
393 + * (a copy is included in the LICENSE file that accompanied this code).
395 + * You should have received a copy of the GNU Lesser General Public License
396 + * version 3 along with OpenOffice.org. If not, see
397 + * <http://www.openoffice.org/license.html>
398 + * for a copy of the LGPLv3 License.
400 + ************************************************************************/
401 +#ifndef __ooo_vba_ControlProvider_idl__
402 +#define __ooo_vba_ControlProvider_idl__
404 +#ifndef __com_sun_star_uno_XInterface_idl__
405 +#include <com/sun/star/uno/XInterface.idl>
408 +#ifndef __com_sun_star_frame_XModel_idl__
409 +#include <com/sun/star/frame/XModel.idl>
413 +module ooo { module vba {
415 +interface XControlProvider;
417 +service ControlProvider
419 + interface ::ooo::vba::XControlProvider;
426 --- oovbaapi/ooo/vba/Globals.idl.old 2009-04-02 10:36:29.000000000 +0000
427 +++ oovbaapi/ooo/vba/Globals.idl 1970-01-01 00:00:00.000000000 +0000
429 -/*************************************************************************
431 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
433 - * Copyright 2008 by Sun Microsystems, Inc.
435 - * OpenOffice.org - a multi-platform office productivity suite
437 - * $RCSfile: Globals.idl,v $
440 - * This file is part of OpenOffice.org.
442 - * OpenOffice.org is free software: you can redistribute it and/or modify
443 - * it under the terms of the GNU Lesser General Public License version 3
444 - * only, as published by the Free Software Foundation.
446 - * OpenOffice.org is distributed in the hope that it will be useful,
447 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
448 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
449 - * GNU Lesser General Public License version 3 for more details
450 - * (a copy is included in the LICENSE file that accompanied this code).
452 - * You should have received a copy of the GNU Lesser General Public License
453 - * version 3 along with OpenOffice.org. If not, see
454 - * <http://www.openoffice.org/license.html>
455 - * for a copy of the LGPLv3 License.
457 - ************************************************************************/
459 -#ifndef __ooo_vba_Globals_idl__
460 -#define __ooo_vba_Globals_idl__
462 -#ifndef __ooo_vba_XGlobals_idl__
463 -#include <ooo/vba/XGlobals.idl>
466 -#include <com/sun/star/uno/XComponentContext.idl>
467 -#include <com/sun/star/table/XCellRange.idl>
469 -module ooo { module vba {
470 -service Globals : XGlobals
477 --- oovbaapi/ooo/vba/XApplicationBase.idl.old 1970-01-01 00:00:00.000000000 +0000
478 +++ oovbaapi/ooo/vba/XApplicationBase.idl 2009-04-06 16:42:01.000000000 +0000
480 +/*************************************************************************
482 + * OpenOffice.org - a multi-platform office productivity suite
488 + * last change: $Author$ $Date$
490 + * The Contents of this file are made available subject to
491 + * the terms of GNU Lesser General Public License Version 2.1.
494 + * GNU Lesser General Public License Version 2.1
495 + * =============================================
496 + * Copyright 2005 by Sun Microsystems, Inc.
497 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
499 + * This library is free software; you can redistribute it and/or
500 + * modify it under the terms of the GNU Lesser General Public
501 + * License version 2.1, as published by the Free Software Foundation.
503 + * This library is distributed in the hope that it will be useful,
504 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
505 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
506 + * Lesser General Public License for more details.
508 + * You should have received a copy of the GNU Lesser General Public
509 + * License along with this library; if not, write to the Free Software
510 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
511 + * MA 02111-1307 USA
513 + ************************************************************************/
514 +#ifndef __ooo_vba_XApplicationBase_idl__
515 +#define __ooo_vba_XApplicationBase_idl__
517 +#ifndef __com_sun_star_uno_XInterface_idl__
518 +#include <com/sun/star/uno/XInterface.idl>
521 +#ifndef __ooo_vba_XHelperInterface_idl__
522 +#include <ooo/vba/XHelperInterface.idl>
525 +module ooo { module vba {
526 +//=============================================================================
528 +interface XApplicationBase
530 + interface ::ooo::vba::XHelperInterface;
532 + [attribute] boolean ScreenUpdating;
533 + [attribute] boolean DisplayStatusBar;
535 + any CommandBars( [in] any aIndex );
541 --- oovbaapi/ooo/vba/XControlProvider.idl.old 1970-01-01 00:00:00.000000000 +0000
542 +++ oovbaapi/ooo/vba/XControlProvider.idl 2009-04-06 16:42:01.000000000 +0000
544 +/*************************************************************************
546 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
548 + * Copyright 2008 by Sun Microsystems, Inc.
550 + * OpenOffice.org - a multi-platform office productivity suite
552 + * $RCSfile: XGlobals.idl,v $
555 + * This file is part of OpenOffice.org.
557 + * OpenOffice.org is free software: you can redistribute it and/or modify
558 + * it under the terms of the GNU Lesser General Public License version 3
559 + * only, as published by the Free Software Foundation.
561 + * OpenOffice.org is distributed in the hope that it will be useful,
562 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
563 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
564 + * GNU Lesser General Public License version 3 for more details
565 + * (a copy is included in the LICENSE file that accompanied this code).
567 + * You should have received a copy of the GNU Lesser General Public License
568 + * version 3 along with OpenOffice.org. If not, see
569 + * <http://www.openoffice.org/license.html>
570 + * for a copy of the LGPLv3 License.
572 + ************************************************************************/
573 +#ifndef __ooo_vba_XControlProvider_idl__
574 +#define __ooo_vba_XControlProvider_idl__
576 +#ifndef __com_sun_star_uno_XInterface_idl__
577 +#include <com/sun/star/uno/XInterface.idl>
580 +#ifndef __com_sun_star_frame_XModel_idl__
581 +#include <com/sun/star/frame/XModel.idl>
584 +#ifndef __com_sun_star_awt_XControl_idl__
585 +#include <com/sun/star/awt/XControl.idl>
588 +#ifndef __com_sun_star_drawing_XControlShape_idl__
589 +#include <com/sun/star/drawing/XControlShape.idl>
591 +#ifndef __ooo_vba_msforms_XControl_idl__
592 +#include <ooo/vba/msforms/XControl.idl>
595 +module ooo { module vba {
597 +interface XControlProvider
599 + ::ooo::vba::msforms::XControl createControl( [in] ::com::sun::star::drawing::XControlShape xControl, [in] ::com::sun::star::frame::XModel xDocOwner );
600 + ::ooo::vba::msforms::XControl createUserformControl( [in] ::com::sun::star::awt::XControl xControl, [in] ::com::sun::star::awt::XControl xDialog, [in] ::com::sun::star::frame::XModel xDocOwner );
608 --- oovbaapi/ooo/vba/XDocumentBase.idl.old 1970-01-01 00:00:00.000000000 +0000
609 +++ oovbaapi/ooo/vba/XDocumentBase.idl 2009-04-06 16:42:01.000000000 +0000
611 +/*************************************************************************
613 + * OpenOffice.org - a multi-platform office productivity suite
619 + * last change: $Author$ $Date$
621 + * The Contents of this file are made available subject to
622 + * the terms of GNU Lesser General Public License Version 2.1.
625 + * GNU Lesser General Public License Version 2.1
626 + * =============================================
627 + * Copyright 2005 by Sun Microsystems, Inc.
628 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
630 + * This library is free software; you can redistribute it and/or
631 + * modify it under the terms of the GNU Lesser General Public
632 + * License version 2.1, as published by the Free Software Foundation.
634 + * This library is distributed in the hope that it will be useful,
635 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
636 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
637 + * Lesser General Public License for more details.
639 + * You should have received a copy of the GNU Lesser General Public
640 + * License along with this library; if not, write to the Free Software
641 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
642 + * MA 02111-1307 USA
644 + ************************************************************************/
645 +#ifndef __ooo_vba_XDocumentBase_idl__
646 +#define __ooo_vba_XDocumentBase_idl__
648 +#ifndef __com_sun_star_uno_XInterface_idl__
649 +#include <com/sun/star/uno/XInterface.idl>
652 +#ifndef __ooo_vba_XHelperInterface_idl__
653 +#include <ooo/vba/XHelperInterface.idl>
656 +module ooo { module vba {
657 +//=============================================================================
659 +interface XDocumentBase
661 + interface ::ooo::vba::XHelperInterface;
663 + [attribute, readonly] string Name;
664 + [attribute, readonly] string Path;
665 + [attribute, readonly] string FullName;
666 + [attribute] boolean Saved;
668 + void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
671 + void Protect( [in] any Password );
672 + void Unprotect( [in] any Password );
678 --- oovbaapi/ooo/vba/XDocumentProperties.idl.old 1970-01-01 00:00:00.000000000 +0000
679 +++ oovbaapi/ooo/vba/XDocumentProperties.idl 2009-04-06 16:42:01.000000000 +0000
681 +/*************************************************************************
683 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
685 + * Copyright 2008 by Sun Microsystems, Inc.
687 + * OpenOffice.org - a multi-platform office productivity suite
689 + * $RCSfile: XDocument.idl,v $
692 + * This file is part of OpenOffice.org.
694 + * OpenOffice.org is free software: you can redistribute it and/or modify
695 + * it under the terms of the GNU Lesser General Public License version 3
696 + * only, as published by the Free Software Foundation.
698 + * OpenOffice.org is distributed in the hope that it will be useful,
699 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
700 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
701 + * GNU Lesser General Public License version 3 for more details
702 + * (a copy is included in the LICENSE file that accompanied this code).
704 + * You should have received a copy of the GNU Lesser General Public License
705 + * version 3 along with OpenOffice.org. If not, see
706 + * <http://www.openoffice.org/license.html>
707 + * for a copy of the LGPLv3 License.
709 + ************************************************************************/
711 +#ifndef __ooo_vba_XDocumentProperties_idl__
712 +#define __ooo_vba_XDocumentProperties_idl__
714 +#ifndef __com_sun_star_script_BasicErrorException_idl__
715 +#include <com/sun/star/script/BasicErrorException.idl>
717 +#ifndef __ooo_vba_XHelperInterface_idl__
718 +#include <ooo/vba/XHelperInterface.idl>
720 +#ifndef __ooo_vba_XCollection_idl__
721 +#include <ooo/vba/XCollection.idl>
724 +module ooo { module vba {
725 +interface XDocumentProperty;
726 +interface XDocumentProperties
728 + interface XCollection;
729 + /** Creates a new custom document property.
730 + * You can only add a new document property to the custom DocumentProperties collection. Depending on value of
731 + * boolean LinkSource, either (False) Value or (True) LinkSource must be provided.
732 + * @param Name (Required String. The name of the property.
733 + * @param LinkToContent Specifies whether the property is linked to the contents of the container document. If this argument is True, the LinkSource argument is required; if it's False, the value argument is required.
734 + * @param Type The data type of the property. Can be one of the following MsoDocProperties constants:
735 + * msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat, msoPropertyTypeNumber, or msoPropertyTypeString.
736 + * @param Value The value of the property, if it's not linked to the contents of the container document.
737 + * The value is converted to match the data type specified by the type argument, if it can't be converted, an error occurs.
738 + * If LinkToContent is True, the Value argument is ignored and the new document property is assigned a default value
739 + * until the linked property values are updated by the container application (usually when the document is saved).
740 + * @param LinkSource Ignored if LinkToContent is False. The source of the linked property. The container application determines
741 + * what types of source linking you can use.
743 + XDocumentProperty Add([in] string Name, [in] boolean LinkToContent, [in] /* MsoDocProperties */ byte Type, [in] any Value,
744 + [in] /*optional*/ any LinkSource)
745 + raises (com::sun::star::script::BasicErrorException);
752 --- oovbaapi/ooo/vba/XDocumentProperty.idl.old 1970-01-01 00:00:00.000000000 +0000
753 +++ oovbaapi/ooo/vba/XDocumentProperty.idl 2009-04-06 16:42:01.000000000 +0000
755 +/*************************************************************************
757 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
759 + * Copyright 2008 by Sun Microsystems, Inc.
761 + * OpenOffice.org - a multi-platform office productivity suite
763 + * $RCSfile: XDocument.idl,v $
766 + * This file is part of OpenOffice.org.
768 + * OpenOffice.org is free software: you can redistribute it and/or modify
769 + * it under the terms of the GNU Lesser General Public License version 3
770 + * only, as published by the Free Software Foundation.
772 + * OpenOffice.org is distributed in the hope that it will be useful,
773 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
774 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
775 + * GNU Lesser General Public License version 3 for more details
776 + * (a copy is included in the LICENSE file that accompanied this code).
778 + * You should have received a copy of the GNU Lesser General Public License
779 + * version 3 along with OpenOffice.org. If not, see
780 + * <http://www.openoffice.org/license.html>
781 + * for a copy of the LGPLv3 License.
783 + ************************************************************************/
785 +#ifndef __ooo_vba_XDocumentProperty_idl__
786 +#define __ooo_vba_XDocumentProperty_idl__
788 +#ifndef __com_sun_star_script_BasicErrorException_idl__
789 +#include <com/sun/star/script/BasicErrorException.idl>
791 +#ifndef __com_sun_star_script_XDefaultProperty_idl__
792 +#include <com/sun/star/script/XDefaultProperty.idl>
794 +#ifndef __ooo_vba_XHelperInterface_idl__
795 +#include <ooo/vba/XHelperInterface.idl>
798 +module ooo { module vba {
801 + * Specific built-in document property. Use CustomDocumentProperties(index),
802 + * where index is the name or index number of the custom document property,
803 + * to return a DocumentProperty object that represents a specific custom document property.
805 +interface XDocumentProperty
808 + interface com::sun::star::script::XDefaultProperty;
809 + interface ooo::vba::XHelperInterface;
812 + raises (com::sun::star::script::BasicErrorException);
814 + /** Required String. The name of the property.
817 + raises (com::sun::star::script::BasicErrorException);
819 + void setName([in] string Name)
820 + raises (com::sun::star::script::BasicErrorException);
822 + /** The data type of the property.
823 + * Can be one of the following MsoDocProperties constants:
824 + * msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat,
825 + * msoPropertyTypeNumber, or msoPropertyTypeString.
828 + raises (com::sun::star::script::BasicErrorException);
830 + void setType([in] byte Type)
831 + raises (com::sun::star::script::BasicErrorException);
833 + /** If true, then LinkSource has a valid value. */
834 + boolean getLinkToContent()
835 + raises (com::sun::star::script::BasicErrorException);
837 + void setLinkToContent([in] boolean LinkToContent)
838 + raises (com::sun::star::script::BasicErrorException);
840 + /** If LinkToContent is false, then this contains the value of the property
841 + * The data type of the value will match the Type property.
844 + raises (com::sun::star::script::BasicErrorException);
846 + void setValue([in] any Value)
847 + raises (com::sun::star::script::BasicErrorException);
849 + /** If LinkToContent is false, then this contains the value of the property */
850 + string getLinkSource()
851 + raises (com::sun::star::script::BasicErrorException);
853 + void setLinkSource([in] string LinkSource)
854 + raises (com::sun::star::script::BasicErrorException);
861 --- oovbaapi/ooo/vba/XGlobals.idl.old 2009-04-02 10:36:29.000000000 +0000
862 +++ oovbaapi/ooo/vba/XGlobals.idl 1970-01-01 00:00:00.000000000 +0000
864 -/*************************************************************************
866 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
868 - * Copyright 2008 by Sun Microsystems, Inc.
870 - * OpenOffice.org - a multi-platform office productivity suite
872 - * $RCSfile: XGlobals.idl,v $
875 - * This file is part of OpenOffice.org.
877 - * OpenOffice.org is free software: you can redistribute it and/or modify
878 - * it under the terms of the GNU Lesser General Public License version 3
879 - * only, as published by the Free Software Foundation.
881 - * OpenOffice.org is distributed in the hope that it will be useful,
882 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
883 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
884 - * GNU Lesser General Public License version 3 for more details
885 - * (a copy is included in the LICENSE file that accompanied this code).
887 - * You should have received a copy of the GNU Lesser General Public License
888 - * version 3 along with OpenOffice.org. If not, see
889 - * <http://www.openoffice.org/license.html>
890 - * for a copy of the LGPLv3 License.
892 - ************************************************************************/
893 -#ifndef __ooo_vba_XGlobals_idl__
894 -#define __ooo_vba_XGlobals_idl__
896 -#ifndef __com_sun_star_uno_XInterface_idl__
897 -#include <com/sun/star/uno/XInterface.idl>
899 -#ifndef __ooo_vba_excel_XApplication_idl__
900 -#include <ooo/vba/excel/XApplication.idl>
902 -#ifndef __ooo_vba_excel_XWorkbook_idl__
903 -#include <ooo/vba/excel/XWorkbook.idl>
905 -#ifndef __ooo_vba_excel_XWorksheet_idl__
906 -#include <ooo/vba/excel/XWorksheet.idl>
909 -module ooo { module vba {
911 -interface XGlobals: com::sun::star::uno::XInterface
913 - // FIXME, need better way to expose globals
914 - sequence< any > getGlobals();
916 - [attribute, readonly] ooo::vba::excel::XApplication Application;
917 - [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook;
918 - [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet;
919 - any WorkSheets( [in] any aIndex );
920 - any WorkBooks( [in] any aIndex );
921 - any Sheets( [in] any aIndex );
922 - any Range( [in] any Cell1, [in] any Cell2 );
923 - any Names( [in] any Index );
931 --- oovbaapi/ooo/vba/XGlobalsBase.idl.old 1970-01-01 00:00:00.000000000 +0000
932 +++ oovbaapi/ooo/vba/XGlobalsBase.idl 2009-04-06 16:42:01.000000000 +0000
934 +/*************************************************************************
936 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
938 + * Copyright 2008 by Sun Microsystems, Inc.
940 + * OpenOffice.org - a multi-platform office productivity suite
942 + * $RCSfile: XGlobals.idl,v $
945 + * This file is part of OpenOffice.org.
947 + * OpenOffice.org is free software: you can redistribute it and/or modify
948 + * it under the terms of the GNU Lesser General Public License version 3
949 + * only, as published by the Free Software Foundation.
951 + * OpenOffice.org is distributed in the hope that it will be useful,
952 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
953 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
954 + * GNU Lesser General Public License version 3 for more details
955 + * (a copy is included in the LICENSE file that accompanied this code).
957 + * You should have received a copy of the GNU Lesser General Public License
958 + * version 3 along with OpenOffice.org. If not, see
959 + * <http://www.openoffice.org/license.html>
960 + * for a copy of the LGPLv3 License.
962 + ************************************************************************/
963 +#ifndef __ooo_vba_XGlobalsBase_idl__
964 +#define __ooo_vba_XGlobalsBase_idl__
966 +#ifndef __com_sun_star_uno_XInterface_idl__
967 +#include <com/sun/star/uno/XInterface.idl>
969 +#ifndef __ooo_vba_XHelperInterface_idl__
970 +#include <ooo/vba/XHelperInterface.idl>
972 +#ifndef __com_sun_star_lang_XMultiServiceFactory
973 +#include <com/sun/star/lang/XMultiServiceFactory.idl>
975 +module ooo { module vba {
976 +interface XGlobalsBase
978 + interface ::ooo::vba::XHelperInterface;
979 + interface ::com::sun::star::lang::XMultiServiceFactory;
987 --- oovbaapi/ooo/vba/XWindowBase.idl.old 1970-01-01 00:00:00.000000000 +0000
988 +++ oovbaapi/ooo/vba/XWindowBase.idl 2009-04-06 16:42:01.000000000 +0000
990 +/*************************************************************************
992 + * OpenOffice.org - a multi-platform office productivity suite
998 + * last change: $Author$ $Date$
1000 + * The Contents of this file are made available subject to
1001 + * the terms of GNU Lesser General Public License Version 2.1.
1004 + * GNU Lesser General Public License Version 2.1
1005 + * =============================================
1006 + * Copyright 2005 by Sun Microsystems, Inc.
1007 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1009 + * This library is free software; you can redistribute it and/or
1010 + * modify it under the terms of the GNU Lesser General Public
1011 + * License version 2.1, as published by the Free Software Foundation.
1013 + * This library is distributed in the hope that it will be useful,
1014 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1015 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1016 + * Lesser General Public License for more details.
1018 + * You should have received a copy of the GNU Lesser General Public
1019 + * License along with this library; if not, write to the Free Software
1020 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1021 + * MA 02111-1307 USA
1023 + ************************************************************************/
1024 +#ifndef __ooo_vba_XHelperWindow_idl__
1025 +#define __ooo_vba_XHelperWindow_idl__
1027 +#ifndef __com_sun_star_uno_XInterface_idl__
1028 +#include <com/sun/star/uno/XInterface.idl>
1031 +#ifndef __ooo_vba_XHelperInterface_idl__
1032 +#include <ooo/vba/XHelperInterface.idl>
1035 +module ooo { module vba {
1036 +//=============================================================================
1038 +interface XWindowBase
1040 + interface ::ooo::vba::XHelperInterface;
1042 + [attribute] long Height;
1043 + [attribute] long Left;
1044 + [attribute] long Top;
1045 + [attribute] boolean Visible;
1046 + [attribute] long Width;
1052 --- oovbaapi/ooo/vba/excel/Globals.idl.old 1970-01-01 00:00:00.000000000 +0000
1053 +++ oovbaapi/ooo/vba/excel/Globals.idl 2009-04-06 16:42:01.000000000 +0000
1055 +/*************************************************************************
1057 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1059 + * Copyright 2008 by Sun Microsystems, Inc.
1061 + * OpenOffice.org - a multi-platform office productivity suite
1063 + * $RCSfile: Globals.idl,v $
1064 + * $Revision: 1.3 $
1066 + * This file is part of OpenOffice.org.
1068 + * OpenOffice.org is free software: you can redistribute it and/or modify
1069 + * it under the terms of the GNU Lesser General Public License version 3
1070 + * only, as published by the Free Software Foundation.
1072 + * OpenOffice.org is distributed in the hope that it will be useful,
1073 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1074 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1075 + * GNU Lesser General Public License version 3 for more details
1076 + * (a copy is included in the LICENSE file that accompanied this code).
1078 + * You should have received a copy of the GNU Lesser General Public License
1079 + * version 3 along with OpenOffice.org. If not, see
1080 + * <http://www.openoffice.org/license.html>
1081 + * for a copy of the LGPLv3 License.
1083 + ************************************************************************/
1085 +#ifndef __ooo_vba_excel_Globals_idl__
1086 +#define __ooo_vba_excel_Globals_idl__
1088 +#ifndef __ooo_vba_excel_XGlobals_idl__
1089 +#include <ooo/vba/excel/XGlobals.idl>
1092 +#include <com/sun/star/uno/XComponentContext.idl>
1093 +#include <com/sun/star/table/XCellRange.idl>
1095 +module ooo { module vba { module excel {
1096 +service Globals : XGlobals
1103 --- oovbaapi/ooo/vba/excel/XApplication.idl.old 2009-04-06 16:41:59.000000000 +0000
1104 +++ oovbaapi/ooo/vba/excel/XApplication.idl 2009-04-06 16:42:01.000000000 +0000
1106 #include <ooo/vba/XAssistant.idl>
1109 -#ifndef __ooo_vba_XCommandBars_idl__
1110 -#include <ooo/vba/XCommandBars.idl>
1113 module ooo { module vba { module excel {
1116 @@ -56,10 +52,10 @@ interface XWorksheetFunction;
1118 interface XWorksheet;
1120 -interface XApplication
1121 +interface XApplication : com::sun::star::uno::XInterface
1124 - interface ::ooo::vba::XHelperInterface;
1125 +// interface ::ooo::vba::XHelperInterface;
1127 [attribute, readonly] any Selection;
1128 [attribute, readonly] XWorkbook ActiveWorkbook;
1129 @@ -74,8 +70,6 @@ interface XApplication
1130 // to determine this
1131 [attribute, readonly] XWorkbook ThisWorkbook;
1132 [attribute, readonly] string Name;
1133 - [attribute] boolean ScreenUpdating;
1134 - [attribute] boolean DisplayStatusBar;
1135 [attribute] boolean DisplayAlerts;
1136 [attribute] boolean DisplayFormulaBar;
1137 [attribute] any CutCopyMode;
1138 @@ -90,7 +84,7 @@ interface XApplication
1139 string LibraryPath() raises(com::sun::star::script::BasicErrorException);
1140 string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
1141 string PathSeparator() raises(com::sun::star::script::BasicErrorException);
1142 - any CommandBars( [in] any aIndex );
1143 + //any CommandBars( [in] any aIndex );
1144 any Workbooks( [in] any aIndex );
1145 any Worksheets( [in] any aIndex );
1146 any Windows( [in] any aIndex );
1147 @@ -109,7 +103,6 @@ interface XApplication
1148 XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
1149 raises(com::sun::star::script::BasicErrorException);
1150 void Volatile([in] any Volatile);
1152 any Caller( [in] any aIndex );
1155 --- oovbaapi/ooo/vba/excel/XGlobals.idl.old 1970-01-01 00:00:00.000000000 +0000
1156 +++ oovbaapi/ooo/vba/excel/XGlobals.idl 2009-04-06 16:42:01.000000000 +0000
1158 +/*************************************************************************
1160 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1162 + * Copyright 2008 by Sun Microsystems, Inc.
1164 + * OpenOffice.org - a multi-platform office productivity suite
1166 + * $RCSfile: XGlobals.idl,v $
1167 + * $Revision: 1.4 $
1169 + * This file is part of OpenOffice.org.
1171 + * OpenOffice.org is free software: you can redistribute it and/or modify
1172 + * it under the terms of the GNU Lesser General Public License version 3
1173 + * only, as published by the Free Software Foundation.
1175 + * OpenOffice.org is distributed in the hope that it will be useful,
1176 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1177 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1178 + * GNU Lesser General Public License version 3 for more details
1179 + * (a copy is included in the LICENSE file that accompanied this code).
1181 + * You should have received a copy of the GNU Lesser General Public License
1182 + * version 3 along with OpenOffice.org. If not, see
1183 + * <http://www.openoffice.org/license.html>
1184 + * for a copy of the LGPLv3 License.
1186 + ************************************************************************/
1187 +#ifndef __ooo_vba_excel_XGlobals_idl__
1188 +#define __ooo_vba_excel_XGlobals_idl__
1190 +#ifndef __com_sun_star_uno_XInterface_idl__
1191 +#include <com/sun/star/uno/XInterface.idl>
1193 +#ifndef __com_sun_star_script_BasicErrorException_idl__
1194 +#include <com/sun/star/script/BasicErrorException.idl>
1196 +#ifndef __ooo_vba_excel_XWorkbook_idl__
1197 +#include <ooo/vba/excel/XWorkbook.idl>
1199 +#ifndef __ooo_vba_excel_XWorksheet_idl__
1200 +#include <ooo/vba/excel/XWorksheet.idl>
1202 +#ifndef __ooo_vba_XAssistant_idl__
1203 +#include <ooo/vba/XAssistant.idl>
1206 +module ooo { module vba { module excel {
1209 +interface XGlobals: com::sun::star::uno::XInterface
1211 + [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook;
1212 + [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet;
1213 + [attribute, readonly] ooo::vba::excel::XWindow ActiveWindow;
1214 + [attribute, readonly] ooo::vba::excel::XRange ActiveCell;
1215 + [attribute, readonly] ooo::vba::XAssistant Assistant;
1216 + [attribute, readonly] any Selection;
1217 + [attribute, readonly] XWorkbook ThisWorkbook;
1219 + void Calculate() raises(com::sun::star::script::BasicErrorException);
1220 + XRange Cells([in] any RowIndex, [in] any ColumnIndex);
1221 + XRange Columns([in] any aIndex);
1222 + any CommandBars( [in] any aIndex );
1223 + any Evaluate( [in] string Name );
1224 +XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
1225 + raises(com::sun::star::script::BasicErrorException);
1226 + any WorkSheets( [in] any aIndex );
1227 + any WorkBooks( [in] any aIndex );
1228 + any WorksheetFunction();
1229 + any Windows( [in] any aIndex );
1230 + any Sheets( [in] any aIndex );
1231 + any Range( [in] any Cell1, [in] any Cell2 );
1232 + XRange Rows([in] any aIndex);
1233 + any Names( [in] any Index );
1234 + XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
1235 + raises(com::sun::star::script::BasicErrorException);
1244 --- oovbaapi/ooo/vba/excel/XWindow.idl.old 2009-04-02 10:36:29.000000000 +0000
1245 +++ oovbaapi/ooo/vba/excel/XWindow.idl 2009-04-06 16:42:01.000000000 +0000
1246 @@ -46,10 +46,8 @@ module ooo { module vba { module excel
1248 interface XWorksheet;
1251 +interface XWindow : com::sun::star::uno::XInterface
1253 - interface ::ooo::vba::XHelperInterface;
1255 [attribute] any Caption;
1256 [attribute] boolean DisplayGridlines;
1257 [attribute] boolean DisplayHeadings;
1258 @@ -58,8 +56,6 @@ interface XWindow
1259 [attribute] boolean DisplayVerticalScrollBar;
1260 [attribute] boolean DisplayWorkbookTabs;
1261 [attribute] boolean FreezePanes;
1262 - [attribute] long Height;
1263 - [attribute] long Left;
1264 [attribute] boolean Split;
1265 [attribute] long SplitColumn;
1266 [attribute] double SplitHorizontal;
1267 @@ -67,10 +63,7 @@ interface XWindow
1268 [attribute] double SplitVertical;
1269 [attribute] any ScrollColumn;
1270 [attribute] any ScrollRow;
1271 - [attribute] long Top;
1272 [attribute] any View;
1273 - [attribute] boolean Visible;
1274 - [attribute] long Width;
1275 [attribute] any WindowState;
1276 [attribute] any Zoom;
1277 any SelectedSheets( [in] any aIndex );
1278 --- oovbaapi/ooo/vba/excel/XWorkbook.idl.old 2009-04-02 10:36:29.000000000 +0000
1279 +++ oovbaapi/ooo/vba/excel/XWorkbook.idl 2009-04-06 16:42:01.000000000 +0000
1280 @@ -48,31 +48,19 @@ interface XWorksheet;
1281 interface XWorksheets;
1284 -interface XWorkbook
1285 +interface XWorkbook : com::sun::star::uno::XInterface
1287 - interface ::ooo::vba::XHelperInterface;
1289 - [attribute, readonly] string Name;
1290 - [attribute, readonly] string Path;
1291 - [attribute, readonly] string FullName;
1292 [attribute, readonly] boolean ProtectStructure;
1293 [attribute, readonly] XWorksheet ActiveSheet;
1294 - [attribute] boolean Saved;
1295 [attribute, readonly] string CodeName;
1297 any Worksheets([in] any sheet);
1298 any Styles([in] any Index );
1299 any Sheets([in] any sheet);
1300 any Windows([in] any index );
1301 - void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
1302 - void Protect( [in] any Password );
1303 - void Unprotect( [in] any Password );
1306 void ResetColors() raises (com::sun::star::script::BasicErrorException);
1309 any Names( [in] any Index );
1311 any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
1312 long FileFormat() raises (com::sun::star::script::BasicErrorException);
1313 void SaveCopyAs( [in] string Filename );
1314 --- oovbaapi/ooo/vba/excel/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
1315 +++ oovbaapi/ooo/vba/excel/makefile.mk 2009-04-06 16:42:01.000000000 +0000
1316 @@ -41,7 +41,9 @@ PACKAGE=ooo$/vba$/Excel
1317 # ------------------------------------------------------------------------
1320 -IDLFILES= XApplication.idl\
1321 +IDLFILES= XGlobals.idl\
1327 --- oovbaapi/ooo/vba/makefile.mk.old 2009-04-06 16:42:00.000000000 +0000
1328 +++ oovbaapi/ooo/vba/makefile.mk 2009-04-06 16:42:01.000000000 +0000
1329 @@ -42,7 +42,6 @@ PACKAGE=ooo$/vba
1335 XVBAToOOEventDescGen.idl\
1337 @@ -54,7 +53,14 @@ IDLFILES=\
1339 XCommandBarPopup.idl\
1340 XCommandBarButton.idl\
1342 + XControlProvider.idl\
1343 + ControlProvider.idl\
1344 + XApplicationBase.idl\
1346 + XDocumentBase.idl\
1348 + XDocumentProperty.idl\
1349 + XDocumentProperties.idl\
1351 # ------------------------------------------------------------------
1353 --- oovbaapi/ooo/vba/word/XApplication.idl.old 1970-01-01 00:00:00.000000000 +0000
1354 +++ oovbaapi/ooo/vba/word/XApplication.idl 2009-04-06 16:42:01.000000000 +0000
1356 +/*************************************************************************
1358 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1360 + * Copyright 2008 by Sun Microsystems, Inc.
1362 + * OpenOffice.org - a multi-platform office productivity suite
1364 + * $RCSfile: XApplication.idl,v $
1365 + * $Revision: 1.4 $
1367 + * This file is part of OpenOffice.org.
1369 + * OpenOffice.org is free software: you can redistribute it and/or modify
1370 + * it under the terms of the GNU Lesser General Public License version 3
1371 + * only, as published by the Free Software Foundation.
1373 + * OpenOffice.org is distributed in the hope that it will be useful,
1374 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1375 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1376 + * GNU Lesser General Public License version 3 for more details
1377 + * (a copy is included in the LICENSE file that accompanied this code).
1379 + * You should have received a copy of the GNU Lesser General Public License
1380 + * version 3 along with OpenOffice.org. If not, see
1381 + * <http://www.openoffice.org/license.html>
1382 + * for a copy of the LGPLv3 License.
1384 + ************************************************************************/
1385 +#ifndef __ooo_vba_word_XApplication_idl__
1386 +#define __ooo_vba_word_XApplication_idl__
1388 +#ifndef __com_sun_star_uno_XInterface_idl__
1389 +#include <com/sun/star/uno/XInterface.idl>
1392 +#ifndef __ooo_vba_XHelperInterface_idl__
1393 +#include <ooo/vba/XHelperInterface.idl>
1396 +module ooo { module vba { module word {
1398 +interface XDocument;
1401 +interface XOptions;
1402 +interface XSelection;
1403 +interface XApplication : com::sun::star::uno::XInterface
1405 + [attribute, readonly] XDocument ActiveDocument;
1406 + [attribute, readonly] XWindow ActiveWindow;
1407 + [attribute, readonly] string Name;
1408 + [attribute, readonly] ooo::vba::word::XSystem System;
1409 + [attribute, readonly] ooo::vba::word::XOptions Options;
1410 + [attribute, readonly] ooo::vba::word::XSelection Selection;
1411 + any CommandBars( [in] any aIndex );
1419 --- oovbaapi/ooo/vba/word/XBookmark.idl.old 1970-01-01 00:00:00.000000000 +0000
1420 +++ oovbaapi/ooo/vba/word/XBookmark.idl 2009-04-06 16:42:01.000000000 +0000
1422 +/*************************************************************************
1424 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1426 + * Copyright 2008 by Sun Microsystems, Inc.
1428 + * OpenOffice.org - a multi-platform office productivity suite
1433 + * This file is part of OpenOffice.org.
1435 + * OpenOffice.org is free software: you can redistribute it and/or modify
1436 + * it under the terms of the GNU Lesser General Public License version 3
1437 + * only, as published by the Free Software Foundation.
1439 + * OpenOffice.org is distributed in the hope that it will be useful,
1440 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1441 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1442 + * GNU Lesser General Public License version 3 for more details
1443 + * (a copy is included in the LICENSE file that accompanied this code).
1445 + * You should have received a copy of the GNU Lesser General Public License
1446 + * version 3 along with OpenOffice.org. If not, see
1447 + * <http://www.openoffice.org/license.html>
1448 + * for a copy of the LGPLv3 License.
1450 + ************************************************************************/
1451 +#ifndef __ooo_vba_word_XBookmark_idl__
1452 +#define __ooo_vba_word_XBookmark_idl__
1454 +#ifndef __com_sun_star_uno_XInterface_idl__
1455 +#include <com/sun/star/uno/XInterface.idl>
1458 +#ifndef __ooo_vba_XHelperInterface_idl__
1459 +#include <ooo/vba/XHelperInterface.idl>
1462 +#ifndef __com_sun_star_container_XNamed_idl__
1463 +#include <com/sun/star/container/XNamed.idl>
1466 +module ooo { module vba { module word {
1468 +interface XBookmark
1470 + interface ooo::vba::XHelperInterface;
1471 + interface ::com::sun::star::container::XNamed;
1483 --- oovbaapi/ooo/vba/word/XBookmarks.idl.old 1970-01-01 00:00:00.000000000 +0000
1484 +++ oovbaapi/ooo/vba/word/XBookmarks.idl 2009-04-06 16:42:01.000000000 +0000
1486 +/*************************************************************************
1488 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1490 + * Copyright 2008 by Sun Microsystems, Inc.
1492 + * OpenOffice.org - a multi-platform office productivity suite
1497 + * This file is part of OpenOffice.org.
1499 + * OpenOffice.org is free software: you can redistribute it and/or modify
1500 + * it under the terms of the GNU Lesser General Public License version 3
1501 + * only, as published by the Free Software Foundation.
1503 + * OpenOffice.org is distributed in the hope that it will be useful,
1504 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1505 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1506 + * GNU Lesser General Public License version 3 for more details
1507 + * (a copy is included in the LICENSE file that accompanied this code).
1509 + * You should have received a copy of the GNU Lesser General Public License
1510 + * version 3 along with OpenOffice.org. If not, see
1511 + * <http://www.openoffice.org/license.html>
1512 + * for a copy of the LGPLv3 License.
1514 + ************************************************************************/
1515 +#ifndef __ooo_vba_word_XBookmarks_idl__
1516 +#define __ooo_vba_word_XBookmarks_idl__
1518 +#ifndef __com_sun_star_uno_XInterface_idl__
1519 +#include <com/sun/star/uno/XInterface.idl>
1522 +#ifndef __ooo_vba_XCollection_idl__
1523 +#include <ooo/vba/XCollection.idl>
1527 +//=============================================================================
1529 +module ooo { module vba { module word {
1531 +//=============================================================================
1533 +interface XBookmarks
1535 + interface ::ooo::vba::XCollection;
1537 + [attribute] long DefaultSorting;
1538 + [attribute] boolean ShowHidden;
1540 + any Add( [in] string Name, [in] any Range );
1541 + boolean Exists( [in] string Name );
1547 --- oovbaapi/ooo/vba/word/XDocument.idl.old 1970-01-01 00:00:00.000000000 +0000
1548 +++ oovbaapi/ooo/vba/word/XDocument.idl 2009-04-06 16:42:01.000000000 +0000
1550 +/*************************************************************************
1552 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1554 + * Copyright 2008 by Sun Microsystems, Inc.
1556 + * OpenOffice.org - a multi-platform office productivity suite
1558 + * $RCSfile: XDocument.idl,v $
1559 + * $Revision: 1.4 $
1561 + * This file is part of OpenOffice.org.
1563 + * OpenOffice.org is free software: you can redistribute it and/or modify
1564 + * it under the terms of the GNU Lesser General Public License version 3
1565 + * only, as published by the Free Software Foundation.
1567 + * OpenOffice.org is distributed in the hope that it will be useful,
1568 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1569 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1570 + * GNU Lesser General Public License version 3 for more details
1571 + * (a copy is included in the LICENSE file that accompanied this code).
1573 + * You should have received a copy of the GNU Lesser General Public License
1574 + * version 3 along with OpenOffice.org. If not, see
1575 + * <http://www.openoffice.org/license.html>
1576 + * for a copy of the LGPLv3 License.
1578 + ************************************************************************/
1579 +#ifndef __ooo_vba_word_XDocument_idl__
1580 +#define __ooo_vba_word_XDocument_idl__
1582 +#ifndef __com_sun_star_uno_XInterface_idl__
1583 +#include <com/sun/star/uno/XInterface.idl>
1586 +#ifndef __ooo_vba_XHelperInterface_idl__
1587 +#include <ooo/vba/XHelperInterface.idl>
1590 +#ifndef __ooo_vba_word_XRange_idl__
1591 +#include <ooo/vba/word/XRange.idl>
1594 +module ooo { module vba { module word {
1596 +interface XDocument : com::sun::star::uno::XInterface
1598 + [attribute, readonly] XRange Content;
1600 + XRange Range( [in] any Start, [in] any End );
1601 + any BuiltInDocumentProperties( [in] any index );
1602 + any CustomDocumentProperties( [in] any index );
1603 + any Bookmarks( [in] any aIndex );
1604 + any Variables( [in] any aIndex );
1612 --- oovbaapi/ooo/vba/word/XGlobals.idl.old 1970-01-01 00:00:00.000000000 +0000
1613 +++ oovbaapi/ooo/vba/word/XGlobals.idl 2009-04-06 16:42:01.000000000 +0000
1615 +/*************************************************************************
1617 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1619 + * Copyright 2008 by Sun Microsystems, Inc.
1621 + * OpenOffice.org - a multi-platform office productivity suite
1623 + * $RCSfile: XGlobals.idl,v $
1624 + * $Revision: 1.4 $
1626 + * This file is part of OpenOffice.org.
1628 + * OpenOffice.org is free software: you can redistribute it and/or modify
1629 + * it under the terms of the GNU Lesser General Public License version 3
1630 + * only, as published by the Free Software Foundation.
1632 + * OpenOffice.org is distributed in the hope that it will be useful,
1633 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1634 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1635 + * GNU Lesser General Public License version 3 for more details
1636 + * (a copy is included in the LICENSE file that accompanied this code).
1638 + * You should have received a copy of the GNU Lesser General Public License
1639 + * version 3 along with OpenOffice.org. If not, see
1640 + * <http://www.openoffice.org/license.html>
1641 + * for a copy of the LGPLv3 License.
1643 + ************************************************************************/
1644 +#ifndef __ooo_vba_word_XGlobals_idl__
1645 +#define __ooo_vba_word_XGlobals_idl__
1647 +#ifndef __com_sun_star_uno_XInterface_idl__
1648 +#include <com/sun/star/uno/XInterface.idl>
1651 +module ooo { module vba { module word {
1652 +interface XDocument;
1655 +interface XOptions;
1656 +interface XSelection;
1657 +interface XGlobals : com::sun::star::uno::XInterface
1659 + [attribute, readonly] XDocument ActiveDocument;
1660 + [attribute, readonly] XWindow ActiveWindow;
1661 + [attribute, readonly] string Name;
1662 + [attribute, readonly] ooo::vba::word::XSystem System;
1663 + [attribute, readonly] ooo::vba::word::XOptions Options;
1664 + [attribute, readonly] ooo::vba::word::XSelection Selection;
1665 + any CommandBars( [in] any aIndex );
1673 --- oovbaapi/ooo/vba/word/XOptions.idl.old 1970-01-01 00:00:00.000000000 +0000
1674 +++ oovbaapi/ooo/vba/word/XOptions.idl 2009-04-06 16:42:01.000000000 +0000
1676 +/*************************************************************************
1678 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1680 + * Copyright 2008 by Sun Microsystems, Inc.
1682 + * OpenOffice.org - a multi-platform office productivity suite
1687 + * This file is part of OpenOffice.org.
1689 + * OpenOffice.org is free software: you can redistribute it and/or modify
1690 + * it under the terms of the GNU Lesser General Public License version 3
1691 + * only, as published by the Free Software Foundation.
1693 + * OpenOffice.org is distributed in the hope that it will be useful,
1694 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1695 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1696 + * GNU Lesser General Public License version 3 for more details
1697 + * (a copy is included in the LICENSE file that accompanied this code).
1699 + * You should have received a copy of the GNU Lesser General Public License
1700 + * version 3 along with OpenOffice.org. If not, see
1701 + * <http://www.openoffice.org/license.html>
1702 + * for a copy of the LGPLv3 License.
1704 + ************************************************************************/
1705 +#ifndef __ooo_vba_word_XOptions_idl__
1706 +#define __ooo_vba_word_XOptions_idl__
1708 +#ifndef __com_sun_star_uno_XInterface_idl__
1709 +#include <com/sun/star/uno/XInterface.idl>
1712 +#ifndef __ooo_vba_XHelperInterface_idl__
1713 +#include <ooo/vba/XHelperInterface.idl>
1716 +module ooo { module vba { module word {
1720 + interface ooo::vba::XHelperInterface;
1722 + any DefaultFilePath( [in] long Path );
1730 --- oovbaapi/ooo/vba/word/XPane.idl.old 1970-01-01 00:00:00.000000000 +0000
1731 +++ oovbaapi/ooo/vba/word/XPane.idl 2009-04-06 16:42:01.000000000 +0000
1733 +/*************************************************************************
1735 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1737 + * Copyright 2008 by Sun Microsystems, Inc.
1739 + * OpenOffice.org - a multi-platform office productivity suite
1744 + * This file is part of OpenOffice.org.
1746 + * OpenOffice.org is free software: you can redistribute it and/or modify
1747 + * it under the terms of the GNU Lesser General Public License version 3
1748 + * only, as published by the Free Software Foundation.
1750 + * OpenOffice.org is distributed in the hope that it will be useful,
1751 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1752 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1753 + * GNU Lesser General Public License version 3 for more details
1754 + * (a copy is included in the LICENSE file that accompanied this code).
1756 + * You should have received a copy of the GNU Lesser General Public License
1757 + * version 3 along with OpenOffice.org. If not, see
1758 + * <http://www.openoffice.org/license.html>
1759 + * for a copy of the LGPLv3 License.
1761 + ************************************************************************/
1762 +#ifndef __ooo_vba_word_XPane_idl__
1763 +#define __ooo_vba_word_XPane_idl__
1765 +#ifndef __com_sun_star_uno_XInterface_idl__
1766 +#include <com/sun/star/uno/XInterface.idl>
1769 +#ifndef __ooo_vba_XHelperInterface_idl__
1770 +#include <ooo/vba/XHelperInterface.idl>
1773 +module ooo { module vba { module word {
1777 + interface ooo::vba::XHelperInterface;
1788 --- oovbaapi/ooo/vba/word/XPanes.idl.old 1970-01-01 00:00:00.000000000 +0000
1789 +++ oovbaapi/ooo/vba/word/XPanes.idl 2009-04-06 16:42:01.000000000 +0000
1791 +/*************************************************************************
1793 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1795 + * Copyright 2008 by Sun Microsystems, Inc.
1797 + * OpenOffice.org - a multi-platform office productivity suite
1802 + * This file is part of OpenOffice.org.
1804 + * OpenOffice.org is free software: you can redistribute it and/or modify
1805 + * it under the terms of the GNU Lesser General Public License version 3
1806 + * only, as published by the Free Software Foundation.
1808 + * OpenOffice.org is distributed in the hope that it will be useful,
1809 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1810 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1811 + * GNU Lesser General Public License version 3 for more details
1812 + * (a copy is included in the LICENSE file that accompanied this code).
1814 + * You should have received a copy of the GNU Lesser General Public License
1815 + * version 3 along with OpenOffice.org. If not, see
1816 + * <http://www.openoffice.org/license.html>
1817 + * for a copy of the LGPLv3 License.
1819 + ************************************************************************/
1820 +#ifndef __ooo_vba_word_XPanes_idl__
1821 +#define __ooo_vba_word_XPanes_idl__
1823 +#ifndef __com_sun_star_uno_XInterface_idl__
1824 +#include <com/sun/star/uno/XInterface.idl>
1827 +#ifndef __ooo_vba_XCollection_idl__
1828 +#include <ooo/vba/XCollection.idl>
1832 +//=============================================================================
1834 +module ooo { module vba { module word {
1836 +//=============================================================================
1840 + interface ::ooo::vba::XCollection;
1846 --- oovbaapi/ooo/vba/word/XRange.idl.old 1970-01-01 00:00:00.000000000 +0000
1847 +++ oovbaapi/ooo/vba/word/XRange.idl 2009-04-06 16:42:01.000000000 +0000
1849 +/*************************************************************************
1851 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1853 + * Copyright 2008 by Sun Microsystems, Inc.
1855 + * OpenOffice.org - a multi-platform office productivity suite
1860 + * This file is part of OpenOffice.org.
1862 + * OpenOffice.org is free software: you can redistribute it and/or modify
1863 + * it under the terms of the GNU Lesser General Public License version 3
1864 + * only, as published by the Free Software Foundation.
1866 + * OpenOffice.org is distributed in the hope that it will be useful,
1867 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1868 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1869 + * GNU Lesser General Public License version 3 for more details
1870 + * (a copy is included in the LICENSE file that accompanied this code).
1872 + * You should have received a copy of the GNU Lesser General Public License
1873 + * version 3 along with OpenOffice.org. If not, see
1874 + * <http://www.openoffice.org/license.html>
1875 + * for a copy of the LGPLv3 License.
1877 + ************************************************************************/
1878 +#ifndef __ooo_vba_word_XRange_idl__
1879 +#define __ooo_vba_word_XRange_idl__
1881 +#ifndef __com_sun_star_uno_XInterface_idl__
1882 +#include <com/sun/star/uno/XInterface.idl>
1885 +#ifndef __ooo_vba_XHelperInterface_idl__
1886 +#include <ooo/vba/XHelperInterface.idl>
1890 +module ooo { module vba { module word {
1894 + interface ooo::vba::XHelperInterface;
1896 + [attribute] string Text;
1898 + void InsertBreak( [in] any Type );
1906 --- oovbaapi/ooo/vba/word/XSelection.idl.old 1970-01-01 00:00:00.000000000 +0000
1907 +++ oovbaapi/ooo/vba/word/XSelection.idl 2009-04-06 16:42:01.000000000 +0000
1909 +/*************************************************************************
1911 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1913 + * Copyright 2008 by Sun Microsystems, Inc.
1915 + * OpenOffice.org - a multi-platform office productivity suite
1920 + * This file is part of OpenOffice.org.
1922 + * OpenOffice.org is free software: you can redistribute it and/or modify
1923 + * it under the terms of the GNU Lesser General Public License version 3
1924 + * only, as published by the Free Software Foundation.
1926 + * OpenOffice.org is distributed in the hope that it will be useful,
1927 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1928 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1929 + * GNU Lesser General Public License version 3 for more details
1930 + * (a copy is included in the LICENSE file that accompanied this code).
1932 + * You should have received a copy of the GNU Lesser General Public License
1933 + * version 3 along with OpenOffice.org. If not, see
1934 + * <http://www.openoffice.org/license.html>
1935 + * for a copy of the LGPLv3 License.
1937 + ************************************************************************/
1938 +#ifndef __ooo_vba_word_XSelection_idl__
1939 +#define __ooo_vba_word_XSelection_idl__
1941 +#ifndef __com_sun_star_uno_XInterface_idl__
1942 +#include <com/sun/star/uno/XInterface.idl>
1945 +#ifndef __ooo_vba_XHelperInterface_idl__
1946 +#include <ooo/vba/XHelperInterface.idl>
1950 +module ooo { module vba { module word {
1952 +interface XSelection
1954 + interface ooo::vba::XHelperInterface;
1956 + [attribute] string Text;
1964 --- oovbaapi/ooo/vba/word/XSystem.idl.old 1970-01-01 00:00:00.000000000 +0000
1965 +++ oovbaapi/ooo/vba/word/XSystem.idl 2009-04-06 16:42:01.000000000 +0000
1967 +/*************************************************************************
1969 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1971 + * Copyright 2008 by Sun Microsystems, Inc.
1973 + * OpenOffice.org - a multi-platform office productivity suite
1978 + * This file is part of OpenOffice.org.
1980 + * OpenOffice.org is free software: you can redistribute it and/or modify
1981 + * it under the terms of the GNU Lesser General Public License version 3
1982 + * only, as published by the Free Software Foundation.
1984 + * OpenOffice.org is distributed in the hope that it will be useful,
1985 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1986 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1987 + * GNU Lesser General Public License version 3 for more details
1988 + * (a copy is included in the LICENSE file that accompanied this code).
1990 + * You should have received a copy of the GNU Lesser General Public License
1991 + * version 3 along with OpenOffice.org. If not, see
1992 + * <http://www.openoffice.org/license.html>
1993 + * for a copy of the LGPLv3 License.
1995 + ************************************************************************/
1996 +#ifndef __ooo_vba_word_XSystem_idl__
1997 +#define __ooo_vba_word_XSystem_idl__
1999 +#ifndef __com_sun_star_uno_XInterface_idl__
2000 +#include <com/sun/star/uno/XInterface.idl>
2003 +#ifndef __ooo_vba_XHelperInterface_idl__
2004 +#include <ooo/vba/XHelperInterface.idl>
2008 +module ooo { module vba { module word {
2012 + interface ooo::vba::XHelperInterface;
2014 + [attribute] long Cursor;
2015 + any PrivateProfileString( [in] string Filename, [in] string Section, [in] string Key );
2023 --- oovbaapi/ooo/vba/word/XVariable.idl.old 1970-01-01 00:00:00.000000000 +0000
2024 +++ oovbaapi/ooo/vba/word/XVariable.idl 2009-04-06 16:42:01.000000000 +0000
2026 +/*************************************************************************
2028 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2030 + * Copyright 2008 by Sun Microsystems, Inc.
2032 + * OpenOffice.org - a multi-platform office productivity suite
2037 + * This file is part of OpenOffice.org.
2039 + * OpenOffice.org is free software: you can redistribute it and/or modify
2040 + * it under the terms of the GNU Lesser General Public License version 3
2041 + * only, as published by the Free Software Foundation.
2043 + * OpenOffice.org is distributed in the hope that it will be useful,
2044 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2045 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2046 + * GNU Lesser General Public License version 3 for more details
2047 + * (a copy is included in the LICENSE file that accompanied this code).
2049 + * You should have received a copy of the GNU Lesser General Public License
2050 + * version 3 along with OpenOffice.org. If not, see
2051 + * <http://www.openoffice.org/license.html>
2052 + * for a copy of the LGPLv3 License.
2054 + ************************************************************************/
2055 +#ifndef __ooo_vba_word_XVariable_idl__
2056 +#define __ooo_vba_word_XVariable_idl__
2058 +#ifndef __com_sun_star_uno_XInterface_idl__
2059 +#include <com/sun/star/uno/XInterface.idl>
2062 +#ifndef __ooo_vba_XHelperInterface_idl__
2063 +#include <ooo/vba/XHelperInterface.idl>
2066 +#ifndef __com_sun_star_container_XNamed_idl__
2067 +#include <com/sun/star/container/XNamed.idl>
2070 +module ooo { module vba { module word {
2072 +interface XVariable
2074 + interface ooo::vba::XHelperInterface;
2075 + interface ::com::sun::star::container::XNamed;
2077 + [attribute] any Value;
2078 + [attribute, readonly] long Index;
2086 --- oovbaapi/ooo/vba/word/XVariables.idl.old 1970-01-01 00:00:00.000000000 +0000
2087 +++ oovbaapi/ooo/vba/word/XVariables.idl 2009-04-06 16:42:01.000000000 +0000
2089 +/*************************************************************************
2091 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2093 + * Copyright 2008 by Sun Microsystems, Inc.
2095 + * OpenOffice.org - a multi-platform office productivity suite
2100 + * This file is part of OpenOffice.org.
2102 + * OpenOffice.org is free software: you can redistribute it and/or modify
2103 + * it under the terms of the GNU Lesser General Public License version 3
2104 + * only, as published by the Free Software Foundation.
2106 + * OpenOffice.org is distributed in the hope that it will be useful,
2107 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2108 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2109 + * GNU Lesser General Public License version 3 for more details
2110 + * (a copy is included in the LICENSE file that accompanied this code).
2112 + * You should have received a copy of the GNU Lesser General Public License
2113 + * version 3 along with OpenOffice.org. If not, see
2114 + * <http://www.openoffice.org/license.html>
2115 + * for a copy of the LGPLv3 License.
2117 + ************************************************************************/
2118 +#ifndef __ooo_vba_word_XVariables_idl__
2119 +#define __ooo_vba_word_XVariables_idl__
2121 +#ifndef __com_sun_star_uno_XInterface_idl__
2122 +#include <com/sun/star/uno/XInterface.idl>
2125 +#ifndef __ooo_vba_XCollection_idl__
2126 +#include <ooo/vba/XCollection.idl>
2130 +//=============================================================================
2132 +module ooo { module vba { module word {
2134 +//=============================================================================
2136 +interface XVariables
2138 + interface ::ooo::vba::XCollection;
2140 + any Add( [in] string Name, [in] any Value );
2146 --- oovbaapi/ooo/vba/word/XView.idl.old 1970-01-01 00:00:00.000000000 +0000
2147 +++ oovbaapi/ooo/vba/word/XView.idl 2009-04-06 16:42:01.000000000 +0000
2149 +/*************************************************************************
2151 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2153 + * Copyright 2008 by Sun Microsystems, Inc.
2155 + * OpenOffice.org - a multi-platform office productivity suite
2160 + * This file is part of OpenOffice.org.
2162 + * OpenOffice.org is free software: you can redistribute it and/or modify
2163 + * it under the terms of the GNU Lesser General Public License version 3
2164 + * only, as published by the Free Software Foundation.
2166 + * OpenOffice.org is distributed in the hope that it will be useful,
2167 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2168 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2169 + * GNU Lesser General Public License version 3 for more details
2170 + * (a copy is included in the LICENSE file that accompanied this code).
2172 + * You should have received a copy of the GNU Lesser General Public License
2173 + * version 3 along with OpenOffice.org. If not, see
2174 + * <http://www.openoffice.org/license.html>
2175 + * for a copy of the LGPLv3 License.
2177 + ************************************************************************/
2178 +#ifndef __ooo_vba_word_XView_idl__
2179 +#define __ooo_vba_word_XView_idl__
2181 +#ifndef __com_sun_star_uno_XInterface_idl__
2182 +#include <com/sun/star/uno/XInterface.idl>
2185 +#ifndef __ooo_vba_XHelperInterface_idl__
2186 +#include <ooo/vba/XHelperInterface.idl>
2189 +module ooo { module vba { module word {
2193 + interface ooo::vba::XHelperInterface;
2195 + [attribute] long SeekView;
2196 + [attribute] long SplitSpecial;
2197 + [attribute] boolean TableGridLines;
2198 + [attribute] long Type;
2206 --- oovbaapi/ooo/vba/word/XWindow.idl.old 1970-01-01 00:00:00.000000000 +0000
2207 +++ oovbaapi/ooo/vba/word/XWindow.idl 2009-04-06 16:42:01.000000000 +0000
2209 +/*************************************************************************
2211 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2213 + * Copyright 2008 by Sun Microsystems, Inc.
2215 + * OpenOffice.org - a multi-platform office productivity suite
2217 + * $RCSfile: XWindow.idl,v $
2218 + * $Revision: 1.4 $
2220 + * This file is part of OpenOffice.org.
2222 + * OpenOffice.org is free software: you can redistribute it and/or modify
2223 + * it under the terms of the GNU Lesser General Public License version 3
2224 + * only, as published by the Free Software Foundation.
2226 + * OpenOffice.org is distributed in the hope that it will be useful,
2227 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2228 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2229 + * GNU Lesser General Public License version 3 for more details
2230 + * (a copy is included in the LICENSE file that accompanied this code).
2232 + * You should have received a copy of the GNU Lesser General Public License
2233 + * version 3 along with OpenOffice.org. If not, see
2234 + * <http://www.openoffice.org/license.html>
2235 + * for a copy of the LGPLv3 License.
2237 + ************************************************************************/
2238 +#ifndef __ooo_vba_word_XWindow_idl__
2239 +#define __ooo_vba_word_XWindow_idl__
2241 +#ifndef __com_sun_star_uno_XInterface_idl__
2242 +#include <com/sun/star/uno/XInterface.idl>
2245 +#ifndef __ooo_vba_XHelperInterface_idl__
2246 +#include <ooo/vba/XHelperInterface.idl>
2249 +//=============================================================================
2251 +module ooo { module vba { module word {
2253 +//=============================================================================
2255 +interface XWindow : com::sun::star::uno::XInterface
2257 + [attribute] any View;
2259 + void Close([in] any SaveChanges, [in] any RouteDocument);
2260 + any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
2261 + any ActivePane(); // this is a fake api for it seems not support in Write
2264 +//=============================================================================
2271 --- oovbaapi/ooo/vba/word/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
2272 +++ oovbaapi/ooo/vba/word/makefile.mk 2009-04-06 16:42:01.000000000 +0000
2274 +#*************************************************************************
2276 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2278 +# Copyright 2008 by Sun Microsystems, Inc.
2280 +# OpenOffice.org - a multi-platform office productivity suite
2282 +# $RCSfile: makefile.mk,v $
2286 +# This file is part of OpenOffice.org.
2288 +# OpenOffice.org is free software: you can redistribute it and/or modify
2289 +# it under the terms of the GNU Lesser General Public License version 3
2290 +# only, as published by the Free Software Foundation.
2292 +# OpenOffice.org is distributed in the hope that it will be useful,
2293 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2294 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2295 +# GNU Lesser General Public License version 3 for more details
2296 +# (a copy is included in the LICENSE file that accompanied this code).
2298 +# You should have received a copy of the GNU Lesser General Public License
2299 +# version 3 along with OpenOffice.org. If not, see
2300 +# <http://www.openoffice.org/license.html>
2301 +# for a copy of the LGPLv3 License.
2303 +#*************************************************************************
2309 +PACKAGE=ooo$/vba$/Word
2311 +# --- Settings -----------------------------------------------------
2312 +.INCLUDE : $(PRJ)$/util$/makefile.pmk
2314 +# ------------------------------------------------------------------------
2317 +IDLFILES= XGlobals.idl\
2318 + XApplication.idl \
2333 +# ------------------------------------------------------------------
2335 +.INCLUDE : target.mk
2337 --- oovbaapi/prj/build.lst.old 2009-04-02 10:36:28.000000000 +0000
2338 +++ oovbaapi/prj/build.lst 2009-04-06 16:42:01.000000000 +0000
2339 @@ -4,5 +4,6 @@ ovba oovbaapi\genconstidl
2340 ovba oovbaapi\ooo\vba\constants nmake - all ovba_constants ovba_genconstidl NULL
2341 ovba oovbaapi\ooo\vba nmake - all ovba_vba NULL
2342 ovba oovbaapi\ooo\vba\excel nmake - all ovba_excel NULL
2343 +ovba oovbaapi\ooo\vba\word nmake - all ovba_word NULL
2344 ovba oovbaapi\ooo\vba\msforms nmake - all ovba_msforms NULL
2345 -ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL
2346 +ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL
2347 --- oovbaapi/util/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
2348 +++ oovbaapi/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
2349 @@ -44,6 +44,7 @@ TARGET=oovbaapi_db
2354 $(UCR)$/msforms.db \
2355 $(UCR)$/constants.db
2357 --- sc/inc/docuno.hxx.old 2009-04-06 16:42:00.000000000 +0000
2358 +++ sc/inc/docuno.hxx 2009-04-06 16:42:01.000000000 +0000
2359 @@ -77,8 +77,6 @@ class SvxFmDrawPage;
2363 -#include <com/sun/star/document/XCodeNameQuery.hpp>
2365 class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
2366 public com::sun::star::sheet::XSpreadsheetDocument,
2367 public com::sun::star::document::XActionLockable,
2368 @@ -92,7 +90,6 @@ class SC_DLLPUBLIC ScModelObj : public S
2369 public com::sun::star::view::XRenderable,
2370 public com::sun::star::document::XLinkTargetSupplier,
2371 public com::sun::star::beans::XPropertySet,
2372 - public com::sun::star::document::XCodeNameQuery,
2373 public com::sun::star::document::XDocumentEventCompatibleHelper,
2374 public SvxFmMSFactory, // derived from XMultiServiceFactory
2375 public com::sun::star::lang::XServiceInfo,
2376 @@ -320,8 +317,6 @@ public:
2377 virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
2378 ::com::sun::star::util::XChangesListener >& aListener )
2379 throw (::com::sun::star::uno::RuntimeException);
2380 - virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
2381 - throw(::com::sun::star::uno::RuntimeException);
2383 virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
2385 --- sc/inc/servuno.hxx.old 2009-04-06 16:41:59.000000000 +0000
2386 +++ sc/inc/servuno.hxx 2009-04-06 16:42:01.000000000 +0000
2387 @@ -94,7 +94,8 @@ class ScDocShell;
2388 #define SC_SERVICE_FORMULAPARS 38
2389 #define SC_SERVICE_OPCODEMAPPER 39
2390 #define SC_SERVICE_VBAOBJECTPROVIDER 40
2391 -#define SC_SERVICE_COUNT 41
2392 +#define SC_SERVICE_VBACODENAMEPROVIDER 41
2393 +#define SC_SERVICE_COUNT 42
2394 #define SC_SERVICE_INVALID USHRT_MAX
2397 --- sc/prj/build.lst.old 2009-04-06 16:41:58.000000000 +0000
2398 +++ sc/prj/build.lst 2009-04-06 16:42:01.000000000 +0000
2400 -sc sc : oovbaapi svx stoc uui BOOST:boost formula oox NULL
2401 +sc sc : vbahelper oovbaapi svx stoc uui BOOST:boost formula oox NULL
2402 sc sc usr1 - all sc_mkout NULL
2403 sc sc\inc nmake - all sc_inc NULL
2404 sc sc\prj get - all sc_prj NULL
2405 --- sc/source/core/tool/interpr4.cxx.old 2009-04-06 16:41:58.000000000 +0000
2406 +++ sc/source/core/tool/interpr4.cxx 2009-04-06 16:42:01.000000000 +0000
2409 #include <algorithm>
2410 #include <functional>
2411 +#include <vbahelper/vbahelper.hxx>
2413 using namespace com::sun::star;
2414 using namespace formula;
2415 @@ -2513,18 +2514,11 @@ lcl_setVBARange( ScRange& aRange, ScDocu
2418 uno::Reference< uno::XInterface > xVBARange;
2419 - uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
2420 - uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
2421 - uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
2422 uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
2423 - // hmm probably better not to have to include the vba generated headers
2424 - // here, but... if they ever become always available certainly the
2425 - // line below is more coder friendly
2426 - //xRange = ooo::vba::excel::Range::createRangeFromXCellRange( xCtx , uno::Reference< ooo::vba::XHelperInterface >(), xCellRange );
2427 uno::Sequence< uno::Any > aArgs(2);
2428 aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
2429 aArgs[1] = uno::Any( xCellRange );
2430 - xVBARange = xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range") ), aArgs, xCtx );
2431 + xVBARange = ov::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
2432 if ( xVBARange.is() )
2434 String sDummy(RTL_CONSTASCII_USTRINGPARAM("A-Range") );
2435 --- sc/source/filter/excel/excimp8.cxx.old 2009-04-06 16:41:59.000000000 +0000
2436 +++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:42:01.000000000 +0000
2437 @@ -103,8 +103,11 @@
2438 #include <com/sun/star/document/XDocumentProperties.hpp>
2439 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
2440 #include <com/sun/star/script/ModuleInfo.hpp>
2441 +#include <basic/basmgr.hxx>
2442 +#include <cppuhelper/component_context.hxx>
2445 +#include <com/sun/star/container/XNameContainer.hpp>
2447 using namespace com::sun::star;
2450 @@ -255,16 +258,6 @@ void ImportExcel8::SheetProtection( void
2451 GetSheetProtectBuffer().ReadOptions( aIn, GetCurrScTab() );
2454 -bool lcl_hasVBAEnabled()
2456 - uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY);
2457 - // test if vba service is present
2458 - uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY );
2459 - uno::Reference< uno::XInterface > xGlobals( xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ), uno::UNO_QUERY );
2461 - return xGlobals.is();
2464 void ImportExcel8::ReadBasic( void )
2467 @@ -280,8 +273,11 @@ void ImportExcel8::ReadBasic( void )
2468 bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
2469 if( bLoadCode || bLoadStrg )
2472 + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.excel.Globals") );
2473 + pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
2474 SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
2475 - bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
2476 + bool bAsComment = !bLoadExecutable || !aGlobs.hasValue();
2477 aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
2478 GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
2480 --- sc/source/filter/excel/xlescher.cxx.old 2009-04-06 16:41:59.000000000 +0000
2481 +++ sc/source/filter/excel/xlescher.cxx 2009-04-06 16:42:01.000000000 +0000
2483 #include <basic/sbstar.hxx>
2484 #include <basic/sbmod.hxx>
2485 #include <basic/sbmeth.hxx>
2486 +#include <basic/basmgr.hxx>
2488 using ::rtl::OUString;
2489 using ::com::sun::star::uno::Reference;
2490 @@ -305,6 +306,7 @@ Reference< XControlModel > XclControlHel
2493 #define EXC_MACRONAME_PRE "vnd.sun.star.script:Standard."
2494 +#define EXC_MACRO_SCHEME "vnd.sun.star.script:"
2495 #define EXC_MACRONAME_SUF "?language=Basic&location=document"
2497 OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjectShell* pDocShell )
2498 @@ -312,9 +314,14 @@ OUString XclControlHelper::GetScMacroNam
2499 String sTmp( rXclMacroName );
2500 if( rXclMacroName.Len() > 0 )
2502 + String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
2504 + if ( pDocShell && pDocShell->GetBasicManager()->GetName().Len() > 0 )
2505 + sProjectName = pDocShell->GetBasicManager()->GetName();
2507 if ( ( sTmp.Search( '.' ) == STRING_NOTFOUND) && pDocShell )
2509 - if( StarBASIC* pBasic = pDocShell->GetBasic() )
2510 + if( StarBASIC* pBasic = pDocShell->GetBasicManager()->GetLib( sProjectName ) )
2512 if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sTmp, SbxCLASS_METHOD ) ) )
2514 @@ -325,7 +332,9 @@ OUString XclControlHelper::GetScMacroNam
2518 - return CREATE_OUSTRING( EXC_MACRONAME_PRE ) + sTmp + CREATE_OUSTRING( EXC_MACRONAME_SUF );
2519 + sProjectName.Append( '.' );
2520 + sTmp.Insert( sProjectName, 0 );
2521 + return CREATE_OUSTRING( EXC_MACRO_SCHEME ) + sTmp + CREATE_OUSTRING( EXC_MACRONAME_SUF );
2525 --- sc/source/ui/docshell/docsh.cxx.old 2009-04-06 16:42:00.000000000 +0000
2526 +++ sc/source/ui/docshell/docsh.cxx 2009-04-06 16:42:01.000000000 +0000
2528 #include "cellsuno.hxx"
2529 #include <com/sun/star/document/XVbaEventsHelper.hpp>
2530 #include <com/sun/star/document/VbaEventId.hpp>
2532 +#include <basic/sbstar.hxx>
2533 +#include <basic/basmgr.hxx>
2534 using namespace com::sun::star;
2535 using namespace com::sun::star::document::VbaEventId;
2537 @@ -284,6 +285,7 @@ void ScDocShell::BeforeXMLLoading()
2539 xEvt->setIgnoreEvents( sal_True );
2541 +// if VBA enabled then we need to
2542 // prevent unnecessary broadcasts and updates
2543 DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
2544 pModificator = new ScDocShellModificator( *this );
2545 @@ -367,7 +369,14 @@ void ScDocShell::AfterXMLLoading(sal_Boo
2548 aDocument.SetInsertingFromOtherDoc( FALSE );
2550 + // add vba globals ( if they are availabl )
2551 + SfxObjectShell* pShell = aDocument.GetDocumentShell();
2555 + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ) );
2556 + pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
2558 // suppress VBA events when loading the xml
2559 uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
2561 --- sc/source/ui/unoobj/docuno.cxx.old 2009-04-06 16:42:00.000000000 +0000
2562 +++ sc/source/ui/unoobj/docuno.cxx 2009-04-06 16:42:01.000000000 +0000
2563 @@ -107,7 +107,6 @@ using namespace com::sun::star::document
2564 // alles ohne Which-ID, Map nur fuer PropertySetInfo
2566 //! umbenennen, sind nicht mehr nur Options
2567 -#include <com/sun/star/script/ScriptEventDescriptor.hpp>
2568 const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
2570 static SfxItemPropertyMap aDocOptPropertyMap_Impl[] =
2571 @@ -315,7 +314,6 @@ uno::Any SAL_CALL ScModelObj::queryInter
2572 SC_QUERYINTERFACE( view::XRenderable )
2573 SC_QUERYINTERFACE( document::XLinkTargetSupplier )
2574 SC_QUERYINTERFACE( beans::XPropertySet )
2575 - SC_QUERYINTERFACE( document::XCodeNameQuery )
2576 SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
2577 SC_QUERYINTERFACE( lang::XMultiServiceFactory )
2578 SC_QUERYINTERFACE( lang::XServiceInfo )
2579 @@ -1723,49 +1721,7 @@ uno::Sequence<rtl::OUString> SAL_CALL Sc
2581 return concatServiceNames( aMyServices, aDrawServices );
2584 -rtl::OUString SAL_CALL
2585 -ScModelObj::getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
2587 - rtl::OUString sCodeName;
2590 - OSL_TRACE( "*** In ScModelObj::getCodeNameForObject");
2591 - // need to find the page ( and index ) for this control
2592 - uno::Reference< drawing::XDrawPagesSupplier > xSupplier( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
2593 - uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
2594 - sal_Int32 nLen = xIndex->getCount();
2595 - bool bMatched = false;
2596 - uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
2597 - for ( sal_Int32 index = 0; index < nLen; ++index )
2601 - uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
2602 - uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
2603 - // get the www-standard container
2604 - uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
2605 - sal_Int32 nCntrls = xFormControls->getCount();
2606 - for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
2608 - uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
2609 - bMatched = ( xControl == xIf );
2613 - pDocShell->GetDocument()->GetCodeName( index, sName );
2614 - sCodeName = sName;
2618 - catch( uno::Exception& ) {}
2623 - // Probably should throw here ( if !bMatched )
2630 --- sc/source/ui/unoobj/servuno.cxx.old 2009-04-06 16:41:59.000000000 +0000
2631 +++ sc/source/ui/unoobj/servuno.cxx 2009-04-06 16:42:01.000000000 +0000
2633 #include <svx/xmlgrhlp.hxx>
2635 #include <comphelper/processfactory.hxx>
2637 +#include <com/sun/star/document/XCodeNameQuery.hpp>
2638 +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
2639 +#include <com/sun/star/form/XFormsSupplier.hpp>
2640 +#include <com/sun/star/script/ScriptEventDescriptor.hpp>
2641 +#include <comphelper/componentcontext.hxx>
2642 +#include <cppuhelper/component_context.hxx>
2643 +#include <vbahelper/vbahelper.hxx>
2644 using namespace ::com::sun::star;
2646 class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
2648 uno::Any maWorkbook;
2649 uno::Any maCachedObject;
2650 - uno::Reference<lang::XMultiServiceFactory> mxSF;
2651 ScDocShell* mpDocShell;
2653 ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
2655 - mxSF.set(comphelper::getProcessServiceFactory());
2656 - uno::Reference<beans::XPropertySet> xProps(mxSF, uno::UNO_QUERY);
2659 - ScDocument* pDoc = mpDocShell->GetDocument();
2661 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
2663 - uno::Sequence< uno::Any > aArgs(2);
2664 - aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
2665 - aArgs[1] = uno::Any( mpDocShell->GetModel() );
2666 - maWorkbook <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook") ), aArgs );
2668 + ScDocument* pDoc = mpDocShell->GetDocument();
2670 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
2672 + uno::Sequence< uno::Any > aArgs(2);
2673 + aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
2674 + aArgs[1] = uno::Any( mpDocShell->GetModel() );
2675 + maWorkbook <<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
2678 virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
2679 @@ -120,7 +120,7 @@ public:
2680 aArgs[0] = maWorkbook;
2681 aArgs[1] = uno::Any( xModel );
2682 aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
2683 - maCachedObject <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet") ), aArgs );
2684 + maCachedObject <<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
2688 @@ -160,6 +160,56 @@ public:
2692 +class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
2694 +ScDocShell* mpDocShell;
2696 + ScVbaCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
2698 + rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
2700 + rtl::OUString sCodeName;
2703 + OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
2704 + // need to find the page ( and index ) for this control
2705 + uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
2706 + uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
2707 + sal_Int32 nLen = xIndex->getCount();
2708 + bool bMatched = false;
2709 + uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
2710 + for ( sal_Int32 index = 0; index < nLen; ++index )
2714 + uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
2715 + uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
2716 + // get the www-standard container
2717 + uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
2718 + sal_Int32 nCntrls = xFormControls->getCount();
2719 + for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
2721 + uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
2722 + bMatched = ( xControl == xIf );
2726 + mpDocShell->GetDocument()->GetCodeName( index, sName );
2727 + sCodeName = sName;
2731 + catch( uno::Exception& ) {}
2736 + // Probably should throw here ( if !bMatched )
2742 //------------------------------------------------------------------------
2744 static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
2745 @@ -210,6 +260,7 @@ static const sal_Char* __FAR_DATA aProvN
2746 SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
2747 SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
2748 "ooo.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
2749 +"ooo.vba.VBACodeNameProvider",// SC_SERVICE_VBACODENAMEPROVIDER
2753 @@ -263,6 +314,7 @@ static const sal_Char* __FAR_DATA aOldNa
2754 "", // SC_SERVICE_FORMULAPARS
2755 "", // SC_SERVICE_OPCODEMAPPER
2756 "", // SC_SERVICE_VBAOBJECTPROVIDER
2757 + "", // SC_SERVICE_VBACODENAMEPROVIDER
2761 @@ -464,6 +516,9 @@ uno::Reference<uno::XInterface> ScServic
2762 case SC_SERVICE_VBAOBJECTPROVIDER:
2763 xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
2765 + case SC_SERVICE_VBACODENAMEPROVIDER:
2766 + xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
2771 --- sc/source/ui/vba/excelvbahelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
2772 +++ sc/source/ui/vba/excelvbahelper.cxx 2009-04-06 16:42:01.000000000 +0000
2774 +/*************************************************************************
2776 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2778 + * Copyright 2008 by Sun Microsystems, Inc.
2780 + * OpenOffice.org - a multi-platform office productivity suite
2782 + * $RCSfile: vbahelper.cxx,v $
2783 + * $Revision: 1.5.32.1 $
2785 + * This file is part of OpenOffice.org.
2787 + * OpenOffice.org is free software: you can redistribute it and/or modify
2788 + * it under the terms of the GNU Lesser General Public License version 3
2789 + * only, as published by the Free Software Foundation.
2791 + * OpenOffice.org is distributed in the hope that it will be useful,
2792 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2793 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2794 + * GNU Lesser General Public License version 3 for more details
2795 + * (a copy is included in the LICENSE file that accompanied this code).
2797 + * You should have received a copy of the GNU Lesser General Public License
2798 + * version 3 along with OpenOffice.org. If not, see
2799 + * <http://www.openoffice.org/license.html>
2800 + * for a copy of the LGPLv3 License.
2802 + ************************************************************************/
2803 +#include <docuno.hxx>
2804 +#include "excelvbahelper.hxx"
2805 +#include "tabvwsh.hxx"
2806 +#include "transobj.hxx"
2807 +#include "scmod.hxx"
2808 +#include "cellsuno.hxx"
2809 +#include <comphelper/processfactory.hxx>
2811 +using namespace ::com::sun::star;
2812 +using namespace ::ooo::vba;
2820 +bool isInPrintPreview( SfxViewFrame* pView )
2822 + sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
2823 + if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
2824 +nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
2826 + SfxViewFactory &rViewFactory =
2827 + pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
2828 + if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() )
2834 +const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
2836 +class PasteCellsWarningReseter
2839 + bool bInitialWarningState;
2840 + static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
2842 + static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
2843 + static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
2844 + static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
2845 + xContext->getServiceManager(), uno::UNO_QUERY_THROW );
2846 + static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
2850 + bool getReplaceCellsWarning() throw ( uno::RuntimeException )
2852 + sal_Bool res = sal_False;
2853 + getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
2854 + return ( res == sal_True );
2857 + void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
2859 + getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
2862 + PasteCellsWarningReseter() throw ( uno::RuntimeException )
2864 + bInitialWarningState = getReplaceCellsWarning();
2865 + if ( bInitialWarningState )
2866 + setReplaceCellsWarning( false );
2868 + ~PasteCellsWarningReseter()
2870 + if ( bInitialWarningState )
2872 + // don't allow dtor to throw
2875 + setReplaceCellsWarning( true );
2877 + catch ( uno::Exception& /*e*/ ){}
2885 + PasteCellsWarningReseter resetWarningBox;
2886 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
2889 + pViewShell->PasteFromSystem();
2890 + pViewShell->CellContentChanged();
2898 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
2900 + pViewShell->CopyToClip(NULL,false,false,true);
2906 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
2908 + pViewShell->CutToClip( NULL, TRUE );
2911 +void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
2913 + PasteCellsWarningReseter resetWarningBox;
2914 + sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
2915 + InsCellCmd eMoveMode = INS_NONE;
2917 + ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
2918 + if ( !pTabViewShell )
2919 + // none active, try next best
2920 + pTabViewShell = getCurrentBestViewShell();
2921 + if ( pTabViewShell )
2923 + ScViewData* pView = pTabViewShell->GetViewData();
2924 + Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
2925 + if ( pView && pWin )
2927 + if ( bAsLink && bOtherDoc )
2928 + pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
2931 + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
2932 + ScDocument* pDoc = NULL;
2934 + pDoc = pOwnClip->GetDocument();
2935 + pTabViewShell->PasteFromClip( nFlags, pDoc,
2936 + nFunction, bSkipEmpty, bTranspose, bAsLink,
2937 + eMoveMode, IDF_NONE, TRUE );
2938 + pTabViewShell->CellContentChanged();
2946 +getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
2948 + uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
2949 + ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
2950 + ScDocShell* pDocShell = NULL;
2952 + pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
2958 +getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
2960 + ScDocShell* pDocShell = getDocShell( xModel );
2962 + return pDocShell->GetBestViewShell();
2967 +getCurrentBestViewShell()
2969 + uno::Reference< frame::XModel > xModel = getCurrentDocument();
2970 + return getBestViewShell( xModel );
2974 +getCurrentViewFrame()
2976 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
2978 + return pViewShell->GetViewFrame();
2983 +ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
2985 + SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
2992 --- sc/source/ui/vba/excelvbahelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
2993 +++ sc/source/ui/vba/excelvbahelper.hxx 2009-04-06 16:42:01.000000000 +0000
2995 +/*************************************************************************
2997 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2999 + * Copyright 2008 by Sun Microsystems, Inc.
3001 + * OpenOffice.org - a multi-platform office productivity suite
3003 + * $RCSfile: vbahelper.hxx,v $
3004 + * $Revision: 1.5.32.1 $
3006 + * This file is part of OpenOffice.org.
3008 + * OpenOffice.org is free software: you can redistribute it and/or modify
3009 + * it under the terms of the GNU Lesser General Public License version 3
3010 + * only, as published by the Free Software Foundation.
3012 + * OpenOffice.org is distributed in the hope that it will be useful,
3013 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3014 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3015 + * GNU Lesser General Public License version 3 for more details
3016 + * (a copy is included in the LICENSE file that accompanied this code).
3018 + * You should have received a copy of the GNU Lesser General Public License
3019 + * version 3 along with OpenOffice.org. If not, see
3020 + * <http://www.openoffice.org/license.html>
3021 + * for a copy of the LGPLv3 License.
3023 + ************************************************************************/
3024 +#ifndef SC_EXCEL_VBA_HELPER_HXX
3025 +#define SC_EXCEL_VBA_HELPER_HXX
3027 +#include<vbahelper/vbahelper.hxx>
3028 +#include <docsh.hxx>
3030 +class ScCellRangeObj;
3039 + void implnPaste();
3041 + void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
3042 + ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
3043 + ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
3044 + ScTabViewShell* getCurrentBestViewShell();
3045 + SfxViewFrame* getCurrentViewFrame();
3046 + class ScVbaCellRangeAccess
3049 + static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj );
3055 --- sc/source/ui/vba/makefile.mk.old 2009-04-06 16:42:00.000000000 +0000
3056 +++ sc/source/ui/vba/makefile.mk 2009-04-06 16:42:01.000000000 +0000
3057 @@ -64,7 +64,7 @@ SLOFILES= \
3058 $(SLO)$/vbaworksheet.obj \
3059 $(SLO)$/vbaoutline.obj \
3060 $(SLO)$/vbafont.obj\
3061 - $(SLO)$/vbahelper.obj\
3062 + $(SLO)$/excelvbahelper.obj\
3063 $(SLO)$/vbainterior.obj\
3064 $(SLO)$/vbawsfunction.obj\
3065 $(SLO)$/vbawindow.obj\
3066 @@ -81,20 +81,10 @@ SLOFILES= \
3067 $(SLO)$/vbapalette.obj \
3068 $(SLO)$/vbaborders.obj \
3069 $(SLO)$/vbacharacters.obj \
3070 - $(SLO)$/vbacombobox.obj \
3071 $(SLO)$/vbavalidation.obj \
3072 - $(SLO)$/vbacontrol.obj \
3073 - $(SLO)$/vbacontrols.obj \
3074 $(SLO)$/vbaoleobject.obj \
3075 $(SLO)$/vbaoleobjects.obj \
3076 - $(SLO)$/vbabutton.obj \
3077 - $(SLO)$/vbalabel.obj \
3078 - $(SLO)$/vbatextbox.obj \
3079 $(SLO)$/vbatextboxshape.obj \
3080 - $(SLO)$/vbaradiobutton.obj \
3081 - $(SLO)$/vbalistbox.obj \
3082 - $(SLO)$/vbalistcontrolhelper.obj \
3083 - $(SLO)$/vbapropvalue.obj \
3084 $(SLO)$/vbapane.obj \
3085 $(SLO)$/vbashape.obj \
3086 $(SLO)$/vbacolorformat.obj \
3087 @@ -116,24 +106,10 @@ SLOFILES= \
3088 $(SLO)$/vbastyle.obj \
3089 $(SLO)$/vbastyles.obj \
3090 $(SLO)$/vbaassistant.obj \
3091 - $(SLO)$/vbauserform.obj \
3092 - $(SLO)$/vbacheckbox.obj \
3093 - $(SLO)$/vbatogglebutton.obj \
3094 - $(SLO)$/vbaframe.obj \
3095 - $(SLO)$/vbascrollbar.obj \
3096 - $(SLO)$/vbaprogressbar.obj \
3097 - $(SLO)$/vbamultipage.obj \
3098 - $(SLO)$/vbapages.obj \
3099 - $(SLO)$/vbacommandbarcontrol.obj \
3100 - $(SLO)$/vbacommandbarcontrols.obj \
3101 - $(SLO)$/vbacommandbar.obj \
3102 - $(SLO)$/vbacommandbars.obj \
3103 $(SLO)$/vbahyperlink.obj \
3104 $(SLO)$/vbapagesetup.obj \
3105 $(SLO)$/vbapagebreak.obj \
3106 $(SLO)$/vbapagebreaks.obj \
3107 - $(SLO)$/vbaspinbutton.obj \
3108 - $(SLO)$/vbaimage.obj \
3109 $(SLO)$/service.obj \
3110 $(SLO)$/vbaeventshelper.obj
3112 --- sc/source/ui/vba/service.cxx.old 2009-04-06 16:42:00.000000000 +0000
3113 +++ sc/source/ui/vba/service.cxx 2009-04-06 16:42:01.000000000 +0000
3114 @@ -61,11 +61,11 @@ namespace globals
3116 extern sdecl::ServiceDecl const serviceDecl;
3119 +namespace hyperlink
3121 extern sdecl::ServiceDecl const serviceDecl;
3123 -namespace hyperlink
3124 +namespace application
3126 extern sdecl::ServiceDecl const serviceDecl;
3128 @@ -87,10 +87,10 @@ extern "C"
3129 lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
3131 OSL_TRACE("In component_writeInfo");
3134 // Component registration
3135 if ( component_writeInfoHelper( pServiceManager, pRegistryKey,
3136 - range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
3137 + range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
3139 // Singleton registration
3141 @@ -110,6 +110,12 @@ extern "C"
3146 + // Component registration
3147 + return component_writeInfoHelper( pServiceManager, pRegistryKey,
3148 + range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl );
3153 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
3154 @@ -118,7 +124,7 @@ extern "C"
3156 OSL_TRACE("In component_getFactory for %s", pImplName );
3157 void* pRet = component_getFactoryHelper(
3158 - pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl );
3159 + pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl );
3161 pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl );
3162 OSL_TRACE("Ret is 0x%x", pRet);
3163 --- sc/source/ui/vba/vbaapplication.cxx.old 2009-04-06 16:41:59.000000000 +0000
3164 +++ sc/source/ui/vba/vbaapplication.cxx 2009-04-06 16:42:01.000000000 +0000
3166 #include "vbashape.hxx"
3167 #include "vbatextboxshape.hxx"
3168 #include "vbaassistant.hxx"
3169 -#include "vbacommandbars.hxx"
3172 #include <osl/file.hxx>
3174 #include "miscuno.hxx"
3175 #include "unonames.hxx"
3176 #include "docsh.hxx"
3177 +#include <vbahelper/helperdecl.hxx>
3179 using namespace ::ooo::vba;
3180 using namespace ::com::sun::star;
3181 @@ -123,7 +123,7 @@ public:
3182 ActiveWorkbook( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){}
3185 -ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
3186 +ScVbaApplication::ScVbaApplication( const uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
3190 @@ -151,15 +151,6 @@ ScVbaApplication::getAssistant() throw (
3194 -ScVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
3196 - uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
3197 - if( aIndex.hasValue() )
3198 - return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) );
3199 - return uno::makeAny( xCommandBars );
3203 ScVbaApplication::getSelection() throw (uno::RuntimeException)
3205 OSL_TRACE("** ScVbaApplication::getSelection() ** ");
3206 @@ -227,7 +218,7 @@ ScVbaApplication::getActiveCell() throw
3208 uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
3209 uno::Reference< table::XCellRange > xRange( xView->getActiveSheet(), ::uno::UNO_QUERY_THROW);
3210 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
3211 + ScTabViewShell* pViewShell = excel::getCurrentBestViewShell();
3213 throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() );
3214 ScViewData* pTabView = pViewShell->GetViewData();
3215 @@ -240,65 +231,6 @@ ScVbaApplication::getActiveCell() throw
3216 return new ScVbaRange( this, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
3220 -ScVbaApplication::getScreenUpdating() throw (uno::RuntimeException)
3222 - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
3223 - return !xModel->hasControllersLocked();
3227 -ScVbaApplication::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
3229 - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
3231 - xModel->unlockControllers();
3233 - xModel->lockControllers();
3237 -ScVbaApplication::getDisplayStatusBar() throw (uno::RuntimeException)
3239 - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
3240 - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
3241 - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
3243 - if( xProps.is() ){
3244 - uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
3245 - rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" ));
3246 - if( xLayoutManager.is() && xLayoutManager->isElementVisible( url ) ){
3254 -ScVbaApplication::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::RuntimeException)
3256 - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
3257 - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
3258 - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
3260 - if( xProps.is() ){
3261 - uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
3262 - rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" ));
3263 - if( xLayoutManager.is() ){
3264 - if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){
3265 - if( !xLayoutManager->showElement( url ) )
3266 - xLayoutManager->createElement( url );
3269 - else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){
3270 - xLayoutManager->hideElement( url );
3279 ScVbaApplication::Workbooks( const uno::Any& aIndex ) throw (uno::RuntimeException)
3281 @@ -347,7 +279,7 @@ ScVbaApplication::Evaluate( const ::rtl:
3283 ScVbaApplication::Dialogs( const uno::Any &aIndex ) throw (uno::RuntimeException)
3285 - uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), mxContext ) );
3286 + uno::Reference< excel::XDialogs > xDialogs( new ScVbaDialogs( uno::Reference< XHelperInterface >( this ), mxContext ) );
3287 if( !aIndex.hasValue() )
3288 return uno::Any( xDialogs );
3289 return uno::Any( xDialogs->Item( aIndex ) );
3290 @@ -460,7 +392,7 @@ ScVbaApplication::setCalculation( ::sal_
3292 ScVbaApplication::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException)
3294 - uno::Reference< XCollection > xWindows = ScVbaWindows::Windows( mxContext );
3295 + uno::Reference< excel::XWindows > xWindows( new ScVbaWindows( this, mxContext ) );
3296 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
3297 return uno::Any( xWindows );
3298 return uno::Any( xWindows->Item( aIndex, uno::Any() ) );
3299 @@ -571,11 +503,11 @@ ScVbaApplication::GoTo( const uno::Any&
3300 xModel->getCurrentController(), uno::UNO_QUERY_THROW );
3301 uno::Reference< sheet::XSpreadsheet > xDoc = xSpreadsheet->getActiveSheet();
3303 - ScTabViewShell* pShell = getCurrentBestViewShell();
3304 + ScTabViewShell* pShell = excel::getCurrentBestViewShell();
3305 ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
3308 - uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName( mxContext, sRangeName, getDocShell( xModel ), formula::FormulaGrammar::CONV_XL_R1C1 );
3309 + uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName( mxContext, sRangeName, excel::getDocShell( xModel ), formula::FormulaGrammar::CONV_XL_R1C1 );
3313 @@ -613,7 +545,7 @@ ScVbaApplication::GoTo( const uno::Any&
3314 if( Reference >>= xRange )
3316 uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
3317 - ScTabViewShell* pShell = getCurrentBestViewShell();
3318 + ScTabViewShell* pShell = excel::getCurrentBestViewShell();
3319 ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
3320 if ( xVbaRange.is() )
3322 @@ -643,38 +575,10 @@ ScVbaApplication::GoTo( const uno::Any&
3323 uno::Reference< uno::XInterface >() );
3328 - static uno::Reference< frame::XController > lcl_getCurrentController()
3330 - const uno::Reference< frame::XModel > xWorkingDoc( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
3331 - uno::Reference< frame::XController > xController;
3332 - if ( xWorkingDoc.is() )
3333 - xController.set( xWorkingDoc->getCurrentController(), uno::UNO_SET_THROW );
3335 - xController.set( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW );
3336 - return xController;
3341 ScVbaApplication::getCursor() throw (uno::RuntimeException)
3343 - sal_Int32 nPointerStyle( POINTER_ARROW );
3346 - const uno::Reference< frame::XController > xController( lcl_getCurrentController(), uno::UNO_SET_THROW );
3347 - const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW );
3348 - const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
3349 - // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only?
3350 - const Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
3352 - nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle();
3354 - catch( const uno::Exception& )
3356 - DBG_UNHANDLED_EXCEPTION();
3358 + sal_Int32 nPointerStyle = getPointerStyle();
3360 switch( nPointerStyle )
3362 @@ -696,82 +600,34 @@ ScVbaApplication::setCursor( sal_Int32 _
3366 - ::std::vector< uno::Reference< frame::XController > > aControllers;
3368 - const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
3369 - if ( xModel2.is() )
3371 - const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW );
3372 - while ( xEnumControllers->hasMoreElements() )
3374 - const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW );
3375 - aControllers.push_back( xController );
3381 - const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
3382 - if ( xModel.is() )
3383 + case excel::XlMousePointer::xlNorthwestArrow:
3385 - const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
3386 - aControllers.push_back( xController );
3387 + const Pointer& rPointer( POINTER_ARROW );
3388 + setCursorHelper( rPointer, sal_False );
3392 + case excel::XlMousePointer::xlWait:
3393 + case excel::XlMousePointer::xlIBeam:
3395 - const uno::Reference< frame::XController > xController( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW );
3396 - aControllers.push_back( xController );
3397 + const Pointer& rPointer( static_cast< PointerStyle >( _cursor ) );
3398 + //It will set the edit window, toobar and statusbar's mouse pointer.
3399 + setCursorHelper( rPointer, sal_True );
3404 - for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin();
3405 - controller != aControllers.end();
3409 - const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW );
3410 - const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
3412 - Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
3413 - OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" );
3418 + case excel::XlMousePointer::xlDefault:
3420 - case excel::XlMousePointer::xlNorthwestArrow:
3422 - const Pointer& rPointer( POINTER_ARROW );
3423 - pWindow->GetSystemWindow()->SetPointer( rPointer );
3424 - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_False );
3427 - case excel::XlMousePointer::xlWait:
3428 - case excel::XlMousePointer::xlIBeam:
3430 - const Pointer& rPointer( static_cast< PointerStyle >( _cursor ) );
3431 - //It will set the edit window, toobar and statusbar's mouse pointer.
3432 - pWindow->GetSystemWindow()->SetPointer( rPointer );
3433 - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_True );
3434 - //It only set the edit window's mouse pointer
3435 - //pWindow->.SetPointer( rPointer );
3436 - //pWindow->.EnableChildPointerOverwrite( sal_True );
3437 - //printf("\nset Cursor...%d\n", pWindow->.GetType());
3440 - case excel::XlMousePointer::xlDefault:
3442 - const Pointer& rPointer( POINTER_NULL );
3443 - pWindow->GetSystemWindow()->SetPointer( rPointer );
3444 - pWindow->GetSystemWindow()->EnableChildPointerOverwrite( sal_False );
3448 - throw uno::RuntimeException( rtl::OUString(
3449 - RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() );
3450 - // TODO: isn't this a flaw in the API? It should be allowed to throw an
3451 - // IllegalArgumentException, or so
3452 + const Pointer& rPointer( POINTER_NULL );
3453 + setCursorHelper( rPointer, sal_False );
3458 + throw uno::RuntimeException( rtl::OUString(
3459 + RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() );
3460 + // TODO: isn't this a flaw in the API? It should be allowed to throw an
3461 + // IllegalArgumentException, or so
3464 catch( const uno::Exception& )
3466 @@ -1145,7 +1001,7 @@ ScVbaApplication::Intersect( const uno::
3469 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
3470 - ScDocShell* pDocShell = getDocShell( xModel );
3471 + ScDocShell* pDocShell = excel::getDocShell( xModel );
3472 if ( aCellRanges.Count() == 1 )
3474 xRefRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) );
3475 @@ -1234,7 +1090,7 @@ ScVbaApplication::Union( const uno::Refe
3476 aCellRanges.Append( *it );
3478 uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
3479 - ScDocShell* pDocShell = getDocShell( xModel );
3480 + ScDocShell* pDocShell = excel::getDocShell( xModel );
3481 if ( aCellRanges.Count() == 1 )
3484 @@ -1269,16 +1125,11 @@ ScVbaApplication::Volatile( const uno::A
3489 -ScVbaApplication::DoEvents() throw ( uno::RuntimeException )
3494 ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException )
3496 sal_Bool bRes = sal_False;
3497 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
3498 + ScTabViewShell* pViewShell = excel::getCurrentBestViewShell();
3501 SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE);
3502 @@ -1296,7 +1147,7 @@ ScVbaApplication::getDisplayFormulaBar()
3504 ScVbaApplication::setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException )
3506 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
3507 + ScTabViewShell* pViewShell = excel::getCurrentBestViewShell();
3508 if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) )
3510 SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar);
3511 @@ -1343,3 +1194,13 @@ ScVbaApplication::getServiceNames()
3513 return aServiceNames;
3516 +namespace application
3518 +namespace sdecl = comphelper::service_decl;
3519 +sdecl::vba_service_class_<ScVbaApplication, sdecl::with_args<false> > serviceImpl;
3520 +extern sdecl::ServiceDecl const serviceDecl(
3522 + "ScVbaApplication",
3523 + "ooo.vba.excel.Application" );
3525 --- sc/source/ui/vba/vbaapplication.hxx.old 2009-04-06 16:41:59.000000000 +0000
3526 +++ sc/source/ui/vba/vbaapplication.hxx 2009-04-06 16:42:01.000000000 +0000
3528 #include <ooo/vba/excel/XApplication.hpp>
3529 #include <com/sun/star/uno/XComponentContext.hpp>
3531 -#include "vbahelperinterface.hxx"
3532 +#include <vbahelper/vbahelperinterface.hxx>
3533 +#include <vbahelper/vbaapplicationbase.hxx>
3534 +#include <cppuhelper/implbase1.hxx>
3536 -typedef InheritedHelperInterfaceImpl1< ov::excel::XApplication > ScVbaApplication_BASE;
3537 +//typedef InheritedHelperInterfaceImpl1< ov::excel::XApplication > ScVbaApplication_BASE;
3538 +typedef cppu::ImplInheritanceHelper1< VbaApplicationBase, ov::excel::XApplication > ScVbaApplication_BASE;
3540 class ScVbaApplication : public ScVbaApplication_BASE
3542 @@ -45,12 +48,9 @@ private:
3543 sal_Int32 m_xCalculation;
3544 rtl::OUString getOfficePath( const rtl::OUString& sPath ) throw ( css::uno::RuntimeException );
3546 - ScVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
3547 + ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext );
3548 virtual ~ScVbaApplication();
3550 - // XHelperInterface ( parent is itself )
3551 - virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
3554 virtual ::rtl::OUString SAL_CALL PathSeparator( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
3555 virtual void SAL_CALL setDefaultFilePath( const ::rtl::OUString& DefaultFilePath ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
3556 @@ -68,15 +68,10 @@ public:
3557 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getActiveCell() throw ( css::uno::RuntimeException);
3558 virtual css::uno::Reference< ov::excel::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
3559 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
3560 - virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException);
3561 - virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException);
3562 - virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
3563 - virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
3564 virtual ::sal_Bool SAL_CALL getDisplayFormulaBar() throw ( css::uno::RuntimeException );
3565 virtual void SAL_CALL setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException );
3567 virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException);
3568 - virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
3569 virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException);
3570 virtual css::uno::Any SAL_CALL Workbooks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
3571 virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
3572 @@ -102,7 +97,6 @@ public:
3573 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
3574 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
3575 virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) throw (css::uno::RuntimeException );
3576 - virtual void SAL_CALL DoEvents() throw (css::uno::RuntimeException);
3577 virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
3579 virtual rtl::OUString& getServiceImplName();
3580 --- sc/source/ui/vba/vbaassistant.hxx.old 2009-04-02 10:45:35.000000000 +0000
3581 +++ sc/source/ui/vba/vbaassistant.hxx 2009-04-06 16:42:01.000000000 +0000
3584 #include <sfx2/sfxhelp.hxx>
3586 -#include "vbahelper.hxx"
3587 -#include "vbahelperinterface.hxx"
3588 +#include "excelvbahelper.hxx"
3589 +#include <vbahelper/vbahelperinterface.hxx>
3591 typedef ::cppu::WeakImplHelper1< ov::XAssistant > Assistant;
3592 typedef InheritedHelperInterfaceImpl< Assistant > ScVbaAssistantImpl_BASE;
3593 --- sc/source/ui/vba/vbaaxes.hxx.old 2009-04-02 10:45:35.000000000 +0000
3594 +++ sc/source/ui/vba/vbaaxes.hxx 2009-04-06 16:42:01.000000000 +0000
3596 #include <ooo/vba/excel/XAxes.hpp>
3597 #include <ooo/vba/excel/XAxis.hpp>
3598 #include <ooo/vba/excel/XChart.hpp>
3599 -#include "vbacollectionimpl.hxx"
3600 +#include <vbahelper/vbacollectionimpl.hxx>
3602 typedef CollTestImplHelper< ov::excel::XAxes > ScVbaAxes_BASE;
3603 class ScVbaAxes : public ScVbaAxes_BASE
3604 --- sc/source/ui/vba/vbaaxis.hxx.old 2009-04-02 10:45:35.000000000 +0000
3605 +++ sc/source/ui/vba/vbaaxis.hxx 2009-04-06 16:42:01.000000000 +0000
3607 #include <com/sun/star/beans/XPropertySet.hpp>
3608 #include <ooo/vba/excel/XAxis.hpp>
3609 #include <ooo/vba/excel/XChart.hpp>
3610 -#include "vbahelperinterface.hxx"
3612 +#include <vbahelper/vbahelperinterface.hxx>
3614 typedef InheritedHelperInterfaceImpl1< ov::excel::XAxis > ScVbaAxis_BASE;
3616 class ScVbaAxis : public ScVbaAxis_BASE
3617 --- sc/source/ui/vba/vbaborders.hxx.old 2009-04-02 10:45:35.000000000 +0000
3618 +++ sc/source/ui/vba/vbaborders.hxx 2009-04-06 16:42:01.000000000 +0000
3620 #include <com/sun/star/beans/XPropertySet.hpp>
3623 -#include "vbacollectionimpl.hxx"
3624 +#include <vbahelper/vbacollectionimpl.hxx>
3626 typedef CollTestImplHelper< ov::excel::XBorders > ScVbaBorders_BASE;
3628 --- sc/source/ui/vba/vbabutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
3629 +++ sc/source/ui/vba/vbabutton.cxx 1970-01-01 00:00:00.000000000 +0000
3631 -/*************************************************************************
3633 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3635 - * Copyright 2008 by Sun Microsystems, Inc.
3637 - * OpenOffice.org - a multi-platform office productivity suite
3639 - * $RCSfile: vbabutton.cxx,v $
3640 - * $Revision: 1.3 $
3642 - * This file is part of OpenOffice.org.
3644 - * OpenOffice.org is free software: you can redistribute it and/or modify
3645 - * it under the terms of the GNU Lesser General Public License version 3
3646 - * only, as published by the Free Software Foundation.
3648 - * OpenOffice.org is distributed in the hope that it will be useful,
3649 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3650 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3651 - * GNU Lesser General Public License version 3 for more details
3652 - * (a copy is included in the LICENSE file that accompanied this code).
3654 - * You should have received a copy of the GNU Lesser General Public License
3655 - * version 3 along with OpenOffice.org. If not, see
3656 - * <http://www.openoffice.org/license.html>
3657 - * for a copy of the LGPLv3 License.
3659 - ************************************************************************/
3660 -#include "vbabutton.hxx"
3663 -using namespace com::sun::star;
3664 -using namespace ooo::vba;
3667 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
3668 -ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
3673 -rtl::OUString SAL_CALL
3674 -ScVbaButton::getCaption() throw (css::uno::RuntimeException)
3676 - rtl::OUString Label;
3677 - m_xProps->getPropertyValue( LABEL ) >>= Label;
3682 -ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
3684 - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
3688 -ScVbaButton::getServiceImplName()
3690 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") );
3694 -uno::Sequence< rtl::OUString >
3695 -ScVbaButton::getServiceNames()
3697 - static uno::Sequence< rtl::OUString > aServiceNames;
3698 - if ( aServiceNames.getLength() == 0 )
3700 - aServiceNames.realloc( 1 );
3701 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) );
3703 - return aServiceNames;
3705 --- sc/source/ui/vba/vbabutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
3706 +++ sc/source/ui/vba/vbabutton.hxx 1970-01-01 00:00:00.000000000 +0000
3708 -/*************************************************************************
3710 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3712 - * Copyright 2008 by Sun Microsystems, Inc.
3714 - * OpenOffice.org - a multi-platform office productivity suite
3716 - * $RCSfile: vbabutton.hxx,v $
3717 - * $Revision: 1.3 $
3719 - * This file is part of OpenOffice.org.
3721 - * OpenOffice.org is free software: you can redistribute it and/or modify
3722 - * it under the terms of the GNU Lesser General Public License version 3
3723 - * only, as published by the Free Software Foundation.
3725 - * OpenOffice.org is distributed in the hope that it will be useful,
3726 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3727 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3728 - * GNU Lesser General Public License version 3 for more details
3729 - * (a copy is included in the LICENSE file that accompanied this code).
3731 - * You should have received a copy of the GNU Lesser General Public License
3732 - * version 3 along with OpenOffice.org. If not, see
3733 - * <http://www.openoffice.org/license.html>
3734 - * for a copy of the LGPLv3 License.
3736 - ************************************************************************/
3737 -#ifndef SC_VBA_BUTTON_HXX
3738 -#define SC_VBA_BUTTON_HXX
3739 -#include <cppuhelper/implbase1.hxx>
3740 -#include <ooo/vba/msforms/XButton.hpp>
3742 -#include "vbacontrol.hxx"
3743 -#include "vbahelper.hxx"
3745 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
3747 -class ScVbaButton : public ButtonImpl_BASE
3750 - ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
3752 - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
3753 - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
3754 - //XHelperInterface
3755 - virtual rtl::OUString& getServiceImplName();
3756 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
3758 -#endif //SC_VBA_BUTTON_HXX
3759 --- sc/source/ui/vba/vbacharacters.hxx.old 2009-04-02 10:45:35.000000000 +0000
3760 +++ sc/source/ui/vba/vbacharacters.hxx 2009-04-06 16:42:01.000000000 +0000
3762 #include <com/sun/star/uno/XComponentContext.hpp>
3763 #include <com/sun/star/text/XSimpleText.hpp>
3765 -#include "vbahelperinterface.hxx"
3766 +#include <vbahelper/vbahelperinterface.hxx>
3767 #include "vbapalette.hxx"
3768 typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaCharacters_BASE;
3770 --- sc/source/ui/vba/vbachart.hxx.old 2009-04-02 10:45:35.000000000 +0000
3771 +++ sc/source/ui/vba/vbachart.hxx 2009-04-06 16:42:01.000000000 +0000
3773 #include <ooo/vba/excel/XChart.hpp>
3774 #include <ooo/vba/excel/XDataLabels.hpp>
3775 #include <ooo/vba/excel/XSeries.hpp>
3776 -#include "vbahelperinterface.hxx"
3777 +#include <vbahelper/vbahelperinterface.hxx>
3779 typedef InheritedHelperInterfaceImpl1<ov::excel::XChart > ChartImpl_BASE;
3781 --- sc/source/ui/vba/vbachartobject.hxx.old 2009-04-02 10:45:35.000000000 +0000
3782 +++ sc/source/ui/vba/vbachartobject.hxx 2009-04-06 16:42:01.000000000 +0000
3784 #include <com/sun/star/container/XNamed.hpp>
3785 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
3786 #include <ooo/vba/excel/XChartObject.hpp>
3787 -#include "vbahelperinterface.hxx"
3788 +#include <vbahelper/vbahelperinterface.hxx>
3791 typedef InheritedHelperInterfaceImpl1<ov::excel::XChartObject > ChartObjectImpl_BASE;
3792 --- sc/source/ui/vba/vbachartobjects.hxx.old 2009-04-02 10:45:35.000000000 +0000
3793 +++ sc/source/ui/vba/vbachartobjects.hxx 2009-04-06 16:42:01.000000000 +0000
3795 #include <com/sun/star/table/XTableCharts.hpp>
3796 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
3797 #include <com/sun/star/container/XEnumerationAccess.hpp>
3798 -#include"vbacollectionimpl.hxx"
3799 -#include "vbahelper.hxx"
3800 +#include <vbahelper/vbacollectionimpl.hxx>
3801 +#include "excelvbahelper.hxx"
3804 typedef CollTestImplHelper< ov::excel::XChartObjects > ChartObjects_BASE;
3805 --- sc/source/ui/vba/vbacharts.hxx.old 2009-04-02 10:45:35.000000000 +0000
3806 +++ sc/source/ui/vba/vbacharts.hxx 2009-04-06 16:42:01.000000000 +0000
3808 #define SC_VBA_CHARTS_HXX
3809 #include <ooo/vba/excel/XCharts.hpp>
3810 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
3811 -#include"vbacollectionimpl.hxx"
3812 -#include "vbahelper.hxx"
3813 +#include <vbahelper/vbacollectionimpl.hxx>
3814 +#include "excelvbahelper.hxx"
3817 typedef CollTestImplHelper< ov::excel::XCharts > Charts_BASE;
3818 --- sc/source/ui/vba/vbacheckbox.cxx.old 2009-04-02 10:45:35.000000000 +0000
3819 +++ sc/source/ui/vba/vbacheckbox.cxx 1970-01-01 00:00:00.000000000 +0000
3821 -/*************************************************************************
3823 - * OpenOffice.org - a multi-platform office productivity suite
3829 - * last change: $Author$ $Date$
3831 - * The Contents of this file are made available subject to
3832 - * the terms of GNU Lesser General Public License Version 2.1.
3835 - * GNU Lesser General Public License Version 2.1
3836 - * =============================================
3837 - * Copyright 2005 by Sun Microsystems, Inc.
3838 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
3840 - * This library is free software; you can redistribute it and/or
3841 - * modify it under the terms of the GNU Lesser General Public
3842 - * License version 2.1, as published by the Free Software Foundation.
3844 - * This library is distributed in the hope that it will be useful,
3845 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3846 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3847 - * Lesser General Public License for more details.
3849 - * You should have received a copy of the GNU Lesser General Public
3850 - * License along with this library; if not, write to the Free Software
3851 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3852 - * MA 02111-1307 USA
3854 - ************************************************************************/
3855 -#include "vbacheckbox.hxx"
3858 -using namespace com::sun::star;
3859 -using namespace ooo::vba;
3862 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
3863 -const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
3864 -ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
3869 -rtl::OUString SAL_CALL
3870 -ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException)
3872 - rtl::OUString Label;
3873 - m_xProps->getPropertyValue( LABEL ) >>= Label;
3878 -ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
3880 - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
3884 -ScVbaCheckbox::getValue() throw (css::uno::RuntimeException)
3886 - sal_Int16 nValue = -1;
3887 - m_xProps->getPropertyValue( STATE ) >>= nValue;
3890 -// return uno::makeAny( nValue );
3891 -// I must be missing something MSO says value should be -1 if selected, 0 if not
3893 - return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False );
3897 -ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
3899 - sal_Int16 nValue = 0;
3900 - sal_Bool bValue = false;
3901 - if( _value >>= nValue )
3906 - else if ( _value >>= bValue )
3911 - m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
3914 -ScVbaCheckbox::getServiceImplName()
3916 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") );
3920 -uno::Sequence< rtl::OUString >
3921 -ScVbaCheckbox::getServiceNames()
3923 - static uno::Sequence< rtl::OUString > aServiceNames;
3924 - if ( aServiceNames.getLength() == 0 )
3926 - aServiceNames.realloc( 1 );
3927 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) );
3929 - return aServiceNames;
3931 --- sc/source/ui/vba/vbacheckbox.hxx.old 2009-04-02 10:45:35.000000000 +0000
3932 +++ sc/source/ui/vba/vbacheckbox.hxx 1970-01-01 00:00:00.000000000 +0000
3934 -/*************************************************************************
3936 - * OpenOffice.org - a multi-platform office productivity suite
3942 - * last change: $Author$ $Date$
3944 - * The Contents of this file are made available subject to
3945 - * the terms of GNU Lesser General Public License Version 2.1.
3948 - * GNU Lesser General Public License Version 2.1
3949 - * =============================================
3950 - * Copyright 2005 by Sun Microsystems, Inc.
3951 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
3953 - * This library is free software; you can redistribute it and/or
3954 - * modify it under the terms of the GNU Lesser General Public
3955 - * License version 2.1, as published by the Free Software Foundation.
3957 - * This library is distributed in the hope that it will be useful,
3958 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3959 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3960 - * Lesser General Public License for more details.
3962 - * You should have received a copy of the GNU Lesser General Public
3963 - * License along with this library; if not, write to the Free Software
3964 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
3965 - * MA 02111-1307 USA
3967 - ************************************************************************/
3968 -#ifndef SC_VBA_CHECKBOX_HXX
3969 -#define SC_VBA_CHECKBOX_HXX
3970 -#include <cppuhelper/implbase2.hxx>
3971 -#include <ooo/vba/msforms/XRadioButton.hpp>
3973 -#include "vbacontrol.hxx"
3974 -#include "vbahelper.hxx"
3976 -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
3978 -class ScVbaCheckbox : public CheckBoxImpl_BASE
3981 - ScVbaCheckbox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
3983 - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
3984 - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
3985 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
3986 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
3987 - // XDefaultProperty
3988 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
3989 - //XHelperInterface
3990 - virtual rtl::OUString& getServiceImplName();
3991 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
3993 -#endif //SC_VBA_CHECKBOX_HXX
3994 --- sc/source/ui/vba/vbacollectionimpl.cxx.old 2009-04-02 10:45:35.000000000 +0000
3995 +++ sc/source/ui/vba/vbacollectionimpl.cxx 1970-01-01 00:00:00.000000000 +0000
3997 -/*************************************************************************
3999 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4001 - * Copyright 2008 by Sun Microsystems, Inc.
4003 - * OpenOffice.org - a multi-platform office productivity suite
4005 - * $RCSfile: vbacollectionimpl.cxx,v $
4006 - * $Revision: 1.3 $
4008 - * This file is part of OpenOffice.org.
4010 - * OpenOffice.org is free software: you can redistribute it and/or modify
4011 - * it under the terms of the GNU Lesser General Public License version 3
4012 - * only, as published by the Free Software Foundation.
4014 - * OpenOffice.org is distributed in the hope that it will be useful,
4015 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4016 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4017 - * GNU Lesser General Public License version 3 for more details
4018 - * (a copy is included in the LICENSE file that accompanied this code).
4020 - * You should have received a copy of the GNU Lesser General Public License
4021 - * version 3 along with OpenOffice.org. If not, see
4022 - * <http://www.openoffice.org/license.html>
4023 - * for a copy of the LGPLv3 License.
4025 - ************************************************************************/
4026 -#include <vbacollectionimpl.hxx>
4027 -#include "vbaglobals.hxx"
4028 -using namespace ::com::sun::star;
4029 -using namespace ::ooo::vba;
4032 -ScVbaCollectionBaseImpl::ScVbaCollectionBaseImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : m_xContext( xContext ), m_xIndexAccess( xIndexAccess )
4034 - m_xNameAccess.set( xIndexAccess, uno::UNO_QUERY );
4038 -ScVbaCollectionBaseImpl::getItemByStringIndex( const rtl::OUString& sIndex ) throw (::uno::RuntimeException)
4040 - if ( !m_xNameAccess.is() )
4041 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl string index access not supported by this object") ), uno::Reference< uno::XInterface >() );
4043 - return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
4047 -ScVbaCollectionBaseImpl::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException)
4049 - if ( !m_xIndexAccess.is() )
4050 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl numeric index access not supported by this object") ), uno::Reference< uno::XInterface >() );
4051 - if ( nIndex <= 0 )
4053 - throw lang::IndexOutOfBoundsException(
4054 - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
4055 - "index is 0 or negative" ) ),
4056 - uno::Reference< uno::XInterface >() );
4058 - // need to adjust for vba index ( for which first element is 1 )
4059 - return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
4062 -::sal_Int32 SAL_CALL
4063 -ScVbaCollectionBaseImpl::getCount() throw (uno::RuntimeException)
4065 - return m_xIndexAccess->getCount();
4069 -ScVbaCollectionBaseImpl::getParent() throw (uno::RuntimeException)
4071 - // #TODO #FIXME investigate whether this makes sense
4072 - uno::Reference< excel::XApplication > xApplication =
4073 - ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication();
4074 - uno::Reference< excel::XWorkbook > xWorkbook;
4075 - if ( xApplication.is() )
4077 - xWorkbook = xApplication->getActiveWorkbook();
4079 - return uno::Any( xWorkbook );
4082 -::sal_Int32 SAL_CALL ScVbaCollectionBaseImpl::getCreator() throw (uno::RuntimeException)
4084 - // #TODO #FIXE some sort of implementation
4088 -uno::Reference< excel::XApplication > SAL_CALL ScVbaCollectionBaseImpl::getApplication() throw (uno::RuntimeException)
4090 - // #TODO #FIXME investigate whether this makes sense
4091 - uno::Reference< excel::XApplication > xApplication =
4092 - ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication();
4093 - return xApplication;
4096 -uno::Any SAL_CALL ScVbaCollectionBaseImpl::Item( const uno::Any& aIndex ) throw (uno::RuntimeException)
4098 - if ( aIndex.getValueTypeClass() != uno::TypeClass_STRING )
4100 - sal_Int32 nIndex = 0;
4102 - if ( ( aIndex >>= nIndex ) != sal_True )
4104 - rtl::OUString message;
4105 - message = rtl::OUString::createFromAscii(
4106 - "Couldn't convert index to Int32");
4107 - throw lang::IndexOutOfBoundsException( message,
4108 - uno::Reference< uno::XInterface >() );
4110 - return getItemByIntIndex( nIndex );
4112 - rtl::OUString aStringSheet;
4114 - aIndex >>= aStringSheet;
4115 - return getItemByStringIndex( aStringSheet );
4118 -::rtl::OUString SAL_CALL
4119 -ScVbaCollectionBaseImpl::getDefaultMethodName( ) throw (css::uno::RuntimeException)
4121 - const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
4127 -::sal_Bool SAL_CALL ScVbaCollectionBaseImpl::hasElements() throw (uno::RuntimeException)
4129 - return ( m_xIndexAccess->getCount() > 0 );
4133 --- sc/source/ui/vba/vbacollectionimpl.hxx.old 2009-04-02 10:45:35.000000000 +0000
4134 +++ sc/source/ui/vba/vbacollectionimpl.hxx 1970-01-01 00:00:00.000000000 +0000
4136 -/*************************************************************************
4138 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4140 - * Copyright 2008 by Sun Microsystems, Inc.
4142 - * OpenOffice.org - a multi-platform office productivity suite
4144 - * $RCSfile: vbacollectionimpl.hxx,v $
4145 - * $Revision: 1.5 $
4147 - * This file is part of OpenOffice.org.
4149 - * OpenOffice.org is free software: you can redistribute it and/or modify
4150 - * it under the terms of the GNU Lesser General Public License version 3
4151 - * only, as published by the Free Software Foundation.
4153 - * OpenOffice.org is distributed in the hope that it will be useful,
4154 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4155 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4156 - * GNU Lesser General Public License version 3 for more details
4157 - * (a copy is included in the LICENSE file that accompanied this code).
4159 - * You should have received a copy of the GNU Lesser General Public License
4160 - * version 3 along with OpenOffice.org. If not, see
4161 - * <http://www.openoffice.org/license.html>
4162 - * for a copy of the LGPLv3 License.
4164 - ************************************************************************/
4165 -#ifndef SC_VBA_COLLECTION_IMPL_HXX
4166 -#define SC_VBA_COLLECTION_IMPL_HXX
4168 -#include <ooo/vba/XCollection.hpp>
4169 -//#include <ooo/vba/XCollectionTest.hpp>
4170 -#include <com/sun/star/container/XEnumerationAccess.hpp>
4171 -#include <com/sun/star/uno/XComponentContext.hpp>
4172 -#include <com/sun/star/script/XDefaultMethod.hpp>
4173 -#include <com/sun/star/container/XIndexAccess.hpp>
4174 -#include <com/sun/star/container/XNameAccess.hpp>
4175 -#include <com/sun/star/container/XNamed.hpp>
4177 -#include <cppuhelper/implbase3.hxx>
4178 -#include <cppuhelper/implbase2.hxx>
4179 -#include <cppuhelper/implbase1.hxx>
4181 -#include "vbahelper.hxx"
4182 -#include "vbahelperinterface.hxx"
4183 -#include "vbaglobals.hxx"
4187 -typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
4189 -class EnumerationHelperImpl : public EnumerationHelper_BASE
4192 - css::uno::Reference< css::uno::XComponentContext > m_xContext;
4193 - css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
4196 - EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
4197 - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
4200 -// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces
4201 -// only requirement is the object needs to implement XName
4205 -typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
4207 -template< typename Ifc1 >
4208 -class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
4211 -typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec;
4214 - class XNamedEnumerationHelper : public EnumerationHelper_BASE
4216 - XNamedVec mXNamedVec;
4217 - typename XNamedVec::iterator mIt;
4219 - XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {}
4221 - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException)
4223 - return ( mIt != mXNamedVec.end() );
4226 - virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
4228 - if ( hasMoreElements() )
4229 - return css::uno::makeAny( *mIt++ );
4230 - throw css::container::NoSuchElementException();
4235 - XNamedVec mXNamedVec;
4236 - typename XNamedVec::iterator cachePos;
4238 - XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {}
4240 - virtual css::uno::Type SAL_CALL getElementType( ) throw (css::uno::RuntimeException) { return Ifc1::static_type(0); }
4241 - virtual ::sal_Bool SAL_CALL hasElements( ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); }
4243 - virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
4245 - if ( !hasByName(aName) )
4246 - throw css::container::NoSuchElementException();
4247 - return css::uno::makeAny( *cachePos );
4249 - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException)
4251 - css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() );
4252 - rtl::OUString* pString = sNames.getArray();
4253 - typename XNamedVec::iterator it = mXNamedVec.begin();
4254 - typename XNamedVec::iterator it_end = mXNamedVec.end();
4256 - for ( ; it != it_end; ++it, ++pString )
4258 - css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW );
4259 - *pString = xName->getName();
4263 - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
4265 - cachePos = mXNamedVec.begin();
4266 - typename XNamedVec::iterator it_end = mXNamedVec.end();
4267 - for ( ; cachePos != it_end; ++cachePos )
4269 - css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW );
4270 - if ( aName.equals( xName->getName() ) )
4273 - return ( cachePos != it_end );
4277 - virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); }
4278 - virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException )
4280 - if ( Index < 0 || Index >= getCount() )
4281 - throw css::lang::IndexOutOfBoundsException();
4283 - return css::uno::makeAny( mXNamedVec[ Index ] );
4286 - // XEnumerationAccess
4287 - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) throw (css::uno::RuntimeException)
4289 - return new XNamedEnumerationHelper( mXNamedVec );
4293 -// including a HelperInterface implementation
4294 -template< typename Ifc1 >
4295 -class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
4297 -typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
4299 - css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
4300 - css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
4302 - virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
4304 - if ( !m_xNameAccess.is() )
4305 - throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
4307 - return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
4310 - virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException)
4312 - if ( !m_xIndexAccess.is() )
4313 - throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
4314 - if ( nIndex <= 0 )
4316 - throw css::lang::IndexOutOfBoundsException(
4317 - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
4318 - "index is 0 or negative" ) ),
4319 - css::uno::Reference< css::uno::XInterface >() );
4321 - // need to adjust for vba index ( for which first element is 1 )
4322 - return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
4325 - ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
4327 - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
4329 - return m_xIndexAccess->getCount();
4332 - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException)
4334 - if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING )
4336 - sal_Int32 nIndex = 0;
4338 - if ( ( Index1 >>= nIndex ) != sal_True )
4340 - rtl::OUString message;
4341 - message = rtl::OUString::createFromAscii(
4342 - "Couldn't convert index to Int32");
4343 - throw css::lang::IndexOutOfBoundsException( message,
4344 - css::uno::Reference< css::uno::XInterface >() );
4346 - return getItemByIntIndex( nIndex );
4348 - rtl::OUString aStringSheet;
4350 - Index1 >>= aStringSheet;
4351 - return getItemByStringIndex( aStringSheet );
4354 - ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException)
4356 - const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
4359 - // XEnumerationAccess
4360 - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;
4363 - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
4365 - virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
4367 - return ( m_xIndexAccess->getCount() > 0 );
4369 - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
4373 -typedef ::cppu::WeakImplHelper1<ov::XCollection> XCollection_InterfacesBASE;
4375 -typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1;
4376 -// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this )
4377 -class ScVbaCollectionBaseImpl : public CollImplBase1
4380 - ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){}
4384 -template <typename Ifc> // where Ifc must implement XCollectionTest
4385 -class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
4387 -typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
4390 - CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
4394 -#endif //SC_VBA_COLLECTION_IMPL_HXX
4395 --- sc/source/ui/vba/vbacolorformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
4396 +++ sc/source/ui/vba/vbacolorformat.hxx 2009-04-06 16:42:01.000000000 +0000
4398 #include <com/sun/star/drawing/XShape.hpp>
4399 #include <ooo/vba/msforms/XColorFormat.hpp>
4400 #include <ooo/vba/msforms/XFillFormat.hpp>
4401 -#include "vbahelperinterface.hxx"
4402 +#include <vbahelper/vbahelperinterface.hxx>
4403 #include "vbafillformat.hxx"
4405 typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE;
4406 --- sc/source/ui/vba/vbacombobox.cxx.old 2009-04-02 10:45:35.000000000 +0000
4407 +++ sc/source/ui/vba/vbacombobox.cxx 1970-01-01 00:00:00.000000000 +0000
4409 -/*************************************************************************
4411 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4413 - * Copyright 2008 by Sun Microsystems, Inc.
4415 - * OpenOffice.org - a multi-platform office productivity suite
4417 - * $RCSfile: vbacombobox.cxx,v $
4418 - * $Revision: 1.4 $
4420 - * This file is part of OpenOffice.org.
4422 - * OpenOffice.org is free software: you can redistribute it and/or modify
4423 - * it under the terms of the GNU Lesser General Public License version 3
4424 - * only, as published by the Free Software Foundation.
4426 - * OpenOffice.org is distributed in the hope that it will be useful,
4427 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4428 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4429 - * GNU Lesser General Public License version 3 for more details
4430 - * (a copy is included in the LICENSE file that accompanied this code).
4432 - * You should have received a copy of the GNU Lesser General Public License
4433 - * version 3 along with OpenOffice.org. If not, see
4434 - * <http://www.openoffice.org/license.html>
4435 - * for a copy of the LGPLv3 License.
4437 - ************************************************************************/
4438 -#include "vbacombobox.hxx"
4441 -using namespace com::sun::star;
4442 -using namespace ooo::vba;
4445 -//SelectedItems list of integer indexes
4446 -//StringItemList list of items
4448 -const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
4449 -const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
4450 -const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
4451 -const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") );
4453 -ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
4455 - mpListHelper.reset( new ListControlHelper( m_xProps ) );
4456 - // grab the default value property name
4457 - m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
4463 -// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in
4466 -ScVbaComboBox::getValue() throw (uno::RuntimeException)
4468 - return m_xProps->getPropertyValue( sSourceName );
4472 -ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
4474 - uno::Sequence< sal_Int16 > sSelection(1);
4475 - _value >>= sSelection[ 0 ];
4476 - m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) );
4480 -ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
4482 - uno::Sequence< rtl::OUString > sItems;
4483 - m_xProps->getPropertyValue( ITEMS ) >>= sItems;
4484 - // should really return the item that has focus regardless of
4485 - // it been selected
4486 - if ( sItems.getLength() > 0 )
4488 - rtl::OUString sText = getText();
4489 - sal_Int32 nLen = sItems.getLength();
4490 - for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index )
4492 - if ( sItems[ index ].equals( sText ) )
4494 - OSL_TRACE("getListIndex returning %d", index );
4495 - return uno::makeAny( index );
4500 - OSL_TRACE("getListIndex returning %d", -1 );
4501 - return uno::makeAny( sal_Int32( -1 ) );
4504 -// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one
4505 -// of the values in the list then the selection is also set
4507 -ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
4509 - m_xProps->setPropertyValue( sSourceName, _value );
4514 -::rtl::OUString SAL_CALL
4515 -ScVbaComboBox::getText() throw (uno::RuntimeException)
4517 - rtl::OUString result;
4518 - getValue() >>= result;
4523 -ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
4525 - setValue( uno::makeAny( _text ) ); // seems the same
4530 -ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
4532 - mpListHelper->AddItem( pvargItem, pvargIndex );
4536 -ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
4538 - mpListHelper->removeItem( index );
4542 -ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
4544 - mpListHelper->Clear();
4548 -ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
4550 - ScVbaControl::setRowSource( _rowsource );
4551 - mpListHelper->setRowSource( _rowsource );
4555 -ScVbaComboBox::getListCount() throw (uno::RuntimeException)
4557 - return mpListHelper->getListCount();
4561 -ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
4563 - return mpListHelper->List( pvargIndex, pvarColumn );
4567 -ScVbaComboBox::getServiceImplName()
4569 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") );
4573 -uno::Sequence< rtl::OUString >
4574 -ScVbaComboBox::getServiceNames()
4576 - static uno::Sequence< rtl::OUString > aServiceNames;
4577 - if ( aServiceNames.getLength() == 0 )
4579 - aServiceNames.realloc( 1 );
4580 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) );
4582 - return aServiceNames;
4584 --- sc/source/ui/vba/vbacombobox.hxx.old 2009-04-02 10:45:35.000000000 +0000
4585 +++ sc/source/ui/vba/vbacombobox.hxx 1970-01-01 00:00:00.000000000 +0000
4587 -/*************************************************************************
4589 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4591 - * Copyright 2008 by Sun Microsystems, Inc.
4593 - * OpenOffice.org - a multi-platform office productivity suite
4595 - * $RCSfile: vbacombobox.hxx,v $
4596 - * $Revision: 1.4 $
4598 - * This file is part of OpenOffice.org.
4600 - * OpenOffice.org is free software: you can redistribute it and/or modify
4601 - * it under the terms of the GNU Lesser General Public License version 3
4602 - * only, as published by the Free Software Foundation.
4604 - * OpenOffice.org is distributed in the hope that it will be useful,
4605 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4606 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4607 - * GNU Lesser General Public License version 3 for more details
4608 - * (a copy is included in the LICENSE file that accompanied this code).
4610 - * You should have received a copy of the GNU Lesser General Public License
4611 - * version 3 along with OpenOffice.org. If not, see
4612 - * <http://www.openoffice.org/license.html>
4613 - * for a copy of the LGPLv3 License.
4615 - ************************************************************************/
4616 -#ifndef SC_VBA_COMBOBOX_HXX
4617 -#define SC_VBA_COMBOBOX_HXX
4618 -#include <cppuhelper/implbase2.hxx>
4619 -#include <com/sun/star/uno/XComponentContext.hpp>
4620 -#include <com/sun/star/beans/XPropertySet.hpp>
4621 -#include <com/sun/star/script/XDefaultProperty.hpp>
4622 -#include <ooo/vba/msforms/XComboBox.hpp>
4623 -#include <comphelper/proparrhlp.hxx>
4624 -#include <comphelper/propertycontainer.hxx>
4625 -#include <com/sun/star/beans/PropertyAttribute.hpp>
4627 -#include "vbacontrol.hxx"
4628 -#include "vbalistcontrolhelper.hxx"
4629 -#include "vbahelper.hxx"
4631 -typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
4632 -class ScVbaComboBox : public ComboBoxImpl_BASE
4634 - std::auto_ptr< ListControlHelper > mpListHelper;
4635 - rtl::OUString sSourceName;
4636 - rtl::OUString msDftPropName;
4637 - bool mbDialogType;
4640 - ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false );
4643 - virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
4644 - virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
4645 - virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
4646 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
4647 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
4648 - virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
4649 - virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
4652 - virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
4653 - virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
4654 - virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
4655 - virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
4657 - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
4659 - // XDefaultProperty
4660 - ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
4661 - //XHelperInterface
4662 - virtual rtl::OUString& getServiceImplName();
4663 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
4667 --- sc/source/ui/vba/vbacommandbar.cxx.old 2009-04-06 16:42:00.000000000 +0000
4668 +++ sc/source/ui/vba/vbacommandbar.cxx 1970-01-01 00:00:00.000000000 +0000
4670 -/*************************************************************************
4672 - * OpenOffice.org - a multi-platform office productivity suite
4678 - * last change: $Author$ $Date$
4680 - * The Contents of this file are made available subject to
4681 - * the terms of GNU Lesser General Public License Version 2.1.
4684 - * GNU Lesser General Public License Version 2.1
4685 - * =============================================
4686 - * Copyright 2005 by Sun Microsystems, Inc.
4687 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
4689 - * This library is free software; you can redistribute it and/or
4690 - * modify it under the terms of the GNU Lesser General Public
4691 - * License version 2.1, as published by the Free Software Foundation.
4693 - * This library is distributed in the hope that it will be useful,
4694 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4695 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4696 - * Lesser General Public License for more details.
4698 - * You should have received a copy of the GNU Lesser General Public
4699 - * License along with this library; if not, write to the Free Software
4700 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
4701 - * MA 02111-1307 USA
4703 - ************************************************************************/
4704 -#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
4705 -#include <com/sun/star/frame/XFrame.hpp>
4706 -#include <com/sun/star/frame/XDesktop.hpp>
4707 -#include <com/sun/star/frame/XLayoutManager.hpp>
4708 -#include <com/sun/star/beans/XPropertySet.hpp>
4709 -#include <ooo/vba/office/MsoBarType.hpp>
4711 -#include "vbacommandbar.hxx"
4712 -#include "vbacommandbarcontrols.hxx"
4713 -#include "vbahelper.hxx"
4716 -using namespace com::sun::star;
4717 -using namespace ooo::vba;
4719 -ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext )
4721 - // it's a menu bar
4722 - // only supporting factory menus ( no custom menus )
4723 - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
4725 - switch( nModuleType )
4728 - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" );
4731 - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" );
4734 - m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" );
4736 - getMenuSettings();
4737 - m_bIsMenu = sal_True;
4738 - m_bCustom = sal_False;
4740 -ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext )
4742 - // it's a tool bar
4743 - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
4745 - m_bTemporary = bTemporary;
4746 - m_bCreate = bCreate;
4747 - // get OOo ToolBarName
4748 - CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() );
4749 - if( iter != mCommandBarNameMap.end() )
4751 - m_sToolBarName = iter->second;
4755 - m_sToolBarName = sToolBarName;
4757 - m_sUIName = m_sToolBarName;
4758 - m_bIsMenu = sal_False;
4759 - getToolBarSettings( m_sToolBarName );
4762 -ScVbaCommandBar::initCommandBar() throw (uno::RuntimeException)
4764 - m_pScVbaCommandBars = dynamic_cast< ScVbaCommandBars* >( m_xParentHardRef.get() );
4765 - if ( !m_pScVbaCommandBars )
4766 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBars"), uno::Reference< uno::XInterface >() );
4767 - m_bIsMenu = sal_False;
4768 - m_bCustom = sal_False;
4769 - m_bTemporary = sal_True;
4770 - m_sToolBarName = rtl::OUString::createFromAscii("");
4771 - m_sUIName = rtl::OUString::createFromAscii("");
4772 - m_sMenuModuleName = m_pScVbaCommandBars->GetModuleName();
4775 -ScVbaCommandBar::getToolBarSettings( rtl::OUString sToolBarName ) throw( uno::RuntimeException )
4777 - rtl::OUString sFactoryToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/") + sToolBarName.toAsciiLowerCase();
4778 - rtl::OUString sCustomToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/custom_toolbar_") + sToolBarName;
4779 - uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
4780 - uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW );
4781 - m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_pScVbaCommandBars->GetModuleName() ), uno::UNO_QUERY_THROW );
4782 - m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW );
4783 - if( m_xUICfgManager->hasSettings( sFactoryToolBar ) )
4785 - // exsiting standard ToolBar
4786 - m_xBarSettings.set( m_xUICfgManager->getSettings( sFactoryToolBar, sal_True ), uno::UNO_QUERY_THROW );
4787 - m_sToolBarName = sFactoryToolBar;
4789 - else if( m_xUICfgManager->hasSettings( sCustomToolBar ) )
4791 - // exisiting custom ToolBar
4792 - m_xBarSettings.set( m_xUICfgManager->getSettings( sCustomToolBar, sal_True ), uno::UNO_QUERY_THROW );
4793 - m_sToolBarName = sCustomToolBar;
4794 - m_bCustom = sal_True;
4796 - else if( m_bCreate )
4798 - // new custom ToolBar
4799 - m_xBarSettings.set( m_xUICfgManager->createSettings(), uno::UNO_QUERY_THROW );
4800 - m_sToolBarName = sCustomToolBar;
4801 - m_bCustom = sal_True;
4805 - throw uno::RuntimeException( rtl::OUString::createFromAscii("ToolBar do not exist"), uno::Reference< uno::XInterface >() );
4806 - if( m_pScVbaCommandBars->GetWindows()->hasByName( m_sToolBarName ) )
4808 - uno::Any aToolBar = m_pScVbaCommandBars->GetWindows()->getByName( m_sToolBarName );
4809 - aToolBar >>= m_aToolBar;
4813 -ScVbaCommandBar::addCustomBar()
4815 - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
4816 - xPropertySet->setPropertyValue(rtl::OUString::createFromAscii("UIName"), uno::makeAny( m_sUIName ));
4818 - if( m_xUICfgManager->hasSettings(m_sToolBarName) )
4820 - m_xUICfgManager->replaceSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
4824 - m_xUICfgManager->insertSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
4826 - if( !m_bTemporary )
4828 - m_xUICfgPers->store();
4832 -ScVbaCommandBar::getMenuSettings()
4836 - rtl::OUString sMenuBar = rtl::OUString::createFromAscii( "private:resource/menubar/menubar" );
4837 - uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
4838 - uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW );
4839 - m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_sMenuModuleName ), uno::UNO_QUERY_THROW );
4840 - m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW );
4841 - m_xBarSettings.set( m_xUICfgManager->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
4843 - catch ( uno::Exception e)
4845 - OSL_TRACE( "getMenuSetting got a error\n" );
4848 -::rtl::OUString SAL_CALL
4849 -ScVbaCommandBar::getName() throw ( uno::RuntimeException )
4851 - // This will get a "NULL length string" when Name is not set.
4852 - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
4853 - uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") );
4854 - rtl::OUString sName;
4856 - if( sName.getLength() < 1 && !m_bIsMenu )
4858 - uno::Reference< container::XNameAccess > xNameAccess( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
4859 - if( xNameAccess->hasByName( m_sToolBarName ) )
4861 - beans::PropertyValues aToolBar;
4862 - xNameAccess->getByName( m_sToolBarName ) >>= aToolBar;
4863 - sal_Int32 nCount = aToolBar.getLength();
4864 - beans::PropertyValue aPropertyValue;
4865 - for( sal_Int32 i = 0; i < nCount; i++ )
4867 - aPropertyValue = aToolBar[i];
4868 - if( aPropertyValue.Name.equals( rtl::OUString::createFromAscii("UIName") ) )
4870 - aPropertyValue.Value >>= sName;
4879 -ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException)
4881 - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
4882 - xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) );
4883 - uno::Reference< container::XIndexAccess > xIndexAccess( m_xBarSettings, uno::UNO_QUERY_THROW );
4885 - if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
4887 - m_xUICfgManager->replaceSettings( m_sToolBarName, xIndexAccess );
4891 - // toolbar not found
4893 - if( !m_bTemporary )
4895 - m_xUICfgPers->store();
4898 -::sal_Bool SAL_CALL
4899 -ScVbaCommandBar::getVisible() throw (uno::RuntimeException)
4901 - sal_Bool bVisible = sal_False;
4905 - while( !m_aToolBar[i].Name.equals( rtl::OUString::createFromAscii( "Visible" ) ) )
4909 - m_aToolBar[i].Value >>= bVisible;
4911 - catch ( uno::Exception e )
4917 -ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
4921 - uno::Reference< frame::XFrame > xFrame( getCurrentDocument()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
4922 - uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW );
4923 - uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW );
4926 - xLayoutManager->createElement( m_sToolBarName );
4927 - xLayoutManager->showElement( m_sToolBarName );
4931 - xLayoutManager->hideElement( m_sToolBarName );
4932 - xLayoutManager->destroyElement( m_sToolBarName );
4935 - catch( uno::Exception e )
4937 - OSL_TRACE( "SetVisible get an exception\n" );
4941 -ScVbaCommandBar::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
4945 - if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
4947 - m_xUICfgManager->removeSettings(m_sToolBarName);
4948 - // make it permanent
4949 - if( !m_bTemporary )
4951 - m_xUICfgPers->store();
4956 - // toolbar not found
4957 - // TODO throw Error
4959 - uno::Reference< container::XNameContainer > xNameContainer( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
4960 - if( xNameContainer->hasByName( m_sToolBarName ) )
4962 - xNameContainer->removeByName( m_sToolBarName );
4967 -ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
4970 - uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
4971 - if( aIndex.hasValue() )
4973 - if( aIndex >>= nIndex )
4975 - uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
4976 - return uno::makeAny( xCommandBarControl );
4979 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() );
4981 - return uno::makeAny( xCommandBarControls );
4985 -ScVbaCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException)
4987 - // #FIXME support msoBarTypePopup
4988 - sal_Int32 nType = office::MsoBarType::msoBarTypePopup;
4989 - nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar;
4994 -ScVbaCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException)
4996 - // alwayse fail to find control
4997 - return uno::makeAny( uno::Reference< XCommandBarControl > () );
5001 -ScVbaCommandBar::getServiceImplName()
5003 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") );
5006 -uno::Sequence<rtl::OUString>
5007 -ScVbaCommandBar::getServiceNames()
5009 - static uno::Sequence< rtl::OUString > aServiceNames;
5010 - if ( aServiceNames.getLength() == 0 )
5012 - aServiceNames.realloc( 1 );
5013 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBar" ) );
5015 - return aServiceNames;
5017 --- sc/source/ui/vba/vbacommandbar.hxx.old 2009-04-06 16:42:00.000000000 +0000
5018 +++ sc/source/ui/vba/vbacommandbar.hxx 1970-01-01 00:00:00.000000000 +0000
5020 -/*************************************************************************
5022 - * OpenOffice.org - a multi-platform office productivity suite
5028 - * last change: $Author$ $Date$
5030 - * The Contents of this file are made available subject to
5031 - * the terms of GNU Lesser General Public License Version 2.1.
5034 - * GNU Lesser General Public License Version 2.1
5035 - * =============================================
5036 - * Copyright 2005 by Sun Microsystems, Inc.
5037 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
5039 - * This library is free software; you can redistribute it and/or
5040 - * modify it under the terms of the GNU Lesser General Public
5041 - * License version 2.1, as published by the Free Software Foundation.
5043 - * This library is distributed in the hope that it will be useful,
5044 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5045 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5046 - * Lesser General Public License for more details.
5048 - * You should have received a copy of the GNU Lesser General Public
5049 - * License along with this library; if not, write to the Free Software
5050 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
5051 - * MA 02111-1307 USA
5053 - ************************************************************************/
5054 -#ifndef SC_VBA_COMMANDBAR_HXX
5055 -#define SC_VBA_COMMANDBAR_HXX
5057 -#include <ooo/vba/XCommandBar.hpp>
5058 -#include <com/sun/star/ui/XUIConfigurationManager.hpp>
5059 -#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
5060 -#include <com/sun/star/container/XIndexContainer.hpp>
5061 -#include <com/sun/star/beans/PropertyValues.hpp>
5063 -#include "vbahelperinterface.hxx"
5064 -#include "vbacommandbars.hxx"
5067 -typedef std::map< const rtl::OUString, rtl::OUString > CommandBarNameMap;
5068 -typedef std::pair< const rtl::OUString, rtl::OUString > CommandBarNamePair;
5069 -const CommandBarNamePair namePair[] = {
5070 - CommandBarNamePair( rtl::OUString::createFromAscii("standard"), rtl::OUString::createFromAscii("standardbar") ),
5071 - CommandBarNamePair( rtl::OUString::createFromAscii("formatting"), rtl::OUString::createFromAscii("formatobjectbar") ),
5073 -static const CommandBarNameMap mCommandBarNameMap( namePair, ( namePair + sizeof(namePair) / sizeof(namePair[0]) ) );
5076 -typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE;
5078 -class ScVbaCommandBar : public CommandBar_BASE
5081 - rtl::OUString m_sToolBarName;
5082 - rtl::OUString m_sMenuModuleName;
5083 - rtl::OUString m_sUIName;
5084 - sal_Bool m_bTemporary;
5085 - sal_Bool m_bIsMenu;
5086 - sal_Bool m_bCustom;
5087 - sal_Bool m_bCreate;
5088 - ScVbaCommandBars* m_pScVbaCommandBars;
5089 - css::beans::PropertyValues m_aToolBar;
5090 - // hard reference for parent
5091 - css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
5092 - css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager;
5093 - css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers;
5094 - css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
5095 - void initCommandBar() throw( css::uno::RuntimeException );
5097 - void getToolBarSettings( rtl::OUString sToolBarName ) throw( css::uno::RuntimeException );
5098 - void getMenuSettings();
5099 - void addCustomBar();
5101 - ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw( css::uno::RuntimeException );
5102 - ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw( css::uno::RuntimeException );
5104 - sal_Bool IsMenu() { return m_bIsMenu; };
5105 - css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
5106 - css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
5107 - css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; };
5108 - rtl::OUString GetToolBarName() { return m_sToolBarName; };
5111 - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
5112 - virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException);
5113 - virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
5114 - virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
5117 - virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
5118 - virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
5119 - virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
5120 - virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
5122 - // XHelperInterface
5123 - virtual rtl::OUString& getServiceImplName();
5124 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
5126 -#endif//SC_VBA_COMMANDBAR_HXX
5127 --- sc/source/ui/vba/vbacommandbarcontrol.cxx.old 2009-04-06 16:42:00.000000000 +0000
5128 +++ sc/source/ui/vba/vbacommandbarcontrol.cxx 1970-01-01 00:00:00.000000000 +0000
5130 -/*************************************************************************
5132 - * OpenOffice.org - a multi-platform office productivity suite
5138 - * last change: $Author$ $Date$
5140 - * The Contents of this file are made available subject to
5141 - * the terms of GNU Lesser General Public License Version 2.1.
5144 - * GNU Lesser General Public License Version 2.1
5145 - * =============================================
5146 - * Copyright 2005 by Sun Microsystems, Inc.
5147 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
5149 - * This library is free software; you can redistribute it and/or
5150 - * modify it under the terms of the GNU Lesser General Public
5151 - * License version 2.1, as published by the Free Software Foundation.
5153 - * This library is distributed in the hope that it will be useful,
5154 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5155 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5156 - * Lesser General Public License for more details.
5158 - * You should have received a copy of the GNU Lesser General Public
5159 - * License along with this library; if not, write to the Free Software
5160 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
5161 - * MA 02111-1307 USA
5163 - ************************************************************************/
5164 -#include "vbacommandbarcontrol.hxx"
5165 -#include <basic/sbstar.hxx>
5166 -#include <basic/sbmod.hxx>
5168 -using namespace com::sun::star;
5169 -using namespace ooo::vba;
5171 -uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName )
5173 - sal_Int32 nCount = aPropertyValues.getLength();
5174 - for( sal_Int32 i = 0; i < nCount; i++ )
5176 - if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) )
5178 - return aPropertyValues[i].Value;
5181 - return uno::Any();
5184 -beans::PropertyValues lcl_repalcePropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName, uno::Any aValue )
5186 - sal_Int32 nCount = aPropertyValues.getLength();
5187 - for( sal_Int32 i = 0; i < nCount; i++ )
5189 - if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) )
5191 - aPropertyValues[i].Value = aValue;
5192 - return aPropertyValues;
5195 - return aPropertyValues;
5198 -ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
5200 - // exsiting CommandBarBarControl
5201 - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
5203 - if( m_xBarSettings->hasElements() )
5205 - ScVbaCommandBarControl* pParentCommandBarControl = m_pCommandBarControls->GetParentCommandBarControl();
5206 - if( pParentCommandBarControl )
5208 - beans::PropertyValues aPropertyValues;
5209 - pParentCommandBarControl->GetCurrentSettings()->getByIndex( pParentCommandBarControl->GetPosition() ) >>= aPropertyValues;
5210 - pParentCommandBarControl->SetPropertyValues( aPropertyValues );
5211 - m_xCurrentSettings.set( lcl_getPropertyValue( pParentCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY_THROW );
5213 - if( !m_xCurrentSettings.is() )
5215 - m_xCurrentSettings.set( m_xUICfgManager->getSettings( m_pCommandBarControls->GetParentToolBarName(), sal_True ), uno::UNO_QUERY_THROW );
5220 - m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
5224 - m_sBarName = m_pCommandBarControls->GetParentToolBarName();
5226 - m_bTemporary = sal_True;
5228 -ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
5230 - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
5232 - if( sName.getLength() > 0 )
5236 - m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName;
5239 - m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
5240 - createNewMenuBarControl();
5244 - m_sBarName = m_pCommandBarControls->GetParentToolBarName();
5245 - createNewToolBarControl();
5250 -ScVbaCommandBarControl::initObjects() throw (uno::RuntimeException)
5252 - m_pCommandBarControls = dynamic_cast< ScVbaCommandBarControls* >( m_xParentHardRef.get() );
5253 - if( !m_pCommandBarControls )
5254 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBarControls"), uno::Reference< uno::XInterface >() );
5255 - m_xUICfgManager.set( m_pCommandBarControls->GetUICfgManager(), uno::UNO_QUERY_THROW );
5256 - m_xUICfgPers.set( m_pCommandBarControls->GetUICfgPers(), uno::UNO_QUERY_THROW );
5257 - m_xBarSettings.set( m_pCommandBarControls->GetBarSettings(), uno::UNO_QUERY_THROW );
5258 - m_bIsMenu = m_pCommandBarControls->IsMenu();
5259 - m_sName = rtl::OUString::createFromAscii( "Custom" );
5263 -ScVbaCommandBarControl::createNewMenuBarControl()
5265 - uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
5267 - uno::Sequence< beans::PropertyValue > aPropertys;
5268 - if( m_nType == office::MsoControlType::msoControlPopup )
5269 - aPropertys = uno::Sequence< beans::PropertyValue >( 4 );
5271 - aPropertys = uno::Sequence< beans::PropertyValue >( 3 );
5273 - aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
5274 - aPropertys[0].Value <<= m_sCommand;
5275 - aPropertys[1].Name = rtl::OUString::createFromAscii("Label");
5276 - aPropertys[1].Value <<= m_sName;
5277 - aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
5278 - aPropertys[2].Value <<= sal_Int32(0);
5280 - if( m_nType == office::MsoControlType::msoControlPopup )
5282 - aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
5283 - aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext );
5286 - if( m_pCommandBarControls->GetParentCommandBar() != NULL )
5288 - // create a new menu
5289 - m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
5290 - m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW );
5292 - else if( m_pCommandBarControls->GetParentCommandBarControl() != NULL )
5294 - // create a new menu entry
5295 - ScVbaCommandBarControl* pPc = m_pCommandBarControls->GetParentCommandBarControl();
5296 - beans::PropertyValues aPropertyValues;
5297 - pPc->GetCurrentSettings()->getByIndex( pPc->GetPosition() ) >>= aPropertyValues;
5298 - pPc->SetPropertyValues( aPropertyValues );
5300 - // has the property already been set?
5301 - if( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ).hasValue() )
5303 - lcl_repalcePropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer"), uno::makeAny( xMenuMSF->createInstanceWithContext( mxContext ) ) );
5304 - pPc->GetCurrentSettings()->replaceByIndex( pPc->GetPosition(), uno::makeAny( pPc->GetPropertyValues() ) );
5306 - m_xCurrentSettings.set( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY_THROW );
5307 - m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
5309 - if( m_xUICfgManager->hasSettings( m_sBarName ) )
5311 - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5315 - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5317 - if( !m_bTemporary )
5319 - m_xUICfgPers->store();
5324 -ScVbaCommandBarControl::createNewToolBarControl()
5326 - uno::Sequence< beans::PropertyValue > aPropertys(4);
5327 - aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
5328 - aPropertys[0].Value <<= m_sCommand;
5329 - aPropertys[1].Name = rtl::OUString::createFromAscii("Label");
5330 - aPropertys[1].Value <<= m_sName;
5331 - aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
5332 - aPropertys[2].Value <<= sal_Int32(0);
5333 - aPropertys[3].Name = rtl::OUString::createFromAscii("IsVisible");
5334 - aPropertys[3].Value <<= sal_True;
5336 - m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
5337 - uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
5338 - rtl::OUString sUIName;
5339 - xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName;
5341 - m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW );
5342 - if( m_xUICfgManager->hasSettings( m_sBarName ) )
5344 - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5348 - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5350 - if( !m_bTemporary )
5352 - m_xUICfgPers->store();
5356 -::rtl::OUString SAL_CALL
5357 -ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException )
5359 - // "Label" always empty
5360 - rtl::OUString sCaption;
5361 - beans::PropertyValues aPropertyValues;
5362 - if( m_xCurrentSettings.is() )
5364 - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
5365 - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
5367 - else if( m_xBarSettings.is() )
5369 - m_xBarSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
5370 - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
5375 -ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
5377 - if( m_xCurrentSettings.is() )
5379 - beans::PropertyValues aPropertyValues;
5380 - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
5381 - beans::PropertyValues aNewPropertyValues;
5382 - aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( _caption ) );
5383 - m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
5384 - if( m_xUICfgManager->hasSettings( m_sBarName ) )
5386 - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5390 - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5392 - // make it permanent
5393 - if( !m_bTemporary )
5395 - m_xUICfgPers->store();
5399 -::rtl::OUString SAL_CALL
5400 -ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException)
5402 - if( m_xCurrentSettings.is() )
5404 - beans::PropertyValues aPropertyValues;
5405 - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
5406 - rtl::OUString sCommandURL;
5407 - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL;
5408 - return sCommandURL;
5410 - return ::rtl::OUString();
5413 -ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
5415 - if( m_xCurrentSettings.is() )
5417 - // convert the comand url into something like vnd.sun.star.script:Standard.testMacro.Macro1?language=Basic&location=document
5418 - rtl::OUString aCommandURL;
5419 - rtl::OUString sUrlPart = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
5420 - SbModule* pModule = StarBASIC::GetActiveModule();
5421 - if( pModule && ( _onaction.indexOf( sUrlPart ) == -1 ) )
5423 - rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
5424 - aCommandURL = sUrlPart.concat( pModule->GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( _onaction ).concat( sUrlPart1 );
5428 - aCommandURL = _onaction;
5430 - OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
5432 - beans::PropertyValues aPropertyValues;
5433 - m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
5434 - beans::PropertyValues aNewPropertyValues;
5435 - aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
5436 - m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
5437 - if( m_xUICfgManager->hasSettings( m_sBarName ) )
5439 - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5443 - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5445 - // make it permanent
5446 - if( !m_bTemporary )
5448 - m_xUICfgPers->store();
5452 -::sal_Bool SAL_CALL
5453 -ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
5455 - // not possible in UNO?
5459 -ScVbaCommandBarControl::setVisible( ::sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
5464 -ScVbaCommandBarControl::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
5466 - if( m_xCurrentSettings.is() )
5468 - m_xCurrentSettings->removeByIndex( m_nPosition );
5470 - if( m_xUICfgManager->hasSettings( m_sBarName ) )
5472 - m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5476 - m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
5478 - // make it permanent
5479 - if( !m_bTemporary )
5481 - m_xUICfgPers->store();
5486 -ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
5489 - uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
5490 - if( aIndex.hasValue() )
5492 - if( aIndex >>= nIndex )
5494 - uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
5495 - return uno::makeAny( xCommandBarControl );
5498 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() );
5500 - return uno::makeAny( xCommandBarControls );
5503 -ScVbaCommandBarControl::getServiceImplName()
5505 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") );
5508 -uno::Sequence<rtl::OUString>
5509 -ScVbaCommandBarControl::getServiceNames()
5511 - static uno::Sequence< rtl::OUString > aServiceNames;
5512 - if ( aServiceNames.getLength() == 0 )
5514 - aServiceNames.realloc( 1 );
5515 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControl" ) );
5517 - return aServiceNames;
5520 -//////////// ScVbaCommandBarPopup //////////////////////////////
5521 -ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
5525 -ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup)
5530 -ScVbaCommandBarPopup::getServiceImplName()
5532 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarPopup") );
5535 -uno::Sequence<rtl::OUString>
5536 -ScVbaCommandBarPopup::getServiceNames()
5538 - static uno::Sequence< rtl::OUString > aServiceNames;
5539 - if ( aServiceNames.getLength() == 0 )
5541 - aServiceNames.realloc( 1 );
5542 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarPopup" ) );
5544 - return aServiceNames;
5547 -//////////// ScVbaCommandBarButton //////////////////////////////
5548 -ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
5552 -ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
5557 -ScVbaCommandBarButton::getServiceImplName()
5559 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarButton") );
5562 -uno::Sequence<rtl::OUString>
5563 -ScVbaCommandBarButton::getServiceNames()
5565 - static uno::Sequence< rtl::OUString > aServiceNames;
5566 - if ( aServiceNames.getLength() == 0 )
5568 - aServiceNames.realloc( 1 );
5569 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarButton" ) );
5571 - return aServiceNames;
5573 --- sc/source/ui/vba/vbacommandbarcontrol.hxx.old 2009-04-06 16:42:00.000000000 +0000
5574 +++ sc/source/ui/vba/vbacommandbarcontrol.hxx 1970-01-01 00:00:00.000000000 +0000
5576 -/*************************************************************************
5578 - * OpenOffice.org - a multi-platform office productivity suite
5584 - * last change: $Author$ $Date$
5586 - * The Contents of this file are made available subject to
5587 - * the terms of GNU Lesser General Public License Version 2.1.
5590 - * GNU Lesser General Public License Version 2.1
5591 - * =============================================
5592 - * Copyright 2005 by Sun Microsystems, Inc.
5593 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
5595 - * This library is free software; you can redistribute it and/or
5596 - * modify it under the terms of the GNU Lesser General Public
5597 - * License version 2.1, as published by the Free Software Foundation.
5599 - * This library is distributed in the hope that it will be useful,
5600 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5601 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5602 - * Lesser General Public License for more details.
5604 - * You should have received a copy of the GNU Lesser General Public
5605 - * License along with this library; if not, write to the Free Software
5606 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
5607 - * MA 02111-1307 USA
5609 - ************************************************************************/
5610 -#ifndef SC_VBA_COMMANDBARCONTROL_HXX
5611 -#define SC_VBA_COMMANDBARCONTROL_HXX
5613 -#include <ooo/vba/XCommandBarControl.hpp>
5614 -#include <ooo/vba/XCommandBarPopup.hpp>
5615 -#include <ooo/vba/XCommandBarButton.hpp>
5616 -#include <ooo/vba/office/MsoControlType.hpp>
5618 -#include "vbahelperinterface.hxx"
5619 -#include "vbacommandbarcontrols.hxx"
5621 -typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE;
5623 -class ScVbaCommandBarControl : public CommandBarControl_BASE
5626 - rtl::OUString m_sName;
5627 - rtl::OUString m_sBarName;
5628 - rtl::OUString m_sCommand;
5629 - sal_Int32 m_nType;
5630 - sal_Int32 m_nPosition;
5631 - sal_Bool m_bTemporary;
5632 - sal_Bool m_bIsMenu;
5633 - ScVbaCommandBarControls* m_pCommandBarControls;
5634 - css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
5635 - css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager;
5636 - css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers;
5637 - css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
5638 - css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
5639 - css::beans::PropertyValues m_aPropertyValues;
5641 - void initObjects() throw (css::uno::RuntimeException);
5642 - void createNewMenuBarControl();
5643 - void createNewToolBarControl();
5645 - ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
5646 - ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
5647 - css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
5648 - css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
5649 - css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; };
5650 - sal_Bool IsMenu() { return m_bIsMenu; };
5651 - sal_Int32 GetPosition() { return m_nPosition; };
5652 - css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; };
5653 - css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; };
5654 - void SetPropertyValues( css::beans::PropertyValues aPropertyValues ) { m_aPropertyValues = aPropertyValues; };
5657 - virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
5658 - virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException);
5659 - virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
5660 - virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
5661 - virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
5662 - virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
5665 - virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
5666 - virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
5668 - // XHelperInterface
5669 - virtual rtl::OUString& getServiceImplName();
5670 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
5673 -typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE;
5674 -class ScVbaCommandBarPopup : public CommandBarPopup_BASE
5677 - ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
5678 - ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
5679 - // XHelperInterface
5680 - virtual rtl::OUString& getServiceImplName();
5681 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
5684 -typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE;
5685 -class ScVbaCommandBarButton : public CommandBarButton_BASE
5688 - ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
5689 - ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
5690 - // XHelperInterface
5691 - virtual rtl::OUString& getServiceImplName();
5692 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
5695 -#endif//SC_VBA_COMMANDBARCONTROL_HXX
5696 --- sc/source/ui/vba/vbacommandbarcontrols.cxx.old 2009-04-06 16:42:00.000000000 +0000
5697 +++ sc/source/ui/vba/vbacommandbarcontrols.cxx 1970-01-01 00:00:00.000000000 +0000
5699 -/*************************************************************************
5701 - * OpenOffice.org - a multi-platform office productivity suite
5707 - * last change: $Author$ $Date$
5709 - * The Contents of this file are made available subject to
5710 - * the terms of GNU Lesser General Public License Version 2.1.
5713 - * GNU Lesser General Public License Version 2.1
5714 - * =============================================
5715 - * Copyright 2005 by Sun Microsystems, Inc.
5716 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
5718 - * This library is free software; you can redistribute it and/or
5719 - * modify it under the terms of the GNU Lesser General Public
5720 - * License version 2.1, as published by the Free Software Foundation.
5722 - * This library is distributed in the hope that it will be useful,
5723 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5724 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5725 - * Lesser General Public License for more details.
5727 - * You should have received a copy of the GNU Lesser General Public
5728 - * License along with this library; if not, write to the Free Software
5729 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
5730 - * MA 02111-1307 USA
5732 - ************************************************************************/
5733 -#include "vbacommandbarcontrols.hxx"
5734 -#include "vbacommandbarcontrol.hxx"
5736 -using namespace com::sun::star;
5737 -using namespace ooo::vba;
5739 -uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
5741 -typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE;
5742 -class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
5744 - //uno::Reference< uno::XComponentContext > m_xContext;
5745 - ScVbaCommandBarControls* m_pCommandBarControls;
5746 - sal_Int32 m_nCurrentPosition;
5748 - CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {}
5749 - virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
5751 - if( m_nCurrentPosition < m_pCommandBarControls->getCount() )
5755 - virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
5757 - if( hasMoreElements() )
5759 - rtl::OUString sName = m_pCommandBarControls->GetControlNameByIndex( m_nCurrentPosition );
5760 - m_nCurrentPosition = m_nCurrentPosition + 1;
5761 - if( sName.getLength() > 0 )
5762 - return m_pCommandBarControls->createCollectionObject( uno::makeAny( sName ) );
5764 - return nextElement();
5767 - throw container::NoSuchElementException();
5771 -ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess )
5773 - m_bIsMenu = sal_False;
5774 - m_bHasElements = sal_False;
5775 - m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
5776 - m_pCommandBar = dynamic_cast< ScVbaCommandBar* >( m_xParentHardRef.get() );
5777 - m_pCommandBarControl = dynamic_cast< ScVbaCommandBarControl* >( m_xParentHardRef.get() );
5778 - if( m_pCommandBar )
5780 - m_xUICfgManager.set( m_pCommandBar->GetUICfgManager(), uno::UNO_QUERY_THROW );
5781 - m_xUICfgPers.set( m_pCommandBar->GetUICfgPers(), uno::UNO_QUERY_THROW );
5782 - m_xBarSettings.set( m_pCommandBar->GetBarSettings(), uno::UNO_QUERY_THROW );
5783 - m_bIsMenu = m_pCommandBar->IsMenu();
5784 - if( m_xBarSettings->hasElements() )
5786 - m_bHasElements = sal_True;
5789 - else if( m_pCommandBarControl )
5791 - m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
5792 - m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
5793 - beans::PropertyValues aPropertyValues;
5794 - m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
5795 - m_pCommandBarControl->SetPropertyValues( aPropertyValues );
5796 - m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
5798 - uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
5799 - if( aValue.hasValue() )
5801 - m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
5802 - m_bHasElements = sal_True;
5806 - m_bHasElements = sal_False;
5808 - m_bIsMenu = m_pCommandBarControl->IsMenu();
5812 - throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() );
5816 -ScVbaCommandBarControls::GetControlNameByIndex( const sal_Int32 nIndex ) throw ( uno::RuntimeException )
5818 - sal_Int32 nCount = 0;
5819 - if( m_bHasElements )
5821 - sal_Int32 nBarSettingsCount = m_xBarSettings->getCount();
5822 - for( sal_Int32 i = 0; i < nBarSettingsCount; i++ )
5824 - beans::PropertyValues aMenuValues;
5825 - m_xBarSettings->getByIndex( i ) >>= aMenuValues;
5826 - for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ )
5828 - if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) )
5831 - if( nIndex == nCount )
5833 - rtl::OUString sCommandURL;
5834 - aMenuValues[j].Value >>= sCommandURL;
5835 - sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") );
5836 - if( ( nLastIndex != -1 ) && ( ( nLastIndex +1 ) < sCommandURL.getLength() ) )
5838 - sCommandURL = sCommandURL.copy( nLastIndex + 1 );
5839 - return sCommandURL;
5847 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Out of bound" ), uno::Reference< uno::XInterface >() );
5848 - return rtl::OUString();
5853 -ScVbaCommandBarControls::getCount() throw (uno::RuntimeException)
5855 - sal_Int32 nCount = 0;
5856 - if( m_bHasElements )
5858 - sal_Int32 nBarSettingsCount = m_xBarSettings->getCount();
5859 - for( sal_Int32 i = 0; i < nBarSettingsCount; i++ )
5861 - beans::PropertyValues aMenuValues;
5862 - m_xBarSettings->getByIndex( i ) >>= aMenuValues;
5863 - for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ )
5865 - if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) )
5874 -// XEnumerationAccess
5876 -ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException )
5878 - return XCommandBarControls::static_type( 0 );
5880 -uno::Reference< container::XEnumeration >
5881 -ScVbaCommandBarControls::createEnumeration() throw ( uno::RuntimeException )
5883 - return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) );
5886 -ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource )
5888 - // only surport the aSource as a name string, because this class is a API wrapper
5889 - rtl::OUString sName;
5890 - if( aSource >>= sName )
5892 - uno::Reference< container::XIndexContainer > xCurrentSettings;
5893 - beans::PropertyValues aPropertyValues;
5894 - if( m_pCommandBarControl )
5896 - m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
5897 - xCurrentSettings.set( lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY );
5898 - if( !xCurrentSettings.is() )
5900 - xCurrentSettings.set( m_xUICfgManager->getSettings( GetParentToolBarName(), sal_True ), uno::UNO_QUERY );
5904 - sal_Int32 nPosition = -1;
5905 - for( sal_Int32 i = 0; i < xCurrentSettings->getCount(); i++ )
5907 - xCurrentSettings->getByIndex( i ) >>= aPropertyValues;
5908 - // Label always empty in OOo
5909 - rtl::OUString sLabel;
5910 - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
5911 - if( sLabel.equalsIgnoreAsciiCase( sName ) )
5916 - // using CammandURL to find
5917 - rtl::OUString sCommandURL;
5918 - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL;
5919 - sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") );
5920 - if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sCommandURL.getLength() ) )
5922 - sCommandURL = sCommandURL.copy( nLastIndex + 1 );
5924 - if( sCommandURL.equalsIgnoreAsciiCase( sName ) )
5931 - if( nPosition != -1 )
5933 - uno::Reference< container::XIndexContainer > xSubMenu;
5934 - lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ) >>= xSubMenu;
5935 - ScVbaCommandBarControl* pNewCommandBarControl = NULL;
5936 - if( xSubMenu.is() )
5937 - pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sName, nPosition );
5939 - pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sName, nPosition );
5941 - return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
5944 - throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
5947 - return uno::Any();
5952 -ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException)
5954 - if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
5956 - return createCollectionObject( aIndex );
5958 - sal_Int32 nIndex = 0;
5959 - if( aIndex >>= nIndex )
5961 - return createCollectionObject( uno::makeAny( GetControlNameByIndex( nIndex ) ) );
5964 - return uno::Any();
5966 -uno::Reference< XCommandBarControl > SAL_CALL
5967 -ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const uno::Any& /*Parameter*/, const uno::Any& Before, const uno::Any& Temporary ) throw (script::BasicErrorException, uno::RuntimeException)
5969 - // Parameter is not supported
5970 - // the following name needs to be individually created;
5971 - rtl::OUString sCaption( rtl::OUString::createFromAscii("custom Control") );
5972 - rtl::OUString sCommand( rtl::OUString::createFromAscii("macro:///Standard.Module1.Test()") );
5973 - sal_Int32 nType =0;
5974 - sal_Int32 nPosition = 0;
5976 - sal_Bool bTemporary = sal_True;
5978 - if( Type.hasValue() )
5979 - if( Type >>= nType )
5981 - // evalute the type of the new control
5983 - if( Id.hasValue() )
5986 - // evalute the action of the new control
5988 - if( Before.hasValue() )
5989 - Before >>= nPosition;
5992 - // if Before is ignore, the new control should be placed at the end of the commandbars;
5993 - if( m_pCommandBar )
5994 - nPosition = getCount();
5995 - else if ( m_pCommandBarControl )
5997 - css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
5998 - xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
5999 - if( xCurrentSettings.is() )
6001 - nPosition = xCurrentSettings->getCount();
6005 - if( Temporary.hasValue() )
6006 - if( Temporary >>= bTemporary )
6008 - // evalute the temporary of the new Control
6011 - ScVbaCommandBarControl* pNewCommandBarControl = NULL;
6012 - if( nType == office::MsoControlType::msoControlButton )
6014 - pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sCaption, nPosition, bTemporary );
6016 - else if ( nType == office::MsoControlType::msoControlPopup )
6018 - pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sCaption, nPosition, bTemporary );
6022 - pNewCommandBarControl = new ScVbaCommandBarControl( this, mxContext, sCaption, nPosition, bTemporary );
6025 - return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
6028 -// XHelperInterface
6030 -ScVbaCommandBarControls::getServiceImplName()
6032 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") );
6035 -uno::Sequence<rtl::OUString>
6036 -ScVbaCommandBarControls::getServiceNames()
6038 - static uno::Sequence< rtl::OUString > aServiceNames;
6039 - if ( aServiceNames.getLength() == 0 )
6041 - aServiceNames.realloc( 1 );
6042 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControls" ) );
6044 - return aServiceNames;
6047 --- sc/source/ui/vba/vbacommandbarcontrols.hxx.old 2009-04-06 16:42:00.000000000 +0000
6048 +++ sc/source/ui/vba/vbacommandbarcontrols.hxx 1970-01-01 00:00:00.000000000 +0000
6050 -/*************************************************************************
6052 - * OpenOffice.org - a multi-platform office productivity suite
6058 - * last change: $Author$ $Date$
6060 - * The Contents of this file are made available subject to
6061 - * the terms of GNU Lesser General Public License Version 2.1.
6064 - * GNU Lesser General Public License Version 2.1
6065 - * =============================================
6066 - * Copyright 2005 by Sun Microsystems, Inc.
6067 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
6069 - * This library is free software; you can redistribute it and/or
6070 - * modify it under the terms of the GNU Lesser General Public
6071 - * License version 2.1, as published by the Free Software Foundation.
6073 - * This library is distributed in the hope that it will be useful,
6074 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6075 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6076 - * Lesser General Public License for more details.
6078 - * You should have received a copy of the GNU Lesser General Public
6079 - * License along with this library; if not, write to the Free Software
6080 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
6081 - * MA 02111-1307 USA
6083 - ************************************************************************/
6084 -#ifndef SC_VBA_COMMANDBARCONTROLS_HXX
6085 -#define SC_VBA_COMMANDBARCONTROLS_HXX
6087 -#include <ooo/vba/XCommandBarControls.hpp>
6089 -#include "vbahelperinterface.hxx"
6090 -#include "vbacommandbar.hxx"
6091 -#include "vbacollectionimpl.hxx"
6093 -class ScVbaCommandBarControl;
6095 -typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE;
6097 -class ScVbaCommandBarControls : public CommandBarControls_BASE
6100 - sal_Bool m_bIsMenu;
6101 - sal_Bool m_bHasElements;
6102 - ScVbaCommandBar* m_pCommandBar;
6103 - ScVbaCommandBarControl* m_pCommandBarControl;
6104 - css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
6105 - css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager;
6106 - css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers;
6107 - css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
6108 - css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
6111 - ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ) throw( css::uno::RuntimeException );
6112 - css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
6113 - css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
6114 - css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; };
6115 - sal_Bool IsMenu() { return m_bIsMenu; };
6116 - ScVbaCommandBar* GetParentCommandBar() { return m_pCommandBar; };
6117 - ScVbaCommandBarControl* GetParentCommandBarControl() { return m_pCommandBarControl; };
6118 - rtl::OUString GetParentToolBarName()
6120 - if( m_pCommandBar ) return m_pCommandBar->GetToolBarName();
6121 - else return rtl::OUString();
6123 - rtl::OUString GetControlNameByIndex( const sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
6126 - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
6127 - // XEnumerationAccess
6128 - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
6129 - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
6130 - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
6133 - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
6134 - virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
6135 - // XHelperInterface
6136 - virtual rtl::OUString& getServiceImplName();
6137 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
6140 -#endif//SC_VBA_COMMANDBARCONTROLS_HXX
6141 --- sc/source/ui/vba/vbacommandbars.cxx.old 2009-04-06 16:42:00.000000000 +0000
6142 +++ sc/source/ui/vba/vbacommandbars.cxx 1970-01-01 00:00:00.000000000 +0000
6144 -/*************************************************************************
6146 - * OpenOffice.org - a multi-platform office productivity suite
6152 - * last change: $Author$ $Date$
6154 - * The Contents of this file are made available subject to
6155 - * the terms of GNU Lesser General Public License Version 2.1.
6158 - * GNU Lesser General Public License Version 2.1
6159 - * =============================================
6160 - * Copyright 2005 by Sun Microsystems, Inc.
6161 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
6163 - * This library is free software; you can redistribute it and/or
6164 - * modify it under the terms of the GNU Lesser General Public
6165 - * License version 2.1, as published by the Free Software Foundation.
6167 - * This library is distributed in the hope that it will be useful,
6168 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6169 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6170 - * Lesser General Public License for more details.
6172 - * You should have received a copy of the GNU Lesser General Public
6173 - * License along with this library; if not, write to the Free Software
6174 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
6175 - * MA 02111-1307 USA
6177 - ************************************************************************/
6178 -#include <com/sun/star/lang/XServiceInfo.hpp>
6179 -#include <com/sun/star/frame/XDesktop.hpp>
6180 -#include <com/sun/star/container/XNameAccess.hpp>
6182 -#include "vbacommandbars.hxx"
6183 -#include "vbacommandbar.hxx"
6185 -using namespace com::sun::star;
6186 -using namespace ooo::vba;
6188 -typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE;
6190 -static rtl::OUString sSpreadsheetDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
6191 -static rtl::OUString sTextDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) );
6192 -static rtl::OUString sWindowStateConfUrl( rtl::OUString::createFromAscii( "com.sun.star.ui.WindowStateConfiguration" ) );
6194 -class CommandBarEnumeration : public CommandBarEnumeration_BASE
6196 - uno::Reference< uno::XComponentContext > m_xContext;
6197 - uno::Reference< XCommandBars > m_xCommandBars;
6198 - uno::Sequence< rtl::OUString > m_sNames;
6199 - sal_Int32 m_nCurrentPosition;
6201 - CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 )
6204 - virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
6206 - if( m_nCurrentPosition < m_sNames.getLength() )
6210 - virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
6212 - if( hasMoreElements() )
6214 - rtl::OUString sName( m_sNames[ m_nCurrentPosition ] );
6215 - m_nCurrentPosition = m_nCurrentPosition + 1;
6216 - if( sName.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
6218 - sal_Int32 nLastIndex = sName.lastIndexOf( rtl::OUString::createFromAscii( "/" ) );
6219 - if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sName.getLength() ) )
6221 - sName = sName.copy( nLastIndex + 1);
6222 - if( sName.getLength() > 0 )
6224 - uno::Reference< XHelperInterface > xHelperInterface( m_xCommandBars, uno::UNO_QUERY_THROW );
6225 - uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( xHelperInterface, m_xContext, sName, sal_True, sal_False ) );
6226 - if( xCommandBar.is() )
6227 - return uno::makeAny( xCommandBar );
6229 - return nextElement();
6232 - return nextElement();
6236 - return nextElement();
6239 - throw container::NoSuchElementException();
6240 - return uno::Any();
6245 -ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess ) : CommandBars_BASE( xParent, xContext, xIndexAccess )
6247 - retrieveObjects();
6250 -ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException )
6252 - uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW );
6253 - if( xServiceInfo->supportsService( sSpreadsheetDocumentUrl ) )
6255 - m_sModuleName = sSpreadsheetDocumentUrl;
6257 - else if( xServiceInfo->supportsService( sTextDocumentUrl ) )
6259 - m_sModuleName = sTextDocumentUrl;
6262 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Unsupported Document" ), uno::Reference< uno::XInterface >() );
6264 - uno::Reference < lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
6265 - uno::Reference < container::XNameAccess > xNameAccess( xMSF->createInstance( sWindowStateConfUrl ), uno::UNO_QUERY_THROW );
6266 - m_xNameAccess.set( xNameAccess->getByName( m_sModuleName ), uno::UNO_QUERY_THROW );
6269 -// XEnumerationAccess
6271 -ScVbaCommandBars::getElementType() throw ( uno::RuntimeException )
6273 - return XCommandBars::static_type( 0 );
6275 -uno::Reference< container::XEnumeration >
6276 -ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException )
6278 - return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames() ) );
6282 -ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
6284 - // aSource should be a name at this time, because of the class is API wrapper.
6285 - rtl::OUString sToolBarName;
6286 - if( aSource >>= sToolBarName )
6288 - sToolBarName = sToolBarName.toAsciiLowerCase();
6289 - if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) )
6291 - return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) ) );
6293 - else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
6295 - return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) ) );
6297 - else if( checkToolBarExist( sToolBarName ) )
6299 - return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) ) );
6302 - return uno::Any();
6306 -uno::Reference< XCommandBar > SAL_CALL
6307 -ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
6309 - // Position - MsoBar MenuBar - sal_Bool
6310 - // Currently only the Name is supported.
6311 - rtl::OUString sName;
6312 - if( !( Name >>= sName ) )
6314 - sName = rtl::OUString::createFromAscii("Custom1");
6316 - sal_Bool bTemporary = false;
6317 - if( !( Temporary >>= bTemporary ) )
6319 - bTemporary = sal_True;
6321 - return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, sName.toAsciiLowerCase(), bTemporary, sal_True ) );
6324 -ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
6326 - // Filter out all toolbars from the window collection
6327 - sal_Int32 nCount = 0;
6328 - uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
6329 - for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
6331 - if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
6339 -// ScVbaCollectionBaseImpl
6341 -ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
6343 - if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
6345 - return createCollectionObject( aIndex );
6348 - // hardcode if "aIndex = 1" that would return "main menu".
6349 - sal_Int16 nIndex = 0;
6350 - aIndex >>= nIndex;
6354 - if( m_sModuleName.equalsIgnoreAsciiCase( sSpreadsheetDocumentUrl ) )
6355 - aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
6356 - else if( m_sModuleName.equalsIgnoreAsciiCase( sTextDocumentUrl ) )
6357 - aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
6358 - if( aSource.hasValue() )
6359 - return createCollectionObject( aSource );
6361 - return uno::Any();
6365 -ScVbaCommandBars::checkToolBarExist( rtl::OUString sToolBarName )
6367 - CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() );
6368 - if( iter != mCommandBarNameMap.end() )
6372 - uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
6373 - for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
6375 - if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
6377 - if( allNames[i].indexOf( sToolBarName ) != -1 )
6386 -// XHelperInterface
6388 -ScVbaCommandBars::getServiceImplName()
6390 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBars") );
6393 -uno::Sequence<rtl::OUString>
6394 -ScVbaCommandBars::getServiceNames()
6396 - static uno::Sequence< rtl::OUString > aServiceNames;
6397 - if ( aServiceNames.getLength() == 0 )
6399 - aServiceNames.realloc( 1 );
6400 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBars" ) );
6402 - return aServiceNames;
6405 --- sc/source/ui/vba/vbacommandbars.hxx.old 2009-04-02 10:45:35.000000000 +0000
6406 +++ sc/source/ui/vba/vbacommandbars.hxx 1970-01-01 00:00:00.000000000 +0000
6408 -/*************************************************************************
6410 - * OpenOffice.org - a multi-platform office productivity suite
6416 - * last change: $Author$ $Date$
6418 - * The Contents of this file are made available subject to
6419 - * the terms of GNU Lesser General Public License Version 2.1.
6422 - * GNU Lesser General Public License Version 2.1
6423 - * =============================================
6424 - * Copyright 2005 by Sun Microsystems, Inc.
6425 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
6427 - * This library is free software; you can redistribute it and/or
6428 - * modify it under the terms of the GNU Lesser General Public
6429 - * License version 2.1, as published by the Free Software Foundation.
6431 - * This library is distributed in the hope that it will be useful,
6432 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6433 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6434 - * Lesser General Public License for more details.
6436 - * You should have received a copy of the GNU Lesser General Public
6437 - * License along with this library; if not, write to the Free Software
6438 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
6439 - * MA 02111-1307 USA
6441 - ************************************************************************/
6442 -#ifndef SC_VBA_COMMANDBARS_HXX
6443 -#define SC_VBA_COMMANDBARS_HXX
6445 -#include <ooo/vba/XCommandBar.hpp>
6446 -#include <ooo/vba/XCommandBars.hpp>
6447 -#include <com/sun/star/container/XNameAccess.hpp>
6449 -#include <cppuhelper/implbase1.hxx>
6451 -#include "vbahelperinterface.hxx"
6452 -#include "vbacollectionimpl.hxx"
6454 -typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE;
6456 -class ScVbaCommandBars : public CommandBars_BASE
6459 - css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
6460 - rtl::OUString m_sModuleName;
6461 - void retrieveObjects() throw( css::uno::RuntimeException );
6463 - ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess );
6465 - sal_Bool checkToolBarExist( rtl::OUString sToolBarName );
6466 - rtl::OUString GetModuleName(){ return m_sModuleName; };
6467 - css::uno::Reference< css::container::XNameAccess > GetWindows()
6469 - retrieveObjects();
6470 - return m_xNameAccess;
6473 - virtual css::uno::Reference< ov::XCommandBar > SAL_CALL Add( const css::uno::Any& Name, const css::uno::Any& Position, const css::uno::Any& MenuBar, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
6474 - // XEnumerationAccess
6475 - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
6476 - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
6477 - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
6479 - virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
6480 - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException);
6481 - // XHelperInterface
6482 - virtual rtl::OUString& getServiceImplName();
6483 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
6486 -#endif//SC_VBA_COMMANDBARS_HXX
6487 --- sc/source/ui/vba/vbacomment.hxx.old 2009-04-02 10:45:35.000000000 +0000
6488 +++ sc/source/ui/vba/vbacomment.hxx 2009-04-06 16:42:01.000000000 +0000
6490 #include <com/sun/star/table/XCellRange.hpp>
6491 #include <com/sun/star/uno/XComponentContext.hpp>
6493 -#include "vbahelperinterface.hxx"
6494 +#include <vbahelper/vbahelperinterface.hxx>
6496 typedef InheritedHelperInterfaceImpl1< ov::excel::XComment > ScVbaComment_BASE;
6498 --- sc/source/ui/vba/vbacomments.hxx.old 2009-04-02 10:45:35.000000000 +0000
6499 +++ sc/source/ui/vba/vbacomments.hxx 2009-04-06 16:42:01.000000000 +0000
6502 #include <ooo/vba/excel/XComments.hpp>
6504 -#include "vbahelper.hxx"
6505 -#include "vbacollectionimpl.hxx"
6506 +#include "excelvbahelper.hxx"
6507 +#include <vbahelper/vbacollectionimpl.hxx>
6508 #include "vbacomment.hxx"
6510 typedef CollTestImplHelper< ov::excel::XComments > ScVbaComments_BASE;
6511 --- sc/source/ui/vba/vbacondition.hxx.old 2009-04-02 10:45:35.000000000 +0000
6512 +++ sc/source/ui/vba/vbacondition.hxx 2009-04-06 16:42:01.000000000 +0000
6514 #define SC_VBA_CONDITION_HXX
6515 #include <com/sun/star/sheet/XSheetCondition.hpp>
6516 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
6517 -#include "vbahelperinterface.hxx"
6518 +#include <vbahelper/vbahelperinterface.hxx>
6519 #include <com/sun/star/sheet/ConditionOperator.hpp>
6521 template< typename Ifc1 >
6522 --- sc/source/ui/vba/vbacontrol.cxx.old 2009-04-02 10:45:35.000000000 +0000
6523 +++ sc/source/ui/vba/vbacontrol.cxx 1970-01-01 00:00:00.000000000 +0000
6525 -/*************************************************************************
6527 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6529 - * Copyright 2008 by Sun Microsystems, Inc.
6531 - * OpenOffice.org - a multi-platform office productivity suite
6533 - * $RCSfile: vbacontrol.cxx,v $
6534 - * $Revision: 1.3 $
6536 - * This file is part of OpenOffice.org.
6538 - * OpenOffice.org is free software: you can redistribute it and/or modify
6539 - * it under the terms of the GNU Lesser General Public License version 3
6540 - * only, as published by the Free Software Foundation.
6542 - * OpenOffice.org is distributed in the hope that it will be useful,
6543 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6544 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6545 - * GNU Lesser General Public License version 3 for more details
6546 - * (a copy is included in the LICENSE file that accompanied this code).
6548 - * You should have received a copy of the GNU Lesser General Public License
6549 - * version 3 along with OpenOffice.org. If not, see
6550 - * <http://www.openoffice.org/license.html>
6551 - * for a copy of the LGPLv3 License.
6553 - ************************************************************************/
6554 -#include <com/sun/star/form/FormComponentType.hpp>
6555 -#include <com/sun/star/awt/XControlModel.hpp>
6556 -#include <com/sun/star/awt/XControl.hpp>
6557 -#include <com/sun/star/awt/XWindow2.hpp>
6558 -#include <com/sun/star/lang/XEventListener.hpp>
6559 -#include <com/sun/star/drawing/XShape.hpp>
6560 -#include <com/sun/star/frame/XModel.hpp>
6561 -#include <com/sun/star/view/XControlAccess.hpp>
6562 -#include <com/sun/star/container/XChild.hpp>
6563 -#include <com/sun/star/form/binding/XBindableValue.hpp>
6564 -#include <com/sun/star/form/binding/XListEntrySink.hpp>
6565 -#include <com/sun/star/table/CellAddress.hpp>
6566 -#include <com/sun/star/table/CellRangeAddress.hpp>
6567 -#ifdef VBA_OOBUILD_HACK
6568 -#include <svtools/bindablecontrolhelper.hxx>
6570 -#include"vbacontrol.hxx"
6571 -#include"vbacombobox.hxx"
6572 -#include "vbabutton.hxx"
6573 -#include "vbalabel.hxx"
6574 -#include "vbatextbox.hxx"
6575 -#include "vbaradiobutton.hxx"
6576 -#include "vbalistbox.hxx"
6577 -#include "vbatogglebutton.hxx"
6578 -#include "vbacheckbox.hxx"
6579 -#include "vbaframe.hxx"
6580 -#include "vbascrollbar.hxx"
6581 -#include "vbaprogressbar.hxx"
6582 -#include "vbamultipage.hxx"
6583 -#include "vbaspinbutton.hxx"
6584 -#include "vbaimage.hxx"
6587 -using namespace com::sun::star;
6588 -using namespace ooo::vba;
6590 -uno::Reference< css::awt::XWindowPeer >
6591 -ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
6593 - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
6595 - uno::Reference< awt::XControlModel > xControlModel;
6596 - uno::Reference< css::awt::XWindowPeer > xWinPeer;
6597 - if ( !xControlShape.is() )
6599 - // would seem to be a Userform control
6600 - uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW );
6601 - xWinPeer = xControl->getPeer();
6605 - xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
6607 - uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
6610 - uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY );
6611 - xWinPeer = xControl->getPeer();
6613 - catch( uno::Exception )
6615 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ),
6616 - uno::Reference< uno::XInterface >() );
6621 -//ScVbaControlListener
6622 -class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener >
6625 - ScVbaControl *pControl;
6627 - ScVbaControlListener( ScVbaControl *pTmpControl );
6628 - virtual ~ScVbaControlListener();
6629 - virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException );
6632 -ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl )
6636 -ScVbaControlListener::~ScVbaControlListener()
6641 -ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException )
6645 - pControl->removeResouce();
6652 -ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel )
6655 - m_xEventListener.set( new ScVbaControlListener( this ) );
6656 - setGeometryHelper( pGeomHelper );
6657 - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
6658 - xComponent->addEventListener( m_xEventListener );
6661 - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
6662 - uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ;
6663 - if ( xControlShape.is() ) // form control
6664 - m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
6665 - else if ( xUserFormControl.is() ) // userform control
6666 - m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
6669 -ScVbaControl::~ScVbaControl()
6671 - if( m_xControl.is() )
6673 - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
6674 - xComponent->removeEventListener( m_xEventListener );
6679 -ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper )
6681 - mpGeometryHelper.reset( pHelper );
6684 -void ScVbaControl::removeResouce() throw( uno::RuntimeException )
6686 - uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
6687 - xComponent->removeEventListener( m_xEventListener );
6692 -//In design model has different behavior
6693 -sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException)
6695 - uno::Any aValue = m_xProps->getPropertyValue
6696 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) );
6697 - sal_Bool bRet = false;
6702 -void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException)
6704 - uno::Any aValue( bVisible );
6705 - m_xProps->setPropertyValue
6706 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue);
6710 -sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
6712 - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
6713 - return xWindow2->isVisible();
6716 -void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
6718 - uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
6719 - xWindow2->setVisible( bVisible );
6721 -double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
6723 - return mpGeometryHelper->getHeight();
6725 -void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException)
6727 - mpGeometryHelper->setHeight( _height );
6730 -double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException)
6732 - return mpGeometryHelper->getWidth();
6734 -void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException)
6736 - mpGeometryHelper->setWidth( _width );
6740 -ScVbaControl::getLeft() throw (uno::RuntimeException)
6742 - return mpGeometryHelper->getLeft();
6746 -ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
6748 - mpGeometryHelper->setLeft( _left );
6753 -ScVbaControl::getTop() throw (uno::RuntimeException)
6755 - return mpGeometryHelper->getTop();
6759 -ScVbaControl::setTop( double _top ) throw (uno::RuntimeException)
6761 - mpGeometryHelper->setTop( _top );
6764 -uno::Reference< uno::XInterface > SAL_CALL
6765 -ScVbaControl::getObject() throw (uno::RuntimeException)
6767 - uno::Reference< msforms::XControl > xRet( this );
6771 -void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
6773 - uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW );
6777 -rtl::OUString SAL_CALL
6778 -ScVbaControl::getControlSource() throw (uno::RuntimeException)
6780 -// #FIXME I *hate* having these upstream differences
6781 -// but this is necessary until I manage to upstream other
6783 -#ifdef VBA_OOBUILD_HACK
6784 - rtl::OUString sControlSource;
6785 - uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY );
6786 - if ( xBindable.is() )
6790 - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
6791 - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY );
6792 - uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW );
6793 - table::CellAddress aAddress;
6794 - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress;
6795 - xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) );
6796 - xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource;
6798 - catch( uno::Exception& )
6802 - return sControlSource;
6804 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
6809 -ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException)
6811 -#ifdef VBA_OOBUILD_HACK
6812 - rtl::OUString sEmpty;
6813 - svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty );
6815 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported
6819 -rtl::OUString SAL_CALL
6820 -ScVbaControl::getRowSource() throw (uno::RuntimeException)
6822 -#ifdef VBA_OOBUILD_HACK
6823 - rtl::OUString sRowSource;
6824 - uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY );
6825 - if ( xListSink.is() )
6829 - uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
6830 - uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY );
6832 - uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW );
6833 - table::CellRangeAddress aAddress;
6834 - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress;
6835 - xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) );
6836 - xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource;
6838 - catch( uno::Exception& )
6842 - return sRowSource;
6844 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
6849 -ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
6851 -#ifdef VBA_OOBUILD_HACK
6852 - rtl::OUString sEmpty;
6853 - svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource );
6855 - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported
6859 -rtl::OUString SAL_CALL
6860 -ScVbaControl::getName() throw (uno::RuntimeException)
6862 - rtl::OUString sName;
6863 - m_xProps->getPropertyValue
6864 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
6870 -ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
6872 - m_xProps->setPropertyValue
6873 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
6875 -//ScVbaControlFactory
6877 -ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
6881 -ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException)
6883 - return createControl( m_xModel );
6885 -ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
6887 - uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
6888 - if ( xControlShape.is() ) // form controls
6889 - return createControl( xControlShape, xParent );
6890 - uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY );
6891 - if ( !xControl.is() )
6892 - throw uno::RuntimeException(); // really we should be more informative
6893 - return createControl( xControl, xParent );
6897 -ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException)
6899 - uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
6900 - sal_Int32 nClassId = -1;
6901 - const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
6902 - xProps->getPropertyValue( sClassId ) >>= nClassId;
6903 - uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
6904 - switch( nClassId )
6906 - case form::FormComponentType::COMBOBOX:
6907 - return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6908 - case form::FormComponentType::COMMANDBUTTON:
6909 - return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6910 - case form::FormComponentType::FIXEDTEXT:
6911 - return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6912 - case form::FormComponentType::TEXTFIELD:
6913 - return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6914 - case form::FormComponentType::RADIOBUTTON:
6915 - return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6916 - case form::FormComponentType::LISTBOX:
6917 - return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6918 - case form::FormComponentType::SPINBUTTON:
6919 - return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6920 - case form::FormComponentType::IMAGECONTROL:
6921 - return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
6923 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
6924 - "Donot support this Control Type." ), uno::Reference< uno::XInterface >() );
6928 -ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
6930 - uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
6931 - uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW );
6932 - ScVbaControl* pControl = NULL;
6933 - uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
6934 - if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
6935 - pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6936 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
6937 - pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6938 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
6939 - pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
6940 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
6942 - sal_Bool bToggle = sal_False;
6943 - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
6945 - pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6947 - pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6949 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
6950 - pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
6951 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
6952 - pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6953 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
6954 - pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6955 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
6956 - pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6957 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
6958 - pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6959 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
6960 - pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6961 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
6962 - pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6963 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
6964 - pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
6965 - else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
6966 - pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
6968 - throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
6973 -ScVbaControl::getServiceImplName()
6975 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") );
6979 -uno::Sequence< rtl::OUString >
6980 -ScVbaControl::getServiceNames()
6982 - static uno::Sequence< rtl::OUString > aServiceNames;
6983 - if ( aServiceNames.getLength() == 0 )
6985 - aServiceNames.realloc( 1 );
6986 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) );
6988 - return aServiceNames;
6992 --- sc/source/ui/vba/vbacontrol.hxx.old 2009-04-02 10:45:35.000000000 +0000
6993 +++ sc/source/ui/vba/vbacontrol.hxx 1970-01-01 00:00:00.000000000 +0000
6995 -/*************************************************************************
6997 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6999 - * Copyright 2008 by Sun Microsystems, Inc.
7001 - * OpenOffice.org - a multi-platform office productivity suite
7003 - * $RCSfile: vbacontrol.hxx,v $
7004 - * $Revision: 1.3 $
7006 - * This file is part of OpenOffice.org.
7008 - * OpenOffice.org is free software: you can redistribute it and/or modify
7009 - * it under the terms of the GNU Lesser General Public License version 3
7010 - * only, as published by the Free Software Foundation.
7012 - * OpenOffice.org is distributed in the hope that it will be useful,
7013 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7014 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7015 - * GNU Lesser General Public License version 3 for more details
7016 - * (a copy is included in the LICENSE file that accompanied this code).
7018 - * You should have received a copy of the GNU Lesser General Public License
7019 - * version 3 along with OpenOffice.org. If not, see
7020 - * <http://www.openoffice.org/license.html>
7021 - * for a copy of the LGPLv3 License.
7023 - ************************************************************************/
7024 -#ifndef SC_VBA_CONTROL_HXX
7025 -#define SC_VBA_CONTROL_HXX
7027 -#include <cppuhelper/implbase1.hxx>
7028 -#include <com/sun/star/beans/XPropertySet.hpp>
7029 -#include <com/sun/star/uno/XComponentContext.hpp>
7030 -#include <com/sun/star/script/XDefaultProperty.hpp>
7031 -#include <com/sun/star/drawing/XControlShape.hpp>
7032 -#include <com/sun/star/awt/XControl.hpp>
7033 -#include <com/sun/star/awt/XWindowPeer.hpp>
7034 -#include <ooo/vba/msforms/XControl.hpp>
7036 -#include "vbahelper.hxx"
7037 -#include "vbahelperinterface.hxx"
7039 -//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
7040 -typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
7042 -class ScVbaControl : public ControlImpl_BASE
7045 - com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
7047 - std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
7048 - css::uno::Reference< css::beans::XPropertySet > m_xProps;
7049 - css::uno::Reference< css::uno::XInterface > m_xControl;
7050 - css::uno::Reference< css::frame::XModel > m_xModel;
7052 - virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
7054 - ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
7055 - const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
7056 - virtual ~ScVbaControl();
7057 - // This class will own the helper, so make sure it is allocated from
7059 - void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
7061 - virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
7062 - virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
7063 - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
7064 - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
7065 - virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
7066 - virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
7067 - virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
7068 - virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
7069 - virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
7070 - virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
7071 - virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
7072 - virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
7073 - virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException);
7075 - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
7076 - virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
7077 - virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException);
7078 - virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException);
7079 - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
7080 - virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
7081 - virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
7082 - //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
7083 - virtual void removeResouce() throw( css::uno::RuntimeException );
7084 - //XHelperInterface
7085 - virtual rtl::OUString& getServiceImplName();
7086 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
7090 -class ScVbaControlFactory
7093 - ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
7094 - const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
7095 - ScVbaControl* createControl() throw ( css::uno::RuntimeException );
7096 - ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException );
7098 - ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
7099 - ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
7100 - css::uno::Reference< css::uno::XComponentContext > m_xContext;
7101 - css::uno::Reference< css::uno::XInterface > m_xControl;
7102 - css::uno::Reference< css::frame::XModel > m_xModel;
7105 -#endif//SC_VBA_CONTROL_HXX
7106 --- sc/source/ui/vba/vbacontrols.cxx.old 2009-04-02 10:45:35.000000000 +0000
7107 +++ sc/source/ui/vba/vbacontrols.cxx 1970-01-01 00:00:00.000000000 +0000
7109 -/*************************************************************************
7111 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7113 - * Copyright 2008 by Sun Microsystems, Inc.
7115 - * OpenOffice.org - a multi-platform office productivity suite
7120 - * This file is part of OpenOffice.org.
7122 - * OpenOffice.org is free software: you can redistribute it and/or modify
7123 - * it under the terms of the GNU Lesser General Public License version 3
7124 - * only, as published by the Free Software Foundation.
7126 - * OpenOffice.org is distributed in the hope that it will be useful,
7127 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7128 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7129 - * GNU Lesser General Public License version 3 for more details
7130 - * (a copy is included in the LICENSE file that accompanied this code).
7132 - * You should have received a copy of the GNU Lesser General Public License
7133 - * version 3 along with OpenOffice.org. If not, see
7134 - * <http://www.openoffice.org/license.html>
7135 - * for a copy of the LGPLv3 License.
7137 - ************************************************************************/
7139 -#include "vbacontrols.hxx"
7140 -#include "vbacontrol.hxx"
7141 -#include <cppuhelper/implbase2.hxx>
7142 -#include <com/sun/star/awt/XControlContainer.hpp>
7143 -#include <hash_map>
7145 -using namespace com::sun::star;
7146 -using namespace ooo::vba;
7149 -typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl;
7151 -typedef std::hash_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash,
7152 - ::std::equal_to< ::rtl::OUString > > ControlIndexMap;
7153 -typedef std::vector< uno::Reference< awt::XControl > > ControlVec;
7155 -class ControlArrayWrapper : public ArrayWrapImpl
7157 - uno::Reference< awt::XControlContainer > mxDialog;
7158 - uno::Sequence< ::rtl::OUString > msNames;
7159 - ControlVec mControls;
7160 - ControlIndexMap mIndices;
7162 - rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
7164 - uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY );
7165 - rtl::OUString sName;
7166 - xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
7172 - ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
7174 - mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
7175 - uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
7177 - msNames.realloc( sXControls.getLength() );
7178 - for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
7180 - uno::Reference< awt::XControl > xCtrl = sXControls[ i ];
7181 - msNames[ i ] = getControlName( xCtrl );
7182 - mControls.push_back( xCtrl );
7183 - mIndices[ msNames[ i ] ] = i;
7188 - virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
7190 - return awt::XControl::static_type(0);
7193 - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
7195 - return ( mControls.size() > 0 );
7199 - virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
7201 - if ( !hasByName( aName ) )
7202 - throw container::NoSuchElementException();
7203 - return getByIndex( mIndices[ aName ] );
7206 - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
7211 - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
7213 - ControlIndexMap::iterator it = mIndices.find( aName );
7214 - return it != mIndices.end();
7218 - virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException)
7220 - return mControls.size();
7223 - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
7225 - if ( Index < 0 || Index >= static_cast< sal_Int32 >( mControls.size() ) )
7226 - throw lang::IndexOutOfBoundsException();
7227 - return uno::makeAny( mControls[ Index ] );
7232 -class ControlsEnumWrapper : public EnumerationHelper_BASE
7234 - uno::Reference<XHelperInterface > m_xParent;
7235 - uno::Reference<uno::XComponentContext > m_xContext;
7236 - uno::Reference<container::XIndexAccess > m_xIndexAccess;
7237 - uno::Reference<awt::XControl > m_xDlg;
7242 - ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {}
7244 - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
7246 - return ( nIndex < m_xIndexAccess->getCount() );
7249 - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
7251 - if ( nIndex < m_xIndexAccess->getCount() )
7253 - uno::Reference< frame::XModel > xModel;
7254 - uno::Reference< uno::XInterface > xControl;
7255 - m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl;
7256 - // Create control from awt::XControl
7257 - ScVbaControlFactory aFac( m_xContext, xControl, xModel );
7258 - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( m_xDlg->getModel() ) );
7259 - return uno::makeAny( xVBAControl );
7261 - throw container::NoSuchElementException();
7267 -uno::Reference<container::XIndexAccess >
7268 -lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg )
7270 - return new ControlArrayWrapper( xDlg );
7273 -ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
7274 - const css::uno::Reference< awt::XControl >& xDialog )
7275 - : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
7277 - mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
7280 -uno::Reference< container::XEnumeration >
7281 -ScVbaControls::createEnumeration() throw (uno::RuntimeException)
7283 - uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) );
7284 - if ( !xEnum.is() )
7285 - throw uno::RuntimeException();
7290 -ScVbaControls::createCollectionObject( const css::uno::Any& aSource )
7292 - // Create control from awt::XControl
7293 - uno::Reference< awt::XControl > xControl;
7294 - aSource >>= xControl;
7295 - uno::Reference< frame::XModel > xModel;
7296 - ScVbaControlFactory aFac( mxContext, xControl, xModel );
7297 - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( mxDialog->getModel() ) );
7298 - return uno::makeAny( xVBAControl );
7302 -ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException)
7304 - uno::Reference< container::XEnumeration > xEnum( createEnumeration() );
7305 - while ( xEnum->hasMoreElements() )
7307 - uno::Reference< msforms::XControl > xControl( xEnum->nextElement(), uno::UNO_QUERY_THROW );
7308 - xControl->setLeft( xControl->getLeft() + cx );
7309 - xControl->setTop( xControl->getTop() + cy );
7314 -ScVbaControls::getElementType() throw (uno::RuntimeException)
7316 - return ooo::vba::msforms::XControl::static_type(0);
7319 -ScVbaControls::getServiceImplName()
7321 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") );
7325 -uno::Sequence< rtl::OUString >
7326 -ScVbaControls::getServiceNames()
7328 - static uno::Sequence< rtl::OUString > aServiceNames;
7329 - if ( aServiceNames.getLength() == 0 )
7331 - aServiceNames.realloc( 1 );
7332 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) );
7334 - return aServiceNames;
7336 --- sc/source/ui/vba/vbacontrols.hxx.old 2009-04-02 10:45:35.000000000 +0000
7337 +++ sc/source/ui/vba/vbacontrols.hxx 1970-01-01 00:00:00.000000000 +0000
7339 -/*************************************************************************
7341 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7343 - * Copyright 2008 by Sun Microsystems, Inc.
7345 - * OpenOffice.org - a multi-platform office productivity suite
7350 - * This file is part of OpenOffice.org.
7352 - * OpenOffice.org is free software: you can redistribute it and/or modify
7353 - * it under the terms of the GNU Lesser General Public License version 3
7354 - * only, as published by the Free Software Foundation.
7356 - * OpenOffice.org is distributed in the hope that it will be useful,
7357 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7358 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7359 - * GNU Lesser General Public License version 3 for more details
7360 - * (a copy is included in the LICENSE file that accompanied this code).
7362 - * You should have received a copy of the GNU Lesser General Public License
7363 - * version 3 along with OpenOffice.org. If not, see
7364 - * <http://www.openoffice.org/license.html>
7365 - * for a copy of the LGPLv3 License.
7367 - ************************************************************************/
7368 -#ifndef SC_VBA_CONTROLS_HXX
7369 -#define SC_VBA_CONTROLS_HXX
7371 -#include <cppuhelper/implbase1.hxx>
7372 -#include <ooo/vba/msforms/XControls.hpp>
7373 -#include <com/sun/star/awt/XControl.hpp>
7375 -#include "vbacollectionimpl.hxx"
7376 -#include "vbahelper.hxx"
7378 -typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
7380 -class ScVbaControls : public ControlsImpl_BASE
7382 - css::uno::Reference< css::awt::XControl > mxDialog;
7384 - virtual rtl::OUString& getServiceImplName();
7385 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
7387 - ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
7388 - const css::uno::Reference< css::awt::XControl >& xDialog );
7390 - virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException);
7391 - // XEnumerationAccess
7392 - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
7393 - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
7395 - // ScVbaCollectionBaseImpl
7396 - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
7399 -#endif //SC_VBA_OLEOBJECTS_HXX
7401 --- sc/source/ui/vba/vbadialog.cxx.old 2009-04-02 10:45:35.000000000 +0000
7402 +++ sc/source/ui/vba/vbadialog.cxx 2009-04-06 16:42:01.000000000 +0000
7405 #include <tools/string.hxx>
7407 -#include "vbahelper.hxx"
7408 +#include "excelvbahelper.hxx"
7409 #include "vbadialog.hxx"
7410 #include "vbaglobals.hxx"
7412 --- sc/source/ui/vba/vbadialog.hxx.old 2009-04-02 10:45:35.000000000 +0000
7413 +++ sc/source/ui/vba/vbadialog.hxx 2009-04-06 16:42:01.000000000 +0000
7415 #include <cppuhelper/implbase1.hxx>
7417 #include <com/sun/star/uno/XComponentContext.hpp>
7418 -#include <ooo/vba/XGlobals.hpp>
7419 #include <ooo/vba/excel/XApplication.hpp>
7420 #include <ooo/vba/excel/XDialog.hpp>
7422 -#include "vbahelperinterface.hxx"
7423 +#include <vbahelper/vbahelperinterface.hxx>
7424 #include "vbadialog.hxx"
7426 typedef InheritedHelperInterfaceImpl1< ov::excel::XDialog > ScVbaDialog_BASE;
7427 --- sc/source/ui/vba/vbadialogs.cxx.old 2009-04-02 10:45:35.000000000 +0000
7428 +++ sc/source/ui/vba/vbadialogs.cxx 2009-04-06 16:42:01.000000000 +0000
7431 #include <tools/string.hxx>
7433 -#include "vbahelper.hxx"
7434 +#include "excelvbahelper.hxx"
7435 #include "vbadialogs.hxx"
7436 #include "vbaglobals.hxx"
7437 #include "vbadialog.hxx"
7438 @@ -62,7 +62,7 @@ ScVbaDialogs::Item( const uno::Any &aIte
7440 sal_Int32 nIndex = 0;
7442 - uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication(), uno::UNO_QUERY_THROW ), nIndex, mxContext ) );
7443 + uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), nIndex, mxContext ) );
7444 return uno::Any( aDialog );
7447 --- sc/source/ui/vba/vbadialogs.hxx.old 2009-04-02 10:45:35.000000000 +0000
7448 +++ sc/source/ui/vba/vbadialogs.hxx 2009-04-06 16:42:01.000000000 +0000
7450 #include <com/sun/star/uno/XComponentContext.hpp>
7451 #include <ooo/vba/excel/XDialogs.hpp>
7452 #include <ooo/vba/XCollection.hpp>
7453 -#include "vbahelperinterface.hxx"
7454 +#include <vbahelper/vbahelperinterface.hxx>
7458 --- sc/source/ui/vba/vbaeventshelper.cxx.old 2009-04-06 16:42:00.000000000 +0000
7459 +++ sc/source/ui/vba/vbaeventshelper.cxx 2009-04-06 16:42:01.000000000 +0000
7462 ************************************************************************/
7463 #include "vbaeventshelper.hxx"
7464 -#include "helperdecl.hxx"
7465 +#include <vbahelper/helperdecl.hxx>
7466 #include <sfx2/objsh.hxx>
7467 -#include <basic/basmgr.hxx>
7468 -#include <basic/sbmod.hxx>
7469 -#include <basic/sbmeth.hxx>
7470 -#include <basic/sbx.hxx>
7471 #include "scextopt.hxx"
7472 #include <sfx2/evntconf.hxx>
7473 #include <sfx2/event.hxx>
7474 @@ -69,8 +65,6 @@ using namespace com::sun::star;
7475 using namespace ooo::vba;
7476 using namespace com::sun::star::document::VbaEventId;
7478 -const static String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
7480 const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
7481 const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
7482 const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
7483 @@ -400,7 +394,7 @@ ScVbaEventsHelper::ScVbaEventsHelper( un
7484 : m_xContext( xContext ), mpVbaEventsListener( NULL ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
7486 uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
7487 - ScDocShell* pDocShell = getDocShell( xModel );
7488 + ScDocShell* pDocShell = excel::getDocShell( xModel );
7489 pDoc = pDocShell->GetDocument();
7492 @@ -452,55 +446,6 @@ sal_Bool ScVbaEventsHelper::executeMacro
7496 -String ScVbaEventsHelper::workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
7499 - // would use the script provider to see if the macro exists but
7500 - // called at this stage tdoc content handler stuff is not set up
7503 - BasicManager* pBasicMgr = pShell-> GetBasicManager();
7506 - StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
7509 - USHORT nId = pBasicMgr->GetLibId( sLibrary );
7510 - pBasicMgr->LoadLib( nId );
7511 - pBasic = pBasicMgr->GetLib( sLibrary );
7515 - if ( sMod.Len() ) // we wish to find the macro is a specific module
7517 - SbModule* pModule = pBasic->FindModule( sMod );
7520 - SbxArray* pMethods = pModule->GetMethods();
7523 - SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
7526 - sFullName = sMacro;
7527 - sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
7532 - else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
7534 - if( SbModule* pModule = pMethod->GetModule() )
7536 - sFullName = sMacro;
7537 - sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
7546 uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
7548 @@ -517,7 +462,7 @@ uno::Any ScVbaEventsHelper::createWorkSh
7549 uno::Sequence< uno::Any > aArgs(2);
7550 aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
7551 aArgs[1] = uno::Any( pShell->GetModel() );
7552 - uno::Reference< uno::XInterface > xWorkbook( xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook") ), aArgs, xCtx ), uno::UNO_QUERY );
7553 + uno::Reference< uno::XInterface > xWorkbook( ov::createVBAUnoAPIServiceWithArgs( pShell, "ooo.vba.excel.Workbook", aArgs ), uno::UNO_QUERY );
7557 @@ -526,7 +471,7 @@ uno::Any ScVbaEventsHelper::createWorkSh
7558 aArgs[ 0 ] <<= xWorkbook;
7559 aArgs[ 1 ] <<= pShell->GetModel();
7560 aArgs[ 2 ] = uno::makeAny( rtl::OUString( sSheetName ) );
7561 - aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet") ), aArgs, xCtx );
7562 + aRet <<= ov::createVBAUnoAPIServiceWithArgs( pShell, "ooo.vba.excel.Worksheet", aArgs );
7564 catch( uno::Exception& e )
7566 @@ -560,7 +505,7 @@ uno::Any ScVbaEventsHelper::createRange(
7568 throw uno::RuntimeException(); //
7570 - aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range") ), aArgs, xCtx );
7571 + aRet <<= ov::createVBAUnoAPIServiceWithArgs( pDoc->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
7574 catch( uno::Exception& e )
7575 @@ -584,7 +529,7 @@ uno::Any ScVbaEventsHelper::createHyperl
7576 aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
7579 - aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Hyperlink") ), aArgs, xCtx );
7580 + aRet <<= ov::createVBAUnoAPIServiceWithArgs( pDoc->GetDocumentShell(), "ooo.vba.excel.Hyperlink", aArgs );
7584 @@ -647,7 +592,7 @@ ScVbaEventsHelper::getMacroPath( const s
7585 case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
7587 rtl::OUString aSheetModuleName = getSheetModuleName( nTab );
7588 - sMacroPath = workbookMacroExists( pShell, aSheetModuleName, sMacroName );
7589 + sMacroPath = docMacroExists( pShell, aSheetModuleName, sMacroName );
7593 @@ -681,7 +626,7 @@ ScVbaEventsHelper::getMacroPath( const s
7594 sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
7597 - sMacroPath = workbookMacroExists( pShell, sWorkbookModuleName, sMacroName );
7598 + sMacroPath = docMacroExists( pShell, sWorkbookModuleName, sMacroName );
7602 --- sc/source/ui/vba/vbaeventshelper.hxx.old 2009-04-06 16:42:00.000000000 +0000
7603 +++ sc/source/ui/vba/vbaeventshelper.hxx 2009-04-06 16:42:01.000000000 +0000
7605 #include <cppuhelper/implbase1.hxx>
7606 #include <com/sun/star/document/VbaEventId.hpp>
7607 #include <com/sun/star/document/XVbaEventsHelper.hpp>
7608 -#include "vbahelper.hxx"
7609 +#include "excelvbahelper.hxx"
7611 #define INVALID_TAB -1
7613 @@ -57,7 +57,6 @@ private:
7614 sal_Bool mbIgnoreEvents;
7616 String getSheetModuleName( SCTAB nTab );
7617 - String workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
7618 css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
7619 css::uno::Any createRange( const css::uno::Any& aRange );
7620 css::uno::Any createHyperlink( const css::uno::Any& rCell );
7621 --- sc/source/ui/vba/vbafillformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
7622 +++ sc/source/ui/vba/vbafillformat.hxx 2009-04-06 16:42:01.000000000 +0000
7624 #include <com/sun/star/drawing/XShape.hpp>
7625 #include <com/sun/star/drawing/FillStyle.hpp>
7626 #include <ooo/vba/msforms/XFillFormat.hpp>
7627 -#include "vbahelperinterface.hxx"
7628 +#include <vbahelper/vbahelperinterface.hxx>
7630 typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE;
7632 --- sc/source/ui/vba/vbafont.hxx.old 2009-04-02 10:45:35.000000000 +0000
7633 +++ sc/source/ui/vba/vbafont.hxx 2009-04-06 16:42:01.000000000 +0000
7636 #include <ooo/vba/excel/XFont.hpp>
7637 #include <com/sun/star/beans/XPropertySet.hpp>
7638 -#include "vbahelperinterface.hxx"
7639 +#include <vbahelper/vbahelperinterface.hxx>
7640 #include "vbapalette.hxx"
7642 class ScTableSheetsObj;
7643 --- sc/source/ui/vba/vbaformat.cxx.old 2009-04-02 10:45:35.000000000 +0000
7644 +++ sc/source/ui/vba/vbaformat.cxx 2009-04-06 16:42:01.000000000 +0000
7646 #include <ooo/vba/excel/XlHAlign.hpp>
7647 #include <ooo/vba/excel/XlOrientation.hpp>
7648 #include <ooo/vba/excel/Constants.hpp>
7649 +#include <ooo/vba/excel/XRange.hpp>
7650 #include <com/sun/star/table/CellVertJustify.hpp>
7651 #include <com/sun/star/table/CellHoriJustify.hpp>
7652 #include <com/sun/star/table/CellOrientation.hpp>
7653 @@ -341,7 +342,7 @@ template< typename Ifc1 >
7655 ScVbaFormat<Ifc1>::Borders( const uno::Any& Index ) throw (script::BasicErrorException, uno::RuntimeException )
7657 - ScVbaPalette aPalette( getDocShell( mxModel ) );
7658 + ScVbaPalette aPalette( excel::getDocShell( mxModel ) );
7659 uno::Reference< XCollection > xColl = new ScVbaBorders( thisHelperIface(), ScVbaFormat_BASE::mxContext, uno::Reference< table::XCellRange >( mxPropertySet, uno::UNO_QUERY_THROW ), aPalette );
7661 if ( Index.hasValue() )
7662 @@ -355,7 +356,7 @@ template< typename Ifc1 >
7663 uno::Reference< excel::XFont > SAL_CALL
7664 ScVbaFormat<Ifc1>::Font( ) throw (script::BasicErrorException, uno::RuntimeException)
7666 - ScVbaPalette aPalette( getDocShell( mxModel ) );
7667 + ScVbaPalette aPalette( excel::getDocShell( mxModel ) );
7668 return new ScVbaFont( thisHelperIface(), ScVbaFormat_BASE::mxContext, aPalette, mxPropertySet );
7671 --- sc/source/ui/vba/vbaformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
7672 +++ sc/source/ui/vba/vbaformat.hxx 2009-04-06 16:42:01.000000000 +0000
7674 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
7675 #include <com/sun/star/lang/Locale.hpp>
7676 #include <com/sun/star/beans/XPropertyState.hpp>
7677 -#include "vbahelperinterface.hxx"
7678 +#include <vbahelper/vbahelperinterface.hxx>
7680 template< typename Ifc1 >
7681 class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
7682 --- sc/source/ui/vba/vbaformatconditions.cxx.old 2009-04-02 10:45:35.000000000 +0000
7683 +++ sc/source/ui/vba/vbaformatconditions.cxx 2009-04-06 16:42:01.000000000 +0000
7685 #include "vbaformatcondition.hxx"
7686 #include "vbaworkbook.hxx"
7687 #include "vbastyles.hxx"
7688 +#include "vbaglobals.hxx"
7689 using namespace ::ooo::vba;
7690 using namespace ::com::sun::star;
7692 @@ -50,7 +51,7 @@ static rtl::OUString sStyleNamePrefix( R
7693 ScVbaFormatConditions::ScVbaFormatConditions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< sheet::XSheetConditionalEntries >& _xSheetConditionalEntries, const uno::Reference< frame::XModel >& xModel ) : ScVbaFormatConditions_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( _xSheetConditionalEntries, uno::UNO_QUERY_THROW ) ), mxSheetConditionalEntries( _xSheetConditionalEntries )
7695 mxRangeParent.set( xParent, uno::UNO_QUERY_THROW );
7696 - uno::Reference< excel::XWorkbook > xWorkbook = new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel );
7697 + uno::Reference< excel::XWorkbook > xWorkbook = new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), xContext, xModel );
7698 mxStyles.set( xWorkbook->Styles( uno::Any() ), uno::UNO_QUERY_THROW );
7699 uno::Reference< sheet::XCellRangeAddressable > xCellRange( mxRangeParent->getCellRange(), uno::UNO_QUERY_THROW );
7700 mxParentRangePropertySet.set( xCellRange, uno::UNO_QUERY_THROW );
7701 --- sc/source/ui/vba/vbaformatconditions.hxx.old 2009-04-02 10:45:35.000000000 +0000
7702 +++ sc/source/ui/vba/vbaformatconditions.hxx 2009-04-06 16:42:01.000000000 +0000
7704 #include <com/sun/star/beans/XPropertySet.hpp>
7705 #include <com/sun/star/table/CellAddress.hpp>
7706 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
7707 -#include "vbacollectionimpl.hxx"
7708 +#include <vbahelper/vbacollectionimpl.hxx>
7710 typedef CollTestImplHelper< ov::excel::XFormatConditions > ScVbaFormatConditions_BASE;
7711 class ScVbaFormatConditions: public ScVbaFormatConditions_BASE
7712 --- sc/source/ui/vba/vbaframe.cxx.old 2009-04-02 10:45:35.000000000 +0000
7713 +++ sc/source/ui/vba/vbaframe.cxx 1970-01-01 00:00:00.000000000 +0000
7715 -/*************************************************************************
7717 - * OpenOffice.org - a multi-platform office productivity suite
7723 - * last change: $Author$ $Date$
7725 - * The Contents of this file are made available subject to
7726 - * the terms of GNU Lesser General Public License Version 2.1.
7729 - * GNU Lesser General Public License Version 2.1
7730 - * =============================================
7731 - * Copyright 2005 by Sun Microsystems, Inc.
7732 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
7734 - * This library is free software; you can redistribute it and/or
7735 - * modify it under the terms of the GNU Lesser General Public
7736 - * License version 2.1, as published by the Free Software Foundation.
7738 - * This library is distributed in the hope that it will be useful,
7739 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7740 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7741 - * Lesser General Public License for more details.
7743 - * You should have received a copy of the GNU Lesser General Public
7744 - * License along with this library; if not, write to the Free Software
7745 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
7746 - * MA 02111-1307 USA
7748 - ************************************************************************/
7749 -#include "vbaframe.hxx"
7752 -using namespace com::sun::star;
7753 -using namespace ooo::vba;
7756 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
7757 -ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
7762 -rtl::OUString SAL_CALL
7763 -ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
7765 - rtl::OUString Label;
7766 - m_xProps->getPropertyValue( LABEL ) >>= Label;
7771 -ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
7773 - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
7777 -ScVbaFrame::getValue() throw (css::uno::RuntimeException)
7779 - return uno::makeAny( getCaption() );
7783 -ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
7785 - rtl::OUString sCaption;
7786 - _value >>= sCaption;
7787 - setCaption( sCaption );
7791 -ScVbaFrame::getServiceImplName()
7793 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
7797 -uno::Sequence< rtl::OUString >
7798 -ScVbaFrame::getServiceNames()
7800 - static uno::Sequence< rtl::OUString > aServiceNames;
7801 - if ( aServiceNames.getLength() == 0 )
7803 - aServiceNames.realloc( 1 );
7804 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
7806 - return aServiceNames;
7808 --- sc/source/ui/vba/vbaframe.hxx.old 2009-04-02 10:45:35.000000000 +0000
7809 +++ sc/source/ui/vba/vbaframe.hxx 1970-01-01 00:00:00.000000000 +0000
7811 -/*************************************************************************
7813 - * OpenOffice.org - a multi-platform office productivity suite
7819 - * last change: $Author$ $Date$
7821 - * The Contents of this file are made available subject to
7822 - * the terms of GNU Lesser General Public License Version 2.1.
7825 - * GNU Lesser General Public License Version 2.1
7826 - * =============================================
7827 - * Copyright 2005 by Sun Microsystems, Inc.
7828 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
7830 - * This library is free software; you can redistribute it and/or
7831 - * modify it under the terms of the GNU Lesser General Public
7832 - * License version 2.1, as published by the Free Software Foundation.
7834 - * This library is distributed in the hope that it will be useful,
7835 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7836 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7837 - * Lesser General Public License for more details.
7839 - * You should have received a copy of the GNU Lesser General Public
7840 - * License along with this library; if not, write to the Free Software
7841 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
7842 - * MA 02111-1307 USA
7844 - ************************************************************************/
7845 -#ifndef SC_VBA_FRAME_HXX
7846 -#define SC_VBA_FRAME_HXX
7847 -#include <cppuhelper/implbase1.hxx>
7848 -#include <ooo/vba/msforms/XLabel.hpp>
7850 -#include "vbacontrol.hxx"
7851 -#include "vbahelper.hxx"
7853 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
7855 -class ScVbaFrame : public FrameImpl_BASE
7858 - ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
7860 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
7861 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
7862 - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
7863 - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
7864 - //XHelperInterface
7865 - virtual rtl::OUString& getServiceImplName();
7866 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
7868 -#endif //SC_VBA_LABEL_HXX
7869 --- sc/source/ui/vba/vbaglobals.cxx.old 2009-04-02 10:45:35.000000000 +0000
7870 +++ sc/source/ui/vba/vbaglobals.cxx 2009-04-06 16:42:01.000000000 +0000
7872 * for a copy of the LGPLv3 License.
7874 ************************************************************************/
7875 -#include "helperdecl.hxx"
7876 +#include <vbahelper/helperdecl.hxx>
7877 #include "vbaglobals.hxx"
7879 #include <comphelper/unwrapargs.hxx>
7881 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
7882 #include <com/sun/star/beans/XPropertySet.hpp>
7883 +#include <cppuhelper/component_context.hxx>
7885 #include "vbaapplication.hxx"
7886 #include "vbaworksheet.hxx"
7887 @@ -49,11 +50,10 @@ using namespace ::ooo::vba;
7889 // =============================================================================
7891 -ScVbaGlobals::ScVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext )
7892 - :m_xContext( rxContext )
7893 +ScVbaGlobals::ScVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext ) : ScVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext )
7895 OSL_TRACE("ScVbaGlobals::ScVbaGlobals()");
7896 - mxApplication = uno::Reference< excel::XApplication > ( new ScVbaApplication( m_xContext) );
7897 + init( rxContext, uno::Any( getApplication() ) );
7900 ScVbaGlobals::~ScVbaGlobals()
7901 @@ -61,23 +61,6 @@ ScVbaGlobals::~ScVbaGlobals()
7902 OSL_TRACE("ScVbaGlobals::~ScVbaGlobals");
7905 -// Will throw if singleton can't be accessed
7906 -uno::Reference< XGlobals >
7907 -ScVbaGlobals::getGlobalsImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException )
7909 - uno::Reference< XGlobals > xGlobals(
7910 - xContext->getValueByName( ::rtl::OUString::createFromAscii(
7911 - "/singletons/ooo.vba.theGlobals") ), uno::UNO_QUERY);
7913 - if ( !xGlobals.is() )
7915 - throw uno::RuntimeException(
7916 - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ),
7917 - uno::Reference< XInterface >() );
7922 // =============================================================================
7924 // =============================================================================
7925 @@ -85,14 +68,15 @@ uno::Reference<excel::XApplication >
7926 ScVbaGlobals::getApplication() throw (uno::RuntimeException)
7928 // OSL_TRACE("In ScVbaGlobals::getApplication");
7929 - return mxApplication;
7930 + static uno::Reference< excel::XApplication > ExcelApplication( new ScVbaApplication( mxContext) );
7931 + return ExcelApplication;
7934 uno::Reference< excel::XWorkbook > SAL_CALL
7935 ScVbaGlobals::getActiveWorkbook() throw (uno::RuntimeException)
7937 // OSL_TRACE("In ScVbaGlobals::getActiveWorkbook");
7938 - uno::Reference< excel::XWorkbook > xWorkbook( mxApplication->getActiveWorkbook(), uno::UNO_QUERY);
7939 + uno::Reference< excel::XWorkbook > xWorkbook( getApplication()->getActiveWorkbook(), uno::UNO_QUERY);
7940 if ( xWorkbook.is() )
7943 @@ -103,22 +87,28 @@ ScVbaGlobals::getActiveWorkbook() throw
7947 +uno::Reference< excel::XWindow > SAL_CALL
7948 +ScVbaGlobals::getActiveWindow() throw (uno::RuntimeException)
7950 + return getApplication()->getActiveWindow();
7953 uno::Reference< excel::XWorksheet > SAL_CALL
7954 ScVbaGlobals::getActiveSheet() throw (uno::RuntimeException)
7956 - return mxApplication->getActiveSheet();
7957 + return getApplication()->getActiveSheet();
7961 ScVbaGlobals::WorkBooks( const uno::Any& aIndex ) throw (uno::RuntimeException)
7963 - return uno::Any( mxApplication->Workbooks(aIndex) );
7964 + return uno::Any( getApplication()->Workbooks(aIndex) );
7968 ScVbaGlobals::WorkSheets(const uno::Any& aIndex) throw (uno::RuntimeException)
7970 - return mxApplication->Worksheets( aIndex );
7971 + return getApplication()->Worksheets( aIndex );
7974 ScVbaGlobals::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException)
7975 @@ -126,26 +116,6 @@ ScVbaGlobals::Sheets( const uno::Any& aI
7976 return WorkSheets( aIndex );
7979 -::uno::Sequence< ::uno::Any > SAL_CALL
7980 -ScVbaGlobals::getGlobals( ) throw (::uno::RuntimeException)
7982 - sal_uInt32 nMax = 0;
7983 - uno::Sequence< uno::Any > maGlobals(4);
7984 - maGlobals[ nMax++ ] <<= ScVbaGlobals::getGlobalsImpl(m_xContext);
7985 - maGlobals[ nMax++ ] <<= mxApplication;
7987 - uno::Reference< excel::XWorkbook > xWorkbook = mxApplication->getActiveWorkbook();
7988 - if( xWorkbook.is() )
7990 - maGlobals[ nMax++ ] <<= xWorkbook;
7991 - uno::Reference< excel::XWorksheet > xWorksheet = xWorkbook->getActiveSheet();
7992 - if( xWorksheet.is() )
7993 - maGlobals[ nMax++ ] <<= xWorksheet;
7995 - maGlobals.realloc( nMax );
8000 ScVbaGlobals::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException)
8002 @@ -158,13 +128,140 @@ ScVbaGlobals::Names( const css::uno::Any
8003 return getApplication()->Names( aIndex );
8006 +uno::Reference< excel::XRange > SAL_CALL
8007 +ScVbaGlobals::getActiveCell() throw (uno::RuntimeException)
8009 + return getApplication()->getActiveCell();
8012 +uno::Reference< XAssistant > SAL_CALL
8013 +ScVbaGlobals::getAssistant() throw (uno::RuntimeException)
8015 + return getApplication()->getAssistant();
8019 +ScVbaGlobals::getSelection() throw (uno::RuntimeException)
8021 + return getApplication()->getSelection();
8024 +uno::Reference< excel::XWorkbook > SAL_CALL
8025 +ScVbaGlobals::getThisWorkbook() throw (uno::RuntimeException)
8027 + return getApplication()->getThisWorkbook();
8030 +ScVbaGlobals::Calculate() throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException)
8032 + return getApplication()->Calculate();
8035 +uno::Reference< excel::XRange > SAL_CALL
8036 +ScVbaGlobals::Cells( const uno::Any& RowIndex, const uno::Any& ColumnIndex ) throw (uno::RuntimeException)
8038 + return getApplication()->getActiveSheet()->Cells( RowIndex, ColumnIndex );
8040 +uno::Reference< excel::XRange > SAL_CALL
8041 +ScVbaGlobals::Columns( const uno::Any& aIndex ) throw (uno::RuntimeException)
8043 + return getApplication()->getActiveSheet()->Columns( aIndex );
8047 +ScVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
8049 + uno::Reference< XApplicationBase > xBase( getApplication(), uno::UNO_QUERY_THROW );
8050 + return xBase->CommandBars( aIndex );
8053 +css::uno::Reference< ov::excel::XRange > SAL_CALL
8054 +ScVbaGlobals::Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
8056 + return getApplication()->Union( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30 );
8058 +css::uno::Reference< ov::excel::XRange > SAL_CALL
8059 +ScVbaGlobals::Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
8061 + return getApplication()->Intersect( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30 );
8065 +ScVbaGlobals::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeException)
8067 + return getApplication()->Evaluate( Name );
8070 +css::uno::Any SAL_CALL
8071 +ScVbaGlobals::WorksheetFunction( ) throw (css::uno::RuntimeException)
8073 + return getApplication()->WorksheetFunction();
8077 +ScVbaGlobals::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException)
8079 + return getApplication()->Windows( aIndex );
8082 +uno::Reference< excel::XRange > SAL_CALL
8083 +ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException)
8085 + return getApplication()->getActiveSheet()->Rows( aIndex );
8089 +uno::Sequence< ::rtl::OUString > SAL_CALL
8090 +ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
8092 + static bool bInit = false;
8093 + static uno::Sequence< rtl::OUString > serviceNames( ScVbaGlobals_BASE::getAvailableServiceNames() );
8096 + rtl::OUString names[] = {
8097 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Range" ) ),
8098 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Workbook" ) ),
8099 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Window" ) ),
8100 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Worksheet" ) ),
8101 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Application" ) ),
8102 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.excel.Hyperlink" ) ),
8104 + sal_Int32 nExcelServices = ( sizeof( names )/ sizeof( names[0] ) );
8105 + sal_Int32 startIndex = serviceNames.getLength();
8106 + serviceNames.realloc( serviceNames.getLength() + nExcelServices );
8107 + for ( sal_Int32 index = 0; index < nExcelServices; ++index )
8108 + serviceNames[ startIndex + index ] = names[ index ];
8111 + return serviceNames;
8115 +ScVbaGlobals::getServiceImplName()
8117 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaGlobals") );
8121 +uno::Sequence< rtl::OUString >
8122 +ScVbaGlobals::getServiceNames()
8124 + static uno::Sequence< rtl::OUString > aServiceNames;
8125 + if ( aServiceNames.getLength() == 0 )
8127 + aServiceNames.realloc( 1 );
8128 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Globals" ) );
8130 + return aServiceNames;
8135 namespace sdecl = comphelper::service_decl;
8136 -sdecl::class_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl;
8137 +sdecl::vba_service_class_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl;
8138 extern sdecl::ServiceDecl const serviceDecl(
8141 - "ooo.vba.Globals" );
8142 + "ooo.vba.excel.Globals" );
8145 --- sc/source/ui/vba/vbaglobals.hxx.old 2009-04-02 10:45:35.000000000 +0000
8146 +++ sc/source/ui/vba/vbaglobals.hxx 2009-04-06 16:42:01.000000000 +0000
8148 #include <com/sun/star/lang/XServiceInfo.hpp>
8149 #include <com/sun/star/lang/XInitialization.hpp>
8150 #include <com/sun/star/uno/XComponentContext.hpp>
8151 -#include <ooo/vba/XGlobals.hpp>
8152 +#include <ooo/vba/excel/XGlobals.hpp>
8153 +#include <ooo/vba/excel/XApplication.hpp>
8155 #include <cppuhelper/implbase1.hxx>
8156 -#include "vbahelper.hxx"
8157 +#include "excelvbahelper.hxx"
8159 +#include <vbahelper/vbaglobalbase.hxx>
8160 // =============================================================================
8161 // class ScVbaGlobals
8162 // =============================================================================
8164 - typedef ::cppu::WeakImplHelper1<
8165 - ov::XGlobals > ScVbaGlobals_BASE;
8167 +typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > ScVbaGlobals_BASE;
8169 class ScVbaGlobals : public ScVbaGlobals_BASE
8172 - css::uno::Reference< css::uno::XComponentContext > m_xContext;
8173 - css::uno::Reference< ov::excel::XApplication > mxApplication;
8174 + virtual css::uno::Reference<
8175 + ov::excel::XApplication > SAL_CALL getApplication()
8176 + throw (css::uno::RuntimeException);
8180 css::uno::Reference< css::uno::XComponentContext >const& rxContext );
8181 virtual ~ScVbaGlobals();
8183 - static css::uno::Reference< ov::XGlobals > getGlobalsImpl(const css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException);
8186 - virtual css::uno::Reference<
8187 - ov::excel::XApplication > SAL_CALL getApplication()
8188 - throw (css::uno::RuntimeException);
8189 virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException);
8190 + virtual css::uno::Reference< ov::excel::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
8191 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
8192 + virtual css::uno::Reference< ov::XAssistant > SAL_CALL getAssistant() throw (css::uno::RuntimeException);
8193 + virtual void SAL_CALL Calculate( ) throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException);
8195 + virtual css::uno::Any SAL_CALL getSelection() throw (css::uno::RuntimeException);
8196 + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getActiveCell() throw (css::uno::RuntimeException);
8197 + virtual css::uno::Reference< ov::excel::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException);
8198 + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Cells( const css::uno::Any& RowIndex, const css::uno::Any& ColumnIndex ) throw (css::uno::RuntimeException);
8199 + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8200 + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8201 + virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ) throw (css::uno::RuntimeException);
8203 virtual css::uno::Any SAL_CALL WorkSheets(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8204 virtual css::uno::Any SAL_CALL WorkBooks(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8205 + virtual css::uno::Any SAL_CALL WorksheetFunction( ) throw (css::uno::RuntimeException);
8206 + virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8207 virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8208 - virtual css::uno::Sequence< css::uno::Any > SAL_CALL getGlobals( ) throw (css::uno::RuntimeException);
8209 virtual css::uno::Any SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
8210 + virtual css::uno::Reference< ::ooo::vba::excel::XRange > SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
8211 virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException );
8212 + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
8213 + virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
8217 + // XMultiServiceFactory
8218 + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
8219 + // XHelperInterface
8220 + virtual rtl::OUString& getServiceImplName();
8221 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
8224 --- sc/source/ui/vba/vbahelper.cxx.old 2009-04-02 10:45:35.000000000 +0000
8225 +++ sc/source/ui/vba/vbahelper.cxx 1970-01-01 00:00:00.000000000 +0000
8227 -/*************************************************************************
8229 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8231 - * Copyright 2008 by Sun Microsystems, Inc.
8233 - * OpenOffice.org - a multi-platform office productivity suite
8235 - * $RCSfile: vbahelper.cxx,v $
8236 - * $Revision: 1.5.32.1 $
8238 - * This file is part of OpenOffice.org.
8240 - * OpenOffice.org is free software: you can redistribute it and/or modify
8241 - * it under the terms of the GNU Lesser General Public License version 3
8242 - * only, as published by the Free Software Foundation.
8244 - * OpenOffice.org is distributed in the hope that it will be useful,
8245 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
8246 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8247 - * GNU Lesser General Public License version 3 for more details
8248 - * (a copy is included in the LICENSE file that accompanied this code).
8250 - * You should have received a copy of the GNU Lesser General Public License
8251 - * version 3 along with OpenOffice.org. If not, see
8252 - * <http://www.openoffice.org/license.html>
8253 - * for a copy of the LGPLv3 License.
8255 - ************************************************************************/
8256 -#include <cppuhelper/bootstrap.hxx>
8257 -#include <com/sun/star/util/XURLTransformer.hpp>
8258 -#include <com/sun/star/frame/XDispatchProvider.hpp>
8259 -#include <com/sun/star/frame/XModel.hpp>
8260 -#include <com/sun/star/frame/XFrame.hpp>
8261 -#include <com/sun/star/frame/XDesktop.hpp>
8262 -#include <com/sun/star/frame/XController.hpp>
8263 -#include <com/sun/star/uno/XComponentContext.hpp>
8264 -#include <com/sun/star/lang/XMultiComponentFactory.hpp>
8265 -#include <com/sun/star/beans/XPropertySet.hpp>
8266 -#include <com/sun/star/beans/XIntrospection.hpp>
8268 -#include <comphelper/processfactory.hxx>
8270 -#include <sfx2/objsh.hxx>
8271 -#include <sfx2/viewfrm.hxx>
8272 -#include <sfx2/dispatch.hxx>
8273 -#include <sfx2/app.hxx>
8274 -#include <svtools/stritem.hxx>
8276 -#include <docuno.hxx>
8278 -#include <basic/sbx.hxx>
8279 -#include <basic/sbstar.hxx>
8280 -#include <rtl/math.hxx>
8283 -#include "vbahelper.hxx"
8284 -#include "tabvwsh.hxx"
8285 -#include "transobj.hxx"
8286 -#include "scmod.hxx"
8287 -#include "vbashape.hxx"
8288 -#include "unonames.hxx"
8289 -#include "cellsuno.hxx"
8290 -using namespace ::com::sun::star;
8291 -using namespace ::ooo::vba;
8293 -#define POINTTO100THMILLIMETERFACTOR 35.27778
8294 -void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
8296 -uno::Any sbxToUnoValue( SbxVariable* pVar );
8304 -const double Millimeter::factor = 35.27778;
8306 -uno::Reference< beans::XIntrospectionAccess >
8307 -getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
8309 - static uno::Reference< beans::XIntrospection > xIntrospection;
8310 - if( !xIntrospection.is() )
8312 - uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
8313 - xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
8315 - return xIntrospection->inspect( aObject );
8318 -uno::Reference< script::XTypeConverter >
8319 -getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
8321 - static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
8324 -// helper method to determine if the view ( calc ) is in print-preview mode
8325 -bool isInPrintPreview( SfxViewFrame* pView )
8327 - sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
8328 - if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
8329 -nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
8331 - SfxViewFactory &rViewFactory =
8332 - pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
8333 - if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() )
8338 -const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
8342 - static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
8346 -class PasteCellsWarningReseter
8349 - bool bInitialWarningState;
8350 - static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
8352 - static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
8353 - static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
8354 - static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
8355 - xContext->getServiceManager(), uno::UNO_QUERY_THROW );
8356 - static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
8360 - bool getReplaceCellsWarning() throw ( uno::RuntimeException )
8362 - sal_Bool res = sal_False;
8363 - getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
8364 - return ( res == sal_True );
8367 - void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
8369 - getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
8372 - PasteCellsWarningReseter() throw ( uno::RuntimeException )
8374 - bInitialWarningState = getReplaceCellsWarning();
8375 - if ( bInitialWarningState )
8376 - setReplaceCellsWarning( false );
8378 - ~PasteCellsWarningReseter()
8380 - if ( bInitialWarningState )
8382 - // don't allow dtor to throw
8385 - setReplaceCellsWarning( true );
8387 - catch ( uno::Exception& /*e*/ ){}
8393 -dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
8397 - url.Complete = aUrl;
8398 - rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
8399 - uno::Reference<frame::XController> xController = xModel->getCurrentController();
8400 - uno::Reference<frame::XFrame> xFrame = xController->getFrame();
8401 - uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
8404 - uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
8405 - uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
8406 - if ( !xContext.is() )
8411 - uno::Reference<lang::XMultiComponentFactory > xServiceManager(
8412 - xContext->getServiceManager() );
8413 - if ( !xServiceManager.is() )
8417 - uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
8418 - ,xContext), uno::UNO_QUERY_THROW );
8419 - if (!xParser.is())
8421 - xParser->parseStrict (url);
8423 - catch ( uno::Exception & /*e*/ )
8428 - uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
8430 - uno::Sequence<beans::PropertyValue> dispatchProps(1);
8432 - sal_Int32 nProps = sProps.getLength();
8433 - beans::PropertyValue* pDest = dispatchProps.getArray();
8436 - dispatchProps.realloc( nProps + 1 );
8437 - // need to reaccquire pDest after realloc
8438 - pDest = dispatchProps.getArray();
8439 - beans::PropertyValue* pSrc = sProps.getArray();
8440 - for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
8444 - (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
8445 - (*pDest).Value <<= (sal_Bool)sal_True;
8447 - if (xDispatcher.is())
8448 - xDispatcher->dispatch( url, dispatchProps );
8452 -dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
8454 - uno::Sequence<beans::PropertyValue> dispatchProps;
8455 - dispatchRequests( xModel, aUrl, dispatchProps );
8459 -void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall)
8461 - ScTabViewShell* pViewShell = getBestViewShell( xModel );
8462 - SfxViewFrame* pViewFrame = NULL;
8464 - pViewFrame = pViewShell->GetViewFrame();
8467 - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
8470 - pDispatcher->Execute( nSlot , nCall );
8478 - PasteCellsWarningReseter resetWarningBox;
8479 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
8482 - pViewShell->PasteFromSystem();
8483 - pViewShell->CellContentChanged();
8491 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
8493 - pViewShell->CopyToClip(NULL,false,false,true);
8499 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
8501 - pViewShell->CutToClip( NULL, TRUE );
8504 -void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
8506 - PasteCellsWarningReseter resetWarningBox;
8507 - sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
8508 - InsCellCmd eMoveMode = INS_NONE;
8510 - ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
8511 - if ( !pTabViewShell )
8512 - // none active, try next best
8513 - pTabViewShell = getCurrentBestViewShell();
8514 - if ( pTabViewShell )
8516 - ScViewData* pView = pTabViewShell->GetViewData();
8517 - Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
8518 - if ( pView && pWin )
8520 - if ( bAsLink && bOtherDoc )
8521 - pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
8524 - ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
8525 - ScDocument* pDoc = NULL;
8527 - pDoc = pOwnClip->GetDocument();
8528 - pTabViewShell->PasteFromClip( nFlags, pDoc,
8529 - nFunction, bSkipEmpty, bTranspose, bAsLink,
8530 - eMoveMode, IDF_NONE, TRUE );
8531 - pTabViewShell->CellContentChanged();
8538 - uno::Reference< frame::XModel >
8539 -getCurrentDocument() throw (uno::RuntimeException)
8541 - uno::Reference< frame::XModel > xModel;
8542 - SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
8543 - SbxObject* basicChosen = pBasic ;
8544 - if ( basicChosen == NULL)
8546 - OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
8549 - SbxObject* p = pBasic;
8550 - SbxObject* pParent = p->GetParent();
8551 - SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
8553 - if( pParentParent )
8555 - basicChosen = pParentParent;
8557 - else if( pParent )
8559 - basicChosen = pParent;
8564 - SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
8568 - aModel = sbxToUnoValue( pCompVar );
8569 - if ( sal_False == ( aModel >>= xModel ) ||
8572 - // trying last gasp try the current component
8573 - uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
8574 - // test if vba service is present
8575 - uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
8576 - uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
8577 - uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
8578 - xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
8579 - if ( !xModel.is() )
8581 - throw uno::RuntimeException(
8582 - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
8588 - OSL_TRACE("Have model ThisComponent points to url %s",
8589 - ::rtl::OUStringToOString( xModel->getURL(),
8590 - RTL_TEXTENCODING_ASCII_US ).pData->buffer );
8595 - OSL_TRACE("Failed to get ThisComponent");
8596 - throw uno::RuntimeException(
8598 - RTL_CONSTASCII_USTRINGPARAM(
8599 - "Can't determine the currently selected document") ),
8600 - uno::Reference< uno::XInterface >() );
8606 -getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
8608 - uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
8609 - ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
8610 - ScDocShell* pDocShell = NULL;
8612 - pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
8618 -getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
8620 - ScDocShell* pDocShell = getDocShell( xModel );
8622 - return pDocShell->GetBestViewShell();
8627 -getCurrentBestViewShell()
8629 - uno::Reference< frame::XModel > xModel = getCurrentDocument();
8630 - return getBestViewShell( xModel );
8634 -getCurrentViewFrame()
8636 - ScTabViewShell* pViewShell = getCurrentBestViewShell();
8638 - return pViewShell->GetViewFrame();
8643 -OORGBToXLRGB( sal_Int32 nCol )
8645 - sal_Int32 nRed = nCol;
8646 - nRed &= 0x00FF0000;
8648 - sal_Int32 nGreen = nCol;
8649 - nGreen &= 0x0000FF00;
8651 - sal_Int32 nBlue = nCol;
8652 - nBlue &= 0x000000FF;
8653 - sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
8657 -XLRGBToOORGB( sal_Int32 nCol )
8659 - sal_Int32 nBlue = nCol;
8660 - nBlue &= 0x00FF0000;
8662 - sal_Int32 nGreen = nCol;
8663 - nGreen &= 0x0000FF00;
8665 - sal_Int32 nRed = nCol;
8666 - nRed &= 0x000000FF;
8667 - sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
8671 -OORGBToXLRGB( const uno::Any& aCol )
8675 - nCol = OORGBToXLRGB( nCol );
8676 - return uno::makeAny( nCol );
8679 -XLRGBToOORGB( const uno::Any& aCol )
8683 - nCol = XLRGBToOORGB( nCol );
8684 - return uno::makeAny( nCol );
8687 -void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, css::uno::Reference< frame::XModel >& xModel, sal_Bool bUseSelection )
8689 - sal_Int32 nTo = 0;
8690 - sal_Int32 nFrom = 0;
8691 - sal_Int16 nCopies = 1;
8692 - sal_Bool bPreview = sal_False;
8693 - sal_Bool bCollate = sal_False;
8694 - sal_Bool bSelection = bUseSelection;
8697 - Copies >>= nCopies;
8698 - Preview >>= bPreview;
8699 - if ( nCopies > 1 ) // Collate only useful when more that 1 copy
8700 - Collate >>= bCollate;
8702 - rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
8703 - rtl::OUString sFileName;
8705 - if (( nFrom || nTo ) )
8708 - sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
8710 - sRange += ::rtl::OUString::valueOf( nTo );
8713 - if ( PrToFileName.getValue() )
8715 - PrToFileName >>= sFileName;
8717 - ScTabViewShell* pViewShell = getBestViewShell( xModel );
8718 - SfxViewFrame* pViewFrame = NULL;
8720 - pViewFrame = pViewShell->GetViewFrame();
8723 - SfxAllItemSet aArgs( SFX_APP()->GetPool() );
8725 - SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
8726 - aArgs.Put( sfxCollate, sfxCollate.Which() );
8727 - SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
8728 - aArgs.Put( sfxCopies, sfxCopies.Which() );
8729 - if ( sFileName.getLength() )
8731 - SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
8732 - aArgs.Put( sfxFileName, sfxFileName.Which() );
8735 - if ( sRange.getLength() )
8737 - SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
8738 - aArgs.Put( sfxRange, sfxRange.Which() );
8740 - SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
8741 - aArgs.Put( sfxSelection, sfxSelection.Which() );
8742 - SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
8743 - aArgs.Put( sfxAsync, sfxAsync.Which() );
8744 - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
8746 - if ( pDispatcher )
8750 - if ( !pViewFrame->GetFrame()->IsInPlace() )
8752 - SC_MOD()->InputEnterHandler();
8753 - pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
8754 - while ( isInPrintPreview( pViewFrame ) )
8755 - Application::Yield();
8759 - pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
8765 - // 1 ActivePrinter ( how/can we switch a printer via API? )
8766 - // 2 PrintToFile ( ms behaviour if this option is specified but no
8767 - // filename supplied 'PrToFileName' then the user will be prompted )
8768 - // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
8769 - // values ) in oOO these options are mutually exclusive
8770 - // 4 There is a pop up to do with transparent objects in the print source
8771 - // should be able to disable that via configuration for the duration
8775 - void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, css::uno::Reference< css::frame::XModel >& xModel )
8777 - dispatchExecute( xModel, SID_VIEWSHELL1 );
8780 -rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
8782 - uno::Type aType = pvargItem.getValueType();
8783 - uno::TypeClass eTypeClass = aType.getTypeClass();
8784 - rtl::OUString sString;
8785 - switch ( eTypeClass )
8787 - case uno::TypeClass_BOOLEAN:
8789 - sal_Bool bBool = sal_False;
8790 - pvargItem >>= bBool;
8791 - sString = rtl::OUString::valueOf( bBool );
8794 - case uno::TypeClass_STRING:
8795 - pvargItem >>= sString;
8797 - case uno::TypeClass_FLOAT:
8800 - pvargItem >>= aFloat;
8801 - sString = rtl::OUString::valueOf( aFloat );
8804 - case uno::TypeClass_DOUBLE:
8806 - double aDouble = 0;
8807 - pvargItem >>= aDouble;
8808 - sString = rtl::OUString::valueOf( aDouble );
8811 - case uno::TypeClass_SHORT:
8812 - case uno::TypeClass_LONG:
8813 - case uno::TypeClass_BYTE:
8815 - sal_Int32 aNum = 0;
8816 - pvargItem >>= aNum;
8817 - sString = rtl::OUString::valueOf( aNum );
8821 - case uno::TypeClass_HYPER:
8823 - sal_Int64 aHyper = 0;
8824 - pvargItem >>= aHyper;
8825 - sString = rtl::OUString::valueOf( aHyper );
8829 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
8836 -ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
8838 - return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
8842 -ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
8844 - sal_Int32 a = _nStartSuffix;
8845 - rtl::OUString scompname = _sElementName;
8846 - bool bElementexists = true;
8847 - sal_Int32 nLen = _slist.getLength();
8849 - return _sElementName;
8851 - while (bElementexists == true)
8853 - for (sal_Int32 i = 0; i < nLen; i++)
8855 - if (FieldInList(_slist, scompname) == -1)
8860 - scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
8862 - return rtl::OUString();
8866 -ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
8868 - sal_Int32 FieldLen = SearchList.getLength();
8869 - sal_Int32 retvalue = -1;
8870 - for (sal_Int32 i = 0; i < FieldLen; i++)
8872 - // I wonder why comparing lexicographically is done
8873 - // when its a match is whats interesting?
8874 - //if (SearchList[i].compareTo(SearchString) == 0)
8875 - if ( SearchList[i].equals( SearchString ) )
8884 -bool NeedEsc(sal_Unicode cCode)
8886 - String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
8887 - return (STRING_NOTFOUND != sEsc.Search(cCode));
8890 -rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
8892 - rtl::OUStringBuffer sResult;
8893 - const sal_Unicode *start = rIn.getStr();
8894 - const sal_Unicode *end = start + rIn.getLength();
8896 - int seenright = 0;
8898 - sResult.append(static_cast<sal_Unicode>('^'));
8900 - while (start < end)
8905 - sResult.append(static_cast<sal_Unicode>('.'));
8909 - sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
8913 - sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
8917 - sResult.append(static_cast<sal_Unicode>('\\'));
8918 - sResult.append(*(++start));
8921 - // dump the ~ and escape the next characture
8923 - sResult.append(static_cast<sal_Unicode>('\\'));
8924 - sResult.append(*start++);
8927 - sResult.append(*start++);
8929 - while (start < end && !seenright)
8936 - sResult.append(static_cast<sal_Unicode>('\\'));
8937 - sResult.append(*start);
8940 - sResult.append(*start);
8944 - sResult.append(static_cast<sal_Unicode>('^'));
8947 - if (NeedEsc(*start))
8948 - sResult.append(static_cast<sal_Unicode>('\\'));
8949 - sResult.append(*start);
8956 - if (NeedEsc(*start))
8957 - sResult.append(static_cast<sal_Unicode>('\\'));
8958 - sResult.append(*start++);
8963 - sResult.append(static_cast<sal_Unicode>('$'));
8965 - return sResult.makeStringAndClear( );
8968 -double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
8970 - double fConvertFactor = 1.0;
8973 - fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
8977 - fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
8979 - return fConvertFactor;
8982 -double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
8984 - double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
8985 - return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
8987 -double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
8989 - double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
8990 - return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
8993 -ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
8995 - m_xShape = new ScVbaShape( xContext, xShape );
8998 -#define VBA_LEFT "PositionX"
8999 -#define VBA_TOP "PositionY"
9000 -UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
9002 - mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
9004 - double UserFormGeometryHelper::getLeft()
9006 - sal_Int32 nLeft = 0;
9007 - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
9008 - return Millimeter::getInPoints( nLeft );
9010 - void UserFormGeometryHelper::setLeft( double nLeft )
9012 - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
9014 - double UserFormGeometryHelper::getTop()
9016 - sal_Int32 nTop = 0;
9017 - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
9018 - return Millimeter::getInPoints( nTop );
9020 - void UserFormGeometryHelper::setTop( double nTop )
9022 - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
9024 - double UserFormGeometryHelper::getHeight()
9026 - sal_Int32 nHeight = 0;
9027 - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ) ) >>= nHeight;
9028 - return Millimeter::getInPoints( nHeight );
9030 - void UserFormGeometryHelper::setHeight( double nHeight )
9032 - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
9034 - double UserFormGeometryHelper::getWidth()
9036 - sal_Int32 nWidth = 0;
9037 - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ) ) >>= nWidth;
9038 - return Millimeter::getInPoints( nWidth );
9040 - void UserFormGeometryHelper::setWidth( double nWidth)
9042 - mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
9046 -ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
9048 - SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
9055 --- sc/source/ui/vba/vbahelper.hxx.old 2009-04-02 10:45:35.000000000 +0000
9056 +++ sc/source/ui/vba/vbahelper.hxx 1970-01-01 00:00:00.000000000 +0000
9058 -/*************************************************************************
9060 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9062 - * Copyright 2008 by Sun Microsystems, Inc.
9064 - * OpenOffice.org - a multi-platform office productivity suite
9066 - * $RCSfile: vbahelper.hxx,v $
9067 - * $Revision: 1.5.32.1 $
9069 - * This file is part of OpenOffice.org.
9071 - * OpenOffice.org is free software: you can redistribute it and/or modify
9072 - * it under the terms of the GNU Lesser General Public License version 3
9073 - * only, as published by the Free Software Foundation.
9075 - * OpenOffice.org is distributed in the hope that it will be useful,
9076 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9077 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9078 - * GNU Lesser General Public License version 3 for more details
9079 - * (a copy is included in the LICENSE file that accompanied this code).
9081 - * You should have received a copy of the GNU Lesser General Public License
9082 - * version 3 along with OpenOffice.org. If not, see
9083 - * <http://www.openoffice.org/license.html>
9084 - * for a copy of the LGPLv3 License.
9086 - ************************************************************************/
9087 -#ifndef SC_VBA_HELPER_HXX
9088 -#define SC_VBA_HELPER_HXX
9090 -#include <com/sun/star/drawing/XShape.hpp>
9091 -#include <com/sun/star/beans/XIntrospectionAccess.hpp>
9092 -#include <com/sun/star/script/BasicErrorException.hpp>
9093 -#include <com/sun/star/script/XTypeConverter.hpp>
9094 -#include <com/sun/star/lang/IllegalArgumentException.hpp>
9095 -#include <com/sun/star/awt/XControl.hpp>
9096 -#include <com/sun/star/awt/XDevice.hpp>
9097 -#include <basic/sberrors.hxx>
9098 -#include <cppuhelper/implbase1.hxx>
9099 -#include <com/sun/star/frame/XModel.hpp>
9100 -#include <docsh.hxx>
9101 -#include <sfx2/dispatch.hxx>
9102 -#include <ooo/vba/msforms/XShape.hpp>
9103 -#include "cellsuno.hxx"
9105 -namespace css = ::com::sun::star;
9111 - template < class T >
9112 - css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException)
9114 - if ( args.getLength() < ( nPos + 1) )
9115 - throw css::lang::IllegalArgumentException();
9116 - css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY );
9117 - if ( !bCanBeNull && !aSomething.is() )
9118 - throw css::lang::IllegalArgumentException();
9119 - return aSomething;
9121 - css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
9122 - css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
9124 - void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
9125 - void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
9126 - void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
9128 - void implnPaste();
9130 - void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
9131 - css::uno::Reference< css::frame::XModel >
9132 - getCurrentDocument() throw (css::uno::RuntimeException);
9133 - ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
9134 - ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
9135 - ScTabViewShell* getCurrentBestViewShell();
9136 - SfxViewFrame* getCurrentViewFrame();
9137 - sal_Int32 OORGBToXLRGB( sal_Int32 );
9138 - sal_Int32 XLRGBToOORGB( sal_Int32 );
9139 - css::uno::Any OORGBToXLRGB( const css::uno::Any& );
9140 - css::uno::Any XLRGBToOORGB( const css::uno::Any& );
9141 - // provide a NULL object that can be passed as variant so that
9142 - // the object when passed to IsNull will return true. aNULL
9143 - // contains an empty object reference
9144 - const css::uno::Any& aNULL();
9145 - void PrintOutHelper( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, css::uno::Reference< css::frame::XModel >& xModel, sal_Bool bSelection );
9146 - void PrintPreviewHelper( const css::uno::Any& EnableChanges, css::uno::Reference< css::frame::XModel >& xModel );
9148 - rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
9149 - rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
9150 - double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
9151 - double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
9152 - double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
9155 -class ScVbaCellRangeAccess
9158 - static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj );
9163 -//Factor to translate between points and hundredths of millimeters:
9165 - static const double factor;
9167 - double m_nMillimeter;
9170 - Millimeter():m_nMillimeter(0) {}
9172 - Millimeter(double mm):m_nMillimeter(mm) {}
9174 - void set(double mm) { m_nMillimeter = mm; }
9175 - void setInPoints(double points)
9177 - m_nMillimeter = points * 0.352777778;
9181 - void setInHundredthsOfOneMillimeter(double hmm)
9183 - m_nMillimeter = hmm / 100;
9188 - return m_nMillimeter;
9190 - double getInHundredthsOfOneMillimeter()
9192 - return m_nMillimeter * 100;
9194 - double getInPoints()
9196 - return m_nMillimeter * 2.834645669; // 72 / 25.4mm
9199 - static sal_Int32 getInHundredthsOfOneMillimeter(double points)
9201 - sal_Int32 mm = static_cast<sal_Int32>(points * factor);
9205 - static double getInPoints(int _hmm)
9207 - double points = double( static_cast<double>(_hmm) / factor);
9212 -class AbstractGeometryAttributes // probably should replace the ShapeHelper below
9215 - virtual ~AbstractGeometryAttributes() {}
9216 - virtual double getLeft() = 0;
9217 - virtual void setLeft( double ) = 0;
9218 - virtual double getTop() = 0;
9219 - virtual void setTop( double ) = 0;
9220 - virtual double getHeight() = 0;
9221 - virtual void setHeight( double ) = 0;
9222 - virtual double getWidth() = 0;
9223 - virtual void setWidth( double ) = 0;
9226 -class ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
9229 - css::uno::Reference< ooo::vba::msforms::XShape > m_xShape;
9230 - ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
9231 - virtual double getLeft()
9233 - return m_xShape->getLeft();
9235 - virtual void setLeft( double nLeft )
9237 - m_xShape->setLeft( nLeft );
9239 - virtual double getTop()
9241 - return m_xShape->getTop();
9243 - virtual void setTop( double nTop )
9245 - m_xShape->setTop( nTop );
9248 - virtual double getHeight()
9250 - return m_xShape->getHeight();
9252 - virtual void setHeight( double nHeight )
9254 - m_xShape->setHeight( nHeight );
9256 - virtual double getWidth()
9258 - return m_xShape->getWidth();
9260 - virtual void setWidth( double nWidth)
9262 - m_xShape->setHeight( nWidth );
9267 -#define VBA_LEFT "PositionX"
9268 -#define VBA_TOP "PositionY"
9269 -class UserFormGeometryHelper : public AbstractGeometryAttributes
9272 - css::uno::Reference< css::beans::XPropertySet > mxModel;
9274 - UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
9275 - virtual double getLeft();
9276 - virtual void setLeft( double nLeft );
9277 - virtual double getTop();
9278 - virtual void setTop( double nTop );
9279 - virtual double getHeight();
9280 - virtual void setHeight( double nHeight );
9281 - virtual double getWidth();
9282 - virtual void setWidth( double nWidth);
9288 - css::uno::Reference< css::drawing::XShape > xShape;
9290 - ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
9292 - if( !xShape.is() )
9293 - throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
9296 - double getHeight()
9298 - return Millimeter::getInPoints(xShape->getSize().Height);
9302 - void setHeight(double _fheight) throw ( css::script::BasicErrorException )
9306 - css::awt::Size aSize = xShape->getSize();
9307 - aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
9308 - xShape->setSize(aSize);
9310 - catch ( css::uno::Exception& /*e*/)
9312 - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
9319 - return Millimeter::getInPoints(xShape->getSize().Width);
9322 - void setWidth(double _fWidth) throw ( css::script::BasicErrorException )
9326 - css::awt::Size aSize = xShape->getSize();
9327 - aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
9328 - xShape->setSize(aSize);
9330 - catch (css::uno::Exception& /*e*/)
9332 - throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
9339 - return Millimeter::getInPoints(xShape->getPosition().X);
9343 - void setLeft(double _fLeft)
9345 - css::awt::Point aPoint = xShape->getPosition();
9346 - aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
9347 - xShape->setPosition(aPoint);
9353 - return Millimeter::getInPoints(xShape->getPosition().Y);
9357 - void setTop(double _fTop)
9359 - css::awt::Point aPoint = xShape->getPosition();
9360 - aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
9361 - xShape->setPosition(aPoint);
9366 -class ContainerUtilities
9370 - static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator);
9371 - static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix );
9373 - static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
9376 -// really just a a place holder to ease the porting pain
9380 - static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
9382 - // #TODO #FIXME ( do we want to support additionalArg here )
9383 - throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
9386 - static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
9388 - exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
9391 - static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
9393 - exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
9399 -namespace ov = ooo::vba;
9402 -# define SC_VBA_FIXME(a) OSL_TRACE( a )
9403 -# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ ))
9405 -# define SC_VBA_FIXME(a)
9406 -# define SC_VBA_STUB()
9410 --- sc/source/ui/vba/vbahelperinterface.hxx.old 2009-04-02 10:45:35.000000000 +0000
9411 +++ sc/source/ui/vba/vbahelperinterface.hxx 1970-01-01 00:00:00.000000000 +0000
9413 -/*************************************************************************
9415 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9417 - * Copyright 2008 by Sun Microsystems, Inc.
9419 - * OpenOffice.org - a multi-platform office productivity suite
9421 - * $RCSfile: vbahelperinterface.hxx,v $
9422 - * $Revision: 1.3 $
9424 - * This file is part of OpenOffice.org.
9426 - * OpenOffice.org is free software: you can redistribute it and/or modify
9427 - * it under the terms of the GNU Lesser General Public License version 3
9428 - * only, as published by the Free Software Foundation.
9430 - * OpenOffice.org is distributed in the hope that it will be useful,
9431 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9432 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9433 - * GNU Lesser General Public License version 3 for more details
9434 - * (a copy is included in the LICENSE file that accompanied this code).
9436 - * You should have received a copy of the GNU Lesser General Public License
9437 - * version 3 along with OpenOffice.org. If not, see
9438 - * <http://www.openoffice.org/license.html>
9439 - * for a copy of the LGPLv3 License.
9441 - ************************************************************************/
9442 -#ifndef SC_VBA_HELPERINTERFACE_HXX
9443 -#define SC_VBA_HELPERINTERFACE_HXX
9445 -#include <cppuhelper/implbase1.hxx>
9446 -#include <ooo/vba/XHelperInterface.hpp>
9447 -#include "vbahelper.hxx"
9448 -#include "vbaglobals.hxx"
9450 -// use this class when you have an a object like
9451 -// interface XAnInterface which contains XHelperInterface in its inheritance hierarchy
9452 -// interface XAnInterface
9454 -// interface XHelperInterface;
9455 -// [attribute, string] name;
9458 -// interface XAnInterface : XHelperInterface;
9460 -// [attribute, string] name;
9463 -// then this class can provide a default implementation of XHelperInterface,
9464 -// you can use it like this
9465 -// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE;
9466 -// class AnInterfaceImpl : public AnInterfaceImpl_BASE
9469 -// AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {}
9470 -// // implement XAnInterface methods only, no need to implement the XHelperInterface
9472 -// virtual void setName( const OUString& );
9473 -// virtual OUString getName();
9476 -const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) );
9478 -template< typename Ifc1 >
9479 -class InheritedHelperInterfaceImpl : public Ifc1
9482 - css::uno::WeakReference< ov::XHelperInterface > mxParent;
9483 - css::uno::Reference< css::uno::XComponentContext > mxContext;
9485 - InheritedHelperInterfaceImpl() {}
9486 - InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
9487 - virtual rtl::OUString& getServiceImplName() = 0;
9488 - virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
9490 - // XHelperInterface Methods
9491 - virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
9493 - return 0x53756E4F;
9495 - virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; }
9497 - virtual css::uno::Any SAL_CALL Application( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return css::uno::makeAny( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication() ); }
9500 - // XServiceInfo Methods
9501 - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
9502 - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException)
9504 - css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames();
9505 - const rtl::OUString* pStart = sServices.getConstArray();
9506 - const rtl::OUString* pEnd = pStart + sServices.getLength();
9507 - for ( ; pStart != pEnd ; ++pStart )
9508 - if ( (*pStart).equals( ServiceName ) )
9512 - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException)
9514 - css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
9519 -template< typename Ifc1 >
9520 -class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
9523 -typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
9525 - InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
9529 --- sc/source/ui/vba/vbahyperlink.cxx.old 2009-04-02 10:45:35.000000000 +0000
9530 +++ sc/source/ui/vba/vbahyperlink.cxx 2009-04-06 16:42:01.000000000 +0000
9534 ************************************************************************/
9535 -#include "helperdecl.hxx"
9536 +#include <vbahelper/helperdecl.hxx>
9537 #include "vbahyperlink.hxx"
9538 #include <com/sun/star/container/XIndexAccess.hpp>
9539 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
9540 --- sc/source/ui/vba/vbahyperlink.hxx.old 2009-04-02 10:45:35.000000000 +0000
9541 +++ sc/source/ui/vba/vbahyperlink.hxx 2009-04-06 16:42:01.000000000 +0000
9543 #include <com/sun/star/beans/XPropertySet.hpp>
9544 #include <ooo/vba/excel/XRange.hpp>
9546 -#include "vbahelperinterface.hxx"
9547 +#include <vbahelper/vbahelperinterface.hxx>
9549 typedef InheritedHelperInterfaceImpl1< ov::excel::XHyperlink > HyperlinkImpl_BASE;
9551 --- sc/source/ui/vba/vbaimage.cxx.old 2009-04-02 10:45:35.000000000 +0000
9552 +++ sc/source/ui/vba/vbaimage.cxx 1970-01-01 00:00:00.000000000 +0000
9554 -/*************************************************************************
9556 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9558 - * Copyright 2008 by Sun Microsystems, Inc.
9560 - * OpenOffice.org - a multi-platform office productivity suite
9565 - * This file is part of OpenOffice.org.
9567 - * OpenOffice.org is free software: you can redistribute it and/or modify
9568 - * it under the terms of the GNU Lesser General Public License version 3
9569 - * only, as published by the Free Software Foundation.
9571 - * OpenOffice.org is distributed in the hope that it will be useful,
9572 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9573 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9574 - * GNU Lesser General Public License version 3 for more details
9575 - * (a copy is included in the LICENSE file that accompanied this code).
9577 - * You should have received a copy of the GNU Lesser General Public License
9578 - * version 3 along with OpenOffice.org. If not, see
9579 - * <http://www.openoffice.org/license.html>
9580 - * for a copy of the LGPLv3 License.
9582 - ************************************************************************/
9583 -#include "vbaimage.hxx"
9586 -using namespace com::sun::star;
9587 -using namespace ooo::vba;
9590 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
9591 -ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
9596 -ScVbaImage::getServiceImplName()
9598 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") );
9602 -uno::Sequence< rtl::OUString >
9603 -ScVbaImage::getServiceNames()
9605 - static uno::Sequence< rtl::OUString > aServiceNames;
9606 - if ( aServiceNames.getLength() == 0 )
9608 - aServiceNames.realloc( 1 );
9609 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) );
9611 - return aServiceNames;
9613 --- sc/source/ui/vba/vbaimage.hxx.old 2009-04-02 10:45:35.000000000 +0000
9614 +++ sc/source/ui/vba/vbaimage.hxx 1970-01-01 00:00:00.000000000 +0000
9616 -/*************************************************************************
9618 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9620 - * Copyright 2008 by Sun Microsystems, Inc.
9622 - * OpenOffice.org - a multi-platform office productivity suite
9627 - * This file is part of OpenOffice.org.
9629 - * OpenOffice.org is free software: you can redistribute it and/or modify
9630 - * it under the terms of the GNU Lesser General Public License version 3
9631 - * only, as published by the Free Software Foundation.
9633 - * OpenOffice.org is distributed in the hope that it will be useful,
9634 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9635 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9636 - * GNU Lesser General Public License version 3 for more details
9637 - * (a copy is included in the LICENSE file that accompanied this code).
9639 - * You should have received a copy of the GNU Lesser General Public License
9640 - * version 3 along with OpenOffice.org. If not, see
9641 - * <http://www.openoffice.org/license.html>
9642 - * for a copy of the LGPLv3 License.
9644 - ************************************************************************/
9645 -#ifndef SC_VBA_IMAGE_HXX
9646 -#define SC_VBA_IMAGE_HXX
9647 -#include <cppuhelper/implbase1.hxx>
9648 -#include <ooo/vba/msforms/XImage.hpp>
9650 -#include "vbacontrol.hxx"
9651 -#include "vbahelper.hxx"
9653 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE;
9655 -class ScVbaImage : public ImageImpl_BASE
9658 - ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
9659 - //XHelperInterface
9660 - virtual rtl::OUString& getServiceImplName();
9661 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
9663 -#endif //SC_VBA_IMAGE_HXX
9664 --- sc/source/ui/vba/vbainterior.hxx.old 2009-04-02 10:45:35.000000000 +0000
9665 +++ sc/source/ui/vba/vbainterior.hxx 2009-04-06 16:42:01.000000000 +0000
9667 #include <com/sun/star/uno/XComponentContext.hpp>
9668 #include <com/sun/star/beans/XPropertySet.hpp>
9669 #include <com/sun/star/container/XIndexAccess.hpp>
9670 +#include <com/sun/star/container/XNameContainer.hpp>
9672 #include <com/sun/star/script/XInvocation.hpp>
9673 -#include "vbahelperinterface.hxx"
9674 +#include <vbahelper/vbahelperinterface.hxx>
9678 --- sc/source/ui/vba/vbalabel.cxx.old 2009-04-02 10:45:35.000000000 +0000
9679 +++ sc/source/ui/vba/vbalabel.cxx 1970-01-01 00:00:00.000000000 +0000
9681 -/*************************************************************************
9683 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9685 - * Copyright 2008 by Sun Microsystems, Inc.
9687 - * OpenOffice.org - a multi-platform office productivity suite
9689 - * $RCSfile: vbalabel.cxx,v $
9690 - * $Revision: 1.3 $
9692 - * This file is part of OpenOffice.org.
9694 - * OpenOffice.org is free software: you can redistribute it and/or modify
9695 - * it under the terms of the GNU Lesser General Public License version 3
9696 - * only, as published by the Free Software Foundation.
9698 - * OpenOffice.org is distributed in the hope that it will be useful,
9699 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9700 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9701 - * GNU Lesser General Public License version 3 for more details
9702 - * (a copy is included in the LICENSE file that accompanied this code).
9704 - * You should have received a copy of the GNU Lesser General Public License
9705 - * version 3 along with OpenOffice.org. If not, see
9706 - * <http://www.openoffice.org/license.html>
9707 - * for a copy of the LGPLv3 License.
9709 - ************************************************************************/
9710 -#include "vbalabel.hxx"
9713 -using namespace com::sun::star;
9714 -using namespace ooo::vba;
9717 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
9718 -ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
9723 -rtl::OUString SAL_CALL
9724 -ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
9726 - rtl::OUString Label;
9727 - m_xProps->getPropertyValue( LABEL ) >>= Label;
9732 -ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
9734 - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
9737 -ScVbaLabel::getValue() throw (css::uno::RuntimeException)
9739 - return uno::makeAny( getCaption() );
9743 -ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
9745 - rtl::OUString sCaption;
9746 - _value >>= sCaption;
9747 - setCaption( sCaption );
9752 -ScVbaLabel::getServiceImplName()
9754 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
9758 -uno::Sequence< rtl::OUString >
9759 -ScVbaLabel::getServiceNames()
9761 - static uno::Sequence< rtl::OUString > aServiceNames;
9762 - if ( aServiceNames.getLength() == 0 )
9764 - aServiceNames.realloc( 1 );
9765 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
9767 - return aServiceNames;
9769 --- sc/source/ui/vba/vbalabel.hxx.old 2009-04-02 10:45:35.000000000 +0000
9770 +++ sc/source/ui/vba/vbalabel.hxx 1970-01-01 00:00:00.000000000 +0000
9772 -/*************************************************************************
9774 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9776 - * Copyright 2008 by Sun Microsystems, Inc.
9778 - * OpenOffice.org - a multi-platform office productivity suite
9780 - * $RCSfile: vbalabel.hxx,v $
9781 - * $Revision: 1.3 $
9783 - * This file is part of OpenOffice.org.
9785 - * OpenOffice.org is free software: you can redistribute it and/or modify
9786 - * it under the terms of the GNU Lesser General Public License version 3
9787 - * only, as published by the Free Software Foundation.
9789 - * OpenOffice.org is distributed in the hope that it will be useful,
9790 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9791 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9792 - * GNU Lesser General Public License version 3 for more details
9793 - * (a copy is included in the LICENSE file that accompanied this code).
9795 - * You should have received a copy of the GNU Lesser General Public License
9796 - * version 3 along with OpenOffice.org. If not, see
9797 - * <http://www.openoffice.org/license.html>
9798 - * for a copy of the LGPLv3 License.
9800 - ************************************************************************/
9801 -#ifndef SC_VBA_LABEL_HXX
9802 -#define SC_VBA_LABEL_HXX
9803 -#include <cppuhelper/implbase1.hxx>
9804 -#include <ooo/vba/msforms/XLabel.hpp>
9806 -#include "vbacontrol.hxx"
9807 -#include "vbahelper.hxx"
9808 -#include <cppuhelper/implbase2.hxx>
9810 -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty > LabelImpl_BASE;
9812 -class ScVbaLabel : public LabelImpl_BASE
9815 - ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
9817 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
9818 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
9819 - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
9820 - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
9821 - //XHelperInterface
9822 - virtual rtl::OUString& getServiceImplName();
9823 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
9824 - // XDefaultProperty
9825 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
9827 -#endif //SC_VBA_LABEL_HXX
9828 --- sc/source/ui/vba/vbalineformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
9829 +++ sc/source/ui/vba/vbalineformat.hxx 2009-04-06 16:42:01.000000000 +0000
9831 #include <com/sun/star/drawing/XShape.hpp>
9832 #include <com/sun/star/beans/XPropertySet.hpp>
9833 #include <ooo/vba/msforms/XLineFormat.hpp>
9834 -#include "vbahelperinterface.hxx"
9835 +#include <vbahelper/vbahelperinterface.hxx>
9837 typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE;
9839 --- sc/source/ui/vba/vbalistbox.cxx.old 2009-04-02 10:45:35.000000000 +0000
9840 +++ sc/source/ui/vba/vbalistbox.cxx 1970-01-01 00:00:00.000000000 +0000
9842 -/*************************************************************************
9844 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9846 - * Copyright 2008 by Sun Microsystems, Inc.
9848 - * OpenOffice.org - a multi-platform office productivity suite
9850 - * $RCSfile: vbalistbox.cxx,v $
9851 - * $Revision: 1.4 $
9853 - * This file is part of OpenOffice.org.
9855 - * OpenOffice.org is free software: you can redistribute it and/or modify
9856 - * it under the terms of the GNU Lesser General Public License version 3
9857 - * only, as published by the Free Software Foundation.
9859 - * OpenOffice.org is distributed in the hope that it will be useful,
9860 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9861 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9862 - * GNU Lesser General Public License version 3 for more details
9863 - * (a copy is included in the LICENSE file that accompanied this code).
9865 - * You should have received a copy of the GNU Lesser General Public License
9866 - * version 3 along with OpenOffice.org. If not, see
9867 - * <http://www.openoffice.org/license.html>
9868 - * for a copy of the LGPLv3 License.
9870 - ************************************************************************/
9871 -#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
9873 -#include "vbalistbox.hxx"
9874 -#include "vbapropvalue.hxx"
9876 -#include <comphelper/anytostring.hxx>
9877 -#include <com/sun/star/script/ArrayWrapper.hpp>
9879 -using namespace com::sun::star;
9880 -using namespace ooo::vba;
9882 -const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
9883 -const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
9884 -const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
9887 -ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
9889 - mpListHelper.reset( new ListControlHelper( m_xProps ) );
9894 -ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
9896 - sal_Int32 nIndex = 0;
9897 - _value >>= nIndex;
9898 - Selected( nIndex );
9902 -ScVbaListBox::getListIndex() throw (uno::RuntimeException)
9904 - uno::Sequence< sal_Int16 > sSelection;
9905 - m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
9906 - if ( sSelection.getLength() == 0 )
9907 - return uno::Any( sal_Int32( -1 ) );
9908 - return uno::Any( sSelection[ 0 ] );
9912 -ScVbaListBox::getValue() throw (uno::RuntimeException)
9914 - uno::Sequence< sal_Int16 > sSelection;
9915 - uno::Sequence< rtl::OUString > sItems;
9916 - m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
9917 - m_xProps->getPropertyValue( ITEMS ) >>= sItems;
9918 - if( getMultiSelect() )
9919 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
9920 - "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
9922 - if ( sSelection.getLength() )
9923 - aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] );
9928 -ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
9930 - if( getMultiSelect() )
9932 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
9933 - "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
9935 - rtl::OUString sValue = getAnyAsString( _value );
9936 - uno::Sequence< rtl::OUString > sList;
9937 - m_xProps->getPropertyValue( ITEMS ) >>= sList;
9938 - uno::Sequence< sal_Int16 > nList;
9939 - sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() );
9940 - sal_Int16 nValue = -1;
9942 - for( i = 0; i < nLength; i++ )
9944 - if( sList[i].equals( sValue ) )
9950 - if( nValue == -1 )
9951 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
9952 - "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
9954 - uno::Sequence< sal_Int16 > nSelectedIndices(1);
9955 - nSelectedIndices[ 0 ] = nValue;
9956 - m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
9957 - m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
9960 -::rtl::OUString SAL_CALL
9961 -ScVbaListBox::getText() throw (uno::RuntimeException)
9963 - rtl::OUString result;
9964 - getValue() >>= result;
9969 -ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
9971 - setValue( uno::makeAny( _text ) ); // seems the same
9975 -ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
9977 - sal_Bool bMultiSelect = sal_False;
9978 - m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
9979 - return bMultiSelect;
9983 -ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
9985 - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
9988 -css::uno::Any SAL_CALL
9989 -ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
9991 - uno::Sequence< rtl::OUString > sList;
9992 - m_xProps->getPropertyValue( ITEMS ) >>= sList;
9993 - sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
9994 - // no choice but to do a horror cast as internally
9995 - // the indices are but sal_Int16
9996 - sal_Int16 nIndex = static_cast< sal_Int16 >( index );
9997 - if( nIndex < 0 || nIndex >= nLength )
9998 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
9999 - "Error Number." ), uno::Reference< uno::XInterface >() );
10000 - m_nIndex = nIndex;
10001 - return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
10006 -ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
10008 - mpListHelper->AddItem( pvargItem, pvargIndex );
10012 -ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
10014 - mpListHelper->removeItem( index );
10018 -ScVbaListBox::Clear( ) throw (uno::RuntimeException)
10020 - mpListHelper->Clear();
10023 -// this is called when something like the following vba code is used
10024 -// to set the selected state of particular entries in the Listbox
10025 -// ListBox1.Selected( 3 ) = false
10028 -ScVbaListBox::setValueEvent( const uno::Any& value )
10030 - sal_Bool bValue = sal_False;
10031 - if( !(value >>= bValue) )
10032 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
10033 - "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
10034 - uno::Sequence< sal_Int16 > nList;
10035 - m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList;
10036 - sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
10037 - sal_Int16 nIndex = m_nIndex;
10038 - for( sal_Int16 i = 0; i < nLength; i++ )
10040 - if( nList[i] == nIndex )
10046 - for( ; i < nLength - 1; i++ )
10048 - nList[i] = nList[i + 1];
10050 - nList.realloc( nLength - 1 );
10051 - //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
10052 - m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
10059 - if( getMultiSelect() )
10061 - nList.realloc( nLength + 1 );
10062 - nList[nLength] = nIndex;
10066 - nList.realloc( 1 );
10067 - nList[0] = nIndex;
10069 - m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
10073 -// this is called when something like the following vba code is used
10074 -// to determine the selected state of particular entries in the Listbox
10075 -// msgbox ListBox1.Selected( 3 )
10078 -ScVbaListBox::getValueEvent()
10080 - uno::Sequence< sal_Int16 > nList;
10081 - m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
10082 - sal_Int32 nLength = nList.getLength();
10083 - sal_Int32 nIndex = m_nIndex;
10085 - for( sal_Int32 i = 0; i < nLength; i++ )
10087 - if( nList[i] == nIndex )
10088 - return uno::makeAny( sal_True );
10091 - return uno::makeAny( sal_False );
10095 -ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
10097 - ScVbaControl::setRowSource( _rowsource );
10098 - mpListHelper->setRowSource( _rowsource );
10101 -sal_Int32 SAL_CALL
10102 -ScVbaListBox::getListCount() throw (uno::RuntimeException)
10104 - return mpListHelper->getListCount();
10108 -ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
10110 - return mpListHelper->List( pvargIndex, pvarColumn );
10114 -ScVbaListBox::getServiceImplName()
10116 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") );
10117 - return sImplName;
10120 -uno::Sequence< rtl::OUString >
10121 -ScVbaListBox::getServiceNames()
10123 - static uno::Sequence< rtl::OUString > aServiceNames;
10124 - if ( aServiceNames.getLength() == 0 )
10126 - aServiceNames.realloc( 1 );
10127 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) );
10129 - return aServiceNames;
10131 --- sc/source/ui/vba/vbalistbox.hxx.old 2009-04-02 10:45:35.000000000 +0000
10132 +++ sc/source/ui/vba/vbalistbox.hxx 1970-01-01 00:00:00.000000000 +0000
10134 -/*************************************************************************
10136 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10138 - * Copyright 2008 by Sun Microsystems, Inc.
10140 - * OpenOffice.org - a multi-platform office productivity suite
10142 - * $RCSfile: vbalistbox.hxx,v $
10143 - * $Revision: 1.3 $
10145 - * This file is part of OpenOffice.org.
10147 - * OpenOffice.org is free software: you can redistribute it and/or modify
10148 - * it under the terms of the GNU Lesser General Public License version 3
10149 - * only, as published by the Free Software Foundation.
10151 - * OpenOffice.org is distributed in the hope that it will be useful,
10152 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10153 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10154 - * GNU Lesser General Public License version 3 for more details
10155 - * (a copy is included in the LICENSE file that accompanied this code).
10157 - * You should have received a copy of the GNU Lesser General Public License
10158 - * version 3 along with OpenOffice.org. If not, see
10159 - * <http://www.openoffice.org/license.html>
10160 - * for a copy of the LGPLv3 License.
10162 - ************************************************************************/
10163 -#ifndef SC_VBA_LISTBOX_HXX
10164 -#define SC_VBA_LISTBOX_HXX
10165 -#include <cppuhelper/implbase2.hxx>
10166 -#include <com/sun/star/uno/XComponentContext.hpp>
10167 -#include <com/sun/star/script/XDefaultProperty.hpp>
10168 -#include <ooo/vba/msforms/XListBox.hpp>
10169 -#include <com/sun/star/beans/PropertyAttribute.hpp>
10171 -#include "vbacontrol.hxx"
10172 -#include "vbapropvalue.hxx"
10173 -#include "vbalistcontrolhelper.hxx"
10174 -#include "vbahelper.hxx"
10176 -typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
10177 -class ScVbaListBox : public ListBoxImpl_BASE
10178 - ,public PropListener
10180 - std::auto_ptr< ListControlHelper > mpListHelper;
10181 - rtl::OUString sSourceName;
10182 - rtl::OUString msDftPropName;
10184 - sal_Int16 m_nIndex;
10187 - ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
10190 - virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
10191 - virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
10192 - virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
10193 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
10194 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
10195 - virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
10196 - virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
10197 - virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
10198 - virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
10199 - virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
10202 - virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
10203 - virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
10204 - virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
10205 - virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
10207 - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
10209 - // XDefaultProperty
10210 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
10212 - //XHelperInterface
10213 - virtual rtl::OUString& getServiceImplName();
10214 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
10217 - virtual void setValueEvent( const css::uno::Any& value );
10218 - virtual css::uno::Any getValueEvent();
10224 --- sc/source/ui/vba/vbalistcontrolhelper.cxx.old 2009-04-02 10:45:35.000000000 +0000
10225 +++ sc/source/ui/vba/vbalistcontrolhelper.cxx 1970-01-01 00:00:00.000000000 +0000
10227 -#include <vbalistcontrolhelper.hxx>
10229 -using namespace com::sun::star;
10230 -using namespace ooo::vba;
10232 -const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
10235 -ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
10237 - if ( pvargItem.hasValue() )
10239 - uno::Sequence< rtl::OUString > sList;
10240 - m_xProps->getPropertyValue( ITEMS ) >>= sList;
10242 - sal_Int32 nIndex = sList.getLength();
10244 - if ( pvargIndex.hasValue() )
10245 - pvargIndex >>= nIndex;
10247 - rtl::OUString sString = getAnyAsString( pvargItem );
10249 - // if no index specified or item is to be appended to end of
10250 - // list just realloc the array and set the last item
10251 - if ( nIndex == sList.getLength() )
10253 - sal_Int32 nOldSize = sList.getLength();
10254 - sList.realloc( nOldSize + 1 );
10255 - sList[ nOldSize ] = sString;
10259 - // just copy those elements above the one to be inserted
10260 - std::vector< rtl::OUString > sVec;
10261 - // reserve just the amount we need to copy
10262 - sVec.reserve( sList.getLength() - nIndex );
10264 - // point at first element to copy
10265 - rtl::OUString* pString = sList.getArray() + nIndex;
10266 - const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
10267 - // insert the new element
10268 - sVec.push_back( sString );
10270 - for ( ; pString != pEndString; ++pString )
10271 - sVec.push_back( *pString );
10273 - sList.realloc( sList.getLength() + 1 );
10275 - // point at first element to be overwritten
10276 - pString = sList.getArray() + nIndex;
10277 - pEndString = sList.getArray() + sList.getLength();
10278 - std::vector< rtl::OUString >::iterator it = sVec.begin();
10279 - for ( ; pString != pEndString; ++pString, ++it)
10284 - m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
10290 -ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
10292 - sal_Int32 nIndex = 0;
10294 - if ( index >>= nIndex )
10296 - uno::Sequence< rtl::OUString > sList;
10297 - m_xProps->getPropertyValue( ITEMS ) >>= sList;
10298 - if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
10299 - throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
10300 - if( sList.hasElements() )
10302 - if( sList.getLength() == 1 )
10307 - for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
10309 - sList[i] = sList[i+1];
10311 - sList.realloc( sList.getLength() - 1 );
10314 - m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
10319 -ListControlHelper::Clear( ) throw (uno::RuntimeException)
10321 - // urk, setValue doesn't seem to work !!
10322 - //setValue( uno::makeAny( sal_Int16() ) );
10323 - m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
10327 -ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
10329 - if ( _rowsource.getLength() == 0 )
10333 -sal_Int32 SAL_CALL
10334 -ListControlHelper::getListCount() throw (uno::RuntimeException)
10336 - uno::Sequence< rtl::OUString > sList;
10337 - m_xProps->getPropertyValue( ITEMS ) >>= sList;
10338 - return sList.getLength();
10342 -ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
10344 - uno::Sequence< rtl::OUString > sList;
10345 - m_xProps->getPropertyValue( ITEMS ) >>= sList;
10346 - sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
10348 - if ( pvargIndex.hasValue() )
10350 - sal_Int16 nIndex = -1;
10351 - pvargIndex >>= nIndex;
10352 - if( nIndex < 0 || nIndex >= nLength )
10353 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
10354 - "Bad row Index" ), uno::Reference< uno::XInterface >() );
10355 - aRet <<= sList[ nIndex ];
10357 - else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
10358 - throw uno::RuntimeException( rtl::OUString::createFromAscii(
10359 - "Bad column Index" ), uno::Reference< uno::XInterface >() );
10360 - else // List() ( e.g. no args )
10362 - uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
10363 - for ( sal_Int32 i = 0; i < nLength; ++i )
10365 - sReturnArray[ i ].realloc( 10 );
10366 - sReturnArray[ i ][ 0 ] = sList[ i ];
10368 - aRet = uno::makeAny( sReturnArray );
10372 --- sc/source/ui/vba/vbalistcontrolhelper.hxx.old 2009-04-02 10:45:35.000000000 +0000
10373 +++ sc/source/ui/vba/vbalistcontrolhelper.hxx 1970-01-01 00:00:00.000000000 +0000
10375 -#ifndef SC_VBA_LISTCONTROLHELPER
10376 -#define SC_VBA_LISTCONTROLHELPER
10378 -#include "vbahelper.hxx"
10380 -class ListControlHelper
10382 - css::uno::Reference< css::beans::XPropertySet > m_xProps;
10385 - ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){}
10386 - virtual ~ListControlHelper() {}
10387 - virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
10388 - virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
10389 - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
10390 - virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
10391 - virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
10392 - virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
10395 --- sc/source/ui/vba/vbamultipage.cxx.old 2009-04-02 10:45:35.000000000 +0000
10396 +++ sc/source/ui/vba/vbamultipage.cxx 1970-01-01 00:00:00.000000000 +0000
10398 -/*************************************************************************
10400 - * OpenOffice.org - a multi-platform office productivity suite
10406 - * last change: $Author$ $Date$
10408 - * The Contents of this file are made available subject to
10409 - * the terms of GNU Lesser General Public License Version 2.1.
10412 - * GNU Lesser General Public License Version 2.1
10413 - * =============================================
10414 - * Copyright 2005 by Sun Microsystems, Inc.
10415 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
10417 - * This library is free software; you can redistribute it and/or
10418 - * modify it under the terms of the GNU Lesser General Public
10419 - * License version 2.1, as published by the Free Software Foundation.
10421 - * This library is distributed in the hope that it will be useful,
10422 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10423 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10424 - * Lesser General Public License for more details.
10426 - * You should have received a copy of the GNU Lesser General Public
10427 - * License along with this library; if not, write to the Free Software
10428 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
10429 - * MA 02111-1307 USA
10431 - ************************************************************************/
10432 -#include "vbamultipage.hxx"
10433 -#include <ooo/vba/XCollection.hpp>
10434 -#include "vbapages.hxx"
10437 -using namespace com::sun::star;
10438 -using namespace ooo::vba;
10440 -// uno servicename com.sun.star.awt.UnoControlProgressBarMode
10441 -const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
10442 -const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") );
10443 -const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") );
10445 -typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base;
10446 -class PagesImpl : public PagesImpl_Base
10448 - sal_Int32 mnPages;
10450 - PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {}
10451 - virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; }
10452 - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException)
10454 - if ( Index < 0 || Index > mnPages )
10455 - throw lang::IndexOutOfBoundsException();
10456 - return uno::makeAny( uno::Reference< uno::XInterface >() );
10458 - // XElementAccess
10459 - virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
10461 - // no Pages object yet #FIXME
10462 - //return msforms::XPage::static_type(0);
10463 - return uno::XInterface::static_type(0);
10465 - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
10467 - return ( mnPages > 0 );
10470 -uno::Reference< container::XIndexAccess >
10471 -ScVbaMultiPage::getPages( sal_Int32 nPages )
10473 - return new PagesImpl( nPages );
10476 -ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
10478 - mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
10479 - // set dialog step to value of multipage pseudo model
10480 - setValue(getValue());
10484 -sal_Int32 SAL_CALL
10485 -ScVbaMultiPage::getValue() throw (css::uno::RuntimeException)
10487 - sal_Int32 nValue = 0;
10488 - m_xProps->getPropertyValue( SVALUE ) >>= nValue;
10493 -ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
10495 - // track change in dialog ( dialog value is 1 based, 0 is a special value )
10496 - m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
10497 - mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
10502 -ScVbaMultiPage::getServiceImplName()
10504 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") );
10505 - return sImplName;
10509 -ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException)
10511 - sal_Int32 nValue = 0;
10512 - m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue;
10513 - uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) );
10514 - if ( !index.hasValue() )
10515 - return uno::makeAny( xColl );
10516 - return xColl->Item( uno::makeAny( index ), uno::Any() );
10519 -uno::Sequence< rtl::OUString >
10520 -ScVbaMultiPage::getServiceNames()
10522 - static uno::Sequence< rtl::OUString > aServiceNames;
10523 - if ( aServiceNames.getLength() == 0 )
10525 - aServiceNames.realloc( 1 );
10526 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) );
10528 - return aServiceNames;
10530 --- sc/source/ui/vba/vbamultipage.hxx.old 2009-04-02 10:45:35.000000000 +0000
10531 +++ sc/source/ui/vba/vbamultipage.hxx 1970-01-01 00:00:00.000000000 +0000
10533 -/*************************************************************************
10535 - * OpenOffice.org - a multi-platform office productivity suite
10541 - * last change: $Author$ $Date$
10543 - * The Contents of this file are made available subject to
10544 - * the terms of GNU Lesser General Public License Version 2.1.
10547 - * GNU Lesser General Public License Version 2.1
10548 - * =============================================
10549 - * Copyright 2005 by Sun Microsystems, Inc.
10550 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
10552 - * This library is free software; you can redistribute it and/or
10553 - * modify it under the terms of the GNU Lesser General Public
10554 - * License version 2.1, as published by the Free Software Foundation.
10556 - * This library is distributed in the hope that it will be useful,
10557 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10558 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10559 - * Lesser General Public License for more details.
10561 - * You should have received a copy of the GNU Lesser General Public
10562 - * License along with this library; if not, write to the Free Software
10563 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
10564 - * MA 02111-1307 USA
10566 - ************************************************************************/
10567 -#ifndef SC_VBA_MULTIPAGE_HXX
10568 -#define SC_VBA_MULTIPAGE_HXX
10569 -#include <cppuhelper/implbase1.hxx>
10570 -#include <ooo/vba/msforms/XMultiPage.hpp>
10571 -#include <com/sun/star/container/XIndexAccess.hpp>
10573 -#include "vbacontrol.hxx"
10574 -#include "vbahelper.hxx"
10575 -//#include <cppuhelper/implbase2.hxx>
10576 -#include <cppuhelper/implbase1.hxx>
10578 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE;
10580 -class ScVbaMultiPage : public MultiPageImpl_BASE
10582 - css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages );
10583 - css::uno::Reference< css::beans::XPropertySet > mxDialogProps;
10585 - ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog );
10587 - virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException);
10588 - virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException);
10589 - virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException);
10591 - //XHelperInterface
10592 - virtual rtl::OUString& getServiceImplName();
10593 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
10594 - // XDefaultProperty
10595 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
10597 -#endif //SC_VBA_LABEL_HXX
10598 --- sc/source/ui/vba/vbaname.cxx.old 2009-04-02 10:45:35.000000000 +0000
10599 +++ sc/source/ui/vba/vbaname.cxx 2009-04-06 16:42:01.000000000 +0000
10601 * for a copy of the LGPLv3 License.
10603 ************************************************************************/
10604 -#include "helperdecl.hxx"
10605 +#include <vbahelper/helperdecl.hxx>
10607 #include <com/sun/star/table/XCellRange.hpp>
10608 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
10609 @@ -64,7 +64,8 @@ ScVbaName::~ScVbaName()
10610 css::uno::Reference< ov::excel::XWorksheet >
10611 ScVbaName::getWorkSheet() throw (css::uno::RuntimeException)
10613 - return ScVbaGlobals::getGlobalsImpl( mxContext )->getActiveSheet();
10614 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
10615 + return xApplication->getActiveSheet();
10619 @@ -234,7 +235,7 @@ ScVbaName::setRefersToR1C1Local( const :
10620 css::uno::Reference< ov::excel::XRange >
10621 ScVbaName::getRefersToRange() throw (css::uno::RuntimeException)
10623 - uno::Reference< ov::excel::XRange > xRange = ScVbaRange::getRangeObjectForName( mxContext, mxNamedRange->getName(), getDocShell( mxModel ), formula::FormulaGrammar::CONV_XL_R1C1 );
10624 + uno::Reference< ov::excel::XRange > xRange = ScVbaRange::getRangeObjectForName( mxContext, mxNamedRange->getName(), excel::getDocShell( mxModel ), formula::FormulaGrammar::CONV_XL_R1C1 );
10628 --- sc/source/ui/vba/vbaname.hxx.old 2009-04-02 10:45:35.000000000 +0000
10629 +++ sc/source/ui/vba/vbaname.hxx 2009-04-06 16:42:01.000000000 +0000
10631 #include <com/sun/star/sheet/XNamedRange.hpp>
10632 #include <com/sun/star/sheet/XNamedRanges.hpp>
10634 -#include "vbahelperinterface.hxx"
10635 +#include <vbahelper/vbahelperinterface.hxx>
10639 typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE;
10641 --- sc/source/ui/vba/vbanames.cxx.old 2009-04-02 10:45:35.000000000 +0000
10642 +++ sc/source/ui/vba/vbanames.cxx 2009-04-06 16:42:01.000000000 +0000
10644 * for a copy of the LGPLv3 License.
10646 ************************************************************************/
10647 -#include "helperdecl.hxx"
10648 +#include <vbahelper/helperdecl.hxx>
10650 #include <com/sun/star/table/XCellRange.hpp>
10651 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
10652 @@ -81,7 +81,7 @@ ScDocument *
10653 ScVbaNames::getScDocument()
10655 uno::Reference< frame::XModel > xModel( getModel() , uno::UNO_QUERY_THROW );
10656 - ScTabViewShell * pTabViewShell = getBestViewShell( xModel );
10657 + ScTabViewShell * pTabViewShell = excel::getBestViewShell( xModel );
10658 if ( !pTabViewShell )
10659 throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() );
10660 ScViewData* pViewData = pTabViewShell->GetViewData();
10661 --- sc/source/ui/vba/vbanames.hxx.old 2009-04-02 10:45:35.000000000 +0000
10662 +++ sc/source/ui/vba/vbanames.hxx 2009-04-06 16:42:01.000000000 +0000
10664 #include <ooo/vba/XCollection.hpp>
10665 #include <com/sun/star/container/XEnumerationAccess.hpp>
10666 #include <com/sun/star/sheet/XNamedRanges.hpp>
10667 -#include "vbacollectionimpl.hxx"
10668 +#include <vbahelper/vbacollectionimpl.hxx>
10673 typedef CollTestImplHelper< ov::excel::XNames > ScVbaNames_BASE;
10675 --- sc/source/ui/vba/vbaoleobject.hxx.old 2009-04-02 10:45:35.000000000 +0000
10676 +++ sc/source/ui/vba/vbaoleobject.hxx 2009-04-06 16:42:01.000000000 +0000
10678 #include <com/sun/star/awt/XWindowPeer.hpp>
10679 #include <ooo/vba/excel/XOLEObject.hpp>
10681 -#include "vbahelperinterface.hxx"
10682 +#include <vbahelper/vbahelperinterface.hxx>
10684 typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BASE;
10686 --- sc/source/ui/vba/vbaoleobjects.hxx.old 2009-04-02 10:45:35.000000000 +0000
10687 +++ sc/source/ui/vba/vbaoleobjects.hxx 2009-04-06 16:42:01.000000000 +0000
10689 #include <cppuhelper/implbase1.hxx>
10690 #include <ooo/vba/excel/XOLEObjects.hpp>
10692 -#include "vbacollectionimpl.hxx"
10693 -#include "vbahelper.hxx"
10694 +#include <vbahelper/vbacollectionimpl.hxx>
10695 +#include "excelvbahelper.hxx"
10697 typedef CollTestImplHelper< ov::excel::XOLEObjects > OLEObjectsImpl_BASE;
10699 --- sc/source/ui/vba/vbaoutline.hxx.old 2009-04-02 10:45:35.000000000 +0000
10700 +++ sc/source/ui/vba/vbaoutline.hxx 2009-04-06 16:42:01.000000000 +0000
10702 #include <cppuhelper/implbase1.hxx>
10703 #include <ooo/vba/excel/XOutline.hpp>
10704 #include <com/sun/star/uno/XComponentContext.hpp>
10705 -#include "vbahelperinterface.hxx"
10706 +#include <vbahelper/vbahelperinterface.hxx>
10708 typedef InheritedHelperInterfaceImpl1< ov::excel::XOutline > ScVbaOutline_BASE;
10710 --- sc/source/ui/vba/vbapagebreak.hxx.old 2009-04-02 10:45:35.000000000 +0000
10711 +++ sc/source/ui/vba/vbapagebreak.hxx 2009-04-06 16:42:01.000000000 +0000
10713 #include <com/sun/star/script/BasicErrorException.hpp>
10714 #include <com/sun/star/sheet/TablePageBreakData.hpp>
10715 #include <com/sun/star/beans/XPropertySet.hpp>
10716 -#include "vbahelperinterface.hxx"
10717 +#include <vbahelper/vbahelperinterface.hxx>
10719 template< typename Ifc1 >
10720 class ScVbaPageBreak : public InheritedHelperInterfaceImpl1< Ifc1 >
10721 --- sc/source/ui/vba/vbapagebreaks.hxx.old 2009-04-02 10:45:35.000000000 +0000
10722 +++ sc/source/ui/vba/vbapagebreaks.hxx 2009-04-06 16:42:01.000000000 +0000
10724 #include <com/sun/star/beans/XPropertySet.hpp>
10725 #include <com/sun/star/container/XIndexAccess.hpp>
10726 #include <com/sun/star/table/XColumnRowRange.hpp>
10727 -#include "vbahelperinterface.hxx"
10728 -#include "vbacollectionimpl.hxx"
10729 +#include <vbahelper/vbahelperinterface.hxx>
10730 +#include <vbahelper/vbacollectionimpl.hxx>
10732 typedef CollTestImplHelper< ov::excel::XHPageBreaks > ScVbaHPageBreaks_BASE;
10734 --- sc/source/ui/vba/vbapages.cxx.old 2009-04-02 10:45:35.000000000 +0000
10735 +++ sc/source/ui/vba/vbapages.cxx 1970-01-01 00:00:00.000000000 +0000
10737 -/*************************************************************************
10739 - * OpenOffice.org - a multi-platform office productivity suite
10745 - * last change: $Author$ $Date$
10747 - * The Contents of this file are made available subject to
10748 - * the terms of GNU Lesser General Public License Version 2.1.
10751 - * GNU Lesser General Public License Version 2.1
10752 - * =============================================
10753 - * Copyright 2005 by Sun Microsystems, Inc.
10754 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
10756 - * This library is free software; you can redistribute it and/or
10757 - * modify it under the terms of the GNU Lesser General Public
10758 - * License version 2.1, as published by the Free Software Foundation.
10760 - * This library is distributed in the hope that it will be useful,
10761 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10762 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10763 - * Lesser General Public License for more details.
10765 - * You should have received a copy of the GNU Lesser General Public
10766 - * License along with this library; if not, write to the Free Software
10767 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
10768 - * MA 02111-1307 USA
10770 - ************************************************************************/
10771 -#include "vbapages.hxx"
10773 -using namespace ::ooo::vba;
10774 -using namespace ::com::sun::star;
10775 -using namespace ::vos;
10777 -ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages )
10781 -uno::Type SAL_CALL
10782 -ScVbaPages::getElementType() throw (uno::RuntimeException)
10784 - // return msforms::XPage::static_type(0);
10785 - return uno::XInterface::static_type(0);
10789 -ScVbaPages::createCollectionObject( const css::uno::Any& aSource )
10795 -ScVbaPages::getServiceImplName()
10797 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") );
10798 - return sImplName;
10801 -uno::Reference< container::XEnumeration > SAL_CALL
10802 -ScVbaPages::createEnumeration() throw (uno::RuntimeException)
10804 - return uno::Reference< container::XEnumeration >();
10807 -uno::Sequence< rtl::OUString >
10808 -ScVbaPages::getServiceNames()
10810 - static uno::Sequence< rtl::OUString > aServiceNames;
10811 - if ( aServiceNames.getLength() == 0 )
10813 - aServiceNames.realloc( 1 );
10814 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) );
10816 - return aServiceNames;
10818 --- sc/source/ui/vba/vbapages.hxx.old 2009-04-02 10:45:35.000000000 +0000
10819 +++ sc/source/ui/vba/vbapages.hxx 1970-01-01 00:00:00.000000000 +0000
10821 -/*************************************************************************
10823 - * OpenOffice.org - a multi-platform office productivity suite
10829 - * last change: $Author$ $Date$
10831 - * The Contents of this file are made available subject to
10832 - * the terms of GNU Lesser General Public License Version 2.1.
10835 - * GNU Lesser General Public License Version 2.1
10836 - * =============================================
10837 - * Copyright 2005 by Sun Microsystems, Inc.
10838 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
10840 - * This library is free software; you can redistribute it and/or
10841 - * modify it under the terms of the GNU Lesser General Public
10842 - * License version 2.1, as published by the Free Software Foundation.
10844 - * This library is distributed in the hope that it will be useful,
10845 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10846 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10847 - * Lesser General Public License for more details.
10849 - * You should have received a copy of the GNU Lesser General Public
10850 - * License along with this library; if not, write to the Free Software
10851 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
10852 - * MA 02111-1307 USA
10854 - ************************************************************************/
10855 -#ifndef SC_VBA_PAGES_HXX
10856 -#define SC_VBA_PAGES_HXX
10858 -#include <ooo/vba/office/MsoShapeType.hpp>
10859 -#include <com/sun/star/lang/XEventListener.hpp>
10860 -#include <com/sun/star/beans/XPropertySet.hpp>
10861 -#include <ooo/vba/msforms/XPages.hpp>
10862 -#include <cppuhelper/implbase2.hxx>
10863 -#include <cppuhelper/implbase1.hxx>
10865 -#include "vbacollectionimpl.hxx"
10866 -typedef CollTestImplHelper<
10867 -ov::msforms::XPages > ScVbaPages_BASE;
10869 -class ScVbaPages : public ScVbaPages_BASE
10872 - virtual rtl::OUString& getServiceImplName();
10873 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
10875 - ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException );
10876 - virtual ~ScVbaPages() {}
10877 - // XEnumerationAccess
10878 - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
10879 - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
10880 - // ScVbaPages_BASE
10881 - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
10884 -#endif//SC_VBA_SHAPE_HXX
10885 --- sc/source/ui/vba/vbapagesetup.cxx.old 2009-04-02 10:45:35.000000000 +0000
10886 +++ sc/source/ui/vba/vbapagesetup.cxx 2009-04-06 16:42:01.000000000 +0000
10888 #include "cellsuno.hxx"
10889 #include "convuno.hxx"
10890 #include "rangelst.hxx"
10891 +#include "excelvbahelper.hxx"
10892 #include <com/sun/star/sheet/XPrintAreas.hpp>
10893 #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
10894 #include <com/sun/star/text/XText.hpp>
10895 @@ -85,7 +86,7 @@ rtl::OUString SAL_CALL ScVbaPageSetup::g
10896 ScUnoConversion::FillScRange( aRange, aSeq[i] );
10897 aRangeList.Append( aRange );
10899 - ScDocument* pDoc = getDocShell( mxModel )->GetDocument();
10900 + ScDocument* pDoc = excel::getDocShell( mxModel )->GetDocument();
10901 aRangeList.Format( aPrintArea, nFlags, pDoc, formula::FormulaGrammar::CONV_XL_A1, ',' );
10904 @@ -106,7 +107,7 @@ void SAL_CALL ScVbaPageSetup::setPrintAr
10906 ScRangeList aCellRanges;
10908 - if( getScRangeListForAddress( rAreas, getDocShell( mxModel ) , aRange, aCellRanges ) )
10909 + if( getScRangeListForAddress( rAreas, excel::getDocShell( mxModel ) , aRange, aCellRanges ) )
10911 uno::Sequence< table::CellRangeAddress > aSeq( aCellRanges.Count() );
10913 --- sc/source/ui/vba/vbapagesetup.hxx.old 2009-04-02 10:45:35.000000000 +0000
10914 +++ sc/source/ui/vba/vbapagesetup.hxx 2009-04-06 16:42:01.000000000 +0000
10916 #include <com/sun/star/uno/XComponentContext.hpp>
10917 #include <com/sun/star/sheet/XSpreadsheet.hpp>
10918 #include <com/sun/star/beans/XPropertySet.hpp>
10919 -#include "vbahelperinterface.hxx"
10920 +#include <vbahelper/vbahelperinterface.hxx>
10922 typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE;
10924 --- sc/source/ui/vba/vbapalette.hxx.old 2009-04-02 10:45:35.000000000 +0000
10925 +++ sc/source/ui/vba/vbapalette.hxx 2009-04-06 16:42:01.000000000 +0000
10927 #ifndef SC_VBAPALETTE_HXX
10928 #define SC_VBAPALETTE_HXX
10930 -#include "vbahelper.hxx"
10931 +#include "excelvbahelper.hxx"
10932 #include <document.hxx>
10933 #include <com/sun/star/container/XIndexAccess.hpp>
10935 --- sc/source/ui/vba/vbapane.hxx.old 2009-04-02 10:45:35.000000000 +0000
10936 +++ sc/source/ui/vba/vbapane.hxx 2009-04-06 16:42:01.000000000 +0000
10938 #include<com/sun/star/sheet/XViewPane.hpp>
10939 #include<ooo/vba/excel/XPane.hpp>
10941 -#include"vbahelper.hxx"
10942 +#include"excelvbahelper.hxx"
10944 typedef cppu::WeakImplHelper1< ov::excel::XPane > PaneImpl_Base;
10946 --- sc/source/ui/vba/vbapictureformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
10947 +++ sc/source/ui/vba/vbapictureformat.hxx 2009-04-06 16:42:01.000000000 +0000
10949 #include <com/sun/star/drawing/XShape.hpp>
10950 #include <com/sun/star/beans/XPropertySet.hpp>
10951 #include <ooo/vba/msforms/XPictureFormat.hpp>
10952 -#include "vbahelperinterface.hxx"
10953 +#include <vbahelper/vbahelperinterface.hxx>
10955 typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE;
10957 --- sc/source/ui/vba/vbapivotcache.hxx.old 2009-04-02 10:45:35.000000000 +0000
10958 +++ sc/source/ui/vba/vbapivotcache.hxx 2009-04-06 16:42:01.000000000 +0000
10960 #include <com/sun/star/sheet/XDataPilotTable.hpp>
10962 #include <ooo/vba/excel/XPivotCache.hpp>
10963 -#include "vbahelperinterface.hxx"
10964 +#include <vbahelper/vbahelperinterface.hxx>
10966 typedef InheritedHelperInterfaceImpl1<ov::excel::XPivotCache > PivotCacheImpl_BASE;
10968 --- sc/source/ui/vba/vbapivottable.hxx.old 2009-04-02 10:45:35.000000000 +0000
10969 +++ sc/source/ui/vba/vbapivottable.hxx 2009-04-06 16:42:01.000000000 +0000
10971 #include <com/sun/star/uno/XComponentContext.hpp>
10972 #include <com/sun/star/sheet/XDataPilotTable.hpp>
10973 #include <ooo/vba/excel/XPivotTable.hpp>
10974 -#include "vbahelper.hxx"
10975 -#include "vbahelperinterface.hxx"
10976 +#include "excelvbahelper.hxx"
10977 +#include <vbahelper/vbahelperinterface.hxx>
10979 typedef InheritedHelperInterfaceImpl1< ov::excel::XPivotTable > PivotTableImpl_BASE;
10981 --- sc/source/ui/vba/vbapivottables.hxx.old 2009-04-02 10:45:35.000000000 +0000
10982 +++ sc/source/ui/vba/vbapivottables.hxx 2009-04-06 16:42:01.000000000 +0000
10984 #include <com/sun/star/container/XEnumerationAccess.hpp>
10985 #include <com/sun/star/uno/XComponentContext.hpp>
10987 -#include "vbahelper.hxx"
10988 -#include "vbahelperinterface.hxx"
10989 -#include "vbacollectionimpl.hxx"
10990 +#include "excelvbahelper.hxx"
10991 +#include <vbahelper/vbahelperinterface.hxx>
10992 +#include <vbahelper/vbacollectionimpl.hxx>
10995 typedef CollTestImplHelper< ov::excel::XPivotTables > ScVbaPivotTables_BASE;
10996 --- sc/source/ui/vba/vbaprogressbar.cxx.old 2009-04-02 10:45:35.000000000 +0000
10997 +++ sc/source/ui/vba/vbaprogressbar.cxx 1970-01-01 00:00:00.000000000 +0000
10999 -/*************************************************************************
11001 - * OpenOffice.org - a multi-platform office productivity suite
11007 - * last change: $Author$ $Date$
11009 - * The Contents of this file are made available subject to
11010 - * the terms of GNU Lesser General Public License Version 2.1.
11013 - * GNU Lesser General Public License Version 2.1
11014 - * =============================================
11015 - * Copyright 2005 by Sun Microsystems, Inc.
11016 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11018 - * This library is free software; you can redistribute it and/or
11019 - * modify it under the terms of the GNU Lesser General Public
11020 - * License version 2.1, as published by the Free Software Foundation.
11022 - * This library is distributed in the hope that it will be useful,
11023 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11024 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11025 - * Lesser General Public License for more details.
11027 - * You should have received a copy of the GNU Lesser General Public
11028 - * License along with this library; if not, write to the Free Software
11029 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
11030 - * MA 02111-1307 USA
11032 - ************************************************************************/
11033 -#include "vbaprogressbar.hxx"
11036 -using namespace com::sun::star;
11037 -using namespace ooo::vba;
11039 -// uno servicename com.sun.star.awt.UnoControlProgressBarMode
11040 -const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
11042 -ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
11048 -ScVbaProgressBar::getValue() throw (css::uno::RuntimeException)
11050 - return m_xProps->getPropertyValue( SVALUE );
11054 -ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
11056 - m_xProps->setPropertyValue( SVALUE, _value );
11060 -ScVbaProgressBar::getServiceImplName()
11062 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") );
11063 - return sImplName;
11066 -uno::Sequence< rtl::OUString >
11067 -ScVbaProgressBar::getServiceNames()
11069 - static uno::Sequence< rtl::OUString > aServiceNames;
11070 - if ( aServiceNames.getLength() == 0 )
11072 - aServiceNames.realloc( 1 );
11073 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
11075 - return aServiceNames;
11077 --- sc/source/ui/vba/vbaprogressbar.hxx.old 2009-04-02 10:45:35.000000000 +0000
11078 +++ sc/source/ui/vba/vbaprogressbar.hxx 1970-01-01 00:00:00.000000000 +0000
11080 -/*************************************************************************
11082 - * OpenOffice.org - a multi-platform office productivity suite
11088 - * last change: $Author$ $Date$
11090 - * The Contents of this file are made available subject to
11091 - * the terms of GNU Lesser General Public License Version 2.1.
11094 - * GNU Lesser General Public License Version 2.1
11095 - * =============================================
11096 - * Copyright 2005 by Sun Microsystems, Inc.
11097 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11099 - * This library is free software; you can redistribute it and/or
11100 - * modify it under the terms of the GNU Lesser General Public
11101 - * License version 2.1, as published by the Free Software Foundation.
11103 - * This library is distributed in the hope that it will be useful,
11104 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11105 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11106 - * Lesser General Public License for more details.
11108 - * You should have received a copy of the GNU Lesser General Public
11109 - * License along with this library; if not, write to the Free Software
11110 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
11111 - * MA 02111-1307 USA
11113 - ************************************************************************/
11114 -#ifndef SC_VBA_PROGRESSBAR_HXX
11115 -#define SC_VBA_PROGRESSBAR_HXX
11116 -#include <cppuhelper/implbase1.hxx>
11117 -#include <ooo/vba/msforms/XProgressBar.hpp>
11119 -#include "vbacontrol.hxx"
11120 -#include "vbahelper.hxx"
11121 -#include <cppuhelper/implbase2.hxx>
11123 -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty > ProgressBarImpl_BASE;
11125 -class ScVbaProgressBar : public ProgressBarImpl_BASE
11128 - ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
11130 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
11131 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
11132 - //XHelperInterface
11133 - virtual rtl::OUString& getServiceImplName();
11134 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
11135 - // XDefaultProperty
11136 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
11138 -#endif //SC_VBA_LABEL_HXX
11139 --- sc/source/ui/vba/vbapropvalue.hxx.old 2009-04-02 10:45:35.000000000 +0000
11140 +++ sc/source/ui/vba/vbapropvalue.hxx 2009-04-06 16:42:01.000000000 +0000
11142 #include <ooo/vba/XPropValue.hpp>
11143 #include <cppuhelper/implbase1.hxx>
11145 -#include "vbahelper.hxx"
11146 +#include "excelvbahelper.hxx"
11148 typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
11150 --- sc/source/ui/vba/vbaradiobutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
11151 +++ sc/source/ui/vba/vbaradiobutton.cxx 1970-01-01 00:00:00.000000000 +0000
11153 -/*************************************************************************
11155 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11157 - * Copyright 2008 by Sun Microsystems, Inc.
11159 - * OpenOffice.org - a multi-platform office productivity suite
11161 - * $RCSfile: vbaradiobutton.cxx,v $
11162 - * $Revision: 1.3 $
11164 - * This file is part of OpenOffice.org.
11166 - * OpenOffice.org is free software: you can redistribute it and/or modify
11167 - * it under the terms of the GNU Lesser General Public License version 3
11168 - * only, as published by the Free Software Foundation.
11170 - * OpenOffice.org is distributed in the hope that it will be useful,
11171 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11172 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11173 - * GNU Lesser General Public License version 3 for more details
11174 - * (a copy is included in the LICENSE file that accompanied this code).
11176 - * You should have received a copy of the GNU Lesser General Public License
11177 - * version 3 along with OpenOffice.org. If not, see
11178 - * <http://www.openoffice.org/license.html>
11179 - * for a copy of the LGPLv3 License.
11181 - ************************************************************************/
11182 -#include "vbaradiobutton.hxx"
11185 -using namespace com::sun::star;
11186 -using namespace ooo::vba;
11189 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
11190 -const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
11191 -ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
11196 -rtl::OUString SAL_CALL
11197 -ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException)
11199 - rtl::OUString Label;
11200 - m_xProps->getPropertyValue( LABEL ) >>= Label;
11205 -ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
11207 - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
11211 -ScVbaRadioButton::getValue() throw (css::uno::RuntimeException)
11213 - sal_Int16 nValue = -1;
11214 - m_xProps->getPropertyValue( STATE ) >>= nValue;
11215 - if( nValue != 0 )
11217 -// return uno::makeAny( nValue );
11218 -// I must be missing something MSO says value should be -1 if selected, 0 if not
11220 - return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False );
11225 -ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
11227 - sal_Int16 nValue = 0;
11228 - sal_Bool bValue = sal_False;
11229 - if( _value >>= nValue )
11231 - if( nValue == -1)
11234 - else if ( _value >>= bValue )
11239 - m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
11243 -ScVbaRadioButton::getServiceImplName()
11245 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") );
11246 - return sImplName;
11249 -uno::Sequence< rtl::OUString >
11250 -ScVbaRadioButton::getServiceNames()
11252 - static uno::Sequence< rtl::OUString > aServiceNames;
11253 - if ( aServiceNames.getLength() == 0 )
11255 - aServiceNames.realloc( 1 );
11256 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) );
11258 - return aServiceNames;
11260 --- sc/source/ui/vba/vbaradiobutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
11261 +++ sc/source/ui/vba/vbaradiobutton.hxx 1970-01-01 00:00:00.000000000 +0000
11263 -/*************************************************************************
11265 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11267 - * Copyright 2008 by Sun Microsystems, Inc.
11269 - * OpenOffice.org - a multi-platform office productivity suite
11271 - * $RCSfile: vbaradiobutton.hxx,v $
11272 - * $Revision: 1.3 $
11274 - * This file is part of OpenOffice.org.
11276 - * OpenOffice.org is free software: you can redistribute it and/or modify
11277 - * it under the terms of the GNU Lesser General Public License version 3
11278 - * only, as published by the Free Software Foundation.
11280 - * OpenOffice.org is distributed in the hope that it will be useful,
11281 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11282 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11283 - * GNU Lesser General Public License version 3 for more details
11284 - * (a copy is included in the LICENSE file that accompanied this code).
11286 - * You should have received a copy of the GNU Lesser General Public License
11287 - * version 3 along with OpenOffice.org. If not, see
11288 - * <http://www.openoffice.org/license.html>
11289 - * for a copy of the LGPLv3 License.
11291 - ************************************************************************/
11292 -#ifndef SC_VBA_RADIOBUTTON_HXX
11293 -#define SC_VBA_RADIOBUTTON_HXX
11294 -#include <ooo/vba/msforms/XRadioButton.hpp>
11295 -#include "vbacontrol.hxx"
11296 -#include "vbahelper.hxx"
11297 -#include <cppuhelper/implbase2.hxx>
11299 -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE;
11301 -class ScVbaRadioButton : public RadioButtonImpl_BASE
11304 - ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
11306 - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
11307 - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
11308 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
11309 - virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException);
11310 - //XHelperInterface
11311 - virtual rtl::OUString& getServiceImplName();
11312 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
11313 - // XDefaultProperty
11314 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
11317 -#endif //SC_VBA_RADIOBUTTON_HXX
11318 --- sc/source/ui/vba/vbarange.cxx.old 2009-04-06 16:42:00.000000000 +0000
11319 +++ sc/source/ui/vba/vbarange.cxx 2009-04-06 16:42:01.000000000 +0000
11321 * for a copy of the LGPLv3 License.
11323 ************************************************************************/
11324 -#include "helperdecl.hxx"
11325 +#include <vbahelper/helperdecl.hxx>
11327 #include <comphelper/unwrapargs.hxx>
11328 #include <comphelper/processfactory.hxx>
11329 @@ -146,7 +146,6 @@
11330 #include "rangelst.hxx"
11331 #include "convuno.hxx"
11332 #include "compiler.hxx"
11333 -#include "formula/grammar.hxx"
11334 #include "attrib.hxx"
11335 #include "undodat.hxx"
11336 #include "dbdocfun.hxx"
11337 @@ -159,7 +158,7 @@
11338 #include "vbaglobals.hxx"
11339 #include "vbastyle.hxx"
11341 -#include <vbacollectionimpl.hxx>
11342 +#include <vbahelper/vbacollectionimpl.hxx>
11343 // begin test includes
11344 #include <com/sun/star/sheet/FunctionArgument.hpp>
11345 // end test includes
11346 @@ -253,7 +252,7 @@ ScCellRangeObj* ScVbaRange::getCellRang
11347 SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException )
11349 ScCellRangeObj* pUnoCellRange = getCellRangeObj();
11350 - SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( pUnoCellRange );
11351 + SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( pUnoCellRange );
11353 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for range" ) ), uno::Reference< uno::XInterface >() );
11355 @@ -470,7 +469,7 @@ public:
11356 if ( pUnoCellRange )
11359 - SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( pUnoCellRange );
11360 + SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( pUnoCellRange );
11361 SfxItemState eState = pDataSet->GetItemState( ATTR_VALUE_FORMAT, TRUE, NULL);
11362 // one of the cells in the range is not like the other ;-)
11363 // so return a zero length format to indicate that
11364 @@ -1999,7 +1998,7 @@ bool cellInRange( const table::CellRange
11366 void setCursor( const SCCOL& nCol, const SCROW& nRow, bool bInSel = true )
11368 - ScTabViewShell* pShell = getCurrentBestViewShell();
11369 + ScTabViewShell* pShell = excel::getCurrentBestViewShell();
11373 @@ -2210,7 +2209,7 @@ ScVbaRange::Copy(const ::uno::Any& Desti
11378 + excel::implnCopy();
11382 @@ -2234,7 +2233,7 @@ ScVbaRange::Cut(const ::uno::Any& Destin
11387 + excel::implnCut();
11391 @@ -2564,7 +2563,7 @@ ScVbaRange::PasteSpecial( const uno::Any
11393 USHORT nFlags = getPasteFlags(nPaste);
11394 USHORT nFormulaBits = getPasteFormulaBits(nOperation);
11395 - implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose);
11396 + excel::implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose);
11397 // restore selection
11398 xSelection->select( uno::makeAny( xSel ) );
11400 @@ -3233,13 +3232,13 @@ ScVbaRange::End( ::sal_Int32 Direction )
11402 // Save ActiveCell pos ( to restore later )
11404 - rtl::OUString sActiveCell = ScVbaGlobals::getGlobalsImpl(
11405 - mxContext )->getApplication()->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
11406 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
11407 + rtl::OUString sActiveCell = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
11409 // position current cell upper left of this range
11410 Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )->Select();
11412 - SfxViewFrame* pViewFrame = getCurrentViewFrame();
11413 + SfxViewFrame* pViewFrame = excel::getCurrentViewFrame();
11416 SfxAllItemSet aArgs( SFX_APP()->GetPool() );
11417 @@ -3275,18 +3274,17 @@ ScVbaRange::End( ::sal_Int32 Direction )
11420 // result is the ActiveCell
11421 - rtl::OUString sMoved = ScVbaGlobals::getGlobalsImpl(
11422 - mxContext )->getApplication()->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
11423 + rtl::OUString sMoved = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
11425 // restore old ActiveCell
11427 - uno::Reference< excel::XRange > xOldActiveCell( ScVbaGlobals::getGlobalsImpl(
11428 - mxContext )->getActiveSheet()->Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW );
11430 + uno::Reference< excel::XRange > xOldActiveCell( xApplication->getActiveSheet()->Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW );
11431 xOldActiveCell->Select();
11433 uno::Reference< excel::XRange > resultCell;
11434 - resultCell.set( ScVbaGlobals::getGlobalsImpl(
11435 - mxContext )->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW );
11437 + resultCell.set( xApplication->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW );
11441 @@ -3749,7 +3747,7 @@ ScVbaRange::setPageBreak( const uno::Any
11442 uno::Reference< frame::XModel > xModel = pShell->GetModel();
11445 - ScTabViewShell* pViewShell = getBestViewShell( xModel );
11446 + ScTabViewShell* pViewShell = excel::getBestViewShell( xModel );
11447 if ( nPageBreak == excel::XlPageBreak::xlPageBreakManual )
11448 pViewShell->InsertPageBreak( bColumn, TRUE, &aAddr);
11449 else if ( nPageBreak == excel::XlPageBreak::xlPageBreakNone )
11450 @@ -4711,7 +4709,7 @@ ScVbaRange::PrintOut( const uno::Any& Fr
11452 xPrintAreas->setPrintAreas( printAreas );
11453 uno::Reference< frame::XModel > xModel = pShell->GetModel();
11454 - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, sal_True );
11455 + PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True );
11459 @@ -5362,7 +5360,8 @@ sal_Bool SAL_CALL
11460 ScVbaRange::hasError() throw (uno::RuntimeException)
11462 double dResult = sal_False;
11463 - uno::Reference< script::XInvocation > xInvoc( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->WorksheetFunction(), uno::UNO_QUERY_THROW );
11464 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
11465 + uno::Reference< script::XInvocation > xInvoc( xApplication->WorksheetFunction(), uno::UNO_QUERY_THROW );
11467 static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("IsError" ) );
11468 uno::Sequence< uno::Any > Params(1);
11469 --- sc/source/ui/vba/vbarange.hxx.old 2009-04-06 16:42:00.000000000 +0000
11470 +++ sc/source/ui/vba/vbarange.hxx 2009-04-06 16:42:01.000000000 +0000
11471 @@ -53,12 +53,15 @@
11472 #include <com/sun/star/sheet/XSpreadsheet.hpp>
11473 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
11475 -//#include "vbahelperinterface.hxx"
11476 +//#include <vbahelper/vbahelperinterface.hxx>
11477 #include "vbaformat.hxx"
11478 +#include <formula/grammar.hxx>
11480 class ScTableSheetsObj;
11481 class ScCellRangesBase;
11482 class ScCellRangeObj;
11486 //typedef InheritedHelperInterfaceImpl1< ov::excel::XRange > ScVbaRange_BASE;
11487 typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE;
11488 --- sc/source/ui/vba/vbascrollbar.cxx.old 2009-04-02 10:45:35.000000000 +0000
11489 +++ sc/source/ui/vba/vbascrollbar.cxx 1970-01-01 00:00:00.000000000 +0000
11491 -/*************************************************************************
11493 - * OpenOffice.org - a multi-platform office productivity suite
11499 - * last change: $Author$ $Date$
11501 - * The Contents of this file are made available subject to
11502 - * the terms of GNU Lesser General Public License Version 2.1.
11505 - * GNU Lesser General Public License Version 2.1
11506 - * =============================================
11507 - * Copyright 2005 by Sun Microsystems, Inc.
11508 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11510 - * This library is free software; you can redistribute it and/or
11511 - * modify it under the terms of the GNU Lesser General Public
11512 - * License version 2.1, as published by the Free Software Foundation.
11514 - * This library is distributed in the hope that it will be useful,
11515 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11516 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11517 - * Lesser General Public License for more details.
11519 - * You should have received a copy of the GNU Lesser General Public
11520 - * License along with this library; if not, write to the Free Software
11521 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
11522 - * MA 02111-1307 USA
11524 - ************************************************************************/
11525 -#include "vbascrollbar.hxx"
11528 -using namespace com::sun::star;
11529 -using namespace ooo::vba;
11532 -const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") );
11533 -const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") );
11534 -const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
11535 -const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") );
11536 -const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") );
11537 -const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") );
11539 -ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
11545 -ScVbaScrollBar::getValue() throw (css::uno::RuntimeException)
11547 - return m_xProps->getPropertyValue( SCROLLVALUE );
11551 -ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
11553 - m_xProps->setPropertyValue( SCROLLVALUE, _value );
11556 -::sal_Int32 SAL_CALL
11557 -ScVbaScrollBar::getMax() throw (uno::RuntimeException)
11559 - sal_Int32 nMax = 0;
11560 - m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax;
11565 -ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
11567 - m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) );
11570 -::sal_Int32 SAL_CALL
11571 -ScVbaScrollBar::getMin() throw (uno::RuntimeException)
11573 - sal_Int32 nVal = 0;
11574 - m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal;
11579 -ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
11581 - m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) );
11585 -ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException)
11587 - m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) );
11590 -::sal_Int32 SAL_CALL
11591 -ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException)
11593 - sal_Int32 nVal = 0;
11594 - m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal;
11598 -::sal_Int32 SAL_CALL
11599 -ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException)
11601 - sal_Int32 nSmallChange = 0;
11602 - m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange;
11603 - return nSmallChange;
11607 -ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException)
11609 - m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) );
11613 -ScVbaScrollBar::getServiceImplName()
11615 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") );
11616 - return sImplName;
11619 -uno::Sequence< rtl::OUString >
11620 -ScVbaScrollBar::getServiceNames()
11622 - static uno::Sequence< rtl::OUString > aServiceNames;
11623 - if ( aServiceNames.getLength() == 0 )
11625 - aServiceNames.realloc( 1 );
11626 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
11628 - return aServiceNames;
11630 --- sc/source/ui/vba/vbascrollbar.hxx.old 2009-04-02 10:45:35.000000000 +0000
11631 +++ sc/source/ui/vba/vbascrollbar.hxx 1970-01-01 00:00:00.000000000 +0000
11633 -/*************************************************************************
11635 - * OpenOffice.org - a multi-platform office productivity suite
11641 - * last change: $Author$ $Date$
11643 - * The Contents of this file are made available subject to
11644 - * the terms of GNU Lesser General Public License Version 2.1.
11647 - * GNU Lesser General Public License Version 2.1
11648 - * =============================================
11649 - * Copyright 2005 by Sun Microsystems, Inc.
11650 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11652 - * This library is free software; you can redistribute it and/or
11653 - * modify it under the terms of the GNU Lesser General Public
11654 - * License version 2.1, as published by the Free Software Foundation.
11656 - * This library is distributed in the hope that it will be useful,
11657 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11658 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11659 - * Lesser General Public License for more details.
11661 - * You should have received a copy of the GNU Lesser General Public
11662 - * License along with this library; if not, write to the Free Software
11663 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
11664 - * MA 02111-1307 USA
11666 - ************************************************************************/
11667 -#ifndef SC_VBA_SCROLLBAR_HXX
11668 -#define SC_VBA_SCROLLBAR_HXX
11669 -#include <cppuhelper/implbase1.hxx>
11670 -#include <ooo/vba/msforms/XScrollBar.hpp>
11672 -#include "vbacontrol.hxx"
11673 -#include "vbahelper.hxx"
11675 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE;
11677 -class ScVbaScrollBar : public ScrollBarImpl_BASE
11680 - ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
11682 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
11683 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
11684 - virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
11685 - virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
11686 - virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
11687 - virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
11688 - virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException);
11689 - virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException);
11690 - virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException);
11691 - virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException);
11694 - //XHelperInterface
11695 - virtual rtl::OUString& getServiceImplName();
11696 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
11698 -#endif //SC_VBA_LABEL_HXX
11699 --- sc/source/ui/vba/vbaseriescollection.hxx.old 2009-04-02 10:45:35.000000000 +0000
11700 +++ sc/source/ui/vba/vbaseriescollection.hxx 2009-04-06 16:42:01.000000000 +0000
11702 #define SC_VBA_SERIESCOLLECTION_HXX
11704 #include <ooo/vba/excel/XSeriesCollection.hpp>
11705 -#include "vbahelperinterface.hxx"
11706 -#include "vbacollectionimpl.hxx"
11707 -#include "vbahelper.hxx"
11708 +#include <vbahelper/vbahelperinterface.hxx>
11709 +#include <vbahelper/vbacollectionimpl.hxx>
11710 +#include "excelvbahelper.hxx"
11713 typedef CollTestImplHelper< ov::excel::XSeriesCollection > SeriesCollection_BASE;
11714 --- sc/source/ui/vba/vbashape.hxx.old 2009-04-02 10:45:35.000000000 +0000
11715 +++ sc/source/ui/vba/vbashape.hxx 2009-04-06 16:42:01.000000000 +0000
11717 #include <ooo/vba/msforms/XLineFormat.hpp>
11718 #include <cppuhelper/implbase2.hxx>
11720 -#include "vbahelperinterface.hxx"
11721 +#include <vbahelper/vbahelperinterface.hxx>
11723 typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
11725 --- sc/source/ui/vba/vbashaperange.cxx.old 2009-04-02 10:45:35.000000000 +0000
11726 +++ sc/source/ui/vba/vbashaperange.cxx 2009-04-06 16:42:01.000000000 +0000
11728 #include <com/sun/star/drawing/XShapeGrouper.hpp>
11729 #include <com/sun/star/drawing/XDrawPage.hpp>
11731 +#include "excelvbahelper.hxx"
11732 #include "vbashaperange.hxx"
11733 #include "vbashape.hxx"
11735 --- sc/source/ui/vba/vbashaperange.hxx.old 2009-04-02 10:45:35.000000000 +0000
11736 +++ sc/source/ui/vba/vbashaperange.hxx 2009-04-06 16:42:01.000000000 +0000
11738 #include <com/sun/star/drawing/XShapes.hpp>
11739 #include <ooo/vba/msforms/XShapeRange.hpp>
11741 -#include "vbacollectionimpl.hxx"
11742 +#include <vbahelper/vbacollectionimpl.hxx>
11744 typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
11746 --- sc/source/ui/vba/vbashapes.cxx.old 2009-04-02 10:45:35.000000000 +0000
11747 +++ sc/source/ui/vba/vbashapes.cxx 2009-04-06 16:42:01.000000000 +0000
11749 #include <ooo/vba/msforms/XShapeRange.hpp>
11750 #include <ooo/vba/office/MsoAutoShapeType.hpp>
11752 +#include "excelvbahelper.hxx"
11753 #include "vbashapes.hxx"
11754 #include "vbashape.hxx"
11755 #include "vbashaperange.hxx"
11756 --- sc/source/ui/vba/vbashapes.hxx.old 2009-04-02 10:45:35.000000000 +0000
11757 +++ sc/source/ui/vba/vbashapes.hxx 2009-04-06 16:42:01.000000000 +0000
11759 #include <com/sun/star/container/XIndexAccess.hpp>
11760 #include <ooo/vba/msforms/XShapes.hpp>
11762 -#include "vbahelperinterface.hxx"
11763 +#include <vbahelper/vbahelperinterface.hxx>
11765 -#include "vbacollectionimpl.hxx"
11766 +#include <vbahelper/vbacollectionimpl.hxx>
11768 typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE;
11770 --- sc/source/ui/vba/vbaspinbutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
11771 +++ sc/source/ui/vba/vbaspinbutton.cxx 1970-01-01 00:00:00.000000000 +0000
11773 -/*************************************************************************
11775 - * OpenOffice.org - a multi-platform office productivity suite
11781 - * last change: $Author$ $Date$
11783 - * The Contents of this file are made available subject to
11784 - * the terms of GNU Lesser General Public License Version 2.1.
11787 - * GNU Lesser General Public License Version 2.1
11788 - * =============================================
11789 - * Copyright 2005 by Sun Microsystems, Inc.
11790 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11792 - * This library is free software; you can redistribute it and/or
11793 - * modify it under the terms of the GNU Lesser General Public
11794 - * License version 2.1, as published by the Free Software Foundation.
11796 - * This library is distributed in the hope that it will be useful,
11797 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11798 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11799 - * Lesser General Public License for more details.
11801 - * You should have received a copy of the GNU Lesser General Public
11802 - * License along with this library; if not, write to the Free Software
11803 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
11804 - * MA 02111-1307 USA
11806 - ************************************************************************/
11807 -#include "vbaspinbutton.hxx"
11810 -using namespace com::sun::star;
11811 -using namespace ooo::vba;
11814 -const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
11815 -const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") );
11816 -const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") );
11817 -const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") );
11819 -ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
11825 -ScVbaSpinButton::getValue() throw (css::uno::RuntimeException)
11827 - return m_xProps->getPropertyValue( SPINVALUE );
11831 -ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
11833 - m_xProps->setPropertyValue( SPINVALUE, _value );
11836 -::sal_Int32 SAL_CALL
11837 -ScVbaSpinButton::getMax() throw (uno::RuntimeException)
11839 - sal_Int32 nMax = 0;
11840 - m_xProps->getPropertyValue( SPINMAX ) >>= nMax;
11845 -ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
11847 - m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) );
11850 -::sal_Int32 SAL_CALL
11851 -ScVbaSpinButton::getMin() throw (uno::RuntimeException)
11853 - sal_Int32 nVal = 0;
11854 - m_xProps->getPropertyValue( SPINMIN ) >>= nVal;
11859 -ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
11861 - m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) );
11865 -ScVbaSpinButton::getServiceImplName()
11867 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") );
11868 - return sImplName;
11871 -uno::Sequence< rtl::OUString >
11872 -ScVbaSpinButton::getServiceNames()
11874 - static uno::Sequence< rtl::OUString > aServiceNames;
11875 - if ( aServiceNames.getLength() == 0 )
11877 - aServiceNames.realloc( 1 );
11878 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
11880 - return aServiceNames;
11882 --- sc/source/ui/vba/vbaspinbutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
11883 +++ sc/source/ui/vba/vbaspinbutton.hxx 1970-01-01 00:00:00.000000000 +0000
11885 -/*************************************************************************
11887 - * OpenOffice.org - a multi-platform office productivity suite
11893 - * last change: $Author$ $Date$
11895 - * The Contents of this file are made available subject to
11896 - * the terms of GNU Lesser General Public License Version 2.1.
11899 - * GNU Lesser General Public License Version 2.1
11900 - * =============================================
11901 - * Copyright 2005 by Sun Microsystems, Inc.
11902 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
11904 - * This library is free software; you can redistribute it and/or
11905 - * modify it under the terms of the GNU Lesser General Public
11906 - * License version 2.1, as published by the Free Software Foundation.
11908 - * This library is distributed in the hope that it will be useful,
11909 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11910 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11911 - * Lesser General Public License for more details.
11913 - * You should have received a copy of the GNU Lesser General Public
11914 - * License along with this library; if not, write to the Free Software
11915 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
11916 - * MA 02111-1307 USA
11918 - ************************************************************************/
11919 -#ifndef SC_VBA_SPINBUTTON_HXX
11920 -#define SC_VBA_SPINBUTTON_HXX
11921 -#include <cppuhelper/implbase1.hxx>
11922 -#include <ooo/vba/msforms/XSpinButton.hpp>
11924 -#include "vbacontrol.hxx"
11925 -#include "vbahelper.hxx"
11927 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE;
11929 -class ScVbaSpinButton : public SpinButtonImpl_BASE
11932 - ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
11934 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
11935 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
11936 - virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
11937 - virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
11938 - virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
11939 - virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
11941 - //XHelperInterface
11942 - virtual rtl::OUString& getServiceImplName();
11943 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
11945 -#endif //SC_VBA_SPINBUTTON_HXX
11946 --- sc/source/ui/vba/vbastyles.cxx.old 2009-04-02 10:45:35.000000000 +0000
11947 +++ sc/source/ui/vba/vbastyles.cxx 2009-04-06 16:42:01.000000000 +0000
11949 ************************************************************************/
11950 #include "vbastyles.hxx"
11951 #include "vbastyle.hxx"
11952 +#include <ooo/vba/excel/XRange.hpp>
11954 using namespace ::ooo::vba;
11955 using namespace ::com::sun::star;
11956 --- sc/source/ui/vba/vbastyles.hxx.old 2009-04-02 10:45:35.000000000 +0000
11957 +++ sc/source/ui/vba/vbastyles.hxx 2009-04-06 16:42:01.000000000 +0000
11959 #define SC_VBA_STYLES_HXX
11960 #include <ooo/vba/excel/XStyles.hpp>
11961 #include <com/sun/star/container/XNameContainer.hpp>
11962 -#include "vbacollectionimpl.hxx"
11963 +#include <vbahelper/vbacollectionimpl.hxx>
11965 typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE;
11966 class ScVbaStyles: public ScVbaStyles_BASE
11967 --- sc/source/ui/vba/vbatextbox.cxx.old 2009-04-02 10:45:35.000000000 +0000
11968 +++ sc/source/ui/vba/vbatextbox.cxx 1970-01-01 00:00:00.000000000 +0000
11970 -/*************************************************************************
11972 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11974 - * Copyright 2008 by Sun Microsystems, Inc.
11976 - * OpenOffice.org - a multi-platform office productivity suite
11978 - * $RCSfile: vbatextbox.cxx,v $
11979 - * $Revision: 1.3 $
11981 - * This file is part of OpenOffice.org.
11983 - * OpenOffice.org is free software: you can redistribute it and/or modify
11984 - * it under the terms of the GNU Lesser General Public License version 3
11985 - * only, as published by the Free Software Foundation.
11987 - * OpenOffice.org is distributed in the hope that it will be useful,
11988 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11989 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11990 - * GNU Lesser General Public License version 3 for more details
11991 - * (a copy is included in the LICENSE file that accompanied this code).
11993 - * You should have received a copy of the GNU Lesser General Public License
11994 - * version 3 along with OpenOffice.org. If not, see
11995 - * <http://www.openoffice.org/license.html>
11996 - * for a copy of the LGPLv3 License.
11998 - ************************************************************************/
11999 -#include <com/sun/star/text/XTextRange.hpp>
12001 -#include "vbatextbox.hxx"
12004 -using namespace com::sun::star;
12005 -using namespace ooo::vba;
12009 -ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
12015 -ScVbaTextBox::getValue() throw (css::uno::RuntimeException)
12017 - return uno::makeAny( getText() );
12021 -ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
12023 - rtl::OUString sVal = getAnyAsString( _value );
12027 -//getString() will cause some imfo lose.
12028 -rtl::OUString SAL_CALL
12029 -ScVbaTextBox::getText() throw (css::uno::RuntimeException)
12032 - aValue = m_xProps->getPropertyValue
12033 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
12034 - rtl::OUString sString;
12035 - aValue >>= sString;
12040 -ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
12044 - uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
12045 - xTextRange->setString( _text );
12048 - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) );
12051 -sal_Int32 SAL_CALL
12052 -ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
12055 - aValue = m_xProps->getPropertyValue
12056 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) );
12057 - sal_Int32 nMaxLength = 0;
12058 - aValue >>= nMaxLength;
12059 - return nMaxLength;
12063 -ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
12065 - uno::Any aValue( _maxlength );
12066 - m_xProps->setPropertyValue
12067 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
12071 -ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException)
12074 - aValue = m_xProps->getPropertyValue
12075 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) );
12076 - sal_Bool bRet = false;
12082 -ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException)
12084 - uno::Any aValue( _multiline );
12085 - m_xProps->setPropertyValue
12086 - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
12090 -ScVbaTextBox::getServiceImplName()
12092 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") );
12093 - return sImplName;
12096 -uno::Sequence< rtl::OUString >
12097 -ScVbaTextBox::getServiceNames()
12099 - static uno::Sequence< rtl::OUString > aServiceNames;
12100 - if ( aServiceNames.getLength() == 0 )
12102 - aServiceNames.realloc( 1 );
12103 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) );
12105 - return aServiceNames;
12107 --- sc/source/ui/vba/vbatextbox.hxx.old 2009-04-02 10:45:35.000000000 +0000
12108 +++ sc/source/ui/vba/vbatextbox.hxx 1970-01-01 00:00:00.000000000 +0000
12110 -/*************************************************************************
12112 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12114 - * Copyright 2008 by Sun Microsystems, Inc.
12116 - * OpenOffice.org - a multi-platform office productivity suite
12118 - * $RCSfile: vbatextbox.hxx,v $
12119 - * $Revision: 1.3 $
12121 - * This file is part of OpenOffice.org.
12123 - * OpenOffice.org is free software: you can redistribute it and/or modify
12124 - * it under the terms of the GNU Lesser General Public License version 3
12125 - * only, as published by the Free Software Foundation.
12127 - * OpenOffice.org is distributed in the hope that it will be useful,
12128 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12129 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12130 - * GNU Lesser General Public License version 3 for more details
12131 - * (a copy is included in the LICENSE file that accompanied this code).
12133 - * You should have received a copy of the GNU Lesser General Public License
12134 - * version 3 along with OpenOffice.org. If not, see
12135 - * <http://www.openoffice.org/license.html>
12136 - * for a copy of the LGPLv3 License.
12138 - ************************************************************************/
12139 -#ifndef SC_VBA_TEXTBOX_HXX
12140 -#define SC_VBA_TEXTBOX_HXX
12141 -#include <cppuhelper/implbase1.hxx>
12142 -#include <ooo/vba/msforms/XTextBox.hpp>
12143 -#include "vbacontrol.hxx"
12144 -#include "vbahelper.hxx"
12146 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
12148 -class ScVbaTextBox : public TextBoxImpl_BASE
12152 - ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false );
12154 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
12155 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
12156 - virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
12157 - virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException);
12158 - virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException);
12159 - virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException);
12160 - virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
12161 - virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
12162 - //XHelperInterface
12163 - virtual rtl::OUString& getServiceImplName();
12164 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
12166 -#endif //SC_VBA_TEXTBOX_HXX
12167 --- sc/source/ui/vba/vbatextboxshape.cxx.old 2009-04-02 10:45:35.000000000 +0000
12168 +++ sc/source/ui/vba/vbatextboxshape.cxx 2009-04-06 16:42:01.000000000 +0000
12169 @@ -62,7 +62,7 @@ ScVbaTextBoxShape::setText( const rtl::O
12170 uno::Reference< excel::XCharacters > SAL_CALL
12171 ScVbaTextBoxShape::characters( const uno::Any& Start, const uno::Any& Length ) throw (uno::RuntimeException)
12173 - ScDocShell* pDocShell = getDocShell( m_xModel );
12174 + ScDocShell* pDocShell = excel::getDocShell( m_xModel );
12175 ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
12178 --- sc/source/ui/vba/vbatextboxshape.hxx.old 2009-04-02 10:45:35.000000000 +0000
12179 +++ sc/source/ui/vba/vbatextboxshape.hxx 2009-04-06 16:42:01.000000000 +0000
12181 #include <com/sun/star/text/XTextRange.hpp>
12182 #include <ooo/vba/msforms/XTextBoxShape.hpp>
12183 #include "vbashape.hxx"
12184 -#include "vbahelper.hxx"
12185 +#include "excelvbahelper.hxx"
12186 #include "vbacharacters.hxx"
12188 typedef cppu::ImplInheritanceHelper1< ScVbaShape, ov::msforms::XTextBoxShape > TextBoxShapeImpl_BASE;
12189 --- sc/source/ui/vba/vbatextframe.hxx.old 2009-04-02 10:45:35.000000000 +0000
12190 +++ sc/source/ui/vba/vbatextframe.hxx 2009-04-06 16:42:01.000000000 +0000
12192 #include <ooo/vba/excel/XCharacters.hpp>
12193 #include <ooo/vba/excel/XTextFrame.hpp>
12195 -#include "vbahelperinterface.hxx"
12196 +#include <vbahelper/vbahelperinterface.hxx>
12197 #include "vbapalette.hxx"
12199 typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE;
12200 --- sc/source/ui/vba/vbatitle.hxx.old 2009-04-02 10:45:35.000000000 +0000
12201 +++ sc/source/ui/vba/vbatitle.hxx 2009-04-06 16:42:01.000000000 +0000
12202 @@ -30,14 +30,15 @@
12203 #ifndef SC_VBA_TITLE_HXX
12204 #define SC_VBA_TITLE_HXX
12206 -#include "vbahelperinterface.hxx"
12207 -#include "vbahelper.hxx"
12208 +#include <vbahelper/vbahelperinterface.hxx>
12209 +#include "excelvbahelper.hxx"
12210 #include "vbainterior.hxx"
12211 #include "vbafont.hxx"
12212 #include "vbapalette.hxx"
12213 #include <com/sun/star/drawing/XShape.hpp>
12214 #include <com/sun/star/beans/XPropertySet.hpp>
12215 #include <ooo/vba/excel/XTitle.hpp>
12216 +#include <ooo/vba/excel/XCharacters.hpp>
12217 #include <basic/sberrors.hxx>
12220 --- sc/source/ui/vba/vbatogglebutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
12221 +++ sc/source/ui/vba/vbatogglebutton.cxx 1970-01-01 00:00:00.000000000 +0000
12223 -/*************************************************************************
12225 - * OpenOffice.org - a multi-platform office productivity suite
12231 - * last change: $Author$ $Date$
12233 - * The Contents of this file are made available subject to
12234 - * the terms of GNU Lesser General Public License Version 2.1.
12237 - * GNU Lesser General Public License Version 2.1
12238 - * =============================================
12239 - * Copyright 2005 by Sun Microsystems, Inc.
12240 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
12242 - * This library is free software; you can redistribute it and/or
12243 - * modify it under the terms of the GNU Lesser General Public
12244 - * License version 2.1, as published by the Free Software Foundation.
12246 - * This library is distributed in the hope that it will be useful,
12247 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12248 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12249 - * Lesser General Public License for more details.
12251 - * You should have received a copy of the GNU Lesser General Public
12252 - * License along with this library; if not, write to the Free Software
12253 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
12254 - * MA 02111-1307 USA
12256 - ************************************************************************/
12257 -#include "vbatogglebutton.hxx"
12260 -using namespace com::sun::star;
12261 -using namespace ooo::vba;
12264 -const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
12265 -const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") );
12266 -const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
12267 -ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
12269 - OSL_TRACE("ScVbaToggleButton(ctor)");
12270 - m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) );
12273 -ScVbaToggleButton::~ScVbaToggleButton()
12275 - OSL_TRACE("~ScVbaToggleButton(dtor)");
12279 -rtl::OUString SAL_CALL
12280 -ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException)
12282 - rtl::OUString Label;
12283 - m_xProps->getPropertyValue( LABEL ) >>= Label;
12288 -ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
12290 - m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
12294 -ScVbaToggleButton::getValue() throw (uno::RuntimeException)
12296 - sal_Int16 nState = 0;
12297 - m_xProps->getPropertyValue( STATE ) >>= nState;
12298 - return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
12302 -ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
12304 - sal_Int16 nState = 0;
12305 - _value >>= nState;
12306 - OSL_TRACE( "nState - %d", nState );
12307 - nState = ( nState == -1 ) ? 1 : 0;
12308 - OSL_TRACE( "nState - %d", nState );
12309 - m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
12313 -ScVbaToggleButton::getServiceImplName()
12315 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") );
12316 - return sImplName;
12319 -uno::Sequence< rtl::OUString >
12320 -ScVbaToggleButton::getServiceNames()
12322 - static uno::Sequence< rtl::OUString > aServiceNames;
12323 - if ( aServiceNames.getLength() == 0 )
12325 - aServiceNames.realloc( 1 );
12326 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) );
12328 - return aServiceNames;
12331 --- sc/source/ui/vba/vbatogglebutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
12332 +++ sc/source/ui/vba/vbatogglebutton.hxx 1970-01-01 00:00:00.000000000 +0000
12334 -/*************************************************************************
12336 - * OpenOffice.org - a multi-platform office productivity suite
12342 - * last change: $Author$ $Date$
12344 - * The Contents of this file are made available subject to
12345 - * the terms of GNU Lesser General Public License Version 2.1.
12348 - * GNU Lesser General Public License Version 2.1
12349 - * =============================================
12350 - * Copyright 2005 by Sun Microsystems, Inc.
12351 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
12353 - * This library is free software; you can redistribute it and/or
12354 - * modify it under the terms of the GNU Lesser General Public
12355 - * License version 2.1, as published by the Free Software Foundation.
12357 - * This library is distributed in the hope that it will be useful,
12358 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12359 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12360 - * Lesser General Public License for more details.
12362 - * You should have received a copy of the GNU Lesser General Public
12363 - * License along with this library; if not, write to the Free Software
12364 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
12365 - * MA 02111-1307 USA
12367 - ************************************************************************/
12368 -#ifndef SC_VBA_TOGGLEBUTTON_HXX
12369 -#define SC_VBA_TOGGLEBUTTON_HXX
12370 -#include <cppuhelper/implbase2.hxx>
12371 -#include <ooo/vba/msforms/XToggleButton.hpp>
12373 -#include "vbacontrol.hxx"
12374 -#include "vbahelper.hxx"
12376 -typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty > ToggleButtonImpl_BASE;
12378 -class ScVbaToggleButton : public ToggleButtonImpl_BASE
12380 - rtl::OUString msDftPropName;
12382 - ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
12383 - ~ScVbaToggleButton();
12385 - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
12386 - virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
12388 - virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
12389 - virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
12390 - //XHelperInterface
12391 - virtual rtl::OUString& getServiceImplName();
12392 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
12393 - // XDefaultProperty
12394 - rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
12396 -#endif //SC_VBA_TOGGLEBUTTON_HXX
12397 --- sc/source/ui/vba/vbauserform.cxx.old 2009-04-02 10:45:35.000000000 +0000
12398 +++ sc/source/ui/vba/vbauserform.cxx 1970-01-01 00:00:00.000000000 +0000
12400 -/*************************************************************************
12402 - * OpenOffice.org - a multi-platform office productivity suite
12408 - * last change: $Author$ $Date$
12410 - * The Contents of this file are made available subject to
12411 - * the terms of GNU Lesser General Public License Version 2.1.
12414 - * GNU Lesser General Public License Version 2.1
12415 - * =============================================
12416 - * Copyright 2005 by Sun Microsystems, Inc.
12417 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
12419 - * This library is free software; you can redistribute it and/or
12420 - * modify it under the terms of the GNU Lesser General Public
12421 - * License version 2.1, as published by the Free Software Foundation.
12423 - * This library is distributed in the hope that it will be useful,
12424 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12425 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12426 - * Lesser General Public License for more details.
12428 - * You should have received a copy of the GNU Lesser General Public
12429 - * License along with this library; if not, write to the Free Software
12430 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
12431 - * MA 02111-1307 USA
12433 - ************************************************************************/
12434 -#include "helperdecl.hxx"
12435 -#include "vbauserform.hxx"
12436 -#include <com/sun/star/awt/XControl.hpp>
12437 -#include <com/sun/star/awt/XControlContainer.hpp>
12438 -#include <com/sun/star/beans/PropertyConcept.hpp>
12439 -#include <basic/sbx.hxx>
12440 -#include <basic/sbstar.hxx>
12441 -#include <basic/sbmeth.hxx>
12442 -#include "unonames.hxx"
12443 -#include "vbacontrols.hxx"
12445 -using namespace ::ooo::vba;
12446 -using namespace ::com::sun::star;
12448 -// some little notes
12449 -// XDialog implementation has the following interesting bits
12450 -// a Controls property ( which is an array of the container controls )
12451 -// each item in the controls array is a XControl, where the model is
12452 -// basically a property bag
12453 -// additionally the XDialog instance has itself a model
12454 -// this model has a ControlModels ( array of models ) property
12455 -// the models in ControlModels can be accessed by name
12456 -// also the XDialog is a XControl ( to access the model above
12458 -ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) : ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), m_pDocShell( 0 ), mbDispose( true )
12460 - m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
12461 - uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
12462 - m_pDocShell = getDocShell( m_xModel );
12463 - m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
12464 - setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
12467 -ScVbaUserForm::~ScVbaUserForm()
12472 -ScVbaUserForm::Show( ) throw (uno::RuntimeException)
12474 - OSL_TRACE("ScVbaUserForm::Show( )");
12476 - if ( m_xDialog.is() )
12477 - aRet = m_xDialog->execute();
12478 - OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet);
12483 - uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW );
12484 - m_xDialog = NULL;
12485 - xComp->dispose();
12486 - mbDispose = false;
12488 - catch( uno::Exception& )
12494 -rtl::OUString SAL_CALL
12495 -ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException)
12497 - rtl::OUString sCaption;
12498 - m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption;
12502 -ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
12504 - m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) );
12508 -ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
12510 - mbDispose = false; // hide not dispose
12511 - if ( m_xDialog.is() )
12512 - m_xDialog->endExecute();
12516 -ScVbaUserForm::RePaint( ) throw (uno::RuntimeException)
12522 -ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException)
12524 - mbDispose = true;
12525 - if ( m_xDialog.is() )
12526 - m_xDialog->endExecute();
12530 -ScVbaUserForm::getServiceImplName()
12532 - static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaUserForm") );
12533 - return sImplName;
12536 -uno::Sequence< rtl::OUString >
12537 -ScVbaUserForm::getServiceNames()
12539 - static uno::Sequence< rtl::OUString > aServiceNames;
12540 - if ( aServiceNames.getLength() == 0 )
12542 - aServiceNames.realloc( 1 );
12543 - aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm" ) );
12545 - return aServiceNames;
12548 -uno::Reference< beans::XIntrospectionAccess > SAL_CALL
12549 -ScVbaUserForm::getIntrospection( ) throw (uno::RuntimeException)
12551 - return uno::Reference< beans::XIntrospectionAccess >();
12555 -ScVbaUserForm::invoke( const ::rtl::OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
12557 - throw uno::RuntimeException(); // unsupported operation
12561 -ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
12563 - uno::Any aObject = getValue( aPropertyName );
12564 - // The Object *must* support XDefaultProperty here because getValue will
12565 - // only return properties that are Objects ( e.g. controls )
12566 - // e.g. Userform1.aControl = something
12567 - // 'aControl' has to support XDefaultProperty to make sense here
12568 - uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW );
12569 - rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName();
12570 - uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) );
12571 - uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW );
12572 - xPropSet->setPropertyValue( aDfltPropName, aValue );
12576 -ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
12578 - uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
12579 - uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
12580 - uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
12581 - ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
12582 - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
12583 - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
12584 - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
12585 - return uno::makeAny( xVBAControl );
12588 -::sal_Bool SAL_CALL
12589 -ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
12591 - return sal_False;
12594 -ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
12596 - uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
12597 - uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) );
12598 - if ( index.hasValue() )
12599 - return uno::makeAny( xControls->Item( index, uno::Any() ) );
12600 - return uno::makeAny( xControls );
12603 -::sal_Bool SAL_CALL
12604 -ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
12606 - uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY );
12607 - OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() );
12608 - if ( xControl.is() )
12610 - uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW );
12611 - sal_Bool bRes = xNameAccess->hasByName( aName );
12612 - OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes );
12615 - return sal_False;
12618 -namespace userform
12620 -namespace sdecl = comphelper::service_decl;
12621 -sdecl::vba_service_class_<ScVbaUserForm, sdecl::with_args<true> > serviceImpl;
12622 -extern sdecl::ServiceDecl const serviceDecl(
12625 - "ooo.vba.excel.UserForm" );
12628 --- sc/source/ui/vba/vbauserform.hxx.old 2009-04-02 10:45:35.000000000 +0000
12629 +++ sc/source/ui/vba/vbauserform.hxx 1970-01-01 00:00:00.000000000 +0000
12631 -/*************************************************************************
12633 - * OpenOffice.org - a multi-platform office productivity suite
12639 - * last change: $Author$ $Date$
12641 - * The Contents of this file are made available subject to
12642 - * the terms of GNU Lesser General Public License Version 2.1.
12645 - * GNU Lesser General Public License Version 2.1
12646 - * =============================================
12647 - * Copyright 2005 by Sun Microsystems, Inc.
12648 - * 901 San Antonio Road, Palo Alto, CA 94303, USA
12650 - * This library is free software; you can redistribute it and/or
12651 - * modify it under the terms of the GNU Lesser General Public
12652 - * License version 2.1, as published by the Free Software Foundation.
12654 - * This library is distributed in the hope that it will be useful,
12655 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12656 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12657 - * Lesser General Public License for more details.
12659 - * You should have received a copy of the GNU Lesser General Public
12660 - * License along with this library; if not, write to the Free Software
12661 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
12662 - * MA 02111-1307 USA
12664 - ************************************************************************/
12665 -#ifndef SC_VBA_USERFORM_HXX
12666 -#define SC_VBA_USERFORM_HXX
12668 -#include <cppuhelper/implbase1.hxx>
12669 -#include <ooo/vba/msforms/XUserForm.hpp>
12670 -#include <com/sun/star/awt/XDialog.hpp>
12671 -#include <com/sun/star/frame/XModel.hpp>
12673 -#include "vbahelperinterface.hxx"
12674 -#include "vbacontrol.hxx"
12676 -//typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE;
12677 -typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XUserForm > ScVbaUserForm_BASE;
12679 -class ScVbaUserForm : public ScVbaUserForm_BASE
12682 - css::uno::Reference< css::awt::XDialog > m_xDialog;
12683 - ScDocShell* m_pDocShell;
12687 - ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
12688 - virtual ~ScVbaUserForm();
12690 - virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
12691 - virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
12692 - // XIntrospection
12693 - virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
12694 - virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
12695 - virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
12696 - virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
12697 - virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
12698 - virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
12699 - virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException);
12700 - virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException);
12701 - virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException);
12702 - virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException);
12703 - virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException);
12704 - //XHelperInterface
12705 - virtual rtl::OUString& getServiceImplName();
12706 - virtual css::uno::Sequence<rtl::OUString> getServiceNames();
12709 --- sc/source/ui/vba/vbavalidation.hxx.old 2009-04-02 10:45:35.000000000 +0000
12710 +++ sc/source/ui/vba/vbavalidation.hxx 2009-04-06 16:42:01.000000000 +0000
12712 #include <com/sun/star/uno/XComponentContext.hpp>
12713 #include <ooo/vba/excel/XValidation.hpp>
12714 #include <com/sun/star/table/XCellRange.hpp>
12715 -#include "vbahelperinterface.hxx"
12716 +#include <vbahelper/vbahelperinterface.hxx>
12718 typedef InheritedHelperInterfaceImpl1<ov::excel::XValidation > ValidationImpl_BASE;
12720 --- sc/source/ui/vba/vbawindow.cxx.old 2009-04-02 10:45:35.000000000 +0000
12721 +++ sc/source/ui/vba/vbawindow.cxx 2009-04-06 16:42:01.000000000 +0000
12722 @@ -27,10 +27,11 @@
12723 * for a copy of the LGPLv3 License.
12725 ************************************************************************/
12726 -#include "helperdecl.hxx"
12727 +#include <vbahelper/helperdecl.hxx>
12728 #include "vbawindow.hxx"
12729 #include "vbaworksheets.hxx"
12730 #include "vbaworksheet.hxx"
12731 +#include "vbaglobals.hxx"
12732 #include "vbapane.hxx"
12733 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
12734 #include <com/sun/star/sheet/XSpreadsheet.hpp>
12735 @@ -118,7 +119,7 @@ public:
12736 ScDocShell* pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
12738 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain docshell" ) ), uno::Reference< uno::XInterface >() );
12739 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12740 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12742 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() );
12744 @@ -202,14 +203,13 @@ public:
12748 -ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext ), m_xModel( xModel )
12749 +ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel )
12754 ScVbaWindow::ScVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
12755 - : WindowImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ),
12756 - m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
12757 + : WindowImpl_BASE( args, xContext )
12761 @@ -306,8 +306,7 @@ ScVbaWindow::getCaption() throw (uno::Ru
12762 if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() )
12764 sTitle = sTitle.copy( 0, nCrudIndex );
12765 - uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5
12766 - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
12767 + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
12768 rtl::OUString sName = workbook.getName();
12769 // rather bizare hack to make sure the name behavior
12771 @@ -343,7 +342,7 @@ uno::Any SAL_CALL
12772 ScVbaWindow::getScrollRow() throw (uno::RuntimeException)
12774 sal_Int32 nValue = 0;
12775 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12776 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12779 ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
12780 @@ -356,7 +355,7 @@ ScVbaWindow::getScrollRow() throw (uno::
12782 ScVbaWindow::setScrollRow( const uno::Any& _scrollrow ) throw (uno::RuntimeException)
12784 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12785 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12788 sal_Int32 scrollRow = 0;
12789 @@ -371,7 +370,7 @@ uno::Any SAL_CALL
12790 ScVbaWindow::getScrollColumn() throw (uno::RuntimeException)
12792 sal_Int32 nValue = 0;
12793 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12794 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12797 ScSplitPos eWhich = pViewShell->GetViewData()->GetActivePart();
12798 @@ -384,7 +383,7 @@ ScVbaWindow::getScrollColumn() throw (un
12800 ScVbaWindow::setScrollColumn( const uno::Any& _scrollcolumn ) throw (uno::RuntimeException)
12802 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12803 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12806 sal_Int32 scrollColumn = 0;
12807 @@ -399,7 +398,7 @@ uno::Any SAL_CALL
12808 ScVbaWindow::getWindowState() throw (uno::RuntimeException)
12810 sal_Int32 nwindowState = xlNormal;
12811 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12812 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12813 SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
12814 SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
12816 @@ -421,7 +420,7 @@ ScVbaWindow::setWindowState( const uno::
12818 sal_Int32 nwindowState = xlMaximized;
12819 _windowstate >>= nwindowState;
12820 - ScTabViewShell* pViewShell = getBestViewShell( m_xModel );
12821 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12822 SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
12823 SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
12825 @@ -444,8 +443,7 @@ ScVbaWindow::setWindowState( const uno::
12827 ScVbaWindow::Activate() throw (css::uno::RuntimeException)
12829 - uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5
12830 - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
12831 + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
12833 workbook.Activate();
12835 @@ -453,8 +451,7 @@ ScVbaWindow::Activate() throw (css::uno:
12837 ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException)
12839 - uno::Reference< ov::XGlobals > xTemp( ScVbaGlobals::getGlobalsImpl( mxContext )); // temporary needed for g++ 3.3.5
12840 - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( xTemp->getApplication(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
12841 + ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
12842 workbook.Close(SaveChanges, FileName, RouteWorkBook );
12845 @@ -467,13 +464,15 @@ ScVbaWindow::ActivePane() throw (script:
12846 uno::Reference< excel::XRange > SAL_CALL
12847 ScVbaWindow::ActiveCell( ) throw (script::BasicErrorException, uno::RuntimeException)
12849 - return ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->getActiveCell();
12850 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
12851 + return xApplication->getActiveCell();
12855 ScVbaWindow::Selection( ) throw (script::BasicErrorException, uno::RuntimeException)
12857 - return ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->getSelection();
12858 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
12859 + return xApplication->getSelection();
12862 ::sal_Bool SAL_CALL
12863 @@ -759,7 +758,8 @@ ScVbaWindow::setZoom( const uno::Any& _z
12864 uno::Reference< excel::XWorksheet > SAL_CALL
12865 ScVbaWindow::ActiveSheet( ) throw (script::BasicErrorException, uno::RuntimeException)
12867 - return ScVbaGlobals::getGlobalsImpl(mxContext)->getApplication()->getActiveSheet();
12868 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
12869 + return xApplication->getActiveSheet();
12873 @@ -787,121 +787,9 @@ ScVbaWindow::setView( const uno::Any& _v
12875 DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
12877 - dispatchExecute( m_xModel, nSlot );
12881 -ScVbaWindow::getVisible() throw (uno::RuntimeException)
12883 - sal_Bool bVisible = sal_True;
12884 - uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
12885 - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
12886 - uno::Reference< css::awt::XWindow2 > xWindow2 (xWindow, uno::UNO_QUERY_THROW );
12887 - if( xWindow2.is() )
12889 - bVisible = xWindow2->isVisible();
12895 -ScVbaWindow::setVisible(sal_Bool _visible) throw (uno::RuntimeException)
12897 - uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
12898 - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
12899 - if( xWindow.is() )
12901 - xWindow->setVisible( _visible );
12905 -css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel )
12907 - css::awt::Rectangle aRect;
12908 - uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
12909 - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
12910 - if( xWindow.is() )
12912 - aRect = xWindow->getPosSize();
12917 -void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, USHORT nFlag )
12919 - uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
12920 - uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
12921 - if( xWindow.is() )
12923 - css::awt::Rectangle aRect = xWindow->getPosSize();
12926 - case css::awt::PosSize::X:
12927 - xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X );
12929 - case css::awt::PosSize::Y:
12930 - xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y );
12932 - case css::awt::PosSize::WIDTH:
12933 - xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH );
12935 - case css::awt::PosSize::HEIGHT:
12936 - xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT );
12944 -sal_Int32 SAL_CALL
12945 -ScVbaWindow::getHeight() throw (uno::RuntimeException)
12947 - css::awt::Rectangle aRect = getPosSize(m_xModel);
12948 - return aRect.Height;
12952 -ScVbaWindow::setHeight( sal_Int32 _height ) throw (uno::RuntimeException)
12954 - setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT);
12957 -sal_Int32 SAL_CALL
12958 -ScVbaWindow::getLeft() throw (uno::RuntimeException)
12960 - css::awt::Rectangle aRect = getPosSize(m_xModel);
12965 -ScVbaWindow::setLeft( sal_Int32 _left ) throw (uno::RuntimeException)
12967 - setPosSize(m_xModel, _left, css::awt::PosSize::X);
12969 -sal_Int32 SAL_CALL
12970 -ScVbaWindow::getTop() throw (uno::RuntimeException)
12972 - css::awt::Rectangle aRect = getPosSize(m_xModel);
12977 -ScVbaWindow::setTop( sal_Int32 _top ) throw (uno::RuntimeException)
12979 - setPosSize(m_xModel, _top, css::awt::PosSize::Y);
12981 -sal_Int32 SAL_CALL
12982 -ScVbaWindow::getWidth() throw (uno::RuntimeException)
12984 - css::awt::Rectangle aRect = getPosSize(m_xModel);
12985 - return aRect.Width;
12989 -ScVbaWindow::setWidth( sal_Int32 _width ) throw (uno::RuntimeException)
12991 - setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH);
12992 + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
12993 + if ( pViewShell )
12994 + dispatchExecute( pViewShell, nSlot );
12998 @@ -924,14 +812,14 @@ void SAL_CALL
12999 ScVbaWindow::PrintOut( const css::uno::Any& From, const css::uno::Any&To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
13001 // need test, print current active sheet
13002 - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, m_xModel, sal_True );
13003 + PrintOutHelper( excel::getBestViewShell( m_xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, sal_True );
13007 ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
13009 // need test, print preview current active sheet
13010 - PrintPreviewHelper( EnableChanges, m_xModel );
13011 + PrintPreviewHelper( EnableChanges, excel::getBestViewShell( m_xModel ) );
13015 --- sc/source/ui/vba/vbawindow.hxx.old 2009-04-02 10:45:35.000000000 +0000
13016 +++ sc/source/ui/vba/vbawindow.hxx 2009-04-06 16:42:01.000000000 +0000
13017 @@ -39,15 +39,16 @@
13018 #include <ooo/vba/excel/XPane.hpp>
13019 #include <com/sun/star/awt/XDevice.hpp>
13021 -#include "vbahelperinterface.hxx"
13022 +#include <vbahelper/vbahelperinterface.hxx>
13023 +#include <vbahelper/vbawindowbase.hxx>
13024 #include "vbaworkbook.hxx"
13026 -typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > WindowImpl_BASE;
13027 +//typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > WindowImpl_BASE;
13028 +typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::excel::XWindow > WindowImpl_BASE;
13030 class ScVbaWindow : public WindowImpl_BASE
13033 - css::uno::Reference< css::frame::XModel > m_xModel;
13034 css::uno::Reference< css::sheet::XViewPane > m_xViewPane;
13035 css::uno::Reference< css::sheet::XViewFreezable > m_xViewFreezable;
13036 css::uno::Reference< css::sheet::XViewSplitable > m_xViewSplitable;
13037 @@ -82,10 +83,6 @@ public:
13038 virtual void SAL_CALL setDisplayWorkbookTabs( ::sal_Bool _bDisplayWorkbookTabs ) throw (css::uno::RuntimeException);
13039 virtual ::sal_Bool SAL_CALL getFreezePanes() throw (css::uno::RuntimeException);
13040 virtual void SAL_CALL setFreezePanes( ::sal_Bool _bFreezePanes ) throw (css::uno::RuntimeException);
13041 - virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ;
13042 - virtual void SAL_CALL setHeight( sal_Int32 _height ) throw (css::uno::RuntimeException) ;
13043 - virtual sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException) ;
13044 - virtual void SAL_CALL setLeft( sal_Int32 _left ) throw (css::uno::RuntimeException) ;
13045 virtual ::sal_Bool SAL_CALL getSplit() throw (css::uno::RuntimeException);
13046 virtual void SAL_CALL setSplit( ::sal_Bool _bSplit ) throw (css::uno::RuntimeException);
13047 virtual sal_Int32 SAL_CALL getSplitColumn() throw (css::uno::RuntimeException) ;
13048 @@ -100,14 +97,8 @@ public:
13049 virtual void SAL_CALL setScrollRow( const css::uno::Any& _scrollrow ) throw (css::uno::RuntimeException) ;
13050 virtual css::uno::Any SAL_CALL getScrollColumn() throw (css::uno::RuntimeException) ;
13051 virtual void SAL_CALL setScrollColumn( const css::uno::Any& _scrollcolumn ) throw (css::uno::RuntimeException) ;
13052 - virtual sal_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ;
13053 - virtual void SAL_CALL setTop( sal_Int32 _top ) throw (css::uno::RuntimeException) ;
13054 virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException);
13055 virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException);
13056 - virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
13057 - virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
13058 - virtual sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException) ;
13059 - virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ;
13060 virtual css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
13061 virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
13062 virtual css::uno::Any SAL_CALL getZoom() throw (css::uno::RuntimeException);
13063 --- sc/source/ui/vba/vbawindows.cxx.old 2009-04-02 10:45:35.000000000 +0000
13064 +++ sc/source/ui/vba/vbawindows.cxx 2009-04-06 16:42:01.000000000 +0000
13067 #include <tools/urlobj.hxx>
13068 #include "vbawindow.hxx"
13069 +#include "vbaglobals.hxx"
13070 //#include "vbaworkbook.hxx"
13072 using namespace ::com::sun::star;
13073 @@ -47,15 +48,15 @@ sal_Int32, ::rtl::OUStringHash,
13074 ::std::equal_to< ::rtl::OUString > > NameIndexHash;
13077 -uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext )
13078 +uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication )
13080 - return new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel );
13081 + return new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
13084 -uno::Any ComponentToWindow( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext )
13085 +uno::Any ComponentToWindow( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext, const uno::Any& aApplication )
13087 uno::Reference< frame::XModel > xModel( aSource, uno::UNO_QUERY_THROW );
13088 - uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext ), xContext,xModel ) );
13089 + uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext, aApplication ), xContext,xModel ) );
13090 return uno::makeAny( xWin );
13093 @@ -108,12 +109,13 @@ public:
13095 class WindowEnumImpl : public WindowComponentEnumImpl
13097 + uno::Any m_aApplication;
13099 - WindowEnumImpl(const uno::Reference< uno::XComponentContext >& xContext, const Components& components ):WindowComponentEnumImpl( xContext, components ) {}
13100 - WindowEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ): WindowComponentEnumImpl( xContext ) {}
13101 + WindowEnumImpl(const uno::Reference< uno::XComponentContext >& xContext, const Components& components, const uno::Any& aApplication ):WindowComponentEnumImpl( xContext, components ), m_aApplication( aApplication ){}
13102 + WindowEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication ): WindowComponentEnumImpl( xContext ), m_aApplication( aApplication ) {}
13103 virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
13105 - return ComponentToWindow( WindowComponentEnumImpl::nextElement(), m_xContext );
13106 + return ComponentToWindow( WindowComponentEnumImpl::nextElement(), m_xContext, m_aApplication );
13110 @@ -212,16 +214,19 @@ ScVbaWindows::ScVbaWindows( const uno::R
13114 +ScVbaWindows::ScVbaWindows( const uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWindows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess > ( new WindowsAccessImpl( xContext ) ) )
13117 uno::Reference< container::XEnumeration >
13118 ScVbaWindows::createEnumeration() throw (uno::RuntimeException)
13120 - return new WindowEnumImpl( mxContext );
13121 + return new WindowEnumImpl( mxContext, Application() );
13125 ScVbaWindows::createCollectionObject( const css::uno::Any& aSource )
13127 - return ComponentToWindow( aSource, mxContext );
13128 + return ComponentToWindow( aSource, mxContext, Application() );
13132 @@ -230,12 +235,6 @@ ScVbaWindows::getElementType() throw (un
13133 return excel::XWindows::static_type(0);
13136 -uno::Reference< XCollection >
13137 -ScVbaWindows::Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext )
13139 - uno::Reference< container::XIndexAccess > xIndex( new WindowsAccessImpl( xContext ) );
13140 - return new ScVbaWindows( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext , xIndex );
13144 ScVbaWindows::Arrange( ::sal_Int32 /*ArrangeStyle*/, const uno::Any& /*ActiveWorkbook*/, const uno::Any& /*SyncHorizontal*/, const uno::Any& /*SyncVertical*/ ) throw (uno::RuntimeException)
13145 --- sc/source/ui/vba/vbawindows.hxx.old 2009-04-02 10:45:35.000000000 +0000
13146 +++ sc/source/ui/vba/vbawindows.hxx 2009-04-06 16:42:01.000000000 +0000
13149 #include <com/sun/star/uno/XComponentContext.hpp>
13151 -#include "vbahelper.hxx"
13152 -#include "vbacollectionimpl.hxx"
13153 +#include "excelvbahelper.hxx"
13154 +#include <vbahelper/vbacollectionimpl.hxx>
13157 typedef CollTestImplHelper< ov::excel::XWindows > ScVbaWindows_BASE;
13158 @@ -45,6 +45,7 @@ class ScVbaWindows : public ScVbaWindows
13161 ScVbaWindows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
13162 + ScVbaWindows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext );
13163 virtual ~ScVbaWindows() {}
13165 // XEnumerationAccess
13166 @@ -57,8 +58,6 @@ public:
13167 // ScVbaCollectionBaseImpl
13168 virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
13170 - static css::uno::Reference< ov::XCollection > Windows( const css::uno::Reference< css::uno::XComponentContext >& xContext );
13172 // XHelperInterface
13173 virtual rtl::OUString& getServiceImplName();
13174 virtual css::uno::Sequence<rtl::OUString> getServiceNames();
13175 --- sc/source/ui/vba/vbaworkbook.cxx.old 2009-04-02 10:45:35.000000000 +0000
13176 +++ sc/source/ui/vba/vbaworkbook.cxx 2009-04-06 16:42:01.000000000 +0000
13178 * for a copy of the LGPLv3 License.
13180 ************************************************************************/
13181 -#include "helperdecl.hxx"
13182 +#include <vbahelper/helperdecl.hxx>
13183 #include <tools/urlobj.hxx>
13184 #include <comphelper/unwrapargs.hxx>
13187 #include "vbaworkbook.hxx"
13188 #include "vbawindows.hxx"
13189 #include "vbastyles.hxx"
13190 -#include "vbahelper.hxx"
13191 +#include "excelvbahelper.hxx"
13192 #include "vbapalette.hxx"
13193 #include <osl/file.hxx>
13195 @@ -192,7 +192,7 @@ ScVbaWorkbook::init()
13196 if ( !ColorData.getLength() )
13199 -ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext) :ScVbaWorkbook_BASE( xParent, xContext ), mxModel(NULL)
13200 +ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext) :ScVbaWorkbook_BASE( xParent, xContext )
13202 //#FIXME this persists the color data per office instance and
13203 // not per workbook instance, need to hook the data into XModel
13204 @@ -203,54 +203,18 @@ ScVbaWorkbook::ScVbaWorkbook( const css
13208 -ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > xModel ) : ScVbaWorkbook_BASE( xParent, xContext ), mxModel( xModel )
13209 +ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::frame::XModel > xModel ) : ScVbaWorkbook_BASE( xParent, xContext, xModel )
13214 ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
13215 - uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
13216 + uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( args, xContext )
13223 -ScVbaWorkbook::getName() throw (uno::RuntimeException)
13225 - rtl::OUString sName = getModel()->getURL();
13226 - if ( sName.getLength() )
13229 - INetURLObject aURL( getModel()->getURL() );
13230 - ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
13234 - const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) );
13235 - // process "UntitledX - $(PRODUCTNAME)"
13236 - uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
13237 - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
13238 - xProps->getPropertyValue(sTitle ) >>= sName;
13239 - sal_Int32 pos = 0;
13240 - sName = sName.getToken(0,' ',pos);
13245 -ScVbaWorkbook::getPath() throw (uno::RuntimeException)
13247 - INetURLObject aURL( getModel()->getURL() );
13248 - aURL.CutLastName();
13249 - return aURL.GetURLPath();
13253 -ScVbaWorkbook::getFullName() throw (uno::RuntimeException)
13255 - INetURLObject aURL( getModel()->getURL() );
13256 - return aURL.GetURLPath();
13258 uno::Reference< excel::XWorksheet >
13259 ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException)
13261 @@ -281,91 +245,19 @@ ScVbaWorkbook::Worksheets( const uno::An
13263 ScVbaWorkbook::Windows( const uno::Any& aIndex ) throw (uno::RuntimeException)
13265 - uno::Reference< XCollection > xWindows = ScVbaWindows::Windows( mxContext );
13267 + uno::Reference< excel::XWindows > xWindows( new ScVbaWindows( getParent(), mxContext ) );
13268 if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
13269 return uno::Any( xWindows );
13270 return uno::Any( xWindows->Item( aIndex, uno::Any() ) );
13273 -ScVbaWorkbook::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
13274 - const uno::Any &rRouteArg ) throw (uno::RuntimeException)
13276 - sal_Bool bSaveChanges = sal_False;
13277 - rtl::OUString aFileName;
13278 - sal_Bool bRouteWorkbook = sal_True;
13280 - rSaveArg >>= bSaveChanges;
13281 - sal_Bool bFileName = ( rFileArg >>= aFileName );
13282 - rRouteArg >>= bRouteWorkbook;
13283 - uno::Reference< frame::XStorable > xStorable( getModel(), uno::UNO_QUERY_THROW );
13284 - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
13286 - if( bSaveChanges )
13288 - if( xStorable->isReadonly() )
13290 - throw uno::RuntimeException(::rtl::OUString(
13291 - RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ),
13292 - uno::Reference< XInterface >() );
13295 - xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) );
13297 - xStorable->store();
13300 - xModifiable->setModified( false );
13302 - uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY );
13304 - if( xCloseable.is() )
13305 - // use close(boolean DeliverOwnership)
13307 - // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may
13308 - // assume ownership if they object the closure by throwing a CloseVetoException
13309 - // Here we give up ownership. To be on the safe side, catch possible veto exception anyway.
13310 - xCloseable->close(sal_True);
13311 - // If close is not supported by this model - try to dispose it.
13312 - // But if the model disagree with a reset request for the modify state
13313 - // we shouldn't do so. Otherwhise some strange things can happen.
13316 - uno::Reference< lang::XComponent > xDisposable ( getCurrentDocument(), uno::UNO_QUERY );
13317 - if ( xDisposable.is() )
13318 - xDisposable->dispose();
13323 -ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
13325 +ScVbaWorkbook::Activate() throw (uno::RuntimeException)
13327 - rtl::OUString rPassword;
13328 - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
13329 - SC_VBA_FIXME(("Workbook::Protect stub"));
13330 - if( aPassword >>= rPassword )
13331 - xProt->protect( rPassword );
13333 - xProt->protect( rtl::OUString() );
13334 + VbaDocumentBase::Activate();
13338 -ScVbaWorkbook::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
13340 - rtl::OUString rPassword;
13341 - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
13342 - if( !getProtectStructure() )
13343 - throw uno::RuntimeException(::rtl::OUString(
13344 - RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ),
13345 - uno::Reference< XInterface >() );
13348 - if( aPassword >>= rPassword )
13349 - xProt->unprotect( rPassword );
13351 - xProt->unprotect( rtl::OUString() );
13356 ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
13358 @@ -373,28 +265,6 @@ ScVbaWorkbook::getProtectStructure() thr
13359 return xProt->isProtected();
13363 -ScVbaWorkbook::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
13365 - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
13366 - xModifiable->setModified( bSave );
13370 -ScVbaWorkbook::getSaved() throw (uno::RuntimeException)
13372 - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
13373 - return xModifiable->isModified();
13377 -ScVbaWorkbook::Save() throw (uno::RuntimeException)
13379 - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save"));
13380 - uno::Reference< frame::XModel > xModel = getModel();
13381 - dispatchRequests(xModel,url);
13385 ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::RuntimeException)
13387 @@ -407,13 +277,6 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OU
13388 xStor->storeToURL( aURL, storeProps );
13392 -ScVbaWorkbook::Activate() throw (uno::RuntimeException)
13394 - uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
13395 - xFrame->activate();
13398 css::uno::Any SAL_CALL
13399 ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException)
13401 @@ -465,7 +328,7 @@ ScVbaWorkbook::getCodeName() throw (css:
13403 #ifdef VBA_OOBUILD_HACK
13404 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
13405 - ScDocument* pDoc = getDocShell( xModel )->GetDocument();
13406 + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
13407 ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
13408 ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
13409 ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName;
13410 @@ -479,7 +342,7 @@ void SAL_CALL
13411 ScVbaWorkbook::setCodeName( const ::rtl::OUString& sGlobCodeName ) throw (css::uno::RuntimeException)
13413 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
13414 - ScDocument* pDoc = getDocShell( xModel )->GetDocument();
13415 + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
13416 ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
13417 ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
13418 pExtSettings.maGlobCodeName = sGlobCodeName;
13419 --- sc/source/ui/vba/vbaworkbook.hxx.old 2009-04-02 10:45:35.000000000 +0000
13420 +++ sc/source/ui/vba/vbaworkbook.hxx 2009-04-06 16:42:01.000000000 +0000
13421 @@ -32,21 +32,20 @@
13423 #include <com/sun/star/frame/XModel.hpp>
13424 #include <ooo/vba/excel/XWorkbook.hpp>
13425 -#include "vbahelperinterface.hxx"
13426 +#include <vbahelper/vbahelperinterface.hxx>
13427 +#include <vbahelper/vbadocumentbase.hxx>
13431 -typedef InheritedHelperInterfaceImpl1< ov::excel::XWorkbook > ScVbaWorkbook_BASE;
13432 +typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ov::excel::XWorkbook > ScVbaWorkbook_BASE;
13434 class ScVbaWorkbook : public ScVbaWorkbook_BASE
13436 - css::uno::Reference< css::frame::XModel > mxModel;
13437 static css::uno::Sequence< sal_Int32 > ColorData;
13438 void initColorData( const css::uno::Sequence< sal_Int32 >& sColors );
13442 - virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
13443 ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
13445 ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
13446 @@ -55,25 +54,14 @@ public:
13447 virtual ~ScVbaWorkbook() {}
13450 - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
13451 - virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
13452 - virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException);
13453 virtual ::sal_Bool SAL_CALL getProtectStructure() throw (css::uno::RuntimeException);
13454 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
13455 - virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException);
13456 - virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
13459 virtual css::uno::Any SAL_CALL Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
13460 virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
13461 virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
13462 - virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
13463 - const css::uno::Any &aFileName,
13464 - const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
13465 - virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
13466 - virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
13467 - virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
13468 - virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
13469 + virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
13471 virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
13473 --- sc/source/ui/vba/vbaworkbooks.cxx.old 2009-04-02 10:45:35.000000000 +0000
13474 +++ sc/source/ui/vba/vbaworkbooks.cxx 2009-04-06 16:42:01.000000000 +0000
13476 #include "vbaglobals.hxx"
13477 #include "vbaworkbook.hxx"
13478 #include "vbaworkbooks.hxx"
13479 -#include "vbahelper.hxx"
13480 +#include <vbahelper/vbahelper.hxx>
13482 #include <hash_map>
13483 #include <osl/file.hxx>
13484 @@ -74,14 +74,14 @@ typedef std::vector < uno::Reference< sh
13485 typedef ::cppu::WeakImplHelper1< container::XEnumeration > SpreadSheetDocEnumImpl_BASE;
13488 -getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc )
13489 +getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc, const uno::Any& aApplication )
13491 // FIXME: fine as long as ScVbaWorkbook is stateless ...
13492 uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
13496 - ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< XHelperInterface >( ScVbaGlobals::getGlobalsImpl( xContext )->getApplication(), uno::UNO_QUERY_THROW ), xContext, xModel );
13497 + ScVbaWorkbook *pWb = new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
13498 return uno::Any( uno::Reference< excel::XWorkbook > (pWb) );
13501 @@ -134,13 +134,14 @@ public:
13503 class WorkBookEnumImpl : public EnumerationHelperImpl
13505 + uno::Any m_aApplication;
13507 - WorkBookEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ){}
13508 + WorkBookEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_aApplication( aApplication ) {}
13510 virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
13512 uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
13513 - return getWorkbook( m_xContext, xDoc );
13514 + return getWorkbook( m_xContext, xDoc, m_aApplication );
13518 @@ -254,14 +255,14 @@ ScVbaWorkbooks::createEnumeration() thro
13519 // the state of this object ( although it should ) would be
13520 // safer to create an enumeration based on this objects state
13521 // rather than one effectively based of the desktop component
13522 - return new WorkBookEnumImpl( mxContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(mxContext) ) );
13523 + return new WorkBookEnumImpl( mxContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(mxContext) ), Application() );
13527 ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
13529 uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY );
13530 - return getWorkbook( mxContext, xDoc );
13531 + return getWorkbook( mxContext, xDoc, Application() );
13535 @@ -282,7 +283,7 @@ ScVbaWorkbooks::Add() throw (uno::Runtim
13536 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
13538 if( xSpreadDoc.is() )
13539 - return getWorkbook( mxContext, xSpreadDoc );
13540 + return getWorkbook( mxContext, xSpreadDoc, Application() );
13544 @@ -438,7 +439,7 @@ ScVbaWorkbooks::Open( const rtl::OUStrin
13545 frame::FrameSearchFlag::CREATE,
13547 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
13548 - uno::Any aRet = getWorkbook( mxContext, xSpreadDoc );
13549 + uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, Application() );
13550 uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
13552 xWBook->Activate();
13553 --- sc/source/ui/vba/vbaworkbooks.hxx.old 2009-04-02 10:45:35.000000000 +0000
13554 +++ sc/source/ui/vba/vbaworkbooks.hxx 2009-04-06 16:42:01.000000000 +0000
13555 @@ -31,11 +31,10 @@
13556 #define SC_VBA_WORKBOOKS_HXX
13559 -#include "vbacollectionimpl.hxx"
13560 -#include <ooo/vba/XGlobals.hpp>
13561 +#include <vbahelper/vbacollectionimpl.hxx>
13562 #include <ooo/vba/excel/XWorkbooks.hpp>
13563 #include <com/sun/star/container/XEnumerationAccess.hpp>
13564 -#include "vbahelper.hxx"
13565 +#include "excelvbahelper.hxx"
13569 @@ -45,7 +44,6 @@ typedef CollTestImplHelper< ov::excel::X
13570 class ScVbaWorkbooks : public ScVbaWorkbooks_BASE
13573 - css::uno::Reference< ov::XGlobals > getGlobals() throw (css::uno::RuntimeException);
13574 rtl::OUString getFileFilterType( const rtl::OUString& rString );
13575 bool isTextFile( const rtl::OUString& rString );
13576 bool isSpreadSheetFile( const rtl::OUString& rString );
13577 --- sc/source/ui/vba/vbaworksheet.cxx.old 2009-04-06 16:42:00.000000000 +0000
13578 +++ sc/source/ui/vba/vbaworksheet.cxx 2009-04-06 16:42:01.000000000 +0000
13580 * for a copy of the LGPLv3 License.
13582 ************************************************************************/
13583 -#include "helperdecl.hxx"
13584 +#include <vbahelper/helperdecl.hxx>
13585 #include <cppuhelper/queryinterface.hxx>
13587 #include <com/sun/star/beans/XPropertySet.hpp>
13589 #include <com/sun/star/form/FormComponentType.hpp>
13590 #include <com/sun/star/form/XFormsSupplier.hpp>
13591 #include <ooo/vba/excel/XlEnableSelection.hpp>
13592 +#include <ooo/vba/XControlProvider.hpp>
13594 #include <comphelper/processfactory.hxx>
13597 #include "vbaworksheet.hxx"
13598 #include "vbachartobjects.hxx"
13599 #include "vbapivottables.hxx"
13600 -#include "vbacombobox.hxx"
13601 #include "vbaoleobject.hxx"
13602 #include "vbaoleobjects.hxx"
13603 #include "vbashapes.hxx"
13604 @@ -268,7 +268,7 @@ ScVbaWorksheet::getEnableSelection() thr
13605 if ( bSheetExists )
13607 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
13608 - ScDocument* pDoc = getDocShell( xModel )->GetDocument();
13609 + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
13610 ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
13611 sal_Bool bLockedCells = sal_False;
13612 sal_Bool bUnlockedCells = sal_False;
13613 @@ -308,7 +308,7 @@ ScVbaWorksheet::setEnableSelection( sal_
13614 if ( bSheetExists )
13616 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
13617 - ScDocument* pDoc = getDocShell( xModel )->GetDocument();
13618 + ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
13619 ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
13620 // default is xlNoSelection
13621 sal_Bool bLockedCells = sal_False;
13622 @@ -431,11 +431,11 @@ ScVbaWorksheet::Move( const uno::Any& Be
13623 uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
13627 + excel::implnCopy();
13628 uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
13632 + excel::implnPaste();
13636 @@ -469,11 +469,11 @@ ScVbaWorksheet::Copy( const uno::Any& Be
13637 uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
13641 + excel::implnCopy();
13642 uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
13646 + excel::implnPaste();
13650 @@ -502,7 +502,7 @@ ScVbaWorksheet::Paste( const uno::Any& D
13651 uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
13655 + excel::implnPaste();
13659 @@ -713,7 +713,7 @@ ScVbaWorksheet::ShowDataForm( ) throw (u
13661 #ifdef VBA_OOBUILD_HACK
13662 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
13663 - ScTabViewShell* pTabViewShell = getBestViewShell( xModel );
13664 + ScTabViewShell* pTabViewShell = excel::getBestViewShell( xModel );
13666 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
13667 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
13668 @@ -762,9 +762,11 @@ uno::Any SAL_CALL
13669 ScVbaWorksheet::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
13671 uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
13672 - ScVbaControlFactory controlFactory( mxContext, xControlShape, getModel() );
13673 - uno::Reference< msforms::XControl > xControl( controlFactory.createControl( getModel() ) );
13674 - return uno::makeAny( xControl );
13676 + uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
13677 + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW );
13678 + uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) );
13679 + return uno::makeAny( xControl );
13682 ::sal_Bool SAL_CALL
13683 @@ -947,10 +949,9 @@ ScVbaWorksheet::PrintOut( const uno::Any
13684 bSelection = sal_True;
13686 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
13687 - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, xModel, bSelection );
13688 + PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
13692 namespace worksheet
13694 namespace sdecl = comphelper::service_decl;
13695 --- sc/source/ui/vba/vbaworksheet.hxx.old 2009-04-06 16:42:00.000000000 +0000
13696 +++ sc/source/ui/vba/vbaworksheet.hxx 2009-04-06 16:42:01.000000000 +0000
13698 #include <ooo/vba/excel/XChartObjects.hpp>
13699 #include <com/sun/star/container/XNamed.hpp>
13701 -#include "vbahelperinterface.hxx"
13702 +#include <vbahelper/vbahelperinterface.hxx>
13703 +#include "address.hxx"
13705 typedef InheritedHelperInterfaceImpl1< ov::excel::XWorksheet > WorksheetImpl_BASE;
13707 --- sc/source/ui/vba/vbaworksheets.cxx.old 2009-04-02 10:45:35.000000000 +0000
13708 +++ sc/source/ui/vba/vbaworksheets.cxx 2009-04-06 16:42:01.000000000 +0000
13709 @@ -217,8 +217,8 @@ ScVbaWorksheets::Add( const uno::Any& Be
13711 if (!aStringSheet.getLength())
13713 - aStringSheet = ScVbaGlobals::getGlobalsImpl(
13714 - mxContext )->getApplication()->getActiveWorkbook()->getActiveSheet()->getName();
13715 + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
13716 + aStringSheet = xApplication->getActiveWorkbook()->getActiveSheet()->getName();
13717 bBefore = sal_True;
13719 nCount = static_cast< SCTAB >( m_xIndexAccess->getCount() );
13720 @@ -295,7 +295,7 @@ ScVbaWorksheets::PrintOut( const uno::An
13721 if ( isSelectedSheets() )
13722 bSelection = sal_True;
13724 - PrintOutHelper( From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, mxModel, bSelection );
13725 + PrintOutHelper( excel::getBestViewShell( mxModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
13729 @@ -336,7 +336,7 @@ ScVbaWorksheets::setVisible( const uno::
13731 ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException)
13733 - ScTabViewShell* pViewShell = getBestViewShell( mxModel );
13734 + ScTabViewShell* pViewShell = excel::getBestViewShell( mxModel );
13736 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() );
13738 --- sc/source/ui/vba/vbaworksheets.hxx.old 2009-04-02 10:45:35.000000000 +0000
13739 +++ sc/source/ui/vba/vbaworksheets.hxx 2009-04-06 16:42:01.000000000 +0000
13741 #include <com/sun/star/sheet/XSpreadsheets.hpp>
13742 #include <com/sun/star/container/XEnumerationAccess.hpp>
13743 #include <com/sun/star/uno/XComponentContext.hpp>
13744 -#include <ooo/vba/XGlobals.hpp>
13746 -#include "vbacollectionimpl.hxx"
13747 +#include <vbahelper/vbacollectionimpl.hxx>
13751 --- sc/util/makefile.mk.old 2009-04-06 16:41:56.000000000 +0000
13752 +++ sc/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
13753 @@ -78,6 +78,7 @@ SHL1IMPLIB= sci
13755 # dynamic libraries
13757 + $(VBAHELPERLIB) \
13761 @@ -299,6 +300,7 @@ SHL9RPATH=OOO
13765 + $(VBAHELPERLIB) \
13769 --- scp2/source/ooo/file_library_ooo.scp.old 2009-04-06 16:41:58.000000000 +0000
13770 +++ scp2/source/ooo/file_library_ooo.scp 2009-04-06 16:42:01.000000000 +0000
13771 @@ -406,7 +406,42 @@ File gid_File_Lib_Vbaobj
13775 +File gid_File_Lib_Vbaswobj
13777 + Styles = (PACKED,UNO_COMPONENT);
13778 + RegistryID = gid_Starregistry_Services_Rdb;
13779 + Dir = gid_Dir_Program;
13781 + Name = STRING(CONCAT4(libvbaswobj,DLLPOSTFIX,.uno,UNXSUFFIX));
13783 + Name = STRING(CONCAT4(vbaswobj,DLLPOSTFIX,.uno,.dll));
13787 +File gid_File_Lib_Vbamsforms
13789 + Styles = (PACKED,UNO_COMPONENT);
13790 + RegistryID = gid_Starregistry_Services_Rdb;
13791 + Dir = gid_Dir_Program;
13793 + Name = STRING(CONCAT4(libmsforms,DLLPOSTFIX,.uno,UNXSUFFIX));
13795 + Name = STRING(CONCAT4(msforms,DLLPOSTFIX,.uno,.dll));
13799 #endif // VBA_EXTENSION
13800 +File gid_File_Lib_Vbahelper
13802 + Styles = (PACKED);
13803 + RegistryID = gid_Starregistry_Services_Rdb;
13804 + Dir = gid_Dir_Program;
13806 + Name = STRING(CONCAT3(libvbahelper,DLLPOSTFIX,UNXSUFFIX));
13808 + Name = STRING(CONCAT3(vbahelper,DLLPOSTFIX,.dll));
13811 #endif // ENABLE_VBA
13814 --- scripting/source/vbaevents/eventhelper.cxx.old 2009-04-06 16:42:00.000000000 +0000
13815 +++ scripting/source/vbaevents/eventhelper.cxx 2009-04-06 16:42:01.000000000 +0000
13816 @@ -768,10 +768,27 @@ EventListener::firing_Impl(const ScriptE
13817 std::list< TranslateInfo >::const_iterator txInfo =
13818 eventInfo_it->second.begin();
13819 std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
13820 - rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
13822 StarBASIC* pBasic = mpShell->GetBasic();
13823 + BasicManager* pBasicManager = mpShell->GetBasicManager();
13824 + //'Project' is a better default but I want to force failures
13825 + //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
13826 + rtl::OUString sProject = rtl::OUString::createFromAscii("Standard");
13828 + if ( pBasicManager->GetName().Len() > 0 )
13829 + sProject = pBasicManager->GetName();
13831 + rtl::OUString sMacroLoc = sProject;
13832 + sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") );
13833 + sMacroLoc = sMacroLoc.concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
13835 + OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
13838 + pBasic = pBasicManager->GetLib( sProject );
13840 SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
13842 for ( ; pModule && txInfo != txInfo_end; ++txInfo )
13844 // see if we have a match for the handlerextension
13845 --- sfx2/inc/sfx2/sfx.hrc.old 2009-04-02 10:44:03.000000000 +0000
13846 +++ sfx2/inc/sfx2/sfx.hrc 2009-04-06 16:42:01.000000000 +0000
13847 @@ -402,8 +402,10 @@
13848 #define MID_DOCINFO_ENCRYPTED 0x2c
13849 #define MID_DOCINFO_STATISTIC 0x33
13850 #define MID_DOCINFO_CHARLOCALE 0x34
13852 -#define MID_LAST_USED_PROPID MID_DOCINFO_CHARLOCALE
13853 +#define MID_CATEGORY 0x35
13854 +#define MID_COMPANY 0x36
13855 +#define MID_MANAGER 0x37
13856 +#define MID_LAST_USED_PROPID MID_MANAGER
13858 // Config-Ids -----------------------------------------------------------
13860 --- sfx2/inc/sfx2/sfxbasemodel.hxx.old 2009-04-02 10:44:03.000000000 +0000
13861 +++ sfx2/inc/sfx2/sfxbasemodel.hxx 2009-04-06 16:42:01.000000000 +0000
13862 @@ -1379,6 +1379,7 @@ protected:
13863 /* returns true if the document signatures are valid, otherwise false */
13864 sal_Bool hasValidSignatures() const;
13866 + void setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& );
13867 //________________________________________________________________________________________________________
13869 //________________________________________________________________________________________________________
13870 --- sfx2/source/appl/appuno.cxx.old 2009-04-02 10:44:02.000000000 +0000
13871 +++ sfx2/source/appl/appuno.cxx 2009-04-06 16:42:01.000000000 +0000
13872 @@ -2283,6 +2283,16 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL compone
13873 xNewKey = xKey->createKey( aTempStr );
13874 xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentProperties") );
13877 + // writer compatable document properties
13878 + aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
13879 + aImpl += comp_CompatWriterDocProps::_getImplementationName();
13881 + aTempStr = aImpl;
13882 + aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
13883 + xNewKey = xKey->createKey( aTempStr );
13884 + xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.writer.DocumentProperties") );
13889 @@ -2340,6 +2350,16 @@ SFX2_DLLPUBLIC void* SAL_CALL component_
13890 ::comp_SfxDocumentMetaData::_getImplementationName(),
13891 ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
13893 + if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
13894 + ::rtl::OUString::createFromAscii( pImplementationName ) ) )
13896 + xFactory = ::cppu::createSingleComponentFactory(
13897 + ::comp_CompatWriterDocProps::_create,
13898 + ::comp_CompatWriterDocProps::_getImplementationName(),
13899 + ::comp_CompatWriterDocProps::_getSupportedServiceNames());
13902 + // Factory is valid - service was found.
13904 // Factory is valid - service was found.
13905 if ( xFactory.is() )
13906 --- sfx2/source/doc/SfxDocumentMetaData.cxx.old 2009-04-02 10:43:58.000000000 +0000
13907 +++ sfx2/source/doc/SfxDocumentMetaData.cxx 2009-04-06 16:42:01.000000000 +0000
13913 +#include <cppuhelper/implbase1.hxx>
13914 +#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
13917 * This file contains the implementation of the service
13918 * com.sun.star.document.DocumentProperties.
13919 @@ -298,12 +302,12 @@ public:
13920 const css::uno::Sequence< css::beans::StringPair >& i_rNamespaces)
13921 throw (css::uno::RuntimeException, css::xml::sax::SAXException);
13925 SfxDocumentMetaData(SfxDocumentMetaData &); // not defined
13926 SfxDocumentMetaData& operator =(SfxDocumentMetaData &); // not defined
13928 virtual ~SfxDocumentMetaData() {}
13930 + virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new SfxDocumentMetaData( context ); };
13931 const css::uno::Reference< css::uno::XComponentContext > m_xContext;
13933 /// for notification
13934 @@ -377,6 +381,54 @@ private:
13935 // throw (css::uno::RuntimeException);
13938 +typedef ::cppu::ImplInheritanceHelper1< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE;
13940 +class CompatWriterDocPropsImpl : public CompatWriterDocPropsImpl_BASE
13942 + rtl::OUString msManager;
13943 + rtl::OUString msCategory;
13944 + rtl::OUString msCompany;
13946 + virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new CompatWriterDocPropsImpl( context ); };
13948 + CompatWriterDocPropsImpl( css::uno::Reference< css::uno::XComponentContext > const & context) : CompatWriterDocPropsImpl_BASE( context ) {}
13949 +// XCompatWriterDocPropsImpl
13950 + virtual ::rtl::OUString SAL_CALL getManager() throw (::com::sun::star::uno::RuntimeException) { return msManager; }
13951 + virtual void SAL_CALL setManager( const ::rtl::OUString& _manager ) throw (::com::sun::star::uno::RuntimeException) { msManager = _manager; }
13952 + virtual ::rtl::OUString SAL_CALL getCategory() throw (::com::sun::star::uno::RuntimeException){ return msCategory; }
13953 + virtual void SAL_CALL setCategory( const ::rtl::OUString& _category ) throw (::com::sun::star::uno::RuntimeException){ msCategory = _category; }
13954 + virtual ::rtl::OUString SAL_CALL getCompany() throw (::com::sun::star::uno::RuntimeException){ return msCompany; }
13955 + virtual void SAL_CALL setCompany( const ::rtl::OUString& _company ) throw (::com::sun::star::uno::RuntimeException){ msCompany = _company; }
13958 + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
13960 + return comp_CompatWriterDocProps::_getImplementationName();
13963 + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
13965 + css::uno::Sequence< rtl::OUString > sServiceNames= getSupportedServiceNames();
13966 + sal_Int32 nLen = sServiceNames.getLength();
13967 + rtl::OUString* pIt = sServiceNames.getArray();
13968 + rtl::OUString* pEnd = ( pIt + nLen );
13969 + sal_Bool bRes = sal_False;
13970 + for ( ; pIt != pEnd; ++pIt )
13972 + if ( pIt->equals( ServiceName ) )
13981 + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
13983 + return comp_CompatWriterDocProps::_getSupportedServiceNames();
13986 ////////////////////////////////////////////////////////////////////////////
13988 bool operator== (const css::util::DateTime &i_rLeft,
13989 @@ -2149,7 +2201,7 @@ SfxDocumentMetaData::createClone()
13990 ::osl::MutexGuard g(m_aMutex);
13993 - SfxDocumentMetaData *pNew = new SfxDocumentMetaData(m_xContext);
13994 + SfxDocumentMetaData *pNew = createMe(m_xContext);
13996 // NB: do not copy the modification listeners, only DOM
13997 css::uno::Reference<css::xml::dom::XDocument> xDoc = createDOM();
13998 @@ -2266,6 +2318,32 @@ void SAL_CALL SfxDocumentMetaData::seria
14001 // component helper namespace
14002 +namespace comp_CompatWriterDocProps {
14004 + ::rtl::OUString SAL_CALL _getImplementationName() {
14005 + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
14006 + "CompatWriterDocPropsImpl"));
14009 + css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
14011 + static css::uno::Sequence< rtl::OUString > aServiceNames;
14012 + if ( aServiceNames.getLength() == 0 )
14014 + aServiceNames.realloc( 1 );
14015 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties" ) );
14017 + return aServiceNames;
14019 + css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
14020 + const css::uno::Reference< css::uno::XComponentContext > & context)
14021 + SAL_THROW((css::uno::Exception))
14023 + return static_cast< ::cppu::OWeakObject * >
14024 + (new CompatWriterDocPropsImpl(context));
14028 namespace comp_SfxDocumentMetaData {
14030 ::rtl::OUString SAL_CALL _getImplementationName() {
14031 --- sfx2/source/doc/docinf.cxx.old 2009-04-02 10:43:58.000000000 +0000
14032 +++ sfx2/source/doc/docinf.cxx 2009-04-06 16:42:01.000000000 +0000
14034 #include <com/sun/star/beans/XPropertySet.hpp>
14035 #include <com/sun/star/beans/XPropertyContainer.hpp>
14036 #include <com/sun/star/document/XDocumentProperties.hpp>
14037 +#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
14038 #include <com/sun/star/uno/Exception.hpp>
14040 #include <rtl/ustring.hxx>
14042 #include <vcl/gdimtf.hxx>
14044 #include "oleprops.hxx"
14046 // ============================================================================
14049 @@ -174,6 +174,28 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropert
14054 + uno::Reference< document::XCompatWriterDocProperties > xWriterProps( i_xDocProps, uno::UNO_QUERY );
14055 + if ( xWriterProps.is() )
14057 + SfxOleSectionRef xBuiltin = aDocSet.GetSection( SECTION_BUILTIN );
14058 + if ( xBuiltin.get() )
14062 + String aStrValue;
14063 + if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) )
14064 + xWriterProps->setManager( aStrValue );
14065 + if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) )
14066 + xWriterProps->setCategory( aStrValue );
14067 + if ( xBuiltin->GetStringValue( aStrValue, PROPID_COMPANY ) )
14068 + xWriterProps->setCompany( aStrValue );
14070 + catch ( uno::Exception& )
14077 return (nGlobError != ERRCODE_NONE) ? nGlobError : nDocError;
14078 --- sfx2/source/doc/objuno.cxx.old 2009-04-02 10:43:58.000000000 +0000
14079 +++ sfx2/source/doc/objuno.cxx 2009-04-06 16:42:01.000000000 +0000
14081 #include <com/sun/star/lang/Locale.hpp>
14082 #include <com/sun/star/util/XModifiable.hpp>
14083 #include <com/sun/star/document/XDocumentProperties.hpp>
14084 +#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
14086 #include <unotools/configmgr.hxx>
14087 #include <tools/inetdef.hxx>
14088 @@ -105,6 +106,9 @@ SfxItemPropertyMap aDocInfoPropertyMap_I
14089 { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
14090 { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
14091 { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
14092 + { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
14093 + { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
14094 + { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
14095 { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
14096 { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
14097 { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
14098 @@ -824,6 +828,22 @@ void SAL_CALL SfxDocumentInfoObject::se
14099 _pImp->m_xDocProps->setDefaultTarget(sTemp);
14101 // case WID_CONTENT_TYPE : // this is readonly!
14102 + case MID_CATEGORY:
14103 + case MID_MANAGER:
14104 + case MID_COMPANY:
14106 + uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
14107 + if ( xWriterProps.is() )
14109 + if ( nHandle == MID_CATEGORY )
14110 + xWriterProps->setCategory( sTemp );
14111 + else if ( nHandle == MID_MANAGER )
14112 + xWriterProps->setManager( sTemp );
14114 + xWriterProps->setCompany( sTemp );
14121 @@ -1041,6 +1061,23 @@ void SAL_CALL SfxDocumentInfoObject::se
14122 case MID_DOCINFO_CHARLOCALE:
14123 aValue <<= _pImp->m_xDocProps->getLanguage();
14125 + case MID_CATEGORY:
14126 + case MID_MANAGER:
14127 + case MID_COMPANY:
14129 + uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
14130 + if ( xWriterProps.is() )
14132 + if ( nHandle == MID_CATEGORY )
14133 + aValue <<= xWriterProps->getCategory();
14134 + else if ( nHandle == MID_MANAGER )
14135 + aValue <<= xWriterProps->getManager();
14137 + aValue <<= xWriterProps->getCompany();
14143 aValue <<= ::rtl::OUString();
14145 --- sfx2/source/doc/oleprops.hxx.old 2009-04-02 10:43:58.000000000 +0000
14146 +++ sfx2/source/doc/oleprops.hxx 2009-04-06 16:42:01.000000000 +0000
14147 @@ -83,6 +83,10 @@ const sal_Int32 PROPID_CREATED
14148 const sal_Int32 PROPID_LASTSAVED = 13;
14149 const sal_Int32 PROPID_THUMBNAIL = 17;
14151 +// some Builtin properties
14152 +const sal_Int32 PROPID_CATEGORY = 0x2;
14153 +const sal_Int32 PROPID_COMPANY = 0xf;
14154 +const sal_Int32 PROPID_MANAGER = 0xe;
14155 // predefined codepages
14156 const sal_uInt16 CODEPAGE_UNKNOWN = 0;
14157 const sal_uInt16 CODEPAGE_UNICODE = 1200;
14158 --- sfx2/source/doc/sfxbasemodel.cxx.old 2009-04-02 10:43:58.000000000 +0000
14159 +++ sfx2/source/doc/sfxbasemodel.cxx 2009-04-06 16:42:01.000000000 +0000
14160 @@ -784,7 +784,15 @@ uno::Reference< document::XDocumentInfo
14162 return m_pData->m_xDocumentInfo;
14166 +SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
14168 + // object already disposed?
14169 + ::vos::OGuard aGuard( Application::GetSolarMutex() );
14170 + if ( impl_isDisposed() )
14171 + throw lang::DisposedException();
14172 + m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
14174 // document::XDocumentPropertiesSupplier:
14175 uno::Reference< document::XDocumentProperties > SAL_CALL
14176 SfxBaseModel::getDocumentProperties()
14177 --- sfx2/source/inc/SfxDocumentMetaData.hxx.old 2009-04-02 10:43:59.000000000 +0000
14178 +++ sfx2/source/inc/SfxDocumentMetaData.hxx 2009-04-06 16:42:01.000000000 +0000
14179 @@ -48,5 +48,16 @@ css::uno::Reference< css::uno::XInterfac
14181 } // closing component helper namespace
14183 +namespace comp_CompatWriterDocProps {
14185 +namespace css = ::com::sun::star;
14187 +// component and service helper functions:
14188 +::rtl::OUString SAL_CALL _getImplementationName();
14189 +css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
14190 +css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
14191 + css::uno::Reference< css::uno::XComponentContext > const & context );
14196 --- solenv/inc/libs.mk.old 2009-04-02 10:53:10.000000000 +0000
14197 +++ solenv/inc/libs.mk 2009-04-06 16:42:01.000000000 +0000
14198 @@ -192,6 +192,7 @@ SAXLIB=-lsax$(DLLPOSTFIX)
14200 DOCMGRLIB=-ldmg$(DLLPOSTFIX)
14201 BASICLIB=-lsb$(DLLPOSTFIX)
14202 +VBAHELPERLIB=-lvbahelper$(DLLPOSTFIX)
14203 DBTOOLSLIB=-ldbtools$(DLLPOSTFIX)
14204 HM2LIBSH=-lhmwrpdll
14206 @@ -433,6 +434,7 @@ SAXLIB=isax.lib
14208 DOCMGRLIB=docmgr.lib
14210 +VBAHELPERLIB=vbahelper.lib
14214 --- svx/inc/svx/mstoolbar.hxx.old 2009-04-06 16:42:00.000000000 +0000
14215 +++ svx/inc/svx/mstoolbar.hxx 2009-04-06 16:42:01.000000000 +0000
14216 @@ -27,6 +27,7 @@ public:
14217 virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
14220 +class SfxObjectShell;
14222 class SVX_DLLPUBLIC CustomToolBarImportHelper
14224 @@ -39,16 +40,16 @@ class SVX_DLLPUBLIC CustomToolBarImportH
14225 std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
14226 css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
14227 css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
14229 + SfxObjectShell& mrDocSh;
14231 - CustomToolBarImportHelper( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
14232 + CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
14234 void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
14235 css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
14236 css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
14239 - static css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
14240 + css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
14242 void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
14244 @@ -131,7 +132,7 @@ public:
14245 ~TBCGeneralInfo() {}
14246 bool Read(SvStream *pS);
14247 void Print( FILE* );
14248 - bool ImportToolBarControlData( std::vector< css::beans::PropertyValue >& );
14249 + bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
14252 class SVX_DLLPUBLIC TBCBitMap : public TBBase
14253 --- svx/inc/svxmsbas.hxx.old 2009-04-06 16:42:00.000000000 +0000
14254 +++ svx/inc/svxmsbas.hxx 2009-04-06 16:42:01.000000000 +0000
14255 @@ -59,6 +59,8 @@ typedef std::hash_map< sal_Int32, String
14257 typedef std::map< String, ObjIdToName > ControlAttributeInfo;
14261 class SVX_DLLPUBLIC SvxImportMSVBasic
14263 ControlAttributeInfo m_ModuleNameToObjIdHash;
14264 @@ -102,6 +104,9 @@ private:
14265 const String &rSubStorageName, BOOL bVBAMode );
14266 SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
14267 const String &rSubStorageName);
14268 + rtl::OUString msProjectName;
14269 + SVX_DLLPRIVATE BOOL ImportCode_Impl( VBA_Impl&, BOOL, BOOL );
14270 + SVX_DLLPRIVATE bool ImportForms_Impl( VBA_Impl&, const String&, const String&, BOOL);
14274 --- svx/source/msfilter/mstoolbar.cxx.old 2009-04-06 16:42:00.000000000 +0000
14275 +++ svx/source/msfilter/mstoolbar.cxx 2009-04-06 16:42:01.000000000 +0000
14277 #include <vcl/graph.hxx>
14278 #include <vcl/bitmapex.hxx>
14280 +#include <sfx2/objsh.hxx>
14281 +#include <basic/basmgr.hxx>
14283 int TBBase::nIndent = 0;
14285 @@ -36,9 +38,9 @@ void CustomToolBarImportHelper::addIcon(
14286 iconcommands.push_back( item );
14289 -CustomToolBarImportHelper::CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr )
14290 +CustomToolBarImportHelper::CustomToolBarImportHelper( SfxObjectShell& rDocShell, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr ) : mrDocSh( rDocShell )
14292 - m_xCfgSupp.set( rxModel, uno::UNO_QUERY_THROW );
14293 + m_xCfgSupp.set( mrDocSh.GetModel(), uno::UNO_QUERY_THROW );
14294 m_xAppCfgMgr.set( rxAppCfgMgr, uno::UNO_QUERY_THROW );
14297 @@ -58,10 +60,18 @@ uno::Any
14298 CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
14300 //"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
14301 - static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
14302 + static rtl::OUString scheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
14303 static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
14304 + rtl::OUString sProject( RTL_CONSTASCII_USTRINGPARAM("Standard") );
14305 + if ( mrDocSh.GetBasicManager()->GetName().Len() )
14306 + sProject = mrDocSh.GetBasicManager()->GetName();
14307 + sProject += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") );
14309 + // #TODO #FIXME a script can also be loosly defined ( e.g. with no module
14312 // create script url
14313 - rtl::OUString scriptURL = part1 + sCmd + part2;
14314 + rtl::OUString scriptURL = scheme + sProject + sCmd + part2;
14315 return uno::makeAny( scriptURL );
14318 @@ -197,7 +207,7 @@ bool TBCData::Read(SvStream *pS)
14320 bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& /*toolbarcontainer*/, CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props )
14322 - controlGeneralInfo.ImportToolBarControlData( props );
14323 + controlGeneralInfo.ImportToolBarControlData( helper, props );
14324 beans::PropertyValue aProp;
14325 aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
14326 aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
14327 @@ -356,7 +366,7 @@ TBCGeneralInfo::Print( FILE* fp )
14331 -TBCGeneralInfo::ImportToolBarControlData( std::vector< beans::PropertyValue >& sControlData )
14332 +TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std::vector< beans::PropertyValue >& sControlData )
14334 if ( ( bFlags & 0x5 ) )
14336 @@ -366,7 +376,7 @@ TBCGeneralInfo::ImportToolBarControlData
14337 if ( extraInfo.getOnAction().getLength() )
14339 aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
14340 - aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( extraInfo.getOnAction() );
14341 + aProp.Value = helper.createCommandFromMacro( extraInfo.getOnAction() );
14342 sControlData.push_back( aProp );
14345 @@ -379,7 +389,7 @@ TBCGeneralInfo::ImportToolBarControlData
14346 sControlData.push_back( aProp );
14348 aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
14349 - aProp.Value = uno::makeAny( CustomToolBarImportHelper::createCommandFromMacro( tooltip.getString() ) );
14350 + aProp.Value = uno::makeAny( helper.createCommandFromMacro( tooltip.getString() ) );
14351 sControlData.push_back( aProp );
14353 // #TODO find out what is the property for tooltip?
14354 --- svx/source/msfilter/msvbasic.cxx.old 2009-04-06 16:41:59.000000000 +0000
14355 +++ svx/source/msfilter/msvbasic.cxx 2009-04-06 16:42:01.000000000 +0000
14356 @@ -40,9 +40,929 @@
14357 #include <osl/endian.h>
14358 #include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
14359 #include "msvbasic.hxx"
14360 +#include <fstream>
14362 +#include <rtl/ustrbuf.hxx>
14364 using namespace ::com::sun::star::script;
14366 +// #FIXME this routine is stolen from msocximex ( needs to be somewhere central )
14368 +const sal_uInt32 SVX_MSOCX_SIZEMASK = 0x7FFFFFFF; /// Mask for character buffer size.
14369 +const sal_uInt32 SVX_MSOCX_COMPRESSED = 0x80000000;
14371 +inline bool lclIsCompressed( sal_uInt32 nLenFld )
14373 + return (nLenFld & SVX_MSOCX_COMPRESSED) != 0;
14377 +/** Extracts and returns the memory size of the character buffer.
14378 + @return Character buffer size (may differ from resulting string length!).
14380 +inline sal_uInt32 lclGetBufferSize( sal_uInt32 nLenFld )
14382 + return nLenFld & SVX_MSOCX_SIZEMASK;
14384 +/** Creates an OUString from a character array created with lclReadCharArray().
14386 + The passed parameters must match, that means the length field must be the
14387 + same used to create the passed character array.
14390 + The character array returned by lclReadCharArray(). May be compressed
14391 + or uncompressed, next parameter nLenFld will specify this.
14394 + MUST be the same string length field that has been passed to
14395 + lclReadCharArray() to create the character array in previous parameter
14399 + An OUString containing the decoded string data. Will be empty if
14402 +rtl::OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
14404 + rtl::OUStringBuffer aBuffer;
14405 + sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
14406 + if( lclIsCompressed( nLenFld ) )
14408 + // buffer contains compressed Unicode, not encoded bytestring
14409 + sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
14410 + aBuffer.setLength( nStrLen );
14411 + const char* pcCurrChar = pcCharArr;
14412 + for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
14413 + /* *pcCurrChar may contain negative values and therefore MUST be
14414 + casted to unsigned char, before assigned to a sal_Unicode. */
14415 + aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
14419 + // buffer contains Little-Endian Unicode
14420 + sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
14421 + aBuffer.setLength( nStrLen );
14422 + const char* pcCurrChar = pcCharArr;
14423 + for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
14425 + /* *pcCurrChar may contain negative values and therefore MUST be
14426 + casted to unsigned char, before assigned to a sal_Unicode. */
14427 + sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
14428 + cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
14429 + aBuffer.setCharAt( nChar, cChar );
14432 + return aBuffer.makeStringAndClear();
14436 +namespace MSLZSS {
14438 +static unsigned int getShift( sal_uInt32 nPos )
14440 + if (nPos <= 0x80) {
14441 + if (nPos <= 0x20)
14442 + return (nPos <= 0x10) ? 12 : 11;
14444 + return (nPos <= 0x40) ? 10 : 9;
14446 + if (nPos <= 0x200)
14447 + return (nPos <= 0x100) ? 8 : 7;
14448 + else if (nPos <= 0x800)
14449 + return (nPos <= 0x400) ? 6 : 5;
14455 +SvMemoryStream *decompressAsStream( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength = NULL, sal_uInt32 *pLength = NULL )
14457 + SvMemoryStream *pResult;
14458 + const sal_Int32 nWINDOWLEN = 4096;
14459 + pResult = new SvMemoryStream();
14461 + sal_uInt8 nLeadbyte;
14462 + unsigned int nPos = 0;
14463 + int nLen, nDistance, nShift, nClean=1;
14464 + sal_uInt8 aHistory[ nWINDOWLEN ];
14466 + pStream->Seek( nOffset + 3 );
14468 + while( pStream->Read( &nLeadbyte, 1 ) )
14470 + for(int nMask=0x01; nMask < 0x100; nMask = nMask<<1)
14472 + // we see if the leadbyte has flagged this location as a dataunit
14473 + // which is actually a token which must be looked up in the history
14474 + if( nLeadbyte & nMask )
14476 + sal_uInt16 nToken;
14478 + *pStream >> nToken;
14483 + //For some reason the division of the token into the length
14484 + //field of the data to be inserted, and the distance back into
14485 + //the history differs depending on how full the history is
14486 + nShift = getShift( nPos % nWINDOWLEN );
14488 + nLen = (nToken & ((1<<nShift) - 1)) + 3;
14489 + nDistance = nToken >> nShift;
14491 + //read the len of data from the history, wrapping around the
14492 + //nWINDOWLEN boundary if necessary data read from the history
14493 + //is also copied into the recent part of the history as well.
14494 + for (int i = 0; i < nLen; i++)
14497 + c = aHistory[(nPos-nDistance-1) % nWINDOWLEN];
14498 + aHistory[nPos % nWINDOWLEN] = c;
14504 + // special boundary case code, not guarantueed to be correct
14505 + // seems to work though, there is something wrong with the
14506 + // compression scheme (or maybe a feature) where when the data
14507 + // ends on a nWINDOWLEN boundary and the excess bytes in the 8
14508 + // dataunit list are discarded, and not interpreted as tokens
14509 + // or normal data.
14510 + if ((nPos != 0) && ((nPos % nWINDOWLEN) == 0) && (nClean))
14512 + pStream->SeekRel(2);
14514 + pResult->Write( aHistory, nWINDOWLEN );
14517 + //This is the normal case for when the data unit is not a
14518 + //token to be looked up, but instead some normal data which
14519 + //can be output, and placed in the history.
14520 + if (pStream->Read(&aHistory[nPos % nWINDOWLEN],1))
14528 + if (nPos % nWINDOWLEN)
14529 + pResult->Write( aHistory, nPos % nWINDOWLEN );
14530 + pResult->Flush();
14532 + if( pCompressedLength )
14533 + *pCompressedLength = nPos;
14536 + *pLength = pResult->Tell();
14538 + pResult->Seek( 0 );
14545 +// also _VBA_PROJECT_VDPI can be used to create a usable
14546 +// ( and much smaller ) "_VBA_PROJECT" stream
14548 +// _VBA_PROJECT Stream Version Dependant Project Information
14549 +// _VBA_PROJECT Stream Version Dependant Project Information
14551 +class _VBA_PROJECT_VDPI
14554 +sal_Int16 Reserved1;
14555 +sal_Int16 Version;
14556 +sal_Int8 Reserved2;
14557 +sal_Int16 Reserved3;
14558 +sal_uInt8* PerformanceCache;
14559 +sal_Int32 PerformanceCacheSize;
14560 +_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCache(0), PerformanceCacheSize(0) {}
14561 +~_VBA_PROJECT_VDPI()
14563 + if ( PerformanceCache )
14564 + delete [] PerformanceCache;
14565 + PerformanceCache = 0;
14566 + PerformanceCacheSize = 0;
14569 +void write( SvStream* pStream )
14571 + *pStream << Reserved1 << Version << Reserved2 << Reserved3;
14572 + for( sal_Int32 i = 0; PerformanceCache && i < PerformanceCacheSize; ++i )
14574 + *pStream >> PerformanceCache[ i ];
14579 +class ProjectSysKindRecord
14584 +sal_Int32 SysKind;
14585 +ProjectSysKindRecord(): Id(0x1), Size(0x4), SysKind( 0x1 ) {}
14586 +void read( SvStream* pStream )
14588 + *pStream >> Id >> Size >> SysKind;
14592 +class ProjectLcidRecord
14599 +ProjectLcidRecord() : Id( 0x2 ), Size( 0x4 ), Lcid( 0x409 ) {}
14600 +void read( SvStream* pStream )
14602 + OSL_TRACE("ProjectLcidRecord [0x%x]", pStream->Tell() );
14603 + *pStream >> Id >> Size >> Lcid;
14607 +class ProjectLcidInvokeRecord
14611 +sal_Int32 LcidInvoke;
14613 +ProjectLcidInvokeRecord() : Id( 0x14 ), Size( 0x4 ), LcidInvoke( 0x409 ) {}
14614 +void read( SvStream* pStream )
14616 + OSL_TRACE("ProjectLcidInvokeRecord [0x%x]", pStream->Tell() );
14617 + *pStream >> Id >> Size >> LcidInvoke;
14621 +class ProjectCodePageRecord
14625 +sal_Int16 CodePage;
14627 +// #FIXME get a better default for the CodePage
14628 +ProjectCodePageRecord() : Id( 0x03 ), Size( 0x2 ), CodePage( 0x0 ) {}
14629 +void read( SvStream* pStream )
14631 + OSL_TRACE("ProjectCodePageRecord [0x%x]", pStream->Tell() );
14632 + *pStream >> Id >> Size >> CodePage;
14635 +class ProjectNameRecord
14639 +sal_Int32 SizeOfProjectName;
14640 +sal_uInt8* ProjectName;
14641 +rtl::OUString msProjectName;
14642 +ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ), ProjectName(0) {}
14643 +~ProjectNameRecord()
14645 + delete [] ProjectName;
14648 +void read( SvStream* pStream )
14650 + OSL_TRACE("ProjectNameRecord [0x%x]", pStream->Tell() );
14651 + *pStream >> Id >> SizeOfProjectName;
14652 + if ( ProjectName )
14653 + delete [] ProjectName;
14655 + if ( SizeOfProjectName )
14657 + ProjectName = new sal_uInt8[ SizeOfProjectName ];
14658 + OSL_TRACE("ProjectNameRecord about to read name from [0x%x], size %d", pStream->Tell(), SizeOfProjectName );
14659 + pStream->Read( ProjectName, SizeOfProjectName );
14660 + msProjectName = lclCreateOUString( reinterpret_cast< const char* >( ProjectName ), ( SVX_MSOCX_COMPRESSED | SizeOfProjectName ) );
14665 +class ProjectDocStringRecord
14669 +sal_Int32 SizeOfDocString;
14670 +sal_uInt8* DocString;
14671 +sal_Int16 Reserved;
14672 +sal_Int32 SizeOfDocStringUnicode;
14673 +sal_uInt8* DocStringUnicode;
14675 +ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), DocString( 0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ), DocStringUnicode( 0 ) {}
14677 +~ProjectDocStringRecord()
14679 + delete [] DocString;
14680 + delete [] DocStringUnicode;
14682 + DocStringUnicode = 0;
14684 +void read( SvStream* pStream )
14686 + OSL_TRACE("ProjectDocStringRecord [0x%x]", pStream->Tell() );
14687 + *pStream >> Id >> SizeOfDocString;
14690 + delete [] DocString;
14692 + DocString = new sal_uInt8[ SizeOfDocString ];
14693 + pStream->Read( DocString, SizeOfDocString );
14695 + if ( SizeOfDocStringUnicode )
14696 + delete [] DocStringUnicode;
14698 + *pStream >> Reserved >> SizeOfDocStringUnicode;
14700 + if ( DocStringUnicode )
14701 + delete [] DocStringUnicode;
14703 + DocStringUnicode = new sal_uInt8[ SizeOfDocStringUnicode ];
14705 + pStream->Read( DocStringUnicode, SizeOfDocStringUnicode );
14710 +class ProjectHelpFilePath
14714 +sal_Int32 SizeOfHelpFile1;
14715 +sal_uInt8* HelpFile1;
14716 +sal_Int16 Reserved;
14717 +sal_Int32 SizeOfHelpFile2;
14718 +sal_uInt8* HelpFile2;
14720 +ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), HelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0), HelpFile2(0) {}
14721 +~ProjectHelpFilePath()
14724 + delete [] HelpFile1;
14726 + delete [] HelpFile2;
14730 +void read( SvStream* pStream )
14732 + OSL_TRACE("ProjectHelpFilePath [0x%x]", pStream->Tell() );
14733 + *pStream >> Id >> SizeOfHelpFile1;
14736 + delete HelpFile1;
14738 + HelpFile1 = new sal_uInt8[ SizeOfHelpFile1 ];
14739 + pStream->Read( HelpFile1, SizeOfHelpFile1 );
14741 + *pStream >> Reserved >> SizeOfHelpFile2;
14744 + delete HelpFile2;
14746 + HelpFile2 = new sal_uInt8[ SizeOfHelpFile2 ];
14747 + pStream->Read( HelpFile2, SizeOfHelpFile2 );
14752 +class ProjectHelpContextRecord
14757 +sal_Int32 HelpContext;
14759 +ProjectHelpContextRecord() : Id( 0x7 ), Size( 0x4 ), HelpContext( 0 ) {}
14760 +void read( SvStream* pStream )
14763 + OSL_TRACE("ProjectHelpContextRecord [0x%x]", pStream->Tell() );
14764 + *pStream >> Id >> Size >> HelpContext;
14769 +class ProjectLibFlagsRecord
14773 +sal_Int32 ProjectLibFlags;
14776 +ProjectLibFlagsRecord() : Id( 0x8 ), Size( 0x4 ), ProjectLibFlags( 0x0 ) {}
14777 +void read( SvStream* pStream )
14779 + OSL_TRACE("ProjectLibFlagsRecord [0x%x]", pStream->Tell() );
14780 + *pStream >> Id >> Size >> ProjectLibFlags;
14784 +class ProjectVersionRecord
14788 +sal_Int32 Reserved;
14789 +sal_Int32 VersionMajor;
14790 +sal_Int16 VersionMinor;
14791 +ProjectVersionRecord() : Id( 0x9 ), Reserved( 0x4 ), VersionMajor( 0x1 ), VersionMinor( 0 ) {}
14792 +void read( SvStream* pStream )
14794 + OSL_TRACE("ProjectVersionRecord [0x%x]", pStream->Tell() );
14795 + *pStream >> Id >> Reserved >> VersionMajor >> VersionMinor;
14799 +class ProjectConstantsRecord
14802 +sal_Int32 SizeOfConstants;
14803 +sal_uInt8* Constants;
14804 +sal_Int16 Reserved;
14805 +sal_Int32 SizeOfConstantsUnicode;
14806 +sal_uInt8* ConstantsUnicode;
14808 +ProjectConstantsRecord() : Id( 0xC ), SizeOfConstants( 0 ), Constants( 0 ), Reserved( 0x3C ), SizeOfConstantsUnicode( 0 ), ConstantsUnicode(0) {}
14810 +~ProjectConstantsRecord()
14812 + delete [] Constants;
14814 + delete [] ConstantsUnicode;
14815 + ConstantsUnicode = 0;
14818 +void read( SvStream* pStream )
14820 + OSL_TRACE("ProjectConstantsRecord [0x%x]", pStream->Tell() );
14821 + *pStream >> Id >> SizeOfConstants;
14823 + delete [] Constants;
14824 + Constants = new sal_uInt8[ SizeOfConstants ];
14826 + pStream->Read( Constants, SizeOfConstants );
14828 + *pStream >> Reserved;
14830 + if ( ConstantsUnicode )
14831 + delete [] ConstantsUnicode;
14833 + *pStream >> SizeOfConstantsUnicode;
14835 + ConstantsUnicode = new sal_uInt8[ SizeOfConstantsUnicode ];
14836 + pStream->Read( ConstantsUnicode, SizeOfConstantsUnicode );
14841 +class ReferenceNameRecord
14845 +sal_Int32 SizeOfName;
14847 +sal_Int16 Reserved;
14848 +sal_Int32 SizeOfNameUnicode;
14849 +sal_uInt8* NameUnicode;
14851 +ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Name( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ), NameUnicode( 0 ) {}
14852 +~ReferenceNameRecord()
14856 + delete [] NameUnicode;
14860 +void read( SvStream* pStream )
14862 + OSL_TRACE("NameRecord [0x%x]", pStream->Tell() );
14863 + *pStream >> Id >> SizeOfName;
14868 + Name = new sal_uInt8[ SizeOfName ];
14870 + pStream->Read( Name, SizeOfName );
14872 + *pStream >> Reserved >> SizeOfNameUnicode;
14874 + if ( NameUnicode )
14877 + NameUnicode = new sal_uInt8[ SizeOfNameUnicode ];
14878 + pStream->Read( NameUnicode, SizeOfNameUnicode );
14883 +// Baseclass for ReferenceControlRecord, ReferenceRegisteredRecord, ReferenceProjectRecord
14886 +class BaseReferenceRecord
14889 +virtual ~BaseReferenceRecord(){}
14890 +virtual bool read( SvStream* pStream ) = 0;
14891 +virtual void import( VBA_Impl& ){}
14895 +class ReferenceProjectRecord : public BaseReferenceRecord
14900 + sal_uInt32 SizeOfLibidAbsolute;
14901 + sal_uInt8* pLibidAbsolute;
14902 + sal_uInt32 SizeOfLibidRelative;
14903 + sal_uInt8* pLibidRelative;
14904 + sal_uInt32 MajorVersion;
14905 + sal_uInt16 MinorVersion;
14906 + rtl::OUString msAbsoluteLibid;
14907 + rtl::OUString msRelativeLibid;
14909 + virtual bool read( SvStream* pStream );
14910 + virtual void import( VBA_Impl& rDir );
14911 + ReferenceProjectRecord();
14912 + ~ReferenceProjectRecord();
14915 +ReferenceProjectRecord::ReferenceProjectRecord() : Id( 0x000E ), Size( 0 ), SizeOfLibidAbsolute( 0 ), pLibidAbsolute( NULL ), SizeOfLibidRelative( 0 ), pLibidRelative( 0 ), MajorVersion( 0 ), MinorVersion( 0 )
14919 +ReferenceProjectRecord::~ReferenceProjectRecord()
14921 + if ( pLibidAbsolute )
14922 + delete[] pLibidAbsolute;
14923 + if ( pLibidRelative )
14924 + delete[] pLibidRelative;
14927 +bool ReferenceProjectRecord::read( SvStream* pStream )
14929 + OSL_TRACE("ReferenceProjectRecord [0x%x]", pStream->Tell() );
14930 + *pStream >> Id >> Size >> SizeOfLibidAbsolute;
14932 + if ( SizeOfLibidAbsolute )
14934 + pLibidAbsolute = new sal_uInt8[ SizeOfLibidAbsolute ];
14935 + OSL_TRACE("ReferenceProjectRecord about to read LibidAbsolute at [0x%x]", pStream->Tell() );
14936 + pStream->Read( pLibidAbsolute, SizeOfLibidAbsolute );
14939 + *pStream >> SizeOfLibidRelative;
14941 + if ( SizeOfLibidRelative )
14943 + pLibidRelative = new sal_uInt8[ SizeOfLibidRelative ];
14944 + OSL_TRACE("ReferenceProjectRecord about to read LibidRelative at [0x%x]", pStream->Tell() );
14945 + pStream->Read( pLibidRelative, SizeOfLibidRelative );
14948 + *pStream >> MajorVersion >> MinorVersion;
14950 + // array size is ORed with SVX_MSOCX_COMPRESSED to force processing of ascii bytes ( and not
14951 + // 16 bit unicode )
14952 + // the offset of 3 is needed to skip the ProjectReference "*\" and project kind ( 0x4[1-4] ) info.
14954 + msAbsoluteLibid = lclCreateOUString( reinterpret_cast< const char* >( pLibidAbsolute + 3 ), ( SVX_MSOCX_COMPRESSED | (SizeOfLibidAbsolute - 3 )));
14955 + msRelativeLibid = lclCreateOUString( reinterpret_cast< const char* >( pLibidRelative + 3 ), ( SVX_MSOCX_COMPRESSED | ( SizeOfLibidRelative -3 )));
14957 + OSL_TRACE("ReferenceProjectRecord - absolute path %s", rtl::OUStringToOString( msAbsoluteLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
14958 + OSL_TRACE("ReferenceProjectRecord - relative path %s", rtl::OUStringToOString( msRelativeLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
14962 +void ReferenceProjectRecord::import( VBA_Impl& rDir )
14964 + rDir.AddProjectReference( msAbsoluteLibid );
14967 +class ReferenceRegisteredRecord : public BaseReferenceRecord
14972 + sal_uInt32 SizeOfLibid;
14973 + sal_uInt8* pLibid;
14974 + sal_Int32 Reserved1;
14975 + sal_Int16 Reserved2;
14977 + ReferenceRegisteredRecord();
14978 + ~ReferenceRegisteredRecord();
14979 + bool read( SvStream* pStream );
14982 +ReferenceRegisteredRecord::ReferenceRegisteredRecord() : Id( 0x000D ), Size( 0 ), SizeOfLibid( 0 ), pLibid( NULL ), Reserved1( 0 ), Reserved2( 0 )
14986 +ReferenceRegisteredRecord::~ReferenceRegisteredRecord()
14995 +ReferenceRegisteredRecord::read( SvStream* pStream )
14997 + OSL_TRACE("ReferenceRegisteredRecord [0x%x]", pStream->Tell() );
14998 + *pStream >> Id >> Size >> SizeOfLibid;
14999 + if ( SizeOfLibid )
15001 + pLibid = new sal_uInt8[ SizeOfLibid ];
15002 + OSL_TRACE("ReferenceRegisteredRecord about to read Libid [0x%x]", pStream->Tell() );
15003 + pStream->Read( pLibid, SizeOfLibid );
15005 + *pStream >> Reserved1 >> Reserved2;
15009 +class ReferenceOriginalRecord
15013 + sal_uInt32 SizeOfLibOriginal;
15014 + sal_uInt8* pLibidOriginal;
15017 +ReferenceOriginalRecord() : Id( 0x033 ), SizeOfLibOriginal( 0 ), pLibidOriginal( NULL )
15021 +~ReferenceOriginalRecord()
15023 + if ( pLibidOriginal )
15024 + delete[] pLibidOriginal;
15027 +void read( SvStream* pStream )
15029 + *pStream >> Id >> SizeOfLibOriginal;
15030 + if ( SizeOfLibOriginal )
15032 + pLibidOriginal = new sal_uInt8[ SizeOfLibOriginal ];
15033 + pStream->Read( pLibidOriginal, SizeOfLibOriginal );
15039 +class ReferenceControlRecord : public BaseReferenceRecord
15042 +ReferenceOriginalRecord OriginalRecord;
15044 +sal_uInt32 SizeTwiddled;
15045 +sal_uInt32 SizeOfLibidTwiddled;
15046 +sal_uInt8* LibidTwiddled;
15047 +sal_uInt32 Reserved1;
15048 +sal_uInt16 Reserved2;
15049 +ReferenceNameRecord* NameRecordExtended;// Optional
15050 +sal_uInt16 Reserved3;
15051 +sal_uInt32 SizeExtended;
15052 +sal_uInt32 SizeOfLibidExtended;
15053 +sal_uInt8* LibidExtended;
15054 +sal_uInt32 Reserved4;
15055 +sal_uInt16 Reserved5;
15056 +sal_uInt8 OriginalTypeLib[ 16 ];
15057 +sal_uInt32 Cookie;
15059 +ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), LibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), NameRecordExtended( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), LibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
15061 + for( int i = 0; i < 16; ++i )
15062 + OriginalTypeLib[ i ] = 0;
15065 +~ReferenceControlRecord()
15067 + delete LibidTwiddled;
15068 + delete NameRecordExtended;
15069 + delete [] LibidExtended;
15070 + LibidTwiddled = 0;
15071 + NameRecordExtended = 0;
15072 + LibidExtended = 0;
15075 +bool read( SvStream* pStream )
15077 + OSL_TRACE("ReferenceControlRecord [0x%x]", pStream->Tell() );
15078 + OriginalRecord.read( pStream );
15079 + *pStream >> Id >> SizeTwiddled >> SizeOfLibidTwiddled;
15081 + if ( SizeOfLibidTwiddled )
15083 + LibidTwiddled = new sal_uInt8[ SizeOfLibidTwiddled ];
15084 + pStream->Read( LibidTwiddled, SizeOfLibidTwiddled );
15087 + *pStream >> Reserved1 >> Reserved2;
15089 + long nPos = pStream->Tell();
15090 + // peek at the id for optional NameRecord
15091 + sal_Int16 nTmpId;
15092 + *pStream >> nTmpId;
15093 + if ( nTmpId == 0x30 )
15095 + Reserved3 = 0x30;
15099 + pStream->Seek( nPos );
15100 + NameRecordExtended = new ReferenceNameRecord();
15101 + NameRecordExtended->read( pStream );
15102 + *pStream >> Reserved3;
15104 + *pStream >> SizeExtended >> SizeOfLibidExtended;
15106 + if ( SizeExtended )
15108 + LibidExtended = new sal_uInt8[ SizeOfLibidExtended ];
15109 + pStream->Read( LibidExtended, SizeOfLibidExtended );
15112 + *pStream >> Reserved4;
15113 + *pStream >> Reserved5;
15115 + pStream->Read( OriginalTypeLib, sizeof( OriginalTypeLib ) );
15116 + *pStream >> Cookie;
15122 +class ReferenceRecord : public BaseReferenceRecord
15125 +// NameRecord is Optional
15126 +ReferenceNameRecord* NameRecord;
15127 +BaseReferenceRecord* aReferenceRecord;
15128 +ReferenceRecord(): NameRecord(0), aReferenceRecord(0) {}
15129 +~ReferenceRecord()
15131 + if ( NameRecord )
15132 + delete NameRecord;
15133 + if ( aReferenceRecord )
15134 + delete aReferenceRecord;
15137 +// false return would mean failed to read Record e.g. end of array encountered
15138 +// Note: this read routine will make sure the stream is pointing to where it was the
15139 +// method was called )
15141 +bool read( SvStream* pStream )
15143 + OSL_TRACE("ReferenceRecord [0x%x]", pStream->Tell() );
15144 + bool bRead = true;
15145 + long nStart = pStream->Tell();
15146 + long nPos = nStart;
15147 + // Peek at the ID
15150 + pStream->Seek( nPos ); // place back before Id
15151 + if ( Id == 0x16 ) // Optional NameRecord
15153 + NameRecord = new ReferenceNameRecord();
15154 + NameRecord->read( pStream );
15156 + else if ( Id == 0x0f )
15158 + pStream->Seek( nStart );
15160 + return bRead; // start of module, terminate read
15163 + nPos = pStream->Tell(); // mark position, peek at next Id
15165 + pStream->Seek( nPos ); // place back before Id
15170 + aReferenceRecord = new ReferenceRegisteredRecord();
15173 + aReferenceRecord = new ReferenceProjectRecord();
15177 + aReferenceRecord = new ReferenceControlRecord();
15181 + OSL_TRACE("Big fat error, unknown ID 0x%x", Id);
15185 + aReferenceRecord->read( pStream );
15189 +void import( VBA_Impl& rVBA )
15191 + if ( aReferenceRecord )
15192 + aReferenceRecord->import( rVBA );
15200 +ProjectSysKindRecord mSysKindRec;
15201 +ProjectLcidRecord mLcidRec;
15202 +ProjectLcidInvokeRecord mLcidInvokeRec;
15203 +ProjectCodePageRecord mCodePageRec;
15204 +ProjectNameRecord mProjectNameRec;
15205 +ProjectDocStringRecord mDocStringRec;
15206 +ProjectHelpFilePath mHelpFileRec;
15207 +ProjectHelpContextRecord mHelpContextRec;
15208 +ProjectLibFlagsRecord mLibFlagsRec;
15209 +ProjectVersionRecord mVersionRec;
15210 +ProjectConstantsRecord mConstantsRecord;
15211 +std::vector< ReferenceRecord* > ReferenceArray;
15216 + for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
15221 +void read( SvStream* pStream )
15223 + sal_Int32 nPos = pStream->Tell();
15224 + std::ofstream aDump("dir.dump");
15225 + while ( !pStream->IsEof() )
15228 + *pStream >> aByte;
15232 + pStream->Seek( nPos );
15233 + readProjectInformation( pStream );
15234 + readProjectReferenceInformation( pStream );
15237 +void readProjectReferenceInformation( SvStream* pStream )
15239 + bool bKeepReading = true;
15240 + while( bKeepReading )
15242 + ReferenceRecord* pRef = new ReferenceRecord();
15243 + bKeepReading = pRef->read( pStream );
15244 + if ( bKeepReading )
15245 + ReferenceArray.push_back( pRef );
15249 +void readProjectInformation( SvStream* pStream )
15251 + mSysKindRec.read( pStream );
15252 + mLcidRec.read( pStream );
15253 + mLcidInvokeRec.read( pStream );
15254 + mCodePageRec.read( pStream );
15255 + mProjectNameRec.read( pStream );
15256 + mDocStringRec.read( pStream );
15257 + mHelpFileRec.read( pStream );
15258 + mHelpContextRec.read( pStream );
15259 + mLibFlagsRec.read( pStream );
15260 + mVersionRec.read( pStream );
15261 + sal_Int32 nPos = pStream->Tell();
15263 + *pStream >> nTmp;
15264 + if ( nTmp == 0x0C )
15266 + pStream->Seek( nPos );
15267 + mConstantsRecord.read( pStream );
15269 + OSL_TRACE("After Information pos is 0x%x", pStream->Tell() );
15272 +void import( VBA_Impl& rVBA )
15274 + // get project references
15275 + for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
15276 + (*it)->import( rVBA );
15277 + rVBA.SetProjectName( mProjectNameRec.msProjectName );
15284 A few urls which may in the future be of some use
15285 http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
15286 @@ -155,7 +1075,17 @@ int VBA_Impl::ReadVBAProject(const SvSto
15287 xVBAProject = rxVBAStorage->OpenSotStream(
15288 String( RTL_CONSTASCII_USTRINGPARAM( "_VBA_PROJECT" ) ),
15289 STREAM_STD_READ | STREAM_NOCREATE );
15291 + // read Dir stream
15292 + SvStorageStreamRef xDir = rxVBAStorage->OpenSotStream(
15293 + String( RTL_CONSTASCII_USTRINGPARAM( "dir" ) ),
15294 + STREAM_STD_READ | STREAM_NOCREATE );
15295 + // decompress the stream
15296 + std::auto_ptr< SvMemoryStream > xCmpDir;
15297 + xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) );
15298 + // try to parse the dir stream
15300 + dDump.read( xCmpDir.get() );
15301 + dDump.import( *this );
15302 if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
15304 DBG_WARNING("Not able to find vba project, cannot find macros");
15305 @@ -455,6 +1385,7 @@ bool VBA_Impl::Open( const String &rTopl
15306 if( !xMacros.Is() || SVSTREAM_OK != xMacros->GetError() )
15308 DBG_WARNING("No Macros Storage");
15309 + OSL_TRACE("No Macros Storage");
15313 @@ -464,6 +1395,7 @@ bool VBA_Impl::Open( const String &rTopl
15314 if( !xVBA.Is() || SVSTREAM_OK != xVBA->GetError() )
15316 DBG_WARNING("No Visual Basic in Storage");
15317 + OSL_TRACE("No Visual Basic in Storage");
15321 @@ -478,6 +1410,7 @@ bool VBA_Impl::Open( const String &rTopl
15322 * ( value ) is either a Class Module, Form Module or a plain VB Module. */
15323 SvStorageStreamRef xProject = xMacros->OpenSotStream(
15324 String( RTL_CONSTASCII_USTRINGPARAM( "PROJECT" ) ) );
15326 SvStorageStream* pStp = xProject;
15328 static const String sThisDoc( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
15329 --- svx/source/msfilter/msvbasic.hxx.old 2009-04-06 16:41:59.000000000 +0000
15330 +++ svx/source/msfilter/msvbasic.hxx 2009-04-06 16:42:01.000000000 +0000
15331 @@ -97,9 +97,14 @@ public:
15333 // #117718# member map of module names to types of module
15334 ModType GetModuleType( const UniString& rModuleName );
15336 - std::vector<String> maReferences;
15337 + rtl::OUString& ProjectName() { return msProjectName; }
15338 + void SetProjectName( const rtl::OUString& rPName ) { msProjectName = rPName; }
15339 + const std::vector<rtl::OUString>& ProjectReferences() { return maPrjReferences; }
15340 + void AddProjectReference( const rtl::OUString& rProject ) { maPrjReferences.push_back( rProject); }
15341 + SvStorage* GetStorage() { return xStor; }
15343 + std::vector<rtl::OUString> maReferences;
15344 + std::vector<rtl::OUString> maPrjReferences;
15345 struct VBAOffset_Impl
15348 @@ -125,6 +130,7 @@ private:
15349 int ReadVBAProject(const SvStorageRef &rxVBAStorage);
15350 int DecompressVBA(int index, SvStorageStreamRef &rxVBAStream);
15351 sal_uInt8 ReadPString(SvStorageStreamRef &xVBAProject, bool bIsUnicode);
15352 + rtl::OUString msProjectName;
15356 --- svx/source/msfilter/svxmsbas.cxx.old 2009-04-06 16:42:00.000000000 +0000
15357 +++ svx/source/msfilter/svxmsbas.cxx 2009-04-06 16:42:01.000000000 +0000
15358 @@ -83,6 +83,7 @@ int SvxImportMSVBasic::Import( const Str
15359 const String &rSubStorageName,
15360 BOOL bAsComment, BOOL bStripped )
15362 + msProjectName = rtl::OUString();
15364 if( bImport && ImportCode_Impl( rStorageName, rSubStorageName,
15365 bAsComment, bStripped ))
15366 @@ -100,7 +101,42 @@ int SvxImportMSVBasic::Import( const Str
15367 bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
15368 const String& rSubStorageName, BOOL bVBAMode )
15370 - SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
15371 + BOOL bRet = FALSE;
15372 + // #FIXME VBA_Impl ( or some other new class ) should handle both userforms
15374 + VBA_Impl aVBA( *xRoot, TRUE );
15375 + // This call is a waste we read the source ( again ) only to get the refereneces
15376 + // *AGAIN*, we really need to rewrite all of this
15377 + aVBA.Open( rStorageName, rSubStorageName );
15379 + bRet = ImportForms_Impl( aVBA, rStorageName, rSubStorageName, bVBAMode );
15380 + std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
15382 + for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
15384 + rtl::OUString sFileName = *it;
15387 + // hacky test code to read referenced projects on linux
15388 + sal_Int32 nPos = (*it).lastIndexOf('\\');
15389 + sFileName = (*it).copy( nPos + 1 );
15390 + sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
15393 + SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
15394 + VBA_Impl refVBA( *rRoot, TRUE );
15395 + refVBA.Open( rStorageName, rSubStorageName );
15396 + // The return from ImportForms doesn't indicate and error ( it could )
15397 + // but also it just means no userforms were imported
15398 + if ( ImportForms_Impl( refVBA, rStorageName, rSubStorageName, bVBAMode ) )
15399 + bRet = true; // mark that at least on userform was imported
15404 +bool SvxImportMSVBasic::ImportForms_Impl( VBA_Impl& rVBA, const String& rStorageName, const String& rSubStorageName, BOOL bVBAMode )
15406 + SvStorageRef xVBAStg(rVBA.GetStorage()->OpenSotStorage(rStorageName,
15407 STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
15408 if (!xVBAStg.Is() || xVBAStg->GetError())
15410 @@ -133,6 +169,10 @@ bool SvxImportMSVBasic::ImportForms_Impl
15411 DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
15413 String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
15415 + if (rVBA.ProjectName().getLength() )
15416 + aLibName = rVBA.ProjectName();
15417 + OSL_TRACE( "userformage lib name %s", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr() );
15418 Reference<XNameContainer> xLib;
15419 if (xLibContainer.is())
15421 @@ -260,17 +300,55 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
15424 VBA_Impl aVBA( *xRoot, bAsComment );
15426 if( aVBA.Open(rStorageName,rSubStorageName) )
15428 + msProjectName = aVBA.ProjectName();
15430 + if ( msProjectName.getLength() )
15431 + rDocSh.GetBasicManager()->SetName( msProjectName ); // set name of Project
15433 + bRet = ImportCode_Impl( aVBA, bAsComment, bStripped );
15434 + std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
15436 + for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
15438 + rtl::OUString sFileName = *it;
15441 + // hacky test code to read referenced projects on linux
15442 + sal_Int32 nPos = (*it).lastIndexOf('\\');
15443 + sFileName = (*it).copy( nPos + 1 );
15444 + sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
15447 + OSL_TRACE("referenced project %s ", rtl::OUStringToOString( sFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
15448 + SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
15449 + VBA_Impl refVBA( *rRoot, bAsComment );
15450 + if( refVBA.Open(rStorageName,rSubStorageName) && ImportCode_Impl( refVBA, bAsComment, bStripped ) )
15451 + bRet = TRUE; // mark that some code was imported
15457 +BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL bStripped )
15459 + BOOL bRet = FALSE;
15460 SFX_APP()->EnterBasicCall();
15461 Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
15462 DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
15464 UINT16 nStreamCount = aVBA.GetNoStreams();
15465 Reference<XNameContainer> xLib;
15467 + String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
15469 if( xLibContainer.is() && nStreamCount )
15471 - String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
15472 + if ( aVBA.ProjectName().getLength() )
15473 + aLibName = aVBA.ProjectName();
15475 if( !xLibContainer->hasByName( aLibName ) )
15476 xLibContainer->createLibrary( aLibName );
15478 @@ -282,7 +360,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
15479 Reference< container::XNameAccess > xVBAObjectForCodeName;
15482 - rDocSh.GetBasic()->SetVBAEnabled( true );
15483 + rDocSh.GetBasicManager()->GetLib( aLibName )->SetVBAEnabled( true );
15484 Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
15487 @@ -483,7 +561,6 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
15490 SFX_APP()->LeaveBasicCall();
15495 --- sw/inc/unocoll.hxx.old 2009-04-02 10:50:57.000000000 +0000
15496 +++ sw/inc/unocoll.hxx 2009-04-06 16:42:01.000000000 +0000
15497 @@ -194,8 +194,10 @@ class SwUnoCollection
15498 #define SW_SERVICE_CHART2_DATA_PROVIDER 106
15499 #define SW_SERVICE_TYPE_FIELDMARK 107
15500 #define SW_SERVICE_TYPE_FORMFIELDMARK 108
15501 +#define SW_SERVICE_VBAOBJECTPROVIDER 109
15502 +#define SW_SERVICE_VBACODENAMEPROVIDER 110
15504 -#define SW_SERVICE_LAST SW_SERVICE_TYPE_FORMFIELDMARK
15505 +#define SW_SERVICE_LAST SW_SERVICE_VBACODENAMEPROVIDER
15507 #define SW_SERVICE_INVALID USHRT_MAX
15509 --- sw/prj/build.lst.old 2009-04-06 16:41:57.000000000 +0000
15510 +++ sw/prj/build.lst 2009-04-06 16:42:01.000000000 +0000
15512 -sw sw : connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui NULL
15513 +sw sw : connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui vbahelper NULL
15514 sw sw usr1 - all sw_mkout NULL
15515 sw sw\inc nmake - all sw_inc NULL
15516 sw sw\uiconfig\layout nmake - all sw_layout NULL
15517 @@ -33,6 +33,7 @@ sw sw\source\ui\smartmenu
15518 sw sw\source\ui\table nmake - all sw_table sw_inc NULL
15519 sw sw\source\ui\uiview nmake - all sw_uivw sw_sdi sw_inc NULL
15520 sw sw\source\ui\uno nmake - all sw_uiuno sw_sdi sw_inc NULL
15521 +sw sw\source\ui\vba nmake - all sw_vba sw_inc NULL
15522 sw sw\source\ui\utlui nmake - all sw_utlui sw_inc NULL
15523 sw sw\source\ui\web nmake - all sw_web sw_uinc sw_sdi sw_inc NULL
15524 sw sw\source\ui\wrtsh nmake - all sw_wrtsh sw_inc NULL
15525 @@ -69,7 +70,7 @@ sw sw\source\filter\writer
15526 sw sw\source\filter\ww1 nmake - all sw_ww1 sw_inc NULL
15527 sw sw\source\filter\ww8 nmake - all sw_ww8 sw_inc NULL
15528 sw sw\source\filter\xml nmake - all sw_xml sw_inc NULL
15529 -sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu NULL
15530 +sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu sw_vba NULL
15531 sw sw\source\core nmake - all sw_core sw_attr sw_bast sw_crsr sw_dcnd sw_doc sw_draw sw_edit sw_excpt sw_fld sw_frmed sw_grph sw_layo sw_ole sw_para sw_sw3io sw_swg sw_text sw_tox sw_txtnd sw_uco sw_undo sw_view sw_acc sw_objpos sw_NumberTree sw_tablecore NULL
15532 sw sw\source\filter nmake - all sw_flt sw_ascii sw_bsflt sw_html sw_rtf sw_wrtr sw_ww1 sw_ww8 sw_xml NULL
15533 sw sw\util nmake - all sw_util sw_core sw_flt sw_sdi sw_ui NULL
15534 --- sw/prj/d.lst.old 2009-04-02 10:50:58.000000000 +0000
15535 +++ sw/prj/d.lst 2009-04-06 16:42:01.000000000 +0000
15536 @@ -63,6 +63,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\module
15537 ..\%__SRC%\bin\swd?????.dll %_DEST%\bin%_EXT%\swd?????.dll
15538 ..\%__SRC%\bin\swui?????.dll %_DEST%\bin%_EXT%\swui?????.dll
15539 ..\%__SRC%\bin\msword?????.dll %_DEST%\bin%_EXT%\msword?????.dll
15540 +..\%__SRC%\bin\vbaswobj*.dll %_DEST%\bin%_EXT%\vbaswobj*.dll
15541 ..\%__SRC%\bin\sw*.res %_DEST%\bin%_EXT%\sw*.res
15542 ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
15544 --- sw/source/core/unocore/unocoll.cxx.old 2009-04-02 10:50:23.000000000 +0000
15545 +++ sw/source/core/unocore/unocoll.cxx 2009-04-06 16:42:01.000000000 +0000
15547 #include <unochart.hxx>
15549 #include "docsh.hxx"
15551 +#include <com/sun/star/document/XCodeNameQuery.hpp>
15552 +#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
15553 +#include <com/sun/star/form/XFormsSupplier.hpp>
15554 +#include <com/sun/star/script/ModuleInfo.hpp>
15555 +#include <com/sun/star/script/ModuleType.hpp>
15556 +#include <com/sun/star/script/ScriptEventDescriptor.hpp>
15557 +#include <vbahelper/vbahelper.hxx>
15558 +#include <basic/basmgr.hxx>
15559 using ::rtl::OUString;
15560 using namespace ::com::sun::star;
15561 using namespace ::com::sun::star::document;
15562 @@ -82,6 +89,119 @@ using namespace ::com::sun::star::text;
15563 using namespace ::com::sun::star::container;
15564 using namespace ::com::sun::star::lang;
15566 +class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
15568 + SwDocShell* mpDocShell;
15569 + rtl::OUString msThisDocumentCodeName;
15571 + SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
15572 + // XCodeNameQuery
15573 + rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
15575 + // Initialise the code name
15576 + if ( msThisDocumentCodeName.getLength() == 0 )
15580 + uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
15581 + uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
15582 + rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
15583 + if ( mpDocShell->GetBasicManager()->GetName().Len() )
15584 + sProjectName = mpDocShell->GetBasicManager()->GetName();
15586 + uno::Reference< container::XNameAccess > xStandard( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
15587 + uno::Sequence< rtl::OUString > sModuleNames = xStandard->getElementNames();
15588 + for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
15590 + script::ModuleInfo mInfo;
15591 + if ( xStandard->getByName( sModuleNames[ i ] ) >>= mInfo )
15593 + if ( mInfo.ModuleType == script::ModuleType::Document )
15595 + msThisDocumentCodeName = sModuleNames[ i ];
15601 + catch( uno::Exception& )
15605 + rtl::OUString sCodeName;
15606 + if ( mpDocShell )
15608 + OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
15609 + // need to find the page ( and index ) for this control
15610 + uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
15611 + uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
15612 + sal_Int32 nLen = xIndex->getCount();
15613 + bool bMatched = false;
15614 + uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
15617 + uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
15618 + uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
15619 + // get the www-standard container
15620 + uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
15621 + sal_Int32 nCntrls = xFormControls->getCount();
15622 + for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
15624 + uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
15625 + bMatched = ( xControl == xIf );
15628 + sCodeName = msThisDocumentCodeName;
15633 + catch( uno::Exception& ) {}
15635 + // Probably should throw here ( if !bMatched )
15636 + return sCodeName;
15640 +class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
15642 + SwDocShell* mpDocShell;
15644 + SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
15646 + // #FIXME #TODO is the code name for ThisDocument read anywhere?
15649 + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
15651 + // #FIXME #TODO we really need to be checking against the codename for
15653 + if ( aName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisDocument" ) ) ) )
15655 + return sal_False;
15657 + ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
15659 + if ( !hasByName( aName ) )
15660 + throw container::NoSuchElementException();
15661 + uno::Sequence< uno::Any > aArgs( 2 );
15662 + aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
15663 + aArgs[1] = uno::Any( mpDocShell->GetModel() );
15664 + uno::Reference< uno::XInterface > xDocObj = ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
15665 + OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj.get() );
15666 + return uno::makeAny( xDocObj );
15668 + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
15670 + uno::Sequence< rtl::OUString > aNames;
15674 + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
15675 + virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
15679 /******************************************************************************
15681 ******************************************************************************/
15682 @@ -203,6 +323,8 @@ const ProvNamesId_Type __FAR_DATA aProvN
15683 { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
15684 { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
15685 { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER },
15686 + { "ooo.vba.VBAObjectModuleObjectProvider", SW_SERVICE_VBAOBJECTPROVIDER },
15687 + { "ooo.vba.VBACodeNameProvider", SW_SERVICE_VBACODENAMEPROVIDER },
15689 // case-correct versions of the service names (see #i67811)
15690 { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
15691 @@ -383,6 +505,18 @@ uno::Reference< uno::XInterface > SwXS
15692 xRet = (cppu::OWeakObject*)pFieldmark;
15695 + case SW_SERVICE_VBAOBJECTPROVIDER :
15697 + SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
15698 + xRet = (cppu::OWeakObject*)pObjProv;
15701 + case SW_SERVICE_VBACODENAMEPROVIDER :
15703 + SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
15704 + xRet = (cppu::OWeakObject*)pObjProv;
15707 case SW_SERVICE_TYPE_FOOTNOTE :
15708 xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
15710 --- sw/source/filter/ww8/ww8par.cxx.old 2009-04-06 16:42:00.000000000 +0000
15711 +++ sw/source/filter/ww8/ww8par.cxx 2009-04-06 16:42:01.000000000 +0000
15712 @@ -132,6 +132,9 @@
15713 #include <svtools/itemiter.hxx> //SfxItemIter
15716 +#include <comphelper/processfactory.hxx>
15717 +#include <basic/basmgr.hxx>
15719 #include "ww8toolbar.hxx"
15721 #include <iostream>
15722 @@ -146,6 +149,76 @@ using namespace sw::util;
15723 using namespace sw::types;
15724 using namespace nsHdFtFlags;
15726 +#include <vbahelper/vbahelper.hxx>
15727 +#include <com/sun/star/document/XEventsSupplier.hpp>
15728 +#include <com/sun/star/container/XNameReplace.hpp>
15729 +#include <com/sun/star/frame/XModel.hpp>
15730 +const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
15732 +const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
15733 +const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
15734 +const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
15736 +struct DocEventNameTable
15738 + const sal_Char* sEventName;
15739 + const sal_Char* sMacroName;
15742 +const DocEventNameTable aEventNameTable[] =
15744 + {"OnNew", "Document_New"},
15745 + {"OnLoad", "Document_Open"},
15746 + {"OnPrepareUnload", "Document_Close"},
15750 +bool registerDocEvent( SfxObjectShell* pShell )
15752 + bool result = false;
15753 + const static rtl::OUString sEvtType( RTL_CONSTASCII_USTRINGPARAM("EventType") );
15754 + const static rtl::OUString sScript( RTL_CONSTASCII_USTRINGPARAM("Script") );
15755 + uno::Reference< document::XEventsSupplier > xEvtSupplier( pShell->GetModel(), uno::UNO_QUERY );
15756 + if( !xEvtSupplier.is() )
15758 + uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );
15759 + if ( xEvts.is() )
15761 + for( const DocEventNameTable* pTable = aEventNameTable; pTable->sEventName != NULL; pTable++ )
15763 + rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName );
15764 + rtl::OUString sMacroName = rtl::OUString::createFromAscii( pTable->sMacroName );
15765 + // fail to search the macro if the module is not specified.
15766 + String sFullPath = ooo::vba::docMacroExists( pShell, sModule, sMacroName );
15767 + if( sFullPath.Len() == 0 )
15770 + uno::Sequence< beans::PropertyValue > aEvents;
15771 + xEvts->getByName( sEvt ) >>= aEvents;
15772 + uno::Sequence< beans::PropertyValue > aOpenEvt( 2 );
15773 + aOpenEvt[ 0 ].Name = sEvtType;
15774 + aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
15775 + aOpenEvt[ 1 ].Name = sScript;
15776 + rtl::OUString sUrl = sUrlPart0.concat( sFullPath ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 );
15777 + aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
15778 + sal_Int32 nPos = aEvents.getLength();
15780 + sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
15781 + if ( nNewSize > aEvents.getLength() )
15782 + aEvents.realloc( nNewSize );
15784 + for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
15785 + aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];
15787 + uno::Any aParam = uno::makeAny( aEvents );
15789 + xEvts->replaceByName( sEvt, aParam );
15797 SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
15798 : SvxMSDffManager(*rRdr.pTableStream, rRdr.GetBaseURL(), rRdr.pWwFib->fcDggInfo,
15799 @@ -3904,7 +3977,52 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Gloss
15801 else //ordinary case
15803 + if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
15805 + const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
15806 + maTracer.EnterEnvironment(sw::log::eMacros);
15807 + // Create and insert Excel vba Globals
15809 + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals") );
15810 + mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
15812 + SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
15813 + pVBAFlags->IsLoadWordBasicCode(),
15814 + pVBAFlags->IsLoadWordBasicStorage() );
15815 + String s1(CREATE_CONST_ASC("Macros"));
15816 + String s2(CREATE_CONST_ASC("VBA"));
15817 + int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
15818 + // Read custom toolbars
15819 + if ( pWwFib->lcbCmds )
15821 + // there is a tgc255 structure
15822 + long nCur = pTableStream->Tell();
15824 + pTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
15825 + if (!aTCG.Read( pTableStream ) )
15826 + OSL_TRACE("** Read of Customization data failed!!!! ");
15827 + pTableStream->Seek( nCur ); // return to previous position, is that necessary?
15829 + aTCG.Print( stderr );
15831 + aTCG.ImportCustomToolBar( *mpDocShell );
15835 + maTracer.Log(sw::log::eContainsVisualBasic);
15836 + rDoc.SetContainsMSVBasic(true);
15839 + StoreMacroCmds();
15841 + // Hackly to register the document event.
15842 + // should be find a better solution to share the codes with Excel Workbook event.
15843 + registerDocEvent( mpDocShell );
15845 + maTracer.LeaveEnvironment(sw::log::eMacros);
15847 ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
15851 ::SetProgressState(nProgress, mpDocShell); // Update
15852 @@ -3978,41 +4096,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Gloss
15853 eMode |= nsRedlineMode_t::REDLINE_ON;
15854 if( pWDop->fRMView )
15855 eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
15856 - if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
15858 - // Read custom toolbars
15859 - if ( pWwFib->lcbCmds )
15861 - // there is a tgc255 structure
15862 - long nCur = pTableStream->Tell();
15864 - pTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
15865 - if (!aTCG.Read( pTableStream ) )
15866 - OSL_TRACE("** Read of Customization data failed!!!! ");
15867 - pTableStream->Seek( nCur ); // return to previous position, is that necessary?
15869 - aTCG.Print( stderr );
15871 - aTCG.ImportCustomToolBar( mpDocShell->GetModel() );
15873 - const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
15874 - maTracer.EnterEnvironment(sw::log::eMacros);
15875 - SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
15876 - pVBAFlags->IsLoadWordBasicCode(),
15877 - pVBAFlags->IsLoadWordBasicStorage() );
15878 - String s1(CREATE_CONST_ASC("Macros"));
15879 - String s2(CREATE_CONST_ASC("VBA"));
15880 - int nRet = aVBasic.Import( s1, s2 );
15883 - maTracer.Log(sw::log::eContainsVisualBasic);
15884 - rDoc.SetContainsMSVBasic(true);
15887 - StoreMacroCmds();
15889 - maTracer.LeaveEnvironment(sw::log::eMacros);
15893 maInsertedTables.DelAndMakeTblFrms();
15894 --- sw/source/filter/ww8/ww8toolbar.cxx.old 2009-04-06 16:42:00.000000000 +0000
15895 +++ sw/source/filter/ww8/ww8toolbar.cxx 2009-04-06 16:42:01.000000000 +0000
15896 @@ -154,14 +154,14 @@ void CTBWrapper::Print( FILE* fp )
15900 -bool CTBWrapper::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
15901 +bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
15904 for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
15906 uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
15907 uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
15908 - CustomToolBarImportHelper helper( rxModel, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
15909 + CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
15910 helper.setMSOCommandMap( new MSOWordCommandConvertor() );
15911 if ( !(*it).ImportCustomToolBar( helper ) )
15913 @@ -538,9 +538,9 @@ void Tcg::Print( FILE* fp )
15917 -bool Tcg::ImportCustomToolBar( const uno::Reference< frame::XModel >& rxModel )
15918 +bool Tcg::ImportCustomToolBar( SfxObjectShell& rDocSh )
15920 - return tcg->ImportCustomToolBar( rxModel );
15921 + return tcg->ImportCustomToolBar( rDocSh );
15925 @@ -601,7 +601,7 @@ bool Tcg255::processSubStruct( sal_uInt8
15929 -bool Tcg255::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
15930 +bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
15932 // Find the CTBWrapper
15933 for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
15934 @@ -612,7 +612,7 @@ bool Tcg255::ImportCustomToolBar( const
15935 CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
15938 - if ( !pCTBWrapper->ImportCustomToolBar( rxModel ) )
15939 + if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
15943 --- sw/source/filter/ww8/ww8toolbar.hxx.old 2009-04-06 16:42:00.000000000 +0000
15944 +++ sw/source/filter/ww8/ww8toolbar.hxx 2009-04-06 16:42:01.000000000 +0000
15945 @@ -117,6 +117,8 @@ public:
15946 void Print( FILE* );
15949 +class SfxObjectShell;
15951 class CTBWrapper : public Tcg255SubStruct
15953 // reserved1 is the ch field of Tcg255SubStruct
15954 @@ -139,7 +141,7 @@ public:
15955 CTBWrapper( bool bReadId = true );
15957 bool Read(SvStream *pS);
15958 - bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
15959 + bool ImportCustomToolBar( SfxObjectShell& rDocSh );
15960 void Print( FILE* );
15963 @@ -320,7 +322,7 @@ public:
15965 bool Read(SvStream *pS);
15966 void Print( FILE* );
15967 - bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
15968 + bool ImportCustomToolBar( SfxObjectShell& rDocSh );
15971 class Tcg: public TBBase
15972 @@ -333,7 +335,7 @@ public:
15975 bool Read(SvStream *pS);
15976 - bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
15977 + bool ImportCustomToolBar( SfxObjectShell& rDocSh );
15978 void Print( FILE* );
15981 --- sw/source/ui/uno/unotxdoc.cxx.old 2009-04-02 10:50:38.000000000 +0000
15982 +++ sw/source/ui/uno/unotxdoc.cxx 2009-04-06 16:42:01.000000000 +0000
15983 @@ -170,6 +170,7 @@ using ::osl::FileBase;
15984 #define SW_CREATE_MARKER_TABLE 0x06
15985 #define SW_CREATE_DRAW_DEFAULTS 0x07
15987 +#include <comphelper/processfactory.hxx>
15989 /******************************************************************************
15991 @@ -362,6 +363,9 @@ SwXTextDocument::SwXTextDocument(SwDocSh
15993 m_pHiddenViewFrame(0)
15995 + uno::Reference< document::XDocumentProperties > xWriterProps( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.writer.DocumentProperties") ), uno::UNO_QUERY_THROW);
15997 + SfxBaseModel::setDocumentProperties( xWriterProps );
15999 /*-- 18.12.98 11:53:00---------------------------------------------------
16001 @@ -2883,6 +2887,7 @@ uno::Sequence< lang::Locale > SAL_CALL S
16003 ::vos::OGuard aGuard(Application::GetSolarMutex());
16006 // possible canonical values for nScriptTypes
16007 // any bit wise combination is allowed
16008 const sal_Int16 nLatin = 0x001;
16009 --- sw/source/ui/vba/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
16010 +++ sw/source/ui/vba/makefile.mk 2009-04-06 16:42:01.000000000 +0000
16012 +#*************************************************************************
16014 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16016 +# Copyright 2008 by Sun Microsystems, Inc.
16018 +# OpenOffice.org - a multi-platform office productivity suite
16020 +# $RCSfile: makefile.mk,v $
16022 +# $Revision: 1.6 $
16024 +# This file is part of OpenOffice.org.
16026 +# OpenOffice.org is free software: you can redistribute it and/or modify
16027 +# it under the terms of the GNU Lesser General Public License version 3
16028 +# only, as published by the Free Software Foundation.
16030 +# OpenOffice.org is distributed in the hope that it will be useful,
16031 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
16032 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16033 +# GNU Lesser General Public License version 3 for more details
16034 +# (a copy is included in the LICENSE file that accompanied this code).
16036 +# You should have received a copy of the GNU Lesser General Public License
16037 +# version 3 along with OpenOffice.org. If not, see
16038 +# <http://www.openoffice.org/license.html>
16039 +# for a copy of the LGPLv3 License.
16041 +#*************************************************************************
16047 +ENABLE_EXCEPTIONS=TRUE
16049 +# --- Settings -----------------------------------------------------
16051 +.INCLUDE : settings.mk
16054 +.IF "$(ENABLE_VBA)"!="YES"
16056 + @echo "not building vba..."
16059 +INCPRE=$(INCCOM)$/$(TARGET)
16060 +CDEFS+=-DVBA_OOBUILD_HACK
16061 +# ------------------------------------------------------------------
16064 + $(SLO)$/vbaglobals.obj \
16065 + $(SLO)$/vbaapplication.obj \
16066 + $(SLO)$/vbadocument.obj \
16067 + $(SLO)$/vbawindow.obj \
16068 + $(SLO)$/vbasystem.obj \
16069 + $(SLO)$/vbarangehelper.obj \
16070 + $(SLO)$/vbarange.obj \
16071 + $(SLO)$/vbabookmark.obj \
16072 + $(SLO)$/vbabookmarks.obj \
16073 + $(SLO)$/vbavariable.obj \
16074 + $(SLO)$/vbavariables.obj \
16075 + $(SLO)$/vbaview.obj \
16076 + $(SLO)$/wordvbahelper.obj \
16077 + $(SLO)$/service.obj \
16078 + $(SLO)$/vbadocumentproperties.obj \
16079 + $(SLO)$/vbapane.obj \
16080 + $(SLO)$/vbapanes.obj \
16081 + $(SLO)$/vbaoptions.obj \
16082 + $(SLO)$/vbaselection.obj \
16084 +# --- Targets ------------------------------------------------------
16086 +.INCLUDE : target.mk
16089 + $(MISC)$/$(TARGET).don \
16091 +$(SLOFILES) : $(MISC)$/$(TARGET).don
16093 +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
16094 + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
16097 --- sw/source/ui/vba/service.cxx.old 1970-01-01 00:00:00.000000000 +0000
16098 +++ sw/source/ui/vba/service.cxx 2009-04-06 16:42:01.000000000 +0000
16100 +/*************************************************************************
16102 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16104 + * Copyright 2008 by Sun Microsystems, Inc.
16106 + * OpenOffice.org - a multi-platform office productivity suite
16108 + * $RCSfile: service.cxx,v $
16109 + * $Revision: 1.4 $
16111 + * This file is part of OpenOffice.org.
16113 + * OpenOffice.org is free software: you can redistribute it and/or modify
16114 + * it under the terms of the GNU Lesser General Public License version 3
16115 + * only, as published by the Free Software Foundation.
16117 + * OpenOffice.org is distributed in the hope that it will be useful,
16118 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16119 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16120 + * GNU Lesser General Public License version 3 for more details
16121 + * (a copy is included in the LICENSE file that accompanied this code).
16123 + * You should have received a copy of the GNU Lesser General Public License
16124 + * version 3 along with OpenOffice.org. If not, see
16125 + * <http://www.openoffice.org/license.html>
16126 + * for a copy of the LGPLv3 License.
16128 + ************************************************************************/
16129 +#include "cppuhelper/implementationentry.hxx"
16130 +#include "com/sun/star/lang/XMultiServiceFactory.hpp"
16131 +#include "com/sun/star/registry/XRegistryKey.hpp"
16132 +#include "comphelper/servicedecl.hxx"
16134 +// =============================================================================
16135 +// component exports
16136 +// =============================================================================
16137 +using namespace ::com::sun::star;
16138 +using namespace ::com::sun::star::uno;
16140 +namespace sdecl = comphelper::service_decl;
16144 +extern sdecl::ServiceDecl const serviceDecl;
16147 +namespace document
16149 +extern sdecl::ServiceDecl const serviceDecl;
16154 + void SAL_CALL component_getImplementationEnvironment(
16155 + const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
16157 + OSL_TRACE("In component_getImplementationEnv");
16158 + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
16161 + sal_Bool SAL_CALL component_writeInfo(
16162 + lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
16164 + OSL_TRACE("In component_writeInfo");
16166 + // Component registration
16167 + return component_writeInfoHelper( pServiceManager, pRegistryKey,
16168 + globals::serviceDecl, document::serviceDecl );
16171 + void * SAL_CALL component_getFactory(
16172 + const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
16173 + registry::XRegistryKey * pRegistryKey )
16175 + OSL_TRACE("In component_getFactory for %s", pImplName );
16176 + void* pRet = component_getFactoryHelper(
16177 + pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl );
16178 + OSL_TRACE("Ret is 0x%x", pRet);
16182 --- sw/source/ui/vba/vbaapplication.cxx.old 1970-01-01 00:00:00.000000000 +0000
16183 +++ sw/source/ui/vba/vbaapplication.cxx 2009-04-06 16:42:01.000000000 +0000
16185 +/*************************************************************************
16187 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16189 + * Copyright 2008 by Sun Microsystems, Inc.
16191 + * OpenOffice.org - a multi-platform office productivity suite
16193 + * $RCSfile: vbaapplication.cxx,v $
16194 + * $Revision: 1.7 $
16196 + * This file is part of OpenOffice.org.
16198 + * OpenOffice.org is free software: you can redistribute it and/or modify
16199 + * it under the terms of the GNU Lesser General Public License version 3
16200 + * only, as published by the Free Software Foundation.
16202 + * OpenOffice.org is distributed in the hope that it will be useful,
16203 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16204 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16205 + * GNU Lesser General Public License version 3 for more details
16206 + * (a copy is included in the LICENSE file that accompanied this code).
16208 + * You should have received a copy of the GNU Lesser General Public License
16209 + * version 3 along with OpenOffice.org. If not, see
16210 + * <http://www.openoffice.org/license.html>
16211 + * for a copy of the LGPLv3 License.
16213 + ************************************************************************/
16214 +#include <stdio.h>
16215 +#include "vbaapplication.hxx"
16216 +#include "vbadocument.hxx"
16217 +#include <osl/file.hxx>
16218 +#include <vbahelper/vbahelper.hxx>
16219 +#include "vbawindow.hxx"
16220 +#include "vbasystem.hxx"
16221 +#include "vbaoptions.hxx"
16222 +#include "vbaselection.hxx"
16224 +using namespace ::ooo;
16225 +using namespace ::ooo::vba;
16226 +using namespace ::com::sun::star;
16228 +using ::com::sun::star::uno::Reference;
16229 +using ::com::sun::star::uno::UNO_QUERY_THROW;
16230 +using ::com::sun::star::uno::UNO_QUERY;
16231 +using ::rtl::OUString;
16233 +// Enable our own join detection for Intersection and Union
16234 +// should be more efficient than using ScRangeList::Join ( because
16235 +// we already are testing the same things )
16237 +#define OWN_JOIN 1
16239 +// #TODO is this defined somewhere else?
16240 +#if ( defined UNX ) || ( defined OS2 ) //unix
16241 +#define FILE_PATH_SEPERATOR "/"
16243 +#define FILE_PATH_SEPERATOR "\\"
16246 +#define EXCELVERSION "11.0"
16248 +uno::Any sbxToUnoValue( SbxVariable* pVar );
16250 +SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext )
16254 +SwVbaApplication::~SwVbaApplication()
16258 +rtl::OUString SAL_CALL
16259 +SwVbaApplication::getName() throw (uno::RuntimeException)
16261 + static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
16265 +uno::Reference< word::XDocument > SAL_CALL
16266 +SwVbaApplication::getActiveDocument() throw (uno::RuntimeException)
16268 + return new SwVbaDocument( this, mxContext, getCurrentDocument() );
16271 +uno::Reference< word::XWindow > SAL_CALL
16272 +SwVbaApplication::getActiveWindow() throw (uno::RuntimeException)
16274 + // #FIXME sofar can't determine Parent
16275 + return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, getCurrentDocument() );
16278 +uno::Reference<word::XSystem > SAL_CALL
16279 +SwVbaApplication::getSystem() throw (uno::RuntimeException)
16281 + return uno::Reference< word::XSystem >( new SwVbaSystem( mxContext ) );
16284 +uno::Reference<word::XOptions > SAL_CALL
16285 +SwVbaApplication::getOptions() throw (uno::RuntimeException)
16287 + return uno::Reference< word::XOptions >( new SwVbaOptions( mxContext ) );
16291 +SwVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
16293 + return VbaApplicationBase::CommandBars( aIndex );
16296 +uno::Reference< word::XSelection > SAL_CALL
16297 +SwVbaApplication::getSelection() throw (uno::RuntimeException)
16299 + return new SwVbaSelection( this, mxContext, getCurrentDocument() );
16303 +SwVbaApplication::getServiceImplName()
16305 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
16306 + return sImplName;
16309 +uno::Sequence< rtl::OUString >
16310 +SwVbaApplication::getServiceNames()
16312 + static uno::Sequence< rtl::OUString > aServiceNames;
16313 + if ( aServiceNames.getLength() == 0 )
16315 + aServiceNames.realloc( 1 );
16316 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Application" ) );
16318 + return aServiceNames;
16320 --- sw/source/ui/vba/vbaapplication.hxx.old 1970-01-01 00:00:00.000000000 +0000
16321 +++ sw/source/ui/vba/vbaapplication.hxx 2009-04-06 16:42:01.000000000 +0000
16323 +/*************************************************************************
16325 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16327 + * Copyright 2008 by Sun Microsystems, Inc.
16329 + * OpenOffice.org - a multi-platform office productivity suite
16331 + * $RCSfile: vbaapplication.hxx,v $
16332 + * $Revision: 1.4 $
16334 + * This file is part of OpenOffice.org.
16336 + * OpenOffice.org is free software: you can redistribute it and/or modify
16337 + * it under the terms of the GNU Lesser General Public License version 3
16338 + * only, as published by the Free Software Foundation.
16340 + * OpenOffice.org is distributed in the hope that it will be useful,
16341 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16342 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16343 + * GNU Lesser General Public License version 3 for more details
16344 + * (a copy is included in the LICENSE file that accompanied this code).
16346 + * You should have received a copy of the GNU Lesser General Public License
16347 + * version 3 along with OpenOffice.org. If not, see
16348 + * <http://www.openoffice.org/license.html>
16349 + * for a copy of the LGPLv3 License.
16351 + ************************************************************************/
16352 +#ifndef SW_VBA_APPLICATION_HXX
16353 +#define SW_VBA_APPLICATION_HXX
16355 +#include <ooo/vba/word/XApplication.hpp>
16356 +#include <ooo/vba/word/XDocument.hpp>
16357 +#include <ooo/vba/word/XWindow.hpp>
16358 +#include <ooo/vba/word/XSystem.hpp>
16359 +#include <ooo/vba/word/XOptions.hpp>
16360 +#include <ooo/vba/word/XSelection.hpp>
16361 +#include <vbahelper/vbahelperinterface.hxx>
16362 +#include <vbahelper/vbaapplicationbase.hxx>
16363 +#include <cppuhelper/implbase1.hxx>
16365 +//typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
16366 +typedef cppu::ImplInheritanceHelper1< VbaApplicationBase, ooo::vba::word::XApplication > SwVbaApplication_BASE;
16368 +class SwVbaApplication : public SwVbaApplication_BASE
16371 + SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
16372 + virtual ~SwVbaApplication();
16375 + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
16376 + virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
16377 + virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException);
16378 + virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
16379 + virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
16380 + virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException);
16381 + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
16382 + // XHelperInterface
16383 + virtual rtl::OUString& getServiceImplName();
16384 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
16386 +#endif /* SW_VBA_APPLICATION_HXX */
16387 --- sw/source/ui/vba/vbabookmark.cxx.old 1970-01-01 00:00:00.000000000 +0000
16388 +++ sw/source/ui/vba/vbabookmark.cxx 2009-04-06 16:42:01.000000000 +0000
16390 +/*************************************************************************
16392 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16394 + * Copyright 2008 by Sun Microsystems, Inc.
16396 + * OpenOffice.org - a multi-platform office productivity suite
16401 + * This file is part of OpenOffice.org.
16403 + * OpenOffice.org is free software: you can redistribute it and/or modify
16404 + * it under the terms of the GNU Lesser General Public License version 3
16405 + * only, as published by the Free Software Foundation.
16407 + * OpenOffice.org is distributed in the hope that it will be useful,
16408 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16409 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16410 + * GNU Lesser General Public License version 3 for more details
16411 + * (a copy is included in the LICENSE file that accompanied this code).
16413 + * You should have received a copy of the GNU Lesser General Public License
16414 + * version 3 along with OpenOffice.org. If not, see
16415 + * <http://www.openoffice.org/license.html>
16416 + * for a copy of the LGPLv3 License.
16418 + ************************************************************************/
16419 +#include "vbabookmark.hxx"
16420 +#include <vbahelper/vbahelper.hxx>
16421 +#include <tools/diagnose_ex.h>
16422 +#include <com/sun/star/text/XTextDocument.hpp>
16423 +#include <com/sun/star/text/XTextContent.hpp>
16424 +#include <com/sun/star/text/XTextViewCursor.hpp>
16425 +#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
16426 +#include "vbarange.hxx"
16428 +using namespace ::ooo::vba;
16429 +using namespace ::com::sun::star;
16431 +SwVbaBookmark::SwVbaBookmark( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
16432 + const css::uno::Reference< frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException ) :
16433 + SwVbaBookmark_BASE( rParent, rContext ), mxModel( rModel ), maName( rName ), mbValid( sal_True )
16435 + uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxModel, uno::UNO_QUERY_THROW );
16436 + mxBookmark.set( xBookmarksSupplier->getBookmarks()->getByName( maName ), uno::UNO_QUERY_THROW );
16439 +SwVbaBookmark::~SwVbaBookmark()
16443 +void SwVbaBookmark::checkVality() throw ( uno::RuntimeException )
16446 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The bookmark is not valid" ) ), uno::Reference< uno::XInterface >() );
16449 +void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
16452 + uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
16453 + xTextDocument->getText()->removeTextContent( mxBookmark );
16454 + mbValid = sal_False;
16457 +void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
16460 + uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
16461 + xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
16464 +rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
16469 +void SAL_CALL SwVbaBookmark::setName( const rtl::OUString& _name ) throw ( uno::RuntimeException )
16471 + uno::Reference< container::XNamed > xNamed( mxBookmark, uno::UNO_QUERY_THROW );
16472 + xNamed->setName( _name );
16475 +uno::Any SAL_CALL SwVbaBookmark::Range() throw ( uno::RuntimeException )
16477 + uno::Reference< text::XTextContent > xTextContent( mxBookmark, uno::UNO_QUERY_THROW );
16478 + uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
16479 + return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextContent->getAnchor()->getStart(), xTextContent->getAnchor()->getEnd() ) ) );
16483 +SwVbaBookmark::getServiceImplName()
16485 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmark") );
16486 + return sImplName;
16489 +uno::Sequence< rtl::OUString >
16490 +SwVbaBookmark::getServiceNames()
16492 + static uno::Sequence< rtl::OUString > aServiceNames;
16493 + if ( aServiceNames.getLength() == 0 )
16495 + aServiceNames.realloc( 1 );
16496 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmark" ) );
16498 + return aServiceNames;
16501 --- sw/source/ui/vba/vbabookmark.hxx.old 1970-01-01 00:00:00.000000000 +0000
16502 +++ sw/source/ui/vba/vbabookmark.hxx 2009-04-06 16:42:01.000000000 +0000
16504 +/*************************************************************************
16506 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16508 + * Copyright 2008 by Sun Microsystems, Inc.
16510 + * OpenOffice.org - a multi-platform office productivity suite
16515 + * This file is part of OpenOffice.org.
16517 + * OpenOffice.org is free software: you can redistribute it and/or modify
16518 + * it under the terms of the GNU Lesser General Public License version 3
16519 + * only, as published by the Free Software Foundation.
16521 + * OpenOffice.org is distributed in the hope that it will be useful,
16522 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16523 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16524 + * GNU Lesser General Public License version 3 for more details
16525 + * (a copy is included in the LICENSE file that accompanied this code).
16527 + * You should have received a copy of the GNU Lesser General Public License
16528 + * version 3 along with OpenOffice.org. If not, see
16529 + * <http://www.openoffice.org/license.html>
16530 + * for a copy of the LGPLv3 License.
16532 + ************************************************************************/
16533 +#ifndef SW_VBA_BOOKMARK_HXX
16534 +#define SW_VBA_BOOKMARK_HXX
16536 +#include <ooo/vba/word/XBookmark.hpp>
16537 +#include <vbahelper/vbahelperinterface.hxx>
16538 +#include <cppuhelper/implbase1.hxx>
16539 +#include <com/sun/star/text/XBookmarksSupplier.hpp>
16540 +#include <com/sun/star/text/XTextContent.hpp>
16542 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XBookmark > SwVbaBookmark_BASE;
16544 +class SwVbaBookmark : public SwVbaBookmark_BASE
16547 + css::uno::Reference< css::frame::XModel > mxModel;
16548 + css::uno::Reference< css::text::XTextContent > mxBookmark;
16549 + rtl::OUString maName;
16550 + sal_Bool mbValid;
16553 + void checkVality() throw ( css::uno::RuntimeException );
16556 + SwVbaBookmark( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
16557 + const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException );
16558 + virtual ~SwVbaBookmark();
16561 + virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException );
16562 + virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException );
16563 + virtual void SAL_CALL Delete() throw ( css::uno::RuntimeException );
16564 + virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
16565 + virtual css::uno::Any SAL_CALL Range() throw ( css::uno::RuntimeException );
16567 + // XHelperInterface
16568 + virtual rtl::OUString& getServiceImplName();
16569 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
16571 +#endif /* SW_VBA_BOOKMARK_HXX */
16572 --- sw/source/ui/vba/vbabookmarks.cxx.old 1970-01-01 00:00:00.000000000 +0000
16573 +++ sw/source/ui/vba/vbabookmarks.cxx 2009-04-06 16:42:01.000000000 +0000
16575 +/*************************************************************************
16577 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16579 + * Copyright 2008 by Sun Microsystems, Inc.
16581 + * OpenOffice.org - a multi-platform office productivity suite
16586 + * This file is part of OpenOffice.org.
16588 + * OpenOffice.org is free software: you can redistribute it and/or modify
16589 + * it under the terms of the GNU Lesser General Public License version 3
16590 + * only, as published by the Free Software Foundation.
16592 + * OpenOffice.org is distributed in the hope that it will be useful,
16593 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16594 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16595 + * GNU Lesser General Public License version 3 for more details
16596 + * (a copy is included in the LICENSE file that accompanied this code).
16598 + * You should have received a copy of the GNU Lesser General Public License
16599 + * version 3 along with OpenOffice.org. If not, see
16600 + * <http://www.openoffice.org/license.html>
16601 + * for a copy of the LGPLv3 License.
16603 + ************************************************************************/
16604 +#include "vbabookmarks.hxx"
16605 +#include "vbabookmark.hxx"
16606 +#include <com/sun/star/container/XNamed.hpp>
16607 +#include <com/sun/star/text/XTextDocument.hpp>
16608 +#include <com/sun/star/text/XTextViewCursor.hpp>
16609 +#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
16610 +#include <ooo/vba/word/WdBookmarkSortBy.hpp>
16611 +#include "vbarange.hxx"
16613 +using namespace ::ooo::vba;
16614 +using namespace ::com::sun::star;
16616 +class BookmarksEnumeration : public EnumerationHelperImpl
16618 + uno::Reference< frame::XModel > mxModel;
16619 + uno::WeakReference< XHelperInterface > mxParent;
16621 + BookmarksEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {}
16623 + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
16625 + uno::Reference< container::XNamed > xNamed( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
16626 + rtl::OUString aName = xNamed->getName();
16627 + return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( mxParent, m_xContext, mxModel, aName ) ) );
16632 +SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, xBookmarks ), mxModel( xModel )
16634 + mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW );
16635 + uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
16636 + mxText = xDocument->getText();
16638 + // FIXME: fail to rename the bookmark
16639 + // word doesn't distinguish cases, so set all bookmarknames to Lowercase
16640 + //renameAllBookmarksToLowercase();
16642 +// XEnumerationAccess
16644 +SwVbaBookmarks::getElementType() throw (uno::RuntimeException)
16646 + return word::XBookmark::static_type(0);
16648 +uno::Reference< container::XEnumeration >
16649 +SwVbaBookmarks::createEnumeration() throw (uno::RuntimeException)
16651 + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
16652 + return new BookmarksEnumeration( getParent(), mxContext,xEnumAccess->createEnumeration(), mxModel );
16656 +SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
16658 + uno::Reference< container::XNamed > xNamed( aSource, uno::UNO_QUERY_THROW );
16659 + rtl::OUString aName = xNamed->getName();
16660 + return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
16663 +void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
16665 + uno::Reference< text::XTextContent > xBookmark( mxBookmarksSupplier->getBookmarks()->getByName( rName ), uno::UNO_QUERY_THROW );
16666 + mxText->removeTextContent( xBookmark );
16669 +void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
16671 + uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
16672 + uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
16673 + uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
16674 + xNamed->setName( rName );
16675 + mxText->insertTextContent( rTextRange, xBookmark, sal_False );
16678 +void SwVbaBookmarks::renameAllBookmarksToLowercase() throw (uno::RuntimeException)
16680 + uno::Reference< container::XIndexAccess > xBookmarks( mxBookmarksSupplier->getBookmarks(),uno::UNO_QUERY_THROW );
16681 + for( sal_Int32 nIndex = 0; nIndex < xBookmarks->getCount(); nIndex++ )
16683 + uno::Reference< container::XNamed > xNamed( xBookmarks->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
16684 + rtl::OUString aName = xNamed->getName();
16685 + rtl::OUString aNameLowerCase = aName.toAsciiLowerCase();
16686 + if( !aName.equals( aNameLowerCase ) );
16687 + xNamed->setName( aNameLowerCase );
16692 +SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw (uno::RuntimeException)
16694 + uno::Reference< text::XTextRange > xTextRange;
16695 + uno::Reference< word::XRange > xRange;
16696 + if( rRange >>= xRange )
16698 + SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( xRange.get() );
16700 + xTextRange = pRange->getXTextRange();
16704 + // FIXME: insert the bookmark into current view cursor
16705 + uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
16706 + xTextRange.set( xViewCursorSupplier->getViewCursor(), uno::UNO_QUERY_THROW );
16709 + // remove the exist bookmark
16710 + rtl::OUString aName = rName.toAsciiLowerCase();
16711 + if( mxBookmarksSupplier->getBookmarks()->hasByName( aName ) )
16712 + removeBookmarkByName( aName );
16714 + addBookmarkByName( aName, xTextRange );
16716 + return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
16719 +sal_Int32 SAL_CALL
16720 +SwVbaBookmarks::getDefaultSorting() throw (css::uno::RuntimeException)
16722 + return word::WdBookmarkSortBy::wdSortByName;
16726 +SwVbaBookmarks::setDefaultSorting( sal_Int32/* _type*/ ) throw (css::uno::RuntimeException)
16728 + // not support in Writer
16732 +SwVbaBookmarks::getShowHidden() throw (css::uno::RuntimeException)
16738 +SwVbaBookmarks::setShowHidden( sal_Bool /*_hidden*/ ) throw (css::uno::RuntimeException)
16740 + // not support in Writer
16744 +SwVbaBookmarks::Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException)
16746 + sal_Bool bExist = mxBookmarksSupplier->getBookmarks()->hasByName( rName.toAsciiLowerCase() );
16751 +SwVbaBookmarks::getServiceImplName()
16753 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmarks") );
16754 + return sImplName;
16757 +css::uno::Sequence<rtl::OUString>
16758 +SwVbaBookmarks::getServiceNames()
16760 + static uno::Sequence< rtl::OUString > sNames;
16761 + if ( sNames.getLength() == 0 )
16763 + sNames.realloc( 1 );
16764 + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmarks") );
16768 --- sw/source/ui/vba/vbabookmarks.hxx.old 1970-01-01 00:00:00.000000000 +0000
16769 +++ sw/source/ui/vba/vbabookmarks.hxx 2009-04-06 16:42:01.000000000 +0000
16771 +/*************************************************************************
16773 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16775 + * Copyright 2008 by Sun Microsystems, Inc.
16777 + * OpenOffice.org - a multi-platform office productivity suite
16782 + * This file is part of OpenOffice.org.
16784 + * OpenOffice.org is free software: you can redistribute it and/or modify
16785 + * it under the terms of the GNU Lesser General Public License version 3
16786 + * only, as published by the Free Software Foundation.
16788 + * OpenOffice.org is distributed in the hope that it will be useful,
16789 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16790 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16791 + * GNU Lesser General Public License version 3 for more details
16792 + * (a copy is included in the LICENSE file that accompanied this code).
16794 + * You should have received a copy of the GNU Lesser General Public License
16795 + * version 3 along with OpenOffice.org. If not, see
16796 + * <http://www.openoffice.org/license.html>
16797 + * for a copy of the LGPLv3 License.
16799 + ************************************************************************/
16800 +#ifndef SW_VBA_BOOKMARKS_HXX
16801 +#define SW_VBA_BOOKMARKS_HXX
16803 +#include <vbahelper/vbacollectionimpl.hxx>
16804 +#include <ooo/vba/word/XBookmarks.hpp>
16805 +#include <com/sun/star/container/XEnumerationAccess.hpp>
16806 +#include <com/sun/star/container/XIndexAccess.hpp>
16807 +#include <vbahelper/vbahelperinterface.hxx>
16808 +#include <com/sun/star/text/XBookmarksSupplier.hpp>
16809 +#include <com/sun/star/text/XTextRange.hpp>
16810 +#include <com/sun/star/text/XText.hpp>
16812 +typedef CollTestImplHelper< ooo::vba::word::XBookmarks > SwVbaBookmarks_BASE;
16814 +class SwVbaBookmarks : public SwVbaBookmarks_BASE
16817 + css::uno::Reference< css::frame::XModel > mxModel;
16818 + css::uno::Reference< css::text::XBookmarksSupplier > mxBookmarksSupplier;
16819 + css::uno::Reference< css::text::XText > mxText;
16822 + void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
16823 + void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
16824 + void renameAllBookmarksToLowercase() throw (css::uno::RuntimeException);
16827 + SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
16828 + virtual ~SwVbaBookmarks() {}
16830 + // XEnumerationAccess
16831 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
16832 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
16834 + // SwVbaBookmarks_BASE
16835 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
16836 + virtual rtl::OUString& getServiceImplName();
16837 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
16840 + virtual sal_Int32 SAL_CALL getDefaultSorting() throw (css::uno::RuntimeException);
16841 + virtual void SAL_CALL setDefaultSorting( sal_Int32 _type ) throw (css::uno::RuntimeException);
16842 + virtual sal_Bool SAL_CALL getShowHidden() throw (css::uno::RuntimeException);
16843 + virtual void SAL_CALL setShowHidden( sal_Bool _hidden ) throw (css::uno::RuntimeException);
16845 + virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rRange ) throw (css::uno::RuntimeException);
16846 + virtual sal_Bool SAL_CALL Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
16849 +#endif /* SW_VBA_BOOKMARKS_HXX */
16850 --- sw/source/ui/vba/vbadocument.cxx.old 1970-01-01 00:00:00.000000000 +0000
16851 +++ sw/source/ui/vba/vbadocument.cxx 2009-04-06 16:42:01.000000000 +0000
16853 +/*************************************************************************
16855 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
16857 + * Copyright 2008 by Sun Microsystems, Inc.
16859 + * OpenOffice.org - a multi-platform office productivity suite
16861 + * $RCSfile: vbadocument.cxx,v $
16862 + * $Revision: 1.7 $
16864 + * This file is part of OpenOffice.org.
16866 + * OpenOffice.org is free software: you can redistribute it and/or modify
16867 + * it under the terms of the GNU Lesser General Public License version 3
16868 + * only, as published by the Free Software Foundation.
16870 + * OpenOffice.org is distributed in the hope that it will be useful,
16871 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16872 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16873 + * GNU Lesser General Public License version 3 for more details
16874 + * (a copy is included in the LICENSE file that accompanied this code).
16876 + * You should have received a copy of the GNU Lesser General Public License
16877 + * version 3 along with OpenOffice.org. If not, see
16878 + * <http://www.openoffice.org/license.html>
16879 + * for a copy of the LGPLv3 License.
16881 + ************************************************************************/
16882 +#include "vbadocument.hxx"
16883 +#include "vbarange.hxx"
16884 +#include "vbarangehelper.hxx"
16885 +#include "vbadocumentproperties.hxx"
16886 +#include "vbabookmarks.hxx"
16887 +#include "vbavariables.hxx"
16888 +#include <com/sun/star/text/XBookmarksSupplier.hpp>
16889 +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
16890 +#include <com/sun/star/document/XDocumentProperties.hpp>
16891 +#include <vbahelper/helperdecl.hxx>
16893 +using namespace ::ooo::vba;
16894 +using namespace ::com::sun::star;
16896 +SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ): SwVbaDocument_BASE( xParent, xContext, xModel )
16900 +SwVbaDocument::SwVbaDocument( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaDocument_BASE( aArgs, xContext )
16905 +SwVbaDocument::~SwVbaDocument()
16909 +void SwVbaDocument::Initialize()
16911 + mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW );
16914 +uno::Reference< word::XRange > SAL_CALL
16915 +SwVbaDocument::getContent() throw ( uno::RuntimeException )
16917 + uno::Reference< text::XTextRange > xStart = mxTextDocument->getText()->getStart();
16918 + uno::Reference< text::XTextRange > xEnd;
16919 + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd, sal_True ) );
16922 +uno::Reference< word::XRange > SAL_CALL
16923 +SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno::RuntimeException )
16925 + if( !rStart.hasValue() && !rEnd.hasValue() )
16926 + return getContent();
16928 + sal_Int32 nStart = 0;
16929 + sal_Int32 nEnd = 0;
16930 + rStart >>= nStart;
16935 + uno::Reference< text::XTextRange > xStart;
16936 + uno::Reference< text::XTextRange > xEnd;
16937 + if( nStart != -1 || nEnd != -1 )
16939 + if( nStart == -1 )
16940 + xStart = mxTextDocument->getText()->getStart();
16942 + xStart = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nStart );
16945 + xEnd = mxTextDocument->getText()->getEnd();
16947 + xEnd = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nEnd );
16950 + if( !xStart.is() && !xEnd.is() )
16955 + xStart = mxTextDocument->getText()->getStart();
16956 + xEnd = mxTextDocument->getText()->getEnd();
16958 + catch( uno::Exception )
16960 + DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
16963 + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd ) );
16967 +SwVbaDocument::BuiltInDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
16969 + uno::Reference< XCollection > xCol( new SwVbaBuiltinDocumentProperties( mxParent, mxContext, getModel() ) );
16970 + if ( index.hasValue() )
16971 + return xCol->Item( index, uno::Any() );
16972 + return uno::makeAny( xCol );
16976 +SwVbaDocument::CustomDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
16978 + uno::Reference< XCollection > xCol( new SwVbaCustomDocumentProperties( mxParent, mxContext, getModel() ) );
16979 + if ( index.hasValue() )
16980 + return xCol->Item( index, uno::Any() );
16981 + return uno::makeAny( xCol );
16985 +SwVbaDocument::Bookmarks( const uno::Any& rIndex ) throw ( uno::RuntimeException )
16987 + uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW );
16988 + uno::Reference<container::XIndexAccess > xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
16989 + uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, getModel() ) );
16990 + if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
16991 + return uno::makeAny( xBookmarksVba );
16993 + return uno::Any( xBookmarksVba->Item( rIndex, uno::Any() ) );
16997 +SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException )
16999 + uno::Reference< document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW );
17000 + uno::Reference< document::XDocumentProperties > xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
17001 + uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
17003 + uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) );
17004 + if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
17005 + return uno::makeAny( xVariables );
17007 + return uno::Any( xVariables->Item( rIndex, uno::Any() ) );
17011 +SwVbaDocument::getServiceImplName()
17013 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument") );
17014 + return sImplName;
17017 +uno::Sequence< rtl::OUString >
17018 +SwVbaDocument::getServiceNames()
17020 + static uno::Sequence< rtl::OUString > aServiceNames;
17021 + if ( aServiceNames.getLength() == 0 )
17023 + aServiceNames.realloc( 1 );
17024 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Document" ) );
17026 + return aServiceNames;
17029 +namespace document
17031 +namespace sdecl = comphelper::service_decl;
17032 +sdecl::vba_service_class_<SwVbaDocument, sdecl::with_args<true> > serviceImpl;
17033 +extern sdecl::ServiceDecl const serviceDecl(
17036 + "ooo.vba.word.Document" );
17039 --- sw/source/ui/vba/vbadocument.hxx.old 1970-01-01 00:00:00.000000000 +0000
17040 +++ sw/source/ui/vba/vbadocument.hxx 2009-04-06 16:42:01.000000000 +0000
17042 +/*************************************************************************
17044 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17046 + * Copyright 2008 by Sun Microsystems, Inc.
17048 + * OpenOffice.org - a multi-platform office productivity suite
17050 + * $RCSfile: vbadocument.hxx,v $
17051 + * $Revision: 1.4 $
17053 + * This file is part of OpenOffice.org.
17055 + * OpenOffice.org is free software: you can redistribute it and/or modify
17056 + * it under the terms of the GNU Lesser General Public License version 3
17057 + * only, as published by the Free Software Foundation.
17059 + * OpenOffice.org is distributed in the hope that it will be useful,
17060 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17061 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17062 + * GNU Lesser General Public License version 3 for more details
17063 + * (a copy is included in the LICENSE file that accompanied this code).
17065 + * You should have received a copy of the GNU Lesser General Public License
17066 + * version 3 along with OpenOffice.org. If not, see
17067 + * <http://www.openoffice.org/license.html>
17068 + * for a copy of the LGPLv3 License.
17070 + ************************************************************************/
17071 +#ifndef SW_VBA_DOCUMENT_HXX
17072 +#define SW_VBA_DOCUMENT_HXX
17074 +#include <ooo/vba/word/XDocument.hpp>
17075 +#include <vbahelper/vbahelperinterface.hxx>
17076 +#include <vbahelper/vbadocumentbase.hxx>
17077 +#include <com/sun/star/text/XTextDocument.hpp>
17079 +typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ooo::vba::word::XDocument > SwVbaDocument_BASE;
17081 +class SwVbaDocument : public SwVbaDocument_BASE
17084 + css::uno::Reference< css::text::XTextDocument > mxTextDocument;
17086 + void Initialize();
17088 + SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, css::uno::Reference< css::frame::XModel > xModel );
17089 + SwVbaDocument( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
17090 + virtual ~SwVbaDocument();
17093 + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getContent() throw ( css::uno::RuntimeException );
17094 + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Range( const css::uno::Any& rStart, const css::uno::Any& rEnd ) throw ( css::uno::RuntimeException );
17095 + virtual css::uno::Any SAL_CALL BuiltInDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
17096 + virtual css::uno::Any SAL_CALL CustomDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
17097 + virtual css::uno::Any SAL_CALL Bookmarks( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
17098 + virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
17100 + // XHelperInterface
17101 + virtual rtl::OUString& getServiceImplName();
17102 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
17104 +#endif /* SW_VBA_DOCUMENT_HXX */
17105 --- sw/source/ui/vba/vbadocumentproperties.cxx.old 1970-01-01 00:00:00.000000000 +0000
17106 +++ sw/source/ui/vba/vbadocumentproperties.cxx 2009-04-06 16:42:01.000000000 +0000
17108 +/*************************************************************************
17110 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17112 + * Copyright 2008 by Sun Microsystems, Inc.
17114 + * OpenOffice.org - a multi-platform office productivity suite
17116 + * $RCSfile: vbadocument.cxx,v $
17117 + * $Revision: 1.7 $
17119 + * This file is part of OpenOffice.org.
17121 + * OpenOffice.org is free software: you can redistribute it and/or modify
17122 + * it under the terms of the GNU Lesser General Public License version 3
17123 + * only, as published by the Free Software Foundation.
17125 + * OpenOffice.org is distributed in the hope that it will be useful,
17126 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17127 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17128 + * GNU Lesser General Public License version 3 for more details
17129 + * (a copy is included in the LICENSE file that accompanied this code).
17131 + * You should have received a copy of the GNU Lesser General Public License
17132 + * version 3 along with OpenOffice.org. If not, see
17133 + * <http://www.openoffice.org/license.html>
17134 + * for a copy of the LGPLv3 License.
17136 + ************************************************************************/
17137 +#include "vbadocumentproperties.hxx"
17138 +#include <cppuhelper/implbase1.hxx>
17139 +#include <cppuhelper/implbase3.hxx>
17140 +#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
17141 +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
17142 +#include <com/sun/star/beans/NamedValue.hpp>
17143 +#include <com/sun/star/beans/XPropertyContainer.hpp>
17144 +#include <ooo/vba/word/WdBuiltInProperty.hpp>
17145 +#include <ooo/vba/office/MsoDocProperties.hpp>
17147 +#include <boost/shared_ptr.hpp>
17148 +#include "wordvbahelper.hxx"
17149 +#include "fesh.hxx"
17150 +#include "docsh.hxx"
17151 +using namespace ::ooo::vba;
17152 +using namespace css;
17154 +sal_Int8 lcl_toMSOPropType( const uno::Type& aType ) throw ( lang::IllegalArgumentException )
17156 + sal_Int16 msoType = office::MsoDocProperties::msoPropertyTypeString;
17158 + switch ( aType.getTypeClass() )
17160 + case uno::TypeClass_BOOLEAN:
17161 + msoType = office::MsoDocProperties::msoPropertyTypeBoolean;
17163 + case uno::TypeClass_FLOAT:
17164 + msoType = office::MsoDocProperties::msoPropertyTypeFloat;
17166 + case uno::TypeClass_STRUCT: // Assume date
17167 + msoType = office::MsoDocProperties::msoPropertyTypeDate;
17169 + case uno::TypeClass_BYTE:
17170 + case uno::TypeClass_SHORT:
17171 + case uno::TypeClass_LONG:
17172 + case uno::TypeClass_HYPER:
17173 + msoType = office::MsoDocProperties::msoPropertyTypeNumber;
17176 + throw lang::IllegalArgumentException();
17181 +class PropertGetSetHelper
17184 + uno::Reference< frame::XModel > m_xModel;
17185 + uno::Reference< beans::XPropertySet > mxProps;
17187 + PropertGetSetHelper( const uno::Reference< frame::XModel >& xModel ):m_xModel( xModel )
17189 + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW );
17190 + mxProps.set( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
17192 + virtual ~PropertGetSetHelper() {}
17193 + virtual uno::Any getPropertyValue( const rtl::OUString& rPropName ) = 0;
17194 + virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue ) = 0;
17195 + virtual uno::Reference< beans::XPropertySet > getUnoProperties() { return mxProps; }
17199 +class BuiltinPropertyGetSetHelper : public PropertGetSetHelper
17202 + BuiltinPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel )
17205 + virtual uno::Any getPropertyValue( const rtl::OUString& rPropName )
17207 + if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EditingDuration" ) ) ) )
17209 + sal_Int32 nSecs = 0;
17210 + mxProps->getPropertyValue( rPropName ) >>= nSecs;
17211 + return uno::makeAny( nSecs/60 ); // minutes
17213 + return mxProps->getPropertyValue( rPropName );
17215 + virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue )
17217 + mxProps->setPropertyValue( rPropName, aValue );
17221 +class CustomPropertyGetSetHelper : public BuiltinPropertyGetSetHelper
17224 + CustomPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :BuiltinPropertyGetSetHelper( xModel )
17226 + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( mxProps, uno::UNO_QUERY_THROW );
17227 + uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
17228 + mxProps.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
17231 +class StatisticPropertyGetSetHelper : public PropertGetSetHelper
17233 + SwDocShell* mpDocShell;
17234 + uno::Reference< beans::XPropertySet > mxModelProps;
17236 + StatisticPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel ) , mpDocShell( NULL )
17238 + mxModelProps.set( m_xModel, uno::UNO_QUERY_THROW );
17239 + mpDocShell = word::getDocShell( xModel );
17241 + virtual uno::Any getPropertyValue( const rtl::OUString& rPropName )
17243 + uno::Sequence< beans::NamedValue > stats;
17246 + // Characters, ParagraphCount & WordCount are available from
17247 + // the model ( and addtionally these also update the statics object )
17248 + //return mxProps->getPropertyValue( rPropName );
17249 + return mxModelProps->getPropertyValue( rPropName );
17251 + catch( uno::Exception& )
17253 + OSL_TRACE("Got exception");
17255 + uno::Any aReturn;
17256 + if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount")) ) ) // special processing needed
17258 + if ( mpDocShell )
17260 + SwFEShell* pFEShell = mpDocShell->GetFEShell();
17263 + aReturn <<= pFEShell->GetLineCount(FALSE);
17269 + mxModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphCount") ) ) >>= stats;
17270 + mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats;
17272 + sal_Int32 nLen = stats.getLength();
17273 + bool bFound = false;
17274 + for ( sal_Int32 index = 0; index < nLen && !bFound ; ++index )
17276 + if ( rPropName.equals( stats[ index ].Name ) )
17278 + aReturn = stats[ index ].Value;
17283 + throw uno::RuntimeException(); // bad Property
17288 + virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue )
17291 + uno::Sequence< beans::NamedValue > stats;
17292 + mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats;
17294 + sal_Int32 nLen = stats.getLength();
17295 + for ( sal_Int32 index = 0; index < nLen; ++index )
17297 + if ( rPropName.equals( stats[ index ].Name ) )
17299 + stats[ index ].Value = aValue;
17300 + mxProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ), uno::makeAny( stats ) );
17310 + rtl::OUString msMSODesc;
17311 + rtl::OUString msOOOPropName;
17312 + boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper;
17314 + static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
17316 + return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
17319 + static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
17321 + DocPropInfo aItem;
17322 + aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
17323 + aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
17324 + aItem.mpPropGetSetHelper = rHelper;
17327 + uno::Any getValue()
17329 + if ( mpPropGetSetHelper.get() )
17330 + return mpPropGetSetHelper->getPropertyValue( msOOOPropName );
17331 + return uno::Any();
17333 + void setValue( const uno::Any& rValue )
17335 + if ( mpPropGetSetHelper.get() )
17336 + mpPropGetSetHelper->setPropertyValue( msOOOPropName, rValue );
17338 + uno::Reference< beans::XPropertySet > getUnoProperties()
17341 + uno::Reference< beans::XPropertySet > xProps;
17342 + if ( mpPropGetSetHelper.get() )
17343 + return mpPropGetSetHelper->getUnoProperties();
17349 +typedef std::hash_map< sal_Int32, DocPropInfo > MSOIndexToOODocPropInfo;
17351 +class BuiltInIndexHelper
17353 + MSOIndexToOODocPropInfo m_docPropInfoMap;
17354 + BuiltInIndexHelper();
17356 + BuiltInIndexHelper( const uno::Reference< frame::XModel >& xModel )
17358 + boost::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) );
17359 + boost::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) );
17361 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17362 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17363 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17364 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17365 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17366 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17367 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17368 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17369 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17370 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17371 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17372 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17373 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // Not sure if this is correct
17374 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
17375 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
17376 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
17377 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
17378 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
17379 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
17380 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
17381 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
17382 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else )
17383 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling
17384 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling
17385 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
17386 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
17387 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
17388 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
17389 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
17390 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to be supported
17392 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper );
17393 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper );
17394 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", aStandardHelper );
17395 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", aStandardHelper );
17396 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", aStandardHelper );
17397 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", aStandardHelper );
17398 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "ModifiedBy", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17399 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "EditingCycles", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17400 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17401 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
17402 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", aStandardHelper );
17403 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", aStandardHelper );
17404 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", aStandardHelper ); // Not sure if this is correct
17405 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", aUsingStatsHelper ); // special handling required ?
17406 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", aUsingStatsHelper ); // special handling require ?
17407 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", aUsingStatsHelper ); // special handling required ?
17408 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", aStandardHelper ); // doesn't seem to exist
17409 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "Category", aStandardHelper ); // hacked in
17410 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", aStandardHelper ); // doesn't seem to exist
17411 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "Manager", aStandardHelper ); // hacked in
17412 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "Company", aStandardHelper ); // hacked in
17413 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else )
17414 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", aUsingStatsHelper ); // special handling
17415 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "ParagraphCount", aUsingStatsHelper ); // special handling
17416 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , aStandardHelper ); // doesn't seem to exist
17417 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", aStandardHelper ); // doesn't seem to exist
17418 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", aStandardHelper ); // doesn't seem to exist
17419 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", aStandardHelper ); // doesn't seem to exist
17420 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", aStandardHelper );
17421 + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", aStandardHelper ); // doesn't seem to be supported
17424 + MSOIndexToOODocPropInfo& getDocPropInfoMap() { return m_docPropInfoMap; }
17428 +typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentProperty > SwVbaDocumentProperty_BASE;
17430 +class SwVbaBuiltInDocumentProperty : public SwVbaDocumentProperty_BASE
17433 + DocPropInfo mPropInfo;
17435 + SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo );
17436 + // XDocumentProperty
17437 + virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException);
17438 + virtual ::rtl::OUString SAL_CALL getName( ) throw (script::BasicErrorException, uno::RuntimeException);
17439 + virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException);
17440 + virtual ::sal_Int8 SAL_CALL getType( ) throw (script::BasicErrorException, uno::RuntimeException);
17441 + virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException);
17442 + virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException);
17443 + virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException);
17444 + virtual uno::Any SAL_CALL getValue( ) throw (script::BasicErrorException, uno::RuntimeException);
17445 + virtual void SAL_CALL setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException);
17446 + virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException);
17447 + virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException);
17448 + //XDefaultProperty
17449 + virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException) { return rtl::OUString::createFromAscii("Value"); }
17450 + // XHelperInterface
17451 + virtual rtl::OUString& getServiceImplName();
17452 + virtual uno::Sequence<rtl::OUString> getServiceNames();
17455 +class SwVbaCustomDocumentProperty : public SwVbaBuiltInDocumentProperty
17459 + SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo );
17461 + virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException);
17462 + virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException);
17464 + virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException);
17465 + virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException);
17466 + virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException);
17467 + virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException);
17468 + virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException);
17473 +SwVbaCustomDocumentProperty::SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaBuiltInDocumentProperty( xParent, xContext, rInfo )
17478 +SwVbaCustomDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException)
17480 + // #FIXME we need to store the link content somewhere
17481 + return sal_False;
17485 +SwVbaCustomDocumentProperty::setLinkToContent( sal_Bool /*bLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
17490 +SwVbaCustomDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException)
17492 + // #FIXME we need to store the link content somewhere
17493 + return rtl::OUString();;
17497 +SwVbaCustomDocumentProperty::setLinkSource( const rtl::OUString& /*rsLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
17499 + // #FIXME we need to store the link source somewhere
17503 +SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException)
17505 + // setName on existing property ?
17507 + // do we need to delete existing property and create a new one?
17511 +SwVbaCustomDocumentProperty::setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException)
17513 + // setType, do we need to do a conversion?
17514 + // #FIXME the underlying value needs to be changed to the new type
17518 +SwVbaCustomDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
17520 + uno::Reference< beans::XPropertyContainer > xContainer( mPropInfo.getUnoProperties(), uno::UNO_QUERY_THROW );
17521 + xContainer->removeProperty( getName() );
17524 +SwVbaBuiltInDocumentProperty::SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaDocumentProperty_BASE( xParent, xContext ), mPropInfo( rInfo )
17529 +SwVbaBuiltInDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
17531 + // not valid for Builtin
17532 + throw uno::RuntimeException();
17535 +::rtl::OUString SAL_CALL
17536 +SwVbaBuiltInDocumentProperty::getName( ) throw (script::BasicErrorException, uno::RuntimeException)
17538 + return mPropInfo.msMSODesc;
17542 +SwVbaBuiltInDocumentProperty::setName( const rtl::OUString& ) throw (script::BasicErrorException, uno::RuntimeException)
17544 + // not valid for Builtin
17545 + throw uno::RuntimeException();
17548 +::sal_Int8 SAL_CALL
17549 +SwVbaBuiltInDocumentProperty::getType( ) throw (script::BasicErrorException, uno::RuntimeException)
17551 + return lcl_toMSOPropType( getValue().getValueType() );
17555 +SwVbaBuiltInDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException)
17557 + // not valid for Builtin
17558 + throw uno::RuntimeException();
17561 +::sal_Bool SAL_CALL
17562 +SwVbaBuiltInDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException)
17564 + return sal_False; // built-in always false
17568 +SwVbaBuiltInDocumentProperty::setLinkToContent( ::sal_Bool /*LinkToContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
17570 + // not valid for Builtin
17571 + throw uno::RuntimeException();
17575 +SwVbaBuiltInDocumentProperty::getValue( ) throw (script::BasicErrorException, uno::RuntimeException)
17577 + uno::Any aRet = mPropInfo.getValue();
17578 + if ( !aRet.hasValue() )
17579 + throw uno::RuntimeException();
17584 +SwVbaBuiltInDocumentProperty::setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException)
17586 + mPropInfo.setValue( Value );
17589 +rtl::OUString SAL_CALL
17590 +SwVbaBuiltInDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException)
17592 + // not valid for Builtin
17593 + throw uno::RuntimeException();
17597 +SwVbaBuiltInDocumentProperty::setLinkSource( const rtl::OUString& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
17599 + // not valid for Builtin
17600 + throw uno::RuntimeException();
17604 +SwVbaBuiltInDocumentProperty::getServiceImplName()
17606 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperty") );
17607 + return sImplName;
17610 +uno::Sequence<rtl::OUString>
17611 +SwVbaBuiltInDocumentProperty::getServiceNames()
17613 + static uno::Sequence< rtl::OUString > aServiceNames;
17614 + if ( aServiceNames.getLength() == 0 )
17616 + aServiceNames.realloc( 1 );
17617 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperty" ) );
17619 + return aServiceNames;
17621 +typedef ::cppu::WeakImplHelper3< com::sun::star::container::XIndexAccess
17622 + ,com::sun::star::container::XNameAccess
17623 + ,com::sun::star::container::XEnumerationAccess
17624 + > PropertiesImpl_BASE;
17626 +typedef std::hash_map< sal_Int32, uno::Reference< XDocumentProperty > > DocProps;
17628 +typedef ::cppu::WeakImplHelper1< com::sun::star::container::XEnumeration > DocPropEnumeration_BASE;
17629 +class DocPropEnumeration : public DocPropEnumeration_BASE
17631 + DocProps mDocProps;
17632 + DocProps::iterator mIt;
17635 + DocPropEnumeration( const DocProps& rProps ) : mDocProps( rProps ), mIt( mDocProps.begin() ) {}
17636 + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
17638 + return mIt != mDocProps.end();
17640 + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
17642 + if ( !hasMoreElements() )
17643 + throw container::NoSuchElementException();
17644 + return uno::makeAny( mIt++->second );
17648 +typedef std::hash_map< rtl::OUString, uno::Reference< XDocumentProperty >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > DocPropsByName;
17650 +class BuiltInPropertiesImpl : public PropertiesImpl_BASE
17654 + uno::Reference< XHelperInterface > m_xParent;
17655 + uno::Reference< uno::XComponentContext > m_xContext;
17656 + uno::Reference< frame::XModel > m_xModel;
17657 + uno::Reference< document::XDocumentInfo > m_xOOOBuiltIns;
17659 + DocProps mDocProps;
17660 + DocPropsByName mNamedDocProps;
17663 + BuiltInPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel )
17665 + BuiltInIndexHelper builtIns( m_xModel );
17666 + for ( sal_Int32 index = word::WdBuiltInProperty::wdPropertyTitle; index <= word::WdBuiltInProperty::wdPropertyCharsWSpaces; ++index )
17668 + mDocProps[ index ] = new SwVbaBuiltInDocumentProperty( xParent, xContext, builtIns.getDocPropInfoMap()[ index ] );
17669 + mNamedDocProps[ mDocProps[ index ]->getName() ] = mDocProps[ index ];
17673 + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
17675 + return mDocProps.size();
17677 + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException )
17679 + // correct the correct by the base class for 1 based indices
17680 + DocProps::iterator it = mDocProps.find( ++Index );
17681 + if ( it == mDocProps.end() )
17682 + throw lang::IndexOutOfBoundsException();
17683 + return uno::makeAny( it->second );
17685 + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
17687 + if ( !hasByName( aName ) )
17688 + throw container::NoSuchElementException();
17689 + DocPropsByName::iterator it = mNamedDocProps.find( aName );
17690 + return uno::Any( it->second );
17693 + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
17695 + uno::Sequence< rtl::OUString > aNames( getCount() );
17696 + rtl::OUString* pName = aNames.getArray();
17697 + DocPropsByName::iterator it_end = mNamedDocProps.end();
17698 + for( DocPropsByName::iterator it = mNamedDocProps.begin(); it != it_end; ++it, ++pName )
17699 + *pName = it->first;
17703 + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
17705 + DocPropsByName::iterator it = mNamedDocProps.find( aName );
17706 + if ( it == mNamedDocProps.end() )
17707 + return sal_False;
17711 + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
17713 + return XDocumentProperty::static_type(0);
17715 + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
17717 + return mDocProps.size() > 0;
17719 + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
17721 + return new DocPropEnumeration( mDocProps );
17725 +SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaDocumentproperties_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BuiltInPropertiesImpl( xParent, xContext, xModel ) ) ), m_xModel( xModel )
17729 +uno::Reference< XDocumentProperty > SAL_CALL
17730 +SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& value, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
17732 + throw uno::RuntimeException(
17733 + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("not supported for Builtin properties") ), uno::Reference< uno::XInterface >() );
17736 +// XEnumerationAccess
17737 +uno::Type SAL_CALL
17738 +SwVbaBuiltinDocumentProperties::getElementType() throw (uno::RuntimeException)
17740 + return XDocumentProperty::static_type(0);
17743 +uno::Reference< container::XEnumeration > SAL_CALL
17744 +SwVbaBuiltinDocumentProperties::createEnumeration() throw (uno::RuntimeException)
17746 + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
17747 + return xEnumAccess->createEnumeration();
17750 +// ScVbaCollectionBaseImpl
17752 +SwVbaBuiltinDocumentProperties::createCollectionObject( const uno::Any& aSource )
17758 +// XHelperInterface
17760 +SwVbaBuiltinDocumentProperties::getServiceImplName()
17762 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperties") );
17763 + return sImplName;
17766 +uno::Sequence<rtl::OUString>
17767 +SwVbaBuiltinDocumentProperties::getServiceNames()
17769 + static uno::Sequence< rtl::OUString > aServiceNames;
17770 + if ( aServiceNames.getLength() == 0 )
17772 + aServiceNames.realloc( 1 );
17773 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperties" ) );
17775 + return aServiceNames;
17778 +class CustomPropertiesImpl : public PropertiesImpl_BASE
17780 + uno::Reference< XHelperInterface > m_xParent;
17781 + uno::Reference< uno::XComponentContext > m_xContext;
17782 + uno::Reference< frame::XModel > m_xModel;
17783 + uno::Reference< beans::XPropertySet > mxUserDefinedProp;
17784 + boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper;
17786 + CustomPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel )
17788 + // suck in the document( custom ) properties
17789 + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW );
17790 + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
17791 + uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
17792 + mxUserDefinedProp.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
17793 + mpPropGetSetHelper.reset( new CustomPropertyGetSetHelper( m_xModel ) );
17796 + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
17798 + return mxUserDefinedProp->getPropertySetInfo()->getProperties().getLength();
17801 + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException )
17803 + uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties();
17804 + if ( Index >= aProps.getLength() )
17805 + throw lang::IndexOutOfBoundsException();
17806 + // How to determine type e.g Date? ( com.sun.star.util.DateTime )
17807 + DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aProps[ Index ].Name, aProps[ Index ].Name, mpPropGetSetHelper );
17808 + return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) );
17811 + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
17813 + if ( !hasByName( aName ) )
17814 + throw container::NoSuchElementException();
17816 + DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aName, aName, mpPropGetSetHelper );
17817 + return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) );
17820 + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
17822 + uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties();
17823 + uno::Sequence< rtl::OUString > aNames( aProps.getLength() );
17824 + rtl::OUString* pString = aNames.getArray();
17825 + rtl::OUString* pEnd = ( pString + aNames.getLength() );
17826 + beans::Property* pProp = aProps.getArray();
17827 + for ( ; pString != pEnd; ++pString, ++pProp )
17828 + *pString = pProp->Name;
17832 + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
17834 + OSL_TRACE("hasByName(%s) returns %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName ) );
17835 + return mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName );
17838 + // XElementAccess
17839 + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
17841 + return XDocumentProperty::static_type(0);
17844 + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
17846 + return getCount() > 0;
17849 + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
17851 + // create a map of properties ( the key doesn't matter )
17852 + OSL_TRACE("Creating an enumeration");
17853 + sal_Int32 key = 0;
17854 + sal_Int32 nElem = getCount();
17855 + DocProps simpleDocPropSnapShot;
17856 + for ( ; key < nElem; ++key )
17857 + simpleDocPropSnapShot[ key ].set( getByIndex( key ), uno::UNO_QUERY_THROW );
17858 + OSL_TRACE("After creating the enumeration");
17859 + return new DocPropEnumeration( simpleDocPropSnapShot );
17862 + void addProp( const ::rtl::OUString& Name, ::sal_Int8 Type, const uno::Any& Value )
17864 + sal_Int16 attributes = 128;
17865 + uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW );
17866 + // TODO fixme, perform the necessary Type Value conversions
17867 + xContainer->addProperty( Name, attributes, Value );
17873 +SwVbaCustomDocumentProperties::SwVbaCustomDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaBuiltinDocumentProperties( xParent, xContext, xModel )
17875 + // replace the m_xIndexAccess implementation ( we need a virtual init )
17876 + m_xIndexAccess.set( new CustomPropertiesImpl( xParent, xContext, xModel ) );
17877 + m_xNameAccess.set( m_xIndexAccess, uno::UNO_QUERY_THROW );
17880 +uno::Reference< XDocumentProperty > SAL_CALL
17881 +SwVbaCustomDocumentProperties::Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const uno::Any& Value, const uno::Any& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException)
17883 + CustomPropertiesImpl* pCustomProps = dynamic_cast< CustomPropertiesImpl* > ( m_xIndexAccess.get() );
17884 + uno::Reference< XDocumentProperty > xDocProp;
17885 + if ( pCustomProps )
17887 + rtl::OUString sLinkSource;
17888 + pCustomProps->addProp( Name, Type, Value );
17890 + xDocProp.set( m_xNameAccess->getByName( Name ), uno::UNO_QUERY_THROW );
17891 + xDocProp->setLinkToContent( LinkToContent );
17893 + if ( LinkSource >>= sLinkSource )
17894 + xDocProp->setLinkSource( sLinkSource );
17899 +// XHelperInterface
17901 +SwVbaCustomDocumentProperties::getServiceImplName()
17903 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCustomDocumentProperties") );
17904 + return sImplName;
17906 --- sw/source/ui/vba/vbadocumentproperties.hxx.old 1970-01-01 00:00:00.000000000 +0000
17907 +++ sw/source/ui/vba/vbadocumentproperties.hxx 2009-04-06 16:42:01.000000000 +0000
17909 +/*************************************************************************
17911 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17913 + * Copyright 2008 by Sun Microsystems, Inc.
17915 + * OpenOffice.org - a multi-platform office productivity suite
17917 + * $RCSfile: vbadocument.hxx,v $
17918 + * $Revision: 1.4 $
17920 + * This file is part of OpenOffice.org.
17922 + * OpenOffice.org is free software: you can redistribute it and/or modify
17923 + * it under the terms of the GNU Lesser General Public License version 3
17924 + * only, as published by the Free Software Foundation.
17926 + * OpenOffice.org is distributed in the hope that it will be useful,
17927 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
17928 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17929 + * GNU Lesser General Public License version 3 for more details
17930 + * (a copy is included in the LICENSE file that accompanied this code).
17932 + * You should have received a copy of the GNU Lesser General Public License
17933 + * version 3 along with OpenOffice.org. If not, see
17934 + * <http://www.openoffice.org/license.html>
17935 + * for a copy of the LGPLv3 License.
17937 + ************************************************************************/
17938 +#ifndef SW_VBA_DOCUMENTPROPERTIES_HXX
17939 +#define SW_VBA_DOCUMENTPROPERTIES_HXX
17941 +#include <ooo/vba/XDocumentProperties.hpp>
17942 +#include <com/sun/star/frame/XModel.hpp>
17943 +#include <vbahelper/vbacollectionimpl.hxx>
17944 +#include <hash_map>
17946 +typedef CollTestImplHelper< ov::XDocumentProperties > SwVbaDocumentproperties_BASE;
17948 +class SwVbaBuiltinDocumentProperties : public SwVbaDocumentproperties_BASE
17951 + css::uno::Reference< css::frame::XModel > m_xModel;
17953 + SwVbaBuiltinDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
17955 + // XDocumentProperties
17956 + virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
17957 + // XEnumerationAccess
17958 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
17959 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
17960 + // ScVbaCollectionBaseImpl
17961 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
17963 + // XHelperInterface
17964 + virtual rtl::OUString& getServiceImplName();
17965 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
17968 +class SwVbaCustomDocumentProperties : public SwVbaBuiltinDocumentProperties
17971 + SwVbaCustomDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
17972 +// XDocumentProperties
17973 + virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
17974 + // XHelperInterface
17975 + virtual rtl::OUString& getServiceImplName();
17978 +#endif /* SW_VBA_DOCUMENTPROPERTY_HXX */
17979 --- sw/source/ui/vba/vbaglobals.cxx.old 1970-01-01 00:00:00.000000000 +0000
17980 +++ sw/source/ui/vba/vbaglobals.cxx 2009-04-06 16:42:01.000000000 +0000
17982 +/*************************************************************************
17984 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17986 + * Copyright 2008 by Sun Microsystems, Inc.
17988 + * OpenOffice.org - a multi-platform office productivity suite
17990 + * $RCSfile: vbaglobals.cxx,v $
17991 + * $Revision: 1.4 $
17993 + * This file is part of OpenOffice.org.
17995 + * OpenOffice.org is free software: you can redistribute it and/or modify
17996 + * it under the terms of the GNU Lesser General Public License version 3
17997 + * only, as published by the Free Software Foundation.
17999 + * OpenOffice.org is distributed in the hope that it will be useful,
18000 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18001 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18002 + * GNU Lesser General Public License version 3 for more details
18003 + * (a copy is included in the LICENSE file that accompanied this code).
18005 + * You should have received a copy of the GNU Lesser General Public License
18006 + * version 3 along with OpenOffice.org. If not, see
18007 + * <http://www.openoffice.org/license.html>
18008 + * for a copy of the LGPLv3 License.
18010 + ************************************************************************/
18011 +#include <vbahelper/helperdecl.hxx>
18012 +#include "vbaglobals.hxx"
18014 +#include <comphelper/unwrapargs.hxx>
18016 +#include <com/sun/star/lang/XMultiComponentFactory.hpp>
18017 +#include <com/sun/star/beans/XPropertySet.hpp>
18018 +#include <com/sun/star/container/XNameContainer.hpp>
18019 +#include <cppuhelper/bootstrap.hxx>
18020 +#include "vbaapplication.hxx"
18021 +using namespace ::com::sun::star;
18022 +using namespace ::com::sun::star::uno;
18023 +using namespace ::ooo::vba;
18027 +// =============================================================================
18029 +// =============================================================================
18031 +SwVbaGlobals::SwVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext )
18033 + OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
18034 + init( rxContext, uno::makeAny( getApplication() ) );
18037 +SwVbaGlobals::~SwVbaGlobals()
18039 + OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
18042 +// =============================================================================
18044 +// =============================================================================
18045 +uno::Reference<word::XApplication >
18046 +SwVbaGlobals::getApplication() throw (uno::RuntimeException)
18048 + OSL_TRACE("In SwVbaGlobals::getApplication");
18049 + static uno::Reference< word::XApplication > WordApplication( new SwVbaApplication( mxContext) );
18050 + return WordApplication;
18053 +uno::Reference<word::XSystem > SAL_CALL
18054 +SwVbaGlobals::getSystem() throw (uno::RuntimeException)
18056 + return getApplication()->getSystem();
18059 +uno::Reference< word::XDocument > SAL_CALL
18060 +SwVbaGlobals::getActiveDocument() throw (uno::RuntimeException)
18062 + return getApplication()->getActiveDocument();
18065 +uno::Reference< word::XWindow > SAL_CALL
18066 +SwVbaGlobals::getActiveWindow() throw (uno::RuntimeException)
18068 + return getApplication()->getActiveWindow();
18071 +rtl::OUString SAL_CALL
18072 +SwVbaGlobals::getName() throw (uno::RuntimeException)
18074 + return getApplication()->getName();
18077 +uno::Reference<word::XOptions > SAL_CALL
18078 +SwVbaGlobals::getOptions() throw (uno::RuntimeException)
18080 + return getApplication()->getOptions();
18084 +SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
18086 + return getApplication()->CommandBars( aIndex );
18089 +uno::Reference<word::XSelection > SAL_CALL
18090 +SwVbaGlobals::getSelection() throw (uno::RuntimeException)
18092 + return getApplication()->getSelection();
18096 +SwVbaGlobals::getServiceImplName()
18098 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaGlobals") );
18099 + return sImplName;
18102 +uno::Sequence< rtl::OUString >
18103 +SwVbaGlobals::getServiceNames()
18105 + static uno::Sequence< rtl::OUString > aServiceNames;
18106 + if ( aServiceNames.getLength() == 0 )
18108 + aServiceNames.realloc( 1 );
18109 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals" ) );
18111 + return aServiceNames;
18114 +uno::Sequence< rtl::OUString >
18115 +SwVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
18117 + static bool bInit = false;
18118 + static uno::Sequence< rtl::OUString > serviceNames( SwVbaGlobals_BASE::getAvailableServiceNames() );
18121 + rtl::OUString names[] = {
18122 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Document" ) ),
18123 +// #FIXME #TODO make Application a proper service
18124 +// ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Application" ) ),
18126 + sal_Int32 nWordServices = ( sizeof( names )/ sizeof( names[0] ) );
18127 + sal_Int32 startIndex = serviceNames.getLength();
18128 + serviceNames.realloc( serviceNames.getLength() + nWordServices );
18129 + for ( sal_Int32 index = 0; index < nWordServices; ++index )
18130 + serviceNames[ startIndex + index ] = names[ index ];
18133 + return serviceNames;
18138 +namespace sdecl = comphelper::service_decl;
18139 +sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<false> > serviceImpl;
18140 +extern sdecl::ServiceDecl const serviceDecl(
18143 + "ooo.vba.word.Globals" );
18146 --- sw/source/ui/vba/vbaglobals.hxx.old 1970-01-01 00:00:00.000000000 +0000
18147 +++ sw/source/ui/vba/vbaglobals.hxx 2009-04-06 16:42:01.000000000 +0000
18149 +/*************************************************************************
18151 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18153 + * Copyright 2008 by Sun Microsystems, Inc.
18155 + * OpenOffice.org - a multi-platform office productivity suite
18157 + * $RCSfile: vbaglobals.hxx,v $
18158 + * $Revision: 1.4 $
18160 + * This file is part of OpenOffice.org.
18162 + * OpenOffice.org is free software: you can redistribute it and/or modify
18163 + * it under the terms of the GNU Lesser General Public License version 3
18164 + * only, as published by the Free Software Foundation.
18166 + * OpenOffice.org is distributed in the hope that it will be useful,
18167 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18168 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18169 + * GNU Lesser General Public License version 3 for more details
18170 + * (a copy is included in the LICENSE file that accompanied this code).
18172 + * You should have received a copy of the GNU Lesser General Public License
18173 + * version 3 along with OpenOffice.org. If not, see
18174 + * <http://www.openoffice.org/license.html>
18175 + * for a copy of the LGPLv3 License.
18177 + ************************************************************************/
18178 +#ifndef SW_VBA_GLOBALS_HXX
18179 +#define SW_VBA_GLOBALS_HXX
18181 +#include <com/sun/star/lang/XServiceInfo.hpp>
18182 +#include <com/sun/star/lang/XInitialization.hpp>
18183 +#include <com/sun/star/uno/XComponentContext.hpp>
18184 +#include <ooo/vba/word/XGlobals.hpp>
18185 +#include <ooo/vba/word/XApplication.hpp>
18186 +#include <ooo/vba/word/XSystem.hpp>
18187 +#include <ooo/vba/word/XOptions.hpp>
18188 +#include <ooo/vba/word/XSelection.hpp>
18190 +#include <cppuhelper/implbase1.hxx>
18191 +#include <vbahelper/vbahelper.hxx>
18192 +#include <vbahelper/vbaglobalbase.hxx>
18194 +// =============================================================================
18195 +// class SwVbaGlobals
18196 +// =============================================================================
18199 +typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::word::XGlobals > SwVbaGlobals_BASE;
18201 +class SwVbaGlobals : public SwVbaGlobals_BASE
18204 + css::uno::Reference< ooo::vba::word::XApplication > mxApplication;
18206 + virtual css::uno::Reference< ooo::vba::word::XApplication > getApplication() throw (css::uno::RuntimeException);
18210 + SwVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext );
18211 + virtual ~SwVbaGlobals();
18214 + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
18215 + virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
18216 + virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException);
18217 + virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
18218 + virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
18219 + virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException);
18220 + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
18221 + // XMultiServiceFactory
18222 + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
18224 + // XHelperInterface
18225 + virtual rtl::OUString& getServiceImplName();
18226 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
18228 +#endif /* SW_VBA_GLOBALS_HXX */
18229 --- sw/source/ui/vba/vbaoptions.cxx.old 1970-01-01 00:00:00.000000000 +0000
18230 +++ sw/source/ui/vba/vbaoptions.cxx 2009-04-06 16:42:01.000000000 +0000
18232 +/*************************************************************************
18234 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18236 + * Copyright 2008 by Sun Microoptionss, Inc.
18238 + * OpenOffice.org - a multi-platform office productivity suite
18243 + * This file is part of OpenOffice.org.
18245 + * OpenOffice.org is free software: you can redistribute it and/or modify
18246 + * it under the terms of the GNU Lesser General Public License version 3
18247 + * only, as published by the Free Software Foundation.
18249 + * OpenOffice.org is distributed in the hope that it will be useful,
18250 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18251 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18252 + * GNU Lesser General Public License version 3 for more details
18253 + * (a copy is included in the LICENSE file that accompanied this code).
18255 + * You should have received a copy of the GNU Lesser General Public License
18256 + * version 3 along with OpenOffice.org. If not, see
18257 + * <http://www.openoffice.org/license.html>
18258 + * for a copy of the LGPLv3 License.
18260 + ************************************************************************/
18261 +#include "vbaoptions.hxx"
18262 +#include <vbahelper/vbahelper.hxx>
18263 +#include <ooo/vba/word/WdDefaultFilePath.hpp>
18264 +#include <com/sun/star/util/XStringSubstitution.hpp>
18265 +#include <com/sun/star/beans/XPropertySet.hpp>
18266 +#include <osl/file.hxx>
18268 +using namespace ::ooo::vba;
18269 +using namespace ::com::sun::star;
18271 +SwVbaOptions::SwVbaOptions( uno::Reference<uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : SwVbaOptions_BASE( uno::Reference< XHelperInterface >(), xContext )
18273 + mxFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
18276 +SwVbaOptions::~SwVbaOptions()
18281 +SwVbaOptions::DefaultFilePath( sal_Int32 _path ) throw ( uno::RuntimeException )
18285 + case word::WdDefaultFilePath::wdDocumentsPath:
18287 + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Work") );
18290 + case word::WdDefaultFilePath::wdPicturesPath:
18292 + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gallery") );
18295 + case word::WdDefaultFilePath::wdUserTemplatesPath:
18296 + case word::WdDefaultFilePath::wdWorkgroupTemplatesPath:
18298 + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template") );
18301 + case word::WdDefaultFilePath::wdUserOptionsPath:
18303 + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserConfig") );
18306 + case word::WdDefaultFilePath::wdToolsPath:
18307 + case word::WdDefaultFilePath::wdProgramPath:
18309 + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Module") );
18312 + case word::WdDefaultFilePath::wdTempFilePath:
18314 + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Temp") );
18319 + DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
18323 + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
18326 +void SwVbaOptions::setValueEvent( const uno::Any& value )
18328 + rtl::OUString sNewPath;
18329 + value >>= sNewPath;
18330 + rtl::OUString sNewPathUrl;
18331 + ::osl::File::getFileURLFromSystemPath( sNewPath, sNewPathUrl );
18332 + uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW );
18333 + rtl::OUString sOldPathUrl;
18334 + xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sOldPathUrl;
18335 + // path could be a multipath, Microsoft doesn't support this feature in Word currently
18336 + // only the last path is from interest.
18337 + sal_Int32 nIndex = sOldPathUrl.lastIndexOf( sal_Unicode(';') );
18338 + if( nIndex != -1 )
18340 + sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ).concat( sNewPathUrl );
18342 + xPathSettings->setPropertyValue( msDefaultFilePath, uno::makeAny( sNewPathUrl ) );
18345 +uno::Any SwVbaOptions::getValueEvent()
18347 + uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW );
18348 + rtl::OUString sPathUrl;
18349 + xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sPathUrl;
18350 + // path could be a multipath, Microsoft doesn't support this feature in Word currently
18351 + // only the last path is from interest.
18352 + sal_Int32 nIndex = sPathUrl.lastIndexOf( sal_Unicode(';') );
18353 + if( nIndex != -1 )
18355 + sPathUrl = sPathUrl.copy( nIndex + 1 );
18357 + rtl::OUString sPath;
18358 + ::osl::File::getSystemPathFromFileURL( sPathUrl, sPath );
18359 + return uno::makeAny( sPath );
18363 +SwVbaOptions::getServiceImplName()
18365 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaOptions") );
18366 + return sImplName;
18369 +uno::Sequence< rtl::OUString >
18370 +SwVbaOptions::getServiceNames()
18372 + static uno::Sequence< rtl::OUString > aServiceNames;
18373 + if ( aServiceNames.getLength() == 0 )
18375 + aServiceNames.realloc( 1 );
18376 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Options" ) );
18378 + return aServiceNames;
18380 --- sw/source/ui/vba/vbaoptions.hxx.old 1970-01-01 00:00:00.000000000 +0000
18381 +++ sw/source/ui/vba/vbaoptions.hxx 2009-04-06 16:42:01.000000000 +0000
18383 +/*************************************************************************
18385 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18387 + * Copyright 2008 by Sun Microsystems, Inc.
18389 + * OpenOffice.org - a multi-platform office productivity suite
18391 + * $RCSfile: vbasystem.hxx,v $
18392 + * $Revision: 1.4 $
18394 + * This file is part of OpenOffice.org.
18396 + * OpenOffice.org is free software: you can redistribute it and/or modify
18397 + * it under the terms of the GNU Lesser General Public License version 3
18398 + * only, as published by the Free Software Foundation.
18400 + * OpenOffice.org is distributed in the hope that it will be useful,
18401 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18402 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18403 + * GNU Lesser General Public License version 3 for more details
18404 + * (a copy is included in the LICENSE file that accompanied this code).
18406 + * You should have received a copy of the GNU Lesser General Public License
18407 + * version 3 along with OpenOffice.org. If not, see
18408 + * <http://www.openoffice.org/license.html>
18409 + * for a copy of the LGPLv3 License.
18411 + ************************************************************************/
18412 +#ifndef SW_VBA_OPTIONS_HXX
18413 +#define SW_VBA_OPTIONS_HXX
18415 +#include <ooo/vba/word/XOptions.hpp>
18416 +#include <vbahelper/vbahelperinterface.hxx>
18417 +#include <cppuhelper/implbase1.hxx>
18418 +#include <vbahelper/vbapropvalue.hxx>
18419 +#include <comphelper/processfactory.hxx>
18421 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XOptions > SwVbaOptions_BASE;
18423 +class SwVbaOptions : public SwVbaOptions_BASE,
18424 + public PropListener
18427 + rtl::OUString msDefaultFilePath;
18428 + css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
18430 + SwVbaOptions( css::uno::Reference< css::uno::XComponentContext >& m_xContext ) throw ( css::uno::RuntimeException );
18431 + virtual ~SwVbaOptions();
18434 + virtual css::uno::Any SAL_CALL DefaultFilePath( sal_Int32 _path ) throw ( css::uno::RuntimeException );
18437 + virtual void setValueEvent( const css::uno::Any& value );
18438 + virtual css::uno::Any getValueEvent();
18440 + // XHelperInterface
18441 + virtual rtl::OUString& getServiceImplName();
18442 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
18444 +#endif /* SW_VBA_OPTIONS_HXX */
18445 --- sw/source/ui/vba/vbapane.cxx.old 1970-01-01 00:00:00.000000000 +0000
18446 +++ sw/source/ui/vba/vbapane.cxx 2009-04-06 16:42:01.000000000 +0000
18448 +/*************************************************************************
18450 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18452 + * Copyright 2008 by Sun Microsystems, Inc.
18454 + * OpenOffice.org - a multi-platform office productivity suite
18459 + * This file is part of OpenOffice.org.
18461 + * OpenOffice.org is free software: you can redistribute it and/or modify
18462 + * it under the terms of the GNU Lesser General Public License version 3
18463 + * only, as published by the Free Software Foundation.
18465 + * OpenOffice.org is distributed in the hope that it will be useful,
18466 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18467 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18468 + * GNU Lesser General Public License version 3 for more details
18469 + * (a copy is included in the LICENSE file that accompanied this code).
18471 + * You should have received a copy of the GNU Lesser General Public License
18472 + * version 3 along with OpenOffice.org. If not, see
18473 + * <http://www.openoffice.org/license.html>
18474 + * for a copy of the LGPLv3 License.
18476 + ************************************************************************/
18477 +#include "vbapane.hxx"
18478 +#include <vbahelper/vbahelper.hxx>
18479 +#include <tools/diagnose_ex.h>
18480 +#include "vbaview.hxx"
18482 +using namespace ::ooo::vba;
18483 +using namespace ::com::sun::star;
18485 +SwVbaPane::SwVbaPane( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
18486 + const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) :
18487 + SwVbaPane_BASE( rParent, rContext ), mxModel( xModel )
18491 +SwVbaPane::~SwVbaPane()
18496 +SwVbaPane::View() throw ( css::uno::RuntimeException )
18498 + return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, mxModel ) ) );
18502 +SwVbaPane::Close( ) throw ( css::uno::RuntimeException )
18504 + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseWin"));
18505 + dispatchRequests( mxModel,url );
18509 +SwVbaPane::getServiceImplName()
18511 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPane") );
18512 + return sImplName;
18515 +uno::Sequence< rtl::OUString >
18516 +SwVbaPane::getServiceNames()
18518 + static uno::Sequence< rtl::OUString > aServiceNames;
18519 + if ( aServiceNames.getLength() == 0 )
18521 + aServiceNames.realloc( 1 );
18522 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) );
18524 + return aServiceNames;
18527 --- sw/source/ui/vba/vbapane.hxx.old 1970-01-01 00:00:00.000000000 +0000
18528 +++ sw/source/ui/vba/vbapane.hxx 2009-04-06 16:42:01.000000000 +0000
18530 +/*************************************************************************
18532 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18534 + * Copyright 2008 by Sun Microsystems, Inc.
18536 + * OpenOffice.org - a multi-platform office productivity suite
18541 + * This file is part of OpenOffice.org.
18543 + * OpenOffice.org is free software: you can redistribute it and/or modify
18544 + * it under the terms of the GNU Lesser General Public License version 3
18545 + * only, as published by the Free Software Foundation.
18547 + * OpenOffice.org is distributed in the hope that it will be useful,
18548 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18549 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18550 + * GNU Lesser General Public License version 3 for more details
18551 + * (a copy is included in the LICENSE file that accompanied this code).
18553 + * You should have received a copy of the GNU Lesser General Public License
18554 + * version 3 along with OpenOffice.org. If not, see
18555 + * <http://www.openoffice.org/license.html>
18556 + * for a copy of the LGPLv3 License.
18558 + ************************************************************************/
18559 +#ifndef SW_VBA_PANE_HXX
18560 +#define SW_VBA_PANE_HXX
18562 +#include <ooo/vba/word/XPane.hpp>
18563 +#include <vbahelper/vbahelperinterface.hxx>
18564 +#include <cppuhelper/implbase1.hxx>
18566 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XPane > SwVbaPane_BASE;
18568 +class SwVbaPane : public SwVbaPane_BASE
18571 + css::uno::Reference< css::frame::XModel > mxModel;
18574 + SwVbaPane( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
18575 + const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException );
18576 + virtual ~SwVbaPane();
18579 + virtual css::uno::Any SAL_CALL View( ) throw (css::uno::RuntimeException);
18580 + virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException);
18582 + // XHelperInterface
18583 + virtual rtl::OUString& getServiceImplName();
18584 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
18586 +#endif /* SW_VBA_PANE_HXX */
18587 --- sw/source/ui/vba/vbapanes.cxx.old 1970-01-01 00:00:00.000000000 +0000
18588 +++ sw/source/ui/vba/vbapanes.cxx 2009-04-06 16:42:01.000000000 +0000
18590 +/*************************************************************************
18592 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18594 + * Copyright 2008 by Sun Microsystems, Inc.
18596 + * OpenOffice.org - a multi-platform office productivity suite
18601 + * This file is part of OpenOffice.org.
18603 + * OpenOffice.org is free software: you can redistribute it and/or modify
18604 + * it under the terms of the GNU Lesser General Public License version 3
18605 + * only, as published by the Free Software Foundation.
18607 + * OpenOffice.org is distributed in the hope that it will be useful,
18608 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18609 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18610 + * GNU Lesser General Public License version 3 for more details
18611 + * (a copy is included in the LICENSE file that accompanied this code).
18613 + * You should have received a copy of the GNU Lesser General Public License
18614 + * version 3 along with OpenOffice.org. If not, see
18615 + * <http://www.openoffice.org/license.html>
18616 + * for a copy of the LGPLv3 License.
18618 + ************************************************************************/
18619 +#include "vbapanes.hxx"
18620 +#include "vbapane.hxx"
18622 +using namespace ::ooo::vba;
18623 +using namespace ::com::sun::star;
18625 +// I assume there is only one pane in Writer
18626 +typedef ::cppu::WeakImplHelper1<container::XIndexAccess > PanesIndexAccess_Base;
18627 +class PanesIndexAccess : public PanesIndexAccess_Base
18630 + uno::Reference< XHelperInterface > mxParent;
18631 + uno::Reference< uno::XComponentContext > mxContext;
18632 + uno::Reference< frame::XModel > mxModel;
18635 + PanesIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) {}
18636 + ~PanesIndexAccess(){}
18639 + virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
18643 + virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
18646 + throw container::NoSuchElementException();
18647 + return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( mxParent, mxContext, mxModel ) ) );
18649 + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
18651 + return word::XPane::static_type(0);
18653 + virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
18659 +class PanesEnumWrapper : public EnumerationHelper_BASE
18661 + uno::Reference<container::XIndexAccess > m_xIndexAccess;
18662 + sal_Int32 nIndex;
18664 + PanesEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
18665 + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
18667 + return ( nIndex < m_xIndexAccess->getCount() );
18670 + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
18672 + if ( nIndex < m_xIndexAccess->getCount() )
18673 + return m_xIndexAccess->getByIndex( nIndex++ );
18674 + throw container::NoSuchElementException();
18678 +SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ), mxModel( xModel )
18681 +// XEnumerationAccess
18683 +SwVbaPanes::getElementType() throw (uno::RuntimeException)
18685 + return word::XPane::static_type(0);
18687 +uno::Reference< container::XEnumeration >
18688 +SwVbaPanes::createEnumeration() throw (uno::RuntimeException)
18690 + return new PanesEnumWrapper( m_xIndexAccess );
18694 +SwVbaPanes::createCollectionObject( const css::uno::Any& aSource )
18700 +SwVbaPanes::getServiceImplName()
18702 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPanes") );
18703 + return sImplName;
18706 +css::uno::Sequence<rtl::OUString>
18707 +SwVbaPanes::getServiceNames()
18709 + static uno::Sequence< rtl::OUString > sNames;
18710 + if ( sNames.getLength() == 0 )
18712 + sNames.realloc( 1 );
18713 + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Panes") );
18717 --- sw/source/ui/vba/vbapanes.hxx.old 1970-01-01 00:00:00.000000000 +0000
18718 +++ sw/source/ui/vba/vbapanes.hxx 2009-04-06 16:42:01.000000000 +0000
18720 +/*************************************************************************
18722 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18724 + * Copyright 2008 by Sun Microsystems, Inc.
18726 + * OpenOffice.org - a multi-platform office productivity suite
18731 + * This file is part of OpenOffice.org.
18733 + * OpenOffice.org is free software: you can redistribute it and/or modify
18734 + * it under the terms of the GNU Lesser General Public License version 3
18735 + * only, as published by the Free Software Foundation.
18737 + * OpenOffice.org is distributed in the hope that it will be useful,
18738 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18739 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18740 + * GNU Lesser General Public License version 3 for more details
18741 + * (a copy is included in the LICENSE file that accompanied this code).
18743 + * You should have received a copy of the GNU Lesser General Public License
18744 + * version 3 along with OpenOffice.org. If not, see
18745 + * <http://www.openoffice.org/license.html>
18746 + * for a copy of the LGPLv3 License.
18748 + ************************************************************************/
18749 +#ifndef SW_VBA_PANES_HXX
18750 +#define SW_VBA_PANES_HXX
18752 +#include <vbahelper/vbacollectionimpl.hxx>
18753 +#include <ooo/vba/word/XPanes.hpp>
18754 +#include <com/sun/star/container/XEnumerationAccess.hpp>
18755 +#include <com/sun/star/container/XIndexAccess.hpp>
18756 +#include <vbahelper/vbahelperinterface.hxx>
18758 +typedef CollTestImplHelper< ooo::vba::word::XPanes > SwVbaPanes_BASE;
18760 +class SwVbaPanes : public SwVbaPanes_BASE
18763 + css::uno::Reference< css::frame::XModel > mxModel;
18766 + SwVbaPanes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
18767 + virtual ~SwVbaPanes() {}
18769 + // XEnumerationAccess
18770 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
18771 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
18773 + // SwVbaPanes_BASE
18774 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
18775 + virtual rtl::OUString& getServiceImplName();
18776 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
18779 +#endif /* SW_VBA_PANES_HXX */
18780 --- sw/source/ui/vba/vbarange.cxx.old 1970-01-01 00:00:00.000000000 +0000
18781 +++ sw/source/ui/vba/vbarange.cxx 2009-04-06 16:42:01.000000000 +0000
18783 +/*************************************************************************
18785 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18787 + * Copyright 2008 by Sun Microsystems, Inc.
18789 + * OpenOffice.org - a multi-platform office productivity suite
18794 + * This file is part of OpenOffice.org.
18796 + * OpenOffice.org is free software: you can redistribute it and/or modify
18797 + * it under the terms of the GNU Lesser General Public License version 3
18798 + * only, as published by the Free Software Foundation.
18800 + * OpenOffice.org is distributed in the hope that it will be useful,
18801 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18802 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18803 + * GNU Lesser General Public License version 3 for more details
18804 + * (a copy is included in the LICENSE file that accompanied this code).
18806 + * You should have received a copy of the GNU Lesser General Public License
18807 + * version 3 along with OpenOffice.org. If not, see
18808 + * <http://www.openoffice.org/license.html>
18809 + * for a copy of the LGPLv3 License.
18811 + ************************************************************************/
18812 +#include "vbarange.hxx"
18813 +#include <vbahelper/vbahelper.hxx>
18814 +#include <tools/diagnose_ex.h>
18815 +#include "vbarangehelper.hxx"
18816 +#include <com/sun/star/text/XTextDocument.hpp>
18817 +#include <ooo/vba/word/WdBreakType.hpp>
18818 +#include <com/sun/star/style/BreakType.hpp>
18820 +using namespace ::ooo::vba;
18821 +using namespace ::com::sun::star;
18823 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaBaseRange_BASE;
18825 +class SwVbaBaseRange : public SwVbaBaseRange_BASE
18828 + uno::Reference< text::XTextDocument > mxTextDocument;
18829 + uno::Reference< text::XTextCursor > mxTextCursor;
18830 + uno::Reference< text::XText > mxText;
18831 + sal_Bool mbMaySpanEndOfDocument;
18833 + SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext );
18834 + virtual ~SwVbaBaseRange();
18837 + uno::Reference< text::XTextRange > getXTextRange() throw (uno::RuntimeException);
18840 + virtual rtl::OUString SAL_CALL getText() throw (uno::RuntimeException);
18841 + virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (uno::RuntimeException);
18844 + virtual void SAL_CALL InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException);
18846 + // XHelperInterface
18847 + virtual rtl::OUString& getServiceImplName();
18848 + virtual uno::Sequence<rtl::OUString> getServiceNames();
18852 +SwVbaBaseRange::SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext )
18853 + : SwVbaBaseRange_BASE( rParent, rContext )
18857 +SwVbaBaseRange::~SwVbaBaseRange()
18861 +uno::Reference< text::XTextRange >
18862 +SwVbaBaseRange::getXTextRange() throw (uno::RuntimeException)
18864 + uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW );
18865 + return xTextRange;
18869 +* The complexity in this method is because we need to workaround
18870 +* an issue that the last paragraph in a document does not have a trailing CRLF.
18873 +rtl::OUString SAL_CALL
18874 +SwVbaBaseRange::getText() throw ( uno::RuntimeException )
18876 + rtl::OUString aText = mxTextCursor->getString();
18877 + sal_Int32 nLen = aText.getLength();
18879 + // FIXME: should add a line separator if the range includes the last paragraph
18882 + if( mxTextCursor->isCollapsed() )
18884 + mxTextCursor->goRight( 1, sal_True );
18885 + aText = mxTextCursor->getString();
18886 + mxTextCursor->collapseToStart();
18890 + uno::Reference< text::XTextRange > xStart = mxTextCursor->getStart();
18891 + uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd();
18892 + mxTextCursor->collapseToEnd();
18893 + mxTextCursor->goRight( 1, sal_True );
18894 + mxTextCursor->gotoRange( xStart, sal_False );
18895 + mxTextCursor->gotoRange( xEnd, sal_True );
18903 +SwVbaBaseRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
18905 + if( rText.indexOf( '\n' ) != -1 )
18907 + mxTextCursor->setString( rtl::OUString() );
18908 + // process CR in strings
18909 + uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
18910 + SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
18914 + mxTextCursor->setString( rText );
18918 +// FIXME: test is not pass
18919 +void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
18921 + // default type is wdPageBreak;
18922 + sal_Int32 nBreakType = word::WdBreakType::wdPageBreak;
18923 + if( _breakType.hasValue() )
18924 + _breakType >>= nBreakType;
18926 + style::BreakType eBreakType = style::BreakType_NONE;
18927 + switch( nBreakType )
18929 + case word::WdBreakType::wdPageBreak:
18930 + eBreakType = style::BreakType_PAGE_AFTER;
18932 + case word::WdBreakType::wdColumnBreak:
18933 + eBreakType = style::BreakType_COLUMN_AFTER;
18935 + case word::WdBreakType::wdLineBreak:
18936 + case word::WdBreakType::wdLineBreakClearLeft:
18937 + case word::WdBreakType::wdLineBreakClearRight:
18938 + case word::WdBreakType::wdSectionBreakContinuous:
18939 + case word::WdBreakType::wdSectionBreakEvenPage:
18940 + case word::WdBreakType::wdSectionBreakNextPage:
18941 + case word::WdBreakType::wdSectionBreakOddPage:
18942 + case word::WdBreakType::wdTextWrappingBreak:
18943 + DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
18946 + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
18949 + if( eBreakType != style::BreakType_NONE )
18951 + if( !mxTextCursor->isCollapsed() )
18953 + mxTextCursor->setString( rtl::OUString() );
18954 + mxTextCursor->collapseToStart();
18957 + uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
18958 + xProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( eBreakType ) );
18963 +SwVbaBaseRange::getServiceImplName()
18965 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBaseRange") );
18966 + return sImplName;
18969 +uno::Sequence< rtl::OUString >
18970 +SwVbaBaseRange::getServiceNames()
18972 + static uno::Sequence< rtl::OUString > aServiceNames;
18973 + if ( aServiceNames.getLength() == 0 )
18975 + aServiceNames.realloc( 1 );
18976 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.BaseRange" ) );
18978 + return aServiceNames;
18983 +* class SwVbaDocRange
18985 +class SwVbaDocRange : public SwVbaBaseRange
18988 + SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
18989 + const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart,
18990 + const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False )
18991 + throw ( uno::RuntimeException );
18992 + virtual ~SwVbaDocRange();
18995 +SwVbaDocRange::SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
18996 + const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart,
18997 + const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw ( uno::RuntimeException ) : SwVbaBaseRange( rParent, rContext )
18999 + mxTextDocument = rDocument;
19000 + mbMaySpanEndOfDocument = _bMaySpanEndOfDocument;
19005 + mxText = mxTextDocument->getText();
19007 + mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
19008 + mxTextCursor->collapseToStart();
19011 + mxTextCursor->gotoRange( rEnd, sal_True );
19013 + mxTextCursor->gotoEnd( sal_True );
19016 +SwVbaDocRange::~SwVbaDocRange()
19021 +* class SwVbaRange
19023 +SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
19024 + const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) : SwVbaRange_BASE( rParent, rContext )
19026 + uno::Reference< text::XText > xText;
19027 + mxActualRange = uno::Reference< word::XRange > ( new SwVbaDocRange( rParent, rContext, rTextDocument, rStart, rEnd, xText, _bMaySpanEndOfDocument ) );
19030 +SwVbaRange::~SwVbaRange()
19034 +uno::Reference< text::XTextRange >
19035 +SwVbaRange::getXTextRange() throw (uno::RuntimeException)
19037 + uno::Reference< text::XTextRange > xTextRange;
19038 + SwVbaBaseRange* pBaseRange = dynamic_cast< SwVbaBaseRange* >( mxActualRange.get() );
19040 + xTextRange = pBaseRange->getXTextRange();
19041 + return xTextRange;
19044 +rtl::OUString SAL_CALL
19045 +SwVbaRange::getText() throw ( uno::RuntimeException )
19047 + rtl::OUString aText;
19048 + if( mxActualRange.is() )
19049 + return mxActualRange->getText();
19054 +SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
19056 + if( mxActualRange.is() )
19057 + mxActualRange->setText( rText );
19060 +void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
19062 + if( mxActualRange.is() )
19063 + mxActualRange->InsertBreak( _breakType );
19067 +SwVbaRange::getServiceImplName()
19069 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRange") );
19070 + return sImplName;
19073 +uno::Sequence< rtl::OUString >
19074 +SwVbaRange::getServiceNames()
19076 + static uno::Sequence< rtl::OUString > aServiceNames;
19077 + if ( aServiceNames.getLength() == 0 )
19079 + aServiceNames.realloc( 1 );
19080 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Range" ) );
19082 + return aServiceNames;
19085 --- sw/source/ui/vba/vbarange.hxx.old 1970-01-01 00:00:00.000000000 +0000
19086 +++ sw/source/ui/vba/vbarange.hxx 2009-04-06 16:42:01.000000000 +0000
19088 +/*************************************************************************
19090 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19092 + * Copyright 2008 by Sun Microsystems, Inc.
19094 + * OpenOffice.org - a multi-platform office productivity suite
19099 + * This file is part of OpenOffice.org.
19101 + * OpenOffice.org is free software: you can redistribute it and/or modify
19102 + * it under the terms of the GNU Lesser General Public License version 3
19103 + * only, as published by the Free Software Foundation.
19105 + * OpenOffice.org is distributed in the hope that it will be useful,
19106 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19107 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19108 + * GNU Lesser General Public License version 3 for more details
19109 + * (a copy is included in the LICENSE file that accompanied this code).
19111 + * You should have received a copy of the GNU Lesser General Public License
19112 + * version 3 along with OpenOffice.org. If not, see
19113 + * <http://www.openoffice.org/license.html>
19114 + * for a copy of the LGPLv3 License.
19116 + ************************************************************************/
19117 +#ifndef SW_VBA_RANGE_HXX
19118 +#define SW_VBA_RANGE_HXX
19120 +#include <ooo/vba/word/XRange.hpp>
19121 +#include <vbahelper/vbahelperinterface.hxx>
19122 +#include <cppuhelper/implbase1.hxx>
19123 +#include <com/sun/star/text/XTextRange.hpp>
19124 +#include <com/sun/star/text/XTextDocument.hpp>
19126 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
19128 +class SwVbaRange : public SwVbaRange_BASE
19131 + css::uno::Reference< ooo::vba::word::XRange > mxActualRange;
19134 + SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
19135 + const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False );
19136 + virtual ~SwVbaRange();
19138 + css::uno::Reference< css::text::XTextRange > getXTextRange() throw (css::uno::RuntimeException);
19141 + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
19142 + virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
19145 + virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
19148 + // XHelperInterface
19149 + virtual rtl::OUString& getServiceImplName();
19150 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
19152 +#endif /* SW_VBA_RANGE_HXX */
19153 --- sw/source/ui/vba/vbarangehelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
19154 +++ sw/source/ui/vba/vbarangehelper.cxx 2009-04-06 16:42:01.000000000 +0000
19156 +/*************************************************************************
19158 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19160 + * Copyright 2008 by Sun Microsystems, Inc.
19162 + * OpenOffice.org - a multi-platform office productivity suite
19167 + * This file is part of OpenOffice.org.
19169 + * OpenOffice.org is free software: you can redistribute it and/or modify
19170 + * it under the terms of the GNU Lesser General Public License version 3
19171 + * only, as published by the Free Software Foundation.
19173 + * OpenOffice.org is distributed in the hope that it will be useful,
19174 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19175 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19176 + * GNU Lesser General Public License version 3 for more details
19177 + * (a copy is included in the LICENSE file that accompanied this code).
19179 + * You should have received a copy of the GNU Lesser General Public License
19180 + * version 3 along with OpenOffice.org. If not, see
19181 + * <http://www.openoffice.org/license.html>
19182 + * for a copy of the LGPLv3 License.
19184 + ************************************************************************/
19185 +#include "vbarangehelper.hxx"
19186 +#include <com/sun/star/text/ControlCharacter.hpp>
19188 +using namespace ::ooo::vba;
19189 +using namespace ::com::sun::star;
19192 + * get a range in a xText by creating
19193 + * a cursor that iterates over the text. If the iterating cursor is
19194 + * equal to the desired position, the range equivalent is returned.
19195 + * Some special cases are tables that are inside of the text, because the
19196 + * position has to be adjusted.
19197 + * @param xText a text where a range position is searched
19198 + * @param position a position inside o the text
19199 + * @return a range for the postion; null is returned if no range can be
19202 +uno::Reference< text::XTextRange > SwVbaRangeHelper::getRangeByPosition( const uno::Reference< text::XText >& rText, sal_Int32 _position ) throw ( uno::RuntimeException )
19204 + uno::Reference< text::XTextRange > xRange;
19207 + sal_Int32 nPos = 0;
19208 + uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor();
19209 + xCursor->collapseToStart();
19210 + sal_Bool bCanGo = sal_True;
19211 + while( !xRange.is() && bCanGo )
19213 + if( _position == nPos )
19215 + xRange = xCursor->getStart();
19219 + bCanGo = xCursor->goRight( 1, sal_False );
19228 +void SwVbaRangeHelper::insertString( uno::Reference< text::XTextRange >& rTextRange, uno::Reference< text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( uno::RuntimeException )
19230 + sal_Int32 nlastIndex = 0;
19231 + sal_Int32 nIndex = 0;
19232 + uno::Reference< text::XTextRange > xRange = rTextRange;
19234 + while(( nIndex = rStr.indexOf('\n', nlastIndex)) >= 0 )
19236 + xRange = xRange->getEnd();
19237 + if( nlastIndex < ( nIndex - 1 ) )
19239 + rText->insertString( xRange, rStr.copy( nlastIndex, ( nIndex - 1 - nlastIndex ) ), _bAbsorb );
19240 + xRange = xRange->getEnd();
19243 + rText->insertControlCharacter( xRange, text::ControlCharacter::PARAGRAPH_BREAK, _bAbsorb );
19244 + nlastIndex = nIndex + 1;
19247 + if( nlastIndex < rStr.getLength() )
19249 + xRange = xRange->getEnd();
19251 + rtl::OUString aWatt = rStr.copy( nlastIndex );
19252 + rText->insertString( xRange, aWatt, _bAbsorb );
19256 +uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Reference< text::XTextRange >& rTextRange, const uno::Reference< text::XText >& rText ) throw ( uno::RuntimeException )
19258 + uno::Reference< text::XTextCursor > xTextCursor;
19259 + sal_Bool bGotTextCursor = sal_False;
19263 + xTextCursor = rText->createTextCursorByRange( rTextRange );
19264 + bGotTextCursor = sal_True;
19266 + catch (uno::Exception& e)
19268 + DebugHelper::exception(e);
19271 + if( !bGotTextCursor )
19275 + uno::Reference< text::XText > xText = rTextRange->getText();
19276 + xTextCursor = xText->createTextCursor();
19277 + bGotTextCursor = sal_True;
19279 + catch( uno::Exception& e )
19281 + DebugHelper::exception(e);
19285 + if( !bGotTextCursor )
19289 + xTextCursor = rText->createTextCursor();
19290 + bGotTextCursor = sal_True;
19292 + catch( uno::Exception& e )
19294 + DebugHelper::exception(e);
19297 + return xTextCursor;
19299 --- sw/source/ui/vba/vbarangehelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
19300 +++ sw/source/ui/vba/vbarangehelper.hxx 2009-04-06 16:42:01.000000000 +0000
19302 +/*************************************************************************
19304 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19306 + * Copyright 2008 by Sun Microsystems, Inc.
19308 + * OpenOffice.org - a multi-platform office productivity suite
19313 + * This file is part of OpenOffice.org.
19315 + * OpenOffice.org is free software: you can redistribute it and/or modify
19316 + * it under the terms of the GNU Lesser General Public License version 3
19317 + * only, as published by the Free Software Foundation.
19319 + * OpenOffice.org is distributed in the hope that it will be useful,
19320 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19321 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19322 + * GNU Lesser General Public License version 3 for more details
19323 + * (a copy is included in the LICENSE file that accompanied this code).
19325 + * You should have received a copy of the GNU Lesser General Public License
19326 + * version 3 along with OpenOffice.org. If not, see
19327 + * <http://www.openoffice.org/license.html>
19328 + * for a copy of the LGPLv3 License.
19330 + ************************************************************************/
19331 +#ifndef SW_VBA_RANGEHELPER_HXX
19332 +#define SW_VBA_RANGEHELPER_HXX
19334 +#include <vbahelper/vbahelperinterface.hxx>
19335 +#include <com/sun/star/text/XTextViewCursor.hpp>
19336 +#include <com/sun/star/text/XText.hpp>
19338 +class SwVbaRangeHelper
19341 + static css::uno::Reference< css::text::XTextRange > getRangeByPosition( const css::uno::Reference< css::text::XText >& rText, sal_Int32 _position )throw ( css::uno::RuntimeException );
19342 + static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
19343 + static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
19346 +#endif /* SW_VBA_RANGEHELPER_HXX */
19347 --- sw/source/ui/vba/vbaselection.cxx.old 1970-01-01 00:00:00.000000000 +0000
19348 +++ sw/source/ui/vba/vbaselection.cxx 2009-04-06 16:42:01.000000000 +0000
19350 +/*************************************************************************
19352 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19354 + * Copyright 2008 by Sun Microsystems, Inc.
19356 + * OpenOffice.org - a multi-platform office productivity suite
19361 + * This file is part of OpenOffice.org.
19363 + * OpenOffice.org is free software: you can redistribute it and/or modify
19364 + * it under the terms of the GNU Lesser General Public License version 3
19365 + * only, as published by the Free Software Foundation.
19367 + * OpenOffice.org is distributed in the hope that it will be useful,
19368 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19369 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19370 + * GNU Lesser General Public License version 3 for more details
19371 + * (a copy is included in the LICENSE file that accompanied this code).
19373 + * You should have received a copy of the GNU Lesser General Public License
19374 + * version 3 along with OpenOffice.org. If not, see
19375 + * <http://www.openoffice.org/license.html>
19376 + * for a copy of the LGPLv3 License.
19378 + ************************************************************************/
19379 +#include "vbaselection.hxx"
19380 +#include <vbahelper/vbahelper.hxx>
19381 +#include <tools/diagnose_ex.h>
19383 +using namespace ::ooo::vba;
19384 +using namespace ::com::sun::star;
19386 +SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
19390 +SwVbaSelection::~SwVbaSelection()
19394 +rtl::OUString SAL_CALL
19395 +SwVbaSelection::getText() throw ( uno::RuntimeException )
19397 + rtl::OUString aText;
19402 +SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
19407 +SwVbaSelection::getServiceImplName()
19409 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSelection") );
19410 + return sImplName;
19413 +uno::Sequence< rtl::OUString >
19414 +SwVbaSelection::getServiceNames()
19416 + static uno::Sequence< rtl::OUString > aServiceNames;
19417 + if ( aServiceNames.getLength() == 0 )
19419 + aServiceNames.realloc( 1 );
19420 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Selection" ) );
19422 + return aServiceNames;
19425 --- sw/source/ui/vba/vbaselection.hxx.old 1970-01-01 00:00:00.000000000 +0000
19426 +++ sw/source/ui/vba/vbaselection.hxx 2009-04-06 16:42:01.000000000 +0000
19428 +/*************************************************************************
19430 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19432 + * Copyright 2008 by Sun Microsystems, Inc.
19434 + * OpenOffice.org - a multi-platform office productivity suite
19439 + * This file is part of OpenOffice.org.
19441 + * OpenOffice.org is free software: you can redistribute it and/or modify
19442 + * it under the terms of the GNU Lesser General Public License version 3
19443 + * only, as published by the Free Software Foundation.
19445 + * OpenOffice.org is distributed in the hope that it will be useful,
19446 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19447 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19448 + * GNU Lesser General Public License version 3 for more details
19449 + * (a copy is included in the LICENSE file that accompanied this code).
19451 + * You should have received a copy of the GNU Lesser General Public License
19452 + * version 3 along with OpenOffice.org. If not, see
19453 + * <http://www.openoffice.org/license.html>
19454 + * for a copy of the LGPLv3 License.
19456 + ************************************************************************/
19457 +#ifndef SW_VBA_SELECTION_HXX
19458 +#define SW_VBA_SELECTION_HXX
19460 +#include <ooo/vba/word/XSelection.hpp>
19461 +#include <vbahelper/vbahelperinterface.hxx>
19463 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
19465 +class SwVbaSelection : public SwVbaSelection_BASE
19468 + css::uno::Reference< css::frame::XModel > mxModel;
19471 + SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
19472 + virtual ~SwVbaSelection();
19475 + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
19476 + virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
19479 + // XHelperInterface
19480 + virtual rtl::OUString& getServiceImplName();
19481 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
19483 +#endif /* SW_VBA_SELECTION_HXX */
19484 --- sw/source/ui/vba/vbasystem.cxx.old 1970-01-01 00:00:00.000000000 +0000
19485 +++ sw/source/ui/vba/vbasystem.cxx 2009-04-06 16:42:01.000000000 +0000
19487 +/*************************************************************************
19489 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19491 + * Copyright 2008 by Sun Microsystems, Inc.
19493 + * OpenOffice.org - a multi-platform office productivity suite
19498 + * This file is part of OpenOffice.org.
19500 + * OpenOffice.org is free software: you can redistribute it and/or modify
19501 + * it under the terms of the GNU Lesser General Public License version 3
19502 + * only, as published by the Free Software Foundation.
19504 + * OpenOffice.org is distributed in the hope that it will be useful,
19505 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19506 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19507 + * GNU Lesser General Public License version 3 for more details
19508 + * (a copy is included in the LICENSE file that accompanied this code).
19510 + * You should have received a copy of the GNU Lesser General Public License
19511 + * version 3 along with OpenOffice.org. If not, see
19512 + * <http://www.openoffice.org/license.html>
19513 + * for a copy of the LGPLv3 License.
19515 + ************************************************************************/
19516 +#include "vbasystem.hxx"
19517 +#include <vbahelper/vbahelper.hxx>
19518 +#include <ooo/vba/word/WdCursorType.hpp>
19519 +#include <tools/diagnose_ex.h>
19520 +#include <tools/config.hxx>
19521 +#include <tools/string.hxx>
19522 +#include <osl/file.hxx>
19523 +#include <tools/urlobj.hxx>
19524 +#include <tools/string.hxx>
19526 +using namespace ::ooo::vba;
19527 +using namespace ::com::sun::star;
19529 +PrivateProfileStringListener::PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey )
19530 + :maFileName( rFileName ), maGroupName( rGroupName ), maKey( rKey )
19534 +PrivateProfileStringListener::~PrivateProfileStringListener()
19538 +void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey )
19540 + maFileName = rFileName;
19541 + maGroupName = rGroupName;
19545 +uno::Any PrivateProfileStringListener::getValueEvent()
19547 + // get the private profile string
19548 + Config aCfg( maFileName );
19549 + aCfg.SetGroup( maGroupName );
19550 + rtl::OUString sValue = rtl::OUString( String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_UTF8 ) );
19552 + return uno::makeAny( sValue );
19555 +void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
19557 + // set the private profile string
19558 + Config aCfg( maFileName );
19559 + aCfg.SetGroup( maGroupName );
19561 + rtl::OUString aValue;
19562 + value >>= aValue;
19563 + aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_UTF8 ) );
19566 +SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
19570 +SwVbaSystem::~SwVbaSystem()
19574 +sal_Int32 SAL_CALL
19575 +SwVbaSystem::getCursor() throw (uno::RuntimeException)
19577 + sal_Int32 nPointerStyle = getPointerStyle();
19579 + switch( nPointerStyle )
19581 + case POINTER_ARROW:
19582 + return word::WdCursorType::wdCursorNorthwestArrow;
19583 + case POINTER_NULL:
19584 + return word::WdCursorType::wdCursorNormal;
19585 + case POINTER_WAIT:
19586 + return word::WdCursorType::wdCursorWait;
19587 + case POINTER_TEXT:
19588 + return word::WdCursorType::wdCursorIBeam;
19590 + return word::WdCursorType::wdCursorNormal;
19595 +SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
19599 + switch( _cursor )
19601 + case word::WdCursorType::wdCursorNorthwestArrow:
19603 + const Pointer& rPointer( POINTER_ARROW );
19604 + setCursorHelper( rPointer, sal_False );
19607 + case word::WdCursorType::wdCursorWait:
19609 + const Pointer& rPointer( static_cast< PointerStyle >( POINTER_WAIT ) );
19610 + //It will set the edit window, toobar and statusbar's mouse pointer.
19611 + setCursorHelper( rPointer, sal_True );
19614 + case word::WdCursorType::wdCursorIBeam:
19616 + const Pointer& rPointer( static_cast< PointerStyle >( POINTER_TEXT ) );
19617 + //It will set the edit window, toobar and statusbar's mouse pointer.
19618 + setCursorHelper( rPointer, sal_True );
19621 + case word::WdCursorType::wdCursorNormal:
19623 + const Pointer& rPointer( POINTER_NULL );
19624 + setCursorHelper( rPointer, sal_False );
19628 + throw uno::RuntimeException( rtl::OUString(
19629 + RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() );
19630 + // TODO: isn't this a flaw in the API? It should be allowed to throw an
19631 + // IllegalArgumentException, or so
19634 + catch( const uno::Exception& )
19636 + DBG_UNHANDLED_EXCEPTION();
19641 +SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
19643 + if( rFilename.getLength() == 0 )
19644 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
19646 + // FIXME: need to detect whether it is a relative file path
19647 + // we need to detect if this is a URL, if not then assume its a file path
19648 + rtl::OUString sFileUrl;
19649 + INetURLObject aObj;
19650 + aObj.SetURL( rFilename );
19651 + bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
19653 + sFileUrl = rFilename;
19655 + osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
19657 + ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_UTF8);
19658 + ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_UTF8);
19659 + maPrivateProfileStringListener.Initialize( sFileUrl, aGroupName, aKey );
19661 + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( &maPrivateProfileStringListener ) ) );
19665 +SwVbaSystem::getServiceImplName()
19667 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSystem") );
19668 + return sImplName;
19671 +uno::Sequence< rtl::OUString >
19672 +SwVbaSystem::getServiceNames()
19674 + static uno::Sequence< rtl::OUString > aServiceNames;
19675 + if ( aServiceNames.getLength() == 0 )
19677 + aServiceNames.realloc( 1 );
19678 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.System" ) );
19680 + return aServiceNames;
19682 --- sw/source/ui/vba/vbasystem.hxx.old 1970-01-01 00:00:00.000000000 +0000
19683 +++ sw/source/ui/vba/vbasystem.hxx 2009-04-06 16:42:01.000000000 +0000
19685 +/*************************************************************************
19687 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19689 + * Copyright 2008 by Sun Microsystems, Inc.
19691 + * OpenOffice.org - a multi-platform office productivity suite
19693 + * $RCSfile: vbasystem.hxx,v $
19694 + * $Revision: 1.4 $
19696 + * This file is part of OpenOffice.org.
19698 + * OpenOffice.org is free software: you can redistribute it and/or modify
19699 + * it under the terms of the GNU Lesser General Public License version 3
19700 + * only, as published by the Free Software Foundation.
19702 + * OpenOffice.org is distributed in the hope that it will be useful,
19703 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19704 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19705 + * GNU Lesser General Public License version 3 for more details
19706 + * (a copy is included in the LICENSE file that accompanied this code).
19708 + * You should have received a copy of the GNU Lesser General Public License
19709 + * version 3 along with OpenOffice.org. If not, see
19710 + * <http://www.openoffice.org/license.html>
19711 + * for a copy of the LGPLv3 License.
19713 + ************************************************************************/
19714 +#ifndef SW_VBA_SYSTEM_HXX
19715 +#define SW_VBA_SYSTEM_HXX
19717 +#include <ooo/vba/word/XSystem.hpp>
19718 +#include <vbahelper/vbahelperinterface.hxx>
19719 +#include <cppuhelper/implbase1.hxx>
19720 +#include <vbahelper/vbapropvalue.hxx>
19722 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSystem > SwVbaSystem_BASE;
19724 +class PrivateProfileStringListener : public PropListener
19727 + rtl::OUString maFileName;
19728 + ByteString maGroupName;
19729 + ByteString maKey;
19731 + PrivateProfileStringListener(){};
19732 + PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
19733 + virtual ~PrivateProfileStringListener();
19734 + void Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
19737 + virtual void setValueEvent( const css::uno::Any& value );
19738 + virtual css::uno::Any getValueEvent();
19741 +class SwVbaSystem : public SwVbaSystem_BASE
19744 + PrivateProfileStringListener maPrivateProfileStringListener;
19747 + SwVbaSystem( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
19748 + virtual ~SwVbaSystem();
19751 + virtual sal_Int32 SAL_CALL getCursor() throw ( css::uno::RuntimeException );
19752 + virtual void SAL_CALL setCursor( sal_Int32 _cursor ) throw ( css::uno::RuntimeException );
19753 + virtual css::uno::Any SAL_CALL PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( css::uno::RuntimeException );
19755 + // XHelperInterface
19756 + virtual rtl::OUString& getServiceImplName();
19757 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
19759 +#endif /* SW_VBA_SYSTEM_HXX */
19760 --- sw/source/ui/vba/vbavariable.cxx.old 1970-01-01 00:00:00.000000000 +0000
19761 +++ sw/source/ui/vba/vbavariable.cxx 2009-04-06 16:42:01.000000000 +0000
19763 +/*************************************************************************
19765 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19767 + * Copyright 2008 by Sun Microsystems, Inc.
19769 + * OpenOffice.org - a multi-platform office productivity suite
19774 + * This file is part of OpenOffice.org.
19776 + * OpenOffice.org is free software: you can redistribute it and/or modify
19777 + * it under the terms of the GNU Lesser General Public License version 3
19778 + * only, as published by the Free Software Foundation.
19780 + * OpenOffice.org is distributed in the hope that it will be useful,
19781 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19782 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19783 + * GNU Lesser General Public License version 3 for more details
19784 + * (a copy is included in the LICENSE file that accompanied this code).
19786 + * You should have received a copy of the GNU Lesser General Public License
19787 + * version 3 along with OpenOffice.org. If not, see
19788 + * <http://www.openoffice.org/license.html>
19789 + * for a copy of the LGPLv3 License.
19791 + ************************************************************************/
19792 +#include "vbavariable.hxx"
19793 +#include <vbahelper/vbahelper.hxx>
19794 +#include <tools/diagnose_ex.h>
19795 +#include <com/sun/star/beans/XPropertySet.hpp>
19796 +#include <com/sun/star/beans/PropertyValue.hpp>
19798 +using namespace ::ooo::vba;
19799 +using namespace ::com::sun::star;
19801 +SwVbaVariable::SwVbaVariable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
19802 + const uno::Reference< beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( uno::RuntimeException ) :
19803 + SwVbaVariable_BASE( rParent, rContext ), mxUserDefined( rUserDefined ), maName( rName )
19807 +SwVbaVariable::~SwVbaVariable()
19811 +rtl::OUString SAL_CALL
19812 +SwVbaVariable::getName() throw ( css::uno::RuntimeException )
19818 +SwVbaVariable::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException )
19820 + throw uno::RuntimeException( rtl::OUString(
19821 + RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() );
19825 +SwVbaVariable::getValue() throw ( css::uno::RuntimeException )
19827 + uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
19828 + return xProp->getPropertyValue( maName );
19832 +SwVbaVariable::setValue( const uno::Any& rValue ) throw ( css::uno::RuntimeException )
19834 + // FIXME: fail to set the value if the new type of vaue is differenct from the original one.
19835 + uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
19836 + xProp->setPropertyValue( maName, rValue );
19839 +sal_Int32 SAL_CALL
19840 +SwVbaVariable::getIndex() throw ( css::uno::RuntimeException )
19842 + const uno::Sequence< beans::PropertyValue > props = mxUserDefined->getPropertyValues();
19843 + for (sal_Int32 i = 0; i < props.getLength(); ++i)
19845 + if( maName.equals( props[i].Name ) )
19853 +SwVbaVariable::getServiceImplName()
19855 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariable") );
19856 + return sImplName;
19859 +uno::Sequence< rtl::OUString >
19860 +SwVbaVariable::getServiceNames()
19862 + static uno::Sequence< rtl::OUString > aServiceNames;
19863 + if ( aServiceNames.getLength() == 0 )
19865 + aServiceNames.realloc( 1 );
19866 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variable" ) );
19868 + return aServiceNames;
19871 --- sw/source/ui/vba/vbavariable.hxx.old 1970-01-01 00:00:00.000000000 +0000
19872 +++ sw/source/ui/vba/vbavariable.hxx 2009-04-06 16:42:01.000000000 +0000
19874 +/*************************************************************************
19876 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19878 + * Copyright 2008 by Sun Microsystems, Inc.
19880 + * OpenOffice.org - a multi-platform office productivity suite
19885 + * This file is part of OpenOffice.org.
19887 + * OpenOffice.org is free software: you can redistribute it and/or modify
19888 + * it under the terms of the GNU Lesser General Public License version 3
19889 + * only, as published by the Free Software Foundation.
19891 + * OpenOffice.org is distributed in the hope that it will be useful,
19892 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19893 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19894 + * GNU Lesser General Public License version 3 for more details
19895 + * (a copy is included in the LICENSE file that accompanied this code).
19897 + * You should have received a copy of the GNU Lesser General Public License
19898 + * version 3 along with OpenOffice.org. If not, see
19899 + * <http://www.openoffice.org/license.html>
19900 + * for a copy of the LGPLv3 License.
19902 + ************************************************************************/
19903 +#ifndef SW_VBA_VARIABLE_HXX
19904 +#define SW_VBA_VARIABLE_HXX
19906 +#include <ooo/vba/word/XVariable.hpp>
19907 +#include <vbahelper/vbahelperinterface.hxx>
19908 +#include <cppuhelper/implbase1.hxx>
19909 +#include <com/sun/star/beans/XPropertyAccess.hpp>
19911 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XVariable > SwVbaVariable_BASE;
19913 +class SwVbaVariable : public SwVbaVariable_BASE
19916 + css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined;
19917 + rtl::OUString maName;
19920 + SwVbaVariable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
19921 + const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( css::uno::RuntimeException );
19922 + virtual ~SwVbaVariable();
19925 + virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException );
19926 + virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException );
19927 + virtual css::uno::Any SAL_CALL getValue() throw ( css::uno::RuntimeException );
19928 + virtual void SAL_CALL setValue( const css::uno::Any& rValue ) throw ( css::uno::RuntimeException );
19929 + virtual sal_Int32 SAL_CALL getIndex() throw ( css::uno::RuntimeException );
19931 + // XHelperInterface
19932 + virtual rtl::OUString& getServiceImplName();
19933 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
19935 +#endif /* SW_VBA_VARIABLE_HXX */
19936 --- sw/source/ui/vba/vbavariables.cxx.old 1970-01-01 00:00:00.000000000 +0000
19937 +++ sw/source/ui/vba/vbavariables.cxx 2009-04-06 16:42:01.000000000 +0000
19939 +/*************************************************************************
19941 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19943 + * Copyright 2008 by Sun Microsystems, Inc.
19945 + * OpenOffice.org - a multi-platform office productivity suite
19950 + * This file is part of OpenOffice.org.
19952 + * OpenOffice.org is free software: you can redistribute it and/or modify
19953 + * it under the terms of the GNU Lesser General Public License version 3
19954 + * only, as published by the Free Software Foundation.
19956 + * OpenOffice.org is distributed in the hope that it will be useful,
19957 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19958 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19959 + * GNU Lesser General Public License version 3 for more details
19960 + * (a copy is included in the LICENSE file that accompanied this code).
19962 + * You should have received a copy of the GNU Lesser General Public License
19963 + * version 3 along with OpenOffice.org. If not, see
19964 + * <http://www.openoffice.org/license.html>
19965 + * for a copy of the LGPLv3 License.
19967 + ************************************************************************/
19968 +#include "vbavariables.hxx"
19969 +#include "vbavariable.hxx"
19970 +#include <com/sun/star/beans/XPropertyContainer.hpp>
19971 +#include <com/sun/star/beans/PropertyAttribute.hpp>
19973 +using namespace ::ooo::vba;
19974 +using namespace ::com::sun::star;
19976 +uno::Reference< container::XIndexAccess > createVariablesAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertyAccess >& xUserDefined ) throw ( uno::RuntimeException )
19978 + // FIXME: the performance is poor?
19979 + XNamedObjectCollectionHelper< word::XVariable >::XNamedVec mVariables;
19980 + const uno::Sequence< beans::PropertyValue > props = xUserDefined->getPropertyValues();
19981 + sal_Int32 nCount = props.getLength();
19982 + mVariables.reserve( nCount );
19983 + for( sal_Int32 i=0; i < nCount; i++ )
19984 + mVariables.push_back( uno::Reference< word::XVariable > ( new SwVbaVariable( xParent, xContext, xUserDefined, props[i].Name ) ) );
19986 + uno::Reference< container::XIndexAccess > xVariables( new XNamedObjectCollectionHelper< word::XVariable >( mVariables ) );
19987 + return xVariables;
19990 +SwVbaVariables::SwVbaVariables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertyAccess >& rUserDefined ): SwVbaVariables_BASE( xParent, xContext, createVariablesAccess( xParent, xContext, rUserDefined ) ), mxUserDefined( rUserDefined )
19993 +// XEnumerationAccess
19995 +SwVbaVariables::getElementType() throw (uno::RuntimeException)
19997 + return word::XVariable::static_type(0);
19999 +uno::Reference< container::XEnumeration >
20000 +SwVbaVariables::createEnumeration() throw (uno::RuntimeException)
20002 + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
20003 + return xEnumerationAccess->createEnumeration();
20007 +SwVbaVariables::createCollectionObject( const css::uno::Any& aSource )
20013 +SwVbaVariables::Add( const rtl::OUString& rName, const uno::Any& rValue ) throw (uno::RuntimeException)
20016 + if( rValue.hasValue() )
20019 + aValue <<= rtl::OUString();
20020 + uno::Reference< beans::XPropertyContainer > xPropertyContainer( mxUserDefined, uno::UNO_QUERY_THROW );
20021 + xPropertyContainer->addProperty( rName, beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::REMOVEABLE, aValue );
20023 + return uno::makeAny( uno::Reference< word::XVariable >( new SwVbaVariable( getParent(), mxContext, mxUserDefined, rName ) ) );
20027 +SwVbaVariables::getServiceImplName()
20029 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariables") );
20030 + return sImplName;
20033 +css::uno::Sequence<rtl::OUString>
20034 +SwVbaVariables::getServiceNames()
20036 + static uno::Sequence< rtl::OUString > sNames;
20037 + if ( sNames.getLength() == 0 )
20039 + sNames.realloc( 1 );
20040 + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variables") );
20044 --- sw/source/ui/vba/vbavariables.hxx.old 1970-01-01 00:00:00.000000000 +0000
20045 +++ sw/source/ui/vba/vbavariables.hxx 2009-04-06 16:42:01.000000000 +0000
20047 +/*************************************************************************
20049 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20051 + * Copyright 2008 by Sun Microsystems, Inc.
20053 + * OpenOffice.org - a multi-platform office productivity suite
20058 + * This file is part of OpenOffice.org.
20060 + * OpenOffice.org is free software: you can redistribute it and/or modify
20061 + * it under the terms of the GNU Lesser General Public License version 3
20062 + * only, as published by the Free Software Foundation.
20064 + * OpenOffice.org is distributed in the hope that it will be useful,
20065 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20066 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20067 + * GNU Lesser General Public License version 3 for more details
20068 + * (a copy is included in the LICENSE file that accompanied this code).
20070 + * You should have received a copy of the GNU Lesser General Public License
20071 + * version 3 along with OpenOffice.org. If not, see
20072 + * <http://www.openoffice.org/license.html>
20073 + * for a copy of the LGPLv3 License.
20075 + ************************************************************************/
20076 +#ifndef SW_VBA_VARIABLES_HXX
20077 +#define SW_VBA_VARIABLES_HXX
20079 +#include <vbahelper/vbacollectionimpl.hxx>
20080 +#include <ooo/vba/word/XVariables.hpp>
20081 +#include <com/sun/star/container/XEnumerationAccess.hpp>
20082 +#include <com/sun/star/container/XIndexAccess.hpp>
20083 +#include <vbahelper/vbahelperinterface.hxx>
20084 +#include <com/sun/star/beans/XPropertyAccess.hpp>
20086 +typedef CollTestImplHelper< ooo::vba::word::XVariables > SwVbaVariables_BASE;
20088 +class SwVbaVariables : public SwVbaVariables_BASE
20091 + css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined;
20094 + SwVbaVariables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined );
20095 + virtual ~SwVbaVariables() {}
20097 + // XEnumerationAccess
20098 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
20099 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
20101 + // SwVbaVariables_BASE
20102 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
20103 + virtual rtl::OUString& getServiceImplName();
20104 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
20107 + virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rValue ) throw (css::uno::RuntimeException);
20110 +#endif /* SW_VBA_VARIABLES_HXX */
20111 --- sw/source/ui/vba/vbaview.cxx.old 1970-01-01 00:00:00.000000000 +0000
20112 +++ sw/source/ui/vba/vbaview.cxx 2009-04-06 16:42:01.000000000 +0000
20114 +/*************************************************************************
20116 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20118 + * Copyright 2008 by Sun Microsystems, Inc.
20120 + * OpenOffice.org - a multi-platform office productivity suite
20125 + * This file is part of OpenOffice.org.
20127 + * OpenOffice.org is free software: you can redistribute it and/or modify
20128 + * it under the terms of the GNU Lesser General Public License version 3
20129 + * only, as published by the Free Software Foundation.
20131 + * OpenOffice.org is distributed in the hope that it will be useful,
20132 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20133 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20134 + * GNU Lesser General Public License version 3 for more details
20135 + * (a copy is included in the LICENSE file that accompanied this code).
20137 + * You should have received a copy of the GNU Lesser General Public License
20138 + * version 3 along with OpenOffice.org. If not, see
20139 + * <http://www.openoffice.org/license.html>
20140 + * for a copy of the LGPLv3 License.
20142 + ************************************************************************/
20143 +#include "vbaview.hxx"
20144 +#include <vbahelper/vbahelper.hxx>
20145 +#include <tools/diagnose_ex.h>
20146 +#include <com/sun/star/beans/XPropertySet.hpp>
20147 +#include <com/sun/star/view/XViewSettingsSupplier.hpp>
20148 +#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
20149 +#include <com/sun/star/text/XText.hpp>
20150 +#include <com/sun/star/text/XTextDocument.hpp>
20151 +#include <com/sun/star/text/XFootnotesSupplier.hpp>
20152 +#include <com/sun/star/text/XEndnotesSupplier.hpp>
20153 +#include <com/sun/star/container/XIndexAccess.hpp>
20154 +#include <com/sun/star/frame/XController.hpp>
20155 +#include <com/sun/star/lang/XServiceInfo.hpp>
20156 +#include <ooo/vba/word/WdSpecialPane.hpp>
20157 +#include <ooo/vba/word/WdViewType.hpp>
20158 +#include <ooo/vba/word/WdSeekView.hpp>
20160 +#include "wordvbahelper.hxx"
20161 +#include <view.hxx>
20163 +using namespace ::ooo::vba;
20164 +using namespace ::com::sun::star;
20166 +const sal_Int32 DEFAULT_BODY_DISTANCE = 500;
20168 +SwVbaView::SwVbaView( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
20169 + const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) :
20170 + SwVbaView_BASE( rParent, rContext ), mxModel( rModel )
20172 + uno::Reference< frame::XController > xController = mxModel->getCurrentController();
20174 + uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW );
20175 + mxViewCursor = xTextViewCursorSupp->getViewCursor();
20177 + uno::Reference< view::XViewSettingsSupplier > xViewSettingSupp( xController, uno::UNO_QUERY_THROW );
20178 + mxViewSettings.set( xViewSettingSupp->getViewSettings(), uno::UNO_QUERY_THROW );
20181 +SwVbaView::~SwVbaView()
20185 +::sal_Int32 SAL_CALL
20186 +SwVbaView::getSeekView() throw (css::uno::RuntimeException)
20188 + uno::Reference< text::XText > xCurrentText = mxViewCursor->getText();
20189 + uno::Reference< lang::XServiceInfo > xServiceInfo( xCurrentText, uno::UNO_QUERY_THROW );
20190 + rtl::OUString aImplName = xServiceInfo->getImplementationName();
20191 + if( aImplName.equalsAscii("SwXBodyText") )
20193 + return word::WdSeekView::wdSeekMainDocument;
20195 + else if( aImplName.equalsAscii("SwXHeadFootText") )
20197 + if( word::HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
20199 + if( word::HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
20200 + return word::WdSeekView::wdSeekFirstPageHeader;
20201 + else if( word::HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
20202 + return word::WdSeekView::wdSeekEvenPagesHeader;
20204 + return word::WdSeekView::wdSeekPrimaryHeader;
20208 + if( word::HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
20209 + return word::WdSeekView::wdSeekFirstPageFooter;
20210 + else if( word::HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
20211 + return word::WdSeekView::wdSeekEvenPagesFooter;
20213 + return word::WdSeekView::wdSeekPrimaryFooter;
20216 + else if( aImplName.equalsAscii("SwXFootnote") )
20218 + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote") ) ) )
20219 + return word::WdSeekView::wdSeekEndnotes;
20221 + return word::WdSeekView::wdSeekFootnotes;
20224 + return word::WdSeekView::wdSeekMainDocument;
20228 +SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException)
20230 + if( _seekview == getSeekView() )
20233 + switch( _seekview )
20235 + case word::WdSeekView::wdSeekFirstPageFooter:
20236 + case word::WdSeekView::wdSeekFirstPageHeader:
20237 + case word::WdSeekView::wdSeekCurrentPageFooter:
20238 + case word::WdSeekView::wdSeekCurrentPageHeader:
20239 + case word::WdSeekView::wdSeekPrimaryFooter:
20240 + case word::WdSeekView::wdSeekPrimaryHeader:
20241 + case word::WdSeekView::wdSeekEvenPagesFooter:
20242 + case word::WdSeekView::wdSeekEvenPagesHeader:
20245 + mxViewCursor->gotoRange( getHFTextRange( _seekview ), sal_False );
20248 + case word::WdSeekView::wdSeekFootnotes:
20250 + uno::Reference< text::XFootnotesSupplier > xFootnotesSupp( mxModel, uno::UNO_QUERY_THROW );
20251 + uno::Reference< container::XIndexAccess > xFootnotes( xFootnotesSupp->getFootnotes(), uno::UNO_QUERY_THROW );
20252 + if( xFootnotes->getCount() > 0 )
20254 + uno::Reference< text::XText > xText( xFootnotes->getByIndex(0), uno::UNO_QUERY_THROW );
20255 + mxViewCursor->gotoRange( xText->getStart(), sal_False );
20259 + DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() );
20263 + case word::WdSeekView::wdSeekEndnotes:
20265 + uno::Reference< text::XEndnotesSupplier > xEndnotesSupp( mxModel, uno::UNO_QUERY_THROW );
20266 + uno::Reference< container::XIndexAccess > xEndnotes( xEndnotesSupp->getEndnotes(), uno::UNO_QUERY_THROW );
20267 + if( xEndnotes->getCount() > 0 )
20269 + uno::Reference< text::XText > xText( xEndnotes->getByIndex(0), uno::UNO_QUERY_THROW );
20270 + mxViewCursor->gotoRange( xText->getStart(), sal_False );
20274 + DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() );
20278 + case word::WdSeekView::wdSeekMainDocument:
20280 + uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
20281 + uno::Reference< text::XText > xText = xTextDocument->getText();
20282 + mxViewCursor->gotoRange( xText->getStart(), sal_False );
20288 +::sal_Int32 SAL_CALL
20289 +SwVbaView::getSplitSpecial() throw (css::uno::RuntimeException)
20291 + return word::WdSpecialPane::wdPaneNone;
20295 +SwVbaView::setSplitSpecial( ::sal_Int32/* _splitspecial */) throw (css::uno::RuntimeException)
20297 + // not support in Writer
20300 +::sal_Bool SAL_CALL
20301 +SwVbaView::getTableGridLines() throw (css::uno::RuntimeException)
20303 + sal_Bool bShowTableGridLine = sal_False;
20304 + mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries"))) >>= bShowTableGridLine;
20305 + return bShowTableGridLine;
20309 +SwVbaView::setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException)
20311 + mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries")), uno::makeAny( _tablegridlines ) );
20314 +::sal_Int32 SAL_CALL
20315 +SwVbaView::getType() throw (css::uno::RuntimeException)
20317 + // FIXME: handle wdPrintPreview type
20318 + sal_Bool bOnlineLayout = sal_False;
20319 + mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout"))) >>= bOnlineLayout;
20320 + return bOnlineLayout ? word::WdViewType::wdWebView : word::WdViewType::wdPrintView;
20324 +SwVbaView::setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException)
20326 + // FIXME: handle wdPrintPreview type
20329 + case word::WdViewType::wdPrintView:
20331 + mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_False ) );
20334 + case word::WdViewType::wdWebView:
20336 + mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_True ) );
20339 + case word::WdViewType::wdPrintPreview:
20341 + PrintPreviewHelper( uno::Any(),word::getView( mxModel ) );
20345 + DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
20350 +uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType ) throw (uno::RuntimeException)
20352 + mxModel->lockControllers();
20354 + rtl::OUString aPropIsOn;
20355 + rtl::OUString aPropIsShared;
20356 + rtl::OUString aPropBodyDistance;
20357 + rtl::OUString aPropText;
20361 + case word::WdSeekView::wdSeekCurrentPageFooter:
20362 + case word::WdSeekView::wdSeekFirstPageFooter:
20363 + case word::WdSeekView::wdSeekPrimaryFooter:
20364 + case word::WdSeekView::wdSeekEvenPagesFooter:
20366 + aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn") );
20367 + aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
20368 + aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance") );
20369 + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
20372 + case word::WdSeekView::wdSeekCurrentPageHeader:
20373 + case word::WdSeekView::wdSeekFirstPageHeader:
20374 + case word::WdSeekView::wdSeekPrimaryHeader:
20375 + case word::WdSeekView::wdSeekEvenPagesHeader:
20377 + aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn") );
20378 + aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
20379 + aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance") );
20380 + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
20385 + uno::Reference< text::XPageCursor > xPageCursor( mxViewCursor, uno::UNO_QUERY_THROW );
20387 + if( nType == word::WdSeekView::wdSeekFirstPageFooter
20388 + || nType == word::WdSeekView::wdSeekFirstPageHeader )
20390 + xPageCursor->jumpToFirstPage();
20393 + uno::Reference< style::XStyle > xStyle;
20394 + uno::Reference< text::XText > xText;
20397 + case word::WdSeekView::wdSeekPrimaryFooter:
20398 + case word::WdSeekView::wdSeekPrimaryHeader:
20399 + case word::WdSeekView::wdSeekEvenPagesFooter:
20400 + case word::WdSeekView::wdSeekEvenPagesHeader:
20402 + // The primary header is the first header of the section.
20403 + // If the header is not shared between odd and even pages
20404 + // the odd page's header is the primary header. If the
20405 + // first page's header is different from the rest of the
20406 + // document, it is NOT the primary header ( the next primary
20407 + // header would be on page 3 )
20408 + // The even pages' header is only available if the header is
20409 + // not shared and the current style is applied to a page with
20410 + // an even page number
20411 + uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW );
20412 + rtl::OUString aPageStyleName;
20413 + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
20414 + if( aPageStyleName.equalsAscii("First Page") )
20416 + // go to the beginning of where the next style is used
20417 + sal_Bool hasNextPage = sal_False;
20418 + xStyle = word::getCurrentPageStyle( mxModel );
20421 + hasNextPage = xPageCursor->jumpToNextPage();
20423 + while( hasNextPage && ( xStyle == word::getCurrentPageStyle( mxModel ) ) );
20425 + if( !hasNextPage )
20426 + DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() );
20436 + xStyle = word::getCurrentPageStyle( mxModel );
20437 + uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
20438 + sal_Bool isOn = sal_False;
20439 + xPageProps->getPropertyValue( aPropIsOn ) >>= isOn;
20440 + sal_Bool isShared = sal_False;
20441 + xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
20444 + xPageProps->setPropertyValue( aPropIsOn, uno::makeAny( sal_True ) );
20445 + xPageProps->setPropertyValue( aPropBodyDistance, uno::makeAny( DEFAULT_BODY_DISTANCE ) );
20449 + rtl::OUString aTempPropText = aPropText;
20450 + if( nType == word::WdSeekView::wdSeekEvenPagesFooter
20451 + || nType == word::WdSeekView::wdSeekEvenPagesHeader )
20453 + aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") );
20457 + aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Right") );
20459 + xText.set( xPageProps->getPropertyValue( aTempPropText), uno::UNO_QUERY_THROW );
20463 + if( nType == word::WdSeekView::wdSeekEvenPagesFooter
20464 + || nType == word::WdSeekView::wdSeekEvenPagesHeader )
20466 + DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() );
20468 + xText.set( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
20471 + mxModel->unlockControllers();
20472 + if( !xText.is() )
20474 + DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
20476 + return xText->getStart();
20480 +SwVbaView::getServiceImplName()
20482 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaView") );
20483 + return sImplName;
20486 +uno::Sequence< rtl::OUString >
20487 +SwVbaView::getServiceNames()
20489 + static uno::Sequence< rtl::OUString > aServiceNames;
20490 + if ( aServiceNames.getLength() == 0 )
20492 + aServiceNames.realloc( 1 );
20493 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.View" ) );
20495 + return aServiceNames;
20498 --- sw/source/ui/vba/vbaview.hxx.old 1970-01-01 00:00:00.000000000 +0000
20499 +++ sw/source/ui/vba/vbaview.hxx 2009-04-06 16:42:01.000000000 +0000
20501 +/*************************************************************************
20503 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20505 + * Copyright 2008 by Sun Microsystems, Inc.
20507 + * OpenOffice.org - a multi-platform office productivity suite
20512 + * This file is part of OpenOffice.org.
20514 + * OpenOffice.org is free software: you can redistribute it and/or modify
20515 + * it under the terms of the GNU Lesser General Public License version 3
20516 + * only, as published by the Free Software Foundation.
20518 + * OpenOffice.org is distributed in the hope that it will be useful,
20519 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20520 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20521 + * GNU Lesser General Public License version 3 for more details
20522 + * (a copy is included in the LICENSE file that accompanied this code).
20524 + * You should have received a copy of the GNU Lesser General Public License
20525 + * version 3 along with OpenOffice.org. If not, see
20526 + * <http://www.openoffice.org/license.html>
20527 + * for a copy of the LGPLv3 License.
20529 + ************************************************************************/
20530 +#ifndef SW_VBA_VIEW_HXX
20531 +#define SW_VBA_VIEW_HXX
20533 +#include <ooo/vba/word/XView.hpp>
20534 +#include <vbahelper/vbahelperinterface.hxx>
20535 +#include <com/sun/star/text/XTextViewCursor.hpp>
20536 +#include <com/sun/star/text/XTextRange.hpp>
20537 +#include <com/sun/star/beans/XPropertySet.hpp>
20539 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XView > SwVbaView_BASE;
20541 +class SwVbaView : public SwVbaView_BASE
20544 + css::uno::Reference< css::frame::XModel > mxModel;
20545 + css::uno::Reference< css::text::XTextViewCursor > mxViewCursor;
20546 + css::uno::Reference< css::beans::XPropertySet > mxViewSettings;
20548 + css::uno::Reference< css::text::XTextRange > getHFTextRange( sal_Int32 nType ) throw (css::uno::RuntimeException);
20551 + SwVbaView( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
20552 + const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
20553 + virtual ~SwVbaView();
20556 + virtual ::sal_Int32 SAL_CALL getSeekView() throw (css::uno::RuntimeException);
20557 + virtual void SAL_CALL setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException);
20558 + virtual ::sal_Int32 SAL_CALL getSplitSpecial() throw (css::uno::RuntimeException);
20559 + virtual void SAL_CALL setSplitSpecial( ::sal_Int32 _splitspecial ) throw (css::uno::RuntimeException);
20560 + virtual ::sal_Bool SAL_CALL getTableGridLines() throw (css::uno::RuntimeException);
20561 + virtual void SAL_CALL setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException);
20562 + virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
20563 + virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException);
20565 + // XHelperInterface
20566 + virtual rtl::OUString& getServiceImplName();
20567 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
20569 +#endif /* SW_VBA_VIEW_HXX */
20570 --- sw/source/ui/vba/vbawindow.cxx.old 1970-01-01 00:00:00.000000000 +0000
20571 +++ sw/source/ui/vba/vbawindow.cxx 2009-04-06 16:42:01.000000000 +0000
20573 +/*************************************************************************
20575 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20577 + * Copyright 2008 by Sun Microsystems, Inc.
20579 + * OpenOffice.org - a multi-platform office productivity suite
20581 + * $RCSfile: vbawindow.cxx,v $
20582 + * $Revision: 1.5 $
20584 + * This file is part of OpenOffice.org.
20586 + * OpenOffice.org is free software: you can redistribute it and/or modify
20587 + * it under the terms of the GNU Lesser General Public License version 3
20588 + * only, as published by the Free Software Foundation.
20590 + * OpenOffice.org is distributed in the hope that it will be useful,
20591 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20592 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20593 + * GNU Lesser General Public License version 3 for more details
20594 + * (a copy is included in the LICENSE file that accompanied this code).
20596 + * You should have received a copy of the GNU Lesser General Public License
20597 + * version 3 along with OpenOffice.org. If not, see
20598 + * <http://www.openoffice.org/license.html>
20599 + * for a copy of the LGPLv3 License.
20601 + ************************************************************************/
20602 +#include <vbahelper/helperdecl.hxx>
20603 +#include "vbawindow.hxx"
20604 +#include "vbaglobals.hxx"
20605 +#include "vbadocument.hxx"
20606 +#include "vbaview.hxx"
20607 +#include "vbapanes.hxx"
20608 +#include "vbapane.hxx"
20610 +using namespace ::com::sun::star;
20611 +using namespace ::ooo::vba;
20613 +SwVbaWindow::SwVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel )
20617 +SwVbaWindow::SwVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
20618 + : WindowImpl_BASE( args, xContext )
20623 +SwVbaWindow::Activate() throw (css::uno::RuntimeException)
20625 + SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
20627 + document.Activate();
20631 +SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException)
20633 + // FIXME: it is incorrect when there are more than 1 windows
20634 + SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
20635 + uno::Any FileName;
20636 + document.Close(SaveChanges, FileName, RouteDocument );
20640 +SwVbaWindow::getView() throw (uno::RuntimeException)
20642 + return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, m_xModel ) ) );
20645 +void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeException)
20647 + sal_Int32 nType = 0;
20648 + if( _view >>= nType )
20650 + SwVbaView view( this, mxContext, m_xModel );
20651 + view.setType( nType );
20656 +SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
20658 + uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) );
20659 + if( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
20660 + return uno::makeAny( xPanes );
20662 + return uno::Any( xPanes->Item( aIndex, uno::Any() ) );
20666 +SwVbaWindow::ActivePane() throw (uno::RuntimeException)
20668 + return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( this, mxContext, m_xModel ) ) );
20672 +SwVbaWindow::getServiceImplName()
20674 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWindow") );
20675 + return sImplName;
20678 +uno::Sequence< rtl::OUString >
20679 +SwVbaWindow::getServiceNames()
20681 + static uno::Sequence< rtl::OUString > aServiceNames;
20682 + if ( aServiceNames.getLength() == 0 )
20684 + aServiceNames.realloc( 1 );
20685 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Window" ) );
20687 + return aServiceNames;
20689 --- sw/source/ui/vba/vbawindow.hxx.old 1970-01-01 00:00:00.000000000 +0000
20690 +++ sw/source/ui/vba/vbawindow.hxx 2009-04-06 16:42:01.000000000 +0000
20692 +/*************************************************************************
20694 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20696 + * Copyright 2008 by Sun Microsystems, Inc.
20698 + * OpenOffice.org - a multi-platform office productivity suite
20700 + * $RCSfile: vbawindow.hxx,v $
20701 + * $Revision: 1.4 $
20703 + * This file is part of OpenOffice.org.
20705 + * OpenOffice.org is free software: you can redistribute it and/or modify
20706 + * it under the terms of the GNU Lesser General Public License version 3
20707 + * only, as published by the Free Software Foundation.
20709 + * OpenOffice.org is distributed in the hope that it will be useful,
20710 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20711 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20712 + * GNU Lesser General Public License version 3 for more details
20713 + * (a copy is included in the LICENSE file that accompanied this code).
20715 + * You should have received a copy of the GNU Lesser General Public License
20716 + * version 3 along with OpenOffice.org. If not, see
20717 + * <http://www.openoffice.org/license.html>
20718 + * for a copy of the LGPLv3 License.
20720 + ************************************************************************/
20721 +#ifndef SW_VBA_WINDOW_HXX
20722 +#define SW_VBA_WINDOW_HXX
20723 +#include <cppuhelper/implbase1.hxx>
20724 +#include <ooo/vba/word/XWindow.hpp>
20725 +#include <com/sun/star/uno/XComponentContext.hpp>
20727 +#include <vbahelper/vbahelperinterface.hxx>
20728 +#include <vbahelper/vbawindowbase.hxx>
20730 +typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::word::XWindow > WindowImpl_BASE;
20732 +class SwVbaWindow : public WindowImpl_BASE
20735 + SwVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
20736 + SwVbaWindow( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
20740 + virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException);
20741 + virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException);
20743 + virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
20744 + virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
20745 + virtual css::uno::Any SAL_CALL Panes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
20746 + virtual css::uno::Any SAL_CALL ActivePane() throw (css::uno::RuntimeException);
20747 + // XHelperInterface
20748 + virtual rtl::OUString& getServiceImplName();
20749 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
20752 +#endif //SW_VBA_WINDOW_HXX
20753 --- sw/source/ui/vba/wordvbahelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
20754 +++ sw/source/ui/vba/wordvbahelper.cxx 2009-04-06 16:42:01.000000000 +0000
20756 +/*************************************************************************
20758 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20760 + * Copyright 2008 by Sun Microsystems, Inc.
20762 + * OpenOffice.org - a multi-platform office productivity suite
20764 + * $RCSfile: vbahelper.cxx,v $
20765 + * $Revision: 1.5.32.1 $
20767 + * This file is part of OpenOffice.org.
20769 + * OpenOffice.org is free software: you can redistribute it and/or modify
20770 + * it under the terms of the GNU Lesser General Public License version 3
20771 + * only, as published by the Free Software Foundation.
20773 + * OpenOffice.org is distributed in the hope that it will be useful,
20774 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20775 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20776 + * GNU Lesser General Public License version 3 for more details
20777 + * (a copy is included in the LICENSE file that accompanied this code).
20779 + * You should have received a copy of the GNU Lesser General Public License
20780 + * version 3 along with OpenOffice.org. If not, see
20781 + * <http://www.openoffice.org/license.html>
20782 + * for a copy of the LGPLv3 License.
20784 + ************************************************************************/
20785 +#include <docsh.hxx>
20786 +#include "wordvbahelper.hxx"
20787 +#include <comphelper/processfactory.hxx>
20788 +#include <com/sun/star/frame/XController.hpp>
20789 +#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
20790 +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
20791 +#include <com/sun/star/container/XNameAccess.hpp>
20792 +#include <com/sun/star/lang/XUnoTunnel.hpp>
20793 +#include <unotxdoc.hxx>
20795 +using namespace ::com::sun::star;
20796 +using namespace ::ooo::vba;
20798 +#define FIRST_PAGE 1;
20807 +SwDocShell* getDocShell( const uno::Reference< frame::XModel>& xModel )
20809 + uno::Reference< lang::XUnoTunnel > xTunnel( xModel, uno::UNO_QUERY_THROW );
20810 + SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
20811 + return pXDoc ? pXDoc->GetDocShell() : 0;
20814 +SwView* getView( const uno::Reference< frame::XModel>& xModel )
20816 + SwDocShell* pDocShell = getDocShell( xModel );
20817 + return pDocShell? pDocShell->GetView() : 0;
20820 +uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
20822 + uno::Reference< frame::XController > xController = xModel->getCurrentController();
20823 + uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW );
20824 + uno::Reference< text::XTextViewCursor > xTextViewCursor = xTextViewCursorSupp->getViewCursor();
20825 + return xTextViewCursor;
20828 +uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
20830 + uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20831 + rtl::OUString aPageStyleName;
20832 + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
20833 + uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
20834 + uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
20835 + uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
20836 + uno::Reference< style::XStyle > xStyle( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW );
20841 +// Class HeaderFooterHelper
20843 +sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
20845 + uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20846 + uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
20848 + sal_Bool isOn = sal_False;
20849 + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
20851 + return sal_False;
20853 + sal_Bool isShared = sal_False;
20854 + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
20856 + rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
20859 + if( 0 == xPageCursor->getPage() % 2 )
20861 + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
20865 + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
20869 + uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
20870 + //FIXME: can not compare in this way?
20871 + return ( xText == xCurrentText );
20874 +sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
20876 + if( isHeader( xModel, xCurrentText ) )
20878 + uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20879 + // FIXME: getPage allways returns 1
20880 + sal_Int32 nPage = xPageCursor->getPage();
20881 + return nPage == FIRST_PAGE;
20883 + return sal_False;
20886 +sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
20888 + if( isHeader( xModel, xCurrentText ) )
20890 + uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
20891 + sal_Bool isShared = sal_False;
20892 + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
20895 + uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20896 + return ( 0 == xPageCursor->getPage() % 2 );
20899 + return sal_False;
20902 +sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
20904 + uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20905 + uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
20907 + sal_Bool isOn = sal_False;
20908 + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
20910 + return sal_False;
20912 + sal_Bool isShared = sal_False;
20913 + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
20915 + rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
20918 + if( 0 == xPageCursor->getPage() % 2 )
20920 + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
20924 + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
20928 + uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
20930 + return ( xText == xCurrentText );
20933 +sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
20935 + if( isFooter( xModel, xCurrentText ) )
20937 + uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20938 + sal_Int32 nPage = xPageCursor->getPage();
20939 + return nPage == FIRST_PAGE;
20941 + return sal_False;
20944 +sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
20946 + if( isFooter( xModel, xCurrentText ) )
20948 + uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
20949 + sal_Bool isShared = sal_False;
20950 + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
20953 + uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
20954 + return ( 0 == xPageCursor->getPage() % 2 );
20957 + return sal_False;
20963 --- sw/source/ui/vba/wordvbahelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
20964 +++ sw/source/ui/vba/wordvbahelper.hxx 2009-04-06 16:42:01.000000000 +0000
20966 +/*************************************************************************
20968 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20970 + * Copyright 2008 by Sun Microsystems, Inc.
20972 + * OpenOffice.org - a multi-platform office productivity suite
20974 + * $RCSfile: vbahelper.hxx,v $
20975 + * $Revision: 1.5.32.1 $
20977 + * This file is part of OpenOffice.org.
20979 + * OpenOffice.org is free software: you can redistribute it and/or modify
20980 + * it under the terms of the GNU Lesser General Public License version 3
20981 + * only, as published by the Free Software Foundation.
20983 + * OpenOffice.org is distributed in the hope that it will be useful,
20984 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20985 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20986 + * GNU Lesser General Public License version 3 for more details
20987 + * (a copy is included in the LICENSE file that accompanied this code).
20989 + * You should have received a copy of the GNU Lesser General Public License
20990 + * version 3 along with OpenOffice.org. If not, see
20991 + * <http://www.openoffice.org/license.html>
20992 + * for a copy of the LGPLv3 License.
20994 + ************************************************************************/
20995 +#ifndef SW_WORD_VBA_HELPER_HXX
20996 +#define SW_WORD_VBA_HELPER_HXX
20998 +#include <vbahelper/vbahelper.hxx>
20999 +#include <com/sun/star/text/XText.hpp>
21000 +#include <com/sun/star/text/XTextViewCursor.hpp>
21001 +#include <com/sun/star/text/XPageCursor.hpp>
21002 +#include <com/sun/star/style/XStyle.hpp>
21012 + //css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
21013 + SwDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel );
21014 + SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
21015 + css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
21016 + css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
21018 +class HeaderFooterHelper
21021 + static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
21022 + static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
21023 + static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
21024 + static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
21025 + static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
21026 + static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
21033 --- sw/util/makefile.mk.old 2009-04-06 16:41:40.000000000 +0000
21034 +++ sw/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
21035 @@ -131,6 +131,7 @@ SHL1STDLIBS+= \
21039 + $(VBAHELPERLIB) \
21042 .IF "$(GUI)"=="WNT"
21043 @@ -343,6 +344,37 @@ SHL4STDLIBS= \
21047 + $(VBAHELPERLIB) \
21052 +TARGET_VBA=vbaswobj
21053 +SHL5TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno
21054 +SHL5IMPLIB= i$(TARGET_VBA)
21056 +SHL5VERSIONMAP=$(TARGET_VBA).map
21057 +SHL5DEF=$(MISC)$/$(SHL5TARGET).def
21058 +DEF5NAME=$(SHL5TARGET)
21061 + $(CPPUHELPERLIB) \
21064 + $(COMPHELPERLIB) \
21068 + $(VBAHELPERLIB) \
21077 +SHL5DEPN=$(SHL1TARGETN)
21078 +SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
21080 .INCLUDE : target.mk
21081 --- sw/util/vbaswobj.map.old 1970-01-01 00:00:00.000000000 +0000
21082 +++ sw/util/vbaswobj.map 2009-04-06 16:42:01.000000000 +0000
21086 + component_getImplementationEnvironment;
21087 + component_getFactory;
21088 + component_writeInfo;
21093 --- vbahelper/inc/vbahelper/helperdecl.hxx.old 1970-01-01 00:00:00.000000000 +0000
21094 +++ vbahelper/inc/vbahelper/helperdecl.hxx 2009-04-06 16:42:01.000000000 +0000
21096 +/*************************************************************************
21098 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21100 + * Copyright 2008 by Sun Microsystems, Inc.
21102 + * OpenOffice.org - a multi-platform office productivity suite
21104 + * $RCSfile: helperdecl.hxx,v $
21105 + * $Revision: 1.3 $
21107 + * This file is part of OpenOffice.org.
21109 + * OpenOffice.org is free software: you can redistribute it and/or modify
21110 + * it under the terms of the GNU Lesser General Public License version 3
21111 + * only, as published by the Free Software Foundation.
21113 + * OpenOffice.org is distributed in the hope that it will be useful,
21114 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21115 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21116 + * GNU Lesser General Public License version 3 for more details
21117 + * (a copy is included in the LICENSE file that accompanied this code).
21119 + * You should have received a copy of the GNU Lesser General Public License
21120 + * version 3 along with OpenOffice.org. If not, see
21121 + * <http://www.openoffice.org/license.html>
21122 + * for a copy of the LGPLv3 License.
21124 + ************************************************************************/
21125 +#ifndef OOVBAAPI_SERV_DECL
21126 +#define OOVBAAPI_SERV_DECL
21127 +#include <comphelper/servicedecl.hxx>
21128 +#include <ooo/vba/XHelperInterface.hpp>
21130 +namespace comphelper {
21131 +namespace service_decl {
21132 +template <typename ImplT_, typename WithArgsT = with_args<false> >
21133 +struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT >
21135 + typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT;
21136 + /** Default ctor. Implementation class without args, expecting
21137 + component context as single argument.
21139 + vba_service_class_() : baseT() {}
21140 + template <typename PostProcessFuncT>
21141 + /** Ctor to pass a post processing function/functor.
21143 + @tpl PostProcessDefaultT let your compiler deduce this
21144 + @param postProcessFunc function/functor that gets the yet unacquired
21145 + ImplT_ pointer returning a
21146 + uno::Reference<uno::XInterface>
21148 + explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
21151 +} // namespace service_decl
21152 +} // namespace comphelper
21154 --- vbahelper/inc/vbahelper/vbaapplicationbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
21155 +++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx 2009-04-06 16:42:01.000000000 +0000
21157 +/*************************************************************************
21159 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21161 + * Copyright 2008 by Sun Microsystems, Inc.
21163 + * OpenOffice.org - a multi-platform office productivity suite
21165 + * $RCSfile: vbaapplicationbase.hxx,v $
21166 + * $Revision: 1.3 $
21168 + * This file is part of OpenOffice.org.
21170 + * OpenOffice.org is free software: you can redistribute it and/or modify
21171 + * it under the terms of the GNU Lesser General Public License version 3
21172 + * only, as published by the Free Software Foundation.
21174 + * OpenOffice.org is distributed in the hope that it will be useful,
21175 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21176 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21177 + * GNU Lesser General Public License version 3 for more details
21178 + * (a copy is included in the LICENSE file that accompanied this code).
21180 + * You should have received a copy of the GNU Lesser General Public License
21181 + * version 3 along with OpenOffice.org. If not, see
21182 + * <http://www.openoffice.org/license.html>
21183 + * for a copy of the LGPLv3 License.
21185 + ************************************************************************/
21186 +#ifndef VBA_APPLICATION_BASE_HXX
21187 +#define VBA_APPLICATION_BASE_HXX
21189 +#include <ooo/vba/XHelperInterface.hpp>
21190 +#include <ooo/vba/XApplicationBase.hpp>
21191 +#include <vbahelper/vbahelperinterface.hxx>
21193 +typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE;
21195 +class VbaApplicationBase : public ApplicationBase_BASE
21198 + VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
21199 + virtual ~VbaApplicationBase();
21202 + // XHelperInterface ( parent is itself )
21203 + virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
21205 + virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException);
21206 + virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException);
21207 + virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
21208 + virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
21209 + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
21211 + // XHelperInterface
21212 + virtual rtl::OUString& getServiceImplName();
21213 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
21216 --- vbahelper/inc/vbahelper/vbacollectionimpl.hxx.old 1970-01-01 00:00:00.000000000 +0000
21217 +++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx 2009-04-06 16:42:01.000000000 +0000
21219 +/*************************************************************************
21221 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21223 + * Copyright 2008 by Sun Microsystems, Inc.
21225 + * OpenOffice.org - a multi-platform office productivity suite
21227 + * $RCSfile: vbacollectionimpl.hxx,v $
21228 + * $Revision: 1.5 $
21230 + * This file is part of OpenOffice.org.
21232 + * OpenOffice.org is free software: you can redistribute it and/or modify
21233 + * it under the terms of the GNU Lesser General Public License version 3
21234 + * only, as published by the Free Software Foundation.
21236 + * OpenOffice.org is distributed in the hope that it will be useful,
21237 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21238 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21239 + * GNU Lesser General Public License version 3 for more details
21240 + * (a copy is included in the LICENSE file that accompanied this code).
21242 + * You should have received a copy of the GNU Lesser General Public License
21243 + * version 3 along with OpenOffice.org. If not, see
21244 + * <http://www.openoffice.org/license.html>
21245 + * for a copy of the LGPLv3 License.
21247 + ************************************************************************/
21248 +#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
21249 +#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
21251 +#include <ooo/vba/XCollection.hpp>
21252 +#include <com/sun/star/container/XEnumerationAccess.hpp>
21253 +#include <com/sun/star/uno/XComponentContext.hpp>
21254 +#include <com/sun/star/script/XDefaultMethod.hpp>
21255 +#include <com/sun/star/container/XIndexAccess.hpp>
21256 +#include <com/sun/star/container/XNameAccess.hpp>
21257 +#include <com/sun/star/container/XNamed.hpp>
21259 +#include <cppuhelper/implbase3.hxx>
21260 +#include <cppuhelper/implbase2.hxx>
21261 +#include <cppuhelper/implbase1.hxx>
21263 +#include "vbahelper/vbahelper.hxx"
21264 +#include "vbahelper/vbahelperinterface.hxx"
21268 +typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
21270 +class EnumerationHelperImpl : public EnumerationHelper_BASE
21273 + css::uno::Reference< css::uno::XComponentContext > m_xContext;
21274 + css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
21277 + EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
21278 + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
21281 +// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces
21282 +// only requirement is the object needs to implement XName
21286 +typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
21288 +template< typename Ifc1 >
21289 +class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
21292 +typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec;
21295 + class XNamedEnumerationHelper : public EnumerationHelper_BASE
21297 + XNamedVec mXNamedVec;
21298 + typename XNamedVec::iterator mIt;
21300 + XNamedEnumerationHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), mIt( mXNamedVec.begin() ) {}
21302 + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException)
21304 + return ( mIt != mXNamedVec.end() );
21307 + virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
21309 + if ( hasMoreElements() )
21310 + return css::uno::makeAny( *mIt++ );
21311 + throw css::container::NoSuchElementException();
21316 + XNamedVec mXNamedVec;
21317 + typename XNamedVec::iterator cachePos;
21319 + XNamedObjectCollectionHelper( const XNamedVec& sMap ) : mXNamedVec( sMap ), cachePos(mXNamedVec.begin()) {}
21320 + // XElementAccess
21321 + virtual css::uno::Type SAL_CALL getElementType( ) throw (css::uno::RuntimeException) { return Ifc1::static_type(0); }
21322 + virtual ::sal_Bool SAL_CALL hasElements( ) throw (css::uno::RuntimeException) { return ( mXNamedVec.size() > 0 ); }
21324 + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
21326 + if ( !hasByName(aName) )
21327 + throw css::container::NoSuchElementException();
21328 + return css::uno::makeAny( *cachePos );
21330 + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException)
21332 + css::uno::Sequence< rtl::OUString > sNames( mXNamedVec.size() );
21333 + rtl::OUString* pString = sNames.getArray();
21334 + typename XNamedVec::iterator it = mXNamedVec.begin();
21335 + typename XNamedVec::iterator it_end = mXNamedVec.end();
21337 + for ( ; it != it_end; ++it, ++pString )
21339 + css::uno::Reference< css::container::XNamed > xName( *it, css::uno::UNO_QUERY_THROW );
21340 + *pString = xName->getName();
21344 + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
21346 + cachePos = mXNamedVec.begin();
21347 + typename XNamedVec::iterator it_end = mXNamedVec.end();
21348 + for ( ; cachePos != it_end; ++cachePos )
21350 + css::uno::Reference< css::container::XNamed > xName( *cachePos, css::uno::UNO_QUERY_THROW );
21351 + if ( aName.equals( xName->getName() ) )
21354 + return ( cachePos != it_end );
21357 + // XElementAccess
21358 + virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException) { return mXNamedVec.size(); }
21359 + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException )
21361 + if ( Index < 0 || Index >= getCount() )
21362 + throw css::lang::IndexOutOfBoundsException();
21364 + return css::uno::makeAny( mXNamedVec[ Index ] );
21367 + // XEnumerationAccess
21368 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) throw (css::uno::RuntimeException)
21370 + return new XNamedEnumerationHelper( mXNamedVec );
21374 +// including a HelperInterface implementation
21375 +template< typename Ifc1 >
21376 +class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
21378 +typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
21380 + css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
21381 + css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
21383 + virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
21385 + if ( !m_xNameAccess.is() )
21386 + throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
21388 + return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
21391 + virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException)
21393 + if ( !m_xIndexAccess.is() )
21394 + throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase numeric index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
21395 + if ( nIndex <= 0 )
21397 + throw css::lang::IndexOutOfBoundsException(
21398 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
21399 + "index is 0 or negative" ) ),
21400 + css::uno::Reference< css::uno::XInterface >() );
21402 + // need to adjust for vba index ( for which first element is 1 )
21403 + return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
21406 + ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
21408 + virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
21410 + return m_xIndexAccess->getCount();
21413 + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw (css::uno::RuntimeException)
21415 + if ( Index1.getValueTypeClass() != css::uno::TypeClass_STRING )
21417 + sal_Int32 nIndex = 0;
21419 + if ( ( Index1 >>= nIndex ) != sal_True )
21421 + rtl::OUString message;
21422 + message = rtl::OUString::createFromAscii(
21423 + "Couldn't convert index to Int32");
21424 + throw css::lang::IndexOutOfBoundsException( message,
21425 + css::uno::Reference< css::uno::XInterface >() );
21427 + return getItemByIntIndex( nIndex );
21429 + rtl::OUString aStringSheet;
21431 + Index1 >>= aStringSheet;
21432 + return getItemByStringIndex( aStringSheet );
21434 + // XDefaultMethod
21435 + ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException)
21437 + const static rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM("Item") );
21440 + // XEnumerationAccess
21441 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;
21443 + // XElementAccess
21444 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
21445 + // XElementAccess
21446 + virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
21448 + return ( m_xIndexAccess->getCount() > 0 );
21450 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
21454 +typedef ::cppu::WeakImplHelper1<ov::XCollection> XCollection_InterfacesBASE;
21456 +typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1;
21457 +// compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this )
21458 +class ScVbaCollectionBaseImpl : public CollImplBase1
21461 + ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){}
21465 +template <typename Ifc> // where Ifc must implement XCollectionTest
21466 +class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
21468 +typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
21471 + CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
21475 +#endif //SC_VBA_COLLECTION_IMPL_HXX
21476 --- vbahelper/inc/vbahelper/vbadllapi.h.old 1970-01-01 00:00:00.000000000 +0000
21477 +++ vbahelper/inc/vbahelper/vbadllapi.h 2009-04-06 16:42:01.000000000 +0000
21479 +/*************************************************************************
21481 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21483 + * Copyright 2008 by Sun Microsystems, Inc.
21485 + * OpenOffice.org - a multi-platform office productivity suite
21487 + * $RCSfile: svldllapi.h,v $
21488 + * $Revision: 1.4 $
21490 + * This file is part of OpenOffice.org.
21492 + * OpenOffice.org is free software: you can redistribute it and/or modify
21493 + * it under the terms of the GNU Lesser General Public License version 3
21494 + * only, as published by the Free Software Foundation.
21496 + * OpenOffice.org is distributed in the hope that it will be useful,
21497 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21498 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21499 + * GNU Lesser General Public License version 3 for more details
21500 + * (a copy is included in the LICENSE file that accompanied this code).
21502 + * You should have received a copy of the GNU Lesser General Public License
21503 + * version 3 along with OpenOffice.org. If not, see
21504 + * <http://www.openoffice.org/license.html>
21505 + * for a copy of the LGPLv3 License.
21507 + ************************************************************************/
21509 +#ifndef INCLUDED_VBADLLAPI_H
21510 +#define INCLUDED_VBADLLAPI_H
21512 +#include "sal/types.h"
21514 +#if defined(VBAHELPER_DLLIMPLEMENTATION)
21515 +#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
21517 +#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
21519 +#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE
21521 +#endif /* INCLUDED_SVLDLLAPI_H */
21523 --- vbahelper/inc/vbahelper/vbadocumentbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
21524 +++ vbahelper/inc/vbahelper/vbadocumentbase.hxx 2009-04-06 16:42:01.000000000 +0000
21526 +/*************************************************************************
21528 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21530 + * Copyright 2008 by Sun Microsystems, Inc.
21532 + * OpenOffice.org - a multi-platform office productivity suite
21537 + * This file is part of OpenOffice.org.
21539 + * OpenOffice.org is free software: you can redistribute it and/or modify
21540 + * it under the terms of the GNU Lesser General Public License version 3
21541 + * only, as published by the Free Software Foundation.
21543 + * OpenOffice.org is distributed in the hope that it will be useful,
21544 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21545 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21546 + * GNU Lesser General Public License version 3 for more details
21547 + * (a copy is included in the LICENSE file that accompanied this code).
21549 + * You should have received a copy of the GNU Lesser General Public License
21550 + * version 3 along with OpenOffice.org. If not, see
21551 + * <http://www.openoffice.org/license.html>
21552 + * for a copy of the LGPLv3 License.
21554 + ************************************************************************/
21555 +#ifndef VBA_DOCUMENTBASE_HXX
21556 +#define VBA_DOCUMENTBASE_HXX
21558 +#include <com/sun/star/frame/XModel.hpp>
21559 +#include <ooo/vba/XDocumentBase.hpp>
21560 +#include <vbahelper/vbahelperinterface.hxx>
21562 +typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentBase > VbaDocumentBase_BASE;
21564 +class VbaDocumentBase : public VbaDocumentBase_BASE
21567 + css::uno::Reference< css::frame::XModel > mxModel;
21569 + virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
21570 + VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
21572 + VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
21573 + css::uno::Reference< css::frame::XModel > xModel );
21574 + VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
21575 + virtual ~VbaDocumentBase() {}
21578 + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
21579 + virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
21580 + virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException);
21581 + virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException);
21582 + virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
21585 + virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
21586 + const css::uno::Any &aFileName,
21587 + const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
21588 + virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
21589 + virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
21590 + virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
21591 + virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
21593 + // XHelperInterface
21594 + virtual rtl::OUString& getServiceImplName();
21595 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
21598 +#endif /* VBA_DOCUMENTBASE_HXX */
21599 --- vbahelper/inc/vbahelper/vbaglobalbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
21600 +++ vbahelper/inc/vbahelper/vbaglobalbase.hxx 2009-04-06 16:42:01.000000000 +0000
21602 +/*************************************************************************
21604 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21606 + * Copyright 2008 by Sun Microsystems, Inc.
21608 + * OpenOffice.org - a multi-platform office productivity suite
21610 + * $RCSfile: vbaapplicationbase.hxx,v $
21611 + * $Revision: 1.3 $
21613 + * This file is part of OpenOffice.org.
21615 + * OpenOffice.org is free software: you can redistribute it and/or modify
21616 + * it under the terms of the GNU Lesser General Public License version 3
21617 + * only, as published by the Free Software Foundation.
21619 + * OpenOffice.org is distributed in the hope that it will be useful,
21620 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21621 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21622 + * GNU Lesser General Public License version 3 for more details
21623 + * (a copy is included in the LICENSE file that accompanied this code).
21625 + * You should have received a copy of the GNU Lesser General Public License
21626 + * version 3 along with OpenOffice.org. If not, see
21627 + * <http://www.openoffice.org/license.html>
21628 + * for a copy of the LGPLv3 License.
21630 + ************************************************************************/
21631 +#ifndef VBA_GLOBAL_BASE_HXX
21632 +#define VBA_GLOBAL_BASE_HXX
21634 +#include "vbahelperinterface.hxx"
21635 +#include <ooo/vba/XGlobalsBase.hpp>
21637 +typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE;
21638 +class VbaGlobalsBase : public Globals_BASE
21643 + bool hasServiceName( const rtl::OUString& serviceName );
21644 + void init( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any& aApplication );
21647 + VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
21648 + virtual ~VbaGlobalsBase(){};
21649 + // XMultiServiceFactory
21650 + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
21651 + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException);
21652 + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
21655 --- vbahelper/inc/vbahelper/vbahelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
21656 +++ vbahelper/inc/vbahelper/vbahelper.hxx 2009-04-06 16:42:01.000000000 +0000
21658 +/*************************************************************************
21660 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21662 + * Copyright 2008 by Sun Microsystems, Inc.
21664 + * OpenOffice.org - a multi-platform office productivity suite
21666 + * $RCSfile: vbahelper.hxx,v $
21667 + * $Revision: 1.5.32.1 $
21669 + * This file is part of OpenOffice.org.
21671 + * OpenOffice.org is free software: you can redistribute it and/or modify
21672 + * it under the terms of the GNU Lesser General Public License version 3
21673 + * only, as published by the Free Software Foundation.
21675 + * OpenOffice.org is distributed in the hope that it will be useful,
21676 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21677 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21678 + * GNU Lesser General Public License version 3 for more details
21679 + * (a copy is included in the LICENSE file that accompanied this code).
21681 + * You should have received a copy of the GNU Lesser General Public License
21682 + * version 3 along with OpenOffice.org. If not, see
21683 + * <http://www.openoffice.org/license.html>
21684 + * for a copy of the LGPLv3 License.
21686 + ************************************************************************/
21687 +#ifndef OOVBAAPI_VBA_HELPER_HXX
21688 +#define OOVBAAPI_VBA_HELPER_HXX
21690 +#include <com/sun/star/drawing/XShape.hpp>
21691 +#include <com/sun/star/beans/XIntrospectionAccess.hpp>
21692 +#include <com/sun/star/beans/XPropertySet.hpp>
21693 +#include <com/sun/star/script/BasicErrorException.hpp>
21694 +#include <com/sun/star/script/XTypeConverter.hpp>
21695 +#include <com/sun/star/lang/IllegalArgumentException.hpp>
21696 +#include <com/sun/star/awt/XControl.hpp>
21697 +#include <com/sun/star/awt/XDevice.hpp>
21698 +#include <basic/sberrors.hxx>
21699 +#include <cppuhelper/implbase1.hxx>
21700 +#include <com/sun/star/frame/XModel.hpp>
21701 +#include <sfx2/dispatch.hxx>
21702 +//#include <ooo/vba/msforms/XShape.hpp>
21703 +#include <vcl/pointr.hxx>
21704 +#define VBAHELPER_DLLIMPLEMENTATION
21705 +#include <vbahelper/vbadllapi.h>
21706 +namespace css = ::com::sun::star;
21712 + template < class T >
21713 + css::uno::Reference< T > getXSomethingFromArgs( css::uno::Sequence< css::uno::Any > const & args, sal_Int32 nPos, bool bCanBeNull = true ) throw (css::lang::IllegalArgumentException)
21715 + if ( args.getLength() < ( nPos + 1) )
21716 + throw css::lang::IllegalArgumentException();
21717 + css::uno::Reference< T > aSomething( args[ nPos ], css::uno::UNO_QUERY );
21718 + if ( !bCanBeNull && !aSomething.is() )
21719 + throw css::lang::IllegalArgumentException();
21720 + return aSomething;
21722 + VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
21723 + VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
21724 + VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
21725 + VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
21726 + VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
21728 + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
21729 + VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
21730 + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
21731 + VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
21732 + VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
21733 + VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& );
21734 + VBAHELPER_DLLPUBLIC css::uno::Any XLRGBToOORGB( const css::uno::Any& );
21735 + // provide a NULL object that can be passed as variant so that
21736 + // the object when passed to IsNull will return true. aNULL
21737 + // contains an empty object reference
21738 + VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL();
21739 + VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection );
21740 + VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* );
21742 + VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
21743 + VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
21744 + VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
21745 + VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
21746 + VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
21747 + VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle();
21748 + VBAHELPER_DLLPUBLIC void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite );
21749 + VBAHELPER_DLLPUBLIC String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
21751 +class VBAHELPER_DLLPUBLIC Millimeter
21753 +//Factor to translate between points and hundredths of millimeters:
21755 + static const double factor;
21757 + double m_nMillimeter;
21762 + Millimeter(double mm);
21764 + void set(double mm);
21765 + void setInPoints(double points) ;
21766 + void setInHundredthsOfOneMillimeter(double hmm);
21768 + double getInHundredthsOfOneMillimeter();
21769 + double getInPoints();
21770 + static sal_Int32 getInHundredthsOfOneMillimeter(double points);
21771 + static double getInPoints(int _hmm);
21774 +class VBAHELPER_DLLPUBLIC AbstractGeometryAttributes // probably should replace the ShapeHelper below
21777 + virtual ~AbstractGeometryAttributes() {}
21778 + virtual double getLeft() = 0;
21779 + virtual void setLeft( double ) = 0;
21780 + virtual double getTop() = 0;
21781 + virtual void setTop( double ) = 0;
21782 + virtual double getHeight() = 0;
21783 + virtual void setHeight( double ) = 0;
21784 + virtual double getWidth() = 0;
21785 + virtual void setWidth( double ) = 0;
21788 +namespace msforms {
21792 +class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
21795 + css::uno::Reference< ooo::vba::msforms::XShape > m_xShape;
21796 + ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
21797 + virtual double getLeft();
21798 + virtual void setLeft( double nLeft );
21799 + virtual double getTop();
21800 + virtual void setTop( double nTop );
21801 + virtual double getHeight();
21802 + virtual void setHeight( double nHeight );
21803 + virtual double getWidth();
21804 + virtual void setWidth( double nWidth);
21806 +#define VBA_LEFT "PositionX"
21807 +#define VBA_TOP "PositionY"
21808 +class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
21811 + css::uno::Reference< css::beans::XPropertySet > mxModel;
21813 + UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
21814 + virtual double getLeft();
21815 + virtual void setLeft( double nLeft );
21816 + virtual double getTop();
21817 + virtual void setTop( double nTop );
21818 + virtual double getHeight();
21819 + virtual void setHeight( double nHeight );
21820 + virtual double getWidth();
21821 + virtual void setWidth( double nWidth);
21824 +class VBAHELPER_DLLPUBLIC ShapeHelper
21827 + css::uno::Reference< css::drawing::XShape > xShape;
21829 + ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
21831 + double getHeight();
21833 + void setHeight(double _fheight) throw ( css::script::BasicErrorException );
21835 + double getWidth();
21837 + void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
21839 + double getLeft();
21841 + void setLeft(double _fLeft);
21845 + void setTop(double _fTop);
21848 +class VBAHELPER_DLLPUBLIC ContainerUtilities
21852 + static rtl::OUString getUniqueName( const css::uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator);
21853 + static rtl::OUString getUniqueName( const css::uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix );
21855 + static sal_Int32 FieldInList( const css::uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString );
21858 +// really just a a place holder to ease the porting pain
21859 +class VBAHELPER_DLLPUBLIC DebugHelper
21862 + static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException );
21864 + static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException );
21866 + static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
21871 +namespace ov = ooo::vba;
21874 +# define SC_VBA_FIXME(a) OSL_TRACE( a )
21875 +# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ ))
21877 +# define SC_VBA_FIXME(a)
21878 +# define SC_VBA_STUB()
21882 --- vbahelper/inc/vbahelper/vbahelperinterface.hxx.old 1970-01-01 00:00:00.000000000 +0000
21883 +++ vbahelper/inc/vbahelper/vbahelperinterface.hxx 2009-04-06 16:42:01.000000000 +0000
21885 +/*************************************************************************
21887 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21889 + * Copyright 2008 by Sun Microsystems, Inc.
21891 + * OpenOffice.org - a multi-platform office productivity suite
21893 + * $RCSfile: vbahelperinterface.hxx,v $
21894 + * $Revision: 1.3 $
21896 + * This file is part of OpenOffice.org.
21898 + * OpenOffice.org is free software: you can redistribute it and/or modify
21899 + * it under the terms of the GNU Lesser General Public License version 3
21900 + * only, as published by the Free Software Foundation.
21902 + * OpenOffice.org is distributed in the hope that it will be useful,
21903 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21904 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21905 + * GNU Lesser General Public License version 3 for more details
21906 + * (a copy is included in the LICENSE file that accompanied this code).
21908 + * You should have received a copy of the GNU Lesser General Public License
21909 + * version 3 along with OpenOffice.org. If not, see
21910 + * <http://www.openoffice.org/license.html>
21911 + * for a copy of the LGPLv3 License.
21913 + ************************************************************************/
21914 +#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX
21915 +#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
21917 +#include <cppuhelper/implbase1.hxx>
21918 +#include <ooo/vba/XHelperInterface.hpp>
21919 +#include <vbahelper/vbahelper.hxx>
21920 +#include <com/sun/star/container/XNameAccess.hpp>
21922 +// use this class when you have an a object like
21923 +// interface XAnInterface which contains XHelperInterface in its inheritance hierarchy
21924 +// interface XAnInterface
21926 +// interface XHelperInterface;
21927 +// [attribute, string] name;
21930 +// interface XAnInterface : XHelperInterface;
21932 +// [attribute, string] name;
21935 +// then this class can provide a default implementation of XHelperInterface,
21936 +// you can use it like this
21937 +// typedef InheritedHelperInterfaceImpl< XAnInterface > > AnInterfaceImpl_BASE;
21938 +// class AnInterfaceImpl : public AnInterfaceImpl_BASE
21941 +// AnInterface( const Reference< HelperInterface >& xParent ) : AnInterfaceImpl_BASE( xParent ) {}
21942 +// // implement XAnInterface methods only, no need to implement the XHelperInterface
21944 +// virtual void setName( const OUString& );
21945 +// virtual OUString getName();
21948 +const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) );
21950 +template< typename Ifc1 >
21951 +class InheritedHelperInterfaceImpl : public Ifc1
21954 + css::uno::WeakReference< ov::XHelperInterface > mxParent;
21955 + css::uno::Reference< css::uno::XComponentContext > mxContext;
21957 + InheritedHelperInterfaceImpl() {}
21958 + InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
21959 + virtual rtl::OUString& getServiceImplName() = 0;
21960 + virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
21962 + // XHelperInterface Methods
21963 + virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
21965 + return 0x53756E4F;
21967 + virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return mxParent; }
21969 + virtual css::uno::Any SAL_CALL Application( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) {
21970 + // The application could certainly be passed around in the context - seems
21972 + css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW );
21973 + return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) );
21977 + // XServiceInfo Methods
21978 + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
21979 + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException)
21981 + css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames();
21982 + const rtl::OUString* pStart = sServices.getConstArray();
21983 + const rtl::OUString* pEnd = pStart + sServices.getLength();
21984 + for ( ; pStart != pEnd ; ++pStart )
21985 + if ( (*pStart).equals( ServiceName ) )
21987 + return sal_False;
21989 + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException)
21991 + css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
21996 +template< typename Ifc1 >
21997 +class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
22000 +typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
22002 + InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
22006 --- vbahelper/inc/vbahelper/vbapropvalue.hxx.old 1970-01-01 00:00:00.000000000 +0000
22007 +++ vbahelper/inc/vbahelper/vbapropvalue.hxx 2009-04-06 16:42:01.000000000 +0000
22009 +/*************************************************************************
22011 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22013 + * Copyright 2008 by Sun Microsystems, Inc.
22015 + * OpenOffice.org - a multi-platform office productivity suite
22017 + * $RCSfile: vbapropvalue.hxx,v $
22018 + * $Revision: 1.3 $
22020 + * This file is part of OpenOffice.org.
22022 + * OpenOffice.org is free software: you can redistribute it and/or modify
22023 + * it under the terms of the GNU Lesser General Public License version 3
22024 + * only, as published by the Free Software Foundation.
22026 + * OpenOffice.org is distributed in the hope that it will be useful,
22027 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22028 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22029 + * GNU Lesser General Public License version 3 for more details
22030 + * (a copy is included in the LICENSE file that accompanied this code).
22032 + * You should have received a copy of the GNU Lesser General Public License
22033 + * version 3 along with OpenOffice.org. If not, see
22034 + * <http://www.openoffice.org/license.html>
22035 + * for a copy of the LGPLv3 License.
22037 + ************************************************************************/
22038 +#ifndef SC_VBA_PROPVALULE_HXX
22039 +#define SC_VBA_PROPVALULE_HXX
22040 +#include <ooo/vba/XPropValue.hpp>
22041 +#include <cppuhelper/implbase1.hxx>
22043 +#include <vbahelper/vbahelper.hxx>
22045 +typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
22047 +class PropListener
22050 + virtual void setValueEvent( const css::uno::Any& value ) = 0;
22051 + virtual css::uno::Any getValueEvent() = 0;
22055 +class ScVbaPropValue : public PropValueImpl_BASE
22057 + PropListener* m_pListener;
22059 + ScVbaPropValue( PropListener* pListener );
22062 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
22063 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
22065 + rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
22068 +#endif //SC_VBA_PROPVALULE_HXX
22069 --- vbahelper/inc/vbahelper/vbawindowbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
22070 +++ vbahelper/inc/vbahelper/vbawindowbase.hxx 2009-04-06 16:42:01.000000000 +0000
22072 +/*************************************************************************
22074 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22076 + * Copyright 2008 by Sun Microsystems, Inc.
22078 + * OpenOffice.org - a multi-platform office productivity suite
22083 + * This file is part of OpenOffice.org.
22085 + * OpenOffice.org is free software: you can redistribute it and/or modify
22086 + * it under the terms of the GNU Lesser General Public License version 3
22087 + * only, as published by the Free Software Foundation.
22089 + * OpenOffice.org is distributed in the hope that it will be useful,
22090 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22091 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22092 + * GNU Lesser General Public License version 3 for more details
22093 + * (a copy is included in the LICENSE file that accompanied this code).
22095 + * You should have received a copy of the GNU Lesser General Public License
22096 + * version 3 along with OpenOffice.org. If not, see
22097 + * <http://www.openoffice.org/license.html>
22098 + * for a copy of the LGPLv3 License.
22100 + ************************************************************************/
22101 +#ifndef VBA_WINDOWBASE_HXX
22102 +#define VBA_WINDOWBASE_HXX
22103 +#include <cppuhelper/implbase1.hxx>
22104 +#include <ooo/vba/XWindowBase.hpp>
22105 +#include <com/sun/star/frame/XModel.hpp>
22106 +#include <com/sun/star/awt/XDevice.hpp>
22108 +#include <vbahelper/vbahelperinterface.hxx>
22110 +typedef InheritedHelperInterfaceImpl1<ov::XWindowBase > WindowBaseImpl_BASE;
22112 +class VbaWindowBase : public WindowBaseImpl_BASE
22115 + css::uno::Reference< css::frame::XModel > m_xModel;
22117 + VbaWindowBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
22118 + VbaWindowBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
22121 + virtual sal_Int32 SAL_CALL getHeight() throw (css::uno::RuntimeException) ;
22122 + virtual void SAL_CALL setHeight( sal_Int32 _height ) throw (css::uno::RuntimeException) ;
22123 + virtual sal_Int32 SAL_CALL getLeft() throw (css::uno::RuntimeException) ;
22124 + virtual void SAL_CALL setLeft( sal_Int32 _left ) throw (css::uno::RuntimeException) ;
22125 + virtual sal_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ;
22126 + virtual void SAL_CALL setTop( sal_Int32 _top ) throw (css::uno::RuntimeException) ;
22127 + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
22128 + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
22129 + virtual sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException) ;
22130 + virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ;
22132 + // XHelperInterface
22133 + virtual rtl::OUString& getServiceImplName();
22134 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
22137 +#endif //VBA_WINDOWBASE_HXX
22138 --- vbahelper/prj/build.lst.old 1970-01-01 00:00:00.000000000 +0000
22139 +++ vbahelper/prj/build.lst 2009-04-06 16:42:01.000000000 +0000
22141 +vba vbahelper : oovbaapi basic sfx2 svx cppuhelper vcl comphelper svtools tools sal NULL
22142 +vba vbahelper usr1 - all vba_mkout NULL
22143 +#vba vbahelper\inc nmake - all vba_inc NULL
22144 +vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL
22145 +vba vbahelper\source\msforms nmake - all vba_msforms NULL
22146 +vba vbahelper\util nmake - all vba_util vba_vbahelper vba_msforms NULL
22147 --- vbahelper/prj/d.lst.old 1970-01-01 00:00:00.000000000 +0000
22148 +++ vbahelper/prj/d.lst 2009-04-06 16:42:01.000000000 +0000
22150 +..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
22151 +..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%
22152 +..\%__SRC%\slb\vbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib
22153 +..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
22154 +..\%__SRC%\bin\vbahelper*.* %_DEST%\bin%_EXT%\vbahelper*.*
22155 +..\%__SRC%\bin\msforms*.* %_DEST%\bin%_EXT%\msforms*.*
22157 +mkdir: %_DEST%\inc%_EXT%\basic
22158 +..\inc\vbahelper\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\vbahelper\vbacollectionimpl.hxx
22159 +..\inc\vbahelper\vbahelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelper.hxx
22160 +..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx
22161 +..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx
22162 +..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx
22163 +..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h
22164 +..\inc\vbahelper\vbawindowbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbawindowbase.hxx
22165 +..\inc\vbahelper\vbadocumentbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentbase.hxx
22166 +..\inc\vbahelper\vbapropvalue.hxx %_DEST%\inc%_EXT%\vbahelper\vbapropvalue.hxx
22167 +..\inc\vbahelper\vbaglobalbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaglobalbase.hxx
22168 --- vbahelper/source/msforms/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
22169 +++ vbahelper/source/msforms/makefile.mk 2009-04-06 16:42:01.000000000 +0000
22171 +#*************************************************************************
22173 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22175 +# Copyright 2008 by Sun Microsystems, Inc.
22177 +# OpenOffice.org - a multi-platform office productivity suite
22179 +# $RCSfile: makefile.mk,v $
22181 +# $Revision: 1.45 $
22183 +# This file is part of OpenOffice.org.
22185 +# OpenOffice.org is free software: you can redistribute it and/or modify
22186 +# it under the terms of the GNU Lesser General Public License version 3
22187 +# only, as published by the Free Software Foundation.
22189 +# OpenOffice.org is distributed in the hope that it will be useful,
22190 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
22191 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22192 +# GNU Lesser General Public License version 3 for more details
22193 +# (a copy is included in the LICENSE file that accompanied this code).
22195 +# You should have received a copy of the GNU Lesser General Public License
22196 +# version 3 along with OpenOffice.org. If not, see
22197 +# <http://www.openoffice.org/license.html>
22198 +# for a copy of the LGPLv3 License.
22200 +#*************************************************************************
22206 +ENABLE_EXCEPTIONS := TRUE
22208 +# --- Settings -----------------------------------------------------
22210 +.INCLUDE : settings.mk
22213 + $(SLO)$/vbacontrol.obj \
22214 + $(SLO)$/vbacontrols.obj \
22215 + $(SLO)$/vbabutton.obj \
22216 + $(SLO)$/vbacombobox.obj \
22217 + $(SLO)$/vbalabel.obj \
22218 + $(SLO)$/vbatextbox.obj \
22219 + $(SLO)$/vbaradiobutton.obj \
22220 + $(SLO)$/vbalistbox.obj \
22221 + $(SLO)$/vbatogglebutton.obj \
22222 + $(SLO)$/vbacheckbox.obj \
22223 + $(SLO)$/vbaframe.obj \
22224 + $(SLO)$/vbascrollbar.obj \
22225 + $(SLO)$/vbaprogressbar.obj \
22226 + $(SLO)$/vbamultipage.obj \
22227 + $(SLO)$/vbalistcontrolhelper.obj \
22228 + $(SLO)$/vbaspinbutton.obj \
22229 + $(SLO)$/vbaimage.obj \
22230 + $(SLO)$/vbapages.obj \
22231 + $(SLO)$/vbauserform.obj \
22232 + $(SLO)$/service.obj \
22234 +# #FIXME vbapropvalue needs to move to vbahelper
22236 +# --- Targets -------------------------------------------------------
22238 +.INCLUDE : target.mk
22241 + $(MISC)$/$(TARGET).don \
22243 +$(SLOFILES) : $(MISC)$/$(TARGET).don
22245 +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
22246 + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
22249 --- vbahelper/source/msforms/service.cxx.old 1970-01-01 00:00:00.000000000 +0000
22250 +++ vbahelper/source/msforms/service.cxx 2009-04-06 16:42:01.000000000 +0000
22252 +/*************************************************************************
22254 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22256 + * Copyright 2008 by Sun Microsystems, Inc.
22258 + * OpenOffice.org - a multi-platform office productivity suite
22260 + * $RCSfile: service.cxx,v $
22261 + * $Revision: 1.4 $
22263 + * This file is part of OpenOffice.org.
22265 + * OpenOffice.org is free software: you can redistribute it and/or modify
22266 + * it under the terms of the GNU Lesser General Public License version 3
22267 + * only, as published by the Free Software Foundation.
22269 + * OpenOffice.org is distributed in the hope that it will be useful,
22270 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22271 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22272 + * GNU Lesser General Public License version 3 for more details
22273 + * (a copy is included in the LICENSE file that accompanied this code).
22275 + * You should have received a copy of the GNU Lesser General Public License
22276 + * version 3 along with OpenOffice.org. If not, see
22277 + * <http://www.openoffice.org/license.html>
22278 + * for a copy of the LGPLv3 License.
22280 + ************************************************************************/
22281 +#include "cppuhelper/implementationentry.hxx"
22282 +#include "com/sun/star/lang/XMultiServiceFactory.hpp"
22283 +#include "com/sun/star/registry/XRegistryKey.hpp"
22284 +#include "comphelper/servicedecl.hxx"
22286 +// =============================================================================
22287 +// component exports
22288 +// =============================================================================
22289 +using namespace ::com::sun::star;
22290 +using namespace ::com::sun::star::uno;
22292 +namespace sdecl = comphelper::service_decl;
22294 +// reference service helper(s)
22295 +namespace controlprovider
22297 +extern sdecl::ServiceDecl const serviceDecl;
22300 +namespace userform
22302 +extern sdecl::ServiceDecl const serviceDecl;
22307 + void SAL_CALL component_getImplementationEnvironment(
22308 + const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
22310 + OSL_TRACE("In component_getImplementationEnv");
22311 + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
22314 + sal_Bool SAL_CALL component_writeInfo(
22315 + lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
22317 + OSL_TRACE("In component_writeInfo");
22319 + // Component registration
22320 + return component_writeInfoHelper( pServiceManager, pRegistryKey,
22321 + controlprovider::serviceDecl, userform::serviceDecl );
22324 + void * SAL_CALL component_getFactory(
22325 + const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
22326 + registry::XRegistryKey * pRegistryKey )
22328 + OSL_TRACE("In component_getFactory for %s", pImplName );
22329 + void* pRet = component_getFactoryHelper(
22330 + pImplName, pServiceManager, pRegistryKey, controlprovider::serviceDecl, userform::serviceDecl );
22331 + OSL_TRACE("Ret is 0x%x", pRet);
22335 --- vbahelper/source/msforms/vbabutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
22336 +++ vbahelper/source/msforms/vbabutton.cxx 2009-04-06 16:42:01.000000000 +0000
22338 +/*************************************************************************
22340 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22342 + * Copyright 2008 by Sun Microsystems, Inc.
22344 + * OpenOffice.org - a multi-platform office productivity suite
22346 + * $RCSfile: vbabutton.cxx,v $
22347 + * $Revision: 1.3 $
22349 + * This file is part of OpenOffice.org.
22351 + * OpenOffice.org is free software: you can redistribute it and/or modify
22352 + * it under the terms of the GNU Lesser General Public License version 3
22353 + * only, as published by the Free Software Foundation.
22355 + * OpenOffice.org is distributed in the hope that it will be useful,
22356 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22357 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22358 + * GNU Lesser General Public License version 3 for more details
22359 + * (a copy is included in the LICENSE file that accompanied this code).
22361 + * You should have received a copy of the GNU Lesser General Public License
22362 + * version 3 along with OpenOffice.org. If not, see
22363 + * <http://www.openoffice.org/license.html>
22364 + * for a copy of the LGPLv3 License.
22366 + ************************************************************************/
22367 +#include "vbabutton.hxx"
22370 +using namespace com::sun::star;
22371 +using namespace ooo::vba;
22374 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
22375 +ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
22380 +rtl::OUString SAL_CALL
22381 +ScVbaButton::getCaption() throw (css::uno::RuntimeException)
22383 + rtl::OUString Label;
22384 + m_xProps->getPropertyValue( LABEL ) >>= Label;
22389 +ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
22391 + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
22395 +ScVbaButton::getServiceImplName()
22397 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") );
22398 + return sImplName;
22401 +uno::Sequence< rtl::OUString >
22402 +ScVbaButton::getServiceNames()
22404 + static uno::Sequence< rtl::OUString > aServiceNames;
22405 + if ( aServiceNames.getLength() == 0 )
22407 + aServiceNames.realloc( 1 );
22408 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) );
22410 + return aServiceNames;
22412 --- vbahelper/source/msforms/vbabutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
22413 +++ vbahelper/source/msforms/vbabutton.hxx 2009-04-06 16:42:01.000000000 +0000
22415 +/*************************************************************************
22417 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22419 + * Copyright 2008 by Sun Microsystems, Inc.
22421 + * OpenOffice.org - a multi-platform office productivity suite
22423 + * $RCSfile: vbabutton.hxx,v $
22424 + * $Revision: 1.3 $
22426 + * This file is part of OpenOffice.org.
22428 + * OpenOffice.org is free software: you can redistribute it and/or modify
22429 + * it under the terms of the GNU Lesser General Public License version 3
22430 + * only, as published by the Free Software Foundation.
22432 + * OpenOffice.org is distributed in the hope that it will be useful,
22433 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22434 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22435 + * GNU Lesser General Public License version 3 for more details
22436 + * (a copy is included in the LICENSE file that accompanied this code).
22438 + * You should have received a copy of the GNU Lesser General Public License
22439 + * version 3 along with OpenOffice.org. If not, see
22440 + * <http://www.openoffice.org/license.html>
22441 + * for a copy of the LGPLv3 License.
22443 + ************************************************************************/
22444 +#ifndef SC_VBA_BUTTON_HXX
22445 +#define SC_VBA_BUTTON_HXX
22446 +#include <cppuhelper/implbase1.hxx>
22447 +#include <ooo/vba/msforms/XButton.hpp>
22449 +#include "vbacontrol.hxx"
22450 +#include <vbahelper/vbahelper.hxx>
22452 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
22454 +class ScVbaButton : public ButtonImpl_BASE
22457 + ScVbaButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
22459 + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
22460 + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
22461 + //XHelperInterface
22462 + virtual rtl::OUString& getServiceImplName();
22463 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
22465 +#endif //SC_VBA_BUTTON_HXX
22466 --- vbahelper/source/msforms/vbacheckbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
22467 +++ vbahelper/source/msforms/vbacheckbox.cxx 2009-04-06 16:42:01.000000000 +0000
22469 +/*************************************************************************
22471 + * OpenOffice.org - a multi-platform office productivity suite
22477 + * last change: $Author$ $Date$
22479 + * The Contents of this file are made available subject to
22480 + * the terms of GNU Lesser General Public License Version 2.1.
22483 + * GNU Lesser General Public License Version 2.1
22484 + * =============================================
22485 + * Copyright 2005 by Sun Microsystems, Inc.
22486 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
22488 + * This library is free software; you can redistribute it and/or
22489 + * modify it under the terms of the GNU Lesser General Public
22490 + * License version 2.1, as published by the Free Software Foundation.
22492 + * This library is distributed in the hope that it will be useful,
22493 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22494 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22495 + * Lesser General Public License for more details.
22497 + * You should have received a copy of the GNU Lesser General Public
22498 + * License along with this library; if not, write to the Free Software
22499 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22500 + * MA 02111-1307 USA
22502 + ************************************************************************/
22503 +#include "vbacheckbox.hxx"
22504 +#include <vbahelper/helperdecl.hxx>
22507 +using namespace com::sun::star;
22508 +using namespace ooo::vba;
22511 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
22512 +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
22513 +ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
22518 +rtl::OUString SAL_CALL
22519 +ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException)
22521 + rtl::OUString Label;
22522 + m_xProps->getPropertyValue( LABEL ) >>= Label;
22527 +ScVbaCheckbox::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
22529 + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
22533 +ScVbaCheckbox::getValue() throw (css::uno::RuntimeException)
22535 + sal_Int16 nValue = -1;
22536 + m_xProps->getPropertyValue( STATE ) >>= nValue;
22537 + if( nValue != 0 )
22539 +// return uno::makeAny( nValue );
22540 +// I must be missing something MSO says value should be -1 if selected, 0 if not
22542 + return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False );
22546 +ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
22548 + sal_Int16 nValue = 0;
22549 + sal_Bool bValue = false;
22550 + if( _value >>= nValue )
22552 + if( nValue == -1)
22555 + else if ( _value >>= bValue )
22560 + m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
22563 +ScVbaCheckbox::getServiceImplName()
22565 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") );
22566 + return sImplName;
22569 +uno::Sequence< rtl::OUString >
22570 +ScVbaCheckbox::getServiceNames()
22572 + static uno::Sequence< rtl::OUString > aServiceNames;
22573 + if ( aServiceNames.getLength() == 0 )
22575 + aServiceNames.realloc( 1 );
22576 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) );
22578 + return aServiceNames;
22581 --- vbahelper/source/msforms/vbacheckbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
22582 +++ vbahelper/source/msforms/vbacheckbox.hxx 2009-04-06 16:42:01.000000000 +0000
22584 +/*************************************************************************
22586 + * OpenOffice.org - a multi-platform office productivity suite
22592 + * last change: $Author$ $Date$
22594 + * The Contents of this file are made available subject to
22595 + * the terms of GNU Lesser General Public License Version 2.1.
22598 + * GNU Lesser General Public License Version 2.1
22599 + * =============================================
22600 + * Copyright 2005 by Sun Microsystems, Inc.
22601 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
22603 + * This library is free software; you can redistribute it and/or
22604 + * modify it under the terms of the GNU Lesser General Public
22605 + * License version 2.1, as published by the Free Software Foundation.
22607 + * This library is distributed in the hope that it will be useful,
22608 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22609 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22610 + * Lesser General Public License for more details.
22612 + * You should have received a copy of the GNU Lesser General Public
22613 + * License along with this library; if not, write to the Free Software
22614 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22615 + * MA 02111-1307 USA
22617 + ************************************************************************/
22618 +#ifndef SC_VBA_CHECKBOX_HXX
22619 +#define SC_VBA_CHECKBOX_HXX
22620 +#include <cppuhelper/implbase2.hxx>
22621 +#include <ooo/vba/msforms/XRadioButton.hpp>
22623 +#include "vbacontrol.hxx"
22624 +#include <vbahelper/vbahelper.hxx>
22626 +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
22628 +class ScVbaCheckbox : public CheckBoxImpl_BASE
22631 + ScVbaCheckbox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
22633 + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
22634 + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
22635 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
22636 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
22637 + // XDefaultProperty
22638 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
22639 + //XHelperInterface
22640 + virtual rtl::OUString& getServiceImplName();
22641 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
22644 +#endif //SC_VBA_CHECKBOX_HXX
22645 --- vbahelper/source/msforms/vbacombobox.cxx.old 1970-01-01 00:00:00.000000000 +0000
22646 +++ vbahelper/source/msforms/vbacombobox.cxx 2009-04-06 16:42:01.000000000 +0000
22648 +/*************************************************************************
22650 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22652 + * Copyright 2008 by Sun Microsystems, Inc.
22654 + * OpenOffice.org - a multi-platform office productivity suite
22656 + * $RCSfile: vbacombobox.cxx,v $
22657 + * $Revision: 1.4 $
22659 + * This file is part of OpenOffice.org.
22661 + * OpenOffice.org is free software: you can redistribute it and/or modify
22662 + * it under the terms of the GNU Lesser General Public License version 3
22663 + * only, as published by the Free Software Foundation.
22665 + * OpenOffice.org is distributed in the hope that it will be useful,
22666 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22667 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22668 + * GNU Lesser General Public License version 3 for more details
22669 + * (a copy is included in the LICENSE file that accompanied this code).
22671 + * You should have received a copy of the GNU Lesser General Public License
22672 + * version 3 along with OpenOffice.org. If not, see
22673 + * <http://www.openoffice.org/license.html>
22674 + * for a copy of the LGPLv3 License.
22676 + ************************************************************************/
22677 +#include "vbacombobox.hxx"
22680 +using namespace com::sun::star;
22681 +using namespace ooo::vba;
22684 +//SelectedItems list of integer indexes
22685 +//StringItemList list of items
22687 +const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
22688 +const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
22689 +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
22690 +const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataFieldProperty") );
22692 +ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
22694 + mpListHelper.reset( new ListControlHelper( m_xProps ) );
22695 + // grab the default value property name
22696 + m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
22702 +// Value, [read] e.g. getValue returns the value of ooo Text propery e.g. the value in
22705 +ScVbaComboBox::getValue() throw (uno::RuntimeException)
22707 + return m_xProps->getPropertyValue( sSourceName );
22711 +ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
22713 + uno::Sequence< sal_Int16 > sSelection(1);
22714 + _value >>= sSelection[ 0 ];
22715 + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) );
22719 +ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
22721 + uno::Sequence< rtl::OUString > sItems;
22722 + m_xProps->getPropertyValue( ITEMS ) >>= sItems;
22723 + // should really return the item that has focus regardless of
22724 + // it been selected
22725 + if ( sItems.getLength() > 0 )
22727 + rtl::OUString sText = getText();
22728 + sal_Int32 nLen = sItems.getLength();
22729 + for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index )
22731 + if ( sItems[ index ].equals( sText ) )
22733 + OSL_TRACE("getListIndex returning %d", index );
22734 + return uno::makeAny( index );
22739 + OSL_TRACE("getListIndex returning %d", -1 );
22740 + return uno::makeAny( sal_Int32( -1 ) );
22743 +// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one
22744 +// of the values in the list then the selection is also set
22746 +ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
22748 + m_xProps->setPropertyValue( sSourceName, _value );
22753 +::rtl::OUString SAL_CALL
22754 +ScVbaComboBox::getText() throw (uno::RuntimeException)
22756 + rtl::OUString result;
22757 + getValue() >>= result;
22762 +ScVbaComboBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
22764 + setValue( uno::makeAny( _text ) ); // seems the same
22769 +ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
22771 + mpListHelper->AddItem( pvargItem, pvargIndex );
22775 +ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
22777 + mpListHelper->removeItem( index );
22781 +ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
22783 + mpListHelper->Clear();
22787 +ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
22789 + ScVbaControl::setRowSource( _rowsource );
22790 + mpListHelper->setRowSource( _rowsource );
22793 +sal_Int32 SAL_CALL
22794 +ScVbaComboBox::getListCount() throw (uno::RuntimeException)
22796 + return mpListHelper->getListCount();
22800 +ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
22802 + return mpListHelper->List( pvargIndex, pvarColumn );
22806 +ScVbaComboBox::getServiceImplName()
22808 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") );
22809 + return sImplName;
22812 +uno::Sequence< rtl::OUString >
22813 +ScVbaComboBox::getServiceNames()
22815 + static uno::Sequence< rtl::OUString > aServiceNames;
22816 + if ( aServiceNames.getLength() == 0 )
22818 + aServiceNames.realloc( 1 );
22819 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ComboBox" ) );
22821 + return aServiceNames;
22823 --- vbahelper/source/msforms/vbacombobox.hxx.old 1970-01-01 00:00:00.000000000 +0000
22824 +++ vbahelper/source/msforms/vbacombobox.hxx 2009-04-06 16:42:01.000000000 +0000
22826 +/*************************************************************************
22828 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22830 + * Copyright 2008 by Sun Microsystems, Inc.
22832 + * OpenOffice.org - a multi-platform office productivity suite
22834 + * $RCSfile: vbacombobox.hxx,v $
22835 + * $Revision: 1.4 $
22837 + * This file is part of OpenOffice.org.
22839 + * OpenOffice.org is free software: you can redistribute it and/or modify
22840 + * it under the terms of the GNU Lesser General Public License version 3
22841 + * only, as published by the Free Software Foundation.
22843 + * OpenOffice.org is distributed in the hope that it will be useful,
22844 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22845 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22846 + * GNU Lesser General Public License version 3 for more details
22847 + * (a copy is included in the LICENSE file that accompanied this code).
22849 + * You should have received a copy of the GNU Lesser General Public License
22850 + * version 3 along with OpenOffice.org. If not, see
22851 + * <http://www.openoffice.org/license.html>
22852 + * for a copy of the LGPLv3 License.
22854 + ************************************************************************/
22855 +#ifndef SC_VBA_COMBOBOX_HXX
22856 +#define SC_VBA_COMBOBOX_HXX
22857 +#include <cppuhelper/implbase2.hxx>
22858 +#include <com/sun/star/uno/XComponentContext.hpp>
22859 +#include <com/sun/star/beans/XPropertySet.hpp>
22860 +#include <com/sun/star/script/XDefaultProperty.hpp>
22861 +#include <ooo/vba/msforms/XComboBox.hpp>
22862 +#include <comphelper/proparrhlp.hxx>
22863 +#include <comphelper/propertycontainer.hxx>
22864 +#include <com/sun/star/beans/PropertyAttribute.hpp>
22866 +#include "vbacontrol.hxx"
22867 +#include "vbalistcontrolhelper.hxx"
22868 +#include <vbahelper/vbahelper.hxx>
22870 +typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
22871 +class ScVbaComboBox : public ComboBoxImpl_BASE
22873 + std::auto_ptr< ListControlHelper > mpListHelper;
22874 + rtl::OUString sSourceName;
22875 + rtl::OUString msDftPropName;
22876 + bool mbDialogType;
22879 + ScVbaComboBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialogType = false );
22882 + virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
22883 + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
22884 + virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
22885 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
22886 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
22887 + virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
22888 + virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
22891 + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
22892 + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
22893 + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
22894 + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
22896 + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
22898 + // XDefaultProperty
22899 + ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
22900 + //XHelperInterface
22901 + virtual rtl::OUString& getServiceImplName();
22902 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
22906 --- vbahelper/source/msforms/vbacontrol.cxx.old 1970-01-01 00:00:00.000000000 +0000
22907 +++ vbahelper/source/msforms/vbacontrol.cxx 2009-04-06 16:42:01.000000000 +0000
22909 +/*************************************************************************
22911 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22913 + * Copyright 2008 by Sun Microsystems, Inc.
22915 + * OpenOffice.org - a multi-platform office productivity suite
22917 + * $RCSfile: vbacontrol.cxx,v $
22918 + * $Revision: 1.3 $
22920 + * This file is part of OpenOffice.org.
22922 + * OpenOffice.org is free software: you can redistribute it and/or modify
22923 + * it under the terms of the GNU Lesser General Public License version 3
22924 + * only, as published by the Free Software Foundation.
22926 + * OpenOffice.org is distributed in the hope that it will be useful,
22927 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22928 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22929 + * GNU Lesser General Public License version 3 for more details
22930 + * (a copy is included in the LICENSE file that accompanied this code).
22932 + * You should have received a copy of the GNU Lesser General Public License
22933 + * version 3 along with OpenOffice.org. If not, see
22934 + * <http://www.openoffice.org/license.html>
22935 + * for a copy of the LGPLv3 License.
22937 + ************************************************************************/
22938 +#include <com/sun/star/form/FormComponentType.hpp>
22939 +#include <com/sun/star/awt/XControlModel.hpp>
22940 +#include <com/sun/star/awt/XControl.hpp>
22941 +#include <com/sun/star/awt/XWindow2.hpp>
22942 +#include <com/sun/star/lang/XEventListener.hpp>
22943 +#include <com/sun/star/drawing/XShape.hpp>
22944 +#include <com/sun/star/drawing/XControlShape.hpp>
22945 +#include <com/sun/star/awt/XControl.hpp>
22946 +#include <com/sun/star/frame/XModel.hpp>
22947 +#include <com/sun/star/view/XControlAccess.hpp>
22948 +#include <com/sun/star/container/XChild.hpp>
22949 +#include <com/sun/star/form/binding/XBindableValue.hpp>
22950 +#include <com/sun/star/form/binding/XListEntrySink.hpp>
22951 +#include <com/sun/star/table/CellAddress.hpp>
22952 +#include <com/sun/star/table/CellRangeAddress.hpp>
22953 +#include <ooo/vba/XControlProvider.hpp>
22954 +#ifdef VBA_OOBUILD_HACK
22955 +#include <svtools/bindablecontrolhelper.hxx>
22957 +#include"vbacontrol.hxx"
22958 +#include"vbacombobox.hxx"
22959 +#include "vbabutton.hxx"
22960 +#include "vbalabel.hxx"
22961 +#include "vbatextbox.hxx"
22962 +#include "vbaradiobutton.hxx"
22963 +#include "vbalistbox.hxx"
22964 +#include "vbatogglebutton.hxx"
22965 +#include "vbacheckbox.hxx"
22966 +#include "vbaframe.hxx"
22967 +#include "vbascrollbar.hxx"
22968 +#include "vbaprogressbar.hxx"
22969 +#include "vbamultipage.hxx"
22970 +#include "vbaspinbutton.hxx"
22971 +#include "vbaimage.hxx"
22972 +#include <vbahelper/helperdecl.hxx>
22975 +using namespace com::sun::star;
22976 +using namespace ooo::vba;
22978 +uno::Reference< css::awt::XWindowPeer >
22979 +ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
22981 + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
22983 + uno::Reference< awt::XControlModel > xControlModel;
22984 + uno::Reference< css::awt::XWindowPeer > xWinPeer;
22985 + if ( !xControlShape.is() )
22987 + // would seem to be a Userform control
22988 + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW );
22989 + xWinPeer = xControl->getPeer();
22993 + xControlModel.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
22995 + uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
22998 + uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY );
22999 + xWinPeer = xControl->getPeer();
23001 + catch( uno::Exception )
23003 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "The Control does not exsit" ),
23004 + uno::Reference< uno::XInterface >() );
23009 +//ScVbaControlListener
23010 +class ScVbaControlListener: public cppu::WeakImplHelper1< lang::XEventListener >
23013 + ScVbaControl *pControl;
23015 + ScVbaControlListener( ScVbaControl *pTmpControl );
23016 + virtual ~ScVbaControlListener();
23017 + virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException );
23020 +ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl )
23024 +ScVbaControlListener::~ScVbaControlListener()
23029 +ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeException )
23033 + pControl->removeResouce();
23040 +ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel )
23043 + m_xEventListener.set( new ScVbaControlListener( this ) );
23044 + setGeometryHelper( pGeomHelper );
23045 + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
23046 + xComponent->addEventListener( m_xEventListener );
23049 + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
23050 + uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ;
23051 + if ( xControlShape.is() ) // form control
23052 + m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
23053 + else if ( xUserFormControl.is() ) // userform control
23054 + m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
23057 +ScVbaControl::~ScVbaControl()
23059 + if( m_xControl.is() )
23061 + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
23062 + xComponent->removeEventListener( m_xEventListener );
23067 +ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper )
23069 + mpGeometryHelper.reset( pHelper );
23072 +void ScVbaControl::removeResouce() throw( uno::RuntimeException )
23074 + uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
23075 + xComponent->removeEventListener( m_xEventListener );
23076 + m_xControl= NULL;
23080 +//In design model has different behavior
23081 +sal_Bool SAL_CALL ScVbaControl::getEnabled() throw (uno::RuntimeException)
23083 + uno::Any aValue = m_xProps->getPropertyValue
23084 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) );
23085 + sal_Bool bRet = false;
23090 +void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeException)
23092 + uno::Any aValue( bVisible );
23093 + m_xProps->setPropertyValue
23094 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ), aValue);
23098 +sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
23100 + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
23101 + return xWindow2->isVisible();
23104 +void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
23106 + uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
23107 + xWindow2->setVisible( bVisible );
23109 +double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
23111 + return mpGeometryHelper->getHeight();
23113 +void SAL_CALL ScVbaControl::setHeight( double _height ) throw (uno::RuntimeException)
23115 + mpGeometryHelper->setHeight( _height );
23118 +double SAL_CALL ScVbaControl::getWidth() throw (uno::RuntimeException)
23120 + return mpGeometryHelper->getWidth();
23122 +void SAL_CALL ScVbaControl::setWidth( double _width ) throw (uno::RuntimeException)
23124 + mpGeometryHelper->setWidth( _width );
23128 +ScVbaControl::getLeft() throw (uno::RuntimeException)
23130 + return mpGeometryHelper->getLeft();
23134 +ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
23136 + mpGeometryHelper->setLeft( _left );
23141 +ScVbaControl::getTop() throw (uno::RuntimeException)
23143 + return mpGeometryHelper->getTop();
23147 +ScVbaControl::setTop( double _top ) throw (uno::RuntimeException)
23149 + mpGeometryHelper->setTop( _top );
23152 +uno::Reference< uno::XInterface > SAL_CALL
23153 +ScVbaControl::getObject() throw (uno::RuntimeException)
23155 + uno::Reference< msforms::XControl > xRet( this );
23159 +void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
23161 + uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW );
23162 + xWin->setFocus();
23165 +rtl::OUString SAL_CALL
23166 +ScVbaControl::getControlSource() throw (uno::RuntimeException)
23168 +// #FIXME I *hate* having these upstream differences
23169 +// but this is necessary until I manage to upstream other
23170 +// dependant parts
23171 +#ifdef VBA_OOBUILD_HACK
23172 + rtl::OUString sControlSource;
23173 + uno::Reference< form::binding::XBindableValue > xBindable( m_xProps, uno::UNO_QUERY );
23174 + if ( xBindable.is() )
23178 + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
23179 + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellAddressConversion" ))), uno::UNO_QUERY );
23180 + uno::Reference< beans::XPropertySet > xProps( xBindable->getValueBinding(), uno::UNO_QUERY_THROW );
23181 + table::CellAddress aAddress;
23182 + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundCell") ) ) >>= aAddress;
23183 + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address") ), uno::makeAny( aAddress ) );
23184 + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sControlSource;
23186 + catch( uno::Exception& )
23190 + return sControlSource;
23192 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getControlSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
23197 +ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException)
23199 +#ifdef VBA_OOBUILD_HACK
23200 + rtl::OUString sEmpty;
23201 + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, _controlsource, sEmpty );
23203 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setControlSource not supported ") ).concat( _controlsource ), uno::Reference< uno::XInterface >()); // not supported
23207 +rtl::OUString SAL_CALL
23208 +ScVbaControl::getRowSource() throw (uno::RuntimeException)
23210 +#ifdef VBA_OOBUILD_HACK
23211 + rtl::OUString sRowSource;
23212 + uno::Reference< form::binding::XListEntrySink > xListSink( m_xProps, uno::UNO_QUERY );
23213 + if ( xListSink.is() )
23217 + uno::Reference< lang::XMultiServiceFactory > xFac( m_xModel, uno::UNO_QUERY_THROW );
23218 + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.CellRangeAddressConversion" ))), uno::UNO_QUERY );
23220 + uno::Reference< beans::XPropertySet > xProps( xListSink->getListEntrySource(), uno::UNO_QUERY_THROW );
23221 + table::CellRangeAddress aAddress;
23222 + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellRange") ) ) >>= aAddress;
23223 + xConvertor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Address")), uno::makeAny( aAddress ) );
23224 + xConvertor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("XL_A1_Representation") ) ) >>= sRowSource;
23226 + catch( uno::Exception& )
23230 + return sRowSource;
23232 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("getRowSource not supported") ), uno::Reference< uno::XInterface >()); // not supported
23237 +ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
23239 +#ifdef VBA_OOBUILD_HACK
23240 + rtl::OUString sEmpty;
23241 + svt::BindableControlHelper::ApplyListSourceAndBindableData( m_xModel, m_xProps, sEmpty, _rowsource );
23243 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setRowSource not supported ") ).concat( _rowsource ), uno::Reference< uno::XInterface >()); // not supported
23247 +rtl::OUString SAL_CALL
23248 +ScVbaControl::getName() throw (uno::RuntimeException)
23250 + rtl::OUString sName;
23251 + m_xProps->getPropertyValue
23252 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
23258 +ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
23260 + m_xProps->setPropertyValue
23261 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
23263 +//ScVbaControlFactory
23265 +ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
23269 +ScVbaControl* ScVbaControlFactory::createControl() throw (uno::RuntimeException)
23271 + return createControl( m_xModel );
23273 +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
23275 + uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
23276 + if ( xControlShape.is() ) // form controls
23277 + return createControl( xControlShape, xParent );
23278 + uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY );
23279 + if ( !xControl.is() )
23280 + throw uno::RuntimeException(); // really we should be more informative
23281 + return createControl( xControl, xParent );
23285 +ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException)
23287 + uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
23288 + sal_Int32 nClassId = -1;
23289 + const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
23290 + xProps->getPropertyValue( sClassId ) >>= nClassId;
23291 + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
23292 + switch( nClassId )
23294 + case form::FormComponentType::COMBOBOX:
23295 + return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23296 + case form::FormComponentType::COMMANDBUTTON:
23297 + return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23298 + case form::FormComponentType::FIXEDTEXT:
23299 + return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23300 + case form::FormComponentType::TEXTFIELD:
23301 + return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23302 + case form::FormComponentType::RADIOBUTTON:
23303 + return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23304 + case form::FormComponentType::LISTBOX:
23305 + return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23306 + case form::FormComponentType::SPINBUTTON:
23307 + return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23308 + case form::FormComponentType::IMAGECONTROL:
23309 + return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
23311 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
23312 + "Donot support this Control Type." ), uno::Reference< uno::XInterface >() );
23316 +ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
23318 + uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
23319 + uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW );
23320 + ScVbaControl* pControl = NULL;
23321 + uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
23322 + if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
23323 + pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23324 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
23325 + pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23326 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
23327 + pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
23328 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
23330 + sal_Bool bToggle = sal_False;
23331 + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
23333 + pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23335 + pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23337 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
23338 + pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
23339 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
23340 + pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23341 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
23342 + pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23343 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
23344 + pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23345 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
23346 + pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23347 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
23348 + pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23349 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
23350 + pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23351 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
23352 + pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
23353 + else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
23354 + pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
23356 + throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
23361 +ScVbaControl::getServiceImplName()
23363 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") );
23364 + return sImplName;
23367 +uno::Sequence< rtl::OUString >
23368 +ScVbaControl::getServiceNames()
23370 + static uno::Sequence< rtl::OUString > aServiceNames;
23371 + if ( aServiceNames.getLength() == 0 )
23373 + aServiceNames.realloc( 1 );
23374 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Control" ) );
23376 + return aServiceNames;
23381 +typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE;
23382 +class ControlProviderImpl : public ControlProvider_BASE
23384 + uno::Reference< uno::XComponentContext > m_xCtx;
23386 + ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {}
23387 + virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
23388 + virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
23391 +uno::Reference< msforms::XControl > SAL_CALL
23392 +ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
23394 + uno::Reference< msforms::XControl > xControlToReturn;
23395 + if ( xControlShape.is() )
23397 + ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
23398 + xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
23400 + return xControlToReturn;
23403 +uno::Reference< msforms::XControl > SAL_CALL
23404 +ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
23406 + uno::Reference< msforms::XControl > xControlToReturn;
23407 + if ( xControl.is() && xDialog.is() )
23410 + ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
23411 + xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
23412 + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
23413 + pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) );
23415 + return xControlToReturn;
23418 +namespace controlprovider
23420 +namespace sdecl = comphelper::service_decl;
23421 +sdecl::class_<ControlProviderImpl, sdecl::with_args<false> > serviceImpl;
23422 +extern sdecl::ServiceDecl const serviceDecl(
23424 + "ControlProviderImpl",
23425 + "ooo.vba.ControlProvider" );
23429 --- vbahelper/source/msforms/vbacontrol.hxx.old 1970-01-01 00:00:00.000000000 +0000
23430 +++ vbahelper/source/msforms/vbacontrol.hxx 2009-04-06 16:42:01.000000000 +0000
23432 +/*************************************************************************
23434 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23436 + * Copyright 2008 by Sun Microsystems, Inc.
23438 + * OpenOffice.org - a multi-platform office productivity suite
23440 + * $RCSfile: vbacontrol.hxx,v $
23441 + * $Revision: 1.3 $
23443 + * This file is part of OpenOffice.org.
23445 + * OpenOffice.org is free software: you can redistribute it and/or modify
23446 + * it under the terms of the GNU Lesser General Public License version 3
23447 + * only, as published by the Free Software Foundation.
23449 + * OpenOffice.org is distributed in the hope that it will be useful,
23450 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23451 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23452 + * GNU Lesser General Public License version 3 for more details
23453 + * (a copy is included in the LICENSE file that accompanied this code).
23455 + * You should have received a copy of the GNU Lesser General Public License
23456 + * version 3 along with OpenOffice.org. If not, see
23457 + * <http://www.openoffice.org/license.html>
23458 + * for a copy of the LGPLv3 License.
23460 + ************************************************************************/
23461 +#ifndef SC_VBA_CONTROL_HXX
23462 +#define SC_VBA_CONTROL_HXX
23464 +#include <cppuhelper/implbase1.hxx>
23465 +#include <com/sun/star/beans/XPropertySet.hpp>
23466 +#include <com/sun/star/uno/XComponentContext.hpp>
23467 +#include <com/sun/star/script/XDefaultProperty.hpp>
23468 +#include <com/sun/star/drawing/XControlShape.hpp>
23469 +#include <com/sun/star/awt/XControl.hpp>
23470 +#include <com/sun/star/awt/XWindowPeer.hpp>
23471 +#include <ooo/vba/msforms/XControl.hpp>
23473 +#include <vbahelper/vbahelper.hxx>
23474 +#include <vbahelper/vbahelperinterface.hxx>
23477 +//typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
23478 +typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
23480 +class ScVbaControl : public ControlImpl_BASE
23483 + com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
23485 + std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
23486 + css::uno::Reference< css::beans::XPropertySet > m_xProps;
23487 + css::uno::Reference< css::uno::XInterface > m_xControl;
23488 + css::uno::Reference< css::frame::XModel > m_xModel;
23490 + virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
23492 + ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
23493 + const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
23494 + virtual ~ScVbaControl();
23495 + // This class will own the helper, so make sure it is allocated from
23497 + void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
23499 + virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
23500 + virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
23501 + virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
23502 + virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
23503 + virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
23504 + virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
23505 + virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
23506 + virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
23507 + virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
23508 + virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
23509 + virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
23510 + virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
23511 + virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException);
23513 + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
23514 + virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
23515 + virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException);
23516 + virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException);
23517 + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
23518 + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
23519 + virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
23520 + //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
23521 + virtual void removeResouce() throw( css::uno::RuntimeException );
23522 + //XHelperInterface
23523 + virtual rtl::OUString& getServiceImplName();
23524 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
23528 +class ScVbaControlFactory
23531 + ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
23532 + const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
23533 + ScVbaControl* createControl() throw ( css::uno::RuntimeException );
23534 + ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException );
23536 + ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
23537 + ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
23538 + css::uno::Reference< css::uno::XComponentContext > m_xContext;
23539 + css::uno::Reference< css::uno::XInterface > m_xControl;
23540 + css::uno::Reference< css::frame::XModel > m_xModel;
23543 +#endif//SC_VBA_CONTROL_HXX
23544 --- vbahelper/source/msforms/vbacontrols.cxx.old 1970-01-01 00:00:00.000000000 +0000
23545 +++ vbahelper/source/msforms/vbacontrols.cxx 2009-04-06 16:42:01.000000000 +0000
23547 +/*************************************************************************
23549 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23551 + * Copyright 2008 by Sun Microsystems, Inc.
23553 + * OpenOffice.org - a multi-platform office productivity suite
23558 + * This file is part of OpenOffice.org.
23560 + * OpenOffice.org is free software: you can redistribute it and/or modify
23561 + * it under the terms of the GNU Lesser General Public License version 3
23562 + * only, as published by the Free Software Foundation.
23564 + * OpenOffice.org is distributed in the hope that it will be useful,
23565 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23566 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23567 + * GNU Lesser General Public License version 3 for more details
23568 + * (a copy is included in the LICENSE file that accompanied this code).
23570 + * You should have received a copy of the GNU Lesser General Public License
23571 + * version 3 along with OpenOffice.org. If not, see
23572 + * <http://www.openoffice.org/license.html>
23573 + * for a copy of the LGPLv3 License.
23575 + ************************************************************************/
23577 +#include "vbacontrols.hxx"
23578 +#include <cppuhelper/implbase2.hxx>
23579 +#include <com/sun/star/awt/XControlContainer.hpp>
23580 +#include <ooo/vba//XControlProvider.hpp>
23581 +#include <hash_map>
23583 +using namespace com::sun::star;
23584 +using namespace ooo::vba;
23587 +typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > ArrayWrapImpl;
23589 +typedef std::hash_map< rtl::OUString, sal_Int32, ::rtl::OUStringHash,
23590 + ::std::equal_to< ::rtl::OUString > > ControlIndexMap;
23591 +typedef std::vector< uno::Reference< awt::XControl > > ControlVec;
23593 +class ControlArrayWrapper : public ArrayWrapImpl
23595 + uno::Reference< awt::XControlContainer > mxDialog;
23596 + uno::Sequence< ::rtl::OUString > msNames;
23597 + ControlVec mControls;
23598 + ControlIndexMap mIndices;
23600 + rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
23602 + uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY );
23603 + rtl::OUString sName;
23604 + xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
23610 + ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
23612 + mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
23613 + uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
23615 + msNames.realloc( sXControls.getLength() );
23616 + for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
23618 + uno::Reference< awt::XControl > xCtrl = sXControls[ i ];
23619 + msNames[ i ] = getControlName( xCtrl );
23620 + mControls.push_back( xCtrl );
23621 + mIndices[ msNames[ i ] ] = i;
23625 + // XElementAccess
23626 + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
23628 + return awt::XControl::static_type(0);
23631 + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
23633 + return ( mControls.size() > 0 );
23637 + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
23639 + if ( !hasByName( aName ) )
23640 + throw container::NoSuchElementException();
23641 + return getByIndex( mIndices[ aName ] );
23644 + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
23649 + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException)
23651 + ControlIndexMap::iterator it = mIndices.find( aName );
23652 + return it != mIndices.end();
23655 + // XElementAccess
23656 + virtual ::sal_Int32 SAL_CALL getCount( ) throw (css::uno::RuntimeException)
23658 + return mControls.size();
23661 + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
23663 + if ( Index < 0 || Index >= static_cast< sal_Int32 >( mControls.size() ) )
23664 + throw lang::IndexOutOfBoundsException();
23665 + return uno::makeAny( mControls[ Index ] );
23670 +class ControlsEnumWrapper : public EnumerationHelper_BASE
23672 + uno::Reference<XHelperInterface > m_xParent;
23673 + uno::Reference<uno::XComponentContext > m_xContext;
23674 + uno::Reference<container::XIndexAccess > m_xIndexAccess;
23675 + uno::Reference<awt::XControl > m_xDlg;
23676 + sal_Int32 nIndex;
23680 + ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {}
23682 + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
23684 + return ( nIndex < m_xIndexAccess->getCount() );
23687 + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
23689 + if ( nIndex < m_xIndexAccess->getCount() )
23691 + uno::Reference< frame::XModel > xModel;
23692 + uno::Reference< awt::XControl > xControl;
23693 + m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl;
23695 + uno::Reference<lang::XMultiComponentFactory > xServiceManager( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
23696 + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), m_xContext ), uno::UNO_QUERY_THROW );
23698 + uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, m_xDlg, xModel ) );
23699 + return uno::makeAny( xVBAControl );
23701 + throw container::NoSuchElementException();
23707 +uno::Reference<container::XIndexAccess >
23708 +lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg )
23710 + return new ControlArrayWrapper( xDlg );
23713 +ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
23714 + const css::uno::Reference< awt::XControl >& xDialog )
23715 + : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
23717 + mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
23720 +uno::Reference< container::XEnumeration >
23721 +ScVbaControls::createEnumeration() throw (uno::RuntimeException)
23723 + uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) );
23724 + if ( !xEnum.is() )
23725 + throw uno::RuntimeException();
23730 +ScVbaControls::createCollectionObject( const css::uno::Any& aSource )
23732 + // Create control from awt::XControl
23733 + uno::Reference< awt::XControl > xControl;
23734 + aSource >>= xControl;
23735 + uno::Reference< frame::XModel > xModel;
23736 + uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
23737 + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW );
23739 + uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, mxDialog, xModel ) );
23741 + return uno::makeAny( xVBAControl );
23745 +ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException)
23747 + uno::Reference< container::XEnumeration > xEnum( createEnumeration() );
23748 + while ( xEnum->hasMoreElements() )
23750 + uno::Reference< msforms::XControl > xControl( xEnum->nextElement(), uno::UNO_QUERY_THROW );
23751 + xControl->setLeft( xControl->getLeft() + cx );
23752 + xControl->setTop( xControl->getTop() + cy );
23757 +ScVbaControls::getElementType() throw (uno::RuntimeException)
23759 + return ooo::vba::msforms::XControl::static_type(0);
23762 +ScVbaControls::getServiceImplName()
23764 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") );
23765 + return sImplName;
23768 +uno::Sequence< rtl::OUString >
23769 +ScVbaControls::getServiceNames()
23771 + static uno::Sequence< rtl::OUString > aServiceNames;
23772 + if ( aServiceNames.getLength() == 0 )
23774 + aServiceNames.realloc( 1 );
23775 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) );
23777 + return aServiceNames;
23779 --- vbahelper/source/msforms/vbacontrols.hxx.old 1970-01-01 00:00:00.000000000 +0000
23780 +++ vbahelper/source/msforms/vbacontrols.hxx 2009-04-06 16:42:01.000000000 +0000
23782 +/*************************************************************************
23784 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23786 + * Copyright 2008 by Sun Microsystems, Inc.
23788 + * OpenOffice.org - a multi-platform office productivity suite
23793 + * This file is part of OpenOffice.org.
23795 + * OpenOffice.org is free software: you can redistribute it and/or modify
23796 + * it under the terms of the GNU Lesser General Public License version 3
23797 + * only, as published by the Free Software Foundation.
23799 + * OpenOffice.org is distributed in the hope that it will be useful,
23800 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23801 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23802 + * GNU Lesser General Public License version 3 for more details
23803 + * (a copy is included in the LICENSE file that accompanied this code).
23805 + * You should have received a copy of the GNU Lesser General Public License
23806 + * version 3 along with OpenOffice.org. If not, see
23807 + * <http://www.openoffice.org/license.html>
23808 + * for a copy of the LGPLv3 License.
23810 + ************************************************************************/
23811 +#ifndef SC_VBA_CONTROLS_HXX
23812 +#define SC_VBA_CONTROLS_HXX
23814 +#include <cppuhelper/implbase1.hxx>
23815 +#include <ooo/vba/msforms/XControls.hpp>
23816 +#include <com/sun/star/awt/XControl.hpp>
23818 +#include <vbahelper/vbacollectionimpl.hxx>
23819 +#include <vbahelper/vbahelper.hxx>
23821 +typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
23823 +class ScVbaControls : public ControlsImpl_BASE
23825 + css::uno::Reference< css::awt::XControl > mxDialog;
23827 + virtual rtl::OUString& getServiceImplName();
23828 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
23830 + ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
23831 + const css::uno::Reference< css::awt::XControl >& xDialog );
23833 + virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException);
23834 + // XEnumerationAccess
23835 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
23836 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
23838 + // ScVbaCollectionBaseImpl
23839 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
23842 +#endif //SC_VBA_OLEOBJECTS_HXX
23844 --- vbahelper/source/msforms/vbaframe.cxx.old 1970-01-01 00:00:00.000000000 +0000
23845 +++ vbahelper/source/msforms/vbaframe.cxx 2009-04-06 16:42:01.000000000 +0000
23847 +/*************************************************************************
23849 + * OpenOffice.org - a multi-platform office productivity suite
23855 + * last change: $Author$ $Date$
23857 + * The Contents of this file are made available subject to
23858 + * the terms of GNU Lesser General Public License Version 2.1.
23861 + * GNU Lesser General Public License Version 2.1
23862 + * =============================================
23863 + * Copyright 2005 by Sun Microsystems, Inc.
23864 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
23866 + * This library is free software; you can redistribute it and/or
23867 + * modify it under the terms of the GNU Lesser General Public
23868 + * License version 2.1, as published by the Free Software Foundation.
23870 + * This library is distributed in the hope that it will be useful,
23871 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23872 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23873 + * Lesser General Public License for more details.
23875 + * You should have received a copy of the GNU Lesser General Public
23876 + * License along with this library; if not, write to the Free Software
23877 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23878 + * MA 02111-1307 USA
23880 + ************************************************************************/
23881 +#include "vbaframe.hxx"
23884 +using namespace com::sun::star;
23885 +using namespace ooo::vba;
23888 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
23889 +ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
23894 +rtl::OUString SAL_CALL
23895 +ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
23897 + rtl::OUString Label;
23898 + m_xProps->getPropertyValue( LABEL ) >>= Label;
23903 +ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
23905 + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
23909 +ScVbaFrame::getValue() throw (css::uno::RuntimeException)
23911 + return uno::makeAny( getCaption() );
23915 +ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
23917 + rtl::OUString sCaption;
23918 + _value >>= sCaption;
23919 + setCaption( sCaption );
23923 +ScVbaFrame::getServiceImplName()
23925 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
23926 + return sImplName;
23929 +uno::Sequence< rtl::OUString >
23930 +ScVbaFrame::getServiceNames()
23932 + static uno::Sequence< rtl::OUString > aServiceNames;
23933 + if ( aServiceNames.getLength() == 0 )
23935 + aServiceNames.realloc( 1 );
23936 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
23938 + return aServiceNames;
23940 --- vbahelper/source/msforms/vbaframe.hxx.old 1970-01-01 00:00:00.000000000 +0000
23941 +++ vbahelper/source/msforms/vbaframe.hxx 2009-04-06 16:42:01.000000000 +0000
23943 +/*************************************************************************
23945 + * OpenOffice.org - a multi-platform office productivity suite
23951 + * last change: $Author$ $Date$
23953 + * The Contents of this file are made available subject to
23954 + * the terms of GNU Lesser General Public License Version 2.1.
23957 + * GNU Lesser General Public License Version 2.1
23958 + * =============================================
23959 + * Copyright 2005 by Sun Microsystems, Inc.
23960 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
23962 + * This library is free software; you can redistribute it and/or
23963 + * modify it under the terms of the GNU Lesser General Public
23964 + * License version 2.1, as published by the Free Software Foundation.
23966 + * This library is distributed in the hope that it will be useful,
23967 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23968 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23969 + * Lesser General Public License for more details.
23971 + * You should have received a copy of the GNU Lesser General Public
23972 + * License along with this library; if not, write to the Free Software
23973 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23974 + * MA 02111-1307 USA
23976 + ************************************************************************/
23977 +#ifndef SC_VBA_FRAME_HXX
23978 +#define SC_VBA_FRAME_HXX
23979 +#include <cppuhelper/implbase1.hxx>
23980 +#include <ooo/vba/msforms/XLabel.hpp>
23982 +#include "vbacontrol.hxx"
23983 +#include <vbahelper/vbahelper.hxx>
23985 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
23987 +class ScVbaFrame : public FrameImpl_BASE
23990 + ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
23992 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
23993 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
23994 + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
23995 + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
23996 + //XHelperInterface
23997 + virtual rtl::OUString& getServiceImplName();
23998 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
24000 +#endif //SC_VBA_LABEL_HXX
24001 --- vbahelper/source/msforms/vbaimage.cxx.old 1970-01-01 00:00:00.000000000 +0000
24002 +++ vbahelper/source/msforms/vbaimage.cxx 2009-04-06 16:42:01.000000000 +0000
24004 +/*************************************************************************
24006 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24008 + * Copyright 2008 by Sun Microsystems, Inc.
24010 + * OpenOffice.org - a multi-platform office productivity suite
24015 + * This file is part of OpenOffice.org.
24017 + * OpenOffice.org is free software: you can redistribute it and/or modify
24018 + * it under the terms of the GNU Lesser General Public License version 3
24019 + * only, as published by the Free Software Foundation.
24021 + * OpenOffice.org is distributed in the hope that it will be useful,
24022 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24023 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24024 + * GNU Lesser General Public License version 3 for more details
24025 + * (a copy is included in the LICENSE file that accompanied this code).
24027 + * You should have received a copy of the GNU Lesser General Public License
24028 + * version 3 along with OpenOffice.org. If not, see
24029 + * <http://www.openoffice.org/license.html>
24030 + * for a copy of the LGPLv3 License.
24032 + ************************************************************************/
24033 +#include "vbaimage.hxx"
24036 +using namespace com::sun::star;
24037 +using namespace ooo::vba;
24040 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
24041 +ScVbaImage::ScVbaImage( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ImageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
24046 +ScVbaImage::getServiceImplName()
24048 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaImage") );
24049 + return sImplName;
24052 +uno::Sequence< rtl::OUString >
24053 +ScVbaImage::getServiceNames()
24055 + static uno::Sequence< rtl::OUString > aServiceNames;
24056 + if ( aServiceNames.getLength() == 0 )
24058 + aServiceNames.realloc( 1 );
24059 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Image" ) );
24061 + return aServiceNames;
24063 --- vbahelper/source/msforms/vbaimage.hxx.old 1970-01-01 00:00:00.000000000 +0000
24064 +++ vbahelper/source/msforms/vbaimage.hxx 2009-04-06 16:42:01.000000000 +0000
24066 +/*************************************************************************
24068 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24070 + * Copyright 2008 by Sun Microsystems, Inc.
24072 + * OpenOffice.org - a multi-platform office productivity suite
24077 + * This file is part of OpenOffice.org.
24079 + * OpenOffice.org is free software: you can redistribute it and/or modify
24080 + * it under the terms of the GNU Lesser General Public License version 3
24081 + * only, as published by the Free Software Foundation.
24083 + * OpenOffice.org is distributed in the hope that it will be useful,
24084 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24085 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24086 + * GNU Lesser General Public License version 3 for more details
24087 + * (a copy is included in the LICENSE file that accompanied this code).
24089 + * You should have received a copy of the GNU Lesser General Public License
24090 + * version 3 along with OpenOffice.org. If not, see
24091 + * <http://www.openoffice.org/license.html>
24092 + * for a copy of the LGPLv3 License.
24094 + ************************************************************************/
24095 +#ifndef SC_VBA_IMAGE_HXX
24096 +#define SC_VBA_IMAGE_HXX
24097 +#include <cppuhelper/implbase1.hxx>
24098 +#include <ooo/vba/msforms/XImage.hpp>
24100 +#include "vbacontrol.hxx"
24101 +#include <vbahelper/vbahelper.hxx>
24103 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XImage > ImageImpl_BASE;
24105 +class ScVbaImage : public ImageImpl_BASE
24108 + ScVbaImage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
24109 + //XHelperInterface
24110 + virtual rtl::OUString& getServiceImplName();
24111 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
24113 +#endif //SC_VBA_IMAGE_HXX
24114 --- vbahelper/source/msforms/vbalabel.cxx.old 1970-01-01 00:00:00.000000000 +0000
24115 +++ vbahelper/source/msforms/vbalabel.cxx 2009-04-06 16:42:01.000000000 +0000
24117 +/*************************************************************************
24119 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24121 + * Copyright 2008 by Sun Microsystems, Inc.
24123 + * OpenOffice.org - a multi-platform office productivity suite
24125 + * $RCSfile: vbalabel.cxx,v $
24126 + * $Revision: 1.3 $
24128 + * This file is part of OpenOffice.org.
24130 + * OpenOffice.org is free software: you can redistribute it and/or modify
24131 + * it under the terms of the GNU Lesser General Public License version 3
24132 + * only, as published by the Free Software Foundation.
24134 + * OpenOffice.org is distributed in the hope that it will be useful,
24135 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24136 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24137 + * GNU Lesser General Public License version 3 for more details
24138 + * (a copy is included in the LICENSE file that accompanied this code).
24140 + * You should have received a copy of the GNU Lesser General Public License
24141 + * version 3 along with OpenOffice.org. If not, see
24142 + * <http://www.openoffice.org/license.html>
24143 + * for a copy of the LGPLv3 License.
24145 + ************************************************************************/
24146 +#include "vbalabel.hxx"
24149 +using namespace com::sun::star;
24150 +using namespace ooo::vba;
24153 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
24154 +ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
24159 +rtl::OUString SAL_CALL
24160 +ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
24162 + rtl::OUString Label;
24163 + m_xProps->getPropertyValue( LABEL ) >>= Label;
24168 +ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
24170 + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
24173 +ScVbaLabel::getValue() throw (css::uno::RuntimeException)
24175 + return uno::makeAny( getCaption() );
24179 +ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
24181 + rtl::OUString sCaption;
24182 + _value >>= sCaption;
24183 + setCaption( sCaption );
24188 +ScVbaLabel::getServiceImplName()
24190 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
24191 + return sImplName;
24194 +uno::Sequence< rtl::OUString >
24195 +ScVbaLabel::getServiceNames()
24197 + static uno::Sequence< rtl::OUString > aServiceNames;
24198 + if ( aServiceNames.getLength() == 0 )
24200 + aServiceNames.realloc( 1 );
24201 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
24203 + return aServiceNames;
24205 --- vbahelper/source/msforms/vbalabel.hxx.old 1970-01-01 00:00:00.000000000 +0000
24206 +++ vbahelper/source/msforms/vbalabel.hxx 2009-04-06 16:42:01.000000000 +0000
24208 +/*************************************************************************
24210 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24212 + * Copyright 2008 by Sun Microsystems, Inc.
24214 + * OpenOffice.org - a multi-platform office productivity suite
24216 + * $RCSfile: vbalabel.hxx,v $
24217 + * $Revision: 1.3 $
24219 + * This file is part of OpenOffice.org.
24221 + * OpenOffice.org is free software: you can redistribute it and/or modify
24222 + * it under the terms of the GNU Lesser General Public License version 3
24223 + * only, as published by the Free Software Foundation.
24225 + * OpenOffice.org is distributed in the hope that it will be useful,
24226 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24227 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24228 + * GNU Lesser General Public License version 3 for more details
24229 + * (a copy is included in the LICENSE file that accompanied this code).
24231 + * You should have received a copy of the GNU Lesser General Public License
24232 + * version 3 along with OpenOffice.org. If not, see
24233 + * <http://www.openoffice.org/license.html>
24234 + * for a copy of the LGPLv3 License.
24236 + ************************************************************************/
24237 +#ifndef SC_VBA_LABEL_HXX
24238 +#define SC_VBA_LABEL_HXX
24239 +#include <cppuhelper/implbase1.hxx>
24240 +#include <ooo/vba/msforms/XLabel.hpp>
24242 +#include "vbacontrol.hxx"
24243 +#include <vbahelper/vbahelper.hxx>
24244 +#include <cppuhelper/implbase2.hxx>
24246 +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XLabel, css::script::XDefaultProperty > LabelImpl_BASE;
24248 +class ScVbaLabel : public LabelImpl_BASE
24251 + ScVbaLabel( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
24253 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
24254 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
24255 + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
24256 + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
24257 + //XHelperInterface
24258 + virtual rtl::OUString& getServiceImplName();
24259 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
24260 + // XDefaultProperty
24261 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
24263 +#endif //SC_VBA_LABEL_HXX
24264 --- vbahelper/source/msforms/vbalistbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
24265 +++ vbahelper/source/msforms/vbalistbox.cxx 2009-04-06 16:42:01.000000000 +0000
24267 +/*************************************************************************
24269 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24271 + * Copyright 2008 by Sun Microsystems, Inc.
24273 + * OpenOffice.org - a multi-platform office productivity suite
24275 + * $RCSfile: vbalistbox.cxx,v $
24276 + * $Revision: 1.4 $
24278 + * This file is part of OpenOffice.org.
24280 + * OpenOffice.org is free software: you can redistribute it and/or modify
24281 + * it under the terms of the GNU Lesser General Public License version 3
24282 + * only, as published by the Free Software Foundation.
24284 + * OpenOffice.org is distributed in the hope that it will be useful,
24285 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24286 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24287 + * GNU Lesser General Public License version 3 for more details
24288 + * (a copy is included in the LICENSE file that accompanied this code).
24290 + * You should have received a copy of the GNU Lesser General Public License
24291 + * version 3 along with OpenOffice.org. If not, see
24292 + * <http://www.openoffice.org/license.html>
24293 + * for a copy of the LGPLv3 License.
24295 + ************************************************************************/
24296 +#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
24298 +#include "vbalistbox.hxx"
24300 +#include <comphelper/anytostring.hxx>
24301 +#include <com/sun/star/script/ArrayWrapper.hpp>
24303 +using namespace com::sun::star;
24304 +using namespace ooo::vba;
24306 +const static rtl::OUString TEXT( RTL_CONSTASCII_USTRINGPARAM("Text") );
24307 +const static rtl::OUString SELECTEDITEMS( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") );
24308 +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
24311 +ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ListBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
24313 + mpListHelper.reset( new ListControlHelper( m_xProps ) );
24318 +ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
24320 + sal_Int32 nIndex = 0;
24321 + _value >>= nIndex;
24322 + Selected( nIndex );
24326 +ScVbaListBox::getListIndex() throw (uno::RuntimeException)
24328 + uno::Sequence< sal_Int16 > sSelection;
24329 + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
24330 + if ( sSelection.getLength() == 0 )
24331 + return uno::Any( sal_Int32( -1 ) );
24332 + return uno::Any( sSelection[ 0 ] );
24336 +ScVbaListBox::getValue() throw (uno::RuntimeException)
24338 + uno::Sequence< sal_Int16 > sSelection;
24339 + uno::Sequence< rtl::OUString > sItems;
24340 + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection;
24341 + m_xProps->getPropertyValue( ITEMS ) >>= sItems;
24342 + if( getMultiSelect() )
24343 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24344 + "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
24346 + if ( sSelection.getLength() )
24347 + aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] );
24352 +ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
24354 + if( getMultiSelect() )
24356 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24357 + "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
24359 + rtl::OUString sValue = getAnyAsString( _value );
24360 + uno::Sequence< rtl::OUString > sList;
24361 + m_xProps->getPropertyValue( ITEMS ) >>= sList;
24362 + uno::Sequence< sal_Int16 > nList;
24363 + sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() );
24364 + sal_Int16 nValue = -1;
24366 + for( i = 0; i < nLength; i++ )
24368 + if( sList[i].equals( sValue ) )
24374 + if( nValue == -1 )
24375 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24376 + "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
24378 + uno::Sequence< sal_Int16 > nSelectedIndices(1);
24379 + nSelectedIndices[ 0 ] = nValue;
24380 + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
24381 + m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
24384 +::rtl::OUString SAL_CALL
24385 +ScVbaListBox::getText() throw (uno::RuntimeException)
24387 + rtl::OUString result;
24388 + getValue() >>= result;
24393 +ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
24395 + setValue( uno::makeAny( _text ) ); // seems the same
24399 +ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
24401 + sal_Bool bMultiSelect = sal_False;
24402 + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
24403 + return bMultiSelect;
24407 +ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
24409 + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
24412 +css::uno::Any SAL_CALL
24413 +ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
24415 + uno::Sequence< rtl::OUString > sList;
24416 + m_xProps->getPropertyValue( ITEMS ) >>= sList;
24417 + sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
24418 + // no choice but to do a horror cast as internally
24419 + // the indices are but sal_Int16
24420 + sal_Int16 nIndex = static_cast< sal_Int16 >( index );
24421 + if( nIndex < 0 || nIndex >= nLength )
24422 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24423 + "Error Number." ), uno::Reference< uno::XInterface >() );
24424 + m_nIndex = nIndex;
24425 + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
24430 +ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
24432 + mpListHelper->AddItem( pvargItem, pvargIndex );
24436 +ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
24438 + mpListHelper->removeItem( index );
24442 +ScVbaListBox::Clear( ) throw (uno::RuntimeException)
24444 + mpListHelper->Clear();
24447 +// this is called when something like the following vba code is used
24448 +// to set the selected state of particular entries in the Listbox
24449 +// ListBox1.Selected( 3 ) = false
24452 +ScVbaListBox::setValueEvent( const uno::Any& value )
24454 + sal_Bool bValue = sal_False;
24455 + if( !(value >>= bValue) )
24456 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24457 + "Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
24458 + uno::Sequence< sal_Int16 > nList;
24459 + m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList;
24460 + sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
24461 + sal_Int16 nIndex = m_nIndex;
24462 + for( sal_Int16 i = 0; i < nLength; i++ )
24464 + if( nList[i] == nIndex )
24470 + for( ; i < nLength - 1; i++ )
24472 + nList[i] = nList[i + 1];
24474 + nList.realloc( nLength - 1 );
24475 + //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
24476 + m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
24483 + if( getMultiSelect() )
24485 + nList.realloc( nLength + 1 );
24486 + nList[nLength] = nIndex;
24490 + nList.realloc( 1 );
24491 + nList[0] = nIndex;
24493 + m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
24497 +// this is called when something like the following vba code is used
24498 +// to determine the selected state of particular entries in the Listbox
24499 +// msgbox ListBox1.Selected( 3 )
24502 +ScVbaListBox::getValueEvent()
24504 + uno::Sequence< sal_Int16 > nList;
24505 + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
24506 + sal_Int32 nLength = nList.getLength();
24507 + sal_Int32 nIndex = m_nIndex;
24509 + for( sal_Int32 i = 0; i < nLength; i++ )
24511 + if( nList[i] == nIndex )
24512 + return uno::makeAny( sal_True );
24515 + return uno::makeAny( sal_False );
24519 +ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
24521 + ScVbaControl::setRowSource( _rowsource );
24522 + mpListHelper->setRowSource( _rowsource );
24525 +sal_Int32 SAL_CALL
24526 +ScVbaListBox::getListCount() throw (uno::RuntimeException)
24528 + return mpListHelper->getListCount();
24532 +ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
24534 + return mpListHelper->List( pvargIndex, pvarColumn );
24538 +ScVbaListBox::getServiceImplName()
24540 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") );
24541 + return sImplName;
24544 +uno::Sequence< rtl::OUString >
24545 +ScVbaListBox::getServiceNames()
24547 + static uno::Sequence< rtl::OUString > aServiceNames;
24548 + if ( aServiceNames.getLength() == 0 )
24550 + aServiceNames.realloc( 1 );
24551 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ScVbaListBox" ) );
24553 + return aServiceNames;
24555 --- vbahelper/source/msforms/vbalistbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
24556 +++ vbahelper/source/msforms/vbalistbox.hxx 2009-04-06 16:42:01.000000000 +0000
24558 +/*************************************************************************
24560 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24562 + * Copyright 2008 by Sun Microsystems, Inc.
24564 + * OpenOffice.org - a multi-platform office productivity suite
24566 + * $RCSfile: vbalistbox.hxx,v $
24567 + * $Revision: 1.3 $
24569 + * This file is part of OpenOffice.org.
24571 + * OpenOffice.org is free software: you can redistribute it and/or modify
24572 + * it under the terms of the GNU Lesser General Public License version 3
24573 + * only, as published by the Free Software Foundation.
24575 + * OpenOffice.org is distributed in the hope that it will be useful,
24576 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24577 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24578 + * GNU Lesser General Public License version 3 for more details
24579 + * (a copy is included in the LICENSE file that accompanied this code).
24581 + * You should have received a copy of the GNU Lesser General Public License
24582 + * version 3 along with OpenOffice.org. If not, see
24583 + * <http://www.openoffice.org/license.html>
24584 + * for a copy of the LGPLv3 License.
24586 + ************************************************************************/
24587 +#ifndef SC_VBA_LISTBOX_HXX
24588 +#define SC_VBA_LISTBOX_HXX
24589 +#include <cppuhelper/implbase2.hxx>
24590 +#include <com/sun/star/uno/XComponentContext.hpp>
24591 +#include <com/sun/star/script/XDefaultProperty.hpp>
24592 +#include <ooo/vba/msforms/XListBox.hpp>
24593 +#include <com/sun/star/beans/PropertyAttribute.hpp>
24595 +#include "vbacontrol.hxx"
24596 +#include <vbahelper/vbapropvalue.hxx>
24597 +#include "vbalistcontrolhelper.hxx"
24598 +#include <vbahelper/vbahelper.hxx>
24600 +typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
24601 +class ScVbaListBox : public ListBoxImpl_BASE
24602 + ,public PropListener
24604 + std::auto_ptr< ListControlHelper > mpListHelper;
24605 + rtl::OUString sSourceName;
24606 + rtl::OUString msDftPropName;
24608 + sal_Int16 m_nIndex;
24611 + ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
24614 + virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException);
24615 + virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
24616 + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
24617 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
24618 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
24619 + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
24620 + virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
24621 + virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
24622 + virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
24623 + virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
24626 + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
24627 + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
24628 + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
24629 + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
24631 + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
24633 + // XDefaultProperty
24634 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
24636 + //XHelperInterface
24637 + virtual rtl::OUString& getServiceImplName();
24638 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
24641 + virtual void setValueEvent( const css::uno::Any& value );
24642 + virtual css::uno::Any getValueEvent();
24648 --- vbahelper/source/msforms/vbalistcontrolhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
24649 +++ vbahelper/source/msforms/vbalistcontrolhelper.cxx 2009-04-06 16:42:01.000000000 +0000
24651 +#include <vbalistcontrolhelper.hxx>
24654 +using namespace com::sun::star;
24655 +using namespace ooo::vba;
24657 +const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
24660 +ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
24662 + if ( pvargItem.hasValue() )
24664 + uno::Sequence< rtl::OUString > sList;
24665 + m_xProps->getPropertyValue( ITEMS ) >>= sList;
24667 + sal_Int32 nIndex = sList.getLength();
24669 + if ( pvargIndex.hasValue() )
24670 + pvargIndex >>= nIndex;
24672 + rtl::OUString sString = getAnyAsString( pvargItem );
24674 + // if no index specified or item is to be appended to end of
24675 + // list just realloc the array and set the last item
24676 + if ( nIndex == sList.getLength() )
24678 + sal_Int32 nOldSize = sList.getLength();
24679 + sList.realloc( nOldSize + 1 );
24680 + sList[ nOldSize ] = sString;
24684 + // just copy those elements above the one to be inserted
24685 + std::vector< rtl::OUString > sVec;
24686 + // reserve just the amount we need to copy
24687 + sVec.reserve( sList.getLength() - nIndex );
24689 + // point at first element to copy
24690 + rtl::OUString* pString = sList.getArray() + nIndex;
24691 + const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
24692 + // insert the new element
24693 + sVec.push_back( sString );
24695 + for ( ; pString != pEndString; ++pString )
24696 + sVec.push_back( *pString );
24698 + sList.realloc( sList.getLength() + 1 );
24700 + // point at first element to be overwritten
24701 + pString = sList.getArray() + nIndex;
24702 + pEndString = sList.getArray() + sList.getLength();
24703 + std::vector< rtl::OUString >::iterator it = sVec.begin();
24704 + for ( ; pString != pEndString; ++pString, ++it)
24709 + m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
24715 +ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
24717 + sal_Int32 nIndex = 0;
24719 + if ( index >>= nIndex )
24721 + uno::Sequence< rtl::OUString > sList;
24722 + m_xProps->getPropertyValue( ITEMS ) >>= sList;
24723 + if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
24724 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
24725 + if( sList.hasElements() )
24727 + if( sList.getLength() == 1 )
24732 + for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
24734 + sList[i] = sList[i+1];
24736 + sList.realloc( sList.getLength() - 1 );
24739 + m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
24744 +ListControlHelper::Clear( ) throw (uno::RuntimeException)
24746 + // urk, setValue doesn't seem to work !!
24747 + //setValue( uno::makeAny( sal_Int16() ) );
24748 + m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
24752 +ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
24754 + if ( _rowsource.getLength() == 0 )
24758 +sal_Int32 SAL_CALL
24759 +ListControlHelper::getListCount() throw (uno::RuntimeException)
24761 + uno::Sequence< rtl::OUString > sList;
24762 + m_xProps->getPropertyValue( ITEMS ) >>= sList;
24763 + return sList.getLength();
24767 +ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
24769 + uno::Sequence< rtl::OUString > sList;
24770 + m_xProps->getPropertyValue( ITEMS ) >>= sList;
24771 + sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
24773 + if ( pvargIndex.hasValue() )
24775 + sal_Int16 nIndex = -1;
24776 + pvargIndex >>= nIndex;
24777 + if( nIndex < 0 || nIndex >= nLength )
24778 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24779 + "Bad row Index" ), uno::Reference< uno::XInterface >() );
24780 + aRet <<= sList[ nIndex ];
24782 + else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
24783 + throw uno::RuntimeException( rtl::OUString::createFromAscii(
24784 + "Bad column Index" ), uno::Reference< uno::XInterface >() );
24785 + else // List() ( e.g. no args )
24787 + uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
24788 + for ( sal_Int32 i = 0; i < nLength; ++i )
24790 + sReturnArray[ i ].realloc( 10 );
24791 + sReturnArray[ i ][ 0 ] = sList[ i ];
24793 + aRet = uno::makeAny( sReturnArray );
24797 --- vbahelper/source/msforms/vbalistcontrolhelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
24798 +++ vbahelper/source/msforms/vbalistcontrolhelper.hxx 2009-04-06 16:42:01.000000000 +0000
24800 +#ifndef SC_VBA_LISTCONTROLHELPER
24801 +#define SC_VBA_LISTCONTROLHELPER
24803 +#include <vbahelper/vbahelper.hxx>
24805 +class ListControlHelper
24807 + css::uno::Reference< css::beans::XPropertySet > m_xProps;
24810 + ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){}
24811 + virtual ~ListControlHelper() {}
24812 + virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
24813 + virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
24814 + virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
24815 + virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
24816 + virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
24817 + virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
24820 --- vbahelper/source/msforms/vbamultipage.cxx.old 1970-01-01 00:00:00.000000000 +0000
24821 +++ vbahelper/source/msforms/vbamultipage.cxx 2009-04-06 16:42:01.000000000 +0000
24823 +/*************************************************************************
24825 + * OpenOffice.org - a multi-platform office productivity suite
24831 + * last change: $Author$ $Date$
24833 + * The Contents of this file are made available subject to
24834 + * the terms of GNU Lesser General Public License Version 2.1.
24837 + * GNU Lesser General Public License Version 2.1
24838 + * =============================================
24839 + * Copyright 2005 by Sun Microsystems, Inc.
24840 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
24842 + * This library is free software; you can redistribute it and/or
24843 + * modify it under the terms of the GNU Lesser General Public
24844 + * License version 2.1, as published by the Free Software Foundation.
24846 + * This library is distributed in the hope that it will be useful,
24847 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24848 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24849 + * Lesser General Public License for more details.
24851 + * You should have received a copy of the GNU Lesser General Public
24852 + * License along with this library; if not, write to the Free Software
24853 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24854 + * MA 02111-1307 USA
24856 + ************************************************************************/
24857 +#include "vbamultipage.hxx"
24858 +#include <ooo/vba/XCollection.hpp>
24859 +#include "vbapages.hxx"
24862 +using namespace com::sun::star;
24863 +using namespace ooo::vba;
24865 +// uno servicename com.sun.star.awt.UnoControlProgressBarMode
24866 +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
24867 +const rtl::OUString SVALUEMAX( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") );
24868 +const rtl::OUString SSTEP( RTL_CONSTASCII_USTRINGPARAM("Step") );
24870 +typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base;
24871 +class PagesImpl : public PagesImpl_Base
24873 + sal_Int32 mnPages;
24875 + PagesImpl( sal_Int32 nPages ) : mnPages( nPages ) {}
24876 + virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) { return mnPages; }
24877 + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, ::uno::RuntimeException)
24879 + if ( Index < 0 || Index > mnPages )
24880 + throw lang::IndexOutOfBoundsException();
24881 + return uno::makeAny( uno::Reference< uno::XInterface >() );
24883 + // XElementAccess
24884 + virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
24886 + // no Pages object yet #FIXME
24887 + //return msforms::XPage::static_type(0);
24888 + return uno::XInterface::static_type(0);
24890 + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
24892 + return ( mnPages > 0 );
24895 +uno::Reference< container::XIndexAccess >
24896 +ScVbaMultiPage::getPages( sal_Int32 nPages )
24898 + return new PagesImpl( nPages );
24901 +ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
24903 + mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
24904 + // set dialog step to value of multipage pseudo model
24905 + setValue(getValue());
24909 +sal_Int32 SAL_CALL
24910 +ScVbaMultiPage::getValue() throw (css::uno::RuntimeException)
24912 + sal_Int32 nValue = 0;
24913 + m_xProps->getPropertyValue( SVALUE ) >>= nValue;
24918 +ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
24920 + // track change in dialog ( dialog value is 1 based, 0 is a special value )
24921 + m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
24922 + mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
24927 +ScVbaMultiPage::getServiceImplName()
24929 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMultiPage") );
24930 + return sImplName;
24934 +ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException)
24936 + sal_Int32 nValue = 0;
24937 + m_xProps->getPropertyValue( SVALUEMAX ) >>= nValue;
24938 + uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( nValue ) ) );
24939 + if ( !index.hasValue() )
24940 + return uno::makeAny( xColl );
24941 + return xColl->Item( uno::makeAny( index ), uno::Any() );
24944 +uno::Sequence< rtl::OUString >
24945 +ScVbaMultiPage::getServiceNames()
24947 + static uno::Sequence< rtl::OUString > aServiceNames;
24948 + if ( aServiceNames.getLength() == 0 )
24950 + aServiceNames.realloc( 1 );
24951 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.MultiPage" ) );
24953 + return aServiceNames;
24955 --- vbahelper/source/msforms/vbamultipage.hxx.old 1970-01-01 00:00:00.000000000 +0000
24956 +++ vbahelper/source/msforms/vbamultipage.hxx 2009-04-06 16:42:01.000000000 +0000
24958 +/*************************************************************************
24960 + * OpenOffice.org - a multi-platform office productivity suite
24966 + * last change: $Author$ $Date$
24968 + * The Contents of this file are made available subject to
24969 + * the terms of GNU Lesser General Public License Version 2.1.
24972 + * GNU Lesser General Public License Version 2.1
24973 + * =============================================
24974 + * Copyright 2005 by Sun Microsystems, Inc.
24975 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
24977 + * This library is free software; you can redistribute it and/or
24978 + * modify it under the terms of the GNU Lesser General Public
24979 + * License version 2.1, as published by the Free Software Foundation.
24981 + * This library is distributed in the hope that it will be useful,
24982 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24983 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24984 + * Lesser General Public License for more details.
24986 + * You should have received a copy of the GNU Lesser General Public
24987 + * License along with this library; if not, write to the Free Software
24988 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24989 + * MA 02111-1307 USA
24991 + ************************************************************************/
24992 +#ifndef SC_VBA_MULTIPAGE_HXX
24993 +#define SC_VBA_MULTIPAGE_HXX
24994 +#include <cppuhelper/implbase1.hxx>
24995 +#include <ooo/vba/msforms/XMultiPage.hpp>
24996 +#include <com/sun/star/container/XIndexAccess.hpp>
24998 +#include "vbacontrol.hxx"
24999 +#include <vbahelper/vbahelper.hxx>
25000 +//#include <cppuhelper/implbase2.hxx>
25001 +#include <cppuhelper/implbase1.hxx>
25003 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XMultiPage > MultiPageImpl_BASE;
25005 +class ScVbaMultiPage : public MultiPageImpl_BASE
25007 + css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages );
25008 + css::uno::Reference< css::beans::XPropertySet > mxDialogProps;
25010 + ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog );
25012 + virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException);
25013 + virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException);
25014 + virtual css::uno::Any SAL_CALL Pages( const css::uno::Any& index ) throw (css::uno::RuntimeException);
25016 + //XHelperInterface
25017 + virtual rtl::OUString& getServiceImplName();
25018 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
25019 + // XDefaultProperty
25020 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
25022 +#endif //SC_VBA_LABEL_HXX
25023 --- vbahelper/source/msforms/vbapages.cxx.old 1970-01-01 00:00:00.000000000 +0000
25024 +++ vbahelper/source/msforms/vbapages.cxx 2009-04-06 16:42:01.000000000 +0000
25026 +/*************************************************************************
25028 + * OpenOffice.org - a multi-platform office productivity suite
25034 + * last change: $Author$ $Date$
25036 + * The Contents of this file are made available subject to
25037 + * the terms of GNU Lesser General Public License Version 2.1.
25040 + * GNU Lesser General Public License Version 2.1
25041 + * =============================================
25042 + * Copyright 2005 by Sun Microsystems, Inc.
25043 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25045 + * This library is free software; you can redistribute it and/or
25046 + * modify it under the terms of the GNU Lesser General Public
25047 + * License version 2.1, as published by the Free Software Foundation.
25049 + * This library is distributed in the hope that it will be useful,
25050 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25051 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25052 + * Lesser General Public License for more details.
25054 + * You should have received a copy of the GNU Lesser General Public
25055 + * License along with this library; if not, write to the Free Software
25056 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25057 + * MA 02111-1307 USA
25059 + ************************************************************************/
25060 +#include "vbapages.hxx"
25062 +using namespace ::ooo::vba;
25063 +using namespace ::com::sun::star;
25065 +ScVbaPages::ScVbaPages( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPages ) throw( lang::IllegalArgumentException ) : ScVbaPages_BASE( xParent, xContext, xPages )
25069 +uno::Type SAL_CALL
25070 +ScVbaPages::getElementType() throw (uno::RuntimeException)
25072 + // return msforms::XPage::static_type(0);
25073 + return uno::XInterface::static_type(0);
25077 +ScVbaPages::createCollectionObject( const css::uno::Any& aSource )
25083 +ScVbaPages::getServiceImplName()
25085 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPages") );
25086 + return sImplName;
25089 +uno::Reference< container::XEnumeration > SAL_CALL
25090 +ScVbaPages::createEnumeration() throw (uno::RuntimeException)
25092 + return uno::Reference< container::XEnumeration >();
25095 +uno::Sequence< rtl::OUString >
25096 +ScVbaPages::getServiceNames()
25098 + static uno::Sequence< rtl::OUString > aServiceNames;
25099 + if ( aServiceNames.getLength() == 0 )
25101 + aServiceNames.realloc( 1 );
25102 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Pages" ) );
25104 + return aServiceNames;
25106 --- vbahelper/source/msforms/vbapages.hxx.old 1970-01-01 00:00:00.000000000 +0000
25107 +++ vbahelper/source/msforms/vbapages.hxx 2009-04-06 16:42:01.000000000 +0000
25109 +/*************************************************************************
25111 + * OpenOffice.org - a multi-platform office productivity suite
25117 + * last change: $Author$ $Date$
25119 + * The Contents of this file are made available subject to
25120 + * the terms of GNU Lesser General Public License Version 2.1.
25123 + * GNU Lesser General Public License Version 2.1
25124 + * =============================================
25125 + * Copyright 2005 by Sun Microsystems, Inc.
25126 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25128 + * This library is free software; you can redistribute it and/or
25129 + * modify it under the terms of the GNU Lesser General Public
25130 + * License version 2.1, as published by the Free Software Foundation.
25132 + * This library is distributed in the hope that it will be useful,
25133 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25134 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25135 + * Lesser General Public License for more details.
25137 + * You should have received a copy of the GNU Lesser General Public
25138 + * License along with this library; if not, write to the Free Software
25139 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25140 + * MA 02111-1307 USA
25142 + ************************************************************************/
25143 +#ifndef SC_VBA_PAGES_HXX
25144 +#define SC_VBA_PAGES_HXX
25146 +#include <ooo/vba/office/MsoShapeType.hpp>
25147 +#include <com/sun/star/lang/XEventListener.hpp>
25148 +#include <com/sun/star/beans/XPropertySet.hpp>
25149 +#include <ooo/vba/msforms/XPages.hpp>
25150 +#include <cppuhelper/implbase2.hxx>
25151 +#include <cppuhelper/implbase1.hxx>
25153 +#include <vbahelper/vbacollectionimpl.hxx>
25154 +typedef CollTestImplHelper<
25155 +ov::msforms::XPages > ScVbaPages_BASE;
25157 +class ScVbaPages : public ScVbaPages_BASE
25160 + virtual rtl::OUString& getServiceImplName();
25161 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
25163 + ScVbaPages( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPages ) throw ( css::lang::IllegalArgumentException );
25164 + virtual ~ScVbaPages() {}
25165 + // XEnumerationAccess
25166 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
25167 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
25168 + // ScVbaPages_BASE
25169 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
25172 +#endif//SC_VBA_SHAPE_HXX
25173 --- vbahelper/source/msforms/vbaprogressbar.cxx.old 1970-01-01 00:00:00.000000000 +0000
25174 +++ vbahelper/source/msforms/vbaprogressbar.cxx 2009-04-06 16:42:01.000000000 +0000
25176 +/*************************************************************************
25178 + * OpenOffice.org - a multi-platform office productivity suite
25184 + * last change: $Author$ $Date$
25186 + * The Contents of this file are made available subject to
25187 + * the terms of GNU Lesser General Public License Version 2.1.
25190 + * GNU Lesser General Public License Version 2.1
25191 + * =============================================
25192 + * Copyright 2005 by Sun Microsystems, Inc.
25193 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25195 + * This library is free software; you can redistribute it and/or
25196 + * modify it under the terms of the GNU Lesser General Public
25197 + * License version 2.1, as published by the Free Software Foundation.
25199 + * This library is distributed in the hope that it will be useful,
25200 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25201 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25202 + * Lesser General Public License for more details.
25204 + * You should have received a copy of the GNU Lesser General Public
25205 + * License along with this library; if not, write to the Free Software
25206 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25207 + * MA 02111-1307 USA
25209 + ************************************************************************/
25210 +#include "vbaprogressbar.hxx"
25213 +using namespace com::sun::star;
25214 +using namespace ooo::vba;
25216 +// uno servicename com.sun.star.awt.UnoControlProgressBarMode
25217 +const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") );
25219 +ScVbaProgressBar::ScVbaProgressBar( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ProgressBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
25225 +ScVbaProgressBar::getValue() throw (css::uno::RuntimeException)
25227 + return m_xProps->getPropertyValue( SVALUE );
25231 +ScVbaProgressBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
25233 + m_xProps->setPropertyValue( SVALUE, _value );
25237 +ScVbaProgressBar::getServiceImplName()
25239 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaProgressBar") );
25240 + return sImplName;
25243 +uno::Sequence< rtl::OUString >
25244 +ScVbaProgressBar::getServiceNames()
25246 + static uno::Sequence< rtl::OUString > aServiceNames;
25247 + if ( aServiceNames.getLength() == 0 )
25249 + aServiceNames.realloc( 1 );
25250 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
25252 + return aServiceNames;
25254 --- vbahelper/source/msforms/vbaprogressbar.hxx.old 1970-01-01 00:00:00.000000000 +0000
25255 +++ vbahelper/source/msforms/vbaprogressbar.hxx 2009-04-06 16:42:01.000000000 +0000
25257 +/*************************************************************************
25259 + * OpenOffice.org - a multi-platform office productivity suite
25265 + * last change: $Author$ $Date$
25267 + * The Contents of this file are made available subject to
25268 + * the terms of GNU Lesser General Public License Version 2.1.
25271 + * GNU Lesser General Public License Version 2.1
25272 + * =============================================
25273 + * Copyright 2005 by Sun Microsystems, Inc.
25274 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25276 + * This library is free software; you can redistribute it and/or
25277 + * modify it under the terms of the GNU Lesser General Public
25278 + * License version 2.1, as published by the Free Software Foundation.
25280 + * This library is distributed in the hope that it will be useful,
25281 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25282 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25283 + * Lesser General Public License for more details.
25285 + * You should have received a copy of the GNU Lesser General Public
25286 + * License along with this library; if not, write to the Free Software
25287 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25288 + * MA 02111-1307 USA
25290 + ************************************************************************/
25291 +#ifndef SC_VBA_PROGRESSBAR_HXX
25292 +#define SC_VBA_PROGRESSBAR_HXX
25293 +#include <cppuhelper/implbase1.hxx>
25294 +#include <ooo/vba/msforms/XProgressBar.hpp>
25296 +#include "vbacontrol.hxx"
25297 +#include <vbahelper/vbahelper.hxx>
25298 +#include <cppuhelper/implbase2.hxx>
25300 +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XProgressBar, css::script::XDefaultProperty > ProgressBarImpl_BASE;
25302 +class ScVbaProgressBar : public ProgressBarImpl_BASE
25305 + ScVbaProgressBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
25307 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
25308 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
25309 + //XHelperInterface
25310 + virtual rtl::OUString& getServiceImplName();
25311 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
25312 + // XDefaultProperty
25313 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
25315 +#endif //SC_VBA_LABEL_HXX
25316 --- vbahelper/source/msforms/vbaradiobutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
25317 +++ vbahelper/source/msforms/vbaradiobutton.cxx 2009-04-06 16:42:01.000000000 +0000
25319 +/*************************************************************************
25321 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25323 + * Copyright 2008 by Sun Microsystems, Inc.
25325 + * OpenOffice.org - a multi-platform office productivity suite
25327 + * $RCSfile: vbaradiobutton.cxx,v $
25328 + * $Revision: 1.3 $
25330 + * This file is part of OpenOffice.org.
25332 + * OpenOffice.org is free software: you can redistribute it and/or modify
25333 + * it under the terms of the GNU Lesser General Public License version 3
25334 + * only, as published by the Free Software Foundation.
25336 + * OpenOffice.org is distributed in the hope that it will be useful,
25337 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25338 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25339 + * GNU Lesser General Public License version 3 for more details
25340 + * (a copy is included in the LICENSE file that accompanied this code).
25342 + * You should have received a copy of the GNU Lesser General Public License
25343 + * version 3 along with OpenOffice.org. If not, see
25344 + * <http://www.openoffice.org/license.html>
25345 + * for a copy of the LGPLv3 License.
25347 + ************************************************************************/
25348 +#include "vbaradiobutton.hxx"
25351 +using namespace com::sun::star;
25352 +using namespace ooo::vba;
25355 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
25356 +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
25357 +ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
25362 +rtl::OUString SAL_CALL
25363 +ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException)
25365 + rtl::OUString Label;
25366 + m_xProps->getPropertyValue( LABEL ) >>= Label;
25371 +ScVbaRadioButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
25373 + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
25377 +ScVbaRadioButton::getValue() throw (css::uno::RuntimeException)
25379 + sal_Int16 nValue = -1;
25380 + m_xProps->getPropertyValue( STATE ) >>= nValue;
25381 + if( nValue != 0 )
25383 +// return uno::makeAny( nValue );
25384 +// I must be missing something MSO says value should be -1 if selected, 0 if not
25386 + return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False );
25391 +ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
25393 + sal_Int16 nValue = 0;
25394 + sal_Bool bValue = sal_False;
25395 + if( _value >>= nValue )
25397 + if( nValue == -1)
25400 + else if ( _value >>= bValue )
25405 + m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
25409 +ScVbaRadioButton::getServiceImplName()
25411 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaRadioButton") );
25412 + return sImplName;
25415 +uno::Sequence< rtl::OUString >
25416 +ScVbaRadioButton::getServiceNames()
25418 + static uno::Sequence< rtl::OUString > aServiceNames;
25419 + if ( aServiceNames.getLength() == 0 )
25421 + aServiceNames.realloc( 1 );
25422 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.RadioButton" ) );
25424 + return aServiceNames;
25426 --- vbahelper/source/msforms/vbaradiobutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
25427 +++ vbahelper/source/msforms/vbaradiobutton.hxx 2009-04-06 16:42:01.000000000 +0000
25429 +/*************************************************************************
25431 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25433 + * Copyright 2008 by Sun Microsystems, Inc.
25435 + * OpenOffice.org - a multi-platform office productivity suite
25437 + * $RCSfile: vbaradiobutton.hxx,v $
25438 + * $Revision: 1.3 $
25440 + * This file is part of OpenOffice.org.
25442 + * OpenOffice.org is free software: you can redistribute it and/or modify
25443 + * it under the terms of the GNU Lesser General Public License version 3
25444 + * only, as published by the Free Software Foundation.
25446 + * OpenOffice.org is distributed in the hope that it will be useful,
25447 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25448 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25449 + * GNU Lesser General Public License version 3 for more details
25450 + * (a copy is included in the LICENSE file that accompanied this code).
25452 + * You should have received a copy of the GNU Lesser General Public License
25453 + * version 3 along with OpenOffice.org. If not, see
25454 + * <http://www.openoffice.org/license.html>
25455 + * for a copy of the LGPLv3 License.
25457 + ************************************************************************/
25458 +#ifndef SC_VBA_RADIOBUTTON_HXX
25459 +#define SC_VBA_RADIOBUTTON_HXX
25460 +#include <ooo/vba/msforms/XRadioButton.hpp>
25461 +#include "vbacontrol.hxx"
25462 +#include <vbahelper/vbahelper.hxx>
25463 +#include <cppuhelper/implbase2.hxx>
25465 +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > RadioButtonImpl_BASE;
25467 +class ScVbaRadioButton : public RadioButtonImpl_BASE
25470 + ScVbaRadioButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
25472 + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
25473 + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
25474 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
25475 + virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException);
25476 + //XHelperInterface
25477 + virtual rtl::OUString& getServiceImplName();
25478 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
25479 + // XDefaultProperty
25480 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
25483 +#endif //SC_VBA_RADIOBUTTON_HXX
25484 --- vbahelper/source/msforms/vbascrollbar.cxx.old 1970-01-01 00:00:00.000000000 +0000
25485 +++ vbahelper/source/msforms/vbascrollbar.cxx 2009-04-06 16:42:01.000000000 +0000
25487 +/*************************************************************************
25489 + * OpenOffice.org - a multi-platform office productivity suite
25495 + * last change: $Author$ $Date$
25497 + * The Contents of this file are made available subject to
25498 + * the terms of GNU Lesser General Public License Version 2.1.
25501 + * GNU Lesser General Public License Version 2.1
25502 + * =============================================
25503 + * Copyright 2005 by Sun Microsystems, Inc.
25504 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25506 + * This library is free software; you can redistribute it and/or
25507 + * modify it under the terms of the GNU Lesser General Public
25508 + * License version 2.1, as published by the Free Software Foundation.
25510 + * This library is distributed in the hope that it will be useful,
25511 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25512 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25513 + * Lesser General Public License for more details.
25515 + * You should have received a copy of the GNU Lesser General Public
25516 + * License along with this library; if not, write to the Free Software
25517 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25518 + * MA 02111-1307 USA
25520 + ************************************************************************/
25521 +#include "vbascrollbar.hxx"
25524 +using namespace com::sun::star;
25525 +using namespace ooo::vba;
25528 +const static rtl::OUString LARGECHANGE( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") );
25529 +const static rtl::OUString SMALLCHANGE( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") );
25530 +const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
25531 +const static rtl::OUString SCROLLVALUE( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") );
25532 +const static rtl::OUString SCROLLMAX( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") );
25533 +const static rtl::OUString SCROLLMIN( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMin") );
25535 +ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
25541 +ScVbaScrollBar::getValue() throw (css::uno::RuntimeException)
25543 + return m_xProps->getPropertyValue( SCROLLVALUE );
25547 +ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
25549 + m_xProps->setPropertyValue( SCROLLVALUE, _value );
25552 +::sal_Int32 SAL_CALL
25553 +ScVbaScrollBar::getMax() throw (uno::RuntimeException)
25555 + sal_Int32 nMax = 0;
25556 + m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax;
25561 +ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
25563 + m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) );
25566 +::sal_Int32 SAL_CALL
25567 +ScVbaScrollBar::getMin() throw (uno::RuntimeException)
25569 + sal_Int32 nVal = 0;
25570 + m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal;
25575 +ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
25577 + m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) );
25581 +ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException)
25583 + m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) );
25586 +::sal_Int32 SAL_CALL
25587 +ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException)
25589 + sal_Int32 nVal = 0;
25590 + m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal;
25594 +::sal_Int32 SAL_CALL
25595 +ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException)
25597 + sal_Int32 nSmallChange = 0;
25598 + m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange;
25599 + return nSmallChange;
25603 +ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException)
25605 + m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) );
25609 +ScVbaScrollBar::getServiceImplName()
25611 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaScrollBar") );
25612 + return sImplName;
25615 +uno::Sequence< rtl::OUString >
25616 +ScVbaScrollBar::getServiceNames()
25618 + static uno::Sequence< rtl::OUString > aServiceNames;
25619 + if ( aServiceNames.getLength() == 0 )
25621 + aServiceNames.realloc( 1 );
25622 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
25624 + return aServiceNames;
25626 --- vbahelper/source/msforms/vbascrollbar.hxx.old 1970-01-01 00:00:00.000000000 +0000
25627 +++ vbahelper/source/msforms/vbascrollbar.hxx 2009-04-06 16:42:01.000000000 +0000
25629 +/*************************************************************************
25631 + * OpenOffice.org - a multi-platform office productivity suite
25637 + * last change: $Author$ $Date$
25639 + * The Contents of this file are made available subject to
25640 + * the terms of GNU Lesser General Public License Version 2.1.
25643 + * GNU Lesser General Public License Version 2.1
25644 + * =============================================
25645 + * Copyright 2005 by Sun Microsystems, Inc.
25646 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25648 + * This library is free software; you can redistribute it and/or
25649 + * modify it under the terms of the GNU Lesser General Public
25650 + * License version 2.1, as published by the Free Software Foundation.
25652 + * This library is distributed in the hope that it will be useful,
25653 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25654 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25655 + * Lesser General Public License for more details.
25657 + * You should have received a copy of the GNU Lesser General Public
25658 + * License along with this library; if not, write to the Free Software
25659 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25660 + * MA 02111-1307 USA
25662 + ************************************************************************/
25663 +#ifndef SC_VBA_SCROLLBAR_HXX
25664 +#define SC_VBA_SCROLLBAR_HXX
25665 +#include <cppuhelper/implbase1.hxx>
25666 +#include <ooo/vba/msforms/XScrollBar.hpp>
25668 +#include "vbacontrol.hxx"
25669 +#include <vbahelper/vbahelper.hxx>
25671 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XScrollBar > ScrollBarImpl_BASE;
25673 +class ScVbaScrollBar : public ScrollBarImpl_BASE
25676 + ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
25678 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
25679 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
25680 + virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
25681 + virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
25682 + virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
25683 + virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
25684 + virtual ::sal_Int32 SAL_CALL getLargeChange() throw (css::uno::RuntimeException);
25685 + virtual void SAL_CALL setLargeChange( ::sal_Int32 _largechange ) throw (css::uno::RuntimeException);
25686 + virtual ::sal_Int32 SAL_CALL getSmallChange() throw (css::uno::RuntimeException);
25687 + virtual void SAL_CALL setSmallChange( ::sal_Int32 _smallchange ) throw (css::uno::RuntimeException);
25690 + //XHelperInterface
25691 + virtual rtl::OUString& getServiceImplName();
25692 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
25694 +#endif //SC_VBA_LABEL_HXX
25695 --- vbahelper/source/msforms/vbaspinbutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
25696 +++ vbahelper/source/msforms/vbaspinbutton.cxx 2009-04-06 16:42:01.000000000 +0000
25698 +/*************************************************************************
25700 + * OpenOffice.org - a multi-platform office productivity suite
25706 + * last change: $Author$ $Date$
25708 + * The Contents of this file are made available subject to
25709 + * the terms of GNU Lesser General Public License Version 2.1.
25712 + * GNU Lesser General Public License Version 2.1
25713 + * =============================================
25714 + * Copyright 2005 by Sun Microsystems, Inc.
25715 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25717 + * This library is free software; you can redistribute it and/or
25718 + * modify it under the terms of the GNU Lesser General Public
25719 + * License version 2.1, as published by the Free Software Foundation.
25721 + * This library is distributed in the hope that it will be useful,
25722 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25723 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25724 + * Lesser General Public License for more details.
25726 + * You should have received a copy of the GNU Lesser General Public
25727 + * License along with this library; if not, write to the Free Software
25728 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25729 + * MA 02111-1307 USA
25731 + ************************************************************************/
25732 +#include "vbaspinbutton.hxx"
25735 +using namespace com::sun::star;
25736 +using namespace ooo::vba;
25739 +const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
25740 +const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") );
25741 +const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") );
25742 +const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") );
25744 +ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
25750 +ScVbaSpinButton::getValue() throw (css::uno::RuntimeException)
25752 + return m_xProps->getPropertyValue( SPINVALUE );
25756 +ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
25758 + m_xProps->setPropertyValue( SPINVALUE, _value );
25761 +::sal_Int32 SAL_CALL
25762 +ScVbaSpinButton::getMax() throw (uno::RuntimeException)
25764 + sal_Int32 nMax = 0;
25765 + m_xProps->getPropertyValue( SPINMAX ) >>= nMax;
25770 +ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
25772 + m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) );
25775 +::sal_Int32 SAL_CALL
25776 +ScVbaSpinButton::getMin() throw (uno::RuntimeException)
25778 + sal_Int32 nVal = 0;
25779 + m_xProps->getPropertyValue( SPINMIN ) >>= nVal;
25784 +ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
25786 + m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) );
25790 +ScVbaSpinButton::getServiceImplName()
25792 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") );
25793 + return sImplName;
25796 +uno::Sequence< rtl::OUString >
25797 +ScVbaSpinButton::getServiceNames()
25799 + static uno::Sequence< rtl::OUString > aServiceNames;
25800 + if ( aServiceNames.getLength() == 0 )
25802 + aServiceNames.realloc( 1 );
25803 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Frame" ) );
25805 + return aServiceNames;
25807 --- vbahelper/source/msforms/vbaspinbutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
25808 +++ vbahelper/source/msforms/vbaspinbutton.hxx 2009-04-06 16:42:01.000000000 +0000
25810 +/*************************************************************************
25812 + * OpenOffice.org - a multi-platform office productivity suite
25818 + * last change: $Author$ $Date$
25820 + * The Contents of this file are made available subject to
25821 + * the terms of GNU Lesser General Public License Version 2.1.
25824 + * GNU Lesser General Public License Version 2.1
25825 + * =============================================
25826 + * Copyright 2005 by Sun Microsystems, Inc.
25827 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
25829 + * This library is free software; you can redistribute it and/or
25830 + * modify it under the terms of the GNU Lesser General Public
25831 + * License version 2.1, as published by the Free Software Foundation.
25833 + * This library is distributed in the hope that it will be useful,
25834 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25835 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25836 + * Lesser General Public License for more details.
25838 + * You should have received a copy of the GNU Lesser General Public
25839 + * License along with this library; if not, write to the Free Software
25840 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25841 + * MA 02111-1307 USA
25843 + ************************************************************************/
25844 +#ifndef SC_VBA_SPINBUTTON_HXX
25845 +#define SC_VBA_SPINBUTTON_HXX
25846 +#include <cppuhelper/implbase1.hxx>
25847 +#include <ooo/vba/msforms/XSpinButton.hpp>
25849 +#include "vbacontrol.hxx"
25850 +#include <vbahelper/vbahelper.hxx>
25852 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XSpinButton > SpinButtonImpl_BASE;
25854 +class ScVbaSpinButton : public SpinButtonImpl_BASE
25857 + ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
25859 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
25860 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
25861 + virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
25862 + virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
25863 + virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
25864 + virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
25866 + //XHelperInterface
25867 + virtual rtl::OUString& getServiceImplName();
25868 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
25870 +#endif //SC_VBA_SPINBUTTON_HXX
25871 --- vbahelper/source/msforms/vbatextbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
25872 +++ vbahelper/source/msforms/vbatextbox.cxx 2009-04-06 16:42:01.000000000 +0000
25874 +/*************************************************************************
25876 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25878 + * Copyright 2008 by Sun Microsystems, Inc.
25880 + * OpenOffice.org - a multi-platform office productivity suite
25882 + * $RCSfile: vbatextbox.cxx,v $
25883 + * $Revision: 1.3 $
25885 + * This file is part of OpenOffice.org.
25887 + * OpenOffice.org is free software: you can redistribute it and/or modify
25888 + * it under the terms of the GNU Lesser General Public License version 3
25889 + * only, as published by the Free Software Foundation.
25891 + * OpenOffice.org is distributed in the hope that it will be useful,
25892 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25893 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25894 + * GNU Lesser General Public License version 3 for more details
25895 + * (a copy is included in the LICENSE file that accompanied this code).
25897 + * You should have received a copy of the GNU Lesser General Public License
25898 + * version 3 along with OpenOffice.org. If not, see
25899 + * <http://www.openoffice.org/license.html>
25900 + * for a copy of the LGPLv3 License.
25902 + ************************************************************************/
25903 +#include <com/sun/star/text/XTextRange.hpp>
25905 +#include "vbatextbox.hxx"
25908 +using namespace com::sun::star;
25909 +using namespace ooo::vba;
25913 +ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
25919 +ScVbaTextBox::getValue() throw (css::uno::RuntimeException)
25921 + return uno::makeAny( getText() );
25925 +ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
25927 + rtl::OUString sVal = getAnyAsString( _value );
25931 +//getString() will cause some imfo lose.
25932 +rtl::OUString SAL_CALL
25933 +ScVbaTextBox::getText() throw (css::uno::RuntimeException)
25936 + aValue = m_xProps->getPropertyValue
25937 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
25938 + rtl::OUString sString;
25939 + aValue >>= sString;
25944 +ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
25948 + uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
25949 + xTextRange->setString( _text );
25952 + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) );
25955 +sal_Int32 SAL_CALL
25956 +ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
25959 + aValue = m_xProps->getPropertyValue
25960 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) );
25961 + sal_Int32 nMaxLength = 0;
25962 + aValue >>= nMaxLength;
25963 + return nMaxLength;
25967 +ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
25969 + uno::Any aValue( _maxlength );
25970 + m_xProps->setPropertyValue
25971 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
25975 +ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException)
25978 + aValue = m_xProps->getPropertyValue
25979 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) );
25980 + sal_Bool bRet = false;
25986 +ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException)
25988 + uno::Any aValue( _multiline );
25989 + m_xProps->setPropertyValue
25990 + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
25994 +ScVbaTextBox::getServiceImplName()
25996 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextBox") );
25997 + return sImplName;
26000 +uno::Sequence< rtl::OUString >
26001 +ScVbaTextBox::getServiceNames()
26003 + static uno::Sequence< rtl::OUString > aServiceNames;
26004 + if ( aServiceNames.getLength() == 0 )
26006 + aServiceNames.realloc( 1 );
26007 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextBox" ) );
26009 + return aServiceNames;
26011 --- vbahelper/source/msforms/vbatextbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
26012 +++ vbahelper/source/msforms/vbatextbox.hxx 2009-04-06 16:42:01.000000000 +0000
26014 +/*************************************************************************
26016 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26018 + * Copyright 2008 by Sun Microsystems, Inc.
26020 + * OpenOffice.org - a multi-platform office productivity suite
26022 + * $RCSfile: vbatextbox.hxx,v $
26023 + * $Revision: 1.3 $
26025 + * This file is part of OpenOffice.org.
26027 + * OpenOffice.org is free software: you can redistribute it and/or modify
26028 + * it under the terms of the GNU Lesser General Public License version 3
26029 + * only, as published by the Free Software Foundation.
26031 + * OpenOffice.org is distributed in the hope that it will be useful,
26032 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26033 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26034 + * GNU Lesser General Public License version 3 for more details
26035 + * (a copy is included in the LICENSE file that accompanied this code).
26037 + * You should have received a copy of the GNU Lesser General Public License
26038 + * version 3 along with OpenOffice.org. If not, see
26039 + * <http://www.openoffice.org/license.html>
26040 + * for a copy of the LGPLv3 License.
26042 + ************************************************************************/
26043 +#ifndef SC_VBA_TEXTBOX_HXX
26044 +#define SC_VBA_TEXTBOX_HXX
26045 +#include <cppuhelper/implbase1.hxx>
26046 +#include <ooo/vba/msforms/XTextBox.hpp>
26047 +#include "vbacontrol.hxx"
26048 +#include <vbahelper/vbahelper.hxx>
26050 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
26052 +class ScVbaTextBox : public TextBoxImpl_BASE
26056 + ScVbaTextBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, bool bDialog = false );
26058 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
26059 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
26060 + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
26061 + virtual void SAL_CALL setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException);
26062 + virtual sal_Int32 SAL_CALL getMaxLength() throw (css::uno::RuntimeException);
26063 + virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException);
26064 + virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException);
26065 + virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException);
26066 + //XHelperInterface
26067 + virtual rtl::OUString& getServiceImplName();
26068 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
26070 +#endif //SC_VBA_TEXTBOX_HXX
26071 --- vbahelper/source/msforms/vbatogglebutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
26072 +++ vbahelper/source/msforms/vbatogglebutton.cxx 2009-04-06 16:42:01.000000000 +0000
26074 +/*************************************************************************
26076 + * OpenOffice.org - a multi-platform office productivity suite
26082 + * last change: $Author$ $Date$
26084 + * The Contents of this file are made available subject to
26085 + * the terms of GNU Lesser General Public License Version 2.1.
26088 + * GNU Lesser General Public License Version 2.1
26089 + * =============================================
26090 + * Copyright 2005 by Sun Microsystems, Inc.
26091 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
26093 + * This library is free software; you can redistribute it and/or
26094 + * modify it under the terms of the GNU Lesser General Public
26095 + * License version 2.1, as published by the Free Software Foundation.
26097 + * This library is distributed in the hope that it will be useful,
26098 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26099 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26100 + * Lesser General Public License for more details.
26102 + * You should have received a copy of the GNU Lesser General Public
26103 + * License along with this library; if not, write to the Free Software
26104 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26105 + * MA 02111-1307 USA
26107 + ************************************************************************/
26108 +#include "vbatogglebutton.hxx"
26111 +using namespace com::sun::star;
26112 +using namespace ooo::vba;
26115 +const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
26116 +const static rtl::OUString TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") );
26117 +const static rtl::OUString STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
26118 +ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
26120 + OSL_TRACE("ScVbaToggleButton(ctor)");
26121 + m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) );
26124 +ScVbaToggleButton::~ScVbaToggleButton()
26126 + OSL_TRACE("~ScVbaToggleButton(dtor)");
26130 +rtl::OUString SAL_CALL
26131 +ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException)
26133 + rtl::OUString Label;
26134 + m_xProps->getPropertyValue( LABEL ) >>= Label;
26139 +ScVbaToggleButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
26141 + m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
26145 +ScVbaToggleButton::getValue() throw (uno::RuntimeException)
26147 + sal_Int16 nState = 0;
26148 + m_xProps->getPropertyValue( STATE ) >>= nState;
26149 + return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
26153 +ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
26155 + sal_Int16 nState = 0;
26156 + _value >>= nState;
26157 + OSL_TRACE( "nState - %d", nState );
26158 + nState = ( nState == -1 ) ? 1 : 0;
26159 + OSL_TRACE( "nState - %d", nState );
26160 + m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
26164 +ScVbaToggleButton::getServiceImplName()
26166 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") );
26167 + return sImplName;
26170 +uno::Sequence< rtl::OUString >
26171 +ScVbaToggleButton::getServiceNames()
26173 + static uno::Sequence< rtl::OUString > aServiceNames;
26174 + if ( aServiceNames.getLength() == 0 )
26176 + aServiceNames.realloc( 1 );
26177 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) );
26179 + return aServiceNames;
26182 --- vbahelper/source/msforms/vbatogglebutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
26183 +++ vbahelper/source/msforms/vbatogglebutton.hxx 2009-04-06 16:42:01.000000000 +0000
26185 +/*************************************************************************
26187 + * OpenOffice.org - a multi-platform office productivity suite
26193 + * last change: $Author$ $Date$
26195 + * The Contents of this file are made available subject to
26196 + * the terms of GNU Lesser General Public License Version 2.1.
26199 + * GNU Lesser General Public License Version 2.1
26200 + * =============================================
26201 + * Copyright 2005 by Sun Microsystems, Inc.
26202 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
26204 + * This library is free software; you can redistribute it and/or
26205 + * modify it under the terms of the GNU Lesser General Public
26206 + * License version 2.1, as published by the Free Software Foundation.
26208 + * This library is distributed in the hope that it will be useful,
26209 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26210 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26211 + * Lesser General Public License for more details.
26213 + * You should have received a copy of the GNU Lesser General Public
26214 + * License along with this library; if not, write to the Free Software
26215 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26216 + * MA 02111-1307 USA
26218 + ************************************************************************/
26219 +#ifndef SC_VBA_TOGGLEBUTTON_HXX
26220 +#define SC_VBA_TOGGLEBUTTON_HXX
26221 +#include <cppuhelper/implbase2.hxx>
26222 +#include <ooo/vba/msforms/XToggleButton.hpp>
26224 +#include "vbacontrol.hxx"
26225 +#include <vbahelper/vbahelper.hxx>
26227 +typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty > ToggleButtonImpl_BASE;
26229 +class ScVbaToggleButton : public ToggleButtonImpl_BASE
26231 + rtl::OUString msDftPropName;
26233 + ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
26234 + ~ScVbaToggleButton();
26236 + virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
26237 + virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
26239 + virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
26240 + virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
26241 + //XHelperInterface
26242 + virtual rtl::OUString& getServiceImplName();
26243 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
26244 + // XDefaultProperty
26245 + rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
26247 +#endif //SC_VBA_TOGGLEBUTTON_HXX
26248 --- vbahelper/source/msforms/vbauserform.cxx.old 1970-01-01 00:00:00.000000000 +0000
26249 +++ vbahelper/source/msforms/vbauserform.cxx 2009-04-06 16:42:01.000000000 +0000
26251 +/*************************************************************************
26253 + * OpenOffice.org - a multi-platform office productivity suite
26259 + * last change: $Author$ $Date$
26261 + * The Contents of this file are made available subject to
26262 + * the terms of GNU Lesser General Public License Version 2.1.
26265 + * GNU Lesser General Public License Version 2.1
26266 + * =============================================
26267 + * Copyright 2005 by Sun Microsystems, Inc.
26268 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
26270 + * This library is free software; you can redistribute it and/or
26271 + * modify it under the terms of the GNU Lesser General Public
26272 + * License version 2.1, as published by the Free Software Foundation.
26274 + * This library is distributed in the hope that it will be useful,
26275 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26276 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26277 + * Lesser General Public License for more details.
26279 + * You should have received a copy of the GNU Lesser General Public
26280 + * License along with this library; if not, write to the Free Software
26281 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26282 + * MA 02111-1307 USA
26284 + ************************************************************************/
26285 +#include <vbahelper/helperdecl.hxx>
26286 +#include "vbauserform.hxx"
26287 +#include <com/sun/star/awt/XControl.hpp>
26288 +#include <com/sun/star/awt/XControlContainer.hpp>
26289 +#include <com/sun/star/beans/PropertyConcept.hpp>
26290 +#include <basic/sbx.hxx>
26291 +#include <basic/sbstar.hxx>
26292 +#include <basic/sbmeth.hxx>
26293 +#include "vbacontrols.hxx"
26295 +using namespace ::ooo::vba;
26296 +using namespace ::com::sun::star;
26298 +// some little notes
26299 +// XDialog implementation has the following interesting bits
26300 +// a Controls property ( which is an array of the container controls )
26301 +// each item in the controls array is a XControl, where the model is
26302 +// basically a property bag
26303 +// additionally the XDialog instance has itself a model
26304 +// this model has a ControlModels ( array of models ) property
26305 +// the models in ControlModels can be accessed by name
26306 +// also the XDialog is a XControl ( to access the model above
26308 +ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) : ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), mbDispose( true )
26310 + m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
26311 + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
26312 + m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
26313 + setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
26316 +ScVbaUserForm::~ScVbaUserForm()
26321 +ScVbaUserForm::Show( ) throw (uno::RuntimeException)
26323 + OSL_TRACE("ScVbaUserForm::Show( )");
26325 + if ( m_xDialog.is() )
26326 + aRet = m_xDialog->execute();
26327 + OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet);
26332 + uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW );
26333 + m_xDialog = NULL;
26334 + xComp->dispose();
26335 + mbDispose = false;
26337 + catch( uno::Exception& )
26343 +rtl::OUString SAL_CALL
26344 +ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException)
26346 + rtl::OUString sCaption;
26347 + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption;
26351 +ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
26353 + m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) );
26357 +ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
26359 + mbDispose = false; // hide not dispose
26360 + if ( m_xDialog.is() )
26361 + m_xDialog->endExecute();
26365 +ScVbaUserForm::RePaint( ) throw (uno::RuntimeException)
26371 +ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException)
26373 + mbDispose = true;
26374 + if ( m_xDialog.is() )
26375 + m_xDialog->endExecute();
26379 +ScVbaUserForm::getServiceImplName()
26381 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaUserForm") );
26382 + return sImplName;
26385 +uno::Sequence< rtl::OUString >
26386 +ScVbaUserForm::getServiceNames()
26388 + static uno::Sequence< rtl::OUString > aServiceNames;
26389 + if ( aServiceNames.getLength() == 0 )
26391 + aServiceNames.realloc( 1 );
26392 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm" ) );
26394 + return aServiceNames;
26397 +uno::Reference< beans::XIntrospectionAccess > SAL_CALL
26398 +ScVbaUserForm::getIntrospection( ) throw (uno::RuntimeException)
26400 + return uno::Reference< beans::XIntrospectionAccess >();
26404 +ScVbaUserForm::invoke( const ::rtl::OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
26406 + throw uno::RuntimeException(); // unsupported operation
26410 +ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
26412 + uno::Any aObject = getValue( aPropertyName );
26413 + // The Object *must* support XDefaultProperty here because getValue will
26414 + // only return properties that are Objects ( e.g. controls )
26415 + // e.g. Userform1.aControl = something
26416 + // 'aControl' has to support XDefaultProperty to make sense here
26417 + uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW );
26418 + rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName();
26419 + uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) );
26420 + uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW );
26421 + xPropSet->setPropertyValue( aDfltPropName, aValue );
26425 +ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
26427 + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
26428 + uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
26429 + uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
26430 + ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
26431 + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
26432 + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
26433 + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
26434 + return uno::makeAny( xVBAControl );
26437 +::sal_Bool SAL_CALL
26438 +ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
26440 + return sal_False;
26443 +ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
26445 + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
26446 + uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) );
26447 + if ( index.hasValue() )
26448 + return uno::makeAny( xControls->Item( index, uno::Any() ) );
26449 + return uno::makeAny( xControls );
26452 +::sal_Bool SAL_CALL
26453 +ScVbaUserForm::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
26455 + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY );
26456 + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is() );
26457 + if ( xControl.is() )
26459 + uno::Reference< container::XNameAccess > xNameAccess( xControl->getModel(), uno::UNO_QUERY_THROW );
26460 + sal_Bool bRes = xNameAccess->hasByName( aName );
26461 + OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xControl.is(), bRes );
26464 + return sal_False;
26467 +namespace userform
26469 +namespace sdecl = comphelper::service_decl;
26470 +sdecl::vba_service_class_<ScVbaUserForm, sdecl::with_args<true> > serviceImpl;
26471 +extern sdecl::ServiceDecl const serviceDecl(
26474 + "ooo.vba.msforms.UserForm" );
26477 --- vbahelper/source/msforms/vbauserform.hxx.old 1970-01-01 00:00:00.000000000 +0000
26478 +++ vbahelper/source/msforms/vbauserform.hxx 2009-04-06 16:42:01.000000000 +0000
26480 +/*************************************************************************
26482 + * OpenOffice.org - a multi-platform office productivity suite
26488 + * last change: $Author$ $Date$
26490 + * The Contents of this file are made available subject to
26491 + * the terms of GNU Lesser General Public License Version 2.1.
26494 + * GNU Lesser General Public License Version 2.1
26495 + * =============================================
26496 + * Copyright 2005 by Sun Microsystems, Inc.
26497 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
26499 + * This library is free software; you can redistribute it and/or
26500 + * modify it under the terms of the GNU Lesser General Public
26501 + * License version 2.1, as published by the Free Software Foundation.
26503 + * This library is distributed in the hope that it will be useful,
26504 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26505 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26506 + * Lesser General Public License for more details.
26508 + * You should have received a copy of the GNU Lesser General Public
26509 + * License along with this library; if not, write to the Free Software
26510 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26511 + * MA 02111-1307 USA
26513 + ************************************************************************/
26514 +#ifndef SC_VBA_USERFORM_HXX
26515 +#define SC_VBA_USERFORM_HXX
26517 +#include <cppuhelper/implbase1.hxx>
26518 +#include <ooo/vba/msforms/XUserForm.hpp>
26519 +#include <com/sun/star/awt/XDialog.hpp>
26520 +#include <com/sun/star/frame/XModel.hpp>
26522 +#include <vbahelper/vbahelperinterface.hxx>
26523 +#include "vbacontrol.hxx"
26525 +//typedef InheritedHelperInterfaceImpl1< ov::msforms::XUserForm > ScVbaUserForm_BASE;
26526 +typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XUserForm > ScVbaUserForm_BASE;
26528 +class ScVbaUserForm : public ScVbaUserForm_BASE
26531 + css::uno::Reference< css::awt::XDialog > m_xDialog;
26535 + ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
26536 + virtual ~ScVbaUserForm();
26538 + virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
26539 + virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
26540 + // XIntrospection
26541 + virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
26542 + virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
26543 + virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
26544 + virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
26545 + virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
26546 + virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
26547 + virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException);
26548 + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException);
26549 + virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException);
26550 + virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException);
26551 + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException);
26552 + //XHelperInterface
26553 + virtual rtl::OUString& getServiceImplName();
26554 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
26557 --- vbahelper/source/vbahelper/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
26558 +++ vbahelper/source/vbahelper/makefile.mk 2009-04-06 16:42:01.000000000 +0000
26560 +#*************************************************************************
26562 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26564 +# Copyright 2008 by Sun Microsystems, Inc.
26566 +# OpenOffice.org - a multi-platform office productivity suite
26568 +# $RCSfile: makefile.mk,v $
26570 +# $Revision: 1.45 $
26572 +# This file is part of OpenOffice.org.
26574 +# OpenOffice.org is free software: you can redistribute it and/or modify
26575 +# it under the terms of the GNU Lesser General Public License version 3
26576 +# only, as published by the Free Software Foundation.
26578 +# OpenOffice.org is distributed in the hope that it will be useful,
26579 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
26580 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26581 +# GNU Lesser General Public License version 3 for more details
26582 +# (a copy is included in the LICENSE file that accompanied this code).
26584 +# You should have received a copy of the GNU Lesser General Public License
26585 +# version 3 along with OpenOffice.org. If not, see
26586 +# <http://www.openoffice.org/license.html>
26587 +# for a copy of the LGPLv3 License.
26589 +#*************************************************************************
26595 +ENABLE_EXCEPTIONS := TRUE
26597 +# --- Settings -----------------------------------------------------
26599 +.INCLUDE : settings.mk
26602 + $(SLO)$/vbahelper.obj \
26603 + $(SLO)$/vbapropvalue.obj \
26604 + $(SLO)$/vbacommandbars.obj \
26605 + $(SLO)$/vbacommandbar.obj \
26606 + $(SLO)$/vbacommandbarcontrols.obj \
26607 + $(SLO)$/vbacommandbarcontrol.obj \
26608 + $(SLO)$/vbaapplicationbase.obj \
26609 + $(SLO)$/vbawindowbase.obj \
26610 + $(SLO)$/vbadocumentbase.obj \
26611 + $(SLO)$/vbaglobalbase.obj \
26613 +# --- Targets -------------------------------------------------------
26615 +.INCLUDE : target.mk
26618 + $(MISC)$/$(TARGET).don \
26620 +$(SLOFILES) : $(MISC)$/$(TARGET).don
26622 +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
26623 + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
26626 --- vbahelper/source/vbahelper/vbaapplicationbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
26627 +++ vbahelper/source/vbahelper/vbaapplicationbase.cxx 2009-04-06 16:42:01.000000000 +0000
26629 +/*************************************************************************
26631 + * OpenOffice.org - a multi-platform office productivity suite
26637 + * last change: $Author$ $Date$
26639 + * The Contents of this file are made available subject to
26640 + * the terms of GNU Lesser General Public License Version 2.1.
26643 + * GNU Lesser General Public License Version 2.1
26644 + * =============================================
26645 + * Copyright 2005 by Sun Microsystems, Inc.
26646 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
26648 + * This library is free software; you can redistribute it and/or
26649 + * modify it under the terms of the GNU Lesser General Public
26650 + * License version 2.1, as published by the Free Software Foundation.
26652 + * This library is distributed in the hope that it will be useful,
26653 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26654 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26655 + * Lesser General Public License for more details.
26657 + * You should have received a copy of the GNU Lesser General Public
26658 + * License along with this library; if not, write to the Free Software
26659 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26660 + * MA 02111-1307 USA
26662 + ************************************************************************/
26663 +#include "vbahelper/vbaapplicationbase.hxx"
26664 +#include <com/sun/star/container/XIndexAccess.hpp>
26665 +#include <com/sun/star/frame/XLayoutManager.hpp>
26667 +#include "vbacommandbars.hxx"
26669 +using namespace com::sun::star;
26670 +using namespace ooo::vba;
26672 +VbaApplicationBase::VbaApplicationBase( const uno::Reference< css::uno::XComponentContext >& xContext )
26673 + : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
26677 +VbaApplicationBase::~VbaApplicationBase()
26682 +VbaApplicationBase::getScreenUpdating() throw (uno::RuntimeException)
26684 + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
26685 + return !xModel->hasControllersLocked();
26689 +VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
26691 + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
26693 + xModel->unlockControllers();
26695 + xModel->lockControllers();
26699 +VbaApplicationBase::getDisplayStatusBar() throw (uno::RuntimeException)
26701 + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
26702 + uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
26703 + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
26705 + if( xProps.is() ){
26706 + uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
26707 + rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" ));
26708 + if( xLayoutManager.is() && xLayoutManager->isElementVisible( url ) ){
26712 + return sal_False;
26716 +VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::RuntimeException)
26718 + uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
26719 + uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
26720 + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
26722 + if( xProps.is() ){
26723 + uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ), uno::UNO_QUERY_THROW );
26724 + rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" ));
26725 + if( xLayoutManager.is() ){
26726 + if( bDisplayStatusBar && !xLayoutManager->isElementVisible( url ) ){
26727 + if( !xLayoutManager->showElement( url ) )
26728 + xLayoutManager->createElement( url );
26731 + else if( !bDisplayStatusBar && xLayoutManager->isElementVisible( url ) ){
26732 + xLayoutManager->hideElement( url );
26741 +VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
26743 + uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
26744 + if( aIndex.hasValue() )
26745 + return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) );
26746 + return uno::makeAny( xCommandBars );
26750 +VbaApplicationBase::getServiceImplName()
26752 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaApplicationBase") );
26753 + return sImplName;
26755 +uno::Sequence<rtl::OUString>
26756 +VbaApplicationBase::getServiceNames()
26758 + static uno::Sequence< rtl::OUString > aServiceNames;
26759 + if ( aServiceNames.getLength() == 0 )
26761 + aServiceNames.realloc( 1 );
26762 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaApplicationBase" ) );
26764 + return aServiceNames;
26768 --- vbahelper/source/vbahelper/vbacommandbar.cxx.old 1970-01-01 00:00:00.000000000 +0000
26769 +++ vbahelper/source/vbahelper/vbacommandbar.cxx 2009-04-06 16:42:01.000000000 +0000
26771 +/*************************************************************************
26773 + * OpenOffice.org - a multi-platform office productivity suite
26779 + * last change: $Author$ $Date$
26781 + * The Contents of this file are made available subject to
26782 + * the terms of GNU Lesser General Public License Version 2.1.
26785 + * GNU Lesser General Public License Version 2.1
26786 + * =============================================
26787 + * Copyright 2005 by Sun Microsystems, Inc.
26788 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
26790 + * This library is free software; you can redistribute it and/or
26791 + * modify it under the terms of the GNU Lesser General Public
26792 + * License version 2.1, as published by the Free Software Foundation.
26794 + * This library is distributed in the hope that it will be useful,
26795 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26796 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26797 + * Lesser General Public License for more details.
26799 + * You should have received a copy of the GNU Lesser General Public
26800 + * License along with this library; if not, write to the Free Software
26801 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26802 + * MA 02111-1307 USA
26804 + ************************************************************************/
26805 +#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
26806 +#include <com/sun/star/frame/XFrame.hpp>
26807 +#include <com/sun/star/frame/XDesktop.hpp>
26808 +#include <com/sun/star/frame/XLayoutManager.hpp>
26809 +#include <com/sun/star/beans/XPropertySet.hpp>
26810 +#include <com/sun/star/container/XNameContainer.hpp>
26811 +#include <ooo/vba/office/MsoBarType.hpp>
26813 +#include "vbacommandbar.hxx"
26814 +#include "vbacommandbarcontrols.hxx"
26816 +using namespace com::sun::star;
26817 +using namespace ooo::vba;
26819 +ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext )
26821 + // it's a menu bar
26822 + // only supporting factory menus ( no custom menus )
26823 + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
26824 + initCommandBar();
26825 + switch( nModuleType )
26828 + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" );
26831 + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" );
26834 + m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" );
26836 + getMenuSettings();
26837 + m_bIsMenu = sal_True;
26838 + m_bCustom = sal_False;
26840 +ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext )
26842 + // it's a tool bar
26843 + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
26844 + initCommandBar();
26845 + m_bTemporary = bTemporary;
26846 + m_bCreate = bCreate;
26847 + // get OOo ToolBarName
26848 + CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() );
26849 + if( iter != mCommandBarNameMap.end() )
26851 + m_sToolBarName = iter->second;
26855 + m_sToolBarName = sToolBarName;
26857 + m_sUIName = m_sToolBarName;
26858 + m_bIsMenu = sal_False;
26859 + getToolBarSettings( m_sToolBarName );
26862 +ScVbaCommandBar::initCommandBar() throw (uno::RuntimeException)
26864 + m_pScVbaCommandBars = dynamic_cast< ScVbaCommandBars* >( m_xParentHardRef.get() );
26865 + if ( !m_pScVbaCommandBars )
26866 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBars"), uno::Reference< uno::XInterface >() );
26867 + m_bIsMenu = sal_False;
26868 + m_bCustom = sal_False;
26869 + m_bTemporary = sal_True;
26870 + m_sToolBarName = rtl::OUString::createFromAscii("");
26871 + m_sUIName = rtl::OUString::createFromAscii("");
26872 + m_sMenuModuleName = m_pScVbaCommandBars->GetModuleName();
26875 +ScVbaCommandBar::getToolBarSettings( rtl::OUString sToolBarName ) throw( uno::RuntimeException )
26877 + rtl::OUString sFactoryToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/") + sToolBarName.toAsciiLowerCase();
26878 + rtl::OUString sCustomToolBar = rtl::OUString::createFromAscii("private:resource/toolbar/custom_toolbar_") + sToolBarName;
26879 + uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
26880 + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW );
26881 + m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_pScVbaCommandBars->GetModuleName() ), uno::UNO_QUERY_THROW );
26882 + m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW );
26883 + if( m_xUICfgManager->hasSettings( sFactoryToolBar ) )
26885 + // exsiting standard ToolBar
26886 + m_xBarSettings.set( m_xUICfgManager->getSettings( sFactoryToolBar, sal_True ), uno::UNO_QUERY_THROW );
26887 + m_sToolBarName = sFactoryToolBar;
26889 + else if( m_xUICfgManager->hasSettings( sCustomToolBar ) )
26891 + // exisiting custom ToolBar
26892 + m_xBarSettings.set( m_xUICfgManager->getSettings( sCustomToolBar, sal_True ), uno::UNO_QUERY_THROW );
26893 + m_sToolBarName = sCustomToolBar;
26894 + m_bCustom = sal_True;
26896 + else if( m_bCreate )
26898 + // new custom ToolBar
26899 + m_xBarSettings.set( m_xUICfgManager->createSettings(), uno::UNO_QUERY_THROW );
26900 + m_sToolBarName = sCustomToolBar;
26901 + m_bCustom = sal_True;
26905 + throw uno::RuntimeException( rtl::OUString::createFromAscii("ToolBar do not exist"), uno::Reference< uno::XInterface >() );
26906 + if( m_pScVbaCommandBars->GetWindows()->hasByName( m_sToolBarName ) )
26908 + uno::Any aToolBar = m_pScVbaCommandBars->GetWindows()->getByName( m_sToolBarName );
26909 + aToolBar >>= m_aToolBar;
26913 +ScVbaCommandBar::addCustomBar()
26915 + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
26916 + xPropertySet->setPropertyValue(rtl::OUString::createFromAscii("UIName"), uno::makeAny( m_sUIName ));
26918 + if( m_xUICfgManager->hasSettings(m_sToolBarName) )
26920 + m_xUICfgManager->replaceSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
26924 + m_xUICfgManager->insertSettings( m_sToolBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
26926 + if( !m_bTemporary )
26928 + m_xUICfgPers->store();
26932 +ScVbaCommandBar::getMenuSettings()
26936 + rtl::OUString sMenuBar = rtl::OUString::createFromAscii( "private:resource/menubar/menubar" );
26937 + uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
26938 + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xUICfgManagerSup( xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") ), uno::UNO_QUERY_THROW );
26939 + m_xUICfgManager.set( xUICfgManagerSup->getUIConfigurationManager( m_sMenuModuleName ), uno::UNO_QUERY_THROW );
26940 + m_xUICfgPers.set( m_xUICfgManager, uno::UNO_QUERY_THROW );
26941 + m_xBarSettings.set( m_xUICfgManager->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
26943 + catch ( uno::Exception e)
26945 + OSL_TRACE( "getMenuSetting got a error\n" );
26948 +::rtl::OUString SAL_CALL
26949 +ScVbaCommandBar::getName() throw ( uno::RuntimeException )
26951 + // This will get a "NULL length string" when Name is not set.
26952 + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
26953 + uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") );
26954 + rtl::OUString sName;
26956 + if( sName.getLength() < 1 && !m_bIsMenu )
26958 + uno::Reference< container::XNameAccess > xNameAccess( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
26959 + if( xNameAccess->hasByName( m_sToolBarName ) )
26961 + beans::PropertyValues aToolBar;
26962 + xNameAccess->getByName( m_sToolBarName ) >>= aToolBar;
26963 + sal_Int32 nCount = aToolBar.getLength();
26964 + beans::PropertyValue aPropertyValue;
26965 + for( sal_Int32 i = 0; i < nCount; i++ )
26967 + aPropertyValue = aToolBar[i];
26968 + if( aPropertyValue.Name.equals( rtl::OUString::createFromAscii("UIName") ) )
26970 + aPropertyValue.Value >>= sName;
26979 +ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException)
26981 + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
26982 + xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) );
26983 + uno::Reference< container::XIndexAccess > xIndexAccess( m_xBarSettings, uno::UNO_QUERY_THROW );
26985 + if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
26987 + m_xUICfgManager->replaceSettings( m_sToolBarName, xIndexAccess );
26991 + // toolbar not found
26993 + if( !m_bTemporary )
26995 + m_xUICfgPers->store();
26998 +::sal_Bool SAL_CALL
26999 +ScVbaCommandBar::getVisible() throw (uno::RuntimeException)
27001 + sal_Bool bVisible = sal_False;
27005 + while( !m_aToolBar[i].Name.equals( rtl::OUString::createFromAscii( "Visible" ) ) )
27009 + m_aToolBar[i].Value >>= bVisible;
27011 + catch ( uno::Exception e )
27017 +ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
27021 + uno::Reference< frame::XFrame > xFrame( getCurrentDocument()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
27022 + uno::Reference< beans::XPropertySet > xPropertySet( xFrame, uno::UNO_QUERY_THROW );
27023 + uno::Reference< frame::XLayoutManager > xLayoutManager( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LayoutManager") ), uno::UNO_QUERY_THROW );
27026 + xLayoutManager->createElement( m_sToolBarName );
27027 + xLayoutManager->showElement( m_sToolBarName );
27031 + xLayoutManager->hideElement( m_sToolBarName );
27032 + xLayoutManager->destroyElement( m_sToolBarName );
27035 + catch( uno::Exception e )
27037 + OSL_TRACE( "SetVisible get an exception\n" );
27041 +ScVbaCommandBar::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
27045 + if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
27047 + m_xUICfgManager->removeSettings(m_sToolBarName);
27048 + // make it permanent
27049 + if( !m_bTemporary )
27051 + m_xUICfgPers->store();
27056 + // toolbar not found
27057 + // TODO throw Error
27059 + uno::Reference< container::XNameContainer > xNameContainer( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
27060 + if( xNameContainer->hasByName( m_sToolBarName ) )
27062 + xNameContainer->removeByName( m_sToolBarName );
27067 +ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
27069 + sal_Int32 nIndex;
27070 + uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
27071 + if( aIndex.hasValue() )
27073 + if( aIndex >>= nIndex )
27075 + uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
27076 + return uno::makeAny( xCommandBarControl );
27079 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() );
27081 + return uno::makeAny( xCommandBarControls );
27084 +sal_Int32 SAL_CALL
27085 +ScVbaCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException)
27087 + // #FIXME support msoBarTypePopup
27088 + sal_Int32 nType = office::MsoBarType::msoBarTypePopup;
27089 + nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar;
27094 +ScVbaCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException)
27096 + // alwayse fail to find control
27097 + return uno::makeAny( uno::Reference< XCommandBarControl > () );
27101 +ScVbaCommandBar::getServiceImplName()
27103 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") );
27104 + return sImplName;
27106 +uno::Sequence<rtl::OUString>
27107 +ScVbaCommandBar::getServiceNames()
27109 + static uno::Sequence< rtl::OUString > aServiceNames;
27110 + if ( aServiceNames.getLength() == 0 )
27112 + aServiceNames.realloc( 1 );
27113 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBar" ) );
27115 + return aServiceNames;
27117 --- vbahelper/source/vbahelper/vbacommandbar.hxx.old 1970-01-01 00:00:00.000000000 +0000
27118 +++ vbahelper/source/vbahelper/vbacommandbar.hxx 2009-04-06 16:42:01.000000000 +0000
27120 +/*************************************************************************
27122 + * OpenOffice.org - a multi-platform office productivity suite
27128 + * last change: $Author$ $Date$
27130 + * The Contents of this file are made available subject to
27131 + * the terms of GNU Lesser General Public License Version 2.1.
27134 + * GNU Lesser General Public License Version 2.1
27135 + * =============================================
27136 + * Copyright 2005 by Sun Microsystems, Inc.
27137 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
27139 + * This library is free software; you can redistribute it and/or
27140 + * modify it under the terms of the GNU Lesser General Public
27141 + * License version 2.1, as published by the Free Software Foundation.
27143 + * This library is distributed in the hope that it will be useful,
27144 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27145 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27146 + * Lesser General Public License for more details.
27148 + * You should have received a copy of the GNU Lesser General Public
27149 + * License along with this library; if not, write to the Free Software
27150 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27151 + * MA 02111-1307 USA
27153 + ************************************************************************/
27154 +#ifndef SC_VBA_COMMANDBAR_HXX
27155 +#define SC_VBA_COMMANDBAR_HXX
27157 +#include <ooo/vba/XCommandBar.hpp>
27158 +#include <com/sun/star/ui/XUIConfigurationManager.hpp>
27159 +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
27160 +#include <com/sun/star/container/XIndexContainer.hpp>
27161 +#include <com/sun/star/beans/PropertyValues.hpp>
27163 +#include <vbahelper/vbahelperinterface.hxx>
27164 +#include "vbacommandbars.hxx"
27167 +typedef std::map< const rtl::OUString, rtl::OUString > CommandBarNameMap;
27168 +typedef std::pair< const rtl::OUString, rtl::OUString > CommandBarNamePair;
27169 +const CommandBarNamePair namePair[] = {
27170 + CommandBarNamePair( rtl::OUString::createFromAscii("standard"), rtl::OUString::createFromAscii("standardbar") ),
27171 + CommandBarNamePair( rtl::OUString::createFromAscii("formatting"), rtl::OUString::createFromAscii("formatobjectbar") ),
27173 +static const CommandBarNameMap mCommandBarNameMap( namePair, ( namePair + sizeof(namePair) / sizeof(namePair[0]) ) );
27176 +typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE;
27178 +class ScVbaCommandBar : public CommandBar_BASE
27181 + rtl::OUString m_sToolBarName;
27182 + rtl::OUString m_sMenuModuleName;
27183 + rtl::OUString m_sUIName;
27184 + sal_Bool m_bTemporary;
27185 + sal_Bool m_bIsMenu;
27186 + sal_Bool m_bCustom;
27187 + sal_Bool m_bCreate;
27188 + ScVbaCommandBars* m_pScVbaCommandBars;
27189 + css::beans::PropertyValues m_aToolBar;
27190 + // hard reference for parent
27191 + css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
27192 + css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager;
27193 + css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers;
27194 + css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
27195 + void initCommandBar() throw( css::uno::RuntimeException );
27197 + void getToolBarSettings( rtl::OUString sToolBarName ) throw( css::uno::RuntimeException );
27198 + void getMenuSettings();
27199 + void addCustomBar();
27201 + ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nModuleType ) throw( css::uno::RuntimeException );
27202 + ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw( css::uno::RuntimeException );
27204 + sal_Bool IsMenu() { return m_bIsMenu; };
27205 + css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
27206 + css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
27207 + css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; };
27208 + rtl::OUString GetToolBarName() { return m_sToolBarName; };
27211 + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
27212 + virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException);
27213 + virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
27214 + virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
27217 + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
27218 + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
27219 + virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
27220 + virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
27222 + // XHelperInterface
27223 + virtual rtl::OUString& getServiceImplName();
27224 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
27226 +#endif//SC_VBA_COMMANDBAR_HXX
27227 --- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx.old 1970-01-01 00:00:00.000000000 +0000
27228 +++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx 2009-04-06 16:42:01.000000000 +0000
27230 +/*************************************************************************
27232 + * OpenOffice.org - a multi-platform office productivity suite
27238 + * last change: $Author$ $Date$
27240 + * The Contents of this file are made available subject to
27241 + * the terms of GNU Lesser General Public License Version 2.1.
27244 + * GNU Lesser General Public License Version 2.1
27245 + * =============================================
27246 + * Copyright 2005 by Sun Microsystems, Inc.
27247 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
27249 + * This library is free software; you can redistribute it and/or
27250 + * modify it under the terms of the GNU Lesser General Public
27251 + * License version 2.1, as published by the Free Software Foundation.
27253 + * This library is distributed in the hope that it will be useful,
27254 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27255 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27256 + * Lesser General Public License for more details.
27258 + * You should have received a copy of the GNU Lesser General Public
27259 + * License along with this library; if not, write to the Free Software
27260 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27261 + * MA 02111-1307 USA
27263 + ************************************************************************/
27264 +#include "vbacommandbarcontrol.hxx"
27265 +#include <basic/sbstar.hxx>
27266 +#include <basic/sbmod.hxx>
27267 +#include <basic/sbmeth.hxx>
27269 +using namespace com::sun::star;
27270 +using namespace ooo::vba;
27272 +uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName )
27274 + sal_Int32 nCount = aPropertyValues.getLength();
27275 + for( sal_Int32 i = 0; i < nCount; i++ )
27277 + if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) )
27279 + return aPropertyValues[i].Value;
27282 + return uno::Any();
27285 +beans::PropertyValues lcl_repalcePropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName, uno::Any aValue )
27287 + sal_Int32 nCount = aPropertyValues.getLength();
27288 + for( sal_Int32 i = 0; i < nCount; i++ )
27290 + if( aPropertyValues[i].Name.equalsIgnoreAsciiCase( sPropertyName ) )
27292 + aPropertyValues[i].Value = aValue;
27293 + return aPropertyValues;
27296 + return aPropertyValues;
27299 +ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
27301 + // exsiting CommandBarBarControl
27302 + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
27304 + if( m_xBarSettings->hasElements() )
27306 + ScVbaCommandBarControl* pParentCommandBarControl = m_pCommandBarControls->GetParentCommandBarControl();
27307 + if( pParentCommandBarControl )
27309 + beans::PropertyValues aPropertyValues;
27310 + pParentCommandBarControl->GetCurrentSettings()->getByIndex( pParentCommandBarControl->GetPosition() ) >>= aPropertyValues;
27311 + pParentCommandBarControl->SetPropertyValues( aPropertyValues );
27312 + m_xCurrentSettings.set( lcl_getPropertyValue( pParentCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY_THROW );
27314 + if( !m_xCurrentSettings.is() )
27316 + m_xCurrentSettings.set( m_xUICfgManager->getSettings( m_pCommandBarControls->GetParentToolBarName(), sal_True ), uno::UNO_QUERY_THROW );
27321 + m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
27325 + m_sBarName = m_pCommandBarControls->GetParentToolBarName();
27327 + m_bTemporary = sal_True;
27329 +ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
27331 + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
27333 + if( sName.getLength() > 0 )
27337 + m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName;
27340 + m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
27341 + createNewMenuBarControl();
27345 + m_sBarName = m_pCommandBarControls->GetParentToolBarName();
27346 + createNewToolBarControl();
27351 +ScVbaCommandBarControl::initObjects() throw (uno::RuntimeException)
27353 + m_pCommandBarControls = dynamic_cast< ScVbaCommandBarControls* >( m_xParentHardRef.get() );
27354 + if( !m_pCommandBarControls )
27355 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Parent needs to be a ScVbaCommandBarControls"), uno::Reference< uno::XInterface >() );
27356 + m_xUICfgManager.set( m_pCommandBarControls->GetUICfgManager(), uno::UNO_QUERY_THROW );
27357 + m_xUICfgPers.set( m_pCommandBarControls->GetUICfgPers(), uno::UNO_QUERY_THROW );
27358 + m_xBarSettings.set( m_pCommandBarControls->GetBarSettings(), uno::UNO_QUERY_THROW );
27359 + m_bIsMenu = m_pCommandBarControls->IsMenu();
27360 + m_sName = rtl::OUString::createFromAscii( "Custom" );
27364 +ScVbaCommandBarControl::createNewMenuBarControl()
27366 + uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
27368 + uno::Sequence< beans::PropertyValue > aPropertys;
27369 + if( m_nType == office::MsoControlType::msoControlPopup )
27370 + aPropertys = uno::Sequence< beans::PropertyValue >( 4 );
27372 + aPropertys = uno::Sequence< beans::PropertyValue >( 3 );
27374 + aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
27375 + aPropertys[0].Value <<= m_sCommand;
27376 + aPropertys[1].Name = rtl::OUString::createFromAscii("Label");
27377 + aPropertys[1].Value <<= m_sName;
27378 + aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
27379 + aPropertys[2].Value <<= sal_Int32(0);
27381 + if( m_nType == office::MsoControlType::msoControlPopup )
27383 + aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
27384 + aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext );
27387 + if( m_pCommandBarControls->GetParentCommandBar() != NULL )
27389 + // create a new menu
27390 + m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
27391 + m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW );
27393 + else if( m_pCommandBarControls->GetParentCommandBarControl() != NULL )
27395 + // create a new menu entry
27396 + ScVbaCommandBarControl* pPc = m_pCommandBarControls->GetParentCommandBarControl();
27397 + beans::PropertyValues aPropertyValues;
27398 + pPc->GetCurrentSettings()->getByIndex( pPc->GetPosition() ) >>= aPropertyValues;
27399 + pPc->SetPropertyValues( aPropertyValues );
27401 + // has the property already been set?
27402 + if( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ).hasValue() )
27404 + lcl_repalcePropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer"), uno::makeAny( xMenuMSF->createInstanceWithContext( mxContext ) ) );
27405 + pPc->GetCurrentSettings()->replaceByIndex( pPc->GetPosition(), uno::makeAny( pPc->GetPropertyValues() ) );
27407 + m_xCurrentSettings.set( lcl_getPropertyValue( pPc->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY_THROW );
27408 + m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
27410 + if( m_xUICfgManager->hasSettings( m_sBarName ) )
27412 + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27416 + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27418 + if( !m_bTemporary )
27420 + m_xUICfgPers->store();
27425 +ScVbaCommandBarControl::createNewToolBarControl()
27427 + uno::Sequence< beans::PropertyValue > aPropertys(4);
27428 + aPropertys[0].Name = rtl::OUString::createFromAscii("CommandURL");
27429 + aPropertys[0].Value <<= m_sCommand;
27430 + aPropertys[1].Name = rtl::OUString::createFromAscii("Label");
27431 + aPropertys[1].Value <<= m_sName;
27432 + aPropertys[2].Name = rtl::OUString::createFromAscii("Type");
27433 + aPropertys[2].Value <<= sal_Int32(0);
27434 + aPropertys[3].Name = rtl::OUString::createFromAscii("IsVisible");
27435 + aPropertys[3].Value <<= sal_True;
27437 + m_xBarSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
27438 + uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
27439 + rtl::OUString sUIName;
27440 + xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") ) >>= sUIName;
27442 + m_xCurrentSettings.set( m_xBarSettings, uno::UNO_QUERY_THROW );
27443 + if( m_xUICfgManager->hasSettings( m_sBarName ) )
27445 + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27449 + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27451 + if( !m_bTemporary )
27453 + m_xUICfgPers->store();
27457 +::rtl::OUString SAL_CALL
27458 +ScVbaCommandBarControl::getCaption() throw ( uno::RuntimeException )
27460 + // "Label" always empty
27461 + rtl::OUString sCaption;
27462 + beans::PropertyValues aPropertyValues;
27463 + if( m_xCurrentSettings.is() )
27465 + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
27466 + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
27468 + else if( m_xBarSettings.is() )
27470 + m_xBarSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
27471 + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label") ) >>= sCaption;
27476 +ScVbaCommandBarControl::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
27478 + if( m_xCurrentSettings.is() )
27480 + beans::PropertyValues aPropertyValues;
27481 + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
27482 + beans::PropertyValues aNewPropertyValues;
27483 + aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( _caption ) );
27484 + m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
27485 + if( m_xUICfgManager->hasSettings( m_sBarName ) )
27487 + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27491 + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27493 + // make it permanent
27494 + if( !m_bTemporary )
27496 + m_xUICfgPers->store();
27500 +::rtl::OUString SAL_CALL
27501 +ScVbaCommandBarControl::getOnAction() throw (uno::RuntimeException)
27503 + if( m_xCurrentSettings.is() )
27505 + beans::PropertyValues aPropertyValues;
27506 + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
27507 + rtl::OUString sCommandURL;
27508 + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL;
27509 + return sCommandURL;
27511 + return ::rtl::OUString();
27514 +ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
27516 + if( m_xCurrentSettings.is() )
27518 + // convert the comand url into something like vnd.sun.star.script:Standard.testMacro.Macro1?language=Basic&location=document
27519 + rtl::OUString aCommandURL;
27520 + rtl::OUString sScheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
27521 + SbModule* pModule = StarBASIC::GetActiveModule();
27524 + String sTmp = _onaction;
27525 + if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pModule->Find( sTmp, SbxCLASS_METHOD ) ) )
27529 + sTmp.Insert( '.', 0 ).Insert( pModule->GetName(), 0 ).Insert( '.', 0 ).Insert( pModule->GetParent()->GetName(), 0 );
27533 + rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
27534 + aCommandURL = sScheme.concat( sTmp ).concat( sUrlPart2 );
27535 + OSL_TRACE("**** METHOD IS %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
27539 + aCommandURL = _onaction;
27541 + OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
27542 + beans::PropertyValues aPropertyValues;
27543 + m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
27544 + beans::PropertyValues aNewPropertyValues;
27545 + aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
27546 + m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
27547 + if( m_xUICfgManager->hasSettings( m_sBarName ) )
27549 + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27553 + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27555 + // make it permanent
27556 + if( !m_bTemporary )
27558 + m_xUICfgPers->store();
27562 +::sal_Bool SAL_CALL
27563 +ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
27565 + // not possible in UNO?
27569 +ScVbaCommandBarControl::setVisible( ::sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
27574 +ScVbaCommandBarControl::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
27576 + if( m_xCurrentSettings.is() )
27578 + m_xCurrentSettings->removeByIndex( m_nPosition );
27580 + if( m_xUICfgManager->hasSettings( m_sBarName ) )
27582 + m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27586 + m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
27588 + // make it permanent
27589 + if( !m_bTemporary )
27591 + m_xUICfgPers->store();
27596 +ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
27598 + sal_Int32 nIndex;
27599 + uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
27600 + if( aIndex.hasValue() )
27602 + if( aIndex >>= nIndex )
27604 + uno::Reference< XCommandBarControl > xCommandBarControl( xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
27605 + return uno::makeAny( xCommandBarControl );
27608 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "invalid index" ), uno::Reference< uno::XInterface >() );
27610 + return uno::makeAny( xCommandBarControls );
27613 +ScVbaCommandBarControl::getServiceImplName()
27615 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") );
27616 + return sImplName;
27618 +uno::Sequence<rtl::OUString>
27619 +ScVbaCommandBarControl::getServiceNames()
27621 + static uno::Sequence< rtl::OUString > aServiceNames;
27622 + if ( aServiceNames.getLength() == 0 )
27624 + aServiceNames.realloc( 1 );
27625 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControl" ) );
27627 + return aServiceNames;
27630 +//////////// ScVbaCommandBarPopup //////////////////////////////
27631 +ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
27635 +ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup)
27640 +ScVbaCommandBarPopup::getServiceImplName()
27642 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarPopup") );
27643 + return sImplName;
27645 +uno::Sequence<rtl::OUString>
27646 +ScVbaCommandBarPopup::getServiceNames()
27648 + static uno::Sequence< rtl::OUString > aServiceNames;
27649 + if ( aServiceNames.getLength() == 0 )
27651 + aServiceNames.realloc( 1 );
27652 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarPopup" ) );
27654 + return aServiceNames;
27657 +//////////// ScVbaCommandBarButton //////////////////////////////
27658 +ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
27662 +ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
27667 +ScVbaCommandBarButton::getServiceImplName()
27669 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarButton") );
27670 + return sImplName;
27672 +uno::Sequence<rtl::OUString>
27673 +ScVbaCommandBarButton::getServiceNames()
27675 + static uno::Sequence< rtl::OUString > aServiceNames;
27676 + if ( aServiceNames.getLength() == 0 )
27678 + aServiceNames.realloc( 1 );
27679 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarButton" ) );
27681 + return aServiceNames;
27683 --- vbahelper/source/vbahelper/vbacommandbarcontrol.hxx.old 1970-01-01 00:00:00.000000000 +0000
27684 +++ vbahelper/source/vbahelper/vbacommandbarcontrol.hxx 2009-04-06 16:42:01.000000000 +0000
27686 +/*************************************************************************
27688 + * OpenOffice.org - a multi-platform office productivity suite
27694 + * last change: $Author$ $Date$
27696 + * The Contents of this file are made available subject to
27697 + * the terms of GNU Lesser General Public License Version 2.1.
27700 + * GNU Lesser General Public License Version 2.1
27701 + * =============================================
27702 + * Copyright 2005 by Sun Microsystems, Inc.
27703 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
27705 + * This library is free software; you can redistribute it and/or
27706 + * modify it under the terms of the GNU Lesser General Public
27707 + * License version 2.1, as published by the Free Software Foundation.
27709 + * This library is distributed in the hope that it will be useful,
27710 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27711 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27712 + * Lesser General Public License for more details.
27714 + * You should have received a copy of the GNU Lesser General Public
27715 + * License along with this library; if not, write to the Free Software
27716 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27717 + * MA 02111-1307 USA
27719 + ************************************************************************/
27720 +#ifndef SC_VBA_COMMANDBARCONTROL_HXX
27721 +#define SC_VBA_COMMANDBARCONTROL_HXX
27723 +#include <ooo/vba/XCommandBarControl.hpp>
27724 +#include <ooo/vba/XCommandBarPopup.hpp>
27725 +#include <ooo/vba/XCommandBarButton.hpp>
27726 +#include <ooo/vba/office/MsoControlType.hpp>
27728 +#include <vbahelper/vbahelperinterface.hxx>
27729 +#include "vbacommandbarcontrols.hxx"
27731 +typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE;
27733 +class ScVbaCommandBarControl : public CommandBarControl_BASE
27736 + rtl::OUString m_sName;
27737 + rtl::OUString m_sBarName;
27738 + rtl::OUString m_sCommand;
27739 + sal_Int32 m_nType;
27740 + sal_Int32 m_nPosition;
27741 + sal_Bool m_bTemporary;
27742 + sal_Bool m_bIsMenu;
27743 + ScVbaCommandBarControls* m_pCommandBarControls;
27744 + css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
27745 + css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager;
27746 + css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers;
27747 + css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
27748 + css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
27749 + css::beans::PropertyValues m_aPropertyValues;
27751 + void initObjects() throw (css::uno::RuntimeException);
27752 + void createNewMenuBarControl();
27753 + void createNewToolBarControl();
27755 + ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
27756 + ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
27757 + css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
27758 + css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
27759 + css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; };
27760 + sal_Bool IsMenu() { return m_bIsMenu; };
27761 + sal_Int32 GetPosition() { return m_nPosition; };
27762 + css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; };
27763 + css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; };
27764 + void SetPropertyValues( css::beans::PropertyValues aPropertyValues ) { m_aPropertyValues = aPropertyValues; };
27767 + virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
27768 + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException);
27769 + virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
27770 + virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
27771 + virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
27772 + virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
27775 + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
27776 + virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
27778 + // XHelperInterface
27779 + virtual rtl::OUString& getServiceImplName();
27780 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
27783 +typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE;
27784 +class ScVbaCommandBarPopup : public CommandBarPopup_BASE
27787 + ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
27788 + ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
27789 + // XHelperInterface
27790 + virtual rtl::OUString& getServiceImplName();
27791 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
27794 +typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE;
27795 +class ScVbaCommandBarButton : public CommandBarButton_BASE
27798 + ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
27799 + ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
27800 + // XHelperInterface
27801 + virtual rtl::OUString& getServiceImplName();
27802 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
27805 +#endif//SC_VBA_COMMANDBARCONTROL_HXX
27806 --- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx.old 1970-01-01 00:00:00.000000000 +0000
27807 +++ vbahelper/source/vbahelper/vbacommandbarcontrols.cxx 2009-04-06 16:42:01.000000000 +0000
27809 +/*************************************************************************
27811 + * OpenOffice.org - a multi-platform office productivity suite
27817 + * last change: $Author$ $Date$
27819 + * The Contents of this file are made available subject to
27820 + * the terms of GNU Lesser General Public License Version 2.1.
27823 + * GNU Lesser General Public License Version 2.1
27824 + * =============================================
27825 + * Copyright 2005 by Sun Microsystems, Inc.
27826 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
27828 + * This library is free software; you can redistribute it and/or
27829 + * modify it under the terms of the GNU Lesser General Public
27830 + * License version 2.1, as published by the Free Software Foundation.
27832 + * This library is distributed in the hope that it will be useful,
27833 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27834 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27835 + * Lesser General Public License for more details.
27837 + * You should have received a copy of the GNU Lesser General Public
27838 + * License along with this library; if not, write to the Free Software
27839 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27840 + * MA 02111-1307 USA
27842 + ************************************************************************/
27843 +#include "vbacommandbarcontrols.hxx"
27844 +#include "vbacommandbarcontrol.hxx"
27846 +using namespace com::sun::star;
27847 +using namespace ooo::vba;
27849 +uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
27851 +typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE;
27852 +class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
27854 + //uno::Reference< uno::XComponentContext > m_xContext;
27855 + ScVbaCommandBarControls* m_pCommandBarControls;
27856 + sal_Int32 m_nCurrentPosition;
27858 + CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {}
27859 + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
27861 + if( m_nCurrentPosition < m_pCommandBarControls->getCount() )
27863 + return sal_False;
27865 + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
27867 + if( hasMoreElements() )
27869 + rtl::OUString sName = m_pCommandBarControls->GetControlNameByIndex( m_nCurrentPosition );
27870 + m_nCurrentPosition = m_nCurrentPosition + 1;
27871 + if( sName.getLength() > 0 )
27872 + return m_pCommandBarControls->createCollectionObject( uno::makeAny( sName ) );
27874 + return nextElement();
27877 + throw container::NoSuchElementException();
27881 +ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess )
27883 + m_bIsMenu = sal_False;
27884 + m_bHasElements = sal_False;
27885 + m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
27886 + m_pCommandBar = dynamic_cast< ScVbaCommandBar* >( m_xParentHardRef.get() );
27887 + m_pCommandBarControl = dynamic_cast< ScVbaCommandBarControl* >( m_xParentHardRef.get() );
27888 + if( m_pCommandBar )
27890 + m_xUICfgManager.set( m_pCommandBar->GetUICfgManager(), uno::UNO_QUERY_THROW );
27891 + m_xUICfgPers.set( m_pCommandBar->GetUICfgPers(), uno::UNO_QUERY_THROW );
27892 + m_xBarSettings.set( m_pCommandBar->GetBarSettings(), uno::UNO_QUERY_THROW );
27893 + m_bIsMenu = m_pCommandBar->IsMenu();
27894 + if( m_xBarSettings->hasElements() )
27896 + m_bHasElements = sal_True;
27899 + else if( m_pCommandBarControl )
27901 + m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
27902 + m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
27903 + beans::PropertyValues aPropertyValues;
27904 + m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
27905 + m_pCommandBarControl->SetPropertyValues( aPropertyValues );
27906 + m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
27908 + uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
27909 + if( aValue.hasValue() )
27911 + m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
27912 + m_bHasElements = sal_True;
27916 + m_bHasElements = sal_False;
27918 + m_bIsMenu = m_pCommandBarControl->IsMenu();
27922 + throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() );
27926 +ScVbaCommandBarControls::GetControlNameByIndex( const sal_Int32 nIndex ) throw ( uno::RuntimeException )
27928 + sal_Int32 nCount = 0;
27929 + if( m_bHasElements )
27931 + sal_Int32 nBarSettingsCount = m_xBarSettings->getCount();
27932 + for( sal_Int32 i = 0; i < nBarSettingsCount; i++ )
27934 + beans::PropertyValues aMenuValues;
27935 + m_xBarSettings->getByIndex( i ) >>= aMenuValues;
27936 + for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ )
27938 + if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) )
27941 + if( nIndex == nCount )
27943 + rtl::OUString sCommandURL;
27944 + aMenuValues[j].Value >>= sCommandURL;
27945 + sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") );
27946 + if( ( nLastIndex != -1 ) && ( ( nLastIndex +1 ) < sCommandURL.getLength() ) )
27948 + sCommandURL = sCommandURL.copy( nLastIndex + 1 );
27949 + return sCommandURL;
27957 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Out of bound" ), uno::Reference< uno::XInterface >() );
27958 + return rtl::OUString();
27962 +sal_Int32 SAL_CALL
27963 +ScVbaCommandBarControls::getCount() throw (uno::RuntimeException)
27965 + sal_Int32 nCount = 0;
27966 + if( m_bHasElements )
27968 + sal_Int32 nBarSettingsCount = m_xBarSettings->getCount();
27969 + for( sal_Int32 i = 0; i < nBarSettingsCount; i++ )
27971 + beans::PropertyValues aMenuValues;
27972 + m_xBarSettings->getByIndex( i ) >>= aMenuValues;
27973 + for( sal_Int32 j = 0; j < aMenuValues.getLength(); j++ )
27975 + if( aMenuValues[j].Name.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii( "CommandURL" ) ) )
27984 +// XEnumerationAccess
27985 +uno::Type SAL_CALL
27986 +ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException )
27988 + return XCommandBarControls::static_type( 0 );
27990 +uno::Reference< container::XEnumeration >
27991 +ScVbaCommandBarControls::createEnumeration() throw ( uno::RuntimeException )
27993 + return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) );
27996 +ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource )
27998 + // only surport the aSource as a name string, because this class is a API wrapper
27999 + rtl::OUString sName;
28000 + if( aSource >>= sName )
28002 + uno::Reference< container::XIndexContainer > xCurrentSettings;
28003 + beans::PropertyValues aPropertyValues;
28004 + if( m_pCommandBarControl )
28006 + m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
28007 + xCurrentSettings.set( lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY );
28008 + if( !xCurrentSettings.is() )
28010 + xCurrentSettings.set( m_xUICfgManager->getSettings( GetParentToolBarName(), sal_True ), uno::UNO_QUERY );
28014 + sal_Int32 nPosition = -1;
28015 + for( sal_Int32 i = 0; i < xCurrentSettings->getCount(); i++ )
28017 + xCurrentSettings->getByIndex( i ) >>= aPropertyValues;
28018 + // Label always empty in OOo
28019 + rtl::OUString sLabel;
28020 + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
28021 + if( sLabel.equalsIgnoreAsciiCase( sName ) )
28026 + // using CammandURL to find
28027 + rtl::OUString sCommandURL;
28028 + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "CommandURL" ) ) >>= sCommandURL;
28029 + sal_Int32 nLastIndex = sCommandURL.lastIndexOf( rtl::OUString::createFromAscii(":") );
28030 + if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sCommandURL.getLength() ) )
28032 + sCommandURL = sCommandURL.copy( nLastIndex + 1 );
28034 + if( sCommandURL.equalsIgnoreAsciiCase( sName ) )
28041 + if( nPosition != -1 )
28043 + uno::Reference< container::XIndexContainer > xSubMenu;
28044 + lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ) >>= xSubMenu;
28045 + ScVbaCommandBarControl* pNewCommandBarControl = NULL;
28046 + if( xSubMenu.is() )
28047 + pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sName, nPosition );
28049 + pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sName, nPosition );
28051 + return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
28054 + throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
28057 + return uno::Any();
28062 +ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException)
28064 + if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
28066 + return createCollectionObject( aIndex );
28068 + sal_Int32 nIndex = 0;
28069 + if( aIndex >>= nIndex )
28071 + return createCollectionObject( uno::makeAny( GetControlNameByIndex( nIndex ) ) );
28074 + return uno::Any();
28076 +uno::Reference< XCommandBarControl > SAL_CALL
28077 +ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const uno::Any& /*Parameter*/, const uno::Any& Before, const uno::Any& Temporary ) throw (script::BasicErrorException, uno::RuntimeException)
28079 + // Parameter is not supported
28080 + // the following name needs to be individually created;
28081 + rtl::OUString sCaption( rtl::OUString::createFromAscii("custom Control") );
28082 + rtl::OUString sCommand( rtl::OUString::createFromAscii("macro:///Standard.Module1.Test()") );
28083 + sal_Int32 nType =0;
28084 + sal_Int32 nPosition = 0;
28086 + sal_Bool bTemporary = sal_True;
28088 + if( Type.hasValue() )
28089 + if( Type >>= nType )
28091 + // evalute the type of the new control
28093 + if( Id.hasValue() )
28096 + // evalute the action of the new control
28098 + if( Before.hasValue() )
28099 + Before >>= nPosition;
28102 + // if Before is ignore, the new control should be placed at the end of the commandbars;
28103 + if( m_pCommandBar )
28104 + nPosition = getCount();
28105 + else if ( m_pCommandBarControl )
28107 + css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
28108 + xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
28109 + if( xCurrentSettings.is() )
28111 + nPosition = xCurrentSettings->getCount();
28115 + if( Temporary.hasValue() )
28116 + if( Temporary >>= bTemporary )
28118 + // evalute the temporary of the new Control
28121 + ScVbaCommandBarControl* pNewCommandBarControl = NULL;
28122 + if( nType == office::MsoControlType::msoControlButton )
28124 + pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sCaption, nPosition, bTemporary );
28126 + else if ( nType == office::MsoControlType::msoControlPopup )
28128 + pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sCaption, nPosition, bTemporary );
28132 + pNewCommandBarControl = new ScVbaCommandBarControl( this, mxContext, sCaption, nPosition, bTemporary );
28135 + return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
28138 +// XHelperInterface
28140 +ScVbaCommandBarControls::getServiceImplName()
28142 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") );
28143 + return sImplName;
28145 +uno::Sequence<rtl::OUString>
28146 +ScVbaCommandBarControls::getServiceNames()
28148 + static uno::Sequence< rtl::OUString > aServiceNames;
28149 + if ( aServiceNames.getLength() == 0 )
28151 + aServiceNames.realloc( 1 );
28152 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControls" ) );
28154 + return aServiceNames;
28157 --- vbahelper/source/vbahelper/vbacommandbarcontrols.hxx.old 1970-01-01 00:00:00.000000000 +0000
28158 +++ vbahelper/source/vbahelper/vbacommandbarcontrols.hxx 2009-04-06 16:42:01.000000000 +0000
28160 +/*************************************************************************
28162 + * OpenOffice.org - a multi-platform office productivity suite
28168 + * last change: $Author$ $Date$
28170 + * The Contents of this file are made available subject to
28171 + * the terms of GNU Lesser General Public License Version 2.1.
28174 + * GNU Lesser General Public License Version 2.1
28175 + * =============================================
28176 + * Copyright 2005 by Sun Microsystems, Inc.
28177 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
28179 + * This library is free software; you can redistribute it and/or
28180 + * modify it under the terms of the GNU Lesser General Public
28181 + * License version 2.1, as published by the Free Software Foundation.
28183 + * This library is distributed in the hope that it will be useful,
28184 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
28185 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28186 + * Lesser General Public License for more details.
28188 + * You should have received a copy of the GNU Lesser General Public
28189 + * License along with this library; if not, write to the Free Software
28190 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28191 + * MA 02111-1307 USA
28193 + ************************************************************************/
28194 +#ifndef SC_VBA_COMMANDBARCONTROLS_HXX
28195 +#define SC_VBA_COMMANDBARCONTROLS_HXX
28197 +#include <ooo/vba/XCommandBarControls.hpp>
28199 +#include <vbahelper/vbahelperinterface.hxx>
28200 +#include "vbacommandbar.hxx"
28201 +#include <vbahelper/vbacollectionimpl.hxx>
28203 +class ScVbaCommandBarControl;
28205 +typedef CollTestImplHelper< ov::XCommandBarControls > CommandBarControls_BASE;
28207 +class ScVbaCommandBarControls : public CommandBarControls_BASE
28210 + sal_Bool m_bIsMenu;
28211 + sal_Bool m_bHasElements;
28212 + ScVbaCommandBar* m_pCommandBar;
28213 + ScVbaCommandBarControl* m_pCommandBarControl;
28214 + css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
28215 + css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgManager;
28216 + css::uno::Reference< css::ui::XUIConfigurationPersistence > m_xUICfgPers;
28217 + css::uno::Reference< css::container::XIndexContainer > m_xBarSettings;
28218 + css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
28221 + ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess ) throw( css::uno::RuntimeException );
28222 + css::uno::Reference< css::ui::XUIConfigurationManager > GetUICfgManager() { return m_xUICfgManager; };
28223 + css::uno::Reference< css::ui::XUIConfigurationPersistence > GetUICfgPers() { return m_xUICfgPers; };
28224 + css::uno::Reference< css::container::XIndexContainer > GetBarSettings() { return m_xBarSettings; };
28225 + sal_Bool IsMenu() { return m_bIsMenu; };
28226 + ScVbaCommandBar* GetParentCommandBar() { return m_pCommandBar; };
28227 + ScVbaCommandBarControl* GetParentCommandBarControl() { return m_pCommandBarControl; };
28228 + rtl::OUString GetParentToolBarName()
28230 + if( m_pCommandBar ) return m_pCommandBar->GetToolBarName();
28231 + else return rtl::OUString();
28233 + rtl::OUString GetControlNameByIndex( const sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
28236 + virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
28237 + // XEnumerationAccess
28238 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
28239 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
28240 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
28243 + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
28244 + virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
28245 + // XHelperInterface
28246 + virtual rtl::OUString& getServiceImplName();
28247 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
28250 +#endif//SC_VBA_COMMANDBARCONTROLS_HXX
28251 --- vbahelper/source/vbahelper/vbacommandbars.cxx.old 1970-01-01 00:00:00.000000000 +0000
28252 +++ vbahelper/source/vbahelper/vbacommandbars.cxx 2009-04-06 16:42:01.000000000 +0000
28254 +/*************************************************************************
28256 + * OpenOffice.org - a multi-platform office productivity suite
28262 + * last change: $Author$ $Date$
28264 + * The Contents of this file are made available subject to
28265 + * the terms of GNU Lesser General Public License Version 2.1.
28268 + * GNU Lesser General Public License Version 2.1
28269 + * =============================================
28270 + * Copyright 2005 by Sun Microsystems, Inc.
28271 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
28273 + * This library is free software; you can redistribute it and/or
28274 + * modify it under the terms of the GNU Lesser General Public
28275 + * License version 2.1, as published by the Free Software Foundation.
28277 + * This library is distributed in the hope that it will be useful,
28278 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
28279 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28280 + * Lesser General Public License for more details.
28282 + * You should have received a copy of the GNU Lesser General Public
28283 + * License along with this library; if not, write to the Free Software
28284 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28285 + * MA 02111-1307 USA
28287 + ************************************************************************/
28288 +#include <com/sun/star/lang/XServiceInfo.hpp>
28289 +#include <com/sun/star/frame/XDesktop.hpp>
28290 +#include <com/sun/star/container/XNameAccess.hpp>
28292 +#include "vbacommandbars.hxx"
28293 +#include "vbacommandbar.hxx"
28295 +using namespace com::sun::star;
28296 +using namespace ooo::vba;
28298 +typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE;
28300 +static rtl::OUString sSpreadsheetDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
28301 +static rtl::OUString sTextDocumentUrl( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) );
28302 +static rtl::OUString sWindowStateConfUrl( rtl::OUString::createFromAscii( "com.sun.star.ui.WindowStateConfiguration" ) );
28304 +class CommandBarEnumeration : public CommandBarEnumeration_BASE
28306 + uno::Reference< uno::XComponentContext > m_xContext;
28307 + uno::Reference< XCommandBars > m_xCommandBars;
28308 + uno::Sequence< rtl::OUString > m_sNames;
28309 + sal_Int32 m_nCurrentPosition;
28311 + CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 )
28314 + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
28316 + if( m_nCurrentPosition < m_sNames.getLength() )
28318 + return sal_False;
28320 + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
28322 + if( hasMoreElements() )
28324 + rtl::OUString sName( m_sNames[ m_nCurrentPosition ] );
28325 + m_nCurrentPosition = m_nCurrentPosition + 1;
28326 + if( sName.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
28328 + sal_Int32 nLastIndex = sName.lastIndexOf( rtl::OUString::createFromAscii( "/" ) );
28329 + if( ( nLastIndex != -1 ) && ( ( nLastIndex + 1 ) < sName.getLength() ) )
28331 + sName = sName.copy( nLastIndex + 1);
28332 + if( sName.getLength() > 0 )
28334 + uno::Reference< XHelperInterface > xHelperInterface( m_xCommandBars, uno::UNO_QUERY_THROW );
28335 + uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( xHelperInterface, m_xContext, sName, sal_True, sal_False ) );
28336 + if( xCommandBar.is() )
28337 + return uno::makeAny( xCommandBar );
28339 + return nextElement();
28342 + return nextElement();
28346 + return nextElement();
28349 + throw container::NoSuchElementException();
28350 + return uno::Any();
28355 +ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess ) : CommandBars_BASE( xParent, xContext, xIndexAccess )
28357 + retrieveObjects();
28360 +ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException )
28362 + uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW );
28363 + if( xServiceInfo->supportsService( sSpreadsheetDocumentUrl ) )
28365 + m_sModuleName = sSpreadsheetDocumentUrl;
28367 + else if( xServiceInfo->supportsService( sTextDocumentUrl ) )
28369 + m_sModuleName = sTextDocumentUrl;
28372 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Unsupported Document" ), uno::Reference< uno::XInterface >() );
28374 + uno::Reference < lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
28375 + uno::Reference < container::XNameAccess > xNameAccess( xMSF->createInstance( sWindowStateConfUrl ), uno::UNO_QUERY_THROW );
28376 + m_xNameAccess.set( xNameAccess->getByName( m_sModuleName ), uno::UNO_QUERY_THROW );
28379 +// XEnumerationAccess
28380 +uno::Type SAL_CALL
28381 +ScVbaCommandBars::getElementType() throw ( uno::RuntimeException )
28383 + return XCommandBars::static_type( 0 );
28385 +uno::Reference< container::XEnumeration >
28386 +ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException )
28388 + return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames() ) );
28392 +ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
28394 + // aSource should be a name at this time, because of the class is API wrapper.
28395 + rtl::OUString sToolBarName;
28396 + if( aSource >>= sToolBarName )
28398 + sToolBarName = sToolBarName.toAsciiLowerCase();
28399 + if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) )
28401 + return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) ) );
28403 + else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
28405 + return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) ) );
28407 + else if( checkToolBarExist( sToolBarName ) )
28409 + return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) ) );
28412 + return uno::Any();
28416 +uno::Reference< XCommandBar > SAL_CALL
28417 +ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Position*/, const css::uno::Any& /*MenuBar*/, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
28419 + // Position - MsoBar MenuBar - sal_Bool
28420 + // Currently only the Name is supported.
28421 + rtl::OUString sName;
28422 + if( !( Name >>= sName ) )
28424 + sName = rtl::OUString::createFromAscii("Custom1");
28426 + sal_Bool bTemporary = false;
28427 + if( !( Temporary >>= bTemporary ) )
28429 + bTemporary = sal_True;
28431 + return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, sName.toAsciiLowerCase(), bTemporary, sal_True ) );
28433 +sal_Int32 SAL_CALL
28434 +ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
28436 + // Filter out all toolbars from the window collection
28437 + sal_Int32 nCount = 0;
28438 + uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
28439 + for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
28441 + if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
28449 +// ScVbaCollectionBaseImpl
28451 +ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
28453 + if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
28455 + return createCollectionObject( aIndex );
28458 + // hardcode if "aIndex = 1" that would return "main menu".
28459 + sal_Int16 nIndex = 0;
28460 + aIndex >>= nIndex;
28461 + if( nIndex == 1 )
28463 + uno::Any aSource;
28464 + if( m_sModuleName.equalsIgnoreAsciiCase( sSpreadsheetDocumentUrl ) )
28465 + aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
28466 + else if( m_sModuleName.equalsIgnoreAsciiCase( sTextDocumentUrl ) )
28467 + aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
28468 + if( aSource.hasValue() )
28469 + return createCollectionObject( aSource );
28471 + return uno::Any();
28475 +ScVbaCommandBars::checkToolBarExist( rtl::OUString sToolBarName )
28477 + CommandBarNameMap::const_iterator iter = mCommandBarNameMap.find( sToolBarName.toAsciiLowerCase() );
28478 + if( iter != mCommandBarNameMap.end() )
28482 + uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
28483 + for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
28485 + if(allNames[i].indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
28487 + if( allNames[i].indexOf( sToolBarName ) != -1 )
28493 + return sal_False;
28496 +// XHelperInterface
28498 +ScVbaCommandBars::getServiceImplName()
28500 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBars") );
28501 + return sImplName;
28503 +uno::Sequence<rtl::OUString>
28504 +ScVbaCommandBars::getServiceNames()
28506 + static uno::Sequence< rtl::OUString > aServiceNames;
28507 + if ( aServiceNames.getLength() == 0 )
28509 + aServiceNames.realloc( 1 );
28510 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBars" ) );
28512 + return aServiceNames;
28515 --- vbahelper/source/vbahelper/vbacommandbars.hxx.old 1970-01-01 00:00:00.000000000 +0000
28516 +++ vbahelper/source/vbahelper/vbacommandbars.hxx 2009-04-06 16:42:01.000000000 +0000
28518 +/*************************************************************************
28520 + * OpenOffice.org - a multi-platform office productivity suite
28526 + * last change: $Author$ $Date$
28528 + * The Contents of this file are made available subject to
28529 + * the terms of GNU Lesser General Public License Version 2.1.
28532 + * GNU Lesser General Public License Version 2.1
28533 + * =============================================
28534 + * Copyright 2005 by Sun Microsystems, Inc.
28535 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
28537 + * This library is free software; you can redistribute it and/or
28538 + * modify it under the terms of the GNU Lesser General Public
28539 + * License version 2.1, as published by the Free Software Foundation.
28541 + * This library is distributed in the hope that it will be useful,
28542 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
28543 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28544 + * Lesser General Public License for more details.
28546 + * You should have received a copy of the GNU Lesser General Public
28547 + * License along with this library; if not, write to the Free Software
28548 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28549 + * MA 02111-1307 USA
28551 + ************************************************************************/
28552 +#ifndef SC_VBA_COMMANDBARS_HXX
28553 +#define SC_VBA_COMMANDBARS_HXX
28555 +#include <ooo/vba/XCommandBar.hpp>
28556 +#include <ooo/vba/XCommandBars.hpp>
28557 +#include <com/sun/star/container/XNameAccess.hpp>
28559 +#include <cppuhelper/implbase1.hxx>
28561 +#include <vbahelper/vbahelperinterface.hxx>
28562 +#include <vbahelper/vbacollectionimpl.hxx>
28564 +typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE;
28566 +class ScVbaCommandBars : public CommandBars_BASE
28569 + css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
28570 + rtl::OUString m_sModuleName;
28571 + void retrieveObjects() throw( css::uno::RuntimeException );
28573 + ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess );
28575 + sal_Bool checkToolBarExist( rtl::OUString sToolBarName );
28576 + rtl::OUString GetModuleName(){ return m_sModuleName; };
28577 + css::uno::Reference< css::container::XNameAccess > GetWindows()
28579 + retrieveObjects();
28580 + return m_xNameAccess;
28583 + virtual css::uno::Reference< ov::XCommandBar > SAL_CALL Add( const css::uno::Any& Name, const css::uno::Any& Position, const css::uno::Any& MenuBar, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
28584 + // XEnumerationAccess
28585 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
28586 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
28587 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
28589 + virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
28590 + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException);
28591 + // XHelperInterface
28592 + virtual rtl::OUString& getServiceImplName();
28593 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
28596 +#endif//SC_VBA_COMMANDBARS_HXX
28597 --- vbahelper/source/vbahelper/vbadocumentbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
28598 +++ vbahelper/source/vbahelper/vbadocumentbase.cxx 2009-04-06 16:42:01.000000000 +0000
28600 +/*************************************************************************
28602 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28604 + * Copyright 2008 by Sun Microsystems, Inc.
28606 + * OpenOffice.org - a multi-platform office productivity suite
28611 + * This file is part of OpenOffice.org.
28613 + * OpenOffice.org is free software: you can redistribute it and/or modify
28614 + * it under the terms of the GNU Lesser General Public License version 3
28615 + * only, as published by the Free Software Foundation.
28617 + * OpenOffice.org is distributed in the hope that it will be useful,
28618 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
28619 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28620 + * GNU Lesser General Public License version 3 for more details
28621 + * (a copy is included in the LICENSE file that accompanied this code).
28623 + * You should have received a copy of the GNU Lesser General Public License
28624 + * version 3 along with OpenOffice.org. If not, see
28625 + * <http://www.openoffice.org/license.html>
28626 + * for a copy of the LGPLv3 License.
28628 + ************************************************************************/
28629 +#include <vbahelper/vbadocumentbase.hxx>
28630 +#include <vbahelper/helperdecl.hxx>
28631 +#include <comphelper/unwrapargs.hxx>
28633 +#include <com/sun/star/util/XModifiable.hpp>
28634 +#include <com/sun/star/util/XProtectable.hpp>
28635 +#include <com/sun/star/util/XCloseable.hpp>
28636 +#include <com/sun/star/frame/XStorable.hpp>
28637 +#include <com/sun/star/frame/XFrame.hpp>
28638 +#include <com/sun/star/beans/XPropertySet.hpp>
28640 +#include <tools/urlobj.hxx>
28641 +#include <osl/file.hxx>
28643 +using namespace ::com::sun::star;
28644 +using namespace ::ooo::vba;
28646 +VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) :VbaDocumentBase_BASE( xParent, xContext ), mxModel(NULL)
28650 +VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ) : VbaDocumentBase_BASE( xParent, xContext ), mxModel( xModel )
28654 +VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args,
28655 + uno::Reference< uno::XComponentContext> const & xContext ) : VbaDocumentBase_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
28660 +VbaDocumentBase::getName() throw (uno::RuntimeException)
28662 + rtl::OUString sName = getModel()->getURL();
28663 + if ( sName.getLength() )
28666 + INetURLObject aURL( getModel()->getURL() );
28667 + ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
28671 + const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) );
28672 + // process "UntitledX - $(PRODUCTNAME)"
28673 + uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
28674 + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
28675 + xProps->getPropertyValue(sTitle ) >>= sName;
28676 + sal_Int32 pos = 0;
28677 + sName = sName.getToken(0,' ',pos);
28682 +VbaDocumentBase::getPath() throw (uno::RuntimeException)
28684 + INetURLObject aURL( getModel()->getURL() );
28685 + aURL.CutLastName();
28686 + return aURL.GetURLPath();
28690 +VbaDocumentBase::getFullName() throw (uno::RuntimeException)
28692 + INetURLObject aURL( getModel()->getURL() );
28693 + return aURL.GetURLPath();
28696 +VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
28697 + const uno::Any &rRouteArg ) throw (uno::RuntimeException)
28699 + sal_Bool bSaveChanges = sal_False;
28700 + rtl::OUString aFileName;
28701 + sal_Bool bRouteWorkbook = sal_True;
28703 + rSaveArg >>= bSaveChanges;
28704 + sal_Bool bFileName = ( rFileArg >>= aFileName );
28705 + rRouteArg >>= bRouteWorkbook;
28706 + uno::Reference< frame::XStorable > xStorable( getModel(), uno::UNO_QUERY_THROW );
28707 + uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
28709 + if( bSaveChanges )
28711 + if( xStorable->isReadonly() )
28713 + throw uno::RuntimeException(::rtl::OUString(
28714 + RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ),
28715 + uno::Reference< XInterface >() );
28718 + xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) );
28720 + xStorable->store();
28723 + xModifiable->setModified( false );
28725 + uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY );
28727 + if( xCloseable.is() )
28728 + // use close(boolean DeliverOwnership)
28730 + // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may
28731 + // assume ownership if they object the closure by throwing a CloseVetoException
28732 + // Here we give up ownership. To be on the safe side, catch possible veto exception anyway.
28733 + xCloseable->close(sal_True);
28734 + // If close is not supported by this model - try to dispose it.
28735 + // But if the model disagree with a reset request for the modify state
28736 + // we shouldn't do so. Otherwhise some strange things can happen.
28739 + uno::Reference< lang::XComponent > xDisposable ( getCurrentDocument(), uno::UNO_QUERY );
28740 + if ( xDisposable.is() )
28741 + xDisposable->dispose();
28746 +VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
28748 + rtl::OUString rPassword;
28749 + uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
28750 + SC_VBA_FIXME(("Workbook::Protect stub"));
28751 + if( aPassword >>= rPassword )
28752 + xProt->protect( rPassword );
28754 + xProt->protect( rtl::OUString() );
28758 +VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
28760 + rtl::OUString rPassword;
28761 + uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
28762 + if( !xProt->isProtected() )
28763 + throw uno::RuntimeException(::rtl::OUString(
28764 + RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ),
28765 + uno::Reference< XInterface >() );
28768 + if( aPassword >>= rPassword )
28769 + xProt->unprotect( rPassword );
28771 + xProt->unprotect( rtl::OUString() );
28776 +VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
28778 + uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
28779 + xModifiable->setModified( bSave );
28783 +VbaDocumentBase::getSaved() throw (uno::RuntimeException)
28785 + uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
28786 + return xModifiable->isModified();
28790 +VbaDocumentBase::Save() throw (uno::RuntimeException)
28792 + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save"));
28793 + uno::Reference< frame::XModel > xModel = getModel();
28794 + dispatchRequests(xModel,url);
28798 +VbaDocumentBase::Activate() throw (uno::RuntimeException)
28800 + uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
28801 + xFrame->activate();
28805 +VbaDocumentBase::getServiceImplName()
28807 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDocumentBase") );
28808 + return sImplName;
28811 +uno::Sequence< rtl::OUString >
28812 +VbaDocumentBase::getServiceNames()
28814 + static uno::Sequence< rtl::OUString > aServiceNames;
28815 + if ( aServiceNames.getLength() == 0 )
28817 + aServiceNames.realloc( 1 );
28818 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaDocumentBase" ) );
28820 + return aServiceNames;
28823 --- vbahelper/source/vbahelper/vbaglobalbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
28824 +++ vbahelper/source/vbahelper/vbaglobalbase.cxx 2009-04-06 16:42:01.000000000 +0000
28826 +/*************************************************************************
28828 + * OpenOffice.org - a multi-platform office productivity suite
28834 + * last change: $Author$ $Date$
28836 + * The Contents of this file are made available subject to
28837 + * the terms of GNU Lesser General Public License Version 2.1.
28840 + * GNU Lesser General Public License Version 2.1
28841 + * =============================================
28842 + * Copyright 2005 by Sun Microsystems, Inc.
28843 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
28845 + * This library is free software; you can redistribute it and/or
28846 + * modify it under the terms of the GNU Lesser General Public
28847 + * License version 2.1, as published by the Free Software Foundation.
28849 + * This library is distributed in the hope that it will be useful,
28850 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
28851 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28852 + * Lesser General Public License for more details.
28854 + * You should have received a copy of the GNU Lesser General Public
28855 + * License along with this library; if not, write to the Free Software
28856 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28857 + * MA 02111-1307 USA
28859 + ************************************************************************/
28860 +#include "vbahelper/vbaglobalbase.hxx"
28862 +#include <cppuhelper/component_context.hxx>
28863 +#include <comphelper/processfactory.hxx>
28864 +#include <com/sun/star/container/XNameContainer.hpp>
28866 +using namespace com::sun::star;
28867 +using namespace ooo::vba;
28869 +VbaGlobalsBase::VbaGlobalsBase(
28870 +const uno::Reference< ov::XHelperInterface >& xParent,
28871 +const uno::Reference< uno::XComponentContext >& xContext)
28872 +: Globals_BASE( xParent, xContext )
28874 + // overwrite context with custom one ( that contains the application )
28875 + ::cppu::ContextEntry_Init aHandlerContextInfo[] =
28877 + ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Application" ) ), uno::Any() )
28880 + mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext );
28885 +VbaGlobalsBase::init( uno::Reference< uno::XComponentContext >const& rxContext, const uno::Any& aApplication )
28887 + uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY_THROW );
28888 + xNameContainer->replaceByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application") ), aApplication );
28889 + uno::Reference< XHelperInterface > xParent( aApplication, uno::UNO_QUERY );
28890 + mxParent = xParent;
28893 +uno::Reference< uno::XInterface > SAL_CALL
28894 +VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
28896 + uno::Reference< uno::XInterface > xReturn;
28898 + if ( hasServiceName( aServiceSpecifier ) )
28899 + xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext );
28903 +uno::Reference< uno::XInterface > SAL_CALL
28904 +VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
28907 + uno::Reference< uno::XInterface > xReturn;
28909 + if ( hasServiceName( ServiceSpecifier ) )
28910 + xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext );
28914 +uno::Sequence< ::rtl::OUString > SAL_CALL
28915 +VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException)
28917 + static const rtl::OUString names[] = {
28919 + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ),
28921 + static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) );
28922 + return serviceNames;
28926 +VbaGlobalsBase::hasServiceName( const rtl::OUString& serviceName )
28928 + uno::Sequence< rtl::OUString > sServiceNames( getAvailableServiceNames() );
28929 + sal_Int32 nLen = sServiceNames.getLength();
28930 + for ( sal_Int32 index = 0; index < nLen; ++index )
28932 + if ( sServiceNames[ index ].equals( serviceName ) )
28939 --- vbahelper/source/vbahelper/vbahelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
28940 +++ vbahelper/source/vbahelper/vbahelper.cxx 2009-04-06 16:42:01.000000000 +0000
28942 +/*************************************************************************
28944 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28946 + * Copyright 2008 by Sun Microsystems, Inc.
28948 + * OpenOffice.org - a multi-platform office productivity suite
28950 + * $RCSfile: vbahelper.cxx,v $
28951 + * $Revision: 1.5.32.1 $
28953 + * This file is part of OpenOffice.org.
28955 + * OpenOffice.org is free software: you can redistribute it and/or modify
28956 + * it under the terms of the GNU Lesser General Public License version 3
28957 + * only, as published by the Free Software Foundation.
28959 + * OpenOffice.org is distributed in the hope that it will be useful,
28960 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
28961 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28962 + * GNU Lesser General Public License version 3 for more details
28963 + * (a copy is included in the LICENSE file that accompanied this code).
28965 + * You should have received a copy of the GNU Lesser General Public License
28966 + * version 3 along with OpenOffice.org. If not, see
28967 + * <http://www.openoffice.org/license.html>
28968 + * for a copy of the LGPLv3 License.
28970 + ************************************************************************/
28971 +#include <cppuhelper/bootstrap.hxx>
28972 +#include <com/sun/star/util/XURLTransformer.hpp>
28973 +#include <com/sun/star/frame/XDispatchProvider.hpp>
28974 +#include <com/sun/star/frame/XModel.hpp>
28975 +#include <com/sun/star/frame/XFrame.hpp>
28976 +#include <com/sun/star/frame/XDesktop.hpp>
28977 +#include <com/sun/star/frame/XController.hpp>
28978 +#include <com/sun/star/uno/XComponentContext.hpp>
28979 +#include <com/sun/star/lang/XMultiComponentFactory.hpp>
28980 +#include <com/sun/star/beans/XPropertySet.hpp>
28981 +#include <com/sun/star/beans/XIntrospection.hpp>
28982 +#include <ooo/vba/msforms/XShape.hpp>
28984 +#include <comphelper/processfactory.hxx>
28986 +#include <sfx2/objsh.hxx>
28987 +#include <sfx2/viewfrm.hxx>
28988 +#include <sfx2/dispatch.hxx>
28989 +#include <sfx2/app.hxx>
28990 +#include <svtools/stritem.hxx>
28991 +#include <svtools/eitem.hxx>
28992 +#include <svtools/intitem.hxx>
28993 +#include <svtools/itemset.hxx>
28994 +//#include <svtools/itempool.hxx>
28995 +#include <sfx2/docfac.hxx>
28996 +#include <sfx2/viewfac.hxx>
28998 +#include <basic/sbx.hxx>
28999 +#include <basic/sbstar.hxx>
29000 +#include <basic/basmgr.hxx>
29001 +#include <basic/sbmod.hxx>
29002 +#include <basic/sbmeth.hxx>
29003 +#include <rtl/math.hxx>
29004 +#include <sfx2/viewsh.hxx>
29006 +#include <tools/urlobj.hxx>
29007 +#include <osl/file.hxx>
29008 +#include <toolkit/awt/vclxwindow.hxx>
29009 +#include <toolkit/helper/vclunohelper.hxx>
29010 +#include <com/sun/star/frame/XModel2.hpp>
29011 +#include <vcl/window.hxx>
29012 +#include <vcl/syswin.hxx>
29013 +#include <tools/diagnose_ex.h>
29015 +#ifndef OOVBA_DLLIMPLEMENTATION
29016 +#define OOVBA_DLLIMPLEMENTATION
29019 +#include <vbahelper/vbahelper.hxx>
29020 +#include <sfx2/app.hxx>
29021 +// #FIXME needs service
29022 +//#include "vbashape.hxx"
29023 +//#include "unonames.hxx"
29025 +using namespace ::com::sun::star;
29026 +using namespace ::ooo::vba;
29028 +#define NAME_HEIGHT "Height"
29029 +#define NAME_WIDTH "Width"
29031 +#define POINTTO100THMILLIMETERFACTOR 35.27778
29033 +void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
29035 +uno::Any sbxToUnoValue( SbxVariable* pVar );
29043 +uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell )
29045 + uno::Any aUnoVar;
29046 + if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
29047 + throw lang::IllegalArgumentException();
29048 + uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW );
29049 + return xVBAFactory;
29052 +css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException)
29054 + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
29055 + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
29056 + return getVBAServiceFactory( pShell )->createInstance( sVarName );
29059 +css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException )
29061 + OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
29062 + ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
29063 + uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
29066 +// helper method to determine if the view ( calc ) is in print-preview mode
29067 +bool isInPrintPreview( SfxViewFrame* pView )
29069 + sal_uInt16 nViewNo = SID_VIEWSHELL1 - SID_VIEWSHELL0;
29070 + if ( pView->GetObjectShell()->GetFactory().GetViewFactoryCount() >
29071 +nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
29073 + SfxViewFactory &rViewFactory =
29074 + pView->GetObjectShell()->GetFactory().GetViewFactory(nViewNo);
29075 + if ( pView->GetCurViewId() == rViewFactory.GetOrdinal() )
29081 +namespace excel // all in this namespace probably can be moved to sc
29085 +const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning"));
29086 +class PasteCellsWarningReseter
29089 + bool bInitialWarningState;
29090 + static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
29092 + static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
29093 + static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
29094 + static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
29095 + xContext->getServiceManager(), uno::UNO_QUERY_THROW );
29096 + static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
29100 + bool getReplaceCellsWarning() throw ( uno::RuntimeException )
29102 + sal_Bool res = sal_False;
29103 + getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res;
29104 + return ( res == sal_True );
29107 + void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException )
29109 + getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) );
29112 + PasteCellsWarningReseter() throw ( uno::RuntimeException )
29114 + bInitialWarningState = getReplaceCellsWarning();
29115 + if ( bInitialWarningState )
29116 + setReplaceCellsWarning( false );
29118 + ~PasteCellsWarningReseter()
29120 + if ( bInitialWarningState )
29122 + // don't allow dtor to throw
29125 + setReplaceCellsWarning( true );
29127 + catch ( uno::Exception& /*e*/ ){}
29135 + PasteCellsWarningReseter resetWarningBox;
29136 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
29137 + if ( pViewShell )
29139 + pViewShell->PasteFromSystem();
29140 + pViewShell->CellContentChanged();
29148 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
29149 + if ( pViewShell )
29150 + pViewShell->CopyToClip(NULL,false,false,true);
29156 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
29157 + if ( pViewShell )
29158 + pViewShell->CutToClip( NULL, TRUE );
29160 +void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
29162 + PasteCellsWarningReseter resetWarningBox;
29163 + sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
29164 + InsCellCmd eMoveMode = INS_NONE;
29166 + if ( !pTabViewShell )
29167 + // none active, try next best
29168 + pTabViewShell = getCurrentBestViewShell();
29169 + if ( pTabViewShell )
29171 + ScViewData* pView = pTabViewShell->GetViewData();
29172 + Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
29173 + if ( pView && pWin )
29175 + if ( bAsLink && bOtherDoc )
29176 + pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
29179 + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
29180 + ScDocument* pDoc = NULL;
29182 + pDoc = pOwnClip->GetDocument();
29183 + pTabViewShell->PasteFromClip( nFlags, pDoc,
29184 + nFunction, bSkipEmpty, bTranspose, bAsLink,
29185 + eMoveMode, IDF_NONE, TRUE );
29186 + pTabViewShell->CellContentChanged();
29194 +getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
29196 + uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
29197 + ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
29198 + ScDocShell* pDocShell = NULL;
29200 + pDocShell = (ScDocShell*)pModel->GetEmbeddedObject();
29201 + return pDocShell;
29206 +getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
29208 + ScDocShell* pDocShell = getDocShell( xModel );
29210 + return pDocShell->GetBestViewShell();
29215 +getCurrentBestViewShell()
29217 + uno::Reference< frame::XModel > xModel = getCurrentDocument();
29218 + return getBestViewShell( xModel );
29222 +getCurrentViewFrame()
29224 + ScTabViewShell* pViewShell = getCurrentBestViewShell();
29225 + if ( pViewShell )
29226 + return pViewShell->GetViewFrame();
29232 +const double Millimeter::factor = 35.27778;
29234 +uno::Reference< beans::XIntrospectionAccess >
29235 +getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
29237 + static uno::Reference< beans::XIntrospection > xIntrospection;
29238 + if( !xIntrospection.is() )
29240 + uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
29241 + xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
29243 + return xIntrospection->inspect( aObject );
29246 +uno::Reference< script::XTypeConverter >
29247 +getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
29249 + static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
29250 + return xTypeConv;
29255 + static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
29259 +void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
29261 + SfxViewFrame* pViewFrame = NULL;
29262 + if ( pViewShell )
29263 + pViewFrame = pViewShell->GetViewFrame();
29264 + if ( pViewFrame )
29266 + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
29267 + if( pDispatcher )
29269 + pDispatcher->Execute( nSlot , nCall );
29275 +dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
29279 + url.Complete = aUrl;
29280 + rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
29281 + uno::Reference<frame::XController> xController = xModel->getCurrentController();
29282 + uno::Reference<frame::XFrame> xFrame = xController->getFrame();
29283 + uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
29286 + uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
29287 + uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
29288 + if ( !xContext.is() )
29293 + uno::Reference<lang::XMultiComponentFactory > xServiceManager(
29294 + xContext->getServiceManager() );
29295 + if ( !xServiceManager.is() )
29299 + uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
29300 + ,xContext), uno::UNO_QUERY_THROW );
29301 + if (!xParser.is())
29303 + xParser->parseStrict (url);
29305 + catch ( uno::Exception & /*e*/ )
29310 + uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
29312 + uno::Sequence<beans::PropertyValue> dispatchProps(1);
29314 + sal_Int32 nProps = sProps.getLength();
29315 + beans::PropertyValue* pDest = dispatchProps.getArray();
29318 + dispatchProps.realloc( nProps + 1 );
29319 + // need to reaccquire pDest after realloc
29320 + pDest = dispatchProps.getArray();
29321 + beans::PropertyValue* pSrc = sProps.getArray();
29322 + for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
29326 + (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
29327 + (*pDest).Value <<= (sal_Bool)sal_True;
29329 + if (xDispatcher.is())
29330 + xDispatcher->dispatch( url, dispatchProps );
29334 +dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
29336 + uno::Sequence<beans::PropertyValue> dispatchProps;
29337 + dispatchRequests( xModel, aUrl, dispatchProps );
29342 + uno::Reference< frame::XModel >
29343 +getCurrentDocument() throw (uno::RuntimeException)
29345 + uno::Reference< frame::XModel > xModel;
29346 + SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
29347 + SbxObject* basicChosen = pBasic ;
29348 + if ( basicChosen == NULL)
29350 + OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
29353 + SbxObject* p = pBasic;
29354 + SbxObject* pParent = p->GetParent();
29355 + SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
29357 + if( pParentParent )
29359 + basicChosen = pParentParent;
29361 + else if( pParent )
29363 + basicChosen = pParent;
29368 + SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
29372 + aModel = sbxToUnoValue( pCompVar );
29373 + if ( sal_False == ( aModel >>= xModel ) ||
29376 + // trying last gasp try the current component
29377 + uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
29378 + // test if vba service is present
29379 + uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
29380 + uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
29381 + uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
29382 + xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
29383 + if ( !xModel.is() )
29385 + throw uno::RuntimeException(
29386 + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
29392 + OSL_TRACE("Have model ThisComponent points to url %s",
29393 + ::rtl::OUStringToOString( xModel->getURL(),
29394 + RTL_TEXTENCODING_ASCII_US ).pData->buffer );
29399 + OSL_TRACE("Failed to get ThisComponent");
29400 + throw uno::RuntimeException(
29402 + RTL_CONSTASCII_USTRINGPARAM(
29403 + "Can't determine the currently selected document") ),
29404 + uno::Reference< uno::XInterface >() );
29410 +OORGBToXLRGB( sal_Int32 nCol )
29412 + sal_Int32 nRed = nCol;
29413 + nRed &= 0x00FF0000;
29415 + sal_Int32 nGreen = nCol;
29416 + nGreen &= 0x0000FF00;
29418 + sal_Int32 nBlue = nCol;
29419 + nBlue &= 0x000000FF;
29420 + sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
29424 +XLRGBToOORGB( sal_Int32 nCol )
29426 + sal_Int32 nBlue = nCol;
29427 + nBlue &= 0x00FF0000;
29429 + sal_Int32 nGreen = nCol;
29430 + nGreen &= 0x0000FF00;
29432 + sal_Int32 nRed = nCol;
29433 + nRed &= 0x000000FF;
29434 + sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
29438 +OORGBToXLRGB( const uno::Any& aCol )
29442 + nCol = OORGBToXLRGB( nCol );
29443 + return uno::makeAny( nCol );
29446 +XLRGBToOORGB( const uno::Any& aCol )
29450 + nCol = XLRGBToOORGB( nCol );
29451 + return uno::makeAny( nCol );
29454 +void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection )
29456 + sal_Int32 nTo = 0;
29457 + sal_Int32 nFrom = 0;
29458 + sal_Int16 nCopies = 1;
29459 + sal_Bool bPreview = sal_False;
29460 + sal_Bool bCollate = sal_False;
29461 + sal_Bool bSelection = bUseSelection;
29464 + Copies >>= nCopies;
29465 + Preview >>= bPreview;
29466 + if ( nCopies > 1 ) // Collate only useful when more that 1 copy
29467 + Collate >>= bCollate;
29469 + rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
29470 + rtl::OUString sFileName;
29472 + if (( nFrom || nTo ) )
29475 + sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
29477 + sRange += ::rtl::OUString::valueOf( nTo );
29480 + if ( PrToFileName.getValue() )
29482 + PrToFileName >>= sFileName;
29484 + SfxViewFrame* pViewFrame = NULL;
29485 + if ( pViewShell )
29486 + pViewFrame = pViewShell->GetViewFrame();
29487 + if ( pViewFrame )
29489 + SfxAllItemSet aArgs( SFX_APP()->GetPool() );
29491 + SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
29492 + aArgs.Put( sfxCollate, sfxCollate.Which() );
29493 + SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
29494 + aArgs.Put( sfxCopies, sfxCopies.Which() );
29495 + if ( sFileName.getLength() )
29497 + SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
29498 + aArgs.Put( sfxFileName, sfxFileName.Which() );
29501 + if ( sRange.getLength() )
29503 + SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
29504 + aArgs.Put( sfxRange, sfxRange.Which() );
29506 + SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
29507 + aArgs.Put( sfxSelection, sfxSelection.Which() );
29508 + SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
29509 + aArgs.Put( sfxAsync, sfxAsync.Which() );
29510 + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
29512 + if ( pDispatcher )
29516 + if ( !pViewFrame->GetFrame()->IsInPlace() )
29518 + // #TODO is this necessary ( calc specific )
29519 +// SC_MOD()->InputEnterHandler();
29520 + pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
29521 + while ( isInPrintPreview( pViewFrame ) )
29522 + Application::Yield();
29526 + pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
29532 + // 1 ActivePrinter ( how/can we switch a printer via API? )
29533 + // 2 PrintToFile ( ms behaviour if this option is specified but no
29534 + // filename supplied 'PrToFileName' then the user will be prompted )
29535 + // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
29536 + // values ) in oOO these options are mutually exclusive
29537 + // 4 There is a pop up to do with transparent objects in the print source
29538 + // should be able to disable that via configuration for the duration
29539 + // of this method
29542 + void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell )
29544 + dispatchExecute( pViewShell, SID_VIEWSHELL1 );
29547 +rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
29549 + uno::Type aType = pvargItem.getValueType();
29550 + uno::TypeClass eTypeClass = aType.getTypeClass();
29551 + rtl::OUString sString;
29552 + switch ( eTypeClass )
29554 + case uno::TypeClass_BOOLEAN:
29556 + sal_Bool bBool = sal_False;
29557 + pvargItem >>= bBool;
29558 + sString = rtl::OUString::valueOf( bBool );
29561 + case uno::TypeClass_STRING:
29562 + pvargItem >>= sString;
29564 + case uno::TypeClass_FLOAT:
29566 + float aFloat = 0;
29567 + pvargItem >>= aFloat;
29568 + sString = rtl::OUString::valueOf( aFloat );
29571 + case uno::TypeClass_DOUBLE:
29573 + double aDouble = 0;
29574 + pvargItem >>= aDouble;
29575 + sString = rtl::OUString::valueOf( aDouble );
29578 + case uno::TypeClass_SHORT:
29579 + case uno::TypeClass_LONG:
29580 + case uno::TypeClass_BYTE:
29582 + sal_Int32 aNum = 0;
29583 + pvargItem >>= aNum;
29584 + sString = rtl::OUString::valueOf( aNum );
29588 + case uno::TypeClass_HYPER:
29590 + sal_Int64 aHyper = 0;
29591 + pvargItem >>= aHyper;
29592 + sString = rtl::OUString::valueOf( aHyper );
29596 + throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
29603 +ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
29605 + return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
29609 +ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
29611 + sal_Int32 a = _nStartSuffix;
29612 + rtl::OUString scompname = _sElementName;
29613 + bool bElementexists = true;
29614 + sal_Int32 nLen = _slist.getLength();
29616 + return _sElementName;
29618 + while (bElementexists == true)
29620 + for (sal_Int32 i = 0; i < nLen; i++)
29622 + if (FieldInList(_slist, scompname) == -1)
29624 + return scompname;
29627 + scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
29629 + return rtl::OUString();
29633 +ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
29635 + sal_Int32 FieldLen = SearchList.getLength();
29636 + sal_Int32 retvalue = -1;
29637 + for (sal_Int32 i = 0; i < FieldLen; i++)
29639 + // I wonder why comparing lexicographically is done
29640 + // when its a match is whats interesting?
29641 + //if (SearchList[i].compareTo(SearchString) == 0)
29642 + if ( SearchList[i].equals( SearchString ) )
29651 +bool NeedEsc(sal_Unicode cCode)
29653 + String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
29654 + return (STRING_NOTFOUND != sEsc.Search(cCode));
29657 +rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
29659 + rtl::OUStringBuffer sResult;
29660 + const sal_Unicode *start = rIn.getStr();
29661 + const sal_Unicode *end = start + rIn.getLength();
29663 + int seenright = 0;
29665 + sResult.append(static_cast<sal_Unicode>('^'));
29667 + while (start < end)
29672 + sResult.append(static_cast<sal_Unicode>('.'));
29676 + sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
29680 + sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
29684 + sResult.append(static_cast<sal_Unicode>('\\'));
29685 + sResult.append(*(++start));
29688 + // dump the ~ and escape the next characture
29690 + sResult.append(static_cast<sal_Unicode>('\\'));
29691 + sResult.append(*start++);
29694 + sResult.append(*start++);
29696 + while (start < end && !seenright)
29703 + sResult.append(static_cast<sal_Unicode>('\\'));
29704 + sResult.append(*start);
29707 + sResult.append(*start);
29711 + sResult.append(static_cast<sal_Unicode>('^'));
29714 + if (NeedEsc(*start))
29715 + sResult.append(static_cast<sal_Unicode>('\\'));
29716 + sResult.append(*start);
29723 + if (NeedEsc(*start))
29724 + sResult.append(static_cast<sal_Unicode>('\\'));
29725 + sResult.append(*start++);
29730 + sResult.append(static_cast<sal_Unicode>('$'));
29732 + return sResult.makeStringAndClear( );
29735 +double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
29737 + double fConvertFactor = 1.0;
29740 + fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
29744 + fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
29746 + return fConvertFactor;
29749 +double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
29751 + double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
29752 + return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
29754 +double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
29756 + double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
29757 + return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
29760 +ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
29762 +// #FIXME needs to be an instantiable service
29763 +// m_xShape = new ScVbaShape( xContext, xShape );
29766 +static uno::Reference< frame::XController > lcl_getCurrentController()
29768 + const uno::Reference< frame::XModel > xWorkingDoc( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
29769 + uno::Reference< frame::XController > xController;
29770 + if ( xWorkingDoc.is() )
29771 + xController.set( xWorkingDoc->getCurrentController(), uno::UNO_SET_THROW );
29773 + xController.set( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW );
29774 + return xController;
29777 +sal_Int32 getPointerStyle()
29779 + sal_Int32 nPointerStyle( POINTER_ARROW );
29782 + const uno::Reference< frame::XController > xController( lcl_getCurrentController(), uno::UNO_SET_THROW );
29783 + const uno::Reference< frame::XFrame > xFrame ( xController->getFrame(), uno::UNO_SET_THROW );
29784 + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
29785 + // why the heck isn't there an XWindowPeer::getPointer, but a setPointer only?
29786 + const Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
29788 + nPointerStyle = pWindow->GetSystemWindow()->GetPointer().GetStyle();
29790 + catch( const uno::Exception& )
29792 + DBG_UNHANDLED_EXCEPTION();
29794 + return nPointerStyle;
29797 +void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite )
29799 + ::std::vector< uno::Reference< frame::XController > > aControllers;
29801 + const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
29802 + if ( xModel2.is() )
29804 + const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW );
29805 + while ( xEnumControllers->hasMoreElements() )
29807 + const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW );
29808 + aControllers.push_back( xController );
29813 + const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
29814 + if ( xModel.is() )
29816 + const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
29817 + aControllers.push_back( xController );
29821 + const uno::Reference< frame::XController > xController( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_THROW );
29822 + aControllers.push_back( xController );
29826 + for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin();
29827 + controller != aControllers.end();
29831 + const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW );
29832 + const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
29834 + Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
29835 + OSL_ENSURE( pWindow, "ScVbaApplication::setCursor: no window!" );
29839 + pWindow->GetSystemWindow()->SetPointer( rPointer );
29840 + pWindow->GetSystemWindow()->EnableChildPointerOverwrite( bOverWrite );
29844 +String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
29846 + String sFullName;
29847 + // would use the script provider to see if the macro exists but
29848 + // called at this stage tdoc content handler stuff is not set up
29851 + String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
29852 + BasicManager* pBasicMgr = pShell-> GetBasicManager();
29855 + if ( pBasicMgr->GetName().Len() )
29856 + sLibrary = pBasicMgr->GetName();
29857 + StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
29860 + USHORT nId = pBasicMgr->GetLibId( sLibrary );
29861 + pBasicMgr->LoadLib( nId );
29862 + pBasic = pBasicMgr->GetLib( sLibrary );
29866 + if ( sMod.Len() ) // we wish to find the macro is a specific module
29868 + SbModule* pModule = pBasic->FindModule( sMod );
29871 + SbxArray* pMethods = pModule->GetMethods();
29874 + SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
29877 + sFullName = sMacro;
29878 + sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
29883 + else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
29885 + if( SbModule* pModule = pMethod->GetModule() )
29887 + sFullName = sMacro;
29888 + sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
29894 + return sFullName;
29897 +#define VBA_LEFT "PositionX"
29898 +#define VBA_TOP "PositionY"
29899 +UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
29901 + mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
29903 + double UserFormGeometryHelper::getLeft()
29905 + sal_Int32 nLeft = 0;
29906 + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
29907 + return Millimeter::getInPoints( nLeft );
29909 + void UserFormGeometryHelper::setLeft( double nLeft )
29911 + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
29913 + double UserFormGeometryHelper::getTop()
29915 + sal_Int32 nTop = 0;
29916 + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
29917 + return Millimeter::getInPoints( nTop );
29919 + void UserFormGeometryHelper::setTop( double nTop )
29921 + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
29923 + double UserFormGeometryHelper::getHeight()
29925 + sal_Int32 nHeight = 0;
29926 + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight;
29927 + return Millimeter::getInPoints( nHeight );
29929 + void UserFormGeometryHelper::setHeight( double nHeight )
29931 + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
29933 + double UserFormGeometryHelper::getWidth()
29935 + sal_Int32 nWidth = 0;
29936 + mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ) ) >>= nWidth;
29937 + return Millimeter::getInPoints( nWidth );
29939 + void UserFormGeometryHelper::setWidth( double nWidth)
29941 + mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
29944 + double ConcreteXShapeGeometryAttributes::getLeft()
29946 + return m_xShape->getLeft();
29948 + void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
29950 + m_xShape->setLeft( nLeft );
29952 + double ConcreteXShapeGeometryAttributes::getTop()
29954 + return m_xShape->getTop();
29956 + void ConcreteXShapeGeometryAttributes::setTop( double nTop )
29958 + m_xShape->setTop( nTop );
29961 + double ConcreteXShapeGeometryAttributes::getHeight()
29963 + return m_xShape->getHeight();
29965 + void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
29967 + m_xShape->setHeight( nHeight );
29969 + double ConcreteXShapeGeometryAttributes::getWidth()
29971 + return m_xShape->getWidth();
29973 + void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
29975 + m_xShape->setHeight( nWidth );
29979 + ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
29981 + if( !xShape.is() )
29982 + throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
29985 + double ShapeHelper::getHeight()
29987 + return Millimeter::getInPoints(xShape->getSize().Height);
29991 + void ShapeHelper::setHeight(double _fheight) throw ( css::script::BasicErrorException )
29995 + css::awt::Size aSize = xShape->getSize();
29996 + aSize.Height = Millimeter::getInHundredthsOfOneMillimeter(_fheight);
29997 + xShape->setSize(aSize);
29999 + catch ( css::uno::Exception& /*e*/)
30001 + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
30006 + double ShapeHelper::getWidth()
30008 + return Millimeter::getInPoints(xShape->getSize().Width);
30011 + void ShapeHelper::setWidth(double _fWidth) throw ( css::script::BasicErrorException )
30015 + css::awt::Size aSize = xShape->getSize();
30016 + aSize.Width = Millimeter::getInHundredthsOfOneMillimeter(_fWidth);
30017 + xShape->setSize(aSize);
30019 + catch (css::uno::Exception& /*e*/)
30021 + throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
30026 + double ShapeHelper::getLeft()
30028 + return Millimeter::getInPoints(xShape->getPosition().X);
30032 + void ShapeHelper::setLeft(double _fLeft)
30034 + css::awt::Point aPoint = xShape->getPosition();
30035 + aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
30036 + xShape->setPosition(aPoint);
30040 + double ShapeHelper::getTop()
30042 + return Millimeter::getInPoints(xShape->getPosition().Y);
30046 + void ShapeHelper::setTop(double _fTop)
30048 + css::awt::Point aPoint = xShape->getPosition();
30049 + aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
30050 + xShape->setPosition(aPoint);
30053 + void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
30055 + // #TODO #FIXME ( do we want to support additionalArg here )
30056 + throw css::script::BasicErrorException( DetailedMessage.concat( rtl::OUString::createFromAscii(" ") ).concat( ex.Message ), css::uno::Reference< css::uno::XInterface >(), err, rtl::OUString() );
30059 + void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
30061 + exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
30063 + void DebugHelper::exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
30065 + exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
30068 + Millimeter::Millimeter():m_nMillimeter(0) {}
30070 + Millimeter::Millimeter(double mm):m_nMillimeter(mm) {}
30072 + void Millimeter::set(double mm) { m_nMillimeter = mm; }
30073 + void Millimeter::setInPoints(double points)
30075 + m_nMillimeter = points * 0.352777778;
30079 + void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
30081 + m_nMillimeter = hmm / 100;
30084 + double Millimeter::get()
30086 + return m_nMillimeter;
30088 + double Millimeter::getInHundredthsOfOneMillimeter()
30090 + return m_nMillimeter * 100;
30092 + double Millimeter::getInPoints()
30094 + return m_nMillimeter * 2.834645669; // 72 / 25.4mm
30097 + sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
30099 + sal_Int32 mm = static_cast<sal_Int32>(points * factor);
30103 + double Millimeter::getInPoints(int _hmm)
30105 + double points = double( static_cast<double>(_hmm) / factor);
30112 --- vbahelper/source/vbahelper/vbapropvalue.cxx.old 1970-01-01 00:00:00.000000000 +0000
30113 +++ vbahelper/source/vbahelper/vbapropvalue.cxx 2009-04-06 16:42:01.000000000 +0000
30115 +/*************************************************************************
30117 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
30119 + * Copyright 2008 by Sun Microsystems, Inc.
30121 + * OpenOffice.org - a multi-platform office productivity suite
30123 + * $RCSfile: vbapropvalue.cxx,v $
30124 + * $Revision: 1.3 $
30126 + * This file is part of OpenOffice.org.
30128 + * OpenOffice.org is free software: you can redistribute it and/or modify
30129 + * it under the terms of the GNU Lesser General Public License version 3
30130 + * only, as published by the Free Software Foundation.
30132 + * OpenOffice.org is distributed in the hope that it will be useful,
30133 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
30134 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30135 + * GNU Lesser General Public License version 3 for more details
30136 + * (a copy is included in the LICENSE file that accompanied this code).
30138 + * You should have received a copy of the GNU Lesser General Public License
30139 + * version 3 along with OpenOffice.org. If not, see
30140 + * <http://www.openoffice.org/license.html>
30141 + * for a copy of the LGPLv3 License.
30143 + ************************************************************************/
30144 +#include "vbahelper/vbapropvalue.hxx"
30146 +using namespace com::sun::star;
30148 +ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener )
30152 +css::uno::Any SAL_CALL
30153 +ScVbaPropValue::getValue() throw (css::uno::RuntimeException)
30155 + return m_pListener->getValueEvent();
30159 +ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException)
30161 + m_pListener->setValueEvent( _value );
30163 --- vbahelper/source/vbahelper/vbawindowbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
30164 +++ vbahelper/source/vbahelper/vbawindowbase.cxx 2009-04-06 16:42:01.000000000 +0000
30166 +/*************************************************************************
30168 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
30170 + * Copyright 2008 by Sun Microsystems, Inc.
30172 + * OpenOffice.org - a multi-platform office productivity suite
30177 + * This file is part of OpenOffice.org.
30179 + * OpenOffice.org is free software: you can redistribute it and/or modify
30180 + * it under the terms of the GNU Lesser General Public License version 3
30181 + * only, as published by the Free Software Foundation.
30183 + * OpenOffice.org is distributed in the hope that it will be useful,
30184 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
30185 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30186 + * GNU Lesser General Public License version 3 for more details
30187 + * (a copy is included in the LICENSE file that accompanied this code).
30189 + * You should have received a copy of the GNU Lesser General Public License
30190 + * version 3 along with OpenOffice.org. If not, see
30191 + * <http://www.openoffice.org/license.html>
30192 + * for a copy of the LGPLv3 License.
30194 + ************************************************************************/
30195 +#include <vbahelper/helperdecl.hxx>
30196 +#include <vbahelper/vbawindowbase.hxx>
30197 +#include <com/sun/star/awt/XWindow.hpp>
30198 +#include <com/sun/star/awt/XWindow2.hpp>
30199 +#include <com/sun/star/awt/PosSize.hpp>
30201 +using namespace ::com::sun::star;
30202 +using namespace ::ooo::vba;
30204 +VbaWindowBase::VbaWindowBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowBaseImpl_BASE( xParent, xContext ), m_xModel( xModel )
30208 +VbaWindowBase::VbaWindowBase( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
30209 + : WindowBaseImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ),
30210 + m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
30215 +VbaWindowBase::getVisible() throw (uno::RuntimeException)
30217 + sal_Bool bVisible = sal_True;
30218 + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
30219 + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
30220 + uno::Reference< css::awt::XWindow2 > xWindow2 (xWindow, uno::UNO_QUERY_THROW );
30221 + if( xWindow2.is() )
30223 + bVisible = xWindow2->isVisible();
30229 +VbaWindowBase::setVisible(sal_Bool _visible) throw (uno::RuntimeException)
30231 + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
30232 + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
30233 + if( xWindow.is() )
30235 + xWindow->setVisible( _visible );
30239 +css::awt::Rectangle getPosSize( const uno::Reference< frame::XModel >& xModel )
30241 + css::awt::Rectangle aRect;
30242 + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
30243 + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
30244 + if( xWindow.is() )
30246 + aRect = xWindow->getPosSize();
30251 +void setPosSize( const uno::Reference< frame::XModel >& xModel, sal_Int32 nValue, USHORT nFlag )
30253 + uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
30254 + uno::Reference< css::awt::XWindow > xWindow (xController->getFrame()->getContainerWindow(), uno::UNO_QUERY_THROW );
30255 + if( xWindow.is() )
30257 + css::awt::Rectangle aRect = xWindow->getPosSize();
30260 + case css::awt::PosSize::X:
30261 + xWindow->setPosSize( nValue, aRect.Y, 0, 0, css::awt::PosSize::X );
30263 + case css::awt::PosSize::Y:
30264 + xWindow->setPosSize( aRect.X, nValue, 0, 0, css::awt::PosSize::Y );
30266 + case css::awt::PosSize::WIDTH:
30267 + xWindow->setPosSize( 0, 0, nValue, aRect.Height, css::awt::PosSize::WIDTH );
30269 + case css::awt::PosSize::HEIGHT:
30270 + xWindow->setPosSize( 0, 0, aRect.Width, nValue, css::awt::PosSize::HEIGHT );
30278 +sal_Int32 SAL_CALL
30279 +VbaWindowBase::getHeight() throw (uno::RuntimeException)
30281 + css::awt::Rectangle aRect = getPosSize(m_xModel);
30282 + return aRect.Height;
30286 +VbaWindowBase::setHeight( sal_Int32 _height ) throw (uno::RuntimeException)
30288 + setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT);
30291 +sal_Int32 SAL_CALL
30292 +VbaWindowBase::getLeft() throw (uno::RuntimeException)
30294 + css::awt::Rectangle aRect = getPosSize(m_xModel);
30299 +VbaWindowBase::setLeft( sal_Int32 _left ) throw (uno::RuntimeException)
30301 + setPosSize(m_xModel, _left, css::awt::PosSize::X);
30303 +sal_Int32 SAL_CALL
30304 +VbaWindowBase::getTop() throw (uno::RuntimeException)
30306 + css::awt::Rectangle aRect = getPosSize(m_xModel);
30311 +VbaWindowBase::setTop( sal_Int32 _top ) throw (uno::RuntimeException)
30313 + setPosSize(m_xModel, _top, css::awt::PosSize::Y);
30315 +sal_Int32 SAL_CALL
30316 +VbaWindowBase::getWidth() throw (uno::RuntimeException)
30318 + css::awt::Rectangle aRect = getPosSize(m_xModel);
30319 + return aRect.Width;
30323 +VbaWindowBase::setWidth( sal_Int32 _width ) throw (uno::RuntimeException)
30325 + setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH);
30329 +VbaWindowBase::getServiceImplName()
30331 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaWindowBase") );
30332 + return sImplName;
30335 +uno::Sequence< rtl::OUString >
30336 +VbaWindowBase::getServiceNames()
30338 + static uno::Sequence< rtl::OUString > aServiceNames;
30339 + if ( aServiceNames.getLength() == 0 )
30341 + aServiceNames.realloc( 1 );
30342 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaWindowBase" ) );
30344 + return aServiceNames;
30346 --- vbahelper/util/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
30347 +++ vbahelper/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
30349 +#*************************************************************************
30351 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
30353 +# Copyright 2008 by Sun Microsystems, Inc.
30355 +# OpenOffice.org - a multi-platform office productivity suite
30357 +# $RCSfile: makefile.mk,v $
30359 +# $Revision: 1.24 $
30361 +# This file is part of OpenOffice.org.
30363 +# OpenOffice.org is free software: you can redistribute it and/or modify
30364 +# it under the terms of the GNU Lesser General Public License version 3
30365 +# only, as published by the Free Software Foundation.
30367 +# OpenOffice.org is distributed in the hope that it will be useful,
30368 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
30369 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30370 +# GNU Lesser General Public License version 3 for more details
30371 +# (a copy is included in the LICENSE file that accompanied this code).
30373 +# You should have received a copy of the GNU Lesser General Public License
30374 +# version 3 along with OpenOffice.org. If not, see
30375 +# <http://www.openoffice.org/license.html>
30376 +# for a copy of the LGPLv3 License.
30378 +#*************************************************************************
30385 +# --- Settings ---------------------------------------------------
30387 +.INCLUDE : settings.mk
30390 +TARGET_HELPER=vbahelper
30391 +SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
30392 +SHL1IMPLIB= i$(TARGET_HELPER)
30394 +SHL1DEF=$(MISC)$/$(SHL1TARGET).def
30395 +DEF1NAME=$(SHL1TARGET)
30397 +LIB1FILES=$(SLB)$/$(TARGET_HELPER).lib
30399 +# dynamic libraries
30402 + $(COMPHELPERLIB) \
30403 + $(CPPUHELPERLIB) \
30414 +#SHL4DEPN=$(SHL1TARGETN)
30415 +SHL1LIBS=$(LIB1FILES)
30417 +TARGET_MSFORMS=msforms
30418 +SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno
30419 +SHL2IMPLIB= i$(TARGET_MSFORMS)
30421 +SHL2VERSIONMAP=$(TARGET_MSFORMS).map
30422 +SHL2DEF=$(MISC)$/$(SHL2TARGET).def
30423 +DEF2NAME=$(SHL2TARGET)
30425 + $(CPPUHELPERLIB) \
30427 + $(COMPHELPERLIB) \
30431 + $(VBAHELPERLIB) \
30440 +SHL2DEPN=$(SHL1TARGETN)
30441 +SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
30443 +# --- Targets -----------------------------------------------------------
30445 +.INCLUDE : target.mk
30446 --- vbahelper/util/msforms.map.old 1970-01-01 00:00:00.000000000 +0000
30447 +++ vbahelper/util/msforms.map 2009-04-06 16:42:01.000000000 +0000
30451 + component_getImplementationEnvironment;
30452 + component_getFactory;
30453 + component_writeInfo;
30458 --- basic/source/uno/namecont.cxx.old 2009-04-06 16:41:59.000000000 +0000
30459 +++ basic/source/uno/namecont.cxx 2009-04-06 16:42:01.000000000 +0000
30460 @@ -2730,6 +2730,10 @@ OUString SfxLibraryContainer::expand_url
30462 // get the standard library
30463 String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
30465 + if ( pBasMgr->GetName().Len() )
30466 + aLibName = pBasMgr->GetName();
30468 StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
30470 bVBACompat = pBasic->isVBAEnabled();
30471 --- sc/inc/cellsuno.hxx.old 2009-04-02 10:45:43.000000000 +0000
30472 +++ sc/inc/cellsuno.hxx 2009-04-06 16:42:01.000000000 +0000
30473 @@ -152,8 +152,10 @@ public:
30477 + namespace excel {
30478 class ScVbaCellRangeAccess; // Vba Helper class
30483 class SC_DLLPUBLIC ScCellRangesBase : public com::sun::star::beans::XPropertySet,
30484 @@ -175,7 +177,7 @@ class SC_DLLPUBLIC ScCellRangesBase : pu
30486 friend class ScTabViewObj; // fuer select()
30487 friend class ScTableSheetObj; // fuer createCursorByRange()
30488 - friend class ooo::vba::ScVbaCellRangeAccess;
30489 + friend class ooo::vba::excel::ScVbaCellRangeAccess;
30492 SfxItemPropertySet aPropSet;
30493 --- sc/source/ui/vba/vbafont.cxx.old 2009-04-02 10:45:35.000000000 +0000
30494 +++ sc/source/ui/vba/vbafont.cxx 2009-04-06 16:42:01.000000000 +0000
30495 @@ -76,7 +76,7 @@ ScVbaFont::ScVbaFont( const uno::Referen
30497 ScVbaFont::GetDataSet()
30499 - SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( mpRangeObj );
30500 + SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( mpRangeObj );