Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  drviews2.cxx   Sprache: C

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <config_features.h>

#include <avmedia/mediaplayer.hxx>

#include <basic/sberrors.hxx>
#include <basic/sbstar.hxx>

#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>

#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/scopeguard.hxx>
#include <comphelper/lok.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/dispatchcommand.hxx>
#include <comphelper/propertyvalue.hxx>

#include <editeng/contouritem.hxx>
#include <editeng/editdata.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/flditem.hxx>
#include <editeng/section.hxx>
#include <editeng/editobj.hxx>
#include <editeng/CustomPropertyField.hxx>
#include <editeng/urlfieldhelper.hxx>

#include <sal/log.hxx>

#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/msg.hxx>
#include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/zoomitem.hxx>
#include <sfx2/lokhelper.hxx>
#include <sfx2/lokunocmdlist.hxx>

#include <svx/compressgraphicdialog.hxx>
#include <svx/ClassificationDialog.hxx>
#include <svx/ClassificationCommon.hxx>
#include <svx/bmpmask.hxx>
#include <svx/extedit.hxx>
#include <svx/extrusionbar.hxx>
#include <svx/f3dchild.hxx>
#include <svx/fontwork.hxx>
#include <svx/fontworkbar.hxx>
#include <svx/graphichelper.hxx>
#include <svx/hlnkitem.hxx>
#include <svx/imapdlg.hxx>
#include <svx/sdtagitm.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdpagv.hxx>
#include <svx/svdundo.hxx>
#include <svx/svxdlg.hxx>
#include <svx/svxids.hrc>
#include <svx/sdtfsitm.hxx>
#include <svx/sdmetitm.hxx>
#include <svx/zoomslideritem.hxx>
#include <svx/xflclit.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/chrtitem.hxx>
#include <svx/xlnclit.hxx>
#include <svx/xflgrit.hxx>
#include <svx/xfillit0.hxx>

#include <comphelper/diagnose_ex.hxx>
#include <tools/UnitConversion.hxx>

#include <unotools/useroptions.hxx>

#include <vcl/abstdlg.hxx>
#include <vcl/graph.hxx>
#include <vcl/svapp.hxx>
#include <vcl/unohelp2.hxx>
#include <vcl/weld.hxx>

#include <editeng/cmapitem.hxx>
#include <editeng/escapementitem.hxx>
#include <editeng/kernitem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/postitem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/crossedoutitem.hxx>
#include <editeng/shdditem.hxx>
#include <editeng/numitem.hxx>
#include <svx/svdobj.hxx>
#include <svx/SvxColorChildWindow.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/flstitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/colritem.hxx>

#include <svl/poolitem.hxx>
#include <svl/style.hxx>
#include <svl/whiter.hxx>

#include <app.hrc>
#include <strings.hrc>

#include <AnimationChildWindow.hxx>
#include <DrawDocShell.hxx>
#include <DrawViewShell.hxx>
#include <LayerTabBar.hxx>
#include <Outliner.hxx>
#include <ViewShellHint.hxx>
#include <ViewShellImplementation.hxx>
#include <Window.hxx>
#include <drawdoc.hxx>
#include <drawview.hxx>
#include <fuarea.hxx>
#include <fubullet.hxx>
#include <fuchar.hxx>
#include <fucushow.hxx>
#include <fuconnct.hxx>
#include <fucopy.hxx>
#include <fudspord.hxx>
#include <fuexecuteinteraction.hxx>
#include <fuexpand.hxx>
#include <fuinsert.hxx>
#include <fuinsfil.hxx>
#include <fuline.hxx>
#include <fulinend.hxx>
#include <fulink.hxx>
#include <fumeasur.hxx>
#include <fumorph.hxx>
#include <fuoaprms.hxx>
#include <fuolbull.hxx>
#include <fupage.hxx>
#include <fuparagr.hxx>
#include <fuprlout.hxx>
#include <fuscale.hxx>
#include <fusel.hxx>
#include <fusldlg.hxx>
#include <fusnapln.hxx>
#include <fusumry.hxx>
#include <futempl.hxx>
#include <futhes.hxx>
#include <futransf.hxx>
#include <futxtatt.hxx>
#include <fuvect.hxx>
#include <futext.hxx>
#include <helpids.h>
#include <sdabstdlg.hxx>
#include <sdattr.hxx>
#include <sdpage.hxx>
#include <sdresid.hxx>
#include <unokywds.hxx>
#include <slideshow.hxx>
#include <stlsheet.hxx>
#include <undolayer.hxx>
#include <sfx2/sidebar/Sidebar.hxx>
#include <sfx2/classificationhelper.hxx>
#include <sdmod.hxx>
#include <model/SlsPageDescriptor.hxx>
#include <model/SlsPageEnumerationProvider.hxx>
#include <SlideSorter.hxx>
#include <view/SlideSorterView.hxx>
#include <SlideSorterViewShell.hxx>
#include <controller/SlideSorterController.hxx>
#include <controller/SlsPageSelector.hxx>
#include <controller/SlsClipboard.hxx>
#include <tools/GraphicSizeCheck.hxx>

#include <theme/ThemeColorChanger.hxx>
#include <svx/dialog/ThemeDialog.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>

#include <ViewShellBase.hxx>
#include <memory>

#include <sfx2/newstyle.hxx>
#include <SelectLayerDlg.hxx>
#include <unomodel.hxx>

#include <iostream>
#include <boost/property_tree/json_parser.hpp>
#include <rtl/uri.hxx>
#include <editeng/editeng.hxx>


using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;

#define MIN_ACTIONS_FOR_DIALOG  5000    ///< if there are more meta objects, we show a dialog during the break up

namespace sd {

namespace {

const SvxFieldItem* findField(editeng::Section const & rSection)
{
    for (SfxPoolItem const * pPool: rSection.maAttributes)
    {
        if (pPool->Which() == EE_FEATURE_FIELD)
            return static_cast<const SvxFieldItem*>(pPool);
    }
    return nullptr;
}

bool hasCustomPropertyField(std::vector<editeng::Section> const & aSections, std::u16string_view rName)
{
    for (editeng::Section const & rSection : aSections)
    {
        const SvxFieldItem* pFieldItem = findField(rSection);
        if (pFieldItem)
        {
            const editeng::CustomPropertyField* pCustomPropertyField = dynamic_cast<const editeng::CustomPropertyField*>(pFieldItem->GetField());
            if (pCustomPropertyField && pCustomPropertyField->GetName() == rName)
                return true;
        }
    }
    return false;
}

OUString getWeightString(SfxItemSet const & rItemSet)
{
    OUString sWeightString = u"NORMAL"_ustr;

    if (const SfxPoolItem* pItem = rItemSet.GetItem(EE_CHAR_WEIGHT, false))
    {
        const SvxWeightItem* pWeightItem = dynamic_cast<const SvxWeightItem*>(pItem);
        if (pWeightItem && pWeightItem->GetWeight() == WEIGHT_BOLD)
            sWeightString = "BOLD";
    }
    return sWeightString;
}

void lcl_LogWarning(const std::string& rWarning)
{
    LOK_WARN("sd.transform", rWarning);
}

void lcl_UnoCommand(const std::string& rText)
{
    if (rText.size() > 0)
    {
        OUString aCmd;
        std::vector<beans::PropertyValue> aArg;
        std::size_t nSpace = rText.find(' ');
        if (nSpace != std::string::npos)
        {
            aCmd = OStringToOUString(rText.substr(0, nSpace), RTL_TEXTENCODING_UTF8);
            std::string aArgText = rText.substr(nSpace + 1);

            aArg = comphelper::JsonToPropertyValues(aArgText);
        }
        else
        {
            aCmd = OStringToOUString(rText, RTL_TEXTENCODING_UTF8);
        }

        OUString aCmdSub;
        if (aCmd.startsWith(".uno:"))
        {
            aCmdSub = aCmd.subView(5);
        }
        else
        {
            lcl_LogWarning("FillApi SlideCmd: uno command not recognized'" + rText + "'");
            return;
        }

        // Check if the uno command is allowed
        const std::map<std::u16string_view, KitUnoCommand>& rUnoCommandList
            = GetKitUnoCommandList();
        auto aCmdData = rUnoCommandList.find(aCmdSub);
        if (aCmdData != rUnoCommandList.end())
        {
            // Make the uno command synchron
            aArg.push_back(comphelper::makePropertyValue("SynchronMode"true));

            // Todo: check why it does not work on my windows system
            comphelper::dispatchCommand(aCmd, comphelper::containerToSequence(aArg));
        }
        else
        {
            lcl_LogWarning("FillApi SlideCmd: uno command not recognized'" + rText + "'");
        }
    }
}

class ClassificationCommon
{
protected:
    sd::DrawViewShell& m_rDrawViewShell;
    uno::Reference<document::XDocumentProperties> m_xDocumentProperties;
    uno::Reference<beans::XPropertyContainer> m_xPropertyContainer;
    sfx::ClassificationKeyCreator m_aKeyCreator;
public:
    ClassificationCommon(sd::DrawViewShell& rDrawViewShell, const css::uno::Reference<css::document::XDocumentProperties>& rDocProps)
        : m_rDrawViewShell(rDrawViewShell)
        , m_xDocumentProperties(rDocProps)
        , m_xPropertyContainer(m_xDocumentProperties->getUserDefinedProperties())
        , m_aKeyCreator(SfxClassificationHelper::getPolicyType())
    {}
};

class ClassificationCollector : public ClassificationCommon
{
private:
    std::vector<svx::ClassificationResult> m_aResults;

    void iterateSectionsAndCollect(std::vector<editeng::Section> const & rSections, EditTextObject const & rEditText)
    {
        sal_Int32 nCurrentParagraph = -1;
        OUString sBlank;

        for (editeng::Section const & rSection : rSections)
        {
            // Insert new paragraph if needed
            while (nCurrentParagraph < rSection.mnParagraph)
            {
                nCurrentParagraph++;
                // Get Weight of current paragraph
                OUString sWeightProperty = getWeightString(rEditText.GetParaAttribs(nCurrentParagraph));
                // Insert new paragraph into collection
                m_aResults.emplace_back(svx::ClassificationType::PARAGRAPH, sWeightProperty, sBlank, sBlank);
            }

            const SvxFieldItem* pFieldItem = findField(rSection);
            const editeng::CustomPropertyField* pCustomPropertyField = pFieldItem ?
                dynamic_cast<const editeng::CustomPropertyField*>(pFieldItem->GetField()) :
                nullptr;
            if (pCustomPropertyField)
            {
                const OUString& aKey = pCustomPropertyField->GetName();
                if (m_aKeyCreator.isMarkingTextKey(aKey))
                {
                    m_aResults.emplace_back(svx::ClassificationType::TEXT,
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
                                           sBlank, sBlank);
                }
                else if (m_aKeyCreator.isCategoryNameKey(aKey) || m_aKeyCreator.isCategoryIdentifierKey(aKey))
                {
                    m_aResults.emplace_back(svx::ClassificationType::CATEGORY,
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
                                           sBlank, sBlank);
                }
                else if (m_aKeyCreator.isMarkingKey(aKey))
                {
                    m_aResults.emplace_back(svx::ClassificationType::MARKING,
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
                                           sBlank, sBlank);
                }
                else if (m_aKeyCreator.isIntellectualPropertyPartKey(aKey))
                {
                    m_aResults.emplace_back(svx::ClassificationType::INTELLECTUAL_PROPERTY_PART,
                                           svx::classification::getProperty(m_xPropertyContainer, aKey),
                                           sBlank, sBlank);
                }
            }
        }
    }

public:
    ClassificationCollector(sd::DrawViewShell & rDrawViewShell, const css::uno::Reference<css::document::XDocumentProperties>& rDocProps)
        : ClassificationCommon(rDrawViewShell, rDocProps)
    {}

    std::vector<svx::ClassificationResult> const & getResults() const
    {
        return m_aResults;
    }

    void collect()
    {
        // Set to MASTER mode
        EditMode eOldMode = m_rDrawViewShell.GetEditMode();
        if (eOldMode != EditMode::MasterPage)
            m_rDrawViewShell.ChangeEditMode(EditMode::MasterPage, false);

        // Scoped guard to revert to the previous mode
        comphelper::ScopeGuard const aGuard([this, eOldMode] () {
            m_rDrawViewShell.ChangeEditMode(eOldMode, false);
        });

        const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);

        for (sal_uInt16 nPageIndex = 0; nPageIndex < nCount; ++nPageIndex)
        {
            SdPage* pMasterPage = m_rDrawViewShell.GetDoc()->GetMasterSdPage(nPageIndex, PageKind::Standard);
            for (const rtl::Reference<SdrObject>& pObject : *pMasterPage)
            {
                SdrRectObj* pRectObject = dynamic_cast<SdrRectObj*>(pObject.get());
                if (pRectObject && pRectObject->GetTextKind() == SdrObjKind::Text)
                {
                    OutlinerParaObject* pOutlinerParagraphObject = pRectObject->GetOutlinerParaObject();
                    if (pOutlinerParagraphObject)
                    {
                        const EditTextObject& rEditText = pOutlinerParagraphObject->GetTextObject();
                        std::vector<editeng::Section> aSections;
                        rEditText.GetAllSections(aSections);

                        // Search for a custom property field that has the classification category identifier key
                        if (hasCustomPropertyField(aSections, m_aKeyCreator.makeCategoryNameKey()))
                        {
                            iterateSectionsAndCollect(aSections, rEditText);
                            return;
                        }
                    }
                }
            }
        }
    }
};

class ClassificationInserter : public ClassificationCommon
{
private:
    /// Delete the previous existing classification object(s) - if they exist
    void deleteExistingObjects()
    {
        OUString sKey = m_aKeyCreator.makeCategoryNameKey();

        const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);

        for (sal_uInt16 nPageIndex = 0; nPageIndex < nCount; ++nPageIndex)
        {
            SdPage* pMasterPage = m_rDrawViewShell.GetDoc()->GetMasterSdPage(nPageIndex, PageKind::Standard);
            for (const rtl::Reference<SdrObject>& pObject : *pMasterPage)
            {
                SdrRectObj* pRectObject = dynamic_cast<SdrRectObj*>(pObject.get());
                if (pRectObject && pRectObject->GetTextKind() == SdrObjKind::Text)
                {
                    OutlinerParaObject* pOutlinerParagraphObject = pRectObject->GetOutlinerParaObject();
                    if (pOutlinerParagraphObject)
                    {
                        const EditTextObject& rEditText = pOutlinerParagraphObject->GetTextObject();
                        std::vector<editeng::Section> aSections;
                        rEditText.GetAllSections(aSections);

                        if (hasCustomPropertyField(aSections, sKey))
                        {
                            pMasterPage->RemoveObject(pRectObject->GetOrdNum());
                        }
                    }
                }
            }
        }
    }

    void fillTheOutliner(Outliner* pOutliner, std::vector<svx::ClassificationResult> const &&nbsp;rResults)
    {
        sal_Int32 nParagraph = -1;
        for (svx::ClassificationResult const & rResult : rResults)
        {

            ESelection aPosition(nParagraph, EE_TEXTPOS_MAX);

            switch (rResult.meType)
            {
                case svx::ClassificationType::TEXT:
                {
                    OUString sKey = m_aKeyCreator.makeNumberedTextKey();
                    svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                }
                break;

                case svx::ClassificationType::CATEGORY:
                {
                    OUString sKey = m_aKeyCreator.makeCategoryNameKey();
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                }
                break;

                case svx::ClassificationType::MARKING:
                {
                    OUString sKey = m_aKeyCreator.makeNumberedMarkingKey();
                    svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                }
                break;

                case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
                {
                    OUString sKey = m_aKeyCreator.makeNumberedIntellectualPropertyPartKey();
                    svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
                    pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                }
                break;

                case svx::ClassificationType::PARAGRAPH:
                {
                    nParagraph++;
                    pOutliner->Insert(u""_ustr);

                    SfxItemSetFixed<EE_ITEMS_START, EE_ITEMS_END> aItemSet(m_rDrawViewShell.GetDoc()->GetPool());

                    if (rResult.msName == "BOLD")
                        aItemSet.Put(SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT));
                    else
                        aItemSet.Put(SvxWeightItem(WEIGHT_NORMAL, EE_CHAR_WEIGHT));

                    SvxNumRule aDefaultNumRule(SvxNumRuleFlags::NONE, 0, false);
                    aItemSet.Put(SvxNumBulletItem(std::move(aDefaultNumRule), EE_PARA_NUMBULLET));

                    pOutliner->SetParaAttribs(nParagraph, aItemSet);
                }
                break;

                default:
                break;
            }
        }
    }

public:
    ClassificationInserter(sd::DrawViewShell & rDrawViewShell, const css::uno::Reference<css::document::XDocumentProperties>& rDocProps)
        : ClassificationCommon(rDrawViewShell, rDocProps)
    {
    }

    void insert(std::vector<svx::ClassificationResult> const & rResults)
    {
        // Set to MASTER mode
        EditMode eOldMode = m_rDrawViewShell.GetEditMode();
        if (eOldMode != EditMode::MasterPage)
            m_rDrawViewShell.ChangeEditMode(EditMode::MasterPage, false);

        // Scoped guard to revert the mode
        comphelper::ScopeGuard const aGuard([this, eOldMode] () {
            m_rDrawViewShell.ChangeEditMode(eOldMode, false);
        });

        // Delete the previous existing object - if exists
        deleteExistingObjects();

        // Clear properties
        svx::classification::removeAllProperties(m_xPropertyContainer);

        SfxClassificationHelper aHelper(m_xDocumentProperties);

        // Apply properties from the BA policy
        for (svx::ClassificationResult const & rResult : rResults)
        {
            if (rResult.meType == svx::ClassificationType::CATEGORY)
                aHelper.SetBACName(rResult.msName, SfxClassificationHelper::getPolicyType());
        }

        // Insert full text as document property
        svx::classification::insertFullTextualRepresentationAsDocumentProperty(m_xPropertyContainer, m_aKeyCreator, rResults);

        // Create the outliner from the
        Outliner* pOutliner = m_rDrawViewShell.GetDoc()->GetInternalOutliner();
        OutlinerMode eOutlinerMode = pOutliner->GetOutlinerMode();

        comphelper::ScopeGuard const aOutlinerGuard([pOutliner, eOutlinerMode] () {
            pOutliner->Init(eOutlinerMode);
        });

        pOutliner->Init(OutlinerMode::TextObject);

        // Fill the outliner with the text from classification result
        fillTheOutliner(pOutliner, rResults);

        // Calculate to outliner text size
        pOutliner->UpdateFields();
        pOutliner->SetUpdateLayout(true);
        Size aTextSize(pOutliner->CalcTextSize());
        pOutliner->SetUpdateLayout(false);

        // Create objects, apply the outliner and add them (objects) to all master pages
        const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);

        for (sal_uInt16 nPageIndex = 0; nPageIndex < nCount; ++nPageIndex)
        {
            SdPage* pMasterPage = m_rDrawViewShell.GetDoc()->GetMasterSdPage(nPageIndex, PageKind::Standard);
            if (!pMasterPage)
                continue;

            rtl::Reference<SdrRectObj> pObject = new SdrRectObj(
                *m_rDrawViewShell.GetDoc(), // TTTT should be reference
                SdrObjKind::Text);
            pObject->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
            pObject->SetOutlinerParaObject(pOutliner->CreateParaObject());
            pMasterPage->InsertObject(pObject.get());

            // Calculate position
            ::tools::Rectangle aRectangle(Point(), pMasterPage->GetSize());
            Point aPosition(aRectangle.Center().X(), aRectangle.Bottom());

            aPosition.AdjustX( -(aTextSize.Width() / 2) );
            aPosition.AdjustY( -(aTextSize.Height()) );

            pObject->SetLogicRect(::tools::Rectangle(aPosition, aTextSize));
        }
    }
};

    void lcl_convertStringArguments(sal_uInt16 nSId, const std::unique_ptr<SfxItemSet>& ;pArgs)
    {
        const SfxPoolItem* pItem = nullptr;

        if (nSId == SID_ATTR_FILL_COLOR)
        {
            pItem = pArgs->GetItem(SID_ATTR_FILL_COLOR);
            Color aColor = pItem ? static_cast<const XFillColorItem*>(pItem)->GetColorValue() : COL_AUTO;
            if (aColor.IsFullyTransparent())
            {
                const XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
                pArgs->Put(aXFillStyleItem);
            }
            else
            {
                SfxItemState eState = pArgs->GetItemState(SID_ATTR_FILL_STYLE, false, &pItem);
                if (eState != SfxItemState::SET || static_cast<const XFillStyleItem*>(pItem)->GetValue() == drawing::FillStyle_NONE)
                {
                    const XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID);
                    pArgs->Put(aXFillStyleItem);
                }
            }
        }
        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
        {
            double fValue = static_cast<const SvxDoubleItem*>(pItem)->GetValue();
            // FIXME: different units...
            int nPow = 100;
            int nValue = fValue * nPow;

            XLineWidthItem aItem(nValue);
            pArgs->Put(aItem);
        }
        if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
        {
            const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
            if (pJSON)
            {
                basegfx::BGradient aGradient = basegfx::BGradient::fromJSON(pJSON->GetValue());
                XFillGradientItem aItem(aGradient);
                pArgs->Put(aItem);
            }
        }
    }
}

/**
 * SfxRequests for temporary actions
 */


void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
    // during a native slide show nothing gets executed!
    if(SlideShow::IsRunning( GetViewShellBase() )
        && !SlideShow::IsInteractiveSlideshow( &GetViewShellBase() ) // IASS
        && (rReq.GetSlot() != SID_NAVIGATOR))
        return;

    DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
    if( !mpDrawView )
        return;

    CheckLineTo (rReq);

    DeactivateCurrentFunction();

    sal_uInt16 nSId = rReq.GetSlot();
    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();

    switch ( nSId )
    {
        case SID_OUTLINE_TEXT_AUTOFIT:
        {
            SfxUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
            if( rMarkList.GetMarkCount() == 1 )
            {
                pUndoManager->EnterListAction(u""_ustr, u""_ustr, 0, GetViewShellBase().GetViewShellId());
                mpDrawView->BegUndo();

                SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
                bool bSet = pObj->GetMergedItemSet().GetItem<SdrTextFitToSizeTypeItem>(SDRATTR_TEXT_FITTOSIZE)->GetValue() != drawing::TextFitToSizeType_NONE;

                mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));

                if (!bSet)
                {
                    //If we are turning on AutoFit we have to turn these off if already on
                    if (pObj->GetMergedItemSet().GetItem<SdrOnOffItem>(SDRATTR_TEXT_AUTOGROWHEIGHT)->GetValue())
                        pObj->SetMergedItem(makeSdrTextAutoGrowHeightItem(false));
                    if (pObj->GetMergedItemSet().GetItem<SdrOnOffItem>(SDRATTR_TEXT_AUTOGROWWIDTH)->GetValue())
                        pObj->SetMergedItem(makeSdrTextAutoGrowWidthItem(false));
                }

                pObj->SetMergedItem(SdrTextFitToSizeTypeItem(bSet ? drawing::TextFitToSizeType_NONE : drawing::TextFitToSizeType_AUTOFIT));

                mpDrawView->EndUndo();
                pUndoManager->LeaveListAction();
            }
            Cancel();
            rReq.Done();
        }
        break;

        // area and line attributes: shall have
        // an own Execute method (like StateMethode)
        case SID_ATTR_FILL_STYLE:
        case SID_ATTR_FILL_COLOR:
        case SID_ATTR_FILL_GRADIENT:
        case SID_ATTR_FILL_HATCH:
        case SID_ATTR_FILL_BITMAP:
        case SID_ATTR_FILL_SHADOW:
        case SID_ATTR_SHADOW_COLOR:
        case SID_ATTR_SHADOW_TRANSPARENCE:
        case SID_ATTR_SHADOW_BLUR:
        case SID_ATTR_SHADOW_XDISTANCE:
        case SID_ATTR_SHADOW_YDISTANCE:
        case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
        case SID_ATTR_FILL_TRANSPARENCE:
        case SID_ATTR_FILL_FLOATTRANSPARENCE:

        case SID_ATTR_LINE_STYLE:
        case SID_ATTR_LINE_DASH:
        case SID_ATTR_LINE_WIDTH:
        case SID_ATTR_LINE_COLOR:
        case SID_ATTR_LINEEND_STYLE:
        case SID_ATTR_LINE_START:
        case SID_ATTR_LINE_END:
        case SID_ATTR_LINE_TRANSPARENCE:
        case SID_ATTR_LINE_JOINT:
        case SID_ATTR_LINE_CAP:

        case SID_ATTR_TEXT_FITTOSIZE:
        {
            if( rReq.GetArgs() )
            {
                std::unique_ptr<SfxItemSet> pNewArgs = rReq.GetArgs()->Clone();
                lcl_convertStringArguments(nSId, pNewArgs);
                mpDrawView->SetAttributes(*pNewArgs);
                rReq.Done();
            }
            else
            {
                switch( rReq.GetSlot() )
                {
                    case SID_ATTR_FILL_SHADOW:
                    case SID_ATTR_SHADOW_COLOR:
                    case SID_ATTR_SHADOW_TRANSPARENCE:
                    case SID_ATTR_SHADOW_BLUR:
                    case SID_ATTR_SHADOW_XDISTANCE:
                    case SID_ATTR_SHADOW_YDISTANCE:
                    case SID_ATTR_FILL_STYLE:
                    case SID_ATTR_FILL_COLOR:
                    case SID_ATTR_FILL_GRADIENT:
                    case SID_ATTR_FILL_HATCH:
                    case SID_ATTR_FILL_BITMAP:
                    case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
                    case SID_ATTR_FILL_TRANSPARENCE:
                    case SID_ATTR_FILL_FLOATTRANSPARENCE:
                        GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SfxCallMode::ASYNCHRON );
                        break;
                    case SID_ATTR_LINE_STYLE:
                    case SID_ATTR_LINE_DASH:
                    case SID_ATTR_LINE_WIDTH:
                    case SID_ATTR_LINE_COLOR:
                    case SID_ATTR_LINE_TRANSPARENCE:
                    case SID_ATTR_LINE_JOINT:
                    case SID_ATTR_LINE_CAP:
                        GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SfxCallMode::ASYNCHRON );
                        break;
                    case SID_ATTR_TEXT_FITTOSIZE:
                        GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SfxCallMode::ASYNCHRON );
                        break;
                }
            }
            Cancel();
        }
        break;

        case SID_HYPHENATION:
        {
            const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(SID_HYPHENATION);

            if( pItem )
            {
                SfxItemSetFixed<EE_PARA_HYPHENATE, EE_PARA_HYPHENATE> aSet( GetPool() );
                bool bValue = pItem->GetValue();
                aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
                mpDrawView->SetAttributes( aSet );
            }
            else // only for testing purpose
            {
                OSL_FAIL(" no value for hyphenation!");
                SfxItemSetFixed<EE_PARA_HYPHENATE, EE_PARA_HYPHENATE> aSet( GetPool() );
                aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, true ) );
                mpDrawView->SetAttributes( aSet );
            }
            rReq.Done();
            Cancel();
        }
        break;

        case FN_TRANSFORM_DOCUMENT_STRUCTURE:
        {
            // get the parameter, what to transform
            OUString aDataJson;
            const SfxStringItem* pDataJson = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
            if (pDataJson)
            {
                aDataJson = pDataJson->GetValue();
                aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8);
            }

            // parse the JSON transform parameter
            boost::property_tree::ptree aTree;
            std::stringstream aStream(
                (std::string(OUStringToOString(aDataJson, RTL_TEXTENCODING_UTF8))));
            try
            {
                boost::property_tree::read_json(aStream, aTree);
            }
            catch (...)
            {
                lcl_LogWarning("FillApi Transform parameter, Wrong JSON format. ");
                throw;
            }

            // Iterate through the JSON data loaded into a tree structure
            for (const auto& aItem : aTree)
            {
                if (aItem.first == "Transforms")
                {
                    // Handle all transformations
                    for (const auto& aItem2Obj : aItem.second)
                    {
                        // handle `"Transforms": { `  and `"Transforms": [` cases as well
                        // if an element is an object `{...}`, then get the first element of the object
                        const auto& aItem2
                            = aItem2Obj.first == "" ? *aItem2Obj.second.ordered_begin() : aItem2Obj;

                        //jump to slide
                        if (aItem2.first == "SlideCommands")
                        {
                            int nActPageId = -1;
                            int nNextPageId = 0;
                            for (const auto& aItem3Obj : aItem2.second)
                            {
                                // It accept direct property, or object as well
                                const auto& aItem3 = aItem3Obj.first == ""
                                                         ? *aItem3Obj.second.ordered_begin()
                                                         : aItem3Obj;

                                sal_uInt16 nPageCount
                                    = GetDoc()->GetSdPageCount(PageKind::Standard);
                                sal_uInt16 nMasterPageCount
                                    = GetDoc()->GetMasterSdPageCount(PageKind::Standard);

                                if (nActPageId != nNextPageId)
                                {
                                    // Make it sure it always point to a real page
                                    if (nNextPageId < 0)
                                        nNextPageId = 0;
                                    if (nNextPageId >= nPageCount)
                                        nNextPageId = nPageCount - 1;

                                    nActPageId = nNextPageId;
                                    // Make sure nActPageId is the current Page
                                    maTabControl->SetCurPageId(nActPageId);
                                    SdPage* pPageStandard
                                        = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
                                    mpDrawView->ShowSdrPage(pPageStandard);
                                }

                                if (aItem3.first == "JumpToSlide")
                                {
                                    std::string aIndex = aItem3.second.get_value<std::string>();
                                    if (aIndex == "last")
                                    {
                                        nNextPageId = nPageCount - 1;
                                    }
                                    else
                                    {
                                        nNextPageId = aItem3.second.get_value<int>();
                                        if (nNextPageId >= nPageCount)
                                        {
                                            lcl_LogWarning(
                                                "FillApi SlideCmd: Slide idx >= Slide count. '"
                                                + aItem3.first + ": " + aIndex
                                                + "' (Slide count = " + std::to_string(nPageCount));
                                            nNextPageId = nPageCount - 1;
                                        }
                                        else if (nNextPageId < 0)
                                        {
                                            lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
                                                           + aItem3.first + ": " + aIndex + "'");
                                            nNextPageId = 0;
                                        }
                                    }
                                }
                                if (aItem3.first == "JumpToSlideByName")
                                {
                                    std::string aPageName = aItem3.second.get_value<std::string>();
                                    int nId = 0;
                                    while (
                                        nId < nPageCount
                                        && GetDoc()->GetSdPage(nId, PageKind::Standard)->GetName()
                                               != OStringToOUString(aPageName,
                                                                    RTL_TEXTENCODING_UTF8))
                                    {
                                        nId++;
                                    }
                                    if (nId < nPageCount)
                                    {
                                        nNextPageId = nId;
                                    }
                                    else
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Slide name not found at: '"
                                            + aItem3.first + ": " + aPageName + "'");
                                    }
                                }
                                else if (aItem3.first == "InsertMasterSlide"
                                         || aItem3.first == "InsertMasterSlideByName")
                                {
                                    int nMasterPageId = 0;
                                    if (aItem3.first == "InsertMasterSlideByName")
                                    {
                                        int nMId = 0;
                                        std::string aMPageName
                                            = aItem3.second.get_value<std::string>();
                                        while (
                                            nMId < nMasterPageCount
                                            && GetDoc()->GetMasterSdPage(nMId, PageKind::Standard)
                                                       ->GetName()
                                                   != OStringToOUString(aMPageName,
                                                       RTL_TEXTENCODING_UTF8))
                                        {
                                            nMId++;
                                        }
                                        if (nMId < nMasterPageCount)
                                        {
                                            nMasterPageId = nMId;
                                        }
                                        else
                                        {
                                            lcl_LogWarning(
                                                "FillApi SlideCmd: MasterSlide name not found at: '"
                                                + aItem3.first + ": " + aMPageName + "'");
                                        }
                                    }
                                    else
                                    {
                                        nMasterPageId = aItem3.second.get_value<int>();
                                    }

                                    if (nMasterPageId >= nMasterPageCount)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Slide idx >= MasterSlide count. '"
                                            + aItem3.first + ": " + std::to_string(nMasterPageId)
                                            + "' (Slide count = " + std::to_string(nMasterPageCount));
                                        nMasterPageId = nMasterPageCount - 1;
                                    }
                                    else if (nMasterPageId < 0)
                                    {
                                        lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
                                                       + aItem3.first + ": "
                                                       + std::to_string(nMasterPageId) + "'");
                                        nMasterPageId = 0;
                                    }

                                    SdPage* pMPage = GetDoc()->GetMasterSdPage(nMasterPageId,
                                                                               PageKind::Standard);
                                    SdPage* pPage
                                        = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);

                                    // It will move to the next slide.
                                    nNextPageId = GetDoc()->CreatePage(
                                        pPage, PageKind::Standard, OUString(), OUString(),
                                        AUTOLAYOUT_TITLE_CONTENT, AUTOLAYOUT_NOTES, truetrue,
                                        pPage->GetPageNum() + 2);

                                    SdPage* pPageStandard
                                        = GetDoc()->GetSdPage(nNextPageId, PageKind::Standard);
                                    SdPage* pPageNote
                                        = GetDoc()->GetSdPage(nNextPageId, PageKind::Notes);

                                    // Change master value
                                    pPageStandard->TRG_SetMasterPage(*pMPage);
                                    pPageNote->TRG_SetMasterPage(*pMPage);
                                }
                                else if (aItem3.first == "DeleteSlide")
                                {
                                    int nPageIdToDel = nActPageId;
                                    if (aItem3.second.get_value<std::string>() != "")
                                    {
                                        nPageIdToDel = aItem3.second.get_value<int>();
                                    }

                                    if (nPageCount > 1)
                                    {
                                        if (nPageIdToDel >= nPageCount)
                                        {
                                            lcl_LogWarning(
                                                "FillApi SlideCmd: Slide idx >= Slide count. '"
                                                + aItem3.first + ": " + std::to_string(nPageIdToDel)
                                                + "' (Slide count = " + std::to_string(nPageCount));
                                            nPageIdToDel = nPageCount - 1;
                                        }
                                        else if (nPageIdToDel < 0)
                                        {
                                            lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
                                                           + aItem3.first + ": "
                                                           + std::to_string(nPageIdToDel) + "'");
                                            nPageIdToDel = 0;
                                        }
                                        GetDoc()->RemovePage(nPageIdToDel * 2 + 1);
                                        GetDoc()->RemovePage(nPageIdToDel * 2 + 1);

                                        if (nPageIdToDel <= nActPageId)
                                        {
                                            nNextPageId--;
                                        }
                                    }
                                    else
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Not enough Slide to delete 1. '"
                                            + aItem3.first + ": " + std::to_string(nPageIdToDel));
                                    }
                                }
                                else if (aItem3.first.starts_with("MoveSlide"))
                                {
                                    int nMoveFrom = nActPageId;
                                    if (aItem3.first.starts_with("MoveSlide."))
                                    {
                                        nMoveFrom = stoi(aItem3.first.substr(10));
                                    }
                                    int nMoveTo = aItem3.second.get_value<int>();

                                    if (nMoveFrom == nMoveTo)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Move slide to the same position. '"
                                            + aItem3.first + ": " + std::to_string(nMoveTo));
                                    }
                                    else if (nMoveFrom >= nPageCount || nMoveTo > nPageCount)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Slide idx >= Slide count. '"
                                            + aItem3.first + ": " + std::to_string(nMoveTo));
                                    }
                                    else if (nMoveFrom < 0 || nMoveTo < 0)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Slide idx < 0. '"
                                            + aItem3.first + ": " + std::to_string(nMoveTo));
                                    }
                                    else
                                    {
                                        // Move both the standard and the Note Page.
                                        // First move the page that will not change
                                        // the order of the other page.
                                        int nFirst = 1;
                                        if (nMoveFrom < nMoveTo)
                                        {
                                            nFirst = 2;
                                        }
                                        int nSecond = 3 - nFirst;

                                        GetDoc()->MovePage(nMoveFrom * 2 + nFirst,
                                                           nMoveTo * 2 + nFirst);
                                        GetDoc()->MovePage(nMoveFrom * 2 + nSecond,
                                                           nMoveTo * 2 + nSecond);

                                        // If the act page is moved, then follow it.
                                        if (nActPageId == nMoveFrom)
                                        {
                                            nNextPageId = nMoveTo;
                                        }
                                        else if (nMoveFrom < nActPageId && nMoveTo >= nActPageId)
                                        {
                                            nNextPageId = nActPageId - 1;
                                        }
                                        else if (nMoveFrom > nActPageId && nMoveTo <= nActPageId)
                                        {
                                            nNextPageId = nActPageId + 1;
                                        }
                                    }
                                }
                                else if (aItem3.first == "DuplicateSlide")
                                {
                                    int nDupSlideId = nActPageId;
                                    if (aItem3.second.get_value<std::string>() != "")
                                    {
                                        nDupSlideId = aItem3.second.get_value<int>();
                                    }

                                    if (nDupSlideId >= nPageCount)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Slide idx >= Slide count. '"
                                            + aItem3.first + ": " + std::to_string(nDupSlideId)
                                            + "' (Slide count = " + std::to_string(nPageCount));
                                        nDupSlideId = nPageCount - 1;
                                    }
                                    else if (nDupSlideId < 0)
                                    {
                                        lcl_LogWarning("FillApi SlideCmd: Slide idx < 0. '"
                                                       + aItem3.first + ": "
                                                       + std::to_string(nDupSlideId) + "'");
                                        nDupSlideId = 0;
                                    }
                                    GetDoc()->DuplicatePage(nDupSlideId);
                                    // Jump to the created page.
                                    nNextPageId = nDupSlideId + 1;
                                    // Make sure the current page will be set also.
                                    nActPageId = nDupSlideId;
                                }
                                else if (aItem3.first == "ChangeLayout"
                                         || aItem3.first == "ChangeLayoutByName")
                                {
                                    AutoLayout nLayoutId;
                                    if (aItem3.first == "ChangeLayoutByName")
                                    {
                                        std::string aLayoutName
                                            = aItem3.second.get_value<std::string>();

                                        nLayoutId = SdPage::stringToAutoLayout(
                                            OStringToOUString(aLayoutName, RTL_TEXTENCODING_UTF8));
                                        if (nLayoutId == AUTOLAYOUT_END)
                                        {
                                            lcl_LogWarning(
                                                "FillApi SlideCmd: Layout name not found at: '"
                                                + aItem3.first + ": " + aLayoutName + "'");
                                            nLayoutId = AUTOLAYOUT_TITLE_CONTENT;
                                        }
                                    }
                                    else
                                    {
                                        nLayoutId = static_cast<AutoLayout>(
                                            aItem3.second.get_value<int>());
                                        if (nLayoutId < AUTOLAYOUT_START
                                            || nLayoutId >= AUTOLAYOUT_END)
                                        {
                                            lcl_LogWarning(
                                                "FillApi SlideCmd: Wrong Layout index at: '"
                                                + aItem3.first + ": " + std::to_string(nLayoutId)
                                                + "'");
                                            nLayoutId = AUTOLAYOUT_TITLE_CONTENT;
                                        }
                                    }

                                    // Todo warning:  ... if (nLayoutId >= ???)
                                    GetDoc()
                                        ->GetSdPage(nActPageId, PageKind::Standard)
                                        ->SetAutoLayout(nLayoutId, true);
                                }
                                else if (aItem3.first == "RenameSlide")
                                {
                                    SdPage* pPageStandard
                                        = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
                                    pPageStandard->SetName(
                                        OStringToOUString(aItem3.second.get_value<std::string>(),
                                                          RTL_TEXTENCODING_UTF8));
                                }
                                else if (aItem3.first.starts_with("SetText."))
                                {
                                    int nObjId = stoi(aItem3.first.substr(8));

                                    SdPage* pPageStandard
                                        = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
                                    int nObjCount = pPageStandard->GetObjCount();
                                    if (nObjId < 0)
                                    {
                                        lcl_LogWarning("FillApi SlideCmd SetText: Object idx < 0. '"
                                                       + aItem3.first + "'");
                                    }
                                    else if (nObjId < nObjCount)
                                    {
                                        SdrObject* pSdrObj = pPageStandard->GetObj(nObjId);
                                        if (pSdrObj->IsSdrTextObj())
                                        {
                                            SdrTextObj* pSdrTxt = static_cast<SdrTextObj*>(pSdrObj);
                                            pSdrTxt->SetText(OStringToOUString(
                                                aItem3.second.get_value<std::string>(),
                                                RTL_TEXTENCODING_UTF8));

                                            // Todo: maybe with empty string it should work elseway?
                                            pSdrObj->SetEmptyPresObj(false);
                                        }
                                    }
                                    else
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd SetText: Object idx >= Object Count. '"
                                            + aItem3.first
                                            + "' (Object Count = " + std::to_string(nPageCount));
                                    }
                                }
                                else if (aItem3.first == "MarkObject"
                                         || aItem3.first == "UnMarkObject")
                                {
                                    bool bUnMark = aItem3.first == "UnMarkObject";
                                    int nObjId = aItem3.second.get_value<int>();

                                    SdPage* pPageStandard
                                        = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
                                    int nObjCount = pPageStandard->GetObjCount();

                                    // Todo: check id vs count
                                    if (nObjId < 0)
                                    {
                                        lcl_LogWarning("FillApi SlideCmd: Object idx < 0 at: '"
                                                       + aItem3.first + std::to_string(nObjId)
                                                       + "'");
                                    }
                                    if (nObjId < nObjCount)
                                    {
                                        SdrObject* pSdrObj = pPageStandard->GetObj(nObjId);
                                        mpDrawView->MarkObj(pSdrObj, mpDrawView->GetSdrPageView(),
                                                            bUnMark);
                                    }
                                    else
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd: Object idx > Object Count. '"
                                            + aItem3.first + std::to_string(nObjId)
                                            + "' (Object Count = " + std::to_string(nObjId));
                                    }
                                }

                                else if (aItem3.first.starts_with("EditTextObject."))
                                {
                                    int nObjId = stoi(aItem3.first.substr(15));
                                    SdPage* pPageStandard
                                        = GetDoc()->GetSdPage(nActPageId, PageKind::Standard);
                                    int nObjCount = pPageStandard->GetObjCount();
                                    if (nObjId < 0)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd EditTextObject: Object idx < 0. '"
                                            + aItem3.first + "'");
                                    }
                                    else if (nObjId >= nObjCount)
                                    {
                                        lcl_LogWarning(
                                            "FillApi SlideCmd EditTextObject: Object idx >= "
                                            "Object Count. '"
                                            + aItem3.first
                                            + "' (Object Count = " + std::to_string(nPageCount));
                                    }
                                    else
                                    {
                                        SdrObject* pSdrObj = pPageStandard->GetObj(nObjId);
                                        if (!pSdrObj->IsSdrTextObj())
                                        {
                                            lcl_LogWarning(
                                                "FillApi SlideCmd EditTextObject: Object is "
                                                "not a TextObject. '"
                                                + aItem3.first + "'");
                                        }
                                        else
                                        {
                                            SdrTextObj* pSdrTxt = static_cast<SdrTextObj*>(pSdrObj);
                                            SdrView* pView1 = GetView();
                                            pView1->MarkObj(pSdrTxt, pView1->GetSdrPageView());
                                            pView1->SdrBeginTextEdit(pSdrTxt);
                                            EditView& rEditView
                                                = pView1->GetTextEditOutlinerView()->GetEditView();
                                            for (const auto& aItem4Obj : aItem3.second)
                                            {
                                                const auto& aItem4
                                                    = aItem4Obj.first == ""
                                                          ? *aItem4Obj.second.ordered_begin()
                                                          : aItem4Obj;

                                                if (aItem4.first == "SelectText")
                                                {
                                                    std::vector<int> aValues;
                                                    for (const auto& aItem5 : aItem4.second)
                                                    {
                                                        //if == last?
                                                        aValues.push_back(aItem5.second.get_value<int>());
                                                    }
                                                    if (aValues.size() == 0)
                                                    {
                                                        //select the whole text
                                                        aValues.push_back(0);
                                                        aValues.push_back(0);
                                                        aValues.push_back(EE_PARA_MAX);
                                                        aValues.push_back(EE_TEXTPOS_MAX);
                                                    }
                                                    else if (aValues.size() == 1)
                                                    {
                                                        //select the paragraph
                                                        aValues.push_back(0);
                                                        aValues.push_back(aValues[0]);
                                                        aValues.push_back(EE_TEXTPOS_MAX);
                                                    }
                                                    else if (aValues.size() == 2)
                                                    {
                                                        // set the cursor without selecting anything
                                                        aValues.push_back(aValues[0]);
                                                        aValues.push_back(aValues[1]);
                                                    }
                                                    else if (aValues.size() == 3)
                                                    {
                                                        aValues.push_back(EE_TEXTPOS_MAX);
                                                    }

                                                    const ESelection rNewSel(aValues[0], aValues[1],
                                                                             aValues[2], aValues[3]);
                                                    rEditView.SetSelection(rNewSel);
                                                }
                                                else if (aItem4.first == "SelectParagraph")
                                                {
                                                    int nParaId = aItem4.second.get_value<int>();

                                                    const ESelection rNewSel(nParaId, 0, nParaId,
                                                                             EE_TEXTPOS_MAX);
                                                    rEditView.SetSelection(rNewSel);
                                                }
                                                else if (aItem4.first == "InsertText")
                                                {
                                                    OUString aText = OStringToOUString(
                                                        aItem4.second.get_value<std::string>(),
                                                        RTL_TEXTENCODING_UTF8);
                                                    // It select the inserted text also
                                                    rEditView.InsertText(aText, true);
                                                }
                                                else if (aItem4.first == "UnoCommand")
                                                {
                                                    std::string aText
                                                        = aItem4.second.get_value<std::string>();
                                                    lcl_UnoCommand(aText);
                                                }
                                            }
                                            pView1->SdrEndTextEdit();
                                        }
                                    }
                                }
                                else if (aItem3.first == "UnoCommand")
                                {
                                    std::string aText = aItem3.second.get_value<std::string>();
                                    lcl_UnoCommand(aText);
                                }
                            }
                        }
                    }
                }
            }
            rReq.Done();
        }
        break;

        case SID_INSERTPAGE:
        case SID_INSERTPAGE_QUICK:
        {
            SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
            Cancel();
            if(HasCurrentFunction(SID_BEZIER_EDIT) )
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
            if (pNewPage != nullptr)
                SwitchPage((pNewPage->GetPageNum()-1)/2);
            rReq.Done ();
        }
        break;

        case SID_DUPLICATE_PAGE:
        {
            auto slideSorter = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
            SdPage* pNewPage = nullptr;
            if(slideSorter)
                DuplicateSelectedSlides(rReq);
            else
                pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
            Cancel();
            if(HasCurrentFunction(SID_BEZIER_EDIT) )
                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
            if(!slideSorter && pNewPage != nullptr)
                SwitchPage((pNewPage->GetPageNum()-1)/2);
            rReq.Done();
        }
        break;

        case SID_INSERT_MASTER_PAGE:
        {
            // Use the API to create a new page.
            rtl::Reference<SdXImpressDocument> xMasterPagesSupplier (
                GetDoc()->getUnoModel());
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=94 H=97 G=95

¤ Dauer der Verarbeitung: 0.23 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge