update credits
[LibreOffice.git] / sw / inc / txatritr.hxx
blob05ed48fb3dbfe651ef01e25a99194be483fc4c5c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _TXATRITR_HXX
20 #define _TXATRITR_HXX
22 #include <tools/solar.h>
23 #include <sal/types.h>
24 #include <editeng/langitem.hxx>
25 #include <hintids.hxx>
26 #include <deque>
28 class String;
29 class SwTxtNode;
30 class SwTxtAttr;
31 class SfxPoolItem;
34 class SwScriptIterator
36 const String& rText;
37 xub_StrLen nChgPos;
38 sal_uInt16 nCurScript;
39 bool bForward;
41 public:
42 SwScriptIterator( const String& rStr, xub_StrLen nStart = 0,
43 bool bFrwrd = true );
45 bool Next();
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;
59 xub_StrLen nChgPos;
60 sal_uInt16 nAttrPos, nWhichId;
61 bool bIsUseGetWhichOfScript;
63 void AddToStack( const SwTxtAttr& rAttr );
64 void SearchNextChg();
66 public:
67 SwTxtAttrIterator( const SwTxtNode& rTxtNd, sal_uInt16 nWhichId,
68 xub_StrLen nStart = 0, bool bUseGetWhichOfScript = true );
70 bool Next();
72 const SfxPoolItem& GetAttr() const { return *pCurItem; }
73 xub_StrLen GetChgPos() const { return nChgPos; }
77 class SwLanguageIterator : public SwTxtAttrIterator
79 public:
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(); }
91 #endif
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */