/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
#ifdef _WIN32
ScTabViewShell* pViewShell = m_rViewData.GetViewShell(); bool bRefMode = pViewShell && pViewShell->IsRefInputMode(); if (bRefMode && nUpdateInterval < SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN) // Lower the update interval during ref mode, because re-draw can be // expensive on Windows. Making this interval too small would queue up // the scroll/paint requests which would cause semi-infinite // scrolls even after the mouse cursor is released. We don't have // this problem on Linux.
nUpdateInterval = SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN; #endif return nUpdateInterval;
}
void ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool/* bDontSelectAtCursor */ )
{ if ( bDidSwitch )
{ if ( rPointPixel == aSwitchPos ) return; // don't scroll in wrong window else
bDidSwitch = false;
}
aSwitchPos = rPointPixel; // only important, if bDidSwitch
// treat position 0 as -1, so scrolling is always possible // (with full screen and hidden headers, the top left border may be at 0) // (moved from ScViewData::GetPosFromPixel)
Point aEffPos = rPointPixel; if ( aEffPos.X() == 0 )
aEffPos.setX( -1 ); if ( aEffPos.Y() == 0 )
aEffPos.setY( -1 );
bool bFillingSelection = m_rViewData.IsFillMode() || m_rViewData.GetFillMode() == ScFillMode::MATRIX; bool bBottomScroll; bool bRightScroll; // for Autofill don't yet assume we want to auto-scroll to the cell under the mouse // because the autofill handle extends into a cells neighbours so initial click is usually // above a neighbour cell if (bFillingSelection)
{
bBottomScroll = aEffPos.Y() >= aWinSize.Height();
bRightScroll = aEffPos.X() >= aWinSize.Width();
} else
{ //in the normal case make the full selected cell visible
bBottomScroll = aEditArea.Bottom() >= aWinSize.Height();
bRightScroll = aEditArea.Right() >= aWinSize.Width();
}
if (bScroll)
{ // Adjust update interval based on how far the mouse pointer is from the edge.
sal_uInt64 nUpdateInterval = CalcUpdateInterval(
aWinSize, aEffPos, bLeftScroll, bTopScroll, bRightScroll, bBottomScroll);
m_pEngine->SetUpdateInterval(nUpdateInterval);
} else
{ // Don't forget to reset the interval when not scrolling!
m_pEngine->SetUpdateInterval(SELENG_AUTOREPEAT_INTERVAL);
}
if (bRefMode)
{ // if no input is possible from this doc, don't move the reference cursor around if ( !ScModule::get()->IsModalMode(&m_rViewData.GetSfxDocShell()) && (!CheckRefBounds(nPosX, nPosY) || SfxLokHelper::getDeviceFormFactor() != LOKDeviceFormFactor::MOBILE))
{ if (!m_bAnchor)
{
pView->DoneRefMode( true );
pView->InitRefMode( nPosX, nPosY, m_rViewData.GetTabNo(), SC_REFTYPE_REF );
}
pView->SelectionChanged();
}
} elseif (m_rViewData.IsFillMode() ||
(m_rViewData.GetFillMode() == ScFillMode::MATRIX && (nScFillModeMouseModifier & KEY_MOD1) ))
{ // If a matrix got touched, switch back to Autofill is possible with Ctrl
SCCOL nDelStartX = nStartX;
SCROW nDelStartY = nStartY; if ( nSizeX > nSizeY )
nDelStartX = nPosX + 1; else
nDelStartY = nPosY + 1; // there is no need to check for zero, because nPosX/Y is also negative
if ( nDelStartX < nStartX )
nDelStartX = nStartX; if ( nDelStartY < nStartY )
nDelStartY = nStartY;
tools::Long nSizeX = 0; if ( bNegX )
{ // in SetCursorAtPoint hidden columns are skipped. // They must be skipped here too, or the result will always be the first hidden column. do ++nPosX; while ( nPosX<nStartX && rDoc.ColHidden(nPosX, nTab) ); for (SCCOL i=nPosX; i<nStartX; i++)
nSizeX += rDoc.GetColWidth( i, nTab );
} else for (SCCOL i=nEndX+1; i<=nPosX; i++)
nSizeX += rDoc.GetColWidth( i, nTab );
tools::Long nSizeY = 0; if ( bNegY )
{ // in SetCursorAtPoint hidden rows are skipped. // They must be skipped here too, or the result will always be the first hidden row. if (++nPosY < nStartY)
{
nPosY = rDoc.FirstVisibleRow(nPosY, nStartY-1, nTab); if (!rDoc.ValidRow(nPosY))
nPosY = nStartY;
}
nSizeY += rDoc.GetRowHeight( nPosY, nStartY-1, nTab );
} else
nSizeY += rDoc.GetRowHeight( nEndY+1, nPosY, nTab );
if ( nSizeX > nSizeY ) // Fill only ever in one direction
{
nPosY = nEndY;
bNegY = false;
} else
{
nPosX = nEndX;
bNegX = false;
}
if (m_bAnchor)
{ if (!m_bStarted)
{ bool bMove = ( nPosX != m_aAnchorPos.Col() ||
nPosY != m_aAnchorPos.Row() ); if ( bMove || ( m_pEngine && m_pEngine->GetMouseEvent().IsShift() ) )
{
pView->InitBlockMode( m_aAnchorPos.Col(), m_aAnchorPos.Row(),
m_aAnchorPos.Tab(), true );
m_bStarted = true;
}
} if (m_bStarted) // If the selection is already started, don't set the cursor.
pView->MarkCursor( nPosX, nPosY, nTab, false, false, true ); else
pView->SetCursor( nPosX, nPosY );
} else
{
ScMarkData& rMark = m_rViewData.GetMarkData(); if (rMark.IsMarked() || rMark.IsMultiMarked())
{
pView->DoneBlockMode(true);
pView->InitBlockMode( nPosX, nPosY, nTab, true );
pView->MarkCursor( nPosX, nPosY, nTab );
m_aAnchorPos.Set( nPosX, nPosY, nTab );
m_bStarted = true;
} // #i3875# *Hack* When a new cell is Ctrl-clicked with no pre-selected cells, // it highlights that new cell as well as the old cell where the cursor is // positioned prior to the click. A selection mode via Shift-F8 should also // follow the same behavior. elseif ( m_rViewData.IsSelCtrlMouseClick() )
{
SCCOL nOldX = m_rViewData.GetCurX();
SCROW nOldY = m_rViewData.GetCurY();
void ScHeaderFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool/* bDontSelectAtCursor */ )
{ if ( bDidSwitch )
{ // next valid position has to be originated from another window if ( rPointPixel == aSwitchPos ) return; // don't scroll in the wrong window else
bDidSwitch = false;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.