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