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