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