LCOV - code coverage report
Current view: top level - dbaccess/source/ui/tabledesign - TEditControl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 12 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 8 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_TABLEDESIGN_TEDITCONTROL_HXX
      20             : #define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TEDITCONTROL_HXX
      21             : 
      22             : #include "TableDesignControl.hxx"
      23             : #include "TableDesignView.hxx"
      24             : #include "TableFieldDescWin.hxx"
      25             : #include "TableRow.hxx"
      26             : #include "QEnumTypes.hxx"
      27             : #include "TypeInfo.hxx"
      28             : 
      29             : class Edit;
      30             : class SfxUndoManager;
      31             : namespace dbaui
      32             : {
      33             :     class OSQLNameEdit;
      34             : 
      35             :     class OTableEditorCtrl : public OTableRowView
      36             :     {
      37             :         enum ChildFocusState
      38             :         {
      39             :             HELPTEXT,
      40             :             DESCRIPTION,
      41             :             NAME,
      42             :             ROW,
      43             :             NONE
      44             :         };
      45             : 
      46             :         ::std::vector< ::boost::shared_ptr<OTableRow> > m_aUndoList;
      47             :         ::std::vector< ::boost::shared_ptr<OTableRow> >*    m_pRowList;
      48             : 
      49             :         VclPtr<OSQLNameEdit>               pNameCell;
      50             :         VclPtr< ::svt::ListBoxControl>      pTypeCell;
      51             :         VclPtr<Edit>                       pHelpTextCell;
      52             :         VclPtr<Edit>                       pDescrCell;
      53             :         VclPtr<OTableFieldDescWin>         pDescrWin;          // properties of one column
      54             : 
      55             :          ::boost::shared_ptr<OTableRow> pActRow;
      56             : 
      57             :         ImplSVEvent *               nCutEvent;
      58             :         ImplSVEvent *               nPasteEvent;
      59             :         ImplSVEvent *               nDeleteEvent;
      60             :         ImplSVEvent *               nInsNewRowsEvent;
      61             :         ImplSVEvent *               nInvalidateTypeEvent;
      62             :         ChildFocusState             m_eChildFocus;
      63             : 
      64             :         long nOldDataPos;
      65             : 
      66             :         bool bSaveOnMove;
      67             :         bool bReadOnly;
      68             : 
      69             :         // helper class
      70             :         class ClipboardInvalidator
      71             :         {
      72             :         private:
      73             :             AutoTimer m_aInvalidateTimer;
      74             :             VclPtr<OTableEditorCtrl> m_pOwner;
      75             : 
      76             :         public:
      77             :             ClipboardInvalidator(sal_uLong nTimeout,OTableEditorCtrl*);
      78             :             ~ClipboardInvalidator();
      79             :             void Stop();
      80             : 
      81             :         protected:
      82             :             DECL_LINK_TYPED(OnInvalidate, Timer*, void);
      83             :         };
      84             : 
      85             :         friend class OTableEditorCtrl::ClipboardInvalidator;
      86             : 
      87             :         ClipboardInvalidator m_aInvalidate;
      88             : 
      89             :     protected:
      90             :         virtual void Command( const CommandEvent& rEvt ) SAL_OVERRIDE;
      91             :         virtual bool SeekRow(long nRow) SAL_OVERRIDE;
      92             :         virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect,
      93             :                                sal_uInt16 nColumnId ) const SAL_OVERRIDE;
      94             : 
      95             :         virtual void CursorMoved() SAL_OVERRIDE;
      96             :         virtual RowStatus GetRowStatus(long nRow) const SAL_OVERRIDE;
      97             : 
      98             :         virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) SAL_OVERRIDE;
      99             :         virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol) SAL_OVERRIDE;
     100             : 
     101             :         virtual void CellModified() SAL_OVERRIDE;
     102             :         virtual bool SaveModified() SAL_OVERRIDE; // is called before changing a cell (false prevents change)
     103             : 
     104             :         virtual OUString GetCellText(long nRow, sal_uInt16 nColId) const SAL_OVERRIDE;
     105             :         virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) SAL_OVERRIDE;
     106             : 
     107             :         virtual void CopyRows() SAL_OVERRIDE;
     108             :         virtual void InsertRows( long nRow ) SAL_OVERRIDE;
     109             :         virtual void DeleteRows() SAL_OVERRIDE;
     110             :         virtual void InsertNewRows( long nRow ) SAL_OVERRIDE;
     111             : 
     112             :         virtual bool IsPrimaryKeyAllowed( long nRow ) SAL_OVERRIDE;
     113             :         virtual bool IsInsertNewAllowed( long nRow ) SAL_OVERRIDE;
     114             :         virtual bool IsDeleteAllowed( long nRow ) SAL_OVERRIDE;
     115             : 
     116             :         void ClearModified();
     117             : 
     118             :         void SetPrimaryKey( bool bSet );
     119             :         bool IsPrimaryKey();
     120             : 
     121             :         DECL_LINK(ControlPreNotifyHdl, NotifyEvent*);
     122             : 
     123             :     public:
     124             :         OTableEditorCtrl(vcl::Window* pParentWin);
     125             :         virtual ~OTableEditorCtrl();
     126             :         virtual void dispose() SAL_OVERRIDE;
     127             :         virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) SAL_OVERRIDE;
     128             :         SfxUndoManager& GetUndoManager() const;
     129             : 
     130           0 :         void SetDescrWin( OTableFieldDescWin* pWin )
     131             :         {
     132           0 :             pDescrWin = pWin;
     133           0 :             if (pDescrWin && pActRow)
     134           0 :                 pDescrWin->DisplayData(pActRow->GetActFieldDescr());
     135           0 :         }
     136             :         bool SaveCurRow();
     137             :         void SwitchType( const TOTypeInfoSP& _pType );
     138             : 
     139             :         /// force displaying of the given row
     140             :         void DisplayData( long nRow, bool bGrabFocus = true );
     141             : 
     142             :         virtual void SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) SAL_OVERRIDE;
     143             :         virtual void SetCellData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rSaveData ) SAL_OVERRIDE;
     144             :         virtual ::com::sun::star::uno::Any  GetCellData( long nRow, sal_uInt16 nColId ) SAL_OVERRIDE;
     145             :         virtual void SetControlText( long nRow, sal_uInt16 nColId, const OUString& rText ) SAL_OVERRIDE;
     146             :         virtual OUString GetControlText( long nRow, sal_uInt16 nColId ) SAL_OVERRIDE;
     147             : 
     148             :         virtual OTableDesignView* GetView() const SAL_OVERRIDE;
     149             : 
     150           0 :         ::std::vector< ::boost::shared_ptr<OTableRow> >* GetRowList(){ return m_pRowList; }
     151             : 
     152           0 :         ::boost::shared_ptr<OTableRow>         GetActRow(){ return pActRow; }
     153             :         void CellModified( long nRow, sal_uInt16 nColId );
     154             :         void SetReadOnly( bool bRead=true );
     155             : 
     156             :         virtual void Init() SAL_OVERRIDE;
     157             :         virtual void DeactivateCell(bool bUpdate = true) SAL_OVERRIDE;
     158             : 
     159             :         bool IsCutAllowed( long nRow = -1 );
     160             :         bool IsCopyAllowed( long nRow = -1 );
     161             :         bool IsPasteAllowed( long nRow = -1 );
     162           0 :         bool IsReadOnly() { return bReadOnly;}
     163             :         OFieldDescription* GetFieldDescr( long nRow );
     164             : 
     165             :         // Window overrides
     166             :         virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     167             : 
     168             :         // IClipboardTest
     169           0 :         virtual bool isCutAllowed() SAL_OVERRIDE { return IsCutAllowed(); }
     170           0 :         virtual bool isCopyAllowed() SAL_OVERRIDE { return IsCopyAllowed(); }
     171           0 :         virtual bool isPasteAllowed() SAL_OVERRIDE { return IsPasteAllowed(); }
     172           0 :         virtual bool hasChildPathFocus() SAL_OVERRIDE { return HasChildPathFocus(); }
     173             : 
     174             :         virtual void cut() SAL_OVERRIDE;
     175             :         virtual void copy() SAL_OVERRIDE;
     176             :         virtual void paste() SAL_OVERRIDE;
     177             : 
     178             :     private:
     179             :         DECL_LINK( StartIndexing, void* );
     180             :         DECL_LINK( DelayedCut, void* );
     181             :         DECL_LINK( DelayedPaste, void* );
     182             :         DECL_LINK( DelayedDelete, void* );
     183             :         DECL_LINK( DelayedInsNewRows, void* );
     184             :         DECL_LINK( InvalidateFieldType, void* );
     185             : 
     186             :         void InitCellController();
     187             :         sal_Int32 HasFieldName( const OUString& rFieldName );
     188             :         OUString GenerateName( const OUString& rName );
     189             :         bool SetDataPtr( long nRow );
     190             : 
     191             :         bool SaveData(long nRow, sal_uInt16 nColumnId);
     192             :         /** AdjustFieldDescription set the needed values for the description
     193             :             @param  _pFieldDesc     the field description where to set the values
     194             :             @param  _rMultiSel      contains the positions which changed for undo/redo
     195             :             @param  _nPos           the current position
     196             :             @param  _bSet           should a key be set
     197             :             @param  _bPrimaryKey    which value should the pkey have
     198             :         */
     199             :         void AdjustFieldDescription( OFieldDescription* _pFieldDesc,
     200             :                                      MultiSelection& _rMultiSel,
     201             :                                      sal_Int32 _nPos,
     202             :                                      bool _bSet,
     203             :                                      bool _bPrimaryKey);
     204             :         /** InvalidateFeatures invalidates the slots SID_UNDO | SID_REDO | SID_SAVEDOC
     205             :         */
     206             :         void InvalidateFeatures();
     207             : 
     208             :         void resetType();
     209             :     };
     210             : }
     211             : #endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TEDITCONTROL_HXX
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11