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