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