LCOV - code coverage report
Current view: top level - sw/inc - txatritr.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 12 100.0 %
Date: 2014-11-03 Functions: 9 9 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef INCLUDED_SW_INC_TXATRITR_HXX
      20             : #define INCLUDED_SW_INC_TXATRITR_HXX
      21             : 
      22             : #include <tools/solar.h>
      23             : #include <sal/types.h>
      24             : #include <editeng/langitem.hxx>
      25             : #include <hintids.hxx>
      26             : #include <swtypes.hxx>
      27             : #include <deque>
      28             : 
      29             : class SwTxtNode;
      30             : class SwTxtAttr;
      31             : class SfxPoolItem;
      32             : 
      33             : class SwScriptIterator
      34             : {
      35             :     const OUString& m_rText;
      36             :     sal_Int32 m_nChgPos;
      37             :     sal_uInt16 nCurScript;
      38             :     bool bForward;
      39             : 
      40             : public:
      41             :     SwScriptIterator( const OUString& rStr, sal_Int32 nStart = 0,
      42             :                       bool bFrwrd = true );
      43             : 
      44             :     bool Next();
      45             : 
      46          16 :     sal_uInt16 GetCurrScript() const { return nCurScript; }
      47          32 :     sal_Int32 GetScriptChgPos() const { return (m_nChgPos == -1) ? COMPLETE_STRING : m_nChgPos; }
      48           6 :     const OUString& GetText() const { return m_rText; }
      49             : };
      50             : 
      51          16 : class SwTxtAttrIterator
      52             : {
      53             :     SwScriptIterator aSIter;
      54             :     std::deque<const SwTxtAttr*> aStack;
      55             :     const SwTxtNode& rTxtNd;
      56             :     const SfxPoolItem *pParaItem, *pCurItem;
      57             :     size_t nAttrPos;
      58             :     sal_Int32 nChgPos;
      59             :     sal_uInt16 nWhichId;
      60             :     bool bIsUseGetWhichOfScript;
      61             : 
      62             :     void AddToStack( const SwTxtAttr& rAttr );
      63             :     void SearchNextChg();
      64             : 
      65             : public:
      66             :     SwTxtAttrIterator( const SwTxtNode& rTxtNd, sal_uInt16 nWhichId,
      67             :                         sal_Int32 nStart = 0, bool bUseGetWhichOfScript = true );
      68             : 
      69             :     bool Next();
      70             : 
      71          16 :     const SfxPoolItem& GetAttr() const  { return *pCurItem; }
      72          16 :     sal_Int32 GetChgPos() const        { return nChgPos; }
      73             : };
      74             : 
      75          16 : class SwLanguageIterator : public SwTxtAttrIterator
      76             : {
      77             : public:
      78          16 :     SwLanguageIterator( const SwTxtNode& rTxtNode, sal_Int32 nStart = 0,
      79             :                         sal_uInt16 nWhich = RES_CHRATR_LANGUAGE,
      80             :                         bool bUseGetWhichOfScript = true )
      81          16 :         : SwTxtAttrIterator( rTxtNode, nWhich, nStart, bUseGetWhichOfScript )
      82          16 :     {}
      83             : 
      84          16 :     sal_uInt16 GetLanguage() const
      85          16 :         { return ((SvxLanguageItem&)GetAttr()).GetValue(); }
      86             : };
      87             : 
      88             : #endif
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10