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