Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_TABVWSH_HXX
30 : : #define SC_TABVWSH_HXX
31 : :
32 : : #include <svtools/htmlcfg.hxx>
33 : : #include <sfx2/viewsh.hxx>
34 : : #include <sfx2/viewfac.hxx>
35 : : #include <editeng/svxenum.hxx>
36 : : #include "scdllapi.h"
37 : : #include "dbfunc.hxx" // -> tabview
38 : : #include "target.hxx"
39 : : #include "rangelst.hxx" // ScRangeListRef
40 : : #include "shellids.hxx"
41 : : #include "tabprotection.hxx" // for ScPasswordHash
42 : :
43 : : #include <boost/ptr_container/ptr_map.hpp>
44 : :
45 : : class FmFormShell;
46 : : class SbxObject;
47 : : class SdrOle2Obj;
48 : : class SfxBindings;
49 : : class SfxChildWindow;
50 : : class SfxModelessDialog;
51 : : class SvxNumberInfoItem;
52 : : struct SfxChildWinInfo;
53 : :
54 : : class ScArea;
55 : : class ScAuditingShell;
56 : : class ScDrawShell;
57 : : class ScDrawTextObjectBar;
58 : : class ScEditShell;
59 : : class ScInputHandler;
60 : : class ScPivotShell;
61 : : class ScDrawFormShell;
62 : : class ScCellShell;
63 : : class ScOleObjectShell;
64 : : class ScGraphicShell;
65 : : class ScMediaShell;
66 : : class ScChartShell;
67 : : class ScPageBreakShell;
68 : : class ScDPObject;
69 : : class ScNavigatorSettings;
70 : : class ScRangeName;
71 : :
72 : : struct ScHeaderFieldData;
73 : :
74 : : namespace editeng { class SvxBorderLine; }
75 : :
76 : : namespace com { namespace sun { namespace star { namespace frame {
77 : : class XDispatchProviderInterceptor;
78 : : } } } }
79 : :
80 : : namespace svx {
81 : : class ExtrusionBar;
82 : : class FontworkBar;
83 : : }
84 : :
85 : : enum ObjectSelectionType
86 : : {
87 : : OST_NONE,
88 : : OST_Cell,
89 : : OST_Editing,
90 : : OST_DrawText,
91 : : OST_Drawing,
92 : : OST_DrawForm,
93 : : OST_Pivot,
94 : : OST_Auditing,
95 : : OST_OleObject,
96 : : OST_Chart,
97 : : OST_Graphic,
98 : : OST_Media
99 : : };
100 : :
101 : : //==================================================================
102 : :
103 : :
104 : : class ScTabViewShell: public SfxViewShell, public ScDBFunc
105 : : {
106 : : private:
107 : : static sal_uInt16 nInsertCtrlState;
108 : : static sal_uInt16 nInsCellsCtrlState;
109 : : static sal_uInt16 nInsObjCtrlState;
110 : :
111 : : SvxHtmlOptions aHTMLOpt;
112 : : ObjectSelectionType eCurOST;
113 : : sal_uInt16 nDrawSfxId;
114 : : sal_uInt16 nCtrlSfxId;
115 : : sal_uInt16 nFormSfxId;
116 : : String sDrawCustom; // current custom shape type
117 : : ScDrawShell* pDrawShell;
118 : : ScDrawTextObjectBar* pDrawTextShell;
119 : : ScEditShell* pEditShell;
120 : : ScPivotShell* pPivotShell;
121 : : ScAuditingShell* pAuditingShell;
122 : : ScDrawFormShell* pDrawFormShell;
123 : : ScCellShell* pCellShell;
124 : : ScOleObjectShell* pOleObjectShell;
125 : : ScChartShell* pChartShell;
126 : : ScGraphicShell* pGraphicShell;
127 : : ScMediaShell* pMediaShell;
128 : : ScPageBreakShell* pPageBreakShell;
129 : : svx::ExtrusionBar* pExtrusionBarShell;
130 : : svx::FontworkBar* pFontworkBarShell;
131 : :
132 : : FmFormShell* pFormShell;
133 : :
134 : : ScInputHandler* pInputHandler; // for OLE input cell
135 : :
136 : : ::editeng::SvxBorderLine* pCurFrameLine;
137 : :
138 : : ::com::sun::star::uno::Reference<
139 : : ::com::sun::star::frame::XDispatchProviderInterceptor >
140 : : xDisProvInterceptor;
141 : :
142 : : Point aWinPos;
143 : :
144 : : ScTabViewTarget aTarget;
145 : : ScArea* pPivotSource;
146 : : ScDPObject* pDialogDPObject;
147 : :
148 : : ScNavigatorSettings* pNavSettings;
149 : :
150 : : // used in first Activate
151 : : sal_Bool bFirstActivate;
152 : :
153 : : sal_Bool bActiveDrawSh;
154 : : sal_Bool bActiveDrawTextSh;
155 : : sal_Bool bActivePivotSh;
156 : : sal_Bool bActiveAuditingSh;
157 : : sal_Bool bActiveDrawFormSh;
158 : : sal_Bool bActiveOleObjectSh;
159 : : sal_Bool bActiveChartSh;
160 : : sal_Bool bActiveGraphicSh;
161 : : sal_Bool bActiveMediaSh;
162 : : sal_Bool bActiveEditSh;
163 : :
164 : : sal_Bool bFormShellAtTop; // does the FormShell need to be on top?
165 : :
166 : :
167 : : sal_Bool bDontSwitch; // Don't turn off EditShell
168 : : sal_Bool bInFormatDialog; // for GetSelectionText
169 : : sal_Bool bPrintSelected; // for result of SvxPrtQryBox
170 : :
171 : : sal_Bool bReadOnly; // to detect status changes
172 : :
173 : : SbxObject* pScSbxObject;
174 : :
175 : : sal_Bool bChartAreaValid; // if chart is drawn
176 : : String aEditChartName;
177 : : ScRangeListRef aChartSource;
178 : : Rectangle aChartPos;
179 : : SCTAB nChartDestTab;
180 : : sal_uInt16 nCurRefDlgId;
181 : :
182 : : SfxBroadcaster* pAccessibilityBroadcaster;
183 : :
184 : : static const int MASTERENUMCOMMANDS = 6;
185 : : String aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
186 : :
187 : : // ugly hack for Add button in ScNameDlg
188 : : boost::ptr_map<rtl::OUString, ScRangeName> maRangeMap;
189 : : bool mbInSwitch;
190 : : rtl::OUString maName;
191 : : rtl::OUString maScope;
192 : :
193 : : private:
194 : : void Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
195 : :
196 : : SfxShell* GetMySubShell() const;
197 : :
198 : : void DoReadUserData( const String& rData );
199 : : void DoReadUserDataSequence( const ::com::sun::star::uno::Sequence<
200 : : ::com::sun::star::beans::PropertyValue >& rSettings );
201 : :
202 : : DECL_LINK( SimpleRefClose, void* );
203 : : DECL_LINK( SimpleRefDone, String* );
204 : : DECL_LINK( SimpleRefAborted, String* );
205 : : DECL_LINK( SimpleRefChange, String* );
206 : : DECL_LINK( FormControlActivated, void* );
207 : :
208 : : protected:
209 : : virtual void Activate(sal_Bool bMDI);
210 : : virtual void Deactivate(sal_Bool bMDI);
211 : : virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = false );
212 : :
213 : : virtual void ShowCursor(bool bOn);
214 : :
215 : : virtual void Move(); // Benachrichtigung
216 : :
217 : : virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ); // alt
218 : :
219 : : virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ); // neu
220 : : virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
221 : : virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
222 : :
223 : : virtual void QueryObjAreaPixel( Rectangle& rRect ) const;
224 : :
225 : : virtual Size GetOptimalSizePixel() const;
226 : :
227 : : virtual String GetSelectionText( sal_Bool bWholeWord );
228 : : virtual sal_Bool HasSelection( sal_Bool bText ) const;
229 : : virtual String GetDescription() const;
230 : :
231 : : virtual void WriteUserData(String &, sal_Bool bBrowse = false);
232 : : virtual void ReadUserData(const String &, sal_Bool bBrowse = false);
233 : : virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = false );
234 : : virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = false );
235 : :
236 : : virtual void UIDeactivated( SfxInPlaceClient* pClient );
237 : :
238 : : virtual bool KeyInput( const KeyEvent &rKeyEvent );
239 : : virtual SdrView* GetDrawView() const;
240 : :
241 : : public:
242 : : TYPEINFO_VISIBILITY(SC_DLLPUBLIC);
243 : :
244 : 102 : SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
245 : 51 : SFX_DECL_VIEWFACTORY(ScTabViewShell);
246 : :
247 : :
248 : : /** -> Clone Method for Factory
249 : : Created from a general shell and inherit as much as possible */
250 : : ScTabViewShell( SfxViewFrame* pViewFrame,
251 : : SfxViewShell* pOldSh );
252 : :
253 : : virtual ~ScTabViewShell();
254 : :
255 : : SC_DLLPUBLIC Window* GetDialogParent();
256 : :
257 : : bool IsRefInputMode() const;
258 : : void ExecuteInputDirect();
259 : :
260 : : ScInputHandler* GetInputHandler() const;
261 : : void UpdateInputHandler( sal_Bool bForce = false, sal_Bool bStopEditing = sal_True );
262 : : void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
263 : : sal_Bool TabKeyInput(const KeyEvent& rKEvt);
264 : : sal_Bool SfxKeyInput(const KeyEvent& rKEvt);
265 : :
266 : : void SetActive();
267 : :
268 : 1611 : ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine; }
269 : : void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine );
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 : : SC_DLLPUBLIC 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 );
315 : : ScArea* GetPivotSource(){return pPivotSource;}
316 : : void SetPivotSource(ScArea* pSrc){pPivotSource=pSrc;}
317 : : void SetDialogDPObject( const ScDPObject* pObj );
318 : 0 : const ScDPObject* GetDialogDPObject() const { return pDialogDPObject; }
319 : :
320 : : sal_Bool GetDontSwitch(){return bDontSwitch;}
321 : 0 : 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 = 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 : : void SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest );
352 : : sal_Bool GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
353 : :
354 : : void SetEditChartName(const String& aStr){aEditChartName=aStr;}
355 : :
356 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
357 : :
358 : : ScNavigatorSettings* GetNavigatorSettings();
359 : :
360 : : // Drucken:
361 : : virtual SfxPrinter* GetPrinter( sal_Bool bCreate = false );
362 : : virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter,
363 : : sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false );
364 : :
365 : : virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
366 : :
367 : : void ConnectObject( SdrOle2Obj* pObj );
368 : : sal_Bool ActivateObject( SdrOle2Obj* pObj, long nVerb );
369 : :
370 : : void DeactivateOle();
371 : :
372 : : SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
373 : : SfxModelessDialog* CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
374 : : SfxChildWinInfo* pInfo,
375 : : Window* pParent, sal_uInt16 nSlotId );
376 : :
377 : : void UpdateOleZoom();
378 : : inline SbxObject* GetScSbxObject() const
379 : : { return pScSbxObject; }
380 : : inline void SetScSbxObject( SbxObject* pOb )
381 : : { pScSbxObject = pOb; }
382 : :
383 : 534 : FmFormShell* GetFormShell() const { return pFormShell; }
384 : :
385 : : void InsertURL( const String& rName, const String& rURL, const String& rTarget,
386 : : sal_uInt16 nMode );
387 : : void InsertURLButton( const String& rName, const String& rURL, const String& rTarget,
388 : : const Point* pInsPos = NULL );
389 : : void InsertURLField( const String& rName, const String& rURL, const String& rTarget );
390 : :
391 : : sal_Bool SelectObject( const String& rName );
392 : :
393 : 0 : void SetInFormatDialog(sal_Bool bFlag) {bInFormatDialog=bFlag;}
394 : : sal_Bool IsInFormatDialog() {return bInFormatDialog;}
395 : :
396 : 524 : void ForceMove() { Move(); }
397 : :
398 : : void MakeNumberInfoItem ( ScDocument* pDoc,
399 : : ScViewData* pViewData,
400 : : SvxNumberInfoItem** ppItem );
401 : :
402 : : void UpdateNumberFormatter ( const SvxNumberInfoItem& rInfoItem );
403 : :
404 : : void ExecuteCellFormatDlg ( SfxRequest& rReq, sal_uInt16 nTabPage = 0xffff );
405 : :
406 : : sal_Bool GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
407 : :
408 : : void StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
409 : : sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection );
410 : : void StopSimpleRefDialog();
411 : :
412 : : void SetCurRefDlgId( sal_uInt16 nNew );
413 : :
414 : : void AddAccessibilityObject( SfxListener& rObject );
415 : : void RemoveAccessibilityObject( SfxListener& rObject );
416 : : void BroadcastAccessibility( const SfxHint &rHint );
417 : : sal_Bool HasAccessibilityObjects();
418 : :
419 : : bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
420 : :
421 : : using ScTabView::ShowCursor;
422 : :
423 : : // ugly hack to call Define Names from Manage Names
424 : : void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
425 : : };
426 : :
427 : : //==================================================================
428 : :
429 : :
430 : : #endif
431 : :
432 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|