LibreOffice Module basctl (master) 1
IDEComboBox.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 <svl/stritem.hxx>
23#include <sfx2/tbxctrl.hxx>
25
26#include "doceventnotifier.hxx"
27#include "scriptdocument.hxx"
28
29namespace basctl
30{
37{
38public:
49
55 LibBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
56
64 virtual void StateChangedAtToolBoxControl(sal_uInt16 nSlotID, SfxItemState eState,
65 const SfxPoolItem* pState) override;
73};
74
82{
83private:
84 DECL_LINK(SelectHdl, weld::ComboBox&, void);
85 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
86
87protected:
88 std::unique_ptr<weld::ComboBox> m_xWidget;
89
92 virtual ~DocListenerBox() override;
93 virtual void dispose() override;
94
95 virtual void Select() = 0;
96 virtual void FillBox() = 0;
97
99 virtual bool HandleKeyInput(const KeyEvent& rKEvt);
100
101private:
102 // DocumentEventListener
103 virtual void onDocumentCreated(const ScriptDocument& _rDoc) override;
104 virtual void onDocumentOpened(const ScriptDocument& _rDoc) override;
105 virtual void onDocumentSave(const ScriptDocument& _rDoc) override;
106 virtual void onDocumentSaveDone(const ScriptDocument& _rDoc) override;
107 virtual void onDocumentSaveAs(const ScriptDocument& _rDoc) override;
108 virtual void onDocumentSaveAsDone(const ScriptDocument& _rDoc) override;
109 virtual void onDocumentClosed(const ScriptDocument& _rDoc) override;
110 virtual void onDocumentTitleChanged(const ScriptDocument& _rDoc) override;
111 virtual void onDocumentModeChanged(const ScriptDocument& _rDoc) override;
112
114
115public:
116 void set_sensitive(bool bSensitive);
117};
118
124class LibBox : public DocListenerBox
125{
126public:
128 LibBox(vcl::Window* pParent);
129 virtual ~LibBox() override;
130 virtual void dispose() override;
131
137 void Update(const SfxStringItem* pItem);
138
139protected:
141 virtual void Select() override;
142
143private:
144 static void ReleaseFocus();
145
152 void InsertEntries(const ScriptDocument& rDocument, LibraryLocation eLocation);
153
154 void ClearBox();
155 void NotifyIDE();
156
158 virtual void FillBox() override;
159
166 virtual bool HandleKeyInput(const KeyEvent& rKEvt) override;
167
168 DECL_LINK(FocusInHdl, weld::Widget&, void);
169 DECL_LINK(FocusOutHdl, weld::Widget&, void);
170
174};
175
182{
183public:
193
199 LanguageBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
200
208 virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState,
209 const SfxPoolItem* pState) override;
216 virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
217};
218
225{
226public:
230 LanguageBox(vcl::Window* pParent);
231 virtual ~LanguageBox() override;
232 virtual void dispose() override;
233
239 void Update(const SfxStringItem* pItem);
240
241protected:
243 virtual void Select() override;
244
251 virtual bool HandleKeyInput(const KeyEvent& rKEvt) override;
252
253private:
255 void ClearBox();
257 void SetLanguage();
258
260 virtual void FillBox() override;
261
265
267};
268
269} // namespace basctl
270
271/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class for all ComboBox elements.
Definition: IDEComboBox.hxx:82
virtual void onDocumentTitleChanged(const ScriptDocument &_rDoc) override
Not interested in. Do nothing.
virtual void onDocumentClosed(const ScriptDocument &_rDoc) override
Only calls FillBox(). Parameter is not used.
virtual void Select()=0
virtual void onDocumentModeChanged(const ScriptDocument &_rDoc) override
Not interested in. Do nothing.
virtual void dispose() override
void set_sensitive(bool bSensitive)
DocListenerBox(vcl::Window *pParent)
Definition: IDEComboBox.cxx:90
std::unique_ptr< weld::ComboBox > m_xWidget
Definition: IDEComboBox.hxx:88
virtual void onDocumentSaveAs(const ScriptDocument &_rDoc) override
Not interested in. Do nothing.
virtual void onDocumentCreated(const ScriptDocument &_rDoc) override
Only calls FillBox(). Parameter is not used.
virtual void onDocumentOpened(const ScriptDocument &_rDoc) override
Only calls FillBox(). Parameter is not used.
virtual void onDocumentSave(const ScriptDocument &_rDoc) override
Not interested in. Do nothing.
virtual void onDocumentSaveDone(const ScriptDocument &_rDoc) override
Not interested in. Do nothing.
DocumentEventNotifier maNotifier
DECL_LINK(SelectHdl, weld::ComboBox &, void)
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
virtual void onDocumentSaveAsDone(const ScriptDocument &_rDoc) override
Only calls FillBox(). Parameter is not used.
virtual void FillBox()=0
virtual ~DocListenerBox() override
virtual bool HandleKeyInput(const KeyEvent &rKEvt)
key strokes the ComboBox receives
allows registering at theGlobalEventBroadcaster for global document events
Manage stats of Language ComboBox.
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
LanguageBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
Class language ComboBox.
virtual void FillBox() override
Fill up the language combobox.
void ClearBox()
Delete all languages from ComboBox.
OUString msNotLocalizedStr
virtual void dispose() override
void Update(const SfxStringItem *pItem)
bool mbIgnoreSelect
do not use in this class
virtual bool HandleKeyInput(const KeyEvent &rKEvt) override
OUString msDefaultLanguageStr
void SetLanguage()
Switch interface of dialog to selected language.
virtual void Select() override
Called for setting language when user selects a language in ComboBox.
virtual ~LanguageBox() override
LanguageBox(vcl::Window *pParent)
Manage states of macro and dialog Library ComboBox.
Definition: IDEComboBox.hxx:37
LibBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
Definition: IDEComboBox.cxx:62
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSlotID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: IDEComboBox.cxx:67
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
Definition: IDEComboBox.cxx:85
Macros and Dialogs Library ComboBox.
virtual bool HandleKeyInput(const KeyEvent &rKEvt) override
virtual void dispose() override
virtual void Select() override
Called for setting language when user selects a language in ComboBox.
bool mbFillBox
If true, when FillBox() is called.
OUString maCurrentText
LibBox(vcl::Window *pParent)
virtual ~LibBox() override
virtual void FillBox() override
Fill up the combobox.
DECL_LINK(FocusOutHdl, weld::Widget &, void)
void InsertEntries(const ScriptDocument &rDocument, LibraryLocation eLocation)
void Update(const SfxStringItem *pItem)
DECL_LINK(FocusInHdl, weld::Widget &, void)
static void ReleaseFocus()
encapsulates a document which contains Basic scripts and dialogs
SfxItemState