Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / extensions / source / bibliography / general.hxx
blob13a457e4dc01b28a89a00f2415ea22ab1b286214
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 #ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX
23 #include <com/sun/star/awt/XFocusListener.hpp>
24 #include <com/sun/star/awt/XControlContainer.hpp>
25 #include <com/sun/star/form/XBoundComponent.hpp>
26 #include <com/sun/star/sdbc/XRowSetListener.hpp>
28 #include <vcl/layout.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <vcl/group.hxx>
31 #include <svtools/svmedit.hxx>
32 #include <vcl/tabpage.hxx>
33 #include <vcl/combobox.hxx>
34 #include <vcl/scrbar.hxx>
35 #include <cppuhelper/implbase1.hxx>
36 #include "bibshortcuthandler.hxx"
39 class BibDataManager;
40 #define TYPE_COUNT 22
41 #define FIELD_COUNT 31
43 /**
44 * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted
46 class BibGeneralPage;
47 class BibGeneralPageFocusListener : public cppu::WeakAggImplHelper1 < css::awt::XFocusListener >
49 private:
50 VclPtr<BibGeneralPage> mpBibGeneralPage;
51 public:
52 explicit BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage);
53 virtual void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override;
54 virtual void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override;
55 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
59 class BibGeneralPage : public TabPage, public BibShortCutHandler
61 VclPtr<VclGrid> pGrid;
62 VclPtr<VclScrolledWindow> pScrolledWindow;
64 VclPtr<FixedText> pIdentifierFT;
65 VclPtr<FixedText> pAuthTypeFT;
66 VclPtr<FixedText> pYearFT;
68 VclPtr<FixedText> pAuthorFT;
69 VclPtr<FixedText> pTitleFT;
71 VclPtr<FixedText> pPublisherFT;
72 VclPtr<FixedText> pAddressFT;
73 VclPtr<FixedText> pISBNFT;
75 VclPtr<FixedText> pChapterFT;
76 VclPtr<FixedText> pPagesFT;
78 VclPtr<FixedText> pEditorFT;
79 VclPtr<FixedText> pEditionFT;
81 VclPtr<FixedText> pBooktitleFT;
82 VclPtr<FixedText> pVolumeFT;
83 VclPtr<FixedText> pHowpublishedFT;
85 VclPtr<FixedText> pOrganizationsFT;
86 VclPtr<FixedText> pInstitutionFT;
87 VclPtr<FixedText> pSchoolFT;
89 VclPtr<FixedText> pReportTypeFT;
90 VclPtr<FixedText> pMonthFT;
92 VclPtr<FixedText> pJournalFT;
93 VclPtr<FixedText> pNumberFT;
94 VclPtr<FixedText> pSeriesFT;
96 VclPtr<FixedText> pAnnoteFT;
97 VclPtr<FixedText> pNoteFT;
98 VclPtr<FixedText> pURLFT;
100 VclPtr<FixedText> pCustom1FT;
101 VclPtr<FixedText> pCustom2FT;
102 VclPtr<FixedText> pCustom3FT;
103 VclPtr<FixedText> pCustom4FT;
104 VclPtr<FixedText> pCustom5FT;
106 VclPtr<FixedText> aFixedTexts[ FIELD_COUNT ];
107 sal_Int16 nFT2CtrlMap[ FIELD_COUNT ];
109 css::uno::Reference< css::awt::XWindow >
110 aControls[ FIELD_COUNT ];
112 OUString sErrorPrefix;
113 OUString sTableErrorString;
115 OUString sTypeColumnName;
117 css::uno::Reference< css::awt::XControlContainer >
118 xCtrlContnr;
120 css::uno::Reference< css::form::XBoundComponent >
121 xLBModel;
123 css::uno::Reference< css::sdbc::XRowSetListener >
124 xPosListener;
126 rtl::Reference<BibGeneralPageFocusListener> mxBibGeneralPageFocusListener;
128 BibDataManager* pDatMan;
130 css::uno::Reference< css::awt::XControlModel >
131 AddXControl( const OUString& rName, FixedText& rLabel, const OString& sHelpId,
132 sal_Int16& rIndex, std::vector<vcl::Window*>& rChildren );
134 void AddControlWithError( const OUString& rColumnName, FixedText& rLabel,
135 OUString& rErrorString,
136 const OString& sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren );
138 protected:
139 void InitFixedTexts(); // create mnemonics and set text an all fixed texts
141 public:
142 BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
143 virtual ~BibGeneralPage() override;
144 virtual void dispose() override;
146 inline const OUString& GetErrorString() const;
148 inline const css::uno::Reference< css::form::XBoundComponent >&
149 GetTypeListBoxModel() const;
150 inline const css::uno::Reference< css::awt::XControlContainer >&
151 GetControlContainer() const;
153 inline BibDataManager* GetDataManager();
155 void CommitActiveControl();
157 void RemoveListeners();
159 virtual void GetFocus() override;
161 virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) override; // returns true, if key was handled
163 const rtl::Reference<BibGeneralPageFocusListener>& GetFocusListener() { return mxBibGeneralPageFocusListener; }
165 /// @throws css::uno::RuntimeException
166 void focusGained(const css::awt::FocusEvent& rEvent);
167 /// @throws css::uno::RuntimeException
168 void focusLost();
173 inline const OUString& BibGeneralPage::GetErrorString() const
175 return sTableErrorString;
178 inline const css::uno::Reference< css::form::XBoundComponent >&
179 BibGeneralPage::GetTypeListBoxModel() const
181 return xLBModel;
184 inline const css::uno::Reference< css::awt::XControlContainer >&
185 BibGeneralPage::GetControlContainer() const
187 return xCtrlContnr;
190 inline BibDataManager* BibGeneralPage::GetDataManager()
192 return pDatMan;
195 #endif
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */