LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/app - AppView.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 4 0.0 %
Date: 2012-12-27 Functions: 0 4 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_APPVIEW_HXX
      20             : #define DBAUI_APPVIEW_HXX
      21             : 
      22             : #include "dataview.hxx"
      23             : #include <com/sun/star/container/XNameAccess.hpp>
      24             : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
      25             : #include <com/sun/star/ucb/XContent.hpp>
      26             : #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
      27             : #include <vcl/fixed.hxx>
      28             : #include <unotools/eventlisteneradapter.hxx>
      29             : #include "IClipBoardTest.hxx"
      30             : #include "AppElementType.hxx"
      31             : 
      32             : namespace com{ namespace sun { namespace star { namespace beans    { class XPropertySet; } } } }
      33             : 
      34             : class Control;
      35             : class SvTreeListEntry;
      36             : class MnemonicGenerator;
      37             : 
      38             : namespace dbaui
      39             : {
      40             :     class IApplicationController;
      41             :     class OApplicationView;
      42             :     class OApplicationDetailView;
      43             :     class OApplicationSwapWindow;
      44             :     class OTitleWindow;
      45             :     //==================================================================
      46             :     class OAppBorderWindow : public Window
      47             :     {
      48             :         OTitleWindow*                       m_pPanel;
      49             :         OApplicationDetailView*             m_pDetailView;
      50             :         OApplicationView*                   m_pView;
      51             : 
      52             :         void ImplInitSettings();
      53             :     protected:
      54             :         // Window
      55             :         virtual void DataChanged( const DataChangedEvent& rDCEvt );
      56             :     public:
      57             :         OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
      58             :         virtual ~OAppBorderWindow();
      59             : 
      60             :         // window overloads
      61             :         virtual void GetFocus();
      62             :         virtual void Resize();
      63             : 
      64             :         OApplicationView*       getView() const;
      65             :         OApplicationSwapWindow* getPanel() const;
      66             :         OApplicationDetailView* getDetailView() const;
      67             :     };
      68             : 
      69             :     //==================================================================
      70             :     class OApplicationView : public ODataView
      71             :                             ,public IClipboardTest
      72             :                             ,public ::utl::OEventListenerAdapter
      73             :     {
      74             :         enum ChildFocusState
      75             :         {
      76             :             PANELSWAP,
      77             :             DETAIL,
      78             :             NONE
      79             :         };
      80             :     private:
      81             :         ::com::sun::star::lang::Locale      m_aLocale;
      82             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
      83             :                                             m_xObject;
      84             :         OAppBorderWindow*                   m_pWin;
      85             :         IApplicationController&             m_rAppController;
      86             :         ChildFocusState                     m_eChildFocus;
      87             : 
      88             :         IClipboardTest* getActiveChild() const;
      89             : 
      90             :         void ImplInitSettings();
      91             :     protected:
      92             : 
      93             : 
      94             :         // return the Rectangle where I can paint myself
      95             :         virtual void resizeDocumentView(Rectangle& rRect);
      96             : 
      97             :         // OEventListenerAdapter
      98             :         virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
      99             : 
     100             :         // Window
     101             :         virtual void DataChanged( const DataChangedEvent& rDCEvt );
     102             :     public:
     103             :         OApplicationView(   Window* pParent
     104             :                             ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
     105             :                             ,IApplicationController&            _rAppController
     106             :                             ,PreviewMode _ePreviewMode
     107             :                             );
     108             :         virtual ~OApplicationView();
     109             : 
     110             :         /// automatically creates mnemonics for the icon/texts in our left hand side panel
     111             :         void    createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
     112             : 
     113             :         /// automatically creates mnemonics for the texts in our task pane
     114             :         void    setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
     115             : 
     116             :         // window overloads
     117             :         virtual long PreNotify( NotifyEvent& rNEvt );
     118             :         virtual void GetFocus();
     119             : 
     120           0 :         inline IApplicationController&                  getAppController() const { return m_rAppController; }
     121             :         inline const ::com::sun::star::lang::Locale&    getLocale() const { return m_aLocale;}
     122             : 
     123             :         // IClipboardTest
     124             :         virtual sal_Bool isCutAllowed();
     125             :         virtual sal_Bool isCopyAllowed();
     126             :         virtual sal_Bool isPasteAllowed();
     127           0 :         virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
     128             :         virtual void copy();
     129             :         virtual void cut();
     130             :         virtual void paste();
     131             : 
     132             :         /// get the left panel
     133           0 :         inline OApplicationSwapWindow*  getPanel()      const { return m_pWin->getPanel(); }
     134             :         /// get the detail page
     135           0 :         inline OApplicationDetailView*  getDetailView() const { return m_pWin->getDetailView(); }
     136             : 
     137             :         /** return the qualified name.
     138             :             @param  _pEntry
     139             :                 The entry of a table, or query, form, report to get the qualified name.
     140             :                 If the entry is <NULL/>, the first selected is chosen.
     141             :             @return
     142             :                 the qualified name
     143             :         */
     144             :         ::rtl::OUString getQualifiedName( SvTreeListEntry* _pEntry ) const;
     145             : 
     146             :         /** returns if an entry is a leaf
     147             :             @param _pEntry
     148             :                 The entry to check
     149             :             @return
     150             :                 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
     151             :         */
     152             :         sal_Bool isLeaf(SvTreeListEntry* _pEntry) const;
     153             : 
     154             :         /** returns if one of the selected entries is a leaf
     155             :             @return
     156             :                 <TRUE/> if the entry is a leaf, otherwise <FALSE/>
     157             :         */
     158             :         sal_Bool isALeafSelected() const;
     159             : 
     160             :         /** select all entries in the detail page
     161             :         */
     162             :         void selectAll();
     163             : 
     164             :         /// returns <TRUE/> if it sorts ascending
     165             :         sal_Bool isSortUp() const;
     166             : 
     167             :         /// sort the entries in the detail page down
     168             :         void sortDown();
     169             : 
     170             :         /// sort the entries in the detail page up
     171             :         void sortUp();
     172             : 
     173             :         /// returns <TRUE/> when a detail page was filled
     174             :         sal_Bool isFilled() const;
     175             : 
     176             :         /// return the element of currently select entry
     177             :         ElementType getElementType() const;
     178             : 
     179             :         /// returns the count of entries
     180             :         sal_Int32 getElementCount();
     181             : 
     182             :         /// returns the count of selected entries
     183             :         sal_Int32 getSelectionCount();
     184             : 
     185             :         /** clears the detail page and the selection on the left side.
     186             :             @param  _bTaskAlso
     187             :                 If <TRUE/> the task window will also be cleared.
     188             :         */
     189             :         void clearPages(sal_Bool _bTaskAlso = sal_True);
     190             : 
     191             :         /** returns the element names which are selected
     192             :             @param  _rNames
     193             :                 The list will be filled.
     194             :         */
     195             :         void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
     196             : 
     197             :         /** describes the current selection for the given control
     198             :         */
     199             :         void    describeCurrentSelectionForControl(
     200             :                     const Control& _rControl,
     201             :                     ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
     202             :                 );
     203             : 
     204             :         /** describes the current selection for the given ElementType
     205             :         */
     206             :         void    describeCurrentSelectionForType(
     207             :                     const ElementType _eType,
     208             :                     ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
     209             :                 );
     210             : 
     211             :         /** select all names on the currently selected container. Non existence names where ignored.
     212             :         *
     213             :         * \param _aNames the element names
     214             :         */
     215             :         void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames);
     216             : 
     217             :         /** adds a new object to the detail page.
     218             :             @param  _eType
     219             :                 The type where the entry shold be appended.
     220             :             @param  _rName
     221             :                 The name of the object to be inserted
     222             :             @param  _rObject
     223             :                 The object to add.
     224             :             @param  _rxConn
     225             :                 If we insert a table, the connection must be set.
     226             :         */
     227             :         SvTreeListEntry* elementAdded(ElementType _eType
     228             :                         ,const ::rtl::OUString& _rName
     229             :                         ,const ::com::sun::star::uno::Any& _rObject );
     230             : 
     231             :         /** replaces a objects name with a new one
     232             :             @param  _eType
     233             :                 The type where the entry shold be appended.
     234             :             @param  _rOldName
     235             :                 The old name of the object to be replaced
     236             :             @param  _rNewName
     237             :                 The new name of the object to be replaced
     238             :             @param  _rxConn
     239             :                 If we insert a table, the connection must be set.
     240             :             @param  _xObject
     241             :                 The object which was replaced
     242             :         */
     243             :         void elementReplaced(ElementType eType
     244             :                         ,const ::rtl::OUString& _rOldName
     245             :                         ,const ::rtl::OUString& _rNewName );
     246             : 
     247             :         /** removes an element from the detail page.
     248             :             @param  _eType
     249             :                 The type where the entry shold be appended.
     250             :             @param  _rName
     251             :                 The name of the element to be removed.
     252             :             @param  _rxConn
     253             :                 If we remove a table, the connection must be set.
     254             :         */
     255             :         void elementRemoved(ElementType _eType
     256             :                             ,const ::rtl::OUString& _rName );
     257             : 
     258             : 
     259             :         /** changes the container which should be displayed. The select handler will also be called.
     260             :             @param  _eType
     261             :                 Which container to show.
     262             :         */
     263             :         void selectContainer(ElementType _eType);
     264             : 
     265             :         /// returns the preview mode
     266             :         PreviewMode getPreviewMode();
     267             : 
     268             :         /// <TRUE/> if the preview is enabled
     269             :         sal_Bool isPreviewEnabled();
     270             : 
     271             :         /** switches to the given preview mode
     272             :             @param  _eMode
     273             :                 the mode to set for the preview
     274             :         */
     275             :         void switchPreview(PreviewMode _eMode);
     276             : 
     277             :         /** shows the Preview of the content when it is enabled.
     278             :             @param  _xContent
     279             :                 The content which must support the "preview" command.
     280             :         */
     281             :         void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
     282             : 
     283             :         /** shows the Preview of a table or query
     284             :             @param  _sDataSourceName
     285             :                 the name of the data source
     286             :             @param  _xConnection
     287             :                 the connection which will be shared
     288             :             @param  _sName
     289             :                 the name of table or query
     290             :             @param  _bTable
     291             :                 <TRUE/> if it is a table, otherwise <FALSE/>
     292             :             @return void
     293             :         */
     294             :         void showPreview(   const ::rtl::OUString& _sDataSourceName,
     295             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
     296             :                             const ::rtl::OUString& _sName,
     297             :                             sal_Bool _bTable);
     298             : 
     299             :         SvTreeListEntry* getEntry( const Point& _aPosPixel ) const;
     300             :     };
     301             : }
     302             : #endif // DBAUI_APPVIEW_HXX
     303             : 
     304             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10