Avoid potential negative array index access to cached text.
[LibreOffice.git] / extensions / source / bibliography / general.hxx
blob9708174ffa1fe2fdb54319c0af87483c7324487b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <sal/config.h>
24 #include <vcl/InterimItemWindow.hxx>
25 #include "bibshortcuthandler.hxx"
28 class BibDataManager;
29 #define TYPE_COUNT 22
30 #define FIELD_COUNT 31
32 class ChangeListener;
34 class BibGeneralPage : public InterimItemWindow
35 , public BibShortCutHandler
37 std::unique_ptr<weld::ScrolledWindow> xScrolledWindow;
38 std::unique_ptr<weld::Widget> xGrid;
40 std::unique_ptr<weld::Label> xIdentifierFT;
41 std::unique_ptr<weld::Entry> xIdentifierED;
43 std::unique_ptr<weld::Label> xAuthTypeFT;
44 std::unique_ptr<weld::ComboBox> xAuthTypeLB;
45 std::unique_ptr<weld::Label> xYearFT;
46 std::unique_ptr<weld::Entry> xYearED;
48 std::unique_ptr<weld::Label> xAuthorFT;
49 std::unique_ptr<weld::Entry> xAuthorED;
50 std::unique_ptr<weld::Label> xTitleFT;
51 std::unique_ptr<weld::Entry> xTitleED;
53 std::unique_ptr<weld::Label> xPublisherFT;
54 std::unique_ptr<weld::Entry> xPublisherED;
55 std::unique_ptr<weld::Label> xAddressFT;
56 std::unique_ptr<weld::Entry> xAddressED;
57 std::unique_ptr<weld::Label> xISBNFT;
58 std::unique_ptr<weld::Entry> xISBNED;
60 std::unique_ptr<weld::Label> xChapterFT;
61 std::unique_ptr<weld::Entry> xChapterED;
62 std::unique_ptr<weld::Label> xPagesFT;
63 std::unique_ptr<weld::Entry> xPagesED;
65 std::unique_ptr<weld::Label> xEditorFT;
66 std::unique_ptr<weld::Entry> xEditorED;
67 std::unique_ptr<weld::Label> xEditionFT;
68 std::unique_ptr<weld::Entry> xEditionED;
70 std::unique_ptr<weld::Label> xBooktitleFT;
71 std::unique_ptr<weld::Entry> xBooktitleED;
72 std::unique_ptr<weld::Label> xVolumeFT;
73 std::unique_ptr<weld::Entry> xVolumeED;
74 std::unique_ptr<weld::Label> xHowpublishedFT;
75 std::unique_ptr<weld::Entry> xHowpublishedED;
77 std::unique_ptr<weld::Label> xOrganizationsFT;
78 std::unique_ptr<weld::Entry> xOrganizationsED;
79 std::unique_ptr<weld::Label> xInstitutionFT;
80 std::unique_ptr<weld::Entry> xInstitutionED;
81 std::unique_ptr<weld::Label> xSchoolFT;
82 std::unique_ptr<weld::Entry> xSchoolED;
84 std::unique_ptr<weld::Label> xReportTypeFT;
85 std::unique_ptr<weld::Entry> xReportTypeED;
86 std::unique_ptr<weld::Label> xMonthFT;
87 std::unique_ptr<weld::Entry> xMonthED;
89 std::unique_ptr<weld::Label> xJournalFT;
90 std::unique_ptr<weld::Entry> xJournalED;
91 std::unique_ptr<weld::Label> xNumberFT;
92 std::unique_ptr<weld::Entry> xNumberED;
93 std::unique_ptr<weld::Label> xSeriesFT;
94 std::unique_ptr<weld::Entry> xSeriesED;
96 std::unique_ptr<weld::Label> xAnnoteFT;
97 std::unique_ptr<weld::Entry> xAnnoteED;
98 std::unique_ptr<weld::Label> xNoteFT;
99 std::unique_ptr<weld::Entry> xNoteED;
100 std::unique_ptr<weld::Label> xURLFT;
101 std::unique_ptr<weld::Entry> xURLED;
103 std::unique_ptr<weld::Label> xCustom1FT;
104 std::unique_ptr<weld::Entry> xCustom1ED;
105 std::unique_ptr<weld::Label> xCustom2FT;
106 std::unique_ptr<weld::Entry> xCustom2ED;
107 std::unique_ptr<weld::Label> xCustom3FT;
108 std::unique_ptr<weld::Entry> xCustom3ED;
109 std::unique_ptr<weld::Label> xCustom4FT;
110 std::unique_ptr<weld::Entry> xCustom4ED;
111 std::unique_ptr<weld::Label> xCustom5FT;
112 std::unique_ptr<weld::Entry> xCustom5ED;
113 std::unique_ptr<weld::Label> m_xLocalURLFT;
114 std::unique_ptr<weld::Entry> m_xLocalURLED;
115 std::unique_ptr<weld::Button> m_xLocalBrowseButton;
116 std::unique_ptr<weld::CheckButton> m_xLocalPageCB;
117 std::unique_ptr<weld::SpinButton> m_xLocalPageSB;
119 OUString sTableErrorString;
121 std::vector<rtl::Reference<ChangeListener>> maChangeListeners;
122 rtl::Reference<ChangeListener> m_aURLListener;
124 BibDataManager* pDatMan;
126 bool AddXControl(const OUString& rName, weld::Entry& rEntry);
127 bool AddXControl(const OUString& rName, weld::ComboBox& rList);
129 template<class Target> void AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName,
130 Target& rWidget, OUString& rErrorString, const OUString& rHelpId);
132 void SaveChanges();
134 DECL_LINK(GainFocusHdl, weld::Widget&, void);
136 DECL_LINK(FirstElementKeyInputHdl, const KeyEvent&, bool);
137 DECL_LINK(LastElementKeyInputHdl, const KeyEvent&, bool);
138 DECL_LINK(BrowseHdl, weld::Button&, void);
139 DECL_LINK(PageNumHdl, weld::Toggleable&, void);
140 DECL_LINK(LosePageFocusHdl, weld::Widget&, void);
142 public:
143 BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
144 virtual ~BibGeneralPage() override;
145 virtual void dispose() override;
147 const OUString& GetErrorString() const
149 return sTableErrorString;
152 weld::Entry& GetLocalURLED();
153 weld::CheckButton& GetLocalPageCB();
154 weld::SpinButton& GetLocalPageSB();
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */