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

Generated by: LCOV version 1.10