nss: upgrade to release 3.73
[LibreOffice.git] / svtools / source / brwbox / ebbcontrols.cxx
blobe83911750ec5aa44f960639a7288d16f41c8f530
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include <svtools/editbrowsebox.hxx>
20 #include <vcl/svapp.hxx>
21 #include <vcl/virdev.hxx>
23 namespace svt
25 //= ComboBoxControl
26 ComboBoxControl::ComboBoxControl(BrowserDataWin* pParent)
27 : ControlBase(pParent, "svt/ui/combocontrol.ui", "ComboControl")
28 , m_xWidget(m_xBuilder->weld_combo_box("combobox"))
30 InitControlBase(m_xWidget.get());
31 m_xWidget->set_entry_width_chars(1); // so a smaller than default width can be used
32 m_xWidget->connect_changed(LINK(this, ComboBoxControl, SelectHdl));
33 m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
34 m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
35 m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
36 m_xWidget->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
37 m_xWidget->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
38 m_xWidget->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
41 void ComboBoxControl::dispose()
43 m_xWidget.reset();
44 ControlBase::dispose();
47 IMPL_LINK_NOARG(ComboBoxControl, SelectHdl, weld::ComboBox&, void)
49 CallModifyHdls();
52 //= ComboBoxCellController
53 ComboBoxCellController::ComboBoxCellController(ComboBoxControl* pWin)
54 :CellController(pWin)
56 static_cast<ComboBoxControl&>(GetWindow()).SetModifyHdl(LINK(this, ComboBoxCellController, ModifyHdl));
59 IMPL_LINK_NOARG(ComboBoxCellController, ModifyHdl, LinkParamNone*, void)
61 callModifyHdl();
64 bool ComboBoxCellController::MoveAllowed(const KeyEvent& rEvt) const
66 weld::ComboBox& rBox = GetComboBox();
67 switch (rEvt.GetKeyCode().GetCode())
69 case KEY_END:
70 case KEY_RIGHT:
72 int nStartPos, nEndPos;
73 bool bNoSelection = rBox.get_entry_selection_bounds(nStartPos, nEndPos);
74 return bNoSelection && nEndPos == rBox.get_active_text().getLength();
76 case KEY_HOME:
77 case KEY_LEFT:
79 int nStartPos, nEndPos;
80 bool bNoSelection = rBox.get_entry_selection_bounds(nStartPos, nEndPos);
81 return bNoSelection && nStartPos == 0;
83 case KEY_UP:
84 case KEY_DOWN:
85 if (rBox.get_popup_shown())
86 return false;
87 if (!rEvt.GetKeyCode().IsShift() &&
88 rEvt.GetKeyCode().IsMod1())
89 return false;
90 // drop down the list box
91 else if (rEvt.GetKeyCode().IsMod2() && rEvt.GetKeyCode().GetCode() == KEY_DOWN)
92 return false;
93 [[fallthrough]];
94 case KEY_PAGEUP:
95 case KEY_PAGEDOWN:
96 case KEY_RETURN:
97 if (rBox.get_popup_shown())
98 return false;
99 [[fallthrough]];
100 default:
101 return true;
105 bool ComboBoxCellController::IsValueChangedFromSaved() const
107 return GetComboBox().get_value_changed_from_saved();
110 void ComboBoxCellController::SaveValue()
112 GetComboBox().save_value();
115 //= ListBoxControl
116 ListBoxControl::ListBoxControl(BrowserDataWin* pParent)
117 : ControlBase(pParent, "svt/ui/listcontrol.ui", "ListControl")
118 , m_xWidget(m_xBuilder->weld_combo_box("listbox"))
120 InitControlBase(m_xWidget.get());
121 m_xWidget->set_size_request(42, -1); // so a later narrow size request can stick
122 m_xWidget->connect_changed(LINK(this, ListBoxControl, SelectHdl));
123 m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
124 m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
125 m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
126 m_xWidget->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
127 m_xWidget->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
128 m_xWidget->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
131 void ListBoxControl::dispose()
133 m_xWidget.reset();
134 ControlBase::dispose();
137 IMPL_LINK_NOARG(ListBoxControl, SelectHdl, weld::ComboBox&, void)
139 CallModifyHdls();
142 //= ListBoxCellController
143 ListBoxCellController::ListBoxCellController(ListBoxControl* pWin)
144 :CellController(pWin)
146 static_cast<ListBoxControl&>(GetWindow()).SetModifyHdl(LINK(this, ListBoxCellController, ListBoxSelectHdl));
149 bool ListBoxCellController::MoveAllowed(const KeyEvent& rEvt) const
151 const weld::ComboBox& rBox = GetListBox();
152 switch (rEvt.GetKeyCode().GetCode())
154 case KEY_UP:
155 case KEY_DOWN:
156 if (!rEvt.GetKeyCode().IsShift() &&
157 rEvt.GetKeyCode().IsMod1())
158 return false;
159 // drop down the list box
160 else
161 if (rEvt.GetKeyCode().IsMod2() && rEvt.GetKeyCode().GetCode() == KEY_DOWN)
162 return false;
163 [[fallthrough]];
164 case KEY_PAGEUP:
165 case KEY_PAGEDOWN:
166 if (rBox.get_popup_shown())
167 return false;
168 [[fallthrough]];
169 default:
170 return true;
174 bool ListBoxCellController::IsValueChangedFromSaved() const
176 return GetListBox().get_value_changed_from_saved();
179 void ListBoxCellController::SaveValue()
181 GetListBox().save_value();
184 IMPL_LINK_NOARG(ListBoxCellController, ListBoxSelectHdl, LinkParamNone*, void)
186 callModifyHdl();
189 //= CheckBoxControl
190 CheckBoxControl::CheckBoxControl(BrowserDataWin* pParent)
191 : ControlBase(pParent, "svt/ui/checkboxcontrol.ui", "CheckBoxControl")
192 , m_xBox(m_xBuilder->weld_check_button("checkbox"))
194 m_aModeState.bTriStateEnabled = true;
195 InitControlBase(m_xBox.get());
196 m_xBox->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
197 m_xBox->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
198 m_xBox->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
199 m_xBox->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
200 m_xBox->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
201 m_xBox->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
202 m_xBox->connect_toggled(LINK(this, CheckBoxControl, OnToggle));
205 void CheckBoxControl::EnableTriState( bool bTriState )
207 if (m_aModeState.bTriStateEnabled != bTriState)
209 m_aModeState.bTriStateEnabled = bTriState;
211 if (!m_aModeState.bTriStateEnabled && GetState() == TRISTATE_INDET)
212 SetState(TRISTATE_FALSE);
216 void CheckBoxControl::SetState(TriState eState)
218 if (!m_aModeState.bTriStateEnabled && (eState == TRISTATE_INDET))
219 eState = TRISTATE_FALSE;
220 m_aModeState.eState = eState;
221 m_xBox->set_state(eState);
224 CheckBoxControl::~CheckBoxControl()
226 disposeOnce();
229 void CheckBoxControl::dispose()
231 m_xBox.reset();
232 ControlBase::dispose();
235 void CheckBoxControl::Clicked()
237 // if tristate is enabled, m_aModeState will take care of setting the
238 // next state in the sequence via TriStateEnabled::ButtonToggled
239 if (!m_aModeState.bTriStateEnabled)
240 m_xBox->set_active(!m_xBox->get_active());
241 OnToggle(*m_xBox);
244 IMPL_LINK_NOARG(CheckBoxControl, OnToggle, weld::ToggleButton&, void)
246 m_aModeState.ButtonToggled(*m_xBox);
247 m_aClickLink.Call(*m_xBox);
248 CallModifyHdls();
251 //= CheckBoxCellController
252 CheckBoxCellController::CheckBoxCellController(CheckBoxControl* pWin)
253 : CellController(pWin)
255 static_cast<CheckBoxControl &>(GetWindow()).SetModifyHdl( LINK(this, CheckBoxCellController, ModifyHdl) );
258 void CheckBoxCellController::ActivatingMouseEvent(const BrowserMouseEvent& rEvt, bool /*bUp*/)
260 CheckBoxControl& rControl = static_cast<CheckBoxControl&>(GetWindow());
261 rControl.GrabFocus();
263 // we have to adjust the position of the event relative to the controller's window
264 Point aPos = rEvt.GetPosPixel() - rEvt.GetRect().TopLeft();
266 Size aControlSize = rControl.GetSizePixel();
267 Size aBoxSize = rControl.GetBox().get_preferred_size();
268 tools::Rectangle aHotRect(Point((aControlSize.Width() - aBoxSize.Width()) / 2,
269 (aControlSize.Height() - aBoxSize.Height()) / 2),
270 aBoxSize);
272 // we want the initial mouse event to act as if it was performed on the checkbox
273 if (aHotRect.IsInside(aPos))
274 rControl.Clicked();
277 weld::CheckButton& CheckBoxCellController::GetCheckBox() const
279 return static_cast<CheckBoxControl &>(GetWindow()).GetBox();
282 bool CheckBoxCellController::IsValueChangedFromSaved() const
284 return GetCheckBox().get_state_changed_from_saved();
287 void CheckBoxCellController::SaveValue()
289 GetCheckBox().save_state();
292 IMPL_LINK_NOARG(CheckBoxCellController, ModifyHdl, LinkParamNone*, void)
294 callModifyHdl();
297 //= MultiLineEditImplementation
298 OUString MultiLineEditImplementation::GetText(LineEnd eSeparator) const
300 weld::TextView& rEntry = m_rEdit.get_widget();
301 return convertLineEnd(rEntry.get_text(), eSeparator);
304 OUString MultiLineEditImplementation::GetSelected(LineEnd eSeparator) const
306 int nStartPos, nEndPos;
307 weld::TextView& rEntry = m_rEdit.get_widget();
308 rEntry.get_selection_bounds(nStartPos, nEndPos);
309 return convertLineEnd(rEntry.get_text().copy(nStartPos, nEndPos - nStartPos), eSeparator);
312 IMPL_LINK_NOARG(MultiLineEditImplementation, ModifyHdl, weld::TextView&, void)
314 CallModifyHdls();
317 EditCellController::EditCellController( IEditImplementation* _pImplementation )
318 :CellController( &_pImplementation->GetControl() )
319 ,m_pEditImplementation( _pImplementation )
320 ,m_bOwnImplementation( false )
322 m_pEditImplementation->SetModifyHdl( LINK(this, EditCellController, ModifyHdl) );
325 IMPL_LINK_NOARG(EntryImplementation, ModifyHdl, weld::Entry&, void)
327 CallModifyHdls();
330 ControlBase::ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OString& rID)
331 : InterimItemWindow(pParent, rUIXMLDescription, rID)
335 void ControlBase::SetEditableReadOnly(bool /*bReadOnly*/)
337 // expected to be overridden for Entry, TextView or the editable entry part of a ComboBox
340 EditControlBase::EditControlBase(BrowserDataWin* pParent)
341 : ControlBase(pParent, "svt/ui/thineditcontrol.ui", "EditControl") // *thin*editcontrol has no frame/border
342 , m_pEntry(nullptr) // inheritors are expected to call InitEditControlBase
346 void EditControlBase::InitEditControlBase(weld::Entry* pEntry)
348 InitControlBase(pEntry);
349 m_pEntry = pEntry;
350 m_pEntry->show();
351 m_pEntry->set_width_chars(1); // so a smaller than default width can be used
352 m_pEntry->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
353 m_pEntry->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
354 connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
355 m_pEntry->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
356 m_pEntry->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
357 m_pEntry->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
360 bool ControlBase::ProcessKey(const KeyEvent& rKEvt)
362 return static_cast<BrowserDataWin*>(GetParent())->GetParent()->ProcessKey(rKEvt);
365 IMPL_LINK(ControlBase, KeyInputHdl, const KeyEvent&, rKEvt, bool)
367 return ProcessKey(rKEvt);
370 IMPL_LINK_NOARG(ControlBase, FocusInHdl, weld::Widget&, void)
372 m_aFocusInHdl.Call(nullptr);
373 static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusIn();
376 IMPL_LINK_NOARG(ControlBase, FocusOutHdl, weld::Widget&, void)
378 m_aFocusOutHdl.Call(nullptr);
379 static_cast<BrowserDataWin*>(GetParent())->GetParent()->ChildFocusOut();
382 IMPL_LINK(ControlBase, MousePressHdl, const MouseEvent&, rEvent, bool)
384 m_aMousePressHdl.Call(rEvent);
385 return false;
388 IMPL_LINK(ControlBase, MouseReleaseHdl, const MouseEvent&, rEvent, bool)
390 m_aMouseReleaseHdl.Call(rEvent);
391 return false;
394 IMPL_LINK(ControlBase, MouseMoveHdl, const MouseEvent&, rEvent, bool)
396 m_aMouseMoveHdl.Call(rEvent);
397 return false;
400 void EditControlBase::dispose()
402 m_pEntry = nullptr;
403 ControlBase::dispose();
406 EditControl::EditControl(BrowserDataWin* pParent)
407 : EditControlBase(pParent)
408 , m_xWidget(m_xBuilder->weld_entry("entry"))
410 InitEditControlBase(m_xWidget.get());
413 void EditControl::dispose()
415 m_xWidget.reset();
416 EditControlBase::dispose();
419 FormattedControlBase::FormattedControlBase(BrowserDataWin* pParent, bool bSpinVariant)
420 : EditControlBase(pParent)
421 , m_bSpinVariant(bSpinVariant)
422 , m_xEntry(m_xBuilder->weld_entry("entry"))
423 , m_xSpinButton(m_xBuilder->weld_formatted_spin_button("spinbutton"))
427 void FormattedControlBase::InitFormattedControlBase()
429 InitEditControlBase(m_bSpinVariant ? m_xSpinButton.get() : m_xEntry.get());
432 void FormattedControlBase::connect_changed(const Link<weld::Entry&, void>& rLink)
434 get_formatter().connect_changed(rLink);
437 void FormattedControlBase::connect_focus_out(const Link<weld::Widget&, void>& rLink)
439 get_formatter().connect_focus_out(rLink);
442 weld::EntryFormatter& FormattedControlBase::get_formatter()
444 return *m_xEntryFormatter;
447 void FormattedControlBase::dispose()
449 m_xEntryFormatter.reset();
450 m_xSpinButton.reset();
451 m_xEntry.reset();
452 EditControlBase::dispose();
455 FormattedControl::FormattedControl(BrowserDataWin* pParent, bool bSpinVariant)
456 : FormattedControlBase(pParent, bSpinVariant)
458 if (bSpinVariant)
459 m_xEntryFormatter.reset(new weld::EntryFormatter(*m_xSpinButton));
460 else
461 m_xEntryFormatter.reset(new weld::EntryFormatter(*m_xEntry));
462 InitFormattedControlBase();
465 DoubleNumericControl::DoubleNumericControl(BrowserDataWin* pParent, bool bSpinVariant)
466 : FormattedControlBase(pParent, bSpinVariant)
468 if (bSpinVariant)
469 m_xEntryFormatter.reset(new weld::DoubleNumericFormatter(*m_xSpinButton));
470 else
471 m_xEntryFormatter.reset(new weld::DoubleNumericFormatter(*m_xEntry));
472 InitFormattedControlBase();
475 LongCurrencyControl::LongCurrencyControl(BrowserDataWin* pParent, bool bSpinVariant)
476 : FormattedControlBase(pParent, bSpinVariant)
478 if (bSpinVariant)
479 m_xEntryFormatter.reset(new weld::LongCurrencyFormatter(*m_xSpinButton));
480 else
481 m_xEntryFormatter.reset(new weld::LongCurrencyFormatter(*m_xEntry));
482 InitFormattedControlBase();
485 TimeControl::TimeControl(BrowserDataWin* pParent, bool bSpinVariant)
486 : FormattedControlBase(pParent, bSpinVariant)
488 if (bSpinVariant)
489 m_xEntryFormatter.reset(new weld::TimeFormatter(*m_xSpinButton));
490 else
491 m_xEntryFormatter.reset(new weld::TimeFormatter(*m_xEntry));
492 InitFormattedControlBase();
495 DateControl::DateControl(BrowserDataWin* pParent, bool bDropDown)
496 : FormattedControlBase(pParent, false)
497 , m_xMenuButton(m_xBuilder->weld_menu_button("button"))
498 , m_xCalendarBuilder(Application::CreateBuilder(m_xMenuButton.get(), "svt/ui/datewindow.ui"))
499 , m_xTopLevel(m_xCalendarBuilder->weld_widget("date_popup_window"))
500 , m_xCalendar(m_xCalendarBuilder->weld_calendar("date"))
501 , m_xExtras(m_xCalendarBuilder->weld_widget("extras"))
502 , m_xTodayBtn(m_xCalendarBuilder->weld_button("today"))
503 , m_xNoneBtn(m_xCalendarBuilder->weld_button("none"))
505 m_xEntryFormatter.reset(new weld::DateFormatter(*m_xEntry));
506 InitFormattedControlBase();
508 m_xMenuButton->set_popover(m_xTopLevel.get());
509 m_xMenuButton->set_visible(bDropDown);
510 m_xMenuButton->connect_toggled(LINK(this, DateControl, ToggleHdl));
512 m_xExtras->show();
514 m_xTodayBtn->connect_clicked(LINK(this, DateControl, ImplClickHdl));
515 m_xNoneBtn->connect_clicked(LINK(this, DateControl, ImplClickHdl));
517 m_xCalendar->connect_activated(LINK(this, DateControl, ActivateHdl));
520 IMPL_LINK(DateControl, ImplClickHdl, weld::Button&, rBtn, void)
522 m_xMenuButton->set_active(false);
523 get_widget().grab_focus();
525 if (&rBtn == m_xTodayBtn.get())
527 Date aToday(Date::SYSTEM);
528 SetDate(aToday);
530 else if (&rBtn == m_xNoneBtn.get())
532 get_widget().set_text(OUString());
536 IMPL_LINK(DateControl, ToggleHdl, weld::ToggleButton&, rButton, void)
538 if (rButton.get_active())
539 m_xCalendar->set_date(static_cast<weld::DateFormatter&>(get_formatter()).GetDate());
542 IMPL_LINK_NOARG(DateControl, ActivateHdl, weld::Calendar&, void)
544 if (m_xMenuButton->get_active())
545 m_xMenuButton->set_active(false);
546 static_cast<weld::DateFormatter&>(get_formatter()).SetDate(m_xCalendar->get_date());
549 void DateControl::SetDate(const Date& rDate)
551 static_cast<weld::DateFormatter&>(get_formatter()).SetDate(rDate);
552 m_xCalendar->set_date(rDate);
555 void DateControl::dispose()
557 m_xTodayBtn.reset();
558 m_xNoneBtn.reset();
559 m_xExtras.reset();
560 m_xCalendar.reset();
561 m_xTopLevel.reset();
562 m_xCalendarBuilder.reset();
563 m_xMenuButton.reset();
564 FormattedControlBase::dispose();
567 PatternControl::PatternControl(BrowserDataWin* pParent)
568 : EditControl(pParent)
570 m_xWidget->connect_key_press(Link<const KeyEvent&, bool>()); // 1) acknowledge we first remove the old one
571 m_xEntryFormatter.reset(new weld::PatternFormatter(*m_xWidget));
572 m_xEntryFormatter->connect_key_press(LINK(this, ControlBase, KeyInputHdl)); // 2) and here we reattach via the formatter
575 void PatternControl::connect_changed(const Link<weld::Entry&, void>& rLink)
577 m_xEntryFormatter->connect_changed(rLink);
580 void PatternControl::connect_focus_out(const Link<weld::Widget&, void>& rLink)
582 m_xEntryFormatter->connect_focus_out(rLink);
585 void PatternControl::dispose()
587 m_xEntryFormatter.reset();
588 EditControl::dispose();
591 EditCellController::EditCellController(EditControlBase* pEdit)
592 : CellController(pEdit)
593 , m_pEditImplementation(new EntryImplementation(*pEdit))
594 , m_bOwnImplementation(true)
596 m_pEditImplementation->SetModifyHdl( LINK(this, EditCellController, ModifyHdl) );
599 EditCellController::~EditCellController( )
601 if ( m_bOwnImplementation )
602 delete m_pEditImplementation;
605 void EditCellController::SaveValue()
607 m_pEditImplementation->SaveValue();
610 bool EditCellController::MoveAllowed(const KeyEvent& rEvt) const
612 bool bResult;
613 switch (rEvt.GetKeyCode().GetCode())
615 case KEY_END:
616 case KEY_RIGHT:
618 Selection aSel = m_pEditImplementation->GetSelection();
619 bResult = !aSel && aSel.Max() == m_pEditImplementation->GetText( LINEEND_LF ).getLength();
620 break;
622 case KEY_HOME:
623 case KEY_LEFT:
625 Selection aSel = m_pEditImplementation->GetSelection();
626 bResult = !aSel && aSel.Min() == 0;
627 break;
629 case KEY_DOWN:
631 bResult = !m_pEditImplementation->CanDown();
632 break;
634 case KEY_UP:
636 bResult = !m_pEditImplementation->CanUp();
637 break;
639 default:
640 bResult = true;
642 return bResult;
645 bool EditCellController::IsValueChangedFromSaved() const
647 return m_pEditImplementation->IsValueChangedFromSaved();
650 IMPL_LINK_NOARG(EditCellController, ModifyHdl, LinkParamNone*, void)
652 callModifyHdl();
655 //= FormattedFieldCellController
656 FormattedFieldCellController::FormattedFieldCellController( FormattedControlBase* _pFormatted )
657 : EditCellController(_pFormatted)
661 void FormattedFieldCellController::CommitModifications()
663 static_cast<FormattedControl&>(GetWindow()).get_formatter().Commit();
666 MultiLineTextCell::MultiLineTextCell(BrowserDataWin* pParent)
667 : ControlBase(pParent, "svt/ui/textviewcontrol.ui", "TextViewControl")
668 , m_xWidget(m_xBuilder->weld_text_view("textview"))
670 InitControlBase(m_xWidget.get());
671 m_xWidget->connect_key_press(LINK(this, ControlBase, KeyInputHdl));
672 m_xWidget->connect_focus_in(LINK(this, ControlBase, FocusInHdl));
673 m_xWidget->connect_focus_out(LINK(this, ControlBase, FocusOutHdl));
674 m_xWidget->connect_mouse_press(LINK(this, ControlBase, MousePressHdl));
675 m_xWidget->connect_mouse_release(LINK(this, ControlBase, MouseReleaseHdl));
676 m_xWidget->connect_mouse_move(LINK(this, ControlBase, MouseMoveHdl));
677 // so any the natural size doesn't have an effect
678 m_xWidget->set_size_request(1, 1);
681 void MultiLineTextCell::GetFocus()
683 if (m_xWidget)
684 m_xWidget->select_region(-1, 0);
685 ControlBase::GetFocus();
688 void MultiLineTextCell::dispose()
690 m_xWidget.reset();
691 ControlBase::dispose();
694 bool MultiLineTextCell::ProcessKey(const KeyEvent& rKEvt)
696 bool bSendToDataWindow = true;
698 sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
699 bool bShift = rKEvt.GetKeyCode().IsShift();
700 bool bCtrl = rKEvt.GetKeyCode().IsMod1();
701 bool bAlt = rKEvt.GetKeyCode().IsMod2();
703 if (!bAlt && !bCtrl && !bShift)
705 switch (nCode)
707 case KEY_DOWN:
708 bSendToDataWindow = !m_xWidget->can_move_cursor_with_down();
709 break;
710 case KEY_UP:
711 bSendToDataWindow = !m_xWidget->can_move_cursor_with_up();
712 break;
716 if (bSendToDataWindow)
717 return ControlBase::ProcessKey(rKEvt);
718 return false;
720 } // namespace svt
722 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */