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