xref: /aoo42x/main/sc/source/ui/inc/tabvwsh.hxx (revision c5c7750d)
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 	sal_Bool	bSearchJustOpened; // i35093
182 
183 private:
184 	void	Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
185 
186 //UNUSED2008-05  void          SetMySubShell( SfxShell* pShell );
187 	SfxShell*		GetMySubShell() const;
188 
189 	void			DoReadUserData( const String& rData );
190     void          DoReadUserDataSequence( const ::com::sun::star::uno::Sequence<
191                                      ::com::sun::star::beans::PropertyValue >& rSettings );
192 
193 	DECL_LINK( SimpleRefClose, String* );
194 	DECL_LINK( SimpleRefDone, String* );
195 	DECL_LINK( SimpleRefAborted, String* );
196 	DECL_LINK( SimpleRefChange, String* );
197     DECL_LINK( FormControlActivated, FmFormShell* );
198 	DECL_LINK( HtmlOptionsHdl, void * );
199 
200 protected:
201 	virtual void	Activate(sal_Bool bMDI);
202 	virtual void	Deactivate(sal_Bool bMDI);
203 	virtual sal_uInt16	PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
204 
205 	virtual void	ShowCursor(FASTBOOL bOn);
206 
207 	virtual void	Move();		// Benachrichtigung
208 
209 	virtual void	AdjustPosSizePixel( const Point &rPos, const Size &rSize );		// alt
210 
211 	virtual void	InnerResizePixel( const Point &rOfs, const Size &rSize );		// neu
212 	virtual void	OuterResizePixel( const Point &rOfs, const Size &rSize );
213 	virtual void	SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
214 
215 	virtual void	QueryObjAreaPixel( Rectangle& rRect ) const;
216 
217 	virtual Size	GetOptimalSizePixel() const;
218 
219 	virtual String  GetSelectionText( sal_Bool bWholeWord );
220 	virtual sal_Bool	HasSelection( sal_Bool bText ) const;
221 	virtual String  GetDescription() const;
222 
223 	virtual void	WriteUserData(String &, sal_Bool bBrowse = sal_False);
224 	virtual void	ReadUserData(const String &, sal_Bool bBrowse = sal_False);
225     virtual void    WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
226     virtual void    ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
227 
228     virtual void    UIDeactivated( SfxInPlaceClient* pClient );
229 
230 	virtual FASTBOOL KeyInput( const KeyEvent &rKeyEvent );
231 	virtual SdrView* GetDrawView() const;
232 
233 public:
234 					TYPEINFO_VISIBILITY(SC_DLLPUBLIC);
235 
236 					SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
237 					SFX_DECL_VIEWFACTORY(ScTabViewShell);
238 
239 
240 					// -> Clone-Methode fuer Factory
241 
242 //UNUSED2008-05  ScTabViewShell( SfxViewFrame*           pViewFrame,
243 //UNUSED2008-05                  const ScTabViewShell&   rWin );
244 
245 					// aus einer allgemeinen Shell konstruieren und
246 					// soviel wie moeglich uebernehmen (SliderPos etc.):
247 
248 					ScTabViewShell( SfxViewFrame*			pViewFrame,
249 									SfxViewShell*			pOldSh );
250 
251 	virtual			~ScTabViewShell();
252 
253 	Window*			GetDialogParent();
254 
255     bool            IsRefInputMode() const;
256 	void			ExecuteInputDirect();
257 
258 	ScInputHandler*	GetInputHandler() const;
259 	void			UpdateInputHandler( sal_Bool bForce = sal_False, sal_Bool bStopEditing = sal_True );
260     void            UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
261 	sal_Bool			TabKeyInput(const KeyEvent& rKEvt);
262 	sal_Bool			SfxKeyInput(const KeyEvent& rKEvt);
263 
264 	void			SetActive();
265 
GetDefaultFrameLine() const266 	SvxBorderLine*	GetDefaultFrameLine() const { return pCurFrameLine; }
267 	void 			SetDefaultFrameLine(const SvxBorderLine* pLine );
268 
269 //UNUSED2008-05  void            ExecuteShowNIY( SfxRequest& rReq );
270 //UNUSED2008-05  void			StateDisabled( SfxItemSet& rSet );
271 
272 	SC_DLLPUBLIC void			Execute( SfxRequest& rReq );
273 	SC_DLLPUBLIC void			GetState( SfxItemSet& rSet );
274 
275 	void			ExecuteTable( SfxRequest& rReq );
276 	void			GetStateTable( SfxItemSet& rSet );
277 
278 	void			WindowChanged();
279 	void 			ExecDraw(SfxRequest&);
280 	void			ExecDrawIns(SfxRequest& rReq);
281 	void 			GetDrawState(SfxItemSet &rSet);
282 	void 			GetDrawInsState(SfxItemSet &rSet);
283 	void			ExecGallery(SfxRequest& rReq);		// StarGallery
284 	void			GetGalleryState(SfxItemSet& rSet);
285 
286 	void			ExecChildWin(SfxRequest& rReq);
287 	void			GetChildWinState( SfxItemSet& rSet );
288 
289 	void			ExecImageMap( SfxRequest& rReq );
290 	void			GetImageMapState( SfxItemSet& rSet );
291 
292 	void			ExecTbx( SfxRequest& rReq );
293 	void			GetTbxState( SfxItemSet& rSet );
294 
295 	void			ExecuteSave( SfxRequest& rReq );
296 	void			GetSaveState( SfxItemSet& rSet );
297 	void			ExecSearch( SfxRequest& rReq );
298 
299 	void			ExecuteUndo(SfxRequest& rReq);
300 	void			GetUndoState(SfxItemSet &rSet);
301 
302 	void			ExecuteSbx( SfxRequest& rReq );
303 	void			GetSbxState( SfxItemSet& rSet );
304 
305 	void			ExecuteObject(SfxRequest& rReq);
306 	void			GetObjectState(SfxItemSet &rSet);
307 
308 	void			ExecDrawOpt(SfxRequest& rReq);
309 	void			GetDrawOptState(SfxItemSet &rSet);
310 
311     void            UpdateDrawShell();
312 	void			SetDrawShell( sal_Bool bActive );
313 	void			SetDrawTextShell( sal_Bool bActive );
314 
315 	void			SetPivotShell( sal_Bool bActive );
GetPivotSource()316 	ScArea*			GetPivotSource(){return pPivotSource;}
SetPivotSource(ScArea * pSrc)317 	void			SetPivotSource(ScArea* pSrc){pPivotSource=pSrc;}
318 	void			SetDialogDPObject( const ScDPObject* pObj );
GetDialogDPObject() const319 	const ScDPObject* GetDialogDPObject() const { return pDialogDPObject; }
320 
GetDontSwitch()321 	sal_Bool			GetDontSwitch(){return bDontSwitch;}
SetDontSwitch(sal_Bool bFlag)322 	void			SetDontSwitch(sal_Bool bFlag){bDontSwitch=bFlag;}
323 
324 
325 	void			SetAuditShell( sal_Bool bActive );
326 	void			SetDrawFormShell( sal_Bool bActive );
327 	void			SetEditShell(EditView* pView, sal_Bool bActive );
328 	void			SetOleObjectShell( sal_Bool bActive );
329 	void			SetChartShell( sal_Bool bActive );
330 	void			SetGraphicShell( sal_Bool bActive );
331 	void			SetMediaShell( sal_Bool bActive );
332 
333 
334 	void			SetDrawShellOrSub();
335 	void			SetCurSubShell( ObjectSelectionType eOST, sal_Bool bForce = sal_False );
336 
337     void            SetFormShellAtTop( sal_Bool bSet );
338 
339 	ObjectSelectionType GetCurObjectSelectionType();
340 
341 	virtual ErrCode	DoVerb(long nVerb);
342 
343 
344 	void			StopEditShell();
345 	sal_Bool			IsDrawTextShell() const;
346 	sal_Bool			IsAuditShell() const;
347 
348 	void			SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr );
349 
350 	void			FillFieldData( ScHeaderFieldData& rData );
351 
352 //UNUSED2008-05  void            ResetChartArea();
353 	void			SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest );
354 	sal_Bool			GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
355 
356 //UNUSED2008-05  sal_Bool            IsChartDlgEdit() const;
357 //UNUSED2008-05  void            SetChartDlgEdit(sal_Bool bFlag){bChartDlgIsEdit=bFlag;}
358 
SetEditChartName(const String & aStr)359 	void			SetEditChartName(const String& aStr){aEditChartName=aStr;}
360 //UNUSED2008-05  const String&   GetEditChartName() const;
361 
362 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
363 
364     ScNavigatorSettings*    GetNavigatorSettings();
365 
366 	// Drucken:
367 	virtual SfxPrinter*		GetPrinter( sal_Bool bCreate = sal_False );
368 	virtual sal_uInt16			SetPrinter( SfxPrinter* pNewPrinter,
369                                           sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false );
370 
371 	virtual SfxTabPage*     CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
372 
373 	void			ConnectObject( SdrOle2Obj* pObj );
374 	sal_Bool			ActivateObject( SdrOle2Obj* pObj, long nVerb );
375 
376     void            DeactivateOle();
377 
378 	SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
379 	SfxModelessDialog*	CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
380 										SfxChildWinInfo* pInfo,
381 										Window* pParent, sal_uInt16 nSlotId );
382 
383 	void			UpdateOleZoom();
GetScSbxObject() const384 	inline SbxObject* GetScSbxObject() const
385 					{ return pScSbxObject; }
SetScSbxObject(SbxObject * pOb)386 	inline void		SetScSbxObject( SbxObject* pOb )
387 					{ pScSbxObject = pOb; }
388 
GetFormShell() const389 	FmFormShell*	GetFormShell() const	{ return pFormShell; }
390 
391 	void 	InsertURL( const String& rName, const String& rURL, const String& rTarget,
392 							sal_uInt16 nMode );
393 	void 	InsertURLButton( const String& rName, const String& rURL, const String& rTarget,
394 							const Point* pInsPos = NULL );
395 	void 	InsertURLField( const String& rName, const String& rURL, const String& rTarget );
396 
397 	sal_Bool	SelectObject( const String& rName );
398 
SetInFormatDialog(sal_Bool bFlag)399 	void	SetInFormatDialog(sal_Bool bFlag) {bInFormatDialog=bFlag;}
IsInFormatDialog()400 	sal_Bool    IsInFormatDialog() {return bInFormatDialog;}
401 
ForceMove()402 	void	ForceMove()		{ Move(); }
403 
404 	void 	MakeNumberInfoItem		( ScDocument*			 pDoc,
405 									  ScViewData*			 pViewData,
406 									  SvxNumberInfoItem**	 ppItem );
407 
408 	void 	UpdateNumberFormatter	( ScDocument*		     	pDoc,
409 									  const SvxNumberInfoItem& 	rInfoItem );
410 
411 	void	ExecuteCellFormatDlg	( SfxRequest& rReq, sal_uInt16 nTabPage = 0xffff );
412 
413 	sal_Bool	GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
414 
415 	void	StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
416                                     sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection );
417 	void	StopSimpleRefDialog();
418 
419 	void	SetCurRefDlgId( sal_uInt16 nNew );
420 
421 	void	AddAccessibilityObject( SfxListener& rObject );
422 	void	RemoveAccessibilityObject( SfxListener& rObject );
423 	void	BroadcastAccessibility( const SfxHint &rHint );
424 	sal_Bool	HasAccessibilityObjects();
425 
426     bool    ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
427 
428     using ScTabView::ShowCursor;
IsActive()429 	sal_Bool IsActive(){ return bIsActive; }
430 	rtl::OUString GetFormula(ScAddress& rAddress);
431 	const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & GetForms() const;
432 
433 	// i123629
GetForceFocusOnCurCell()434 	sal_Bool	GetForceFocusOnCurCell(){return bForceFocusOnCurCell;}
SetForceFocusOnCurCell(sal_Bool bFlag)435 	void		SetForceFocusOnCurCell(sal_Bool bFlag){bForceFocusOnCurCell=bFlag;}
436 };
437 
438 //==================================================================
439 
440 
441 #endif
442 
443