Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/view/drviews2.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 <avmedia/mediaplayer.hxx>
23
24
#include <basic/sberrors.hxx>
25
#include <basic/sbstar.hxx>
26
27
#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
28
#include <com/sun/star/drawing/XDrawPages.hpp>
29
#include <com/sun/star/lang/XInitialization.hpp>
30
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
31
#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
32
#include <com/sun/star/frame/XDispatchProvider.hpp>
33
#include <com/sun/star/util/URLTransformer.hpp>
34
#include <com/sun/star/util/XURLTransformer.hpp>
35
#include <com/sun/star/scanner/XScannerManager2.hpp>
36
#include <com/sun/star/document/XDocumentProperties.hpp>
37
38
#include <comphelper/processfactory.hxx>
39
#include <comphelper/propertysequence.hxx>
40
#include <comphelper/scopeguard.hxx>
41
#include <comphelper/lok.hxx>
42
#include <comphelper/sequence.hxx>
43
#include <comphelper/sequenceashashmap.hxx>
44
#include <comphelper/dispatchcommand.hxx>
45
#include <comphelper/propertyvalue.hxx>
46
47
#include <editeng/contouritem.hxx>
48
#include <editeng/editdata.hxx>
49
#include <editeng/eeitem.hxx>
50
#include <editeng/flditem.hxx>
51
#include <editeng/section.hxx>
52
#include <editeng/editobj.hxx>
53
#include <editeng/CustomPropertyField.hxx>
54
#include <editeng/urlfieldhelper.hxx>
55
56
#include <sal/log.hxx>
57
58
#include <sfx2/bindings.hxx>
59
#include <sfx2/dispatch.hxx>
60
#include <sfx2/docfile.hxx>
61
#include <sfx2/msgpool.hxx>
62
#include <sfx2/msg.hxx>
63
#include <sfx2/request.hxx>
64
#include <sfx2/viewfrm.hxx>
65
#include <sfx2/zoomitem.hxx>
66
#include <sfx2/lokhelper.hxx>
67
#include <sfx2/lokunocmdlist.hxx>
68
#include <svtools/dlgname.hxx>
69
#include <svx/compressgraphicdialog.hxx>
70
#include <svx/ClassificationDialog.hxx>
71
#include <svx/ClassificationCommon.hxx>
72
#include <svx/bmpmask.hxx>
73
#include <svx/extedit.hxx>
74
#include <svx/extrusionbar.hxx>
75
#include <svx/f3dchild.hxx>
76
#include <svx/fontwork.hxx>
77
#include <svx/fontworkbar.hxx>
78
#include <svx/graphichelper.hxx>
79
#include <svx/hlnkitem.hxx>
80
#include <svx/imapdlg.hxx>
81
#include <svx/sdtagitm.hxx>
82
#include <svx/svdetc.hxx>
83
#include <svx/svdograf.hxx>
84
#include <svx/svdoole2.hxx>
85
#include <svx/svdpagv.hxx>
86
#include <svx/svdundo.hxx>
87
#include <svx/svxdlg.hxx>
88
#include <svx/svxids.hrc>
89
#include <svx/sdtfsitm.hxx>
90
#include <svx/sdmetitm.hxx>
91
#include <svx/zoomslideritem.hxx>
92
#include <svx/xflclit.hxx>
93
#include <svx/xlnwtit.hxx>
94
#include <svx/chrtitem.hxx>
95
#include <svx/xlnclit.hxx>
96
#include <svx/xflgrit.hxx>
97
#include <svx/xfillit0.hxx>
98
99
#include <comphelper/diagnose_ex.hxx>
100
#include <tools/UnitConversion.hxx>
101
102
#include <unotools/useroptions.hxx>
103
104
#include <vcl/abstdlg.hxx>
105
#include <vcl/graph.hxx>
106
#include <vcl/svapp.hxx>
107
#include <vcl/unohelp2.hxx>
108
#include <vcl/weld/MessageDialog.hxx>
109
#include <vcl/weld/WaitObject.hxx>
110
111
#include <editeng/cmapitem.hxx>
112
#include <editeng/escapementitem.hxx>
113
#include <editeng/kernitem.hxx>
114
#include <editeng/wghtitem.hxx>
115
#include <editeng/postitem.hxx>
116
#include <editeng/udlnitem.hxx>
117
#include <editeng/crossedoutitem.hxx>
118
#include <editeng/shdditem.hxx>
119
#include <editeng/numitem.hxx>
120
#include <svx/svdobj.hxx>
121
#include <svx/SvxColorChildWindow.hxx>
122
#include <editeng/outlobj.hxx>
123
#include <editeng/flstitem.hxx>
124
#include <editeng/fontitem.hxx>
125
#include <editeng/fhgtitem.hxx>
126
#include <editeng/colritem.hxx>
127
128
#include <svl/poolitem.hxx>
129
#include <svl/style.hxx>
130
#include <svl/whiter.hxx>
131
132
#include <app.hrc>
133
#include <strings.hrc>
134
135
#include <AnimationChildWindow.hxx>
136
#include <DrawDocShell.hxx>
137
#include <DrawViewShell.hxx>
138
#include <LayerTabBar.hxx>
139
#include <Outliner.hxx>
140
#include <ViewShellHint.hxx>
141
#include <ViewShellImplementation.hxx>
142
#include <Window.hxx>
143
#include <drawdoc.hxx>
144
#include <SlideSectionManager.hxx>
145
#include <UndoSlideSection.hxx>
146
#include <drawview.hxx>
147
#include <fuarea.hxx>
148
#include <fubullet.hxx>
149
#include <fuchar.hxx>
150
#include <fucushow.hxx>
151
#include <fuconnct.hxx>
152
#include <fucopy.hxx>
153
#include <fudspord.hxx>
154
#include <fuexecuteinteraction.hxx>
155
#include <fuexpand.hxx>
156
#include <fuinsert.hxx>
157
#include <fuinsfil.hxx>
158
#include <fuline.hxx>
159
#include <fulinend.hxx>
160
#include <fulink.hxx>
161
#include <fumeasur.hxx>
162
#include <fumorph.hxx>
163
#include <fuoaprms.hxx>
164
#include <fuolbull.hxx>
165
#include <fupage.hxx>
166
#include <fuparagr.hxx>
167
#include <fuprlout.hxx>
168
#include <fuscale.hxx>
169
#include <fusel.hxx>
170
#include <fusldlg.hxx>
171
#include <fusnapln.hxx>
172
#include <fusumry.hxx>
173
#include <futempl.hxx>
174
#include <futhes.hxx>
175
#include <futransf.hxx>
176
#include <futxtatt.hxx>
177
#include <fuvect.hxx>
178
#include <futext.hxx>
179
#include <helpids.h>
180
#include <sdabstdlg.hxx>
181
#include <sdattr.hxx>
182
#include <sdpage.hxx>
183
#include <sdresid.hxx>
184
#include <unokywds.hxx>
185
#include <slideshow.hxx>
186
#include <stlsheet.hxx>
187
#include <undolayer.hxx>
188
#include <sfx2/sidebar/Sidebar.hxx>
189
#include <sfx2/classificationhelper.hxx>
190
#include <sdmod.hxx>
191
#include <model/SlsPageDescriptor.hxx>
192
#include <model/SlsPageEnumerationProvider.hxx>
193
#include <SlideSorter.hxx>
194
#include <view/SlideSorterView.hxx>
195
#include <SlideSorterViewShell.hxx>
196
#include <controller/SlideSorterController.hxx>
197
#include <controller/SlsPageSelector.hxx>
198
#include <controller/SlsClipboard.hxx>
199
#include <tools/GraphicSizeCheck.hxx>
200
201
#include <theme/ThemeColorChanger.hxx>
202
#include <svx/dialog/ThemeDialog.hxx>
203
#include <svx/dialog/ThemeColorEditDialog.hxx>
204
#include <svx/ColorSets.hxx>
205
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
206
207
#include <ViewShellBase.hxx>
208
#include <memory>
209
210
#include <sfx2/newstyle.hxx>
211
#include <SelectLayerDlg.hxx>
212
#include <unomodel.hxx>
213
214
#include <iostream>
215
#include <boost/property_tree/json_parser.hpp>
216
#include <rtl/uri.hxx>
217
#include <editeng/editeng.hxx>
218
219
220
using namespace ::com::sun::star;
221
using namespace ::com::sun::star::uno;
222
223
0
#define MIN_ACTIONS_FOR_DIALOG  5000    ///< if there are more meta objects, we show a dialog during the break up
224
225
namespace sd {
226
227
namespace {
228
229
const SvxFieldItem* findField(editeng::Section const & rSection)
230
0
{
231
0
    for (SfxPoolItem const * pPool: rSection.maAttributes)
232
0
    {
233
0
        if (pPool->Which() == EE_FEATURE_FIELD)
234
0
            return static_cast<const SvxFieldItem*>(pPool);
235
0
    }
236
0
    return nullptr;
237
0
}
238
239
bool hasCustomPropertyField(std::vector<editeng::Section> const & aSections, std::u16string_view rName)
240
0
{
241
0
    for (editeng::Section const & rSection : aSections)
242
0
    {
243
0
        const SvxFieldItem* pFieldItem = findField(rSection);
244
0
        if (pFieldItem)
245
0
        {
246
0
            const editeng::CustomPropertyField* pCustomPropertyField = dynamic_cast<const editeng::CustomPropertyField*>(pFieldItem->GetField());
247
0
            if (pCustomPropertyField && pCustomPropertyField->GetName() == rName)
248
0
                return true;
249
0
        }
250
0
    }
251
0
    return false;
252
0
}
253
254
OUString getWeightString(SfxItemSet const & rItemSet)
255
0
{
256
0
    OUString sWeightString = u"NORMAL"_ustr;
257
258
0
    if (const SfxPoolItem* pItem = rItemSet.GetItem(EE_CHAR_WEIGHT, false))
259
0
    {
260
0
        const SvxWeightItem* pWeightItem = dynamic_cast<const SvxWeightItem*>(pItem);
261
0
        if (pWeightItem && pWeightItem->GetWeight() == WEIGHT_BOLD)
262
0
            sWeightString = "BOLD";
263
0
    }
264
0
    return sWeightString;
265
0
}
266
267
void lcl_LogWarning(const std::string& rWarning)
268
0
{
269
0
    LOK_WARN("sd.transform", rWarning);
270
0
}
271
272
void lcl_UnoCommand(const std::string& rText)
273
0
{
274
0
    if (rText.size() > 0)
275
0
    {
276
0
        OUString aCmd;
277
0
        std::vector<beans::PropertyValue> aArg;
278
0
        std::size_t nSpace = rText.find(' ');
279
0
        if (nSpace != std::string::npos)
280
0
        {
281
0
            aCmd = OStringToOUString(rText.substr(0, nSpace), RTL_TEXTENCODING_UTF8);
282
0
            std::string aArgText = rText.substr(nSpace + 1);
283
284
0
            aArg = comphelper::JsonToPropertyValues(aArgText);
285
0
        }
286
0
        else
287
0
        {
288
0
            aCmd = OStringToOUString(rText, RTL_TEXTENCODING_UTF8);
289
0
        }
290
291
0
        OUString aCmdSub;
292
0
        if (aCmd.startsWith(".uno:"))
293
0
        {
294
0
            aCmdSub = aCmd.subView(5);
295
0
        }
296
0
        else
297
0
        {
298
0
            lcl_LogWarning("FillApi SlideCmd: uno command not recognized'" + rText + "'");
299
0
            return;
300
0
        }
301
302
        // Check if the uno command is allowed
303
0
        const std::map<std::u16string_view, KitUnoCommand>& rUnoCommandList
304
0
            = GetKitUnoCommandList();
305
0
        auto aCmdData = rUnoCommandList.find(aCmdSub);
306
0
        if (aCmdData != rUnoCommandList.end())
307
0
        {
308
            // Make the uno command synchron
309
0
            aArg.push_back(comphelper::makePropertyValue("SynchronMode", true));
310
311
            // Todo: check why it does not work on my windows system
312
0
            comphelper::dispatchCommand(aCmd, comphelper::containerToSequence(aArg));
313
0
        }
314
0
        else
315
0
        {
316
0
            lcl_LogWarning("FillApi SlideCmd: uno command not recognized'" + rText + "'");
317
0
        }
318
0
    }
319
0
}
320
321
class ClassificationCommon
322
{
323
protected:
324
    sd::DrawViewShell& m_rDrawViewShell;
325
    uno::Reference<document::XDocumentProperties> m_xDocumentProperties;
326
    uno::Reference<beans::XPropertyContainer> m_xPropertyContainer;
327
    sfx::ClassificationKeyCreator m_aKeyCreator;
328
public:
329
    ClassificationCommon(sd::DrawViewShell& rDrawViewShell, const css::uno::Reference<css::document::XDocumentProperties>& rDocProps)
330
0
        : m_rDrawViewShell(rDrawViewShell)
331
0
        , m_xDocumentProperties(rDocProps)
332
0
        , m_xPropertyContainer(m_xDocumentProperties->getUserDefinedProperties())
333
0
        , m_aKeyCreator(SfxClassificationHelper::getPolicyType())
334
0
    {}
335
};
336
337
class ClassificationCollector : public ClassificationCommon
338
{
339
private:
340
    std::vector<svx::ClassificationResult> m_aResults;
341
342
    void iterateSectionsAndCollect(std::vector<editeng::Section> const & rSections, EditTextObject const & rEditText)
343
0
    {
344
0
        sal_Int32 nCurrentParagraph = -1;
345
0
        OUString sBlank;
346
347
0
        for (editeng::Section const & rSection : rSections)
348
0
        {
349
            // Insert new paragraph if needed
350
0
            while (nCurrentParagraph < rSection.mnParagraph)
351
0
            {
352
0
                nCurrentParagraph++;
353
                // Get Weight of current paragraph
354
0
                OUString sWeightProperty = getWeightString(rEditText.GetParaAttribs(nCurrentParagraph));
355
                // Insert new paragraph into collection
356
0
                m_aResults.emplace_back(svx::ClassificationType::PARAGRAPH, sWeightProperty, sBlank, sBlank);
357
0
            }
358
359
0
            const SvxFieldItem* pFieldItem = findField(rSection);
360
0
            const editeng::CustomPropertyField* pCustomPropertyField = pFieldItem ?
361
0
                dynamic_cast<const editeng::CustomPropertyField*>(pFieldItem->GetField()) :
362
0
                nullptr;
363
0
            if (pCustomPropertyField)
364
0
            {
365
0
                const OUString& aKey = pCustomPropertyField->GetName();
366
0
                if (m_aKeyCreator.isMarkingTextKey(aKey))
367
0
                {
368
0
                    m_aResults.emplace_back(svx::ClassificationType::TEXT,
369
0
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
370
0
                                           sBlank, sBlank);
371
0
                }
372
0
                else if (m_aKeyCreator.isCategoryNameKey(aKey) || m_aKeyCreator.isCategoryIdentifierKey(aKey))
373
0
                {
374
0
                    m_aResults.emplace_back(svx::ClassificationType::CATEGORY,
375
0
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
376
0
                                           sBlank, sBlank);
377
0
                }
378
0
                else if (m_aKeyCreator.isMarkingKey(aKey))
379
0
                {
380
0
                    m_aResults.emplace_back(svx::ClassificationType::MARKING,
381
0
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
382
0
                                           sBlank, sBlank);
383
0
                }
384
0
                else if (m_aKeyCreator.isIntellectualPropertyPartKey(aKey))
385
0
                {
386
0
                    m_aResults.emplace_back(svx::ClassificationType::INTELLECTUAL_PROPERTY_PART,
387
0
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
388
0
                                           sBlank, sBlank);
389
0
                }
390
0
            }
391
0
        }
392
0
    }
393
394
public:
395
    ClassificationCollector(sd::DrawViewShell & rDrawViewShell, const css::uno::Reference<css::document::XDocumentProperties>& rDocProps)
396
0
        : ClassificationCommon(rDrawViewShell, rDocProps)
397
0
    {}
398
399
    std::vector<svx::ClassificationResult> const & getResults() const
400
0
    {
401
0
        return m_aResults;
402
0
    }
403
404
    void collect()
405
0
    {
406
        // Set to MASTER mode
407
0
        EditMode eOldMode = m_rDrawViewShell.GetEditMode();
408
0
        if (eOldMode != EditMode::MasterPage)
409
0
            m_rDrawViewShell.ChangeEditMode(EditMode::MasterPage, false);
410
411
        // Scoped guard to revert to the previous mode
412
0
        comphelper::ScopeGuard const aGuard([this, eOldMode] () {
413
0
            m_rDrawViewShell.ChangeEditMode(eOldMode, false);
414
0
        });
415
416
0
        const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);
417
418
0
        for (sal_uInt16 nPageIndex = 0; nPageIndex < nCount; ++nPageIndex)
419
0
        {
420
0
            SdPage* pMasterPage = m_rDrawViewShell.GetDoc()->GetMasterSdPage(nPageIndex, PageKind::Standard);
421
0
            for (const rtl::Reference<SdrObject>& pObject : *pMasterPage)
422
0
            {
423
0
                SdrRectObj* pRectObject = dynamic_cast<SdrRectObj*>(pObject.get());
424
0
                if (pRectObject && pRectObject->GetTextKind() == SdrObjKind::Text)
425
0
                {
426
0
                    OutlinerParaObject* pOutlinerParagraphObject = pRectObject->GetOutlinerParaObject();
427
0
                    if (pOutlinerParagraphObject)
428
0
                    {
429
0
                        const EditTextObject& rEditText = pOutlinerParagraphObject->GetTextObject();
430
0
                        std::vector<editeng::Section> aSections;
431
0
                        rEditText.GetAllSections(aSections);
432
433
                        // Search for a custom property field that has the classification category identifier key
434
0
                        if (hasCustomPropertyField(aSections, m_aKeyCreator.makeCategoryNameKey()))
435
0
                        {
436
0
                            iterateSectionsAndCollect(aSections, rEditText);
437
0
                            return;
438
0
                        }
439
0
                    }
440
0
                }
441
0
            }
442
0
        }
443
0
    }
444
};
445
446
class ClassificationInserter : public ClassificationCommon
447
{
448
private:
449
    /// Delete the previous existing classification object(s) - if they exist
450
    void deleteExistingObjects()
451
0
    {
452
0
        OUString sKey = m_aKeyCreator.makeCategoryNameKey();
453
454
0
        const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);
455
456
0
        for (sal_uInt16 nPageIndex = 0; nPageIndex < nCount; ++nPageIndex)
457
0
        {
458
0
            SdPage* pMasterPage = m_rDrawViewShell.GetDoc()->GetMasterSdPage(nPageIndex, PageKind::Standard);
459
0
            for (const rtl::Reference<SdrObject>& pObject : *pMasterPage)
460
0
            {
461
0
                SdrRectObj* pRectObject = dynamic_cast<SdrRectObj*>(pObject.get());
462
0
                if (pRectObject && pRectObject->GetTextKind() == SdrObjKind::Text)
463
0
                {
464
0
                    OutlinerParaObject* pOutlinerParagraphObject = pRectObject->GetOutlinerParaObject();
465
0
                    if (pOutlinerParagraphObject)
466
0
                    {
467
0
                        const EditTextObject& rEditText = pOutlinerParagraphObject->GetTextObject();
468
0
                        std::vector<editeng::Section> aSections;
469
0
                        rEditText.GetAllSections(aSections);
470
471
0
                        if (hasCustomPropertyField(aSections, sKey))
472
0
                        {
473
0
                            pMasterPage->RemoveObject(pRectObject->GetOrdNum());
474
0
                        }
475
0
                    }
476
0
                }
477
0
            }
478
0
        }
479
0
    }
480
481
    void fillTheOutliner(Outliner* pOutliner, std::vector<svx::ClassificationResult> const & rResults)
482
0
    {
483
0
        sal_Int32 nParagraph = -1;
484
0
        for (svx::ClassificationResult const & rResult : rResults)
485
0
        {
486
487
0
            ESelection aPosition(nParagraph, EE_TEXTPOS_MAX);
488
489
0
            switch (rResult.meType)
490
0
            {
491
0
                case svx::ClassificationType::TEXT:
492
0
                {
493
0
                    OUString sKey = m_aKeyCreator.makeNumberedTextKey();
494
0
                    svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
495
0
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
496
0
                }
497
0
                break;
498
499
0
                case svx::ClassificationType::CATEGORY:
500
0
                {
501
0
                    OUString sKey = m_aKeyCreator.makeCategoryNameKey();
502
0
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
503
0
                }
504
0
                break;
505
506
0
                case svx::ClassificationType::MARKING:
507
0
                {
508
0
                    OUString sKey = m_aKeyCreator.makeNumberedMarkingKey();
509
0
                    svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
510
0
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
511
0
                }
512
0
                break;
513
514
0
                case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
515
0
                {
516
0
                    OUString sKey = m_aKeyCreator.makeNumberedIntellectualPropertyPartKey();
517
0
                    svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
518
0
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
519
0
                }
520
0
                break;
521
522
0
                case svx::ClassificationType::PARAGRAPH:
523
0
                {
524
0
                    nParagraph++;
525
0
                    pOutliner->Insert(u""_ustr);
526
527
0
                    SfxItemSet aItemSet(SfxItemSet::makeFixedSfxItemSet<EE_ITEMS_START, EE_ITEMS_END>(m_rDrawViewShell.GetDoc()->GetPool()));
528
529
0
                    if (rResult.msName == "BOLD")
530
0
                        aItemSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
531
0
                    else
532
0
                        aItemSet.Put(SvxWeightItem(WEIGHT_NORMAL, EE_CHAR_WEIGHT));
533
534
0
                    SvxNumRule aDefaultNumRule(SvxNumRuleFlags::NONE, 0, false);
535
0
                    aItemSet.Put(SvxNumBulletItem(std::move(aDefaultNumRule), EE_PARA_NUMBULLET));
536
537
0
                    pOutliner->SetParaAttribs(nParagraph, aItemSet);
538
0
                }
539
0
                break;
540
541
0
                default:
542
0
                break;
543
0
            }
544
0
        }
545
0
    }
546
547
public:
548
    ClassificationInserter(sd::DrawViewShell & rDrawViewShell, const css::uno::Reference<css::document::XDocumentProperties>& rDocProps)
549
0
        : ClassificationCommon(rDrawViewShell, rDocProps)
550
0
    {
551
0
    }
552
553
    void insert(std::vector<svx::ClassificationResult> const & rResults)
554
0
    {
555
        // Set to MASTER mode
556
0
        EditMode eOldMode = m_rDrawViewShell.GetEditMode();
557
0
        if (eOldMode != EditMode::MasterPage)
558
0
            m_rDrawViewShell.ChangeEditMode(EditMode::MasterPage, false);
559
560
        // Scoped guard to revert the mode
561
0
        comphelper::ScopeGuard const aGuard([this, eOldMode] () {
562
0
            m_rDrawViewShell.ChangeEditMode(eOldMode, false);
563
0
        });
564
565
        // Delete the previous existing object - if exists
566
0
        deleteExistingObjects();
567
568
        // Clear properties
569
0
        svx::classification::removeAllProperties(m_xPropertyContainer);
570
571
0
        SfxClassificationHelper aHelper(m_xDocumentProperties);
572
573
        // Apply properties from the BA policy
574
0
        for (svx::ClassificationResult const & rResult : rResults)
575
0
        {
576
0
            if (rResult.meType == svx::ClassificationType::CATEGORY)
577
0
                aHelper.SetBACName(rResult.msName, SfxClassificationHelper::getPolicyType());
578
0
        }
579
580
        // Insert full text as document property
581
0
        svx::classification::insertFullTextualRepresentationAsDocumentProperty(m_xPropertyContainer, m_aKeyCreator, rResults);
582
583
        // Create the outliner from the
584
0
        Outliner* pOutliner = m_rDrawViewShell.GetDoc()->GetInternalOutliner();
585
0
        OutlinerMode eOutlinerMode = pOutliner->GetOutlinerMode();
586
587
0
        comphelper::ScopeGuard const aOutlinerGuard([pOutliner, eOutlinerMode] () {
588
0
            pOutliner->Init(eOutlinerMode);
589
0
        });
590
591
0
        pOutliner->Init(OutlinerMode::TextObject);
592
593
        // Fill the outliner with the text from classification result
594
0
        fillTheOutliner(pOutliner, rResults);
595
596
        // Calculate to outliner text size
597
0
        pOutliner->UpdateFields();
598
0
        pOutliner->SetUpdateLayout(true);
599
0
        Size aTextSize(pOutliner->CalcTextSize());
600
0
        pOutliner->SetUpdateLayout(false);
601
602
        // Create objects, apply the outliner and add them (objects) to all master pages
603
0
        const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);
604
605
0
        for (sal_uInt16 nPageIndex = 0; nPageIndex < nCount; ++nPageIndex)
606
0
        {
607
0
            SdPage* pMasterPage = m_rDrawViewShell.GetDoc()->GetMasterSdPage(nPageIndex, PageKind::Standard);
608
0
            if (!pMasterPage)
609
0
                continue;
610
611
0
            rtl::Reference<SdrRectObj> pObject = new SdrRectObj(
612
0
                *m_rDrawViewShell.GetDoc(), // TTTT should be reference
613
0
                ::tools::Rectangle(), SdrObjKind::Text);
614
0
            pObject->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
615
0
            pObject->SetOutlinerParaObject(pOutliner->CreateParaObject());
616
0
            pMasterPage->InsertObject(pObject.get());
617
618
            // Calculate position
619
0
            ::tools::Rectangle aRectangle(Point(), pMasterPage->GetSize());
620
0
            Point aPosition(aRectangle.Center().X(), aRectangle.Bottom());
621
622
0
            aPosition.AdjustX( -(aTextSize.Width() / 2) );
623
0
            aPosition.AdjustY( -(aTextSize.Height()) );
624
625
0
            pObject->SetLogicRect(::tools::Rectangle(aPosition, aTextSize));
626
0
        }
627
0
    }
628
};
629
630
    void lcl_convertStringArguments(sal_uInt16 nSId, const std::unique_ptr<SfxItemSet>& pArgs)
631
0
    {
632
0
        const SfxPoolItem* pItem = nullptr;
633
634
0
        if (nSId == SID_ATTR_FILL_COLOR)
635
0
        {
636
0
            pItem = pArgs->GetItem(SID_ATTR_FILL_COLOR);
637
0
            Color aColor = pItem ? static_cast<const XFillColorItem*>(pItem)->GetColorValue() : COL_AUTO;
638
0
            if (aColor.IsFullyTransparent())
639
0
            {
640
0
                const XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
641
0
                pArgs->Put(aXFillStyleItem);
642
0
            }
643
0
            else
644
0
            {
645
0
                SfxItemState eState = pArgs->GetItemState(SID_ATTR_FILL_STYLE, false, &pItem);
646
0
                if (eState != SfxItemState::SET || static_cast<const XFillStyleItem*>(pItem)->GetValue() == drawing::FillStyle_NONE)
647
0
                {
648
0
                    const XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID);
649
0
                    pArgs->Put(aXFillStyleItem);
650
0
                }
651
0
            }
652
0
        }
653
0
        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
654
0
        {
655
0
            double fValue = static_cast<const SvxDoubleItem*>(pItem)->GetValue();
656
            // FIXME: different units...
657
0
            int nPow = 100;
658
0
            int nValue = fValue * nPow;
659
660
0
            XLineWidthItem aItem(nValue);
661
0
            pArgs->Put(aItem);
662
0
        }
663
0
        if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
664
0
        {
665
0
            const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
666
0
            if (pJSON)
667
0
            {
668
0
                basegfx::BGradient aGradient = basegfx::BGradient::fromJSON(pJSON->GetValue());
669
0
                XFillGradientItem aItem(aGradient);
670
0
                pArgs->Put(aItem);
671
0
            }
672
0
        }
673
0
    }
674
}
675
676
void DrawViewShell::FuTransformDocumentStructure(const SfxRequest& rReq)
677
0
{
678
    // get the parameter, what to transform
679
0
    OUString aDataJson;
680
0
    const SfxStringItem* pDataJson = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
681
0
    if (pDataJson)
682
0
    {
683
0
        aDataJson = pDataJson->GetValue();
684
0
        aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8);
685
0
    }
686
687
    // parse the JSON transform parameter
688
0
    boost::property_tree::ptree aTree;
689
0
    std::stringstream aStream(
690
0
        (std::string(OUStringToOString(aDataJson, RTL_TEXTENCODING_UTF8))));
691
0
    try
692
0
    {
693
0
        boost::property_tree::read_json(aStream, aTree);
694
0
    }
695
0
    catch (...)
696
0
    {
697
0
        lcl_LogWarning("FillApi Transform parameter, Wrong JSON format. ");
698
0
        throw;
699
0
    }
700
701
    // Iterate through the JSON data loaded into a tree structure
702
0
    for (const auto& aItem : aTree)
703
0
    {
704
0
        if (aItem.first == "Transforms")
705
0
        {
706
            // Handle all transformations
707
0
            for (const auto& aItem2Obj : aItem.second)
708
0
            {
709
                // handle `"Transforms": { `  and `"Transforms": [` cases as well
710
                // if an element is an object `{...}`, then get the first element of the object
711
0
                const auto& aItem2
712
0
                    = aItem2Obj.first == "" ? *aItem2Obj.second.ordered_begin() : aItem2Obj;
713
714
                //jump to slide
715
0
                if (aItem2.first == "SlideCommands")
716
0
                {
717
0
                    int nActPageId = -1;
718
0
                    int nNextPageId = 0;
719
0
                    for (const auto& aItem3Obj : aItem2.second)
720
0
                    {
721
                        // It accept direct property, or object as well
722
0
                        const auto& aItem3 = aItem3Obj.first == ""
723
0
                                                 ? *aItem3Obj.second.ordered_begin()
724
0
                                                 : aItem3Obj;
725
726
0
                        sal_uInt16 nPageCount
727
0
                            = GetDoc()->GetSdPageCount(PageKind::Standard);
728
0
                        sal_uInt16 nMasterPageCount
729
0
                            = GetDoc()->GetMasterSdPageCount(PageKind::Standard);
730
731
0
                        if (nActPageId != nNextPageId)
732
0
                        {
733
                            // Make it sure it always point to a real page
734
0
                            if (nNextPageId < 0)
735
0
                                nNextPageId = 0;
736
0
                            if (nNextPageId >= nPageCount)
737
0
                                nNextPageId = nPageCount - 1;
738
739
0
                            nActPageId = nNextPageId;
740
                            // Make sure nActPageId is the current Page
741
0
                            maTabControl->SetCurPageId(nActPageId);
742
0
                            SdPage* pPageStandard
743
0
                                = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
744
0
                            mpDrawView->ShowSdrPage(pPageStandard);
745
0
                        }
746
747
0
                        if (aItem3.first == "JumpToSlide")
748
0
                        {
749
0
                            std::string aIndex = aItem3.second.get_value<std::string>();
750
0
                            if (aIndex == "last")
751
0
                            {
752
0
                                nNextPageId = nPageCount - 1;
753
0
                            }
754
0
                            else
755
0
                            {
756
0
                                nNextPageId = aItem3.second.get_value<int>();
757
0
                                if (nNextPageId >= nPageCount)
758
0
                                {
759
0
                                    lcl_LogWarning(
760
0
                                        "FillApi SlideCmd: Slide idx >= Slide count. '"
761
0
                                        + aItem3.first + ": " + aIndex
762
0
                                        + "' (Slide count = " + std::to_string(nPageCount));
763
0
                                    nNextPageId = nPageCount - 1;
764
0
                                }
765
0
                                else if (nNextPageId < 0)
766
0
                                {
767
0
                                    lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
768
0
                                                   + aItem3.first + ": " + aIndex + "'");
769
0
                                    nNextPageId = 0;
770
0
                                }
771
0
                            }
772
0
                        }
773
0
                        if (aItem3.first == "JumpToSlideByName")
774
0
                        {
775
0
                            std::string aPageName = aItem3.second.get_value<std::string>();
776
0
                            int nId = 0;
777
0
                            while (
778
0
                                nId < nPageCount
779
0
                                && GetDoc()->GetSdPage(nId, PageKind::Standard)->GetName()
780
0
                                       != OStringToOUString(aPageName,
781
0
                                                            RTL_TEXTENCODING_UTF8))
782
0
                            {
783
0
                                nId++;
784
0
                            }
785
0
                            if (nId < nPageCount)
786
0
                            {
787
0
                                nNextPageId = nId;
788
0
                            }
789
0
                            else
790
0
                            {
791
0
                                lcl_LogWarning(
792
0
                                    "FillApi SlideCmd: Slide name not found at: '"
793
0
                                    + aItem3.first + ": " + aPageName + "'");
794
0
                            }
795
0
                        }
796
0
                        else if (aItem3.first == "InsertMasterSlide"
797
0
                                 || aItem3.first == "InsertMasterSlideByName")
798
0
                        {
799
0
                            int nMasterPageId = 0;
800
0
                            if (aItem3.first == "InsertMasterSlideByName")
801
0
                            {
802
0
                                int nMId = 0;
803
0
                                std::string aMPageName
804
0
                                    = aItem3.second.get_value<std::string>();
805
0
                                while (
806
0
                                    nMId < nMasterPageCount
807
0
                                    && GetDoc()->GetMasterSdPage(nMId, PageKind::Standard)
808
0
                                               ->GetName()
809
0
                                           != OStringToOUString(aMPageName,
810
0
                                               RTL_TEXTENCODING_UTF8))
811
0
                                {
812
0
                                    nMId++;
813
0
                                }
814
0
                                if (nMId < nMasterPageCount)
815
0
                                {
816
0
                                    nMasterPageId = nMId;
817
0
                                }
818
0
                                else
819
0
                                {
820
0
                                    lcl_LogWarning(
821
0
                                        "FillApi SlideCmd: MasterSlide name not found at: '"
822
0
                                        + aItem3.first + ": " + aMPageName + "'");
823
0
                                }
824
0
                            }
825
0
                            else
826
0
                            {
827
0
                                nMasterPageId = aItem3.second.get_value<int>();
828
0
                            }
829
830
0
                            if (nMasterPageId >= nMasterPageCount)
831
0
                            {
832
0
                                lcl_LogWarning(
833
0
                                    "FillApi SlideCmd: Slide idx >= MasterSlide count. '"
834
0
                                    + aItem3.first + ": " + std::to_string(nMasterPageId)
835
0
                                    + "' (Slide count = " + std::to_string(nMasterPageCount));
836
0
                                nMasterPageId = nMasterPageCount - 1;
837
0
                            }
838
0
                            else if (nMasterPageId < 0)
839
0
                            {
840
0
                                lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
841
0
                                               + aItem3.first + ": "
842
0
                                               + std::to_string(nMasterPageId) + "'");
843
0
                                nMasterPageId = 0;
844
0
                            }
845
846
0
                            SdPage* pMPage = GetDoc()->GetMasterSdPage(nMasterPageId,
847
0
                                                                       PageKind::Standard);
848
0
                            SdPage* pPage
849
0
                                = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
850
851
                            // It will move to the next slide.
852
0
                            nNextPageId = GetDoc()->CreatePage(
853
0
                                pPage, PageKind::Standard, OUString(), OUString(),
854
0
                                AUTOLAYOUT_TITLE_CONTENT, AUTOLAYOUT_NOTES, true, true,
855
0
                                pPage->GetPageNum() + 2);
856
857
0
                            SdPage* pPageStandard
858
0
                                = GetDoc()->GetSdPage(nNextPageId, PageKind::Standard);
859
0
                            SdPage* pPageNote
860
0
                                = GetDoc()->GetSdPage(nNextPageId, PageKind::Notes);
861
862
                            // Change master value
863
0
                            pPageStandard->TRG_SetMasterPage(*pMPage);
864
0
                            pPageNote->TRG_SetMasterPage(*pMPage);
865
0
                        }
866
0
                        else if (aItem3.first == "DeleteSlide")
867
0
                        {
868
0
                            int nPageIdToDel = nActPageId;
869
0
                            if (aItem3.second.get_value<std::string>() != "")
870
0
                            {
871
0
                                nPageIdToDel = aItem3.second.get_value<int>();
872
0
                            }
873
874
0
                            if (nPageCount > 1)
875
0
                            {
876
0
                                if (nPageIdToDel >= nPageCount)
877
0
                                {
878
0
                                    lcl_LogWarning(
879
0
                                        "FillApi SlideCmd: Slide idx >= Slide count. '"
880
0
                                        + aItem3.first + ": " + std::to_string(nPageIdToDel)
881
0
                                        + "' (Slide count = " + std::to_string(nPageCount));
882
0
                                    nPageIdToDel = nPageCount - 1;
883
0
                                }
884
0
                                else if (nPageIdToDel < 0)
885
0
                                {
886
0
                                    lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
887
0
                                                   + aItem3.first + ": "
888
0
                                                   + std::to_string(nPageIdToDel) + "'");
889
0
                                    nPageIdToDel = 0;
890
0
                                }
891
0
                                GetDoc()->RemovePage(nPageIdToDel * 2 + 1);
892
0
                                GetDoc()->RemovePage(nPageIdToDel * 2 + 1);
893
894
0
                                if (nPageIdToDel <= nActPageId)
895
0
                                {
896
0
                                    nNextPageId--;
897
0
                                }
898
0
                            }
899
0
                            else
900
0
                            {
901
0
                                lcl_LogWarning(
902
0
                                    "FillApi SlideCmd: Not enough Slide to delete 1. '"
903
0
                                    + aItem3.first + ": " + std::to_string(nPageIdToDel));
904
0
                            }
905
0
                        }
906
0
                        else if (aItem3.first.starts_with("MoveSlide"))
907
0
                        {
908
0
                            int nMoveFrom = nActPageId;
909
0
                            if (aItem3.first.starts_with("MoveSlide."))
910
0
                            {
911
0
                                nMoveFrom = stoi(aItem3.first.substr(10));
912
0
                            }
913
0
                            int nMoveTo = aItem3.second.get_value<int>();
914
915
0
                            if (nMoveFrom == nMoveTo)
916
0
                            {
917
0
                                lcl_LogWarning(
918
0
                                    "FillApi SlideCmd: Move slide to the same position. '"
919
0
                                    + aItem3.first + ": " + std::to_string(nMoveTo));
920
0
                            }
921
0
                            else if (nMoveFrom >= nPageCount || nMoveTo > nPageCount)
922
0
                            {
923
0
                                lcl_LogWarning(
924
0
                                    "FillApi SlideCmd: Slide idx >= Slide count. '"
925
0
                                    + aItem3.first + ": " + std::to_string(nMoveTo));
926
0
                            }
927
0
                            else if (nMoveFrom < 0 || nMoveTo < 0)
928
0
                            {
929
0
                                lcl_LogWarning(
930
0
                                    "FillApi SlideCmd: Slide idx < 0. '"
931
0
                                    + aItem3.first + ": " + std::to_string(nMoveTo));
932
0
                            }
933
0
                            else
934
0
                            {
935
                                // Move both the standard and the Note Page.
936
                                // First move the page that will not change
937
                                // the order of the other page.
938
0
                                int nFirst = 1;
939
0
                                if (nMoveFrom < nMoveTo)
940
0
                                {
941
0
                                    nFirst = 2;
942
0
                                }
943
0
                                int nSecond = 3 - nFirst;
944
945
0
                                GetDoc()->MovePage(nMoveFrom * 2 + nFirst,
946
0
                                                   nMoveTo * 2 + nFirst);
947
0
                                GetDoc()->MovePage(nMoveFrom * 2 + nSecond,
948
0
                                                   nMoveTo * 2 + nSecond);
949
950
                                // If the act page is moved, then follow it.
951
0
                                if (nActPageId == nMoveFrom)
952
0
                                {
953
0
                                    nNextPageId = nMoveTo;
954
0
                                }
955
0
                                else if (nMoveFrom < nActPageId && nMoveTo >= nActPageId)
956
0
                                {
957
0
                                    nNextPageId = nActPageId - 1;
958
0
                                }
959
0
                                else if (nMoveFrom > nActPageId && nMoveTo <= nActPageId)
960
0
                                {
961
0
                                    nNextPageId = nActPageId + 1;
962
0
                                }
963
0
                            }
964
0
                        }
965
0
                        else if (aItem3.first == "DuplicateSlide")
966
0
                        {
967
0
                            int nDupSlideId = nActPageId;
968
0
                            if (aItem3.second.get_value<std::string>() != "")
969
0
                            {
970
0
                                nDupSlideId = aItem3.second.get_value<int>();
971
0
                            }
972
973
0
                            if (nDupSlideId >= nPageCount)
974
0
                            {
975
0
                                lcl_LogWarning(
976
0
                                    "FillApi SlideCmd: Slide idx >= Slide count. '"
977
0
                                    + aItem3.first + ": " + std::to_string(nDupSlideId)
978
0
                                    + "' (Slide count = " + std::to_string(nPageCount));
979
0
                                nDupSlideId = nPageCount - 1;
980
0
                            }
981
0
                            else if (nDupSlideId < 0)
982
0
                            {
983
0
                                lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
984
0
                                               + aItem3.first + ": "
985
0
                                               + std::to_string(nDupSlideId) + "'");
986
0
                                nDupSlideId = 0;
987
0
                            }
988
0
                            GetDoc()->DuplicatePage(nDupSlideId);
989
                            // Jump to the created page.
990
0
                            nNextPageId = nDupSlideId + 1;
991
                            // Make sure the current page will be set also.
992
0
                            nActPageId = nDupSlideId;
993
0
                        }
994
0
                        else if (aItem3.first == "ChangeLayout"
995
0
                                 || aItem3.first == "ChangeLayoutByName")
996
0
                        {
997
0
                            AutoLayout nLayoutId;
998
0
                            if (aItem3.first == "ChangeLayoutByName")
999
0
                            {
1000
0
                                std::string aLayoutName
1001
0
                                    = aItem3.second.get_value<std::string>();
1002
1003
0
                                nLayoutId = SdPage::stringToAutoLayout(
1004
0
                                    OStringToOUString(aLayoutName, RTL_TEXTENCODING_UTF8));
1005
0
                                if (nLayoutId == AUTOLAYOUT_END)
1006
0
                                {
1007
0
                                    lcl_LogWarning(
1008
0
                                        "FillApi SlideCmd: Layout name not found at: '"
1009
0
                                        + aItem3.first + ": " + aLayoutName + "'");
1010
0
                                    nLayoutId = AUTOLAYOUT_TITLE_CONTENT;
1011
0
                                }
1012
0
                            }
1013
0
                            else
1014
0
                            {
1015
0
                                nLayoutId = static_cast<AutoLayout>(
1016
0
                                    aItem3.second.get_value<int>());
1017
0
                                if (nLayoutId < AUTOLAYOUT_START
1018
0
                                    || nLayoutId >= AUTOLAYOUT_END)
1019
0
                                {
1020
0
                                    lcl_LogWarning(
1021
0
                                        "FillApi SlideCmd: Wrong Layout index at: '"
1022
0
                                        + aItem3.first + ": " + std::to_string(nLayoutId)
1023
0
                                        + "'");
1024
0
                                    nLayoutId = AUTOLAYOUT_TITLE_CONTENT;
1025
0
                                }
1026
0
                            }
1027
1028
                            // Todo warning:  ... if (nLayoutId >= ???)
1029
0
                            GetDoc()
1030
0
                                ->GetSdPage(nActPageId, PageKind::Standard)
1031
0
                                ->SetAutoLayout(nLayoutId, true);
1032
0
                        }
1033
0
                        else if (aItem3.first == "RenameSlide")
1034
0
                        {
1035
0
                            SdPage* pPageStandard
1036
0
                                = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
1037
0
                            pPageStandard->SetName(
1038
0
                                OStringToOUString(aItem3.second.get_value<std::string>(),
1039
0
                                                  RTL_TEXTENCODING_UTF8));
1040
0
                        }
1041
0
                        else if (aItem3.first.starts_with("SetText."))
1042
0
                        {
1043
0
                            int nObjId = stoi(aItem3.first.substr(8));
1044
1045
0
                            SdPage* pPageStandard
1046
0
                                = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
1047
0
                            int nObjCount = pPageStandard->GetObjCount();
1048
0
                            if (nObjId < 0)
1049
0
                            {
1050
0
                                lcl_LogWarning("FillApi SlideCmd SetText: Object idx < 0. '"
1051
0
                                               + aItem3.first + "'");
1052
0
                            }
1053
0
                            else if (nObjId < nObjCount)
1054
0
                            {
1055
0
                                SdrObject* pSdrObj = pPageStandard->GetObj(nObjId);
1056
0
                                if (pSdrObj->IsSdrTextObj())
1057
0
                                {
1058
0
                                    SdrTextObj* pSdrTxt = static_cast<SdrTextObj*>(pSdrObj);
1059
0
                                    pSdrTxt->SetText(OStringToOUString(
1060
0
                                        aItem3.second.get_value<std::string>(),
1061
0
                                        RTL_TEXTENCODING_UTF8));
1062
1063
                                    // Todo: maybe with empty string it should work elseway?
1064
0
                                    pSdrObj->SetEmptyPresObj(false);
1065
0
                                }
1066
0
                            }
1067
0
                            else
1068
0
                            {
1069
0
                                lcl_LogWarning(
1070
0
                                    "FillApi SlideCmd SetText: Object idx >= Object Count. '"
1071
0
                                    + aItem3.first
1072
0
                                    + "' (Object Count = " + std::to_string(nPageCount));
1073
0
                            }
1074
0
                        }
1075
0
                        else if (aItem3.first == "MarkObject"
1076
0
                                 || aItem3.first == "UnMarkObject")
1077
0
                        {
1078
0
                            bool bUnMark = aItem3.first == "UnMarkObject";
1079
0
                            int nObjId = aItem3.second.get_value<int>();
1080
1081
0
                            SdPage* pPageStandard
1082
0
                                = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
1083
0
                            int nObjCount = pPageStandard->GetObjCount();
1084
1085
                            // Todo: check id vs count
1086
0
                            if (nObjId < 0)
1087
0
                            {
1088
0
                                lcl_LogWarning("FillApi SlideCmd: Object idx < 0 at: '"
1089
0
                                               + aItem3.first + std::to_string(nObjId)
1090
0
                                               + "'");
1091
0
                            }
1092
0
                            if (nObjId < nObjCount)
1093
0
                            {
1094
0
                                SdrObject* pSdrObj = pPageStandard->GetObj(nObjId);
1095
0
                                mpDrawView->MarkObj(pSdrObj, mpDrawView->GetSdrPageView(),
1096
0
                                                    bUnMark);
1097
0
                            }
1098
0
                            else
1099
0
                            {
1100
0
                                lcl_LogWarning(
1101
0
                                    "FillApi SlideCmd: Object idx > Object Count. '"
1102
0
                                    + aItem3.first + std::to_string(nObjId)
1103
0
                                    + "' (Object Count = " + std::to_string(nObjId));
1104
0
                            }
1105
0
                        }
1106
1107
0
                        else if (aItem3.first.starts_with("EditTextObject."))
1108
0
                        {
1109
0
                            int nObjId = stoi(aItem3.first.substr(15));
1110
0
                            SdPage* pPageStandard
1111
0
                                = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
1112
0
                            int nObjCount = pPageStandard->GetObjCount();
1113
0
                            if (nObjId < 0)
1114
0
                            {
1115
0
                                lcl_LogWarning(
1116
0
                                    "FillApi SlideCmd EditTextObject: Object idx < 0. '"
1117
0
                                    + aItem3.first + "'");
1118
0
                            }
1119
0
                            else if (nObjId >= nObjCount)
1120
0
                            {
1121
0
                                lcl_LogWarning(
1122
0
                                    "FillApi SlideCmd EditTextObject: Object idx >= "
1123
0
                                    "Object Count. '"
1124
0
                                    + aItem3.first
1125
0
                                    + "' (Object Count = " + std::to_string(nPageCount));
1126
0
                            }
1127
0
                            else
1128
0
                            {
1129
0
                                SdrObject* pSdrObj = pPageStandard->GetObj(nObjId);
1130
0
                                if (!pSdrObj->IsSdrTextObj())
1131
0
                                {
1132
0
                                    lcl_LogWarning(
1133
0
                                        "FillApi SlideCmd EditTextObject: Object is "
1134
0
                                        "not a TextObject. '"
1135
0
                                        + aItem3.first + "'");
1136
0
                                }
1137
0
                                else
1138
0
                                {
1139
0
                                    SdrTextObj* pSdrTxt = static_cast<SdrTextObj*>(pSdrObj);
1140
0
                                    SdrView* pView1 = GetView();
1141
0
                                    pView1->MarkObj(pSdrTxt, pView1->GetSdrPageView());
1142
0
                                    pView1->SdrBeginTextEdit(pSdrTxt);
1143
0
                                    EditView& rEditView
1144
0
                                        = pView1->GetTextEditOutlinerView()->GetEditView();
1145
0
                                    for (const auto& aItem4Obj : aItem3.second)
1146
0
                                    {
1147
0
                                        const auto& aItem4
1148
0
                                            = aItem4Obj.first == ""
1149
0
                                                  ? *aItem4Obj.second.ordered_begin()
1150
0
                                                  : aItem4Obj;
1151
1152
0
                                        if (aItem4.first == "SelectText")
1153
0
                                        {
1154
0
                                            std::vector<int> aValues;
1155
0
                                            for (const auto& aItem5 : aItem4.second)
1156
0
                                            {
1157
                                                //if == last?
1158
0
                                                aValues.push_back(aItem5.second.get_value<int>());
1159
0
                                            }
1160
0
                                            if (aValues.size() == 0)
1161
0
                                            {
1162
                                                //select the whole text
1163
0
                                                aValues.push_back(0);
1164
0
                                                aValues.push_back(0);
1165
0
                                                aValues.push_back(EE_PARA_MAX);
1166
0
                                                aValues.push_back(EE_TEXTPOS_MAX);
1167
0
                                            }
1168
0
                                            else if (aValues.size() == 1)
1169
0
                                            {
1170
                                                //select the paragraph
1171
0
                                                aValues.push_back(0);
1172
0
                                                aValues.push_back(aValues[0]);
1173
0
                                                aValues.push_back(EE_TEXTPOS_MAX);
1174
0
                                            }
1175
0
                                            else if (aValues.size() == 2)
1176
0
                                            {
1177
                                                // set the cursor without selecting anything
1178
0
                                                aValues.push_back(aValues[0]);
1179
0
                                                aValues.push_back(aValues[1]);
1180
0
                                            }
1181
0
                                            else if (aValues.size() == 3)
1182
0
                                            {
1183
0
                                                aValues.push_back(EE_TEXTPOS_MAX);
1184
0
                                            }
1185
1186
0
                                            const ESelection rNewSel(aValues[0], aValues[1],
1187
0
                                                                     aValues[2], aValues[3]);
1188
0
                                            rEditView.SetSelection(rNewSel);
1189
0
                                        }
1190
0
                                        else if (aItem4.first == "SelectParagraph")
1191
0
                                        {
1192
0
                                            int nParaId = aItem4.second.get_value<int>();
1193
1194
0
                                            const ESelection rNewSel(nParaId, 0, nParaId,
1195
0
                                                                     EE_TEXTPOS_MAX);
1196
0
                                            rEditView.SetSelection(rNewSel);
1197
0
                                        }
1198
0
                                        else if (aItem4.first == "InsertText")
1199
0
                                        {
1200
0
                                            OUString aText = OStringToOUString(
1201
0
                                                aItem4.second.get_value<std::string>(),
1202
0
                                                RTL_TEXTENCODING_UTF8);
1203
                                            // It select the inserted text also
1204
0
                                            rEditView.InsertText(aText, true);
1205
0
                                        }
1206
0
                                        else if (aItem4.first == "UnoCommand")
1207
0
                                        {
1208
0
                                            std::string aText
1209
0
                                                = aItem4.second.get_value<std::string>();
1210
0
                                            lcl_UnoCommand(aText);
1211
0
                                        }
1212
0
                                    }
1213
0
                                    pView1->SdrEndTextEdit();
1214
0
                                }
1215
0
                            }
1216
0
                        }
1217
0
                        else if (aItem3.first == "UnoCommand")
1218
0
                        {
1219
0
                            std::string aText = aItem3.second.get_value<std::string>();
1220
0
                            lcl_UnoCommand(aText);
1221
0
                        }
1222
0
                    }
1223
0
                }
1224
0
            }
1225
0
        }
1226
0
        else if (aItem.first == "UnoCommand")
1227
0
        {
1228
0
            SfxLokHelper::dispatchUnoCommand(aItem.second);
1229
0
        }
1230
0
    }
1231
0
}
1232
1233
/**
1234
 * SfxRequests for temporary actions
1235
 */
1236
1237
void DrawViewShell::FuTemporary(SfxRequest& rReq)
1238
0
{
1239
    // during a native slide show nothing gets executed!
1240
0
    if(SlideShow::IsRunning( GetViewShellBase() )
1241
0
        && !SlideShow::IsInteractiveSlideshow( GetViewShellBase() ) // IASS
1242
0
        && (rReq.GetSlot() != SID_NAVIGATOR))
1243
0
        return;
1244
1245
0
    DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
1246
0
    if( !mpDrawView )
1247
0
        return;
1248
1249
0
    CheckLineTo (rReq);
1250
1251
0
    DeactivateCurrentFunction();
1252
1253
0
    sal_uInt16 nSId = rReq.GetSlot();
1254
0
    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
1255
1256
0
    switch ( nSId )
1257
0
    {
1258
0
        case SID_OUTLINE_TEXT_AUTOFIT:
1259
0
        {
1260
0
            SfxUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
1261
0
            if( rMarkList.GetMarkCount() == 1 )
1262
0
            {
1263
0
                pUndoManager->EnterListAction(u""_ustr, u""_ustr, 0, GetViewShellBase().GetViewShellId());
1264
0
                mpDrawView->BegUndo();
1265
1266
0
                SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1267
0
                bool bSet = pObj->GetMergedItemSet().GetItem<SdrTextFitToSizeTypeItem>(SDRATTR_TEXT_FITTOSIZE)->GetValue() != drawing::TextFitToSizeType_NONE;
1268
1269
0
                mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
1270
1271
0
                if (!bSet)
1272
0
                {
1273
                    //If we are turning on AutoFit we have to turn these off if already on
1274
0
                    if (pObj->GetMergedItemSet().GetItem<SdrOnOffItem>(SDRATTR_TEXT_AUTOGROWHEIGHT)->GetValue())
1275
0
                        pObj->SetMergedItem(makeSdrTextAutoGrowHeightItem(false));
1276
0
                    if (pObj->GetMergedItemSet().GetItem<SdrOnOffItem>(SDRATTR_TEXT_AUTOGROWWIDTH)->GetValue())
1277
0
                        pObj->SetMergedItem(makeSdrTextAutoGrowWidthItem(false));
1278
0
                }
1279
1280
0
                pObj->SetMergedItem(SdrTextFitToSizeTypeItem(bSet ? drawing::TextFitToSizeType_NONE : drawing::TextFitToSizeType_AUTOFIT));
1281
1282
0
                mpDrawView->EndUndo();
1283
0
                pUndoManager->LeaveListAction();
1284
0
            }
1285
0
            Cancel();
1286
0
            rReq.Done();
1287
0
        }
1288
0
        break;
1289
1290
        // area and line attributes: shall have
1291
        // an own Execute method (like StateMethode)
1292
0
        case SID_ATTR_FILL_STYLE:
1293
0
        case SID_ATTR_FILL_COLOR:
1294
0
        case SID_ATTR_FILL_GRADIENT:
1295
0
        case SID_ATTR_FILL_HATCH:
1296
0
        case SID_ATTR_FILL_BITMAP:
1297
0
        case SID_ATTR_FILL_SHADOW:
1298
0
        case SID_ATTR_SHADOW_COLOR:
1299
0
        case SID_ATTR_SHADOW_TRANSPARENCE:
1300
0
        case SID_ATTR_SHADOW_BLUR:
1301
0
        case SID_ATTR_SHADOW_XDISTANCE:
1302
0
        case SID_ATTR_SHADOW_YDISTANCE:
1303
0
        case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
1304
0
        case SID_ATTR_FILL_TRANSPARENCE:
1305
0
        case SID_ATTR_FILL_FLOATTRANSPARENCE:
1306
1307
0
        case SID_ATTR_LINE_STYLE:
1308
0
        case SID_ATTR_LINE_DASH:
1309
0
        case SID_ATTR_LINE_WIDTH:
1310
0
        case SID_ATTR_LINE_COLOR:
1311
0
        case SID_ATTR_LINEEND_STYLE:
1312
0
        case SID_ATTR_LINE_START:
1313
0
        case SID_ATTR_LINE_END:
1314
0
        case SID_ATTR_LINE_TRANSPARENCE:
1315
0
        case SID_ATTR_LINE_JOINT:
1316
0
        case SID_ATTR_LINE_CAP:
1317
1318
0
        case SID_ATTR_TEXT_FITTOSIZE:
1319
0
        {
1320
0
            if( rReq.GetArgs() )
1321
0
            {
1322
0
                std::unique_ptr<SfxItemSet> pNewArgs = rReq.GetArgs()->Clone();
1323
0
                lcl_convertStringArguments(nSId, pNewArgs);
1324
0
                mpDrawView->SetAttributes(*pNewArgs);
1325
0
                rReq.Done();
1326
0
            }
1327
0
            else
1328
0
            {
1329
0
                switch( rReq.GetSlot() )
1330
0
                {
1331
0
                    case SID_ATTR_FILL_SHADOW:
1332
0
                    case SID_ATTR_SHADOW_COLOR:
1333
0
                    case SID_ATTR_SHADOW_TRANSPARENCE:
1334
0
                    case SID_ATTR_SHADOW_BLUR:
1335
0
                    case SID_ATTR_SHADOW_XDISTANCE:
1336
0
                    case SID_ATTR_SHADOW_YDISTANCE:
1337
0
                    case SID_ATTR_FILL_STYLE:
1338
0
                    case SID_ATTR_FILL_COLOR:
1339
0
                    case SID_ATTR_FILL_GRADIENT:
1340
0
                    case SID_ATTR_FILL_HATCH:
1341
0
                    case SID_ATTR_FILL_BITMAP:
1342
0
                    case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
1343
0
                    case SID_ATTR_FILL_TRANSPARENCE:
1344
0
                    case SID_ATTR_FILL_FLOATTRANSPARENCE:
1345
0
                        GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SfxCallMode::ASYNCHRON );
1346
0
                        break;
1347
0
                    case SID_ATTR_LINE_STYLE:
1348
0
                    case SID_ATTR_LINE_DASH:
1349
0
                    case SID_ATTR_LINE_WIDTH:
1350
0
                    case SID_ATTR_LINE_COLOR:
1351
0
                    case SID_ATTR_LINE_TRANSPARENCE:
1352
0
                    case SID_ATTR_LINE_JOINT:
1353
0
                    case SID_ATTR_LINE_CAP:
1354
0
                        GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SfxCallMode::ASYNCHRON );
1355
0
                        break;
1356
0
                    case SID_ATTR_TEXT_FITTOSIZE:
1357
0
                        GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SfxCallMode::ASYNCHRON );
1358
0
                        break;
1359
0
                }
1360
0
            }
1361
0
            Cancel();
1362
0
        }
1363
0
        break;
1364
1365
0
        case SID_HYPHENATION:
1366
0
        {
1367
0
            const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(SID_HYPHENATION);
1368
1369
0
            if( pItem )
1370
0
            {
1371
0
                SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<EE_PARA_HYPHENATE, EE_PARA_HYPHENATE>( GetPool() ));
1372
0
                bool bValue = pItem->GetValue();
1373
0
                aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
1374
0
                mpDrawView->SetAttributes( aSet );
1375
0
            }
1376
0
            else // only for testing purpose
1377
0
            {
1378
0
                OSL_FAIL(" no value for hyphenation!");
1379
0
                SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<EE_PARA_HYPHENATE, EE_PARA_HYPHENATE>( GetPool() ));
1380
0
                aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, true ) );
1381
0
                mpDrawView->SetAttributes( aSet );
1382
0
            }
1383
0
            rReq.Done();
1384
0
            Cancel();
1385
0
        }
1386
0
        break;
1387
1388
0
        case FN_TRANSFORM_DOCUMENT_STRUCTURE:
1389
0
        {
1390
0
            FuTransformDocumentStructure(rReq);
1391
0
            rReq.Done();
1392
0
        }
1393
0
        break;
1394
1395
0
        case SID_INSERTPAGE:
1396
0
        case SID_INSERTPAGE_QUICK:
1397
0
        {
1398
0
            SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
1399
0
            Cancel();
1400
0
            if(HasCurrentFunction(SID_BEZIER_EDIT) )
1401
0
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1402
0
            if (pNewPage != nullptr)
1403
0
                SwitchPage((pNewPage->GetPageNum()-1)/2);
1404
0
            rReq.Done ();
1405
0
        }
1406
0
        break;
1407
0
        case SID_INSERT_CANVAS_SLIDE:
1408
0
        {
1409
0
            sal_uInt16 nCanvasPageIndex = GetDoc()->GetOrInsertCanvasPage();
1410
0
            Cancel(); // Don't know what this does
1411
0
            SwitchPage(nCanvasPageIndex);
1412
0
            rReq.Done();
1413
0
        }
1414
0
        break;
1415
1416
0
        case SID_SHUFFLE_PAGES:
1417
0
        {
1418
0
            if (!GetDoc()->HasCanvasPage())
1419
0
                break;
1420
0
            GetDoc()->ReshufflePages();
1421
0
            Cancel();
1422
0
            rReq.Done();
1423
0
        }
1424
0
        break;
1425
1426
0
        case SID_DUPLICATE_PAGE:
1427
0
        {
1428
0
            auto slideSorter = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
1429
0
            SdPage* pNewPage = nullptr;
1430
0
            if(slideSorter)
1431
0
                DuplicateSelectedSlides(rReq);
1432
0
            else
1433
0
                pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
1434
0
            Cancel();
1435
0
            if(HasCurrentFunction(SID_BEZIER_EDIT) )
1436
0
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1437
0
            if(!slideSorter && pNewPage != nullptr)
1438
0
                SwitchPage((pNewPage->GetPageNum()-1)/2);
1439
0
            rReq.Done();
1440
0
        }
1441
0
        break;
1442
1443
0
        case SID_INSERT_MASTER_PAGE:
1444
0
        {
1445
            // Use the API to create a new page.
1446
0
            rtl::Reference<SdXImpressDocument> xMasterPagesSupplier (
1447
0
                GetDoc()->getUnoModel());
1448
0
            if (xMasterPagesSupplier.is())
1449
0
            {
1450
0
                Reference<drawing::XDrawPages> xMasterPages (
1451
0
                    xMasterPagesSupplier->getMasterPages());
1452
0
                if (xMasterPages.is())
1453
0
                {
1454
0
                    sal_uInt16 nIndex = GetCurPagePos() + 1;
1455
0
                    xMasterPages->insertNewByIndex (nIndex);
1456
1457
                    // Create shapes for the default layout.
1458
0
                    SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
1459
0
                        nIndex, PageKind::Standard);
1460
0
                    pMasterPage->CreateTitleAndLayout (true,true);
1461
0
                }
1462
0
            }
1463
1464
0
            Cancel();
1465
0
            if(HasCurrentFunction(SID_BEZIER_EDIT))
1466
0
                GetViewFrame()->GetDispatcher()->Execute(
1467
0
                    SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1468
0
            rReq.Done ();
1469
0
        }
1470
0
        break;
1471
1472
0
        case SID_MODIFYPAGE:
1473
0
        {
1474
0
            if (mePageKind==PageKind::Standard || mePageKind==PageKind::Notes ||
1475
0
                (mePageKind==PageKind::Handout && meEditMode==EditMode::MasterPage) )
1476
0
            {
1477
0
                if ( mpDrawView->IsTextEdit() )
1478
0
                {
1479
0
                    mpDrawView->SdrEndTextEdit();
1480
0
                }
1481
0
                sal_uInt16 nPage = maTabControl->GetCurPagePos();
1482
0
                mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
1483
0
                ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
1484
0
                    rReq,
1485
0
                    mpActualPage,
1486
0
                    mePageKind);
1487
0
            }
1488
1489
0
            Cancel();
1490
0
            rReq.Done ();
1491
0
        }
1492
0
        break;
1493
1494
0
        case SID_ASSIGN_LAYOUT:
1495
0
        {
1496
0
            if (mePageKind==PageKind::Standard || mePageKind==PageKind::Notes || (mePageKind==PageKind::Handout && meEditMode==EditMode::MasterPage))
1497
0
            {
1498
0
                if ( mpDrawView->IsTextEdit() )
1499
0
                    mpDrawView->SdrEndTextEdit();
1500
1501
0
                ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
1502
0
            }
1503
0
            Cancel();
1504
0
            rReq.Done ();
1505
0
        }
1506
0
        break;
1507
1508
0
        case SID_RENAMEPAGE:
1509
0
        case SID_RENAME_MASTER_PAGE:
1510
0
        {
1511
0
            if (mePageKind==PageKind::Standard || mePageKind==PageKind::Notes )
1512
0
            {
1513
0
                if ( mpDrawView->IsTextEdit() )
1514
0
                {
1515
0
                    mpDrawView->SdrEndTextEdit();
1516
0
                }
1517
1518
0
                sal_uInt16 nPage = maTabControl->GetCurPagePos();
1519
0
                SdPage* pCurrentPage = ( GetEditMode() == EditMode::Page )
1520
0
                    ? GetDoc()->GetSdPage( nPage, GetPageKind() )
1521
0
                    : GetDoc()->GetMasterSdPage( nPage, GetPageKind() );
1522
1523
0
                OUString aTitle = SdResId(STR_TITLE_RENAMESLIDE);
1524
0
                OUString aDescr = SdResId(STR_DESC_RENAMESLIDE);
1525
0
                const OUString& aPageName = pCurrentPage->GetName();
1526
1527
0
                if(rReq.GetArgs())
1528
0
                {
1529
0
                    OUString aName = rReq.GetArgs()->GetItem<const SfxStringItem>(SID_RENAMEPAGE)->GetValue();
1530
1531
0
                    bool bResult = RenameSlide( maTabControl->GetPageId(nPage), aName );
1532
0
                    DBG_ASSERT( bResult, "Couldn't rename slide" );
1533
0
                }
1534
0
                else
1535
0
                {
1536
0
                    SvxNameDialog aNameDlg(GetFrameWeld(), aPageName, aDescr);
1537
0
                    aNameDlg.set_title(aTitle);
1538
0
                    aNameDlg.SetCheckNameHdl(LINK(this, DrawViewShell, RenameSlideHdl));
1539
0
                    aNameDlg.SetEditHelpId(HID_SD_NAMEDIALOG_PAGE);
1540
1541
0
                    if (aNameDlg.run() == RET_OK)
1542
0
                    {
1543
0
                        OUString aNewName = aNameDlg.GetName();
1544
0
                        if (aNewName != aPageName)
1545
0
                        {
1546
0
                            bool bResult = RenameSlide( maTabControl->GetPageId(nPage), aNewName );
1547
0
                            DBG_ASSERT( bResult, "Couldn't rename slide" );
1548
0
                        }
1549
0
                    }
1550
0
                }
1551
0
            }
1552
0
            Cancel();
1553
0
            rReq.Ignore();
1554
0
        }
1555
0
        break;
1556
1557
0
        case SID_RENAMEPAGE_QUICK:
1558
0
        {
1559
0
            if (mePageKind==PageKind::Standard || mePageKind==PageKind::Notes )
1560
0
            {
1561
0
                if ( mpDrawView->IsTextEdit() )
1562
0
                {
1563
0
                    mpDrawView->SdrEndTextEdit();
1564
0
                }
1565
1566
0
                maTabControl->StartEditMode( maTabControl->GetCurPageId() );
1567
0
            }
1568
1569
0
            Cancel();
1570
0
            rReq.Ignore ();
1571
0
        }
1572
0
        break;
1573
1574
0
        case SID_ADD_SLIDE_SECTION:
1575
0
        {
1576
0
            SdPage* pPage = GetActualPage();
1577
0
            if (pPage)
1578
0
            {
1579
0
                sal_uInt16 nPage = (pPage->GetPageNum() - 1) / 2;
1580
0
                sd::SlideSectionManager& rMgr = GetDoc()->GetSectionManager();
1581
0
                auto pUndo = GetDoc()->IsUndoEnabled()
1582
0
                    ? std::make_unique<sd::UndoSlideSection>(
1583
0
                          *GetDoc(), SdResId(STR_UNDO_ADD_SLIDE_SECTION))
1584
0
                    : nullptr;
1585
0
                rMgr.AddSection(nPage, SdResId(STR_DEFAULT_SLIDE_SECTION_NAME));
1586
0
                if (pUndo)
1587
0
                    GetDoc()->AddUndo(std::move(pUndo));
1588
0
                GetDocSh()->SetModified();
1589
0
            }
1590
0
        }
1591
0
        break;
1592
1593
0
        case SID_REMOVE_SLIDE_SECTION:
1594
0
        {
1595
0
            SdPage* pPage = GetActualPage();
1596
0
            if (pPage)
1597
0
            {
1598
0
                sal_uInt16 nPage = (pPage->GetPageNum() - 1) / 2;
1599
0
                sd::SlideSectionManager& rMgr = GetDoc()->GetSectionManager();
1600
0
                sal_Int32 nSectionIdx = rMgr.GetSectionIndexForSlide(nPage);
1601
0
                if (nSectionIdx >= 0 && rMgr.IsSectionStart(nPage))
1602
0
                {
1603
0
                    auto pUndo = GetDoc()->IsUndoEnabled()
1604
0
                        ? std::make_unique<sd::UndoSlideSection>(
1605
0
                              *GetDoc(), SdResId(STR_UNDO_REMOVE_SLIDE_SECTION))
1606
0
                        : nullptr;
1607
0
                    rMgr.RemoveSection(nSectionIdx);
1608
0
                    if (pUndo)
1609
0
                        GetDoc()->AddUndo(std::move(pUndo));
1610
0
                    GetDocSh()->SetModified();
1611
0
                }
1612
0
            }
1613
0
        }
1614
0
        break;
1615
1616
0
        case SID_REMOVE_SLIDE_SECTION_AND_SLIDES:
1617
0
        {
1618
0
            SdPage* pPage = GetActualPage();
1619
0
            if (pPage)
1620
0
            {
1621
0
                sal_uInt16 nPage = (pPage->GetPageNum() - 1) / 2;
1622
0
                sd::SlideSectionManager& rMgr = GetDoc()->GetSectionManager();
1623
0
                sal_Int32 nSectionIdx = rMgr.GetSectionIndexForSlide(nPage);
1624
0
                if (nSectionIdx >= 0 && rMgr.IsSectionStart(nPage))
1625
0
                {
1626
0
                    const bool bUndo = GetDoc()->IsUndoEnabled();
1627
0
                    if (bUndo)
1628
0
                        GetView()->BegUndo(
1629
0
                            SdResId(STR_UNDO_REMOVE_SLIDE_SECTION_AND_SLIDES));
1630
1631
0
                    rMgr.RemoveSectionSlides(nSectionIdx);
1632
1633
0
                    if (bUndo)
1634
0
                        GetView()->EndUndo();
1635
0
                    GetDocSh()->SetModified();
1636
0
                    ResetActualPage();
1637
0
                }
1638
0
            }
1639
0
        }
1640
0
        break;
1641
1642
0
        case SID_RENAME_SLIDE_SECTION:
1643
0
        {
1644
0
            sd::SlideSectionManager& rMgr = GetDoc()->GetSectionManager();
1645
0
            if (rReq.GetArgs())
1646
0
            {
1647
0
                const SfxInt32Item* pIndexItem
1648
0
                    = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_RENAME_SLIDE_SECTION, false);
1649
0
                const SfxStringItem* pNameItem
1650
0
                    = rReq.GetArgs()->GetItem<SfxStringItem>(SID_RENAMEPAGE, false);
1651
0
                if (pIndexItem && pNameItem)
1652
0
                {
1653
0
                    sal_Int32 nSectionIndex = pIndexItem->GetValue();
1654
0
                    OUString aNewName = pNameItem->GetValue();
1655
0
                    if (nSectionIndex >= 0 && nSectionIndex < rMgr.GetSectionCount()
1656
0
                        && !aNewName.isEmpty())
1657
0
                    {
1658
0
                        auto pUndo = GetDoc()->IsUndoEnabled()
1659
0
                            ? std::make_unique<sd::UndoSlideSection>(
1660
0
                                  *GetDoc(), SdResId(STR_UNDO_RENAME_SLIDE_SECTION))
1661
0
                            : nullptr;
1662
0
                        rMgr.RenameSection(nSectionIndex, aNewName);
1663
0
                        if (pUndo)
1664
0
                            GetDoc()->AddUndo(std::move(pUndo));
1665
0
                        GetDocSh()->SetModified();
1666
0
                    }
1667
0
                }
1668
0
            }
1669
0
        }
1670
0
        break;
1671
1672
0
        case SID_MOVE_SLIDE_SECTION_UP:
1673
0
        {
1674
0
            SdPage* pPage = GetActualPage();
1675
0
            if (pPage)
1676
0
            {
1677
0
                sal_uInt16 nPage = (pPage->GetPageNum() - 1) / 2;
1678
0
                sd::SlideSectionManager& rMgr = GetDoc()->GetSectionManager();
1679
0
                sal_Int32 nSectionIdx = rMgr.GetSectionIndexForSlide(nPage);
1680
0
                if (nSectionIdx > 0)
1681
0
                {
1682
                    // Group the section metadata undo with the page-reorder undo
1683
                    // recorded by MovePages() inside MoveSection().
1684
0
                    const bool bUndo = GetDoc()->IsUndoEnabled();
1685
0
                    if (bUndo)
1686
0
                        GetDoc()->BegUndo(SdResId(STR_UNDO_MOVE_SLIDE_SECTION));
1687
0
                    auto pUndo = bUndo
1688
0
                        ? std::make_unique<sd::UndoSlideSection>(
1689
0
                              *GetDoc(), SdResId(STR_UNDO_MOVE_SLIDE_SECTION))
1690
0
                        : nullptr;
1691
0
                    rMgr.MoveSection(nSectionIdx, nSectionIdx - 1);
1692
0
                    if (bUndo)
1693
0
                    {
1694
0
                        GetDoc()->AddUndo(std::move(pUndo));
1695
0
                        GetDoc()->EndUndo();
1696
0
                    }
1697
0
                    GetDocSh()->SetModified();
1698
0
                }
1699
0
            }
1700
0
        }
1701
0
        break;
1702
1703
0
        case SID_MOVE_SLIDE_SECTION_DOWN:
1704
0
        {
1705
0
            SdPage* pPage = GetActualPage();
1706
0
            if (pPage)
1707
0
            {
1708
0
                sal_uInt16 nPage = (pPage->GetPageNum() - 1) / 2;
1709
0
                sd::SlideSectionManager& rMgr = GetDoc()->GetSectionManager();
1710
0
                sal_Int32 nSectionIdx = rMgr.GetSectionIndexForSlide(nPage);
1711
0
                if (nSectionIdx >= 0 && nSectionIdx < rMgr.GetSectionCount() - 1)
1712
0
                {
1713
0
                    const bool bUndo = GetDoc()->IsUndoEnabled();
1714
0
                    if (bUndo)
1715
0
                        GetDoc()->BegUndo(SdResId(STR_UNDO_MOVE_SLIDE_SECTION));
1716
0
                    auto pUndo = bUndo
1717
0
                        ? std::make_unique<sd::UndoSlideSection>(
1718
0
                              *GetDoc(), SdResId(STR_UNDO_MOVE_SLIDE_SECTION))
1719
0
                        : nullptr;
1720
0
                    rMgr.MoveSection(nSectionIdx, nSectionIdx + 1);
1721
0
                    if (bUndo)
1722
0
                    {
1723
0
                        GetDoc()->AddUndo(std::move(pUndo));
1724
0
                        GetDoc()->EndUndo();
1725
0
                    }
1726
0
                    GetDocSh()->SetModified();
1727
0
                }
1728
0
            }
1729
0
        }
1730
0
        break;
1731
1732
0
        case SID_PAGESIZE :  // either this (no menu entries or something else!)
1733
0
        {
1734
0
            const SfxItemSet *pArgs = rReq.GetArgs ();
1735
1736
0
            if (pArgs && pArgs->Count () == 3)
1737
0
            {
1738
0
                const SfxUInt32Item* pWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEWIDTH);
1739
0
                const SfxUInt32Item* pHeight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEHEIGHT);
1740
0
                const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
1741
1742
0
                Size aSize (pWidth->GetValue (), pHeight->GetValue ());
1743
1744
0
                SetupPage (aSize, 0, 0, 0, 0, true, false, pScaleAll->GetValue ());
1745
0
                rReq.Ignore ();
1746
0
                break;
1747
0
            }
1748
#if HAVE_FEATURE_SCRIPTING
1749
            StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
1750
#endif
1751
0
            rReq.Ignore ();
1752
0
            break;
1753
0
        }
1754
1755
0
        case SID_PAGEMARGIN :  // or this (no menu entries or something else!)
1756
0
        {
1757
0
            const SfxItemSet *pArgs = rReq.GetArgs ();
1758
1759
0
            if (pArgs && pArgs->Count () == 5)
1760
0
            {
1761
0
                const SfxUInt32Item* pLeft = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGELEFT);
1762
0
                const SfxUInt32Item* pRight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGERIGHT);
1763
0
                const SfxUInt32Item* pUpper = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGETOP);
1764
0
                const SfxUInt32Item* pLower = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEBOTTOM);
1765
0
                const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
1766
1767
0
                Size aEmptySize (0, 0);
1768
1769
0
                SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
1770
0
                           pUpper->GetValue (), pLower->GetValue (),
1771
0
                           false, true, pScaleAll->GetValue ());
1772
0
                rReq.Ignore ();
1773
0
                break;
1774
0
            }
1775
#if HAVE_FEATURE_SCRIPTING
1776
            StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
1777
#endif
1778
0
            rReq.Ignore ();
1779
0
            break;
1780
0
        }
1781
1782
0
        case SID_ATTR_ZOOMSLIDER:
1783
0
        {
1784
0
            const SfxItemSet* pArgs = rReq.GetArgs();
1785
1786
0
            const SfxUInt16Item* pScale = (pArgs && pArgs->Count () == 1) ?
1787
0
                rReq.GetArg(SID_ATTR_ZOOMSLIDER) : nullptr;
1788
0
            if (pScale && CHECK_RANGE (5, pScale->GetValue (), 3000))
1789
0
            {
1790
0
                SetZoom (pScale->GetValue ());
1791
1792
0
                SfxBindings& rBindings = GetViewFrame()->GetBindings();
1793
0
                rBindings.Invalidate( SID_ATTR_ZOOM );
1794
0
                rBindings.Invalidate( SID_ZOOM_IN );
1795
0
                rBindings.Invalidate( SID_ZOOM_OUT );
1796
0
                rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
1797
1798
0
            }
1799
1800
0
            Cancel();
1801
0
            rReq.Done ();
1802
0
            break;
1803
0
        }
1804
1805
0
        case SID_ATTR_ZOOM:
1806
0
        {
1807
0
            const SfxItemSet* pArgs = rReq.GetArgs();
1808
0
            mbZoomOnPage = false;
1809
1810
0
            if ( pArgs )
1811
0
            {
1812
0
                SvxZoomType eZT = pArgs->Get( SID_ATTR_ZOOM ).GetType();
1813
0
                switch( eZT )
1814
0
                {
1815
0
                    case SvxZoomType::PERCENT:
1816
0
                    {
1817
0
                        sal_uInt16 nZoom = pArgs->Get( SID_ATTR_ZOOM ).GetValue();
1818
0
                        SetZoom( static_cast<::tools::Long>( nZoom ) );
1819
0
                    }
1820
0
                        break;
1821
1822
0
                    case SvxZoomType::OPTIMAL:
1823
0
                        GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
1824
0
                                    SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1825
0
                        break;
1826
1827
0
                    case SvxZoomType::PAGEWIDTH:
1828
0
                        GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
1829
0
                                    SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1830
0
                        break;
1831
1832
0
                    case SvxZoomType::WHOLEPAGE:
1833
0
                        GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
1834
0
                                    SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
1835
0
                        break;
1836
0
                    case SvxZoomType::PAGEWIDTH_NOBORDER:
1837
0
                        OSL_FAIL("sd::DrawViewShell::FuTemporary(), SvxZoomType::PAGEWIDTH_NOBORDER not handled!" );
1838
0
                        break;
1839
0
                }
1840
0
                rReq.Ignore ();
1841
0
            }
1842
0
            else
1843
0
            {
1844
                // open zoom dialog
1845
0
                SetCurrentFunction( FuScale::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
1846
0
            }
1847
0
            Cancel();
1848
0
        }
1849
0
        break;
1850
1851
0
        case SID_CHANGEBEZIER:
1852
0
        case SID_CHANGEPOLYGON:
1853
0
            if ( mpDrawView->IsTextEdit() )
1854
0
            {
1855
0
                mpDrawView->SdrEndTextEdit();
1856
0
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1857
0
            }
1858
1859
0
            if ( mpDrawView->IsPresObjSelected() )
1860
0
            {
1861
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1862
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
1863
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
1864
0
                xInfoBox->run();
1865
0
            }
1866
0
            else
1867
0
            {
1868
0
                if( rReq.GetSlot() == SID_CHANGEBEZIER )
1869
0
                {
1870
0
                    weld::WaitObject aWait(GetFrameWeld());
1871
0
                    mpDrawView->ConvertMarkedToPathObj(false);
1872
0
                }
1873
0
                else
1874
0
                {
1875
0
                    if( mpDrawView->IsVectorizeAllowed() )
1876
0
                    {
1877
0
                        SetCurrentFunction( FuVectorize::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
1878
0
                    }
1879
0
                    else
1880
0
                    {
1881
0
                        weld::WaitObject aWait(GetFrameWeld());
1882
0
                        mpDrawView->ConvertMarkedToPolyObj();
1883
0
                    }
1884
0
                }
1885
1886
0
                Invalidate(SID_CHANGEBEZIER);
1887
0
                Invalidate(SID_CHANGEPOLYGON);
1888
0
            }
1889
0
            Cancel();
1890
1891
0
            if( HasCurrentFunction(SID_BEZIER_EDIT) )
1892
0
            {   // where applicable, activate right edit action
1893
0
                GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
1894
0
                                        SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
1895
0
            }
1896
0
            rReq.Ignore ();
1897
0
            break;
1898
1899
0
        case SID_CONVERT_TO_CONTOUR:
1900
0
            if ( mpDrawView->IsTextEdit() )
1901
0
            {
1902
0
                mpDrawView->SdrEndTextEdit();
1903
0
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1904
0
            }
1905
1906
0
            if ( mpDrawView->IsPresObjSelected() )
1907
0
            {
1908
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1909
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
1910
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
1911
0
                xInfoBox->run();
1912
0
            }
1913
0
            else
1914
0
            {
1915
0
                weld::WaitObject aWait(GetFrameWeld());
1916
0
                mpDrawView->ConvertMarkedToPathObj(true);
1917
1918
0
                Invalidate(SID_CONVERT_TO_CONTOUR);
1919
0
            }
1920
0
            Cancel();
1921
1922
0
            rReq.Ignore ();
1923
0
            break;
1924
1925
0
        case SID_CONVERT_TO_METAFILE:
1926
0
        case SID_CONVERT_TO_BITMAP:
1927
0
        {
1928
            // End text edit mode when it is active because the metafile or
1929
            // bitmap that will be created does not support it.
1930
0
            if ( mpDrawView->IsTextEdit() )
1931
0
            {
1932
0
                mpDrawView->SdrEndTextEdit();
1933
0
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1934
0
            }
1935
1936
0
            if ( mpDrawView->IsPresObjSelected(true,true,true) )
1937
0
            {
1938
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
1939
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
1940
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
1941
0
                xInfoBox->run();
1942
0
            }
1943
0
            else
1944
0
            {
1945
0
                weld::WaitObject aWait(GetFrameWeld());
1946
1947
                // create SdrGrafObj from metafile/bitmap
1948
0
                Graphic aGraphic;
1949
0
                switch (nSId)
1950
0
                {
1951
0
                    case SID_CONVERT_TO_METAFILE:
1952
0
                    {
1953
                        // switch on undo for the next operations
1954
0
                        mpDrawView->BegUndo(SdResId(STR_UNDO_CONVERT_TO_METAFILE));
1955
0
                        GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile());
1956
0
                        aGraphic = Graphic(aMetaFile);
1957
0
                    }
1958
0
                    break;
1959
0
                    case SID_CONVERT_TO_BITMAP:
1960
0
                    {
1961
                        // Disable spelling during conversion
1962
0
                        bool bOnlineSpell = GetDoc()->GetOnlineSpell();
1963
0
                        GetDoc()->SetOnlineSpell(false);
1964
1965
                        // switch on undo for the next operations
1966
0
                        mpDrawView->BegUndo(SdResId(STR_UNDO_CONVERT_TO_BITMAP));
1967
0
                        aGraphic = Graphic(mpDrawView->GetMarkedObjBitmap());
1968
                        // Restore online spelling
1969
0
                        GetDoc()->SetOnlineSpell(bOnlineSpell);
1970
0
                    }
1971
0
                    break;
1972
0
                }
1973
1974
                // create new object
1975
0
                rtl::Reference<SdrGrafObj> pGraphicObj = new SdrGrafObj(
1976
0
                    *GetDoc(),
1977
0
                    aGraphic);
1978
1979
                // get some necessary info and ensure it
1980
0
                const size_t nMarkCount(rMarkList.GetMarkCount());
1981
0
                SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1982
0
                OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
1983
0
                OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
1984
1985
                // fit rectangle of new graphic object to selection's mark rect
1986
0
                ::tools::Rectangle aAllMarkedRect;
1987
0
                rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
1988
0
                pGraphicObj->SetLogicRect(aAllMarkedRect);
1989
1990
                // #i71540# to keep the order, it is necessary to replace the lowest object
1991
                // of the selection with the new object. This also means that with multi
1992
                // selection, all other objects need to be deleted first
1993
0
                SdrMark* pFirstMark = rMarkList.GetMark(0);
1994
0
                SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
1995
1996
0
                if(nMarkCount > 1)
1997
0
                {
1998
                    // take first object out of selection
1999
0
                    mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
2000
2001
                    // clear remaining selection
2002
0
                    mpDrawView->DeleteMarkedObj();
2003
0
                }
2004
2005
                // #i124816# copy layer from lowest object which gets replaced
2006
0
                pGraphicObj->SetLayer(pReplacementCandidate->GetLayer());
2007
2008
                // now replace lowest object with new one
2009
0
                mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj.get());
2010
2011
                // switch off undo
2012
0
                mpDrawView->EndUndo();
2013
0
            }
2014
0
        }
2015
2016
0
        Cancel();
2017
2018
0
        rReq.Done ();
2019
0
        break;
2020
2021
0
        case SID_REMOVE_HYPERLINK:
2022
0
        {
2023
0
            if (mpDrawView->IsTextEdit())
2024
0
            {
2025
0
                OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
2026
0
                if (pOutView)
2027
0
                    URLFieldHelper::RemoveURLField(pOutView->GetEditView());
2028
0
            }
2029
0
        }
2030
0
        Cancel();
2031
0
        rReq.Done ();
2032
0
        break;
2033
2034
0
        case SID_SET_DEFAULT:
2035
0
        {
2036
0
            std::optional<SfxItemSet> pSet;
2037
2038
0
            if (mpDrawView->IsTextEdit())
2039
0
            {
2040
0
                pSet.emplace( GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END> );
2041
0
                mpDrawView->SetAttributes( *pSet, true );
2042
0
            }
2043
0
            else
2044
0
            {
2045
0
                const size_t nCount = rMarkList.GetMarkCount();
2046
2047
                // For every presentation object a SfxItemSet of hard attributes
2048
                // and the UserCall is stored in this list. This is because
2049
                // at the following mpDrawView->SetAttributes( *pSet, sal_True )
2050
                // they get lost and have to be restored.
2051
0
                std::vector<std::pair<std::unique_ptr<SfxItemSet>,SdrObjUserCall*> > aAttrList;
2052
0
                SdPage* pPresPage = static_cast<SdPage*>( mpDrawView->GetSdrPageView()->GetPage() );
2053
2054
0
                for ( size_t i = 0; i < nCount; ++i )
2055
0
                {
2056
0
                    SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
2057
2058
0
                    if( pPresPage->IsPresObj( pObj ) )
2059
0
                    {
2060
0
                        auto pNewSet = std::make_unique<SfxItemSet>(SfxItemSet::makeFixedSfxItemSet<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT>( GetDoc()->GetPool() ));
2061
0
                        pNewSet->Put(pObj->GetMergedItemSet());
2062
0
                        aAttrList.emplace_back(std::move(pNewSet), pObj->GetUserCall());
2063
0
                    }
2064
0
                }
2065
2066
0
                pSet.emplace( GetPool() );
2067
0
                mpDrawView->SetAttributes( *pSet, true );
2068
2069
0
                sal_uLong j = 0;
2070
2071
0
                for ( size_t i = 0; i < nCount; ++i )
2072
0
                {
2073
0
                    SfxStyleSheet* pSheet = nullptr;
2074
0
                    SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
2075
2076
0
                    if (pObj->GetObjIdentifier() == SdrObjKind::TitleText)
2077
0
                    {
2078
0
                        pSheet = mpActualPage->GetStyleSheetForPresObj(PresObjKind::Title);
2079
0
                        if (pSheet)
2080
0
                            pObj->SetStyleSheet(pSheet, false);
2081
0
                    }
2082
0
                    else if(pObj->GetObjIdentifier() == SdrObjKind::OutlineText)
2083
0
                    {
2084
0
                        for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
2085
0
                        {
2086
0
                            pSheet = mpActualPage->GetStyleSheetForPresObj( PresObjKind::Outline );
2087
0
                            DBG_ASSERT(pSheet, "Template for outline object not found");
2088
0
                            if (pSheet)
2089
0
                            {
2090
0
                                pObj->StartListening(*pSheet);
2091
2092
0
                                if( nLevel == 1 )
2093
                                    // text frame listens on StyleSheet of level1
2094
0
                                    pObj->NbcSetStyleSheet(pSheet, false);
2095
0
                            }
2096
0
                        }
2097
0
                    }
2098
2099
0
                    if( pPresPage->IsPresObj( pObj ) )
2100
0
                    {
2101
0
                        std::pair<std::unique_ptr<SfxItemSet>,SdrObjUserCall*> &rAttr = aAttrList[j++];
2102
2103
0
                        std::unique_ptr<SfxItemSet> & pNewSet(rAttr.first);
2104
0
                        SdrObjUserCall* pUserCall = rAttr.second;
2105
2106
0
                        if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SfxItemState::SET )
2107
0
                        {
2108
0
                            pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
2109
0
                        }
2110
2111
0
                        if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SfxItemState::SET )
2112
0
                        {
2113
0
                            pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
2114
0
                        }
2115
2116
0
                        if( pUserCall )
2117
0
                            pObj->SetUserCall( pUserCall );
2118
0
                    }
2119
0
                }
2120
0
            }
2121
2122
0
            pSet.reset();
2123
0
            Cancel();
2124
0
        }
2125
0
        break;
2126
2127
0
        case SID_DELETE_SNAPITEM:
2128
0
        {
2129
0
            SdrPageView* pPV;
2130
0
            Point   aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
2131
0
            sal_uInt16  nHitLog = static_cast<sal_uInt16>(GetActiveWindow()->PixelToLogic( Size(
2132
0
                FuPoor::HITPIX, 0 ) ).Width());
2133
0
            sal_uInt16  nHelpLine;
2134
2135
0
            if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow()->GetOutDev(), nHelpLine, pPV) )
2136
0
            {
2137
0
                pPV->DeleteHelpLine( nHelpLine );
2138
0
            }
2139
0
            Cancel();
2140
0
            rReq.Ignore ();
2141
0
        }
2142
0
        break;
2143
2144
0
        case SID_DELETE_PAGE:
2145
0
        case SID_DELETE_MASTER_PAGE:
2146
0
            DeleteActualPage();
2147
0
            Cancel();
2148
0
            rReq.Ignore ();
2149
0
        break;
2150
2151
0
        case SID_DELETE_LAYER:
2152
0
            DeleteActualLayer();
2153
0
            Cancel();
2154
0
            rReq.Ignore ();
2155
0
        break;
2156
2157
0
        case SID_ORIGINAL_SIZE:
2158
0
            mpDrawView->SetMarkedOriginalSize();
2159
0
            Cancel();
2160
0
            rReq.Done();
2161
0
        break;
2162
2163
0
        case SID_DRAW_FONTWORK:
2164
0
        case SID_DRAW_FONTWORK_VERTICAL:
2165
0
        {
2166
0
            svx::FontworkBar::execute(*mpView, rReq, GetViewFrame()->GetBindings());       // SJ: can be removed  (I think)
2167
0
            Cancel();
2168
0
            rReq.Done();
2169
0
        }
2170
0
        break;
2171
2172
0
        case SID_SAVE_GRAPHIC:
2173
0
        {
2174
0
            if( rMarkList.GetMarkCount() == 1 )
2175
0
            {
2176
0
                if (const SdrGrafObj* pObj = dynamic_cast<const SdrGrafObj*>(rMarkList.GetMark(0)->GetMarkedSdrObj()))
2177
0
                    if (pObj->GetGraphicType() == GraphicType::Bitmap || pObj->GetGraphicType() == GraphicType::GdiMetafile)
2178
0
                    {
2179
0
                        weld::Window* pFrame = GetFrameWeld();
2180
0
                        GraphicAttr aGraphicAttr = pObj->GetGraphicAttr();
2181
0
                        short nState = RET_CANCEL;
2182
0
                        if (aGraphicAttr != GraphicAttr()) // the image has been modified
2183
0
                        {
2184
0
                            if (pFrame)
2185
0
                            {
2186
0
                                nState = GraphicHelper::HasToSaveTransformedImage(pFrame);
2187
0
                            }
2188
0
                        }
2189
0
                        else
2190
0
                        {
2191
0
                            nState = RET_NO;
2192
0
                        }
2193
2194
0
                        if (nState == RET_YES)
2195
0
                        {
2196
0
                            GraphicHelper::ExportGraphic(pFrame, pObj->GetTransformedGraphic(), u""_ustr);
2197
0
                        }
2198
0
                        else if (nState == RET_NO)
2199
0
                        {
2200
0
                            const GraphicObject& aGraphicObject(pObj->GetGraphicObject());
2201
0
                            GraphicHelper::ExportGraphic(pFrame, aGraphicObject.GetGraphic(), u""_ustr);
2202
0
                        }
2203
0
                    }
2204
0
            }
2205
0
            Cancel();
2206
0
            rReq.Ignore();
2207
0
        }
2208
0
        break;
2209
2210
0
        case SID_EXTERNAL_EDIT:
2211
0
        {
2212
0
            if( rMarkList.GetMarkCount() == 1 )
2213
0
            {
2214
0
                SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
2215
0
                if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ) )
2216
0
                    if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
2217
0
                    {
2218
0
                        GraphicObject aGraphicObject( pGraphicObj->GetGraphicObject() );
2219
0
                        m_ExternalEdits.push_back(
2220
0
                            std::make_unique<SdrExternalToolEdit>(
2221
0
                                mpDrawView.get(), pGraphicObj));
2222
0
                        m_ExternalEdits.back()->Edit( &aGraphicObject );
2223
0
                    }
2224
0
            }
2225
0
            Cancel();
2226
0
            rReq.Ignore();
2227
0
        }
2228
0
        break;
2229
2230
0
        case SID_COMPRESS_GRAPHIC:
2231
0
        {
2232
0
            if( rMarkList.GetMarkCount() == 1 )
2233
0
            {
2234
0
                SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
2235
2236
0
                if( auto pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj ) )
2237
0
                    if( pGraphicObj->GetGraphicType() == GraphicType::Bitmap )
2238
0
                    {
2239
0
                        CompressGraphicsDialog dialog(GetFrameWeld(), pGraphicObj, GetViewFrame()->GetBindings() );
2240
0
                        if (dialog.run() == RET_OK)
2241
0
                        {
2242
0
                            rtl::Reference<SdrGrafObj> pNewObject = dialog.GetCompressedSdrGrafObj();
2243
0
                            SdrPageView* pPageView = mpDrawView->GetSdrPageView();
2244
0
                            OUString aUndoString = rMarkList.GetMarkDescription() + " Compress";
2245
0
                            mpDrawView->BegUndo( aUndoString );
2246
0
                            mpDrawView->ReplaceObjectAtView( pObj, *pPageView, pNewObject.get() );
2247
0
                            mpDrawView->EndUndo();
2248
0
                        }
2249
0
                    }
2250
0
            }
2251
0
            Cancel();
2252
0
            rReq.Ignore();
2253
0
        }
2254
0
        break;
2255
2256
0
        case SID_GRAPHIC_SIZE_CHECK:
2257
0
        {
2258
0
            sd::GraphicSizeCheckGUIResult aResult(GetDoc());
2259
0
            svx::GenericCheckDialog aDialog(GetFrameWeld(), aResult);
2260
0
            aDialog.run();
2261
2262
0
            Cancel();
2263
0
            rReq.Ignore();
2264
0
        }
2265
0
        break;
2266
2267
0
        case SID_ATTRIBUTES_LINE:  // BASIC
2268
0
        {
2269
0
            SetCurrentFunction( FuLine::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2270
0
            if (rReq.GetArgs())
2271
0
                Cancel();
2272
0
        }
2273
0
        break;
2274
2275
0
        case SID_ATTRIBUTES_AREA:  // BASIC
2276
0
        {
2277
0
            SetCurrentFunction( FuArea::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2278
0
            if (rReq.GetArgs())
2279
0
                Cancel();
2280
0
        }
2281
0
        break;
2282
2283
0
        case SID_ATTR_TRANSFORM:
2284
0
        {
2285
0
            SetCurrentFunction( FuTransform::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2286
            // tdf#138963 conditions tested for here must be the same as those
2287
            // of the early returns from FuTransform::DoExecute
2288
0
            if (rReq.GetArgs() || rMarkList.GetMarkCount() == 0)
2289
0
            {
2290
0
                Invalidate(SID_RULER_OBJECT);
2291
0
                Cancel();
2292
0
            }
2293
0
        }
2294
0
        break;
2295
0
        case SID_MOVE_SHAPE_HANDLE:
2296
0
        {
2297
0
            const SfxItemSet *pArgs = rReq.GetArgs ();
2298
0
            if (pArgs && pArgs->Count () >= 3)
2299
0
            {
2300
0
                const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
2301
0
                const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
2302
0
                const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
2303
0
                const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
2304
2305
0
                const sal_uInt32 handleNum = handleNumItem->GetValue();
2306
0
                const ::tools::Long newPosX = convertTwipToMm100(newPosXTwips->GetValue());
2307
0
                const ::tools::Long newPosY = convertTwipToMm100(newPosYTwips->GetValue());
2308
2309
0
                mpDrawView->MoveShapeHandle(handleNum, Point(newPosX, newPosY), OrdNum ? OrdNum->GetValue() : -1);
2310
0
                Cancel();
2311
0
            }
2312
0
            break;
2313
0
        }
2314
0
        case SID_CHAR_DLG_EFFECT:
2315
0
        case SID_CHAR_DLG:  // BASIC
2316
0
        {
2317
0
            SetCurrentFunction( FuChar::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2318
0
            Cancel();
2319
0
        }
2320
0
        break;
2321
2322
0
        case SID_PARA_DLG:
2323
0
        {
2324
0
            SetCurrentFunction( FuParagraph::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2325
0
            Cancel();
2326
0
        }
2327
0
        break;
2328
2329
0
        case FN_NUM_BULLET_ON:
2330
0
        {
2331
0
            SfxUInt16Item aItem(FN_SVX_SET_BULLET, FuBulletAndPosition::BULLET_TOGGLE);
2332
0
            GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_BULLET,
2333
0
                    SfxCallMode::RECORD, { &aItem });
2334
0
        }
2335
0
        break;
2336
2337
0
        case FN_NUM_NUMBERING_ON:
2338
0
        {
2339
0
            SfxUInt16Item aItem(FN_SVX_SET_NUMBER, FuBulletAndPosition::BULLET_TOGGLE);
2340
0
            GetViewFrame()->GetDispatcher()->ExecuteList(FN_SVX_SET_NUMBER,
2341
0
                    SfxCallMode::RECORD, { &aItem });
2342
0
        }
2343
0
        break;
2344
2345
0
        case SID_OUTLINE_BULLET:
2346
0
        case FN_SVX_SET_BULLET:
2347
0
        case FN_SVX_SET_NUMBER:
2348
0
        {
2349
0
            SetCurrentFunction( FuBulletAndPosition::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2350
0
            Cancel();
2351
0
            SfxBindings& rBindings = GetViewFrame()->GetBindings();
2352
0
            rBindings.Invalidate( FN_NUM_BULLET_ON );
2353
0
            rBindings.Invalidate( FN_NUM_NUMBERING_ON );
2354
0
        }
2355
0
        break;
2356
2357
0
        case FN_INSERT_SOFT_HYPHEN:
2358
0
        case FN_INSERT_HARDHYPHEN:
2359
0
        case FN_INSERT_HARD_SPACE:
2360
0
        case FN_INSERT_NNBSP:
2361
0
        case SID_INSERT_RLM :
2362
0
        case SID_INSERT_LRM :
2363
0
        case SID_INSERT_WJ :
2364
0
        case SID_INSERT_ZWSP:
2365
0
        case SID_CHARMAP:
2366
0
        {
2367
0
            SetCurrentFunction( FuBullet::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2368
0
            Cancel();
2369
0
        }
2370
0
        break;
2371
2372
0
        case SID_PRESENTATION_LAYOUT:
2373
0
        {
2374
0
            SetCurrentFunction( FuPresentationLayout::Create(*this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq) );
2375
0
            Cancel();
2376
0
        }
2377
0
        break;
2378
2379
0
        case SID_PASTE_SPECIAL:
2380
0
        {
2381
0
            SetCurrentFunction( FuInsertClipboard::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2382
0
            Cancel();
2383
0
            rReq.Ignore ();
2384
0
        }
2385
0
        break;
2386
2387
0
        case SID_CHANGE_PICTURE:
2388
0
        case SID_INSERT_GRAPHIC:
2389
0
        {
2390
0
            SetCurrentFunction( FuInsertGraphic::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq,
2391
0
                                                         nSId == SID_CHANGE_PICTURE ) );
2392
0
            Cancel();
2393
0
            rReq.Ignore ();
2394
0
        }
2395
0
        break;
2396
2397
0
        case SID_INSERT_AVMEDIA:
2398
0
        {
2399
0
            SetCurrentFunction( FuInsertAVMedia::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2400
2401
0
            Cancel();
2402
0
            rReq.Ignore ();
2403
0
        }
2404
0
        break;
2405
2406
0
        case SID_INSERT_OBJECT:
2407
0
        case SID_INSERT_FLOATINGFRAME:
2408
0
        case SID_INSERT_MATH:
2409
0
        case SID_INSERT_DIAGRAM:
2410
0
        case SID_ATTR_TABLE:
2411
0
        {
2412
0
            SetCurrentFunction( FuInsertOLE::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2413
            // Set the selection tool as the old one. This in particular important for the
2414
            // zoom function, in which clicking without dragging zooms as well, and that
2415
            // makes exiting the object editing mode impossible.
2416
0
            if (dynamic_cast<FuSelection*>( GetOldFunction().get() ) == nullptr)
2417
0
                SetOldFunction( FuSelection::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2418
0
            Cancel();
2419
0
            rReq.Ignore ();
2420
0
        }
2421
0
        break;
2422
0
        case SID_CLASSIFICATION_APPLY:
2423
0
        {
2424
0
            const SfxItemSet* pArgs = rReq.GetArgs();
2425
0
            const SfxPoolItem* pItem = nullptr;
2426
0
            if (pArgs && pArgs->GetItemState(nSId, false, &pItem) == SfxItemState::SET)
2427
0
            {
2428
0
                const OUString& rName = static_cast<const SfxStringItem*>(pItem)->GetValue();
2429
0
                auto eType = SfxClassificationPolicyType::IntellectualProperty;
2430
0
                if (pArgs->GetItemState(SID_TYPE_NAME, false, &pItem) == SfxItemState::SET)
2431
0
                {
2432
0
                    const OUString& rType = static_cast<const SfxStringItem*>(pItem)->GetValue();
2433
0
                    eType = SfxClassificationHelper::stringToPolicyType(rType);
2434
0
                }
2435
0
                if (SfxViewFrame* pViewFrame = GetViewFrame())
2436
0
                {
2437
0
                    if (SfxObjectShell* pObjectShell = pViewFrame->GetObjectShell())
2438
0
                    {
2439
0
                        SfxClassificationHelper aHelper(pObjectShell->getDocProperties());
2440
0
                        aHelper.SetBACName(rName, eType);
2441
0
                    }
2442
0
                }
2443
0
            }
2444
0
            else
2445
0
                SAL_WARN("sd.ui", "missing parameter for SID_CLASSIFICATION_APPLY");
2446
2447
0
            Cancel();
2448
0
            rReq.Ignore();
2449
0
        }
2450
0
        break;
2451
2452
0
        case SID_CLASSIFICATION_DIALOG:
2453
0
        {
2454
0
            if (SfxObjectShell* pObjShell = SfxObjectShell::Current())
2455
0
            {
2456
0
                css::uno::Reference<css::document::XDocumentProperties> xDocProps(pObjShell->getDocProperties());
2457
0
                auto xDialog = std::make_shared<svx::ClassificationDialog>(GetFrameWeld(), xDocProps, false, [](){} );
2458
0
                ClassificationCollector aCollector(*this, xDocProps);
2459
0
                aCollector.collect();
2460
2461
0
                xDialog->setupValues(std::vector(aCollector.getResults()));
2462
2463
0
                if (RET_OK == xDialog->run())
2464
0
                {
2465
0
                    ClassificationInserter aInserter(*this, xDocProps);
2466
0
                    aInserter.insert(xDialog->getResult());
2467
0
                }
2468
0
                xDialog.reset();
2469
0
            }
2470
2471
0
            Cancel();
2472
0
            rReq.Ignore();
2473
0
        }
2474
0
        break;
2475
2476
0
        case SID_COPYOBJECTS:
2477
0
        {
2478
0
            if ( mpDrawView->IsPresObjSelected(false) )
2479
0
            {
2480
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2481
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
2482
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
2483
0
                xInfoBox->run();
2484
0
            }
2485
0
            else
2486
0
            {
2487
0
                if ( mpDrawView->IsTextEdit() )
2488
0
                {
2489
0
                    mpDrawView->SdrEndTextEdit();
2490
0
                }
2491
2492
0
                SetCurrentFunction( FuCopy::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2493
0
            }
2494
0
            Cancel();
2495
0
            rReq.Ignore ();
2496
0
        }
2497
0
        break;
2498
2499
0
        case SID_INSERTFILE:  // BASIC
2500
0
        {
2501
0
            Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
2502
0
            SetCurrentFunction( FuInsertFile::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2503
0
            Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
2504
0
            Cancel();
2505
0
            rReq.Done ();
2506
0
        }
2507
0
        break;
2508
2509
0
        case SID_SELECT_BACKGROUND:
2510
0
        case SID_SAVE_BACKGROUND:
2511
0
        case SID_ATTR_PAGE_SIZE:
2512
0
        case SID_ATTR_PAGE:
2513
0
        case SID_PAGESETUP:  // BASIC ??
2514
0
        {
2515
0
            SetCurrentFunction( FuPage::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2516
0
            Cancel();
2517
0
            rReq.Ignore (); // we generate independent macros !!
2518
0
        }
2519
0
        break;
2520
2521
0
        case SID_BEFORE_OBJ:
2522
0
        case SID_BEHIND_OBJ:
2523
0
        {
2524
0
            SetCurrentFunction( FuDisplayOrder::Create(*this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq) );
2525
0
            rReq.Done();
2526
            // finishes itself, no Cancel() needed!
2527
0
        }
2528
0
        break;
2529
2530
0
        case SID_REVERSE_ORDER:   // BASIC
2531
0
        {
2532
0
            mpDrawView->ReverseOrderOfMarked();
2533
0
            Cancel();
2534
0
            rReq.Done ();
2535
0
        }
2536
0
        break;
2537
2538
0
        case SID_ANIMATION_EFFECTS:
2539
0
        {
2540
0
            SetCurrentFunction( FuObjectAnimationParameters::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq) );
2541
0
            Cancel();
2542
0
        }
2543
0
        break;
2544
2545
0
        case SID_EXECUTE_ANIMATION_EFFECT:
2546
0
        {
2547
0
            SetCurrentFunction(FuExecuteInteraction::Create(*this, GetActiveWindow(),
2548
0
                                                            mpDrawView.get(), *GetDoc(), rReq));
2549
0
            Cancel();
2550
0
        }
2551
0
        break;
2552
2553
0
        case SID_LINEEND_POLYGON:
2554
0
        {
2555
0
            SetCurrentFunction( FuLineEnd::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2556
0
            Cancel();
2557
0
        }
2558
0
        break;
2559
2560
0
        case SID_CAPTUREPOINT:
2561
            // negative value to signal call from menu
2562
0
            maMousePos = Point(-1,-1);
2563
0
            [[fallthrough]];
2564
0
        case SID_SET_SNAPITEM:
2565
0
        {
2566
0
            SetCurrentFunction( FuSnapLine::Create(*this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq) );
2567
0
            Cancel();
2568
0
        }
2569
0
        break;
2570
2571
0
        case SID_MANAGE_LINKS:
2572
0
        {
2573
0
            SetCurrentFunction( FuLink::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2574
0
            Cancel();
2575
0
            rReq.Ignore ();
2576
0
        }
2577
0
        break;
2578
2579
0
        case SID_THESAURUS:
2580
0
        {
2581
0
            SetCurrentFunction( FuThesaurus::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2582
0
            Cancel();
2583
0
            rReq.Ignore ();
2584
0
        }
2585
0
        break;
2586
2587
0
        case SID_TEXTATTR_DLG:
2588
0
        {
2589
0
            if (mpDrawView->IsTextEdit())
2590
0
                mpDrawView->SdrEndTextEdit();
2591
0
            SetCurrentFunction( FuTextAttrDlg::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2592
0
            Cancel();
2593
0
            rReq.Ignore ();
2594
0
        }
2595
0
        break;
2596
2597
0
        case SID_MEASURE_DLG:
2598
0
        {
2599
0
            SetCurrentFunction( FuMeasureDlg::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2600
0
            Cancel();
2601
0
            rReq.Ignore ();
2602
0
        }
2603
0
        break;
2604
2605
0
        case SID_CONNECTION_DLG:
2606
0
        {
2607
0
            SetCurrentFunction( FuConnectionDlg::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2608
0
            Cancel();
2609
0
            rReq.Done();
2610
0
        }
2611
0
        break;
2612
2613
0
        case SID_CONNECTION_NEW_ROUTING:
2614
0
        {
2615
0
            SfxItemSet aDefAttr(SfxItemSet::makeFixedSfxItemSet<SDRATTR_EDGELINE1DELTA, SDRATTR_EDGELINE3DELTA>( GetPool() ));
2616
0
            GetView()->SetAttributes( aDefAttr, true ); // (ReplaceAll)
2617
2618
0
            Cancel();
2619
0
            rReq.Done();
2620
0
        }
2621
0
        break;
2622
2623
0
        case SID_TWAIN_SELECT:
2624
0
        {
2625
0
            if( mxScannerManager.is() )
2626
0
            {
2627
0
                try
2628
0
                {
2629
0
                    const css::uno::Sequence< css::scanner::ScannerContext >
2630
0
                        aContexts( mxScannerManager->getAvailableScanners() );
2631
2632
0
                    if( aContexts.hasElements() )
2633
0
                    {
2634
0
                        css::scanner::ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
2635
2636
0
                        Reference<lang::XInitialization> xInit(mxScannerManager, UNO_QUERY);
2637
0
                        if (xInit.is())
2638
0
                        {
2639
                            //  initialize dialog
2640
0
                            weld::Window* pWindow = rReq.GetFrameWeld();
2641
0
                            uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
2642
0
                            {
2643
0
                                {"ParentWindow", pWindow ? uno::Any(pWindow->GetXWindow()) : uno::Any(Reference<awt::XWindow>())}
2644
0
                            }));
2645
0
                            xInit->initialize( aSeq );
2646
0
                        }
2647
2648
0
                        mxScannerManager->configureScannerAndScan( aContext, mxScannerListener );
2649
0
                    }
2650
0
                }
2651
0
                catch(...)
2652
0
                {
2653
0
                }
2654
0
            }
2655
2656
0
            Cancel();
2657
0
            rReq.Done();
2658
0
        }
2659
0
        break;
2660
2661
0
        case SID_TWAIN_TRANSFER:
2662
0
        {
2663
0
            bool bDone = false;
2664
2665
0
            if( mxScannerManager.is() )
2666
0
            {
2667
0
                try
2668
0
                {
2669
0
                    const css::uno::Sequence< css::scanner::ScannerContext > aContexts( mxScannerManager->getAvailableScanners() );
2670
2671
0
                    if( aContexts.hasElements() )
2672
0
                    {
2673
0
                        mxScannerManager->startScan( aContexts.getConstArray()[ 0 ], mxScannerListener );
2674
0
                        bDone = true;
2675
0
                    }
2676
0
                }
2677
0
                catch( ... )
2678
0
                {
2679
0
                }
2680
0
            }
2681
2682
0
            if( !bDone )
2683
0
            {
2684
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
2685
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
2686
#ifndef UNX
2687
                                                              SdResId(STR_TWAIN_NO_SOURCE)
2688
#else
2689
0
                                                              SdResId(STR_TWAIN_NO_SOURCE_UNX)
2690
0
#endif
2691
0
                                                              ));
2692
0
                xInfoBox->run();
2693
2694
0
            }
2695
0
            else
2696
0
            {
2697
0
                SfxBindings& rBindings = GetViewFrame()->GetBindings();
2698
0
                rBindings.Invalidate( SID_TWAIN_SELECT );
2699
0
                rBindings.Invalidate( SID_TWAIN_TRANSFER );
2700
0
            }
2701
2702
0
            Cancel();
2703
0
            rReq.Done();
2704
0
        }
2705
0
        break;
2706
2707
0
        case SID_POLYGON_MORPHING:
2708
0
        {
2709
0
            SetCurrentFunction( FuMorph::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
2710
0
            Cancel();
2711
0
        }
2712
0
        break;
2713
2714
0
        case SID_INSERTLAYER:
2715
0
        {
2716
0
            if ( mpDrawView->IsTextEdit() )
2717
0
            {
2718
0
                mpDrawView->SdrEndTextEdit();
2719
0
            }
2720
2721
0
            SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
2722
0
            sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
2723
0
            sal_uInt16 nLayer = nLayerCnt - 2 + 1;
2724
0
            OUString aLayerName = SdResId(STR_LAYER) + OUString::number(nLayer);
2725
0
            OUString aLayerTitle, aLayerDesc;
2726
0
            bool bIsVisible = false;
2727
0
            bool bIsLocked = false;
2728
0
            bool bIsPrintable = false;
2729
2730
0
            const SfxItemSet* pArgs = rReq.GetArgs();
2731
2732
0
            if (! pArgs)
2733
0
            {
2734
0
                SfxItemSet aNewAttr(SfxItemSet::makeFixedSfxItemSet<ATTR_LAYER_START, ATTR_LAYER_END>( GetDoc()->GetPool() ));
2735
2736
0
                aNewAttr.Put( makeSdAttrLayerName( aLayerName ) );
2737
0
                aNewAttr.Put( makeSdAttrLayerTitle() );
2738
0
                aNewAttr.Put( makeSdAttrLayerDesc() );
2739
0
                aNewAttr.Put( makeSdAttrLayerVisible() );
2740
0
                aNewAttr.Put( makeSdAttrLayerPrintable() );
2741
0
                aNewAttr.Put( makeSdAttrLayerLocked() );
2742
0
                aNewAttr.Put( makeSdAttrLayerThisPage() );
2743
2744
0
                SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
2745
0
                vcl::Window* pWin = GetActiveWindow();
2746
0
                ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg( pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, true, SdResId(STR_INSERTLAYER)) );
2747
0
                pDlg->SetHelpId( SdModule::get()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() );
2748
2749
                // test for already existing names
2750
0
                bool bLoop = true;
2751
0
                while( bLoop && pDlg->Execute() == RET_OK )
2752
0
                {
2753
0
                    pDlg->GetAttr( aNewAttr );
2754
0
                    aLayerName   = aNewAttr.Get(ATTR_LAYER_NAME).GetValue ();
2755
2756
0
                    if( rLayerAdmin.GetLayer( aLayerName )
2757
0
                        || aLayerName.isEmpty()
2758
0
                        || LayerTabBar::IsLocalizedNameOfStandardLayer( aLayerName) )
2759
0
                    {
2760
                        // name already exists
2761
0
                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
2762
0
                                                                   VclMessageType::Warning, VclButtonsType::Ok,
2763
0
                                                                   SdResId(STR_WARN_NAME_DUPLICATE)));
2764
0
                        xWarn->run();
2765
0
                    }
2766
0
                    else
2767
0
                        bLoop = false;
2768
0
                }
2769
0
                if( bLoop ) // was canceled
2770
0
                {
2771
0
                    pDlg.disposeAndClear();
2772
0
                    Cancel();
2773
0
                    rReq.Ignore ();
2774
0
                    break;
2775
0
                }
2776
0
                else
2777
0
                {
2778
0
                    aLayerTitle  = aNewAttr.Get(ATTR_LAYER_TITLE).GetValue();
2779
0
                    aLayerDesc   = aNewAttr.Get(ATTR_LAYER_DESC).GetValue ();
2780
0
                    bIsVisible   = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
2781
0
                    bIsLocked    = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ;
2782
0
                    bIsPrintable = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ;
2783
0
                }
2784
0
            }
2785
0
            else if (pArgs->Count () != 4)
2786
0
            {
2787
#if HAVE_FEATURE_SCRIPTING
2788
                 StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
2789
#endif
2790
0
                 Cancel();
2791
0
                 rReq.Ignore ();
2792
0
                 break;
2793
0
            }
2794
0
            else
2795
0
            {
2796
0
                 const SfxStringItem* pLayerName = rReq.GetArg<SfxStringItem>(ID_VAL_LAYERNAME);
2797
0
                 const SfxBoolItem* pIsVisible = rReq.GetArg<SfxBoolItem>(ID_VAL_ISVISIBLE);
2798
0
                 const SfxBoolItem* pIsLocked = rReq.GetArg<SfxBoolItem>(ID_VAL_ISLOCKED);
2799
0
                 const SfxBoolItem* pIsPrintable = rReq.GetArg<SfxBoolItem>(ID_VAL_ISPRINTABLE);
2800
2801
0
                 aLayerName   = pLayerName->GetValue ();
2802
0
                 bIsVisible   = pIsVisible->GetValue ();
2803
0
                 bIsLocked    = pIsLocked->GetValue ();
2804
0
                 bIsPrintable = pIsPrintable->GetValue ();
2805
0
            }
2806
2807
0
            OUString aPrevLayer = mpDrawView->GetActiveLayer();
2808
0
            SdrLayer* pLayer;
2809
0
            sal_uInt16 nPrevLayer = 0;
2810
0
            nLayerCnt = rLayerAdmin.GetLayerCount();
2811
2812
0
            for ( nLayer = 0; nLayer < nLayerCnt; nLayer++ )
2813
0
            {
2814
0
                pLayer = rLayerAdmin.GetLayer(nLayer);
2815
0
                OUString aName = pLayer->GetName();
2816
2817
0
                if ( aPrevLayer == aName )
2818
0
                {
2819
0
                    nPrevLayer = std::max(nLayer, sal_uInt16(4));
2820
0
                }
2821
0
            }
2822
2823
0
            mpDrawView->InsertNewLayer(aLayerName, nPrevLayer + 1);
2824
0
            pLayer = rLayerAdmin.GetLayer(aLayerName);
2825
0
            if( pLayer )
2826
0
            {
2827
0
                pLayer->SetTitle( aLayerTitle );
2828
0
                pLayer->SetDescription( aLayerDesc );
2829
0
            }
2830
2831
0
            mpDrawView->SetLayerVisible( aLayerName, bIsVisible );
2832
0
            mpDrawView->SetLayerLocked( aLayerName, bIsLocked);
2833
0
            mpDrawView->SetLayerPrintable(aLayerName, bIsPrintable);
2834
2835
0
            mpDrawView->SetActiveLayer(aLayerName);
2836
2837
0
            ResetActualLayer();
2838
2839
0
            GetDoc()->SetChanged();
2840
2841
0
            GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER,
2842
0
                    SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
2843
2844
0
            Cancel();
2845
0
            rReq.Done ();
2846
0
        }
2847
0
        break;
2848
2849
0
        case SID_MODIFYLAYER:
2850
0
        {
2851
0
            if(!GetLayerTabControl()) // #i87182#
2852
0
            {
2853
0
                OSL_ENSURE(false, "No LayerTabBar (!)");
2854
0
                Cancel();
2855
0
                rReq.Ignore();
2856
0
                break;
2857
0
            }
2858
2859
0
            if ( mpDrawView->IsTextEdit() )
2860
0
            {
2861
0
                mpDrawView->SdrEndTextEdit();
2862
0
            }
2863
2864
0
            SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
2865
0
            sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId();
2866
0
            OUString aLayerName = GetLayerTabControl()->GetLayerName(nCurPage);
2867
0
            SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName);
2868
2869
0
            OUString aLayerTitle = pLayer->GetTitle();
2870
0
            OUString aLayerDesc = pLayer->GetDescription();
2871
2872
0
            OUString aOldLayerName(aLayerName);
2873
0
            OUString aOldLayerTitle(aLayerTitle);
2874
0
            OUString aOldLayerDesc(aLayerDesc);
2875
2876
0
            bool bIsVisible, bIsLocked, bIsPrintable;
2877
0
            bool bOldIsVisible = bIsVisible = mpDrawView->IsLayerVisible(aLayerName);
2878
0
            bool bOldIsLocked = bIsLocked = mpDrawView->IsLayerLocked(aLayerName);
2879
0
            bool bOldIsPrintable = bIsPrintable = mpDrawView->IsLayerPrintable(aLayerName);
2880
2881
0
            const SfxItemSet* pArgs = rReq.GetArgs();
2882
            // is it allowed to delete the layer?
2883
0
            bool bDelete = !( LayerTabBar::IsRealNameOfStandardLayer(aLayerName) );
2884
2885
0
            if (! pArgs)
2886
0
            {
2887
0
                SfxItemSet aNewAttr(SfxItemSet::makeFixedSfxItemSet<ATTR_LAYER_START, ATTR_LAYER_END>( GetDoc()->GetPool() ));
2888
2889
0
                aNewAttr.Put( makeSdAttrLayerName( aLayerName ) );
2890
0
                aNewAttr.Put( makeSdAttrLayerTitle( aLayerTitle ) );
2891
0
                aNewAttr.Put( makeSdAttrLayerDesc( aLayerDesc ) );
2892
0
                aNewAttr.Put( makeSdAttrLayerVisible( bIsVisible ) );
2893
0
                aNewAttr.Put( makeSdAttrLayerLocked( bIsLocked ) );
2894
0
                aNewAttr.Put( makeSdAttrLayerPrintable( bIsPrintable ) );
2895
0
                aNewAttr.Put( makeSdAttrLayerThisPage() );
2896
2897
0
                SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
2898
0
                vcl::Window* pWin = GetActiveWindow();
2899
0
                ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg( pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, bDelete, SdResId(STR_MODIFYLAYER)) );
2900
0
                pDlg->SetHelpId( SdModule::get()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() );
2901
2902
                // test for already existing names
2903
0
                bool    bLoop = true;
2904
0
                sal_uInt16  nRet = 0;
2905
0
                while( bLoop )
2906
0
                {
2907
0
                    nRet = pDlg->Execute();
2908
0
                    if (nRet != RET_OK)
2909
0
                        break;
2910
0
                    pDlg->GetAttr( aNewAttr );
2911
0
                    aLayerName   = aNewAttr.Get(ATTR_LAYER_NAME).GetValue ();
2912
0
                    if (bDelete)
2913
0
                    {
2914
0
                        if( (rLayerAdmin.GetLayer( aLayerName ) && aLayerName != aOldLayerName)
2915
0
                            || LayerTabBar::IsRealNameOfStandardLayer(aLayerName)
2916
0
                            || LayerTabBar::IsLocalizedNameOfStandardLayer(aLayerName)
2917
0
                            || aLayerName.isEmpty() )
2918
0
                        {
2919
                            // name already exists
2920
0
                            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
2921
0
                                                                   VclMessageType::Warning, VclButtonsType::Ok,
2922
0
                                                                   SdResId(STR_WARN_NAME_DUPLICATE)));
2923
0
                            xWarn->run();
2924
0
                        }
2925
0
                        else
2926
0
                            bLoop = false;
2927
0
                    }
2928
0
                    else
2929
0
                        bLoop = false; // altering name is already disabled in the dialog itself
2930
0
                }
2931
0
                switch (nRet)
2932
0
                {
2933
0
                    case RET_OK :
2934
0
                        aLayerTitle  = aNewAttr.Get(ATTR_LAYER_TITLE).GetValue ();
2935
0
                        aLayerDesc   = aNewAttr.Get(ATTR_LAYER_DESC).GetValue ();
2936
0
                        bIsVisible   = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue ();
2937
0
                        bIsLocked    = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue ();
2938
0
                        bIsPrintable = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue ();
2939
0
                        break;
2940
2941
0
                    default :
2942
0
                        pDlg.disposeAndClear();
2943
0
                        rReq.Ignore ();
2944
0
                        Cancel ();
2945
0
                        return;
2946
0
                }
2947
0
            }
2948
0
            else if (pArgs->Count () == 4)
2949
0
            {
2950
0
                const SfxStringItem* pLayerName = rReq.GetArg<SfxStringItem>(ID_VAL_LAYERNAME);
2951
0
                const SfxBoolItem* pIsVisible = rReq.GetArg<SfxBoolItem>(ID_VAL_ISVISIBLE);
2952
0
                const SfxBoolItem* pIsLocked = rReq.GetArg<SfxBoolItem>(ID_VAL_ISLOCKED);
2953
0
                const SfxBoolItem* pIsPrintable = rReq.GetArg<SfxBoolItem>(ID_VAL_ISPRINTABLE);
2954
2955
0
                aLayerName   = pLayerName->GetValue ();
2956
0
                bIsVisible   = pIsVisible->GetValue ();
2957
0
                bIsLocked    = pIsLocked->GetValue ();
2958
0
                bIsPrintable = pIsPrintable->GetValue ();
2959
0
            }
2960
0
            else
2961
0
            {
2962
#if HAVE_FEATURE_SCRIPTING
2963
                StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
2964
#endif
2965
0
                Cancel ();
2966
0
                rReq.Ignore ();
2967
0
                break;
2968
0
            }
2969
2970
0
            SfxUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
2971
0
            std::unique_ptr<SdLayerModifyUndoAction> pAction( new SdLayerModifyUndoAction(
2972
0
                *GetDoc(),
2973
0
                pLayer,
2974
                // old values
2975
0
                aOldLayerName,
2976
0
                aOldLayerTitle,
2977
0
                aOldLayerDesc,
2978
0
                bOldIsVisible,
2979
0
                bOldIsLocked,
2980
0
                bOldIsPrintable,
2981
                // new values
2982
0
                aLayerName,
2983
0
                aLayerTitle,
2984
0
                aLayerDesc,
2985
0
                bIsVisible,
2986
0
                bIsLocked,
2987
0
                bIsPrintable
2988
0
                ) );
2989
0
            pManager->AddUndoAction( std::move(pAction) );
2990
2991
0
            ModifyLayer( pLayer, aLayerName, aLayerTitle, aLayerDesc, bIsVisible, bIsLocked, bIsPrintable );
2992
2993
0
            Cancel();
2994
0
            rReq.Done ();
2995
0
        }
2996
0
        break;
2997
2998
0
        case SID_TOGGLELAYERVISIBILITY:
2999
0
        {
3000
            // tdf#113439; duplicates LayerTabBar::MouseButtonDown()
3001
0
            sal_uInt16 aTabId = GetLayerTabControl()->GetCurPageId();
3002
0
            OUString aName( GetLayerTabControl()->GetLayerName(aTabId) );
3003
3004
0
            SdrPageView* pPV = mpDrawView->GetSdrPageView();
3005
0
            bool bVisible = !pPV->IsLayerVisible(aName);
3006
3007
0
            pPV->SetLayerVisible(aName, bVisible);
3008
3009
0
            ResetActualLayer();
3010
0
            GetDoc()->SetChanged();
3011
3012
0
            Cancel();
3013
0
            rReq.Ignore ();
3014
0
        }
3015
0
        break;
3016
3017
0
        case SID_RENAMELAYER:
3018
0
        {
3019
0
            if ( mpDrawView->IsTextEdit() )
3020
0
            {
3021
0
                mpDrawView->SdrEndTextEdit();
3022
0
            }
3023
3024
0
            if(GetLayerTabControl()) // #i87182#
3025
0
            {
3026
0
                GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
3027
0
            }
3028
0
            else
3029
0
            {
3030
0
                OSL_ENSURE(false, "No LayerTabBar (!)");
3031
0
            }
3032
3033
0
            Cancel();
3034
0
            rReq.Ignore ();
3035
0
        }
3036
0
        break;
3037
3038
0
        case SID_EDIT_HYPERLINK :
3039
0
        {
3040
            // Ensure the field is selected first
3041
0
            OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
3042
0
            if (pOutView)
3043
0
                pOutView->SelectFieldAtCursor();
3044
3045
0
            GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
3046
3047
0
            Cancel();
3048
0
            rReq.Done ();
3049
0
        }
3050
0
        break;
3051
3052
0
        case SID_INSERT_HYPERLINK :
3053
0
        {
3054
0
            GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
3055
3056
0
            Cancel();
3057
0
            rReq.Done ();
3058
0
        }
3059
0
        break;
3060
3061
0
        case SID_OPEN_HYPERLINK:
3062
0
        {
3063
0
            OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
3064
0
            if ( pOutView )
3065
0
            {
3066
0
                const SvxFieldItem* pFieldItem
3067
0
                    = pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
3068
0
                const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr;
3069
0
                if( auto pURLField = dynamic_cast< const SvxURLField *>( pField ) )
3070
0
                {
3071
0
                    SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() );
3072
0
                    SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() );
3073
3074
0
                    OUString aReferName;
3075
0
                    SfxViewFrame* pFrame = GetViewFrame();
3076
0
                    SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium();
3077
0
                    if (pMed)
3078
0
                        aReferName = pMed->GetName();
3079
3080
0
                    SfxFrameItem aFrm( SID_DOCFRAME, pFrame );
3081
0
                    SfxStringItem aReferer( SID_REFERER, aReferName );
3082
3083
0
                    SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false );
3084
0
                    SfxBoolItem aBrowsing( SID_BROWSE, true );
3085
3086
0
                    if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
3087
0
                    {
3088
0
                        pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC,
3089
0
                            SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
3090
0
                            { &aUrl, &aTarget, &aFrm, &aReferer,
3091
0
                                &aNewView, &aBrowsing });
3092
0
                    }
3093
0
                }
3094
0
            }
3095
0
            Cancel();
3096
0
            rReq.Done ();
3097
0
        }
3098
0
        break;
3099
3100
0
        case SID_COPY_HYPERLINK_LOCATION:
3101
0
        {
3102
0
            OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView();
3103
0
            if ( pOutView )
3104
0
            {
3105
0
                const SvxFieldItem* pFieldItem
3106
0
                    = pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
3107
0
                const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr;
3108
0
                if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
3109
0
                {
3110
0
                    uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
3111
0
                        = pOutView->GetWindow()->GetClipboard();
3112
3113
0
                    vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, SfxViewShell::Current());
3114
0
                }
3115
0
            }
3116
3117
0
            Cancel();
3118
0
            rReq.Done ();
3119
0
        }
3120
0
        break;
3121
3122
0
        case SID_HYPERLINK_SETLINK:
3123
0
        {
3124
0
            const SfxItemSet* pReqArgs = rReq.GetArgs();
3125
3126
0
            if (pReqArgs)
3127
0
            {
3128
0
                const SvxHyperlinkItem* pHLItem =
3129
0
                    &pReqArgs->Get(SID_HYPERLINK_SETLINK);
3130
3131
0
                if (pHLItem->GetInsertMode() == HLINK_FIELD)
3132
0
                {
3133
0
                    InsertURLField(pHLItem->GetURL(), pHLItem->GetName(),
3134
0
                                   pHLItem->GetTargetFrame(), pHLItem->GetIntName());
3135
0
                }
3136
0
                else if (pHLItem->GetInsertMode() == HLINK_BUTTON)
3137
0
                {
3138
0
                    InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
3139
0
                                    pHLItem->GetTargetFrame(), nullptr);
3140
0
                }
3141
0
                else if (pHLItem->GetInsertMode() == HLINK_DEFAULT)
3142
0
                {
3143
0
                    OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
3144
                    // When the provided text is just a hint, prefer the selection over it; if both
3145
                    // are missing, use the URL.
3146
0
                    OUString sLinkText;
3147
0
                    if (pHLItem->GetTextIsHint() && pOlView && pOlView->HasSelection())
3148
0
                        sLinkText = pOlView->GetSelected();
3149
0
                    else if (!pHLItem->GetName().isEmpty())
3150
0
                        sLinkText = pHLItem->GetName();
3151
0
                    else
3152
0
                        sLinkText = pHLItem->GetURL();
3153
3154
0
                    if (pOlView || comphelper::LibreOfficeKit::isActive())
3155
0
                    {
3156
0
                        InsertURLField(pHLItem->GetURL(), sLinkText,
3157
0
                                       pHLItem->GetTargetFrame(), pHLItem->GetIntName());
3158
0
                    }
3159
0
                    else
3160
0
                    {
3161
0
                        InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(),
3162
0
                                        pHLItem->GetTargetFrame(), nullptr);
3163
0
                    }
3164
0
                }
3165
0
            }
3166
3167
0
            Cancel();
3168
0
            rReq.Ignore ();
3169
0
        }
3170
0
        break;
3171
3172
0
        case SID_HIDE_LAST_LEVEL:
3173
0
        {
3174
0
            ESelection aSel;
3175
            // fdo#78151 editing a PresObjKind::Outline in a master page ?
3176
0
            ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
3177
0
            if (pOL)
3178
0
            {
3179
                //we are on the last paragraph
3180
0
                aSel.Adjust();
3181
0
                if (aSel.end.nPara == pOL->GetParagraphCount() - 1)
3182
0
                {
3183
0
                    sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara);
3184
                    //there exists a previous numbering level
3185
0
                    if (nDepth != sal_uInt16(-1) && nDepth > 0)
3186
0
                    {
3187
0
                        Paragraph* pPara = pOL->GetParagraph(aSel.end.nPara);
3188
0
                        pOL->Remove(pPara, 1);
3189
0
                    }
3190
0
                }
3191
0
            }
3192
0
            Cancel();
3193
0
            rReq.Done ();
3194
0
        }
3195
0
        break;
3196
3197
0
        case SID_SHOW_NEXT_LEVEL:
3198
0
        {
3199
0
            const TranslateId STR_PRESOBJ_MPOUTLINE_ARY[]
3200
0
            {
3201
0
                STR_PRESOBJ_MPOUTLINE,
3202
0
                STR_PRESOBJ_MPOUTLLAYER2,
3203
0
                STR_PRESOBJ_MPOUTLLAYER3,
3204
0
                STR_PRESOBJ_MPOUTLLAYER4,
3205
0
                STR_PRESOBJ_MPOUTLLAYER5,
3206
0
                STR_PRESOBJ_MPOUTLLAYER6,
3207
0
                STR_PRESOBJ_MPOUTLLAYER7,
3208
0
                STR_PRESOBJ_MPNOTESTITLE,
3209
0
                STR_PRESOBJ_MPNOTESTEXT,
3210
0
                STR_PRESOBJ_NOTESTEXT
3211
0
            };
3212
3213
0
            ESelection aSel;
3214
            // fdo#78151 editing a PresObjKind::Outline in a master page ?
3215
0
            ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
3216
0
            if (pOL)
3217
0
            {
3218
                //we are on the last paragraph
3219
0
                aSel.Adjust();
3220
0
                if (aSel.end.nPara == pOL->GetParagraphCount() - 1)
3221
0
                {
3222
0
                    sal_uInt16 nDepth = pOL->GetDepth(aSel.end.nPara);
3223
                    //there exists a previous numbering level
3224
0
                    if (nDepth < 8)
3225
0
                    {
3226
0
                        sal_uInt16 nNewDepth = nDepth+1;
3227
0
                        pOL->Insert(SdResId(STR_PRESOBJ_MPOUTLINE_ARY[nNewDepth]), EE_PARA_MAX, nNewDepth);
3228
0
                    }
3229
0
                }
3230
0
            }
3231
0
            Cancel();
3232
0
            rReq.Done ();
3233
0
        }
3234
0
        break;
3235
3236
0
        case SID_INSERT_FLD_DATE_FIX:
3237
0
        case SID_INSERT_FLD_DATE_VAR:
3238
0
        case SID_INSERT_FLD_TIME_FIX:
3239
0
        case SID_INSERT_FLD_TIME_VAR:
3240
0
        case SID_INSERT_FLD_AUTHOR:
3241
0
        case SID_INSERT_FLD_PAGE:
3242
0
        case SID_INSERT_FLD_PAGE_TITLE:
3243
0
        case SID_INSERT_FLD_PAGES:
3244
0
        case SID_INSERT_FLD_FILE:
3245
0
        {
3246
0
            sal_uInt16 nMul = 1;
3247
0
            std::unique_ptr<SvxFieldItem> pFieldItem;
3248
3249
0
            switch( nSId )
3250
0
            {
3251
0
                case SID_INSERT_FLD_DATE_FIX:
3252
0
                    pFieldItem.reset(new SvxFieldItem(
3253
0
                        SvxDateField( Date( Date::SYSTEM ), SvxDateType::Fix ), EE_FEATURE_FIELD ));
3254
0
                break;
3255
3256
0
                case SID_INSERT_FLD_DATE_VAR:
3257
0
                    pFieldItem.reset(new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD ));
3258
0
                break;
3259
3260
0
                case SID_INSERT_FLD_TIME_FIX:
3261
0
                    pFieldItem.reset(new SvxFieldItem(
3262
0
                        SvxExtTimeField( ::tools::Time( ::tools::Time::SYSTEM ), SvxTimeType::Fix ), EE_FEATURE_FIELD ));
3263
0
                break;
3264
3265
0
                case SID_INSERT_FLD_TIME_VAR:
3266
0
                    pFieldItem.reset(new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD ));
3267
0
                break;
3268
3269
0
                case SID_INSERT_FLD_AUTHOR:
3270
0
                {
3271
0
                    SvtUserOptions aUserOptions;
3272
0
                    pFieldItem.reset(new SvxFieldItem(
3273
0
                            SvxAuthorField(
3274
0
                                aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() ), EE_FEATURE_FIELD ));
3275
0
                }
3276
0
                break;
3277
3278
0
                case SID_INSERT_FLD_PAGE:
3279
0
                {
3280
0
                    pFieldItem.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ));
3281
0
                    nMul = 3;
3282
0
                }
3283
0
                break;
3284
3285
0
                case SID_INSERT_FLD_PAGE_TITLE:
3286
0
                {
3287
0
                    pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
3288
0
                    nMul = 3;
3289
0
                }
3290
0
                break;
3291
3292
0
                case SID_INSERT_FLD_PAGES:
3293
0
                {
3294
0
                    pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
3295
0
                    nMul = 3;
3296
0
                }
3297
0
                break;
3298
3299
0
                case SID_INSERT_FLD_FILE:
3300
0
                {
3301
0
                    OUString aName;
3302
0
                    if( GetDocSh()->HasName() )
3303
0
                        aName = GetDocSh()->GetMedium()->GetName();
3304
0
                    pFieldItem.reset(new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD ));
3305
0
                }
3306
0
                break;
3307
0
            }
3308
3309
0
            OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
3310
3311
0
            if( pOLV )
3312
0
            {
3313
0
                const SvxFieldItem* pOldFldItem = pOLV->GetFieldAtSelection();
3314
3315
0
                if( pOldFldItem && ( nullptr != dynamic_cast< const SvxURLField *>( pOldFldItem->GetField() ) ||
3316
0
                                    nullptr != dynamic_cast< const SvxDateField *>( pOldFldItem->GetField() ) ||
3317
0
                                    nullptr != dynamic_cast< const SvxTimeField *>( pOldFldItem->GetField() ) ||
3318
0
                                    nullptr != dynamic_cast< const SvxExtTimeField *>( pOldFldItem->GetField() ) ||
3319
0
                                    nullptr != dynamic_cast< const SvxExtFileField *>( pOldFldItem->GetField() ) ||
3320
0
                                    nullptr != dynamic_cast< const SvxAuthorField *>( pOldFldItem->GetField() ) ||
3321
0
                                    nullptr != dynamic_cast< const SvxPageField *>( pOldFldItem->GetField() ) ) )
3322
0
                {
3323
                    // select field, then it will be deleted when inserting
3324
0
                    ESelection aSel = pOLV->GetSelection();
3325
0
                    if (aSel.start.nIndex == aSel.end.nIndex)
3326
0
                        aSel.end.nIndex++;
3327
0
                    pOLV->SetSelection( aSel );
3328
0
                }
3329
3330
0
                if( pFieldItem )
3331
0
                    pOLV->InsertField( *pFieldItem );
3332
0
            }
3333
0
            else
3334
0
            {
3335
0
                Outliner* pOutl = GetDoc()->GetInternalOutliner();
3336
0
                pOutl->Init( OutlinerMode::TextObject );
3337
0
                OutlinerMode nOutlMode = pOutl->GetOutlinerMode();
3338
0
                pOutl->SetStyleSheet( 0, nullptr );
3339
0
                pOutl->QuickInsertField( *pFieldItem, ESelection() );
3340
0
                std::optional<OutlinerParaObject> pOutlParaObject = pOutl->CreateParaObject();
3341
3342
0
                rtl::Reference<SdrRectObj> pRectObj = new SdrRectObj(
3343
0
                    *GetDoc(), ::tools::Rectangle(), SdrObjKind::Text);
3344
0
                pRectObj->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
3345
3346
0
                pOutl->UpdateFields();
3347
0
                pOutl->SetUpdateLayout( true );
3348
0
                Size aSize( pOutl->CalcTextSize() );
3349
0
                aSize.setWidth( aSize.Width() * nMul );
3350
0
                pOutl->SetUpdateLayout( false );
3351
3352
0
                Point aPos;
3353
0
                ::tools::Rectangle aRect( aPos, GetActiveWindow()->GetOutputSizePixel() );
3354
0
                aPos = aRect.Center();
3355
0
                aPos = GetActiveWindow()->PixelToLogic(aPos);
3356
0
                aPos.AdjustX( -(aSize.Width() / 2) );
3357
0
                aPos.AdjustY( -(aSize.Height() / 2) );
3358
3359
0
                ::tools::Rectangle aLogicRect(aPos, aSize);
3360
0
                pRectObj->SetLogicRect(aLogicRect);
3361
0
                pRectObj->SetOutlinerParaObject( std::move(pOutlParaObject) );
3362
0
                mpDrawView->InsertObjectAtView(pRectObj.get(), *mpDrawView->GetSdrPageView());
3363
0
                pOutl->Init( nOutlMode );
3364
0
            }
3365
3366
0
            pFieldItem.reset();
3367
3368
0
            Cancel();
3369
0
            rReq.Ignore ();
3370
0
        }
3371
0
        break;
3372
3373
0
        case SID_MODIFY_FIELD:
3374
0
        {
3375
0
            OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
3376
3377
0
            if( pOLV )
3378
0
            {
3379
0
                const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection();
3380
3381
0
                if( pFldItem && (nullptr != dynamic_cast< const SvxDateField *>( pFldItem->GetField() ) ||
3382
0
                                 nullptr != dynamic_cast< const SvxAuthorField *>( pFldItem->GetField() ) ||
3383
0
                                 nullptr != dynamic_cast< const SvxExtFileField *>( pFldItem->GetField() ) ||
3384
0
                                 nullptr != dynamic_cast< const SvxExtTimeField *>( pFldItem->GetField() ) ) )
3385
0
                {
3386
                    // Dialog...
3387
0
                    SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
3388
0
                    vcl::Window* pWin = GetActiveWindow();
3389
0
                    ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg( pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOLV->GetAttribs() ) );
3390
0
                    if( pDlg->Execute() == RET_OK )
3391
0
                    {
3392
                        // To make a correct SetAttribs() call at the utlinerView
3393
                        // it is necessary to split the actions here
3394
0
                        std::unique_ptr<SvxFieldData> pField(pDlg->GetField());
3395
0
                        ESelection aSel = pOLV->GetSelection();
3396
0
                        bool bSelectionWasModified(false);
3397
3398
0
                        if( pField )
3399
0
                        {
3400
0
                            SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
3401
3402
0
                            if (aSel.start.nIndex == aSel.end.nIndex)
3403
0
                            {
3404
0
                                bSelectionWasModified = true;
3405
0
                                aSel.end.nIndex++;
3406
0
                                pOLV->SetSelection( aSel );
3407
0
                            }
3408
3409
0
                            pOLV->InsertField( aFieldItem );
3410
3411
                            // select again for eventual SetAttribs call
3412
0
                            pOLV->SetSelection( aSel );
3413
0
                        }
3414
3415
0
                        SfxItemSet aSet( pDlg->GetItemSet() );
3416
3417
0
                        if( aSet.Count() )
3418
0
                        {
3419
0
                            pOLV->SetAttribs( aSet );
3420
3421
0
                            ::Outliner& rOutliner = pOLV->GetOutliner();
3422
0
                            rOutliner.UpdateFields();
3423
0
                        }
3424
3425
0
                        if(pField)
3426
0
                        {
3427
                            // restore selection to original
3428
0
                            if(bSelectionWasModified)
3429
0
                            {
3430
0
                                aSel.end.nIndex--;
3431
0
                                pOLV->SetSelection( aSel );
3432
0
                            }
3433
0
                        }
3434
0
                    }
3435
0
                }
3436
0
            }
3437
3438
0
            Cancel();
3439
0
            rReq.Ignore ();
3440
0
        }
3441
0
        break;
3442
3443
0
        case SID_OPEN_XML_FILTERSETTINGS:
3444
0
        {
3445
0
            try
3446
0
            {
3447
0
                css::uno::Reference < css::ui::dialogs::XExecutableDialog > xDialog = css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
3448
0
                xDialog->execute();
3449
0
            }
3450
0
            catch( css::uno::RuntimeException& )
3451
0
            {
3452
0
                DBG_UNHANDLED_EXCEPTION("sd.view");
3453
0
            }
3454
3455
0
            Cancel();
3456
0
            rReq.Ignore ();
3457
0
        }
3458
0
        break;
3459
3460
0
        case SID_GROUP:  // BASIC
3461
0
        {
3462
0
            if ( mpDrawView->IsPresObjSelected( true, true, true ) )
3463
0
            {
3464
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3465
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3466
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3467
0
                xInfoBox->run();
3468
0
            }
3469
0
            else
3470
0
            {
3471
0
                mpDrawView->GroupMarked();
3472
0
            }
3473
0
            Cancel();
3474
0
            rReq.Done ();
3475
0
        }
3476
0
        break;
3477
3478
0
        case SID_UNGROUP:  // BASIC
3479
0
        {
3480
0
            mpDrawView->UnGroupMarked();
3481
0
            Cancel();
3482
0
            rReq.Done ();
3483
0
        }
3484
0
        break;
3485
3486
0
        case SID_NAME_GROUP:
3487
0
        {
3488
            // only allow for single object selection since the name of an object needs
3489
            // to be unique
3490
0
            if(1 == rMarkList.GetMarkCount())
3491
0
            {
3492
                // #i68101#
3493
0
                rtl::Reference<SdrObject> pSelected = rMarkList.GetMark(0)->GetMarkedSdrObj();
3494
0
                OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
3495
0
                OUString aName(pSelected->GetName());
3496
3497
0
                SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
3498
0
                VclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(GetFrameWeld(), aName));
3499
3500
0
                pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl));
3501
3502
0
                pDlg->StartExecuteAsync(
3503
0
                    [this, pDlg, pSelected] (sal_Int32 nResult)->void
3504
0
                    {
3505
0
                        if (nResult == RET_OK)
3506
0
                        {
3507
0
                            pSelected->SetName(pDlg->GetName());
3508
3509
0
                            SdPage* pPage = GetActualPage();
3510
0
                            if (pPage)
3511
0
                                pPage->notifyObjectRenamed(pSelected.get());
3512
0
                        }
3513
0
                        pDlg->disposeOnce();
3514
0
                        SfxBindings& rBindings = GetViewFrame()->GetBindings();
3515
0
                        rBindings.Invalidate( SID_NAVIGATOR_STATE, true );
3516
0
                        rBindings.Invalidate( SID_CONTEXT );
3517
0
                    }
3518
0
                );
3519
0
            }
3520
3521
0
            Cancel();
3522
0
            rReq.Ignore();
3523
0
            break;
3524
0
        }
3525
3526
        // #i68101#
3527
0
        case SID_OBJECT_TITLE_DESCRIPTION:
3528
0
        {
3529
0
            if(1 == rMarkList.GetMarkCount())
3530
0
            {
3531
0
                rtl::Reference<SdrObject> pSelected = rMarkList.GetMark(0)->GetMarkedSdrObj();
3532
0
                OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
3533
0
                OUString aTitle(pSelected->GetTitle());
3534
0
                OUString aDescription(pSelected->GetDescription());
3535
0
                bool isDecorative(pSelected->IsDecorative());
3536
3537
0
                SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
3538
0
                VclPtr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog(
3539
0
                            GetFrameWeld(), aTitle, aDescription, isDecorative));
3540
3541
0
                pDlg->StartExecuteAsync(
3542
0
                    [this, pDlg, pSelected] (sal_Int32 nResult)->void
3543
0
                    {
3544
0
                        if (nResult == RET_OK)
3545
0
                        {
3546
0
                            pSelected->SetTitle(pDlg->GetTitle());
3547
0
                            pSelected->SetDescription(pDlg->GetDescription());
3548
0
                            pSelected->SetDecorative(pDlg->IsDecorative());
3549
0
                        }
3550
0
                        pDlg->disposeOnce();
3551
0
                        SfxBindings& rBindings = GetViewFrame()->GetBindings();
3552
0
                        rBindings.Invalidate( SID_NAVIGATOR_STATE, true );
3553
0
                        rBindings.Invalidate( SID_CONTEXT );
3554
0
                    }
3555
0
                );
3556
0
            }
3557
3558
0
            Cancel();
3559
0
            rReq.Ignore();
3560
0
            break;
3561
0
        }
3562
3563
0
        case SID_SETLAYER:
3564
0
        {
3565
0
            const size_t nMarkCount = rMarkList.GetMarkCount();
3566
0
            if (nMarkCount >= 1 && mpLayerTabBar)
3567
0
            {
3568
0
                SdSelectLayerDlg aDlg(GetFrameWeld());
3569
3570
0
                weld::TreeView& rTreeView = aDlg.GetTreeView();
3571
0
                auto nPageCount = mpLayerTabBar->GetPageCount();
3572
0
                for (auto i = 0; i < nPageCount; i++)
3573
0
                    rTreeView.append_text(LayerTabBar::convertToLocalizedName(
3574
0
                                        mpLayerTabBar->GetLayerName(mpLayerTabBar->GetPageId(i))));
3575
0
                rTreeView.select(0);
3576
3577
0
                if (aDlg.run() == RET_OK && rTreeView.get_selected_index() != -1)
3578
0
                {
3579
0
                    SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
3580
0
                    SdrLayerID aSdrLayerId = rLayerAdmin.GetLayerID(mpLayerTabBar->GetLayerName(
3581
0
                                        mpLayerTabBar->GetPageId(rTreeView.get_selected_index())));
3582
0
                    for (size_t i = 0; i < nMarkCount; ++i)
3583
0
                    {
3584
0
                        SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
3585
0
                        pObj->SetLayer(aSdrLayerId);
3586
0
                    }
3587
0
                }
3588
0
            }
3589
0
            Cancel();
3590
0
            rReq.Ignore();
3591
0
            break;
3592
0
        }
3593
3594
0
        case SID_ENTER_GROUP:  // BASIC
3595
0
        {
3596
0
            mpDrawView->EnterMarkedGroup();
3597
0
            Cancel();
3598
0
            rReq.Done ();
3599
0
        }
3600
0
        break;
3601
3602
0
        case SID_LEAVE_GROUP:  // BASIC
3603
0
        {
3604
0
            mpDrawView->LeaveOneGroup();
3605
0
            Cancel();
3606
0
            rReq.Done ();
3607
0
        }
3608
0
        break;
3609
3610
0
        case SID_LEAVE_ALL_GROUPS:  // BASIC
3611
0
        {
3612
0
            mpDrawView->LeaveAllGroup();
3613
0
            Cancel();
3614
0
            rReq.Done ();
3615
0
        }
3616
0
        break;
3617
3618
0
        case SID_TEXT_COMBINE:  // BASIC
3619
0
        {
3620
            // End text edit to avoid conflicts
3621
0
            if(mpDrawView->IsTextEdit())
3622
0
                mpDrawView->SdrEndTextEdit();
3623
3624
0
            if ( mpDrawView->IsPresObjSelected() )
3625
0
            {
3626
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3627
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3628
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3629
0
                xInfoBox->run();
3630
0
            }
3631
0
            else
3632
0
            {
3633
0
                weld::WaitObject aWait(GetFrameWeld());
3634
0
                mpDrawView->CombineMarkedTextObjects();
3635
0
            }
3636
0
            Cancel();
3637
0
            rReq.Done ();
3638
0
        }
3639
0
        break;
3640
3641
0
        case SID_COMBINE:  // BASIC
3642
0
        {
3643
            // End text edit to avoid conflicts
3644
0
            if(mpDrawView->IsTextEdit())
3645
0
                mpDrawView->SdrEndTextEdit();
3646
3647
0
            if ( mpDrawView->IsPresObjSelected() )
3648
0
            {
3649
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3650
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3651
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3652
0
                xInfoBox->run();
3653
0
            }
3654
0
            else
3655
0
            {
3656
0
                weld::WaitObject aWait(GetFrameWeld());
3657
0
                mpDrawView->CombineMarkedObjects(false);
3658
0
            }
3659
0
            Cancel();
3660
0
            rReq.Done ();
3661
0
        }
3662
0
        break;
3663
3664
0
        case SID_DISTRIBUTE_HLEFT:
3665
0
        case SID_DISTRIBUTE_HCENTER:
3666
0
        case SID_DISTRIBUTE_HDISTANCE:
3667
0
        case SID_DISTRIBUTE_HRIGHT:
3668
0
        case SID_DISTRIBUTE_VTOP:
3669
0
        case SID_DISTRIBUTE_VCENTER:
3670
0
        case SID_DISTRIBUTE_VDISTANCE:
3671
0
        case SID_DISTRIBUTE_VBOTTOM:
3672
0
        {
3673
0
            if ( mpDrawView->IsPresObjSelected() )
3674
0
            {
3675
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3676
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3677
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3678
0
                xInfoBox->run();
3679
0
            }
3680
0
            else
3681
0
            {
3682
0
                mpDrawView->DistributeMarkedObjects(nSId);
3683
0
            }
3684
0
            Cancel();
3685
0
            rReq.Done ();
3686
0
        }
3687
0
        break;
3688
0
        case SID_POLY_MERGE:
3689
0
        {
3690
            // End text edit to avoid conflicts
3691
0
            if(mpDrawView->IsTextEdit())
3692
0
                mpDrawView->SdrEndTextEdit();
3693
3694
0
            if ( mpDrawView->IsPresObjSelected() )
3695
0
            {
3696
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3697
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3698
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3699
0
                xInfoBox->run();
3700
0
            }
3701
0
            else
3702
0
            {
3703
0
                weld::WaitObject aWait(GetFrameWeld());
3704
0
                mpDrawView->MergeMarkedObjects(SdrMergeMode::Merge);
3705
0
            }
3706
0
            Cancel();
3707
0
            rReq.Done ();
3708
0
        }
3709
0
        break;
3710
3711
0
        case SID_POLY_SUBSTRACT:
3712
0
        {
3713
            // End text edit to avoid conflicts
3714
0
            if(mpDrawView->IsTextEdit())
3715
0
                mpDrawView->SdrEndTextEdit();
3716
3717
0
            if ( mpDrawView->IsPresObjSelected() )
3718
0
            {
3719
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3720
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3721
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3722
0
                xInfoBox->run();
3723
0
            }
3724
0
            else
3725
0
            {
3726
0
                weld::WaitObject aWait(GetFrameWeld());
3727
0
                mpDrawView->MergeMarkedObjects(SdrMergeMode::Subtract);
3728
0
            }
3729
0
            Cancel();
3730
0
            rReq.Done ();
3731
0
        }
3732
0
        break;
3733
3734
0
        case SID_POLY_INTERSECT:
3735
0
        {
3736
            // End text edit to avoid conflicts
3737
0
            if(mpDrawView->IsTextEdit())
3738
0
                mpDrawView->SdrEndTextEdit();
3739
3740
0
            if ( mpDrawView->IsPresObjSelected() )
3741
0
            {
3742
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3743
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3744
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3745
0
                xInfoBox->run();
3746
0
            }
3747
0
            else
3748
0
            {
3749
0
                weld::WaitObject aWait(GetFrameWeld());
3750
0
                mpDrawView->MergeMarkedObjects(SdrMergeMode::Intersect);
3751
0
            }
3752
0
            Cancel();
3753
0
            rReq.Done ();
3754
0
        }
3755
0
        break;
3756
3757
0
        case SID_EQUALIZEWIDTH:
3758
0
        case SID_EQUALIZEHEIGHT:
3759
0
        {
3760
            // End text edit to avoid conflicts
3761
0
            if(mpDrawView->IsTextEdit())
3762
0
                mpDrawView->SdrEndTextEdit();
3763
3764
0
            mpDrawView->EqualizeMarkedObjects(nSId == SID_EQUALIZEWIDTH);
3765
0
            Cancel();
3766
0
            rReq.Done ();
3767
0
        }
3768
0
        break;
3769
3770
0
        case SID_DISMANTLE:  // BASIC
3771
0
        {
3772
0
            if ( mpDrawView->IsDismantlePossible() )
3773
0
            {
3774
0
                weld::WaitObject aWait(GetFrameWeld());
3775
0
                mpDrawView->DismantleMarkedObjects();
3776
0
            }
3777
0
            Cancel();
3778
0
            rReq.Done ();
3779
0
        }
3780
0
        break;
3781
3782
0
        case SID_CONNECT:  // BASIC
3783
0
        {
3784
0
            if ( mpDrawView->IsPresObjSelected() )
3785
0
            {
3786
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3787
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3788
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3789
0
                xInfoBox->run();
3790
0
            }
3791
0
            else
3792
0
            {
3793
0
                weld::WaitObject aWait(GetFrameWeld());
3794
0
                mpDrawView->CombineMarkedObjects();
3795
0
            }
3796
0
            Cancel();
3797
0
            rReq.Done ();
3798
0
        }
3799
0
        break;
3800
3801
0
        case SID_BREAK:  // BASIC
3802
0
        {
3803
0
            if ( mpDrawView->IsTextEdit() )
3804
0
            {
3805
0
                mpDrawView->SdrEndTextEdit();
3806
0
            }
3807
3808
0
            if ( mpDrawView->IsBreak3DObjPossible() )
3809
0
            {
3810
0
                weld::WaitObject aWait(GetFrameWeld());
3811
0
                mpDrawView->Break3DObj();
3812
0
            }
3813
0
            else if ( mpDrawView->IsDismantlePossible(true) )
3814
0
            {
3815
0
                weld::WaitObject aWait(GetFrameWeld());
3816
0
                mpDrawView->DismantleMarkedObjects(true);
3817
0
            }
3818
0
            else if ( mpDrawView->IsImportMtfPossible() )
3819
0
            {
3820
0
                weld::WaitObject aWait(GetFrameWeld());
3821
0
                const size_t nCnt=rMarkList.GetMarkCount();
3822
3823
                // determine the sum of meta objects of all selected meta files
3824
0
                sal_uLong nCount = 0;
3825
0
                for(size_t nm=0; nm<nCnt; ++nm)
3826
0
                {
3827
0
                    SdrMark*     pM=rMarkList.GetMark(nm);
3828
0
                    SdrObject*   pObj=pM->GetMarkedSdrObj();
3829
0
                    SdrGrafObj*  pGraf= dynamic_cast< SdrGrafObj *>( pObj );
3830
0
                    SdrOle2Obj*  pOle2= dynamic_cast< SdrOle2Obj *>( pObj );
3831
3832
0
                    if (pGraf != nullptr)
3833
0
                    {
3834
0
                        if (pGraf->HasGDIMetaFile())
3835
0
                        {
3836
0
                            nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionSize();
3837
0
                        }
3838
0
                        else if (pGraf->isEmbeddedVectorGraphicData())
3839
0
                        {
3840
0
                            nCount += pGraf->getMetafileFromEmbeddedVectorGraphicData().GetActionSize();
3841
0
                        }
3842
0
                    }
3843
3844
0
                    if (pOle2)
3845
0
                        if (const Graphic* pGraphic = pOle2->GetGraphic())
3846
0
                            nCount += pGraphic->GetGDIMetaFile().GetActionSize();
3847
0
                }
3848
3849
                // decide with the sum of all meta objects if we should show a dialog
3850
0
                if(nCount < MIN_ACTIONS_FOR_DIALOG)
3851
0
                {
3852
                    // nope, no dialog
3853
0
                    mpDrawView->DoImportMarkedMtf();
3854
0
                }
3855
0
                else
3856
0
                {
3857
0
                    SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
3858
0
                    ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateBreakDlg(GetFrameWeld(), mpDrawView.get(), GetDocSh(), nCount, static_cast<sal_uLong>(nCnt) ));
3859
0
                    pDlg->Execute();
3860
0
                }
3861
0
            }
3862
3863
0
            Cancel();
3864
0
            rReq.Done ();
3865
0
        }
3866
0
        break;
3867
3868
0
        case SID_CONVERT_TO_3D:
3869
0
        {
3870
0
            if ( mpDrawView->IsPresObjSelected() )
3871
0
            {
3872
0
                std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
3873
0
                                                              VclMessageType::Info, VclButtonsType::Ok,
3874
0
                                                              SdResId(STR_ACTION_NOTPOSSIBLE)));
3875
0
                xInfoBox->run();
3876
0
            }
3877
0
            else
3878
0
            {
3879
0
                if (mpDrawView->IsConvertTo3DObjPossible())
3880
0
                {
3881
0
                    if (mpDrawView->IsTextEdit())
3882
0
                    {
3883
0
                        mpDrawView->SdrEndTextEdit();
3884
0
                    }
3885
3886
0
                    weld::WaitObject aWait(GetFrameWeld());
3887
0
                    mpDrawView->ConvertMarkedObjTo3D();
3888
0
                }
3889
0
            }
3890
3891
0
            Cancel();
3892
0
            rReq.Done();
3893
0
        }
3894
0
        break;
3895
3896
0
        case SID_FRAME_TO_TOP:  // BASIC
3897
0
        {
3898
0
            mpDrawView->PutMarkedToTop();
3899
0
            Cancel();
3900
0
            rReq.Done ();
3901
0
        }
3902
0
        break;
3903
3904
0
        case SID_MOREFRONT:  // BASIC
3905
0
        case SID_FRAME_UP:  // BASIC
3906
0
        {
3907
0
            mpDrawView->MovMarkedToTop();
3908
0
            Cancel();
3909
0
            rReq.Done ();
3910
0
        }
3911
0
        break;
3912
3913
0
        case SID_MOREBACK:  // BASIC
3914
0
        case SID_FRAME_DOWN:  // BASIC
3915
0
        {
3916
0
            mpDrawView->MovMarkedToBtm();
3917
0
            Cancel();
3918
0
            rReq.Done ();
3919
0
        }
3920
0
        break;
3921
3922
0
        case SID_FRAME_TO_BOTTOM:   // BASIC
3923
0
        {
3924
0
            mpDrawView->PutMarkedToBtm();
3925
0
            Cancel();
3926
0
            rReq.Done ();
3927
0
        }
3928
0
        break;
3929
3930
0
        case SID_HORIZONTAL:  // BASIC
3931
0
        case SID_FLIP_HORIZONTAL:
3932
0
        {
3933
0
            mpDrawView->MirrorAllMarkedHorizontal();
3934
0
            Cancel();
3935
0
            rReq.Done ();
3936
0
        }
3937
0
        break;
3938
3939
0
        case SID_VERTICAL:  // BASIC
3940
0
        case SID_FLIP_VERTICAL:
3941
0
        {
3942
0
            mpDrawView->MirrorAllMarkedVertical();
3943
0
            Cancel();
3944
0
            rReq.Done ();
3945
0
        }
3946
0
        break;
3947
3948
0
        case SID_OBJECT_ALIGN_LEFT:  // BASIC
3949
0
        {
3950
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::Left, SdrVertAlign::NONE);
3951
0
            Cancel();
3952
0
            rReq.Done ();
3953
0
        }
3954
0
        break;
3955
3956
0
        case SID_OBJECT_ALIGN_CENTER:  // BASIC
3957
0
        {
3958
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::Center, SdrVertAlign::NONE);
3959
0
            Cancel();
3960
0
            rReq.Done ();
3961
0
        }
3962
0
        break;
3963
3964
0
        case SID_OBJECT_ALIGN_RIGHT:  // BASIC
3965
0
        {
3966
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::Right, SdrVertAlign::NONE);
3967
0
            Cancel();
3968
0
            rReq.Done ();
3969
0
        }
3970
0
        break;
3971
3972
0
        case SID_OBJECT_ALIGN_UP:  // BASIC
3973
0
        {
3974
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Top);
3975
0
            Cancel();
3976
0
            rReq.Done ();
3977
0
        }
3978
0
        break;
3979
3980
0
        case SID_OBJECT_ALIGN_MIDDLE:  // BASIC
3981
0
        {
3982
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Center);
3983
0
            Cancel();
3984
0
            rReq.Done ();
3985
0
        }
3986
0
        break;
3987
3988
0
        case SID_ALIGN_PAGE:
3989
0
        {
3990
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::Center, SdrVertAlign::Center);
3991
0
            Cancel();
3992
0
            rReq.Done ();
3993
0
        }
3994
0
        break;
3995
3996
0
        case SID_OBJECT_ALIGN_DOWN:  // BASIC
3997
0
        {
3998
0
            mpDrawView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Bottom);
3999
0
            Cancel();
4000
0
            rReq.Done ();
4001
0
        }
4002
0
        break;
4003
4004
0
        case SID_SELECTALL:  // BASIC
4005
0
        {
4006
0
            if( (dynamic_cast<FuSelection*>( GetOldFunction().get() ) != nullptr) &&
4007
0
                !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
4008
0
            {
4009
0
                if ( !mpDrawView->IsAction() )
4010
0
                    mpDrawView->MarkAllPoints();
4011
0
            }
4012
0
            else
4013
0
                mpDrawView->SelectAll();
4014
4015
0
            FreshNavigatrTree();
4016
4017
0
            Cancel();
4018
0
            rReq.Done ();
4019
0
        }
4020
0
        break;
4021
4022
0
        case SID_STYLE_NEW: // BASIC ???
4023
0
        case SID_STYLE_APPLY:
4024
0
        case SID_STYLE_EDIT:
4025
0
        case SID_STYLE_DELETE:
4026
0
        case SID_STYLE_HIDE:
4027
0
        case SID_STYLE_SHOW:
4028
0
        case SID_STYLE_FAMILY:
4029
0
        case SID_STYLE_WATERCAN:
4030
0
        case SID_STYLE_UPDATE_BY_EXAMPLE:
4031
0
        case SID_STYLE_NEW_BY_EXAMPLE:
4032
0
        {
4033
0
            if (!rReq.GetArgs()
4034
0
                && (nSId == SID_STYLE_EDIT || nSId == SID_STYLE_UPDATE_BY_EXAMPLE
4035
0
                     || nSId == SID_STYLE_NEW_BY_EXAMPLE))
4036
0
            {
4037
0
                SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
4038
0
                if( pStyleSheet && pStyleSheet->GetFamily() == SfxStyleFamily::Page)
4039
0
                    pStyleSheet = static_cast<SdStyleSheet*>(pStyleSheet)->GetPseudoStyleSheet();
4040
4041
0
                if( (pStyleSheet == nullptr) && GetView()->IsTextEdit() )
4042
0
                {
4043
0
                    GetView()->SdrEndTextEdit();
4044
4045
0
                    pStyleSheet = mpDrawView->GetStyleSheet();
4046
0
                    if(pStyleSheet && pStyleSheet->GetFamily() == SfxStyleFamily::Page)
4047
0
                        pStyleSheet = static_cast<SdStyleSheet*>(pStyleSheet)->GetPseudoStyleSheet();
4048
0
                }
4049
4050
0
                if( pStyleSheet == nullptr )
4051
0
                {
4052
0
                    rReq.Ignore();
4053
0
                    break;
4054
0
                }
4055
4056
0
                SfxAllItemSet aSet(GetDoc()->GetPool());
4057
4058
0
                aSet.Put(SfxUInt16Item(SID_STYLE_FAMILY,
4059
0
                                       static_cast<sal_uInt16>(pStyleSheet->GetFamily())));
4060
4061
0
                if (nSId == SID_STYLE_NEW_BY_EXAMPLE)
4062
0
                {
4063
0
                    weld::Window* pWindow = GetViewFrame()->GetFrameWeld();
4064
0
                    SfxNewStyleDlg aDlg(pWindow, *pStyleSheet->GetPool(), pStyleSheet->GetFamily());
4065
0
                    auto nResult = aDlg.run();
4066
0
                    if (nResult == RET_OK)
4067
0
                    {
4068
0
                        aSet.Put(SfxStringItem(SID_STYLE_NEW_BY_EXAMPLE, aDlg.GetName()));
4069
0
                        aSet.Put(SfxStringItem(SID_STYLE_REFERENCE, pStyleSheet->GetName()));
4070
0
                    }
4071
0
                    else
4072
0
                    {
4073
0
                        Cancel();
4074
0
                        rReq.Ignore();
4075
0
                        break;
4076
0
                    }
4077
0
                }
4078
0
                else
4079
0
                    aSet.Put(SfxStringItem(nSId, pStyleSheet->GetName()));
4080
4081
0
                rReq.SetArgs(aSet);
4082
0
            }
4083
4084
0
            if( rReq.GetArgs() )
4085
0
            {
4086
0
                SetCurrentFunction( FuTemplate::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
4087
0
                if( rReq.GetSlot() == SID_STYLE_APPLY )
4088
0
                    GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
4089
0
                Cancel();
4090
0
            }
4091
0
            else if( rReq.GetSlot() == SID_STYLE_APPLY )
4092
0
                GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SfxCallMode::ASYNCHRON );
4093
0
            rReq.Ignore ();
4094
0
        }
4095
0
        break;
4096
4097
0
        case SID_IMAP:
4098
0
        {
4099
0
            sal_uInt16      nId = SvxIMapDlgChildWindow::GetChildWindowId();
4100
4101
0
            GetViewFrame()->ToggleChildWindow( nId );
4102
0
            GetViewFrame()->GetBindings().Invalidate( SID_IMAP );
4103
4104
0
            if ( GetViewFrame()->HasChildWindow( nId )
4105
0
                && ( ( ViewShell::Implementation::GetImageMapDialog() ) != nullptr ) )
4106
0
            {
4107
0
                if ( rMarkList.GetMarkCount() == 1 )
4108
0
                    UpdateIMapDlg( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
4109
0
            }
4110
4111
0
            Cancel();
4112
0
            rReq.Ignore ();
4113
0
        }
4114
0
        break;
4115
4116
0
        case SID_GRID_FRONT:
4117
0
        {
4118
0
            mpDrawView->SetGridFront( !mpDrawView->IsGridFront() );
4119
0
            Cancel();
4120
0
            rReq.Done ();
4121
0
        }
4122
0
        break;
4123
4124
0
        case SID_HELPLINES_FRONT:
4125
0
        {
4126
0
            mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() );
4127
0
            Cancel();
4128
0
            rReq.Done ();
4129
0
        }
4130
0
        break;
4131
4132
0
        case SID_FONTWORK:
4133
0
        {
4134
0
            if ( rReq.GetArgs() )
4135
0
            {
4136
0
                GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
4137
0
                                        static_cast<const SfxBoolItem&>(rReq.GetArgs()->
4138
0
                                        Get(SID_FONTWORK)).GetValue());
4139
0
            }
4140
0
            else
4141
0
            {
4142
0
                GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
4143
0
            }
4144
4145
0
            GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK);
4146
0
            Cancel();
4147
0
            rReq.Ignore ();
4148
0
        }
4149
0
        break;
4150
4151
0
        case SID_COLOR_CONTROL:
4152
0
        {
4153
0
            if ( rReq.GetArgs() )
4154
0
                GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
4155
0
                                        rReq.GetArgs()->Get(SID_COLOR_CONTROL).GetValue());
4156
0
            else
4157
0
                GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
4158
4159
0
            GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL);
4160
0
            Cancel();
4161
0
            rReq.Ignore ();
4162
0
        }
4163
0
        break;
4164
4165
0
        case SID_EXTRUSION_TOGGLE:
4166
0
        case SID_EXTRUSION_TILT_DOWN:
4167
0
        case SID_EXTRUSION_TILT_UP:
4168
0
        case SID_EXTRUSION_TILT_LEFT:
4169
0
        case SID_EXTRUSION_TILT_RIGHT:
4170
0
        case SID_EXTRUSION_3D_COLOR:
4171
0
        case SID_EXTRUSION_DEPTH:
4172
0
        case SID_EXTRUSION_DIRECTION:
4173
0
        case SID_EXTRUSION_PROJECTION:
4174
0
        case SID_EXTRUSION_LIGHTING_DIRECTION:
4175
0
        case SID_EXTRUSION_LIGHTING_INTENSITY:
4176
0
        case SID_EXTRUSION_SURFACE:
4177
0
        case SID_EXTRUSION_DEPTH_FLOATER:
4178
0
        case SID_EXTRUSION_DIRECTION_FLOATER:
4179
0
        case SID_EXTRUSION_LIGHTING_FLOATER:
4180
0
        case SID_EXTRUSION_SURFACE_FLOATER:
4181
0
        case SID_EXTRUSION_DEPTH_DIALOG:
4182
0
            svx::ExtrusionBar::execute( mpDrawView.get(), rReq, GetViewFrame()->GetBindings() );
4183
0
            Cancel();
4184
0
            rReq.Ignore ();
4185
0
            break;
4186
4187
0
        case SID_FONTWORK_SHAPE:
4188
0
        case SID_FONTWORK_SHAPE_TYPE:
4189
0
        case SID_FONTWORK_ALIGNMENT:
4190
0
        case SID_FONTWORK_SAME_LETTER_HEIGHTS:
4191
0
        case SID_FONTWORK_CHARACTER_SPACING:
4192
0
        case SID_FONTWORK_KERN_CHARACTER_PAIRS:
4193
0
        case SID_FONTWORK_GALLERY_FLOATER:
4194
0
        case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
4195
0
        case SID_FONTWORK_ALIGNMENT_FLOATER:
4196
0
        case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
4197
0
            svx::FontworkBar::execute(*mpDrawView, rReq, GetViewFrame()->GetBindings());
4198
0
            Cancel();
4199
0
            rReq.Ignore ();
4200
0
            break;
4201
4202
0
        case SID_BMPMASK:
4203
0
        {
4204
0
            GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
4205
0
            GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK );
4206
4207
0
            Cancel();
4208
0
            rReq.Ignore ();
4209
0
        }
4210
0
        break;
4211
4212
0
        case SID_NAVIGATOR:
4213
0
        {
4214
0
            if ( rReq.GetArgs() )
4215
0
                GetViewFrame()->SetChildWindow(SID_NAVIGATOR,
4216
0
                                        static_cast<const SfxBoolItem&>(rReq.GetArgs()->
4217
0
                                        Get(SID_NAVIGATOR)).GetValue());
4218
0
            else
4219
0
                GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR );
4220
4221
0
            GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR);
4222
0
            Cancel();
4223
0
            rReq.Ignore ();
4224
0
        }
4225
0
        break;
4226
4227
0
        case SID_SLIDE_TRANSITIONS_PANEL:
4228
0
        case SID_MASTER_SLIDES_PANEL:
4229
0
        case SID_CUSTOM_ANIMATION_PANEL:
4230
0
        case SID_GALLERY:
4231
0
        {
4232
            // First make sure that the sidebar is visible
4233
0
            GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
4234
4235
0
            OUString panelId;
4236
0
            if (nSId == SID_CUSTOM_ANIMATION_PANEL)
4237
0
                panelId = "SdCustomAnimationPanel";
4238
0
            else if (nSId == SID_GALLERY)
4239
0
                panelId = "GalleryPanel";
4240
0
            else if (nSId == SID_SLIDE_TRANSITIONS_PANEL)
4241
0
                panelId = "SdSlideTransitionPanel";
4242
0
            else if (nSId == SID_MASTER_SLIDES_PANEL)
4243
0
                panelId = "SdAllMasterPagesPanel";
4244
4245
0
            ::sfx2::sidebar::Sidebar::TogglePanel(
4246
0
                panelId,
4247
0
                GetViewFrame()->GetFrame().GetFrameInterface());
4248
4249
0
            Cancel();
4250
0
            rReq.Done();
4251
0
        }
4252
0
        break;
4253
4254
0
        case SID_ANIMATION_OBJECTS:
4255
0
        {
4256
0
            if ( rReq.GetArgs() )
4257
0
                GetViewFrame()->SetChildWindow(
4258
0
                    AnimationChildWindow::GetChildWindowId(),
4259
0
                    static_cast<const SfxBoolItem&>(rReq.GetArgs()->
4260
0
                        Get(SID_ANIMATION_OBJECTS)).GetValue());
4261
0
            else
4262
0
                GetViewFrame()->ToggleChildWindow(
4263
0
                    AnimationChildWindow::GetChildWindowId() );
4264
4265
0
            GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS);
4266
0
            Cancel();
4267
0
            rReq.Ignore ();
4268
0
        }
4269
0
        break;
4270
4271
0
        case SID_3D_WIN:
4272
0
        {
4273
0
            if ( rReq.GetArgs() )
4274
0
                GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
4275
0
                                        static_cast<const SfxBoolItem&>(rReq.GetArgs()->
4276
0
                                        Get( SID_3D_WIN )).GetValue());
4277
0
            else
4278
0
                GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
4279
4280
0
            GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN );
4281
0
            Cancel();
4282
0
            rReq.Ignore ();
4283
0
        }
4284
0
        break;
4285
4286
0
        case SID_CONVERT_TO_3D_LATHE_FAST:
4287
0
        {
4288
            /* The call is enough. The initialization via Start3DCreation and
4289
               CreateMirrorPolygons is no longer needed if the parameter
4290
               sal_True is provided. Then a tilted rotary body with an axis left
4291
               besides the bounding rectangle of the selected objects is drawn
4292
               immediately and without user interaction.  */
4293
0
            mpDrawView->SdrEndTextEdit();
4294
0
            if(GetActiveWindow())
4295
0
                GetActiveWindow()->EnterWait();
4296
0
            mpDrawView->End3DCreation(true);
4297
0
            Cancel();
4298
0
            rReq.Ignore();
4299
0
            if(GetActiveWindow())
4300
0
                GetActiveWindow()->LeaveWait();
4301
0
        }
4302
0
        break;
4303
4304
0
        case SID_PRESENTATION_DLG:
4305
0
        {
4306
0
            SetCurrentFunction( FuSlideShowDlg::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
4307
0
            Cancel();
4308
0
        }
4309
0
        break;
4310
4311
0
        case SID_REMOTE_DLG:
4312
0
        {
4313
#ifdef ENABLE_SDREMOTE
4314
             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
4315
             ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateRemoteDialog(GetFrameWeld()));
4316
             pDlg->Execute();
4317
#endif
4318
0
        }
4319
0
        break;
4320
4321
0
        case SID_CUSTOMSHOW_DLG:
4322
0
        {
4323
0
            SetCurrentFunction( FuCustomShowDlg::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
4324
0
            Cancel();
4325
0
        }
4326
0
        break;
4327
4328
0
        case SID_EXPAND_PAGE:
4329
0
        {
4330
0
            SetCurrentFunction( FuExpandPage::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
4331
0
            Cancel();
4332
0
        }
4333
0
        break;
4334
4335
0
        case SID_SUMMARY_PAGE:
4336
0
        {
4337
0
            mpDrawView->SdrEndTextEdit();
4338
0
            SetCurrentFunction( FuSummaryPage::Create( *this, GetActiveWindow(), mpDrawView.get(), *GetDoc(), rReq ) );
4339
0
            Cancel();
4340
0
        }
4341
0
        break;
4342
4343
0
#if HAVE_FEATURE_AVMEDIA
4344
0
        case SID_AVMEDIA_PLAYER:
4345
0
        {
4346
0
            GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
4347
0
            GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER );
4348
0
            Cancel();
4349
0
            rReq.Ignore ();
4350
0
        }
4351
0
        break;
4352
0
#endif
4353
4354
0
        case SID_PRESENTATION_MINIMIZER:
4355
0
        {
4356
0
            const Reference<XComponentContext>& xContext(::comphelper::getProcessComponentContext());
4357
0
            Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext));
4358
0
            Reference<frame::XDispatchProvider> xProvider(GetViewShellBase().GetController()->getFrame(), UNO_QUERY);
4359
0
            if (xProvider.is())
4360
0
            {
4361
0
                util::URL aURL;
4362
0
                aURL.Complete = "vnd.com.sun.star.comp.PresentationMinimizer:execute";
4363
0
                xParser->parseStrict(aURL);
4364
0
                uno::Reference<frame::XDispatch> xDispatch(xProvider->queryDispatch(aURL, OUString(), 0));
4365
0
                if (xDispatch.is())
4366
0
                {
4367
0
                    xDispatch->dispatch(aURL, uno::Sequence< beans::PropertyValue >());
4368
0
                }
4369
0
            }
4370
0
            Cancel();
4371
0
            rReq.Ignore();
4372
0
        }
4373
0
        break;
4374
4375
0
        case SID_DISPLAY_MASTER_BACKGROUND:
4376
0
        case SID_DISPLAY_MASTER_OBJECTS:
4377
0
        {
4378
            // Determine current page and toggle visibility of layers
4379
            // associated with master page background or master page shapes.
4380
            // FIXME: This solution is wrong, because shapes of master pages need
4381
            // not be on layer "background" or "backgroundobjects".
4382
            // See tdf#118613
4383
0
            SdPage* pPage = GetActualPage();
4384
0
            if (pPage != nullptr
4385
0
                && GetDoc() != nullptr)
4386
0
            {
4387
0
                SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
4388
0
                SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
4389
0
                SdrLayerID aLayerId;
4390
0
                if (nSId == SID_DISPLAY_MASTER_BACKGROUND)
4391
0
                    aLayerId = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
4392
0
                else
4393
0
                    aLayerId = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
4394
0
                aVisibleLayers.Set(aLayerId, !aVisibleLayers.IsSet(aLayerId));
4395
0
                pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
4396
0
            }
4397
0
            Cancel();
4398
0
            rReq.Done(); // Mark task as done to auto-update the state of each buttons tdf#132816
4399
0
        }
4400
0
        break;
4401
4402
0
        case SID_PHOTOALBUM:
4403
0
        {
4404
0
            SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
4405
0
            vcl::Window* pWin = GetActiveWindow();
4406
0
            ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog(
4407
0
                pWin ? pWin->GetFrameWeld() : nullptr,
4408
0
                *GetDoc()));
4409
4410
0
            pDlg->Execute();
4411
0
            Cancel();
4412
0
            rReq.Ignore ();
4413
0
        }
4414
0
        break;
4415
4416
0
        case SID_INSERT_QRCODE:
4417
0
        case SID_EDIT_QRCODE:
4418
0
        {
4419
0
            VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
4420
0
            const uno::Reference<frame::XModel> xModel = GetViewShellBase().GetController()->getModel();
4421
0
            ScopedVclPtr<AbstractQrCodeGenDialog> pDlg(pFact->CreateQrCodeGenDialog(
4422
0
                GetFrameWeld(), xModel, rReq.GetSlot() == SID_EDIT_QRCODE));
4423
0
            pDlg->Execute();
4424
0
            Cancel();
4425
0
            rReq.Ignore ();
4426
0
        }
4427
0
        break;
4428
4429
0
        case SID_THEME_DIALOG:
4430
0
        {
4431
0
            SdrPage* pMasterPage = &GetActualPage()->TRG_GetMasterPage();
4432
0
            auto pTheme = pMasterPage->getSdrPageProperties().getTheme();
4433
0
            auto pDialog = std::make_shared<svx::ThemeDialog>(GetFrameWeld(), pTheme.get());
4434
0
            auto* pDocShell = GetDocSh();
4435
0
            weld::DialogController::runAsync(pDialog, [pDialog, pMasterPage, pDocShell](sal_uInt32 nResult)
4436
0
            {
4437
0
                if (RET_OK != nResult)
4438
0
                    return;
4439
4440
0
                auto pColorSet = pDialog->getCurrentColorSet();
4441
0
                if (pColorSet)
4442
0
                {
4443
0
                    sd::ThemeColorChanger aChanger(pMasterPage, pDocShell);
4444
0
                    aChanger.apply(pColorSet);
4445
0
                }
4446
0
            });
4447
4448
0
            Cancel();
4449
0
            rReq.Ignore();
4450
0
        }
4451
0
        break;
4452
4453
0
        case SID_ADD_THEME:
4454
0
        {
4455
            // Create empty color set as starting point for new theme
4456
0
            auto pCurrentColorSet = std::make_shared<model::ColorSet>(OUString());
4457
4458
            // Open ThemeColorEditDialog to create/edit the new color set
4459
0
            auto pSubDialog = std::make_shared<svx::ThemeColorEditDialog>(GetFrameWeld(), *pCurrentColorSet);
4460
4461
0
            weld::DialogController::runAsync(pSubDialog, [pSubDialog](sal_uInt32 nResult) {
4462
0
                if (nResult != RET_OK)
4463
0
                    return;
4464
4465
0
                auto aColorSet = pSubDialog->getColorSet();
4466
0
                if (!aColorSet.getName().isEmpty())
4467
0
                {
4468
                    // Add the new color set to the global collection
4469
0
                    svx::ColorSets::get().insert(aColorSet);
4470
0
                }
4471
0
            });
4472
4473
0
            Cancel();
4474
0
            rReq.Ignore();
4475
0
        }
4476
0
        break;
4477
4478
0
        case SID_APPLY_THEME:
4479
0
        {
4480
0
            const SfxItemSet* pArgs = rReq.GetArgs();
4481
0
            if (pArgs)
4482
0
            {
4483
0
                const SfxPoolItem* pItem;
4484
0
                if (pArgs->GetItemState(FN_PARAM_1, true, &pItem) == SfxItemState::SET)
4485
0
                {
4486
0
                    OUString aThemeName = static_cast<const SfxStringItem*>(pItem)->GetValue();
4487
0
                    auto pColorSet = svx::ColorSets::get().getColorSet(aThemeName);
4488
4489
0
                    if (pColorSet)
4490
0
                    {
4491
0
                        SdrPage* pMasterPage = &GetActualPage()->TRG_GetMasterPage();
4492
0
                        auto* pDocShell = GetDocSh();
4493
4494
0
                        auto pSharedColorSet = std::shared_ptr<model::ColorSet>(new model::ColorSet(*pColorSet));
4495
0
                        sd::ThemeColorChanger aChanger(pMasterPage, pDocShell);
4496
0
                        aChanger.apply(pSharedColorSet);
4497
0
                    }
4498
0
                }
4499
0
            }
4500
4501
0
            Cancel();
4502
0
            rReq.Done();
4503
0
        }
4504
0
        break;
4505
4506
0
        case SID_ATTR_GLOW_COLOR:
4507
0
        case SID_ATTR_GLOW_RADIUS:
4508
0
        case SID_ATTR_GLOW_TRANSPARENCY:
4509
0
        case SID_ATTR_GLOW_TEXT_COLOR:
4510
0
        case SID_ATTR_GLOW_TEXT_RADIUS:
4511
0
        case SID_ATTR_GLOW_TEXT_TRANSPARENCY:
4512
0
        case SID_ATTR_SOFTEDGE_RADIUS:
4513
0
        case SID_ATTR_TEXTCOLUMNS_NUMBER:
4514
0
        case SID_ATTR_TEXTCOLUMNS_SPACING:
4515
0
        case SID_ATTR_TEXT_AUTOGROWWIDTH:
4516
0
        case SID_ATTR_TEXT_AUTOGROWHEIGHT:
4517
0
        case SID_ATTR_TEXT_LEFTDIST:
4518
0
        case SID_ATTR_TEXT_RIGHTDIST:
4519
0
        case SID_ATTR_TEXT_UPPERDIST:
4520
0
        case SID_ATTR_TEXT_LOWERDIST:
4521
0
            if (const SfxItemSet* pNewArgs = rReq.GetArgs())
4522
0
                mpDrawView->SetAttributes(*pNewArgs);
4523
0
            rReq.Done();
4524
0
            Cancel();
4525
0
            break;
4526
4527
0
        case SID_PASTE_SLIDE:
4528
0
        case SID_COPY_SLIDE:
4529
0
        {
4530
0
            sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase())
4531
0
                ->GetSlideSorter()
4532
0
                .GetController()
4533
0
                .FuSupport(rReq);
4534
0
            Cancel();
4535
0
            rReq.Done();
4536
0
        }
4537
0
        break;
4538
0
        default:
4539
0
        {
4540
0
            SAL_WARN( "sd.ui", "Slot without function" );
4541
0
            Cancel();
4542
0
            rReq.Ignore ();
4543
0
        }
4544
0
        break;
4545
0
    }
4546
4547
0
    if(HasCurrentFunction())
4548
0
    {
4549
0
        GetCurrentFunction()->Activate();
4550
0
    }
4551
0
}
4552
4553
void DrawViewShell::ExecChar( SfxRequest &rReq )
4554
0
{
4555
0
    SdDrawDocument* pDoc = GetDoc();
4556
0
    if (!pDoc || !mpDrawView)
4557
0
        return;
4558
4559
0
    SfxItemSet aEditAttr( pDoc->GetPool() );
4560
0
    mpDrawView->GetAttributes( aEditAttr );
4561
4562
    //modified by wj for sym2_1580, if put old itemset into new set,
4563
    //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
4564
    // and use old attr to update all the attributes
4565
//  SfxItemSet aNewAttr( GetPool(),
4566
//  EE_ITEMS_START, EE_ITEMS_END );
4567
//  aNewAttr.Put( aEditAttr, sal_False );
4568
0
    SfxItemSet aNewAttr( pDoc->GetPool() );
4569
    //modified end
4570
4571
0
    sal_uInt16 nSId = rReq.GetSlot();
4572
4573
0
    switch ( nSId )
4574
0
    {
4575
0
    case SID_ATTR_CHAR_FONT:
4576
0
        if( rReq.GetArgs() )
4577
0
        {
4578
0
            const SvxFontItem* pItem = rReq.GetArg(SID_ATTR_CHAR_FONT);
4579
0
            if (pItem)
4580
0
            {
4581
0
                aNewAttr.Put(*pItem);
4582
0
            }
4583
0
        }
4584
0
        break;
4585
0
    case SID_ATTR_CHAR_FONTHEIGHT:
4586
0
        if( rReq.GetArgs() )
4587
0
        {
4588
0
            const SvxFontHeightItem* pItem = rReq.GetArg(SID_ATTR_CHAR_FONTHEIGHT);
4589
0
            if (pItem)
4590
0
            {
4591
0
                aNewAttr.Put(*pItem);
4592
0
            }
4593
0
        }
4594
0
        break;
4595
0
    case SID_ATTR_CHAR_WEIGHT:
4596
0
        if( rReq.GetArgs() )
4597
0
        {
4598
0
            const SvxWeightItem* pItem = rReq.GetArg(SID_ATTR_CHAR_WEIGHT);
4599
0
            if (pItem)
4600
0
            {
4601
0
                aNewAttr.Put(*pItem);
4602
0
            }
4603
0
        }
4604
0
        break;
4605
0
    case SID_ATTR_CHAR_POSTURE:
4606
0
        if( rReq.GetArgs() )
4607
0
        {
4608
0
            const SvxPostureItem* pItem = rReq.GetArg(SID_ATTR_CHAR_POSTURE);
4609
0
            if (pItem)
4610
0
            {
4611
0
                aNewAttr.Put(*pItem);
4612
0
            }
4613
0
        }
4614
0
        break;
4615
0
    case SID_ATTR_CHAR_UNDERLINE:
4616
0
        if( rReq.GetArgs() )
4617
0
        {
4618
0
            const SvxUnderlineItem* pItem = rReq.GetArg(SID_ATTR_CHAR_UNDERLINE);
4619
0
            if (pItem)
4620
0
            {
4621
0
                aNewAttr.Put(*pItem);
4622
0
            }
4623
0
            else
4624
0
            {
4625
0
                FontLineStyle eFU = aEditAttr.Get( EE_CHAR_UNDERLINE ).GetLineStyle();
4626
0
                aNewAttr.Put( SvxUnderlineItem( eFU != LINESTYLE_NONE ?LINESTYLE_NONE : LINESTYLE_SINGLE,  EE_CHAR_UNDERLINE ) );
4627
0
            }
4628
0
        }
4629
0
        break;
4630
0
    case SID_ATTR_CHAR_OVERLINE:
4631
0
        if( rReq.GetArgs() )
4632
0
        {
4633
0
            const SvxOverlineItem* pItem = rReq.GetArg(SID_ATTR_CHAR_OVERLINE);
4634
0
            if (pItem)
4635
0
            {
4636
0
                aNewAttr.Put(*pItem);
4637
0
            }
4638
0
            else
4639
0
            {
4640
0
                FontLineStyle eFU = aEditAttr.Get( EE_CHAR_OVERLINE ).GetLineStyle();
4641
0
                aNewAttr.Put( SvxOverlineItem( eFU != LINESTYLE_NONE ?LINESTYLE_NONE : LINESTYLE_SINGLE,  EE_CHAR_OVERLINE ) );
4642
0
            }
4643
0
        }
4644
0
        break;
4645
4646
0
        case SID_ULINE_VAL_NONE:
4647
0
        {
4648
0
            aNewAttr.Put(SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE));
4649
0
            break;
4650
0
        }
4651
4652
0
        case SID_ULINE_VAL_SINGLE:
4653
0
        case SID_ULINE_VAL_DOUBLE:
4654
0
        case SID_ULINE_VAL_DOTTED:
4655
0
        {
4656
0
            FontLineStyle eOld = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle();
4657
0
            FontLineStyle eNew = eOld;
4658
4659
0
            switch (nSId)
4660
0
            {
4661
0
                case SID_ULINE_VAL_SINGLE:
4662
0
                    eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE;
4663
0
                    break;
4664
0
                case SID_ULINE_VAL_DOUBLE:
4665
0
                    eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE;
4666
0
                    break;
4667
0
                case SID_ULINE_VAL_DOTTED:
4668
0
                    eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED;
4669
0
                    break;
4670
0
            }
4671
4672
0
            SvxUnderlineItem aUnderline(eNew, EE_CHAR_UNDERLINE);
4673
0
            aNewAttr.Put(aUnderline);
4674
0
        }
4675
0
        break;
4676
4677
0
    case SID_ATTR_CHAR_SHADOWED:
4678
0
        if( rReq.GetArgs() )
4679
0
        {
4680
0
            const SvxShadowedItem* pItem = rReq.GetArg(SID_ATTR_CHAR_SHADOWED);
4681
0
            if (pItem)
4682
0
            {
4683
0
                aNewAttr.Put(*pItem);
4684
0
            }
4685
0
        }
4686
0
        break;
4687
0
    case SID_ATTR_CHAR_CONTOUR:
4688
0
        if( rReq.GetArgs() )
4689
0
        {
4690
0
            const SvxContourItem* pItem = rReq.GetArg(SID_ATTR_CHAR_CONTOUR);
4691
0
            if (pItem)
4692
0
            {
4693
0
                aNewAttr.Put(*pItem);
4694
0
            }
4695
0
        }
4696
0
        break;
4697
4698
0
    case SID_ATTR_CHAR_STRIKEOUT:
4699
0
        if( rReq.GetArgs() )
4700
0
        {
4701
0
            const SvxCrossedOutItem* pItem = rReq.GetArg(SID_ATTR_CHAR_STRIKEOUT);
4702
0
            if (pItem)
4703
0
            {
4704
0
                aNewAttr.Put(*pItem);
4705
0
            }
4706
0
        }
4707
0
        break;
4708
0
    case SID_ATTR_CHAR_COLOR:
4709
0
        if( rReq.GetArgs() )
4710
0
        {
4711
0
            const SvxColorItem* pItem = rReq.GetArg(SID_ATTR_CHAR_COLOR);
4712
0
            if (pItem)
4713
0
            {
4714
0
                aNewAttr.Put(*pItem);
4715
0
            }
4716
0
        }
4717
0
        break;
4718
0
    case SID_ATTR_CHAR_KERNING:
4719
0
        if( rReq.GetArgs() )
4720
0
        {
4721
0
            const SvxKerningItem* pItem = rReq.GetArg(SID_ATTR_CHAR_KERNING);
4722
0
            if (pItem)
4723
0
            {
4724
0
                aNewAttr.Put(*pItem);
4725
0
            }
4726
0
        }
4727
0
        break;
4728
0
    case SID_ATTR_CHAR_CASEMAP:
4729
0
        if( rReq.GetArgs() )
4730
0
        {
4731
0
            const SvxCaseMapItem* pItem = rReq.GetArg(SID_ATTR_CHAR_CASEMAP);
4732
0
            if (pItem)
4733
0
            {
4734
0
                aNewAttr.Put(*pItem);
4735
0
            }
4736
0
        }
4737
0
        break;
4738
0
    case SID_SET_SMALL_CAPS:
4739
0
        {
4740
0
            SvxCaseMap eCaseMap = aEditAttr.Get(EE_CHAR_CASEMAP).GetCaseMap();
4741
0
            if (eCaseMap == SvxCaseMap::SmallCaps)
4742
0
                eCaseMap = SvxCaseMap::NotMapped;
4743
0
            else
4744
0
                eCaseMap = SvxCaseMap::SmallCaps;
4745
0
            SvxCaseMapItem aItem(eCaseMap, EE_CHAR_CASEMAP);
4746
0
            aNewAttr.Put(aItem);
4747
0
        }
4748
0
        break;
4749
0
    case SID_SET_SUB_SCRIPT:
4750
0
        {
4751
0
            SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
4752
0
            SvxEscapement eEsc = aEditAttr.Get(EE_CHAR_ESCAPEMENT).GetEscapement();
4753
0
            if( eEsc == SvxEscapement::Subscript )
4754
0
                aItem.SetEscapement( SvxEscapement::Off );
4755
0
            else
4756
0
                aItem.SetEscapement( SvxEscapement::Subscript );
4757
0
            aNewAttr.Put( aItem );
4758
0
        }
4759
0
        break;
4760
0
    case SID_SET_SUPER_SCRIPT:
4761
0
        {
4762
0
            SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
4763
0
            SvxEscapement eEsc = aEditAttr.Get(EE_CHAR_ESCAPEMENT).GetEscapement();
4764
0
            if( eEsc == SvxEscapement::Superscript )
4765
0
                aItem.SetEscapement( SvxEscapement::Off );
4766
0
            else
4767
0
                aItem.SetEscapement( SvxEscapement::Superscript );
4768
0
            aNewAttr.Put( aItem );
4769
0
        }
4770
0
        break;
4771
0
    case SID_SHRINK_FONT_SIZE:
4772
0
    case SID_GROW_FONT_SIZE:
4773
0
        {
4774
0
            const SvxFontListItem* pFonts = GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST );
4775
0
            const FontList* pFontList = pFonts ? pFonts->GetFontList() : nullptr;
4776
0
            if( pFontList )
4777
0
            {
4778
0
                FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, nullptr, pFontList, mpView );
4779
0
                GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
4780
0
            }
4781
0
            break;
4782
0
        }
4783
0
    case SID_ATTR_CHAR_BACK_COLOR:
4784
0
        if( rReq.GetArgs() )
4785
0
        {
4786
0
            const SvxColorItem* pItem = rReq.GetArg<SvxColorItem>(SID_ATTR_CHAR_BACK_COLOR);
4787
0
            if (pItem)
4788
0
            {
4789
0
                aNewAttr.Put(*pItem);
4790
0
            }
4791
0
        }
4792
0
        break;
4793
0
    default:
4794
0
        break;
4795
0
    }
4796
4797
0
    mpDrawView->SetAttributes(aNewAttr);
4798
0
    rReq.Done();
4799
0
    Cancel();
4800
0
}
4801
4802
/** This method consists basically of three parts:
4803
    1. Process the arguments of the SFX request.
4804
    2. Use the model to create a new page or duplicate an existing one.
4805
    3. Update the tab control and switch to the new page.
4806
*/
4807
SdPage* DrawViewShell::CreateOrDuplicatePage (
4808
    SfxRequest& rRequest,
4809
    PageKind ePageKind,
4810
    SdPage* pPage,
4811
    const sal_Int32 nInsertPosition)
4812
0
{
4813
0
    SdPage* pNewPage = nullptr;
4814
0
    if (ePageKind == PageKind::Standard && meEditMode != EditMode::MasterPage)
4815
0
    {
4816
0
        if ( mpDrawView->IsTextEdit() )
4817
0
        {
4818
0
            mpDrawView->SdrEndTextEdit();
4819
0
        }
4820
0
        pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
4821
0
    }
4822
0
    return pNewPage;
4823
0
}
4824
4825
void DrawViewShell::DuplicateSelectedSlides (SfxRequest& rRequest)
4826
0
{
4827
0
    ::sd::slidesorter::SlideSorterViewShell* pSlideSorterViewShell =
4828
0
        sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
4829
0
    if (!pSlideSorterViewShell)
4830
0
        return;
4831
4832
    // Create a list of the pages that are to be duplicated.  The process of
4833
    // duplication alters the selection.
4834
0
    sal_Int32 nInsertPosition (0);
4835
0
    ::std::vector<SdPage*> aPagesToDuplicate;
4836
0
    sd::slidesorter::SlideSorter &rSlideSorter = pSlideSorterViewShell->GetSlideSorter();
4837
0
    sd::slidesorter::model::PageEnumeration aSelectedPages (
4838
0
        sd::slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(rSlideSorter.GetModel()));
4839
0
    while (aSelectedPages.HasMoreElements())
4840
0
    {
4841
0
        sd::slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
4842
0
        if (pDescriptor && pDescriptor->GetPage())
4843
0
        {
4844
0
            aPagesToDuplicate.push_back(pDescriptor->GetPage());
4845
0
            nInsertPosition = pDescriptor->GetPage()->GetPageNum()+2;
4846
0
        }
4847
0
    }
4848
4849
    // Duplicate the pages in aPagesToDuplicate and collect the newly
4850
    // created pages in aPagesToSelect.
4851
0
    const bool bUndo (aPagesToDuplicate.size()>1 && rSlideSorter.GetView().IsUndoEnabled());
4852
0
    if (bUndo)
4853
0
        rSlideSorter.GetView().BegUndo(SdResId(STR_INSERTPAGE));
4854
4855
0
    ::std::vector<SdPage*> aPagesToSelect;
4856
0
    for(::std::vector<SdPage*>::const_iterator
4857
0
            iPage(aPagesToDuplicate.begin()),
4858
0
            iEnd(aPagesToDuplicate.end());
4859
0
        iPage!=iEnd;
4860
0
        ++iPage, nInsertPosition+=2)
4861
0
    {
4862
0
        aPagesToSelect.push_back(
4863
0
            rSlideSorter.GetViewShell().CreateOrDuplicatePage(
4864
0
                rRequest, PageKind::Standard, *iPage, nInsertPosition));
4865
0
    }
4866
0
    aPagesToDuplicate.clear();
4867
4868
0
    if (bUndo)
4869
0
        rSlideSorter.GetView().EndUndo();
4870
4871
    // Set the selection to the pages in aPagesToSelect.
4872
0
    sd::slidesorter::controller::PageSelector& rSelector (rSlideSorter.GetController().GetPageSelector());
4873
0
    rSelector.DeselectAllPages();
4874
0
    for (auto const& it: aPagesToSelect)
4875
0
    {
4876
0
        rSelector.SelectPage(it);
4877
0
    }
4878
0
}
4879
4880
void DrawViewShell::ExecutePropPanelAttr (SfxRequest const & rReq)
4881
0
{
4882
0
    if(SlideShow::IsRunning( GetViewShellBase() )
4883
0
        && !SlideShow::IsInteractiveSlideshow( GetViewShellBase() )) // IASS
4884
0
        return;
4885
4886
0
    SdDrawDocument* pDoc = GetDoc();
4887
0
    if (!pDoc || !mpDrawView)
4888
0
        return;
4889
4890
0
    sal_uInt16 nSId = rReq.GetSlot();
4891
0
    SfxItemSet aAttrs( pDoc->GetPool() );
4892
4893
0
    switch ( nSId )
4894
0
    {
4895
0
    case SID_TABLE_VERT_NONE:
4896
0
    case SID_TABLE_VERT_CENTER:
4897
0
    case SID_TABLE_VERT_BOTTOM:
4898
0
        SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
4899
0
        if (nSId == SID_TABLE_VERT_CENTER)
4900
0
            eTVA = SDRTEXTVERTADJUST_CENTER;
4901
0
        else if (nSId == SID_TABLE_VERT_BOTTOM)
4902
0
            eTVA = SDRTEXTVERTADJUST_BOTTOM;
4903
4904
0
        aAttrs.Put( SdrTextVertAdjustItem(eTVA) );
4905
0
        mpDrawView->SetAttributes(aAttrs);
4906
4907
0
        break;
4908
0
    }
4909
0
}
4910
4911
void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet)
4912
0
{
4913
0
    SfxWhichIter    aIter( rSet );
4914
0
    sal_uInt16          nWhich = aIter.FirstWhich();
4915
4916
0
    SdDrawDocument* pDoc = GetDoc();
4917
0
    if (!pDoc || !mpDrawView)
4918
0
        return;
4919
4920
0
    SfxItemSet aAttrs( pDoc->GetPool() );
4921
0
    mpDrawView->GetAttributes( aAttrs );
4922
4923
0
    while ( nWhich )
4924
0
    {
4925
0
        sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
4926
0
            ? GetPool().GetSlotId(nWhich)
4927
0
            : nWhich;
4928
0
        switch ( nSlotId )
4929
0
        {
4930
0
            case SID_TABLE_VERT_NONE:
4931
0
            case SID_TABLE_VERT_CENTER:
4932
0
            case SID_TABLE_VERT_BOTTOM:
4933
0
                bool bContour = false;
4934
0
                SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
4935
0
                if( eConState != SfxItemState::INVALID )
4936
0
                {
4937
0
                    bContour = aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
4938
0
                }
4939
0
                if (bContour) break;
4940
4941
0
                SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
4942
                //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
4943
4944
                //if(SfxItemState::INVALID != eVState && SfxItemState::INVALID != eHState)
4945
0
                if(SfxItemState::INVALID != eVState)
4946
0
                {
4947
0
                    SdrTextVertAdjust eTVA = aAttrs.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
4948
0
                    bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
4949
0
                            (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
4950
0
                            (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
4951
0
                    rSet.Put(SfxBoolItem(nSlotId, bSet));
4952
0
                }
4953
0
                else
4954
0
                {
4955
0
                    rSet.Put(SfxBoolItem(nSlotId, false));
4956
0
                }
4957
0
                break;
4958
0
        }
4959
0
        nWhich = aIter.NextWhich();
4960
0
    }
4961
0
}
4962
4963
} // end of namespace sd
4964
4965
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */