LibreOffice Module vcl (master)  1
builderfactory.hxx
Go to the documentation of this file.
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 
10 #ifndef INCLUDED_VCL_BUILDER_FACTORY_HXX
11 #define INCLUDED_VCL_BUILDER_FACTORY_HXX
12 
13 #include <vcl/vclptr.hxx>
14 #include <vcl/builder.hxx>
15 
16 #define VCL_BUILDER_FACTORY(typeName) \
17  extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
18  { \
19  static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, \
20  decltype(make##typeName)>); \
21  (void)rMap; \
22  rRet = VclPtr<typeName>::Create(pParent); \
23  }
24 
25 #define VCL_BUILDER_FACTORY_ARGS(typeName,arg1) \
26  extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
27  { \
28  static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, \
29  decltype(make##typeName)>); \
30  (void)rMap; \
31  rRet = VclPtr<typeName>::Create(pParent,arg1); \
32  }
33 
34 #define VCL_BUILDER_FACTORY_CONSTRUCTOR(typeName,arg2) \
35  extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
36  { \
37  static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, \
38  decltype(make##typeName)>); \
39  OUString sBorder = BuilderUtils::extractCustomProperty(rMap); \
40  WinBits wb = arg2; \
41  if (!sBorder.isEmpty()) \
42  wb |= WB_BORDER; \
43  rRet = VclPtr<typeName>::Create(pParent,wb); \
44  }
45 
46 #define VCL_BUILDER_FACTORY_EXTERN(typeName) \
47  extern "C" void make##typeName(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap)
48 
49 #endif
50 
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */