Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/view/outlnvs2.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <OutlineViewShell.hxx>
21
#include <Outliner.hxx>
22
23
#include <app.hrc>
24
#include <svx/hlnkitem.hxx>
25
#include <sfx2/bindings.hxx>
26
#include <sfx2/docfile.hxx>
27
#include <sfx2/request.hxx>
28
#include <sfx2/zoomitem.hxx>
29
#include <svx/svxids.hrc>
30
#include <svx/svdoutl.hxx>
31
#include <svx/zoomslideritem.hxx>
32
#include <editeng/eeitem.hxx>
33
#include <editeng/flditem.hxx>
34
#include <editeng/editstat.hxx>
35
#include <unotools/useroptions.hxx>
36
37
#include <sfx2/viewfrm.hxx>
38
#include <Window.hxx>
39
#include <fubullet.hxx>
40
#include <fuolbull.hxx>
41
#include <fuscale.hxx>
42
#include <fuchar.hxx>
43
#include <fuinsfil.hxx>
44
#include <fuprobjs.hxx>
45
#include <futhes.hxx>
46
#include <futempl.hxx>
47
#include <fusldlg.hxx>
48
#include <zoomlist.hxx>
49
#include <fuexpand.hxx>
50
#include <fusumry.hxx>
51
#include <fucushow.hxx>
52
#include <sdabstdlg.hxx>
53
#include <DrawDocShell.hxx>
54
#include <DrawViewShell.hxx>
55
#include <OutlineView.hxx>
56
#include <slideshow.hxx>
57
#include <memory>
58
59
namespace sd {
60
61
/************************************************************************/
62
63
/**
64
 * SfxRequests for temporary functions
65
 */
66
67
void OutlineViewShell::FuTemporary(SfxRequest &rReq)
68
0
{
69
0
    DeactivateCurrentFunction();
70
71
0
    OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
72
0
    sal_uInt16 nSId = rReq.GetSlot();
73
74
0
    switch( nSId )
75
0
    {
76
0
        case SID_ATTR_ZOOM:
77
0
        {
78
0
            const SfxItemSet* pArgs = rReq.GetArgs();
79
80
0
            if ( pArgs )
81
0
            {
82
0
                SvxZoomItem aZoom = pArgs->Get( SID_ATTR_ZOOM );
83
0
                SvxZoomType eZT = aZoom.GetType();
84
0
                switch( eZT )
85
0
                {
86
0
                    case SvxZoomType::PERCENT:
87
0
                    {
88
0
                        SetZoom( static_cast<::tools::Long>( pArgs->Get( SID_ATTR_ZOOM ).GetValue()) );
89
0
                        Invalidate( SID_ATTR_ZOOM );
90
0
                        Invalidate( SID_ATTR_ZOOMSLIDER );
91
0
                    }
92
0
                    break;
93
94
0
                    default:
95
0
                        break;
96
0
                }
97
0
                rReq.Done();
98
0
            }
99
0
            else
100
0
            {
101
                // open the zoom dialog here
102
0
                SetCurrentFunction( FuScale::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
103
0
            }
104
0
            Cancel();
105
0
        }
106
0
        break;
107
108
0
        case SID_ATTR_ZOOMSLIDER:
109
0
        {
110
0
            const SfxItemSet* pArgs = rReq.GetArgs();
111
112
0
            const SfxUInt16Item* pScale = (pArgs && pArgs->Count () == 1) ?
113
0
                rReq.GetArg(SID_ATTR_ZOOMSLIDER) : nullptr;
114
0
            if (pScale && CHECK_RANGE (5, pScale->GetValue (), 3000))
115
0
            {
116
0
                SetZoom (pScale->GetValue ());
117
118
0
                SfxBindings& rBindings = GetViewFrame()->GetBindings();
119
0
                rBindings.Invalidate( SID_ATTR_ZOOM );
120
0
                rBindings.Invalidate( SID_ZOOM_IN );
121
0
                rBindings.Invalidate( SID_ZOOM_OUT );
122
0
                rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
123
124
0
            }
125
126
0
            Cancel();
127
0
            rReq.Done ();
128
0
            break;
129
0
        }
130
131
0
        case SID_ZOOM_IN:
132
0
        {
133
0
            SetZoom( std::min<::tools::Long>( GetActiveWindow()->GetZoom() * 2, GetActiveWindow()->GetMaxZoom() ) );
134
0
            ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0),
135
0
                                             GetActiveWindow()->GetOutputSizePixel()) );
136
0
            mpZoomList->InsertZoomRect(aVisAreaWin);
137
0
            Invalidate( SID_ATTR_ZOOM );
138
0
            Invalidate( SID_ZOOM_IN );
139
0
            Invalidate(SID_ZOOM_OUT);
140
0
            Invalidate( SID_ATTR_ZOOMSLIDER );
141
0
            Cancel();
142
0
            rReq.Done();
143
0
        }
144
0
        break;
145
146
0
        case SID_SIZE_REAL:
147
0
        {
148
0
            SetZoom( 100 );
149
0
            ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0),
150
0
                                             GetActiveWindow()->GetOutputSizePixel()) );
151
0
            mpZoomList->InsertZoomRect(aVisAreaWin);
152
0
            Invalidate( SID_ATTR_ZOOM );
153
0
            Invalidate( SID_ATTR_ZOOMSLIDER );
154
0
            Cancel();
155
0
            rReq.Done();
156
0
        }
157
0
        break;
158
159
0
        case SID_ZOOM_OUT:
160
0
        {
161
0
            SetZoom( std::max<::tools::Long>( GetActiveWindow()->GetZoom() / 2, GetActiveWindow()->GetMinZoom() ) );
162
0
            ::tools::Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0),
163
0
                                             GetActiveWindow()->GetOutputSizePixel()) );
164
0
            mpZoomList->InsertZoomRect(aVisAreaWin);
165
0
            Invalidate( SID_ATTR_ZOOM );
166
0
            Invalidate( SID_ZOOM_OUT);
167
0
            Invalidate( SID_ZOOM_IN );
168
0
            Invalidate( SID_ATTR_ZOOMSLIDER );
169
0
            Cancel();
170
0
            rReq.Done();
171
0
        }
172
0
        break;
173
174
0
        case SID_OUTLINE_COLLAPSE_ALL:
175
0
        {
176
0
            pOutlinerView->CollapseAll();
177
0
            Cancel();
178
0
            rReq.Done();
179
0
        }
180
0
        break;
181
182
0
        case SID_OUTLINE_COLLAPSE:
183
0
        {
184
0
            pOutlinerView->Collapse();
185
0
            Cancel();
186
0
            rReq.Done();
187
0
        }
188
0
        break;
189
190
0
        case SID_OUTLINE_EXPAND_ALL:
191
0
        {
192
0
            pOutlinerView->ExpandAll();
193
0
            Cancel();
194
0
            rReq.Done();
195
0
        }
196
0
        break;
197
198
0
        case SID_OUTLINE_EXPAND:
199
0
        {
200
0
            pOutlinerView->Expand();
201
0
            Cancel();
202
0
            rReq.Done();
203
0
        }
204
0
        break;
205
206
0
        case SID_OUTLINE_FORMAT:
207
0
        {
208
0
            ::Outliner& rOutl = pOutlinerView->GetOutliner();
209
0
            rOutl.SetFlatMode( !rOutl.IsFlatMode() );
210
0
            Invalidate( SID_COLORVIEW );
211
0
            Cancel();
212
0
            rReq.Done();
213
0
        }
214
0
        break;
215
216
0
        case SID_SELECTALL:
217
0
        {
218
0
            ::Outliner& rOutl = pOlView->GetOutliner();
219
0
            sal_Int32 nParaCount = rOutl.GetParagraphCount();
220
0
            if (nParaCount > 0)
221
0
            {
222
0
                pOutlinerView->SelectRange( 0, nParaCount );
223
0
            }
224
0
            Cancel();
225
0
        }
226
0
        break;
227
228
0
        case SID_PRESENTATION:
229
0
        case SID_PRESENTATION_CURRENT_SLIDE:
230
0
        case SID_REHEARSE_TIMINGS:
231
0
        {
232
0
            pOlView->PrepareClose();
233
0
            slideshowhelp::ShowSlideShow(rReq, *GetDoc());
234
0
            Cancel();
235
0
            rReq.Done();
236
0
        }
237
0
        break;
238
239
0
        case SID_COLORVIEW:
240
0
        {
241
0
            ::Outliner& rOutl = pOutlinerView->GetOutliner();
242
0
            EEControlBits nCntrl = rOutl.GetControlWord();
243
244
0
            if ( !(nCntrl & EEControlBits::NOCOLORS) )
245
0
            {
246
                // color view is enabled: disable
247
0
                rOutl.SetControlWord(nCntrl | EEControlBits::NOCOLORS);
248
0
            }
249
0
            else
250
0
            {
251
                // color view is disabled: enable
252
0
                rOutl.SetControlWord(nCntrl & ~EEControlBits::NOCOLORS);
253
0
            }
254
255
0
            InvalidateWindows();
256
0
            Invalidate( SID_COLORVIEW );
257
0
            Cancel();
258
0
            rReq.Done();
259
0
        }
260
0
        break;
261
262
0
        case SID_STYLE_EDIT:
263
0
        case SID_STYLE_UPDATE_BY_EXAMPLE:
264
0
        {
265
0
            if( rReq.GetArgs() )
266
0
            {
267
0
                SetCurrentFunction( FuTemplate::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
268
0
                Cancel();
269
0
            }
270
271
0
            rReq.Ignore ();
272
0
        }
273
0
        break;
274
275
0
        case SID_PRESENTATION_DLG:
276
0
        {
277
0
            SetCurrentFunction( FuSlideShowDlg::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
278
0
            Cancel();
279
0
        }
280
0
        break;
281
282
0
        case SID_REMOTE_DLG:
283
0
        {
284
#ifdef ENABLE_SDREMOTE
285
             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
286
             ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateRemoteDialog(GetFrameWeld()));
287
             pDlg->Execute();
288
#endif
289
0
        }
290
0
        break;
291
292
0
        case SID_CUSTOMSHOW_DLG:
293
0
        {
294
0
            SetCurrentFunction( FuCustomShowDlg::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
295
0
            Cancel();
296
0
        }
297
0
        break;
298
299
0
        case SID_PHOTOALBUM:
300
0
        {
301
0
            SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
302
0
            vcl::Window* pWin = GetActiveWindow();
303
0
            ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog(
304
0
                pWin ? pWin->GetFrameWeld() : nullptr,
305
0
                *GetDoc()));
306
307
0
            pDlg->Execute();
308
309
0
            Cancel();
310
0
            rReq.Ignore ();
311
0
        }
312
0
        break;
313
0
    }
314
315
0
    if(HasCurrentFunction())
316
0
        GetCurrentFunction()->Activate();
317
318
0
    Invalidate( SID_OUTLINE_COLLAPSE_ALL );
319
0
    Invalidate( SID_OUTLINE_COLLAPSE );
320
0
    Invalidate( SID_OUTLINE_EXPAND_ALL );
321
0
    Invalidate( SID_OUTLINE_EXPAND );
322
323
0
    SfxBindings& rBindings = GetViewFrame()->GetBindings();
324
0
    rBindings.Invalidate( SID_OUTLINE_LEFT );
325
0
    rBindings.Invalidate( SID_OUTLINE_RIGHT );
326
0
    rBindings.Invalidate( SID_OUTLINE_UP );
327
0
    rBindings.Invalidate( SID_OUTLINE_DOWN );
328
329
0
    Invalidate( SID_OUTLINE_FORMAT );
330
0
    Invalidate( SID_COLORVIEW );
331
0
    Invalidate(SID_CUT);
332
0
    Invalidate(SID_COPY);
333
0
    Invalidate(SID_PASTE);
334
0
    Invalidate(SID_PASTE_UNFORMATTED);
335
0
}
336
337
void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
338
0
{
339
0
    sal_uInt16 nSId = rReq.GetSlot();
340
0
    std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
341
0
    if (nSId != SID_OUTLINE_BULLET && nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER)
342
0
    {
343
0
        aGuard.reset( new OutlineViewModelChangeGuard(*pOlView) );
344
0
    }
345
0
    DeactivateCurrentFunction();
346
347
0
    OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
348
    //sal_uInt16 nSId = rReq.GetSlot();
349
350
0
    switch( nSId )
351
0
    {
352
0
        case SID_HYPERLINK_SETLINK:
353
0
        {
354
0
            const SfxItemSet* pReqArgs = rReq.GetArgs();
355
356
0
            if (pReqArgs)
357
0
            {
358
0
                const SvxHyperlinkItem* pHLItem =
359
0
                    &pReqArgs->Get(SID_HYPERLINK_SETLINK);
360
361
0
                SvxFieldItem aURLItem(SvxURLField(pHLItem->GetURL(),
362
0
                                                  pHLItem->GetName(),
363
0
                                                  SvxURLFormat::Repr), EE_FEATURE_FIELD);
364
0
                ESelection aSel( pOutlinerView->GetSelection() );
365
0
                pOutlinerView->InsertField(aURLItem);
366
0
                if (aSel.start.nIndex <= aSel.end.nIndex)
367
0
                    aSel.end.nIndex = aSel.start.nIndex + 1;
368
0
                else
369
0
                    aSel.start.nIndex = aSel.end.nIndex + 1;
370
0
                pOutlinerView->SetSelection( aSel );
371
0
            }
372
373
0
            Cancel();
374
0
            rReq.Ignore ();
375
0
        }
376
0
        break;
377
378
0
        case FN_INSERT_SOFT_HYPHEN:
379
0
        case FN_INSERT_HARDHYPHEN:
380
0
        case FN_INSERT_HARD_SPACE:
381
0
        case FN_INSERT_NNBSP:
382
0
        case SID_INSERT_RLM :
383
0
        case SID_INSERT_LRM :
384
0
        case SID_INSERT_WJ :
385
0
        case SID_INSERT_ZWSP:
386
0
        case SID_CHARMAP:
387
0
        {
388
0
            SetCurrentFunction( FuBullet::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
389
0
            Cancel();
390
0
        }
391
0
        break;
392
393
0
        case SID_OUTLINE_BULLET:
394
0
        case FN_SVX_SET_BULLET:
395
0
        case FN_SVX_SET_NUMBER:
396
0
        {
397
0
            SetCurrentFunction( FuBulletAndPosition::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
398
0
            Cancel();
399
0
        }
400
0
        break;
401
402
0
        case SID_THESAURUS:
403
0
        {
404
0
            SetCurrentFunction( FuThesaurus::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
405
0
            Cancel();
406
0
            rReq.Ignore ();
407
0
        }
408
0
        break;
409
410
0
        case SID_CHAR_DLG_EFFECT:
411
0
        case SID_CHAR_DLG:
412
0
        {
413
0
            SetCurrentFunction( FuChar::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
414
0
            Cancel();
415
0
        }
416
0
        break;
417
418
0
        case SID_INSERTFILE:
419
0
        {
420
0
            SetCurrentFunction( FuInsertFile::Create(*this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq) );
421
0
            Cancel();
422
0
        }
423
0
        break;
424
425
0
        case SID_PRESENTATIONOBJECT:
426
0
        {
427
0
            SetCurrentFunction( FuPresentationObjects::Create(*this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq) );
428
0
            Cancel();
429
0
        }
430
0
        break;
431
432
0
        case SID_SET_DEFAULT:
433
0
        {
434
0
            pOutlinerView->RemoveAttribs(true); // sal_True = also paragraph attributes
435
0
            Cancel();
436
0
            rReq.Done();
437
0
        }
438
0
        break;
439
440
0
        case SID_SUMMARY_PAGE:
441
0
        {
442
0
            pOlView->SetSelectedPages();
443
0
            SetCurrentFunction( FuSummaryPage::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
444
0
            pOlView->GetOutliner().Clear();
445
0
            pOlView->FillOutliner();
446
0
            pOlView->GetActualPage();
447
0
            Cancel();
448
0
        }
449
0
        break;
450
451
0
        case SID_EXPAND_PAGE:
452
0
        {
453
0
            pOlView->SetSelectedPages();
454
0
            SetCurrentFunction( FuExpandPage::Create( *this, GetActiveWindow(), pOlView.get(), *GetDoc(), rReq ) );
455
0
            pOlView->GetOutliner().Clear();
456
0
            pOlView->FillOutliner();
457
0
            pOlView->GetActualPage();
458
0
            Cancel();
459
0
        }
460
0
        break;
461
462
0
        case SID_INSERT_FLD_DATE_FIX:
463
0
        case SID_INSERT_FLD_DATE_VAR:
464
0
        case SID_INSERT_FLD_TIME_FIX:
465
0
        case SID_INSERT_FLD_TIME_VAR:
466
0
        case SID_INSERT_FLD_AUTHOR:
467
0
        case SID_INSERT_FLD_PAGE:
468
0
        case SID_INSERT_FLD_PAGE_TITLE:
469
0
        case SID_INSERT_FLD_PAGES:
470
0
        case SID_INSERT_FLD_FILE:
471
0
        {
472
0
            std::unique_ptr<SvxFieldItem> pFieldItem;
473
474
0
            switch( nSId )
475
0
            {
476
0
                case SID_INSERT_FLD_DATE_FIX:
477
0
                    pFieldItem.reset(new SvxFieldItem(
478
0
                        SvxDateField( Date( Date::SYSTEM ), SvxDateType::Fix ), EE_FEATURE_FIELD ));
479
0
                break;
480
481
0
                case SID_INSERT_FLD_DATE_VAR:
482
0
                    pFieldItem.reset(new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD ));
483
0
                break;
484
485
0
                case SID_INSERT_FLD_TIME_FIX:
486
0
                    pFieldItem.reset(new SvxFieldItem(
487
0
                        SvxExtTimeField( ::tools::Time( ::tools::Time::SYSTEM ), SvxTimeType::Fix ), EE_FEATURE_FIELD ));
488
0
                break;
489
490
0
                case SID_INSERT_FLD_TIME_VAR:
491
0
                    pFieldItem.reset(new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD ));
492
0
                break;
493
494
0
                case SID_INSERT_FLD_AUTHOR:
495
0
                {
496
0
                    SvtUserOptions aUserOptions;
497
0
                    pFieldItem.reset(new SvxFieldItem(
498
0
                            SvxAuthorField(
499
0
                                aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() )
500
0
                                , EE_FEATURE_FIELD ));
501
0
                }
502
0
                break;
503
504
0
                case SID_INSERT_FLD_PAGE:
505
0
                    pFieldItem.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ));
506
0
                break;
507
508
0
                case SID_INSERT_FLD_PAGE_TITLE:
509
0
                    pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
510
0
                break;
511
512
0
                case SID_INSERT_FLD_PAGES:
513
0
                    pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
514
0
                break;
515
516
0
                case SID_INSERT_FLD_FILE:
517
0
                {
518
0
                    OUString aName;
519
0
                    if( GetDocSh()->HasName() )
520
0
                        aName = GetDocSh()->GetMedium()->GetName();
521
                    //else
522
                    //  aName = GetDocSh()->GetName();
523
0
                    pFieldItem.reset(new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD ));
524
0
                }
525
0
                break;
526
0
            }
527
528
0
            const SvxFieldItem* pOldFldItem = pOutlinerView->GetFieldAtSelection();
529
530
0
            if( pOldFldItem && ( nullptr != dynamic_cast< const SvxURLField *>( pOldFldItem->GetField() ) ||
531
0
                                nullptr != dynamic_cast< const SvxDateField *>( pOldFldItem->GetField() ) ||
532
0
                                nullptr != dynamic_cast< const SvxTimeField *>( pOldFldItem->GetField() ) ||
533
0
                                nullptr != dynamic_cast< const SvxExtTimeField *>( pOldFldItem->GetField() ) ||
534
0
                                nullptr != dynamic_cast< const SvxExtFileField *>( pOldFldItem->GetField() ) ||
535
0
                                nullptr != dynamic_cast< const SvxAuthorField *>( pOldFldItem->GetField() ) ||
536
0
                                nullptr != dynamic_cast< const SvxPageField *>( pOldFldItem->GetField() ) ||
537
0
                                nullptr != dynamic_cast< const SvxPagesField *>( pOldFldItem->GetField() )) )
538
0
            {
539
                // select field, so it gets deleted on Insert
540
0
                ESelection aSel = pOutlinerView->GetSelection();
541
0
                if (aSel.start.nIndex == aSel.end.nIndex)
542
0
                    aSel.end.nIndex++;
543
0
                pOutlinerView->SetSelection( aSel );
544
0
            }
545
546
0
            if( pFieldItem )
547
0
                pOutlinerView->InsertField( *pFieldItem );
548
549
0
            pFieldItem.reset();
550
551
0
            Cancel();
552
0
            rReq.Ignore ();
553
0
        }
554
0
        break;
555
556
0
        case SID_MODIFY_FIELD:
557
0
        {
558
0
            const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
559
560
0
            if( pFldItem && (nullptr != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) ||
561
0
                                nullptr != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) ||
562
0
                                nullptr != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) ||
563
0
                                nullptr != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) ) )
564
0
            {
565
                // Dialog...
566
0
                SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
567
0
                vcl::Window* pWin = GetActiveWindow();
568
0
                ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOutlinerView->GetAttribs() ));
569
0
                if( pDlg->Execute() == RET_OK )
570
0
                {
571
0
                    std::unique_ptr<SvxFieldData> pField(pDlg->GetField());
572
0
                    if( pField )
573
0
                    {
574
0
                        SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
575
                        //pOLV->DeleteSelected(); <-- unfortunately missing!
576
                        // select field, so it gets deleted on Insert
577
0
                        ESelection aSel = pOutlinerView->GetSelection();
578
0
                        bool bSel = true;
579
0
                        if (aSel.start.nIndex == aSel.end.nIndex)
580
0
                        {
581
0
                            bSel = false;
582
0
                            aSel.end.nIndex++;
583
0
                        }
584
0
                        pOutlinerView->SetSelection( aSel );
585
586
0
                        pOutlinerView->InsertField( aFieldItem );
587
588
                        // reset selection to original state
589
0
                        if( !bSel )
590
0
                            aSel.end.nIndex--;
591
0
                        pOutlinerView->SetSelection( aSel );
592
593
0
                        pField.reset();
594
0
                    }
595
596
0
                    SfxItemSet aSet( pDlg->GetItemSet() );
597
0
                    if( aSet.Count() )
598
0
                    {
599
0
                        pOutlinerView->SetAttribs( aSet );
600
601
0
                        ::Outliner& rOutliner = pOutlinerView->GetOutliner();
602
0
                        rOutliner.UpdateFields();
603
0
                    }
604
0
                }
605
0
            }
606
607
0
            Cancel();
608
0
            rReq.Ignore ();
609
0
        }
610
0
        break;
611
0
    }
612
613
0
    if(HasCurrentFunction())
614
0
        GetCurrentFunction()->Activate();
615
616
0
    Invalidate( SID_OUTLINE_COLLAPSE_ALL );
617
0
    Invalidate( SID_OUTLINE_COLLAPSE );
618
0
    Invalidate( SID_OUTLINE_EXPAND_ALL );
619
0
    Invalidate( SID_OUTLINE_EXPAND );
620
621
0
    SfxBindings& rBindings = GetViewFrame()->GetBindings();
622
0
    rBindings.Invalidate( SID_OUTLINE_LEFT );
623
0
    rBindings.Invalidate( SID_OUTLINE_RIGHT );
624
0
    rBindings.Invalidate( SID_OUTLINE_UP );
625
0
    rBindings.Invalidate( SID_OUTLINE_DOWN );
626
627
0
    Invalidate( SID_OUTLINE_FORMAT );
628
0
    Invalidate( SID_COLORVIEW );
629
0
    Invalidate(SID_CUT);
630
0
    Invalidate(SID_COPY);
631
0
    Invalidate(SID_PASTE);
632
0
    Invalidate(SID_PASTE_UNFORMATTED);
633
0
}
634
635
} // end of namespace sd
636
637
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */