1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
31 static PPropertyHandler s_pVCLDateHandler
= nullptr;
32 static PPropertyHandler s_pVCLTimeHandler
= nullptr;
35 //= FormHandlerFactory
36 PPropertyHandler
FormHandlerFactory::getFormPropertyHandler( const PropertyId i_propertyId
)
38 PPropertyHandler
pHandler( nullptr );
40 switch ( i_propertyId
)
44 case PID_DEFAULT_DATE
:
46 if ( s_pVCLDateHandler
.get() == nullptr )
48 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
49 if ( s_pVCLDateHandler
== nullptr )
50 s_pVCLDateHandler
= new VCLDateHandler();
52 pHandler
= s_pVCLDateHandler
;
57 case PID_DEFAULT_TIME
:
59 if ( s_pVCLTimeHandler
.get() == nullptr )
61 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
62 if ( s_pVCLTimeHandler
== nullptr )
63 s_pVCLTimeHandler
= new VCLTimeHandler();
65 pHandler
= s_pVCLTimeHandler
;
69 OSL_ENSURE( false, "FormHandlerFactory::getFormPropertyHandler: unknown property ID!" );
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */