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 #ifndef INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFILEPICKER_HXX
21 #define INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFILEPICKER_HXX
23 #include <cppuhelper/compbase.hxx>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
27 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
28 #include <com/sun/star/beans/StringPair.hpp>
30 #include "SalAquaPicker.hxx"
32 #include <rtl/ustring.hxx>
33 #include "FilterHelper.hxx"
34 #include "AquaFilePickerDelegate.hxx"
36 // Implementation class for the XFilePicker Interface
38 typedef ::cppu::WeakComponentImplHelper
<
39 css::ui::dialogs::XFilePicker3
,
40 css::ui::dialogs::XFilePickerControlAccess
,
41 css::lang::XInitialization
,
42 css::lang::XServiceInfo
> SalAquaFilePicker_Base
;
44 class SalAquaFilePicker
:
46 public SalAquaFilePicker_Base
53 // XFilePickerNotifier
55 virtual void SAL_CALL
addFilePickerListener( const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
) override
;
56 virtual void SAL_CALL
removeFilePickerListener( const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
) override
;
58 // XExecutableDialog functions
60 virtual void SAL_CALL
setTitle( const OUString
& aTitle
) override
;
62 virtual sal_Int16 SAL_CALL
execute( ) override
;
64 // XFilePicker functions
66 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
) override
;
68 virtual void SAL_CALL
setDefaultName( const OUString
& aName
) override
;
70 virtual void SAL_CALL
setDisplayDirectory( const OUString
& aDirectory
) override
;
72 virtual OUString SAL_CALL
getDisplayDirectory( ) override
;
74 virtual css::uno::Sequence
< OUString
> SAL_CALL
getFiles( ) override
;
76 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSelectedFiles( ) override
;
78 // XFilterManager functions
80 virtual void SAL_CALL
appendFilter( const OUString
& aTitle
, const OUString
& aFilter
) override
;
82 virtual void SAL_CALL
setCurrentFilter( const OUString
& aTitle
) override
;
84 virtual OUString SAL_CALL
getCurrentFilter( ) override
;
86 // XFilterGroupManager functions
88 virtual void SAL_CALL
appendFilterGroup( const OUString
& sGroupTitle
, const css::uno::Sequence
< css::beans::StringPair
>& aFilters
) override
;
90 // XFilePickerControlAccess functions
92 virtual void SAL_CALL
setValue( sal_Int16 nControlId
, sal_Int16 nControlAction
, const css::uno::Any
& aValue
) override
;
94 virtual css::uno::Any SAL_CALL
getValue( sal_Int16 aControlId
, sal_Int16 aControlAction
) override
;
96 virtual void SAL_CALL
enableControl( sal_Int16 nControlId
, sal_Bool bEnable
) override
;
98 virtual void SAL_CALL
setLabel( sal_Int16 nControlId
, const OUString
& aLabel
) override
;
100 virtual OUString SAL_CALL
getLabel( sal_Int16 nControlId
) override
;
104 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
108 virtual void SAL_CALL
cancel( ) override
;
112 using cppu::WeakComponentImplHelperBase::disposing
;
113 /// @throws css::uno::RuntimeException
114 virtual void disposing( const css::lang::EventObject
& aEvent
);
118 virtual OUString SAL_CALL
getImplementationName( ) override
;
120 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
122 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
124 // FilePicker Event functions
126 void fileSelectionChanged( css::ui::dialogs::FilePickerEvent aEvent
);
127 void directoryChanged( css::ui::dialogs::FilePickerEvent aEvent
);
128 // OUString SAL_CALL helpRequested( css::ui::dialogs::FilePickerEvent aEvent ) const;
129 void controlStateChanged( css::ui::dialogs::FilePickerEvent aEvent
);
130 void dialogSizeChanged( );
132 AquaFilePickerDelegate
* getDelegate() {
136 OUString
const & getSaveFileName() {
137 return m_sSaveFileName
;
141 SalAquaFilePicker( const SalAquaFilePicker
& ) = delete;
142 SalAquaFilePicker
& operator=( const SalAquaFilePicker
& ) = delete;
144 virtual void ensureFilterHelper();
146 css::uno::Reference
< css::ui::dialogs::XFilePickerListener
> m_xListener
;
147 FilterHelper
*m_pFilterHelper
;
148 OUString m_sSaveFileName
;
149 AquaFilePickerDelegate
*m_pDelegate
;
151 void updateFilterUI();
152 void updateSaveFileNameExtension();
156 virtual ~SalAquaFilePicker() override
;
158 void filterControlChanged();
161 #endif // INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFILEPICKER_HXX
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */