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

Generated by: LCOV version 1.10