update dev300-m58
[ooovba.git] / sd / source / ui / inc / View.hxx
blobed765f7a4add606acff011382b9d12390d15e6f4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: View.hxx,v $
10 * $Revision: 1.22 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_VIEW_HXX
32 #define SD_VIEW_HXX
34 #include "pres.hxx"
35 #include <tools/gen.hxx>
36 #include <svtools/transfer.hxx>
37 #include <svx/fmview.hxx>
38 #include <svx/svdmark.hxx>
39 //#ifndef _SVDVMARK_HXX //autogen
40 //#include <svx/svdvmark.hxx>
41 //#endif
42 #include <svx/svdpage.hxx>
43 #include "fupoor.hxx"
45 #include "smarttag.hxx"
47 class SdDrawDocument;
48 class SdrOle2Obj;
49 class SdrGrafObj;
50 class SdrMediaObj;
51 class OutputDevice;
52 class VirtualDevice;
53 class ImageMap;
54 class Point;
55 class Graphic;
56 class SdrOutliner;
57 class TransferableDataHelper;
58 struct StyleRequestData;
59 class Outliner;
61 namespace sd {
63 class DrawDocShell;
64 struct SdNavigatorDropEvent;
65 class ViewShell;
66 class Window;
67 class ViewClipboard;
69 // -------------------
70 // - SdViewRedrawRec -
71 // -------------------
73 struct SdViewRedrawRec
75 OutputDevice* mpOut;
76 Rectangle aRect;
80 class View : public FmFormView
82 public:
83 TYPEINFO();
85 View (
86 SdDrawDocument* pDrawDoc,
87 OutputDevice* pOutDev,
88 ViewShell* pViewSh=NULL);
89 virtual ~View (void);
91 void CompleteRedraw( OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L);
93 virtual BOOL GetAttributes( SfxItemSet& rTargetSet, BOOL bOnlyHardAttr=FALSE ) const;
94 virtual BOOL SetAttributes(const SfxItemSet& rSet, BOOL bReplaceAll = FALSE);
95 virtual void MarkListHasChanged();
96 virtual void ModelHasChanged();
97 virtual void SelectAll();
98 virtual void DoCut(::Window* pWindow=NULL);
99 virtual void DoCopy(::Window* pWindow=NULL);
100 virtual void DoPaste(::Window* pWindow=NULL);
101 virtual void DoConnect(SdrOle2Obj* pOleObj);
102 virtual BOOL SetStyleSheet(SfxStyleSheet* pStyleSheet, BOOL bDontRemoveHardAttr = FALSE);
103 virtual void StartDrag( const Point& rStartPos, ::Window* pWindow );
104 virtual void DragFinished( sal_Int8 nDropAction );
105 virtual sal_Int8 AcceptDrop (
106 const AcceptDropEvent& rEvt,
107 DropTargetHelper& rTargetHelper,
108 ::sd::Window* pTargetWindow = NULL,
109 USHORT nPage = SDRPAGE_NOTFOUND,
110 USHORT nLayer = SDRPAGE_NOTFOUND);
111 virtual sal_Int8 ExecuteDrop (
112 const ExecuteDropEvent& rEvt,
113 DropTargetHelper& rTargetHelper,
114 ::sd::Window* pTargetWindow = NULL,
115 USHORT nPage = SDRPAGE_NOTFOUND,
116 USHORT nLayer = SDRPAGE_NOTFOUND);
118 ::com::sun::star::uno::Reference<
119 ::com::sun::star::datatransfer::XTransferable>
120 CreateClipboardDataObject (::sd::View*, ::Window& rWindow);
121 ::com::sun::star::uno::Reference<
122 ::com::sun::star::datatransfer::XTransferable>
123 CreateDragDataObject (::sd::View*, ::Window& rWindow,
124 const Point& rDragPos);
125 ::com::sun::star::uno::Reference<
126 ::com::sun::star::datatransfer::XTransferable>
127 CreateSelectionDataObject (::sd::View*, ::Window& rWindow);
129 void UpdateSelectionClipboard( BOOL bForceDeselect );
131 inline DrawDocShell* GetDocSh (void) const;
132 inline SdDrawDocument* GetDoc (void) const;
133 inline ViewShell* GetViewShell (void) const;
135 virtual sal_Bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = 0L, ::Window* pWin = 0L, sal_Bool bIsNewObj = sal_False,
136 SdrOutliner* pGivenOutliner = 0L, OutlinerView* pGivenOutlinerView = 0L,
137 sal_Bool bDontDeleteOutliner = sal_False, sal_Bool bOnlyOneView = sal_False, sal_Bool bGrabFocus = sal_True);
139 virtual SdrEndTextEditKind SdrEndTextEdit(sal_Bool bDontDeleteReally = sal_False);
141 bool RestoreDefaultText( SdrTextObj* pTextObj );
143 BOOL InsertData( const TransferableDataHelper& rDataHelper,
144 const Point& rPos, sal_Int8& rDnDAction, BOOL bDrag,
145 ULONG nFormat = 0, USHORT nPage = SDRPAGE_NOTFOUND, USHORT nLayer = SDRLAYER_NOTFOUND );
146 /** gets the metafile from the given transferable helper and insert it as a graphic shape.
147 @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
148 present, then is is inserted as a single graphic.
150 bool InsertMetaFile( TransferableDataHelper& rDataHelper,
151 const Point& rInsertPos,
152 ImageMap* pImageMap, bool bOptimize );
154 SdrGrafObj* InsertGraphic( const Graphic& rGraphic,
155 sal_Int8& rAction, const Point& rPos,
156 SdrObject* pSelectedObj, ImageMap* pImageMap );
157 SdrMediaObj* InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction,
158 const Point& rPos, const Size& rSize );
160 bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, ULONG nPasteOptions );
162 BOOL IsPresObjSelected(BOOL bOnPage=TRUE, BOOL bOnMasterPage=TRUE, BOOL bCheckPresObjListOnly=FALSE, BOOL bCheckLayoutOnly=FALSE) const;
164 void SetMarkedOriginalSize();
166 VirtualDevice* CreatePageVDev(USHORT nSdPage, PageKind ePageKind, ULONG nWidthPixel);
168 void LockRedraw(BOOL bLock);
169 bool IsRedrawLocked (void) const;
171 BOOL IsMorphingAllowed() const;
172 BOOL IsVectorizeAllowed() const;
174 virtual SfxStyleSheet* GetStyleSheet() const;
176 BOOL GetExchangeList( List*& rpExchangeList, List* pBookmarkList, USHORT nType );
178 virtual void onAccessibilityOptionsChanged();
180 virtual SdrModel* GetMarkedObjModel() const;
181 virtual BOOL Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, UINT32 nOptions=0);
182 using SdrExchangeView::Paste;
184 /** returns true if we have an undo manager and there is an open list undo action */
185 bool isRecordingUndo() const;
187 virtual void AddCustomHdl();
189 SmartTagSet& getSmartTags() { return maSmartTags; }
190 void selectSmartTag( const SmartTagReference& xTag );
191 void updateHandles();
193 virtual SdrViewContext GetContext() const;
194 virtual BOOL HasMarkablePoints() const;
195 virtual ULONG GetMarkablePointCount() const;
196 virtual BOOL HasMarkedPoints() const;
197 virtual ULONG GetMarkedPointCount() const;
198 virtual BOOL IsPointMarkable(const SdrHdl& rHdl) const;
199 virtual BOOL MarkPoint(SdrHdl& rHdl, BOOL bUnmark=FALSE);
200 virtual void CheckPossibilities();
201 virtual BOOL MarkPoints(const ::Rectangle* pRect, BOOL bUnmark);
202 using SdrMarkView::MarkPoints;
204 void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
205 void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
206 void SetMoveProtected( bool bSet ) { bMoveProtect = bSet; }
207 void SetResizeFreeAllowed( bool bSet ) { bResizeFreeAllowed = bSet; }
208 void SetResizePropAllowed( bool bSet ) { bResizePropAllowed = bSet; }
209 void SetResizeProtected( bool bSet ) { bResizeProtect = bSet; }
211 void SetMarkedPointsSmoothPossible( bool bSet ) { bSetMarkedPointsSmoothPossible = bSet; }
212 void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; }
214 protected:
215 DECL_LINK( OnParagraphInsertedHdl, ::Outliner * );
216 DECL_LINK( OnParagraphRemovingHdl, ::Outliner * );
218 virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
219 virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
221 SdDrawDocument* mpDoc;
222 DrawDocShell* mpDocSh;
223 ViewShell* mpViewSh;
224 SdrMarkList* mpDragSrcMarkList;
225 SdrObject* mpDropMarkerObj;
226 SdrDropMarkerOverlay* mpDropMarker;
227 USHORT mnDragSrcPgNum;
228 Point maDropPos;
229 ::std::vector< String > maDropFileVector;
230 sal_Int8 mnAction;
231 Timer maDropErrorTimer;
232 Timer maDropInsertFileTimer;
233 USHORT mnLockRedrawSmph;
234 List* mpLockedRedraws;
235 bool mbIsDropAllowed;
237 DECL_LINK( DropErrorHdl, Timer* );
238 DECL_LINK( DropInsertFileHdl, Timer* );
239 DECL_LINK( ExecuteNavigatorDrop, SdNavigatorDropEvent* pSdNavigatorDropEvent );
241 void ImplClearDrawDropMarker();
243 SmartTagSet maSmartTags;
245 private:
246 ::std::auto_ptr<ViewClipboard> mpClipboard;
250 DrawDocShell* View::GetDocSh (void) const
252 return mpDocSh;
254 SdDrawDocument* View::GetDoc (void) const
256 return mpDoc;
259 ViewShell* View::GetViewShell (void) const
261 return mpViewSh;
264 } // end of namespace sd
266 #endif