summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/app
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-25 16:51:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-27 20:14:00 +0200
commit0319ebeca61a8eb73c6bdacc25639658fe3b9fba (patch)
treee88d05fe4b8f1281470b9c27e04467088b7c5235 /dbaccess/source/ui/app
parentfce9d818e7ddeeb309e56069f67b7fb702ea31a6 (diff)
weld dbu ui cluster
making the dbaccess a wholely welded hierarchy Change-Id: I87ea94d7775e38c8eb3342d91a730457481407f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101340 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/app')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx9
-rw-r--r--dbaccess/source/ui/app/AppController.hxx3
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx61
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx18
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx230
-rw-r--r--dbaccess/source/ui/app/AppDetailView.hxx55
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.cxx54
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.hxx19
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.cxx96
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.hxx34
-rw-r--r--dbaccess/source/ui/app/AppView.cxx135
-rw-r--r--dbaccess/source/ui/app/AppView.hxx36
-rw-r--r--dbaccess/source/ui/app/ChildWindow.cxx25
-rw-r--r--dbaccess/source/ui/app/ChildWindow.hxx34
14 files changed, 317 insertions, 492 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 937778bb3302..f8818f11d7ed 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2268,9 +2268,14 @@ Any OApplicationController::getCurrentSelection(weld::TreeView& rControl) const
return makeAny( aSelection );
}
-vcl::Window* OApplicationController::getMenuParent(weld::TreeView& rControl) const
+vcl::Window* OApplicationController::getMenuParent() const
{
- return getContainer()->getMenuParent(rControl);
+ return getContainer()->getMenuParent();
+}
+
+void OApplicationController::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ getContainer()->adjustMenuPosition(rControl, rPos);
}
bool OApplicationController::requestQuickHelp(const void* /*pUserData*/, OUString& /*rText*/) const
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index 490b4232a7ea..0fe4dcbca527 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -507,7 +507,8 @@ namespace dbaui
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
virtual css::uno::Any getCurrentSelection(weld::TreeView& rControl) const override;
- virtual vcl::Window* getMenuParent(weld::TreeView& rControl) const override;
+ virtual vcl::Window* getMenuParent() const override;
+ virtual void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const override;
void OnInvalidateClipboard();
DECL_LINK( OnClipboardChanged, TransferableDataHelper*, void );
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 8cf955b2a2f0..1d1a023445ae 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -121,8 +121,8 @@ namespace
}
}
-OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* pParent, OAppBorderWindow& rBorderWin, PreviewMode ePreviewMode)
- : InterimItemWindow(pParent, "dbaccess/ui/detailwindow.ui", "DetailWindow")
+OAppDetailPageHelper::OAppDetailPageHelper(weld::Container* pParent, OAppBorderWindow& rBorderWin, PreviewMode ePreviewMode)
+ : OChildWindow(pParent, "dbaccess/ui/detailwindow.ui", "DetailWindow")
, m_rBorderWin(rBorderWin)
, m_xBox(m_xBuilder->weld_container("box"))
, m_xFL(m_xBuilder->weld_widget("separator"))
@@ -150,17 +150,10 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* pParent, OAppBorderWindo
m_xDocumentInfo->SetHelpId(HID_APP_VIEW_PREVIEW_3);
m_xWindow = m_xTablePreview->CreateChildFrame();
-
- ImplInitSettings();
}
OAppDetailPageHelper::~OAppDetailPageHelper()
{
- disposeOnce();
-}
-
-void OAppDetailPageHelper::dispose()
-{
try
{
Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
@@ -191,8 +184,6 @@ void OAppDetailPageHelper::dispose()
m_xMBPreview.reset();
m_xFL.reset();
m_xBox.reset();
-
- InterimItemWindow::dispose();
}
int OAppDetailPageHelper::getVisibleControlIndex() const
@@ -215,14 +206,21 @@ void OAppDetailPageHelper::selectAll()
}
}
-void OAppDetailPageHelper::GetFocus()
+void OAppDetailPageHelper::GrabFocus()
{
int nPos = getVisibleControlIndex();
if (nPos < E_ELEMENT_TYPE_COUNT)
m_aLists[nPos]->GetWidget().grab_focus();
else if (m_xMBPreview && m_xMBPreview->get_visible())
m_xMBPreview->grab_focus();
- InterimItemWindow::GetFocus();
+}
+
+bool OAppDetailPageHelper::HasChildPathFocus() const
+{
+ int nPos = getVisibleControlIndex();
+ if (nPos < E_ELEMENT_TYPE_COUNT && m_aLists[nPos]->GetWidget().has_focus())
+ return true;
+ return m_xMBPreview && m_xMBPreview->has_focus();
}
void OAppDetailPageHelper::sort(int nPos, bool bAscending)
@@ -368,9 +366,19 @@ void OAppDetailPageHelper::describeCurrentSelectionForType(const ElementType eTy
_out_rSelectedObjects = comphelper::containerToSequence(aSelected);
}
-vcl::Window* OAppDetailPageHelper::getMenuParent(weld::TreeView& /*rControl*/) const
+vcl::Window* OAppDetailPageHelper::getMenuParent() const
+{
+ return &m_rBorderWin;
+}
+
+void OAppDetailPageHelper::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
{
- return const_cast<dbaui::OAppDetailPageHelper*>(this);
+ int x, y, width, height;
+ if (rControl.get_extents_relative_to(m_rBorderWin.getTopLevel(), x, y, width, height))
+ {
+ rPos.AdjustX(x);
+ rPos.AdjustY(y);
+ }
}
void OAppDetailPageHelper::selectElements(const Sequence< OUString>& _aNames)
@@ -679,7 +687,7 @@ std::unique_ptr<DBTreeViewBase> OAppDetailPageHelper::createSimpleTree(const OSt
void OAppDetailPageHelper::setupTree(DBTreeViewBase& rDBTreeView)
{
- weld::WaitObject aWaitCursor(GetFrameWeld());
+ weld::WaitObject aWaitCursor(m_rBorderWin.GetFrameWeld());
rDBTreeView.getListBox().setCopyHandler(LINK(this, OAppDetailPageHelper, OnCopyEntry));
rDBTreeView.getListBox().setPasteHandler(LINK(this, OAppDetailPageHelper, OnPasteEntry));
@@ -688,6 +696,8 @@ void OAppDetailPageHelper::setupTree(DBTreeViewBase& rDBTreeView)
weld::TreeView& rTreeView = rDBTreeView.GetWidget();
rTreeView.make_sorted();
rTreeView.set_selection_mode(SelectionMode::Multiple);
+ // an arbitrary small size it's allowed to shrink to
+ rTreeView.set_size_request(42, 42);
rTreeView.connect_row_activated(LINK(this, OAppDetailPageHelper, OnEntryDoubleClick));
@@ -937,7 +947,7 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
m_xTablePreview->hide();
- weld::WaitObject aWaitCursor(GetFrameWeld());
+ weld::WaitObject aWaitCursor(m_rBorderWin.GetFrameWeld());
try
{
Reference<XCommandProcessor> xContent(_xContent,UNO_QUERY);
@@ -998,7 +1008,7 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
if ( !isPreviewEnabled() )
return;
- weld::WaitObject aWaitCursor(GetFrameWeld());
+ weld::WaitObject aWaitCursor(m_rBorderWin.GetFrameWeld());
m_xPreview->Hide();
m_xDocumentInfo->Hide();
m_xTablePreview->show();
@@ -1161,21 +1171,6 @@ IMPL_LINK(OAppDetailPageHelper, MenuSelectHdl, const OString&, rIdent, void)
m_xMBPreview->set_label(stripTrailingDots(m_xMBPreview->get_item_label(rIdent)));
}
-void OAppDetailPageHelper::KeyInput( const KeyEvent& rKEvt )
-{
- DBTreeViewBase* pCurrentView = getCurrentView();
- OSL_PRECOND( pCurrentView, "OAppDetailPageHelper::KeyInput: how this?" );
-
- sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- if (KEY_RETURN == nCode && pCurrentView)
- {
- getBorderWin().getView()->getAppController().onEntryDoubleClick(pCurrentView->GetWidget());
- return;
- }
-
- InterimItemWindow::KeyInput(rKEvt);
-}
-
OPreviewWindow::OPreviewWindow()
{
}
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 33b98d66116c..f5cd662236cb 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -28,13 +28,11 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <AppElementType.hxx>
#include <sfx2/weldutils.hxx>
-#include <vcl/InterimItemWindow.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/toolbox.hxx>
#include <vcl/graph.hxx>
#include <vcl/GraphicObject.hxx>
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
+#include "ChildWindow.hxx"
#include "DocumentInfoPreview.hxx"
namespace com::sun::star::awt { class XWindow; }
@@ -78,7 +76,7 @@ namespace dbaui
// A helper class for the controls in the detail page.
// Combines general functionality.
- class OAppDetailPageHelper final : public InterimItemWindow
+ class OAppDetailPageHelper final : public OChildWindow
{
std::unique_ptr<DBTreeViewBase> m_aLists[ELEMENT_COUNT];
OAppBorderWindow& m_rBorderWin;
@@ -165,14 +163,11 @@ namespace dbaui
OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
public:
- OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode);
+ OAppDetailPageHelper(weld::Container* pParent, OAppBorderWindow& rBorderWin, PreviewMode ePreviewMode);
virtual ~OAppDetailPageHelper() override;
- virtual void dispose() override;
- // Window overrides
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
-
- virtual void GetFocus() override;
+ virtual void GrabFocus() override;
+ virtual bool HasChildPathFocus() const override;
/** creates the tables page
@param _xConnection
@@ -230,7 +225,8 @@ namespace dbaui
/** get the menu parent window for the given control
*/
- vcl::Window* getMenuParent(weld::TreeView& rControl) const;
+ vcl::Window* getMenuParent() const;
+ void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
/** select all names on the currently selected container. Non existence names where ignored.
*
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index ed7a1c6c861c..23011330a7e8 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/util/URL.hpp>
#include <core_resource.hxx>
#include <vcl/event.hxx>
+#include <vcl/svapp.hxx>
#include "AppDetailPageHelper.hxx"
#include <dbaccess/IController.hxx>
#include <algorithm>
@@ -59,11 +60,6 @@ TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, const char* _pHelpID, const
{
}
-IMPL_LINK(OTasksWindow, KeyInputHdl, const KeyEvent&, rKEvt, bool)
-{
- return ChildKeyInput(rKEvt);
-}
-
void OTasksWindow::updateHelpText()
{
const char* pHelpTextId = nullptr;
@@ -84,14 +80,19 @@ IMPL_LINK(OTasksWindow, onSelected, weld::TreeView&, rTreeView, bool)
return true;
}
-void OTasksWindow::GetFocus()
+void OTasksWindow::GrabFocus()
{
- InterimItemWindow::GetFocus();
if (!m_xTreeView)
return;
+ m_xTreeView->grab_focus();
FocusInHdl(*m_xTreeView);
}
+bool OTasksWindow::HasChildPathFocus() const
+{
+ return m_xTreeView && m_xTreeView->has_focus();
+}
+
IMPL_LINK_NOARG(OTasksWindow, FocusInHdl, weld::Widget&, void)
{
m_xTreeView->select(m_nCursorIndex != -1 ? m_nCursorIndex : 0);
@@ -109,64 +110,39 @@ IMPL_LINK_NOARG(OTasksWindow, OnEntrySelectHdl, weld::TreeView&, void)
updateHelpText();
}
-OTasksWindow::OTasksWindow(vcl::Window* pParent,OApplicationDetailView* _pDetailView)
- : InterimItemWindow(pParent, "dbaccess/ui/taskwindow.ui", "TaskWindow")
+OTasksWindow::OTasksWindow(weld::Container* pParent, OApplicationDetailView* pDetailView)
+ : OChildWindow(pParent, "dbaccess/ui/taskwindow.ui", "TaskWindow")
, m_xTreeView(m_xBuilder->weld_tree_view("treeview"))
, m_xDescription(m_xBuilder->weld_label("description"))
- , m_xHelpText(m_xBuilder->weld_label("helptext"))
- , m_pDetailView(_pDetailView)
+ , m_xHelpText(m_xBuilder->weld_text_view("helptext"))
+ , m_pDetailView(pDetailView)
, m_nCursorIndex(-1)
{
m_xContainer->set_stack_background();
- InitControlBase(m_xTreeView.get());
-
m_xTreeView->set_help_id(HID_APP_CREATION_LIST);
m_xTreeView->connect_row_activated(LINK(this, OTasksWindow, onSelected));
m_xTreeView->connect_changed(LINK(this, OTasksWindow, OnEntrySelectHdl));
- m_xTreeView->connect_key_press(LINK(this, OTasksWindow, KeyInputHdl));
m_xTreeView->connect_focus_in(LINK(this, OTasksWindow, FocusInHdl));
m_xTreeView->connect_focus_out(LINK(this, OTasksWindow, FocusOutHdl));
+ // an arbitrary small size it's allowed to shrink to
+ m_xTreeView->set_size_request(42, 42);
m_xHelpText->set_help_id(HID_APP_HELP_TEXT);
m_xDescription->set_help_id(HID_APP_DESCRIPTION_TEXT);
-
- ImplInitSettings();
}
OTasksWindow::~OTasksWindow()
{
- disposeOnce();
-}
-
-void OTasksWindow::dispose()
-{
Clear();
- m_xTreeView.reset();
- m_xDescription.reset();
- m_xHelpText.reset();
- m_pDetailView.clear();
- InterimItemWindow::dispose();
-}
-
-void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
}
void OTasksWindow::setHelpText(const char* pId)
{
if (pId)
- m_xHelpText->set_label(DBA_RES(pId));
+ m_xHelpText->set_text(DBA_RES(pId));
else
- m_xHelpText->set_label(OUString());
+ m_xHelpText->set_text(OUString());
}
void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
@@ -226,87 +202,32 @@ void OTasksWindow::Clear()
m_xTreeView->clear();
}
-OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent )
- ,m_aHorzSplitter(VclPtr<Splitter>::Create(this))
- ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this, STR_TASKS))
- ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this, nullptr))
- ,m_rBorderWin(_rParent)
+OApplicationDetailView::OApplicationDetailView(weld::Container* pParent, OAppBorderWindow& rBorder,
+ PreviewMode ePreviewMode)
+ : m_xBuilder(Application::CreateBuilder(pParent, "dbaccess/ui/appdetailwindow.ui"))
+ , m_xContainer(m_xBuilder->weld_container("AppDetailWindow"))
+ , m_xHorzSplitter(m_xBuilder->weld_paned("splitter"))
+ , m_xTasksParent(m_xBuilder->weld_container("tasks"))
+ , m_xContainerParent(m_xBuilder->weld_container("container"))
+ , m_xTasks(new dbaui::OTitleWindow(m_xTasksParent.get(), STR_TASKS))
+ , m_xTitleContainer(new dbaui::OTitleWindow(m_xContainerParent.get(), nullptr))
+ , m_rBorderWin(rBorder)
{
- ImplInitSettings();
-
- m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer->getChildContainer(),m_rBorderWin,_ePreviewMode);
- m_pControlHelper->Show();
- m_aContainer->setChildWindow(m_pControlHelper);
-
- VclPtrInstance<OTasksWindow> pTasks(m_aTasks->getChildContainer(),this);
- pTasks->Show();
- pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
- m_aTasks->setChildWindow(pTasks);
- m_aTasks->Show();
+ m_xControlHelper = std::make_shared<OAppDetailPageHelper>(m_xTitleContainer->getChildContainer(), m_rBorderWin, ePreviewMode);
+ m_xTitleContainer->setChildWindow(m_xControlHelper);
- m_aContainer->Show();
-
- const long nFrameWidth = LogicToPixel(Size(3, 0), MapMode(MapUnit::MapAppFont)).Width();
- m_aHorzSplitter->SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) );
- // now set the components at the base class
- set(m_aContainer.get(),m_aTasks.get());
-
- m_aHorzSplitter->Show();
- setSplitter(m_aHorzSplitter.get());
+ std::shared_ptr<OChildWindow> xTasks = std::make_shared<OTasksWindow>(m_xTasks->getChildContainer(), this);
+ xTasks->Enable(!m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
+ m_xTasks->setChildWindow(xTasks);
}
OApplicationDetailView::~OApplicationDetailView()
{
- disposeOnce();
}
-void OApplicationDetailView::dispose()
+void OApplicationDetailView::setTaskExternalMnemonics( MnemonicGenerator const & rMnemonics )
{
- set(nullptr);
- setSplitter(nullptr);
- m_aHorzSplitter.disposeAndClear();
- m_aTasks.disposeAndClear();
- m_aContainer.disposeAndClear();
- m_pControlHelper.clear();
- OSplitterView::dispose();
-}
-
-void OApplicationDetailView::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_aHorzSplitter->SetBackground( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter->SetFillColor( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter->SetTextFillColor(rStyleSettings.GetDialogColor() );
-}
-
-void OApplicationDetailView::DataChanged( const DataChangedEvent& rDCEvt )
-{
- OSplitterView::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OApplicationDetailView::setTaskExternalMnemonics( MnemonicGenerator const & _rMnemonics )
-{
- m_aExternalMnemonics = _rMnemonics;
+ m_aExternalMnemonics = rMnemonics;
}
void OApplicationDetailView::createTablesPage(const Reference< XConnection >& _xConnection )
@@ -331,16 +252,13 @@ void OApplicationDetailView::impl_createPage( ElementType _eType, const Referenc
bool bEnabled = !rData.aTasks.empty()
&& getBorderWin().getView()->getCommandController().isCommandEnabled( rData.aTasks[0].sUNOCommand );
getTasksWindow().Enable( bEnabled );
- m_aContainer->setTitle(rData.pTitleId);
+ m_xTitleContainer->setTitle(rData.pTitleId);
// let our helper create the object list
if ( _eType == E_TABLE )
- m_pControlHelper->createTablesPage( _rxConnection );
+ GetControlHelper()->createTablesPage( _rxConnection );
else
- m_pControlHelper->createPage( _eType, _rxNonTableElements );
-
- // resize for proper window arrangements
- Resize();
+ GetControlHelper()->createPage( _eType, _rxNonTableElements );
}
void OApplicationDetailView::impl_fillTaskPaneData(ElementType _eType, TaskPaneData& _rData) const
@@ -409,7 +327,7 @@ const TaskPaneData& OApplicationDetailView::impl_getTaskPaneData( ElementType _e
OUString OApplicationDetailView::getQualifiedName(weld::TreeIter* _pEntry) const
{
- return m_pControlHelper->getQualifiedName( _pEntry );
+ return GetControlHelper()->getQualifiedName( _pEntry );
}
bool OApplicationDetailView::isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry)
@@ -419,79 +337,84 @@ bool OApplicationDetailView::isLeaf(const weld::TreeView& rTreeView, const weld:
bool OApplicationDetailView::isALeafSelected() const
{
- return m_pControlHelper->isALeafSelected();
+ return GetControlHelper()->isALeafSelected();
}
void OApplicationDetailView::selectAll()
{
- m_pControlHelper->selectAll();
+ GetControlHelper()->selectAll();
}
void OApplicationDetailView::sortDown()
{
- m_pControlHelper->sortDown();
+ GetControlHelper()->sortDown();
}
void OApplicationDetailView::sortUp()
{
- m_pControlHelper->sortUp();
+ GetControlHelper()->sortUp();
}
bool OApplicationDetailView::isFilled() const
{
- return m_pControlHelper->isFilled();
+ return GetControlHelper()->isFilled();
}
ElementType OApplicationDetailView::getElementType() const
{
- return m_pControlHelper->getElementType();
+ return GetControlHelper()->getElementType();
}
void OApplicationDetailView::clearPages(bool _bTaskAlso)
{
if ( _bTaskAlso )
getTasksWindow().Clear();
- m_pControlHelper->clearPages();
+ GetControlHelper()->clearPages();
}
sal_Int32 OApplicationDetailView::getSelectionCount()
{
- return m_pControlHelper->getSelectionCount();
+ return GetControlHelper()->getSelectionCount();
}
sal_Int32 OApplicationDetailView::getElementCount() const
{
- return m_pControlHelper->getElementCount();
+ return GetControlHelper()->getElementCount();
}
void OApplicationDetailView::getSelectionElementNames( std::vector< OUString>& _rNames ) const
{
- m_pControlHelper->getSelectionElementNames( _rNames );
+ GetControlHelper()->getSelectionElementNames( _rNames );
}
void OApplicationDetailView::describeCurrentSelectionForControl(const weld::TreeView& rControl, Sequence< NamedDatabaseObject >& out_rSelectedObjects)
{
- m_pControlHelper->describeCurrentSelectionForControl(rControl, out_rSelectedObjects);
+ GetControlHelper()->describeCurrentSelectionForControl(rControl, out_rSelectedObjects);
}
void OApplicationDetailView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
{
- m_pControlHelper->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
+ GetControlHelper()->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
}
-vcl::Window* OApplicationDetailView::getMenuParent(weld::TreeView& rControl) const
+vcl::Window* OApplicationDetailView::getMenuParent() const
{
- return m_pControlHelper->getMenuParent(rControl);
+ return GetControlHelper()->getMenuParent();
+}
+
+void OApplicationDetailView::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ return GetControlHelper()->adjustMenuPosition(rControl, rPos);
}
void OApplicationDetailView::selectElements(const Sequence< OUString>& _aNames)
{
- m_pControlHelper->selectElements( _aNames );
+ GetControlHelper()->selectElements( _aNames );
}
std::unique_ptr<weld::TreeIter> OApplicationDetailView::getEntry(const Point& rPoint) const
{
- return m_pControlHelper->getEntry(rPoint);
+ return GetControlHelper()->getEntry(rPoint);
}
bool OApplicationDetailView::isCutAllowed()
@@ -514,59 +437,76 @@ void OApplicationDetailView::paste() { }
std::unique_ptr<weld::TreeIter> OApplicationDetailView::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
{
- return m_pControlHelper->elementAdded(_eType, _rName, _rObject);
+ return GetControlHelper()->elementAdded(_eType, _rName, _rObject);
}
void OApplicationDetailView::elementRemoved(ElementType _eType,const OUString& _rName )
{
- m_pControlHelper->elementRemoved(_eType,_rName );
+ GetControlHelper()->elementRemoved(_eType,_rName );
}
void OApplicationDetailView::elementReplaced(ElementType _eType
,const OUString& _rOldName
,const OUString& _rNewName )
{
- m_pControlHelper->elementReplaced( _eType, _rOldName, _rNewName );
+ GetControlHelper()->elementReplaced( _eType, _rOldName, _rNewName );
}
PreviewMode OApplicationDetailView::getPreviewMode() const
{
- return m_pControlHelper->getPreviewMode();
+ return GetControlHelper()->getPreviewMode();
}
bool OApplicationDetailView::isPreviewEnabled() const
{
- return m_pControlHelper->isPreviewEnabled();
+ return GetControlHelper()->isPreviewEnabled();
}
void OApplicationDetailView::switchPreview(PreviewMode _eMode)
{
- m_pControlHelper->switchPreview(_eMode);
+ GetControlHelper()->switchPreview(_eMode);
}
void OApplicationDetailView::showPreview(const Reference< XContent >& _xContent)
{
- m_pControlHelper->showPreview(_xContent);
+ GetControlHelper()->showPreview(_xContent);
}
void OApplicationDetailView::showPreview( const OUString& _sDataSourceName,
const OUString& _sName,
bool _bTable)
{
- m_pControlHelper->showPreview(_sDataSourceName,_sName,_bTable);
+ GetControlHelper()->showPreview(_sDataSourceName,_sName,_bTable);
}
bool OApplicationDetailView::isSortUp() const
{
- return m_pControlHelper->isSortUp();
+ return GetControlHelper()->isSortUp();
}
TreeListBox* OApplicationDetailView::getTreeWindow() const
{
- DBTreeViewBase* pCurrent = m_pControlHelper->getCurrentView();
+ DBTreeViewBase* pCurrent = GetControlHelper()->getCurrentView();
if (!pCurrent)
return nullptr;
return &pCurrent->getListBox();
}
+OAppDetailPageHelper* OApplicationDetailView::GetControlHelper()
+{
+ return static_cast<OAppDetailPageHelper*>(m_xControlHelper.get());
+}
+
+const OAppDetailPageHelper* OApplicationDetailView::GetControlHelper() const
+{
+ return static_cast<const OAppDetailPageHelper*>(m_xControlHelper.get());
+}
+
+bool OApplicationDetailView::HasChildPathFocus() const
+{
+ return m_xHorzSplitter->has_focus() ||
+ m_xTasks->HasChildPathFocus() ||
+ m_xTitleContainer->HasChildPathFocus();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
index a74a496c5ca9..592b6e3f344e 100644
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ b/dbaccess/source/ui/app/AppDetailView.hxx
@@ -23,8 +23,6 @@
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
-#include <vcl/split.hxx>
-#include <vcl/InterimItemWindow.hxx>
#include <vcl/mnemonic.hxx>
#include <IClipBoardTest.hxx>
#include "AppTitleWindow.hxx"
@@ -63,30 +61,29 @@ namespace dbaui
const char* pTitleId;
};
- class OTasksWindow final : public InterimItemWindow
+ class OTasksWindow final : public OChildWindow
{
std::unique_ptr<weld::TreeView> m_xTreeView;
std::unique_ptr<weld::Label> m_xDescription;
- std::unique_ptr<weld::Label> m_xHelpText;
- VclPtr<OApplicationDetailView> m_pDetailView;
+ std::unique_ptr<weld::TextView> m_xHelpText;
+ OApplicationDetailView* m_pDetailView;
int m_nCursorIndex;
DECL_LINK(onSelected, weld::TreeView&, bool);
DECL_LINK(OnEntrySelectHdl, weld::TreeView&, void);
- DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
DECL_LINK(FocusInHdl, weld::Widget&, void);
DECL_LINK(FocusOutHdl, weld::Widget&, void);
void updateHelpText();
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
public:
- OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView);
- virtual ~OTasksWindow() override;
- virtual void dispose() override;
+ OTasksWindow(weld::Container* pParent, OApplicationDetailView* pDetailView);
+ ~OTasksWindow();
- virtual void GetFocus() override;
+ virtual void GrabFocus() override;
+
+ virtual bool HasChildPathFocus() const override;
OApplicationDetailView* getDetailView() const { return m_pDetailView; }
@@ -97,27 +94,26 @@ namespace dbaui
void setHelpText(const char* pId);
};
- class OApplicationDetailView : public OSplitterView
- , public IClipboardTest
+ class OApplicationDetailView final : public IClipboardTest
{
- VclPtr<Splitter> m_aHorzSplitter;
- VclPtr<OTitleWindow> m_aTasks;
- VclPtr<OTitleWindow> m_aContainer;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Paned> m_xHorzSplitter;
+ std::unique_ptr<weld::Container> m_xTasksParent;
+ std::unique_ptr<weld::Container> m_xContainerParent;
+ std::unique_ptr<OTitleWindow> m_xTasks;
+ std::unique_ptr<OTitleWindow> m_xTitleContainer;
OAppBorderWindow& m_rBorderWin; // my parent
- VclPtr<OAppDetailPageHelper> m_pControlHelper;
- std::vector< TaskPaneData > m_aTaskPaneData;
+ std::shared_ptr<OChildWindow> m_xControlHelper;
+ std::vector< TaskPaneData > m_aTaskPaneData;
MnemonicGenerator m_aExternalMnemonics;
- void ImplInitSettings();
-
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+ const OAppDetailPageHelper* GetControlHelper() const;
+ OAppDetailPageHelper* GetControlHelper();
public:
- OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode);
- virtual ~OApplicationDetailView() override;
- // Window overrides
- virtual void dispose() override;
+ OApplicationDetailView(weld::Container* pParent, OAppBorderWindow& rBorder, PreviewMode ePreviewMode);
+ ~OApplicationDetailView();
/** creates the tables page
@param _xConnection
@@ -136,7 +132,7 @@ namespace dbaui
void setTaskExternalMnemonics( MnemonicGenerator const & _rMnemonics );
OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
- OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks->getChildWindow() ); }
+ OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_xTasks->getChildWindow() ); }
bool isCutAllowed() override ;
bool isCopyAllowed() override ;
@@ -223,7 +219,8 @@ namespace dbaui
/** get the menu parent window for the given control
*/
- vcl::Window* getMenuParent(weld::TreeView& rControl) const;
+ vcl::Window* getMenuParent() const;
+ void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
/** select all names on the currently selected container. Non existence names where ignored.
*
@@ -306,6 +303,8 @@ namespace dbaui
std::unique_ptr<weld::TreeIter> getEntry(const Point& rPosPixel) const;
TreeListBox* getTreeWindow() const;
+
+ bool HasChildPathFocus() const;
private:
void impl_createPage(
ElementType _eType,
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index 9ab50e8a0b4c..c6b13a0a44b9 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -23,6 +23,7 @@
#include <vcl/event.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
#include "AppController.hxx"
using namespace ::dbaui;
@@ -31,68 +32,37 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
-OApplicationSwapWindow::OApplicationSwapWindow(vcl::Window* pParent, OAppBorderWindow& rBorderWindow)
- : InterimItemWindow(pParent, "dbaccess/ui/appswapwindow.ui", "AppSwapWindow")
+OApplicationSwapWindow::OApplicationSwapWindow(weld::Container* pParent, OAppBorderWindow& rBorderWindow)
+ : OChildWindow(pParent, "dbaccess/ui/appswapwindow.ui", "AppSwapWindow")
, m_xIconControl(new OApplicationIconControl(m_xBuilder->weld_scrolled_window("scroll")))
, m_xIconControlWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xIconControl))
, m_eLastType(E_NONE)
, m_rBorderWin(rBorderWindow)
+ , m_nChangeEvent(nullptr)
{
m_xContainer->set_stack_background();
- ImplInitSettings();
-
m_xIconControl->SetHelpId(HID_APP_SWAP_ICONCONTROL);
m_xIconControl->Fill();
m_xIconControl->setItemStateHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
m_xIconControl->setControlActionListener( &m_rBorderWin.getView()->getAppController() );
}
-void OApplicationSwapWindow::GetFocus()
+void OApplicationSwapWindow::GrabFocus()
{
if (m_xIconControl)
m_xIconControl->GrabFocus();
- InterimItemWindow::GetFocus();
}
-OApplicationSwapWindow::~OApplicationSwapWindow()
+bool OApplicationSwapWindow::HasChildPathFocus() const
{
- disposeOnce();
+ return m_xIconControl && m_xIconControl->HasFocus();
}
-void OApplicationSwapWindow::dispose()
-{
- m_xIconControlWin.reset();
- m_xIconControl.reset();
- InterimItemWindow::dispose();
-}
-
-void OApplicationSwapWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-
-void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt )
+OApplicationSwapWindow::~OApplicationSwapWindow()
{
- Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
+ if (m_nChangeEvent)
+ Application::RemoveUserEvent(m_nChangeEvent);
}
void OApplicationSwapWindow::clearSelection()
@@ -132,7 +102,8 @@ bool OApplicationSwapWindow::onContainerSelected( ElementType _eType )
return true;
}
- PostUserEvent( LINK( this, OApplicationSwapWindow, ChangeToLastSelected ), nullptr, true );
+ if (!m_nChangeEvent)
+ m_nChangeEvent = Application::PostUserEvent(LINK(this, OApplicationSwapWindow, ChangeToLastSelected));
return false;
}
@@ -147,6 +118,7 @@ IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, const ThumbnailViewItem*
IMPL_LINK_NOARG(OApplicationSwapWindow, ChangeToLastSelected, void*, void)
{
+ m_nChangeEvent = nullptr;
selectContainer(m_eLastType);
}
diff --git a/dbaccess/source/ui/app/AppSwapWindow.hxx b/dbaccess/source/ui/app/AppSwapWindow.hxx
index b63d563e496b..fadfb6fb3ccc 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.hxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.hxx
@@ -20,36 +20,33 @@
#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPSWAPWINDOW_HXX
#include <IClipBoardTest.hxx>
-#include <vcl/InterimItemWindow.hxx>
-#include <vcl/vclptr.hxx>
#include "AppIconControl.hxx"
#include <AppElementType.hxx>
+#include "ChildWindow.hxx"
class MnemonicGenerator;
namespace dbaui
{
class OAppBorderWindow;
- class OApplicationSwapWindow : public InterimItemWindow
+ class OApplicationSwapWindow : public OChildWindow
, public IClipboardTest
{
std::unique_ptr<OApplicationIconControl> m_xIconControl;
std::unique_ptr<weld::CustomWeld> m_xIconControlWin;
ElementType m_eLastType;
OAppBorderWindow& m_rBorderWin;
-
- void ImplInitSettings();
+ ImplSVEvent* m_nChangeEvent;
DECL_LINK( OnContainerSelectHdl, const ThumbnailViewItem*, void );
DECL_LINK( ChangeToLastSelected, void*, void );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
+
public:
- OApplicationSwapWindow(vcl::Window* pParent, OAppBorderWindow& rBorderWindow);
+ OApplicationSwapWindow(weld::Container* pParent, OAppBorderWindow& rBorderWindow);
virtual ~OApplicationSwapWindow() override;
- // Window overrides
- virtual void dispose() override;
- virtual void GetFocus() override;
+
+ virtual void GrabFocus() override;
+ virtual bool HasChildPathFocus() const override;
bool isCutAllowed() override { return false; }
bool isCopyAllowed() override { return false; }
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index 3231d020e42a..dbe4e77abd53 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -28,47 +28,32 @@
namespace dbaui
{
-OTitleWindow::OTitleWindow(vcl::Window* pParent, const char* pTitleId)
- : InterimItemWindow(pParent, "dbaccess/ui/titlewindow.ui", "TitleWindow")
+OTitleWindow::OTitleWindow(weld::Container* pParent, const char* pTitleId)
+ : m_xBuilder(Application::CreateBuilder(pParent, "dbaccess/ui/titlewindow.ui"))
+ , m_xContainer(m_xBuilder->weld_container("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);
- ImplInitSettings();
+ m_xContainer->set_stack_background();
m_xTitleFrame->set_title_background();
m_xTitle->set_label_type(weld::LabelType::Title);
}
OTitleWindow::~OTitleWindow()
{
- disposeOnce();
}
-void OTitleWindow::dispose()
+weld::Container* OTitleWindow::getChildContainer()
{
- 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();
-}
-
-vcl::Window* OTitleWindow::getChildContainer()
-{
- return VCLUnoHelper::GetWindow(m_xChildParent);
+ return m_xChildContainer.get();
}
-void OTitleWindow::setChildWindow(vcl::Window* pChild)
+void OTitleWindow::setChildWindow(std::shared_ptr<OChildWindow>& rChild)
{
- m_xChild = pChild;
+ m_xChild = rChild;
}
void OTitleWindow::setTitle(const char* pTitleId)
@@ -78,74 +63,15 @@ void OTitleWindow::setTitle(const char* pTitleId)
m_xTitle->set_label(DBA_RES(pTitleId));
}
-void OTitleWindow::GetFocus()
+void OTitleWindow::GrabFocus()
{
- InterimItemWindow::GetFocus();
if (m_xChild)
m_xChild->GrabFocus();
}
-long OTitleWindow::GetWidthPixel() const
+bool OTitleWindow::HasChildPathFocus() const
{
- Size aTextSize = LogicToPixel(Size(12, 0), MapMode(MapUnit::MapAppFont));
- sal_Int32 nWidth = GetTextWidth(m_xTitle->get_label()) + 2*aTextSize.Width();
-
- return nWidth;
-}
-
-void OTitleWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OTitleWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- AllSettings aAllSettings = GetSettings();
- StyleSettings aStyle = aAllSettings.GetStyleSettings();
- aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
- aAllSettings.SetStyleSettings(aStyle);
- SetSettings(aAllSettings);
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-
-void OTitleWindow::ApplySettings(vcl::RenderContext& rRenderContext)
-{
- // FIXME RenderContext
- AllSettings aAllSettings = rRenderContext.GetSettings();
- StyleSettings aStyle = aAllSettings.GetStyleSettings();
- aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
- aAllSettings.SetStyleSettings(aStyle);
- rRenderContext.SetSettings(aAllSettings);
-
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor(rStyleSettings.GetWindowTextColor());
- SetPointFont(*this, aFont);
-
- rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
- rRenderContext.SetTextFillColor();
-
- rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
+ return m_xChild && m_xChild->HasChildPathFocus();
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx
index dcef39575cf0..2c536bfd2a93 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.hxx
@@ -19,58 +19,48 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
-#include <vcl/InterimItemWindow.hxx>
+#include "ChildWindow.hxx"
namespace dbaui
{
- class OTitleWindow final : public InterimItemWindow
+ class OTitleWindow final
{
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
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();
+ std::shared_ptr<OChildWindow> m_xChild;
- virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
public:
- OTitleWindow(vcl::Window* pParent, const char* pTitleId);
- virtual ~OTitleWindow() override;
- virtual void dispose() override;
+ OTitleWindow(weld::Container* pParent, const char* pTitleId);
+ ~OTitleWindow();
- // Window overrides
- virtual void GetFocus() override;
+ void GrabFocus();
- virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+ bool HasChildPathFocus() const;
/** gets the window which should be used as a child's parent */
- vcl::Window* getChildContainer();
+ weld::Container* getChildContainer();
/** sets the child window which should be displayed below the title. It will be destroyed at the end.
@param _pChild
The child window.
*/
- void setChildWindow(vcl::Window* _pChild);
+ void setChildWindow(std::shared_ptr<OChildWindow>& rChild);
/** gets the child window.
@return
The child window.
*/
- vcl::Window* getChildWindow() const { return m_xChild; }
+ OChildWindow* getChildWindow() const { return m_xChild.get(); }
/** sets the title text out of the resource
@param pTitleId
The resource id of the title text.
*/
void setTitle(const char* pTitleId);
-
- /** Gets the min Width in Pixel which is needed to display the whole
-
- @return
- the min width
- */
- long GetWidthPixel() const;
};
} // namespace dbaui
#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPTITLEWINDOW_HXX
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index c6770a1eafd9..59ba64f0b0ea 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -42,24 +42,20 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using ::com::sun::star::sdb::application::NamedDatabaseObject;
-OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
- ,m_pPanel(nullptr)
- ,m_pDetailView(nullptr)
- ,m_pView(_pParent)
+OAppBorderWindow::OAppBorderWindow(OApplicationView* pParent, PreviewMode ePreviewMode)
+ : InterimItemWindow(pParent, "dbaccess/ui/appborderwindow.ui", "AppBorderWindow", false)
+ , m_xPanelParent(m_xBuilder->weld_container("panel"))
+ , m_xDetailViewParent(m_xBuilder->weld_container("detail"))
+ , m_xView(pParent)
{
+ SetStyle(GetStyle() | WB_DIALOGCONTROL);
- SetBorderStyle(WindowBorderStyle::MONO);
+ m_xPanel.reset(new OTitleWindow(m_xPanelParent.get(), STR_DATABASE));
+ std::shared_ptr<OChildWindow> xSwap = std::make_shared<OApplicationSwapWindow>(m_xPanel->getChildContainer(), *this);
- m_pPanel = VclPtr<OTitleWindow>::Create(this, STR_DATABASE);
- m_pPanel->SetBorderStyle(WindowBorderStyle::MONO);
- VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel->getChildContainer(), *this );
- pSwap->Show();
+ m_xPanel->setChildWindow(xSwap);
- m_pPanel->setChildWindow(pSwap);
- m_pPanel->Show();
-
- m_pDetailView = VclPtr<OApplicationDetailView>::Create(*this,_ePreviewMode);
- m_pDetailView->Show();
+ m_xDetailView.reset(new OApplicationDetailView(m_xDetailViewParent.get(), *this, ePreviewMode));
ImplInitSettings();
}
@@ -72,81 +68,25 @@ OAppBorderWindow::~OAppBorderWindow()
void OAppBorderWindow::dispose()
{
// destroy children
- if ( m_pPanel )
- m_pPanel->Hide();
- m_pPanel.disposeAndClear();
- if ( m_pDetailView )
- m_pDetailView->Hide();
- m_pDetailView.disposeAndClear();
- m_pView.clear();
- vcl::Window::dispose();
+ m_xPanel.reset();
+ m_xDetailView.reset();
+ m_xPanelParent.reset();
+ m_xDetailViewParent.reset();
+ m_xView.clear();
+ InterimItemWindow::dispose();
}
void OAppBorderWindow::GetFocus()
{
- if ( m_pPanel )
- m_pPanel->GrabFocus();
-}
-
-void OAppBorderWindow::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
- long nX = 0;
-
- Size aFLSize = LogicToPixel(Size(3, 8), MapMode(MapUnit::MapAppFont));
- if ( m_pPanel )
- {
- OApplicationSwapWindow* pSwap = getPanel();
- if (pSwap)
- nX = pSwap->get_preferred_size().Width();
- nX = std::max(m_pPanel->GetWidthPixel() ,nX);
- m_pPanel->SetPosSizePixel(Point(0,0),Size(nX,nOutputHeight));
- }
-
- if ( m_pDetailView )
- m_pDetailView->SetPosSizePixel(Point(nX + aFLSize.Width(),0),Size(nOutputWidth - nX - aFLSize.Width(),nOutputHeight));
+ if (m_xPanel)
+ m_xPanel->GrabFocus();
}
-void OAppBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
- (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
- (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-void OAppBorderWindow::ImplInitSettings()
-{
- // FIXME RenderContext
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont(*this, aFont);
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
-
- SetBackground( rStyleSettings.GetDialogColor() );
-}
-
-
OApplicationSwapWindow* OAppBorderWindow::getPanel() const
{
- return static_cast< OApplicationSwapWindow* >( m_pPanel->getChildWindow() );
+ return static_cast<OApplicationSwapWindow*>(m_xPanel->getChildWindow());
}
-
OApplicationView::OApplicationView( vcl::Window* pParent
,const Reference< XComponentContext >& _rxOrb
,OApplicationController& _rAppController
@@ -154,7 +94,6 @@ OApplicationView::OApplicationView( vcl::Window* pParent
) :
ODataView( pParent, _rAppController, _rxOrb, WB_DIALOGCONTROL )
,m_rAppController( _rAppController )
- ,m_eChildFocus(NONE)
{
m_pWin = VclPtr<OAppBorderWindow>::Create(this,_ePreviewMode);
m_pWin->Show();
@@ -219,18 +158,22 @@ void OApplicationView::resizeDocumentView(tools::Rectangle& _rPlayground)
_rPlayground.SetSize( Size( 0, 0 ) );
}
+OApplicationView::ChildFocusState OApplicationView::getChildFocus() const
+{
+ ChildFocusState eChildFocus;
+ if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
+ eChildFocus = PANELSWAP;
+ else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
+ eChildFocus = DETAIL;
+ else
+ eChildFocus = NONE;
+ return eChildFocus;
+}
+
bool OApplicationView::PreNotify( NotifyEvent& rNEvt )
{
switch(rNEvt.GetType())
{
- case MouseNotifyEvent::GETFOCUS:
- if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
- m_eChildFocus = PANELSWAP;
- else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
- m_eChildFocus = DETAIL;
- else
- m_eChildFocus = NONE;
- break;
case MouseNotifyEvent::KEYINPUT:
{
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
@@ -250,7 +193,7 @@ bool OApplicationView::PreNotify( NotifyEvent& rNEvt )
IClipboardTest* OApplicationView::getActiveChild() const
{
IClipboardTest* pTest = nullptr;
- if ( DETAIL == m_eChildFocus )
+ if (getChildFocus() == DETAIL)
pTest = getDetailView();
return pTest;
}
@@ -372,10 +315,16 @@ void OApplicationView::describeCurrentSelectionForControl(const weld::TreeView&
getDetailView()->describeCurrentSelectionForControl(rControl, out_rSelectedObjects);
}
-vcl::Window* OApplicationView::getMenuParent(weld::TreeView& rControl) const
+vcl::Window* OApplicationView::getMenuParent() const
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getMenuParent(rControl);
+ return getDetailView()->getMenuParent();
+}
+
+void OApplicationView::adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const
+{
+ OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
+ return getDetailView()->adjustMenuPosition(rControl, rPos);
}
void OApplicationView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
@@ -496,10 +445,8 @@ void OApplicationView::showPreview( const OUString& _sDataSourceName,
void OApplicationView::GetFocus()
{
- if ( m_eChildFocus == NONE && m_pWin )
- {
+ if (m_pWin && getChildFocus() == NONE)
m_pWin->GrabFocus();
- }
}
void OApplicationView::_disposing( const css::lang::EventObject& /*_rSource*/ )
diff --git a/dbaccess/source/ui/app/AppView.hxx b/dbaccess/source/ui/app/AppView.hxx
index c4a747294497..5752d1d124d4 100644
--- a/dbaccess/source/ui/app/AppView.hxx
+++ b/dbaccess/source/ui/app/AppView.hxx
@@ -24,17 +24,14 @@
#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <unotools/eventlisteneradapter.hxx>
+#include <vcl/InterimItemWindow.hxx>
+#include <vcl/weld.hxx>
#include <IClipBoardTest.hxx>
#include <AppElementType.hxx>
namespace com::sun::star::beans { class XPropertySet; }
class Control;
-namespace weld
-{
- class TreeIter;
- class TreeView;
-}
class MnemonicGenerator;
namespace dbaui
@@ -45,28 +42,26 @@ namespace dbaui
class OTitleWindow;
class OApplicationController;
- class OAppBorderWindow : public vcl::Window
+ class OAppBorderWindow final : public InterimItemWindow
{
- VclPtr<OTitleWindow> m_pPanel;
- VclPtr<OApplicationDetailView> m_pDetailView;
- VclPtr<OApplicationView> m_pView;
+ std::unique_ptr<weld::Container> m_xPanelParent;
+ std::unique_ptr<weld::Container> m_xDetailViewParent;
+ std::unique_ptr<OTitleWindow> m_xPanel;
+ std::unique_ptr<OApplicationDetailView> m_xDetailView;
+ VclPtr<OApplicationView> m_xView;
- void ImplInitSettings();
- protected:
- // Window
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public:
- OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
+ OAppBorderWindow(OApplicationView* pParent, PreviewMode ePreviewMode);
virtual ~OAppBorderWindow() override;
virtual void dispose() override;
// Window overrides
virtual void GetFocus() override;
- virtual void Resize() override;
- OApplicationView* getView() const { return m_pView;}
+ OApplicationView* getView() const { return m_xView.get(); }
OApplicationSwapWindow* getPanel() const;
- OApplicationDetailView* getDetailView() const { return m_pDetailView;}
+ OApplicationDetailView* getDetailView() const { return m_xDetailView.get(); }
+ weld::Container& getTopLevel() { return *m_xContainer; }
};
class OApplicationView : public ODataView
@@ -84,8 +79,8 @@ namespace dbaui
m_xObject;
VclPtr<OAppBorderWindow> m_pWin;
OApplicationController& m_rAppController;
- ChildFocusState m_eChildFocus;
+ ChildFocusState getChildFocus() const;
IClipboardTest* getActiveChild() const;
void ImplInitSettings();
@@ -210,7 +205,10 @@ namespace dbaui
/** get the menu parent window for the given control
*/
- vcl::Window* getMenuParent(weld::TreeView& rControl) const;
+ vcl::Window* getMenuParent() const;
+
+ /** adjust rPos relative to rControl to instead relative to getMenuParent */
+ void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
/** select all names on the currently selected container. Non existence names where ignored.
*
diff --git a/dbaccess/source/ui/app/ChildWindow.cxx b/dbaccess/source/ui/app/ChildWindow.cxx
new file mode 100644
index 000000000000..879b5f84a387
--- /dev/null
+++ b/dbaccess/source/ui/app/ChildWindow.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/svapp.hxx>
+#include "ChildWindow.hxx"
+
+namespace dbaui
+{
+OChildWindow::OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription,
+ const OString& rID)
+ : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
+ , m_xContainer(m_xBuilder->weld_container(rID))
+{
+}
+
+OChildWindow::~OChildWindow() {}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/dbaccess/source/ui/app/ChildWindow.hxx b/dbaccess/source/ui/app/ChildWindow.hxx
new file mode 100644
index 000000000000..5b9906142f94
--- /dev/null
+++ b/dbaccess/source/ui/app/ChildWindow.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+class OChildWindow
+{
+protected:
+ OChildWindow(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID);
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+public:
+ virtual ~OChildWindow();
+
+ virtual void GrabFocus() = 0;
+
+ virtual bool HasChildPathFocus() const = 0;
+
+ void Enable(bool bEnable) { m_xContainer->set_sensitive(bEnable); }
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */