1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scmod.cxx,v $
10 * $Revision: 1.58.128.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
33 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
34 #include <comphelper/processfactory.hxx>
40 // INCLUDE ---------------------------------------------------------------
42 #include "scitems.hxx"
43 #include <sfx2/app.hxx>
44 #include <svx/eeitem.hxx>
46 #include <svx/flditem.hxx>
47 #include <svx/outliner.hxx>
48 #include <basic/sbstar.hxx>
50 #include <sfx2/sfxdlg.hxx>
51 #include <sfx2/viewfrm.hxx>
52 #include <sfx2/objface.hxx>
54 #include <svx/hyprlink.hxx>
55 #include "IAnyRefDialog.hxx"
57 #include <svtools/ehdl.hxx>
58 #include <svtools/accessibilityoptions.hxx>
59 #include <svtools/ctloptions.hxx>
60 #include <svtools/useroptions.hxx>
61 #include <vcl/status.hxx>
62 #include <sfx2/bindings.hxx>
63 #include <sfx2/request.hxx>
64 #include <sfx2/macrconf.hxx>
65 #include <sfx2/printer.hxx>
66 #include <svx/langitem.hxx>
67 #include <svtools/colorcfg.hxx>
69 #include <svtools/whiter.hxx>
70 #include <svx/selctrl.hxx>
71 #include <svx/insctrl.hxx>
72 #include <svx/zoomctrl.hxx>
73 #include <svx/modctrl.hxx>
74 #include <svx/pszctrl.hxx>
75 #include <svx/zoomsliderctrl.hxx>
76 #include <vcl/msgbox.hxx>
77 #include <svtools/inethist.hxx>
78 #include <vcl/waitobj.hxx>
79 #include <svx/svxerr.hxx>
85 #include "viewopti.hxx"
86 #include "docoptio.hxx"
87 #include "appoptio.hxx"
88 #include "inputopt.hxx"
89 #include "printopt.hxx"
90 #include "navicfg.hxx"
91 #include "addincfg.hxx"
92 #include "tabvwsh.hxx"
93 #include "prevwsh.hxx"
95 #include "drwlayer.hxx"
96 #include "uiitems.hxx"
99 #include "inputhdl.hxx"
100 #include "inputwin.hxx"
101 #include "msgpool.hxx"
102 #include "scresid.hxx"
103 #include "anyrefdg.hxx"
104 #include "teamdlg.hxx"
105 #include "dwfunctr.hxx"
106 #include "formdata.hxx"
107 //CHINA001 #include "tpview.hxx"
108 //CHINA001 #include "tpusrlst.hxx"
109 //CHINA001 #include "tpcalc.hxx"
110 #include "tpprint.hxx"
111 //CHINA001 #include "opredlin.hxx"
112 #include "transobj.hxx"
113 #include "detfunc.hxx"
114 #include "preview.hxx"
116 #include <svx/xmlsecctrl.hxx>
120 #include "scslots.hxx"
122 #include "scabstdlg.hxx" //CHINA001
124 #define SC_IDLE_MIN 150
125 #define SC_IDLE_MAX 3000
126 #define SC_IDLE_STEP 75
127 #define SC_IDLE_COUNT 50
129 static USHORT nIdleCount
= 0;
131 //------------------------------------------------------------------
133 SFX_IMPL_INTERFACE( ScModule
, SfxShell
, ScResId(RID_APPTITLE
) )
135 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION
| SFX_VISIBILITY_DESKTOP
| SFX_VISIBILITY_STANDARD
| SFX_VISIBILITY_CLIENT
| SFX_VISIBILITY_VIEWER
,
136 ScResId(RID_OBJECTBAR_APP
) );
137 SFX_STATUSBAR_REGISTRATION( ScResId(SCCFG_STATUSBAR
) ); // nur ID wichtig
138 SFX_CHILDWINDOW_REGISTRATION( SvxHyperlinkDlgWrapper::GetChildWindowId() );
141 //------------------------------------------------------------------
143 ScModule::ScModule( SfxObjectFactory
* pFact
) :
144 SfxModule( SfxApplication::CreateResManager( "sc" ), FALSE
, pFact
, NULL
),
145 pSelTransfer( NULL
),
146 pMessagePool( NULL
),
147 pRefInputHandler( NULL
),
156 pColorConfig( NULL
),
157 pAccessOptions( NULL
),
159 pUserOptions( NULL
),
161 pSvxErrorHdl( NULL
),
162 pFormEditData( NULL
),
164 bIsWaterCan( FALSE
),
165 bIsInEditCommand( FALSE
),
166 bIsInExecuteDrop( FALSE
),
167 mbIsInSharedDocLoading( false ),
168 mbIsInSharedDocSaving( false )
170 // im ctor ist der ResManager (DLL-Daten) noch nicht initialisiert!
172 SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("StarCalc"))); // fuer Basic
175 SetClipObject( NULL
, NULL
);
177 // InputHandler braucht nicht mehr angelegt zu werden
179 // ErrorHandler anlegen - war in Init()
180 // zwischen OfficeApplication::Init und ScGlobal::Init
181 SvxErrorHandler::Get();
182 pErrorHdl
= new SfxErrorHandler( RID_ERRHDLSC
,
187 aSpellTimer
.SetTimeout(10);
188 aSpellTimer
.SetTimeoutHdl( LINK( this, ScModule
, SpellTimerHdl
) );
189 aIdleTimer
.SetTimeout(SC_IDLE_MIN
);
190 aIdleTimer
.SetTimeoutHdl( LINK( this, ScModule
, IdleHandler
) );
193 pMessagePool
= new ScMessagePool
;
194 pMessagePool
->FreezeIdRanges();
195 SetPool( pMessagePool
);
196 ScGlobal::InitTextHeight( pMessagePool
);
198 StartListening( *SFX_APP() ); // for SFX_HINT_DEINITIALIZING
201 ScModule::~ScModule()
203 DBG_ASSERT( !pSelTransfer
, "Selection Transfer object not deleted" );
205 // InputHandler braucht nicht mehr geloescht zu werden (gibt keinen an der App mehr)
207 SfxItemPool::Free(pMessagePool
);
209 DELETEZ( pFormEditData
);
212 // delete pSvxErrorHdl;
214 ScGlobal::Clear(); // ruft auch ScDocumentPool::DeleteVersionMaps();
216 DeleteCfg(); // wurde mal aus Exit() gerufen
219 //------------------------------------------------------------------
221 void ScModule::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
223 if ( rHint
.ISA(SfxSimpleHint
) )
225 ULONG nHintId
= ((SfxSimpleHint
&)rHint
).GetId();
226 if ( nHintId
== SFX_HINT_DEINITIALIZING
)
228 // ConfigItems must be removed before ConfigManager
231 else if ( nHintId
== SFX_HINT_COLORS_CHANGED
|| nHintId
== SFX_HINT_ACCESSIBILITY_CHANGED
)
233 // Test if detective objects have to be updated with new colors
234 // (if the detective colors haven't been used yet, there's nothing to update)
235 if ( ScDetectiveFunc::IsColorsInitialized() )
237 const svtools::ColorConfig
& rColors
= GetColorConfig();
239 ( ScDetectiveFunc::GetArrowColor() != (ColorData
)rColors
.GetColorValue(svtools::CALCDETECTIVE
).nColor
||
240 ScDetectiveFunc::GetErrorColor() != (ColorData
)rColors
.GetColorValue(svtools::CALCDETECTIVEERROR
).nColor
);
242 ( ScDetectiveFunc::GetCommentColor() != (ColorData
)rColors
.GetColorValue(svtools::CALCNOTESBACKGROUND
).nColor
);
243 if ( bArrows
|| bComments
)
245 ScDetectiveFunc::InitializeColors(); // get the new colors
247 // update detective objects in all open documents
248 SfxObjectShell
* pObjSh
= SfxObjectShell::GetFirst();
251 if ( pObjSh
->Type() == TYPE(ScDocShell
) )
253 ScDocShell
* pDocSh
= ((ScDocShell
*)pObjSh
);
255 ScDetectiveFunc( pDocSh
->GetDocument(), 0 ).UpdateAllArrowColors();
257 ScDetectiveFunc::UpdateAllComments( *pDocSh
->GetDocument() );
259 pObjSh
= SfxObjectShell::GetNext( *pObjSh
);
264 // force all views to repaint, using the new options
266 SfxViewShell
* pViewShell
= SfxViewShell::GetFirst();
269 if ( pViewShell
->ISA(ScTabViewShell
) )
271 ScTabViewShell
* pViewSh
= (ScTabViewShell
*)pViewShell
;
272 pViewSh
->PaintGrid();
274 pViewSh
->PaintLeft();
275 pViewSh
->PaintExtras();
277 ScInputHandler
* pHdl
= pViewSh
->GetInputHandler();
279 pHdl
->ForgetLastPattern(); // EditEngine BackgroundColor may change
281 else if ( pViewShell
->ISA(ScPreviewShell
) )
283 Window
* pWin
= pViewShell
->GetWindow();
287 pViewShell
= SfxViewShell::GetNext( *pViewShell
);
290 else if ( nHintId
== SFX_HINT_CTL_SETTINGS_CHANGED
)
292 // for all documents: set digit language for printer, recalc output factor, update row heights
293 SfxObjectShell
* pObjSh
= SfxObjectShell::GetFirst();
296 if ( pObjSh
->Type() == TYPE(ScDocShell
) )
298 ScDocShell
* pDocSh
= ((ScDocShell
*)pObjSh
);
299 OutputDevice
* pPrinter
= pDocSh
->GetPrinter();
301 pPrinter
->SetDigitLanguage( GetOptDigitLanguage() );
303 pDocSh
->CalcOutputFactor();
305 SCTAB nTabCount
= pDocSh
->GetDocument()->GetTableCount();
306 for (SCTAB nTab
=0; nTab
<nTabCount
; nTab
++)
307 pDocSh
->AdjustRowHeight( 0, MAXROW
, nTab
);
309 pObjSh
= SfxObjectShell::GetNext( *pObjSh
);
312 // for all views (table and preview): update digit language
313 SfxViewShell
* pSh
= SfxViewShell::GetFirst();
316 if ( pSh
->ISA( ScTabViewShell
) )
318 ScTabViewShell
* pViewSh
= (ScTabViewShell
*)pSh
;
320 // set ref-device for EditEngine (re-evaluates digit settings)
321 ScInputHandler
* pHdl
= GetInputHdl(pViewSh
);
323 pHdl
->UpdateRefDevice();
325 pViewSh
->DigitLanguageChanged();
326 pViewSh
->PaintGrid();
328 else if ( pSh
->ISA( ScPreviewShell
) )
330 ScPreviewShell
* pPreviewSh
= (ScPreviewShell
*)pSh
;
331 ScPreview
* pPreview
= pPreviewSh
->GetPreview();
333 pPreview
->SetDigitLanguage( GetOptDigitLanguage() );
334 pPreview
->Invalidate();
337 pSh
= SfxViewShell::GetNext( *pSh
);
343 //------------------------------------------------------------------
345 void ScModule::DeleteCfg()
347 DELETEZ( pViewCfg
); // Speichern passiert vor Exit() automatisch
350 DELETEZ( pInputCfg
);
351 DELETEZ( pPrintCfg
);
352 DELETEZ( pNavipiCfg
);
353 DELETEZ( pAddInCfg
);
357 EndListening(*pColorConfig
);
358 DELETEZ( pColorConfig
);
360 if ( pAccessOptions
)
362 EndListening(*pAccessOptions
);
363 DELETEZ( pAccessOptions
);
367 EndListening(*pCTLOptions
);
368 DELETEZ( pCTLOptions
);
372 DELETEZ( pUserOptions
);
376 //------------------------------------------------------------------
378 #define TEXT_WIDTH(s) rStatusBar.GetTextWidth((s))
380 void ScModule::FillStatusBar(StatusBar
& rStatusBar
)
382 // Dokumentposition (Tabelle x / y)
383 rStatusBar
.InsertItem( SID_STATUS_DOCPOS
,
384 TEXT_WIDTH( String().Fill( 10, 'X' ) ),
385 SIB_LEFT
|SIB_AUTOSIZE
);
386 rStatusBar
.SetHelpId( SID_STATUS_DOCPOS
, SID_STATUS_DOCPOS
);
389 rStatusBar
.InsertItem( SID_STATUS_PAGESTYLE
,
390 TEXT_WIDTH( String().Fill( 15, 'X' ) ),
391 SIB_LEFT
|SIB_AUTOSIZE
);
392 rStatusBar
.SetHelpId( SID_STATUS_PAGESTYLE
, SID_STATUS_PAGESTYLE
);
394 // Einfuege-/Ueberschreibmodus
395 rStatusBar
.InsertItem( SID_ATTR_INSERT
,
396 SvxInsertStatusBarControl::GetDefItemWidth(rStatusBar
),
398 rStatusBar
.SetHelpId( SID_ATTR_INSERT
, SID_ATTR_INSERT
);
401 rStatusBar
.InsertItem( SID_STATUS_SELMODE
,
402 SvxSelectionModeControl::GetDefItemWidth(rStatusBar
),
404 rStatusBar
.SetHelpId( SID_STATUS_SELMODE
, SID_STATUS_SELMODE
);
406 // Dokument geaendert
407 rStatusBar
.InsertItem( SID_DOC_MODIFIED
,
408 SvxModifyControl::GetDefItemWidth(rStatusBar
));
411 rStatusBar
.InsertItem( SID_SIGNATURE
, XmlSecStatusBarControl::GetDefItemWidth( rStatusBar
), SIB_USERDRAW
);
412 rStatusBar
.SetHelpId(SID_SIGNATURE
, SID_SIGNATURE
);
415 rStatusBar
.SetHelpId( SID_DOC_MODIFIED
, SID_DOC_MODIFIED
);
417 // den aktuellen Kontext anzeigen Uhrzeit / FramePos / TabellenInfo / Errors
418 rStatusBar
.InsertItem( SID_ATTR_SIZE
,
419 SvxPosSizeStatusBarControl::GetDefItemWidth(rStatusBar
),
420 SIB_AUTOSIZE
|SIB_LEFT
|SIB_USERDRAW
);
421 rStatusBar
.SetHelpId( SID_ATTR_SIZE
, SID_ATTR_SIZE
);
424 rStatusBar
.InsertItem( SID_ATTR_ZOOM
,
425 SvxZoomStatusBarControl::GetDefItemWidth(rStatusBar
),
427 rStatusBar
.SetHelpId( SID_ATTR_ZOOM
, SID_ATTR_ZOOM
);
430 rStatusBar
.InsertItem( SID_ATTR_ZOOMSLIDER
,
431 TEXT_WIDTH( String().Fill( 15, 'X' ) ),
433 rStatusBar
.SetHelpId( SID_ATTR_ZOOMSLIDER
, SID_ATTR_ZOOMSLIDER
);
438 //------------------------------------------------------------------
440 // von der Applikation verschoben:
442 //------------------------------------------------------------------
444 void ScModule::Execute( SfxRequest
& rReq
)
446 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
447 SfxBindings
* pBindings
= pViewFrm
? &pViewFrm
->GetBindings() : NULL
;
449 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
450 USHORT nSlot
= rReq
.GetSlot();
454 case SID_CHOOSE_DESIGN
:
457 String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Template.Samples.ShowStyles"));
458 SfxApplication
* pApp
= SFX_APP();
459 pApp
->EnterBasicCall();
460 pApp
->GetMacroConfig()->Call( NULL
, aMacroName
, pApp
->GetBasicManager() );
461 pApp
->LeaveBasicCall();
464 case SID_EURO_CONVERTER
:
467 String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Euro.ConvertRun.Main"));
468 SfxApplication
* pApp
= SFX_APP();
469 pApp
->EnterBasicCall();
470 pApp
->GetMacroConfig()->Call( NULL
, aMacroName
, pApp
->GetBasicManager() );
471 pApp
->LeaveBasicCall();
474 case SID_AUTOSPELL_CHECK
:
477 const SfxPoolItem
* pItem
;
478 if ( pReqArgs
&& SFX_ITEM_SET
== pReqArgs
->GetItemState( nSlot
, TRUE
, &pItem
) )
479 bSet
= ((const SfxBoolItem
*)pItem
)->GetValue();
482 ScDocShell
* pDocSh
= PTR_CAST(ScDocShell
, SfxObjectShell::Current());
484 bSet
= !pDocSh
->GetDocument()->GetDocOptions().IsAutoSpell();
486 bSet
= !GetDocOptions().IsAutoSpell();
489 SfxItemSet
aSet( GetPool(), SID_AUTOSPELL_CHECK
, SID_AUTOSPELL_CHECK
);
490 aSet
.Put( SfxBoolItem( SID_AUTOSPELL_CHECK
, bSet
) );
491 ModifyOptions( aSet
);
496 case SID_ATTR_METRIC
:
498 const SfxPoolItem
* pItem
;
499 if ( pReqArgs
&& SFX_ITEM_SET
== pReqArgs
->GetItemState( nSlot
, TRUE
, &pItem
) )
501 FieldUnit eUnit
= (FieldUnit
)((const SfxUInt16Item
*)pItem
)->GetValue();
504 case FUNIT_MM
: // nur die Einheiten, die auch im Dialog stehen
511 ScAppOptions
aNewOpts( GetAppOptions() );
512 aNewOpts
.SetAppMetric( eUnit
);
513 SetAppOptions( aNewOpts
);
519 // added to avoid warnings
526 case FID_AUTOCOMPLETE
:
528 ScAppOptions
aNewOpts( GetAppOptions() );
529 BOOL bNew
= !aNewOpts
.GetAutoComplete();
530 aNewOpts
.SetAutoComplete( bNew
);
531 SetAppOptions( aNewOpts
);
532 ScInputHandler::SetAutoComplete( bNew
);
534 pBindings
->Invalidate( FID_AUTOCOMPLETE
);
539 case SID_DETECTIVE_AUTO
:
541 ScAppOptions
aNewOpts( GetAppOptions() );
542 BOOL bNew
= !aNewOpts
.GetDetectiveAuto();
543 SFX_REQUEST_ARG( rReq
, pAuto
, SfxBoolItem
, SID_DETECTIVE_AUTO
, sal_False
);
545 bNew
= pAuto
->GetValue();
547 aNewOpts
.SetDetectiveAuto( bNew
);
548 SetAppOptions( aNewOpts
);
550 pBindings
->Invalidate( SID_DETECTIVE_AUTO
);
551 rReq
.AppendItem( SfxBoolItem( SID_DETECTIVE_AUTO
, bNew
) );
556 case SID_PSZ_FUNCTION
:
559 const SfxUInt16Item
& rItem
= (const SfxUInt16Item
&)pReqArgs
->Get(SID_PSZ_FUNCTION
);
560 DBG_ASSERT(rItem
.ISA(SfxUInt16Item
),"falscher Parameter");
562 ScAppOptions
aNewOpts( GetAppOptions() );
563 aNewOpts
.SetStatusFunc( rItem
.GetValue() );
564 SetAppOptions( aNewOpts
);
568 pBindings
->Invalidate( SID_TABLE_CELL
);
569 pBindings
->Update( SID_TABLE_CELL
); // sofort
571 pBindings
->Invalidate( SID_PSZ_FUNCTION
);
572 pBindings
->Update( SID_PSZ_FUNCTION
);
573 // falls Menue gleich wieder aufgeklappt wird
578 case SID_ATTR_LANGUAGE
:
579 case SID_ATTR_CHAR_CJK_LANGUAGE
:
580 case SID_ATTR_CHAR_CTL_LANGUAGE
:
582 const SfxPoolItem
* pItem
;
583 if ( pReqArgs
&& SFX_ITEM_SET
== pReqArgs
->GetItemState( GetPool().GetWhich(nSlot
), TRUE
, &pItem
) )
585 ScDocShell
* pDocSh
= PTR_CAST(ScDocShell
, SfxObjectShell::Current());
586 ScDocument
* pDoc
= pDocSh
? pDocSh
->GetDocument() : NULL
;
589 LanguageType eNewLang
= ((SvxLanguageItem
*)pItem
)->GetLanguage();
590 LanguageType eLatin
, eCjk
, eCtl
;
591 pDoc
->GetLanguage( eLatin
, eCjk
, eCtl
);
592 LanguageType eOld
= ( nSlot
== SID_ATTR_CHAR_CJK_LANGUAGE
) ? eCjk
:
593 ( ( nSlot
== SID_ATTR_CHAR_CTL_LANGUAGE
) ? eCtl
: eLatin
);
594 if ( eNewLang
!= eOld
)
596 if ( nSlot
== SID_ATTR_CHAR_CJK_LANGUAGE
)
598 else if ( nSlot
== SID_ATTR_CHAR_CTL_LANGUAGE
)
603 pDoc
->SetLanguage( eLatin
, eCjk
, eCtl
);
605 ScInputHandler
* pInputHandler
= GetInputHdl();
607 pInputHandler
->UpdateSpellSettings(); // EditEngine-Flags
608 ScTabViewShell
* pViewSh
= PTR_CAST(ScTabViewShell
, SfxViewShell::Current());
610 pViewSh
->UpdateDrawTextOutliner(); // EditEngine-Flags
612 pDocSh
->SetDocumentModified();
619 case FID_FOCUS_POSWND
:
621 ScInputHandler
* pHdl
= GetInputHdl();
624 ScInputWindow
* pWin
= pHdl
->GetInputWindow();
626 pWin
->PosGrabFocus();
632 case SID_OPEN_XML_FILTERSETTINGS
:
636 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
);
642 catch( ::com::sun::star::uno::RuntimeException
& )
649 DBG_ERROR( "ScApplication: Unknown Message." );
654 void ScModule::GetState( SfxItemSet
& rSet
)
656 SfxWhichIter
aIter(rSet
);
657 USHORT nWhich
= aIter
.FirstWhich();
662 case FID_AUTOCOMPLETE
:
663 rSet
.Put( SfxBoolItem( nWhich
, GetAppOptions().GetAutoComplete() ) );
665 case SID_DETECTIVE_AUTO
:
666 rSet
.Put( SfxBoolItem( nWhich
, GetAppOptions().GetDetectiveAuto() ) );
668 case SID_PSZ_FUNCTION
:
669 rSet
.Put( SfxUInt16Item( nWhich
, GetAppOptions().GetStatusFunc() ) );
671 case SID_ATTR_METRIC
:
672 rSet
.Put( SfxUInt16Item( nWhich
, sal::static_int_cast
<UINT16
>(GetAppOptions().GetAppMetric()) ) );
674 case SID_AUTOSPELL_CHECK
:
677 ScDocShell
* pDocSh
= PTR_CAST(ScDocShell
, SfxObjectShell::Current());
679 bAuto
= pDocSh
->GetDocument()->GetDocOptions().IsAutoSpell();
682 USHORT nDummyLang
, nDummyCjk
, nDummyCtl
;
683 GetSpellSettings( nDummyLang
, nDummyCjk
, nDummyCtl
, bAuto
);
685 rSet
.Put( SfxBoolItem( nWhich
, bAuto
) );
688 case SID_ATTR_LANGUAGE
:
689 case ATTR_CJK_FONT_LANGUAGE
: // WID for SID_ATTR_CHAR_CJK_LANGUAGE
690 case ATTR_CTL_FONT_LANGUAGE
: // WID for SID_ATTR_CHAR_CTL_LANGUAGE
692 ScDocShell
* pDocSh
= PTR_CAST(ScDocShell
, SfxObjectShell::Current());
693 ScDocument
* pDoc
= pDocSh
? pDocSh
->GetDocument() : NULL
;
696 LanguageType eLatin
, eCjk
, eCtl
;
697 pDoc
->GetLanguage( eLatin
, eCjk
, eCtl
);
698 LanguageType eLang
= ( nWhich
== ATTR_CJK_FONT_LANGUAGE
) ? eCjk
:
699 ( ( nWhich
== ATTR_CTL_FONT_LANGUAGE
) ? eCtl
: eLatin
);
700 rSet
.Put( SvxLanguageItem( eLang
, nWhich
) );
706 nWhich
= aIter
.NextWhich();
711 void ScModule::HideDisabledSlots( SfxItemSet
& rSet
)
713 if( SfxViewFrame
* pViewFrm
= SfxViewFrame::Current() )
715 SfxBindings
& rBindings
= pViewFrm
->GetBindings();
716 SfxWhichIter
aIter( rSet
);
717 for( USHORT nWhich
= aIter
.FirstWhich(); nWhich
!= 0; nWhich
= aIter
.NextWhich() )
719 ScViewUtil::HideDisabledSlot( rSet
, rBindings
, nWhich
);
720 // always disable the slots
721 rSet
.DisableItem( nWhich
);
727 //------------------------------------------------------------------
729 void ScModule::ResetDragObject()
731 aDragData
.pCellTransfer
= NULL
;
732 aDragData
.pDrawTransfer
= NULL
;
734 aDragData
.aLinkDoc
.Erase();
735 aDragData
.aLinkTable
.Erase();
736 aDragData
.aLinkArea
.Erase();
737 aDragData
.pJumpLocalDoc
= NULL
;
738 aDragData
.aJumpTarget
.Erase();
739 aDragData
.aJumpText
.Erase();
742 void ScModule::SetDragObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
)
745 aDragData
.pCellTransfer
= pCellObj
;
746 aDragData
.pDrawTransfer
= pDrawObj
;
749 void ScModule::SetDragLink( const String
& rDoc
, const String
& rTab
, const String
& rArea
)
753 aDragData
.aLinkDoc
= rDoc
;
754 aDragData
.aLinkTable
= rTab
;
755 aDragData
.aLinkArea
= rArea
;
758 void ScModule::SetDragJump( ScDocument
* pLocalDoc
, const String
& rTarget
, const String
& rText
)
762 aDragData
.pJumpLocalDoc
= pLocalDoc
;
763 aDragData
.aJumpTarget
= rTarget
;
764 aDragData
.aJumpText
= rText
;
767 //------------------------------------------------------------------
769 void ScModule::SetClipObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
)
771 DBG_ASSERT( !pCellObj
|| !pDrawObj
, "SetClipObject: not allowed to set both objects" );
773 aClipData
.pCellClipboard
= pCellObj
;
774 aClipData
.pDrawClipboard
= pDrawObj
;
777 ScDocument
* ScModule::GetClipDoc()
779 // called from document
781 ScTransferObj
* pObj
= ScTransferObj::GetOwnClipboard( NULL
);
783 return pObj
->GetDocument();
788 //------------------------------------------------------------------
790 void ScModule::SetSelectionTransfer( ScSelectionTransferObj
* pNew
)
795 //------------------------------------------------------------------
797 void ScModule::InitFormEditData()
799 pFormEditData
= new ScFormEditData
;
802 void ScModule::ClearFormEditData()
804 DELETEZ( pFormEditData
);
807 //------------------------------------------------------------------
809 void ScModule::SetViewOptions( const ScViewOptions
& rOpt
)
812 pViewCfg
= new ScViewCfg
;
814 pViewCfg
->SetOptions( rOpt
);
817 const ScViewOptions
& ScModule::GetViewOptions()
820 pViewCfg
= new ScViewCfg
;
825 void ScModule::SetDocOptions( const ScDocOptions
& rOpt
)
828 pDocCfg
= new ScDocCfg
;
830 pDocCfg
->SetOptions( rOpt
);
833 const ScDocOptions
& ScModule::GetDocOptions()
836 pDocCfg
= new ScDocCfg
;
845 void ScModule::InsertEntryToLRUList(USHORT nFIndex
)
849 const ScAppOptions
& rAppOpt
= GetAppOptions();
850 USHORT nLRUFuncCount
= Min( rAppOpt
.GetLRUFuncListCount(), (USHORT
)LRU_MAX
);
851 USHORT
* pLRUListIds
= rAppOpt
.GetLRUFuncList();
853 USHORT aIdxList
[LRU_MAX
];
857 while ((n
< LRU_MAX
) && n
<nLRUFuncCount
) // alte Liste abklappern
859 if (!bFound
&& (pLRUListIds
[n
]== nFIndex
))
860 bFound
= TRUE
; // erster! Treffer
862 aIdxList
[n
] = pLRUListIds
[n
]; // hinter Treffer kopieren
863 else if ((n
+1) < LRU_MAX
)
864 aIdxList
[n
+1] = pLRUListIds
[n
]; // vor Treffer verschieben
867 if (!bFound
&& (n
< LRU_MAX
)) // Eintrag nicht gefunden?
869 aIdxList
[0] = nFIndex
; // Current on Top
871 ScAppOptions
aNewOpts(rAppOpt
); // an App melden
872 aNewOpts
.SetLRUFuncList(aIdxList
, n
);
873 SetAppOptions(aNewOpts
);
875 RecentFunctionsChanged();
879 void ScModule::RecentFunctionsChanged()
881 // update function list window
882 USHORT nFuncListID
= ScFunctionChildWindow::GetChildWindowId();
885 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
886 if ( pViewFrm
&& pViewFrm
->HasChildWindow(nFuncListID
) )
888 ScFunctionChildWindow
* pWnd
=(ScFunctionChildWindow
*)pViewFrm
->GetChildWindow( nFuncListID
);
890 ScFunctionDockWin
* pFuncList
=(ScFunctionDockWin
*)pWnd
->GetWindow();
892 pFuncList
->InitLRUList();
896 void ScModule::SetAppOptions( const ScAppOptions
& rOpt
)
899 pAppCfg
= new ScAppCfg
;
901 pAppCfg
->SetOptions( rOpt
);
904 void global_InitAppOptions()
906 SC_MOD()->GetAppOptions();
909 const ScAppOptions
& ScModule::GetAppOptions()
912 pAppCfg
= new ScAppCfg
;
917 void ScModule::SetInputOptions( const ScInputOptions
& rOpt
)
920 pInputCfg
= new ScInputCfg
;
922 pInputCfg
->SetOptions( rOpt
);
925 const ScInputOptions
& ScModule::GetInputOptions()
928 pInputCfg
= new ScInputCfg
;
933 void ScModule::SetPrintOptions( const ScPrintOptions
& rOpt
)
936 pPrintCfg
= new ScPrintCfg
;
938 pPrintCfg
->SetOptions( rOpt
);
941 const ScPrintOptions
& ScModule::GetPrintOptions()
944 pPrintCfg
= new ScPrintCfg
;
949 ScNavipiCfg
& ScModule::GetNavipiCfg()
952 pNavipiCfg
= new ScNavipiCfg
;
957 ScAddInCfg
& ScModule::GetAddInCfg()
960 pAddInCfg
= new ScAddInCfg
;
965 svtools::ColorConfig
& ScModule::GetColorConfig()
969 pColorConfig
= new svtools::ColorConfig
;
970 StartListening(*pColorConfig
);
973 return *pColorConfig
;
976 SvtAccessibilityOptions
& ScModule::GetAccessOptions()
978 if ( !pAccessOptions
)
980 pAccessOptions
= new SvtAccessibilityOptions
;
981 StartListening(*pAccessOptions
);
984 return *pAccessOptions
;
987 SvtCTLOptions
& ScModule::GetCTLOptions()
991 pCTLOptions
= new SvtCTLOptions
;
992 StartListening(*pCTLOptions
);
998 SvtUserOptions
& ScModule::GetUserOptions()
1002 pUserOptions
= new SvtUserOptions
;
1004 return *pUserOptions
;
1007 USHORT
ScModule::GetOptDigitLanguage()
1009 SvtCTLOptions::TextNumerals eNumerals
= GetCTLOptions().GetCTLTextNumerals();
1010 return ( eNumerals
== SvtCTLOptions::NUMERALS_ARABIC
) ? LANGUAGE_ENGLISH_US
:
1011 ( eNumerals
== SvtCTLOptions::NUMERALS_HINDI
) ? LANGUAGE_ARABIC_SAUDI_ARABIA
:
1015 //------------------------------------------------------------------
1019 //------------------------------------------------------------------
1022 // ModifyOptions - Items aus Calc-Options-Dialog
1023 // und SID_AUTOSPELL_CHECK
1026 #define IS_AVAILABLE(w,item) (SFX_ITEM_SET==rOptSet.GetItemState((w),TRUE,&item))
1028 void ScModule::ModifyOptions( const SfxItemSet
& rOptSet
)
1030 USHORT nOldSpellLang
, nOldCjkLang
, nOldCtlLang
;
1032 GetSpellSettings( nOldSpellLang
, nOldCjkLang
, nOldCtlLang
, bOldAutoSpell
);
1036 DBG_ASSERT( pAppCfg
, "AppOptions not initialised :-(" );
1040 DBG_ASSERT( pInputCfg
, "InputOptions not initialised :-(" );
1042 //--------------------------------------------------------------
1044 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
1045 SfxBindings
* pBindings
= pViewFrm
? &pViewFrm
->GetBindings() : NULL
;
1047 ScTabViewShell
* pViewSh
= PTR_CAST(ScTabViewShell
, SfxViewShell::Current());
1048 ScDocShell
* pDocSh
= PTR_CAST(ScDocShell
, SfxObjectShell::Current());
1049 ScDocument
* pDoc
= pDocSh
? pDocSh
->GetDocument() : NULL
;
1050 const SfxPoolItem
* pItem
= NULL
;
1051 BOOL bRepaint
= FALSE
;
1052 BOOL bUpdateMarks
= FALSE
;
1053 BOOL bUpdateRefDev
= FALSE
;
1054 BOOL bCalcAll
= FALSE
;
1055 BOOL bSaveSpellCheck
= FALSE
;
1056 BOOL bSaveAppOptions
= FALSE
;
1057 BOOL bSaveInputOptions
= FALSE
;
1059 //--------------------------------------------------------------------------
1061 // SFX_APP()->SetOptions( rOptSet );
1063 // Linguistik nicht mehr
1065 if ( IS_AVAILABLE(SID_ATTR_METRIC
,pItem
) )
1068 pAppCfg
->SetAppMetric( (FieldUnit
)((const SfxUInt16Item
*)pItem
)->GetValue() );
1069 bSaveAppOptions
= TRUE
;
1072 if ( IS_AVAILABLE(SCITEM_USERLIST
,pItem
) )
1074 ScGlobal::SetUserList( ((const ScUserListItem
*)pItem
)->GetUserList() );
1075 bSaveAppOptions
= TRUE
;
1078 if ( IS_AVAILABLE(SID_SC_OPT_SYNCZOOM
,pItem
) )
1080 pAppCfg
->SetSynchronizeZoom( static_cast<const SfxBoolItem
*>(pItem
)->GetValue() );
1081 bSaveAppOptions
= TRUE
;
1084 //============================================
1086 //============================================
1088 if ( IS_AVAILABLE(SID_SCVIEWOPTIONS
,pItem
) )
1090 const ScViewOptions
& rNewOpt
= ((const ScTpViewItem
*)pItem
)->GetViewOptions();
1094 ScViewData
* pViewData
= pViewSh
->GetViewData();
1095 const ScViewOptions
& rOldOpt
= pViewData
->GetOptions();
1097 BOOL bAnchorList
= ( rOldOpt
.GetOption( VOPT_ANCHOR
) !=
1098 rNewOpt
.GetOption( VOPT_ANCHOR
) );
1100 if ( rOldOpt
!= rNewOpt
)
1102 pViewData
->SetOptions( rNewOpt
); // veraendert rOldOpt
1103 pViewData
->GetDocument()->SetViewOptions( rNewOpt
);
1104 pDocSh
->SetDocumentModified();
1108 pViewSh
->UpdateAnchorHandles();
1110 SetViewOptions( rNewOpt
);
1112 pBindings
->Invalidate(SID_HELPLINES_MOVE
);
1115 //============================================
1116 // GridOptions, Auswertung nach ViewOptions,
1117 // da GridOptions Member der ViewOptions ist!
1118 //============================================
1120 if ( IS_AVAILABLE(SID_ATTR_GRID_OPTIONS
,pItem
) )
1122 ScGridOptions
aNewGridOpt( (const SvxOptionsGrid
&)((const SvxGridItem
&)*pItem
) );
1126 ScViewData
* pViewData
= pViewSh
->GetViewData();
1127 ScViewOptions
aNewViewOpt( pViewData
->GetOptions() );
1128 const ScGridOptions
& rOldGridOpt
= aNewViewOpt
.GetGridOptions();
1130 if ( rOldGridOpt
!= aNewGridOpt
)
1132 aNewViewOpt
.SetGridOptions( aNewGridOpt
);
1133 pViewData
->SetOptions( aNewViewOpt
);
1134 pViewData
->GetDocument()->SetViewOptions( aNewViewOpt
);
1135 pDocSh
->SetDocumentModified();
1139 ScViewOptions
aNewViewOpt ( GetViewOptions() );
1140 aNewViewOpt
.SetGridOptions( aNewGridOpt
);
1141 SetViewOptions( aNewViewOpt
);
1144 pBindings
->Invalidate(SID_GRID_VISIBLE
);
1145 pBindings
->Invalidate(SID_GRID_USE
);
1150 //============================================
1152 //============================================
1154 if ( IS_AVAILABLE(SID_SCDOCOPTIONS
,pItem
) )
1156 const ScDocOptions
& rNewOpt
= ((const ScTpCalcItem
*)pItem
)->GetDocOptions();
1160 const ScDocOptions
& rOldOpt
= pDoc
->GetDocOptions();
1162 bRepaint
= ( bRepaint
|| ( rOldOpt
!= rNewOpt
) );
1163 bCalcAll
= bRepaint
&&
1164 ( rOldOpt
.IsIter() != rNewOpt
.IsIter()
1165 || rOldOpt
.GetIterCount() != rNewOpt
.GetIterCount()
1166 || rOldOpt
.GetIterEps() != rNewOpt
.GetIterEps()
1167 || rOldOpt
.IsIgnoreCase() != rNewOpt
.IsIgnoreCase()
1168 || rOldOpt
.IsCalcAsShown() != rNewOpt
.IsCalcAsShown()
1169 || (rNewOpt
.IsCalcAsShown() &&
1170 rOldOpt
.GetStdPrecision() != rNewOpt
.GetStdPrecision())
1171 || rOldOpt
.IsMatchWholeCell() != rNewOpt
.IsMatchWholeCell()
1172 || rOldOpt
.GetYear2000() != rNewOpt
.GetYear2000()
1173 || rOldOpt
.IsFormulaRegexEnabled() != rNewOpt
.IsFormulaRegexEnabled()
1175 pDoc
->SetDocOptions( rNewOpt
);
1176 pDocSh
->SetDocumentModified();
1178 SetDocOptions( rNewOpt
);
1181 // nach den eigentlichen DocOptions auch noch die TabDistance setzen
1182 if ( IS_AVAILABLE(SID_ATTR_DEFTABSTOP
,pItem
) )
1184 USHORT nTabDist
= ((SfxUInt16Item
*)pItem
)->GetValue();
1185 ScDocOptions
aOpt(GetDocOptions());
1186 aOpt
.SetTabDistance(nTabDist
);
1187 SetDocOptions( aOpt
);
1191 ScDocOptions
aDocOpt(pDoc
->GetDocOptions());
1192 aDocOpt
.SetTabDistance(nTabDist
);
1193 pDoc
->SetDocOptions( aDocOpt
);
1194 pDocSh
->SetDocumentModified();
1195 if(pDoc
->GetDrawLayer())
1196 pDoc
->GetDrawLayer()->SetDefaultTabulator(nTabDist
);
1200 // AutoSpell nach den Doc-Options (weil Member)
1202 if ( IS_AVAILABLE(SID_AUTOSPELL_CHECK
,pItem
) ) // an Doc-Options
1204 BOOL bDoAutoSpell
= ((const SfxBoolItem
*)pItem
)->GetValue();
1208 ScDocOptions aNewOpt
= pDoc
->GetDocOptions();
1209 if ( aNewOpt
.IsAutoSpell() != bDoAutoSpell
)
1211 aNewOpt
.SetAutoSpell( bDoAutoSpell
);
1212 pDoc
->SetDocOptions( aNewOpt
);
1215 pDoc
->SetOnlineSpellPos( ScAddress(0,0,0) ); // vorne anfangen
1218 WaitObject
aWait( pDocSh
->GetActiveDialogParent() );
1219 pDoc
->RemoveAutoSpellObj(); // Edit-Text-Objekte wieder zurueckwandeln
1222 //#92038#; don't set document modified, because this flag is no longer saved
1223 // pDocSh->SetDocumentModified();
1225 bRepaint
= TRUE
; // weil HideAutoSpell evtl. ungueltig
1226 //! alle Views painten ???
1230 if ( bOldAutoSpell
!= bDoAutoSpell
)
1232 SetAutoSpellProperty( bDoAutoSpell
);
1233 bSaveSpellCheck
= TRUE
;
1236 pDocSh
->PostPaintGridAll(); // wegen Markierungen
1237 ScInputHandler
* pInputHandler
= GetInputHdl();
1238 if ( pInputHandler
)
1239 pInputHandler
->UpdateSpellSettings(); // EditEngine-Flags
1241 pViewSh
->UpdateDrawTextOutliner(); // EditEngine-Flags
1244 pBindings
->Invalidate( SID_AUTOSPELL_CHECK
);
1247 //============================================
1249 //============================================
1251 if ( IS_AVAILABLE(SID_SC_INPUT_SELECTIONPOS
,pItem
) )
1253 pInputCfg
->SetMoveDir( ((const SfxUInt16Item
*)pItem
)->GetValue() );
1254 bSaveInputOptions
= TRUE
;
1256 if ( IS_AVAILABLE(SID_SC_INPUT_SELECTION
,pItem
) )
1258 pInputCfg
->SetMoveSelection( ((const SfxBoolItem
*)pItem
)->GetValue() );
1259 bSaveInputOptions
= TRUE
;
1261 if ( IS_AVAILABLE(SID_SC_INPUT_EDITMODE
,pItem
) )
1263 pInputCfg
->SetEnterEdit( ((const SfxBoolItem
*)pItem
)->GetValue() );
1264 bSaveInputOptions
= TRUE
;
1266 if ( IS_AVAILABLE(SID_SC_INPUT_FMT_EXPAND
,pItem
) )
1268 pInputCfg
->SetExtendFormat( ((const SfxBoolItem
*)pItem
)->GetValue() );
1269 bSaveInputOptions
= TRUE
;
1271 if ( IS_AVAILABLE(SID_SC_INPUT_RANGEFINDER
,pItem
) )
1273 pInputCfg
->SetRangeFinder( ((const SfxBoolItem
*)pItem
)->GetValue() );
1274 bSaveInputOptions
= TRUE
;
1276 if ( IS_AVAILABLE(SID_SC_INPUT_REF_EXPAND
,pItem
) )
1278 pInputCfg
->SetExpandRefs( ((const SfxBoolItem
*)pItem
)->GetValue() );
1279 bSaveInputOptions
= TRUE
;
1281 if ( IS_AVAILABLE(SID_SC_INPUT_MARK_HEADER
,pItem
) )
1283 pInputCfg
->SetMarkHeader( ((const SfxBoolItem
*)pItem
)->GetValue() );
1284 bSaveInputOptions
= TRUE
;
1285 bUpdateMarks
= TRUE
;
1287 if ( IS_AVAILABLE(SID_SC_INPUT_TEXTWYSIWYG
,pItem
) )
1289 BOOL bNew
= ((const SfxBoolItem
*)pItem
)->GetValue();
1290 if ( bNew
!= pInputCfg
->GetTextWysiwyg() )
1292 pInputCfg
->SetTextWysiwyg( bNew
);
1293 bSaveInputOptions
= TRUE
;
1294 bUpdateRefDev
= TRUE
;
1297 if( IS_AVAILABLE( SID_SC_INPUT_REPLCELLSWARN
, pItem
) )
1299 pInputCfg
->SetReplaceCellsWarn( ((const SfxBoolItem
*)pItem
)->GetValue() );
1300 bSaveInputOptions
= TRUE
;
1303 //============================================
1305 //============================================
1307 if ( IS_AVAILABLE(SID_SCPRINTOPTIONS
,pItem
) )
1309 const ScPrintOptions
& rNewOpt
= ((const ScTpPrintItem
*)pItem
)->GetPrintOptions();
1310 SetPrintOptions( rNewOpt
);
1312 // broadcast causes all previews to recalc page numbers
1313 SFX_APP()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS
) );
1316 //----------------------------------------------------------
1318 // if ( bSaveSpellCheck )
1320 // currently LinguProperties are saved only at program exit.
1321 // if a save method becomes available, it should be called here.
1324 if ( bSaveAppOptions
)
1325 pAppCfg
->OptionsChanged();
1327 if ( bSaveInputOptions
)
1328 pInputCfg
->OptionsChanged();
1330 // Neuberechnung anstossen?
1332 if ( pDoc
&& bCalcAll
)
1334 WaitObject
aWait( pDocSh
->GetActiveDialogParent() );
1337 pViewSh
->UpdateCharts( TRUE
);
1339 ScDBFunc::DoUpdateCharts( ScAddress(), pDoc
, TRUE
);
1341 pBindings
->Invalidate( SID_ATTR_SIZE
); //SvxPosSize-StatusControl-Update
1344 if ( pViewSh
&& bUpdateMarks
)
1345 pViewSh
->UpdateAutoFillMark();
1347 // View neuzeichnen?
1349 if ( pViewSh
&& bRepaint
)
1351 pViewSh
->UpdateFixPos();
1352 pViewSh
->PaintGrid();
1353 pViewSh
->PaintTop();
1354 pViewSh
->PaintLeft();
1355 pViewSh
->PaintExtras();
1356 pViewSh
->InvalidateBorder();
1359 pBindings
->Invalidate( FID_TOGGLEHEADERS
); // -> Checks im Menue
1360 pBindings
->Invalidate( FID_TOGGLESYNTAX
);
1364 // update ref device (for all documents)
1366 if ( bUpdateRefDev
)
1368 // for all documents: recalc output factor, update row heights
1369 SfxObjectShell
* pObjSh
= SfxObjectShell::GetFirst();
1372 if ( pObjSh
->Type() == TYPE(ScDocShell
) )
1374 ScDocShell
* pOneDocSh
= ((ScDocShell
*)pObjSh
);
1375 pOneDocSh
->CalcOutputFactor();
1376 SCTAB nTabCount
= pOneDocSh
->GetDocument()->GetTableCount();
1377 for (SCTAB nTab
=0; nTab
<nTabCount
; nTab
++)
1378 pOneDocSh
->AdjustRowHeight( 0, MAXROW
, nTab
);
1380 pObjSh
= SfxObjectShell::GetNext( *pObjSh
);
1383 // for all (tab-) views:
1384 TypeId aScType
= TYPE(ScTabViewShell
);
1385 SfxViewShell
* pSh
= SfxViewShell::GetFirst( &aScType
);
1388 ScTabViewShell
* pOneViewSh
= (ScTabViewShell
*)pSh
;
1390 // set ref-device for EditEngine
1391 ScInputHandler
* pHdl
= GetInputHdl(pOneViewSh
);
1393 pHdl
->UpdateRefDevice();
1395 // update view scale
1396 ScViewData
* pViewData
= pOneViewSh
->GetViewData();
1397 pOneViewSh
->SetZoom( pViewData
->GetZoomX(), pViewData
->GetZoomY(), FALSE
);
1400 pOneViewSh
->PaintGrid();
1401 pOneViewSh
->PaintTop();
1402 pOneViewSh
->PaintLeft();
1404 pSh
= SfxViewShell::GetNext( *pSh
, &aScType
);
1411 //------------------------------------------------------------------
1415 //------------------------------------------------------------------
1417 ScInputHandler
* ScModule::GetInputHdl( ScTabViewShell
* pViewSh
, BOOL bUseRef
)
1419 if ( pRefInputHandler
&& bUseRef
)
1420 return pRefInputHandler
;
1422 ScInputHandler
* pHdl
= NULL
;
1425 // in case a UIActive embedded object has no ViewShell ( UNO component )
1426 // the own calc view shell will be set as current, but no handling should happen
1428 ScTabViewShell
* pCurViewSh
= PTR_CAST( ScTabViewShell
, SfxViewShell::Current() );
1429 if ( pCurViewSh
&& !pCurViewSh
->GetUIActiveClient() )
1430 pViewSh
= pCurViewSh
;
1434 pHdl
= pViewSh
->GetInputHandler(); // Viewshell hat jetzt immer einen
1436 // #57989# wenn keine ViewShell uebergeben oder aktiv, kann NULL herauskommen
1437 DBG_ASSERT( pHdl
|| !pViewSh
, "GetInputHdl: kein InputHandler gefunden" );
1441 void ScModule::ViewShellChanged()
1443 ScInputHandler
* pHdl
= GetInputHdl();
1444 ScTabViewShell
* pShell
= ScTabViewShell::GetActiveViewShell();
1445 if ( pShell
&& pHdl
)
1446 pShell
->UpdateInputHandler();
1449 void ScModule::SetInputMode( ScInputMode eMode
)
1451 ScInputHandler
* pHdl
= GetInputHdl();
1453 pHdl
->SetMode( eMode
);
1456 BOOL
ScModule::IsEditMode()
1458 ScInputHandler
* pHdl
= GetInputHdl();
1459 return pHdl
&& pHdl
->IsEditMode();
1462 BOOL
ScModule::IsInputMode()
1464 ScInputHandler
* pHdl
= GetInputHdl();
1465 return pHdl
&& pHdl
->IsInputMode();
1468 BOOL
ScModule::InputKeyEvent( const KeyEvent
& rKEvt
, BOOL bStartEdit
)
1470 ScInputHandler
* pHdl
= GetInputHdl();
1471 return ( pHdl
? pHdl
->KeyInput( rKEvt
, bStartEdit
) : FALSE
);
1474 void ScModule::InputEnterHandler( BYTE nBlockMode
)
1476 if ( !SFX_APP()->IsDowning() ) // nicht beim Programmende
1478 ScInputHandler
* pHdl
= GetInputHdl();
1480 pHdl
->EnterHandler( nBlockMode
);
1484 void ScModule::InputCancelHandler()
1486 ScInputHandler
* pHdl
= GetInputHdl();
1488 pHdl
->CancelHandler();
1491 void ScModule::InputSelection( EditView
* pView
)
1493 ScInputHandler
* pHdl
= GetInputHdl();
1495 pHdl
->InputSelection( pView
);
1498 void ScModule::InputChanged( EditView
* pView
)
1500 ScInputHandler
* pHdl
= GetInputHdl();
1502 pHdl
->InputChanged( pView
);
1505 void ScModule::ViewShellGone( ScTabViewShell
* pViewSh
)
1507 ScInputHandler
* pHdl
= GetInputHdl();
1509 pHdl
->ViewShellGone( pViewSh
);
1511 // Team dialog is opened with the window from a view as parent
1512 // -> close it if any view is closed
1514 pTeamDlg
->Close(); // resets variable pTeamDlg
1517 void ScModule::SetRefInputHdl( ScInputHandler
* pNew
)
1519 pRefInputHandler
= pNew
;
1522 ScInputHandler
* ScModule::GetRefInputHdl()
1524 return pRefInputHandler
;
1527 //------------------------------------------------------------------------
1530 void ScModule::InputGetSelection( xub_StrLen
& rStart
, xub_StrLen
& rEnd
)
1532 ScInputHandler
* pHdl
= GetInputHdl();
1534 pHdl
->InputGetSelection( rStart
, rEnd
);
1537 void ScModule::InputSetSelection( xub_StrLen nStart
, xub_StrLen nEnd
)
1539 ScInputHandler
* pHdl
= GetInputHdl();
1541 pHdl
->InputSetSelection( nStart
, nEnd
);
1544 void ScModule::InputReplaceSelection( const String
& rStr
)
1546 ScInputHandler
* pHdl
= GetInputHdl();
1548 pHdl
->InputReplaceSelection( rStr
);
1551 String
ScModule::InputGetFormulaStr()
1553 ScInputHandler
* pHdl
= GetInputHdl();
1556 aStr
= pHdl
->InputGetFormulaStr();
1560 void ScModule::ActivateInputWindow( const String
* pStrFormula
, BOOL bMatrix
)
1562 ScInputHandler
* pHdl
= GetInputHdl();
1565 ScInputWindow
* pWin
= pHdl
->GetInputWindow();
1568 // Formel uebernehmen
1571 pWin
->SetFuncString( *pStrFormula
, FALSE
);
1572 // SetSumAssignMode wegen FALSE nicht noetig
1574 BYTE nMode
= bMatrix
? SC_ENTER_MATRIX
: SC_ENTER_NORMAL
;
1575 pHdl
->EnterHandler( nMode
);
1577 // ohne Invalidate bleibt die Selektion stehen, wenn die Formel unveraendert ist
1579 pWin
->TextInvalidate();
1586 pWin
->SetFuncString( EMPTY_STRING
, FALSE
);
1587 // SetSumAssignMode wegen FALSE nicht noetig
1589 pHdl
->CancelHandler();
1594 //------------------------------------------------------------------
1596 // Referenz - Dialoge
1598 //------------------------------------------------------------------
1600 void ScModule::SetRefDialog( USHORT nId
, BOOL bVis
, SfxViewFrame
* pViewFrm
)
1602 //! move reference dialog handling to view
1603 //! (only keep function autopilot here for references to other documents)
1605 if(nCurRefDlgId
==0 || (nId
==nCurRefDlgId
&& !bVis
))
1608 pViewFrm
= SfxViewFrame::Current();
1610 // #79379# bindings update causes problems with update of stylist if
1611 // current style family has changed
1613 // pViewFrm->GetBindings().Update(); // to avoid trouble in LockDispatcher
1615 nCurRefDlgId
= bVis
? nId
: 0 ; // before SetChildWindow
1619 // store the dialog id also in the view shell
1620 SfxViewShell
* pViewSh
= pViewFrm
->GetViewShell();
1621 if ( pViewSh
&& pViewSh
->ISA( ScTabViewShell
) )
1622 ((ScTabViewShell
*)pViewSh
)->SetCurRefDlgId( nCurRefDlgId
);
1625 // no ScTabViewShell - possible for example from a Basic macro
1627 nCurRefDlgId
= 0; // don't set nCurRefDlgId if no dialog is created
1630 pViewFrm
->SetChildWindow( nId
, bVis
);
1633 SfxApplication
* pSfxApp
= SFX_APP();
1634 pSfxApp
->Broadcast( SfxSimpleHint( FID_REFMODECHANGED
) );
1638 void ScModule::OpenTeamDlg()
1642 // team dialog needs an existing parent window
1643 // -> use window from active view (dialog is closed in ViewShellGone)
1645 ScTabViewShell
* pShell
= ScTabViewShell::GetActiveViewShell();
1647 pTeamDlg
= new ScTeamDlg( pShell
->GetActiveWin() );
1653 SfxChildWindow
* lcl_GetChildWinFromAnyView( USHORT nId
)
1655 // first try the current view
1657 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
1658 // #i46999# current view frame can be null (for example, when closing help)
1659 SfxChildWindow
* pChildWnd
= pViewFrm
? pViewFrm
->GetChildWindow( nId
) : NULL
;
1661 return pChildWnd
; // found in the current view
1663 // if not found there, get the child window from any open view
1664 // it can be open only in one view because nCurRefDlgId is global
1666 pViewFrm
= SfxViewFrame::GetFirst();
1669 pChildWnd
= pViewFrm
->GetChildWindow( nId
);
1671 return pChildWnd
; // found in any view
1673 pViewFrm
= SfxViewFrame::GetNext( *pViewFrm
);
1676 return NULL
; // none found
1679 BOOL
ScModule::IsModalMode(SfxObjectShell
* pDocSh
)
1681 //! move reference dialog handling to view
1682 //! (only keep function autopilot here for references to other documents)
1684 BOOL bIsModal
= FALSE
;
1688 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1691 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
1692 bIsModal
= pChildWnd
->IsVisible() &&
1693 !( pRefDlg
->IsRefInputMode() && pRefDlg
->IsDocAllowed(pDocSh
) );
1697 // in 592 and above, the dialog isn't visible in other views
1698 // if the dialog is open but can't be accessed, disable input
1703 // pChildWnd kann 0 sein, wenn der Dialog nach dem Umschalten
1704 // von einer anderen Shell noch nicht erzeugt wurde (z.B. in GetFocus)
1708 ScInputHandler
* pHdl
= GetInputHdl();
1710 bIsModal
= pHdl
->IsModalMode(pDocSh
);
1716 BOOL
ScModule::IsTableLocked()
1718 //! move reference dialog handling to view
1719 //! (only keep function autopilot here for references to other documents)
1721 BOOL bLocked
= FALSE
;
1723 // bisher nur bei ScAnyRefDlg
1727 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1729 bLocked
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow())->IsTableLocked();
1731 bLocked
= TRUE
; // for other views, see IsModalMode
1737 BOOL
ScModule::IsRefDialogOpen()
1739 //! move reference dialog handling to view
1740 //! (only keep function autopilot here for references to other documents)
1742 BOOL bIsOpen
= FALSE
;
1746 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1748 bIsOpen
= pChildWnd
->IsVisible();
1750 bIsOpen
= TRUE
; // for other views, see IsModalMode
1756 BOOL
ScModule::IsFormulaMode()
1758 //! move reference dialog handling to view
1759 //! (only keep function autopilot here for references to other documents)
1761 BOOL bIsFormula
= FALSE
;
1765 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1768 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
1769 bIsFormula
= pChildWnd
->IsVisible() && pRefDlg
->IsRefInputMode();
1774 ScInputHandler
* pHdl
= GetInputHdl();
1776 bIsFormula
= pHdl
->IsFormulaMode();
1779 if (bIsInEditCommand
)
1785 void lcl_MarkedTabs( const ScMarkData
& rMark
, SCTAB
& rStartTab
, SCTAB
& rEndTab
)
1787 if (rMark
.GetSelectCount() > 1)
1790 for (SCTAB i
=0; i
<=MAXTAB
; i
++)
1791 if (rMark
.GetTableSelect(i
))
1801 void ScModule::SetReference( const ScRange
& rRef
, ScDocument
* pDoc
,
1802 const ScMarkData
* pMarkData
)
1804 //! move reference dialog handling to view
1805 //! (only keep function autopilot here for references to other documents)
1807 // in Ref-Dialogen wird hiermit auch das Zoom-In ausgeloest,
1808 // wenn Start und Ende der Ref unterschiedlich sind
1810 ScRange aNew
= rRef
;
1811 aNew
.Justify(); // immer "richtig herum"
1815 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1816 DBG_ASSERT( pChildWnd
, "NoChildWin" );
1819 if ( nCurRefDlgId
== SID_OPENDLG_CONSOLIDATE
&& pMarkData
)
1821 SCTAB nStartTab
= aNew
.aStart
.Tab();
1822 SCTAB nEndTab
= aNew
.aEnd
.Tab();
1823 lcl_MarkedTabs( *pMarkData
, nStartTab
, nEndTab
);
1824 aNew
.aStart
.SetTab(nStartTab
);
1825 aNew
.aEnd
.SetTab(nEndTab
);
1828 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
1830 // hide the (color) selection now instead of later from LoseFocus,
1831 // don't abort the ref input that causes this call (bDoneRefMode = FALSE)
1832 pRefDlg
->HideReference( FALSE
);
1833 pRefDlg
->SetReference( aNew
, pDoc
);
1838 ScInputHandler
* pHdl
= GetInputHdl();
1840 pHdl
->SetReference( aNew
, pDoc
);
1843 DBG_ERROR("SetReference ohne Empfaenger");
1848 void ScModule::AddRefEntry() // "Mehrfachselektion"
1850 //! move reference dialog handling to view
1851 //! (only keep function autopilot here for references to other documents)
1855 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1856 DBG_ASSERT( pChildWnd
, "NoChildWin" );
1859 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
1860 pRefDlg
->AddRefEntry();
1865 ScInputHandler
* pHdl
= GetInputHdl();
1867 pHdl
->AddRefEntry();
1871 void ScModule::EndReference()
1873 //! move reference dialog handling to view
1874 //! (only keep function autopilot here for references to other documents)
1876 // in Ref-Dialogen wird hiermit auch das Zoom-In wieder aufgehoben
1878 //! ShowRefFrame am InputHdl, wenn der Funktions-AP offen ist ???
1882 SfxChildWindow
* pChildWnd
= lcl_GetChildWinFromAnyView( nCurRefDlgId
);
1883 DBG_ASSERT( pChildWnd
, "NoChildWin" );
1886 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
1887 pRefDlg
->SetActive();
1892 //------------------------------------------------------------------
1894 // Idle / Online-Spelling
1896 //------------------------------------------------------------------
1898 void ScModule::AnythingChanged()
1900 ULONG nOldTime
= aIdleTimer
.GetTimeout();
1901 if ( nOldTime
!= SC_IDLE_MIN
)
1902 aIdleTimer
.SetTimeout( SC_IDLE_MIN
);
1907 void lcl_CheckNeedsRepaint( ScDocShell
* pDocShell
)
1909 SfxViewFrame
* pFrame
= SfxViewFrame::GetFirst( pDocShell
);
1912 SfxViewShell
* p
= pFrame
->GetViewShell();
1913 ScTabViewShell
* pViewSh
= PTR_CAST(ScTabViewShell
,p
);
1915 pViewSh
->CheckNeedsRepaint();
1916 pFrame
= SfxViewFrame::GetNext( *pFrame
, pDocShell
);
1920 IMPL_LINK( ScModule
, IdleHandler
, Timer
*, EMPTYARG
)
1922 if ( Application::AnyInput( INPUT_MOUSEANDKEYBOARD
) )
1924 aIdleTimer
.Start(); // Timeout unveraendert
1929 ScDocShell
* pDocSh
= PTR_CAST( ScDocShell
, SfxObjectShell::Current() );
1932 ScDocument
* pDoc
= pDocSh
->GetDocument();
1933 if ( pDoc
->IsLoadingDone() )
1935 BOOL bLinks
= pDoc
->IdleCheckLinks();
1936 BOOL bWidth
= pDoc
->IdleCalcTextWidth();
1937 BOOL bSpell
= pDoc
->ContinueOnlineSpelling();
1939 aSpellTimer
.Start(); // da ist noch was
1941 bMore
= bLinks
|| bWidth
|| bSpell
; // ueberhaupt noch was?
1943 // While calculating a Basic formula, a paint event may have occured,
1944 // so check the bNeedsRepaint flags for this document's views
1946 lcl_CheckNeedsRepaint( pDocSh
);
1950 ULONG nOldTime
= aIdleTimer
.GetTimeout();
1951 ULONG nNewTime
= nOldTime
;
1954 nNewTime
= SC_IDLE_MIN
;
1959 // SC_IDLE_COUNT mal mit initialem Timeout, dann hochzaehlen
1961 if ( nIdleCount
< SC_IDLE_COUNT
)
1965 nNewTime
+= SC_IDLE_STEP
;
1966 if ( nNewTime
> SC_IDLE_MAX
)
1967 nNewTime
= SC_IDLE_MAX
;
1970 if ( nNewTime
!= nOldTime
)
1971 aIdleTimer
.SetTimeout( nNewTime
);
1977 IMPL_LINK( ScModule
, SpellTimerHdl
, Timer
*, EMPTYARG
)
1979 if ( Application::AnyInput( INPUT_KEYBOARD
) )
1981 aSpellTimer
.Start();
1982 return 0; // dann spaeter wieder...
1985 ScDocShell
* pDocSh
= PTR_CAST( ScDocShell
, SfxObjectShell::Current() );
1988 ScDocument
* pDoc
= pDocSh
->GetDocument();
1989 if ( pDoc
->ContinueOnlineSpelling() )
1990 aSpellTimer
.Start();
1995 //virtuelle Methoden fuer den Optionendialog
1996 SfxItemSet
* ScModule::CreateItemSet( USHORT nId
)
1998 SfxItemSet
* pRet
= 0;
1999 if(SID_SC_EDITOPTIONS
== nId
)
2001 pRet
= new SfxItemSet( GetPool(),
2003 SID_SCDOCOPTIONS
, SID_SCDOCOPTIONS
,
2005 SID_SCVIEWOPTIONS
, SID_SCVIEWOPTIONS
,
2006 SID_SC_OPT_SYNCZOOM
, SID_SC_OPT_SYNCZOOM
,
2008 SID_SC_INPUT_SELECTION
,SID_SC_INPUT_MARK_HEADER
,
2009 SID_SC_INPUT_TEXTWYSIWYG
,SID_SC_INPUT_TEXTWYSIWYG
,
2010 SID_SC_INPUT_REPLCELLSWARN
,SID_SC_INPUT_REPLCELLSWARN
,
2012 SCITEM_USERLIST
, SCITEM_USERLIST
,
2014 SID_SCPRINTOPTIONS
, SID_SCPRINTOPTIONS
,
2016 SID_ATTR_GRID_OPTIONS
, SID_ATTR_GRID_OPTIONS
,
2018 SID_ATTR_METRIC
, SID_ATTR_METRIC
,
2019 SID_ATTR_DEFTABSTOP
, SID_ATTR_DEFTABSTOP
,
2022 ScDocShell
* pDocSh
= PTR_CAST(ScDocShell
,
2023 SfxObjectShell::Current());
2024 ScDocOptions aCalcOpt
= pDocSh
2025 ? pDocSh
->GetDocument()->GetDocOptions()
2028 ScTabViewShell
* pViewSh
= PTR_CAST(ScTabViewShell
,
2029 SfxViewShell::Current());
2030 ScViewOptions aViewOpt
= pViewSh
2031 ? pViewSh
->GetViewData()->GetOptions()
2034 ScUserListItem
aULItem( SCITEM_USERLIST
);
2035 ScUserList
* pUL
= ScGlobal::GetUserList();
2037 // SFX_APP()->GetOptions( aSet );
2039 pRet
->Put( SfxUInt16Item( SID_ATTR_METRIC
,
2040 sal::static_int_cast
<UINT16
>(GetAppOptions().GetAppMetric()) ) );
2043 pRet
->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP
,
2044 aCalcOpt
.GetTabDistance()));
2045 pRet
->Put( ScTpCalcItem( SID_SCDOCOPTIONS
, aCalcOpt
) );
2048 pRet
->Put( ScTpViewItem( SID_SCVIEWOPTIONS
, aViewOpt
) );
2049 pRet
->Put( SfxBoolItem( SID_SC_OPT_SYNCZOOM
, GetAppOptions().GetSynchronizeZoom() ) );
2052 const ScInputOptions
& rInpOpt
= GetInputOptions();
2053 pRet
->Put( SfxUInt16Item( SID_SC_INPUT_SELECTIONPOS
,
2054 rInpOpt
.GetMoveDir() ) );
2055 pRet
->Put( SfxBoolItem( SID_SC_INPUT_SELECTION
,
2056 rInpOpt
.GetMoveSelection() ) );
2057 pRet
->Put( SfxBoolItem( SID_SC_INPUT_EDITMODE
,
2058 rInpOpt
.GetEnterEdit() ) );
2059 pRet
->Put( SfxBoolItem( SID_SC_INPUT_FMT_EXPAND
,
2060 rInpOpt
.GetExtendFormat() ) );
2061 pRet
->Put( SfxBoolItem( SID_SC_INPUT_RANGEFINDER
,
2062 rInpOpt
.GetRangeFinder() ) );
2063 pRet
->Put( SfxBoolItem( SID_SC_INPUT_REF_EXPAND
,
2064 rInpOpt
.GetExpandRefs() ) );
2065 pRet
->Put( SfxBoolItem( SID_SC_INPUT_MARK_HEADER
,
2066 rInpOpt
.GetMarkHeader() ) );
2067 pRet
->Put( SfxBoolItem( SID_SC_INPUT_TEXTWYSIWYG
,
2068 rInpOpt
.GetTextWysiwyg() ) );
2069 pRet
->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN
,
2070 rInpOpt
.GetReplaceCellsWarn() ) );
2073 pRet
->Put( ScTpPrintItem( SID_SCPRINTOPTIONS
, GetPrintOptions() ) );
2076 SvxGridItem
* pSvxGridItem
= aViewOpt
.CreateGridItem();
2077 pRet
->Put( *pSvxGridItem
);
2078 delete pSvxGridItem
;
2082 aULItem
.SetUserList( *pUL
);
2083 pRet
->Put( aULItem
);
2089 void ScModule::ApplyItemSet( USHORT nId
, const SfxItemSet
& rSet
)
2091 if(SID_SC_EDITOPTIONS
== nId
)
2093 ModifyOptions( rSet
);
2097 SfxTabPage
* ScModule::CreateTabPage( USHORT nId
, Window
* pParent
, const SfxItemSet
& rSet
)
2099 SfxTabPage
* pRet
= NULL
;
2100 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
2101 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
2104 case SID_SC_TP_LAYOUT
:
2106 //CHINA001 pRet = ScTpLayoutOptions::Create(pParent, rSet);
2107 ::CreateTabPage ScTpLayoutOptionsCreate
= pFact
->GetTabPageCreatorFunc( RID_SCPAGE_LAYOUT
);
2108 if ( ScTpLayoutOptionsCreate
)
2109 pRet
= (*ScTpLayoutOptionsCreate
) (pParent
, rSet
);
2112 case SID_SC_TP_CONTENT
:
2114 //CHINA001 pRet = ScTpContentOptions::Create(pParent, rSet);
2115 ::CreateTabPage ScTpContentOptionsCreate
= pFact
->GetTabPageCreatorFunc(RID_SCPAGE_CONTENT
);
2116 if ( ScTpContentOptionsCreate
)
2117 pRet
= (*ScTpContentOptionsCreate
)(pParent
, rSet
);
2120 case SID_SC_TP_GRID
: pRet
= SvxGridTabPage::Create(pParent
, rSet
); break;
2121 case SID_SC_TP_USERLISTS
:
2123 //CHINA001 pRet = ScTpUserLists::Create(pParent, rSet);
2124 ::CreateTabPage ScTpUserListsCreate
= pFact
->GetTabPageCreatorFunc( RID_SCPAGE_USERLISTS
);
2125 if ( ScTpUserListsCreate
)
2126 pRet
= (*ScTpUserListsCreate
)( pParent
, rSet
);
2129 case SID_SC_TP_CALC
:
2130 { //CHINA001 pRet = ScTpCalcOptions::Create(pParent, rSet);
2131 ::CreateTabPage ScTpCalcOptionsCreate
= pFact
->GetTabPageCreatorFunc( RID_SCPAGE_CALC
);
2132 if ( ScTpCalcOptionsCreate
)
2133 pRet
= (*ScTpCalcOptionsCreate
)(pParent
, rSet
);
2136 case SID_SC_TP_FORMULA
:
2138 ::CreateTabPage ScTpFormulaOptionsCreate
= pFact
->GetTabPageCreatorFunc (RID_SCPAGE_FORMULA
);
2139 if (ScTpFormulaOptionsCreate
)
2140 pRet
= (*ScTpFormulaOptionsCreate
)(pParent
, rSet
);
2143 case SID_SC_TP_CHANGES
:
2144 { //CHINA001 pRet = ScRedlineOptionsTabPage::Create(pParent, rSet);
2145 ::CreateTabPage ScRedlineOptionsTabPageCreate
= pFact
->GetTabPageCreatorFunc( RID_SCPAGE_OPREDLINE
);
2146 if ( ScRedlineOptionsTabPageCreate
)
2147 pRet
=(*ScRedlineOptionsTabPageCreate
)(pParent
, rSet
);
2150 case RID_SC_TP_PRINT
:
2151 {//CHINA001 pRet = ScTpPrintOptions::Create(pParent, rSet);
2152 ::CreateTabPage ScTpPrintOptionsCreate
= pFact
->GetTabPageCreatorFunc( RID_SCPAGE_PRINT
);
2153 if ( ScTpPrintOptionsCreate
)
2154 pRet
= (*ScTpPrintOptionsCreate
)( pParent
, rSet
);
2157 case RID_OFA_TP_INTERNATIONAL
:
2159 SfxAbstractDialogFactory
* pSfxFact
= SfxAbstractDialogFactory::Create();
2162 ::CreateTabPage fnCreatePage
= pSfxFact
->GetTabPageCreatorFunc( nId
);
2164 pRet
= (*fnCreatePage
)( pParent
, rSet
);
2169 DBG_ASSERT( pRet
, "ScModule::CreateTabPage(): no valid ID for TabPage!" );
2174 //------------------------------------------------------------------
2176 IMPL_LINK( ScModule
, CalcFieldValueHdl
, EditFieldInfo
*, pInfo
)
2178 //! mit ScFieldEditEngine zusammenfassen !!!
2182 const SvxFieldItem
& rField
= pInfo
->GetField();
2183 const SvxFieldData
* pField
= rField
.GetField();
2185 if (pField
&& pField
->ISA(SvxURLField
))
2187 /******************************************************************
2189 ******************************************************************/
2191 const SvxURLField
* pURLField
= (const SvxURLField
*) pField
;
2192 String aURL
= pURLField
->GetURL();
2194 switch ( pURLField
->GetFormat() )
2196 case SVXURLFORMAT_APPDEFAULT
: //!!! einstellbar an App???
2197 case SVXURLFORMAT_REPR
:
2199 pInfo
->SetRepresentation( pURLField
->GetRepresentation() );
2203 case SVXURLFORMAT_URL
:
2205 pInfo
->SetRepresentation( aURL
);
2210 svtools::ColorConfigEntry eEntry
=
2211 INetURLHistory::GetOrCreate()->QueryUrl( aURL
) ? svtools::LINKSVISITED
: svtools::LINKS
;
2212 pInfo
->SetTxtColor( GetColorConfig().GetColorValue(eEntry
).nColor
);
2216 DBG_ERROR("unbekannter Feldbefehl");
2217 pInfo
->SetRepresentation(String('?'));