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 5052 : DocumentOutlineNodesManager::DocumentOutlineNodesManager( SwDoc& i_rSwdoc ) : m_rSwdoc( i_rSwdoc )
27 : {
28 5052 : }
29 :
30 162 : sal_Int32 DocumentOutlineNodesManager::getOutlineNodesCount() const
31 : {
32 162 : return m_rSwdoc.GetNodes().GetOutLineNds().size();
33 : }
34 :
35 0 : int DocumentOutlineNodesManager::getOutlineLevel( const sal_Int32 nIdx ) const
36 : {
37 0 : return m_rSwdoc.GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->
38 0 : GetTxtNode()->GetAttrOutlineLevel()-1;
39 : }
40 :
41 0 : OUString DocumentOutlineNodesManager::getOutlineText( const sal_Int32 nIdx,
42 : const bool bWithNumber,
43 : const bool bWithSpacesForLevel,
44 : const bool bWithFtn ) const
45 : {
46 0 : return m_rSwdoc.GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->
47 : GetTxtNode()->GetExpandTxt( 0, -1, bWithNumber,
48 0 : bWithNumber, bWithSpacesForLevel, bWithFtn );
49 : }
50 :
51 0 : SwTxtNode* DocumentOutlineNodesManager::getOutlineNode( const sal_Int32 nIdx ) const
52 : {
53 0 : return m_rSwdoc.GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->GetTxtNode();
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_uInt16 nOutlCount( static_cast<sal_uInt16>(getOutlineNodesCount()) );
62 0 : for ( sal_uInt16 i = 0; i < nOutlCount; ++i )
63 : {
64 : orOutlineNodeList.push_back(
65 0 : m_rSwdoc.GetNodes().GetOutLineNds()[i]->GetTxtNode() );
66 : }
67 0 : }
68 :
69 10090 : DocumentOutlineNodesManager::~DocumentOutlineNodesManager()
70 : {
71 10090 : }
72 :
73 :
74 270 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|