update emoji autocorrect entries from po-files
[LibreOffice.git] / svx / workben / pixelctl.cxx
blob127b1be4a83ac6db5ac664486498acf6e8f0d539
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sal/main.h>
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>
38 #include <math.h>
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::lang;
42 using namespace cppu;
44 // Forward declaration
45 void Main();
47 SAL_IMPLEMENT_MAIN()
49 try
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 );
62 InitVCL();
63 ::Main();
64 DeInitVCL();
66 catch (const Exception& e)
68 SAL_WARN("vcl.app", "Fatal exception: " << e.Message);
69 return 1;
71 catch (const std::exception& e)
73 SAL_WARN("vcl.app", "Fatal exception: " << e.what());
74 return 1;
77 return 0;
80 class MyWin : public WorkWindow
82 VclPtr<SvxPixelCtl> maPixelCtl;
84 public:
85 MyWin(vcl::Window* pParent, WinBits nWinStyle);
86 virtual ~MyWin()
88 disposeOnce();
90 virtual void dispose() SAL_OVERRIDE;
91 void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
92 void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
93 void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
94 void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
95 void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
96 void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
97 void Resize() SAL_OVERRIDE;
98 bool Close() SAL_OVERRIDE;
101 void Main()
103 ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK );
104 aMainWin->SetText( OUString( "SvxPixelCtl" ) );
105 aMainWin->Show();
107 Application::Execute();
110 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
111 WorkWindow( pParent, nWinStyle ),
112 maPixelCtl( VclPtr<SvxPixelCtl>::Create(this) )
114 maPixelCtl->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) );
115 maPixelCtl->Show();
119 void MyWin::dispose()
121 maPixelCtl.disposeAndClear();
122 WorkWindow::dispose();
125 bool MyWin::Close()
127 bool bRet = WorkWindow::Close();
128 if( bRet )
129 Application::Quit();
130 return bRet;
133 void MyWin::MouseMove( const MouseEvent& rMEvt )
135 WorkWindow::MouseMove( rMEvt );
138 void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
140 WorkWindow::MouseButtonDown( rMEvt );
143 void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
145 WorkWindow::MouseButtonUp( rMEvt );
148 void MyWin::KeyInput( const KeyEvent& rKEvt )
150 WorkWindow::KeyInput( rKEvt );
153 void MyWin::KeyUp( const KeyEvent& rKEvt )
155 WorkWindow::KeyUp( rKEvt );
158 void MyWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
160 WorkWindow::Paint(rRenderContext, rRect);
163 void MyWin::Resize()
165 WorkWindow::Resize();
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */