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