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 "scitems.hxx"
21 #include <editeng/eeitem.hxx>
23 #include <svx/svxdlg.hxx>
24 #include <editeng/formatbreakitem.hxx>
25 #include <editeng/hyphenzoneitem.hxx>
26 #include <editeng/orphitem.hxx>
27 #include <editeng/outliner.hxx>
28 #include <editeng/spltitem.hxx>
29 #include <editeng/widwitem.hxx>
30 #include <sot/exchange.hxx>
31 #include <vcl/msgbox.hxx>
32 #include <svtools/transfer.hxx>
35 #include "drtxtob.hxx"
36 #include "drawview.hxx"
37 #include "viewdata.hxx"
38 #include "scresid.hxx"
39 #include <gridwin.hxx>
41 #include "scabstdlg.hxx"
42 #include <boost/scoped_ptr.hpp>
44 bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet
& rArgs
,
45 SfxItemSet
& rOutSet
, sal_uInt16 nSlot
)
47 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
48 assert(pFact
&& "ScAbstractFactory create fail!");
50 boost::scoped_ptr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateScCharDlg(
51 pViewData
->GetDialogParent(), &rArgs
,
52 pViewData
->GetSfxDocShell()));
53 assert(pDlg
&& "Dialog create fail!");
54 if (nSlot
== SID_CHAR_DLG_EFFECT
)
56 pDlg
->SetCurPageId("fonteffects");
58 bool bRet
= ( pDlg
->Execute() == RET_OK
);
62 const SfxItemSet
* pNewAttrs
= pDlg
->GetOutputItemSet();
64 rOutSet
.Put( *pNewAttrs
);
70 bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet
& rArgs
,
73 SfxItemPool
* pArgPool
= rArgs
.GetPool();
74 SfxItemSet
aNewAttr( *pArgPool
,
75 EE_ITEMS_START
, EE_ITEMS_END
,
76 SID_ATTR_PARA_HYPHENZONE
, SID_ATTR_PARA_HYPHENZONE
,
77 SID_ATTR_PARA_PAGEBREAK
, SID_ATTR_PARA_PAGEBREAK
,
78 SID_ATTR_PARA_SPLIT
, SID_ATTR_PARA_SPLIT
,
79 SID_ATTR_PARA_WIDOWS
, SID_ATTR_PARA_WIDOWS
,
80 SID_ATTR_PARA_ORPHANS
, SID_ATTR_PARA_ORPHANS
,
82 aNewAttr
.Put( rArgs
);
84 // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
85 // Muss natuerlich noch geaendert werden
86 // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
88 aNewAttr
.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE
) );
89 aNewAttr
.Put( SvxFormatBreakItem( SVX_BREAK_NONE
, SID_ATTR_PARA_PAGEBREAK
) );
90 aNewAttr
.Put( SvxFormatSplitItem( true, SID_ATTR_PARA_SPLIT
) );
91 aNewAttr
.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS
) );
92 aNewAttr
.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS
) );
94 ScAbstractDialogFactory
* pFact
= ScAbstractDialogFactory::Create();
95 OSL_ENSURE(pFact
, "ScAbstractFactory create fail!");
97 boost::scoped_ptr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateScParagraphDlg(
98 pViewData
->GetDialogParent(), &aNewAttr
));
99 OSL_ENSURE(pDlg
, "Dialog create fail!");
100 bool bRet
= ( pDlg
->Execute() == RET_OK
);
104 const SfxItemSet
* pNewAttrs
= pDlg
->GetOutputItemSet();
106 rOutSet
.Put( *pNewAttrs
);
112 void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest
& /* rReq */ )
114 SdrView
* pView
= pViewData
->GetScDrawView();
115 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
116 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
117 boost::scoped_ptr
<SfxAbstractPasteDialog
> pDlg(pFact
->CreatePasteDialog( pViewData
->GetDialogParent() ));
119 pDlg
->Insert( SotClipboardFormatId::STRING
, EMPTY_OUSTRING
);
120 pDlg
->Insert( SotClipboardFormatId::RTF
, EMPTY_OUSTRING
);
122 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData
->GetActiveWin() ) );
124 SotClipboardFormatId nFormat
= pDlg
->GetFormat( aDataHelper
.GetTransferable() );
126 //! test if outliner view is still valid
128 if (nFormat
!= SotClipboardFormatId::NONE
)
130 if (nFormat
== SotClipboardFormatId::STRING
)
133 pOutView
->PasteSpecial();
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */