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