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 :
21 : #include "forms/form_handler_factory.hxx"
22 : #include "vcl_date_handler.hxx"
23 : #include "vcl_time_handler.hxx"
24 :
25 : //......................................................................................................................
26 : namespace xmloff
27 : {
28 : //......................................................................................................................
29 :
30 : namespace
31 : {
32 24 : static PPropertyHandler s_pVCLDateHandler = NULL;
33 24 : static PPropertyHandler s_pVCLTimeHandler = NULL;
34 : }
35 :
36 : //==================================================================================================================
37 : //= FormHandlerFactory
38 : //==================================================================================================================
39 : //------------------------------------------------------------------------------------------------------------------
40 0 : PPropertyHandler FormHandlerFactory::getFormPropertyHandler( const PropertyId i_propertyId )
41 : {
42 0 : PPropertyHandler pHandler( NULL );
43 :
44 0 : switch ( i_propertyId )
45 : {
46 : case PID_DATE_MIN:
47 : case PID_DATE_MAX:
48 : case PID_DEFAULT_DATE:
49 : case PID_DATE:
50 0 : if ( s_pVCLDateHandler.get() == NULL )
51 : {
52 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
53 0 : if ( s_pVCLDateHandler == NULL )
54 0 : s_pVCLDateHandler = new VCLDateHandler();
55 : }
56 0 : pHandler = s_pVCLDateHandler;
57 0 : break;
58 :
59 : case PID_TIME_MIN:
60 : case PID_TIME_MAX:
61 : case PID_DEFAULT_TIME:
62 : case PID_TIME:
63 0 : if ( s_pVCLTimeHandler.get() == NULL )
64 : {
65 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
66 0 : if ( s_pVCLTimeHandler == NULL )
67 0 : s_pVCLTimeHandler = new VCLTimeHandler();
68 : }
69 0 : pHandler = s_pVCLTimeHandler;
70 0 : break;
71 :
72 : default:
73 : OSL_ENSURE( false, "FormHandlerFactory::getFormPropertyHandler: unknown property ID!" );
74 0 : break;
75 : }
76 :
77 0 : return pHandler;
78 : }
79 :
80 : //......................................................................................................................
81 72 : } // namespace xmloff
82 : //......................................................................................................................
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|