1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/tabpage.hxx>
30 #include <vcl/combobox.hxx>
31 #include <vcl/scrbar.hxx>
32 #include <cppuhelper/implbase1.hxx>
33 #include "bibshortcuthandler.hxx"
38 #define FIELD_COUNT 31
41 * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted
44 class BibGeneralPageFocusListener
: public cppu::WeakAggImplHelper1
< css::awt::XFocusListener
>
47 VclPtr
<BibGeneralPage
> mpBibGeneralPage
;
49 explicit BibGeneralPageFocusListener(BibGeneralPage
*pBibGeneralPage
);
50 virtual void SAL_CALL
focusGained( const css::awt::FocusEvent
& e
) override
;
51 virtual void SAL_CALL
focusLost( const css::awt::FocusEvent
& e
) override
;
52 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
56 class BibGeneralPage
: public TabPage
, public BibShortCutHandler
58 VclPtr
<VclGrid
> pGrid
;
59 VclPtr
<VclScrolledWindow
> pScrolledWindow
;
61 VclPtr
<FixedText
> pIdentifierFT
;
62 VclPtr
<FixedText
> pAuthTypeFT
;
63 VclPtr
<FixedText
> pYearFT
;
65 VclPtr
<FixedText
> pAuthorFT
;
66 VclPtr
<FixedText
> pTitleFT
;
68 VclPtr
<FixedText
> pPublisherFT
;
69 VclPtr
<FixedText
> pAddressFT
;
70 VclPtr
<FixedText
> pISBNFT
;
72 VclPtr
<FixedText
> pChapterFT
;
73 VclPtr
<FixedText
> pPagesFT
;
75 VclPtr
<FixedText
> pEditorFT
;
76 VclPtr
<FixedText
> pEditionFT
;
78 VclPtr
<FixedText
> pBooktitleFT
;
79 VclPtr
<FixedText
> pVolumeFT
;
80 VclPtr
<FixedText
> pHowpublishedFT
;
82 VclPtr
<FixedText
> pOrganizationsFT
;
83 VclPtr
<FixedText
> pInstitutionFT
;
84 VclPtr
<FixedText
> pSchoolFT
;
86 VclPtr
<FixedText
> pReportTypeFT
;
87 VclPtr
<FixedText
> pMonthFT
;
89 VclPtr
<FixedText
> pJournalFT
;
90 VclPtr
<FixedText
> pNumberFT
;
91 VclPtr
<FixedText
> pSeriesFT
;
93 VclPtr
<FixedText
> pAnnoteFT
;
94 VclPtr
<FixedText
> pNoteFT
;
95 VclPtr
<FixedText
> pURLFT
;
97 VclPtr
<FixedText
> pCustom1FT
;
98 VclPtr
<FixedText
> pCustom2FT
;
99 VclPtr
<FixedText
> pCustom3FT
;
100 VclPtr
<FixedText
> pCustom4FT
;
101 VclPtr
<FixedText
> pCustom5FT
;
103 VclPtr
<FixedText
> aFixedTexts
[ FIELD_COUNT
];
104 sal_Int16 nFT2CtrlMap
[ FIELD_COUNT
];
106 css::uno::Reference
< css::awt::XWindow
>
107 aControls
[ FIELD_COUNT
];
109 OUString sTableErrorString
;
111 OUString sTypeColumnName
;
113 css::uno::Reference
< css::awt::XControlContainer
>
116 css::uno::Reference
< css::form::XBoundComponent
>
119 css::uno::Reference
< css::sdbc::XRowSetListener
>
122 rtl::Reference
<BibGeneralPageFocusListener
> mxBibGeneralPageFocusListener
;
124 BibDataManager
* pDatMan
;
126 css::uno::Reference
< css::awt::XControlModel
>
127 AddXControl( const OUString
& rName
, FixedText
& rLabel
, const OString
& sHelpId
,
128 sal_Int16
& rIndex
, std::vector
<vcl::Window
*>& rChildren
);
130 void AddControlWithError( const OUString
& rColumnName
, FixedText
& rLabel
,
131 OUString
& rErrorString
,
132 const OString
& sHelpId
, sal_uInt16 nIndexInFTArray
, std::vector
<vcl::Window
*>& rChildren
);
135 void InitFixedTexts(); // create mnemonics and set text an all fixed texts
138 BibGeneralPage(vcl::Window
* pParent
, BibDataManager
* pDatMan
);
139 virtual ~BibGeneralPage() override
;
140 virtual void dispose() override
;
142 inline const OUString
& GetErrorString() const;
144 inline const css::uno::Reference
< css::form::XBoundComponent
>&
145 GetTypeListBoxModel() const;
146 inline const css::uno::Reference
< css::awt::XControlContainer
>&
147 GetControlContainer() const;
149 inline BibDataManager
* GetDataManager();
151 void CommitActiveControl();
153 void RemoveListeners();
155 virtual void GetFocus() override
;
157 virtual bool HandleShortCutKey( const KeyEvent
& rKeyEvent
) override
; // returns true, if key was handled
159 /// @throws css::uno::RuntimeException
160 void focusGained(const css::awt::FocusEvent
& rEvent
);
161 /// @throws css::uno::RuntimeException
167 inline const OUString
& BibGeneralPage::GetErrorString() const
169 return sTableErrorString
;
172 inline const css::uno::Reference
< css::form::XBoundComponent
>&
173 BibGeneralPage::GetTypeListBoxModel() const
178 inline const css::uno::Reference
< css::awt::XControlContainer
>&
179 BibGeneralPage::GetControlContainer() const
184 inline BibDataManager
* BibGeneralPage::GetDataManager()
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */