xref: /AOO41X/main/extensions/source/bibliography/toolbar.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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_TOOLBAR_HXX
29*cdf0e10cSrcweir #define _BIB_TOOLBAR_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <vcl/toolbox.hxx>
36*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
37*cdf0e10cSrcweir #include <vcl/edit.hxx>
38*cdf0e10cSrcweir #include <vcl/fixed.hxx>
39*cdf0e10cSrcweir #include <svl/svarray.hxx>
40*cdf0e10cSrcweir #include <vcl/timer.hxx>
41*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir class BibDataManager;
44*cdf0e10cSrcweir class BibToolBar;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir private:
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 	sal_uInt16		nIndex;
51*cdf0e10cSrcweir 	rtl::OUString			aCommand;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir protected:
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 	BibToolBar		*pToolBar;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir public:
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
60*cdf0e10cSrcweir 	~BibToolBarListener();
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 	rtl::OUString			GetCommand();
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 	// ::com::sun::star::lang::XEventListener
65*cdf0e10cSrcweir 	// we do not hold References to dispatches, so there is nothing to do on disposal
66*cdf0e10cSrcweir 	virtual void	SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*Source*/)
67*cdf0e10cSrcweir 											throw( ::com::sun::star::uno::RuntimeException ){};
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 	// ::com::sun::star::frame::XStatusListener
70*cdf0e10cSrcweir 	virtual void	SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
71*cdf0e10cSrcweir 											throw( ::com::sun::star::uno::RuntimeException );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir };
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir class BibTBListBoxListener: public BibToolBarListener
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir public:
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
80*cdf0e10cSrcweir 	~BibTBListBoxListener();
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	virtual void	SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
83*cdf0e10cSrcweir 											throw( ::com::sun::star::uno::RuntimeException );
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir };
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir class BibTBEditListener: public BibToolBarListener
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir public:
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
92*cdf0e10cSrcweir 	~BibTBEditListener();
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	virtual void	SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
95*cdf0e10cSrcweir 											throw( ::com::sun::star::uno::RuntimeException );
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir };
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir class BibTBQueryMenuListener:	public BibToolBarListener
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir public:
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
104*cdf0e10cSrcweir 	~BibTBQueryMenuListener();
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	virtual void	SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
107*cdf0e10cSrcweir 											throw( ::com::sun::star::uno::RuntimeException );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir };
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener>* BibToolBarListenerPtr;
113*cdf0e10cSrcweir SV_DECL_PTRARR_DEL( BibToolBarListenerArr, BibToolBarListenerPtr, 4, 4 )
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir class BibToolBar:	public ToolBox
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir 	private:
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 		BibToolBarListenerArr	aListenerArr;
120*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >			xController;
121*cdf0e10cSrcweir 		Timer					aTimer;
122*cdf0e10cSrcweir //      Timer                   aMenuTimer;
123*cdf0e10cSrcweir         ImageList               aImgLst;
124*cdf0e10cSrcweir         ImageList               aImgLstHC;
125*cdf0e10cSrcweir         ImageList               aBigImgLst;
126*cdf0e10cSrcweir         ImageList               aBigImgLstHC;
127*cdf0e10cSrcweir 		FixedText				aFtSource;
128*cdf0e10cSrcweir 		ListBox 				aLBSource;
129*cdf0e10cSrcweir 		FixedText				aFtQuery;
130*cdf0e10cSrcweir 		Edit					aEdQuery;
131*cdf0e10cSrcweir 		PopupMenu				aPopupMenu;
132*cdf0e10cSrcweir 		sal_uInt16				nMenuId;
133*cdf0e10cSrcweir 		sal_uInt16				nSelMenuItem;
134*cdf0e10cSrcweir 		rtl::OUString			aQueryField;
135*cdf0e10cSrcweir 		Link                    aLayoutManager;
136*cdf0e10cSrcweir 		sal_Int16               nSymbolsSize;
137*cdf0e10cSrcweir 		sal_Int16               nOutStyle;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 		BibDataManager* 		pDatMan;
140*cdf0e10cSrcweir 		DECL_LINK( SelHdl, ListBox* );
141*cdf0e10cSrcweir 		DECL_LINK( SendSelHdl, Timer* );
142*cdf0e10cSrcweir         DECL_LINK( MenuHdl, ToolBox* );
143*cdf0e10cSrcweir         DECL_LINK( OptionsChanged_Impl, void* );
144*cdf0e10cSrcweir         DECL_LINK( SettingsChanged_Impl, void* );
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir         void                    ApplyImageList();
147*cdf0e10cSrcweir         void                    RebuildToolbar();
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     protected:
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir         void                    DataChanged( const DataChangedEvent& rDCEvt );
152*cdf0e10cSrcweir         void                    InitListener();
153*cdf0e10cSrcweir 		virtual void			Select();
154*cdf0e10cSrcweir 		virtual void			Click();
155*cdf0e10cSrcweir         long                    PreNotify( NotifyEvent& rNEvt );
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 	public:
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 		BibToolBar(Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK );
161*cdf0e10cSrcweir 		~BibToolBar();
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 		void	SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 		void	ClearSourceList();
166*cdf0e10cSrcweir 		void	UpdateSourceList(sal_Bool bFlag=sal_True);
167*cdf0e10cSrcweir 		void	EnableSourceList(sal_Bool bFlag=sal_True);
168*cdf0e10cSrcweir 		void	InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND );
169*cdf0e10cSrcweir 		void	SelectSourceEntry(const XubString& );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 		void	EnableQuery(sal_Bool bFlag=sal_True);
172*cdf0e10cSrcweir 		void	SetQueryString(const XubString& );
173*cdf0e10cSrcweir 		void    AdjustToolBox();
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 		void	ClearFilterMenu();
176*cdf0e10cSrcweir 		sal_uInt16	InsertFilterItem(const XubString& );
177*cdf0e10cSrcweir 		void	SelectFilterItem(sal_uInt16 nId);
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 		void	statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
180*cdf0e10cSrcweir 											throw( ::com::sun::star::uno::RuntimeException );
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 		void	SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;}
183*cdf0e10cSrcweir         void    SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs);
184*cdf0e10cSrcweir };
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir #endif
190