1c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5c45d927aSAndrew Rist * distributed with this work for additional information 6c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10c45d927aSAndrew Rist * 11c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12c45d927aSAndrew Rist * 13c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14c45d927aSAndrew Rist * software distributed under the License is distributed on an 15c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17c45d927aSAndrew Rist * specific language governing permissions and limitations 18c45d927aSAndrew Rist * under the License. 19c45d927aSAndrew Rist * 20c45d927aSAndrew Rist *************************************************************/ 21c45d927aSAndrew Rist 22c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SD_VIEW_HXX 25cdf0e10cSrcweir #define SD_VIEW_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "pres.hxx" 28cdf0e10cSrcweir #include <tools/gen.hxx> 29cdf0e10cSrcweir #include <svtools/transfer.hxx> 30cdf0e10cSrcweir #include <svx/fmview.hxx> 31cdf0e10cSrcweir #include <svx/svdmark.hxx> 32cdf0e10cSrcweir //#ifndef _SVDVMARK_HXX //autogen 33cdf0e10cSrcweir //#include <svx/svdvmark.hxx> 34cdf0e10cSrcweir //#endif 35cdf0e10cSrcweir #include <svx/svdpage.hxx> 36cdf0e10cSrcweir #include "fupoor.hxx" 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include "smarttag.hxx" 39*766ce4d0SZheng Fan #include <editeng/numitem.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir class SdDrawDocument; 42cdf0e10cSrcweir class SdrOle2Obj; 43cdf0e10cSrcweir class SdrGrafObj; 44cdf0e10cSrcweir class SdrMediaObj; 45cdf0e10cSrcweir class OutputDevice; 46cdf0e10cSrcweir class VirtualDevice; 47cdf0e10cSrcweir class ImageMap; 48cdf0e10cSrcweir class Point; 49cdf0e10cSrcweir class Graphic; 50cdf0e10cSrcweir class SdrOutliner; 51cdf0e10cSrcweir class TransferableDataHelper; 52cdf0e10cSrcweir struct StyleRequestData; 53cdf0e10cSrcweir class Outliner; 54cdf0e10cSrcweir 55cdf0e10cSrcweir namespace sd { 56cdf0e10cSrcweir 57cdf0e10cSrcweir class DrawDocShell; 58cdf0e10cSrcweir struct SdNavigatorDropEvent; 59cdf0e10cSrcweir class ViewShell; 60cdf0e10cSrcweir class Window; 61cdf0e10cSrcweir class ViewClipboard; 62cdf0e10cSrcweir 63cdf0e10cSrcweir // ------------------- 64cdf0e10cSrcweir // - SdViewRedrawRec - 65cdf0e10cSrcweir // ------------------- 66cdf0e10cSrcweir 67cdf0e10cSrcweir struct SdViewRedrawRec 68cdf0e10cSrcweir { 69cdf0e10cSrcweir OutputDevice* mpOut; 70cdf0e10cSrcweir Rectangle aRect; 71cdf0e10cSrcweir }; 72cdf0e10cSrcweir 73cdf0e10cSrcweir 74cdf0e10cSrcweir class View : public FmFormView 75cdf0e10cSrcweir { 76cdf0e10cSrcweir public: 77cdf0e10cSrcweir TYPEINFO(); 78cdf0e10cSrcweir 79cdf0e10cSrcweir View ( 80cdf0e10cSrcweir SdDrawDocument* pDrawDoc, 81cdf0e10cSrcweir OutputDevice* pOutDev, 82cdf0e10cSrcweir ViewShell* pViewSh=NULL); 83cdf0e10cSrcweir virtual ~View (void); 84cdf0e10cSrcweir 85cdf0e10cSrcweir void CompleteRedraw( OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L); 86cdf0e10cSrcweir 87cdf0e10cSrcweir virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const; 88cdf0e10cSrcweir virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False); 89cdf0e10cSrcweir virtual void MarkListHasChanged(); 90cdf0e10cSrcweir virtual void ModelHasChanged(); 91cdf0e10cSrcweir virtual void SelectAll(); 92cdf0e10cSrcweir virtual void DoCut(::Window* pWindow=NULL); 93cdf0e10cSrcweir virtual void DoCopy(::Window* pWindow=NULL); 94cdf0e10cSrcweir virtual void DoPaste(::Window* pWindow=NULL); 95cdf0e10cSrcweir virtual void DoConnect(SdrOle2Obj* pOleObj); 96cdf0e10cSrcweir virtual sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr = sal_False); 97cdf0e10cSrcweir virtual void StartDrag( const Point& rStartPos, ::Window* pWindow ); 98cdf0e10cSrcweir virtual void DragFinished( sal_Int8 nDropAction ); 99cdf0e10cSrcweir virtual sal_Int8 AcceptDrop ( 100cdf0e10cSrcweir const AcceptDropEvent& rEvt, 101cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 102cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL, 103cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND, 104cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND); 105cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop ( 106cdf0e10cSrcweir const ExecuteDropEvent& rEvt, 107cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 108cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL, 109cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND, 110cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND); 111cdf0e10cSrcweir 112cdf0e10cSrcweir ::com::sun::star::uno::Reference< 113cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable> 114cdf0e10cSrcweir CreateClipboardDataObject (::sd::View*, ::Window& rWindow); 115cdf0e10cSrcweir ::com::sun::star::uno::Reference< 116cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable> 117cdf0e10cSrcweir CreateDragDataObject (::sd::View*, ::Window& rWindow, 118cdf0e10cSrcweir const Point& rDragPos); 119cdf0e10cSrcweir ::com::sun::star::uno::Reference< 120cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable> 121cdf0e10cSrcweir CreateSelectionDataObject (::sd::View*, ::Window& rWindow); 122cdf0e10cSrcweir 123cdf0e10cSrcweir void UpdateSelectionClipboard( sal_Bool bForceDeselect ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir inline DrawDocShell* GetDocSh (void) const; 126cdf0e10cSrcweir inline SdDrawDocument* GetDoc (void) const; 127cdf0e10cSrcweir inline ViewShell* GetViewShell (void) const; 128cdf0e10cSrcweir 129cdf0e10cSrcweir virtual sal_Bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = 0L, ::Window* pWin = 0L, sal_Bool bIsNewObj = sal_False, 130cdf0e10cSrcweir SdrOutliner* pGivenOutliner = 0L, OutlinerView* pGivenOutlinerView = 0L, 131cdf0e10cSrcweir sal_Bool bDontDeleteOutliner = sal_False, sal_Bool bOnlyOneView = sal_False, sal_Bool bGrabFocus = sal_True); 132cdf0e10cSrcweir 133cdf0e10cSrcweir virtual SdrEndTextEditKind SdrEndTextEdit(sal_Bool bDontDeleteReally = sal_False); 134cdf0e10cSrcweir 135cdf0e10cSrcweir bool RestoreDefaultText( SdrTextObj* pTextObj ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir sal_Bool InsertData( const TransferableDataHelper& rDataHelper, 138cdf0e10cSrcweir const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag, 139cdf0e10cSrcweir sal_uLong nFormat = 0, sal_uInt16 nPage = SDRPAGE_NOTFOUND, sal_uInt16 nLayer = SDRLAYER_NOTFOUND ); 140cdf0e10cSrcweir /** gets the metafile from the given transferable helper and insert it as a graphic shape. 141cdf0e10cSrcweir @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is 142cdf0e10cSrcweir present, then is is inserted as a single graphic. 143cdf0e10cSrcweir */ 144cdf0e10cSrcweir bool InsertMetaFile( TransferableDataHelper& rDataHelper, 145cdf0e10cSrcweir const Point& rInsertPos, 146cdf0e10cSrcweir ImageMap* pImageMap, bool bOptimize ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir SdrGrafObj* InsertGraphic( const Graphic& rGraphic, 149cdf0e10cSrcweir sal_Int8& rAction, const Point& rPos, 150cdf0e10cSrcweir SdrObject* pSelectedObj, ImageMap* pImageMap ); 151cdf0e10cSrcweir SdrMediaObj* InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction, 152cdf0e10cSrcweir const Point& rPos, const Size& rSize ); 153cdf0e10cSrcweir 154cdf0e10cSrcweir bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir sal_Bool IsPresObjSelected(sal_Bool bOnPage=sal_True, sal_Bool bOnMasterPage=sal_True, sal_Bool bCheckPresObjListOnly=sal_False, sal_Bool bCheckLayoutOnly=sal_False) const; 157cdf0e10cSrcweir 158cdf0e10cSrcweir void SetMarkedOriginalSize(); 159cdf0e10cSrcweir 160cdf0e10cSrcweir void LockRedraw(sal_Bool bLock); 161cdf0e10cSrcweir 162cdf0e10cSrcweir sal_Bool IsMorphingAllowed() const; 163cdf0e10cSrcweir sal_Bool IsVectorizeAllowed() const; 164cdf0e10cSrcweir 165cdf0e10cSrcweir virtual SfxStyleSheet* GetStyleSheet() const; 166cdf0e10cSrcweir 167cdf0e10cSrcweir sal_Bool GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType ); 168cdf0e10cSrcweir 169cdf0e10cSrcweir virtual void onAccessibilityOptionsChanged(); 170cdf0e10cSrcweir 171cdf0e10cSrcweir virtual SdrModel* GetMarkedObjModel() const; 172cdf0e10cSrcweir virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0); 173cdf0e10cSrcweir using SdrExchangeView::Paste; 174cdf0e10cSrcweir 175cdf0e10cSrcweir /** returns true if we have an undo manager and there is an open list undo action */ 176cdf0e10cSrcweir bool isRecordingUndo() const; 177cdf0e10cSrcweir 178cdf0e10cSrcweir virtual void AddCustomHdl(); 179cdf0e10cSrcweir 180cdf0e10cSrcweir SmartTagSet& getSmartTags() { return maSmartTags; } 181cdf0e10cSrcweir void selectSmartTag( const SmartTagReference& xTag ); 182cdf0e10cSrcweir void updateHandles(); 183cdf0e10cSrcweir 184cdf0e10cSrcweir virtual SdrViewContext GetContext() const; 185cdf0e10cSrcweir virtual sal_Bool HasMarkablePoints() const; 186cdf0e10cSrcweir virtual sal_uLong GetMarkablePointCount() const; 187cdf0e10cSrcweir virtual sal_Bool HasMarkedPoints() const; 188cdf0e10cSrcweir virtual sal_uLong GetMarkedPointCount() const; 189cdf0e10cSrcweir virtual sal_Bool IsPointMarkable(const SdrHdl& rHdl) const; 190cdf0e10cSrcweir virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False); 191cdf0e10cSrcweir virtual void CheckPossibilities(); 192cdf0e10cSrcweir virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark); 193cdf0e10cSrcweir using SdrMarkView::MarkPoints; 194*766ce4d0SZheng Fan sal_Bool ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet); 195*766ce4d0SZheng Fan void ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false); 196cdf0e10cSrcweir 197cdf0e10cSrcweir void SetPossibilitiesDirty() { bPossibilitiesDirty = true; } 198cdf0e10cSrcweir void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; } 199cdf0e10cSrcweir void SetMoveProtected( bool bSet ) { bMoveProtect = bSet; } 200cdf0e10cSrcweir void SetResizeFreeAllowed( bool bSet ) { bResizeFreeAllowed = bSet; } 201cdf0e10cSrcweir void SetResizePropAllowed( bool bSet ) { bResizePropAllowed = bSet; } 202cdf0e10cSrcweir void SetResizeProtected( bool bSet ) { bResizeProtect = bSet; } 203cdf0e10cSrcweir 204cdf0e10cSrcweir void SetMarkedPointsSmoothPossible( bool bSet ) { bSetMarkedPointsSmoothPossible = bSet; } 205cdf0e10cSrcweir void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; } 206cdf0e10cSrcweir 207cdf0e10cSrcweir SdrObject* GetEmptyPresentationObject( PresObjKind eKind ); 208cdf0e10cSrcweir protected: 209cdf0e10cSrcweir DECL_LINK( OnParagraphInsertedHdl, ::Outliner * ); 210cdf0e10cSrcweir DECL_LINK( OnParagraphRemovingHdl, ::Outliner * ); 211cdf0e10cSrcweir 212cdf0e10cSrcweir virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ); 213cdf0e10cSrcweir virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ); 214cdf0e10cSrcweir 215cdf0e10cSrcweir SdDrawDocument* mpDoc; 216cdf0e10cSrcweir DrawDocShell* mpDocSh; 217cdf0e10cSrcweir ViewShell* mpViewSh; 218cdf0e10cSrcweir SdrMarkList* mpDragSrcMarkList; 219cdf0e10cSrcweir SdrObject* mpDropMarkerObj; 220cdf0e10cSrcweir SdrDropMarkerOverlay* mpDropMarker; 221cdf0e10cSrcweir sal_uInt16 mnDragSrcPgNum; 222cdf0e10cSrcweir Point maDropPos; 223cdf0e10cSrcweir ::std::vector< String > maDropFileVector; 224cdf0e10cSrcweir sal_Int8 mnAction; 225cdf0e10cSrcweir Timer maDropErrorTimer; 226cdf0e10cSrcweir Timer maDropInsertFileTimer; 227cdf0e10cSrcweir sal_uInt16 mnLockRedrawSmph; 228cdf0e10cSrcweir List* mpLockedRedraws; 229cdf0e10cSrcweir bool mbIsDropAllowed; 230cdf0e10cSrcweir 231cdf0e10cSrcweir DECL_LINK( DropErrorHdl, Timer* ); 232cdf0e10cSrcweir DECL_LINK( DropInsertFileHdl, Timer* ); 233cdf0e10cSrcweir DECL_LINK( ExecuteNavigatorDrop, SdNavigatorDropEvent* pSdNavigatorDropEvent ); 234cdf0e10cSrcweir 235cdf0e10cSrcweir void ImplClearDrawDropMarker(); 236cdf0e10cSrcweir 237cdf0e10cSrcweir SmartTagSet maSmartTags; 238cdf0e10cSrcweir 239cdf0e10cSrcweir private: 240cdf0e10cSrcweir ::std::auto_ptr<ViewClipboard> mpClipboard; 241cdf0e10cSrcweir }; 242cdf0e10cSrcweir 243cdf0e10cSrcweir 244cdf0e10cSrcweir DrawDocShell* View::GetDocSh (void) const 245cdf0e10cSrcweir { 246cdf0e10cSrcweir return mpDocSh; 247cdf0e10cSrcweir } 248cdf0e10cSrcweir SdDrawDocument* View::GetDoc (void) const 249cdf0e10cSrcweir { 250cdf0e10cSrcweir return mpDoc; 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir ViewShell* View::GetViewShell (void) const 254cdf0e10cSrcweir { 255cdf0e10cSrcweir return mpViewSh; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir } // end of namespace sd 259cdf0e10cSrcweir 260cdf0e10cSrcweir #endif 261