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>
27 #include <svtools/stdctrl.hxx>
29 #include <vcl/layout.hxx>
30 #include <vcl/lstbox.hxx>
31 #include <vcl/group.hxx>
32 #include <svtools/svmedit.hxx>
33 #include <vcl/tabpage.hxx>
34 #include <vcl/combobox.hxx>
35 #include <vcl/scrbar.hxx>
36 #include <cppuhelper/implbase1.hxx>
37 #include "bibshortcuthandler.hxx"
42 #define FIELD_COUNT 31
45 * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted
48 class BibGeneralPageFocusListener
: public cppu::WeakAggImplHelper1
< ::com::sun::star::awt::XFocusListener
>
51 VclPtr
<BibGeneralPage
> mpBibGeneralPage
;
53 BibGeneralPageFocusListener(BibGeneralPage
*pBibGeneralPage
);
54 virtual void SAL_CALL
focusGained( const ::com::sun::star::awt::FocusEvent
& e
) throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
55 virtual void SAL_CALL
focusLost( const ::com::sun::star::awt::FocusEvent
& e
) throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
56 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
60 class BibGeneralPage
: public BibTabPage
62 VclPtr
<VclGrid
> pGrid
;
63 VclPtr
<VclScrolledWindow
> pScrolledWindow
;
65 VclPtr
<FixedText
> pIdentifierFT
;
66 VclPtr
<FixedText
> pAuthTypeFT
;
67 VclPtr
<FixedText
> pYearFT
;
69 VclPtr
<FixedText
> pAuthorFT
;
70 VclPtr
<FixedText
> pTitleFT
;
72 VclPtr
<FixedText
> pPublisherFT
;
73 VclPtr
<FixedText
> pAddressFT
;
74 VclPtr
<FixedText
> pISBNFT
;
76 VclPtr
<FixedText
> pChapterFT
;
77 VclPtr
<FixedText
> pPagesFT
;
79 VclPtr
<FixedText
> pEditorFT
;
80 VclPtr
<FixedText
> pEditionFT
;
82 VclPtr
<FixedText
> pBooktitleFT
;
83 VclPtr
<FixedText
> pVolumeFT
;
84 VclPtr
<FixedText
> pHowpublishedFT
;
86 VclPtr
<FixedText
> pOrganizationsFT
;
87 VclPtr
<FixedText
> pInstitutionFT
;
88 VclPtr
<FixedText
> pSchoolFT
;
90 VclPtr
<FixedText
> pReportTypeFT
;
91 VclPtr
<FixedText
> pMonthFT
;
93 VclPtr
<FixedText
> pJournalFT
;
94 VclPtr
<FixedText
> pNumberFT
;
95 VclPtr
<FixedText
> pSeriesFT
;
97 VclPtr
<FixedText
> pAnnoteFT
;
98 VclPtr
<FixedText
> pNoteFT
;
99 VclPtr
<FixedText
> pURLFT
;
101 VclPtr
<FixedText
> pCustom1FT
;
102 VclPtr
<FixedText
> pCustom2FT
;
103 VclPtr
<FixedText
> pCustom3FT
;
104 VclPtr
<FixedText
> pCustom4FT
;
105 VclPtr
<FixedText
> pCustom5FT
;
107 VclPtr
<FixedText
> aFixedTexts
[ FIELD_COUNT
];
108 sal_Int16 nFT2CtrlMap
[ FIELD_COUNT
];
110 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>
111 aControls
[ FIELD_COUNT
];
113 OUString sErrorPrefix
;
114 OUString sTableErrorString
;
116 OUString sTypeColumnName
;
118 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>
121 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XBoundComponent
>
122 xCurrentBoundComponent
;
124 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XBoundComponent
>
127 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSetListener
>
130 rtl::Reference
<BibGeneralPageFocusListener
> mxBibGeneralPageFocusListener
;
132 BibDataManager
* pDatMan
;
134 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>
135 AddXControl( const OUString
& rName
, FixedText
& rLabel
, const OString
& sHelpId
,
136 sal_Int16
& rIndex
, std::vector
<vcl::Window
*>& rChildren
);
138 void AddControlWithError( const OUString
& rColumnName
, FixedText
& rLabel
,
139 OUString
& rErrorString
,
140 const OString
& sHelpId
, sal_uInt16 nIndexInFTArray
, std::vector
<vcl::Window
*>& rChildren
);
143 void InitFixedTexts(); // create mnemonics and set text an all fixed texts
146 BibGeneralPage(vcl::Window
* pParent
, BibDataManager
* pDatMan
);
147 virtual ~BibGeneralPage();
148 virtual void dispose() SAL_OVERRIDE
;
150 inline const OUString
& GetErrorString() const;
152 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XBoundComponent
>&
153 GetTypeListBoxModel() const;
154 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>&
155 GetControlContainer() const;
157 inline BibDataManager
* GetDataManager();
159 void CommitActiveControl();
161 void RemoveListeners();
163 virtual void GetFocus() SAL_OVERRIDE
;
165 virtual bool HandleShortCutKey( const KeyEvent
& rKeyEvent
) SAL_OVERRIDE
; // returns true, if key was handled
167 inline rtl::Reference
<BibGeneralPageFocusListener
> GetFocusListener() { return mxBibGeneralPageFocusListener
; }
169 void focusGained(const css::awt::FocusEvent
& rEvent
) throw( css::uno::RuntimeException
, std::exception
);
170 void focusLost(const css::awt::FocusEvent
& rEvent
) throw( css::uno::RuntimeException
, std::exception
);
175 inline const OUString
& BibGeneralPage::GetErrorString() const
177 return sTableErrorString
;
180 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XBoundComponent
>&
181 BibGeneralPage::GetTypeListBoxModel() const
186 inline const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>&
187 BibGeneralPage::GetControlContainer() const
192 inline BibDataManager
* BibGeneralPage::GetDataManager()
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */