LCOV - code coverage report
Current view: top level - sw/source/filter/html - htmlnum.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 40 55.0 %
Date: 2012-08-25 Functions: 6 18 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 8 0.0 %

           Branch data     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 _HTMLNUM_HXX
      20                 :            : #define _HTMLNUM_HXX
      21                 :            : 
      22                 :            : #include <swtypes.hxx>
      23                 :            : #include <string.h>
      24                 :            : 
      25                 :            : #define HTML_NUMBUL_MARGINLEFT  (MM50*2 + MM50/2)
      26                 :            : #define HTML_NUMBUL_INDENT      (-MM50)
      27                 :            : 
      28                 :            : class SwTxtNode;
      29                 :            : class SwNumRule;
      30                 :            : 
      31                 :            : class SwHTMLNumRuleInfo
      32                 :            : {
      33                 :            :     sal_uInt16      aNumStarts[MAXLEVEL];
      34                 :            :     SwNumRule   *   pNumRule;       // Aktuelle Numerierung
      35                 :            :     sal_uInt16      nDeep;          // aktuelle Num-Tiefe (1, 2, 3, ...)
      36                 :            :     sal_Bool        bRestart : 1;   // Export: Numerierung neu starten
      37                 :            :     sal_Bool        bNumbered : 1;  // Export: Absatz ist numeriert
      38                 :            : 
      39                 :            : public:
      40                 :            : 
      41                 :            :     inline void Set( const SwHTMLNumRuleInfo& rInf );
      42                 :            :     void Set( const SwTxtNode& rTxtNd );
      43                 :            : 
      44                 :          6 :     SwHTMLNumRuleInfo() :
      45                 :            :         pNumRule( 0 ), nDeep( 0 ),
      46                 :          6 :         bRestart( sal_False ), bNumbered( sal_False )
      47                 :            :     {
      48                 :          6 :         memset( &aNumStarts, 0xff, sizeof( aNumStarts ) );
      49                 :          6 :     }
      50                 :            : 
      51                 :          0 :     SwHTMLNumRuleInfo( const SwHTMLNumRuleInfo& rInf ) :
      52                 :            :         pNumRule( rInf.pNumRule ), nDeep( rInf.nDeep ),
      53                 :          0 :         bRestart( rInf.bRestart ), bNumbered( rInf.bNumbered )
      54                 :            :     {
      55                 :          0 :         memcpy( &aNumStarts, &rInf.aNumStarts, sizeof( aNumStarts ) );
      56                 :          0 :     }
      57                 :            : 
      58                 :          0 :     SwHTMLNumRuleInfo( const SwTxtNode& rTxtNd ) { Set( rTxtNd ); }
      59                 :            :     inline SwHTMLNumRuleInfo& operator=( const SwHTMLNumRuleInfo& rInf );
      60                 :            : 
      61                 :            :     inline void Clear();
      62                 :            : 
      63                 :          0 :     void SetNumRule( const SwNumRule *pRule ) { pNumRule = (SwNumRule *)pRule; }
      64                 :          4 :     SwNumRule *GetNumRule() { return pNumRule; }
      65                 :          0 :     const SwNumRule *GetNumRule() const { return pNumRule; }
      66                 :            : 
      67                 :          0 :     void SetDepth( sal_uInt16 nDepth ) { nDeep = nDepth; }
      68                 :          2 :     sal_uInt16 GetDepth() const { return nDeep; }
      69                 :          0 :     sal_uInt16 IncDepth() { return ++nDeep; }
      70         [ #  # ]:          0 :     sal_uInt16 DecDepth() { return nDeep==0 ? 0 : --nDeep; }
      71                 :            :     inline sal_uInt8 GetLevel() const;
      72                 :            : 
      73                 :            :     void SetRestart( sal_Bool bSet ) { bRestart = bSet; }
      74                 :          0 :     sal_Bool IsRestart() const { return bRestart; }
      75                 :            : 
      76                 :            :     void SetNumbered( sal_Bool bSet ) { bNumbered = bSet; }
      77                 :          0 :     sal_Bool IsNumbered() const { return bNumbered; }
      78                 :            : 
      79                 :            :     inline void SetNodeStartValue( sal_uInt8 nLvl, sal_uInt16 nVal=USHRT_MAX );
      80                 :          0 :     sal_uInt16 GetNodeStartValue( sal_uInt8 nLvl ) const { return aNumStarts[nLvl]; }
      81                 :            : };
      82                 :            : 
      83                 :          2 : inline SwHTMLNumRuleInfo& SwHTMLNumRuleInfo::operator=(
      84                 :            :     const SwHTMLNumRuleInfo& rInf )
      85                 :            : {
      86                 :          2 :     Set( rInf );
      87                 :          2 :     return *this;
      88                 :            : }
      89                 :            : 
      90                 :          2 : inline void SwHTMLNumRuleInfo::Set( const SwHTMLNumRuleInfo& rInf )
      91                 :            : {
      92                 :          2 :     pNumRule = rInf.pNumRule;
      93                 :          2 :     nDeep = rInf.nDeep;
      94                 :          2 :     bRestart = rInf.bRestart;
      95                 :          2 :     bNumbered = rInf.bNumbered;
      96                 :          2 :     memcpy( &aNumStarts, &rInf.aNumStarts, sizeof( aNumStarts ) );
      97                 :          2 : }
      98                 :            : 
      99                 :          2 : inline void SwHTMLNumRuleInfo::Clear()
     100                 :            : {
     101                 :          2 :     pNumRule = 0;
     102                 :          2 :     nDeep = 0;
     103                 :          2 :     bRestart = bNumbered = sal_False;
     104                 :          2 :     memset( &aNumStarts, 0xff, sizeof( aNumStarts ) );
     105                 :          2 : }
     106                 :            : 
     107                 :          0 : inline sal_uInt8 SwHTMLNumRuleInfo::GetLevel() const
     108                 :            : {
     109                 :            :     return
     110                 :            :         (sal_uInt8)( pNumRule!=0 && nDeep != 0
     111                 :            :             ? ( nDeep<=MAXLEVEL ? nDeep-1 : MAXLEVEL - 1 )
     112 [ #  # ][ #  # ]:          0 :             : 0 );
                 [ #  # ]
     113                 :            : }
     114                 :            : 
     115                 :          0 : inline void SwHTMLNumRuleInfo::SetNodeStartValue( sal_uInt8 nLvl, sal_uInt16 nVal )
     116                 :            : {
     117                 :          0 :     aNumStarts[nLvl] = nVal;
     118                 :          0 : }
     119                 :            : 
     120                 :            : 
     121                 :            : #endif
     122                 :            : 
     123                 :            : 
     124                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10