From bfade7477e091a20882a923e645bedf7e16360f5 Mon Sep 17 00:00:00 2001 From: Denjo Date: Sun, 16 Oct 2022 11:54:13 +0900 Subject: [PATCH 1/3] push test --- sw/source/core/undo/docundo.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index c474dd679214f..e3a15909bcedf 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +// push test #include #include From f77eef0049a71d89611606d5bed53f4e4d651b21 Mon Sep 17 00:00:00 2001 From: yuji3333 Date: Mon, 24 Oct 2022 18:49:05 +0900 Subject: [PATCH 2/3] all select Change-Id: If2d292ab562bd2f89c872bc7ba13c681583ee604 --- include/vcl/toolbox.hxx | 1 + sw/source/core/undo/docundo.cxx | 1 + vcl/source/window/toolbox.cxx | 196 ++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+) diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 055d82f1e7228..bef2028c6efbd 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -270,6 +270,7 @@ public: virtual void Select(); virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + void MouseButtonDown2( const MouseEvent& rMEvt ); virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; virtual void MouseMove( const MouseEvent& rMEvt ) override; virtual void Tracking( const TrackingEvent& rTEvt ) override; diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index e3a15909bcedf..c8316435b3302 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -53,6 +53,7 @@ using namespace ::com::sun::star; namespace sw { + UndoManager::UndoManager(std::shared_ptr xUndoNodes, IDocumentDrawModelAccess & rDrawModelAccess, IDocumentRedlineAccess & rRedlineAccess, diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index bd2f5f5ffa357..0cfbf62188b85 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3108,6 +3108,11 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) { if ( (item.meType == ToolBoxItemType::BUTTON) && item.mbEnabled ) { + // if ((nTempPos == 25) || (nTempPos == 26)){ + // return this->MouseButtonDown2(rMEvt); + // } + return this->MouseButtonDown2(rMEvt); + bClearHigh = false; if ( mnHighItemId != item.mnId ) { @@ -3365,6 +3370,197 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) DockingWindow::MouseButtonDown( rMEvt ); } +void ToolBox::MouseButtonDown2( const MouseEvent& rMEvt ) +{ + // only trigger toolbox for left mouse button and when + // we're not in normal operation + if (!mbDrag && (mnCurPos == ITEM_NOTFOUND) ) + { + // call activate already here, as items could + // be exchanged + Activate(); + + // update ToolBox here, such that user knows it + if ( mbFormat ) + { + ImplFormat(); + PaintImmediately(); + } + + Point aMousePos = rMEvt.GetPosPixel(); + ImplToolItems::size_type i = 0; + ImplToolItems::size_type nNewPos = ITEM_NOTFOUND; + + // search for item that was clicked + for (auto const& item : mpData->m_aItems) + { + // is this the item? + if ( item.maRect.Contains( aMousePos ) ) + { + // do nothing if it is a separator or + // if the item has been disabled + if ( (item.meType == ToolBoxItemType::BUTTON) && + !item.mbShowWindow ) + nNewPos = i; + + break; + } + + i++; + } + + // item found + if ( nNewPos != ITEM_NOTFOUND ) + { + if ( !mpData->m_aItems[nNewPos].mbEnabled ) + { + Deactivate(); + return; + } + + // update actual data + StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; + mnCurPos = i; + mnCurItemId = mpData->m_aItems[nNewPos].mnId; + mnDownItemId = mnCurItemId; + mnMouseModifier = rMEvt.GetModifier(); + if ( mpData->m_aItems[nNewPos].mnBits & ToolBoxItemBits::REPEAT ) + nTrackFlags |= StartTrackingFlags::ButtonRepeat; + + // update bDrag here, as it is evaluated in the EndSelection + mbDrag = true; + + // on double-click: only call the handler, but do so before the button + // is hit, as in the handler dragging + // can be terminated + if ( rMEvt.GetClicks() == 2 ) + DoubleClick(); + + if ( mbDrag ) + { + InvalidateItem(mnCurPos); + Highlight(); + } + + // was dropdown arrow pressed + if( mpData->m_aItems[nNewPos].mnBits & ToolBoxItemBits::DROPDOWN ) + { + if( ( (mpData->m_aItems[nNewPos].mnBits & ToolBoxItemBits::DROPDOWNONLY) == ToolBoxItemBits::DROPDOWNONLY) + || mpData->m_aItems[nNewPos].GetDropDownRect( mbHorz ).Contains( aMousePos )) + { + // dropdownonly always triggers the dropdown handler, over the whole button area + + // the drop down arrow should not trigger the item action + mpData->mbDropDownByKeyboard = false; + mpData->maDropdownClickHdl.Call( this ); + + // do not reset data if the dropdown handler opened a floating window + // see ImplFloatControl() + if( !mpFloatWin ) + { + // no floater was opened + Deactivate(); + InvalidateItem(mnCurPos); + + mnCurPos = ITEM_NOTFOUND; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); + mnMouseModifier = 0; + mnHighItemId = ToolBoxItemId(0); + } + return; + } + else // activate long click timer + mpData->maDropdownTimer.Start(); + } + + // call Click handler + if ( rMEvt.GetClicks() != 2 ) + Click(); + + // also call Select handler at repeat + if ( nTrackFlags & StartTrackingFlags::ButtonRepeat ) + Select(); + + // if the actions was not aborted in Click handler + if ( mbDrag ) + StartTracking( nTrackFlags ); + + // if mouse was clicked over an item we + // can abort here + return; + } + + Deactivate(); + + // menu button hit ? + if( mpData->maMenubuttonItem.maRect.Contains( aMousePos ) && ImplHasClippedItems() ) + { + if ( maMenuButtonHdl.IsSet() ) + maMenuButtonHdl.Call( this ); + else + ExecuteCustomMenu( mpData->maMenubuttonItem.maRect ); + return; + } + + // check scroll- and next-buttons here + if ( maUpperRect.Contains( aMousePos ) ) + { + if ( mnCurLine > 1 ) + { + StartTracking(); + mbUpper = true; + mbIn = true; + InvalidateSpin(true, false); + } + return; + } + if ( maLowerRect.Contains( aMousePos ) ) + { + if ( mnCurLine+mnVisLines-1 < mnCurLines ) + { + StartTracking(); + mbLower = true; + mbIn = true; + InvalidateSpin(false); + } + return; + } + + // Linesizing testen + if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING ) + { + sal_uInt16 nLineMode = ImplTestLineSize( aMousePos ); + if ( nLineMode ) + { + ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); + + // call handler, such that we can set the + // dock rectangles + StartDocking(); + + Point aPos = GetParent()->OutputToScreenPixel( GetPosPixel() ); + Size aSize = GetSizePixel(); + aPos = ScreenToOutputPixel( aPos ); + + // start dragging + pMgr->StartDragging( this, aMousePos, tools::Rectangle( aPos, aSize ), + nLineMode ); + return; + } + } + + // no item, then only click or double click + if ( rMEvt.GetClicks() == 2 ) + DoubleClick(); + else + Click(); + } + + if ( !mbDrag && (mnCurPos == ITEM_NOTFOUND) ) + DockingWindow::MouseButtonDown( rMEvt ); +} + void ToolBox::MouseButtonUp( const MouseEvent& rMEvt ) { if ( ImplHandleMouseButtonUp( rMEvt ) ) From 6e263a90895d1c2d2dbc0a11508c6de7168aaa7e Mon Sep 17 00:00:00 2001 From: yuji3333 Date: Wed, 26 Oct 2022 10:57:27 +0900 Subject: [PATCH 3/3] add mousehover Change-Id: I696e01328bcc4d58892da4f78fc197bd54d36094 --- include/vcl/toolbox.hxx | 2 +- vcl/source/window/toolbox.cxx | 245 ++++++++++------------------------ 2 files changed, 74 insertions(+), 173 deletions(-) diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index bef2028c6efbd..8fbbd2d571c76 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -270,7 +270,7 @@ public: virtual void Select(); virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; - void MouseButtonDown2( const MouseEvent& rMEvt ); + void MouseButtonHover( const MouseEvent& rMEvt , const int nTempPos); virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; virtual void MouseMove( const MouseEvent& rMEvt ) override; virtual void Tracking( const TrackingEvent& rTEvt ) override; diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 0cfbf62188b85..1a38d7cdbc560 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3108,10 +3108,9 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) { if ( (item.meType == ToolBoxItemType::BUTTON) && item.mbEnabled ) { - // if ((nTempPos == 25) || (nTempPos == 26)){ - // return this->MouseButtonDown2(rMEvt); - // } - return this->MouseButtonDown2(rMEvt); + if (mpData->m_aItems[nTempPos].mnBits & ToolBoxItemBits::DROPDOWN){ + this->MouseButtonHover(rMEvt, nTempPos); + } bClearHigh = false; if ( mnHighItemId != item.mnId ) @@ -3370,195 +3369,97 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) DockingWindow::MouseButtonDown( rMEvt ); } -void ToolBox::MouseButtonDown2( const MouseEvent& rMEvt ) +void ToolBox::MouseButtonHover( const MouseEvent& rMEvt , const int nTempPos) { - // only trigger toolbox for left mouse button and when - // we're not in normal operation - if (!mbDrag && (mnCurPos == ITEM_NOTFOUND) ) - { - // call activate already here, as items could - // be exchanged - Activate(); - - // update ToolBox here, such that user knows it - if ( mbFormat ) - { - ImplFormat(); - PaintImmediately(); - } - Point aMousePos = rMEvt.GetPosPixel(); - ImplToolItems::size_type i = 0; - ImplToolItems::size_type nNewPos = ITEM_NOTFOUND; + // call activate already here, as items could + // be exchanged + Activate(); - // search for item that was clicked - for (auto const& item : mpData->m_aItems) - { - // is this the item? - if ( item.maRect.Contains( aMousePos ) ) - { - // do nothing if it is a separator or - // if the item has been disabled - if ( (item.meType == ToolBoxItemType::BUTTON) && - !item.mbShowWindow ) - nNewPos = i; - - break; - } - - i++; - } - - // item found - if ( nNewPos != ITEM_NOTFOUND ) - { - if ( !mpData->m_aItems[nNewPos].mbEnabled ) - { - Deactivate(); - return; - } - - // update actual data - StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; - mnCurPos = i; - mnCurItemId = mpData->m_aItems[nNewPos].mnId; - mnDownItemId = mnCurItemId; - mnMouseModifier = rMEvt.GetModifier(); - if ( mpData->m_aItems[nNewPos].mnBits & ToolBoxItemBits::REPEAT ) - nTrackFlags |= StartTrackingFlags::ButtonRepeat; - - // update bDrag here, as it is evaluated in the EndSelection - mbDrag = true; - - // on double-click: only call the handler, but do so before the button - // is hit, as in the handler dragging - // can be terminated - if ( rMEvt.GetClicks() == 2 ) - DoubleClick(); + // update ToolBox here, such that user knows it + if ( mbFormat ) + { + ImplFormat(); + PaintImmediately(); + } - if ( mbDrag ) - { - InvalidateItem(mnCurPos); - Highlight(); - } + Point aMousePos = rMEvt.GetPosPixel(); - // was dropdown arrow pressed - if( mpData->m_aItems[nNewPos].mnBits & ToolBoxItemBits::DROPDOWN ) - { - if( ( (mpData->m_aItems[nNewPos].mnBits & ToolBoxItemBits::DROPDOWNONLY) == ToolBoxItemBits::DROPDOWNONLY) - || mpData->m_aItems[nNewPos].GetDropDownRect( mbHorz ).Contains( aMousePos )) - { - // dropdownonly always triggers the dropdown handler, over the whole button area - // the drop down arrow should not trigger the item action - mpData->mbDropDownByKeyboard = false; - mpData->maDropdownClickHdl.Call( this ); + if ( !mpData->m_aItems[nTempPos].mbEnabled ) + { + Deactivate(); + return; + } - // do not reset data if the dropdown handler opened a floating window - // see ImplFloatControl() - if( !mpFloatWin ) - { - // no floater was opened - Deactivate(); - InvalidateItem(mnCurPos); + // update actual data + StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; + mnCurPos = nTempPos; + mnCurItemId = mpData->m_aItems[nTempPos].mnId; + mnDownItemId = mnCurItemId; + mnMouseModifier = rMEvt.GetModifier(); + if ( mpData->m_aItems[nTempPos].mnBits & ToolBoxItemBits::REPEAT ) + nTrackFlags |= StartTrackingFlags::ButtonRepeat; - mnCurPos = ITEM_NOTFOUND; - mnCurItemId = ToolBoxItemId(0); - mnDownItemId = ToolBoxItemId(0); - mnMouseModifier = 0; - mnHighItemId = ToolBoxItemId(0); - } - return; - } - else // activate long click timer - mpData->maDropdownTimer.Start(); - } + // update bDrag here, as it is evaluated in the EndSelection + mbDrag = true; - // call Click handler - if ( rMEvt.GetClicks() != 2 ) - Click(); + // on double-click: only call the handler, but do so before the button + // is hit, as in the handler dragging + // can be terminated + if ( rMEvt.GetClicks() == 2 ) + DoubleClick(); - // also call Select handler at repeat - if ( nTrackFlags & StartTrackingFlags::ButtonRepeat ) - Select(); + if ( mbDrag ) + { + InvalidateItem(mnCurPos); + Highlight(); + } - // if the actions was not aborted in Click handler - if ( mbDrag ) - StartTracking( nTrackFlags ); - // if mouse was clicked over an item we - // can abort here - return; - } + if( ( (mpData->m_aItems[nTempPos].mnBits & ToolBoxItemBits::DROPDOWNONLY) == ToolBoxItemBits::DROPDOWNONLY) + || mpData->m_aItems[nTempPos].GetDropDownRect( mbHorz ).Contains( aMousePos )) + { + // dropdownonly always triggers the dropdown handler, over the whole button area - Deactivate(); + // the drop down arrow should not trigger the item action + mpData->mbDropDownByKeyboard = false; + mpData->maDropdownClickHdl.Call( this ); - // menu button hit ? - if( mpData->maMenubuttonItem.maRect.Contains( aMousePos ) && ImplHasClippedItems() ) + // do not reset data if the dropdown handler opened a floating window + // see ImplFloatControl() + if( !mpFloatWin ) { - if ( maMenuButtonHdl.IsSet() ) - maMenuButtonHdl.Call( this ); - else - ExecuteCustomMenu( mpData->maMenubuttonItem.maRect ); - return; - } + // no floater was opened + Deactivate(); + InvalidateItem(mnCurPos); - // check scroll- and next-buttons here - if ( maUpperRect.Contains( aMousePos ) ) - { - if ( mnCurLine > 1 ) - { - StartTracking(); - mbUpper = true; - mbIn = true; - InvalidateSpin(true, false); - } - return; + mnCurPos = ITEM_NOTFOUND; + mnCurItemId = ToolBoxItemId(0); + mnDownItemId = ToolBoxItemId(0); + mnMouseModifier = 0; + mnHighItemId = ToolBoxItemId(0); } - if ( maLowerRect.Contains( aMousePos ) ) - { - if ( mnCurLine+mnVisLines-1 < mnCurLines ) - { - StartTracking(); - mbLower = true; - mbIn = true; - InvalidateSpin(false); - } - return; - } - - // Linesizing testen - if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING ) - { - sal_uInt16 nLineMode = ImplTestLineSize( aMousePos ); - if ( nLineMode ) - { - ImplTBDragMgr* pMgr = ImplGetTBDragMgr(); - - // call handler, such that we can set the - // dock rectangles - StartDocking(); + return; + } + else // activate long click timer + mpData->maDropdownTimer.Start(); - Point aPos = GetParent()->OutputToScreenPixel( GetPosPixel() ); - Size aSize = GetSizePixel(); - aPos = ScreenToOutputPixel( aPos ); + // call Click handler + if ( rMEvt.GetClicks() != 2 ) + Click(); - // start dragging - pMgr->StartDragging( this, aMousePos, tools::Rectangle( aPos, aSize ), - nLineMode ); - return; - } - } + // also call Select handler at repeat + if ( nTrackFlags & StartTrackingFlags::ButtonRepeat ) + Select(); - // no item, then only click or double click - if ( rMEvt.GetClicks() == 2 ) - DoubleClick(); - else - Click(); - } + // if the actions was not aborted in Click handler + if ( mbDrag ) + StartTracking( nTrackFlags ); - if ( !mbDrag && (mnCurPos == ITEM_NOTFOUND) ) - DockingWindow::MouseButtonDown( rMEvt ); + // if mouse was clicked over an item we + // can abort here + return; } void ToolBox::MouseButtonUp( const MouseEvent& rMEvt )