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 _BIBCONFIG_HXX
25 #define _BIBCONFIG_HXX
26 
27 #include <unotools/configitem.hxx>
28 class MappingArray;
29 
30 //-----------------------------------------------------------------------------
31 #define COLUMN_COUNT 				31
32 #define IDENTIFIER_POS				0
33 #define AUTHORITYTYPE_POS			1
34 #define AUTHOR_POS                  2
35 #define TITLE_POS                   3
36 #define YEAR_POS                    4
37 #define ISBN_POS                    5
38 #define BOOKTITLE_POS               6
39 #define CHAPTER_POS                 7
40 #define EDITION_POS                 8
41 #define EDITOR_POS                  9
42 #define HOWPUBLISHED_POS            10
43 #define INSTITUTION_POS             11
44 #define JOURNAL_POS                 12
45 #define MONTH_POS                   13
46 #define NOTE_POS                    14
47 #define ANNOTE_POS                  15
48 #define NUMBER_POS                  16
49 #define ORGANIZATIONS_POS           17
50 #define PAGES_POS                   18
51 #define PUBLISHER_POS               19
52 #define ADDRESS_POS                 20
53 #define SCHOOL_POS                  21
54 #define SERIES_POS                  22
55 #define REPORTTYPE_POS              23
56 #define VOLUME_POS                  24
57 #define URL_POS                     25
58 #define CUSTOM1_POS                 26
59 #define CUSTOM2_POS                 27
60 #define CUSTOM3_POS                 28
61 #define CUSTOM4_POS                 29
62 #define CUSTOM5_POS                 30
63 //-----------------------------------------------------------------------------
64 struct StringPair
65 {
66 	rtl::OUString 	sRealColumnName;
67 	rtl::OUString  	sLogicalColumnName;
68 };
69 //-----------------------------------------------------------------------------
70 struct Mapping
71 {
72 	rtl::OUString 		sTableName;
73 	rtl::OUString		sURL;
74 	sal_Int16			nCommandType;
75 	StringPair 			aColumnPairs[COLUMN_COUNT];
76 
MappingMapping77 	Mapping() :
78 		nCommandType(0){}
79 };
80 //-----------------------------------------------------------------------------
81 struct BibDBDescriptor
82 {
83 	rtl::OUString 	sDataSource;
84 	rtl::OUString  	sTableOrQuery;
85 	sal_Int32 		nCommandType;
86 };
87 //-----------------------------------------------------------------------------
88 
89 class BibConfig : public utl::ConfigItem
90 {
91 	rtl::OUString 	sDataSource;
92 	rtl::OUString 	sTableOrQuery;
93 	sal_Int32 		nTblOrQuery;
94 
95 	rtl::OUString 	sQueryField;
96 	rtl::OUString 	sQueryText;
97 	MappingArray*				pMappingsArr;
98     long 			nBeamerSize;
99 	long 			nViewSize;
100     sal_Bool        bShowColumnAssignmentWarning;
101 
102 	rtl::OUString 				aColumnDefaults[COLUMN_COUNT];
103 
104 	com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
105 public:
106 	BibConfig();
107 	~BibConfig();
108 
109 	virtual void	Commit();
110     virtual void            Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
111 
112 	BibDBDescriptor			GetBibliographyURL();
113 	void					SetBibliographyURL(const BibDBDescriptor& rDesc);
114 
115 	const Mapping* 			GetMapping(const BibDBDescriptor& rDesc) const;
116 	void					SetMapping(const BibDBDescriptor& rDesc, const Mapping* pMapping);
117 
GetDefColumnName(sal_uInt16 nIndex) const118 	const rtl::OUString&	GetDefColumnName(sal_uInt16 nIndex) const
119 											{return aColumnDefaults[nIndex];}
120 
121 
setBeamerSize(long nSize)122 	void					setBeamerSize(long nSize) {SetModified(); nBeamerSize = nSize;}
getBeamerSize() const123 	long					getBeamerSize()const {return nBeamerSize;}
setViewSize(long nSize)124 	void					setViewSize(long nSize) {SetModified(); nViewSize = nSize;}
getViewSize()125 	long					getViewSize() {return nViewSize;}
126 
getQueryField() const127 	const rtl::OUString&	getQueryField() const {return sQueryField;}
setQueryField(const rtl::OUString & rSet)128 	void					setQueryField(const rtl::OUString& rSet) {SetModified(); sQueryField = rSet;}
129 
getQueryText() const130 	const rtl::OUString&	getQueryText() const {return sQueryText;}
setQueryText(const rtl::OUString & rSet)131 	void					setQueryText(const rtl::OUString& rSet) {SetModified(); sQueryText = rSet;}
132 
IsShowColumnAssignmentWarning() const133     sal_Bool                IsShowColumnAssignmentWarning() const
134                                 { return bShowColumnAssignmentWarning;}
SetShowColumnAssignmentWarning(sal_Bool bSet)135     void                    SetShowColumnAssignmentWarning(sal_Bool bSet)
136                                 { bShowColumnAssignmentWarning = bSet;}
137 };
138 /* -----------------------------20.11.00 11:47--------------------------------
139 
140  ---------------------------------------------------------------------------*/
141 class DBChangeDialogConfig_Impl
142 {
143 	com::sun::star::uno::Sequence<rtl::OUString> aSourceNames;
144 public:
145 	DBChangeDialogConfig_Impl();
146 	~DBChangeDialogConfig_Impl();
147 
148     const com::sun::star::uno::Sequence<rtl::OUString>& GetDataSourceNames();
149 
150 };
151 #endif
152