1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_xmlscript.hxx"
30*cdf0e10cSrcweir #include "imp_share.hxx"
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <osl/diagnose.h>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <xmlscript/xml_import.hxx>
37*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir namespace xmlscript
41*cdf0e10cSrcweir {
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //##################################################################################################
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir //__________________________________________________________________________________________________
46*cdf0e10cSrcweir Reference< xml::input::XElement > LibElementBase::getParent()
47*cdf0e10cSrcweir     throw (RuntimeException)
48*cdf0e10cSrcweir {
49*cdf0e10cSrcweir     return static_cast< xml::input::XElement * >( _pParent );
50*cdf0e10cSrcweir }
51*cdf0e10cSrcweir //__________________________________________________________________________________________________
52*cdf0e10cSrcweir OUString LibElementBase::getLocalName()
53*cdf0e10cSrcweir     throw (RuntimeException)
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir     return _aLocalName;
56*cdf0e10cSrcweir }
57*cdf0e10cSrcweir //__________________________________________________________________________________________________
58*cdf0e10cSrcweir sal_Int32 LibElementBase::getUid()
59*cdf0e10cSrcweir     throw (RuntimeException)
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir     return _pImport->XMLNS_LIBRARY_UID;
62*cdf0e10cSrcweir }
63*cdf0e10cSrcweir //__________________________________________________________________________________________________
64*cdf0e10cSrcweir Reference< xml::input::XAttributes > LibElementBase::getAttributes()
65*cdf0e10cSrcweir     throw (RuntimeException)
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir     return _xAttributes;
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir //__________________________________________________________________________________________________
70*cdf0e10cSrcweir void LibElementBase::ignorableWhitespace(
71*cdf0e10cSrcweir     OUString const & /*rWhitespaces*/ )
72*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir }
75*cdf0e10cSrcweir //__________________________________________________________________________________________________
76*cdf0e10cSrcweir void LibElementBase::characters( OUString const & /*rChars*/ )
77*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir     // not used, all characters ignored
80*cdf0e10cSrcweir }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir //__________________________________________________________________________________________________
83*cdf0e10cSrcweir void LibElementBase::processingInstruction(
84*cdf0e10cSrcweir     OUString const & /*rTarget*/, OUString const & /*rData*/ )
85*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir //__________________________________________________________________________________________________
90*cdf0e10cSrcweir void LibElementBase::endElement()
91*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir //__________________________________________________________________________________________________
95*cdf0e10cSrcweir Reference< xml::input::XElement > LibElementBase::startChildElement(
96*cdf0e10cSrcweir     sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
97*cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & /*xAttributes*/ )
98*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir     throw xml::sax::SAXException(
101*cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ),
102*cdf0e10cSrcweir         Reference< XInterface >(), Any() );
103*cdf0e10cSrcweir }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir //__________________________________________________________________________________________________
106*cdf0e10cSrcweir LibElementBase::LibElementBase(
107*cdf0e10cSrcweir     OUString const & rLocalName,
108*cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes,
109*cdf0e10cSrcweir     LibElementBase * pParent, LibraryImport * pImport )
110*cdf0e10cSrcweir     SAL_THROW( () )
111*cdf0e10cSrcweir     : _pImport( pImport )
112*cdf0e10cSrcweir     , _pParent( pParent )
113*cdf0e10cSrcweir     , _aLocalName( rLocalName )
114*cdf0e10cSrcweir     , _xAttributes( xAttributes )
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir     _pImport->acquire();
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     if (_pParent)
119*cdf0e10cSrcweir     {
120*cdf0e10cSrcweir         _pParent->acquire();
121*cdf0e10cSrcweir     }
122*cdf0e10cSrcweir }
123*cdf0e10cSrcweir //__________________________________________________________________________________________________
124*cdf0e10cSrcweir LibElementBase::~LibElementBase()
125*cdf0e10cSrcweir     SAL_THROW( () )
126*cdf0e10cSrcweir {
127*cdf0e10cSrcweir     _pImport->release();
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     if (_pParent)
130*cdf0e10cSrcweir     {
131*cdf0e10cSrcweir         _pParent->release();
132*cdf0e10cSrcweir     }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
135*cdf0e10cSrcweir     OString aStr( OUStringToOString( _aLocalName, RTL_TEXTENCODING_ASCII_US ) );
136*cdf0e10cSrcweir     OSL_TRACE( "LibElementBase::~LibElementBase(): %s\n", aStr.getStr() );
137*cdf0e10cSrcweir #endif
138*cdf0e10cSrcweir }
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir //##################################################################################################
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir // XRoot
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir //______________________________________________________________________________
145*cdf0e10cSrcweir void LibraryImport::startDocument(
146*cdf0e10cSrcweir     Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
147*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir     XMLNS_LIBRARY_UID = xNamespaceMapping->getUidByUri(
150*cdf0e10cSrcweir         OUSTR(XMLNS_LIBRARY_URI) );
151*cdf0e10cSrcweir     XMLNS_XLINK_UID = xNamespaceMapping->getUidByUri(
152*cdf0e10cSrcweir         OUSTR(XMLNS_XLINK_URI) );
153*cdf0e10cSrcweir }
154*cdf0e10cSrcweir //__________________________________________________________________________________________________
155*cdf0e10cSrcweir void LibraryImport::endDocument()
156*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir //__________________________________________________________________________________________________
160*cdf0e10cSrcweir void LibraryImport::processingInstruction(
161*cdf0e10cSrcweir     OUString const & /*rTarget*/, OUString const & /*rData*/ )
162*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir //__________________________________________________________________________________________________
166*cdf0e10cSrcweir void LibraryImport::setDocumentLocator(
167*cdf0e10cSrcweir     Reference< xml::sax::XLocator > const & /*xLocator*/ )
168*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir //__________________________________________________________________________________________________
172*cdf0e10cSrcweir Reference< xml::input::XElement > LibraryImport::startRootElement(
173*cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
174*cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
175*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
176*cdf0e10cSrcweir {
177*cdf0e10cSrcweir     if (XMLNS_LIBRARY_UID != nUid)
178*cdf0e10cSrcweir     {
179*cdf0e10cSrcweir         throw xml::sax::SAXException(
180*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
181*cdf0e10cSrcweir             Reference< XInterface >(), Any() );
182*cdf0e10cSrcweir     }
183*cdf0e10cSrcweir     else if (mpLibArray && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("libraries") ))
184*cdf0e10cSrcweir     {
185*cdf0e10cSrcweir         return new LibrariesElement( rLocalName, xAttributes, 0, this );
186*cdf0e10cSrcweir     }
187*cdf0e10cSrcweir     else if (mpLibDesc && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("library") ))
188*cdf0e10cSrcweir     {
189*cdf0e10cSrcweir         LibDescriptor& aDesc = *mpLibDesc;
190*cdf0e10cSrcweir         aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False;
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir         aDesc.aName = xAttributes->getValueByUidName(
193*cdf0e10cSrcweir             XMLNS_LIBRARY_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) );
194*cdf0e10cSrcweir         getBoolAttr(
195*cdf0e10cSrcweir             &aDesc.bReadOnly,
196*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ), xAttributes,
197*cdf0e10cSrcweir             XMLNS_LIBRARY_UID );
198*cdf0e10cSrcweir         getBoolAttr(
199*cdf0e10cSrcweir             &aDesc.bPasswordProtected,
200*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ),
201*cdf0e10cSrcweir             xAttributes, XMLNS_LIBRARY_UID );
202*cdf0e10cSrcweir         getBoolAttr(
203*cdf0e10cSrcweir             &aDesc.bPreload,
204*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("preload") ),
205*cdf0e10cSrcweir             xAttributes, XMLNS_LIBRARY_UID );
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir         return new LibraryElement( rLocalName, xAttributes, 0, this );
208*cdf0e10cSrcweir     }
209*cdf0e10cSrcweir     else
210*cdf0e10cSrcweir     {
211*cdf0e10cSrcweir         throw xml::sax::SAXException(
212*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal root element (expected libraries) given: ") ) +
213*cdf0e10cSrcweir             rLocalName, Reference< XInterface >(), Any() );
214*cdf0e10cSrcweir     }
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir //__________________________________________________________________________________________________
217*cdf0e10cSrcweir LibraryImport::~LibraryImport()
218*cdf0e10cSrcweir     SAL_THROW( () )
219*cdf0e10cSrcweir {
220*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
221*cdf0e10cSrcweir     OSL_TRACE( "LibraryImport::~LibraryImport().\n" );
222*cdf0e10cSrcweir #endif
223*cdf0e10cSrcweir }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir //##################################################################################################
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir // libraries
229*cdf0e10cSrcweir //__________________________________________________________________________________________________
230*cdf0e10cSrcweir Reference< xml::input::XElement > LibrariesElement::startChildElement(
231*cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
232*cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
233*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir     if (_pImport->XMLNS_LIBRARY_UID != nUid)
236*cdf0e10cSrcweir     {
237*cdf0e10cSrcweir         throw xml::sax::SAXException(
238*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
239*cdf0e10cSrcweir             Reference< XInterface >(), Any() );
240*cdf0e10cSrcweir     }
241*cdf0e10cSrcweir     // library
242*cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("library") ))
243*cdf0e10cSrcweir     {
244*cdf0e10cSrcweir         LibDescriptor aDesc;
245*cdf0e10cSrcweir         aDesc.bLink = aDesc.bReadOnly = aDesc.bPasswordProtected = aDesc.bPreload = sal_False;
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir         aDesc.aName = xAttributes->getValueByUidName(
248*cdf0e10cSrcweir             _pImport->XMLNS_LIBRARY_UID,
249*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) );
250*cdf0e10cSrcweir         aDesc.aStorageURL = xAttributes->getValueByUidName(
251*cdf0e10cSrcweir             _pImport->XMLNS_XLINK_UID,
252*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("href") ) );
253*cdf0e10cSrcweir         getBoolAttr(
254*cdf0e10cSrcweir             &aDesc.bLink,
255*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("link") ),
256*cdf0e10cSrcweir             xAttributes, _pImport->XMLNS_LIBRARY_UID );
257*cdf0e10cSrcweir         getBoolAttr(
258*cdf0e10cSrcweir             &aDesc.bReadOnly,
259*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
260*cdf0e10cSrcweir             xAttributes, _pImport->XMLNS_LIBRARY_UID );
261*cdf0e10cSrcweir         getBoolAttr(
262*cdf0e10cSrcweir             &aDesc.bPasswordProtected,
263*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ),
264*cdf0e10cSrcweir             xAttributes, _pImport->XMLNS_LIBRARY_UID );
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir         mLibDescriptors.push_back( aDesc );
267*cdf0e10cSrcweir         return new LibraryElement( rLocalName, xAttributes, this, _pImport );
268*cdf0e10cSrcweir     }
269*cdf0e10cSrcweir     else
270*cdf0e10cSrcweir     {
271*cdf0e10cSrcweir         throw xml::sax::SAXException(
272*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
273*cdf0e10cSrcweir             Reference< XInterface >(), Any() );
274*cdf0e10cSrcweir     }
275*cdf0e10cSrcweir }
276*cdf0e10cSrcweir //__________________________________________________________________________________________________
277*cdf0e10cSrcweir void LibrariesElement::endElement()
278*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
279*cdf0e10cSrcweir {
280*cdf0e10cSrcweir     sal_Int32 nLibCount = _pImport->mpLibArray->mnLibCount = (sal_Int32)mLibDescriptors.size();
281*cdf0e10cSrcweir     _pImport->mpLibArray->mpLibs = new LibDescriptor[ nLibCount ];
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir     for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
284*cdf0e10cSrcweir     {
285*cdf0e10cSrcweir         const LibDescriptor& rLib = mLibDescriptors[i];
286*cdf0e10cSrcweir         _pImport->mpLibArray->mpLibs[i] = rLib;
287*cdf0e10cSrcweir     }
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir // library
291*cdf0e10cSrcweir //__________________________________________________________________________________________________
292*cdf0e10cSrcweir Reference< xml::input::XElement > LibraryElement::startChildElement(
293*cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
294*cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
295*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
296*cdf0e10cSrcweir {
297*cdf0e10cSrcweir     if (_pImport->XMLNS_LIBRARY_UID != nUid)
298*cdf0e10cSrcweir     {
299*cdf0e10cSrcweir         throw xml::sax::SAXException(
300*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
301*cdf0e10cSrcweir             Reference< XInterface >(), Any() );
302*cdf0e10cSrcweir     }
303*cdf0e10cSrcweir     // library
304*cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("element") ))
305*cdf0e10cSrcweir     {
306*cdf0e10cSrcweir         OUString aValue( xAttributes->getValueByUidName(
307*cdf0e10cSrcweir             _pImport->XMLNS_LIBRARY_UID,
308*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) ) );
309*cdf0e10cSrcweir         if (aValue.getLength())
310*cdf0e10cSrcweir             mElements.push_back( aValue );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir         return new LibElementBase( rLocalName, xAttributes, this, _pImport );
313*cdf0e10cSrcweir     }
314*cdf0e10cSrcweir     else
315*cdf0e10cSrcweir     {
316*cdf0e10cSrcweir         throw xml::sax::SAXException(
317*cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
318*cdf0e10cSrcweir             Reference< XInterface >(), Any() );
319*cdf0e10cSrcweir     }
320*cdf0e10cSrcweir }
321*cdf0e10cSrcweir //__________________________________________________________________________________________________
322*cdf0e10cSrcweir void LibraryElement::endElement()
323*cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
324*cdf0e10cSrcweir {
325*cdf0e10cSrcweir     sal_Int32 nElementCount = mElements.size();
326*cdf0e10cSrcweir     Sequence< OUString > aElementNames( nElementCount );
327*cdf0e10cSrcweir     OUString* pElementNames = aElementNames.getArray();
328*cdf0e10cSrcweir     for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
329*cdf0e10cSrcweir         pElementNames[i] = mElements[i];
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir     LibDescriptor* pLib = _pImport->mpLibDesc;
332*cdf0e10cSrcweir     if( !pLib )
333*cdf0e10cSrcweir         pLib = &static_cast< LibrariesElement* >( _pParent )->mLibDescriptors.back();
334*cdf0e10cSrcweir     pLib->aElementNames = aElementNames;
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir //##################################################################################################
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir Reference< ::com::sun::star::xml::sax::XDocumentHandler >
341*cdf0e10cSrcweir SAL_CALL importLibraryContainer( LibDescriptorArray* pLibArray )
342*cdf0e10cSrcweir         SAL_THROW( (Exception) )
343*cdf0e10cSrcweir {
344*cdf0e10cSrcweir     return ::xmlscript::createDocumentHandler(
345*cdf0e10cSrcweir         static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) );
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir //##################################################################################################
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >
351*cdf0e10cSrcweir SAL_CALL importLibrary( LibDescriptor& rLib )
352*cdf0e10cSrcweir         SAL_THROW( (::com::sun::star::uno::Exception) )
353*cdf0e10cSrcweir {
354*cdf0e10cSrcweir     return ::xmlscript::createDocumentHandler(
355*cdf0e10cSrcweir         static_cast< xml::input::XRoot * >( new LibraryImport( &rLib ) ) );
356*cdf0e10cSrcweir }
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir //##################################################################################################
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir LibDescriptorArray::LibDescriptorArray( sal_Int32 nLibCount )
362*cdf0e10cSrcweir {
363*cdf0e10cSrcweir     mnLibCount = nLibCount;
364*cdf0e10cSrcweir     mpLibs = new LibDescriptor[ mnLibCount ];
365*cdf0e10cSrcweir }
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir LibDescriptorArray::~LibDescriptorArray()
368*cdf0e10cSrcweir {
369*cdf0e10cSrcweir     delete[] mpLibs;
370*cdf0e10cSrcweir }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir }
373