Line data Source code
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 : #ifndef SC_EXCEL_VBA_HELPER_HXX
20 : #define SC_EXCEL_VBA_HELPER_HXX
21 :
22 : #include <vbahelper/vbahelper.hxx>
23 : #include "docsh.hxx"
24 : #include <com/sun/star/sheet/XDatabaseRange.hpp>
25 : #include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
26 : #include <com/sun/star/table/XCellRange.hpp>
27 : #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
28 : #include <com/sun/star/sheet/XSpreadsheet.hpp>
29 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
30 : #include <com/sun/star/lang/XUnoTunnel.hpp>
31 : #include <ooo/vba/XHelperInterface.hpp>
32 :
33 : class ScCellRangesBase;
34 :
35 : namespace ooo {
36 : namespace vba {
37 : namespace excel {
38 :
39 : // ============================================================================
40 :
41 : // nTabs empty means apply zoom to all sheets
42 : void implSetZoom( const css::uno::Reference< css::frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs );
43 : void implnCopy( const css::uno::Reference< css::frame::XModel>& xModel );
44 : void implnPaste ( const css::uno::Reference< css::frame::XModel>& xModel );
45 : void implnCut( const css::uno::Reference< css::frame::XModel>& xModel );
46 : void implnPasteSpecial( const css::uno::Reference< css::frame::XModel>& xModel, sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
47 : ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
48 : ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
49 : ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext );
50 : SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel );
51 :
52 : css::uno::Reference< css::sheet::XUnnamedDatabaseRanges > GetUnnamedDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
53 :
54 : css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet ) throw ( css::uno::RuntimeException );
55 : css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSpreadsheet >& xSheet ) throw ( css::uno::RuntimeException );
56 : css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
57 : css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::uno::RuntimeException );
58 : css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCell >& xCell ) throw ( css::uno::RuntimeException );
59 : css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::frame::XModel >& xModel, SCTAB nTab ) throw ( css::uno::RuntimeException );
60 :
61 : ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
62 : void setUpDocumentModules( const css::uno::Reference< css::sheet::XSpreadsheetDocument >& xDoc );
63 :
64 : // ============================================================================
65 :
66 : class ScVbaCellRangeAccess
67 : {
68 : public:
69 : static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
70 : };
71 :
72 : // Extracts a implementation object ( via XUnoTunnel ) from an uno object
73 : // by default will throw if unsuccessful.
74 : template < typename ImplObject >
75 0 : ImplObject* getImplFromDocModuleWrapper( const css::uno::Reference< css::uno::XInterface >& rxWrapperIf, bool bThrow = true ) throw (css::uno::RuntimeException)
76 : {
77 0 : ImplObject* pObj = NULL;
78 0 : css::uno::Reference< css::lang::XUnoTunnel > xTunnel( rxWrapperIf, css::uno::UNO_QUERY );
79 0 : if ( xTunnel.is() )
80 0 : pObj = reinterpret_cast<ImplObject*>( xTunnel->getSomething(ImplObject::getUnoTunnelId()));
81 0 : if ( bThrow && !pObj )
82 0 : throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Internal error, can't exctract implementation object" ) ), rxWrapperIf );
83 0 : return pObj;
84 : }
85 : // ============================================================================
86 :
87 : } // namespace excel
88 : } // namespace vba
89 : } // namespace ooo
90 :
91 : #endif
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|