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