LibreOffice Module sw (master) 1
atrtox.cxx
Go to the documentation of this file.
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 <tox.hxx>
23
25 sal_Int32 const nStartPos, sal_Int32 const*const pEnd)
26 : SwTextAttr( rAttr, nStartPos )
27 , SwTextAttrEnd( rAttr, nStartPos, nStartPos )
28 , m_pTextNode( nullptr )
29 , m_pEnd( nullptr )
30{
31 rAttr.m_pTextAttr = this;
32 if ( rAttr.GetAlternativeText().isEmpty() )
33 {
34 m_nEnd = *pEnd;
35 m_pEnd = & m_nEnd;
36 }
37 else
38 {
39 SetHasDummyChar(true);
40 }
41 SetDontMoveAttr( true );
43}
44
46{
47}
48
49const sal_Int32* SwTextTOXMark::GetEnd() const
50{
51 return m_pEnd;
52}
53
54void SwTextTOXMark::SetEnd(sal_Int32 n)
55{
56 *m_pEnd = n;
57 if (m_pHints)
59}
60
62{
63 SwTOXMark& rTOX = const_cast<SwTOXMark&>(GetTOXMark());
64 TOXTypes eType = rTOX.GetTOXType()->GetType();
65 const sal_uInt16 nCount = rDoc.GetTOXTypeCount( eType );
66 const SwTOXType* pType = nullptr;
67 const OUString rNm = rTOX.GetTOXType()->GetTypeName();
68
69 for(sal_uInt16 i=0; i < nCount; ++i)
70 {
71 const SwTOXType* pSrcType = rDoc.GetTOXType(eType, i);
72 if(pSrcType->GetTypeName() == rNm )
73 {
74 pType = pSrcType;
75 break;
76 }
77 }
78
79 // if the requested tox type does not exist, create it
80 if(!pType)
81 {
82 rDoc.InsertTOXType( SwTOXType( rDoc, eType, rNm ) );
83 pType = rDoc.GetTOXType(eType, 0);
84 }
85
86 // register at target tox type
87 const_cast<SwTOXType*>(pType)->Add( &rTOX );
88}
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:197
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
Definition: doctxm.cxx:630
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage table of content types.
Definition: doctxm.cxx:612
const SwTOXType * GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
Definition: doctxm.cxx:621
const SwTOXType * GetTOXType() const
Definition: tox.hxx:576
const OUString & GetAlternativeText() const
Definition: tox.hxx:570
SwTextTOXMark * m_pTextAttr
Definition: tox.hxx:98
const OUString & GetTypeName() const
Definition: tox.hxx:690
TOXTypes GetType() const
Definition: tox.hxx:693
sal_Int32 m_nEnd
Definition: txatbase.hxx:138
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
void SetDontMoveAttr(bool bFlag)
Definition: txatbase.hxx:73
void SetOverlapAllowedAttr(bool bFlag)
Definition: txatbase.hxx:75
void SetHasDummyChar(const bool bFlag)
Definition: txatbase.hxx:78
SwpHints * m_pHints
Definition: txatbase.hxx:67
const SwTOXMark & GetTOXMark() const
Definition: txatbase.hxx:232
virtual void SetEnd(sal_Int32) override
Definition: atrtox.cxx:54
SwTextTOXMark(SwTOXMark &rAttr, sal_Int32 const nStart, sal_Int32 const *const pEnd)
Definition: atrtox.cxx:24
void CopyTOXMark(SwDoc &rDestDoc)
Definition: atrtox.cxx:61
sal_Int32 * m_pEnd
Definition: txttxmrk.hxx:31
virtual const sal_Int32 * GetEnd() const override
end position
Definition: atrtox.cxx:49
virtual ~SwTextTOXMark() override
Definition: atrtox.cxx:45
void EndPosChanged() const
Definition: ndhints.hxx:213
int nCount
DocumentType eType
sal_Int64 n
int i
TOXTypes
Definition: toxe.hxx:40