1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: trvlcol.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
46 SwLayoutFrm
* GetCurrColumn( const SwLayoutFrm
* pLayFrm
)
48 while( pLayFrm
&& !pLayFrm
->IsColumnFrm() )
49 pLayFrm
= pLayFrm
->GetUpper();
50 return (SwLayoutFrm
*)pLayFrm
;
54 SwLayoutFrm
* GetNextColumn( const SwLayoutFrm
* pLayFrm
)
56 SwLayoutFrm
* pActCol
= GetCurrColumn( pLayFrm
);
57 return pActCol
? (SwLayoutFrm
*)pActCol
->GetNext() : 0;
61 SwLayoutFrm
* GetPrevColumn( const SwLayoutFrm
* pLayFrm
)
63 SwLayoutFrm
* pActCol
= GetCurrColumn( pLayFrm
);
64 return pActCol
? (SwLayoutFrm
*)pActCol
->GetPrev() : 0;
68 SwCntntFrm
* GetColumnStt( const SwLayoutFrm
* pColFrm
)
70 return pColFrm
? (SwCntntFrm
*)pColFrm
->ContainsCntnt() : 0;
74 SwCntntFrm
* GetColumnEnd( const SwLayoutFrm
* pColFrm
)
76 SwCntntFrm
*pRet
= GetColumnStt( pColFrm
);
80 SwCntntFrm
*pNxt
= pRet
->GetNextCntntFrm();
81 while( pNxt
&& pColFrm
->IsAnLower( pNxt
) )
84 pNxt
= pNxt
->GetNextCntntFrm();
90 SwWhichColumn fnColumnPrev
= &GetPrevColumn
;
91 SwWhichColumn fnColumnCurr
= &GetCurrColumn
;
92 SwWhichColumn fnColumnNext
= &GetNextColumn
;
93 SwPosColumn fnColumnStart
= &GetColumnStt
;
94 SwPosColumn fnColumnEnd
= &GetColumnEnd
;
97 BOOL
SwCrsrShell::MoveColumn( SwWhichColumn fnWhichCol
, SwPosColumn fnPosCol
)
102 SwLayoutFrm
* pLayFrm
= GetCurrFrm()->GetUpper();
103 if( pLayFrm
&& 0 != ( pLayFrm
= (*fnWhichCol
)( pLayFrm
)) )
105 SwCntntFrm
* pCnt
= (*fnPosCol
)( pLayFrm
);
108 SET_CURR_SHELL( this );
109 SwCallLink
aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
110 SwCrsrSaveState
aSaveState( *pCurCrsr
);
114 Point
aPt( pCnt
->Frm().Pos() + pCnt
->Prt().Pos() );
115 if( fnPosCol
== GetColumnEnd
)
117 aPt
.X() += pCnt
->Prt().Width();
118 aPt
.Y() += pCnt
->Prt().Height();
121 pCnt
->GetCrsrOfst( pCurCrsr
->GetPoint(), aPt
);
123 if( !pCurCrsr
->IsInProtectTable( TRUE
) &&
124 !pCurCrsr
->IsSelOvr() )