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