Update ooo320-m1
[ooovba.git] / sw / inc / txatritr.hxx
blob9717a1325f0882cee9c3fbe9469f450ad89869b1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txatritr.hxx,v $
10 * $Revision: 1.8 $
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 ************************************************************************/
30 #ifndef _TXATRITR_HXX
31 #define _TXATRITR_HXX
33 #include <tools/solar.h>
34 #include <sal/types.h>
35 #include <svtools/svarray.hxx>
36 #include <svx/langitem.hxx>
37 #include <hintids.hxx>
39 class String;
40 class SwTxtNode;
41 class SwTxtAttr;
42 class SfxPoolItem;
45 class SwScriptIterator
47 const String& rText;
48 xub_StrLen nChgPos;
49 sal_uInt16 nCurScript;
50 sal_Bool bForward;
52 public:
53 SwScriptIterator( const String& rStr, xub_StrLen nStart = 0,
54 sal_Bool bFrwrd = sal_True );
56 sal_Bool Next();
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;
67 SvPtrarr aStack;
68 const SwTxtNode& rTxtNd;
69 const SfxPoolItem *pParaItem, *pCurItem;
70 xub_StrLen nChgPos;
71 sal_uInt16 nAttrPos, nWhichId;
72 sal_Bool bIsUseGetWhichOfScript;
74 void AddToStack( const SwTxtAttr& rAttr );
75 void SearchNextChg();
77 public:
78 SwTxtAttrIterator( const SwTxtNode& rTxtNd, USHORT nWhichId,
79 xub_StrLen nStart = 0, sal_Bool bUseGetWhichOfScript = sal_True );
81 sal_Bool Next();
83 const SfxPoolItem& GetAttr() const { return *pCurItem; }
84 xub_StrLen GetChgPos() const { return nChgPos; }
88 class SwLanguageIterator : public SwTxtAttrIterator
90 public:
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(); }
102 #endif