Update ooo320-m1
[ooovba.git] / extensions / source / bibliography / toolbar.hxx
blob6be7faa50b1f8f6b77c9be787be71fe9f9a4efe5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: toolbar.hxx,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _BIB_TOOLBAR_HXX
32 #define _BIB_TOOLBAR_HXX
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/frame/XStatusListener.hpp>
38 #include <vcl/toolbox.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <vcl/edit.hxx>
41 #include <vcl/fixed.hxx>
42 #include <svtools/svarray.hxx>
43 #include <vcl/timer.hxx>
44 #include <cppuhelper/implbase1.hxx> // helper for implementations
46 class BibDataManager;
47 class BibToolBar;
49 class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
51 private:
53 sal_uInt16 nIndex;
54 rtl::OUString aCommand;
56 protected:
58 BibToolBar *pToolBar;
60 public:
62 BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
63 ~BibToolBarListener();
65 rtl::OUString GetCommand();
67 // ::com::sun::star::lang::XEventListener
68 // we do not hold References to dispatches, so there is nothing to do on disposal
69 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*Source*/)
70 throw( ::com::sun::star::uno::RuntimeException ){};
72 // ::com::sun::star::frame::XStatusListener
73 virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
74 throw( ::com::sun::star::uno::RuntimeException );
78 class BibTBListBoxListener: public BibToolBarListener
80 public:
82 BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
83 ~BibTBListBoxListener();
85 virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
86 throw( ::com::sun::star::uno::RuntimeException );
90 class BibTBEditListener: public BibToolBarListener
92 public:
94 BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
95 ~BibTBEditListener();
97 virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
98 throw( ::com::sun::star::uno::RuntimeException );
102 class BibTBQueryMenuListener: public BibToolBarListener
104 public:
106 BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
107 ~BibTBQueryMenuListener();
109 virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
110 throw( ::com::sun::star::uno::RuntimeException );
115 typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener>* BibToolBarListenerPtr;
116 SV_DECL_PTRARR_DEL( BibToolBarListenerArr, BibToolBarListenerPtr, 4, 4 )
118 class BibToolBar: public ToolBox
120 private:
122 BibToolBarListenerArr aListenerArr;
123 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
124 Timer aTimer;
125 // Timer aMenuTimer;
126 ImageList aImgLst;
127 ImageList aImgLstHC;
128 ImageList aBigImgLst;
129 ImageList aBigImgLstHC;
130 FixedText aFtSource;
131 ListBox aLBSource;
132 FixedText aFtQuery;
133 Edit aEdQuery;
134 PopupMenu aPopupMenu;
135 sal_uInt16 nMenuId;
136 sal_uInt16 nSelMenuItem;
137 rtl::OUString aQueryField;
138 Link aLayoutManager;
139 sal_Int16 nSymbolsSize;
140 sal_Int16 nOutStyle;
142 BibDataManager* pDatMan;
143 DECL_LINK( SelHdl, ListBox* );
144 DECL_LINK( SendSelHdl, Timer* );
145 DECL_LINK( MenuHdl, ToolBox* );
146 DECL_LINK( OptionsChanged_Impl, void* );
147 DECL_LINK( SettingsChanged_Impl, void* );
149 void ApplyImageList();
150 void RebuildToolbar();
152 protected:
154 void DataChanged( const DataChangedEvent& rDCEvt );
155 void InitListener();
156 virtual void Select();
157 virtual void Click();
158 long PreNotify( NotifyEvent& rNEvt );
161 public:
163 BibToolBar(Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK );
164 ~BibToolBar();
166 void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
168 void ClearSourceList();
169 void UpdateSourceList(sal_Bool bFlag=sal_True);
170 void EnableSourceList(sal_Bool bFlag=sal_True);
171 void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND );
172 void SelectSourceEntry(const XubString& );
174 void EnableQuery(sal_Bool bFlag=sal_True);
175 void SetQueryString(const XubString& );
176 void AdjustToolBox();
178 void ClearFilterMenu();
179 sal_uInt16 InsertFilterItem(const XubString& );
180 void SelectFilterItem(sal_uInt16 nId);
182 void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
183 throw( ::com::sun::star::uno::RuntimeException );
185 void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;}
186 void SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs);
192 #endif