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/implbase.hxx>
38 class BibToolBarListener
: public cppu::WeakImplHelper
< css::frame::XStatusListener
>
47 VclPtr
<BibToolBar
> pToolBar
;
51 BibToolBarListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
52 virtual ~BibToolBarListener() override
;
54 const OUString
& GetCommand() const { return aCommand
;}
56 // css::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 css::lang::EventObject
& /*Source*/) override
{};
60 // css::frame::XStatusListener
61 virtual void SAL_CALL
statusChanged(const css::frame::FeatureStateEvent
& Event
) override
;
65 class BibTBListBoxListener
: public BibToolBarListener
69 BibTBListBoxListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
70 virtual ~BibTBListBoxListener() override
;
72 virtual void SAL_CALL
statusChanged(const css::frame::FeatureStateEvent
& Event
) override
;
76 class BibTBEditListener
: public BibToolBarListener
80 BibTBEditListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
81 virtual ~BibTBEditListener() override
;
83 virtual void SAL_CALL
statusChanged(const css::frame::FeatureStateEvent
& Event
) override
;
87 class BibTBQueryMenuListener
: public BibToolBarListener
91 BibTBQueryMenuListener(BibToolBar
*pTB
, const OUString
& aStr
, sal_uInt16 nId
);
92 virtual ~BibTBQueryMenuListener() override
;
94 virtual void SAL_CALL
statusChanged(const css::frame::FeatureStateEvent
& Event
) override
;
99 typedef std::vector
< css::uno::Reference
< css::frame::XStatusListener
> > BibToolBarListenerArr
;
101 class BibToolBar
: public ToolBox
105 BibToolBarListenerArr aListenerArr
;
106 css::uno::Reference
< css::frame::XController
> xController
;
108 VclPtr
<FixedText
> aFtSource
;
109 VclPtr
<ListBox
> aLBSource
;
110 VclPtr
<FixedText
> aFtQuery
;
111 VclPtr
<Edit
> aEdQuery
;
112 ScopedVclPtr
<PopupMenu
> pPopupMenu
;
114 sal_uInt16 nSelMenuItem
;
115 OUString aQueryField
;
116 Link
<void*,void> aLayoutManager
;
117 sal_Int16 nSymbolsSize
;
120 sal_uInt16 nTBC_FT_SOURCE
;
121 sal_uInt16 nTBC_LB_SOURCE
;
122 sal_uInt16 nTBC_FT_QUERY
;
123 sal_uInt16 nTBC_ED_QUERY
;
124 sal_uInt16 nTBC_BT_AUTOFILTER
;
125 sal_uInt16 nTBC_BT_COL_ASSIGN
;
126 sal_uInt16 nTBC_BT_CHANGESOURCE
;
127 sal_uInt16 nTBC_BT_FILTERCRIT
;
128 sal_uInt16 nTBC_BT_REMOVEFILTER
;
130 BibDataManager
* pDatMan
;
131 DECL_LINK( SelHdl
, ListBox
&, void );
132 DECL_LINK( SendSelHdl
, Timer
*, void );
133 DECL_LINK( MenuHdl
, ToolBox
*, void );
134 DECL_LINK( OptionsChanged_Impl
, LinkParamNone
*, void );
135 DECL_LINK( SettingsChanged_Impl
, VclSimpleEvent
&, void );
137 void ApplyImageList();
138 void RebuildToolbar();
142 void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
144 virtual void Select() override
;
145 virtual void Click() override
;
146 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
151 BibToolBar(vcl::Window
* pParent
, Link
<void*,void> aLink
);
152 virtual ~BibToolBar() override
;
153 virtual void dispose() override
;
155 sal_uInt16
GetChangeSourceId() const { return nTBC_BT_CHANGESOURCE
; }
157 void SetXController(const css::uno::Reference
< css::frame::XController
> &);
159 void ClearSourceList();
160 void UpdateSourceList(bool bFlag
);
161 void EnableSourceList(bool bFlag
);
162 void InsertSourceEntry(const OUString
& );
163 void SelectSourceEntry(const OUString
& );
165 void EnableQuery(bool bFlag
);
166 void SetQueryString(const OUString
& );
167 void AdjustToolBox();
169 void ClearFilterMenu();
170 sal_uInt16
InsertFilterItem(const OUString
& );
171 void SelectFilterItem(sal_uInt16 nId
);
173 /// @throws css::uno::RuntimeException
174 void statusChanged(const css::frame::FeatureStateEvent
& Event
);
176 void SetDatMan(BibDataManager
& rDatMan
) {pDatMan
= &rDatMan
;}
177 void SendDispatch(sal_uInt16 nId
, const css::uno::Sequence
< css::beans::PropertyValue
>& rArgs
);
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */