diff options
author | Ocke Janssen <oj@openoffice.org> | 2002-06-24 06:49:59 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2002-06-24 06:49:59 +0000 |
commit | 57a567c250247574c5f77429a89c51cb1f3cecd5 (patch) | |
tree | 4fa35ad5bd89f0d0ce326248c0b15ec708e266c9 /dbaccess/source | |
parent | f022d8b20ec36a5845049b1a89449e381fa54526 (diff) |
#99301# enable window resizing
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ui/inc/JoinTableView.hxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableWindow.hxx | 16 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindow.cxx | 110 |
3 files changed, 102 insertions, 31 deletions
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx index b0a4ebe30b5e..db742e580692 100644 --- a/dbaccess/source/ui/inc/JoinTableView.hxx +++ b/dbaccess/source/ui/inc/JoinTableView.hxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinTableView.hxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: oj $ $Date: 2002-05-23 11:11:42 $ + * last change: $Author: oj $ $Date: 2002-06-24 07:49:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -163,6 +163,7 @@ namespace dbaui // window override virtual void StateChanged( StateChangedType nStateChange ); virtual void GetFocus(); + virtual void LoseFocus(); virtual void KeyInput( const KeyEvent& rEvt ); // Accessibility virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > CreateAccessible(); @@ -301,6 +302,8 @@ namespace dbaui Size getRealOutputSize() const { return m_aOutputSize; } + + virtual void EnsureVisible(const OTableWindow* _pWin); virtual void EnsureVisible(const Point& _rPoint,const Size& _rSize); diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx index e82ad8e87282..c554f3447477 100644 --- a/dbaccess/source/ui/inc/TableWindow.hxx +++ b/dbaccess/source/ui/inc/TableWindow.hxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindow.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2002-05-22 11:11:48 $ + * last change: $Author: oj $ $Date: 2002-06-24 07:49:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -185,6 +185,18 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> GetTable() const { ::osl::MutexGuard aGuard( m_aMutex ); return m_xTable; } UINT16 GetSizingFlags() const { return m_nSizingFlags; } + /** set the sizing flag to the direction + @param _rPos + The EndPosition after resizing. + */ + void setSizingFlag(const Point& _rPos); + /** set the rsizing flag to NONE. + */ + void resetSizingFlag() { m_nSizingFlags = SIZING_NONE; } + + /** returns the new sizing + */ + Rectangle getSizingRect(const Point& _rPos,const Size& _rOutputSize) const; // window override virtual void StateChanged( StateChangedType nStateChange ); diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index a658145a69a7..2c80b3f8de9e 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindow.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: oj $ $Date: 2002-06-21 07:06:39 $ + * last change: $Author: oj $ $Date: 2002-06-24 07:49:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -446,35 +446,79 @@ void OTableWindow::Draw3DBorder(const Rectangle& rRect) DrawLine( rRect.BottomLeft()+Point(1,-2), rRect.TopLeft() + aEHvector ); DrawLine( rRect.TopLeft() + aEHvector, rRect.TopRight()+Point(-2,1) ); } - -//------------------------------------------------------------------------------ -void OTableWindow::MouseMove( const MouseEvent& rEvt ) +// ----------------------------------------------------------------------------- +Rectangle OTableWindow::getSizingRect(const Point& _rPos,const Size& _rOutputSize) const { - Window::MouseMove(rEvt); + Rectangle aSizingRect = Rectangle( GetPosPixel(), GetSizePixel() ); + UINT16 nSizingFlags = GetSizingFlags(); - OJoinTableView* pCont = getTableView(); - if (pCont->getDesignView()->getController()->isReadOnly()) - return; + if( nSizingFlags & SIZING_TOP ) + { + if( _rPos.Y() < 0 ) + aSizingRect.Top() = 0; + else + aSizingRect.Top() = _rPos.Y(); + } + + if( nSizingFlags & SIZING_BOTTOM ) + { + if( _rPos.Y() > _rOutputSize.Height() ) + aSizingRect.Bottom() = _rOutputSize.Height(); + else + aSizingRect.Bottom() = _rPos.Y(); + } - Point aPos = rEvt.GetPosPixel(); - Size aOutSize = GetOutputSizePixel(); - Pointer aPointer; + if( nSizingFlags & SIZING_RIGHT ) + { + if( _rPos.X() > _rOutputSize.Width() ) + aSizingRect.Right() = _rOutputSize.Width(); + else + aSizingRect.Right() = _rPos.X(); + } + + if( nSizingFlags & SIZING_LEFT ) + { + if( _rPos.X() < 0 ) + aSizingRect.Left() = 0; + else + aSizingRect.Left() = _rPos.X(); + } + return aSizingRect; +} +// ----------------------------------------------------------------------------- +void OTableWindow::setSizingFlag(const Point& _rPos) +{ + Size aOutSize = GetOutputSizePixel(); ////////////////////////////////////////////////////////////////////// // Flags anpassen, wenn Mauszeiger in sizingArea m_nSizingFlags = SIZING_NONE; - if( aPos.X() < TABWIN_SIZING_AREA ) + if( _rPos.X() < TABWIN_SIZING_AREA ) m_nSizingFlags |= SIZING_LEFT; - if( aPos.Y() < TABWIN_SIZING_AREA ) + if( _rPos.Y() < TABWIN_SIZING_AREA ) m_nSizingFlags |= SIZING_TOP; - if( aPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA ) + if( _rPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA ) m_nSizingFlags |= SIZING_RIGHT; - if( aPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA ) + if( _rPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA ) m_nSizingFlags |= SIZING_BOTTOM; +} +//------------------------------------------------------------------------------ +void OTableWindow::MouseMove( const MouseEvent& rEvt ) +{ + Window::MouseMove(rEvt); + + OJoinTableView* pCont = getTableView(); + if (pCont->getDesignView()->getController()->isReadOnly()) + return; + + Point aPos = rEvt.GetPosPixel(); + setSizingFlag(aPos); + Pointer aPointer; + ////////////////////////////////////////////////////////////////////// // Mauszeiger anpassen, wenn Mauszeiger in sizingArea @@ -714,6 +758,9 @@ long OTableWindow::PreNotify(NotifyEvent& rNEvt) { case EVENT_KEYINPUT: { + if ( getDesignView()->getController()->isReadOnly() ) + break; + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); const KeyCode& rCode = pKeyEvent->GetKeyCode(); if ( rCode.IsMod1() ) @@ -748,17 +795,25 @@ long OTableWindow::PreNotify(NotifyEvent& rNEvt) { if ( rCode.IsShift() ) { -// OJoinTableView* pView = getTableView(); -// Size aNewSize(aStartPoint.X(),aStartPoint.Y()); -// if ( pView->isMovementAllowed(GetData()->GetPosition(), aNewSize) ) -// { -// Size aOldSize = GetData()->GetSize(); -// SetSizePixel(aNewSize); -// pView->EnsureVisible(GetData()->GetPosition(), GetData()->GetSize()); -// pView->TabWinSized(this,GetData()->GetPosition(),aOldSize); -// Invalidate(INVALIDATE_NOCHILDREN); -// getDesignView()->getController()->setModified( sal_True ); -// } + OJoinTableView* pView = getTableView(); + Point ptOld = GetPosPixel(); + Size aSize = pView->getRealOutputSize(); + Size aNewSize(aStartPoint.X(),aStartPoint.Y()); + if ( ((ptOld.X() + aNewSize.Width()) <= aSize.Width()) + && ((ptOld.Y() + aNewSize.Height()) <= aSize.Height()) ) + { + if ( aNewSize.Width() < TABWIN_WIDTH_MIN ) + aNewSize.Width() = TABWIN_WIDTH_MIN; + if ( aNewSize.Height() < TABWIN_HEIGHT_MIN ) + aNewSize.Height() = TABWIN_HEIGHT_MIN; + + Size szOld = GetSizePixel(); + + aNewSize = Size(pView->CalcZoom(aNewSize.Width()),pView->CalcZoom(aNewSize.Height())); + SetPosSizePixel( ptOld, aNewSize ); + pView->TabWinSized(this, ptOld, szOld); + Invalidate( INVALIDATE_NOCHILDREN ); + } } else { @@ -796,6 +851,7 @@ long OTableWindow::PreNotify(NotifyEvent& rNEvt) m_nMoveIncrement = 1; } } + resetSizingFlag(); } else { |