LCOV - code coverage report
Current view: top level - basctl/source/basicide - bastype2.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 17 0.0 %
Date: 2012-08-25 Functions: 0 17 0.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                 :            : #ifndef _BASTYPE2_HXX
      20                 :            : #define _BASTYPE2_HXX
      21                 :            : 
      22                 :            : #include "doceventnotifier.hxx"
      23                 :            : 
      24                 :            : #include <memory>
      25                 :            : #include "tools/solar.h"
      26                 :            : 
      27                 :            : #include <svtools/svtreebx.hxx>
      28                 :            : #include <svl/lstner.hxx>
      29                 :            : #include <basic/sbstar.hxx>
      30                 :            : #include <sbxitem.hxx>
      31                 :            : #include "basobj.hxx"
      32                 :            : 
      33                 :            : enum BasicEntryType
      34                 :            : {
      35                 :            :     OBJ_TYPE_UNKNOWN,
      36                 :            :     OBJ_TYPE_DOCUMENT,
      37                 :            :     OBJ_TYPE_LIBRARY,
      38                 :            :     OBJ_TYPE_MODULE,
      39                 :            :     OBJ_TYPE_DIALOG,
      40                 :            :     OBJ_TYPE_METHOD,
      41                 :            :     OBJ_TYPE_DOCUMENT_OBJECTS,
      42                 :            :     OBJ_TYPE_USERFORMS,
      43                 :            :     OBJ_TYPE_NORMAL_MODULES,
      44                 :            :     OBJ_TYPE_CLASS_MODULES
      45                 :            : };
      46                 :            : 
      47                 :            : #define BROWSEMODE_MODULES      0x01
      48                 :            : #define BROWSEMODE_SUBS         0x02
      49                 :            : #define BROWSEMODE_DIALOGS      0x04
      50                 :            : 
      51                 :            : class SbModule;
      52                 :            : class SvLBoxEntry;
      53                 :            : class SbxVariable;
      54                 :            : 
      55                 :            : 
      56                 :            : class BasicEntry
      57                 :            : {
      58                 :            : private:
      59                 :            :     BasicEntryType  m_eType;
      60                 :            : 
      61                 :            : public:
      62                 :          0 :                     BasicEntry( BasicEntryType eType )  { m_eType = eType; }
      63                 :          0 :                     BasicEntry( const BasicEntry& r )   { m_eType = r.m_eType; }
      64                 :            :     virtual         ~BasicEntry();
      65                 :            : 
      66                 :          0 :     BasicEntryType  GetType() const                     { return m_eType; }
      67                 :            : };
      68                 :            : 
      69                 :            : class BasicDocumentEntry : public BasicEntry
      70                 :            : {
      71                 :            : private:
      72                 :            :     ScriptDocument      m_aDocument;
      73                 :            :     LibraryLocation     m_eLocation;
      74                 :            : 
      75                 :            : public:
      76                 :            :                     BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType = OBJ_TYPE_DOCUMENT );
      77                 :            :     virtual         ~BasicDocumentEntry();
      78                 :            : 
      79                 :            :     const ScriptDocument&
      80                 :          0 :                     GetDocument() const { return m_aDocument; }
      81                 :          0 :     LibraryLocation GetLocation() const { return m_eLocation; }
      82                 :            : };
      83                 :            : 
      84                 :            : class BasicLibEntry : public BasicDocumentEntry
      85                 :            : {
      86                 :            : private:
      87                 :            :     ::rtl::OUString m_aLibName;
      88                 :            : 
      89                 :            : public:
      90                 :            :     BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, BasicEntryType eType = OBJ_TYPE_LIBRARY );
      91                 :            :     virtual         ~BasicLibEntry();
      92                 :            : 
      93                 :          0 :     const ::rtl::OUString&   GetLibName() const { return m_aLibName; }
      94                 :            : };
      95                 :            : 
      96                 :            : class BasicEntryDescriptor
      97                 :            : {
      98                 :            :     ScriptDocument          m_aDocument;
      99                 :            :     LibraryLocation         m_eLocation;
     100                 :            :     ::rtl::OUString         m_aLibName;
     101                 :            :     ::rtl::OUString         m_aLibSubName;  // for vba entry:  Document Objects, Class Modules, Forms and Normal Modules
     102                 :            :     ::rtl::OUString         m_aName;
     103                 :            :     ::rtl::OUString         m_aMethodName;
     104                 :            :     BasicEntryType          m_eType;
     105                 :            : 
     106                 :            : public:
     107                 :            :                             BasicEntryDescriptor();
     108                 :            :     BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, const ::rtl::OUString& rLibSubName, const ::rtl::OUString& rName, BasicEntryType eType );
     109                 :            :     BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, const ::rtl::OUString& rLibSubName, const ::rtl::OUString& rName, const ::rtl::OUString& rMethodName, BasicEntryType eType );
     110                 :            :     virtual                 ~BasicEntryDescriptor();
     111                 :            : 
     112                 :            :                             BasicEntryDescriptor( const BasicEntryDescriptor& rDesc );
     113                 :            :     BasicEntryDescriptor&   operator=( const BasicEntryDescriptor& rDesc );
     114                 :            :     bool                    operator==( const BasicEntryDescriptor& rDesc ) const;
     115                 :            : 
     116                 :            :     const ScriptDocument&
     117                 :          0 :                             GetDocument() const { return m_aDocument; }
     118                 :            :     void                    SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
     119                 :            : 
     120                 :          0 :     LibraryLocation         GetLocation() const { return m_eLocation; }
     121                 :            :     void                    SetLocation( LibraryLocation eLocation ) { m_eLocation = eLocation; }
     122                 :            : 
     123                 :          0 :     const ::rtl::OUString&  GetLibName() const { return m_aLibName; }
     124                 :            :     void                    SetLibName( const ::rtl::OUString& aLibName ) { m_aLibName = aLibName; }
     125                 :            : 
     126                 :          0 :     const ::rtl::OUString&  GetLibSubName() const { return m_aLibSubName; }
     127                 :            :     void                    SetLibSubName( const ::rtl::OUString& aLibSubName ) { m_aLibSubName = aLibSubName; }
     128                 :            : 
     129                 :          0 :     const ::rtl::OUString&  GetName() const { return m_aName; }
     130                 :            :     void                    SetName( const ::rtl::OUString& aName ) { m_aName = aName; }
     131                 :            : 
     132                 :          0 :     const ::rtl::OUString&           GetMethodName() const { return m_aMethodName; }
     133                 :          0 :     void                    SetMethodName( const ::rtl::OUString& aMethodName ) { m_aMethodName = aMethodName; }
     134                 :            : 
     135                 :          0 :     BasicEntryType          GetType() const { return m_eType; }
     136                 :          0 :     void                    SetType( BasicEntryType eType ) { m_eType = eType; }
     137                 :            : };
     138                 :            : 
     139                 :            : 
     140                 :            : /************************************************************
     141                 :            :     Classification of types and pointers in the BasicEntries:
     142                 :            : 
     143                 :            :     OBJ_TYPE_DOCUMENT        BasicDocumentEntry
     144                 :            :     OBJ_TYPE_LIBRARY         BasicEntry
     145                 :            :     OBJ_TYPE_MODULE          BasicEntry
     146                 :            :     OBJ_TYPE_DIALOG          BasicEntry
     147                 :            :     OBJ_TYPE_METHOD          BasicEntry
     148                 :            : 
     149                 :            : **************************************************************/
     150                 :            : 
     151                 :            : class BasicTreeListBox  :public SvTreeListBox
     152                 :            :                         ,public ::basctl::DocumentEventListener
     153                 :            : {
     154                 :            : private:
     155                 :            :     sal_uInt16                          nMode;
     156                 :            :     ::basctl::DocumentEventNotifier m_aNotifier;
     157                 :            : 
     158                 :            :     void            SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage );
     159                 :            :     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
     160                 :            : 
     161                 :            : protected:
     162                 :            :     virtual void            RequestingChildren( SvLBoxEntry* pParent );
     163                 :            :     virtual void            ExpandedHdl();
     164                 :            :     virtual SvLBoxEntry*    CloneEntry( SvLBoxEntry* pSource );
     165                 :            :     virtual long            ExpandingHdl();
     166                 :            : 
     167                 :            :     void                    ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
     168                 :            :     void                    ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName );
     169                 :            :     void                    ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName );
     170                 :            :     void                    ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName );
     171                 :            :     SvLBoxEntry*            ImpFindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText );
     172                 :            : 
     173                 :            :     // DocumentEventListener
     174                 :            :     virtual void onDocumentCreated( const ScriptDocument& _rDocument );
     175                 :            :     virtual void onDocumentOpened( const ScriptDocument& _rDocument );
     176                 :            :     virtual void onDocumentSave( const ScriptDocument& _rDocument );
     177                 :            :     virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
     178                 :            :     virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
     179                 :            :     virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
     180                 :            :     virtual void onDocumentClosed( const ScriptDocument& _rDocument );
     181                 :            :     virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
     182                 :            :     virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
     183                 :            : 
     184                 :            : public:
     185                 :            :                     BasicTreeListBox( Window* pParent, const ResId& rRes );
     186                 :            :                     ~BasicTreeListBox();
     187                 :            : 
     188                 :            :     void            ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
     189                 :            :     void            ScanAllEntries();
     190                 :            :     void            UpdateEntries();
     191                 :            : 
     192                 :            :     bool            IsEntryProtected( SvLBoxEntry* pEntry );
     193                 :            : 
     194                 :          0 :     void            SetMode( sal_uInt16 nM ) { nMode = nM; }
     195                 :          0 :     sal_uInt16          GetMode() const { return nMode; }
     196                 :            : 
     197                 :            :     SbModule*       FindModule( SvLBoxEntry* pEntry );
     198                 :            :     SbxVariable*    FindVariable( SvLBoxEntry* pEntry );
     199                 :            :     SvLBoxEntry*    FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
     200                 :            :     SvLBoxEntry*    FindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText, BasicEntryType eType );
     201                 :            : 
     202                 :            :     BasicEntryDescriptor    GetEntryDescriptor( SvLBoxEntry* pEntry );
     203                 :            : 
     204                 :            :     BasicIDEType    ConvertType( BasicEntryType eType );
     205                 :            :     bool            IsValidEntry( SvLBoxEntry* pEntry );
     206                 :            : 
     207                 :            :     SvLBoxEntry*    AddEntry( const ::rtl::OUString& rText, const Image& rImage,
     208                 :            :                               SvLBoxEntry* pParent, bool bChildrenOnDemand,
     209                 :            :                               std::auto_ptr< BasicEntry > aUserData );
     210                 :            :     void            RemoveEntry (SvLBoxEntry*);
     211                 :            :     void            RemoveEntry (ScriptDocument const&);
     212                 :            : 
     213                 :            :     ::rtl::OUString GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const;
     214                 :            :     void            GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage );
     215                 :            : 
     216                 :            :     void            SetCurrentEntry( BasicEntryDescriptor& rDesc );
     217                 :            : 
     218                 :            : private:
     219                 :            :     LibraryType     GetLibraryType() const;
     220                 :            : };
     221                 :            : 
     222                 :            : #endif  // _BASTYPE2_HXX
     223                 :            : 
     224                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10