LibreOffice Module sc (master)  1
drtxtob1.cxx
Go to the documentation of this file.
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>
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 
41  SfxItemSet& rOutSet , sal_uInt16 nSlot)
42 {
45  mrViewData.GetDialogParent(), &rArgs,
46  mrViewData.GetSfxDocShell(), true));
47  if (nSlot == SID_CHAR_DLG_EFFECT)
48  {
49  pDlg->SetCurPageId("fonteffects");
50  }
51  bool bRet = ( pDlg->Execute() == RET_OK );
52 
53  if ( bRet )
54  {
55  const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
56  if ( pNewAttrs )
57  rOutSet.Put( *pNewAttrs );
58  }
59 
60  return bRet;
61 }
62 
64  SfxItemSet& rOutSet )
65 {
66  SfxItemPool* pArgPool = rArgs.GetPool();
67  SfxItemSet aNewAttr(
68  *pArgPool,
69  svl::Items<
71  SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS>{});
72  aNewAttr.Put( rArgs );
73 
74  // Values have been taken over once to show the dialog.
75  // Has to be changed
76  // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
77 
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) );
83 
85 
87  mrViewData.GetDialogParent(), &aNewAttr));
88  bool bRet = ( pDlg->Execute() == RET_OK );
89 
90  if ( bRet )
91  {
92  const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
93  if ( pNewAttrs )
94  rOutSet.Put( *pNewAttrs );
95  }
96 
97  return bRet;
98 }
99 
101 {
102  SdrView* pView = mrViewData.GetScDrawView();
103  OutlinerView* pOutView = pView->GetTextEditOutlinerView();
105  ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(mrViewData.GetDialogParent()));
106 
107  pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING );
108  pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING );
109  pDlg->Insert( SotClipboardFormatId::RICHTEXT, EMPTY_OUSTRING );
110 
112 
113  SotClipboardFormatId nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
114 
116 
117  if (nFormat != SotClipboardFormatId::NONE)
118  {
119  if (nFormat == SotClipboardFormatId::STRING)
120  pOutView->Paste();
121  else
122  pOutView->PasteSpecial();
123  }
124 }
125 
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void PasteSpecial()
#define EMPTY_OUSTRING
Definition: global.hxx:214
virtual const SfxItemSet * GetOutputItemSet() const =0
static SvxAbstractDialogFactory * Create()
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
void ExecutePasteContents(SfxRequest &rReq)
Definition: drtxtob1.cxx:100
virtual VclPtr< SfxAbstractTabDialog > CreateScCharDlg(weld::Window *pParent, const SfxItemSet *pAttr, const SfxObjectShell *pDocShell, bool bDrawText)=0
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
ScViewData & mrViewData
Definition: drtxtob.hxx:38
SotClipboardFormatId
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3074
virtual VclPtr< SfxAbstractTabDialog > CreateScParagraphDlg(weld::Window *pParent, const SfxItemSet *pAttr)=0
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
virtual void SetCurPageId(const OString &rName)=0
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper)=0
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3062
void Paste(bool bUseSpecial=false)
const OutlinerView * GetTextEditOutlinerView() const
weld::Window * GetDialogParent()
Definition: viewdata.cxx:3056
SfxItemPool * GetPool() const
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName)=0
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool ExecuteParaDlg(const SfxItemSet &rArgs, SfxItemSet &rOutSet)
Definition: drtxtob1.cxx:63
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:38
RET_OK
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool ExecuteCharDlg(const SfxItemSet &rArgs, SfxItemSet &rOutSet, sal_uInt16 nSlot)
Definition: drtxtob1.cxx:40