1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_TXTFLD_HXX
20 #define INCLUDED_SW_INC_TXTFLD_HXX
22 #include "txatbase.hxx"
23 #include <rtl/ustring.hxx>
31 class SAL_DLLPUBLIC_RTTI SwTextField
: public virtual SwTextAttr
33 mutable OUString m_aExpand
; // only used to determine, if field content is changing in <ExpandTextField()>
34 SwTextNode
* m_pTextNode
;
38 SwFormatField
& rAttr
,
39 sal_Int32
const nStart
,
40 bool const bInClipboard
);
42 virtual ~SwTextField() override
;
44 void CopyTextField( SwTextField
*pDest
) const;
46 void ExpandTextField( const bool bForceNotify
= false ) const;
48 // get and set TextNode pointer
49 SwTextNode
* GetpTextNode() const
53 SwTextNode
& GetTextNode() const
58 void ChgTextNode( SwTextNode
* pNew
)
63 bool IsFieldInDoc() const;
65 // enable notification that field content has changed and needs reformatting
66 virtual void NotifyContentChange( SwFormatField
& rFormatField
);
68 // deletes the given field via removing the corresponding text selection from the document's content
69 static void DeleteTextField( const SwTextField
& rTextField
);
71 // return text selection for the given field
72 static void GetPamForTextField( const SwTextField
& rTextField
,
73 std::shared_ptr
< SwPaM
>& rPamForTextField
);
77 class SwTextInputField final
78 : public SwTextAttrNesting
83 SwFormatField
& rAttr
,
84 sal_Int32
const nStart
,
86 bool const bInClipboard
);
88 virtual ~SwTextInputField() override
;
90 bool LockNotifyContentChange();
91 void UnlockNotifyContentChange();
92 virtual void NotifyContentChange( SwFormatField
& rFormatField
) override
;
94 void UpdateTextNodeContent( const OUString
& rNewContent
);
96 OUString
GetFieldContent() const;
97 void UpdateFieldContent();
101 bool m_bLockNotifyContentChange
;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */