Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_GENERAL_HXX
22 :
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>
28 :
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"
38 :
39 :
40 : class BibDataManager;
41 : #define TYPE_COUNT 22
42 : #define FIELD_COUNT 31
43 :
44 : /**
45 : * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted
46 : */
47 : class BibGeneralPage;
48 0 : class BibGeneralPageFocusListener : public cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener >
49 : {
50 : private:
51 : VclPtr<BibGeneralPage> mpBibGeneralPage;
52 : public:
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;
57 :
58 : };
59 :
60 : class BibGeneralPage: public BibTabPage
61 : {
62 : VclPtr<VclGrid> pGrid;
63 : VclPtr<VclScrolledWindow> pScrolledWindow;
64 :
65 : VclPtr<FixedText> pIdentifierFT;
66 : VclPtr<FixedText> pAuthTypeFT;
67 : VclPtr<FixedText> pYearFT;
68 :
69 : VclPtr<FixedText> pAuthorFT;
70 : VclPtr<FixedText> pTitleFT;
71 :
72 : VclPtr<FixedText> pPublisherFT;
73 : VclPtr<FixedText> pAddressFT;
74 : VclPtr<FixedText> pISBNFT;
75 :
76 : VclPtr<FixedText> pChapterFT;
77 : VclPtr<FixedText> pPagesFT;
78 :
79 : VclPtr<FixedText> pEditorFT;
80 : VclPtr<FixedText> pEditionFT;
81 :
82 : VclPtr<FixedText> pBooktitleFT;
83 : VclPtr<FixedText> pVolumeFT;
84 : VclPtr<FixedText> pHowpublishedFT;
85 :
86 : VclPtr<FixedText> pOrganizationsFT;
87 : VclPtr<FixedText> pInstitutionFT;
88 : VclPtr<FixedText> pSchoolFT;
89 :
90 : VclPtr<FixedText> pReportTypeFT;
91 : VclPtr<FixedText> pMonthFT;
92 :
93 : VclPtr<FixedText> pJournalFT;
94 : VclPtr<FixedText> pNumberFT;
95 : VclPtr<FixedText> pSeriesFT;
96 :
97 : VclPtr<FixedText> pAnnoteFT;
98 : VclPtr<FixedText> pNoteFT;
99 : VclPtr<FixedText> pURLFT;
100 :
101 : VclPtr<FixedText> pCustom1FT;
102 : VclPtr<FixedText> pCustom2FT;
103 : VclPtr<FixedText> pCustom3FT;
104 : VclPtr<FixedText> pCustom4FT;
105 : VclPtr<FixedText> pCustom5FT;
106 :
107 : VclPtr<FixedText> aFixedTexts[ FIELD_COUNT ];
108 : sal_Int16 nFT2CtrlMap[ FIELD_COUNT ];
109 :
110 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
111 : aControls[ FIELD_COUNT ];
112 :
113 : OUString sErrorPrefix;
114 : OUString sTableErrorString;
115 :
116 : OUString sTypeColumnName;
117 :
118 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
119 : xCtrlContnr;
120 :
121 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
122 : xCurrentBoundComponent;
123 :
124 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
125 : xLBModel;
126 :
127 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >
128 : xPosListener;
129 :
130 : BibGeneralPageFocusListener maBibGeneralPageFocusListener;
131 :
132 : BibDataManager* pDatMan;
133 :
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 );
137 :
138 : void AddControlWithError( const OUString& rColumnName, FixedText& rLabel,
139 : OUString& rErrorString,
140 : const OString& sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren );
141 :
142 : protected:
143 : void InitFixedTexts(); // create mnemonics and set text an all fixed texts
144 :
145 : public:
146 : BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
147 : virtual ~BibGeneralPage();
148 : virtual void dispose() SAL_OVERRIDE;
149 :
150 : inline const OUString& GetErrorString() const;
151 :
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;
156 :
157 : inline BibDataManager* GetDataManager();
158 :
159 : void CommitActiveControl();
160 :
161 : void RemoveListeners();
162 :
163 : virtual void GetFocus() SAL_OVERRIDE;
164 :
165 : virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) SAL_OVERRIDE; // returns true, if key was handled
166 :
167 0 : inline BibGeneralPageFocusListener& GetFocusListener() { return maBibGeneralPageFocusListener; }
168 :
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 );
171 :
172 : };
173 :
174 :
175 0 : inline const OUString& BibGeneralPage::GetErrorString() const
176 : {
177 0 : return sTableErrorString;
178 : }
179 :
180 : inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >&
181 0 : BibGeneralPage::GetTypeListBoxModel() const
182 : {
183 0 : return xLBModel;
184 : }
185 :
186 : inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >&
187 0 : BibGeneralPage::GetControlContainer() const
188 : {
189 0 : return xCtrlContnr;
190 : }
191 :
192 0 : inline BibDataManager* BibGeneralPage::GetDataManager()
193 : {
194 0 : return pDatMan;
195 : }
196 :
197 : #endif
198 :
199 :
200 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|