LibreOffice Module sc (master) 1
tabvwshd.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
20#include <sfx2/childwin.hxx>
21#include <sfx2/viewfrm.hxx>
22
23#include <tabvwsh.hxx>
24#include <scmod.hxx>
25#include <docsh.hxx>
26#include <gridwin.hxx>
27
30
32{
33 // if a ref-input dialog is open, use it as parent
34 // (necessary when a slot is executed from the dialog's OK handler)
35 if (nCurRefDlgId && nCurRefDlgId == SC_MOD()->GetCurRefDlgId())
36 {
37 SfxViewFrame& rViewFrm = GetViewFrame();
38 if (rViewFrm.HasChildWindow(nCurRefDlgId))
39 {
40 SfxChildWindow* pChild = rViewFrm.GetChildWindow(nCurRefDlgId);
41 if (pChild)
42 {
43 auto xController = pChild->GetController();
44 weld::Window* pRet = xController ? xController->getDialog() : nullptr;
45 if (pRet && pRet->get_visible())
46 return pRet;
47 }
48 }
49 }
50
52 if (pDocSh->IsOle())
53 {
54 // TODO/LATER: how to GetEditWindow in embedded document?!
55 // It should be OK to return the ViewShell Window!
56 vcl::Window* pWin = GetWindow();
57 return pWin ? pWin->GetFrameWeld() : nullptr;
58 // SvInPlaceEnvironment* pEnv = pDocSh->GetIPEnv();
59 // if (pEnv)
60 // return pEnv->GetEditWin();
61 }
62
63 vcl::Window* pWin = GetActiveWin(); // for normal views, too
64 return pWin ? pWin->GetFrameWeld() : nullptr;
65}
66
67/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsOle() const
Definition: docsh6.cxx:147
sal_uInt16 nCurRefDlgId
Definition: tabvwsh.hxx:160
weld::Window * GetDialogParent()
parent window for dialogs Problem: OLE Server!
Definition: tabvwshd.cxx:31
ScViewData & GetViewData()
Definition: tabview.hxx:344
ScGridWindow * GetActiveWin()
Definition: tabview.cxx:878
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
std::shared_ptr< SfxDialogController > & GetController()
bool HasChildWindow(sal_uInt16)
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxViewFrame & GetViewFrame() const
vcl::Window * GetWindow() const
weld::Window * GetFrameWeld() const
virtual bool get_visible() const=0
#define SC_MOD()
Definition: scmod.hxx:247
Reference< XController > xController