1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _BIB_GENERAL_HXX
29*cdf0e10cSrcweir #define _BIB_GENERAL_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/awt/XFocusListener.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/awt/XControlContainer.hpp>
33*cdf0e10cSrcweir //#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
34*cdf0e10cSrcweir //#include <com/sun/star/lang/XMultiServiceFactory.hpp>
35*cdf0e10cSrcweir //#endif
36*cdf0e10cSrcweir #include <com/sun/star/form/XBoundComponent.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSetListener.hpp>
38*cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen
41*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #include <vcl/group.hxx>
44*cdf0e10cSrcweir #include <svtools/svmedit.hxx>
45*cdf0e10cSrcweir #include <vcl/tabpage.hxx>
46*cdf0e10cSrcweir #include <vcl/combobox.hxx>
47*cdf0e10cSrcweir #include <vcl/scrbar.hxx>
48*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations
49*cdf0e10cSrcweir #include "bibshortcuthandler.hxx"
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir class BibDataManager;
53*cdf0e10cSrcweir #define TYPE_COUNT 22
54*cdf0e10cSrcweir #define FIELD_COUNT 31
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir typedef cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener > BibGeneralPageBaseClass;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir 	Window				aControlParentWin;
61*cdf0e10cSrcweir 	FixedText			aIdentifierFT;
62*cdf0e10cSrcweir 	FixedText			aAuthTypeFT;
63*cdf0e10cSrcweir     FixedText           aYearFT;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	FixedText			aAuthorFT;
66*cdf0e10cSrcweir     FixedText           aTitleFT;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 	FixedText			aPublisherFT;
69*cdf0e10cSrcweir     FixedText           aAddressFT;
70*cdf0e10cSrcweir     FixedText           aISBNFT;
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     FixedText           aChapterFT;
73*cdf0e10cSrcweir     FixedText           aPagesFT;
74*cdf0e10cSrcweir     FixedLine           aFirstFL;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir     FixedText           aEditorFT;
77*cdf0e10cSrcweir     FixedText           aEditionFT;
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     FixedText           aBooktitleFT;
80*cdf0e10cSrcweir     FixedText           aVolumeFT;
81*cdf0e10cSrcweir     FixedText           aHowpublishedFT;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     FixedText           aOrganizationsFT;
84*cdf0e10cSrcweir     FixedText           aInstitutionFT;
85*cdf0e10cSrcweir     FixedText           aSchoolFT;
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     FixedText           aReportTypeFT;
88*cdf0e10cSrcweir     FixedText           aMonthFT;
89*cdf0e10cSrcweir     FixedLine           aSecondFL;
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     FixedText           aJournalFT;
92*cdf0e10cSrcweir     FixedText           aNumberFT;
93*cdf0e10cSrcweir     FixedText           aSeriesFT;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     FixedText           aAnnoteFT;
96*cdf0e10cSrcweir     FixedText           aNoteFT;
97*cdf0e10cSrcweir     FixedText           aURLFT;
98*cdf0e10cSrcweir     FixedLine           aThirdFL;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     FixedText           aCustom1FT;
101*cdf0e10cSrcweir 	FixedText			aCustom2FT;
102*cdf0e10cSrcweir 	FixedText			aCustom3FT;
103*cdf0e10cSrcweir 	FixedText			aCustom4FT;
104*cdf0e10cSrcweir 	FixedText			aCustom5FT;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	ScrollBar			aHoriScroll;
107*cdf0e10cSrcweir 	ScrollBar			aVertScroll;
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	FixedText*			aFixedTexts[ FIELD_COUNT ];
110*cdf0e10cSrcweir 	sal_Int16			nFT2CtrlMap[ FIELD_COUNT ];
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
113*cdf0e10cSrcweir 						aControls[ FIELD_COUNT ];
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	Size				aStdSize;
116*cdf0e10cSrcweir 	Point				aBasePos;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	String				aBibTypeArr[ TYPE_COUNT ];
119*cdf0e10cSrcweir 	String				sErrorPrefix;
120*cdf0e10cSrcweir 	String				sTableErrorString;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	String				sTypeColumnName;
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
125*cdf0e10cSrcweir 						xCtrlContnr;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
128*cdf0e10cSrcweir 						xMgr;
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
131*cdf0e10cSrcweir 						xCurrentBoundComponent;
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
134*cdf0e10cSrcweir 						xLBModel;
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >
137*cdf0e10cSrcweir 						xPosListener;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 	BibDataManager*		pDatMan;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
143*cdf0e10cSrcweir 								AddXControl( const String& rName, Point aPos, Size aSize, const rtl::OString& sHelpId,
144*cdf0e10cSrcweir 											sal_Int16& rIndex );
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	void						AddControlWithError( const rtl::OUString& rColumnName, const Point& rPos,
147*cdf0e10cSrcweir 											const Size& rSize, String& rErrorString, String aColumnUIName,
148*cdf0e10cSrcweir 											const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	void						AdjustScrollbars();
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	DECL_LINK( ScrollHdl, ScrollBar* );
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir protected:
155*cdf0e10cSrcweir 	virtual void				Resize();
156*cdf0e10cSrcweir 	void						InitFixedTexts( void );		// create mnemonics and set text an all fixed texts
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir public:
159*cdf0e10cSrcweir 								BibGeneralPage(Window* pParent, BibDataManager* pDatMan);
160*cdf0e10cSrcweir 	virtual						~BibGeneralPage();
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	inline const String&		GetErrorString() const;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >&
165*cdf0e10cSrcweir 								GetTypeListBoxModel() const;
166*cdf0e10cSrcweir 	inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >&
167*cdf0e10cSrcweir 								GetControlContainer() const;
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 	inline BibDataManager* 		GetDataManager();
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	void						CommitActiveControl();
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	virtual void SAL_CALL		disposing( const ::com::sun::star::lang::EventObject& Source ) throw( com::sun::star::uno::RuntimeException );
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	void SAL_CALL				focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException );
176*cdf0e10cSrcweir 	void SAL_CALL				focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	void						RemoveListeners();
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	virtual void				GetFocus();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	virtual sal_Bool				HandleShortCutKey( const KeyEvent& rKeyEvent );	// returns true, if key was handled
183*cdf0e10cSrcweir };
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir inline const String& BibGeneralPage::GetErrorString() const
187*cdf0e10cSrcweir {
188*cdf0e10cSrcweir 	return sTableErrorString;
189*cdf0e10cSrcweir }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >&
192*cdf0e10cSrcweir 	BibGeneralPage::GetTypeListBoxModel() const
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir 	return xLBModel;
195*cdf0e10cSrcweir }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >&
198*cdf0e10cSrcweir 	BibGeneralPage::GetControlContainer() const
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir 	return xCtrlContnr;
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir inline BibDataManager* BibGeneralPage::GetDataManager()
204*cdf0e10cSrcweir {
205*cdf0e10cSrcweir 	return pDatMan;
206*cdf0e10cSrcweir }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir #endif
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211