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 INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX
23 #include <svx/fmshell.hxx>
24 #include <svtools/htmlcfg.hxx>
25 #include <sfx2/viewsh.hxx>
26 #include <sfx2/viewfac.hxx>
27 #include <editeng/svxenum.hxx>
31 #include "rangelst.hxx"
32 #include "shellids.hxx"
33 #include "tabprotection.hxx"
35 #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 class ScTabViewShell
: public SfxViewShell
, public ScDBFunc
95 static sal_uInt16 nInsertCtrlState
;
96 static sal_uInt16 nInsCellsCtrlState
;
97 static sal_uInt16 nInsObjCtrlState
;
99 SvxHtmlOptions aHTMLOpt
;
100 ObjectSelectionType eCurOST
;
101 sal_uInt16 nDrawSfxId
;
102 sal_uInt16 nCtrlSfxId
;
103 sal_uInt16 nFormSfxId
;
104 OUString sDrawCustom
; // current custom shape type
105 ScDrawShell
* pDrawShell
;
106 ScDrawTextObjectBar
* pDrawTextShell
;
107 ScEditShell
* pEditShell
;
108 ScPivotShell
* pPivotShell
;
109 ScAuditingShell
* pAuditingShell
;
110 ScDrawFormShell
* pDrawFormShell
;
111 ScCellShell
* pCellShell
;
112 ScOleObjectShell
* pOleObjectShell
;
113 ScChartShell
* pChartShell
;
114 ScGraphicShell
* pGraphicShell
;
115 ScMediaShell
* pMediaShell
;
116 ScPageBreakShell
* pPageBreakShell
;
117 svx::ExtrusionBar
* pExtrusionBarShell
;
118 svx::FontworkBar
* pFontworkBarShell
;
120 FmFormShell
* pFormShell
;
122 ScInputHandler
* pInputHandler
; // for OLE input cell
124 ::editeng::SvxBorderLine
* pCurFrameLine
;
126 ::com::sun::star::uno::Reference
<
127 ::com::sun::star::frame::XDispatchProviderInterceptor
>
132 ScTabViewTarget aTarget
;
133 ScArea
* pPivotSource
;
134 ScDPObject
* pDialogDPObject
;
136 ScNavigatorSettings
* pNavSettings
;
138 // used in first Activate
142 bool bActiveDrawTextSh
;
144 bool bActiveAuditingSh
;
145 bool bActiveDrawFormSh
;
146 bool bActiveOleObjectSh
;
148 bool bActiveGraphicSh
;
152 bool bFormShellAtTop
; // does the FormShell need to be on top?
154 bool bDontSwitch
; // Don't turn off EditShell
155 bool bInFormatDialog
; // for GetSelectionText
156 bool bPrintSelected
; // for result of SvxPrtQryBox
158 bool bReadOnly
; // to detect status changes
162 SbxObject
* pScSbxObject
;
164 bool bChartAreaValid
; // if chart is drawn
165 bool bForceFocusOnCurCell
; // #i123629#
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( TriState nForceDesignMode
= TRISTATE_INDET
);
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(bool bMDI
) SAL_OVERRIDE
;
201 virtual void Deactivate(bool bMDI
) SAL_OVERRIDE
;
202 virtual bool PrepareClose( bool bUI
= true ) SAL_OVERRIDE
;
204 virtual void ShowCursor(bool bOn
) SAL_OVERRIDE
;
206 virtual void Move() SAL_OVERRIDE
; // Benachrichtigung
208 virtual void AdjustPosSizePixel( const Point
&rPos
, const Size
&rSize
) SAL_OVERRIDE
; // alt
210 virtual void InnerResizePixel( const Point
&rOfs
, const Size
&rSize
) SAL_OVERRIDE
; // neu
211 virtual void OuterResizePixel( const Point
&rOfs
, const Size
&rSize
) SAL_OVERRIDE
;
212 virtual void SetZoomFactor( const Fraction
&rZoomX
, const Fraction
&rZoomY
) SAL_OVERRIDE
;
214 virtual void QueryObjAreaPixel( Rectangle
& rRect
) const SAL_OVERRIDE
;
216 virtual OUString
GetSelectionText( bool bWholeWord
) SAL_OVERRIDE
;
217 virtual bool HasSelection( bool bText
) const SAL_OVERRIDE
;
219 virtual void WriteUserData(OUString
&, bool bBrowse
= false) SAL_OVERRIDE
;
220 virtual void ReadUserData(const OUString
&, bool bBrowse
= false) SAL_OVERRIDE
;
221 virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>&, bool bBrowse
= false ) SAL_OVERRIDE
;
222 virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>&, bool bBrowse
= false ) SAL_OVERRIDE
;
224 virtual void UIDeactivated( SfxInPlaceClient
* pClient
) SAL_OVERRIDE
;
226 virtual bool KeyInput( const KeyEvent
&rKeyEvent
) SAL_OVERRIDE
;
227 virtual SdrView
* GetDrawView() const SAL_OVERRIDE
;
230 TYPEINFO_VISIBILITY_OVERRIDE(SC_DLLPUBLIC
);
231 SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL
)
232 SFX_DECL_VIEWFACTORY(ScTabViewShell
);
235 /// SfxInterface initializer.
236 static void InitInterface_Impl();
239 /** -> Clone Method for Factory
240 Created from a general shell and inherit as much as possible */
241 ScTabViewShell( SfxViewFrame
* pViewFrame
,
242 SfxViewShell
* pOldSh
);
244 virtual ~ScTabViewShell();
246 SC_DLLPUBLIC
vcl::Window
* GetDialogParent();
248 bool IsRefInputMode() const;
249 void ExecuteInputDirect();
251 ScInputHandler
* GetInputHandler() const { return pInputHandler
;}
252 void UpdateInputHandler( bool bForce
= false, bool bStopEditing
= true );
253 void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust
);
254 bool TabKeyInput(const KeyEvent
& rKEvt
);
255 bool SfxKeyInput(const KeyEvent
& rKEvt
);
259 ::editeng::SvxBorderLine
* GetDefaultFrameLine() const { return pCurFrameLine
; }
260 void SetDefaultFrameLine(const ::editeng::SvxBorderLine
* pLine
);
262 SC_DLLPUBLIC
void Execute( SfxRequest
& rReq
);
263 SC_DLLPUBLIC
void GetState( SfxItemSet
& rSet
);
265 void ExecuteTable( SfxRequest
& rReq
);
266 void GetStateTable( SfxItemSet
& rSet
);
268 void WindowChanged();
269 void ExecDraw(SfxRequest
&);
270 void ExecDrawIns(SfxRequest
& rReq
);
271 void GetDrawState(SfxItemSet
&rSet
);
272 void GetDrawInsState(SfxItemSet
&rSet
);
273 void ExecGallery(SfxRequest
& rReq
);
275 void ExecChildWin(SfxRequest
& rReq
);
277 void ExecImageMap( SfxRequest
& rReq
);
278 void GetImageMapState( SfxItemSet
& rSet
);
280 void ExecTbx( SfxRequest
& rReq
);
281 static 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 static void ExecuteSbx( SfxRequest
& rReq
);
291 static 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( bool bActive
);
301 void SetDrawTextShell( bool bActive
);
303 void SetPivotShell( 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 bool GetDontSwitch(){return bDontSwitch
;}
310 void SetDontSwitch(bool bFlag
){bDontSwitch
=bFlag
;}
312 void SetAuditShell( bool bActive
);
313 void SetDrawFormShell( bool bActive
);
314 void SetEditShell(EditView
* pView
, bool bActive
);
315 void SetOleObjectShell( bool bActive
);
316 void SetChartShell( bool bActive
);
317 void SetGraphicShell( bool bActive
);
318 void SetMediaShell( bool bActive
);
320 void SetDrawShellOrSub();
321 void SetCurSubShell( ObjectSelectionType eOST
, bool bForce
= false );
323 void SetFormShellAtTop( bool bSet
);
325 ObjectSelectionType
GetCurObjectSelectionType() { return eCurOST
; }
327 virtual ErrCode
DoVerb(long nVerb
) SAL_OVERRIDE
;
329 void StopEditShell();
330 bool IsDrawTextShell() const;
331 bool IsAuditShell() const;
333 void SetDrawTextUndo( ::svl::IUndoManager
* pUndoMgr
);
335 void FillFieldData( ScHeaderFieldData
& rData
);
337 bool GetChartArea( ScRangeListRef
& rSource
, Rectangle
& rDest
, SCTAB
& rTab
) const;
339 void SetEditChartName(const OUString
& aStr
){aEditChartName
=aStr
;}
341 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
343 ScNavigatorSettings
* GetNavigatorSettings();
346 virtual SfxPrinter
* GetPrinter( bool bCreate
= false ) SAL_OVERRIDE
;
347 virtual sal_uInt16
SetPrinter( SfxPrinter
* pNewPrinter
,
348 SfxPrinterChangeFlags nDiffFlags
= SFX_PRINTER_ALL
, bool bIsApi
=false ) SAL_OVERRIDE
;
350 virtual bool HasPrintOptionsPage() const SAL_OVERRIDE
;
351 virtual VclPtr
<SfxTabPage
> CreatePrintOptionsPage( vcl::Window
*pParent
, const SfxItemSet
&rOptions
) SAL_OVERRIDE
;
353 void ConnectObject( SdrOle2Obj
* pObj
);
354 bool ActivateObject( SdrOle2Obj
* pObj
, long nVerb
);
356 void DeactivateOle();
358 SC_DLLPUBLIC
static ScTabViewShell
* GetActiveViewShell();
359 VclPtr
<SfxModelessDialog
> CreateRefDialog( SfxBindings
* pB
, SfxChildWindow
* pCW
,
360 SfxChildWinInfo
* pInfo
,
361 vcl::Window
* pParent
, sal_uInt16 nSlotId
);
363 void UpdateOleZoom();
364 inline SbxObject
* GetScSbxObject() const
365 { return pScSbxObject
; }
366 inline void SetScSbxObject( SbxObject
* pOb
)
367 { pScSbxObject
= pOb
; }
369 virtual const FmFormShell
* GetFormShell() const SAL_OVERRIDE
{ return pFormShell
; }
370 virtual FmFormShell
* GetFormShell() SAL_OVERRIDE
{ return pFormShell
; }
372 void InsertURL( const OUString
& rName
, const OUString
& rURL
, const OUString
& rTarget
,
374 void InsertURLButton( const OUString
& rName
, const OUString
& rURL
, const OUString
& rTarget
,
375 const Point
* pInsPos
= NULL
);
376 void InsertURLField( const OUString
& rName
, const OUString
& rURL
, const OUString
& rTarget
);
378 bool SelectObject( const OUString
& rName
);
380 void SetInFormatDialog(bool bFlag
) {bInFormatDialog
=bFlag
;}
381 bool IsInFormatDialog() {return bInFormatDialog
;}
383 void ForceMove() { Move(); }
385 static SvxNumberInfoItem
* MakeNumberInfoItem( ScDocument
* pDoc
, ScViewData
* pViewData
);
387 static void UpdateNumberFormatter( const SvxNumberInfoItem
& rInfoItem
);
389 void ExecuteCellFormatDlg( SfxRequest
& rReq
, const OString
&rTabPage
= OString());
391 bool GetFunction( OUString
& rFuncStr
, sal_uInt16 nErrCode
= 0 );
393 void StartSimpleRefDialog( const OUString
& rTitle
, const OUString
& rInitVal
,
394 bool bCloseOnButtonUp
, bool bSingleCell
, bool bMultiSelection
);
395 void StopSimpleRefDialog();
397 void SetCurRefDlgId( sal_uInt16 nNew
);
399 void AddAccessibilityObject( SfxListener
& rObject
);
400 void RemoveAccessibilityObject( SfxListener
& rObject
);
401 void BroadcastAccessibility( const SfxHint
&rHint
);
402 bool HasAccessibilityObjects();
404 bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash
);
406 using ScTabView::ShowCursor
;
408 bool IsActive() const { return bIsActive
; }
409 OUString
GetFormula(ScAddress
& rAddress
);
411 // ugly hack to call Define Names from Manage Names
412 void SwitchBetweenRefDialogs(SfxModelessDialog
* pDialog
);
414 bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell
; }
415 void SetForceFocusOnCurCell(bool bFlag
) { bForceFocusOnCurCell
=bFlag
; }
420 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */