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