xref: /trunk/main/sc/source/ui/drawfunc/drtxtob1.cxx (revision d9a8b508)
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 
ExecuteCharDlg(const SfxItemSet & rArgs,SfxItemSet & rOutSet,sal_uInt16 nSlot)55 sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
56 												SfxItemSet& rOutSet , sal_uInt16 nSlot)
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 	if (nSlot == SID_CHAR_DLG_EFFECT)
69 	{
70 		pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
71 	}
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 
ExecuteParaDlg(const SfxItemSet & rArgs,SfxItemSet & rOutSet)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 
ExecutePasteContents(SfxRequest &)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