1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_VBA_VBASHEETOBJECT_HXX
21 #define INCLUDED_SC_SOURCE_UI_VBA_VBASHEETOBJECT_HXX
23 #include <ooo/vba/excel/XButton.hpp>
24 #include <ooo/vba/excel/XControlObject.hpp>
25 #include <ooo/vba/excel/XSheetObject.hpp>
26 #include <vbahelper/vbahelperinterface.hxx>
27 #include "vbapalette.hxx"
29 namespace com
{ namespace sun
{ namespace star
{
30 namespace container
{ class XIndexContainer
; }
31 namespace drawing
{ class XControlShape
; }
34 typedef InheritedHelperInterfaceImpl1
< ov::excel::XCharacters
> ScVbaButtonCharacters_BASE
;
36 /** Simple implementation of the Characters symbol for drawing button objects. */
37 class ScVbaButtonCharacters
: public ScVbaButtonCharacters_BASE
40 explicit ScVbaButtonCharacters(
41 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
42 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
43 const css::uno::Reference
< css::beans::XPropertySet
>& rxPropSet
,
44 const ScVbaPalette
& rPalette
,
45 const css::uno::Any
& rStart
,
46 const css::uno::Any
& rLength
) throw (css::uno::RuntimeException
);
47 virtual ~ScVbaButtonCharacters();
49 // XCharacters attributes
50 virtual OUString SAL_CALL
getCaption() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
51 virtual void SAL_CALL
setCaption( const OUString
& rCaption
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
52 virtual OUString SAL_CALL
getText() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
53 virtual void SAL_CALL
setText( const OUString
& rText
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
54 virtual sal_Int32 SAL_CALL
getCount() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
55 virtual css::uno::Reference
< ov::excel::XFont
> SAL_CALL
getFont() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
56 virtual void SAL_CALL
setFont( const css::uno::Reference
< ov::excel::XFont
>& rxFont
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
58 // XCharacters methods
59 virtual void SAL_CALL
Insert( const OUString
& rString
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
60 virtual void SAL_CALL
Delete() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
63 VBAHELPER_DECL_XHELPERINTERFACE
66 OUString
getFullString() const throw (css::uno::RuntimeException
);
67 void setFullString( const OUString
& rString
) throw (css::uno::RuntimeException
);
70 ScVbaPalette maPalette
;
71 css::uno::Reference
< css::beans::XPropertySet
> mxPropSet
;
76 typedef InheritedHelperInterfaceImpl1
< ov::excel::XSheetObject
> ScVbaSheetObject_BASE
;
78 /** Base class for drawing objects embedded in sheets. */
79 class ScVbaSheetObjectBase
: public ScVbaSheetObject_BASE
82 explicit ScVbaSheetObjectBase(
83 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
84 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
85 const css::uno::Reference
< css::frame::XModel
>& rxModel
,
86 const css::uno::Reference
< css::drawing::XShape
>& rxShape
) throw (css::uno::RuntimeException
);
88 // XSheetObject attributes
89 virtual double SAL_CALL
getLeft() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual void SAL_CALL
setLeft( double fLeft
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual double SAL_CALL
getTop() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual void SAL_CALL
setTop( double fTop
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual double SAL_CALL
getWidth() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual void SAL_CALL
setWidth( double fWidth
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual double SAL_CALL
getHeight() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual void SAL_CALL
setHeight( double fHeight
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual OUString SAL_CALL
getName() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual void SAL_CALL
setName( const OUString
& rName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual sal_Int32 SAL_CALL
getPlacement() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual void SAL_CALL
setPlacement( sal_Int32 nPlacement
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual sal_Bool SAL_CALL
getPrintObject() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
setPrintObject( sal_Bool bPrintObject
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 /** Sets default properties after a new object has been created. */
105 void setDefaultProperties( sal_Int32 nIndex
) throw (css::uno::RuntimeException
);
108 /** Derived classes return the base name used for new objects. */
109 virtual OUString
implGetBaseName() const = 0;
110 /** Derived classes set default properties for new drawing objects. */
111 virtual void implSetDefaultProperties() throw (css::uno::RuntimeException
);
114 ScVbaPalette maPalette
;
115 css::uno::Reference
< css::frame::XModel
> mxModel
;
116 css::uno::Reference
< css::drawing::XShape
> mxShape
;
117 css::uno::Reference
< css::beans::XPropertySet
> mxShapeProps
;
120 typedef ::cppu::ImplInheritanceHelper1
< ScVbaSheetObjectBase
, ov::excel::XControlObject
> ScVbaControlObject_BASE
;
122 class ScVbaControlObjectBase
: public ScVbaControlObject_BASE
125 /** Specifies the listener used for OnAction events. */
128 LISTENER_ACTION
, /// XActionListener.actionPerformed
129 LISTENER_MOUSE
, /// XMouseListener.mouseReleased
130 LISTENER_TEXT
, /// XTextListener.textChanged
131 LISTENER_VALUE
, /// XAdjustmentListener.adjustmentValueChanged
132 LISTENER_CHANGE
/// XChangeListener.changed
135 explicit ScVbaControlObjectBase(
136 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
137 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
138 const css::uno::Reference
< css::frame::XModel
>& rxModel
,
139 const css::uno::Reference
< css::container::XIndexContainer
>& rxFormIC
,
140 const css::uno::Reference
< css::drawing::XControlShape
>& rxControlShape
,
141 ListenerType eListenerType
) throw (css::uno::RuntimeException
);
143 // XSheetObject attributes
144 virtual OUString SAL_CALL
getName() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 virtual void SAL_CALL
setName( const OUString
& rName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual OUString SAL_CALL
getOnAction() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual void SAL_CALL
setOnAction( const OUString
& rMacroName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 virtual sal_Bool SAL_CALL
getPrintObject() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
149 virtual void SAL_CALL
setPrintObject( sal_Bool bPrintObject
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
151 // XControlObject attributes
152 virtual sal_Bool SAL_CALL
getAutoSize() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
153 virtual void SAL_CALL
setAutoSize( sal_Bool bAutoSize
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 sal_Int32
getModelIndexInForm() const throw (css::uno::RuntimeException
);
159 css::uno::Reference
< css::container::XIndexContainer
> mxFormIC
;
160 css::uno::Reference
< css::beans::XPropertySet
> mxControlProps
;
161 OUString maListenerType
;
162 OUString maEventMethod
;
165 typedef ::cppu::ImplInheritanceHelper1
< ScVbaControlObjectBase
, ov::excel::XButton
> ScVbaButton_BASE
;
167 class ScVbaButton
: public ScVbaButton_BASE
170 explicit ScVbaButton(
171 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
172 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
173 const css::uno::Reference
< css::frame::XModel
>& rxModel
,
174 const css::uno::Reference
< css::container::XIndexContainer
>& rxFormIC
,
175 const css::uno::Reference
< css::drawing::XControlShape
>& rxControlShape
) throw (css::uno::RuntimeException
);
177 // XButton attributes
178 virtual OUString SAL_CALL
getCaption() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
179 virtual void SAL_CALL
setCaption( const OUString
& rCaption
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
180 virtual css::uno::Reference
< ov::excel::XFont
> SAL_CALL
getFont() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
181 virtual void SAL_CALL
setFont( const css::uno::Reference
< ov::excel::XFont
>& rxFont
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
182 virtual sal_Int32 SAL_CALL
getHorizontalAlignment() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
183 virtual void SAL_CALL
setHorizontalAlignment( sal_Int32 nAlign
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
184 virtual sal_Int32 SAL_CALL
getVerticalAlignment() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
185 virtual void SAL_CALL
setVerticalAlignment( sal_Int32 nAlign
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
186 virtual sal_Int32 SAL_CALL
getOrientation() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual void SAL_CALL
setOrientation( sal_Int32 nOrientation
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
190 css::uno::Reference
< ov::excel::XCharacters
> SAL_CALL
Characters(
191 const css::uno::Any
& rStart
, const css::uno::Any
& rLength
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
194 VBAHELPER_DECL_XHELPERINTERFACE
197 virtual OUString
implGetBaseName() const SAL_OVERRIDE
;
198 virtual void implSetDefaultProperties() throw (css::uno::RuntimeException
) SAL_OVERRIDE
;
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */