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
25 #include <tools/gen.hxx>
26 #include <vcl/transfer.hxx>
27 #include <svx/fmview.hxx>
28 #include <svx/svdpage.hxx>
29 #include <vcl/idle.hxx>
31 #include "smarttag.hxx"
50 //For master view we want to force that master
51 //textboxes have readonly text, because the
52 //text is the auto-generated click-here-to-edit
53 //and it doesn't help to change it
54 class OutlinerMasterViewFilter
60 OutlinerMasterViewFilter()
65 void Start(SdrOutliner
*pOutl
);
69 class SAL_DLLPUBLIC_RTTI View
: public FmFormView
74 SdDrawDocument
& rDrawDoc
,
75 OutputDevice
* pOutDev
,
76 ViewShell
* pViewSh
=nullptr);
77 virtual ~View() override
;
79 void CompleteRedraw( OutputDevice
* pOutDev
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= nullptr) override
;
81 virtual void GetAttributes( SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
= false ) const;
82 virtual bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
= false, bool bSlide
= false, bool bMaster
= false);
83 virtual void MarkListHasChanged() override
;
87 void DoPaste(::sd::Window
* pWindow
=nullptr);
88 virtual void DoConnect(SdrOle2Obj
* pOleObj
) override
;
89 virtual bool SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
= false);
90 void StartDrag( const Point
& rStartPos
, vcl::Window
* pWindow
);
91 virtual void DragFinished( sal_Int8 nDropAction
);
92 virtual sal_Int8
AcceptDrop (
93 const AcceptDropEvent
& rEvt
,
94 DropTargetHelper
& rTargetHelper
,
95 ::sd::Window
* pTargetWindow
,
98 virtual sal_Int8
ExecuteDrop (
99 const ExecuteDropEvent
& rEvt
,
100 ::sd::Window
* pTargetWindow
,
104 css::uno::Reference
<css::datatransfer::XTransferable
>
105 CreateClipboardDataObject ();
106 css::uno::Reference
<css::datatransfer::XTransferable
>
107 CreateDragDataObject (::sd::View
*, vcl::Window
& rWindow
,
108 const Point
& rDragPos
);
109 css::uno::Reference
<css::datatransfer::XTransferable
>
110 CreateSelectionDataObject (::sd::View
*, vcl::Window
& rWindow
);
112 void UpdateSelectionClipboard( bool bForceDeselect
);
114 DrawDocShell
* GetDocSh() const { return mpDocSh
; }
115 inline SdDrawDocument
& GetDoc() const;
116 ViewShell
* GetViewShell() const { return mpViewSh
; }
117 SfxViewShell
* GetSfxViewShell() const override
;
119 virtual bool SdrBeginTextEdit(SdrObject
* pObj
, SdrPageView
* pPV
= nullptr, vcl::Window
* pWin
= nullptr, bool bIsNewObj
= false,
120 SdrOutliner
* pGivenOutliner
= nullptr, OutlinerView
* pGivenOutlinerView
= nullptr,
121 bool bDontDeleteOutliner
= false, bool bOnlyOneView
= false, bool bGrabFocus
= true) override
;
123 virtual SdrEndTextEditKind
SdrEndTextEdit(bool bDontDeleteReally
= false) override
;
125 bool RestoreDefaultText( SdrTextObj
* pTextObj
);
127 bool InsertData( const TransferableDataHelper
& rDataHelper
,
128 const Point
& rPos
, sal_Int8
& rDnDAction
, bool bDrag
,
129 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
,
130 sal_uInt16 nPage
= SDRPAGE_NOTFOUND
, SdrLayerID nLayer
= SDRLAYER_NOTFOUND
);
131 /** gets the metafile from the given transferable helper and insert it as a graphic shape.
132 @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
133 present, then is inserted as a single graphic.
135 bool InsertMetaFile( TransferableDataHelper
& rDataHelper
,
136 const Point
& rInsertPos
,
137 ImageMap
const * pImageMap
, bool bOptimize
);
138 SdrGrafObj
* InsertGraphic( const Graphic
& rGraphic
,
139 sal_Int8
& rAction
, const Point
& rPos
,
140 SdrObject
* pSelectedObj
, ImageMap
const * pImageMap
);
141 void InsertMediaURL( const OUString
& rMediaURL
, sal_Int8
& rAction
,
142 const Point
& rPos
, const Size
& rSize
,
144 SdrMediaObj
* InsertMediaObj( const OUString
& rURL
, const OUString
& rMimeType
, sal_Int8
& rAction
,
145 const Point
& rPos
, const Size
& rSize
);
147 bool PasteRTFTable( const ::tools::SvRef
<SotStorageStream
>& xStm
, SdrPage
* pPage
, SdrInsertFlags nPasteOptions
);
149 bool IsPresObjSelected(bool bOnPage
= true, bool bOnMasterPage
= true, bool bCheckPresObjListOnly
= false, bool bCheckLayoutOnly
= false) const;
151 void SetMarkedOriginalSize();
153 bool IsMorphingAllowed() const;
154 bool IsVectorizeAllowed() const;
156 virtual SfxStyleSheet
* GetStyleSheet() const;
158 /** return parameter:
159 pExchangeList == NULL -> all names are unique
160 bNameOK == false -> cancel by user
162 nType == 1 -> objects
163 nType == 2 -> pages and objects */
165 bool GetExchangeList( std::vector
<OUString
> &rExchangeList
,
166 std::vector
<OUString
> &rBookmarkList
,
167 const sal_uInt16 nType
);
169 virtual void onAccessibilityOptionsChanged() override
;
171 /** returns true if we have an undo manager and there is an open list undo action */
172 bool isRecordingUndo() const;
174 virtual void AddCustomHdl() override
;
176 SmartTagSet
& getSmartTags() { return maSmartTags
; }
177 void updateHandles();
179 virtual SdrViewContext
GetContext() const override
;
180 virtual bool HasMarkablePoints() const override
;
181 virtual sal_Int32
GetMarkablePointCount() const override
;
182 virtual bool HasMarkedPoints() const override
;
183 virtual bool IsPointMarkable(const SdrHdl
& rHdl
) const override
;
184 virtual bool MarkPoint(SdrHdl
& rHdl
, bool bUnmark
=false) override
;
185 virtual void CheckPossibilities() override
;
186 virtual bool MarkPoints(const ::tools::Rectangle
* pRect
, bool bUnmark
) override
;
187 using SdrMarkView::MarkPoints
;
190 const bool bBulletOnOffMode
,
191 const bool bNormalBullet
);
193 /** change the bullets/numbering of the marked objects
196 true: just toggle the current bullets/numbering on --> off resp. off --> on
198 @param bHandleBullets
200 false: handle numbering
203 numbering rule which needs to be applied. can be 0.
205 void ChangeMarkedObjectsBulletsNumbering(
207 const bool bHandleBullets
,
208 const SvxNumRule
* pNumRule
);
210 void SetPossibilitiesDirty() { m_bPossibilitiesDirty
= true; }
211 void SetMoveAllowed( bool bSet
) { m_bMoveAllowed
= bSet
; }
212 void SetMoveProtected( bool bSet
) { m_bMoveProtect
= bSet
; }
213 void SetResizeFreeAllowed( bool bSet
) { m_bResizeFreeAllowed
= bSet
; }
214 void SetResizePropAllowed( bool bSet
) { m_bResizePropAllowed
= bSet
; }
215 void SetResizeProtected( bool bSet
) { m_bResizeProtect
= bSet
; }
217 SdrObject
* GetEmptyPresentationObject( PresObjKind eKind
);
219 SdrObject
* GetSelectedSingleObject(SdPage
const * pPage
);
220 void SetAuthor(const OUString
& rAuthor
) { m_sAuthor
= rAuthor
; }
221 const OUString
& GetAuthor() { return m_sAuthor
; }
224 DECL_LINK( OnParagraphInsertedHdl
, ::Outliner::ParagraphHdlParam
, void );
225 DECL_LINK( OnParagraphRemovingHdl
, ::Outliner::ParagraphHdlParam
, void );
227 virtual void OnBeginPasteOrDrop( PasteOrDropInfos
* pInfo
) override
;
228 virtual void OnEndPasteOrDrop( PasteOrDropInfos
* pInfo
) override
;
230 SdDrawDocument
& mrDoc
;
231 DrawDocShell
* mpDocSh
;
233 std::unique_ptr
<SdrMarkList
> mpDragSrcMarkList
;
234 SdrObject
* mpDropMarkerObj
;
235 std::unique_ptr
<SdrDropMarkerOverlay
> mpDropMarker
;
236 sal_uInt16 mnDragSrcPgNum
;
238 ::std::vector
<OUString
> maDropFileVector
;
240 Idle maDropErrorIdle
;
241 Idle maDropInsertFileIdle
;
242 sal_uInt16 mnLockRedrawSmph
;
243 bool mbIsDropAllowed
;
245 DECL_LINK( DropErrorHdl
, Timer
*, void );
246 DECL_LINK( DropInsertFileHdl
, Timer
*, void );
247 DECL_LINK( ExecuteNavigatorDrop
, void*, void );
249 void ImplClearDrawDropMarker();
251 SmartTagSet maSmartTags
;
254 ::std::unique_ptr
<ViewClipboard
> mpClipboard
;
255 OutlinerMasterViewFilter maMasterViewFilter
;
259 SdDrawDocument
& View::GetDoc() const
264 } // end of namespace sd
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */