update dev300-m58
[ooovba.git] / sc / source / ui / view / reffact.cxx
blobcc444135c3726e3dc0a97d8c1ac3be7c7038cb53
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: reffact.cxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include <sfx2/app.hxx>
39 #include <sfx2/basedlgs.hxx>
40 #include <sfx2/bindings.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <sfx2/viewfrm.hxx>
44 #include "reffact.hxx"
45 #include "tabvwsh.hxx"
46 #include "sc.hrc"
47 #include "acredlin.hxx"
48 #include "simpref.hxx"
49 #include "scmod.hxx"
51 // -----------------------------------------------------------------------
53 SFX_IMPL_MODELESSDIALOG(ScNameDlgWrapper, FID_DEFINE_NAME )
54 SFX_IMPL_MODELESSDIALOG(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
55 SFX_IMPL_MODELESSDIALOG(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
56 SFX_IMPL_MODELESSDIALOG(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
57 SFX_IMPL_MODELESSDIALOG(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
58 SFX_IMPL_MODELESSDIALOG(ScFilterDlgWrapper, SID_FILTER )
59 SFX_IMPL_MODELESSDIALOG(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
60 SFX_IMPL_MODELESSDIALOG(ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
61 SFX_IMPL_MODELESSDIALOG(ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE )
62 SFX_IMPL_MODELESSDIALOG(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
63 SFX_IMPL_MODELESSDIALOG(ScCondFormatDlgWrapper, SID_OPENDLG_CONDFRMT )
64 SFX_IMPL_MODELESSDIALOG(ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
65 SFX_IMPL_MODELESSDIALOG(ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
66 SFX_IMPL_MODELESSDIALOG(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
67 SFX_IMPL_MODELESSDIALOG(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
68 SFX_IMPL_MODELESSDIALOG(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
69 /*!!! dafuer muss der Funktionsautopilot noch umgebaut werden
70 SFX_IMPL_CHILDWINDOW(ScFunctionDlgWrapper, SID_OPENDLG_FUNCTION )
71 SFX_IMPL_CHILDWINDOW(ScEditFunctionDlgWrapper, SID_OPENDLG_EDITFUNCTION )
72 SFX_IMPL_CHILDWINDOW(ScArgumentDlgWrapper, SID_OPENDLG_ARGUMENT )
75 #define IMPL_CHILD_CTOR(Class,sid) \
76 Class::Class( Window* pParentP, \
77 USHORT nId, \
78 SfxBindings* p, \
79 SfxChildWinInfo* pInfo ) \
80 : SfxChildWindow(pParentP, nId) \
81 { \
82 ScTabViewShell* pViewShell = \
83 PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \
84 DBG_ASSERT( pViewShell, "missing view shell :-(" ); \
85 pWindow = pViewShell ? \
86 pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : NULL; \
87 if (pViewShell && !pWindow) \
88 pViewShell->GetViewFrame()->SetChildWindow( nId, FALSE ); \
92 //=========================================================================
94 //-------------------------------------------------------------------------
95 // ScNameDlgWrapper
96 //-------------------------------------------------------------------------
98 IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
100 //-------------------------------------------------------------------------
101 // ScSolverDlgWrapper
102 //-------------------------------------------------------------------------
104 IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
106 //-------------------------------------------------------------------------
107 // ScOptSolverDlgWrapper
108 //-------------------------------------------------------------------------
110 IMPL_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
112 //-------------------------------------------------------------------------
113 // ScPivotLayoutWrapper
114 //-------------------------------------------------------------------------
116 IMPL_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
118 //-------------------------------------------------------------------------
119 // ScTabOpDlgWrapper
120 //-------------------------------------------------------------------------
122 IMPL_CHILD_CTOR( ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
124 //-------------------------------------------------------------------------
125 // ScFilterDlgWrapper
126 //-------------------------------------------------------------------------
128 IMPL_CHILD_CTOR( ScFilterDlgWrapper, SID_FILTER )
130 //-------------------------------------------------------------------------
131 // ScSpecialFilterDlgWrapper
132 //-------------------------------------------------------------------------
134 IMPL_CHILD_CTOR( ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
136 //-------------------------------------------------------------------------
137 // ScDbNameDlgWrapper
138 //-------------------------------------------------------------------------
140 IMPL_CHILD_CTOR( ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
142 //-------------------------------------------------------------------------
143 // ScColRowNameRangesDlgWrapper
144 //-------------------------------------------------------------------------
146 IMPL_CHILD_CTOR( ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
148 //-------------------------------------------------------------------------
149 // ScConsolidateDlgWrapper
150 //-------------------------------------------------------------------------
152 IMPL_CHILD_CTOR( ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE )
154 //-------------------------------------------------------------------------
155 // ScPrintAreasDlgWrapper
156 //-------------------------------------------------------------------------
158 IMPL_CHILD_CTOR( ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
160 //-------------------------------------------------------------------------
161 // ScCondFormatDlgWrapper
162 //-------------------------------------------------------------------------
164 IMPL_CHILD_CTOR( ScCondFormatDlgWrapper, SID_OPENDLG_CONDFRMT )
166 //-------------------------------------------------------------------------
167 // ScFormulaDlgWrapper
168 //-------------------------------------------------------------------------
170 IMPL_CHILD_CTOR( ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
173 //-------------------------------------------------------------------------
174 // ScSimpleRefDlgWrapper
175 //-------------------------------------------------------------------------
177 static BOOL bScSimpleRefFlag;
178 static long nScSimpleRefHeight;
179 static long nScSimpleRefWidth;
180 static long nScSimpleRefX;
181 static long nScSimpleRefY;
182 static BOOL bAutoReOpen=TRUE;
184 ScSimpleRefDlgWrapper::ScSimpleRefDlgWrapper( Window* pParentP,
185 USHORT nId,
186 SfxBindings* p,
187 SfxChildWinInfo* pInfo )
188 : SfxChildWindow(pParentP, nId)
190 // ScTabViewShell* pViewShell =
191 // PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
193 ScTabViewShell* pViewShell = NULL;
194 SfxDispatcher* pDisp = p->GetDispatcher();
195 if ( pDisp )
197 SfxViewFrame* pViewFrm = pDisp->GetFrame();
198 if ( pViewFrm )
199 pViewShell = PTR_CAST( ScTabViewShell, pViewFrm->GetViewShell() );
202 DBG_ASSERT( pViewShell, "missing view shell :-(" );
204 if(pInfo!=NULL && bScSimpleRefFlag)
206 pInfo->aPos.X()=nScSimpleRefX;
207 pInfo->aPos.Y()=nScSimpleRefY;
208 pInfo->aSize.Height()=nScSimpleRefHeight;
209 pInfo->aSize.Width()=nScSimpleRefWidth;
211 pWindow = NULL;
213 if(bAutoReOpen && pViewShell)
214 pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP, WID_SIMPLE_REF);
216 if (!pWindow)
218 SC_MOD()->SetRefDialog( nId, FALSE );
222 void ScSimpleRefDlgWrapper::SetDefaultPosSize(Point aPos, Size aSize, BOOL bSet)
224 bScSimpleRefFlag=bSet;
225 if(bScSimpleRefFlag)
227 nScSimpleRefX=aPos.X();
228 nScSimpleRefY=aPos.Y();
229 nScSimpleRefHeight=aSize.Height();
230 nScSimpleRefWidth=aSize.Width();
235 String ScSimpleRefDlgWrapper::GetRefString()
237 String aResult;
238 if(pWindow!=NULL)
240 aResult=((ScSimpleRefDlg*)pWindow)->GetRefString();
242 return aResult;
245 void ScSimpleRefDlgWrapper::SetAutoReOpen(BOOL bFlag)
247 bAutoReOpen=bFlag;
250 void ScSimpleRefDlgWrapper::SetRefString(const String& rStr)
252 if(pWindow!=NULL)
254 ((ScSimpleRefDlg*)pWindow)->SetRefString(rStr);
258 void ScSimpleRefDlgWrapper::SetCloseHdl( const Link& rLink )
260 if(pWindow!=NULL)
262 ((ScSimpleRefDlg*)pWindow)->SetCloseHdl( rLink );
266 void ScSimpleRefDlgWrapper::SetUnoLinks( const Link& rDone,
267 const Link& rAbort, const Link& rChange )
269 if(pWindow!=NULL)
271 ((ScSimpleRefDlg*)pWindow)->SetUnoLinks( rDone, rAbort, rChange );
275 void ScSimpleRefDlgWrapper::SetFlags( BOOL bCloseOnButtonUp, BOOL bSingleCell, BOOL bMultiSelection )
277 if(pWindow!=NULL)
279 ((ScSimpleRefDlg*)pWindow)->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection );
283 void ScSimpleRefDlgWrapper::StartRefInput()
285 if(pWindow!=NULL)
287 ((ScSimpleRefDlg*)pWindow)->StartRefInput();
293 //-------------------------------------------------------------------------
294 // ScAcceptChgDlgWrapper //Kommentar: sollte in die ViewShell
295 //-------------------------------------------------------------------------
297 ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( Window* pParentP,
298 USHORT nId,
299 SfxBindings* pBindings,
300 SfxChildWinInfo* pInfo ) :
301 SfxChildWindow( pParentP, nId )
303 ScTabViewShell* pViewShell =
304 PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
305 DBG_ASSERT( pViewShell, "missing view shell :-(" );
306 pWindow = pViewShell ?
307 new ScAcceptChgDlg( pBindings, this, pParentP, pViewShell->GetViewData() ) :
308 NULL;
309 if(pWindow!=NULL)
311 ((ScAcceptChgDlg*)pWindow)->Initialize( pInfo );
313 if (pViewShell && !pWindow)
314 pViewShell->GetViewFrame()->SetChildWindow( nId, FALSE );
317 void ScAcceptChgDlgWrapper::ReInitDlg()
319 ScTabViewShell* pViewShell =
320 PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
321 DBG_ASSERT( pViewShell, "missing view shell :-(" );
323 if(pWindow!=NULL && pViewShell)
325 ((ScAcceptChgDlg*)pWindow)->ReInit(pViewShell->GetViewData());
329 //-------------------------------------------------------------------------
330 // ScHighlightChgDlgWrapper
331 //-------------------------------------------------------------------------
333 IMPL_CHILD_CTOR( ScHighlightChgDlgWrapper, FID_CHG_SHOW )
335 /*------------------------------------------------------------------------*/
336 /*@@@
337 //-------------------------------------------------------------------------
338 // ScFunctionDlgWrapper
339 //-------------------------------------------------------------------------
341 IMPL_CHILD_CTOR( ScFunctionDlgWrapper, SID_OPENDLG_FUNCTION )
343 //-------------------------------------------------------------------------
344 // ScEditFunctionDlgWrapper
345 //-------------------------------------------------------------------------
347 IMPL_CHILD_CTOR( ScEditFunctionDlgWrapper, SID_OPENDLG_EDITFUNCTION )
349 //-------------------------------------------------------------------------
350 // ScArgumentDlgWrapper
351 //-------------------------------------------------------------------------
353 IMPL_CHILD_CTOR( ScArgumentDlgWrapper, SID_OPENDLG_ARGUMENT )
354 @@@*/
355 /*------------------------------------------------------------------------*/