Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/view/drviews3.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 <config_features.h>
21
22
#include <DrawViewShell.hxx>
23
#include <DrawController.hxx>
24
25
#include <sfx2/viewfrm.hxx>
26
#include <editeng/eeitem.hxx>
27
#include <editeng/tstpitem.hxx>
28
#include <editeng/lrspitem.hxx>
29
#include <editeng/protitem.hxx>
30
#include <editeng/frmdiritem.hxx>
31
#include <editeng/adjustitem.hxx>
32
#include <svx/svdotable.hxx>
33
#include <editeng/numitem.hxx>
34
#include <svx/rulritem.hxx>
35
#include <svx/svxids.hrc>
36
#include <svx/svdpagv.hxx>
37
#include <sfx2/request.hxx>
38
#include <sfx2/dispatch.hxx>
39
#include <tools/urlobj.hxx>
40
#include <svl/eitem.hxx>
41
#include <svl/rectitem.hxx>
42
#include <svl/stritem.hxx>
43
#include <svx/svdoole2.hxx>
44
#include <svl/itempool.hxx>
45
#include <svl/ptitem.hxx>
46
#include <basic/sbstar.hxx>
47
#include <basic/sberrors.hxx>
48
#include <svx/fmshell.hxx>
49
#include <svx/f3dchild.hxx>
50
#include <svx/float3d.hxx>
51
#include <svx/sdmetitm.hxx>
52
#include <svx/svdogrp.hxx>
53
#include <svx/diagram/DiagramHelper_svx.hxx>
54
55
#include <app.hrc>
56
#include <strings.hrc>
57
58
#include <sdundogr.hxx>
59
#include <undopage.hxx>
60
#include <fupoor.hxx>
61
#include <slideshow.hxx>
62
#include <sdpage.hxx>
63
#include <Window.hxx>
64
#include <sdresid.hxx>
65
#include <unokywds.hxx>
66
#include <drawview.hxx>
67
#include <drawdoc.hxx>
68
#include <DrawDocShell.hxx>
69
#include <sdabstdlg.hxx>
70
#include <sfx2/ipclient.hxx>
71
#include <comphelper/diagnose_ex.hxx>
72
#include <ViewShellBase.hxx>
73
#include <FormShellManager.hxx>
74
#include <LayerTabBar.hxx>
75
#include <framework/ConfigurationController.hxx>
76
#include <framework/Configuration.hxx>
77
#include <com/sun/star/drawing/XShape.hpp>
78
#include <com/sun/star/frame/XFrame.hpp>
79
#include <editeng/lspcitem.hxx>
80
#include <editeng/ulspitem.hxx>
81
#include <memory>
82
#include <comphelper/processfactory.hxx>
83
#include <oox/drawingml/diagram/diagram.hxx>
84
#include <oox/export/drawingml.hxx>
85
#include <oox/shape/ShapeFilterBase.hxx>
86
87
using namespace ::com::sun::star::uno;
88
using namespace ::com::sun::star::drawing::framework;
89
using ::com::sun::star::frame::XFrame;
90
using ::com::sun::star::frame::XController;
91
92
namespace sd {
93
94
/**
95
 * handle SfxRequests for controller
96
 */
97
void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
98
0
{
99
    // except a page switch and jumps to bookmarks, nothing is executed during
100
    // a slide show
101
0
    if( HasCurrentFunction(SID_PRESENTATION) &&
102
0
        rReq.GetSlot() != SID_SWITCHPAGE &&
103
0
        rReq.GetSlot() != SID_JUMPTOMARK)
104
0
        return;
105
106
0
    CheckLineTo (rReq);
107
108
    // End text edit mode for some requests.
109
0
    sal_uInt16 nSlot = rReq.GetSlot();
110
0
    bool bAllowFocusChange = true;
111
0
    switch (nSlot)
112
0
    {
113
0
        case SID_OUTPUT_QUALITY_COLOR:
114
0
        case SID_OUTPUT_QUALITY_GRAYSCALE:
115
0
        case SID_OUTPUT_QUALITY_BLACKWHITE:
116
0
        case SID_OUTPUT_QUALITY_CONTRAST:
117
            // Do nothing.
118
0
            break;
119
0
        case SID_SWITCHPAGE:
120
0
            if (rReq.GetArgs() && rReq.GetArgs()->Count () == 1)
121
0
            {
122
0
                const SfxBoolItem* pAllowFocusChange = rReq.GetArg<SfxBoolItem>(SID_SWITCHPAGE);
123
0
                bAllowFocusChange = pAllowFocusChange->GetValue();
124
0
                if (!bAllowFocusChange)
125
0
                    break;
126
0
            }
127
0
            [[fallthrough]];
128
0
        default:
129
0
            if ( mpDrawView->IsTextEdit() )
130
0
            {
131
0
                mpDrawView->SdrEndTextEdit();
132
0
            }
133
0
    }
134
135
0
    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
136
    //  sal_uInt16 nSlot = rReq.GetSlot();
137
0
    switch (nSlot)
138
0
    {
139
0
        case SID_SWITCHPAGE:  // BASIC
140
0
        {
141
            // switch page in running slide show
142
0
            if(SlideShow::IsRunning(GetViewShellBase())
143
0
                && !SlideShow::IsInteractiveSlideshow(GetViewShellBase()) // IASS
144
0
                && rReq.GetArgs())
145
0
            {
146
0
                if (const SfxUInt32Item* pWhatPage = rReq.GetArg(ID_VAL_WHATPAGE))
147
0
                    SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber(static_cast<sal_Int32>((pWhatPage->GetValue()-1)>>1));
148
0
            }
149
0
            else
150
0
            {
151
0
                const SfxItemSet *pArgs = rReq.GetArgs ();
152
0
                sal_uInt16 nSelectedPage = 0;
153
154
0
                if (! pArgs || pArgs->Count () == 1)
155
0
                {
156
0
                    nSelectedPage = maTabControl->GetCurPagePos();
157
0
                }
158
0
                else if (pArgs->Count () == 2)
159
0
                {
160
0
                    const SfxUInt32Item* pWhatPage = rReq.GetArg(ID_VAL_WHATPAGE);
161
0
                    const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND);
162
163
0
                    sal_Int32 nWhatPage = static_cast<sal_Int32>(pWhatPage->GetValue ());
164
0
                    PageKind nWhatKind = static_cast<PageKind>(pWhatKind->GetValue ());
165
0
                    if (nWhatKind < PageKind::Standard || nWhatKind > PageKind::Handout)
166
0
                    {
167
#if HAVE_FEATURE_SCRIPTING
168
                        StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
169
#endif
170
0
                        rReq.Ignore ();
171
0
                        break;
172
0
                    }
173
0
                    else if (meEditMode != EditMode::MasterPage)
174
0
                    {
175
0
                        if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount(nWhatKind)))
176
0
                        {
177
#if HAVE_FEATURE_SCRIPTING
178
                            StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE);
179
#endif
180
0
                            rReq.Ignore ();
181
0
                            break;
182
0
                        }
183
184
0
                        nSelectedPage = static_cast<short>(nWhatPage);
185
0
                        mePageKind    = nWhatKind;
186
0
                    }
187
0
                }
188
0
                else
189
0
                {
190
#if HAVE_FEATURE_SCRIPTING
191
                    StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
192
#endif
193
0
                    rReq.Ignore ();
194
0
                    break;
195
0
                }
196
197
0
                if( GetDocSh() && (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED))
198
0
                    GetDocSh()->SetModified();
199
200
0
                SwitchPage(nSelectedPage, bAllowFocusChange);
201
202
0
                if(HasCurrentFunction(SID_BEZIER_EDIT))
203
0
                    GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
204
205
0
                Invalidate();
206
0
                InvalidateWindows();
207
0
                rReq.Done ();
208
0
            }
209
0
            break;
210
0
        }
211
212
0
        case SID_SWITCHLAYER:  // BASIC
213
0
        {
214
0
            const SfxItemSet *pArgs = rReq.GetArgs ();
215
216
            // #i87182#
217
0
            bool bCurPageValid(false);
218
0
            sal_uInt16 nCurPage(0);
219
220
0
            if(GetLayerTabControl())
221
0
            {
222
0
                nCurPage = GetLayerTabControl()->GetCurPageId();
223
0
                bCurPageValid = true;
224
0
            }
225
226
0
            if(pArgs && 1 == pArgs->Count())
227
0
            {
228
0
                const SfxUInt32Item* pWhatLayer = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYER);
229
230
0
                if(pWhatLayer)
231
0
                {
232
0
                    nCurPage = static_cast<short>(pWhatLayer->GetValue());
233
0
                    bCurPageValid = true;
234
0
                }
235
0
            }
236
237
0
            if(bCurPageValid)
238
0
            {
239
0
                OUString aLayerName( GetLayerTabControl()->GetLayerName(nCurPage));
240
0
                if (!aLayerName.isEmpty())
241
0
                {
242
0
                    mpDrawView->SetActiveLayer(aLayerName);
243
0
                }
244
0
                Invalidate();
245
0
            }
246
247
0
            rReq.Done ();
248
249
0
            break;
250
0
        }
251
252
0
        case SID_PAGEMODE:  // BASIC
253
0
        {
254
255
0
            const SfxItemSet *pArgs = rReq.GetArgs();
256
257
0
            if (pArgs && pArgs->Count () == 2)
258
0
            {
259
0
                const SfxBoolItem* pIsActive = rReq.GetArg<SfxBoolItem>(ID_VAL_ISACTIVE);
260
0
                const SfxUInt32Item* pWhatKind = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATKIND);
261
262
0
                PageKind nWhatKind = static_cast<PageKind>(pWhatKind->GetValue());
263
0
                if ( nWhatKind >= PageKind::Standard && nWhatKind <= PageKind::Handout)
264
0
                {
265
0
                    mbIsLayerModeActive = pIsActive->GetValue();
266
0
                    mePageKind = nWhatKind;
267
0
                }
268
0
            }
269
270
            // turn on default layer of page
271
0
            mpDrawView->SetActiveLayer(sUNO_LayerName_layout);
272
273
0
            ChangeEditMode(EditMode::Page, mbIsLayerModeActive);
274
275
0
            Invalidate();
276
0
            rReq.Done ();
277
278
0
            break;
279
0
        }
280
281
0
        case SID_LAYERMODE:  // BASIC
282
0
        {
283
0
            const SfxItemSet *pArgs = rReq.GetArgs();
284
285
0
            if (pArgs && pArgs->Count() == 2)
286
0
            {
287
0
                const SfxUInt32Item* pWhatLayer = rReq.GetArg<SfxUInt32Item>(ID_VAL_WHATLAYER);
288
0
                EditMode nWhatLayer = static_cast<EditMode>(pWhatLayer->GetValue());
289
0
                if (nWhatLayer == EditMode::Page || nWhatLayer == EditMode::MasterPage)
290
0
                {
291
0
                    mbIsLayerModeActive = rReq.GetArg<SfxBoolItem>(ID_VAL_ISACTIVE)->GetValue();
292
0
                    meEditMode = nWhatLayer;
293
0
                }
294
0
            }
295
296
0
            ChangeEditMode(meEditMode, !mbIsLayerModeActive);
297
298
0
            Invalidate();
299
0
            rReq.Done();
300
301
0
            break;
302
0
        }
303
304
0
        case SID_HEADER_AND_FOOTER:
305
0
        case SID_INSERT_PAGE_NUMBER:
306
0
        case SID_INSERT_DATE_TIME:
307
0
        {
308
0
            SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
309
0
            vcl::Window* pWin = GetActiveWindow();
310
0
            VclPtr<AbstractHeaderFooterDialog> pDlg(pFact->CreateHeaderFooterDialog(*this, pWin ? pWin->GetFrameWeld() : nullptr, *GetDoc(), mpActualPage));
311
0
            auto xRequest = std::make_shared<SfxRequest>(rReq);
312
0
            rReq.Ignore(); // the 'old' request is not relevant any more
313
0
            pDlg->StartExecuteAsync([this, pDlg, xRequest=std::move(xRequest)](sal_Int32 /*nResult*/){
314
0
                GetActiveWindow()->Invalidate();
315
0
                UpdatePreview( mpActualPage );
316
317
0
                Invalidate();
318
0
                xRequest->Done();
319
320
0
                pDlg->disposeOnce();
321
0
            });
322
0
            break;
323
0
        }
324
325
0
        case SID_MASTER_LAYOUTS:
326
0
        {
327
0
            SdPage* pPage = GetActualPage();
328
0
            if (meEditMode == EditMode::MasterPage)
329
                // Use the master page of the current page.
330
0
                pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
331
332
0
            SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
333
0
            vcl::Window* pWin = GetActiveWindow();
334
0
            ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, *GetDoc(), pPage));
335
0
            pDlg->Execute();
336
0
            Invalidate();
337
0
            rReq.Done ();
338
0
            break;
339
0
        }
340
0
        case SID_OBJECTRESIZE:
341
0
        {
342
            // The server likes to change the client size
343
0
            OSL_ASSERT (GetViewShell()!=nullptr);
344
0
            SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
345
346
0
            if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
347
0
            {
348
0
                const SfxRectangleItem& rRect =
349
0
                    rReq.GetArgs()->Get(SID_OBJECTRESIZE);
350
0
                ::tools::Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) );
351
352
0
                if ( rMarkList.GetMarkCount() != 0 )
353
0
                {
354
0
                    if (rMarkList.GetMarkCount() == 1)
355
0
                    {
356
0
                        SdrMark* pMark = rMarkList.GetMark(0);
357
0
                        SdrObject* pObj = pMark->GetMarkedSdrObj();
358
359
0
                        SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj );
360
0
                        if(pOle2Obj)
361
0
                        {
362
0
                            if( pOle2Obj->GetObjRef().is() )
363
0
                            {
364
0
                                pOle2Obj->SetLogicRect(aRect);
365
0
                            }
366
0
                        }
367
0
                    }
368
0
                }
369
0
            }
370
0
            rReq.Ignore ();
371
0
            break;
372
0
        }
373
374
0
        case SID_RELOAD:
375
0
        {
376
0
            sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
377
0
            SfxViewFrame* pFrame = GetViewFrame();
378
379
0
            try
380
0
            {
381
0
                Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW );
382
383
                // Save the current configuration of panes and views.
384
0
                DrawController* pDrawController = GetViewShellBase().GetDrawController();
385
0
                if (pDrawController)
386
0
                {
387
0
                    rtl::Reference<sd::framework::ConfigurationController> xConfigurationController (
388
0
                        pDrawController->getConfigurationController() );
389
0
                    rtl::Reference<sd::framework::Configuration> xConfiguration (
390
0
                        xConfigurationController->getRequestedConfiguration() );
391
392
0
                    SfxChildWindow* pWindow = pFrame->GetChildWindow(nId);
393
0
                    if(pWindow)
394
0
                    {
395
0
                        Svx3DWin* p3DWin = static_cast<Svx3DWin*>(pWindow->GetWindow());
396
0
                        if(p3DWin)
397
0
                            p3DWin->DocumentReload();
398
0
                    }
399
400
                    // normal forwarding to ViewFrame for execution
401
0
                    GetViewFrame()->ExecuteSlot(rReq);
402
403
                    // From here on we must cope with this object and the frame already being
404
                    // deleted.  Do not call any methods or use data members.
405
0
                    Reference<XController> xController( xFrame->getController(), UNO_SET_THROW );
406
407
                    // Restore the configuration.
408
0
                    if (auto pDrawController2 = dynamic_cast<DrawController*>( xController.get() ))
409
0
                    {
410
0
                        xConfigurationController = pDrawController2->getConfigurationController();
411
0
                        if ( ! xConfigurationController.is())
412
0
                            throw RuntimeException();
413
0
                        xConfigurationController->restoreConfiguration(xConfiguration);
414
0
                    }
415
0
                }
416
0
            }
417
0
            catch (RuntimeException&)
418
0
            {
419
0
                DBG_UNHANDLED_EXCEPTION("sd.view");
420
0
            }
421
422
            // We have to return immediately to avoid accessing this object.
423
0
            return;
424
0
        }
425
426
0
        case SID_JUMPTOMARK:
427
0
        {
428
0
            if( rReq.GetArgs() )
429
0
            {
430
0
                const SfxStringItem* pBookmark = rReq.GetArg(SID_JUMPTOMARK);
431
432
0
                if (pBookmark)
433
0
                {
434
0
                    OUString sBookmark(INetURLObject::decode(pBookmark->GetValue(), INetURLObject::DecodeMechanism::WithCharset));
435
436
0
                    rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
437
0
                    if(xSlideshow.is() && xSlideshow->isRunning())
438
0
                    {
439
0
                        xSlideshow->jumpToBookmark(sBookmark);
440
0
                    }
441
0
                    else
442
0
                    {
443
0
                        GotoBookmark(sBookmark);
444
0
                    }
445
0
                }
446
0
            }
447
0
            rReq.Done();
448
0
            break;
449
0
        }
450
451
0
        case SID_OUTPUT_QUALITY_COLOR:
452
0
        case SID_OUTPUT_QUALITY_GRAYSCALE:
453
0
        case SID_OUTPUT_QUALITY_BLACKWHITE:
454
0
        case SID_OUTPUT_QUALITY_CONTRAST:
455
0
        {
456
0
            ExecReq( rReq );
457
0
            break;
458
0
        }
459
460
0
        case SID_MAIL_SCROLLBODY_PAGEDOWN:
461
0
        {
462
0
            ExecReq( rReq );
463
0
            break;
464
0
        }
465
466
0
        case SID_ATTR_YEAR2000:
467
0
        {
468
0
            FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
469
0
            if (pFormShell != nullptr)
470
0
            {
471
0
                const SfxPoolItem* pItem;
472
0
                if (rReq.GetArgs()->GetItemState(
473
0
                    SID_ATTR_YEAR2000, true, &pItem) == SfxItemState::SET)
474
0
                    pFormShell->SetY2KState (
475
0
                        static_cast<const SfxUInt16Item*>(pItem)->GetValue());
476
0
            }
477
478
0
            rReq.Done();
479
0
        }
480
0
        break;
481
482
0
        case SID_OPT_LOCALE_CHANGED:
483
0
        {
484
0
            GetActiveWindow()->Invalidate();
485
0
            UpdatePreview( mpActualPage );
486
0
            rReq.Done();
487
0
        }
488
0
        break;
489
490
0
        case SID_REGENERATE_DIAGRAM:
491
0
        case SID_DIAGRAM_TO_GROUP:
492
0
        case SID_EDIT_DIAGRAM:
493
0
        {
494
0
            if (1 == rMarkList.GetMarkCount())
495
0
            {
496
0
                SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
497
498
                // Support advanced DiagramHelper
499
0
                if(nullptr != pObj && pObj->isDiagram())
500
0
                {
501
0
                    if (SID_REGENERATE_DIAGRAM == nSlot)
502
0
                    {
503
0
                        mpDrawView->UnmarkAll();
504
0
                        pObj->getDiagramHelper()->reLayout();
505
0
                        mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView());
506
0
                    }
507
0
                    else if (SID_EDIT_DIAGRAM == nSlot)
508
0
                    {
509
0
                        VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
510
0
                        VclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog(
511
0
                            GetFrameWeld(),
512
0
                            *static_cast<SdrObjGroup*>(pObj));
513
0
                        pDlg->StartExecuteAsync(
514
0
                            [pDlg] (sal_Int32 /*nResult*/)->void
515
0
                            {
516
0
                                pDlg->disposeOnce();
517
0
                            }
518
0
                        );
519
0
                    }
520
0
                    else // SID_DIAGRAM_TO_GROUP
521
0
                    {
522
0
                        mpDrawView->UnmarkAll();
523
0
                        pObj->getDiagramHelper()->disconnectFromSdrObjGroup(true);
524
0
                        mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView());
525
0
                    }
526
0
                }
527
0
            }
528
529
0
            rReq.Done();
530
0
        }
531
0
        break;
532
533
0
        default:
534
0
        break;
535
0
    }
536
0
}
537
538
void  DrawViewShell::ExecRuler(SfxRequest& rReq)
539
0
{
540
    // nothing is executed during a slide show!
541
0
    if(HasCurrentFunction(SID_PRESENTATION))
542
0
        return;
543
544
0
    CheckLineTo (rReq);
545
546
0
    const SfxItemSet* pArgs = rReq.GetArgs();
547
0
    const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
548
0
    Size aPageSize = mpActualPage->GetSize();
549
0
    Size aViewSize = GetActiveWindow()->GetViewSize();
550
551
0
    switch ( rReq.GetSlot() )
552
0
    {
553
0
        case SID_ATTR_LONG_LRSPACE:
554
0
            if (pArgs)
555
0
            {
556
0
                std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(*GetDoc()));
557
0
                pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
558
559
0
                const SvxLongLRSpaceItem& rLRSpace =
560
0
                        pArgs->Get(SID_ATTR_LONG_LRSPACE);
561
562
0
                if( mpDrawView->IsTextEdit() )
563
0
                {
564
0
                    ::tools::Rectangle aRect = maMarkRect;
565
0
                    aRect.SetPos(aRect.TopLeft() + aPagePos);
566
0
                    aRect.SetLeft( rLRSpace.GetLeft() );
567
0
                    aRect.SetRight( aViewSize.Width() - rLRSpace.GetRight() );
568
0
                    aRect.SetPos(aRect.TopLeft() - aPagePos);
569
0
                    if ( aRect != maMarkRect)
570
0
                    {
571
0
                        mpDrawView->SetAllMarkedRect(aRect);
572
0
                        maMarkRect = mpDrawView->GetAllMarkedRect();
573
0
                        Invalidate( SID_RULER_OBJECT );
574
0
                    }
575
0
                }
576
0
                else
577
0
                {
578
0
                    ::tools::Long nLeft = std::max(::tools::Long(0), rLRSpace.GetLeft() - aPagePos.X());
579
0
                    ::tools::Long nRight = std::max(::tools::Long(0), rLRSpace.GetRight() + aPagePos.X() +
580
0
                                          aPageSize.Width() - aViewSize.Width());
581
582
0
                    sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
583
0
                    sal_uInt16 i;
584
0
                    for ( i = 0; i < nPageCnt; i++)
585
0
                    {
586
0
                        SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
587
0
                        SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(),
588
0
                                                pPage,
589
0
                                                pPage->GetLeftBorder(),
590
0
                                                pPage->GetRightBorder(),
591
0
                                                nLeft, nRight);
592
0
                        pUndoGroup->AddAction(pUndo);
593
0
                        pPage->SetLeftBorder(nLeft);
594
0
                        pPage->SetRightBorder(nRight);
595
0
                    }
596
0
                    nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
597
598
0
                    for (i = 0; i < nPageCnt; i++)
599
0
                    {
600
0
                        SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
601
0
                        SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(),
602
0
                                                pPage,
603
0
                                                pPage->GetLeftBorder(),
604
0
                                                pPage->GetRightBorder(),
605
0
                                                nLeft, nRight);
606
0
                        pUndoGroup->AddAction(pUndo);
607
0
                        pPage->SetLeftBorder(nLeft);
608
0
                        pPage->SetRightBorder(nRight);
609
0
                    }
610
0
                    InvalidateWindows();
611
0
                }
612
613
                // give the undo group to the undo manager
614
0
                GetViewFrame()->GetObjectShell()->GetUndoManager()->
615
0
                                                    AddUndoAction(std::move(pUndoGroup));
616
0
            }
617
0
            break;
618
0
        case SID_ATTR_LONG_ULSPACE:
619
0
            if (pArgs)
620
0
            {
621
0
                std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(*GetDoc()));
622
0
                pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
623
624
0
                const SvxLongULSpaceItem& rULSpace =
625
0
                        pArgs->Get(SID_ATTR_LONG_ULSPACE);
626
627
0
                if( mpDrawView->IsTextEdit() )
628
0
                {
629
0
                    ::tools::Rectangle aRect = maMarkRect;
630
0
                    aRect.SetPos(aRect.TopLeft() + aPagePos);
631
0
                    aRect.SetTop( rULSpace.GetUpper() );
632
0
                    aRect.SetBottom( aViewSize.Height() - rULSpace.GetLower() );
633
0
                    aRect.SetPos(aRect.TopLeft() - aPagePos);
634
635
0
                    if ( aRect != maMarkRect)
636
0
                    {
637
0
                        mpDrawView->SetAllMarkedRect(aRect);
638
0
                        maMarkRect = mpDrawView->GetAllMarkedRect();
639
0
                        Invalidate( SID_RULER_OBJECT );
640
0
                    }
641
0
                }
642
0
                else
643
0
                {
644
0
                    ::tools::Long nUpper = std::max(::tools::Long(0), rULSpace.GetUpper() - aPagePos.Y());
645
0
                    ::tools::Long nLower = std::max(::tools::Long(0), rULSpace.GetLower() + aPagePos.Y() +
646
0
                                          aPageSize.Height() - aViewSize.Height());
647
648
0
                    sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
649
0
                    sal_uInt16 i;
650
0
                    for ( i = 0; i < nPageCnt; i++)
651
0
                    {
652
0
                        SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
653
0
                        SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(),
654
0
                                                pPage,
655
0
                                                pPage->GetUpperBorder(),
656
0
                                                pPage->GetLowerBorder(),
657
0
                                                nUpper, nLower);
658
0
                        pUndoGroup->AddAction(pUndo);
659
0
                        pPage->SetUpperBorder(nUpper);
660
0
                        pPage->SetLowerBorder(nLower);
661
0
                    }
662
0
                    nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
663
664
0
                    for (i = 0; i < nPageCnt; i++)
665
0
                    {
666
0
                        SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
667
0
                        SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(),
668
0
                                                pPage,
669
0
                                                pPage->GetUpperBorder(),
670
0
                                                pPage->GetLowerBorder(),
671
0
                                                nUpper, nLower);
672
0
                        pUndoGroup->AddAction(pUndo);
673
0
                        pPage->SetUpperBorder(nUpper);
674
0
                        pPage->SetLowerBorder(nLower);
675
0
                    }
676
0
                    InvalidateWindows();
677
0
                }
678
679
                // give the undo group to the undo manager
680
0
                GetViewFrame()->GetObjectShell()->GetUndoManager()->
681
0
                                                    AddUndoAction(std::move(pUndoGroup));
682
0
            }
683
0
            break;
684
0
        case SID_RULER_OBJECT:
685
0
            if (pArgs)
686
0
            {
687
0
                ::tools::Rectangle aRect = maMarkRect;
688
0
                aRect.SetPos(aRect.TopLeft() + aPagePos);
689
690
0
                const SvxObjectItem& rOI = pArgs->Get(SID_RULER_OBJECT);
691
692
0
                if ( rOI.GetStartX() != rOI.GetEndX() )
693
0
                {
694
0
                    aRect.SetLeft( rOI.GetStartX() );
695
0
                    aRect.SetRight( rOI.GetEndX() );
696
0
                }
697
0
                if ( rOI.GetStartY() != rOI.GetEndY() )
698
0
                {
699
0
                    aRect.SetTop( rOI.GetStartY() );
700
0
                    aRect.SetBottom( rOI.GetEndY() );
701
0
                }
702
0
                aRect.SetPos(aRect.TopLeft() - aPagePos);
703
0
                if ( aRect != maMarkRect)
704
0
                {
705
0
                    mpDrawView->SetAllMarkedRect(aRect);
706
0
                    maMarkRect = mpDrawView->GetAllMarkedRect();
707
0
                    Invalidate( SID_RULER_OBJECT );
708
0
                }
709
0
            }
710
0
            break;
711
0
        case SID_ATTR_TABSTOP:
712
0
            if (pArgs && mpDrawView->IsTextEdit())
713
0
            {
714
0
                const SvxTabStopItem& rItem = pArgs->Get( EE_PARA_TABS );
715
716
0
                SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_TABS, EE_PARA_TABS>( GetPool() ));
717
718
0
                aEditAttr.Put( rItem );
719
0
                mpDrawView->SetAttributes( aEditAttr );
720
721
0
                Invalidate(SID_ATTR_TABSTOP);
722
0
            }
723
0
            break;
724
0
        case SID_ATTR_PARA_LINESPACE:
725
0
            if (pArgs)
726
0
            {
727
0
                SvxLineSpacingItem aParaLineSP = pArgs->Get(
728
0
                    GetPool().GetWhichIDFromSlotID(SID_ATTR_PARA_LINESPACE));
729
730
0
                SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_SBL, EE_PARA_SBL>( GetPool() ));
731
0
                aParaLineSP.SetWhich( EE_PARA_SBL );
732
733
0
                aEditAttr.Put( aParaLineSP );
734
0
                mpDrawView->SetAttributes( aEditAttr );
735
736
0
                Invalidate(SID_ATTR_PARA_LINESPACE);
737
0
            }
738
0
            break;
739
0
        case SID_ATTR_PARA_ADJUST_LEFT:
740
0
        {
741
0
            SvxAdjustItem aItem( SvxAdjust::Left, EE_PARA_JUST );
742
0
            SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_JUST, EE_PARA_JUST>( GetPool() ));
743
744
0
            aEditAttr.Put( aItem );
745
0
            mpDrawView->SetAttributes( aEditAttr );
746
747
0
            Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
748
0
            break;
749
0
        }
750
0
        case SID_ATTR_PARA_ADJUST_CENTER:
751
0
        {
752
0
            SvxAdjustItem aItem( SvxAdjust::Center, EE_PARA_JUST );
753
0
            SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_JUST, EE_PARA_JUST>( GetPool() ));
754
755
0
            aEditAttr.Put( aItem );
756
0
            mpDrawView->SetAttributes( aEditAttr );
757
758
0
            Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
759
0
            break;
760
0
        }
761
0
        case SID_ATTR_PARA_ADJUST_RIGHT:
762
0
        {
763
0
            SvxAdjustItem aItem( SvxAdjust::Right, EE_PARA_JUST );
764
0
            SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_JUST, EE_PARA_JUST>( GetPool() ));
765
766
0
            aEditAttr.Put( aItem );
767
0
            mpDrawView->SetAttributes( aEditAttr );
768
769
0
            Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
770
0
            break;
771
0
        }
772
0
        case SID_ATTR_PARA_ADJUST_BLOCK:
773
0
        {
774
0
            SvxAdjustItem aItem( SvxAdjust::Block, EE_PARA_JUST );
775
0
            SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_JUST, EE_PARA_JUST>( GetPool() ));
776
777
0
            aEditAttr.Put( aItem );
778
0
            mpDrawView->SetAttributes( aEditAttr );
779
780
0
            Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
781
0
            break;
782
0
        }
783
0
        case SID_ATTR_PARA_ADJUST_START:
784
0
        {
785
0
            SvxAdjustItem aItem( SvxAdjust::ParaStart, EE_PARA_JUST );
786
0
            SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_JUST, EE_PARA_JUST>( GetPool() ));
787
788
0
            aEditAttr.Put( aItem );
789
0
            mpDrawView->SetAttributes( aEditAttr );
790
791
0
            Invalidate(SID_ATTR_PARA_ADJUST_START);
792
0
            break;
793
0
        }
794
0
        case SID_ATTR_PARA_ADJUST_END:
795
0
        {
796
0
            SvxAdjustItem aItem( SvxAdjust::ParaEnd, EE_PARA_JUST );
797
0
            SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_JUST, EE_PARA_JUST>( GetPool() ));
798
799
0
            aEditAttr.Put( aItem );
800
0
            mpDrawView->SetAttributes( aEditAttr );
801
802
0
            Invalidate(SID_ATTR_PARA_ADJUST_END);
803
0
            break;
804
0
        }
805
0
        case SID_ATTR_PARA_ULSPACE:
806
0
            if (pArgs)
807
0
            {
808
0
                SvxULSpaceItem aULSP = static_cast<const SvxULSpaceItem&>(pArgs->Get(
809
0
                    SID_ATTR_PARA_ULSPACE));
810
0
                SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_ULSPACE, EE_PARA_ULSPACE>( GetPool() ));
811
0
                aULSP.SetWhich( EE_PARA_ULSPACE );
812
813
0
                aEditAttr.Put( aULSP );
814
0
                mpDrawView->SetAttributes( aEditAttr );
815
816
0
                Invalidate(SID_ATTR_PARA_ULSPACE);
817
0
            }
818
0
            break;
819
0
        case SID_ATTR_PARA_LRSPACE:
820
0
            if (pArgs)
821
0
            {
822
0
                SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get(
823
0
                    SID_ATTR_PARA_LRSPACE));
824
825
0
                SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<EE_PARA_LRSPACE, EE_PARA_LRSPACE>( GetPool() ));
826
0
                aLRSpace.SetWhich( EE_PARA_LRSPACE );
827
828
0
                aEditAttr.Put( aLRSpace );
829
0
                mpDrawView->SetAttributes( aEditAttr );
830
831
0
                Invalidate(SID_ATTR_PARA_LRSPACE);
832
0
            }
833
0
            break;
834
0
        case SID_ATTR_LRSPACE:
835
0
            if (pArgs && mpDrawView->IsTextEdit())
836
0
            {
837
0
                sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
838
0
                const SvxLRSpaceItem& rItem = static_cast<const SvxLRSpaceItem&>(
839
0
                            pArgs->Get( nId ));
840
841
0
                SfxItemSet aEditAttr(SfxItemSet::makeFixedSfxItemSet<
842
0
                    EE_PARA_NUMBULLET, EE_PARA_NUMBULLET,
843
0
                    EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL,
844
0
                    EE_PARA_LRSPACE, EE_PARA_LRSPACE> ( GetDoc()->GetPool() ));
845
0
                mpDrawView->GetAttributes( aEditAttr );
846
847
0
                nId = EE_PARA_LRSPACE;
848
0
                SvxLRSpaceItem aLRSpaceItem(rItem.GetLeft(), rItem.GetRight(),
849
0
                                            rItem.GetTextFirstLineOffset(), nId);
850
851
0
                const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue();
852
0
                const SvxLRSpaceItem& rOrigLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE );
853
0
                const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET );
854
0
                if( nOutlineLevel != -1 &&
855
0
                    rNumBulletItem.GetNumRule().GetLevelCount() > nOutlineLevel )
856
0
                {
857
0
                    const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule().GetLevel(nOutlineLevel);
858
0
                    SvxNumberFormat aFormat(rFormat);
859
860
                    // left margin gets distributed onto LRSpace item
861
                    // and number format AbsLSpace - this fixes
862
                    // n#707779 (previously, LRSpace left indent could
863
                    // become negative - EditEngine really does not
864
                    // like that.
865
0
                    const auto nAbsLSpace=aFormat.GetAbsLSpace();
866
0
                    const ::tools::Long nTxtLeft = rItem.ResolveTextLeft({});
867
0
                    const ::tools::Long  nLeftIndent=std::max(::tools::Long(0),nTxtLeft - nAbsLSpace);
868
0
                    aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(nLeftIndent));
869
                    // control for clipped left indent - remainder
870
                    // reduces number format first line indent
871
0
                    aFormat.SetAbsLSpace(nTxtLeft - nLeftIndent);
872
873
                    // negative first line indent goes to the number
874
                    // format, positive to the lrSpace item
875
0
                    if (rItem.GetTextFirstLineOffset().m_dValue < 0.0)
876
0
                    {
877
0
                        aFormat.SetFirstLineOffset(rItem.ResolveTextFirstLineOffset({})
878
0
                                                   - rOrigLRSpaceItem.ResolveTextFirstLineOffset({})
879
0
                                                   + aFormat.GetCharTextDistance());
880
0
                        aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::zero());
881
0
                    }
882
0
                    else
883
0
                    {
884
0
                        aFormat.SetFirstLineOffset(0);
885
0
                        aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(
886
0
                            rItem.ResolveTextFirstLineOffset({}) - aFormat.GetFirstLineOffset()
887
0
                            + aFormat.GetCharTextDistance()));
888
0
                    }
889
890
0
                    if( rFormat != aFormat )
891
0
                    {
892
                        // put all items
893
0
                        const_cast<SvxNumRule&>(rNumBulletItem.GetNumRule()).SetLevel(nOutlineLevel,aFormat);
894
0
                        aEditAttr.Put( rNumBulletItem );
895
0
                        aEditAttr.Put( aLRSpaceItem );
896
0
                        mpDrawView->SetAttributes( aEditAttr );
897
898
0
                        Invalidate(SID_ATTR_PARA_LRSPACE);
899
0
                        break;
900
0
                    }
901
0
                }
902
903
                // only put lrSpace item
904
0
                SfxItemSet aEditAttrReduced(SfxItemSet::makeFixedSfxItemSet<EE_PARA_LRSPACE, EE_PARA_LRSPACE>( GetDoc()->GetPool() ));
905
0
                aEditAttrReduced.Put( aLRSpaceItem );
906
0
                mpDrawView->SetAttributes( aEditAttrReduced );
907
908
0
                Invalidate(SID_ATTR_PARA_LRSPACE);
909
0
            }
910
0
            break;
911
0
    }
912
0
}
913
914
void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
915
0
{
916
0
    Point aOrigin;
917
918
0
    if (mpDrawView->GetSdrPageView())
919
0
    {
920
0
        aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin();
921
0
    }
922
923
0
    Size aViewSize = GetActiveWindow()->GetViewSize();
924
925
0
    const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
926
0
    Size aPageSize = mpActualPage->GetSize();
927
928
0
    ::tools::Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()),
929
0
                                     aViewSize.Height() - (aPagePos.Y() + aPageSize.Height())));
930
931
0
    if( mpDrawView->IsTextEdit() )
932
0
    {
933
0
        Point aPnt1 = GetActiveWindow()->GetWinViewPos();
934
0
        ::tools::Rectangle aMinMaxRect( aPnt1, Size(-1, -1) );
935
0
        rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
936
0
    }
937
0
    else
938
0
    {
939
0
        rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) );
940
0
    }
941
942
0
    SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLeftBorder(),
943
0
                                aRect.Right() + mpActualPage->GetRightBorder(),
944
0
                                SID_ATTR_LONG_LRSPACE);
945
0
    SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUpperBorder(),
946
0
                                aRect.Bottom() + mpActualPage->GetLowerBorder(),
947
0
                                SID_ATTR_LONG_ULSPACE);
948
0
    rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(),
949
0
                                                       aViewSize.Height()));
950
0
    SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin );
951
952
0
    SvxProtectItem aProtect( SID_RULER_PROTECT );
953
954
0
    maMarkRect = mpDrawView->GetAllMarkedRect();
955
956
0
    const bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == css::text::WritingMode_RL_TB;
957
0
    rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL));
958
0
    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
959
960
0
    if( rMarkList.GetMarkCount() != 0 )
961
0
    {
962
0
        if( mpDrawView->IsTextEdit() )
963
0
        {
964
0
            SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
965
0
            if( pObj->GetObjInventor() == SdrInventor::Default)
966
0
            {
967
0
                SfxItemSet aEditAttr( GetDoc()->GetPool() );
968
0
                mpDrawView->GetAttributes( aEditAttr );
969
0
                if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SfxItemState::DEFAULT )
970
0
                {
971
0
                    const SvxTabStopItem& rItem = aEditAttr.Get( EE_PARA_TABS );
972
0
                    rSet.Put( rItem );
973
974
0
                    const SvxLRSpaceItem& rLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE );
975
0
                    SvxLRSpaceItem aLRSpaceItem(rLRSpaceItem.GetLeft(), rLRSpaceItem.GetRight(),
976
0
                                                rLRSpaceItem.GetTextFirstLineOffset(),
977
0
                                                SID_ATTR_PARA_LRSPACE);
978
979
0
                    const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue();
980
0
                    const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET );
981
0
                    if( nOutlineLevel != -1 &&
982
0
                        rNumBulletItem.GetNumRule().GetLevelCount() > nOutlineLevel )
983
0
                    {
984
0
                        const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule().GetLevel(nOutlineLevel);
985
0
                        aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(
986
0
                            rFormat.GetAbsLSpace() + rLRSpaceItem.ResolveTextLeft({})));
987
0
                        aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(
988
0
                            rLRSpaceItem.ResolveTextFirstLineOffset({})
989
0
                            + rFormat.GetFirstLineOffset() - rFormat.GetCharTextDistance()));
990
0
                    }
991
992
0
                    rSet.Put( aLRSpaceItem );
993
994
0
                    Point aPos( aPagePos + maMarkRect.TopLeft() );
995
996
0
                    if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SfxItemState::SET )
997
0
                    {
998
0
                        const SdrMetricItem& rTLDItem = aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
999
0
                        ::tools::Long nLD = rTLDItem.GetValue();
1000
0
                        aPos.AdjustX(nLD );
1001
0
                    }
1002
1003
0
                    aPointItem.SetValue( aPos );
1004
1005
0
                    ::tools::Rectangle aParaRect(maMarkRect);
1006
0
                    if (pObj->GetObjIdentifier() == SdrObjKind::Table)
1007
0
                    {
1008
0
                        sdr::table::SdrTableObj* pTable = static_cast<sdr::table::SdrTableObj*>(pObj);
1009
0
                        sdr::table::CellPos cellpos;
1010
0
                        pTable->getActiveCellPos(cellpos);
1011
0
                        pTable->getCellBounds(cellpos, aParaRect);
1012
0
                    }
1013
1014
0
                    aLRSpace.SetLeft(aPagePos.X() + aParaRect.Left());
1015
1016
0
                    if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SfxItemState::SET )
1017
0
                    {
1018
0
                        const SdrMetricItem& rTLDItem = aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
1019
0
                        ::tools::Long nLD = rTLDItem.GetValue();
1020
0
                        aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD );
1021
0
                    }
1022
1023
0
                    aLRSpace.SetRight(aRect.Right() + aPageSize.Width() - aParaRect.Right());
1024
1025
0
                    if ( aEditAttr.GetItemState( SDRATTR_TEXT_RIGHTDIST ) == SfxItemState::SET )
1026
0
                    {
1027
0
                        const SdrMetricItem& rTRDItem = aEditAttr.Get( SDRATTR_TEXT_RIGHTDIST );
1028
0
                        ::tools::Long nRD = rTRDItem.GetValue();
1029
0
                        aLRSpace.SetRight( aLRSpace.GetRight() + nRD );
1030
0
                    }
1031
1032
0
                    aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() );
1033
0
                    aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() );
1034
1035
0
                    rSet.DisableItem( SID_RULER_OBJECT );
1036
1037
                    // lock page margins
1038
0
                    aProtect.SetSizeProtect( true );
1039
0
                    aProtect.SetPosProtect( true );
1040
0
                }
1041
1042
0
                if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SfxItemState::DEFAULT )
1043
0
                {
1044
0
                    const SvxFrameDirectionItem& rItem = aEditAttr.Get( EE_PARA_WRITINGDIR );
1045
0
                    rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == SvxFrameDirection::Horizontal_RL_TB));
1046
0
                }
1047
0
            }
1048
0
        }
1049
0
        else
1050
0
        {
1051
0
            rSet.DisableItem( EE_PARA_TABS );
1052
0
            rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
1053
1054
0
            if( mpDrawView->IsResizeAllowed(true) )
1055
0
            {
1056
0
                ::tools::Rectangle aResizeRect( maMarkRect );
1057
1058
0
                aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos);
1059
0
                SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(),
1060
0
                                       aResizeRect.Top(), aResizeRect.Bottom());
1061
0
                rSet.Put(aObjItem);
1062
0
                rSet.DisableItem( EE_PARA_TABS );
1063
0
            }
1064
0
            else
1065
0
            {
1066
0
                rSet.DisableItem( SID_RULER_OBJECT );
1067
0
            }
1068
0
        }
1069
0
    }
1070
0
    else
1071
0
    {
1072
0
        rSet.DisableItem( SID_RULER_OBJECT );
1073
0
        rSet.DisableItem( EE_PARA_TABS );
1074
0
    }
1075
1076
0
    rSet.Put( aLRSpace );
1077
0
    rSet.Put( aULSpace );
1078
1079
0
    rSet.Put( aPointItem );
1080
0
    rSet.Put( aProtect );
1081
0
}
1082
1083
void  DrawViewShell::ExecStatusBar(SfxRequest& rReq)
1084
0
{
1085
    // nothing is executed during a slide show!
1086
0
    if(HasCurrentFunction(SID_PRESENTATION))
1087
0
        return;
1088
1089
0
    CheckLineTo (rReq);
1090
1091
0
    switch ( rReq.GetSlot() )
1092
0
    {
1093
0
        case SID_ATTR_SIZE:
1094
0
        {
1095
0
            GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SfxCallMode::ASYNCHRON );
1096
0
        }
1097
0
        break;
1098
1099
0
        case SID_STATUS_LAYOUT:
1100
0
        {
1101
0
            GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SfxCallMode::ASYNCHRON );
1102
0
        }
1103
0
        break;
1104
1105
0
        case SID_STATUS_PAGE:
1106
0
        {
1107
0
            GetViewFrame()->GetDispatcher()->Execute(SID_GO_TO_PAGE,
1108
0
                                SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
1109
0
        }
1110
0
        break;
1111
0
    }
1112
0
}
1113
1114
/**
1115
 * set state of snap object entries in popup
1116
 */
1117
void  DrawViewShell::GetSnapItemState( SfxItemSet &rSet )
1118
0
{
1119
0
    SdrPageView* pPV;
1120
0
    Point   aMPos = GetActiveWindow()->PixelToLogic(maMousePos);
1121
0
    sal_uInt16  nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic(
1122
0
        Size(FuPoor::HITPIX,0)).Width());
1123
0
    sal_uInt16  nHelpLine;
1124
1125
0
    if ( !mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow()->GetOutDev(), nHelpLine, pPV) )
1126
0
        return;
1127
1128
0
    const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
1129
1130
0
    if ( rHelpLine.GetKind() == SdrHelpLineKind::Point )
1131
0
    {
1132
0
        rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
1133
0
                            SdResId( STR_POPUP_EDIT_SNAPPOINT)) );
1134
0
        rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
1135
0
                            SdResId( STR_POPUP_DELETE_SNAPPOINT)) );
1136
0
    }
1137
0
    else
1138
0
    {
1139
0
        rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
1140
0
                            SdResId( STR_POPUP_EDIT_SNAPLINE)) );
1141
0
        rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
1142
0
                            SdResId( STR_POPUP_DELETE_SNAPLINE)) );
1143
0
    }
1144
0
}
1145
1146
void DrawViewShell::RememberCanvasPageVisArea(const ::tools::Rectangle &aRect)
1147
0
{
1148
0
    if (!GetDoc()->HasCanvasPage())
1149
0
        return;
1150
0
    maCanvasPageVisArea = aRect;
1151
0
}
1152
1153
} // end of namespace sd
1154
1155
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */