Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / inc / chpfld.hxx
blob1032f19b4abed0e75d8814ee442d204a91deb3ec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
22 #include "fldbas.hxx"
24 class SwFrame;
25 class SwContentNode;
26 class SwTextNode;
27 class SwRootFrame;
29 enum SwChapterFormat
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
39 class SAL_DLLPUBLIC_RTTI SwChapterFieldType final : public SwFieldType
41 public:
42 SwChapterFieldType();
44 virtual std::unique_ptr<SwFieldType> Copy() const override;
48 class SW_DLLPUBLIC SwChapterField final : public SwField
50 friend class SwChapterFieldType;
51 friend class ToxTextGeneratorTest; // the unittest needs to mock the chapter fields.
53 struct State
55 sal_uInt8 nLevel;
56 OUString sTitle;
57 OUString sNumber;
58 OUString sLabelFollowedBy;
59 OUString sPre;
60 OUString sPost;
61 State() : nLevel(0) {}
63 State m_State;
64 State m_StateRLHidden;
66 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
67 virtual std::unique_ptr<SwField> Copy() const override;
69 public:
70 SwChapterField(SwChapterFieldType*, sal_uInt32 nFormat = 0);
72 // #i53420#
73 void ChangeExpansion( const SwFrame&,
74 const SwContentNode*,
75 bool bSrchNum = false);
76 void ChangeExpansion(const SwTextNode &rNd, bool bSrchNum, SwRootFrame const* pLayout = nullptr);
78 sal_uInt8 GetLevel(SwRootFrame const* pLayout = nullptr) const;
79 void SetLevel(sal_uInt8);
81 const OUString& GetNumber(SwRootFrame const* pLayout = nullptr) const;
82 const OUString& GetTitle(SwRootFrame const* pLayout = nullptr) const;
84 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
85 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
88 #endif // INCLUDED_SW_INC_CHPFLD_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */