LibreOffice Module sc (master)  1
vbasheetobject.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <ooo/vba/excel/XButton.hpp>
23 #include <ooo/vba/excel/XControlObject.hpp>
24 #include <ooo/vba/excel/XSheetObject.hpp>
25 #include <cppuhelper/implbase.hxx>
27 #include "vbapalette.hxx"
28 
29 namespace com::sun::star {
30  namespace container { class XIndexContainer; }
31  namespace drawing { class XControlShape; }
32 }
33 
35 
38 {
39 public:
41  explicit ScVbaButtonCharacters(
42  const css::uno::Reference< ov::XHelperInterface >& rxParent,
43  const css::uno::Reference< css::uno::XComponentContext >& rxContext,
44  const css::uno::Reference< css::beans::XPropertySet >& rxPropSet,
45  const ScVbaPalette& rPalette,
46  const css::uno::Any& rStart,
47  const css::uno::Any& rLength );
48  virtual ~ScVbaButtonCharacters() override;
49 
50  // XCharacters attributes
51  virtual OUString SAL_CALL getCaption() override;
52  virtual void SAL_CALL setCaption( const OUString& rCaption ) override;
53  virtual OUString SAL_CALL getText() override;
54  virtual void SAL_CALL setText( const OUString& rText ) override;
55  virtual sal_Int32 SAL_CALL getCount() override;
56  virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() override;
57  virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& rxFont ) override;
58 
59  // XCharacters methods
60  virtual void SAL_CALL Insert( const OUString& rString ) override;
61  virtual void SAL_CALL Delete() override;
62 
63  // XHelperInterface
65 
66 private:
68  OUString getFullString() const;
70  void setFullString( const OUString& rString );
71 
72 private:
74  css::uno::Reference< css::beans::XPropertySet > mxPropSet;
75  sal_Int32 mnStart;
76  sal_Int32 mnLength;
77 };
78 
80 
83 {
84 public:
86  explicit ScVbaSheetObjectBase(
87  const css::uno::Reference< ov::XHelperInterface >& rxParent,
88  const css::uno::Reference< css::uno::XComponentContext >& rxContext,
89  const css::uno::Reference< css::frame::XModel >& rxModel,
90  const css::uno::Reference< css::drawing::XShape >& rxShape );
91 
92  // XSheetObject attributes
93  virtual double SAL_CALL getLeft() override;
94  virtual void SAL_CALL setLeft( double fLeft ) override;
95  virtual double SAL_CALL getTop() override;
96  virtual void SAL_CALL setTop( double fTop ) override;
97  virtual double SAL_CALL getWidth() override;
98  virtual void SAL_CALL setWidth( double fWidth ) override;
99  virtual double SAL_CALL getHeight() override;
100  virtual void SAL_CALL setHeight( double fHeight ) override;
101  virtual OUString SAL_CALL getName() override;
102  virtual void SAL_CALL setName( const OUString& rName ) override;
103  virtual sal_Int32 SAL_CALL getPlacement() override;
104  virtual void SAL_CALL setPlacement( sal_Int32 nPlacement ) override;
105  virtual sal_Bool SAL_CALL getPrintObject() override;
106  virtual void SAL_CALL setPrintObject( sal_Bool bPrintObject ) override;
107 
112  void setDefaultProperties( sal_Int32 nIndex );
113 
114 protected:
116  virtual OUString implGetBaseName() const = 0;
121  virtual void implSetDefaultProperties();
122 
123 protected:
125  css::uno::Reference< css::frame::XModel > mxModel;
126  css::uno::Reference< css::drawing::XShape > mxShape;
127  css::uno::Reference< css::beans::XPropertySet > mxShapeProps;
128 };
129 
130 typedef ::cppu::ImplInheritanceHelper< ScVbaSheetObjectBase, ov::excel::XControlObject > ScVbaControlObject_BASE;
131 
133 {
134 public:
136  explicit ScVbaControlObjectBase(
137  const css::uno::Reference< ov::XHelperInterface >& rxParent,
138  const css::uno::Reference< css::uno::XComponentContext >& rxContext,
139  const css::uno::Reference< css::frame::XModel >& rxModel,
140  const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
141  const css::uno::Reference< css::drawing::XControlShape >& rxControlShape );
142 
143  // XSheetObject attributes
144  virtual OUString SAL_CALL getName() override;
145  virtual void SAL_CALL setName( const OUString& rName ) override;
146  virtual OUString SAL_CALL getOnAction() override;
147  virtual void SAL_CALL setOnAction( const OUString& rMacroName ) override;
148  virtual sal_Bool SAL_CALL getPrintObject() override;
149  virtual void SAL_CALL setPrintObject( sal_Bool bPrintObject ) override;
150 
151  // XControlObject attributes
152  virtual sal_Bool SAL_CALL getAutoSize() override;
153  virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) override;
154 
156  void NotifyMacroEventRead();
157 
158 protected:
160  sal_Int32 getModelIndexInForm() const;
161 
162 protected:
163  css::uno::Reference< css::container::XIndexContainer > mxFormIC;
164  css::uno::Reference< css::beans::XPropertySet > mxControlProps;
166 };
167 
168 typedef ::cppu::ImplInheritanceHelper< ScVbaControlObjectBase, ov::excel::XButton > ScVbaButton_BASE;
169 
171 {
172 public:
174  explicit ScVbaButton(
175  const css::uno::Reference< ov::XHelperInterface >& rxParent,
176  const css::uno::Reference< css::uno::XComponentContext >& rxContext,
177  const css::uno::Reference< css::frame::XModel >& rxModel,
178  const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
179  const css::uno::Reference< css::drawing::XControlShape >& rxControlShape );
180 
181  // XButton attributes
182  virtual OUString SAL_CALL getCaption() override;
183  virtual void SAL_CALL setCaption( const OUString& rCaption ) override;
184  virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() override;
185  virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& rxFont ) override;
186  virtual sal_Int32 SAL_CALL getHorizontalAlignment() override;
187  virtual void SAL_CALL setHorizontalAlignment( sal_Int32 nAlign ) override;
188  virtual sal_Int32 SAL_CALL getVerticalAlignment() override;
189  virtual void SAL_CALL setVerticalAlignment( sal_Int32 nAlign ) override;
190  virtual sal_Int32 SAL_CALL getOrientation() override;
191  virtual void SAL_CALL setOrientation( sal_Int32 nOrientation ) override;
192  virtual css::uno::Any SAL_CALL getValue() override;
193  virtual void SAL_CALL setValue( const css::uno::Any &nValue ) override;
194  virtual OUString SAL_CALL getText() override;
195  virtual void SAL_CALL setText( const OUString &aText ) override;
196 
197  // XButton methods
198  css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters(
199  const css::uno::Any& rStart, const css::uno::Any& rLength ) override;
200 
201  // XHelperInterface
203 
204 protected:
205  virtual OUString implGetBaseName() const override;
206  virtual void implSetDefaultProperties() override;
207 };
208 
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL getPrintObject() override
sal_Int32 nIndex
ScVbaControlObjectBase(const css::uno::Reference< ov::XHelperInterface > &rxParent, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XModel > &rxModel, const css::uno::Reference< css::container::XIndexContainer > &rxFormIC, const css::uno::Reference< css::drawing::XControlShape > &rxControlShape)
virtual void SAL_CALL setPrintObject(sal_Bool bPrintObject) override
virtual sal_Int32 SAL_CALL getOrientation() override
virtual void SAL_CALL setTop(double fTop) override
virtual sal_Bool SAL_CALL getPrintObject() override
virtual void SAL_CALL setName(const OUString &rName) override
#define VBAHELPER_DECL_XHELPERINTERFACE
virtual OUString SAL_CALL getText() override
virtual void implSetDefaultProperties() override
css::uno::Reference< css::frame::XModel > mxModel
InheritedHelperInterfaceWeakImpl< ov::excel::XSheetObject > ScVbaSheetObject_BASE
virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() override
virtual double SAL_CALL getLeft() override
virtual void SAL_CALL setValue(const css::uno::Any &nValue) override
virtual sal_Int32 SAL_CALL getVerticalAlignment() override
virtual double SAL_CALL getHeight() override
virtual void SAL_CALL setCaption(const OUString &rCaption) override
virtual OUString SAL_CALL getName() override
exports com.sun.star. container
ScVbaButton(const css::uno::Reference< ov::XHelperInterface > &rxParent, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XModel > &rxModel, const css::uno::Reference< css::container::XIndexContainer > &rxFormIC, const css::uno::Reference< css::drawing::XControlShape > &rxControlShape)
void setDefaultProperties(sal_Int32 nIndex)
Sets default properties after a new object has been created.
virtual void SAL_CALL setName(const OUString &rName) override
virtual void SAL_CALL setHeight(double fHeight) override
virtual void implSetDefaultProperties()
Derived classes set default properties for new drawing objects.
virtual void SAL_CALL setVerticalAlignment(sal_Int32 nAlign) override
virtual sal_Int32 SAL_CALL getHorizontalAlignment() override
virtual double SAL_CALL getTop() override
virtual OUString SAL_CALL getOnAction() override
virtual void SAL_CALL Insert(const OUString &rString) override
ScVbaSheetObjectBase(const css::uno::Reference< ov::XHelperInterface > &rxParent, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XModel > &rxModel, const css::uno::Reference< css::drawing::XShape > &rxShape)
void setFullString(const OUString &rString)
virtual void SAL_CALL setPlacement(sal_Int32 nPlacement) override
virtual void SAL_CALL setLeft(double fLeft) override
::cppu::ImplInheritanceHelper< ScVbaControlObjectBase, ov::excel::XButton > ScVbaButton_BASE
virtual OUString implGetBaseName() const =0
Derived classes return the base name used for new objects.
css::uno::Reference< css::drawing::XShape > mxShape
virtual sal_Bool SAL_CALL getAutoSize() override
virtual OUString SAL_CALL getCaption() override
virtual OUString SAL_CALL getText() override
virtual void SAL_CALL setOnAction(const OUString &rMacroName) override
virtual void SAL_CALL setText(const OUString &rText) override
virtual sal_Int32 SAL_CALL getCount() override
::cppu::ImplInheritanceHelper< ScVbaSheetObjectBase, ov::excel::XControlObject > ScVbaControlObject_BASE
unsigned char sal_Bool
css::uno::Reference< css::beans::XPropertySet > mxControlProps
css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters(const css::uno::Any &rStart, const css::uno::Any &rLength) override
InheritedHelperInterfaceWeakImpl< ov::excel::XCharacters > ScVbaButtonCharacters_BASE
Base class for drawing objects embedded in sheets.
virtual double SAL_CALL getWidth() override
sal_Int32 getModelIndexInForm() const
virtual void SAL_CALL setAutoSize(sal_Bool bAutoSize) override
void NotifyMacroEventRead()
Notify that the document contains a macro event handler.
virtual void SAL_CALL setFont(const css::uno::Reference< ov::excel::XFont > &rxFont) override
virtual ~ScVbaButtonCharacters() override
virtual css::uno::Any SAL_CALL getValue() override
virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() override
OUString getFullString() const
css::uno::Reference< css::container::XIndexContainer > mxFormIC
virtual void SAL_CALL Delete() override
virtual void SAL_CALL setFont(const css::uno::Reference< ov::excel::XFont > &rxFont) override
virtual void SAL_CALL setCaption(const OUString &rCaption) override
virtual void SAL_CALL setText(const OUString &aText) override
css::uno::Reference< css::beans::XPropertySet > mxPropSet
virtual OUString SAL_CALL getCaption() override
virtual void SAL_CALL setHorizontalAlignment(sal_Int32 nAlign) override
Simple implementation of the Characters symbol for drawing button objects.
virtual OUString SAL_CALL getName() override
virtual void SAL_CALL setWidth(double fWidth) override
css::uno::Reference< css::beans::XPropertySet > mxShapeProps
ScVbaButtonCharacters(const css::uno::Reference< ov::XHelperInterface > &rxParent, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::beans::XPropertySet > &rxPropSet, const ScVbaPalette &rPalette, const css::uno::Any &rStart, const css::uno::Any &rLength)
virtual sal_Int32 SAL_CALL getPlacement() override
virtual void SAL_CALL setPrintObject(sal_Bool bPrintObject) override
virtual OUString implGetBaseName() const override
sal_Int16 nValue
virtual void SAL_CALL setOrientation(sal_Int32 nOrientation) override