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: redlnitr.hxx,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 ************************************************************************/
33 #include "ndhints.hxx"
35 #ifndef IDOCUMENTREDLINEACCESS_HXX_INCLUDED
36 #include <IDocumentRedlineAccess.hxx>
40 #ifndef _SVSTDARR_USHORTS
41 #define _SVSTDARR_USHORTS
42 #include <svtools/svstdarr.hxx>
53 const SvUShorts
&rArr
; // XAMA: Array of xub_StrLen
57 sal_Bool
_Leave( SwFont
& rFnt
, xub_StrLen nNew
);
58 sal_Bool
Inside() const { return ( nPos
>= nStart
&& nPos
< nEnd
); }
59 void ActualizeFont( SwFont
&rFnt
, xub_StrLen nAttr
);
61 SwExtend( const SvUShorts
&rA
, xub_StrLen nSt
) : pFnt(0), rArr( rA
),
62 nStart( nSt
), nPos( STRING_LEN
), nEnd( nStart
+ rA
.Count() ) {}
63 ~SwExtend() { delete pFnt
; }
64 sal_Bool
IsOn() const { return pFnt
!= 0; }
65 void Reset() { if( pFnt
) { delete pFnt
; pFnt
= NULL
; } nPos
= STRING_LEN
; }
66 sal_Bool
Leave( SwFont
& rFnt
, xub_StrLen nNew
)
67 { if( pFnt
) return _Leave( rFnt
, nNew
); return sal_False
; }
68 short Enter( SwFont
& rFnt
, xub_StrLen nNew
);
69 xub_StrLen
Next( xub_StrLen nNext
);
70 SwFont
* GetFont() { return pFnt
; }
71 void UpdateFont( SwFont
&rFnt
) { ActualizeFont( rFnt
, rArr
[ nPos
- nStart
] ); }
76 SwpHtStart_SAR aHints
;
79 SwAttrHandler
& rAttrHandler
;
90 void _Clear( SwFont
* pFnt
);
91 sal_Bool
_ChkSpecialUnderline() const;
92 void FillHints( MSHORT nAuthor
, RedlineType_t eType
);
93 short _Seek( SwFont
& rFnt
, xub_StrLen nNew
, xub_StrLen nOld
);
94 xub_StrLen
_GetNextRedln( xub_StrLen nNext
);
95 inline short EnterExtend( SwFont
& rFnt
, xub_StrLen nNew
)
96 { if( pExt
) return pExt
->Enter( rFnt
, nNew
); return 0; }
97 inline xub_StrLen
NextExtend( xub_StrLen nNext
)
98 { if( pExt
) return pExt
->Next( nNext
); return nNext
; }
100 SwRedlineItr( const SwTxtNode
& rTxtNd
, SwFont
& rFnt
, SwAttrHandler
& rAH
,
101 xub_StrLen nRedlPos
, sal_Bool bShw
, const SvUShorts
*pArr
= 0,
102 xub_StrLen nStart
= STRING_LEN
);
104 inline sal_Bool
IsOn() const { return bOn
|| ( pExt
&& pExt
->IsOn() ); }
105 inline void Clear( SwFont
* pFnt
) { if( bOn
) _Clear( pFnt
); }
106 void ChangeTxtAttr( SwFont
* pFnt
, SwTxtAttr
&rHt
, sal_Bool bChg
);
107 inline short Seek( SwFont
& rFnt
, xub_StrLen nNew
, xub_StrLen nOld
)
108 { if( bShow
|| pExt
) return _Seek( rFnt
, nNew
, nOld
); return 0; }
109 inline void Reset() { if( nAct
!= nFirst
) nAct
= STRING_LEN
;
110 if( pExt
) pExt
->Reset(); }
111 inline xub_StrLen
GetNextRedln( xub_StrLen nNext
)
112 { if( bShow
|| pExt
) return _GetNextRedln( nNext
); return nNext
; }
113 inline sal_Bool
ChkSpecialUnderline() const
114 { if ( IsOn() ) return _ChkSpecialUnderline(); return sal_False
; }
115 sal_Bool
CheckLine( xub_StrLen nChkStart
, xub_StrLen nChkEnd
);
116 inline sal_Bool
LeaveExtend( SwFont
& rFnt
, xub_StrLen nNew
)
117 { return pExt
->Leave(rFnt
, nNew
); }
118 inline sal_Bool
ExtOn() { if( pExt
) return pExt
->IsOn(); return sal_False
; }
119 inline void UpdateExtFont( SwFont
&rFnt
) {
120 ASSERT( ExtOn(), "UpdateExtFont without ExtOn" )
121 pExt
->UpdateFont( rFnt
); }