xref: /aoo41x/main/sw/source/ui/shells/drwtxtsh.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <hintids.hxx>
32*cdf0e10cSrcweir #include <i18npool/lang.h>
33*cdf0e10cSrcweir #include <svl/slstitm.hxx>
34*cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
35*cdf0e10cSrcweir #include <editeng/fontitem.hxx>
36*cdf0e10cSrcweir #include <editeng/langitem.hxx>
37*cdf0e10cSrcweir #include <svx/svdview.hxx>
38*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
39*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
40*cdf0e10cSrcweir #include <sfx2/objface.hxx>
41*cdf0e10cSrcweir #include <svx/svdotext.hxx>
42*cdf0e10cSrcweir #include <svx/xftsfit.hxx>
43*cdf0e10cSrcweir #include <editeng/editeng.hxx>
44*cdf0e10cSrcweir #include <editeng/editview.hxx>
45*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
46*cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
47*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
48*cdf0e10cSrcweir #include <svx/fontwork.hxx>
49*cdf0e10cSrcweir #include <sfx2/request.hxx>
50*cdf0e10cSrcweir #include <svl/whiter.hxx>
51*cdf0e10cSrcweir #include <editeng/outliner.hxx>
52*cdf0e10cSrcweir #include <editeng/editstat.hxx>
53*cdf0e10cSrcweir #include <svx/svdoutl.hxx>
54*cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp>
55*cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
56*cdf0e10cSrcweir #include <com/sun/star/i18n/TextConversionOption.hpp>
57*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
59*cdf0e10cSrcweir #include <swtypes.hxx>
60*cdf0e10cSrcweir #include <view.hxx>
61*cdf0e10cSrcweir #include <wrtsh.hxx>
62*cdf0e10cSrcweir #include <viewopt.hxx>
63*cdf0e10cSrcweir #include <initui.hxx>               // fuer SpellPointer
64*cdf0e10cSrcweir #include <drwtxtsh.hxx>
65*cdf0e10cSrcweir #include <swundo.hxx>
66*cdf0e10cSrcweir #include <breakit.hxx>
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #include <cmdid.h>
69*cdf0e10cSrcweir #include <helpid.h>
70*cdf0e10cSrcweir #ifndef _GLOBALS_HRC
71*cdf0e10cSrcweir #include <globals.hrc>
72*cdf0e10cSrcweir #endif
73*cdf0e10cSrcweir #ifndef _SHELLS_HRC
74*cdf0e10cSrcweir #include <shells.hrc>
75*cdf0e10cSrcweir #endif
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir #define SwDrawTextShell
78*cdf0e10cSrcweir #include <sfx2/msg.hxx>
79*cdf0e10cSrcweir #include <swslots.hxx>
80*cdf0e10cSrcweir #ifndef _POPUP_HRC
81*cdf0e10cSrcweir #include <popup.hrc>
82*cdf0e10cSrcweir #endif
83*cdf0e10cSrcweir #include <uitool.hxx>
84*cdf0e10cSrcweir #include <wview.hxx>
85*cdf0e10cSrcweir #include <swmodule.hxx>
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir #include <svx/xtable.hxx>
88*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
89*cdf0e10cSrcweir #include <svx/dialogs.hrc>
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
92*cdf0e10cSrcweir #include <svx/dialogs.hrc>
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx>
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir #include "swabstdlg.hxx" //CHINA001
97*cdf0e10cSrcweir #include "misc.hrc"
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir using namespace ::com::sun::star;
100*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
101*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
102*cdf0e10cSrcweir using namespace ::com::sun::star::i18n;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwDrawTextShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT))
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir 	SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRWTXT_POPUPMENU));
109*cdf0e10cSrcweir 	SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TEXT_TOOLBOX));
110*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
111*cdf0e10cSrcweir }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir TYPEINIT1(SwDrawTextShell,SfxShell)
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir /*--------------------------------------------------------------------
116*cdf0e10cSrcweir 	Beschreibung:
117*cdf0e10cSrcweir  --------------------------------------------------------------------*/
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir void SwDrawTextShell::Init()
122*cdf0e10cSrcweir {
123*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
124*cdf0e10cSrcweir 	pSdrView = rSh.GetDrawView();
125*cdf0e10cSrcweir     SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
126*cdf0e10cSrcweir     //#97471# mouse click _and_ key input at the same time
127*cdf0e10cSrcweir     if( !pOutliner )
128*cdf0e10cSrcweir         return ;
129*cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
130*cdf0e10cSrcweir 	sal_uLong nCtrl = pOutliner->GetControlWord();
131*cdf0e10cSrcweir 	nCtrl |= EE_CNTRL_AUTOCORRECT;
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 	SetUndoManager(&pOutliner->GetUndoManager());
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	// jetzt versuchen wir mal ein AutoSpell
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	const SwViewOption* pVOpt = rSh.GetViewOptions();
138*cdf0e10cSrcweir 	if(pVOpt->IsOnlineSpell())
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir 		nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
141*cdf0e10cSrcweir 	}
142*cdf0e10cSrcweir 	else
143*cdf0e10cSrcweir         nCtrl &= ~(EE_CNTRL_ONLINESPELLING);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	pOutliner->SetControlWord(nCtrl);
146*cdf0e10cSrcweir     pOLV->ShowCursor();
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir /*--------------------------------------------------------------------
150*cdf0e10cSrcweir 	Beschreibung:
151*cdf0e10cSrcweir  --------------------------------------------------------------------*/
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir SwDrawTextShell::SwDrawTextShell(SwView &rV) :
155*cdf0e10cSrcweir 	SfxShell(&rV),
156*cdf0e10cSrcweir 	rView(rV)
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
159*cdf0e10cSrcweir 	SetPool(rSh.GetAttrPool().GetSecondaryPool());
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	Init();
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 	rSh.NoEdit(sal_True);
164*cdf0e10cSrcweir 	SetName(String::CreateFromAscii("ObjectText"));
165*cdf0e10cSrcweir 	SetHelpId(SW_DRWTXTSHELL);
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir /*--------------------------------------------------------------------
169*cdf0e10cSrcweir 	Beschreibung:
170*cdf0e10cSrcweir  --------------------------------------------------------------------*/
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir __EXPORT SwDrawTextShell::~SwDrawTextShell()
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir     if ( GetView().GetCurShell() == this )
177*cdf0e10cSrcweir 		rView.ResetSubShell();
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	//MA 13. Nov. 96: Das kommt durchaus vor #33141#:
180*cdf0e10cSrcweir 	//(doppel-)Klick von einem Texteditmode in ein anderes Objekt, zwischendurch
181*cdf0e10cSrcweir 	//wird eine andere (Draw-)Shell gepusht, die alte aber noch nicht deletet.
182*cdf0e10cSrcweir 	//Dann wird vor dem Flush wieder ein DrawTextShell gepusht und der Mode ist
183*cdf0e10cSrcweir 	//eingeschaltet. In diesem Moment wird der Dispatcher geflusht und die alte
184*cdf0e10cSrcweir 	//DrawTextShell zerstoert.
185*cdf0e10cSrcweir //	ASSERT( !pSdrView->IsTextEdit(), "TextEdit in DTor DrwTxtSh?" );
186*cdf0e10cSrcweir //    if (pSdrView->IsTextEdit())
187*cdf0e10cSrcweir //		GetShell().EndTextEdit();	// Danebengeklickt, Ende mit Edit
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir //    GetShell().Edit();
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir SwWrtShell& SwDrawTextShell::GetShell()
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir 	return rView.GetWrtShell();
195*cdf0e10cSrcweir }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir /*--------------------------------------------------------------------
199*cdf0e10cSrcweir 	Beschreibung:	Slots mit dieser Statusmethode disablen
200*cdf0e10cSrcweir  --------------------------------------------------------------------*/
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir void SwDrawTextShell::StateDisableItems( SfxItemSet &rSet )
203*cdf0e10cSrcweir {
204*cdf0e10cSrcweir 	SfxWhichIter aIter(rSet);
205*cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	while (nWhich)
208*cdf0e10cSrcweir 	{
209*cdf0e10cSrcweir 		rSet.DisableItem( nWhich );
210*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
211*cdf0e10cSrcweir 	}
212*cdf0e10cSrcweir }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir /*************************************************************************
216*cdf0e10cSrcweir |*
217*cdf0e10cSrcweir |* Attribute setzen
218*cdf0e10cSrcweir |*
219*cdf0e10cSrcweir \************************************************************************/
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir void SwDrawTextShell::SetAttrToMarked(const SfxItemSet& rAttr)
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir 	Rectangle aNullRect;
226*cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
227*cdf0e10cSrcweir     Rectangle aOutRect = pOLV->GetOutputArea();
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	if (aNullRect != aOutRect)
230*cdf0e10cSrcweir 	{
231*cdf0e10cSrcweir 		GetShell().GetDrawView()->SetAttributes(rAttr);
232*cdf0e10cSrcweir //		Init();
233*cdf0e10cSrcweir 	}
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir /*--------------------------------------------------------------------
237*cdf0e10cSrcweir 	Beschreibung:
238*cdf0e10cSrcweir  --------------------------------------------------------------------*/
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir sal_Bool SwDrawTextShell::IsTextEdit()
243*cdf0e10cSrcweir {
244*cdf0e10cSrcweir     return pSdrView->IsTextEdit();
245*cdf0e10cSrcweir }
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir /*--------------------------------------------------------------------
248*cdf0e10cSrcweir 	Beschreibung:
249*cdf0e10cSrcweir  --------------------------------------------------------------------*/
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir void SwDrawTextShell::ExecFontWork(SfxRequest& rReq)
254*cdf0e10cSrcweir {
255*cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
256*cdf0e10cSrcweir     FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
257*cdf0e10cSrcweir     SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
258*cdf0e10cSrcweir     SfxViewFrame* pVFrame = GetView().GetViewFrame();
259*cdf0e10cSrcweir 	if ( rReq.GetArgs() )
260*cdf0e10cSrcweir 	{
261*cdf0e10cSrcweir 		pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
262*cdf0e10cSrcweir 								((const SfxBoolItem&) (rReq.GetArgs()->
263*cdf0e10cSrcweir 								Get(SID_FONTWORK))).GetValue());
264*cdf0e10cSrcweir 	}
265*cdf0e10cSrcweir 	else
266*cdf0e10cSrcweir 		pVFrame->ToggleChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	pVFrame->GetBindings().Invalidate(SID_FONTWORK);
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir /*--------------------------------------------------------------------
272*cdf0e10cSrcweir 	Beschreibung:
273*cdf0e10cSrcweir  --------------------------------------------------------------------*/
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir void SwDrawTextShell::StateFontWork(SfxItemSet& rSet)
278*cdf0e10cSrcweir {
279*cdf0e10cSrcweir 	const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
280*cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_FONTWORK, GetView().GetViewFrame()->HasChildWindow(nId)));
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir /*************************************************************************
284*cdf0e10cSrcweir |*
285*cdf0e10cSrcweir |* SfxRequests fuer FontWork bearbeiten
286*cdf0e10cSrcweir |*
287*cdf0e10cSrcweir \************************************************************************/
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir void SwDrawTextShell::ExecFormText(SfxRequest& rReq)
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
294*cdf0e10cSrcweir 	SdrView* pDrView = rSh.GetDrawView();
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
299*cdf0e10cSrcweir 	{
300*cdf0e10cSrcweir 		const SfxItemSet& rSet = *rReq.GetArgs();
301*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         //ask for the ViewFrame here - "this" may not be valid any longer!
304*cdf0e10cSrcweir         SfxViewFrame* pVFrame = GetView().GetViewFrame();
305*cdf0e10cSrcweir         if ( pDrView->IsTextEdit() )
306*cdf0e10cSrcweir 		{
307*cdf0e10cSrcweir             //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and
308*cdf0e10cSrcweir             // 'this' is not valid anymore
309*cdf0e10cSrcweir             SwView& rTempView = GetView();
310*cdf0e10cSrcweir             pDrView->SdrEndTextEdit(sal_True);
311*cdf0e10cSrcweir             //this removes the current shell from the dispatcher stack!!
312*cdf0e10cSrcweir             rTempView.AttrChangedNotify(&rSh);
313*cdf0e10cSrcweir 		}
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 		if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem) ==
316*cdf0e10cSrcweir 			 SFX_ITEM_SET &&
317*cdf0e10cSrcweir 			((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
318*cdf0e10cSrcweir 		{
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir 			const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
321*cdf0e10cSrcweir             SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)(
322*cdf0e10cSrcweir                     pVFrame->GetChildWindow(nId)->GetWindow());
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 			pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
325*cdf0e10cSrcweir 									rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
326*cdf0e10cSrcweir 								   ((const XFormTextStdFormItem*) pItem)->
327*cdf0e10cSrcweir 								   GetValue());
328*cdf0e10cSrcweir 		}
329*cdf0e10cSrcweir 		else
330*cdf0e10cSrcweir 			pDrView->SetAttributes(rSet);
331*cdf0e10cSrcweir 	}
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir /*************************************************************************
336*cdf0e10cSrcweir |*
337*cdf0e10cSrcweir |* Statuswerte fuer FontWork zurueckgeben
338*cdf0e10cSrcweir |*
339*cdf0e10cSrcweir \************************************************************************/
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet)
344*cdf0e10cSrcweir {
345*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
346*cdf0e10cSrcweir 	SdrView* pDrView = rSh.GetDrawView();
347*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
348*cdf0e10cSrcweir 	const SdrObject* pObj = NULL;
349*cdf0e10cSrcweir 	SvxFontWorkDialog* pDlg = NULL;
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 	const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 	SfxViewFrame* pVFrame = GetView().GetViewFrame();
354*cdf0e10cSrcweir 	if ( pVFrame->HasChildWindow(nId) )
355*cdf0e10cSrcweir 		pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 1 )
358*cdf0e10cSrcweir 		pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 	if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
361*cdf0e10cSrcweir 		!((SdrTextObj*) pObj)->HasText() )
362*cdf0e10cSrcweir 	{
363*cdf0e10cSrcweir #define	XATTR_ANZ 12
364*cdf0e10cSrcweir 		static const sal_uInt16 nXAttr[ XATTR_ANZ ] =
365*cdf0e10cSrcweir 		{ 	XATTR_FORMTXTSTYLE, XATTR_FORMTXTADJUST, XATTR_FORMTXTDISTANCE,
366*cdf0e10cSrcweir 			XATTR_FORMTXTSTART, XATTR_FORMTXTMIRROR, XATTR_FORMTXTSTDFORM,
367*cdf0e10cSrcweir 			XATTR_FORMTXTHIDEFORM, XATTR_FORMTXTOUTLINE, XATTR_FORMTXTSHADOW,
368*cdf0e10cSrcweir 			XATTR_FORMTXTSHDWCOLOR, XATTR_FORMTXTSHDWXVAL, XATTR_FORMTXTSHDWYVAL
369*cdf0e10cSrcweir 		};
370*cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < XATTR_ANZ; )
371*cdf0e10cSrcweir 			rSet.DisableItem( nXAttr[ i++ ] );
372*cdf0e10cSrcweir 	}
373*cdf0e10cSrcweir 	else
374*cdf0e10cSrcweir 	{
375*cdf0e10cSrcweir 		if ( pDlg )
376*cdf0e10cSrcweir 			pDlg->SetColorTable(XColorTable::GetStdColorTable());
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir 		pDrView->GetAttributes( rSet );
379*cdf0e10cSrcweir 	}
380*cdf0e10cSrcweir }
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir /*--------------------------------------------------------------------
383*cdf0e10cSrcweir 	Beschreibung:
384*cdf0e10cSrcweir  --------------------------------------------------------------------*/
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq)
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
391*cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
392*cdf0e10cSrcweir     if( rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() )
393*cdf0e10cSrcweir 	{
394*cdf0e10cSrcweir         switch(rReq.GetSlot())
395*cdf0e10cSrcweir 		{
396*cdf0e10cSrcweir         case SID_THESAURUS:
397*cdf0e10cSrcweir             pOLV->StartThesaurus();
398*cdf0e10cSrcweir 			break;
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         case SID_HANGUL_HANJA_CONVERSION:
401*cdf0e10cSrcweir             pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
402*cdf0e10cSrcweir                     i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True, sal_False );
403*cdf0e10cSrcweir             break;
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir         case SID_CHINESE_CONVERSION:
406*cdf0e10cSrcweir             {
407*cdf0e10cSrcweir                 //open ChineseTranslationDialog
408*cdf0e10cSrcweir                 Reference< XComponentContext > xContext(
409*cdf0e10cSrcweir                     ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
410*cdf0e10cSrcweir                 if(xContext.is())
411*cdf0e10cSrcweir                 {
412*cdf0e10cSrcweir                     Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
413*cdf0e10cSrcweir                     if(xMCF.is())
414*cdf0e10cSrcweir                     {
415*cdf0e10cSrcweir                         Reference< ui::dialogs::XExecutableDialog > xDialog(
416*cdf0e10cSrcweir                                 xMCF->createInstanceWithContext(
417*cdf0e10cSrcweir                                     rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
418*cdf0e10cSrcweir                                     , xContext), UNO_QUERY);
419*cdf0e10cSrcweir                         Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
420*cdf0e10cSrcweir                         if( xInit.is() )
421*cdf0e10cSrcweir                         {
422*cdf0e10cSrcweir                             //  initialize dialog
423*cdf0e10cSrcweir                             Reference< awt::XWindow > xDialogParentWindow(0);
424*cdf0e10cSrcweir                             Sequence<Any> aSeq(1);
425*cdf0e10cSrcweir                             Any* pArray = aSeq.getArray();
426*cdf0e10cSrcweir                             PropertyValue aParam;
427*cdf0e10cSrcweir                             aParam.Name = rtl::OUString::createFromAscii("ParentWindow");
428*cdf0e10cSrcweir                             aParam.Value <<= makeAny(xDialogParentWindow);
429*cdf0e10cSrcweir                             pArray[0] <<= makeAny(aParam);
430*cdf0e10cSrcweir                             xInit->initialize( aSeq );
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir                             //execute dialog
433*cdf0e10cSrcweir                             sal_Int16 nDialogRet = xDialog->execute();
434*cdf0e10cSrcweir                             if( RET_OK == nDialogRet )
435*cdf0e10cSrcweir                             {
436*cdf0e10cSrcweir                                 //get some parameters from the dialog
437*cdf0e10cSrcweir                                 sal_Bool bToSimplified = sal_True;
438*cdf0e10cSrcweir                                 sal_Bool bUseVariants = sal_True;
439*cdf0e10cSrcweir                                 sal_Bool bCommonTerms = sal_True;
440*cdf0e10cSrcweir                                 Reference< beans::XPropertySet >  xProp( xDialog, UNO_QUERY );
441*cdf0e10cSrcweir                                 if( xProp.is() )
442*cdf0e10cSrcweir                                 {
443*cdf0e10cSrcweir                                     try
444*cdf0e10cSrcweir                                     {
445*cdf0e10cSrcweir                                         xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
446*cdf0e10cSrcweir                                         xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
447*cdf0e10cSrcweir                                         xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
448*cdf0e10cSrcweir                                     }
449*cdf0e10cSrcweir                                     catch( Exception& )
450*cdf0e10cSrcweir                                     {
451*cdf0e10cSrcweir                                     }
452*cdf0e10cSrcweir                                 }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir                                 //execute translation
455*cdf0e10cSrcweir                                 sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
456*cdf0e10cSrcweir                                 sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
457*cdf0e10cSrcweir                                 sal_Int32 nOptions    = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
458*cdf0e10cSrcweir                                 if( !bCommonTerms )
459*cdf0e10cSrcweir                                     nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir                                 Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT,
462*cdf0e10cSrcweir                                             nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir                                 pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False, sal_False );
465*cdf0e10cSrcweir                             }
466*cdf0e10cSrcweir                         }
467*cdf0e10cSrcweir                         Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
468*cdf0e10cSrcweir                         if( xComponent.is() )
469*cdf0e10cSrcweir                             xComponent->dispose();
470*cdf0e10cSrcweir                     }
471*cdf0e10cSrcweir                 }
472*cdf0e10cSrcweir             }
473*cdf0e10cSrcweir             break;
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir         default:
476*cdf0e10cSrcweir 			ASSERT(!this, "unexpected slot-id");
477*cdf0e10cSrcweir 		}
478*cdf0e10cSrcweir 	}
479*cdf0e10cSrcweir }
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir /*--------------------------------------------------------------------
482*cdf0e10cSrcweir 	Beschreibung:
483*cdf0e10cSrcweir  --------------------------------------------------------------------*/
484*cdf0e10cSrcweir void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
485*cdf0e10cSrcweir {
486*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
487*cdf0e10cSrcweir 	pSdrView = rSh.GetDrawView();
488*cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir     switch (rReq.GetSlot())
491*cdf0e10cSrcweir 	{
492*cdf0e10cSrcweir         case FN_INSERT_SOFT_HYPHEN:
493*cdf0e10cSrcweir         case FN_INSERT_HARDHYPHEN:
494*cdf0e10cSrcweir         case FN_INSERT_HARD_SPACE:
495*cdf0e10cSrcweir         case SID_INSERT_RLM :
496*cdf0e10cSrcweir         case SID_INSERT_LRM :
497*cdf0e10cSrcweir         case SID_INSERT_ZWNBSP :
498*cdf0e10cSrcweir         case SID_INSERT_ZWSP:
499*cdf0e10cSrcweir         {
500*cdf0e10cSrcweir             sal_Unicode cIns = 0;
501*cdf0e10cSrcweir             switch(rReq.GetSlot())
502*cdf0e10cSrcweir             {
503*cdf0e10cSrcweir                 case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
504*cdf0e10cSrcweir                 case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
505*cdf0e10cSrcweir                 case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
506*cdf0e10cSrcweir                 case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
507*cdf0e10cSrcweir                 case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
508*cdf0e10cSrcweir                 case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
509*cdf0e10cSrcweir                 case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
510*cdf0e10cSrcweir             }
511*cdf0e10cSrcweir             pOLV->InsertText( String(cIns));
512*cdf0e10cSrcweir             rReq.Done();
513*cdf0e10cSrcweir         }
514*cdf0e10cSrcweir         break;
515*cdf0e10cSrcweir         case SID_CHARMAP:
516*cdf0e10cSrcweir 	{  // Sonderzeichen einfuegen
517*cdf0e10cSrcweir             InsertSymbol(rReq);
518*cdf0e10cSrcweir 			break;
519*cdf0e10cSrcweir 	}
520*cdf0e10cSrcweir 	      case FN_INSERT_STRING:
521*cdf0e10cSrcweir                 {
522*cdf0e10cSrcweir 			const SfxItemSet *pNewAttrs = rReq.GetArgs();
523*cdf0e10cSrcweir                         sal_uInt16 nSlot = rReq.GetSlot();
524*cdf0e10cSrcweir 			const SfxPoolItem* pItem = 0;
525*cdf0e10cSrcweir                         if(pNewAttrs)
526*cdf0e10cSrcweir 			{
527*cdf0e10cSrcweir                                 pNewAttrs->GetItemState(nSlot, sal_False, &pItem );
528*cdf0e10cSrcweir                          	pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
529*cdf0e10cSrcweir 			}
530*cdf0e10cSrcweir                         break;
531*cdf0e10cSrcweir                 }
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir 		case SID_SELECTALL:
534*cdf0e10cSrcweir 		{
535*cdf0e10cSrcweir             SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
536*cdf0e10cSrcweir             if(pOutliner)
537*cdf0e10cSrcweir             {
538*cdf0e10cSrcweir                 sal_uLong nParaCount = pOutliner->GetParagraphCount();
539*cdf0e10cSrcweir                 if (nParaCount > 0)
540*cdf0e10cSrcweir                     pOLV->SelectRange(0L, sal_uInt16(nParaCount) );
541*cdf0e10cSrcweir             }
542*cdf0e10cSrcweir 		}
543*cdf0e10cSrcweir 		break;
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir 		case FN_FORMAT_RESET:	// delete hard text attributes
546*cdf0e10cSrcweir 		{
547*cdf0e10cSrcweir             pOLV->RemoveAttribsKeepLanguages( true );
548*cdf0e10cSrcweir             pOLV->GetEditView().GetEditEngine()->RemoveFields(sal_True);
549*cdf0e10cSrcweir 			rReq.Done();
550*cdf0e10cSrcweir 		}
551*cdf0e10cSrcweir 		break;
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir 		case FN_ESCAPE:
554*cdf0e10cSrcweir 			if (pSdrView->IsTextEdit())
555*cdf0e10cSrcweir 			{
556*cdf0e10cSrcweir 				// Shellwechsel!
557*cdf0e10cSrcweir 				rSh.EndTextEdit();
558*cdf0e10cSrcweir                 SwView& rTempView = rSh.GetView();
559*cdf0e10cSrcweir                 rTempView.ExitDraw();
560*cdf0e10cSrcweir 				rSh.Edit();
561*cdf0e10cSrcweir                 rTempView.AttrChangedNotify(&rSh);
562*cdf0e10cSrcweir 				return;
563*cdf0e10cSrcweir 			}
564*cdf0e10cSrcweir 			break;
565*cdf0e10cSrcweir 		case FN_DRAWTEXT_ATTR_DLG:
566*cdf0e10cSrcweir 			{
567*cdf0e10cSrcweir 				SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
568*cdf0e10cSrcweir 				pSdrView->GetAttributes( aNewAttr );
569*cdf0e10cSrcweir 				SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
570*cdf0e10cSrcweir 				if ( pFact )
571*cdf0e10cSrcweir 				{
572*cdf0e10cSrcweir 					SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog(
573*cdf0e10cSrcweir 								&(GetView().GetViewFrame()->GetWindow()),
574*cdf0e10cSrcweir 								&aNewAttr, pSdrView );
575*cdf0e10cSrcweir 					sal_uInt16 nResult = pDlg->Execute();
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir 					if (nResult == RET_OK)
578*cdf0e10cSrcweir 					{
579*cdf0e10cSrcweir 						if (pSdrView->AreObjectsMarked())
580*cdf0e10cSrcweir 	                    {
581*cdf0e10cSrcweir 							pSdrView->SetAttributes(*pDlg->GetOutputItemSet());
582*cdf0e10cSrcweir 	                        rReq.Done(*(pDlg->GetOutputItemSet()));
583*cdf0e10cSrcweir 	                    }
584*cdf0e10cSrcweir 	                }
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 					delete( pDlg );
587*cdf0e10cSrcweir 				}
588*cdf0e10cSrcweir 			}
589*cdf0e10cSrcweir 			break;
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir 		default:
592*cdf0e10cSrcweir 			ASSERT(!this, "unexpected slot-id");
593*cdf0e10cSrcweir 			return;
594*cdf0e10cSrcweir 	}
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir 	GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir 	if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
599*cdf0e10cSrcweir 		rSh.SetModified();
600*cdf0e10cSrcweir }
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir /*--------------------------------------------------------------------
603*cdf0e10cSrcweir 	Beschreibung:	Undo ausfuehren
604*cdf0e10cSrcweir  --------------------------------------------------------------------*/
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
609*cdf0e10cSrcweir {
610*cdf0e10cSrcweir 	if( IsTextEdit() )
611*cdf0e10cSrcweir 	{
612*cdf0e10cSrcweir 		sal_Bool bCallBase = sal_True;
613*cdf0e10cSrcweir 		const SfxItemSet* pArgs = rReq.GetArgs();
614*cdf0e10cSrcweir 		if( pArgs )
615*cdf0e10cSrcweir 		{
616*cdf0e10cSrcweir 			sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
617*cdf0e10cSrcweir 			const SfxPoolItem* pItem;
618*cdf0e10cSrcweir 			switch( nId )
619*cdf0e10cSrcweir 			{
620*cdf0e10cSrcweir 			case SID_UNDO:
621*cdf0e10cSrcweir 			case SID_REDO:
622*cdf0e10cSrcweir 				if( SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ) &&
623*cdf0e10cSrcweir 					1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) )
624*cdf0e10cSrcweir 				{
625*cdf0e10cSrcweir 					// then we make by ourself.
626*cdf0e10cSrcweir                     ::svl::IUndoManager* pUndoManager = GetUndoManager();
627*cdf0e10cSrcweir                     if( pUndoManager )
628*cdf0e10cSrcweir 					{
629*cdf0e10cSrcweir 						if( SID_UNDO == nId )
630*cdf0e10cSrcweir 							while( nCnt-- )
631*cdf0e10cSrcweir                                 pUndoManager->Undo();
632*cdf0e10cSrcweir 						else
633*cdf0e10cSrcweir 							while( nCnt-- )
634*cdf0e10cSrcweir                                 pUndoManager->Redo();
635*cdf0e10cSrcweir 					}
636*cdf0e10cSrcweir 					bCallBase = sal_False;
637*cdf0e10cSrcweir 					GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
638*cdf0e10cSrcweir 				}
639*cdf0e10cSrcweir 				break;
640*cdf0e10cSrcweir 			}
641*cdf0e10cSrcweir 		}
642*cdf0e10cSrcweir 		if( bCallBase )
643*cdf0e10cSrcweir 		{
644*cdf0e10cSrcweir 			SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
645*cdf0e10cSrcweir 			pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface());
646*cdf0e10cSrcweir 		}
647*cdf0e10cSrcweir 	}
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir /*--------------------------------------------------------------------
651*cdf0e10cSrcweir 	Beschreibung:	Zustand Undo
652*cdf0e10cSrcweir  --------------------------------------------------------------------*/
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir void SwDrawTextShell::StateUndo(SfxItemSet &rSet)
657*cdf0e10cSrcweir {
658*cdf0e10cSrcweir 	if ( !IsTextEdit() )
659*cdf0e10cSrcweir 		return;
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir 	SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
662*cdf0e10cSrcweir 	SfxWhichIter aIter(rSet);
663*cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
664*cdf0e10cSrcweir 	while( nWhich )
665*cdf0e10cSrcweir 	{
666*cdf0e10cSrcweir 		switch ( nWhich )
667*cdf0e10cSrcweir 		{
668*cdf0e10cSrcweir 		case SID_GETUNDOSTRINGS:
669*cdf0e10cSrcweir 		case SID_GETREDOSTRINGS:
670*cdf0e10cSrcweir 			{
671*cdf0e10cSrcweir                 ::svl::IUndoManager* pUndoManager = GetUndoManager();
672*cdf0e10cSrcweir                 if( pUndoManager )
673*cdf0e10cSrcweir 				{
674*cdf0e10cSrcweir 					UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const;
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir 					sal_uInt16 nCount;
677*cdf0e10cSrcweir 					if( SID_GETUNDOSTRINGS == nWhich )
678*cdf0e10cSrcweir 					{
679*cdf0e10cSrcweir                         nCount = pUndoManager->GetUndoActionCount();
680*cdf0e10cSrcweir 						fnGetComment = &::svl::IUndoManager::GetUndoActionComment;
681*cdf0e10cSrcweir 					}
682*cdf0e10cSrcweir 					else
683*cdf0e10cSrcweir 					{
684*cdf0e10cSrcweir                         nCount = pUndoManager->GetRedoActionCount();
685*cdf0e10cSrcweir 						fnGetComment = &::svl::IUndoManager::GetRedoActionComment;
686*cdf0e10cSrcweir 					}
687*cdf0e10cSrcweir 					if( nCount )
688*cdf0e10cSrcweir 					{
689*cdf0e10cSrcweir 						String sList;
690*cdf0e10cSrcweir 						for( sal_uInt16 n = 0; n < nCount; ++n )
691*cdf0e10cSrcweir                             ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) )
692*cdf0e10cSrcweir 									+= '\n';
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir 						SfxStringListItem aItem( nWhich );
695*cdf0e10cSrcweir 						aItem.SetString( sList );
696*cdf0e10cSrcweir 						rSet.Put( aItem );
697*cdf0e10cSrcweir 					}
698*cdf0e10cSrcweir 				}
699*cdf0e10cSrcweir 				else
700*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
701*cdf0e10cSrcweir 			}
702*cdf0e10cSrcweir 			break;
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir 		default:
705*cdf0e10cSrcweir 			pSfxViewFrame->GetSlotState( nWhich,
706*cdf0e10cSrcweir 									pSfxViewFrame->GetInterface(), &rSet );
707*cdf0e10cSrcweir 		}
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
710*cdf0e10cSrcweir 	}
711*cdf0e10cSrcweir }
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq )
714*cdf0e10cSrcweir {
715*cdf0e10cSrcweir     using namespace i18n;
716*cdf0e10cSrcweir 	{
717*cdf0e10cSrcweir 		sal_uInt32 nMode = 0;
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 		switch( rReq.GetSlot() )
720*cdf0e10cSrcweir 		{
721*cdf0e10cSrcweir         case SID_TRANSLITERATE_SENTENCE_CASE:
722*cdf0e10cSrcweir             nMode = TransliterationModulesExtra::SENTENCE_CASE;
723*cdf0e10cSrcweir             break;
724*cdf0e10cSrcweir         case SID_TRANSLITERATE_TITLE_CASE:
725*cdf0e10cSrcweir             nMode = TransliterationModulesExtra::TITLE_CASE;
726*cdf0e10cSrcweir             break;
727*cdf0e10cSrcweir         case SID_TRANSLITERATE_TOGGLE_CASE:
728*cdf0e10cSrcweir             nMode = TransliterationModulesExtra::TOGGLE_CASE;
729*cdf0e10cSrcweir             break;
730*cdf0e10cSrcweir 		case SID_TRANSLITERATE_UPPER:
731*cdf0e10cSrcweir 			nMode = TransliterationModules_LOWERCASE_UPPERCASE;
732*cdf0e10cSrcweir 			break;
733*cdf0e10cSrcweir 		case SID_TRANSLITERATE_LOWER:
734*cdf0e10cSrcweir 			nMode = TransliterationModules_UPPERCASE_LOWERCASE;
735*cdf0e10cSrcweir 			break;
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 		case SID_TRANSLITERATE_HALFWIDTH:
738*cdf0e10cSrcweir 			nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
739*cdf0e10cSrcweir 			break;
740*cdf0e10cSrcweir 		case SID_TRANSLITERATE_FULLWIDTH:
741*cdf0e10cSrcweir 			nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
742*cdf0e10cSrcweir 			break;
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir 		case SID_TRANSLITERATE_HIRAGANA:
745*cdf0e10cSrcweir 			nMode = TransliterationModules_KATAKANA_HIRAGANA;
746*cdf0e10cSrcweir 			break;
747*cdf0e10cSrcweir 		case SID_TRANSLITERATE_KATAGANA:
748*cdf0e10cSrcweir 			nMode = TransliterationModules_HIRAGANA_KATAKANA;
749*cdf0e10cSrcweir 			break;
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir 		default:
752*cdf0e10cSrcweir 			ASSERT(!this, "falscher Dispatcher");
753*cdf0e10cSrcweir 		}
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir 		if( nMode )
756*cdf0e10cSrcweir         {
757*cdf0e10cSrcweir             OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
758*cdf0e10cSrcweir             pOLV->TransliterateText( nMode );
759*cdf0e10cSrcweir         }
760*cdf0e10cSrcweir 	}
761*cdf0e10cSrcweir }
762*cdf0e10cSrcweir 
763*cdf0e10cSrcweir /*--------------------------------------------------------------------
764*cdf0e10cSrcweir 	Beschreibung:	Sonderzeichen einfuegen (siehe SDraw: FUBULLET.CXX)
765*cdf0e10cSrcweir  --------------------------------------------------------------------*/
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
768*cdf0e10cSrcweir {
769*cdf0e10cSrcweir     OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
770*cdf0e10cSrcweir     if(!pOLV)
771*cdf0e10cSrcweir         return;
772*cdf0e10cSrcweir     const SfxItemSet *pArgs = rReq.GetArgs();
773*cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
774*cdf0e10cSrcweir     if( pArgs )
775*cdf0e10cSrcweir         pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem);
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir     String sSym;
778*cdf0e10cSrcweir     String sFontName;
779*cdf0e10cSrcweir     if ( pItem )
780*cdf0e10cSrcweir     {
781*cdf0e10cSrcweir         sSym = ((const SfxStringItem*)pItem)->GetValue();
782*cdf0e10cSrcweir         const SfxPoolItem* pFtItem = NULL;
783*cdf0e10cSrcweir 		pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem);
784*cdf0e10cSrcweir         const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
785*cdf0e10cSrcweir         if ( pFontItem )
786*cdf0e10cSrcweir             sFontName = pFontItem->GetValue();
787*cdf0e10cSrcweir     }
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir     SfxItemSet aSet(pOLV->GetAttribs());
790*cdf0e10cSrcweir     sal_uInt16 nScript = pOLV->GetSelectedScriptType();
791*cdf0e10cSrcweir     SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
792*cdf0e10cSrcweir     {
793*cdf0e10cSrcweir         SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
794*cdf0e10cSrcweir         aSetItem.GetItemSet().Put( aSet, sal_False );
795*cdf0e10cSrcweir         const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
796*cdf0e10cSrcweir         if( pI )
797*cdf0e10cSrcweir             aSetDlgFont = *(SvxFontItem*)pI;
798*cdf0e10cSrcweir         else
799*cdf0e10cSrcweir             aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
800*cdf0e10cSrcweir                         SID_ATTR_CHAR_FONT,
801*cdf0e10cSrcweir                         GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
802*cdf0e10cSrcweir 		if (!sFontName.Len())
803*cdf0e10cSrcweir 			sFontName = aSetDlgFont.GetFamilyName();
804*cdf0e10cSrcweir     }
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir     Font aFont(sFontName, Size(1,1));
807*cdf0e10cSrcweir     if(!sSym.Len())
808*cdf0e10cSrcweir     {
809*cdf0e10cSrcweir         SfxAllItemSet aAllSet( GetPool() );
810*cdf0e10cSrcweir         aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir         SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
813*cdf0e10cSrcweir         String sSymbolFont = aOpt.GetSymbolFont();
814*cdf0e10cSrcweir         if( sSymbolFont.Len() )
815*cdf0e10cSrcweir             aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
816*cdf0e10cSrcweir         else
817*cdf0e10cSrcweir             aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir         // Wenn Zeichen selektiert ist kann es angezeigt werden
820*cdf0e10cSrcweir 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
821*cdf0e10cSrcweir         SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
822*cdf0e10cSrcweir 			rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
823*cdf0e10cSrcweir         sal_uInt16 nResult = pDlg->Execute();
824*cdf0e10cSrcweir         if( nResult == RET_OK )
825*cdf0e10cSrcweir         {
826*cdf0e10cSrcweir             SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False );
827*cdf0e10cSrcweir 			SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False );
828*cdf0e10cSrcweir 			if ( pFontItem )
829*cdf0e10cSrcweir 			{
830*cdf0e10cSrcweir 				aFont.SetName( pFontItem->GetFamilyName() );
831*cdf0e10cSrcweir 				aFont.SetStyleName( pFontItem->GetStyleName() );
832*cdf0e10cSrcweir 				aFont.SetCharSet( pFontItem->GetCharSet() );
833*cdf0e10cSrcweir 				aFont.SetPitch( pFontItem->GetPitch() );
834*cdf0e10cSrcweir 			}
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir             if ( pCItem )
837*cdf0e10cSrcweir 			{
838*cdf0e10cSrcweir                 sSym  = pCItem->GetValue();
839*cdf0e10cSrcweir 				aOpt.SetSymbolFont(aFont.GetName());
840*cdf0e10cSrcweir 				SW_MOD()->ApplyUsrPref(aOpt, &rView);
841*cdf0e10cSrcweir 			}
842*cdf0e10cSrcweir         }
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir 		delete( pDlg );
845*cdf0e10cSrcweir     }
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir     if( sSym.Len() )
848*cdf0e10cSrcweir 	{
849*cdf0e10cSrcweir 		// nicht flackern
850*cdf0e10cSrcweir 		pOLV->HideCursor();
851*cdf0e10cSrcweir         SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
852*cdf0e10cSrcweir         pOutliner->SetUpdateMode(sal_False);
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 		SfxItemSet aOldSet( pOLV->GetAttribs() );
855*cdf0e10cSrcweir 		SfxItemSet aFontSet( *aOldSet.GetPool(),
856*cdf0e10cSrcweir 							EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
857*cdf0e10cSrcweir 							EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK,
858*cdf0e10cSrcweir 							EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL,
859*cdf0e10cSrcweir 							0 );
860*cdf0e10cSrcweir 		aFontSet.Set( aOldSet );
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir 		// String einfuegen
863*cdf0e10cSrcweir         pOLV->InsertText( sSym );
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir 		// attributieren (Font setzen)
866*cdf0e10cSrcweir         SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
867*cdf0e10cSrcweir 		SvxFontItem aFontItem (aFont.GetFamily(),	 aFont.GetName(),
868*cdf0e10cSrcweir 								aFont.GetStyleName(), aFont.GetPitch(),
869*cdf0e10cSrcweir 								aFont.GetCharSet(),
870*cdf0e10cSrcweir 								EE_CHAR_FONTINFO );
871*cdf0e10cSrcweir         nScript = pBreakIt->GetAllScriptsOfText( sSym );
872*cdf0e10cSrcweir 		if( SCRIPTTYPE_LATIN & nScript )
873*cdf0e10cSrcweir             aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO );
874*cdf0e10cSrcweir 		if( SCRIPTTYPE_ASIAN & nScript )
875*cdf0e10cSrcweir             aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
876*cdf0e10cSrcweir 		if( SCRIPTTYPE_COMPLEX & nScript )
877*cdf0e10cSrcweir             aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
878*cdf0e10cSrcweir         pOLV->SetAttribs(aFontAttribSet);
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir 		// Selektion loeschen
881*cdf0e10cSrcweir 		ESelection aSel(pOLV->GetSelection());
882*cdf0e10cSrcweir 		aSel.nStartPara = aSel.nEndPara;
883*cdf0e10cSrcweir 		aSel.nStartPos = aSel.nEndPos;
884*cdf0e10cSrcweir 		pOLV->SetSelection(aSel);
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir 		// Alten Font restaurieren
887*cdf0e10cSrcweir 		pOLV->SetAttribs( aFontSet );
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir 		// ab jetzt wieder anzeigen
890*cdf0e10cSrcweir 		pOutliner->SetUpdateMode(sal_True);
891*cdf0e10cSrcweir 		pOLV->ShowCursor();
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir 		rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
894*cdf0e10cSrcweir         if(aFont.GetName().Len())
895*cdf0e10cSrcweir 			rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
896*cdf0e10cSrcweir         rReq.Done();
897*cdf0e10cSrcweir     }
898*cdf0e10cSrcweir }
899*cdf0e10cSrcweir /*-- 22.10.2003 14:26:32---------------------------------------------------
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
902*cdf0e10cSrcweir ::svl::IUndoManager* SwDrawTextShell::GetUndoManager()
903*cdf0e10cSrcweir {
904*cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
905*cdf0e10cSrcweir     pSdrView = rSh.GetDrawView();
906*cdf0e10cSrcweir     SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
907*cdf0e10cSrcweir     pOutliner = pSdrView->GetTextEditOutliner();
908*cdf0e10cSrcweir     return &pOutliner->GetUndoManager();
909*cdf0e10cSrcweir }
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir 
913