merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / drawfunc / drtxtob1.cxx
blob44b4b6d2d7b35090efe1fdf2a51ad370a7d794e6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drtxtob1.cxx,v $
10 * $Revision: 1.16 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //------------------------------------------------------------------------
38 #include "scitems.hxx"
39 #include <svx/eeitem.hxx>
41 #include <svx/svxdlg.hxx>
42 #include <svx/brkitem.hxx>
43 #include <svx/hyznitem.hxx>
44 #include <svx/orphitem.hxx>
45 #include <svx/outliner.hxx>
46 #include <svx/spltitem.hxx>
47 #include <svx/widwitem.hxx>
48 #include <sot/exchange.hxx>
49 #include <vcl/msgbox.hxx>
50 #include <svtools/transfer.hxx>
52 #include "sc.hrc"
53 #include "drtxtob.hxx"
54 #include "drawview.hxx"
55 #include "viewdata.hxx"
56 //CHINA001 #include "textdlgs.hxx"
57 #include "scresid.hxx"
59 #include "scabstdlg.hxx" //CHINA00
60 //------------------------------------------------------------------------
62 BOOL ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
63 SfxItemSet& rOutSet )
65 //CHINA001 ScCharDlg* pDlg = new ScCharDlg( pViewData->GetDialogParent(),
66 //CHINA001 &rArgs,
67 //CHINA001 pViewData->GetSfxDocShell() );
68 //CHINA001
69 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
70 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
72 SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs,
73 pViewData->GetSfxDocShell(),RID_SCDLG_CHAR );
74 DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
75 BOOL bRet = ( pDlg->Execute() == RET_OK );
77 if ( bRet )
79 const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
80 if ( pNewAttrs )
81 rOutSet.Put( *pNewAttrs );
83 delete pDlg;
85 return bRet;
88 BOOL ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
89 SfxItemSet& rOutSet )
91 SfxItemPool* pArgPool = rArgs.GetPool();
92 SfxItemSet aNewAttr( *pArgPool,
93 EE_ITEMS_START, EE_ITEMS_END,
94 SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
95 SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
96 SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
97 SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
98 SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
99 0 );
100 aNewAttr.Put( rArgs );
102 // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
103 // Muss natuerlich noch geaendert werden
104 // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
106 aNewAttr.Put( SvxHyphenZoneItem( sal_False, SID_ATTR_PARA_HYPHENZONE ) );
107 aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
108 aNewAttr.Put( SvxFmtSplitItem( sal_True, SID_ATTR_PARA_SPLIT) );
109 aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
110 aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
112 //CHINA001 ScParagraphDlg* pDlg = new ScParagraphDlg( pViewData->GetDialogParent(),
113 //CHINA001 &aNewAttr );
114 //CHINA001
115 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
116 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
118 SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( pViewData->GetDialogParent(), &aNewAttr, RID_SCDLG_PARAGRAPH);
119 DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
120 BOOL bRet = ( pDlg->Execute() == RET_OK );
122 if ( bRet )
124 const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
125 if ( pNewAttrs )
126 rOutSet.Put( *pNewAttrs );
128 delete pDlg;
130 return bRet;
133 void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
135 SdrView* pView = pViewData->GetScDrawView();
136 OutlinerView* pOutView = pView->GetTextEditOutlinerView();
137 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
138 SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
140 pDlg->Insert( SOT_FORMAT_STRING, EMPTY_STRING );
141 pDlg->Insert( SOT_FORMAT_RTF, EMPTY_STRING );
143 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
145 ULONG nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
147 //! test if outliner view is still valid
149 if (nFormat > 0)
151 if (nFormat == SOT_FORMAT_STRING)
152 pOutView->Paste();
153 else
154 pOutView->PasteSpecial();
156 delete pDlg;