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 .
19 #ifndef INCLUDED_SW_INC_TXATRITR_HXX
20 #define INCLUDED_SW_INC_TXATRITR_HXX
22 #include <tools/solar.h>
23 #include <sal/types.h>
24 #include <editeng/langitem.hxx>
25 #include <hintids.hxx>
26 #include <swtypes.hxx>
33 class SwScriptIterator
35 const OUString
& m_rText
;
37 sal_uInt16 nCurScript
;
41 SwScriptIterator( const OUString
& rStr
, sal_Int32 nStart
= 0,
46 sal_uInt16
GetCurrScript() const { return nCurScript
; }
47 sal_Int32
GetScriptChgPos() const { return (m_nChgPos
== -1) ? COMPLETE_STRING
: m_nChgPos
; }
48 const OUString
& GetText() const { return m_rText
; }
51 class SwTextAttrIterator
53 SwScriptIterator aSIter
;
54 std::deque
<const SwTextAttr
*> aStack
;
55 const SwTextNode
& rTextNd
;
56 const SfxPoolItem
*pParaItem
, *pCurItem
;
60 bool bIsUseGetWhichOfScript
;
62 void AddToStack( const SwTextAttr
& rAttr
);
66 SwTextAttrIterator( const SwTextNode
& rTextNd
, sal_uInt16 nWhichId
,
67 sal_Int32 nStart
= 0, bool bUseGetWhichOfScript
= true );
71 const SfxPoolItem
& GetAttr() const { return *pCurItem
; }
72 sal_Int32
GetChgPos() const { return nChgPos
; }
75 class SwLanguageIterator
: public SwTextAttrIterator
78 SwLanguageIterator( const SwTextNode
& rTextNode
, sal_Int32 nStart
= 0,
79 sal_uInt16 nWhich
= RES_CHRATR_LANGUAGE
,
80 bool bUseGetWhichOfScript
= true )
81 : SwTextAttrIterator( rTextNode
, nWhich
, nStart
, bUseGetWhichOfScript
)
84 sal_uInt16
GetLanguage() const
85 { return static_cast<const SvxLanguageItem
&>(GetAttr()).GetValue(); }
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */