Bump version to 24.04.3.4
[LibreOffice.git] / basctl / source / basicide / ObjectCatalog.cxx
blob13069ed46621c77ba14188eb59a3f9894eead6f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <strings.hrc>
21 #include <iderid.hxx>
23 #include <ObjectCatalog.hxx>
24 #include <helpids.h>
26 #include <vcl/taskpanelist.hxx>
28 namespace basctl
30 ObjectCatalog::ObjectCatalog(vcl::Window* pParent)
31 : DockingWindow(pParent, "modules/BasicIDE/ui/dockingorganizer.ui", "DockingOrganizer")
33 m_xTitle = m_xBuilder->weld_label("title");
34 m_xTree.reset(new SbTreeListBox(m_xBuilder->weld_tree_view("libraries"), GetFrameWeld()));
36 SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT");
37 SetText(IDEResId(RID_BASICIDE_OBJCAT));
39 // title
40 m_xTitle->set_label(IDEResId(RID_BASICIDE_OBJCAT));
42 // tree list
43 weld::TreeView& rWidget = m_xTree->get_widget();
45 rWidget.set_help_id(HID_BASICIDE_OBJECTCAT);
46 m_xTree->ScanAllEntries();
47 rWidget.grab_focus();
49 // make object catalog keyboard accessible
50 GetParent()->GetSystemWindow()->GetTaskPaneList()->AddWindow(this);
53 ObjectCatalog::~ObjectCatalog() { disposeOnce(); }
55 void ObjectCatalog::dispose()
57 GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this);
58 m_xTitle.reset();
59 m_xTree.reset();
60 DockingWindow::dispose();
63 // ToggleFloatingMode() -- called by DockingWindow when IsFloatingMode() changes
64 void ObjectCatalog::ToggleFloatingMode()
66 // base class version
67 DockingWindow::ToggleFloatingMode();
69 bool const bFloating = IsFloatingMode();
70 // tdf#152154: m_xTitle will be null during disposing
71 if (m_xTitle)
72 m_xTitle->set_visible(!bFloating);
75 void ObjectCatalog::SetCurrentEntry(BaseWindow* pCurWin)
77 EntryDescriptor aDescriptor;
78 if (pCurWin)
79 aDescriptor = pCurWin->CreateEntryDescriptor();
80 m_xTree->SetCurrentEntry(aDescriptor);
83 } // namespace basctl
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */