merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / scripting / source / storage / ScriptElement.cxx
blob422e62aab361c77ff11aabcccaff6e54009c6ba0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_scripting.hxx"
32 #include "ScriptElement.hxx"
33 #include <util/util.hxx>
35 using namespace ::rtl;
36 using namespace ::com::sun::star;
37 using namespace ::com::sun::star::uno;
39 typedef ::std::vector < ::std::pair < ::rtl::OUString, bool > > dependencies_vec;
40 typedef ::std::vector < ::std::pair < ::rtl::OUString, ::rtl::OUString > > deliveries_vec;
42 namespace scripting_impl
45 //*************************************************************************
46 /**
47 Construct a ScriptElement from a ScriptData object
49 @param sII
50 the ScriptDataObject
52 ScriptElement::ScriptElement( ScriptData & sII ) :
53 XMLElement( OUSTR( "parcel" ) ),
54 m_sII( sII )
56 OSL_TRACE( "ScriptElement ctor called\n" );
58 addAttribute( OUSTR( "language" ), sII.language );
59 addAttribute( OUSTR( "xmlns:parcel" ), OUSTR( "scripting.dtd" ) );
60 XMLElement* xScriptElt = new XMLElement( OUSTR( "script" ) );
61 xScriptElt->addAttribute( OUSTR( "language" ), sII.language );
62 Reference < xml::sax::XAttributeList > xal( xScriptElt );
63 addSubElement( xal );
65 strpair_map::const_iterator mp_it = sII.locales.begin();
66 strpair_map::const_iterator mp_itend = sII.locales.end();
68 for( ; mp_it != mp_itend; ++mp_it )
70 XMLElement* xel = new XMLElement( OUSTR( "locale" ) );
71 xel->addAttribute( OUSTR( "lang" ), mp_it->first );
74 XMLElement* subxel = new XMLElement( OUSTR( "displayname" ) );
75 subxel->addAttribute( OUSTR( "value" ), mp_it->second.first );
76 Reference < xml::sax::XAttributeList > subxattl( subxel );
77 xel->addSubElement( subxattl );
80 XMLElement* subxel = new XMLElement( OUSTR( "description" ),
81 mp_it->second.second );
82 Reference< xml::sax::XAttributeList > subxattl( subxel );
83 xel->addSubElement( subxattl );
86 Reference < xml::sax::XAttributeList > xal( xel );
87 xScriptElt->addSubElement( xal );
91 XMLElement* xel = new XMLElement( OUSTR( "functionname" ) );
92 xel->addAttribute( OUSTR( "value" ), sII.functionname );
93 Reference < xml::sax::XAttributeList > xal( xel );
94 xScriptElt->addSubElement( xal );
98 XMLElement* xel = new XMLElement( OUSTR( "logicalname" ) );
99 xel->addAttribute( OUSTR( "value" ), sII.logicalname );
100 Reference < xml::sax::XAttributeList > xal( xel );
101 xScriptElt->addSubElement( xal );
104 props_vec::const_iterator vp_it = sII.languagedepprops.begin();
105 props_vec::const_iterator vp_itend = sII.languagedepprops.end();
107 if ( vp_it != vp_itend )
109 XMLElement* xel = new XMLElement( OUSTR( "languagedepprops" ) );
111 for( ; vp_it != vp_itend ; ++vp_it )
113 XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
114 subxel->addAttribute( OUSTR( "name" ), vp_it->first );
115 subxel->addAttribute( OUSTR( "value" ), vp_it->second );
116 Reference < xml::sax::XAttributeList > subxattl( subxel );
117 xel->addSubElement( subxattl );
120 Reference < xml::sax::XAttributeList > xal( xel );
121 xScriptElt->addSubElement( xal );
124 filesets_map::const_iterator fm_it = sII.filesets.begin();
125 filesets_map::const_iterator fm_itend = sII.filesets.end();
127 for( ; fm_it != fm_itend; ++fm_it )
129 XMLElement* xel = new XMLElement( OUSTR( "fileset" ) );
130 xel->addAttribute( OUSTR( "name" ), fm_it->first );
132 vp_it = fm_it->second.first.begin();
133 vp_itend = fm_it->second.first.end();
135 for( ; vp_it != vp_itend; ++vp_it )
137 XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
138 subxel->addAttribute( OUSTR( "name" ), vp_it->first );
139 subxel->addAttribute( OUSTR("value"), vp_it->second );
140 Reference < xml::sax::XAttributeList > subxattl( subxel );
141 xel->addSubElement( subxattl );
144 strpairvec_map::const_iterator sm_it = fm_it->second.second.begin();
145 strpairvec_map::const_iterator sm_itend = fm_it->second.second.end();
147 if( sm_it != sm_itend )
149 // was there a purpose for contstructing this
150 // XMLElement* subxel = new XMLElement( OUSTR( "file" ) );
151 xel->addAttribute( OUSTR( "name" ), sm_it->first );
157 //*************************************************************************
158 ScriptElement::~ScriptElement() SAL_THROW(())
162 } // namespace scripting_impl
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */