xref: /trunk/main/xmloff/source/text/txtftne.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir /** @#file
29cdf0e10cSrcweir  *
30cdf0e10cSrcweir  * This file implements XMLTextParagraphExport methods to export
31cdf0e10cSrcweir  * - footnotes
32cdf0e10cSrcweir  * - endnotes
33cdf0e10cSrcweir  * - footnote configuration elements
34cdf0e10cSrcweir  * - endnote configuration elements
35cdf0e10cSrcweir  */
36cdf0e10cSrcweir #include <tools/debug.hxx>
37cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
38cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
39cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
40cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
41cdf0e10cSrcweir #include <com/sun/star/text/XTextDocument.hpp>
42cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
43cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp>
44cdf0e10cSrcweir #include <com/sun/star/text/XFootnote.hpp>
45cdf0e10cSrcweir #include <com/sun/star/text/XFootnotesSupplier.hpp>
46cdf0e10cSrcweir #include <com/sun/star/text/XEndnotesSupplier.hpp>
47cdf0e10cSrcweir #include <com/sun/star/text/FootnoteNumbering.hpp>
48cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp>
49cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
50cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
51cdf0e10cSrcweir #include <xmloff/xmlnumfe.hxx>
52cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
53cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
54cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
55cdf0e10cSrcweir #include <xmloff/families.hxx>
56cdf0e10cSrcweir #include <xmloff/xmlnume.hxx>
57cdf0e10cSrcweir #include "XMLTextCharStyleNamesElementExport.hxx"
58cdf0e10cSrcweir #include <xmloff/XMLEventExport.hxx>
59cdf0e10cSrcweir #ifndef _XMLOFF_TXTPARAE_HXX
60cdf0e10cSrcweir #include <xmloff/txtparae.hxx>
61cdf0e10cSrcweir #endif
62cdf0e10cSrcweir 
63cdf0e10cSrcweir using ::rtl::OUString;
64cdf0e10cSrcweir using ::rtl::OUStringBuffer;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir using namespace ::com::sun::star;
67cdf0e10cSrcweir using namespace ::com::sun::star::uno;
68cdf0e10cSrcweir using namespace ::com::sun::star::lang;
69cdf0e10cSrcweir using namespace ::com::sun::star::beans;
70cdf0e10cSrcweir using namespace ::com::sun::star::text;
71cdf0e10cSrcweir using namespace ::com::sun::star::container;
72cdf0e10cSrcweir using namespace ::xmloff::token;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
exportTextFootnote(const Reference<XPropertySet> & rPropSet,const OUString & rText,sal_Bool bAutoStyles,sal_Bool bIsProgress)75cdf0e10cSrcweir void XMLTextParagraphExport::exportTextFootnote(
76cdf0e10cSrcweir     const Reference<XPropertySet> & rPropSet,
77cdf0e10cSrcweir     const OUString& rText,
78cdf0e10cSrcweir     sal_Bool bAutoStyles, sal_Bool bIsProgress )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir     // get footnote and associated text
81cdf0e10cSrcweir     Any aAny;
82cdf0e10cSrcweir     aAny = rPropSet->getPropertyValue(sFootnote);
83cdf0e10cSrcweir     Reference<XFootnote> xFootnote;
84cdf0e10cSrcweir     aAny >>= xFootnote;
85cdf0e10cSrcweir     Reference<XText> xText(xFootnote, UNO_QUERY);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     // are we an endnote?
88cdf0e10cSrcweir     Reference<XServiceInfo> xServiceInfo( xFootnote, UNO_QUERY );
89cdf0e10cSrcweir     sal_Bool bIsEndnote = xServiceInfo->supportsService(sTextEndnoteService);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     if (bAutoStyles)
92cdf0e10cSrcweir     {
93cdf0e10cSrcweir         // handle formatting of citation mark
94cdf0e10cSrcweir         Add( XML_STYLE_FAMILY_TEXT_TEXT, rPropSet );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         // handle formatting within footnote
97cdf0e10cSrcweir         exportTextFootnoteHelper(xFootnote, xText, rText,
98cdf0e10cSrcweir                                  bAutoStyles, bIsEndnote, bIsProgress );
99cdf0e10cSrcweir     }
100cdf0e10cSrcweir     else
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir         // create span (for citation mark) if necessary; footnote content
103cdf0e10cSrcweir         // wil be handled via exportTextFootnoteHelper, exportText
104cdf0e10cSrcweir         sal_Bool bHasHyperlink;
105cdf0e10cSrcweir         sal_Bool bIsUICharStyle = sal_False;
106cdf0e10cSrcweir         sal_Bool bHasAutoStyle = sal_False;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir         OUString sStyle = FindTextStyleAndHyperlink( rPropSet, bHasHyperlink,
109cdf0e10cSrcweir                                                      bIsUICharStyle, bHasAutoStyle );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         // export hyperlink (if we have one)
112cdf0e10cSrcweir         Reference < XPropertySetInfo > xPropSetInfo;
113cdf0e10cSrcweir         if( bHasHyperlink )
114cdf0e10cSrcweir         {
115cdf0e10cSrcweir             Reference<XPropertyState> xPropState( rPropSet, UNO_QUERY );
116cdf0e10cSrcweir             xPropSetInfo = rPropSet->getPropertySetInfo();
117cdf0e10cSrcweir             bHasHyperlink =
118cdf0e10cSrcweir                 addHyperlinkAttributes( rPropSet, xPropState, xPropSetInfo );
119cdf0e10cSrcweir         }
120cdf0e10cSrcweir         SvXMLElementExport aHyperlink( GetExport(), bHasHyperlink,
121cdf0e10cSrcweir                                        XML_NAMESPACE_TEXT, XML_A,
122cdf0e10cSrcweir                                        sal_False, sal_False );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir         if( bHasHyperlink )
125cdf0e10cSrcweir         {
126cdf0e10cSrcweir             // export events (if supported)
127cdf0e10cSrcweir             OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
128cdf0e10cSrcweir                 "HyperLinkEvents"));
129cdf0e10cSrcweir             if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
130cdf0e10cSrcweir             {
131cdf0e10cSrcweir                 Any a = rPropSet->getPropertyValue(sHyperLinkEvents);
132cdf0e10cSrcweir                 Reference<XNameReplace> xName;
133cdf0e10cSrcweir                 a >>= xName;
134cdf0e10cSrcweir                 GetExport().GetEventExport().Export(xName, sal_False);
135cdf0e10cSrcweir             }
136cdf0e10cSrcweir         }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir         {
139cdf0e10cSrcweir             XMLTextCharStyleNamesElementExport aCharStylesExport(
140cdf0e10cSrcweir                 GetExport(), bIsUICharStyle &&
141cdf0e10cSrcweir                              aCharStyleNamesPropInfoCache.hasProperty(
142cdf0e10cSrcweir                                                     rPropSet ), bHasAutoStyle,
143cdf0e10cSrcweir                 rPropSet, sCharStyleNames );
144cdf0e10cSrcweir             if( sStyle.getLength() )
145cdf0e10cSrcweir             {
146cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
147cdf0e10cSrcweir                                           GetExport().EncodeStyleName( sStyle ) );
148cdf0e10cSrcweir                 SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
149cdf0e10cSrcweir                                           XML_SPAN, sal_False, sal_False );
150cdf0e10cSrcweir                 exportTextFootnoteHelper(xFootnote, xText, rText,
151cdf0e10cSrcweir                                          bAutoStyles, bIsEndnote, bIsProgress );
152cdf0e10cSrcweir             }
153cdf0e10cSrcweir             else
154cdf0e10cSrcweir             {
155cdf0e10cSrcweir                 exportTextFootnoteHelper(xFootnote, xText, rText,
156cdf0e10cSrcweir                                          bAutoStyles, bIsEndnote, bIsProgress );
157cdf0e10cSrcweir             }
158cdf0e10cSrcweir         }
159cdf0e10cSrcweir     }
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 
exportTextFootnoteHelper(const Reference<XFootnote> & rFootnote,const Reference<XText> & rText,const OUString & rTextString,sal_Bool bAutoStyles,sal_Bool bIsEndnote,sal_Bool bIsProgress)163cdf0e10cSrcweir void XMLTextParagraphExport::exportTextFootnoteHelper(
164cdf0e10cSrcweir     const Reference<XFootnote> & rFootnote,
165cdf0e10cSrcweir     const Reference<XText> & rText,
166cdf0e10cSrcweir     const OUString& rTextString,
167cdf0e10cSrcweir     sal_Bool bAutoStyles,
168cdf0e10cSrcweir     sal_Bool bIsEndnote,
169cdf0e10cSrcweir     sal_Bool bIsProgress )
170cdf0e10cSrcweir {
171cdf0e10cSrcweir     if (bAutoStyles)
172cdf0e10cSrcweir     {
173cdf0e10cSrcweir         exportText(rText, bAutoStyles, bIsProgress, sal_True );
174cdf0e10cSrcweir     }
175cdf0e10cSrcweir     else
176cdf0e10cSrcweir     {
177cdf0e10cSrcweir         // export reference Id (for reference fields)
178cdf0e10cSrcweir         Reference<XPropertySet> xPropSet(rFootnote, UNO_QUERY);
179cdf0e10cSrcweir         Any aAny = xPropSet->getPropertyValue(sReferenceId);
180cdf0e10cSrcweir         sal_Int32 nNumber = 0;
181cdf0e10cSrcweir         aAny >>= nNumber;
182cdf0e10cSrcweir         OUStringBuffer aBuf;
183cdf0e10cSrcweir         aBuf.appendAscii("ftn");
184cdf0e10cSrcweir         aBuf.append(nNumber);
185cdf0e10cSrcweir         GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_ID,
186cdf0e10cSrcweir                                  aBuf.makeStringAndClear());
187cdf0e10cSrcweir         GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
188cdf0e10cSrcweir                                  GetXMLToken( bIsEndnote ? XML_ENDNOTE
189cdf0e10cSrcweir                                                          : XML_FOOTNOTE ) );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir         SvXMLElementExport aNote(GetExport(), XML_NAMESPACE_TEXT,
192cdf0e10cSrcweir                                  XML_NOTE, sal_False, sal_False);
193cdf0e10cSrcweir         {
194cdf0e10cSrcweir             // handle label vs. automatic numbering
195cdf0e10cSrcweir             OUString sLabel = rFootnote->getLabel();
196cdf0e10cSrcweir             if (sLabel.getLength()>0)
197cdf0e10cSrcweir             {
198cdf0e10cSrcweir                 GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_LABEL,
199cdf0e10cSrcweir                                          sLabel);
200cdf0e10cSrcweir             }
201cdf0e10cSrcweir             // else: automatic numbering -> no attribute
202cdf0e10cSrcweir 
203cdf0e10cSrcweir             SvXMLElementExport aCite(GetExport(), XML_NAMESPACE_TEXT,
204cdf0e10cSrcweir                                      XML_NOTE_CITATION, sal_False, sal_False);
205cdf0e10cSrcweir             GetExport().Characters(rTextString);
206cdf0e10cSrcweir         }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         {
209cdf0e10cSrcweir             SvXMLElementExport aBody(GetExport(), XML_NAMESPACE_TEXT,
210cdf0e10cSrcweir                                      XML_NOTE_BODY, sal_False, sal_False);
211cdf0e10cSrcweir             exportText(rText, bAutoStyles, bIsProgress, sal_True );
212cdf0e10cSrcweir         }
213cdf0e10cSrcweir     }
214cdf0e10cSrcweir }
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 
exportTextFootnoteConfiguration()217cdf0e10cSrcweir void XMLTextParagraphExport::exportTextFootnoteConfiguration()
218cdf0e10cSrcweir {
219cdf0e10cSrcweir     // footnote settings
220cdf0e10cSrcweir     Reference<XFootnotesSupplier> aFootnotesSupplier(GetExport().GetModel(),
221cdf0e10cSrcweir                                                      UNO_QUERY);
222cdf0e10cSrcweir     Reference<XPropertySet> aFootnoteConfiguration(
223cdf0e10cSrcweir         aFootnotesSupplier->getFootnoteSettings());
224cdf0e10cSrcweir     exportTextFootnoteConfigurationHelper(aFootnoteConfiguration, sal_False);
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     // endnote settings
227cdf0e10cSrcweir     Reference<XEndnotesSupplier> aEndnotesSupplier(GetExport().GetModel(),
228cdf0e10cSrcweir                                                    UNO_QUERY);
229cdf0e10cSrcweir     Reference<XPropertySet> aEndnoteConfiguration(
230cdf0e10cSrcweir         aEndnotesSupplier->getEndnoteSettings());
231cdf0e10cSrcweir     exportTextFootnoteConfigurationHelper(aEndnoteConfiguration, sal_True);
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 
lcl_exportString(SvXMLExport & rExport,const Reference<XPropertySet> & rPropSet,const OUString & sProperty,sal_uInt16 nPrefix,enum XMLTokenEnum eElement,sal_Bool bEncodeName,sal_Bool bOmitIfEmpty)235cdf0e10cSrcweir void lcl_exportString(
236cdf0e10cSrcweir     SvXMLExport& rExport,
237cdf0e10cSrcweir     const Reference<XPropertySet> & rPropSet,
238cdf0e10cSrcweir     const OUString& sProperty,
239cdf0e10cSrcweir     sal_uInt16 nPrefix,
240cdf0e10cSrcweir     enum XMLTokenEnum eElement,
241cdf0e10cSrcweir     sal_Bool bEncodeName,
242cdf0e10cSrcweir     sal_Bool bOmitIfEmpty)
243cdf0e10cSrcweir {
244cdf0e10cSrcweir     DBG_ASSERT( eElement != XML_TOKEN_INVALID, "need element token");
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     Any aAny = rPropSet->getPropertyValue(sProperty);
247cdf0e10cSrcweir     OUString sTmp;
248cdf0e10cSrcweir     aAny >>= sTmp;
249cdf0e10cSrcweir     if (!bOmitIfEmpty || (sTmp.getLength() > 0))
250cdf0e10cSrcweir     {
251cdf0e10cSrcweir         if( bEncodeName )
252cdf0e10cSrcweir             sTmp = rExport.EncodeStyleName( sTmp );
253cdf0e10cSrcweir         rExport.AddAttribute(nPrefix, eElement, sTmp);
254cdf0e10cSrcweir     }
255cdf0e10cSrcweir }
256cdf0e10cSrcweir 
exportTextFootnoteConfigurationHelper(const Reference<XPropertySet> & rFootnoteConfig,sal_Bool bIsEndnote)257cdf0e10cSrcweir void XMLTextParagraphExport::exportTextFootnoteConfigurationHelper(
258cdf0e10cSrcweir     const Reference<XPropertySet> & rFootnoteConfig,
259cdf0e10cSrcweir     sal_Bool bIsEndnote)
260cdf0e10cSrcweir {
261cdf0e10cSrcweir     GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
262cdf0e10cSrcweir                              GetXMLToken( bIsEndnote ? XML_ENDNOTE
263cdf0e10cSrcweir                                                      : XML_FOOTNOTE ) );
264cdf0e10cSrcweir     // default/paragraph style
265cdf0e10cSrcweir     lcl_exportString( GetExport(), rFootnoteConfig,
266cdf0e10cSrcweir                       sParaStyleName,
267cdf0e10cSrcweir                       XML_NAMESPACE_TEXT, XML_DEFAULT_STYLE_NAME,
268cdf0e10cSrcweir                       sal_True, sal_True);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir     // citation style
271cdf0e10cSrcweir     lcl_exportString( GetExport(), rFootnoteConfig,
272cdf0e10cSrcweir                       sCharStyleName,
273cdf0e10cSrcweir                       XML_NAMESPACE_TEXT, XML_CITATION_STYLE_NAME,
274cdf0e10cSrcweir                       sal_True, sal_True);
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     // citation body style
277cdf0e10cSrcweir     lcl_exportString( GetExport(), rFootnoteConfig,
278cdf0e10cSrcweir                       sAnchorCharStyleName,
279cdf0e10cSrcweir                       XML_NAMESPACE_TEXT, XML_CITATION_BODY_STYLE_NAME,
280cdf0e10cSrcweir                       sal_True, sal_True);
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     // page style
283cdf0e10cSrcweir     lcl_exportString( GetExport(), rFootnoteConfig,
284cdf0e10cSrcweir                       sPageStyleName,
285cdf0e10cSrcweir                       XML_NAMESPACE_TEXT, XML_MASTER_PAGE_NAME,
286cdf0e10cSrcweir                       sal_True, sal_True );
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     // prefix
289cdf0e10cSrcweir     lcl_exportString( GetExport(), rFootnoteConfig, sPrefix,
290cdf0e10cSrcweir                       XML_NAMESPACE_STYLE, XML_NUM_PREFIX, sal_False, sal_True);
291cdf0e10cSrcweir 
292cdf0e10cSrcweir     // suffix
293cdf0e10cSrcweir     lcl_exportString( GetExport(), rFootnoteConfig, sSuffix,
294cdf0e10cSrcweir                       XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, sal_False, sal_True);
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 
298cdf0e10cSrcweir     Any aAny;
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     // numbering style
301cdf0e10cSrcweir     OUStringBuffer sBuffer;
302cdf0e10cSrcweir     aAny = rFootnoteConfig->getPropertyValue(sNumberingType);
303cdf0e10cSrcweir     sal_Int16 nNumbering = 0;
304cdf0e10cSrcweir     aAny >>= nNumbering;
305cdf0e10cSrcweir     GetExport().GetMM100UnitConverter().convertNumFormat( sBuffer, nNumbering);
306cdf0e10cSrcweir     GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
307cdf0e10cSrcweir                              sBuffer.makeStringAndClear() );
308cdf0e10cSrcweir     GetExport().GetMM100UnitConverter().convertNumLetterSync( sBuffer, nNumbering);
309cdf0e10cSrcweir     if (sBuffer.getLength() )
310cdf0e10cSrcweir     {
311cdf0e10cSrcweir         GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
312cdf0e10cSrcweir                                  sBuffer.makeStringAndClear());
313cdf0e10cSrcweir     }
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     // StartAt / start-value
316cdf0e10cSrcweir     aAny = rFootnoteConfig->getPropertyValue(sStartAt);
317cdf0e10cSrcweir     sal_Int16 nOffset = 0;
318cdf0e10cSrcweir     aAny >>= nOffset;
319cdf0e10cSrcweir     SvXMLUnitConverter::convertNumber(sBuffer, (sal_Int32)nOffset);
320cdf0e10cSrcweir     GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_START_VALUE,
321cdf0e10cSrcweir                              sBuffer.makeStringAndClear());
322cdf0e10cSrcweir 
323cdf0e10cSrcweir     // some properties are for footnotes only
324cdf0e10cSrcweir     if (!bIsEndnote)
325cdf0e10cSrcweir     {
326cdf0e10cSrcweir         // footnotes position
327cdf0e10cSrcweir         aAny = rFootnoteConfig->getPropertyValue(
328cdf0e10cSrcweir             sPositionEndOfDoc);
329cdf0e10cSrcweir         GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FOOTNOTES_POSITION,
330cdf0e10cSrcweir                                  ( (*(sal_Bool *)aAny.getValue()) ?
331cdf0e10cSrcweir                                         XML_DOCUMENT : XML_PAGE ) );
332cdf0e10cSrcweir 
333cdf0e10cSrcweir         aAny = rFootnoteConfig->getPropertyValue(sFootnoteCounting);
334cdf0e10cSrcweir         sal_Int16 nTmp = 0;
335cdf0e10cSrcweir         aAny >>= nTmp;
336cdf0e10cSrcweir         enum XMLTokenEnum eElement;
337cdf0e10cSrcweir         switch (nTmp)
338cdf0e10cSrcweir         {
339cdf0e10cSrcweir             case FootnoteNumbering::PER_PAGE:
340cdf0e10cSrcweir                 eElement = XML_PAGE;
341cdf0e10cSrcweir                 break;
342cdf0e10cSrcweir             case FootnoteNumbering::PER_CHAPTER:
343cdf0e10cSrcweir                 eElement = XML_CHAPTER;
344cdf0e10cSrcweir                 break;
345cdf0e10cSrcweir             case FootnoteNumbering::PER_DOCUMENT:
346cdf0e10cSrcweir             default:
347cdf0e10cSrcweir                 eElement = XML_DOCUMENT;
348cdf0e10cSrcweir                 break;
349cdf0e10cSrcweir         }
350cdf0e10cSrcweir         GetExport().AddAttribute(XML_NAMESPACE_TEXT,
351cdf0e10cSrcweir                                  XML_START_NUMBERING_AT, eElement);
352cdf0e10cSrcweir     }
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     // element
355cdf0e10cSrcweir     SvXMLElementExport aFootnoteConfigElement(
356cdf0e10cSrcweir         GetExport(), XML_NAMESPACE_TEXT,
357cdf0e10cSrcweir         XML_NOTES_CONFIGURATION,
358cdf0e10cSrcweir         sal_True, sal_True);
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     // two element for footnote content
361cdf0e10cSrcweir     if (!bIsEndnote)
362cdf0e10cSrcweir     {
363cdf0e10cSrcweir         OUString sTmp;
364cdf0e10cSrcweir 
365cdf0e10cSrcweir         // end notice / quo vadis
366cdf0e10cSrcweir         aAny = rFootnoteConfig->getPropertyValue(sEndNotice);
367cdf0e10cSrcweir         aAny >>= sTmp;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir         if (sTmp.getLength() > 0)
370cdf0e10cSrcweir         {
371cdf0e10cSrcweir             SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_TEXT,
372cdf0e10cSrcweir                                      XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD,
373cdf0e10cSrcweir                                      sal_True, sal_False);
374cdf0e10cSrcweir             GetExport().Characters(sTmp);
375cdf0e10cSrcweir         }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir         // begin notice / ergo sum
378cdf0e10cSrcweir         aAny = rFootnoteConfig->getPropertyValue(sBeginNotice);
379cdf0e10cSrcweir         aAny >>= sTmp;
380cdf0e10cSrcweir 
381cdf0e10cSrcweir         if (sTmp.getLength() > 0)
382cdf0e10cSrcweir         {
383cdf0e10cSrcweir             SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_TEXT,
384cdf0e10cSrcweir                                      XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD,
385cdf0e10cSrcweir                                      sal_True, sal_False);
386cdf0e10cSrcweir             GetExport().Characters(sTmp);
387cdf0e10cSrcweir         }
388cdf0e10cSrcweir     }
389cdf0e10cSrcweir }
390