1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b3f79822SAndrew Rist * distributed with this work for additional information
6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10b3f79822SAndrew Rist *
11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12b3f79822SAndrew Rist *
13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist * software distributed under the License is distributed on an
15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17b3f79822SAndrew Rist * specific language governing permissions and limitations
18b3f79822SAndrew Rist * under the License.
19b3f79822SAndrew Rist *
20b3f79822SAndrew Rist *************************************************************/
21b3f79822SAndrew Rist
22b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
27cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
28cdf0e10cSrcweir
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweir
32cdf0e10cSrcweir
33cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include "scitems.hxx"
36cdf0e10cSrcweir #include <sfx2/app.hxx>
37cdf0e10cSrcweir #include <editeng/eeitem.hxx>
38cdf0e10cSrcweir
39cdf0e10cSrcweir #include <editeng/flditem.hxx>
40cdf0e10cSrcweir #include <editeng/outliner.hxx>
41cdf0e10cSrcweir #include <basic/sbstar.hxx>
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx>
44cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
45cdf0e10cSrcweir #include <sfx2/objface.hxx>
46cdf0e10cSrcweir
47cdf0e10cSrcweir #include <svx/hyprlink.hxx>
48cdf0e10cSrcweir #include "IAnyRefDialog.hxx"
49cdf0e10cSrcweir
50cdf0e10cSrcweir #include <svtools/ehdl.hxx>
51cdf0e10cSrcweir #include <svtools/accessibilityoptions.hxx>
52cdf0e10cSrcweir #include <svl/ctloptions.hxx>
53cdf0e10cSrcweir #include <unotools/useroptions.hxx>
54cdf0e10cSrcweir #include <vcl/status.hxx>
55cdf0e10cSrcweir #include <sfx2/bindings.hxx>
56cdf0e10cSrcweir #include <sfx2/request.hxx>
57cdf0e10cSrcweir #include <sfx2/printer.hxx>
58cdf0e10cSrcweir #include <editeng/langitem.hxx>
59cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
60cdf0e10cSrcweir
61cdf0e10cSrcweir #include <svl/whiter.hxx>
62cdf0e10cSrcweir #include <svx/selctrl.hxx>
63cdf0e10cSrcweir #include <svx/insctrl.hxx>
64cdf0e10cSrcweir #include <svx/zoomctrl.hxx>
65cdf0e10cSrcweir #include <svx/modctrl.hxx>
66cdf0e10cSrcweir #include <svx/pszctrl.hxx>
67cdf0e10cSrcweir #include <svx/zoomsliderctrl.hxx>
68cdf0e10cSrcweir #include <vcl/msgbox.hxx>
69cdf0e10cSrcweir #include <svl/inethist.hxx>
70cdf0e10cSrcweir #include <vcl/waitobj.hxx>
71cdf0e10cSrcweir #include <svx/svxerr.hxx>
72cdf0e10cSrcweir
73cdf0e10cSrcweir
74cdf0e10cSrcweir
75cdf0e10cSrcweir #include "scmod.hxx"
76cdf0e10cSrcweir #include "global.hxx"
77cdf0e10cSrcweir #include "viewopti.hxx"
78cdf0e10cSrcweir #include "docoptio.hxx"
79cdf0e10cSrcweir #include "appoptio.hxx"
80cdf0e10cSrcweir #include "inputopt.hxx"
81cdf0e10cSrcweir #include "printopt.hxx"
82cdf0e10cSrcweir #include "navicfg.hxx"
83cdf0e10cSrcweir #include "addincfg.hxx"
84cdf0e10cSrcweir #include "tabvwsh.hxx"
85cdf0e10cSrcweir #include "prevwsh.hxx"
86cdf0e10cSrcweir #include "docsh.hxx"
87cdf0e10cSrcweir #include "drwlayer.hxx"
88cdf0e10cSrcweir #include "uiitems.hxx"
89cdf0e10cSrcweir #include "sc.hrc"
90cdf0e10cSrcweir #include "cfgids.hxx"
91cdf0e10cSrcweir #include "inputhdl.hxx"
92cdf0e10cSrcweir #include "inputwin.hxx"
93cdf0e10cSrcweir #include "msgpool.hxx"
94cdf0e10cSrcweir #include "scresid.hxx"
95cdf0e10cSrcweir #include "anyrefdg.hxx"
96cdf0e10cSrcweir #include "dwfunctr.hxx"
97cdf0e10cSrcweir #include "formdata.hxx"
98cdf0e10cSrcweir //CHINA001 #include "tpview.hxx"
99cdf0e10cSrcweir //CHINA001 #include "tpusrlst.hxx"
100cdf0e10cSrcweir //CHINA001 #include "tpcalc.hxx"
101cdf0e10cSrcweir #include "tpprint.hxx"
102cdf0e10cSrcweir //CHINA001 #include "opredlin.hxx"
103cdf0e10cSrcweir #include "transobj.hxx"
104cdf0e10cSrcweir #include "detfunc.hxx"
105cdf0e10cSrcweir #include "preview.hxx"
106cdf0e10cSrcweir
107cdf0e10cSrcweir #include <svx/xmlsecctrl.hxx>
108cdf0e10cSrcweir
109cdf0e10cSrcweir
110cdf0e10cSrcweir #define ScModule
111cdf0e10cSrcweir #include "scslots.hxx"
112cdf0e10cSrcweir
113cdf0e10cSrcweir #include "scabstdlg.hxx" //CHINA001
114cdf0e10cSrcweir
115cdf0e10cSrcweir #define SC_IDLE_MIN 150
116cdf0e10cSrcweir #define SC_IDLE_MAX 3000
117cdf0e10cSrcweir #define SC_IDLE_STEP 75
118cdf0e10cSrcweir #define SC_IDLE_COUNT 50
119cdf0e10cSrcweir
120cdf0e10cSrcweir static sal_uInt16 nIdleCount = 0;
121cdf0e10cSrcweir
122cdf0e10cSrcweir //------------------------------------------------------------------
123cdf0e10cSrcweir
SFX_IMPL_INTERFACE(ScModule,SfxShell,ScResId (RID_APPTITLE))124cdf0e10cSrcweir SFX_IMPL_INTERFACE( ScModule, SfxShell, ScResId(RID_APPTITLE) )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER,
127cdf0e10cSrcweir ScResId(RID_OBJECTBAR_APP) );
128cdf0e10cSrcweir SFX_STATUSBAR_REGISTRATION( ScResId(SCCFG_STATUSBAR) ); // nur ID wichtig
129cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION( SvxHyperlinkDlgWrapper::GetChildWindowId() );
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
132cdf0e10cSrcweir //------------------------------------------------------------------
133cdf0e10cSrcweir
ScModule(SfxObjectFactory * pFact)134cdf0e10cSrcweir ScModule::ScModule( SfxObjectFactory* pFact ) :
135cdf0e10cSrcweir SfxModule( SfxApplication::CreateResManager( "sc" ), sal_False, pFact, NULL ),
136cdf0e10cSrcweir pSelTransfer( NULL ),
137cdf0e10cSrcweir pMessagePool( NULL ),
138cdf0e10cSrcweir pRefInputHandler( NULL ),
139cdf0e10cSrcweir pViewCfg( NULL ),
140cdf0e10cSrcweir pDocCfg( NULL ),
141cdf0e10cSrcweir pAppCfg( NULL ),
142cdf0e10cSrcweir pInputCfg( NULL ),
143cdf0e10cSrcweir pPrintCfg( NULL ),
144cdf0e10cSrcweir pNavipiCfg( NULL ),
145cdf0e10cSrcweir pAddInCfg( NULL ),
146cdf0e10cSrcweir pColorConfig( NULL ),
147cdf0e10cSrcweir pAccessOptions( NULL ),
148cdf0e10cSrcweir pCTLOptions( NULL ),
149cdf0e10cSrcweir pUserOptions( NULL ),
150cdf0e10cSrcweir pErrorHdl( NULL ),
151cdf0e10cSrcweir pSvxErrorHdl( NULL ),
152cdf0e10cSrcweir pFormEditData( NULL ),
153cdf0e10cSrcweir nCurRefDlgId( 0 ),
154cdf0e10cSrcweir bIsWaterCan( sal_False ),
155cdf0e10cSrcweir bIsInEditCommand( sal_False ),
156cdf0e10cSrcweir bIsInExecuteDrop( sal_False ),
157cdf0e10cSrcweir mbIsInSharedDocLoading( false ),
158cdf0e10cSrcweir mbIsInSharedDocSaving( false )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir // im ctor ist der ResManager (DLL-Daten) noch nicht initialisiert!
161cdf0e10cSrcweir
162cdf0e10cSrcweir SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("StarCalc"))); // fuer Basic
163cdf0e10cSrcweir
164cdf0e10cSrcweir ResetDragObject();
165cdf0e10cSrcweir SetClipObject( NULL, NULL );
166cdf0e10cSrcweir
167cdf0e10cSrcweir // InputHandler braucht nicht mehr angelegt zu werden
168cdf0e10cSrcweir
169cdf0e10cSrcweir // ErrorHandler anlegen - war in Init()
170cdf0e10cSrcweir // zwischen OfficeApplication::Init und ScGlobal::Init
171cdf0e10cSrcweir SvxErrorHandler::Get();
172cdf0e10cSrcweir pErrorHdl = new SfxErrorHandler( RID_ERRHDLSC,
173cdf0e10cSrcweir ERRCODE_AREA_SC,
174cdf0e10cSrcweir ERRCODE_AREA_APP2-1,
175cdf0e10cSrcweir GetResMgr() );
176cdf0e10cSrcweir
177cdf0e10cSrcweir aSpellTimer.SetTimeout(10);
178cdf0e10cSrcweir aSpellTimer.SetTimeoutHdl( LINK( this, ScModule, SpellTimerHdl ) );
179cdf0e10cSrcweir aIdleTimer.SetTimeout(SC_IDLE_MIN);
180cdf0e10cSrcweir aIdleTimer.SetTimeoutHdl( LINK( this, ScModule, IdleHandler ) );
181cdf0e10cSrcweir aIdleTimer.Start();
182cdf0e10cSrcweir
183cdf0e10cSrcweir pMessagePool = new ScMessagePool;
184cdf0e10cSrcweir pMessagePool->FreezeIdRanges();
185cdf0e10cSrcweir SetPool( pMessagePool );
186cdf0e10cSrcweir ScGlobal::InitTextHeight( pMessagePool );
187cdf0e10cSrcweir
188cdf0e10cSrcweir StartListening( *SFX_APP() ); // for SFX_HINT_DEINITIALIZING
189cdf0e10cSrcweir }
190cdf0e10cSrcweir
~ScModule()191cdf0e10cSrcweir ScModule::~ScModule()
192cdf0e10cSrcweir {
193cdf0e10cSrcweir DBG_ASSERT( !pSelTransfer, "Selection Transfer object not deleted" );
194cdf0e10cSrcweir
195cdf0e10cSrcweir // InputHandler braucht nicht mehr geloescht zu werden (gibt keinen an der App mehr)
196cdf0e10cSrcweir
197cdf0e10cSrcweir SfxItemPool::Free(pMessagePool);
198cdf0e10cSrcweir
199cdf0e10cSrcweir DELETEZ( pFormEditData );
200cdf0e10cSrcweir
201cdf0e10cSrcweir delete pErrorHdl;
202cdf0e10cSrcweir // delete pSvxErrorHdl;
203cdf0e10cSrcweir
204cdf0e10cSrcweir ScGlobal::Clear(); // ruft auch ScDocumentPool::DeleteVersionMaps();
205cdf0e10cSrcweir
206cdf0e10cSrcweir DeleteCfg(); // wurde mal aus Exit() gerufen
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
209cdf0e10cSrcweir //------------------------------------------------------------------
ConfigurationChanged(utl::ConfigurationBroadcaster * p,sal_uInt32)210cdf0e10cSrcweir void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 )
211cdf0e10cSrcweir {
212cdf0e10cSrcweir if ( p == pColorConfig || p == pAccessOptions )
213cdf0e10cSrcweir {
214cdf0e10cSrcweir // Test if detective objects have to be updated with new colors
215cdf0e10cSrcweir // (if the detective colors haven't been used yet, there's nothing to update)
216cdf0e10cSrcweir if ( ScDetectiveFunc::IsColorsInitialized() )
217cdf0e10cSrcweir {
218cdf0e10cSrcweir const svtools::ColorConfig& rColors = GetColorConfig();
219cdf0e10cSrcweir sal_Bool bArrows =
220cdf0e10cSrcweir ( ScDetectiveFunc::GetArrowColor() != (ColorData)rColors.GetColorValue(svtools::CALCDETECTIVE).nColor ||
221cdf0e10cSrcweir ScDetectiveFunc::GetErrorColor() != (ColorData)rColors.GetColorValue(svtools::CALCDETECTIVEERROR).nColor );
222cdf0e10cSrcweir sal_Bool bComments =
223cdf0e10cSrcweir ( ScDetectiveFunc::GetCommentColor() != (ColorData)rColors.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor );
224cdf0e10cSrcweir if ( bArrows || bComments )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir ScDetectiveFunc::InitializeColors(); // get the new colors
227cdf0e10cSrcweir
228cdf0e10cSrcweir // update detective objects in all open documents
229cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
230cdf0e10cSrcweir while ( pObjSh )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir if ( pObjSh->Type() == TYPE(ScDocShell) )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir ScDocShell* pDocSh = ((ScDocShell*)pObjSh);
235cdf0e10cSrcweir if ( bArrows )
236cdf0e10cSrcweir ScDetectiveFunc( pDocSh->GetDocument(), 0 ).UpdateAllArrowColors();
237cdf0e10cSrcweir if ( bComments )
238cdf0e10cSrcweir ScDetectiveFunc::UpdateAllComments( *pDocSh->GetDocument() );
239cdf0e10cSrcweir }
240cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir }
243cdf0e10cSrcweir }
244cdf0e10cSrcweir
245cdf0e10cSrcweir // force all views to repaint, using the new options
246cdf0e10cSrcweir
247cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::GetFirst();
248cdf0e10cSrcweir while(pViewShell)
249cdf0e10cSrcweir {
250cdf0e10cSrcweir if ( pViewShell->ISA(ScTabViewShell) )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir ScTabViewShell* pViewSh = (ScTabViewShell*)pViewShell;
253cdf0e10cSrcweir pViewSh->PaintGrid();
254cdf0e10cSrcweir pViewSh->PaintTop();
255cdf0e10cSrcweir pViewSh->PaintLeft();
256cdf0e10cSrcweir pViewSh->PaintExtras();
257cdf0e10cSrcweir
258cdf0e10cSrcweir ScInputHandler* pHdl = pViewSh->GetInputHandler();
259cdf0e10cSrcweir if ( pHdl )
260cdf0e10cSrcweir pHdl->ForgetLastPattern(); // EditEngine BackgroundColor may change
261cdf0e10cSrcweir }
262cdf0e10cSrcweir else if ( pViewShell->ISA(ScPreviewShell) )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir Window* pWin = pViewShell->GetWindow();
265cdf0e10cSrcweir if (pWin)
266cdf0e10cSrcweir pWin->Invalidate();
267cdf0e10cSrcweir }
268cdf0e10cSrcweir pViewShell = SfxViewShell::GetNext( *pViewShell );
269cdf0e10cSrcweir }
270cdf0e10cSrcweir }
271cdf0e10cSrcweir else if ( p == pCTLOptions )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir // for all documents: set digit language for printer, recalc output factor, update row heights
274cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
275cdf0e10cSrcweir while ( pObjSh )
276cdf0e10cSrcweir {
277cdf0e10cSrcweir if ( pObjSh->Type() == TYPE(ScDocShell) )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir ScDocShell* pDocSh = ((ScDocShell*)pObjSh);
280cdf0e10cSrcweir OutputDevice* pPrinter = pDocSh->GetPrinter();
281cdf0e10cSrcweir if ( pPrinter )
282cdf0e10cSrcweir pPrinter->SetDigitLanguage( GetOptDigitLanguage() );
283cdf0e10cSrcweir
284cdf0e10cSrcweir pDocSh->CalcOutputFactor();
285cdf0e10cSrcweir
286cdf0e10cSrcweir SCTAB nTabCount = pDocSh->GetDocument()->GetTableCount();
287cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++)
288cdf0e10cSrcweir pDocSh->AdjustRowHeight( 0, MAXROW, nTab );
289cdf0e10cSrcweir }
290cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh );
291cdf0e10cSrcweir }
292cdf0e10cSrcweir
293cdf0e10cSrcweir // for all views (table and preview): update digit language
294cdf0e10cSrcweir SfxViewShell* pSh = SfxViewShell::GetFirst();
295cdf0e10cSrcweir while ( pSh )
296cdf0e10cSrcweir {
297cdf0e10cSrcweir if ( pSh->ISA( ScTabViewShell ) )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir ScTabViewShell* pViewSh = (ScTabViewShell*)pSh;
300cdf0e10cSrcweir
301cdf0e10cSrcweir // set ref-device for EditEngine (re-evaluates digit settings)
302cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(pViewSh);
303cdf0e10cSrcweir if (pHdl)
304cdf0e10cSrcweir pHdl->UpdateRefDevice();
305cdf0e10cSrcweir
306cdf0e10cSrcweir pViewSh->DigitLanguageChanged();
307cdf0e10cSrcweir pViewSh->PaintGrid();
308cdf0e10cSrcweir }
309cdf0e10cSrcweir else if ( pSh->ISA( ScPreviewShell ) )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir ScPreviewShell* pPreviewSh = (ScPreviewShell*)pSh;
312cdf0e10cSrcweir ScPreview* pPreview = pPreviewSh->GetPreview();
313cdf0e10cSrcweir
314cdf0e10cSrcweir pPreview->SetDigitLanguage( GetOptDigitLanguage() );
315cdf0e10cSrcweir pPreview->Invalidate();
316cdf0e10cSrcweir }
317cdf0e10cSrcweir
318cdf0e10cSrcweir pSh = SfxViewShell::GetNext( *pSh );
319cdf0e10cSrcweir }
320cdf0e10cSrcweir }
321cdf0e10cSrcweir }
322cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)323cdf0e10cSrcweir void ScModule::Notify( SfxBroadcaster&, const SfxHint& rHint )
324cdf0e10cSrcweir {
325cdf0e10cSrcweir if ( rHint.ISA(SfxSimpleHint) )
326cdf0e10cSrcweir {
327cdf0e10cSrcweir sal_uLong nHintId = ((SfxSimpleHint&)rHint).GetId();
328cdf0e10cSrcweir if ( nHintId == SFX_HINT_DEINITIALIZING )
329cdf0e10cSrcweir {
330cdf0e10cSrcweir // ConfigItems must be removed before ConfigManager
331cdf0e10cSrcweir DeleteCfg();
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir }
335cdf0e10cSrcweir
336cdf0e10cSrcweir //------------------------------------------------------------------
337cdf0e10cSrcweir
DeleteCfg()338cdf0e10cSrcweir void ScModule::DeleteCfg()
339cdf0e10cSrcweir {
340cdf0e10cSrcweir DELETEZ( pViewCfg ); // Speichern passiert vor Exit() automatisch
341cdf0e10cSrcweir DELETEZ( pDocCfg );
342cdf0e10cSrcweir DELETEZ( pAppCfg );
343cdf0e10cSrcweir DELETEZ( pInputCfg );
344cdf0e10cSrcweir DELETEZ( pPrintCfg );
345cdf0e10cSrcweir DELETEZ( pNavipiCfg );
346cdf0e10cSrcweir DELETEZ( pAddInCfg );
347cdf0e10cSrcweir
348cdf0e10cSrcweir if ( pColorConfig )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir pColorConfig->RemoveListener(this);
351cdf0e10cSrcweir DELETEZ( pColorConfig );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir if ( pAccessOptions )
354cdf0e10cSrcweir {
355cdf0e10cSrcweir pAccessOptions->RemoveListener(this);
356cdf0e10cSrcweir DELETEZ( pAccessOptions );
357cdf0e10cSrcweir }
358cdf0e10cSrcweir if ( pCTLOptions )
359cdf0e10cSrcweir {
360cdf0e10cSrcweir pCTLOptions->RemoveListener(this);
361cdf0e10cSrcweir DELETEZ( pCTLOptions );
362cdf0e10cSrcweir }
363cdf0e10cSrcweir if( pUserOptions )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir DELETEZ( pUserOptions );
366cdf0e10cSrcweir }
367cdf0e10cSrcweir }
368cdf0e10cSrcweir
369cdf0e10cSrcweir //------------------------------------------------------------------
370cdf0e10cSrcweir //
371cdf0e10cSrcweir // von der Applikation verschoben:
372cdf0e10cSrcweir //
373cdf0e10cSrcweir //------------------------------------------------------------------
374cdf0e10cSrcweir
Execute(SfxRequest & rReq)375cdf0e10cSrcweir void ScModule::Execute( SfxRequest& rReq )
376cdf0e10cSrcweir {
377cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current();
378cdf0e10cSrcweir SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : NULL;
379cdf0e10cSrcweir
380cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs();
381cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot();
382cdf0e10cSrcweir
383cdf0e10cSrcweir switch ( nSlot )
384cdf0e10cSrcweir {
385cdf0e10cSrcweir case SID_CHOOSE_DESIGN:
386cdf0e10cSrcweir {
387cdf0e10cSrcweir String aMacroName =
388cdf0e10cSrcweir String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Template.Samples.ShowStyles"));
389cdf0e10cSrcweir SfxApplication::CallAppBasic( aMacroName );
390cdf0e10cSrcweir }
391cdf0e10cSrcweir break;
392cdf0e10cSrcweir case SID_EURO_CONVERTER:
393cdf0e10cSrcweir {
394cdf0e10cSrcweir String aMacroName =
395cdf0e10cSrcweir String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Euro.ConvertRun.Main"));
396cdf0e10cSrcweir SfxApplication::CallAppBasic( aMacroName );
397cdf0e10cSrcweir }
398cdf0e10cSrcweir break;
399cdf0e10cSrcweir case SID_AUTOSPELL_CHECK:
400cdf0e10cSrcweir {
401cdf0e10cSrcweir sal_Bool bSet;
402cdf0e10cSrcweir const SfxPoolItem* pItem;
403cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( nSlot, sal_True, &pItem ) )
404cdf0e10cSrcweir bSet = ((const SfxBoolItem*)pItem)->GetValue();
405cdf0e10cSrcweir else
406cdf0e10cSrcweir { // Toggle
407cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
408cdf0e10cSrcweir if ( pDocSh )
409cdf0e10cSrcweir bSet = !pDocSh->GetDocument()->GetDocOptions().IsAutoSpell();
410cdf0e10cSrcweir else
411cdf0e10cSrcweir bSet = !GetDocOptions().IsAutoSpell();
412cdf0e10cSrcweir }
413cdf0e10cSrcweir
414cdf0e10cSrcweir SfxItemSet aSet( GetPool(), SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK );
415cdf0e10cSrcweir aSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, bSet ) );
416cdf0e10cSrcweir ModifyOptions( aSet );
417cdf0e10cSrcweir rReq.Done();
418cdf0e10cSrcweir }
419cdf0e10cSrcweir break;
420cdf0e10cSrcweir
421cdf0e10cSrcweir case SID_ATTR_METRIC:
422cdf0e10cSrcweir {
423cdf0e10cSrcweir const SfxPoolItem* pItem;
424cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( nSlot, sal_True, &pItem ) )
425cdf0e10cSrcweir {
426cdf0e10cSrcweir FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
427cdf0e10cSrcweir switch( eUnit )
428cdf0e10cSrcweir {
429cdf0e10cSrcweir case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen
430cdf0e10cSrcweir case FUNIT_CM:
431cdf0e10cSrcweir case FUNIT_INCH:
432cdf0e10cSrcweir case FUNIT_PICA:
433cdf0e10cSrcweir case FUNIT_POINT:
434cdf0e10cSrcweir {
435cdf0e10cSrcweir PutItem( *pItem );
436cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() );
437cdf0e10cSrcweir aNewOpts.SetAppMetric( eUnit );
438cdf0e10cSrcweir SetAppOptions( aNewOpts );
439cdf0e10cSrcweir rReq.Done();
440cdf0e10cSrcweir }
441cdf0e10cSrcweir break;
442cdf0e10cSrcweir default:
443cdf0e10cSrcweir {
444cdf0e10cSrcweir // added to avoid warnings
445cdf0e10cSrcweir }
446cdf0e10cSrcweir }
447cdf0e10cSrcweir }
448cdf0e10cSrcweir }
449cdf0e10cSrcweir break;
450cdf0e10cSrcweir
451cdf0e10cSrcweir case FID_AUTOCOMPLETE:
452cdf0e10cSrcweir {
453cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() );
454cdf0e10cSrcweir sal_Bool bNew = !aNewOpts.GetAutoComplete();
455cdf0e10cSrcweir aNewOpts.SetAutoComplete( bNew );
456cdf0e10cSrcweir SetAppOptions( aNewOpts );
457cdf0e10cSrcweir ScInputHandler::SetAutoComplete( bNew );
458cdf0e10cSrcweir if (pBindings)
459cdf0e10cSrcweir pBindings->Invalidate( FID_AUTOCOMPLETE );
460cdf0e10cSrcweir rReq.Done();
461cdf0e10cSrcweir }
462cdf0e10cSrcweir break;
463cdf0e10cSrcweir
464cdf0e10cSrcweir case SID_DETECTIVE_AUTO:
465cdf0e10cSrcweir {
466cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() );
467cdf0e10cSrcweir sal_Bool bNew = !aNewOpts.GetDetectiveAuto();
468cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pAuto, SfxBoolItem, SID_DETECTIVE_AUTO, sal_False );
469cdf0e10cSrcweir if ( pAuto )
470cdf0e10cSrcweir bNew = pAuto->GetValue();
471cdf0e10cSrcweir
472cdf0e10cSrcweir aNewOpts.SetDetectiveAuto( bNew );
473cdf0e10cSrcweir SetAppOptions( aNewOpts );
474cdf0e10cSrcweir if (pBindings)
475cdf0e10cSrcweir pBindings->Invalidate( SID_DETECTIVE_AUTO );
476cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( SID_DETECTIVE_AUTO, bNew ) );
477cdf0e10cSrcweir rReq.Done();
478cdf0e10cSrcweir }
479cdf0e10cSrcweir break;
480cdf0e10cSrcweir
481cdf0e10cSrcweir case SID_PSZ_FUNCTION:
482cdf0e10cSrcweir if (pReqArgs)
483cdf0e10cSrcweir {
484cdf0e10cSrcweir const SfxUInt16Item& rItem = (const SfxUInt16Item&)pReqArgs->Get(SID_PSZ_FUNCTION);
485cdf0e10cSrcweir DBG_ASSERT(rItem.ISA(SfxUInt16Item),"falscher Parameter");
486cdf0e10cSrcweir
487cdf0e10cSrcweir ScAppOptions aNewOpts( GetAppOptions() );
488cdf0e10cSrcweir aNewOpts.SetStatusFunc( rItem.GetValue() );
489cdf0e10cSrcweir SetAppOptions( aNewOpts );
490cdf0e10cSrcweir
491cdf0e10cSrcweir if (pBindings)
492cdf0e10cSrcweir {
493cdf0e10cSrcweir pBindings->Invalidate( SID_TABLE_CELL );
494cdf0e10cSrcweir pBindings->Update( SID_TABLE_CELL ); // sofort
495cdf0e10cSrcweir
496cdf0e10cSrcweir pBindings->Invalidate( SID_PSZ_FUNCTION );
497cdf0e10cSrcweir pBindings->Update( SID_PSZ_FUNCTION );
498cdf0e10cSrcweir // falls Menue gleich wieder aufgeklappt wird
499cdf0e10cSrcweir }
500cdf0e10cSrcweir }
501cdf0e10cSrcweir break;
502cdf0e10cSrcweir
503cdf0e10cSrcweir case SID_ATTR_LANGUAGE:
504cdf0e10cSrcweir case SID_ATTR_CHAR_CJK_LANGUAGE:
505cdf0e10cSrcweir case SID_ATTR_CHAR_CTL_LANGUAGE:
506cdf0e10cSrcweir {
507cdf0e10cSrcweir const SfxPoolItem* pItem;
508cdf0e10cSrcweir if ( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( GetPool().GetWhich(nSlot), sal_True, &pItem ) )
509cdf0e10cSrcweir {
510cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
511cdf0e10cSrcweir ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL;
512cdf0e10cSrcweir if ( pDoc )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir LanguageType eNewLang = ((SvxLanguageItem*)pItem)->GetLanguage();
515cdf0e10cSrcweir LanguageType eLatin, eCjk, eCtl;
516cdf0e10cSrcweir pDoc->GetLanguage( eLatin, eCjk, eCtl );
517cdf0e10cSrcweir LanguageType eOld = ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE ) ? eCjk :
518cdf0e10cSrcweir ( ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE ) ? eCtl : eLatin );
519cdf0e10cSrcweir if ( eNewLang != eOld )
520cdf0e10cSrcweir {
521cdf0e10cSrcweir if ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE )
522cdf0e10cSrcweir eCjk = eNewLang;
523cdf0e10cSrcweir else if ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE )
524cdf0e10cSrcweir eCtl = eNewLang;
525cdf0e10cSrcweir else
526cdf0e10cSrcweir eLatin = eNewLang;
527cdf0e10cSrcweir
528cdf0e10cSrcweir pDoc->SetLanguage( eLatin, eCjk, eCtl );
529cdf0e10cSrcweir
530cdf0e10cSrcweir ScInputHandler* pInputHandler = GetInputHdl();
531cdf0e10cSrcweir if ( pInputHandler )
532cdf0e10cSrcweir pInputHandler->UpdateSpellSettings(); // EditEngine-Flags
533cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
534cdf0e10cSrcweir if ( pViewSh )
535cdf0e10cSrcweir pViewSh->UpdateDrawTextOutliner(); // EditEngine-Flags
536cdf0e10cSrcweir
537cdf0e10cSrcweir pDocSh->SetDocumentModified();
538cdf0e10cSrcweir }
539cdf0e10cSrcweir }
540cdf0e10cSrcweir }
541cdf0e10cSrcweir }
542cdf0e10cSrcweir break;
543cdf0e10cSrcweir
544cdf0e10cSrcweir case FID_FOCUS_POSWND:
545cdf0e10cSrcweir {
546cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
547cdf0e10cSrcweir if (pHdl)
548cdf0e10cSrcweir {
549cdf0e10cSrcweir ScInputWindow* pWin = pHdl->GetInputWindow();
550cdf0e10cSrcweir if (pWin)
551cdf0e10cSrcweir pWin->PosGrabFocus();
552cdf0e10cSrcweir }
553cdf0e10cSrcweir rReq.Done();
554cdf0e10cSrcweir }
555cdf0e10cSrcweir break;
556cdf0e10cSrcweir
557cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS:
558cdf0e10cSrcweir {
559cdf0e10cSrcweir try
560cdf0e10cSrcweir {
561cdf0e10cSrcweir com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), com::sun::star::uno::UNO_QUERY);
562cdf0e10cSrcweir if( xDialog.is() )
563cdf0e10cSrcweir {
564cdf0e10cSrcweir xDialog->execute();
565cdf0e10cSrcweir }
566cdf0e10cSrcweir }
567cdf0e10cSrcweir catch( ::com::sun::star::uno::RuntimeException& )
568cdf0e10cSrcweir {
569cdf0e10cSrcweir }
570cdf0e10cSrcweir }
571cdf0e10cSrcweir break;
572cdf0e10cSrcweir
573cdf0e10cSrcweir default:
574cdf0e10cSrcweir DBG_ERROR( "ScApplication: Unknown Message." );
575cdf0e10cSrcweir break;
576cdf0e10cSrcweir }
577cdf0e10cSrcweir }
578cdf0e10cSrcweir
GetState(SfxItemSet & rSet)579cdf0e10cSrcweir void ScModule::GetState( SfxItemSet& rSet )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir SfxWhichIter aIter(rSet);
582cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich();
583cdf0e10cSrcweir while ( nWhich )
584cdf0e10cSrcweir {
585cdf0e10cSrcweir switch ( nWhich )
586cdf0e10cSrcweir {
587cdf0e10cSrcweir case FID_AUTOCOMPLETE:
588cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetAppOptions().GetAutoComplete() ) );
589cdf0e10cSrcweir break;
590cdf0e10cSrcweir case SID_DETECTIVE_AUTO:
591cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, GetAppOptions().GetDetectiveAuto() ) );
592cdf0e10cSrcweir break;
593cdf0e10cSrcweir case SID_PSZ_FUNCTION:
594cdf0e10cSrcweir rSet.Put( SfxUInt16Item( nWhich, GetAppOptions().GetStatusFunc() ) );
595cdf0e10cSrcweir break;
596cdf0e10cSrcweir case SID_ATTR_METRIC:
597cdf0e10cSrcweir rSet.Put( SfxUInt16Item( nWhich, sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) );
598cdf0e10cSrcweir break;
599cdf0e10cSrcweir case SID_AUTOSPELL_CHECK:
600cdf0e10cSrcweir {
601cdf0e10cSrcweir sal_Bool bAuto;
602cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
603cdf0e10cSrcweir if ( pDocSh )
604cdf0e10cSrcweir bAuto = pDocSh->GetDocument()->GetDocOptions().IsAutoSpell();
605cdf0e10cSrcweir else
606cdf0e10cSrcweir {
607cdf0e10cSrcweir sal_uInt16 nDummyLang, nDummyCjk, nDummyCtl;
608cdf0e10cSrcweir GetSpellSettings( nDummyLang, nDummyCjk, nDummyCtl, bAuto );
609cdf0e10cSrcweir }
610cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bAuto ) );
611cdf0e10cSrcweir }
612cdf0e10cSrcweir break;
613cdf0e10cSrcweir case SID_ATTR_LANGUAGE:
614cdf0e10cSrcweir case ATTR_CJK_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CJK_LANGUAGE
615cdf0e10cSrcweir case ATTR_CTL_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CTL_LANGUAGE
616cdf0e10cSrcweir {
617cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
618cdf0e10cSrcweir ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL;
619cdf0e10cSrcweir if ( pDoc )
620cdf0e10cSrcweir {
621cdf0e10cSrcweir LanguageType eLatin, eCjk, eCtl;
622cdf0e10cSrcweir pDoc->GetLanguage( eLatin, eCjk, eCtl );
623cdf0e10cSrcweir LanguageType eLang = ( nWhich == ATTR_CJK_FONT_LANGUAGE ) ? eCjk :
624cdf0e10cSrcweir ( ( nWhich == ATTR_CTL_FONT_LANGUAGE ) ? eCtl : eLatin );
625cdf0e10cSrcweir rSet.Put( SvxLanguageItem( eLang, nWhich ) );
626cdf0e10cSrcweir }
627cdf0e10cSrcweir }
628cdf0e10cSrcweir break;
629cdf0e10cSrcweir
630cdf0e10cSrcweir }
631cdf0e10cSrcweir nWhich = aIter.NextWhich();
632cdf0e10cSrcweir }
633cdf0e10cSrcweir }
634cdf0e10cSrcweir
635cdf0e10cSrcweir
HideDisabledSlots(SfxItemSet & rSet)636cdf0e10cSrcweir void ScModule::HideDisabledSlots( SfxItemSet& rSet )
637cdf0e10cSrcweir {
638cdf0e10cSrcweir if( SfxViewFrame* pViewFrm = SfxViewFrame::Current() )
639cdf0e10cSrcweir {
640cdf0e10cSrcweir SfxBindings& rBindings = pViewFrm->GetBindings();
641cdf0e10cSrcweir SfxWhichIter aIter( rSet );
642cdf0e10cSrcweir for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich != 0; nWhich = aIter.NextWhich() )
643cdf0e10cSrcweir {
644cdf0e10cSrcweir ScViewUtil::HideDisabledSlot( rSet, rBindings, nWhich );
645cdf0e10cSrcweir // always disable the slots
646cdf0e10cSrcweir rSet.DisableItem( nWhich );
647cdf0e10cSrcweir }
648cdf0e10cSrcweir }
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir
652cdf0e10cSrcweir //------------------------------------------------------------------
653cdf0e10cSrcweir
ResetDragObject()654cdf0e10cSrcweir void ScModule::ResetDragObject()
655cdf0e10cSrcweir {
656cdf0e10cSrcweir aDragData.pCellTransfer = NULL;
657cdf0e10cSrcweir aDragData.pDrawTransfer = NULL;
658cdf0e10cSrcweir
659cdf0e10cSrcweir aDragData.aLinkDoc.Erase();
660cdf0e10cSrcweir aDragData.aLinkTable.Erase();
661cdf0e10cSrcweir aDragData.aLinkArea.Erase();
662cdf0e10cSrcweir aDragData.pJumpLocalDoc = NULL;
663cdf0e10cSrcweir aDragData.aJumpTarget.Erase();
664cdf0e10cSrcweir aDragData.aJumpText.Erase();
665cdf0e10cSrcweir }
666cdf0e10cSrcweir
SetDragObject(ScTransferObj * pCellObj,ScDrawTransferObj * pDrawObj)667cdf0e10cSrcweir void ScModule::SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj )
668cdf0e10cSrcweir {
669cdf0e10cSrcweir ResetDragObject();
670cdf0e10cSrcweir aDragData.pCellTransfer = pCellObj;
671cdf0e10cSrcweir aDragData.pDrawTransfer = pDrawObj;
672cdf0e10cSrcweir }
673cdf0e10cSrcweir
SetDragLink(const String & rDoc,const String & rTab,const String & rArea)674cdf0e10cSrcweir void ScModule::SetDragLink( const String& rDoc, const String& rTab, const String& rArea )
675cdf0e10cSrcweir {
676cdf0e10cSrcweir ResetDragObject();
677cdf0e10cSrcweir
678cdf0e10cSrcweir aDragData.aLinkDoc = rDoc;
679cdf0e10cSrcweir aDragData.aLinkTable = rTab;
680cdf0e10cSrcweir aDragData.aLinkArea = rArea;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir
SetDragJump(ScDocument * pLocalDoc,const String & rTarget,const String & rText)683cdf0e10cSrcweir void ScModule::SetDragJump( ScDocument* pLocalDoc, const String& rTarget, const String& rText )
684cdf0e10cSrcweir {
685cdf0e10cSrcweir ResetDragObject();
686cdf0e10cSrcweir
687cdf0e10cSrcweir aDragData.pJumpLocalDoc = pLocalDoc;
688cdf0e10cSrcweir aDragData.aJumpTarget = rTarget;
689cdf0e10cSrcweir aDragData.aJumpText = rText;
690cdf0e10cSrcweir }
691cdf0e10cSrcweir
692cdf0e10cSrcweir //------------------------------------------------------------------
693cdf0e10cSrcweir
SetClipObject(ScTransferObj * pCellObj,ScDrawTransferObj * pDrawObj)694cdf0e10cSrcweir void ScModule::SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir DBG_ASSERT( !pCellObj || !pDrawObj, "SetClipObject: not allowed to set both objects" );
697cdf0e10cSrcweir
698cdf0e10cSrcweir aClipData.pCellClipboard = pCellObj;
699cdf0e10cSrcweir aClipData.pDrawClipboard = pDrawObj;
700cdf0e10cSrcweir }
701cdf0e10cSrcweir
GetClipDoc()702cdf0e10cSrcweir ScDocument* ScModule::GetClipDoc()
703cdf0e10cSrcweir {
704cdf0e10cSrcweir // called from document
705cdf0e10cSrcweir
706cdf0e10cSrcweir ScTransferObj* pObj = ScTransferObj::GetOwnClipboard( NULL );
707cdf0e10cSrcweir if (pObj)
708cdf0e10cSrcweir return pObj->GetDocument();
709cdf0e10cSrcweir
710cdf0e10cSrcweir return NULL;
711cdf0e10cSrcweir }
712cdf0e10cSrcweir
713cdf0e10cSrcweir //------------------------------------------------------------------
714cdf0e10cSrcweir
SetSelectionTransfer(ScSelectionTransferObj * pNew)715cdf0e10cSrcweir void ScModule::SetSelectionTransfer( ScSelectionTransferObj* pNew )
716cdf0e10cSrcweir {
717cdf0e10cSrcweir pSelTransfer = pNew;
718cdf0e10cSrcweir }
719cdf0e10cSrcweir
720cdf0e10cSrcweir //------------------------------------------------------------------
721cdf0e10cSrcweir
InitFormEditData()722cdf0e10cSrcweir void ScModule::InitFormEditData()
723cdf0e10cSrcweir {
724cdf0e10cSrcweir pFormEditData = new ScFormEditData;
725cdf0e10cSrcweir }
726cdf0e10cSrcweir
ClearFormEditData()727cdf0e10cSrcweir void ScModule::ClearFormEditData()
728cdf0e10cSrcweir {
729cdf0e10cSrcweir DELETEZ( pFormEditData );
730cdf0e10cSrcweir }
731cdf0e10cSrcweir
732cdf0e10cSrcweir //------------------------------------------------------------------
733cdf0e10cSrcweir
SetViewOptions(const ScViewOptions & rOpt)734cdf0e10cSrcweir void ScModule::SetViewOptions( const ScViewOptions& rOpt )
735cdf0e10cSrcweir {
736cdf0e10cSrcweir if ( !pViewCfg )
737cdf0e10cSrcweir pViewCfg = new ScViewCfg;
738cdf0e10cSrcweir
739cdf0e10cSrcweir pViewCfg->SetOptions( rOpt );
740cdf0e10cSrcweir }
741cdf0e10cSrcweir
GetViewOptions()742cdf0e10cSrcweir const ScViewOptions& ScModule::GetViewOptions()
743cdf0e10cSrcweir {
744cdf0e10cSrcweir if ( !pViewCfg )
745cdf0e10cSrcweir pViewCfg = new ScViewCfg;
746cdf0e10cSrcweir
747cdf0e10cSrcweir return *pViewCfg;
748cdf0e10cSrcweir }
749cdf0e10cSrcweir
SetDocOptions(const ScDocOptions & rOpt)750cdf0e10cSrcweir void ScModule::SetDocOptions( const ScDocOptions& rOpt )
751cdf0e10cSrcweir {
752cdf0e10cSrcweir if ( !pDocCfg )
753cdf0e10cSrcweir pDocCfg = new ScDocCfg;
754cdf0e10cSrcweir
755cdf0e10cSrcweir pDocCfg->SetOptions( rOpt );
756cdf0e10cSrcweir }
757cdf0e10cSrcweir
GetDocOptions()758cdf0e10cSrcweir const ScDocOptions& ScModule::GetDocOptions()
759cdf0e10cSrcweir {
760cdf0e10cSrcweir if ( !pDocCfg )
761cdf0e10cSrcweir pDocCfg = new ScDocCfg;
762cdf0e10cSrcweir
763cdf0e10cSrcweir return *pDocCfg;
764cdf0e10cSrcweir }
765cdf0e10cSrcweir
766cdf0e10cSrcweir #ifndef LRU_MAX
767cdf0e10cSrcweir #define LRU_MAX 10
768cdf0e10cSrcweir #endif
769cdf0e10cSrcweir
InsertEntryToLRUList(sal_uInt16 nFIndex)770cdf0e10cSrcweir void ScModule::InsertEntryToLRUList(sal_uInt16 nFIndex)
771cdf0e10cSrcweir {
772cdf0e10cSrcweir if(nFIndex != 0)
773cdf0e10cSrcweir {
774cdf0e10cSrcweir const ScAppOptions& rAppOpt = GetAppOptions();
775cdf0e10cSrcweir sal_uInt16 nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (sal_uInt16)LRU_MAX );
776cdf0e10cSrcweir sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList();
777cdf0e10cSrcweir
778cdf0e10cSrcweir sal_uInt16 aIdxList[LRU_MAX];
779cdf0e10cSrcweir sal_uInt16 n = 0;
780cdf0e10cSrcweir sal_Bool bFound = sal_False;
781cdf0e10cSrcweir
782cdf0e10cSrcweir while ((n < LRU_MAX) && n<nLRUFuncCount) // alte Liste abklappern
783cdf0e10cSrcweir {
784cdf0e10cSrcweir if (!bFound && (pLRUListIds[n]== nFIndex))
785cdf0e10cSrcweir bFound = sal_True; // erster! Treffer
786cdf0e10cSrcweir else if (bFound)
787cdf0e10cSrcweir aIdxList[n ] = pLRUListIds[n]; // hinter Treffer kopieren
788cdf0e10cSrcweir else if ((n+1) < LRU_MAX)
789cdf0e10cSrcweir aIdxList[n+1] = pLRUListIds[n]; // vor Treffer verschieben
790cdf0e10cSrcweir n++;
791cdf0e10cSrcweir }
792cdf0e10cSrcweir if (!bFound && (n < LRU_MAX)) // Eintrag nicht gefunden?
793cdf0e10cSrcweir n++; // einen mehr
794cdf0e10cSrcweir aIdxList[0] = nFIndex; // Current on Top
795cdf0e10cSrcweir
796cdf0e10cSrcweir ScAppOptions aNewOpts(rAppOpt); // an App melden
797cdf0e10cSrcweir aNewOpts.SetLRUFuncList(aIdxList, n);
798cdf0e10cSrcweir SetAppOptions(aNewOpts);
799cdf0e10cSrcweir
800cdf0e10cSrcweir RecentFunctionsChanged();
801cdf0e10cSrcweir }
802cdf0e10cSrcweir }
803cdf0e10cSrcweir
RecentFunctionsChanged()804cdf0e10cSrcweir void ScModule::RecentFunctionsChanged()
805cdf0e10cSrcweir {
806cdf0e10cSrcweir // update function list window
807cdf0e10cSrcweir sal_uInt16 nFuncListID = ScFunctionChildWindow::GetChildWindowId();
808cdf0e10cSrcweir
809cdf0e10cSrcweir //! notify all views
810cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current();
811cdf0e10cSrcweir if ( pViewFrm && pViewFrm->HasChildWindow(nFuncListID) )
812cdf0e10cSrcweir {
813cdf0e10cSrcweir ScFunctionChildWindow* pWnd =(ScFunctionChildWindow*)pViewFrm->GetChildWindow( nFuncListID );
814cdf0e10cSrcweir
815cdf0e10cSrcweir ScFunctionDockWin* pFuncList=(ScFunctionDockWin*)pWnd->GetWindow();
816cdf0e10cSrcweir
817cdf0e10cSrcweir pFuncList->InitLRUList();
818cdf0e10cSrcweir }
819cdf0e10cSrcweir }
820cdf0e10cSrcweir
SetAppOptions(const ScAppOptions & rOpt)821cdf0e10cSrcweir void ScModule::SetAppOptions( const ScAppOptions& rOpt )
822cdf0e10cSrcweir {
823cdf0e10cSrcweir if ( !pAppCfg )
824cdf0e10cSrcweir pAppCfg = new ScAppCfg;
825cdf0e10cSrcweir
826cdf0e10cSrcweir pAppCfg->SetOptions( rOpt );
827cdf0e10cSrcweir }
828cdf0e10cSrcweir
global_InitAppOptions()829cdf0e10cSrcweir void global_InitAppOptions()
830cdf0e10cSrcweir {
831cdf0e10cSrcweir SC_MOD()->GetAppOptions();
832cdf0e10cSrcweir }
833cdf0e10cSrcweir
GetAppOptions()834cdf0e10cSrcweir const ScAppOptions& ScModule::GetAppOptions()
835cdf0e10cSrcweir {
836cdf0e10cSrcweir if ( !pAppCfg )
837cdf0e10cSrcweir pAppCfg = new ScAppCfg;
838cdf0e10cSrcweir
839cdf0e10cSrcweir return *pAppCfg;
840cdf0e10cSrcweir }
841cdf0e10cSrcweir
SetInputOptions(const ScInputOptions & rOpt)842cdf0e10cSrcweir void ScModule::SetInputOptions( const ScInputOptions& rOpt )
843cdf0e10cSrcweir {
844cdf0e10cSrcweir if ( !pInputCfg )
845cdf0e10cSrcweir pInputCfg = new ScInputCfg;
846cdf0e10cSrcweir
847cdf0e10cSrcweir pInputCfg->SetOptions( rOpt );
848cdf0e10cSrcweir }
849cdf0e10cSrcweir
GetInputOptions()850cdf0e10cSrcweir const ScInputOptions& ScModule::GetInputOptions()
851cdf0e10cSrcweir {
852cdf0e10cSrcweir if ( !pInputCfg )
853cdf0e10cSrcweir pInputCfg = new ScInputCfg;
854cdf0e10cSrcweir
855cdf0e10cSrcweir return *pInputCfg;
856cdf0e10cSrcweir }
857cdf0e10cSrcweir
SetPrintOptions(const ScPrintOptions & rOpt)858cdf0e10cSrcweir void ScModule::SetPrintOptions( const ScPrintOptions& rOpt )
859cdf0e10cSrcweir {
860cdf0e10cSrcweir if ( !pPrintCfg )
861cdf0e10cSrcweir pPrintCfg = new ScPrintCfg;
862cdf0e10cSrcweir
863cdf0e10cSrcweir pPrintCfg->SetOptions( rOpt );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir
GetPrintOptions()866cdf0e10cSrcweir const ScPrintOptions& ScModule::GetPrintOptions()
867cdf0e10cSrcweir {
868cdf0e10cSrcweir if ( !pPrintCfg )
869cdf0e10cSrcweir pPrintCfg = new ScPrintCfg;
870cdf0e10cSrcweir
871cdf0e10cSrcweir return *pPrintCfg;
872cdf0e10cSrcweir }
873cdf0e10cSrcweir
GetNavipiCfg()874cdf0e10cSrcweir ScNavipiCfg& ScModule::GetNavipiCfg()
875cdf0e10cSrcweir {
876cdf0e10cSrcweir if ( !pNavipiCfg )
877cdf0e10cSrcweir pNavipiCfg = new ScNavipiCfg;
878cdf0e10cSrcweir
879cdf0e10cSrcweir return *pNavipiCfg;
880cdf0e10cSrcweir }
881cdf0e10cSrcweir
GetAddInCfg()882cdf0e10cSrcweir ScAddInCfg& ScModule::GetAddInCfg()
883cdf0e10cSrcweir {
884cdf0e10cSrcweir if ( !pAddInCfg )
885cdf0e10cSrcweir pAddInCfg = new ScAddInCfg;
886cdf0e10cSrcweir
887cdf0e10cSrcweir return *pAddInCfg;
888cdf0e10cSrcweir }
889cdf0e10cSrcweir
GetColorConfig()890cdf0e10cSrcweir svtools::ColorConfig& ScModule::GetColorConfig()
891cdf0e10cSrcweir {
892cdf0e10cSrcweir if ( !pColorConfig )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir pColorConfig = new svtools::ColorConfig;
895cdf0e10cSrcweir pColorConfig->AddListener(this);
896cdf0e10cSrcweir }
897cdf0e10cSrcweir
898cdf0e10cSrcweir return *pColorConfig;
899cdf0e10cSrcweir }
900cdf0e10cSrcweir
GetAccessOptions()901cdf0e10cSrcweir SvtAccessibilityOptions& ScModule::GetAccessOptions()
902cdf0e10cSrcweir {
903cdf0e10cSrcweir if ( !pAccessOptions )
904cdf0e10cSrcweir {
905cdf0e10cSrcweir pAccessOptions = new SvtAccessibilityOptions;
906cdf0e10cSrcweir pAccessOptions->AddListener(this);
907cdf0e10cSrcweir }
908cdf0e10cSrcweir
909cdf0e10cSrcweir return *pAccessOptions;
910cdf0e10cSrcweir }
911cdf0e10cSrcweir
GetCTLOptions()912cdf0e10cSrcweir SvtCTLOptions& ScModule::GetCTLOptions()
913cdf0e10cSrcweir {
914cdf0e10cSrcweir if ( !pCTLOptions )
915cdf0e10cSrcweir {
916cdf0e10cSrcweir pCTLOptions = new SvtCTLOptions;
917cdf0e10cSrcweir pCTLOptions->AddListener(this);
918cdf0e10cSrcweir }
919cdf0e10cSrcweir
920cdf0e10cSrcweir return *pCTLOptions;
921cdf0e10cSrcweir }
922cdf0e10cSrcweir
GetUserOptions()923cdf0e10cSrcweir SvtUserOptions& ScModule::GetUserOptions()
924cdf0e10cSrcweir {
925cdf0e10cSrcweir if( !pUserOptions )
926cdf0e10cSrcweir {
927cdf0e10cSrcweir pUserOptions = new SvtUserOptions;
928cdf0e10cSrcweir }
929cdf0e10cSrcweir return *pUserOptions;
930cdf0e10cSrcweir }
931cdf0e10cSrcweir
GetOptDigitLanguage()932cdf0e10cSrcweir sal_uInt16 ScModule::GetOptDigitLanguage()
933cdf0e10cSrcweir {
934cdf0e10cSrcweir SvtCTLOptions::TextNumerals eNumerals = GetCTLOptions().GetCTLTextNumerals();
935cdf0e10cSrcweir return ( eNumerals == SvtCTLOptions::NUMERALS_ARABIC ) ? LANGUAGE_ENGLISH_US :
936cdf0e10cSrcweir ( eNumerals == SvtCTLOptions::NUMERALS_HINDI) ? LANGUAGE_ARABIC_SAUDI_ARABIA :
937cdf0e10cSrcweir LANGUAGE_SYSTEM;
938cdf0e10cSrcweir }
939cdf0e10cSrcweir
940cdf0e10cSrcweir //------------------------------------------------------------------
941cdf0e10cSrcweir //
942cdf0e10cSrcweir // Optionen
943cdf0e10cSrcweir //
944cdf0e10cSrcweir //------------------------------------------------------------------
945cdf0e10cSrcweir
946cdf0e10cSrcweir //
947cdf0e10cSrcweir // ModifyOptions - Items aus Calc-Options-Dialog
948cdf0e10cSrcweir // und SID_AUTOSPELL_CHECK
949cdf0e10cSrcweir //
950cdf0e10cSrcweir
951cdf0e10cSrcweir #define IS_AVAILABLE(w,item) (SFX_ITEM_SET==rOptSet.GetItemState((w),sal_True,&item))
952cdf0e10cSrcweir
ModifyOptions(const SfxItemSet & rOptSet)953cdf0e10cSrcweir void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
954cdf0e10cSrcweir {
955cdf0e10cSrcweir sal_uInt16 nOldSpellLang, nOldCjkLang, nOldCtlLang;
956cdf0e10cSrcweir sal_Bool bOldAutoSpell;
957cdf0e10cSrcweir GetSpellSettings( nOldSpellLang, nOldCjkLang, nOldCtlLang, bOldAutoSpell );
958cdf0e10cSrcweir
959cdf0e10cSrcweir if (!pAppCfg)
960cdf0e10cSrcweir GetAppOptions();
961cdf0e10cSrcweir DBG_ASSERT( pAppCfg, "AppOptions not initialised :-(" );
962cdf0e10cSrcweir
963cdf0e10cSrcweir if (!pInputCfg)
964cdf0e10cSrcweir GetInputOptions();
965cdf0e10cSrcweir DBG_ASSERT( pInputCfg, "InputOptions not initialised :-(" );
966cdf0e10cSrcweir
967cdf0e10cSrcweir //--------------------------------------------------------------
968cdf0e10cSrcweir
969cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current();
970cdf0e10cSrcweir SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : NULL;
971cdf0e10cSrcweir
972cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
973cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
974cdf0e10cSrcweir ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL;
975cdf0e10cSrcweir const SfxPoolItem* pItem = NULL;
976cdf0e10cSrcweir sal_Bool bRepaint = sal_False;
977cdf0e10cSrcweir sal_Bool bUpdateMarks = sal_False;
978cdf0e10cSrcweir sal_Bool bUpdateRefDev = sal_False;
979cdf0e10cSrcweir sal_Bool bCalcAll = sal_False;
980cdf0e10cSrcweir sal_Bool bSaveSpellCheck = sal_False;
981cdf0e10cSrcweir sal_Bool bSaveAppOptions = sal_False;
982cdf0e10cSrcweir sal_Bool bSaveInputOptions = sal_False;
983cdf0e10cSrcweir
984cdf0e10cSrcweir //--------------------------------------------------------------------------
985cdf0e10cSrcweir
986cdf0e10cSrcweir // SFX_APP()->SetOptions( rOptSet );
987cdf0e10cSrcweir
988cdf0e10cSrcweir // Linguistik nicht mehr
989cdf0e10cSrcweir
990cdf0e10cSrcweir if ( IS_AVAILABLE(SID_ATTR_METRIC,pItem) )
991cdf0e10cSrcweir {
992cdf0e10cSrcweir PutItem( *pItem );
993cdf0e10cSrcweir pAppCfg->SetAppMetric( (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue() );
994cdf0e10cSrcweir bSaveAppOptions = sal_True;
995cdf0e10cSrcweir }
996cdf0e10cSrcweir
997cdf0e10cSrcweir if ( IS_AVAILABLE(SCITEM_USERLIST,pItem) )
998cdf0e10cSrcweir {
999cdf0e10cSrcweir ScGlobal::SetUserList( ((const ScUserListItem*)pItem)->GetUserList() );
1000cdf0e10cSrcweir bSaveAppOptions = sal_True;
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir
1003cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_OPT_SYNCZOOM,pItem) )
1004cdf0e10cSrcweir {
1005cdf0e10cSrcweir pAppCfg->SetSynchronizeZoom( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
1006cdf0e10cSrcweir bSaveAppOptions = sal_True;
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir
1009cdf0e10cSrcweir //============================================
1010cdf0e10cSrcweir // ViewOptions
1011cdf0e10cSrcweir //============================================
1012cdf0e10cSrcweir
1013cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SCVIEWOPTIONS,pItem) )
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir const ScViewOptions& rNewOpt = ((const ScTpViewItem*)pItem)->GetViewOptions();
1016cdf0e10cSrcweir
1017cdf0e10cSrcweir if ( pViewSh )
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir ScViewData* pViewData = pViewSh->GetViewData();
1020cdf0e10cSrcweir const ScViewOptions& rOldOpt = pViewData->GetOptions();
1021cdf0e10cSrcweir
1022cdf0e10cSrcweir sal_Bool bAnchorList = ( rOldOpt.GetOption( VOPT_ANCHOR ) !=
1023cdf0e10cSrcweir rNewOpt.GetOption( VOPT_ANCHOR ) );
1024cdf0e10cSrcweir
1025cdf0e10cSrcweir if ( rOldOpt != rNewOpt )
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir pViewData->SetOptions( rNewOpt ); // veraendert rOldOpt
1028cdf0e10cSrcweir pViewData->GetDocument()->SetViewOptions( rNewOpt );
1029cdf0e10cSrcweir pDocSh->SetDocumentModified();
1030cdf0e10cSrcweir bRepaint = sal_True;
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir if ( bAnchorList )
1033cdf0e10cSrcweir pViewSh->UpdateAnchorHandles();
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir SetViewOptions( rNewOpt );
1036cdf0e10cSrcweir if (pBindings)
1037*facb16e7SArmin Le Grand {
1038cdf0e10cSrcweir pBindings->Invalidate(SID_HELPLINES_MOVE);
1039*facb16e7SArmin Le Grand pBindings->Invalidate(SID_SCGRIDSHOW);
1040*facb16e7SArmin Le Grand }
1041cdf0e10cSrcweir }
1042cdf0e10cSrcweir
1043cdf0e10cSrcweir //============================================
1044cdf0e10cSrcweir // GridOptions, Auswertung nach ViewOptions,
1045cdf0e10cSrcweir // da GridOptions Member der ViewOptions ist!
1046cdf0e10cSrcweir //============================================
1047cdf0e10cSrcweir
1048cdf0e10cSrcweir if ( IS_AVAILABLE(SID_ATTR_GRID_OPTIONS,pItem) )
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir ScGridOptions aNewGridOpt( (const SvxOptionsGrid&)((const SvxGridItem&)*pItem) );
1051cdf0e10cSrcweir
1052cdf0e10cSrcweir if ( pViewSh )
1053cdf0e10cSrcweir {
1054cdf0e10cSrcweir ScViewData* pViewData = pViewSh->GetViewData();
1055cdf0e10cSrcweir ScViewOptions aNewViewOpt( pViewData->GetOptions() );
1056cdf0e10cSrcweir const ScGridOptions& rOldGridOpt = aNewViewOpt.GetGridOptions();
1057cdf0e10cSrcweir
1058cdf0e10cSrcweir if ( rOldGridOpt != aNewGridOpt )
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir aNewViewOpt.SetGridOptions( aNewGridOpt );
1061cdf0e10cSrcweir pViewData->SetOptions( aNewViewOpt );
1062cdf0e10cSrcweir pViewData->GetDocument()->SetViewOptions( aNewViewOpt );
1063cdf0e10cSrcweir pDocSh->SetDocumentModified();
1064cdf0e10cSrcweir bRepaint = sal_True;
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir ScViewOptions aNewViewOpt ( GetViewOptions() );
1068cdf0e10cSrcweir aNewViewOpt.SetGridOptions( aNewGridOpt );
1069cdf0e10cSrcweir SetViewOptions( aNewViewOpt );
1070cdf0e10cSrcweir if (pBindings)
1071cdf0e10cSrcweir {
1072cdf0e10cSrcweir pBindings->Invalidate(SID_GRID_VISIBLE);
1073cdf0e10cSrcweir pBindings->Invalidate(SID_GRID_USE);
1074cdf0e10cSrcweir }
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir
1077cdf0e10cSrcweir
1078cdf0e10cSrcweir //============================================
1079cdf0e10cSrcweir // DocOptions
1080cdf0e10cSrcweir //============================================
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SCDOCOPTIONS,pItem) )
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir const ScDocOptions& rNewOpt = ((const ScTpCalcItem*)pItem)->GetDocOptions();
1085cdf0e10cSrcweir
1086cdf0e10cSrcweir if ( pDoc )
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir const ScDocOptions& rOldOpt = pDoc->GetDocOptions();
1089cdf0e10cSrcweir
1090cdf0e10cSrcweir bRepaint = ( bRepaint || ( rOldOpt != rNewOpt ) );
1091cdf0e10cSrcweir bCalcAll = bRepaint &&
1092cdf0e10cSrcweir ( rOldOpt.IsIter() != rNewOpt.IsIter()
1093cdf0e10cSrcweir || rOldOpt.GetIterCount() != rNewOpt.GetIterCount()
1094cdf0e10cSrcweir || rOldOpt.GetIterEps() != rNewOpt.GetIterEps()
1095cdf0e10cSrcweir || rOldOpt.IsIgnoreCase() != rNewOpt.IsIgnoreCase()
1096cdf0e10cSrcweir || rOldOpt.IsCalcAsShown() != rNewOpt.IsCalcAsShown()
1097cdf0e10cSrcweir || (rNewOpt.IsCalcAsShown() &&
1098cdf0e10cSrcweir rOldOpt.GetStdPrecision() != rNewOpt.GetStdPrecision())
1099cdf0e10cSrcweir || rOldOpt.IsMatchWholeCell() != rNewOpt.IsMatchWholeCell()
1100cdf0e10cSrcweir || rOldOpt.GetYear2000() != rNewOpt.GetYear2000()
1101cdf0e10cSrcweir || rOldOpt.IsFormulaRegexEnabled() != rNewOpt.IsFormulaRegexEnabled()
1102cdf0e10cSrcweir );
1103cdf0e10cSrcweir pDoc->SetDocOptions( rNewOpt );
1104cdf0e10cSrcweir pDocSh->SetDocumentModified();
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir SetDocOptions( rNewOpt );
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir
1109cdf0e10cSrcweir // nach den eigentlichen DocOptions auch noch die TabDistance setzen
1110cdf0e10cSrcweir if ( IS_AVAILABLE(SID_ATTR_DEFTABSTOP,pItem) )
1111cdf0e10cSrcweir {
1112cdf0e10cSrcweir sal_uInt16 nTabDist = ((SfxUInt16Item*)pItem)->GetValue();
1113cdf0e10cSrcweir ScDocOptions aOpt(GetDocOptions());
1114cdf0e10cSrcweir aOpt.SetTabDistance(nTabDist);
1115cdf0e10cSrcweir SetDocOptions( aOpt );
1116cdf0e10cSrcweir
1117cdf0e10cSrcweir if ( pDoc )
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir ScDocOptions aDocOpt(pDoc->GetDocOptions());
1120cdf0e10cSrcweir aDocOpt.SetTabDistance(nTabDist);
1121cdf0e10cSrcweir pDoc->SetDocOptions( aDocOpt );
1122cdf0e10cSrcweir pDocSh->SetDocumentModified();
1123cdf0e10cSrcweir if(pDoc->GetDrawLayer())
1124cdf0e10cSrcweir pDoc->GetDrawLayer()->SetDefaultTabulator(nTabDist);
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir }
1127cdf0e10cSrcweir
1128cdf0e10cSrcweir // AutoSpell nach den Doc-Options (weil Member)
1129cdf0e10cSrcweir
1130cdf0e10cSrcweir if ( IS_AVAILABLE(SID_AUTOSPELL_CHECK,pItem) ) // an Doc-Options
1131cdf0e10cSrcweir {
1132cdf0e10cSrcweir sal_Bool bDoAutoSpell = ((const SfxBoolItem*)pItem)->GetValue();
1133cdf0e10cSrcweir
1134cdf0e10cSrcweir if (pDoc)
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir ScDocOptions aNewOpt = pDoc->GetDocOptions();
1137cdf0e10cSrcweir if ( aNewOpt.IsAutoSpell() != bDoAutoSpell )
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir aNewOpt.SetAutoSpell( bDoAutoSpell );
1140cdf0e10cSrcweir pDoc->SetDocOptions( aNewOpt );
1141cdf0e10cSrcweir
1142cdf0e10cSrcweir if (bDoAutoSpell)
1143cdf0e10cSrcweir pDoc->SetOnlineSpellPos( ScAddress(0,0,0) ); // vorne anfangen
1144cdf0e10cSrcweir else
1145cdf0e10cSrcweir {
1146cdf0e10cSrcweir WaitObject aWait( pDocSh->GetActiveDialogParent() );
1147cdf0e10cSrcweir pDoc->RemoveAutoSpellObj(); // Edit-Text-Objekte wieder zurueckwandeln
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir
1150cdf0e10cSrcweir //#92038#; don't set document modified, because this flag is no longer saved
1151cdf0e10cSrcweir // pDocSh->SetDocumentModified();
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir bRepaint = sal_True; // weil HideAutoSpell evtl. ungueltig
1154cdf0e10cSrcweir //! alle Views painten ???
1155cdf0e10cSrcweir }
1156cdf0e10cSrcweir }
1157cdf0e10cSrcweir
1158cdf0e10cSrcweir if ( bOldAutoSpell != bDoAutoSpell )
1159cdf0e10cSrcweir {
1160cdf0e10cSrcweir SetAutoSpellProperty( bDoAutoSpell );
1161cdf0e10cSrcweir bSaveSpellCheck = sal_True;
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir if ( pDocSh )
1164cdf0e10cSrcweir pDocSh->PostPaintGridAll(); // wegen Markierungen
1165cdf0e10cSrcweir ScInputHandler* pInputHandler = GetInputHdl();
1166cdf0e10cSrcweir if ( pInputHandler )
1167cdf0e10cSrcweir pInputHandler->UpdateSpellSettings(); // EditEngine-Flags
1168cdf0e10cSrcweir if ( pViewSh )
1169cdf0e10cSrcweir pViewSh->UpdateDrawTextOutliner(); // EditEngine-Flags
1170cdf0e10cSrcweir
1171cdf0e10cSrcweir if (pBindings)
1172cdf0e10cSrcweir pBindings->Invalidate( SID_AUTOSPELL_CHECK );
1173cdf0e10cSrcweir }
1174cdf0e10cSrcweir
1175cdf0e10cSrcweir //============================================
1176cdf0e10cSrcweir // InputOptions
1177cdf0e10cSrcweir //============================================
1178cdf0e10cSrcweir
1179cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_SELECTIONPOS,pItem) )
1180cdf0e10cSrcweir {
1181cdf0e10cSrcweir pInputCfg->SetMoveDir( ((const SfxUInt16Item*)pItem)->GetValue() );
1182cdf0e10cSrcweir bSaveInputOptions = sal_True;
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_SELECTION,pItem) )
1185cdf0e10cSrcweir {
1186cdf0e10cSrcweir pInputCfg->SetMoveSelection( ((const SfxBoolItem*)pItem)->GetValue() );
1187cdf0e10cSrcweir bSaveInputOptions = sal_True;
1188cdf0e10cSrcweir }
1189cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_EDITMODE,pItem) )
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir pInputCfg->SetEnterEdit( ((const SfxBoolItem*)pItem)->GetValue() );
1192cdf0e10cSrcweir bSaveInputOptions = sal_True;
1193cdf0e10cSrcweir }
1194cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_FMT_EXPAND,pItem) )
1195cdf0e10cSrcweir {
1196cdf0e10cSrcweir pInputCfg->SetExtendFormat( ((const SfxBoolItem*)pItem)->GetValue() );
1197cdf0e10cSrcweir bSaveInputOptions = sal_True;
1198cdf0e10cSrcweir }
1199cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_RANGEFINDER,pItem) )
1200cdf0e10cSrcweir {
1201cdf0e10cSrcweir pInputCfg->SetRangeFinder( ((const SfxBoolItem*)pItem)->GetValue() );
1202cdf0e10cSrcweir bSaveInputOptions = sal_True;
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_REF_EXPAND,pItem) )
1205cdf0e10cSrcweir {
1206cdf0e10cSrcweir pInputCfg->SetExpandRefs( ((const SfxBoolItem*)pItem)->GetValue() );
1207cdf0e10cSrcweir bSaveInputOptions = sal_True;
1208cdf0e10cSrcweir }
1209cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_MARK_HEADER,pItem) )
1210cdf0e10cSrcweir {
1211cdf0e10cSrcweir pInputCfg->SetMarkHeader( ((const SfxBoolItem*)pItem)->GetValue() );
1212cdf0e10cSrcweir bSaveInputOptions = sal_True;
1213cdf0e10cSrcweir bUpdateMarks = sal_True;
1214cdf0e10cSrcweir }
1215cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SC_INPUT_TEXTWYSIWYG,pItem) )
1216cdf0e10cSrcweir {
1217cdf0e10cSrcweir sal_Bool bNew = ((const SfxBoolItem*)pItem)->GetValue();
1218cdf0e10cSrcweir if ( bNew != pInputCfg->GetTextWysiwyg() )
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir pInputCfg->SetTextWysiwyg( bNew );
1221cdf0e10cSrcweir bSaveInputOptions = sal_True;
1222cdf0e10cSrcweir bUpdateRefDev = sal_True;
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir }
1225cdf0e10cSrcweir if( IS_AVAILABLE( SID_SC_INPUT_REPLCELLSWARN, pItem ) )
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir pInputCfg->SetReplaceCellsWarn( ((const SfxBoolItem*)pItem)->GetValue() );
1228cdf0e10cSrcweir bSaveInputOptions = sal_True;
1229cdf0e10cSrcweir }
1230cdf0e10cSrcweir
1231cdf0e10cSrcweir //============================================
1232cdf0e10cSrcweir // PrintOptions
1233cdf0e10cSrcweir //============================================
1234cdf0e10cSrcweir
1235cdf0e10cSrcweir if ( IS_AVAILABLE(SID_SCPRINTOPTIONS,pItem) )
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir const ScPrintOptions& rNewOpt = ((const ScTpPrintItem*)pItem)->GetPrintOptions();
1238cdf0e10cSrcweir SetPrintOptions( rNewOpt );
1239cdf0e10cSrcweir
1240cdf0e10cSrcweir // broadcast causes all previews to recalc page numbers
1241cdf0e10cSrcweir SFX_APP()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS ) );
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir
1244cdf0e10cSrcweir //----------------------------------------------------------
1245cdf0e10cSrcweir
1246cdf0e10cSrcweir // if ( bSaveSpellCheck )
1247cdf0e10cSrcweir // {
1248cdf0e10cSrcweir // currently LinguProperties are saved only at program exit.
1249cdf0e10cSrcweir // if a save method becomes available, it should be called here.
1250cdf0e10cSrcweir // }
1251cdf0e10cSrcweir
1252cdf0e10cSrcweir if ( bSaveAppOptions )
1253cdf0e10cSrcweir pAppCfg->OptionsChanged();
1254cdf0e10cSrcweir
1255cdf0e10cSrcweir if ( bSaveInputOptions )
1256cdf0e10cSrcweir pInputCfg->OptionsChanged();
1257cdf0e10cSrcweir
1258cdf0e10cSrcweir // Neuberechnung anstossen?
1259cdf0e10cSrcweir
1260cdf0e10cSrcweir if ( pDoc && bCalcAll )
1261cdf0e10cSrcweir {
1262cdf0e10cSrcweir WaitObject aWait( pDocSh->GetActiveDialogParent() );
1263cdf0e10cSrcweir pDoc->CalcAll();
1264cdf0e10cSrcweir if ( pViewSh )
1265cdf0e10cSrcweir pViewSh->UpdateCharts( sal_True );
1266cdf0e10cSrcweir else
1267cdf0e10cSrcweir ScDBFunc::DoUpdateCharts( ScAddress(), pDoc, sal_True );
1268cdf0e10cSrcweir if (pBindings)
1269cdf0e10cSrcweir pBindings->Invalidate( SID_ATTR_SIZE ); //SvxPosSize-StatusControl-Update
1270cdf0e10cSrcweir }
1271cdf0e10cSrcweir
1272cdf0e10cSrcweir if ( pViewSh && bUpdateMarks )
1273cdf0e10cSrcweir pViewSh->UpdateAutoFillMark();
1274cdf0e10cSrcweir
1275cdf0e10cSrcweir // View neuzeichnen?
1276cdf0e10cSrcweir
1277cdf0e10cSrcweir if ( pViewSh && bRepaint )
1278cdf0e10cSrcweir {
1279cdf0e10cSrcweir pViewSh->UpdateFixPos();
1280cdf0e10cSrcweir pViewSh->PaintGrid();
1281cdf0e10cSrcweir pViewSh->PaintTop();
1282cdf0e10cSrcweir pViewSh->PaintLeft();
1283cdf0e10cSrcweir pViewSh->PaintExtras();
1284cdf0e10cSrcweir pViewSh->InvalidateBorder();
1285cdf0e10cSrcweir if (pBindings)
1286cdf0e10cSrcweir {
1287cdf0e10cSrcweir pBindings->Invalidate( FID_TOGGLEHEADERS ); // -> Checks im Menue
1288cdf0e10cSrcweir pBindings->Invalidate( FID_TOGGLESYNTAX );
1289cdf0e10cSrcweir }
1290cdf0e10cSrcweir }
1291cdf0e10cSrcweir
1292cdf0e10cSrcweir // update ref device (for all documents)
1293cdf0e10cSrcweir
1294cdf0e10cSrcweir if ( bUpdateRefDev )
1295cdf0e10cSrcweir {
1296cdf0e10cSrcweir // for all documents: recalc output factor, update row heights
1297cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
1298cdf0e10cSrcweir while ( pObjSh )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir if ( pObjSh->Type() == TYPE(ScDocShell) )
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir ScDocShell* pOneDocSh = ((ScDocShell*)pObjSh);
1303cdf0e10cSrcweir pOneDocSh->CalcOutputFactor();
1304cdf0e10cSrcweir SCTAB nTabCount = pOneDocSh->GetDocument()->GetTableCount();
1305cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++)
1306cdf0e10cSrcweir pOneDocSh->AdjustRowHeight( 0, MAXROW, nTab );
1307cdf0e10cSrcweir }
1308cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh );
1309cdf0e10cSrcweir }
1310cdf0e10cSrcweir
1311cdf0e10cSrcweir // for all (tab-) views:
1312cdf0e10cSrcweir TypeId aScType = TYPE(ScTabViewShell);
1313cdf0e10cSrcweir SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType );
1314cdf0e10cSrcweir while ( pSh )
1315cdf0e10cSrcweir {
1316cdf0e10cSrcweir ScTabViewShell* pOneViewSh = (ScTabViewShell*)pSh;
1317cdf0e10cSrcweir
1318cdf0e10cSrcweir // set ref-device for EditEngine
1319cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl(pOneViewSh);
1320cdf0e10cSrcweir if (pHdl)
1321cdf0e10cSrcweir pHdl->UpdateRefDevice();
1322cdf0e10cSrcweir
1323cdf0e10cSrcweir // update view scale
1324cdf0e10cSrcweir ScViewData* pViewData = pOneViewSh->GetViewData();
1325cdf0e10cSrcweir pOneViewSh->SetZoom( pViewData->GetZoomX(), pViewData->GetZoomY(), sal_False );
1326cdf0e10cSrcweir
1327cdf0e10cSrcweir // repaint
1328cdf0e10cSrcweir pOneViewSh->PaintGrid();
1329cdf0e10cSrcweir pOneViewSh->PaintTop();
1330cdf0e10cSrcweir pOneViewSh->PaintLeft();
1331cdf0e10cSrcweir
1332cdf0e10cSrcweir pSh = SfxViewShell::GetNext( *pSh, &aScType );
1333cdf0e10cSrcweir }
1334cdf0e10cSrcweir }
1335cdf0e10cSrcweir }
1336cdf0e10cSrcweir
1337cdf0e10cSrcweir #undef IS_AVAILABLE
1338cdf0e10cSrcweir
1339cdf0e10cSrcweir //------------------------------------------------------------------
1340cdf0e10cSrcweir //
1341cdf0e10cSrcweir // Input-Handler
1342cdf0e10cSrcweir //
1343cdf0e10cSrcweir //------------------------------------------------------------------
1344cdf0e10cSrcweir
GetInputHdl(ScTabViewShell * pViewSh,sal_Bool bUseRef)1345cdf0e10cSrcweir ScInputHandler* ScModule::GetInputHdl( ScTabViewShell* pViewSh, sal_Bool bUseRef )
1346cdf0e10cSrcweir {
1347cdf0e10cSrcweir if ( pRefInputHandler && bUseRef )
1348cdf0e10cSrcweir return pRefInputHandler;
1349cdf0e10cSrcweir
1350cdf0e10cSrcweir ScInputHandler* pHdl = NULL;
1351cdf0e10cSrcweir if ( !pViewSh )
1352cdf0e10cSrcweir {
1353cdf0e10cSrcweir // in case a UIActive embedded object has no ViewShell ( UNO component )
1354cdf0e10cSrcweir // the own calc view shell will be set as current, but no handling should happen
1355cdf0e10cSrcweir
1356cdf0e10cSrcweir ScTabViewShell* pCurViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
1357cdf0e10cSrcweir if ( pCurViewSh && !pCurViewSh->GetUIActiveClient() )
1358cdf0e10cSrcweir pViewSh = pCurViewSh;
1359cdf0e10cSrcweir }
1360cdf0e10cSrcweir
1361cdf0e10cSrcweir if ( pViewSh )
1362cdf0e10cSrcweir pHdl = pViewSh->GetInputHandler(); // Viewshell hat jetzt immer einen
1363cdf0e10cSrcweir
1364cdf0e10cSrcweir // #57989# wenn keine ViewShell uebergeben oder aktiv, kann NULL herauskommen
1365cdf0e10cSrcweir DBG_ASSERT( pHdl || !pViewSh, "GetInputHdl: kein InputHandler gefunden" );
1366cdf0e10cSrcweir return pHdl;
1367cdf0e10cSrcweir }
1368cdf0e10cSrcweir
ViewShellChanged()1369cdf0e10cSrcweir void ScModule::ViewShellChanged()
1370cdf0e10cSrcweir {
1371cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1372cdf0e10cSrcweir ScTabViewShell* pShell = ScTabViewShell::GetActiveViewShell();
1373cdf0e10cSrcweir if ( pShell && pHdl )
1374cdf0e10cSrcweir pShell->UpdateInputHandler();
1375cdf0e10cSrcweir }
1376cdf0e10cSrcweir
SetInputMode(ScInputMode eMode)1377cdf0e10cSrcweir void ScModule::SetInputMode( ScInputMode eMode )
1378cdf0e10cSrcweir {
1379cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1380cdf0e10cSrcweir if (pHdl)
1381cdf0e10cSrcweir pHdl->SetMode( eMode );
1382cdf0e10cSrcweir }
1383cdf0e10cSrcweir
IsEditMode()1384cdf0e10cSrcweir sal_Bool ScModule::IsEditMode()
1385cdf0e10cSrcweir {
1386cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1387cdf0e10cSrcweir return pHdl && pHdl->IsEditMode();
1388cdf0e10cSrcweir }
1389cdf0e10cSrcweir
IsInputMode()1390cdf0e10cSrcweir sal_Bool ScModule::IsInputMode()
1391cdf0e10cSrcweir {
1392cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1393cdf0e10cSrcweir return pHdl && pHdl->IsInputMode();
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir
InputKeyEvent(const KeyEvent & rKEvt,sal_Bool bStartEdit)1396cdf0e10cSrcweir sal_Bool ScModule::InputKeyEvent( const KeyEvent& rKEvt, sal_Bool bStartEdit )
1397cdf0e10cSrcweir {
1398cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1399cdf0e10cSrcweir return ( pHdl ? pHdl->KeyInput( rKEvt, bStartEdit ) : sal_False );
1400cdf0e10cSrcweir }
1401cdf0e10cSrcweir
InputEnterHandler(sal_uInt8 nBlockMode)1402cdf0e10cSrcweir void ScModule::InputEnterHandler( sal_uInt8 nBlockMode )
1403cdf0e10cSrcweir {
1404cdf0e10cSrcweir if ( !SFX_APP()->IsDowning() ) // nicht beim Programmende
1405cdf0e10cSrcweir {
1406cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1407cdf0e10cSrcweir if (pHdl)
1408cdf0e10cSrcweir pHdl->EnterHandler( nBlockMode );
1409cdf0e10cSrcweir }
1410cdf0e10cSrcweir }
1411cdf0e10cSrcweir
InputCancelHandler()1412cdf0e10cSrcweir void ScModule::InputCancelHandler()
1413cdf0e10cSrcweir {
1414cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1415cdf0e10cSrcweir if (pHdl)
1416cdf0e10cSrcweir pHdl->CancelHandler();
1417cdf0e10cSrcweir }
1418cdf0e10cSrcweir
InputSelection(EditView * pView)1419cdf0e10cSrcweir void ScModule::InputSelection( EditView* pView )
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1422cdf0e10cSrcweir if (pHdl)
1423cdf0e10cSrcweir pHdl->InputSelection( pView );
1424cdf0e10cSrcweir }
1425cdf0e10cSrcweir
InputChanged(EditView * pView)1426cdf0e10cSrcweir void ScModule::InputChanged( EditView* pView )
1427cdf0e10cSrcweir {
1428cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1429cdf0e10cSrcweir if (pHdl)
1430cdf0e10cSrcweir pHdl->InputChanged( pView );
1431cdf0e10cSrcweir }
1432cdf0e10cSrcweir
ViewShellGone(ScTabViewShell * pViewSh)1433cdf0e10cSrcweir void ScModule::ViewShellGone( ScTabViewShell* pViewSh )
1434cdf0e10cSrcweir {
1435cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1436cdf0e10cSrcweir if (pHdl)
1437cdf0e10cSrcweir pHdl->ViewShellGone( pViewSh );
1438cdf0e10cSrcweir }
1439cdf0e10cSrcweir
SetRefInputHdl(ScInputHandler * pNew)1440cdf0e10cSrcweir void ScModule::SetRefInputHdl( ScInputHandler* pNew )
1441cdf0e10cSrcweir {
1442cdf0e10cSrcweir pRefInputHandler = pNew;
1443cdf0e10cSrcweir }
1444cdf0e10cSrcweir
GetRefInputHdl()1445cdf0e10cSrcweir ScInputHandler* ScModule::GetRefInputHdl()
1446cdf0e10cSrcweir {
1447cdf0e10cSrcweir return pRefInputHandler;
1448cdf0e10cSrcweir }
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir //------------------------------------------------------------------------
1451cdf0e10cSrcweir // Olk's Krempel:
1452cdf0e10cSrcweir
InputGetSelection(xub_StrLen & rStart,xub_StrLen & rEnd)1453cdf0e10cSrcweir void ScModule::InputGetSelection( xub_StrLen& rStart, xub_StrLen& rEnd )
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1456cdf0e10cSrcweir if (pHdl)
1457cdf0e10cSrcweir pHdl->InputGetSelection( rStart, rEnd );
1458cdf0e10cSrcweir }
1459cdf0e10cSrcweir
InputSetSelection(xub_StrLen nStart,xub_StrLen nEnd)1460cdf0e10cSrcweir void ScModule::InputSetSelection( xub_StrLen nStart, xub_StrLen nEnd )
1461cdf0e10cSrcweir {
1462cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1463cdf0e10cSrcweir if (pHdl)
1464cdf0e10cSrcweir pHdl->InputSetSelection( nStart, nEnd );
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir
InputReplaceSelection(const String & rStr)1467cdf0e10cSrcweir void ScModule::InputReplaceSelection( const String& rStr )
1468cdf0e10cSrcweir {
1469cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1470cdf0e10cSrcweir if (pHdl)
1471cdf0e10cSrcweir pHdl->InputReplaceSelection( rStr );
1472cdf0e10cSrcweir }
1473cdf0e10cSrcweir
InputGetFormulaStr()1474cdf0e10cSrcweir String ScModule::InputGetFormulaStr()
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1477cdf0e10cSrcweir String aStr;
1478cdf0e10cSrcweir if ( pHdl )
1479cdf0e10cSrcweir aStr = pHdl->InputGetFormulaStr();
1480cdf0e10cSrcweir return aStr;
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir
ActivateInputWindow(const String * pStrFormula,sal_Bool bMatrix)1483cdf0e10cSrcweir void ScModule::ActivateInputWindow( const String* pStrFormula, sal_Bool bMatrix )
1484cdf0e10cSrcweir {
1485cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1486cdf0e10cSrcweir if ( pHdl )
1487cdf0e10cSrcweir {
1488cdf0e10cSrcweir ScInputWindow* pWin = pHdl->GetInputWindow();
1489cdf0e10cSrcweir if ( pStrFormula )
1490cdf0e10cSrcweir {
1491cdf0e10cSrcweir // Formel uebernehmen
1492cdf0e10cSrcweir if ( pWin )
1493cdf0e10cSrcweir {
1494cdf0e10cSrcweir pWin->SetFuncString( *pStrFormula, sal_False );
1495cdf0e10cSrcweir // SetSumAssignMode wegen sal_False nicht noetig
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir sal_uInt8 nMode = bMatrix ? SC_ENTER_MATRIX : SC_ENTER_NORMAL;
1498cdf0e10cSrcweir pHdl->EnterHandler( nMode );
1499cdf0e10cSrcweir
1500cdf0e10cSrcweir // ohne Invalidate bleibt die Selektion stehen, wenn die Formel unveraendert ist
1501cdf0e10cSrcweir if (pWin)
1502cdf0e10cSrcweir pWin->TextInvalidate();
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir else
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir // Abbrechen
1507cdf0e10cSrcweir if ( pWin )
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir pWin->SetFuncString( EMPTY_STRING, sal_False );
1510cdf0e10cSrcweir // SetSumAssignMode wegen sal_False nicht noetig
1511cdf0e10cSrcweir }
1512cdf0e10cSrcweir pHdl->CancelHandler();
1513cdf0e10cSrcweir }
1514cdf0e10cSrcweir }
1515cdf0e10cSrcweir }
1516cdf0e10cSrcweir
1517cdf0e10cSrcweir //------------------------------------------------------------------
1518cdf0e10cSrcweir //
1519cdf0e10cSrcweir // Referenz - Dialoge
1520cdf0e10cSrcweir //
1521cdf0e10cSrcweir //------------------------------------------------------------------
1522cdf0e10cSrcweir
SetRefDialog(sal_uInt16 nId,sal_Bool bVis,SfxViewFrame * pViewFrm)1523cdf0e10cSrcweir void ScModule::SetRefDialog( sal_uInt16 nId, sal_Bool bVis, SfxViewFrame* pViewFrm )
1524cdf0e10cSrcweir {
1525cdf0e10cSrcweir //! move reference dialog handling to view
1526cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1527cdf0e10cSrcweir
1528cdf0e10cSrcweir if(nCurRefDlgId==0 || (nId==nCurRefDlgId && !bVis))
1529cdf0e10cSrcweir {
1530cdf0e10cSrcweir if ( !pViewFrm )
1531cdf0e10cSrcweir pViewFrm = SfxViewFrame::Current();
1532cdf0e10cSrcweir
1533cdf0e10cSrcweir // #79379# bindings update causes problems with update of stylist if
1534cdf0e10cSrcweir // current style family has changed
1535cdf0e10cSrcweir //if ( pViewFrm )
1536cdf0e10cSrcweir // pViewFrm->GetBindings().Update(); // to avoid trouble in LockDispatcher
1537cdf0e10cSrcweir
1538cdf0e10cSrcweir nCurRefDlgId = bVis ? nId : 0 ; // before SetChildWindow
1539cdf0e10cSrcweir
1540cdf0e10cSrcweir if ( pViewFrm )
1541cdf0e10cSrcweir {
1542cdf0e10cSrcweir // store the dialog id also in the view shell
1543cdf0e10cSrcweir SfxViewShell* pViewSh = pViewFrm->GetViewShell();
1544cdf0e10cSrcweir if ( pViewSh && pViewSh->ISA( ScTabViewShell ) )
1545cdf0e10cSrcweir ((ScTabViewShell*)pViewSh)->SetCurRefDlgId( nCurRefDlgId );
1546cdf0e10cSrcweir else
1547cdf0e10cSrcweir {
1548cdf0e10cSrcweir // no ScTabViewShell - possible for example from a Basic macro
1549cdf0e10cSrcweir bVis = sal_False;
1550cdf0e10cSrcweir nCurRefDlgId = 0; // don't set nCurRefDlgId if no dialog is created
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir
1553cdf0e10cSrcweir pViewFrm->SetChildWindow( nId, bVis );
1554cdf0e10cSrcweir }
1555cdf0e10cSrcweir
1556cdf0e10cSrcweir SfxApplication* pSfxApp = SFX_APP();
1557cdf0e10cSrcweir pSfxApp->Broadcast( SfxSimpleHint( FID_REFMODECHANGED ) );
1558cdf0e10cSrcweir }
1559cdf0e10cSrcweir }
1560cdf0e10cSrcweir
lcl_GetChildWinFromAnyView(sal_uInt16 nId)1561cdf0e10cSrcweir SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId )
1562cdf0e10cSrcweir {
1563cdf0e10cSrcweir // first try the current view
1564cdf0e10cSrcweir
1565cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1566cdf0e10cSrcweir // #i46999# current view frame can be null (for example, when closing help)
1567cdf0e10cSrcweir SfxChildWindow* pChildWnd = pViewFrm ? pViewFrm->GetChildWindow( nId ) : NULL;
1568cdf0e10cSrcweir if ( pChildWnd )
1569cdf0e10cSrcweir return pChildWnd; // found in the current view
1570cdf0e10cSrcweir
1571cdf0e10cSrcweir // if not found there, get the child window from any open view
1572cdf0e10cSrcweir // it can be open only in one view because nCurRefDlgId is global
1573cdf0e10cSrcweir
1574cdf0e10cSrcweir pViewFrm = SfxViewFrame::GetFirst();
1575cdf0e10cSrcweir while ( pViewFrm )
1576cdf0e10cSrcweir {
1577cdf0e10cSrcweir pChildWnd = pViewFrm->GetChildWindow( nId );
1578cdf0e10cSrcweir if ( pChildWnd )
1579cdf0e10cSrcweir return pChildWnd; // found in any view
1580cdf0e10cSrcweir
1581cdf0e10cSrcweir pViewFrm = SfxViewFrame::GetNext( *pViewFrm );
1582cdf0e10cSrcweir }
1583cdf0e10cSrcweir
1584cdf0e10cSrcweir return NULL; // none found
1585cdf0e10cSrcweir }
1586cdf0e10cSrcweir
IsModalMode(SfxObjectShell * pDocSh)1587cdf0e10cSrcweir sal_Bool ScModule::IsModalMode(SfxObjectShell* pDocSh)
1588cdf0e10cSrcweir {
1589cdf0e10cSrcweir //! move reference dialog handling to view
1590cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1591cdf0e10cSrcweir
1592cdf0e10cSrcweir sal_Bool bIsModal = sal_False;
1593cdf0e10cSrcweir
1594cdf0e10cSrcweir if ( nCurRefDlgId )
1595cdf0e10cSrcweir {
1596cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1597cdf0e10cSrcweir if ( pChildWnd )
1598cdf0e10cSrcweir {
1599cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
1600cdf0e10cSrcweir bIsModal = pChildWnd->IsVisible() &&
1601cdf0e10cSrcweir !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) );
1602cdf0e10cSrcweir }
1603cdf0e10cSrcweir else
1604cdf0e10cSrcweir {
1605cdf0e10cSrcweir // in 592 and above, the dialog isn't visible in other views
1606cdf0e10cSrcweir // if the dialog is open but can't be accessed, disable input
1607cdf0e10cSrcweir
1608cdf0e10cSrcweir bIsModal = sal_True;
1609cdf0e10cSrcweir }
1610cdf0e10cSrcweir
1611cdf0e10cSrcweir // pChildWnd kann 0 sein, wenn der Dialog nach dem Umschalten
1612cdf0e10cSrcweir // von einer anderen Shell noch nicht erzeugt wurde (z.B. in GetFocus)
1613cdf0e10cSrcweir }
1614cdf0e10cSrcweir else if (pDocSh)
1615cdf0e10cSrcweir {
1616cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1617cdf0e10cSrcweir if ( pHdl )
1618cdf0e10cSrcweir bIsModal = pHdl->IsModalMode(pDocSh);
1619cdf0e10cSrcweir }
1620cdf0e10cSrcweir
1621cdf0e10cSrcweir return bIsModal;
1622cdf0e10cSrcweir }
1623cdf0e10cSrcweir
IsTableLocked()1624cdf0e10cSrcweir sal_Bool ScModule::IsTableLocked()
1625cdf0e10cSrcweir {
1626cdf0e10cSrcweir //! move reference dialog handling to view
1627cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1628cdf0e10cSrcweir
1629cdf0e10cSrcweir sal_Bool bLocked = sal_False;
1630cdf0e10cSrcweir
1631cdf0e10cSrcweir // bisher nur bei ScAnyRefDlg
1632cdf0e10cSrcweir
1633cdf0e10cSrcweir if ( nCurRefDlgId )
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1636cdf0e10cSrcweir if ( pChildWnd )
1637cdf0e10cSrcweir bLocked = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow())->IsTableLocked();
1638cdf0e10cSrcweir else
1639cdf0e10cSrcweir bLocked = sal_True; // for other views, see IsModalMode
1640cdf0e10cSrcweir }
1641cdf0e10cSrcweir
1642cdf0e10cSrcweir return bLocked;
1643cdf0e10cSrcweir }
1644cdf0e10cSrcweir
IsRefDialogOpen()1645cdf0e10cSrcweir sal_Bool ScModule::IsRefDialogOpen()
1646cdf0e10cSrcweir {
1647cdf0e10cSrcweir //! move reference dialog handling to view
1648cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1649cdf0e10cSrcweir
1650cdf0e10cSrcweir sal_Bool bIsOpen = sal_False;
1651cdf0e10cSrcweir
1652cdf0e10cSrcweir if ( nCurRefDlgId )
1653cdf0e10cSrcweir {
1654cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1655cdf0e10cSrcweir if ( pChildWnd )
1656cdf0e10cSrcweir bIsOpen = pChildWnd->IsVisible();
1657cdf0e10cSrcweir else
1658cdf0e10cSrcweir bIsOpen = sal_True; // for other views, see IsModalMode
1659cdf0e10cSrcweir }
1660cdf0e10cSrcweir
1661cdf0e10cSrcweir return bIsOpen;
1662cdf0e10cSrcweir }
1663cdf0e10cSrcweir
IsFormulaMode()1664cdf0e10cSrcweir sal_Bool ScModule::IsFormulaMode()
1665cdf0e10cSrcweir {
1666cdf0e10cSrcweir //! move reference dialog handling to view
1667cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1668cdf0e10cSrcweir
1669cdf0e10cSrcweir sal_Bool bIsFormula = sal_False;
1670cdf0e10cSrcweir
1671cdf0e10cSrcweir if ( nCurRefDlgId )
1672cdf0e10cSrcweir {
1673cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1674cdf0e10cSrcweir if ( pChildWnd )
1675cdf0e10cSrcweir {
1676cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
1677cdf0e10cSrcweir bIsFormula = pChildWnd->IsVisible() && pRefDlg->IsRefInputMode();
1678cdf0e10cSrcweir }
1679cdf0e10cSrcweir }
1680cdf0e10cSrcweir else
1681cdf0e10cSrcweir {
1682cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1683cdf0e10cSrcweir if ( pHdl )
1684cdf0e10cSrcweir bIsFormula = pHdl->IsFormulaMode();
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir
1687cdf0e10cSrcweir if (bIsInEditCommand)
1688cdf0e10cSrcweir bIsFormula = sal_True;
1689cdf0e10cSrcweir
1690cdf0e10cSrcweir return bIsFormula;
1691cdf0e10cSrcweir }
1692cdf0e10cSrcweir
lcl_MarkedTabs(const ScMarkData & rMark,SCTAB & rStartTab,SCTAB & rEndTab)1693cdf0e10cSrcweir void lcl_MarkedTabs( const ScMarkData& rMark, SCTAB& rStartTab, SCTAB& rEndTab )
1694cdf0e10cSrcweir {
1695cdf0e10cSrcweir if (rMark.GetSelectCount() > 1)
1696cdf0e10cSrcweir {
1697cdf0e10cSrcweir sal_Bool bFirst = sal_True;
1698cdf0e10cSrcweir for (SCTAB i=0; i<=MAXTAB; i++)
1699cdf0e10cSrcweir if (rMark.GetTableSelect(i))
1700cdf0e10cSrcweir {
1701cdf0e10cSrcweir if (bFirst)
1702cdf0e10cSrcweir rStartTab = i;
1703cdf0e10cSrcweir rEndTab = i;
1704cdf0e10cSrcweir bFirst = sal_False;
1705cdf0e10cSrcweir }
1706cdf0e10cSrcweir }
1707cdf0e10cSrcweir }
1708cdf0e10cSrcweir
SetReference(const ScRange & rRef,ScDocument * pDoc,const ScMarkData * pMarkData)1709cdf0e10cSrcweir void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc,
1710cdf0e10cSrcweir const ScMarkData* pMarkData )
1711cdf0e10cSrcweir {
1712cdf0e10cSrcweir //! move reference dialog handling to view
1713cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1714cdf0e10cSrcweir
1715cdf0e10cSrcweir // in Ref-Dialogen wird hiermit auch das Zoom-In ausgeloest,
1716cdf0e10cSrcweir // wenn Start und Ende der Ref unterschiedlich sind
1717cdf0e10cSrcweir
1718cdf0e10cSrcweir ScRange aNew = rRef;
1719cdf0e10cSrcweir aNew.Justify(); // immer "richtig herum"
1720cdf0e10cSrcweir
1721cdf0e10cSrcweir if( nCurRefDlgId )
1722cdf0e10cSrcweir {
1723cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1724cdf0e10cSrcweir DBG_ASSERT( pChildWnd, "NoChildWin" );
1725cdf0e10cSrcweir if ( pChildWnd )
1726cdf0e10cSrcweir {
1727cdf0e10cSrcweir if ( nCurRefDlgId == SID_OPENDLG_CONSOLIDATE && pMarkData )
1728cdf0e10cSrcweir {
1729cdf0e10cSrcweir SCTAB nStartTab = aNew.aStart.Tab();
1730cdf0e10cSrcweir SCTAB nEndTab = aNew.aEnd.Tab();
1731cdf0e10cSrcweir lcl_MarkedTabs( *pMarkData, nStartTab, nEndTab );
1732cdf0e10cSrcweir aNew.aStart.SetTab(nStartTab);
1733cdf0e10cSrcweir aNew.aEnd.SetTab(nEndTab);
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir
1736cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
1737cdf0e10cSrcweir
1738cdf0e10cSrcweir // hide the (color) selection now instead of later from LoseFocus,
1739cdf0e10cSrcweir // don't abort the ref input that causes this call (bDoneRefMode = sal_False)
1740cdf0e10cSrcweir pRefDlg->HideReference( sal_False );
1741cdf0e10cSrcweir pRefDlg->SetReference( aNew, pDoc );
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir }
1744cdf0e10cSrcweir else
1745cdf0e10cSrcweir {
1746cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1747cdf0e10cSrcweir if (pHdl)
1748cdf0e10cSrcweir pHdl->SetReference( aNew, pDoc );
1749cdf0e10cSrcweir else
1750cdf0e10cSrcweir {
1751cdf0e10cSrcweir DBG_ERROR("SetReference ohne Empfaenger");
1752cdf0e10cSrcweir }
1753cdf0e10cSrcweir }
1754cdf0e10cSrcweir }
1755cdf0e10cSrcweir
AddRefEntry()1756cdf0e10cSrcweir void ScModule::AddRefEntry() // "Mehrfachselektion"
1757cdf0e10cSrcweir {
1758cdf0e10cSrcweir //! move reference dialog handling to view
1759cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1760cdf0e10cSrcweir
1761cdf0e10cSrcweir if ( nCurRefDlgId )
1762cdf0e10cSrcweir {
1763cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1764cdf0e10cSrcweir DBG_ASSERT( pChildWnd, "NoChildWin" );
1765cdf0e10cSrcweir if ( pChildWnd )
1766cdf0e10cSrcweir {
1767cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
1768cdf0e10cSrcweir pRefDlg->AddRefEntry();
1769cdf0e10cSrcweir }
1770cdf0e10cSrcweir }
1771cdf0e10cSrcweir else
1772cdf0e10cSrcweir {
1773cdf0e10cSrcweir ScInputHandler* pHdl = GetInputHdl();
1774cdf0e10cSrcweir if (pHdl)
1775cdf0e10cSrcweir pHdl->AddRefEntry();
1776cdf0e10cSrcweir }
1777cdf0e10cSrcweir }
1778cdf0e10cSrcweir
EndReference()1779cdf0e10cSrcweir void ScModule::EndReference()
1780cdf0e10cSrcweir {
1781cdf0e10cSrcweir //! move reference dialog handling to view
1782cdf0e10cSrcweir //! (only keep function autopilot here for references to other documents)
1783cdf0e10cSrcweir
1784cdf0e10cSrcweir // in Ref-Dialogen wird hiermit auch das Zoom-In wieder aufgehoben
1785cdf0e10cSrcweir
1786cdf0e10cSrcweir //! ShowRefFrame am InputHdl, wenn der Funktions-AP offen ist ???
1787cdf0e10cSrcweir
1788cdf0e10cSrcweir if ( nCurRefDlgId )
1789cdf0e10cSrcweir {
1790cdf0e10cSrcweir SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
1791cdf0e10cSrcweir DBG_ASSERT( pChildWnd, "NoChildWin" );
1792cdf0e10cSrcweir if ( pChildWnd )
1793cdf0e10cSrcweir {
1794cdf0e10cSrcweir IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
1795cdf0e10cSrcweir pRefDlg->SetActive();
1796cdf0e10cSrcweir }
1797cdf0e10cSrcweir }
1798cdf0e10cSrcweir }
1799cdf0e10cSrcweir
1800cdf0e10cSrcweir //------------------------------------------------------------------
1801cdf0e10cSrcweir //
1802cdf0e10cSrcweir // Idle / Online-Spelling
1803cdf0e10cSrcweir //
1804cdf0e10cSrcweir //------------------------------------------------------------------
1805cdf0e10cSrcweir
AnythingChanged()1806cdf0e10cSrcweir void ScModule::AnythingChanged()
1807cdf0e10cSrcweir {
1808cdf0e10cSrcweir sal_uLong nOldTime = aIdleTimer.GetTimeout();
1809cdf0e10cSrcweir if ( nOldTime != SC_IDLE_MIN )
1810cdf0e10cSrcweir aIdleTimer.SetTimeout( SC_IDLE_MIN );
1811cdf0e10cSrcweir
1812cdf0e10cSrcweir nIdleCount = 0;
1813cdf0e10cSrcweir }
1814cdf0e10cSrcweir
lcl_CheckNeedsRepaint(ScDocShell * pDocShell)1815cdf0e10cSrcweir void lcl_CheckNeedsRepaint( ScDocShell* pDocShell )
1816cdf0e10cSrcweir {
1817cdf0e10cSrcweir SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
1818cdf0e10cSrcweir while ( pFrame )
1819cdf0e10cSrcweir {
1820cdf0e10cSrcweir SfxViewShell* p = pFrame->GetViewShell();
1821cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p);
1822cdf0e10cSrcweir if ( pViewSh )
1823cdf0e10cSrcweir pViewSh->CheckNeedsRepaint();
1824cdf0e10cSrcweir pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
1825cdf0e10cSrcweir }
1826cdf0e10cSrcweir }
1827cdf0e10cSrcweir
IMPL_LINK(ScModule,IdleHandler,Timer *,EMPTYARG)1828cdf0e10cSrcweir IMPL_LINK( ScModule, IdleHandler, Timer*, EMPTYARG )
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir if ( Application::AnyInput( INPUT_MOUSEANDKEYBOARD ) )
1831cdf0e10cSrcweir {
1832cdf0e10cSrcweir aIdleTimer.Start(); // Timeout unveraendert
1833cdf0e10cSrcweir return 0;
1834cdf0e10cSrcweir }
1835cdf0e10cSrcweir
1836cdf0e10cSrcweir sal_Bool bMore = sal_False;
1837cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() );
1838cdf0e10cSrcweir if ( pDocSh )
1839cdf0e10cSrcweir {
1840cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
1841cdf0e10cSrcweir
1842cdf0e10cSrcweir sal_Bool bLinks = pDoc->IdleCheckLinks();
1843cdf0e10cSrcweir sal_Bool bWidth = pDoc->IdleCalcTextWidth();
1844cdf0e10cSrcweir sal_Bool bSpell = pDoc->ContinueOnlineSpelling();
1845cdf0e10cSrcweir if ( bSpell )
1846cdf0e10cSrcweir aSpellTimer.Start(); // da ist noch was
1847cdf0e10cSrcweir
1848cdf0e10cSrcweir bMore = bLinks || bWidth || bSpell; // ueberhaupt noch was?
1849cdf0e10cSrcweir
1850cdf0e10cSrcweir // While calculating a Basic formula, a paint event may have occured,
1851cdf0e10cSrcweir // so check the bNeedsRepaint flags for this document's views
1852cdf0e10cSrcweir if (bWidth)
1853cdf0e10cSrcweir lcl_CheckNeedsRepaint( pDocSh );
1854cdf0e10cSrcweir }
1855cdf0e10cSrcweir
1856cdf0e10cSrcweir sal_uLong nOldTime = aIdleTimer.GetTimeout();
1857cdf0e10cSrcweir sal_uLong nNewTime = nOldTime;
1858cdf0e10cSrcweir if ( bMore )
1859cdf0e10cSrcweir {
1860cdf0e10cSrcweir nNewTime = SC_IDLE_MIN;
1861cdf0e10cSrcweir nIdleCount = 0;
1862cdf0e10cSrcweir }
1863cdf0e10cSrcweir else
1864cdf0e10cSrcweir {
1865cdf0e10cSrcweir // SC_IDLE_COUNT mal mit initialem Timeout, dann hochzaehlen
1866cdf0e10cSrcweir
1867cdf0e10cSrcweir if ( nIdleCount < SC_IDLE_COUNT )
1868cdf0e10cSrcweir ++nIdleCount;
1869cdf0e10cSrcweir else
1870cdf0e10cSrcweir {
1871cdf0e10cSrcweir nNewTime += SC_IDLE_STEP;
1872cdf0e10cSrcweir if ( nNewTime > SC_IDLE_MAX )
1873cdf0e10cSrcweir nNewTime = SC_IDLE_MAX;
1874cdf0e10cSrcweir }
1875cdf0e10cSrcweir }
1876cdf0e10cSrcweir if ( nNewTime != nOldTime )
1877cdf0e10cSrcweir aIdleTimer.SetTimeout( nNewTime );
1878cdf0e10cSrcweir
1879cdf0e10cSrcweir aIdleTimer.Start();
1880cdf0e10cSrcweir return 0;
1881cdf0e10cSrcweir }
1882cdf0e10cSrcweir
IMPL_LINK(ScModule,SpellTimerHdl,Timer *,EMPTYARG)1883cdf0e10cSrcweir IMPL_LINK( ScModule, SpellTimerHdl, Timer*, EMPTYARG )
1884cdf0e10cSrcweir {
1885cdf0e10cSrcweir if ( Application::AnyInput( INPUT_KEYBOARD ) )
1886cdf0e10cSrcweir {
1887cdf0e10cSrcweir aSpellTimer.Start();
1888cdf0e10cSrcweir return 0; // dann spaeter wieder...
1889cdf0e10cSrcweir }
1890cdf0e10cSrcweir
1891cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() );
1892cdf0e10cSrcweir if ( pDocSh )
1893cdf0e10cSrcweir {
1894cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument();
1895cdf0e10cSrcweir if ( pDoc->ContinueOnlineSpelling() )
1896cdf0e10cSrcweir aSpellTimer.Start();
1897cdf0e10cSrcweir }
1898cdf0e10cSrcweir return 0;
1899cdf0e10cSrcweir }
1900cdf0e10cSrcweir
1901cdf0e10cSrcweir //virtuelle Methoden fuer den Optionendialog
CreateItemSet(sal_uInt16 nId)1902cdf0e10cSrcweir SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId )
1903cdf0e10cSrcweir {
1904cdf0e10cSrcweir SfxItemSet* pRet = 0;
1905cdf0e10cSrcweir if(SID_SC_EDITOPTIONS == nId)
1906cdf0e10cSrcweir {
1907cdf0e10cSrcweir pRet = new SfxItemSet( GetPool(),
1908cdf0e10cSrcweir // TP_CALC:
1909cdf0e10cSrcweir SID_SCDOCOPTIONS, SID_SCDOCOPTIONS,
1910cdf0e10cSrcweir // TP_VIEW:
1911cdf0e10cSrcweir SID_SCVIEWOPTIONS, SID_SCVIEWOPTIONS,
1912cdf0e10cSrcweir SID_SC_OPT_SYNCZOOM, SID_SC_OPT_SYNCZOOM,
1913cdf0e10cSrcweir // TP_INPUT:
1914cdf0e10cSrcweir SID_SC_INPUT_SELECTION,SID_SC_INPUT_MARK_HEADER,
1915cdf0e10cSrcweir SID_SC_INPUT_TEXTWYSIWYG,SID_SC_INPUT_TEXTWYSIWYG,
1916cdf0e10cSrcweir SID_SC_INPUT_REPLCELLSWARN,SID_SC_INPUT_REPLCELLSWARN,
1917cdf0e10cSrcweir // TP_USERLISTS:
1918cdf0e10cSrcweir SCITEM_USERLIST, SCITEM_USERLIST,
1919cdf0e10cSrcweir // TP_PRINT:
1920cdf0e10cSrcweir SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
1921cdf0e10cSrcweir // TP_GRID:
1922cdf0e10cSrcweir SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
1923cdf0e10cSrcweir //
1924cdf0e10cSrcweir SID_ATTR_METRIC, SID_ATTR_METRIC,
1925cdf0e10cSrcweir SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
1926cdf0e10cSrcweir 0 );
1927cdf0e10cSrcweir
1928cdf0e10cSrcweir ScDocShell* pDocSh = PTR_CAST(ScDocShell,
1929cdf0e10cSrcweir SfxObjectShell::Current());
1930cdf0e10cSrcweir ScDocOptions aCalcOpt = pDocSh
1931cdf0e10cSrcweir ? pDocSh->GetDocument()->GetDocOptions()
1932cdf0e10cSrcweir : GetDocOptions();
1933cdf0e10cSrcweir
1934cdf0e10cSrcweir ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,
1935cdf0e10cSrcweir SfxViewShell::Current());
1936cdf0e10cSrcweir ScViewOptions aViewOpt = pViewSh
1937cdf0e10cSrcweir ? pViewSh->GetViewData()->GetOptions()
1938cdf0e10cSrcweir : GetViewOptions();
1939cdf0e10cSrcweir
1940cdf0e10cSrcweir ScUserListItem aULItem( SCITEM_USERLIST );
1941cdf0e10cSrcweir ScUserList* pUL = ScGlobal::GetUserList();
1942cdf0e10cSrcweir
1943cdf0e10cSrcweir // SFX_APP()->GetOptions( aSet );
1944cdf0e10cSrcweir
1945cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_METRIC,
1946cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) );
1947cdf0e10cSrcweir
1948cdf0e10cSrcweir // TP_CALC
1949cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP,
1950cdf0e10cSrcweir aCalcOpt.GetTabDistance()));
1951cdf0e10cSrcweir pRet->Put( ScTpCalcItem( SID_SCDOCOPTIONS, aCalcOpt ) );
1952cdf0e10cSrcweir
1953cdf0e10cSrcweir // TP_VIEW
1954cdf0e10cSrcweir pRet->Put( ScTpViewItem( SID_SCVIEWOPTIONS, aViewOpt ) );
1955cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_OPT_SYNCZOOM, GetAppOptions().GetSynchronizeZoom() ) );
1956cdf0e10cSrcweir
1957cdf0e10cSrcweir // TP_INPUT
1958cdf0e10cSrcweir const ScInputOptions& rInpOpt = GetInputOptions();
1959cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_SC_INPUT_SELECTIONPOS,
1960cdf0e10cSrcweir rInpOpt.GetMoveDir() ) );
1961cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_SELECTION,
1962cdf0e10cSrcweir rInpOpt.GetMoveSelection() ) );
1963cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_EDITMODE,
1964cdf0e10cSrcweir rInpOpt.GetEnterEdit() ) );
1965cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_FMT_EXPAND,
1966cdf0e10cSrcweir rInpOpt.GetExtendFormat() ) );
1967cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_RANGEFINDER,
1968cdf0e10cSrcweir rInpOpt.GetRangeFinder() ) );
1969cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_REF_EXPAND,
1970cdf0e10cSrcweir rInpOpt.GetExpandRefs() ) );
1971cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_MARK_HEADER,
1972cdf0e10cSrcweir rInpOpt.GetMarkHeader() ) );
1973cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_TEXTWYSIWYG,
1974cdf0e10cSrcweir rInpOpt.GetTextWysiwyg() ) );
1975cdf0e10cSrcweir pRet->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN,
1976cdf0e10cSrcweir rInpOpt.GetReplaceCellsWarn() ) );
1977cdf0e10cSrcweir
1978cdf0e10cSrcweir // RID_SC_TP_PRINT
1979cdf0e10cSrcweir pRet->Put( ScTpPrintItem( SID_SCPRINTOPTIONS, GetPrintOptions() ) );
1980cdf0e10cSrcweir
1981cdf0e10cSrcweir // TP_GRID
1982cdf0e10cSrcweir SvxGridItem* pSvxGridItem = aViewOpt.CreateGridItem();
1983cdf0e10cSrcweir pRet->Put( *pSvxGridItem );
1984cdf0e10cSrcweir delete pSvxGridItem;
1985cdf0e10cSrcweir
1986cdf0e10cSrcweir // TP_USERLISTS
1987cdf0e10cSrcweir if ( pUL )
1988cdf0e10cSrcweir aULItem.SetUserList( *pUL );
1989cdf0e10cSrcweir pRet->Put( aULItem );
1990cdf0e10cSrcweir
1991cdf0e10cSrcweir }
1992cdf0e10cSrcweir return pRet;
1993cdf0e10cSrcweir }
1994cdf0e10cSrcweir
ApplyItemSet(sal_uInt16 nId,const SfxItemSet & rSet)1995cdf0e10cSrcweir void ScModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
1996cdf0e10cSrcweir {
1997cdf0e10cSrcweir if(SID_SC_EDITOPTIONS == nId)
1998cdf0e10cSrcweir {
1999cdf0e10cSrcweir ModifyOptions( rSet );
2000cdf0e10cSrcweir }
2001cdf0e10cSrcweir }
2002cdf0e10cSrcweir
CreateTabPage(sal_uInt16 nId,Window * pParent,const SfxItemSet & rSet)2003cdf0e10cSrcweir SfxTabPage* ScModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
2004cdf0e10cSrcweir {
2005cdf0e10cSrcweir SfxTabPage* pRet = NULL;
2006cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
2007cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
2008cdf0e10cSrcweir switch(nId)
2009cdf0e10cSrcweir {
2010cdf0e10cSrcweir case SID_SC_TP_LAYOUT:
2011cdf0e10cSrcweir {
2012cdf0e10cSrcweir //CHINA001 pRet = ScTpLayoutOptions::Create(pParent, rSet);
2013cdf0e10cSrcweir ::CreateTabPage ScTpLayoutOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_LAYOUT );
2014cdf0e10cSrcweir if ( ScTpLayoutOptionsCreate )
2015cdf0e10cSrcweir pRet = (*ScTpLayoutOptionsCreate) (pParent, rSet);
2016cdf0e10cSrcweir }
2017cdf0e10cSrcweir break;
2018cdf0e10cSrcweir case SID_SC_TP_CONTENT:
2019cdf0e10cSrcweir {
2020cdf0e10cSrcweir //CHINA001 pRet = ScTpContentOptions::Create(pParent, rSet);
2021cdf0e10cSrcweir ::CreateTabPage ScTpContentOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SCPAGE_CONTENT);
2022cdf0e10cSrcweir if ( ScTpContentOptionsCreate )
2023cdf0e10cSrcweir pRet = (*ScTpContentOptionsCreate)(pParent, rSet);
2024cdf0e10cSrcweir }
2025cdf0e10cSrcweir break;
2026cdf0e10cSrcweir case SID_SC_TP_GRID: pRet = SvxGridTabPage::Create(pParent, rSet); break;
2027cdf0e10cSrcweir case SID_SC_TP_USERLISTS:
2028cdf0e10cSrcweir {
2029cdf0e10cSrcweir //CHINA001 pRet = ScTpUserLists::Create(pParent, rSet);
2030cdf0e10cSrcweir ::CreateTabPage ScTpUserListsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_USERLISTS );
2031cdf0e10cSrcweir if ( ScTpUserListsCreate )
2032cdf0e10cSrcweir pRet = (*ScTpUserListsCreate)( pParent, rSet);
2033cdf0e10cSrcweir }
2034cdf0e10cSrcweir break;
2035cdf0e10cSrcweir case SID_SC_TP_CALC:
2036cdf0e10cSrcweir { //CHINA001 pRet = ScTpCalcOptions::Create(pParent, rSet);
2037cdf0e10cSrcweir ::CreateTabPage ScTpCalcOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_CALC );
2038cdf0e10cSrcweir if ( ScTpCalcOptionsCreate )
2039cdf0e10cSrcweir pRet = (*ScTpCalcOptionsCreate)(pParent, rSet);
2040cdf0e10cSrcweir }
2041cdf0e10cSrcweir break;
2042cdf0e10cSrcweir case SID_SC_TP_CHANGES:
2043cdf0e10cSrcweir { //CHINA001 pRet = ScRedlineOptionsTabPage::Create(pParent, rSet);
2044cdf0e10cSrcweir ::CreateTabPage ScRedlineOptionsTabPageCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_OPREDLINE );
2045cdf0e10cSrcweir if ( ScRedlineOptionsTabPageCreate )
2046cdf0e10cSrcweir pRet =(*ScRedlineOptionsTabPageCreate)(pParent, rSet);
2047cdf0e10cSrcweir }
2048cdf0e10cSrcweir break;
2049cdf0e10cSrcweir case RID_SC_TP_PRINT:
2050cdf0e10cSrcweir {//CHINA001 pRet = ScTpPrintOptions::Create(pParent, rSet);
2051cdf0e10cSrcweir ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
2052cdf0e10cSrcweir if ( ScTpPrintOptionsCreate )
2053cdf0e10cSrcweir pRet = (*ScTpPrintOptionsCreate)( pParent, rSet);
2054cdf0e10cSrcweir }
2055cdf0e10cSrcweir break;
2056cdf0e10cSrcweir case RID_OFA_TP_INTERNATIONAL:
2057cdf0e10cSrcweir {
2058cdf0e10cSrcweir SfxAbstractDialogFactory* pSfxFact = SfxAbstractDialogFactory::Create();
2059cdf0e10cSrcweir if ( pSfxFact )
2060cdf0e10cSrcweir {
2061cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pSfxFact->GetTabPageCreatorFunc( nId );
2062cdf0e10cSrcweir if ( fnCreatePage )
2063cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
2064cdf0e10cSrcweir }
2065cdf0e10cSrcweir }
2066cdf0e10cSrcweir }
2067cdf0e10cSrcweir
2068cdf0e10cSrcweir DBG_ASSERT( pRet, "ScModule::CreateTabPage(): no valid ID for TabPage!" );
2069cdf0e10cSrcweir
2070cdf0e10cSrcweir return pRet;
2071cdf0e10cSrcweir }
2072cdf0e10cSrcweir
2073cdf0e10cSrcweir //------------------------------------------------------------------
2074cdf0e10cSrcweir
IMPL_LINK(ScModule,CalcFieldValueHdl,EditFieldInfo *,pInfo)2075cdf0e10cSrcweir IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo )
2076cdf0e10cSrcweir {
2077cdf0e10cSrcweir //! mit ScFieldEditEngine zusammenfassen !!!
2078cdf0e10cSrcweir
2079cdf0e10cSrcweir if (pInfo)
2080cdf0e10cSrcweir {
2081cdf0e10cSrcweir const SvxFieldItem& rField = pInfo->GetField();
2082cdf0e10cSrcweir const SvxFieldData* pField = rField.GetField();
2083cdf0e10cSrcweir
2084cdf0e10cSrcweir if (pField && pField->ISA(SvxURLField))
2085cdf0e10cSrcweir {
2086cdf0e10cSrcweir /******************************************************************
2087cdf0e10cSrcweir * URL-Field
2088cdf0e10cSrcweir ******************************************************************/
2089cdf0e10cSrcweir
2090cdf0e10cSrcweir const SvxURLField* pURLField = (const SvxURLField*) pField;
2091cdf0e10cSrcweir String aURL = pURLField->GetURL();
2092cdf0e10cSrcweir
2093cdf0e10cSrcweir switch ( pURLField->GetFormat() )
2094cdf0e10cSrcweir {
2095cdf0e10cSrcweir case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App???
2096cdf0e10cSrcweir case SVXURLFORMAT_REPR:
2097cdf0e10cSrcweir {
2098cdf0e10cSrcweir pInfo->SetRepresentation( pURLField->GetRepresentation() );
2099cdf0e10cSrcweir }
2100cdf0e10cSrcweir break;
2101cdf0e10cSrcweir
2102cdf0e10cSrcweir case SVXURLFORMAT_URL:
2103cdf0e10cSrcweir {
2104cdf0e10cSrcweir pInfo->SetRepresentation( aURL );
2105cdf0e10cSrcweir }
2106cdf0e10cSrcweir break;
2107cdf0e10cSrcweir }
2108cdf0e10cSrcweir
2109cdf0e10cSrcweir svtools::ColorConfigEntry eEntry =
2110cdf0e10cSrcweir INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS;
2111cdf0e10cSrcweir pInfo->SetTxtColor( GetColorConfig().GetColorValue(eEntry).nColor );
2112cdf0e10cSrcweir }
2113cdf0e10cSrcweir else
2114cdf0e10cSrcweir {
2115cdf0e10cSrcweir DBG_ERROR("unbekannter Feldbefehl");
2116cdf0e10cSrcweir pInfo->SetRepresentation(String('?'));
2117cdf0e10cSrcweir }
2118cdf0e10cSrcweir }
2119cdf0e10cSrcweir
2120cdf0e10cSrcweir return 0;
2121cdf0e10cSrcweir }
2122cdf0e10cSrcweir
RegisterRefWindow(sal_uInt16 nSlotId,Window * pWnd)2123cdf0e10cSrcweir sal_Bool ScModule::RegisterRefWindow( sal_uInt16 nSlotId, Window *pWnd )
2124cdf0e10cSrcweir {
2125cdf0e10cSrcweir std::list<Window*> & rlRefWindow = m_mapRefWindow[nSlotId];
2126cdf0e10cSrcweir
2127cdf0e10cSrcweir if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == rlRefWindow.end() )
2128cdf0e10cSrcweir {
2129cdf0e10cSrcweir rlRefWindow.push_back( pWnd );
2130cdf0e10cSrcweir return sal_True;
2131cdf0e10cSrcweir }
2132cdf0e10cSrcweir
2133cdf0e10cSrcweir return sal_False;
2134cdf0e10cSrcweir }
2135cdf0e10cSrcweir
UnregisterRefWindow(sal_uInt16 nSlotId,Window * pWnd)2136cdf0e10cSrcweir sal_Bool ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd )
2137cdf0e10cSrcweir {
2138cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId );
2139cdf0e10cSrcweir
2140cdf0e10cSrcweir if( iSlot == m_mapRefWindow.end() )
2141cdf0e10cSrcweir return sal_False;
2142cdf0e10cSrcweir
2143cdf0e10cSrcweir std::list<Window*> & rlRefWindow = iSlot->second;
2144cdf0e10cSrcweir
2145cdf0e10cSrcweir std::list<Window*>::iterator i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd );
2146cdf0e10cSrcweir
2147cdf0e10cSrcweir if( i == rlRefWindow.end() )
2148cdf0e10cSrcweir return sal_False;
2149cdf0e10cSrcweir
2150cdf0e10cSrcweir rlRefWindow.erase( i );
2151cdf0e10cSrcweir
2152cdf0e10cSrcweir if( !rlRefWindow.size() )
2153cdf0e10cSrcweir m_mapRefWindow.erase( nSlotId );
2154cdf0e10cSrcweir
2155cdf0e10cSrcweir return sal_True;
2156cdf0e10cSrcweir }
2157cdf0e10cSrcweir
IsAliveRefDlg(sal_uInt16 nSlotId,Window * pWnd)2158cdf0e10cSrcweir sal_Bool ScModule::IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd )
2159cdf0e10cSrcweir {
2160cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId );
2161cdf0e10cSrcweir
2162cdf0e10cSrcweir if( iSlot == m_mapRefWindow.end() )
2163cdf0e10cSrcweir return sal_False;
2164cdf0e10cSrcweir
2165cdf0e10cSrcweir std::list<Window*> & rlRefWindow = iSlot->second;
2166cdf0e10cSrcweir
2167cdf0e10cSrcweir return rlRefWindow.end() != std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd );
2168cdf0e10cSrcweir }
2169cdf0e10cSrcweir
Find1RefWindow(sal_uInt16 nSlotId,Window * pWndAncestor)2170cdf0e10cSrcweir Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor )
2171cdf0e10cSrcweir {
2172cdf0e10cSrcweir if (!pWndAncestor)
2173cdf0e10cSrcweir return NULL;
2174cdf0e10cSrcweir
2175cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId );
2176cdf0e10cSrcweir
2177cdf0e10cSrcweir if( iSlot == m_mapRefWindow.end() )
2178cdf0e10cSrcweir return NULL;
2179cdf0e10cSrcweir
2180cdf0e10cSrcweir std::list<Window*> & rlRefWindow = iSlot->second;
2181cdf0e10cSrcweir
2182cdf0e10cSrcweir while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent;
2183cdf0e10cSrcweir
2184cdf0e10cSrcweir for( std::list<Window*>::iterator i = rlRefWindow.begin(); i!=rlRefWindow.end(); i++ )
2185cdf0e10cSrcweir if ( pWndAncestor->IsWindowOrChild( *i, (*i)->IsSystemWindow() ) )
2186cdf0e10cSrcweir return *i;
2187cdf0e10cSrcweir
2188cdf0e10cSrcweir return NULL;
2189cdf0e10cSrcweir }
2190cdf0e10cSrcweir
Find1RefWindow(Window * pWndAncestor)2191cdf0e10cSrcweir Window * ScModule::Find1RefWindow( Window *pWndAncestor )
2192cdf0e10cSrcweir {
2193cdf0e10cSrcweir if (!pWndAncestor)
2194cdf0e10cSrcweir return NULL;
2195cdf0e10cSrcweir
2196cdf0e10cSrcweir while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent;
2197cdf0e10cSrcweir
2198cdf0e10cSrcweir for( std::map<sal_uInt16, std::list<Window*> >::iterator i = m_mapRefWindow.begin();
2199cdf0e10cSrcweir i!=m_mapRefWindow.end(); i++ )
2200cdf0e10cSrcweir for( std::list<Window*>::iterator j = i->second.begin(); j!=i->second.end(); j++ )
2201cdf0e10cSrcweir if ( pWndAncestor->IsWindowOrChild( *j, (*j)->IsSystemWindow() ) )
2202cdf0e10cSrcweir return *j;
2203cdf0e10cSrcweir
2204cdf0e10cSrcweir return NULL;
2205cdf0e10cSrcweir }
2206cdf0e10cSrcweir
2207