xref: /aoo41x/main/sw/inc/txtfld.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _TXTFLD_HXX
28 #define _TXTFLD_HXX
29 
30 #include <txatbase.hxx>
31 #include <tools/string.hxx>
32 #include <pam.hxx>
33 
34 class SwTxtNode;
35 
36 // ATT_FLD ***********************************
37 
38 class SwTxtFld : public SwTxtAttr
39 {
40     mutable   String m_aExpand;
41     SwTxtNode * m_pTxtNode;
42 
43 public:
44     SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart);
45     virtual ~SwTxtFld();
46 
47 	void CopyFld( SwTxtFld *pDest ) const;
48     void Expand() const;
49 	inline void ExpandAlways();
50 
51     // get and set TxtNode pointer
52     SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
53     inline SwTxtNode& GetTxtNode() const;
54     void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
55     // enable notification that field content has changed and needs reformatting
56     void NotifyContentChange(SwFmtFld& rFmtFld);
57 
58     // #111840#
59     /**
60        Returns position of this field.
61 
62        @return position of this field. Has to be deleted explicitly.
63     */
64 //    SwPosition * GetPosition() const;
65 };
66 
67 inline SwTxtNode& SwTxtFld::GetTxtNode() const
68 {
69     ASSERT( m_pTxtNode, "SwTxtFld:: where is my TxtNode?" );
70     return *m_pTxtNode;
71 }
72 
73 inline void SwTxtFld::ExpandAlways()
74 {
75     m_aExpand += ' ';
76     Expand();
77 }
78 
79 #endif
80 
81