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