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