1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_TABVWSH_HXX
21 #define SC_TABVWSH_HXX
23 #include <svtools/htmlcfg.hxx>
24 #include <sfx2/viewsh.hxx>
25 #include <sfx2/viewfac.hxx>
26 #include <editeng/svxenum.hxx>
30 #include "rangelst.hxx"
31 #include "shellids.hxx"
32 #include "tabprotection.hxx"
34 #include <boost/ptr_container/ptr_map.hpp>
41 class SfxModelessDialog
;
42 class SvxNumberInfoItem
;
43 struct SfxChildWinInfo
;
46 class ScAuditingShell
;
48 class ScDrawTextObjectBar
;
52 class ScDrawFormShell
;
54 class ScOleObjectShell
;
58 class ScPageBreakShell
;
60 class ScNavigatorSettings
;
63 struct ScHeaderFieldData
;
65 namespace editeng
{ class SvxBorderLine
; }
67 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{
68 class XDispatchProviderInterceptor
;
76 enum ObjectSelectionType
92 //==================================================================
95 class ScTabViewShell
: public SfxViewShell
, public ScDBFunc
98 static sal_uInt16 nInsertCtrlState
;
99 static sal_uInt16 nInsCellsCtrlState
;
100 static sal_uInt16 nInsObjCtrlState
;
102 SvxHtmlOptions aHTMLOpt
;
103 ObjectSelectionType eCurOST
;
104 sal_uInt16 nDrawSfxId
;
105 sal_uInt16 nCtrlSfxId
;
106 sal_uInt16 nFormSfxId
;
107 OUString sDrawCustom
; // current custom shape type
108 ScDrawShell
* pDrawShell
;
109 ScDrawTextObjectBar
* pDrawTextShell
;
110 ScEditShell
* pEditShell
;
111 ScPivotShell
* pPivotShell
;
112 ScAuditingShell
* pAuditingShell
;
113 ScDrawFormShell
* pDrawFormShell
;
114 ScCellShell
* pCellShell
;
115 ScOleObjectShell
* pOleObjectShell
;
116 ScChartShell
* pChartShell
;
117 ScGraphicShell
* pGraphicShell
;
118 ScMediaShell
* pMediaShell
;
119 ScPageBreakShell
* pPageBreakShell
;
120 svx::ExtrusionBar
* pExtrusionBarShell
;
121 svx::FontworkBar
* pFontworkBarShell
;
123 FmFormShell
* pFormShell
;
125 ScInputHandler
* pInputHandler
; // for OLE input cell
127 ::editeng::SvxBorderLine
* pCurFrameLine
;
129 ::com::sun::star::uno::Reference
<
130 ::com::sun::star::frame::XDispatchProviderInterceptor
>
135 ScTabViewTarget aTarget
;
136 ScArea
* pPivotSource
;
137 ScDPObject
* pDialogDPObject
;
139 ScNavigatorSettings
* pNavSettings
;
141 // used in first Activate
142 sal_Bool bFirstActivate
;
144 sal_Bool bActiveDrawSh
;
145 sal_Bool bActiveDrawTextSh
;
146 sal_Bool bActivePivotSh
;
147 sal_Bool bActiveAuditingSh
;
148 sal_Bool bActiveDrawFormSh
;
149 sal_Bool bActiveOleObjectSh
;
150 sal_Bool bActiveChartSh
;
151 sal_Bool bActiveGraphicSh
;
152 sal_Bool bActiveMediaSh
;
153 sal_Bool bActiveEditSh
;
155 sal_Bool bFormShellAtTop
; // does the FormShell need to be on top?
158 sal_Bool bDontSwitch
; // Don't turn off EditShell
159 sal_Bool bInFormatDialog
; // for GetSelectionText
160 sal_Bool bPrintSelected
; // for result of SvxPrtQryBox
162 sal_Bool bReadOnly
; // to detect status changes
164 SbxObject
* pScSbxObject
;
166 sal_Bool bChartAreaValid
; // if chart is drawn
167 OUString aEditChartName
;
168 ScRangeListRef aChartSource
;
171 sal_uInt16 nCurRefDlgId
;
173 SfxBroadcaster
* pAccessibilityBroadcaster
;
175 static const int MASTERENUMCOMMANDS
= 6;
176 OUString aCurrShapeEnumCommand
[ MASTERENUMCOMMANDS
];
178 // ugly hack for Add button in ScNameDlg
179 boost::ptr_map
<OUString
, ScRangeName
> maRangeMap
;
185 void Construct( sal_uInt8 nForceDesignMode
= SC_FORCEMODE_NONE
);
187 SfxShell
* GetMySubShell() const;
189 void DoReadUserData( const OUString
& rData
);
190 void DoReadUserDataSequence( const ::com::sun::star::uno::Sequence
<
191 ::com::sun::star::beans::PropertyValue
>& rSettings
);
193 DECL_LINK( SimpleRefClose
, void* );
194 DECL_LINK( SimpleRefDone
, OUString
* );
195 DECL_LINK( SimpleRefAborted
, OUString
* );
196 DECL_LINK( SimpleRefChange
, OUString
* );
197 DECL_LINK( FormControlActivated
, void* );
200 virtual void Activate(sal_Bool bMDI
);
201 virtual void Deactivate(sal_Bool bMDI
);
202 virtual sal_uInt16
PrepareClose( sal_Bool bUI
= sal_True
, sal_Bool bForBrowsing
= false );
204 virtual void ShowCursor(bool bOn
);
206 virtual void Move(); // Benachrichtigung
208 virtual void AdjustPosSizePixel( const Point
&rPos
, const Size
&rSize
); // alt
210 virtual void InnerResizePixel( const Point
&rOfs
, const Size
&rSize
); // neu
211 virtual void OuterResizePixel( const Point
&rOfs
, const Size
&rSize
);
212 virtual void SetZoomFactor( const Fraction
&rZoomX
, const Fraction
&rZoomY
);
214 virtual void QueryObjAreaPixel( Rectangle
& rRect
) const;
216 virtual OUString
GetSelectionText( bool bWholeWord
);
217 virtual sal_Bool
HasSelection( sal_Bool bText
) const;
218 virtual OUString
GetDescription() const;
220 virtual void WriteUserData(OUString
&, bool bBrowse
= false);
221 virtual void ReadUserData(const OUString
&, bool bBrowse
= false);
222 virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>&, sal_Bool bBrowse
= false );
223 virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>&, sal_Bool bBrowse
= false );
225 virtual void UIDeactivated( SfxInPlaceClient
* pClient
);
227 virtual bool KeyInput( const KeyEvent
&rKeyEvent
);
228 virtual SdrView
* GetDrawView() const;
231 TYPEINFO_VISIBILITY(SC_DLLPUBLIC
);
233 SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL
)
234 SFX_DECL_VIEWFACTORY(ScTabViewShell
);
237 /** -> Clone Method for Factory
238 Created from a general shell and inherit as much as possible */
239 ScTabViewShell( SfxViewFrame
* pViewFrame
,
240 SfxViewShell
* pOldSh
);
242 virtual ~ScTabViewShell();
244 SC_DLLPUBLIC Window
* GetDialogParent();
246 bool IsRefInputMode() const;
247 void ExecuteInputDirect();
249 ScInputHandler
* GetInputHandler() const;
250 void UpdateInputHandler( sal_Bool bForce
= false, sal_Bool bStopEditing
= sal_True
);
251 void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust
);
252 sal_Bool
TabKeyInput(const KeyEvent
& rKEvt
);
253 sal_Bool
SfxKeyInput(const KeyEvent
& rKEvt
);
257 ::editeng::SvxBorderLine
* GetDefaultFrameLine() const { return pCurFrameLine
; }
258 void SetDefaultFrameLine(const ::editeng::SvxBorderLine
* pLine
);
260 SC_DLLPUBLIC
void Execute( SfxRequest
& rReq
);
261 SC_DLLPUBLIC
void GetState( SfxItemSet
& rSet
);
263 void ExecuteTable( SfxRequest
& rReq
);
264 void GetStateTable( SfxItemSet
& rSet
);
266 void WindowChanged();
267 void ExecDraw(SfxRequest
&);
268 void ExecDrawIns(SfxRequest
& rReq
);
269 void GetDrawState(SfxItemSet
&rSet
);
270 void GetDrawInsState(SfxItemSet
&rSet
);
271 void ExecGallery(SfxRequest
& rReq
); // StarGallery
272 void GetGalleryState(SfxItemSet
& rSet
);
274 void ExecChildWin(SfxRequest
& rReq
);
275 void GetChildWinState( SfxItemSet
& rSet
);
277 void ExecImageMap( SfxRequest
& rReq
);
278 void GetImageMapState( SfxItemSet
& rSet
);
280 void ExecTbx( SfxRequest
& rReq
);
281 void GetTbxState( SfxItemSet
& rSet
);
283 void ExecuteSave( SfxRequest
& rReq
);
284 void GetSaveState( SfxItemSet
& rSet
);
285 void ExecSearch( SfxRequest
& rReq
);
287 void ExecuteUndo(SfxRequest
& rReq
);
288 void GetUndoState(SfxItemSet
&rSet
);
290 void ExecuteSbx( SfxRequest
& rReq
);
291 void GetSbxState( SfxItemSet
& rSet
);
293 void ExecuteObject(SfxRequest
& rReq
);
294 void GetObjectState(SfxItemSet
&rSet
);
296 void ExecDrawOpt(SfxRequest
& rReq
);
297 void GetDrawOptState(SfxItemSet
&rSet
);
299 void UpdateDrawShell();
300 void SetDrawShell( sal_Bool bActive
);
301 void SetDrawTextShell( sal_Bool bActive
);
303 void SetPivotShell( sal_Bool bActive
);
304 ScArea
* GetPivotSource(){return pPivotSource
;}
305 void SetPivotSource(ScArea
* pSrc
){pPivotSource
=pSrc
;}
306 void SetDialogDPObject( const ScDPObject
* pObj
);
307 const ScDPObject
* GetDialogDPObject() const { return pDialogDPObject
; }
309 sal_Bool
GetDontSwitch(){return bDontSwitch
;}
310 void SetDontSwitch(sal_Bool bFlag
){bDontSwitch
=bFlag
;}
313 void SetAuditShell( sal_Bool bActive
);
314 void SetDrawFormShell( sal_Bool bActive
);
315 void SetEditShell(EditView
* pView
, sal_Bool bActive
);
316 void SetOleObjectShell( sal_Bool bActive
);
317 void SetChartShell( sal_Bool bActive
);
318 void SetGraphicShell( sal_Bool bActive
);
319 void SetMediaShell( sal_Bool bActive
);
322 void SetDrawShellOrSub();
323 void SetCurSubShell( ObjectSelectionType eOST
, sal_Bool bForce
= false );
325 void SetFormShellAtTop( sal_Bool bSet
);
327 ObjectSelectionType
GetCurObjectSelectionType();
329 virtual ErrCode
DoVerb(long nVerb
);
332 void StopEditShell();
333 sal_Bool
IsDrawTextShell() const;
334 sal_Bool
IsAuditShell() const;
336 void SetDrawTextUndo( ::svl::IUndoManager
* pUndoMgr
);
338 void FillFieldData( ScHeaderFieldData
& rData
);
340 void SetChartArea( const ScRangeListRef
& rSource
, const Rectangle
& rDest
);
341 sal_Bool
GetChartArea( ScRangeListRef
& rSource
, Rectangle
& rDest
, SCTAB
& rTab
) const;
343 void SetEditChartName(const OUString
& aStr
){aEditChartName
=aStr
;}
345 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
347 ScNavigatorSettings
* GetNavigatorSettings();
350 virtual SfxPrinter
* GetPrinter( sal_Bool bCreate
= false );
351 virtual sal_uInt16
SetPrinter( SfxPrinter
* pNewPrinter
,
352 sal_uInt16 nDiffFlags
= SFX_PRINTER_ALL
, bool bIsApi
=false );
354 virtual bool HasPrintOptionsPage() const;
355 virtual SfxTabPage
* CreatePrintOptionsPage( Window
*pParent
, const SfxItemSet
&rOptions
);
357 void ConnectObject( SdrOle2Obj
* pObj
);
358 sal_Bool
ActivateObject( SdrOle2Obj
* pObj
, long nVerb
);
360 void DeactivateOle();
362 SC_DLLPUBLIC
static ScTabViewShell
* GetActiveViewShell();
363 SfxModelessDialog
* CreateRefDialog( SfxBindings
* pB
, SfxChildWindow
* pCW
,
364 SfxChildWinInfo
* pInfo
,
365 Window
* pParent
, sal_uInt16 nSlotId
);
367 void UpdateOleZoom();
368 inline SbxObject
* GetScSbxObject() const
369 { return pScSbxObject
; }
370 inline void SetScSbxObject( SbxObject
* pOb
)
371 { pScSbxObject
= pOb
; }
373 FmFormShell
* GetFormShell() const { return pFormShell
; }
375 void InsertURL( const OUString
& rName
, const OUString
& rURL
, const OUString
& rTarget
,
377 void InsertURLButton( const OUString
& rName
, const OUString
& rURL
, const OUString
& rTarget
,
378 const Point
* pInsPos
= NULL
);
379 void InsertURLField( const OUString
& rName
, const OUString
& rURL
, const OUString
& rTarget
);
381 sal_Bool
SelectObject( const OUString
& rName
);
383 void SetInFormatDialog(sal_Bool bFlag
) {bInFormatDialog
=bFlag
;}
384 sal_Bool
IsInFormatDialog() {return bInFormatDialog
;}
386 void ForceMove() { Move(); }
388 void MakeNumberInfoItem ( ScDocument
* pDoc
,
389 ScViewData
* pViewData
,
390 SvxNumberInfoItem
** ppItem
);
392 void UpdateNumberFormatter ( const SvxNumberInfoItem
& rInfoItem
);
394 void ExecuteCellFormatDlg ( SfxRequest
& rReq
, const OString
&rTabPage
= OString());
396 sal_Bool
GetFunction( OUString
& rFuncStr
, sal_uInt16 nErrCode
= 0 );
398 void StartSimpleRefDialog( const OUString
& rTitle
, const OUString
& rInitVal
,
399 sal_Bool bCloseOnButtonUp
, sal_Bool bSingleCell
, sal_Bool bMultiSelection
);
400 void StopSimpleRefDialog();
402 void SetCurRefDlgId( sal_uInt16 nNew
);
404 void AddAccessibilityObject( SfxListener
& rObject
);
405 void RemoveAccessibilityObject( SfxListener
& rObject
);
406 void BroadcastAccessibility( const SfxHint
&rHint
);
407 sal_Bool
HasAccessibilityObjects();
409 bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash
);
411 using ScTabView::ShowCursor
;
413 // ugly hack to call Define Names from Manage Names
414 void SwitchBetweenRefDialogs(SfxModelessDialog
* pDialog
);
417 //==================================================================
422 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */