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>
25 ComboBoxControl::ComboBoxControl(BrowserDataWin
* pParent
)
26 : ControlBase(pParent
, "svt/ui/combocontrol.ui", "ComboControl")
27 , m_xWidget(m_xBuilder
->weld_combo_box("combobox"))
29 InitControlBase(m_xWidget
.get());
30 m_xWidget
->set_entry_width_chars(1); // so a smaller than default width can be used
31 m_xWidget
->connect_changed(LINK(this, ComboBoxControl
, SelectHdl
));
32 m_xWidget
->connect_key_press(LINK(this, ControlBase
, KeyInputHdl
));
33 m_xWidget
->connect_key_release(LINK(this, ControlBase
, KeyReleaseHdl
));
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::SetPointFont(const vcl::Font
& rFont
)
43 m_xWidget
->set_entry_font(rFont
);
46 void ComboBoxControl::dispose()
49 ControlBase::dispose();
52 IMPL_LINK_NOARG(ComboBoxControl
, SelectHdl
, weld::ComboBox
&, void)
57 //= ComboBoxCellController
58 ComboBoxCellController::ComboBoxCellController(ComboBoxControl
* pWin
)
61 static_cast<ComboBoxControl
&>(GetWindow()).SetModifyHdl(LINK(this, ComboBoxCellController
, ModifyHdl
));
64 IMPL_LINK_NOARG(ComboBoxCellController
, ModifyHdl
, LinkParamNone
*, void)
69 bool ComboBoxCellController::MoveAllowed(const KeyEvent
& rEvt
) const
71 weld::ComboBox
& rBox
= GetComboBox();
72 switch (rEvt
.GetKeyCode().GetCode())
77 int nStartPos
, nEndPos
;
78 bool bNoSelection
= rBox
.get_entry_selection_bounds(nStartPos
, nEndPos
);
79 return bNoSelection
&& nEndPos
== rBox
.get_active_text().getLength();
84 int nStartPos
, nEndPos
;
85 bool bNoSelection
= rBox
.get_entry_selection_bounds(nStartPos
, nEndPos
);
86 return bNoSelection
&& nStartPos
== 0;
90 if (rBox
.get_popup_shown())
92 if (!rEvt
.GetKeyCode().IsShift() &&
93 rEvt
.GetKeyCode().IsMod1())
95 // drop down the list box
96 else if (rEvt
.GetKeyCode().IsMod2() && rEvt
.GetKeyCode().GetCode() == KEY_DOWN
)
102 if (rBox
.get_popup_shown())
110 bool ComboBoxCellController::IsValueChangedFromSaved() const
112 return GetComboBox().get_value_changed_from_saved();
115 void ComboBoxCellController::SaveValue()
117 GetComboBox().save_value();
121 ListBoxControl::ListBoxControl(BrowserDataWin
* pParent
)
122 : ControlBase(pParent
, "svt/ui/listcontrol.ui", "ListControl")
123 , m_xWidget(m_xBuilder
->weld_combo_box("listbox"))
125 InitControlBase(m_xWidget
.get());
126 m_xWidget
->set_size_request(42, -1); // so a later narrow size request can stick
127 m_xWidget
->connect_changed(LINK(this, ListBoxControl
, SelectHdl
));
128 m_xWidget
->connect_key_press(LINK(this, ControlBase
, KeyInputHdl
));
129 m_xWidget
->connect_key_release(LINK(this, ControlBase
, KeyReleaseHdl
));
130 m_xWidget
->connect_focus_in(LINK(this, ControlBase
, FocusInHdl
));
131 m_xWidget
->connect_focus_out(LINK(this, ControlBase
, FocusOutHdl
));
132 m_xWidget
->connect_mouse_press(LINK(this, ControlBase
, MousePressHdl
));
133 m_xWidget
->connect_mouse_release(LINK(this, ControlBase
, MouseReleaseHdl
));
134 m_xWidget
->connect_mouse_move(LINK(this, ControlBase
, MouseMoveHdl
));
137 void ListBoxControl::SetPointFont(const vcl::Font
& rFont
)
139 m_xWidget
->set_font(rFont
);
142 void ListBoxControl::dispose()
145 ControlBase::dispose();
148 IMPL_LINK_NOARG(ListBoxControl
, SelectHdl
, weld::ComboBox
&, void)
153 //= ListBoxCellController
154 ListBoxCellController::ListBoxCellController(ListBoxControl
* pWin
)
155 :CellController(pWin
)
157 static_cast<ListBoxControl
&>(GetWindow()).SetModifyHdl(LINK(this, ListBoxCellController
, ListBoxSelectHdl
));
160 bool ListBoxCellController::MoveAllowed(const KeyEvent
& rEvt
) const
162 const weld::ComboBox
& rBox
= GetListBox();
163 switch (rEvt
.GetKeyCode().GetCode())
167 if (!rEvt
.GetKeyCode().IsShift() &&
168 rEvt
.GetKeyCode().IsMod1())
170 // drop down the list box
172 if (rEvt
.GetKeyCode().IsMod2() && rEvt
.GetKeyCode().GetCode() == KEY_DOWN
)
177 if (rBox
.get_popup_shown())
185 bool ListBoxCellController::IsValueChangedFromSaved() const
187 return GetListBox().get_value_changed_from_saved();
190 void ListBoxCellController::SaveValue()
192 GetListBox().save_value();
195 IMPL_LINK_NOARG(ListBoxCellController
, ListBoxSelectHdl
, LinkParamNone
*, void)
201 CheckBoxControl::CheckBoxControl(BrowserDataWin
* pParent
)
202 : ControlBase(pParent
, "svt/ui/checkboxcontrol.ui", "CheckBoxControl")
203 , m_xBox(m_xBuilder
->weld_check_button("checkbox"))
205 m_aModeState
.bTriStateEnabled
= true;
206 InitControlBase(m_xBox
.get());
207 m_xBox
->connect_key_press(LINK(this, ControlBase
, KeyInputHdl
));
208 m_xBox
->connect_key_release(LINK(this, ControlBase
, KeyReleaseHdl
));
209 m_xBox
->connect_focus_in(LINK(this, ControlBase
, FocusInHdl
));
210 m_xBox
->connect_focus_out(LINK(this, ControlBase
, FocusOutHdl
));
211 m_xBox
->connect_mouse_press(LINK(this, ControlBase
, MousePressHdl
));
212 m_xBox
->connect_mouse_release(LINK(this, ControlBase
, MouseReleaseHdl
));
213 m_xBox
->connect_mouse_move(LINK(this, ControlBase
, MouseMoveHdl
));
214 m_xBox
->connect_toggled(LINK(this, CheckBoxControl
, OnToggle
));
217 void CheckBoxControl::SetPointFont(const vcl::Font
& /*rFont*/)
221 void CheckBoxControl::EnableTriState( bool bTriState
)
223 if (m_aModeState
.bTriStateEnabled
!= bTriState
)
225 m_aModeState
.bTriStateEnabled
= bTriState
;
227 if (!m_aModeState
.bTriStateEnabled
&& GetState() == TRISTATE_INDET
)
228 SetState(TRISTATE_FALSE
);
232 void CheckBoxControl::SetState(TriState eState
)
234 if (!m_aModeState
.bTriStateEnabled
&& (eState
== TRISTATE_INDET
))
235 eState
= TRISTATE_FALSE
;
236 m_aModeState
.eState
= eState
;
237 m_xBox
->set_state(eState
);
240 CheckBoxControl::~CheckBoxControl()
245 void CheckBoxControl::dispose()
248 ControlBase::dispose();
251 void CheckBoxControl::Clicked()
253 // if tristate is enabled, m_aModeState will take care of setting the
254 // next state in the sequence via TriStateEnabled::ButtonToggled
255 if (!m_aModeState
.bTriStateEnabled
)
256 m_xBox
->set_active(!m_xBox
->get_active());
260 IMPL_LINK_NOARG(CheckBoxControl
, OnToggle
, weld::Toggleable
&, void)
262 m_aModeState
.ButtonToggled(*m_xBox
);
263 m_aToggleLink
.Call(*m_xBox
);
267 //= CheckBoxCellController
268 CheckBoxCellController::CheckBoxCellController(CheckBoxControl
* pWin
)
269 : CellController(pWin
)
271 static_cast<CheckBoxControl
&>(GetWindow()).SetModifyHdl( LINK(this, CheckBoxCellController
, ModifyHdl
) );
274 void CheckBoxCellController::ActivatingMouseEvent(const BrowserMouseEvent
& rEvt
, bool /*bUp*/)
276 CheckBoxControl
& rControl
= static_cast<CheckBoxControl
&>(GetWindow());
277 rControl
.GrabFocus();
279 // we have to adjust the position of the event relative to the controller's window
280 Point aPos
= rEvt
.GetPosPixel() - rEvt
.GetRect().TopLeft();
282 Size aControlSize
= rControl
.GetSizePixel();
283 Size aBoxSize
= rControl
.GetBox().get_preferred_size();
284 tools::Rectangle
aHotRect(Point((aControlSize
.Width() - aBoxSize
.Width()) / 2,
285 (aControlSize
.Height() - aBoxSize
.Height()) / 2),
288 // we want the initial mouse event to act as if it was performed on the checkbox
289 if (aHotRect
.Contains(aPos
))
293 weld::CheckButton
& CheckBoxCellController::GetCheckBox() const
295 return static_cast<CheckBoxControl
&>(GetWindow()).GetBox();
298 bool CheckBoxCellController::IsValueChangedFromSaved() const
300 return GetCheckBox().get_state_changed_from_saved();
303 void CheckBoxCellController::SaveValue()
305 GetCheckBox().save_state();
308 IMPL_LINK_NOARG(CheckBoxCellController
, ModifyHdl
, LinkParamNone
*, void)
313 //= MultiLineEditImplementation
314 OUString
MultiLineEditImplementation::GetText(LineEnd eSeparator
) const
316 weld::TextView
& rEntry
= m_rEdit
.get_widget();
317 return convertLineEnd(rEntry
.get_text(), eSeparator
);
320 OUString
MultiLineEditImplementation::GetSelected(LineEnd eSeparator
) const
322 int nStartPos
, nEndPos
;
323 weld::TextView
& rEntry
= m_rEdit
.get_widget();
324 rEntry
.get_selection_bounds(nStartPos
, nEndPos
);
325 return convertLineEnd(rEntry
.get_text().copy(nStartPos
, nEndPos
- nStartPos
), eSeparator
);
328 IMPL_LINK_NOARG(MultiLineEditImplementation
, ModifyHdl
, weld::TextView
&, void)
333 EditCellController::EditCellController( IEditImplementation
* _pImplementation
)
334 :CellController( &_pImplementation
->GetControl() )
335 ,m_pEditImplementation( _pImplementation
)
336 ,m_bOwnImplementation( false )
338 m_pEditImplementation
->SetModifyHdl( LINK(this, EditCellController
, ModifyHdl
) );
341 IMPL_LINK_NOARG(EntryImplementation
, ModifyHdl
, weld::Entry
&, void)
346 ControlBase::ControlBase(BrowserDataWin
* pParent
, const OUString
& rUIXMLDescription
, const OUString
& rID
)
347 : InterimItemWindow(pParent
, rUIXMLDescription
, rID
)
351 void ControlBase::SetEditableReadOnly(bool /*bReadOnly*/)
353 // expected to be overridden for Entry, TextView or the editable entry part of a ComboBox
356 EditControlBase::EditControlBase(BrowserDataWin
* pParent
)
357 : ControlBase(pParent
, "svt/ui/thineditcontrol.ui", "EditControl") // *thin*editcontrol has no frame/border
358 , m_pEntry(nullptr) // inheritors are expected to call InitEditControlBase
362 void EditControlBase::InitEditControlBase(weld::Entry
* pEntry
)
364 InitControlBase(pEntry
);
367 m_pEntry
->set_width_chars(1); // so a smaller than default width can be used
368 connect_focus_in(LINK(this, ControlBase
, FocusInHdl
)); // need to chain with pattern handler
369 connect_focus_out(LINK(this, ControlBase
, FocusOutHdl
)); // need to chain with pattern handler
370 connect_key_press(LINK(this, ControlBase
, KeyInputHdl
)); // need to chain with pattern handler
371 m_pEntry
->connect_key_release(LINK(this, ControlBase
, KeyReleaseHdl
));
372 m_pEntry
->connect_mouse_press(LINK(this, ControlBase
, MousePressHdl
));
373 m_pEntry
->connect_mouse_release(LINK(this, ControlBase
, MouseReleaseHdl
));
374 m_pEntry
->connect_mouse_move(LINK(this, ControlBase
, MouseMoveHdl
));
377 bool ControlBase::ProcessKey(const KeyEvent
& rKEvt
)
379 return static_cast<BrowserDataWin
*>(GetParent())->GetParent()->ProcessKey(rKEvt
);
382 IMPL_LINK(ControlBase
, KeyInputHdl
, const KeyEvent
&, rKEvt
, bool)
384 m_aKeyInputHdl
.Call(rKEvt
);
385 return ProcessKey(rKEvt
);
388 IMPL_LINK(ControlBase
, KeyReleaseHdl
, const KeyEvent
&, rKEvt
, bool)
390 m_aKeyReleaseHdl
.Call(rKEvt
);
394 IMPL_LINK_NOARG(ControlBase
, FocusInHdl
, weld::Widget
&, void)
396 m_aFocusInHdl
.Call(nullptr);
397 static_cast<BrowserDataWin
*>(GetParent())->GetParent()->ChildFocusIn();
400 IMPL_LINK_NOARG(ControlBase
, FocusOutHdl
, weld::Widget
&, void)
402 m_aFocusOutHdl
.Call(nullptr);
403 static_cast<BrowserDataWin
*>(GetParent())->GetParent()->ChildFocusOut();
406 IMPL_LINK(ControlBase
, MousePressHdl
, const MouseEvent
&, rEvent
, bool)
408 m_aMousePressHdl
.Call(rEvent
);
412 IMPL_LINK(ControlBase
, MouseReleaseHdl
, const MouseEvent
&, rEvent
, bool)
414 m_aMouseReleaseHdl
.Call(rEvent
);
418 IMPL_LINK(ControlBase
, MouseMoveHdl
, const MouseEvent
&, rEvent
, bool)
420 m_aMouseMoveHdl
.Call(rEvent
);
424 void EditControlBase::dispose()
427 ControlBase::dispose();
430 EditControl::EditControl(BrowserDataWin
* pParent
)
431 : EditControlBase(pParent
)
432 , m_xWidget(m_xBuilder
->weld_entry("entry"))
434 InitEditControlBase(m_xWidget
.get());
437 void EditControl::dispose()
440 EditControlBase::dispose();
443 FormattedControlBase::FormattedControlBase(BrowserDataWin
* pParent
, bool bSpinVariant
)
444 : EditControlBase(pParent
)
445 , m_bSpinVariant(bSpinVariant
)
446 , m_xEntry(m_xBuilder
->weld_entry("entry"))
447 , m_xSpinButton(m_xBuilder
->weld_formatted_spin_button("spinbutton"))
451 void FormattedControlBase::InitFormattedControlBase()
453 InitEditControlBase(m_bSpinVariant
? m_xSpinButton
.get() : m_xEntry
.get());
456 void FormattedControlBase::connect_changed(const Link
<weld::Entry
&, void>& rLink
)
458 get_formatter().connect_changed(rLink
);
461 void FormattedControlBase::connect_focus_in(const Link
<weld::Widget
&, void>& rLink
)
463 get_widget().connect_focus_in(rLink
);
466 void FormattedControlBase::connect_focus_out(const Link
<weld::Widget
&, void>& rLink
)
468 get_formatter().connect_focus_out(rLink
);
471 void FormattedControlBase::connect_key_press(const Link
<const KeyEvent
&, bool>& rLink
)
473 get_widget().connect_key_press(rLink
);
476 weld::EntryFormatter
& FormattedControlBase::get_formatter()
478 return *m_xEntryFormatter
;
481 void FormattedControlBase::dispose()
483 m_xEntryFormatter
.reset();
484 m_xSpinButton
.reset();
486 EditControlBase::dispose();
489 FormattedControl::FormattedControl(BrowserDataWin
* pParent
, bool bSpinVariant
)
490 : FormattedControlBase(pParent
, bSpinVariant
)
493 m_xEntryFormatter
.reset(new weld::EntryFormatter(*m_xSpinButton
));
495 m_xEntryFormatter
.reset(new weld::EntryFormatter(*m_xEntry
));
496 InitFormattedControlBase();
499 DoubleNumericControl::DoubleNumericControl(BrowserDataWin
* pParent
, bool bSpinVariant
)
500 : FormattedControlBase(pParent
, bSpinVariant
)
503 m_xEntryFormatter
.reset(new weld::DoubleNumericFormatter(*m_xSpinButton
));
505 m_xEntryFormatter
.reset(new weld::DoubleNumericFormatter(*m_xEntry
));
506 InitFormattedControlBase();
509 LongCurrencyControl::LongCurrencyControl(BrowserDataWin
* pParent
, bool bSpinVariant
)
510 : FormattedControlBase(pParent
, bSpinVariant
)
513 m_xEntryFormatter
.reset(new weld::LongCurrencyFormatter(*m_xSpinButton
));
515 m_xEntryFormatter
.reset(new weld::LongCurrencyFormatter(*m_xEntry
));
516 InitFormattedControlBase();
519 TimeControl::TimeControl(BrowserDataWin
* pParent
, bool bSpinVariant
)
520 : FormattedControlBase(pParent
, bSpinVariant
)
523 m_xEntryFormatter
.reset(new weld::TimeFormatter(*m_xSpinButton
));
525 m_xEntryFormatter
.reset(new weld::TimeFormatter(*m_xEntry
));
526 InitFormattedControlBase();
529 DateControl::DateControl(BrowserDataWin
* pParent
, bool bDropDown
)
530 : FormattedControlBase(pParent
, false)
531 , m_xMenuButton(m_xBuilder
->weld_menu_button("button"))
532 , m_xCalendarBuilder(Application::CreateBuilder(m_xMenuButton
.get(), "svt/ui/datewindow.ui"))
533 , m_xTopLevel(m_xCalendarBuilder
->weld_widget("date_popup_window"))
534 , m_xCalendar(m_xCalendarBuilder
->weld_calendar("date"))
535 , m_xExtras(m_xCalendarBuilder
->weld_widget("extras"))
536 , m_xTodayBtn(m_xCalendarBuilder
->weld_button("today"))
537 , m_xNoneBtn(m_xCalendarBuilder
->weld_button("none"))
539 m_xEntryFormatter
.reset(new weld::DateFormatter(*m_xEntry
));
540 InitFormattedControlBase();
542 m_xMenuButton
->set_popover(m_xTopLevel
.get());
543 m_xMenuButton
->set_visible(bDropDown
);
544 m_xMenuButton
->connect_toggled(LINK(this, DateControl
, ToggleHdl
));
548 m_xTodayBtn
->connect_clicked(LINK(this, DateControl
, ImplClickHdl
));
549 m_xNoneBtn
->connect_clicked(LINK(this, DateControl
, ImplClickHdl
));
551 m_xCalendar
->connect_activated(LINK(this, DateControl
, ActivateHdl
));
554 IMPL_LINK(DateControl
, ImplClickHdl
, weld::Button
&, rBtn
, void)
556 m_xMenuButton
->set_active(false);
557 get_widget().grab_focus();
559 if (&rBtn
== m_xTodayBtn
.get())
561 Date
aToday(Date::SYSTEM
);
564 else if (&rBtn
== m_xNoneBtn
.get())
566 get_widget().set_text(OUString());
570 IMPL_LINK(DateControl
, ToggleHdl
, weld::Toggleable
&, rButton
, void)
572 if (rButton
.get_active())
573 m_xCalendar
->set_date(static_cast<weld::DateFormatter
&>(get_formatter()).GetDate());
576 IMPL_LINK_NOARG(DateControl
, ActivateHdl
, weld::Calendar
&, void)
578 if (m_xMenuButton
->get_active())
579 m_xMenuButton
->set_active(false);
580 static_cast<weld::DateFormatter
&>(get_formatter()).SetDate(m_xCalendar
->get_date());
583 void DateControl::SetDate(const Date
& rDate
)
585 static_cast<weld::DateFormatter
&>(get_formatter()).SetDate(rDate
);
586 m_xCalendar
->set_date(rDate
);
589 void DateControl::dispose()
596 m_xCalendarBuilder
.reset();
597 m_xMenuButton
.reset();
598 FormattedControlBase::dispose();
601 PatternControl::PatternControl(BrowserDataWin
* pParent
)
602 : EditControlBase(pParent
)
603 , m_xWidget(m_xBuilder
->weld_entry("entry"))
605 m_xEntryFormatter
.reset(new weld::PatternFormatter(*m_xWidget
));
606 InitEditControlBase(m_xWidget
.get());
609 void PatternControl::connect_changed(const Link
<weld::Entry
&, void>& rLink
)
611 m_xEntryFormatter
->connect_changed(rLink
);
614 void PatternControl::connect_focus_in(const Link
<weld::Widget
&, void>& rLink
)
616 m_xEntryFormatter
->connect_focus_in(rLink
);
619 void PatternControl::connect_focus_out(const Link
<weld::Widget
&, void>& rLink
)
621 m_xEntryFormatter
->connect_focus_out(rLink
);
624 void PatternControl::connect_key_press(const Link
<const KeyEvent
&, bool>& rLink
)
626 m_xEntryFormatter
->connect_key_press(rLink
);
629 void PatternControl::dispose()
631 m_xEntryFormatter
.reset();
633 EditControlBase::dispose();
636 EditCellController::EditCellController(EditControlBase
* pEdit
)
637 : CellController(pEdit
)
638 , m_pEditImplementation(new EntryImplementation(*pEdit
))
639 , m_bOwnImplementation(true)
641 m_pEditImplementation
->SetModifyHdl( LINK(this, EditCellController
, ModifyHdl
) );
644 EditCellController::~EditCellController( )
646 if ( m_bOwnImplementation
)
647 delete m_pEditImplementation
;
650 void EditCellController::SaveValue()
652 m_pEditImplementation
->SaveValue();
655 bool EditCellController::MoveAllowed(const KeyEvent
& rEvt
) const
658 switch (rEvt
.GetKeyCode().GetCode())
663 Selection aSel
= m_pEditImplementation
->GetSelection();
664 bResult
= !aSel
&& aSel
.Max() == m_pEditImplementation
->GetText( LINEEND_LF
).getLength();
670 Selection aSel
= m_pEditImplementation
->GetSelection();
671 bResult
= !aSel
&& aSel
.Min() == 0;
676 bResult
= !m_pEditImplementation
->CanDown();
681 bResult
= !m_pEditImplementation
->CanUp();
690 bool EditCellController::IsValueChangedFromSaved() const
692 return m_pEditImplementation
->IsValueChangedFromSaved();
695 IMPL_LINK_NOARG(EditCellController
, ModifyHdl
, LinkParamNone
*, void)
700 //= FormattedFieldCellController
701 FormattedFieldCellController::FormattedFieldCellController( FormattedControlBase
* _pFormatted
)
702 : EditCellController(_pFormatted
)
706 void FormattedFieldCellController::CommitModifications()
708 static_cast<FormattedControl
&>(GetWindow()).get_formatter().Commit();
711 MultiLineTextCell::MultiLineTextCell(BrowserDataWin
* pParent
)
712 : ControlBase(pParent
, "svt/ui/textviewcontrol.ui", "TextViewControl")
713 , m_xWidget(m_xBuilder
->weld_text_view("textview"))
715 InitControlBase(m_xWidget
.get());
716 m_xWidget
->connect_key_press(LINK(this, ControlBase
, KeyInputHdl
));
717 m_xWidget
->connect_key_release(LINK(this, ControlBase
, KeyReleaseHdl
));
718 m_xWidget
->connect_focus_in(LINK(this, ControlBase
, FocusInHdl
));
719 m_xWidget
->connect_focus_out(LINK(this, ControlBase
, FocusOutHdl
));
720 m_xWidget
->connect_mouse_press(LINK(this, ControlBase
, MousePressHdl
));
721 m_xWidget
->connect_mouse_release(LINK(this, ControlBase
, MouseReleaseHdl
));
722 m_xWidget
->connect_mouse_move(LINK(this, ControlBase
, MouseMoveHdl
));
723 // so any the natural size doesn't have an effect
724 m_xWidget
->set_size_request(1, 1);
727 void MultiLineTextCell::GetFocus()
730 m_xWidget
->select_region(-1, 0);
731 ControlBase::GetFocus();
734 void MultiLineTextCell::dispose()
737 ControlBase::dispose();
740 bool MultiLineTextCell::ProcessKey(const KeyEvent
& rKEvt
)
742 bool bSendToDataWindow
= true;
744 sal_uInt16 nCode
= rKEvt
.GetKeyCode().GetCode();
745 bool bShift
= rKEvt
.GetKeyCode().IsShift();
746 bool bCtrl
= rKEvt
.GetKeyCode().IsMod1();
747 bool bAlt
= rKEvt
.GetKeyCode().IsMod2();
749 if (!bAlt
&& !bCtrl
&& !bShift
)
754 bSendToDataWindow
= !m_xWidget
->can_move_cursor_with_down();
757 bSendToDataWindow
= !m_xWidget
->can_move_cursor_with_up();
762 if (bSendToDataWindow
)
763 return ControlBase::ProcessKey(rKEvt
);
768 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */