LibreOffice Module sc (master)  1
excelvbahelper.hxx
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 #pragma once
20 
21 #include <sal/config.h>
22 
24 
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <vector>
27 #include <global.hxx>
28 
29 namespace com::sun::star::frame { class XModel; }
30 namespace com::sun::star::uno { class XComponentContext; }
31 
32 namespace com::sun::star::sheet { class XDatabaseRange; }
33 namespace com::sun::star::sheet { class XUnnamedDatabaseRanges; }
34 namespace com::sun::star::table { class XCell; }
35 namespace com::sun::star::table { class XCellRange; }
36 namespace com::sun::star::sheet { class XSheetCellRangeContainer; }
37 namespace com::sun::star::sheet { class XSpreadsheet; }
38 namespace com::sun::star::sheet { class XSpreadsheetDocument; }
39 namespace ooo::vba { class XHelperInterface; }
40 
41 class ScCellRangesBase;
42 class ScTabViewShell;
43 class SfxViewFrame;
44 
45 namespace ooo::vba::excel {
46 
47 // nTabs empty means apply zoom to all sheets
48 void implSetZoom( const css::uno::Reference< css::frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs );
49 void implnCopy( const css::uno::Reference< css::frame::XModel>& xModel );
50 void implnPaste ( const css::uno::Reference< css::frame::XModel>& xModel );
51 void implnCut( const css::uno::Reference< css::frame::XModel>& xModel );
52 void implnPasteSpecial( const css::uno::Reference< css::frame::XModel>& xModel, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bTranspose);
53 ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
54 ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
55 ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext );
56 SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel );
57 
59 css::uno::Reference< css::sheet::XUnnamedDatabaseRanges > GetUnnamedDataBaseRanges( const ScDocShell* pShell );
60 
62 css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( const ScDocShell* pShell, sal_Int16 nSheet );
64 css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSpreadsheet >& xSheet );
66 css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges );
68 css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCellRange >& xRange );
70 css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCell >& xCell );
72 css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::frame::XModel >& xModel, SCTAB nTab );
73 
75 ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange );
76 void setUpDocumentModules( const css::uno::Reference< css::sheet::XSpreadsheetDocument >& xDoc );
77 
79 {
80 public:
81  static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
82 };
83 
84 // Extracts an implementation object (via XUnoTunnel) from a UNO object.
85 // Will throw if unsuccessful.
87 template < typename ImplObject >
88  ImplObject* getImplFromDocModuleWrapper( const css::uno::Reference< css::uno::XInterface >& rxWrapperIf )
89  {
90  ImplObject* pObj = comphelper::getFromUnoTunnel<ImplObject>(rxWrapperIf);
91  if ( !pObj )
92  throw css::uno::RuntimeException("Internal error, can't extract implementation object", rxWrapperIf );
93  return pObj;
94  }
95 
96 } // namespace ooo::vba::excel
97 
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void setUpDocumentModules(const uno::Reference< sheet::XSpreadsheetDocument > &xDoc)
uno::Reference< sheet::XUnnamedDatabaseRanges > GetUnnamedDataBaseRanges(const ScDocShell *pShell)
ScDocShell * GetDocShellFromRange(const uno::Reference< uno::XInterface > &xRange)
ImplObject * getImplFromDocModuleWrapper(const css::uno::Reference< css::uno::XInterface > &rxWrapperIf)
void implnCopy(const uno::Reference< frame::XModel > &xModel)
static SfxItemSet * GetDataSet(ScCellRangesBase *pRangeObj)
uno::Reference< XHelperInterface > getUnoSheetModuleObj(const uno::Reference< table::XCellRange > &xRange)
ScPasteFunc
Definition: global.hxx:189
ScDocShell * getDocShell(const css::uno::Reference< css::frame::XModel > &xModel)
InsertDeleteFlags
Definition: global.hxx:158
SfxViewFrame * getViewFrame(const uno::Reference< frame::XModel > &xModel)
void implnCut(const uno::Reference< frame::XModel > &xModel)
uno::Reference< sheet::XDatabaseRange > GetAutoFiltRange(const ScDocShell *pShell, sal_Int16 nSheet)
ScTabViewShell * getBestViewShell(const css::uno::Reference< css::frame::XModel > &xModel)
void implnPasteSpecial(const uno::Reference< frame::XModel > &xModel, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bTranspose)
ScTabViewShell * getCurrentBestViewShell(const uno::Reference< uno::XComponentContext > &xContext)
void implnPaste(const uno::Reference< frame::XModel > &xModel)
void implSetZoom(const uno::Reference< frame::XModel > &xModel, sal_Int16 nZoom, std::vector< SCTAB > &nTabs)
sal_Int16 SCTAB
Definition: types.hxx:22