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 .
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 <com/sun/star/ui/dialogs/XFilePicker.hpp>
29 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
31 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
32 #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
33 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
34 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
35 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
36 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
37 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
38 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
39 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 #include <vcl/event.hxx>
45 #include <vcl/svapp.hxx>
46 #include <vcl/wrkwin.hxx>
47 #include <vcl/button.hxx>
49 #include <comphelper/processfactory.hxx>
50 #include <cppuhelper/bootstrap.hxx>
52 #include "../source/office/iodlg.hxx"
54 using namespace ::com::sun::star::uno
;
55 using namespace ::com::sun::star::lang
;
58 // Forward declaration
63 Reference
< XMultiServiceFactory
> xMS
= cppu::createRegistryServiceFactory( OUString( "applicat.rdb" ), sal_True
);
65 css::uno::Reference
< css::uno::XComponentContext
> xComponentContext
= cppu::defaultBootstrap_InitialComponentContext();
66 css::uno::Reference
< css::lang::XMultiServiceFactory
> xMSch
;
67 xMSch
.set(xComponentContext
->getServiceManager(), css::uno::UNO_QUERY
);
68 comphelper::setProcessServiceFactory(xMSch
);
70 comphelper::setProcessServiceFactory(xMS
);
80 class MyWin
: public WorkWindow
83 MyWin( vcl::Window
* pParent
, WinBits nWinStyle
);
85 void MouseMove( const MouseEvent
& rMEvt
);
86 void MouseButtonDown( const MouseEvent
& rMEvt
);
87 void MouseButtonUp( const MouseEvent
& rMEvt
);
88 void KeyInput( const KeyEvent
& rKEvt
);
89 void KeyUp( const KeyEvent
& rKEvt
);
90 void Paint( const Rectangle
& rRect
);
96 DECL_LINK( Test
, PushButton
* );
103 MyWin
aMainWin( NULL
, WB_APP
| WB_STDWORK
);
104 aMainWin
.SetText(OUString("VCL - Workbench"));
107 Application::Execute();
111 MyWin::MyWin( vcl::Window
* pParent
, WinBits nWinStyle
)
112 :WorkWindow( pParent
, nWinStyle
)
115 aOKBtn
.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
116 aOKBtn
.SetClickHdl( LINK( this, MyWin
, Test
) );
121 void MyWin::MouseMove( const MouseEvent
& rMEvt
)
123 WorkWindow::MouseMove( rMEvt
);
127 void MyWin::MouseButtonDown( const MouseEvent
& rMEvt
)
129 WorkWindow::MouseButtonDown( rMEvt
);
133 void MyWin::MouseButtonUp( const MouseEvent
& rMEvt
)
135 WorkWindow::MouseButtonUp( rMEvt
);
139 void MyWin::KeyInput( const KeyEvent
& rKEvt
)
141 WorkWindow::KeyInput( rKEvt
);
145 void MyWin::KeyUp( const KeyEvent
& rKEvt
)
147 WorkWindow::KeyUp( rKEvt
);
151 void MyWin::Paint( const Rectangle
& rRect
)
153 WorkWindow::Paint( rRect
);
159 WorkWindow::Resize();
163 IMPL_LINK( MyWin
, Test
, PushButton
*, pBtn
, void )
166 if ( pBtn
== &aOKBtn
)
168 ScopedVclPtrInstance
<SvtFileDialog
> pDlg(this, PickerFlags::PathDialog
);
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */