Line data Source code
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 : #ifndef INCLUDED_SD_SOURCE_UI_INC_OUTLINEVIEW_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_OUTLINEVIEW_HXX
22 :
23 : #include <vcl/image.hxx>
24 : #include <editeng/lrspitem.hxx>
25 : #include "View.hxx"
26 :
27 : class SdPage;
28 : class SdrPage;
29 : class Paragraph;
30 : class SdrTextObj;
31 : class Outliner;
32 : class SfxProgress;
33 : struct PaintFirstLineInfo;
34 : struct PasteOrDropInfos;
35 :
36 : namespace sd { namespace tools {
37 : class EventMultiplexerEvent;
38 : } }
39 :
40 : namespace sd {
41 :
42 : class DrawDocShell;
43 : class OutlineViewShell;
44 : class OutlineViewModelChangeGuard;
45 : class DrawDocShell;
46 :
47 : static const int MAX_OUTLINERVIEWS = 4;
48 :
49 : /**
50 : * Derivative of ::sd::View for the outline mode
51 : |*
52 : \************************************************************************/
53 :
54 : class OutlineView
55 : : public ::sd::View
56 : {
57 : friend class OutlineViewModelChangeGuard;
58 : public:
59 : OutlineView (DrawDocShell& rDocSh,
60 : ::Window* pWindow,
61 : OutlineViewShell& rOutlineViewSh);
62 : virtual ~OutlineView (void);
63 :
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.
68 : */
69 : void ConnectToApplication (void);
70 : void DisconnectFromApplication (void);
71 :
72 : TYPEINFO_OVERRIDE();
73 :
74 : SdrTextObj* GetTitleTextObject(SdrPage* pPage);
75 : SdrTextObj* GetOutlineTextObject(SdrPage* pPage);
76 :
77 : SdrTextObj* CreateTitleTextObject(SdPage* pPage);
78 : SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
79 :
80 : virtual void AddWindowToPaintView(OutputDevice* pWin) SAL_OVERRIDE;
81 : virtual void DeleteWindowFromPaintView(OutputDevice* pWin) SAL_OVERRIDE;
82 :
83 : OutlinerView* GetViewByWindow (::Window* pWin) const;
84 0 : SdrOutliner* GetOutliner() { return(&mrOutliner) ; }
85 :
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 );
91 :
92 : /** selects the paragraph for the given page at the outliner view*/
93 : void SetActualPage( SdPage* pActual );
94 :
95 : virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
96 : virtual void AdjustPosSizePixel(
97 : const Point &rPos,
98 : const Size &rSize,
99 : ::sd::Window* pWindow);
100 :
101 : // Callbacks fuer LINKs
102 : DECL_LINK( ParagraphInsertedHdl, Outliner * );
103 : DECL_LINK( ParagraphRemovingHdl, Outliner * );
104 : DECL_LINK( DepthChangedHdl, Outliner * );
105 : DECL_LINK( StatusEventHdl, void * );
106 : DECL_LINK( BeginMovingHdl, Outliner * );
107 : DECL_LINK( EndMovingHdl, Outliner * );
108 : DECL_LINK(RemovingPagesHdl, void *);
109 : DECL_LINK( IndentingPagesHdl, OutlinerView * );
110 : DECL_LINK( BeginDropHdl, void * );
111 : DECL_LINK( EndDropHdl, void * );
112 : DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* );
113 :
114 : sal_uLong GetPaperWidth();
115 :
116 : sal_Bool PrepareClose(sal_Bool bUI = sal_True);
117 :
118 : virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const SAL_OVERRIDE;
119 : virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False) SAL_OVERRIDE;
120 :
121 : void FillOutliner();
122 : void SetLinks();
123 : void ResetLinks() const;
124 :
125 : SfxStyleSheet* GetStyleSheet() const SAL_OVERRIDE;
126 :
127 : void SetSelectedPages();
128 :
129 : virtual sal_Int8 AcceptDrop (
130 : const AcceptDropEvent& rEvt,
131 : DropTargetHelper& rTargetHelper,
132 : ::sd::Window* pTargetWindow = NULL,
133 : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
134 : sal_uInt16 nLayer = SDRPAGE_NOTFOUND) SAL_OVERRIDE;
135 : virtual sal_Int8 ExecuteDrop (
136 : const ExecuteDropEvent& rEvt,
137 : DropTargetHelper& rTargetHelper,
138 : ::sd::Window* pTargetWindow = NULL,
139 : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
140 : sal_uInt16 nLayer = SDRPAGE_NOTFOUND) SAL_OVERRIDE;
141 :
142 :
143 : // Re-implement GetScriptType for this view to get correct results
144 : virtual sal_uInt16 GetScriptType() const SAL_OVERRIDE;
145 :
146 : /** After this method has been called with <TRUE/> following changes of
147 : the current page are ignored in that the corresponding text is not
148 : selected.
149 : This is used to supress unwanted side effects between selection and
150 : cursor position.
151 : */
152 : void IgnoreCurrentPageChanges (bool bIgnore);
153 : void InvalidateSlideNumberArea();
154 :
155 : /** creates and inserts an empty slide for the given paragraph. */
156 : SdPage* InsertSlideForParagraph( Paragraph* pPara );
157 :
158 : void UpdateParagraph( sal_Int32 nPara );
159 :
160 : protected:
161 : virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE;
162 : virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE;
163 :
164 : private:
165 : /** call this method before you do anything that can modify the outliner
166 : and or the drawing document model. It will create needed undo actions */
167 : void BeginModelChange();
168 :
169 : /** call this method after BeginModelChange(), when all possible model
170 : changes are done. */
171 : void EndModelChange();
172 :
173 : /** merge edit engine undo actions if possible */
174 : void TryToMergeUndoActions();
175 :
176 : /** updates all changes in the outliner model to the draw model */
177 : void UpdateDocument();
178 :
179 : OutlineViewShell& mrOutlineViewShell;
180 : SdrOutliner& mrOutliner;
181 : OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
182 :
183 : std::vector<Paragraph*> maOldParaOrder;
184 : std::vector<Paragraph*> maSelectedParas;
185 :
186 : sal_Int32 mnPagesToProcess; // for the progress bar
187 : sal_Int32 mnPagesProcessed;
188 :
189 : sal_Bool mbFirstPaint;
190 :
191 : sal_uLong mnPaperWidth;
192 :
193 : SfxProgress* mpProgress;
194 :
195 : /** stores the last used document color.
196 : this is changed in onUpdateStyleSettings()
197 : */
198 : Color maDocColor;
199 :
200 : /** updates the high contrast settings and document color if they changed.
201 : @param bForceUpdate forces the method to set all style settings
202 : */
203 : void onUpdateStyleSettings( bool bForceUpdate = false );
204 :
205 : /** this link is called from the vcl applicaten when the stylesettings
206 : change. Its only purpose is to call onUpdateStyleSettings() then.
207 : */
208 : DECL_LINK( AppEventListenerHdl, void * );
209 :
210 : DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent*);
211 :
212 : /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
213 : std::auto_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard;
214 :
215 : Font maPageNumberFont;
216 : Font maBulletFont;
217 :
218 : SvxLRSpaceItem maLRSpaceItem;
219 : Image maSlideImage;
220 : };
221 :
222 : // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
223 : class OutlineViewPageChangesGuard
224 : {
225 : public:
226 : OutlineViewPageChangesGuard( OutlineView* pView );
227 : ~OutlineViewPageChangesGuard();
228 : private:
229 : OutlineView* mpView;
230 : };
231 :
232 : // calls BeginModelChange() on c'tor and EndModelChange() on d'tor
233 : class OutlineViewModelChangeGuard
234 : {
235 : public:
236 : OutlineViewModelChangeGuard( OutlineView& rView );
237 : ~OutlineViewModelChangeGuard();
238 : private:
239 : OutlineView& mrView;
240 : };
241 :
242 : } // end of namespace sd
243 :
244 : #endif
245 :
246 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|