1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SC_VBA_WORKSHEET_HXX 24 #define SC_VBA_WORKSHEET_HXX 25 26 #include <cppuhelper/implbase2.hxx> 27 #include <comphelper/unwrapargs.hxx> 28 29 #include <com/sun/star/sheet/XSpreadsheet.hpp> 30 #include <com/sun/star/script/XInvocation.hpp> 31 #include <ooo/vba/excel/XWorksheet.hpp> 32 #include <ooo/vba/excel/XComments.hpp> 33 #include <ooo/vba/excel/XRange.hpp> 34 #include <com/sun/star/lang/XEventListener.hpp> 35 #include <com/sun/star/uno/XComponentContext.hpp> 36 #include <com/sun/star/frame/XModel.hpp> 37 #include <ooo/vba/excel/XOutline.hpp> 38 #include <ooo/vba/excel/XPageSetup.hpp> 39 #include <ooo/vba/excel/XHPageBreaks.hpp> 40 #include <ooo/vba/excel/XVPageBreaks.hpp> 41 42 #include <vbahelper/vbahelperinterface.hxx> 43 #include "address.hxx" 44 45 namespace ooo { namespace vba { namespace excel { 46 class XChartObjects; 47 class XHyperlinks; 48 } } } 49 50 class ScVbaSheetObjectsBase; 51 52 typedef InheritedHelperInterfaceImpl1< ov::excel::XWorksheet > WorksheetImpl_BASE; 53 54 class ScVbaWorksheet : public WorksheetImpl_BASE 55 { 56 css::uno::Reference< css::sheet::XSpreadsheet > mxSheet; 57 css::uno::Reference< css::frame::XModel > mxModel; 58 css::uno::Reference< ov::excel::XChartObjects > mxCharts; 59 css::uno::Reference< ov::excel::XHyperlinks > mxHlinks; 60 ::rtl::Reference< ScVbaSheetObjectsBase > mxButtons; 61 bool mbVeryHidden; 62 63 css::uno::Reference< ov::excel::XWorksheet > getSheetAtOffset(SCTAB offset); 64 css::uno::Reference< ov::excel::XRange > getSheetRange(); 65 66 css::uno::Reference< css::container::XNameAccess > getFormControls(); 67 css::uno::Any getControlShape( const rtl::OUString& sName ); 68 69 css::uno::Reference< css::beans::XPropertySet > getFirstDBRangeProperties(); 70 71 protected: 72 73 ScVbaWorksheet( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); 74 public: 75 ScVbaWorksheet( const css::uno::Reference< ov::XHelperInterface >& xParent, 76 const css::uno::Reference< css::uno::XComponentContext >& xContext, 77 const css::uno::Reference< css::sheet::XSpreadsheet >& xSheet, 78 const css::uno::Reference< css::frame::XModel >& xModel ) ; 79 ScVbaWorksheet( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); 80 81 virtual ~ScVbaWorksheet(); 82 83 virtual css::uno::Reference< css::frame::XModel > getModel() 84 { return mxModel; } 85 virtual css::uno::Reference< css::sheet::XSpreadsheet > getSheet() 86 { return mxSheet; } 87 88 // Attributes 89 virtual ::rtl::OUString SAL_CALL getName(); 90 virtual void SAL_CALL setName( const ::rtl::OUString &rName ); 91 virtual sal_Int32 SAL_CALL getVisible(); 92 virtual void SAL_CALL setVisible( sal_Int32 nVisible ); 93 virtual ::sal_Int32 SAL_CALL getStandardWidth(); 94 virtual ::sal_Int32 SAL_CALL getStandardHeight(); 95 virtual ::sal_Bool SAL_CALL getProtectionMode(); 96 virtual ::sal_Bool SAL_CALL getProtectContents(); 97 virtual ::sal_Bool SAL_CALL getProtectDrawingObjects(); 98 virtual ::sal_Bool SAL_CALL getProtectScenarios(); 99 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getUsedRange() ; 100 virtual css::uno::Any SAL_CALL ChartObjects( const css::uno::Any& Index ); 101 virtual css::uno::Reference< ov::excel::XOutline > SAL_CALL Outline( ); 102 virtual css::uno::Reference< ov::excel::XPageSetup > SAL_CALL PageSetup( ); 103 virtual css::uno::Any SAL_CALL HPageBreaks( const css::uno::Any& aIndex ); 104 virtual css::uno::Any SAL_CALL VPageBreaks( const css::uno::Any& aIndex ); 105 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getNext(); 106 virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getPrevious(); 107 virtual sal_Int16 SAL_CALL getIndex(); 108 virtual sal_Int32 SAL_CALL getEnableSelection(); 109 virtual void SAL_CALL setEnableSelection( sal_Int32 nSelection ); 110 virtual sal_Bool SAL_CALL getAutoFilterMode(); 111 virtual void SAL_CALL setAutoFilterMode( sal_Bool bAutoFilterMode ); 112 113 // Methods 114 virtual void SAL_CALL Activate(); 115 virtual void SAL_CALL Select(); 116 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ); 117 virtual void SAL_CALL Move( const css::uno::Any& Before, const css::uno::Any& After ) ; 118 virtual void SAL_CALL Copy( const css::uno::Any& Before, const css::uno::Any& After ); 119 virtual void SAL_CALL Paste( const css::uno::Any& Destination, const css::uno::Any& Link ); 120 virtual void SAL_CALL Delete( ); 121 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 ); 122 virtual void SAL_CALL Unprotect( const css::uno::Any& Password ); 123 124 virtual void SAL_CALL Calculate( ); 125 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 ); 126 // Hacks (?) 127 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Cells( const css::uno::Any &nRow, const css::uno::Any &nCol ); 128 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Rows(const css::uno::Any& aIndex ); 129 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Columns(const css::uno::Any& aIndex ); 130 131 virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ); 132 virtual css::uno::Any SAL_CALL PivotTables( const css::uno::Any& Index ); 133 virtual css::uno::Any SAL_CALL Comments( const css::uno::Any& Index ); 134 virtual css::uno::Any SAL_CALL Hyperlinks( const css::uno::Any& aIndex ); 135 virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ); 136 137 virtual css::uno::Any SAL_CALL OLEObjects( const css::uno::Any& Index ); 138 virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ); 139 140 virtual css::uno::Any SAL_CALL Buttons( const css::uno::Any& rIndex ); 141 virtual css::uno::Any SAL_CALL CheckBoxes( const css::uno::Any& rIndex ); 142 virtual css::uno::Any SAL_CALL DropDowns( const css::uno::Any& rIndex ); 143 virtual css::uno::Any SAL_CALL GroupBoxes( const css::uno::Any& rIndex ); 144 virtual css::uno::Any SAL_CALL Labels( const css::uno::Any& rIndex ); 145 virtual css::uno::Any SAL_CALL ListBoxes( const css::uno::Any& rIndex ); 146 virtual css::uno::Any SAL_CALL OptionButtons( const css::uno::Any& rIndex ); 147 virtual css::uno::Any SAL_CALL ScrollBars( const css::uno::Any& rIndex ); 148 virtual css::uno::Any SAL_CALL Spinners( const css::uno::Any& rIndex ); 149 150 virtual void SAL_CALL setEnableCalculation( ::sal_Bool EnableCalculation ); 151 virtual ::sal_Bool SAL_CALL getEnableCalculation( ); 152 virtual void SAL_CALL ShowDataForm( ); 153 // XInvocation 154 virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ); 155 virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ); 156 virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ); 157 virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ); 158 virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ); 159 virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ); 160 // CodeName 161 virtual rtl::OUString SAL_CALL getCodeName(); 162 sal_Int16 getSheetID(); 163 164 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 ); 165 // XHelperInterface 166 virtual rtl::OUString& getServiceImplName(); 167 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 168 }; 169 170 #endif /* SC_VBA_WORKSHEET_HXX */ 171