Minimal vcl application

Created a minimal vcl application inside vcl/workben in ~55 loc
in which creates a window and paints a simple text inside it.

One can run the application by invoking:

    ./bin/run minvcl

Change-Id: If648666ff25c4b66089a37c8d8164752663fa225
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125124
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
diff --git a/Repository.mk b/Repository.mk
index dddb180..812d47d 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
	xrmex \
	$(if $(filter-out ANDROID iOS WNT,$(OS)), \
        svdemo \
        minvcl \
        fftester \
        svptest \
        svpclient ) \
diff --git a/vcl/Executable_minvcl.mk b/vcl/Executable_minvcl.mk
new file mode 100644
index 0000000..8de973d
--- /dev/null
+++ b/vcl/Executable_minvcl.mk
@@ -0,0 +1,37 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

$(eval $(call gb_Executable_Executable,minvcl))

$(eval $(call gb_Executable_use_api,minvcl,\
    offapi \
    udkapi \
))

$(eval $(call gb_Executable_set_include,minvcl,\
    $$(INCLUDE) \
    -I$(SRCDIR)/vcl/inc \
))

$(eval $(call gb_Executable_use_libraries,minvcl,\
    tl \
    sal \
    vcl \
    cppu \
    cppuhelper \
    comphelper \
    i18nlangtag \
))

$(eval $(call gb_Executable_add_exception_objects,minvcl,\
    vcl/workben/minvcl \
))

# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index b1cfb2c..6b15c77 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -46,6 +46,7 @@ ifeq ($(CROSS_COMPILING)$(DISABLE_DYNLOADING),)
$(eval $(call gb_Module_add_targets,vcl,\
    $(if $(filter-out ANDROID iOS WNT,$(OS)), \
        Executable_svdemo \
        Executable_minvcl \
        Executable_fftester \
        Executable_svptest \
        Executable_svpclient) \
diff --git a/vcl/workben/minvcl.cxx b/vcl/workben/minvcl.cxx
new file mode 100644
index 0000000..98e8ddd
--- /dev/null
+++ b/vcl/workben/minvcl.cxx
@@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <cppuhelper/bootstrap.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>

#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>

namespace
{
class TheWindow : public WorkWindow
{
public:
    TheWindow()
        : WorkWindow(nullptr, WB_APP | WB_STDWORK)
    {
    }
    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
};

class TheApplication : public Application
{
public:
    virtual int Main();

private:
    VclPtr<TheWindow> mpWin;
};
}

void TheWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
    rRenderContext.DrawText(Point(rRect.GetWidth() / 2, rRect.getHeight() / 2),
                            OUString(u"VCL module in LibreOffice"));
}

int TheApplication::Main()
{
    mpWin = VclPtr<TheWindow>::Create();
    mpWin->SetText(u"VCL");
    mpWin->Show();
    Execute();
    mpWin.disposeAndClear();
    return 0;
}

int main()
{
    auto xContext = cppu::defaultBootstrap_InitialComponentContext();
    css::uno::Reference<css::lang::XMultiServiceFactory> xServiceManager(
        xContext->getServiceManager(), css::uno::UNO_QUERY);
    comphelper::setProcessServiceFactory(xServiceManager);
    LanguageTag::setConfiguredSystemLanguage(MsLangId::getSystemLanguage());

    TheApplication aApp;
    InitVCL();
    int ret = aApp.Main();
    DeInitVCL();

    css::uno::Reference<css::lang::XComponent>(xContext, css::uno::UNO_QUERY_THROW)->dispose();
    comphelper::setProcessServiceFactory(nullptr);

    return ret;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */