Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/source/ui/drawfunc/drtxtob1.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 <editeng/eeitem.hxx>
21
22
#include <svx/svxdlg.hxx>
23
#include <editeng/formatbreakitem.hxx>
24
#include <editeng/hyphenzoneitem.hxx>
25
#include <editeng/orphitem.hxx>
26
#include <editeng/outliner.hxx>
27
#include <editeng/spltitem.hxx>
28
#include <editeng/widwitem.hxx>
29
#include <editeng/editids.hrc>
30
#include <svx/svxids.hrc>
31
#include <vcl/transfer.hxx>
32
33
#include <drtxtob.hxx>
34
#include <drawview.hxx>
35
#include <viewdata.hxx>
36
#include <gridwin.hxx>
37
38
#include <scabstdlg.hxx>
39
40
bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
41
                                                SfxItemSet& rOutSet , sal_uInt16 nSlot)
42
0
{
43
0
    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
44
0
    ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
45
0
        mrViewData.GetDialogParent(), &rArgs,
46
0
        mrViewData.GetSfxDocShell(), true));
47
0
    if (nSlot == SID_CHAR_DLG_EFFECT)
48
0
    {
49
0
        pDlg->SetCurPageId(u"fonteffects"_ustr);
50
0
    }
51
0
    bool bRet = ( pDlg->Execute() == RET_OK );
52
53
0
    if ( bRet )
54
0
    {
55
0
        const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
56
0
        if ( pNewAttrs )
57
0
            rOutSet.Put( *pNewAttrs );
58
0
    }
59
60
0
    return bRet;
61
0
}
62
63
bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
64
                                                SfxItemSet& rOutSet )
65
0
{
66
0
    SfxItemPool* pArgPool = rArgs.GetPool();
67
0
    SfxItemSet aNewAttr(SfxItemSet::makeFixedSfxItemSet<EE_ITEMS_START, EE_ITEMS_END,
68
0
                                                        SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS>(*pArgPool));
69
0
    aNewAttr.Put( rArgs );
70
71
    // Values have been taken over once to show the dialog.
72
    // Has to be changed
73
    // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
74
75
0
    aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
76
0
    aNewAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, SID_ATTR_PARA_PAGEBREAK ) );
77
0
    aNewAttr.Put( SvxFormatSplitItem( true, SID_ATTR_PARA_SPLIT)  );
78
0
    aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
79
0
    aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
80
81
0
    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
82
83
0
    ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScParagraphDlg(
84
0
        mrViewData.GetDialogParent(), &aNewAttr));
85
0
    bool bRet = ( pDlg->Execute() == RET_OK );
86
87
0
    if ( bRet )
88
0
    {
89
0
        const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
90
0
        if ( pNewAttrs )
91
0
            rOutSet.Put( *pNewAttrs );
92
0
    }
93
94
0
    return bRet;
95
0
}
96
97
void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
98
0
{
99
0
    SdrView* pView = mrViewData.GetScDrawView();
100
0
    OutlinerView* pOutView = pView->GetTextEditOutlinerView();
101
0
    SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
102
0
    ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(mrViewData.GetDialogParent()));
103
104
0
    pDlg->Insert( SotClipboardFormatId::STRING, OUString() );
105
0
    pDlg->Insert( SotClipboardFormatId::RTF,    OUString() );
106
0
    pDlg->Insert( SotClipboardFormatId::RICHTEXT,  OUString() );
107
0
    pDlg->Insert(SotClipboardFormatId::HTML_SIMPLE, OUString());
108
109
0
    TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mrViewData.GetActiveWin() ) );
110
111
0
    SotClipboardFormatId nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
112
113
    //! test if outliner view is still valid
114
115
0
    if (nFormat != SotClipboardFormatId::NONE)
116
0
    {
117
0
        if (nFormat == SotClipboardFormatId::STRING)
118
0
            pOutView->Paste();
119
0
        else
120
0
            pOutView->PasteSpecial(nFormat);
121
0
    }
122
0
}
123
124
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */