1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "sal/config.h"
22 #include "codemaker/commoncpp.hxx"
23 #include "codemaker/global.hxx"
25 #include "skeletoncommon.hxx"
26 #include "skeletoncpp.hxx"
30 using namespace ::rtl
;
31 using namespace ::codemaker::cpp
;
33 namespace skeletonmaker
{ namespace cpp
{
35 void generateIncludes(std::ostream
& o
,
36 const std::set
< OUString
>& interfaces
,
37 OUString propertyhelper
, bool serviceobject
,
38 bool supportxcomponent
)
40 o
<< "#include \"sal/config.h\"\n";
42 o
<< "#include \"cppuhelper/factory.hxx\"\n"
43 << "#include \"cppuhelper/implementationentry.hxx\"\n";
45 o
<< "#include \"com/sun/star/uno/XComponentContext.hpp\"\n";
47 if (supportxcomponent
) {
48 o
<< "#include \"cppuhelper/compbase" << interfaces
.size() << ".hxx\"\n";
49 o
<< "#include \"cppuhelper/basemutex.hxx\"\n";
51 o
<< "#include \"cppuhelper/implbase" << interfaces
.size() << ".hxx\"\n";
54 if (propertyhelper
.getLength() > 1) {
55 if (propertyhelper
.equals("_"))
56 o
<< "#include \"cppuhelper/rpopshlp.hxx\"\n";
58 o
<< "#include \"cppuhelper/propertysetmixin.hxx\"\n";
61 std::set
< OUString
>::const_iterator iter
= interfaces
.begin();
62 while (iter
!= interfaces
.end())
65 << ((*iter
).replace('.', '/').getStr())
71 short generateNamespace(std::ostream
& o
,
72 const OString
& implname
,
77 sal_Int32 index
= implname
.lastIndexOf('.');
79 o
<< "\n\n// component helper namespace\n";
88 nm
= buf
.makeStringAndClear();
89 o
<< "namespace comp_" << implname
<< " {\n\n";
97 OString
token(implname
.getToken(0, '.', nPos
));
98 if (nPos
< 0 && serviceobject
) {
99 buf
.append("::comp_");
101 o
<< "namespace comp_" << token
<< " { ";
106 o
<< "namespace " << token
<< " { ";
109 } while( nPos
<= index
);
110 nm
= buf
.makeStringAndClear();
116 OString
generateCompHelperDeclaration(std::ostream
& o
,
117 const OString
& implname
)
120 short nbrackets
= generateNamespace(o
, implname
, true, nm
);
122 o
<< "namespace css = ::com::sun::star;\n\n";
124 // generate component/service helper functions
125 o
<< "// component and service helper functions:\n"
126 "::rtl::OUString SAL_CALL _getImplementationName();\n"
127 "css::uno::Sequence< ::rtl::OUString > SAL_CALL "
128 "_getSupportedServiceNames();\n"
129 "css::uno::Reference< css::uno::XInterface > SAL_CALL _create("
130 " css::uno::Reference< css::uno::XComponentContext > const & "
134 for (short i
=0; i
< nbrackets
; i
++)
136 o
<< "// closing component helper namespace\n\n";
141 void generateCompHelperDefinition(std::ostream
& o
,
142 const OString
& implname
,
143 const OString
& classname
,
144 const std::set
< OUString
>& services
)
147 short nbrackets
= generateNamespace(o
, implname
, true, nm
);
149 o
<< "::rtl::OUString SAL_CALL _getImplementationName() {\n"
150 << " return ::rtl::OUString(\n"
151 << " \"" << implname
<< "\");\n}\n\n";
153 o
<< "css::uno::Sequence< ::rtl::OUString > SAL_CALL "
154 "_getSupportedServiceNames()\n{\n css::uno::Sequence< "
155 << "::rtl::OUString >" << " s(" << services
.size() << ");\n";
157 std::set
< OUString
>::const_iterator iter
= services
.begin();
159 while (iter
!= services
.end())
161 o
<< " s[" << i
++ << "] = ::rtl::OUString(\""
162 << *iter
<< "\");\n";
165 o
<< " return s;\n}\n\n";
167 o
<< "css::uno::Reference< css::uno::XInterface > SAL_CALL _create("
168 << "\n const css::uno::Reference< css::uno::XComponentContext > & "
169 << "context)\n SAL_THROW((css::uno::Exception))\n{\n"
170 << " return static_cast< ::cppu::OWeakObject * >(new "
171 << classname
<< "(context));\n}\n\n";
174 for (short j
=0; j
< nbrackets
; j
++)
176 o
<< "// closing component helper namespace\n\n";
180 void generateCompFunctions(std::ostream
& o
, const OString
& nmspace
)
182 o
<< "static ::cppu::ImplementationEntry const entries[] = {\n"
183 << " { &" << nmspace
<< "::_create,\n &"
184 << nmspace
<< "::_getImplementationName,\n &"
185 << nmspace
<< "::_getSupportedServiceNames,\n"
186 << " &::cppu::createSingleComponentFactory, 0, 0 },\n"
187 << " { 0, 0, 0, 0, 0, 0 }\n};\n\n";
189 o
<< "extern \"C\" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(\n"
190 << " const char * implName, void * serviceManager, void * registryKey)\n{\n"
191 << " return ::cppu::component_getFactoryHelper(\n"
192 << " implName, serviceManager, registryKey, entries);\n}\n\n";
194 o
<< "extern \"C\" sal_Bool SAL_CALL component_writeInfo(\n"
195 << " void * serviceManager, void * registryKey)\n{\n"
196 << " return ::cppu::component_writeInfoHelper("
197 << "serviceManager, registryKey, entries);\n}\n";
200 void generateXPropertySetBodies(std::ostream
& o
,
201 const OString
& classname
,
202 const OString
& propertyhelper
)
204 o
<< "// com.sun.star.beans.XPropertySet:\n";
206 o
<< "css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL "
207 << classname
<< "getPropertySetInfo() throw ("
208 "css::uno::RuntimeException)\n{\n return ::cppu::PropertySetMixin< "
210 << " >::getPropertySetInfo();\n}\n\n";
212 o
<< "void SAL_CALL " << classname
<< "setPropertyValue(const ::rtl::OUString"
213 " & aPropertyName, const css::uno::Any & aValue) throw ("
214 "css::uno::RuntimeException, css::beans::UnknownPropertyException, "
215 "css::beans::PropertyVetoException, css::lang::IllegalArgumentException, "
216 "css::lang::WrappedTargetException)\n{\n ::cppu::PropertySetMixin< "
217 << propertyhelper
<< " >::setPropertyValue(aPropertyName, aValue);\n}\n\n";
220 o
<< "css::uno::Any SAL_CALL " << classname
<< "getPropertyValue(const "
221 "::rtl::OUString & aPropertyName) throw (css::uno::RuntimeException, "
222 "css::beans::UnknownPropertyException, css::lang::WrappedTargetException)"
223 "\n{\n return ::cppu::PropertySetMixin< "
224 << propertyhelper
<< " >::getPropertyValue(aPropertyName);\n}\n\n";
226 o
<< "void SAL_CALL " << classname
<< "addPropertyChangeListener(const "
227 "::rtl::OUString & aPropertyName, const css::uno::Reference< "
228 "css::beans::XPropertyChangeListener > & xListener) throw ("
229 "css::uno::RuntimeException, css::beans::UnknownPropertyException, "
230 "css::lang::WrappedTargetException)\n{\n ::cppu::PropertySetMixin< "
232 << " >::addPropertyChangeListener(aPropertyName, xListener);\n}\n\n";
234 o
<< "void SAL_CALL " << classname
<< "removePropertyChangeListener(const "
235 "::rtl::OUString & aPropertyName, const css::uno::Reference< "
236 "css::beans::XPropertyChangeListener > & xListener) throw ("
237 "css::uno::RuntimeException, css::beans::UnknownPropertyException, "
238 "css::lang::WrappedTargetException)\n{\n ::cppu::PropertySetMixin< "
240 << " >::removePropertyChangeListener(aPropertyName, xListener);\n}\n\n";
242 o
<< "void SAL_CALL " << classname
<< "addVetoableChangeListener(const "
243 "::rtl::OUString & aPropertyName, const css::uno::Reference< "
244 "css::beans::XVetoableChangeListener > & xListener) throw ("
245 "css::uno::RuntimeException, css::beans::UnknownPropertyException, "
246 "css::lang::WrappedTargetException)\n{\n ::cppu::PropertySetMixin< "
248 << " >::addVetoableChangeListener(aPropertyName, xListener);\n}\n\n";
250 o
<< "void SAL_CALL " << classname
<< "removeVetoableChangeListener(const "
251 "::rtl::OUString & aPropertyName, const css::uno::Reference< "
252 "css::beans::XVetoableChangeListener > & xListener) throw ("
253 "css::uno::RuntimeException, css::beans::UnknownPropertyException, "
254 "css::lang::WrappedTargetException)\n{\n ::cppu::PropertySetMixin< "
256 << " >::removeVetoableChangeListener(aPropertyName, xListener);\n}\n\n";
259 void generateXFastPropertySetBodies(std::ostream
& o
,
260 const OString
& classname
,
261 const OString
& propertyhelper
)
263 o
<< "// com.sun.star.beans.XFastPropertySet:\n";
265 o
<< "void SAL_CALL " << classname
<< "setFastPropertyValue( ::sal_Int32 "
266 "nHandle, const css::uno::Any& aValue ) throw ("
267 "css::beans::UnknownPropertyException, css::beans::PropertyVetoException, "
268 "css::lang::IllegalArgumentException, css::lang::WrappedTargetException, "
269 "css::uno::RuntimeException)\n{\n ::cppu::PropertySetMixin< "
270 << propertyhelper
<< " >::setFastPropertyValue(nHandle, aValue);\n}\n\n";
273 o
<< "css::uno::Any SAL_CALL " << classname
<< "getFastPropertyValue( "
274 "::sal_Int32 nHandle ) throw (css::beans::UnknownPropertyException, "
275 "css::lang::WrappedTargetException, css::uno::RuntimeException)\n{\n"
276 " return ::cppu::PropertySetMixin< "
277 << propertyhelper
<< " >::getFastPropertyValue(nHandle);\n}\n\n";
280 void generateXPropertyAccessBodies(std::ostream
& o
,
281 const OString
& classname
,
282 const OString
& propertyhelper
)
284 o
<< " // com.sun.star.beans.XPropertyAccess:\n";
286 o
<< "css::uno::Sequence< css::beans::PropertyValue > SAL_CALL "
287 << classname
<< "getPropertyValues( ) throw ("
288 "css::uno::RuntimeException)\n{\n"
289 " return ::cppu::PropertySetMixin< "
290 << propertyhelper
<< " >::getPropertyValues();\n}\n\n";
292 o
<< "void SAL_CALL " << classname
<< "setPropertyValues( const "
293 "css::uno::Sequence< css::beans::PropertyValue >& aProps ) throw ("
294 "css::beans::UnknownPropertyException, css::beans::PropertyVetoException, "
295 "css::lang::IllegalArgumentException, css::lang::WrappedTargetException, "
296 "css::uno::RuntimeException)\n{\n"
297 " ::cppu::PropertySetMixin< "
298 << propertyhelper
<< " >::setPropertyValues(aProps);\n}\n\n";
301 void generateXLocalizable(std::ostream
& o
, const OString
& classname
)
303 o
<< "// css::lang::XLocalizable:\n"
304 "void SAL_CALL " << classname
<< "setLocale(const css::lang::"
305 "Locale & eLocale) throw (css::uno::RuntimeException)\n{\n"
306 " m_locale = eLocale;\n}\n\n"
307 "css::lang::Locale SAL_CALL " << classname
<< "getLocale() "
308 "throw (css::uno::RuntimeException)\n{\n return m_locale;\n}\n\n";
311 void generateXAddInBodies(std::ostream
& o
, const OString
& classname
)
313 o
<< "// css::sheet::XAddIn:\n";
315 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getProgrammaticFuntionName("
316 "const ::rtl::OUString & aDisplayName) throw (css::uno::RuntimeException)"
317 "\n{\n ::rtl::OUString ret;\n try {\n css::uno::Reference< "
318 "css::container::XNameAccess > xNAccess(m_xHAccess, css::uno::UNO_QUERY);\n"
319 " css::uno::Sequence< ::rtl::OUString > functions = "
320 "xNAccess->getElementNames();\n sal_Int32 len = functions."
321 "getLength();\n ::rtl::OUString sDisplayName;\n"
322 " for (sal_Int32 i=0; i < len; ++i) {\n"
323 " sDisplayName = getAddinProperty(functions[i], "
324 "::rtl::OUString(),\n "
325 "sDISPLAYNAME);\n if (sDisplayName.equals(aDisplayName))\n"
326 " return functions[i];\n }\n }\n"
327 " catch ( const css::uno::RuntimeException & e ) {\n throw e;\n }\n"
328 " catch ( css::uno::Exception & ) {\n }\n return ret;\n}\n\n";
330 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getDisplayFunctionName(const "
331 "::rtl::OUString & aProgrammaticName) throw (css::uno::RuntimeException)\n"
332 "{\n return getAddinProperty(aProgrammaticName, ::rtl::OUString(), "
333 "sDISPLAYNAME);\n}\n\n";
335 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getFunctionDescription(const "
336 "::rtl::OUString & aProgrammaticName) throw (css::uno::RuntimeException)\n"
337 "{\n return getAddinProperty(aProgrammaticName, ::rtl::OUString(), "
338 "sDESCRIPTION);\n}\n\n";
340 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getDisplayArgumentName(const "
341 "::rtl::OUString & aProgrammaticFunctionName, ::sal_Int32 nArgument) throw "
342 "(css::uno::RuntimeException)\n{\n return getAddinProperty("
343 "aProgrammaticFunctionName,\n m_functionMap["
344 "aProgrammaticFunctionName][nArgument],\n"
345 " sDISPLAYNAME);\n}\n\n";
347 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getArgumentDescription(const "
348 "::rtl::OUString & aProgrammaticFunctionName, ::sal_Int32 nArgument) throw "
349 "(css::uno::RuntimeException)\n{\n return getAddinProperty("
350 "aProgrammaticFunctionName,\n "
351 "m_functionMap[aProgrammaticFunctionName][nArgument],\n"
352 " sDESCRIPTION);\n}\n\n";
354 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getProgrammaticCategoryName("
355 "const ::rtl::OUString & aProgrammaticFunctionName) throw ("
356 "css::uno::RuntimeException)\n{\n return getAddinProperty("
357 "aProgrammaticFunctionName, ::rtl::OUString(), sCATEGORY);\n}\n\n";
359 o
<< "::rtl::OUString SAL_CALL " << classname
<< "getDisplayCategoryName(const "
360 "::rtl::OUString & aProgrammaticFunctionName) throw ("
361 "css::uno::RuntimeException)\n{\n return getAddinProperty("
362 "aProgrammaticFunctionName, ::rtl::OUString(), "
363 "sCATEGORYDISPLAYNAME);\n}\n\n";
366 void generateXCompatibilityNamesBodies(std::ostream
& o
, const OString
& classname
)
368 o
<< "// css::sheet::XCompatibilityNames:\n"
369 "css::uno::Sequence< css::sheet::LocalizedName > SAL_CALL " << classname
370 << "getCompatibilityNames(const ::rtl::OUString & aProgrammaticName) throw "
371 "(css::uno::RuntimeException)\n{\n css::uno::Sequence< "
372 "css::sheet::LocalizedName > seqLocalizedNames;\n try {\n "
373 "::rtl::OUStringBuffer buf("
374 "aProgrammaticName);\n buf.appendAscii(\"/CompatibilityName\");\n"
375 " ::rtl::OUString hname(buf.makeStringAndClear());\n\n "
376 "if ( m_xCompAccess->hasByHierarchicalName(hname) ) {\n"
377 " css::uno::Reference< css::container::XNameAccess > "
379 " m_xCompAccess->getByHierarchicalName(hname), "
380 "css::uno::UNO_QUERY);\n\n css::uno::Sequence< ::rtl::OUString"
381 " > elems = \n xNameAccess->getElementNames();"
382 "\n ::sal_Int32 len = elems.getLength();\n\n "
383 "seqLocalizedNames.realloc(len);\n\n ::rtl::OUString "
384 "sCompatibilityName;\n for (::sal_Int32 i=0; i < len; ++i) {\n"
385 " ::rtl::OUString sLocale(elems[i]);\n "
386 "xNameAccess->getByName(sLocale) >>= sCompatibilityName;\n\n"
387 " css::lang::Locale aLocale;\n "
388 "::sal_Int32 nIndex = 0, nToken = 0;\n "
389 "do {\n ::rtl::OUString aToken = sLocale.getToken(0, '-', "
390 "nIndex);\n switch (nToken++) {\n "
391 "case 0:\n aLocale.Language = aToken;\n"
392 " break;\n case 1:\n"
393 " aLocale.Country = aToken;\n "
394 " break;\n default:\n "
395 "aLocale.Variant = sLocale.copy(nIndex-aToken.getLength()-1);\n"
396 " nIndex = -1;\n }\n"
397 " } while ( nIndex >= 0 );\n\n "
398 "seqLocalizedNames[i].Locale = aLocale;\n "
399 "seqLocalizedNames[i].Name = sCompatibilityName;\n }"
400 "\n }\n }\n catch ( const css::uno::RuntimeException & e ) {\n "
401 "throw e;\n }\n catch ( css::uno::Exception & ) {\n }\n\n"
402 " return seqLocalizedNames;\n}\n\n";
405 void generateXInitialization(std::ostream
& o
, const OString
& classname
)
407 o
<< "// css::lang::XInitialization:\n"
408 "void SAL_CALL " << classname
<< "initialize( const css::uno::Sequence< "
409 "css::uno::Any >& aArguments ) "
410 "throw (css::uno::Exception, css::uno::RuntimeException)\n{\n"
411 " css::uno::Reference < css::frame::XFrame > xFrame;\n"
412 " if ( aArguments.getLength() ) {\n aArguments[0] >>= xFrame;\n"
413 " m_xFrame = xFrame;\n }\n}\n\n";
416 void generateXDispatch(std::ostream
& o
,
417 const OString
& classname
,
418 const ProtocolCmdMap
& protocolCmdMap
)
420 // com.sun.star.frame.XDispatch
422 o
<< "// css::frame::XDispatch:\n"
423 "void SAL_CALL " << classname
<< "dispatch( const css::util::URL& aURL, const "
424 "css::uno::Sequence< css::beans::PropertyValue >& aArguments ) throw"
425 "(css::uno::RuntimeException)\n{\n";
427 ProtocolCmdMap::const_iterator iter
= protocolCmdMap
.begin();
428 while (iter
!= protocolCmdMap
.end()) {
429 o
<< " if ( aURL.Protocol.equalsAscii(\"" << (*iter
).first
430 << "\") == 0 )\n {\n";
432 for (std::vector
< OString
>::const_iterator i
= (*iter
).second
.begin();
433 i
!= (*iter
).second
.end(); ++i
) {
434 o
<< " if ( aURL.Path.equalsAscii(\"" << (*i
) << "\") )\n"
435 " {\n // add your own code here\n"
445 o
<< "void SAL_CALL " << classname
<< "addStatusListener( const css::uno::Reference< "
446 "css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) "
447 "throw (css::uno::RuntimeException)\n{\n"
448 " // add your own code here\n}\n\n";
450 // removeStatusListener
451 o
<< "void SAL_CALL " << classname
<< "removeStatusListener( const css::uno::Reference"
452 "< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) "
453 "throw (css::uno::RuntimeException)\n{\n"
454 " // add your own code here\n}\n\n";
457 void generateXDispatchProvider(std::ostream
& o
,
458 const OString
& classname
,
459 const ProtocolCmdMap
& protocolCmdMap
)
462 // com.sun.star.frame.XDispatchProvider
464 o
<< "// css::frame::XDispatchProvider:\n"
465 "css::uno::Reference< css::frame::XDispatch > SAL_CALL " << classname
466 << "queryDispatch( const css::util::URL& aURL,"
467 " const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags ) "
468 "throw(css::uno::RuntimeException)\n{\n css::uno::Reference< "
469 "css::frame::XDispatch > xRet;\n"
470 " if ( !m_xFrame.is() )\n return 0;\n\n";
472 ProtocolCmdMap::const_iterator iter
= protocolCmdMap
.begin();
473 while (iter
!= protocolCmdMap
.end()) {
474 o
<< " if ( aURL.Protocol.equalsAscii(\"" << (*iter
).first
475 << "\") == 0 )\n {\n";
477 for (std::vector
< OString
>::const_iterator i
= (*iter
).second
.begin();
478 i
!= (*iter
).second
.end(); ++i
) {
479 o
<< " if ( aURL.Path.equalsAscii(\"" << (*i
) << "\") == 0 )\n"
486 o
<< " return xRet;\n}\n\n";
489 o
<< "css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL "
490 << classname
<< "queryDispatches( const css::uno::Sequence< "
491 "css::frame::DispatchDescriptor >& seqDescripts ) throw("
492 "css::uno::RuntimeException)\n{\n"
493 " sal_Int32 nCount = seqDescripts.getLength();\n"
494 " css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > "
495 "lDispatcher(nCount);\n\n"
496 " for( sal_Int32 i=0; i<nCount; ++i ) {\n"
497 " lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL,\n"
498 " seqDescripts[i].FrameName,\n"
499 " seqDescripts[i].SearchFlags );\n"
500 " }\n\n return lDispatcher;\n}\n\n";
503 void generateAddinConstructorAndHelper(std::ostream
& o
,
504 ProgramOptions
const & options
,
505 rtl::Reference
< TypeManager
> const & manager
, const OString
& classname
,
506 const std::set
< OUString
>& interfaces
)
508 o
<< classname
<< "::" << classname
509 << "(css::uno::Reference< css::uno::XComponentContext > const & context) :\n"
510 << " m_xContext(context), m_locale()\n{\n";
512 if (options
.backwardcompatible
) {
515 generateFunctionParameterMap(o
, options
, manager
, interfaces
);
517 o
<< " css::uno::Reference< css::lang::XMultiServiceFactory > xProvider"
518 "(\n m_xContext->getServiceManager()->createInstanceWithContext"
519 "(\n ::rtl::OUString(\n "
520 " \"com.sun.star.configuration.ConfigurationProvider\"),"
521 "\n m_xContext ), css::uno::UNO_QUERY );\n\n";
523 o
<< " ::rtl::OUString sReadOnlyView(\n"
524 " \"com.sun.star.configuration.ConfigurationAccess\");\n\n";
526 o
<< " ::rtl::OUStringBuffer sPath(::rtl::OUString(\n"
527 " \"/org.openoffice.Office.CalcAddIns/AddInInfo/\"));\n"
528 " sPath.appendAscii(sADDIN_SERVICENAME);\n"
529 " sPath.appendAscii(\"/AddInFunctions\");\n\n"
530 " // create arguments: nodepath\n"
531 " css::beans::PropertyValue aArgument;\n"
532 " aArgument.Name = ::rtl::OUString(\"nodepath\");\n"
533 " aArgument.Value <<= sPath.makeStringAndClear();\n\n"
534 " css::uno::Sequence< css::uno::Any > aArguments(1);\n"
535 " aArguments[0] <<= aArgument;\n\n";
537 o
<< " // create the default view using default UI locale\n"
538 " css::uno::Reference< css::uno::XInterface > xIface =\n"
539 " xProvider->createInstanceWithArguments(sReadOnlyView, "
541 " m_xHAccess = css::uno::Reference<\n "
542 "css::container::XHierarchicalNameAccess >(xIface, css::uno::UNO_QUERY);"
545 o
<< " // extend arguments to create a view for all locales to get "
546 "simple\n // access to the compatibilityname property\n"
547 " aArgument.Name = ::rtl::OUString(\"locale\");\n"
548 " aArgument.Value <<= ::rtl::OUString(\"*\");\n"
549 " aArguments.realloc(2);\n"
550 " aArguments[1] <<= aArgument;\n\n"
551 " // create view for all locales\n"
552 " xIface = xProvider->createInstanceWithArguments(sReadOnlyView, "
554 " m_xCompAccess = css::uno::Reference<\n "
555 "css::container::XHierarchicalNameAccess >(xIface, css::uno::UNO_QUERY);\n";
557 o
<< " }\n catch ( css::uno::Exception & ) {\n }\n}\n\n";
559 o
<< "// addin configuration property helper function:\n::rtl::OUString "
560 "SAL_CALL " << classname
<< "::getAddinProperty(const ::rtl::OUString &"
561 " funcName, const ::rtl::OUString & paramName, const char * propName) "
562 "throw (css::uno::RuntimeException)\n{\n"
563 " ::rtl::OUString ret;\n try {\n "
564 "::rtl::OUStringBuffer buf(funcName);\n"
565 " if (!paramName.isEmpty()) {\n"
566 " buf.appendAscii(\"/Parameters/\");\n"
567 " buf.append(paramName);\n }\n\n"
568 " css::uno::Reference< css::beans::XPropertySet > xPropSet(\n"
569 " m_xHAccess->getByHierarchicalName(\n"
570 " buf.makeStringAndClear()), css::uno::UNO_QUERY);\n"
571 " xPropSet->getPropertyValue(\n "
572 "::rtl::OUString(propName)) >>= ret;\n }\n"
573 " catch ( const css::uno::RuntimeException & e ) {\n throw e;\n }\n"
574 " catch ( css::uno::Exception & ) {\n }\n return ret;\n";
579 void generateMemberInitialization(std::ostream
& o
,
580 ProgramOptions
const & options
,
581 rtl::Reference
< TypeManager
> const & manager
,
582 AttributeInfo
const & members
)
584 if (!members
.empty()) {
585 for (AttributeInfo::const_iterator
i(members
.begin());
586 i
!= members
.end(); ++i
)
589 if ((manager
->decompose(i
->type
, true, 0, &rank
, 0, 0)
590 <= codemaker::UnoType::SORT_CHAR
)
593 o
<< ",\n m_" << i
->name
<< "(";
594 printType(o
, options
, manager
, i
->type
, 16, true);
601 void generateMemberDeclaration(std::ostream
& o
,
602 ProgramOptions
const & options
,
603 rtl::Reference
< TypeManager
> const & manager
,
604 AttributeInfo
const & members
)
606 for (AttributeInfo::const_iterator
i(members
.begin());
607 i
!= members
.end(); ++i
)
610 printType(o
, options
, manager
, i
->type
, 1, false);
611 o
<< " m_" << i
->name
<< ";\n";
615 OString
generateClassDefinition(std::ostream
& o
,
616 ProgramOptions
const & options
,
617 rtl::Reference
< TypeManager
> const & manager
,
618 OString
const & classname
,
619 std::set
< OUString
> const & interfaces
,
620 AttributeInfo
const & properties
,
621 AttributeInfo
const & attributes
,
622 std::set
< OUString
> const & propinterfaces
,
623 OUString
const & propertyhelper
, bool supportxcomponent
)
625 OStringBuffer
parentname(64);
626 o
<< "class " << classname
<< ":\n";
628 if (!interfaces
.empty()) {
629 if (supportxcomponent
) {
630 parentname
.append("::cppu::WeakComponentImplHelper");
631 parentname
.append(static_cast<sal_Int32
>(interfaces
.size()));
632 o
<< " private ::cppu::BaseMutex,\n"
633 << " public ::cppu::WeakComponentImplHelper"
634 << interfaces
.size() << "<";
636 parentname
.append("::cppu::WeakImplHelper");
637 parentname
.append(static_cast<sal_Int32
>(interfaces
.size()));
638 o
<< " public ::cppu::WeakImplHelper" << interfaces
.size() << "<";
641 std::set
< OUString
>::const_iterator iter
= interfaces
.begin();
642 while (iter
!= interfaces
.end())
644 o
<< "\n " << scopedCppName(u2b(*iter
));
646 if (iter
!= interfaces
.end())
653 if (propertyhelper
.getLength() > 1) {
654 o
<< ",\n public ::cppu::PropertySetMixin< "
655 << scopedCppName(u2b(propertyhelper
)) << " >";
658 o
<< "\n{\npublic:\n"
659 << " explicit " << classname
<< "("
660 << "css::uno::Reference< css::uno::XComponentContext > const & context);\n\n";
662 // generate component/service helper functions
663 // o << " // component and service helper functions:\n"
664 // << " static ::rtl::OUString SAL_CALL _getImplementationName();\n"
665 // << " static css::uno::Sequence< ::rtl::OUString > SAL_CALL "
666 // << "_getSupportedServiceNames();\n"
667 // << " static css::uno::Reference< css::uno::XInterface > SAL_CALL _create("
668 // << "\n css::uno::Reference< css::uno::XComponentContext > const & "
669 // << "context);\n\n";
671 // overload queryInterface
672 if (propertyhelper
.getLength() > 1) {
673 o
<< " // css::uno::XInterface:\n"
674 " virtual css::uno::Any SAL_CALL queryInterface("
675 "css::uno::Type const & type) throw ("
676 "css::uno::RuntimeException);\n";
678 OStringBuffer
buffer(256);
679 buffer
.append(parentname
.toString());
681 std::set
< OUString
>::const_iterator iter
= interfaces
.begin();
682 while (iter
!= interfaces
.end())
684 buffer
.append(scopedCppName(u2b(*iter
)));
686 if (iter
!= interfaces
.end())
691 OString
parent(buffer
.makeStringAndClear());
692 o
<< " virtual void SAL_CALL acquire() throw ()\n { "
693 << parent
<< "::acquire(); }\n";
694 o
<< " virtual void SAL_CALL release() throw ()\n { "
695 << parent
<< "::release(); }\n\n";
698 std::set
< OUString
>::const_iterator it
= interfaces
.begin();
699 codemaker::GeneratedTypeSet generated
;
700 while (it
!= interfaces
.end())
702 printMethods(o
, options
, manager
, *it
, generated
, "", "", " ",
703 true, propertyhelper
);
707 o
<< "private:\n " << classname
<< "(const " << classname
<< " &); // not defined\n"
708 << " " << classname
<< "& operator=(const " << classname
<< " &); // not defined\n\n"
709 << " // destructor is private and will be called indirectly by the release call"
710 << " virtual ~" << classname
<< "() {}\n\n";
712 if (options
.componenttype
== 2) {
713 o
<< " typedef boost::unordered_map< ::sal_Int32, rtl::OUString, "
714 "boost::hash<::sal_Int32> > ParamMap;\n"
715 " typedef boost::unordered_map< rtl::OUString, ParamMap, "
716 "rtl::OUStringHash > FunctionMap;\n\n"
717 " ::rtl::OUString SAL_CALL getAddinProperty(const ::rtl::OUString & "
718 "funcName, const ::rtl::OUString & paramName, const char * propName) "
719 "throw (css::uno::RuntimeException);\n\n";
722 if (supportxcomponent
) {
723 o
<< " // overload WeakComponentImplHelperBase::disposing()\n"
724 " // This function is called upon disposing the component,\n"
725 " // if your component needs special work when it becomes\n"
726 " // disposed, do it here.\n"
727 " virtual void SAL_CALL disposing();\n\n";
731 o
<< " css::uno::Reference< css::uno::XComponentContext > m_xContext;\n";
732 if (!supportxcomponent
&& !attributes
.empty())
733 o
<< " mutable ::osl::Mutex m_aMutex;\n";
735 // additional member for add-ons
736 if (options
.componenttype
== 3) {
737 o
<< " css::uno::Reference< css::frame::XFrame > m_xFrame;\n";
740 if (options
.componenttype
== 2) {
741 if (options
.backwardcompatible
) {
742 o
<<" css::uno::Reference< css::container::XHierarchicalNameAccess > "
744 " css::uno::Reference< css::container::XHierarchicalNameAccess > "
746 " FunctionMap m_functionMap;\n";
748 o
<< " css::lang::Locale m_locale;\n";
751 generateMemberDeclaration(o
, options
, manager
, properties
);
752 generateMemberDeclaration(o
, options
, manager
, attributes
);
754 // if (!properties.empty())
756 // AttributeInfo::const_iterator iter = properties.begin();
757 // while (iter != properties.end())
760 // printType(o, options, manager, iter->second.first.replace('.','/'),
762 // o << " m_" << iter->first << ";\n";
766 // if (!attributes.empty())
768 // AttributeInfo::const_iterator iter = attributes.begin();
769 // while (iter != attributes.end())
772 // printType(o, options, manager, iter->second.first.replace('.','/'),
774 // o << " m_" << iter->first << ";\n";
781 // generate constructor
782 if (options
.componenttype
== 2) {
783 generateAddinConstructorAndHelper(o
, options
, manager
,
784 classname
, interfaces
);
786 o
<< classname
<< "::" << classname
787 << "(css::uno::Reference< css::uno::XComponentContext > const & context) :\n";
788 if (supportxcomponent
) {
789 o
<< " ::cppu::WeakComponentImplHelper" << interfaces
.size() << "<";
790 std::set
< OUString
>::const_iterator iter
= interfaces
.begin();
791 while (iter
!= interfaces
.end()) {
792 o
<< "\n " << scopedCppName(u2b(*iter
));
794 if (iter
!= interfaces
.end())
797 o
<< ">(m_aMutex),\n";
800 if (propertyhelper
.getLength() > 1) {
801 o
<< " ::cppu::PropertySetMixin< "
802 << scopedCppName(u2b(propertyhelper
)) << " >(\n"
803 << " context, static_cast< Implements >(\n ";
804 OStringBuffer
buffer(128);
805 if (propinterfaces
.find("com/sun/star/beans/XPropertySet")
806 != propinterfaces
.end()) {
807 buffer
.append("IMPLEMENTS_PROPERTY_SET");
809 if (propinterfaces
.find("com/sun/star/beans/XFastPropertySet")
810 != propinterfaces
.end()) {
811 if (buffer
.getLength() > 0)
812 buffer
.append(" | IMPLEMENTS_FAST_PROPERTY_SET");
814 buffer
.append("IMPLEMENTS_FAST_PROPERTY_SET");
816 if (propinterfaces
.find("com/sun/star/beans/XPropertyAccess")
817 != propinterfaces
.end()) {
818 if (buffer
.getLength() > 0)
819 buffer
.append(" | IMPLEMENTS_PROPERTY_ACCESS");
821 buffer
.append("IMPLEMENTS_PROPERTY_ACCESS");
823 o
<< buffer
.makeStringAndClear()
824 << "), css::uno::Sequence< ::rtl::OUString >()),\n";
826 o
<< " m_xContext(context)";
828 generateMemberInitialization(o
, options
, manager
, properties
);
829 generateMemberInitialization(o
, options
, manager
, attributes
);
834 // generate service/component helper function implementations
835 // generateServiceHelper(o, options.implname, classname, services);
837 if (supportxcomponent
) {
838 o
<< "// overload WeakComponentImplHelperBase::disposing()\n"
839 "// This function is called upon disposing the component,\n"
840 "// if your component needs special work when it becomes\n"
841 "// disposed, do it here.\n"
842 "void SAL_CALL " << classname
<< "::disposing()\n{\n\n}\n\n";
845 return parentname
.makeStringAndClear();
848 void generateXServiceInfoBodies(std::ostream
& o
,
849 OString
const & classname
,
850 OString
const & comphelpernamespace
)
852 o
<< "// com.sun.star.uno.XServiceInfo:\n"
853 << "::rtl::OUString SAL_CALL " << classname
<< "getImplementationName() "
854 << "throw (css::uno::RuntimeException)\n{\n "
855 << "return " << comphelpernamespace
<< "::_getImplementationName();\n}\n\n";
857 o
<< "::sal_Bool SAL_CALL " << classname
858 << "supportsService(::rtl::OUString const & "
859 << "serviceName) throw (css::uno::RuntimeException)\n{\n "
860 << "css::uno::Sequence< ::rtl::OUString > serviceNames = "
861 << comphelpernamespace
<< "::_getSupportedServiceNames();\n "
862 << "for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {\n "
863 << " if (serviceNames[i] == serviceName)\n return sal_True;\n"
864 << " }\n return sal_False;\n}\n\n";
866 o
<< "css::uno::Sequence< ::rtl::OUString > SAL_CALL " << classname
867 << "getSupportedServiceNames() throw (css::uno::RuntimeException)\n{\n "
868 << "return " << comphelpernamespace
869 << "::_getSupportedServiceNames();\n}\n\n";
873 void generateMethodBodies(std::ostream
& o
,
874 ProgramOptions
const & options
,
875 rtl::Reference
< TypeManager
> const & manager
,
876 std::set
< OUString
> const & interfaces
,
877 OString
const & classname
,
878 OString
const & comphelpernamespace
,
879 OUString
const & propertyhelper
)
881 OString
name(classname
.concat("::"));
882 std::set
< OUString
>::const_iterator iter
= interfaces
.begin();
883 codemaker::GeneratedTypeSet generated
;
884 while (iter
!= interfaces
.end()) {
885 if ( (*iter
).equals("com.sun.star.lang.XServiceInfo") ) {
886 generateXServiceInfoBodies(o
, name
, comphelpernamespace
);
887 generated
.add(u2b(*iter
));
889 printMethods(o
, options
, manager
, *iter
, generated
, "_",
890 name
, "", true, propertyhelper
);
896 void generateQueryInterface(std::ostream
& o
,
897 ProgramOptions
const & options
,
898 rtl::Reference
< TypeManager
> const & manager
,
899 const std::set
< OUString
>& interfaces
,
900 OString
const & parentname
,
901 OString
const & classname
,
902 OUString
const & propertyhelper
)
904 if (propertyhelper
.isEmpty())
907 o
<< "css::uno::Any " << classname
908 << "::queryInterface(css::uno::Type const & type) throw ("
909 "css::uno::RuntimeException)\n{\n ";
911 if (!propertyhelper
.isEmpty())
914 o
<< "css::uno::Any a(";
916 o
<< parentname
<< "<";
917 std::set
< OUString
>::const_iterator iter
= interfaces
.begin();
918 while (iter
!= interfaces
.end())
920 o
<< "\n " << scopedCppName(u2b(*iter
));
922 if (iter
!= interfaces
.end())
928 if (!propertyhelper
.isEmpty()) {
929 o
<< "::queryInterface(type);\n";
931 o
<< "::queryInterface(type));\n";
932 o
<< " return a.hasValue() ? a\n : (";
933 if (propertyhelper
.equals("_")) {
934 o
<< "::cppu::OPropertySetHelper::queryInterface(type));\n";
936 o
<< "::cppu::PropertySetMixin<\n ";
937 printType(o
, options
, manager
, propertyhelper
, 0, false);
938 o
<< " >::queryInterface(\n type));\n";
944 void generateSkeleton(ProgramOptions
const & options
,
945 rtl::Reference
< TypeManager
> const & manager
,
946 std::vector
< OString
> const & types
)
948 // special handling of calc add-ins
949 if (options
.componenttype
== 2) {
950 generateCalcAddin(options
, manager
, types
);
954 std::set
< OUString
> interfaces
;
955 std::set
< OUString
> services
;
956 AttributeInfo properties
;
957 AttributeInfo attributes
;
958 std::set
< OUString
> propinterfaces
;
959 bool serviceobject
= false;
960 bool supportxcomponent
= false;
962 std::vector
< OString
>::const_iterator iter
= types
.begin();
963 while (iter
!= types
.end()) {
964 checkType(manager
, b2u(*iter
), interfaces
, services
, properties
);
968 if (options
.componenttype
== 3) {
969 // the Protocolhandler service is mandatory for an protocol handler add-on,
970 // so it is defaulted. The XDispatchProvider provides Dispatch objects for
971 // certain functions and the generated impl object implements XDispatch
972 // directly for simplicity reasons.
973 checkType(manager
, "com.sun.star.frame.ProtocolHandler",
974 interfaces
, services
, properties
);
975 checkType(manager
, "com.sun.star.frame.XDispatch",
976 interfaces
, services
, properties
);
979 // check if service object or simple UNO object
980 if (!services
.empty())
981 serviceobject
= true;
983 OUString propertyhelper
= checkPropertyHelper(
984 options
, manager
, services
, interfaces
, attributes
, propinterfaces
);
986 checkDefaultInterfaces(interfaces
, services
, propertyhelper
);
988 if (interfaces
.size() > 12)
989 throw CannotDumpException(
990 "the skeletonmaker supports components with 12 interfaces "
991 "only (limitation of the UNO implementation helpers)!");
994 supportxcomponent
= checkXComponentSupport(manager
, interfaces
);
996 OString compFileName
;
998 std::ostream
* pofs
= NULL
;
999 bool standardout
= getOutputStream(options
, ".cxx",
1000 &pofs
, compFileName
, tmpFileName
);
1003 if (!standardout
&& options
.license
) {
1004 printLicenseHeader(*pofs
, compFileName
);
1007 generateIncludes(*pofs
, interfaces
, propertyhelper
, serviceobject
,
1010 if (options
.componenttype
== 3) {
1011 *pofs
<< "#include \"com/sun/star/frame/XFrame.hpp\"\n";
1018 if (serviceobject
) {
1019 nmspace
= generateCompHelperDeclaration(*pofs
, options
.implname
);
1022 "\n\n/// anonymous implementation namespace\nnamespace {\n\n"
1023 "namespace css = ::com::sun::star;\n\n";
1025 nm
= generateNamespace(*pofs
, options
.implname
, false, nmspace
);
1026 *pofs
<< "namespace css = ::com::sun::star;\n\n";
1029 sal_Int32 index
= 0;
1030 OString
classname(options
.implname
);
1031 if ((index
= classname
.lastIndexOf('.')) > 0)
1032 classname
= classname
.copy(index
+1);
1035 generateClassDefinition(*pofs
,
1036 options
, manager
, classname
, interfaces
, properties
,
1037 attributes
, propinterfaces
, propertyhelper
, supportxcomponent
));
1039 generateQueryInterface(*pofs
, options
, manager
, interfaces
, parentname
,
1040 classname
, propertyhelper
);
1042 generateMethodBodies(*pofs
, options
, manager
, interfaces
, classname
,
1043 nmspace
, propertyhelper
);
1045 if (serviceobject
) {
1047 *pofs
<< "} // closing anonymous implementation namespace\n\n";
1049 generateCompHelperDefinition(*pofs
, options
.implname
,
1050 classname
, services
);
1051 generateCompFunctions(*pofs
, nmspace
);
1054 for (short i
=0; i
< nm
; i
++)
1056 *pofs
<< (nm
> 0 ? "// closing namespace\n\n" : "\n");
1059 if ( !standardout
&& pofs
&& ((std::ofstream
*)pofs
)->is_open()) {
1060 ((std::ofstream
*)pofs
)->close();
1062 OSL_VERIFY(makeValidTypeFile(compFileName
, tmpFileName
, sal_False
));
1064 } catch (CannotDumpException
& e
) {
1065 std::cerr
<< "ERROR: " << e
.getMessage() << "\n";
1066 if ( !standardout
) {
1067 if (pofs
&& ((std::ofstream
*)pofs
)->is_open()) {
1068 ((std::ofstream
*)pofs
)->close();
1071 // remove existing type file if something goes wrong to ensure
1073 if (fileExists(compFileName
))
1074 removeTypeFile(compFileName
);
1076 // remove tmp file if something goes wrong
1077 removeTypeFile(tmpFileName
);
1082 void generateCalcAddin(ProgramOptions
const & options
,
1083 rtl::Reference
< TypeManager
> const & manager
,
1084 std::vector
< OString
> const & types
)
1086 std::set
< OUString
> interfaces
;
1087 std::set
< OUString
> services
;
1088 AttributeInfo properties
;
1089 AttributeInfo attributes
;
1090 std::set
< OUString
> propinterfaces
;
1091 bool serviceobject
= false;
1092 bool supportxcomponent
= false;
1095 std::vector
< OString
>::const_iterator iter
= types
.begin();
1096 while (iter
!= types
.end()) {
1097 checkType(manager
, b2u(*iter
), interfaces
, services
, properties
);
1101 OUString sAddinService
;
1102 if (services
.size() != 1) {
1103 throw CannotDumpException(
1104 "for calc add-in components one and only one service type is necessary!"
1105 " Please reference a valid type with the '-t' option.");
1109 // get the one and only add-in service for later use
1110 std::set
< OUString
>::const_iterator iter2
= services
.begin();
1111 sAddinService
= *iter2
;
1112 if (sAddinService
.equals("com.sun.star.sheet.AddIn")) {
1113 sAddinService
= *(++iter2
);
1116 // if backwardcompatible==true the AddIn service needs to be added to the
1117 // suported service list, the necessary intefaces are mapped to the add-in
1118 // configuration. Since OO.org 2.0.4 this is obsolete and the add-in is
1119 // take form the configuration from Calc directly, this simplifies the
1121 if (options
.backwardcompatible
) {
1122 checkType(manager
, "com.sun.star.sheet.AddIn",
1123 interfaces
, services
, properties
);
1125 // special case for the optional XLocalization interface. It should be
1126 // implemented always. But it is parent of the XAddIn and we need it only
1127 // if backwardcompatible is false.
1128 if (interfaces
.find("com.sun.star.lang.XLocalizable") == interfaces
.end()) {
1129 interfaces
.insert("com.sun.star.lang.XLocalizable");
1133 OUString propertyhelper
= checkPropertyHelper(
1134 options
, manager
, services
, interfaces
, attributes
, propinterfaces
);
1136 if (!propertyhelper
.isEmpty())
1137 std::cerr
<< "WARNING: interfaces specifying calc add-in functions "
1138 "shouldn't support attributes!\n";
1140 checkDefaultInterfaces(interfaces
, services
, propertyhelper
);
1142 if (interfaces
.size() > 12) {
1143 throw CannotDumpException(
1144 "the skeletonmaker supports components with 12 interfaces "
1145 "only (limitation of the UNO implementation helpers)!");
1148 // check if service object or simple UNO object
1149 if (!services
.empty())
1150 serviceobject
= true;
1152 supportxcomponent
= checkXComponentSupport(manager
, interfaces
);
1153 if (supportxcomponent
)
1154 std::cerr
<< "WARNING: add-ins shouldn't support "
1155 "com.sun.star.uno.XComponent!\n";
1157 OString compFileName
;
1158 OString tmpFileName
;
1159 std::ostream
* pofs
= NULL
;
1160 bool standardout
= getOutputStream(options
, ".cxx",
1161 &pofs
, compFileName
, tmpFileName
);
1164 if (!standardout
&& options
.license
) {
1165 printLicenseHeader(*pofs
, compFileName
);
1168 generateIncludes(*pofs
, interfaces
, propertyhelper
, serviceobject
,
1172 "#include \"com/sun/star/beans/PropertyValue.hpp\"\n"
1173 "#include \"com/sun/star/beans/XPropertySet.hpp\"\n"
1174 "#include \"com/sun/star/container/XNameAccess.hpp\"\n"
1175 "#include \"com/sun/star/container/XHierarchicalNameAccess.hpp\"\n\n"
1176 "#include \"rtl/ustrbuf.hxx\"\n\n"
1177 "#include <boost/unordered_map.hpp>\n"
1181 OString
nmspace(generateCompHelperDeclaration(*pofs
, options
.implname
));
1184 "\n\n// anonymous implementation namespace\nnamespace {\n\n"
1185 "namespace css = ::com::sun::star;\n\n";
1187 sal_Int32 index
= 0;
1188 OString
classname(options
.implname
);
1189 if ((index
= classname
.lastIndexOf('.')) > 0) {
1190 classname
= classname
.copy(index
+1);
1193 if (options
.backwardcompatible
) {
1194 *pofs
<< "static const char * sADDIN_SERVICENAME = \""
1195 << sAddinService
<< "\";\n\n";
1196 *pofs
<< "static const char * sDISPLAYNAME = \"DisplayName\";\n"
1197 "static const char * sDESCRIPTION = \"Description\";\n"
1198 "static const char * sCATEGORY = \"Category\";\n"
1199 "static const char * sCATEGORYDISPLAYNAME = \"CategoryDisplayName\";"
1204 generateClassDefinition(*pofs
,
1205 options
, manager
, classname
, interfaces
, properties
,
1206 attributes
, propinterfaces
, propertyhelper
, supportxcomponent
));
1208 generateQueryInterface(*pofs
, options
, manager
, interfaces
, parentname
,
1209 classname
, propertyhelper
);
1211 generateMethodBodies(*pofs
, options
, manager
, interfaces
, classname
,
1212 nmspace
, propertyhelper
);
1215 *pofs
<< "} // closing anonymous implementation namespace\n\n";
1217 generateCompHelperDefinition(*pofs
, options
.implname
, classname
,
1220 generateCompFunctions(*pofs
, nmspace
);
1222 if ( !standardout
&& pofs
&& ((std::ofstream
*)pofs
)->is_open()) {
1223 ((std::ofstream
*)pofs
)->close();
1225 OSL_VERIFY(makeValidTypeFile(compFileName
, tmpFileName
, sal_False
));
1227 } catch (CannotDumpException
& e
) {
1228 std::cerr
<< "ERROR: " << e
.getMessage() << "\n";
1229 if ( !standardout
) {
1230 if (pofs
&& ((std::ofstream
*)pofs
)->is_open()) {
1231 ((std::ofstream
*)pofs
)->close();
1234 // remove existing type file if something goes wrong to ensure
1236 if (fileExists(compFileName
))
1237 removeTypeFile(compFileName
);
1239 // remove tmp file if something goes wrong
1240 removeTypeFile(tmpFileName
);
1248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */