xref: /AOO41X/main/dbaccess/source/ui/inc/TableDesignView.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBAUI_TABLEDESIGNVIEW_HXX
24cdf0e10cSrcweir #define DBAUI_TABLEDESIGNVIEW_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_DATAVIEW_HXX
27cdf0e10cSrcweir #include "dataview.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
33cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _SV_SPLIT_HXX
36cdf0e10cSrcweir #include <vcl/split.hxx>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX
39cdf0e10cSrcweir #include "IClipBoardTest.hxx"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace dbaui
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	class OTableController;
45cdf0e10cSrcweir 	class OTableFieldDescWin;
46cdf0e10cSrcweir 	class OTableEditorCtrl;
47cdf0e10cSrcweir 	//==================================================================
48cdf0e10cSrcweir 	class OTableBorderWindow : public Window
49cdf0e10cSrcweir 	{
50cdf0e10cSrcweir 		Splitter							m_aHorzSplitter;
51cdf0e10cSrcweir 		OTableFieldDescWin*					m_pFieldDescWin;
52cdf0e10cSrcweir 		OTableEditorCtrl*					m_pEditorCtrl;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 		void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
55cdf0e10cSrcweir 		void ArrangeChilds( long nSplitPos ,Rectangle& rRect);
56cdf0e10cSrcweir 		DECL_LINK( SplitHdl, Splitter* );
57cdf0e10cSrcweir 	protected:
58cdf0e10cSrcweir 		virtual void DataChanged(const DataChangedEvent& rDCEvt);
59cdf0e10cSrcweir 	public:
60cdf0e10cSrcweir 		OTableBorderWindow(Window* pParent);
61cdf0e10cSrcweir 		~OTableBorderWindow();
62cdf0e10cSrcweir 		// window overloads
63cdf0e10cSrcweir 		virtual void Resize();
64cdf0e10cSrcweir 		virtual void GetFocus();
65cdf0e10cSrcweir 
GetEditorCtrl() const66cdf0e10cSrcweir 		OTableEditorCtrl*		GetEditorCtrl() const { return m_pEditorCtrl; }
GetDescWin() const67cdf0e10cSrcweir 		OTableFieldDescWin*		GetDescWin()	const { return m_pFieldDescWin; }
68cdf0e10cSrcweir 	};
69cdf0e10cSrcweir 	//==================================================================
70cdf0e10cSrcweir 	class OTableDesignView : public ODataView
71cdf0e10cSrcweir 							,public IClipboardTest
72cdf0e10cSrcweir 	{
73cdf0e10cSrcweir 		enum ChildFocusState
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			DESCRIPTION,
76cdf0e10cSrcweir 			EDITOR,
77cdf0e10cSrcweir 			NONE
78cdf0e10cSrcweir 		};
79cdf0e10cSrcweir 	private:
80cdf0e10cSrcweir 		::com::sun::star::lang::Locale		m_aLocale;
81cdf0e10cSrcweir 		OTableBorderWindow*					m_pWin;
82cdf0e10cSrcweir 		OTableController&					m_rController;
83cdf0e10cSrcweir 		ChildFocusState						m_eChildFocus;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 		IClipboardTest* getActiveChild() const;
86cdf0e10cSrcweir 	protected:
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 		// return the Rectangle where I can paint myself
90cdf0e10cSrcweir 		virtual void resizeDocumentView(Rectangle& rRect);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	public:
93cdf0e10cSrcweir 		OTableDesignView(	Window* pParent,
94cdf0e10cSrcweir 							const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&,
95cdf0e10cSrcweir 							OTableController& _rController);
96cdf0e10cSrcweir 		virtual ~OTableDesignView();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 		// window overloads
99cdf0e10cSrcweir 		virtual long			PreNotify( NotifyEvent& rNEvt );
100cdf0e10cSrcweir 		virtual void			GetFocus();
101cdf0e10cSrcweir 
GetEditorCtrl() const102cdf0e10cSrcweir 		OTableEditorCtrl*		GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : NULL; }
GetDescWin() const103cdf0e10cSrcweir 		OTableFieldDescWin*		GetDescWin()	const { return m_pWin ? m_pWin->GetDescWin() : NULL; }
getController() const104cdf0e10cSrcweir 		OTableController&		getController() const { return m_rController; }
105cdf0e10cSrcweir 
getLocale() const106cdf0e10cSrcweir 		::com::sun::star::lang::Locale		getLocale() const { return m_aLocale;}
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 		// IClipboardTest
109cdf0e10cSrcweir 		virtual sal_Bool isCutAllowed();
110cdf0e10cSrcweir 		virtual sal_Bool isCopyAllowed();
111cdf0e10cSrcweir 		virtual sal_Bool isPasteAllowed();
hasChildPathFocus()112cdf0e10cSrcweir 		virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
113cdf0e10cSrcweir 		virtual void copy();
114cdf0e10cSrcweir 		virtual void cut();
115cdf0e10cSrcweir 		virtual void paste();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 		// set the view readonly or not
118cdf0e10cSrcweir 		virtual void setReadOnly(sal_Bool _bReadOnly);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 		virtual void initialize();
121cdf0e10cSrcweir 		void reSync(); // resync window data with realdata
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 		DECL_LINK( SwitchHdl, Accelerator* );
124cdf0e10cSrcweir 	};
125cdf0e10cSrcweir }
126cdf0e10cSrcweir #endif // DBAUI_TABLEDESIGNVIEW_HXX
127cdf0e10cSrcweir 
128