merge the formfield patch from ooo-build
[ooovba.git] / sw / source / filter / ww8 / docxfootnotes.hxx
blobb594f88f5866a18c9c2acfcc1a5f43576b671ac7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile$
10 * $Revision$
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DOCXFOOTNOTES_HXX_
32 #define _DOCXFOOTNOTES_HXX_
34 #include <fmtftn.hxx>
36 #include <oox/core/tokens.hxx>
37 #include <rtl/string.hxx>
38 #include <rtl/ustring.hxx>
39 #include <sax/fshelper.hxx>
41 #include <vector>
43 namespace docx {
45 typedef ::std::vector< const SwFmtFtn* > FootnotesVector;
47 /** Remember footnotes/endnotes so that we can dump them in one go.
49 Also rememeber the last added footnote Id to be able to write it in the
50 DocxAttributeOutput::EndRunProperties() method.
52 class FootnotesList {
53 /// The current footnote, that was not written yet.
54 sal_Int32 m_nCurrent;
56 /// List of the footnotes.
57 FootnotesVector m_aFootnotes;
59 public:
60 FootnotesList() : m_nCurrent( -1 ) {}
62 void add( const SwFmtFtn& rFootnote )
64 m_aFootnotes.push_back( &rFootnote );
65 m_nCurrent = m_aFootnotes.size() - 1;
68 /// Return the current footnote/endnote and clear the 'current' state.
69 const SwFmtFtn* getCurrent( sal_Int32& rId )
71 // skip ids 0 and 1 - they are reserved for separator and
72 // continuationSeparator
73 rId = m_nCurrent + 2;
75 // anything to write at all?
76 if ( m_nCurrent < 0 )
78 rId = -1;
79 return NULL;
82 const SwFmtFtn *pFootnote = m_aFootnotes[m_nCurrent];
83 m_nCurrent = -1;
85 return pFootnote;
88 /// Return all the footnotes/endnotes.
89 const FootnotesVector& getVector() const
91 return m_aFootnotes;
94 /// Do we have any footnotes/endnotes at all?
95 bool isEmpty() const
97 return m_aFootnotes.empty();
101 } // namespace docx
103 #endif // _DOCXFOOTNOTES_HXX_