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 : #include <DocumentOutlineNodesManager.hxx>
20 : #include <doc.hxx>
21 : #include <ndtxt.hxx>
22 :
23 : namespace sw
24 : {
25 :
26 2958 : DocumentOutlineNodesManager::DocumentOutlineNodesManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc )
27 : {
28 2958 : }
29 :
30 40 : sal_Int32 DocumentOutlineNodesManager::getOutlineNodesCount() const
31 : {
32 40 : return m_rDoc.GetNodes().GetOutLineNds().size();
33 : }
34 :
35 0 : int DocumentOutlineNodesManager::getOutlineLevel( const sal_Int32 nIdx ) const
36 : {
37 0 : return m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->
38 0 : GetTextNode()->GetAttrOutlineLevel()-1;
39 : }
40 :
41 0 : OUString DocumentOutlineNodesManager::getOutlineText( const sal_Int32 nIdx,
42 : const bool bWithNumber,
43 : const bool bWithSpacesForLevel,
44 : const bool bWithFootnote ) const
45 : {
46 0 : return m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->
47 : GetTextNode()->GetExpandText( 0, -1, bWithNumber,
48 0 : bWithNumber, bWithSpacesForLevel, bWithFootnote );
49 : }
50 :
51 0 : SwTextNode* DocumentOutlineNodesManager::getOutlineNode( const sal_Int32 nIdx ) const
52 : {
53 0 : return m_rDoc.GetNodes().GetOutLineNds()[ nIdx ]->GetTextNode();
54 : }
55 :
56 0 : void DocumentOutlineNodesManager::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const
57 : {
58 0 : orOutlineNodeList.clear();
59 0 : orOutlineNodeList.reserve( getOutlineNodesCount() );
60 :
61 0 : const sal_Int32 nOutlCount = getOutlineNodesCount();
62 0 : for ( sal_Int32 i = 0; i < nOutlCount; ++i )
63 : {
64 : orOutlineNodeList.push_back(
65 0 : m_rDoc.GetNodes().GetOutLineNds()[i]->GetTextNode() );
66 : }
67 0 : }
68 :
69 5898 : DocumentOutlineNodesManager::~DocumentOutlineNodesManager()
70 : {
71 5898 : }
72 :
73 :
74 177 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|