diff options
author | Ocke Janssen <oj@openoffice.org> | 2002-06-21 06:09:34 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2002-06-21 06:09:34 +0000 |
commit | f022d8b20ec36a5845049b1a89449e381fa54526 (patch) | |
tree | d5ee89d12e5594a9fc51ba0a6fa13910a5a60e19 /dbaccess/source/ui/querydesign | |
parent | 2ec8c8618c0c4c80aa0efafca50805401b1b76e7 (diff) |
#100271# #99994# drag source and deletion corrected
Diffstat (limited to 'dbaccess/source/ui/querydesign')
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinTableView.cxx | 59 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 20 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindow.cxx | 92 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindowListBox.cxx | 37 |
4 files changed, 119 insertions, 89 deletions
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 02c3e9625a04..d01174ebb200 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinTableView.cxx,v $ * - * $Revision: 1.36 $ + * $Revision: 1.37 $ * - * last change: $Author: oj $ $Date: 2002-05-29 08:28:58 $ + * last change: $Author: oj $ $Date: 2002-06-21 07:06:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -490,52 +490,56 @@ namespace // data about the tab win Point aUpperLeft = _rPoint; // normalize with respect to visibility - aUpperLeft.X() -= _pView->GetScrollOffset().X(); - aUpperLeft.Y() -= _pView->GetScrollOffset().Y(); + aUpperLeft -= _pView->GetScrollOffset(); + // aUpperLeft.Y() -= _pView->GetScrollOffset().Y(); Point aLowerRight(aUpperLeft.X() + _rSize.Width(), aUpperLeft.Y() + _rSize.Height()); - // aLowerRight.Y() -= GetScrollOffset().Y(); // data about ourself Size aSize = _pView->getRealOutputSize(); //GetOutputSizePixel(); BOOL bVisbile = TRUE; BOOL bFitsHor = (aUpperLeft.X() >= 0) && (aLowerRight.X() <= aSize.Width()); - BOOL bFitsVert = (aUpperLeft.Y() >= 0) && (aLowerRight.Y() <= aSize.Height()); + BOOL bFitsVert= (aUpperLeft.Y() >= 0) && (aLowerRight.Y() <= aSize.Height()); if (!bFitsHor || !bFitsVert) { + // #100386# OJ if (!bFitsHor) { // ensure the visibility of the right border - if (aLowerRight.X() > aSize.Width()) - _nScrollX = (aLowerRight.X() - aSize.Width() + TABWIN_SPACING_X); + if ( aLowerRight.X() > aSize.Width() ) + _nScrollX = aLowerRight.X() - aSize.Width() + TABWIN_SPACING_X; - // ensure the cisibility of the left border (higher priority) - if (aUpperLeft.X() - _nScrollX < 0) + // ensure the visibility of the left border (higher priority) + if ( (aUpperLeft.X() - _nScrollX) < 0 ) _nScrollX = aUpperLeft.X() - TABWIN_SPACING_X; } if (!bFitsVert) { // lower border - if (aLowerRight.Y() > aSize.Height()) - _nScrollY = (aLowerRight.Y() - aSize.Height() + TABWIN_SPACING_Y); - + if ( aLowerRight.Y() > aSize.Height() ) + _nScrollY = aLowerRight.Y() - aSize.Height() + TABWIN_SPACING_Y; // upper border - if (aUpperLeft.Y() - _nScrollY < 0) + if ( (aUpperLeft.Y() - _nScrollY) < 0 ) _nScrollY = aUpperLeft.Y() - TABWIN_SPACING_Y; } - if (aSize.Width() > _rSize.Width() && _nScrollX) + if (aSize.Width() > _rSize.Width() && _nScrollX ) bVisbile = isScrollAllowed(_pView,_nScrollX, TRUE); - if (aSize.Height() > _rSize.Height() && _nScrollY) + if (aSize.Height() > _rSize.Height() && _nScrollY ) bVisbile = bVisbile && isScrollAllowed(_pView,_nScrollY, FALSE); - if( (_rPoint.X() + _rSize.Width() +_nScrollX + 1) >= _pView->GetHScrollBar()->GetRangeMax() ) - bVisbile = FALSE; - else if( (_rPoint.Y() + _rSize.Height() + _nScrollY + 1) >= _pView->GetVScrollBar()->GetRangeMax() ) - bVisbile = FALSE; + if ( bVisbile ) + { + sal_Int32 nHRangeMax = _pView->GetHScrollBar()->GetRangeMax(); + sal_Int32 nVRangeMax = _pView->GetVScrollBar()->GetRangeMax(); + if ( aSize.Width() + _pView->GetHScrollBar()->GetThumbPos() + _nScrollX > nHRangeMax ) + bVisbile = FALSE; + if ( bVisbile && aSize.Height() + _pView->GetVScrollBar()->GetThumbPos() + _nScrollY > nVRangeMax ) + bVisbile = FALSE; + } } @@ -1020,6 +1024,10 @@ void OJoinTableView::SelectConn(OTableConnection* pConn) DBG_CHKTHIS(OJoinTableView,NULL); DeselectConn(GetSelectedConn()); + pConn->Select(); + m_pSelectedConn = pConn; + GrabFocus(); // has to be called here because a table window may still be focused + // die betroffenene Eintraege in den Windows selektieren OTableWindow* pConnSource = pConn->GetSourceWin(); OTableWindow* pConnDest = pConn->GetDestWin(); @@ -1066,9 +1074,6 @@ void OJoinTableView::SelectConn(OTableConnection* pConn) Invalidate(INVALIDATE_NOCHILDREN); } } - - pConn->Select(); - m_pSelectedConn = pConn; } //------------------------------------------------------------------------------ void OJoinTableView::Paint( const Rectangle& rRect ) @@ -1692,10 +1697,16 @@ void OJoinTableView::lookForUiActivities() { } // ----------------------------------------------------------------------------- +void OJoinTableView::LoseFocus() +{ + DeselectConn(GetSelectedConn()); + Window::LoseFocus(); +} +// ----------------------------------------------------------------------------- void OJoinTableView::GetFocus() { Window::GetFocus(); - if ( !m_aTableMap.empty() ) + if ( !m_aTableMap.empty() && !GetSelectedConn() ) GrabTabWinFocus(); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index f7ca5eb700bb..40f315b4b5c7 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -2,9 +2,9 @@ * * $RCSfile: SelectionBrowseBox.cxx,v $ * - * $Revision: 1.41 $ + * $Revision: 1.42 $ * - * last change: $Author: fs $ $Date: 2002-05-24 12:58:56 $ + * last change: $Author: oj $ $Date: 2002-06-21 07:06:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1204,13 +1204,23 @@ void OSelectionBrowseBox::KeyInput( const KeyEvent& rEvt ) sal_Int8 OSelectionBrowseBox::AcceptDrop( const BrowserAcceptDropEvent& rEvt ) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); + sal_Int8 nDropAction = DND_ACTION_NONE; if ( (rEvt.GetColumnId() >= 0) && (rEvt.GetRow() >= -1) - && OJoinExchObj::isFormatAvailable(GetDataFlavors()) ) - return DND_ACTION_LINK; + { + if ( IsEditing() ) + { + // #100271# OJ allow the asterix again + SaveModified(); + DeactivateCell(); + } + // check if the format is already supported, if not deactivate the current cell and try again + if ( OJoinExchObj::isFormatAvailable(GetDataFlavors()) ) + nDropAction = DND_ACTION_LINK; + } - return DND_ACTION_NONE; + return nDropAction; } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index 23904a7a7257..a658145a69a7 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.19 $ + * $Revision: 1.20 $ * - * last change: $Author: fs $ $Date: 2002-06-11 07:33:43 $ + * last change: $Author: oj $ $Date: 2002-06-21 07:06:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -522,14 +522,6 @@ void OTableWindow::MouseButtonDown( const MouseEvent& rEvt ) void OTableWindow::Resize() { ////////////////////////////////////////////////////////////////////// - // Modify Flag des Documents nicht beim ersten Resize setzen - if( IsVisible() ) - { - OJoinTableView* pTabWinCont = getTableView(); -// pTabWinCont->GetViewShell()->GetShell->SetModified( TRUE ); - } - - ////////////////////////////////////////////////////////////////////// // Das Fenster darf nicht verschwinden, deshalb min. Groesse setzen Size aOutSize = GetOutputSizePixel(); aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height())); @@ -609,18 +601,11 @@ BOOL OTableWindow::HandleKeyInput( const KeyEvent& rEvt ) BOOL bHandle = FALSE; -// if ( rCode.IsMod2() ) -// { -// m_nMoveCount = 0; // reset our move ment count -// m_nMoveIncrement = 1; -// } if( !bCtrl && !bShift && (nCode==KEY_DELETE) ) { Remove(); bHandle = TRUE; } -// else -// Window::KeyInput( rEvt ); return bHandle; } @@ -734,6 +719,12 @@ long OTableWindow::PreNotify(NotifyEvent& rNEvt) if ( rCode.IsMod1() ) { Point aStartPoint = GetPosPixel(); + if ( rCode.IsShift() ) + { + aStartPoint.X() = GetSizePixel().Width(); + aStartPoint.Y() = GetSizePixel().Height(); + } + switch( rCode.GetCode() ) { case KEY_DOWN: @@ -753,29 +744,51 @@ long OTableWindow::PreNotify(NotifyEvent& rNEvt) aStartPoint.X() += m_nMoveIncrement; break; } - if( bHandled )//&& aStartPoint.X() > -1 && aStartPoint.Y() > -1 ) + if ( bHandled ) { - // remember how often the user moved our window - ++m_nMoveCount; - if( m_nMoveCount == 5 ) - m_nMoveIncrement = 10; - else if( m_nMoveCount > 15 ) - m_nMoveCount = m_nMoveIncrement = 20; - - Point aOldDataPoint = GetData()->GetPosition(); - Point aNewDataPoint = aStartPoint + getTableView()->GetScrollOffset(); - if ( aNewDataPoint.X() > -1 && aNewDataPoint.Y() > -1 ) + 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 ); +// } + } + else { - OJoinTableView* pView = getTableView(); - if ( pView->isMovementAllowed(aNewDataPoint, GetData()->GetSize()) ) + // remember how often the user moved our window + ++m_nMoveCount; + if( m_nMoveCount == 5 ) + m_nMoveIncrement = 10; + else if( m_nMoveCount > 15 ) + m_nMoveCount = m_nMoveIncrement = 20; + + Point aOldDataPoint = GetData()->GetPosition(); + Point aNewDataPoint = aStartPoint + getTableView()->GetScrollOffset(); + if ( aNewDataPoint.X() > -1 && aNewDataPoint.Y() > -1 ) { - SetPosPixel(aStartPoint); - - // aNewDataPoint can not be used here because SetPosPixel reset it - pView->EnsureVisible(GetData()->GetPosition(), GetData()->GetSize()); - pView->TabWinMoved(this,aOldDataPoint); - Invalidate(INVALIDATE_NOCHILDREN); - getDesignView()->getController()->setModified( sal_True ); + OJoinTableView* pView = getTableView(); + if ( pView->isMovementAllowed(aNewDataPoint, GetData()->GetSize()) ) + { + SetPosPixel(aStartPoint); + + // aNewDataPoint can not be used here because SetPosPixel reset it + pView->EnsureVisible(GetData()->GetPosition(), GetData()->GetSize()); + pView->TabWinMoved(this,aOldDataPoint); + Invalidate(INVALIDATE_NOCHILDREN); + getDesignView()->getController()->setModified( sal_True ); + } + else + { + m_nMoveCount = 0; // reset our movement count + m_nMoveIncrement = 1; + } } else { @@ -783,11 +796,6 @@ long OTableWindow::PreNotify(NotifyEvent& rNEvt) m_nMoveIncrement = 1; } } - else - { - m_nMoveCount = 0; // reset our movement count - m_nMoveIncrement = 1; - } } else { diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index 7a1c43452f6d..a923a4fab622 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindowListBox.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: oj $ $Date: 2002-05-22 10:52:13 $ + * last change: $Author: oj $ $Date: 2002-06-21 07:09:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -262,18 +262,16 @@ void OTableWindowListBox::StartDrag( sal_Int8 nAction, const Point& rPosPixel ) OJoinTableView* pCont = m_pTabWin->getTableView(); if (!pCont->getDesignView()->getController()->isReadOnly() && pCont->getDesignView()->getController()->isConnected()) { - sal_Bool bFirst = FirstSelected() != First(); + // #100271# OJ asterix was not allowed to be copied to selection browsebox + sal_Bool bFirstNotAllowed = FirstSelected() == First() && m_pTabWin->GetData()->IsShowAll(); EndSelection(); - if ( !m_pTabWin->GetData()->IsShowAll() || bFirst) - { - // eine Beschreibung der Source - OJoinExchangeData jxdSource(this); - m_bDragSource = sal_True; - // in ein Exchange-Objekt packen - OJoinExchObj* pJoin = new OJoinExchObj(jxdSource); - Reference< XTransferable > xEnsureDelete(pJoin); - pJoin->StartDrag(this, DND_ACTION_LINK, this); - } + // create a description of the source + OJoinExchangeData jxdSource(this); + m_bDragSource = sal_True; + // put it into a exchange object + OJoinExchObj* pJoin = new OJoinExchObj(jxdSource,bFirstNotAllowed); + Reference< XTransferable > xEnsureDelete(pJoin); + pJoin->StartDrag(this, DND_ACTION_LINK, this); } } @@ -282,7 +280,9 @@ sal_Int8 OTableWindowListBox::AcceptDrop( const AcceptDropEvent& _rEvt ) { sal_Int8 nDND_Action = DND_ACTION_NONE; // check the format - if (!m_bDragSource && OJoinExchObj::isFormatAvailable(GetDataFlavorExVector())) + if ( !m_bDragSource + && !OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SOT_FORMATSTR_ID_SBA_TABID) // this means that the first entry is to be draged + && OJoinExchObj::isFormatAvailable(GetDataFlavorExVector(),SOT_FORMATSTR_ID_SBA_JOIN) ) { // don't drop into the window if it's the drag source itself // remove the selection if the dragging operation is leaving the window @@ -365,15 +365,16 @@ void OTableWindowListBox::GetFocus() if (GetCurEntry() != NULL) { - if (GetSelectionCount() == 0) + if ( GetSelectionCount() == 0 || GetCurEntry() != FirstSelected() ) + { + if ( FirstSelected() ) + Select(FirstSelected(), FALSE); Select(GetCurEntry(), TRUE); + } else ShowFocusRect(FirstSelected()); } SvTreeListBox::GetFocus(); - -// if(m_pTabWin) -// m_pTabWin->GrabFocus(); } //------------------------------------------------------------------------------ |