1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <editeng/eeitem.hxx>
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>
33 #include <drtxtob.hxx>
34 #include <drawview.hxx>
35 #include <viewdata.hxx>
36 #include <gridwin.hxx>
38 #include <scabstdlg.hxx>
40 bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet
& rArgs
,
41 SfxItemSet
& rOutSet
, sal_uInt16 nSlot
)
43 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
44 ScopedVclPtr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateScCharDlg(
45 mrViewData
.GetDialogParent(), &rArgs
,
46 mrViewData
.GetSfxDocShell(), true));
47 if (nSlot
== SID_CHAR_DLG_EFFECT
)
49 pDlg
->SetCurPageId(u
"fonteffects"_ustr
);
51 bool bRet
= ( pDlg
->Execute() == RET_OK
);
55 const SfxItemSet
* pNewAttrs
= pDlg
->GetOutputItemSet();
57 rOutSet
.Put( *pNewAttrs
);
63 bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet
& rArgs
,
66 SfxItemPool
* pArgPool
= rArgs
.GetPool();
68 EE_ITEMS_START
, EE_ITEMS_END
,
69 SID_ATTR_PARA_PAGEBREAK
, SID_ATTR_PARA_WIDOWS
> aNewAttr(*pArgPool
);
70 aNewAttr
.Put( rArgs
);
72 // Values have been taken over once to show the dialog.
74 // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
76 aNewAttr
.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE
) );
77 aNewAttr
.Put( SvxFormatBreakItem( SvxBreak::NONE
, SID_ATTR_PARA_PAGEBREAK
) );
78 aNewAttr
.Put( SvxFormatSplitItem( true, SID_ATTR_PARA_SPLIT
) );
79 aNewAttr
.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS
) );
80 aNewAttr
.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS
) );
82 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
84 ScopedVclPtr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateScParagraphDlg(
85 mrViewData
.GetDialogParent(), &aNewAttr
));
86 bool bRet
= ( pDlg
->Execute() == RET_OK
);
90 const SfxItemSet
* pNewAttrs
= pDlg
->GetOutputItemSet();
92 rOutSet
.Put( *pNewAttrs
);
98 void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest
& /* rReq */ )
100 SdrView
* pView
= mrViewData
.GetScDrawView();
101 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
102 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
103 ScopedVclPtr
<SfxAbstractPasteDialog
> pDlg(pFact
->CreatePasteDialog(mrViewData
.GetDialogParent()));
105 pDlg
->Insert( SotClipboardFormatId::STRING
, OUString() );
106 pDlg
->Insert( SotClipboardFormatId::RTF
, OUString() );
107 pDlg
->Insert( SotClipboardFormatId::RICHTEXT
, OUString() );
108 pDlg
->Insert(SotClipboardFormatId::HTML_SIMPLE
, OUString());
110 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mrViewData
.GetActiveWin() ) );
112 SotClipboardFormatId nFormat
= pDlg
->GetFormat( aDataHelper
.GetTransferable() );
114 //! test if outliner view is still valid
116 if (nFormat
!= SotClipboardFormatId::NONE
)
118 if (nFormat
== SotClipboardFormatId::STRING
)
121 pOutView
->PasteSpecial(nFormat
);
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */