1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlconti.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include "xmlconti.hxx"
39 #include "xmlimprt.hxx"
41 #include "document.hxx"
43 #include <xmloff/xmltkmap.hxx>
44 #include <xmloff/nmspmap.hxx>
45 #include <xmloff/xmlnmspe.hxx>
46 #include <xmloff/xmltoken.hxx>
48 using namespace xmloff::token
;
50 //------------------------------------------------------------------
52 ScXMLContentContext::ScXMLContentContext( ScXMLImport
& rImport
,
54 const ::rtl::OUString
& rLName
,
55 const ::com::sun::star::uno::Reference
<
56 ::com::sun::star::xml::sax::XAttributeList
>& /* xAttrList */,
57 rtl::OUStringBuffer
& sTempValue
) :
58 SvXMLImportContext( rImport
, nPrfx
, rLName
),
64 ScXMLContentContext::~ScXMLContentContext()
68 SvXMLImportContext
*ScXMLContentContext::CreateChildContext( USHORT nPrefix
,
69 const ::rtl::OUString
& rLName
,
70 const ::com::sun::star::uno::Reference
<
71 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
)
73 SvXMLImportContext
*pContext
= 0;
75 if ((nPrefix
== XML_NAMESPACE_TEXT
) && IsXMLToken(rLName
, XML_S
))
78 sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
79 for( sal_Int16 i
=0; i
< nAttrCount
; ++i
)
81 const rtl::OUString
& sAttrName(xAttrList
->getNameByIndex( i
));
82 const rtl::OUString
& sAttrValue(xAttrList
->getValueByIndex( i
));
83 rtl::OUString aLocalName
;
84 USHORT nPrfx
= GetScImport().GetNamespaceMap().GetKeyByAttrName(
85 sAttrName
, &aLocalName
);
86 if ((nPrfx
== XML_NAMESPACE_TEXT
) && IsXMLToken(aLocalName
, XML_C
))
87 nRepeat
= sAttrValue
.toInt32();
90 for (sal_Int32 j
= 0; j
< nRepeat
; ++j
)
91 sOUText
.append(static_cast<sal_Unicode
>(' '));
93 sOUText
.append(static_cast<sal_Unicode
>(' '));
97 pContext
= new SvXMLImportContext( GetImport(), nPrefix
, rLName
);
102 void ScXMLContentContext::Characters( const ::rtl::OUString
& rChars
)
104 sOUText
.append(rChars
);
107 void ScXMLContentContext::EndElement()
109 sValue
.append(sOUText
);