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 .
19 #ifndef INCLUDED_SC_SOURCE_UI_VBA_EXCELVBAHELPER_HXX
20 #define INCLUDED_SC_SOURCE_UI_VBA_EXCELVBAHELPER_HXX
22 #include <vbahelper/vbahelper.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>
33 class ScCellRangesBase
;
39 // nTabs empty means apply zoom to all sheets
40 void implSetZoom( const css::uno::Reference
< css::frame::XModel
>& xModel
, sal_Int16 nZoom
, std::vector
< SCTAB
>& nTabs
);
41 void implnCopy( const css::uno::Reference
< css::frame::XModel
>& xModel
);
42 void implnPaste ( const css::uno::Reference
< css::frame::XModel
>& xModel
);
43 void implnCut( const css::uno::Reference
< css::frame::XModel
>& xModel
);
44 void implnPasteSpecial( const css::uno::Reference
< css::frame::XModel
>& xModel
, InsertDeleteFlags nFlags
, sal_uInt16 nFunction
, bool bSkipEmpty
, bool bTranspose
);
45 ScTabViewShell
* getBestViewShell( const css::uno::Reference
< css::frame::XModel
>& xModel
) ;
46 ScDocShell
* getDocShell( const css::uno::Reference
< css::frame::XModel
>& xModel
) ;
47 ScTabViewShell
* getCurrentBestViewShell( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
48 SfxViewFrame
* getViewFrame( const css::uno::Reference
< css::frame::XModel
>& xModel
);
50 css::uno::Reference
< css::sheet::XUnnamedDatabaseRanges
> GetUnnamedDataBaseRanges( ScDocShell
* pShell
) throw ( css::uno::RuntimeException
);
52 css::uno::Reference
< css::sheet::XDatabaseRange
> GetAutoFiltRange( ScDocShell
* pShell
, sal_Int16 nSheet
) throw ( css::uno::RuntimeException
);
53 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::sheet::XSpreadsheet
>& xSheet
) throw ( css::uno::RuntimeException
);
54 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::sheet::XSheetCellRangeContainer
>& xRanges
) throw ( css::uno::RuntimeException
);
55 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::table::XCellRange
>& xRange
) throw ( css::uno::RuntimeException
);
56 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::table::XCell
>& xCell
) throw ( css::uno::RuntimeException
);
57 css::uno::Reference
< ooo::vba::XHelperInterface
> getUnoSheetModuleObj( const css::uno::Reference
< css::frame::XModel
>& xModel
, SCTAB nTab
) throw ( css::uno::RuntimeException
);
59 ScDocShell
* GetDocShellFromRange( const css::uno::Reference
< css::uno::XInterface
>& xRange
) throw ( css::uno::RuntimeException
);
60 void setUpDocumentModules( const css::uno::Reference
< css::sheet::XSpreadsheetDocument
>& xDoc
);
62 class ScVbaCellRangeAccess
65 static SfxItemSet
* GetDataSet( ScCellRangesBase
* pRangeObj
);
68 // Extracts a implementation object ( via XUnoTunnel ) from an uno object
69 // by default will throw if unsuccessful.
70 template < typename ImplObject
>
71 ImplObject
* getImplFromDocModuleWrapper( const css::uno::Reference
< css::uno::XInterface
>& rxWrapperIf
, bool bThrow
= true ) throw (css::uno::RuntimeException
)
73 ImplObject
* pObj
= NULL
;
74 css::uno::Reference
< css::lang::XUnoTunnel
> xTunnel( rxWrapperIf
, css::uno::UNO_QUERY
);
76 pObj
= reinterpret_cast<ImplObject
*>( xTunnel
->getSomething(ImplObject::getUnoTunnelId()));
77 if ( bThrow
&& !pObj
)
78 throw css::uno::RuntimeException("Internal error, can't exctract implementation object", rxWrapperIf
);
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */