xref: /AOO41X/main/dbaccess/source/ui/inc/TableDesignView.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef DBAUI_TABLEDESIGNVIEW_HXX
28*cdf0e10cSrcweir #define DBAUI_TABLEDESIGNVIEW_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #ifndef DBAUI_DATAVIEW_HXX
31*cdf0e10cSrcweir #include "dataview.hxx"
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
34*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
37*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir #ifndef _SV_SPLIT_HXX
40*cdf0e10cSrcweir #include <vcl/split.hxx>
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX
43*cdf0e10cSrcweir #include "IClipBoardTest.hxx"
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir namespace dbaui
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir 	class OTableController;
49*cdf0e10cSrcweir 	class OTableFieldDescWin;
50*cdf0e10cSrcweir 	class OTableEditorCtrl;
51*cdf0e10cSrcweir 	//==================================================================
52*cdf0e10cSrcweir 	class OTableBorderWindow : public Window
53*cdf0e10cSrcweir 	{
54*cdf0e10cSrcweir 		Splitter							m_aHorzSplitter;
55*cdf0e10cSrcweir 		OTableFieldDescWin*					m_pFieldDescWin;
56*cdf0e10cSrcweir 		OTableEditorCtrl*					m_pEditorCtrl;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir 		void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
59*cdf0e10cSrcweir 		void ArrangeChilds( long nSplitPos ,Rectangle& rRect);
60*cdf0e10cSrcweir 		DECL_LINK( SplitHdl, Splitter* );
61*cdf0e10cSrcweir 	protected:
62*cdf0e10cSrcweir 		virtual void DataChanged(const DataChangedEvent& rDCEvt);
63*cdf0e10cSrcweir 	public:
64*cdf0e10cSrcweir 		OTableBorderWindow(Window* pParent);
65*cdf0e10cSrcweir 		~OTableBorderWindow();
66*cdf0e10cSrcweir 		// window overloads
67*cdf0e10cSrcweir 		virtual void Resize();
68*cdf0e10cSrcweir 		virtual void GetFocus();
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 		OTableEditorCtrl*		GetEditorCtrl() const { return m_pEditorCtrl; }
71*cdf0e10cSrcweir 		OTableFieldDescWin*		GetDescWin()	const { return m_pFieldDescWin; }
72*cdf0e10cSrcweir 	};
73*cdf0e10cSrcweir 	//==================================================================
74*cdf0e10cSrcweir 	class OTableDesignView : public ODataView
75*cdf0e10cSrcweir 							,public IClipboardTest
76*cdf0e10cSrcweir 	{
77*cdf0e10cSrcweir 		enum ChildFocusState
78*cdf0e10cSrcweir 		{
79*cdf0e10cSrcweir 			DESCRIPTION,
80*cdf0e10cSrcweir 			EDITOR,
81*cdf0e10cSrcweir 			NONE
82*cdf0e10cSrcweir 		};
83*cdf0e10cSrcweir 	private:
84*cdf0e10cSrcweir 		::com::sun::star::lang::Locale		m_aLocale;
85*cdf0e10cSrcweir 		OTableBorderWindow*					m_pWin;
86*cdf0e10cSrcweir 		OTableController&					m_rController;
87*cdf0e10cSrcweir 		ChildFocusState						m_eChildFocus;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 		IClipboardTest* getActiveChild() const;
90*cdf0e10cSrcweir 	protected:
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 		// return the Rectangle where I can paint myself
94*cdf0e10cSrcweir 		virtual void resizeDocumentView(Rectangle& rRect);
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	public:
97*cdf0e10cSrcweir 		OTableDesignView(	Window* pParent,
98*cdf0e10cSrcweir 							const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&,
99*cdf0e10cSrcweir 							OTableController& _rController);
100*cdf0e10cSrcweir 		virtual ~OTableDesignView();
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 		// window overloads
103*cdf0e10cSrcweir 		virtual long			PreNotify( NotifyEvent& rNEvt );
104*cdf0e10cSrcweir 		virtual void			GetFocus();
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 		OTableEditorCtrl*		GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : NULL; }
107*cdf0e10cSrcweir 		OTableFieldDescWin*		GetDescWin()	const { return m_pWin ? m_pWin->GetDescWin() : NULL; }
108*cdf0e10cSrcweir 		OTableController&		getController() const { return m_rController; }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 		::com::sun::star::lang::Locale		getLocale() const { return m_aLocale;}
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 		// IClipboardTest
113*cdf0e10cSrcweir 		virtual sal_Bool isCutAllowed();
114*cdf0e10cSrcweir 		virtual sal_Bool isCopyAllowed();
115*cdf0e10cSrcweir 		virtual sal_Bool isPasteAllowed();
116*cdf0e10cSrcweir 		virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
117*cdf0e10cSrcweir 		virtual void copy();
118*cdf0e10cSrcweir 		virtual void cut();
119*cdf0e10cSrcweir 		virtual void paste();
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 		// set the view readonly or not
122*cdf0e10cSrcweir 		virtual void setReadOnly(sal_Bool _bReadOnly);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 		virtual void initialize();
125*cdf0e10cSrcweir 		void reSync(); // resync window data with realdata
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 		DECL_LINK( SwitchHdl, Accelerator* );
128*cdf0e10cSrcweir 	};
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir #endif // DBAUI_TABLEDESIGNVIEW_HXX
131*cdf0e10cSrcweir 
132