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 INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_TOOLBAR_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_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>
33 #include <boost/ptr_container/ptr_vector.hpp>
38 class BibToolBarListener
: public cppu::WeakImplHelper1
< ::com::sun::star::frame::XStatusListener
>
47 VclPtr
<BibToolBar
> pToolBar
;
51 BibToolBarListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
52 virtual ~BibToolBarListener();
54 OUString
GetCommand() const { return aCommand
;}
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
, std::exception
) SAL_OVERRIDE
{};
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
, std::exception
) SAL_OVERRIDE
;
67 class BibTBListBoxListener
: public BibToolBarListener
71 BibTBListBoxListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
72 virtual ~BibTBListBoxListener();
74 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
75 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 class BibTBEditListener
: public BibToolBarListener
83 BibTBEditListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
84 virtual ~BibTBEditListener();
86 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
87 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 class BibTBQueryMenuListener
: public BibToolBarListener
95 BibTBQueryMenuListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
96 virtual ~BibTBQueryMenuListener();
98 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
99 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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 css::uno::Reference
< css::frame::XController
> xController
;
116 ImageList aBigImgLst
;
117 ImageList aBigImgLstHC
;
118 VclPtr
<FixedText
> aFtSource
;
119 VclPtr
<ListBox
> aLBSource
;
120 VclPtr
<FixedText
> aFtQuery
;
121 VclPtr
<Edit
> aEdQuery
;
122 PopupMenu aPopupMenu
;
124 sal_uInt16 nSelMenuItem
;
125 OUString aQueryField
;
126 Link
<> aLayoutManager
;
127 sal_Int16 nSymbolsSize
;
130 BibDataManager
* pDatMan
;
131 DECL_LINK( SelHdl
, ListBox
* );
132 DECL_LINK_TYPED( SendSelHdl
, Idle
*, void );
133 DECL_LINK_TYPED( MenuHdl
, ToolBox
*, void );
134 DECL_LINK( OptionsChanged_Impl
, void* );
135 DECL_LINK( SettingsChanged_Impl
, void* );
137 void ApplyImageList();
138 void RebuildToolbar();
142 void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
144 virtual void Select() SAL_OVERRIDE
;
145 virtual void Click() SAL_OVERRIDE
;
146 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
151 BibToolBar(vcl::Window
* pParent
, Link
<> aLink
, WinBits nStyle
= WB_3DLOOK
);
152 virtual ~BibToolBar();
153 virtual void dispose() SAL_OVERRIDE
;
155 void SetXController(const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController
> &);
157 void ClearSourceList();
158 void UpdateSourceList(bool bFlag
=true);
159 void EnableSourceList(bool bFlag
=true);
160 void InsertSourceEntry(const OUString
&,sal_Int32 nPos
=LISTBOX_APPEND
);
161 void SelectSourceEntry(const OUString
& );
163 void EnableQuery(bool bFlag
=true);
164 void SetQueryString(const OUString
& );
165 void AdjustToolBox();
167 void ClearFilterMenu();
168 sal_uInt16
InsertFilterItem(const OUString
& );
169 void SelectFilterItem(sal_uInt16 nId
);
171 void statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
)
172 throw( ::com::sun::star::uno::RuntimeException
);
174 void SetDatMan(BibDataManager
& rDatMan
) {pDatMan
= &rDatMan
;}
175 void SendDispatch(sal_uInt16 nId
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rArgs
);
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */