1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
27 SwLayoutFrame
* GetCurrColumn( const SwLayoutFrame
* pLayFrame
)
29 while( pLayFrame
&& !pLayFrame
->IsColumnFrame() )
30 pLayFrame
= pLayFrame
->GetUpper();
31 return const_cast<SwLayoutFrame
*>(pLayFrame
);
34 SwLayoutFrame
* GetNextColumn( const SwLayoutFrame
* pLayFrame
)
36 SwLayoutFrame
* pActCol
= GetCurrColumn( pLayFrame
);
37 return pActCol
? static_cast<SwLayoutFrame
*>(pActCol
->GetNext()) : nullptr;
40 SwLayoutFrame
* GetPrevColumn( const SwLayoutFrame
* pLayFrame
)
42 SwLayoutFrame
* pActCol
= GetCurrColumn( pLayFrame
);
43 return pActCol
? static_cast<SwLayoutFrame
*>(pActCol
->GetPrev()) : nullptr;
46 SwContentFrame
* GetColumnStt( const SwLayoutFrame
* pColFrame
)
48 return pColFrame
? const_cast<SwContentFrame
*>(pColFrame
->ContainsContent()) : nullptr;
51 SwContentFrame
* GetColumnEnd( const SwLayoutFrame
* pColFrame
)
53 SwContentFrame
*pRet
= GetColumnStt( pColFrame
);
57 SwContentFrame
*pNxt
= pRet
->GetNextContentFrame();
58 while( pNxt
&& pColFrame
->IsAnLower( pNxt
) )
61 pNxt
= pNxt
->GetNextContentFrame();
66 void SwCursorShell::MoveColumn( SwWhichColumn fnWhichCol
, SwPosColumn fnPosCol
)
70 SwLayoutFrame
* pLayFrame
= GetCurrFrame()->GetUpper();
73 pLayFrame
= (*fnWhichCol
)( pLayFrame
);
77 SwContentFrame
* pCnt
= (*fnPosCol
)( pLayFrame
);
81 CurrShell
aCurr( this );
82 SwCallLink
aLk( *this ); // watch Cursor-Moves; call Link if needed
83 SwCursorSaveState
aSaveState( *m_pCurrentCursor
);
87 Point
aPt( pCnt
->getFrameArea().Pos() + pCnt
->getFramePrintArea().Pos() );
88 if( fnPosCol
== GetColumnEnd
)
90 aPt
.setX(aPt
.getX() + pCnt
->getFramePrintArea().Width());
91 aPt
.setY(aPt
.getY() + pCnt
->getFramePrintArea().Height());
94 pCnt
->GetModelPositionForViewPoint( m_pCurrentCursor
->GetPoint(), aPt
);
96 if( !m_pCurrentCursor
->IsInProtectTable( true ) &&
97 !m_pCurrentCursor
->IsSelOvr() )
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */