LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - formbrowsertools.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 "formbrowsertools.hxx"
      21                 :            : #include <com/sun/star/form/FormComponentType.hpp>
      22                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      23                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      24                 :            : #include "formresid.hrc"
      25                 :            : #include "modulepcr.hxx"
      26                 :            : #include <tools/string.hxx>
      27                 :            : #include "formstrings.hxx"
      28                 :            : 
      29                 :            : //............................................................................
      30                 :            : namespace pcr
      31                 :            : {
      32                 :            : //............................................................................
      33                 :            : 
      34                 :            :     using namespace ::com::sun::star::uno;
      35                 :            :     using namespace ::com::sun::star::form;
      36                 :            :     using namespace ::com::sun::star::lang;
      37                 :            :     using namespace ::com::sun::star::beans;
      38                 :            : 
      39                 :            :     //------------------------------------------------------------------------
      40                 :          0 :     ::rtl::OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj)
      41                 :            :     {
      42                 :          0 :         PcrClient aResourceAccess;
      43                 :            :             // this ensures that we have our resource file loaded
      44                 :            : 
      45                 :          0 :         ::rtl::OUString sClassName;
      46                 :          0 :         switch (nClassId)
      47                 :            :         {
      48                 :            :             case FormComponentType::TEXTFIELD:
      49                 :            :             {
      50                 :          0 :                 Reference< XInterface >  xIFace;
      51                 :          0 :                 aUnoObj >>= xIFace;
      52                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_EDIT));
      53                 :          0 :                 if (xIFace.is())
      54                 :            :                 {   // we have a chance to check if it's a formatted field model
      55                 :          0 :                     Reference< XServiceInfo >  xInfo(xIFace, UNO_QUERY);
      56                 :          0 :                     if (xInfo.is() && (xInfo->supportsService(SERVICE_COMPONENT_FORMATTEDFIELD)))
      57                 :          0 :                         sClassName = String(PcrRes(RID_STR_PROPTITLE_FORMATTED));
      58                 :          0 :                     else if (!xInfo.is())
      59                 :            :                     {
      60                 :            :                         // couldn't distinguish between formatted and edit with the service name, so try with the properties
      61                 :          0 :                         Reference< XPropertySet >  xProps(xIFace, UNO_QUERY);
      62                 :          0 :                         if (xProps.is())
      63                 :            :                         {
      64                 :          0 :                             Reference< XPropertySetInfo >  xPropsInfo = xProps->getPropertySetInfo();
      65                 :          0 :                             if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(PROPERTY_FORMATSSUPPLIER))
      66                 :          0 :                                 sClassName = String(PcrRes(RID_STR_PROPTITLE_FORMATTED));
      67                 :          0 :                         }
      68                 :          0 :                     }
      69                 :          0 :                 }
      70                 :            :             }
      71                 :          0 :             break;
      72                 :            : 
      73                 :            :             case FormComponentType::COMMANDBUTTON:
      74                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_PUSHBUTTON)); break;
      75                 :            :             case FormComponentType::RADIOBUTTON:
      76                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_RADIOBUTTON)); break;
      77                 :            :             case FormComponentType::CHECKBOX:
      78                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_CHECKBOX)); break;
      79                 :            :             case FormComponentType::LISTBOX:
      80                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_LISTBOX)); break;
      81                 :            :             case FormComponentType::COMBOBOX:
      82                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_COMBOBOX)); break;
      83                 :            :             case FormComponentType::GROUPBOX:
      84                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_GROUPBOX)); break;
      85                 :            :             case FormComponentType::IMAGEBUTTON:
      86                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_IMAGEBUTTON)); break;
      87                 :            :             case FormComponentType::FIXEDTEXT:
      88                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_FIXEDTEXT)); break;
      89                 :            :             case FormComponentType::GRIDCONTROL:
      90                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_DBGRID)); break;
      91                 :            :             case FormComponentType::FILECONTROL:
      92                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_FILECONTROL)); break;
      93                 :            : 
      94                 :            :             case FormComponentType::DATEFIELD:
      95                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_DATEFIELD)); break;
      96                 :            :             case FormComponentType::TIMEFIELD:
      97                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_TIMEFIELD)); break;
      98                 :            :             case FormComponentType::NUMERICFIELD:
      99                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_NUMERICFIELD)); break;
     100                 :            :             case FormComponentType::CURRENCYFIELD:
     101                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_CURRENCYFIELD)); break;
     102                 :            :             case FormComponentType::PATTERNFIELD:
     103                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_PATTERNFIELD)); break;
     104                 :            :             case FormComponentType::IMAGECONTROL:
     105                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_IMAGECONTROL)); break;
     106                 :            :             case FormComponentType::HIDDENCONTROL:
     107                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_HIDDENCONTROL)); break;
     108                 :            : 
     109                 :            :             case FormComponentType::CONTROL:
     110                 :            :             default:
     111                 :          0 :                 sClassName = String(PcrRes(RID_STR_PROPTITLE_UNKNOWNCONTROL)); break;
     112                 :            :         }
     113                 :            : 
     114                 :          0 :         return sClassName;
     115                 :            :     }
     116                 :            : 
     117                 :            :     //------------------------------------------------------------------------
     118                 :          0 :     sal_Int16 classifyComponent( const Reference< XInterface >& _rxComponent )
     119                 :            :     {
     120                 :          0 :         Reference< XPropertySet > xComponentProps( _rxComponent, UNO_QUERY_THROW );
     121                 :          0 :         Reference< XPropertySetInfo > xPSI( xComponentProps->getPropertySetInfo(), UNO_SET_THROW );
     122                 :            : 
     123                 :          0 :         sal_Int16 nControlType( FormComponentType::CONTROL );
     124                 :          0 :         if ( xPSI->hasPropertyByName( PROPERTY_CLASSID ) )
     125                 :            :         {
     126                 :          0 :             OSL_VERIFY( xComponentProps->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType );
     127                 :            :         }
     128                 :          0 :         return nControlType;
     129                 :            :     }
     130                 :            : 
     131                 :            : //............................................................................
     132                 :            : } // namespace pcr
     133                 :            : //............................................................................
     134                 :            : 
     135                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10