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: txatritr.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 <tools/solar.h>
34 #include <sal/types.h>
35 #include <svtools/svarray.hxx>
36 #include <svx/langitem.hxx>
37 #include <hintids.hxx>
45 class SwScriptIterator
49 sal_uInt16 nCurScript
;
53 SwScriptIterator( const String
& rStr
, xub_StrLen nStart
= 0,
54 sal_Bool bFrwrd
= sal_True
);
58 sal_uInt16
GetCurrScript() const { return nCurScript
; }
59 xub_StrLen
GetScriptChgPos() const { return nChgPos
; }
60 const String
& GetText() const { return rText
; }
64 class SwTxtAttrIterator
66 SwScriptIterator aSIter
;
68 const SwTxtNode
& rTxtNd
;
69 const SfxPoolItem
*pParaItem
, *pCurItem
;
71 sal_uInt16 nAttrPos
, nWhichId
;
72 sal_Bool bIsUseGetWhichOfScript
;
74 void AddToStack( const SwTxtAttr
& rAttr
);
78 SwTxtAttrIterator( const SwTxtNode
& rTxtNd
, USHORT nWhichId
,
79 xub_StrLen nStart
= 0, sal_Bool bUseGetWhichOfScript
= sal_True
);
83 const SfxPoolItem
& GetAttr() const { return *pCurItem
; }
84 xub_StrLen
GetChgPos() const { return nChgPos
; }
88 class SwLanguageIterator
: public SwTxtAttrIterator
91 SwLanguageIterator( const SwTxtNode
& rTxtNode
, xub_StrLen nStart
= 0,
92 USHORT nWhich
= RES_CHRATR_LANGUAGE
,
93 sal_Bool bUseGetWhichOfScript
= sal_True
)
94 : SwTxtAttrIterator( rTxtNode
, nWhich
, nStart
, bUseGetWhichOfScript
)
97 sal_uInt16
GetLanguage() const
98 { return ((SvxLanguageItem
&)GetAttr()).GetValue(); }