1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_X_NOTE_HELPER_HXX
21 #define INCLUDED_X_NOTE_HELPER_HXX
24 #include <WW8DocumentImpl.hxx>
26 namespace writerfilter
{
30 A helper class for footnotes and endnotes and annotations(aka X-notes).
35 /// Character positions of X-notes in footnote document
36 WW8StructBase::Pointer_t mpCps
;
38 /// Character positions of references to X-notes
39 typename PLCF
<T
>::Pointer_t mpRefs
;
41 /// piece table for CP to FC conversion
42 WW8PieceTable::Pointer_t mpPieceTable
;
45 WW8DocumentImpl
* mpDocument
;
47 /// type of X-notes handled by this helper (PROP_FOOTNOTE, PROP_ENDNOTE)
50 /// offset in document where X-note subdocument starts
51 CpAndFc mCpAndFcOffset
;
54 Return CpAndFc in document for X-note.
56 @param nPos index of X-note
58 CpAndFc
getCpAndFc(sal_uInt32 nPos
);
61 Return CpAndFc in document for reference to a certain X-note.
63 @param nPos index of the X-note
65 CpAndFc
getRefCpAndFc(sal_uInt32 nPos
);
68 typedef boost::shared_ptr
<XNoteHelper
> Pointer_t
;
70 XNoteHelper(WW8StructBase::Pointer_t pCps
,
71 typename PLCF
<T
>::Pointer_t pRefs
,
72 WW8PieceTable::Pointer_t pPieceTable
,
73 WW8DocumentImpl
* pDocument
,
75 CpAndFc cpAndFcOffset
)
76 : mpCps(pCps
), mpRefs(pRefs
), mpPieceTable(pPieceTable
),
77 mpDocument(pDocument
), meType(eType
), mCpAndFcOffset(cpAndFcOffset
)
84 Generates CpAndFcs in document for X-notes.
89 Return number of X-notes.
91 sal_uInt32
getCount() const;
94 Return index of CpAndFc.
96 @param rCpAndFc the CpAndFc to search
98 @return the index of the rCpAndFc found or getCount() otherwise
100 sal_uInt32
getIndexOfCpAndFc(const CpAndFc
& rCpAndFc
);
103 Return subdocument containing X-note.
105 @param nIndex index of X-note.
107 writerfilter::Reference
<Stream
>::Pointer_t
get(sal_uInt32 nIndex
);
110 Return subdocument containing X-note.
112 @param rCpAndFc CpAndFc of the X-note's reference
114 writerfilter::Reference
<Stream
>::Pointer_t
get(const CpAndFc
& rCpAndFc
);
117 Return reference data structure of X-note.
119 @param nIndex index of X-note
121 T
* getRef(sal_uInt32 nIndex
);
124 Return reference data structure of X-note.
126 @param rCpAndFc CpAndFc for the X-note's reference
128 T
* getRef(const CpAndFc
& rCpAndFc
);
133 #endif // INCLUDED_X_NOTE_HELPER_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */