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 : :
30 : : #include "OutlineView.hxx"
31 : : #include <memory>
32 : : #include <editeng/forbiddencharacterstable.hxx>
33 : : #include <sfx2/progress.hxx>
34 : : #include <vcl/wrkwin.hxx>
35 : : #include <svx/svxids.hrc>
36 : : #include "eetext.hxx"
37 : : #include <editeng/eeitem.hxx>
38 : : #include <editeng/editstat.hxx>
39 : : #include <editeng/lrspitem.hxx>
40 : : #include <svx/svdotext.hxx>
41 : : #include <sfx2/printer.hxx>
42 : : #include <sfx2/imagemgr.hxx>
43 : : #include <sfx2/app.hxx>
44 : : #include <sfx2/bindings.hxx>
45 : : #include <svl/itempool.hxx>
46 : : #include <svl/style.hxx>
47 : : #include <svx/svdorect.hxx>
48 : : #include <svx/svdundo.hxx>
49 : : #include <svl/brdcst.hxx>
50 : : #include <vcl/msgbox.hxx>
51 : : #include <editeng/adjitem.hxx>
52 : : #include <editeng/tstpitem.hxx>
53 : : #include <editeng/lspcitem.hxx>
54 : : #include <editeng/numitem.hxx>
55 : : #include <editeng/outlobj.hxx>
56 : : #include <editeng/editeng.hxx>
57 : :
58 : : #include <editeng/editobj.hxx>
59 : : #include <editeng/editund2.hxx>
60 : :
61 : : #include <editeng/editview.hxx>
62 : : #include <editeng/svxfont.hxx>
63 : : #include <editeng/fhgtitem.hxx>
64 : :
65 : : #include "DrawDocShell.hxx"
66 : : #include "drawdoc.hxx"
67 : : #include "Window.hxx"
68 : : #include "sdpage.hxx"
69 : : #include "pres.hxx"
70 : : #include "OutlineViewShell.hxx"
71 : : #include "app.hrc"
72 : : #include "glob.hrc"
73 : : #include "sdresid.hxx"
74 : : #include "Outliner.hxx"
75 : : #include "strings.hrc"
76 : : #include "EventMultiplexer.hxx"
77 : : #include "ViewShellBase.hxx"
78 : : #include "undo/undoobjects.hxx"
79 : : #include "undo/undomanager.hxx"
80 : : #include "stlsheet.hxx"
81 : :
82 : : using ::rtl::OUString;
83 : : using namespace ::com::sun::star::uno;
84 : : using namespace ::com::sun::star::frame;
85 : :
86 : : namespace sd {
87 : :
88 : : // width: DIN A4, two margins à 1 cm each
89 : : #define OUTLINE_PAPERWIDTH 19000
90 : :
91 : : // a progress bar gets displayed when more than
92 : : // PROCESS_WITH_PROGRESS_THRESHOLD pages are concerned
93 : : #define PROCESS_WITH_PROGRESS_THRESHOLD 5
94 : :
95 : : struct SdParaAndPos
96 : : {
97 : : Paragraph* pPara;
98 : : sal_uInt16 nPos;
99 : : };
100 : :
101 [ # # ][ # # ]: 0 : TYPEINIT1( OutlineView, ::sd::View );
102 : :
103 : : /*************************************************************************
104 : : |*
105 : : |* Constructor
106 : : |*
107 : : \************************************************************************/
108 : :
109 : 0 : OutlineView::OutlineView( DrawDocShell& rDocSh, ::Window* pWindow, OutlineViewShell& rOutlineViewSh)
110 : 0 : : ::sd::View(*rDocSh.GetDoc(), pWindow, &rOutlineViewSh)
111 : : , mrOutlineViewShell(rOutlineViewSh)
112 [ # # ]: 0 : , mrOutliner(*mrDoc.GetOutliner(sal_True))
113 : : , mnPagesToProcess(0)
114 : : , mnPagesProcessed(0)
115 : : , mbFirstPaint(sal_True)
116 : : , mpProgress(NULL)
117 : : , maDocColor( COL_WHITE )
118 : : , mnPageNumberWidthPixel( 0 )
119 [ # # ][ # # ]: 0 : , maLRSpaceItem( 0, 0, 2000, 0, EE_PARA_OUTLLRSPACE )
[ # # ][ # # ]
[ # # ][ # # ]
120 : : {
121 : 0 : sal_Bool bInitOutliner = sal_False;
122 : :
123 [ # # ][ # # ]: 0 : if (mrOutliner.GetViewCount() == 0)
124 : : {
125 : : // initialize Outliner: set Reference Device
126 : 0 : bInitOutliner = sal_True;
127 [ # # ]: 0 : mrOutliner.Init( OUTLINERMODE_OUTLINEVIEW );
128 [ # # ][ # # ]: 0 : mrOutliner.SetRefDevice( SD_MOD()->GetRefDevice( rDocSh ) );
[ # # ]
129 : 0 : sal_uLong nWidth = OUTLINE_PAPERWIDTH;
130 [ # # ]: 0 : mrOutliner.SetPaperSize(Size(nWidth, 400000000));
131 : : }
132 : :
133 : : // insert View into Outliner
134 [ # # ]: 0 : for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
135 : : {
136 : 0 : mpOutlinerView[nView] = NULL;
137 : : }
138 : :
139 [ # # ][ # # ]: 0 : mpOutlinerView[0] = new OutlinerView(&mrOutliner, pWindow);
140 [ # # ]: 0 : Rectangle aNullRect;
141 [ # # ]: 0 : mpOutlinerView[0]->SetOutputArea(aNullRect);
142 [ # # ]: 0 : mrOutliner.SetUpdateMode(sal_False);
143 [ # # ]: 0 : mrOutliner.InsertView(mpOutlinerView[0], LIST_APPEND);
144 : :
145 [ # # ]: 0 : onUpdateStyleSettings( true );
146 : :
147 [ # # ]: 0 : if (bInitOutliner)
148 : : {
149 : : // fill Outliner with contents
150 [ # # ]: 0 : FillOutliner();
151 : : }
152 : :
153 [ # # ]: 0 : Link aLink( LINK(this,OutlineView,EventMultiplexerListener) );
154 [ # # ]: 0 : mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->AddEventListener(
155 : : aLink,
156 : : tools::EventMultiplexerEvent::EID_CURRENT_PAGE
157 [ # # ][ # # ]: 0 : | tools::EventMultiplexerEvent::EID_PAGE_ORDER);
[ # # ]
158 : :
159 [ # # ]: 0 : LanguageType eLang = mrOutliner.GetDefaultLanguage();
160 [ # # ][ # # ]: 0 : maPageNumberFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, eLang, 0 );
[ # # ]
161 [ # # ]: 0 : maPageNumberFont.SetHeight( 500 );
162 : :
163 [ # # ]: 0 : maBulletFont.SetColor( COL_AUTO );
164 [ # # ]: 0 : maBulletFont.SetHeight( 1000 );
165 [ # # ]: 0 : maBulletFont.SetCharSet(RTL_TEXTENCODING_MS_1252); // and replacing other values by standard
166 [ # # ]: 0 : maBulletFont.SetName( OUString( "StarSymbol" ) );
167 [ # # ]: 0 : maBulletFont.SetWeight(WEIGHT_NORMAL);
168 [ # # ]: 0 : maBulletFont.SetUnderline(UNDERLINE_NONE);
169 [ # # ]: 0 : maBulletFont.SetStrikeout(STRIKEOUT_NONE);
170 [ # # ]: 0 : maBulletFont.SetItalic(ITALIC_NONE);
171 [ # # ]: 0 : maBulletFont.SetOutline(sal_False);
172 [ # # ]: 0 : maBulletFont.SetShadow(sal_False);
173 : :
174 : :
175 [ # # ][ # # ]: 0 : Reference<XFrame> xFrame (mrOutlineViewShell.GetViewShellBase().GetFrame()->GetTopFrame().GetFrameInterface(), UNO_QUERY);
[ # # ][ # # ]
[ # # ]
176 : :
177 : 0 : const OUString aSlotURL( ".uno:ShowSlide" );
178 [ # # ][ # # ]: 0 : maSlideImage = GetImage( xFrame, aSlotURL, true );
[ # # ]
179 : :
180 : : // Tell undo manager of the document about the undo manager of the
181 : : // outliner, so that the former can synchronize with the later.
182 [ # # ][ # # ]: 0 : sd::UndoManager* pDocUndoMgr = dynamic_cast<sd::UndoManager*>(mpDocSh->GetUndoManager());
183 [ # # ]: 0 : if (pDocUndoMgr != NULL)
184 [ # # ][ # # ]: 0 : pDocUndoMgr->SetLinkedUndoManager(&mrOutliner.GetUndoManager());
185 : 0 : }
186 : :
187 : : /*************************************************************************
188 : : |*
189 : : |* Destructor, restore Links, clear Oultiner
190 : : |*
191 : : \************************************************************************/
192 : :
193 [ # # ][ # # ]: 0 : OutlineView::~OutlineView()
[ # # ][ # # ]
[ # # ]
194 : : {
195 : : DBG_ASSERT(maDragAndDropModelGuard.get() == 0, "sd::OutlineView::~OutlineView(), prior drag operation not finished correctly!" );
196 : :
197 [ # # ]: 0 : Link aLink( LINK(this,OutlineView,EventMultiplexerListener) );
198 [ # # ][ # # ]: 0 : mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->RemoveEventListener( aLink );
[ # # ][ # # ]
199 [ # # ]: 0 : DisconnectFromApplication();
200 : :
201 [ # # ]: 0 : if( mpProgress )
202 [ # # ][ # # ]: 0 : delete mpProgress;
203 : :
204 : : // unregister OutlinerViews and destroy them
205 [ # # ]: 0 : for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
206 : : {
207 [ # # ]: 0 : if (mpOutlinerView[nView] != NULL)
208 : : {
209 [ # # ]: 0 : mrOutliner.RemoveView( mpOutlinerView[nView] );
210 [ # # ][ # # ]: 0 : delete mpOutlinerView[nView];
211 : 0 : mpOutlinerView[nView] = NULL;
212 : : }
213 : : }
214 : :
215 [ # # ][ # # ]: 0 : if (mrOutliner.GetViewCount() == 0)
216 : : {
217 : : // uninitialize Outliner: enable color display
218 [ # # ]: 0 : ResetLinks();
219 [ # # ]: 0 : sal_uLong nCntrl = mrOutliner.GetControlWord();
220 [ # # ]: 0 : mrOutliner.SetUpdateMode(sal_False); // otherwise there will be drawn on SetControlWord
221 [ # # ]: 0 : mrOutliner.SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
222 [ # # ]: 0 : SvtAccessibilityOptions aOptions;
223 [ # # ][ # # ]: 0 : mrOutliner.ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
224 [ # # ][ # # ]: 0 : mrOutliner.Clear();
225 : : }
226 [ # # ]: 0 : }
227 : :
228 : :
229 : :
230 : :
231 : 0 : void OutlineView::ConnectToApplication (void)
232 : : {
233 : 0 : mrOutlineViewShell.GetActiveWindow()->GrabFocus();
234 [ # # ]: 0 : Application::AddEventListener(LINK(this, OutlineView, AppEventListenerHdl));
235 : 0 : }
236 : :
237 : :
238 : :
239 : :
240 : 0 : void OutlineView::DisconnectFromApplication (void)
241 : : {
242 [ # # ]: 0 : Application::RemoveEventListener(LINK(this, OutlineView, AppEventListenerHdl));
243 : 0 : }
244 : :
245 : :
246 : :
247 : :
248 : : /*************************************************************************
249 : : |*
250 : : |* Paint method
251 : : |*
252 : : \************************************************************************/
253 : :
254 : 0 : void OutlineView::Paint(const Rectangle& rRect, ::sd::Window* pWin)
255 : : {
256 : 0 : OutlinerView* pOlView = GetViewByWindow(pWin);
257 : :
258 [ # # ]: 0 : if (pOlView)
259 : : {
260 : 0 : pOlView->HideCursor();
261 : 0 : pOlView->Paint(rRect);
262 : :
263 : 0 : pOlView->ShowCursor(mbFirstPaint);
264 : :
265 : 0 : mbFirstPaint = sal_False;
266 : : }
267 : 0 : }
268 : :
269 : 0 : void OutlineView::InvalidateSlideNumberArea()
270 : : {
271 : 0 : }
272 : :
273 : : /*************************************************************************
274 : : |*
275 : : |* Window size was changed
276 : : |*
277 : : \************************************************************************/
278 : :
279 : 0 : void OutlineView::AdjustPosSizePixel(const Point &,const Size &,::sd::Window*)
280 : : {
281 : 0 : }
282 : :
283 : : /*************************************************************************
284 : : |*
285 : : |* add a window
286 : : |*
287 : : \************************************************************************/
288 : :
289 : 0 : void OutlineView::AddWindowToPaintView(OutputDevice* pWin)
290 : : {
291 : 0 : sal_Bool bAdded = sal_False;
292 : 0 : sal_Bool bValidArea = sal_False;
293 [ # # ]: 0 : Rectangle aOutputArea;
294 : 0 : const Color aWhiteColor( COL_WHITE );
295 : 0 : sal_uInt16 nView = 0;
296 : :
297 [ # # ][ # # ]: 0 : while (nView < MAX_OUTLINERVIEWS && !bAdded)
[ # # ]
298 : : {
299 [ # # ]: 0 : if (mpOutlinerView[nView] == NULL)
300 : : {
301 [ # # ][ # # ]: 0 : mpOutlinerView[nView] = new OutlinerView(&mrOutliner, dynamic_cast< ::sd::Window* >(pWin));
[ # # ]
302 [ # # ]: 0 : mpOutlinerView[nView]->SetBackgroundColor( aWhiteColor );
303 [ # # ]: 0 : mrOutliner.InsertView(mpOutlinerView[nView], LIST_APPEND);
304 : 0 : bAdded = sal_True;
305 : :
306 [ # # ]: 0 : if (bValidArea)
307 : : {
308 [ # # ]: 0 : mpOutlinerView[nView]->SetOutputArea(aOutputArea);
309 : : }
310 : : }
311 [ # # ]: 0 : else if (!bValidArea)
312 : : {
313 [ # # ]: 0 : aOutputArea = mpOutlinerView[nView]->GetOutputArea();
314 : 0 : bValidArea = sal_True;
315 : : }
316 : :
317 : 0 : nView++;
318 : : }
319 : :
320 : : // white background in Outliner
321 [ # # ][ # # ]: 0 : pWin->SetBackground( Wallpaper( aWhiteColor ) );
[ # # ]
322 : :
323 [ # # ]: 0 : ::sd::View::AddWindowToPaintView(pWin);
324 : 0 : }
325 : :
326 : : /*************************************************************************
327 : : |*
328 : : |* remove a window
329 : : |*
330 : : \************************************************************************/
331 : :
332 : 0 : void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
333 : : {
334 : 0 : sal_Bool bRemoved = sal_False;
335 : 0 : sal_uInt16 nView = 0;
336 : : ::Window* pWindow;
337 : :
338 [ # # ][ # # ]: 0 : while (nView < MAX_OUTLINERVIEWS && !bRemoved)
[ # # ]
339 : : {
340 [ # # ]: 0 : if (mpOutlinerView[nView] != NULL)
341 : : {
342 : 0 : pWindow = mpOutlinerView[nView]->GetWindow();
343 : :
344 [ # # ]: 0 : if (pWindow == pWin)
345 : : {
346 : 0 : mrOutliner.RemoveView( mpOutlinerView[nView] );
347 [ # # ]: 0 : delete mpOutlinerView[nView];
348 : 0 : mpOutlinerView[nView] = NULL;
349 : 0 : bRemoved = sal_True;
350 : : }
351 : : }
352 : :
353 : 0 : nView++;
354 : : }
355 : :
356 : 0 : ::sd::View::DeleteWindowFromPaintView(pWin);
357 : 0 : }
358 : :
359 : : /*************************************************************************
360 : : |*
361 : : |* Return a pointer to the OutlinerView corresponding to the window
362 : : |*
363 : : \************************************************************************/
364 : :
365 : 0 : OutlinerView* OutlineView::GetViewByWindow (::Window* pWin) const
366 : : {
367 : 0 : OutlinerView* pOlView = NULL;
368 [ # # ]: 0 : for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
369 : : {
370 [ # # ]: 0 : if (mpOutlinerView[nView] != NULL)
371 : : {
372 [ # # ]: 0 : if ( pWin == mpOutlinerView[nView]->GetWindow() )
373 : : {
374 : 0 : pOlView = mpOutlinerView[nView];
375 : : }
376 : : }
377 : : }
378 : 0 : return (pOlView);
379 : : }
380 : :
381 : :
382 : : /*************************************************************************
383 : : |*
384 : : |* Return the title before a random paragraph
385 : : |*
386 : : \************************************************************************/
387 : :
388 : 0 : Paragraph* OutlineView::GetPrevTitle(const Paragraph* pPara)
389 : : {
390 : 0 : sal_Int32 nPos = mrOutliner.GetAbsPos(const_cast<Paragraph*>(pPara));
391 : :
392 [ # # ]: 0 : if (nPos > 0)
393 : : {
394 [ # # ]: 0 : while(nPos)
395 : : {
396 : 0 : pPara = mrOutliner.GetParagraph(--nPos);
397 [ # # ]: 0 : if( mrOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) )
398 : : {
399 : 0 : return const_cast< Paragraph* >( pPara );
400 : : }
401 : : }
402 : :
403 : : }
404 : 0 : return NULL;
405 : : }
406 : :
407 : : /*************************************************************************
408 : : |*
409 : : |* Return the title after a random paragraph
410 : : |*
411 : : \************************************************************************/
412 : :
413 : 0 : Paragraph* OutlineView::GetNextTitle(const Paragraph* pPara)
414 : : {
415 : 0 : Paragraph* pResult = const_cast< Paragraph* >( pPara );
416 : :
417 : 0 : sal_Int32 nPos = mrOutliner.GetAbsPos(pResult);
418 : :
419 [ # # ]: 0 : do
420 : : {
421 : 0 : pResult = mrOutliner.GetParagraph(++nPos);
422 [ # # ][ # # ]: 0 : if( pResult && mrOutliner.HasParaFlag(pResult, PARAFLAG_ISPAGE) )
[ # # ]
423 : 0 : return pResult;
424 : : }
425 : : while( pResult );
426 : :
427 : 0 : return NULL;
428 : : }
429 : :
430 : : /*************************************************************************
431 : : |*
432 : : |* Handler for inserting pages (paragraphs)
433 : : |*
434 : : \************************************************************************/
435 : :
436 : 0 : IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner )
437 : : {
438 : : // we get calls to this handler during binary insert of drag and drop contents but
439 : : // we ignore it here and handle it later in OnEndPasteOrDrop()
440 [ # # ]: 0 : if( maDragAndDropModelGuard.get() == 0 )
441 : : {
442 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(this);
443 : :
444 : 0 : Paragraph* pPara = pOutliner->GetHdlParagraph();
445 : :
446 [ # # ]: 0 : sal_uInt16 nAbsPos = (sal_uInt16)mrOutliner.GetAbsPos( pPara );
447 : :
448 [ # # ]: 0 : UpdateParagraph( nAbsPos );
449 : :
450 [ # # ][ # # ]: 0 : if( (nAbsPos == 0) || mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) || mrOutliner.HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), PARAFLAG_ISPAGE) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
451 : : {
452 [ # # ]: 0 : InsertSlideForParagraph( pPara );
453 : 0 : InvalidateSlideNumberArea();
454 [ # # ]: 0 : }
455 : : }
456 : :
457 : 0 : return 0;
458 : : }
459 : :
460 : : /** creates and inserts an empty slide for the given paragraph */
461 : 0 : SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara )
462 : : {
463 : : DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::InsertSlideForParagraph(), model change without undo?!" );
464 : :
465 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(this);
466 : :
467 [ # # ]: 0 : mrOutliner.SetParaFlag( pPara, PARAFLAG_ISPAGE );
468 : : // how many titles are there before the new title paragraph?
469 : 0 : sal_uLong nExample = 0L; // position of the "example" page
470 : 0 : sal_uLong nTarget = 0L; // position of insertion
471 [ # # ]: 0 : while(pPara)
472 : : {
473 [ # # ]: 0 : pPara = GetPrevTitle(pPara);
474 [ # # ]: 0 : if (pPara)
475 : 0 : nTarget++;
476 : : }
477 : :
478 : : // if a new paragraph is created via RETURN before the first paragraph, the
479 : : // Outliner reports the old paragraph (which was moved down) as a new
480 : : // paragraph
481 [ # # ]: 0 : if (nTarget == 1)
482 : : {
483 [ # # ][ # # ]: 0 : String aTest(mrOutliner.GetText( mrOutliner.GetParagraph( 0 ) ));
484 [ # # ]: 0 : if (aTest.Len() == 0)
485 : : {
486 : 0 : nTarget = 0;
487 [ # # ]: 0 : }
488 : : }
489 : :
490 : :
491 : : // the "example" page is the previous page - if it is available
492 [ # # ]: 0 : if (nTarget > 0)
493 : : {
494 : 0 : nExample = nTarget - 1;
495 : :
496 [ # # ]: 0 : sal_uInt16 nPageCount = mrDoc.GetSdPageCount( PK_STANDARD );
497 [ # # ]: 0 : if( nExample >= nPageCount )
498 : 0 : nExample = nPageCount - 1;
499 : : }
500 : :
501 : : /**********************************************************************
502 : : * All the time, a standard page is created before a notes page.
503 : : * It is ensured that after each standard page the corresponding notes page
504 : : * follows. A handout page is exactly one handout page.
505 : : **********************************************************************/
506 : :
507 : : // this page is exemplary
508 [ # # ]: 0 : SdPage* pExample = (SdPage*)mrDoc.GetSdPage((sal_uInt16)nExample, PK_STANDARD);
509 [ # # ]: 0 : SdPage* pPage = (SdPage*)mrDoc.AllocPage(sal_False);
510 : :
511 [ # # ][ # # ]: 0 : pPage->SetLayoutName(pExample->GetLayoutName());
[ # # ]
512 : :
513 : : // insert (page)
514 [ # # ]: 0 : mrDoc.InsertPage(pPage, (sal_uInt16)(nTarget) * 2 + 1);
515 [ # # ][ # # ]: 0 : if( isRecordingUndo() )
516 [ # # ][ # # ]: 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pPage));
[ # # ]
517 : :
518 : : // assign a master page to the standard page
519 [ # # ][ # # ]: 0 : pPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
520 : :
521 : : // set page size
522 [ # # ][ # # ]: 0 : pPage->SetSize(pExample->GetSize());
523 : 0 : pPage->SetBorder( pExample->GetLftBorder(),
524 : 0 : pExample->GetUppBorder(),
525 : 0 : pExample->GetRgtBorder(),
526 [ # # ][ # # ]: 0 : pExample->GetLwrBorder() );
[ # # ][ # # ]
[ # # ]
527 : :
528 : : // create new presentation objects (after <Title> or <Title with subtitle>
529 : : // follows <Title with outline>, otherwise apply the layout of the previous
530 : : // page
531 : 0 : AutoLayout eAutoLayout = pExample->GetAutoLayout();
532 [ # # ][ # # ]: 0 : if (eAutoLayout == AUTOLAYOUT_TITLE ||
533 : : eAutoLayout == AUTOLAYOUT_ONLY_TITLE)
534 : : {
535 [ # # ]: 0 : pPage->SetAutoLayout(AUTOLAYOUT_ENUM, sal_True);
536 : : }
537 : : else
538 : : {
539 [ # # ]: 0 : pPage->SetAutoLayout(pExample->GetAutoLayout(), sal_True);
540 : : }
541 : :
542 : : /**********************************************************************
543 : : |* now the notes page
544 : : \*********************************************************************/
545 [ # # ]: 0 : pExample = (SdPage*)mrDoc.GetSdPage((sal_uInt16)nExample, PK_NOTES);
546 [ # # ]: 0 : SdPage* pNotesPage = (SdPage*)mrDoc.AllocPage(sal_False);
547 : :
548 [ # # ][ # # ]: 0 : pNotesPage->SetLayoutName(pExample->GetLayoutName());
[ # # ]
549 : :
550 : 0 : pNotesPage->SetPageKind(PK_NOTES);
551 : :
552 : : // insert (notes page)
553 [ # # ]: 0 : mrDoc.InsertPage(pNotesPage, (sal_uInt16)(nTarget) * 2 + 2);
554 [ # # ][ # # ]: 0 : if( isRecordingUndo() )
555 [ # # ][ # # ]: 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
[ # # ]
556 : :
557 : : // assign a master page to the notes page
558 [ # # ][ # # ]: 0 : pNotesPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
559 : :
560 : : // set page size, there must be already one page available
561 [ # # ][ # # ]: 0 : pNotesPage->SetSize(pExample->GetSize());
562 : 0 : pNotesPage->SetBorder( pExample->GetLftBorder(),
563 : 0 : pExample->GetUppBorder(),
564 : 0 : pExample->GetRgtBorder(),
565 [ # # ][ # # ]: 0 : pExample->GetLwrBorder() );
[ # # ][ # # ]
[ # # ]
566 : :
567 : : // create presentation objects
568 [ # # ]: 0 : pNotesPage->SetAutoLayout(pExample->GetAutoLayout(), sal_True);
569 : :
570 [ # # ]: 0 : mrOutliner.UpdateFields();
571 : :
572 [ # # ]: 0 : return pPage;
573 : : }
574 : :
575 : : /*************************************************************************
576 : : |*
577 : : |* Handler for deleting pages (paragraphs)
578 : : |*
579 : : \************************************************************************/
580 : :
581 : 0 : IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner )
582 : : {
583 : : DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::ParagraphRemovingHdl(), model change without undo?!" );
584 : :
585 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(this);
586 : :
587 : 0 : Paragraph* pPara = pOutliner->GetHdlParagraph();
588 [ # # ][ # # ]: 0 : if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
589 : : {
590 : : // how many titles are in front of the title paragraph in question?
591 : 0 : sal_uLong nPos = 0L;
592 [ # # ]: 0 : while(pPara)
593 : : {
594 [ # # ]: 0 : pPara = GetPrevTitle(pPara);
595 [ # # ]: 0 : if (pPara) nPos++;
596 : : }
597 : :
598 : : // delete page and notes page
599 : 0 : sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1;
600 [ # # ]: 0 : SdrPage* pPage = mrDoc.GetPage(nAbsPos);
601 [ # # ][ # # ]: 0 : if( isRecordingUndo() )
602 [ # # ][ # # ]: 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
[ # # ]
603 [ # # ]: 0 : mrDoc.RemovePage(nAbsPos);
604 : :
605 : 0 : nAbsPos = (sal_uInt16)nPos * 2 + 1;
606 [ # # ]: 0 : pPage = mrDoc.GetPage(nAbsPos);
607 [ # # ][ # # ]: 0 : if( isRecordingUndo() )
608 [ # # ][ # # ]: 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
[ # # ]
609 [ # # ]: 0 : mrDoc.RemovePage(nAbsPos);
610 : :
611 : : // progress display if necessary
612 [ # # ]: 0 : if (mnPagesToProcess)
613 : : {
614 : 0 : mnPagesProcessed++;
615 : :
616 [ # # ]: 0 : if(mpProgress)
617 [ # # ]: 0 : mpProgress->SetState(mnPagesProcessed);
618 : :
619 [ # # ]: 0 : if (mnPagesProcessed == mnPagesToProcess)
620 : : {
621 [ # # ]: 0 : if(mpProgress)
622 : : {
623 [ # # ][ # # ]: 0 : delete mpProgress;
624 : 0 : mpProgress = NULL;
625 : : }
626 : 0 : mnPagesToProcess = 0;
627 : 0 : mnPagesProcessed = 0;
628 : : }
629 : : }
630 [ # # ]: 0 : pOutliner->UpdateFields();
631 : : }
632 : :
633 : 0 : InvalidateSlideNumberArea();
634 : :
635 [ # # ]: 0 : return 0;
636 : : }
637 : :
638 : : /*************************************************************************
639 : : |*
640 : : |* Handler for changing the indentation depth of paragraphs (requires inserting
641 : : |* or deleting of pages in some cases)
642 : : |*
643 : : \************************************************************************/
644 : :
645 : 0 : IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner )
646 : : {
647 : : DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::DepthChangedHdl(), no undo for model change?!" );
648 : :
649 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(this);
650 : :
651 : 0 : Paragraph* pPara = pOutliner->GetHdlParagraph();
652 [ # # ][ # # ]: 0 : if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) == 0) )
[ # # ][ # # ]
653 : : {
654 : : // the current paragraph is transformed into a slide
655 : :
656 [ # # ]: 0 : mrOutliner.SetDepth( pPara, -1 );
657 : :
658 : : // are multiple level 1 paragraphs being brought to level 0 and we
659 : : // should start a progress view or a timer and didn't already?
660 [ # # ]: 0 : if (mnPagesToProcess == 0)
661 : : {
662 [ # # ]: 0 : Window* pActWin = mrOutlineViewShell.GetActiveWindow();
663 [ # # ]: 0 : OutlinerView* pOlView = GetViewByWindow(pActWin);
664 : :
665 [ # # ]: 0 : std::vector<Paragraph*> aSelList;
666 [ # # ]: 0 : pOlView->CreateSelectionList(aSelList);
667 : :
668 : 0 : Paragraph *pParagraph = NULL;
669 [ # # ][ # # ]: 0 : for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
[ # # ]
670 : : {
671 : 0 : pParagraph = *iter;
672 : :
673 [ # # ][ # # ]: 0 : if( !pOutliner->HasParaFlag( pParagraph, PARAFLAG_ISPAGE ) &&
[ # # ][ # # ]
674 [ # # ][ # # ]: 0 : (pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( pParagraph ) ) <= 0) )
675 : 0 : mnPagesToProcess++;
676 : : }
677 : :
678 : 0 : mnPagesToProcess++; // the paragraph being in level 0 already
679 : : // should be included
680 : 0 : mnPagesProcessed = 0;
681 : :
682 [ # # ]: 0 : if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD)
683 : : {
684 [ # # ]: 0 : if( mpProgress )
685 [ # # ][ # # ]: 0 : delete mpProgress;
686 : :
687 [ # # ][ # # ]: 0 : const String aStr(SdResId(STR_CREATE_PAGES));
688 [ # # ][ # # ]: 0 : mpProgress = new SfxProgress( GetDocSh(), aStr, mnPagesToProcess );
[ # # ]
689 : : }
690 : : else
691 : : {
692 [ # # ]: 0 : mpDocSh->SetWaitCursor( sal_True );
693 : 0 : }
694 : : }
695 : :
696 [ # # ]: 0 : ParagraphInsertedHdl(pOutliner);
697 : :
698 : 0 : mnPagesProcessed++;
699 : :
700 : : // should there be a progress display?
701 [ # # ]: 0 : if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD)
702 : : {
703 [ # # ]: 0 : if (mpProgress)
704 [ # # ]: 0 : mpProgress->SetState(mnPagesProcessed);
705 : : }
706 : :
707 : : // was this the last page?
708 [ # # ]: 0 : if (mnPagesProcessed == mnPagesToProcess)
709 : : {
710 [ # # ][ # # ]: 0 : if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD && mpProgress)
711 : : {
712 [ # # ][ # # ]: 0 : delete mpProgress;
713 : 0 : mpProgress = NULL;
714 : : }
715 : : else
716 [ # # ]: 0 : mpDocSh->SetWaitCursor( sal_False );
717 : :
718 : 0 : mnPagesToProcess = 0;
719 : 0 : mnPagesProcessed = 0;
720 : : }
721 [ # # ]: 0 : pOutliner->UpdateFields();
722 : : }
723 [ # # ][ # # ]: 0 : else if( !pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) != 0) )
[ # # ][ # # ]
724 : : {
725 : : // the paragraph was a page but now becomes a normal paragraph
726 : :
727 : : // how many titles are before the title paragraph in question?
728 : 0 : sal_uLong nPos = 0L;
729 : 0 : Paragraph* pParagraph = pPara;
730 [ # # ]: 0 : while(pParagraph)
731 : : {
732 [ # # ]: 0 : pParagraph = GetPrevTitle(pParagraph);
733 [ # # ]: 0 : if (pParagraph)
734 : 0 : nPos++;
735 : : }
736 : : // delete page and notes page
737 : :
738 : 0 : sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1;
739 [ # # ]: 0 : SdrPage* pPage = mrDoc.GetPage(nAbsPos);
740 [ # # ][ # # ]: 0 : if( isRecordingUndo() )
741 [ # # ][ # # ]: 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
[ # # ]
742 [ # # ]: 0 : mrDoc.RemovePage(nAbsPos);
743 : :
744 : 0 : nAbsPos = (sal_uInt16)nPos * 2 + 1;
745 [ # # ]: 0 : pPage = mrDoc.GetPage(nAbsPos);
746 [ # # ][ # # ]: 0 : if( isRecordingUndo() )
747 [ # # ][ # # ]: 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
[ # # ]
748 [ # # ]: 0 : mrDoc.RemovePage(nAbsPos);
749 : :
750 [ # # ]: 0 : pPage = GetPageForParagraph( pPara );
751 : :
752 [ # # ][ # # ]: 0 : mrOutliner.SetDepth( pPara, (pPage && (static_cast<SdPage*>(pPage)->GetAutoLayout() == AUTOLAYOUT_TITLE)) ? -1 : 0 );
[ # # ]
753 : :
754 : : // progress display if necessary
755 [ # # ]: 0 : if (mnPagesToProcess)
756 : : {
757 : 0 : mnPagesProcessed++;
758 [ # # ]: 0 : if (mpProgress)
759 [ # # ]: 0 : mpProgress->SetState(mnPagesProcessed);
760 : :
761 [ # # ]: 0 : if (mnPagesProcessed == mnPagesToProcess)
762 : : {
763 [ # # ]: 0 : if(mpProgress)
764 : : {
765 [ # # ][ # # ]: 0 : delete mpProgress;
766 : 0 : mpProgress = NULL;
767 : : }
768 : 0 : mnPagesToProcess = 0;
769 : 0 : mnPagesProcessed = 0;
770 : : }
771 : : }
772 [ # # ]: 0 : pOutliner->UpdateFields();
773 : : }
774 [ # # ][ # # ]: 0 : else if ( (pOutliner->GetPrevDepth() == 1) && ( pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( pPara ) ) == 2 ) )
[ # # ][ # # ]
[ # # ]
775 : : {
776 : : // how many titles are in front of the title paragraph in question?
777 : 0 : sal_Int32 nPos = -1L;
778 : :
779 : 0 : Paragraph* pParagraph = pPara;
780 [ # # ]: 0 : while(pParagraph)
781 : : {
782 [ # # ]: 0 : pParagraph = GetPrevTitle(pParagraph);
783 [ # # ]: 0 : if (pParagraph)
784 : 0 : nPos++;
785 : : }
786 : :
787 [ # # ]: 0 : if(nPos >= 0)
788 : : {
789 [ # # ]: 0 : SdPage*pPage = (SdPage*)mrDoc.GetSdPage( (sal_uInt16) nPos, PK_STANDARD);
790 : :
791 [ # # ][ # # ]: 0 : if(pPage && pPage->GetPresObj(PRESOBJ_TEXT))
[ # # ][ # # ]
792 [ # # ]: 0 : pOutliner->SetDepth( pPara, 0 );
793 : : }
794 : :
795 : : }
796 : : // how many titles are in front of the title paragraph in question?
797 : 0 : sal_Int32 nPos = -1L;
798 : :
799 : 0 : Paragraph* pTempPara = pPara;
800 [ # # ]: 0 : while(pTempPara)
801 : : {
802 [ # # ]: 0 : pTempPara = GetPrevTitle(pTempPara);
803 [ # # ]: 0 : if (pTempPara)
804 : 0 : nPos++;
805 : : }
806 : :
807 [ # # ]: 0 : if( nPos >= 0 )
808 : : {
809 [ # # ]: 0 : SdPage* pPage = (SdPage*) mrDoc.GetSdPage( (sal_uInt16) nPos, PK_STANDARD );
810 : :
811 [ # # ]: 0 : if( pPage )
812 : : {
813 : 0 : SfxStyleSheet* pStyleSheet = NULL;
814 [ # # ]: 0 : sal_uLong nPara = pOutliner->GetAbsPos( pPara );
815 [ # # ]: 0 : sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nPara );
816 [ # # ]: 0 : bool bSubTitle = pPage->GetPresObj(PRESOBJ_TEXT) != NULL;
817 : :
818 [ # # ][ # # ]: 0 : if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
819 : : {
820 [ # # ]: 0 : pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
821 : : }
822 [ # # ]: 0 : else if( bSubTitle )
823 : : {
824 [ # # ]: 0 : pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
825 : : }
826 : : else
827 : : {
828 [ # # ]: 0 : pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
829 : :
830 [ # # ]: 0 : if( nDepth > 0 )
831 : : {
832 [ # # ][ # # ]: 0 : String aNewStyleSheetName( pStyleSheet->GetName() );
833 [ # # ]: 0 : aNewStyleSheetName.Erase( aNewStyleSheetName.Len()-1, 1 );
834 [ # # ][ # # ]: 0 : aNewStyleSheetName += String::CreateFromInt32( nDepth+1 );
[ # # ]
835 [ # # ]: 0 : SfxStyleSheetBasePool* pStylePool = mrDoc.GetStyleSheetPool();
836 [ # # ][ # # ]: 0 : pStyleSheet = (SfxStyleSheet*) pStylePool->Find( aNewStyleSheetName, pStyleSheet->GetFamily() );
837 : : }
838 : : }
839 : :
840 : : // before we set the style sheet we need to preserve the bullet item
841 : : // since all items will be deleted while setting a new style sheet
842 [ # # ]: 0 : SfxItemSet aOldAttrs( pOutliner->GetParaAttribs( (sal_uInt16)nPara ) );
843 : :
844 [ # # ]: 0 : pOutliner->SetStyleSheet( nPara, pStyleSheet );
845 : :
846 : : // restore the old bullet item but not if the style changed
847 [ # # ][ # # ]: 0 : if ( pOutliner->GetPrevDepth() != -1 && nDepth != -1 &&
[ # # ][ # # ]
848 [ # # ]: 0 : aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
849 : : {
850 [ # # ]: 0 : SfxItemSet aAttrs( pOutliner->GetParaAttribs( (sal_uInt16)nPara ) );
851 [ # # ][ # # ]: 0 : aAttrs.Put( *aOldAttrs.GetItem( EE_PARA_NUMBULLET ) );
852 [ # # ][ # # ]: 0 : pOutliner->SetParaAttribs( (sal_uInt16)nPara, aAttrs );
853 [ # # ]: 0 : }
854 : : }
855 : : }
856 : :
857 : 0 : InvalidateSlideNumberArea();
858 : :
859 [ # # ]: 0 : return 0;
860 : : }
861 : :
862 : : /*************************************************************************
863 : : |*
864 : : |* Handler for StatusEvents
865 : : |*
866 : : \************************************************************************/
867 : :
868 : 0 : IMPL_LINK_NOARG(OutlineView, StatusEventHdl)
869 : : {
870 [ # # ]: 0 : ::sd::Window* pWin = mrOutlineViewShell.GetActiveWindow();
871 [ # # ]: 0 : OutlinerView* pOutlinerView = GetViewByWindow(pWin);
872 [ # # ]: 0 : Rectangle aVis = pOutlinerView->GetVisArea();
873 : 0 : sal_uLong nWidth = OUTLINE_PAPERWIDTH;
874 : : Rectangle aText = Rectangle(Point(0,0),
875 : : Size(nWidth,
876 [ # # ][ # # ]: 0 : mrOutliner.GetTextHeight()));
877 [ # # ]: 0 : Rectangle aWin(Point(0,0), pWin->GetOutputSizePixel());
878 [ # # ]: 0 : aWin = pWin->PixelToLogic(aWin);
879 : :
880 [ # # ][ # # ]: 0 : if (!aVis.IsEmpty()) // not when opening
881 : : {
882 [ # # ]: 0 : aText.Bottom() += aWin.GetHeight();
883 : :
884 : : mrOutlineViewShell.InitWindows(Point(0,0), aText.GetSize(),
885 [ # # ][ # # ]: 0 : Point(aVis.TopLeft()));
886 [ # # ]: 0 : mrOutlineViewShell.UpdateScrollBars();
887 : : }
888 : :
889 : 0 : InvalidateSlideNumberArea();
890 : 0 : return 0;
891 : : }
892 : :
893 : 0 : IMPL_LINK_NOARG(OutlineView, BeginDropHdl)
894 : : {
895 : : DBG_ASSERT(maDragAndDropModelGuard.get() == 0, "sd::OutlineView::BeginDropHdl(), prior drag operation not finished correctly!" );
896 : :
897 [ # # ]: 0 : maDragAndDropModelGuard.reset( new OutlineViewModelChangeGuard( *this ) );
898 : 0 : return 0;
899 : : }
900 : :
901 : 0 : IMPL_LINK_NOARG(OutlineView, EndDropHdl)
902 : : {
903 : 0 : maDragAndDropModelGuard.reset(0);
904 : 0 : InvalidateSlideNumberArea();
905 : 0 : return 0;
906 : : }
907 : :
908 : : /*************************************************************************
909 : : |*
910 : : |* Handler for the start of a paragraph movement
911 : : |*
912 : : \************************************************************************/
913 : :
914 : 0 : IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner )
915 : : {
916 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(this);
917 : :
918 : : // list of selected title paragraphs
919 [ # # ]: 0 : mpOutlinerView[0]->CreateSelectionList(maSelectedParas);
920 : :
921 [ # # ][ # # ]: 0 : for (std::vector<Paragraph*>::iterator it = maSelectedParas.begin(); it != maSelectedParas.end();)
922 : : {
923 [ # # ][ # # ]: 0 : if (!pOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE))
924 [ # # ]: 0 : it = maSelectedParas.erase(it);
925 : : else
926 : 0 : ++it;
927 : : }
928 : :
929 : : // select the pages belonging to the paragraphs on level 0 to select
930 : 0 : sal_uInt16 nPos = 0;
931 : 0 : sal_uLong nParaPos = 0;
932 [ # # ]: 0 : Paragraph* pPara = pOutliner->GetParagraph( 0 );
933 : 0 : std::vector<Paragraph*>::const_iterator fiter;
934 : :
935 [ # # ]: 0 : while(pPara)
936 : : {
937 [ # # ][ # # ]: 0 : if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page?
938 : : {
939 [ # # ]: 0 : maOldParaOrder.push_back(pPara);
940 [ # # ]: 0 : SdPage* pPage = mrDoc.GetSdPage(nPos, PK_STANDARD);
941 : :
942 [ # # ][ # # ]: 0 : fiter = std::find(maSelectedParas.begin(),maSelectedParas.end(),pPara);
943 : :
944 [ # # ]: 0 : pPage->SetSelected(fiter != maSelectedParas.end());
945 : :
946 : 0 : ++nPos;
947 : : }
948 [ # # ]: 0 : pPara = pOutliner->GetParagraph( ++nParaPos );
949 : : }
950 : :
951 [ # # ]: 0 : return 0;
952 : : }
953 : :
954 : : /*************************************************************************
955 : : |*
956 : : |* Handler for the end of a paragraph movement
957 : : |*
958 : : \************************************************************************/
959 : :
960 : 0 : IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner )
961 : : {
962 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(this);
963 : :
964 : : DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::EndMovingHdl(), model change without undo?!" );
965 : :
966 : : // look for insertion position via the first paragraph
967 [ # # ][ # # ]: 0 : Paragraph* pSearchIt = maSelectedParas.empty() ? NULL : *(maSelectedParas.begin());
968 : :
969 : : // look for the first of the selected paragraphs in the new ordering
970 : 0 : sal_uInt16 nPosNewOrder = 0;
971 : 0 : sal_uLong nParaPos = 0;
972 [ # # ]: 0 : Paragraph* pPara = pOutliner->GetParagraph( 0 );
973 : 0 : Paragraph* pPrev = NULL;
974 [ # # ][ # # ]: 0 : while (pPara && pPara != pSearchIt)
[ # # ]
975 : : {
976 [ # # ][ # # ]: 0 : if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
977 : : {
978 : 0 : nPosNewOrder++;
979 : 0 : pPrev = pPara;
980 : : }
981 [ # # ]: 0 : pPara = pOutliner->GetParagraph( ++nParaPos );
982 : : }
983 : :
984 : 0 : sal_uInt16 nPos = nPosNewOrder; // don't change nPosNewOrder
985 [ # # ]: 0 : if (nPos == 0)
986 : : {
987 : 0 : nPos = (sal_uInt16)-1; // insert before the first page
988 : : }
989 : : else
990 : : {
991 : : // look for the predecessor in the old ordering
992 : : std::vector<Paragraph*>::const_iterator it = std::find(maOldParaOrder.begin(),
993 : : maOldParaOrder.end(),
994 [ # # ][ # # ]: 0 : pPrev);
995 : :
996 [ # # ][ # # ]: 0 : if (it != maOldParaOrder.end())
997 [ # # ]: 0 : nPos = static_cast<sal_uInt16>(it-maOldParaOrder.begin());
998 : : else
999 : 0 : nPos = 0xffff;
1000 : :
1001 : : DBG_ASSERT(nPos != 0xffff, "Absatz nicht gefunden");
1002 : : }
1003 : :
1004 [ # # ]: 0 : mrDoc.MovePages(nPos);
1005 : :
1006 : : // deselect the pages again
1007 : 0 : sal_uInt16 nPageCount = (sal_uInt16)maSelectedParas.size();
1008 [ # # ]: 0 : while (nPageCount)
1009 : : {
1010 [ # # ]: 0 : SdPage* pPage = mrDoc.GetSdPage(nPosNewOrder, PK_STANDARD);
1011 : 0 : pPage->SetSelected(sal_False);
1012 : 0 : nPosNewOrder++;
1013 : 0 : nPageCount--;
1014 : : }
1015 : :
1016 [ # # ]: 0 : pOutliner->UpdateFields();
1017 : :
1018 : 0 : maSelectedParas.clear();
1019 : 0 : maOldParaOrder.clear();
1020 : :
1021 : 0 : InvalidateSlideNumberArea();
1022 : :
1023 [ # # ]: 0 : return 0;
1024 : : }
1025 : :
1026 : : /*************************************************************************
1027 : : |*
1028 : : |* Look for the title text object in one page of the model
1029 : : |*
1030 : : \************************************************************************/
1031 : :
1032 : 0 : SdrTextObj* OutlineView::GetTitleTextObject(SdrPage* pPage)
1033 : : {
1034 : 0 : sal_uLong nObjectCount = pPage->GetObjCount();
1035 : 0 : SdrObject* pObject = NULL;
1036 : 0 : SdrTextObj* pResult = NULL;
1037 : :
1038 [ # # ]: 0 : for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
1039 : : {
1040 : 0 : pObject = pPage->GetObj(nObject);
1041 [ # # ]: 0 : if (pObject->GetObjInventor() == SdrInventor &&
[ # # # # ]
1042 : 0 : pObject->GetObjIdentifier() == OBJ_TITLETEXT)
1043 : : {
1044 : 0 : pResult = (SdrTextObj*)pObject;
1045 : 0 : break;
1046 : : }
1047 : : }
1048 : 0 : return pResult;
1049 : : }
1050 : :
1051 : :
1052 : : /*************************************************************************
1053 : : |*
1054 : : |* Look for the outline text object in one page of the model
1055 : : |*
1056 : : \************************************************************************/
1057 : :
1058 : 0 : SdrTextObj* OutlineView::GetOutlineTextObject(SdrPage* pPage)
1059 : : {
1060 : 0 : sal_uLong nObjectCount = pPage->GetObjCount();
1061 : 0 : SdrObject* pObject = NULL;
1062 : 0 : SdrTextObj* pResult = NULL;
1063 : :
1064 [ # # ]: 0 : for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
1065 : : {
1066 : 0 : pObject = pPage->GetObj(nObject);
1067 [ # # ]: 0 : if (pObject->GetObjInventor() == SdrInventor &&
[ # # # # ]
1068 : 0 : pObject->GetObjIdentifier() == OBJ_OUTLINETEXT)
1069 : : {
1070 : 0 : pResult = (SdrTextObj*)pObject;
1071 : 0 : break;
1072 : : }
1073 : : }
1074 : 0 : return pResult;
1075 : : }
1076 : :
1077 : 0 : SdrTextObj* OutlineView::CreateTitleTextObject(SdPage* pPage)
1078 : : {
1079 : : DBG_ASSERT( GetTitleTextObject(pPage) == 0, "sd::OutlineView::CreateTitleTextObject(), there is already a title text object!" );
1080 : :
1081 [ # # ]: 0 : if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE )
1082 : : {
1083 : : // simple case
1084 : 0 : pPage->SetAutoLayout( AUTOLAYOUT_ONLY_TITLE, true );
1085 : : }
1086 : : else
1087 : : {
1088 : : // we already have a layout with a title but the title
1089 : : // object was deleted, create a new one
1090 : 0 : pPage->InsertAutoLayoutShape( 0, PRESOBJ_TITLE, false, pPage->GetTitleRect(), true );
1091 : : }
1092 : :
1093 : 0 : return GetTitleTextObject(pPage);
1094 : : }
1095 : :
1096 : 0 : SdrTextObj* OutlineView::CreateOutlineTextObject(SdPage* pPage)
1097 : : {
1098 : : DBG_ASSERT( GetOutlineTextObject(pPage) == 0, "sd::OutlineView::CreateOutlineTextObject(), there is already a layout text object!" );
1099 : :
1100 : 0 : AutoLayout eNewLayout = pPage->GetAutoLayout();
1101 [ # # # # ]: 0 : switch( eNewLayout )
1102 : : {
1103 : : case AUTOLAYOUT_NONE:
1104 : : case AUTOLAYOUT_ONLY_TITLE:
1105 : 0 : case AUTOLAYOUT_TITLE: eNewLayout = AUTOLAYOUT_ENUM; break;
1106 : :
1107 : 0 : case AUTOLAYOUT_CHART: eNewLayout = AUTOLAYOUT_CHARTTEXT; break;
1108 : :
1109 : : case AUTOLAYOUT_ORG:
1110 : : case AUTOLAYOUT_TAB:
1111 : 0 : case AUTOLAYOUT_OBJ: eNewLayout = AUTOLAYOUT_OBJTEXT; break;
1112 : : default:
1113 : 0 : break;
1114 : : }
1115 : :
1116 [ # # ]: 0 : if( eNewLayout != pPage->GetAutoLayout() )
1117 : : {
1118 : 0 : pPage->SetAutoLayout( eNewLayout, true );
1119 : : }
1120 : : else
1121 : : {
1122 : : // we already have a layout with a text but the text
1123 : : // object was deleted, create a new one
1124 : : pPage->InsertAutoLayoutShape( 0,
1125 : : (eNewLayout == AUTOLAYOUT_TITLE) ? PRESOBJ_TEXT : PRESOBJ_OUTLINE,
1126 [ # # ]: 0 : false, pPage->GetLayoutRect(), true );
1127 : : }
1128 : :
1129 : 0 : return GetOutlineTextObject(pPage);
1130 : : }
1131 : :
1132 : : /** updates draw model with all changes from outliner model */
1133 : 0 : sal_Bool OutlineView::PrepareClose(sal_Bool)
1134 : : {
1135 [ # # ][ # # ]: 0 : ::sd::UndoManager* pDocUndoMgr = dynamic_cast<sd::UndoManager*>(mpDocSh->GetUndoManager());
1136 [ # # ]: 0 : if (pDocUndoMgr != NULL)
1137 [ # # ]: 0 : pDocUndoMgr->SetLinkedUndoManager(NULL);
1138 : :
1139 [ # # ][ # # ]: 0 : mrOutliner.GetUndoManager().Clear();
1140 : :
1141 [ # # ][ # # ]: 0 : const String aUndoStr(SdResId(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
1142 [ # # ]: 0 : BegUndo(aUndoStr);
1143 [ # # ]: 0 : UpdateDocument();
1144 [ # # ]: 0 : EndUndo();
1145 [ # # ][ # # ]: 0 : mrDoc.SetSelected(GetActualPage(), sal_True);
1146 [ # # ]: 0 : return sal_True;
1147 : : }
1148 : :
1149 : :
1150 : : /*************************************************************************
1151 : : |*
1152 : : |* Set attributes of the selected text
1153 : : |*
1154 : : \************************************************************************/
1155 : :
1156 : 0 : sal_Bool OutlineView::SetAttributes(const SfxItemSet& rSet, sal_Bool )
1157 : : {
1158 : 0 : sal_Bool bOk = sal_False;
1159 : :
1160 : 0 : OutlinerView* pOlView = GetViewByWindow(mrOutlineViewShell.GetActiveWindow());
1161 : :
1162 [ # # ]: 0 : if (pOlView)
1163 : : {
1164 : 0 : pOlView->SetAttribs(rSet);
1165 : 0 : bOk = sal_True;
1166 : : }
1167 : :
1168 : 0 : mrOutlineViewShell.Invalidate (SID_PREVIEW_STATE);
1169 : :
1170 : 0 : return (bOk);
1171 : : }
1172 : :
1173 : : /*************************************************************************
1174 : : |*
1175 : : |* Get attributes of the selected text
1176 : : |*
1177 : : \************************************************************************/
1178 : :
1179 : 0 : sal_Bool OutlineView::GetAttributes( SfxItemSet& rTargetSet, sal_Bool ) const
1180 : : {
1181 : : OutlinerView* pOlView = GetViewByWindow(
1182 : 0 : mrOutlineViewShell.GetActiveWindow());
1183 : : DBG_ASSERT(pOlView, "keine OutlinerView gefunden");
1184 : :
1185 [ # # ]: 0 : rTargetSet.Put( pOlView->GetAttribs(), sal_False );
1186 : 0 : return sal_True;
1187 : : }
1188 : :
1189 : : /** creates outliner model from draw model */
1190 : 0 : void OutlineView::FillOutliner()
1191 : : {
1192 : 0 : mrOutliner.GetUndoManager().Clear();
1193 : 0 : mrOutliner.EnableUndo(sal_False);
1194 : 0 : ResetLinks();
1195 : 0 : mrOutliner.SetUpdateMode(false);
1196 : :
1197 : 0 : Paragraph* pTitleToSelect = NULL;
1198 : 0 : sal_uLong nPageCount = mrDoc.GetSdPageCount(PK_STANDARD);
1199 : :
1200 : : // fill outliner with paragraphs from slides title & (outlines|subtitles)
1201 [ # # ]: 0 : for (sal_uInt16 nPage = 0; nPage < nPageCount; nPage++)
1202 : : {
1203 : 0 : SdPage* pPage = (SdPage*)mrDoc.GetSdPage(nPage, PK_STANDARD);
1204 : 0 : Paragraph * pPara = NULL;
1205 : :
1206 : : // take text from title shape
1207 : 0 : SdrTextObj* pTO = GetTitleTextObject(pPage);
1208 [ # # ][ # # ]: 0 : if(pTO && !(pTO->IsEmptyPresObj()))
[ # # ]
1209 : : {
1210 : 0 : OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
1211 [ # # ]: 0 : if (pOPO)
1212 : : {
1213 : 0 : sal_Bool bVertical = pOPO->IsVertical();
1214 : 0 : pOPO->SetVertical( sal_False );
1215 : 0 : mrOutliner.AddText(*pOPO);
1216 : 0 : pOPO->SetVertical( bVertical );
1217 : 0 : pPara = mrOutliner.GetParagraph( mrOutliner.GetParagraphCount()-1 );
1218 : : }
1219 : : }
1220 : :
1221 [ # # ]: 0 : if( pPara == 0 ) // no title, insert an empty paragraph
1222 : : {
1223 [ # # ]: 0 : pPara = mrOutliner.Insert(String());
1224 : 0 : mrOutliner.SetDepth(pPara, -1);
1225 : :
1226 : : // do not apply hard attributes from the previous paragraph
1227 : 0 : mrOutliner.SetParaAttribs( (sal_uInt16)mrOutliner.GetAbsPos(pPara),
1228 : 0 : mrOutliner.GetEmptyItemSet() );
1229 : :
1230 : 0 : mrOutliner.SetStyleSheet( mrOutliner.GetAbsPos( pPara ), pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ) );
1231 : : }
1232 : :
1233 : 0 : mrOutliner.SetParaFlag( pPara, PARAFLAG_ISPAGE );
1234 : :
1235 : 0 : sal_uLong nPara = mrOutliner.GetAbsPos( pPara );
1236 : :
1237 : 0 : UpdateParagraph( (sal_uInt16)nPara );
1238 : :
1239 : : // remember paragraph of currently selected page
1240 [ # # ]: 0 : if (pPage->IsSelected())
1241 : 0 : pTitleToSelect = pPara;
1242 : :
1243 : : // take text from subtitle or outline
1244 : 0 : pTO = static_cast<SdrTextObj*>(pPage->GetPresObj(PRESOBJ_TEXT));
1245 : 0 : const bool bSubTitle = pTO != 0;
1246 : :
1247 [ # # ]: 0 : if (!pTO) // if no subtile found, try outline
1248 : 0 : pTO = GetOutlineTextObject(pPage);
1249 : :
1250 [ # # ][ # # ]: 0 : if(pTO && !(pTO->IsEmptyPresObj())) // found some text
[ # # ]
1251 : : {
1252 : 0 : OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
1253 [ # # ]: 0 : if (pOPO)
1254 : : {
1255 : 0 : sal_uInt16 nParaCount1 = (sal_uInt16)mrOutliner.GetParagraphCount();
1256 : 0 : sal_Bool bVertical = pOPO->IsVertical();
1257 : 0 : pOPO->SetVertical( sal_False );
1258 : 0 : mrOutliner.AddText(*pOPO);
1259 : 0 : pOPO->SetVertical( bVertical );
1260 : :
1261 : 0 : sal_uInt16 nParaCount2 = (sal_uInt16)mrOutliner.GetParagraphCount();
1262 [ # # ]: 0 : for (sal_uInt16 n = nParaCount1; n < nParaCount2; n++)
1263 : : {
1264 [ # # ]: 0 : if( bSubTitle )
1265 : : {
1266 : 0 : Paragraph* p = mrOutliner.GetParagraph(n);
1267 [ # # ][ # # ]: 0 : if(p && mrOutliner.GetDepth( n ) > 0 )
[ # # ]
1268 : 0 : mrOutliner.SetDepth(p, 0);
1269 : : }
1270 : :
1271 : 0 : UpdateParagraph( n );
1272 : : }
1273 : : }
1274 : : }
1275 : : }
1276 : :
1277 : : // place cursor at the start
1278 : 0 : Paragraph* pFirstPara = mrOutliner.GetParagraph( 0 );
1279 : 0 : mpOutlinerView[0]->Select( pFirstPara, sal_True, sal_False );
1280 : 0 : mpOutlinerView[0]->Select( pFirstPara, sal_False, sal_False );
1281 : :
1282 : : // select title of slide that was selected
1283 [ # # ]: 0 : if (pTitleToSelect)
1284 : 0 : mpOutlinerView[0]->Select(pTitleToSelect, sal_True, sal_False);
1285 : :
1286 : 0 : SetLinks();
1287 : :
1288 : 0 : mrOutliner.EnableUndo(sal_True);
1289 : :
1290 : 0 : mrOutliner.SetUpdateMode(true);
1291 : 0 : }
1292 : :
1293 : : /*************************************************************************
1294 : : |*
1295 : : |* Handler for deleting of level 0 paragraphs (pages): Warning
1296 : : |*
1297 : : \************************************************************************/
1298 : :
1299 : 0 : IMPL_LINK_NOARG(OutlineView, RemovingPagesHdl)
1300 : : {
1301 : 0 : sal_uInt16 nNumOfPages = mrOutliner.GetSelPageCount();
1302 : :
1303 [ # # ]: 0 : if (nNumOfPages > PROCESS_WITH_PROGRESS_THRESHOLD)
1304 : : {
1305 : 0 : mnPagesToProcess = nNumOfPages;
1306 : 0 : mnPagesProcessed = 0;
1307 : : }
1308 : :
1309 [ # # ]: 0 : if (mnPagesToProcess)
1310 : : {
1311 [ # # ]: 0 : if( mpProgress )
1312 [ # # ][ # # ]: 0 : delete mpProgress;
1313 : :
1314 [ # # ][ # # ]: 0 : String aStr(SdResId(STR_DELETE_PAGES));
1315 [ # # ][ # # ]: 0 : mpProgress = new SfxProgress( GetDocSh(), aStr, mnPagesToProcess );
[ # # ]
1316 : : }
1317 : 0 : mrOutliner.UpdateFields();
1318 : :
1319 : 0 : InvalidateSlideNumberArea();
1320 : :
1321 : 0 : return 1;
1322 : : }
1323 : :
1324 : : /*************************************************************************
1325 : : |*
1326 : : |* Handler for indenting level 0 paragraphs (pages): Warning
1327 : : |*
1328 : : \************************************************************************/
1329 : :
1330 : 0 : IMPL_LINK_INLINE_START( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView )
1331 : : {
1332 : 0 : return RemovingPagesHdl(pOutlinerView);
1333 : : }
1334 : 0 : IMPL_LINK_INLINE_END( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView )
1335 : :
1336 : :
1337 : : /** returns the first slide that is selected in the outliner or where
1338 : : the cursor is located */
1339 : 0 : SdPage* OutlineView::GetActualPage()
1340 : : {
1341 [ # # ]: 0 : ::sd::Window* pWin = mrOutlineViewShell.GetActiveWindow();
1342 [ # # ]: 0 : OutlinerView* pActiveView = GetViewByWindow(pWin);
1343 : :
1344 [ # # ]: 0 : std::vector<Paragraph*> aSelList;
1345 [ # # ]: 0 : pActiveView->CreateSelectionList(aSelList);
1346 : :
1347 [ # # ][ # # ]: 0 : Paragraph *pPar = aSelList.empty() ? NULL : *(aSelList.begin());
1348 [ # # ]: 0 : SdPage* pCurrent = GetPageForParagraph(pPar);
1349 : :
1350 : : DBG_ASSERT( pCurrent ||
1351 : : (mpDocSh->GetUndoManager() && static_cast< sd::UndoManager *>(mpDocSh->GetUndoManager())->IsDoing()) ||
1352 : : maDragAndDropModelGuard.get(),
1353 : : "sd::OutlineView::GetActualPage(), no current page?" );
1354 : :
1355 [ # # ]: 0 : if( pCurrent )
1356 : 0 : return pCurrent;
1357 : :
1358 [ # # ]: 0 : return mrDoc.GetSdPage( 0, PK_STANDARD );
1359 : : }
1360 : :
1361 : 0 : SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara )
1362 : : {
1363 [ # # ]: 0 : if( !mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) )
1364 : 0 : pPara = GetPrevTitle(pPara);
1365 : :
1366 : 0 : sal_uInt32 nPageToSelect = 0;
1367 [ # # ]: 0 : while(pPara)
1368 : : {
1369 : 0 : pPara = GetPrevTitle(pPara);
1370 [ # # ]: 0 : if(pPara)
1371 : 0 : nPageToSelect++;
1372 : : }
1373 : :
1374 [ # # ]: 0 : if( nPageToSelect < (sal_uInt32)mrDoc.GetSdPageCount( PK_STANDARD ) )
1375 : 0 : return static_cast< SdPage* >( mrDoc.GetSdPage( (sal_uInt16)nPageToSelect, PK_STANDARD) );
1376 : :
1377 : 0 : return 0;
1378 : : }
1379 : :
1380 : 0 : Paragraph* OutlineView::GetParagraphForPage( ::Outliner& rOutl, SdPage* pPage )
1381 : : {
1382 : : // get the number of paragraphs with ident 0 we need to skip before
1383 : : // we finde the actual page
1384 : 0 : sal_uInt32 nPagesToSkip = (pPage->GetPageNum() - 1) >> 1;
1385 : :
1386 : 0 : sal_uInt32 nParaPos = 0;
1387 : 0 : Paragraph* pPara = rOutl.GetParagraph( 0 );
1388 [ # # ]: 0 : while( pPara )
1389 : : {
1390 : : // if this paragraph is a page ...
1391 [ # # ]: 0 : if( mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) )
1392 : : {
1393 : : // see if we already skiped enough pages
1394 [ # # ]: 0 : if( 0 == nPagesToSkip )
1395 : 0 : break; // and if so, end the loop
1396 : :
1397 : : // we skiped another page
1398 : 0 : nPagesToSkip--;
1399 : : }
1400 : :
1401 : : // get next paragraph
1402 : 0 : pPara = mrOutliner.GetParagraph( ++nParaPos );
1403 : : }
1404 : :
1405 : 0 : return pPara;
1406 : : }
1407 : :
1408 : : /** selects the paragraph for the given page at the outliner view*/
1409 : 0 : void OutlineView::SetActualPage( SdPage* pActual )
1410 : : {
1411 [ # # ][ # # ]: 0 : if( pActual && dynamic_cast<Outliner&>(mrOutliner).GetIgnoreCurrentPageChangesLevel()==0 && !mbFirstPaint)
[ # # ][ # # ]
[ # # ]
1412 : : {
1413 : : // if we found a paragraph, select its text at the outliner view
1414 : 0 : Paragraph* pPara = GetParagraphForPage( mrOutliner, pActual );
1415 [ # # ]: 0 : if( pPara )
1416 : 0 : mpOutlinerView[0]->Select( pPara, sal_True, sal_False );
1417 : : }
1418 : 0 : }
1419 : :
1420 : : /*************************************************************************
1421 : : |*
1422 : : |* Get StyleSheet from the selection
1423 : : |*
1424 : : \************************************************************************/
1425 : :
1426 : 0 : SfxStyleSheet* OutlineView::GetStyleSheet() const
1427 : : {
1428 : 0 : ::sd::Window* pActWin = mrOutlineViewShell.GetActiveWindow();
1429 : 0 : OutlinerView* pOlView = GetViewByWindow(pActWin);
1430 : 0 : SfxStyleSheet* pResult = pOlView->GetStyleSheet();
1431 : 0 : return pResult;
1432 : : }
1433 : :
1434 : :
1435 : :
1436 : : /*************************************************************************
1437 : : |*
1438 : : |* Mark pages as selected / not selected
1439 : : |*
1440 : : \************************************************************************/
1441 : :
1442 : 0 : void OutlineView::SetSelectedPages()
1443 : : {
1444 : : // list of selected title paragraphs
1445 [ # # ]: 0 : std::vector<Paragraph*> aSelParas;
1446 [ # # ]: 0 : mpOutlinerView[0]->CreateSelectionList(aSelParas);
1447 : :
1448 [ # # ][ # # ]: 0 : for (std::vector<Paragraph*>::iterator it = aSelParas.begin(); it != aSelParas.end();)
1449 : : {
1450 [ # # ][ # # ]: 0 : if (!mrOutliner.HasParaFlag(*it, PARAFLAG_ISPAGE))
1451 [ # # ]: 0 : it = aSelParas.erase(it);
1452 : : else
1453 : 0 : ++it;
1454 : : }
1455 : :
1456 : : // select the pages belonging to the paragraphs on level 0 to select
1457 : 0 : sal_uInt16 nPos = 0;
1458 : 0 : sal_uLong nParaPos = 0;
1459 [ # # ]: 0 : Paragraph *pPara = mrOutliner.GetParagraph( 0 );
1460 : 0 : std::vector<Paragraph*>::const_iterator fiter;
1461 : :
1462 [ # # ]: 0 : while(pPara)
1463 : : {
1464 [ # # ][ # # ]: 0 : if( mrOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page
1465 : : {
1466 [ # # ]: 0 : SdPage* pPage = mrDoc.GetSdPage(nPos, PK_STANDARD);
1467 : : DBG_ASSERT(pPage!=NULL,
1468 : : "Trying to select non-existing page OutlineView::SetSelectedPages()");
1469 : :
1470 [ # # ]: 0 : if (pPage)
1471 : : {
1472 [ # # ][ # # ]: 0 : fiter = std::find(aSelParas.begin(),aSelParas.end(),pPara);
1473 [ # # ]: 0 : pPage->SetSelected(fiter != aSelParas.end());
1474 : : }
1475 : :
1476 : 0 : nPos++;
1477 : : }
1478 : :
1479 [ # # ]: 0 : pPara = mrOutliner.GetParagraph( ++nParaPos );
1480 : 0 : }
1481 : 0 : }
1482 : :
1483 : :
1484 : : /*************************************************************************
1485 : : |*
1486 : : |* Set new links
1487 : : |*
1488 : : \************************************************************************/
1489 : :
1490 : 0 : void OutlineView::SetLinks()
1491 : : {
1492 : : // set notification links
1493 : 0 : mrOutliner.SetParaInsertedHdl(LINK(this, OutlineView, ParagraphInsertedHdl));
1494 : 0 : mrOutliner.SetParaRemovingHdl(LINK(this, OutlineView, ParagraphRemovingHdl));
1495 : 0 : mrOutliner.SetDepthChangedHdl(LINK(this, OutlineView, DepthChangedHdl));
1496 : 0 : mrOutliner.SetBeginMovingHdl(LINK(this, OutlineView, BeginMovingHdl));
1497 : 0 : mrOutliner.SetEndMovingHdl(LINK(this, OutlineView, EndMovingHdl));
1498 : 0 : mrOutliner.SetRemovingPagesHdl(LINK(this, OutlineView, RemovingPagesHdl));
1499 : 0 : mrOutliner.SetIndentingPagesHdl(LINK(this, OutlineView, IndentingPagesHdl));
1500 [ # # ]: 0 : mrOutliner.SetStatusEventHdl(LINK(this, OutlineView, StatusEventHdl));
1501 [ # # ]: 0 : mrOutliner.SetBeginDropHdl(LINK(this,OutlineView, BeginDropHdl));
1502 [ # # ]: 0 : mrOutliner.SetEndDropHdl(LINK(this,OutlineView, EndDropHdl));
1503 : 0 : mrOutliner.SetPaintFirstLineHdl(LINK(this,OutlineView,PaintingFirstLineHdl));
1504 [ # # ]: 0 : mrOutliner.SetBeginPasteOrDropHdl(LINK(this,OutlineView, BeginPasteOrDropHdl));
1505 [ # # ]: 0 : mrOutliner.SetEndPasteOrDropHdl(LINK(this,OutlineView, EndPasteOrDropHdl));
1506 : 0 : }
1507 : :
1508 : :
1509 : :
1510 : : /*************************************************************************
1511 : : |*
1512 : : |* Restore old links
1513 : : |*
1514 : : \************************************************************************/
1515 : :
1516 : 0 : void OutlineView::ResetLinks() const
1517 : : {
1518 [ # # ]: 0 : Link aEmptyLink;
1519 : 0 : mrOutliner.SetParaInsertedHdl(aEmptyLink);
1520 : 0 : mrOutliner.SetParaRemovingHdl(aEmptyLink);
1521 : 0 : mrOutliner.SetDepthChangedHdl(aEmptyLink);
1522 : 0 : mrOutliner.SetBeginMovingHdl(aEmptyLink);
1523 : 0 : mrOutliner.SetEndMovingHdl(aEmptyLink);
1524 [ # # ]: 0 : mrOutliner.SetStatusEventHdl(aEmptyLink);
1525 : 0 : mrOutliner.SetRemovingPagesHdl(aEmptyLink);
1526 : 0 : mrOutliner.SetIndentingPagesHdl(aEmptyLink);
1527 : 0 : mrOutliner.SetDrawPortionHdl(aEmptyLink);
1528 [ # # ]: 0 : mrOutliner.SetBeginPasteOrDropHdl(aEmptyLink);
1529 [ # # ]: 0 : mrOutliner.SetEndPasteOrDropHdl(aEmptyLink);
1530 : 0 : }
1531 : :
1532 : : /*************************************************************************
1533 : : |*
1534 : : |* AcceptDrop
1535 : : |*
1536 : : \************************************************************************/
1537 : :
1538 : 0 : sal_Int8 OutlineView::AcceptDrop( const AcceptDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16)
1539 : : {
1540 : 0 : return DND_ACTION_NONE;
1541 : : }
1542 : :
1543 : : /*************************************************************************
1544 : : |*
1545 : : |* ExecuteDrop
1546 : : |*
1547 : : \************************************************************************/
1548 : :
1549 : 0 : sal_Int8 OutlineView::ExecuteDrop( const ExecuteDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16)
1550 : : {
1551 : 0 : return DND_ACTION_NONE;
1552 : : }
1553 : :
1554 : : // Re-implement GetScriptType for this view to get correct results
1555 : 0 : sal_uInt16 OutlineView::GetScriptType() const
1556 : : {
1557 : 0 : sal_uInt16 nScriptType = ::sd::View::GetScriptType();
1558 : :
1559 : 0 : OutlinerParaObject* pTempOPObj = mrOutliner.CreateParaObject();
1560 [ # # ]: 0 : if(pTempOPObj)
1561 : : {
1562 : 0 : nScriptType = pTempOPObj->GetTextObject().GetScriptType();
1563 [ # # ]: 0 : delete pTempOPObj;
1564 : : }
1565 : :
1566 : 0 : return nScriptType;
1567 : : }
1568 : :
1569 : 0 : void OutlineView::onUpdateStyleSettings( bool bForceUpdate /* = false */ )
1570 : : {
1571 [ # # ]: 0 : svtools::ColorConfig aColorConfig;
1572 [ # # ]: 0 : const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
1573 [ # # ][ # # ]: 0 : if( bForceUpdate || (maDocColor != aDocColor) )
[ # # ]
1574 : : {
1575 : : sal_uInt16 nView;
1576 [ # # ]: 0 : for( nView = 0; nView < MAX_OUTLINERVIEWS; nView++ )
1577 : : {
1578 [ # # ]: 0 : if (mpOutlinerView[nView] != NULL)
1579 : : {
1580 [ # # ]: 0 : mpOutlinerView[nView]->SetBackgroundColor( aDocColor );
1581 : :
1582 [ # # ]: 0 : ::Window* pWindow = mpOutlinerView[nView]->GetWindow();
1583 : :
1584 [ # # ]: 0 : if( pWindow )
1585 [ # # ][ # # ]: 0 : pWindow->SetBackground( Wallpaper( aDocColor ) );
[ # # ]
1586 : :
1587 : : }
1588 : : }
1589 : :
1590 [ # # ]: 0 : mrOutliner.SetBackgroundColor( aDocColor );
1591 : :
1592 : 0 : maDocColor = aDocColor;
1593 [ # # ]: 0 : }
1594 : 0 : }
1595 : :
1596 : 0 : IMPL_LINK_NOARG(OutlineView, AppEventListenerHdl)
1597 : : {
1598 : 0 : onUpdateStyleSettings();
1599 : 0 : return 0;
1600 : : }
1601 : :
1602 : :
1603 : :
1604 : :
1605 : 0 : IMPL_LINK(OutlineView, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
1606 : : {
1607 [ # # ]: 0 : if (pEvent != NULL)
1608 : : {
1609 [ # # # ]: 0 : switch (pEvent->meEventId)
1610 : : {
1611 : : case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
1612 : 0 : SetActualPage(mrOutlineViewShell.GetActualPage());
1613 : 0 : InvalidateSlideNumberArea();
1614 : 0 : break;
1615 : :
1616 : : case tools::EventMultiplexerEvent::EID_PAGE_ORDER:
1617 [ # # ][ # # ]: 0 : if (dynamic_cast<Outliner&>(mrOutliner).GetIgnoreCurrentPageChangesLevel()==0)
1618 : : {
1619 [ # # ]: 0 : if (((mrDoc.GetPageCount()-1)%2) == 0)
1620 : : {
1621 : 0 : mrOutliner.Clear();
1622 : 0 : FillOutliner();
1623 : 0 : ::sd::Window* pWindow = mrOutlineViewShell.GetActiveWindow();
1624 [ # # ]: 0 : if (pWindow != NULL)
1625 : 0 : pWindow->Invalidate();
1626 : : }
1627 : : }
1628 : 0 : break;
1629 : : }
1630 : : }
1631 : 0 : return 0;
1632 : : }
1633 : :
1634 : 0 : void OutlineView::IgnoreCurrentPageChanges (bool bIgnoreChanges)
1635 : : {
1636 [ # # ]: 0 : if (bIgnoreChanges)
1637 [ # # ]: 0 : dynamic_cast<Outliner&>(mrOutliner).IncreIgnoreCurrentPageChangesLevel();
1638 : : else
1639 [ # # ]: 0 : dynamic_cast<Outliner&>(mrOutliner).DecreIgnoreCurrentPageChangesLevel();
1640 : 0 : }
1641 : :
1642 : : /** call this method before you do anything that can modify the outliner
1643 : : and or the drawing document model. It will create needed undo actions */
1644 : 0 : void OutlineView::BeginModelChange()
1645 : : {
1646 [ # # ]: 0 : const String aEmpty;
1647 [ # # ][ # # ]: 0 : mrOutliner.GetUndoManager().EnterListAction(aEmpty,aEmpty);
1648 [ # # ][ # # ]: 0 : const String aUndoStr(SdResId(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
1649 [ # # ][ # # ]: 0 : BegUndo(aUndoStr);
[ # # ]
1650 : 0 : }
1651 : :
1652 : : /** call this method after BeginModelChange(), when all possible model
1653 : : changes are done. */
1654 : 0 : void OutlineView::EndModelChange()
1655 : : {
1656 : 0 : UpdateDocument();
1657 : :
1658 : 0 : ::svl::IUndoManager* pDocUndoMgr = mpDocSh->GetUndoManager();
1659 : :
1660 : 0 : bool bHasUndoActions = pDocUndoMgr->GetUndoActionCount() != 0;
1661 : :
1662 : 0 : EndUndo();
1663 : :
1664 : : DBG_ASSERT( bHasUndoActions == (mrOutliner.GetUndoManager().GetUndoActionCount() != 0), "sd::OutlineView::EndModelChange(), undo actions not in sync!" );
1665 : :
1666 : 0 : mrOutliner.GetUndoManager().LeaveListAction();
1667 : :
1668 [ # # ][ # # ]: 0 : if( bHasUndoActions && mrOutliner.GetEditEngine().HasTriedMergeOnLastAddUndo() )
[ # # ]
1669 : 0 : TryToMergeUndoActions();
1670 : :
1671 : 0 : mrOutlineViewShell.Invalidate( SID_UNDO );
1672 : 0 : mrOutlineViewShell.Invalidate( SID_REDO );
1673 : 0 : }
1674 : :
1675 : : /** updates all changes in the outliner model to the draw model */
1676 : 0 : void OutlineView::UpdateDocument()
1677 : : {
1678 : 0 : const sal_uInt32 nPageCount = mrDoc.GetSdPageCount(PK_STANDARD);
1679 : 0 : Paragraph* pPara = mrOutliner.GetParagraph( 0 );
1680 : : sal_uInt32 nPage;
1681 [ # # ]: 0 : for (nPage = 0; nPage < nPageCount; nPage++)
1682 : : {
1683 : 0 : SdPage* pPage = mrDoc.GetSdPage( (sal_uInt16)nPage, PK_STANDARD);
1684 : 0 : mrDoc.SetSelected(pPage, sal_False);
1685 : :
1686 : 0 : mrOutlineViewShell.UpdateTitleObject( pPage, pPara );
1687 : 0 : mrOutlineViewShell.UpdateOutlineObject( pPage, pPara );
1688 : :
1689 [ # # ]: 0 : if( pPara )
1690 : 0 : pPara = GetNextTitle(pPara);
1691 : : }
1692 : :
1693 : : DBG_ASSERT( pPara == 0, "sd::OutlineView::UpdateDocument(), slides are out of sync, creating missing ones" );
1694 [ # # ]: 0 : while( pPara )
1695 : : {
1696 : 0 : SdPage* pPage = InsertSlideForParagraph( pPara );
1697 : 0 : mrDoc.SetSelected(pPage, sal_False);
1698 : :
1699 : 0 : mrOutlineViewShell.UpdateTitleObject( pPage, pPara );
1700 : 0 : mrOutlineViewShell.UpdateOutlineObject( pPage, pPara );
1701 : :
1702 [ # # ]: 0 : if( pPara )
1703 : 0 : pPara = GetNextTitle(pPara);
1704 : : }
1705 : 0 : }
1706 : :
1707 : : /** merge edit engine undo actions if possible */
1708 : 0 : void OutlineView::TryToMergeUndoActions()
1709 : : {
1710 : 0 : ::svl::IUndoManager& rOutlineUndo = mrOutliner.GetUndoManager();
1711 [ # # ]: 0 : if( rOutlineUndo.GetUndoActionCount() > 1 )
1712 : : {
1713 [ # # ]: 0 : SfxListUndoAction* pListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(0) );
1714 [ # # ]: 0 : SfxListUndoAction* pPrevListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(1) );
1715 [ # # ][ # # ]: 0 : if( pListAction && pPrevListAction )
1716 : : {
1717 : : // find the top EditUndo action in the top undo action list
1718 : 0 : size_t nAction = pListAction->aUndoActions.size();
1719 : 0 : EditUndo* pEditUndo = 0;
1720 [ # # ][ # # ]: 0 : while( !pEditUndo && nAction )
[ # # ]
1721 : : {
1722 [ # # ]: 0 : pEditUndo = dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction);
1723 : : }
1724 : :
1725 : 0 : sal_uInt16 nEditPos = nAction; // we need this later to remove the merged undo actions
1726 : :
1727 : : // make sure it is the only EditUndo action in the top undo list
1728 [ # # ][ # # ]: 0 : while( pEditUndo && nAction )
[ # # ]
1729 : : {
1730 [ # # ][ # # ]: 0 : if( dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction) )
[ # # ]
1731 : 0 : pEditUndo = 0;
1732 : : }
1733 : :
1734 : : // do we have one and only one EditUndo action in the top undo list?
1735 [ # # ]: 0 : if( pEditUndo )
1736 : : {
1737 : : // yes, see if we can merge it with the prev undo list
1738 : :
1739 : 0 : nAction = pPrevListAction->aUndoActions.size();
1740 : 0 : EditUndo* pPrevEditUndo = 0;
1741 [ # # ][ # # ]: 0 : while( !pPrevEditUndo && nAction )
[ # # ]
1742 [ # # ]: 0 : pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->aUndoActions[--nAction].pAction);
1743 : :
1744 [ # # ][ # # ]: 0 : if( pPrevEditUndo && pPrevEditUndo->Merge( pEditUndo ) )
[ # # ]
1745 : : {
1746 : : // ok we merged the only EditUndo of the top undo list with
1747 : : // the top EditUndo of the previous undo list
1748 : :
1749 : : // first remove the merged undo action
1750 : : DBG_ASSERT( pListAction->aUndoActions[nEditPos].pAction == pEditUndo,
1751 : : "sd::OutlineView::TryToMergeUndoActions(), wrong edit pos!" );
1752 : 0 : pListAction->aUndoActions.Remove(nEditPos);
1753 [ # # ]: 0 : delete pEditUndo;
1754 : :
1755 : : // now check if we also can merge the draw undo actions
1756 : 0 : ::svl::IUndoManager* pDocUndoManager = mpDocSh->GetUndoManager();
1757 [ # # ][ # # ]: 0 : if( pDocUndoManager && ( pListAction->aUndoActions.size() == 1 ))
[ # # ]
1758 : : {
1759 [ # # ]: 0 : SfxLinkUndoAction* pLinkAction = dynamic_cast< SfxLinkUndoAction* >( pListAction->aUndoActions[0].pAction );
1760 : 0 : SfxLinkUndoAction* pPrevLinkAction = 0;
1761 : :
1762 [ # # ]: 0 : if( pLinkAction )
1763 : : {
1764 : 0 : nAction = pPrevListAction->aUndoActions.size();
1765 [ # # ][ # # ]: 0 : while( !pPrevLinkAction && nAction )
[ # # ]
1766 [ # # ]: 0 : pPrevLinkAction = dynamic_cast< SfxLinkUndoAction* >(pPrevListAction->aUndoActions[--nAction].pAction);
1767 : : }
1768 : :
1769 [ # # ][ # # : 0 : if( pLinkAction && pPrevLinkAction &&
# # # # ]
[ # # ]
1770 : 0 : ( pLinkAction->GetAction() == pDocUndoManager->GetUndoAction(0) ) &&
1771 : 0 : ( pPrevLinkAction->GetAction() == pDocUndoManager->GetUndoAction(1) ) )
1772 : : {
1773 [ # # ]: 0 : SfxListUndoAction* pSourceList = dynamic_cast< SfxListUndoAction* >(pLinkAction->GetAction());
1774 [ # # ]: 0 : SfxListUndoAction* pDestinationList = dynamic_cast< SfxListUndoAction* >(pPrevLinkAction->GetAction());
1775 : :
1776 [ # # ][ # # ]: 0 : if( pSourceList && pDestinationList )
1777 : : {
1778 : 0 : sal_uInt16 nCount = pSourceList->aUndoActions.size();
1779 : 0 : sal_uInt16 nDestAction = pDestinationList->aUndoActions.size();
1780 [ # # ]: 0 : while( nCount-- )
1781 : : {
1782 : 0 : SfxUndoAction* pTemp = pSourceList->aUndoActions[0].pAction;
1783 : 0 : pSourceList->aUndoActions.Remove(0);
1784 : 0 : pDestinationList->aUndoActions.Insert( pTemp, nDestAction++ );
1785 : : }
1786 : 0 : pDestinationList->nCurUndoAction = pDestinationList->aUndoActions.size();
1787 : :
1788 : 0 : pListAction->aUndoActions.Remove(0);
1789 [ # # ]: 0 : delete pLinkAction;
1790 : :
1791 : 0 : pDocUndoManager->RemoveLastUndoAction();
1792 : : }
1793 : : }
1794 : : }
1795 : :
1796 [ # # ]: 0 : if ( !pListAction->aUndoActions.empty() )
1797 : : {
1798 : : // now we have to move all remaining doc undo actions from the top undo
1799 : : // list to the previous undo list and remove the top undo list
1800 : :
1801 : 0 : size_t nCount = pListAction->aUndoActions.size();
1802 : 0 : size_t nDestAction = pPrevListAction->aUndoActions.size();
1803 [ # # ]: 0 : while( nCount-- )
1804 : : {
1805 : 0 : SfxUndoAction* pTemp = pListAction->aUndoActions[0].pAction;
1806 : 0 : pListAction->aUndoActions.Remove(0);
1807 [ # # ]: 0 : if( pTemp )
1808 : 0 : pPrevListAction->aUndoActions.Insert( pTemp, nDestAction++ );
1809 : : }
1810 : 0 : pPrevListAction->nCurUndoAction = pPrevListAction->aUndoActions.size();
1811 : : }
1812 : :
1813 : 0 : rOutlineUndo.RemoveLastUndoAction();
1814 : : }
1815 : : }
1816 : : }
1817 : : }
1818 : 0 : }
1819 : :
1820 : 0 : IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo)
1821 : : {
1822 [ # # ]: 0 : if( pInfo )
1823 : : {
1824 [ # # ]: 0 : Paragraph* pPara = mrOutliner.GetParagraph( pInfo->mnPara );
1825 : 0 : EditEngine& rEditEngine = const_cast< EditEngine& >( mrOutliner.GetEditEngine() );
1826 : :
1827 [ # # ][ # # ]: 0 : Size aImageSize( pInfo->mpOutDev->PixelToLogic( maSlideImage.GetSizePixel() ) );
1828 : 0 : Size aOffset( 100, 100 );
1829 : :
1830 : : // paint slide number
1831 [ # # ][ # # ]: 0 : if( pPara && mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) )
[ # # ][ # # ]
1832 : : {
1833 : 0 : long nPage = 0; // todo, printing??
1834 [ # # ]: 0 : for ( sal_uInt16 n = 0; n <= pInfo->mnPara; n++ )
1835 : : {
1836 [ # # ]: 0 : Paragraph* p = mrOutliner.GetParagraph( n );
1837 [ # # ][ # # ]: 0 : if ( mrOutliner.HasParaFlag(p,PARAFLAG_ISPAGE) )
1838 : 0 : nPage++;
1839 : : }
1840 : :
1841 [ # # ]: 0 : long nBulletHeight = (long)mrOutliner.GetLineHeight( pInfo->mnPara );
1842 : 0 : long nFontHeight = 0;
1843 [ # # ][ # # ]: 0 : if ( !rEditEngine.IsFlatMode() )
1844 : : {
1845 : 0 : nFontHeight = nBulletHeight / 5;
1846 : : }
1847 : : else
1848 : : {
1849 : 0 : nFontHeight = (nBulletHeight * 10) / 25;
1850 : : }
1851 : :
1852 : 0 : Size aFontSz( 0, nFontHeight );
1853 : :
1854 : 0 : Size aOutSize( 2000, nBulletHeight );
1855 : :
1856 : 0 : const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7;
1857 : 0 : const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width();
1858 : 0 : aImageSize.Width() = (long)( fImageRatio * fImageHeight );
1859 : 0 : aImageSize.Height() = (long)( fImageHeight );
1860 : :
1861 : 0 : Point aImagePos( pInfo->mrStartPos );
1862 : 0 : aImagePos.X() += aOutSize.Width() - aImageSize.Width() - aOffset.Width() ;
1863 : 0 : aImagePos.Y() += (aOutSize.Height() - aImageSize.Height()) / 2;
1864 : :
1865 [ # # ]: 0 : pInfo->mpOutDev->DrawImage( aImagePos, aImageSize, maSlideImage );
1866 : :
1867 [ # # ]: 0 : const bool bVertical = mrOutliner.IsVertical();
1868 [ # # ]: 0 : const bool bRightToLeftPara = rEditEngine.IsRightToLeft( pInfo->mnPara );
1869 : :
1870 [ # # ]: 0 : LanguageType eLang = rEditEngine.GetDefaultLanguage();
1871 : :
1872 : 0 : Point aTextPos( aImagePos.X() - aOffset.Width(), pInfo->mrStartPos.Y() );
1873 [ # # ]: 0 : Font aNewFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, eLang, 0 ) );
1874 [ # # ]: 0 : aNewFont.SetSize( aFontSz );
1875 [ # # ]: 0 : aNewFont.SetVertical( bVertical );
1876 [ # # ][ # # ]: 0 : aNewFont.SetOrientation( bVertical ? 2700 : 0 );
1877 [ # # ]: 0 : aNewFont.SetColor( COL_AUTO );
1878 [ # # ]: 0 : pInfo->mpOutDev->SetFont( aNewFont );
1879 [ # # ]: 0 : String aPageText = String::CreateFromInt32( nPage );
1880 : 0 : Size aTextSz;
1881 [ # # ]: 0 : aTextSz.Width() = pInfo->mpOutDev->GetTextWidth( aPageText );
1882 [ # # ]: 0 : aTextSz.Height() = pInfo->mpOutDev->GetTextHeight();
1883 [ # # ]: 0 : if ( !bVertical )
1884 : : {
1885 : 0 : aTextPos.Y() += (aOutSize.Height() - aTextSz.Height()) / 2;
1886 [ # # ]: 0 : if ( !bRightToLeftPara )
1887 : : {
1888 : 0 : aTextPos.X() -= aTextSz.Width();
1889 : : }
1890 : : else
1891 : : {
1892 : 0 : aTextPos.X() += aTextSz.Width();
1893 : : }
1894 : : }
1895 : : else
1896 : : {
1897 : 0 : aTextPos.Y() -= aTextSz.Width();
1898 : 0 : aTextPos.X() += nBulletHeight / 2;
1899 : : }
1900 [ # # ][ # # ]: 0 : pInfo->mpOutDev->DrawText( aTextPos, aPageText );
[ # # ]
1901 : : }
1902 : : }
1903 : :
1904 : 0 : return 0;
1905 : : }
1906 : :
1907 : : // --------------------------------------------------------------------
1908 : :
1909 : 0 : void OutlineView::UpdateParagraph( sal_uInt16 nPara )
1910 : : {
1911 [ # # ]: 0 : SfxItemSet aNewAttrs2( mrOutliner.GetParaAttribs( nPara ) );
1912 [ # # ]: 0 : aNewAttrs2.Put( maLRSpaceItem );
1913 [ # # ][ # # ]: 0 : mrOutliner.SetParaAttribs( nPara, aNewAttrs2 );
1914 : 0 : }
1915 : :
1916 : : // --------------------------------------------------------------------
1917 : :
1918 : 0 : void OutlineView::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
1919 : : {
1920 : 0 : }
1921 : :
1922 : : /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
1923 : : get the correct style sheet and new slides are inserted. */
1924 : 0 : void OutlineView::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
1925 : : {
1926 : 0 : SdPage* pPage = 0;
1927 : 0 : SfxStyleSheetBasePool* pStylePool = GetDoc().GetStyleSheetPool();
1928 : :
1929 [ # # ]: 0 : for( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
1930 : : {
1931 : 0 : Paragraph* pPara = mrOutliner.GetParagraph( nPara );
1932 : :
1933 : 0 : bool bPage = mrOutliner.HasParaFlag( pPara, PARAFLAG_ISPAGE );
1934 : :
1935 [ # # ]: 0 : if( !bPage )
1936 : : {
1937 [ # # ]: 0 : SdStyleSheet* pStyleSheet = dynamic_cast< SdStyleSheet* >( mrOutliner.GetStyleSheet( nPara ) );
1938 [ # # ]: 0 : if( pStyleSheet )
1939 : : {
1940 [ # # ]: 0 : const OUString aName( pStyleSheet->GetApiName() );
1941 [ # # ]: 0 : if ( aName == "title" )
1942 : 0 : bPage = true;
1943 : : }
1944 : : }
1945 : :
1946 [ # # ]: 0 : if( !pPara )
1947 : 0 : continue; // fatality!?
1948 : :
1949 [ # # ][ # # ]: 0 : if( bPage && (nPara != pInfos->nStartPara) )
1950 : : {
1951 : : // insert new slide for this paragraph
1952 : 0 : pPage = InsertSlideForParagraph( pPara );
1953 : : }
1954 : : else
1955 : : {
1956 : : // newly inserted non page paragraphs get the outline style
1957 [ # # ]: 0 : if( !pPage )
1958 : 0 : pPage = GetPageForParagraph( pPara );
1959 : :
1960 [ # # ]: 0 : if( pPage )
1961 : : {
1962 [ # # ]: 0 : SfxStyleSheet* pStyle = pPage->GetStyleSheetForPresObj( bPage ? PRESOBJ_TITLE : PRESOBJ_OUTLINE );
1963 : :
1964 [ # # ]: 0 : if( !bPage )
1965 : : {
1966 : 0 : const sal_Int16 nDepth = mrOutliner.GetDepth( nPara );
1967 [ # # ]: 0 : if( nDepth > 0 )
1968 : : {
1969 [ # # ][ # # ]: 0 : String aStyleSheetName( pStyle->GetName() );
1970 [ # # ]: 0 : aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
1971 [ # # ][ # # ]: 0 : aStyleSheetName += String::CreateFromInt32( nDepth );
[ # # ]
1972 [ # # ]: 0 : pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyle->GetFamily() ) );
1973 [ # # ]: 0 : DBG_ASSERT( pStyle, "sd::OutlineView::OnEndPasteOrDrop(), Style not found!" );
1974 : : }
1975 : : }
1976 : :
1977 : 0 : mrOutliner.SetStyleSheet( nPara, pStyle );
1978 : : }
1979 : :
1980 : 0 : UpdateParagraph( nPara );
1981 : : }
1982 : : }
1983 : 0 : }
1984 : :
1985 : : // ====================================================================
1986 : :
1987 : :
1988 : 0 : OutlineViewModelChangeGuard::OutlineViewModelChangeGuard( OutlineView& rView )
1989 : 0 : : mrView( rView )
1990 : : {
1991 : 0 : mrView.BeginModelChange();
1992 : 0 : }
1993 : :
1994 : 0 : OutlineViewModelChangeGuard::~OutlineViewModelChangeGuard()
1995 : : {
1996 : 0 : mrView.EndModelChange();
1997 : 0 : }
1998 : :
1999 : 0 : OutlineViewPageChangesGuard::OutlineViewPageChangesGuard( OutlineView* pView )
2000 : 0 : : mpView( pView )
2001 : : {
2002 [ # # ]: 0 : if( mpView )
2003 : 0 : mpView->IgnoreCurrentPageChanges( true );
2004 : 0 : }
2005 : :
2006 : 0 : OutlineViewPageChangesGuard::~OutlineViewPageChangesGuard()
2007 : : {
2008 [ # # ]: 0 : if( mpView )
2009 : 0 : mpView->IgnoreCurrentPageChanges( false );
2010 : 0 : }
2011 : :
2012 : :
2013 : : } // end of namespace sd
2014 : :
2015 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|