xref: /aoo4110/main/sc/source/ui/inc/tabvwsh.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_TABVWSH_HXX
25 #define SC_TABVWSH_HXX
26 
27 #include <svtools/htmlcfg.hxx>
28 #include <sfx2/viewsh.hxx>
29 #include <sfx2/viewfac.hxx>
30 #include <editeng/svxenum.hxx>
31 #include "scdllapi.h"
32 #include "dbfunc.hxx"			// -> tabview
33 #include "target.hxx"
34 #include "rangelst.hxx"			// ScRangeListRef
35 #include "shellids.hxx"
36 #include "tabprotection.hxx" // for ScPasswordHash
37 
38 class FmFormShell;
39 class SbxObject;
40 class SdrOle2Obj;
41 class SfxBindings;
42 class SfxChildWindow;
43 class SfxModelessDialog;
44 class SvxBorderLine;
45 class SvxBoxObjectRef;
46 class SvxNumberInfoItem;
47 struct SfxChildWinInfo;
48 
49 class ScArea;
50 class ScAuditingShell;
51 class ScDrawShell;
52 class ScDrawTextObjectBar;
53 class ScEditShell;
54 class ScInputHandler;
55 class ScPivotShell;
56 class ScDrawFormShell;
57 class ScCellShell;
58 class ScOleObjectShell;
59 class ScGraphicShell;
60 class ScMediaShell;
61 class ScChartShell;
62 class ScPageBreakShell;
63 class ScDPObject;
64 class ScNavigatorSettings;
65 
66 struct ScHeaderFieldData;
67 
68 namespace com { namespace sun { namespace star { namespace frame {
69 	class XDispatchProviderInterceptor;
70 } } } }
71 
72 namespace svx {
73 	class ExtrusionBar;
74 	class FontworkBar;
75 }
76 
77 enum ObjectSelectionType
78 {
79 	OST_NONE,
80 	OST_Cell,
81 	OST_Editing,
82 	OST_DrawText,
83 	OST_Drawing,
84 	OST_DrawForm,
85 	OST_Pivot,
86 	OST_Auditing,
87 	OST_OleObject,
88 	OST_Chart,
89 	OST_Graphic,
90 	OST_Media
91 };
92 
93 //==================================================================
94 
95 
96 class ScTabViewShell: public SfxViewShell, public ScDBFunc
97 {
98 private:
99 	static sal_uInt16			nInsertCtrlState;
100 	static sal_uInt16			nInsCellsCtrlState;
101 	static sal_uInt16			nInsObjCtrlState;
102 
103     SvxHtmlOptions          aHTMLOpt;
104 	ObjectSelectionType		eCurOST;
105 	sal_uInt16					nDrawSfxId;
106 	sal_uInt16					nCtrlSfxId;
107 	sal_uInt16					nFormSfxId;
108     String                  sDrawCustom;                // current custom shape type
109 	ScDrawShell*			pDrawShell;
110 	ScDrawTextObjectBar*	pDrawTextShell;
111 	ScEditShell*			pEditShell;
112 	ScPivotShell*			pPivotShell;
113 	ScAuditingShell*		pAuditingShell;
114 	ScDrawFormShell*		pDrawFormShell;
115 	ScCellShell*			pCellShell;
116 	ScOleObjectShell*		pOleObjectShell;
117 	ScChartShell*			pChartShell;
118 	ScGraphicShell*			pGraphicShell;
119 	ScMediaShell*			pMediaShell;
120 	ScPageBreakShell*		pPageBreakShell;
121 	svx::ExtrusionBar*		pExtrusionBarShell;
122 	svx::FontworkBar*		pFontworkBarShell;
123 
124 	FmFormShell*			pFormShell;
125 
126 	ScInputHandler*			pInputHandler;				// fuer OLE-Eingabezeile
127 
128 	SvxBorderLine*			pCurFrameLine;
129 
130 	::com::sun::star::uno::Reference<
131 		::com::sun::star::frame::XDispatchProviderInterceptor >
132 							xDisProvInterceptor;
133 
134 	Point					aWinPos;
135 
136 	ScTabViewTarget			aTarget;
137 	ScArea*					pPivotSource;
138 	ScDPObject*				pDialogDPObject;
139 
140     ScNavigatorSettings*    pNavSettings;
141 
142     // used in first Activate
143 	sal_Bool					bFirstActivate;
144 
145 	sal_Bool					bActiveDrawSh;
146 	sal_Bool					bActiveDrawTextSh;
147 	sal_Bool					bActivePivotSh;
148 	sal_Bool					bActiveAuditingSh;
149 	sal_Bool					bActiveDrawFormSh;
150 	sal_Bool					bActiveOleObjectSh;
151 	sal_Bool					bActiveChartSh;
152 	sal_Bool					bActiveGraphicSh;
153 	sal_Bool					bActiveMediaSh;
154 	sal_Bool					bActiveEditSh;
155 
156 	sal_Bool                    bFormShellAtTop;            // does the FormShell need to be on top?
157 
158 
159 	sal_Bool					bDontSwitch;				// EditShell nicht abschalten
160 	sal_Bool					bInFormatDialog;			// fuer GetSelectionText
161 	sal_Bool					bPrintSelected;				// for result of SvxPrtQryBox
162 
163 	sal_Bool					bReadOnly;					// um Status-Aenderungen zu erkennen
164 	sal_Bool 					bIsActive;
165 	SbxObject*				pScSbxObject;
166 
167 //UNUSED2008-05  sal_Bool                    bChartDlgIsEdit;            // Datenbereich aendern
168 	sal_Bool					bChartAreaValid;			// wenn Chart aufgezogen wird
169 	String					aEditChartName;
170 	ScRangeListRef			aChartSource;
171 	Rectangle				aChartPos;
172 	SCTAB					nChartDestTab;
173 	sal_uInt16					nCurRefDlgId;
174 
175 	SfxBroadcaster*			pAccessibilityBroadcaster;
176 
177 	static const int		MASTERENUMCOMMANDS = 6;
178     String					aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
179 
180 	sal_Bool	bForceFocusOnCurCell; // i123629
181 
182 private:
183 	void	Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
184 
185 //UNUSED2008-05  void          SetMySubShell( SfxShell* pShell );
186 	SfxShell*		GetMySubShell() const;
187 
188 	void			DoReadUserData( const String& rData );
189     void          DoReadUserDataSequence( const ::com::sun::star::uno::Sequence<
190                                      ::com::sun::star::beans::PropertyValue >& rSettings );
191 
192 	DECL_LINK( SimpleRefClose, String* );
193 	DECL_LINK( SimpleRefDone, String* );
194 	DECL_LINK( SimpleRefAborted, String* );
195 	DECL_LINK( SimpleRefChange, String* );
196     DECL_LINK( FormControlActivated, FmFormShell* );
197 	DECL_LINK( HtmlOptionsHdl, void * );
198 
199 protected:
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 = sal_False );
203 
204 	virtual void	ShowCursor(FASTBOOL bOn);
205 
206 	virtual void	Move();		// Benachrichtigung
207 
208 	virtual void	AdjustPosSizePixel( const Point &rPos, const Size &rSize );		// alt
209 
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 );
213 
214 	virtual void	QueryObjAreaPixel( Rectangle& rRect ) const;
215 
216 	virtual Size	GetOptimalSizePixel() const;
217 
218 	virtual String  GetSelectionText( sal_Bool bWholeWord );
219 	virtual sal_Bool	HasSelection( sal_Bool bText ) const;
220 	virtual String  GetDescription() const;
221 
222 	virtual void	WriteUserData(String &, sal_Bool bBrowse = sal_False);
223 	virtual void	ReadUserData(const String &, sal_Bool bBrowse = sal_False);
224     virtual void    WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
225     virtual void    ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
226 
227     virtual void    UIDeactivated( SfxInPlaceClient* pClient );
228 
229 	virtual FASTBOOL KeyInput( const KeyEvent &rKeyEvent );
230 	virtual SdrView* GetDrawView() const;
231 
232 public:
233 					TYPEINFO_VISIBILITY(SC_DLLPUBLIC);
234 
235 					SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
236 					SFX_DECL_VIEWFACTORY(ScTabViewShell);
237 
238 
239 					// -> Clone-Methode fuer Factory
240 
241 //UNUSED2008-05  ScTabViewShell( SfxViewFrame*           pViewFrame,
242 //UNUSED2008-05                  const ScTabViewShell&   rWin );
243 
244 					// aus einer allgemeinen Shell konstruieren und
245 					// soviel wie moeglich uebernehmen (SliderPos etc.):
246 
247 					ScTabViewShell( SfxViewFrame*			pViewFrame,
248 									SfxViewShell*			pOldSh );
249 
250 	virtual			~ScTabViewShell();
251 
252 	Window*			GetDialogParent();
253 
254     bool            IsRefInputMode() const;
255 	void			ExecuteInputDirect();
256 
257 	ScInputHandler*	GetInputHandler() const;
258 	void			UpdateInputHandler( sal_Bool bForce = sal_False, sal_Bool bStopEditing = sal_True );
259     void            UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
260 	sal_Bool			TabKeyInput(const KeyEvent& rKEvt);
261 	sal_Bool			SfxKeyInput(const KeyEvent& rKEvt);
262 
263 	void			SetActive();
264 
GetDefaultFrameLine() const265 	SvxBorderLine*	GetDefaultFrameLine() const { return pCurFrameLine; }
266 	void 			SetDefaultFrameLine(const SvxBorderLine* pLine );
267 
268 //UNUSED2008-05  void            ExecuteShowNIY( SfxRequest& rReq );
269 //UNUSED2008-05  void			StateDisabled( SfxItemSet& rSet );
270 
271 	SC_DLLPUBLIC void			Execute( SfxRequest& rReq );
272 	SC_DLLPUBLIC void			GetState( SfxItemSet& rSet );
273 
274 	void			ExecuteTable( SfxRequest& rReq );
275 	void			GetStateTable( SfxItemSet& rSet );
276 
277 	void			WindowChanged();
278 	void 			ExecDraw(SfxRequest&);
279 	void			ExecDrawIns(SfxRequest& rReq);
280 	void 			GetDrawState(SfxItemSet &rSet);
281 	void 			GetDrawInsState(SfxItemSet &rSet);
282 	void			ExecGallery(SfxRequest& rReq);		// StarGallery
283 	void			GetGalleryState(SfxItemSet& rSet);
284 
285 	void			ExecChildWin(SfxRequest& rReq);
286 	void			GetChildWinState( SfxItemSet& rSet );
287 
288 	void			ExecImageMap( SfxRequest& rReq );
289 	void			GetImageMapState( SfxItemSet& rSet );
290 
291 	void			ExecTbx( SfxRequest& rReq );
292 	void			GetTbxState( SfxItemSet& rSet );
293 
294 	void			ExecuteSave( SfxRequest& rReq );
295 	void			GetSaveState( SfxItemSet& rSet );
296 	void			ExecSearch( SfxRequest& rReq );
297 
298 	void			ExecuteUndo(SfxRequest& rReq);
299 	void			GetUndoState(SfxItemSet &rSet);
300 
301 	void			ExecuteSbx( SfxRequest& rReq );
302 	void			GetSbxState( SfxItemSet& rSet );
303 
304 	void			ExecuteObject(SfxRequest& rReq);
305 	void			GetObjectState(SfxItemSet &rSet);
306 
307 	void			ExecDrawOpt(SfxRequest& rReq);
308 	void			GetDrawOptState(SfxItemSet &rSet);
309 
310     void            UpdateDrawShell();
311 	void			SetDrawShell( sal_Bool bActive );
312 	void			SetDrawTextShell( sal_Bool bActive );
313 
314 	void			SetPivotShell( sal_Bool bActive );
GetPivotSource()315 	ScArea*			GetPivotSource(){return pPivotSource;}
SetPivotSource(ScArea * pSrc)316 	void			SetPivotSource(ScArea* pSrc){pPivotSource=pSrc;}
317 	void			SetDialogDPObject( const ScDPObject* pObj );
GetDialogDPObject() const318 	const ScDPObject* GetDialogDPObject() const { return pDialogDPObject; }
319 
GetDontSwitch()320 	sal_Bool			GetDontSwitch(){return bDontSwitch;}
SetDontSwitch(sal_Bool bFlag)321 	void			SetDontSwitch(sal_Bool bFlag){bDontSwitch=bFlag;}
322 
323 
324 	void			SetAuditShell( sal_Bool bActive );
325 	void			SetDrawFormShell( sal_Bool bActive );
326 	void			SetEditShell(EditView* pView, sal_Bool bActive );
327 	void			SetOleObjectShell( sal_Bool bActive );
328 	void			SetChartShell( sal_Bool bActive );
329 	void			SetGraphicShell( sal_Bool bActive );
330 	void			SetMediaShell( sal_Bool bActive );
331 
332 
333 	void			SetDrawShellOrSub();
334 	void			SetCurSubShell( ObjectSelectionType eOST, sal_Bool bForce = sal_False );
335 
336     void            SetFormShellAtTop( sal_Bool bSet );
337 
338 	ObjectSelectionType GetCurObjectSelectionType();
339 
340 	virtual ErrCode	DoVerb(long nVerb);
341 
342 
343 	void			StopEditShell();
344 	sal_Bool			IsDrawTextShell() const;
345 	sal_Bool			IsAuditShell() const;
346 
347 	void			SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr );
348 
349 	void			FillFieldData( ScHeaderFieldData& rData );
350 
351 //UNUSED2008-05  void            ResetChartArea();
352 	void			SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest );
353 	sal_Bool			GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
354 
355 //UNUSED2008-05  sal_Bool            IsChartDlgEdit() const;
356 //UNUSED2008-05  void            SetChartDlgEdit(sal_Bool bFlag){bChartDlgIsEdit=bFlag;}
357 
SetEditChartName(const String & aStr)358 	void			SetEditChartName(const String& aStr){aEditChartName=aStr;}
359 //UNUSED2008-05  const String&   GetEditChartName() const;
360 
361 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
362 
363     ScNavigatorSettings*    GetNavigatorSettings();
364 
365 	// Drucken:
366 	virtual SfxPrinter*		GetPrinter( sal_Bool bCreate = sal_False );
367 	virtual sal_uInt16			SetPrinter( SfxPrinter* pNewPrinter,
368                                           sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false );
369 
370 	virtual SfxTabPage*     CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
371 
372 	void			ConnectObject( SdrOle2Obj* pObj );
373 	sal_Bool			ActivateObject( SdrOle2Obj* pObj, long nVerb );
374 
375     void            DeactivateOle();
376 
377 	SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
378 	SfxModelessDialog*	CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
379 										SfxChildWinInfo* pInfo,
380 										Window* pParent, sal_uInt16 nSlotId );
381 
382 	void			UpdateOleZoom();
GetScSbxObject() const383 	inline SbxObject* GetScSbxObject() const
384 					{ return pScSbxObject; }
SetScSbxObject(SbxObject * pOb)385 	inline void		SetScSbxObject( SbxObject* pOb )
386 					{ pScSbxObject = pOb; }
387 
GetFormShell() const388 	FmFormShell*	GetFormShell() const	{ return pFormShell; }
389 
390 	void 	InsertURL( const String& rName, const String& rURL, const String& rTarget,
391 							sal_uInt16 nMode );
392 	void 	InsertURLButton( const String& rName, const String& rURL, const String& rTarget,
393 							const Point* pInsPos = NULL );
394 	void 	InsertURLField( const String& rName, const String& rURL, const String& rTarget );
395 
396 	sal_Bool	SelectObject( const String& rName );
397 
SetInFormatDialog(sal_Bool bFlag)398 	void	SetInFormatDialog(sal_Bool bFlag) {bInFormatDialog=bFlag;}
IsInFormatDialog()399 	sal_Bool    IsInFormatDialog() {return bInFormatDialog;}
400 
ForceMove()401 	void	ForceMove()		{ Move(); }
402 
403 	void 	MakeNumberInfoItem		( ScDocument*			 pDoc,
404 									  ScViewData*			 pViewData,
405 									  SvxNumberInfoItem**	 ppItem );
406 
407 	void 	UpdateNumberFormatter	( ScDocument*		     	pDoc,
408 									  const SvxNumberInfoItem& 	rInfoItem );
409 
410 	void	ExecuteCellFormatDlg	( SfxRequest& rReq, sal_uInt16 nTabPage = 0xffff );
411 
412 	sal_Bool	GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
413 
414 	void	StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
415                                     sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection );
416 	void	StopSimpleRefDialog();
417 
418 	void	SetCurRefDlgId( sal_uInt16 nNew );
419 
420 	void	AddAccessibilityObject( SfxListener& rObject );
421 	void	RemoveAccessibilityObject( SfxListener& rObject );
422 	void	BroadcastAccessibility( const SfxHint &rHint );
423 	sal_Bool	HasAccessibilityObjects();
424 
425     bool    ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
426 
427     using ScTabView::ShowCursor;
IsActive()428 	sal_Bool IsActive(){ return bIsActive; }
429 	rtl::OUString GetFormula(ScAddress& rAddress);
430 	const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & GetForms() const;
431 
432 	// i123629
GetForceFocusOnCurCell()433 	sal_Bool	GetForceFocusOnCurCell(){return bForceFocusOnCurCell;}
SetForceFocusOnCurCell(sal_Bool bFlag)434 	void		SetForceFocusOnCurCell(sal_Bool bFlag){bForceFocusOnCurCell=bFlag;}
435 };
436 
437 //==================================================================
438 
439 
440 #endif
441 
442