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 .
20 #ifndef INCLUDED_OOX_OLE_VBAMODULE_HXX
21 #define INCLUDED_OOX_OLE_VBAMODULE_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <rtl/textenc.h>
25 #include <rtl/ustring.hxx>
26 #include <sal/types.h>
28 namespace com
{ namespace sun
{ namespace star
{
29 namespace container
{ class XNameAccess
; }
30 namespace container
{ class XNameContainer
; }
31 namespace frame
{ class XModel
; }
32 namespace uno
{ class XComponentContext
; }
36 class BinaryInputStream
;
48 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
49 const css::uno::Reference
< css::frame::XModel
>& rxDocModel
,
50 const OUString
& rName
,
51 rtl_TextEncoding eTextEnc
,
54 /** Returns the module type (com.sun.star.script.ModuleType constant). */
55 sal_Int32
getType() const { return mnType
; }
56 /** Sets the passed module type. */
57 void setType( sal_Int32 nType
) { mnType
= nType
; }
59 /** Returns the name of the module. */
60 const OUString
& getName() const { return maName
; }
61 /** Returns the stream name of the module. */
62 const OUString
& getStreamName() const { return maStreamName
; }
64 /** Imports all records for this module until the MODULEEND record. */
65 void importDirRecords( BinaryInputStream
& rDirStrm
);
67 /** Imports the VBA source code into the passed Basic library. */
68 void createAndImportModule(
69 StorageBase
& rVbaStrg
,
70 const css::uno::Reference
< css::container::XNameContainer
>& rxBasicLib
,
71 const css::uno::Reference
< css::container::XNameAccess
>& rxDocObjectNA
) const;
72 /** Creates an empty Basic module in the passed Basic library. */
73 void createEmptyModule(
74 const css::uno::Reference
< css::container::XNameContainer
>& rxBasicLib
,
75 const css::uno::Reference
< css::container::XNameAccess
>& rxDocObjectNA
) const;
78 /** Reads and returns the VBA source code from the passed storage. */
79 OUString
readSourceCode( StorageBase
& rVbaStrg
) const;
81 /** Creates a new Basic module and inserts it into the passed Basic library. */
83 const OUString
& rVBASourceCode
,
84 const css::uno::Reference
< css::container::XNameContainer
>& rxBasicLib
,
85 const css::uno::Reference
< css::container::XNameAccess
>& rxDocObjectNA
) const;
88 css::uno::Reference
< css::uno::XComponentContext
>
89 mxContext
; ///< Component context with service manager.
90 css::uno::Reference
< css::frame::XModel
>
91 mxDocModel
; ///< Document model used to import/export the VBA project.
93 OUString maStreamName
;
95 rtl_TextEncoding meTextEnc
;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */