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 .
19 #ifndef INCLUDED_SC_SOURCE_UI_VBA_VBAWORKSHEET_HXX
20 #define INCLUDED_SC_SOURCE_UI_VBA_VBAWORKSHEET_HXX
22 #include <cppuhelper/implbase2.hxx>
23 #include <comphelper/unwrapargs.hxx>
25 #include <com/sun/star/sheet/XSpreadsheet.hpp>
26 #include <com/sun/star/script/XInvocation.hpp>
27 #include <ooo/vba/excel/XWorksheet.hpp>
28 #include <ooo/vba/excel/XComments.hpp>
29 #include <ooo/vba/excel/XRange.hpp>
30 #include <com/sun/star/lang/XEventListener.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <com/sun/star/frame/XModel.hpp>
33 #include <ooo/vba/excel/XOutline.hpp>
34 #include <ooo/vba/excel/XPageSetup.hpp>
35 #include <ooo/vba/excel/XHPageBreaks.hpp>
36 #include <ooo/vba/excel/XVPageBreaks.hpp>
37 #include <com/sun/star/container/XNamed.hpp>
39 #include <vbahelper/vbahelperinterface.hxx>
40 #include "address.hxx"
42 namespace ooo
{ namespace vba
{ namespace excel
{
47 class ScVbaSheetObjectsBase
;
49 typedef InheritedHelperInterfaceImpl1
< ov::excel::XWorksheet
> WorksheetImpl_BASE
;
51 class ScVbaWorksheet
: public WorksheetImpl_BASE
53 css::uno::Reference
< css::sheet::XSpreadsheet
> mxSheet
;
54 css::uno::Reference
< css::frame::XModel
> mxModel
;
55 css::uno::Reference
< ov::excel::XChartObjects
> mxCharts
;
56 css::uno::Reference
< ov::excel::XHyperlinks
> mxHlinks
;
57 ::rtl::Reference
< ScVbaSheetObjectsBase
> mxButtons
;
60 css::uno::Reference
< ov::excel::XWorksheet
> getSheetAtOffset(SCTAB offset
) throw (css::uno::RuntimeException
);
61 css::uno::Reference
< ov::excel::XRange
> getSheetRange() throw (css::uno::RuntimeException
);
63 css::uno::Reference
< css::container::XNameAccess
> getFormControls();
64 css::uno::Any
getControlShape( const OUString
& sName
);
67 ScVbaWorksheet( const css::uno::Reference
< ov::XHelperInterface
>& xParent
,
68 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
69 const css::uno::Reference
< css::sheet::XSpreadsheet
>& xSheet
,
70 const css::uno::Reference
< css::frame::XModel
>& xModel
)throw (css::uno::RuntimeException
) ;
71 ScVbaWorksheet( css::uno::Sequence
< css::uno::Any
> const& aArgs
, css::uno::Reference
< css::uno::XComponentContext
>const& xContext
) throw ( css::lang::IllegalArgumentException
, css::uno::RuntimeException
);
73 virtual ~ScVbaWorksheet();
75 css::uno::Reference
< css::frame::XModel
> getModel()
77 css::uno::Reference
< css::sheet::XSpreadsheet
> getSheet()
79 static const com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
80 css::uno::Reference
< ov::excel::XWorksheet
> createSheetCopyInNewDoc( const OUString
& );
81 css::uno::Reference
< ov::excel::XWorksheet
> createSheetCopy(css::uno::Reference
< ov::excel::XWorksheet
> xSheet
, bool bAfter
);
84 virtual OUString SAL_CALL
getName() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 virtual void SAL_CALL
setName( const OUString
&rName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual sal_Int32 SAL_CALL
getVisible() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual void SAL_CALL
setVisible( sal_Int32 nVisible
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 virtual ::sal_Int32 SAL_CALL
getStandardWidth() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 virtual ::sal_Int32 SAL_CALL
getStandardHeight() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual sal_Bool SAL_CALL
getProtectionMode() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual sal_Bool SAL_CALL
getProtectContents() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual sal_Bool SAL_CALL
getProtectDrawingObjects() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual sal_Bool SAL_CALL
getProtectScenarios() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
getUsedRange() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual css::uno::Any SAL_CALL
ChartObjects( const css::uno::Any
& Index
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual css::uno::Reference
< ov::excel::XOutline
> SAL_CALL
Outline( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual css::uno::Reference
< ov::excel::XPageSetup
> SAL_CALL
PageSetup( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual css::uno::Any SAL_CALL
HPageBreaks( const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual css::uno::Any SAL_CALL
VPageBreaks( const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual css::uno::Reference
< ov::excel::XWorksheet
> SAL_CALL
getNext() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual css::uno::Reference
< ov::excel::XWorksheet
> SAL_CALL
getPrevious() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual sal_Int16 SAL_CALL
getIndex() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 virtual sal_Int32 SAL_CALL
getEnableSelection() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 virtual void SAL_CALL
setEnableSelection( sal_Int32 nSelection
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 virtual sal_Bool SAL_CALL
getAutoFilterMode() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual void SAL_CALL
setAutoFilterMode( sal_Bool bAutoFilterMode
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual void SAL_CALL
Activate() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
110 virtual void SAL_CALL
Select() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Range( const css::uno::Any
& Cell1
, const css::uno::Any
& Cell2
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 virtual void SAL_CALL
Move( const css::uno::Any
& Before
, const css::uno::Any
& After
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
113 virtual void SAL_CALL
Copy( const css::uno::Any
& Before
, const css::uno::Any
& After
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
114 virtual void SAL_CALL
Paste( const css::uno::Any
& Destination
, const css::uno::Any
& Link
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 virtual void SAL_CALL
Delete( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
116 virtual void SAL_CALL
Protect( const css::uno::Any
& Password
, const css::uno::Any
& DrawingObjects
, const css::uno::Any
& Contents
, const css::uno::Any
& Scenarios
, const css::uno::Any
& UserInterfaceOnly
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
117 virtual void SAL_CALL
Unprotect( const css::uno::Any
& Password
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
119 virtual void SAL_CALL
Calculate( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 virtual void SAL_CALL
CheckSpelling( const css::uno::Any
& CustomDictionary
,const css::uno::Any
& IgnoreUppercase
,const css::uno::Any
& AlwaysSuggest
, const css::uno::Any
& SpellingLang
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Cells( const css::uno::Any
&nRow
, const css::uno::Any
&nCol
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Rows(const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Columns(const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual css::uno::Any SAL_CALL
Evaluate( const OUString
& Name
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual css::uno::Any SAL_CALL
PivotTables( const css::uno::Any
& Index
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual css::uno::Any SAL_CALL
Comments( const css::uno::Any
& Index
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 virtual css::uno::Any SAL_CALL
Hyperlinks( const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual css::uno::Any SAL_CALL
Names( const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
132 virtual css::uno::Any SAL_CALL
OLEObjects( const css::uno::Any
& Index
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 virtual css::uno::Any SAL_CALL
Shapes( const css::uno::Any
& aIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 virtual css::uno::Any SAL_CALL
Buttons( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual css::uno::Any SAL_CALL
CheckBoxes( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual css::uno::Any SAL_CALL
DropDowns( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
138 virtual css::uno::Any SAL_CALL
GroupBoxes( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 virtual css::uno::Any SAL_CALL
Labels( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 virtual css::uno::Any SAL_CALL
ListBoxes( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual css::uno::Any SAL_CALL
OptionButtons( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
142 virtual css::uno::Any SAL_CALL
ScrollBars( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual css::uno::Any SAL_CALL
Spinners( const css::uno::Any
& rIndex
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 virtual void SAL_CALL
setEnableCalculation( sal_Bool EnableCalculation
) throw ( css::script::BasicErrorException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual sal_Bool SAL_CALL
getEnableCalculation( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual void SAL_CALL
ShowDataForm( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
149 virtual css::uno::Reference
< css::beans::XIntrospectionAccess
> SAL_CALL
getIntrospection( ) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 virtual css::uno::Any SAL_CALL
invoke( const OUString
& aFunctionName
, const css::uno::Sequence
< css::uno::Any
>& aParams
, css::uno::Sequence
< ::sal_Int16
>& aOutParamIndex
, css::uno::Sequence
< css::uno::Any
>& aOutParam
) throw (css::lang::IllegalArgumentException
, css::script::CannotConvertException
, css::reflection::InvocationTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
151 virtual void SAL_CALL
setValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) throw (css::beans::UnknownPropertyException
, css::script::CannotConvertException
, css::reflection::InvocationTargetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual css::uno::Any SAL_CALL
getValue( const OUString
& aPropertyName
) throw (css::beans::UnknownPropertyException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
153 virtual sal_Bool SAL_CALL
hasMethod( const OUString
& aName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
154 virtual sal_Bool SAL_CALL
hasProperty( const OUString
& aName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 virtual OUString SAL_CALL
getCodeName() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
157 sal_Int16
getSheetID() throw (css::uno::RuntimeException
);
159 virtual void SAL_CALL
PrintOut( const css::uno::Any
& From
, const css::uno::Any
& To
, const css::uno::Any
& Copies
, const css::uno::Any
& Preview
, const css::uno::Any
& ActivePrinter
, const css::uno::Any
& PrintToFile
, const css::uno::Any
& Collate
, const css::uno::Any
& PrToFileName
, const css::uno::Any
& IgnorePrintAreas
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
161 virtual OUString
getServiceImplName() SAL_OVERRIDE
;
162 virtual css::uno::Sequence
<OUString
> getServiceNames() SAL_OVERRIDE
;
164 virtual ::sal_Int64 SAL_CALL
getSomething(const css::uno::Sequence
<sal_Int8
>& rId
) throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 #endif // INCLUDED_SC_SOURCE_UI_VBA_VBAWORKSHEET_HXX
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */