LCOV - code coverage report
Current view: top level - sw/inc - txatritr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 12 12 100.0 %
Date: 2015-06-13 12:38:46 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 SwTextNode;
      30             : class SwTextAttr;
      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           8 :     sal_uInt16 GetCurrScript() const { return nCurScript; }
      47          16 :     sal_Int32 GetScriptChgPos() const { return (m_nChgPos == -1) ? COMPLETE_STRING : m_nChgPos; }
      48           3 :     const OUString& GetText() const { return m_rText; }
      49             : };
      50             : 
      51           8 : class SwTextAttrIterator
      52             : {
      53             :     SwScriptIterator aSIter;
      54             :     std::deque<const SwTextAttr*> aStack;
      55             :     const SwTextNode& rTextNd;
      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 SwTextAttr& rAttr );
      63             :     void SearchNextChg();
      64             : 
      65             : public:
      66             :     SwTextAttrIterator( const SwTextNode& rTextNd, sal_uInt16 nWhichId,
      67             :                         sal_Int32 nStart = 0, bool bUseGetWhichOfScript = true );
      68             : 
      69             :     bool Next();
      70             : 
      71           8 :     const SfxPoolItem& GetAttr() const  { return *pCurItem; }
      72           8 :     sal_Int32 GetChgPos() const        { return nChgPos; }
      73             : };
      74             : 
      75           8 : class SwLanguageIterator : public SwTextAttrIterator
      76             : {
      77             : public:
      78           8 :     SwLanguageIterator( const SwTextNode& rTextNode, sal_Int32 nStart = 0,
      79             :                         sal_uInt16 nWhich = RES_CHRATR_LANGUAGE,
      80             :                         bool bUseGetWhichOfScript = true )
      81           8 :         : SwTextAttrIterator( rTextNode, nWhich, nStart, bUseGetWhichOfScript )
      82           8 :     {}
      83             : 
      84           8 :     sal_uInt16 GetLanguage() const
      85           8 :         { return static_cast<const SvxLanguageItem&>(GetAttr()).GetValue(); }
      86             : };
      87             : 
      88             : #endif
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11