LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - txatritr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 12 91.7 %
Date: 2013-07-09 Functions: 8 9 88.9 %
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 _TXATRITR_HXX
      20             : #define _TXATRITR_HXX
      21             : 
      22             : #include <tools/solar.h>
      23             : #include <sal/types.h>
      24             : #include <editeng/langitem.hxx>
      25             : #include <hintids.hxx>
      26             : #include <deque>
      27             : 
      28             : class String;
      29             : class SwTxtNode;
      30             : class SwTxtAttr;
      31             : class SfxPoolItem;
      32             : 
      33             : 
      34             : class SwScriptIterator
      35             : {
      36             :     const String& rText;
      37             :     xub_StrLen nChgPos;
      38             :     sal_uInt16 nCurScript;
      39             :     bool bForward;
      40             : 
      41             : public:
      42             :     SwScriptIterator( const String& rStr, xub_StrLen nStart = 0,
      43             :                       bool bFrwrd = true );
      44             : 
      45             :     bool Next();
      46             : 
      47           3 :     sal_uInt16 GetCurrScript() const        { return nCurScript; }
      48           6 :     xub_StrLen GetScriptChgPos() const      { return nChgPos; }
      49           0 :     const String& GetText() const           { return rText; }
      50             : };
      51             : 
      52             : 
      53           3 : class SwTxtAttrIterator
      54             : {
      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;
      62             : 
      63             :     void AddToStack( const SwTxtAttr& rAttr );
      64             :     void SearchNextChg();
      65             : 
      66             : public:
      67             :     SwTxtAttrIterator( const SwTxtNode& rTxtNd, sal_uInt16 nWhichId,
      68             :                         xub_StrLen nStart = 0, bool bUseGetWhichOfScript = true );
      69             : 
      70             :     bool Next();
      71             : 
      72           3 :     const SfxPoolItem& GetAttr() const  { return *pCurItem; }
      73           3 :     xub_StrLen GetChgPos() const        { return nChgPos; }
      74             : };
      75             : 
      76             : 
      77           3 : class SwLanguageIterator : public SwTxtAttrIterator
      78             : {
      79             : public:
      80           3 :     SwLanguageIterator( const SwTxtNode& rTxtNode, xub_StrLen nStart = 0,
      81             :                         sal_uInt16 nWhich = RES_CHRATR_LANGUAGE,
      82             :                         bool bUseGetWhichOfScript = true )
      83           3 :         : SwTxtAttrIterator( rTxtNode, nWhich, nStart, bUseGetWhichOfScript )
      84           3 :     {}
      85             : 
      86           3 :     sal_uInt16 GetLanguage() const
      87           3 :         { return ((SvxLanguageItem&)GetAttr()).GetValue(); }
      88             : };
      89             : 
      90             : 
      91             : #endif
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10