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 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 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 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 168cdf0e10cSrcweir __EXPORT SwDrawTextShell::~SwDrawTextShell() 169cdf0e10cSrcweir { 170cdf0e10cSrcweir if ( GetView().GetCurShell() == this ) 171cdf0e10cSrcweir rView.ResetSubShell(); 172cdf0e10cSrcweir 173cdf0e10cSrcweir //MA 13. Nov. 96: Das kommt durchaus vor #33141#: 174cdf0e10cSrcweir //(doppel-)Klick von einem Texteditmode in ein anderes Objekt, zwischendurch 175cdf0e10cSrcweir //wird eine andere (Draw-)Shell gepusht, die alte aber noch nicht deletet. 176cdf0e10cSrcweir //Dann wird vor dem Flush wieder ein DrawTextShell gepusht und der Mode ist 177cdf0e10cSrcweir //eingeschaltet. In diesem Moment wird der Dispatcher geflusht und die alte 178cdf0e10cSrcweir //DrawTextShell zerstoert. 179cdf0e10cSrcweir // ASSERT( !pSdrView->IsTextEdit(), "TextEdit in DTor DrwTxtSh?" ); 180cdf0e10cSrcweir // if (pSdrView->IsTextEdit()) 181cdf0e10cSrcweir // GetShell().EndTextEdit(); // Danebengeklickt, Ende mit Edit 182cdf0e10cSrcweir 183cdf0e10cSrcweir // GetShell().Edit(); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir SwWrtShell& SwDrawTextShell::GetShell() 187cdf0e10cSrcweir { 188cdf0e10cSrcweir return rView.GetWrtShell(); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir 192cdf0e10cSrcweir /*-------------------------------------------------------------------- 193cdf0e10cSrcweir Beschreibung: Slots mit dieser Statusmethode disablen 194cdf0e10cSrcweir --------------------------------------------------------------------*/ 195cdf0e10cSrcweir 196cdf0e10cSrcweir void SwDrawTextShell::StateDisableItems( SfxItemSet &rSet ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir SfxWhichIter aIter(rSet); 199cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir while (nWhich) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir rSet.DisableItem( nWhich ); 204cdf0e10cSrcweir nWhich = aIter.NextWhich(); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir 209cdf0e10cSrcweir /************************************************************************* 210cdf0e10cSrcweir |* 211cdf0e10cSrcweir |* Attribute setzen 212cdf0e10cSrcweir |* 213cdf0e10cSrcweir \************************************************************************/ 214cdf0e10cSrcweir 215cdf0e10cSrcweir 216cdf0e10cSrcweir 217cdf0e10cSrcweir void SwDrawTextShell::SetAttrToMarked(const SfxItemSet& rAttr) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir Rectangle aNullRect; 220cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 221cdf0e10cSrcweir Rectangle aOutRect = pOLV->GetOutputArea(); 222cdf0e10cSrcweir 223cdf0e10cSrcweir if (aNullRect != aOutRect) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir GetShell().GetDrawView()->SetAttributes(rAttr); 226cdf0e10cSrcweir // Init(); 227cdf0e10cSrcweir } 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir /*-------------------------------------------------------------------- 231cdf0e10cSrcweir Beschreibung: 232cdf0e10cSrcweir --------------------------------------------------------------------*/ 233cdf0e10cSrcweir 234cdf0e10cSrcweir 235cdf0e10cSrcweir 236cdf0e10cSrcweir sal_Bool SwDrawTextShell::IsTextEdit() 237cdf0e10cSrcweir { 238cdf0e10cSrcweir return pSdrView->IsTextEdit(); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir 241cdf0e10cSrcweir /*-------------------------------------------------------------------- 242cdf0e10cSrcweir Beschreibung: 243cdf0e10cSrcweir --------------------------------------------------------------------*/ 244cdf0e10cSrcweir 245cdf0e10cSrcweir 246cdf0e10cSrcweir 247cdf0e10cSrcweir void SwDrawTextShell::ExecFontWork(SfxRequest& rReq) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 250cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView())); 251cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); 252cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 253cdf0e10cSrcweir if ( rReq.GetArgs() ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(), 256cdf0e10cSrcweir ((const SfxBoolItem&) (rReq.GetArgs()-> 257cdf0e10cSrcweir Get(SID_FONTWORK))).GetValue()); 258cdf0e10cSrcweir } 259cdf0e10cSrcweir else 260cdf0e10cSrcweir pVFrame->ToggleChildWindow(SvxFontWorkChildWindow::GetChildWindowId()); 261cdf0e10cSrcweir 262cdf0e10cSrcweir pVFrame->GetBindings().Invalidate(SID_FONTWORK); 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir /*-------------------------------------------------------------------- 266cdf0e10cSrcweir Beschreibung: 267cdf0e10cSrcweir --------------------------------------------------------------------*/ 268cdf0e10cSrcweir 269cdf0e10cSrcweir 270cdf0e10cSrcweir 271cdf0e10cSrcweir void SwDrawTextShell::StateFontWork(SfxItemSet& rSet) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); 274cdf0e10cSrcweir rSet.Put(SfxBoolItem(SID_FONTWORK, GetView().GetViewFrame()->HasChildWindow(nId))); 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir /************************************************************************* 278cdf0e10cSrcweir |* 279cdf0e10cSrcweir |* SfxRequests fuer FontWork bearbeiten 280cdf0e10cSrcweir |* 281cdf0e10cSrcweir \************************************************************************/ 282cdf0e10cSrcweir 283cdf0e10cSrcweir 284cdf0e10cSrcweir 285cdf0e10cSrcweir void SwDrawTextShell::ExecFormText(SfxRequest& rReq) 286cdf0e10cSrcweir { 287cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 288cdf0e10cSrcweir SdrView* pDrView = rSh.GetDrawView(); 289cdf0e10cSrcweir 290cdf0e10cSrcweir const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); 291cdf0e10cSrcweir 292cdf0e10cSrcweir if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() ) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir const SfxItemSet& rSet = *rReq.GetArgs(); 295cdf0e10cSrcweir 296cdf0e10cSrcweir //ask for the ViewFrame here - "this" may not be valid any longer! 297*cb0cd92eSPavel Janík // SfxViewFrame* pVFrame = GetView().GetViewFrame(); 298cdf0e10cSrcweir if ( pDrView->IsTextEdit() ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and 301cdf0e10cSrcweir // 'this' is not valid anymore 302cdf0e10cSrcweir SwView& rTempView = GetView(); 303cdf0e10cSrcweir pDrView->SdrEndTextEdit(sal_True); 304cdf0e10cSrcweir //this removes the current shell from the dispatcher stack!! 305cdf0e10cSrcweir rTempView.AttrChangedNotify(&rSh); 306cdf0e10cSrcweir } 307cdf0e10cSrcweir 3081e9c32afSArmin Le Grand pDrView->SetAttributes(rSet); 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir /************************************************************************* 314cdf0e10cSrcweir |* 315cdf0e10cSrcweir |* Statuswerte fuer FontWork zurueckgeben 316cdf0e10cSrcweir |* 317cdf0e10cSrcweir \************************************************************************/ 318cdf0e10cSrcweir 319cdf0e10cSrcweir 320cdf0e10cSrcweir 321cdf0e10cSrcweir void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 324cdf0e10cSrcweir SdrView* pDrView = rSh.GetDrawView(); 325cdf0e10cSrcweir const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); 326cdf0e10cSrcweir const SdrObject* pObj = NULL; 327cdf0e10cSrcweir SvxFontWorkDialog* pDlg = NULL; 328cdf0e10cSrcweir 329cdf0e10cSrcweir const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); 330cdf0e10cSrcweir 331cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 332cdf0e10cSrcweir if ( pVFrame->HasChildWindow(nId) ) 333cdf0e10cSrcweir pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow()); 334cdf0e10cSrcweir 335cdf0e10cSrcweir if ( rMarkList.GetMarkCount() == 1 ) 336cdf0e10cSrcweir pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 337cdf0e10cSrcweir 338ef076a15SArmin Le Grand const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj); 339ef076a15SArmin Le Grand const bool bDeactivate( 340ef076a15SArmin Le Grand !pObj || 341ef076a15SArmin Le Grand !pTextObj || 342ef076a15SArmin Le Grand !pTextObj->HasText() || 343ef076a15SArmin Le Grand dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes 344ef076a15SArmin Le Grand 345ef076a15SArmin Le Grand if (bDeactivate) 346cdf0e10cSrcweir { 347ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSTYLE); 348ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTADJUST); 349ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTDISTANCE); 350ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSTART); 351ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTMIRROR); 352ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTHIDEFORM); 353ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTOUTLINE); 354ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHADOW); 355ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR); 356ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHDWXVAL); 357ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHDWYVAL); 358cdf0e10cSrcweir } 359cdf0e10cSrcweir else 360cdf0e10cSrcweir { 361cdf0e10cSrcweir if ( pDlg ) 36297e8a929SArmin Le Grand pDlg->SetColorTable(XColorList::GetStdColorList()); 363cdf0e10cSrcweir 364cdf0e10cSrcweir pDrView->GetAttributes( rSet ); 365cdf0e10cSrcweir } 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir /*-------------------------------------------------------------------- 369cdf0e10cSrcweir Beschreibung: 370cdf0e10cSrcweir --------------------------------------------------------------------*/ 371cdf0e10cSrcweir 372cdf0e10cSrcweir 373cdf0e10cSrcweir 374cdf0e10cSrcweir void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 377cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 378cdf0e10cSrcweir if( rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() ) 379cdf0e10cSrcweir { 380cdf0e10cSrcweir switch(rReq.GetSlot()) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir case SID_THESAURUS: 383cdf0e10cSrcweir pOLV->StartThesaurus(); 384cdf0e10cSrcweir break; 385cdf0e10cSrcweir 386cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 387cdf0e10cSrcweir pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, 388cdf0e10cSrcweir i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True, sal_False ); 389cdf0e10cSrcweir break; 390cdf0e10cSrcweir 391cdf0e10cSrcweir case SID_CHINESE_CONVERSION: 392cdf0e10cSrcweir { 393cdf0e10cSrcweir //open ChineseTranslationDialog 394cdf0e10cSrcweir Reference< XComponentContext > xContext( 395cdf0e10cSrcweir ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one 396cdf0e10cSrcweir if(xContext.is()) 397cdf0e10cSrcweir { 398cdf0e10cSrcweir Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); 399cdf0e10cSrcweir if(xMCF.is()) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir Reference< ui::dialogs::XExecutableDialog > xDialog( 402cdf0e10cSrcweir xMCF->createInstanceWithContext( 403cdf0e10cSrcweir rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog") 404cdf0e10cSrcweir , xContext), UNO_QUERY); 405cdf0e10cSrcweir Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY ); 406cdf0e10cSrcweir if( xInit.is() ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir // initialize dialog 409cdf0e10cSrcweir Reference< awt::XWindow > xDialogParentWindow(0); 410cdf0e10cSrcweir Sequence<Any> aSeq(1); 411cdf0e10cSrcweir Any* pArray = aSeq.getArray(); 412cdf0e10cSrcweir PropertyValue aParam; 413cdf0e10cSrcweir aParam.Name = rtl::OUString::createFromAscii("ParentWindow"); 414cdf0e10cSrcweir aParam.Value <<= makeAny(xDialogParentWindow); 415cdf0e10cSrcweir pArray[0] <<= makeAny(aParam); 416cdf0e10cSrcweir xInit->initialize( aSeq ); 417cdf0e10cSrcweir 418cdf0e10cSrcweir //execute dialog 419cdf0e10cSrcweir sal_Int16 nDialogRet = xDialog->execute(); 420cdf0e10cSrcweir if( RET_OK == nDialogRet ) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir //get some parameters from the dialog 423cdf0e10cSrcweir sal_Bool bToSimplified = sal_True; 424cdf0e10cSrcweir sal_Bool bUseVariants = sal_True; 425cdf0e10cSrcweir sal_Bool bCommonTerms = sal_True; 426cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY ); 427cdf0e10cSrcweir if( xProp.is() ) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir try 430cdf0e10cSrcweir { 431cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified; 432cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants; 433cdf0e10cSrcweir xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms; 434cdf0e10cSrcweir } 435cdf0e10cSrcweir catch( Exception& ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir } 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir //execute translation 441cdf0e10cSrcweir sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED; 442cdf0e10cSrcweir sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL; 443cdf0e10cSrcweir sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0; 444cdf0e10cSrcweir if( !bCommonTerms ) 445cdf0e10cSrcweir nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER; 446cdf0e10cSrcweir 447cdf0e10cSrcweir Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT, 448cdf0e10cSrcweir nTargetLang, DEFAULTFONT_FLAGS_ONLYONE ); 449cdf0e10cSrcweir 450cdf0e10cSrcweir pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False, sal_False ); 451cdf0e10cSrcweir } 452cdf0e10cSrcweir } 453cdf0e10cSrcweir Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY ); 454cdf0e10cSrcweir if( xComponent.is() ) 455cdf0e10cSrcweir xComponent->dispose(); 456cdf0e10cSrcweir } 457cdf0e10cSrcweir } 458cdf0e10cSrcweir } 459cdf0e10cSrcweir break; 460cdf0e10cSrcweir 461cdf0e10cSrcweir default: 462cdf0e10cSrcweir ASSERT(!this, "unexpected slot-id"); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir } 465cdf0e10cSrcweir } 466cdf0e10cSrcweir 467cdf0e10cSrcweir /*-------------------------------------------------------------------- 468cdf0e10cSrcweir Beschreibung: 469cdf0e10cSrcweir --------------------------------------------------------------------*/ 470cdf0e10cSrcweir void SwDrawTextShell::ExecDraw(SfxRequest &rReq) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 473cdf0e10cSrcweir pSdrView = rSh.GetDrawView(); 474cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 475cdf0e10cSrcweir 476cdf0e10cSrcweir switch (rReq.GetSlot()) 477cdf0e10cSrcweir { 478cdf0e10cSrcweir case FN_INSERT_SOFT_HYPHEN: 479cdf0e10cSrcweir case FN_INSERT_HARDHYPHEN: 480cdf0e10cSrcweir case FN_INSERT_HARD_SPACE: 481cdf0e10cSrcweir case SID_INSERT_RLM : 482cdf0e10cSrcweir case SID_INSERT_LRM : 483cdf0e10cSrcweir case SID_INSERT_ZWNBSP : 484cdf0e10cSrcweir case SID_INSERT_ZWSP: 485cdf0e10cSrcweir { 486cdf0e10cSrcweir sal_Unicode cIns = 0; 487cdf0e10cSrcweir switch(rReq.GetSlot()) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break; 490cdf0e10cSrcweir case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break; 491cdf0e10cSrcweir case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break; 492cdf0e10cSrcweir case SID_INSERT_RLM : cIns = CHAR_RLM ; break; 493cdf0e10cSrcweir case SID_INSERT_LRM : cIns = CHAR_LRM ; break; 494cdf0e10cSrcweir case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break; 495cdf0e10cSrcweir case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break; 496cdf0e10cSrcweir } 497cdf0e10cSrcweir pOLV->InsertText( String(cIns)); 498cdf0e10cSrcweir rReq.Done(); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir break; 501cdf0e10cSrcweir case SID_CHARMAP: 502cdf0e10cSrcweir { // Sonderzeichen einfuegen 503cdf0e10cSrcweir InsertSymbol(rReq); 504cdf0e10cSrcweir break; 505cdf0e10cSrcweir } 506cdf0e10cSrcweir case FN_INSERT_STRING: 507cdf0e10cSrcweir { 508cdf0e10cSrcweir const SfxItemSet *pNewAttrs = rReq.GetArgs(); 509cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 510cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 511cdf0e10cSrcweir if(pNewAttrs) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir pNewAttrs->GetItemState(nSlot, sal_False, &pItem ); 514cdf0e10cSrcweir pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue()); 515cdf0e10cSrcweir } 516cdf0e10cSrcweir break; 517cdf0e10cSrcweir } 518cdf0e10cSrcweir 519cdf0e10cSrcweir case SID_SELECTALL: 520cdf0e10cSrcweir { 521cdf0e10cSrcweir SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner(); 522cdf0e10cSrcweir if(pOutliner) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir sal_uLong nParaCount = pOutliner->GetParagraphCount(); 525cdf0e10cSrcweir if (nParaCount > 0) 526cdf0e10cSrcweir pOLV->SelectRange(0L, sal_uInt16(nParaCount) ); 527cdf0e10cSrcweir } 528cdf0e10cSrcweir } 529cdf0e10cSrcweir break; 530cdf0e10cSrcweir 531cdf0e10cSrcweir case FN_FORMAT_RESET: // delete hard text attributes 532cdf0e10cSrcweir { 533cdf0e10cSrcweir pOLV->RemoveAttribsKeepLanguages( true ); 534cdf0e10cSrcweir pOLV->GetEditView().GetEditEngine()->RemoveFields(sal_True); 535cdf0e10cSrcweir rReq.Done(); 536cdf0e10cSrcweir } 537cdf0e10cSrcweir break; 538cdf0e10cSrcweir 539cdf0e10cSrcweir case FN_ESCAPE: 540cdf0e10cSrcweir if (pSdrView->IsTextEdit()) 541cdf0e10cSrcweir { 542cdf0e10cSrcweir // Shellwechsel! 543cdf0e10cSrcweir rSh.EndTextEdit(); 544cdf0e10cSrcweir SwView& rTempView = rSh.GetView(); 545cdf0e10cSrcweir rTempView.ExitDraw(); 546cdf0e10cSrcweir rSh.Edit(); 547cdf0e10cSrcweir rTempView.AttrChangedNotify(&rSh); 548cdf0e10cSrcweir return; 549cdf0e10cSrcweir } 550cdf0e10cSrcweir break; 551cdf0e10cSrcweir case FN_DRAWTEXT_ATTR_DLG: 552cdf0e10cSrcweir { 553cdf0e10cSrcweir SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() ); 554cdf0e10cSrcweir pSdrView->GetAttributes( aNewAttr ); 555cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 556cdf0e10cSrcweir if ( pFact ) 557cdf0e10cSrcweir { 558cdf0e10cSrcweir SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( 559cdf0e10cSrcweir &(GetView().GetViewFrame()->GetWindow()), 560cdf0e10cSrcweir &aNewAttr, pSdrView ); 561cdf0e10cSrcweir sal_uInt16 nResult = pDlg->Execute(); 562cdf0e10cSrcweir 563cdf0e10cSrcweir if (nResult == RET_OK) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir if (pSdrView->AreObjectsMarked()) 566cdf0e10cSrcweir { 567cdf0e10cSrcweir pSdrView->SetAttributes(*pDlg->GetOutputItemSet()); 568cdf0e10cSrcweir rReq.Done(*(pDlg->GetOutputItemSet())); 569cdf0e10cSrcweir } 570cdf0e10cSrcweir } 571cdf0e10cSrcweir 572cdf0e10cSrcweir delete( pDlg ); 573cdf0e10cSrcweir } 574cdf0e10cSrcweir } 575cdf0e10cSrcweir break; 576512ec161SZheng Fan case SID_TABLE_VERT_NONE: 577512ec161SZheng Fan case SID_TABLE_VERT_CENTER: 578512ec161SZheng Fan case SID_TABLE_VERT_BOTTOM: 579512ec161SZheng Fan { 580512ec161SZheng Fan sal_uInt16 nSId = rReq.GetSlot(); 581512ec161SZheng Fan if (pSdrView->AreObjectsMarked()) 582512ec161SZheng Fan { 583512ec161SZheng Fan SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; 584512ec161SZheng Fan if (nSId == SID_TABLE_VERT_CENTER) 585512ec161SZheng Fan eTVA = SDRTEXTVERTADJUST_CENTER; 586512ec161SZheng Fan else if (nSId == SID_TABLE_VERT_BOTTOM) 587512ec161SZheng Fan eTVA = SDRTEXTVERTADJUST_BOTTOM; 588512ec161SZheng Fan 589512ec161SZheng Fan SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() ); 590512ec161SZheng Fan pSdrView->GetAttributes( aNewAttr ); 591512ec161SZheng Fan aNewAttr.Put(SdrTextVertAdjustItem(eTVA)); 592512ec161SZheng Fan pSdrView->SetAttributes(aNewAttr); 593512ec161SZheng Fan rReq.Done(); 594512ec161SZheng Fan } 595512ec161SZheng Fan 596512ec161SZheng Fan } 597512ec161SZheng Fan break; 598cdf0e10cSrcweir 599cdf0e10cSrcweir default: 600cdf0e10cSrcweir ASSERT(!this, "unexpected slot-id"); 601cdf0e10cSrcweir return; 602cdf0e10cSrcweir } 603cdf0e10cSrcweir 604cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); 605cdf0e10cSrcweir 606cdf0e10cSrcweir if (IsTextEdit() && pOLV->GetOutliner()->IsModified()) 607cdf0e10cSrcweir rSh.SetModified(); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir 610cdf0e10cSrcweir /*-------------------------------------------------------------------- 611cdf0e10cSrcweir Beschreibung: Undo ausfuehren 612cdf0e10cSrcweir --------------------------------------------------------------------*/ 613cdf0e10cSrcweir 614cdf0e10cSrcweir 615cdf0e10cSrcweir 616cdf0e10cSrcweir void SwDrawTextShell::ExecUndo(SfxRequest &rReq) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir if( IsTextEdit() ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir sal_Bool bCallBase = sal_True; 621cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 622cdf0e10cSrcweir if( pArgs ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir sal_uInt16 nId = rReq.GetSlot(), nCnt = 1; 625cdf0e10cSrcweir const SfxPoolItem* pItem; 626cdf0e10cSrcweir switch( nId ) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir case SID_UNDO: 629cdf0e10cSrcweir case SID_REDO: 630cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ) && 631cdf0e10cSrcweir 1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) ) 632cdf0e10cSrcweir { 633cdf0e10cSrcweir // then we make by ourself. 634cdf0e10cSrcweir ::svl::IUndoManager* pUndoManager = GetUndoManager(); 635cdf0e10cSrcweir if( pUndoManager ) 636cdf0e10cSrcweir { 637cdf0e10cSrcweir if( SID_UNDO == nId ) 638cdf0e10cSrcweir while( nCnt-- ) 639cdf0e10cSrcweir pUndoManager->Undo(); 640cdf0e10cSrcweir else 641cdf0e10cSrcweir while( nCnt-- ) 642cdf0e10cSrcweir pUndoManager->Redo(); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir bCallBase = sal_False; 645cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir break; 648cdf0e10cSrcweir } 649cdf0e10cSrcweir } 650cdf0e10cSrcweir if( bCallBase ) 651cdf0e10cSrcweir { 652cdf0e10cSrcweir SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame(); 653cdf0e10cSrcweir pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface()); 654cdf0e10cSrcweir } 655cdf0e10cSrcweir } 656cdf0e10cSrcweir } 657cdf0e10cSrcweir 658cdf0e10cSrcweir /*-------------------------------------------------------------------- 659cdf0e10cSrcweir Beschreibung: Zustand Undo 660cdf0e10cSrcweir --------------------------------------------------------------------*/ 661cdf0e10cSrcweir 662cdf0e10cSrcweir 663cdf0e10cSrcweir 664cdf0e10cSrcweir void SwDrawTextShell::StateUndo(SfxItemSet &rSet) 665cdf0e10cSrcweir { 666cdf0e10cSrcweir if ( !IsTextEdit() ) 667cdf0e10cSrcweir return; 668cdf0e10cSrcweir 669cdf0e10cSrcweir SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame(); 670cdf0e10cSrcweir SfxWhichIter aIter(rSet); 671cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 672cdf0e10cSrcweir while( nWhich ) 673cdf0e10cSrcweir { 674cdf0e10cSrcweir switch ( nWhich ) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir case SID_GETUNDOSTRINGS: 677cdf0e10cSrcweir case SID_GETREDOSTRINGS: 678cdf0e10cSrcweir { 679cdf0e10cSrcweir ::svl::IUndoManager* pUndoManager = GetUndoManager(); 680cdf0e10cSrcweir if( pUndoManager ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const; 683cdf0e10cSrcweir 684cdf0e10cSrcweir sal_uInt16 nCount; 685cdf0e10cSrcweir if( SID_GETUNDOSTRINGS == nWhich ) 686cdf0e10cSrcweir { 687cdf0e10cSrcweir nCount = pUndoManager->GetUndoActionCount(); 688cdf0e10cSrcweir fnGetComment = &::svl::IUndoManager::GetUndoActionComment; 689cdf0e10cSrcweir } 690cdf0e10cSrcweir else 691cdf0e10cSrcweir { 692cdf0e10cSrcweir nCount = pUndoManager->GetRedoActionCount(); 693cdf0e10cSrcweir fnGetComment = &::svl::IUndoManager::GetRedoActionComment; 694cdf0e10cSrcweir } 695cdf0e10cSrcweir if( nCount ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir String sList; 698cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nCount; ++n ) 699cdf0e10cSrcweir ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) ) 700cdf0e10cSrcweir += '\n'; 701cdf0e10cSrcweir 702cdf0e10cSrcweir SfxStringListItem aItem( nWhich ); 703cdf0e10cSrcweir aItem.SetString( sList ); 704cdf0e10cSrcweir rSet.Put( aItem ); 705cdf0e10cSrcweir } 706cdf0e10cSrcweir } 707cdf0e10cSrcweir else 708cdf0e10cSrcweir rSet.DisableItem( nWhich ); 709cdf0e10cSrcweir } 710cdf0e10cSrcweir break; 711cdf0e10cSrcweir 712cdf0e10cSrcweir default: 713cdf0e10cSrcweir pSfxViewFrame->GetSlotState( nWhich, 714cdf0e10cSrcweir pSfxViewFrame->GetInterface(), &rSet ); 715cdf0e10cSrcweir } 716cdf0e10cSrcweir 717cdf0e10cSrcweir nWhich = aIter.NextWhich(); 718cdf0e10cSrcweir } 719cdf0e10cSrcweir } 720cdf0e10cSrcweir 721cdf0e10cSrcweir void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq ) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir using namespace i18n; 724cdf0e10cSrcweir { 725cdf0e10cSrcweir sal_uInt32 nMode = 0; 726cdf0e10cSrcweir 727cdf0e10cSrcweir switch( rReq.GetSlot() ) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir case SID_TRANSLITERATE_SENTENCE_CASE: 730cdf0e10cSrcweir nMode = TransliterationModulesExtra::SENTENCE_CASE; 731cdf0e10cSrcweir break; 732cdf0e10cSrcweir case SID_TRANSLITERATE_TITLE_CASE: 733cdf0e10cSrcweir nMode = TransliterationModulesExtra::TITLE_CASE; 734cdf0e10cSrcweir break; 735cdf0e10cSrcweir case SID_TRANSLITERATE_TOGGLE_CASE: 736cdf0e10cSrcweir nMode = TransliterationModulesExtra::TOGGLE_CASE; 737cdf0e10cSrcweir break; 738cdf0e10cSrcweir case SID_TRANSLITERATE_UPPER: 739cdf0e10cSrcweir nMode = TransliterationModules_LOWERCASE_UPPERCASE; 740cdf0e10cSrcweir break; 741cdf0e10cSrcweir case SID_TRANSLITERATE_LOWER: 742cdf0e10cSrcweir nMode = TransliterationModules_UPPERCASE_LOWERCASE; 743cdf0e10cSrcweir break; 744cdf0e10cSrcweir 745cdf0e10cSrcweir case SID_TRANSLITERATE_HALFWIDTH: 746cdf0e10cSrcweir nMode = TransliterationModules_FULLWIDTH_HALFWIDTH; 747cdf0e10cSrcweir break; 748cdf0e10cSrcweir case SID_TRANSLITERATE_FULLWIDTH: 749cdf0e10cSrcweir nMode = TransliterationModules_HALFWIDTH_FULLWIDTH; 750cdf0e10cSrcweir break; 751cdf0e10cSrcweir 752cdf0e10cSrcweir case SID_TRANSLITERATE_HIRAGANA: 753cdf0e10cSrcweir nMode = TransliterationModules_KATAKANA_HIRAGANA; 754cdf0e10cSrcweir break; 755cdf0e10cSrcweir case SID_TRANSLITERATE_KATAGANA: 756cdf0e10cSrcweir nMode = TransliterationModules_HIRAGANA_KATAKANA; 757cdf0e10cSrcweir break; 758cdf0e10cSrcweir 759cdf0e10cSrcweir default: 760cdf0e10cSrcweir ASSERT(!this, "falscher Dispatcher"); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir 763cdf0e10cSrcweir if( nMode ) 764cdf0e10cSrcweir { 765cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 766cdf0e10cSrcweir pOLV->TransliterateText( nMode ); 767cdf0e10cSrcweir } 768cdf0e10cSrcweir } 769cdf0e10cSrcweir } 770cdf0e10cSrcweir 771cdf0e10cSrcweir /*-------------------------------------------------------------------- 772cdf0e10cSrcweir Beschreibung: Sonderzeichen einfuegen (siehe SDraw: FUBULLET.CXX) 773cdf0e10cSrcweir --------------------------------------------------------------------*/ 774cdf0e10cSrcweir 775cdf0e10cSrcweir void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) 776cdf0e10cSrcweir { 777cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 778cdf0e10cSrcweir if(!pOLV) 779cdf0e10cSrcweir return; 780cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 781cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 782cdf0e10cSrcweir if( pArgs ) 783cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); 784cdf0e10cSrcweir 785cdf0e10cSrcweir String sSym; 786cdf0e10cSrcweir String sFontName; 787cdf0e10cSrcweir if ( pItem ) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir sSym = ((const SfxStringItem*)pItem)->GetValue(); 790cdf0e10cSrcweir const SfxPoolItem* pFtItem = NULL; 791cdf0e10cSrcweir pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem); 792cdf0e10cSrcweir const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); 793cdf0e10cSrcweir if ( pFontItem ) 794cdf0e10cSrcweir sFontName = pFontItem->GetValue(); 795cdf0e10cSrcweir } 796cdf0e10cSrcweir 797cdf0e10cSrcweir SfxItemSet aSet(pOLV->GetAttribs()); 798cdf0e10cSrcweir sal_uInt16 nScript = pOLV->GetSelectedScriptType(); 799cdf0e10cSrcweir SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); 800cdf0e10cSrcweir { 801cdf0e10cSrcweir SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); 802cdf0e10cSrcweir aSetItem.GetItemSet().Put( aSet, sal_False ); 803cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); 804cdf0e10cSrcweir if( pI ) 805cdf0e10cSrcweir aSetDlgFont = *(SvxFontItem*)pI; 806cdf0e10cSrcweir else 807cdf0e10cSrcweir aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( 808cdf0e10cSrcweir SID_ATTR_CHAR_FONT, 809cdf0e10cSrcweir GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); 810cdf0e10cSrcweir if (!sFontName.Len()) 811cdf0e10cSrcweir sFontName = aSetDlgFont.GetFamilyName(); 812cdf0e10cSrcweir } 813cdf0e10cSrcweir 814cdf0e10cSrcweir Font aFont(sFontName, Size(1,1)); 815cdf0e10cSrcweir if(!sSym.Len()) 816cdf0e10cSrcweir { 817cdf0e10cSrcweir SfxAllItemSet aAllSet( GetPool() ); 818cdf0e10cSrcweir aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); 819cdf0e10cSrcweir 820cdf0e10cSrcweir SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); 821cdf0e10cSrcweir String sSymbolFont = aOpt.GetSymbolFont(); 822cdf0e10cSrcweir if( sSymbolFont.Len() ) 823cdf0e10cSrcweir aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); 824cdf0e10cSrcweir else 825cdf0e10cSrcweir aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); 826cdf0e10cSrcweir 827cdf0e10cSrcweir // Wenn Zeichen selektiert ist kann es angezeigt werden 828cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 829cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, 830cdf0e10cSrcweir rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); 831cdf0e10cSrcweir sal_uInt16 nResult = pDlg->Execute(); 832cdf0e10cSrcweir if( nResult == RET_OK ) 833cdf0e10cSrcweir { 834cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False ); 835cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); 836cdf0e10cSrcweir if ( pFontItem ) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir aFont.SetName( pFontItem->GetFamilyName() ); 839cdf0e10cSrcweir aFont.SetStyleName( pFontItem->GetStyleName() ); 840cdf0e10cSrcweir aFont.SetCharSet( pFontItem->GetCharSet() ); 841cdf0e10cSrcweir aFont.SetPitch( pFontItem->GetPitch() ); 842cdf0e10cSrcweir } 843cdf0e10cSrcweir 844cdf0e10cSrcweir if ( pCItem ) 845cdf0e10cSrcweir { 846cdf0e10cSrcweir sSym = pCItem->GetValue(); 847cdf0e10cSrcweir aOpt.SetSymbolFont(aFont.GetName()); 848cdf0e10cSrcweir SW_MOD()->ApplyUsrPref(aOpt, &rView); 849cdf0e10cSrcweir } 850cdf0e10cSrcweir } 851cdf0e10cSrcweir 852cdf0e10cSrcweir delete( pDlg ); 853cdf0e10cSrcweir } 854cdf0e10cSrcweir 855cdf0e10cSrcweir if( sSym.Len() ) 856cdf0e10cSrcweir { 857cdf0e10cSrcweir // nicht flackern 858cdf0e10cSrcweir pOLV->HideCursor(); 859cdf0e10cSrcweir SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner(); 860cdf0e10cSrcweir pOutliner->SetUpdateMode(sal_False); 861cdf0e10cSrcweir 862cdf0e10cSrcweir SfxItemSet aOldSet( pOLV->GetAttribs() ); 863cdf0e10cSrcweir SfxItemSet aFontSet( *aOldSet.GetPool(), 864cdf0e10cSrcweir EE_CHAR_FONTINFO, EE_CHAR_FONTINFO, 865cdf0e10cSrcweir EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK, 866cdf0e10cSrcweir EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL, 867cdf0e10cSrcweir 0 ); 868cdf0e10cSrcweir aFontSet.Set( aOldSet ); 869cdf0e10cSrcweir 870cdf0e10cSrcweir // String einfuegen 871cdf0e10cSrcweir pOLV->InsertText( sSym ); 872cdf0e10cSrcweir 873cdf0e10cSrcweir // attributieren (Font setzen) 874cdf0e10cSrcweir SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() ); 875cdf0e10cSrcweir SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(), 876cdf0e10cSrcweir aFont.GetStyleName(), aFont.GetPitch(), 877cdf0e10cSrcweir aFont.GetCharSet(), 878cdf0e10cSrcweir EE_CHAR_FONTINFO ); 879cdf0e10cSrcweir nScript = pBreakIt->GetAllScriptsOfText( sSym ); 880cdf0e10cSrcweir if( SCRIPTTYPE_LATIN & nScript ) 881cdf0e10cSrcweir aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO ); 882cdf0e10cSrcweir if( SCRIPTTYPE_ASIAN & nScript ) 883cdf0e10cSrcweir aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CJK ); 884cdf0e10cSrcweir if( SCRIPTTYPE_COMPLEX & nScript ) 885cdf0e10cSrcweir aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CTL ); 886cdf0e10cSrcweir pOLV->SetAttribs(aFontAttribSet); 887cdf0e10cSrcweir 888cdf0e10cSrcweir // Selektion loeschen 889cdf0e10cSrcweir ESelection aSel(pOLV->GetSelection()); 890cdf0e10cSrcweir aSel.nStartPara = aSel.nEndPara; 891cdf0e10cSrcweir aSel.nStartPos = aSel.nEndPos; 892cdf0e10cSrcweir pOLV->SetSelection(aSel); 893cdf0e10cSrcweir 894cdf0e10cSrcweir // Alten Font restaurieren 895cdf0e10cSrcweir pOLV->SetAttribs( aFontSet ); 896cdf0e10cSrcweir 897cdf0e10cSrcweir // ab jetzt wieder anzeigen 898cdf0e10cSrcweir pOutliner->SetUpdateMode(sal_True); 899cdf0e10cSrcweir pOLV->ShowCursor(); 900cdf0e10cSrcweir 901cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) ); 902cdf0e10cSrcweir if(aFont.GetName().Len()) 903cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) ); 904cdf0e10cSrcweir rReq.Done(); 905cdf0e10cSrcweir } 906cdf0e10cSrcweir } 907cdf0e10cSrcweir /*-- 22.10.2003 14:26:32--------------------------------------------------- 908cdf0e10cSrcweir 909cdf0e10cSrcweir -----------------------------------------------------------------------*/ 910cdf0e10cSrcweir ::svl::IUndoManager* SwDrawTextShell::GetUndoManager() 911cdf0e10cSrcweir { 912cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 913cdf0e10cSrcweir pSdrView = rSh.GetDrawView(); 914cdf0e10cSrcweir SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner(); 915cdf0e10cSrcweir pOutliner = pSdrView->GetTextEditOutliner(); 916cdf0e10cSrcweir return &pOutliner->GetUndoManager(); 917cdf0e10cSrcweir } 918cdf0e10cSrcweir 919512ec161SZheng Fan void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet) 920512ec161SZheng Fan { 921512ec161SZheng Fan SfxWhichIter aIter( rSet ); 922512ec161SZheng Fan sal_uInt16 nWhich = aIter.FirstWhich(); 923512ec161SZheng Fan 924512ec161SZheng Fan SwWrtShell &rSh = GetShell(); 925512ec161SZheng Fan pSdrView = rSh.GetDrawView(); 926cdf0e10cSrcweir 927512ec161SZheng Fan SfxItemSet aAttrs( pSdrView->GetModel()->GetItemPool() ); 928512ec161SZheng Fan pSdrView->GetAttributes( aAttrs ); 929512ec161SZheng Fan 930512ec161SZheng Fan while ( nWhich ) 931512ec161SZheng Fan { 932512ec161SZheng Fan sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) 933512ec161SZheng Fan ? GetPool().GetSlotId(nWhich) 934512ec161SZheng Fan : nWhich; 935512ec161SZheng Fan switch ( nSlotId ) 936512ec161SZheng Fan { 937512ec161SZheng Fan case SID_TABLE_VERT_NONE: 938512ec161SZheng Fan case SID_TABLE_VERT_CENTER: 939512ec161SZheng Fan case SID_TABLE_VERT_BOTTOM: 940512ec161SZheng Fan sal_Bool bContour = sal_False; 941512ec161SZheng Fan SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); 942512ec161SZheng Fan if( eConState != SFX_ITEM_DONTCARE ) 943512ec161SZheng Fan { 944512ec161SZheng Fan bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); 945512ec161SZheng Fan } 946512ec161SZheng Fan if (bContour) break; 947512ec161SZheng Fan 948512ec161SZheng Fan SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); 949512ec161SZheng Fan //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); 950512ec161SZheng Fan 951512ec161SZheng Fan //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) 952512ec161SZheng Fan if(SFX_ITEM_DONTCARE != eVState) 953512ec161SZheng Fan { 954512ec161SZheng Fan SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); 955512ec161SZheng Fan sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP|| 956512ec161SZheng Fan nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER || 957512ec161SZheng Fan nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM; 958512ec161SZheng Fan rSet.Put(SfxBoolItem(nSlotId, bSet)); 959512ec161SZheng Fan } 960512ec161SZheng Fan else 961512ec161SZheng Fan { 962512ec161SZheng Fan rSet.Put(SfxBoolItem(nSlotId, sal_False)); 963512ec161SZheng Fan } 964512ec161SZheng Fan break; 965512ec161SZheng Fan } 966512ec161SZheng Fan nWhich = aIter.NextWhich(); 967512ec161SZheng Fan } 968512ec161SZheng Fan } 969