xref: /trunk/main/cui/source/inc/dbregister.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c4eee24dSAndrew Rist  * distributed with this work for additional information
6*c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9*c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15*c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18*c4eee24dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*c4eee24dSAndrew Rist  *************************************************************/
21*c4eee24dSAndrew Rist 
22*c4eee24dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SVX_DBREGISTER_HXX
25cdf0e10cSrcweir #define SVX_DBREGISTER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "optpath.hxx"
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
30cdf0e10cSrcweir #include <svl/poolitem.hxx>
31cdf0e10cSrcweir #include "ControlFocusHelper.hxx"
32cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class SvLBoxEntry;
35cdf0e10cSrcweir namespace svx
36cdf0e10cSrcweir {
37cdf0e10cSrcweir     class OptHeaderTabListBox;
38cdf0e10cSrcweir }
39cdf0e10cSrcweir //........................................................................
40cdf0e10cSrcweir namespace svx
41cdf0e10cSrcweir {
42cdf0e10cSrcweir //........................................................................
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     //====================================================================
45cdf0e10cSrcweir     //= DbRegistrationOptionsPage
46cdf0e10cSrcweir     //====================================================================
47cdf0e10cSrcweir     class DbRegistrationOptionsPage : public SfxTabPage
48cdf0e10cSrcweir     {
49cdf0e10cSrcweir     private:
50cdf0e10cSrcweir         FixedLine           aStdBox;
51cdf0e10cSrcweir         FixedText           aTypeText;
52cdf0e10cSrcweir         FixedText           aPathText;
53cdf0e10cSrcweir         SvxControlFocusHelper   aPathCtrl;
54cdf0e10cSrcweir         PushButton          m_aNew;
55cdf0e10cSrcweir         PushButton          m_aEdit;
56cdf0e10cSrcweir         PushButton          m_aDelete;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir         HeaderBar*          pHeaderBar;
59cdf0e10cSrcweir         ::svx::OptHeaderTabListBox* pPathBox;
60cdf0e10cSrcweir         SvLBoxEntry*        m_pCurEntry;
61cdf0e10cSrcweir         sal_uLong               m_nOldCount;
62cdf0e10cSrcweir         sal_Bool                m_bModified;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir #ifdef SVX_DBREGISTER_HXX
65cdf0e10cSrcweir         DECL_LINK( NewHdl, void * );
66cdf0e10cSrcweir         DECL_LINK( EditHdl, void * );
67cdf0e10cSrcweir         DECL_LINK( DeleteHdl, void * );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         DECL_LINK( PathSelect_Impl, SvTabListBox* );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir         DECL_LINK( HeaderSelect_Impl, HeaderBar * );
72cdf0e10cSrcweir         DECL_LINK( HeaderEndDrag_Impl, HeaderBar * );
73cdf0e10cSrcweir         DECL_LINK( NameValidator, String*);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         /** inserts a new entry in the tablistbox
77cdf0e10cSrcweir             @param  _sName
78cdf0e10cSrcweir                 The name of the entry.
79cdf0e10cSrcweir             @param  _sLocation
80cdf0e10cSrcweir                 The location of the file.
81cdf0e10cSrcweir         */
82cdf0e10cSrcweir         void insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool bReadOnly );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         /** opens the LinkDialog to create a register pair
85cdf0e10cSrcweir             @param  _sOldName
86cdf0e10cSrcweir                 The old name of the entry may be empty.
87cdf0e10cSrcweir             @param  _sOldLocation
88cdf0e10cSrcweir                 The old location of the entry may be empty.
89cdf0e10cSrcweir             @param  _pEntry
90cdf0e10cSrcweir                 The entry to remove if the entry will be changed
91cdf0e10cSrcweir         */
92cdf0e10cSrcweir         void openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry = NULL);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir #endif
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     public:
97cdf0e10cSrcweir         DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet );
98cdf0e10cSrcweir         virtual ~DbRegistrationOptionsPage();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
101cdf0e10cSrcweir         static sal_uInt16*      GetRanges();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
104cdf0e10cSrcweir         virtual void        Reset( const SfxItemSet& rSet );
105cdf0e10cSrcweir         virtual void        FillUserData();
106cdf0e10cSrcweir     };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     //====================================================================
109cdf0e10cSrcweir     //= RegistrationItemSetHolder
110cdf0e10cSrcweir     //====================================================================
111cdf0e10cSrcweir     /** helper for DatabaseRegistrationDialog
112cdf0e10cSrcweir 
113cdf0e10cSrcweir         Necessary so that DatabaseRegistrationDialog is self-contained, i.e. always reflects
114cdf0e10cSrcweir         the current registration state.
115cdf0e10cSrcweir     */
116cdf0e10cSrcweir     class RegistrationItemSetHolder
117cdf0e10cSrcweir     {
118cdf0e10cSrcweir     private:
119cdf0e10cSrcweir         SfxItemSet  m_aRegistrationItems;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     protected:
122cdf0e10cSrcweir         RegistrationItemSetHolder( const SfxItemSet& _rMasterSet );
123cdf0e10cSrcweir         ~RegistrationItemSetHolder();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     protected:
getRegistrationItems() const126cdf0e10cSrcweir         const SfxItemSet& getRegistrationItems() const { return m_aRegistrationItems; }
127cdf0e10cSrcweir     };
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     //====================================================================
130cdf0e10cSrcweir     //= DatabaseRegistrationDialog
131cdf0e10cSrcweir     //====================================================================
132cdf0e10cSrcweir     class DatabaseRegistrationDialog    :public RegistrationItemSetHolder
133cdf0e10cSrcweir                                         ,public SfxSingleTabDialog
134cdf0e10cSrcweir     {
135cdf0e10cSrcweir     public:
136cdf0e10cSrcweir         DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rAttr );
137cdf0e10cSrcweir         ~DatabaseRegistrationDialog();
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         virtual short   Execute();
140cdf0e10cSrcweir     };
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //........................................................................
143cdf0e10cSrcweir }   // namespace svx
144cdf0e10cSrcweir //........................................................................
145cdf0e10cSrcweir 
146cdf0e10cSrcweir #endif // SVX_DBREGISTER_HXX
147