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 : #include <editeng/numitem.hxx>
35 :
36 : class SdDrawDocument;
37 : class SdPage;
38 : class SdrOle2Obj;
39 : class SdrGrafObj;
40 : class SdrMediaObj;
41 : class OutputDevice;
42 : class ImageMap;
43 : class Point;
44 : class Graphic;
45 : class SdrOutliner;
46 : class TransferableDataHelper;
47 : struct StyleRequestData;
48 : class Outliner;
49 :
50 : namespace sd {
51 :
52 : class DrawDocShell;
53 : struct SdNavigatorDropEvent;
54 : class ViewShell;
55 : class Window;
56 : class ViewClipboard;
57 :
58 : // -------------------
59 : // - SdViewRedrawRec -
60 : // -------------------
61 :
62 0 : struct SdViewRedrawRec
63 : {
64 : OutputDevice* mpOut;
65 : Rectangle aRect;
66 : };
67 :
68 :
69 : class View : public FmFormView
70 : {
71 : public:
72 : TYPEINFO();
73 :
74 : View (
75 : SdDrawDocument& rDrawDoc,
76 : OutputDevice* pOutDev,
77 : ViewShell* pViewSh=NULL);
78 : virtual ~View (void);
79 :
80 : void CompleteRedraw( OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L);
81 :
82 : virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const;
83 : virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
84 : virtual void MarkListHasChanged();
85 : virtual void ModelHasChanged();
86 : virtual void SelectAll();
87 : virtual void DoCut(::Window* pWindow=NULL);
88 : virtual void DoCopy(::Window* pWindow=NULL);
89 : virtual void DoPaste(::Window* pWindow=NULL);
90 : virtual void DoConnect(SdrOle2Obj* pOleObj);
91 : virtual sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr = sal_False);
92 : virtual void StartDrag( const Point& rStartPos, ::Window* pWindow );
93 : virtual void DragFinished( sal_Int8 nDropAction );
94 : virtual sal_Int8 AcceptDrop (
95 : const AcceptDropEvent& rEvt,
96 : DropTargetHelper& rTargetHelper,
97 : ::sd::Window* pTargetWindow = NULL,
98 : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
99 : sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
100 : virtual sal_Int8 ExecuteDrop (
101 : const ExecuteDropEvent& rEvt,
102 : DropTargetHelper& rTargetHelper,
103 : ::sd::Window* pTargetWindow = NULL,
104 : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
105 : sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
106 :
107 : ::com::sun::star::uno::Reference<
108 : ::com::sun::star::datatransfer::XTransferable>
109 : CreateClipboardDataObject (::sd::View*, ::Window& rWindow);
110 : ::com::sun::star::uno::Reference<
111 : ::com::sun::star::datatransfer::XTransferable>
112 : CreateDragDataObject (::sd::View*, ::Window& rWindow,
113 : const Point& rDragPos);
114 : ::com::sun::star::uno::Reference<
115 : ::com::sun::star::datatransfer::XTransferable>
116 : CreateSelectionDataObject (::sd::View*, ::Window& rWindow);
117 :
118 : void UpdateSelectionClipboard( sal_Bool bForceDeselect );
119 :
120 : inline DrawDocShell* GetDocSh (void) const;
121 : inline SdDrawDocument& GetDoc (void) const;
122 : inline ViewShell* GetViewShell (void) const;
123 :
124 : virtual sal_Bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = 0L, ::Window* pWin = 0L, sal_Bool bIsNewObj = sal_False,
125 : SdrOutliner* pGivenOutliner = 0L, OutlinerView* pGivenOutlinerView = 0L,
126 : sal_Bool bDontDeleteOutliner = sal_False, sal_Bool bOnlyOneView = sal_False, sal_Bool bGrabFocus = sal_True);
127 :
128 : virtual SdrEndTextEditKind SdrEndTextEdit(sal_Bool bDontDeleteReally = sal_False);
129 :
130 : bool RestoreDefaultText( SdrTextObj* pTextObj );
131 :
132 : sal_Bool InsertData( const TransferableDataHelper& rDataHelper,
133 : const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag,
134 : sal_uLong nFormat = 0, sal_uInt16 nPage = SDRPAGE_NOTFOUND, sal_uInt16 nLayer = SDRLAYER_NOTFOUND );
135 : /** gets the metafile from the given transferable helper and insert it as a graphic shape.
136 : @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
137 : present, then is is inserted as a single graphic.
138 : */
139 : bool InsertMetaFile( TransferableDataHelper& rDataHelper,
140 : const Point& rInsertPos,
141 : ImageMap* pImageMap, bool bOptimize );
142 :
143 : SdrGrafObj* InsertGraphic( const Graphic& rGraphic,
144 : sal_Int8& rAction, const Point& rPos,
145 : SdrObject* pSelectedObj, ImageMap* pImageMap );
146 : SdrMediaObj* InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction,
147 : const Point& rPos, const Size& rSize,
148 : bool const bLink );
149 :
150 : bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions );
151 :
152 : sal_Bool IsPresObjSelected(sal_Bool bOnPage=sal_True, sal_Bool bOnMasterPage=sal_True, sal_Bool bCheckPresObjListOnly=sal_False, sal_Bool bCheckLayoutOnly=sal_False) const;
153 :
154 : void SetMarkedOriginalSize();
155 :
156 : sal_Bool IsMorphingAllowed() const;
157 : sal_Bool IsVectorizeAllowed() const;
158 :
159 : virtual SfxStyleSheet* GetStyleSheet() const;
160 :
161 : /** return parameter:
162 : pExchangeList == NULL -> all names are unique
163 : bNameOK == sal_False -> cancel by user
164 : nType == 0 -> pages
165 : nType == 1 -> objects
166 : nType == 2 -> pages and objects */
167 :
168 : bool GetExchangeList( std::vector<OUString> &rExchangeList,
169 : std::vector<OUString> &rBookmarkList,
170 : const sal_uInt16 nType );
171 :
172 : virtual void onAccessibilityOptionsChanged();
173 :
174 : virtual SdrModel* GetMarkedObjModel() const;
175 : virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
176 : using SdrExchangeView::Paste;
177 :
178 : /** returns true if we have an undo manager and there is an open list undo action */
179 : bool isRecordingUndo() const;
180 :
181 : virtual void AddCustomHdl();
182 :
183 0 : SmartTagSet& getSmartTags() { return maSmartTags; }
184 : void selectSmartTag( const SmartTagReference& xTag );
185 : void updateHandles();
186 :
187 : virtual SdrViewContext GetContext() const;
188 : virtual sal_Bool HasMarkablePoints() const;
189 : virtual sal_uLong GetMarkablePointCount() const;
190 : virtual sal_Bool HasMarkedPoints() const;
191 : virtual sal_uLong GetMarkedPointCount() const;
192 : virtual sal_Bool IsPointMarkable(const SdrHdl& rHdl) const;
193 : virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
194 : virtual void CheckPossibilities();
195 : virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
196 : using SdrMarkView::MarkPoints;
197 :
198 : bool ShouldToggleOn(
199 : const bool bBulletOnOffMode,
200 : const bool bNormalBullet);
201 :
202 : /** change the bullets/numbering of the marked objects
203 :
204 : @param bToggle
205 : true: just toggle the current bullets/numbering on --> off resp. off --> on
206 :
207 : @param bHandleBullets
208 : true: handle bullets
209 : false: handle numbering
210 :
211 : @param pNumRule
212 : numbering rule which needs to be applied. can be 0.
213 :
214 : @param bSwitchOff
215 : true: switch off bullets/numbering
216 : */
217 : void ChangeMarkedObjectsBulletsNumbering(
218 : const bool bToggle,
219 : const bool bHandleBullets,
220 : const SvxNumRule* pNumRule,
221 : const bool bSwitchOff);
222 :
223 0 : void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
224 0 : void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
225 0 : void SetMoveProtected( bool bSet ) { bMoveProtect = bSet; }
226 0 : void SetResizeFreeAllowed( bool bSet ) { bResizeFreeAllowed = bSet; }
227 0 : void SetResizePropAllowed( bool bSet ) { bResizePropAllowed = bSet; }
228 0 : void SetResizeProtected( bool bSet ) { bResizeProtect = bSet; }
229 :
230 : void SetMarkedPointsSmoothPossible( bool bSet ) { bSetMarkedPointsSmoothPossible = bSet; }
231 : void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; }
232 :
233 : SdrObject* GetEmptyPresentationObject( PresObjKind eKind );
234 : SdPage* GetPage();
235 : SdrObject* GetSelectedSingleObject(SdPage* pPage);
236 :
237 : protected:
238 : DECL_LINK( OnParagraphInsertedHdl, ::Outliner * );
239 : DECL_LINK( OnParagraphRemovingHdl, ::Outliner * );
240 :
241 : virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
242 : virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
243 :
244 : SdDrawDocument& mrDoc;
245 : DrawDocShell* mpDocSh;
246 : ViewShell* mpViewSh;
247 : SdrMarkList* mpDragSrcMarkList;
248 : SdrObject* mpDropMarkerObj;
249 : SdrDropMarkerOverlay* mpDropMarker;
250 : sal_uInt16 mnDragSrcPgNum;
251 : Point maDropPos;
252 : ::std::vector< String > maDropFileVector;
253 : sal_Int8 mnAction;
254 : Timer maDropErrorTimer;
255 : Timer maDropInsertFileTimer;
256 : sal_uInt16 mnLockRedrawSmph;
257 : boost::ptr_vector<SdViewRedrawRec> maLockedRedraws;
258 : bool mbIsDropAllowed;
259 :
260 : DECL_LINK( DropErrorHdl, void* );
261 : DECL_LINK( DropInsertFileHdl, void* );
262 : DECL_LINK( ExecuteNavigatorDrop, SdNavigatorDropEvent* pSdNavigatorDropEvent );
263 :
264 : void ImplClearDrawDropMarker();
265 :
266 : SmartTagSet maSmartTags;
267 :
268 : private:
269 : ::std::auto_ptr<ViewClipboard> mpClipboard;
270 : };
271 :
272 :
273 0 : DrawDocShell* View::GetDocSh (void) const
274 : {
275 0 : return mpDocSh;
276 : }
277 0 : SdDrawDocument& View::GetDoc (void) const
278 : {
279 0 : return mrDoc;
280 : }
281 :
282 74 : ViewShell* View::GetViewShell (void) const
283 : {
284 74 : return mpViewSh;
285 : }
286 :
287 : } // end of namespace sd
288 :
289 : #endif
290 :
291 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|