LibreOffice Module sw (master) 1
trvlcol.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <crsrsh.hxx>
21#include <layfrm.hxx>
22#include <cntfrm.hxx>
23#include <swcrsr.hxx>
24#include <viscrs.hxx>
25#include "callnk.hxx"
26
28{
29 while( pLayFrame && !pLayFrame->IsColumnFrame() )
30 pLayFrame = pLayFrame->GetUpper();
31 return const_cast<SwLayoutFrame*>(pLayFrame);
32}
33
35{
36 SwLayoutFrame* pActCol = GetCurrColumn( pLayFrame );
37 return pActCol ? static_cast<SwLayoutFrame*>(pActCol->GetNext()) : nullptr;
38}
39
41{
42 SwLayoutFrame* pActCol = GetCurrColumn( pLayFrame );
43 return pActCol ? static_cast<SwLayoutFrame*>(pActCol->GetPrev()) : nullptr;
44}
45
47{
48 return pColFrame ? const_cast<SwContentFrame*>(pColFrame->ContainsContent()) : nullptr;
49}
50
52{
53 SwContentFrame *pRet = GetColumnStt( pColFrame );
54 if( !pRet )
55 return nullptr;
56
57 SwContentFrame *pNxt = pRet->GetNextContentFrame();
58 while( pNxt && pColFrame->IsAnLower( pNxt ) )
59 {
60 pRet = pNxt;
61 pNxt = pNxt->GetNextContentFrame();
62 }
63 return pRet;
64}
65
67{
68 if( m_pTableCursor )
69 return;
70 SwLayoutFrame* pLayFrame = GetCurrFrame()->GetUpper();
71 if( !pLayFrame )
72 return;
73 pLayFrame = (*fnWhichCol)( pLayFrame );
74 if( !pLayFrame )
75 return;
76
77 SwContentFrame* pCnt = (*fnPosCol)( pLayFrame );
78 if( !pCnt )
79 return;
80
81 CurrShell aCurr( this );
82 SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
84
85 pCnt->Calc(GetOut());
86
87 Point aPt( pCnt->getFrameArea().Pos() + pCnt->getFramePrintArea().Pos() );
88 if( fnPosCol == GetColumnEnd )
89 {
90 aPt.setX(aPt.getX() + pCnt->getFramePrintArea().Width());
91 aPt.setY(aPt.getY() + pCnt->getFramePrintArea().Height());
92 }
93
95
96 if( !m_pCurrentCursor->IsInProtectTable( true ) &&
98 {
100 }
101}
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:120
A helper class to save cursor state (position).
Definition: swcrsr.hxx:233
SAL_DLLPRIVATE void UpdateCursor(sal_uInt16 eFlags=SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd=false)
Definition: crsrsh.cxx:1876
void MoveColumn(SwWhichColumn, SwPosColumn)
Definition: trvlcol.cxx:66
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2771
SwShellTableCursor * m_pTableCursor
table Cursor; only in tables when the selection lays over 2 columns
Definition: crsrsh.hxx:192
SwShellCursor * m_pCurrentCursor
current cursor
Definition: crsrsh.hxx:186
virtual bool IsSelOvr(SwCursorSelOverFlags eFlags=SwCursorSelOverFlags::CheckNodeSection|SwCursorSelOverFlags::Toggle|SwCursorSelOverFlags::ChangePos)
Definition: swcrsr.cxx:222
bool IsInProtectTable(bool bMove=false, bool bChgCursor=true)
Definition: swcrsr.cxx:557
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
SwFrame * GetNext()
Definition: frame.hxx:682
bool IsColumnFrame() const
Definition: frame.hxx:1188
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1799
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const
Definition: unusedf.cxx:47
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
SwFrame * GetPrev()
Definition: frame.hxx:683
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:233
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:72
const SwPosition * GetPoint() const
Definition: pam.hxx:253
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void Width(tools::Long nNew)
Definition: swrect.hxx:189
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:365
SwContentFrame *(* SwPosColumn)(const SwLayoutFrame *)
Definition: cshtyp.hxx:67
SwLayoutFrame *(* SwWhichColumn)(const SwLayoutFrame *)
Definition: cshtyp.hxx:66
SwContentFrame * GetColumnEnd(const SwLayoutFrame *pColFrame)
Definition: trvlcol.cxx:51
SwLayoutFrame * GetPrevColumn(const SwLayoutFrame *pLayFrame)
Definition: trvlcol.cxx:40
SwLayoutFrame * GetCurrColumn(const SwLayoutFrame *pLayFrame)
Definition: trvlcol.cxx:27
SwLayoutFrame * GetNextColumn(const SwLayoutFrame *pLayFrame)
Definition: trvlcol.cxx:34
SwContentFrame * GetColumnStt(const SwLayoutFrame *pColFrame)
Definition: trvlcol.cxx:46