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 .
21 #include <ooo/vba/excel/XWorksheet.hpp>
22 #include <rtl/ref.hxx>
24 #include <vbahelper/vbahelperinterface.hxx>
27 namespace com::sun::star::frame
{ class XModel
; }
28 namespace com::sun::star::sheet
{ class XSpreadsheet
; }
29 namespace com::sun::star::uno
{ class XComponentContext
; }
30 namespace ooo::vba::excel
{ class XOutline
; }
31 namespace ooo::vba::excel
{ class XPageSetup
; }
32 namespace ooo::vba::excel
{ class XRange
; }
34 namespace ooo::vba::excel
{
39 class ScVbaSheetObjectsBase
;
40 class ScVbaChartObjects
;
42 typedef InheritedHelperInterfaceWeakImpl
< ov::excel::XWorksheet
> WorksheetImpl_BASE
;
44 class ScVbaWorksheet
: public WorksheetImpl_BASE
46 css::uno::Reference
< css::sheet::XSpreadsheet
> mxSheet
;
47 css::uno::Reference
< css::frame::XModel
> mxModel
;
48 rtl::Reference
<ScVbaChartObjects
> mxCharts
;
49 css::uno::Reference
< ov::excel::XHyperlinks
> mxHlinks
;
50 ::rtl::Reference
< ScVbaSheetObjectsBase
> mxButtons
[2];
53 /// @throws css::uno::RuntimeException
54 css::uno::Reference
< ov::excel::XWorksheet
> getSheetAtOffset(SCTAB offset
);
55 /// @throws css::uno::RuntimeException
56 css::uno::Reference
< ov::excel::XRange
> getSheetRange();
58 css::uno::Reference
< css::container::XNameAccess
> getFormControls() const;
59 css::uno::Any
getControlShape( std::u16string_view sName
);
61 css::uno::Any
getButtons( const css::uno::Any
&rIndex
, bool bOptionButtons
);
64 /// @throws css::uno::RuntimeException
65 ScVbaWorksheet( const css::uno::Reference
< ov::XHelperInterface
>& xParent
,
66 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
67 css::uno::Reference
< css::sheet::XSpreadsheet
> xSheet
,
68 css::uno::Reference
< css::frame::XModel
> xModel
) ;
69 /// @throws css::lang::IllegalArgumentException
70 /// @throws css::uno::RuntimeException
71 ScVbaWorksheet( css::uno::Sequence
< css::uno::Any
> const& aArgs
, css::uno::Reference
< css::uno::XComponentContext
>const& xContext
);
73 virtual ~ScVbaWorksheet() override
;
75 const css::uno::Reference
< css::frame::XModel
>& getModel() const
77 const css::uno::Reference
< css::sheet::XSpreadsheet
>& getSheet() const
79 static const css::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
> const & xSheet
, bool bAfter
);
84 virtual OUString SAL_CALL
getName() override
;
85 virtual void SAL_CALL
setName( const OUString
&rName
) override
;
86 virtual sal_Int32 SAL_CALL
getVisible() override
;
87 virtual void SAL_CALL
setVisible( sal_Int32 nVisible
) override
;
88 virtual ::sal_Int32 SAL_CALL
getStandardWidth() override
;
89 virtual ::sal_Int32 SAL_CALL
getStandardHeight() override
;
90 virtual sal_Bool SAL_CALL
getProtectionMode() override
;
91 virtual sal_Bool SAL_CALL
getProtectContents() override
;
92 virtual sal_Bool SAL_CALL
getProtectDrawingObjects() override
;
93 virtual sal_Bool SAL_CALL
getProtectScenarios() override
;
94 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
getUsedRange() override
;
95 virtual css::uno::Any SAL_CALL
ChartObjects( const css::uno::Any
& Index
) override
;
96 virtual css::uno::Reference
< ov::excel::XOutline
> SAL_CALL
Outline( ) override
;
97 virtual css::uno::Reference
< ov::excel::XPageSetup
> SAL_CALL
PageSetup( ) override
;
98 virtual css::uno::Any SAL_CALL
HPageBreaks( const css::uno::Any
& aIndex
) override
;
99 virtual css::uno::Any SAL_CALL
VPageBreaks( const css::uno::Any
& aIndex
) override
;
100 virtual css::uno::Reference
< ov::excel::XWorksheet
> SAL_CALL
getNext() override
;
101 virtual css::uno::Reference
< ov::excel::XWorksheet
> SAL_CALL
getPrevious() override
;
102 virtual sal_Int16 SAL_CALL
getIndex() override
;
103 virtual sal_Int32 SAL_CALL
getEnableSelection() override
;
104 virtual void SAL_CALL
setEnableSelection( sal_Int32 nSelection
) override
;
105 virtual sal_Bool SAL_CALL
getAutoFilterMode() override
;
106 virtual void SAL_CALL
setAutoFilterMode( sal_Bool bAutoFilterMode
) override
;
109 virtual void SAL_CALL
Activate() override
;
110 virtual void SAL_CALL
Select() override
;
111 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Range( const css::uno::Any
& Cell1
, const css::uno::Any
& Cell2
) override
;
112 virtual void SAL_CALL
Move( const css::uno::Any
& Before
, const css::uno::Any
& After
) override
;
113 virtual void SAL_CALL
Copy( const css::uno::Any
& Before
, const css::uno::Any
& After
) override
;
114 virtual void SAL_CALL
Paste( const css::uno::Any
& Destination
, const css::uno::Any
& Link
) override
;
115 virtual void SAL_CALL
Delete( ) 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
) override
;
117 virtual void SAL_CALL
Unprotect( const css::uno::Any
& Password
) override
;
119 virtual void SAL_CALL
Calculate( ) 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
) override
;
122 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Cells( const css::uno::Any
&nRow
, const css::uno::Any
&nCol
) override
;
123 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Rows(const css::uno::Any
& aIndex
) override
;
124 virtual css::uno::Reference
< ov::excel::XRange
> SAL_CALL
Columns(const css::uno::Any
& aIndex
) override
;
126 virtual css::uno::Any SAL_CALL
Evaluate( const OUString
& Name
) override
;
127 virtual css::uno::Any SAL_CALL
PivotTables( const css::uno::Any
& Index
) override
;
128 virtual css::uno::Any SAL_CALL
Comments( const css::uno::Any
& Index
) override
;
129 virtual css::uno::Any SAL_CALL
Hyperlinks( const css::uno::Any
& aIndex
) override
;
130 virtual css::uno::Any SAL_CALL
Names( const css::uno::Any
& aIndex
) override
;
132 virtual css::uno::Any SAL_CALL
OLEObjects( const css::uno::Any
& Index
) override
;
133 virtual css::uno::Any SAL_CALL
Shapes( const css::uno::Any
& aIndex
) override
;
135 virtual css::uno::Any SAL_CALL
Buttons( const css::uno::Any
& rIndex
) override
;
136 virtual css::uno::Any SAL_CALL
CheckBoxes( const css::uno::Any
& rIndex
) override
;
137 virtual css::uno::Any SAL_CALL
DropDowns( const css::uno::Any
& rIndex
) override
;
138 virtual css::uno::Any SAL_CALL
GroupBoxes( const css::uno::Any
& rIndex
) override
;
139 virtual css::uno::Any SAL_CALL
Labels( const css::uno::Any
& rIndex
) override
;
140 virtual css::uno::Any SAL_CALL
ListBoxes( const css::uno::Any
& rIndex
) override
;
141 virtual css::uno::Any SAL_CALL
OptionButtons( const css::uno::Any
& rIndex
) override
;
142 virtual css::uno::Any SAL_CALL
ScrollBars( const css::uno::Any
& rIndex
) override
;
143 virtual css::uno::Any SAL_CALL
Spinners( const css::uno::Any
& rIndex
) override
;
145 virtual void SAL_CALL
setEnableCalculation( sal_Bool EnableCalculation
) override
;
146 virtual sal_Bool SAL_CALL
getEnableCalculation( ) override
;
147 virtual void SAL_CALL
ShowDataForm( ) override
;
149 virtual css::uno::Reference
< css::beans::XIntrospectionAccess
> SAL_CALL
getIntrospection( ) 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
) override
;
151 virtual void SAL_CALL
setValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
152 virtual css::uno::Any SAL_CALL
getValue( const OUString
& aPropertyName
) override
;
153 virtual sal_Bool SAL_CALL
hasMethod( const OUString
& aName
) override
;
154 virtual sal_Bool SAL_CALL
hasProperty( const OUString
& aName
) override
;
156 virtual OUString SAL_CALL
getCodeName() override
;
157 /// @throws css::uno::RuntimeException
158 sal_Int16
getSheetID() const;
160 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
) override
;
161 virtual void SAL_CALL
ExportAsFixedFormat(const css::uno::Any
& Type
, const css::uno::Any
& FileName
, const css::uno::Any
& Quality
,
162 const css::uno::Any
& IncludeDocProperties
, const css::uno::Any
& IgnorePrintAreas
, const css::uno::Any
& From
,
163 const css::uno::Any
& To
, const css::uno::Any
& OpenAfterPublish
, const css::uno::Any
& FixedFormatExtClassPtr
) override
;
165 virtual OUString
getServiceImplName() override
;
166 virtual css::uno::Sequence
<OUString
> getServiceNames() override
;
168 virtual ::sal_Int64 SAL_CALL
getSomething(const css::uno::Sequence
<sal_Int8
>& rId
) override
;
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */