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 .
22 #include <cppuhelper/bootstrap.hxx>
23 #include <comphelper/processfactory.hxx>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <vcl/event.hxx>
29 #include <vcl/svapp.hxx>
30 #include <vcl/wrkwin.hxx>
31 #include <tools/extendapplicationenvironment.hxx>
33 #include <svx/dlgctrl.hxx>
35 #include <rtl/strbuf.hxx>
36 #include <rtl/ustrbuf.hxx>
40 using namespace ::com::sun::star::uno
;
41 using namespace ::com::sun::star::lang
;
44 // Forward declaration
51 tools::extendApplicationEnvironment();
53 // create the global service-manager
54 Reference
< XComponentContext
> xContext
= defaultBootstrap_InitialComponentContext();
55 Reference
< XMultiServiceFactory
> xServiceManager( xContext
->getServiceManager(), UNO_QUERY
);
57 if( !xServiceManager
.is() )
58 Application::Abort( "Failed to bootstrap" );
60 comphelper::setProcessServiceFactory( xServiceManager
);
66 catch (const Exception
& e
)
68 SAL_WARN("vcl.app", "Fatal exception: " << e
.Message
);
71 catch (const std::exception
& e
)
73 SAL_WARN("vcl.app", "Fatal exception: " << e
.what());
80 class MyWin
: public WorkWindow
82 VclPtr
<SvxPixelCtl
> maPixelCtl
;
85 MyWin(vcl::Window
* pParent
, WinBits nWinStyle
);
86 virtual ~MyWin() override
90 virtual void dispose() override
;
91 bool Close() override
;
96 ScopedVclPtrInstance
< MyWin
> aMainWin( nullptr, WB_STDWORK
);
97 aMainWin
->SetText( "SvxPixelCtl" );
100 Application::Execute();
103 MyWin::MyWin( vcl::Window
* pParent
, WinBits nWinStyle
) :
104 WorkWindow( pParent
, nWinStyle
),
105 maPixelCtl( VclPtr
<SvxPixelCtl
>::Create(this) )
107 maPixelCtl
->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) );
112 void MyWin::dispose()
114 maPixelCtl
.disposeAndClear();
115 WorkWindow::dispose();
120 bool bRet
= WorkWindow::Close();
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */