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 "vbaworksheet.hxx"
21 #include "vbanames.hxx"
22 
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
25 #include <com/sun/star/container/XNamed.hpp>
26 #include <com/sun/star/util/XProtectable.hpp>
27 #include <com/sun/star/table/XCellRange.hpp>
28 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
29 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
30 #include <com/sun/star/sheet/XCalculatable.hpp>
31 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
32 #include <com/sun/star/sheet/XSheetCellRange.hpp>
33 #include <com/sun/star/sheet/XSheetCellCursor.hpp>
34 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
35 #include <com/sun/star/sheet/XUsedAreaCursor.hpp>
36 #include <com/sun/star/sheet/XSpreadsheets.hpp>
37 #include <com/sun/star/sheet/XSheetOutline.hpp>
38 #include <com/sun/star/sheet/XSheetPageBreak.hpp>
39 #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
40 #include <com/sun/star/sheet/XNamedRanges.hpp>
41 #include <com/sun/star/frame/Desktop.hpp>
42 #include <com/sun/star/table/XTableChartsSupplier.hpp>
43 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
44 #include <com/sun/star/drawing/XControlShape.hpp>
45 #include <com/sun/star/form/XFormsSupplier.hpp>
46 #include <ooo/vba/excel/XApplication.hpp>
47 #include <ooo/vba/excel/XlEnableSelection.hpp>
48 #include <ooo/vba/excel/XlSheetVisibility.hpp>
49 #include <ooo/vba/XControlProvider.hpp>
50 
51 #include <basic/sberrors.hxx>
54 #include <vbahelper/vbashapes.hxx>
55 
56 //zhangyun showdataform
57 #include <scabstdlg.hxx>
58 #include <tabvwsh.hxx>
59 
60 #include <tabprotection.hxx>
61 #include "excelvbahelper.hxx"
62 #include "vbaoutline.hxx"
63 #include "vbarange.hxx"
64 #include "vbacomments.hxx"
65 #include "vbachartobjects.hxx"
66 #include "vbapivottables.hxx"
67 #include "vbaoleobjects.hxx"
68 #include "vbapagesetup.hxx"
69 #include "vbapagebreaks.hxx"
70 #include "vbaworksheets.hxx"
71 #include "vbahyperlinks.hxx"
72 #include "vbasheetobjects.hxx"
73 #include <dbdata.hxx>
74 
75 #include <attrib.hxx>
76 
77 #define STANDARDWIDTH 2267
78 #define STANDARDHEIGHT 427
79 
80 using namespace com::sun::star;
81 using namespace ooo::vba;
82 
83 static void getNewSpreadsheetName (OUString &aNewName, const OUString& aOldName, const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc )
84 {
85  if (!xSpreadDoc.is())
86  throw lang::IllegalArgumentException( "getNewSpreadsheetName() xSpreadDoc is null", uno::Reference< uno::XInterface >(), 1 );
87  static const char aUnderScore[] = "_";
88  int currentNum =2;
89  aNewName = aOldName + aUnderScore + OUString::number(currentNum) ;
90  SCTAB nTab = 0;
91  while ( ScVbaWorksheets::nameExists(xSpreadDoc,aNewName, nTab ) )
92  {
93  aNewName = aOldName + aUnderScore + OUString::number(++currentNum);
94  }
95 }
96 
97 static void removeAllSheets( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const OUString& aSheetName)
98 {
99  if (!xSpreadDoc.is())
100  throw lang::IllegalArgumentException( "removeAllSheets() xSpreadDoc is null", uno::Reference< uno::XInterface >(), 1 );
101  uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
102  uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
103 
104  if ( xIndex.is() )
105  {
106  uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
107  for (sal_Int32 i = xIndex->getCount() -1; i>= 1; i--)
108  {
109  uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(i), uno::UNO_QUERY);
110  uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
111  xNameContainer->removeByName(xNamed->getName());
112  }
113 
114  uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY);
115  uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
116  xNamed->setName(aSheetName);
117  }
118 }
119 
120 static uno::Reference<frame::XModel>
121 openNewDoc(const OUString& aSheetName )
122 {
123  uno::Reference<frame::XModel> xModel;
124  try
125  {
126  uno::Reference< uno::XComponentContext > xContext(
128 
129  uno::Reference <frame::XDesktop2 > xComponentLoader = frame::Desktop::create(xContext);
130 
131  uno::Reference<lang::XComponent > xComponent( xComponentLoader->loadComponentFromURL(
132  "private:factory/scalc",
133  "_blank", 0,
134  uno::Sequence < css::beans::PropertyValue >() ) );
135  uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
136  removeAllSheets(xSpreadDoc,aSheetName);
137  xModel.set(xSpreadDoc,uno::UNO_QUERY_THROW);
138  }
139  catch ( uno::Exception & /*e*/ )
140  {
141  }
142  return xModel;
143 }
144 
145 ScVbaWorksheet::ScVbaWorksheet(const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
146  const uno::Reference< sheet::XSpreadsheet >& xSheet,
147  const uno::Reference< frame::XModel >& xModel ) : WorksheetImpl_BASE( xParent, xContext ), mxSheet( xSheet ), mxModel(xModel), mbVeryHidden( false )
148 {
149 }
150 
151 ScVbaWorksheet::ScVbaWorksheet( uno::Sequence< uno::Any> const & args,
152  uno::Reference< uno::XComponentContext> const & xContext ) : WorksheetImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) ), mbVeryHidden( false )
153 {
154  if ( args.getLength() < 3 )
155  throw lang::IllegalArgumentException();
156 
157  OUString sSheetName;
158  args[2] >>= sSheetName;
159 
160  uno::Reference< sheet::XSpreadsheetDocument > xSpreadDoc( mxModel, uno::UNO_QUERY_THROW );
161  uno::Reference< container::XNameAccess > xNameAccess( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
162  mxSheet.set( xNameAccess->getByName( sSheetName ), uno::UNO_QUERY_THROW );
163 }
164 
166 {
167 }
168 
169 namespace
170 {
171  class theScVbaWorksheetUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScVbaWorksheetUnoTunnelId > {};
172 }
173 
174 const uno::Sequence<sal_Int8>& ScVbaWorksheet::getUnoTunnelId()
175 {
176  return theScVbaWorksheetUnoTunnelId::get().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  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  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  pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS, bLockedCells );
362  pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, bUnlockedCells );
363  }
364 
365 
366 }
367 
369 {
370  uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
371  ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
372  ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
373  if (pDBData)
374  return pDBData->HasAutoFilter();
375  return false;
376 }
377 
378 void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode )
379 {
380  uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
381  ScDocShell* pDocShell = excel::getDocShell( xModel );
382  ScDocument& rDoc = pDocShell->GetDocument();
383  ScDBData* pDBData = rDoc.GetAnonymousDBData(getSheetID());
384  if (pDBData)
385  {
386  pDBData->SetAutoFilter(bAutoFilterMode);
387  ScRange aRange;
388  pDBData->GetArea(aRange);
389  if (bAutoFilterMode)
390  rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
391  aRange.aEnd.Col(), aRange.aStart.Row(),
392  aRange.aStart.Tab(), ScMF::Auto );
393  else if (!bAutoFilterMode)
394  rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(),
395  aRange.aEnd.Col(), aRange.aStart.Row(),
396  aRange.aStart.Tab(), ScMF::Auto );
397  ScRange aPaintRange(aRange.aStart, aRange.aEnd);
398  aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
399  pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
400  }
401 }
402 
403 uno::Reference< excel::XRange >
405 {
406  uno::Reference< sheet::XSheetCellRange > xSheetCellRange(getSheet(), uno::UNO_QUERY_THROW );
407  uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor( getSheet()->createCursorByRange( xSheetCellRange ), uno::UNO_SET_THROW );
408  uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
409  xUsedCursor->gotoStartOfUsedArea( false );
410  xUsedCursor->gotoEndOfUsedArea( true );
411  return new ScVbaRange(this, mxContext, xSheetCellCursor);
412 }
413 
414 uno::Reference< excel::XOutline >
416 {
417  uno::Reference<sheet::XSheetOutline> xOutline(getSheet(),uno::UNO_QUERY_THROW);
418  return new ScVbaOutline( this, mxContext, xOutline);
419 }
420 
421 uno::Reference< excel::XPageSetup >
423 {
424  return new ScVbaPageSetup( this, mxContext, getSheet(), getModel() );
425 }
426 
427 uno::Any
429 {
430  uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(getSheet(),uno::UNO_QUERY_THROW);
431  uno::Reference< excel::XHPageBreaks > xHPageBreaks( new ScVbaHPageBreaks( this, mxContext, xSheetPageBreak));
432  if ( aIndex.hasValue() )
433  return xHPageBreaks->Item( aIndex, uno::Any());
434  return uno::makeAny( xHPageBreaks );
435 }
436 
437 uno::Any
439 {
440  uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak( getSheet(), uno::UNO_QUERY_THROW );
441  uno::Reference< excel::XVPageBreaks > xVPageBreaks( new ScVbaVPageBreaks( this, mxContext, xSheetPageBreak ) );
442  if( aIndex.hasValue() )
443  return xVPageBreaks->Item( aIndex, uno::Any());
444  return uno::makeAny( xVPageBreaks );
445 }
446 
447 sal_Int32
449 {
450  return STANDARDWIDTH ;
451 }
452 
453 sal_Int32
455 {
456  return STANDARDHEIGHT;
457 }
458 
459 sal_Bool
461 {
462  return false;
463 }
464 
465 sal_Bool
467 {
468  uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
469  return xProtectable->isProtected();
470 }
471 
472 sal_Bool
474 {
475  SCTAB nTab = 0;
476  OUString aSheetName = getName();
477  uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
478  bool bSheetExists = ScVbaWorksheets::nameExists (xSpreadDoc, aSheetName, nTab);
479  if ( bSheetExists )
480  {
481  uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
482  ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
483  ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
484  if ( pProtect )
485  return pProtect->isOptionEnabled( ScTableProtection::OBJECTS );
486  }
487  return false;
488 }
489 
490 sal_Bool
492 {
493  return false;
494 }
495 
496 void
498 {
499  uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
500  getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
501  xSpreadsheet->setActiveSheet(getSheet());
502 }
503 
504 void
506 {
507  Activate();
508 }
509 
510 void
511 ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After )
512 {
513  uno::Reference<excel::XWorksheet> xSheet;
514  OUString aCurrSheetName = getName();
515 
516  if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
517  {
518  uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( );
519  uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW);
520  // #FIXME needs worksheet as parent
521  uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xSheetCellCursor);
522  if (xRange.is())
523  xRange->Select();
525  uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
526  if (xModel.is())
527  {
528  excel::implnPaste(xModel);
529  Delete();
530  }
531  return ;
532  }
533 
534  uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
535  SCTAB nDest = 0;
536  if ( ScVbaWorksheets::nameExists (xSpreadDoc, xSheet->getName(), nDest) )
537  {
538  bool bAfter = After.hasValue();
539  if (bAfter)
540  nDest++;
541  uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
542  xSheets->moveByName(aCurrSheetName,nDest);
543  }
544 }
545 
546 void
547 ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After )
548 {
549  uno::Reference<excel::XWorksheet> xSheet;
550  if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()))
551  {
553  return;
554  }
555 
556  uno::Reference<excel::XWorksheet> xNewSheet = createSheetCopy(xSheet, After.hasValue());
557  xNewSheet->Activate();
558 }
559 
560 void
562 {
563  // #TODO# #FIXME# Link is not used
564  uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
565  if ( xRange.is() )
566  xRange->Select();
568 }
569 
570 void
572 {
573  uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
574  OUString aSheetName = getName();
575  SCTAB nTab = 0;
576  if (!ScVbaWorksheets::nameExists(xSpreadDoc, aSheetName, nTab ))
577  {
578  return;
579  }
580  uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
581  uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW);
582  xNameContainer->removeByName(aSheetName);
583  mxSheet.clear();
584 }
585 
586 uno::Reference< excel::XWorksheet >
588 {
589  uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
590  uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_SET_THROW );
591  uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW );
592 
593  SCTAB nIdx = 0;
594  if ( !ScVbaWorksheets::nameExists (xSpreadDoc, getName(), nIdx ) )
595  return uno::Reference< excel::XWorksheet >();
596  nIdx = nIdx + offset;
597  uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(nIdx), uno::UNO_QUERY_THROW);
598  // parent will be the parent of 'this' worksheet
599  return new ScVbaWorksheet (getParent(), mxContext, xSheet, getModel());
600 }
601 
602 uno::Reference< excel::XWorksheet >
604 {
605  return getSheetAtOffset(static_cast<SCTAB>(1));
606 }
607 
608 uno::Reference< excel::XWorksheet >
610 {
611  return getSheetAtOffset(-1);
612 }
613 
614 void
615 ScVbaWorksheet::Protect( const uno::Any& Password, const uno::Any& /*DrawingObjects*/, const uno::Any& /*Contents*/, const uno::Any& /*Scenarios*/, const uno::Any& /*UserInterfaceOnly*/ )
616 {
617  // #TODO# #FIXME# is there anything we can do with the unused param
618  // can the implementation use anything else here
619  uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
620  OUString aPasswd;
621  Password >>= aPasswd;
622  xProtectable->protect( aPasswd );
623 }
624 
625 void
627 {
628  uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW);
629  OUString aPasswd;
630  Password >>= aPasswd;
631  xProtectable->unprotect( aPasswd );
632 }
633 
634 void
636 {
637  uno::Reference <sheet::XCalculatable> xReCalculate(getModel(), uno::UNO_QUERY_THROW);
638  xReCalculate->calculate();
639 }
640 
641 uno::Reference< excel::XRange >
642 ScVbaWorksheet::Range( const ::uno::Any& Cell1, const ::uno::Any& Cell2 )
643 {
644  uno::Reference< excel::XRange > xSheetRange( new ScVbaRange( this, mxContext
645 , uno::Reference< table::XCellRange >( getSheet(), uno::UNO_QUERY_THROW ) ) );
646  return xSheetRange->Range( Cell1, Cell2 );
647 }
648 
649 void
650 ScVbaWorksheet::CheckSpelling( const uno::Any& /*CustomDictionary*/,const uno::Any& /*IgnoreUppercase*/,const uno::Any& /*AlwaysSuggest*/, const uno::Any& /*SpellingLang*/ )
651 {
652  // #TODO# #FIXME# unused params above, can we do anything with those
653  uno::Reference< frame::XModel > xModel( getModel() );
654  dispatchRequests(xModel,".uno:SpellDialog");
655 }
656 
657 uno::Reference< excel::XRange >
659 {
660  uno::Reference< table::XCellRange > xRange( getSheet(),uno::UNO_QUERY_THROW );
661  return uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRange ) );
662 }
663 
664 // These are hacks - we prolly (somehow) need to inherit
665 // the vbarange functionality here ...
666 uno::Reference< excel::XRange >
667 ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol )
668 {
669  // Performance optimization for often-called Cells method:
670  // Use a common helper method instead of creating a new ScVbaRange object
671  uno::Reference< table::XCellRange > xRange( getSheet(), uno::UNO_QUERY_THROW );
672  uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
673  ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
674  return ScVbaRange::CellsHelper( &rDoc, this, mxContext, xRange, nRow, nCol );
675 }
676 
677 uno::Reference< excel::XRange >
679 {
680  return getSheetRange()->Rows( aIndex );
681 }
682 
683 uno::Reference< excel::XRange >
685 {
686  return getSheetRange()->Columns( aIndex );
687 }
688 
689 uno::Any SAL_CALL
691 {
692  if ( !mxCharts.is() )
693  {
694  uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
695  uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
696 
697  uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
698  mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
699  }
700  if ( Index.hasValue() )
701  {
702  uno::Reference< XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW );
703  return xColl->Item( Index, uno::Any() );
704  }
705  else
706  return uno::makeAny( mxCharts );
707 
708 }
709 
710 uno::Any SAL_CALL
712 {
713  uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
714  uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
715  uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
716 
717  uno::Reference< XCollection > xColl( new ScVbaPivotTables( this, mxContext, xIndexAccess ) );
718  if ( Index.hasValue() )
719  return xColl->Item( Index, uno::Any() );
720  return uno::makeAny( xColl );
721 }
722 
723 uno::Any SAL_CALL
725 {
726  uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet();
727  uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xSheet, uno::UNO_QUERY_THROW );
728  uno::Reference< sheet::XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), uno::UNO_SET_THROW );
729  uno::Reference< container::XIndexAccess > xIndexAccess( xAnnos, uno::UNO_QUERY_THROW );
730  uno::Reference< XCollection > xColl( new ScVbaComments( this, mxContext, mxModel, xIndexAccess ) );
731  if ( Index.hasValue() )
732  return xColl->Item( Index, uno::Any() );
733  return uno::makeAny( xColl );
734 }
735 
736 uno::Any SAL_CALL
738 {
739  /* The worksheet always returns the same Hyperlinks object.
740  See vbahyperlinks.hxx for more details. */
741  if( !mxHlinks.is() )
742  mxHlinks.set( new ScVbaHyperlinks( this, mxContext ) );
743  if( aIndex.hasValue() )
744  return uno::Reference< XCollection >( mxHlinks, uno::UNO_QUERY_THROW )->Item( aIndex, uno::Any() );
745  return uno::Any( mxHlinks );
746 }
747 
748 uno::Any SAL_CALL
749 ScVbaWorksheet::Names( const css::uno::Any& aIndex )
750 {
751  // fake sheet-local names by returning all global names
752  // #163498# initialize Names object with correct parent (this worksheet)
753  // TODO: real sheet-local names...
754  uno::Reference< beans::XPropertySet > xProps( mxModel, uno::UNO_QUERY_THROW );
755  uno::Reference< sheet::XNamedRanges > xNamedRanges( xProps->getPropertyValue("NamedRanges"), uno::UNO_QUERY_THROW );
756  uno::Reference< XCollection > xNames( new ScVbaNames( this, mxContext, xNamedRanges, mxModel ) );
757  if ( aIndex.hasValue() )
758  return xNames->Item( aIndex, uno::Any() );
759  return uno::Any( xNames );
760 }
761 
762 uno::Any SAL_CALL
764 {
765  uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
766  uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
767  uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPageSupplier->getDrawPage(), uno::UNO_SET_THROW );
768  uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPage, uno::UNO_QUERY_THROW );
769 
770  uno::Reference< excel::XOLEObjects >xOleObjects( new ScVbaOLEObjects( this, mxContext, xIndexAccess ) );
771  if( Index.hasValue() )
772  return xOleObjects->Item( Index, uno::Any() );
773  return uno::Any( xOleObjects );
774 }
775 
776 uno::Any SAL_CALL
778 {
779  uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
780  uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
781  uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
782  uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY_THROW );
783 
784  uno::Reference< msforms::XShapes> xVbaShapes( new ScVbaShapes( this, mxContext, xIndexAccess, getModel() ) );
785  if ( aIndex.hasValue() )
786  return xVbaShapes->Item( aIndex, uno::Any() );
787  return uno::makeAny( xVbaShapes );
788 }
789 
790 uno::Any
791 ScVbaWorksheet::getButtons( const uno::Any &rIndex, bool bOptionButtons )
792 {
793  ::rtl::Reference< ScVbaSheetObjectsBase > &rxButtons = bOptionButtons ? mxButtons[0] : mxButtons[1];
794 
795  if( !rxButtons.is() )
796  rxButtons.set( new ScVbaButtons( this, mxContext, mxModel, mxSheet, bOptionButtons ) );
797  else
798  rxButtons->collectShapes();
799  if( rIndex.hasValue() )
800  return rxButtons->Item( rIndex, uno::Any() );
801  return uno::Any( uno::Reference< XCollection >( rxButtons.get() ) );
802 }
803 
804 uno::Any SAL_CALL
806 {
807  return getButtons( rIndex, false );
808 }
809 
810 uno::Any SAL_CALL
812 {
813  throw uno::RuntimeException();
814 }
815 
816 uno::Any SAL_CALL
818 {
819  throw uno::RuntimeException();
820 }
821 
822 uno::Any SAL_CALL
824 {
825  throw uno::RuntimeException();
826 }
827 
828 uno::Any SAL_CALL
829 ScVbaWorksheet::Labels( const uno::Any& /*rIndex*/ )
830 {
831  throw uno::RuntimeException();
832 }
833 
834 uno::Any SAL_CALL
836 {
837  throw uno::RuntimeException();
838 }
839 
840 uno::Any SAL_CALL
842 {
843  return getButtons( rIndex, true );
844 }
845 
846 uno::Any SAL_CALL
848 {
849  throw uno::RuntimeException();
850 }
851 
852 uno::Any SAL_CALL
853 ScVbaWorksheet::Spinners( const uno::Any& /*rIndex*/ )
854 {
855  throw uno::RuntimeException();
856 }
857 
858 void SAL_CALL
860 {
861  uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
862  ScTabViewShell* pTabViewShell = excel::getBestViewShell( xModel );
863 
865 
867  pTabViewShell));
868 
869  pDlg->Execute();
870 }
871 
872 uno::Any SAL_CALL
873 ScVbaWorksheet::Evaluate( const OUString& Name )
874 {
875  // #TODO Evaluate allows other things to be evaluated, e.g. functions
876  // I think ( like SIN(3) etc. ) need to investigate that
877  // named Ranges also? e.g. [MyRange] if so need a list of named ranges
878  uno::Any aVoid;
879  return uno::Any( Range( uno::Any( Name ), aVoid ) );
880 }
881 
882 uno::Reference< beans::XIntrospectionAccess > SAL_CALL
884 {
885  return uno::Reference< beans::XIntrospectionAccess >();
886 }
887 
888 uno::Any SAL_CALL
889 ScVbaWorksheet::invoke( const OUString& /*aFunctionName*/, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ )
890 {
891  throw uno::RuntimeException("Unsupported"); // unsupported operation
892 }
893 
894 void SAL_CALL
895 ScVbaWorksheet::setValue( const OUString& aPropertyName, const uno::Any& aValue )
896 {
897  setDefaultPropByIntrospection( getValue( aPropertyName ), aValue );
898 }
899 uno::Any SAL_CALL
900 ScVbaWorksheet::getValue( const OUString& aPropertyName )
901 {
902  uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
903 
904  uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
905  uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext("ooo.vba.ControlProvider", mxContext ), uno::UNO_QUERY_THROW );
906  uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) );
907  return uno::makeAny( xControl );
908 }
909 
910 sal_Bool SAL_CALL
911 ScVbaWorksheet::hasMethod( const OUString& /*aName*/ )
912 {
913  return false;
914 }
915 
916 uno::Reference< container::XNameAccess >
918 {
919  uno::Reference< container::XNameAccess > xFormControls;
920  try
921  {
922  uno::Reference< sheet::XSpreadsheet > xSpreadsheet( getSheet(), uno::UNO_SET_THROW );
923  uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSpreadsheet, uno::UNO_QUERY_THROW );
924  uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
925  uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
926  // get the www-standard container ( maybe we should access the
927  // 'www-standard' by name rather than index, this seems an
928  // implementation detail
929  if( xIndexAccess->hasElements() )
930  xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
931 
932  }
933  catch( uno::Exception& )
934  {
935  }
936  return xFormControls;
937 
938  }
939 sal_Bool SAL_CALL
940 ScVbaWorksheet::hasProperty( const OUString& aName )
941 {
942  uno::Reference< container::XNameAccess > xFormControls( getFormControls() );
943  if ( xFormControls.is() )
944  return xFormControls->hasByName( aName );
945  return false;
946 }
947 
948 uno::Any
949 ScVbaWorksheet::getControlShape( const OUString& sName )
950 {
951  // ideally we would get an XControl object but it appears an XControl
952  // implementation only exists for a Control implementation obtained from the
953  // view ( e.g. in basic you would get this from
954  // thiscomponent.currentcontroller.getControl( controlModel ) )
955  // and the thing to realise is that it is only possible to get an XControl
956  // for a currently displayed control :-( often we would want to modify
957  // a control not on the active sheet. But... you can always access the
958  // XControlShape from the DrawPage whether that is the active drawpage or not
959 
960  uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW );
961  uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
962 
963  sal_Int32 nCount = xIndexAccess->getCount();
964  for( int index = 0; index < nCount; index++ )
965  {
966  uno::Any aUnoObj = xIndexAccess->getByIndex( index );
967  // It seems there are some drawing objects that can not query into Control shapes?
968  uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY );
969  if( xControlShape.is() )
970  {
971  uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW );
972  if( sName == xNamed->getName() )
973  {
974  return aUnoObj;
975  }
976  }
977  }
978  return uno::Any();
979 }
980 
981 OUString
983 {
984  return "ScVbaWorksheet";
985 }
986 
987 void SAL_CALL
989 {
990  uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
991  xCalculatable->enableAutomaticCalculation( bEnableCalculation);
992 }
993 sal_Bool SAL_CALL
995 {
996  uno::Reference <sheet::XCalculatable> xCalculatable(getModel(), uno::UNO_QUERY_THROW);
997  return xCalculatable->isAutomaticCalculationEnabled();
998 }
999 
1000 uno::Sequence< OUString >
1002 {
1003  static uno::Sequence< OUString > const aServiceNames
1004  {
1005  "ooo.vba.excel.Worksheet"
1006  };
1007  return aServiceNames;
1008 }
1009 
1010 OUString SAL_CALL
1012 {
1013  uno::Reference< beans::XPropertySet > xSheetProp( mxSheet, uno::UNO_QUERY_THROW );
1014  return xSheetProp->getPropertyValue("CodeName").get< OUString >();
1015 }
1016 
1017 sal_Int16
1019 {
1020  uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW ); // if ActiveSheet, mxSheet is null.
1021  return xAddressable->getRangeAddress().Sheet;
1022 }
1023 
1024 void SAL_CALL
1025 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& )
1026 {
1027  sal_Int32 nTo = 0;
1028  sal_Int32 nFrom = 0;
1029  bool bSelection = false;
1030  From >>= nFrom;
1031  To >>= nTo;
1032 
1033  if ( !( nFrom || nTo ) )
1034  bSelection = true;
1035 
1036  uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
1037  PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
1038 }
1039 
1040 sal_Int64 SAL_CALL
1041 ScVbaWorksheet::getSomething(const uno::Sequence<sal_Int8 > & rId)
1042 {
1043  if (isUnoTunnelId<ScVbaWorksheet>(rId))
1044  {
1045  return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
1046  }
1047  return 0;
1048 }
1049 
1050 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1052  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
1053 {
1054  return cppu::acquire(new ScVbaWorksheet(args, context));
1055 }
1056 
1057 /* 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:307
SCROW Row() const
Definition: address.hxx:262
virtual css::uno::Any SAL_CALL DropDowns(const css::uno::Any &rIndex) override
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:5015
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScVbaWorksheet_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
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:855
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
static bool nameExists(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &xSpreadDoc, const OUString &name, SCTAB &nTab)
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
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
virtual OUString getServiceImplName() override
tuple index
css::uno::Reference< css::frame::XModel > mxModel
uno::Reference< XHelperInterface > getUnoDocModule(const OUString &aModName, SfxObjectShell const *pShell)
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:99
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:301
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)
css::uno::Any getControlShape(const OUString &sName)
#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
static css::uno::Reference< ov::excel::XRange > CellsHelper(const ScDocument *pDoc, 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 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:38
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:5026
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
SC_DLLPUBLIC ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1880
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
static void getNewSpreadsheetName(OUString &aNewName, const OUString &aOldName, const uno::Reference< sheet::XSpreadsheetDocument > &xSpreadDoc)
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)
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
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