1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: toolbar.hxx,v $
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
49 class BibToolBarListener
: public cppu::WeakImplHelper1
< ::com::sun::star::frame::XStatusListener
>
54 rtl::OUString aCommand
;
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
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
94 BibTBEditListener(BibToolBar
*pTB
,rtl::OUString aStr
,sal_uInt16 nId
);
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
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
122 BibToolBarListenerArr aListenerArr
;
123 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController
> xController
;
128 ImageList aBigImgLst
;
129 ImageList aBigImgLstHC
;
134 PopupMenu aPopupMenu
;
136 sal_uInt16 nSelMenuItem
;
137 rtl::OUString aQueryField
;
139 sal_Int16 nSymbolsSize
;
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();
154 void DataChanged( const DataChangedEvent
& rDCEvt
);
156 virtual void Select();
157 virtual void Click();
158 long PreNotify( NotifyEvent
& rNEvt
);
163 BibToolBar(Window
* pParent
, Link aLink
, WinBits nStyle
= WB_3DLOOK
);
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
);