Update git submodules
[LibreOffice.git] / sd / source / ui / dlg / NavigatorChildWindow.cxx
blob6055c238a3c9d18d60789d29922918c4b46036c8
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 <NavigatorChildWindow.hxx>
21 #include <navigatr.hxx>
22 #include <app.hrc>
23 #include <sfx2/bindings.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/sfxsids.hrc>
26 #include <svl/eitem.hxx>
28 namespace sd {
30 static void RequestNavigatorUpdate (SfxBindings const * pBindings)
32 if (pBindings != nullptr
33 && pBindings->GetDispatcher() != nullptr)
35 SfxBoolItem aItem (SID_NAVIGATOR_INIT, true);
36 pBindings->GetDispatcher()->ExecuteList(
37 SID_NAVIGATOR_INIT,
38 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
39 { &aItem });
43 SdNavigatorFloat::SdNavigatorFloat(SfxBindings* _pBindings, SfxChildWindow* _pMgr,
44 vcl::Window* _pParent, SfxChildWinInfo* pInfo)
45 : SfxNavigator(_pBindings, _pMgr, _pParent, pInfo)
46 , m_xNavWin(std::make_unique<SdNavigatorWin>(m_xContainer.get(), _pBindings, this))
47 , m_bSetInitialFocusOnActivate(true)
49 m_xNavWin->SetUpdateRequestFunctor(
50 [_pBindings] () { return RequestNavigatorUpdate(_pBindings); });
52 SetMinOutputSizePixel(GetOptimalSize());
55 void SdNavigatorFloat::Activate()
57 SfxNavigator::Activate();
58 // tdf#141708 defer grabbing focus to preferred widget until the float is
59 // first activated
60 if (m_bSetInitialFocusOnActivate)
62 m_xNavWin->FirstFocus();
63 m_bSetInitialFocusOnActivate = false;
67 void SdNavigatorFloat::InitTreeLB(const SdDrawDocument* pDoc)
69 m_xNavWin->InitTreeLB(pDoc);
72 void SdNavigatorFloat::FreshTree(const SdDrawDocument* pDoc)
74 m_xNavWin->FreshTree(pDoc);
77 void SdNavigatorFloat::dispose()
79 m_xNavWin.reset();
80 SfxNavigator::dispose();
83 SdNavigatorFloat::~SdNavigatorFloat()
85 disposeOnce();
88 SFX_IMPL_DOCKINGWINDOW(SdNavigatorWrapper, SID_NAVIGATOR);
90 SdNavigatorWrapper::SdNavigatorWrapper(vcl::Window *_pParent, sal_uInt16 nId,
91 SfxBindings* pBindings, SfxChildWinInfo* pInfo)
92 : SfxNavigatorWrapper(_pParent, nId)
94 SetWindow(VclPtr<SdNavigatorFloat>::Create(pBindings, this, _pParent, pInfo));
95 Initialize();
98 } // end of namespace sd
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */