Line data Source code
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 "scitems.hxx"
21 : #include <editeng/eeitem.hxx>
22 :
23 : #include <svx/svxdlg.hxx>
24 : #include <editeng/brkitem.hxx>
25 : #include <editeng/hyznitem.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>
33 :
34 : #include "sc.hrc"
35 : #include "drtxtob.hxx"
36 : #include "drawview.hxx"
37 : #include "viewdata.hxx"
38 : #include "scresid.hxx"
39 :
40 : #include "scabstdlg.hxx"
41 : //------------------------------------------------------------------------
42 :
43 0 : sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
44 : SfxItemSet& rOutSet )
45 : {
46 0 : ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
47 : OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
48 :
49 : SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs,
50 0 : pViewData->GetSfxDocShell(),RID_SCDLG_CHAR );
51 : OSL_ENSURE(pDlg, "Dialog create fail!");
52 0 : sal_Bool bRet = ( pDlg->Execute() == RET_OK );
53 :
54 0 : if ( bRet )
55 : {
56 0 : const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
57 0 : if ( pNewAttrs )
58 0 : rOutSet.Put( *pNewAttrs );
59 : }
60 0 : delete pDlg;
61 :
62 0 : return bRet;
63 : }
64 :
65 0 : sal_Bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
66 : SfxItemSet& rOutSet )
67 : {
68 0 : SfxItemPool* pArgPool = rArgs.GetPool();
69 : SfxItemSet aNewAttr( *pArgPool,
70 : EE_ITEMS_START, EE_ITEMS_END,
71 : SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
72 : SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
73 : SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
74 : SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
75 : SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
76 0 : 0 );
77 0 : aNewAttr.Put( rArgs );
78 :
79 : // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
80 : // Muss natuerlich noch geaendert werden
81 : // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
82 :
83 0 : aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
84 0 : aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
85 0 : aNewAttr.Put( SvxFmtSplitItem( sal_True, SID_ATTR_PARA_SPLIT) );
86 0 : aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
87 0 : aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
88 :
89 0 : ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
90 : OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
91 :
92 0 : SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( pViewData->GetDialogParent(), &aNewAttr, RID_SCDLG_PARAGRAPH);
93 : OSL_ENSURE(pDlg, "Dialog create fail!");
94 0 : sal_Bool bRet = ( pDlg->Execute() == RET_OK );
95 :
96 0 : if ( bRet )
97 : {
98 0 : const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
99 0 : if ( pNewAttrs )
100 0 : rOutSet.Put( *pNewAttrs );
101 : }
102 0 : delete pDlg;
103 :
104 0 : return bRet;
105 : }
106 :
107 0 : void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
108 : {
109 0 : SdrView* pView = pViewData->GetScDrawView();
110 0 : OutlinerView* pOutView = pView->GetTextEditOutlinerView();
111 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
112 0 : SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
113 :
114 0 : pDlg->Insert( SOT_FORMAT_STRING, EMPTY_STRING );
115 0 : pDlg->Insert( SOT_FORMAT_RTF, EMPTY_STRING );
116 :
117 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
118 :
119 0 : sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
120 :
121 : //! test if outliner view is still valid
122 :
123 0 : if (nFormat > 0)
124 : {
125 0 : if (nFormat == SOT_FORMAT_STRING)
126 0 : pOutView->Paste();
127 : else
128 0 : pOutView->PasteSpecial();
129 : }
130 0 : delete pDlg;
131 15 : }
132 :
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|