diff options
-rw-r--r-- | forms/source/solar/control/navtoolbar.cxx | 2 | ||||
-rw-r--r-- | forms/source/solar/inc/navtoolbar.hxx | 2 | ||||
-rw-r--r-- | include/svtools/brwbox.hxx | 4 | ||||
-rw-r--r-- | include/svtools/recorditemwindow.hxx (renamed from include/svx/recorditemwindow.hxx) | 13 | ||||
-rw-r--r-- | include/svx/gridctrl.hxx | 11 | ||||
-rw-r--r-- | solenv/sanitizers/ui/svx.suppr | 3 | ||||
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/brwbox/brwbox1.cxx | 6 | ||||
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 4 | ||||
-rw-r--r-- | svtools/source/brwbox/recorditemwindow.cxx (renamed from svx/source/form/recorditemwindow.cxx) | 14 | ||||
-rw-r--r-- | svx/Library_svxcore.mk | 1 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 72 | ||||
-rw-r--r-- | svx/source/form/tbxform.cxx | 2 | ||||
-rw-r--r-- | svx/source/inc/gridcell.hxx | 1 | ||||
-rw-r--r-- | svx/source/inc/tbxform.hxx | 2 | ||||
-rw-r--r-- | svx/uiconfig/ui/absrecbox.ui | 22 |
16 files changed, 80 insertions, 80 deletions
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index 2f0147d04307..5c0ee830cbec 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -621,7 +621,7 @@ namespace frm } RecordPositionInput::RecordPositionInput(vcl::Window* pParent) - : RecordItemWindow(pParent) + : RecordItemWindow(pParent, true) , m_pDispatcher( nullptr ) { } diff --git a/forms/source/solar/inc/navtoolbar.hxx b/forms/source/solar/inc/navtoolbar.hxx index 576ddb951293..c96fd141662b 100644 --- a/forms/source/solar/inc/navtoolbar.hxx +++ b/forms/source/solar/inc/navtoolbar.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_FORMS_SOURCE_SOLAR_INC_NAVTOOLBAR_HXX #define INCLUDED_FORMS_SOURCE_SOLAR_INC_NAVTOOLBAR_HXX -#include <svx/recorditemwindow.hxx> +#include <svtools/recorditemwindow.hxx> #include <memory> namespace frm diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 67a3e8fdbb7a..00b68803515b 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -39,7 +39,7 @@ class BrowserColumn; class BrowserHeader; class ScrollBar; -class StatusBar; +class RecordItemWindow; namespace svt { class BrowseBoxImpl; @@ -275,7 +275,7 @@ private: VclPtr<BrowserDataWin> pDataWin; // window to display data rows VclPtr<ScrollBar> pVScroll; // vertical scrollbar VclPtr<ScrollBar> aHScroll; // horizontal scrollbar - VclPtr<StatusBar> aStatusBar; // statusbar, just to measure its height + VclPtr<RecordItemWindow> aStatusBarHeight; // statusbar, just to measure its height long nDataRowHeight; // height of a single data-row sal_uInt16 nTitleLines; // number of lines in title row diff --git a/include/svx/recorditemwindow.hxx b/include/svtools/recorditemwindow.hxx index d49db978c136..576be8766430 100644 --- a/include/svx/recorditemwindow.hxx +++ b/include/svtools/recorditemwindow.hxx @@ -10,23 +10,28 @@ #pragma once #include <vcl/InterimItemWindow.hxx> -#include <svx/svxdllapi.h> +#include <svtools/svtdllapi.h> -class SVXCORE_DLLPUBLIC RecordItemWindow : public InterimItemWindow +class SVT_DLLPUBLIC RecordItemWindow : public InterimItemWindow { public: - RecordItemWindow(vcl::Window* _pParent); + RecordItemWindow(vcl::Window* pParent, bool bHasFrame); virtual void dispose() override; virtual ~RecordItemWindow() override; void set_text(const OUString& rText) { m_xWidget->set_text(rText); } + void set_font(const vcl::Font& rFont) { m_xWidget->set_font(rFont); } + +protected: + virtual bool DoKeyInput(const KeyEvent& rEvt); private: - virtual void PositionFired(sal_Int64 nRecord) = 0; + virtual void PositionFired(sal_Int64 nRecord); std::unique_ptr<weld::Entry> m_xWidget; DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(ActivatedHdl, weld::Entry&, bool); // for invalidating our content when losing the focus DECL_LINK(FocusOutHdl, weld::Widget&, void); diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index 90eaa9927280..c07f9ed464f1 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -20,12 +20,13 @@ #define INCLUDED_SVX_GRIDCTRL_HXX #include <com/sun/star/util/Date.hpp> -#include <vcl/field.hxx> #include <tools/ref.hxx> #include <svtools/editbrowsebox.hxx> +#include <svtools/recorditemwindow.hxx> #include <osl/mutex.hxx> #include <svx/svxdllapi.h> +#include <vcl/menu.hxx> #include <o3tl/typed_flags_set.hxx> #include <memory> #include <vector> @@ -174,13 +175,13 @@ public: class SAL_DLLPRIVATE NavigationBar final : public Control { - class AbsolutePos : public NumericField + class AbsolutePos final : public RecordItemWindow { public: - AbsolutePos(vcl::Window* pParent, WinBits nStyle); + AbsolutePos(vcl::Window* pParent); - virtual void KeyInput(const KeyEvent& rEvt) override; - virtual void LoseFocus() override; + virtual bool DoKeyInput(const KeyEvent& rEvt) override; + virtual void PositionFired(sal_Int64 nRecord) override; }; friend class NavigationBar::AbsolutePos; diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr index d33877fd457f..5a9d0f52fde2 100644 --- a/solenv/sanitizers/ui/svx.suppr +++ b/solenv/sanitizers/ui/svx.suppr @@ -1,4 +1,5 @@ -svx/uiconfig/ui/absrecbox.ui://GtkEntry[@id='entry'] no-labelled-by +svx/uiconfig/ui/absrecbox.ui://GtkEntry[@id='entry-frame'] no-labelled-by +svx/uiconfig/ui/absrecbox.ui://GtkEntry[@id='entry-noframe'] no-labelled-by svx/uiconfig/ui/addinstancedialog.ui://GtkLabel[@id='alttitle'] orphan-label svx/uiconfig/ui/addmodeldialog.ui://GtkLabel[@id='alttitle'] orphan-label svx/uiconfig/ui/addnamespacedialog.ui://GtkLabel[@id='alttitle'] orphan-label diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 63bb7e13205d..456a7ae568a0 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -74,6 +74,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/brwbox/ebbcontrols \ svtools/source/brwbox/editbrowsebox \ svtools/source/brwbox/editbrowsebox2 \ + svtools/source/brwbox/recorditemwindow \ svtools/source/config/accessibilityoptions \ svtools/source/config/apearcfg \ svtools/source/config/colorcfg \ diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 17392a79db0e..5bac96fc1945 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -19,6 +19,7 @@ #include <svtools/brwbox.hxx> #include <svtools/brwhead.hxx> +#include <svtools/recorditemwindow.hxx> #include <o3tl/numeric.hxx> #include <o3tl/safeint.hxx> #include "datwin.hxx" @@ -26,7 +27,6 @@ #include <tools/fract.hxx> #include <sal/log.hxx> #include <vcl/scrbar.hxx> -#include <vcl/status.hxx> #include <algorithm> #include <com/sun/star/accessibility/AccessibleTableModelChange.hpp> @@ -110,7 +110,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode ) ,DragSourceHelper( this ) ,DropTargetHelper( this ) ,aHScroll( VclPtr<ScrollBar>::Create(this, WB_HSCROLL) ) - ,aStatusBar( VclPtr<StatusBar>::Create(this) ) + ,aStatusBarHeight(VclPtr<RecordItemWindow>::Create(this, false)) { ConstructImpl( nMode ); } @@ -137,7 +137,7 @@ void BrowseBox::dispose() pDataWin.disposeAndClear(); pVScroll.disposeAndClear(); aHScroll.disposeAndClear(); - aStatusBar.disposeAndClear(); + aStatusBarHeight.disposeAndClear(); // free columns-space mvCols.clear(); diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 1046363849b9..5abdf5e34099 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -22,13 +22,13 @@ #include <osl/diagnose.h> #include <tools/debug.hxx> #include <svtools/brwbox.hxx> +#include <svtools/recorditemwindow.hxx> #include "datwin.hxx" #include <svtools/colorcfg.hxx> #include <vcl/commandevent.hxx> #include <vcl/ptrstyle.hxx> #include <vcl/scrbar.hxx> #include <vcl/settings.hxx> -#include <vcl/status.hxx> #include <tools/multisel.hxx> #include <tools/fract.hxx> @@ -1037,7 +1037,7 @@ long BrowseBox::GetBarHeight() const // (we can't ask the scrollbars for their size cause if we're zoomed they still have to be // resized - which is done in UpdateScrollbars) - return std::max(aStatusBar->GetSizePixel().Height(), GetSettings().GetStyleSettings().GetScrollBarSize()); + return std::max(aStatusBarHeight->GetSizePixel().Height(), GetSettings().GetStyleSettings().GetScrollBarSize()); } void BrowseBox::UpdateScrollbars() diff --git a/svx/source/form/recorditemwindow.cxx b/svtools/source/brwbox/recorditemwindow.cxx index efb07343ecfc..a993044cb6de 100644 --- a/svx/source/form/recorditemwindow.cxx +++ b/svtools/source/brwbox/recorditemwindow.cxx @@ -17,12 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <svtools/recorditemwindow.hxx> #include <vcl/event.hxx> -#include <tbxform.hxx> -RecordItemWindow::RecordItemWindow(vcl::Window* pParent) +RecordItemWindow::RecordItemWindow(vcl::Window* pParent, bool bHasFrame) : InterimItemWindow(pParent, "svx/ui/absrecbox.ui", "AbsRecBox") - , m_xWidget(m_xBuilder->weld_entry("entry")) + , m_xWidget(m_xBuilder->weld_entry(bHasFrame ? "entry-frame" : "entry-noframe")) { InitControlBase(m_xWidget.get()); @@ -30,6 +30,8 @@ RecordItemWindow::RecordItemWindow(vcl::Window* pParent) m_xWidget->connect_activate(LINK(this, RecordItemWindow, ActivatedHdl)); m_xWidget->connect_focus_out(LINK(this, RecordItemWindow, FocusOutHdl)); + m_xWidget->show(); + auto aPrefSize(m_xWidget->get_preferred_size()); m_xWidget->set_width_chars(1); // so a smaller than default width can be used later @@ -61,7 +63,7 @@ void RecordItemWindow::FirePosition(bool _bForce) IMPL_LINK_NOARG(RecordItemWindow, FocusOutHdl, weld::Widget&, void) { FirePosition(false); } -IMPL_LINK(RecordItemWindow, KeyInputHdl, const KeyEvent&, rKEvt, bool) +bool RecordItemWindow::DoKeyInput(const KeyEvent& rKEvt) { vcl::KeyCode aCode = rKEvt.GetKeyCode(); bool bUp = (aCode.GetCode() == KEY_UP); @@ -83,6 +85,10 @@ IMPL_LINK(RecordItemWindow, KeyInputHdl, const KeyEvent&, rKEvt, bool) return ChildKeyInput(rKEvt); } +void RecordItemWindow::PositionFired(sal_Int64 /*nRecord*/) {} + +IMPL_LINK(RecordItemWindow, KeyInputHdl, const KeyEvent&, rKEvt, bool) { return DoKeyInput(rKEvt); } + IMPL_LINK_NOARG(RecordItemWindow, ActivatedHdl, weld::Entry&, bool) { if (!m_xWidget->get_text().isEmpty()) diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index bd9cf307393b..73d22cafee6c 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -469,7 +469,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/form/navigatortree \ svx/source/form/navigatortreemodel \ svx/source/form/ParseContext \ - svx/source/form/recorditemwindow \ svx/source/form/sdbdatacolumn \ svx/source/form/sqlparserclient \ svx/source/form/typemap \ diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 71d51825c560..e0d8093ec989 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -274,44 +274,26 @@ void FmXGridSourcePropListener::_propertyChanged(const PropertyChangeEvent& evt) m_pParent->DataSourcePropertyChanged(evt); } -DbGridControl::NavigationBar::AbsolutePos::AbsolutePos(vcl::Window* pParent, WinBits nStyle) - :NumericField(pParent, nStyle) +DbGridControl::NavigationBar::AbsolutePos::AbsolutePos(vcl::Window* pParent) + : RecordItemWindow(pParent, false) { - SetMin(1); - SetFirst(1); - SetSpinSize(1); - - SetDecimalDigits(0); - SetStrictFormat(true); } -void DbGridControl::NavigationBar::AbsolutePos::KeyInput(const KeyEvent& rEvt) +bool DbGridControl::NavigationBar::AbsolutePos::DoKeyInput(const KeyEvent& rEvt) { - if (rEvt.GetKeyCode() == KEY_RETURN && !GetText().isEmpty()) + if (rEvt.GetKeyCode() == KEY_TAB) { - sal_Int64 nRecord = GetValue(); - if (nRecord < GetMin() || nRecord > GetMax()) - return; - else - static_cast<NavigationBar*>(GetParent())->PositionDataSource(static_cast<sal_Int32>(nRecord)); - } - else if (rEvt.GetKeyCode() == KEY_TAB) GetParent()->GetParent()->GrabFocus(); - else - NumericField::KeyInput(rEvt); + return true; + } + return RecordItemWindow::DoKeyInput(rEvt); } -void DbGridControl::NavigationBar::AbsolutePos::LoseFocus() +void DbGridControl::NavigationBar::AbsolutePos::PositionFired(sal_Int64 nRecord) { - NumericField::LoseFocus(); - sal_Int64 nRecord = GetValue(); - if (nRecord < GetMin() || nRecord > GetMax()) - return; - else - { - static_cast<NavigationBar*>(GetParent())->PositionDataSource(static_cast<sal_Int32>(nRecord)); - static_cast<NavigationBar*>(GetParent())->InvalidateState(DbGridControlNavigationBarState::Absolute); - } + NavigationBar* pBar = static_cast<NavigationBar*>(GetParent()); + pBar->PositionDataSource(nRecord); + pBar->InvalidateState(DbGridControlNavigationBarState::Absolute); } void DbGridControl::NavigationBar::PositionDataSource(sal_Int32 nRecord) @@ -328,7 +310,7 @@ void DbGridControl::NavigationBar::PositionDataSource(sal_Int32 nRecord) DbGridControl::NavigationBar::NavigationBar(vcl::Window* pParent) :Control(pParent, 0) ,m_aRecordText(VclPtr<FixedText>::Create(this, WB_VCENTER)) - ,m_aAbsolute(VclPtr<DbGridControl::NavigationBar::AbsolutePos>::Create(this, WB_CENTER | WB_VCENTER)) + ,m_aAbsolute(VclPtr<DbGridControl::NavigationBar::AbsolutePos>::Create(this)) ,m_aRecordOf(VclPtr<FixedText>::Create(this, WB_VCENTER)) ,m_aRecordCount(VclPtr<FixedText>::Create(this, WB_VCENTER)) ,m_aFirstBtn(VclPtr<ImageButton>::Create(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)) @@ -392,7 +374,6 @@ DbGridControl::NavigationBar::NavigationBar(vcl::Window* pParent) m_aAbsolute->Show(); } - DbGridControl::NavigationBar::~NavigationBar() { disposeOnce(); @@ -428,6 +409,7 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls() // calculate base size tools::Rectangle aRect(static_cast<DbGridControl*>(GetParent())->GetControlArea()); long nH = aRect.GetSize().Height(); + long nW = GetParent()->GetOutputSizePixel().Width(); Size aBorder = LogicToPixel(Size(2, 2), MapMode(MapUnit::MapAppFont)); aBorder = Size(CalcZoom(aBorder.Width()), CalcZoom(aBorder.Height())); @@ -436,7 +418,7 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls() { vcl::Font aApplFont(GetSettings().GetStyleSettings().GetToolFont()); - m_aAbsolute->SetControlFont( aApplFont ); + m_aAbsolute->set_font(aApplFont); aApplFont.SetTransparent( true ); m_aRecordText->SetControlFont( aApplFont ); m_aRecordOf->SetControlFont( aApplFont ); @@ -451,7 +433,7 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls() nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width()); // count an extra hairspace (U+200A) left and right - const OUString sevenDigits(m_aAbsolute->CreateFieldText(6000000)); + const OUString sevenDigits(OUString::number(6000000)); const OUString hairSpace(u'\x200A'); OUString textPattern = hairSpace + sevenDigits + hairSpace; nTextWidth = m_aAbsolute->GetTextWidth(textPattern); @@ -691,21 +673,9 @@ void DbGridControl::NavigationBar::SetState(DbGridControlNavigationBarState nWhi case DbGridControlNavigationBarState::Absolute: pWnd = m_aAbsolute.get(); if (bAvailable) - { - if (pParent->m_nTotalCount >= 0) - { - if (pParent->IsCurrentAppending()) - m_aAbsolute->SetMax(pParent->m_nTotalCount + 1); - else - m_aAbsolute->SetMax(pParent->m_nTotalCount); - } - else - m_aAbsolute->SetMax(LONG_MAX); - - m_aAbsolute->SetValue(m_nCurrentPos + 1); - } + m_aAbsolute->set_text(OUString::number(m_nCurrentPos + 1)); else - m_aAbsolute->SetText(OUString()); + m_aAbsolute->set_text(OUString()); break; case DbGridControlNavigationBarState::Text: pWnd = m_aRecordText.get(); @@ -722,12 +692,12 @@ void DbGridControl::NavigationBar::SetState(DbGridControlNavigationBarState nWhi if (pParent->GetOptions() & DbGridControlOptions::Insert) { if (pParent->IsCurrentAppending() && !pParent->IsModified()) - aText = m_aAbsolute->CreateFieldText(pParent->GetRowCount()); + aText = OUString::number(pParent->GetRowCount()); else - aText = m_aAbsolute->CreateFieldText(pParent->GetRowCount() - 1); + aText = OUString::number(pParent->GetRowCount() - 1); } else - aText = m_aAbsolute->CreateFieldText(pParent->GetRowCount()); + aText = OUString::number(pParent->GetRowCount()); if(!pParent->m_bRecordCountFinal) aText += " *"; } @@ -738,7 +708,7 @@ void DbGridControl::NavigationBar::SetState(DbGridControlNavigationBarState nWhi if (pParent->GetSelectRowCount()) { OUString aExtendedInfo = aText + " (" + - m_aAbsolute->CreateFieldText(pParent->GetSelectRowCount()) + ")"; + OUString::number(pParent->GetSelectRowCount()) + ")"; pWnd->SetText(aExtendedInfo); } else diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index 97aac28af619..ad081492f25c 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; SvxFmAbsRecWin::SvxFmAbsRecWin(vcl::Window* pParent, SfxToolBoxControl* pController) - : RecordItemWindow(pParent) + : RecordItemWindow(pParent, true) , m_pController(pController) { } diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 2f57874c779b..669d1d6095a8 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -22,6 +22,7 @@ #include <memory> #include <svx/gridctrl.hxx> +#include <vcl/edit.hxx> #include "sqlparserclient.hxx" diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx index a167b51d42ea..cd8f7e037502 100644 --- a/svx/source/inc/tbxform.hxx +++ b/svx/source/inc/tbxform.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SVX_SOURCE_INC_TBXFORM_HXX #include <sfx2/tbxctrl.hxx> -#include <svx/recorditemwindow.hxx> +#include <svtools/recorditemwindow.hxx> class SvxFmAbsRecWin final : public RecordItemWindow { diff --git a/svx/uiconfig/ui/absrecbox.ui b/svx/uiconfig/ui/absrecbox.ui index a91603f505f6..b1f763b33587 100644 --- a/svx/uiconfig/ui/absrecbox.ui +++ b/svx/uiconfig/ui/absrecbox.ui @@ -7,11 +7,11 @@ <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="spacing">4</property> + <property name="orientation">vertical</property> <child> - <object class="GtkEntry" id="entry"> - <property name="visible">True</property> + <object class="GtkEntry" id="entry-frame"> <property name="can_focus">True</property> + <property name="no_show_all">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="width_chars">4</property> @@ -23,5 +23,21 @@ <property name="position">0</property> </packing> </child> + <child> + <object class="GtkEntry" id="entry-noframe"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="has_frame">False</property> + <property name="width_chars">4</property> + <property name="shadow_type">none</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> </interface> |