LCOV - code coverage report
Current view: top level - dbaccess/source/ui/app - AppDetailView.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 10 0.0 %
Date: 2014-04-14 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 INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
      20             : #define INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
      21             : 
      22             : #include <com/sun/star/frame/XController.hpp>
      23             : #include <com/sun/star/container/XNameAccess.hpp>
      24             : #include <com/sun/star/sdbc/XConnection.hpp>
      25             : #include <com/sun/star/ucb/XContent.hpp>
      26             : #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
      27             : #include <vcl/split.hxx>
      28             : #include <vcl/fixed.hxx>
      29             : #include <vcl/mnemonic.hxx>
      30             : #include "IClipBoardTest.hxx"
      31             : #include "AppTitleWindow.hxx"
      32             : #include "AppElementType.hxx"
      33             : #include <svtools/treelistbox.hxx>
      34             : #include "VertSplitView.hxx"
      35             : 
      36             : #include <vector>
      37             : 
      38             : class SvTreeListEntry;
      39             : 
      40             : namespace dbaui
      41             : {
      42             :     class OAppBorderWindow;
      43             :     class OApplicationDetailView;
      44             :     class OAppDetailPageHelper;
      45             :     class OTasksWindow;
      46             : 
      47           0 :     class OCreationList : public SvTreeListBox
      48             :     {
      49             :         OTasksWindow&   m_rTaskWindow;
      50             : 
      51             :         // members related to drawing the currently hovered/selected entry
      52             :         SvTreeListEntry*        m_pMouseDownEntry;
      53             :         SvTreeListEntry*        m_pLastActiveEntry;
      54             :         Color               m_aOriginalBackgroundColor;
      55             :         Font                m_aOriginalFont;
      56             : 
      57             :     public:
      58             :         OCreationList( OTasksWindow& _rParent );
      59             :         // window overloads
      60             :         virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      61             :         virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      62             :         virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      63             :         virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
      64             :         virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
      65             :         virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
      66             :         virtual void GetFocus() SAL_OVERRIDE;
      67             :         virtual void LoseFocus() SAL_OVERRIDE;
      68             : 
      69           0 :         inline void resetLastActive() { m_pLastActiveEntry = NULL;}
      70             : 
      71             :         void    updateHelpText();
      72             : 
      73             :     protected:
      74             :         virtual void        PreparePaint( SvTreeListEntry* _pEntry ) SAL_OVERRIDE;
      75             :         virtual Rectangle   GetFocusRect( SvTreeListEntry* _pEntry, long _nLine ) SAL_OVERRIDE;
      76             :         virtual void        ModelHasCleared() SAL_OVERRIDE;
      77             : 
      78             :         // IMnemonicEntryList
      79             :         virtual void        SelectSearchEntry( const void* _pEntry ) SAL_OVERRIDE;
      80             :         virtual void        ExecuteSearchEntry( const void* _pEntry ) const SAL_OVERRIDE;
      81             : 
      82             :     private:
      83             :         void    onSelected( SvTreeListEntry* _pEntry ) const;
      84             :         /** sets a new current entry, and invalidates the old and the new one, if necessary
      85             :             @return <TRUE/> if and only if the "current entry" changed
      86             :         */
      87             :         bool    setCurrentEntryInvalidate( SvTreeListEntry* _pEntry );
      88             :     };
      89             : 
      90           0 :     struct TaskEntry
      91             :     {
      92             :         OUString        sUNOCommand;
      93             :         sal_uInt16      nHelpID;
      94             :         OUString        sTitle;
      95             :         bool            bHideWhenDisabled;
      96             :             // TODO: we should be consistent in the task pane and the menus/toolbars:
      97             :             // If an entry is disabled in the latter, it should also be disabled in the former.
      98             :             // If an entry is *hidden* in the former, it should also be hidden in the latter.
      99             : 
     100             :         TaskEntry( const sal_Char* _pAsciiUNOCommand, sal_uInt16 _nHelpID, sal_uInt16 _nTitleResourceID, bool _bHideWhenDisabled = false );
     101             :     };
     102             :     typedef ::std::vector< TaskEntry >  TaskEntryList;
     103             : 
     104           0 :     struct TaskPaneData
     105             :     {
     106             :         /// the tasks available in the pane
     107             :         TaskEntryList   aTasks;
     108             :         /// the resource ID for the title of the pane
     109             :         sal_uInt16          nTitleId;
     110             :     };
     111             : 
     112             :     class OTasksWindow : public Window
     113             :     {
     114             :         OCreationList                       m_aCreation;
     115             :         FixedText                           m_aDescription;
     116             :         FixedText                           m_aHelpText;
     117             :         FixedLine                           m_aFL;
     118             :         OApplicationDetailView*             m_pDetailView;
     119             : 
     120             :         DECL_LINK( OnEntrySelectHdl,        SvTreeListBox* );
     121             :         void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
     122             :     protected:
     123             :         virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
     124             :     public:
     125             :         OTasksWindow(Window* _pParent,OApplicationDetailView* _pDetailView);
     126             :         virtual ~OTasksWindow();
     127             : 
     128             :         // window overloads
     129             :         virtual void Resize() SAL_OVERRIDE;
     130             : 
     131           0 :         OApplicationDetailView* getDetailView() const { return m_pDetailView; }
     132             : 
     133             :         /// fills the Creation listbox with the necessary strings and images
     134             :         void fillTaskEntryList( const TaskEntryList& _rList );
     135             : 
     136           0 :         inline bool HandleKeyInput( const KeyEvent& _rKEvt )
     137             :         {
     138           0 :             return m_aCreation.HandleKeyInput( _rKEvt );
     139             :         }
     140             : 
     141             :         void Clear();
     142             :         void setHelpText(sal_uInt16 _nId);
     143             :     };
     144             :     class OApplicationDetailView : public OSplitterView
     145             :                                  , public IClipboardTest
     146             :     {
     147             :         Splitter                            m_aHorzSplitter;
     148             :         OTitleWindow                        m_aTasks;
     149             :         OTitleWindow                        m_aContainer;
     150             :         OAppBorderWindow&                   m_rBorderWin;       // my parent
     151             :         OAppDetailPageHelper*               m_pControlHelper;
     152             :         ::std::vector< TaskPaneData >       m_aTaskPaneData;
     153             :         MnemonicGenerator                   m_aExternalMnemonics;
     154             : 
     155             :         void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
     156             : 
     157             :     protected:
     158             :         virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
     159             : 
     160             :     public:
     161             :         OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode);
     162             :         virtual ~OApplicationDetailView();
     163             :         // window overloads
     164             :         virtual void GetFocus() SAL_OVERRIDE;
     165             : 
     166             :         /** creates the tables page
     167             :             @param  _xConnection
     168             :                 The connection to get the table names
     169             :         */
     170             :         void createTablesPage(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
     171             : 
     172             :         /** creates the page for the specific type.
     173             :             @param  _eType
     174             :                 The type which should be created. E_TABLE isn't allowed.
     175             :             @param  _xContainer
     176             :                 The container of the elements to be inserted.
     177             :         */
     178             :         void createPage(ElementType _eType,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xContainer);
     179             : 
     180             :         void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
     181             : 
     182             :         /** called to give the window the chance to intercept key events, while it has not
     183             :             the focus
     184             : 
     185             :             @return <TRUE/> if and only if the event has been handled, and should not
     186             :                 not be further processed
     187             :         */
     188             :         bool    interceptKeyInput( const KeyEvent& _rEvent );
     189             : 
     190           0 :         inline OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
     191           0 :         inline OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks.getChildWindow() ); }
     192             : 
     193             :         sal_Bool isCutAllowed() SAL_OVERRIDE ;
     194             :         sal_Bool isCopyAllowed() SAL_OVERRIDE    ;
     195             :         sal_Bool isPasteAllowed() SAL_OVERRIDE;
     196           0 :         virtual sal_Bool hasChildPathFocus() SAL_OVERRIDE { return HasChildPathFocus(); }
     197             :         void copy() SAL_OVERRIDE;
     198             :         void cut() SAL_OVERRIDE;
     199             :         void paste() SAL_OVERRIDE;
     200             : 
     201             :         /** return the qualified name.
     202             :             @param  _pEntry
     203             :                 The entry of a table, or query, form, report to get the qualified name.
     204             :                 If the entry is <NULL/>, the first selected is chosen.
     205             :             @return
     206             :                 the qualified name
     207             :         */
     208             :         OUString getQualifiedName( SvTreeListEntry* _pEntry ) const;
     209             : 
     210             :         /** returns if an entry is a leaf
     211             :             @param _pEntry
     212             :                 The entry to check
     213             :             @return
     214             :                 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
     215             :         */
     216             :         sal_Bool isLeaf(SvTreeListEntry* _pEntry) const;
     217             : 
     218             :         /** returns if one of the selected entries is a leaf
     219             :             @return
     220             :                 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
     221             :         */
     222             :         sal_Bool isALeafSelected() const;
     223             : 
     224             :         /** select all entries in the detail page
     225             :         */
     226             :         void selectAll();
     227             : 
     228             :         /// returns <TRUE/> if it sorts ascending
     229             :         sal_Bool isSortUp() const;
     230             : 
     231             :         /// sort the entries in the detail page down
     232             :         void sortDown();
     233             : 
     234             :         /// sort the entries in the detail page up
     235             :         void sortUp();
     236             : 
     237             :         /// returns <TRUE/> when a detail page was filled
     238             :         sal_Bool isFilled() const;
     239             : 
     240             :         /// return the element of currently select entry
     241             :         ElementType getElementType() const;
     242             : 
     243             :         /** clears the detail pages.
     244             :             @param  _bTaskAlso
     245             :                 If <TRUE/> the task window will also be cleared.
     246             :         */
     247             :         void clearPages(sal_Bool _bTaskAlso = sal_True);
     248             : 
     249             :         /// returns the count of entries
     250             :         sal_Int32 getElementCount();
     251             : 
     252             :         /// returns the count of selected entries
     253             :         sal_Int32 getSelectionCount();
     254             : 
     255             :         /** returns the element names which are selected
     256             :             @param  _rNames
     257             :                 The list will be filled.
     258             :         */
     259             :         void getSelectionElementNames(::std::vector< OUString>& _rNames ) const;
     260             : 
     261             :         /** describes the current selection for the given control
     262             :         */
     263             :         void    describeCurrentSelectionForControl(
     264             :                     const Control& _rControl,
     265             :                     ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
     266             :                 );
     267             : 
     268             :         /** describes the current selection for the given ElementType
     269             :         */
     270             :         void    describeCurrentSelectionForType(
     271             :                     const ElementType _eType,
     272             :                     ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
     273             :                 );
     274             : 
     275             :         /** select all names on the currently selected container. Non existence names where ignored.
     276             :         *
     277             :         * \param _aNames the element names
     278             :         */
     279             :         void selectElements(const ::com::sun::star::uno::Sequence< OUString>& _aNames);
     280             : 
     281             :         /** adds a new object to the detail page.
     282             :             @param  _eType
     283             :                 The type where the entry shold be appended.
     284             :             @param  _rName
     285             :                 The name of the object to be inserted
     286             :             @param  _rObject
     287             :                 The object to add.
     288             :             @param  _rxConn
     289             :                 If we insert a table, the connection must be set.
     290             :         */
     291             :         SvTreeListEntry* elementAdded(ElementType eType
     292             :                         ,const OUString& _rName
     293             :                         ,const ::com::sun::star::uno::Any& _rObject );
     294             : 
     295             :         /** replaces a objects name with a new one
     296             :             @param  _eType
     297             :                 The type where the entry shold be appended.
     298             :             @param  _rOldName
     299             :                 The old name of the object to be replaced
     300             :             @param  _rNewName
     301             :                 The new name of the object to be replaced
     302             :             @param  _rxConn
     303             :                 If we insert a table, the connection must be set.
     304             :             @param  _xObject
     305             :                 The object which was replaced
     306             :         */
     307             :         void elementReplaced(ElementType eType
     308             :                         ,const OUString& _rOldName
     309             :                         ,const OUString& _rNewName );
     310             : 
     311             :         /** removes an element from the detail page.
     312             :             @param  _eType
     313             :                 The type where the entry shold be appended.
     314             :             @param  _rName
     315             :                 The name of the element to be removed.
     316             :             @param  _rxConn
     317             :                 If we remove a table, the connection must be set.
     318             :         */
     319             :         void elementRemoved(ElementType _eType
     320             :                             ,const OUString& _rName );
     321             : 
     322             :         /// returns the preview mode
     323             :         PreviewMode getPreviewMode();
     324             : 
     325             :         /// <TRUE/> if the preview is enabled
     326             :         sal_Bool isPreviewEnabled();
     327             : 
     328             :         /** switches to the given preview mode
     329             :             @param  _eMode
     330             :                 the mode to set for the preview
     331             :         */
     332             :         void switchPreview(PreviewMode _eMode);
     333             : 
     334             :         /** shows the Preview of the content when it is enabled.
     335             :             @param  _xContent
     336             :                 The content which must support the "preview" command.
     337             :         */
     338             :         void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
     339             : 
     340             :         /** shows the Preview of a table or query
     341             :             @param  _sDataSourceName
     342             :                 the name of the data source
     343             :             @param  _sName
     344             :                 the name of table or query
     345             :             @param  _bTable
     346             :                 <TRUE/> if it is a table, otherwise <FALSE/>
     347             :             @return void
     348             :         */
     349             :         void showPreview(   const OUString& _sDataSourceName,
     350             :                             const OUString& _sName,
     351             :                             sal_Bool _bTable);
     352             : 
     353             :         SvTreeListEntry* getEntry( const Point& _aPoint ) const;
     354             : 
     355             :         Window* getTreeWindow() const;
     356             :     private:
     357             :         void                impl_createPage(
     358             :                                 ElementType _eType,
     359             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     360             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxNonTableElements
     361             :                             );
     362             : 
     363             :         const TaskPaneData& impl_getTaskPaneData( ElementType _eType );
     364             :         void                impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const;
     365             :     };
     366             : }
     367             : #endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPDETAILVIEW_HXX
     368             : 
     369             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10