bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / OutlineView.hxx
blob6d2b1a06243f9adbc09e04f455985d7d207b02f7
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 <vcl/image.hxx>
24 #include <editeng/lrspitem.hxx>
25 #include "View.hxx"
27 class SdPage;
28 class SdrPage;
29 class Paragraph;
30 class SdrTextObj;
31 class Outliner;
32 class SfxProgress;
33 struct PaintFirstLineInfo;
34 struct PasteOrDropInfos;
36 namespace sd { namespace tools {
37 class EventMultiplexerEvent;
38 } }
40 namespace sd {
42 class DrawDocShell;
43 class OutlineViewShell;
44 class OutlineViewModelChangeGuard;
45 class DrawDocShell;
47 static const int MAX_OUTLINERVIEWS = 4;
49 /**
50 * Derivative of ::sd::View for the outline mode
52 \************************************************************************/
54 class OutlineView
55 : public ::sd::View
57 friend class OutlineViewModelChangeGuard;
58 public:
59 OutlineView (DrawDocShell& rDocSh,
60 vcl::Window* pWindow,
61 OutlineViewShell& rOutlineViewSh);
62 virtual ~OutlineView();
64 /** This method is called by the view shell that owns the view to tell
65 the view that it can safely connect to the application.
66 This method must not be called before the view shell is on the shell
67 stack.
69 void ConnectToApplication();
70 void DisconnectFromApplication();
72 TYPEINFO_OVERRIDE();
74 static SdrTextObj* GetTitleTextObject(SdrPage* pPage);
75 static SdrTextObj* GetOutlineTextObject(SdrPage* pPage);
77 static SdrTextObj* CreateTitleTextObject(SdPage* pPage);
78 static SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
80 virtual void AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow) SAL_OVERRIDE;
81 virtual void DeleteWindowFromPaintView(OutputDevice* pWin) SAL_OVERRIDE;
83 OutlinerView* GetViewByWindow(vcl::Window* pWin) const;
84 SdrOutliner& GetOutliner() { return mrOutliner; }
86 Paragraph* GetPrevTitle(const Paragraph* pPara);
87 Paragraph* GetNextTitle(const Paragraph* pPara);
88 SdPage* GetActualPage();
89 SdPage* GetPageForParagraph( Paragraph* pPara );
90 Paragraph* GetParagraphForPage( ::Outliner& rOutl, SdPage* pPage );
92 /** selects the paragraph for the given page at the outliner view*/
93 void SetActualPage( SdPage* pActual );
95 void Paint (const Rectangle& rRect, ::sd::Window* pWin);
97 // Callbacks fuer LINKs
98 DECL_LINK( ParagraphInsertedHdl, Outliner * );
99 DECL_LINK( ParagraphRemovingHdl, Outliner * );
100 DECL_LINK( DepthChangedHdl, Outliner * );
101 DECL_LINK( StatusEventHdl, void * );
102 DECL_LINK( BeginMovingHdl, Outliner * );
103 DECL_LINK( EndMovingHdl, Outliner * );
104 DECL_LINK(RemovingPagesHdl, void *);
105 DECL_LINK( IndentingPagesHdl, OutlinerView * );
106 DECL_LINK( BeginDropHdl, void * );
107 DECL_LINK( EndDropHdl, void * );
108 DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* );
110 sal_uLong GetPaperWidth() { return mnPaperWidth;}
112 bool PrepareClose(bool bUI = true);
114 virtual bool GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const SAL_OVERRIDE;
115 virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false) SAL_OVERRIDE;
117 void FillOutliner();
118 void SetLinks();
119 void ResetLinks() const;
121 SfxStyleSheet* GetStyleSheet() const SAL_OVERRIDE;
123 void SetSelectedPages();
125 virtual sal_Int8 AcceptDrop (
126 const AcceptDropEvent& rEvt,
127 DropTargetHelper& rTargetHelper,
128 ::sd::Window* pTargetWindow = NULL,
129 sal_uInt16 nPage = SDRPAGE_NOTFOUND,
130 sal_uInt16 nLayer = SDRPAGE_NOTFOUND) SAL_OVERRIDE;
131 virtual sal_Int8 ExecuteDrop (
132 const ExecuteDropEvent& rEvt,
133 DropTargetHelper& rTargetHelper,
134 ::sd::Window* pTargetWindow = NULL,
135 sal_uInt16 nPage = SDRPAGE_NOTFOUND,
136 sal_uInt16 nLayer = SDRPAGE_NOTFOUND) SAL_OVERRIDE;
138 // Re-implement GetScriptType for this view to get correct results
139 virtual SvtScriptType GetScriptType() const SAL_OVERRIDE;
141 /** After this method has been called with <TRUE/> following changes of
142 the current page are ignored in that the corresponding text is not
143 selected.
144 This is used to suppress unwanted side effects between selection and
145 cursor position.
147 void IgnoreCurrentPageChanges (bool bIgnore);
149 /** creates and inserts an empty slide for the given paragraph. */
150 SdPage* InsertSlideForParagraph( Paragraph* pPara );
152 void UpdateParagraph( sal_Int32 nPara );
154 protected:
155 virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE;
156 virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE;
158 private:
159 /** call this method before you do anything that can modify the outliner
160 and or the drawing document model. It will create needed undo actions */
161 void BeginModelChange();
163 /** call this method after BeginModelChange(), when all possible model
164 changes are done. */
165 void EndModelChange();
167 /** merge edit engine undo actions if possible */
168 void TryToMergeUndoActions();
170 /** updates all changes in the outliner model to the draw model */
171 void UpdateDocument();
173 OutlineViewShell& mrOutlineViewShell;
174 SdrOutliner& mrOutliner;
175 OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
177 std::vector<Paragraph*> maOldParaOrder;
178 std::vector<Paragraph*> maSelectedParas;
180 sal_Int32 mnPagesToProcess; // for the progress bar
181 sal_Int32 mnPagesProcessed;
183 bool mbFirstPaint;
185 sal_uLong mnPaperWidth;
187 SfxProgress* mpProgress;
189 /** stores the last used document color.
190 this is changed in onUpdateStyleSettings()
192 Color maDocColor;
194 /** updates the high contrast settings and document color if they changed.
195 @param bForceUpdate forces the method to set all style settings
197 void onUpdateStyleSettings( bool bForceUpdate = false );
199 /** this link is called from the vcl applicaten when the stylesettings
200 change. Its only purpose is to call onUpdateStyleSettings() then.
202 DECL_LINK( AppEventListenerHdl, void * );
204 DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent*);
206 /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
207 std::unique_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard;
209 vcl::Font maPageNumberFont;
210 vcl::Font maBulletFont;
212 SvxLRSpaceItem maLRSpaceItem;
213 Image maSlideImage;
216 // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
217 class OutlineViewPageChangesGuard
219 public:
220 OutlineViewPageChangesGuard( OutlineView* pView );
221 ~OutlineViewPageChangesGuard();
222 private:
223 OutlineView* mpView;
226 // calls BeginModelChange() on c'tor and EndModelChange() on d'tor
227 class OutlineViewModelChangeGuard
229 public:
230 OutlineViewModelChangeGuard( OutlineView& rView );
231 ~OutlineViewModelChangeGuard();
232 private:
233 OutlineView& mrView;
236 } // end of namespace sd
238 #endif
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */