LibreOffice Module sd (master) 1
OutlineView.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <memory>
23#include <vcl/image.hxx>
24#include <vcl/vclevent.hxx>
25#include <editeng/lrspitem.hxx>
26#include <o3tl/deleter.hxx>
27#include "View.hxx"
28
29class SdPage;
30class SdrPage;
31class SdrTextObj;
32class SfxProgress;
33struct PasteOrDropInfos;
34class EditView;
35
36namespace sd::tools {
37 class EventMultiplexerEvent;
38}
39
40namespace sd {
41
42class DrawDocShell;
43class OutlineViewShell;
44class OutlineViewModelChangeGuard;
45
46const int MAX_OUTLINERVIEWS = 4;
47
53class OutlineView final
54 : public ::sd::View
55{
57public:
59 vcl::Window* pWindow,
60 OutlineViewShell& rOutlineViewSh);
61 virtual ~OutlineView() override;
62
70
71
72 static SdrTextObj* GetTitleTextObject(SdrPage const * pPage);
73 static SdrTextObj* GetOutlineTextObject(SdrPage const * pPage);
74
77
78 virtual void AddDeviceToPaintView(OutputDevice& rDev, vcl::Window* pWindow) override;
79 virtual void DeleteDeviceFromPaintView(OutputDevice& rDev) override;
80
81 OutlinerView* GetViewByWindow(vcl::Window const * pWin) const;
83
84 Paragraph* GetPrevTitle(const Paragraph* pPara);
85 Paragraph* GetNextTitle(const Paragraph* pPara);
88 Paragraph* GetParagraphForPage( ::Outliner const & rOutl, SdPage const * pPage );
89
91 void SetActualPage( SdPage const * pActual );
92
93 void Paint (const ::tools::Rectangle& rRect, ::sd::Window const * pWin);
94
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 );
107
109
110 void PrepareClose();
111
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;
114
115 void FillOutliner();
116 void SetLinks();
117 void ResetLinks() const;
118
119 SfxStyleSheet* GetStyleSheet() const override;
120
121 void SetSelectedPages();
122
123 virtual sal_Int8 AcceptDrop (
124 const AcceptDropEvent& rEvt,
125 DropTargetHelper& rTargetHelper,
126 SdrLayerID nLayer) override;
127 virtual sal_Int8 ExecuteDrop (
128 const ExecuteDropEvent& rEvt,
129 ::sd::Window* pTargetWindow,
130 sal_uInt16 nPage,
131 SdrLayerID nLayer) override;
132
133 // Re-implement GetScriptType for this view to get correct results
134 virtual SvtScriptType GetScriptType() const override;
135
142 void IgnoreCurrentPageChanges (bool bIgnore);
143
146
147 void UpdateParagraph( sal_Int32 nPara );
148
149protected:
150 virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override;
151 virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override;
152
153private:
156 void BeginModelChange();
157
160 void EndModelChange();
161
164
166 void UpdateDocument();
167
170 std::unique_ptr<OutlinerView> mpOutlinerViews[MAX_OUTLINERVIEWS];
171
172 std::vector<Paragraph*> maOldParaOrder;
173 std::vector<Paragraph*> maSelectedParas;
174
175 sal_Int32 mnPagesToProcess; // for the progress bar
177
179
181
182 std::unique_ptr<SfxProgress> mpProgress;
183
188
192 void onUpdateStyleSettings( bool bForceUpdate );
193
197 DECL_LINK( AppEventListenerHdl, VclSimpleEvent&, void );
198
199 DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent&, void);
200
202 std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> maDragAndDropModelGuard;
203
206};
207
208// calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
210{
211public:
214private:
216};
217
218// calls BeginModelChange() on c'tor and EndModelChange() on d'tor
220{
221public:
223 ~OutlineViewModelChangeGuard() COVERITY_NOEXCEPT_FALSE;
224private:
226};
227
228} // end of namespace sd
229
230/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OutlineViewModelChangeGuard(OutlineView &rView)
Definition: outlview.cxx:1692
~OutlineViewModelChangeGuard() COVERITY_NOEXCEPT_FALSE
Definition: outlview.cxx:1698
OutlineViewPageChangesGuard(OutlineView *pView)
Definition: outlview.cxx:1704
Show a textual overview of the text contents of all slides.
Derivative of sd::View for the outline mode |* .
Definition: OutlineView.hxx:55
void FillOutliner()
creates outliner model from draw model
Definition: outlview.cxx:1000
SvxLRSpaceItem maLRSpaceItem
DECL_LINK(EndMovingHdl, ::Outliner *, void)
SdrOutliner & GetOutliner()
Definition: OutlineView.hxx:82
DECL_LINK(IndentingPagesHdl, OutlinerView *, bool)
void ConnectToApplication()
This method is called by the view shell that owns the view to tell the view that it can safely connec...
Definition: outlview.cxx:162
sal_Int32 mnPagesProcessed
sal_uLong GetPaperWidth() const
OutlineViewShell & mrOutlineViewShell
void BeginModelChange()
call this method before you do anything that can modify the outliner and or the drawing document mode...
Definition: outlview.cxx:1398
DECL_LINK(BeginDropHdl, EditView *, void)
DECL_LINK(PaintingFirstLineHdl, PaintFirstLineInfo *, void)
static SdrTextObj * CreateTitleTextObject(SdPage *pPage)
Definition: outlview.cxx:897
SdPage * GetPageForParagraph(Paragraph *pPara)
Definition: outlview.cxx:1157
void ResetLinks() const
Restore old links.
Definition: outlview.cxx:1291
sal_uLong mnPaperWidth
sal_Int32 mnPagesToProcess
void SetSelectedPages()
Mark pages as selected / not selected.
Definition: outlview.cxx:1230
virtual ~OutlineView() override
Destructor, restore Links, clear Outliner.
Definition: outlview.cxx:129
SdPage * InsertSlideForParagraph(Paragraph *pPara)
creates and inserts an empty slide for the given paragraph.
Definition: outlview.cxx:345
DECL_LINK(StatusEventHdl, EditStatus &, void)
void EndModelChange()
call this method after BeginModelChange(), when all possible model changes are done.
Definition: outlview.cxx:1406
void IgnoreCurrentPageChanges(bool bIgnore)
After this method has been called with <TRUE> following changes of the current page are ignored in th...
Definition: outlview.cxx:1388
virtual void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const override
Get attributes of the selected text.
Definition: outlview.cxx:990
Paragraph * GetParagraphForPage(::Outliner const &rOutl, SdPage const *pPage)
Definition: outlview.cxx:1176
Paragraph * GetPrevTitle(const Paragraph *pPara)
Return the title before a random paragraph.
Definition: outlview.cxx:281
Color maDocColor
stores the last used document color.
static SdrTextObj * CreateOutlineTextObject(SdPage *pPage)
Definition: outlview.cxx:916
OutlinerView * GetViewByWindow(vcl::Window const *pWin) const
Return a pointer to the OutlinerView corresponding to the window.
Definition: outlview.cxx:262
DECL_LINK(DepthChangedHdl, ::Outliner::DepthChangeHdlParam, void)
void PrepareClose()
updates draw model with all changes from outliner model
Definition: outlview.cxx:953
void SetActualPage(SdPage const *pActual)
selects the paragraph for the given page at the outliner view
Definition: outlview.cxx:1205
Paragraph * GetNextTitle(const Paragraph *pPara)
Return the title after a random paragraph.
Definition: outlview.cxx:303
DECL_LINK(BeginMovingHdl, ::Outliner *, void)
virtual void OnBeginPasteOrDrop(PasteOrDropInfos *pInfo) override
Definition: outlview.cxx:1624
DECL_LINK(EndDropHdl, EditView *, void)
DECL_LINK(AppEventListenerHdl, VclSimpleEvent &, void)
this link is called from the vcl application when the stylesettings change.
virtual void AddDeviceToPaintView(OutputDevice &rDev, vcl::Window *pWindow) override
Definition: outlview.cxx:196
DECL_LINK(RemovingPagesHdl, OutlinerView *, bool)
void Paint(const ::tools::Rectangle &rRect, ::sd::Window const *pWin)
Definition: outlview.cxx:181
DECL_LINK(ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void)
SfxStyleSheet * GetStyleSheet() const override
Get StyleSheet from the selection.
Definition: outlview.cxx:1219
SdPage * GetActualPage()
returns the first slide that is selected in the outliner or where the cursor is located
Definition: outlview.cxx:1135
void UpdateParagraph(sal_Int32 nPara)
Definition: outlview.cxx:1617
virtual void OnEndPasteOrDrop(PasteOrDropInfos *pInfo) override
this is called after a paste or drop operation, make sure that the newly inserted paragraphs get the ...
Definition: outlview.cxx:1630
void onUpdateStyleSettings(bool bForceUpdate)
updates the high contrast settings and document color if they changed.
Definition: outlview.cxx:1330
virtual bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false, bool bSlide=false, bool bMaster=false) override
Set attributes of the selected text.
Definition: outlview.cxx:970
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt, DropTargetHelper &rTargetHelper, SdrLayerID nLayer) override
Definition: outlview.cxx:1306
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt, ::sd::Window *pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer) override
Definition: outlview.cxx:1311
void SetLinks()
Set new links.
Definition: outlview.cxx:1270
OutlineView(DrawDocShell &rDocSh, vcl::Window *pWindow, OutlineViewShell &rOutlineViewSh)
Definition: outlview.cxx:72
static SdrTextObj * GetOutlineTextObject(SdrPage const *pPage)
Look for the outline text object in one page of the model.
Definition: outlview.cxx:879
std::unique_ptr< OutlinerView > mpOutlinerViews[MAX_OUTLINERVIEWS]
void TryToMergeUndoActions()
merge edit engine undo actions if possible
Definition: outlview.cxx:1461
virtual void DeleteDeviceFromPaintView(OutputDevice &rDev) override
Definition: outlview.cxx:233
void DisconnectFromApplication()
Definition: outlview.cxx:176
SdrOutliner & mrOutliner
std::vector< Paragraph * > maOldParaOrder
DECL_LINK(ParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void)
void UpdateDocument()
updates all changes in the outliner model to the draw model
Definition: outlview.cxx:1428
virtual SvtScriptType GetScriptType() const override
Definition: outlview.cxx:1317
std::vector< Paragraph * > maSelectedParas
std::unique_ptr< OutlineViewModelChangeGuard, o3tl::default_delete< OutlineViewModelChangeGuard > > maDragAndDropModelGuard
holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl
std::unique_ptr< SfxProgress > mpProgress
static SdrTextObj * GetTitleTextObject(SdrPage const *pPage)
Look for the title text object in one page of the model.
Definition: outlview.cxx:858
DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent &, void)
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
SvtScriptType
const int MAX_OUTLINERVIEWS
Definition: OutlineView.hxx:46
sal_uIntPtr sal_uLong
signed char sal_Int8