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