Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef SC_VBA_SHEETOBJECT_HXX
21 : : #define SC_VBA_SHEETOBJECT_HXX
22 : :
23 : : #include <memory>
24 : : #include <ooo/vba/excel/XButton.hpp>
25 : : #include <ooo/vba/excel/XControlObject.hpp>
26 : : #include <ooo/vba/excel/XSheetObject.hpp>
27 : : #include <vbahelper/vbahelperinterface.hxx>
28 : : #include "vbapalette.hxx"
29 : :
30 : : namespace com { namespace sun { namespace star {
31 : : namespace container { class XIndexContainer; }
32 : : namespace drawing { class XControlShape; }
33 : : } } }
34 : :
35 : : // ============================================================================
36 : :
37 : : typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaButtonCharacters_BASE;
38 : :
39 : : /** Simple implementation of the Characters symbol for drawing button objects. */
40 : : class ScVbaButtonCharacters : public ScVbaButtonCharacters_BASE
41 : : {
42 : : public:
43 : : explicit ScVbaButtonCharacters(
44 : : const css::uno::Reference< ov::XHelperInterface >& rxParent,
45 : : const css::uno::Reference< css::uno::XComponentContext >& rxContext,
46 : : const css::uno::Reference< css::beans::XPropertySet >& rxPropSet,
47 : : const ScVbaPalette& rPalette,
48 : : const css::uno::Any& rStart,
49 : : const css::uno::Any& rLength ) throw (css::uno::RuntimeException);
50 : : virtual ~ScVbaButtonCharacters();
51 : :
52 : : // XCharacters attributes
53 : : virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
54 : : virtual void SAL_CALL setCaption( const ::rtl::OUString& rCaption ) throw (css::uno::RuntimeException);
55 : : virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
56 : : virtual void SAL_CALL setText( const ::rtl::OUString& rText ) throw (css::uno::RuntimeException);
57 : : virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
58 : : virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
59 : : virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& rxFont ) throw (css::uno::RuntimeException);
60 : :
61 : : // XCharacters methods
62 : : virtual void SAL_CALL Insert( const ::rtl::OUString& rString ) throw (css::uno::RuntimeException);
63 : : virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
64 : :
65 : : // XHelperInterface
66 : : VBAHELPER_DECL_XHELPERINTERFACE
67 : :
68 : : private:
69 : : ::rtl::OUString getFullString() const throw (css::uno::RuntimeException);
70 : : void setFullString( const ::rtl::OUString& rString ) throw (css::uno::RuntimeException);
71 : :
72 : : private:
73 : : ScVbaPalette maPalette;
74 : : css::uno::Reference< css::beans::XPropertySet > mxPropSet;
75 : : sal_Int32 mnStart;
76 : : sal_Int32 mnLength;
77 : : };
78 : :
79 : : // ============================================================================
80 : :
81 : : typedef InheritedHelperInterfaceImpl1< ov::excel::XSheetObject > ScVbaSheetObject_BASE;
82 : :
83 : : /** Base class for drawing objects embedded in sheets. */
84 [ # # ]: 0 : class ScVbaSheetObjectBase : public ScVbaSheetObject_BASE
85 : : {
86 : : public:
87 : : explicit ScVbaSheetObjectBase(
88 : : const css::uno::Reference< ov::XHelperInterface >& rxParent,
89 : : const css::uno::Reference< css::uno::XComponentContext >& rxContext,
90 : : const css::uno::Reference< css::frame::XModel >& rxModel,
91 : : const css::uno::Reference< css::drawing::XShape >& rxShape ) throw (css::uno::RuntimeException);
92 : :
93 : : // XSheetObject attributes
94 : : virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
95 : : virtual void SAL_CALL setLeft( double fLeft ) throw (css::uno::RuntimeException);
96 : : virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
97 : : virtual void SAL_CALL setTop( double fTop ) throw (css::uno::RuntimeException);
98 : : virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
99 : : virtual void SAL_CALL setWidth( double fWidth ) throw (css::uno::RuntimeException);
100 : : virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
101 : : virtual void SAL_CALL setHeight( double fHeight ) throw (css::uno::RuntimeException);
102 : : virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
103 : : virtual void SAL_CALL setName( const ::rtl::OUString& rName ) throw (css::uno::RuntimeException);
104 : : virtual sal_Int32 SAL_CALL getPlacement() throw (css::uno::RuntimeException);
105 : : virtual void SAL_CALL setPlacement( sal_Int32 nPlacement ) throw (css::uno::RuntimeException);
106 : : virtual sal_Bool SAL_CALL getPrintObject() throw (css::uno::RuntimeException);
107 : : virtual void SAL_CALL setPrintObject( sal_Bool bPrintObject ) throw (css::uno::RuntimeException);
108 : :
109 : : /** Sets default properties after a new object has been created. */
110 : : void setDefaultProperties( sal_Int32 nIndex ) throw (css::uno::RuntimeException);
111 : :
112 : : protected:
113 : : /** Derived classes return the base name used for new objects. */
114 : : virtual ::rtl::OUString implGetBaseName() const = 0;
115 : : /** Derived classes set default properties for new drawing objects. */
116 : : virtual void implSetDefaultProperties() throw (css::uno::RuntimeException);
117 : :
118 : : protected:
119 : : ScVbaPalette maPalette;
120 : : css::uno::Reference< css::frame::XModel > mxModel;
121 : : css::uno::Reference< css::drawing::XShape > mxShape;
122 : : css::uno::Reference< css::beans::XPropertySet > mxShapeProps;
123 : : };
124 : :
125 : : // ============================================================================
126 : :
127 : : typedef ::cppu::ImplInheritanceHelper1< ScVbaSheetObjectBase, ov::excel::XControlObject > ScVbaControlObject_BASE;
128 : :
129 [ # # ]: 0 : class ScVbaControlObjectBase : public ScVbaControlObject_BASE
130 : : {
131 : : public:
132 : : /** Specifies the listener used for OnAction events. */
133 : : enum ListenerType
134 : : {
135 : : LISTENER_ACTION, /// XActionListener.actionPerformed
136 : : LISTENER_MOUSE, /// XMouseListener.mouseReleased
137 : : LISTENER_TEXT, /// XTextListener.textChanged
138 : : LISTENER_VALUE, /// XAdjustmentListener.adjustmentValueChanged
139 : : LISTENER_CHANGE /// XChangeListener.changed
140 : : };
141 : :
142 : : explicit ScVbaControlObjectBase(
143 : : const css::uno::Reference< ov::XHelperInterface >& rxParent,
144 : : const css::uno::Reference< css::uno::XComponentContext >& rxContext,
145 : : const css::uno::Reference< css::frame::XModel >& rxModel,
146 : : const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
147 : : const css::uno::Reference< css::drawing::XControlShape >& rxControlShape,
148 : : ListenerType eListenerType ) throw (css::uno::RuntimeException);
149 : :
150 : : // XSheetObject attributes
151 : : virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
152 : : virtual void SAL_CALL setName( const ::rtl::OUString& rName ) throw (css::uno::RuntimeException);
153 : : virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
154 : : virtual void SAL_CALL setOnAction( const ::rtl::OUString& rMacroName ) throw (css::uno::RuntimeException);
155 : : virtual sal_Bool SAL_CALL getPrintObject() throw (css::uno::RuntimeException);
156 : : virtual void SAL_CALL setPrintObject( sal_Bool bPrintObject ) throw (css::uno::RuntimeException);
157 : :
158 : : // XControlObject attributes
159 : : virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
160 : : virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
161 : :
162 : : protected:
163 : : sal_Int32 getModelIndexInForm() const throw (css::uno::RuntimeException);
164 : :
165 : : protected:
166 : : css::uno::Reference< css::container::XIndexContainer > mxFormIC;
167 : : css::uno::Reference< css::beans::XPropertySet > mxControlProps;
168 : : ::rtl::OUString maListenerType;
169 : : ::rtl::OUString maEventMethod;
170 : : };
171 : :
172 : : // ============================================================================
173 : :
174 : : typedef ::cppu::ImplInheritanceHelper1< ScVbaControlObjectBase, ov::excel::XButton > ScVbaButton_BASE;
175 : :
176 [ # # ]: 0 : class ScVbaButton : public ScVbaButton_BASE
177 : : {
178 : : public:
179 : : explicit ScVbaButton(
180 : : const css::uno::Reference< ov::XHelperInterface >& rxParent,
181 : : const css::uno::Reference< css::uno::XComponentContext >& rxContext,
182 : : const css::uno::Reference< css::frame::XModel >& rxModel,
183 : : const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
184 : : const css::uno::Reference< css::drawing::XControlShape >& rxControlShape ) throw (css::uno::RuntimeException);
185 : :
186 : : // XButton attributes
187 : : virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
188 : : virtual void SAL_CALL setCaption( const ::rtl::OUString& rCaption ) throw (css::uno::RuntimeException);
189 : : virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
190 : : virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& rxFont ) throw (css::uno::RuntimeException);
191 : : virtual sal_Int32 SAL_CALL getHorizontalAlignment() throw (css::uno::RuntimeException);
192 : : virtual void SAL_CALL setHorizontalAlignment( sal_Int32 nAlign ) throw (css::uno::RuntimeException);
193 : : virtual sal_Int32 SAL_CALL getVerticalAlignment() throw (css::uno::RuntimeException);
194 : : virtual void SAL_CALL setVerticalAlignment( sal_Int32 nAlign ) throw (css::uno::RuntimeException);
195 : : virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException);
196 : : virtual void SAL_CALL setOrientation( sal_Int32 nOrientation ) throw (css::uno::RuntimeException);
197 : :
198 : : // XButton methods
199 : : css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters(
200 : : const css::uno::Any& rStart, const css::uno::Any& rLength ) throw (css::uno::RuntimeException);
201 : :
202 : : // XHelperInterface
203 : : VBAHELPER_DECL_XHELPERINTERFACE
204 : :
205 : : protected:
206 : : virtual ::rtl::OUString implGetBaseName() const;
207 : : virtual void implSetDefaultProperties() throw (css::uno::RuntimeException);
208 : : };
209 : :
210 : : // ============================================================================
211 : :
212 : : #endif
213 : :
214 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|