build fix
[LibreOffice.git] / fpicker / test / svdem.cxx
blobc5c16066c403fd3deeab795f8619c8908fac95a9
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 <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
34 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
35 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
36 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
37 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
38 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
39 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
40 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
42 #include <sal/main.h>
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 #include <vcl/event.hxx>
46 #include <vcl/svapp.hxx>
47 #include <vcl/wrkwin.hxx>
48 #include <vcl/msgbox.hxx>
49 #include <vcl/button.hxx>
51 #include <comphelper/processfactory.hxx>
52 #include <cppuhelper/bootstrap.hxx>
54 #include "../source/office/iodlg.hxx"
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::lang;
60 // Forward declaration
61 void Main();
63 SAL_IMPLEMENT_MAIN()
65 Reference< XMultiServiceFactory > xMS = cppu::createRegistryServiceFactory( OUString( "applicat.rdb" ), sal_True );
67 css::uno::Reference< css::uno::XComponentContext > xComponentContext = cppu::defaultBootstrap_InitialComponentContext();
68 css::uno::Reference< css::lang::XMultiServiceFactory> xMSch;
69 xMSch.set(xComponentContext->getServiceManager(), css::uno::UNO_QUERY);
70 comphelper::setProcessServiceFactory(xMSch);
72 comphelper::setProcessServiceFactory(xMS);
74 InitVCL();
75 ::Main();
76 DeInitVCL();
78 return 0;
82 class MyWin : public WorkWindow
84 public:
85 MyWin( vcl::Window* pParent, WinBits nWinStyle );
87 void MouseMove( const MouseEvent& rMEvt );
88 void MouseButtonDown( const MouseEvent& rMEvt );
89 void MouseButtonUp( const MouseEvent& rMEvt );
90 void KeyInput( const KeyEvent& rKEvt );
91 void KeyUp( const KeyEvent& rKEvt );
92 void Paint( const Rectangle& rRect );
93 void Resize();
95 private:
96 OKButton aOKBtn;
98 DECL_LINK( Test, PushButton* );
103 void Main()
105 MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
106 aMainWin.SetText(OUString("VCL - Workbench"));
107 aMainWin.Show();
109 Application::Execute();
113 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle )
114 :WorkWindow( pParent, nWinStyle )
115 ,aOKBtn(this)
117 aOKBtn.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
118 aOKBtn.SetClickHdl( LINK( this, MyWin, Test ) );
119 aOKBtn.Show();
123 void MyWin::MouseMove( const MouseEvent& rMEvt )
125 WorkWindow::MouseMove( rMEvt );
129 void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
131 WorkWindow::MouseButtonDown( rMEvt );
135 void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
137 WorkWindow::MouseButtonUp( rMEvt );
141 void MyWin::KeyInput( const KeyEvent& rKEvt )
143 WorkWindow::KeyInput( rKEvt );
147 void MyWin::KeyUp( const KeyEvent& rKEvt )
149 WorkWindow::KeyUp( rKEvt );
153 void MyWin::Paint( const Rectangle& rRect )
155 WorkWindow::Paint( rRect );
159 void MyWin::Resize()
161 WorkWindow::Resize();
165 IMPL_LINK( MyWin, Test, PushButton*, pBtn, void )
167 printf("Test\n");
168 if ( pBtn == &aOKBtn )
170 ScopedVclPtrInstance<SvtFileDialog> pDlg(this, PickerFlags::PathDialog);
171 pDlg->Execute();
172 printf("ok\n");
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */