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

Generated by: LCOV version 1.10