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