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