LCOV - code coverage report
Current view: top level - oox/inc/oox/ole - vbamodule.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 4 75.0 %
Date: 2012-08-25 Functions: 3 4 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            : 
      20                 :            : #ifndef OOX_OLE_VBAMODULE_HXX
      21                 :            : #define OOX_OLE_VBAMODULE_HXX
      22                 :            : 
      23                 :            : #include <com/sun/star/uno/Reference.hxx>
      24                 :            : #include <rtl/ustring.hxx>
      25                 :            : 
      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; }
      31                 :            : } } }
      32                 :            : 
      33                 :            : namespace oox {
      34                 :            :     class BinaryInputStream;
      35                 :            :     class StorageBase;
      36                 :            : }
      37                 :            : 
      38                 :            : namespace oox {
      39                 :            : namespace ole {
      40                 :            : 
      41                 :            : // ============================================================================
      42                 :            : 
      43                 :         65 : class VbaModule
      44                 :            : {
      45                 :            : public:
      46                 :            :     explicit            VbaModule(
      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 ::rtl::OUString& rName,
      50                 :            :                             rtl_TextEncoding eTextEnc,
      51                 :            :                             bool bExecutable );
      52                 :            : 
      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                 :         65 :     inline void         setType( sal_Int32 nType ) { mnType = nType; }
      57                 :            : 
      58                 :            :     /** Returns the name of the module. */
      59                 :          0 :     inline const ::rtl::OUString& getName() const { return maName; }
      60                 :            :     /** Returns the stream name of the module. */
      61                 :         65 :     inline const ::rtl::OUString& getStreamName() const { return maStreamName; }
      62                 :            : 
      63                 :            :     /** Imports all records for this module until the MODULEEND record. */
      64                 :            :     void                importDirRecords( BinaryInputStream& rDirStrm );
      65                 :            : 
      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,
      71                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
      72                 :            :     /** Creates an empty Basic module in the passed Basic library. */
      73                 :            :     void                createEmptyModule(
      74                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
      75                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
      76                 :            : 
      77                 :            : private:
      78                 :            :     /** Reads and returns the VBA source code from the passed storage. */
      79                 :            :     ::rtl::OUString     readSourceCode(
      80                 :            :                             StorageBase& rVbaStrg,
      81                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
      82                 :            : 
      83                 :            :     void extractOleOverrideFromAttr( const rtl::OUString& rAttribute,
      84                 :            :                                      const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
      85                 :            : 
      86                 :            :     /** Creates a new Basic module and inserts it into the passed Basic library. */
      87                 :            :     void                createModule(
      88                 :            :                             const ::rtl::OUString& rVBASourceCode,
      89                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
      90                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
      91                 :            : 
      92                 :            : private:
      93                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
      94                 :            :                         mxContext;          ///< Component context with service manager.
      95                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
      96                 :            :                         mxDocModel;         ///< Document model used to import/export the VBA project.
      97                 :            :     ::rtl::OUString     maName;
      98                 :            :     ::rtl::OUString     maStreamName;
      99                 :            :     ::rtl::OUString     maDocString;
     100                 :            :     rtl_TextEncoding    meTextEnc;
     101                 :            :     sal_Int32           mnType;
     102                 :            :     sal_uInt32          mnOffset;
     103                 :            :     bool                mbReadOnly;
     104                 :            :     bool                mbPrivate;
     105                 :            :     bool                mbExecutable;
     106                 :            : };
     107                 :            : 
     108                 :            : // ============================================================================
     109                 :            : 
     110                 :            : } // namespace ole
     111                 :            : } // namespace oox
     112                 :            : 
     113                 :            : #endif
     114                 :            : 
     115                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10