1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #ifndef SD_OUTLINE_VIEW_HXX
30 #define SD_OUTLINE_VIEW_HXX
32 #include <vcl/image.hxx>
33 #include <editeng/lrspitem.hxx>
43 struct PaintFirstLineInfo
;
44 struct PasteOrDropInfos
;
46 namespace sd
{ namespace tools
{
47 class EventMultiplexerEvent
;
53 class OutlineViewShell
;
54 class OutlineViewModelChangeGuard
;
57 static const int MAX_OUTLINERVIEWS
= 4;
59 /*************************************************************************
61 |* Ableitung von ::sd::View fuer den Outline-Modus
63 \************************************************************************/
68 friend class OutlineViewModelChangeGuard
;
70 OutlineView (DrawDocShell
* pDocSh
,
72 OutlineViewShell
* pOutlineViewSh
);
75 /** This method is called by the view shell that owns the view to tell
76 the view that it can safely connect to the application.
77 This method must not be called before the view shell is on the shell
80 void ConnectToApplication (void);
81 void DisconnectFromApplication (void);
85 SdrTextObj
* GetTitleTextObject(SdrPage
* pPage
);
86 SdrTextObj
* GetOutlineTextObject(SdrPage
* pPage
);
88 SdrTextObj
* CreateTitleTextObject(SdPage
* pPage
);
89 SdrTextObj
* CreateOutlineTextObject(SdPage
* pPage
);
91 virtual void AddWindowToPaintView(OutputDevice
* pWin
);
92 virtual void DeleteWindowFromPaintView(OutputDevice
* pWin
);
94 OutlinerView
* GetViewByWindow (::Window
* pWin
) const;
95 SdrOutliner
* GetOutliner() { return(mpOutliner
) ; }
97 Paragraph
* GetPrevTitle(const Paragraph
* pPara
);
98 Paragraph
* GetNextTitle(const Paragraph
* pPara
);
99 SdPage
* GetActualPage();
100 SdPage
* GetPageForParagraph( Paragraph
* pPara
);
101 Paragraph
* GetParagraphForPage( ::Outliner
* pOutl
, SdPage
* pPage
);
103 /** selects the paragraph for the given page at the outliner view*/
104 void SetActualPage( SdPage
* pActual
);
106 virtual void Paint (const Rectangle
& rRect
, ::sd::Window
* pWin
);
107 virtual void AdjustPosSizePixel(
110 ::sd::Window
* pWindow
);
112 // Callbacks fuer LINKs
113 DECL_LINK( ParagraphInsertedHdl
, Outliner
* );
114 DECL_LINK( ParagraphRemovingHdl
, Outliner
* );
115 DECL_LINK( DepthChangedHdl
, Outliner
* );
116 DECL_LINK( StatusEventHdl
, EditStatus
* );
117 DECL_LINK( BeginMovingHdl
, Outliner
* );
118 DECL_LINK( EndMovingHdl
, Outliner
* );
119 DECL_LINK( RemovingPagesHdl
, OutlinerView
* );
120 DECL_LINK( IndentingPagesHdl
, OutlinerView
* );
121 DECL_LINK( BeginDropHdl
, void * );
122 DECL_LINK( EndDropHdl
, void * );
123 DECL_LINK( PaintingFirstLineHdl
, PaintFirstLineInfo
* );
125 ULONG
GetPaperWidth() const { return 2*21000; } // DIN A4 Breite
127 BOOL
PrepareClose(BOOL bUI
= TRUE
);
129 virtual BOOL
GetAttributes( SfxItemSet
& rTargetSet
, BOOL bOnlyHardAttr
=FALSE
) const;
130 virtual BOOL
SetAttributes(const SfxItemSet
& rSet
, BOOL bReplaceAll
= FALSE
);
132 // virtual BOOL HasMarkedObjUnused() const;
135 void ResetLinks() const;
137 SfxStyleSheet
* GetStyleSheet() const;
139 void SetSelectedPages();
141 virtual sal_Int8
AcceptDrop (
142 const AcceptDropEvent
& rEvt
,
143 DropTargetHelper
& rTargetHelper
,
144 ::sd::Window
* pTargetWindow
= NULL
,
145 USHORT nPage
= SDRPAGE_NOTFOUND
,
146 USHORT nLayer
= SDRPAGE_NOTFOUND
);
147 virtual sal_Int8
ExecuteDrop (
148 const ExecuteDropEvent
& rEvt
,
149 DropTargetHelper
& rTargetHelper
,
150 ::sd::Window
* pTargetWindow
= NULL
,
151 USHORT nPage
= SDRPAGE_NOTFOUND
,
152 USHORT nLayer
= SDRPAGE_NOTFOUND
);
155 // #97766# Re-implement GetScriptType for this view to get correct results
156 virtual sal_uInt16
GetScriptType() const;
158 /** After this method has been called with <TRUE/> following changes of
159 the current page are ignored in that the corresponding text is not
161 This is used to supress unwanted side effects between selection and
164 void IgnoreCurrentPageChanges (bool bIgnore
);
165 void InvalidateSlideNumberArea();
167 /** creates and inserts an empty slide for the given paragraph. */
168 SdPage
* InsertSlideForParagraph( Paragraph
* pPara
);
170 void UpdateParagraph( USHORT nPara
);
173 virtual void OnBeginPasteOrDrop( PasteOrDropInfos
* pInfos
);
174 virtual void OnEndPasteOrDrop( PasteOrDropInfos
* pInfos
);
177 /** call this method before you do anything that can modify the outliner
178 and or the drawing document model. It will create needed undo actions */
179 void BeginModelChange();
181 /** call this method after BeginModelChange(), when all possible model
183 void EndModelChange();
185 /** merge edit engine undo actions if possible */
186 void TryToMergeUndoActions();
188 /** updates all changes in the outliner model to the draw model */
189 void UpdateDocument();
191 OutlineViewShell
* mpOutlineViewShell
;
192 SdrOutliner
* mpOutliner
;
193 OutlinerView
* mpOutlinerView
[MAX_OUTLINERVIEWS
];
195 List
* mpOldParaOrder
;
196 List
* mpSelectedParas
;
198 USHORT mnPagesToProcess
; // fuer die Fortschrittsanzeige
199 USHORT mnPagesProcessed
;
203 SfxProgress
* mpProgress
;
205 /** stores the last used high contrast mode.
206 this is changed in onUpdateStyleSettings()
208 bool mbHighContrastMode
;
210 /** stores the last used document color.
211 this is changed in onUpdateStyleSettings()
215 /** updates the high contrast settings and document color if they changed.
216 @param bForceUpdate forces the method to set all style settings
218 void onUpdateStyleSettings( bool bForceUpdate
= false );
220 /** this link is called from the vcl applicaten when the stylesettings
221 change. Its only purpose is to call onUpdateStyleSettings() then.
223 DECL_LINK( AppEventListenerHdl
, void * );
225 DECL_LINK(EventMultiplexerListener
, sd::tools::EventMultiplexerEvent
*);
227 /** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
228 std::auto_ptr
< OutlineViewModelChangeGuard
> maDragAndDropModelGuard
;
230 Font maPageNumberFont
;
231 sal_Int32 mnPageNumberWidthPixel
;
234 SvxLRSpaceItem maLRSpaceItem
;
238 // calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
239 class OutlineViewPageChangesGuard
242 OutlineViewPageChangesGuard( OutlineView
* pView
);
243 ~OutlineViewPageChangesGuard();
248 // calls BeginModelChange() on c'tor and EndModelChange() on d'tor
249 class OutlineViewModelChangeGuard
252 OutlineViewModelChangeGuard( OutlineView
& rView
);
253 ~OutlineViewModelChangeGuard();
258 } // end of namespace sd
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */