LibreOffice Module sw (master) 1
txtfld.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_TXTFLD_HXX
20#define INCLUDED_SW_INC_TXTFLD_HXX
21
22#include "txatbase.hxx"
23#include <rtl/ustring.hxx>
24
25#include <memory>
26#include <cassert>
27
28class SwPaM;
29class SwTextNode;
30
31class SAL_DLLPUBLIC_RTTI SwTextField : public virtual SwTextAttr
32{
33 mutable OUString m_aExpand; // only used to determine, if field content is changing in <ExpandTextField()>
35
36public:
38 SwFormatField & rAttr,
39 sal_Int32 const nStart,
40 bool const bInClipboard );
41
42 virtual ~SwTextField() override;
43
44 void CopyTextField( SwTextField *pDest ) const;
45
46 void ExpandTextField( const bool bForceNotify = false ) const;
47
48 // get and set TextNode pointer
50 {
51 return m_pTextNode;
52 }
54 {
55 assert(m_pTextNode);
56 return *m_pTextNode;
57 }
58 void ChgTextNode( SwTextNode* pNew )
59 {
60 m_pTextNode = pNew;
61 }
62
63 bool IsFieldInDoc() const;
64
65 // enable notification that field content has changed and needs reformatting
66 virtual void NotifyContentChange( SwFormatField& rFormatField );
67
68 // deletes the given field via removing the corresponding text selection from the document's content
69 static void DeleteTextField( const SwTextField& rTextField );
70
71 // return text selection for the given field
72 static void GetPamForTextField( const SwTextField& rTextField,
73 std::shared_ptr< SwPaM >& rPamForTextField );
74
75};
76
78 : public SwTextAttrNesting
79 , public SwTextField
80{
81public:
83 SwFormatField & rAttr,
84 sal_Int32 const nStart,
85 sal_Int32 const nEnd,
86 bool const bInClipboard );
87
88 virtual ~SwTextInputField() override;
89
92 virtual void NotifyContentChange( SwFormatField& rFormatField ) override;
93
94 void UpdateTextNodeContent( const OUString& rNewContent );
95
96 OUString GetFieldContent() const;
97 void UpdateFieldContent();
98
99private:
100
102};
103
104#endif
105
106/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
void ChgTextNode(SwTextNode *pNew)
Definition: txtfld.hxx:58
SwTextNode * m_pTextNode
Definition: txtfld.hxx:34
OUString m_aExpand
Definition: txtfld.hxx:33
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
bool m_bLockNotifyContentChange
Definition: txtfld.hxx:101
void UpdateTextNodeContent(const OUString &rNewContent)
Definition: atrfld.cxx:727
OUString GetFieldContent() const
Definition: atrfld.cxx:691
void UnlockNotifyContentChange()
Definition: atrfld.cxx:673
SwTextInputField(SwFormatField &rAttr, sal_Int32 const nStart, sal_Int32 const nEnd, bool const bInClipboard)
Definition: atrfld.cxx:644
void UpdateFieldContent()
Definition: atrfld.cxx:696
virtual ~SwTextInputField() override
Definition: atrfld.cxx:659
virtual void NotifyContentChange(SwFormatField &rFormatField) override
Definition: atrfld.cxx:678
bool LockNotifyContentChange()
Definition: atrfld.cxx:663
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86