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 .
22 #include <cppuhelper/compbase.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
27 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <osl/mutex.hxx>
32 #include "gtk3_kde5_filepicker_ipc.hxx"
34 typedef ::cppu::WeakComponentImplHelper
<css::ui::dialogs::XFilePicker3
,
35 css::ui::dialogs::XFilePickerControlAccess
36 // TODO css::ui::dialogs::XFilePreview
38 css::lang::XInitialization
, css::lang::XServiceInfo
>
39 Gtk3KDE5FilePicker_Base
;
41 class Gtk3KDE5FilePicker
: public Gtk3KDE5FilePicker_Base
44 css::uno::Reference
<css::ui::dialogs::XFilePickerListener
> m_xListener
;
46 osl::Mutex _helperMutex
;
47 Gtk3KDE5FilePickerIpc m_ipc
;
50 explicit Gtk3KDE5FilePicker(const css::uno::Reference
<css::uno::XComponentContext
>&);
51 virtual ~Gtk3KDE5FilePicker() override
;
53 // XFilePickerNotifier
54 virtual void SAL_CALL
addFilePickerListener(
55 const css::uno::Reference
<css::ui::dialogs::XFilePickerListener
>& xListener
) override
;
56 virtual void SAL_CALL
removeFilePickerListener(
57 const css::uno::Reference
<css::ui::dialogs::XFilePickerListener
>& xListener
) override
;
59 // XExecutableDialog functions
60 virtual void SAL_CALL
setTitle(const OUString
& rTitle
) override
;
61 virtual sal_Int16 SAL_CALL
execute() override
;
63 // XFilePicker functions
64 virtual void SAL_CALL
setMultiSelectionMode(sal_Bool bMode
) override
;
65 virtual void SAL_CALL
setDefaultName(const OUString
& rName
) override
;
66 virtual void SAL_CALL
setDisplayDirectory(const OUString
& rDirectory
) override
;
67 virtual OUString SAL_CALL
getDisplayDirectory() override
;
68 virtual css::uno::Sequence
<OUString
> SAL_CALL
getFiles() override
;
70 // XFilterManager functions
71 virtual void SAL_CALL
appendFilter(const OUString
& rTitle
, const OUString
& rFilter
) override
;
72 virtual void SAL_CALL
setCurrentFilter(const OUString
& rTitle
) override
;
73 virtual OUString SAL_CALL
getCurrentFilter() override
;
75 // XFilterGroupManager functions
77 appendFilterGroup(const OUString
& rGroupTitle
,
78 const css::uno::Sequence
<css::beans::StringPair
>& rFilters
) override
;
80 // XFilePickerControlAccess functions
81 virtual void SAL_CALL
setValue(sal_Int16 nControlId
, sal_Int16 nControlAction
,
82 const css::uno::Any
& rValue
) override
;
83 virtual css::uno::Any SAL_CALL
getValue(sal_Int16 nControlId
,
84 sal_Int16 nControlAction
) override
;
85 virtual void SAL_CALL
enableControl(sal_Int16 nControlId
, sal_Bool bEnable
) override
;
86 virtual void SAL_CALL
setLabel(sal_Int16 nControlId
, const OUString
& rLabel
) override
;
87 virtual OUString SAL_CALL
getLabel(sal_Int16 nControlId
) override
;
91 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( );
92 virtual sal_Int32 SAL_CALL getTargetColorDepth( );
93 virtual sal_Int32 SAL_CALL getAvailableWidth( );
94 virtual sal_Int32 SAL_CALL getAvailableHeight( );
95 virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any &rImage );
96 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState );
97 virtual sal_Bool SAL_CALL getShowState( );
100 // XFilePicker2 functions
101 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSelectedFiles() override
;
104 virtual void SAL_CALL
initialize(const css::uno::Sequence
<css::uno::Any
>& rArguments
) override
;
107 virtual void SAL_CALL
cancel() override
;
110 virtual void disposing(const css::lang::EventObject
& rEvent
);
111 using cppu::WeakComponentImplHelperBase::disposing
;
114 virtual OUString SAL_CALL
getImplementationName() override
;
115 virtual sal_Bool SAL_CALL
supportsService(const OUString
& rServiceName
) override
;
116 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
119 Gtk3KDE5FilePicker(const Gtk3KDE5FilePicker
&) = delete;
120 Gtk3KDE5FilePicker
& operator=(const Gtk3KDE5FilePicker
&) = delete;
122 //add a custom control widget to the file dialog
123 void addCustomControl(sal_Int16 controlId
);
125 // emit XFilePickerListener controlStateChanged event
126 void filterChanged();
127 // emit XFilePickerListener fileSelectionChanged event
128 void selectionChanged();
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */