2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 17:02:47 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-02-26 09:41:22 +00:00
|
|
|
|
|
|
|
#include <vcl/scrbar.hxx>
|
|
|
|
#include <svx/svdview.hxx>
|
|
|
|
#include "dlgedfunc.hxx"
|
2001-03-23 15:13:46 +00:00
|
|
|
#include "dlged.hxx"
|
2003-03-26 11:49:19 +00:00
|
|
|
#include "dlgedview.hxx"
|
2001-02-26 09:41:22 +00:00
|
|
|
#include <vcl/seleng.hxx>
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
namespace basctl
|
|
|
|
{
|
2001-10-17 09:17:18 +00:00
|
|
|
|
2015-05-04 17:28:40 +02:00
|
|
|
IMPL_LINK_TYPED( DlgEdFunc, ScrollTimeout, Timer *, pTimer, void )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2007-01-16 15:35:04 +00:00
|
|
|
(void)pTimer;
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPos = rWindow.ScreenToOutputPixel( rWindow.GetPointerPosPixel() );
|
|
|
|
aPos = rWindow.PixelToLogic( aPos );
|
2001-02-26 09:41:22 +00:00
|
|
|
ForceScroll( aPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
void DlgEdFunc::ForceScroll( const Point& rPos )
|
|
|
|
{
|
|
|
|
aScrollTimer.Stop();
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2001-02-26 09:41:22 +00:00
|
|
|
|
|
|
|
static Point aDefPoint;
|
2012-09-02 16:21:08 +02:00
|
|
|
Rectangle aOutRect( aDefPoint, rWindow.GetOutputSizePixel() );
|
|
|
|
aOutRect = rWindow.PixelToLogic( aOutRect );
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
ScrollBar* pHScroll = rParent.GetHScroll();
|
|
|
|
ScrollBar* pVScroll = rParent.GetVScroll();
|
2001-02-26 09:41:22 +00:00
|
|
|
long nDeltaX = pHScroll->GetLineSize();
|
|
|
|
long nDeltaY = pVScroll->GetLineSize();
|
|
|
|
|
|
|
|
if( !aOutRect.IsInside( rPos ) )
|
|
|
|
{
|
|
|
|
if( rPos.X() < aOutRect.Left() )
|
|
|
|
nDeltaX = -nDeltaX;
|
2013-02-25 17:52:23 +01:00
|
|
|
else if( rPos.X() <= aOutRect.Right() )
|
2001-02-26 09:41:22 +00:00
|
|
|
nDeltaX = 0;
|
|
|
|
|
|
|
|
if( rPos.Y() < aOutRect.Top() )
|
|
|
|
nDeltaY = -nDeltaY;
|
2013-02-25 17:52:23 +01:00
|
|
|
else if( rPos.Y() <= aOutRect.Bottom() )
|
2001-02-26 09:41:22 +00:00
|
|
|
nDeltaY = 0;
|
|
|
|
|
|
|
|
if( nDeltaX )
|
|
|
|
pHScroll->SetThumbPos( pHScroll->GetThumbPos() + nDeltaX );
|
|
|
|
if( nDeltaY )
|
|
|
|
pVScroll->SetThumbPos( pVScroll->GetThumbPos() + nDeltaY );
|
|
|
|
|
|
|
|
if( nDeltaX )
|
2012-09-02 16:21:08 +02:00
|
|
|
rParent.DoScroll( pHScroll );
|
2001-02-26 09:41:22 +00:00
|
|
|
if( nDeltaY )
|
2012-09-02 16:21:08 +02:00
|
|
|
rParent.DoScroll( pVScroll );
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
aScrollTimer.Start();
|
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
DlgEdFunc::DlgEdFunc (DlgEditor& rParent_) :
|
|
|
|
rParent(rParent_)
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) );
|
|
|
|
aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
DlgEdFunc::~DlgEdFunc()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFunc::MouseButtonDown( const MouseEvent& )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFunc::MouseButtonUp( const MouseEvent& )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
aScrollTimer.Stop();
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFunc::MouseMove( const MouseEvent& )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
bool bReturn = false;
|
2002-04-24 13:52:16 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
2014-08-23 22:22:32 +03:00
|
|
|
vcl::KeyCode aCode = rKEvt.GetKeyCode();
|
2011-01-14 11:16:25 +01:00
|
|
|
sal_uInt16 nCode = aCode.GetCode();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
switch ( nCode )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2002-04-24 13:52:16 +00:00
|
|
|
case KEY_ESCAPE:
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsAction() )
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.BrkAction();
|
2012-08-07 08:36:40 +02:00
|
|
|
bReturn = true;
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
2012-09-02 16:21:08 +02:00
|
|
|
else if ( rView.AreObjectsMarked() )
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
const SdrHdlList& rHdlList = rView.GetHdlList();
|
2002-04-24 13:52:16 +00:00
|
|
|
SdrHdl* pHdl = rHdlList.GetFocusHdl();
|
|
|
|
if ( pHdl )
|
2012-09-02 16:21:08 +02:00
|
|
|
const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
|
2002-04-24 13:52:16 +00:00
|
|
|
else
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.UnmarkAll();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bReturn = true;
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case KEY_TAB:
|
|
|
|
{
|
|
|
|
if ( !aCode.IsMod1() && !aCode.IsMod2() )
|
|
|
|
{
|
|
|
|
// mark next object
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( !rView.MarkNextObj( !aCode.IsShift() ) )
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
|
|
|
// if no next object, mark first/last
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.UnmarkAllObj();
|
|
|
|
rView.MarkNextObj( !aCode.IsShift() );
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.AreObjectsMarked() )
|
|
|
|
rView.MakeVisible( rView.GetAllMarkedRect(), rWindow );
|
2002-04-24 13:52:16 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bReturn = true;
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
else if ( aCode.IsMod1() )
|
|
|
|
{
|
|
|
|
// selected handle
|
2012-09-02 16:21:08 +02:00
|
|
|
const SdrHdlList& rHdlList = rView.GetHdlList();
|
|
|
|
const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl( !aCode.IsShift() );
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
// guarantee visibility of focused handle
|
2012-09-02 16:21:08 +02:00
|
|
|
if (SdrHdl* pHdl = rHdlList.GetFocusHdl())
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
|
|
|
Point aHdlPosition( pHdl->GetPos() );
|
|
|
|
Rectangle aVisRect( aHdlPosition - Point( 100, 100 ), Size( 200, 200 ) );
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.MakeVisible( aVisRect, rWindow );
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bReturn = true;
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
2002-04-24 13:52:16 +00:00
|
|
|
break;
|
|
|
|
case KEY_UP:
|
|
|
|
case KEY_DOWN:
|
|
|
|
case KEY_LEFT:
|
|
|
|
case KEY_RIGHT:
|
|
|
|
{
|
|
|
|
long nX = 0;
|
|
|
|
long nY = 0;
|
|
|
|
|
|
|
|
if ( nCode == KEY_UP )
|
|
|
|
{
|
|
|
|
// scroll up
|
|
|
|
nX = 0;
|
|
|
|
nY = -1;
|
|
|
|
}
|
|
|
|
else if ( nCode == KEY_DOWN )
|
|
|
|
{
|
|
|
|
// scroll down
|
|
|
|
nX = 0;
|
|
|
|
nY = 1;
|
|
|
|
}
|
|
|
|
else if ( nCode == KEY_LEFT )
|
|
|
|
{
|
|
|
|
// scroll left
|
|
|
|
nX = -1;
|
|
|
|
nY = 0;
|
|
|
|
}
|
|
|
|
else if ( nCode == KEY_RIGHT )
|
|
|
|
{
|
|
|
|
// scroll right
|
|
|
|
nX = 1;
|
|
|
|
nY = 0;
|
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.AreObjectsMarked() && !aCode.IsMod1() )
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
|
|
|
if ( aCode.IsMod2() )
|
|
|
|
{
|
|
|
|
// move in 1 pixel distance
|
2012-09-02 16:21:08 +02:00
|
|
|
Size aPixelSize = rWindow.PixelToLogic(Size(1, 1));
|
2002-04-24 13:52:16 +00:00
|
|
|
nX *= aPixelSize.Width();
|
|
|
|
nY *= aPixelSize.Height();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move in 1 mm distance
|
|
|
|
nX *= 100;
|
|
|
|
nY *= 100;
|
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
const SdrHdlList& rHdlList = rView.GetHdlList();
|
2002-04-24 13:52:16 +00:00
|
|
|
SdrHdl* pHdl = rHdlList.GetFocusHdl();
|
|
|
|
|
|
|
|
if ( pHdl == 0 )
|
|
|
|
{
|
|
|
|
// no handle selected
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsMoveAllowed() )
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
|
|
|
// restrict movement to work area
|
2012-09-02 16:21:08 +02:00
|
|
|
const Rectangle& rWorkArea = rView.GetWorkArea();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
if ( !rWorkArea.IsEmpty() )
|
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
Rectangle aMarkRect( rView.GetMarkedObjRect() );
|
2002-04-24 13:52:16 +00:00
|
|
|
aMarkRect.Move( nX, nY );
|
|
|
|
|
|
|
|
if ( !rWorkArea.IsInside( aMarkRect ) )
|
|
|
|
{
|
|
|
|
if ( aMarkRect.Left() < rWorkArea.Left() )
|
|
|
|
nX += rWorkArea.Left() - aMarkRect.Left();
|
|
|
|
|
|
|
|
if ( aMarkRect.Right() > rWorkArea.Right() )
|
|
|
|
nX -= aMarkRect.Right() - rWorkArea.Right();
|
|
|
|
|
|
|
|
if ( aMarkRect.Top() < rWorkArea.Top() )
|
|
|
|
nY += rWorkArea.Top() - aMarkRect.Top();
|
|
|
|
|
|
|
|
if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
|
|
|
|
nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nX != 0 || nY != 0 )
|
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.MoveAllMarked( Size( nX, nY ) );
|
|
|
|
rView.MakeVisible( rView.GetAllMarkedRect(), rWindow );
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move the handle
|
|
|
|
if ( pHdl && ( nX || nY ) )
|
|
|
|
{
|
|
|
|
Point aStartPoint( pHdl->GetPos() );
|
|
|
|
Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
|
2012-09-02 16:21:08 +02:00
|
|
|
const SdrDragStat& rDragStat = rView.GetDragStat();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
// start dragging
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.BegDragObj( aStartPoint, 0, pHdl, 0 );
|
2002-04-24 13:52:16 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsDragObj() )
|
2002-04-24 13:52:16 +00:00
|
|
|
{
|
2012-08-07 08:36:40 +02:00
|
|
|
bool const bWasNoSnap = rDragStat.IsNoSnap();
|
2012-09-02 16:21:08 +02:00
|
|
|
bool const bWasSnapEnabled = rView.IsSnapEnabled();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
// switch snapping off
|
|
|
|
if ( !bWasNoSnap )
|
2012-09-02 16:21:08 +02:00
|
|
|
const_cast<SdrDragStat&>(rDragStat).SetNoSnap(true);
|
2002-04-24 13:52:16 +00:00
|
|
|
if ( bWasSnapEnabled )
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetSnapEnabled(false);
|
2002-04-24 13:52:16 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.MovAction( aEndPoint );
|
|
|
|
rView.EndDragObj();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
// restore snap
|
|
|
|
if ( !bWasNoSnap )
|
2012-09-02 16:21:08 +02:00
|
|
|
const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap );
|
2002-04-24 13:52:16 +00:00
|
|
|
if ( bWasSnapEnabled )
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetSnapEnabled( bWasSnapEnabled );
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// make moved handle visible
|
|
|
|
Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) );
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.MakeVisible( aVisRect, rWindow );
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// scroll page
|
2012-09-02 16:21:08 +02:00
|
|
|
ScrollBar* pScrollBar = ( nX != 0 ) ? rParent.GetHScroll() : rParent.GetVScroll();
|
2002-04-24 13:52:16 +00:00
|
|
|
if ( pScrollBar )
|
|
|
|
{
|
|
|
|
long nRangeMin = pScrollBar->GetRangeMin();
|
|
|
|
long nRangeMax = pScrollBar->GetRangeMax();
|
|
|
|
long nThumbPos = pScrollBar->GetThumbPos() + ( ( nX != 0 ) ? nX : nY ) * pScrollBar->GetLineSize();
|
|
|
|
if ( nThumbPos < nRangeMin )
|
|
|
|
nThumbPos = nRangeMin;
|
|
|
|
if ( nThumbPos > nRangeMax )
|
|
|
|
nThumbPos = nRangeMax;
|
|
|
|
pScrollBar->SetThumbPos( nThumbPos );
|
2012-09-02 16:21:08 +02:00
|
|
|
rParent.DoScroll( pScrollBar );
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bReturn = true;
|
2002-04-24 13:52:16 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
}
|
|
|
|
break;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
if ( bReturn )
|
2012-09-02 16:21:08 +02:00
|
|
|
rWindow.ReleaseMouse();
|
2002-04-24 13:52:16 +00:00
|
|
|
|
|
|
|
return bReturn;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
DlgEdFuncInsert::DlgEdFuncInsert (DlgEditor& rParent_) :
|
|
|
|
DlgEdFunc(rParent_)
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
rParent.GetView().SetCreateMode(true);
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DlgEdFuncInsert::~DlgEdFuncInsert()
|
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
rParent.GetView().SetEditMode( true );
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
if( !rMEvt.IsLeft() )
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetActualWin(&rWindow);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPos = rWindow.PixelToLogic( rMEvt.GetPosPixel() );
|
|
|
|
sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
|
|
|
sal_uInt16 nDrgLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
rWindow.CaptureMouse();
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2001-10-17 09:17:18 +00:00
|
|
|
if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
|
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrHdl* pHdl = rView.PickHandle(aPos);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2001-10-17 09:17:18 +00:00
|
|
|
// if selected object was hit, drag object
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( pHdl!=NULL || rView.IsMarkedHit(aPos, nHitLog) )
|
2015-06-08 16:23:13 +02:00
|
|
|
rView.BegDragObj(aPos, nullptr, pHdl, nDrgLog);
|
2012-09-02 16:21:08 +02:00
|
|
|
else if ( rView.AreObjectsMarked() )
|
|
|
|
rView.UnmarkAll();
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2001-10-17 09:17:18 +00:00
|
|
|
// if no action, create object
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( !rView.IsAction() )
|
|
|
|
rView.BegCreateObj(aPos);
|
2001-10-17 09:17:18 +00:00
|
|
|
}
|
|
|
|
else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
|
|
|
|
{
|
|
|
|
// if object was hit, show property browser
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsMarkedHit(aPos, nHitLog) && rParent.GetMode() != DlgEditor::READONLY )
|
|
|
|
rParent.ShowProperties();
|
2001-10-17 09:17:18 +00:00
|
|
|
}
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
DlgEdFunc::MouseButtonUp( rMEvt );
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetActualWin(&rWindow);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
rWindow.ReleaseMouse();
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2001-03-23 15:13:46 +00:00
|
|
|
// object creation active?
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsCreateObj() )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.EndCreateObj(SDRCREATE_FORCEEND);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( !rView.AreObjectsMarked() )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
|
|
|
Point aPos( rWindow.PixelToLogic( rMEvt.GetPosPixel() ) );
|
|
|
|
rView.MarkObj(aPos, nHitLog);
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
return rView.AreObjectsMarked();
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsDragObj() )
|
|
|
|
rView.EndDragObj( rMEvt.IsMod1() );
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetActualWin(&rWindow);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPos = rWindow.PixelToLogic(rMEvt.GetPosPixel());
|
|
|
|
sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if (rView.IsAction())
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
ForceScroll(aPos);
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.MovAction(aPos);
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2013-12-20 11:25:37 +01:00
|
|
|
rWindow.SetPointer( rView.GetPreferredPointer( aPos, &rWindow, nHitLog ) );
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
DlgEdFuncSelect::DlgEdFuncSelect (DlgEditor& rParent_) :
|
|
|
|
DlgEdFunc(rParent_),
|
2012-08-01 10:05:20 +09:00
|
|
|
bMarkAction(false)
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DlgEdFuncSelect::~DlgEdFuncSelect()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2001-03-23 15:13:46 +00:00
|
|
|
// get view from parent
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetActualWin(&rWindow);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
sal_uInt16 nDrgLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
|
|
|
sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
|
|
|
Point aMDPos = rWindow.PixelToLogic(rMEvt.GetPosPixel());
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2001-10-17 09:17:18 +00:00
|
|
|
if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrHdl* pHdl = rView.PickHandle(aMDPos);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2001-03-23 15:13:46 +00:00
|
|
|
// hit selected object?
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( pHdl!=NULL || rView.IsMarkedHit(aMDPos, nHitLog) )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2015-06-08 16:23:13 +02:00
|
|
|
rView.BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-03-23 15:13:46 +00:00
|
|
|
// if not multi selection, unmark all
|
2001-02-26 09:41:22 +00:00
|
|
|
if ( !rMEvt.IsShift() )
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.UnmarkAll();
|
2001-02-26 09:41:22 +00:00
|
|
|
else
|
|
|
|
{
|
2015-02-14 00:31:54 +02:00
|
|
|
SdrObject* pObj;
|
|
|
|
SdrPageView* pPV;
|
2012-09-02 16:21:08 +02:00
|
|
|
if( rView.PickObj( aMDPos, nHitLog, pObj, pPV ) )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-08-07 14:33:56 +02:00
|
|
|
//if (dynamic_cast<DlgEdForm*>(pObj))
|
2012-09-02 16:21:08 +02:00
|
|
|
// rView.UnmarkAll();
|
2001-04-10 14:18:14 +00:00
|
|
|
//else
|
2012-09-02 16:21:08 +02:00
|
|
|
// rParent.UnmarkDialog();
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.MarkObj(aMDPos, nHitLog) )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2001-03-23 15:13:46 +00:00
|
|
|
// drag object
|
2012-09-02 16:21:08 +02:00
|
|
|
pHdl = rView.PickHandle(aMDPos);
|
2015-06-08 16:23:13 +02:00
|
|
|
rView.BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-03-23 15:13:46 +00:00
|
|
|
// select object
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.BegMarkObj(aMDPos);
|
2012-08-01 10:05:20 +09:00
|
|
|
bMarkAction = true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-10-17 09:17:18 +00:00
|
|
|
else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
|
|
|
|
{
|
|
|
|
// if object was hit, show property browser
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsMarkedHit(aMDPos, nHitLog) && rParent.GetMode() != DlgEditor::READONLY )
|
|
|
|
rParent.ShowProperties();
|
2001-10-17 09:17:18 +00:00
|
|
|
}
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
|
|
|
DlgEdFunc::MouseButtonUp( rMEvt );
|
|
|
|
|
2001-03-23 15:13:46 +00:00
|
|
|
// get view from parent
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetActualWin(&rWindow);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPnt = rWindow.PixelToLogic(rMEvt.GetPosPixel());
|
|
|
|
sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
2001-02-26 09:41:22 +00:00
|
|
|
|
|
|
|
if ( rMEvt.IsLeft() )
|
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
if (rView.IsDragObj())
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2001-03-23 15:13:46 +00:00
|
|
|
// object was dragged
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.EndDragObj( rMEvt.IsMod1() );
|
|
|
|
rView.ForceMarkedToAnotherPage();
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
2012-09-02 16:21:08 +02:00
|
|
|
else if (rView.IsAction())
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.EndAction();
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-01 10:05:20 +09:00
|
|
|
bMarkAction = false;
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2013-12-20 11:25:37 +01:00
|
|
|
rWindow.SetPointer( rView.GetPreferredPointer( aPnt, &rWindow, nHitLog ) );
|
2012-09-02 16:21:08 +02:00
|
|
|
rWindow.ReleaseMouse();
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
SdrView& rView = rParent.GetView();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window& rWindow = rParent.GetWindow();
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.SetActualWin(&rWindow);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPnt = rWindow.PixelToLogic(rMEvt.GetPosPixel());
|
|
|
|
sal_uInt16 nHitLog = static_cast<sal_uInt16>(rWindow.PixelToLogic(Size(3, 0)).Width());
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-09-02 16:21:08 +02:00
|
|
|
if ( rView.IsAction() )
|
2001-02-26 09:41:22 +00:00
|
|
|
{
|
2012-09-02 16:21:08 +02:00
|
|
|
Point aPix = rMEvt.GetPosPixel();
|
|
|
|
Point aPnt_ = rWindow.PixelToLogic(aPix);
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2007-01-16 15:35:04 +00:00
|
|
|
ForceScroll(aPnt_);
|
2012-09-02 16:21:08 +02:00
|
|
|
rView.MovAction(aPnt_);
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
2013-12-20 11:25:37 +01:00
|
|
|
rWindow.SetPointer( rView.GetPreferredPointer( aPnt, &rWindow, nHitLog ) );
|
2001-02-26 09:41:22 +00:00
|
|
|
|
2012-08-07 08:36:40 +02:00
|
|
|
return true;
|
2001-02-26 09:41:22 +00:00
|
|
|
}
|
|
|
|
|
Basic IDE: namespace basctl
Now all names in basctl are in namespace 'basctl'.
There were lots of names that included the word 'Basic' or 'BasicIDE' in
it, e.g. BasicIDEData, BasicDocumentEntry, BasicTreeListBox,
BasicIDEModule, IDEBaseWindow etc. This information is now stored in the
namespace name, so the names could be shortened: basctl::DocumentEntry,
basctl::TreeListBox, basctl::Module, basctl::BaseWindow etc.
Some other minor changes:
* LibInfos, LibInfoItem, LibInfoKey ->
LibInfos, LibInfos::Item, LibInfos::Key
* The header guards are now uniformly BASCTL_FILENAME_HXX, instead of
e.g. _FILENAME_HXX, which is undefined behaviour because of the '_'.
* namespace BasicIDE, BasicIDEGlobals, basicide -> namespace basctl
* BASICIDE_TYPE_MODULE, ... -> basctl::TYPE_MODULE, ...
Change-Id: I2a9b493562d0d8a2510d569798fbe9e1161b7c9b
Reviewed-on: https://gerrit.libreoffice.org/501
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
2012-08-25 12:43:27 +02:00
|
|
|
} // namespace basctl
|
|
|
|
|
2010-10-12 15:57:08 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|