summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-19 11:23:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-19 21:26:08 +0200
commit62cef592924fd86856304e361af1b68f204b61e1 (patch)
tree617c0dbd9595e3092da21654053d7df12e6d33b7 /dbaccess/source
parentc8a95925ca316c2656c81696b1e87c7d5767883d (diff)
weld OTitleWindow
Change-Id: I10996b1d927e6e8db913d04d975fda69669a2988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100984 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx8
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.cxx87
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.hxx23
-rw-r--r--dbaccess/source/ui/app/AppView.cxx4
4 files changed, 51 insertions, 71 deletions
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index ab8c7632e54f..ed7a1c6c861c 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -228,17 +228,17 @@ void OTasksWindow::Clear()
OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent )
,m_aHorzSplitter(VclPtr<Splitter>::Create(this))
- ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this, STR_TASKS, WB_BORDER | WB_DIALOGCONTROL))
- ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this, nullptr, WB_BORDER | WB_DIALOGCONTROL))
+ ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this, STR_TASKS))
+ ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this, nullptr))
,m_rBorderWin(_rParent)
{
ImplInitSettings();
- m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer.get(),m_rBorderWin,_ePreviewMode);
+ m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer->getChildContainer(),m_rBorderWin,_ePreviewMode);
m_pControlHelper->Show();
m_aContainer->setChildWindow(m_pControlHelper);
- VclPtrInstance<OTasksWindow> pTasks(m_aTasks.get(),this);
+ VclPtrInstance<OTasksWindow> pTasks(m_aTasks->getChildContainer(),this);
pTasks->Show();
pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
m_aTasks->setChildWindow(pTasks);
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index f3a8023312c2..3231d020e42a 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -17,34 +17,30 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "AppTitleWindow.hxx"
+#include <com/sun/star/awt/XWindow.hpp>
#include <core_resource.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/event.hxx>
+#include "AppTitleWindow.hxx"
namespace dbaui
{
-OTitleWindow::OTitleWindow(vcl::Window* _pParent, const char* pTitleId, WinBits _nBits, bool _bShift)
- : Window(_pParent,_nBits | WB_DIALOGCONTROL)
- , m_aTitleFrame(VclPtr<vcl::Window>::Create(this))
- , m_aTitle(VclPtr<FixedText>::Create(m_aTitleFrame, WB_VCENTER))
- , m_pChild(nullptr)
- , m_bShift(_bShift)
+OTitleWindow::OTitleWindow(vcl::Window* pParent, const char* pTitleId)
+ : InterimItemWindow(pParent, "dbaccess/ui/titlewindow.ui", "TitleWindow")
+ , m_xTitleFrame(m_xBuilder->weld_container("titleparent"))
+ , m_xTitle(m_xBuilder->weld_label("title"))
+ , m_xChildContainer(m_xBuilder->weld_container("box"))
+ , m_xChildParent(m_xChildContainer->CreateChildFrame())
+ , m_xChild(nullptr)
{
setTitle(pTitleId);
- SetBorderStyle(WindowBorderStyle::MONO);
ImplInitSettings();
- const StyleSettings& rStyle = Application::GetSettings().GetStyleSettings();
- vcl::Font aFont = m_aTitle->GetControlFont();
- aFont.SetWeight(WEIGHT_BOLD);
- m_aTitle->SetControlFont(aFont);
- m_aTitle->SetControlForeground(rStyle.GetLightColor());
- m_aTitleFrame->SetBackground(rStyle.GetShadowColor());
- m_aTitleFrame->Show();
- m_aTitle->Show();
+ m_xTitleFrame->set_title_background();
+ m_xTitle->set_label_type(weld::LabelType::Title);
}
OTitleWindow::~OTitleWindow()
@@ -54,64 +50,45 @@ OTitleWindow::~OTitleWindow()
void OTitleWindow::dispose()
{
- if ( m_pChild )
- {
- m_pChild->Hide();
- }
- m_pChild.disposeAndClear();
- m_aTitle.disposeAndClear();
- m_aTitleFrame.disposeAndClear();
- vcl::Window::dispose();
+ if (m_xChild)
+ m_xChild->Hide();
+ m_xChild.disposeAndClear();
+ m_xChildParent->dispose();
+ m_xChildParent.clear();
+ m_xChildContainer.reset();
+ m_xTitle.reset();
+ m_xTitleFrame.reset();
+ InterimItemWindow::dispose();
}
-void OTitleWindow::setChildWindow(vcl::Window* _pChild)
+vcl::Window* OTitleWindow::getChildContainer()
{
- m_pChild = _pChild;
+ return VCLUnoHelper::GetWindow(m_xChildParent);
}
-#define SPACE_BORDER 1
-void OTitleWindow::Resize()
+void OTitleWindow::setChildWindow(vcl::Window* pChild)
{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- Size aTextSize = LogicToPixel(Size(6, 3), MapMode(MapUnit::MapAppFont));
- sal_Int32 nXOffset = aTextSize.Width();
- sal_Int32 nYOffset = aTextSize.Height();
- sal_Int32 nHeight = GetTextHeight() + 2*nYOffset;
-
- m_aTitleFrame->SetPosSizePixel(Point(SPACE_BORDER, SPACE_BORDER),
- Size(nOutputWidth - 2*SPACE_BORDER, nHeight - SPACE_BORDER));
- m_aTitle->SetPosSizePixel(Point(nXOffset, 0),
- Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nHeight - SPACE_BORDER));
- if ( m_pChild )
- {
- m_pChild->SetPosSizePixel( Point(m_bShift ? (nXOffset+SPACE_BORDER) : sal_Int32(SPACE_BORDER), nHeight + nXOffset + SPACE_BORDER),
- Size(nOutputWidth - ( m_bShift ? (2*nXOffset - 2*SPACE_BORDER) : sal_Int32(SPACE_BORDER) ), nOutputHeight - nHeight - 2*nXOffset - 2*SPACE_BORDER) );
- }
+ m_xChild = pChild;
}
void OTitleWindow::setTitle(const char* pTitleId)
{
- if (pTitleId)
- {
- m_aTitle->SetText(DBA_RES(pTitleId));
- }
+ if (!pTitleId)
+ return;
+ m_xTitle->set_label(DBA_RES(pTitleId));
}
void OTitleWindow::GetFocus()
{
- Window::GetFocus();
- if ( m_pChild )
- m_pChild->GrabFocus();
+ InterimItemWindow::GetFocus();
+ if (m_xChild)
+ m_xChild->GrabFocus();
}
long OTitleWindow::GetWidthPixel() const
{
Size aTextSize = LogicToPixel(Size(12, 0), MapMode(MapUnit::MapAppFont));
- sal_Int32 nWidth = GetTextWidth(m_aTitle->GetText()) + 2*aTextSize.Width();
+ sal_Int32 nWidth = GetTextWidth(m_xTitle->get_label()) + 2*aTextSize.Width();
return nWidth;
}
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx
index ebb7fae7e42d..dcef39575cf0 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.hxx
@@ -19,30 +19,33 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
-#include <vcl/fixed.hxx>
+#include <vcl/InterimItemWindow.hxx>
namespace dbaui
{
- class OTitleWindow : public vcl::Window
+ class OTitleWindow final : public InterimItemWindow
{
- VclPtr<vcl::Window> m_aTitleFrame;
- VclPtr<FixedText> m_aTitle;
- VclPtr<vcl::Window> m_pChild;
- bool m_bShift;
+ std::unique_ptr<weld::Container> m_xTitleFrame;
+ std::unique_ptr<weld::Label> m_xTitle;
+ std::unique_ptr<weld::Container> m_xChildContainer;
+ css::uno::Reference<css::awt::XWindow> m_xChildParent;
+ VclPtr<vcl::Window> m_xChild;
void ImplInitSettings();
- protected:
+
virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
public:
- OTitleWindow(vcl::Window* _pParent, const char* pTitleId, WinBits _nBits, bool _bShift = true);
+ OTitleWindow(vcl::Window* pParent, const char* pTitleId);
virtual ~OTitleWindow() override;
virtual void dispose() override;
// Window overrides
- virtual void Resize() override;
virtual void GetFocus() override;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+ /** gets the window which should be used as a child's parent */
+ vcl::Window* getChildContainer();
+
/** sets the child window which should be displayed below the title. It will be destroyed at the end.
@param _pChild
The child window.
@@ -54,7 +57,7 @@ namespace dbaui
@return
The child window.
*/
- vcl::Window* getChildWindow() const { return m_pChild; }
+ vcl::Window* getChildWindow() const { return m_xChild; }
/** sets the title text out of the resource
@param pTitleId
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index bdb2f561126e..b92917c4615b 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -50,9 +50,9 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev
SetBorderStyle(WindowBorderStyle::MONO);
- m_pPanel = VclPtr<OTitleWindow>::Create(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false);
+ m_pPanel = VclPtr<OTitleWindow>::Create(this, STR_DATABASE);
m_pPanel->SetBorderStyle(WindowBorderStyle::MONO);
- VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel, *this );
+ VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel->getChildContainer(), *this );
pSwap->Show();
m_pPanel->setChildWindow(pSwap);