Update ooo320-m1
[ooovba.git] / sc / source / ui / inc / tabvwsh.hxx
blob29c70787b2101adeefae91aae66a5e04dc2b15fd
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: tabvwsh.hxx,v $
10 * $Revision: 1.30.32.3 $
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 #ifndef SC_TABVWSH_HXX
32 #define SC_TABVWSH_HXX
34 #include <sfx2/viewsh.hxx>
35 #include <sfx2/viewfac.hxx>
36 #include <svx/svxenum.hxx>
37 #include "scdllapi.h"
38 #include "dbfunc.hxx" // -> tabview
39 #include "target.hxx"
40 #include "rangelst.hxx" // ScRangeListRef
41 #include "shellids.hxx"
42 #include "tabprotection.hxx" // for ScPasswordHash
44 class FmFormShell;
45 class SbxObject;
46 class SdrOle2Obj;
47 class SfxBindings;
48 class SfxChildWindow;
49 class SfxModelessDialog;
50 class SvxBorderLine;
51 class SvxBoxObjectRef;
52 class SvxNumberInfoItem;
53 struct SfxChildWinInfo;
55 class ScArea;
56 class ScAuditingShell;
57 class ScDrawShell;
58 class ScDrawTextObjectBar;
59 class ScEditShell;
60 class ScInputHandler;
61 class ScPivotShell;
62 class ScDrawFormShell;
63 class ScCellShell;
64 class ScOleObjectShell;
65 class ScGraphicShell;
66 class ScMediaShell;
67 class ScChartShell;
68 class ScPageBreakShell;
69 class ScDPObject;
70 class ScNavigatorSettings;
72 struct ScHeaderFieldData;
74 namespace com { namespace sun { namespace star { namespace frame {
75 class XDispatchProviderInterceptor;
76 } } } }
78 namespace svx {
79 class ExtrusionBar;
80 class FontworkBar;
83 enum ObjectSelectionType
85 OST_NONE,
86 OST_Cell,
87 OST_Editing,
88 OST_DrawText,
89 OST_Drawing,
90 OST_DrawForm,
91 OST_Pivot,
92 OST_Auditing,
93 OST_OleObject,
94 OST_Chart,
95 OST_Graphic,
96 OST_Media
99 //==================================================================
102 class ScTabViewShell: public SfxViewShell, public ScDBFunc
104 private:
105 static USHORT nInsertCtrlState;
106 static USHORT nInsCellsCtrlState;
107 static USHORT nInsObjCtrlState;
109 ObjectSelectionType eCurOST;
110 USHORT nDrawSfxId;
111 USHORT nCtrlSfxId;
112 USHORT nFormSfxId;
113 String sDrawCustom; // current custom shape type
114 ScDrawShell* pDrawShell;
115 ScDrawTextObjectBar* pDrawTextShell;
116 ScEditShell* pEditShell;
117 ScPivotShell* pPivotShell;
118 ScAuditingShell* pAuditingShell;
119 ScDrawFormShell* pDrawFormShell;
120 ScCellShell* pCellShell;
121 ScOleObjectShell* pOleObjectShell;
122 ScChartShell* pChartShell;
123 ScGraphicShell* pGraphicShell;
124 ScMediaShell* pMediaShell;
125 ScPageBreakShell* pPageBreakShell;
126 svx::ExtrusionBar* pExtrusionBarShell;
127 svx::FontworkBar* pFontworkBarShell;
129 FmFormShell* pFormShell;
131 ScInputHandler* pInputHandler; // fuer OLE-Eingabezeile
133 SvxBorderLine* pCurFrameLine;
135 ::com::sun::star::uno::Reference<
136 ::com::sun::star::frame::XDispatchProviderInterceptor >
137 xDisProvInterceptor;
139 Point aWinPos;
141 ScTabViewTarget aTarget;
142 ScArea* pPivotSource;
143 ScDPObject* pDialogDPObject;
145 ScNavigatorSettings* pNavSettings;
147 // used in first Activate
148 ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aPendingUserData;
149 BOOL bFirstActivate;
151 BOOL bActiveDrawSh;
152 BOOL bActiveDrawTextSh;
153 BOOL bActivePivotSh;
154 BOOL bActiveAuditingSh;
155 BOOL bActiveDrawFormSh;
156 BOOL bActiveOleObjectSh;
157 BOOL bActiveChartSh;
158 BOOL bActiveGraphicSh;
159 BOOL bActiveMediaSh;
160 BOOL bActiveEditSh;
162 BOOL bFormShellAtTop; // does the FormShell need to be on top?
165 BOOL bDontSwitch; // EditShell nicht abschalten
166 BOOL bInFormatDialog; // fuer GetSelectionText
167 BOOL bPrintSelected; // for result of SvxPrtQryBox
169 BOOL bReadOnly; // um Status-Aenderungen zu erkennen
171 SbxObject* pScSbxObject;
173 //UNUSED2008-05 BOOL bChartDlgIsEdit; // Datenbereich aendern
174 BOOL bChartAreaValid; // wenn Chart aufgezogen wird
175 String aEditChartName;
176 ScRangeListRef aChartSource;
177 Rectangle aChartPos;
178 SCTAB nChartDestTab;
179 USHORT nCurRefDlgId;
181 SfxBroadcaster* pAccessibilityBroadcaster;
183 static const int MASTERENUMCOMMANDS = 6;
184 String aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
186 private:
187 void Construct( BYTE nForceDesignMode = SC_FORCEMODE_NONE );
189 //UNUSED2008-05 void SetMySubShell( SfxShell* pShell );
190 SfxShell* GetMySubShell() const;
192 void DoReadUserData( const String& rData );
193 void DoReadUserDataSequence( const ::com::sun::star::uno::Sequence<
194 ::com::sun::star::beans::PropertyValue >& rSettings );
196 DECL_LINK( SimpleRefClose, String* );
197 DECL_LINK( SimpleRefDone, String* );
198 DECL_LINK( SimpleRefAborted, String* );
199 DECL_LINK( SimpleRefChange, String* );
200 DECL_LINK( FormControlActivated, FmFormShell* );
202 protected:
203 virtual void Activate(BOOL bMDI);
204 virtual void Deactivate(BOOL bMDI);
205 virtual USHORT PrepareClose( BOOL bUI = TRUE, BOOL bForBrowsing = FALSE );
207 virtual void ShowCursor(FASTBOOL bOn);
209 virtual void Move(); // Benachrichtigung
211 virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ); // alt
213 virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ); // neu
214 virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
215 virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
217 virtual void QueryObjAreaPixel( Rectangle& rRect ) const;
219 virtual Size GetOptimalSizePixel() const;
221 virtual String GetSelectionText( BOOL bWholeWord );
222 virtual BOOL HasSelection( BOOL bText ) const;
223 virtual String GetDescription() const;
225 virtual void WriteUserData(String &, BOOL bBrowse = FALSE);
226 virtual void ReadUserData(const String &, BOOL bBrowse = FALSE);
227 virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
228 virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
230 virtual void UIDeactivated( SfxInPlaceClient* pClient );
232 virtual FASTBOOL KeyInput( const KeyEvent &rKeyEvent );
233 virtual SdrView* GetDrawView() const;
235 public:
236 TYPEINFO_VISIBILITY(SC_DLLPUBLIC);
238 SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
239 SFX_DECL_VIEWFACTORY(ScTabViewShell);
242 // -> Clone-Methode fuer Factory
244 //UNUSED2008-05 ScTabViewShell( SfxViewFrame* pViewFrame,
245 //UNUSED2008-05 const ScTabViewShell& rWin );
247 // aus einer allgemeinen Shell konstruieren und
248 // soviel wie moeglich uebernehmen (SliderPos etc.):
250 ScTabViewShell( SfxViewFrame* pViewFrame,
251 SfxViewShell* pOldSh );
253 virtual ~ScTabViewShell();
255 SC_DLLPUBLIC Window* GetDialogParent();
257 bool IsRefInputMode() const;
258 void ExecuteInputDirect();
260 ScInputHandler* GetInputHandler() const;
261 void UpdateInputHandler( BOOL bForce = FALSE, BOOL bStopEditing = TRUE );
262 void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
263 BOOL TabKeyInput(const KeyEvent& rKEvt);
264 BOOL SfxKeyInput(const KeyEvent& rKEvt);
266 void SetActive();
268 SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine; }
269 void SetDefaultFrameLine(const SvxBorderLine* pLine );
271 //UNUSED2008-05 void ExecuteShowNIY( SfxRequest& rReq );
272 //UNUSED2008-05 void StateDisabled( SfxItemSet& rSet );
274 SC_DLLPUBLIC void Execute( SfxRequest& rReq );
275 SC_DLLPUBLIC void GetState( SfxItemSet& rSet );
277 void ExecuteTable( SfxRequest& rReq );
278 void GetStateTable( SfxItemSet& rSet );
280 void WindowChanged();
281 void ExecDraw(SfxRequest&);
282 void ExecDrawIns(SfxRequest& rReq);
283 void GetDrawState(SfxItemSet &rSet);
284 void GetDrawInsState(SfxItemSet &rSet);
285 void ExecGallery(SfxRequest& rReq); // StarGallery
286 void GetGalleryState(SfxItemSet& rSet);
288 void ExecChildWin(SfxRequest& rReq);
289 void GetChildWinState( SfxItemSet& rSet );
291 void ExecImageMap( SfxRequest& rReq );
292 void GetImageMapState( SfxItemSet& rSet );
294 void ExecTbx( SfxRequest& rReq );
295 void GetTbxState( SfxItemSet& rSet );
297 void ExecuteSave( SfxRequest& rReq );
298 void GetSaveState( SfxItemSet& rSet );
299 void ExecSearch( SfxRequest& rReq );
301 void ExecuteUndo(SfxRequest& rReq);
302 void GetUndoState(SfxItemSet &rSet);
304 void ExecuteSbx( SfxRequest& rReq );
305 void GetSbxState( SfxItemSet& rSet );
307 void ExecuteObject(SfxRequest& rReq);
308 void GetObjectState(SfxItemSet &rSet);
310 void ExecDrawOpt(SfxRequest& rReq);
311 void GetDrawOptState(SfxItemSet &rSet);
314 void SetDrawShell( BOOL bActive );
315 void SetDrawTextShell( BOOL bActive );
317 void SetPivotShell( BOOL bActive );
318 ScArea* GetPivotSource(){return pPivotSource;}
319 void SetPivotSource(ScArea* pSrc){pPivotSource=pSrc;}
320 void SetDialogDPObject( const ScDPObject* pObj );
321 const ScDPObject* GetDialogDPObject() const { return pDialogDPObject; }
323 BOOL GetDontSwitch(){return bDontSwitch;}
324 void SetDontSwitch(BOOL bFlag){bDontSwitch=bFlag;}
327 void SetAuditShell( BOOL bActive );
328 void SetDrawFormShell( BOOL bActive );
329 void SetEditShell(EditView* pView, BOOL bActive );
330 void SetOleObjectShell( BOOL bActive );
331 void SetChartShell( BOOL bActive );
332 void SetGraphicShell( BOOL bActive );
333 void SetMediaShell( BOOL bActive );
336 void SetDrawShellOrSub();
337 void SetCurSubShell( ObjectSelectionType eOST, BOOL bForce = FALSE );
339 void SetFormShellAtTop( BOOL bSet );
341 ObjectSelectionType GetCurObjectSelectionType();
343 virtual ErrCode DoVerb(long nVerb);
346 void StopEditShell();
347 BOOL IsDrawTextShell() const;
348 BOOL IsAuditShell() const;
350 void SetDrawTextUndo( SfxUndoManager* pUndoMgr );
352 void FillFieldData( ScHeaderFieldData& rData );
354 //UNUSED2008-05 void ResetChartArea();
355 void SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest );
356 BOOL GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
358 //UNUSED2008-05 BOOL IsChartDlgEdit() const;
359 //UNUSED2008-05 void SetChartDlgEdit(BOOL bFlag){bChartDlgIsEdit=bFlag;}
361 void SetEditChartName(const String& aStr){aEditChartName=aStr;}
362 //UNUSED2008-05 const String& GetEditChartName() const;
364 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
366 ScNavigatorSettings* GetNavigatorSettings();
368 // Drucken:
369 virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE );
370 virtual USHORT SetPrinter( SfxPrinter* pNewPrinter,
371 USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false );
373 virtual PrintDialog* CreatePrintDialog( Window* pParent );
374 virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
375 virtual void PreparePrint( PrintDialog* pPrintDialog = NULL );
376 virtual ErrCode DoPrint( SfxPrinter *pPrinter,
377 PrintDialog *pPrintDialog,
378 BOOL bSilent, BOOL bIsAPI );
379 virtual USHORT Print( SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pPrintDialog = NULL );
381 void ConnectObject( SdrOle2Obj* pObj );
382 BOOL ActivateObject( SdrOle2Obj* pObj, long nVerb );
384 void DeactivateOle();
386 SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
387 SfxModelessDialog* CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
388 SfxChildWinInfo* pInfo,
389 Window* pParent, USHORT nSlotId );
391 void UpdateOleZoom();
392 inline SbxObject* GetScSbxObject() const
393 { return pScSbxObject; }
394 inline void SetScSbxObject( SbxObject* pOb )
395 { pScSbxObject = pOb; }
397 FmFormShell* GetFormShell() const { return pFormShell; }
399 void InsertURL( const String& rName, const String& rURL, const String& rTarget,
400 USHORT nMode );
401 void InsertURLButton( const String& rName, const String& rURL, const String& rTarget,
402 const Point* pInsPos = NULL );
403 void InsertURLField( const String& rName, const String& rURL, const String& rTarget );
405 BOOL SelectObject( const String& rName );
407 void SetInFormatDialog(BOOL bFlag) {bInFormatDialog=bFlag;}
408 BOOL IsInFormatDialog() {return bInFormatDialog;}
410 void ForceMove() { Move(); }
412 void MakeNumberInfoItem ( ScDocument* pDoc,
413 ScViewData* pViewData,
414 SvxNumberInfoItem** ppItem );
416 void UpdateNumberFormatter ( ScDocument* pDoc,
417 const SvxNumberInfoItem& rInfoItem );
419 void ExecuteCellFormatDlg ( SfxRequest& rReq, USHORT nTabPage = 0xffff );
421 BOOL GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
423 void StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
424 BOOL bCloseOnButtonUp, BOOL bSingleCell, BOOL bMultiSelection );
425 void StopSimpleRefDialog();
427 void SetCurRefDlgId( USHORT nNew );
429 void AddAccessibilityObject( SfxListener& rObject );
430 void RemoveAccessibilityObject( SfxListener& rObject );
431 void BroadcastAccessibility( const SfxHint &rHint );
432 BOOL HasAccessibilityObjects();
434 bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
436 using ScTabView::ShowCursor;
439 //==================================================================
442 #endif