1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include <boost/ptr_container/ptr_vector.hpp>
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>
33 #include "smarttag.hxx"
34 #include <editeng/numitem.hxx>
46 class TransferableDataHelper
;
47 struct StyleRequestData
;
53 struct SdNavigatorDropEvent
;
58 // -------------------
59 // - SdViewRedrawRec -
60 // -------------------
62 struct SdViewRedrawRec
69 class View
: public FmFormView
75 SdDrawDocument
& rDrawDoc
,
76 OutputDevice
* pOutDev
,
77 ViewShell
* pViewSh
=NULL
);
80 void CompleteRedraw( OutputDevice
* pOutDev
, const Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= 0L);
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
);
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
);
118 void UpdateSelectionClipboard( sal_Bool bForceDeselect
);
120 inline DrawDocShell
* GetDocSh (void) const;
121 inline SdDrawDocument
& GetDoc (void) const;
122 inline ViewShell
* GetViewShell (void) const;
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
);
128 virtual SdrEndTextEditKind
SdrEndTextEdit(sal_Bool bDontDeleteReally
= sal_False
);
130 bool RestoreDefaultText( SdrTextObj
* pTextObj
);
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.
139 bool InsertMetaFile( TransferableDataHelper
& rDataHelper
,
140 const Point
& rInsertPos
,
141 ImageMap
* pImageMap
, bool bOptimize
);
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
,
150 bool PasteRTFTable( SotStorageStreamRef xStm
, SdrPage
* pPage
, sal_uLong nPasteOptions
);
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;
154 void SetMarkedOriginalSize();
156 sal_Bool
IsMorphingAllowed() const;
157 sal_Bool
IsVectorizeAllowed() const;
159 virtual SfxStyleSheet
* GetStyleSheet() const;
161 /** return parameter:
162 pExchangeList == NULL -> all names are unique
163 bNameOK == sal_False -> cancel by user
165 nType == 1 -> objects
166 nType == 2 -> pages and objects */
168 bool GetExchangeList( std::vector
<OUString
> &rExchangeList
,
169 std::vector
<OUString
> &rBookmarkList
,
170 const sal_uInt16 nType
);
172 virtual void onAccessibilityOptionsChanged();
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
;
178 /** returns true if we have an undo manager and there is an open list undo action */
179 bool isRecordingUndo() const;
181 virtual void AddCustomHdl();
183 SmartTagSet
& getSmartTags() { return maSmartTags
; }
184 void selectSmartTag( const SmartTagReference
& xTag
);
185 void updateHandles();
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
;
199 const bool bBulletOnOffMode
,
200 const bool bNormalBullet
);
202 /** change the bullets/numbering of the marked objects
205 true: just toggle the current bullets/numbering on --> off resp. off --> on
207 @param bHandleBullets
209 false: handle numbering
212 numbering rule which needs to be applied. can be 0.
215 true: switch off bullets/numbering
217 void ChangeMarkedObjectsBulletsNumbering(
219 const bool bHandleBullets
,
220 const SvxNumRule
* pNumRule
,
221 const bool bSwitchOff
);
223 void SetPossibilitiesDirty() { bPossibilitiesDirty
= true; }
224 void SetMoveAllowed( bool bSet
) { bMoveAllowed
= bSet
; }
225 void SetMoveProtected( bool bSet
) { bMoveProtect
= bSet
; }
226 void SetResizeFreeAllowed( bool bSet
) { bResizeFreeAllowed
= bSet
; }
227 void SetResizePropAllowed( bool bSet
) { bResizePropAllowed
= bSet
; }
228 void SetResizeProtected( bool bSet
) { bResizeProtect
= bSet
; }
230 void SetMarkedPointsSmoothPossible( bool bSet
) { bSetMarkedPointsSmoothPossible
= bSet
; }
231 void SetMarkedSegmentsKindPossible( bool bSet
) { bSetMarkedSegmentsKindPossible
= bSet
; }
233 SdrObject
* GetEmptyPresentationObject( PresObjKind eKind
);
235 SdrObject
* GetSelectedSingleObject(SdPage
* pPage
);
238 DECL_LINK( OnParagraphInsertedHdl
, ::Outliner
* );
239 DECL_LINK( OnParagraphRemovingHdl
, ::Outliner
* );
241 virtual void OnBeginPasteOrDrop( PasteOrDropInfos
* pInfos
);
242 virtual void OnEndPasteOrDrop( PasteOrDropInfos
* pInfos
);
244 SdDrawDocument
& mrDoc
;
245 DrawDocShell
* mpDocSh
;
247 SdrMarkList
* mpDragSrcMarkList
;
248 SdrObject
* mpDropMarkerObj
;
249 SdrDropMarkerOverlay
* mpDropMarker
;
250 sal_uInt16 mnDragSrcPgNum
;
252 ::std::vector
< String
> maDropFileVector
;
254 Timer maDropErrorTimer
;
255 Timer maDropInsertFileTimer
;
256 sal_uInt16 mnLockRedrawSmph
;
257 boost::ptr_vector
<SdViewRedrawRec
> maLockedRedraws
;
258 bool mbIsDropAllowed
;
260 DECL_LINK( DropErrorHdl
, void* );
261 DECL_LINK( DropInsertFileHdl
, void* );
262 DECL_LINK( ExecuteNavigatorDrop
, SdNavigatorDropEvent
* pSdNavigatorDropEvent
);
264 void ImplClearDrawDropMarker();
266 SmartTagSet maSmartTags
;
269 ::std::auto_ptr
<ViewClipboard
> mpClipboard
;
273 DrawDocShell
* View::GetDocSh (void) const
277 SdDrawDocument
& View::GetDoc (void) const
282 ViewShell
* View::GetViewShell (void) const
287 } // end of namespace sd
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */