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