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