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