Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _TXTATR_HXX
29 : : #define _TXTATR_HXX
30 : :
31 : : #include <txatbase.hxx> // SwTxtAttr/SwTxtAttrEnd
32 : : #include <calbck.hxx>
33 : :
34 : :
35 : : class SwTxtNode; // For SwTxtFld.
36 : : class SwCharFmt;
37 : :
38 : : namespace sw {
39 : : class MetaFieldManager;
40 : : }
41 : :
42 : :
43 : : // ATT_CHARFMT *********************************************
44 : :
45 : : class SwTxtCharFmt : public SwTxtAttrEnd
46 : : {
47 : : SwTxtNode * m_pTxtNode;
48 : : sal_uInt16 m_nSortNumber;
49 : :
50 : : public:
51 : : SwTxtCharFmt( SwFmtCharFmt& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
52 : : virtual ~SwTxtCharFmt( );
53 : :
54 : : // Passed from SwFmtCharFmt (no derivation from SwClient!).
55 : : void ModifyNotification( const SfxPoolItem*, const SfxPoolItem* );
56 : : bool GetInfo( SfxPoolItem& rInfo ) const;
57 : :
58 : : // get and set TxtNode pointer
59 : 52 : void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
60 : :
61 : 0 : void SetSortNumber( sal_uInt16 nSortNumber ) { m_nSortNumber = nSortNumber; }
62 : 96 : sal_uInt16 GetSortNumber() const { return m_nSortNumber; }
63 : : };
64 : :
65 : :
66 : : // ******************************
67 : :
68 : : class SwTxtAttrNesting : public SwTxtAttrEnd
69 : : {
70 : : protected:
71 : : SwTxtAttrNesting( SfxPoolItem & i_rAttr,
72 : : const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
73 : : virtual ~SwTxtAttrNesting();
74 : : };
75 : :
76 : : class SwTxtMeta : public SwTxtAttrNesting
77 : : {
78 : : private:
79 : : SwTxtMeta( SwFmtMeta & i_rAttr,
80 : : const xub_StrLen i_nStart, const xub_StrLen i_nEnd );
81 : :
82 : : public:
83 : : static SwTxtMeta * CreateTxtMeta(
84 : : ::sw::MetaFieldManager & i_rTargetDocManager,
85 : : SwTxtNode *const i_pTargetTxtNode,
86 : : SwFmtMeta & i_rAttr,
87 : : xub_StrLen const i_nStart, xub_StrLen const i_nEnd,
88 : : bool const i_bIsCopy);
89 : :
90 : : virtual ~SwTxtMeta();
91 : :
92 : : void ChgTxtNode(SwTxtNode * const pNode);
93 : : };
94 : :
95 : :
96 : : // ******************************
97 : :
98 : : class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrNesting, public SwClient
99 : : {
100 : : SwTxtNode* m_pTxtNode;
101 : : protected:
102 : : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
103 : : public:
104 : : SwTxtRuby( SwFmtRuby& rAttr, xub_StrLen nStart, xub_StrLen nEnd );
105 : : virtual ~SwTxtRuby();
106 : : TYPEINFO();
107 : :
108 : : virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const;
109 : :
110 : : SW_DLLPRIVATE void InitRuby(SwTxtNode & rNode);
111 : :
112 : : /// Get and set TxtNode pointer.
113 : : const SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
114 : : inline const SwTxtNode& GetTxtNode() const;
115 : 386 : void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
116 : :
117 : : SwCharFmt* GetCharFmt();
118 : 0 : const SwCharFmt* GetCharFmt() const
119 : 0 : { return (const_cast<SwTxtRuby*>(this))->GetCharFmt(); }
120 : : };
121 : :
122 : :
123 : 336 : inline const SwTxtNode& SwTxtRuby::GetTxtNode() const
124 : : {
125 : : OSL_ENSURE( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" );
126 : 336 : return *m_pTxtNode;
127 : : }
128 : :
129 : : #endif
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|