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