1*f6a9d5caSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6a9d5caSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6a9d5caSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6a9d5caSAndrew Rist * distributed with this work for additional information 6*f6a9d5caSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6a9d5caSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6a9d5caSAndrew Rist * "License"); you may not use this file except in compliance 9*f6a9d5caSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6a9d5caSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6a9d5caSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6a9d5caSAndrew Rist * software distributed under the License is distributed on an 15*f6a9d5caSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6a9d5caSAndrew Rist * KIND, either express or implied. See the License for the 17*f6a9d5caSAndrew Rist * specific language governing permissions and limitations 18*f6a9d5caSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6a9d5caSAndrew Rist *************************************************************/ 21*f6a9d5caSAndrew Rist 22*f6a9d5caSAndrew Rist 23cdf0e10cSrcweir #ifndef VIEW_HXX 24cdf0e10cSrcweir #define VIEW_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <sfx2/dockwin.hxx> 27cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 28cdf0e10cSrcweir #include <svtools/scrwin.hxx> 29cdf0e10cSrcweir #include <sfx2/ctrlitem.hxx> 30cdf0e10cSrcweir #include <sfx2/shell.hxx> 31cdf0e10cSrcweir #include <sfx2/viewfac.hxx> 32cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 33cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 34cdf0e10cSrcweir #include "edit.hxx" 35cdf0e10cSrcweir #include "node.hxx" 36cdf0e10cSrcweir #include "accessibility.hxx" 37cdf0e10cSrcweir 38cdf0e10cSrcweir class Menu; 39cdf0e10cSrcweir class DataChangedEvent; 40cdf0e10cSrcweir class SmClipboardChangeListener; 41cdf0e10cSrcweir class SmDocShell; 42cdf0e10cSrcweir class SmViewShell; 43cdf0e10cSrcweir class SmPrintUIOptions; 44cdf0e10cSrcweir 45cdf0e10cSrcweir /**************************************************************************/ 46cdf0e10cSrcweir 47cdf0e10cSrcweir class SmGraphicWindow : public ScrollableWindow 48cdf0e10cSrcweir { 49cdf0e10cSrcweir Point aFormulaDrawPos; 50cdf0e10cSrcweir Rectangle aCursorRect; 51cdf0e10cSrcweir 52cdf0e10cSrcweir ::com::sun::star::uno::Reference< 53cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > xAccessible; 54cdf0e10cSrcweir SmGraphicAccessible * pAccessible; 55cdf0e10cSrcweir 56cdf0e10cSrcweir SmViewShell *pViewShell; 57cdf0e10cSrcweir sal_uInt16 nZoom; 58cdf0e10cSrcweir short nModifyCount; 59cdf0e10cSrcweir sal_Bool bIsCursorVisible; 60cdf0e10cSrcweir 61cdf0e10cSrcweir protected: SetFormulaDrawPos(const Point & rPos)62cdf0e10cSrcweir void SetFormulaDrawPos(const Point &rPos) { aFormulaDrawPos = rPos; } SetIsCursorVisible(sal_Bool bVis)63cdf0e10cSrcweir void SetIsCursorVisible(sal_Bool bVis) { bIsCursorVisible = bVis; } 64cdf0e10cSrcweir using Window::SetCursor; 65cdf0e10cSrcweir void SetCursor(const SmNode *pNode); 66cdf0e10cSrcweir void SetCursor(const Rectangle &rRect); 67cdf0e10cSrcweir 68cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& ); 69cdf0e10cSrcweir virtual void Paint(const Rectangle&); 70cdf0e10cSrcweir virtual void KeyInput(const KeyEvent& rKEvt); 71cdf0e10cSrcweir virtual void Command(const CommandEvent& rCEvt); 72cdf0e10cSrcweir virtual void StateChanged( StateChangedType eChanged ); 73cdf0e10cSrcweir DECL_LINK(MenuSelectHdl, Menu *); 74cdf0e10cSrcweir 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir SmGraphicWindow(SmViewShell* pShell); 77cdf0e10cSrcweir ~SmGraphicWindow(); 78cdf0e10cSrcweir 79cdf0e10cSrcweir // Window 80cdf0e10cSrcweir virtual void MouseButtonDown(const MouseEvent &rMEvt); 81cdf0e10cSrcweir virtual void GetFocus(); 82cdf0e10cSrcweir virtual void LoseFocus(); 83cdf0e10cSrcweir GetView()84cdf0e10cSrcweir SmViewShell * GetView() { return pViewShell; } 85cdf0e10cSrcweir 86cdf0e10cSrcweir using Window::SetZoom; 87cdf0e10cSrcweir void SetZoom(sal_uInt16 Factor); 88cdf0e10cSrcweir using Window::GetZoom; GetZoom() const89cdf0e10cSrcweir sal_uInt16 GetZoom() const { return nZoom; } 90cdf0e10cSrcweir GetFormulaDrawPos() const91cdf0e10cSrcweir const Point & GetFormulaDrawPos() const { return aFormulaDrawPos; } 92cdf0e10cSrcweir 93cdf0e10cSrcweir void ZoomToFitInWindow(); 94cdf0e10cSrcweir using ScrollableWindow::SetTotalSize; 95cdf0e10cSrcweir void SetTotalSize(); 96cdf0e10cSrcweir IsCursorVisible() const97cdf0e10cSrcweir sal_Bool IsCursorVisible() const { return bIsCursorVisible; } 98cdf0e10cSrcweir void ShowCursor(sal_Bool bShow); 99cdf0e10cSrcweir const SmNode * SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol); 100cdf0e10cSrcweir 101cdf0e10cSrcweir void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir // for Accessibility 104cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 105cdf0e10cSrcweir 106cdf0e10cSrcweir using Window::GetAccessible; GetAccessible_Impl()107cdf0e10cSrcweir SmGraphicAccessible * GetAccessible_Impl() { return pAccessible; } 108cdf0e10cSrcweir }; 109cdf0e10cSrcweir 110cdf0e10cSrcweir /**************************************************************************/ 111cdf0e10cSrcweir 112cdf0e10cSrcweir class SmGraphicController: public SfxControllerItem 113cdf0e10cSrcweir { 114cdf0e10cSrcweir protected: 115cdf0e10cSrcweir SmGraphicWindow &rGraphic; 116cdf0e10cSrcweir public: 117cdf0e10cSrcweir SmGraphicController(SmGraphicWindow &, sal_uInt16, SfxBindings & ); 118cdf0e10cSrcweir virtual void StateChanged(sal_uInt16 nSID, 119cdf0e10cSrcweir SfxItemState eState, 120cdf0e10cSrcweir const SfxPoolItem* pState); 121cdf0e10cSrcweir }; 122cdf0e10cSrcweir 123cdf0e10cSrcweir /**************************************************************************/ 124cdf0e10cSrcweir 125cdf0e10cSrcweir class SmEditController: public SfxControllerItem 126cdf0e10cSrcweir { 127cdf0e10cSrcweir protected: 128cdf0e10cSrcweir SmEditWindow &rEdit; 129cdf0e10cSrcweir 130cdf0e10cSrcweir public: 131cdf0e10cSrcweir SmEditController(SmEditWindow &, sal_uInt16, SfxBindings & ); 132cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 133cdf0e10cSrcweir virtual ~SmEditController(); 134cdf0e10cSrcweir #endif 135cdf0e10cSrcweir 136cdf0e10cSrcweir virtual void StateChanged(sal_uInt16 nSID, 137cdf0e10cSrcweir SfxItemState eState, 138cdf0e10cSrcweir const SfxPoolItem* pState); 139cdf0e10cSrcweir }; 140cdf0e10cSrcweir 141cdf0e10cSrcweir /**************************************************************************/ 142cdf0e10cSrcweir 143cdf0e10cSrcweir class SmCmdBoxWindow : public SfxDockingWindow 144cdf0e10cSrcweir { 145cdf0e10cSrcweir SmEditWindow aEdit; 146cdf0e10cSrcweir SmEditController aController; 147cdf0e10cSrcweir sal_Bool bExiting; 148cdf0e10cSrcweir 149cdf0e10cSrcweir Timer aInitialFocusTimer; 150cdf0e10cSrcweir 151cdf0e10cSrcweir DECL_LINK(InitialFocusTimerHdl, Timer *); 152cdf0e10cSrcweir 153cdf0e10cSrcweir protected : 154cdf0e10cSrcweir 155cdf0e10cSrcweir // Window 156cdf0e10cSrcweir virtual void GetFocus(); 157cdf0e10cSrcweir virtual void Resize(); 158cdf0e10cSrcweir virtual void Paint(const Rectangle& rRect); 159cdf0e10cSrcweir virtual void StateChanged( StateChangedType nStateChange ); 160cdf0e10cSrcweir 161cdf0e10cSrcweir virtual Size CalcDockingSize(SfxChildAlignment eAlign); 162cdf0e10cSrcweir virtual SfxChildAlignment CheckAlignment(SfxChildAlignment eActual, 163cdf0e10cSrcweir SfxChildAlignment eWish); 164cdf0e10cSrcweir 165cdf0e10cSrcweir virtual void ToggleFloatingMode(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir public: 168cdf0e10cSrcweir SmCmdBoxWindow(SfxBindings *pBindings, 169cdf0e10cSrcweir SfxChildWindow *pChildWindow, 170cdf0e10cSrcweir Window *pParent); 171cdf0e10cSrcweir 172cdf0e10cSrcweir virtual ~SmCmdBoxWindow (); 173cdf0e10cSrcweir 174cdf0e10cSrcweir void AdjustPosition(); 175cdf0e10cSrcweir GetEditWindow()176cdf0e10cSrcweir SmEditWindow *GetEditWindow() { return (&aEdit); } 177cdf0e10cSrcweir SmViewShell *GetView(); 178cdf0e10cSrcweir }; 179cdf0e10cSrcweir 180cdf0e10cSrcweir /**************************************************************************/ 181cdf0e10cSrcweir 182cdf0e10cSrcweir class SmCmdBoxWrapper : public SfxChildWindow 183cdf0e10cSrcweir { 184cdf0e10cSrcweir SFX_DECL_CHILDWINDOW(SmCmdBoxWrapper); 185cdf0e10cSrcweir 186cdf0e10cSrcweir protected: 187cdf0e10cSrcweir SmCmdBoxWrapper(Window *pParentWindow, 188cdf0e10cSrcweir sal_uInt16 nId, 189cdf0e10cSrcweir SfxBindings *pBindings, 190cdf0e10cSrcweir SfxChildWinInfo *pInfo); 191cdf0e10cSrcweir 192cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 193cdf0e10cSrcweir virtual ~SmCmdBoxWrapper(); 194cdf0e10cSrcweir #endif 195cdf0e10cSrcweir 196cdf0e10cSrcweir public: 197cdf0e10cSrcweir GetEditWindow()198cdf0e10cSrcweir SmEditWindow *GetEditWindow() 199cdf0e10cSrcweir { 200cdf0e10cSrcweir return (((SmCmdBoxWindow *)pWindow)->GetEditWindow()); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir }; 204cdf0e10cSrcweir 205cdf0e10cSrcweir /**************************************************************************/ 206cdf0e10cSrcweir 207cdf0e10cSrcweir namespace sfx2 { class FileDialogHelper; } 208cdf0e10cSrcweir struct SmViewShell_Impl; 209cdf0e10cSrcweir 210cdf0e10cSrcweir class SmViewShell: public SfxViewShell 211cdf0e10cSrcweir { 212cdf0e10cSrcweir // for handling the PasteClipboardState 213cdf0e10cSrcweir friend class SmClipboardChangeListener; 214cdf0e10cSrcweir 215cdf0e10cSrcweir SmGraphicWindow aGraphic; 216cdf0e10cSrcweir SmGraphicController aGraphicController; 217cdf0e10cSrcweir String StatusText; 218cdf0e10cSrcweir 219cdf0e10cSrcweir ::com::sun::star::uno:: Reference < 220cdf0e10cSrcweir ::com::sun::star::lang:: XEventListener > xClipEvtLstnr; 221cdf0e10cSrcweir SmClipboardChangeListener* pClipEvtLstnr; 222cdf0e10cSrcweir SmViewShell_Impl* pImpl; 223cdf0e10cSrcweir sal_Bool bPasteState; 224cdf0e10cSrcweir 225cdf0e10cSrcweir DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* ); 226cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 227cdf0e10cSrcweir 228cdf0e10cSrcweir protected: 229cdf0e10cSrcweir 230cdf0e10cSrcweir Size GetTextLineSize(OutputDevice& rDevice, 231cdf0e10cSrcweir const String& rLine); 232cdf0e10cSrcweir Size GetTextSize(OutputDevice& rDevice, 233cdf0e10cSrcweir const String& rText, 234cdf0e10cSrcweir long MaxWidth); 235cdf0e10cSrcweir void DrawTextLine(OutputDevice& rDevice, 236cdf0e10cSrcweir const Point& rPosition, 237cdf0e10cSrcweir const String& rLine); 238cdf0e10cSrcweir void DrawText(OutputDevice& rDevice, 239cdf0e10cSrcweir const Point& rPosition, 240cdf0e10cSrcweir const String& rText, 241cdf0e10cSrcweir sal_uInt16 MaxWidth); 242cdf0e10cSrcweir 243cdf0e10cSrcweir virtual sal_uInt16 Print(SfxProgress &rProgress, sal_Bool bIsAPI); 244cdf0e10cSrcweir virtual SfxPrinter *GetPrinter(sal_Bool bCreate = sal_False); 245cdf0e10cSrcweir virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, 246cdf0e10cSrcweir sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false); 247cdf0e10cSrcweir 248cdf0e10cSrcweir sal_Bool Insert( SfxMedium& rMedium ); 249cdf0e10cSrcweir sal_Bool InsertFrom(SfxMedium &rMedium); 250cdf0e10cSrcweir 251cdf0e10cSrcweir virtual SfxTabPage *CreatePrintOptionsPage(Window *pParent, 252cdf0e10cSrcweir const SfxItemSet &rOptions); 253cdf0e10cSrcweir virtual void Deactivate(sal_Bool IsMDIActivate); 254cdf0e10cSrcweir virtual void Activate(sal_Bool IsMDIActivate); 255cdf0e10cSrcweir virtual Size GetOptimalSizePixel() const; 256cdf0e10cSrcweir virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize); 257cdf0e10cSrcweir virtual void InnerResizePixel(const Point &rOfs, const Size &rSize); 258cdf0e10cSrcweir virtual void OuterResizePixel(const Point &rOfs, const Size &rSize); 259cdf0e10cSrcweir virtual void QueryObjAreaPixel( Rectangle& rRect ) const; 260cdf0e10cSrcweir virtual void SetZoomFactor( const Fraction &rX, const Fraction &rY ); 261cdf0e10cSrcweir 262cdf0e10cSrcweir public: 263cdf0e10cSrcweir TYPEINFO(); 264cdf0e10cSrcweir 265cdf0e10cSrcweir SmViewShell(SfxViewFrame *pFrame, SfxViewShell *pOldSh); 266cdf0e10cSrcweir ~SmViewShell(); 267cdf0e10cSrcweir GetDoc()268cdf0e10cSrcweir SmDocShell * GetDoc() 269cdf0e10cSrcweir { 270cdf0e10cSrcweir return (SmDocShell *) GetViewFrame()->GetObjectShell(); 271cdf0e10cSrcweir } 272cdf0e10cSrcweir 273cdf0e10cSrcweir SmEditWindow * GetEditWindow(); GetGraphicWindow()274cdf0e10cSrcweir SmGraphicWindow & GetGraphicWindow() { return aGraphic; } GetGraphicWindow() const275cdf0e10cSrcweir const SmGraphicWindow & GetGraphicWindow() const { return aGraphic; } 276cdf0e10cSrcweir 277cdf0e10cSrcweir void SetStatusText(const String& Text); 278cdf0e10cSrcweir 279cdf0e10cSrcweir void ShowError( const SmErrorDesc *pErrorDesc ); 280cdf0e10cSrcweir void NextError(); 281cdf0e10cSrcweir void PrevError(); 282cdf0e10cSrcweir 283cdf0e10cSrcweir SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+2) 284cdf0e10cSrcweir SFX_DECL_VIEWFACTORY(SmViewShell); 285cdf0e10cSrcweir 286cdf0e10cSrcweir virtual void Execute( SfxRequest& rReq ); 287cdf0e10cSrcweir virtual void GetState(SfxItemSet &); 288cdf0e10cSrcweir 289cdf0e10cSrcweir void Impl_Print( OutputDevice &rOutDev, const SmPrintUIOptions &rPrintUIOptions, 290cdf0e10cSrcweir Rectangle aOutRect, Point aZeroPoint ); 291cdf0e10cSrcweir }; 292cdf0e10cSrcweir 293cdf0e10cSrcweir #endif 294