Line data Source code
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 : * Footnote config.
59 : ************************************************************************/
60 : #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFOOTNOTECONFIG_HXX
61 : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFOOTNOTECONFIG_HXX
62 :
63 : #include "xfstyle.hxx"
64 :
65 12 : class XFFootnoteConfig : public XFStyle
66 : {
67 : public:
68 : XFFootnoteConfig();
69 :
70 : public:
71 : void SetBodyStyle(const OUString& style);
72 :
73 : void SetCitationStyle(const OUString& style);
74 :
75 : void SetDefaultStyle(const OUString& style);
76 :
77 : void SetMasterPage(const OUString& masterPage);
78 :
79 : void SetNumberFormat(const OUString& numberFormat);
80 :
81 : void SetStartValue(sal_Int32 value=0);
82 :
83 : void SetRestartOnPage();
84 :
85 : void SetRestartOnChapter();
86 :
87 : void SetInsertInPage(bool page=true);
88 :
89 : void SetNumPrefix(const OUString& numprefix);
90 :
91 : void SetNumSuffix(const OUString& numsuffix);
92 :
93 : void SetMessageOn(const OUString& message);
94 :
95 : void SetMessageFrom(const OUString& message);
96 :
97 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
98 :
99 : protected:
100 : OUString m_strBodyStyle;
101 : OUString m_strCitationStyle;
102 : OUString m_strDefaultStyle;
103 : OUString m_strMasterPage;
104 : OUString m_strNumFmt;
105 : OUString m_strNumPrefix;
106 : OUString m_strNumSuffix;
107 : OUString m_strMessageFrom;
108 : OUString m_strMessageOn;
109 : sal_Int32 m_nStartValue;
110 : sal_Int32 m_nRestartType;
111 : bool m_bInsertInPage;
112 : bool m_bIsFootnote;
113 : };
114 :
115 8 : inline XFFootnoteConfig::XFFootnoteConfig()
116 : {
117 8 : m_nStartValue = 0;
118 8 : m_nRestartType = -1;
119 8 : m_strNumFmt = "1";
120 8 : m_bInsertInPage = true;
121 8 : m_strDefaultStyle = "Footnote";
122 8 : m_strMasterPage = "Footnote";
123 8 : m_strCitationStyle = "Footnote Symbol";
124 8 : m_strBodyStyle = "Footnote anchor";
125 8 : m_bIsFootnote = true;
126 8 : }
127 :
128 : inline void XFFootnoteConfig::SetBodyStyle(const OUString& style)
129 : {
130 : m_strBodyStyle = style;
131 : }
132 :
133 : inline void XFFootnoteConfig::SetCitationStyle(const OUString& style)
134 : {
135 : m_strCitationStyle = style;
136 : }
137 :
138 : inline void XFFootnoteConfig::SetDefaultStyle(const OUString& style)
139 : {
140 : m_strDefaultStyle = style;
141 : }
142 :
143 8 : inline void XFFootnoteConfig::SetMasterPage(const OUString& masterPage)
144 : {
145 8 : m_strMasterPage = masterPage;
146 8 : }
147 :
148 : inline void XFFootnoteConfig::SetNumberFormat(const OUString& numberFormat)
149 : {
150 : m_strNumFmt = numberFormat;
151 : }
152 :
153 8 : inline void XFFootnoteConfig::SetStartValue(sal_Int32 value)
154 : {
155 8 : if( value<0 )
156 8 : return;
157 8 : m_nStartValue = value;
158 : }
159 :
160 0 : inline void XFFootnoteConfig::SetRestartOnPage()
161 : {
162 0 : m_nRestartType = 0;
163 0 : }
164 :
165 : inline void XFFootnoteConfig::SetRestartOnChapter()
166 : {
167 : m_nRestartType = 1;
168 : }
169 :
170 : inline void XFFootnoteConfig::SetInsertInPage(bool page)
171 : {
172 : m_bInsertInPage = page;
173 : }
174 :
175 8 : inline void XFFootnoteConfig::SetNumPrefix(const OUString& numprefix)
176 : {
177 8 : m_strNumPrefix = numprefix;
178 8 : }
179 :
180 8 : inline void XFFootnoteConfig::SetNumSuffix(const OUString& numsuffix)
181 : {
182 8 : m_strNumSuffix = numsuffix;
183 8 : }
184 :
185 0 : inline void XFFootnoteConfig::SetMessageOn(const OUString& message)
186 : {
187 0 : m_strMessageOn = message;
188 0 : }
189 :
190 0 : inline void XFFootnoteConfig::SetMessageFrom(const OUString& message)
191 : {
192 0 : m_strMessageFrom = message;
193 0 : }
194 :
195 6 : inline void XFFootnoteConfig::ToXml(IXFStream *pStrm)
196 : {
197 6 : IXFAttrList *pAttrList = pStrm->GetAttrList();
198 6 : pAttrList->Clear();
199 :
200 6 : if( !m_strCitationStyle.isEmpty() )
201 6 : pAttrList->AddAttribute( "text:citation-style-name", m_strCitationStyle);
202 :
203 6 : if( !m_strBodyStyle.isEmpty() )
204 6 : pAttrList->AddAttribute( "text:citation-body-style-name", m_strBodyStyle);
205 :
206 6 : if( !m_strNumPrefix.isEmpty() )
207 3 : pAttrList->AddAttribute( "style:num-prefix", m_strNumPrefix);
208 :
209 6 : if( !m_strNumSuffix.isEmpty() )
210 3 : pAttrList->AddAttribute( "style:num-suffix", m_strNumSuffix);
211 :
212 6 : if( !m_strNumFmt.isEmpty() )
213 6 : pAttrList->AddAttribute( "style:num-format", m_strNumFmt);
214 :
215 6 : if( !m_strDefaultStyle.isEmpty() )
216 6 : pAttrList->AddAttribute( "text:default-style-name", m_strDefaultStyle);
217 :
218 6 : if( !m_strMasterPage.isEmpty() )
219 6 : pAttrList->AddAttribute( "text:master-page-name", m_strMasterPage);
220 :
221 6 : pAttrList->AddAttribute( "text:start-value", OUString::number(m_nStartValue) );
222 :
223 6 : if( m_bIsFootnote )
224 : {
225 3 : if( m_nRestartType == -1 )
226 3 : pAttrList->AddAttribute( "text:start-numbering-at", "document" );
227 0 : else if( m_nRestartType == 0 )
228 0 : pAttrList->AddAttribute( "text:start-numbering-at", "page" );
229 0 : else if( m_nRestartType == 1 )
230 0 : pAttrList->AddAttribute( "text:start-numbering-at", "chapter" );
231 :
232 3 : if( m_bInsertInPage )
233 3 : pAttrList->AddAttribute( "text:footnotes-position", "page" );
234 : else
235 0 : pAttrList->AddAttribute( "text:footnotes-position", "document" );
236 : }
237 :
238 6 : if(m_bIsFootnote)
239 : {
240 3 : pStrm->StartElement( "text:footnotes-configuration" );
241 3 : if( !m_strMessageOn.isEmpty() )
242 : {
243 0 : pStrm->StartElement( "text:footnote-continuation-notice-forward" );
244 0 : pStrm->Characters(m_strMessageOn);
245 0 : pStrm->EndElement( "text:footnote-continuation-notice-forward" );
246 : }
247 :
248 3 : if( !m_strMessageFrom.isEmpty() )
249 : {
250 0 : pStrm->StartElement( "text:footnote-continuation-notice-backward" );
251 0 : pStrm->Characters(m_strMessageFrom);
252 0 : pStrm->EndElement( "text:footnote-continuation-notice-backward" );
253 : }
254 :
255 3 : pStrm->EndElement( "text:footnotes-configuration" );
256 : }
257 : else
258 : {
259 3 : pStrm->StartElement( "text:endnotes-configuration" );
260 3 : pStrm->EndElement( "text:endnotes-configuration" );
261 : }
262 :
263 6 : }
264 :
265 : #endif
266 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|