Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / fpicker / source / office / OfficeFilePicker.hxx
blob33e2b6d16e7c59d1d8ff0a5396f76cd93896aa51
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 .
19 #pragma once
21 #include <cppuhelper/implbase5.hxx>
22 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
23 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
24 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
25 #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
26 #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XEventListener.hpp>
31 #include "commonpicker.hxx"
32 #include "pickercallbacks.hxx"
34 #include <vector>
36 class Dialog;
37 struct FilterEntry;
38 struct ElementEntry_Impl;
39 enum class PickerFlags;
41 typedef ::std::vector< FilterEntry > FilterList; // can be maintained more effectively
42 typedef ::std::vector< ElementEntry_Impl > ElementList;
44 typedef css::beans::StringPair UnoFilterEntry;
45 typedef css::uno::Sequence< UnoFilterEntry > UnoFilterList; // can be transported more effectively
47 // class SvtFilePicker ---------------------------------------------------
49 typedef cppu::ImplInheritanceHelper <svt::OCommonPicker
50 , css::ui::dialogs::XFilePicker3
51 , css::ui::dialogs::XFilePickerControlAccess
52 , css::ui::dialogs::XFilePreview
53 , css::lang::XServiceInfo
54 , css::ui::dialogs::XAsynchronousExecutableDialog
55 > SvtFilePicker_Base;
57 class SvtFilePicker :public SvtFilePicker_Base
58 ,public ::svt::IFilePickerListener
60 protected:
61 std::unique_ptr<FilterList>
62 m_pFilterList;
63 std::unique_ptr<ElementList>
64 m_pElemList;
66 bool m_bMultiSelection;
67 sal_Int16 m_nServiceType;
68 OUString m_aDefaultName;
69 OUString m_aCurrentFilter;
71 OUString m_aOldDisplayDirectory;
72 OUString m_aOldHideDirectory;
74 OUString m_aStandardDir;
75 css::uno::Sequence< OUString >
76 m_aDenyList;
78 css::uno::Reference< css::ui::dialogs::XFilePickerListener >
79 m_xListener;
80 css::uno::Reference< css::ui::dialogs::XDialogClosedListener >
81 m_xDlgClosedListener;
83 public:
84 SvtFilePicker();
85 virtual ~SvtFilePicker() override;
88 // XExecutableDialog functions
90 virtual void SAL_CALL setTitle( const OUString& _rTitle ) override;
91 virtual sal_Int16 SAL_CALL execute( ) override;
94 // XAsynchronousExecutableDialog functions
96 virtual void SAL_CALL setDialogTitle( const OUString& _rTitle ) override;
97 virtual void SAL_CALL startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) override;
100 // XFilePicker functions
103 virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) override;
104 virtual void SAL_CALL setDefaultName( const OUString& aName ) override;
105 virtual void SAL_CALL setDisplayDirectory( const OUString& aDirectory ) override;
106 virtual OUString SAL_CALL getDisplayDirectory() override;
107 virtual css::uno::Sequence< OUString > SAL_CALL getFiles() override;
108 virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles() override;
111 // XFilePickerControlAccess functions
114 virtual void SAL_CALL setValue( sal_Int16 ElementID, sal_Int16 ControlAction, const css::uno::Any& value ) override;
115 virtual css::uno::Any SAL_CALL getValue( sal_Int16 ElementID, sal_Int16 ControlAction ) override;
116 virtual void SAL_CALL setLabel( sal_Int16 ElementID, const OUString& aValue ) override;
117 virtual OUString SAL_CALL getLabel( sal_Int16 ElementID ) override;
118 virtual void SAL_CALL enableControl( sal_Int16 ElementID, sal_Bool bEnable ) override;
121 // XFilePickerNotifier functions
124 virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
125 virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
128 // XFilePreview functions
131 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats() override;
132 virtual sal_Int32 SAL_CALL getTargetColorDepth() override;
133 virtual sal_Int32 SAL_CALL getAvailableWidth() override;
134 virtual sal_Int32 SAL_CALL getAvailableHeight() override;
135 virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any& aImage ) override;
136 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) override;
137 virtual sal_Bool SAL_CALL getShowState() override;
140 // XFilterManager functions
143 virtual void SAL_CALL appendFilter( const OUString& aTitle, const OUString& aFilter ) override;
144 virtual void SAL_CALL setCurrentFilter( const OUString& aTitle ) override;
145 virtual OUString SAL_CALL getCurrentFilter() override;
148 // XFilterGroupManager functions
150 virtual void SAL_CALL appendFilterGroup( const OUString& sGroupTitle, const css::uno::Sequence< css::beans::StringPair >& aFilters ) override;
153 // these methods are here because they're ambiguous
155 virtual void SAL_CALL cancel() override
156 { ::svt::OCommonPicker::cancel(); }
157 virtual void SAL_CALL dispose() override
158 { ::svt::OCommonPicker::dispose(); }
159 virtual void SAL_CALL addEventListener(const css::uno::Reference<css::lang::XEventListener>& l) override
160 { ::svt::OCommonPicker::addEventListener(l); }
161 virtual void SAL_CALL removeEventListener(const css::uno::Reference<css::lang::XEventListener>& l) override
162 { ::svt::OCommonPicker::removeEventListener(l); }
165 // XInitialization functions
168 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
171 // XServiceInfo functions
174 /* XServiceInfo */
175 virtual OUString SAL_CALL getImplementationName() override;
176 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
177 virtual css::uno::Sequence< OUString > SAL_CALL
178 getSupportedServiceNames() override;
180 protected:
182 // OCommonPicker overridables
184 virtual std::shared_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
185 virtual sal_Int16 implExecutePicker( ) override;
186 virtual bool implHandleInitializationArgument(
187 const OUString& _rName,
188 const css::uno::Any& _rValue
189 ) override;
191 protected:
192 PickerFlags getPickerFlags() const;
193 virtual void notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) override;
195 bool FilterNameExists( const OUString& rTitle );
196 bool FilterNameExists( const UnoFilterList& _rGroupedFilters );
198 void ensureFilterList( const OUString& _rInitialCurrentFilter );
200 void prepareExecute( );
202 void DialogClosedHdl(sal_Int32 nResult);
205 // SvtRemoteFilePicker
207 class SvtRemoteFilePicker : public SvtFilePicker
209 public:
210 SvtRemoteFilePicker();
212 virtual std::shared_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) override;
214 /* XServiceInfo */
215 virtual OUString SAL_CALL getImplementationName() override;
216 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
217 virtual css::uno::Sequence< OUString > SAL_CALL
218 getSupportedServiceNames() override;
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */