LibreOffice Module sc (master)  1
vbaworksheets.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 #include "vbaworksheets.hxx"
20 
21 #include <sfx2/viewfrm.hxx>
22 
23 #include <cppuhelper/implbase.hxx>
24 
25 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
26 #include <com/sun/star/container/XEnumerationAccess.hpp>
27 #include <com/sun/star/sheet/XSpreadsheet.hpp>
28 #include <com/sun/star/container/XNamed.hpp>
29 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30 #include <com/sun/star/script/XTypeConverter.hpp>
31 
32 #include <ooo/vba/excel/XApplication.hpp>
33 #include <tabvwsh.hxx>
34 
35 #include "excelvbahelper.hxx"
36 #include "vbaworksheet.hxx"
37 #include <markdata.hxx>
38 
39 #include <vector>
40 #include <prevwsh.hxx>
41 #include <preview.hxx>
42 using namespace ::ooo::vba;
43 using namespace ::com::sun::star;
44 
45 // a map ( or hashmap ) won't do as we need also to preserve the order
46 // (as added ) of the items
47 typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap;
48 
49 // #FIXME #TODO the implementation of the Sheets collections sucks,
50 // e.g. there is no support for tracking sheets added/removed from the collection
51 
52 namespace {
53 
54 class WorkSheetsEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration >
55 {
56  SheetMap mSheetMap;
57  SheetMap::iterator mIt;
58 public:
59  explicit WorkSheetsEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
60  virtual sal_Bool SAL_CALL hasMoreElements( ) override
61  {
62  return ( mIt != mSheetMap.end() );
63  }
64  virtual uno::Any SAL_CALL nextElement( ) override
65  {
66  if ( !hasMoreElements() )
67  throw container::NoSuchElementException();
68  uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
69  return uno::makeAny( xSheet ) ;
70  }
71 };
72 
73 class SheetCollectionHelper : public ::cppu::WeakImplHelper< container::XNameAccess,
74  container::XIndexAccess,
75  container::XEnumerationAccess >
76 {
77  SheetMap mSheetMap;
78  SheetMap::iterator cachePos;
79 public:
80  explicit SheetCollectionHelper( const SheetMap& sMap ) : mSheetMap( sMap ), cachePos(mSheetMap.begin()) {}
81  // XElementAccess
82  virtual uno::Type SAL_CALL getElementType( ) override { return cppu::UnoType<sheet::XSpreadsheet>::get(); }
83  virtual sal_Bool SAL_CALL hasElements( ) override { return ( !mSheetMap.empty() ); }
84  // XNameAccess
85  virtual uno::Any SAL_CALL getByName( const OUString& aName ) override
86  {
87  if ( !hasByName(aName) )
88  throw container::NoSuchElementException();
89  return uno::makeAny( *cachePos );
90  }
91  virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) override
92  {
93  uno::Sequence< OUString > sNames( mSheetMap.size() );
94  OUString* pString = sNames.getArray();
95 
96  for ( const auto& rItem : mSheetMap )
97  {
98  uno::Reference< container::XNamed > xName( rItem, uno::UNO_QUERY_THROW );
99  *pString = xName->getName();
100  ++pString;
101  }
102  return sNames;
103  }
104  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override
105  {
106  cachePos = mSheetMap.begin();
107  SheetMap::iterator it_end = mSheetMap.end();
108  for ( ; cachePos != it_end; ++cachePos )
109  {
110  uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
111  if ( aName == xName->getName() )
112  break;
113  }
114  return ( cachePos != it_end );
115  }
116 
117  // XElementAccess
118  virtual ::sal_Int32 SAL_CALL getCount( ) override { return mSheetMap.size(); }
119  virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override
120  {
121  if ( Index < 0 || Index >= getCount() )
122  throw lang::IndexOutOfBoundsException();
123 
124  return uno::makeAny( mSheetMap[ Index ] );
125 
126  }
127  // XEnumerationAccess
128  virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) override
129  {
130  return new WorkSheetsEnumeration( mSheetMap );
131  }
132 };
133 
134 class SheetsEnumeration : public EnumerationHelperImpl
135 {
136  uno::Reference< frame::XModel > m_xModel;
137 public:
139  SheetsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_xModel( xModel ) {}
140 
141  virtual uno::Any SAL_CALL nextElement( ) override
142  {
143  uno::Reference< sheet::XSpreadsheet > xSheet( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
144  uno::Reference< XHelperInterface > xIf = excel::getUnoSheetModuleObj( xSheet );
145  uno::Any aRet;
146  if ( !xIf.is() )
147  {
148  // if the Sheet is in a document created by the api unfortunately ( at the
149  // moment, it actually won't have the special Document modules
150  uno::Reference< excel::XWorksheet > xNewSheet( new ScVbaWorksheet( m_xParent, m_xContext, xSheet, m_xModel ) );
151  aRet <<= xNewSheet;
152  }
153  else
154  aRet <<= xIf;
155  return aRet;
156  }
157 
158 };
159 
160 }
161 
162 ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, xSheets ), mxModel( xModel ), m_xSheets( uno::Reference< sheet::XSpreadsheets >( xSheets, uno::UNO_QUERY ) )
163 {
164 }
165 
166 ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< container::XEnumerationAccess >& xEnumAccess, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xEnumAccess, uno::UNO_QUERY ) ), mxModel(xModel)
167 {
168 }
169 
170 // XEnumerationAccess
171 uno::Type
173 {
175 }
176 
177 uno::Reference< container::XEnumeration >
179 {
180  if ( !m_xSheets.is() )
181  {
182  uno::Reference< container::XEnumerationAccess > xAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
183  return xAccess->createEnumeration();
184  }
185  uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xSheets, uno::UNO_QUERY_THROW );
186  return new SheetsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
187 }
188 
189 uno::Any
191 {
192  uno::Reference< sheet::XSpreadsheet > xSheet( aSource, uno::UNO_QUERY );
193  uno::Reference< XHelperInterface > xIf = excel::getUnoSheetModuleObj( xSheet );
194  uno::Any aRet;
195  if ( !xIf.is() )
196  {
197  // if the Sheet is in a document created by the api unfortunately ( at the
198  // moment, it actually won't have the special Document modules
199  uno::Reference< excel::XWorksheet > xNewSheet( new ScVbaWorksheet( getParent(), mxContext, xSheet, mxModel ) );
200  aRet <<= xNewSheet;
201  }
202  else
203  aRet <<= xIf;
204  return aRet;
205 }
206 
207 // XWorksheets
208 uno::Any
209 ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After,
210  const uno::Any& Count, const uno::Any& Type )
211 {
212  if ( isSelectedSheets() )
213  return uno::Any(); // or should we throw?
214 
215  OUString aStringSheet;
216  bool bBefore(true);
217  SCTAB nSheetIndex = 0;
218  SCTAB nNewSheets = 1, nType = 0;
219  Count >>= nNewSheets;
220  Type >>= nType;
221  SCTAB nCount = 0;
222 
223  uno::Reference< excel::XWorksheet > xBeforeAfterSheet;
224 
225  if ( Before.hasValue() )
226  {
227  if ( Before >>= xBeforeAfterSheet )
228  aStringSheet = xBeforeAfterSheet->getName();
229  else
230  Before >>= aStringSheet;
231  }
232 
233  if (aStringSheet.isEmpty() && After.hasValue() )
234  {
235  if ( After >>= xBeforeAfterSheet )
236  aStringSheet = xBeforeAfterSheet->getName();
237  else
238  After >>= aStringSheet;
239  bBefore = false;
240  }
241  if (aStringSheet.isEmpty())
242  {
243  uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
244  aStringSheet = xApplication->getActiveWorkbook()->getActiveSheet()->getName();
245  bBefore = true;
246  }
247  nCount = static_cast< SCTAB >( m_xIndexAccess->getCount() );
248  for (SCTAB i=0; i < nCount; i++)
249  {
250  uno::Reference< sheet::XSpreadsheet > xSheet(m_xIndexAccess->getByIndex(i), uno::UNO_QUERY);
251  uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW );
252  if (xNamed->getName() == aStringSheet)
253  {
254  nSheetIndex = i;
255  break;
256  }
257  }
258 
259  if(!bBefore)
260  nSheetIndex++;
261 
262  SCTAB nSheetName = nCount + 1;
263  OUString aStringBase( "Sheet" );
265  for (SCTAB i=0; i < nNewSheets; i++, nSheetName++)
266  {
267  OUString aStringName = aStringBase + OUString::number(nSheetName);
268  while (m_xNameAccess->hasByName(aStringName))
269  {
270  nSheetName++;
271  aStringName = aStringBase + OUString::number(nSheetName);
272  }
273  m_xSheets->insertNewByName(aStringName, nSheetIndex + i);
274  result = getItemByStringIndex( aStringName );
275  }
276  uno::Reference< excel::XWorksheet > xNewSheet( result, uno::UNO_QUERY );
277  if ( xNewSheet.is() )
278  xNewSheet->Activate();
279  return result;
280 }
281 
282 void
284 {
285  // #TODO #INVESTIGATE
286  // mmm this method could be trouble if the underlying
287  // uno objects ( the m_xIndexAccess etc ) aren't aware of the
288  // contents that are deleted
289  sal_Int32 nElems = getCount();
290  for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem )
291  {
292  uno::Reference< excel::XWorksheet > xSheet( Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
293  xSheet->Delete();
294  }
295 }
296 
297 bool
299 {
300  return !m_xSheets.is();
301 }
302 
303 void SAL_CALL
304 ScVbaWorksheets::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 )
305 {
306  sal_Int32 nTo = 0;
307  sal_Int32 nFrom = 0;
308  bool bSelection = false;
309  From >>= nFrom;
310  To >>= nTo;
311 
312  if ( !( nFrom || nTo ) )
313  if ( isSelectedSheets() )
314  bSelection = true;
315 
316  PrintOutHelper( excel::getBestViewShell( mxModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
317 }
318 
319 uno::Any SAL_CALL
321 {
322  bool bVisible = true;
323  uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_SET_THROW );
324  while ( xEnum->hasMoreElements() )
325  {
326  uno::Reference< excel::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW );
327  if ( xSheet->getVisible() == 0 )
328  {
329  bVisible = false;
330  break;
331  }
332  }
333  return uno::makeAny( bVisible );
334 }
335 
336 void SAL_CALL
338 {
339  bool bState = false;
340  if ( !(_visible >>= bState) )
341  throw uno::RuntimeException("Visible property doesn't support non boolean #FIXME" );
342 
343  uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_SET_THROW );
344  while ( xEnum->hasMoreElements() )
345  {
346  uno::Reference< excel::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW );
347  xSheet->setVisible( bState ? 1 : 0 );
348  }
349 
350 }
351 
352 void SAL_CALL
354 {
356  if ( !pViewShell )
357  throw uno::RuntimeException("Cannot obtain view shell" );
358 
359  ScMarkData& rMarkData = pViewShell->GetViewData().GetMarkData();
360  bool bReplace = true;
361  Replace >>= bReplace;
362  // Replace is defaulted to True, meaning this current collection
363  // becomes the Selection, if it were false then the current selection would
364  // be extended
365  bool bSelectSingle = bReplace;
366  sal_Int32 nElems = getCount();
367  for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem )
368  {
369  uno::Reference< excel::XWorksheet > xSheet( Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
370  ScVbaWorksheet* pSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSheet );
371  if ( bSelectSingle )
372  {
373  rMarkData.SelectOneTable( static_cast< SCTAB >( pSheet->getSheetID() ) );
374  bSelectSingle = false;
375  }
376  else
377  rMarkData.SelectTable( static_cast< SCTAB >( pSheet->getSheetID() ), true );
378  }
379 
380 }
381 
382 void SAL_CALL
383 ScVbaWorksheets::Copy ( const uno::Any& Before, const uno::Any& After)
384 {
385  uno::Reference<excel::XWorksheet> xSheet;
386  sal_Int32 nElems = getCount();
387  bool bAfter = After.hasValue();
388  std::vector< uno::Reference< excel::XWorksheet > > Sheets;
389  sal_Int32 nItem = 0;
390 
391  for ( nItem = 1; nItem <= nElems; ++nItem)
392  {
393  uno::Reference<excel::XWorksheet> xWorksheet(Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
394  Sheets.push_back(xWorksheet);
395  }
396  bool bNewDoc = (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue()));
397 
398  uno::Reference< excel::XWorksheet > xSrcSheet;
399  if ( bNewDoc )
400  {
401  bAfter = true;
402  xSrcSheet = Sheets.at(0);
403  ScVbaWorksheet* pSrcSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSrcSheet );
404  xSheet = pSrcSheet->createSheetCopyInNewDoc(xSrcSheet->getName());
405  nItem = 1;
406  }
407  else
408  {
409  nItem=0;
410  }
411 
412  for (; nItem < nElems; ++nItem )
413  {
414  xSrcSheet = Sheets[nItem];
415  ScVbaWorksheet* pSrcSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSrcSheet );
416  if ( bAfter )
417  xSheet = pSrcSheet->createSheetCopy(xSheet, bAfter);
418  else
419  pSrcSheet->createSheetCopy(xSheet, bAfter);
420  }
421 }
422 
423 //ScVbaCollectionBaseImpl
424 uno::Any SAL_CALL
426 {
427  if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE )
428  {
429  const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter(mxContext);
430  uno::Any aConverted = xConverter->convertTo( Index, cppu::UnoType<uno::Sequence< uno::Any >>::get() );
431  SheetMap aSheets;
432  uno::Sequence< uno::Any > sIndices;
433  aConverted >>= sIndices;
434  for( const auto& rIndex : std::as_const(sIndices) )
435  {
436  uno::Reference< excel::XWorksheet > xWorkSheet( ScVbaWorksheets_BASE::Item( rIndex, Index2 ), uno::UNO_QUERY_THROW );
437  ScVbaWorksheet* pWorkSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xWorkSheet );
438  uno::Reference< sheet::XSpreadsheet > xSheet( pWorkSheet->getSheet() , uno::UNO_SET_THROW );
439  uno::Reference< container::XNamed > xName( xSheet, uno::UNO_QUERY_THROW );
440  aSheets.push_back( xSheet );
441  }
442  uno::Reference< container::XIndexAccess > xIndexAccess = new SheetCollectionHelper( aSheets );
443  uno::Reference< XCollection > xSelectedSheets( new ScVbaWorksheets( getParent(), mxContext, xIndexAccess, mxModel ) );
444  return uno::makeAny( xSelectedSheets );
445  }
446  return ScVbaWorksheets_BASE::Item( Index, Index2 );
447 }
448 
449 OUString
451 {
452  return "ScVbaWorksheets";
453 }
454 
455 css::uno::Sequence<OUString>
457 {
458  static uno::Sequence< OUString > const sNames
459  {
460  "ooo.vba.excel.Worksheets"
461  };
462  return sNames;
463 }
464 
465 bool ScVbaWorksheets::nameExists( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const OUString & name, SCTAB& nTab )
466 {
467  if (!xSpreadDoc.is())
468  throw lang::IllegalArgumentException( "nameExists() xSpreadDoc is null", uno::Reference< uno::XInterface >(), 1 );
469  uno::Reference <container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
470  if ( xIndex.is() )
471  {
472  SCTAB nCount = static_cast< SCTAB >( xIndex->getCount() );
473  for (SCTAB i=0; i < nCount; i++)
474  {
475  uno::Reference< container::XNamed > xNamed( xIndex->getByIndex(i), uno::UNO_QUERY_THROW );
476  if (xNamed->getName() == name)
477  {
478  nTab = i;
479  return true;
480  }
481  }
482  }
483  return false;
484 }
485 
486 void ScVbaWorksheets::PrintPreview( const css::uno::Any& /*EnableChanges*/ )
487 {
488  // need test, print preview current active sheet
489  // !! TODO !! get view shell from controller
491  SfxViewFrame* pViewFrame = nullptr;
492  if ( pViewShell )
493  pViewFrame = pViewShell->GetViewFrame();
494  if ( !pViewFrame )
495  return;
496 
497  if ( pViewFrame->GetFrame().IsInPlace() )
498  return;
499 
500  dispatchExecute( pViewShell, SID_VIEWSHELL1 );
501  SfxViewShell* pShell = SfxViewShell::Get( pViewFrame->GetFrame().GetFrameInterface()->getController() );
502 
503  ScPreviewShell* pPrvShell = dynamic_cast< ScPreviewShell* >( pShell );
504  if ( !pPrvShell )
505  return;
506 
507  ScPreview* pPrvView = pPrvShell->GetPreview();
508  const ScDocument& rDoc = pViewShell->GetViewData().GetDocument();
509  ScMarkData aMarkData(rDoc.GetSheetLimits());
510  sal_Int32 nElems = getCount();
511  for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem )
512  {
513  uno::Reference< excel::XWorksheet > xSheet( Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW );
514  ScVbaWorksheet* pSheet = excel::getImplFromDocModuleWrapper<ScVbaWorksheet>( xSheet );
515  if ( pSheet )
516  aMarkData.SelectTable(static_cast< SCTAB >( pSheet->getSheetID() ), true );
517  }
518  // save old selection, setting the selectedtabs in the preview
519  // can affect the current selection when preview has been
520  // closed
521  ScMarkData::MarkedTabsType aOldTabs = pPrvView->GetSelectedTabs();
522  pPrvView->SetSelectedTabs( aMarkData );
523  // force update
524  pPrvView->DataChanged(false);
525  // set sensible first page
526  tools::Long nPage = pPrvView->GetFirstPage( 1 );
527  pPrvView->SetPageNo( nPage );
528  WaitUntilPreviewIsClosed( pViewFrame );
529  // restore old tab selection
530  pViewShell = excel::getBestViewShell( mxModel );
531  pViewShell->GetViewData().GetMarkData().SetSelectedTabs(aOldTabs);
532 
533 }
534 
535 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3046
Reference< XTypeConverter > xConverter
SfxViewFrame * GetViewFrame() const
virtual css::uno::Any SAL_CALL Application() override
virtual css::uno::Any createCollectionObject(const css::uno::Any &aSource) override
Type
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)
Reference< frame::XModel > m_xModel
bool hasValue()
bool bVisible
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: preview.cxx:925
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess
long Long
EnumerationHelperImpl(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::container::XEnumeration > &xEnumeration)
virtual css::uno::Any SAL_CALL Add(const css::uno::Any &Before, const css::uno::Any &After, const css::uno::Any &Count, const css::uno::Any &Type) override
Reference
std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap
css::uno::Reference< css::frame::XModel2 > mxModel
virtual void SAL_CALL PrintPreview(const css::uno::Any &EnableChanges) override
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
virtual css::uno::Any getItemByStringIndex(const OUString &sIndex)
css::uno::Reference< ov::excel::XWorksheet > createSheetCopy(css::uno::Reference< ov::excel::XWorksheet > const &xSheet, bool bAfter)
static bool nameExists(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &xSpreadDoc, const OUString &name, SCTAB &nTab)
exports com.sun.star. sheet
exports com.sun.star. container
uno::Reference< XHelperInterface > getUnoSheetModuleObj(const uno::Reference< table::XCellRange > &xRange)
std::vector< uno::Reference< sheet::XSpreadsheet > > Sheets
Definition: vbawindow.cxx:57
SfxFrame & GetFrame() const
int nCount
virtual css::uno::Any SAL_CALL Item(const css::uno::Any &Index1, const css::uno::Any &Index2) override
SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData &rMark)
Definition: preview.cxx:1567
virtual css::uno::Sequence< OUString > getServiceNames() override
ScViewData & GetViewData()
Definition: tabview.hxx:334
void WaitUntilPreviewIsClosed(SfxViewFrame *pViewFrame)
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL setVisible(const css::uno::Any &_visible) override
int i
virtual OUString getServiceImplName() override
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
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) override
SC_DLLPUBLIC void SetPageNo(tools::Long nPage)
Definition: preview.cxx:745
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:880
const css::uno::Reference< css::sheet::XSpreadsheet > & getSheet() const
css::uno::Reference< css::container::XNameAccess > m_xNameAccess
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:189
unsigned char sal_Bool
sal_Int16 getSheetID() const
bool isSelectedSheets() const
virtual void SAL_CALL Delete() override
const ScMarkData::MarkedTabsType & GetSelectedTabs() const
Definition: preview.hxx:161
css::uno::Type const & get()
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
css::uno::Reference< ov::excel::XWorksheet > createSheetCopyInNewDoc(const OUString &)
ScTabViewShell * getBestViewShell(const css::uno::Reference< css::frame::XModel > &xModel)
virtual void SAL_CALL Select(const css::uno::Any &Replace) override
SC_DLLPUBLIC tools::Long GetFirstPage(SCTAB nTab)
Definition: preview.cxx:754
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
void dispatchExecute(SfxViewShell const *pViewShell, sal_uInt16 nSlot)
css::uno::Reference< css::uno::XComponentContext > mxContext
bool IsInPlace() const
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
static SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
virtual css::uno::Any SAL_CALL getVisible() override
OUString aName
virtual void SAL_CALL Copy(const css::uno::Any &Before, const css::uno::Any &After) override
css::uno::Reference< css::sheet::XSpreadsheets > m_xSheets
css::uno::Reference< css::frame::XModel > mxModel
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
Any result
Reference< XModel > xModel
uno::Reference< script::XTypeConverter > const & getTypeConverter(const uno::Reference< uno::XComponentContext > &xContext)
virtual css::uno::Any SAL_CALL Item(const css::uno::Any &Index1, const css::uno::Any &) override
Reference< XComponentContext > m_xContext
std::set< SCTAB > MarkedTabsType
Definition: markdata.hxx:46
struct _ADOIndex Index
ScVbaWorksheets(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::container::XIndexAccess > &xSheets, const css::uno::Reference< css::frame::XModel > &xModel)
sal_Int16 SCTAB
Definition: types.hxx:23
virtual ::sal_Int32 SAL_CALL getCount() override
void SetSelectedTabs(const MarkedTabsType &rTabs)
Definition: markdata.cxx:218