xref: /aoo41x/main/sc/source/ui/vba/vbasheetobjects.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_VBA_SHEETOBJECTS_HXX
29 #define SC_VBA_SHEETOBJECTS_HXX
30 
31 #include <ooo/vba/excel/XGraphicObjects.hpp>
32 #include <vbahelper/vbacollectionimpl.hxx>
33 #include <rtl/ref.hxx>
34 
35 namespace com { namespace sun { namespace star {
36     namespace container { class XEnumeration; }
37     namespace frame { class XModel; }
38     namespace sheet { class XSpreadsheet; }
39 } } }
40 
41 // ============================================================================
42 
43 class ScVbaObjectContainer;
44 typedef ::rtl::Reference< ScVbaObjectContainer > ScVbaObjectContainerRef;
45 
46 // ============================================================================
47 
48 typedef CollTestImplHelper< ov::XCollection > ScVbaSheetObjects_BASE;
49 
50 /** Base class for collections containing a specific type of drawing object
51     embedded in a sheet (worksheet, chart sheet, or dialog sheet).
52  */
53 class ScVbaSheetObjectsBase : public ScVbaSheetObjects_BASE
54 {
55 public:
56     explicit ScVbaSheetObjectsBase( const ScVbaObjectContainerRef& rxContainer ) throw (css::uno::RuntimeException);
57     virtual ~ScVbaSheetObjectsBase();
58 
59     /** Updates the collection by fetching all shapes from the draw page. */
60     void collectShapes() throw (css::uno::RuntimeException);
61 
62     // XEnumerationAccess
63     virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
64 
65     // XElementAccess
66     virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
67 
68     // ScVbaCollectionBase
69     virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource );
70     virtual css::uno::Any getItemByStringIndex( const ::rtl::OUString& rIndex ) throw (css::uno::RuntimeException);
71 
72 protected:
73     ScVbaObjectContainerRef mxContainer;
74 };
75 
76 // ============================================================================
77 
78 typedef ::cppu::ImplInheritanceHelper1< ScVbaSheetObjectsBase, ov::excel::XGraphicObjects > ScVbaGraphicObjects_BASE;
79 
80 /** Base class for collections containing a specific type of graphic object
81     from a sheet.
82  */
83 class ScVbaGraphicObjectsBase : public ScVbaGraphicObjects_BASE
84 {
85 public:
86     explicit ScVbaGraphicObjectsBase( const ScVbaObjectContainerRef& rxContainer ) throw (css::uno::RuntimeException);
87 
88     // XGraphicObjects
89     virtual css::uno::Any SAL_CALL Add(
90         const css::uno::Any& rLeft,
91         const css::uno::Any& rTop,
92         const css::uno::Any& rWidth,
93         const css::uno::Any& rHeight ) throw (css::uno::RuntimeException);
94 };
95 
96 // ============================================================================
97 
98 /** Collection containing all button controls from a sheet (not ActiveX controls). */
99 class ScVbaButtons : public ScVbaGraphicObjectsBase
100 {
101 public:
102     explicit ScVbaButtons(
103         const css::uno::Reference< ov::XHelperInterface >& rxParent,
104         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
105         const css::uno::Reference< css::frame::XModel >& rxModel,
106         const css::uno::Reference< css::sheet::XSpreadsheet >& rxSheet ) throw (css::uno::RuntimeException);
107 
108     VBAHELPER_DECL_XHELPERINTERFACE
109 };
110 
111 // ============================================================================
112 
113 #endif
114