Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #38

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/vcl/toolbox.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public:
virtual void Select();

virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
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;
Expand Down
2 changes: 2 additions & 0 deletions sw/source/core/undo/docundo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/

// push test
#include <UndoManager.hxx>

#include <libxml/xmlwriter.h>
Expand Down Expand Up @@ -52,6 +53,7 @@ using namespace ::com::sun::star;

namespace sw {


UndoManager::UndoManager(std::shared_ptr<SwNodes> xUndoNodes,
IDocumentDrawModelAccess & rDrawModelAccess,
IDocumentRedlineAccess & rRedlineAccess,
Expand Down
97 changes: 97 additions & 0 deletions vcl/source/window/toolbox.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,10 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
{
if ( (item.meType == ToolBoxItemType::BUTTON) && item.mbEnabled )
{
if (mpData->m_aItems[nTempPos].mnBits & ToolBoxItemBits::DROPDOWN){
this->MouseButtonHover(rMEvt, nTempPos);
}

bClearHigh = false;
if ( mnHighItemId != item.mnId )
{
Expand Down Expand Up @@ -3365,6 +3369,99 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt )
DockingWindow::MouseButtonDown( rMEvt );
}

void ToolBox::MouseButtonHover( const MouseEvent& rMEvt , const int nTempPos)
{

// 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();


if ( !mpData->m_aItems[nTempPos].mbEnabled )
{
Deactivate();
return;
}

// 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;

// 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();
}


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

// 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;
}

void ToolBox::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( ImplHandleMouseButtonUp( rMEvt ) )
Expand Down