Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / reportdesign / inc / ModuleHelper.hxx
blobad1cb6761256518c95be4ab29dfaaebdd21f22df
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _RPTUI_MODULE_HELPER_RPT_HXX_
30 #define _RPTUI_MODULE_HELPER_RPT_HXX_
32 #include "dllapi.h"
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <tools/resmgr.hxx>
36 //.........................................................................
37 namespace rptui
39 //.........................................................................
40 //=========================================================================
41 //= OModule
42 //=========================================================================
43 class OModuleImpl;
44 class REPORTDESIGN_DLLPUBLIC OModule
46 friend class OModuleClient;
48 private:
49 OModule();
50 // not implemented. OModule is a static class
52 protected:
53 static sal_Int32 s_nClients; /// number of registered clients
54 static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered
56 public:
57 /// get the vcl res manager of the module
58 static ResMgr* getResManager();
59 protected:
60 /// register a client for the module
61 static void registerClient();
62 /// revoke a client for the module
63 static void revokeClient();
65 private:
66 /** ensure that the impl class exists
67 @precond m_aMutex is guarded when this method gets called
69 static void ensureImpl();
72 //=========================================================================
73 //= OModuleClient
74 //=========================================================================
75 /** base class for objects which uses any global module-specific ressources
77 class REPORTDESIGN_DLLPUBLIC OModuleClient
79 public:
80 inline OModuleClient() { OModule::registerClient(); }
81 inline ~OModuleClient() { OModule::revokeClient(); }
84 //=========================================================================
85 //= ModuleRes
86 //=========================================================================
87 /** specialized ResId, using the ressource manager provided by the global module
89 class REPORTDESIGN_DLLPUBLIC ModuleRes : public ::ResId
91 public:
92 inline ModuleRes(sal_uInt16 _nId) : ResId(_nId, *OModule::getResManager()) { }
94 //.........................................................................
95 } // namespace rptui
96 //.........................................................................
98 #endif // _RPTUI_MODULE_HELPER_RPT_HXX_
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */