update ooo310-m15
[ooovba.git] / applied_patches / 0452-vba-menubar-objects.diff
blob1dd20c9517b795a5b8ba4d7315232976937f978a
1 diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl
2 index 2d903de..cf758f3 100644
3 --- oovbaapi/ooo/vba/excel/XApplication.idl
4 +++ oovbaapi/ooo/vba/excel/XApplication.idl
5 @@ -103,6 +103,7 @@ interface XApplication : com::sun::star::uno::XInterface
6 raises(com::sun::star::script::BasicErrorException);
7 void Volatile([in] any Volatile);
8 any Caller( [in] any aIndex );
9 + any MenuBars( [in] any aIndex );
12 }; }; };
13 diff --git oovbaapi/ooo/vba/excel/XGlobals.idl oovbaapi/ooo/vba/excel/XGlobals.idl
14 index b21e902..782da39 100644
15 --- oovbaapi/ooo/vba/excel/XGlobals.idl
16 +++ oovbaapi/ooo/vba/excel/XGlobals.idl
17 @@ -76,6 +76,7 @@ XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3,
18 any Names( [in] any Index );
19 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)
20 raises(com::sun::star::script::BasicErrorException);
21 + any MenuBars( [in] any aIndex );
25 diff --git oovbaapi/ooo/vba/excel/XMenu.idl oovbaapi/ooo/vba/excel/XMenu.idl
26 new file mode 100644
27 index 0000000..cb3698b
28 --- /dev/null
29 +++ oovbaapi/ooo/vba/excel/XMenu.idl
30 @@ -0,0 +1,62 @@
31 +/*************************************************************************
32 + *
33 + * OpenOffice.org - a multi-platform office productivity suite
34 + *
35 + * $RCSfile$
36 + *
37 + * $Revision$
38 + *
39 + * last change: $Author$ $Date$
40 + *
41 + * The Contents of this file are made available subject to
42 + * the terms of GNU Lesser General Public License Version 2.1.
43 + *
44 + *
45 + * GNU Lesser General Public License Version 2.1
46 + * =============================================
47 + * Copyright 2005 by Sun Microsystems, Inc.
48 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
49 + *
50 + * This library is free software; you can redistribute it and/or
51 + * modify it under the terms of the GNU Lesser General Public
52 + * License version 2.1, as published by the Free Software Foundation.
53 + *
54 + * This library is distributed in the hope that it will be useful,
55 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
56 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
57 + * Lesser General Public License for more details.
58 + *
59 + * You should have received a copy of the GNU Lesser General Public
60 + * License along with this library; if not, write to the Free Software
61 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
62 + * MA 02111-1307 USA
63 + *
64 + ************************************************************************/
65 +#ifndef __ooo_vba_excel_XMenu_idl__
66 +#define __ooo_vba_excel_XMenu_idl__
68 +#ifndef __com_sun_star_uno_XInterface_idl__
69 +#include <com/sun/star/uno/XInterface.idl>
70 +#endif
72 +#ifndef __ooo_vba_XHelperInterface_idl__
73 +#include <ooo/vba/XHelperInterface.idl>
74 +#endif
75 +//=============================================================================
77 +module ooo { module vba { module excel {
78 +//=============================================================================
80 +interface XMenu
82 + interface XHelperInterface;
84 + [attribute] string Caption;
86 + void Delete() raises ( com::sun::star::script::BasicErrorException );
87 + any MenuItems( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
88 +};
90 +}; }; };
92 +#endif
93 diff --git oovbaapi/ooo/vba/excel/XMenuBar.idl oovbaapi/ooo/vba/excel/XMenuBar.idl
94 new file mode 100644
95 index 0000000..3ead272
96 --- /dev/null
97 +++ oovbaapi/ooo/vba/excel/XMenuBar.idl
98 @@ -0,0 +1,59 @@
99 +/*************************************************************************
101 + * OpenOffice.org - a multi-platform office productivity suite
103 + * $RCSfile$
105 + * $Revision$
107 + * last change: $Author$ $Date$
109 + * The Contents of this file are made available subject to
110 + * the terms of GNU Lesser General Public License Version 2.1.
113 + * GNU Lesser General Public License Version 2.1
114 + * =============================================
115 + * Copyright 2005 by Sun Microsystems, Inc.
116 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
118 + * This library is free software; you can redistribute it and/or
119 + * modify it under the terms of the GNU Lesser General Public
120 + * License version 2.1, as published by the Free Software Foundation.
122 + * This library is distributed in the hope that it will be useful,
123 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
124 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
125 + * Lesser General Public License for more details.
127 + * You should have received a copy of the GNU Lesser General Public
128 + * License along with this library; if not, write to the Free Software
129 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
130 + * MA 02111-1307 USA
132 + ************************************************************************/
133 +#ifndef __ooo_vba_excel_XMenuBar_idl__
134 +#define __ooo_vba_excel_XMenuBar_idl__
136 +#ifndef __com_sun_star_uno_XInterface_idl__
137 +#include <com/sun/star/uno/XInterface.idl>
138 +#endif
140 +#ifndef __ooo_vba_XHelperInterface_idl__
141 +#include <ooo/vba/XHelperInterface.idl>
142 +#endif
143 +//=============================================================================
145 +module ooo { module vba { module excel {
146 +//=============================================================================
148 +interface XMenuBar
150 + interface XHelperInterface;
152 + any Menus( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
155 +}; }; };
157 +#endif
158 diff --git oovbaapi/ooo/vba/excel/XMenuBars.idl oovbaapi/ooo/vba/excel/XMenuBars.idl
159 new file mode 100644
160 index 0000000..3a46c3b
161 --- /dev/null
162 +++ oovbaapi/ooo/vba/excel/XMenuBars.idl
163 @@ -0,0 +1,66 @@
164 +/*************************************************************************
166 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
167 + *
168 + * Copyright 2008 by Sun Microsystems, Inc.
170 + * OpenOffice.org - a multi-platform office productivity suite
172 + * $RCSfile: XMenuBars.idl,v $
173 + * $Revision: 1.0 $
175 + * This file is part of OpenOffice.org.
177 + * OpenOffice.org is free software: you can redistribute it and/or modify
178 + * it under the terms of the GNU Lesser General Public License version 3
179 + * only, as published by the Free Software Foundation.
181 + * OpenOffice.org is distributed in the hope that it will be useful,
182 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
183 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184 + * GNU Lesser General Public License version 3 for more details
185 + * (a copy is included in the LICENSE file that accompanied this code).
187 + * You should have received a copy of the GNU Lesser General Public License
188 + * version 3 along with OpenOffice.org. If not, see
189 + * <http://www.openoffice.org/license.html>
190 + * for a copy of the LGPLv3 License.
192 + ************************************************************************/
193 +#ifndef __ooo_vba_excel_XMenuBars_idl__
194 +#define __ooo_vba_excel_XMenuBars_idl__
196 +#ifndef __com_sun_star_uno_XInterface_idl__
197 +#include <com/sun/star/uno/XInterface.idl>
198 +#endif
200 +#ifndef __ooo_vba_XHelperInterface_idl__
201 +#include <ooo/vba/XHelperInterface.idl>
202 +#endif
204 +#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
205 +#include <com/sun/star/script/BasicErrorException.idl>
206 +#endif
208 +#ifndef __ooo_vba_XCollection_idl__
209 +#include <ooo/vba/XCollection.idl>
210 +#endif
212 +//=============================================================================
214 +module ooo { module vba { module excel {
216 +//=============================================================================
218 +interface XMenuBars
220 + interface ooo::vba::XCollection;
223 +//=============================================================================
225 +}; }; };
227 +#endif
230 diff --git oovbaapi/ooo/vba/excel/XMenuItem.idl oovbaapi/ooo/vba/excel/XMenuItem.idl
231 new file mode 100644
232 index 0000000..2dcfb2f
233 --- /dev/null
234 +++ oovbaapi/ooo/vba/excel/XMenuItem.idl
235 @@ -0,0 +1,62 @@
236 +/*************************************************************************
238 + * OpenOffice.org - a multi-platform office productivity suite
240 + * $RCSfile$
242 + * $Revision$
244 + * last change: $Author$ $Date$
246 + * The Contents of this file are made available subject to
247 + * the terms of GNU Lesser General Public License Version 2.1.
250 + * GNU Lesser General Public License Version 2.1
251 + * =============================================
252 + * Copyright 2005 by Sun Microsystems, Inc.
253 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
255 + * This library is free software; you can redistribute it and/or
256 + * modify it under the terms of the GNU Lesser General Public
257 + * License version 2.1, as published by the Free Software Foundation.
259 + * This library is distributed in the hope that it will be useful,
260 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
261 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
262 + * Lesser General Public License for more details.
264 + * You should have received a copy of the GNU Lesser General Public
265 + * License along with this library; if not, write to the Free Software
266 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
267 + * MA 02111-1307 USA
269 + ************************************************************************/
270 +#ifndef __ooo_vba_excel_XMenuItem_idl__
271 +#define __ooo_vba_excel_XMenuItem_idl__
273 +#ifndef __com_sun_star_uno_XInterface_idl__
274 +#include <com/sun/star/uno/XInterface.idl>
275 +#endif
277 +#ifndef __ooo_vba_XHelperInterface_idl__
278 +#include <ooo/vba/XHelperInterface.idl>
279 +#endif
280 +//=============================================================================
282 +module ooo { module vba { module excel {
283 +//=============================================================================
285 +interface XMenuItem
287 + interface XHelperInterface;
289 + [attribute] string Caption;
290 + [attribute] string OnAction;
292 + void Delete() raises ( com::sun::star::script::BasicErrorException );
295 +}; }; };
297 +#endif
298 diff --git oovbaapi/ooo/vba/excel/XMenuItems.idl oovbaapi/ooo/vba/excel/XMenuItems.idl
299 new file mode 100644
300 index 0000000..9ba7b38
301 --- /dev/null
302 +++ oovbaapi/ooo/vba/excel/XMenuItems.idl
303 @@ -0,0 +1,70 @@
304 +/*************************************************************************
306 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
307 + *
308 + * Copyright 2008 by Sun Microsystems, Inc.
310 + * OpenOffice.org - a multi-platform office productivity suite
312 + * $RCSfile: XMenuItems.idl,v $
313 + * $Revision: 1.0 $
315 + * This file is part of OpenOffice.org.
317 + * OpenOffice.org is free software: you can redistribute it and/or modify
318 + * it under the terms of the GNU Lesser General Public License version 3
319 + * only, as published by the Free Software Foundation.
321 + * OpenOffice.org is distributed in the hope that it will be useful,
322 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
323 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
324 + * GNU Lesser General Public License version 3 for more details
325 + * (a copy is included in the LICENSE file that accompanied this code).
327 + * You should have received a copy of the GNU Lesser General Public License
328 + * version 3 along with OpenOffice.org. If not, see
329 + * <http://www.openoffice.org/license.html>
330 + * for a copy of the LGPLv3 License.
332 + ************************************************************************/
333 +#ifndef __ooo_vba_excel_XMenuItems_idl__
334 +#define __ooo_vba_excel_XMenuItems_idl__
336 +#ifndef __com_sun_star_uno_XInterface_idl__
337 +#include <com/sun/star/uno/XInterface.idl>
338 +#endif
340 +#ifndef __ooo_vba_XHelperInterface_idl__
341 +#include <ooo/vba/XHelperInterface.idl>
342 +#endif
344 +#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
345 +#include <com/sun/star/script/BasicErrorException.idl>
346 +#endif
348 +#ifndef __ooo_vba_XCollection_idl__
349 +#include <ooo/vba/XCollection.idl>
350 +#endif
352 +//=============================================================================
354 +module ooo { module vba { module excel {
356 +//=============================================================================
358 +interface XMenuItem;
360 +interface XMenuItems
362 + interface ooo::vba::XCollection;
364 + XMenuItem Add( [in] string Caption, [in] any OnAction, [in] any ShortcutKey, [in] any Before, [in] any Restore, [in] any StatusBar, [in] any HelpFile, [in] any HelpContextID ) raises ( com::sun::star::script::BasicErrorException );
367 +//=============================================================================
369 +}; }; };
371 +#endif
374 diff --git oovbaapi/ooo/vba/excel/XMenus.idl oovbaapi/ooo/vba/excel/XMenus.idl
375 new file mode 100644
376 index 0000000..c8e4ea2
377 --- /dev/null
378 +++ oovbaapi/ooo/vba/excel/XMenus.idl
379 @@ -0,0 +1,70 @@
380 +/*************************************************************************
382 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
383 + *
384 + * Copyright 2008 by Sun Microsystems, Inc.
386 + * OpenOffice.org - a multi-platform office productivity suite
388 + * $RCSfile: XMenus.idl,v $
389 + * $Revision: 1.0 $
391 + * This file is part of OpenOffice.org.
393 + * OpenOffice.org is free software: you can redistribute it and/or modify
394 + * it under the terms of the GNU Lesser General Public License version 3
395 + * only, as published by the Free Software Foundation.
397 + * OpenOffice.org is distributed in the hope that it will be useful,
398 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
399 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
400 + * GNU Lesser General Public License version 3 for more details
401 + * (a copy is included in the LICENSE file that accompanied this code).
403 + * You should have received a copy of the GNU Lesser General Public License
404 + * version 3 along with OpenOffice.org. If not, see
405 + * <http://www.openoffice.org/license.html>
406 + * for a copy of the LGPLv3 License.
408 + ************************************************************************/
409 +#ifndef __ooo_vba_excel_XMenus_idl__
410 +#define __ooo_vba_excel_XMenus_idl__
412 +#ifndef __com_sun_star_uno_XInterface_idl__
413 +#include <com/sun/star/uno/XInterface.idl>
414 +#endif
416 +#ifndef __ooo_vba_XHelperInterface_idl__
417 +#include <ooo/vba/XHelperInterface.idl>
418 +#endif
420 +#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
421 +#include <com/sun/star/script/BasicErrorException.idl>
422 +#endif
424 +#ifndef __ooo_vba_XCollection_idl__
425 +#include <ooo/vba/XCollection.idl>
426 +#endif
428 +//=============================================================================
430 +module ooo { module vba { module excel {
432 +//=============================================================================
434 +interface XMenu;
436 +interface XMenus
438 + interface ooo::vba::XCollection;
440 + XMenu Add( [in] string Caption, [in] any Before, [in] any Restore ) raises ( com::sun::star::script::BasicErrorException );
443 +//=============================================================================
445 +}; }; };
447 +#endif
450 diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
451 index 232f83c..f3ad793 100644
452 --- oovbaapi/ooo/vba/excel/makefile.mk
453 +++ oovbaapi/ooo/vba/excel/makefile.mk
454 @@ -103,6 +103,12 @@ IDLFILES= XGlobals.idl\
455 XVPageBreak.idl \
456 XVPageBreaks.idl \
457 TextFrame.idl \
458 + XMenuBar.idl \
459 + XMenuBars.idl \
460 + XMenu.idl \
461 + XMenus.idl \
462 + XMenuItem.idl \
463 + XMenuItems.idl \
466 # ------------------------------------------------------------------
467 diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk
468 index 9350a3b..2f8a16f 100644
469 --- sc/source/ui/vba/makefile.mk
470 +++ sc/source/ui/vba/makefile.mk
471 @@ -104,7 +104,13 @@ SLOFILES= \
472 $(SLO)$/vbapagebreak.obj \
473 $(SLO)$/vbapagebreaks.obj \
474 $(SLO)$/service.obj \
475 - $(SLO)$/vbaeventshelper.obj
476 + $(SLO)$/vbaeventshelper.obj \
477 + $(SLO)$/vbamenubar.obj \
478 + $(SLO)$/vbamenubars.obj \
479 + $(SLO)$/vbamenu.obj \
480 + $(SLO)$/vbamenus.obj \
481 + $(SLO)$/vbamenuitem.obj \
482 + $(SLO)$/vbamenuitems.obj \
484 # --- Targets ------------------------------------------------------
486 diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
487 index c06f3bd..68d0834 100644
488 --- sc/source/ui/vba/vbaapplication.cxx
489 +++ sc/source/ui/vba/vbaapplication.cxx
490 @@ -43,6 +43,7 @@
491 #include <ooo/vba/excel/XlMousePointer.hpp>
492 #include <com/sun/star/sheet/XNamedRanges.hpp>
493 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
494 +#include<ooo/vba/XCommandBars.hpp>
496 #include "vbaapplication.hxx"
497 #include "vbaworkbooks.hxx"
498 @@ -54,6 +55,7 @@
499 #include "vbawindow.hxx"
500 #include "vbawindows.hxx"
501 #include "vbaglobals.hxx"
502 +#include "vbamenubars.hxx"
503 #include "tabvwsh.hxx"
504 #include "gridwin.hxx"
505 #include "vbanames.hxx"
506 @@ -1186,6 +1188,19 @@ ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
507 return getCurrentExcelDoc();
510 +uno::Any SAL_CALL
511 +ScVbaApplication::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
513 + uno::Reference< XCommandBars > xCommandBars( CommandBars( uno::Any() ), uno::UNO_QUERY_THROW );
514 + uno::Reference< XCollection > xMenuBars( new ScVbaMenuBars( this, mxContext, xCommandBars ) );
515 + if ( aIndex.hasValue() )
517 + return uno::Any ( xMenuBars->Item( aIndex, uno::Any() ) );
520 + return uno::Any( xMenuBars );
523 rtl::OUString&
524 ScVbaApplication::getServiceImplName()
526 diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
527 index d7098b4..8e5da56 100644
528 --- sc/source/ui/vba/vbaapplication.hxx
529 +++ sc/source/ui/vba/vbaapplication.hxx
530 @@ -101,6 +101,7 @@ public:
531 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);
532 virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) throw (css::uno::RuntimeException );
533 virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
534 + virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
535 // XHelperInterface
536 virtual rtl::OUString& getServiceImplName();
537 virtual css::uno::Sequence<rtl::OUString> getServiceNames();
538 diff --git sc/source/ui/vba/vbaglobals.cxx sc/source/ui/vba/vbaglobals.cxx
539 index d32eb78..ac5e4f5 100644
540 --- sc/source/ui/vba/vbaglobals.cxx
541 +++ sc/source/ui/vba/vbaglobals.cxx
542 @@ -211,6 +211,12 @@ ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException)
546 +uno::Any SAL_CALL
547 +ScVbaGlobals::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
549 + return uno::Any( getApplication()->MenuBars(aIndex) );
552 uno::Sequence< ::rtl::OUString > SAL_CALL
553 ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
555 diff --git sc/source/ui/vba/vbaglobals.hxx sc/source/ui/vba/vbaglobals.hxx
556 index 89861ee..66dd1fa 100644
557 --- sc/source/ui/vba/vbaglobals.hxx
558 +++ sc/source/ui/vba/vbaglobals.hxx
559 @@ -83,6 +83,8 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc
560 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);
561 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);
563 + virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
567 // XMultiServiceFactory
568 diff --git sc/source/ui/vba/vbamenu.cxx sc/source/ui/vba/vbamenu.cxx
569 new file mode 100644
570 index 0000000..58972b0
571 --- /dev/null
572 +++ sc/source/ui/vba/vbamenu.cxx
573 @@ -0,0 +1,91 @@
574 +/*************************************************************************
576 + * OpenOffice.org - a multi-platform office productivity suite
578 + * $RCSfile$
580 + * $Revision$
582 + * last change: $Author$ $Date$
584 + * The Contents of this file are made available subject to
585 + * the terms of GNU Lesser General Public License Version 2.1.
588 + * GNU Lesser General Public License Version 2.1
589 + * =============================================
590 + * Copyright 2005 by Sun Microsystems, Inc.
591 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
593 + * This library is free software; you can redistribute it and/or
594 + * modify it under the terms of the GNU Lesser General Public
595 + * License version 2.1, as published by the Free Software Foundation.
597 + * This library is distributed in the hope that it will be useful,
598 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
599 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
600 + * Lesser General Public License for more details.
602 + * You should have received a copy of the GNU Lesser General Public
603 + * License along with this library; if not, write to the Free Software
604 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
605 + * MA 02111-1307 USA
607 + ************************************************************************/
608 +#include "vbamenu.hxx"
609 +#include "vbamenuitems.hxx"
611 +using namespace com::sun::star;
612 +using namespace ooo::vba;
614 +ScVbaMenu::ScVbaMenu( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : Menu_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
618 +::rtl::OUString SAL_CALL
619 +ScVbaMenu::getCaption() throw ( uno::RuntimeException )
621 + return m_xCommandBarControl->getCaption();
624 +void SAL_CALL
625 +ScVbaMenu::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
627 + m_xCommandBarControl->setCaption( _caption );
630 +void SAL_CALL
631 +ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
633 + m_xCommandBarControl->Delete();
636 +uno::Any SAL_CALL
637 +ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
639 + uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
640 + uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
641 + if( aIndex.hasValue() )
643 + return xMenuItems->Item( aIndex, uno::Any() );
645 + return uno::makeAny( xMenuItems );
648 +rtl::OUString&
649 +ScVbaMenu::getServiceImplName()
651 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenu") );
652 + return sImplName;
654 +uno::Sequence<rtl::OUString>
655 +ScVbaMenu::getServiceNames()
657 + static uno::Sequence< rtl::OUString > aServiceNames;
658 + if ( aServiceNames.getLength() == 0 )
660 + aServiceNames.realloc( 1 );
661 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menu" ) );
663 + return aServiceNames;
665 diff --git sc/source/ui/vba/vbamenu.hxx sc/source/ui/vba/vbamenu.hxx
666 new file mode 100644
667 index 0000000..cd96857
668 --- /dev/null
669 +++ sc/source/ui/vba/vbamenu.hxx
670 @@ -0,0 +1,62 @@
671 +/*************************************************************************
673 + * OpenOffice.org - a multi-platform office productivity suite
675 + * $RCSfile$
677 + * $Revision$
679 + * last change: $Author$ $Date$
681 + * The Contents of this file are made available subject to
682 + * the terms of GNU Lesser General Public License Version 2.1.
685 + * GNU Lesser General Public License Version 2.1
686 + * =============================================
687 + * Copyright 2005 by Sun Microsystems, Inc.
688 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
690 + * This library is free software; you can redistribute it and/or
691 + * modify it under the terms of the GNU Lesser General Public
692 + * License version 2.1, as published by the Free Software Foundation.
694 + * This library is distributed in the hope that it will be useful,
695 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
696 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
697 + * Lesser General Public License for more details.
699 + * You should have received a copy of the GNU Lesser General Public
700 + * License along with this library; if not, write to the Free Software
701 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
702 + * MA 02111-1307 USA
704 + ************************************************************************/
705 +#ifndef SC_VBA_MENU_HXX
706 +#define SC_VBA_MENU_HXX
708 +#include <ooo/vba/excel/XMenu.hpp>
709 +#include <ooo/vba/XCommandBarControl.hpp>
710 +#include <vbahelper/vbahelperinterface.hxx>
712 +typedef InheritedHelperInterfaceImpl1< ov::excel::XMenu > Menu_BASE;
714 +class ScVbaMenu : public Menu_BASE
716 +private:
717 + css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
719 +public:
720 + ScVbaMenu( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) throw( css::uno::RuntimeException );
722 + virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
723 + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException);
725 + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
726 + virtual css::uno::Any SAL_CALL MenuItems( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
728 + // XHelperInterface
729 + virtual rtl::OUString& getServiceImplName();
730 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
732 +#endif//SC_VBA_MENU_HXX
733 diff --git sc/source/ui/vba/vbamenubar.cxx sc/source/ui/vba/vbamenubar.cxx
734 new file mode 100644
735 index 0000000..9386028
736 --- /dev/null
737 +++ sc/source/ui/vba/vbamenubar.cxx
738 @@ -0,0 +1,74 @@
739 +/*************************************************************************
741 + * OpenOffice.org - a multi-platform office productivity suite
743 + * $RCSfile$
745 + * $Revision$
747 + * last change: $Author$ $Date$
749 + * The Contents of this file are made available subject to
750 + * the terms of GNU Lesser General Public License Version 2.1.
753 + * GNU Lesser General Public License Version 2.1
754 + * =============================================
755 + * Copyright 2005 by Sun Microsystems, Inc.
756 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
758 + * This library is free software; you can redistribute it and/or
759 + * modify it under the terms of the GNU Lesser General Public
760 + * License version 2.1, as published by the Free Software Foundation.
762 + * This library is distributed in the hope that it will be useful,
763 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
764 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
765 + * Lesser General Public License for more details.
767 + * You should have received a copy of the GNU Lesser General Public
768 + * License along with this library; if not, write to the Free Software
769 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
770 + * MA 02111-1307 USA
772 + ************************************************************************/
773 +#include "vbamenubar.hxx"
774 +#include "vbamenus.hxx"
775 +#include <ooo/vba/XCommandBarControls.hpp>
777 +using namespace com::sun::star;
778 +using namespace ooo::vba;
780 +ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBar >& xCommandBar ) throw( uno::RuntimeException ) : MenuBar_BASE( xParent, xContext ), m_xCommandBar( xCommandBar )
784 +uno::Any SAL_CALL
785 +ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
787 + uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
788 + uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
789 + if( aIndex.hasValue() )
791 + return xMenus->Item( aIndex, uno::Any() );
793 + return uno::makeAny( xMenus );
796 +rtl::OUString&
797 +ScVbaMenuBar::getServiceImplName()
799 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBar") );
800 + return sImplName;
802 +uno::Sequence<rtl::OUString>
803 +ScVbaMenuBar::getServiceNames()
805 + static uno::Sequence< rtl::OUString > aServiceNames;
806 + if ( aServiceNames.getLength() == 0 )
808 + aServiceNames.realloc( 1 );
809 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBar" ) );
811 + return aServiceNames;
813 diff --git sc/source/ui/vba/vbamenubar.hxx sc/source/ui/vba/vbamenubar.hxx
814 new file mode 100644
815 index 0000000..fa39054
816 --- /dev/null
817 +++ sc/source/ui/vba/vbamenubar.hxx
818 @@ -0,0 +1,58 @@
819 +/*************************************************************************
821 + * OpenOffice.org - a multi-platform office productivity suite
823 + * $RCSfile$
825 + * $Revision$
827 + * last change: $Author$ $Date$
829 + * The Contents of this file are made available subject to
830 + * the terms of GNU Lesser General Public License Version 2.1.
833 + * GNU Lesser General Public License Version 2.1
834 + * =============================================
835 + * Copyright 2005 by Sun Microsystems, Inc.
836 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
838 + * This library is free software; you can redistribute it and/or
839 + * modify it under the terms of the GNU Lesser General Public
840 + * License version 2.1, as published by the Free Software Foundation.
842 + * This library is distributed in the hope that it will be useful,
843 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
844 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
845 + * Lesser General Public License for more details.
847 + * You should have received a copy of the GNU Lesser General Public
848 + * License along with this library; if not, write to the Free Software
849 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
850 + * MA 02111-1307 USA
852 + ************************************************************************/
853 +#ifndef SC_VBA_MENUBAR_HXX
854 +#define SC_VBA_MENUBAR_HXX
856 +#include <ooo/vba/excel/XMenuBar.hpp>
857 +#include <ooo/vba/XCommandBar.hpp>
858 +#include <vbahelper/vbahelperinterface.hxx>
860 +typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuBar > MenuBar_BASE;
862 +class ScVbaMenuBar : public MenuBar_BASE
864 +private:
865 + css::uno::Reference< ov::XCommandBar > m_xCommandBar;
867 +public:
868 + ScVbaMenuBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBar >& xCommandBar ) throw( css::uno::RuntimeException );
870 + virtual css::uno::Any SAL_CALL Menus( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
872 + // XHelperInterface
873 + virtual rtl::OUString& getServiceImplName();
874 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
876 +#endif//SC_VBA_MENUBAR_HXX
877 diff --git sc/source/ui/vba/vbamenubars.cxx sc/source/ui/vba/vbamenubars.cxx
878 new file mode 100644
879 index 0000000..a5f9e9b
880 --- /dev/null
881 +++ sc/source/ui/vba/vbamenubars.cxx
882 @@ -0,0 +1,146 @@
883 +/*************************************************************************
885 + * OpenOffice.org - a multi-platform office productivity suite
887 + * $RCSfile$
889 + * $Revision$
891 + * last change: $Author$ $Date$
893 + * The Contents of this file are made available subject to
894 + * the terms of GNU Lesser General Public License Version 2.1.
897 + * GNU Lesser General Public License Version 2.1
898 + * =============================================
899 + * Copyright 2005 by Sun Microsystems, Inc.
900 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
902 + * This library is free software; you can redistribute it and/or
903 + * modify it under the terms of the GNU Lesser General Public
904 + * License version 2.1, as published by the Free Software Foundation.
906 + * This library is distributed in the hope that it will be useful,
907 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
908 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
909 + * Lesser General Public License for more details.
911 + * You should have received a copy of the GNU Lesser General Public
912 + * License along with this library; if not, write to the Free Software
913 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
914 + * MA 02111-1307 USA
916 + ************************************************************************/
917 +#include "vbamenubars.hxx"
918 +#include "vbamenubar.hxx"
919 +#include <ooo/vba/excel/XlSheetType.hpp>
921 +using namespace com::sun::star;
922 +using namespace ooo::vba;
925 +typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuBarEnumeration_BASE;
927 +class MenuBarEnumeration : public MenuBarEnumeration_BASE
929 + uno::Reference< XHelperInterface > m_xParent;
930 + uno::Reference< uno::XComponentContext > m_xContext;
931 + uno::Reference< container::XEnumeration > m_xEnumeration;
932 +public:
933 + MenuBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
936 + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
938 + return m_xEnumeration->hasMoreElements();
940 + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
942 + // FIXME: should be add menubar
943 + if( hasMoreElements() )
945 + uno::Reference< XCommandBar > xCommandBar( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
946 + uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( m_xParent, m_xContext, xCommandBar ) );
947 + return uno::makeAny( xMenuBar );
949 + else
950 + throw container::NoSuchElementException();
951 + return uno::Any();
955 +ScVbaMenuBars::ScVbaMenuBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBars >& xCommandBars ) throw ( uno::RuntimeException ) : MenuBars_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBars( xCommandBars )
959 +ScVbaMenuBars::~ScVbaMenuBars()
963 +// XEnumerationAccess
964 +uno::Type SAL_CALL
965 +ScVbaMenuBars::getElementType() throw ( uno::RuntimeException )
967 + return excel::XMenuBar::static_type( 0 );
970 +uno::Reference< container::XEnumeration >
971 +ScVbaMenuBars::createEnumeration() throw ( uno::RuntimeException )
973 + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBars, uno::UNO_QUERY_THROW );
974 + return uno::Reference< container::XEnumeration >( new MenuBarEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
977 +uno::Any
978 +ScVbaMenuBars::createCollectionObject( const uno::Any& aSource )
980 + // make no sense
981 + return aSource;
984 +sal_Int32 SAL_CALL
985 +ScVbaMenuBars::getCount() throw(css::uno::RuntimeException)
987 + return m_xCommandBars->getCount();
990 +// ScVbaCollectionBaseImpl
991 +uno::Any SAL_CALL
992 +ScVbaMenuBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
994 + sal_Int16 nIndex = 0;
995 + aIndex >>= nIndex;
996 + if( nIndex == excel::XlSheetType::xlWorksheet )
998 + uno::Any aSource;
999 + aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
1000 + uno::Reference< XCommandBar > xCommandBar( m_xCommandBars->Item( aSource, uno::Any() ), uno::UNO_QUERY_THROW );
1001 + uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( this, mxContext, xCommandBar ) );
1002 + return uno::makeAny( xMenuBar );
1005 + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
1007 + return uno::Any();
1010 +// XHelperInterface
1011 +rtl::OUString&
1012 +ScVbaMenuBars::getServiceImplName()
1014 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBars") );
1015 + return sImplName;
1017 +uno::Sequence<rtl::OUString>
1018 +ScVbaMenuBars::getServiceNames()
1020 + static uno::Sequence< rtl::OUString > aServiceNames;
1021 + if ( aServiceNames.getLength() == 0 )
1023 + aServiceNames.realloc( 1 );
1024 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBars" ) );
1026 + return aServiceNames;
1029 diff --git sc/source/ui/vba/vbamenubars.hxx sc/source/ui/vba/vbamenubars.hxx
1030 new file mode 100644
1031 index 0000000..0d8ea58
1032 --- /dev/null
1033 +++ sc/source/ui/vba/vbamenubars.hxx
1034 @@ -0,0 +1,69 @@
1035 +/*************************************************************************
1037 + * OpenOffice.org - a multi-platform office productivity suite
1039 + * $RCSfile$
1041 + * $Revision$
1043 + * last change: $Author$ $Date$
1045 + * The Contents of this file are made available subject to
1046 + * the terms of GNU Lesser General Public License Version 2.1.
1049 + * GNU Lesser General Public License Version 2.1
1050 + * =============================================
1051 + * Copyright 2005 by Sun Microsystems, Inc.
1052 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1054 + * This library is free software; you can redistribute it and/or
1055 + * modify it under the terms of the GNU Lesser General Public
1056 + * License version 2.1, as published by the Free Software Foundation.
1058 + * This library is distributed in the hope that it will be useful,
1059 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1060 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1061 + * Lesser General Public License for more details.
1063 + * You should have received a copy of the GNU Lesser General Public
1064 + * License along with this library; if not, write to the Free Software
1065 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1066 + * MA 02111-1307 USA
1068 + ************************************************************************/
1069 +#ifndef SC_VBA_MENUBARS_HXX
1070 +#define SC_VBA_MENUBARS_HXX
1072 +#include <ooo/vba/excel/XMenuBars.hpp>
1073 +#include <ooo/vba/excel/XMenuBar.hpp>
1074 +#include <ooo/vba/XCommandBars.hpp>
1075 +#include <com/sun/star/container/XNameAccess.hpp>
1076 +#include <cppuhelper/implbase1.hxx>
1077 +#include <vbahelper/vbahelperinterface.hxx>
1078 +#include <vbahelper/vbacollectionimpl.hxx>
1080 +typedef CollTestImplHelper< ov::excel::XMenuBars > MenuBars_BASE;
1082 +class ScVbaMenuBars : public MenuBars_BASE
1084 +private:
1085 + css::uno::Reference< ov::XCommandBars > m_xCommandBars;
1087 +public:
1088 + ScVbaMenuBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBars >& xCommandBars ) throw (css::uno::RuntimeException);
1089 + virtual ~ScVbaMenuBars();
1091 + // XEnumerationAccess
1092 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
1093 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
1094 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
1096 + virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
1097 + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& aIndex, const css::uno::Any& /*aIndex2*/ ) throw( css::uno::RuntimeException);
1098 + // XHelperInterface
1099 + virtual rtl::OUString& getServiceImplName();
1100 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
1103 +#endif//SC_VBA_MENUBARS_HXX
1104 diff --git sc/source/ui/vba/vbamenuitem.cxx sc/source/ui/vba/vbamenuitem.cxx
1105 new file mode 100644
1106 index 0000000..48254cc
1107 --- /dev/null
1108 +++ sc/source/ui/vba/vbamenuitem.cxx
1109 @@ -0,0 +1,90 @@
1110 +/*************************************************************************
1112 + * OpenOffice.org - a multi-platform office productivity suite
1114 + * $RCSfile$
1116 + * $Revision$
1118 + * last change: $Author$ $Date$
1120 + * The Contents of this file are made available subject to
1121 + * the terms of GNU Lesser General Public License Version 2.1.
1124 + * GNU Lesser General Public License Version 2.1
1125 + * =============================================
1126 + * Copyright 2005 by Sun Microsystems, Inc.
1127 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1129 + * This library is free software; you can redistribute it and/or
1130 + * modify it under the terms of the GNU Lesser General Public
1131 + * License version 2.1, as published by the Free Software Foundation.
1133 + * This library is distributed in the hope that it will be useful,
1134 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1135 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1136 + * Lesser General Public License for more details.
1138 + * You should have received a copy of the GNU Lesser General Public
1139 + * License along with this library; if not, write to the Free Software
1140 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1141 + * MA 02111-1307 USA
1143 + ************************************************************************/
1144 +#include "vbamenuitem.hxx"
1146 +using namespace com::sun::star;
1147 +using namespace ooo::vba;
1149 +ScVbaMenuItem::ScVbaMenuItem( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : MenuItem_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
1153 +::rtl::OUString SAL_CALL
1154 +ScVbaMenuItem::getCaption() throw ( uno::RuntimeException )
1156 + return m_xCommandBarControl->getCaption();
1159 +void SAL_CALL
1160 +ScVbaMenuItem::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
1162 + m_xCommandBarControl->setCaption( _caption );
1165 +::rtl::OUString SAL_CALL
1166 +ScVbaMenuItem::getOnAction() throw ( uno::RuntimeException )
1168 + return m_xCommandBarControl->getOnAction();
1171 +void SAL_CALL
1172 +ScVbaMenuItem::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
1174 + m_xCommandBarControl->setOnAction( _onaction );
1177 +void SAL_CALL
1178 +ScVbaMenuItem::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
1180 + m_xCommandBarControl->Delete();
1183 +rtl::OUString&
1184 +ScVbaMenuItem::getServiceImplName()
1186 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItem") );
1187 + return sImplName;
1189 +uno::Sequence<rtl::OUString>
1190 +ScVbaMenuItem::getServiceNames()
1192 + static uno::Sequence< rtl::OUString > aServiceNames;
1193 + if ( aServiceNames.getLength() == 0 )
1195 + aServiceNames.realloc( 1 );
1196 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItem" ) );
1198 + return aServiceNames;
1200 diff --git sc/source/ui/vba/vbamenuitem.hxx sc/source/ui/vba/vbamenuitem.hxx
1201 new file mode 100644
1202 index 0000000..bf4c087
1203 --- /dev/null
1204 +++ sc/source/ui/vba/vbamenuitem.hxx
1205 @@ -0,0 +1,63 @@
1206 +/*************************************************************************
1208 + * OpenOffice.org - a multi-platform office productivity suite
1210 + * $RCSfile$
1212 + * $Revision$
1214 + * last change: $Author$ $Date$
1216 + * The Contents of this file are made available subject to
1217 + * the terms of GNU Lesser General Public License Version 2.1.
1220 + * GNU Lesser General Public License Version 2.1
1221 + * =============================================
1222 + * Copyright 2005 by Sun Microsystems, Inc.
1223 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1225 + * This library is free software; you can redistribute it and/or
1226 + * modify it under the terms of the GNU Lesser General Public
1227 + * License version 2.1, as published by the Free Software Foundation.
1229 + * This library is distributed in the hope that it will be useful,
1230 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1231 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1232 + * Lesser General Public License for more details.
1234 + * You should have received a copy of the GNU Lesser General Public
1235 + * License along with this library; if not, write to the Free Software
1236 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1237 + * MA 02111-1307 USA
1239 + ************************************************************************/
1240 +#ifndef SC_VBA_MENUITEM_HXX
1241 +#define SC_VBA_MENUITEM_HXX
1243 +#include <ooo/vba/excel/XMenuItem.hpp>
1244 +#include <ooo/vba/XCommandBarControl.hpp>
1245 +#include <vbahelper/vbahelperinterface.hxx>
1247 +typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuItem > MenuItem_BASE;
1249 +class ScVbaMenuItem : public MenuItem_BASE
1251 +private:
1252 + css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
1254 +public:
1255 + ScVbaMenuItem( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) throw( css::uno::RuntimeException );
1257 + virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
1258 + virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (css::uno::RuntimeException);
1259 + virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
1260 + virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
1262 + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
1264 + // XHelperInterface
1265 + virtual rtl::OUString& getServiceImplName();
1266 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
1268 +#endif//SC_VBA_MENUITEM_HXX
1269 diff --git sc/source/ui/vba/vbamenuitems.cxx sc/source/ui/vba/vbamenuitems.cxx
1270 new file mode 100644
1271 index 0000000..3a5cd79
1272 --- /dev/null
1273 +++ sc/source/ui/vba/vbamenuitems.cxx
1274 @@ -0,0 +1,159 @@
1275 +/*************************************************************************
1277 + * OpenOffice.org - a multi-platform office productivity suite
1279 + * $RCSfile$
1281 + * $Revision$
1283 + * last change: $Author$ $Date$
1285 + * The Contents of this file are made available subject to
1286 + * the terms of GNU Lesser General Public License Version 2.1.
1289 + * GNU Lesser General Public License Version 2.1
1290 + * =============================================
1291 + * Copyright 2005 by Sun Microsystems, Inc.
1292 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1294 + * This library is free software; you can redistribute it and/or
1295 + * modify it under the terms of the GNU Lesser General Public
1296 + * License version 2.1, as published by the Free Software Foundation.
1298 + * This library is distributed in the hope that it will be useful,
1299 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1300 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1301 + * Lesser General Public License for more details.
1303 + * You should have received a copy of the GNU Lesser General Public
1304 + * License along with this library; if not, write to the Free Software
1305 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1306 + * MA 02111-1307 USA
1308 + ************************************************************************/
1309 +#include "vbamenuitems.hxx"
1310 +#include "vbamenuitem.hxx"
1311 +#include "vbamenu.hxx"
1312 +#include <ooo/vba/office/MsoControlType.hpp>
1314 +using namespace com::sun::star;
1315 +using namespace ooo::vba;
1318 +typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
1320 +class MenuEnumeration : public MenuEnumeration_BASE
1322 + uno::Reference< XHelperInterface > m_xParent;
1323 + uno::Reference< uno::XComponentContext > m_xContext;
1324 + uno::Reference< container::XEnumeration > m_xEnumeration;
1325 +public:
1326 + MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
1329 + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
1331 + return m_xEnumeration->hasMoreElements();
1333 + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
1335 + // FIXME: should be add menu
1336 + if( hasMoreElements() )
1338 + uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
1339 + if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
1341 + uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
1342 + return uno::makeAny( xMenu );
1344 + else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
1346 + uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) );
1347 + return uno::makeAny( xMenuItem );
1349 + nextElement();
1351 + else
1352 + throw container::NoSuchElementException();
1353 + return uno::Any();
1357 +ScVbaMenuItems::ScVbaMenuItems( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : MenuItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
1361 +// XEnumerationAccess
1362 +uno::Type SAL_CALL
1363 +ScVbaMenuItems::getElementType() throw ( uno::RuntimeException )
1365 + return excel::XMenuItem::static_type( 0 );
1368 +uno::Reference< container::XEnumeration >
1369 +ScVbaMenuItems::createEnumeration() throw ( uno::RuntimeException )
1371 + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
1372 + return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
1375 +uno::Any
1376 +ScVbaMenuItems::createCollectionObject( const uno::Any& aSource )
1378 + // make no sense
1379 + return aSource;
1382 +sal_Int32 SAL_CALL
1383 +ScVbaMenuItems::getCount() throw(css::uno::RuntimeException)
1385 + // FIXME: should check if it is a popup menu
1386 + return m_xCommandBarControls->getCount();
1389 +// ScVbaCollectionBaseImpl
1390 +uno::Any SAL_CALL
1391 +ScVbaMenuItems::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
1393 + uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
1394 + if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
1395 + return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
1396 + else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
1397 + return uno::makeAny( uno::Reference< excel::XMenuItem > ( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) ) );
1398 + throw uno::RuntimeException();
1401 +uno::Reference< excel::XMenuItem > SAL_CALL ScVbaMenuItems::Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& /*ShortcutKey*/, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& /*StatusBar*/, const css::uno::Any& /*HelpFile*/, const css::uno::Any& /*HelpContextID*/ ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
1403 + sal_Int32 nType = office::MsoControlType::msoControlButton;
1404 + uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
1405 + xCommandBarControl->setCaption( Caption );
1406 + if( OnAction.hasValue() )
1408 + rtl::OUString sAction;
1409 + OnAction >>= sAction;
1410 + xCommandBarControl->setOnAction( sAction );
1412 + return uno::Reference< excel::XMenuItem >( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) );
1415 +// XHelperInterface
1416 +rtl::OUString&
1417 +ScVbaMenuItems::getServiceImplName()
1419 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItems") );
1420 + return sImplName;
1422 +uno::Sequence<rtl::OUString>
1423 +ScVbaMenuItems::getServiceNames()
1425 + static uno::Sequence< rtl::OUString > aServiceNames;
1426 + if ( aServiceNames.getLength() == 0 )
1428 + aServiceNames.realloc( 1 );
1429 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItems" ) );
1431 + return aServiceNames;
1434 diff --git sc/source/ui/vba/vbamenuitems.hxx sc/source/ui/vba/vbamenuitems.hxx
1435 new file mode 100644
1436 index 0000000..8aeb931
1437 --- /dev/null
1438 +++ sc/source/ui/vba/vbamenuitems.hxx
1439 @@ -0,0 +1,68 @@
1440 +/*************************************************************************
1442 + * OpenOffice.org - a multi-platform office productivity suite
1444 + * $RCSfile$
1446 + * $Revision$
1448 + * last change: $Author$ $Date$
1450 + * The Contents of this file are made available subject to
1451 + * the terms of GNU Lesser General Public License Version 2.1.
1454 + * GNU Lesser General Public License Version 2.1
1455 + * =============================================
1456 + * Copyright 2005 by Sun Microsystems, Inc.
1457 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1459 + * This library is free software; you can redistribute it and/or
1460 + * modify it under the terms of the GNU Lesser General Public
1461 + * License version 2.1, as published by the Free Software Foundation.
1463 + * This library is distributed in the hope that it will be useful,
1464 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1465 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1466 + * Lesser General Public License for more details.
1468 + * You should have received a copy of the GNU Lesser General Public
1469 + * License along with this library; if not, write to the Free Software
1470 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1471 + * MA 02111-1307 USA
1473 + ************************************************************************/
1474 +#ifndef SC_VBA_MENUITEMS_HXX
1475 +#define SC_VBA_MENUITEMS_HXX
1477 +#include <ooo/vba/excel/XMenuItems.hpp>
1478 +#include <ooo/vba/excel/XMenuItem.hpp>
1479 +#include <ooo/vba/XCommandBarControls.hpp>
1480 +#include <vbahelper/vbahelperinterface.hxx>
1481 +#include <vbahelper/vbacollectionimpl.hxx>
1483 +typedef CollTestImplHelper< ov::excel::XMenuItems > MenuItems_BASE;
1485 +class ScVbaMenuItems : public MenuItems_BASE
1487 +private:
1488 + css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
1490 +public:
1491 + ScVbaMenuItems( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) throw( css::uno::RuntimeException );
1493 + // XEnumerationAccess
1494 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
1495 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
1496 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
1498 + // Methods
1499 + virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
1500 + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
1501 + virtual css::uno::Reference< ov::excel::XMenuItem > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& ShortcutKey, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& StatusBar, const css::uno::Any& HelpFile, const css::uno::Any& HelpContextID ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
1502 + // XHelperInterface
1503 + virtual rtl::OUString& getServiceImplName();
1504 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
1507 +#endif//SC_VBA_MENUITEMS_HXX
1508 diff --git sc/source/ui/vba/vbamenus.cxx sc/source/ui/vba/vbamenus.cxx
1509 new file mode 100644
1510 index 0000000..7d5a21b
1511 --- /dev/null
1512 +++ sc/source/ui/vba/vbamenus.cxx
1513 @@ -0,0 +1,145 @@
1514 +/*************************************************************************
1516 + * OpenOffice.org - a multi-platform office productivity suite
1518 + * $RCSfile$
1520 + * $Revision$
1522 + * last change: $Author$ $Date$
1524 + * The Contents of this file are made available subject to
1525 + * the terms of GNU Lesser General Public License Version 2.1.
1528 + * GNU Lesser General Public License Version 2.1
1529 + * =============================================
1530 + * Copyright 2005 by Sun Microsystems, Inc.
1531 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1533 + * This library is free software; you can redistribute it and/or
1534 + * modify it under the terms of the GNU Lesser General Public
1535 + * License version 2.1, as published by the Free Software Foundation.
1537 + * This library is distributed in the hope that it will be useful,
1538 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1539 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1540 + * Lesser General Public License for more details.
1542 + * You should have received a copy of the GNU Lesser General Public
1543 + * License along with this library; if not, write to the Free Software
1544 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1545 + * MA 02111-1307 USA
1547 + ************************************************************************/
1548 +#include "vbamenus.hxx"
1549 +#include "vbamenu.hxx"
1550 +#include <ooo/vba/office/MsoControlType.hpp>
1552 +using namespace com::sun::star;
1553 +using namespace ooo::vba;
1556 +typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
1558 +class MenuEnumeration : public MenuEnumeration_BASE
1560 + uno::Reference< XHelperInterface > m_xParent;
1561 + uno::Reference< uno::XComponentContext > m_xContext;
1562 + uno::Reference< container::XEnumeration > m_xEnumeration;
1563 +public:
1564 + MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
1567 + virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
1569 + return m_xEnumeration->hasMoreElements();
1571 + virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
1573 + // FIXME: should be add menu
1574 + if( hasMoreElements() )
1576 + uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
1577 + if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
1579 + uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
1580 + return uno::makeAny( xMenu );
1582 + nextElement();
1584 + else
1585 + throw container::NoSuchElementException();
1586 + return uno::Any();
1590 +ScVbaMenus::ScVbaMenus( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : Menus_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
1594 +// XEnumerationAccess
1595 +uno::Type SAL_CALL
1596 +ScVbaMenus::getElementType() throw ( uno::RuntimeException )
1598 + return excel::XMenu::static_type( 0 );
1601 +uno::Reference< container::XEnumeration >
1602 +ScVbaMenus::createEnumeration() throw ( uno::RuntimeException )
1604 + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
1605 + return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
1608 +uno::Any
1609 +ScVbaMenus::createCollectionObject( const uno::Any& aSource )
1611 + // make no sense
1612 + return aSource;
1615 +sal_Int32 SAL_CALL
1616 +ScVbaMenus::getCount() throw(css::uno::RuntimeException)
1618 + // FIXME: should check if it is a popup menu
1619 + return m_xCommandBarControls->getCount();
1622 +// ScVbaCollectionBaseImpl
1623 +uno::Any SAL_CALL
1624 +ScVbaMenus::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
1626 + uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
1627 + if( xCommandBarControl->getType() != office::MsoControlType::msoControlPopup )
1628 + throw uno::RuntimeException();
1629 + return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
1632 +uno::Reference< excel::XMenu > SAL_CALL ScVbaMenus::Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
1634 + sal_Int32 nType = office::MsoControlType::msoControlPopup;
1635 + uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
1636 + xCommandBarControl->setCaption( Caption );
1637 + return uno::Reference< excel::XMenu >( new ScVbaMenu( this, mxContext, xCommandBarControl ) );
1640 +// XHelperInterface
1641 +rtl::OUString&
1642 +ScVbaMenus::getServiceImplName()
1644 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenus") );
1645 + return sImplName;
1647 +uno::Sequence<rtl::OUString>
1648 +ScVbaMenus::getServiceNames()
1650 + static uno::Sequence< rtl::OUString > aServiceNames;
1651 + if ( aServiceNames.getLength() == 0 )
1653 + aServiceNames.realloc( 1 );
1654 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menus" ) );
1656 + return aServiceNames;
1659 diff --git sc/source/ui/vba/vbamenus.hxx sc/source/ui/vba/vbamenus.hxx
1660 new file mode 100644
1661 index 0000000..596127e
1662 --- /dev/null
1663 +++ sc/source/ui/vba/vbamenus.hxx
1664 @@ -0,0 +1,68 @@
1665 +/*************************************************************************
1667 + * OpenOffice.org - a multi-platform office productivity suite
1669 + * $RCSfile$
1671 + * $Revision$
1673 + * last change: $Author$ $Date$
1675 + * The Contents of this file are made available subject to
1676 + * the terms of GNU Lesser General Public License Version 2.1.
1679 + * GNU Lesser General Public License Version 2.1
1680 + * =============================================
1681 + * Copyright 2005 by Sun Microsystems, Inc.
1682 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1684 + * This library is free software; you can redistribute it and/or
1685 + * modify it under the terms of the GNU Lesser General Public
1686 + * License version 2.1, as published by the Free Software Foundation.
1688 + * This library is distributed in the hope that it will be useful,
1689 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1690 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1691 + * Lesser General Public License for more details.
1693 + * You should have received a copy of the GNU Lesser General Public
1694 + * License along with this library; if not, write to the Free Software
1695 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1696 + * MA 02111-1307 USA
1698 + ************************************************************************/
1699 +#ifndef SC_VBA_MENUS_HXX
1700 +#define SC_VBA_MENUS_HXX
1702 +#include <ooo/vba/excel/XMenus.hpp>
1703 +#include <ooo/vba/excel/XMenu.hpp>
1704 +#include <ooo/vba/XCommandBarControls.hpp>
1705 +#include <vbahelper/vbahelperinterface.hxx>
1706 +#include <vbahelper/vbacollectionimpl.hxx>
1708 +typedef CollTestImplHelper< ov::excel::XMenus > Menus_BASE;
1710 +class ScVbaMenus : public Menus_BASE
1712 +private:
1713 + css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
1715 +public:
1716 + ScVbaMenus( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) throw( css::uno::RuntimeException );
1718 + // XEnumerationAccess
1719 + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
1720 + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
1721 + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
1723 + // Methods
1724 + virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
1725 + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
1726 + virtual css::uno::Reference< ov::excel::XMenu > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
1727 + // XHelperInterface
1728 + virtual rtl::OUString& getServiceImplName();
1729 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
1732 +#endif//SC_VBA_MENUS_HXX