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: tabvwsh4.cxx,v $
10 * $Revision: 1.76.102.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"
36 // INCLUDE ---------------------------------------------------------------
38 #include <sfx2/topfrm.hxx>
39 #include "scitems.hxx"
40 #include <svx/eeitem.hxx>
42 #include <sfx2/app.hxx>
43 #include <svx/extrusionbar.hxx>
44 #include <svx/fontworkbar.hxx>
45 #include <svx/boxitem.hxx>
46 #include <svx/fmshell.hxx>
47 #include <svx/sizeitem.hxx>
48 #include <svx/boxitem.hxx>
49 #include <svx/prtqry.hxx>
50 #include <sfx2/request.hxx>
51 #include <sfx2/printer.hxx>
52 #include <sfx2/dispatch.hxx>
53 #include <svtools/printdlg.hxx>
54 #include <svtools/whiter.hxx>
55 #include <svtools/moduleoptions.hxx>
56 #include <rtl/logfile.hxx>
57 #include <tools/urlobj.hxx>
58 #include <sfx2/docfile.hxx>
60 #include "tabvwsh.hxx"
62 #include "globstr.hrc"
63 #include "stlpool.hxx"
64 #include "stlsheet.hxx"
67 #include "appoptio.hxx"
68 #include "rangeutl.hxx"
69 #include "printfun.hxx"
71 #include "drformsh.hxx"
73 #include "pivotsh.hxx"
74 #include "auditsh.hxx"
75 #include "drtxtob.hxx"
76 #include "inputhdl.hxx"
77 #include "editutil.hxx"
78 #include "inputopt.hxx"
79 #include "inputwin.hxx"
80 #include "scresid.hxx"
81 #include "dbcolect.hxx" // fuer ReImport
82 #include "reffact.hxx"
83 #include "viewuno.hxx"
84 #include "dispuno.hxx"
85 #include "anyrefdg.hxx"
86 #include "chgtrack.hxx"
88 #include "oleobjsh.hxx"
89 #include "chartsh.hxx"
90 #include "graphsh.hxx"
91 #include "mediash.hxx"
92 #include "pgbrksh.hxx"
93 #include "dpobject.hxx"
94 #include "prevwsh.hxx"
95 #include "tpprint.hxx"
96 #include "scextopt.hxx"
97 #include "printopt.hxx"
98 #include "drawview.hxx"
100 #include "navsett.hxx"
101 #include "sc.hrc" //CHINA001
102 #include "scabstdlg.hxx" //CHINA001
103 #include "externalrefmgr.hxx"
105 void ActivateOlk( ScViewData
* pViewData
);
106 void DeActivateOlk( ScViewData
* pViewData
);
108 extern SfxViewShell
* pScActiveViewShell
; // global.cxx
110 using namespace com::sun::star
;
112 // STATIC DATA -----------------------------------------------------------
114 USHORT
ScTabViewShell::nInsertCtrlState
= SID_INSERT_GRAPHIC
;
115 USHORT
ScTabViewShell::nInsCellsCtrlState
= 0;
116 USHORT
ScTabViewShell::nInsObjCtrlState
= SID_INSERT_DIAGRAM
;
118 // -----------------------------------------------------------------------
120 void __EXPORT
ScTabViewShell::Activate(BOOL bMDI
)
122 SfxViewShell::Activate(bMDI
);
124 // hier kein GrabFocus, sonst gibt's Probleme wenn etwas inplace editiert wird!
128 // fuer Eingabezeile (ClearCache)
129 ScModule
* pScMod
= SC_MOD();
130 pScMod
->ViewShellChanged();
132 ActivateView( TRUE
, bFirstActivate
);
133 ActivateOlk( GetViewData() );
135 // #56870# AutoCorrect umsetzen, falls der Writer seins neu angelegt hat
136 UpdateDrawTextOutliner();
138 // RegisterNewTargetNames gibts nicht mehr
140 SfxViewFrame
* pThisFrame
= GetViewFrame();
141 if ( pInputHandler
&& pThisFrame
->HasChildWindow(FID_INPUTLINE_STATUS
) )
143 // eigentlich nur beim Reload (letzte Version) noetig:
144 // Das InputWindow bleibt stehen, aber die View mitsamt InputHandler wird
145 // neu angelegt, darum muss der InputHandler am InputWindow gesetzt werden.
146 SfxChildWindow
* pChild
= pThisFrame
->GetChildWindow(FID_INPUTLINE_STATUS
);
149 ScInputWindow
* pWin
= (ScInputWindow
*)pChild
->GetWindow();
150 if (pWin
&& pWin
->IsVisible())
153 ScInputHandler
* pOldHdl
=pWin
->GetInputHandler();
155 TypeId aScType
= TYPE(ScTabViewShell
);
157 SfxViewShell
* pSh
= SfxViewShell::GetFirst( &aScType
);
158 while ( pSh
!=NULL
&& pOldHdl
!=NULL
)
160 if (((ScTabViewShell
*)pSh
)->GetInputHandler() == pOldHdl
)
162 pOldHdl
->ResetDelayTimer();
165 pSh
= SfxViewShell::GetNext( *pSh
, &aScType
);
168 pWin
->SetInputHandler( pInputHandler
);
173 UpdateInputHandler( TRUE
);
175 if ( bFirstActivate
)
177 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_NAVIGATOR_UPDATEALL
) );
178 bFirstActivate
= FALSE
;
180 if ( aPendingUserData
.hasElements() )
182 // #89897# read user data from print preview now, after ctor
183 DoReadUserDataSequence( aPendingUserData
);
184 aPendingUserData
.realloc( 0 );
187 // #116278# ReadExtOptions (view settings from Excel import) must also be done
188 // after the ctor, because of the potential calls to Window::Show.
189 // Even after the fix for #104887# (Window::Show no longer notifies the access
190 // bridge, it's done in ImplSetReallyVisible), there are problems if Window::Show
191 // is called during the ViewShell ctor and reschedules asynchronous calls
192 // (for example from the FmFormShell ctor).
193 ScExtDocOptions
* pExtOpt
= GetViewData()->GetDocument()->GetExtDocOptions();
194 if ( pExtOpt
&& pExtOpt
->IsChanged() )
196 GetViewData()->ReadExtOptions(*pExtOpt
); // Excel view settings
197 SetTabNo( GetViewData()->GetTabNo(), TRUE
);
198 pExtOpt
->SetChanged( false );
202 pScActiveViewShell
= this;
204 ScInputHandler
* pHdl
= pScMod
->GetInputHdl(this);
207 pHdl
->SetRefScale( GetViewData()->GetZoomX(), GetViewData()->GetZoomY() );
210 // Aenderungs-Dialog aktualisieren
212 if ( pThisFrame
->HasChildWindow(FID_CHG_ACCEPT
) )
214 SfxChildWindow
* pChild
= pThisFrame
->GetChildWindow(FID_CHG_ACCEPT
);
217 ((ScAcceptChgDlgWrapper
*)pChild
)->ReInitDlg();
221 if(pScMod
->IsRefDialogOpen())
223 USHORT nModRefDlgId
=pScMod
->GetCurRefDlgId();
224 SfxChildWindow
* pChildWnd
= pThisFrame
->GetChildWindow( nModRefDlgId
);
227 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
228 pRefDlg
->ViewShellChanged(this);
233 // don't call CheckSelectionTransfer here - activating a view should not change the
234 // primary selection (may be happening just because the mouse was moved over the window)
236 // Wenn Referenzeingabe-Tip-Hilfe hier wieder angezeigt werden soll (ShowRefTip),
237 // muss sie beim Verschieben der View angepasst werden (gibt sonst Probleme unter OS/2
238 // beim Umschalten zwischen Dokumenten)
241 void __EXPORT
ScTabViewShell::Deactivate(BOOL bMDI
)
245 ScDocument
* pDoc
=GetViewData()->GetDocument();
247 ScChangeTrack
* pChanges
=pDoc
->GetChangeTrack();
252 pChanges
->SetModifiedLink(aLink
);
255 SfxViewShell::Deactivate(bMDI
);
257 ScInputHandler
* pHdl
= SC_MOD()->GetInputHdl(this);
261 // #85421# during shell deactivation, shells must not be switched, or the loop
262 // through the shell stack (in SfxDispatcher::DoDeactivate_Impl) will not work
263 BOOL bOldDontSwitch
= bDontSwitch
;
266 DeActivateOlk( GetViewData() );
267 ActivateView( FALSE
, FALSE
);
269 if ( GetViewFrame()->GetFrame()->IsInPlace() ) // inplace
270 GetViewData()->GetDocShell()->UpdateOle(GetViewData(),TRUE
);
273 pHdl
->NotifyChange( NULL
, TRUE
); // Timer-verzoegert wg. Dokumentwechsel
275 if (pScActiveViewShell
== this)
276 pScActiveViewShell
= NULL
;
278 bDontSwitch
= bOldDontSwitch
;
282 HideNoteMarker(); // Notiz-Anzeige
285 pHdl
->HideTip(); // Formel-AutoEingabe-Tip abschalten
289 void ScTabViewShell::SetActive()
291 // Die Sfx-View moechte sich gerne selbst aktivieren, weil dabei noch
292 // magische Dinge geschehen (z.B. stuerzt sonst evtl. der Gestalter ab)
296 SfxViewFrame
* pFrame
= GetViewFrame();
297 if ( pFrame
->ISA(SfxTopViewFrame
) )
298 pFrame
->GetFrame()->Appear();
300 SFX_APP()->SetViewFrame( pFrame
); // immer erst Appear, dann SetViewFrame (#29290#)
304 USHORT __EXPORT
ScTabViewShell::PrepareClose(BOOL bUI
, BOOL bForBrowsing
)
306 // Call EnterHandler even in formula mode here,
307 // so a formula change in an embedded object isn't lost
308 // (ScDocShell::PrepareClose isn't called then).
309 ScInputHandler
* pHdl
= SC_MOD()->GetInputHdl( this );
310 if ( pHdl
&& pHdl
->IsInputMode() )
311 pHdl
->EnterHandler();
313 // #110797# draw text edit mode must be closed
314 FuPoor
* pPoor
= GetDrawFuncPtr();
315 if ( pPoor
&& ( IsDrawTextShell() || pPoor
->GetSlotID() == SID_DRAW_NOTEEDIT
) )
317 // "clean" end of text edit, including note handling, subshells and draw func switching,
318 // as in FuDraw and ScTabView::DrawDeselectAll
319 GetViewData()->GetDispatcher().Execute( pPoor
->GetSlotID(), SFX_CALLMODE_SLOT
| SFX_CALLMODE_RECORD
);
321 ScDrawView
* pDrView
= GetScDrawView();
324 // force end of text edit, to be safe
325 // #128314# ScEndTextEdit must always be used, to ensure correct UndoManager
326 pDrView
->ScEndTextEdit();
331 USHORT nRet
= pFormShell
->PrepareClose(bUI
, bForBrowsing
);
335 return SfxViewShell::PrepareClose(bUI
,bForBrowsing
);
338 //------------------------------------------------------------------
340 Size __EXPORT
ScTabViewShell::GetOptimalSizePixel() const
344 SCTAB nCurTab
= GetViewData()->GetTabNo();
345 ScDocument
* pDoc
= GetViewData()->GetDocument();
346 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
347 SfxStyleSheetBase
* pStyleSheet
= pStylePool
->Find(
348 pDoc
->GetPageStyle( nCurTab
),
349 SFX_STYLE_FAMILY_PAGE
);
351 DBG_ASSERT( pStyleSheet
, "PageStyle not found :-/" );
355 const SfxItemSet
& rSet
= pStyleSheet
->GetItemSet();
356 const SvxSizeItem
& rItem
= (const SvxSizeItem
&)rSet
.Get( ATTR_PAGE_SIZE
);
357 const Size
& rPageSize
= rItem
.GetSize();
359 aOptSize
.Width() = (long) (rPageSize
.Width() * GetViewData()->GetPPTX());
360 aOptSize
.Height() = (long) (rPageSize
.Height() * GetViewData()->GetPPTY());
366 //------------------------------------------------------------------
368 // Zoom fuer In-Place berechnen
369 // aus Verhaeltnis von VisArea und Fenstergroesse des GridWin
371 void ScTabViewShell::UpdateOleZoom()
373 ScDocShell
* pDocSh
= GetViewData()->GetDocShell();
374 if ( pDocSh
->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
)
376 //TODO/LATER: is there a difference between the two GetVisArea methods?
377 Size aObjSize
= ((const SfxObjectShell
*)pDocSh
)->GetVisArea().GetSize();
378 if ( aObjSize
.Width() > 0 && aObjSize
.Height() > 0 )
380 Window
* pWin
= GetActiveWin();
381 Size aWinHMM
= pWin
->PixelToLogic( pWin
->GetOutputSizePixel(), MAP_100TH_MM
);
382 SetZoomFactor( Fraction( aWinHMM
.Width(),aObjSize
.Width() ),
383 Fraction( aWinHMM
.Height(),aObjSize
.Height() ) );
388 void __EXPORT
ScTabViewShell::AdjustPosSizePixel( const Point
&rPos
, const Size
&rSize
)
390 OuterResizePixel( rPos
, rSize
);
393 void __EXPORT
ScTabViewShell::InnerResizePixel( const Point
&rOfs
, const Size
&rSize
)
395 Size
aNewSize( rSize
);
396 if ( GetViewFrame()->GetFrame()->IsInPlace() )
399 GetBorderSize( aBorder
, rSize
);
400 SetBorderPixel( aBorder
);
402 Size aObjSize
= GetObjectShell()->GetVisArea().GetSize();
405 aSize
.Width() -= (aBorder
.Left() + aBorder
.Right());
406 aSize
.Height() -= (aBorder
.Top() + aBorder
.Bottom());
408 if ( aObjSize
.Width() > 0 && aObjSize
.Height() > 0 )
410 Size aLogicSize
= GetWindow()->PixelToLogic( aSize
, MAP_100TH_MM
);
411 SfxViewShell::SetZoomFactor( Fraction( aLogicSize
.Width(),aObjSize
.Width() ),
412 Fraction( aLogicSize
.Height(),aObjSize
.Height() ) );
416 aPos
.X() += aBorder
.Left();
417 aPos
.Y() += aBorder
.Top();
418 GetWindow()->SetPosSizePixel( aPos
, aSize
);
423 GetBorderSize( aBorder
, rSize
);
424 SetBorderPixel( aBorder
);
425 aNewSize
.Width() += aBorder
.Left() + aBorder
.Right();
426 aNewSize
.Height() += aBorder
.Top() + aBorder
.Bottom();
429 DoResize( rOfs
, aNewSize
, TRUE
); // rSize = Groesse von gridwin
431 UpdateOleZoom(); // Zoom fuer In-Place berechnen
433 // GetViewData()->GetDocShell()->UpdateOle( GetViewData() );
434 GetViewData()->GetDocShell()->SetDocumentModified();
437 void __EXPORT
ScTabViewShell::OuterResizePixel( const Point
&rOfs
, const Size
&rSize
)
440 GetBorderSize( aBorder
, rSize
);
441 SetBorderPixel( aBorder
);
443 DoResize( rOfs
, rSize
); // Position und Groesse von tabview wie uebergeben
445 // ForceMove als Ersatz fuer den Sfx-Move-Mechanismus
446 // (aWinPos muss aktuell gehalten werden, damit ForceMove beim Ole-Deaktivieren klappt)
451 void __EXPORT
ScTabViewShell::SetZoomFactor( const Fraction
&rZoomX
, const Fraction
&rZoomY
)
455 Fraction
aFrac20( 1,5 );
456 Fraction
aFrac400( 4,1 );
458 Fraction
aNewX( rZoomX
);
459 if ( aNewX
< aFrac20
)
461 if ( aNewX
> aFrac400
)
463 Fraction
aNewY( rZoomY
);
464 if ( aNewY
< aFrac20
)
466 if ( aNewY
> aFrac400
)
469 GetViewData()->UpdateScreenZoom( aNewX
, aNewY
);
470 SetZoom( aNewX
, aNewY
, TRUE
);
476 SfxViewShell::SetZoomFactor( rZoomX
, rZoomY
);
479 void __EXPORT
ScTabViewShell::QueryObjAreaPixel( Rectangle
& rRect
) const
481 // auf ganze Zellen anpassen (in 1/100 mm)
483 Size aPixelSize
= rRect
.GetSize();
484 Window
* pWin
= ((ScTabViewShell
*)this)->GetActiveWin();
485 Size aLogicSize
= pWin
->PixelToLogic( aPixelSize
);
487 const ScViewData
* pViewData
= GetViewData();
488 ScDocument
* pDoc
= pViewData
->GetDocument();
489 ScSplitPos ePos
= pViewData
->GetActivePart();
490 SCCOL nCol
= pViewData
->GetPosX(WhichH(ePos
));
491 SCROW nRow
= pViewData
->GetPosY(WhichV(ePos
));
492 SCTAB nTab
= pViewData
->GetTabNo();
493 BOOL bNegativePage
= pDoc
->IsNegativePage( nTab
);
495 Rectangle aLogicRect
= pDoc
->GetMMRect( nCol
, nRow
, nCol
, nRow
, nTab
);
498 // use right edge of aLogicRect, and aLogicSize
499 aLogicRect
.Left() = aLogicRect
.Right() - aLogicSize
.Width() + 1; // Right() is set below
501 aLogicRect
.SetSize( aLogicSize
);
503 pDoc
->SnapVisArea( aLogicRect
);
505 rRect
.SetSize( pWin
->LogicToPixel( aLogicRect
.GetSize() ) );
508 // auf ganze Zellen anpassen (in Pixeln)
510 ScViewData
* pViewData
= ((ScTabViewShell
*)this)->GetViewData();
511 Size aSize
= rRect
.GetSize();
513 ScSplitPos ePos
= pViewData
->GetActivePart();
514 Window
* pWin
= ((ScTabViewShell
*)this)->GetActiveWin();
516 Point
aTest( aSize
.Width(), aSize
.Height() );
519 pViewData
->GetPosFromPixel( aTest
.X(), aTest
.Y(), ePos
, nPosX
, nPosY
);
522 pViewData
->GetMouseQuadrant( aTest
, ePos
, nPosX
, nPosY
, bLeft
, bTop
);
527 aTest
= pViewData
->GetScrPos( (SCCOL
)nPosX
, (SCROW
)nPosY
, ePos
, TRUE
);
529 rRect
.SetSize(Size(aTest
.X(),aTest
.Y()));
533 //------------------------------------------------------------------
535 void __EXPORT
ScTabViewShell::Move()
537 Point aNewPos
= GetViewFrame()->GetWindow().OutputToScreenPixel(Point());
539 if (aNewPos
!= aWinPos
)
546 //------------------------------------------------------------------
548 void __EXPORT
ScTabViewShell::ShowCursor(FASTBOOL
/* bOn */)
550 /*!!! ShowCursor wird nicht paarweise wie im gridwin gerufen.
551 Der CursorLockCount am Gridwin muss hier direkt auf 0 gesetzt werden
560 //------------------------------------------------------------------
562 void __EXPORT
ScTabViewShell::WriteUserData(String
& rData
, BOOL
/* bBrowse */)
564 GetViewData()->WriteUserData(rData
);
567 void ScTabViewShell::WriteUserDataSequence (uno::Sequence
< beans::PropertyValue
>& rSettings
, sal_Bool
/* bBrowse */ )
569 GetViewData()->WriteUserDataSequence (rSettings
);
572 void __EXPORT
ScTabViewShell::ReadUserData(const String
& rData
, BOOL
/* bBrowse */)
574 if ( !GetViewData()->GetDocShell()->IsPreview() )
575 DoReadUserData( rData
);
578 void ScTabViewShell::ReadUserDataSequence (const uno::Sequence
< beans::PropertyValue
>& rSettings
, sal_Bool
/* bBrowse */ )
580 if ( !GetViewData()->GetDocShell()->IsPreview() )
581 DoReadUserDataSequence( rSettings
);
584 void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence
< beans::PropertyValue
>& rSettings
)
586 Window
* pOldWin
= GetActiveWin();
587 BOOL bFocus
= pOldWin
&& pOldWin
->HasFocus();
589 GetViewData()->ReadUserDataSequence(rSettings
);
590 SetTabNo( GetViewData()->GetTabNo(), TRUE
);
592 if ( GetViewData()->IsPagebreakMode() )
593 SetCurSubShell( GetCurObjectSelectionType(), TRUE
);
595 Window
* pNewWin
= GetActiveWin();
596 if (pNewWin
&& pNewWin
!= pOldWin
)
598 SetWindow( pNewWin
); //! ist diese ViewShell immer aktiv???
600 pNewWin
->GrabFocus();
601 WindowChanged(); // Drawing-Layer (z.B. #56771#)
604 if (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX
||
605 GetViewData()->GetVSplitMode() == SC_SPLIT_FIX
)
614 //! if ViewData has more tables than document, remove tables in ViewData
618 // DoReadUserData is also called from ctor when switching from print preview
620 void ScTabViewShell::DoReadUserData( const String
& rData
)
622 Window
* pOldWin
= GetActiveWin();
623 BOOL bFocus
= pOldWin
&& pOldWin
->HasFocus();
625 GetViewData()->ReadUserData(rData
);
626 SetTabNo( GetViewData()->GetTabNo(), TRUE
);
628 if ( GetViewData()->IsPagebreakMode() )
629 SetCurSubShell( GetCurObjectSelectionType(), TRUE
);
631 Window
* pNewWin
= GetActiveWin();
632 if (pNewWin
&& pNewWin
!= pOldWin
)
634 SetWindow( pNewWin
); //! ist diese ViewShell immer aktiv???
636 pNewWin
->GrabFocus();
637 WindowChanged(); // Drawing-Layer (z.B. #56771#)
640 if (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX
||
641 GetViewData()->GetVSplitMode() == SC_SPLIT_FIX
)
650 //! if ViewData has more tables than document, remove tables in ViewData
654 //------------------------------------------------------------------
656 //UNUSED2008-05 void ScTabViewShell::ExecuteShowNIY( SfxRequest& /* rReq */ )
658 //UNUSED2008-05 ErrorMessage(STR_BOX_YNI);
661 //UNUSED2008-05 //------------------------------------------------------------------
663 //UNUSED2008-05 void ScTabViewShell::StateDisabled( SfxItemSet& rSet )
665 //UNUSED2008-05 SfxWhichIter aIter( rSet );
666 //UNUSED2008-05 USHORT nWhich = aIter.FirstWhich();
668 //UNUSED2008-05 while ( nWhich )
670 //UNUSED2008-05 rSet.DisableItem( nWhich );
671 //UNUSED2008-05 nWhich = aIter.NextWhich();
675 void ScTabViewShell::SetDrawShellOrSub()
677 bActiveDrawSh
= TRUE
;
679 if(bActiveDrawFormSh
)
681 SetCurSubShell(OST_DrawForm
);
683 else if(bActiveGraphicSh
)
685 SetCurSubShell(OST_Graphic
);
687 else if(bActiveMediaSh
)
689 SetCurSubShell(OST_Media
);
691 else if(bActiveChartSh
)
693 SetCurSubShell(OST_Chart
);
695 else if(bActiveOleObjectSh
)
697 SetCurSubShell(OST_OleObject
);
701 SetCurSubShell(OST_Drawing
, true /* force: different toolbars are
702 visible concerning shape type
707 void ScTabViewShell::SetDrawShell( BOOL bActive
)
711 SetCurSubShell(OST_Drawing
, true /* force: different toolbars are
712 visible concerning shape type
717 if(bActiveDrawFormSh
|| bActiveDrawSh
||
718 bActiveGraphicSh
|| bActiveMediaSh
|| bActiveOleObjectSh
||
719 bActiveChartSh
|| bActiveDrawTextSh
)
721 SetCurSubShell(OST_Cell
);
723 bActiveDrawFormSh
=FALSE
;
724 bActiveGraphicSh
=FALSE
;
725 bActiveMediaSh
=FALSE
;
726 bActiveOleObjectSh
=FALSE
;
727 bActiveChartSh
=FALSE
;
730 BOOL bWasDraw
= bActiveDrawSh
|| bActiveDrawTextSh
;
732 bActiveDrawSh
= bActive
;
733 bActiveDrawTextSh
= FALSE
;
737 ResetDrawDragMode(); // Mirror / Rotate aus
739 if (bWasDraw
&& (GetViewData()->GetHSplitMode() == SC_SPLIT_FIX
||
740 GetViewData()->GetVSplitMode() == SC_SPLIT_FIX
))
742 // Aktiven Teil an Cursor anpassen, etc.
743 MoveCursorAbs( GetViewData()->GetCurX(), GetViewData()->GetCurY(),
744 SC_FOLLOW_NONE
, FALSE
, FALSE
, TRUE
);
749 void ScTabViewShell::SetDrawTextShell( BOOL bActive
)
751 bActiveDrawTextSh
= bActive
;
754 bActiveDrawFormSh
=FALSE
;
755 bActiveGraphicSh
=FALSE
;
756 bActiveMediaSh
=FALSE
;
757 bActiveOleObjectSh
=FALSE
;
758 bActiveChartSh
=FALSE
;
759 bActiveDrawSh
= FALSE
;
760 SetCurSubShell(OST_DrawText
);
763 SetCurSubShell(OST_Cell
);
767 void ScTabViewShell::SetPivotShell( BOOL bActive
)
769 bActivePivotSh
= bActive
;
771 // #68771# #76198# SetPivotShell is called from CursorPosChanged every time
772 // -> don't change anything except switching between cell and pivot shell
774 if ( eCurOST
== OST_Pivot
|| eCurOST
== OST_Cell
)
778 bActiveDrawTextSh
= bActiveDrawSh
= FALSE
;
779 bActiveDrawFormSh
=FALSE
;
780 bActiveGraphicSh
=FALSE
;
781 bActiveMediaSh
=FALSE
;
782 bActiveOleObjectSh
=FALSE
;
783 bActiveChartSh
=FALSE
;
784 SetCurSubShell(OST_Pivot
);
787 SetCurSubShell(OST_Cell
);
791 void ScTabViewShell::SetAuditShell( BOOL bActive
)
793 bActiveAuditingSh
= bActive
;
796 bActiveDrawTextSh
= bActiveDrawSh
= FALSE
;
797 bActiveDrawFormSh
=FALSE
;
798 bActiveGraphicSh
=FALSE
;
799 bActiveMediaSh
=FALSE
;
800 bActiveOleObjectSh
=FALSE
;
801 bActiveChartSh
=FALSE
;
802 SetCurSubShell(OST_Auditing
);
805 SetCurSubShell(OST_Cell
);
808 void ScTabViewShell::SetDrawFormShell( BOOL bActive
)
810 bActiveDrawFormSh
= bActive
;
812 if(bActiveDrawFormSh
)
813 SetCurSubShell(OST_DrawForm
);
815 void ScTabViewShell::SetChartShell( BOOL bActive
)
817 bActiveChartSh
= bActive
;
820 SetCurSubShell(OST_Chart
);
823 void ScTabViewShell::SetGraphicShell( BOOL bActive
)
825 bActiveGraphicSh
= bActive
;
828 SetCurSubShell(OST_Graphic
);
831 void ScTabViewShell::SetMediaShell( BOOL bActive
)
833 bActiveMediaSh
= bActive
;
836 SetCurSubShell(OST_Media
);
839 void ScTabViewShell::SetOleObjectShell( BOOL bActive
)
841 bActiveOleObjectSh
= bActive
;
843 if(bActiveOleObjectSh
)
844 SetCurSubShell(OST_OleObject
);
846 SetCurSubShell(OST_Cell
);
849 void ScTabViewShell::SetEditShell(EditView
* pView
, BOOL bActive
)
854 pEditShell
->SetEditView( pView
);
856 pEditShell
= new ScEditShell( pView
, GetViewData() );
858 SetCurSubShell(OST_Editing
);
860 else if(bActiveEditSh
)
862 SetCurSubShell(OST_Cell
);
864 bActiveEditSh
= bActive
;
867 void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST
, BOOL bForce
)
869 ScViewData
* pViewData
= GetViewData();
870 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
872 if(bDontSwitch
) return;
874 if(!pCellShell
) //Wird eh immer gebraucht.
876 pCellShell
= new ScCellShell( GetViewData() );
877 pCellShell
->SetRepeatTarget( &aTarget
);
880 BOOL bPgBrk
=pViewData
->IsPagebreakMode();
882 if(bPgBrk
&& !pPageBreakShell
)
884 pPageBreakShell
= new ScPageBreakShell( this );
885 pPageBreakShell
->SetRepeatTarget( &aTarget
);
889 if ( eOST
!=eCurOST
|| bForce
)
891 BOOL bCellBrush
= FALSE
; // "format paint brush" allowed for cells
892 BOOL bDrawBrush
= FALSE
; // "format paint brush" allowed for drawing objects
894 if(eCurOST
!=OST_NONE
) RemoveSubShell();
896 if (pFormShell
&& !bFormShellAtTop
)
897 AddSubShell(*pFormShell
); // add below own subshells
903 AddSubShell(*pCellShell
);
904 if(bPgBrk
) AddSubShell(*pPageBreakShell
);
910 AddSubShell(*pCellShell
);
911 if(bPgBrk
) AddSubShell(*pPageBreakShell
);
915 AddSubShell(*pEditShell
);
921 if ( !pDrawTextShell
)
923 pDocSh
->MakeDrawLayer();
924 pDrawTextShell
= new ScDrawTextObjectBar( GetViewData() );
926 AddSubShell(*pDrawTextShell
);
931 if (svx::checkForSelectedCustomShapes(
932 GetScDrawView(), true /* bOnlyExtruded */ )) {
933 if (pExtrusionBarShell
== 0)
934 pExtrusionBarShell
= new svx::ExtrusionBar(this);
935 AddSubShell( *pExtrusionBarShell
);
937 sal_uInt32 nCheckStatus
= 0;
938 if (svx::checkForSelectedFontWork(
939 GetScDrawView(), nCheckStatus
)) {
940 if (pFontworkBarShell
== 0)
941 pFontworkBarShell
= new svx::FontworkBar(this);
942 AddSubShell( *pFontworkBarShell
);
947 pDocSh
->MakeDrawLayer();
948 pDrawShell
= new ScDrawShell( GetViewData() );
949 pDrawShell
->SetRepeatTarget( &aTarget
);
951 AddSubShell(*pDrawShell
);
958 if ( !pDrawFormShell
)
960 pDocSh
->MakeDrawLayer();
961 pDrawFormShell
= new ScDrawFormShell( GetViewData() );
962 pDrawFormShell
->SetRepeatTarget( &aTarget
);
964 AddSubShell(*pDrawFormShell
);
973 pDocSh
->MakeDrawLayer();
974 pChartShell
= new ScChartShell( GetViewData() );
975 pChartShell
->SetRepeatTarget( &aTarget
);
977 AddSubShell(*pChartShell
);
984 if ( !pOleObjectShell
)
986 pDocSh
->MakeDrawLayer();
987 pOleObjectShell
= new ScOleObjectShell( GetViewData() );
988 pOleObjectShell
->SetRepeatTarget( &aTarget
);
990 AddSubShell(*pOleObjectShell
);
999 pDocSh
->MakeDrawLayer();
1000 pGraphicShell
= new ScGraphicShell( GetViewData() );
1001 pGraphicShell
->SetRepeatTarget( &aTarget
);
1003 AddSubShell(*pGraphicShell
);
1012 pDocSh
->MakeDrawLayer();
1013 pMediaShell
= new ScMediaShell( GetViewData() );
1014 pMediaShell
->SetRepeatTarget( &aTarget
);
1016 AddSubShell(*pMediaShell
);
1022 AddSubShell(*pCellShell
);
1023 if(bPgBrk
) AddSubShell(*pPageBreakShell
);
1027 pPivotShell
= new ScPivotShell( this );
1028 pPivotShell
->SetRepeatTarget( &aTarget
);
1030 AddSubShell(*pPivotShell
);
1036 AddSubShell(*pCellShell
);
1037 if(bPgBrk
) AddSubShell(*pPageBreakShell
);
1039 if ( !pAuditingShell
)
1041 pDocSh
->MakeDrawLayer(); // die Wartezeit lieber jetzt als beim Klick
1043 pAuditingShell
= new ScAuditingShell( GetViewData() );
1044 pAuditingShell
->SetRepeatTarget( &aTarget
);
1046 AddSubShell(*pAuditingShell
);
1051 DBG_ERROR("Falsche Shell angefordert");
1055 if (pFormShell
&& bFormShellAtTop
)
1056 AddSubShell(*pFormShell
); // add on top of own subshells
1060 // abort "format paint brush" when switching to an incompatible shell
1061 if ( ( GetBrushDocument() && !bCellBrush
) || ( GetDrawBrushSet() && !bDrawBrush
) )
1062 ResetBrushDocument();
1066 void ScTabViewShell::SetFormShellAtTop( BOOL bSet
)
1068 if ( pFormShell
&& !bSet
)
1069 pFormShell
->ForgetActiveControl(); // let the FormShell know it no longer has the focus
1071 if ( bFormShellAtTop
!= bSet
)
1073 bFormShellAtTop
= bSet
;
1074 SetCurSubShell( GetCurObjectSelectionType(), TRUE
);
1078 IMPL_LINK( ScTabViewShell
, FormControlActivated
, FmFormShell
*, EMPTYARG
)
1080 // a form control got the focus, so the form shell has to be on top
1081 SetFormShellAtTop( TRUE
);
1085 ObjectSelectionType
ScTabViewShell::GetCurObjectSelectionType()
1090 // GetMySubShell / SetMySubShell: altes Verhalten simulieren,
1091 // dass es nur eine SubShell gibt (nur innerhalb der 5 eignenen SubShells)
1093 SfxShell
* ScTabViewShell::GetMySubShell() const
1095 // GetSubShell() war frueher const, und GetSubShell(USHORT) sollte es auch sein...
1098 SfxShell
* pSub
= ((ScTabViewShell
*)this)->GetSubShell(nPos
);
1101 if ( pSub
== pDrawShell
|| pSub
== pDrawTextShell
|| pSub
== pEditShell
||
1102 pSub
== pPivotShell
|| pSub
== pAuditingShell
|| pSub
== pDrawFormShell
||
1103 pSub
== pCellShell
|| pSub
== pOleObjectShell
|| pSub
== pChartShell
||
1104 pSub
== pGraphicShell
|| pSub
== pMediaShell
|| pSub
== pPageBreakShell
)
1105 return pSub
; // gefunden
1107 pSub
= ((ScTabViewShell
*)this)->GetSubShell(++nPos
);
1109 return NULL
; // keine von meinen dabei
1112 //UNUSED2008-05 void ScTabViewShell::SetMySubShell( SfxShell* pShell )
1114 //UNUSED2008-05 SfxShell* pOld = GetMySubShell();
1115 //UNUSED2008-05 if ( pOld != pShell )
1117 //UNUSED2008-05 if (pOld)
1118 //UNUSED2008-05 RemoveSubShell(pOld); // alte SubShell entfernen
1119 //UNUSED2008-05 if (pShell)
1120 //UNUSED2008-05 AddSubShell(*pShell); // neue setzen
1124 BOOL
ScTabViewShell::IsDrawTextShell() const
1126 return ( pDrawTextShell
&& ( GetMySubShell() == pDrawTextShell
) );
1129 BOOL
ScTabViewShell::IsAuditShell() const
1131 return ( pAuditingShell
&& ( GetMySubShell() == pAuditingShell
) );
1134 void ScTabViewShell::SetDrawTextUndo( SfxUndoManager
* pNewUndoMgr
)
1136 // Default: Undo-Manager der DocShell
1138 pNewUndoMgr
= GetViewData()->GetDocShell()->GetUndoManager();
1142 pDrawTextShell
->SetUndoManager(pNewUndoMgr
);
1143 ScDocShell
* pDocSh
= GetViewData()->GetDocShell();
1144 if ( pNewUndoMgr
== pDocSh
->GetUndoManager() &&
1145 !pDocSh
->GetDocument()->IsUndoEnabled() )
1147 pNewUndoMgr
->SetMaxUndoActionCount( 0 );
1152 DBG_ERROR("SetDrawTextUndo ohne DrawTextShell");
1156 //------------------------------------------------------------------
1158 ScTabViewShell
* ScTabViewShell::GetActiveViewShell()
1160 return PTR_CAST(ScTabViewShell
,Current());
1163 //------------------------------------------------------------------
1165 SfxPrinter
* __EXPORT
ScTabViewShell::GetPrinter( BOOL bCreate
)
1167 // Drucker ist immer da (wird fuer die FontListe schon beim Starten angelegt)
1168 return GetViewData()->GetDocShell()->GetPrinter(bCreate
);
1171 USHORT __EXPORT
ScTabViewShell::SetPrinter( SfxPrinter
*pNewPrinter
, USHORT nDiffFlags
, bool )
1173 return GetViewData()->GetDocShell()->SetPrinter( pNewPrinter
, nDiffFlags
);
1176 PrintDialog
* __EXPORT
ScTabViewShell::CreatePrintDialog( Window
*pParent
)
1178 ScDocShell
* pDocShell
= GetViewData()->GetDocShell();
1179 ScDocument
* pDoc
= pDocShell
->GetDocument();
1181 pDoc
->SetPrintOptions(); // Optionen aus OFA am Printer setzen
1182 SfxPrinter
* pPrinter
= GetPrinter();
1185 PrintDialog
* pDlg
= new PrintDialog( pParent
, true );
1186 SCTAB nTabCount
= pDoc
->GetTableCount();
1187 long nDocPageMax
= 0;
1189 pDlg
->EnableSheetRange( true, PRINTSHEETS_ALL
);
1190 pDlg
->EnableSheetRange( true, PRINTSHEETS_SELECTED_SHEETS
);
1191 pDlg
->EnableSheetRange( true, PRINTSHEETS_SELECTED_CELLS
);
1192 bool bAllTabs
= SC_MOD()->GetPrintOptions().GetAllSheets();
1193 pDlg
->CheckSheetRange( bAllTabs
? PRINTSHEETS_ALL
: PRINTSHEETS_SELECTED_SHEETS
);
1195 // update all pending row heights with a single progress bar,
1196 // instead of a separate progress for each sheet from ScPrintFunc
1197 pDocShell
->UpdatePendingRowHeights( MAXTAB
, true );
1199 ScMarkData aMarkData
;
1200 aMarkData
.SelectTable( GetViewData()->GetTabNo(), TRUE
);
1202 for ( SCTAB i
=0; i
<nTabCount
; i
++ )
1204 if ( !bAllTabs
&& !aMarkData
.GetTableSelect( i
) )
1206 ScPrintFunc
aPrintFunc( pDocShell
, pPrinter
, i
);
1207 nDocPageMax
+= aPrintFunc
.GetTotalPages();
1210 if ( nDocPageMax
> 0 )
1213 if ( nDocPageMax
> 1 )
1216 aStrRange
+= String::CreateFromInt32( nDocPageMax
);
1220 pDlg
->SetRangeText ( aStrRange
);
1221 pDlg
->EnableRange ( PRINTDIALOG_ALL
);
1222 pDlg
->EnableRange ( PRINTDIALOG_RANGE
);
1223 pDlg
->SetFirstPage ( 1 );
1224 pDlg
->SetMinPage ( 1 );
1225 pDlg
->SetLastPage ( (USHORT
)nDocPageMax
);
1226 pDlg
->SetMaxPage ( (USHORT
)nDocPageMax
);
1227 pDlg
->EnableCollate ();
1232 SfxTabPage
* ScTabViewShell::CreatePrintOptionsPage( Window
*pParent
, const SfxItemSet
&rOptions
)
1234 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
1235 DBG_ASSERT(pFact
, "ScAbstractFactory create fail!");//CHINA001
1236 //CHINA001 return ScTpPrintOptions::Create( pParent, rOptions );
1237 ::CreateTabPage ScTpPrintOptionsCreate
= pFact
->GetTabPageCreatorFunc( RID_SCPAGE_PRINT
);
1238 if ( ScTpPrintOptionsCreate
)
1239 return (*ScTpPrintOptionsCreate
)( pParent
, rOptions
);
1243 void __EXPORT
ScTabViewShell::PreparePrint( PrintDialog
* pPrintDialog
)
1245 ScDocShell
* pDocShell
= GetViewData()->GetDocShell();
1247 SfxViewShell::PreparePrint( pPrintDialog
);
1248 pDocShell
->PreparePrint( pPrintDialog
, &GetViewData()->GetMarkData() );
1251 ErrCode
ScTabViewShell::DoPrint( SfxPrinter
*pPrinter
,
1252 PrintDialog
*pPrintDialog
, BOOL bSilent
, BOOL bIsAPI
)
1254 // #72527# if SID_PRINTDOCDIRECT is executed and there's a selection,
1255 // ask if only the selection should be printed
1257 const ScMarkData
& rMarkData
= GetViewData()->GetMarkData();
1258 if ( !pPrintDialog
&& !bSilent
&& !bIsAPI
&& ( rMarkData
.IsMarked() || rMarkData
.IsMultiMarked() ) )
1260 SvxPrtQryBox
aQuery( GetDialogParent() );
1261 short nBtn
= aQuery
.Execute();
1263 if ( nBtn
== RET_CANCEL
)
1264 return ERRCODE_IO_ABORT
;
1266 if ( nBtn
== RET_OK
)
1267 bPrintSelected
= TRUE
;
1270 ErrCode nRet
= ERRCODE_IO_ABORT
;
1272 ScDocShell
* pDocShell
= GetViewData()->GetDocShell();
1273 if ( pDocShell
->CheckPrint( pPrintDialog
, &GetViewData()->GetMarkData(), bPrintSelected
, bIsAPI
) )
1275 // get the list of affected sheets before SfxViewShell::Print
1276 bool bAllTabs
= ( pPrintDialog
? ( pPrintDialog
->GetCheckedSheetRange() == PRINTSHEETS_ALL
) : SC_MOD()->GetPrintOptions().GetAllSheets() );
1278 uno::Sequence
<sal_Int32
> aSheets
;
1279 SCTAB nTabCount
= pDocShell
->GetDocument()->GetTableCount();
1280 USHORT nPrinted
= 0;
1281 for ( SCTAB nTab
=0; nTab
<nTabCount
; nTab
++ )
1282 if ( bAllTabs
|| rMarkData
.GetTableSelect(nTab
) )
1284 aSheets
.realloc( nPrinted
+ 1 );
1285 aSheets
[nPrinted
] = nTab
;
1289 uno::Sequence
< beans::PropertyValue
> aProps(1);
1290 aProps
[0].Name
=::rtl::OUString::createFromAscii("PrintSheets");
1291 aProps
[0].Value
<<= aSheets
;
1292 SetAdditionalPrintOptions( aProps
);
1294 // SfxViewShell::DoPrint calls Print (after StartJob etc.)
1295 nRet
= SfxViewShell::DoPrint( pPrinter
, pPrintDialog
, bSilent
, bIsAPI
);
1298 bPrintSelected
= FALSE
;
1303 USHORT __EXPORT
ScTabViewShell::Print( SfxProgress
& rProgress
, BOOL bIsAPI
,
1304 PrintDialog
* pPrintDialog
)
1306 ScDocShell
* pDocShell
= GetViewData()->GetDocShell();
1307 pDocShell
->GetDocument()->SetPrintOptions(); // Optionen aus OFA am Printer setzen
1309 SfxViewShell::Print( rProgress
, bIsAPI
, pPrintDialog
);
1310 pDocShell
->Print( rProgress
, pPrintDialog
, &GetViewData()->GetMarkData(),
1311 GetDialogParent(), bPrintSelected
, bIsAPI
);
1315 void ScTabViewShell::StopEditShell()
1317 if ( pEditShell
!= NULL
&& !bDontSwitch
)
1318 SetEditShell(NULL
, FALSE
);
1321 //------------------------------------------------------------------
1323 // close handler to ensure function of dialog:
1325 IMPL_LINK( ScTabViewShell
, SimpleRefClose
, String
*, EMPTYARG
)
1327 SfxInPlaceClient
* pClient
= GetIPClient();
1328 if ( pClient
&& pClient
->IsObjectInPlaceActive() )
1330 // If range selection was started with an active embedded object,
1331 // switch back to original sheet (while the dialog is still open).
1333 SetTabNo( GetViewData()->GetRefTabNo() );
1336 ScSimpleRefDlgWrapper::SetAutoReOpen( TRUE
);
1340 // handlers to call UNO listeners:
1342 ScTabViewObj
* lcl_GetViewObj( ScTabViewShell
& rShell
)
1344 ScTabViewObj
* pRet
= NULL
;
1345 SfxViewFrame
* pViewFrame
= rShell
.GetViewFrame();
1348 SfxFrame
* pFrame
= pViewFrame
->GetFrame();
1351 uno::Reference
<frame::XController
> xController
= pFrame
->GetController();
1352 if (xController
.is())
1353 pRet
= ScTabViewObj::getImplementation( xController
);
1359 IMPL_LINK( ScTabViewShell
, SimpleRefDone
, String
*, pResult
)
1361 ScTabViewObj
* pImpObj
= lcl_GetViewObj( *this );
1362 if ( pImpObj
&& pResult
)
1363 pImpObj
->RangeSelDone( *pResult
);
1367 IMPL_LINK( ScTabViewShell
, SimpleRefAborted
, String
*, pResult
)
1369 ScTabViewObj
* pImpObj
= lcl_GetViewObj( *this );
1370 if ( pImpObj
&& pResult
)
1371 pImpObj
->RangeSelAborted( *pResult
);
1375 IMPL_LINK( ScTabViewShell
, SimpleRefChange
, String
*, pResult
)
1377 ScTabViewObj
* pImpObj
= lcl_GetViewObj( *this );
1378 if ( pImpObj
&& pResult
)
1379 pImpObj
->RangeSelChanged( *pResult
);
1383 void ScTabViewShell::StartSimpleRefDialog(
1384 const String
& rTitle
, const String
& rInitVal
,
1385 BOOL bCloseOnButtonUp
, BOOL bSingleCell
, BOOL bMultiSelection
)
1387 SfxViewFrame
* pViewFrm
= GetViewFrame();
1389 if ( GetActiveViewShell() != this )
1391 // #i18833# / #i34499# The API method can be called for a view that's not active.
1392 // Then the view has to be activated first, the same way as in Execute for SID_CURRENTDOC.
1393 // Can't use GrabFocus here, because it needs to take effect immediately.
1395 if ( pViewFrm
->ISA(SfxTopViewFrame
) )
1396 pViewFrm
->GetFrame()->Appear();
1399 USHORT nId
= ScSimpleRefDlgWrapper::GetChildWindowId();
1401 SC_MOD()->SetRefDialog( nId
, TRUE
, pViewFrm
);
1403 ScSimpleRefDlgWrapper
* pWnd
= (ScSimpleRefDlgWrapper
*)pViewFrm
->GetChildWindow( nId
);
1406 pWnd
->SetCloseHdl( LINK( this, ScTabViewShell
, SimpleRefClose
) );
1407 pWnd
->SetUnoLinks( LINK( this, ScTabViewShell
, SimpleRefDone
),
1408 LINK( this, ScTabViewShell
, SimpleRefAborted
),
1409 LINK( this, ScTabViewShell
, SimpleRefChange
) );
1410 pWnd
->SetRefString( rInitVal
);
1411 pWnd
->SetFlags( bCloseOnButtonUp
, bSingleCell
, bMultiSelection
);
1412 pWnd
->SetAutoReOpen( FALSE
);
1413 Window
* pWin
= pWnd
->GetWindow();
1414 pWin
->SetText( rTitle
);
1415 pWnd
->StartRefInput();
1419 void ScTabViewShell::StopSimpleRefDialog()
1421 SfxViewFrame
* pViewFrm
= GetViewFrame();
1422 USHORT nId
= ScSimpleRefDlgWrapper::GetChildWindowId();
1424 ScSimpleRefDlgWrapper
* pWnd
= (ScSimpleRefDlgWrapper
*)pViewFrm
->GetChildWindow( nId
);
1427 Window
* pWin
= pWnd
->GetWindow();
1428 if (pWin
&& pWin
->IsSystemWindow())
1429 ((SystemWindow
*)pWin
)->Close(); // calls abort handler
1433 //------------------------------------------------------------------
1435 BOOL
ScTabViewShell::TabKeyInput(const KeyEvent
& rKEvt
)
1437 ScModule
* pScMod
= SC_MOD();
1439 SfxViewFrame
* pThisFrame
= GetViewFrame();
1440 if ( pThisFrame
->GetChildWindow( SID_OPENDLG_FUNCTION
) )
1443 KeyCode aCode
= rKEvt
.GetKeyCode();
1444 BOOL bShift
= aCode
.IsShift();
1445 BOOL bControl
= aCode
.IsMod1();
1446 BOOL bAlt
= aCode
.IsMod2();
1447 USHORT nCode
= aCode
.GetCode();
1449 BOOL bInPlace
= pScMod
->IsEditMode(); // Editengine bekommt alles
1450 BOOL bAnyEdit
= pScMod
->IsInputMode(); // nur Zeichen & Backspace
1451 BOOL bDraw
= IsDrawTextEdit();
1453 HideNoteMarker(); // Notiz-Anzeige
1455 // don't do extra HideCursor/ShowCursor calls if EnterHandler will switch to a different sheet
1456 BOOL bOnRefSheet
= ( GetViewData()->GetRefTabNo() == GetViewData()->GetTabNo() );
1457 BOOL bHideCursor
= ( ( nCode
== KEY_RETURN
&& bInPlace
) || nCode
== KEY_TAB
) && bOnRefSheet
;
1462 ScDocument
* pDoc
= GetViewData()->GetDocument();
1464 pDoc
->KeyInput( rKEvt
); // TimerDelays etc.
1468 bUsed
= pScMod
->InputKeyEvent( rKEvt
); // Eingabe
1470 bUsed
= sal::static_int_cast
<BOOL
>(SfxViewShell::KeyInput( rKEvt
)); // accelerators
1474 BOOL bIsType
= FALSE
;
1475 USHORT nModi
= aCode
.GetModifier();
1476 USHORT nGroup
= aCode
.GetGroup();
1478 if ( nGroup
== KEYGROUP_NUM
|| nGroup
== KEYGROUP_ALPHA
|| nGroup
== 0 )
1479 if ( !bControl
&& !bAlt
)
1482 if ( nGroup
== KEYGROUP_MISC
)
1486 bIsType
= bControl
&& !bAlt
; // Control, Shift-Control-Return
1487 if ( !bIsType
&& nModi
== 0 )
1489 // Will der InputHandler auch ein einfaches Return?
1491 ScInputHandler
* pHdl
= pScMod
->GetInputHdl(this);
1492 bIsType
= pHdl
&& pHdl
->TakesReturn();
1496 bIsType
= !bControl
&& !bAlt
; // ohne Modifier oder Shift-Space
1500 bIsType
= (nModi
== 0); // nur ohne Modifier
1507 bUsed
= pScMod
->InputKeyEvent( rKEvt
); // Eingabe
1510 bUsed
= sal::static_int_cast
<BOOL
>(SfxViewShell::KeyInput( rKEvt
)); // accelerators
1512 if ( !bUsed
&& !bIsType
&& nCode
!= KEY_RETURN
) // Eingabe nochmal hinterher
1513 bUsed
= pScMod
->InputKeyEvent( rKEvt
);
1517 // #51889# Spezialfall: Copy/Cut bei Mehrfachselektion -> Fehlermeldung
1518 // (Slot ist disabled, SfxViewShell::KeyInput wuerde also kommentarlos verschluckt)
1519 KeyFuncType eFunc
= aCode
.GetFunction();
1520 if ( eFunc
== KEYFUNC_CUT
)
1523 ScMarkType eMarkType
= GetViewData()->GetSimpleArea( aDummy
);
1524 if ( eMarkType
!= SC_MARK_SIMPLE
&&
1525 !(eFunc
== KEYFUNC_COPY
&& eMarkType
== SC_MARK_SIMPLE_FILTERED
) )
1527 ErrorMessage(STR_NOMULTISELECT
);
1532 bUsed
= sal::static_int_cast
<BOOL
>(SfxViewShell::KeyInput( rKEvt
)); // accelerators
1534 // #74696# during inplace editing, some slots are handled by the
1535 // container app and are executed during Window::KeyInput.
1536 // -> don't pass keys to input handler that would be used there
1537 // but should call slots instead.
1538 BOOL bParent
= ( GetViewFrame()->GetFrame()->IsInPlace() && eFunc
!= KEYFUNC_DONTKNOW
);
1540 if( !bUsed
&& !bDraw
&& nCode
!= KEY_RETURN
&& !bParent
)
1541 bUsed
= pScMod
->InputKeyEvent( rKEvt
, TRUE
); // Eingabe
1544 if (!bInPlace
&& !bUsed
&& !bDraw
)
1550 BOOL bNormal
= !bControl
&& !bAlt
;
1551 if ( !bAnyEdit
&& bNormal
)
1553 // je nach Optionen mit Enter in den Edit-Modus schalten
1555 const ScInputOptions
& rOpt
= pScMod
->GetInputOptions();
1556 if ( rOpt
.GetEnterEdit() )
1558 pScMod
->SetInputMode( SC_INPUT_TABLE
);
1563 BOOL bEditReturn
= bControl
&& !bShift
; // An Edit-Engine weiter
1564 if ( !bUsed
&& !bEditReturn
)
1569 BYTE nMode
= SC_ENTER_NORMAL
;
1570 if ( bShift
&& bControl
)
1571 nMode
= SC_ENTER_MATRIX
;
1573 nMode
= SC_ENTER_BLOCK
;
1574 pScMod
->InputEnterHandler(nMode
);
1576 if (nMode
== SC_ENTER_NORMAL
)
1579 GetViewData()->GetDispatcher().Execute( SID_CURSORENTERUP
,
1580 SFX_CALLMODE_SLOT
| SFX_CALLMODE_RECORD
);
1582 GetViewData()->GetDispatcher().Execute( SID_CURSORENTERDOWN
,
1583 SFX_CALLMODE_SLOT
| SFX_CALLMODE_RECORD
);
1586 UpdateInputHandler(TRUE
);
1591 // hier kein UpdateInputHandler, weil bei Referenzeingabe auf ein
1592 // anderes Dokument diese ViewShell nicht die ist, auf der eingegeben
1602 // Alt-Cursortasten hart codiert, weil Alt nicht konfigurierbar ist
1604 if ( !bUsed
&& bAlt
&& !bControl
)
1610 ModifyCellSize( DIR_TOP
, bShift
);
1614 ModifyCellSize( DIR_BOTTOM
, bShift
);
1618 ModifyCellSize( DIR_LEFT
, bShift
);
1622 ModifyCellSize( DIR_RIGHT
, bShift
);
1626 nSlotId
= bShift
? SID_CURSORPAGELEFT_SEL
: SID_CURSORPAGELEFT_
;
1629 nSlotId
= bShift
? SID_CURSORPAGERIGHT_SEL
: SID_CURSORPAGERIGHT_
;
1634 GetViewData()->GetDispatcher().Execute( nSlotId
, SFX_CALLMODE_SLOT
| SFX_CALLMODE_RECORD
);
1645 BOOL
ScTabViewShell::SfxKeyInput(const KeyEvent
& rKeyEvent
)
1647 return sal::static_int_cast
<BOOL
>(SfxViewShell::KeyInput( rKeyEvent
));
1650 FASTBOOL __EXPORT
ScTabViewShell::KeyInput( const KeyEvent
&rKeyEvent
)
1652 // return SfxViewShell::KeyInput( rKeyEvent );
1653 return TabKeyInput( rKeyEvent
);
1656 //------------------------------------------------------------------
1658 // SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_DISABLE_ACCELS ),
1660 #define __INIT_ScTabViewShell \
1661 eCurOST(OST_NONE), \
1663 nCtrlSfxId(USHRT_MAX), \
1664 nFormSfxId(USHRT_MAX), \
1666 pDrawTextShell(NULL), \
1668 pPivotShell(NULL), \
1669 pAuditingShell(NULL), \
1670 pDrawFormShell(NULL), \
1672 pOleObjectShell(NULL), \
1673 pChartShell(NULL), \
1674 pGraphicShell(NULL), \
1675 pMediaShell(NULL), \
1676 pPageBreakShell(NULL), \
1677 pExtrusionBarShell(NULL), \
1678 pFontworkBarShell(NULL), \
1680 pInputHandler(NULL), \
1681 pCurFrameLine(NULL), \
1683 pDialogDPObject(NULL), \
1684 pNavSettings(NULL), \
1685 bActiveDrawSh(FALSE), \
1686 bActiveDrawTextSh(FALSE), \
1687 bActivePivotSh(FALSE), \
1688 bActiveAuditingSh(FALSE), \
1689 bActiveDrawFormSh(FALSE), \
1690 bActiveOleObjectSh(FALSE), \
1691 bActiveChartSh(FALSE), \
1692 bActiveGraphicSh(FALSE), \
1693 bActiveMediaSh(FALSE), \
1694 bActiveEditSh(FALSE), \
1695 bFormShellAtTop(FALSE), \
1696 bDontSwitch(FALSE), \
1697 bInFormatDialog(FALSE), \
1698 bPrintSelected(FALSE), \
1700 pScSbxObject(NULL), \
1701 /*bChartDlgIsEdit(FALSE),*/ \
1702 bChartAreaValid(FALSE), \
1704 pAccessibilityBroadcaster(NULL)
1707 //------------------------------------------------------------------
1709 void ScTabViewShell::Construct( BYTE nForceDesignMode
)
1711 SfxApplication
* pSfxApp
= SFX_APP();
1712 ScDocShell
* pDocSh
= GetViewData()->GetDocShell();
1713 ScDocument
* pDoc
= pDocSh
->GetDocument();
1715 bReadOnly
= pDocSh
->IsReadOnly();
1717 SetName( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("View")) ); // fuer SBX
1718 Color
aColBlack( COL_BLACK
);
1719 // SetPool( &pSfxApp->GetPool() );
1720 SetPool( &SC_MOD()->GetPool() );
1721 SetWindow( GetActiveWin() );
1723 pCurFrameLine
= new SvxBorderLine( &aColBlack
, 20, 0, 0 );
1724 pPivotSource
= new ScArea
;
1725 StartListening(*GetViewData()->GetDocShell(),TRUE
);
1726 StartListening(*GetViewFrame(),TRUE
);
1727 StartListening(*pSfxApp
,TRUE
); // #i62045# #i62046# application is needed for Calc's own hints
1729 SfxViewFrame
* pFirst
= SfxViewFrame::GetFirst(pDocSh
);
1730 BOOL bFirstView
= !pFirst
1731 || (pFirst
== GetViewFrame() && !SfxViewFrame::GetNext(*pFirst
,pDocSh
));
1733 if ( pDocSh
->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
)
1735 //TODO/LATER: is there a difference between the two GetVisArea methods?
1736 Rectangle aVisArea
= ((const SfxObjectShell
*)pDocSh
)->GetVisArea();
1738 SCTAB nVisTab
= pDoc
->GetVisibleTab();
1739 if (!pDoc
->HasTable(nVisTab
))
1742 pDoc
->SetVisibleTab(nVisTab
);
1744 SetTabNo( nVisTab
);
1745 BOOL bNegativePage
= pDoc
->IsNegativePage( nVisTab
);
1746 // show the right cells
1747 GetViewData()->SetScreenPos( bNegativePage
? aVisArea
.TopRight() : aVisArea
.TopLeft() );
1749 if ( GetViewFrame()->GetFrame()->IsInPlace() ) // inplace
1751 pDocSh
->SetInplace( TRUE
); // schon so initialisiert
1752 if (pDoc
->IsEmbedded())
1753 pDoc
->ResetEmbedded(); // keine blaue Markierung
1755 else if ( bFirstView
)
1757 pDocSh
->SetInplace( FALSE
);
1758 GetViewData()->RefreshZoom(); // recalculate PPT
1759 if (!pDoc
->IsEmbedded())
1760 pDoc
->SetEmbedded( aVisArea
); // VisArea markieren
1765 // #48721# jeder Task hat neuerdings sein eigenes InputWindow,
1766 // darum muesste eigentlich entweder jeder Task seinen InputHandler bekommen,
1767 // oder das InputWindow muesste sich beim App-InputHandler anmelden, wenn der
1768 // Task aktiv wird, oder das InputWindow muesste sich den InputHandler selbst
1769 // anlegen (dann immer ueber das InputWindow suchen, und nur wenn das nicht da
1770 // ist, den InputHandler von der App nehmen).
1771 // Als Sofortloesung bekommt erstmal jede View ihren Inputhandler, das gibt
1772 // nur noch Probleme, wenn zwei Views in einem Task-Fenster sind.
1774 pInputHandler
= new ScInputHandler
;
1777 // if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE oder Plug-In
1778 // pInputHandler = new ScInputHandler;
1780 // FormShell vor MakeDrawView anlegen, damit die DrawView auf jeden Fall
1781 // an der FormShell angemeldet werden kann
1782 // Gepusht wird die FormShell im ersten Activate
1783 pFormShell
= new FmFormShell(this);
1784 pFormShell
->SetControlActivationHandler( LINK( this, ScTabViewShell
, FormControlActivated
) );
1786 // DrawView darf nicht im TabView - ctor angelegt werden,
1787 // wenn die ViewShell noch nicht kostruiert ist...
1788 if (pDoc
->GetDrawLayer())
1789 MakeDrawView( nForceDesignMode
);
1790 ViewOptionsHasChanged(FALSE
); // legt auch evtl. DrawView an
1792 SfxUndoManager
* pMgr
= pDocSh
->GetUndoManager();
1793 SetUndoManager( pMgr
);
1794 pFormShell
->SetUndoManager( pMgr
);
1795 if ( !pDoc
->IsUndoEnabled() )
1797 pMgr
->SetMaxUndoActionCount( 0 );
1799 SetRepeatTarget( &aTarget
);
1800 pFormShell
->SetRepeatTarget( &aTarget
);
1801 SetHelpId( HID_SCSHELL_TABVWSH
);
1803 if ( bFirstView
) // first view?
1805 pDoc
->SetDocVisible( TRUE
); // used when creating new sheets
1806 if ( pDocSh
->IsEmpty() )
1808 // set first sheet's RTL flag (following will already be initialized because of SetDocVisible)
1809 pDoc
->SetLayoutRTL( 0, ScGlobal::IsSystemRTL() );
1811 // append additional sheets (not for OLE object)
1812 if ( pDocSh
->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED
)
1814 SCTAB nInitTabCount
= 3; //! konfigurierbar !!!
1815 for (SCTAB i
=1; i
<nInitTabCount
; i
++)
1816 pDoc
->MakeTable(i
,false);
1819 pDocSh
->SetEmpty( FALSE
); // #i6232# make sure this is done only once
1822 // ReadExtOptions is now in Activate
1824 // Link-Update nicht verschachteln
1825 if ( pDocSh
->GetCreateMode() != SFX_CREATE_MODE_INTERNAL
&&
1826 pDocSh
->IsUpdateEnabled() ) // #105575#; update only in the first creation of the ViewShell
1828 // Check if there are any external data.
1829 bool bLink
= pDoc
->GetExternalRefManager()->hasExternalData();
1832 // #i100042# sheet links can still exist independently from external formula references
1833 SCTAB nTabCount
= pDoc
->GetTableCount();
1834 for (SCTAB i
=0; i
<nTabCount
&& !bLink
; i
++)
1835 if (pDoc
->IsLinked(i
))
1839 if (pDoc
->HasDdeLinks() || pDoc
->HasAreaLinks())
1844 pFirst
= GetViewFrame();
1846 if(SC_MOD()->GetCurRefDlgId()==0)
1848 pFirst
->GetDispatcher()->Execute( SID_UPDATETABLINKS
,
1849 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
1853 BOOL bReImport
= FALSE
; // importierte Daten aktualisieren
1854 ScDBCollection
* pDBColl
= pDoc
->GetDBCollection();
1857 USHORT nCount
= pDBColl
->GetCount();
1858 for (USHORT i
=0; i
<nCount
&& !bReImport
; i
++)
1860 ScDBData
* pData
= (*pDBColl
)[i
];
1861 if ( pData
->IsStripData() &&
1862 pData
->HasImportParam() && !pData
->HasImportSelection() )
1869 pFirst
= GetViewFrame();
1870 if(SC_MOD()->GetCurRefDlgId()==0)
1872 pFirst
->GetDispatcher()->Execute( SID_REIMPORT_AFTER_LOAD
,
1873 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
1879 UpdateAutoFillMark();
1881 // ScDispatchProviderInterceptor registers itself in ctor
1882 xDisProvInterceptor
= new ScDispatchProviderInterceptor( this );
1884 bFirstActivate
= TRUE
; // NavigatorUpdate aufschieben bis Activate()
1886 // #105575#; update only in the first creation of the ViewShell
1887 pDocSh
->SetUpdateEnabled(FALSE
);
1889 if ( GetViewFrame()->GetFrame()->IsInPlace() )
1890 UpdateHeaderWidth(); // The implace activation requires headers to be calculated
1893 GetBorderSize( aBorder
, Size() );
1894 SetBorderPixel( aBorder
);
1897 //------------------------------------------------------------------
1899 //UNUSED2008-05 ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
1900 //UNUSED2008-05 const ScTabViewShell& rWin ) :
1901 //UNUSED2008-05 SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ),
1902 //UNUSED2008-05 ScDBFunc( &pViewFrame->GetWindow(), rWin, this ),
1903 //UNUSED2008-05 __INIT_ScTabViewShell
1905 //UNUSED2008-05 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabViewShell::ScTabViewShell" );
1907 //UNUSED2008-05 Construct();
1909 //UNUSED2008-05 UpdatePageBreakData();
1911 //UNUSED2008-05 /*uno::Reference<frame::XFrame> xFrame = pViewFrame->GetFrame()->GetFrameInterface();
1912 //UNUSED2008-05 if (xFrame.is())
1913 //UNUSED2008-05 xFrame->setComponent( uno::Reference<awt::XWindow>(), new ScTabViewObj( this ) );*/
1914 //UNUSED2008-05 // make Controller known to SFX
1915 //UNUSED2008-05 new ScTabViewObj( this );
1917 //UNUSED2008-05 SetCurSubShell(OST_Cell);
1918 //UNUSED2008-05 SvBorder aBorder;
1919 //UNUSED2008-05 GetBorderSize( aBorder, Size() );
1920 //UNUSED2008-05 SetBorderPixel( aBorder );
1923 //------------------------------------------------------------------
1925 ScTabViewShell::ScTabViewShell( SfxViewFrame
* pViewFrame
,
1926 SfxViewShell
* pOldSh
) :
1927 SfxViewShell( pViewFrame
, SFX_VIEW_MAXIMIZE_FIRST
| SFX_VIEW_CAN_PRINT
| SFX_VIEW_HAS_PRINTOPTIONS
),
1928 ScDBFunc( &pViewFrame
->GetWindow(), (ScDocShell
&)*pViewFrame
->GetObjectShell(), this ),
1929 __INIT_ScTabViewShell
1931 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog
, "sc", "nn93723", "ScTabViewShell::ScTabViewShell" );
1933 const ScAppOptions
& rAppOpt
= SC_MOD()->GetAppOptions();
1935 // if switching back from print preview,
1936 // restore the view settings that were active when creating the preview
1937 // #89897# ReadUserData must not happen from ctor, because the view's edit window
1938 // has to be shown by the sfx. ReadUserData is deferred until the first Activate call.
1939 // #106334# old DesignMode state from form layer must be restored, too
1941 BYTE nForceDesignMode
= SC_FORCEMODE_NONE
;
1942 if ( pOldSh
&& pOldSh
->ISA( ScPreviewShell
) )
1944 ScPreviewShell
* pPreviewShell
= ((ScPreviewShell
*)pOldSh
);
1945 aPendingUserData
= pPreviewShell
->GetSourceData(); // used in Activate
1946 nForceDesignMode
= pPreviewShell
->GetSourceDesignMode();
1949 Construct( nForceDesignMode
);
1951 if ( GetViewData()->GetDocShell()->IsPreview() )
1953 // preview for template dialog: always show whole page
1954 SetZoomType( SVX_ZOOM_WHOLEPAGE
, TRUE
); // zoom value is recalculated at next Resize
1958 Fraction
aFract( rAppOpt
.GetZoom(), 100 );
1959 SetZoom( aFract
, aFract
, TRUE
);
1960 SetZoomType( rAppOpt
.GetZoomType(), TRUE
);
1963 /*uno::Reference<frame::XFrame> xFrame = pViewFrame->GetFrame()->GetFrameInterface();
1965 xFrame->setComponent( uno::Reference<awt::XWindow>(), new ScTabViewObj( this ) );*/
1966 // make Controller known to SFX
1967 new ScTabViewObj( this );
1969 SetCurSubShell(OST_Cell
);
1971 GetBorderSize( aBorder
, Size() );
1972 SetBorderPixel( aBorder
);
1978 #undef __INIT_ScTabViewShell
1980 //------------------------------------------------------------------
1982 __EXPORT
ScTabViewShell::~ScTabViewShell()
1984 ScDocShell
* pDocSh
= GetViewData()->GetDocShell();
1985 EndListening(*pDocSh
);
1986 EndListening(*GetViewFrame());
1987 EndListening(*SFX_APP()); // #i62045# #i62046# needed now - SfxViewShell no longer does it
1989 SC_MOD()->ViewShellGone(this);
1991 RemoveSubShell(); // alle
1994 // #54104# alles auf NULL, falls aus dem TabView-dtor noch darauf zugegriffen wird
1995 //! (soll eigentlich nicht !??!?!)
1997 DELETEZ(pFontworkBarShell
);
1998 DELETEZ(pExtrusionBarShell
);
1999 DELETEZ(pCellShell
);
2000 DELETEZ(pPageBreakShell
);
2001 DELETEZ(pDrawShell
);
2002 DELETEZ(pDrawFormShell
);
2003 DELETEZ(pOleObjectShell
);
2004 DELETEZ(pChartShell
);
2005 DELETEZ(pGraphicShell
);
2006 DELETEZ(pMediaShell
);
2007 DELETEZ(pDrawTextShell
);
2008 DELETEZ(pEditShell
);
2009 DELETEZ(pPivotShell
);
2010 DELETEZ(pAuditingShell
);
2011 DELETEZ(pCurFrameLine
);
2012 DELETEZ(pInputHandler
);
2013 DELETEZ(pPivotSource
);
2014 DELETEZ(pDialogDPObject
);
2015 DELETEZ(pNavSettings
);
2017 DELETEZ(pFormShell
);
2018 DELETEZ(pAccessibilityBroadcaster
);
2021 //------------------------------------------------------------------
2023 void ScTabViewShell::SetDialogDPObject( const ScDPObject
* pObj
)
2025 delete pDialogDPObject
;
2027 pDialogDPObject
= new ScDPObject( *pObj
);
2029 pDialogDPObject
= NULL
;
2032 //------------------------------------------------------------------
2034 void ScTabViewShell::FillFieldData( ScHeaderFieldData
& rData
)
2036 ScDocShell
* pDocShell
= GetViewData()->GetDocShell();
2037 ScDocument
* pDoc
= pDocShell
->GetDocument();
2038 SCTAB nTab
= GetViewData()->GetTabNo();
2039 pDoc
->GetName( nTab
, rData
.aTabName
);
2041 rData
.aTitle
= pDocShell
->GetTitle();
2042 const INetURLObject
& rURLObj
= pDocShell
->GetMedium()->GetURLObject();
2043 rData
.aLongDocName
= rURLObj
.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS
);
2044 if ( rData
.aLongDocName
.Len() )
2045 rData
.aShortDocName
= rURLObj
.GetName( INetURLObject::DECODE_UNAMBIGUOUS
);
2047 rData
.aShortDocName
= rData
.aLongDocName
= rData
.aTitle
;
2049 rData
.nTotalPages
= 99;
2051 // eNumType kennt der Dialog selber
2054 //------------------------------------------------------------------
2056 void ScTabViewShell::SetChartArea( const ScRangeListRef
& rSource
, const Rectangle
& rDest
)
2058 bChartAreaValid
= TRUE
;
2059 aChartSource
= rSource
;
2061 nChartDestTab
= GetViewData()->GetTabNo();
2064 //UNUSED2008-05 void ScTabViewShell::ResetChartArea()
2066 //UNUSED2008-05 bChartAreaValid = FALSE;
2069 BOOL
ScTabViewShell::GetChartArea( ScRangeListRef
& rSource
, Rectangle
& rDest
, SCTAB
& rTab
) const
2071 rSource
= aChartSource
;
2073 rTab
= nChartDestTab
;
2074 return bChartAreaValid
;
2077 //UNUSED2008-05 BOOL ScTabViewShell::IsChartDlgEdit() const
2079 //UNUSED2008-05 return bChartDlgIsEdit;
2082 //UNUSED2008-05 const String& ScTabViewShell::GetEditChartName() const
2084 //UNUSED2008-05 return aEditChartName;
2087 ScNavigatorSettings
* ScTabViewShell::GetNavigatorSettings()
2090 pNavSettings
= new ScNavigatorSettings
;
2091 return pNavSettings
;
2095 //------------------------------------------------------------------
2097 void ScTabViewShell::ExecTbx( SfxRequest
& rReq
)
2099 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
2100 USHORT nSlot
= rReq
.GetSlot();
2101 const SfxPoolItem
* pItem
= NULL
;
2103 pReqArgs
->GetItemState( nSlot
, TRUE
, &pItem
);
2107 case SID_TBXCTL_INSERT
:
2109 nInsertCtrlState
= ((const SfxUInt16Item
*)pItem
)->GetValue();
2111 case SID_TBXCTL_INSCELLS
:
2113 nInsCellsCtrlState
= ((const SfxUInt16Item
*)pItem
)->GetValue();
2115 case SID_TBXCTL_INSOBJ
:
2117 nInsObjCtrlState
= ((const SfxUInt16Item
*)pItem
)->GetValue();
2120 DBG_ERROR("Slot im Wald");
2122 GetViewFrame()->GetBindings().Invalidate( nSlot
);
2125 void ScTabViewShell::GetTbxState( SfxItemSet
& rSet
)
2127 rSet
.Put( SfxUInt16Item( SID_TBXCTL_INSERT
, nInsertCtrlState
) );
2128 rSet
.Put( SfxUInt16Item( SID_TBXCTL_INSCELLS
, nInsCellsCtrlState
) );
2130 // ohne installiertes Chart darf Chart nicht Default sein...
2131 if ( nInsObjCtrlState
== SID_DRAW_CHART
&& !SvtModuleOptions().IsChart() )
2132 nInsObjCtrlState
= SID_INSERT_OBJECT
;
2134 rSet
.Put( SfxUInt16Item( SID_TBXCTL_INSOBJ
, nInsObjCtrlState
) );