Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef SC_TABVWSH_HXX
21 : #define SC_TABVWSH_HXX
22 :
23 : #include <svtools/htmlcfg.hxx>
24 : #include <sfx2/viewsh.hxx>
25 : #include <sfx2/viewfac.hxx>
26 : #include <editeng/svxenum.hxx>
27 : #include "scdllapi.h"
28 : #include "dbfunc.hxx" // -> tabview
29 : #include "target.hxx"
30 : #include "rangelst.hxx" // ScRangeListRef
31 : #include "shellids.hxx"
32 : #include "tabprotection.hxx" // for ScPasswordHash
33 :
34 : #include <boost/ptr_container/ptr_map.hpp>
35 :
36 : class FmFormShell;
37 : class SbxObject;
38 : class SdrOle2Obj;
39 : class SfxBindings;
40 : class SfxChildWindow;
41 : class SfxModelessDialog;
42 : class SvxNumberInfoItem;
43 : struct SfxChildWinInfo;
44 :
45 : class ScArea;
46 : class ScAuditingShell;
47 : class ScDrawShell;
48 : class ScDrawTextObjectBar;
49 : class ScEditShell;
50 : class ScInputHandler;
51 : class ScPivotShell;
52 : class ScDrawFormShell;
53 : class ScCellShell;
54 : class ScOleObjectShell;
55 : class ScGraphicShell;
56 : class ScMediaShell;
57 : class ScChartShell;
58 : class ScPageBreakShell;
59 : class ScDPObject;
60 : class ScNavigatorSettings;
61 : class ScRangeName;
62 :
63 : struct ScHeaderFieldData;
64 :
65 : namespace editeng { class SvxBorderLine; }
66 :
67 : namespace com { namespace sun { namespace star { namespace frame {
68 : class XDispatchProviderInterceptor;
69 : } } } }
70 :
71 : namespace svx {
72 : class ExtrusionBar;
73 : class FontworkBar;
74 : }
75 :
76 : enum ObjectSelectionType
77 : {
78 : OST_NONE,
79 : OST_Cell,
80 : OST_Editing,
81 : OST_DrawText,
82 : OST_Drawing,
83 : OST_DrawForm,
84 : OST_Pivot,
85 : OST_Auditing,
86 : OST_OleObject,
87 : OST_Chart,
88 : OST_Graphic,
89 : OST_Media
90 : };
91 :
92 : //==================================================================
93 :
94 :
95 : class ScTabViewShell: public SfxViewShell, public ScDBFunc
96 : {
97 : private:
98 : static sal_uInt16 nInsertCtrlState;
99 : static sal_uInt16 nInsCellsCtrlState;
100 : static sal_uInt16 nInsObjCtrlState;
101 :
102 : SvxHtmlOptions aHTMLOpt;
103 : ObjectSelectionType eCurOST;
104 : sal_uInt16 nDrawSfxId;
105 : sal_uInt16 nCtrlSfxId;
106 : sal_uInt16 nFormSfxId;
107 : String 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;
122 :
123 : FmFormShell* pFormShell;
124 :
125 : ScInputHandler* pInputHandler; // for OLE input cell
126 :
127 : ::editeng::SvxBorderLine* pCurFrameLine;
128 :
129 : ::com::sun::star::uno::Reference<
130 : ::com::sun::star::frame::XDispatchProviderInterceptor >
131 : xDisProvInterceptor;
132 :
133 : Point aWinPos;
134 :
135 : ScTabViewTarget aTarget;
136 : ScArea* pPivotSource;
137 : ScDPObject* pDialogDPObject;
138 :
139 : ScNavigatorSettings* pNavSettings;
140 :
141 : // used in first Activate
142 : sal_Bool bFirstActivate;
143 :
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;
154 :
155 : sal_Bool bFormShellAtTop; // does the FormShell need to be on top?
156 :
157 :
158 : sal_Bool bDontSwitch; // Don't turn off EditShell
159 : sal_Bool bInFormatDialog; // for GetSelectionText
160 : sal_Bool bPrintSelected; // for result of SvxPrtQryBox
161 :
162 : sal_Bool bReadOnly; // to detect status changes
163 :
164 : SbxObject* pScSbxObject;
165 :
166 : sal_Bool bChartAreaValid; // if chart is drawn
167 : String aEditChartName;
168 : ScRangeListRef aChartSource;
169 : Rectangle aChartPos;
170 : SCTAB nChartDestTab;
171 : sal_uInt16 nCurRefDlgId;
172 :
173 : SfxBroadcaster* pAccessibilityBroadcaster;
174 :
175 : static const int MASTERENUMCOMMANDS = 6;
176 : String aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
177 :
178 : // ugly hack for Add button in ScNameDlg
179 : boost::ptr_map<rtl::OUString, ScRangeName> maRangeMap;
180 : bool mbInSwitch;
181 : rtl::OUString maName;
182 : rtl::OUString maScope;
183 :
184 : private:
185 : void Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
186 :
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, void* );
194 : DECL_LINK( SimpleRefDone, String* );
195 : DECL_LINK( SimpleRefAborted, String* );
196 : DECL_LINK( SimpleRefChange, String* );
197 : DECL_LINK( FormControlActivated, 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 = false );
203 :
204 : virtual void ShowCursor(bool 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 = false);
223 : virtual void ReadUserData(const String &, sal_Bool bBrowse = false);
224 : virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = false );
225 : virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = false );
226 :
227 : virtual void UIDeactivated( SfxInPlaceClient* pClient );
228 :
229 : virtual bool KeyInput( const KeyEvent &rKeyEvent );
230 : virtual SdrView* GetDrawView() const;
231 :
232 : public:
233 : TYPEINFO_VISIBILITY(SC_DLLPUBLIC);
234 :
235 10 : SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
236 5 : SFX_DECL_VIEWFACTORY(ScTabViewShell);
237 :
238 :
239 : /** -> Clone Method for Factory
240 : Created from a general shell and inherit as much as possible */
241 : ScTabViewShell( SfxViewFrame* pViewFrame,
242 : SfxViewShell* pOldSh );
243 :
244 : virtual ~ScTabViewShell();
245 :
246 : SC_DLLPUBLIC Window* GetDialogParent();
247 :
248 : bool IsRefInputMode() const;
249 : void ExecuteInputDirect();
250 :
251 : ScInputHandler* GetInputHandler() const;
252 : void UpdateInputHandler( sal_Bool bForce = false, sal_Bool bStopEditing = sal_True );
253 : void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
254 : sal_Bool TabKeyInput(const KeyEvent& rKEvt);
255 : sal_Bool SfxKeyInput(const KeyEvent& rKEvt);
256 :
257 : void SetActive();
258 :
259 0 : ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine; }
260 : void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine );
261 :
262 : SC_DLLPUBLIC void Execute( SfxRequest& rReq );
263 : SC_DLLPUBLIC void GetState( SfxItemSet& rSet );
264 :
265 : void ExecuteTable( SfxRequest& rReq );
266 : void GetStateTable( SfxItemSet& rSet );
267 :
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); // StarGallery
274 : void GetGalleryState(SfxItemSet& rSet);
275 :
276 : void ExecChildWin(SfxRequest& rReq);
277 : void GetChildWinState( SfxItemSet& rSet );
278 :
279 : void ExecImageMap( SfxRequest& rReq );
280 : void GetImageMapState( SfxItemSet& rSet );
281 :
282 : void ExecTbx( SfxRequest& rReq );
283 : void GetTbxState( SfxItemSet& rSet );
284 :
285 : void ExecuteSave( SfxRequest& rReq );
286 : void GetSaveState( SfxItemSet& rSet );
287 : void ExecSearch( SfxRequest& rReq );
288 :
289 : void ExecuteUndo(SfxRequest& rReq);
290 : void GetUndoState(SfxItemSet &rSet);
291 :
292 : void ExecuteSbx( SfxRequest& rReq );
293 : void GetSbxState( SfxItemSet& rSet );
294 :
295 : void ExecuteObject(SfxRequest& rReq);
296 : void GetObjectState(SfxItemSet &rSet);
297 :
298 : void ExecDrawOpt(SfxRequest& rReq);
299 : void GetDrawOptState(SfxItemSet &rSet);
300 :
301 : void UpdateDrawShell();
302 : void SetDrawShell( sal_Bool bActive );
303 : void SetDrawTextShell( sal_Bool bActive );
304 :
305 : void SetPivotShell( sal_Bool bActive );
306 : ScArea* GetPivotSource(){return pPivotSource;}
307 : void SetPivotSource(ScArea* pSrc){pPivotSource=pSrc;}
308 : void SetDialogDPObject( const ScDPObject* pObj );
309 0 : const ScDPObject* GetDialogDPObject() const { return pDialogDPObject; }
310 :
311 : sal_Bool GetDontSwitch(){return bDontSwitch;}
312 0 : void SetDontSwitch(sal_Bool bFlag){bDontSwitch=bFlag;}
313 :
314 :
315 : void SetAuditShell( sal_Bool bActive );
316 : void SetDrawFormShell( sal_Bool bActive );
317 : void SetEditShell(EditView* pView, sal_Bool bActive );
318 : void SetOleObjectShell( sal_Bool bActive );
319 : void SetChartShell( sal_Bool bActive );
320 : void SetGraphicShell( sal_Bool bActive );
321 : void SetMediaShell( sal_Bool bActive );
322 :
323 :
324 : void SetDrawShellOrSub();
325 : void SetCurSubShell( ObjectSelectionType eOST, sal_Bool bForce = false );
326 :
327 : void SetFormShellAtTop( sal_Bool bSet );
328 :
329 : ObjectSelectionType GetCurObjectSelectionType();
330 :
331 : virtual ErrCode DoVerb(long nVerb);
332 :
333 :
334 : void StopEditShell();
335 : sal_Bool IsDrawTextShell() const;
336 : sal_Bool IsAuditShell() const;
337 :
338 : void SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr );
339 :
340 : void FillFieldData( ScHeaderFieldData& rData );
341 :
342 : void SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest );
343 : sal_Bool GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
344 :
345 : void SetEditChartName(const String& aStr){aEditChartName=aStr;}
346 :
347 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
348 :
349 : ScNavigatorSettings* GetNavigatorSettings();
350 :
351 : // Drucken:
352 : virtual SfxPrinter* GetPrinter( sal_Bool bCreate = false );
353 : virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter,
354 : sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false );
355 :
356 : virtual bool HasPrintOptionsPage() const;
357 : virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
358 :
359 : void ConnectObject( SdrOle2Obj* pObj );
360 : sal_Bool ActivateObject( SdrOle2Obj* pObj, long nVerb );
361 :
362 : void DeactivateOle();
363 :
364 : SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
365 : SfxModelessDialog* CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
366 : SfxChildWinInfo* pInfo,
367 : Window* pParent, sal_uInt16 nSlotId );
368 :
369 : void UpdateOleZoom();
370 : inline SbxObject* GetScSbxObject() const
371 : { return pScSbxObject; }
372 : inline void SetScSbxObject( SbxObject* pOb )
373 : { pScSbxObject = pOb; }
374 :
375 0 : FmFormShell* GetFormShell() const { return pFormShell; }
376 :
377 : void InsertURL( const String& rName, const String& rURL, const String& rTarget,
378 : sal_uInt16 nMode );
379 : void InsertURLButton( const String& rName, const String& rURL, const String& rTarget,
380 : const Point* pInsPos = NULL );
381 : void InsertURLField( const String& rName, const String& rURL, const String& rTarget );
382 :
383 : sal_Bool SelectObject( const String& rName );
384 :
385 0 : void SetInFormatDialog(sal_Bool bFlag) {bInFormatDialog=bFlag;}
386 : sal_Bool IsInFormatDialog() {return bInFormatDialog;}
387 :
388 0 : void ForceMove() { Move(); }
389 :
390 : void MakeNumberInfoItem ( ScDocument* pDoc,
391 : ScViewData* pViewData,
392 : SvxNumberInfoItem** ppItem );
393 :
394 : void UpdateNumberFormatter ( const SvxNumberInfoItem& rInfoItem );
395 :
396 : void ExecuteCellFormatDlg ( SfxRequest& rReq, sal_uInt16 nTabPage = 0xffff );
397 :
398 : sal_Bool GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
399 :
400 : void StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
401 : sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection );
402 : void StopSimpleRefDialog();
403 :
404 : void SetCurRefDlgId( sal_uInt16 nNew );
405 :
406 : void AddAccessibilityObject( SfxListener& rObject );
407 : void RemoveAccessibilityObject( SfxListener& rObject );
408 : void BroadcastAccessibility( const SfxHint &rHint );
409 : sal_Bool HasAccessibilityObjects();
410 :
411 : bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
412 :
413 : using ScTabView::ShowCursor;
414 :
415 : // ugly hack to call Define Names from Manage Names
416 : void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
417 : };
418 :
419 : //==================================================================
420 :
421 :
422 : #endif
423 :
424 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|