LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/tabledesign - TEditControl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2012-12-27 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 DBAUI_TABLEEDITORCONTROL_HXX
      20             : #define DBAUI_TABLEEDITORCONTROL_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             :         // Hilfsklasse
      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             :         friend class OTableEditorCtrl::ClipboardInvalidator;
      85             : 
      86             :         ClipboardInvalidator    m_aInvalidate;
      87             : 
      88             :     protected:
      89             :         virtual void Command( const CommandEvent& rEvt );
      90             :         virtual sal_Bool SeekRow(long nRow);
      91             :         virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect,
      92             :                                sal_uInt16 nColumnId ) const;
      93             : 
      94             :         virtual void CursorMoved();
      95             :         virtual RowStatus GetRowStatus(long nRow) const;
      96             : 
      97             :         virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol);
      98             :         virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol);
      99             : 
     100             :         virtual void CellModified();
     101             :         virtual sal_Bool SaveModified();    // wird aufgerufen vor einem Zellenwechsel
     102             :                                         // return sal_False, verhindert Zellenwechsel
     103             :         virtual void Undo();
     104             :         virtual void Redo();
     105             :         virtual String GetCellText(long nRow, sal_uInt16 nColId) const;
     106             :         virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
     107             : 
     108             :         virtual void CopyRows();
     109             :         virtual void InsertRows( long nRow );
     110             :         virtual void DeleteRows();
     111             :         virtual void InsertNewRows( long nRow );
     112             : 
     113             :         virtual sal_Bool IsPrimaryKeyAllowed( long nRow );
     114             :         virtual sal_Bool IsInsertNewAllowed( long nRow );
     115             :         virtual sal_Bool IsDeleteAllowed( long nRow );
     116             : 
     117             :         void         ClearModified();
     118             : 
     119             :         void         SetPrimaryKey( sal_Bool bSet );
     120             :         sal_Bool         IsPrimaryKey();
     121             : 
     122             :         DECL_LINK(ControlPreNotifyHdl, NotifyEvent*);
     123             : 
     124             :     public:
     125             :         //  TYPEINFO();
     126             :         OTableEditorCtrl(Window* pParentWin);
     127             :         virtual         ~OTableEditorCtrl();
     128             :         virtual sal_Bool    CursorMoving(long nNewRow, sal_uInt16 nNewCol);
     129             :         virtual void    UpdateAll();
     130             :         SfxUndoManager& GetUndoManager() const;
     131             : 
     132           0 :         void            SetDescrWin( OTableFieldDescWin* pWin ){ pDescrWin = pWin; if (pDescrWin && pActRow) pDescrWin->DisplayData(pActRow->GetActFieldDescr()); }
     133             :         sal_Bool            SaveCurRow();
     134             :         void            SwitchType( const TOTypeInfoSP& _pType );
     135             : 
     136             :         void            DisplayData( long nRow, sal_Bool bGrabFocus = sal_True );
     137             :             // erzwingt das Anzeigen der genannten Zeile (selbst wenn es eigentlich schon die aktuelle ist)
     138             : 
     139             :         virtual void    SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo );
     140             :         virtual void    SetCellData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rSaveData );
     141             :         virtual ::com::sun::star::uno::Any  GetCellData( long nRow, sal_uInt16 nColId );
     142             :         virtual void    SetControlText( long nRow, sal_uInt16 nColId, const String& rText );
     143             :         virtual String  GetControlText( long nRow, sal_uInt16 nColId );
     144             : 
     145             :         virtual OTableDesignView* GetView() const;
     146             : 
     147           0 :         ::std::vector< ::boost::shared_ptr<OTableRow> >* GetRowList(){ return m_pRowList; }
     148             : 
     149           0 :         ::boost::shared_ptr<OTableRow>         GetActRow(){ return pActRow; }
     150             :         void            CellModified( long nRow, sal_uInt16 nColId );
     151             :         void            SetReadOnly( sal_Bool bRead=sal_True );
     152             : 
     153             :         virtual void Init();
     154             :         virtual void DeactivateCell(sal_Bool bUpdate = sal_True);
     155             : 
     156             :         sal_Bool IsCutAllowed( long nRow = -1 );
     157             :         sal_Bool IsCopyAllowed( long nRow = -1 );
     158             :         sal_Bool IsPasteAllowed( long nRow = -1 );
     159             :         sal_Bool IsReadOnly();
     160             :         OFieldDescription* GetFieldDescr( long nRow );
     161             : 
     162             :         // window overloads
     163             :         virtual long            PreNotify( NotifyEvent& rNEvt );
     164             : 
     165             :         // IClipboardTest
     166           0 :         virtual sal_Bool isCutAllowed() { return IsCutAllowed(); }
     167           0 :         virtual sal_Bool isCopyAllowed() { return IsCopyAllowed(); }
     168           0 :         virtual sal_Bool isPasteAllowed() { return IsPasteAllowed(); }
     169           0 :         virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
     170             : 
     171             :         virtual void cut();
     172             :         virtual void copy();
     173             :         virtual void paste();
     174             :     private:
     175             :         DECL_LINK( StartIndexing, void* );
     176             :         DECL_LINK( DelayedCut, void* );
     177             :         DECL_LINK( DelayedPaste, void* );
     178             :         DECL_LINK( DelayedDelete, void* );
     179             :         DECL_LINK( DelayedInsNewRows, void* );
     180             :         DECL_LINK( InvalidateFieldType, void* );
     181             : 
     182             :         void InitCellController();
     183             :         sal_Int32 HasFieldName( const String& rFieldName );
     184             :         String GenerateName( const String& rName );
     185             :         sal_Bool SetDataPtr( long nRow );
     186             : 
     187             :         sal_Bool SaveData(long nRow, sal_uInt16 nColumnId);
     188             :         /** AdjustFieldDescription set the needed values for the description
     189             :             @param  _pFieldDesc     the field description where to set the values
     190             :             @param  _rMultiSel      contains the postions which changed for undo/redo
     191             :             @param  _nPos           the current position
     192             :             @param  _bSet           should a key be set
     193             :             @param  _bPrimaryKey    which value should the pkey have
     194             :         */
     195             :         void AdjustFieldDescription( OFieldDescription* _pFieldDesc,
     196             :                                      MultiSelection& _rMultiSel,
     197             :                                      sal_Int32 _nPos,
     198             :                                      sal_Bool _bSet,
     199             :                                      sal_Bool _bPrimaryKey);
     200             :         /** InvalidateFeatures invalidates the slots SID_UNDO | SID_REDO | SID_SAVEDOC
     201             :         */
     202             :         void InvalidateFeatures();
     203             : 
     204             :         void resetType();
     205             :     };
     206             : }
     207             : #endif // DBAUI_TABLEEDITORCONTROL_HXX
     208             : 
     209             : 
     210             : 
     211             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10