LibreOffice Module extensions (master) 1
toolbar.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <com/sun/star/frame/XController.hpp>
23#include <com/sun/star/frame/XStatusListener.hpp>
24
26#include <vcl/toolbox.hxx>
27#include <vcl/timer.hxx>
29#include <vector>
30
31class BibDataManager;
32class BibToolBar;
33
34class BibToolBarListener: public cppu::WeakImplHelper < css::frame::XStatusListener>
35{
36private:
37
39 OUString aCommand;
40
41protected:
42
44
45public:
46
47 BibToolBarListener(BibToolBar *pTB, OUString aStr, ToolBoxItemId nId);
48 virtual ~BibToolBarListener() override;
49
50 const OUString& GetCommand() const { return aCommand;}
51
52 // css::lang::XEventListener
53 // we do not hold References to dispatches, so there is nothing to do on disposal
54 virtual void SAL_CALL disposing(const css::lang::EventObject& /*Source*/) override {};
55
56 // css::frame::XStatusListener
57 virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
58
59};
60
62{
63public:
64
66 virtual ~BibTBListBoxListener() override;
67
68 virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
69
70};
71
73{
74public:
75
76 BibTBEditListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId);
77 virtual ~BibTBEditListener() override;
78
79 virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
80
81};
82
84{
85public:
86
88 virtual ~BibTBQueryMenuListener() override;
89
90 virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
91
92};
93
94
95typedef std::vector< css::uno::Reference< css::frame::XStatusListener> > BibToolBarListenerArr;
96
98{
99public:
101 virtual ~ComboBoxControl() override;
102 virtual void dispose() override;
103
105
106 void set_sensitive(bool bSensitive)
107 {
108 m_xFtSource->set_sensitive(bSensitive);
109 m_xLBSource->set_sensitive(bSensitive);
110 Enable(bSensitive);
111 }
112
113private:
114 std::unique_ptr<weld::Label> m_xFtSource;
115 std::unique_ptr<weld::ComboBox> m_xLBSource;
116};
117
118class EditControl final : public InterimItemWindow
119{
120public:
121 EditControl(vcl::Window* pParent);
122 virtual ~EditControl() override;
123 virtual void dispose() override;
124
125 weld::Entry* get_widget() { return m_xEdQuery.get(); }
126
127 void set_sensitive(bool bSensitive)
128 {
129 m_xFtQuery->set_sensitive(bSensitive);
130 m_xEdQuery->set_sensitive(bSensitive);
131 Enable(bSensitive);
132 }
133
134private:
135 std::unique_ptr<weld::Label> m_xFtQuery;
136 std::unique_ptr<weld::Entry> m_xEdQuery;
137};
138
139class BibToolBar: public ToolBox
140{
141 private:
142
144 css::uno::Reference< css::frame::XController > xController;
150 std::unique_ptr<weld::Builder> xBuilder;
151 std::unique_ptr<weld::Menu> xPopupMenu;
152 sal_uInt16 nMenuId;
153 OUString sSelMenuItem;
154 OUString aQueryField;
156 sal_Int16 nSymbolsSize;
157
165
167 DECL_LINK( SelHdl, weld::ComboBox&, void );
168 DECL_LINK( SendSelHdl, Timer*, void );
169 DECL_LINK( MenuHdl, ToolBox*, void );
170 DECL_LINK( OptionsChanged_Impl, LinkParamNone*, void );
171 DECL_LINK( SettingsChanged_Impl, VclSimpleEvent&, void );
172
173 void ApplyImageList();
174 void RebuildToolbar();
175
176 protected:
177
178 void DataChanged( const DataChangedEvent& rDCEvt ) override;
179 void InitListener();
180 virtual void Select() override;
181 virtual void Click() override;
182 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
183
184
185 public:
186
187 BibToolBar(vcl::Window* pParent, Link<void*,void> aLink);
188 virtual ~BibToolBar() override;
189 virtual void dispose() override;
190
192
193 void SetXController(const css::uno::Reference< css::frame::XController > &);
194
195 void ClearSourceList();
196 void UpdateSourceList(bool bFlag);
197 void EnableSourceList(bool bFlag);
198 void InsertSourceEntry(const OUString& );
199 void SelectSourceEntry(const OUString& );
200
201 void EnableQuery(bool bFlag);
202 void SetQueryString(const OUString& );
203 void AdjustToolBox();
204
205 void ClearFilterMenu();
206 sal_uInt16 InsertFilterItem(const OUString& );
207 void SelectFilterItem(sal_uInt16 nId);
208
210 void statusChanged(const css::frame::FeatureStateEvent& Event);
211
212 void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;}
213 void SendDispatch(ToolBoxItemId nId, const css::uno::Sequence< css::beans::PropertyValue >& rArgs);
214};
215
216
217/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~BibTBEditListener() override
Definition: toolbar.cxx:160
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
Definition: toolbar.cxx:164
BibTBEditListener(BibToolBar *pTB, const OUString &aStr, ToolBoxItemId nId)
Definition: toolbar.cxx:155
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
Definition: toolbar.cxx:89
BibTBListBoxListener(BibToolBar *pTB, const OUString &aStr, ToolBoxItemId nId)
Definition: toolbar.cxx:80
virtual ~BibTBListBoxListener() override
Definition: toolbar.cxx:85
virtual ~BibTBQueryMenuListener() override
Definition: toolbar.cxx:123
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
Definition: toolbar.cxx:127
BibTBQueryMenuListener(BibToolBar *pTB, const OUString &aStr, ToolBoxItemId nId)
Definition: toolbar.cxx:118
virtual void SAL_CALL disposing(const css::lang::EventObject &) override
Definition: toolbar.hxx:54
ToolBoxItemId nIndex
Definition: toolbar.hxx:38
virtual ~BibToolBarListener() override
Definition: toolbar.cxx:59
OUString aCommand
Definition: toolbar.hxx:39
BibToolBarListener(BibToolBar *pTB, OUString aStr, ToolBoxItemId nId)
Definition: toolbar.cxx:52
VclPtr< BibToolBar > pToolBar
Definition: toolbar.hxx:43
const OUString & GetCommand() const
Definition: toolbar.hxx:50
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
Definition: toolbar.cxx:63
Link< void *, void > aLayoutManager
Definition: toolbar.hxx:155
void SelectSourceEntry(const OUString &)
Definition: toolbar.cxx:455
ToolBoxItemId GetChangeSourceId() const
Definition: toolbar.hxx:191
ToolBoxItemId nTBC_BT_AUTOFILTER
Definition: toolbar.hxx:160
DECL_LINK(SendSelHdl, Timer *, void)
std::unique_ptr< weld::Builder > xBuilder
Definition: toolbar.hxx:150
virtual void Select() override
Definition: toolbar.cxx:342
BibToolBarListenerArr aListenerArr
Definition: toolbar.hxx:143
weld::ComboBox * pLbSource
Definition: toolbar.hxx:147
void RebuildToolbar()
Definition: toolbar.cxx:585
void ApplyImageList()
Definition: toolbar.cxx:592
ToolBoxItemId nTBC_BT_CHANGESOURCE
Definition: toolbar.hxx:162
void EnableSourceList(bool bFlag)
Definition: toolbar.cxx:432
ToolBoxItemId nTBC_SOURCE
Definition: toolbar.hxx:158
void statusChanged(const css::frame::FeatureStateEvent &Event)
Definition: toolbar.cxx:544
BibToolBar(vcl::Window *pParent, Link< void *, void > aLink)
Definition: toolbar.cxx:225
virtual ~BibToolBar() override
Definition: toolbar.cxx:269
sal_uInt16 nMenuId
Definition: toolbar.hxx:152
DECL_LINK(SettingsChanged_Impl, VclSimpleEvent &, void)
ToolBoxItemId nTBC_BT_COL_ASSIGN
Definition: toolbar.hxx:161
void ClearFilterMenu()
Definition: toolbar.cxx:411
ToolBoxItemId nTBC_BT_FILTERCRIT
Definition: toolbar.hxx:163
void SetDatMan(BibDataManager &rDatMan)
Definition: toolbar.hxx:212
void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: toolbar.cxx:552
VclPtr< EditControl > xQuery
Definition: toolbar.hxx:148
Idle aIdle
Definition: toolbar.hxx:145
std::unique_ptr< weld::Menu > xPopupMenu
Definition: toolbar.hxx:151
void SendDispatch(ToolBoxItemId nId, const css::uno::Sequence< css::beans::PropertyValue > &rArgs)
Definition: toolbar.cxx:361
void InsertSourceEntry(const OUString &)
Definition: toolbar.cxx:450
void ClearSourceList()
Definition: toolbar.cxx:437
css::uno::Reference< css::frame::XController > xController
Definition: toolbar.hxx:144
void SetXController(const css::uno::Reference< css::frame::XController > &)
Definition: toolbar.cxx:335
VclPtr< ComboBoxControl > xSource
Definition: toolbar.hxx:146
OUString sSelMenuItem
Definition: toolbar.hxx:153
void AdjustToolBox()
Definition: toolbar.cxx:600
DECL_LINK(SelHdl, weld::ComboBox &, void)
virtual void Click() override
Definition: toolbar.cxx:387
void SelectFilterItem(sal_uInt16 nId)
Definition: toolbar.cxx:424
sal_Int16 nSymbolsSize
Definition: toolbar.hxx:156
BibDataManager * pDatMan
Definition: toolbar.hxx:166
OUString aQueryField
Definition: toolbar.hxx:154
void UpdateSourceList(bool bFlag)
Definition: toolbar.cxx:442
ToolBoxItemId nTBC_BT_REMOVEFILTER
Definition: toolbar.hxx:164
weld::Entry * pEdQuery
Definition: toolbar.hxx:149
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: toolbar.cxx:470
void EnableQuery(bool bFlag)
Definition: toolbar.cxx:460
void InitListener()
Definition: toolbar.cxx:288
DECL_LINK(OptionsChanged_Impl, LinkParamNone *, void)
sal_uInt16 InsertFilterItem(const OUString &)
Definition: toolbar.cxx:417
DECL_LINK(MenuHdl, ToolBox *, void)
virtual void dispose() override
Definition: toolbar.cxx:274
ToolBoxItemId nTBC_QUERY
Definition: toolbar.hxx:159
void SetQueryString(const OUString &)
Definition: toolbar.cxx:465
ComboBoxControl(vcl::Window *pParent)
Definition: toolbar.cxx:179
std::unique_ptr< weld::ComboBox > m_xLBSource
Definition: toolbar.hxx:115
weld::ComboBox * get_widget()
Definition: toolbar.hxx:104
std::unique_ptr< weld::Label > m_xFtSource
Definition: toolbar.hxx:114
void set_sensitive(bool bSensitive)
Definition: toolbar.hxx:106
virtual void dispose() override
Definition: toolbar.cxx:190
virtual ~ComboBoxControl() override
Definition: toolbar.cxx:197
std::unique_ptr< weld::Label > m_xFtQuery
Definition: toolbar.hxx:135
virtual void dispose() override
Definition: toolbar.cxx:213
void set_sensitive(bool bSensitive)
Definition: toolbar.hxx:127
std::unique_ptr< weld::Entry > m_xEdQuery
Definition: toolbar.hxx:136
EditControl(vcl::Window *pParent)
Definition: toolbar.cxx:202
weld::Entry * get_widget()
Definition: toolbar.hxx:125
virtual ~EditControl() override
Definition: toolbar.cxx:220
void Enable(bool bEnable=true, bool bChild=true)
aStr
sal_Int16 nId
std::vector< css::uno::Reference< css::frame::XStatusListener > > BibToolBarListenerArr
Definition: toolbar.hxx:95