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 :
20 : #include <doc.hxx>
21 : #include <txttxmrk.hxx>
22 : #include <swfont.hxx>
23 : #include <tox.hxx>
24 : #include <ndtxt.hxx>
25 :
26 342 : SwTxtTOXMark::SwTxtTOXMark( SwTOXMark& rAttr,
27 : sal_Int32 const nStartPos, sal_Int32 const*const pEnd)
28 : : SwTxtAttr( rAttr, nStartPos )
29 : , SwTxtAttrEnd( rAttr, nStartPos, nStartPos )
30 : , m_pTxtNode( 0 )
31 342 : , m_pEnd( 0 )
32 : {
33 342 : rAttr.pTxtAttr = this;
34 342 : if ( rAttr.GetAlternativeText().isEmpty() )
35 : {
36 28 : m_nEnd = *pEnd;
37 28 : m_pEnd = & m_nEnd;
38 : }
39 : else
40 : {
41 314 : SetHasDummyChar(true);
42 : }
43 342 : SetDontMoveAttr( true );
44 342 : SetOverlapAllowedAttr( true );
45 342 : }
46 :
47 684 : SwTxtTOXMark::~SwTxtTOXMark()
48 : {
49 684 : }
50 :
51 18786 : sal_Int32* SwTxtTOXMark::GetEnd()
52 : {
53 18786 : return m_pEnd;
54 : }
55 :
56 0 : void SwTxtTOXMark::CopyTOXMark( SwDoc* pDoc )
57 : {
58 0 : SwTOXMark& rTOX = (SwTOXMark&)GetTOXMark();
59 0 : TOXTypes eType = rTOX.GetTOXType()->GetType();
60 0 : const sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType );
61 0 : const SwTOXType* pType = 0;
62 0 : const OUString rNm = rTOX.GetTOXType()->GetTypeName();
63 :
64 : // kein entsprechender Verzeichnistyp vorhanden -> anlegen
65 : // sonst verwenden
66 0 : for(sal_uInt16 i=0; i < nCount; ++i)
67 : {
68 0 : const SwTOXType* pSrcType = pDoc->GetTOXType(eType, i);
69 0 : if(pSrcType->GetTypeName() == rNm )
70 : {
71 0 : pType = pSrcType;
72 0 : break;
73 : }
74 : }
75 : // kein entsprechender Typ vorhanden -> neu erzeugen
76 :
77 0 : if(!pType)
78 : {
79 0 : pDoc->InsertTOXType( SwTOXType( eType, rNm ) );
80 0 : pType = pDoc->GetTOXType(eType, 0);
81 : }
82 : // Verzeichnistyp umhaengen
83 :
84 0 : ((SwTOXType*)pType)->Add( &rTOX );
85 270 : }
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|