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 pShell->GetDocument().GetCodeName( 0, aCodeName );
203 return uno::Reference< excel::XWorksheet >( getUnoDocModule( aCodeName, pShell ), uno::UNO_QUERY_THROW );
204}
205
206css::uno::Reference< ov::excel::XWorksheet >
207ScVbaWorksheet::createSheetCopy(uno::Reference<excel::XWorksheet> const & xSheet, bool bAfter)
208{
209 OUString aCurrSheetName = getName();
210 ScVbaWorksheet* pDestSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSheet );
211
212 uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
213 uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
214
215 SCTAB nDest = 0;
216 SCTAB nSrc = 0;
217 OUString aSheetName = xSheet->getName();
218 bool bSameDoc = ( pDestSheet->getModel() == getModel() );
219 bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest );
220 bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc );
221
222 // set sheet name to be newSheet name
223 aSheetName = aCurrSheetName;
224 if ( bSheetExists && bDestSheetExists )
225 {
226 SCTAB nDummy=0;
227 if(bAfter)
228 nDest++;
229 uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
230 if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) )
231 getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
232 if ( bSameDoc )
233 xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
234 else
235 {
236 ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
237 ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
238 if ( pDestDocShell && pSrcDocShell )
239 pDestDocShell->TransferTab( *pSrcDocShell, nSrc, nDest, true, true );
240 }
241 }
242 // return new sheet
243 uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
244 uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::Any( aSheetName ) ), uno::UNO_QUERY_THROW );
245 return xNewSheet;
246}
247
248OUString
250{
251 uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW );
252 return xNamed->getName();
253}
254
255void
256ScVbaWorksheet::setName(const OUString &rName )
257{
258 uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW );
259 xNamed->setName( rName );
260}
261
262sal_Int32
264{
265 uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
266 bool bVisible = false;
267 xProps->getPropertyValue( "IsVisible" ) >>= bVisible;
268 using namespace ::ooo::vba::excel::XlSheetVisibility;
269 return bVisible ? xlSheetVisible : (mbVeryHidden ? xlSheetVeryHidden : xlSheetHidden);
270}
271
272void
273ScVbaWorksheet::setVisible( sal_Int32 nVisible )
274{
275 using namespace ::ooo::vba::excel::XlSheetVisibility;
276 bool bVisible = true;
277 switch( nVisible )
278 {
279 case xlSheetVisible: case 1: // Excel accepts -1 and 1 for visible sheets
280 bVisible = true;
281 mbVeryHidden = false;
282 break;
283 case xlSheetHidden:
284 bVisible = false;
285 mbVeryHidden = false;
286 break;
287 case xlSheetVeryHidden:
288 bVisible = false;
289 mbVeryHidden = true;
290 break;
291 default:
292 throw uno::RuntimeException();
293 }
294 uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
295 xProps->setPropertyValue( "IsVisible", uno::Any( bVisible ) );
296}
297
298sal_Int16
300{
301 return getSheetID() + 1;
302}
303
304sal_Int32
306{
307 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
308 SCTAB nTab = 0;
309 if ( !ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
310 throw uno::RuntimeException("Sheet Name does not exist." );
311
312 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
314 const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
315 bool bLockedCells = false;
316 bool bUnlockedCells = false;
317 if( pProtect )
318 {
321 }
322 if( bLockedCells )
323 return excel::XlEnableSelection::xlNoRestrictions;
324 if( bUnlockedCells )
325 return excel::XlEnableSelection::xlUnlockedCells;
326 return excel::XlEnableSelection::xlNoSelection;
327
328}
329
330void
332{
333 if( (nSelection != excel::XlEnableSelection::xlNoRestrictions) &&
334 (nSelection != excel::XlEnableSelection::xlUnlockedCells) &&
335 (nSelection != excel::XlEnableSelection::xlNoSelection) )
336 {
337 DebugHelper::runtimeexception(ERRCODE_BASIC_BAD_PARAMETER);
338 }
339
340 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
341 SCTAB nTab = 0;
342 if ( !ScVbaWorksheets::nameExists(xSpreadDoc, getName(), nTab) )
343 throw uno::RuntimeException("Sheet Name does not exist." );
344
345 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
347 const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
348 // default is xlNoSelection
349 bool bLockedCells = false;
350 bool bUnlockedCells = false;
351 if( nSelection == excel::XlEnableSelection::xlNoRestrictions )
352 {
353 bLockedCells = true;
354 bUnlockedCells = true;
355 }
356 else if( nSelection == excel::XlEnableSelection::xlUnlockedCells )
357 {
358 bUnlockedCells = true;
359 }
360 if( pProtect )
361 {
362 ScTableProtection aNewProtect(*pProtect);
363 aNewProtect.setOption(ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells);
364 aNewProtect.setOption(ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells);
365 rDoc.SetTabProtection(nTab, &aNewProtect);
366 }
367
368
369}
370
372{
373 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
375 ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
376 if (pDBData)
377 return pDBData->HasAutoFilter();
378 return false;
379}
380
381void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode )
382{
383 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
384 ScDocShell* pDocShell = excel::getDocShell( xModel );
385 ScDocument& rDoc = pDocShell->GetDocument();
386 ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
387 if (!pDBData)
388 return;
389
390 pDBData->SetAutoFilter(bAutoFilterMode);
391 ScRange aRange;
392 pDBData->GetArea(aRange);
393 if (bAutoFilterMode)
394 rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
395 aRange.aEnd.Col(), aRange.aStart.Row(),
396 aRange.aStart.Tab(), ScMF::Auto );
397 else if (!bAutoFilterMode)
398 rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
399 aRange.aEnd.Col(), aRange.aStart.Row(),
400 aRange.aStart.Tab(), ScMF::Auto );
401 ScRange aPaintRange(aRange.aStart, aRange.aEnd);
402 aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
403 pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
404}
405
406uno::Reference< excel::XRange >
408{
409 uno::Reference< sheet::XSheetCellRange > xSheetCellRange(getSheet(), uno::UNO_QUERY_THROW );
410 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor( getSheet()->createCursorByRange( xSheetCellRange ), uno::UNO_SET_THROW );
411 uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
412 xUsedCursor->gotoStartOfUsedArea( false );
413 xUsedCursor->gotoEndOfUsedArea( true );
414 return new ScVbaRange(this, mxContext, xSheetCellCursor);
415}
416
417uno::Reference< excel::XOutline >
419{
420 uno::Reference<sheet::XSheetOutline> xOutline(getSheet(),uno::UNO_QUERY_THROW);
421 return new ScVbaOutline( this, mxContext, xOutline);
422}
423
424uno::Reference< excel::XPageSetup >
426{
427 return new ScVbaPageSetup( this, mxContext, getSheet(), getModel() );
428}
429
432{
433 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(getSheet(),uno::UNO_QUERY_THROW);
434 uno::Reference< excel::XHPageBreaks > xHPageBreaks( new ScVbaHPageBreaks( this, mxContext, xSheetPageBreak));
435 if ( aIndex.hasValue() )
436 return xHPageBreaks->Item( aIndex, uno::Any());
437 return uno::Any( xHPageBreaks );
438}
439
442{
443 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak( getSheet(), uno::UNO_QUERY_THROW );
444 uno::Reference< excel::XVPageBreaks > xVPageBreaks( new ScVbaVPageBreaks( this, mxContext, xSheetPageBreak ) );
445 if( aIndex.hasValue() )
446 return xVPageBreaks->Item( aIndex, uno::Any());
447 return uno::Any( xVPageBreaks );
448}
449
450sal_Int32
452{
453 return STANDARDWIDTH ;
454}
455
456sal_Int32
458{
459 return STANDARDHEIGHT;
460}
461
464{
465 return false;
466}
467
470{
471 uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
472 return xProtectable->isProtected();
473}
474
477{
478 SCTAB nTab = 0;
479 OUString aSheetName = getName();
480 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
481 bool bSheetExists = ScVbaWorksheets::nameExists (xSpreadDoc, aSheetName, nTab);
482 if ( bSheetExists )
483 {
484 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
486 const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
487 if ( pProtect )
489 }
490 return false;
491}
492
495{
496 return false;
497}
498
499void
501{
502 uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
503 getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
504 xSpreadsheet->setActiveSheet(getSheet());
505}
506
507void
509{
510 Activate();
511}
512
513void
514ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After )
515{
516 uno::Reference<excel::XWorksheet> xSheet;
517 OUString aCurrSheetName = getName();
518
519 if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
520 {
521 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
522 uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
523 // #FIXME needs worksheet as parent
524 uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xSheetCellCursor);
525 if (xRange.is())
526 xRange->Select();
528 uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
529 if (xModel.is())
530 {
532 Delete();
533 }
534 return ;
535 }
536
537 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
538 SCTAB nDest = 0;
539 if ( ScVbaWorksheets::nameExists (xSpreadDoc, xSheet->getName(), nDest) )
540 {
541 bool bAfter = After.hasValue();
542 if (bAfter)
543 nDest++;
544 uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
545 xSheets->moveByName(aCurrSheetName,nDest);
546 }
547}
548
549void
550ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After )
551{
552 uno::Reference<excel::XWorksheet> xSheet;
553 if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
554 {
556 return;
557 }
558
559 uno::Reference<excel::XWorksheet> xNewSheet = createSheetCopy(xSheet, After.hasValue());
560 xNewSheet->Activate();
561}
562
563void
565{
566 // #TODO# #FIXME# Link is not used
567 uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
568 if ( xRange.is() )
569 xRange->Select();
571}
572
573void
575{
576 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
577 OUString aSheetName = getName();
578 SCTAB nTab = 0;
579 if (!ScVbaWorksheets::nameExists(xSpreadDoc, aSheetName, nTab ))
580 {
581 return;
582 }
583 uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
584 uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
585 xNameContainer->removeByName(aSheetName);
586 mxSheet.clear();
587}
588
589uno::Reference< excel::XWorksheet >
591{
592 uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
593 uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_SET_THROW );
594 uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW );
595
596 SCTAB nIdx = 0;
597 if ( !ScVbaWorksheets::nameExists (xSpreadDoc, getName(), nIdx ) )
598 return uno::Reference< excel::XWorksheet >();
599 nIdx = nIdx + offset;
600 uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(nIdx), uno::UNO_QUERY_THROW);
601 // parent will be the parent of 'this' worksheet
602 return new ScVbaWorksheet (getParent(), mxContext, xSheet, getModel());
603}
604
605uno::Reference< excel::XWorksheet >
607{
608 return getSheetAtOffset(static_cast<SCTAB>(1));
609}
610
611uno::Reference< excel::XWorksheet >
613{
614 return getSheetAtOffset(-1);
615}
616
617void
618ScVbaWorksheet::Protect( const uno::Any& Password, const uno::Any& /*DrawingObjects*/, const uno::Any& /*Contents*/, const uno::Any& /*Scenarios*/, const uno::Any& /*UserInterfaceOnly*/ )
619{
620 // #TODO# #FIXME# is there anything we can do with the unused param
621 // can the implementation use anything else here
622 uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
623 OUString aPasswd;
624 Password >>= aPasswd;
625 xProtectable->protect( aPasswd );
626}
627
628void
630{
631 uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
632 OUString aPasswd;
633 Password >>= aPasswd;
634 xProtectable->unprotect( aPasswd );
635}
636
637void
639{
640 uno::Reference <sheet::XCalculatable> xReCalculate(getModel(), uno::UNO_QUERY_THROW);
641 xReCalculate->calculate();
642}
643
644uno::Reference< excel::XRange >
645ScVbaWorksheet::Range( const ::uno::Any& Cell1, const ::uno::Any& Cell2 )
646{
647 uno::Reference< excel::XRange > xSheetRange( new ScVbaRange( this, mxContext
648, uno::Reference< table::XCellRange >( getSheet(), uno::UNO_QUERY_THROW ) ) );
649 return xSheetRange->Range( Cell1, Cell2 );
650}
651
652void
653ScVbaWorksheet::CheckSpelling( const uno::Any& /*CustomDictionary*/,const uno::Any& /*IgnoreUppercase*/,const uno::Any& /*AlwaysSuggest*/, const uno::Any& /*SpellingLang*/ )
654{
655 // #TODO# #FIXME# unused params above, can we do anything with those
656 uno::Reference< frame::XModel > xModel( getModel() );
657 dispatchRequests(xModel,".uno:SpellDialog");
658}
659
660uno::Reference< excel::XRange >
662{
663 uno::Reference< table::XCellRange > xRange( getSheet(),uno::UNO_QUERY_THROW );
664 return uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRange ) );
665}
666
667// These are hacks - we prolly (somehow) need to inherit
668// the vbarange functionality here ...
669uno::Reference< excel::XRange >
670ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol )
671{
672 // Performance optimization for often-called Cells method:
673 // Use a common helper method instead of creating a new ScVbaRange object
674 uno::Reference< table::XCellRange > xRange( getSheet(), uno::UNO_QUERY_THROW );
675 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
677 return ScVbaRange::CellsHelper( rDoc, this, mxContext, xRange, nRow, nCol );
678}
679
680uno::Reference< excel::XRange >
682{
683 return getSheetRange()->Rows( aIndex );
684}
685
686uno::Reference< excel::XRange >
688{
689 return getSheetRange()->Columns( aIndex );
690}
691
692uno::Any SAL_CALL
694{
695 if ( !mxCharts.is() )
696 {
697 uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
698 uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
699
700 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
701 mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
702 }
703 if ( Index.hasValue() )
704 {
705 uno::Reference< XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW );
706 return xColl->Item( Index, uno::Any() );
707 }
708 else
709 return uno::Any( mxCharts );
710
711}
712
713uno::Any SAL_CALL
715{
716 uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
717 uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
718 uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
719
720 uno::Reference< XCollection > xColl( new ScVbaPivotTables( this, mxContext, xIndexAccess ) );
721 if ( Index.hasValue() )
722 return xColl->Item( Index, uno::Any() );
723 return uno::Any( xColl );
724}
725
726uno::Any SAL_CALL
728{
729 uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
730 uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xSheet, uno::UNO_QUERY_THROW );
731 uno::Reference< sheet::XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), uno::UNO_SET_THROW );
732 uno::Reference< container::XIndexAccess > xIndexAccess( xAnnos, uno::UNO_QUERY_THROW );
733 uno::Reference< XCollection > xColl( new ScVbaComments( this, mxContext, mxModel, xIndexAccess ) );
734 if ( Index.hasValue() )
735 return xColl->Item( Index, uno::Any() );
736 return uno::Any( xColl );
737}
738
739uno::Any SAL_CALL
741{
742 /* The worksheet always returns the same Hyperlinks object.
743 See vbahyperlinks.hxx for more details. */
744 if( !mxHlinks.is() )
745 mxHlinks.set( new ScVbaHyperlinks( this, mxContext ) );
746 if( aIndex.hasValue() )
747 return uno::Reference< XCollection >( mxHlinks, uno::UNO_QUERY_THROW )->Item( aIndex, uno::Any() );
748 return uno::Any( mxHlinks );
749}
750
751uno::Any SAL_CALL
752ScVbaWorksheet::Names( const css::uno::Any& aIndex )
753{
754 css::uno::Reference<css::beans::XPropertySet> xProps(getSheet(), css::uno::UNO_QUERY_THROW);
755 uno::Reference< sheet::XNamedRanges > xNamedRanges( xProps->getPropertyValue("NamedRanges"), uno::UNO_QUERY_THROW );
756 uno::Reference< XCollection > xNames( new ScVbaNames( this, mxContext, xNamedRanges, mxModel ) );
757 if ( aIndex.hasValue() )
758 return xNames->Item( aIndex, uno::Any() );
759 return uno::Any( xNames );
760}
761
762uno::Any SAL_CALL
764{
765 uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
766 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
767 uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPageSupplier->getDrawPage(), uno::UNO_SET_THROW );
768 uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPage, uno::UNO_QUERY_THROW );
769
770 uno::Reference< excel::XOLEObjects >xOleObjects( new ScVbaOLEObjects( this, mxContext, xIndexAccess ) );
771 if( Index.hasValue() )
772 return xOleObjects->Item( Index, uno::Any() );
773 return uno::Any( xOleObjects );
774}
775
776uno::Any SAL_CALL
778{
779 uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
780 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
781 uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
782 uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW );
783
784 uno::Reference< msforms::XShapes> xVbaShapes( new ScVbaShapes( this, mxContext, xIndexAccess, getModel() ) );
785 if ( aIndex.hasValue() )
786 return xVbaShapes->Item( aIndex, uno::Any() );
787 return uno::Any( xVbaShapes );
788}
789
791ScVbaWorksheet::getButtons( const uno::Any &rIndex, bool bOptionButtons )
792{
793 ::rtl::Reference< ScVbaSheetObjectsBase > &rxButtons = bOptionButtons ? mxButtons[0] : mxButtons[1];
794
795 if( !rxButtons.is() )
796 rxButtons.set( new ScVbaButtons( this, mxContext, mxModel, mxSheet, bOptionButtons ) );
797 else
798 rxButtons->collectShapes();
799 if( rIndex.hasValue() )
800 return rxButtons->Item( rIndex, uno::Any() );
801 return uno::Any( uno::Reference< XCollection >( rxButtons ) );
802}
803
804uno::Any SAL_CALL
806{
807 return getButtons( rIndex, false );
808}
809
810uno::Any SAL_CALL
812{
813 throw uno::RuntimeException();
814}
815
816uno::Any SAL_CALL
818{
819 throw uno::RuntimeException();
820}
821
822uno::Any SAL_CALL
824{
825 throw uno::RuntimeException();
826}
827
828uno::Any SAL_CALL
830{
831 throw uno::RuntimeException();
832}
833
834uno::Any SAL_CALL
836{
837 throw uno::RuntimeException();
838}
839
840uno::Any SAL_CALL
842{
843 return getButtons( rIndex, true );
844}
845
846uno::Any SAL_CALL
848{
849 throw uno::RuntimeException();
850}
851
852uno::Any SAL_CALL
854{
855 throw uno::RuntimeException();
856}
857
858void SAL_CALL
860{
861 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
863
865
867 pTabViewShell));
868
869 pDlg->Execute();
870}
871
872uno::Any SAL_CALL
873ScVbaWorksheet::Evaluate( const OUString& Name )
874{
875 // #TODO Evaluate allows other things to be evaluated, e.g. functions
876 // I think ( like SIN(3) etc. ) need to investigate that
877 // named Ranges also? e.g. [MyRange] if so need a list of named ranges
878 uno::Any aVoid;
879 return uno::Any( Range( uno::Any( Name ), aVoid ) );
880}
881
882uno::Reference< beans::XIntrospectionAccess > SAL_CALL
884{
885 return uno::Reference< beans::XIntrospectionAccess >();
886}
887
888uno::Any SAL_CALL
889ScVbaWorksheet::invoke( const OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ )
890{
891 throw uno::RuntimeException("Unsupported"); // unsupported operation
892}
893
894void SAL_CALL
895ScVbaWorksheet::setValue( const OUString& aPropertyName, const uno::Any& aValue )
896{
897 setDefaultPropByIntrospection( getValue( aPropertyName ), aValue );
898}
899uno::Any SAL_CALL
900ScVbaWorksheet::getValue( const OUString& aPropertyName )
901{
902 uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
903
904 uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
905 uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext("ooo.vba.ControlProvider", mxContext ), uno::UNO_QUERY_THROW );
906 uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) );
907 return uno::Any( xControl );
908}
909
910sal_Bool SAL_CALL
911ScVbaWorksheet::hasMethod( const OUString& /*aName*/ )
912{
913 return false;
914}
915
916uno::Reference< container::XNameAccess >
918{
919 uno::Reference< container::XNameAccess > xFormControls;
920 try
921 {
922 uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
923 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
924 uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
925 uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
926 // get the www-standard container ( maybe we should access the
927 // 'www-standard' by name rather than index, this seems an
928 // implementation detail
929 if( xIndexAccess->hasElements() )
930 xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
931
932 }
933 catch( uno::Exception& )
934 {
935 }
936 return xFormControls;
937
938 }
939sal_Bool SAL_CALL
940ScVbaWorksheet::hasProperty( const OUString& aName )
941{
942 uno::Reference< container::XNameAccess > xFormControls( getFormControls() );
943 if ( xFormControls.is() )
944 return xFormControls->hasByName( aName );
945 return false;
946}
947
949ScVbaWorksheet::getControlShape( std::u16string_view sName )
950{
951 // ideally we would get an XControl object but it appears an XControl
952 // implementation only exists for a Control implementation obtained from the
953 // view ( e.g. in basic you would get this from
954 // thiscomponent.currentcontroller.getControl( controlModel ) )
955 // and the thing to realise is that it is only possible to get an XControl
956 // for a currently displayed control :-( often we would want to modify
957 // a control not on the active sheet. But... you can always access the
958 // XControlShape from the DrawPage whether that is the active drawpage or not
959
960 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW );
961 uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
962
963 sal_Int32 nCount = xIndexAccess->getCount();
964 for( int index = 0; index < nCount; index++ )
965 {
966 uno::Any aUnoObj = xIndexAccess->getByIndex( index );
967 // It seems there are some drawing objects that can not query into Control shapes?
968 uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY );
969 if( xControlShape.is() )
970 {
971 uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW );
972 if( sName == xNamed->getName() )
973 {
974 return aUnoObj;
975 }
976 }
977 }
978 return uno::Any();
979}
980
981OUString
983{
984 return "ScVbaWorksheet";
985}
986
987void SAL_CALL
989{
990 uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
991 xCalculatable->enableAutomaticCalculation( bEnableCalculation);
992}
993sal_Bool SAL_CALL
995{
996 uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
997 return xCalculatable->isAutomaticCalculationEnabled();
998}
999
1000uno::Sequence< OUString >
1002{
1003 static uno::Sequence< OUString > const aServiceNames
1004 {
1005 "ooo.vba.excel.Worksheet"
1006 };
1007 return aServiceNames;
1008}
1009
1010OUString SAL_CALL
1012{
1013 uno::Reference< beans::XPropertySet > xSheetProp( mxSheet, uno::UNO_QUERY_THROW );
1014 return xSheetProp->getPropertyValue("CodeName").get< OUString >();
1015}
1016
1017sal_Int16
1019{
1020 uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW ); // if ActiveSheet, mxSheet is null.
1021 return xAddressable->getRangeAddress().Sheet;
1022}
1023
1024void SAL_CALL
1025ScVbaWorksheet::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& )
1026{
1027 sal_Int32 nTo = 0;
1028 sal_Int32 nFrom = 0;
1029 bool bSelection = false;
1030 From >>= nFrom;
1031 To >>= nTo;
1032
1033 if ( !( nFrom || nTo ) )
1034 bSelection = true;
1035
1036 uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
1037 PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
1038}
1039
1040sal_Int64 SAL_CALL
1041ScVbaWorksheet::getSomething(const uno::Sequence<sal_Int8 > & rId)
1042{
1043 return comphelper::getSomethingImpl(rId, this);
1044}
1045
1046extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1048 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
1049{
1050 return cppu::acquire(new ScVbaWorksheet(args, context));
1051}
1052
1053/* 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:204
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
void SetAutoFilter(bool bSet)
Definition: dbdata.hxx:205
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
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:853
SC_DLLPUBLIC bool RemoveFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:5093
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1928
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:5082
const OUString & GetCodeName() const
Definition: document.hxx:608
SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection *pProtect)
Definition: documen3.cxx:1936
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
Definition: document.cxx:309
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:2215
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 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 aName
const char * sName
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
Reference< XComponentContext > getProcessComponentContext()
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)
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