LibreOffice Module sc (master) 1
vbaworksheet.cxx
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#include <sal/config.h>
21
22#include <string_view>
23
24#include "vbaworksheet.hxx"
25#include "vbanames.hxx"
26
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/beans/XIntrospectionAccess.hpp>
29#include <com/sun/star/container/XNamed.hpp>
30#include <com/sun/star/util/XProtectable.hpp>
31#include <com/sun/star/table/XCellRange.hpp>
32#include <com/sun/star/sheet/XSpreadsheetView.hpp>
33#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
34#include <com/sun/star/sheet/XCalculatable.hpp>
35#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
36#include <com/sun/star/sheet/XSheetCellRange.hpp>
37#include <com/sun/star/sheet/XSheetCellCursor.hpp>
38#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
39#include <com/sun/star/sheet/XUsedAreaCursor.hpp>
40#include <com/sun/star/sheet/XSpreadsheets.hpp>
41#include <com/sun/star/sheet/XSheetOutline.hpp>
42#include <com/sun/star/sheet/XSheetPageBreak.hpp>
43#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
44#include <com/sun/star/sheet/XNamedRanges.hpp>
45#include <com/sun/star/frame/Desktop.hpp>
46#include <com/sun/star/table/XTableChartsSupplier.hpp>
47#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
48#include <com/sun/star/drawing/XControlShape.hpp>
49#include <com/sun/star/form/XFormsSupplier.hpp>
50#include <ooo/vba/excel/XApplication.hpp>
51#include <ooo/vba/excel/XlEnableSelection.hpp>
52#include <ooo/vba/excel/XlSheetVisibility.hpp>
53#include <ooo/vba/XControlProvider.hpp>
54
55#include <basic/sberrors.hxx>
58#include <utility>
60
61//zhangyun showdataform
62#include <scabstdlg.hxx>
63#include <tabvwsh.hxx>
64
65#include <tabprotection.hxx>
66#include "excelvbahelper.hxx"
67#include "vbaoutline.hxx"
68#include "vbarange.hxx"
69#include "vbacomments.hxx"
70#include "vbachartobjects.hxx"
71#include "vbapivottables.hxx"
72#include "vbaoleobjects.hxx"
73#include "vbapagesetup.hxx"
74#include "vbapagebreaks.hxx"
75#include "vbaworksheets.hxx"
76#include "vbahyperlinks.hxx"
77#include "vbasheetobjects.hxx"
78#include <dbdata.hxx>
79
80#include <attrib.hxx>
81
82#define STANDARDWIDTH 2267
83#define STANDARDHEIGHT 427
84
85using namespace com::sun::star;
86using namespace ooo::vba;
87
88static void getNewSpreadsheetName (OUString &aNewName, std::u16string_view aOldName, const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc )
89{
90 if (!xSpreadDoc.is())
91 throw lang::IllegalArgumentException( "getNewSpreadsheetName() xSpreadDoc is null", uno::Reference< uno::XInterface >(), 1 );
92 static const char aUnderScore[] = "_";
93 int currentNum =2;
94 aNewName = OUString::Concat(aOldName) + aUnderScore + OUString::number(currentNum) ;
95 SCTAB nTab = 0;
96 while ( ScVbaWorksheets::nameExists(xSpreadDoc,aNewName, nTab ) )
97 {
98 aNewName = OUString::Concat(aOldName) + aUnderScore + OUString::number(++currentNum);
99 }
100}
101
102static void removeAllSheets( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const OUString& aSheetName)
103{
104 if (!xSpreadDoc.is())
105 throw lang::IllegalArgumentException( "removeAllSheets() xSpreadDoc is null", uno::Reference< uno::XInterface >(), 1 );
106 uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
107 uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
108
109 if ( !xIndex.is() )
110 return;
111
112 uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
113 for (sal_Int32 i = xIndex->getCount() -1; i>= 1; i--)
114 {
115 uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(i), uno::UNO_QUERY);
116 uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
117 xNameContainer->removeByName(xNamed->getName());
118 }
119
120 uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY);
121 uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
122 xNamed->setName(aSheetName);
123}
124
125static uno::Reference<frame::XModel>
126openNewDoc(const OUString& aSheetName )
127{
128 uno::Reference<frame::XModel> xModel;
129 try
130 {
131 uno::Reference< uno::XComponentContext > xContext(
133
134 uno::Reference <frame::XDesktop2 > xComponentLoader = frame::Desktop::create(xContext);
135
136 uno::Reference<lang::XComponent > xComponent( xComponentLoader->loadComponentFromURL(
137 "private:factory/scalc",
138 "_blank", 0,
139 uno::Sequence < css::beans::PropertyValue >() ) );
140 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
141 removeAllSheets(xSpreadDoc,aSheetName);
142 xModel.set(xSpreadDoc,uno::UNO_QUERY_THROW);
143 }
144 catch ( uno::Exception & /*e*/ )
145 {
146 }
147 return xModel;
148}
149
150ScVbaWorksheet::ScVbaWorksheet(const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
151 uno::Reference< sheet::XSpreadsheet > xSheet,
152 uno::Reference< frame::XModel > xModel ) : WorksheetImpl_BASE( xParent, xContext ), mxSheet(std::move( xSheet )), mxModel(std::move(xModel)), mbVeryHidden( false )
153{
154}
155
156ScVbaWorksheet::ScVbaWorksheet( uno::Sequence< uno::Any> const & args,
157 uno::Reference< uno::XComponentContext> const & xContext ) : WorksheetImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ), mbVeryHidden( false )
158{
159 if ( args.getLength() < 3 )
160 throw lang::IllegalArgumentException();
161
162 OUString sSheetName;
163 args[2] >>= sSheetName;
164
165 uno::Reference< sheet::XSpreadsheetDocument > xSpreadDoc( mxModel, uno::UNO_QUERY_THROW );
166 uno::Reference< container::XNameAccess > xNameAccess( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
167 mxSheet.set( xNameAccess->getByName( sSheetName ), uno::UNO_QUERY_THROW );
168}
169
171{
172}
173
174const uno::Sequence<sal_Int8>& ScVbaWorksheet::getUnoTunnelId()
175{
176 static const comphelper::UnoIdInit theScVbaWorksheetUnoTunnelId;
177 return theScVbaWorksheetUnoTunnelId.getSeq();
178}
179
180uno::Reference< ov::excel::XWorksheet >
181ScVbaWorksheet::createSheetCopyInNewDoc(const OUString& aCurrSheetName)
182{
183 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
184 uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
185 uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xSheetCellCursor);
186 if (xRange.is())
187 xRange->Select();
189 uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
190 if (xModel.is())
191 {
193 }
194 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
195 excel::setUpDocumentModules(xSpreadDoc);
196 uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_SET_THROW );
197 uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW );
198 uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW);
199
201 OUString aCodeName;
202 if (pShell)
203 pShell->GetDocument().GetCodeName( 0, aCodeName );
204 return uno::Reference< excel::XWorksheet >( getUnoDocModule( aCodeName, pShell ), uno::UNO_QUERY_THROW );
205}
206
207css::uno::Reference< ov::excel::XWorksheet >
208ScVbaWorksheet::createSheetCopy(uno::Reference<excel::XWorksheet> const & xSheet, bool bAfter)
209{
210 OUString aCurrSheetName = getName();
211 ScVbaWorksheet* pDestSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSheet );
212
213 uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
214 uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
215
216 SCTAB nDest = 0;
217 SCTAB nSrc = 0;
218 OUString aSheetName = xSheet->getName();
219 bool bSameDoc = ( pDestSheet->getModel() == getModel() );
220 bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest );
221 bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc );
222
223 // set sheet name to be newSheet name
224 aSheetName = aCurrSheetName;
225 if ( bSheetExists && bDestSheetExists )
226 {
227 SCTAB nDummy=0;
228 if(bAfter)
229 nDest++;
230 uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
231 if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) )
232 getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
233 if ( bSameDoc )
234 xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
235 else
236 {
237 ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
238 ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
239 if ( pDestDocShell && pSrcDocShell )
240 pDestDocShell->TransferTab( *pSrcDocShell, nSrc, nDest, true, true );
241 }
242 }
243 // return new sheet
244 uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
245 uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::Any( aSheetName ) ), uno::UNO_QUERY_THROW );
246 return xNewSheet;
247}
248
249OUString
251{
252 uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW );
253 return xNamed->getName();
254}
255
256void
257ScVbaWorksheet::setName(const OUString &rName )
258{
259 uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW );
260 xNamed->setName( rName );
261}
262
263sal_Int32
265{
266 uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
267 bool bVisible = false;
268 xProps->getPropertyValue( "IsVisible" ) >>= bVisible;
269 using namespace ::ooo::vba::excel::XlSheetVisibility;
270 return bVisible ? xlSheetVisible : (mbVeryHidden ? xlSheetVeryHidden : xlSheetHidden);
271}
272
273void
274ScVbaWorksheet::setVisible( sal_Int32 nVisible )
275{
276 using namespace ::ooo::vba::excel::XlSheetVisibility;
277 bool bVisible = true;
278 switch( nVisible )
279 {
280 case xlSheetVisible: case 1: // Excel accepts -1 and 1 for visible sheets
281 bVisible = true;
282 mbVeryHidden = false;
283 break;
284 case xlSheetHidden:
285 bVisible = false;
286 mbVeryHidden = false;
287 break;
288 case xlSheetVeryHidden:
289 bVisible = false;
290 mbVeryHidden = true;
291 break;
292 default:
293 throw uno::RuntimeException();
294 }
295 uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
296 xProps->setPropertyValue( "IsVisible", uno::Any( bVisible ) );
297}
298
299sal_Int16
301{
302 return getSheetID() + 1;
303}
304
305sal_Int32
307{
308 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
309 SCTAB nTab = 0;
310 if ( !ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
311 throw uno::RuntimeException("Sheet Name does not exist." );
312
313 if ( ScDocShell* pShell = excel::getDocShell( getModel() ))
314 {
315 ScDocument& rDoc = pShell->GetDocument();
316 const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
317 bool bLockedCells = false;
318 bool bUnlockedCells = false;
319 if( pProtect )
320 {
323 }
324 if( bLockedCells )
325 return excel::XlEnableSelection::xlNoRestrictions;
326 if( bUnlockedCells )
327 return excel::XlEnableSelection::xlUnlockedCells;
328 }
329 return excel::XlEnableSelection::xlNoSelection;
330
331}
332
333void
335{
336 if( (nSelection != excel::XlEnableSelection::xlNoRestrictions) &&
337 (nSelection != excel::XlEnableSelection::xlUnlockedCells) &&
338 (nSelection != excel::XlEnableSelection::xlNoSelection) )
339 {
340 DebugHelper::runtimeexception(ERRCODE_BASIC_BAD_PARAMETER);
341 }
342
343 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
344 SCTAB nTab = 0;
345 if ( !ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
346 throw uno::RuntimeException("Sheet Name does not exist." );
347
348 if ( ScDocShell* pShell = excel::getDocShell( getModel() ))
349 {
350 ScDocument& rDoc = pShell->GetDocument();
351 const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
352 // default is xlNoSelection
353 bool bLockedCells = false;
354 bool bUnlockedCells = false;
355 if( nSelection == excel::XlEnableSelection::xlNoRestrictions )
356 {
357 bLockedCells = true;
358 bUnlockedCells = true;
359 }
360 else if( nSelection == excel::XlEnableSelection::xlUnlockedCells )
361 {
362 bUnlockedCells = true;
363 }
364 if( pProtect )
365 {
366 ScTableProtection aNewProtect(*pProtect);
367 aNewProtect.setOption(ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells);
368 aNewProtect.setOption(ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells);
369 rDoc.SetTabProtection(nTab, &aNewProtect);
370 }
371 }
372}
373
375{
376 if ( ScDocShell* pShell = excel::getDocShell( getModel() ))
377 {
378 ScDocument& rDoc = pShell->GetDocument();
379 ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
380 if (pDBData)
381 return pDBData->HasAutoFilter();
382 }
383 return false;
384}
385
386void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode )
387{
388 ScDocShell* pDocShell = excel::getDocShell( getModel() );
389 if (!pDocShell)
390 return;
391 ScDocument& rDoc = pDocShell->GetDocument();
392 ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
393 if (!pDBData)
394 return;
395
396 pDBData->SetAutoFilter(bAutoFilterMode);
397 ScRange aRange;
398 pDBData->GetArea(aRange);
399 if (bAutoFilterMode)
400 rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
401 aRange.aEnd.Col(), aRange.aStart.Row(),
402 aRange.aStart.Tab(), ScMF::Auto );
403 else if (!bAutoFilterMode)
404 rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
405 aRange.aEnd.Col(), aRange.aStart.Row(),
406 aRange.aStart.Tab(), ScMF::Auto );
407 ScRange aPaintRange(aRange.aStart, aRange.aEnd);
408 aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
409 pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
410}
411
412uno::Reference< excel::XRange >
414{
415 uno::Reference< sheet::XSheetCellRange > xSheetCellRange(getSheet(), uno::UNO_QUERY_THROW );
416 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor( getSheet()->createCursorByRange( xSheetCellRange ), uno::UNO_SET_THROW );
417 uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
418 xUsedCursor->gotoStartOfUsedArea( false );
419 xUsedCursor->gotoEndOfUsedArea( true );
420 return new ScVbaRange(this, mxContext, xSheetCellCursor);
421}
422
423uno::Reference< excel::XOutline >
425{
426 uno::Reference<sheet::XSheetOutline> xOutline(getSheet(),uno::UNO_QUERY_THROW);
427 return new ScVbaOutline( this, mxContext, xOutline);
428}
429
430uno::Reference< excel::XPageSetup >
432{
433 return new ScVbaPageSetup( this, mxContext, getSheet(), getModel() );
434}
435
438{
439 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(getSheet(),uno::UNO_QUERY_THROW);
440 uno::Reference< excel::XHPageBreaks > xHPageBreaks( new ScVbaHPageBreaks( this, mxContext, xSheetPageBreak));
441 if ( aIndex.hasValue() )
442 return xHPageBreaks->Item( aIndex, uno::Any());
443 return uno::Any( xHPageBreaks );
444}
445
448{
449 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak( getSheet(), uno::UNO_QUERY_THROW );
450 uno::Reference< excel::XVPageBreaks > xVPageBreaks( new ScVbaVPageBreaks( this, mxContext, xSheetPageBreak ) );
451 if( aIndex.hasValue() )
452 return xVPageBreaks->Item( aIndex, uno::Any());
453 return uno::Any( xVPageBreaks );
454}
455
456sal_Int32
458{
459 return STANDARDWIDTH ;
460}
461
462sal_Int32
464{
465 return STANDARDHEIGHT;
466}
467
470{
471 return false;
472}
473
476{
477 uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
478 return xProtectable->isProtected();
479}
480
483{
484 SCTAB nTab = 0;
485 OUString aSheetName = getName();
486 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
487 bool bSheetExists = ScVbaWorksheets::nameExists (xSpreadDoc, aSheetName, nTab);
488 if ( bSheetExists )
489 {
490 if ( ScDocShell* pShell = excel::getDocShell( getModel() ))
491 {
492 ScDocument& rDoc = pShell->GetDocument();
493 const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
494 if ( pProtect )
496 }
497 }
498 return false;
499}
500
503{
504 return false;
505}
506
507void
509{
510 uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
511 getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
512 xSpreadsheet->setActiveSheet(getSheet());
513}
514
515void
517{
518 Activate();
519}
520
521void
522ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After )
523{
524 uno::Reference<excel::XWorksheet> xSheet;
525 OUString aCurrSheetName = getName();
526
527 if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
528 {
529 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
530 uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
531 // #FIXME needs worksheet as parent
532 uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xSheetCellCursor);
533 if (xRange.is())
534 xRange->Select();
536 uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
537 if (xModel.is())
538 {
540 Delete();
541 }
542 return ;
543 }
544
545 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
546 SCTAB nDest = 0;
547 if ( ScVbaWorksheets::nameExists (xSpreadDoc, xSheet->getName(), nDest) )
548 {
549 bool bAfter = After.hasValue();
550 if (bAfter)
551 nDest++;
552 uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
553 xSheets->moveByName(aCurrSheetName,nDest);
554 }
555}
556
557void
558ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After )
559{
560 uno::Reference<excel::XWorksheet> xSheet;
561 if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
562 {
564 return;
565 }
566
567 uno::Reference<excel::XWorksheet> xNewSheet = createSheetCopy(xSheet, After.hasValue());
568 xNewSheet->Activate();
569}
570
571void
573{
574 // #TODO# #FIXME# Link is not used
575 uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
576 if ( xRange.is() )
577 xRange->Select();
579}
580
581void
583{
584 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
585 OUString aSheetName = getName();
586 SCTAB nTab = 0;
587 if (!ScVbaWorksheets::nameExists(xSpreadDoc, aSheetName, nTab ))
588 {
589 return;
590 }
591 uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
592 uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
593 xNameContainer->removeByName(aSheetName);
594 mxSheet.clear();
595}
596
597uno::Reference< excel::XWorksheet >
599{
600 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
601 uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_SET_THROW );
602 uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW );
603
604 SCTAB nIdx = 0;
605 if ( !ScVbaWorksheets::nameExists (xSpreadDoc, getName(), nIdx ) )
606 return uno::Reference< excel::XWorksheet >();
607 nIdx = nIdx + offset;
608 uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(nIdx), uno::UNO_QUERY_THROW);
609 // parent will be the parent of 'this' worksheet
610 return new ScVbaWorksheet (getParent(), mxContext, xSheet, getModel());
611}
612
613uno::Reference< excel::XWorksheet >
615{
616 return getSheetAtOffset(static_cast<SCTAB>(1));
617}
618
619uno::Reference< excel::XWorksheet >
621{
622 return getSheetAtOffset(-1);
623}
624
625void
626ScVbaWorksheet::Protect( const uno::Any& Password, const uno::Any& /*DrawingObjects*/, const uno::Any& /*Contents*/, const uno::Any& /*Scenarios*/, const uno::Any& /*UserInterfaceOnly*/ )
627{
628 // #TODO# #FIXME# is there anything we can do with the unused param
629 // can the implementation use anything else here
630 uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
631 OUString aPasswd;
632 Password >>= aPasswd;
633 xProtectable->protect( aPasswd );
634}
635
636void
638{
639 uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
640 OUString aPasswd;
641 Password >>= aPasswd;
642 xProtectable->unprotect( aPasswd );
643}
644
645void
647{
648 uno::Reference <sheet::XCalculatable> xReCalculate(getModel(), uno::UNO_QUERY_THROW);
649 xReCalculate->calculate();
650}
651
652uno::Reference< excel::XRange >
653ScVbaWorksheet::Range( const ::uno::Any& Cell1, const ::uno::Any& Cell2 )
654{
655 uno::Reference< excel::XRange > xSheetRange( new ScVbaRange( this, mxContext
656, uno::Reference< table::XCellRange >( getSheet(), uno::UNO_QUERY_THROW ) ) );
657 return xSheetRange->Range( Cell1, Cell2 );
658}
659
660void
661ScVbaWorksheet::CheckSpelling( const uno::Any& /*CustomDictionary*/,const uno::Any& /*IgnoreUppercase*/,const uno::Any& /*AlwaysSuggest*/, const uno::Any& /*SpellingLang*/ )
662{
663 // #TODO# #FIXME# unused params above, can we do anything with those
664 uno::Reference< frame::XModel > xModel( getModel() );
665 dispatchRequests(xModel,".uno:SpellDialog");
666}
667
668uno::Reference< excel::XRange >
670{
671 uno::Reference< table::XCellRange > xRange( getSheet(),uno::UNO_QUERY_THROW );
672 return uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRange ) );
673}
674
675// These are hacks - we prolly (somehow) need to inherit
676// the vbarange functionality here ...
677uno::Reference< excel::XRange >
678ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol )
679{
680 // Performance optimization for often-called Cells method:
681 // Use a common helper method instead of creating a new ScVbaRange object
682 uno::Reference< table::XCellRange > xRange( getSheet(), uno::UNO_QUERY_THROW );
683 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
684 if(ScDocShell* pShell = excel::getDocShell( xModel ))
685 return ScVbaRange::CellsHelper(pShell->GetDocument(), this, mxContext, xRange, nRow, nCol );
686 throw uno::RuntimeException();
687}
688
689uno::Reference< excel::XRange >
691{
692 return getSheetRange()->Rows( aIndex );
693}
694
695uno::Reference< excel::XRange >
697{
698 return getSheetRange()->Columns( aIndex );
699}
700
701uno::Any SAL_CALL
703{
704 if ( !mxCharts.is() )
705 {
706 uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
707 uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
708
709 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
710 mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
711 }
712 if ( Index.hasValue() )
713 {
714 uno::Reference< XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW );
715 return xColl->Item( Index, uno::Any() );
716 }
717 else
718 return uno::Any( mxCharts );
719
720}
721
722uno::Any SAL_CALL
724{
725 uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
726 uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
727 uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
728
729 uno::Reference< XCollection > xColl( new ScVbaPivotTables( this, mxContext, xIndexAccess ) );
730 if ( Index.hasValue() )
731 return xColl->Item( Index, uno::Any() );
732 return uno::Any( xColl );
733}
734
735uno::Any SAL_CALL
737{
738 uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
739 uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xSheet, uno::UNO_QUERY_THROW );
740 uno::Reference< sheet::XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), uno::UNO_SET_THROW );
741 uno::Reference< container::XIndexAccess > xIndexAccess( xAnnos, uno::UNO_QUERY_THROW );
742 uno::Reference< XCollection > xColl( new ScVbaComments( this, mxContext, mxModel, xIndexAccess ) );
743 if ( Index.hasValue() )
744 return xColl->Item( Index, uno::Any() );
745 return uno::Any( xColl );
746}
747
748uno::Any SAL_CALL
750{
751 /* The worksheet always returns the same Hyperlinks object.
752 See vbahyperlinks.hxx for more details. */
753 if( !mxHlinks.is() )
754 mxHlinks.set( new ScVbaHyperlinks( this, mxContext ) );
755 if( aIndex.hasValue() )
756 return uno::Reference< XCollection >( mxHlinks, uno::UNO_QUERY_THROW )->Item( aIndex, uno::Any() );
757 return uno::Any( mxHlinks );
758}
759
760uno::Any SAL_CALL
761ScVbaWorksheet::Names( const css::uno::Any& aIndex )
762{
763 css::uno::Reference<css::beans::XPropertySet> xProps(getSheet(), css::uno::UNO_QUERY_THROW);
764 uno::Reference< sheet::XNamedRanges > xNamedRanges( xProps->getPropertyValue("NamedRanges"), uno::UNO_QUERY_THROW );
765 uno::Reference< XCollection > xNames( new ScVbaNames( this, mxContext, xNamedRanges, mxModel ) );
766 if ( aIndex.hasValue() )
767 return xNames->Item( aIndex, uno::Any() );
768 return uno::Any( xNames );
769}
770
771uno::Any SAL_CALL
773{
774 uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
775 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
776 uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPageSupplier->getDrawPage(), uno::UNO_SET_THROW );
777 uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPage, uno::UNO_QUERY_THROW );
778
779 uno::Reference< excel::XOLEObjects >xOleObjects( new ScVbaOLEObjects( this, mxContext, xIndexAccess ) );
780 if( Index.hasValue() )
781 return xOleObjects->Item( Index, uno::Any() );
782 return uno::Any( xOleObjects );
783}
784
785uno::Any SAL_CALL
787{
788 uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
789 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
790 uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
791 uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW );
792
793 uno::Reference< msforms::XShapes> xVbaShapes( new ScVbaShapes( this, mxContext, xIndexAccess, getModel() ) );
794 if ( aIndex.hasValue() )
795 return xVbaShapes->Item( aIndex, uno::Any() );
796 return uno::Any( xVbaShapes );
797}
798
800ScVbaWorksheet::getButtons( const uno::Any &rIndex, bool bOptionButtons )
801{
802 ::rtl::Reference< ScVbaSheetObjectsBase > &rxButtons = bOptionButtons ? mxButtons[0] : mxButtons[1];
803
804 if( !rxButtons.is() )
805 rxButtons.set( new ScVbaButtons( this, mxContext, mxModel, mxSheet, bOptionButtons ) );
806 else
807 rxButtons->collectShapes();
808 if( rIndex.hasValue() )
809 return rxButtons->Item( rIndex, uno::Any() );
810 return uno::Any( uno::Reference< XCollection >( rxButtons ) );
811}
812
813uno::Any SAL_CALL
815{
816 return getButtons( rIndex, false );
817}
818
819uno::Any SAL_CALL
821{
822 throw uno::RuntimeException();
823}
824
825uno::Any SAL_CALL
827{
828 throw uno::RuntimeException();
829}
830
831uno::Any SAL_CALL
833{
834 throw uno::RuntimeException();
835}
836
837uno::Any SAL_CALL
839{
840 throw uno::RuntimeException();
841}
842
843uno::Any SAL_CALL
845{
846 throw uno::RuntimeException();
847}
848
849uno::Any SAL_CALL
851{
852 return getButtons( rIndex, true );
853}
854
855uno::Any SAL_CALL
857{
858 throw uno::RuntimeException();
859}
860
861uno::Any SAL_CALL
863{
864 throw uno::RuntimeException();
865}
866
867void SAL_CALL
869{
870 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
872
874
876 pTabViewShell));
877
878 pDlg->Execute();
879}
880
881uno::Any SAL_CALL
882ScVbaWorksheet::Evaluate( const OUString& Name )
883{
884 // #TODO Evaluate allows other things to be evaluated, e.g. functions
885 // I think ( like SIN(3) etc. ) need to investigate that
886 // named Ranges also? e.g. [MyRange] if so need a list of named ranges
887 uno::Any aVoid;
888 return uno::Any( Range( uno::Any( Name ), aVoid ) );
889}
890
891uno::Reference< beans::XIntrospectionAccess > SAL_CALL
893{
894 return uno::Reference< beans::XIntrospectionAccess >();
895}
896
897uno::Any SAL_CALL
898ScVbaWorksheet::invoke( const OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ )
899{
900 throw uno::RuntimeException("Unsupported"); // unsupported operation
901}
902
903void SAL_CALL
904ScVbaWorksheet::setValue( const OUString& aPropertyName, const uno::Any& aValue )
905{
906 setDefaultPropByIntrospection( getValue( aPropertyName ), aValue );
907}
908uno::Any SAL_CALL
909ScVbaWorksheet::getValue( const OUString& aPropertyName )
910{
911 uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
912
913 uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
914 uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext("ooo.vba.ControlProvider", mxContext ), uno::UNO_QUERY_THROW );
915 uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) );
916 return uno::Any( xControl );
917}
918
919sal_Bool SAL_CALL
920ScVbaWorksheet::hasMethod( const OUString& /*aName*/ )
921{
922 return false;
923}
924
925uno::Reference< container::XNameAccess >
927{
928 uno::Reference< container::XNameAccess > xFormControls;
929 try
930 {
931 uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
932 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
933 uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
934 uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
935 // get the www-standard container ( maybe we should access the
936 // 'www-standard' by name rather than index, this seems an
937 // implementation detail
938 if( xIndexAccess->hasElements() )
939 xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
940
941 }
942 catch( uno::Exception& )
943 {
944 }
945 return xFormControls;
946
947 }
948sal_Bool SAL_CALL
949ScVbaWorksheet::hasProperty( const OUString& aName )
950{
951 uno::Reference< container::XNameAccess > xFormControls( getFormControls() );
952 if ( xFormControls.is() )
953 return xFormControls->hasByName( aName );
954 return false;
955}
956
958ScVbaWorksheet::getControlShape( std::u16string_view sName )
959{
960 // ideally we would get an XControl object but it appears an XControl
961 // implementation only exists for a Control implementation obtained from the
962 // view ( e.g. in basic you would get this from
963 // thiscomponent.currentcontroller.getControl( controlModel ) )
964 // and the thing to realise is that it is only possible to get an XControl
965 // for a currently displayed control :-( often we would want to modify
966 // a control not on the active sheet. But... you can always access the
967 // XControlShape from the DrawPage whether that is the active drawpage or not
968
969 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW );
970 uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
971
972 sal_Int32 nCount = xIndexAccess->getCount();
973 for( int index = 0; index < nCount; index++ )
974 {
975 uno::Any aUnoObj = xIndexAccess->getByIndex( index );
976 // It seems there are some drawing objects that can not query into Control shapes?
977 uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY );
978 if( xControlShape.is() )
979 {
980 uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW );
981 if( sName == xNamed->getName() )
982 {
983 return aUnoObj;
984 }
985 }
986 }
987 return uno::Any();
988}
989
990OUString
992{
993 return "ScVbaWorksheet";
994}
995
996void SAL_CALL
998{
999 uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
1000 xCalculatable->enableAutomaticCalculation( bEnableCalculation);
1001}
1002sal_Bool SAL_CALL
1004{
1005 uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
1006 return xCalculatable->isAutomaticCalculationEnabled();
1007}
1008
1009uno::Sequence< OUString >
1011{
1012 static uno::Sequence< OUString > const aServiceNames
1013 {
1014 "ooo.vba.excel.Worksheet"
1015 };
1016 return aServiceNames;
1017}
1018
1019OUString SAL_CALL
1021{
1022 uno::Reference< beans::XPropertySet > xSheetProp( mxSheet, uno::UNO_QUERY_THROW );
1023 return xSheetProp->getPropertyValue("CodeName").get< OUString >();
1024}
1025
1026sal_Int16
1028{
1029 uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW ); // if ActiveSheet, mxSheet is null.
1030 return xAddressable->getRangeAddress().Sheet;
1031}
1032
1033void SAL_CALL
1034ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName, const uno::Any& )
1035{
1036 sal_Int32 nTo = 0;
1037 sal_Int32 nFrom = 0;
1038 bool bSelection = false;
1039 From >>= nFrom;
1040 To >>= nTo;
1041
1042 if ( !( nFrom || nTo ) )
1043 bSelection = true;
1044
1045 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
1046 PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
1047}
1048
1049void SAL_CALL
1050ScVbaWorksheet::ExportAsFixedFormat(const css::uno::Any& Type, const css::uno::Any& FileName, const css::uno::Any& Quality,
1051 const css::uno::Any& IncludeDocProperties, const css::uno::Any& /*IgnorePrintAreas*/, const css::uno::Any& From,
1052 const css::uno::Any& To, const css::uno::Any& OpenAfterPublish, const css::uno::Any& /*FixedFormatExtClassPtr*/)
1053{
1054 uno::Reference< frame::XModel > xModel(getModel(), uno::UNO_SET_THROW);
1055 uno::Reference< excel::XApplication > xApplication(Application(), uno::UNO_QUERY_THROW);
1056
1057 excel::ExportAsFixedFormatHelper(xModel, xApplication, Type, FileName, Quality,
1058 IncludeDocProperties, From, To, OpenAfterPublish);
1059}
1060
1061sal_Int64 SAL_CALL
1062ScVbaWorksheet::getSomething(const uno::Sequence<sal_Int8 > & rId)
1063{
1064 return comphelper::getSomethingImpl(rId, this);
1065}
1066
1067extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1069 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
1070{
1071 return cppu::acquire(new ScVbaWorksheet(args, context));
1072}
1073
1074/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
css::uno::Reference< css::frame::XModel2 > mxModel
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual css::uno::Any SAL_CALL Application() override
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
virtual VclPtr< AbstractScDataFormDlg > CreateScDataFormDlg(weld::Window *pParent, ScTabViewShell *pTabViewShell)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
SCCOL Col() const
Definition: address.hxx:279
bool HasAutoFilter() const
Definition: dbdata.hxx:212
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:298
void SetAutoFilter(bool bSet)
Definition: dbdata.hxx:213
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:101
sal_uLong TransferTab(ScDocShell &rSrcDocShell, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew, bool bNotifyAndPaint)
Definition: docsh5.cxx:863
SC_DLLPUBLIC bool RemoveFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:4980
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1914
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:4970
const OUString & GetCodeName() const
Definition: document.hxx:609
SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection *pProtect)
Definition: documen3.cxx:1922
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
Definition: document.cxx:290
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
sheet protection state container
bool isOptionEnabled(Option eOption) const
void setOption(Option eOption, bool bEnabled)
Collection containing all button controls from a sheet (not ActiveX controls).
static css::uno::Reference< ov::excel::XRange > CellsHelper(const ScDocument &rDoc, const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::table::XCellRange > &xRange, const css::uno::Any &nRowIndex, const css::uno::Any &nColumnIndex)
Definition: vbarange.cxx:2218
virtual void SAL_CALL Paste(const css::uno::Any &Destination, const css::uno::Any &Link) override
virtual css::uno::Any SAL_CALL Evaluate(const OUString &Name) override
virtual void SAL_CALL setVisible(sal_Int32 nVisible) override
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
css::uno::Reference< ov::excel::XChartObjects > mxCharts
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
::rtl::Reference< ScVbaSheetObjectsBase > mxButtons[2]
virtual void SAL_CALL Copy(const css::uno::Any &Before, const css::uno::Any &After) override
virtual sal_Bool SAL_CALL hasProperty(const OUString &aName) override
virtual void SAL_CALL setName(const OUString &rName) override
virtual void SAL_CALL setEnableCalculation(sal_Bool EnableCalculation) override
virtual css::uno::Any SAL_CALL ChartObjects(const css::uno::Any &Index) override
virtual css::uno::Any SAL_CALL Spinners(const css::uno::Any &rIndex) override
virtual css::uno::Reference< ov::excel::XOutline > SAL_CALL Outline() override
virtual ::sal_Int32 SAL_CALL getStandardWidth() override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
virtual css::uno::Any SAL_CALL OLEObjects(const css::uno::Any &Index) override
virtual sal_Int16 SAL_CALL getIndex() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual ~ScVbaWorksheet() override
virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getUsedRange() override
virtual sal_Bool SAL_CALL getProtectionMode() override
virtual void SAL_CALL Unprotect(const css::uno::Any &Password) override
virtual ::sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
sal_Int16 getSheetID() const
virtual css::uno::Any SAL_CALL ListBoxes(const css::uno::Any &rIndex) override
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
virtual sal_Bool SAL_CALL hasMethod(const OUString &aName) override
css::uno::Reference< ov::excel::XWorksheet > createSheetCopyInNewDoc(const OUString &)
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Rows(const css::uno::Any &aIndex) override
virtual OUString SAL_CALL getName() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Cells(const css::uno::Any &nRow, const css::uno::Any &nCol) override
virtual css::uno::Any SAL_CALL Buttons(const css::uno::Any &rIndex) override
virtual void SAL_CALL Delete() override
virtual sal_Bool SAL_CALL getProtectContents() override
virtual void SAL_CALL setEnableSelection(sal_Int32 nSelection) override
virtual css::uno::Any SAL_CALL Hyperlinks(const css::uno::Any &aIndex) override
virtual sal_Int32 SAL_CALL getEnableSelection() override
virtual css::uno::Any SAL_CALL Shapes(const css::uno::Any &aIndex) override
virtual css::uno::Any SAL_CALL Comments(const css::uno::Any &Index) override
const css::uno::Reference< css::frame::XModel > & getModel() const
css::uno::Reference< ov::excel::XHyperlinks > mxHlinks
virtual css::uno::Any SAL_CALL Names(const css::uno::Any &aIndex) override
virtual void SAL_CALL Activate() override
virtual ::sal_Int32 SAL_CALL getStandardHeight() override
virtual sal_Int32 SAL_CALL getVisible() override
virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getNext() override
virtual void SAL_CALL ShowDataForm() override
css::uno::Reference< css::sheet::XSpreadsheet > mxSheet
virtual css::uno::Any SAL_CALL DropDowns(const css::uno::Any &rIndex) override
virtual void SAL_CALL ExportAsFixedFormat(const css::uno::Any &Type, const css::uno::Any &FileName, const css::uno::Any &Quality, const css::uno::Any &IncludeDocProperties, const css::uno::Any &IgnorePrintAreas, const css::uno::Any &From, const css::uno::Any &To, const css::uno::Any &OpenAfterPublish, const css::uno::Any &FixedFormatExtClassPtr) override
virtual void SAL_CALL setValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Any SAL_CALL VPageBreaks(const css::uno::Any &aIndex) override
virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getPrevious() override
virtual css::uno::Reference< ov::excel::XPageSetup > SAL_CALL PageSetup() override
virtual css::uno::Any SAL_CALL Labels(const css::uno::Any &rIndex) override
virtual css::uno::Any SAL_CALL GroupBoxes(const css::uno::Any &rIndex) override
virtual void SAL_CALL Select() override
css::uno::Reference< ov::excel::XWorksheet > getSheetAtOffset(SCTAB offset)
css::uno::Reference< ov::excel::XRange > getSheetRange()
css::uno::Reference< css::frame::XModel > mxModel
virtual void SAL_CALL setAutoFilterMode(sal_Bool bAutoFilterMode) override
virtual OUString getServiceImplName() override
css::uno::Any getButtons(const css::uno::Any &rIndex, bool bOptionButtons)
virtual OUString SAL_CALL getCodeName() override
virtual sal_Bool SAL_CALL getProtectDrawingObjects() override
virtual css::uno::Any SAL_CALL CheckBoxes(const css::uno::Any &rIndex) override
virtual void SAL_CALL Calculate() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Columns(const css::uno::Any &aIndex) override
virtual sal_Bool SAL_CALL getProtectScenarios() override
virtual sal_Bool SAL_CALL getEnableCalculation() override
css::uno::Reference< css::container::XNameAccess > getFormControls() const
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
css::uno::Reference< ov::excel::XWorksheet > createSheetCopy(css::uno::Reference< ov::excel::XWorksheet > const &xSheet, bool bAfter)
virtual void SAL_CALL Move(const css::uno::Any &Before, const css::uno::Any &After) override
virtual sal_Bool SAL_CALL getAutoFilterMode() override
virtual css::uno::Any SAL_CALL getValue(const OUString &aPropertyName) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range(const css::uno::Any &Cell1, const css::uno::Any &Cell2) override
const css::uno::Reference< css::sheet::XSpreadsheet > & getSheet() const
virtual css::uno::Any SAL_CALL HPageBreaks(const css::uno::Any &aIndex) override
virtual css::uno::Any SAL_CALL PivotTables(const css::uno::Any &Index) override
virtual css::uno::Any SAL_CALL OptionButtons(const css::uno::Any &rIndex) override
ScVbaWorksheet(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, css::uno::Reference< css::sheet::XSpreadsheet > xSheet, css::uno::Reference< css::frame::XModel > xModel)
virtual css::uno::Any SAL_CALL ScrollBars(const css::uno::Any &rIndex) override
css::uno::Any getControlShape(std::u16string_view sName)
static bool nameExists(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &xSpreadDoc, std::u16string_view name, SCTAB &nTab)
weld::Window * GetFrameWeld() const
const css::uno::Sequence< sal_Int8 > & getSeq() const
int nCount
std::deque< AttacherIndex_Impl > aIndex
Sequence< OUString > aServiceNames
OUString sName
OUString aName
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
Reference< XComponentContext > getProcessComponentContext()
Type
int i
index
void setUpDocumentModules(const uno::Reference< sheet::XSpreadsheetDocument > &xDoc)
ScDocShell * getDocShell(const css::uno::Reference< css::frame::XModel > &xModel)
void implnPaste(const uno::Reference< frame::XModel > &xModel)
void ExportAsFixedFormatHelper(const uno::Reference< frame::XModel > &xModel, const css::uno::Reference< XApplication > &xApplication, const css::uno::Any &Type, const css::uno::Any &FileName, const css::uno::Any &Quality, const css::uno::Any &IncludeDocProperties, const css::uno::Any &From, const css::uno::Any &To, const css::uno::Any &OpenAfterPublish)
ScTabViewShell * getBestViewShell(const css::uno::Reference< css::frame::XModel > &xModel)
void implnCopy(const uno::Reference< frame::XModel > &xModel)
VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection(const css::uno::Any &aObj, const css::uno::Any &aValue)
css::uno::Reference< T > getXSomethingFromArgs(css::uno::Sequence< css::uno::Any > const &args, sal_Int32 nPos, bool bCanBeNull=true)
VBAHELPER_DLLPUBLIC void PrintOutHelper(SfxViewShell const *pViewShell, 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, bool bSelection)
uno::Reference< XHelperInterface > getUnoDocModule(std::u16string_view aModName, SfxObjectShell const *pShell)
VBAHELPER_DLLPUBLIC void dispatchRequests(const css::uno::Reference< css::frame::XModel > &xModel, const OUString &aUrl)
args
Destination
#define ERRCODE_BASIC_BAD_PARAMETER
bool hasValue()
Reference< XModel > xModel
bool bVisible
OUString Name
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22
#define STANDARDWIDTH
static void removeAllSheets(const uno::Reference< sheet::XSpreadsheetDocument > &xSpreadDoc, const OUString &aSheetName)
static void getNewSpreadsheetName(OUString &aNewName, std::u16string_view aOldName, const uno::Reference< sheet::XSpreadsheetDocument > &xSpreadDoc)
static uno::Reference< frame::XModel > openNewDoc(const OUString &aSheetName)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScVbaWorksheet_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
#define STANDARDHEIGHT