summaryrefslogtreecommitdiff
path: root/extensions/source/bibliography/general.hxx
blob: 31eece3891cf614df6387de51e01a8f7774dc1ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX
#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX

#include <sal/config.h>

#include <string_view>

#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/form/XBoundComponent.hpp>
#include <com/sun/star/sdbc/XRowSetListener.hpp>

#include <vcl/InterimItemWindow.hxx>
#include <cppuhelper/implbase1.hxx>
#include "bibshortcuthandler.hxx"


class BibDataManager;
#define TYPE_COUNT 22
#define FIELD_COUNT 31

class ChangeListener;

class BibGeneralPage : public InterimItemWindow
                     , public BibShortCutHandler
{
    std::unique_ptr<weld::ScrolledWindow> xScrolledWindow;
    std::unique_ptr<weld::Widget> xGrid;

    std::unique_ptr<weld::Label> xIdentifierFT;
    std::unique_ptr<weld::Entry> xIdentifierED;

    std::unique_ptr<weld::Label> xAuthTypeFT;
    std::unique_ptr<weld::ComboBox> xAuthTypeLB;
    std::unique_ptr<weld::Label> xYearFT;
    std::unique_ptr<weld::Entry> xYearED;

    std::unique_ptr<weld::Label> xAuthorFT;
    std::unique_ptr<weld::Entry> xAuthorED;
    std::unique_ptr<weld::Label> xTitleFT;
    std::unique_ptr<weld::Entry> xTitleED;

    std::unique_ptr<weld::Label> xPublisherFT;
    std::unique_ptr<weld::Entry> xPublisherED;
    std::unique_ptr<weld::Label> xAddressFT;
    std::unique_ptr<weld::Entry> xAddressED;
    std::unique_ptr<weld::Label> xISBNFT;
    std::unique_ptr<weld::Entry> xISBNED;

    std::unique_ptr<weld::Label> xChapterFT;
    std::unique_ptr<weld::Entry> xChapterED;
    std::unique_ptr<weld::Label> xPagesFT;
    std::unique_ptr<weld::Entry> xPagesED;

    std::unique_ptr<weld::Label> xEditorFT;
    std::unique_ptr<weld::Entry> xEditorED;
    std::unique_ptr<weld::Label> xEditionFT;
    std::unique_ptr<weld::Entry> xEditionED;

    std::unique_ptr<weld::Label> xBooktitleFT;
    std::unique_ptr<weld::Entry> xBooktitleED;
    std::unique_ptr<weld::Label> xVolumeFT;
    std::unique_ptr<weld::Entry> xVolumeED;
    std::unique_ptr<weld::Label> xHowpublishedFT;
    std::unique_ptr<weld::Entry> xHowpublishedED;

    std::unique_ptr<weld::Label> xOrganizationsFT;
    std::unique_ptr<weld::Entry> xOrganizationsED;
    std::unique_ptr<weld::Label> xInstitutionFT;
    std::unique_ptr<weld::Entry> xInstitutionED;
    std::unique_ptr<weld::Label> xSchoolFT;
    std::unique_ptr<weld::Entry> xSchoolED;

    std::unique_ptr<weld::Label> xReportTypeFT;
    std::unique_ptr<weld::Entry> xReportTypeED;
    std::unique_ptr<weld::Label> xMonthFT;
    std::unique_ptr<weld::Entry> xMonthED;

    std::unique_ptr<weld::Label> xJournalFT;
    std::unique_ptr<weld::Entry> xJournalED;
    std::unique_ptr<weld::Label> xNumberFT;
    std::unique_ptr<weld::Entry> xNumberED;
    std::unique_ptr<weld::Label> xSeriesFT;
    std::unique_ptr<weld::Entry> xSeriesED;

    std::unique_ptr<weld::Label> xAnnoteFT;
    std::unique_ptr<weld::Entry> xAnnoteED;
    std::unique_ptr<weld::Label> xNoteFT;
    std::unique_ptr<weld::Entry> xNoteED;
    std::unique_ptr<weld::Label> xURLFT;
    std::unique_ptr<weld::Entry> xURLED;

    std::unique_ptr<weld::Label> xCustom1FT;
    std::unique_ptr<weld::Entry> xCustom1ED;
    std::unique_ptr<weld::Label> xCustom2FT;
    std::unique_ptr<weld::Entry> xCustom2ED;
    std::unique_ptr<weld::Label> xCustom3FT;
    std::unique_ptr<weld::Entry> xCustom3ED;
    std::unique_ptr<weld::Label> xCustom4FT;
    std::unique_ptr<weld::Entry> xCustom4ED;
    std::unique_ptr<weld::Label> xCustom5FT;
    std::unique_ptr<weld::Entry> xCustom5ED;

    OUString            sTableErrorString;

    std::vector<rtl::Reference<ChangeListener>> maChangeListeners;

    BibDataManager*     pDatMan;

    bool                        AddXControl(const OUString& rName, weld::Entry& rEntry);
    bool                        AddXControl(const OUString& rName, weld::ComboBox& rList);

    template<class Target> void AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName,
        Target& rWidget, OUString& rErrorString, const OString& rHelpId);

    void SaveChanges();

    DECL_LINK(GainFocusHdl, weld::Widget&, void);

    DECL_LINK(FirstElementKeyInputHdl, const KeyEvent&, bool);
    DECL_LINK(LastElementKeyInputHdl, const KeyEvent&, bool);

public:
                                BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
    virtual                     ~BibGeneralPage() override;
    virtual void                dispose() override;

    const OUString&      GetErrorString() const
    {
        return sTableErrorString;
    }

    BibDataManager*      GetDataManager()
    {
        return pDatMan;
    }
};

#endif


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */