docthemes: Save themes def. to a file when added to ColorSets
[LibreOffice.git] / sw / source / core / crsr / trvlcol.cxx
blobc680e5a87c3f0d9168545a6d04cee42ff6293ca6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <crsrsh.hxx>
21 #include <layfrm.hxx>
22 #include <cntfrm.hxx>
23 #include <swcrsr.hxx>
24 #include <viscrs.hxx>
25 #include "callnk.hxx"
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 );
54 if( !pRet )
55 return nullptr;
57 SwContentFrame *pNxt = pRet->GetNextContentFrame();
58 while( pNxt && pColFrame->IsAnLower( pNxt ) )
60 pRet = pNxt;
61 pNxt = pNxt->GetNextContentFrame();
63 return pRet;
66 void SwCursorShell::MoveColumn( SwWhichColumn fnWhichCol, SwPosColumn fnPosCol )
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;
77 SwContentFrame* pCnt = (*fnPosCol)( pLayFrame );
78 if( !pCnt )
79 return;
81 CurrShell aCurr( this );
82 SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
83 SwCursorSaveState aSaveState( *m_pCurrentCursor );
85 pCnt->Calc(GetOut());
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() )
99 UpdateCursor();
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */