xref: /trunk/main/sw/inc/txtatr.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _TXTATR_HXX
24 #define _TXTATR_HXX
25 
26 #include <txatbase.hxx>     // SwTxtAttr/SwTxtAttrEnd
27 #include <calbck.hxx>
28 
29 
30 class SwTxtNode;	// fuer SwTxtFld
31 class SwCharFmt;
32 
33 namespace sw {
34     class MetaFieldManager;
35 }
36 
37 
38 // ATT_CHARFMT *********************************************
39 
40 class SwTxtCharFmt : public SwTxtAttrEnd
41 {
42     SwTxtNode * m_pTxtNode;
43     sal_uInt16 m_nSortNumber;
44 
45 public:
46     SwTxtCharFmt( SwFmtCharFmt& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
47     virtual ~SwTxtCharFmt( );
48 
49 	// werden vom SwFmtCharFmt hierher weitergeleitet (no derivation from SwClient!)
50     void ModifyNotification( const SfxPoolItem*, const SfxPoolItem* );
51 	bool GetInfo( SfxPoolItem& rInfo ) const;
52 
53     // get and set TxtNode pointer
ChgTxtNode(SwTxtNode * pNew)54     void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
55 
SetSortNumber(sal_uInt16 nSortNumber)56     void SetSortNumber( sal_uInt16 nSortNumber ) { m_nSortNumber = nSortNumber; }
GetSortNumber() const57     sal_uInt16 GetSortNumber() const { return m_nSortNumber; }
58 };
59 
60 
61 // ******************************
62 
63 class SwTxtAttrNesting : public SwTxtAttrEnd
64 {
65 protected:
66     SwTxtAttrNesting( SfxPoolItem & i_rAttr,
67         const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
68     virtual ~SwTxtAttrNesting();
69 };
70 
71 class SwTxtMeta : public SwTxtAttrNesting
72 {
73 private:
74     SwTxtMeta( SwFmtMeta & i_rAttr,
75         const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
76 
77 public:
78     static SwTxtMeta * CreateTxtMeta(
79         ::sw::MetaFieldManager & i_rTargetDocManager,
80         SwTxtNode *const i_pTargetTxtNode,
81         SwFmtMeta & i_rAttr,
82         xub_StrLen const i_nStart, xub_StrLen const i_nEnd,
83         bool const i_bIsCopy);
84 
85     virtual ~SwTxtMeta();
86 
87     void ChgTxtNode(SwTxtNode * const pNode);
88 };
89 
90 
91 // ******************************
92 
93 class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrNesting, public SwClient
94 {
95     SwTxtNode* m_pTxtNode;
96 protected:
97    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
98 public:
99 	SwTxtRuby( SwFmtRuby& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
100 	virtual ~SwTxtRuby();
101 	TYPEINFO();
102 
103 	virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
104 
105     SW_DLLPRIVATE void InitRuby(SwTxtNode & rNode);
106 
107     /// get and set TxtNode pointer
GetpTxtNode() const108            const SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
109     inline const SwTxtNode& GetTxtNode() const;
ChgTxtNode(SwTxtNode * pNew)110     void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
111 
112 		  SwCharFmt* GetCharFmt();
GetCharFmt() const113 	const SwCharFmt* GetCharFmt() const
114             { return (const_cast<SwTxtRuby*>(this))->GetCharFmt(); }
115 };
116 
117 // --------------- Inline Implementierungen ------------------------
118 
GetTxtNode() const119 inline const SwTxtNode& SwTxtRuby::GetTxtNode() const
120 {
121     ASSERT( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" );
122     return *m_pTxtNode;
123 }
124 
125 #endif
126