1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <sal/config.h>
23 #include <comphelper/servicehelper.hxx>
24 #include <com/sun/star/document/XDocumentProperties.hpp>
25 #include <ooo/vba/excel/XApplication.hpp>
30 namespace com::sun::star::frame
{ class XModel
; }
31 namespace com::sun::star::uno
{ class XComponentContext
; }
33 namespace com::sun::star::sheet
{ class XDatabaseRange
; }
34 namespace com::sun::star::sheet
{ class XUnnamedDatabaseRanges
; }
35 namespace com::sun::star::table
{ class XCell
; }
36 namespace com::sun::star::table
{ class XCellRange
; }
37 namespace com::sun::star::sheet
{ class XSheetCellRangeContainer
; }
38 namespace com::sun::star::sheet
{ class XSpreadsheet
; }
39 namespace com::sun::star::sheet
{ class XSpreadsheetDocument
; }
40 namespace ooo::vba
{ class XHelperInterface
; }
42 class ScCellRangesBase
;
46 namespace ooo::vba::excel
{
48 // nTabs empty means apply zoom to all sheets
49 void implSetZoom( const css::uno::Reference
< css::frame::XModel
>& xModel
, sal_Int16 nZoom
, std::vector
< SCTAB
>& nTabs
);
50 void implnCopy( const css::uno::Reference
< css::frame::XModel
>& xModel
);
51 void implnPaste ( const css::uno::Reference
< css::frame::XModel
>& xModel
);
52 void implnCut( const css::uno::Reference
< css::frame::XModel
>& xModel
);
53 void implnPasteSpecial( const css::uno::Reference
< css::frame::XModel
>& xModel
, InsertDeleteFlags nFlags
, ScPasteFunc nFunction
, bool bSkipEmpty
, bool bTranspose
);
54 SAL_RET_MAYBENULL ScTabViewShell
* getBestViewShell( const css::uno::Reference
< css::frame::XModel
>& xModel
) ;
55 SAL_RET_MAYBENULL ScDocShell
* getDocShell( const css::uno::Reference
< css::frame::XModel
>& xModel
) ;
56 SAL_RET_MAYBENULL ScTabViewShell
* getCurrentBestViewShell( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
57 SAL_RET_MAYBENULL SfxViewFrame
* getViewFrame( const css::uno::Reference
< css::frame::XModel
>& xModel
);
59 /// @throws css::uno::RuntimeException
60 css::uno::Reference
< css::sheet::XUnnamedDatabaseRanges
> GetUnnamedDataBaseRanges( const ScDocShell
* pShell
);
62 /// @throws css::uno::RuntimeException
63 css::uno::Reference
< css::sheet::XDatabaseRange
> GetAutoFiltRange( const ScDocShell
* pShell
, sal_Int16 nSheet
);
64 /// @throws css::uno::RuntimeException
65 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::sheet::XSpreadsheet
>& xSheet
);
66 /// @throws css::uno::RuntimeException
67 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::sheet::XSheetCellRangeContainer
>& xRanges
);
68 /// @throws css::uno::RuntimeException
69 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::table::XCellRange
>& xRange
);
70 /// @throws css::uno::RuntimeException
71 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::table::XCell
>& xCell
);
72 /// @throws css::uno::RuntimeException
73 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::frame::XModel
>& xModel
, SCTAB nTab
);
75 /// @throws css::uno::RuntimeException
76 ScDocShell
* GetDocShellFromRange( const css::uno::Reference
< css::uno::XInterface
>& xRange
);
77 void setUpDocumentModules( const css::uno::Reference
< css::sheet::XSpreadsheetDocument
>& xDoc
);
79 void ExportAsFixedFormatHelper(
80 const css::uno::Reference
< css::frame::XModel
>& xModel
, const css::uno::Reference
< ooo::vba::excel::XApplication
>& xApplication
,
81 const css::uno::Any
& Type
, const css::uno::Any
& FileName
, const css::uno::Any
& Quality
,
82 const css::uno::Any
& IncludeDocProperties
, const css::uno::Any
& From
,
83 const css::uno::Any
& To
, const css::uno::Any
& OpenAfterPublish
);
86 const css::uno::Reference
< css::frame::XModel
>& xModel
,
87 const css::uno::Reference
< css::document::XDocumentProperties
>& i_xOldDocInfo
);
89 class ScVbaCellRangeAccess
92 static SfxItemSet
* GetDataSet( ScCellRangesBase
* pRangeObj
);
95 // Extracts an implementation object (via XUnoTunnel) from a UNO object.
96 // Will throw if unsuccessful.
97 /// @throws css::uno::RuntimeException
98 template < typename ImplObject
>
99 ImplObject
* getImplFromDocModuleWrapper( const css::uno::Reference
< css::uno::XInterface
>& rxWrapperIf
)
101 ImplObject
* pObj
= comphelper::getFromUnoTunnel
<ImplObject
>(rxWrapperIf
);
103 throw css::uno::RuntimeException(u
"Internal error, can't extract implementation object"_ustr
, rxWrapperIf
);
107 } // namespace ooo::vba::excel
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */