Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SD_OUTLINE_VIEW_HXX
30 : : #define SD_OUTLINE_VIEW_HXX
31 : :
32 : : #include <vcl/image.hxx>
33 : : #include <editeng/lrspitem.hxx>
34 : : #include "View.hxx"
35 : :
36 : : class SdPage;
37 : : class SdrPage;
38 : : class Paragraph;
39 : : class SdrTextObj;
40 : : class Outliner;
41 : : class SfxProgress;
42 : : struct PaintFirstLineInfo;
43 : : struct PasteOrDropInfos;
44 : :
45 : : namespace sd { namespace tools {
46 : : class EventMultiplexerEvent;
47 : : } }
48 : :
49 : : namespace sd {
50 : :
51 : : class DrawDocShell;
52 : : class OutlineViewShell;
53 : : class OutlineViewModelChangeGuard;
54 : : class DrawDocShell;
55 : :
56 : : static const int MAX_OUTLINERVIEWS = 4;
57 : :
58 : : /*************************************************************************
59 : : |*
60 : : |* Ableitung von ::sd::View fuer den Outline-Modus
61 : : |*
62 : : \************************************************************************/
63 : :
64 : : class OutlineView
65 : : : public ::sd::View
66 : : {
67 : : friend class OutlineViewModelChangeGuard;
68 : : public:
69 : : OutlineView (DrawDocShell& rDocSh,
70 : : ::Window* pWindow,
71 : : OutlineViewShell& rOutlineViewSh);
72 : : ~OutlineView (void);
73 : :
74 : : /** This method is called by the view shell that owns the view to tell
75 : : the view that it can safely connect to the application.
76 : : This method must not be called before the view shell is on the shell
77 : : stack.
78 : : */
79 : : void ConnectToApplication (void);
80 : : void DisconnectFromApplication (void);
81 : :
82 : : TYPEINFO();
83 : :
84 : : SdrTextObj* GetTitleTextObject(SdrPage* pPage);
85 : : SdrTextObj* GetOutlineTextObject(SdrPage* pPage);
86 : :
87 : : SdrTextObj* CreateTitleTextObject(SdPage* pPage);
88 : : SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
89 : :
90 : : virtual void AddWindowToPaintView(OutputDevice* pWin);
91 : : virtual void DeleteWindowFromPaintView(OutputDevice* pWin);
92 : :
93 : : OutlinerView* GetViewByWindow (::Window* pWin) const;
94 : 0 : SdrOutliner* GetOutliner() { return(&mrOutliner) ; }
95 : :
96 : : Paragraph* GetPrevTitle(const Paragraph* pPara);
97 : : Paragraph* GetNextTitle(const Paragraph* pPara);
98 : : SdPage* GetActualPage();
99 : : SdPage* GetPageForParagraph( Paragraph* pPara );
100 : : Paragraph* GetParagraphForPage( ::Outliner& rOutl, SdPage* pPage );
101 : :
102 : : /** selects the paragraph for the given page at the outliner view*/
103 : : void SetActualPage( SdPage* pActual );
104 : :
105 : : virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
106 : : virtual void AdjustPosSizePixel(
107 : : const Point &rPos,
108 : : const Size &rSize,
109 : : ::sd::Window* pWindow);
110 : :
111 : : // Callbacks fuer LINKs
112 : : DECL_LINK( ParagraphInsertedHdl, Outliner * );
113 : : DECL_LINK( ParagraphRemovingHdl, Outliner * );
114 : : DECL_LINK( DepthChangedHdl, Outliner * );
115 : : DECL_LINK( StatusEventHdl, void * );
116 : : DECL_LINK( BeginMovingHdl, Outliner * );
117 : : DECL_LINK( EndMovingHdl, Outliner * );
118 : : DECL_LINK(RemovingPagesHdl, void *);
119 : : DECL_LINK( IndentingPagesHdl, OutlinerView * );
120 : : DECL_LINK( BeginDropHdl, void * );
121 : : DECL_LINK( EndDropHdl, void * );
122 : : DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* );
123 : :
124 : 0 : sal_uLong GetPaperWidth() const { return 2*21000; } // DIN A4 Breite
125 : :
126 : : sal_Bool PrepareClose(sal_Bool bUI = sal_True);
127 : :
128 : : virtual sal_Bool GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const;
129 : : virtual sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
130 : :
131 : : void FillOutliner();
132 : : void SetLinks();
133 : : void ResetLinks() const;
134 : :
135 : : SfxStyleSheet* GetStyleSheet() const;
136 : :
137 : : void SetSelectedPages();
138 : :
139 : : virtual sal_Int8 AcceptDrop (
140 : : const AcceptDropEvent& rEvt,
141 : : DropTargetHelper& rTargetHelper,
142 : : ::sd::Window* pTargetWindow = NULL,
143 : : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
144 : : sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
145 : : virtual sal_Int8 ExecuteDrop (
146 : : const ExecuteDropEvent& rEvt,
147 : : DropTargetHelper& rTargetHelper,
148 : : ::sd::Window* pTargetWindow = NULL,
149 : : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
150 : : sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
151 : :
152 : :
153 : : // Re-implement GetScriptType for this view to get correct results
154 : : virtual sal_uInt16 GetScriptType() const;
155 : :
156 : : /** After this method has been called with <TRUE/> following changes of
157 : : the current page are ignored in that the corresponding text is not
158 : : selected.
159 : : This is used to supress unwanted side effects between selection and
160 : : cursor position.
161 : : */
162 : : void IgnoreCurrentPageChanges (bool bIgnore);
163 : : void InvalidateSlideNumberArea();
164 : :
165 : : /** creates and inserts an empty slide for the given paragraph. */
166 : : SdPage* InsertSlideForParagraph( Paragraph* pPara );
167 : :
168 : : void UpdateParagraph( sal_uInt16 nPara );
169 : :
170 : : protected:
171 : : virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
172 : : virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
173 : :
174 : : private:
175 : : /** call this method before you do anything that can modify the outliner
176 : : and or the drawing document model. It will create needed undo actions */
177 : : void BeginModelChange();
178 : :
179 : : /** call this method after BeginModelChange(), when all possible model
180 : : changes are done. */
181 : : void EndModelChange();
182 : :
183 : : /** merge edit engine undo actions if possible */
184 : : void TryToMergeUndoActions();
185 : :
186 : : /** updates all changes in the outliner model to the draw model */
187 : : void UpdateDocument();
188 : :
189 : : OutlineViewShell& mrOutlineViewShell;
190 : : SdrOutliner& mrOutliner;
191 : : OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
192 : :
193 : : std::vector<Paragraph*> maOldParaOrder;
194 : : std::vector<Paragraph*> maSelectedParas;
195 : :
196 : : sal_uInt16 mnPagesToProcess; // fuer die Fortschrittsanzeige
197 : : sal_uInt16 mnPagesProcessed;
198 : :
199 : : sal_Bool mbFirstPaint;
200 : :
201 : : SfxProgress* mpProgress;
202 : :
203 : : /** stores the last used document color.
204 : : this is changed in onUpdateStyleSettings()
205 : : */
206 : : Color maDocColor;
207 : :
208 : : /** updates the high contrast settings and document color if they changed.
209 : : @param bForceUpdate forces the method to set all style settings
210 : : */
211 : : void onUpdateStyleSettings( bool bForceUpdate = false );
212 : :
213 : : /** this link is called from the vcl applicaten when the stylesettings
214 : : change. Its only purpose is to call onUpdateStyleSettings() then.
215 : : */
216 : : DECL_LINK( AppEventListenerHdl, void * );
217 : :
218 : : DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent*);
219 : :
220 : : /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
221 : : std::auto_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard;
222 : :
223 : : Font maPageNumberFont;
224 : : sal_Int32 mnPageNumberWidthPixel;
225 : : Font maBulletFont;
226 : :
227 : : SvxLRSpaceItem maLRSpaceItem;
228 : : Image maSlideImage;
229 : : };
230 : :
231 : : // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
232 : : class OutlineViewPageChangesGuard
233 : : {
234 : : public:
235 : : OutlineViewPageChangesGuard( OutlineView* pView );
236 : : ~OutlineViewPageChangesGuard();
237 : : private:
238 : : OutlineView* mpView;
239 : : };
240 : :
241 : : // calls BeginModelChange() on c'tor and EndModelChange() on d'tor
242 : : class OutlineViewModelChangeGuard
243 : : {
244 : : public:
245 : : OutlineViewModelChangeGuard( OutlineView& rView );
246 : : ~OutlineViewModelChangeGuard();
247 : : private:
248 : : OutlineView& mrView;
249 : : };
250 : :
251 : : } // end of namespace sd
252 : :
253 : : #endif
254 : :
255 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|