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