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 <cppuhelper/implbase.hxx>
27 #include <vbahelper/vbahelperinterface.hxx>
28 #include "vbapalette.hxx"
30 namespace com
{ namespace sun
{ namespace star
{
31 namespace container
{ class XIndexContainer
; }
32 namespace drawing
{ class XControlShape
; }
35 typedef InheritedHelperInterfaceWeakImpl
< ov::excel::XCharacters
> ScVbaButtonCharacters_BASE
;
37 /** Simple implementation of the Characters symbol for drawing button objects. */
38 class ScVbaButtonCharacters
: public ScVbaButtonCharacters_BASE
41 /// @throws css::uno::RuntimeException
42 explicit ScVbaButtonCharacters(
43 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
44 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
45 const css::uno::Reference
< css::beans::XPropertySet
>& rxPropSet
,
46 const ScVbaPalette
& rPalette
,
47 const css::uno::Any
& rStart
,
48 const css::uno::Any
& rLength
);
49 virtual ~ScVbaButtonCharacters() override
;
51 // XCharacters attributes
52 virtual OUString SAL_CALL
getCaption() override
;
53 virtual void SAL_CALL
setCaption( const OUString
& rCaption
) override
;
54 virtual OUString SAL_CALL
getText() override
;
55 virtual void SAL_CALL
setText( const OUString
& rText
) override
;
56 virtual sal_Int32 SAL_CALL
getCount() override
;
57 virtual css::uno::Reference
< ov::excel::XFont
> SAL_CALL
getFont() override
;
58 virtual void SAL_CALL
setFont( const css::uno::Reference
< ov::excel::XFont
>& rxFont
) override
;
60 // XCharacters methods
61 virtual void SAL_CALL
Insert( const OUString
& rString
) override
;
62 virtual void SAL_CALL
Delete() override
;
65 VBAHELPER_DECL_XHELPERINTERFACE
68 /// @throws css::uno::RuntimeException
69 OUString
getFullString() const;
70 /// @throws css::uno::RuntimeException
71 void setFullString( const OUString
& rString
);
74 ScVbaPalette
const maPalette
;
75 css::uno::Reference
< css::beans::XPropertySet
> mxPropSet
;
80 typedef InheritedHelperInterfaceWeakImpl
< ov::excel::XSheetObject
> ScVbaSheetObject_BASE
;
82 /** Base class for drawing objects embedded in sheets. */
83 class ScVbaSheetObjectBase
: public ScVbaSheetObject_BASE
86 /// @throws css::uno::RuntimeException
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
);
93 // XSheetObject attributes
94 virtual double SAL_CALL
getLeft() override
;
95 virtual void SAL_CALL
setLeft( double fLeft
) override
;
96 virtual double SAL_CALL
getTop() override
;
97 virtual void SAL_CALL
setTop( double fTop
) override
;
98 virtual double SAL_CALL
getWidth() override
;
99 virtual void SAL_CALL
setWidth( double fWidth
) override
;
100 virtual double SAL_CALL
getHeight() override
;
101 virtual void SAL_CALL
setHeight( double fHeight
) override
;
102 virtual OUString SAL_CALL
getName() override
;
103 virtual void SAL_CALL
setName( const OUString
& rName
) override
;
104 virtual sal_Int32 SAL_CALL
getPlacement() override
;
105 virtual void SAL_CALL
setPlacement( sal_Int32 nPlacement
) override
;
106 virtual sal_Bool SAL_CALL
getPrintObject() override
;
107 virtual void SAL_CALL
setPrintObject( sal_Bool bPrintObject
) override
;
109 /** Sets default properties after a new object has been created.
111 @throws css::uno::RuntimeException
113 void setDefaultProperties( sal_Int32 nIndex
);
116 /** Derived classes return the base name used for new objects. */
117 virtual OUString
implGetBaseName() const = 0;
118 /** Derived classes set default properties for new drawing objects.
120 @throws css::uno::RuntimeException
122 virtual void implSetDefaultProperties();
125 ScVbaPalette
const maPalette
;
126 css::uno::Reference
< css::frame::XModel
> mxModel
;
127 css::uno::Reference
< css::drawing::XShape
> mxShape
;
128 css::uno::Reference
< css::beans::XPropertySet
> mxShapeProps
;
131 typedef ::cppu::ImplInheritanceHelper
< ScVbaSheetObjectBase
, ov::excel::XControlObject
> ScVbaControlObject_BASE
;
133 class ScVbaControlObjectBase
: public ScVbaControlObject_BASE
136 /// @throws css::uno::RuntimeException
137 explicit ScVbaControlObjectBase(
138 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
139 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
140 const css::uno::Reference
< css::frame::XModel
>& rxModel
,
141 const css::uno::Reference
< css::container::XIndexContainer
>& rxFormIC
,
142 const css::uno::Reference
< css::drawing::XControlShape
>& rxControlShape
);
144 // XSheetObject attributes
145 virtual OUString SAL_CALL
getName() override
;
146 virtual void SAL_CALL
setName( const OUString
& rName
) override
;
147 virtual OUString SAL_CALL
getOnAction() override
;
148 virtual void SAL_CALL
setOnAction( const OUString
& rMacroName
) override
;
149 virtual sal_Bool SAL_CALL
getPrintObject() override
;
150 virtual void SAL_CALL
setPrintObject( sal_Bool bPrintObject
) override
;
152 // XControlObject attributes
153 virtual sal_Bool SAL_CALL
getAutoSize() override
;
154 virtual void SAL_CALL
setAutoSize( sal_Bool bAutoSize
) override
;
156 /// Notify that the document contains a macro event handler
157 void NotifyMacroEventRead();
160 /// @throws css::uno::RuntimeException
161 sal_Int32
getModelIndexInForm() const;
164 css::uno::Reference
< css::container::XIndexContainer
> mxFormIC
;
165 css::uno::Reference
< css::beans::XPropertySet
> mxControlProps
;
166 bool mbNotifyMacroEventRead
;
169 typedef ::cppu::ImplInheritanceHelper
< ScVbaControlObjectBase
, ov::excel::XButton
> ScVbaButton_BASE
;
171 class ScVbaButton
: public ScVbaButton_BASE
174 /// @throws css::uno::RuntimeException
175 explicit ScVbaButton(
176 const css::uno::Reference
< ov::XHelperInterface
>& rxParent
,
177 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
178 const css::uno::Reference
< css::frame::XModel
>& rxModel
,
179 const css::uno::Reference
< css::container::XIndexContainer
>& rxFormIC
,
180 const css::uno::Reference
< css::drawing::XControlShape
>& rxControlShape
);
182 // XButton attributes
183 virtual OUString SAL_CALL
getCaption() override
;
184 virtual void SAL_CALL
setCaption( const OUString
& rCaption
) override
;
185 virtual css::uno::Reference
< ov::excel::XFont
> SAL_CALL
getFont() override
;
186 virtual void SAL_CALL
setFont( const css::uno::Reference
< ov::excel::XFont
>& rxFont
) override
;
187 virtual sal_Int32 SAL_CALL
getHorizontalAlignment() override
;
188 virtual void SAL_CALL
setHorizontalAlignment( sal_Int32 nAlign
) override
;
189 virtual sal_Int32 SAL_CALL
getVerticalAlignment() override
;
190 virtual void SAL_CALL
setVerticalAlignment( sal_Int32 nAlign
) override
;
191 virtual sal_Int32 SAL_CALL
getOrientation() override
;
192 virtual void SAL_CALL
setOrientation( sal_Int32 nOrientation
) override
;
193 virtual css::uno::Any SAL_CALL
getValue() override
;
194 virtual void SAL_CALL
setValue( const css::uno::Any
&nValue
) override
;
195 virtual OUString SAL_CALL
getText() override
;
196 virtual void SAL_CALL
setText( const OUString
&aText
) override
;
199 css::uno::Reference
< ov::excel::XCharacters
> SAL_CALL
Characters(
200 const css::uno::Any
& rStart
, const css::uno::Any
& rLength
) override
;
203 VBAHELPER_DECL_XHELPERINTERFACE
206 virtual OUString
implGetBaseName() const override
;
207 virtual void implSetDefaultProperties() override
;
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */