xref: /trunk/main/dbaccess/source/ui/inc/TableDesignControl.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef DBAUI_TABLEDESIGNCONTROL_HXX
28 #define DBAUI_TABLEDESIGNCONTROL_HXX
29 
30 #ifndef _TABBAR_HXX //autogen
31 #include <svtools/tabbar.hxx>
32 #endif
33 #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_
34 #include <svtools/editbrowsebox.hxx>
35 #endif
36 
37 #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX
38 #include "IClipBoardTest.hxx"
39 #endif
40 #ifndef DBAUI_TYPEINFO_HXX
41 #include "TypeInfo.hxx"
42 #endif
43 
44 #define TABPAGESIZE 70
45 namespace dbaui
46 {
47     class OTableDesignView;
48     class OTypeInfo;
49     //==================================================================
50     class OTableRowView : public ::svt::EditBrowseBox
51                         ,public IClipboardTest
52     {
53         friend class OTableDesignUndoAct;
54 
55     protected:
56         long    m_nDataPos;             // derzeit benoetigte Zeile
57         long    m_nCurrentPos;          // Aktuelle Position der ausgewaehlten Column
58     private:
59         sal_uInt16  m_nCurUndoActId;
60     protected:
61         sal_Bool    m_bCurrentModified;
62         sal_Bool    m_bUpdatable;
63         sal_Bool    m_bClipboardFilled;
64 
65     public:
66         OTableRowView(Window* pParent);
67         virtual ~OTableRowView();
68 
69         virtual void                SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) = 0;
70         virtual void                SetCellData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rNewData ) = 0;
71         virtual ::com::sun::star::uno::Any          GetCellData( long nRow, sal_uInt16 nColId ) = 0;
72         virtual void                SetControlText( long nRow, sal_uInt16 nColId, const String& rText ) = 0;
73         virtual String              GetControlText( long nRow, sal_uInt16 nColId ) = 0;
74 
75         virtual OTableDesignView* GetView() const = 0;
76 
77         sal_uInt16  GetCurUndoActId(){ return m_nCurUndoActId; }
78 
79         // IClipboardTest
80         virtual void cut();
81         virtual void copy();
82         virtual void paste();
83 
84     protected:
85         void Paste( long nRow );
86 
87         virtual void CopyRows()                             = 0;
88         virtual void DeleteRows()                           = 0;
89         virtual void InsertRows( long nRow )                = 0;
90         virtual void InsertNewRows( long nRow )             = 0;
91 
92         virtual sal_Bool IsPrimaryKeyAllowed( long nRow )   = 0;
93         virtual sal_Bool IsInsertNewAllowed( long nRow )    = 0;
94         virtual sal_Bool IsDeleteAllowed( long nRow )       = 0;
95 
96         virtual sal_Bool IsUpdatable() const {return m_bUpdatable;}
97         virtual void SetUpdatable( sal_Bool bUpdate=sal_True );
98 
99         virtual RowStatus GetRowStatus(long nRow) const;
100         virtual void KeyInput(const KeyEvent& rEvt);
101         virtual void Command( const CommandEvent& rEvt );
102 
103         virtual void Init();
104     };
105 }
106 #endif // DBAUI_TABLEDESIGNCONTROL_HXX
107 
108 
109