1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_CHPFLD_HXX
20 #define INCLUDED_SW_INC_CHPFLD_HXX
27 class ToxTextGeneratorTest
;
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
39 class SW_DLLPUBLIC SwChapterFieldType
: public SwFieldType
44 virtual SwFieldType
* Copy() const override
;
48 class SW_DLLPUBLIC SwChapterField
: public SwField
50 friend class SwChapterFieldType
;
51 friend class ToxTextGeneratorTest
; // the unittest needs to mock the chapter fields.
58 virtual OUString
Expand() const override
;
59 virtual SwField
* Copy() const override
;
62 SwChapterField(SwChapterFieldType
*, sal_uInt32 nFormat
= 0);
65 void ChangeExpansion( const SwFrame
*,
67 bool bSrchNum
= false);
68 void ChangeExpansion(const SwTextNode
&rNd
, bool bSrchNum
);
70 inline sal_uInt8
GetLevel() const;
71 inline void SetLevel(sal_uInt8
);
73 inline const OUString
& GetNumber() const;
74 inline const OUString
& GetTitle() const;
75 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt16 nWhich
) const override
;
76 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt16 nWhich
) override
;
79 inline sal_uInt8
SwChapterField::GetLevel() const { return nLevel
; }
80 inline void SwChapterField::SetLevel(sal_uInt8 nLev
) { nLevel
= nLev
; }
81 inline const OUString
& SwChapterField::GetNumber() const { return sNumber
; }
82 inline const OUString
& SwChapterField::GetTitle() const { return sTitle
; }
84 #endif // INCLUDED_SW_INC_CHPFLD_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */