1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _BIB_TOOLBAR_HXX
21 #define _BIB_TOOLBAR_HXX
23 #include <com/sun/star/frame/XController.hpp>
24 #include <com/sun/star/frame/XStatusListener.hpp>
27 #include <vcl/toolbox.hxx>
28 #include <vcl/lstbox.hxx>
29 #include <vcl/edit.hxx>
30 #include <vcl/fixed.hxx>
31 #include <vcl/timer.hxx>
32 #include <cppuhelper/implbase1.hxx> // helper for implementations
33 #include <boost/ptr_container/ptr_vector.hpp>
38 class BibToolBarListener
: public cppu::WeakImplHelper1
< ::com::sun::star::frame::XStatusListener
>
43 rtl::OUString aCommand
;
51 BibToolBarListener(BibToolBar
*pTB
,rtl::OUString aStr
,sal_uInt16 nId
);
52 ~BibToolBarListener();
54 rtl::OUString
GetCommand() const;
56 // ::com::sun::star::lang::XEventListener
57 // we do not hold References to dispatches, so there is nothing to do on disposal
58 virtual void SAL_CALL
disposing(const ::com::sun::star::lang::EventObject
& /*Source*/)
59 throw( ::com::sun::star::uno::RuntimeException
){};
61 // ::com::sun::star::frame::XStatusListener
62 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
63 throw( ::com::sun::star::uno::RuntimeException
);
67 class BibTBListBoxListener
: public BibToolBarListener
71 BibTBListBoxListener(BibToolBar
*pTB
,rtl::OUString aStr
,sal_uInt16 nId
);
72 ~BibTBListBoxListener();
74 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
75 throw( ::com::sun::star::uno::RuntimeException
);
79 class BibTBEditListener
: public BibToolBarListener
83 BibTBEditListener(BibToolBar
*pTB
,rtl::OUString aStr
,sal_uInt16 nId
);
86 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
87 throw( ::com::sun::star::uno::RuntimeException
);
91 class BibTBQueryMenuListener
: public BibToolBarListener
95 BibTBQueryMenuListener(BibToolBar
*pTB
,rtl::OUString aStr
,sal_uInt16 nId
);
96 ~BibTBQueryMenuListener();
98 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
99 throw( ::com::sun::star::uno::RuntimeException
);
104 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XStatusListener
> BibToolBarListenerRef
;
105 typedef boost::ptr_vector
<BibToolBarListenerRef
> BibToolBarListenerArr
;
107 class BibToolBar
: public ToolBox
111 BibToolBarListenerArr aListenerArr
;
112 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController
> xController
;
116 ImageList aBigImgLst
;
117 ImageList aBigImgLstHC
;
122 PopupMenu aPopupMenu
;
124 sal_uInt16 nSelMenuItem
;
125 rtl::OUString aQueryField
;
127 sal_Int16 nSymbolsSize
;
130 BibDataManager
* pDatMan
;
131 DECL_LINK( SelHdl
, ListBox
* );
132 DECL_LINK( SendSelHdl
, Timer
* );
133 DECL_LINK( MenuHdl
, ToolBox
* );
134 DECL_LINK( OptionsChanged_Impl
, void* );
135 DECL_LINK( SettingsChanged_Impl
, void* );
137 void ApplyImageList();
138 void RebuildToolbar();
142 void DataChanged( const DataChangedEvent
& rDCEvt
);
144 virtual void Select();
145 virtual void Click();
146 long PreNotify( NotifyEvent
& rNEvt
);
151 BibToolBar(Window
* pParent
, Link aLink
, WinBits nStyle
= WB_3DLOOK
);
154 void SetXController(const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController
> &);
156 void ClearSourceList();
157 void UpdateSourceList(sal_Bool bFlag
=sal_True
);
158 void EnableSourceList(sal_Bool bFlag
=sal_True
);
159 void InsertSourceEntry(const XubString
&,sal_uInt16 nPos
=LISTBOX_APPEND
);
160 void SelectSourceEntry(const XubString
& );
162 void EnableQuery(sal_Bool bFlag
=sal_True
);
163 void SetQueryString(const XubString
& );
164 void AdjustToolBox();
166 void ClearFilterMenu();
167 sal_uInt16
InsertFilterItem(const XubString
& );
168 void SelectFilterItem(sal_uInt16 nId
);
170 void statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
171 throw( ::com::sun::star::uno::RuntimeException
);
173 void SetDatMan(BibDataManager
& rDatMan
) {pDatMan
= &rDatMan
;}
174 void SendDispatch(sal_uInt16 nId
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rArgs
);
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */