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