xref: /aoo41x/main/sc/source/ui/view/tabvwshd.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 
32 
33 //------------------------------------------------------------------
34 
35 #ifdef _MSC_VER
36 #pragma optimize ("", off)
37 #endif
38 
39 // INCLUDE ---------------------------------------------------------------
40 
41 #include <sfx2/childwin.hxx>
42 #include <sfx2/request.hxx>
43 #include <sfx2/viewfrm.hxx>
44 #include <vcl/svapp.hxx>
45 #include <vcl/wrkwin.hxx>
46 
47 #include "tabvwsh.hxx"
48 #include "global.hxx"
49 #include "scmod.hxx"
50 #include "docsh.hxx"
51 #include "sc.hrc"
52 
53 
54 // STATIC DATA -----------------------------------------------------------
55 
56 //------------------------------------------------------------------
57 
58 #define IS_AVAILABLE(WhichId,ppItem) \
59     (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
60 
61 //! 		Parent-Window fuer Dialoge
62 //! 		Problem: OLE Server!
63 
64 Window* ScTabViewShell::GetDialogParent()
65 {
66 	//	#95513# if a ref-input dialog is open, use it as parent
67 	//	(necessary when a slot is executed from the dialog's OK handler)
68 	if ( nCurRefDlgId && nCurRefDlgId == SC_MOD()->GetCurRefDlgId() )
69 	{
70 		SfxViewFrame* pViewFrm = GetViewFrame();
71 		if ( pViewFrm->HasChildWindow(nCurRefDlgId) )
72 		{
73 			SfxChildWindow* pChild = pViewFrm->GetChildWindow(nCurRefDlgId);
74 			if (pChild)
75 			{
76 				Window* pWin = pChild->GetWindow();
77 				if (pWin && pWin->IsVisible())
78 					return pWin;
79 			}
80 		}
81 	}
82 
83 	ScDocShell* pDocSh = GetViewData()->GetDocShell();
84 	if ( pDocSh->IsOle() )
85 	{
86         //TODO/LATER: how to GetEditWindow in embedded document?!
87         //It should be OK to return the VieShell Window!
88         return GetWindow();
89         //SvInPlaceEnvironment* pEnv = pDocSh->GetIPEnv();
90         //if (pEnv)
91         //    return pEnv->GetEditWin();
92 	}
93 
94 	return GetActiveWin();		// for normal views, too
95 }
96 
97 
98 
99 
100 
101