bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / OutlineView.hxx
blobc9151846efcf897ca87d389e2ddb407aa1cae6df
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_OUTLINEVIEW_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_OUTLINEVIEW_HXX
23 #include <memory>
24 #include <vcl/image.hxx>
25 #include <editeng/lrspitem.hxx>
26 #include <o3tl/deleter.hxx>
27 #include "View.hxx"
29 class SdPage;
30 class SdrPage;
31 class SdrTextObj;
32 class SfxProgress;
33 struct PasteOrDropInfos;
34 class EditView;
36 namespace sd { namespace tools {
37 class EventMultiplexerEvent;
38 } }
40 namespace sd {
42 class DrawDocShell;
43 class OutlineViewShell;
44 class OutlineViewModelChangeGuard;
46 static const int MAX_OUTLINERVIEWS = 4;
48 /**
49 * Derivative of ::sd::View for the outline mode
51 \************************************************************************/
53 class OutlineView
54 : public ::sd::View
56 friend class OutlineViewModelChangeGuard;
57 public:
58 OutlineView (DrawDocShell& rDocSh,
59 vcl::Window* pWindow,
60 OutlineViewShell& rOutlineViewSh);
61 virtual ~OutlineView() override;
63 /** This method is called by the view shell that owns the view to tell
64 the view that it can safely connect to the application.
65 This method must not be called before the view shell is on the shell
66 stack.
68 void ConnectToApplication();
69 void DisconnectFromApplication();
72 static SdrTextObj* GetTitleTextObject(SdrPage const * pPage);
73 static SdrTextObj* GetOutlineTextObject(SdrPage const * pPage);
75 static SdrTextObj* CreateTitleTextObject(SdPage* pPage);
76 static SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
78 virtual void AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow) override;
79 virtual void DeleteWindowFromPaintView(OutputDevice* pWin) override;
81 OutlinerView* GetViewByWindow(vcl::Window const * pWin) const;
82 SdrOutliner& GetOutliner() { return mrOutliner; }
84 Paragraph* GetPrevTitle(const Paragraph* pPara);
85 Paragraph* GetNextTitle(const Paragraph* pPara);
86 SdPage* GetActualPage();
87 SdPage* GetPageForParagraph( Paragraph* pPara );
88 Paragraph* GetParagraphForPage( ::Outliner const & rOutl, SdPage const * pPage );
90 /** selects the paragraph for the given page at the outliner view*/
91 void SetActualPage( SdPage const * pActual );
93 void Paint (const ::tools::Rectangle& rRect, ::sd::Window const * pWin);
95 // Callbacks for LINKs
96 DECL_LINK( ParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void );
97 DECL_LINK( ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void );
98 DECL_LINK( DepthChangedHdl, ::Outliner::DepthChangeHdlParam, void );
99 DECL_LINK( StatusEventHdl, EditStatus&, void );
100 DECL_LINK( BeginMovingHdl, ::Outliner *, void );
101 DECL_LINK( EndMovingHdl, ::Outliner *, void );
102 DECL_LINK( RemovingPagesHdl, OutlinerView *, bool );
103 DECL_LINK( IndentingPagesHdl, OutlinerView *, bool );
104 DECL_LINK( BeginDropHdl, EditView*, void );
105 DECL_LINK( EndDropHdl, EditView*, void );
106 DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo*, void );
108 sal_uLong GetPaperWidth() { return mnPaperWidth;}
110 void PrepareClose();
112 virtual void GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const override;
113 virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false, bool bSlide = false, bool bMaster = false) override;
115 void FillOutliner();
116 void SetLinks();
117 void ResetLinks() const;
119 SfxStyleSheet* GetStyleSheet() const override;
121 void SetSelectedPages();
123 virtual sal_Int8 AcceptDrop (
124 const AcceptDropEvent& rEvt,
125 DropTargetHelper& rTargetHelper,
126 ::sd::Window* pTargetWindow,
127 sal_uInt16 nPage,
128 SdrLayerID nLayer) override;
129 virtual sal_Int8 ExecuteDrop (
130 const ExecuteDropEvent& rEvt,
131 ::sd::Window* pTargetWindow,
132 sal_uInt16 nPage,
133 SdrLayerID nLayer) override;
135 // Re-implement GetScriptType for this view to get correct results
136 virtual SvtScriptType GetScriptType() const override;
138 /** After this method has been called with <TRUE/> following changes of
139 the current page are ignored in that the corresponding text is not
140 selected.
141 This is used to suppress unwanted side effects between selection and
142 cursor position.
144 void IgnoreCurrentPageChanges (bool bIgnore);
146 /** creates and inserts an empty slide for the given paragraph. */
147 SdPage* InsertSlideForParagraph( Paragraph* pPara );
149 void UpdateParagraph( sal_Int32 nPara );
151 protected:
152 virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override;
153 virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override;
155 private:
156 /** call this method before you do anything that can modify the outliner
157 and or the drawing document model. It will create needed undo actions */
158 void BeginModelChange();
160 /** call this method after BeginModelChange(), when all possible model
161 changes are done. */
162 void EndModelChange();
164 /** merge edit engine undo actions if possible */
165 void TryToMergeUndoActions();
167 /** updates all changes in the outliner model to the draw model */
168 void UpdateDocument();
170 OutlineViewShell& mrOutlineViewShell;
171 SdrOutliner& mrOutliner;
172 std::unique_ptr<OutlinerView> mpOutlinerViews[MAX_OUTLINERVIEWS];
174 std::vector<Paragraph*> maOldParaOrder;
175 std::vector<Paragraph*> maSelectedParas;
177 sal_Int32 mnPagesToProcess; // for the progress bar
178 sal_Int32 mnPagesProcessed;
180 bool mbFirstPaint;
182 sal_uLong mnPaperWidth;
184 std::unique_ptr<SfxProgress> mpProgress;
186 /** stores the last used document color.
187 this is changed in onUpdateStyleSettings()
189 Color maDocColor;
191 /** updates the high contrast settings and document color if they changed.
192 @param bForceUpdate forces the method to set all style settings
194 void onUpdateStyleSettings( bool bForceUpdate );
196 /** this link is called from the vcl application when the stylesettings
197 change. Its only purpose is to call onUpdateStyleSettings() then.
199 DECL_LINK( AppEventListenerHdl, VclSimpleEvent&, void );
201 DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent&, void);
203 /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
204 std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> maDragAndDropModelGuard;
206 SvxLRSpaceItem const maLRSpaceItem;
207 Image maSlideImage;
210 // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
211 class OutlineViewPageChangesGuard
213 public:
214 OutlineViewPageChangesGuard( OutlineView* pView );
215 ~OutlineViewPageChangesGuard();
216 private:
217 OutlineView* mpView;
220 // calls BeginModelChange() on c'tor and EndModelChange() on d'tor
221 class OutlineViewModelChangeGuard
223 public:
224 OutlineViewModelChangeGuard( OutlineView& rView );
225 ~OutlineViewModelChangeGuard() COVERITY_NOEXCEPT_FALSE;
226 private:
227 OutlineView& mrView;
230 } // end of namespace sd
232 #endif
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */