xref: /trunk/main/cui/source/inc/dbregister.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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_DBREGISTER_HXX
29 #define SVX_DBREGISTER_HXX
30 
31 #include "optpath.hxx"
32 #include <tools/string.hxx>
33 #include <comphelper/stl_types.hxx>
34 #include <svl/poolitem.hxx>
35 #include "ControlFocusHelper.hxx"
36 #include <sfx2/basedlgs.hxx>
37 
38 class SvLBoxEntry;
39 namespace svx
40 {
41     class OptHeaderTabListBox;
42 }
43 //........................................................................
44 namespace svx
45 {
46 //........................................................................
47 
48     //====================================================================
49     //= DbRegistrationOptionsPage
50     //====================================================================
51     class DbRegistrationOptionsPage : public SfxTabPage
52     {
53     private:
54         FixedLine           aStdBox;
55         FixedText           aTypeText;
56         FixedText           aPathText;
57         SvxControlFocusHelper   aPathCtrl;
58         PushButton          m_aNew;
59         PushButton          m_aEdit;
60         PushButton          m_aDelete;
61 
62         HeaderBar*          pHeaderBar;
63         ::svx::OptHeaderTabListBox* pPathBox;
64         SvLBoxEntry*        m_pCurEntry;
65         sal_uLong               m_nOldCount;
66         sal_Bool                m_bModified;
67 
68 #ifdef SVX_DBREGISTER_HXX
69         DECL_LINK( NewHdl, void * );
70         DECL_LINK( EditHdl, void * );
71         DECL_LINK( DeleteHdl, void * );
72 
73         DECL_LINK( PathSelect_Impl, SvTabListBox* );
74 
75         DECL_LINK( HeaderSelect_Impl, HeaderBar * );
76         DECL_LINK( HeaderEndDrag_Impl, HeaderBar * );
77         DECL_LINK( NameValidator, String*);
78 
79 
80         /** inserts a new entry in the tablistbox
81             @param  _sName
82                 The name of the entry.
83             @param  _sLocation
84                 The location of the file.
85         */
86         void insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool bReadOnly );
87 
88         /** opens the LinkDialog to create a register pair
89             @param  _sOldName
90                 The old name of the entry may be empty.
91             @param  _sOldLocation
92                 The old location of the entry may be empty.
93             @param  _pEntry
94                 The entry to remove if the entry will be changed
95         */
96         void openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry = NULL);
97 
98 #endif
99 
100     public:
101         DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet );
102         virtual ~DbRegistrationOptionsPage();
103 
104         static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
105         static sal_uInt16*      GetRanges();
106 
107         virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
108         virtual void        Reset( const SfxItemSet& rSet );
109         virtual void        FillUserData();
110     };
111 
112     //====================================================================
113     //= RegistrationItemSetHolder
114     //====================================================================
115     /** helper for DatabaseRegistrationDialog
116 
117         Necessary so that DatabaseRegistrationDialog is self-contained, i.e. always reflects
118         the current registration state.
119     */
120     class RegistrationItemSetHolder
121     {
122     private:
123         SfxItemSet  m_aRegistrationItems;
124 
125     protected:
126         RegistrationItemSetHolder( const SfxItemSet& _rMasterSet );
127         ~RegistrationItemSetHolder();
128 
129     protected:
130         const SfxItemSet& getRegistrationItems() const { return m_aRegistrationItems; }
131     };
132 
133     //====================================================================
134     //= DatabaseRegistrationDialog
135     //====================================================================
136     class DatabaseRegistrationDialog    :public RegistrationItemSetHolder
137                                         ,public SfxSingleTabDialog
138     {
139     public:
140         DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rAttr );
141         ~DatabaseRegistrationDialog();
142 
143         virtual short   Execute();
144     };
145 
146 //........................................................................
147 }   // namespace svx
148 //........................................................................
149 
150 #endif // SVX_DBREGISTER_HXX
151 
152 
153