1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SVX_DATABASELOCATIONINPUT_HXX 25 #define SVX_DATABASELOCATIONINPUT_HXX 26 27 #include "svx/svxdllapi.h" 28 29 /** === begin UNO includes === **/ 30 /** === end UNO includes === **/ 31 32 class PushButton; 33 class String; 34 namespace svt { class OFileURLControl; } 35 namespace comphelper { class ComponentContext; } 36 37 #include <memory> 38 39 //........................................................................ 40 namespace svx 41 { 42 //........................................................................ 43 44 //==================================================================== 45 //= DatabaseLocationInputController 46 //==================================================================== 47 class DatabaseLocationInputController_Impl; 48 /** helper class to control controls needed to input a database location 49 50 If you allow, in your dialog, to save a database document, then you usually 51 have a OFileURLControl for inputting the actual location, and a push button 52 to browse for a location. 53 54 This helper class controls such two UI elements. 55 */ 56 class SVX_DLLPUBLIC DatabaseLocationInputController 57 { 58 public: 59 DatabaseLocationInputController( 60 const ::comphelper::ComponentContext& _rContext, 61 ::svt::OFileURLControl& _rLocationInput, 62 PushButton& _rBrowseButton 63 ); 64 ~DatabaseLocationInputController(); 65 66 /** sets the given URL at the input control, after translating it into a system path 67 */ 68 void setURL( const String& _rURL ); 69 70 /** returns the current database location, in form of an URL (not a system path) 71 */ 72 String getURL() const; 73 74 /** prepares committing the database location entered in the input field 75 76 Effectively, this method checks whether the file in the location already 77 exists, and if so, it asks the user whether to overwrite it. 78 79 If the method is called multiple times, this check only happens when the location 80 changed since the last call. 81 */ 82 bool prepareCommit(); 83 84 private: 85 ::std::auto_ptr< DatabaseLocationInputController_Impl > 86 m_pImpl; 87 }; 88 89 //........................................................................ 90 } // namespace svx 91 //........................................................................ 92 93 #endif // SVX_DATABASELOCATIONINPUT_HXX 94