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