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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_INC_VIEW_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_VIEW_HXX
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>
31 #include <vcl/idle.hxx>
34 #include "smarttag.hxx"
35 #include <editeng/numitem.hxx>
47 class TransferableDataHelper
;
48 struct StyleRequestData
;
54 struct SdNavigatorDropEvent
;
60 struct SdViewRedrawRec
62 VclPtr
<OutputDevice
> mpOut
;
66 //For master view we want to force that master
67 //textboxes have readonly text, because the
68 //text is the auto-generated click-here-to-edit
69 //and it doesn't help to change it
70 class OutlinerMasterViewFilter
76 OutlinerMasterViewFilter()
81 void Start(SdrOutliner
*pOutl
);
85 class View
: public FmFormView
91 SdDrawDocument
& rDrawDoc
,
92 OutputDevice
* pOutDev
,
93 ViewShell
* pViewSh
=NULL
);
96 void CompleteRedraw( OutputDevice
* pOutDev
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= 0L) SAL_OVERRIDE
;
98 virtual bool GetAttributes( SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
= false ) const;
99 virtual bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
= false);
100 virtual void MarkListHasChanged() SAL_OVERRIDE
;
101 virtual void ModelHasChanged() SAL_OVERRIDE
;
103 void DoCut(vcl::Window
* pWindow
=NULL
);
104 void DoCopy(vcl::Window
* pWindow
=NULL
);
105 void DoPaste(vcl::Window
* pWindow
=NULL
);
106 virtual void DoConnect(SdrOle2Obj
* pOleObj
) SAL_OVERRIDE
;
107 virtual bool SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
= false);
108 void StartDrag( const Point
& rStartPos
, vcl::Window
* pWindow
);
109 virtual void DragFinished( sal_Int8 nDropAction
);
110 virtual sal_Int8
AcceptDrop (
111 const AcceptDropEvent
& rEvt
,
112 DropTargetHelper
& rTargetHelper
,
113 ::sd::Window
* pTargetWindow
= NULL
,
114 sal_uInt16 nPage
= SDRPAGE_NOTFOUND
,
115 sal_uInt16 nLayer
= SDRPAGE_NOTFOUND
);
116 virtual sal_Int8
ExecuteDrop (
117 const ExecuteDropEvent
& rEvt
,
118 DropTargetHelper
& rTargetHelper
,
119 ::sd::Window
* pTargetWindow
= NULL
,
120 sal_uInt16 nPage
= SDRPAGE_NOTFOUND
,
121 sal_uInt16 nLayer
= SDRPAGE_NOTFOUND
);
123 ::com::sun::star::uno::Reference
<
124 ::com::sun::star::datatransfer::XTransferable
>
125 CreateClipboardDataObject (::sd::View
*, vcl::Window
& rWindow
);
126 ::com::sun::star::uno::Reference
<
127 ::com::sun::star::datatransfer::XTransferable
>
128 CreateDragDataObject (::sd::View
*, vcl::Window
& rWindow
,
129 const Point
& rDragPos
);
130 ::com::sun::star::uno::Reference
<
131 ::com::sun::star::datatransfer::XTransferable
>
132 CreateSelectionDataObject (::sd::View
*, vcl::Window
& rWindow
);
134 void UpdateSelectionClipboard( bool bForceDeselect
);
136 inline DrawDocShell
* GetDocSh() const { return mpDocSh
; }
137 inline SdDrawDocument
& GetDoc() const;
138 inline ViewShell
* GetViewShell() const { return mpViewSh
; }
140 virtual bool SdrBeginTextEdit(SdrObject
* pObj
, SdrPageView
* pPV
= 0L, vcl::Window
* pWin
= 0L, bool bIsNewObj
= false,
141 SdrOutliner
* pGivenOutliner
= 0L, OutlinerView
* pGivenOutlinerView
= 0L,
142 bool bDontDeleteOutliner
= false, bool bOnlyOneView
= false, bool bGrabFocus
= true) SAL_OVERRIDE
;
144 virtual SdrEndTextEditKind
SdrEndTextEdit(bool bDontDeleteReally
= false) SAL_OVERRIDE
;
146 bool RestoreDefaultText( SdrTextObj
* pTextObj
);
148 bool InsertData( const TransferableDataHelper
& rDataHelper
,
149 const Point
& rPos
, sal_Int8
& rDnDAction
, bool bDrag
,
150 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
,
151 sal_uInt16 nPage
= SDRPAGE_NOTFOUND
, sal_uInt16 nLayer
= SDRLAYER_NOTFOUND
);
152 /** gets the metafile from the given transferable helper and insert it as a graphic shape.
153 @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
154 present, then is inserted as a single graphic.
156 bool InsertMetaFile( TransferableDataHelper
& rDataHelper
,
157 const Point
& rInsertPos
,
158 ImageMap
* pImageMap
, bool bOptimize
);
160 SdrGrafObj
* InsertGraphic( const Graphic
& rGraphic
,
161 sal_Int8
& rAction
, const Point
& rPos
,
162 SdrObject
* pSelectedObj
, ImageMap
* pImageMap
);
163 SdrMediaObj
* InsertMediaURL( const OUString
& rMediaURL
, sal_Int8
& rAction
,
164 const Point
& rPos
, const Size
& rSize
,
167 SdrMediaObj
* Insert3DModelURL( const OUString
& rModelURL
, sal_Int8
& rAction
,
168 const Point
& rPos
, const Size
& rSize
,
171 SdrMediaObj
* InsertMediaObj( const OUString
& rURL
, const OUString
& rMimeType
, sal_Int8
& rAction
,
172 const Point
& rPos
, const Size
& rSize
);
174 bool PasteRTFTable( ::tools::SvRef
<SotStorageStream
> xStm
, SdrPage
* pPage
, SdrInsertFlags nPasteOptions
);
176 bool IsPresObjSelected(bool bOnPage
= true, bool bOnMasterPage
= true, bool bCheckPresObjListOnly
= false, bool bCheckLayoutOnly
= false) const;
178 void SetMarkedOriginalSize();
180 bool IsMorphingAllowed() const;
181 bool IsVectorizeAllowed() const;
183 virtual SfxStyleSheet
* GetStyleSheet() const;
185 /** return parameter:
186 pExchangeList == NULL -> all names are unique
187 bNameOK == false -> cancel by user
189 nType == 1 -> objects
190 nType == 2 -> pages and objects */
192 bool GetExchangeList( std::vector
<OUString
> &rExchangeList
,
193 std::vector
<OUString
> &rBookmarkList
,
194 const sal_uInt16 nType
);
196 virtual void onAccessibilityOptionsChanged() SAL_OVERRIDE
;
198 virtual SdrModel
* GetMarkedObjModel() const SAL_OVERRIDE
;
200 const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
, SdrInsertFlags nOptions
,
201 const OUString
& rSrcShellID
, const OUString
& rDestShellID
) SAL_OVERRIDE
;
203 using SdrExchangeView::Paste
;
205 /** returns true if we have an undo manager and there is an open list undo action */
206 bool isRecordingUndo() const;
208 virtual void AddCustomHdl() SAL_OVERRIDE
;
210 SmartTagSet
& getSmartTags() { return maSmartTags
; }
211 void selectSmartTag( const SmartTagReference
& xTag
);
212 void updateHandles();
214 virtual SdrViewContext
GetContext() const SAL_OVERRIDE
;
215 virtual bool HasMarkablePoints() const SAL_OVERRIDE
;
216 virtual sal_uLong
GetMarkablePointCount() const SAL_OVERRIDE
;
217 virtual bool HasMarkedPoints() const SAL_OVERRIDE
;
218 virtual sal_uLong
GetMarkedPointCount() const SAL_OVERRIDE
;
219 virtual bool IsPointMarkable(const SdrHdl
& rHdl
) const SAL_OVERRIDE
;
220 virtual bool MarkPoint(SdrHdl
& rHdl
, bool bUnmark
=false) SAL_OVERRIDE
;
221 virtual void CheckPossibilities() SAL_OVERRIDE
;
222 virtual bool MarkPoints(const ::Rectangle
* pRect
, bool bUnmark
) SAL_OVERRIDE
;
223 using SdrMarkView::MarkPoints
;
226 const bool bBulletOnOffMode
,
227 const bool bNormalBullet
);
229 /** change the bullets/numbering of the marked objects
232 true: just toggle the current bullets/numbering on --> off resp. off --> on
234 @param bHandleBullets
236 false: handle numbering
239 numbering rule which needs to be applied. can be 0.
242 true: switch off bullets/numbering
244 void ChangeMarkedObjectsBulletsNumbering(
246 const bool bHandleBullets
,
247 const SvxNumRule
* pNumRule
,
248 const bool bSwitchOff
);
250 void SetPossibilitiesDirty() { bPossibilitiesDirty
= true; }
251 void SetMoveAllowed( bool bSet
) { bMoveAllowed
= bSet
; }
252 void SetMoveProtected( bool bSet
) { bMoveProtect
= bSet
; }
253 void SetResizeFreeAllowed( bool bSet
) { bResizeFreeAllowed
= bSet
; }
254 void SetResizePropAllowed( bool bSet
) { bResizePropAllowed
= bSet
; }
255 void SetResizeProtected( bool bSet
) { bResizeProtect
= bSet
; }
257 void SetMarkedPointsSmoothPossible( bool bSet
) { bSetMarkedPointsSmoothPossible
= bSet
; }
258 void SetMarkedSegmentsKindPossible( bool bSet
) { bSetMarkedSegmentsKindPossible
= bSet
; }
260 SdrObject
* GetEmptyPresentationObject( PresObjKind eKind
);
262 SdrObject
* GetSelectedSingleObject(SdPage
* pPage
);
265 DECL_LINK( OnParagraphInsertedHdl
, ::Outliner
* );
266 DECL_LINK( OnParagraphRemovingHdl
, ::Outliner
* );
268 virtual void OnBeginPasteOrDrop( PasteOrDropInfos
* pInfos
) SAL_OVERRIDE
;
269 virtual void OnEndPasteOrDrop( PasteOrDropInfos
* pInfos
) SAL_OVERRIDE
;
271 SdDrawDocument
& mrDoc
;
272 DrawDocShell
* mpDocSh
;
274 SdrMarkList
* mpDragSrcMarkList
;
275 SdrObject
* mpDropMarkerObj
;
276 SdrDropMarkerOverlay
* mpDropMarker
;
277 sal_uInt16 mnDragSrcPgNum
;
279 ::std::vector
<OUString
> maDropFileVector
;
281 Idle maDropErrorIdle
;
282 Idle maDropInsertFileIdle
;
283 sal_uInt16 mnLockRedrawSmph
;
284 boost::ptr_vector
<SdViewRedrawRec
> maLockedRedraws
;
285 bool mbIsDropAllowed
;
287 DECL_LINK_TYPED( DropErrorHdl
, Idle
*, void );
288 DECL_LINK_TYPED( DropInsertFileHdl
, Idle
*, void );
289 DECL_LINK( ExecuteNavigatorDrop
, SdNavigatorDropEvent
* pSdNavigatorDropEvent
);
291 void ImplClearDrawDropMarker();
293 SmartTagSet maSmartTags
;
296 ::std::unique_ptr
<ViewClipboard
> mpClipboard
;
297 OutlinerMasterViewFilter maMasterViewFilter
;
300 SdDrawDocument
& View::GetDoc() const
305 } // end of namespace sd
309 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */