LibreOffice Module sw (master)  1
docxfootnotes.hxx
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 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_DOCXFOOTNOTES_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_DOCXFOOTNOTES_HXX
22 
23 #include <sal/types.h>
24 
25 #include <vector>
26 
27 class SwFormatFootnote;
28 
29 namespace docx {
30 
31 typedef std::vector< const SwFormatFootnote* > FootnotesVector;
32 
40  sal_Int32 m_nCurrent;
41 
43  FootnotesVector m_aFootnotes;
44 
45 public:
46  FootnotesList() : m_nCurrent( -1 ) {}
47 
48  void add( const SwFormatFootnote& rFootnote )
49  {
50  m_aFootnotes.push_back( &rFootnote );
51  m_nCurrent = m_aFootnotes.size() - 1;
52  }
53 
55  const SwFormatFootnote* getCurrent( sal_Int32& rId )
56  {
57  // anything to write at all?
58  if ( m_nCurrent < 0 )
59  {
60  rId = -1;
61  return nullptr;
62  }
63 
64  // skip ids 0 and 1 - they are reserved for separator and
65  // continuationSeparator
66  rId = m_nCurrent + 2;
67 
68  const SwFormatFootnote *pFootnote = m_aFootnotes[m_nCurrent];
69  m_nCurrent = -1;
70 
71  return pFootnote;
72  }
73 
75  const FootnotesVector& getVector() const
76  {
77  return m_aFootnotes;
78  }
79 
81  bool isEmpty() const
82  {
83  return m_aFootnotes.empty();
84  }
85 };
86 
87 } // namespace docx
88 
89 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXFOOTNOTES_HXX
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void add(const SwFormatFootnote &rFootnote)
FootnotesVector m_aFootnotes
List of the footnotes.
std::vector< const SwFormatFootnote * > FootnotesVector
const SwFormatFootnote * getCurrent(sal_Int32 &rId)
Return the current footnote/endnote and clear the 'current' state.
Remember footnotes/endnotes so that we can dump them in one go.
sal_Int32 m_nCurrent
The current footnote, that was not written yet.
const FootnotesVector & getVector() const
Return all the footnotes/endnotes.
bool isEmpty() const
Do we have any footnotes/endnotes at all?