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