1*46dbaceeSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*46dbaceeSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*46dbaceeSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*46dbaceeSAndrew Rist  * distributed with this work for additional information
6*46dbaceeSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*46dbaceeSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*46dbaceeSAndrew Rist  * "License"); you may not use this file except in compliance
9*46dbaceeSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*46dbaceeSAndrew Rist  *
11*46dbaceeSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*46dbaceeSAndrew Rist  *
13*46dbaceeSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*46dbaceeSAndrew Rist  * software distributed under the License is distributed on an
15*46dbaceeSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*46dbaceeSAndrew Rist  * KIND, either express or implied.  See the License for the
17*46dbaceeSAndrew Rist  * specific language governing permissions and limitations
18*46dbaceeSAndrew Rist  * under the License.
19*46dbaceeSAndrew Rist  *
20*46dbaceeSAndrew Rist  *************************************************************/
21*46dbaceeSAndrew Rist 
22*46dbaceeSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _BIBCONFIG_HXX
25cdf0e10cSrcweir #define _BIBCONFIG_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <unotools/configitem.hxx>
28cdf0e10cSrcweir class MappingArray;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir //-----------------------------------------------------------------------------
31cdf0e10cSrcweir #define COLUMN_COUNT 				31
32cdf0e10cSrcweir #define IDENTIFIER_POS				0
33cdf0e10cSrcweir #define AUTHORITYTYPE_POS			1
34cdf0e10cSrcweir #define AUTHOR_POS                  2
35cdf0e10cSrcweir #define TITLE_POS                   3
36cdf0e10cSrcweir #define YEAR_POS                    4
37cdf0e10cSrcweir #define ISBN_POS                    5
38cdf0e10cSrcweir #define BOOKTITLE_POS               6
39cdf0e10cSrcweir #define CHAPTER_POS                 7
40cdf0e10cSrcweir #define EDITION_POS                 8
41cdf0e10cSrcweir #define EDITOR_POS                  9
42cdf0e10cSrcweir #define HOWPUBLISHED_POS            10
43cdf0e10cSrcweir #define INSTITUTION_POS             11
44cdf0e10cSrcweir #define JOURNAL_POS                 12
45cdf0e10cSrcweir #define MONTH_POS                   13
46cdf0e10cSrcweir #define NOTE_POS                    14
47cdf0e10cSrcweir #define ANNOTE_POS                  15
48cdf0e10cSrcweir #define NUMBER_POS                  16
49cdf0e10cSrcweir #define ORGANIZATIONS_POS           17
50cdf0e10cSrcweir #define PAGES_POS                   18
51cdf0e10cSrcweir #define PUBLISHER_POS               19
52cdf0e10cSrcweir #define ADDRESS_POS                 20
53cdf0e10cSrcweir #define SCHOOL_POS                  21
54cdf0e10cSrcweir #define SERIES_POS                  22
55cdf0e10cSrcweir #define REPORTTYPE_POS              23
56cdf0e10cSrcweir #define VOLUME_POS                  24
57cdf0e10cSrcweir #define URL_POS                     25
58cdf0e10cSrcweir #define CUSTOM1_POS                 26
59cdf0e10cSrcweir #define CUSTOM2_POS                 27
60cdf0e10cSrcweir #define CUSTOM3_POS                 28
61cdf0e10cSrcweir #define CUSTOM4_POS                 29
62cdf0e10cSrcweir #define CUSTOM5_POS                 30
63cdf0e10cSrcweir //-----------------------------------------------------------------------------
64cdf0e10cSrcweir struct StringPair
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	rtl::OUString 	sRealColumnName;
67cdf0e10cSrcweir 	rtl::OUString  	sLogicalColumnName;
68cdf0e10cSrcweir };
69cdf0e10cSrcweir //-----------------------------------------------------------------------------
70cdf0e10cSrcweir struct Mapping
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	rtl::OUString 		sTableName;
73cdf0e10cSrcweir 	rtl::OUString		sURL;
74cdf0e10cSrcweir 	sal_Int16			nCommandType;
75cdf0e10cSrcweir 	StringPair 			aColumnPairs[COLUMN_COUNT];
76cdf0e10cSrcweir 
MappingMapping77cdf0e10cSrcweir 	Mapping() :
78cdf0e10cSrcweir 		nCommandType(0){}
79cdf0e10cSrcweir };
80cdf0e10cSrcweir //-----------------------------------------------------------------------------
81cdf0e10cSrcweir struct BibDBDescriptor
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	rtl::OUString 	sDataSource;
84cdf0e10cSrcweir 	rtl::OUString  	sTableOrQuery;
85cdf0e10cSrcweir 	sal_Int32 		nCommandType;
86cdf0e10cSrcweir };
87cdf0e10cSrcweir //-----------------------------------------------------------------------------
88cdf0e10cSrcweir 
89cdf0e10cSrcweir class BibConfig : public utl::ConfigItem
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	rtl::OUString 	sDataSource;
92cdf0e10cSrcweir 	rtl::OUString 	sTableOrQuery;
93cdf0e10cSrcweir 	sal_Int32 		nTblOrQuery;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	rtl::OUString 	sQueryField;
96cdf0e10cSrcweir 	rtl::OUString 	sQueryText;
97cdf0e10cSrcweir 	MappingArray*				pMappingsArr;
98cdf0e10cSrcweir     long 			nBeamerSize;
99cdf0e10cSrcweir 	long 			nViewSize;
100cdf0e10cSrcweir     sal_Bool        bShowColumnAssignmentWarning;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	rtl::OUString 				aColumnDefaults[COLUMN_COUNT];
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
105cdf0e10cSrcweir public:
106cdf0e10cSrcweir 	BibConfig();
107cdf0e10cSrcweir 	~BibConfig();
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	virtual void	Commit();
110cdf0e10cSrcweir     virtual void            Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	BibDBDescriptor			GetBibliographyURL();
113cdf0e10cSrcweir 	void					SetBibliographyURL(const BibDBDescriptor& rDesc);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	const Mapping* 			GetMapping(const BibDBDescriptor& rDesc) const;
116cdf0e10cSrcweir 	void					SetMapping(const BibDBDescriptor& rDesc, const Mapping* pMapping);
117cdf0e10cSrcweir 
GetDefColumnName(sal_uInt16 nIndex) const118cdf0e10cSrcweir 	const rtl::OUString&	GetDefColumnName(sal_uInt16 nIndex) const
119cdf0e10cSrcweir 											{return aColumnDefaults[nIndex];}
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
setBeamerSize(long nSize)122cdf0e10cSrcweir 	void					setBeamerSize(long nSize) {SetModified(); nBeamerSize = nSize;}
getBeamerSize() const123cdf0e10cSrcweir 	long					getBeamerSize()const {return nBeamerSize;}
setViewSize(long nSize)124cdf0e10cSrcweir 	void					setViewSize(long nSize) {SetModified(); nViewSize = nSize;}
getViewSize()125cdf0e10cSrcweir 	long					getViewSize() {return nViewSize;}
126cdf0e10cSrcweir 
getQueryField() const127cdf0e10cSrcweir 	const rtl::OUString&	getQueryField() const {return sQueryField;}
setQueryField(const rtl::OUString & rSet)128cdf0e10cSrcweir 	void					setQueryField(const rtl::OUString& rSet) {SetModified(); sQueryField = rSet;}
129cdf0e10cSrcweir 
getQueryText() const130cdf0e10cSrcweir 	const rtl::OUString&	getQueryText() const {return sQueryText;}
setQueryText(const rtl::OUString & rSet)131cdf0e10cSrcweir 	void					setQueryText(const rtl::OUString& rSet) {SetModified(); sQueryText = rSet;}
132cdf0e10cSrcweir 
IsShowColumnAssignmentWarning() const133cdf0e10cSrcweir     sal_Bool                IsShowColumnAssignmentWarning() const
134cdf0e10cSrcweir                                 { return bShowColumnAssignmentWarning;}
SetShowColumnAssignmentWarning(sal_Bool bSet)135cdf0e10cSrcweir     void                    SetShowColumnAssignmentWarning(sal_Bool bSet)
136cdf0e10cSrcweir                                 { bShowColumnAssignmentWarning = bSet;}
137cdf0e10cSrcweir };
138cdf0e10cSrcweir /* -----------------------------20.11.00 11:47--------------------------------
139cdf0e10cSrcweir 
140cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
141cdf0e10cSrcweir class DBChangeDialogConfig_Impl
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	com::sun::star::uno::Sequence<rtl::OUString> aSourceNames;
144cdf0e10cSrcweir public:
145cdf0e10cSrcweir 	DBChangeDialogConfig_Impl();
146cdf0e10cSrcweir 	~DBChangeDialogConfig_Impl();
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     const com::sun::star::uno::Sequence<rtl::OUString>& GetDataSourceNames();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir };
151cdf0e10cSrcweir #endif
152