1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SVTOOLS_RESTRICTEDPATHS_HXX 29 #define SVTOOLS_RESTRICTEDPATHS_HXX 30 31 #include <svl/urlfilter.hxx> 32 #include <svl/svldllapi.h> 33 #include <tools/string.hxx> 34 35 #include <vector> 36 37 namespace svt 38 { 39 class SVL_DLLPUBLIC RestrictedPaths : public IUrlFilter 40 { 41 private: 42 ::std::vector< String > m_aUnrestrictedURLs; 43 bool m_bFilterIsEnabled; 44 45 public: 46 RestrictedPaths(); 47 virtual ~RestrictedPaths(); 48 49 inline bool hasFilter() const { return !m_aUnrestrictedURLs.empty(); } 50 inline const ::std::vector< String >& getFilter() const { return m_aUnrestrictedURLs; } 51 52 inline void enableFilter( bool _bEnable ) { m_bFilterIsEnabled = _bEnable; } 53 inline bool isFilterEnabled() const { return m_bFilterIsEnabled; } 54 55 public: 56 /** checks URL access permissions 57 58 <p>with the "restriction" feature we have in the file dialog, it's possible that 59 only certain URLs can be browsed. This method checks whether a given URL belongs 60 to this set of permitted URLs.</p> 61 62 <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p> 63 */ 64 virtual bool isUrlAllowed( const String& _rURL ) const; 65 66 /** checks URL access permissions 67 68 <p>with the "restriction" feature we have in the file dialog, it's possible that 69 only certain URLs can be browsed. This method checks whether a given URL belongs 70 to this set of permitted URLs.</p> 71 72 <p>Default behavior allows access to parent folder of a restricted folder (but not to its siblings). 73 If allowParents is set to <FALSE/> parent folders will be treated as forbidden. 74 75 <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p> 76 */ 77 bool isUrlAllowed( const String& _rURL, bool allowParents ) const; 78 }; 79 80 } // namespace svt 81 82 #endif // SVTOOLS_RESTRICTEDPATHS_HXX 83