Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _BIBCONFIG_HXX
30 : : #define _BIBCONFIG_HXX
31 : :
32 : : #include <unotools/configitem.hxx>
33 : : #include <boost/ptr_container/ptr_vector.hpp>
34 : :
35 : : struct Mapping;
36 : : typedef boost::ptr_vector<Mapping> MappingArray;
37 : :
38 : :
39 : : //-----------------------------------------------------------------------------
40 : : #define COLUMN_COUNT 31
41 : : #define IDENTIFIER_POS 0
42 : : #define AUTHORITYTYPE_POS 1
43 : : #define AUTHOR_POS 2
44 : : #define TITLE_POS 3
45 : : #define YEAR_POS 4
46 : : #define ISBN_POS 5
47 : : #define BOOKTITLE_POS 6
48 : : #define CHAPTER_POS 7
49 : : #define EDITION_POS 8
50 : : #define EDITOR_POS 9
51 : : #define HOWPUBLISHED_POS 10
52 : : #define INSTITUTION_POS 11
53 : : #define JOURNAL_POS 12
54 : : #define MONTH_POS 13
55 : : #define NOTE_POS 14
56 : : #define ANNOTE_POS 15
57 : : #define NUMBER_POS 16
58 : : #define ORGANIZATIONS_POS 17
59 : : #define PAGES_POS 18
60 : : #define PUBLISHER_POS 19
61 : : #define ADDRESS_POS 20
62 : : #define SCHOOL_POS 21
63 : : #define SERIES_POS 22
64 : : #define REPORTTYPE_POS 23
65 : : #define VOLUME_POS 24
66 : : #define URL_POS 25
67 : : #define CUSTOM1_POS 26
68 : : #define CUSTOM2_POS 27
69 : : #define CUSTOM3_POS 28
70 : : #define CUSTOM4_POS 29
71 : : #define CUSTOM5_POS 30
72 : : //-----------------------------------------------------------------------------
73 : 0 : struct StringPair
74 : : {
75 : : rtl::OUString sRealColumnName;
76 : : rtl::OUString sLogicalColumnName;
77 : : };
78 : : //-----------------------------------------------------------------------------
79 [ # # ][ # # ]: 0 : struct Mapping
[ # # ]
80 : : {
81 : : rtl::OUString sTableName;
82 : : rtl::OUString sURL;
83 : : sal_Int16 nCommandType;
84 : : StringPair aColumnPairs[COLUMN_COUNT];
85 : :
86 : 0 : Mapping() :
87 [ # # ]: 0 : nCommandType(0){}
88 : : };
89 : : //-----------------------------------------------------------------------------
90 : 0 : struct BibDBDescriptor
91 : : {
92 : : rtl::OUString sDataSource;
93 : : rtl::OUString sTableOrQuery;
94 : : sal_Int32 nCommandType;
95 : : };
96 : : //-----------------------------------------------------------------------------
97 : :
98 : : class BibConfig : public utl::ConfigItem
99 : : {
100 : : rtl::OUString sDataSource;
101 : : rtl::OUString sTableOrQuery;
102 : : sal_Int32 nTblOrQuery;
103 : :
104 : : rtl::OUString sQueryField;
105 : : rtl::OUString sQueryText;
106 : : MappingArray* pMappingsArr;
107 : : long nBeamerSize;
108 : : long nViewSize;
109 : : sal_Bool bShowColumnAssignmentWarning;
110 : :
111 : : rtl::OUString aColumnDefaults[COLUMN_COUNT];
112 : :
113 : : com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
114 : : public:
115 : : BibConfig();
116 : : ~BibConfig();
117 : :
118 : : virtual void Commit();
119 : : virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
120 : :
121 : : BibDBDescriptor GetBibliographyURL();
122 : : void SetBibliographyURL(const BibDBDescriptor& rDesc);
123 : :
124 : : const Mapping* GetMapping(const BibDBDescriptor& rDesc) const;
125 : : void SetMapping(const BibDBDescriptor& rDesc, const Mapping* pMapping);
126 : :
127 : 0 : const rtl::OUString& GetDefColumnName(sal_uInt16 nIndex) const
128 : 0 : {return aColumnDefaults[nIndex];}
129 : :
130 : :
131 : 0 : void setBeamerSize(long nSize) {SetModified(); nBeamerSize = nSize;}
132 : 0 : long getBeamerSize()const {return nBeamerSize;}
133 : 0 : void setViewSize(long nSize) {SetModified(); nViewSize = nSize;}
134 : 0 : long getViewSize() {return nViewSize;}
135 : :
136 : 0 : const rtl::OUString& getQueryField() const {return sQueryField;}
137 : 0 : void setQueryField(const rtl::OUString& rSet) {SetModified(); sQueryField = rSet;}
138 : :
139 : 0 : const rtl::OUString& getQueryText() const {return sQueryText;}
140 : 0 : void setQueryText(const rtl::OUString& rSet) {SetModified(); sQueryText = rSet;}
141 : :
142 : 0 : sal_Bool IsShowColumnAssignmentWarning() const
143 : 0 : { return bShowColumnAssignmentWarning;}
144 : 0 : void SetShowColumnAssignmentWarning(sal_Bool bSet)
145 : 0 : { bShowColumnAssignmentWarning = bSet;}
146 : : };
147 : :
148 : : class DBChangeDialogConfig_Impl
149 : : {
150 : : com::sun::star::uno::Sequence<rtl::OUString> aSourceNames;
151 : : public:
152 : : DBChangeDialogConfig_Impl();
153 : : ~DBChangeDialogConfig_Impl();
154 : :
155 : : const com::sun::star::uno::Sequence<rtl::OUString>& GetDataSourceNames();
156 : :
157 : : };
158 : : #endif
159 : :
160 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|