summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svtools/editbrowsebox.hxx12
-rw-r--r--include/vcl/InterimItemWindow.hxx10
-rw-r--r--include/vcl/window.hxx2
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx33
-rw-r--r--vcl/source/control/InterimItemWindow.cxx27
5 files changed, 38 insertions, 46 deletions
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index aa162d1bd09b..5c8cbef2d9eb 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -170,21 +170,9 @@ namespace svt
public:
ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OString& rID);
- bool ControlHasFocus() const;
-
- virtual void dispose() override;
-
- virtual void GetFocus() override;
-
virtual bool ProcessKey(const KeyEvent& rKEvt);
-
- virtual void Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags nFlags) override;
protected:
- void InitControlBase(weld::Widget* pWidget);
-
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
- private:
- weld::Widget* m_pWidget;
};
class SVT_DLLPUBLIC EditControlBase : public ControlBase
diff --git a/include/vcl/InterimItemWindow.hxx b/include/vcl/InterimItemWindow.hxx
index 2ff2dd6d2303..2e2a259a2077 100644
--- a/include/vcl/InterimItemWindow.hxx
+++ b/include/vcl/InterimItemWindow.hxx
@@ -23,10 +23,16 @@ public:
virtual Size GetOptimalSize() const override;
virtual void GetFocus() override;
+ bool ControlHasFocus() const;
+
+ virtual void Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags nFlags) override;
+
protected:
InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID,
sal_uInt64 nLOKWindowId = 0);
+ void InitControlBase(weld::Widget* pWidget);
+
// pass keystrokes from our child window through this to handle focus changes correctly
// returns true if keystroke is consumed
bool ChildKeyInput(const KeyEvent& rKEvt);
@@ -34,6 +40,10 @@ protected:
std::unique_ptr<weld::Builder> m_xBuilder;
VclPtr<vcl::Window> m_xVclContentArea;
std::unique_ptr<weld::Container> m_xContainer;
+ weld::Widget* m_pWidget;
+
+private:
+ virtual void ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& rPos) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index bcd98f64d572..f937c9c2503d 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -721,7 +721,7 @@ private:
SAL_DLLPRIVATE bool ImplStopDnd();
SAL_DLLPRIVATE void ImplStartDnd();
- SAL_DLLPRIVATE void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
+ virtual void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
SAL_DLLPRIVATE css::uno::Reference< css::rendering::XCanvas >
ImplGetCanvas( bool bSpriteCanvas ) const;
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index b228985547d8..96b802bcf2e4 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -300,42 +300,9 @@ namespace svt
ControlBase::ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OString& rID)
: InterimItemWindow(pParent, rUIXMLDescription, rID)
- , m_pWidget(nullptr) // inheritors are expected to call InitControlBase
{
}
- bool ControlBase::ControlHasFocus() const
- {
- if (!m_pWidget)
- return false;
- return m_pWidget->has_focus();
- }
-
- void ControlBase::Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags /*nFlags*/)
- {
- if (!m_pWidget)
- return;
- m_pWidget->draw(*pDevice, tools::Rectangle(rPos, GetSizePixel()));
- }
-
- void ControlBase::dispose()
- {
- m_pWidget = nullptr;
- InterimItemWindow::dispose();
- }
-
- void ControlBase::GetFocus()
- {
- if (m_pWidget)
- m_pWidget->grab_focus();
- InterimItemWindow::GetFocus();
- }
-
- void ControlBase::InitControlBase(weld::Widget* pWidget)
- {
- m_pWidget = pWidget;
- }
-
EditControlBase::EditControlBase(BrowserDataWin* pParent)
: ControlBase(pParent, "svt/ui/thineditcontrol.ui", "EditControl") // *thin*editcontrol has no frame/border
, m_pEntry(nullptr) // inheritors are expected to call InitEditControlBase
diff --git a/vcl/source/control/InterimItemWindow.cxx b/vcl/source/control/InterimItemWindow.cxx
index 67554e226b5b..e42a331438f2 100644
--- a/vcl/source/control/InterimItemWindow.cxx
+++ b/vcl/source/control/InterimItemWindow.cxx
@@ -13,6 +13,7 @@
InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription,
const OString& rID, sal_uInt64 nLOKWindowId)
: Control(pParent, WB_TABSTOP | WB_DIALOGCONTROL)
+ , m_pWidget(nullptr) // inheritors are expected to call InitControlBase
{
m_xVclContentArea = VclPtr<VclVBox>::Create(this);
m_xVclContentArea->Show();
@@ -28,6 +29,8 @@ InterimItemWindow::~InterimItemWindow() { disposeOnce(); }
void InterimItemWindow::dispose()
{
+ m_pWidget = nullptr;
+
m_xContainer.reset();
m_xBuilder.reset();
m_xVclContentArea.disposeAndClear();
@@ -48,8 +51,20 @@ Size InterimItemWindow::GetOptimalSize() const
return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
}
+bool InterimItemWindow::ControlHasFocus() const
+{
+ if (!m_pWidget)
+ return false;
+ return m_pWidget->has_focus();
+}
+
+void InterimItemWindow::InitControlBase(weld::Widget* pWidget) { m_pWidget = pWidget; }
+
void InterimItemWindow::GetFocus()
{
+ if (m_pWidget)
+ m_pWidget->grab_focus();
+
/* let toolbox know this item window has focus so it updates its mnHighItemId to point
to this toolitem in case tab means to move to another toolitem within
the toolbox
@@ -97,4 +112,16 @@ bool InterimItemWindow::ChildKeyInput(const KeyEvent& rKEvt)
return true;
}
+void InterimItemWindow::Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags /*nFlags*/)
+{
+ if (!m_pWidget)
+ return;
+ m_pWidget->draw(*pDevice, tools::Rectangle(rPos, GetSizePixel()));
+}
+
+void InterimItemWindow::ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& rPos)
+{
+ Draw(pTargetOutDev, rPos, DrawFlags::NONE);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */