LCOV - code coverage report
Current view: top level - xmloff/source/forms/handler - form_handler_factory.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 20 15.0 %
Date: 2015-06-13 12:38:46 Functions: 2 3 66.7 %
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 "forms/form_handler_factory.hxx"
      21             : #include "vcl_date_handler.hxx"
      22             : #include "vcl_time_handler.hxx"
      23             : #include <osl/diagnose.h>
      24             : #include <osl/mutex.hxx>
      25             : 
      26             : namespace xmloff
      27             : {
      28             : 
      29             :     namespace
      30             :     {
      31         152 :         static PPropertyHandler s_pVCLDateHandler = NULL;
      32         152 :         static PPropertyHandler s_pVCLTimeHandler = NULL;
      33             :     }
      34             : 
      35             :     //= FormHandlerFactory
      36           0 :     PPropertyHandler FormHandlerFactory::getFormPropertyHandler( const PropertyId i_propertyId )
      37             :     {
      38           0 :         PPropertyHandler pHandler( NULL );
      39             : 
      40           0 :         switch ( i_propertyId )
      41             :         {
      42             :         case PID_DATE_MIN:
      43             :         case PID_DATE_MAX:
      44             :         case PID_DEFAULT_DATE:
      45             :         case PID_DATE:
      46           0 :             if ( s_pVCLDateHandler.get() == NULL )
      47             :             {
      48           0 :                 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      49           0 :                 if ( s_pVCLDateHandler == NULL )
      50           0 :                     s_pVCLDateHandler = new VCLDateHandler();
      51             :             }
      52           0 :             pHandler = s_pVCLDateHandler;
      53           0 :             break;
      54             : 
      55             :         case PID_TIME_MIN:
      56             :         case PID_TIME_MAX:
      57             :         case PID_DEFAULT_TIME:
      58             :         case PID_TIME:
      59           0 :             if ( s_pVCLTimeHandler.get() == NULL )
      60             :             {
      61           0 :                 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      62           0 :                 if ( s_pVCLTimeHandler == NULL )
      63           0 :                     s_pVCLTimeHandler = new VCLTimeHandler();
      64             :             }
      65           0 :             pHandler = s_pVCLTimeHandler;
      66           0 :             break;
      67             : 
      68             :         default:
      69             :             OSL_ENSURE( false, "FormHandlerFactory::getFormPropertyHandler: unknown property ID!" );
      70           0 :             break;
      71             :         }
      72             : 
      73           0 :         return pHandler;
      74             :     }
      75             : 
      76         456 : } // namespace xmloff
      77             : 
      78             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11