xref: /trunk/main/sc/source/ui/vba/vbasheetobjects.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_VBA_SHEETOBJECTS_HXX
25 #define SC_VBA_SHEETOBJECTS_HXX
26 
27 #include <ooo/vba/excel/XGraphicObjects.hpp>
28 #include <vbahelper/vbacollectionimpl.hxx>
29 #include <rtl/ref.hxx>
30 
31 namespace com { namespace sun { namespace star {
32     namespace container { class XEnumeration; }
33     namespace frame { class XModel; }
34     namespace sheet { class XSpreadsheet; }
35 } } }
36 
37 // ============================================================================
38 
39 class ScVbaObjectContainer;
40 typedef ::rtl::Reference< ScVbaObjectContainer > ScVbaObjectContainerRef;
41 
42 // ============================================================================
43 
44 typedef CollTestImplHelper< ov::XCollection > ScVbaSheetObjects_BASE;
45 
46 /** Base class for collections containing a specific type of drawing object
47     embedded in a sheet (worksheet, chart sheet, or dialog sheet).
48  */
49 class ScVbaSheetObjectsBase : public ScVbaSheetObjects_BASE
50 {
51 public:
52     explicit ScVbaSheetObjectsBase( const ScVbaObjectContainerRef& rxContainer ) throw (css::uno::RuntimeException);
53     virtual ~ScVbaSheetObjectsBase();
54 
55     /** Updates the collection by fetching all shapes from the draw page. */
56     void collectShapes() throw (css::uno::RuntimeException);
57 
58     // XEnumerationAccess
59     virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
60 
61     // XElementAccess
62     virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
63 
64     // ScVbaCollectionBase
65     virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource );
66     virtual css::uno::Any getItemByStringIndex( const ::rtl::OUString& rIndex ) throw (css::uno::RuntimeException);
67 
68 protected:
69     ScVbaObjectContainerRef mxContainer;
70 };
71 
72 // ============================================================================
73 
74 typedef ::cppu::ImplInheritanceHelper1< ScVbaSheetObjectsBase, ov::excel::XGraphicObjects > ScVbaGraphicObjects_BASE;
75 
76 /** Base class for collections containing a specific type of graphic object
77     from a sheet.
78  */
79 class ScVbaGraphicObjectsBase : public ScVbaGraphicObjects_BASE
80 {
81 public:
82     explicit ScVbaGraphicObjectsBase( const ScVbaObjectContainerRef& rxContainer ) throw (css::uno::RuntimeException);
83 
84     // XGraphicObjects
85     virtual css::uno::Any SAL_CALL Add(
86         const css::uno::Any& rLeft,
87         const css::uno::Any& rTop,
88         const css::uno::Any& rWidth,
89         const css::uno::Any& rHeight ) throw (css::uno::RuntimeException);
90 };
91 
92 // ============================================================================
93 
94 /** Collection containing all button controls from a sheet (not ActiveX controls). */
95 class ScVbaButtons : public ScVbaGraphicObjectsBase
96 {
97 public:
98     explicit ScVbaButtons(
99         const css::uno::Reference< ov::XHelperInterface >& rxParent,
100         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
101         const css::uno::Reference< css::frame::XModel >& rxModel,
102         const css::uno::Reference< css::sheet::XSpreadsheet >& rxSheet ) throw (css::uno::RuntimeException);
103 
104     VBAHELPER_DECL_XHELPERINTERFACE
105 };
106 
107 // ============================================================================
108 
109 #endif
110