update dev300-m58
[ooovba.git] / sd / source / ui / inc / OutlineView.hxx
blobf227b83cafe1060de30752c2728693eb32f47267
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OutlineView.hxx,v $
10 * $Revision: 1.17 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_OUTLINE_VIEW_HXX
32 #define SD_OUTLINE_VIEW_HXX
34 #include <vcl/image.hxx>
35 #include <svx/lrspitem.hxx>
36 #include "View.hxx"
38 class SdPage;
39 class SdrPage;
40 class EditStatus;
41 class Paragraph;
42 class SdrTextObj;
43 class Outliner;
44 class SfxProgress;
45 struct PaintFirstLineInfo;
46 struct PasteOrDropInfos;
48 namespace sd { namespace tools {
49 class EventMultiplexerEvent;
50 } }
52 namespace sd {
54 class DrawDocShell;
55 class OutlineViewShell;
56 class OutlineViewModelChangeGuard;
57 class DrawDocShell;
59 static const int MAX_OUTLINERVIEWS = 4;
61 /*************************************************************************
63 |* Ableitung von ::sd::View fuer den Outline-Modus
65 \************************************************************************/
67 class OutlineView
68 : public ::sd::View
70 friend class OutlineViewModelChangeGuard;
71 public:
72 OutlineView (DrawDocShell* pDocSh,
73 ::Window* pWindow,
74 OutlineViewShell* pOutlineViewSh);
75 ~OutlineView (void);
77 /** This method is called by the view shell that owns the view to tell
78 the view that it can safely connect to the application.
79 This method must not be called before the view shell is on the shell
80 stack.
82 void ConnectToApplication (void);
83 void DisconnectFromApplication (void);
85 TYPEINFO();
87 SdrTextObj* GetTitleTextObject(SdrPage* pPage);
88 SdrTextObj* GetOutlineTextObject(SdrPage* pPage);
90 SdrTextObj* CreateTitleTextObject(SdPage* pPage);
91 SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
93 virtual void AddWindowToPaintView(OutputDevice* pWin);
94 virtual void DeleteWindowFromPaintView(OutputDevice* pWin);
96 OutlinerView* GetViewByWindow (::Window* pWin) const;
97 SdrOutliner* GetOutliner() { return(mpOutliner) ; }
99 Paragraph* GetPrevTitle(const Paragraph* pPara);
100 Paragraph* GetNextTitle(const Paragraph* pPara);
101 SdPage* GetActualPage();
102 SdPage* GetPageForParagraph( Paragraph* pPara );
103 Paragraph* GetParagraphForPage( ::Outliner* pOutl, SdPage* pPage );
105 /** selects the paragraph for the given page at the outliner view*/
106 void SetActualPage( SdPage* pActual );
108 virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
109 virtual void AdjustPosSizePixel(
110 const Point &rPos,
111 const Size &rSize,
112 ::sd::Window* pWindow);
114 // Callbacks fuer LINKs
115 DECL_LINK( ParagraphInsertedHdl, Outliner * );
116 DECL_LINK( ParagraphRemovingHdl, Outliner * );
117 DECL_LINK( DepthChangedHdl, Outliner * );
118 DECL_LINK( StatusEventHdl, EditStatus * );
119 DECL_LINK( BeginMovingHdl, Outliner * );
120 DECL_LINK( EndMovingHdl, Outliner * );
121 DECL_LINK( RemovingPagesHdl, OutlinerView * );
122 DECL_LINK( IndentingPagesHdl, OutlinerView * );
123 DECL_LINK( BeginDropHdl, void * );
124 DECL_LINK( EndDropHdl, void * );
125 DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* );
127 ULONG GetPaperWidth() const { return 2*21000; } // DIN A4 Breite
129 BOOL PrepareClose(BOOL bUI = TRUE);
131 virtual BOOL GetAttributes( SfxItemSet& rTargetSet, BOOL bOnlyHardAttr=FALSE ) const;
132 virtual BOOL SetAttributes(const SfxItemSet& rSet, BOOL bReplaceAll = FALSE);
134 // virtual BOOL HasMarkedObjUnused() const;
135 void FillOutliner();
136 void SetLinks();
137 void ResetLinks() const;
139 SfxStyleSheet* GetStyleSheet() const;
141 void SetSelectedPages();
143 virtual sal_Int8 AcceptDrop (
144 const AcceptDropEvent& rEvt,
145 DropTargetHelper& rTargetHelper,
146 ::sd::Window* pTargetWindow = NULL,
147 USHORT nPage = SDRPAGE_NOTFOUND,
148 USHORT nLayer = SDRPAGE_NOTFOUND);
149 virtual sal_Int8 ExecuteDrop (
150 const ExecuteDropEvent& rEvt,
151 DropTargetHelper& rTargetHelper,
152 ::sd::Window* pTargetWindow = NULL,
153 USHORT nPage = SDRPAGE_NOTFOUND,
154 USHORT nLayer = SDRPAGE_NOTFOUND);
157 // #97766# Re-implement GetScriptType for this view to get correct results
158 virtual sal_uInt16 GetScriptType() const;
160 /** After this method has been called with <TRUE/> following changes of
161 the current page are ignored in that the corresponding text is not
162 selected.
163 This is used to supress unwanted side effects between selection and
164 cursor position.
166 void IgnoreCurrentPageChanges (bool bIgnore);
168 sal_Int32 GetPageNumberWidthPixel();
170 void InvalidateSlideNumberArea();
172 /** creates and inserts an empty slide for the given paragraph. */
173 SdPage* InsertSlideForParagraph( Paragraph* pPara );
175 void UpdateParagraph( USHORT nPara );
177 protected:
178 virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
179 virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
181 private:
182 /** call this method before you do anything that can modify the outliner
183 and or the drawing document model. It will create needed undo actions */
184 void BeginModelChange();
186 /** call this method after BeginModelChange(), when all possible model
187 changes are done. */
188 void EndModelChange();
190 /** merge edit engine undo actions if possible */
191 void TryToMergeUndoActions();
193 /** updates all changes in the outliner model to the draw model */
194 void UpdateDocument();
196 OutlineViewShell* mpOutlineViewShell;
197 SdrOutliner* mpOutliner;
198 OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
200 List* mpOldParaOrder;
201 List* mpSelectedParas;
203 USHORT mnPagesToProcess; // fuer die Fortschrittsanzeige
204 USHORT mnPagesProcessed;
206 BOOL mbFirstPaint;
208 SfxProgress* mpProgress;
210 /** stores the last used high contrast mode.
211 this is changed in onUpdateStyleSettings()
213 bool mbHighContrastMode;
215 /** stores the last used document color.
216 this is changed in onUpdateStyleSettings()
218 Color maDocColor;
220 /** updates the high contrast settings and document color if they changed.
221 @param bForceUpdate forces the method to set all style settings
223 void onUpdateStyleSettings( bool bForceUpdate = false );
225 /** this link is called from the vcl applicaten when the stylesettings
226 change. Its only purpose is to call onUpdateStyleSettings() then.
228 DECL_LINK( AppEventListenerHdl, void * );
230 DECL_LINK(EventMultiplexerListener, sd::tools::EventMultiplexerEvent*);
232 /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
233 std::auto_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard;
235 Font maPageNumberFont;
236 sal_Int32 mnPageNumberWidthPixel;
237 Font maBulletFont;
239 SvxLRSpaceItem maLRSpaceItem;
240 Image maSlideImage;
243 // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
244 class OutlineViewPageChangesGuard
246 public:
247 OutlineViewPageChangesGuard( OutlineView* pView );
248 ~OutlineViewPageChangesGuard();
249 private:
250 OutlineView* mpView;
253 // calls BeginModelChange() on c'tor and EndModelChange() on d'tor
254 class OutlineViewModelChangeGuard
256 public:
257 OutlineViewModelChangeGuard( OutlineView& rView );
258 ~OutlineViewModelChangeGuard();
259 private:
260 OutlineView& mrView;
263 } // end of namespace sd
265 #endif