LCOV - code coverage report
Current view: top level - dbaccess/source/ui/inc - indexdialog.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 6 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 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             : 
      20             : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
      22             : 
      23             : #include <vcl/dialog.hxx>
      24             : #include <vcl/fixed.hxx>
      25             : #include <vcl/lstbox.hxx>
      26             : #include <vcl/button.hxx>
      27             : #include <com/sun/star/container/XNameAccess.hpp>
      28             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29             : #include <com/sun/star/sdbc/XConnection.hpp>
      30             : #include <com/sun/star/uno/Sequence.hxx>
      31             : #include <com/sun/star/uno/XComponentContext.hpp>
      32             : #include <vcl/toolbox.hxx>
      33             : #include <svtools/treelistbox.hxx>
      34             : #include <unotools/viewoptions.hxx>
      35             : #include "indexes.hxx"
      36             : #include <dbaccess/ToolBoxHelper.hxx>
      37             : 
      38             : namespace dbaui
      39             : {
      40             : 
      41             :     // DbaIndexList
      42           0 :     class DbaIndexList : public SvTreeListBox
      43             :     {
      44             :     protected:
      45             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
      46             :         Link<>      m_aSelectHdl;
      47             :         Link<>      m_aEndEditHdl;
      48             :         bool    m_bSuspendSelectHdl;
      49             : 
      50             :     public:
      51             :         DbaIndexList(vcl::Window* _pParent, WinBits nWinBits);
      52             : 
      53           0 :         void SetSelectHdl(const Link<>& _rHdl) { m_aSelectHdl = _rHdl; }
      54             :         Link<> GetSelectHdl() const { return m_aSelectHdl; }
      55             : 
      56           0 :         void SetEndEditHdl(const Link<>& _rHdl) { m_aEndEditHdl = _rHdl; }
      57             :         Link<> GetEndEditHdl() const { return m_aEndEditHdl; }
      58             : 
      59             :         virtual bool Select(SvTreeListEntry* pEntry, bool bSelect) SAL_OVERRIDE;
      60             : 
      61             :         void enableSelectHandler();
      62             :         void disableSelectHandler();
      63             : 
      64             :         void SelectNoHandlerCall( SvTreeListEntry* pEntry );
      65             : 
      66           0 :         inline void setConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection)
      67             :         {
      68           0 :              m_xConnection = _rxConnection;
      69           0 :         }
      70             : 
      71             :     protected:
      72             :         virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) SAL_OVERRIDE;
      73             : 
      74             :     private:
      75             :         using SvTreeListBox::Select;
      76             :     };
      77             : 
      78             :     // DbaIndexDialog
      79             :     class IndexFieldsControl;
      80             :     class OIndexCollection;
      81             :     class DbaIndexDialog :  public ModalDialog,
      82             :                             public OToolBoxHelper
      83             :     {
      84             :     protected:
      85             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
      86             :         SvtViewOptions          m_aGeometrySettings;
      87             : 
      88             :         VclPtr<ToolBox>                 m_pActions;
      89             :         VclPtr<DbaIndexList>            m_pIndexList;
      90             :         VclPtr<FixedText>               m_pIndexDetails;
      91             :         VclPtr<FixedText>               m_pDescriptionLabel;
      92             :         VclPtr<FixedText>               m_pDescription;
      93             :         VclPtr<CheckBox>                m_pUnique;
      94             :         VclPtr<FixedText>               m_pFieldsLabel;
      95             :         VclPtr<IndexFieldsControl>      m_pFields;
      96             :         VclPtr<PushButton>              m_pClose;
      97             : 
      98             :         OIndexCollection*       m_pIndexes;
      99             :         SvTreeListEntry*            m_pPreviousSelection;
     100             :         bool                m_bEditAgain;
     101             : 
     102             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
     103             :                                 m_xContext;
     104             :     public:
     105             :         DbaIndexDialog(
     106             :             vcl::Window* _pParent,
     107             :             const ::com::sun::star::uno::Sequence< OUString >& _rFieldNames,
     108             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxIndexes,
     109             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     110             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
     111             :             sal_Int32 _nMaxColumnsInIndex
     112             :             );
     113             :         virtual ~DbaIndexDialog();
     114             :         virtual void dispose() SAL_OVERRIDE;
     115             : 
     116             :         virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     117             :         virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     118             : 
     119             :         //TO-DO, remove when all other OToolBoxHelper are converted to .ui
     120             :         virtual void resizeControls(const Size&) SAL_OVERRIDE;
     121             : 
     122             :         /** will be called when the id of the image list needs to change
     123             :             @param  _eBitmapSet
     124             :                 <svtools/imgdef.hxx>
     125             :         */
     126             :         virtual void setImageList(sal_Int16 _eBitmapSet) SAL_OVERRIDE;
     127             :     protected:
     128             :         void fillIndexList();
     129             :         void updateToolbox();
     130             :         void updateControls(const SvTreeListEntry* _pEntry);
     131             : 
     132             :     protected:
     133             :         DECL_LINK( OnIndexSelected, DbaIndexList* );
     134             :         DECL_LINK_TYPED( OnIndexAction, ToolBox*, void );
     135             :         DECL_LINK( OnEntryEdited, SvTreeListEntry* );
     136             :         DECL_LINK( OnModified, void* );
     137             :         DECL_LINK( OnCloseDialog, void* );
     138             : 
     139             :         DECL_LINK( OnEditIndexAgain, SvTreeListEntry* );
     140             : 
     141             :     private:
     142             :         sal_uInt16 mnNewCmdId;
     143             :         sal_uInt16 mnDropCmdId;
     144             :         sal_uInt16 mnRenameCmdId;
     145             :         sal_uInt16 mnSaveCmdId;
     146             :         sal_uInt16 mnResetCmdId;
     147             : 
     148             :         Image maScNewCmdImg;
     149             :         Image maScDropCmdImg;
     150             :         Image maScRenameCmdImg;
     151             :         Image maScSaveCmdImg;
     152             :         Image maScResetCmdImg;
     153             :         Image maLcNewCmdImg;
     154             :         Image maLcDropCmdImg;
     155             :         Image maLcRenameCmdImg;
     156             :         Image maLcSaveCmdImg;
     157             :         Image maLcResetCmdImg;
     158             : 
     159             :         void OnNewIndex();
     160             :         void OnDropIndex(bool _bConfirm = true);
     161             :         void OnRenameIndex();
     162             :         void OnSaveIndex();
     163             :         void OnResetIndex();
     164             : 
     165             :         bool implCommit(SvTreeListEntry* _pEntry);
     166             :         bool implSaveModified(bool _bPlausibility = true);
     167             :         bool implCommitPreviouslySelected();
     168             : 
     169             :         bool implDropIndex(SvTreeListEntry* _pEntry, bool _bRemoveFromCollection);
     170             : 
     171             :         bool implCheckPlausibility(const Indexes::const_iterator& _rPos);
     172             : 
     173             :         /** checks if the controls have to be replaced and moved.
     174             :         */
     175             :         void checkControls();
     176             :     };
     177             : 
     178             : }   // namespace dbaui
     179             : 
     180             : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
     181             : 
     182             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11