1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _BIB_GENERAL_HXX
25 #define _BIB_GENERAL_HXX
26 
27 #include <com/sun/star/awt/XFocusListener.hpp>
28 #include <com/sun/star/awt/XControlContainer.hpp>
29 //#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
30 //#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 //#endif
32 #include <com/sun/star/form/XBoundComponent.hpp>
33 #include <com/sun/star/sdbc/XRowSetListener.hpp>
34 #include <svtools/stdctrl.hxx>
35 
36 #ifndef _LSTBOX_HXX //autogen
37 #include <vcl/lstbox.hxx>
38 #endif
39 #include <vcl/group.hxx>
40 #include <svtools/svmedit.hxx>
41 #include <vcl/tabpage.hxx>
42 #include <vcl/combobox.hxx>
43 #include <vcl/scrbar.hxx>
44 #include <cppuhelper/implbase1.hxx> // helper for implementations
45 #include "bibshortcuthandler.hxx"
46 
47 
48 class BibDataManager;
49 #define TYPE_COUNT 22
50 #define FIELD_COUNT 31
51 
52 typedef cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener > BibGeneralPageBaseClass;
53 
54 class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage
55 {
56 	Window				aControlParentWin;
57 	FixedText			aIdentifierFT;
58 	FixedText			aAuthTypeFT;
59     FixedText           aYearFT;
60 
61 	FixedText			aAuthorFT;
62     FixedText           aTitleFT;
63 
64 	FixedText			aPublisherFT;
65     FixedText           aAddressFT;
66     FixedText           aISBNFT;
67 
68     FixedText           aChapterFT;
69     FixedText           aPagesFT;
70     FixedLine           aFirstFL;
71 
72     FixedText           aEditorFT;
73     FixedText           aEditionFT;
74 
75     FixedText           aBooktitleFT;
76     FixedText           aVolumeFT;
77     FixedText           aHowpublishedFT;
78 
79     FixedText           aOrganizationsFT;
80     FixedText           aInstitutionFT;
81     FixedText           aSchoolFT;
82 
83     FixedText           aReportTypeFT;
84     FixedText           aMonthFT;
85     FixedLine           aSecondFL;
86 
87     FixedText           aJournalFT;
88     FixedText           aNumberFT;
89     FixedText           aSeriesFT;
90 
91     FixedText           aAnnoteFT;
92     FixedText           aNoteFT;
93     FixedText           aURLFT;
94     FixedLine           aThirdFL;
95 
96     FixedText           aCustom1FT;
97 	FixedText			aCustom2FT;
98 	FixedText			aCustom3FT;
99 	FixedText			aCustom4FT;
100 	FixedText			aCustom5FT;
101 
102 	ScrollBar			aHoriScroll;
103 	ScrollBar			aVertScroll;
104 
105 	FixedText*			aFixedTexts[ FIELD_COUNT ];
106 	sal_Int16			nFT2CtrlMap[ FIELD_COUNT ];
107 
108 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
109 						aControls[ FIELD_COUNT ];
110 
111 	Size				aStdSize;
112 	Point				aBasePos;
113 
114 	String				aBibTypeArr[ TYPE_COUNT ];
115 	String				sErrorPrefix;
116 	String				sTableErrorString;
117 
118 	String				sTypeColumnName;
119 
120 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
121 						xCtrlContnr;
122 
123 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
124 						xMgr;
125 
126 	::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
127 						xCurrentBoundComponent;
128 
129 	::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
130 						xLBModel;
131 
132 	::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >
133 						xPosListener;
134 
135 
136 	BibDataManager*		pDatMan;
137 
138 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
139 								AddXControl( const String& rName, Point aPos, Size aSize, const rtl::OString& sHelpId,
140 											sal_Int16& rIndex );
141 
142 	void						AddControlWithError( const rtl::OUString& rColumnName, const Point& rPos,
143 											const Size& rSize, String& rErrorString, String aColumnUIName,
144 											const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray );
145 
146 	void						AdjustScrollbars();
147 
148 	DECL_LINK( ScrollHdl, ScrollBar* );
149 
150 protected:
151 	virtual void				Resize();
152 	void						InitFixedTexts( void );		// create mnemonics and set text an all fixed texts
153 
154 public:
155 								BibGeneralPage(Window* pParent, BibDataManager* pDatMan);
156 	virtual						~BibGeneralPage();
157 
158 	inline const String&		GetErrorString() const;
159 
160 	inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >&
161 								GetTypeListBoxModel() const;
162 	inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >&
163 								GetControlContainer() const;
164 
165 	inline BibDataManager* 		GetDataManager();
166 
167 	void						CommitActiveControl();
168 
169 	virtual void SAL_CALL		disposing( const ::com::sun::star::lang::EventObject& Source ) throw( com::sun::star::uno::RuntimeException );
170 
171 	void SAL_CALL				focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException );
172 	void SAL_CALL				focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException );
173 
174 	void						RemoveListeners();
175 
176 	virtual void				GetFocus();
177 
178 	virtual sal_Bool				HandleShortCutKey( const KeyEvent& rKeyEvent );	// returns true, if key was handled
179 };
180 
181 
GetErrorString() const182 inline const String& BibGeneralPage::GetErrorString() const
183 {
184 	return sTableErrorString;
185 }
186 
187 inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >&
GetTypeListBoxModel() const188 	BibGeneralPage::GetTypeListBoxModel() const
189 {
190 	return xLBModel;
191 }
192 
193 inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >&
GetControlContainer() const194 	BibGeneralPage::GetControlContainer() const
195 {
196 	return xCtrlContnr;
197 }
198 
GetDataManager()199 inline BibDataManager* BibGeneralPage::GetDataManager()
200 {
201 	return pDatMan;
202 }
203 
204 #endif
205 
206 
207