/* -*- 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 .
*/
// first try to move to the start of the current SwSection return SwCursorShell::MoveRegion( GotoCurrRegionAndSkip, fnRegionStart ) ||
(pMoveTable != nullptr // move to start of text - if in different table, move out
? MoveStartText() // TODO who needs SttEndDoc for other case?
: SwCursorShell::SttEndDoc(true));
}
bool SwWrtShell::GoEnd(bool bKeepArea, constbool *pMoveTable)
{ if (pMoveTable && *pMoveTable) // only in SelAll()
{
SwTableNode const*const pTable(getShellCursor(false)->GetPoint()->GetNode().FindTableNode());
assert(pTable); if (MoveTable(GotoCurrTable, fnTableEnd))
{ returntrue;
} elseif (SwCursor const*const pCursor = getShellCursor(false);
pCursor->GetPoint()->GetNode().GetIndex()
< pTable->GetNodes()[pTable->EndOfSectionIndex()-1]->StartOfSectionIndex() // problem: cursor isn't inside 1st cell, and didn't move there // workaround: try to move cursor outside of table for SelAll()
&& MoveOutOfTable())
{ returntrue;
} else
{ returnfalse;
}
}
// m_bDestOnStack indicates if I could not set the coursor at the current // position, because in this region is no content. if( !m_bDestOnStack )
{
Point aPt( aOldRect.Center() );
if( !IsCursorVisible() ) // set CursorPos to top-/bottom left pos. So the pagescroll is not // be dependent on the current cursor, but on the visarea.
aPt.setY( aTmpArea.Top() + aTmpArea.Height() / 2 );
// If we had a frame selection, it must be removed after the m_fnSetCursor // and we have to remember the position on the stack to return to it later. bool bIsFrameSel = false;
//Target position is now within the viewable region --> //Place the cursor at the target position; remember that no target //position is longer on the stack. //The new visible region is to be determined beforehand.
aTmpArea.Pos().AdjustY(lOffset ); if( aTmpArea.Contains(m_aDest) )
{ if( bSelect )
SttSelect(); else
EndSelect();
// Position into the stack; bDiff indicates if there is a // difference between the old and the new cursor position.
m_pCursorStack.reset( new CursorStack( bDiff, bIsFrameSel, aOldRect.Center(),
lOffset, std::move(m_pCursorStack) ) ); return !m_bDestOnStack && bDiff;
}
constbool bValidPos = m_pCursorStack->bValidCurPos; if( bUpdate && bValidPos )
{ // If a predecessor is on the stack, // use the flag for a valid position.
SwRect aTmpArea(VisArea());
aTmpArea.Pos().AdjustY( -(m_pCursorStack->lOffset) ); if( aTmpArea.Contains( m_pCursorStack->aDocPos ) )
{ if( bSelect )
SttSelect(); else
EndSelect();
(this->*m_fnSetCursor)(&m_pCursorStack->aDocPos, !m_pCursorStack->bIsFrameSel, ScrollSizeMode::ScrollSizeDefault); if( m_pCursorStack->bIsFrameSel && IsObjSelectable(m_pCursorStack->aDocPos))
{
HideCursor();
SelectObj( m_pCursorStack->aDocPos );
EnterSelFrameMode( &m_pCursorStack->aDocPos );
}
} // If a discrepancy between the visible range and the // remembered cursor position occurs, all of the remembered // positions are thrown away. else
{
ResetCursorStack_(); returnfalse;
}
}
m_pCursorStack = std::move(m_pCursorStack->pNext); if( nullptr == m_pCursorStack )
{
m_ePageMove = MV_NO;
m_bDestOnStack = false;
} return bValidPos;
}
// Reset of all pushed cursor positions; these will // not be displayed ( --> No Start-/EndAction!!)
void SwWrtShell::ResetCursorStack_()
{ while(m_pCursorStack)
m_pCursorStack = std::move(m_pCursorStack->pNext);
m_ePageMove = MV_NO;
m_bDestOnStack = false;
} /** if no stack exists --> cancel selection if stack && change of direction --> pop cursor and return else --> push cursor transpose cursor
*/
bool SwWrtShell::PageCursor(SwTwips lOffset, bool bSelect)
{ // Do nothing if an offset of 0 was indicated if(!lOffset) returnfalse; // Was once used to force a reformat of the layout. // This has not work that way, because the cursor was not set // because this does not happen within a // Start-/EndActionParentheses. // Because only SwViewShell::EndAction() is called at the end, // no updating of the display of the cursor position takes place. // The CursorShell-Actionparentheses cannot be used, because it // always leads to displaying the cursor, thus also, // if after the scroll scrolled in a region without a valid position. // SwViewShell::StartAction();
PageMove eDir = lOffset > 0? MV_PAGE_DOWN: MV_PAGE_UP; // Change of direction and stack present if( eDir != m_ePageMove && m_ePageMove != MV_NO && PopCursor( true, bSelect )) returntrue;
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.