LCOV - code coverage report
Current view: top level - dbaccess/source/ui/tabledesign - TEditControl.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 11 0.0 %
Date: 2014-04-14 Functions: 0 7 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             :         OSQLNameEdit*               pNameCell;
      50             :         ::svt::ListBoxControl*      pTypeCell;
      51             :         Edit*                       pHelpTextCell;
      52             :         Edit*                       pDescrCell;
      53             :         OTableFieldDescWin*         pDescrWin;          // properties of one column
      54             : 
      55             :          ::boost::shared_ptr<OTableRow> pActRow;
      56             : 
      57             :         sal_uLong                       nIndexEvent;
      58             :         sal_uLong                       nCutEvent;
      59             :         sal_uLong                       nPasteEvent;
      60             :         sal_uLong                       nDeleteEvent;
      61             :         sal_uLong                       nInsNewRowsEvent;
      62             :         sal_uLong                       nInvalidateTypeEvent;
      63             :         ChildFocusState             m_eChildFocus;
      64             : 
      65             :         long nOldDataPos;
      66             : 
      67             :         sal_Bool bSaveOnMove;
      68             :         sal_Bool bReadOnly;
      69             : 
      70             :         // helper class
      71             :         class ClipboardInvalidator
      72             :         {
      73             :         private:
      74             :             AutoTimer m_aInvalidateTimer;
      75             :             OTableEditorCtrl* m_pOwner;
      76             : 
      77             :         public:
      78             :             ClipboardInvalidator(sal_uLong nTimeout,OTableEditorCtrl*);
      79             :             ~ClipboardInvalidator();
      80             : 
      81             :         protected:
      82             :             DECL_LINK(OnInvalidate, 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 void Undo();
     105             :         virtual void Redo();
     106             :         virtual OUString GetCellText(long nRow, sal_uInt16 nColId) const SAL_OVERRIDE;
     107             :         virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) SAL_OVERRIDE;
     108             : 
     109             :         virtual void CopyRows() SAL_OVERRIDE;
     110             :         virtual void InsertRows( long nRow ) SAL_OVERRIDE;
     111             :         virtual void DeleteRows() SAL_OVERRIDE;
     112             :         virtual void InsertNewRows( long nRow ) SAL_OVERRIDE;
     113             : 
     114             :         virtual sal_Bool IsPrimaryKeyAllowed( long nRow ) SAL_OVERRIDE;
     115             :         virtual sal_Bool IsInsertNewAllowed( long nRow ) SAL_OVERRIDE;
     116             :         virtual sal_Bool IsDeleteAllowed( long nRow ) SAL_OVERRIDE;
     117             : 
     118             :         void ClearModified();
     119             : 
     120             :         void SetPrimaryKey( sal_Bool bSet );
     121             :         sal_Bool IsPrimaryKey();
     122             : 
     123             :         DECL_LINK(ControlPreNotifyHdl, NotifyEvent*);
     124             : 
     125             :     public:
     126             :         OTableEditorCtrl(Window* pParentWin);
     127             :         virtual ~OTableEditorCtrl();
     128             :         virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) SAL_OVERRIDE;
     129             :         virtual void UpdateAll();
     130             :         SfxUndoManager& GetUndoManager() const;
     131             : 
     132           0 :         void SetDescrWin( OTableFieldDescWin* pWin )
     133             :         {
     134           0 :             pDescrWin = pWin;
     135           0 :             if (pDescrWin && pActRow)
     136           0 :                 pDescrWin->DisplayData(pActRow->GetActFieldDescr());
     137           0 :         }
     138             :         sal_Bool SaveCurRow();
     139             :         void SwitchType( const TOTypeInfoSP& _pType );
     140             : 
     141             :         /// force displaying of the given row
     142             :         void DisplayData( long nRow, sal_Bool bGrabFocus = sal_True );
     143             : 
     144             :         virtual void SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) SAL_OVERRIDE;
     145             :         virtual void SetCellData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rSaveData ) SAL_OVERRIDE;
     146             :         virtual ::com::sun::star::uno::Any  GetCellData( long nRow, sal_uInt16 nColId ) SAL_OVERRIDE;
     147             :         virtual void SetControlText( long nRow, sal_uInt16 nColId, const OUString& rText ) SAL_OVERRIDE;
     148             :         virtual OUString GetControlText( long nRow, sal_uInt16 nColId ) SAL_OVERRIDE;
     149             : 
     150             :         virtual OTableDesignView* GetView() const SAL_OVERRIDE;
     151             : 
     152           0 :         ::std::vector< ::boost::shared_ptr<OTableRow> >* GetRowList(){ return m_pRowList; }
     153             : 
     154           0 :         ::boost::shared_ptr<OTableRow>         GetActRow(){ return pActRow; }
     155             :         void CellModified( long nRow, sal_uInt16 nColId );
     156             :         void SetReadOnly( sal_Bool bRead=sal_True );
     157             : 
     158             :         virtual void Init() SAL_OVERRIDE;
     159             :         virtual void DeactivateCell(bool bUpdate = true) SAL_OVERRIDE;
     160             : 
     161             :         sal_Bool IsCutAllowed( long nRow = -1 );
     162             :         sal_Bool IsCopyAllowed( long nRow = -1 );
     163             :         sal_Bool IsPasteAllowed( long nRow = -1 );
     164             :         sal_Bool IsReadOnly();
     165             :         OFieldDescription* GetFieldDescr( long nRow );
     166             : 
     167             :         // window overloads
     168             :         virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     169             : 
     170             :         // IClipboardTest
     171           0 :         virtual sal_Bool isCutAllowed() SAL_OVERRIDE { return IsCutAllowed(); }
     172           0 :         virtual sal_Bool isCopyAllowed() SAL_OVERRIDE { return IsCopyAllowed(); }
     173           0 :         virtual sal_Bool isPasteAllowed() SAL_OVERRIDE { return IsPasteAllowed(); }
     174           0 :         virtual sal_Bool hasChildPathFocus() SAL_OVERRIDE { return HasChildPathFocus(); }
     175             : 
     176             :         virtual void cut() SAL_OVERRIDE;
     177             :         virtual void copy() SAL_OVERRIDE;
     178             :         virtual void paste() SAL_OVERRIDE;
     179             : 
     180             :     private:
     181             :         DECL_LINK( StartIndexing, void* );
     182             :         DECL_LINK( DelayedCut, void* );
     183             :         DECL_LINK( DelayedPaste, void* );
     184             :         DECL_LINK( DelayedDelete, void* );
     185             :         DECL_LINK( DelayedInsNewRows, void* );
     186             :         DECL_LINK( InvalidateFieldType, void* );
     187             : 
     188             :         void InitCellController();
     189             :         sal_Int32 HasFieldName( const OUString& rFieldName );
     190             :         OUString GenerateName( const OUString& rName );
     191             :         sal_Bool SetDataPtr( long nRow );
     192             : 
     193             :         sal_Bool SaveData(long nRow, sal_uInt16 nColumnId);
     194             :         /** AdjustFieldDescription set the needed values for the description
     195             :             @param  _pFieldDesc     the field description where to set the values
     196             :             @param  _rMultiSel      contains the postions which changed for undo/redo
     197             :             @param  _nPos           the current position
     198             :             @param  _bSet           should a key be set
     199             :             @param  _bPrimaryKey    which value should the pkey have
     200             :         */
     201             :         void AdjustFieldDescription( OFieldDescription* _pFieldDesc,
     202             :                                      MultiSelection& _rMultiSel,
     203             :                                      sal_Int32 _nPos,
     204             :                                      sal_Bool _bSet,
     205             :                                      sal_Bool _bPrimaryKey);
     206             :         /** InvalidateFeatures invalidates the slots SID_UNDO | SID_REDO | SID_SAVEDOC
     207             :         */
     208             :         void InvalidateFeatures();
     209             : 
     210             :         void resetType();
     211             :     };
     212             : }
     213             : #endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TEDITCONTROL_HXX
     214             : 
     215             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10