LCOV - code coverage report
Current view: top level - sw/inc - chpfld.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 6 83.3 %
Date: 2015-06-13 12:38:46 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 INCLUDED_SW_INC_CHPFLD_HXX
      20             : #define INCLUDED_SW_INC_CHPFLD_HXX
      21             : 
      22             : #include "fldbas.hxx"
      23             : 
      24             : class SwFrm;
      25             : class SwContentNode;
      26             : class SwTextNode;
      27             : class ToxTextGeneratorTest;
      28             : 
      29             : enum SwChapterFormat
      30             : {
      31             :     CF_BEGIN,
      32             :     CF_NUMBER = CF_BEGIN,       ///< only the chapter number
      33             :     CF_TITLE,                   ///< only the title
      34             :     CF_NUM_TITLE,               ///< number and title
      35             :     CF_NUMBER_NOPREPST,         ///< only chapter number without post-/prefix
      36             :     CF_NUM_NOPREPST_TITLE,      ///< chapter number without post-/prefix and title
      37             :     CF_END
      38             : };
      39             : 
      40        5904 : class SW_DLLPUBLIC SwChapterFieldType : public SwFieldType
      41             : {
      42             : public:
      43             :     SwChapterFieldType();
      44             : 
      45             :     virtual SwFieldType*    Copy() const SAL_OVERRIDE;
      46             : 
      47             : };
      48             : 
      49         226 : class SW_DLLPUBLIC SwChapterField : public SwField
      50             : {
      51             :     friend class SwChapterFieldType;
      52             :     friend class ToxTextGeneratorTest; // the unittest needs to mock the chapter fields.
      53             :     sal_uInt8 nLevel;
      54             :     OUString sTitle;
      55             :     OUString sNumber;
      56             :     OUString sPre;
      57             :     OUString sPost;
      58             : 
      59             :     virtual OUString Expand() const SAL_OVERRIDE;
      60             :     virtual SwField* Copy() const SAL_OVERRIDE;
      61             : 
      62             : public:
      63             :     SwChapterField(SwChapterFieldType*, sal_uInt32 nFormat = 0);
      64             : 
      65             :     // #i53420#
      66             :     void ChangeExpansion( const SwFrm*,
      67             :                           const SwContentNode*,
      68             :         bool bSrchNum = false);
      69             :     void ChangeExpansion(const SwTextNode &rNd, bool bSrchNum);
      70             : 
      71             :     inline sal_uInt8 GetLevel() const;
      72             :     inline void SetLevel(sal_uInt8);
      73             : 
      74             :     inline OUString      GetNumber() const;
      75             :     inline OUString      GetTitle() const;
      76             :     virtual bool         QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const SAL_OVERRIDE;
      77             :     virtual bool         PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) SAL_OVERRIDE;
      78             : };
      79             : 
      80           0 : inline sal_uInt8 SwChapterField::GetLevel() const   { return nLevel; }
      81          12 : inline void SwChapterField::SetLevel(sal_uInt8 nLev) { nLevel = nLev; }
      82           4 : inline OUString SwChapterField::GetNumber() const { return sNumber; }
      83           2 : inline OUString SwChapterField::GetTitle() const { return sTitle; }
      84             : 
      85             : #endif // INCLUDED_SW_INC_CHPFLD_HXX
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11