LibreOffice Module lotuswordpro (master) 1
xfindex.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 *
31 *
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
38 *
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
55 ************************************************************************/
56/*************************************************************************
57 * @file
58 * Represents index source, index body and index entry.
59 ************************************************************************/
60#ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFINDEX_HXX
61#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFINDEX_HXX
62#include <map>
63#include <vector>
64
65#include <xfilter/xfcontent.hxx>
67#include <rtl/ref.hxx>
68
69class XFIndex;
70class XFIndexTemplate;
71class XFParagraph;
72
79{
80public:
82
83public:
87 void SetLevel(const OUString& level);
91 void SetStyleName(const OUString& style) override;
95 void AddEntry(enumXFIndexTemplate entry, const OUString& styleName);
96
100 void AddTabEntry(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter, const OUString& styleName);
101
105 void AddTextEntry(const OUString& sSpan, const OUString& styleName);
106
107 virtual void ToXml(IXFStream *pStrm) override;
108
109private:
113 void SetTagName(const OUString& tag);
114
115 friend class XFIndex;
116private:
117 OUString m_nLevel;
118 OUString m_strStyle;
123 OUString m_strTagName;
124 typedef std::pair<enumXFIndexTemplate, OUString> TOCTEMPLATE_ENTRY_TYPE;
125 std::vector<TOCTEMPLATE_ENTRY_TYPE> m_aEntries; // template entry + text style
126 std::map<sal_uInt16, OUString> m_aTextEntries;
127};
128
134{
135public:
136 XFIndex();
137
138 virtual ~XFIndex() override;
139
140public:
145
149 void AddTemplate(const OUString& level, const OUString& style, XFIndexTemplate* templ);
150
154 void SetProtected(bool protect);
155
159 void SetSeparator(bool sep);
160
161 virtual void ToXml(IXFStream *pStrm) override;
162
163 void AddTocSource(sal_uInt16 nLevel, const OUString& sStyleName);
164
165private:
167 OUString m_strTitle;
170
171 std::vector<rtl::Reference<XFIndexTemplate>> m_aTemplates; // template entry + style
172
173 #define MAX_TOC_LEVEL 10
174 std::vector<OUString> m_aTOCSource[MAX_TOC_LEVEL+1];
175};
176
178 : m_eTabType(enumXFTabNone)
179 , m_fTabLength(0.0)
180{
181 m_nLevel = OUString::number(0);
182}
183
184inline void XFIndexTemplate::SetLevel(const OUString& level)
185{
186 m_nLevel = level;
187}
188inline void XFIndexTemplate::SetStyleName(const OUString& style)
189{
190 m_strStyle = style;
191}
192
193inline void XFIndexTemplate::SetTagName(const OUString& tag)
194{
195 m_strTagName = tag;
196}
197
198inline void XFIndexTemplate::AddEntry(enumXFIndexTemplate entry, const OUString& styleName)
199{
200 std::pair<enumXFIndexTemplate, OUString> pair(entry, styleName);
201 m_aEntries.push_back(pair);
202}
203
204inline void XFIndexTemplate::AddTabEntry(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter, const OUString& styleName)
205{
207 m_strTabLeader = OUString( leader );
208 m_strTabDelimiter = OUString( delimiter );
209 m_fTabLength = len;
210
212}
213
214inline void XFIndexTemplate::AddTextEntry(const OUString& sText, const OUString& styleName)
215{
216 sal_uInt16 nLen = m_aEntries.size();
218
219 m_aTextEntries[nLen] = sText;
220}
221
223{
224 m_eType = type;
225}
226
227#endif
228
229/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stream wrapper for sax writer.
Definition: ixfstream.hxx:72
A container for content.
@descr Base class for all content object.
Definition: xfcontent.hxx:80
Index template.
Definition: xfindex.hxx:79
OUString m_strStyle
Definition: xfindex.hxx:118
OUString m_nLevel
Definition: xfindex.hxx:117
std::map< sal_uInt16, OUString > m_aTextEntries
Definition: xfindex.hxx:126
void SetTagName(const OUString &tag)
@descr Helper function.
Definition: xfindex.hxx:193
OUString m_strTabDelimiter
Definition: xfindex.hxx:121
OUString m_strTagName
Definition: xfindex.hxx:123
void SetStyleName(const OUString &style) override
@descr Set style.
Definition: xfindex.hxx:188
std::vector< TOCTEMPLATE_ENTRY_TYPE > m_aEntries
Definition: xfindex.hxx:125
OUString m_strTabLeader
Definition: xfindex.hxx:122
std::pair< enumXFIndexTemplate, OUString > TOCTEMPLATE_ENTRY_TYPE
Definition: xfindex.hxx:124
void AddEntry(enumXFIndexTemplate entry, const OUString &styleName)
@descr Add an entry in the template.
Definition: xfindex.hxx:198
void AddTabEntry(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter, const OUString &styleName)
@descr Add a tab entry in the template.
Definition: xfindex.hxx:204
void SetLevel(const OUString &level)
@descr Set template level.
Definition: xfindex.hxx:184
virtual void ToXml(IXFStream *pStrm) override
Definition: xfindex.cxx:231
enumXFTab m_eTabType
Definition: xfindex.hxx:119
double m_fTabLength
Definition: xfindex.hxx:120
void AddTextEntry(const OUString &sSpan, const OUString &styleName)
@descr Add an entry in the template.
Definition: xfindex.hxx:214
Index, include index template, index body.
Definition: xfindex.hxx:134
OUString m_strTitle
Definition: xfindex.hxx:167
XFIndex()
Definition: xfindex.cxx:63
bool m_bSeparator
Definition: xfindex.hxx:169
void SetProtected(bool protect)
@descr Set if protected index to prevent handy-revise.
Definition: xfindex.cxx:83
bool m_bProtect
Definition: xfindex.hxx:168
enumXFIndex m_eType
Definition: xfindex.hxx:166
void SetSeparator(bool sep)
@descr Set separator.
Definition: xfindex.cxx:88
virtual ~XFIndex() override
Definition: xfindex.cxx:69
void AddTemplate(const OUString &level, const OUString &style, XFIndexTemplate *templ)
@descr Add index template entry.
Definition: xfindex.cxx:73
virtual void ToXml(IXFStream *pStrm) override
@descr Output to OOo model or local file.
Definition: xfindex.cxx:103
void AddTocSource(sal_uInt16 nLevel, const OUString &sStyleName)
Definition: xfindex.cxx:93
void SetIndexType(enumXFIndex type)
@descr Set index type.
Definition: xfindex.hxx:222
std::vector< OUString > m_aTOCSource[MAX_TOC_LEVEL+1]
Definition: xfindex.hxx:174
std::vector< rtl::Reference< XFIndexTemplate > > m_aTemplates
Definition: xfindex.hxx:171
Paragraph object for SODC.
Definition: xfparagraph.hxx:73
sal_uInt16 sal_Unicode
ResultType type
enumXFIndex
Definition: xfdefs.hxx:441
enumXFIndexTemplate
Definition: xfdefs.hxx:451
@ enumXFIndexTemplateSpan
Definition: xfdefs.hxx:459
@ enumXFIndexTemplateTab
Definition: xfdefs.hxx:455
enumXFTab
Definition: xfdefs.hxx:230
@ enumXFTabNone
Definition: xfdefs.hxx:231
#define MAX_TOC_LEVEL
Definition: xfindex.hxx:173