LCOV - code coverage report
Current view: top level - basctl/source/basicide - bastype2.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 18 0.0 %
Date: 2014-04-11 Functions: 0 19 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10