LCOV - code coverage report
Current view: top level - unodevtools/source/skeletonmaker - javacompskeleton.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 373 0.0 %
Date: 2014-04-14 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 &)
     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             :     o << "        return getAddinProperty(aProgrammaticFunctionName,\n"
     334             :         "                                m_functionMap.get(\n"
     335             :         "                                    aProgrammaticFunctionName).get("
     336             :         "nArgument),\n"
     337           0 :         "                                sDISPLAYNAME);\n    }\n\n";
     338             : 
     339             :     // getArgumentDescription
     340             :     o << "    public String getArgumentDescription(String "
     341           0 :         "aProgrammaticFunctionName, int nArgument)\n    {\n";
     342             :     o << "        return getAddinProperty(aProgrammaticFunctionName,\n"
     343             :         "                                m_functionMap.get(\n"
     344             :         "                                    aProgrammaticFunctionName).get("
     345             :         "nArgument),\n"
     346           0 :         "                                sDESCRIPTION);\n    }\n\n";
     347             : 
     348             :     // getProgrammaticCategoryName
     349             :     o << "    public String getProgrammaticCategoryName(String "
     350             :         "aProgrammaticFunctionName)\n    {\n"
     351             :         "        return getAddinProperty(aProgrammaticFunctionName, \"\", "
     352           0 :         "sCATEGORY);\n    }\n\n";
     353             : 
     354             :     // getDisplayCategoryName
     355             :     o << "    public String getDisplayCategoryName(String "
     356             :         "aProgrammaticFunctionName)\n    {\n"
     357             :         "        return getAddinProperty(aProgrammaticFunctionName, \"\", "
     358           0 :         "sCATEGORYDISPLAYNAME);\n    }\n\n";
     359           0 : }
     360             : 
     361           0 : void generateXCompatibilityNamesBodies(std::ostream& o)
     362             : {
     363             :     o << "    // com.sun.star.sheet.XCompatibilityNames:\n"
     364             :         "    public com.sun.star.sheet.LocalizedName[] getCompatibilityNames("
     365             :         "String aProgrammaticName)\n    {\n"
     366             :         "        com.sun.star.sheet.LocalizedName[] seqLocalizedNames =\n"
     367           0 :         "            new com.sun.star.sheet.LocalizedName[0];\n\n        try {\n";
     368             : 
     369             :     o << "            StringBuffer path = new StringBuffer(aProgrammaticName);\n"
     370             :         "            path.append(\"/CompatibilityName\");\n"
     371           0 :         "            String hname = path.toString();\n\n";
     372             : 
     373             :     o << "            if ( m_xCompAccess.hasByHierarchicalName(hname) ) {\n"
     374             :         "                com.sun.star.container.XNameAccess xNameAccess =\n"
     375             :         "                    (com.sun.star.container.XNameAccess)UnoRuntime."
     376             :         "queryInterface(\n"
     377             :         "                        com.sun.star.container.XNameAccess.class,\n"
     378             :         "                        m_xCompAccess.getByHierarchicalName(hname));\n\n"
     379             :         "                String elems[] = xNameAccess.getElementNames();\n"
     380             :         "                int len = elems.length;\n"
     381             :         "                seqLocalizedNames = new com.sun.star.sheet.LocalizedName"
     382           0 :         "[len];\n                String sCompatibilityName = \"\";\n\n";
     383             : 
     384             :     o << "                for (int i=0; i < len; ++i) {\n"
     385             :         "                    String sLocale = elems[i];\n"
     386             :         "                    sCompatibilityName = com.sun.star.uno.AnyConverter."
     387             :         "toString(\n                        xNameAccess.getByName(sLocale));\n\n"
     388             :         "                    com.sun.star.lang.Locale aLocale = \n"
     389             :         "                        new com.sun.star.lang.Locale();\n\n"
     390             :         /* FIXME-BCP47: this will break. */
     391             :         "                    String tokens[] = sLocale.split(\"-\");\n"
     392             :         "                    int nToken = tokens.length;\n"
     393             :         "                    if (nToken >= 1) aLocale.Language = tokens[0];\n"
     394             :         "                    if (nToken >= 2) aLocale.Country = tokens[1];\n"
     395             :         "                    if (nToken >= 3)  {\n"
     396             :         "                        StringBuffer buf = \n"
     397             :         "                            new StringBuffer(tokens[2]);\n"
     398             :         "                        for (int t=3; t < nToken; ++t)\n"
     399             :         "                            buf.append(tokens[t]);\n\n"
     400             :         "                        aLocale.Variant = buf.toString();\n"
     401             :         "                    }\n\n"
     402             :         "                    seqLocalizedNames[i].Locale = aLocale;\n"
     403             :         "                    seqLocalizedNames[i].Name = sCompatibilityName;\n"
     404             :         "                }\n        }\n        }\n"
     405             :         "        catch ( com.sun.star.uno.RuntimeException e ) {\n"
     406             :         "            throw e;\n        }\n"
     407             :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n\n"
     408           0 :         "        return seqLocalizedNames;\n    }\n\n";
     409           0 : }
     410             : 
     411           0 : void generateXInitializationBodies(std::ostream& o)
     412             : {
     413             :     o << "    // com.sun.star.lang.XInitialization:\n"
     414             :         "    public void initialize( Object[] object )\n"
     415             :         "        throws com.sun.star.uno.Exception\n    {\n"
     416             :         "        if ( object.length > 0 )\n        {\n"
     417             :         "            m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(\n"
     418           0 :         "                com.sun.star.frame.XFrame.class, object[0]);\n        }\n    }\n\n";
     419           0 : }
     420             : 
     421           0 : void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options)
     422             : {
     423             :     // com.sun.star.frame.XDispatch
     424             :     // dispatch
     425             :     o << "    // com.sun.star.frame.XDispatch:\n"
     426             :         "     public void dispatch( com.sun.star.util.URL aURL,\n"
     427           0 :         "                           com.sun.star.beans.PropertyValue[] aArguments )\n    {\n";
     428             : 
     429           0 :     ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin();
     430           0 :     while (iter != options.protocolCmdMap.end()) {
     431           0 :         o << "         if ( aURL.Protocol.compareTo(\"" << (*iter).first
     432           0 :           << "\") == 0 )\n        {\n";
     433             : 
     434           0 :         for (std::vector< OString >::const_iterator i = (*iter).second.begin();
     435           0 :              i != (*iter).second.end(); ++i) {
     436           0 :             o << "            if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n"
     437             :                 "            {\n                // add your own code here\n"
     438           0 :                 "                return;\n            }\n";
     439             :         }
     440             : 
     441           0 :         o << "        }\n";
     442           0 :         ++iter;
     443             :     }
     444           0 :     o << "    }\n\n";
     445             : 
     446             :     // addStatusListener
     447             :     o << "    public void addStatusListener( com.sun.star.frame.XStatusListener xControl,\n"
     448             :         "                                    com.sun.star.util.URL aURL )\n    {\n"
     449           0 :         "        // add your own code here\n    }\n\n";
     450             : 
     451             :     // com.sun.star.frame.XDispatch
     452             :     o << "    public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,\n"
     453             :         "                                       com.sun.star.util.URL aURL )\n    {\n"
     454           0 :         "        // add your own code here\n    }\n\n";
     455           0 : }
     456             : 
     457           0 : void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & options)
     458             : {
     459             :     // com.sun.star.frame.XDispatchProvider
     460             :     // queryDispatch
     461             :     o << "    // com.sun.star.frame.XDispatchProvider:\n"
     462             :         "    public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,\n"
     463             :         "                                                       String sTargetFrameName,\n"
     464           0 :         "                                                       int iSearchFlags )\n    {\n";
     465             : 
     466           0 :     ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin();
     467           0 :     while (iter != options.protocolCmdMap.end()) {
     468           0 :         o << "        if ( aURL.Protocol.compareTo(\"" << (*iter).first
     469           0 :           << "\") == 0 )\n        {\n";
     470             : 
     471           0 :         for (std::vector< OString >::const_iterator i = (*iter).second.begin();
     472           0 :              i != (*iter).second.end(); ++i) {
     473           0 :             o << "            if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n"
     474           0 :                 "                return this;\n";
     475             :         }
     476             : 
     477           0 :         o << "        }\n";
     478           0 :         ++iter;
     479             :     }
     480           0 :     o << "        return null;\n    }\n\n";
     481             : 
     482             :     // queryDispatches
     483             :     o << "    // com.sun.star.frame.XDispatchProvider:\n"
     484             :         "    public com.sun.star.frame.XDispatch[] queryDispatches(\n"
     485             :         "         com.sun.star.frame.DispatchDescriptor[] seqDescriptors )\n    {\n"
     486             :         "        int nCount = seqDescriptors.length;\n"
     487             :         "        com.sun.star.frame.XDispatch[] seqDispatcher =\n"
     488             :         "            new com.sun.star.frame.XDispatch[seqDescriptors.length];\n\n"
     489             :         "        for( int i=0; i < nCount; ++i )\n        {\n"
     490             :         "            seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,\n"
     491             :         "                                             seqDescriptors[i].FrameName,\n"
     492             :         "                                             seqDescriptors[i].SearchFlags );\n"
     493           0 :         "        }\n        return seqDispatcher;\n    }\n\n";
     494           0 : }
     495             : 
     496           0 : void generateMethodBodies(std::ostream& o,
     497             :          ProgramOptions const & options,
     498             :          rtl::Reference< TypeManager > const & manager,
     499             :          const std::set< OUString >& interfaces,
     500             :          const OString& indentation, bool usepropertymixin)
     501             : {
     502           0 :     std::set< OUString >::const_iterator iter = interfaces.begin();
     503           0 :     codemaker::GeneratedTypeSet generated;
     504           0 :     while (iter != interfaces.end()) {
     505           0 :         OUString type(*iter);
     506           0 :         ++iter;
     507           0 :         if (type.equals("com.sun.star.lang.XServiceInfo")) {
     508           0 :             generateXServiceInfoBodies(o);
     509           0 :             generated.add(u2b(type));
     510             :         } else {
     511           0 :             if (options.componenttype == 2) {
     512           0 :                 if (type.equals("com.sun.star.lang.XServiceName")) {
     513             :                     o << "    // com.sun.star.lang.XServiceName:\n"
     514             :                         "    public String getServiceName() {\n"
     515           0 :                         "        return sADDIN_SERVICENAME;\n    }\n";
     516           0 :                     generated.add(u2b(type));
     517           0 :                     continue;
     518           0 :                 } else if (type.equals("com.sun.star.sheet.XAddIn")) {
     519           0 :                     generateXAddInBodies(o, options);
     520           0 :                     generated.add(u2b(type));
     521             : 
     522             :                     // special handling of XLocalizable -> parent of XAddIn
     523           0 :                     if (!generated.contains("com.sun.star.lang.XLocalizable")) {
     524           0 :                         generateXLocalizableBodies(o);
     525           0 :                         generated.add("com.sun.star.lang.XLocalizable");
     526             :                     }
     527           0 :                     continue;
     528           0 :                 } else if (type.equals("com.sun.star.lang.XLocalizable")) {
     529           0 :                     generateXLocalizableBodies(o);
     530           0 :                     generated.add(u2b(type));
     531           0 :                     continue;
     532           0 :                 } else if (type.equals("com.sun.star.sheet.XCompatibilityNames")) {
     533           0 :                     generateXCompatibilityNamesBodies(o);
     534           0 :                     generated.add(u2b(type));
     535           0 :                     continue;
     536             :                 }
     537             :             }
     538           0 :             if (options.componenttype == 3) {
     539           0 :                 if (type.equals("com.sun.star.lang.XInitialization")) {
     540           0 :                     generateXInitializationBodies(o);
     541           0 :                     generated.add(u2b(type));
     542           0 :                     continue;
     543           0 :                 } else if (type.equals("com.sun.star.frame.XDispatch")) {
     544           0 :                     generateXDispatchBodies(o, options);
     545           0 :                     generated.add(u2b(type));
     546           0 :                     continue;
     547           0 :                 } else if (type.equals("com.sun.star.frame.XDispatchProvider")) {
     548           0 :                     generateXDispatchProviderBodies(o, options);
     549           0 :                     generated.add(u2b(type));
     550           0 :                     continue;
     551             :                 }
     552             :             }
     553             :             printMethods(o, options, manager, type, generated, "_",
     554           0 :                          indentation, true, usepropertymixin);
     555             :         }
     556           0 :     }
     557           0 : }
     558             : 
     559             : static const char* propcomment=
     560             : "        // use the last parameter of the PropertySetMixin constructor\n"
     561             : "        // for your optional attributes if necessary. See the documentation\n"
     562             : "        // of the PropertySetMixin helper for further information.\n"
     563             : "        // Ensure that your attributes are initialized correctly!\n";
     564             : 
     565             : 
     566           0 : void generateAddinConstructorAndHelper(std::ostream& o,
     567             :          ProgramOptions const & options,
     568             :          rtl::Reference< TypeManager > const & manager, const OString & classname,
     569             :          const std::set< OUString >& services,
     570             :          const std::set< OUString >& interfaces)
     571             : {
     572             :     o << "    private com.sun.star.lang.Locale m_locale = "
     573           0 :         "new com.sun.star.lang.Locale();\n";
     574             : 
     575           0 :     if (!options.backwardcompatible) {
     576             :         // Constructor
     577           0 :         o << "\n    public " << classname << "( XComponentContext context )\n"
     578           0 :             "    {\n        m_xContext = context;\n    }\n\n";
     579           0 :         return;
     580             :     }
     581             : 
     582             : 
     583             :     // get the one and only add-in service for later use
     584           0 :     std::set< OUString >::const_iterator iter = services.begin();
     585           0 :     OUString sAddinService = *iter;
     586           0 :     if (sAddinService == "com.sun.star.sheet.AddIn") {
     587           0 :         sAddinService = *(++iter);
     588             :     }
     589             : 
     590             : 
     591             :     // add-in specific fields
     592           0 :     o << "\n    private static final String sADDIN_SERVICENAME = \""
     593           0 :       << sAddinService << "\";\n\n";
     594             :     o << "    private static final String sDISPLAYNAME = "
     595             :         "\"DisplayName\";\n"
     596             :         "    private static final String sDESCRIPTION = "
     597             :         "\"Description\";\n"
     598             :         "    private static final String sCATEGORY = \"Category\";\n"
     599             :         "    private static final String sCATEGORYDISPLAYNAME = "
     600           0 :         "\"CategoryDisplayName\";\n\n";
     601             : 
     602             :     o << "    private com.sun.star.container.XHierarchicalNameAccess  "
     603             :         "m_xHAccess = null;\n"
     604             :         "    private com.sun.star.container.XHierarchicalNameAccess  "
     605           0 :         "m_xCompAccess = null;\n";
     606             :     o << "    private java.util.Hashtable<\n        String, "
     607           0 :         "java.util.Hashtable< Integer, String> > m_functionMap = null;\n\n";
     608             : 
     609             :     // Constructor
     610           0 :     o << "\n    public " << classname << "( XComponentContext context )\n    {\n"
     611             :         "        m_xContext = context;\n\n"
     612           0 :         "        try {\n";
     613             : 
     614             :     o << "        m_functionMap = new java.util.Hashtable<\n"
     615           0 :         "            String, java.util.Hashtable< Integer, String > >();\n\n";
     616             : 
     617           0 :     generateFunctionParameterMap(o, options,  manager, interfaces);
     618             : 
     619             :     o << "        com.sun.star.lang.XMultiServiceFactory xProvider = \n"
     620             :         "            (com.sun.star.lang.XMultiServiceFactory)UnoRuntime."
     621             :         "queryInterface(\n"
     622             :         "                com.sun.star.lang.XMultiServiceFactory.class,\n"
     623             :         "                m_xContext.getServiceManager().createInstanceWithContext("
     624             :         "\n                    \"com.sun.star.configuration.ConfigurationProvider\""
     625           0 :         ",\n                    m_xContext));\n\n";
     626             : 
     627             :     o << "        String sReadOnlyView = "
     628           0 :         "\"com.sun.star.configuration.ConfigurationAccess\";\n\n";
     629             : 
     630             :     o << "        StringBuffer sPath = new StringBuffer(\n"
     631             :         "             \"/org.openoffice.Office.CalcAddIns/AddInInfo/\");\n"
     632             :         "        sPath.append(sADDIN_SERVICENAME);\n"
     633           0 :         "        sPath.append(\"/AddInFunctions\");\n\n";
     634             : 
     635             :     o << "        // create arguments: nodepath\n"
     636             :         "         com.sun.star.beans.PropertyValue aArgument = \n"
     637             :         "             new com.sun.star.beans.PropertyValue();\n"
     638             :         "         aArgument.Name = \"nodepath\";\n"
     639             :         "         aArgument.Value = new com.sun.star.uno.Any(\n"
     640           0 :         "             com.sun.star.uno.Type.STRING, sPath.toString());\n\n";
     641             : 
     642             :     o << "        Object aArguments[] = new Object[1];\n"
     643             :         "        aArguments[0] = new com.sun.star.uno.Any("
     644             :         " new com.sun.star.uno.Type(\n"
     645           0 :         "            com.sun.star.beans.PropertyValue.class), aArgument);\n\n";
     646             : 
     647             :     o << "        // create the default view using default UI locale\n"
     648             :         "         Object xIface = \n"
     649             :         "             xProvider.createInstanceWithArguments(sReadOnlyView, "
     650           0 :         "aArguments);\n\n";
     651             : 
     652             :     o << "        m_xHAccess = (com.sun.star.container.XHierarchicalNameAccess)\n"
     653             :         "             UnoRuntime.queryInterface(\n"
     654             :         "                 com.sun.star.container.XHierarchicalNameAccess.class, "
     655           0 :         "xIface);\n\n";
     656             : 
     657             :     o << "        // extends arguments to create a view for all locales to get "
     658             :         "simple\n        // access to the compatibilityname property\n"
     659             :         "        aArguments = new Object[2];\n"
     660             :         "        aArguments[0] = new com.sun.star.uno.Any( "
     661             :         "new com.sun.star.uno.Type(\n"
     662             :         "            com.sun.star.beans.PropertyValue.class), aArgument);\n"
     663             :         "        aArgument.Name = \"locale\";\n"
     664             :         "        aArgument.Value = new com.sun.star.uno.Any(\n"
     665             :         "            com.sun.star.uno.Type.STRING, \"*\");\n"
     666             :         "        aArguments[1] = new com.sun.star.uno.Any( "
     667             :         " new com.sun.star.uno.Type(\n"
     668           0 :         "            com.sun.star.beans.PropertyValue.class), aArgument);\n\n";
     669             : 
     670             :     o << "        // create view for all locales\n"
     671             :         "        xIface = xProvider.createInstanceWithArguments(sReadOnlyView, "
     672             :         "aArguments);\n\n"
     673             :         "        m_xCompAccess = (com.sun.star.container.XHierarchicalNameAccess)\n"
     674             :         "            UnoRuntime.queryInterface(\n"
     675             :         "                com.sun.star.container.XHierarchicalNameAccess.class, "
     676             :         "xIface);\n        }\n"
     677           0 :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n    }\n\n";
     678             : 
     679             :     // add-in helper function
     680             :     o << "    // addin configuration property helper function:\n"
     681             :         "    String getAddinProperty(String funcName, "
     682             :         "String paramName, String propName)\n    {\n"
     683             :         "        try {\n            StringBuffer buf = "
     684             :         "new StringBuffer(funcName);\n\n"
     685             :         "            if (paramName.length() > 0) {\n"
     686             :         "                buf.append(\"/Parameters/\");\n"
     687           0 :         "                buf.append(paramName);\n            }\n\n";
     688             : 
     689             :     o << "            com.sun.star.beans.XPropertySet xPropSet =\n"
     690             :         "                (com.sun.star.beans.XPropertySet)UnoRuntime."
     691             :         "queryInterface(\n"
     692             :         "                    com.sun.star.beans.XPropertySet.class,\n"
     693             :         "                    m_xHAccess.getByHierarchicalName(buf.toString()));\n\n"
     694             :         "            return com.sun.star.uno.AnyConverter.toString(\n"
     695             :         "                xPropSet.getPropertyValue(propName));\n        }\n"
     696             :         "        catch ( com.sun.star.uno.RuntimeException e ) {\n"
     697             :         "            throw e;\n        }\n"
     698             :         "        catch ( com.sun.star.uno.Exception e ) {\n        }\n"
     699           0 :         "        return \"\";\n    }\n\n";
     700             : }
     701             : 
     702             : 
     703           0 : void generateClassDefinition(std::ostream& o,
     704             :          ProgramOptions const & options,
     705             :          rtl::Reference< TypeManager > const & manager,
     706             :          const OString & classname,
     707             :          const std::set< OUString >& services,
     708             :          const std::set< OUString >& interfaces,
     709             :          const AttributeInfo& properties,
     710             :          const AttributeInfo& attributes,
     711             :          const OUString& propertyhelper, bool supportxcomponent)
     712             : {
     713           0 :     o << "\n\npublic final class " << classname << " extends ";
     714             : 
     715           0 :     if (!interfaces.empty()) {
     716           0 :         if (propertyhelper.equals("_")) {
     717           0 :                 o << "PropertySet\n";
     718             :         } else {
     719           0 :             if (supportxcomponent)
     720           0 :                 o << "ComponentBase\n";
     721             :             else
     722           0 :                 o << "WeakBase\n";
     723             :         }
     724           0 :         o << "   implements ";
     725           0 :         std::set< OUString >::const_iterator iter = interfaces.begin();
     726           0 :         while (iter != interfaces.end()) {
     727           0 :             o << (*iter);
     728           0 :             ++iter;
     729           0 :             if (iter != interfaces.end())
     730           0 :                 o << ",\n              ";
     731             :         }
     732             :     }
     733           0 :     o << "\n{\n";
     734             : 
     735           0 :     o << "    private final XComponentContext m_xContext;\n";
     736             : 
     737             :     // additional member for add-ons
     738           0 :     if (options.componenttype == 3) {
     739           0 :         o << "    private com.sun.star.frame.XFrame m_xFrame;\n";
     740             :     }
     741             : 
     742             :     // check property helper
     743           0 :     if (propertyhelper.getLength() > 1)
     744           0 :         o << "    private final PropertySetMixin m_prophlp;\n";
     745             : 
     746           0 :     o << "    private static final String m_implementationName = "
     747           0 :       << classname << ".class.getName();\n";
     748             : 
     749           0 :     if (!services.empty()) {
     750           0 :         o << "    private static final String[] m_serviceNames = {\n";
     751           0 :         std::set< OUString >::const_iterator iter = services.begin();
     752           0 :         while (iter != services.end()) {
     753           0 :             o << "        \"" << (*iter).replace('/','.') << "\"";
     754           0 :             ++iter;
     755           0 :             if (iter != services.end())
     756           0 :                 o << ",\n";
     757             :             else
     758           0 :                 o << " };\n\n";
     759             :         }
     760             :     }
     761             : 
     762             :     // attribute/property members
     763           0 :     if (!properties.empty()) {
     764             :         AttributeInfo::const_iterator iter =
     765           0 :             properties.begin();
     766           0 :         o << "    // properties\n";
     767           0 :         while (iter != properties.end()) {
     768           0 :             o << "    protected ";
     769           0 :             printType(o, options, manager, iter->type, false, false);
     770           0 :             o << " m_" << iter->name << ";\n";
     771           0 :             ++iter;
     772             :         }
     773           0 :     } else if (!attributes.empty()) {
     774             :         AttributeInfo::const_iterator iter =
     775           0 :             attributes.begin();
     776           0 :         o << "    // attributes\n";
     777           0 :         while (iter != attributes.end()) {
     778           0 :             o << "    private ";
     779           0 :             printType(o, options, manager, iter->type, false, false);
     780           0 :             o << " m_" << iter->name << " = ";
     781           0 :             printType(o, options, manager, iter->type, false, true);
     782           0 :             o <<";\n";
     783           0 :             ++iter;
     784             :         }
     785             :     }
     786             : 
     787             :     // special handling of calc add-ins
     788           0 :     if (options.componenttype == 2)
     789             :     {
     790             :         generateAddinConstructorAndHelper(o, options, manager, classname,
     791           0 :                                           services, interfaces);
     792             :     } else {
     793           0 :         o << "\n    public " << classname << "( XComponentContext context )\n"
     794           0 :             "    {\n        m_xContext = context;\n";
     795           0 :         if (propertyhelper.equals("_")) {
     796           0 :             registerProperties(o, properties, "        ");
     797             :         } else {
     798           0 :             if (propertyhelper.getLength() > 1) {
     799           0 :                 o << propcomment
     800           0 :                   << "        m_prophlp = new PropertySetMixin(m_xContext, this,\n"
     801           0 :                   << "            new Type(" << propertyhelper
     802           0 :                   << ".class), null);\n";
     803             :             }
     804             :         }
     805           0 :         o << "    };\n\n";
     806             : 
     807             :     }
     808             : 
     809           0 :     if (!services.empty())
     810           0 :         generateCompFunctions(o, classname);
     811             : 
     812             :     generateMethodBodies(o, options, manager, interfaces,
     813           0 :                          "    ", propertyhelper.getLength() > 1);
     814             : 
     815             :     // end of class definition
     816           0 :     o << "}\n";
     817           0 : }
     818             : 
     819           0 : void generateSkeleton(ProgramOptions const & options,
     820             :                       rtl::Reference< TypeManager > const & manager,
     821             :                       std::vector< OString > const & types)
     822             : {
     823           0 :     std::set< OUString > interfaces;
     824           0 :     std::set< OUString > services;
     825           0 :     AttributeInfo properties;
     826           0 :     AttributeInfo attributes;
     827           0 :     std::set< OUString > propinterfaces;
     828           0 :     bool serviceobject = false;
     829           0 :     bool supportxcomponent = false;
     830             : 
     831           0 :     std::vector< OString >::const_iterator iter = types.begin();
     832           0 :     while (iter != types.end()) {
     833           0 :         checkType(manager, b2u(*iter), interfaces, services, properties);
     834           0 :         ++iter;
     835             :     }
     836             : 
     837           0 :     if (options.componenttype == 3) {
     838             :         // the Protocolhandler service is mandatory for an protocol handler add-on,
     839             :         // so it is defaulted. The XDispatchProvider provides Dispatch objects for
     840             :         // certain functions and the generated impl object implements XDispatch
     841             :         // directly for simplicity reasons.
     842             :         checkType(manager, "com.sun.star.frame.ProtocolHandler",
     843           0 :                   interfaces, services, properties);
     844             :         checkType(manager, "com.sun.star.frame.XDispatch",
     845           0 :                   interfaces, services, properties);
     846             :     }
     847             : 
     848           0 :     if (options.componenttype == 2) {
     849           0 :         if (services.size() != 1) {
     850             :             throw CannotDumpException(
     851             :                 "for calc add-in components one and only one service type is "
     852           0 :                 "necessary! Please reference a valid type with the '-t' option.");
     853             :         }
     854             : 
     855             :         // if backwardcompatible==true the AddIn service needs to be added to the
     856             :         // supported service list, the necessary intefaces are mapped to the add-in
     857             :         // configuration. Since OO.org 2.0.4 this is obsolete and the add-in is
     858             :         // take form the configuration from Calc directly, this simplifies the
     859             :         // add-in code
     860           0 :         if (options.backwardcompatible) {
     861             :             checkType(manager, "com.sun.star.sheet.AddIn",
     862           0 :                       interfaces, services, properties);
     863             :         } else {
     864             :             // special case for the optional XLocalization interface. It should be
     865             :             // implemented always. But it is parent of the XAddIn and we need it only
     866             :             // if backwardcompatible is false.
     867           0 :             if (interfaces.find("com.sun.star.lang.XLocalizable") == interfaces.end()) {
     868           0 :                 interfaces.insert("com.sun.star.lang.XLocalizable");
     869             :             }
     870             :         }
     871             :     }
     872             : 
     873             : 
     874             :     // check if service object or simple UNO object
     875           0 :     if (!services.empty())
     876           0 :         serviceobject = true;
     877             : 
     878             :     OUString propertyhelper = checkPropertyHelper(
     879           0 :         options, manager, services, interfaces, attributes, propinterfaces);
     880           0 :     checkDefaultInterfaces(interfaces, services, propertyhelper);
     881             : 
     882           0 :     if (options.componenttype == 2) {
     883           0 :         if (!propertyhelper.isEmpty())
     884             :             std::cerr << "WARNING: interfaces specifying calc add-in functions "
     885           0 :                 "shouldn't support attributes!\n";
     886             :     }
     887             : 
     888           0 :     supportxcomponent = checkXComponentSupport(manager, interfaces);
     889             : 
     890           0 :     OString compFileName;
     891           0 :     OString tmpFileName;
     892           0 :     std::ostream* pofs = NULL;
     893             :     bool standardout = getOutputStream(options, ".java",
     894           0 :                                        &pofs, compFileName, tmpFileName);
     895             : 
     896             :     try {
     897           0 :         if (!standardout && options.license) {
     898           0 :             printLicenseHeader(*pofs, compFileName);
     899             :         }
     900             : 
     901           0 :         generatePackage(*pofs, options.implname);
     902             : 
     903             :         generateImports(*pofs, options, propertyhelper,
     904           0 :                         serviceobject, supportxcomponent);
     905             : 
     906           0 :         OString classname(options.implname);
     907           0 :         sal_Int32 index = 0;
     908           0 :         if ((index = classname.lastIndexOf('.')) > 0)
     909           0 :             classname = classname.copy(index+1);
     910             : 
     911             :         generateClassDefinition(*pofs, options, manager, classname, services,
     912             :                                 interfaces, properties, attributes, propertyhelper,
     913           0 :                                 supportxcomponent);
     914             : 
     915           0 :         if ( !standardout && pofs && ((std::ofstream*)pofs)->is_open()) {
     916           0 :             ((std::ofstream*)pofs)->close();
     917           0 :             delete pofs;
     918           0 :             OSL_VERIFY(makeValidTypeFile(compFileName, tmpFileName, false));
     919           0 :         }
     920           0 :     } catch (CannotDumpException & e) {
     921           0 :         std::cerr << "ERROR: " << e.getMessage() << "\n";
     922           0 :         if ( !standardout ) {
     923           0 :             if (pofs && ((std::ofstream*)pofs)->is_open()) {
     924           0 :                 ((std::ofstream*)pofs)->close();
     925           0 :                 delete pofs;
     926             :             }
     927             :             // remove existing type file if something goes wrong to ensure
     928             :             // consistency
     929           0 :             if (fileExists(compFileName))
     930           0 :                 removeTypeFile(compFileName);
     931             : 
     932             :             // remove tmp file if something goes wrong
     933           0 :             removeTypeFile(tmpFileName);
     934             :         }
     935           0 :     }
     936           0 : }
     937             : 
     938           0 : } }
     939             : 
     940             : 
     941             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10