bump product version to 6.4.0.3
[LibreOffice.git] / sd / source / ui / inc / View.hxx
blob5aba1fb326d98eb61928e18deb1692a2d0bd1110
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <memory>
24 #include <pres.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"
33 class SdDrawDocument;
34 class SdPage;
35 class SdrOle2Obj;
36 class SdrGrafObj;
37 class SdrMediaObj;
38 class OutputDevice;
39 class ImageMap;
40 class Graphic;
41 class SdrOutliner;
43 namespace sd {
45 class DrawDocShell;
46 class ViewShell;
47 class Window;
48 class ViewClipboard;
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
56 private:
57 SdrOutliner *m_pOutl;
58 bool m_bReadOnly;
59 public:
60 OutlinerMasterViewFilter()
61 : m_pOutl(nullptr)
62 , m_bReadOnly(false)
65 void Start(SdrOutliner *pOutl);
66 void End();
69 class SAL_DLLPUBLIC_RTTI View : public FmFormView
71 public:
73 View (
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;
84 void SelectAll();
85 void DoCut();
86 void DoCopy();
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 SdrLayerID nLayer);
96 virtual sal_Int8 ExecuteDrop (
97 const ExecuteDropEvent& rEvt,
98 ::sd::Window* pTargetWindow,
99 sal_uInt16 nPage,
100 SdrLayerID nLayer);
102 css::uno::Reference<css::datatransfer::XTransferable>
103 CreateClipboardDataObject ();
104 css::uno::Reference<css::datatransfer::XTransferable>
105 CreateDragDataObject (::sd::View*, vcl::Window& rWindow,
106 const Point& rDragPos);
107 css::uno::Reference<css::datatransfer::XTransferable>
108 CreateSelectionDataObject (::sd::View*, vcl::Window& rWindow);
110 void UpdateSelectionClipboard( bool bForceDeselect );
112 DrawDocShell* GetDocSh() const { return mpDocSh; }
113 inline SdDrawDocument& GetDoc() const;
114 ViewShell* GetViewShell() const { return mpViewSh; }
115 SfxViewShell* GetSfxViewShell() const override;
117 virtual bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = nullptr, vcl::Window* pWin = nullptr, bool bIsNewObj = false,
118 SdrOutliner* pGivenOutliner = nullptr, OutlinerView* pGivenOutlinerView = nullptr,
119 bool bDontDeleteOutliner = false, bool bOnlyOneView = false, bool bGrabFocus = true) override;
121 virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally = false) override;
123 bool RestoreDefaultText( SdrTextObj* pTextObj );
125 bool InsertData( const TransferableDataHelper& rDataHelper,
126 const Point& rPos, sal_Int8& rDnDAction, bool bDrag,
127 SotClipboardFormatId nFormat = SotClipboardFormatId::NONE,
128 sal_uInt16 nPage = SDRPAGE_NOTFOUND, SdrLayerID nLayer = SDRLAYER_NOTFOUND );
129 /** gets the metafile from the given transferable helper and insert it as a graphic shape.
130 @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
131 present, then is inserted as a single graphic.
133 bool InsertMetaFile( TransferableDataHelper& rDataHelper,
134 const Point& rInsertPos,
135 ImageMap const * pImageMap, bool bOptimize );
136 SdrGrafObj* InsertGraphic( const Graphic& rGraphic,
137 sal_Int8& rAction, const Point& rPos,
138 SdrObject* pSelectedObj, ImageMap const * pImageMap );
139 void InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction,
140 const Point& rPos, const Size& rSize,
141 bool const bLink );
142 SdrMediaObj* InsertMediaObj( const OUString& rURL, const OUString& rMimeType, sal_Int8& rAction,
143 const Point& rPos, const Size& rSize );
145 bool PasteRTFTable( const ::tools::SvRef<SotStorageStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions );
147 bool IsPresObjSelected(bool bOnPage = true, bool bOnMasterPage = true, bool bCheckPresObjListOnly = false, bool bCheckLayoutOnly = false) const;
149 void SetMarkedOriginalSize();
151 bool IsMorphingAllowed() const;
152 bool IsVectorizeAllowed() const;
154 virtual SfxStyleSheet* GetStyleSheet() const;
156 /** return parameter:
157 pExchangeList == NULL -> all names are unique
158 bNameOK == false -> cancel by user
159 nType == 0 -> pages
160 nType == 1 -> objects
161 nType == 2 -> pages and objects */
163 bool GetExchangeList( std::vector<OUString> &rExchangeList,
164 std::vector<OUString> &rBookmarkList,
165 const sal_uInt16 nType );
167 virtual void onAccessibilityOptionsChanged() override;
169 /** returns true if we have an undo manager and there is an open list undo action */
170 bool isRecordingUndo() const;
172 virtual void AddCustomHdl() override;
174 SmartTagSet& getSmartTags() { return maSmartTags; }
175 void updateHandles();
177 virtual SdrViewContext GetContext() const override;
178 virtual bool HasMarkablePoints() const override;
179 virtual sal_Int32 GetMarkablePointCount() const override;
180 virtual bool HasMarkedPoints() const override;
181 virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark=false) override;
182 virtual void CheckPossibilities() override;
183 virtual bool MarkPoints(const ::tools::Rectangle* pRect, bool bUnmark) override;
184 using SdrMarkView::MarkPoints;
186 bool ShouldToggleOn(
187 const bool bBulletOnOffMode,
188 const bool bNormalBullet);
190 /** change the bullets/numbering of the marked objects
192 @param bToggle
193 true: just toggle the current bullets/numbering on --> off resp. off --> on
195 @param bHandleBullets
196 true: handle bullets
197 false: handle numbering
199 @param pNumRule
200 numbering rule which needs to be applied. can be 0.
202 void ChangeMarkedObjectsBulletsNumbering(
203 const bool bToggle,
204 const bool bHandleBullets,
205 const SvxNumRule* pNumRule);
207 void SetPossibilitiesDirty() { m_bPossibilitiesDirty = true; }
208 void SetMoveAllowed( bool bSet ) { m_bMoveAllowed = bSet; }
209 void SetMoveProtected( bool bSet ) { m_bMoveProtect = bSet; }
210 void SetResizeFreeAllowed( bool bSet ) { m_bResizeFreeAllowed = bSet; }
211 void SetResizePropAllowed( bool bSet ) { m_bResizePropAllowed = bSet; }
212 void SetResizeProtected( bool bSet ) { m_bResizeProtect = bSet; }
214 SdrObject* GetEmptyPresentationObject( PresObjKind eKind );
215 SdPage* GetPage();
216 SdrObject* GetSelectedSingleObject(SdPage const * pPage);
217 void SetAuthor(const OUString& rAuthor) { m_sAuthor = rAuthor; }
218 const OUString& GetAuthor() const { return m_sAuthor; }
220 protected:
221 DECL_LINK( OnParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void );
222 DECL_LINK( OnParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void );
224 virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override;
225 virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override;
227 SdDrawDocument& mrDoc;
228 DrawDocShell* mpDocSh;
229 ViewShell* mpViewSh;
230 std::unique_ptr<SdrMarkList> mpDragSrcMarkList;
231 SdrObject* mpDropMarkerObj;
232 std::unique_ptr<SdrDropMarkerOverlay> mpDropMarker;
233 sal_uInt16 mnDragSrcPgNum;
234 Point maDropPos;
235 ::std::vector<OUString> maDropFileVector;
236 sal_Int8 mnAction;
237 Idle maDropErrorIdle;
238 Idle maDropInsertFileIdle;
239 sal_uInt16 mnLockRedrawSmph;
240 bool mbIsDropAllowed;
242 DECL_LINK( DropErrorHdl, Timer*, void );
243 DECL_LINK( DropInsertFileHdl, Timer*, void );
244 DECL_LINK( ExecuteNavigatorDrop, void*, void );
246 void ImplClearDrawDropMarker();
248 SmartTagSet maSmartTags;
250 private:
251 ::std::unique_ptr<ViewClipboard> mpClipboard;
252 OutlinerMasterViewFilter maMasterViewFilter;
253 OUString m_sAuthor;
256 SdDrawDocument& View::GetDoc() const
258 return mrDoc;
261 } // end of namespace sd
263 #endif
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */