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