Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX
22 :
23 : #include <unotools/configitem.hxx>
24 : #include <boost/ptr_container/ptr_vector.hpp>
25 :
26 : struct Mapping;
27 : typedef boost::ptr_vector<Mapping> MappingArray;
28 :
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 0 : struct StringPair
65 : {
66 : OUString sRealColumnName;
67 : OUString sLogicalColumnName;
68 : };
69 :
70 0 : struct Mapping
71 : {
72 : OUString sTableName;
73 : OUString sURL;
74 : sal_Int16 nCommandType;
75 : StringPair aColumnPairs[COLUMN_COUNT];
76 :
77 0 : Mapping() :
78 0 : nCommandType(0){}
79 : };
80 :
81 0 : struct BibDBDescriptor
82 : {
83 : OUString sDataSource;
84 : OUString sTableOrQuery;
85 : sal_Int32 nCommandType;
86 : };
87 :
88 :
89 : class BibConfig : public utl::ConfigItem
90 : {
91 : OUString sDataSource;
92 : OUString sTableOrQuery;
93 : sal_Int32 nTblOrQuery;
94 :
95 : OUString sQueryField;
96 : OUString sQueryText;
97 : MappingArray* pMappingsArr;
98 : long nBeamerSize;
99 : long nViewSize;
100 : bool bShowColumnAssignmentWarning;
101 :
102 : OUString aColumnDefaults[COLUMN_COUNT];
103 :
104 : static com::sun::star::uno::Sequence<OUString> GetPropertyNames();
105 :
106 : virtual void ImplCommit() SAL_OVERRIDE;
107 :
108 : public:
109 : BibConfig();
110 : virtual ~BibConfig();
111 :
112 : virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames) SAL_OVERRIDE;
113 :
114 : BibDBDescriptor GetBibliographyURL();
115 : void SetBibliographyURL(const BibDBDescriptor& rDesc);
116 :
117 : const Mapping* GetMapping(const BibDBDescriptor& rDesc) const;
118 : void SetMapping(const BibDBDescriptor& rDesc, const Mapping* pMapping);
119 :
120 0 : const OUString& GetDefColumnName(sal_uInt16 nIndex) const
121 0 : {return aColumnDefaults[nIndex];}
122 :
123 :
124 0 : void setBeamerSize(long nSize) {SetModified(); nBeamerSize = nSize;}
125 0 : long getBeamerSize()const {return nBeamerSize;}
126 0 : void setViewSize(long nSize) {SetModified(); nViewSize = nSize;}
127 0 : long getViewSize() {return nViewSize;}
128 :
129 0 : const OUString& getQueryField() const {return sQueryField;}
130 0 : void setQueryField(const OUString& rSet) {SetModified(); sQueryField = rSet;}
131 :
132 0 : const OUString& getQueryText() const {return sQueryText;}
133 0 : void setQueryText(const OUString& rSet) {SetModified(); sQueryText = rSet;}
134 :
135 0 : bool IsShowColumnAssignmentWarning() const
136 0 : { return bShowColumnAssignmentWarning;}
137 0 : void SetShowColumnAssignmentWarning(bool bSet)
138 0 : { bShowColumnAssignmentWarning = bSet;}
139 : };
140 :
141 : class DBChangeDialogConfig_Impl
142 : {
143 : com::sun::star::uno::Sequence<OUString> aSourceNames;
144 : public:
145 : DBChangeDialogConfig_Impl();
146 : ~DBChangeDialogConfig_Impl();
147 :
148 : const com::sun::star::uno::Sequence<OUString>& GetDataSourceNames();
149 :
150 : };
151 : #endif
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|