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 .
24 #include <tools/gen.hxx>
25 #include <vcl/transfer.hxx>
26 #include <svx/fmview.hxx>
27 #include <svx/svdpage.hxx>
28 #include <vcl/idle.hxx>
30 #include "smarttag.hxx"
31 #include "fusearch.hxx"
43 namespace avmedia
{ class PlayerListener
; }
52 //For master view we want to force that master
53 //textboxes have readonly text, because the
54 //text is the auto-generated click-here-to-edit
55 //and it doesn't help to change it
56 class OutlinerMasterViewFilter
62 OutlinerMasterViewFilter()
67 void Start(SdrOutliner
*pOutl
);
74 rtl::Reference
<FuSearch
> maFunctionSearch
;
77 rtl::Reference
<FuSearch
>& getFunctionSearch()
79 return maFunctionSearch
;
82 void setSearchFunction(rtl::Reference
<FuSearch
> const & xFunction
)
84 resetSearchFunction();
85 maFunctionSearch
= xFunction
;
88 void resetSearchFunction()
90 if (maFunctionSearch
.is())
91 maFunctionSearch
->Dispose();
95 class SAL_DLLPUBLIC_RTTI View
: public FmFormView
100 SdDrawDocument
& rDrawDoc
,
101 OutputDevice
* pOutDev
,
102 ViewShell
* pViewSh
=nullptr);
103 virtual ~View() override
;
105 void CompleteRedraw( OutputDevice
* pOutDev
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= nullptr) override
;
107 virtual void GetAttributes( SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
= false ) const;
108 virtual bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
= false, bool bSlide
= false, bool bMaster
= false);
109 virtual void MarkListHasChanged() override
;
113 void DoPaste(::sd::Window
* pWindow
=nullptr);
114 virtual void DoConnect(SdrOle2Obj
* pOleObj
) override
;
115 virtual bool SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
= false);
116 void StartDrag( const Point
& rStartPos
, vcl::Window
* pWindow
);
117 virtual void DragFinished( sal_Int8 nDropAction
);
118 virtual sal_Int8
AcceptDrop (
119 const AcceptDropEvent
& rEvt
,
120 DropTargetHelper
& rTargetHelper
,
122 virtual sal_Int8
ExecuteDrop (
123 const ExecuteDropEvent
& rEvt
,
124 ::sd::Window
* pTargetWindow
,
128 css::uno::Reference
<css::datatransfer::XTransferable
>
129 CreateClipboardDataObject ();
130 css::uno::Reference
<css::datatransfer::XTransferable
>
131 CreateDragDataObject (::sd::View
*, vcl::Window
& rWindow
,
132 const Point
& rDragPos
);
133 css::uno::Reference
<css::datatransfer::XTransferable
>
134 CreateSelectionDataObject (::sd::View
*);
136 // update clipboard to what is selected
137 void UpdateSelectionClipboard();
139 // release content of clipboard, if we own the content
140 void ClearSelectionClipboard();
142 DrawDocShell
* GetDocSh() const { return mpDocSh
; }
143 inline SdDrawDocument
& GetDoc() const;
144 ViewShell
* GetViewShell() const { return mpViewSh
; }
145 SfxViewShell
* GetSfxViewShell() const override
;
147 // Create a local UndoManager
148 std::unique_ptr
<SdrUndoManager
> createLocalTextUndoManager() override
;
150 virtual bool SdrBeginTextEdit(SdrObject
* pObj
, SdrPageView
* pPV
= nullptr, vcl::Window
* pWin
= nullptr, bool bIsNewObj
= false,
151 SdrOutliner
* pGivenOutliner
= nullptr, OutlinerView
* pGivenOutlinerView
= nullptr,
152 bool bDontDeleteOutliner
= false, bool bOnlyOneView
= false, bool bGrabFocus
= true) override
;
154 virtual SdrEndTextEditKind
SdrEndTextEdit(bool bDontDeleteReally
= false) override
;
156 bool RestoreDefaultText( SdrTextObj
* pTextObj
);
158 bool InsertData( const TransferableDataHelper
& rDataHelper
,
159 const Point
& rPos
, sal_Int8
& rDnDAction
, bool bDrag
,
160 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
,
161 sal_uInt16 nPage
= SDRPAGE_NOTFOUND
, SdrLayerID nLayer
= SDRLAYER_NOTFOUND
);
162 /** gets the metafile from the given transferable helper and insert it as a graphic shape.
163 @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
164 present, then is inserted as a single graphic.
166 bool InsertMetaFile( const TransferableDataHelper
& rDataHelper
,
167 const Point
& rInsertPos
,
168 ImageMap
const * pImageMap
, bool bOptimize
);
169 SdrGrafObj
* InsertGraphic( const Graphic
& rGraphic
,
170 sal_Int8
& rAction
, const Point
& rPos
,
171 SdrObject
* pSelectedObj
, ImageMap
const * pImageMap
);
172 void InsertMediaURL( const OUString
& rMediaURL
, sal_Int8
& rAction
,
173 const Point
& rPos
, const Size
& rSize
,
175 SdrMediaObj
* InsertMediaObj(const OUString
& rURL
, sal_Int8
& rAction
,
176 const Point
& rPos
, const Size
& rSize
);
178 bool PasteRTFTable( const ::tools::SvRef
<SotTempStream
>& xStm
, SdrPage
* pPage
, SdrInsertFlags nPasteOptions
);
180 bool IsPresObjSelected(bool bOnPage
= true, bool bOnMasterPage
= true, bool bCheckPresObjListOnly
= false, bool bCheckLayoutOnly
= false) const;
182 void SetMarkedOriginalSize();
184 bool IsMorphingAllowed() const;
185 bool IsVectorizeAllowed() const;
187 virtual SfxStyleSheet
* GetStyleSheet() const;
189 /** return parameter:
190 pExchangeList == NULL -> all names are unique
191 bNameOK == false -> cancel by user
193 nType == 1 -> objects
194 nType == 2 -> pages and objects */
196 bool GetExchangeList( std::vector
<OUString
> &rExchangeList
,
197 std::vector
<OUString
> &rBookmarkList
,
198 const sal_uInt16 nType
);
200 virtual void onAccessibilityOptionsChanged() override
;
202 /** returns true if we have an undo manager and there is an open list undo action */
203 bool isRecordingUndo() const;
205 virtual void AddCustomHdl() override
;
207 SmartTagSet
& getSmartTags() { return maSmartTags
; }
208 void updateHandles();
210 virtual SdrViewContext
GetContext() const override
;
211 virtual bool HasMarkablePoints() const override
;
212 virtual sal_Int32
GetMarkablePointCount() const override
;
213 virtual bool HasMarkedPoints() const override
;
214 virtual bool MarkPoint(SdrHdl
& rHdl
, bool bUnmark
=false) override
;
215 virtual void CheckPossibilities() override
;
216 virtual bool MarkPoints(const ::tools::Rectangle
* pRect
, bool bUnmark
) override
;
217 using SdrMarkView::MarkPoints
;
220 const bool bBulletOnOffMode
,
221 const bool bNormalBullet
);
223 /** change the bullets/numbering of the marked objects
226 true: just toggle the current bullets/numbering on --> off resp. off --> on
228 @param bHandleBullets
230 false: handle numbering
233 numbering rule which needs to be applied. can be 0.
235 void ChangeMarkedObjectsBulletsNumbering(
237 const bool bHandleBullets
,
238 const SvxNumRule
* pNumRule
);
240 void SetPossibilitiesDirty() { m_bPossibilitiesDirty
= true; }
241 void SetMoveAllowed( bool bSet
) { m_bMoveAllowed
= bSet
; }
242 void SetMoveProtected( bool bSet
) { m_bMoveProtect
= bSet
; }
243 void SetResizeFreeAllowed( bool bSet
) { m_bResizeFreeAllowed
= bSet
; }
244 void SetResizePropAllowed( bool bSet
) { m_bResizePropAllowed
= bSet
; }
245 void SetResizeProtected( bool bSet
) { m_bResizeProtect
= bSet
; }
247 SdrObject
* GetEmptyPresentationObject( PresObjKind eKind
);
249 SdrObject
* GetSelectedSingleObject(SdPage
const * pPage
);
250 void SetAuthor(const OUString
& rAuthor
) { m_sAuthor
= rAuthor
; }
251 const OUString
& GetAuthor() const { return m_sAuthor
; }
253 SearchContext
& getSearchContext() { return maSearchContext
; }
255 DECL_DLLPRIVATE_LINK( OnParagraphInsertedHdl
, ::Outliner::ParagraphHdlParam
, void );
256 DECL_DLLPRIVATE_LINK( OnParagraphRemovingHdl
, ::Outliner::ParagraphHdlParam
, void );
258 virtual void OnBeginPasteOrDrop( PasteOrDropInfos
* pInfo
) override
;
259 virtual void OnEndPasteOrDrop( PasteOrDropInfos
* pInfo
) override
;
261 SdDrawDocument
& mrDoc
;
262 DrawDocShell
* mpDocSh
;
264 std::unique_ptr
<SdrMarkList
> mpDragSrcMarkList
;
265 SdrObject
* mpDropMarkerObj
;
266 std::unique_ptr
<SdrDropMarkerOverlay
> mpDropMarker
;
267 sal_uInt16 mnDragSrcPgNum
;
269 ::std::vector
<OUString
> maDropFileVector
;
271 Idle maDropErrorIdle
;
272 Idle maDropInsertFileIdle
;
273 rtl::Reference
<avmedia::PlayerListener
> mxDropMediaSizeListener
;
274 sal_uInt16 mnLockRedrawSmph
;
275 bool mbIsDropAllowed
;
277 DECL_DLLPRIVATE_LINK( DropErrorHdl
, Timer
*, void );
278 DECL_DLLPRIVATE_LINK( DropInsertFileHdl
, Timer
*, void );
279 DECL_DLLPRIVATE_LINK( ExecuteNavigatorDrop
, void*, void );
281 void ImplClearDrawDropMarker();
283 SmartTagSet maSmartTags
;
286 ::std::unique_ptr
<ViewClipboard
> mpClipboard
;
287 OutlinerMasterViewFilter maMasterViewFilter
;
288 SearchContext maSearchContext
;
293 SdDrawDocument
& View::GetDoc() const
298 } // end of namespace sd
300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */