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