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 Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
71 public:
72  SwGetRefFieldType(SwDoc* pDoc );
73  virtual std::unique_ptr<SwFieldType> Copy() const override;
74 
75  SwDoc* GetDoc() const { return m_pDoc; }
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 };
84 
85 class SW_DLLPUBLIC SwGetRefField final : public SwField
86 {
87 private:
88  OUString m_sSetRefName;
90  OUString m_sText;
91  OUString m_sTextRLHidden;
92  sal_uInt16 m_nSubType;
94  sal_uInt16 m_nSeqNo;
95 
96  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
97  virtual std::unique_ptr<SwField> Copy() const override;
98 
99 public:
100  SwGetRefField( SwGetRefFieldType*, const OUString& rSetRef, const OUString& rReferenceLanguage,
101  sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat );
102 
103  virtual ~SwGetRefField() override;
104 
105  virtual OUString GetFieldName() const override;
106 
107  const OUString& GetSetRefName() const { return m_sSetRefName; }
108 
109  // #i81002#
116  void UpdateField( const SwTextField* pFieldTextAttr );
117 
118  void SetExpand( const OUString& rStr );
119 
121  virtual sal_uInt16 GetSubType() const override;
122  virtual void SetSubType( sal_uInt16 n ) override;
123 
124  // --> #i81002#
125  bool IsRefToHeadingCrossRefBookmark() const;
126  bool IsRefToNumItemCrossRefBookmark() const;
127  const SwTextNode* GetReferencedTextNode() const;
128  // #i85090#
129  OUString GetExpandedTextOfReferencedTextNode(SwRootFrame const& rLayout) const;
130 
132  sal_uInt16 GetSeqNo() const { return m_nSeqNo; }
133  void SetSeqNo( sal_uInt16 n ) { m_nSeqNo = n; }
134 
135  // Name of reference.
136  virtual OUString GetPar1() const override;
137  virtual void SetPar1(const OUString& rStr) override;
138 
139  virtual OUString GetPar2() const override;
140  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override;
141  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override;
142 
143  void ConvertProgrammaticToUIName();
144 
145  virtual OUString GetDescription() const override;
146 };
147 
148 #endif
149 
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
OUString m_sTextRLHidden
result for layout with redlines hidden
Definition: reffld.hxx:91
"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:94
sal_uIntPtr sal_uLong
Base class of all fields.
Definition: fldbas.hxx:280
Definition: doc.hxx:185
REFERENCEMARK
Definition: reffld.hxx:45
bool IsFrameBehind(const SwTextNode &rMyNd, sal_Int32 nMySttPos, const SwTextNode &rBehindNd, sal_Int32 nSttPos)
Definition: reffld.cxx:102
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
virtual OUString GetPar1() const
Definition: fldbas.cxx:271
"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:314
OUString m_sSetRefName
Definition: reffld.hxx:88
"Category and Number"
Definition: reffld.hxx:53
OUString m_sSetReferenceLanguage
Definition: reffld.hxx:89
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:301
SwDoc * GetDoc() const
Definition: reffld.hxx:75
virtual OUString GetDescription() const
Definition: fldbas.cxx:761
virtual void SetPar1(const OUString &rStr)
Definition: fldbas.cxx:286
virtual std::unique_ptr< SwField > Copy() const =0
new reference format types for referencing bookmarks and set references
Definition: reffld.hxx:58
virtual OUString GetPar2() const
Definition: fldbas.cxx:276
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SwDoc * m_pDoc
Definition: reffld.hxx:67
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: calbck.hxx:183
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:292
REFERENCESUBTYPE
Definition: reffld.hxx:35
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
"Reference"
Definition: reffld.hxx:50
sal_uInt16 GetSeqNo() const
Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
Definition: reffld.hxx:132
OUString m_sText
result
Definition: reffld.hxx:90
"Above/Below"
Definition: reffld.hxx:51
"Number (no context)"
Definition: reffld.hxx:59
sal_uInt16 m_nSubType
Definition: reffld.hxx:92
const OUString & GetSetRefName() const
Definition: reffld.hxx:107
virtual OUString GetFieldName() const
get name or content
Definition: fldbas.cxx:255
void SetSeqNo(sal_uInt16 n)
Definition: reffld.hxx:133
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:1014
"Numbering"
Definition: reffld.hxx:55
virtual void SetSubType(sal_uInt16)
Definition: fldbas.cxx:297