1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
23 #include <sfx2/bindings.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/sfxsids.hrc>
26 #include <svl/eitem.hxx>
27 #include <svl/itemset.hxx>
31 static void RequestNavigatorUpdate (SfxBindings
const * pBindings
)
33 if (pBindings
!= nullptr
34 && pBindings
->GetDispatcher() != nullptr)
36 SfxBoolItem
aItem (SID_NAVIGATOR_INIT
, true);
37 pBindings
->GetDispatcher()->ExecuteList(
39 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
,
44 SdNavigatorFloat::SdNavigatorFloat(SfxBindings
* _pBindings
, SfxChildWindow
* _pMgr
,
45 vcl::Window
* _pParent
, SfxChildWinInfo
* pInfo
)
46 : SfxNavigator(_pBindings
, _pMgr
, _pParent
, pInfo
)
47 , m_xNavWin(std::make_unique
<SdNavigatorWin
>(m_xContainer
.get(), _pBindings
, this))
48 , m_bSetInitialFocusOnActivate(true)
50 m_xNavWin
->SetUpdateRequestFunctor(
51 [_pBindings
] () { return RequestNavigatorUpdate(_pBindings
); });
53 SetMinOutputSizePixel(GetOptimalSize());
56 void SdNavigatorFloat::Activate()
58 SfxNavigator::Activate();
59 // tdf#141708 defer grabbing focus to preferred widget until the float is
61 if (m_bSetInitialFocusOnActivate
)
63 m_xNavWin
->FirstFocus();
64 m_bSetInitialFocusOnActivate
= false;
68 void SdNavigatorFloat::InitTreeLB(const SdDrawDocument
* pDoc
)
70 m_xNavWin
->InitTreeLB(pDoc
);
73 void SdNavigatorFloat::dispose()
76 SfxNavigator::dispose();
79 SdNavigatorFloat::~SdNavigatorFloat()
84 SFX_IMPL_DOCKINGWINDOW(SdNavigatorWrapper
, SID_NAVIGATOR
);
86 SdNavigatorWrapper::SdNavigatorWrapper(vcl::Window
*_pParent
, sal_uInt16 nId
,
87 SfxBindings
* pBindings
, SfxChildWinInfo
* pInfo
)
88 : SfxNavigatorWrapper(_pParent
, nId
)
90 SetWindow(VclPtr
<SdNavigatorFloat
>::Create(pBindings
, this, _pParent
, pInfo
));
94 } // end of namespace sd
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */