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