LibreOffice Module sd (master) 1
NavigatorChildWindow.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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>
27
28namespace sd {
29
30static void RequestNavigatorUpdate (SfxBindings const * pBindings)
31{
32 if (pBindings != nullptr
33 && pBindings->GetDispatcher() != nullptr)
34 {
35 SfxBoolItem aItem (SID_NAVIGATOR_INIT, true);
36 pBindings->GetDispatcher()->ExecuteList(
37 SID_NAVIGATOR_INIT,
38 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
39 { &aItem });
40 }
41}
42
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)
48{
49 m_xNavWin->SetUpdateRequestFunctor(
50 [_pBindings] () { return RequestNavigatorUpdate(_pBindings); });
51
52 SetMinOutputSizePixel(GetOptimalSize());
53}
54
56{
57 SfxNavigator::Activate();
58 // tdf#141708 defer grabbing focus to preferred widget until the float is
59 // first activated
61 {
62 m_xNavWin->FirstFocus();
64 }
65}
66
68{
69 m_xNavWin->InitTreeLB(pDoc);
70}
71
73{
74 m_xNavWin->FreshTree(pDoc);
75}
76
78{
79 m_xNavWin.reset();
81}
82
84{
85 disposeOnce();
86}
87
89
91 SfxBindings* pBindings, SfxChildWinInfo* pInfo)
92 : SfxNavigatorWrapper(_pParent, nId)
93{
94 SetWindow(VclPtr<SdNavigatorFloat>::Create(pBindings, this, _pParent, pInfo));
95 Initialize();
96}
97
98} // end of namespace sd
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxDispatcher * GetDispatcher() const
void SetWindow(const VclPtr< vcl::Window > &p)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
virtual void dispose() override
void SetMinOutputSizePixel(const Size &rSize)
bool m_bSetInitialFocusOnActivate
Definition: navigatr.hxx:86
void InitTreeLB(const SdDrawDocument *pDoc)
virtual ~SdNavigatorFloat() override
void FreshTree(const SdDrawDocument *pDoc)
SdNavigatorFloat(SfxBindings *_pBindings, SfxChildWindow *pMgr, vcl::Window *pParent, SfxChildWinInfo *pInfo)
virtual void dispose() override
std::unique_ptr< SdNavigatorWin > m_xNavWin
Definition: navigatr.hxx:85
virtual void Activate() override
SdNavigatorWrapper(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
static void RequestNavigatorUpdate(SfxBindings const *pBindings)
SFX_IMPL_DOCKINGWINDOW(SdNavigatorWrapper, SID_NAVIGATOR)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Reference< XNameAccess > m_xContainer
sal_Int16 nId