xref: /AOO41X/main/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx (revision 63bba73cc51e0afb45f8a8d578158724bb5afee8)
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 #include "XMLFootnoteConfigurationImportContext.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _RTL_USTRING
29cdf0e10cSrcweir #include <rtl/ustring.hxx>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
32cdf0e10cSrcweir #include <tools/debug.hxx>
33cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
34cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
35cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #ifndef _XMLOFF_FAMILIES_HXX
38cdf0e10cSrcweir #include <xmloff/families.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
41cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
42cdf0e10cSrcweir #include <xmloff/xmlnumi.hxx>
43cdf0e10cSrcweir #include <com/sun/star/xml/sax/XAttributeList.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
45cdf0e10cSrcweir #include <com/sun/star/text/XFootnote.hpp>
46cdf0e10cSrcweir #include <com/sun/star/text/XFootnotesSupplier.hpp>
47cdf0e10cSrcweir #include <com/sun/star/text/XEndnotesSupplier.hpp>
48cdf0e10cSrcweir #include <com/sun/star/text/FootnoteNumbering.hpp>
49cdf0e10cSrcweir #include <com/sun/star/style/NumberingType.hpp>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir using ::rtl::OUString;
53cdf0e10cSrcweir using ::rtl::OUStringBuffer;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir using namespace ::com::sun::star::text;
56cdf0e10cSrcweir using namespace ::com::sun::star::beans;
57cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58cdf0e10cSrcweir using namespace ::com::sun::star::style;
59cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax;
60cdf0e10cSrcweir using namespace ::xmloff::token;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir //
63cdf0e10cSrcweir //  XMLFootnoteConfigHelper
64cdf0e10cSrcweir //
65cdf0e10cSrcweir 
66cdf0e10cSrcweir /// local helper class for import of quo-vadis and ergo-sum elements
67cdf0e10cSrcweir class XMLFootnoteConfigHelper : public SvXMLImportContext
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	OUStringBuffer sBuffer;
70cdf0e10cSrcweir 	XMLFootnoteConfigurationImportContext& rConfig;
71cdf0e10cSrcweir 	sal_Bool bIsBegin;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir public:
74cdf0e10cSrcweir 	TYPEINFO();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	XMLFootnoteConfigHelper(
77cdf0e10cSrcweir 		SvXMLImport& rImport,
78cdf0e10cSrcweir 		sal_uInt16 nPrfx,
79cdf0e10cSrcweir 		const OUString& rLName,
80cdf0e10cSrcweir 		XMLFootnoteConfigurationImportContext& rConfigImport,
81cdf0e10cSrcweir 		sal_Bool bBegin);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	virtual void EndElement();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	virtual void Characters( const OUString& rChars );
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir TYPEINIT1( XMLFootnoteConfigHelper, SvXMLImportContext );
89cdf0e10cSrcweir 
XMLFootnoteConfigHelper(SvXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLName,XMLFootnoteConfigurationImportContext & rConfigImport,sal_Bool bBegin)90cdf0e10cSrcweir XMLFootnoteConfigHelper::XMLFootnoteConfigHelper(
91cdf0e10cSrcweir 	SvXMLImport& rImport,
92cdf0e10cSrcweir 	sal_uInt16 nPrfx,
93cdf0e10cSrcweir 	const OUString& rLName,
94cdf0e10cSrcweir 	XMLFootnoteConfigurationImportContext& rConfigImport,
95cdf0e10cSrcweir 	sal_Bool bBegin)
96cdf0e10cSrcweir :	SvXMLImportContext(rImport, nPrfx, rLName)
97cdf0e10cSrcweir ,	sBuffer()
98cdf0e10cSrcweir ,	rConfig(rConfigImport)
99cdf0e10cSrcweir ,	bIsBegin(bBegin)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
EndElement()103cdf0e10cSrcweir void XMLFootnoteConfigHelper::EndElement()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	if (bIsBegin)
106cdf0e10cSrcweir 	{
107cdf0e10cSrcweir 		rConfig.SetBeginNotice(sBuffer.makeStringAndClear());
108cdf0e10cSrcweir 	}
109cdf0e10cSrcweir 	else
110cdf0e10cSrcweir 	{
111cdf0e10cSrcweir 		rConfig.SetEndNotice(sBuffer.makeStringAndClear());
112cdf0e10cSrcweir 	}
113cdf0e10cSrcweir //	rConfig = NULL; // import contexts are ref-counted
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
Characters(const OUString & rChars)116cdf0e10cSrcweir void XMLFootnoteConfigHelper::Characters( const OUString& rChars )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	sBuffer.append(rChars);
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir //
123cdf0e10cSrcweir // XMLFootnoteConfigurationImportContext
124cdf0e10cSrcweir //
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 
127cdf0e10cSrcweir TYPEINIT1( XMLFootnoteConfigurationImportContext, SvXMLStyleContext );
128cdf0e10cSrcweir 
XMLFootnoteConfigurationImportContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLocalName,const Reference<XAttributeList> & xAttrList)129cdf0e10cSrcweir XMLFootnoteConfigurationImportContext::XMLFootnoteConfigurationImportContext(
130cdf0e10cSrcweir 	SvXMLImport& rImport,
131cdf0e10cSrcweir 	sal_uInt16 nPrfx,
132cdf0e10cSrcweir 	const OUString& rLocalName,
133cdf0e10cSrcweir 	const Reference<XAttributeList> & xAttrList)
134cdf0e10cSrcweir :	SvXMLStyleContext(rImport, nPrfx, rLocalName, xAttrList, XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG)
135cdf0e10cSrcweir ,	sPropertyAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName"))
136cdf0e10cSrcweir ,	sPropertyCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName"))
137cdf0e10cSrcweir ,	sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType"))
138cdf0e10cSrcweir ,	sPropertyPageStyleName(RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))
139cdf0e10cSrcweir ,	sPropertyParagraphStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName"))
140cdf0e10cSrcweir ,	sPropertyPrefix(RTL_CONSTASCII_USTRINGPARAM("Prefix"))
141cdf0e10cSrcweir ,	sPropertyStartAt(RTL_CONSTASCII_USTRINGPARAM("StartAt"))
142cdf0e10cSrcweir ,	sPropertySuffix(RTL_CONSTASCII_USTRINGPARAM("Suffix"))
143cdf0e10cSrcweir ,	sPropertyPositionEndOfDoc(RTL_CONSTASCII_USTRINGPARAM("PositionEndOfDoc"))
144cdf0e10cSrcweir ,	sPropertyFootnoteCounting(RTL_CONSTASCII_USTRINGPARAM("FootnoteCounting"))
145cdf0e10cSrcweir ,	sPropertyEndNotice(RTL_CONSTASCII_USTRINGPARAM("EndNotice"))
146cdf0e10cSrcweir ,	sPropertyBeginNotice(RTL_CONSTASCII_USTRINGPARAM("BeginNotice"))
147cdf0e10cSrcweir ,	sNumFormat(RTL_CONSTASCII_USTRINGPARAM("1"))
148cdf0e10cSrcweir ,	sNumSync(RTL_CONSTASCII_USTRINGPARAM("false"))
149cdf0e10cSrcweir ,	pAttrTokenMap(NULL)
150cdf0e10cSrcweir ,	nOffset(0)
151cdf0e10cSrcweir ,	nNumbering(FootnoteNumbering::PER_PAGE)
152cdf0e10cSrcweir ,	bPosition(sal_False)
153cdf0e10cSrcweir ,	bIsEndnote(sal_False)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir 	sal_Int16 nLength = xAttrList->getLength();
156cdf0e10cSrcweir 	for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
157cdf0e10cSrcweir 	{
158cdf0e10cSrcweir 		OUString sLocalName;
159cdf0e10cSrcweir 		sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
160cdf0e10cSrcweir 			GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
161cdf0e10cSrcweir 							  &sLocalName );
162cdf0e10cSrcweir 		if( XML_NAMESPACE_TEXT == nPrefix && IsXMLToken( sLocalName,
163cdf0e10cSrcweir 														XML_NOTE_CLASS ) )
164cdf0e10cSrcweir 		{
165cdf0e10cSrcweir 			const OUString& rValue = xAttrList->getValueByIndex( nAttr );
166cdf0e10cSrcweir 			if( IsXMLToken( rValue, XML_ENDNOTE ) )
167cdf0e10cSrcweir 			{
168cdf0e10cSrcweir 				bIsEndnote = sal_True;
169cdf0e10cSrcweir 				SetFamily( XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG );
170cdf0e10cSrcweir 			}
171cdf0e10cSrcweir 			break;
172cdf0e10cSrcweir 		}
173cdf0e10cSrcweir 	}
174cdf0e10cSrcweir 
175cdf0e10cSrcweir }
~XMLFootnoteConfigurationImportContext()176cdf0e10cSrcweir XMLFootnoteConfigurationImportContext::~XMLFootnoteConfigurationImportContext()
177cdf0e10cSrcweir {
178cdf0e10cSrcweir     delete pAttrTokenMap;
179cdf0e10cSrcweir }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir enum XMLFtnConfigToken
182cdf0e10cSrcweir {
183cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_CITATION_STYLENAME,
184cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_ANCHOR_STYLENAME,
185cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_DEFAULT_STYLENAME,
186cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_PAGE_STYLENAME,
187cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_OFFSET,
188cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_NUM_PREFIX,
189cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_NUM_SUFFIX,
190cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_NUM_FORMAT,
191cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_NUM_SYNC,
192cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_START_AT,
193cdf0e10cSrcweir 	XML_TOK_FTNCONFIG_POSITION
194cdf0e10cSrcweir };
195cdf0e10cSrcweir 
196cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
197cdf0e10cSrcweir {
198cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_CITATION_STYLE_NAME,      XML_TOK_FTNCONFIG_CITATION_STYLENAME },
199cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_CITATION_BODY_STYLE_NAME, XML_TOK_FTNCONFIG_ANCHOR_STYLENAME },
200cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_DEFAULT_STYLE_NAME,       XML_TOK_FTNCONFIG_DEFAULT_STYLENAME },
201cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_MASTER_PAGE_NAME,         XML_TOK_FTNCONFIG_PAGE_STYLENAME },
202cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_START_VALUE, XML_TOK_FTNCONFIG_OFFSET },
203cdf0e10cSrcweir 	{ XML_NAMESPACE_STYLE, XML_NUM_PREFIX, XML_TOK_FTNCONFIG_NUM_PREFIX },
204cdf0e10cSrcweir 	{ XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, XML_TOK_FTNCONFIG_NUM_SUFFIX },
205cdf0e10cSrcweir 	{ XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_FTNCONFIG_NUM_FORMAT },
206cdf0e10cSrcweir 	{ XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_TOK_FTNCONFIG_NUM_SYNC },
207cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_START_NUMBERING_AT, XML_TOK_FTNCONFIG_START_AT},
208cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_FOOTNOTES_POSITION, XML_TOK_FTNCONFIG_POSITION},
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	// for backwards compatibility with SRC630 & earlier
211cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_NUM_PREFIX, XML_TOK_FTNCONFIG_NUM_PREFIX },
212cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_NUM_SUFFIX, XML_TOK_FTNCONFIG_NUM_SUFFIX },
213cdf0e10cSrcweir 	{ XML_NAMESPACE_TEXT, XML_OFFSET, XML_TOK_FTNCONFIG_OFFSET },
214cdf0e10cSrcweir 	XML_TOKEN_MAP_END
215cdf0e10cSrcweir };
216cdf0e10cSrcweir 
217cdf0e10cSrcweir const SvXMLTokenMap&
GetFtnConfigAttrTokenMap()218cdf0e10cSrcweir 	XMLFootnoteConfigurationImportContext::GetFtnConfigAttrTokenMap()
219cdf0e10cSrcweir {
220cdf0e10cSrcweir 	if (NULL == pAttrTokenMap)
221cdf0e10cSrcweir 	{
222cdf0e10cSrcweir 		pAttrTokenMap = new SvXMLTokenMap(aTextFieldAttrTokenMap);
223cdf0e10cSrcweir 	}
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	return *pAttrTokenMap;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir static SvXMLEnumMapEntry __READONLY_DATA aFootnoteNumberingMap[] =
229cdf0e10cSrcweir {
230cdf0e10cSrcweir 	{ XML_PAGE,		        FootnoteNumbering::PER_PAGE },
231cdf0e10cSrcweir 	{ XML_CHAPTER,		    FootnoteNumbering::PER_CHAPTER },
232cdf0e10cSrcweir 	{ XML_DOCUMENT,	        FootnoteNumbering::PER_DOCUMENT },
233cdf0e10cSrcweir 	{ XML_TOKEN_INVALID, 	0 },
234cdf0e10cSrcweir };
235cdf0e10cSrcweir 
StartElement(const Reference<XAttributeList> & xAttrList)236cdf0e10cSrcweir void XMLFootnoteConfigurationImportContext::StartElement(
237cdf0e10cSrcweir 	const Reference<XAttributeList> & xAttrList )
238cdf0e10cSrcweir {
239cdf0e10cSrcweir 	sal_Int16 nLength = xAttrList->getLength();
240cdf0e10cSrcweir 	for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
241cdf0e10cSrcweir 	{
242cdf0e10cSrcweir 		OUString sLocalName;
243cdf0e10cSrcweir 		sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
244cdf0e10cSrcweir 			GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
245cdf0e10cSrcweir 							  &sLocalName );
246cdf0e10cSrcweir 		OUString sValue = xAttrList->getValueByIndex(nAttr);
247cdf0e10cSrcweir 		switch (GetFtnConfigAttrTokenMap().Get(nPrefix, sLocalName))
248cdf0e10cSrcweir 		{
249cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_CITATION_STYLENAME:
250cdf0e10cSrcweir 				sCitationStyle = sValue;
251cdf0e10cSrcweir 				break;
252cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_ANCHOR_STYLENAME:
253cdf0e10cSrcweir 				sAnchorStyle = sValue;
254cdf0e10cSrcweir 				break;
255cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_DEFAULT_STYLENAME:
256cdf0e10cSrcweir 				sDefaultStyle = sValue;
257cdf0e10cSrcweir 				break;
258cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_PAGE_STYLENAME:
259cdf0e10cSrcweir 				sPageStyle = sValue;
260cdf0e10cSrcweir 				break;
261cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_OFFSET:
262cdf0e10cSrcweir 			{
263cdf0e10cSrcweir 				sal_Int32 nTmp;
264cdf0e10cSrcweir 				if (SvXMLUnitConverter::convertNumber(nTmp, sValue))
265cdf0e10cSrcweir 				{
266cdf0e10cSrcweir 					nOffset = (sal_uInt16)nTmp;
267cdf0e10cSrcweir 				}
268cdf0e10cSrcweir 				break;
269cdf0e10cSrcweir 			}
270cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_NUM_PREFIX:
271cdf0e10cSrcweir 				sPrefix = sValue;
272cdf0e10cSrcweir 				break;
273cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_NUM_SUFFIX:
274cdf0e10cSrcweir 				sSuffix = sValue;
275cdf0e10cSrcweir 				break;
276cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_NUM_FORMAT:
277cdf0e10cSrcweir 				sNumFormat = sValue;
278cdf0e10cSrcweir 				break;
279cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_NUM_SYNC:
280cdf0e10cSrcweir 				sNumSync = sValue;
281cdf0e10cSrcweir 				break;
282cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_START_AT:
283cdf0e10cSrcweir 			{
284cdf0e10cSrcweir 				sal_uInt16 nTmp;
285cdf0e10cSrcweir 				if (SvXMLUnitConverter::convertEnum(nTmp, sValue,
286cdf0e10cSrcweir 													aFootnoteNumberingMap))
287cdf0e10cSrcweir 				{
288cdf0e10cSrcweir 					nNumbering = nTmp;
289cdf0e10cSrcweir 				}
290cdf0e10cSrcweir 				break;
291cdf0e10cSrcweir 			}
292cdf0e10cSrcweir 			case XML_TOK_FTNCONFIG_POSITION:
293cdf0e10cSrcweir 				bPosition = IsXMLToken( sValue, XML_DOCUMENT );
294cdf0e10cSrcweir 				break;
295cdf0e10cSrcweir 			default:
296cdf0e10cSrcweir 				; // ignore
297cdf0e10cSrcweir 		}
298cdf0e10cSrcweir 	}
299cdf0e10cSrcweir }
300cdf0e10cSrcweir 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const Reference<XAttributeList> & xAttrList)301cdf0e10cSrcweir SvXMLImportContext *XMLFootnoteConfigurationImportContext::CreateChildContext(
302cdf0e10cSrcweir 	sal_uInt16 nPrefix,
303cdf0e10cSrcweir 	const OUString& rLocalName,
304cdf0e10cSrcweir 	const Reference<XAttributeList> & xAttrList )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir 	SvXMLImportContext* pContext = NULL;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	if (!bIsEndnote)
309cdf0e10cSrcweir 	{
310cdf0e10cSrcweir 		if (XML_NAMESPACE_TEXT == nPrefix)
311cdf0e10cSrcweir 		{
312cdf0e10cSrcweir 			if ( IsXMLToken( rLocalName,
313cdf0e10cSrcweir                              XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD ) )
314cdf0e10cSrcweir 			{
315cdf0e10cSrcweir 				pContext = new XMLFootnoteConfigHelper(GetImport(),
316cdf0e10cSrcweir 													   nPrefix, rLocalName,
317cdf0e10cSrcweir 													   *this, sal_False);
318cdf0e10cSrcweir 			}
319cdf0e10cSrcweir 			else if ( IsXMLToken( rLocalName,
320cdf0e10cSrcweir                                   XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD ) )
321cdf0e10cSrcweir 			{
322cdf0e10cSrcweir 				pContext = new XMLFootnoteConfigHelper(GetImport(),
323cdf0e10cSrcweir 													   nPrefix, rLocalName,
324cdf0e10cSrcweir 													   *this, sal_True);
325cdf0e10cSrcweir 			}
326cdf0e10cSrcweir 			// else: default context
327cdf0e10cSrcweir 		}
328cdf0e10cSrcweir 		// else: unknown namespace -> default context
329cdf0e10cSrcweir 	}
330cdf0e10cSrcweir 	// else: endnote -> default context
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	if (pContext == NULL)
333cdf0e10cSrcweir 	{
334cdf0e10cSrcweir 		// default: delegate to super class
335cdf0e10cSrcweir 		pContext = SvXMLStyleContext::CreateChildContext(nPrefix,
336cdf0e10cSrcweir 														 rLocalName,
337cdf0e10cSrcweir 														 xAttrList);
338cdf0e10cSrcweir 	}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 	return pContext;
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 
344cdf0e10cSrcweir // --> OD 2005-01-31 #i40597# - rename method <CreateAndInsertLate(..)> to
345cdf0e10cSrcweir // <Finish(..)>
Finish(sal_Bool bOverwrite)346cdf0e10cSrcweir void XMLFootnoteConfigurationImportContext::Finish( sal_Bool bOverwrite )
347cdf0e10cSrcweir // <--
348cdf0e10cSrcweir {
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 	if (bOverwrite)
351cdf0e10cSrcweir 	{
352cdf0e10cSrcweir 		if (bIsEndnote)
353cdf0e10cSrcweir 		{
354cdf0e10cSrcweir 			Reference<XEndnotesSupplier> xSupplier(
355cdf0e10cSrcweir 				GetImport().GetModel(), UNO_QUERY);
356cdf0e10cSrcweir 			if (xSupplier.is())
357cdf0e10cSrcweir 			{
358cdf0e10cSrcweir 				ProcessSettings(xSupplier->getEndnoteSettings());
359cdf0e10cSrcweir 			}
360cdf0e10cSrcweir 		}
361cdf0e10cSrcweir 		else
362cdf0e10cSrcweir 		{
363cdf0e10cSrcweir 			Reference<XFootnotesSupplier> xSupplier(
364cdf0e10cSrcweir 				GetImport().GetModel(), UNO_QUERY);
365cdf0e10cSrcweir 			if (xSupplier.is())
366cdf0e10cSrcweir 			{
367cdf0e10cSrcweir 				ProcessSettings(xSupplier->getFootnoteSettings());
368cdf0e10cSrcweir 			}
369cdf0e10cSrcweir 		}
370cdf0e10cSrcweir 	}
371cdf0e10cSrcweir 	// else: ignore (there's only one configuration, so we can only overwrite)
372cdf0e10cSrcweir }
373cdf0e10cSrcweir 
ProcessSettings(const Reference<XPropertySet> & rConfig)374cdf0e10cSrcweir void XMLFootnoteConfigurationImportContext::ProcessSettings(
375cdf0e10cSrcweir 	const Reference<XPropertySet> & rConfig)
376cdf0e10cSrcweir {
377cdf0e10cSrcweir 	Any aAny;
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	if (sCitationStyle.getLength() > 0)
380cdf0e10cSrcweir 	{
381cdf0e10cSrcweir 		aAny <<= GetImport().GetStyleDisplayName(
382cdf0e10cSrcweir 						XML_STYLE_FAMILY_TEXT_TEXT, sCitationStyle );
383cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyCharStyleName, aAny);
384cdf0e10cSrcweir 	}
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 	if (sAnchorStyle.getLength() > 0)
387cdf0e10cSrcweir 	{
388cdf0e10cSrcweir 		aAny <<= GetImport().GetStyleDisplayName(
389cdf0e10cSrcweir 						XML_STYLE_FAMILY_TEXT_TEXT, sAnchorStyle );
390cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyAnchorCharStyleName, aAny);
391cdf0e10cSrcweir 	}
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 	if (sPageStyle.getLength() > 0)
394cdf0e10cSrcweir 	{
395cdf0e10cSrcweir 		aAny <<= GetImport().GetStyleDisplayName(
396cdf0e10cSrcweir 						XML_STYLE_FAMILY_MASTER_PAGE, sPageStyle );
397cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyPageStyleName, aAny);
398cdf0e10cSrcweir 	}
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 	if (sDefaultStyle.getLength() > 0)
401cdf0e10cSrcweir 	{
402cdf0e10cSrcweir 		aAny <<= GetImport().GetStyleDisplayName(
403cdf0e10cSrcweir 						XML_STYLE_FAMILY_TEXT_PARAGRAPH, sDefaultStyle );
404cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyParagraphStyleName, aAny);
405cdf0e10cSrcweir 	}
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 	aAny <<= sPrefix;
408cdf0e10cSrcweir 	rConfig->setPropertyValue(sPropertyPrefix, aAny);
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 	aAny <<= sSuffix;
411cdf0e10cSrcweir 	rConfig->setPropertyValue(sPropertySuffix, aAny);
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	sal_Int16 nNumType = NumberingType::ARABIC;
414cdf0e10cSrcweir 	GetImport().GetMM100UnitConverter().convertNumFormat( nNumType, sNumFormat,
415cdf0e10cSrcweir 													 sNumSync );
416cdf0e10cSrcweir     // #i61399: Corrupt file? It contains "Bullet" as numbering style for footnotes.
417cdf0e10cSrcweir     // Okay, even it seems to be corrupt, we will oversee this and set the style to ARABIC
418cdf0e10cSrcweir     if( NumberingType::CHAR_SPECIAL == nNumType )
419cdf0e10cSrcweir         nNumType = NumberingType::ARABIC;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 	aAny <<=  nNumType;
422cdf0e10cSrcweir 	rConfig->setPropertyValue(sPropertyNumberingType, aAny);
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 	aAny <<= nOffset;
425cdf0e10cSrcweir 	rConfig->setPropertyValue(sPropertyStartAt, aAny);
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 	if (!bIsEndnote)
428cdf0e10cSrcweir 	{
429cdf0e10cSrcweir 		aAny.setValue(&bPosition, ::getBooleanCppuType());
430cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyPositionEndOfDoc, aAny);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 		aAny <<= nNumbering;
433cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyFootnoteCounting, aAny);
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 		aAny <<= sEndNotice;
436cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyEndNotice, aAny);
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 		aAny <<= sBeginNotice;
439cdf0e10cSrcweir 		rConfig->setPropertyValue(sPropertyBeginNotice, aAny);
440cdf0e10cSrcweir 	}
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
SetBeginNotice(OUString sText)443cdf0e10cSrcweir void XMLFootnoteConfigurationImportContext::SetBeginNotice(
444cdf0e10cSrcweir 	OUString sText)
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	sBeginNotice = sText;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
SetEndNotice(OUString sText)449cdf0e10cSrcweir void XMLFootnoteConfigurationImportContext::SetEndNotice(
450cdf0e10cSrcweir 	OUString sText)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	sEndNotice = sText;
453cdf0e10cSrcweir }
454