xref: /trunk/main/sw/inc/txtatr.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 _TXTATR_HXX
28 #define _TXTATR_HXX
29 
30 #include <txatbase.hxx>     // SwTxtAttr/SwTxtAttrEnd
31 #include <calbck.hxx>
32 
33 
34 class SwTxtNode;	// fuer SwTxtFld
35 class SwCharFmt;
36 
37 namespace sw {
38     class MetaFieldManager;
39 }
40 
41 
42 // ATT_CHARFMT *********************************************
43 
44 class SwTxtCharFmt : public SwTxtAttrEnd
45 {
46     SwTxtNode * m_pTxtNode;
47     sal_uInt16 m_nSortNumber;
48 
49 public:
50     SwTxtCharFmt( SwFmtCharFmt& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
51     virtual ~SwTxtCharFmt( );
52 
53 	// werden vom SwFmtCharFmt hierher weitergeleitet (no derivation from SwClient!)
54     void ModifyNotification( const SfxPoolItem*, const SfxPoolItem* );
55 	bool GetInfo( SfxPoolItem& rInfo ) const;
56 
57     // get and set TxtNode pointer
58     void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
59 
60     void SetSortNumber( sal_uInt16 nSortNumber ) { m_nSortNumber = nSortNumber; }
61     sal_uInt16 GetSortNumber() const { return m_nSortNumber; }
62 };
63 
64 
65 // ******************************
66 
67 class SwTxtAttrNesting : public SwTxtAttrEnd
68 {
69 protected:
70     SwTxtAttrNesting( SfxPoolItem & i_rAttr,
71         const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
72     virtual ~SwTxtAttrNesting();
73 };
74 
75 class SwTxtMeta : public SwTxtAttrNesting
76 {
77 private:
78     SwTxtMeta( SwFmtMeta & i_rAttr,
79         const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
80 
81 public:
82     static SwTxtMeta * CreateTxtMeta(
83         ::sw::MetaFieldManager & i_rTargetDocManager,
84         SwTxtNode *const i_pTargetTxtNode,
85         SwFmtMeta & i_rAttr,
86         xub_StrLen const i_nStart, xub_StrLen const i_nEnd,
87         bool const i_bIsCopy);
88 
89     virtual ~SwTxtMeta();
90 
91     void ChgTxtNode(SwTxtNode * const pNode);
92 };
93 
94 
95 // ******************************
96 
97 class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrNesting, public SwClient
98 {
99     SwTxtNode* m_pTxtNode;
100 protected:
101    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
102 public:
103 	SwTxtRuby( SwFmtRuby& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
104 	virtual ~SwTxtRuby();
105 	TYPEINFO();
106 
107 	virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
108 
109     SW_DLLPRIVATE void InitRuby(SwTxtNode & rNode);
110 
111     /// get and set TxtNode pointer
112            const SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
113     inline const SwTxtNode& GetTxtNode() const;
114     void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
115 
116 		  SwCharFmt* GetCharFmt();
117 	const SwCharFmt* GetCharFmt() const
118             { return (const_cast<SwTxtRuby*>(this))->GetCharFmt(); }
119 };
120 
121 // --------------- Inline Implementierungen ------------------------
122 
123 inline const SwTxtNode& SwTxtRuby::GetTxtNode() const
124 {
125     ASSERT( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" );
126     return *m_pTxtNode;
127 }
128 
129 #endif
130