Coverage Report

Created: 2026-04-09 11:41

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