nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / ui / drawfunc / drtxtob1.cxx
blob2e3a76d9f42578ff490f69c05f2037806bcf6ea1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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("fonteffects");
51 bool bRet = ( pDlg->Execute() == RET_OK );
53 if ( bRet )
55 const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
56 if ( pNewAttrs )
57 rOutSet.Put( *pNewAttrs );
60 return bRet;
63 bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
64 SfxItemSet& rOutSet )
66 SfxItemPool* pArgPool = rArgs.GetPool();
67 SfxItemSet aNewAttr(
68 *pArgPool,
69 svl::Items<
70 EE_ITEMS_START, EE_ITEMS_END,
71 SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS>{});
72 aNewAttr.Put( rArgs );
74 // Values have been taken over once to show the dialog.
75 // Has to be changed
76 // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
78 aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
79 aNewAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, SID_ATTR_PARA_PAGEBREAK ) );
80 aNewAttr.Put( SvxFormatSplitItem( true, SID_ATTR_PARA_SPLIT) );
81 aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
82 aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
84 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
86 ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScParagraphDlg(
87 mrViewData.GetDialogParent(), &aNewAttr));
88 bool bRet = ( pDlg->Execute() == RET_OK );
90 if ( bRet )
92 const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
93 if ( pNewAttrs )
94 rOutSet.Put( *pNewAttrs );
97 return bRet;
100 void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
102 SdrView* pView = mrViewData.GetScDrawView();
103 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
104 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
105 ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(mrViewData.GetDialogParent()));
107 pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING );
108 pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING );
109 pDlg->Insert( SotClipboardFormatId::RICHTEXT, EMPTY_OUSTRING );
111 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mrViewData.GetActiveWin() ) );
113 SotClipboardFormatId nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
115 //! test if outliner view is still valid
117 if (nFormat != SotClipboardFormatId::NONE)
119 if (nFormat == SotClipboardFormatId::STRING)
120 pOutView->Paste();
121 else
122 pOutView->PasteSpecial();
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */