LibreOffice Module sw (master)  1
reffld.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_REFFLD_HXX
20 #define INCLUDED_SW_INC_REFFLD_HXX
21 
22 #include <tools/solar.h>
23 
24 #include "fldbas.hxx"
25 
26 class SfxPoolItem;
27 class SwDoc;
28 class SwTextNode;
29 class SwTextField;
30 class SwRootFrame;
31 
32 bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
33  const SwTextNode& rBehindNd, sal_Int32 nSttPos );
34 
36 {
43 };
44 
46 {
56  // --> #i81002#
61 };
62 
64 
65 class SAL_DLLPUBLIC_RTTI SwGetRefFieldType final : public SwFieldType
66 {
68 
70  virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
71 public:
72  SwGetRefFieldType(SwDoc& rDoc );
73  virtual std::unique_ptr<SwFieldType> Copy() const override;
74 
75  SwDoc& GetDoc() const { return m_rDoc; }
76 
77  void MergeWithOtherDoc( SwDoc& rDestDoc );
78 
79  static SwTextNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
80  sal_uInt16 nSubType, sal_uInt16 nSeqNo,
81  sal_Int32* pStt, sal_Int32* pEnd = nullptr,
82  SwRootFrame const* pLayout = nullptr);
83  void UpdateGetReferences();
84 };
85 
86 class SW_DLLPUBLIC SwGetRefField final : public SwField
87 {
88 private:
89  OUString m_sSetRefName;
91  OUString m_sText;
92  OUString m_sTextRLHidden;
93  sal_uInt16 m_nSubType;
95  sal_uInt16 m_nSeqNo;
96 
97  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
98  virtual std::unique_ptr<SwField> Copy() const override;
99 
100 public:
101  SwGetRefField( SwGetRefFieldType*, const OUString& rSetRef, const OUString& rReferenceLanguage,
102  sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat );
103 
104  virtual ~SwGetRefField() override;
105 
106  virtual OUString GetFieldName() const override;
107 
108  const OUString& GetSetRefName() const { return m_sSetRefName; }
109 
110  // #i81002#
117  void UpdateField( const SwTextField* pFieldTextAttr );
118 
119  void SetExpand( const OUString& rStr );
120 
122  virtual sal_uInt16 GetSubType() const override;
123  virtual void SetSubType( sal_uInt16 n ) override;
124 
125  // --> #i81002#
126  bool IsRefToHeadingCrossRefBookmark() const;
127  bool IsRefToNumItemCrossRefBookmark() const;
128  const SwTextNode* GetReferencedTextNode() const;
129  // #i85090#
130  OUString GetExpandedTextOfReferencedTextNode(SwRootFrame const& rLayout) const;
131 
133  sal_uInt16 GetSeqNo() const { return m_nSeqNo; }
134  void SetSeqNo( sal_uInt16 n ) { m_nSeqNo = n; }
135 
136  // Name of reference.
137  virtual OUString GetPar1() const override;
138  virtual void SetPar1(const OUString& rStr) override;
139 
140  virtual OUString GetPar2() const override;
141  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override;
142  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override;
143 
144  void ConvertProgrammaticToUIName();
145 
146  virtual OUString GetDescription() const override;
147 };
148 
149 #endif
150 
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
OUString m_sTextRLHidden
result for layout with redlines hidden
Definition: reffld.hxx:92
"Page"
Definition: reffld.hxx:48
"Caption Text"
Definition: reffld.hxx:54
virtual std::unique_ptr< SwFieldType > Copy() const =0
sal_uInt16 m_nSeqNo
reference to either a SwTextFootnote::m_nSeqNo or a SwSetExpField::mnSeqNo
Definition: reffld.hxx:95
sal_uIntPtr sal_uLong
Base class of all fields.
Definition: fldbas.hxx:289
Definition: doc.hxx:186
REFERENCEMARK
Definition: reffld.hxx:45
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:111
bool IsFrameBehind(const SwTextNode &rMyNd, sal_Int32 nMySttPos, const SwTextNode &rBehindNd, sal_Int32 nSttPos)
Definition: reffld.cxx:99
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
virtual OUString GetPar1() const
Definition: fldbas.cxx:314
SwDoc & m_rDoc
Definition: docbm.cxx:1205
"As Page Style"
Definition: reffld.hxx:52
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
"Chapter"
Definition: reffld.hxx:49
"Number (full context)"
Definition: reffld.hxx:60
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:357
OUString m_sSetRefName
Definition: reffld.hxx:89
"Category and Number"
Definition: reffld.hxx:53
OUString m_sSetReferenceLanguage
Definition: reffld.hxx:90
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:344
virtual OUString GetDescription() const
Definition: fldbas.cxx:802
virtual void SetPar1(const OUString &rStr)
Definition: fldbas.cxx:329
virtual std::unique_ptr< SwField > Copy() const =0
new reference format types for referencing bookmarks and set references
Definition: reffld.hxx:58
SwDoc & m_rDoc
Definition: reffld.hxx:67
virtual OUString GetPar2() const
Definition: fldbas.cxx:319
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:335
REFERENCESUBTYPE
Definition: reffld.hxx:35
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
"Reference"
Definition: reffld.hxx:50
sal_uInt16 GetSeqNo() const
Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
Definition: reffld.hxx:133
OUString m_sText
result
Definition: reffld.hxx:91
"Above/Below"
Definition: reffld.hxx:51
SwDoc & GetDoc() const
Definition: reffld.hxx:75
"Number (no context)"
Definition: reffld.hxx:59
sal_uInt16 m_nSubType
Definition: reffld.hxx:93
const OUString & GetSetRefName() const
Definition: reffld.hxx:108
virtual OUString GetFieldName() const
get name or content
Definition: fldbas.cxx:298
void SetSeqNo(sal_uInt16 n)
Definition: reffld.hxx:134
Get reference.
Definition: reffld.hxx:65
const SwContentFrame * FindAnchor(const SwFrame *pOldAnch, const Point &rNew, const bool bBody=false)
search an anchor for paragraph bound frames starting from pOldAnch
Definition: flycnt.cxx:1034
"Numbering"
Definition: reffld.hxx:55
virtual void SetSubType(sal_uInt16)
Definition: fldbas.cxx:340