xref: /aoo41x/main/sc/source/ui/drawfunc/drtxtob1.cxx (revision b3f79822)
1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b3f79822SAndrew Rist  * distributed with this work for additional information
6*b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b3f79822SAndrew Rist  *
11*b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist  *
13*b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b3f79822SAndrew Rist  * specific language governing permissions and limitations
18*b3f79822SAndrew Rist  * under the License.
19*b3f79822SAndrew Rist  *
20*b3f79822SAndrew Rist  *************************************************************/
21*b3f79822SAndrew Rist 
22*b3f79822SAndrew 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 
55cdf0e10cSrcweir sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
56cdf0e10cSrcweir 												SfxItemSet& rOutSet )
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
68cdf0e10cSrcweir 	sal_Bool bRet = ( pDlg->Execute() == RET_OK );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	if ( bRet )
71cdf0e10cSrcweir 	{
72cdf0e10cSrcweir 		const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
73cdf0e10cSrcweir 		if ( pNewAttrs )
74cdf0e10cSrcweir 			rOutSet.Put( *pNewAttrs );
75cdf0e10cSrcweir 	}
76cdf0e10cSrcweir 	delete pDlg;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	return bRet;
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir sal_Bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
82cdf0e10cSrcweir 												SfxItemSet& rOutSet )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     SfxItemPool* pArgPool = rArgs.GetPool();
85cdf0e10cSrcweir     SfxItemSet aNewAttr( *pArgPool,
86cdf0e10cSrcweir 							EE_ITEMS_START, EE_ITEMS_END,
87cdf0e10cSrcweir 							SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
88cdf0e10cSrcweir 							SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
89cdf0e10cSrcweir 							SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
90cdf0e10cSrcweir 							SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
91cdf0e10cSrcweir 							SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
92cdf0e10cSrcweir 							0 );
93cdf0e10cSrcweir 	aNewAttr.Put( rArgs );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	// Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
96cdf0e10cSrcweir 	// Muss natuerlich noch geaendert werden
97cdf0e10cSrcweir 	// aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     aNewAttr.Put( SvxHyphenZoneItem( sal_False, SID_ATTR_PARA_HYPHENZONE ) );
100cdf0e10cSrcweir     aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
101cdf0e10cSrcweir     aNewAttr.Put( SvxFmtSplitItem( sal_True, SID_ATTR_PARA_SPLIT)  );
102cdf0e10cSrcweir     aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
103cdf0e10cSrcweir     aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir //CHINA001	ScParagraphDlg* pDlg = new ScParagraphDlg( pViewData->GetDialogParent(),
106cdf0e10cSrcweir //CHINA001	&aNewAttr );
107cdf0e10cSrcweir //CHINA001
108cdf0e10cSrcweir 	ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
109cdf0e10cSrcweir 	DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( pViewData->GetDialogParent(), &aNewAttr, RID_SCDLG_PARAGRAPH);
112cdf0e10cSrcweir 	DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
113cdf0e10cSrcweir 	sal_Bool bRet = ( pDlg->Execute() == RET_OK );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	if ( bRet )
116cdf0e10cSrcweir 	{
117cdf0e10cSrcweir 		const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
118cdf0e10cSrcweir 		if ( pNewAttrs )
119cdf0e10cSrcweir 			rOutSet.Put( *pNewAttrs );
120cdf0e10cSrcweir 	}
121cdf0e10cSrcweir 	delete pDlg;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	return bRet;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir 	SdrView* pView = pViewData->GetScDrawView();
129cdf0e10cSrcweir 	OutlinerView* pOutView = pView->GetTextEditOutlinerView();
130cdf0e10cSrcweir     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
131cdf0e10cSrcweir     SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	pDlg->Insert( SOT_FORMAT_STRING, EMPTY_STRING );
134cdf0e10cSrcweir 	pDlg->Insert( SOT_FORMAT_RTF,	 EMPTY_STRING );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	//!	test if outliner view is still valid
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	if (nFormat > 0)
143cdf0e10cSrcweir 	{
144cdf0e10cSrcweir 		if (nFormat == SOT_FORMAT_STRING)
145cdf0e10cSrcweir 			pOutView->Paste();
146cdf0e10cSrcweir 		else
147cdf0e10cSrcweir 			pOutView->PasteSpecial();
148cdf0e10cSrcweir 	}
149cdf0e10cSrcweir 	delete pDlg;
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 
153