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: edredln.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"
36 #include <vcl/window.hxx>
37 #include "redline.hxx"
42 #include "frmtool.hxx"
45 USHORT
SwEditShell::GetRedlineMode() const
47 return GetDoc()->GetRedlineMode();
50 void SwEditShell::SetRedlineMode( USHORT eMode
)
52 if( eMode
!= GetDoc()->GetRedlineMode() )
54 SET_CURR_SHELL( this );
56 GetDoc()->SetRedlineMode( (RedlineMode_t
)eMode
);
61 BOOL
SwEditShell::IsRedlineOn() const
63 return GetDoc()->IsRedlineOn();
66 USHORT
SwEditShell::GetRedlineCount() const
68 return GetDoc()->GetRedlineTbl().Count();
71 const SwRedline
& SwEditShell::GetRedline( USHORT nPos
) const
73 return *GetDoc()->GetRedlineTbl()[ nPos
];
76 void lcl_InvalidateAll( ViewShell
* pSh
)
78 ViewShell
*pStop
= pSh
;
82 pSh
->GetWin()->Invalidate();
83 pSh
= (ViewShell
*)pSh
->GetNext();
85 } while ( pSh
!= pStop
);
88 BOOL
SwEditShell::AcceptRedline( USHORT nPos
)
90 SET_CURR_SHELL( this );
92 BOOL bRet
= GetDoc()->AcceptRedline( nPos
, true );
93 if( !nPos
&& !::IsExtraData( GetDoc() ) )
94 lcl_InvalidateAll( this );
99 BOOL
SwEditShell::RejectRedline( USHORT nPos
)
101 SET_CURR_SHELL( this );
103 BOOL bRet
= GetDoc()->RejectRedline( nPos
, true );
104 if( !nPos
&& !::IsExtraData( GetDoc() ) )
105 lcl_InvalidateAll( this );
110 // Kommentar am Redline setzen
111 BOOL
SwEditShell::SetRedlineComment( const String
& rS
)
114 FOREACHPAM_START(this)
115 bRet
= bRet
|| GetDoc()->SetRedlineComment( *PCURCRSR
, rS
);
121 const SwRedline
* SwEditShell::GetCurrRedline() const
123 return GetDoc()->GetRedline( *GetCrsr()->GetPoint(), 0 );
126 void SwEditShell::UpdateRedlineAttr()
128 if( ( nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE
) ==
129 ( nsRedlineMode_t::REDLINE_SHOW_MASK
& GetDoc()->GetRedlineMode() ))
131 SET_CURR_SHELL( this );
134 GetDoc()->UpdateRedlineAttr();
140 // suche das Redline zu diesem Data und returne die Pos im Array
141 // USHRT_MAX wird returnt, falls nicht vorhanden
142 USHORT
SwEditShell::FindRedlineOfData( const SwRedlineData
& rData
) const
144 const SwRedlineTbl
& rTbl
= GetDoc()->GetRedlineTbl();
146 for( USHORT i
= 0, nCnt
= rTbl
.Count(); i
< nCnt
; ++i
)
147 if( &rTbl
[ i
]->GetRedlineData() == &rData
)