LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/unodevtools/source/skeletonmaker - javacompskeleton.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 381 0.0 %
Date: 2013-07-09 Functions: 0 21 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include "sal/config.h"
      21             : 
      22             : #include "codemaker/commonjava.hxx"
      23             : #include "codemaker/global.hxx"
      24             : #include "rtl/strbuf.hxx"
      25             : 
      26             : #include "skeletoncommon.hxx"
      27             : #include "skeletonjava.hxx"
      28             : 
      29             : #include <iostream>
      30             : 
      31             : using namespace ::rtl;
      32             : using namespace ::codemaker::java;
      33             : 
      34             : namespace skeletonmaker { namespace java {
      35             : 
      36           0 : void generatePackage(std::ostream & o, const OString & implname)
      37             : {
      38           0 :     sal_Int32 index = implname.lastIndexOf('.');
      39           0 :     if (index != -1)
      40           0 :         o << "package " << implname.copy(0, index) << ";\n\n";
      41           0 : }
      42             : 
      43           0 : void generateImports(std::ostream & o, ProgramOptions const & options,
      44             :          const OUString & propertyhelper,
      45             :          bool serviceobject, bool supportxcomponent)
      46             : {
      47           0 :     if (options.componenttype == 3)
      48           0 :         o << "import com.sun.star.uno.UnoRuntime;\n";
      49           0 :     o << "import com.sun.star.uno.XComponentContext;\n";
      50           0 :     if (serviceobject) {
      51           0 :         o << "import com.sun.star.lib.uno.helper.Factory;\n";
      52           0 :         o << "import com.sun.star.lang.XSingleComponentFactory;\n";
      53           0 :         o << "import com.sun.star.registry.XRegistryKey;\n";
      54             :     }
      55             : 
      56           0 :     if  (!propertyhelper.equals("_")) {
      57           0 :         if (supportxcomponent)
      58           0 :             o << "import com.sun.star.lib.uno.helper.ComponentBase;\n";
      59             :         else
      60           0 :             o << "import com.sun.star.lib.uno.helper.WeakBase;\n";
      61             :     }
      62           0 :     if (!propertyhelper.isEmpty()) {
      63           0 :         if (propertyhelper.equals("_")) {
      64           0 :             o << "import com.sun.star.lib.uno.helper.PropertySet;\n";
      65           0 :             o << "import com.sun.star.beans.PropertyAttribute;\n";
      66             :         } else {
      67           0 :             o << "import com.sun.star.uno.Type;\n";
      68           0 :             o << "import com.sun.star.uno.Any;\n";
      69           0 :             o << "import com.sun.star.beans.Ambiguous;\n";
      70           0 :             o << "import com.sun.star.beans.Defaulted;\n";
      71           0 :             o << "import com.sun.star.beans.Optional;\n";
      72           0 :             o << "import com.sun.star.lib.uno.helper.PropertySetMixin;\n";
      73             :         }
      74             :     }
      75           0 : }
      76             : 
      77           0 : void generateCompFunctions(std::ostream & o, const OString & classname)
      78             : {
      79             :     o << "    public static XSingleComponentFactory __getComponentFactory("
      80             :         " String sImplementationName ) {\n"
      81             :         "        XSingleComponentFactory xFactory = null;\n\n"
      82             :         "        if ( sImplementationName.equals( m_implementationName ) )\n"
      83           0 :         "            xFactory = Factory.createComponentFactory("
      84           0 :       << classname << ".class, m_serviceNames);\n"
      85           0 :         "        return xFactory;\n    }\n\n";
      86             : 
      87             :     o << "    public static boolean __writeRegistryServiceInfo("
      88             :         " XRegistryKey xRegistryKey ) {\n"
      89             :         "        return Factory.writeRegistryServiceInfo(m_implementationName,\n"
      90             :         "                                                m_serviceNames,\n"
      91             :         "                                                xRegistryKey);\n"
      92           0 :         "    }\n\n";
      93           0 : }
      94             : 
      95           0 : void generateXServiceInfoBodies(std::ostream& o)
      96             : {
      97           0 :     o << "    // com.sun.star.lang.XServiceInfo:\n";
      98           0 :     o << "    public String getImplementationName() {\n"
      99           0 :       << "         return m_implementationName;\n    }\n\n";
     100             : 
     101           0 :     o << "    public boolean supportsService( String sService ) {\n"
     102           0 :       << "        int len = m_serviceNames.length;\n\n"
     103           0 :       << "        for( int i=0; i < len; i++) {\n"
     104           0 :       << "            if (sService.equals(m_serviceNames[i]))\n"
     105           0 :       << "                return true;\n"
     106           0 :       << "        }\n        return false;\n    }\n\n";
     107             : 
     108           0 :     o << "    public String[] getSupportedServiceNames() {\n"
     109           0 :       << "        return m_serviceNames;\n    }\n\n";
     110           0 : }
     111             : 
     112           0 : void generateXPropertySetBodies(std::ostream& o)
     113             : {
     114           0 :     o << "    // com.sun.star.beans.XPropertySet:\n";
     115             :     o << "    public com.sun.star.beans.XPropertySetInfo getPropertySetInfo()\n"
     116           0 :       "    {\n        return m_prophlp.getPropertySetInfo();\n    }\n\n";
     117             : 
     118             :     o << "    public void setPropertyValue(String aPropertyName, "
     119             :         "Object aValue) throws "
     120             :         "com.sun.star.beans.UnknownPropertyException, "
     121             :         "com.sun.star.beans.PropertyVetoException, "
     122             :         "com.sun.star.lang.IllegalArgumentException,"
     123             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     124           0 :         "m_prophlp.setPropertyValue(aPropertyName, aValue);\n    }\n\n";
     125             : 
     126             :     o << "    public Object getPropertyValue(String "
     127             :         "aPropertyName) throws com.sun.star.beans.UnknownPropertyException, "
     128             :         "com.sun.star.lang.WrappedTargetException\n    {\n        return "
     129           0 :         "m_prophlp.getPropertyValue(aPropertyName);\n    }\n\n";
     130             : 
     131             :     o << "    public void addPropertyChangeListener(String aPropertyName"
     132             :         ", com.sun.star.beans.XPropertyChangeListener xListener) throws "
     133             :         "com.sun.star.beans.UnknownPropertyException, "
     134             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     135           0 :         "m_prophlp.addPropertyChangeListener(aPropertyName, xListener);\n    }\n\n";
     136             : 
     137             :     o << "    public void removePropertyChangeListener(String "
     138             :         "aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) "
     139             :         "throws com.sun.star.beans.UnknownPropertyException, "
     140             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     141             :         "m_prophlp.removePropertyChangeListener(aPropertyName, xListener);\n"
     142           0 :         "    }\n\n";
     143             : 
     144             :     o << "    public void addVetoableChangeListener(String aPropertyName"
     145             :         ", com.sun.star.beans.XVetoableChangeListener xListener) throws "
     146             :         "com.sun.star.beans.UnknownPropertyException, "
     147             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     148           0 :         "m_prophlp.addVetoableChangeListener(aPropertyName, xListener);\n    }\n\n";
     149             : 
     150             :     o << "    public void removeVetoableChangeListener(String "
     151             :         "aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) "
     152             :         "throws com.sun.star.beans.UnknownPropertyException, "
     153             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     154           0 :         "m_prophlp.removeVetoableChangeListener(aPropertyName, xListener);\n }\n\n";
     155           0 : }
     156             : 
     157           0 : void generateXFastPropertySetBodies(std::ostream& o)
     158             : {
     159           0 :     o << "    // com.sun.star.beans.XFastPropertySet:\n";
     160             : 
     161             :     o << "    public void setFastPropertyValue(int nHandle, Object "
     162             :         "aValue) throws com.sun.star.beans.UnknownPropertyException, "
     163             :         "com.sun.star.beans.PropertyVetoException, "
     164             :         "com.sun.star.lang.IllegalArgumentException, "
     165             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     166           0 :         "m_prophlp.setFastPropertyValue(nHandle, aValue);\n    }\n\n";
     167             : 
     168             :     o << "    public Object getFastPropertyValue(int nHandle) throws "
     169             :         "com.sun.star.beans.UnknownPropertyException, "
     170             :         "com.sun.star.lang.WrappedTargetException\n    {\n        return "
     171           0 :         "m_prophlp.getFastPropertyValue(nHandle);\n    }\n\n";
     172           0 : }
     173             : 
     174           0 : void generateXPropertyAccessBodies(std::ostream& o)
     175             : {
     176           0 :     o << "    // com.sun.star.beans.XPropertyAccess:\n";
     177             : 
     178             :     o << "    public com.sun.star.beans.PropertyValue[] getPropertyValues()\n"
     179           0 :         " {\n        return m_prophlp.getPropertyValues();\n    }\n\n";
     180             : 
     181             :     o << "    public void setPropertyValues(com.sun.star.beans.PropertyValue[] "
     182             :         "aProps) throws com.sun.star.beans.UnknownPropertyException, "
     183             :         "com.sun.star.beans.PropertyVetoException, "
     184             :         "com.sun.star.lang.IllegalArgumentException, "
     185             :         "com.sun.star.lang.WrappedTargetException\n    {\n        "
     186           0 :         "m_prophlp.setPropertyValues(aProps);\n    }\n\n";
     187           0 : }
     188             : 
     189             : 
     190           0 : bool checkAttribute(
     191             :     OStringBuffer& attributeValue,
     192             :     unoidl::AccumulationBasedServiceEntity::Property::Attributes attribute)
     193             : {
     194           0 :     bool cast = false;
     195             :     sal_uInt16 attributes[9] = {
     196             :         /* com::sun::star::beans::PropertyValue::MAYBEVOID */ 1,
     197             :         /* com::sun::star::beans::PropertyValue::BOUND */ 2,
     198             :         /* com::sun::star::beans::PropertyValue::CONSTRAINED */ 4,
     199             :         /* com::sun::star::beans::PropertyValue::TRANSIENT */ 8,
     200             :         /* com::sun::star::beans::PropertyValue::READONLY */ 16,
     201             :         /* com::sun::star::beans::PropertyValue::MAYBEAMBIGIOUS */ 32,
     202             :         /* com::sun::star::beans::PropertyValue::MAYBEDEFAULT */ 64,
     203             :         /* com::sun::star::beans::PropertyValue::REMOVABLE */ 128,
     204           0 :         /* com::sun::star::beans::PropertyValue::OPTIONAL */ 256 };
     205             : 
     206           0 :     for (sal_uInt16 i = 0; i < 9; i++)
     207             :     {
     208           0 :         if (attribute & attributes[i]) {
     209           0 :             if (!attributeValue.isEmpty()) {
     210           0 :                 cast |= true;
     211           0 :                 attributeValue.append("|");
     212             :             }
     213           0 :             switch (attributes[i])
     214             :             {
     215             :             case 1:
     216           0 :                 attributeValue.append("PropertyAttribute.MAYBEVOID");
     217           0 :                 break;
     218             :             case 2:
     219           0 :                 attributeValue.append("PropertyAttribute.BOUND");
     220           0 :                 break;
     221             :             case 4:
     222           0 :                 attributeValue.append("PropertyAttribute.CONSTRAINED");
     223           0 :                 break;
     224             :             case 8:
     225           0 :                 attributeValue.append("PropertyAttribute.TRANSIENT");
     226           0 :                 break;
     227             :             case 16:
     228           0 :                 attributeValue.append("PropertyAttribute.READONLY");
     229           0 :                 break;
     230             :             case 32:
     231           0 :                 attributeValue.append("PropertyAttribute.MAYBEAMBIGIOUS");
     232           0 :                 break;
     233             :             case 64:
     234           0 :                 attributeValue.append("PropertyAttribute.MAYBEDEFAULT");
     235           0 :                 break;
     236             :             case 128:
     237           0 :                 attributeValue.append("PropertyAttribute.REMOVABLE");
     238           0 :                 break;
     239             :             case 256:
     240           0 :                 attributeValue.append("PropertyAttribute.OPTIONAL");
     241           0 :                 break;
     242             :             }
     243             :         }
     244             :     }
     245           0 :     if (cast) {
     246           0 :         attributeValue.insert(0, '(');
     247           0 :         attributeValue.append(')');
     248             :     }
     249             : 
     250           0 :     return cast;
     251             : }
     252             : 
     253           0 : void registerProperties(std::ostream& o,
     254             :                         const AttributeInfo& properties,
     255             :                         const OString& indentation)
     256             : {
     257           0 :     if (!properties.empty()) {
     258           0 :         bool cast = false;
     259           0 :         OStringBuffer attributeValue;
     260           0 :         for (AttributeInfo::const_iterator i(properties.begin());
     261           0 :              i != properties.end(); ++i)
     262             :         {
     263           0 :             if (i->attributes != 0) {
     264           0 :                 cast = checkAttribute(attributeValue, i->attributes);
     265             :             } else {
     266           0 :                 cast = true;
     267           0 :                 attributeValue.append('0');
     268             :             }
     269             : 
     270           0 :             o << indentation << "registerProperty(\"" << i->name
     271           0 :               << "\", \"m_" << i->name << "\",\n"
     272           0 :               << indentation << "      ";
     273           0 :             if (cast)
     274           0 :                 o << "(short)";
     275             : 
     276           0 :             o << attributeValue.makeStringAndClear() << ");\n";
     277           0 :         }
     278             :     }
     279           0 : }
     280             : 
     281           0 : void generateXLocalizableBodies(std::ostream& o) {
     282             :     // com.sun.star.lang.XLocalizable:
     283             :     // setLocale
     284             :     o << "    // com.sun.star.lang.XLocalizable:\n"
     285             :         "    public void setLocale(com.sun.star.lang.Locale eLocale)\n    {\n"
     286           0 :         "        m_locale = eLocale;\n    }\n\n";
     287             : 
     288             :     // getLocale
     289             :     o << "    public com.sun.star.lang.Locale getLocale()\n    {\n"
     290           0 :         "        return m_locale;\n    }\n\n";
     291           0 : }
     292             : 
     293           0 : void generateXAddInBodies(std::ostream& o, ProgramOptions const & options)
     294             : {
     295             :     // com.sun.star.sheet.XAddIn:
     296             :     // getProgrammaticFuntionName
     297             :     o << "    // com.sun.star.sheet.XAddIn:\n"
     298             :         "    public String getProgrammaticFuntionName(String "
     299             :         "aDisplayName)\n    {\n"
     300             :         "        try {\n"
     301             :         "            com.sun.star.container.XNameAccess xNAccess =\n"
     302             :         "                (com.sun.star.container.XNameAccess)UnoRuntime."
     303             :         "queryInterface(\n"
     304             :         "                    com.sun.star.container.XNameAccess.class, m_xHAccess);"
     305             :         "\n            String functions[] = xNAccess.getElementNames();\n"
     306             :         "            String sDisplayName = \"\";\n"
     307             :         "            int len = functions.length;\n"
     308             :         "            for (int i=0; i < len; ++i) {\n"
     309             :         "                sDisplayName = com.sun.star.uno.AnyConverter.toString(\n"
     310             :         "                    getAddinProperty(functions[i], \"\", sDISPLAYNAME));\n"
     311             :         "                if (sDisplayName.equals(aDisplayName))\n"
     312             :         "                    return functions[i];\n            }\n"
     313             :         "        }\n        catch ( com.sun.star.uno.RuntimeException e ) {\n"
     314             :         "            throw e;\n        }\n"
     315             :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n\n"
     316           0 :         "        return \"\";\n    }\n\n";
     317             : 
     318             :     // getDisplayFunctionName
     319             :     o << "    public String getDisplayFunctionName(String "
     320             :         "aProgrammaticName)\n    {\n"
     321             :         "        return getAddinProperty(aProgrammaticName, \"\", sDISPLAYNAME);\n"
     322           0 :         "    }\n\n";
     323             : 
     324             :     // getFunctionDescription
     325             :     o << "    public String getFunctionDescription(String "
     326             :         "aProgrammaticName)\n    {\n"
     327             :         "        return getAddinProperty(aProgrammaticName, \"\", sDESCRIPTION);\n"
     328           0 :         "    }\n\n";
     329             : 
     330             :     // getDisplayArgumentName
     331             :     o << "    public String getDisplayArgumentName(String "
     332           0 :         "aProgrammaticFunctionName, int nArgument)\n    {\n";
     333           0 :     if (options.java5) {
     334             :         o << "        return getAddinProperty(aProgrammaticFunctionName,\n"
     335             :             "                                m_functionMap.get(\n"
     336             :             "                                    aProgrammaticFunctionName).get("
     337             :             "nArgument),\n"
     338           0 :             "                                sDISPLAYNAME);\n    }\n\n";
     339             :     } else {
     340             :         o << "        return getAddinProperty(aProgrammaticFunctionName, (String)\n"
     341             :             "                                ((java.util.Hashtable)m_functionMap."
     342             :             "get(\n                                    aProgrammaticFunctionName))."
     343             :             "get(\n                                        new Integer(nArgument))"
     344           0 :             ", sDISPLAYNAME);\n    }\n\n";
     345             :     }
     346             : 
     347             :     // getArgumentDescription
     348             :     o << "    public String getArgumentDescription(String "
     349           0 :         "aProgrammaticFunctionName, int nArgument)\n    {\n";
     350           0 :     if (options.java5) {
     351             :         o << "        return getAddinProperty(aProgrammaticFunctionName,\n"
     352             :             "                                m_functionMap.get(\n"
     353             :             "                                    aProgrammaticFunctionName).get("
     354             :             "nArgument),\n"
     355           0 :             "                                sDESCRIPTION);\n    }\n\n";
     356             :     } else {
     357             :         o << "        return getAddinProperty(aProgrammaticFunctionName, (String)\n"
     358             :             "                                ((java.util.Hashtable)m_functionMap."
     359             :             "get(\n                                    aProgrammaticFunctionName))."
     360             :             "get(\n                                        new Integer(nArgument))"
     361           0 :             ", sDESCRIPTION);\n    }\n\n";
     362             :     }
     363             :     // getProgrammaticCategoryName
     364             :     o << "    public String getProgrammaticCategoryName(String "
     365             :         "aProgrammaticFunctionName)\n    {\n"
     366             :         "        return getAddinProperty(aProgrammaticFunctionName, \"\", "
     367           0 :         "sCATEGORY);\n    }\n\n";
     368             : 
     369             :     // getDisplayCategoryName
     370             :     o << "    public String getDisplayCategoryName(String "
     371             :         "aProgrammaticFunctionName)\n    {\n"
     372             :         "        return getAddinProperty(aProgrammaticFunctionName, \"\", "
     373           0 :         "sCATEGORYDISPLAYNAME);\n    }\n\n";
     374           0 : }
     375             : 
     376           0 : void generateXCompatibilityNamesBodies(std::ostream& o)
     377             : {
     378             :     o << "    // com.sun.star.sheet.XCompatibilityNames:\n"
     379             :         "    public com.sun.star.sheet.LocalizedName[] getCompatibilityNames("
     380             :         "String aProgrammaticName)\n    {\n"
     381             :         "        com.sun.star.sheet.LocalizedName[] seqLocalizedNames =\n"
     382           0 :         "            new com.sun.star.sheet.LocalizedName[0];\n\n        try {\n";
     383             : 
     384             :     o << "            StringBuffer path = new StringBuffer(aProgrammaticName);\n"
     385             :         "            path.append(\"/CompatibilityName\");\n"
     386           0 :         "            String hname = path.toString();\n\n";
     387             : 
     388             :     o << "            if ( m_xCompAccess.hasByHierarchicalName(hname) ) {\n"
     389             :         "                com.sun.star.container.XNameAccess xNameAccess =\n"
     390             :         "                    (com.sun.star.container.XNameAccess)UnoRuntime."
     391             :         "queryInterface(\n"
     392             :         "                        com.sun.star.container.XNameAccess.class,\n"
     393             :         "                        m_xCompAccess.getByHierarchicalName(hname));\n\n"
     394             :         "                String elems[] = xNameAccess.getElementNames();\n"
     395             :         "                int len = elems.length;\n"
     396             :         "                seqLocalizedNames = new com.sun.star.sheet.LocalizedName"
     397           0 :         "[len];\n                String sCompatibilityName = \"\";\n\n";
     398             : 
     399             :     o << "                for (int i=0; i < len; ++i) {\n"
     400             :         "                    String sLocale = elems[i];\n"
     401             :         "                    sCompatibilityName = com.sun.star.uno.AnyConverter."
     402             :         "toString(\n                        xNameAccess.getByName(sLocale));\n\n"
     403             :         "                    com.sun.star.lang.Locale aLocale = \n"
     404             :         "                        new com.sun.star.lang.Locale();\n\n"
     405             :         "                    String tokens[] = sLocale.split(\"-\");\n"
     406             :         "                    int nToken = tokens.length;\n"
     407             :         "                    if (nToken >= 1) aLocale.Language = tokens[0];\n"
     408             :         "                    if (nToken >= 2) aLocale.Country = tokens[1];\n"
     409             :         "                    if (nToken >= 3)  {\n"
     410             :         "                        StringBuffer buf = \n"
     411             :         "                            new StringBuffer(tokens[2]);\n"
     412             :         "                        for (int t=3; t < nToken; ++t)\n"
     413             :         "                            buf.append(tokens[t]);\n\n"
     414             :         "                        aLocale.Variant = buf.toString();\n"
     415             :         "                    }\n\n"
     416             :         "                    seqLocalizedNames[i].Locale = aLocale;\n"
     417             :         "                    seqLocalizedNames[i].Name = sCompatibilityName;\n"
     418             :         "                }\n        }\n        }\n"
     419             :         "        catch ( com.sun.star.uno.RuntimeException e ) {\n"
     420             :         "            throw e;\n        }\n"
     421             :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n\n"
     422           0 :         "        return seqLocalizedNames;\n    }\n\n";
     423           0 : }
     424             : 
     425           0 : void generateXInitializationBodies(std::ostream& o)
     426             : {
     427             :     o << "    // com.sun.star.lang.XInitialization:\n"
     428             :         "    public void initialize( Object[] object )\n"
     429             :         "        throws com.sun.star.uno.Exception\n    {\n"
     430             :         "        if ( object.length > 0 )\n        {\n"
     431             :         "            m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(\n"
     432           0 :         "                com.sun.star.frame.XFrame.class, object[0]);\n        }\n    }\n\n";
     433           0 : }
     434             : 
     435           0 : void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options)
     436             : {
     437             :     // com.sun.star.frame.XDispatch
     438             :     // dispatch
     439             :     o << "    // com.sun.star.frame.XDispatch:\n"
     440             :         "     public void dispatch( com.sun.star.util.URL aURL,\n"
     441           0 :         "                           com.sun.star.beans.PropertyValue[] aArguments )\n    {\n";
     442             : 
     443           0 :     ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin();
     444           0 :     while (iter != options.protocolCmdMap.end()) {
     445           0 :         o << "         if ( aURL.Protocol.compareTo(\"" << (*iter).first
     446           0 :           << "\") == 0 )\n        {\n";
     447             : 
     448           0 :         for (std::vector< OString >::const_iterator i = (*iter).second.begin();
     449           0 :              i != (*iter).second.end(); ++i) {
     450           0 :             o << "            if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n"
     451             :                 "            {\n                // add your own code here\n"
     452           0 :                 "                return;\n            }\n";
     453             :         }
     454             : 
     455           0 :         o << "        }\n";
     456           0 :         ++iter;
     457             :     }
     458           0 :     o << "    }\n\n";
     459             : 
     460             :     // addStatusListener
     461             :     o << "    public void addStatusListener( com.sun.star.frame.XStatusListener xControl,\n"
     462             :         "                                    com.sun.star.util.URL aURL )\n    {\n"
     463           0 :         "        // add your own code here\n    }\n\n";
     464             : 
     465             :     // com.sun.star.frame.XDispatch
     466             :     o << "    public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,\n"
     467             :         "                                       com.sun.star.util.URL aURL )\n    {\n"
     468           0 :         "        // add your own code here\n    }\n\n";
     469           0 : }
     470             : 
     471           0 : void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & options)
     472             : {
     473             :     // com.sun.star.frame.XDispatchProvider
     474             :     // queryDispatch
     475             :     o << "    // com.sun.star.frame.XDispatchProvider:\n"
     476             :         "    public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,\n"
     477             :         "                                                       String sTargetFrameName,\n"
     478           0 :         "                                                       int iSearchFlags )\n    {\n";
     479             : 
     480           0 :     ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin();
     481           0 :     while (iter != options.protocolCmdMap.end()) {
     482           0 :         o << "        if ( aURL.Protocol.compareTo(\"" << (*iter).first
     483           0 :           << "\") == 0 )\n        {\n";
     484             : 
     485           0 :         for (std::vector< OString >::const_iterator i = (*iter).second.begin();
     486           0 :              i != (*iter).second.end(); ++i) {
     487           0 :             o << "            if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n"
     488           0 :                 "                return this;\n";
     489             :         }
     490             : 
     491           0 :         o << "        }\n";
     492           0 :         ++iter;
     493             :     }
     494           0 :     o << "        return null;\n    }\n\n";
     495             : 
     496             :     // queryDispatches
     497             :     o << "    // com.sun.star.frame.XDispatchProvider:\n"
     498             :         "    public com.sun.star.frame.XDispatch[] queryDispatches(\n"
     499             :         "         com.sun.star.frame.DispatchDescriptor[] seqDescriptors )\n    {\n"
     500             :         "        int nCount = seqDescriptors.length;\n"
     501             :         "        com.sun.star.frame.XDispatch[] seqDispatcher =\n"
     502             :         "            new com.sun.star.frame.XDispatch[seqDescriptors.length];\n\n"
     503             :         "        for( int i=0; i < nCount; ++i )\n        {\n"
     504             :         "            seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,\n"
     505             :         "                                             seqDescriptors[i].FrameName,\n"
     506             :         "                                             seqDescriptors[i].SearchFlags );\n"
     507           0 :         "        }\n        return seqDispatcher;\n    }\n\n";
     508           0 : }
     509             : 
     510           0 : void generateMethodBodies(std::ostream& o,
     511             :          ProgramOptions const & options,
     512             :          rtl::Reference< TypeManager > const & manager,
     513             :          const std::set< OUString >& interfaces,
     514             :          const OString& indentation, bool usepropertymixin)
     515             : {
     516           0 :     std::set< OUString >::const_iterator iter = interfaces.begin();
     517           0 :     codemaker::GeneratedTypeSet generated;
     518           0 :     while (iter != interfaces.end()) {
     519           0 :         OUString type(*iter);
     520           0 :         ++iter;
     521           0 :         if (type.equals("com.sun.star.lang.XServiceInfo")) {
     522           0 :             generateXServiceInfoBodies(o);
     523           0 :             generated.add(u2b(type));
     524             :         } else {
     525           0 :             if (options.componenttype == 2) {
     526           0 :                 if (type.equals("com.sun.star.lang.XServiceName")) {
     527             :                     o << "    // com.sun.star.lang.XServiceName:\n"
     528             :                         "    public String getServiceName() {\n"
     529           0 :                         "        return sADDIN_SERVICENAME;\n    }\n";
     530           0 :                     generated.add(u2b(type));
     531           0 :                     continue;
     532           0 :                 } else if (type.equals("com.sun.star.sheet.XAddIn")) {
     533           0 :                     generateXAddInBodies(o, options);
     534           0 :                     generated.add(u2b(type));
     535             : 
     536             :                     // special handling of XLocalizable -> parent of XAddIn
     537           0 :                     if (!generated.contains("com.sun.star.lang.XLocalizable")) {
     538           0 :                         generateXLocalizableBodies(o);
     539           0 :                         generated.add("com.sun.star.lang.XLocalizable");
     540             :                     }
     541           0 :                     continue;
     542           0 :                 } else if (type.equals("com.sun.star.lang.XLocalizable")) {
     543           0 :                     generateXLocalizableBodies(o);
     544           0 :                     generated.add(u2b(type));
     545           0 :                     continue;
     546           0 :                 } else if (type.equals("com.sun.star.sheet.XCompatibilityNames")) {
     547           0 :                     generateXCompatibilityNamesBodies(o);
     548           0 :                     generated.add(u2b(type));
     549           0 :                     continue;
     550             :                 }
     551             :             }
     552           0 :             if (options.componenttype == 3) {
     553           0 :                 if (type.equals("com.sun.star.lang.XInitialization")) {
     554           0 :                     generateXInitializationBodies(o);
     555           0 :                     generated.add(u2b(type));
     556           0 :                     continue;
     557           0 :                 } else if (type.equals("com.sun.star.frame.XDispatch")) {
     558           0 :                     generateXDispatchBodies(o, options);
     559           0 :                     generated.add(u2b(type));
     560           0 :                     continue;
     561           0 :                 } else if (type.equals("com.sun.star.frame.XDispatchProvider")) {
     562           0 :                     generateXDispatchProviderBodies(o, options);
     563           0 :                     generated.add(u2b(type));
     564           0 :                     continue;
     565             :                 }
     566             :             }
     567             :             printMethods(o, options, manager, type, generated, "_",
     568           0 :                          indentation, true, usepropertymixin);
     569             :         }
     570           0 :     }
     571           0 : }
     572             : 
     573             : static const char* propcomment=
     574             : "        // use the last parameter of the PropertySetMixin constructor\n"
     575             : "        // for your optional attributes if necessary. See the documentation\n"
     576             : "        // of the PropertySetMixin helper for further information.\n"
     577             : "        // Ensure that your attributes are initialized correctly!\n";
     578             : 
     579             : 
     580           0 : void generateAddinConstructorAndHelper(std::ostream& o,
     581             :          ProgramOptions const & options,
     582             :          rtl::Reference< TypeManager > const & manager, const OString & classname,
     583             :          const std::set< OUString >& services,
     584             :          const std::set< OUString >& interfaces)
     585             : {
     586             :     o << "    private com.sun.star.lang.Locale m_locale = "
     587           0 :         "new com.sun.star.lang.Locale();\n";
     588             : 
     589           0 :     if (!options.backwardcompatible) {
     590             :         // Constructor
     591           0 :         o << "\n    public " << classname << "( XComponentContext context )\n"
     592           0 :             "    {\n        m_xContext = context;\n    }\n\n";
     593           0 :         return;
     594             :     }
     595             : 
     596             : 
     597             :     // get the one and only add-in service for later use
     598           0 :     std::set< OUString >::const_iterator iter = services.begin();
     599           0 :     OUString sAddinService = *iter;
     600           0 :     if (sAddinService == "com.sun.star.sheet.AddIn") {
     601           0 :         sAddinService = *(++iter);
     602             :     }
     603             : 
     604             : 
     605             :     // add-in specific fields
     606           0 :     o << "\n    private static final String sADDIN_SERVICENAME = \""
     607           0 :       << sAddinService << "\";\n\n";
     608             :     o << "    private static final String sDISPLAYNAME = "
     609             :         "\"DisplayName\";\n"
     610             :         "    private static final String sDESCRIPTION = "
     611             :         "\"Description\";\n"
     612             :         "    private static final String sCATEGORY = \"Category\";\n"
     613             :         "    private static final String sCATEGORYDISPLAYNAME = "
     614           0 :         "\"CategoryDisplayName\";\n\n";
     615             : 
     616             :     o << "    private com.sun.star.container.XHierarchicalNameAccess  "
     617             :         "m_xHAccess = null;\n"
     618             :         "    private com.sun.star.container.XHierarchicalNameAccess  "
     619           0 :         "m_xCompAccess = null;\n";
     620           0 :     if (options.java5) {
     621             :         o << "    private java.util.Hashtable<\n        String, "
     622           0 :             "java.util.Hashtable< Integer, String> > m_functionMap = null;\n\n";
     623             :     } else {
     624           0 :         o << "    private java.util.Hashtable m_functionMap = null;\n\n";
     625             :     }
     626             :     // Constructor
     627           0 :     o << "\n    public " << classname << "( XComponentContext context )\n    {\n"
     628             :         "        m_xContext = context;\n\n"
     629           0 :         "        try {\n";
     630             : 
     631           0 :     if (options.java5) {
     632             :         o << "        m_functionMap = new java.util.Hashtable<\n"
     633             :             "            String, java.util.Hashtable< Integer, "
     634           0 :             "String > >();\n\n";
     635             :     } else {
     636           0 :         o << "        m_functionMap = new java.util.Hashtable();\n\n";
     637             :     }
     638             : 
     639           0 :     generateFunctionParameterMap(o, options,  manager, interfaces);
     640             : 
     641             :     o << "        com.sun.star.lang.XMultiServiceFactory xProvider = \n"
     642             :         "            (com.sun.star.lang.XMultiServiceFactory)UnoRuntime."
     643             :         "queryInterface(\n"
     644             :         "                com.sun.star.lang.XMultiServiceFactory.class,\n"
     645             :         "                m_xContext.getServiceManager().createInstanceWithContext("
     646             :         "\n                    \"com.sun.star.configuration.ConfigurationProvider\""
     647           0 :         ",\n                    m_xContext));\n\n";
     648             : 
     649             :     o << "        String sReadOnlyView = "
     650           0 :         "\"com.sun.star.configuration.ConfigurationAccess\";\n\n";
     651             : 
     652             :     o << "        StringBuffer sPath = new StringBuffer(\n"
     653             :         "             \"/org.openoffice.Office.CalcAddIns/AddInInfo/\");\n"
     654             :         "        sPath.append(sADDIN_SERVICENAME);\n"
     655           0 :         "        sPath.append(\"/AddInFunctions\");\n\n";
     656             : 
     657             :     o << "        // create arguments: nodepath\n"
     658             :         "         com.sun.star.beans.PropertyValue aArgument = \n"
     659             :         "             new com.sun.star.beans.PropertyValue();\n"
     660             :         "         aArgument.Name = \"nodepath\";\n"
     661             :         "         aArgument.Value = new com.sun.star.uno.Any(\n"
     662           0 :         "             com.sun.star.uno.Type.STRING, sPath.toString());\n\n";
     663             : 
     664             :     o << "        Object aArguments[] = new Object[1];\n"
     665             :         "        aArguments[0] = new com.sun.star.uno.Any("
     666             :         " new com.sun.star.uno.Type(\n"
     667           0 :         "            com.sun.star.beans.PropertyValue.class), aArgument);\n\n";
     668             : 
     669             :     o << "        // create the default view using default UI locale\n"
     670             :         "         Object xIface = \n"
     671             :         "             xProvider.createInstanceWithArguments(sReadOnlyView, "
     672           0 :         "aArguments);\n\n";
     673             : 
     674             :     o << "        m_xHAccess = (com.sun.star.container.XHierarchicalNameAccess)\n"
     675             :         "             UnoRuntime.queryInterface(\n"
     676             :         "                 com.sun.star.container.XHierarchicalNameAccess.class, "
     677           0 :         "xIface);\n\n";
     678             : 
     679             :     o << "        // extends arguments to create a view for all locales to get "
     680             :         "simple\n        // access to the compatibilityname property\n"
     681             :         "        aArguments = new Object[2];\n"
     682             :         "        aArguments[0] = new com.sun.star.uno.Any( "
     683             :         "new com.sun.star.uno.Type(\n"
     684             :         "            com.sun.star.beans.PropertyValue.class), aArgument);\n"
     685             :         "        aArgument.Name = \"locale\";\n"
     686             :         "        aArgument.Value = new com.sun.star.uno.Any(\n"
     687             :         "            com.sun.star.uno.Type.STRING, \"*\");\n"
     688             :         "        aArguments[1] = new com.sun.star.uno.Any( "
     689             :         " new com.sun.star.uno.Type(\n"
     690           0 :         "            com.sun.star.beans.PropertyValue.class), aArgument);\n\n";
     691             : 
     692             :     o << "        // create view for all locales\n"
     693             :         "        xIface = xProvider.createInstanceWithArguments(sReadOnlyView, "
     694             :         "aArguments);\n\n"
     695             :         "        m_xCompAccess = (com.sun.star.container.XHierarchicalNameAccess)\n"
     696             :         "            UnoRuntime.queryInterface(\n"
     697             :         "                com.sun.star.container.XHierarchicalNameAccess.class, "
     698             :         "xIface);\n        }\n"
     699           0 :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n    }\n\n";
     700             : 
     701             :     // add-in helper function
     702             :     o << "    // addin configuration property helper function:\n"
     703             :         "    String getAddinProperty(String funcName, "
     704             :         "String paramName, String propName)\n    {\n"
     705             :         "        try {\n            StringBuffer buf = "
     706             :         "new StringBuffer(funcName);\n\n"
     707             :         "            if (paramName.length() > 0) {\n"
     708             :         "                buf.append(\"/Parameters/\");\n"
     709           0 :         "                buf.append(paramName);\n            }\n\n";
     710             : 
     711             :     o << "            com.sun.star.beans.XPropertySet xPropSet =\n"
     712             :         "                (com.sun.star.beans.XPropertySet)UnoRuntime."
     713             :         "queryInterface(\n"
     714             :         "                    com.sun.star.beans.XPropertySet.class,\n"
     715             :         "                    m_xHAccess.getByHierarchicalName(buf.toString()));\n\n"
     716             :         "            return com.sun.star.uno.AnyConverter.toString(\n"
     717             :         "                xPropSet.getPropertyValue(propName));\n        }\n"
     718             :         "        catch ( com.sun.star.uno.RuntimeException e ) {\n"
     719             :         "            throw e;\n        }\n"
     720             :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n"
     721           0 :         "        return \"\";\n    }\n\n";
     722             : }
     723             : 
     724             : 
     725           0 : void generateClassDefinition(std::ostream& o,
     726             :          ProgramOptions const & options,
     727             :          rtl::Reference< TypeManager > const & manager,
     728             :          const OString & classname,
     729             :          const std::set< OUString >& services,
     730             :          const std::set< OUString >& interfaces,
     731             :          const AttributeInfo& properties,
     732             :          const AttributeInfo& attributes,
     733             :          const OUString& propertyhelper, bool supportxcomponent)
     734             : {
     735           0 :     o << "\n\npublic final class " << classname << " extends ";
     736             : 
     737           0 :     if (!interfaces.empty()) {
     738           0 :         if (propertyhelper.equals("_")) {
     739           0 :                 o << "PropertySet\n";
     740             :         } else {
     741           0 :             if (supportxcomponent)
     742           0 :                 o << "ComponentBase\n";
     743             :             else
     744           0 :                 o << "WeakBase\n";
     745             :         }
     746           0 :         o << "   implements ";
     747           0 :         std::set< OUString >::const_iterator iter = interfaces.begin();
     748           0 :         while (iter != interfaces.end()) {
     749           0 :             o << (*iter);
     750           0 :             ++iter;
     751           0 :             if (iter != interfaces.end())
     752           0 :                 o << ",\n              ";
     753             :         }
     754             :     }
     755           0 :     o << "\n{\n";
     756             : 
     757           0 :     o << "    private final XComponentContext m_xContext;\n";
     758             : 
     759             :     // additional member for add-ons
     760           0 :     if (options.componenttype == 3) {
     761           0 :         o << "    private com.sun.star.frame.XFrame m_xFrame;\n";
     762             :     }
     763             : 
     764             :     // check property helper
     765           0 :     if (propertyhelper.getLength() > 1)
     766           0 :         o << "    private final PropertySetMixin m_prophlp;\n";
     767             : 
     768           0 :     o << "    private static final String m_implementationName = "
     769           0 :       << classname << ".class.getName();\n";
     770             : 
     771           0 :     if (!services.empty()) {
     772           0 :         o << "    private static final String[] m_serviceNames = {\n";
     773           0 :         std::set< OUString >::const_iterator iter = services.begin();
     774           0 :         while (iter != services.end()) {
     775           0 :             o << "        \"" << (*iter).replace('/','.') << "\"";
     776           0 :             ++iter;
     777           0 :             if (iter != services.end())
     778           0 :                 o << ",\n";
     779             :             else
     780           0 :                 o << " };\n\n";
     781             :         }
     782             :     }
     783             : 
     784             :     // attribute/property members
     785           0 :     if (!properties.empty()) {
     786             :         AttributeInfo::const_iterator iter =
     787           0 :             properties.begin();
     788           0 :         o << "    // properties\n";
     789           0 :         while (iter != properties.end()) {
     790           0 :             o << "    protected ";
     791           0 :             printType(o, options, manager, iter->type, false, false);
     792           0 :             o << " m_" << iter->name << ";\n";
     793           0 :             ++iter;
     794             :         }
     795           0 :     } else if (!attributes.empty()) {
     796             :         AttributeInfo::const_iterator iter =
     797           0 :             attributes.begin();
     798           0 :         o << "    // attributes\n";
     799           0 :         while (iter != attributes.end()) {
     800           0 :             o << "    private ";
     801           0 :             printType(o, options, manager, iter->type, false, false);
     802           0 :             o << " m_" << iter->name << " = ";
     803           0 :             printType(o, options, manager, iter->type, false, true);
     804           0 :             o <<";\n";
     805           0 :             ++iter;
     806             :         }
     807             :     }
     808             : 
     809             :     // special handling of calc add-ins
     810           0 :     if (options.componenttype == 2)
     811             :     {
     812             :         generateAddinConstructorAndHelper(o, options, manager, classname,
     813           0 :                                           services, interfaces);
     814             :     } else {
     815           0 :         o << "\n    public " << classname << "( XComponentContext context )\n"
     816           0 :             "    {\n        m_xContext = context;\n";
     817           0 :         if (propertyhelper.equals("_")) {
     818           0 :             registerProperties(o, properties, "        ");
     819             :         } else {
     820           0 :             if (propertyhelper.getLength() > 1) {
     821           0 :                 o << propcomment
     822           0 :                   << "        m_prophlp = new PropertySetMixin(m_xContext, this,\n"
     823           0 :                   << "            new Type(" << propertyhelper
     824           0 :                   << ".class), null);\n";
     825             :             }
     826             :         }
     827           0 :         o << "    };\n\n";
     828             : 
     829             :     }
     830             : 
     831           0 :     if (!services.empty())
     832           0 :         generateCompFunctions(o, classname);
     833             : 
     834             :     generateMethodBodies(o, options, manager, interfaces,
     835           0 :                          "    ", propertyhelper.getLength() > 1);
     836             : 
     837             :     // end of class definition
     838           0 :     o << "}\n";
     839           0 : }
     840             : 
     841           0 : void generateSkeleton(ProgramOptions const & options,
     842             :                       rtl::Reference< TypeManager > const & manager,
     843             :                       std::vector< OString > const & types)
     844             : {
     845           0 :     std::set< OUString > interfaces;
     846           0 :     std::set< OUString > services;
     847           0 :     AttributeInfo properties;
     848           0 :     AttributeInfo attributes;
     849           0 :     std::set< OUString > propinterfaces;
     850           0 :     bool serviceobject = false;
     851           0 :     bool supportxcomponent = false;
     852             : 
     853           0 :     std::vector< OString >::const_iterator iter = types.begin();
     854           0 :     while (iter != types.end()) {
     855           0 :         checkType(manager, b2u(*iter), interfaces, services, properties);
     856           0 :         ++iter;
     857             :     }
     858             : 
     859           0 :     if (options.componenttype == 3) {
     860             :         // the Protocolhandler service is mandatory for an protocol handler add-on,
     861             :         // so it is defaulted. The XDispatchProvider provides Dispatch objects for
     862             :         // certain functions and the generated impl object implements XDispatch
     863             :         // directly for simplicity reasons.
     864             :         checkType(manager, "com.sun.star.frame.ProtocolHandler",
     865           0 :                   interfaces, services, properties);
     866             :         checkType(manager, "com.sun.star.frame.XDispatch",
     867           0 :                   interfaces, services, properties);
     868             :     }
     869             : 
     870           0 :     if (options.componenttype == 2) {
     871           0 :         if (services.size() != 1) {
     872             :             throw CannotDumpException(
     873             :                 "for calc add-in components one and only one service type is "
     874           0 :                 "necessary! Please reference a valid type with the '-t' option.");
     875             :         }
     876             : 
     877             :         // if backwardcompatible==true the AddIn service needs to be added to the
     878             :         // suported service list, the necessary intefaces are mapped to the add-in
     879             :         // configuration. Since OO.org 2.0.4 this is obsolete and the add-in is
     880             :         // take form the configuration from Calc directly, this simplifies the
     881             :         // add-in code
     882           0 :         if (options.backwardcompatible) {
     883             :             checkType(manager, "com.sun.star.sheet.AddIn",
     884           0 :                       interfaces, services, properties);
     885             :         } else {
     886             :             // special case for the optional XLocalization interface. It should be
     887             :             // implemented always. But it is parent of the XAddIn and we need it only
     888             :             // if backwardcompatible is false.
     889           0 :             if (interfaces.find("com.sun.star.lang.XLocalizable") == interfaces.end()) {
     890           0 :                 interfaces.insert("com.sun.star.lang.XLocalizable");
     891             :             }
     892             :         }
     893             :     }
     894             : 
     895             : 
     896             :     // check if service object or simple UNO object
     897           0 :     if (!services.empty())
     898           0 :         serviceobject = true;
     899             : 
     900             :     OUString propertyhelper = checkPropertyHelper(
     901           0 :         options, manager, services, interfaces, attributes, propinterfaces);
     902           0 :     checkDefaultInterfaces(interfaces, services, propertyhelper);
     903             : 
     904           0 :     if (options.componenttype == 2) {
     905           0 :         if (!propertyhelper.isEmpty())
     906             :             std::cerr << "WARNING: interfaces specifying calc add-in functions "
     907           0 :                 "shouldn't support attributes!\n";
     908             :     }
     909             : 
     910           0 :     supportxcomponent = checkXComponentSupport(manager, interfaces);
     911             : 
     912           0 :     OString compFileName;
     913           0 :     OString tmpFileName;
     914           0 :     std::ostream* pofs = NULL;
     915             :     bool standardout = getOutputStream(options, ".java",
     916           0 :                                        &pofs, compFileName, tmpFileName);
     917             : 
     918             :     try {
     919           0 :         if (!standardout && options.license) {
     920           0 :             printLicenseHeader(*pofs, compFileName);
     921             :         }
     922             : 
     923           0 :         generatePackage(*pofs, options.implname);
     924             : 
     925             :         generateImports(*pofs, options, propertyhelper,
     926           0 :                         serviceobject, supportxcomponent);
     927             : 
     928           0 :         OString classname(options.implname);
     929           0 :         sal_Int32 index = 0;
     930           0 :         if ((index = classname.lastIndexOf('.')) > 0)
     931           0 :             classname = classname.copy(index+1);
     932             : 
     933             :         generateClassDefinition(*pofs, options, manager, classname, services,
     934             :                                 interfaces, properties, attributes, propertyhelper,
     935           0 :                                 supportxcomponent);
     936             : 
     937           0 :         if ( !standardout && pofs && ((std::ofstream*)pofs)->is_open()) {
     938           0 :             ((std::ofstream*)pofs)->close();
     939           0 :             delete pofs;
     940           0 :             OSL_VERIFY(makeValidTypeFile(compFileName, tmpFileName, sal_False));
     941           0 :         }
     942           0 :     } catch (CannotDumpException & e) {
     943           0 :         std::cerr << "ERROR: " << e.getMessage() << "\n";
     944           0 :         if ( !standardout ) {
     945           0 :             if (pofs && ((std::ofstream*)pofs)->is_open()) {
     946           0 :                 ((std::ofstream*)pofs)->close();
     947           0 :                 delete pofs;
     948             :             }
     949             :             // remove existing type file if something goes wrong to ensure
     950             :             // consistency
     951           0 :             if (fileExists(compFileName))
     952           0 :                 removeTypeFile(compFileName);
     953             : 
     954             :             // remove tmp file if something goes wrong
     955           0 :             removeTypeFile(tmpFileName);
     956             :         }
     957           0 :     }
     958           0 : }
     959             : 
     960           0 : } }
     961             : 
     962             : 
     963             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10