Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / querydesign / TableWindow.cxx
blobf96a95644bc8876a40dc2b53a5eda77bbebc24f8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "TableWindow.hxx"
21 #include "TableWindowListBox.hxx"
22 #include "QueryTableView.hxx"
23 #include "QueryDesignView.hxx"
24 #include "TableWindowData.hxx"
25 #include "imageprovider.hxx"
26 #include <tools/diagnose_ex.h>
27 #include <osl/diagnose.h>
28 #include <vcl/svapp.hxx>
29 #include <vcl/wall.hxx>
30 #include <vcl/settings.hxx>
32 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
33 #include <com/sun/star/container/XNameAccess.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36 #include <com/sun/star/accessibility/AccessibleRole.hpp>
37 #include "querycontroller.hxx"
38 #include "dbu_qry.hrc"
39 #include "dbustrings.hrc"
40 #include "Query.hrc"
41 #include <comphelper/extract.hxx>
42 #include "UITools.hxx"
43 #include "TableWindowAccess.hxx"
44 #include "browserids.hxx"
45 #include <connectivity/dbtools.hxx>
46 #include "svtools/treelistentry.hxx"
48 #include <boost/scoped_ptr.hpp>
50 using namespace dbaui;
51 using namespace ::utl;
52 using namespace ::com::sun::star;
53 using namespace ::com::sun::star::sdb;
54 using namespace ::com::sun::star::sdbc;
55 using namespace ::com::sun::star::sdbcx;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::beans;
58 using namespace ::com::sun::star::container;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star::accessibility;
62 namespace DatabaseObject = css::sdb::application::DatabaseObject;
64 #define TABWIN_SIZING_AREA 4
65 #define TABWIN_WIDTH_MIN 90
66 #define TABWIN_HEIGHT_MIN 80
68 namespace {
70 void Draw3DBorder(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
72 // Use the System Style-Settings for my colours
73 const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
75 // Black lines for bottom and right
76 rRenderContext.SetLineColor(aSystemStyle.GetDarkShadowColor());
77 rRenderContext.DrawLine(rRect.BottomLeft(), rRect.BottomRight());
78 rRenderContext.DrawLine(rRect.BottomRight(), rRect.TopRight());
80 // Dark grey lines over the black lines
81 rRenderContext.SetLineColor(aSystemStyle.GetShadowColor());
82 Point aEHvector(1, 1);
83 rRenderContext.DrawLine(rRect.BottomLeft() + Point(1, -1), rRect.BottomRight() - aEHvector);
84 rRenderContext.DrawLine(rRect.BottomRight() - aEHvector, rRect.TopRight() + Point(-1, 1));
86 // Light grey lines for top and left
87 rRenderContext.SetLineColor(aSystemStyle.GetLightColor());
88 rRenderContext.DrawLine(rRect.BottomLeft() + Point(1, -2), rRect.TopLeft() + aEHvector);
89 rRenderContext.DrawLine(rRect.TopLeft() + aEHvector, rRect.TopRight() + Point(-2, 1));
94 // class OTableWindow
95 OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData )
96 : ::comphelper::OContainerListener(m_aMutex)
97 ,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
98 ,m_aTypeImage( VclPtr<FixedImage>::Create(this) )
99 ,m_xTitle( VclPtr<OTableWindowTitle>::Create(this) )
100 ,m_pAccessible(NULL)
101 ,m_pData( pTabWinData )
102 ,m_nMoveCount(0)
103 ,m_nMoveIncrement(1)
104 ,m_nSizingFlags( SIZING_NONE )
105 ,m_bActive( false )
108 // Set position and size
109 if( GetData()->HasPosition() )
110 SetPosPixel( GetData()->GetPosition() );
112 if( GetData()->HasSize() )
113 SetSizePixel( GetData()->GetSize() );
115 // Set background
116 const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
117 SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
118 // Set the text colour even though there is no text,
119 // because derived classes might need it
120 SetTextColor(aSystemStyle.GetButtonTextColor());
122 EnableClipSiblings();
125 OTableWindow::~OTableWindow()
127 disposeOnce();
130 void OTableWindow::dispose()
132 if (m_xListBox)
134 OSL_ENSURE(m_xListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
136 m_xListBox.disposeAndClear();
137 if ( m_pContainerListener.is() )
138 m_pContainerListener->dispose();
140 m_pAccessible = NULL;
141 m_aTypeImage.disposeAndClear();
142 m_xTitle.disposeAndClear();
143 vcl::Window::dispose();
146 const OJoinTableView* OTableWindow::getTableView() const
148 OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!");
149 return static_cast<OJoinTableView*>(GetParent());
152 OJoinTableView* OTableWindow::getTableView()
154 OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!");
155 return static_cast<OJoinTableView*>(GetParent());
158 OJoinDesignView* OTableWindow::getDesignView()
160 OSL_ENSURE(static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent()),"No OJoinDesignView!");
161 return static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent());
164 void OTableWindow::SetPosPixel( const Point& rNewPos )
166 Point aNewPosData = rNewPos + getTableView()->GetScrollOffset();
167 GetData()->SetPosition( aNewPosData );
168 Window::SetPosPixel( rNewPos );
171 void OTableWindow::SetSizePixel( const Size& rNewSize )
173 Size aOutSize(rNewSize);
174 if( aOutSize.Width() < TABWIN_WIDTH_MIN )
175 aOutSize.Width() = TABWIN_WIDTH_MIN;
176 if( aOutSize.Height() < TABWIN_HEIGHT_MIN )
177 aOutSize.Height() = TABWIN_HEIGHT_MIN;
179 GetData()->SetSize( aOutSize );
180 Window::SetSizePixel( aOutSize );
183 void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
185 SetPosPixel( rNewPos );
186 SetSizePixel( rNewSize );
189 VclPtr<OTableWindowListBox> OTableWindow::CreateListBox()
191 return VclPtr<OTableWindowListBox>::Create(this);
194 bool OTableWindow::FillListBox()
196 m_xListBox->Clear();
197 if ( !m_pContainerListener.is() )
199 Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY);
200 if ( xContainer.is() )
201 m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
203 // mark all primary keys with special image
204 ModuleRes TmpRes(IMG_JOINS);
205 ImageList aImageList(TmpRes);
206 Image aPrimKeyImage = aImageList.GetImage(IMG_PRIMARY_KEY);
208 if (GetData()->IsShowAll())
210 SvTreeListEntry* pEntry = m_xListBox->InsertEntry( OUString("*") );
211 pEntry->SetUserData( createUserData(NULL,false) );
214 Reference<XNameAccess> xPKeyColumns;
217 xPKeyColumns = dbtools::getPrimaryKeyColumns_throw(m_pData->getTable());
219 catch(Exception&)
221 OSL_FAIL("Exception occurred!");
225 Reference< XNameAccess > xColumns = m_pData->getColumns();
226 if( xColumns.is() )
228 Sequence< OUString> aColumns = xColumns->getElementNames();
229 const OUString* pIter = aColumns.getConstArray();
230 const OUString* pEnd = pIter + aColumns.getLength();
232 SvTreeListEntry* pEntry = NULL;
233 for (; pIter != pEnd; ++pIter)
235 bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName( *pIter );
236 // is this column in the primary key
237 if ( bPrimaryKeyColumn )
238 pEntry = m_xListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage);
239 else
240 pEntry = m_xListBox->InsertEntry(*pIter);
242 Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
243 if ( xColumn.is() )
244 pEntry->SetUserData( createUserData(xColumn,bPrimaryKeyColumn) );
248 catch(Exception&)
250 OSL_FAIL("Exception occurred!");
253 return true;
256 void* OTableWindow::createUserData(const Reference< XPropertySet>& /*_xColumn*/,bool /*_bPrimaryKey*/)
258 return NULL;
261 void OTableWindow::deleteUserData(void*& _pUserData)
263 OSL_ENSURE(!_pUserData,"INVALID call. Need to delete the userclass!");
264 _pUserData = NULL;
267 void OTableWindow::clearListBox()
269 if ( m_xListBox )
271 SvTreeListEntry* pEntry = m_xListBox->First();
273 while(pEntry)
275 void* pUserData = pEntry->GetUserData();
276 deleteUserData(pUserData);
277 SvTreeListEntry* pNextEntry = m_xListBox->Next(pEntry);
278 m_xListBox->GetModel()->Remove(pEntry);
279 pEntry = pNextEntry;
284 void OTableWindow::impl_updateImage()
286 ImageProvider aImageProvider( getDesignView()->getController().getConnection() );
288 Image aImage;
289 aImageProvider.getImages( GetComposedName(), m_pData->isQuery() ? DatabaseObject::QUERY : DatabaseObject::TABLE, aImage );
291 if ( !aImage )
293 OSL_FAIL( "OTableWindow::impl_updateImage: no images!" );
294 return;
297 m_aTypeImage->SetModeImage( aImage );
298 m_aTypeImage->Show();
301 bool OTableWindow::Init()
303 // create list box if necessary
304 if ( !m_xListBox )
306 m_xListBox = CreateListBox();
307 OSL_ENSURE( m_xListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" );
308 m_xListBox->SetSelectionMode( MULTIPLE_SELECTION );
311 // Set the title
312 m_xTitle->SetText( m_pData->GetWinName() );
313 m_xTitle->Show();
315 m_xListBox->Show();
317 // add the fields to the ListBox
318 clearListBox();
319 bool bSuccess = FillListBox();
320 if ( bSuccess )
321 m_xListBox->SelectAll( false );
323 impl_updateImage();
325 return bSuccess;
328 void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt)
330 if (rDCEvt.GetType() == DataChangedEventType::SETTINGS)
332 // In the worst-case the colours have changed so
333 // adapt myself to the new colours
334 const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings();
335 SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor())));
336 SetTextColor(aSystemStyle.GetButtonTextColor());
340 void OTableWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
342 Rectangle aRect(Point(0,0), GetOutputSizePixel());
343 Window::Paint(rRenderContext, rRect);
344 Draw3DBorder(rRenderContext, aRect);
347 Rectangle OTableWindow::getSizingRect(const Point& _rPos,const Size& _rOutputSize) const
349 Rectangle aSizingRect = Rectangle( GetPosPixel(), GetSizePixel() );
350 sal_uInt16 nSizingFlags = GetSizingFlags();
352 if( nSizingFlags & SIZING_TOP )
354 if( _rPos.Y() < 0 )
355 aSizingRect.Top() = 0;
356 else
357 aSizingRect.Top() = _rPos.Y();
360 if( nSizingFlags & SIZING_BOTTOM )
362 if( _rPos.Y() > _rOutputSize.Height() )
363 aSizingRect.Bottom() = _rOutputSize.Height();
364 else
365 aSizingRect.Bottom() = _rPos.Y();
368 if( nSizingFlags & SIZING_RIGHT )
370 if( _rPos.X() > _rOutputSize.Width() )
371 aSizingRect.Right() = _rOutputSize.Width();
372 else
373 aSizingRect.Right() = _rPos.X();
376 if( nSizingFlags & SIZING_LEFT )
378 if( _rPos.X() < 0 )
379 aSizingRect.Left() = 0;
380 else
381 aSizingRect.Left() = _rPos.X();
383 return aSizingRect;
386 void OTableWindow::setSizingFlag(const Point& _rPos)
388 Size aOutSize = GetOutputSizePixel();
389 // Set the flags when the mouse cursor is in the sizing area
390 m_nSizingFlags = SIZING_NONE;
392 if( _rPos.X() < TABWIN_SIZING_AREA )
393 m_nSizingFlags |= SIZING_LEFT;
395 if( _rPos.Y() < TABWIN_SIZING_AREA )
396 m_nSizingFlags |= SIZING_TOP;
398 if( _rPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA )
399 m_nSizingFlags |= SIZING_RIGHT;
401 if( _rPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA )
402 m_nSizingFlags |= SIZING_BOTTOM;
405 void OTableWindow::MouseMove( const MouseEvent& rEvt )
407 Window::MouseMove(rEvt);
409 OJoinTableView* pCont = getTableView();
410 if (pCont->getDesignView()->getController().isReadOnly())
411 return;
413 Point aPos = rEvt.GetPosPixel();
414 setSizingFlag(aPos);
415 Pointer aPointer;
417 // Set the mouse cursor when it is in the sizing area
418 switch( m_nSizingFlags )
420 case SIZING_TOP:
421 case SIZING_BOTTOM:
422 aPointer = Pointer( PointerStyle::SSize );
423 break;
425 case SIZING_LEFT:
426 case SIZING_RIGHT:
427 aPointer = Pointer( PointerStyle::ESize );
428 break;
430 case SIZING_LEFT+SIZING_TOP:
431 case SIZING_RIGHT+SIZING_BOTTOM:
432 aPointer = Pointer( PointerStyle::SESize );
433 break;
435 case SIZING_RIGHT+SIZING_TOP:
436 case SIZING_LEFT+SIZING_BOTTOM:
437 aPointer = Pointer( PointerStyle::NESize );
438 break;
441 SetPointer( aPointer );
444 void OTableWindow::MouseButtonDown( const MouseEvent& rEvt )
446 // When resizing, the parent must be informed that
447 // the window size of its child has changed
448 if( m_nSizingFlags )
449 getTableView()->BeginChildSizing( this, GetPointer() );
451 Window::MouseButtonDown( rEvt );
454 void OTableWindow::Resize()
456 // The window must not disappear so we enforce a minimum size
457 Size aOutSize = GetOutputSizePixel();
458 aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height()));
460 long nTitleHeight = CalcZoom( GetTextHeight() )+ CalcZoom( 4 );
462 // Set the title and ListBox
463 long n5Pos = CalcZoom(5);
464 long nPositionX = n5Pos;
465 long nPositionY = n5Pos;
467 // position the image which indicates the type
468 m_aTypeImage->SetPosPixel( Point( nPositionX, nPositionY ) );
469 Size aImageSize( m_aTypeImage->GetImage().GetSizePixel() );
470 m_aTypeImage->SetSizePixel( aImageSize );
472 if ( nTitleHeight < aImageSize.Height() )
473 nTitleHeight = aImageSize.Height();
475 nPositionX += aImageSize.Width() + CalcZoom( 2 );
476 m_xTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
478 long nTitleToList = CalcZoom( 3 );
480 m_xListBox->SetPosSizePixel(
481 Point( n5Pos, nPositionY + nTitleHeight + nTitleToList ),
482 Size( aOutSize.Width() - 2 * n5Pos, aOutSize.Height() - ( nPositionY + nTitleHeight + nTitleToList ) - n5Pos )
485 Window::Invalidate();
488 void OTableWindow::SetBoldTitle( bool bBold )
490 vcl::Font aFont = m_xTitle->GetFont();
491 aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL );
492 m_xTitle->SetFont( aFont );
493 m_xTitle->Invalidate();
496 void OTableWindow::GetFocus()
498 Window::GetFocus();
499 // we have to forward the focus to our listbox to enable keystokes
500 if(m_xListBox)
501 m_xListBox->GrabFocus();
504 void OTableWindow::setActive(bool _bActive)
506 SetBoldTitle( _bActive );
507 m_bActive = _bActive;
508 if (!_bActive && m_xListBox && m_xListBox->GetSelectionCount() != 0)
509 m_xListBox->SelectAll(false);
512 void OTableWindow::Remove()
514 // Delete the window
515 OJoinTableView* pTabWinCont = getTableView();
516 pTabWinCont->RemoveTabWin( this );
517 pTabWinCont->Invalidate();
520 bool OTableWindow::HandleKeyInput( const KeyEvent& rEvt )
522 const vcl::KeyCode& rCode = rEvt.GetKeyCode();
523 sal_uInt16 nCode = rCode.GetCode();
524 bool bShift = rCode.IsShift();
525 bool bCtrl = rCode.IsMod1();
527 bool bHandle = false;
529 if( !bCtrl && !bShift && (nCode==KEY_DELETE) )
531 Remove();
532 bHandle = true;
534 return bHandle;
537 bool OTableWindow::ExistsAConn() const
539 return getTableView()->ExistsAConn(this);
542 void OTableWindow::EnumValidFields(::std::vector< OUString>& arrstrFields)
544 arrstrFields.clear();
545 // This default implementation counts every item in the ListBox ... for any other behaviour it must be over-written
546 if ( m_xListBox )
548 arrstrFields.reserve(m_xListBox->GetEntryCount());
549 SvTreeListEntry* pEntryLoop = m_xListBox->First();
550 while (pEntryLoop)
552 arrstrFields.push_back(m_xListBox->GetEntryText(pEntryLoop));
553 pEntryLoop = m_xListBox->Next(pEntryLoop);
558 void OTableWindow::StateChanged( StateChangedType nType )
560 Window::StateChanged( nType );
562 // FIXME RenderContext
564 if ( nType == StateChangedType::Zoom )
566 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
568 vcl::Font aFont = rStyleSettings.GetGroupFont();
569 if ( IsControlFont() )
570 aFont.Merge( GetControlFont() );
571 SetZoomedPointFont(*this, aFont);
573 m_xTitle->SetZoom(GetZoom());
574 m_xListBox->SetZoom(GetZoom());
575 Resize();
576 Invalidate();
580 Reference< XAccessible > OTableWindow::CreateAccessible()
582 OTableWindowAccess* pAccessible = new OTableWindowAccess(this);
583 m_pAccessible = pAccessible;
584 return pAccessible;
587 void OTableWindow::Command(const CommandEvent& rEvt)
589 switch (rEvt.GetCommand())
591 case CommandEventId::ContextMenu:
593 OJoinController& rController = getDesignView()->getController();
594 if(!rController.isReadOnly() && rController.isConnected())
596 Point ptWhere;
597 if ( rEvt.IsMouseEvent() )
598 ptWhere = rEvt.GetMousePosPixel();
599 else
601 SvTreeListEntry* pCurrent = m_xListBox->GetCurEntry();
602 if ( pCurrent )
603 ptWhere = m_xListBox->GetEntryPosition(pCurrent);
604 else
605 ptWhere = m_xTitle->GetPosPixel();
608 PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
609 switch (aContextMenu.Execute(this, ptWhere))
611 case SID_DELETE:
612 Remove();
613 break;
616 break;
618 default:
619 Window::Command(rEvt);
623 bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
625 bool bHandled = false;
626 switch (rNEvt.GetType())
628 case MouseNotifyEvent::KEYINPUT:
630 if ( getDesignView()->getController().isReadOnly() )
631 break;
633 const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
634 const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
635 if ( rCode.IsMod1() )
637 Point aStartPoint = GetPosPixel();
638 if ( rCode.IsShift() )
640 aStartPoint.X() = GetSizePixel().Width();
641 aStartPoint.Y() = GetSizePixel().Height();
644 switch( rCode.GetCode() )
646 case KEY_DOWN:
647 bHandled = true;
648 aStartPoint.Y() += m_nMoveIncrement;
649 break;
650 case KEY_UP:
651 bHandled = true;
652 aStartPoint.Y() += -m_nMoveIncrement;
653 break;
654 case KEY_LEFT:
655 bHandled = true;
656 aStartPoint.X() += -m_nMoveIncrement;
657 break;
658 case KEY_RIGHT:
659 bHandled = true;
660 aStartPoint.X() += m_nMoveIncrement;
661 break;
663 if ( bHandled )
665 if ( rCode.IsShift() )
667 OJoinTableView* pView = getTableView();
668 Point ptOld = GetPosPixel();
669 Size aSize = pView->getRealOutputSize();
670 Size aNewSize(aStartPoint.X(),aStartPoint.Y());
671 if ( ((ptOld.X() + aNewSize.Width()) <= aSize.Width())
672 && ((ptOld.Y() + aNewSize.Height()) <= aSize.Height()) )
674 if ( aNewSize.Width() < TABWIN_WIDTH_MIN )
675 aNewSize.Width() = TABWIN_WIDTH_MIN;
676 if ( aNewSize.Height() < TABWIN_HEIGHT_MIN )
677 aNewSize.Height() = TABWIN_HEIGHT_MIN;
679 Size szOld = GetSizePixel();
681 aNewSize = Size(pView->CalcZoom(aNewSize.Width()),pView->CalcZoom(aNewSize.Height()));
682 SetPosSizePixel( ptOld, aNewSize );
683 pView->TabWinSized(this, ptOld, szOld);
684 Invalidate( INVALIDATE_NOCHILDREN );
687 else
689 // remember how often the user moved our window
690 ++m_nMoveCount;
691 if( m_nMoveCount == 5 )
692 m_nMoveIncrement = 10;
693 else if( m_nMoveCount > 15 )
694 m_nMoveCount = m_nMoveIncrement = 20;
696 Point aOldDataPoint = GetData()->GetPosition();
697 Point aNewDataPoint = aStartPoint + getTableView()->GetScrollOffset();
698 if ( aNewDataPoint.X() > -1 && aNewDataPoint.Y() > -1 )
700 OJoinTableView* pView = getTableView();
701 if ( pView->isMovementAllowed(aNewDataPoint, GetData()->GetSize()) )
703 SetPosPixel(aStartPoint);
705 // aNewDataPoint can not be used here because SetPosPixel reset it
706 pView->EnsureVisible(GetData()->GetPosition(), GetData()->GetSize());
707 pView->TabWinMoved(this,aOldDataPoint);
708 Invalidate(INVALIDATE_NOCHILDREN);
709 getDesignView()->getController().setModified( sal_True );
711 else
713 m_nMoveCount = 0; // reset our movement count
714 m_nMoveIncrement = 1;
717 else
719 m_nMoveCount = 0; // reset our movement count
720 m_nMoveIncrement = 1;
723 resetSizingFlag();
725 else
727 m_nMoveCount = 0; // reset our movement count
728 m_nMoveIncrement = 1;
731 else
733 m_nMoveCount = 0; // reset our movement count
734 m_nMoveIncrement = 1;
736 break;
738 case MouseNotifyEvent::KEYUP:
740 const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
741 const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
742 sal_uInt16 nKeyCode = rCode.GetCode();
743 if ( rCode.IsMod2() && nKeyCode != KEY_UP && nKeyCode != KEY_DOWN && nKeyCode != KEY_LEFT && nKeyCode != KEY_RIGHT )
745 m_nMoveCount = 0; // reset our movement count
746 m_nMoveIncrement = 1;
748 break;
750 default:
751 break;
753 if (!bHandled)
754 return Window::PreNotify(rNEvt);
755 return true;
758 OUString OTableWindow::getTitle() const
760 return m_xTitle->GetText();
763 void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
765 FillListBox();
768 void OTableWindow::_elementRemoved( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
770 FillListBox();
773 void OTableWindow::_elementReplaced( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
775 FillListBox();
778 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */