fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / fpicker / test / svdem.cxx
blob61217a7c692ad9c57ffec9f2e6bd06384e7b1fec
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 <com/sun/star/lang/XComponent.hpp>
21 #include <com/sun/star/registry/XSimpleRegistry.hpp>
22 #include <osl/file.hxx>
24 #include <cppuhelper/servicefactory.hxx>
26 #include <rtl/ustring>
27 #include <sal/types.h>
28 #include <osl/diagnose.h>
29 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
30 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
32 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
33 #include <cppuhelper/implbase1.hxx>
34 #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
35 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
36 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
37 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
38 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
39 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
40 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
41 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
43 #include <sal/main.h>
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 #include <vcl/event.hxx>
47 #include <vcl/svapp.hxx>
48 #include <vcl/wrkwin.hxx>
49 #include <vcl/msgbox.hxx>
50 #include <vcl/button.hxx>
52 #include <comphelper/processfactory.hxx>
53 #include <cppuhelper/bootstrap.hxx>
55 #include "../source/office/iodlg.hxx"
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::lang;
61 // Forward declaration
62 void Main();
64 String aEmptyStr;
68 SAL_IMPLEMENT_MAIN()
70 Reference< XMultiServiceFactory > xMS;
71 xMS = cppu::createRegistryServiceFactory( OUString( "applicat.rdb" ), sal_True );
73 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory> xMSch;
74 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xComponentContext;
75 xComponentContext = cppu::defaultBootstrap_InitialComponentContext();
76 xMSch.set(xComponentContext->getServiceManager(), com::sun::star::uno::UNO_QUERY);
77 comphelper::setProcessServiceFactory(xMSch);
79 comphelper::setProcessServiceFactory(xMS);
81 InitVCL();
82 ::Main();
83 DeInitVCL();
85 return 0;
90 class MyWin : public WorkWindow
92 public:
93 MyWin( vcl::Window* pParent, WinBits nWinStyle );
95 void MouseMove( const MouseEvent& rMEvt );
96 void MouseButtonDown( const MouseEvent& rMEvt );
97 void MouseButtonUp( const MouseEvent& rMEvt );
98 void KeyInput( const KeyEvent& rKEvt );
99 void KeyUp( const KeyEvent& rKEvt );
100 void Paint( const Rectangle& rRect );
101 void Resize();
103 private:
104 OKButton aOKBtn;
106 DECL_LINK( Test, PushButton* );
112 void Main()
114 MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
115 aMainWin.SetText(OUString("VCL - Workbench"));
116 aMainWin.Show();
118 Application::Execute();
123 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle )
124 :WorkWindow( pParent, nWinStyle )
125 ,aOKBtn(this)
127 aOKBtn.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
128 aOKBtn.SetClickHdl( LINK( this, MyWin, Test ) );
129 aOKBtn.Show();
134 void MyWin::MouseMove( const MouseEvent& rMEvt )
136 WorkWindow::MouseMove( rMEvt );
141 void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
143 WorkWindow::MouseButtonDown( rMEvt );
148 void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
150 WorkWindow::MouseButtonUp( rMEvt );
155 void MyWin::KeyInput( const KeyEvent& rKEvt )
157 WorkWindow::KeyInput( rKEvt );
162 void MyWin::KeyUp( const KeyEvent& rKEvt )
164 WorkWindow::KeyUp( rKEvt );
169 void MyWin::Paint( const Rectangle& rRect )
171 WorkWindow::Paint( rRect );
176 void MyWin::Resize()
178 WorkWindow::Resize();
183 IMPL_LINK( MyWin, Test, PushButton*, pBtn )
185 printf("Test\n");
186 if ( pBtn == &aOKBtn )
188 ScopedVclPtrInstance<SvtFileDialog> pDlg(this,SFXWB_PATHDIALOG);
189 pDlg->Execute();
190 printf("ok\n");
193 return 0;
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */