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