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 "modulepcr.hxx"
22 #include <rtl/instance.hxx>
23 #include <osl/getglobalmutex.hxx>
24 #include <unotools/resmgr.hxx>
25 #include <vcl/settings.hxx>
26 #include <vcl/svapp.hxx>
30 struct CreateModuleClass
32 PcrModule
* operator()()
34 static PcrModule
* pModule
= new PcrModule
;
36 /* yes, in theory, this is a resource leak, since the PcrModule
37 will never be cleaned up. However, using a non-heap instance of PcrModule
38 would not work: It would be cleaned up when the module is unloaded.
39 This might happen (and is likely to happen) *after* the tools-library
40 has been unloaded. However, the module's dtor is where we would delete
41 our resource manager (in case not all our clients de-registered) - which
42 would call into the already-unloaded tools-library. */
46 PcrModule::PcrModule()
50 PcrModule
& PcrModule::getInstance()
52 return *rtl_Instance
< PcrModule
, CreateModuleClass
, ::osl::MutexGuard
, ::osl::GetGlobalMutex
>::
53 create( CreateModuleClass(), ::osl::GetGlobalMutex() );
56 OUString
PcrRes(const char* pId
)
58 return Translate::get(pId
, Translate::Create("pcr"));
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */