LibreOffice Module sw (master)  1
chpfld.hxx
Go to the documentation of this file.
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 SwFrame;
25 class SwContentNode;
26 class SwTextNode;
27 class SwRootFrame;
28 
30 {
37 };
38 
40 {
41 public:
43 
44  virtual std::unique_ptr<SwFieldType> Copy() const override;
45 
46 };
47 
49 {
50  friend class SwChapterFieldType;
51  friend class ToxTextGeneratorTest; // the unittest needs to mock the chapter fields.
52 
53  struct State
54  {
56  OUString sTitle;
57  OUString sNumber;
58  OUString sPre;
59  OUString sPost;
60  State() : nLevel(0) {}
61  };
64 
65  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
66  virtual std::unique_ptr<SwField> Copy() const override;
67 
68 public:
69  SwChapterField(SwChapterFieldType*, sal_uInt32 nFormat = 0);
70 
71  // #i53420#
72  void ChangeExpansion( const SwFrame&,
73  const SwContentNode*,
74  bool bSrchNum = false);
75  void ChangeExpansion(const SwTextNode &rNd, bool bSrchNum, SwRootFrame const* pLayout = nullptr);
76 
77  sal_uInt8 GetLevel(SwRootFrame const* pLayout = nullptr) const;
78  void SetLevel(sal_uInt8);
79 
80  const OUString& GetNumber(SwRootFrame const* pLayout = nullptr) const;
81  const OUString& GetTitle(SwRootFrame const* pLayout = nullptr) const;
82 
83  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
84  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
85 };
86 
87 #endif // INCLUDED_SW_INC_CHPFLD_HXX
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
Base class of the Writer layout elements.
Definition: frame.hxx:295
virtual std::unique_ptr< SwFieldType > Copy() const =0
Base class of all fields.
Definition: fldbas.hxx:279
only chapter number without post-/prefix
Definition: chpfld.hxx:35
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
chapter number without post-/prefix and title
Definition: chpfld.hxx:36
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:314
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:301
number and title
Definition: chpfld.hxx:34
virtual std::unique_ptr< SwField > Copy() const =0
sal_uInt8 nLevel
Definition: chpfld.hxx:55
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
only the chapter number
Definition: chpfld.hxx:32
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
unsigned char sal_uInt8
SwChapterFormat
Definition: chpfld.hxx:29
State m_StateRLHidden
Definition: chpfld.hxx:63
State m_State
Definition: chpfld.hxx:62
only the title
Definition: chpfld.hxx:33