xref: /AOO41X/main/dbaccess/source/ui/tabledesign/TableDesignView.cxx (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 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
30*cdf0e10cSrcweir #ifndef DBAUI_TABLEDESIGNVIEW_HXX
31*cdf0e10cSrcweir #include "TableDesignView.hxx"
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX
34*cdf0e10cSrcweir #include <tools/debug.hxx>
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir #ifndef DBUI_TABLECONTROLLER_HXX
37*cdf0e10cSrcweir #include "TableController.hxx"
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_
40*cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #ifndef DBAUI_FIELDDESCRIPTIONS_HXX
43*cdf0e10cSrcweir #include "FieldDescriptions.hxx"
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir #ifndef DBAUI_TABLEEDITORCONTROL_HXX
46*cdf0e10cSrcweir #include "TEditControl.hxx"
47*cdf0e10cSrcweir #endif
48*cdf0e10cSrcweir #ifndef DBAUI_TABLEFIELDDESCRIPTION_HXX
49*cdf0e10cSrcweir #include "TableFieldDescWin.hxx"
50*cdf0e10cSrcweir #endif
51*cdf0e10cSrcweir #ifndef DBAUI_TABLEROW_HXX
52*cdf0e10cSrcweir #include "TableRow.hxx"
53*cdf0e10cSrcweir #endif
54*cdf0e10cSrcweir #ifndef _UTL_CONFIGMGR_HXX_
55*cdf0e10cSrcweir #include <unotools/configmgr.hxx>
56*cdf0e10cSrcweir #endif
57*cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
58*cdf0e10cSrcweir #include <comphelper/types.hxx>
59*cdf0e10cSrcweir #endif
60*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBOARD_XCLIPBOARD_HPP_
61*cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
62*cdf0e10cSrcweir #endif
63*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX
64*cdf0e10cSrcweir #include <unotools/syslocale.hxx>
65*cdf0e10cSrcweir #endif
66*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX
67*cdf0e10cSrcweir #include "UITools.hxx"
68*cdf0e10cSrcweir #endif
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir using namespace ::dbaui;
72*cdf0e10cSrcweir using namespace ::utl;
73*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
74*cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::clipboard;
75*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
76*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir //==================================================================
79*cdf0e10cSrcweir // class OTableBorderWindow
80*cdf0e10cSrcweir DBG_NAME(OTableBorderWindow)
81*cdf0e10cSrcweir //==================================================================
82*cdf0e10cSrcweir OTableBorderWindow::OTableBorderWindow(Window* pParent) : Window(pParent,WB_BORDER)
83*cdf0e10cSrcweir 	,m_aHorzSplitter( this )
84*cdf0e10cSrcweir {
85*cdf0e10cSrcweir     DBG_CTOR(OTableBorderWindow,NULL);
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	ImplInitSettings( sal_True, sal_True, sal_True );
88*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
89*cdf0e10cSrcweir 	// Childs erzeugen
90*cdf0e10cSrcweir 	m_pEditorCtrl	= new OTableEditorCtrl( this);
91*cdf0e10cSrcweir 	m_pFieldDescWin = new OTableFieldDescWin( this );
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	m_pFieldDescWin->SetHelpId(HID_TAB_DESIGN_DESCWIN);
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	// set depending windows and controls
96*cdf0e10cSrcweir 	m_pEditorCtrl->SetDescrWin(m_pFieldDescWin);
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
99*cdf0e10cSrcweir 	// Splitter einrichten
100*cdf0e10cSrcweir 	m_aHorzSplitter.SetSplitHdl( LINK(this, OTableBorderWindow, SplitHdl) );
101*cdf0e10cSrcweir 	m_aHorzSplitter.Show();
102*cdf0e10cSrcweir }
103*cdf0e10cSrcweir // -----------------------------------------------------------------------------
104*cdf0e10cSrcweir OTableBorderWindow::~OTableBorderWindow()
105*cdf0e10cSrcweir {
106*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
107*cdf0e10cSrcweir 	// Childs zerstoeren
108*cdf0e10cSrcweir 	//	::dbaui::notifySystemWindow(this,m_pFieldDescWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
109*cdf0e10cSrcweir 	m_pEditorCtrl->Hide();
110*cdf0e10cSrcweir 	m_pFieldDescWin->Hide();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	{
113*cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp(m_pEditorCtrl);
114*cdf0e10cSrcweir 		m_pEditorCtrl = NULL;
115*cdf0e10cSrcweir 	}
116*cdf0e10cSrcweir 	{
117*cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp(m_pFieldDescWin);
118*cdf0e10cSrcweir 		m_pFieldDescWin = NULL;
119*cdf0e10cSrcweir 	}
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     DBG_DTOR(OTableBorderWindow,NULL);
122*cdf0e10cSrcweir }
123*cdf0e10cSrcweir // -----------------------------------------------------------------------------
124*cdf0e10cSrcweir void OTableBorderWindow::Resize()
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir 	const long nSplitterHeight(3);
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
129*cdf0e10cSrcweir 	// Abmessungen parent window
130*cdf0e10cSrcweir 	Size aOutputSize( GetOutputSize() );
131*cdf0e10cSrcweir 	long nOutputWidth	= aOutputSize.Width();
132*cdf0e10cSrcweir 	long nOutputHeight	= aOutputSize.Height();
133*cdf0e10cSrcweir 	long nSplitPos		= m_aHorzSplitter.GetSplitPosPixel();
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
136*cdf0e10cSrcweir 	// Verschiebebereich Splitter mittleres Drittel des Outputs
137*cdf0e10cSrcweir 	long nDragPosY = nOutputHeight/3;
138*cdf0e10cSrcweir 	long nDragSizeHeight = nOutputHeight/3;
139*cdf0e10cSrcweir 	m_aHorzSplitter.SetDragRectPixel( Rectangle(Point(0,nDragPosY), Size(nOutputWidth,nDragSizeHeight) ), this );
140*cdf0e10cSrcweir 	if( (nSplitPos < nDragPosY) || (nSplitPos > (nDragPosY+nDragSizeHeight)) )
141*cdf0e10cSrcweir 		nSplitPos = nDragPosY+nDragSizeHeight-5;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
144*cdf0e10cSrcweir 	// Splitter setzen
145*cdf0e10cSrcweir 	m_aHorzSplitter.SetPosSizePixel( Point( 0, nSplitPos ), Size(nOutputWidth, nSplitterHeight));
146*cdf0e10cSrcweir 	m_aHorzSplitter.SetSplitPosPixel( nSplitPos );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
149*cdf0e10cSrcweir 	// Fenster setzen
150*cdf0e10cSrcweir 	m_pEditorCtrl->SetPosSizePixel( Point(0, 0), Size(nOutputWidth , nSplitPos) );
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	m_pFieldDescWin->SetPosSizePixel(	Point(0, nSplitPos+nSplitterHeight),
153*cdf0e10cSrcweir 						Size(nOutputWidth, nOutputHeight-nSplitPos-nSplitterHeight) );
154*cdf0e10cSrcweir }
155*cdf0e10cSrcweir //------------------------------------------------------------------------------
156*cdf0e10cSrcweir IMPL_LINK( OTableBorderWindow, SplitHdl, Splitter*, pSplit )
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir 	if(pSplit == &m_aHorzSplitter)
159*cdf0e10cSrcweir 	{
160*cdf0e10cSrcweir 		m_aHorzSplitter.SetPosPixel( Point( m_aHorzSplitter.GetPosPixel().X(),m_aHorzSplitter.GetSplitPosPixel() ) );
161*cdf0e10cSrcweir 		Resize();
162*cdf0e10cSrcweir 	}
163*cdf0e10cSrcweir 	return 0;
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir // -----------------------------------------------------------------------------
166*cdf0e10cSrcweir void OTableBorderWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	if ( bFont )
171*cdf0e10cSrcweir 	{
172*cdf0e10cSrcweir 		Font aFont = rStyleSettings.GetAppFont();
173*cdf0e10cSrcweir 		if ( IsControlFont() )
174*cdf0e10cSrcweir 			aFont.Merge( GetControlFont() );
175*cdf0e10cSrcweir 		SetPointFont( aFont );
176*cdf0e10cSrcweir //		Set/*Zoomed*/PointFont( aFont );
177*cdf0e10cSrcweir 	}
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	if ( bFont || bForeground )
180*cdf0e10cSrcweir 	{
181*cdf0e10cSrcweir 		Color aTextColor = rStyleSettings.GetButtonTextColor();
182*cdf0e10cSrcweir 		if ( IsControlForeground() )
183*cdf0e10cSrcweir 			aTextColor = GetControlForeground();
184*cdf0e10cSrcweir 		SetTextColor( aTextColor );
185*cdf0e10cSrcweir 	}
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	if ( bBackground )
188*cdf0e10cSrcweir 	{
189*cdf0e10cSrcweir 		if( IsControlBackground() )
190*cdf0e10cSrcweir 			SetBackground( GetControlBackground() );
191*cdf0e10cSrcweir 		else
192*cdf0e10cSrcweir 			SetBackground( rStyleSettings.GetFaceColor() );
193*cdf0e10cSrcweir 	}
194*cdf0e10cSrcweir }
195*cdf0e10cSrcweir // -----------------------------------------------------------------------
196*cdf0e10cSrcweir void OTableBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
197*cdf0e10cSrcweir {
198*cdf0e10cSrcweir 	Window::DataChanged( rDCEvt );
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
201*cdf0e10cSrcweir 		 (rDCEvt.GetFlags() & SETTINGS_STYLE) )
202*cdf0e10cSrcweir 	{
203*cdf0e10cSrcweir 		ImplInitSettings( sal_True, sal_True, sal_True );
204*cdf0e10cSrcweir 		Invalidate();
205*cdf0e10cSrcweir 	}
206*cdf0e10cSrcweir }
207*cdf0e10cSrcweir // -----------------------------------------------------------------------------
208*cdf0e10cSrcweir void OTableBorderWindow::GetFocus()
209*cdf0e10cSrcweir {
210*cdf0e10cSrcweir 	Window::GetFocus();
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	// forward the focus to the current cell of the editor control
213*cdf0e10cSrcweir 	if (m_pEditorCtrl)
214*cdf0e10cSrcweir 		m_pEditorCtrl->GrabFocus();
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir //==================================================================
218*cdf0e10cSrcweir // class OTableDesignView
219*cdf0e10cSrcweir //==================================================================
220*cdf0e10cSrcweir DBG_NAME(OTableDesignView);
221*cdf0e10cSrcweir //------------------------------------------------------------------------------
222*cdf0e10cSrcweir OTableDesignView::OTableDesignView( Window* pParent,
223*cdf0e10cSrcweir 									const Reference< XMultiServiceFactory >& _rxOrb,
224*cdf0e10cSrcweir 									OTableController& _rController
225*cdf0e10cSrcweir 								   ) :
226*cdf0e10cSrcweir 	ODataView( pParent, _rController,_rxOrb )
227*cdf0e10cSrcweir 	,m_rController( _rController )
228*cdf0e10cSrcweir 	,m_eChildFocus(NONE)
229*cdf0e10cSrcweir {
230*cdf0e10cSrcweir 	DBG_CTOR(OTableDesignView,NULL);
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 	try
233*cdf0e10cSrcweir 	{
234*cdf0e10cSrcweir 		m_aLocale = SvtSysLocale().GetLocaleData().getLocale();
235*cdf0e10cSrcweir 	}
236*cdf0e10cSrcweir 	catch(Exception&)
237*cdf0e10cSrcweir 	{
238*cdf0e10cSrcweir 	}
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 	m_pWin = new OTableBorderWindow(this);
241*cdf0e10cSrcweir 	m_pWin->Show();
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir //------------------------------------------------------------------------------
245*cdf0e10cSrcweir OTableDesignView::~OTableDesignView()
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir 	DBG_DTOR(OTableDesignView,NULL);
248*cdf0e10cSrcweir 	m_pWin->Hide();
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 	{
251*cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp(m_pWin);
252*cdf0e10cSrcweir 		m_pWin = NULL;
253*cdf0e10cSrcweir 	}
254*cdf0e10cSrcweir }
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir // -----------------------------------------------------------------------------
257*cdf0e10cSrcweir void OTableDesignView::initialize()
258*cdf0e10cSrcweir {
259*cdf0e10cSrcweir 	GetEditorCtrl()->Init();
260*cdf0e10cSrcweir 	GetDescWin()->Init();
261*cdf0e10cSrcweir 	// first call after the editctrl has been set
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 	GetEditorCtrl()->Show();
264*cdf0e10cSrcweir 	GetDescWin()->Show();
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	GetEditorCtrl()->DisplayData(0);
267*cdf0e10cSrcweir }
268*cdf0e10cSrcweir //------------------------------------------------------------------------------
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir //------------------------------------------------------------------------------
271*cdf0e10cSrcweir void OTableDesignView::resizeDocumentView(Rectangle& _rPlayground)
272*cdf0e10cSrcweir {
273*cdf0e10cSrcweir 	m_pWin->SetPosSizePixel( _rPlayground.TopLeft(), _rPlayground.GetSize() );
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	// just for completeness: there is no space left, we occupied it all ...
276*cdf0e10cSrcweir 	_rPlayground.SetPos( _rPlayground.BottomRight() );
277*cdf0e10cSrcweir 	_rPlayground.SetSize( Size( 0, 0 ) );
278*cdf0e10cSrcweir }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir //------------------------------------------------------------------------------
281*cdf0e10cSrcweir IMPL_LINK( OTableDesignView, SwitchHdl, Accelerator*, /*pAcc*/ )
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	if( getController().isReadOnly() )
284*cdf0e10cSrcweir 		return 0;
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	if( GetDescWin()->HasChildPathFocus() )
287*cdf0e10cSrcweir 	{
288*cdf0e10cSrcweir 		GetDescWin()->LoseFocus();
289*cdf0e10cSrcweir 		GetEditorCtrl()->GrabFocus();
290*cdf0e10cSrcweir 	}
291*cdf0e10cSrcweir 	else
292*cdf0e10cSrcweir 	{
293*cdf0e10cSrcweir 		 ::boost::shared_ptr<OTableRow>  pRow = (*GetEditorCtrl()->GetRowList())[GetEditorCtrl()->GetCurRow()];
294*cdf0e10cSrcweir 		OFieldDescription* pFieldDescr = pRow ? pRow->GetActFieldDescr() : NULL;
295*cdf0e10cSrcweir 		if ( pFieldDescr )
296*cdf0e10cSrcweir 			GetDescWin()->GrabFocus();
297*cdf0e10cSrcweir 		else
298*cdf0e10cSrcweir 			GetEditorCtrl()->GrabFocus();
299*cdf0e10cSrcweir 	}
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 	return 0;
302*cdf0e10cSrcweir }
303*cdf0e10cSrcweir //------------------------------------------------------------------------------
304*cdf0e10cSrcweir long OTableDesignView::PreNotify( NotifyEvent& rNEvt )
305*cdf0e10cSrcweir {
306*cdf0e10cSrcweir 	sal_Bool bHandled = sal_False;
307*cdf0e10cSrcweir 	switch(rNEvt.GetType())
308*cdf0e10cSrcweir 	{
309*cdf0e10cSrcweir 		case EVENT_GETFOCUS:
310*cdf0e10cSrcweir 			if( GetDescWin() && GetDescWin()->HasChildPathFocus() )
311*cdf0e10cSrcweir 				m_eChildFocus = DESCRIPTION;
312*cdf0e10cSrcweir 			else if ( GetEditorCtrl() && GetEditorCtrl()->HasChildPathFocus() )
313*cdf0e10cSrcweir 				m_eChildFocus = EDITOR;
314*cdf0e10cSrcweir 			else
315*cdf0e10cSrcweir 				m_eChildFocus = NONE;
316*cdf0e10cSrcweir 			break;
317*cdf0e10cSrcweir 	}
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 	return bHandled ? 1L : ODataView::PreNotify(rNEvt);
320*cdf0e10cSrcweir }
321*cdf0e10cSrcweir // -----------------------------------------------------------------------------
322*cdf0e10cSrcweir IClipboardTest* OTableDesignView::getActiveChild() const
323*cdf0e10cSrcweir {
324*cdf0e10cSrcweir 	IClipboardTest* pTest = NULL;
325*cdf0e10cSrcweir 	switch(m_eChildFocus)
326*cdf0e10cSrcweir 	{
327*cdf0e10cSrcweir 		case DESCRIPTION:
328*cdf0e10cSrcweir 			pTest = GetDescWin();
329*cdf0e10cSrcweir 			break;
330*cdf0e10cSrcweir 		case EDITOR:
331*cdf0e10cSrcweir 			pTest = GetEditorCtrl();
332*cdf0e10cSrcweir 			break;
333*cdf0e10cSrcweir         case NONE:
334*cdf0e10cSrcweir             break;
335*cdf0e10cSrcweir 	}
336*cdf0e10cSrcweir 	return pTest;
337*cdf0e10cSrcweir }
338*cdf0e10cSrcweir // -----------------------------------------------------------------------------
339*cdf0e10cSrcweir sal_Bool OTableDesignView::isCopyAllowed()
340*cdf0e10cSrcweir {
341*cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
342*cdf0e10cSrcweir 	return pTest && pTest->isCopyAllowed();
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir // -----------------------------------------------------------------------------
345*cdf0e10cSrcweir sal_Bool OTableDesignView::isCutAllowed()
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
348*cdf0e10cSrcweir 	return pTest && pTest->isCutAllowed();
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir // -----------------------------------------------------------------------------
351*cdf0e10cSrcweir sal_Bool OTableDesignView::isPasteAllowed()
352*cdf0e10cSrcweir {
353*cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
354*cdf0e10cSrcweir 	return pTest && pTest->isPasteAllowed();
355*cdf0e10cSrcweir }
356*cdf0e10cSrcweir // -----------------------------------------------------------------------------
357*cdf0e10cSrcweir void OTableDesignView::copy()
358*cdf0e10cSrcweir {
359*cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
360*cdf0e10cSrcweir 	if ( pTest )
361*cdf0e10cSrcweir 		pTest->copy();
362*cdf0e10cSrcweir }
363*cdf0e10cSrcweir // -----------------------------------------------------------------------------
364*cdf0e10cSrcweir void OTableDesignView::cut()
365*cdf0e10cSrcweir {
366*cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
367*cdf0e10cSrcweir 	if ( pTest )
368*cdf0e10cSrcweir 		pTest->cut();
369*cdf0e10cSrcweir }
370*cdf0e10cSrcweir // -----------------------------------------------------------------------------
371*cdf0e10cSrcweir void OTableDesignView::paste()
372*cdf0e10cSrcweir {
373*cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
374*cdf0e10cSrcweir 	if ( pTest )
375*cdf0e10cSrcweir 		pTest->paste();
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir // -----------------------------------------------------------------------------
378*cdf0e10cSrcweir // set the view readonly or not
379*cdf0e10cSrcweir void OTableDesignView::setReadOnly(sal_Bool _bReadOnly)
380*cdf0e10cSrcweir {
381*cdf0e10cSrcweir 	GetDescWin()->SetReadOnly(_bReadOnly);
382*cdf0e10cSrcweir 	GetEditorCtrl()->SetReadOnly(_bReadOnly);
383*cdf0e10cSrcweir }
384*cdf0e10cSrcweir // -----------------------------------------------------------------------------
385*cdf0e10cSrcweir void OTableDesignView::reSync()
386*cdf0e10cSrcweir {
387*cdf0e10cSrcweir 	GetEditorCtrl()->DeactivateCell();
388*cdf0e10cSrcweir 	 ::boost::shared_ptr<OTableRow>  pRow = (*GetEditorCtrl()->GetRowList())[GetEditorCtrl()->GetCurRow()];
389*cdf0e10cSrcweir 	OFieldDescription* pFieldDescr = pRow ? pRow->GetActFieldDescr() : NULL;
390*cdf0e10cSrcweir 	if ( pFieldDescr )
391*cdf0e10cSrcweir 		GetDescWin()->DisplayData(pFieldDescr);
392*cdf0e10cSrcweir }
393*cdf0e10cSrcweir // -----------------------------------------------------------------------------
394*cdf0e10cSrcweir void OTableDesignView::GetFocus()
395*cdf0e10cSrcweir {
396*cdf0e10cSrcweir 	if ( GetEditorCtrl() )
397*cdf0e10cSrcweir 		GetEditorCtrl()->GrabFocus();
398*cdf0e10cSrcweir }
399*cdf0e10cSrcweir // -----------------------------------------------------------------------------
400*cdf0e10cSrcweir 
401