LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/inc - dbtreelistbox.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 14 0.0 %
Date: 2012-12-27 Functions: 0 15 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 DBAUI_DBTREELISTBOX_HXX
      20             : #define DBAUI_DBTREELISTBOX_HXX
      21             : 
      22             : #include "ScrollHelper.hxx"
      23             : #include "moduledbu.hxx"
      24             : 
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : 
      27             : #include <svtools/treelistbox.hxx>
      28             : #include <vcl/timer.hxx>
      29             : 
      30             : #include <set>
      31             : 
      32             : 
      33             : namespace dbaui
      34             : {
      35           0 :     struct DBTreeEditedEntry
      36             :     {
      37             :         SvTreeListEntry*    pEntry;
      38             :         XubString       aNewText;
      39             :     };
      40             : 
      41           0 :     class IEntryFilter
      42             :     {
      43             :     public:
      44             :         virtual bool    includeEntry( SvTreeListEntry* _pEntry ) const = 0;
      45             : 
      46             :     protected:
      47           0 :         ~IEntryFilter() {}
      48             :     };
      49             : 
      50             :     //========================================================================
      51             :     class IControlActionListener;
      52             :     class IContextMenuProvider;
      53             :     class DBTreeListBox     :public SvTreeListBox
      54             :     {
      55             :         OModuleClient               m_aModuleClient;
      56             :         OScrollHelper               m_aScrollHelper;
      57             :         Timer                       m_aTimer; // is needed for table updates
      58             :         Point                       m_aMousePos;
      59             :         std::set<SvTreeListEntry*>      m_aSelectedEntries;
      60             :         SvTreeListEntry*                m_pDragedEntry;
      61             :         IControlActionListener*     m_pActionListener;
      62             :         IContextMenuProvider*
      63             :                                     m_pContextMenuProvider;
      64             : 
      65             :         Link                        m_aPreExpandHandler;    // handler to be called before a node is expanded
      66             :         Link                        m_aSelChangeHdl;        // handlet to be called (asynchronously) when the selection changes in any way
      67             :         Link                        m_aCutHandler;          // called when someone press CTRL+X
      68             :         Link                        m_aCopyHandler;         // called when someone press CTRL+C
      69             :         Link                        m_aPasteHandler;        // called when someone press CTRL+V
      70             :         Link                        m_aDeleteHandler;       // called when someone press DELETE Key
      71             :         Link                        m_aEditingHandler;      // called before someone will edit an entry
      72             :         Link                        m_aEditedHandler;       // called after someone edited an entry
      73             :         Link                        m_aEnterKeyHdl;
      74             : 
      75             : 
      76             :         sal_Bool                    m_bHandleEnterKey;
      77             : 
      78             :     protected:
      79             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
      80             : 
      81             :     private:
      82             :         void init();
      83             :         DECL_LINK( OnTimeOut, void* );
      84             :         DECL_LINK( OnResetEntry, SvTreeListEntry* );
      85             :         DECL_LINK( ScrollUpHdl, SvTreeListBox* );
      86             :         DECL_LINK( ScrollDownHdl, SvTreeListBox* );
      87             : 
      88             :     public:
      89             :         DBTreeListBox( Window* pParent
      90             :             ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
      91             :             ,WinBits nWinStyle=0
      92             :             ,sal_Bool _bHandleEnterKey = sal_False);
      93             :         DBTreeListBox( Window* pParent
      94             :             ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
      95             :             ,const ResId& rResId
      96             :             ,sal_Bool _bHandleEnterKey = sal_False);
      97             :         ~DBTreeListBox();
      98             : 
      99           0 :         void                    setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
     100           0 :         void                    setContextMenuProvider( IContextMenuProvider* _pContextMenuProvider ) { m_pContextMenuProvider = _pContextMenuProvider; }
     101             : 
     102           0 :         inline void setORB(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB) { m_xORB = _xORB; }
     103             : 
     104             : 
     105           0 :         void    SetPreExpandHandler(const Link& _rHdl)  { m_aPreExpandHandler = _rHdl; }
     106           0 :         void    SetSelChangeHdl( const Link& _rHdl )    { m_aSelChangeHdl = _rHdl; }
     107           0 :         void    setCutHandler(const Link& _rHdl)        { m_aCutHandler = _rHdl; }
     108           0 :         void    setCopyHandler(const Link& _rHdl)       { m_aCopyHandler = _rHdl; }
     109           0 :         void    setPasteHandler(const Link& _rHdl)      { m_aPasteHandler = _rHdl; }
     110           0 :         void    setDeleteHandler(const Link& _rHdl)     { m_aDeleteHandler = _rHdl; }
     111             :         void    setEditingHandler(const Link& _rHdl)    { m_aEditingHandler = _rHdl; }
     112             :         void    setEditedHandler(const Link& _rHdl)     { m_aEditedHandler = _rHdl; }
     113             : 
     114             :         // modified the given entry so that the expand handler is called whenever the entry is expanded
     115             :         // (normally, the expand handler is called only once)
     116             :         void            EnableExpandHandler(SvTreeListEntry* _pEntry);
     117             : 
     118             :         SvTreeListEntry*    GetEntryPosByName( const String& aName, SvTreeListEntry* pStart = NULL, const IEntryFilter* _pFilter = NULL ) const;
     119             :         virtual void    RequestingChildren( SvTreeListEntry* pParent );
     120             :         virtual void    SelectHdl();
     121             :         virtual void    DeselectHdl();
     122             :         // Window
     123             :         virtual void    KeyInput( const KeyEvent& rKEvt );
     124             : 
     125             :         virtual void    StateChanged( StateChangedType nStateChange );
     126             :         virtual void    InitEntry(SvTreeListEntry* pEntry, const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp, SvLBoxButtonKind eButtonKind);
     127             : 
     128             :         // enable editing for tables/views and queries
     129             :         virtual sal_Bool    EditingEntry( SvTreeListEntry* pEntry, Selection& );
     130             :         virtual sal_Bool    EditedEntry( SvTreeListEntry* pEntry, const rtl::OUString& rNewText );
     131             : 
     132             :         virtual sal_Bool    DoubleClickHdl();
     133             : 
     134             :         virtual PopupMenu* CreateContextMenu( void );
     135             :         virtual void    ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
     136             : 
     137           0 :         void            SetEnterKeyHdl(const Link& rNewHdl) {m_aEnterKeyHdl = rNewHdl;}
     138             : 
     139           0 :         void            clearCurrentSelection() { m_aSelectedEntries.clear(); }
     140             : 
     141             :     protected:
     142             :         virtual void        MouseButtonDown( const MouseEvent& rMEvt );
     143             :         virtual void        RequestHelp( const HelpEvent& rHEvt );
     144             : 
     145             :         // DragSourceHelper overridables
     146             :         virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     147             :         // DropTargetHelper overridables
     148             :         virtual sal_Int8    AcceptDrop( const AcceptDropEvent& _rEvt );
     149             :         virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& _rEvt );
     150             : 
     151             :         virtual void        ModelHasRemoved( SvTreeListEntry* pEntry );
     152             :         virtual void        ModelHasEntryInvalidated( SvTreeListEntry* pEntry );
     153             : 
     154             :         void                implStopSelectionTimer();
     155             :         void                implStartSelectionTimer();
     156             : 
     157             :     protected:
     158             :         using SvTreeListBox::ExecuteDrop;
     159             :     };
     160             : }
     161             : 
     162             : #endif // DBAUI_DBTREELISTBOX_HXX
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10