Line data Source code
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 :
20 : #ifndef SVTOOLS_RESTRICTEDPATHS_HXX
21 : #define SVTOOLS_RESTRICTEDPATHS_HXX
22 :
23 : #include <svl/urlfilter.hxx>
24 : #include <svl/svldllapi.h>
25 :
26 : #include <vector>
27 :
28 : namespace svt
29 : {
30 : class SVL_DLLPUBLIC RestrictedPaths : public IUrlFilter
31 : {
32 : private:
33 : ::std::vector< OUString > m_aUnrestrictedURLs;
34 : bool m_bFilterIsEnabled;
35 :
36 : public:
37 : RestrictedPaths();
38 : virtual ~RestrictedPaths();
39 :
40 : inline bool hasFilter() const { return !m_aUnrestrictedURLs.empty(); }
41 0 : inline const ::std::vector< OUString >& getFilter() const { return m_aUnrestrictedURLs; }
42 :
43 0 : inline void enableFilter( bool _bEnable ) { m_bFilterIsEnabled = _bEnable; }
44 : inline bool isFilterEnabled() const { return m_bFilterIsEnabled; }
45 :
46 : public:
47 : /** checks URL access permissions
48 :
49 : <p>with the "restriction" feature we have in the file dialog, it's possible that
50 : only certain URLs can be browsed. This method checks whether a given URL belongs
51 : to this set of permitted URLs.</p>
52 :
53 : <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
54 : */
55 : virtual bool isUrlAllowed( const OUString& _rURL ) const;
56 :
57 : /** checks URL access permissions
58 :
59 : <p>with the "restriction" feature we have in the file dialog, it's possible that
60 : only certain URLs can be browsed. This method checks whether a given URL belongs
61 : to this set of permitted URLs.</p>
62 :
63 : <p>Default behavior allows access to parent folder of a restricted folder (but not to its siblings).
64 : If allowParents is set to <FALSE/> parent folders will be treated as forbidden.
65 :
66 : <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
67 : */
68 : bool isUrlAllowed( const OUString& _rURL, bool allowParents ) const;
69 : };
70 :
71 : } // namespace svt
72 :
73 : #endif // SVTOOLS_RESTRICTEDPATHS_HXX
74 :
75 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|