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 SVX_DATABASELOCATIONINPUT_HXX 29 #define SVX_DATABASELOCATIONINPUT_HXX 30 31 #include "svx/svxdllapi.h" 32 33 /** === begin UNO includes === **/ 34 /** === end UNO includes === **/ 35 36 class PushButton; 37 class String; 38 namespace svt { class OFileURLControl; } 39 namespace comphelper { class ComponentContext; } 40 41 #include <memory> 42 43 //........................................................................ 44 namespace svx 45 { 46 //........................................................................ 47 48 //==================================================================== 49 //= DatabaseLocationInputController 50 //==================================================================== 51 class DatabaseLocationInputController_Impl; 52 /** helper class to control controls needed to input a database location 53 54 If you allow, in your dialog, to save a database document, then you usually 55 have a OFileURLControl for inputting the actual location, and a push button 56 to browse for a location. 57 58 This helper class controls such two UI elements. 59 */ 60 class SVX_DLLPUBLIC DatabaseLocationInputController 61 { 62 public: 63 DatabaseLocationInputController( 64 const ::comphelper::ComponentContext& _rContext, 65 ::svt::OFileURLControl& _rLocationInput, 66 PushButton& _rBrowseButton 67 ); 68 ~DatabaseLocationInputController(); 69 70 /** sets the given URL at the input control, after translating it into a system path 71 */ 72 void setURL( const String& _rURL ); 73 74 /** returns the current database location, in form of an URL (not a system path) 75 */ 76 String getURL() const; 77 78 /** prepares committing the database location entered in the input field 79 80 Effectively, this method checks whether the file in the location already 81 exists, and if so, it asks the user whether to overwrite it. 82 83 If the method is called multiple times, this check only happens when the location 84 changed since the last call. 85 */ 86 bool prepareCommit(); 87 88 private: 89 ::std::auto_ptr< DatabaseLocationInputController_Impl > 90 m_pImpl; 91 }; 92 93 //........................................................................ 94 } // namespace svx 95 //........................................................................ 96 97 #endif // SVX_DATABASELOCATIONINPUT_HXX 98