1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b3f79822SAndrew Rist * distributed with this work for additional information
6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10*b3f79822SAndrew Rist *
11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist *
13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17*b3f79822SAndrew Rist * specific language governing permissions and limitations
18*b3f79822SAndrew Rist * under the License.
19*b3f79822SAndrew Rist *
20*b3f79822SAndrew Rist *************************************************************/
21*b3f79822SAndrew Rist
22*b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <sfx2/app.hxx>
32cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
33cdf0e10cSrcweir #include <sfx2/bindings.hxx>
34cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
35cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include "reffact.hxx"
38cdf0e10cSrcweir #include "tabvwsh.hxx"
39cdf0e10cSrcweir #include "sc.hrc"
40cdf0e10cSrcweir #include "acredlin.hxx"
41cdf0e10cSrcweir #include "simpref.hxx"
42cdf0e10cSrcweir #include "scmod.hxx"
43cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
44cdf0e10cSrcweir #include "validate.hxx"
45cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
46cdf0e10cSrcweir
47cdf0e10cSrcweir // -----------------------------------------------------------------------
48cdf0e10cSrcweir
SFX_IMPL_MODELESSDIALOG(ScNameDlgWrapper,FID_DEFINE_NAME)49cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScNameDlgWrapper, FID_DEFINE_NAME )
50cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
51cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
52cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
53cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
54cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScFilterDlgWrapper, SID_FILTER )
55cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
56cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
57cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE )
58cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
59cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScCondFormatDlgWrapper, SID_OPENDLG_CONDFRMT )
60cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
61cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
62cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
63cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
64cdf0e10cSrcweir SFX_IMPL_MODELESSDIALOG(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
65cdf0e10cSrcweir /*!!! dafuer muss der Funktionsautopilot noch umgebaut werden
66cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(ScFunctionDlgWrapper, SID_OPENDLG_FUNCTION )
67cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(ScEditFunctionDlgWrapper, SID_OPENDLG_EDITFUNCTION )
68cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(ScArgumentDlgWrapper, SID_OPENDLG_ARGUMENT )
69cdf0e10cSrcweir */
70cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
71cdf0e10cSrcweir //SFX_IMPL_MODELESSDIALOG(ScValidityRefChildWin, SID_VALIDITY_REFERENCE )
72cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
73cdf0e10cSrcweir SfxChildWinInfo __EXPORT ScValidityRefChildWin::GetInfo() const
74cdf0e10cSrcweir {
75cdf0e10cSrcweir SfxChildWinInfo anInfo = SfxChildWindow::GetInfo();
76cdf0e10cSrcweir
77cdf0e10cSrcweir if( Window *pWnd = GetWindow() )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir anInfo.aSize = pWnd->GetSizePixel();
80cdf0e10cSrcweir
81cdf0e10cSrcweir if( pWnd->IsDialog() )
82cdf0e10cSrcweir if ( static_cast<Dialog*>(pWnd)->IsRollUp() )
83cdf0e10cSrcweir anInfo.nFlags |= SFX_CHILDWIN_ZOOMIN;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir
86cdf0e10cSrcweir return anInfo;
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir namespace { ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings ); }
90cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
91cdf0e10cSrcweir
92cdf0e10cSrcweir #define IMPL_CHILD_CTOR(Class,sid) \
93cdf0e10cSrcweir Class::Class( Window* pParentP, \
94cdf0e10cSrcweir sal_uInt16 nId, \
95cdf0e10cSrcweir SfxBindings* p, \
96cdf0e10cSrcweir SfxChildWinInfo* pInfo ) \
97cdf0e10cSrcweir : SfxChildWindow(pParentP, nId) \
98cdf0e10cSrcweir { \
99cdf0e10cSrcweir /*//<!--Added by PengYunQuan for Validity Cell Range Picker*/\
100cdf0e10cSrcweir /************************************************************************************/\
101cdf0e10cSrcweir /* When a new document is creating, the SfxViewFrame may be ready, */\
102cdf0e10cSrcweir /* But the ScTabViewShell may have not been activated yet. In this */\
103cdf0e10cSrcweir /* situation, SfxViewShell::Current() does not get the correct shell, */\
104cdf0e10cSrcweir /* and we should lcl_GetTabViewShell( p ) instead of SfxViewShell::Current() */\
105cdf0e10cSrcweir /************************************************************************************/\
106cdf0e10cSrcweir ScTabViewShell* pViewShell = lcl_GetTabViewShell( p ); \
107cdf0e10cSrcweir /*//-->Added by PengYunQuan for Validity Cell Range Picker*/\
108cdf0e10cSrcweir if (!pViewShell) \
109cdf0e10cSrcweir pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \
110cdf0e10cSrcweir DBG_ASSERT( pViewShell, "missing view shell :-(" ); \
111cdf0e10cSrcweir pWindow = pViewShell ? \
112cdf0e10cSrcweir pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : NULL; \
113cdf0e10cSrcweir if (pViewShell && !pWindow) \
114cdf0e10cSrcweir pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False ); \
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
117cdf0e10cSrcweir
118cdf0e10cSrcweir //=========================================================================
119cdf0e10cSrcweir
120cdf0e10cSrcweir //-------------------------------------------------------------------------
121cdf0e10cSrcweir // ScNameDlgWrapper
122cdf0e10cSrcweir //-------------------------------------------------------------------------
123cdf0e10cSrcweir
124cdf0e10cSrcweir IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
125cdf0e10cSrcweir
126cdf0e10cSrcweir //-------------------------------------------------------------------------
127cdf0e10cSrcweir // ScSolverDlgWrapper
128cdf0e10cSrcweir //-------------------------------------------------------------------------
129cdf0e10cSrcweir
130cdf0e10cSrcweir IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
131cdf0e10cSrcweir
132cdf0e10cSrcweir //-------------------------------------------------------------------------
133cdf0e10cSrcweir // ScOptSolverDlgWrapper
134cdf0e10cSrcweir //-------------------------------------------------------------------------
135cdf0e10cSrcweir
136cdf0e10cSrcweir IMPL_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
137cdf0e10cSrcweir
138cdf0e10cSrcweir //-------------------------------------------------------------------------
139cdf0e10cSrcweir // ScPivotLayoutWrapper
140cdf0e10cSrcweir //-------------------------------------------------------------------------
141cdf0e10cSrcweir
142cdf0e10cSrcweir IMPL_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
143cdf0e10cSrcweir
144cdf0e10cSrcweir //-------------------------------------------------------------------------
145cdf0e10cSrcweir // ScTabOpDlgWrapper
146cdf0e10cSrcweir //-------------------------------------------------------------------------
147cdf0e10cSrcweir
148cdf0e10cSrcweir IMPL_CHILD_CTOR( ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
149cdf0e10cSrcweir
150cdf0e10cSrcweir //-------------------------------------------------------------------------
151cdf0e10cSrcweir // ScFilterDlgWrapper
152cdf0e10cSrcweir //-------------------------------------------------------------------------
153cdf0e10cSrcweir
154cdf0e10cSrcweir IMPL_CHILD_CTOR( ScFilterDlgWrapper, SID_FILTER )
155cdf0e10cSrcweir
156cdf0e10cSrcweir //-------------------------------------------------------------------------
157cdf0e10cSrcweir // ScSpecialFilterDlgWrapper
158cdf0e10cSrcweir //-------------------------------------------------------------------------
159cdf0e10cSrcweir
160cdf0e10cSrcweir IMPL_CHILD_CTOR( ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
161cdf0e10cSrcweir
162cdf0e10cSrcweir //-------------------------------------------------------------------------
163cdf0e10cSrcweir // ScDbNameDlgWrapper
164cdf0e10cSrcweir //-------------------------------------------------------------------------
165cdf0e10cSrcweir
166cdf0e10cSrcweir IMPL_CHILD_CTOR( ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
167cdf0e10cSrcweir
168cdf0e10cSrcweir //-------------------------------------------------------------------------
169cdf0e10cSrcweir // ScColRowNameRangesDlgWrapper
170cdf0e10cSrcweir //-------------------------------------------------------------------------
171cdf0e10cSrcweir
172cdf0e10cSrcweir IMPL_CHILD_CTOR( ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
173cdf0e10cSrcweir
174cdf0e10cSrcweir //-------------------------------------------------------------------------
175cdf0e10cSrcweir // ScConsolidateDlgWrapper
176cdf0e10cSrcweir //-------------------------------------------------------------------------
177cdf0e10cSrcweir
178cdf0e10cSrcweir IMPL_CHILD_CTOR( ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE )
179cdf0e10cSrcweir
180cdf0e10cSrcweir //-------------------------------------------------------------------------
181cdf0e10cSrcweir // ScPrintAreasDlgWrapper
182cdf0e10cSrcweir //-------------------------------------------------------------------------
183cdf0e10cSrcweir
184cdf0e10cSrcweir IMPL_CHILD_CTOR( ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
185cdf0e10cSrcweir
186cdf0e10cSrcweir //-------------------------------------------------------------------------
187cdf0e10cSrcweir // ScCondFormatDlgWrapper
188cdf0e10cSrcweir //-------------------------------------------------------------------------
189cdf0e10cSrcweir
190cdf0e10cSrcweir IMPL_CHILD_CTOR( ScCondFormatDlgWrapper, SID_OPENDLG_CONDFRMT )
191cdf0e10cSrcweir
192cdf0e10cSrcweir //-------------------------------------------------------------------------
193cdf0e10cSrcweir // ScFormulaDlgWrapper
194cdf0e10cSrcweir //-------------------------------------------------------------------------
195cdf0e10cSrcweir
196cdf0e10cSrcweir IMPL_CHILD_CTOR( ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
197cdf0e10cSrcweir
198cdf0e10cSrcweir
199cdf0e10cSrcweir //-------------------------------------------------------------------------
200cdf0e10cSrcweir // ScSimpleRefDlgWrapper
201cdf0e10cSrcweir //-------------------------------------------------------------------------
202cdf0e10cSrcweir
203cdf0e10cSrcweir static sal_Bool bScSimpleRefFlag;
204cdf0e10cSrcweir static long nScSimpleRefHeight;
205cdf0e10cSrcweir static long nScSimpleRefWidth;
206cdf0e10cSrcweir static long nScSimpleRefX;
207cdf0e10cSrcweir static long nScSimpleRefY;
208cdf0e10cSrcweir static sal_Bool bAutoReOpen=sal_True;
209cdf0e10cSrcweir
ScSimpleRefDlgWrapper(Window * pParentP,sal_uInt16 nId,SfxBindings * p,SfxChildWinInfo * pInfo)210cdf0e10cSrcweir ScSimpleRefDlgWrapper::ScSimpleRefDlgWrapper( Window* pParentP,
211cdf0e10cSrcweir sal_uInt16 nId,
212cdf0e10cSrcweir SfxBindings* p,
213cdf0e10cSrcweir SfxChildWinInfo* pInfo )
214cdf0e10cSrcweir : SfxChildWindow(pParentP, nId)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir // ScTabViewShell* pViewShell =
217cdf0e10cSrcweir // PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
218cdf0e10cSrcweir
219cdf0e10cSrcweir ScTabViewShell* pViewShell = NULL;
220cdf0e10cSrcweir SfxDispatcher* pDisp = p->GetDispatcher();
221cdf0e10cSrcweir if ( pDisp )
222cdf0e10cSrcweir {
223cdf0e10cSrcweir SfxViewFrame* pViewFrm = pDisp->GetFrame();
224cdf0e10cSrcweir if ( pViewFrm )
225cdf0e10cSrcweir pViewShell = PTR_CAST( ScTabViewShell, pViewFrm->GetViewShell() );
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir DBG_ASSERT( pViewShell, "missing view shell :-(" );
229cdf0e10cSrcweir
230cdf0e10cSrcweir if(pInfo!=NULL && bScSimpleRefFlag)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir pInfo->aPos.X()=nScSimpleRefX;
233cdf0e10cSrcweir pInfo->aPos.Y()=nScSimpleRefY;
234cdf0e10cSrcweir pInfo->aSize.Height()=nScSimpleRefHeight;
235cdf0e10cSrcweir pInfo->aSize.Width()=nScSimpleRefWidth;
236cdf0e10cSrcweir }
237cdf0e10cSrcweir pWindow = NULL;
238cdf0e10cSrcweir
239cdf0e10cSrcweir if(bAutoReOpen && pViewShell)
240cdf0e10cSrcweir pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP, WID_SIMPLE_REF);
241cdf0e10cSrcweir
242cdf0e10cSrcweir if (!pWindow)
243cdf0e10cSrcweir {
244cdf0e10cSrcweir SC_MOD()->SetRefDialog( nId, sal_False );
245cdf0e10cSrcweir }
246cdf0e10cSrcweir }
247cdf0e10cSrcweir
SetDefaultPosSize(Point aPos,Size aSize,sal_Bool bSet)248cdf0e10cSrcweir void ScSimpleRefDlgWrapper::SetDefaultPosSize(Point aPos, Size aSize, sal_Bool bSet)
249cdf0e10cSrcweir {
250cdf0e10cSrcweir bScSimpleRefFlag=bSet;
251cdf0e10cSrcweir if(bScSimpleRefFlag)
252cdf0e10cSrcweir {
253cdf0e10cSrcweir nScSimpleRefX=aPos.X();
254cdf0e10cSrcweir nScSimpleRefY=aPos.Y();
255cdf0e10cSrcweir nScSimpleRefHeight=aSize.Height();
256cdf0e10cSrcweir nScSimpleRefWidth=aSize.Width();
257cdf0e10cSrcweir }
258cdf0e10cSrcweir }
259cdf0e10cSrcweir
260cdf0e10cSrcweir
GetRefString()261cdf0e10cSrcweir String ScSimpleRefDlgWrapper::GetRefString()
262cdf0e10cSrcweir {
263cdf0e10cSrcweir String aResult;
264cdf0e10cSrcweir if(pWindow!=NULL)
265cdf0e10cSrcweir {
266cdf0e10cSrcweir aResult=((ScSimpleRefDlg*)pWindow)->GetRefString();
267cdf0e10cSrcweir }
268cdf0e10cSrcweir return aResult;
269cdf0e10cSrcweir }
270cdf0e10cSrcweir
SetAutoReOpen(sal_Bool bFlag)271cdf0e10cSrcweir void ScSimpleRefDlgWrapper::SetAutoReOpen(sal_Bool bFlag)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir bAutoReOpen=bFlag;
274cdf0e10cSrcweir }
275cdf0e10cSrcweir
SetRefString(const String & rStr)276cdf0e10cSrcweir void ScSimpleRefDlgWrapper::SetRefString(const String& rStr)
277cdf0e10cSrcweir {
278cdf0e10cSrcweir if(pWindow!=NULL)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir ((ScSimpleRefDlg*)pWindow)->SetRefString(rStr);
281cdf0e10cSrcweir }
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
SetCloseHdl(const Link & rLink)284cdf0e10cSrcweir void ScSimpleRefDlgWrapper::SetCloseHdl( const Link& rLink )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir if(pWindow!=NULL)
287cdf0e10cSrcweir {
288cdf0e10cSrcweir ((ScSimpleRefDlg*)pWindow)->SetCloseHdl( rLink );
289cdf0e10cSrcweir }
290cdf0e10cSrcweir }
291cdf0e10cSrcweir
SetUnoLinks(const Link & rDone,const Link & rAbort,const Link & rChange)292cdf0e10cSrcweir void ScSimpleRefDlgWrapper::SetUnoLinks( const Link& rDone,
293cdf0e10cSrcweir const Link& rAbort, const Link& rChange )
294cdf0e10cSrcweir {
295cdf0e10cSrcweir if(pWindow!=NULL)
296cdf0e10cSrcweir {
297cdf0e10cSrcweir ((ScSimpleRefDlg*)pWindow)->SetUnoLinks( rDone, rAbort, rChange );
298cdf0e10cSrcweir }
299cdf0e10cSrcweir }
300cdf0e10cSrcweir
SetFlags(sal_Bool bCloseOnButtonUp,sal_Bool bSingleCell,sal_Bool bMultiSelection)301cdf0e10cSrcweir void ScSimpleRefDlgWrapper::SetFlags( sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir if(pWindow!=NULL)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir ((ScSimpleRefDlg*)pWindow)->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
306cdf0e10cSrcweir }
307cdf0e10cSrcweir }
308cdf0e10cSrcweir
StartRefInput()309cdf0e10cSrcweir void ScSimpleRefDlgWrapper::StartRefInput()
310cdf0e10cSrcweir {
311cdf0e10cSrcweir if(pWindow!=NULL)
312cdf0e10cSrcweir {
313cdf0e10cSrcweir ((ScSimpleRefDlg*)pWindow)->StartRefInput();
314cdf0e10cSrcweir }
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
317cdf0e10cSrcweir
318cdf0e10cSrcweir
319cdf0e10cSrcweir //-------------------------------------------------------------------------
320cdf0e10cSrcweir // ScAcceptChgDlgWrapper //Kommentar: sollte in die ViewShell
321cdf0e10cSrcweir //-------------------------------------------------------------------------
322cdf0e10cSrcweir
ScAcceptChgDlgWrapper(Window * pParentP,sal_uInt16 nId,SfxBindings * pBindings,SfxChildWinInfo * pInfo)323cdf0e10cSrcweir ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( Window* pParentP,
324cdf0e10cSrcweir sal_uInt16 nId,
325cdf0e10cSrcweir SfxBindings* pBindings,
326cdf0e10cSrcweir SfxChildWinInfo* pInfo ) :
327cdf0e10cSrcweir SfxChildWindow( pParentP, nId )
328cdf0e10cSrcweir {
329cdf0e10cSrcweir ScTabViewShell* pViewShell =
330cdf0e10cSrcweir PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
331cdf0e10cSrcweir DBG_ASSERT( pViewShell, "missing view shell :-(" );
332cdf0e10cSrcweir pWindow = pViewShell ?
333cdf0e10cSrcweir new ScAcceptChgDlg( pBindings, this, pParentP, pViewShell->GetViewData() ) :
334cdf0e10cSrcweir NULL;
335cdf0e10cSrcweir if(pWindow!=NULL)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir ((ScAcceptChgDlg*)pWindow)->Initialize( pInfo );
338cdf0e10cSrcweir }
339cdf0e10cSrcweir if (pViewShell && !pWindow)
340cdf0e10cSrcweir pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False );
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
ReInitDlg()343cdf0e10cSrcweir void ScAcceptChgDlgWrapper::ReInitDlg()
344cdf0e10cSrcweir {
345cdf0e10cSrcweir ScTabViewShell* pViewShell =
346cdf0e10cSrcweir PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
347cdf0e10cSrcweir DBG_ASSERT( pViewShell, "missing view shell :-(" );
348cdf0e10cSrcweir
349cdf0e10cSrcweir if(pWindow!=NULL && pViewShell)
350cdf0e10cSrcweir {
351cdf0e10cSrcweir ((ScAcceptChgDlg*)pWindow)->ReInit(pViewShell->GetViewData());
352cdf0e10cSrcweir }
353cdf0e10cSrcweir }
354cdf0e10cSrcweir
355cdf0e10cSrcweir //-------------------------------------------------------------------------
356cdf0e10cSrcweir // ScHighlightChgDlgWrapper
357cdf0e10cSrcweir //-------------------------------------------------------------------------
358cdf0e10cSrcweir
359cdf0e10cSrcweir IMPL_CHILD_CTOR( ScHighlightChgDlgWrapper, FID_CHG_SHOW )
360cdf0e10cSrcweir
361cdf0e10cSrcweir /*------------------------------------------------------------------------*/
362cdf0e10cSrcweir /*@@@
363cdf0e10cSrcweir //-------------------------------------------------------------------------
364cdf0e10cSrcweir // ScFunctionDlgWrapper
365cdf0e10cSrcweir //-------------------------------------------------------------------------
366cdf0e10cSrcweir
367cdf0e10cSrcweir IMPL_CHILD_CTOR( ScFunctionDlgWrapper, SID_OPENDLG_FUNCTION )
368cdf0e10cSrcweir
369cdf0e10cSrcweir //-------------------------------------------------------------------------
370cdf0e10cSrcweir // ScEditFunctionDlgWrapper
371cdf0e10cSrcweir //-------------------------------------------------------------------------
372cdf0e10cSrcweir
373cdf0e10cSrcweir IMPL_CHILD_CTOR( ScEditFunctionDlgWrapper, SID_OPENDLG_EDITFUNCTION )
374cdf0e10cSrcweir
375cdf0e10cSrcweir //-------------------------------------------------------------------------
376cdf0e10cSrcweir // ScArgumentDlgWrapper
377cdf0e10cSrcweir //-------------------------------------------------------------------------
378cdf0e10cSrcweir
379cdf0e10cSrcweir IMPL_CHILD_CTOR( ScArgumentDlgWrapper, SID_OPENDLG_ARGUMENT )
380cdf0e10cSrcweir @@@*/
381cdf0e10cSrcweir /*------------------------------------------------------------------------*/
382cdf0e10cSrcweir
383cdf0e10cSrcweir
384cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
385cdf0e10cSrcweir namespace
386cdf0e10cSrcweir {
lcl_GetTabViewShell(SfxBindings * pBindings)387cdf0e10cSrcweir ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir if( pBindings )
390cdf0e10cSrcweir if( SfxDispatcher* pDisp = pBindings ->GetDispatcher() )
391cdf0e10cSrcweir if( SfxViewFrame *pFrm = pDisp->GetFrame() )
392cdf0e10cSrcweir if( SfxViewShell* pViewSh = pFrm->GetViewShell() )
393cdf0e10cSrcweir return dynamic_cast<ScTabViewShell*>( pViewSh );
394cdf0e10cSrcweir
395cdf0e10cSrcweir return NULL;
396cdf0e10cSrcweir }
397cdf0e10cSrcweir }
398cdf0e10cSrcweir
ScValidityRefChildWin(Window * pParentP,sal_uInt16 nId,SfxBindings * p,SfxChildWinInfo *)399cdf0e10cSrcweir ScValidityRefChildWin::ScValidityRefChildWin( Window* pParentP, \
400cdf0e10cSrcweir sal_uInt16 nId, \
401cdf0e10cSrcweir SfxBindings* p, \
402cdf0e10cSrcweir SfxChildWinInfo* /*pInfo*/ ) \
403cdf0e10cSrcweir : SfxChildWindow(pParentP, nId),
404cdf0e10cSrcweir m_bVisibleLock( false ),
405cdf0e10cSrcweir m_bFreeWindowLock( false ),
406cdf0e10cSrcweir m_pSavedWndParent( NULL )
407cdf0e10cSrcweir {
408cdf0e10cSrcweir SetWantsFocus( sal_False );\
409cdf0e10cSrcweir ScTabViewShell* pViewShell = \
410cdf0e10cSrcweir NULL != ( pWindow = ScValidationDlg::Find1AliveObject( pParentP ) ) ? static_cast<ScValidationDlg*>(pWindow)->GetTabViewShell() :
411cdf0e10cSrcweir lcl_GetTabViewShell( p );
412cdf0e10cSrcweir if (!pViewShell)
413cdf0e10cSrcweir pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
414cdf0e10cSrcweir DBG_ASSERT( pViewShell, "missing view shell :-(" ); \
415cdf0e10cSrcweir if (pViewShell && !pWindow) \
416cdf0e10cSrcweir pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False ); \
417cdf0e10cSrcweir else if( pWindow /*&& pWindow->ISA(ScValidationDlg)*/ )
418cdf0e10cSrcweir {}//pWindow = new Window( pParentP, WB_HIDE );
419cdf0e10cSrcweir
420cdf0e10cSrcweir if( pWindow ) m_pSavedWndParent = pWindow->GetParent();
421cdf0e10cSrcweir }
422cdf0e10cSrcweir
~ScValidityRefChildWin()423cdf0e10cSrcweir ScValidityRefChildWin::~ScValidityRefChildWin()
424cdf0e10cSrcweir {
425cdf0e10cSrcweir if( pWindow ) pWindow->SetParent( m_pSavedWndParent );
426cdf0e10cSrcweir
427cdf0e10cSrcweir if( m_bFreeWindowLock )
428cdf0e10cSrcweir pWindow = NULL;
429cdf0e10cSrcweir }
430cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
431