diff options
Diffstat (limited to 'unodevtools/source')
-rw-r--r-- | unodevtools/source/skeletonmaker/cppcompskeleton.cxx | 184 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cpptypemaker.cxx | 110 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javacompskeleton.cxx | 94 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javatypemaker.cxx | 78 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncommon.cxx | 66 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncommon.hxx | 10 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletoncpp.hxx | 2 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletonjava.hxx | 2 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/skeletonmaker.cxx | 34 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/options.cxx | 2 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/typeblob.cxx | 260 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/typemanager.cxx | 68 |
12 files changed, 455 insertions, 455 deletions
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx index d76af17fba09..f78325f334f4 100644 --- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -56,13 +56,13 @@ void generateIncludes(std::ostream & o, o << "#include \"cppuhelper/basemutex.hxx\"\n"; } else { o << "#include \"cppuhelper/implbase" << interfaces.size() << ".hxx\"\n"; - } + } if (propertyhelper.getLength() > 1) { if (propertyhelper.equals("_")) o << "#include \"cppuhelper/rpopshlp.hxx\"\n"; else - o << "#include \"cppuhelper/propertysetmixin.hxx\"\n"; + o << "#include \"cppuhelper/propertysetmixin.hxx\"\n"; } std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); @@ -72,7 +72,7 @@ void generateIncludes(std::ostream & o, << ((*iter).replace('.', '/').getStr()) << ".hpp\"\n"; iter++; - } + } } short generateNamespace(std::ostream & o, @@ -127,7 +127,7 @@ OString generateCompHelperDeclaration(std::ostream & o, short nbrackets = generateNamespace(o, implname, true, nm); o << "namespace css = ::com::sun::star;\n\n"; - + // generate component/service helper functions o << "// component and service helper functions:\n" "::rtl::OUString SAL_CALL _getImplementationName();\n" @@ -141,18 +141,18 @@ OString generateCompHelperDeclaration(std::ostream & o, for (short i=0; i < nbrackets; i++) o << "} "; o << "// closing component helper namespace\n\n"; - + return nm; } void generateCompHelperDefinition(std::ostream & o, const OString & implname, - const OString & classname, + const OString & classname, const std::hash_set< OString, OStringHash >& services) { OString nm; short nbrackets = generateNamespace(o, implname, true, nm); - + o << "::rtl::OUString SAL_CALL _getImplementationName() {\n" << " return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n" << " \"" << implname << "\"));\n}\n\n"; @@ -169,7 +169,7 @@ void generateCompHelperDefinition(std::ostream & o, << "RTL_CONSTASCII_USTRINGPARAM(\n \"" << (*iter).replace('/','.') << "\"));\n"; iter++; - } + } o << " return s;\n}\n\n"; o << "css::uno::Reference< css::uno::XInterface > SAL_CALL _create(" @@ -182,7 +182,7 @@ void generateCompHelperDefinition(std::ostream & o, for (short j=0; j < nbrackets; j++) o << "} "; o << "// closing component helper namespace\n\n"; - + } void generateCompFunctions(std::ostream & o, const OString & nmspace) @@ -214,7 +214,7 @@ void generateXPropertySetBodies(std::ostream& o, const OString & propertyhelper) { o << "// com.sun.star.beans.XPropertySet:\n"; - + o << "css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL " << classname << "getPropertySetInfo() throw (" "css::uno::RuntimeException)\n{\n return ::cppu::PropertySetMixin< " @@ -265,7 +265,7 @@ void generateXPropertySetBodies(std::ostream& o, "css::uno::RuntimeException, css::beans::UnknownPropertyException, " "css::lang::WrappedTargetException)\n{\n ::cppu::PropertySetMixin< " << propertyhelper - << " >::removeVetoableChangeListener(aPropertyName, xListener);\n}\n\n"; + << " >::removeVetoableChangeListener(aPropertyName, xListener);\n}\n\n"; } void generateXFastPropertySetBodies(std::ostream& o, @@ -279,14 +279,14 @@ void generateXFastPropertySetBodies(std::ostream& o, "css::beans::UnknownPropertyException, css::beans::PropertyVetoException, " "css::lang::IllegalArgumentException, css::lang::WrappedTargetException, " "css::uno::RuntimeException)\n{\n ::cppu::PropertySetMixin< " - << propertyhelper << " >::setFastPropertyValue(nHandle, aValue);\n}\n\n"; - + << propertyhelper << " >::setFastPropertyValue(nHandle, aValue);\n}\n\n"; + o << "css::uno::Any SAL_CALL " << classname << "getFastPropertyValue( " "::sal_Int32 nHandle ) throw (css::beans::UnknownPropertyException, " "css::lang::WrappedTargetException, css::uno::RuntimeException)\n{\n" " return ::cppu::PropertySetMixin< " - << propertyhelper << " >::getFastPropertyValue(nHandle);\n}\n\n"; + << propertyhelper << " >::getFastPropertyValue(nHandle);\n}\n\n"; } void generateXPropertyAccessBodies(std::ostream& o, @@ -299,15 +299,15 @@ void generateXPropertyAccessBodies(std::ostream& o, << classname << "getPropertyValues( ) throw (" "::com::sun::star::uno::RuntimeException)\n{\n" " return ::cppu::PropertySetMixin< " - << propertyhelper << " >::getPropertyValues();\n}\n\n"; - + << propertyhelper << " >::getPropertyValues();\n}\n\n"; + o << "void SAL_CALL " << classname << "setPropertyValues( const " "css::uno::Sequence< css::beans::PropertyValue >& aProps ) throw (" "css::beans::UnknownPropertyException, css::beans::PropertyVetoException, " "css::lang::IllegalArgumentException, css::lang::WrappedTargetException, " "css::uno::RuntimeException)\n{\n" " ::cppu::PropertySetMixin< " - << propertyhelper << " >::setPropertyValues(aProps);\n}\n\n"; + << propertyhelper << " >::setPropertyValues(aProps);\n}\n\n"; } void generateXLocalizable(std::ostream& o, const OString & classname) @@ -435,12 +435,12 @@ void generateXDispatch(std::ostream& o, "void SAL_CALL " << classname << "dispatch( const css::util::URL& aURL, const " "css::uno::Sequence< css::beans::PropertyValue >& aArguments ) throw" "(css::uno::RuntimeException)\n{\n"; - + ProtocolCmdMap::const_iterator iter = protocolCmdMap.begin(); while (iter != protocolCmdMap.end()) { o << " if ( aURL.Protocol.equalsAscii(\"" << (*iter).first << "\") == 0 )\n {\n"; - + for (std::vector< OString >::const_iterator i = (*iter).second.begin(); i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.equalsAscii(\"" << (*i) << "\") )\n" @@ -452,13 +452,13 @@ void generateXDispatch(std::ostream& o, iter++; } o << "}\n\n"; - + // addStatusListener o << "void SAL_CALL " << classname << "addStatusListener( const css::uno::Reference< " "css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) " "throw (css::uno::RuntimeException)\n{\n" " // add your own code here\n}\n\n"; - + // removeStatusListener o << "void SAL_CALL " << classname << "removeStatusListener( const css::uno::Reference" "< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) " @@ -485,7 +485,7 @@ void generateXDispatchProvider(std::ostream& o, while (iter != protocolCmdMap.end()) { o << " if ( aURL.Protocol.equalsAscii(\"" << (*iter).first << "\") == 0 )\n {\n"; - + for (std::vector< OString >::const_iterator i = (*iter).second.begin(); i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.equalsAscii(\"" << (*i) << "\") == 0 )\n" @@ -511,7 +511,7 @@ void generateXDispatchProvider(std::ostream& o, " seqDescripts[i].SearchFlags );\n" " }\n\n return lDispatcher;\n}\n\n"; } - + void generateAddinConstructorAndHelper(std::ostream& o, ProgramOptions const & options, TypeManager const & manager, const OString & classname, @@ -525,17 +525,17 @@ void generateAddinConstructorAndHelper(std::ostream& o, o << " try {\n"; generateFunctionParameterMap(o, options, manager, interfaces); - + o << " css::uno::Reference< css::lang::XMultiServiceFactory > xProvider" "(\n m_xContext->getServiceManager()->createInstanceWithContext" "(\n ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n " " \"com.sun.star.configuration.ConfigurationProvider\"))," "\n m_xContext ), css::uno::UNO_QUERY );\n\n"; - + o << " ::rtl::OUString sReadOnlyView(\n" " RTL_CONSTASCII_USTRINGPARAM(\n" " \"com.sun.star.configuration.ConfigurationAccess\"));\n\n"; - + o << " ::rtl::OUStringBuffer sPath(::rtl::OUString::createFromAscii(\n" " \"/org.openoffice.Office.CalcAddIns/AddInInfo/\"));\n" " sPath.appendAscii(sADDIN_SERVICENAME);\n" @@ -546,7 +546,7 @@ void generateAddinConstructorAndHelper(std::ostream& o, " aArgument.Value <<= sPath.makeStringAndClear();\n\n" " css::uno::Sequence< css::uno::Any > aArguments(1);\n" " aArguments[0] <<= aArgument;\n\n"; - + o << " // create the default view using default UI locale\n" " css::uno::Reference< css::uno::XInterface > xIface =\n" " xProvider->createInstanceWithArguments(sReadOnlyView, " @@ -554,7 +554,7 @@ void generateAddinConstructorAndHelper(std::ostream& o, " m_xHAccess = css::uno::Reference<\n " "css::container::XHierarchicalNameAccess >(xIface, css::uno::UNO_QUERY);" "\n\n"; - + o << " // extend arguments to create a view for all locales to get " "simple\n // access to the compatibilityname property\n" " aArgument.Name = ::rtl::OUString::createFromAscii(\"locale\");\n" @@ -566,9 +566,9 @@ void generateAddinConstructorAndHelper(std::ostream& o, "aArguments);\n\n" " m_xCompAccess = css::uno::Reference<\n " "css::container::XHierarchicalNameAccess >(xIface, css::uno::UNO_QUERY);\n"; - + o << " }\n catch ( css::uno::Exception & ) {\n }\n}\n\n"; - + o << "// addin configuration property helper function:\n::rtl::OUString " "SAL_CALL " << classname << "::getAddinProperty(const ::rtl::OUString &" " funcName, const ::rtl::OUString & paramName, const char * propName) " @@ -627,7 +627,7 @@ void generateMemberDeclaration(std::ostream& o, o << " "; printType(o, options, manager, i->second.first.replace('.','/'), 1, false); - o << " m_" << i->first << ";\n"; + o << " m_" << i->first << ";\n"; } } @@ -643,7 +643,7 @@ OString generateClassDefinition(std::ostream& o, { OStringBuffer parentname(64); o << "class " << classname << ":\n"; - + if (!interfaces.empty()) { if (supportxcomponent) { parentname.append("::cppu::WeakComponentImplHelper"); @@ -656,7 +656,7 @@ OString generateClassDefinition(std::ostream& o, parentname.append(static_cast<sal_Int32>(interfaces.size())); o << " public ::cppu::WeakImplHelper" << interfaces.size() << "<"; } - + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while (iter != interfaces.end()) @@ -669,12 +669,12 @@ OString generateClassDefinition(std::ostream& o, o << ">"; } } - + if (propertyhelper.getLength() > 1) { o << ",\n public ::cppu::PropertySetMixin< " << scopedCppName(propertyhelper, false, true) << " >"; } - + o << "\n{\npublic:\n" << " explicit " << classname << "(" << "css::uno::Reference< css::uno::XComponentContext > const & context);\n\n"; @@ -687,7 +687,7 @@ OString generateClassDefinition(std::ostream& o, // << " static css::uno::Reference< css::uno::XInterface > SAL_CALL _create(" // << "\n css::uno::Reference< css::uno::XComponentContext > const & " // << "context);\n\n"; - + // overload queryInterface if (propertyhelper.getLength() > 1) { o << " // ::com::sun::star::uno::XInterface:\n" @@ -702,7 +702,7 @@ OString generateClassDefinition(std::ostream& o, interfaces.begin(); while (iter != interfaces.end()) { - buffer.append(scopedCppName(*iter, false, true)); + buffer.append(scopedCppName(*iter, false, true)); iter++; if (iter != interfaces.end()) buffer.append(", "); @@ -715,7 +715,7 @@ OString generateClassDefinition(std::ostream& o, o << " virtual void SAL_CALL release() throw ()\n { " << parent << "::release(); }\n\n"; } - + std::hash_set< OString, OStringHash >::const_iterator it = interfaces.begin(); codemaker::GeneratedTypeSet generated; @@ -726,7 +726,7 @@ OString generateClassDefinition(std::ostream& o, true, propertyhelper); it++; } - + o << "private:\n " << classname << "(const " << classname << " &); // not defined\n" << " " << classname << "& operator=(const " << classname << " &); // not defined\n\n" << " // destructor is private and will be called indirectly by the release call" @@ -739,8 +739,8 @@ OString generateClassDefinition(std::ostream& o, "rtl::OUStringHash > FunctionMap;\n\n" " ::rtl::OUString SAL_CALL getAddinProperty(const ::rtl::OUString & " "funcName, const ::rtl::OUString & paramName, const char * propName) " - "throw (css::uno::RuntimeException);\n\n"; - } + "throw (css::uno::RuntimeException);\n\n"; + } if (supportxcomponent) { o << " // overload WeakComponentImplHelperBase::disposing()\n" @@ -749,7 +749,7 @@ OString generateClassDefinition(std::ostream& o, " // disposed, do it here.\n" " virtual void SAL_CALL disposing();\n\n"; } - + // members o << " css::uno::Reference< css::uno::XComponentContext > m_xContext;\n"; if (!supportxcomponent && !attributes.empty()) @@ -773,7 +773,7 @@ OString generateClassDefinition(std::ostream& o, generateMemberDeclaration(o, options, manager, properties); generateMemberDeclaration(o, options, manager, attributes); - + // if (!properties.empty()) // { // AttributeInfo::const_iterator iter = properties.begin(); @@ -782,7 +782,7 @@ OString generateClassDefinition(std::ostream& o, // o << " "; // printType(o, options, manager, iter->second.first.replace('.','/'), // 1, false); -// o << " m_" << iter->first << ";\n"; +// o << " m_" << iter->first << ";\n"; // iter++; // } // } @@ -794,18 +794,18 @@ OString generateClassDefinition(std::ostream& o, // o << " "; // printType(o, options, manager, iter->second.first.replace('.','/'), // 1, false); -// o << " m_" << iter->first << ";\n"; +// o << " m_" << iter->first << ";\n"; // iter++; // } // } - + o << "};\n\n"; - + // generate constructor if (options.componenttype == 2) { generateAddinConstructorAndHelper(o, options, manager, classname, interfaces); - } else { + } else { o << classname << "::" << classname << "(css::uno::Reference< css::uno::XComponentContext > const & context) :\n"; if (supportxcomponent) { @@ -819,7 +819,7 @@ OString generateClassDefinition(std::ostream& o, o << ","; else o << ">(m_aMutex),\n"; - } + } } if (propertyhelper.getLength() > 1) { o << " ::cppu::PropertySetMixin< " @@ -827,7 +827,7 @@ OString generateClassDefinition(std::ostream& o, << " context, static_cast< Implements >(\n "; OStringBuffer buffer(128); if (propinterfaces.find("com/sun/star/beans/XPropertySet") - != propinterfaces.end()) { + != propinterfaces.end()) { buffer.append("IMPLEMENTS_PROPERTY_SET"); } if (propinterfaces.find("com/sun/star/beans/XFastPropertySet") @@ -851,7 +851,7 @@ OString generateClassDefinition(std::ostream& o, generateMemberInitialization(o, options, manager, properties); generateMemberInitialization(o, options, manager, attributes); - + o << "\n{}\n\n"; } @@ -865,7 +865,7 @@ OString generateClassDefinition(std::ostream& o, "// disposed, do it here.\n" "void SAL_CALL " << classname << "::disposing()\n{\n\n}\n\n"; } - + return parentname.makeStringAndClear(); } @@ -882,7 +882,7 @@ void generateXServiceInfoBodies(std::ostream& o, << "supportsService(::rtl::OUString const & " << "serviceName) throw (css::uno::RuntimeException)\n{\n " << "css::uno::Sequence< ::rtl::OUString > serviceNames = " - << comphelpernamespace << "::_getSupportedServiceNames();\n " + << comphelpernamespace << "::_getSupportedServiceNames();\n " << "for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {\n " << " if (serviceNames[i] == serviceName)\n return sal_True;\n" << " }\n return sal_False;\n}\n\n"; @@ -890,12 +890,12 @@ void generateXServiceInfoBodies(std::ostream& o, o << "css::uno::Sequence< ::rtl::OUString > SAL_CALL " << classname << "getSupportedServiceNames() throw (css::uno::RuntimeException)\n{\n " << "return " << comphelpernamespace - << "::_getSupportedServiceNames();\n}\n\n"; + << "::_getSupportedServiceNames();\n}\n\n"; } void generateMethodBodies(std::ostream& o, - ProgramOptions const & options, + ProgramOptions const & options, TypeManager const & manager, std::hash_set< OString, OStringHash > const & interfaces, OString const & classname, @@ -920,7 +920,7 @@ void generateMethodBodies(std::ostream& o, } void generateQueryInterface(std::ostream& o, - ProgramOptions const & options, + ProgramOptions const & options, TypeManager const & manager, const std::hash_set< OString, OStringHash >& interfaces, OString const & parentname, @@ -929,7 +929,7 @@ void generateQueryInterface(std::ostream& o, { if (propertyhelper.getLength() == 0) return; - + o << "css::uno::Any " << classname << "::queryInterface(css::uno::Type const & type) throw (" "css::uno::RuntimeException)\n{\n "; @@ -962,9 +962,9 @@ void generateQueryInterface(std::ostream& o, } else { o << "::cppu::PropertySetMixin<\n "; printType(o, options, manager, propertyhelper.replace('.', '/'), - 0, false); + 0, false); o << " >::queryInterface(\n type));\n"; - } + } } o << "}\n\n"; } @@ -979,7 +979,7 @@ void generateSkeleton(ProgramOptions const & options, generateCalcAddin(options, manager, types); return; } - + std::hash_set< OString, OStringHash > interfaces; std::hash_set< OString, OStringHash > services; AttributeInfo properties; @@ -1002,23 +1002,23 @@ void generateSkeleton(ProgramOptions const & options, checkType(manager, "com.sun.star.frame.ProtocolHandler", interfaces, services, properties); checkType(manager, "com.sun.star.frame.XDispatch", - interfaces, services, properties); + interfaces, services, properties); } - + // check if service object or simple UNO object if (!services.empty()) serviceobject = true; - + OString propertyhelper = checkPropertyHelper( options, manager, services, interfaces, attributes, propinterfaces); checkDefaultInterfaces(interfaces, services, propertyhelper); - + if (interfaces.size() > 12) throw CannotDumpException( "the skeletonmaker supports components with 12 interfaces " "only (limitation of the UNO implementation helpers)!"); - + supportxcomponent = checkXComponentSupport(manager, interfaces); @@ -1032,7 +1032,7 @@ void generateSkeleton(ProgramOptions const & options, if (!standardout && options.license) { printLicenseHeader(*pofs, compFileName); } - + generateIncludes(*pofs, interfaces, properties, propertyhelper, serviceobject, supportxcomponent); @@ -1054,7 +1054,7 @@ void generateSkeleton(ProgramOptions const & options, nm = generateNamespace(*pofs, options.implname, false, nmspace); *pofs << "namespace css = ::com::sun::star;\n\n"; } - + sal_Int32 index = 0; OString classname(options.implname); if ((index = classname.lastIndexOf('.')) > 0) @@ -1067,14 +1067,14 @@ void generateSkeleton(ProgramOptions const & options, generateQueryInterface(*pofs, options, manager, interfaces, parentname, classname, propertyhelper); - + generateMethodBodies(*pofs, options, manager, interfaces, classname, nmspace, propertyhelper); if (serviceobject) { // close namepsace *pofs << "} // closing anonymous implementation namespace\n\n"; - + generateCompHelperDefinition(*pofs, options.implname, classname, services); generateCompFunctions(*pofs, nmspace); @@ -1092,17 +1092,17 @@ void generateSkeleton(ProgramOptions const & options, } } catch(CannotDumpException& e) { - std::cerr << "ERROR: " << e.m_message.getStr() << "\n"; + std::cerr << "ERROR: " << e.m_message.getStr() << "\n"; if ( !standardout ) { if (pofs && ((std::ofstream*)pofs)->is_open()) { - ((std::ofstream*)pofs)->close(); + ((std::ofstream*)pofs)->close(); delete pofs; } // remove existing type file if something goes wrong to ensure // consistency if (fileExists(compFileName)) removeTypeFile(compFileName); - + // remove tmp file if something goes wrong removeTypeFile(tmpFileName); } @@ -1121,28 +1121,28 @@ void generateCalcAddin(ProgramOptions const & options, bool serviceobject = false; bool supportxcomponent = false; - + std::vector< OString >::const_iterator iter = types.begin(); while (iter != types.end()) { checkType(manager, *iter, interfaces, services, properties); iter++; } - + OString sAddinService; if (services.size() != 1) { throw CannotDumpException( "for calc add-in components one and only one service type is necessary!" " Please reference a valid type with the '-t' option."); } - - + + // get the one and only add-in service for later use std::hash_set< OString, OStringHash >::const_iterator iter2 = services.begin(); sAddinService = (*iter2).replace('/', '.'); if (sAddinService.equals("com.sun.star.sheet.AddIn")) { sAddinService = (*(++iter2)).replace('/', '.'); } - + // if backwardcompatible==true the AddIn service needs to be added to the // suported service list, the necessary intefaces are mapped to the add-in // configuration. Since OO.org 2.0.4 this is obsolete and the add-in is @@ -1158,17 +1158,17 @@ void generateCalcAddin(ProgramOptions const & options, if (interfaces.find("com.sun.star.lang.XLocalizable") == interfaces.end()) { interfaces.insert("com.sun.star.lang.XLocalizable"); } - } - + } + OString propertyhelper = checkPropertyHelper( options, manager, services, interfaces, attributes, propinterfaces); if (propertyhelper.getLength() > 0) std::cerr << "WARNING: interfaces specifying calc add-in functions " "shouldn't support attributes!\n"; - + checkDefaultInterfaces(interfaces, services, propertyhelper); - + if (interfaces.size() > 12) { throw CannotDumpException( "the skeletonmaker supports components with 12 interfaces " @@ -1189,12 +1189,12 @@ void generateCalcAddin(ProgramOptions const & options, std::ostream* pofs = NULL; bool standardout = getOutputStream(options, ".cxx", &pofs, compFileName, tmpFileName); - + try { if (!standardout && options.license) { printLicenseHeader(*pofs, compFileName); } - + generateIncludes(*pofs, interfaces, properties, propertyhelper, serviceobject, supportxcomponent); @@ -1206,7 +1206,7 @@ void generateCalcAddin(ProgramOptions const & options, "#include \"rtl/ustrbuf.hxx\"\n\n" "#include <hash_map>\n" "#include <set>\n"; - + // namespace OString nmspace(generateCompHelperDeclaration(*pofs, options.implname)); @@ -1229,7 +1229,7 @@ void generateCalcAddin(ProgramOptions const & options, "static const char * sCATEGORYDISPLAYNAME = \"CategoryDisplayName\";" "\n\n"; } - + OString parentname( generateClassDefinition(*pofs, options, manager, classname, interfaces, properties, @@ -1237,18 +1237,18 @@ void generateCalcAddin(ProgramOptions const & options, generateQueryInterface(*pofs, options, manager, interfaces, parentname, classname, propertyhelper); - + generateMethodBodies(*pofs, options, manager, interfaces, classname, nmspace, propertyhelper); - + // close namepsace *pofs << "} // closing anonymous implementation namespace\n\n"; generateCompHelperDefinition(*pofs, options.implname, classname, services); - + generateCompFunctions(*pofs, nmspace); - + if ( !standardout && pofs && ((std::ofstream*)pofs)->is_open()) { ((std::ofstream*)pofs)->close(); delete pofs; @@ -1259,14 +1259,14 @@ void generateCalcAddin(ProgramOptions const & options, std::cerr << "ERROR: " << e.m_message.getStr() << "\n"; if ( !standardout ) { if (pofs && ((std::ofstream*)pofs)->is_open()) { - ((std::ofstream*)pofs)->close(); + ((std::ofstream*)pofs)->close(); delete pofs; } // remove existing type file if something goes wrong to ensure // consistency if (fileExists(compFileName)) removeTypeFile(compFileName); - + // remove tmp file if something goes wrong removeTypeFile(tmpFileName); } diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx index 15ae7ae95988..9c6e3eafe108 100644 --- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx +++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -87,7 +87,7 @@ void printType(std::ostream & o, { bReference = true; } - + if (bReference && referenceType == 4) o << "const "; @@ -103,7 +103,7 @@ void printType(std::ostream & o, o << scopedCppName(codemaker::cpp::translateUnoToCppType( sort, typeClass, name, false), false, options.shortnames && referenceType > 0); - + if (typeClass == RT_TYPE_INTERFACE && referenceType > 0) o << " >"; @@ -114,12 +114,12 @@ void printType(std::ostream & o, { if (i != arguments.begin()) o << ", "; - + printType(o, options, manager, *i, 1, false); } o << " >"; } - + for (sal_Int32 i = 0; i < rank; ++i) o << " >"; @@ -162,11 +162,11 @@ bool printConstructorParameters(std::ostream & o, options, manager, superReader, outerReader, arguments); } for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) { - if (previous) + if (previous) o << ", "; else previous = true; - + if ((reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) == 0) { printType(o, options, manager, codemaker::convertString(reader.getFieldTypeName(i)), 4); @@ -234,7 +234,7 @@ void printMethodParameters(std::ostream & o, referenceType); o << ' '; } - + o << (codemaker::cpp::translateUnoToCppIdentifier( codemaker::convertString( reader.getMethodParameterName(method, i)), @@ -270,7 +270,7 @@ void printSetPropertyMixinBody(std::ostream & o, bool bound = (reader.getFieldFlags(field) & RT_ACCESS_BOUND ? true : false); o << "\n{\n"; - + if (bound) o << " BoundListeners l;\n"; @@ -301,22 +301,22 @@ void printSetPropertyMixinBody(std::ostream & o, buffer2.insert(0, t); buffer2.append(".Value"); } - } else { + } else { if (single) { single=false; - if (!optional) + if (!optional) buffer1.append("the_value.Value"); - + buffer2.append("the_value.Value"); } else { if (!optional) { buffer1.insert(0, t); - buffer1.append(".Value"); + buffer1.append(".Value"); } buffer2.insert(0, t); - buffer2.append(".Value"); + buffer2.append(".Value"); } - } + } } while( nPos <= index ); o << " css::uno::Any v;\n"; @@ -333,18 +333,18 @@ void printSetPropertyMixinBody(std::ostream & o, o << " prepareSet(\n rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" << fieldname << "\")),\n css::uno::Any(), css::uno::Any(), "; } - + if (bound) o << "&l);\n"; else o << "0);\n"; - + o << " {\n osl::MutexGuard g(m_aMutex);\n m_" << fieldname << " = the_value;\n }\n"; if (bound) o << " l.notify();\n"; - + o << "}\n\n"; } @@ -385,8 +385,8 @@ void printMethods(std::ostream & o, OString type(codemaker::convertString(reader.getTypeName())); if (generated.contains(type) || type.equals("com/sun/star/uno/XInterface") || (defaultvalue && - ( type.equals("com/sun/star/lang/XComponent") || - type.equals("com/sun/star/lang/XTypeProvider") || + ( type.equals("com/sun/star/lang/XComponent") || + type.equals("com/sun/star/lang/XTypeProvider") || type.equals("com/sun/star/uno/XWeak")) ) ) { return; @@ -460,7 +460,7 @@ void printMethods(std::ostream & o, return; } } - + generated.add(type); if (options.all || defaultvalue) { for (sal_uInt16 i = 0; i < reader.getSuperTypeCount(); ++i) { @@ -473,13 +473,13 @@ void printMethods(std::ostream & o, "Bad type library entity " + codemaker::convertString( reader.getSuperTypeName(i))); - } + } OString stype(codemaker::convertString(super.getTypeName())); printMethods(o, options, manager, super, generated, delegate, classname, indentation, defaultvalue, propertyhelper); } - + if (reader.getFieldCount() > 0 || reader.getMethodCount() > 0) { o << indentation << "// "; printType(o, options, manager, type, 0); @@ -491,13 +491,13 @@ void printMethods(std::ostream & o, o << indentation; if (!body) o << "virtual "; - + printType(o, options, manager, codemaker::convertString(reader.getFieldTypeName(i)), 1); o << " SAL_CALL "; if (classname.getLength() > 0) o << classname; - + o << "get" << codemaker::convertString(reader.getFieldName(i)).getStr() << "()"; @@ -506,7 +506,7 @@ void printMethods(std::ostream & o, && reader.getMethodName(method) == reader.getFieldName(i)) { printExceptionSpecification(o, options, manager, reader, method++); - } else { + } else { o << ((options.shortnames) ? " throw (css::uno::RuntimeException)" : " throw (::com::sun::star::uno::RuntimeException)"); } @@ -539,16 +539,16 @@ void printMethods(std::ostream & o, } else { o << ";\n"; } - + if ((reader.getFieldFlags(i) & RT_ACCESS_READONLY) == 0) { o << indentation; if (!body) o << "virtual "; - + o << "void SAL_CALL "; if (classname.getLength() > 0) o << classname; - + o << "set" << (codemaker::convertString(reader.getFieldName(i)).getStr()) << '('; @@ -593,7 +593,7 @@ void printMethods(std::ostream & o, o << indentation; if (!body) o << "virtual "; - + printType(o, options, manager, codemaker::convertString( reader.getMethodReturnTypeName(method)), 1); @@ -633,7 +633,7 @@ void printMethods(std::ostream & o, o << "\n" << indentation << "{\n" << indentation << " "; if (!reader.getMethodReturnTypeName(method).equals(s)) o << "return "; - + o << delegate.getStr() << (codemaker::convertString( reader.getMethodName(method)).getStr()) @@ -689,7 +689,7 @@ void printServiceMembers(std::ostream & o, OString referenceType( codemaker::convertString( reader.getReferenceTypeName(i)).replace('/', '.')); - + if ( reader.getReferenceSort(i) == RT_REF_SUPPORTS ) { o << "\n// supported interface " << referenceType.getStr() << "\n"; generateDocumentation(o, options, manager, referenceType, delegate); @@ -707,13 +707,13 @@ void printServiceMembers(std::ostream & o, codemaker::convertString(reader.getFieldName(i))); OString fieldType( codemaker::convertString(reader.getFieldTypeName(i))); - + o << "// private "; printType(o, options, manager, fieldType, 1); o << " " << codemaker::cpp::translateUnoToCppIdentifier( fieldName, "property").getStr() - << ";\n"; + << ";\n"; } } } @@ -727,7 +727,7 @@ void printMapsToCppType(std::ostream & o, o << "maps to C++ "; if (cppTypeSort != 0) o << cppTypeSort << ' '; - + o << "type \""; if (rank == 0 && name == "com/sun/star/uno/XInterface") { o << "Reference< com::sun::star::uno::XInterface >"; @@ -762,7 +762,7 @@ void generateDocumentation(std::ostream & o, } comment=false; } - + if (comment) { o << "\n// UNO"; if (rank > 0) { @@ -771,19 +771,19 @@ void generateDocumentation(std::ostream & o, o << " simple type"; } else { typereg::Reader reader(manager.getTypeReader(name)); - if (!reader.isValid()) + if (!reader.isValid()) throw CannotDumpException("Bad type library entity " + name); - + switch (typeClass) { case RT_TYPE_INTERFACE: o << " interface type"; break; - + case RT_TYPE_MODULE: o << "IDL module"; break; - + case RT_TYPE_STRUCT: if (reader.getReferenceCount() == 0) o << " simple struct type"; @@ -792,15 +792,15 @@ void generateDocumentation(std::ostream & o, else o << " instantiated polymorphic struct type"; break; - + case RT_TYPE_ENUM: o << " enum type"; break; - + case RT_TYPE_EXCEPTION: o << " exception type"; break; - + case RT_TYPE_TYPEDEF: o << "IDL typedef"; break; @@ -811,7 +811,7 @@ void generateDocumentation(std::ostream & o, else o << "IDL accumulation-based service"; break; - + case RT_TYPE_SINGLETON: if ((manager.getTypeReader( codemaker::convertString( @@ -821,16 +821,16 @@ void generateDocumentation(std::ostream & o, else o << "IDL service-based singleton"; break; - + case RT_TYPE_CONSTANTS: o << "IDL constant group"; break; - + default: OSL_ASSERT(false); break; } - } + } o << " \"" << type.getStr() << "\" "; } sort = codemaker::decomposeAndResolve( @@ -838,21 +838,21 @@ void generateDocumentation(std::ostream & o, &arguments); if (rank > 0) { if (comment) { - printMapsToCppType(o, + printMapsToCppType(o, options, manager, sort, typeClass, name, rank, arguments, "array"); o << '\n'; } } else if (sort != codemaker::UnoType::SORT_COMPLEX) { if (comment) { - printMapsToCppType(o, + printMapsToCppType(o, options, manager, sort, typeClass, name, rank, arguments, 0); o << '\n'; } } else { typereg::Reader reader(manager.getTypeReader(name)); - if (!reader.isValid()) + if (!reader.isValid()) throw CannotDumpException("Bad type library entity " + name); - + switch (typeClass) { case RT_TYPE_INTERFACE: @@ -861,12 +861,12 @@ void generateDocumentation(std::ostream & o, options, manager, sort, typeClass, name, rank, arguments, "interface"); if (name == "com/sun/star/uno/XInterface") { - if (comment) + if (comment) o << '\n'; } else { if (comment) o << "; " << (options.all ? "all" : "direct") << " methods:\n"; - + codemaker::GeneratedTypeSet generated; printMethods(o, options, manager, reader, generated, delegate, options.implname, ""); @@ -874,7 +874,7 @@ void generateDocumentation(std::ostream & o, break; case RT_TYPE_MODULE: - printMapsToCppType(o, + printMapsToCppType(o, options, manager, sort, typeClass, name, rank, arguments, "namespace"); o << '\n'; @@ -934,7 +934,7 @@ void generateDocumentation(std::ostream & o, reader.getSuperTypeName(0)).replace('/', '.')); generateDocumentation(o, options, manager, super, delegate); } else { - if (comment) + if (comment) o << ("does not map to C++\n" "// the service members are generated instead\n"); printServiceMembers(o, options, manager, reader, type, delegate); diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx index 5659066b0d1c..898b7d6c4068 100644 --- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -79,7 +79,7 @@ void generateImports(std::ostream & o, ProgramOptions const & options, } } - + // std::hash_set< OString, OStringHash >::const_iterator iter = // interfaces.begin(); // while (iter != interfaces.end()) @@ -104,7 +104,7 @@ void generateCompFunctions(std::ostream & o, const OString & classname) " return Factory.writeRegistryServiceInfo(m_implementationName,\n" " m_serviceNames,\n" " xRegistryKey);\n" - " }\n\n"; + " }\n\n"; } void generateXServiceInfoBodies(std::ostream& o) @@ -214,7 +214,7 @@ bool checkAttribute(OStringBuffer& attributeValue, sal_uInt16 attribute) /* com::sun::star::beans::PropertyValue::MAYBEAMBIGIOUS */ 32, /* com::sun::star::beans::PropertyValue::MAYBEDEFAULT */ 64, /* com::sun::star::beans::PropertyValue::REMOVEABLE */ 128, - /* com::sun::star::beans::PropertyValue::OPTIONAL */ 256 }; + /* com::sun::star::beans::PropertyValue::OPTIONAL */ 256 }; for (sal_uInt16 i = 0; i < 9; i++) { @@ -259,7 +259,7 @@ bool checkAttribute(OStringBuffer& attributeValue, sal_uInt16 attribute) attributeValue.insert(0, '('); attributeValue.append(')'); } - + return cast; } @@ -280,7 +280,7 @@ void registerProperties(std::ostream& o, cast = true; attributeValue.append('0'); } - + o << indentation << "registerProperty(\"" << i->first << "\", \"m_" << i->first << "\",\n" << indentation << " "; @@ -289,7 +289,7 @@ void registerProperties(std::ostream& o, o << attributeValue.makeStringAndClear() << ");\n"; } - } + } } void generateXLocalizableBodies(std::ostream& o) { @@ -357,7 +357,7 @@ void generateXAddInBodies(std::ostream& o, ProgramOptions const & options) "get(\n new Integer(nArgument))" ", sDISPLAYNAME);\n }\n\n"; } - + // getArgumentDescription o << " public String getArgumentDescription(String " "aProgrammaticFunctionName, int nArgument)\n {\n"; @@ -453,12 +453,12 @@ void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options) o << " // com.sun.star.frame.XDispatch:\n" " public void dispatch( com.sun.star.util.URL aURL,\n" " com.sun.star.beans.PropertyValue[] aArguments )\n {\n"; - + ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin(); while (iter != options.protocolCmdMap.end()) { o << " if ( aURL.Protocol.compareTo(\"" << (*iter).first << "\") == 0 )\n {\n"; - + for (std::vector< OString >::const_iterator i = (*iter).second.begin(); i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n" @@ -470,12 +470,12 @@ void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options) iter++; } o << " }\n\n"; - + // addStatusListener o << " public void addStatusListener( com.sun.star.frame.XStatusListener xControl,\n" " com.sun.star.util.URL aURL )\n {\n" " // add your own code here\n }\n\n"; - + // com.sun.star.frame.XDispatch o << " public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,\n" " com.sun.star.util.URL aURL )\n {\n" @@ -495,7 +495,7 @@ void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & opt while (iter != options.protocolCmdMap.end()) { o << " if ( aURL.Protocol.compareTo(\"" << (*iter).first << "\") == 0 )\n {\n"; - + for (std::vector< OString >::const_iterator i = (*iter).second.begin(); i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n" @@ -578,7 +578,7 @@ void generateMethodBodies(std::ostream& o, generated.add(type); continue; } - } + } typereg::Reader reader(manager.getTypeReader(type.replace('.','/'))); printMethods(o, options, manager, reader, generated, "_", indentation, true, usepropertymixin); @@ -608,16 +608,16 @@ void generateAddinConstructorAndHelper(std::ostream& o, " {\n m_xContext = context;\n }\n\n"; return; } - + // get the one and only add-in service for later use std::hash_set< OString, OStringHash >::const_iterator iter = services.begin(); OString sAddinService = (*iter).replace('/', '.'); if (sAddinService.equals("com.sun.star.sheet.AddIn")) { sAddinService = (*(++iter)).replace('/', '.'); - } - + } + // add-in specific fields o << "\n private static final String sADDIN_SERVICENAME = \"" << sAddinService << "\";\n\n"; @@ -651,7 +651,7 @@ void generateAddinConstructorAndHelper(std::ostream& o, } else { o << " m_functionMap = new java.util.Hashtable();\n\n"; } - + generateFunctionParameterMap(o, options, manager, interfaces); o << " com.sun.star.lang.XMultiServiceFactory xProvider = \n" @@ -676,7 +676,7 @@ void generateAddinConstructorAndHelper(std::ostream& o, " aArgument.Name = \"nodepath\";\n" " aArgument.Value = new com.sun.star.uno.Any(\n" " com.sun.star.uno.Type.STRING, sPath.toString());\n\n"; - + o << " Object aArguments[] = new Object[1];\n" " aArguments[0] = new com.sun.star.uno.Any(" " new com.sun.star.uno.Type(\n" @@ -734,7 +734,7 @@ void generateAddinConstructorAndHelper(std::ostream& o, " catch ( com.sun.star.uno.RuntimeException e ) {\n" " throw e;\n }\n" " catch ( com.sun.star.uno.Exception e ) {\n }\n" - " return \"\";\n }\n\n"; + " return \"\";\n }\n\n"; } @@ -767,7 +767,7 @@ void generateClassDefinition(std::ostream& o, iter++; if (iter != interfaces.end()) o << ",\n "; - } + } } o << "\n{\n"; @@ -777,11 +777,11 @@ void generateClassDefinition(std::ostream& o, if (options.componenttype == 3) { o << " private com.sun.star.frame.XFrame m_xFrame;\n"; } - + // check property helper if (propertyhelper.getLength() > 1) o << " private final PropertySetMixin m_prophlp;\n"; - + o << " private static final String m_implementationName = " << classname << ".class.getName();\n"; @@ -796,7 +796,7 @@ void generateClassDefinition(std::ostream& o, o << ",\n"; else o << " };\n\n"; - } + } } // attribute/property members @@ -808,13 +808,13 @@ void generateClassDefinition(std::ostream& o, o << " protected "; printType(o, options, manager, iter->second.first.replace('.','/'), false, false); - o << " m_" << iter->first << ";\n"; + o << " m_" << iter->first << ";\n"; iter++; } } else if (!attributes.empty()) { AttributeInfo::const_iterator iter = attributes.begin(); - o << " // attributes\n"; + o << " // attributes\n"; while (iter != attributes.end()) { o << " private "; printType(o, options, manager, iter->second.first.replace('.','/'), @@ -822,11 +822,11 @@ void generateClassDefinition(std::ostream& o, o << " m_" << iter->first << " = "; printType(o, options, manager, iter->second.first.replace('.','/'), false, true); - o <<";\n"; + o <<";\n"; iter++; } } - + // special handling of calc add-ins if (options.componenttype == 2) { @@ -846,15 +846,15 @@ void generateClassDefinition(std::ostream& o, } } o << " };\n\n"; - + } if (!services.empty()) generateCompFunctions(o, classname); - + generateMethodBodies(o, options, manager, interfaces, - " ", propertyhelper.getLength() > 1); - + " ", propertyhelper.getLength() > 1); + // end of class definition o << "}\n"; } @@ -887,12 +887,12 @@ void generateSkeleton(ProgramOptions const & options, interfaces, services, properties); checkType(manager, "com.sun.star.frame.XDispatch", interfaces, services, properties); - - + + // ProtocolCmdMap::const_iterator iter2 = options.protocolCmdMap.begin(); // while (iter2 != options.protocolCmdMap.end()) { // fprintf(stdout, "prt=%s\n", (*iter2).first.getStr()); - + // for (std::vector< OString >::const_iterator i = (*iter2).second.begin(); // i != (*iter2).second.end(); ++i) { // fprintf(stdout, "cmd=%s\n", (*i).getStr()); @@ -901,7 +901,7 @@ void generateSkeleton(ProgramOptions const & options, // } // return; } - + if (options.componenttype == 2) { if (services.size() != 1) { throw CannotDumpException( @@ -927,11 +927,11 @@ void generateSkeleton(ProgramOptions const & options, } } - + // check if service object or simple UNO object if (!services.empty()) - serviceobject = true; - + serviceobject = true; + OString propertyhelper = checkPropertyHelper( options, manager, services, interfaces, attributes, propinterfaces); checkDefaultInterfaces(interfaces, services, propertyhelper); @@ -941,7 +941,7 @@ void generateSkeleton(ProgramOptions const & options, std::cerr << "WARNING: interfaces specifying calc add-in functions " "shouldn't support attributes!\n"; } - + supportxcomponent = checkXComponentSupport(manager, interfaces); OString compFileName; @@ -954,7 +954,7 @@ void generateSkeleton(ProgramOptions const & options, if (!standardout && options.license) { printLicenseHeader(*pofs, compFileName); } - + generatePackage(*pofs, options.implname); generateImports(*pofs, options, interfaces, propertyhelper, @@ -967,8 +967,8 @@ void generateSkeleton(ProgramOptions const & options, generateClassDefinition(*pofs, options, manager, classname, services, interfaces, properties, attributes, propertyhelper, - supportxcomponent); - + supportxcomponent); + if ( !standardout && pofs && ((std::ofstream*)pofs)->is_open()) { ((std::ofstream*)pofs)->close(); delete pofs; @@ -976,21 +976,21 @@ void generateSkeleton(ProgramOptions const & options, } } catch(CannotDumpException& e) { - std::cerr << "ERROR: " << e.m_message.getStr() << "\n"; + std::cerr << "ERROR: " << e.m_message.getStr() << "\n"; if ( !standardout ) { if (pofs && ((std::ofstream*)pofs)->is_open()) { - ((std::ofstream*)pofs)->close(); + ((std::ofstream*)pofs)->close(); delete pofs; } // remove existing type file if something goes wrong to ensure // consistency if (fileExists(compFileName)) removeTypeFile(compFileName); - + // remove tmp file if something goes wrong removeTypeFile(tmpFileName); } - } + } } } } diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx index 9f49f66a8785..f69e474fa9ca 100644 --- a/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -209,7 +209,7 @@ void printMethodParameters(std::ostream & o, o << ", "; else previous = true; - + if ( withtype ) { printType(o, options, manager, codemaker::convertString( @@ -266,7 +266,7 @@ void printSetPropertyMixinBody(std::ostream & o, bool bound = (reader.getFieldFlags(field) & RT_ACCESS_BOUND ? true : false); o << "\n" << indentation << "{\n"; - + if ( bound ) { o << indentation << " PropertySetMixin.BoundListeners l = " "new PropertySetMixin.BoundListeners();\n\n"; @@ -289,7 +289,7 @@ void printSetPropertyMixinBody(std::ostream & o, OStringBuffer buffer(16); buffer.append("(("); buffer.append(s.copy(s.lastIndexOf('/')+1)); - buffer.append(')'); + buffer.append(')'); OString t = buffer.makeStringAndClear(); if ( t.equals("((Optional)") ) { @@ -304,22 +304,22 @@ void printSetPropertyMixinBody(std::ostream & o, buffer2.insert(0, t); buffer2.append(").Value"); } - } else { + } else { if ( single ) { single=false; if ( !optional ) { - buffer1.append("the_value.Value"); + buffer1.append("the_value.Value"); } buffer2.append("the_value.Value"); } else { if ( !optional ) { buffer1.insert(0, t); - buffer1.append(").Value"); + buffer1.append(").Value"); } buffer2.insert(0, t); - buffer2.append(").Value"); + buffer2.append(").Value"); } - } + } } while( nPos <= index ); o << "Any.VOID,\n" << indentation << " "; @@ -330,15 +330,15 @@ void printSetPropertyMixinBody(std::ostream & o, o << ") ? " << buffer2.makeStringAndClear() << " : Any.VOID,\n" << indentation << " "; else - o << ", "; + o << ", "; } - + if ( bound ) o << "l"; else o << "null"; - o << ");\n"; - + o << ");\n"; + o << indentation << " synchronized (this) {\n" << indentation << " m_" << fieldname << " = the_value;\n" << indentation << " }\n"; @@ -363,8 +363,8 @@ void printMethods(std::ostream & o, OString type(codemaker::convertString(reader.getTypeName())); if ( generated.contains(type) || type == "com/sun/star/uno/XInterface" || ( defaultvalue && - ( type.equals("com/sun/star/lang/XComponent") || - type.equals("com/sun/star/lang/XTypeProvider") || + ( type.equals("com/sun/star/lang/XComponent") || + type.equals("com/sun/star/lang/XTypeProvider") || type.equals("com/sun/star/uno/XWeak") ) ) ) { return; } @@ -384,11 +384,11 @@ void printMethods(std::ostream & o, return; } } - + static OString sd(RTL_CONSTASCII_STRINGPARAM("_")); bool body = ((delegate.getLength() > 0) ? true : false); bool defaultbody = ((delegate.equals(sd)) ? true : false); - + generated.add(type); if ( options.all || defaultvalue ) { for (sal_uInt16 i = 0; i < reader.getSuperTypeCount(); ++i) { @@ -422,7 +422,7 @@ void printMethods(std::ostream & o, // attributes.insert(StringPairHashMap::value_type(fieldName, // std::pair<OString, sal_Int16>( // fieldType, reader.getFieldFlags(i)))); - + o << indentation << "public "; printType(o, options, manager, @@ -475,7 +475,7 @@ void printMethods(std::ostream & o, << (codemaker::convertString(reader.getFieldName(i)). getStr()) << '('; - printType(o, + printType(o, options, manager, codemaker::convertString(reader.getFieldTypeName(i)), false); @@ -510,14 +510,14 @@ void printMethods(std::ostream & o, } for ( ; method < reader.getMethodCount(); ++method ) { o << indentation << "public "; - printType(o, + printType(o, options, manager, codemaker::convertString( reader.getMethodReturnTypeName(method)), false); - + const OString methodName(codemaker::convertString(reader.getMethodName(method))); - + o << ' ' << methodName.getStr() << '('; printMethodParameters(o, options, manager, reader, method, false, true); o << ')'; @@ -537,7 +537,7 @@ void printMethods(std::ostream & o, " in Java and C++\n" << indentation << " // polymorphic structs.\n" << indentation << " return "; - printType(o, + printType(o, options, manager, codemaker::convertString( reader.getMethodReturnTypeName(method)), @@ -604,7 +604,7 @@ void printServiceMembers(std::ostream & o, OString referenceType( codemaker::convertString( reader.getReferenceTypeName(i)).replace('/', '.')); - + if ( reader.getReferenceSort(i) == RT_REF_SUPPORTS ) { o << "\n// supported interface " << referenceType.getStr() << "\n"; generateDocumentation(o, options, manager, referenceType, delegate); @@ -626,7 +626,7 @@ void printServiceMembers(std::ostream & o, o << " " << codemaker::java::translateUnoToJavaIdentifier( fieldName, "property").getStr() - << ";\n"; + << ";\n"; } } @@ -644,7 +644,7 @@ void printMapsToJavaType(std::ostream & o, if ( rank == 0 && name == "com/sun/star/uno/XInterface" ) { o << "com.sun.star.uno.XInterface"; } else { - printType(o, + printType(o, options, manager, sort, typeClass, name, rank, arguments, false); } o << '"'; @@ -673,7 +673,7 @@ void generateDocumentation(std::ostream & o, comment=false; } - + if ( comment ) { o << "\n// UNO"; if ( rank > 0 ) { @@ -689,11 +689,11 @@ void generateDocumentation(std::ostream & o, case RT_TYPE_INTERFACE: o << " interface type"; break; - + case RT_TYPE_MODULE: o << "IDL module"; break; - + case RT_TYPE_STRUCT: if ( reader.getReferenceCount() == 0 ) { o << " simple struct type"; @@ -703,19 +703,19 @@ void generateDocumentation(std::ostream & o, o << " instantiated polymorphic struct type"; } break; - + case RT_TYPE_ENUM: o << " enum type"; break; - + case RT_TYPE_EXCEPTION: o << " exception type"; break; - + case RT_TYPE_TYPEDEF: o << "IDL typedef"; break; - + case RT_TYPE_SERVICE: if ( reader.getSuperTypeCount() > 0 ) { o << " single-inheritance--based service"; @@ -723,7 +723,7 @@ void generateDocumentation(std::ostream & o, o << "IDL accumulation-based service"; } break; - + case RT_TYPE_SINGLETON: if ( (manager.getTypeReader( codemaker::convertString( @@ -735,11 +735,11 @@ void generateDocumentation(std::ostream & o, o << "IDL service-based singleton"; } break; - + case RT_TYPE_CONSTANTS: o << "IDL constant group"; break; - + default: OSL_ASSERT(false); break; @@ -751,11 +751,11 @@ void generateDocumentation(std::ostream & o, manager, binType, true, true, true, &typeClass, &name, &rank, &arguments); if ( rank > 0 ) { - printMapsToJavaType(o, + printMapsToJavaType(o, options, manager, sort, typeClass, name, rank, arguments, "array"); o << '\n'; } else if ( sort != codemaker::UnoType::SORT_COMPLEX ) { - printMapsToJavaType(o, + printMapsToJavaType(o, options, manager, sort, typeClass, name, rank, arguments, 0); o << '\n'; } else { @@ -781,7 +781,7 @@ void generateDocumentation(std::ostream & o, break; case RT_TYPE_MODULE: - printMapsToJavaType(o, + printMapsToJavaType(o, options, manager, sort, typeClass, name, rank, arguments, "package"); o << '\n'; diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/unodevtools/source/skeletonmaker/skeletoncommon.cxx index 188e0fa05101..218dc65bc52a 100644 --- a/unodevtools/source/skeletonmaker/skeletoncommon.cxx +++ b/unodevtools/source/skeletonmaker/skeletoncommon.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,7 +52,7 @@ void printLicenseHeader(std::ostream& o, rtl::OString const & filename) OString shortfilename(filename); if ( index != -1 ) shortfilename = filename.copy(index+1); - + o << "/*************************************************************************\n" " *\n" " * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" @@ -78,14 +78,14 @@ void printLicenseHeader(std::ostream& o, rtl::OString const & filename) " * <http://www.openoffice.org/license.html>\n" " * for a copy of the LGPLv3 License.\n" " *\n" - " ************************************************************************/\n\n"; + " ************************************************************************/\n\n"; } bool getOutputStream(ProgramOptions const & options, OString const & extension, std::ostream** ppOutputStream, OString & targetSourceFileName, - OString & tmpSourceFileName) + OString & tmpSourceFileName) { bool bStandardout = false; if ( options.outputpath.equals("stdout") ) @@ -101,7 +101,7 @@ bool getOutputStream(ProgramOptions const & options, OString tmpDir = getTempDir(targetSourceFileName); FileStream file; file.createTempFile(tmpDir); - + if( !file.isValid() ) { OString message("cannot open "); @@ -164,8 +164,8 @@ void checkAttributes(TypeManager const & manager, typeName.equals("com/sun/star/beans/XPropertyAccess") ) { propinterfaces.insert(typeName); - } - + } + for ( sal_uInt16 i = 0; i < reader.getSuperTypeCount(); ++i ) { typereg::Reader supertype(manager.getTypeReader( codemaker::convertString( @@ -200,7 +200,7 @@ void checkType(TypeManager const & manager, std::hash_set< OString, OStringHash >& serviceTypes, AttributeInfo& properties) { - + OString binType(type.replace('.', '/')); typereg::Reader reader(manager.getTypeReader(binType)); if ( !reader.isValid() ) { @@ -214,7 +214,7 @@ void checkType(TypeManager const & manager, // com/sun/star/lang/XComponent should be also not in the list // but it will be used for checking the impl helper and will be // removed later if necessary. - if ( binType.equals("com/sun/star/lang/XTypeProvider") || + if ( binType.equals("com/sun/star/lang/XTypeProvider") || binType.equals("com/sun/star/uno/XWeak") ) return; if (interfaceTypes.find(type) == interfaceTypes.end()) { @@ -244,7 +244,7 @@ void checkType(TypeManager const & manager, // check if constructors are specified, if yes automatically // support of XInitialization. We will take care of the default - // constructor because in this case XInitialization is not called. + // constructor because in this case XInitialization is not called. if ( reader.getMethodCount() > 1 || ( reader.getMethodCount() == 1 && reader.getMethodName(0).getLength() > 0 ) ) @@ -252,13 +252,13 @@ void checkType(TypeManager const & manager, OString s("com.sun.star.lang.XInitialization"); if ( interfaceTypes.find(s) == interfaceTypes.end() ) interfaceTypes.insert(s); - } + } } else { for ( sal_uInt16 i = 0; i < reader.getReferenceCount(); ++i ) { OString referenceType( codemaker::convertString( reader.getReferenceTypeName(i)).replace('/', '.')); - + if ( reader.getReferenceSort(i) == RT_REF_SUPPORTS ) { checkType(manager, referenceType, interfaceTypes, serviceTypes, properties); @@ -267,7 +267,7 @@ void checkType(TypeManager const & manager, serviceTypes, properties); } } - + for ( sal_uInt16 i = 0; i < reader.getFieldCount(); ++i ) { OString fieldName( codemaker::convertString(reader.getFieldName(i)). @@ -299,7 +299,7 @@ void checkDefaultInterfaces( interfaces.erase("com.sun.star.lang.XServiceInfo"); } else { if (interfaces.find("com.sun.star.lang.XServiceInfo") == interfaces.end()) - interfaces.insert("com.sun.star.lang.XServiceInfo"); + interfaces.insert("com.sun.star.lang.XServiceInfo"); } if ( propertyhelper.equals("_") ) { @@ -318,9 +318,9 @@ void checkDefaultInterfaces( bool checkServiceProperties(TypeManager const & manager, const typereg::Reader & reader) { - if ( reader.getFieldCount() > 0 ) + if ( reader.getFieldCount() > 0 ) return true; - + if ( reader.getReferenceCount() > 0 ) { for ( sal_uInt16 i = 0; i < reader.getReferenceCount(); ++i ) { if ( reader.getReferenceSort(i) == RT_REF_EXPORTS ) { @@ -331,7 +331,7 @@ bool checkServiceProperties(TypeManager const & manager, if ( checkServiceProperties(manager, refreader) ) return true; } - } + } } return false; } @@ -353,7 +353,7 @@ OString checkPropertyHelper( end = services.end(); } else { iter = interfaces.begin(); - end = interfaces.end(); + end = interfaces.end(); } bool oldStyleWithProperties = false; @@ -373,9 +373,9 @@ OString checkPropertyHelper( + codemaker::convertString( reader.getSuperTypeName(0))); } - + checkAttributes(manager, supertype, attributes, propinterfaces); - + if ( !(attributes.empty() || propinterfaces.empty()) ) { return OUStringToOString( supertype.getTypeName().replace('/', '.'), @@ -394,7 +394,7 @@ OString checkPropertyHelper( } iter++; } - + return (oldStyleWithProperties ? "_" : ""); } @@ -432,14 +432,14 @@ bool checkXComponentSupport(TypeManager const & manager, { if ( interfaces.empty() ) return false; - + std::hash_set< OString, OStringHash >::const_iterator iter = interfaces.begin(); while ( iter != interfaces.end() ) { if ( (*iter).equals("com.sun.star.lang.XComponent") ) { interfaces.erase("com.sun.star.lang.XComponent"); return true; - } + } typereg::Reader reader(manager.getTypeReader((*iter).replace('.', '/'))); if ( checkXComponentSupport(manager, reader) ) return true; @@ -454,7 +454,7 @@ sal_uInt16 checkAdditionalPropertyFlags(typereg::Reader const & reader, { sal_uInt16 flags = 0; bool getterSupportsUnknown = false; - + OUString su(RTL_CONSTASCII_USTRINGPARAM( "com/sun/star/beans/UnknownPropertyException")); if ( method < reader.getMethodCount() @@ -505,7 +505,7 @@ bool checkAddinType(TypeManager const & manager, std::vector< OString > arguments; codemaker::UnoType::Sort sort = codemaker::decomposeAndResolve( manager, type, true, true, true, &typeClass, &name, &rank, &arguments); - + if ( sort == codemaker::UnoType::SORT_LONG || sort == codemaker::UnoType::SORT_DOUBLE || sort == codemaker::UnoType::SORT_STRING ) @@ -514,14 +514,14 @@ bool checkAddinType(TypeManager const & manager, return true; } if ( sort == codemaker::UnoType::SORT_ANY ) - { + { if ( rank <= 2 ) { if ( rank ==1 ) { if ( bIsReturn ) return false; bLastAny = true; } - + return true; } } @@ -547,7 +547,7 @@ bool checkAddinType(TypeManager const & manager, void checkAddInTypes(TypeManager const & manager, typereg::Reader const & reader) -{ +{ OString sType(codemaker::convertString(reader.getTypeName()).replace('/', '.')); bool bLastAny = false; bool bHasXPropertySet = false; @@ -589,7 +589,7 @@ void checkAddInTypes(TypeManager const & manager, if ( bHasXPropertySet ) msg.append(" The type 'XPropertySet' is allowed only once."); - msg.append(" Please check your IDL definition."); + msg.append(" Please check your IDL definition."); throw CannotDumpException(msg.makeStringAndClear()); } } @@ -617,7 +617,7 @@ void generateFunctionParamterMap(std::ostream& o, // check if the specified add-in functions supports valid types checkAddInTypes(manager, reader); - + for ( sal_uInt16 i = 0; i < reader.getSuperTypeCount(); ++i ) { typereg::Reader super( manager.getTypeReader( @@ -628,7 +628,7 @@ void generateFunctionParamterMap(std::ostream& o, "Bad type library entity " + codemaker::convertString( reader.getSuperTypeName(i))); - } + } generateFunctionParamterMap(o, options, manager, super, generated, bFirst); } @@ -665,7 +665,7 @@ void generateFunctionParamterMap(std::ostream& o, else o << " fpm = new java.util.Hashtable();\n"; } - + for ( sal_uInt16 p = 0; p < reader.getMethodParameterCount(m); ++p ) { if ( options.language == 2 ) { o << " fpm[" << p @@ -713,7 +713,7 @@ void generateFunctionParameterMap(std::ostream& o, + codemaker::convertString( reader.getTypeName())); } - + generateFunctionParamterMap(o, options, manager, reader, generated, bFirst); iter++; } diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.hxx b/unodevtools/source/skeletonmaker/skeletoncommon.hxx index 83b89bf15a21..557addb6b867 100644 --- a/unodevtools/source/skeletonmaker/skeletoncommon.hxx +++ b/unodevtools/source/skeletonmaker/skeletoncommon.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ namespace skeletonmaker { typedef ::std::map< ::rtl::OString, ::std::vector< ::rtl::OString >, ::std::less< ::rtl::OString > > ProtocolCmdMap; -typedef ::std::vector< ::std::pair< rtl::OString, +typedef ::std::vector< ::std::pair< rtl::OString, ::std::pair< rtl::OString, sal_Int16 > > > AttributeInfo; @@ -85,7 +85,7 @@ void printLicenseHeader(std::ostream& o, rtl::OString const & filename); create dependent on the output path, the implementation name and the extension a new output file. If output path is equal "stdout" the tool generates the output to standard out. - + @param options the program options including the output path and the implementation name @param extension specifies the file extensions (e.g. .cxx or .java) @@ -131,10 +131,10 @@ rtl::OString checkPropertyHelper( checks whether the return and parameters types are valid and allowed calc add-in type. The function throws a CannotDumpException with an detailed error description which type is wrong - + @param manager a type manager @param reader a registry type reader of an interface defining - calc add-in functions + calc add-in functions */ void checkAddInTypes(TypeManager const & manager, typereg::Reader const & reader); diff --git a/unodevtools/source/skeletonmaker/skeletoncpp.hxx b/unodevtools/source/skeletonmaker/skeletoncpp.hxx index 803788cfb3c6..6213bc1dbb9b 100644 --- a/unodevtools/source/skeletonmaker/skeletoncpp.hxx +++ b/unodevtools/source/skeletonmaker/skeletoncpp.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/unodevtools/source/skeletonmaker/skeletonjava.hxx b/unodevtools/source/skeletonmaker/skeletonjava.hxx index e2c0c9e75539..36174d19f49a 100644 --- a/unodevtools/source/skeletonmaker/skeletonjava.hxx +++ b/unodevtools/source/skeletonmaker/skeletonjava.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/unodevtools/source/skeletonmaker/skeletonmaker.cxx b/unodevtools/source/skeletonmaker/skeletonmaker.cxx index 2467bf2334c6..dffb0c81712a 100644 --- a/unodevtools/source/skeletonmaker/skeletonmaker.cxx +++ b/unodevtools/source/skeletonmaker/skeletonmaker.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,7 +74,7 @@ static const char usageText[] = " -sn, --shortnames using namespace abbreviation 'css:': for\n" " '::com::sun::star::', only valid for sub-command\n" " 'dump' and target language 'cpp'. It is default for the\n" -" sub-command 'component'.\n" +" sub-command 'component'.\n" " --propertysetmixin the generated skeleton implements the cppu::PropertySetMixin\n" " helper if a referenced new style service specifies an\n" " interface which provides attributes (directly or inherited).\n" @@ -157,7 +157,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/) OString delegate; try { - + sal_Int32 nPos = 0; sal_Int32 nCount = (sal_Int32)rtl_getAppCommandArgCount(); OUString arg, sOption; @@ -195,7 +195,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/) printUsageAndExit(programname, version); exit(EXIT_FAILURE); } - + // read up to arguments while ( nPos < nCount ) { @@ -220,26 +220,26 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/) options.java5 = false; options.language = 2; continue; - } + } if ( readOption( &bOption, "sn", &nPos, arg) || readOption( &bOption, "shortnames", &nPos, arg) ) { options.shortnames = true; continue; - } + } if ( readOption( &bOption, "lh", &nPos, arg) || readOption( &bOption, "licenseheader", &nPos, arg) ) { options.license = true; continue; - } + } if ( readOption( &bOption, "bc", &nPos, arg) || readOption( &bOption, "backward-compatible", &nPos, arg) ) { options.backwardcompatible = true; continue; - } + } if ( readOption( &bOption, "propertysetmixin", &nPos, arg) ) { options.supportpropertysetmixin = true; continue; - } + } if ( readOption( &sOption, "d", &nPos, arg) ) { delegate = OUStringToOString(sOption, RTL_TEXTENCODING_UTF8); continue; @@ -273,27 +273,27 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/) vCmds.push_back(sCmd); } while ( nIndex >= 0 ); - options.protocolCmdMap.insert(ProtocolCmdMap::value_type(sPrt, vCmds)); + options.protocolCmdMap.insert(ProtocolCmdMap::value_type(sPrt, vCmds)); continue; } - - + + // else illegal argument OUStringBuffer buf( 64 ); buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("unexpected parameter \"")); buf.append(arg); buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("\"!")); - throw RuntimeException(buf.makeStringAndClear(), + throw RuntimeException(buf.makeStringAndClear(), Reference< XInterface >()); } - + if ( types.empty() && options.componenttype != 3) { std::cerr << ("\nError: no type is specified, use the -T option at least once\n"); - printUsageAndExit(programname, version); + printUsageAndExit(programname, version); exit(EXIT_FAILURE); } - + UnoTypeManager manager; if ( !manager.init(registries) ) { std::cerr @@ -337,7 +337,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, /*argv*/) break; } } - + } catch (CannotDumpException & e) { std::cout.flush(); std::cerr << "\nError: " << e.m_message << std::endl; diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx index dbca5cb95f93..305ce54def0a 100644 --- a/unodevtools/source/unodevtools/options.cxx +++ b/unodevtools/source/unodevtools/options.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/unodevtools/source/unodevtools/typeblob.cxx b/unodevtools/source/unodevtools/typeblob.cxx index b92bc374cb90..fe91026a8519 100644 --- a/unodevtools/source/unodevtools/typeblob.cxx +++ b/unodevtools/source/unodevtools/typeblob.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -59,75 +59,75 @@ namespace unodevtools { void writeConstantData(typereg::Writer& rWriter, sal_uInt16 fieldIndex, const Reference< XConstantTypeDescription >& xConstant) - -{ - RTConstValue constValue; + +{ + RTConstValue constValue; OUString uConstTypeName; OUString uConstName = xConstant->getName(); Any aConstantAny = xConstant->getConstantValue(); - + switch ( aConstantAny.getValueTypeClass() ) { case TypeClass_BOOLEAN: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")); - constValue.m_type = RT_TYPE_BOOL; + constValue.m_type = RT_TYPE_BOOL; aConstantAny >>= constValue.m_value.aBool; } break; case TypeClass_BYTE: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("byte")); - constValue.m_type = RT_TYPE_BYTE; + constValue.m_type = RT_TYPE_BYTE; aConstantAny >>= constValue.m_value.aByte; } break; case TypeClass_SHORT: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("short")); - constValue.m_type = RT_TYPE_INT16; + constValue.m_type = RT_TYPE_INT16; aConstantAny >>= constValue.m_value.aShort; } break; case TypeClass_UNSIGNED_SHORT: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned short")); - constValue.m_type = RT_TYPE_UINT16; + constValue.m_type = RT_TYPE_UINT16; aConstantAny >>= constValue.m_value.aUShort; } break; case TypeClass_LONG: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("long")); - constValue.m_type = RT_TYPE_INT32; + constValue.m_type = RT_TYPE_INT32; aConstantAny >>= constValue.m_value.aLong; } break; case TypeClass_UNSIGNED_LONG: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned long")); - constValue.m_type = RT_TYPE_UINT32; + constValue.m_type = RT_TYPE_UINT32; aConstantAny >>= constValue.m_value.aULong; } break; case TypeClass_FLOAT: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("float")); - constValue.m_type = RT_TYPE_FLOAT; + constValue.m_type = RT_TYPE_FLOAT; aConstantAny >>= constValue.m_value.aFloat; } break; case TypeClass_DOUBLE: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("double")); - constValue.m_type = RT_TYPE_DOUBLE; + constValue.m_type = RT_TYPE_DOUBLE; aConstantAny >>= constValue.m_value.aDouble; } break; case TypeClass_STRING: { uConstTypeName = OUString(RTL_CONSTASCII_USTRINGPARAM("string")); - constValue.m_type = RT_TYPE_STRING; + constValue.m_type = RT_TYPE_STRING; constValue.m_value.aString = ((OUString*)aConstantAny.getValue())->getStr(); } break; @@ -135,10 +135,10 @@ void writeConstantData(typereg::Writer& rWriter, sal_uInt16 fieldIndex, OSL_ENSURE( 0, "unsupported constant type" ); break; } - + rWriter.setFieldData(fieldIndex, OUString(), OUString(), RT_ACCESS_CONST, uConstName, uConstTypeName, constValue); -} +} sal_uInt32 getInheritedMemberCount( GeneratedTypeSet& checkedTypes, @@ -150,22 +150,22 @@ sal_uInt32 getInheritedMemberCount( OString name; for (sal_uInt16 i=0; i < count; i++) { name = OString(OUStringToOString(superTypes[i]->getName(), - RTL_TEXTENCODING_UTF8)); + RTL_TEXTENCODING_UTF8)); if (!checkedTypes.contains(name)) { checkedTypes.add(name); Reference< XInterfaceTypeDescription2 > xIFace( superTypes[i], UNO_QUERY); - + Sequence< Reference< XTypeDescription> > baseTypes = xIFace->getBaseTypes(); if ( baseTypes.getLength() > 0) memberCount += getInheritedMemberCount(checkedTypes, baseTypes); memberCount += xIFace->getMembers().getLength(); - } + } } - + return memberCount; } @@ -174,8 +174,8 @@ void writeMethodData( typereg::Writer& rWriter, sal_uInt32 calculatedMemberOffse { RTMethodMode methodMode = RT_MODE_TWOWAY; if ( xMethod->isOneway() ) - methodMode = RT_MODE_ONEWAY; - + methodMode = RT_MODE_ONEWAY; + Sequence< Reference< XMethodParameter > > parameters(xMethod->getParameters()); Sequence< Reference< XTypeDescription > > exceptions(xMethod->getExceptions()); @@ -184,10 +184,10 @@ void writeMethodData( typereg::Writer& rWriter, sal_uInt32 calculatedMemberOffse - calculatedMemberOffset); sal_uInt16 paramCount = (sal_uInt16)parameters.getLength(); sal_uInt16 exceptionCount = (sal_uInt16)exceptions.getLength(); - + rWriter.setMethodData(methodIndex, OUString(), methodMode, xMethod->getMemberName(), - xMethod->getReturnType()->getName().replace('.', '/'), + xMethod->getReturnType()->getName().replace('.', '/'), paramCount, exceptionCount); RTParamMode paramMode = RT_PARAM_IN; @@ -198,7 +198,7 @@ void writeMethodData( typereg::Writer& rWriter, sal_uInt32 calculatedMemberOffse if ( xParam->isIn() && xParam->isOut()) paramMode = RT_PARAM_INOUT; else if ( xParam->isIn() ) - paramMode = RT_PARAM_IN; + paramMode = RT_PARAM_IN; else if ( xParam->isOut() ) paramMode = RT_PARAM_OUT; @@ -206,35 +206,35 @@ void writeMethodData( typereg::Writer& rWriter, sal_uInt32 calculatedMemberOffse (sal_uInt16)xParam->getPosition(), paramMode, xParam->getName(), xParam->getType()-> - getName().replace('.', '/')); + getName().replace('.', '/')); } - + for (i=0; i < exceptionCount; i++) { rWriter.setMethodExceptionTypeName( - methodIndex, i, exceptions[i]->getName().replace('.', '/')); + methodIndex, i, exceptions[i]->getName().replace('.', '/')); } -} +} void writeAttributeMethodData( typereg::Writer& rWriter, sal_uInt16& methodindex, RTMethodMode methodmode, const Reference<XInterfaceAttributeTypeDescription2>& xAttr) { Sequence<Reference<XCompoundTypeDescription> > seqExcp; - if (methodmode == RT_MODE_ATTRIBUTE_GET) + if (methodmode == RT_MODE_ATTRIBUTE_GET) seqExcp = xAttr->getGetExceptions(); else seqExcp = xAttr->getSetExceptions(); - + if (seqExcp.getLength() > 0) { rWriter.setMethodData(methodindex, OUString(), methodmode, xAttr->getMemberName(), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")), 0, (sal_uInt16)seqExcp.getLength()); for (sal_Int32 i=0; i < seqExcp.getLength(); i++) { rWriter.setMethodExceptionTypeName( methodindex, (sal_uInt16)i, - seqExcp[i]->getName().replace('.', '/')); + seqExcp[i]->getName().replace('.', '/')); } ++methodindex; } @@ -247,7 +247,7 @@ RTFieldAccess checkParameterizedTypeFlag(const Sequence< OUString >& typeParams, if (typeParams[i].equals(memberType)) return RT_ACCESS_PARAMETERIZED_TYPE; } - + return RT_ACCESS_READWRITE; } @@ -257,7 +257,7 @@ RTFieldAccess checkPropertyFlags(short flags) { case PropertyAttribute::MAYBEVOID: propertyFlags |= RT_ACCESS_MAYBEVOID; case PropertyAttribute::BOUND: - propertyFlags |= RT_ACCESS_BOUND; + propertyFlags |= RT_ACCESS_BOUND; case PropertyAttribute::CONSTRAINED: propertyFlags |= RT_ACCESS_CONSTRAINED; case PropertyAttribute::TRANSIENT: @@ -284,7 +284,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, OUString uTypeName(OStringToOUString(typeName, RTL_TEXTENCODING_UTF8) .replace('/', '.')); - + Any aTypeAny( xTDmgr->getByHierarchicalName( uTypeName ) ); if ( !aTypeAny.hasValue() ) @@ -292,10 +292,10 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, Reference< XTypeDescription > xType; aTypeAny >>= xType; - + if ( !xType.is() ) return NULL; - + Reference< XPublished > xPublished(xType, UNO_QUERY); void* pBlob = NULL; switch (xType->getTypeClass()) @@ -303,22 +303,22 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_CONSTANTS: { Reference< XConstantsTypeDescription > xCFace(xType, UNO_QUERY); - + if ( !xCFace.is() ) return NULL; - + Sequence< Reference< XConstantTypeDescription > > constTypes( xCFace->getConstants()); sal_uInt16 constCount = (sal_uInt16)constTypes.getLength(); - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_CONSTANTS, xPublished->isPublished(), - uTypeName.replace('.', '/'), + uTypeName.replace('.', '/'), 0, constCount, 0, 0); - + for (sal_uInt16 i=0; i < constCount; i++) - writeConstantData(writer, i, constTypes[i]); - + writeConstantData(writer, i, constTypes[i]); + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -327,40 +327,40 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_MODULE: { Reference< XModuleTypeDescription > xMFace(xType, UNO_QUERY); - + if ( !xMFace.is() ) return NULL; - + Sequence< Reference< XTypeDescription > > memberTypes( xMFace->getMembers()); - + sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength(); sal_uInt16 constCount = 0; sal_Int16 i; - + for ( i=0; i < memberCount; i++) { if ( TypeClass_CONSTANT == memberTypes[i]->getTypeClass() ) constCount++; } - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_MODULE, xPublished->isPublished(), - uTypeName.replace('.', '/'), + uTypeName.replace('.', '/'), 0, constCount, 0, 0); - + if ( 0 < constCount ) { Reference< XConstantTypeDescription > xConst; - sal_uInt16 fieldIndex = 0; + sal_uInt16 fieldIndex = 0; for (i=0; i < memberCount; i++) { if ( TypeClass_CONSTANT == memberTypes[i]->getTypeClass() ) { xConst = Reference< XConstantTypeDescription >( memberTypes[i], UNO_QUERY); - - writeConstantData(writer, ++fieldIndex, xConst); + + writeConstantData(writer, ++fieldIndex, xConst); } } } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -369,10 +369,10 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_INTERFACE: { Reference< XInterfaceTypeDescription2 > xIFace(xType, UNO_QUERY); - + if ( !xIFace.is() ) return NULL; - + Reference< XInterfaceAttributeTypeDescription2 > xAttr; Reference< XInterfaceMethodTypeDescription > xMethod; Sequence< Reference< XInterfaceMemberTypeDescription > > memberTypes( @@ -381,14 +381,14 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, xIFace->getBaseTypes(); Sequence< Reference< XTypeDescription > > optBaseTypes = xIFace->getOptionalBaseTypes(); - - sal_uInt16 baseCount = (sal_uInt16)baseTypes.getLength(); + + sal_uInt16 baseCount = (sal_uInt16)baseTypes.getLength(); sal_uInt16 optBaseCount = (sal_uInt16)optBaseTypes.getLength(); sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength(); sal_uInt16 attrCount = 0, attrmethods = 0; sal_uInt16 inheritedMemberCount = 0; sal_uInt16 i; - + for (i=0; i < memberCount; i++) { xAttr = Reference< XInterfaceAttributeTypeDescription2 >( memberTypes[i], UNO_QUERY); @@ -399,7 +399,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, attrmethods++; if (xAttr->getSetExceptions().getLength() > 0) - attrmethods++; + attrmethods++; } } @@ -409,19 +409,19 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, inheritedMemberCount = (sal_uInt16)getInheritedMemberCount( checkedTypes, baseTypes ); } - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_INTERFACE, xPublished->isPublished(), uTypeName.replace('.', '/'), baseCount, attrCount, memberCount-attrCount+attrmethods, (sal_uInt16)optBaseTypes.getLength()); - + // set super types for (i=0; i < baseCount; i++) { writer.setSuperTypeName(i, baseTypes[i]-> getName().replace('.', '/')); } - + // set optional super types RTReferenceType referenceType = RT_REF_SUPPORTS; RTFieldAccess fieldAccess = RT_ACCESS_OPTIONAL; @@ -430,7 +430,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, fieldAccess, optBaseTypes[i]-> getName().replace('.', '/')); } - + fieldAccess = RT_ACCESS_READWRITE; // reset attrCount, used for method index calculation attrCount = 0; @@ -441,13 +441,13 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, if ( xAttr.is() ) { ++attrCount; if (xAttr->isReadOnly()) - fieldAccess = RT_ACCESS_READONLY; + fieldAccess = RT_ACCESS_READONLY; else fieldAccess = RT_ACCESS_READWRITE; if (xAttr->isBound()) fieldAccess |= RT_ACCESS_BOUND; - + writer.setFieldData((sal_uInt16)memberTypes[i]->getPosition() - inheritedMemberCount, OUString(), OUString(), fieldAccess, @@ -461,10 +461,10 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, writeAttributeMethodData(writer, attrmethods, RT_MODE_ATTRIBUTE_SET, xAttr); } - + continue; } - + xMethod = Reference< XInterfaceMethodTypeDescription >( memberTypes[i], UNO_QUERY); if ( xMethod.is() ) { @@ -472,7 +472,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, xMethod); } } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -481,20 +481,20 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_STRUCT: { Reference< XStructTypeDescription > xStruct(xType, UNO_QUERY); - + if ( !xStruct.is() ) return NULL; - + if ( xStruct->getTypeArguments().getLength() > 0) return NULL; - - + + Sequence< OUString > typeParams( xStruct->getTypeParameters()); Sequence< OUString > memberNames( xStruct->getMemberNames()); Sequence< Reference< XTypeDescription > > memberTypes( xStruct->getMemberTypes()); sal_uInt16 memberCount = (sal_uInt16)memberNames.getLength(); - + OUString uSuperType; sal_uInt16 superCount=0; if ( typeParams.getLength() == 0) { @@ -521,18 +521,18 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, if (typeParams.getLength() > 0) fieldAccess |= checkParameterizedTypeFlag( typeParams, memberTypes[i]->getName()); - + writer.setFieldData(i, OUString(), OUString(), fieldAccess, memberNames[i], - memberTypes[i]->getName().replace('.', '/'), + memberTypes[i]->getName().replace('.', '/'), RTConstValue()); } - + for (i=0; i < typeParams.getLength(); i++) { writer.setReferenceData(i, OUString(), RT_REF_TYPE_PARAMETER, RT_ACCESS_INVALID, typeParams[i]); } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -541,15 +541,15 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_EXCEPTION: { Reference< XCompoundTypeDescription > xComp(xType, UNO_QUERY); - + if ( !xComp.is() ) return NULL; - + Sequence< OUString > memberNames( xComp->getMemberNames()); Sequence< Reference< XTypeDescription > > memberTypes( xComp->getMemberTypes()); sal_uInt16 memberCount = (sal_uInt16)memberNames.getLength(); - + OUString uSuperType; sal_uInt16 superCount=0; Reference< XTypeDescription > xSuperType = xComp->getBaseType(); @@ -557,7 +557,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, ++superCount; uSuperType = xSuperType->getName().replace('.','/'); } - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_EXCEPTION, xPublished->isPublished(), uTypeName.replace('.', '/'), @@ -571,10 +571,10 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, for (sal_Int16 i=0; i < memberCount; i++) { writer.setFieldData(i, OUString(), OUString(), RT_ACCESS_READWRITE, memberNames[i], - memberTypes[i]->getName().replace('.', '/'), + memberTypes[i]->getName().replace('.', '/'), RTConstValue()); } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -583,29 +583,29 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_ENUM: { Reference< XEnumTypeDescription > xEnum(xType, UNO_QUERY); - + if ( !xEnum.is() ) return NULL; - + Sequence< OUString > enumNames( xEnum->getEnumNames()); Sequence< sal_Int32 > enumValues( xEnum->getEnumValues()); sal_uInt16 enumCount = (sal_uInt16)enumNames.getLength(); - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_ENUM, xPublished->isPublished(), uTypeName.replace('.', '/'), 0, enumCount, 0, 0); - - RTConstValue constValue; + + RTConstValue constValue; for (sal_Int16 i=0; i < enumCount; i++) { - constValue.m_type = RT_TYPE_INT32; + constValue.m_type = RT_TYPE_INT32; constValue.m_value.aLong = enumValues[i]; - + writer.setFieldData(i, OUString(), OUString(), RT_ACCESS_CONST, enumNames[i], OUString(), constValue); } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -614,18 +614,18 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_TYPEDEF: { Reference< XIndirectTypeDescription > xTD(xType, UNO_QUERY); - + if ( !xTD.is() ) return NULL; - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_TYPEDEF, xPublished->isPublished(), uTypeName.replace('.', '/'), 1, 0, 0, 0); - + writer.setSuperTypeName(0, xTD->getReferencedType() ->getName().replace('.','/')); - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -634,10 +634,10 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_SERVICE: { Reference< XServiceTypeDescription2 > xService(xType, UNO_QUERY); - + if ( !xService.is() ) return NULL; - + Sequence<Reference<XServiceConstructorDescription> > constructors( xService->getConstructors()); Sequence<Reference<XPropertyTypeDescription> > properties; @@ -648,7 +648,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, sal_uInt16 methodCount = (sal_uInt16)constructors.getLength(); sal_uInt16 referenceCount = 0; sal_uInt16 propertyCount = 0; - + if ( !xService->isSingleInterfaceBased() ) { mandatoryServices = xService->getMandatoryServices(); optionalServices = xService->getOptionalServices(); @@ -659,21 +659,21 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, mandatoryServices.getLength()+ optionalServices.getLength()+ mandatoryInterfaces.getLength()+ - optionalInterfaces.getLength()); + optionalInterfaces.getLength()); propertyCount = (sal_uInt16)properties.getLength(); } - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_SERVICE, xPublished->isPublished(), uTypeName.replace('.', '/'), (xService->isSingleInterfaceBased() ? 1 : 0), propertyCount, methodCount, referenceCount); - + sal_uInt16 i=0; if ( xService->isSingleInterfaceBased() ) { writer.setSuperTypeName(0, xService->getInterface() ->getName().replace('.','/')); - + sal_uInt16 j=0; for ( i=0; i<methodCount; i++ ) { Reference<XServiceConstructorDescription> xConstructor( @@ -686,83 +686,83 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, parameters = xConstructor->getParameters(); parameterCount = (sal_uInt16)parameters.getLength(); } - + writer.setMethodData(i, OUString(), RT_MODE_TWOWAY, xConstructor->getName(), OUString( RTL_CONSTASCII_USTRINGPARAM("void")), parameterCount, exceptionCount); - + if ( !xConstructor->isDefaultConstructor() ) { for ( j=0; j<parameterCount; j++ ) { Reference<XParameter> xParam(parameters[j], UNO_QUERY); RTParamMode paramMode = RT_PARAM_IN; if (xParam->isRestParameter()) paramMode = RT_PARAM_REST; - + writer.setMethodParameterData( i, (sal_uInt16)xParam->getPosition(), paramMode, xParam->getName(), xParam->getType()->getName().replace('.', '/')); } - + for (j=0; j<exceptionCount; j++) { Reference<XCompoundTypeDescription> xExcp( exceptions[j], UNO_QUERY); - + writer.setMethodExceptionTypeName( i, j, xExcp->getName().replace('.', '/')); } - } - } + } + } } else { for (i=0; i<propertyCount; i++) { Reference<XPropertyTypeDescription> xProp( properties[i], UNO_QUERY); - + RTFieldAccess propertyFlags = checkPropertyFlags( xProp->getPropertyFlags()); - + writer.setFieldData(i, OUString(), OUString(), - propertyFlags, + propertyFlags, xProp->getName().copy(xProp->getName().lastIndexOf('.')+1), xProp->getPropertyTypeDescription() ->getName().replace('.', '/'), RTConstValue()); - } - + } + sal_uInt16 refIndex = 0; sal_uInt16 length = (sal_uInt16)mandatoryServices.getLength(); - for (i=0; i < length; i++) { + for (i=0; i < length; i++) { writer.setReferenceData(refIndex++, OUString(), RT_REF_EXPORTS, RT_ACCESS_INVALID, mandatoryServices[i]->getName() .replace('.', '/')); } length = (sal_uInt16)optionalServices.getLength(); - for (i=0; i < length; i++) { + for (i=0; i < length; i++) { writer.setReferenceData(refIndex++, OUString(), RT_REF_EXPORTS, RT_ACCESS_OPTIONAL, optionalServices[i]->getName() .replace('.', '/')); - } + } length = (sal_uInt16)mandatoryInterfaces.getLength(); - for (i=0; i < length; i++) { + for (i=0; i < length; i++) { writer.setReferenceData(refIndex++, OUString(), RT_REF_SUPPORTS, RT_ACCESS_INVALID, mandatoryInterfaces[i]->getName() .replace('.', '/')); } length = (sal_uInt16)optionalInterfaces.getLength(); - for (i=0; i < length; i++) { + for (i=0; i < length; i++) { writer.setReferenceData(refIndex++, OUString(), RT_REF_SUPPORTS, RT_ACCESS_OPTIONAL, optionalInterfaces[i]->getName() .replace('.', '/')); - } + } } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -771,10 +771,10 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, case TypeClass_SINGLETON: { Reference<XSingletonTypeDescription2> xSingleton(xType, UNO_QUERY); - + if ( !xSingleton.is() ) return NULL; - + typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(), RT_TYPE_SINGLETON, xPublished->isPublished(), uTypeName.replace('.', '/'), @@ -787,7 +787,7 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, writer.setSuperTypeName(0, xSingleton->getService() ->getName().replace('.','/')); } - + const void* p = writer.getBlob(blobsize); pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize); rtl_copyMemory(pBlob, p, *blobsize); @@ -797,9 +797,9 @@ void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr, OSL_ENSURE( 0, "unsupported type" ); break; } - - return pBlob; -} + + return pBlob; +} } // end of namespace unodevtools diff --git a/unodevtools/source/unodevtools/typemanager.cxx b/unodevtools/source/unodevtools/typemanager.cxx index 8bd4fe650415..c787b3f00772 100644 --- a/unodevtools/source/unodevtools/typemanager.cxx +++ b/unodevtools/source/unodevtools/typemanager.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -79,16 +79,16 @@ static RTTypeClass mapTypeClass(TypeClass typeclass) { UnoTypeManager::UnoTypeManager() { m_pImpl = new UnoTypeManagerImpl(); - acquire(); -} + acquire(); +} UnoTypeManager::~UnoTypeManager() { release(); -} +} void UnoTypeManager::release() -{ +{ if (0 == TypeManager::release()) delete m_pImpl; } @@ -117,7 +117,7 @@ sal_Bool UnoTypeManager::init( } if ( !registries.empty() ) { - + Reference< XMultiComponentFactory > xServiceManager( xContext->getServiceManager() ); if ( !xServiceManager.is() ) { @@ -125,9 +125,9 @@ sal_Bool UnoTypeManager::init( "internal UNO problem, can't get ServiceManager")); throw RuntimeException( msg, Reference< XInterface >()); } - + Sequence<Any> seqArgs(registries.size()); - + std::vector< OUString >::const_iterator iter = registries.begin(); int i = 0; while ( iter != registries.end() ) @@ -162,9 +162,9 @@ sal_Bool UnoTypeManager::init( Reference< XSet > xSet(m_pImpl->m_tdmgr, UNO_QUERY); xSet->insert(a); } - + return sal_True; -} +} sal_Bool UnoTypeManager::isValidType(const ::rtl::OString& name) const { @@ -203,81 +203,81 @@ typereg::Reader UnoTypeManager::getTypeReader( rtl_freeMemory(pBlob); return reader; -} +} typereg::Reader UnoTypeManager::getTypeReader(RegistryKey& rTypeKey) const { typereg::Reader reader; - + if (rTypeKey.isValid()) { - RegValueType valueType; - sal_uInt32 valueSize; + RegValueType valueType; + sal_uInt32 valueSize; if (!rTypeKey.getValueInfo(OUString(), &valueType, &valueSize)) { - sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize); + sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize); if ( !rTypeKey.getValue(OUString(), pBuffer) ) { reader = typereg::Reader( pBuffer, valueSize, true, TYPEREG_VERSION_1); - } + } rtl_freeMemory(pBuffer); } } return reader; -} +} RTTypeClass UnoTypeManager::getTypeClass(const OString& name) const { if ( m_pImpl->m_t2TypeClass.count(name) > 0 ) { - return m_pImpl->m_t2TypeClass[name]; + return m_pImpl->m_t2TypeClass[name]; } else { Reference< XTypeDescription > xTD; Any a = m_pImpl->m_tdmgr->getByHierarchicalName( OStringToOUString(name, RTL_TEXTENCODING_UTF8)); a >>= xTD; - + if ( xTD.is() ) { RTTypeClass tc = mapTypeClass(xTD->getTypeClass()); if (tc != RT_TYPE_INVALID) - m_pImpl->m_t2TypeClass[name] = tc; + m_pImpl->m_t2TypeClass[name] = tc; return tc; } - } + } - return RT_TYPE_INVALID; -} + return RT_TYPE_INVALID; +} RTTypeClass UnoTypeManager::getTypeClass(RegistryKey& rTypeKey) const { OString name = getTypeName(rTypeKey); - + if ( m_pImpl->m_t2TypeClass.count(name) > 0 ) { return m_pImpl->m_t2TypeClass[name]; } else { if ( rTypeKey.isValid() ) { - RegValueType valueType; - sal_uInt32 valueSize; + RegValueType valueType; + sal_uInt32 valueSize; if ( !rTypeKey.getValueInfo(OUString(), &valueType, &valueSize) ) { - sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize); + sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize); if ( !rTypeKey.getValue(OUString(), pBuffer) ) { typereg::Reader reader( pBuffer, valueSize, false, TYPEREG_VERSION_1); RTTypeClass ret = reader.getTypeClass(); - + rtl_freeMemory(pBuffer); - - m_pImpl->m_t2TypeClass[name] = ret; + + m_pImpl->m_t2TypeClass[name] = ret; return ret; - } + } rtl_freeMemory(pBuffer); } } - } + } - return RT_TYPE_INVALID; -} + return RT_TYPE_INVALID; +} } // end of namespace unodevtools |