diff options
-rw-r--r-- | basctl/UIConfig_basicide.mk | 1 | ||||
-rw-r--r-- | basctl/source/basicide/ObjectCatalog.cxx | 93 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 6 | ||||
-rw-r--r-- | basctl/source/inc/ObjectCatalog.hxx | 17 | ||||
-rw-r--r-- | basctl/source/inc/bastypes.hxx | 1 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/ui/basicmacrodialog.ui | 2 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/ui/dockingorganizer.ui | 81 |
7 files changed, 122 insertions, 79 deletions
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 <helpids.h> #include <vcl/taskpanelist.hxx> +#include <vcl/svapp.hxx> +#include <vcl/layout.hxx> namespace basctl { ObjectCatalog::ObjectCatalog(vcl::Window* pParent) - : DockingWindow(pParent) - , aTitle(VclPtr<FixedText>::Create(this)) - , aTree(VclPtr<TreeListBox>::Create(this, WB_TABSTOP)) + : DockingWindow(pParent, "DockingWindow", "sfx/ui/dockingwindow.ui") { + m_xVclContentArea = VclPtr<VclVBox>::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(); - - { - // 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); - } + weld::TreeView& rWidget = m_xTree->get_widget(); + + 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 <vcl/fixed.hxx> +#include <vcl/weld.hxx> 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<FixedText> aTitle; ///< Title of the Object Catalog window - VclPtr<TreeListBox> aTree; ///< The Treelist of the objects in window + std::unique_ptr<weld::Builder> m_xBuilder; + VclPtr<vcl::Window> m_xVclContentArea; + std::unique_ptr<weld::Container> m_xContainer; + + std::unique_ptr<weld::Label> m_xTitle; ///< Title of the Object Catalog window + std::unique_ptr<SbTreeListBox> 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 @@ <property name="shadow_type">in</property> <child> <object class="GtkTreeView" id="libraries"> - <property name="width_request">-1</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -210,7 +209,6 @@ <property name="model">liststore1</property> <property name="headers_visible">False</property> <property name="search_column">1</property> - <property name="show_expanders">True</property> <property name="enable_tree_lines">True</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="Macro Library List-selection1"/> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="basctl"> + <requires lib="gtk+" version="3.0"/> + <object class="GtkTreeStore" id="liststore1"> + <columns> + <!-- column-name expander --> + <column type="GdkPixbuf"/> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkGrid" id="DockingOrganizer"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="libraries"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="search_column">1</property> + <property name="enable_tree_lines">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <property name="spacing">6</property> + <child> + <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/> + <attributes> + <attribute name="pixbuf">0</attribute> + </attributes> + </child> + <child> + <object class="GtkCellRendererText" id="cellrenderertext2"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="title"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">libraries</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> |