update credits
[LibreOffice.git] / fpicker / test / svdem.cxx
blob19723a1366d9b4394014be71ecc088d5567de79c
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 #ifndef _RTL_USTRING_
27 #include <rtl/ustring>
28 #endif
29 #include <sal/types.h>
30 #include <osl/diagnose.h>
31 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
32 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
34 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
35 #include <cppuhelper/implbase1.hxx>
36 #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
37 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
38 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
39 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
40 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
41 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
42 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
43 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
45 #include <sal/main.h>
46 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <vcl/event.hxx>
49 #include <vcl/svapp.hxx>
50 #include <vcl/wrkwin.hxx>
51 #include <vcl/msgbox.hxx>
52 #include <vcl/button.hxx>
54 #include <comphelper/processfactory.hxx>
55 #include <cppuhelper/bootstrap.hxx>
57 #include "../source/office/iodlg.hxx"
59 using namespace ::com::sun::star::uno;
60 using namespace ::com::sun::star::lang;
61 // -----------------------------------------------------------------------
63 // Forward declaration
64 void Main();
66 String aEmptyStr;
68 // -----------------------------------------------------------------------
70 SAL_IMPLEMENT_MAIN()
72 Reference< XMultiServiceFactory > xMS;
73 xMS = cppu::createRegistryServiceFactory( OUString( "applicat.rdb" ), sal_True );
75 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory> xMSch;
76 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xComponentContext;
77 xComponentContext = cppu::defaultBootstrap_InitialComponentContext();
78 xMSch.set(xComponentContext->getServiceManager(), com::sun::star::uno::UNO_QUERY);
79 comphelper::setProcessServiceFactory(xMSch);
81 comphelper::setProcessServiceFactory(xMS);
83 InitVCL();
84 ::Main();
85 DeInitVCL();
87 return 0;
90 // -----------------------------------------------------------------------
92 class MyWin : public WorkWindow
94 public:
95 MyWin( Window* pParent, WinBits nWinStyle );
97 void MouseMove( const MouseEvent& rMEvt );
98 void MouseButtonDown( const MouseEvent& rMEvt );
99 void MouseButtonUp( const MouseEvent& rMEvt );
100 void KeyInput( const KeyEvent& rKEvt );
101 void KeyUp( const KeyEvent& rKEvt );
102 void Paint( const Rectangle& rRect );
103 void Resize();
105 private:
106 OKButton aOKBtn;
108 DECL_LINK( Test, PushButton* );
112 // -----------------------------------------------------------------------
114 void Main()
116 MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
117 aMainWin.SetText(OUString("VCL - Workbench"));
118 aMainWin.Show();
120 Application::Execute();
123 // -----------------------------------------------------------------------
125 MyWin::MyWin( Window* pParent, WinBits nWinStyle )
126 :WorkWindow( pParent, nWinStyle )
127 ,aOKBtn(this)
129 aOKBtn.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
130 aOKBtn.SetClickHdl( LINK( this, MyWin, Test ) );
131 aOKBtn.Show();
134 // -----------------------------------------------------------------------
136 void MyWin::MouseMove( const MouseEvent& rMEvt )
138 WorkWindow::MouseMove( rMEvt );
141 // -----------------------------------------------------------------------
143 void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
145 WorkWindow::MouseButtonDown( rMEvt );
148 // -----------------------------------------------------------------------
150 void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
152 WorkWindow::MouseButtonUp( rMEvt );
155 // -----------------------------------------------------------------------
157 void MyWin::KeyInput( const KeyEvent& rKEvt )
159 WorkWindow::KeyInput( rKEvt );
162 // -----------------------------------------------------------------------
164 void MyWin::KeyUp( const KeyEvent& rKEvt )
166 WorkWindow::KeyUp( rKEvt );
169 // -----------------------------------------------------------------------
171 void MyWin::Paint( const Rectangle& rRect )
173 WorkWindow::Paint( rRect );
176 // -----------------------------------------------------------------------
178 void MyWin::Resize()
180 WorkWindow::Resize();
183 // -----------------------------------------------------------------------
185 IMPL_LINK( MyWin, Test, PushButton*, pBtn )
187 printf("Test\n");
188 if ( pBtn == &aOKBtn )
190 SvtFileDialog* pDlg = new SvtFileDialog( this,SFXWB_PATHDIALOG);
191 pDlg->Execute();
192 delete pDlg;
193 printf("ok\n");
196 return 0;
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */