diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk index 874c1cff4e9c..c87e39c77001 100644 --- a/basctl/UIConfig_basicide.mk +++ b/basctl/UIConfig_basicide.mk @@ -40,6 +40,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\ basctl/uiconfig/basicide/ui/defaultlanguage \ basctl/uiconfig/basicide/ui/deletelangdialog \ basctl/uiconfig/basicide/ui/dialogpage \ + basctl/uiconfig/basicide/ui/dockingorganizer \ basctl/uiconfig/basicide/ui/exportdialog \ basctl/uiconfig/basicide/ui/gotolinedialog \ basctl/uiconfig/basicide/ui/importlibdialog \ diff --git a/basctl/source/basicide/ObjectCatalog.cxx b/basctl/source/basicide/ObjectCatalog.cxx index 0a32d327f860..3c06ddb5201e 100644 --- a/basctl/source/basicide/ObjectCatalog.cxx +++ b/basctl/source/basicide/ObjectCatalog.cxx @@ -24,40 +24,35 @@ #include #include +#include +#include namespace basctl { ObjectCatalog::ObjectCatalog(vcl::Window* pParent) - : DockingWindow(pParent) - , aTitle(VclPtr::Create(this)) - , aTree(VclPtr::Create(this, WB_TABSTOP)) + : DockingWindow(pParent, "DockingWindow", "sfx/ui/dockingwindow.ui") { + m_xVclContentArea = VclPtr::Create(this); + m_xVclContentArea->Show(); + m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, + "modules/BasicIDE/ui/dockingorganizer.ui")); + m_xContainer = m_xBuilder->weld_container("DockingOrganizer"); + + m_xTitle = m_xBuilder->weld_label("title"); + m_xTree.reset(new SbTreeListBox(m_xBuilder->weld_tree_view("libraries"), GetFrameWeld())); + SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT"); SetText(IDEResId(RID_BASICIDE_OBJCAT)); // title - aTitle->SetText(IDEResId(RID_BASICIDE_OBJCAT)); - aTitle->SetStyle(WB_CENTER); + m_xTitle->set_label(IDEResId(RID_BASICIDE_OBJCAT)); // tree list - aTree->Hide(); - aTree->SetStyle(WB_BORDER | WB_TABSTOP | WB_HSCROLL | WB_HASLINES | WB_HASLINESATROOT - | WB_HASBUTTONS | WB_HASBUTTONSATROOT); - aTree->SetAccessibleName(IDEResId(RID_STR_TLB_MACROS)); - aTree->SetHelpId(HID_BASICIDE_OBJECTCAT); - aTree->ScanAllEntries(); - aTree->GrabFocus(); + weld::TreeView& rWidget = m_xTree->get_widget(); - { - // centered after AppWin: - Window const& rParent = *GetParent(); - Point aPos = rParent.OutputToScreenPixel(Point(0, 0)); - Size const aParentSize = rParent.GetSizePixel(); - Size const aSize = GetSizePixel(); - aPos.AdjustX((aParentSize.Width() - aSize.Width()) / 2); - aPos.AdjustY((aParentSize.Height() - aSize.Height()) / 2); - SetPosPixel(aPos); - } + rWidget.set_help_id(HID_BASICIDE_OBJECTCAT); + m_xTree->ScanAllEntries(); + rWidget.grab_focus(); // make object catalog keyboard accessible GetParent()->GetSystemWindow()->GetTaskPaneList()->AddWindow(this); @@ -69,60 +64,22 @@ void ObjectCatalog::dispose() { if (!IsDisposed()) GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this); - aTitle.disposeAndClear(); - aTree.disposeAndClear(); + m_xTitle.reset(); + m_xTree.reset(); + m_xContainer.reset(); + m_xBuilder.reset(); + m_xVclContentArea.disposeAndClear(); DockingWindow::dispose(); } -// Resize() -- called by Window -void ObjectCatalog::Resize() -{ - // arranging the controls - ArrangeWindows(); -} - // ToggleFloatingMode() -- called by DockingWindow when IsFloatingMode() changes void ObjectCatalog::ToggleFloatingMode() { // base class version DockingWindow::ToggleFloatingMode(); - // rearranging the controls (title) - ArrangeWindows(); -} -// ArrangeWindows() -- arranges the controls to the size of the ObjectCatalog -void ObjectCatalog::ArrangeWindows() -{ - if (!aTitle || !aTree) - return; - - Size const aSize = GetOutputSizePixel(); bool const bFloating = IsFloatingMode(); - - // title - // (showing only if no title bar) - if (bFloating) - aTitle->Hide(); - else - { - Size aTitleSize = LogicToPixel(Size(3, 10), MapMode(MapUnit::MapAppFont)); - aTitleSize.setWidth(aSize.Width() - 2 * aTitleSize.Width()); - aTitle->SetPosPixel(LogicToPixel(Point(3, 3), MapMode(MapUnit::MapAppFont))); - aTitle->SetSizePixel(aTitleSize); - aTitle->Show(); - } - - // tree - Point const aTreePos = LogicToPixel(Point(3, bFloating ? 3 : 16), MapMode(MapUnit::MapAppFont)); - long const nMargin = aTreePos.X(); - Size const aTreeSize(aSize.Width() - 2 * nMargin, aSize.Height() - aTreePos.Y() - nMargin); - if (aTreeSize.Height() > 0) - { - aTree->SetPosSizePixel(aTreePos, aTreeSize); - aTree->Show(); - } - else - aTree->Hide(); + m_xTitle->set_visible(!bFloating); } void ObjectCatalog::SetCurrentEntry(BaseWindow* pCurWin) @@ -130,7 +87,7 @@ void ObjectCatalog::SetCurrentEntry(BaseWindow* pCurWin) EntryDescriptor aDescriptor; if (pCurWin) aDescriptor = pCurWin->CreateEntryDescriptor(); - aTree->SetCurrentEntry(aDescriptor); + m_xTree->SetCurrentEntry(aDescriptor); } } // namespace basctl diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index e79452377198..6c54d770ee58 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -261,6 +261,12 @@ DockingWindow::DockingWindow (vcl::Window* pParent) : nShowCount(0) { } +DockingWindow::DockingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription) : + ::DockingWindow(pParent, rID, rUIXMLDescription), + pLayout(nullptr), + nShowCount(0) +{ } + DockingWindow::DockingWindow (Layout* pParent) : ::DockingWindow(pParent, StyleBits), pLayout(pParent), diff --git a/basctl/source/inc/ObjectCatalog.hxx b/basctl/source/inc/ObjectCatalog.hxx index fbe37f249306..e18a37fdfa0c 100644 --- a/basctl/source/inc/ObjectCatalog.hxx +++ b/basctl/source/inc/ObjectCatalog.hxx @@ -23,7 +23,7 @@ #include "bastype2.hxx" #include "bastypes.hxx" -#include +#include namespace basctl { @@ -42,23 +42,22 @@ public: virtual void dispose() override; /// Update the entries of Object Catalog Treelist - void UpdateEntries() { aTree->UpdateEntries(); } + void UpdateEntries() { m_xTree->UpdateEntries(); } void SetCurrentEntry(BaseWindow* pCurWin); private: - VclPtr aTitle; ///< Title of the Object Catalog window - VclPtr aTree; ///< The Treelist of the objects in window + std::unique_ptr m_xBuilder; + VclPtr m_xVclContentArea; + std::unique_ptr m_xContainer; + + std::unique_ptr m_xTitle; ///< Title of the Object Catalog window + std::unique_ptr m_xTree; ///< The Treelist of the objects in window - /// Function is called by Window. Use only for arranging the controls. - virtual void Resize() override; /*! * Function for resize by DockingWindow. * It is called by DockingWindow when IsFloatingMode() changes. */ virtual void ToggleFloatingMode() override; - - /// Uses by Resize() and ToggleFloatingMode() functions for resizing - void ArrangeWindows(); }; } // namespace basctl diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index fcebade1d7af..58e007bf6268 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -81,6 +81,7 @@ class DockingWindow : public ::DockingWindow { public: DockingWindow (vcl::Window* pParent); + DockingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription); DockingWindow (Layout* pParent); virtual ~DockingWindow() override; virtual void dispose() override; diff --git a/basctl/uiconfig/basicide/ui/basicmacrodialog.ui b/basctl/uiconfig/basicide/ui/basicmacrodialog.ui index e806ad30eeaa..e9ee0ba54bc2 100644 --- a/basctl/uiconfig/basicide/ui/basicmacrodialog.ui +++ b/basctl/uiconfig/basicide/ui/basicmacrodialog.ui @@ -201,7 +201,6 @@ in - -1 True True True @@ -210,7 +209,6 @@ liststore1 False 1 - True True diff --git a/basctl/uiconfig/basicide/ui/dockingorganizer.ui b/basctl/uiconfig/basicide/ui/dockingorganizer.ui new file mode 100644 index 000000000000..94144738c1a5 --- /dev/null +++ b/basctl/uiconfig/basicide/ui/dockingorganizer.ui @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + True + False + True + True + 6 + 12 + + + True + True + True + True + in + + + True + True + True + True + True + liststore1 + False + 1 + True + + + + + + 6 + + + + 0 + + + + + + 1 + + + + + + + + + 0 + 1 + + + + + True + False + True + libraries + + + 0 + 0 + + + +