xref: /trunk/main/sw/source/core/txtnode/atrref.cxx (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 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #include <hintids.hxx>
33 #include <txtrfmrk.hxx>
34 #include <fmtrfmrk.hxx>
35 #include <swfont.hxx>
36 
37 
38 /****************************************************************************
39  *
40  *  class SwFmtRefMark
41  *
42  ****************************************************************************/
43 
44 SwFmtRefMark::~SwFmtRefMark( )
45 {
46 }
47 
48 SwFmtRefMark::SwFmtRefMark( const XubString& rName )
49 	: SfxPoolItem( RES_TXTATR_REFMARK ),
50     pTxtAttr( 0 ),
51     aRefName( rName )
52 {
53 }
54 
55 SwFmtRefMark::SwFmtRefMark( const SwFmtRefMark& rAttr )
56 	: SfxPoolItem( RES_TXTATR_REFMARK ),
57     pTxtAttr( 0 ),
58     aRefName( rAttr.aRefName )
59 {
60 }
61 
62 int SwFmtRefMark::operator==( const SfxPoolItem& rAttr ) const
63 {
64 	ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
65 	return aRefName == ((SwFmtRefMark&)rAttr).aRefName;
66 }
67 
68 SfxPoolItem* SwFmtRefMark::Clone( SfxItemPool* ) const
69 {
70 	return new SwFmtRefMark( *this );
71 }
72 
73 /*************************************************************************
74  *						class SwTxtRefMark
75  *************************************************************************/
76 
77 // Attribut fuer Inhalts-/Positions-Referenzen im Text
78 
79 SwTxtRefMark::SwTxtRefMark( SwFmtRefMark& rAttr,
80             xub_StrLen const nStartPos, xub_StrLen const*const pEnd)
81     : SwTxtAttrEnd( rAttr, nStartPos, nStartPos )
82     , m_pTxtNode( 0 )
83     , m_pEnd( 0 )
84 {
85     rAttr.pTxtAttr = this;
86     if ( pEnd )
87     {
88         m_nEnd = *pEnd;
89         m_pEnd = & m_nEnd;
90     }
91     else
92     {
93         SetHasDummyChar(true);
94     }
95     SetDontMoveAttr( true );
96     SetOverlapAllowedAttr( true );
97 }
98 
99 xub_StrLen* SwTxtRefMark::GetEnd()
100 {
101     return m_pEnd;
102 }
103 
104