1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX
20 #define INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX
21 
22 #include <vcl/weld.hxx>
23 #include <com/sun/star/beans/StringPair.hpp>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include "pickercallbacks.hxx"
27 
28 class SvTabListBox;
29 class SvtFileView;
30 class SvtFileDialogFilter_Impl;
31 
32 
33 enum class PickerFlags {
34     NONE              = 0x000000,
35     AutoExtension     = 0x000001,
36     FilterOptions     = 0x000002,
37     ShowVersions      = 0x000004,
38     InsertAsLink      = 0x000008,
39     ShowPreview       = 0x000010,
40     Templates         = 0x000020,
41     PlayButton        = 0x000040,
42     Selection         = 0x000080,
43     ImageTemplate     = 0x000100,
44     PathDialog        = 0x000200,
45     Open              = 0x000400,
46     SaveAs            = 0x000800,
47     Password          = 0x001000,
48     ReadOnly          = 0x002000,
49     MultiSelection    = 0x004000,
50     ImageAnchor       = 0x008000,
51 };
52 namespace o3tl {
53     template<> struct typed_flags<PickerFlags> : is_typed_flags<PickerFlags, 0x00ffff> {};
54 }
55 
56 #define FILEDIALOG_FILTER_ALL   "*.*"
57 
58 // SvtFileDialog_Base
59 
60 class SvtFileDialog_Base : public weld::GenericDialogController, public ::svt::IFilePickerController
61 {
62 public:
SvtFileDialog_Base(weld::Window * pParent,const OUString & rUIXMLDescription,const OString & rID)63     SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID)
64         : weld::GenericDialogController(pParent, rUIXMLDescription, rID)
65     {
66     }
67 
PrepareExecute()68     virtual bool PrepareExecute() { return true ; }
69 
70     virtual SvtFileView* GetView() = 0;
71 
72     virtual void SetHasFilename( bool bHasFilename ) = 0;
73     virtual void SetBlackList( const css::uno::Sequence< OUString >& rBlackList ) = 0;
74     virtual const css::uno::Sequence< OUString >& GetBlackList() const = 0;
75     virtual void SetStandardDir( const OUString& rStdDir ) = 0;
76     virtual const OUString& GetStandardDir() const = 0;
77     virtual void SetPath( const OUString& rNewURL ) = 0;
78     virtual const OUString& GetPath() = 0;
79     virtual std::vector<OUString> GetPathList() const = 0;
80     virtual bool ContentIsFolder( const OUString& rURL ) = 0;
81 
82     virtual OUString getCurrentFileText() const = 0;
83     virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) = 0;
84 
85     virtual void AddFilter( const OUString& rFilter, const OUString& rType ) = 0;
86     virtual void AddFilterGroup( const OUString& _rFilter,
87                                 const css::uno::Sequence< css::beans::StringPair >& rFilters ) = 0;
88     virtual OUString GetCurFilter() const = 0;
89     virtual void SetCurFilter( const OUString& rFilter ) = 0;
90     virtual void FilterSelect() = 0;
91 
92     virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) = 0;
93     virtual void onAsyncOperationStarted() = 0;
94     virtual void onAsyncOperationFinished() = 0;
95     virtual void UpdateControls( const OUString& rURL ) = 0;
96 
97     virtual void EnableAutocompletion( bool _bEnable = true ) = 0;
98 
99     virtual sal_Int32 getAvailableWidth() = 0;
100     virtual sal_Int32 getAvailableHeight() = 0;
101 
102     virtual void setImage( const css::uno::Any& rImage ) = 0;
103 
104     virtual bool getShowState() = 0;
105 };
106 
107 #define FILE_SELECTION_CHANGED  1
108 #define DIRECTORY_CHANGED       2
109 #define CTRL_STATE_CHANGED      4
110 #define DIALOG_SIZE_CHANGED     5
111 
112 
113 #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
116