xref: /trunk/main/sc/source/ui/drawfunc/drtxtob1.cxx (revision da72173f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 //------------------------------------------------------------------------
30 
31 #include "scitems.hxx"
32 #include <editeng/eeitem.hxx>
33 
34 #include <svx/svxdlg.hxx>
35 #include <editeng/brkitem.hxx>
36 #include <editeng/hyznitem.hxx>
37 #include <editeng/orphitem.hxx>
38 #include <editeng/outliner.hxx>
39 #include <editeng/spltitem.hxx>
40 #include <editeng/widwitem.hxx>
41 #include <sot/exchange.hxx>
42 #include <vcl/msgbox.hxx>
43 #include <svtools/transfer.hxx>
44 
45 #include "sc.hrc"
46 #include "drtxtob.hxx"
47 #include "drawview.hxx"
48 #include "viewdata.hxx"
49 //CHINA001 #include "textdlgs.hxx"
50 #include "scresid.hxx"
51 
52 #include "scabstdlg.hxx" //CHINA00
53 //------------------------------------------------------------------------
54 
55 sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
56 												SfxItemSet& rOutSet )
57 {
58 //CHINA001	ScCharDlg* pDlg = new ScCharDlg( pViewData->GetDialogParent(),
59 //CHINA001	&rArgs,
60 //CHINA001	pViewData->GetSfxDocShell() );
61 //CHINA001
62 	ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
63 	DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
64 
65 	SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg(  pViewData->GetDialogParent(), &rArgs,
66 														pViewData->GetSfxDocShell(),RID_SCDLG_CHAR );
67 	DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
68 	sal_Bool bRet = ( pDlg->Execute() == RET_OK );
69 
70 	if ( bRet )
71 	{
72 		const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
73 		if ( pNewAttrs )
74 			rOutSet.Put( *pNewAttrs );
75 	}
76 	delete pDlg;
77 
78 	return bRet;
79 }
80 
81 sal_Bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
82 												SfxItemSet& rOutSet )
83 {
84     SfxItemPool* pArgPool = rArgs.GetPool();
85     SfxItemSet aNewAttr( *pArgPool,
86 							EE_ITEMS_START, EE_ITEMS_END,
87 							SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
88 							SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
89 							SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
90 							SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
91 							SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
92 							0 );
93 	aNewAttr.Put( rArgs );
94 
95 	// Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
96 	// Muss natuerlich noch geaendert werden
97 	// aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
98 
99     aNewAttr.Put( SvxHyphenZoneItem( sal_False, SID_ATTR_PARA_HYPHENZONE ) );
100     aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
101     aNewAttr.Put( SvxFmtSplitItem( sal_True, SID_ATTR_PARA_SPLIT)  );
102     aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
103     aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
104 
105 //CHINA001	ScParagraphDlg* pDlg = new ScParagraphDlg( pViewData->GetDialogParent(),
106 //CHINA001	&aNewAttr );
107 //CHINA001
108 	ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
109 	DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
110 
111 	SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( pViewData->GetDialogParent(), &aNewAttr, RID_SCDLG_PARAGRAPH);
112 	DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
113 	sal_Bool bRet = ( pDlg->Execute() == RET_OK );
114 
115 	if ( bRet )
116 	{
117 		const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
118 		if ( pNewAttrs )
119 			rOutSet.Put( *pNewAttrs );
120 	}
121 	delete pDlg;
122 
123 	return bRet;
124 }
125 
126 void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
127 {
128 	SdrView* pView = pViewData->GetScDrawView();
129 	OutlinerView* pOutView = pView->GetTextEditOutlinerView();
130     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
131     SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
132 
133 	pDlg->Insert( SOT_FORMAT_STRING, EMPTY_STRING );
134 	pDlg->Insert( SOT_FORMAT_RTF,	 EMPTY_STRING );
135 
136 	TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
137 
138     sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
139 
140 	//!	test if outliner view is still valid
141 
142 	if (nFormat > 0)
143 	{
144 		if (nFormat == SOT_FORMAT_STRING)
145 			pOutView->Paste();
146 		else
147 			pOutView->PasteSpecial();
148 	}
149 	delete pDlg;
150 }
151 
152 
153