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/scrbar.hxx>
31 #include <cppuhelper/implbase1.hxx>
32 #include "bibshortcuthandler.hxx"
37 #define FIELD_COUNT 31
40 * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted
43 class BibGeneralPageFocusListener
: public cppu::WeakAggImplHelper1
< css::awt::XFocusListener
>
46 VclPtr
<BibGeneralPage
> mpBibGeneralPage
;
48 explicit BibGeneralPageFocusListener(BibGeneralPage
*pBibGeneralPage
);
49 virtual void SAL_CALL
focusGained( const css::awt::FocusEvent
& e
) override
;
50 virtual void SAL_CALL
focusLost( const css::awt::FocusEvent
& e
) override
;
51 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
55 class BibGeneralPage
: public TabPage
, public BibShortCutHandler
57 VclPtr
<VclGrid
> pGrid
;
58 VclPtr
<VclScrolledWindow
> pScrolledWindow
;
60 VclPtr
<FixedText
> pIdentifierFT
;
61 VclPtr
<FixedText
> pAuthTypeFT
;
62 VclPtr
<FixedText
> pYearFT
;
64 VclPtr
<FixedText
> pAuthorFT
;
65 VclPtr
<FixedText
> pTitleFT
;
67 VclPtr
<FixedText
> pPublisherFT
;
68 VclPtr
<FixedText
> pAddressFT
;
69 VclPtr
<FixedText
> pISBNFT
;
71 VclPtr
<FixedText
> pChapterFT
;
72 VclPtr
<FixedText
> pPagesFT
;
74 VclPtr
<FixedText
> pEditorFT
;
75 VclPtr
<FixedText
> pEditionFT
;
77 VclPtr
<FixedText
> pBooktitleFT
;
78 VclPtr
<FixedText
> pVolumeFT
;
79 VclPtr
<FixedText
> pHowpublishedFT
;
81 VclPtr
<FixedText
> pOrganizationsFT
;
82 VclPtr
<FixedText
> pInstitutionFT
;
83 VclPtr
<FixedText
> pSchoolFT
;
85 VclPtr
<FixedText
> pReportTypeFT
;
86 VclPtr
<FixedText
> pMonthFT
;
88 VclPtr
<FixedText
> pJournalFT
;
89 VclPtr
<FixedText
> pNumberFT
;
90 VclPtr
<FixedText
> pSeriesFT
;
92 VclPtr
<FixedText
> pAnnoteFT
;
93 VclPtr
<FixedText
> pNoteFT
;
94 VclPtr
<FixedText
> pURLFT
;
96 VclPtr
<FixedText
> pCustom1FT
;
97 VclPtr
<FixedText
> pCustom2FT
;
98 VclPtr
<FixedText
> pCustom3FT
;
99 VclPtr
<FixedText
> pCustom4FT
;
100 VclPtr
<FixedText
> pCustom5FT
;
102 VclPtr
<FixedText
> aFixedTexts
[ FIELD_COUNT
];
103 sal_Int16 nFT2CtrlMap
[ FIELD_COUNT
];
105 css::uno::Reference
< css::awt::XWindow
>
106 aControls
[ FIELD_COUNT
];
108 OUString sTableErrorString
;
110 OUString sTypeColumnName
;
112 css::uno::Reference
< css::awt::XControlContainer
>
115 css::uno::Reference
< css::form::XBoundComponent
>
118 css::uno::Reference
< css::sdbc::XRowSetListener
>
121 rtl::Reference
<BibGeneralPageFocusListener
> mxBibGeneralPageFocusListener
;
123 BibDataManager
* pDatMan
;
125 css::uno::Reference
< css::awt::XControlModel
>
126 AddXControl( const OUString
& rName
, FixedText
& rLabel
, const OString
& sHelpId
,
127 sal_Int16
& rIndex
, std::vector
<vcl::Window
*>& rChildren
);
129 void AddControlWithError( const OUString
& rColumnName
, FixedText
& rLabel
,
130 OUString
& rErrorString
,
131 const OString
& sHelpId
, sal_uInt16 nIndexInFTArray
, std::vector
<vcl::Window
*>& rChildren
);
134 void InitFixedTexts(); // create mnemonics and set text an all fixed texts
137 BibGeneralPage(vcl::Window
* pParent
, BibDataManager
* pDatMan
);
138 virtual ~BibGeneralPage() override
;
139 virtual void dispose() override
;
141 inline const OUString
& GetErrorString() const;
143 inline const css::uno::Reference
< css::form::XBoundComponent
>&
144 GetTypeListBoxModel() const;
145 inline const css::uno::Reference
< css::awt::XControlContainer
>&
146 GetControlContainer() const;
148 inline BibDataManager
* GetDataManager();
150 void CommitActiveControl();
152 void RemoveListeners();
154 virtual void GetFocus() override
;
156 virtual bool HandleShortCutKey( const KeyEvent
& rKeyEvent
) override
; // returns true, if key was handled
158 /// @throws css::uno::RuntimeException
159 void focusGained(const css::awt::FocusEvent
& rEvent
);
160 /// @throws css::uno::RuntimeException
166 inline const OUString
& BibGeneralPage::GetErrorString() const
168 return sTableErrorString
;
171 inline const css::uno::Reference
< css::form::XBoundComponent
>&
172 BibGeneralPage::GetTypeListBoxModel() const
177 inline const css::uno::Reference
< css::awt::XControlContainer
>&
178 BibGeneralPage::GetControlContainer() const
183 inline BibDataManager
* BibGeneralPage::GetDataManager()
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */