1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <tools/solar.h>
23 #include <sal/types.h>
24 #include <editeng/langitem.hxx>
25 #include <hintids.hxx>
34 class SwScriptIterator
38 sal_uInt16 nCurScript
;
42 SwScriptIterator( const String
& rStr
, xub_StrLen nStart
= 0,
47 sal_uInt16
GetCurrScript() const { return nCurScript
; }
48 xub_StrLen
GetScriptChgPos() const { return nChgPos
; }
49 const String
& GetText() const { return rText
; }
53 class SwTxtAttrIterator
55 SwScriptIterator aSIter
;
56 std::deque
<const SwTxtAttr
*> aStack
;
57 const SwTxtNode
& rTxtNd
;
58 const SfxPoolItem
*pParaItem
, *pCurItem
;
60 sal_uInt16 nAttrPos
, nWhichId
;
61 bool bIsUseGetWhichOfScript
;
63 void AddToStack( const SwTxtAttr
& rAttr
);
67 SwTxtAttrIterator( const SwTxtNode
& rTxtNd
, sal_uInt16 nWhichId
,
68 xub_StrLen nStart
= 0, bool bUseGetWhichOfScript
= true );
72 const SfxPoolItem
& GetAttr() const { return *pCurItem
; }
73 xub_StrLen
GetChgPos() const { return nChgPos
; }
77 class SwLanguageIterator
: public SwTxtAttrIterator
80 SwLanguageIterator( const SwTxtNode
& rTxtNode
, xub_StrLen nStart
= 0,
81 sal_uInt16 nWhich
= RES_CHRATR_LANGUAGE
,
82 bool bUseGetWhichOfScript
= true )
83 : SwTxtAttrIterator( rTxtNode
, nWhich
, nStart
, bUseGetWhichOfScript
)
86 sal_uInt16
GetLanguage() const
87 { return ((SvxLanguageItem
&)GetAttr()).GetValue(); }
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */