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 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 28cdf0e10cSrcweir #define _SW_FRMVALID_HXX 29cdf0e10cSrcweir #include <hintids.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <svl/globalnameitem.hxx> 32cdf0e10cSrcweir #include <sfx2/objface.hxx> 33cdf0e10cSrcweir #include <sfx2/lnkbase.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <tools/errinf.hxx> 36cdf0e10cSrcweir #include <svx/svdview.hxx> 37cdf0e10cSrcweir #include <svl/ptitem.hxx> 38cdf0e10cSrcweir #include <svl/stritem.hxx> 39cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 40cdf0e10cSrcweir #include <vcl/msgbox.hxx> 41cdf0e10cSrcweir #include <sfx2/fcontnr.hxx> 42cdf0e10cSrcweir #include <svx/hlnkitem.hxx> 43cdf0e10cSrcweir #include <svl/srchitem.hxx> 44cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 45cdf0e10cSrcweir #include <sfx2/docfile.hxx> 46cdf0e10cSrcweir #include <svl/urihelper.hxx> 47cdf0e10cSrcweir #include <basic/sbxvar.hxx> 48cdf0e10cSrcweir #include <svl/whiter.hxx> 49cdf0e10cSrcweir #include <sfx2/request.hxx> 50cdf0e10cSrcweir #include <editeng/opaqitem.hxx> 51cdf0e10cSrcweir #include <editeng/fontitem.hxx> 52cdf0e10cSrcweir #include <editeng/adjitem.hxx> 53cdf0e10cSrcweir #include <editeng/boxitem.hxx> 54cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 55cdf0e10cSrcweir #include <editeng/svxacorr.hxx> 56cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 57cdf0e10cSrcweir #include <svtools/filter.hxx> 58cdf0e10cSrcweir #include <svx/htmlmode.hxx> 59cdf0e10cSrcweir #include <svx/pfiledlg.hxx> 60cdf0e10cSrcweir #include <svtools/htmlcfg.hxx> 61cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp> 62cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModulesExtra.hpp> 63cdf0e10cSrcweir 64cdf0e10cSrcweir #include <sot/clsids.hxx> 65cdf0e10cSrcweir #include <editeng/acorrcfg.hxx> 66cdf0e10cSrcweir #include <wdocsh.hxx> 67cdf0e10cSrcweir #include <fmtinfmt.hxx> 68cdf0e10cSrcweir #include <fmtclds.hxx> 69cdf0e10cSrcweir #include <fmtsrnd.hxx> 70cdf0e10cSrcweir #include <fmtfsize.hxx> 71cdf0e10cSrcweir #include <swmodule.hxx> 72cdf0e10cSrcweir #include <wrtsh.hxx> 73cdf0e10cSrcweir #include <view.hxx> 74cdf0e10cSrcweir #include <docsh.hxx> 75cdf0e10cSrcweir #include <doc.hxx> 76cdf0e10cSrcweir #include <uitool.hxx> 77cdf0e10cSrcweir #include <cmdid.h> 78cdf0e10cSrcweir #include <globals.hrc> 79cdf0e10cSrcweir #include <frmmgr.hxx> 80cdf0e10cSrcweir #include <textsh.hxx> 81cdf0e10cSrcweir #include <frmfmt.hxx> 82cdf0e10cSrcweir #include <tablemgr.hxx> 83cdf0e10cSrcweir #include <swundo.hxx> // fuer Undo-IDs 84cdf0e10cSrcweir #include <shellio.hxx> 85cdf0e10cSrcweir #include <frmdlg.hxx> 86cdf0e10cSrcweir #include <usrpref.hxx> 87cdf0e10cSrcweir #include <swtable.hxx> 88cdf0e10cSrcweir #include <tblafmt.hxx> 89cdf0e10cSrcweir #include <caption.hxx> 90cdf0e10cSrcweir #include <idxmrk.hxx> 91cdf0e10cSrcweir #include <poolfmt.hxx> 92cdf0e10cSrcweir #include <breakit.hxx> 93cdf0e10cSrcweir #include <crsskip.hxx> 94cdf0e10cSrcweir #include <modcfg.hxx> 95cdf0e10cSrcweir #include <column.hxx> 96cdf0e10cSrcweir #include <edtwin.hxx> 97cdf0e10cSrcweir #include <shells.hrc> 98cdf0e10cSrcweir #include <popup.hrc> 99cdf0e10cSrcweir #include <swerror.h> 100cdf0e10cSrcweir #include <SwAppletImpl.hxx> 101cdf0e10cSrcweir #include <unochart.hxx> 102cdf0e10cSrcweir 103cdf0e10cSrcweir #include <chartins.hxx> 104cdf0e10cSrcweir 105cdf0e10cSrcweir #define SwTextShell 106cdf0e10cSrcweir #define Paragraph 107cdf0e10cSrcweir #define HyphenZone 108cdf0e10cSrcweir #define TextFont 109cdf0e10cSrcweir #define DropCap 110cdf0e10cSrcweir #include <sfx2/msg.hxx> 111f120fe41SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx> 112cdf0e10cSrcweir #include <swslots.hxx> 113cdf0e10cSrcweir #include <SwRewriter.hxx> 114cdf0e10cSrcweir #include <comcore.hrc> 115cdf0e10cSrcweir 116cdf0e10cSrcweir using namespace ::com::sun::star; 117cdf0e10cSrcweir using ::rtl::OUString; 118cdf0e10cSrcweir 119cdf0e10cSrcweir #include <svx/svxdlg.hxx> 120cdf0e10cSrcweir #include <svx/dialogs.hrc> 121cdf0e10cSrcweir #include "swabstdlg.hxx" 122cdf0e10cSrcweir #include <misc.hrc> 123cdf0e10cSrcweir #include <table.hrc> 124cdf0e10cSrcweir #include <frmui.hrc> 125cdf0e10cSrcweir #include <unomid.h> 126cdf0e10cSrcweir 127cdf0e10cSrcweir 128cdf0e10cSrcweir 129cdf0e10cSrcweir /*-------------------------------------------------------------------- 130cdf0e10cSrcweir Beschreibung: 131cdf0e10cSrcweir --------------------------------------------------------------------*/ 132cdf0e10cSrcweir 133cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwTextShell, SwBaseShell, SW_RES(STR_SHELLNAME_TEXT)) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TEXT_POPUPMENU)); 136cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX)); 137cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(FN_EDIT_FORMULA); 138cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD); 139cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_IDX_ENTRY_DLG); 140cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_AUTH_ENTRY_DLG); 141cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SID_RUBY_DIALOG); 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir TYPEINIT1(SwTextShell,SwBaseShell) 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir void SwTextShell::ExecInsert(SfxRequest &rReq) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 153cdf0e10cSrcweir 154cdf0e10cSrcweir ASSERT( !rSh.IsObjSelected() && !rSh.IsFrmSelected(), 155cdf0e10cSrcweir "Falsche Shell auf dem Dispatcher" ); 156cdf0e10cSrcweir 157cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 158cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 159cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 160cdf0e10cSrcweir if(pArgs) 161cdf0e10cSrcweir pArgs->GetItemState(nSlot, sal_False, &pItem ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir switch( nSlot ) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir case FN_INSERT_STRING: 166cdf0e10cSrcweir if( pItem ) 167cdf0e10cSrcweir rSh.InsertByWord(((const SfxStringItem *)pItem)->GetValue()); 168cdf0e10cSrcweir break; 169*69a74367SOliver-Rainer Wittmann 170cdf0e10cSrcweir case FN_INSERT_SOFT_HYPHEN: 171cdf0e10cSrcweir if( CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, 0 ) && 172cdf0e10cSrcweir CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, -1 )) 173cdf0e10cSrcweir rSh.Insert( String( CHAR_SOFTHYPHEN ) ); 174cdf0e10cSrcweir break; 175cdf0e10cSrcweir 176cdf0e10cSrcweir case FN_INSERT_HARDHYPHEN: 177cdf0e10cSrcweir case FN_INSERT_HARD_SPACE: 178cdf0e10cSrcweir { 179*69a74367SOliver-Rainer Wittmann const sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK : CHAR_HARDHYPHEN; 180cdf0e10cSrcweir 181cdf0e10cSrcweir SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get(); 182cdf0e10cSrcweir SvxAutoCorrect* pACorr = pACfg->GetAutoCorrect(); 183*69a74367SOliver-Rainer Wittmann if( pACorr && pACfg->IsAutoFmtByInput() 184*69a74367SOliver-Rainer Wittmann && pACorr->IsAutoCorrFlag( 185*69a74367SOliver-Rainer Wittmann CptlSttSntnc | CptlSttWrd | AddNonBrkSpace | ChgOrdinalNumber | ChgToEnEmDash | SetINetAttr | Autocorrect ) ) 186*69a74367SOliver-Rainer Wittmann { 187cdf0e10cSrcweir rSh.AutoCorrect( *pACorr, cIns ); 188*69a74367SOliver-Rainer Wittmann } 189cdf0e10cSrcweir else 190*69a74367SOliver-Rainer Wittmann { 191cdf0e10cSrcweir rSh.Insert( String( cIns ) ); 192cdf0e10cSrcweir } 193*69a74367SOliver-Rainer Wittmann } 194cdf0e10cSrcweir break; 195*69a74367SOliver-Rainer Wittmann 196cdf0e10cSrcweir case SID_INSERT_RLM : 197cdf0e10cSrcweir case SID_INSERT_LRM : 198cdf0e10cSrcweir case SID_INSERT_ZWNBSP : 199cdf0e10cSrcweir case SID_INSERT_ZWSP: 200cdf0e10cSrcweir { 201cdf0e10cSrcweir sal_Unicode cIns = 0; 202cdf0e10cSrcweir switch(nSlot) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir case SID_INSERT_RLM : cIns = CHAR_RLM ; break; 205cdf0e10cSrcweir case SID_INSERT_LRM : cIns = CHAR_LRM ; break; 206cdf0e10cSrcweir case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break; 207cdf0e10cSrcweir case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break; 208cdf0e10cSrcweir } 209cdf0e10cSrcweir rSh.Insert( String( cIns ) ); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir break; 212*69a74367SOliver-Rainer Wittmann 213cdf0e10cSrcweir case FN_INSERT_BREAK: 214*69a74367SOliver-Rainer Wittmann { 215*69a74367SOliver-Rainer Wittmann if( !rSh.CrsrInsideInputFld() ) 216*69a74367SOliver-Rainer Wittmann { 217cdf0e10cSrcweir rSh.SplitNode(); 218*69a74367SOliver-Rainer Wittmann } 219*69a74367SOliver-Rainer Wittmann else 220*69a74367SOliver-Rainer Wittmann { 221*69a74367SOliver-Rainer Wittmann rSh.InsertLineBreak(); 222*69a74367SOliver-Rainer Wittmann } 223*69a74367SOliver-Rainer Wittmann } 224cdf0e10cSrcweir rReq.Done(); 225cdf0e10cSrcweir break; 226*69a74367SOliver-Rainer Wittmann 227cdf0e10cSrcweir case FN_INSERT_PAGEBREAK: 228cdf0e10cSrcweir rSh.InsertPageBreak(); 229cdf0e10cSrcweir rReq.Done(); 230cdf0e10cSrcweir break; 231*69a74367SOliver-Rainer Wittmann 232cdf0e10cSrcweir case FN_INSERT_LINEBREAK: 233cdf0e10cSrcweir rSh.InsertLineBreak(); 234cdf0e10cSrcweir rReq.Done(); 235cdf0e10cSrcweir break; 236*69a74367SOliver-Rainer Wittmann 237cdf0e10cSrcweir case FN_INSERT_COLUMN_BREAK: 238cdf0e10cSrcweir rSh.InsertColumnBreak(); 239cdf0e10cSrcweir rReq.Done(); 240cdf0e10cSrcweir break; 241*69a74367SOliver-Rainer Wittmann 242cdf0e10cSrcweir case SID_HYPERLINK_SETLINK: 243cdf0e10cSrcweir if (pItem) 244cdf0e10cSrcweir InsertHyperlink(*((const SvxHyperlinkItem *)pItem)); 245cdf0e10cSrcweir rReq.Done(); 246cdf0e10cSrcweir break; 247*69a74367SOliver-Rainer Wittmann 248cdf0e10cSrcweir case SID_INSERT_AVMEDIA: 249cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq ))); 250cdf0e10cSrcweir break; 251*69a74367SOliver-Rainer Wittmann 252cdf0e10cSrcweir case SID_INSERT_SOUND: 253cdf0e10cSrcweir case SID_INSERT_VIDEO: 254cdf0e10cSrcweir { 255cdf0e10cSrcweir SvxPluginFileDlg aDlg( &GetView().GetViewFrame()->GetWindow(), nSlot ); 256cdf0e10cSrcweir aDlg.SetContext( nSlot == SID_INSERT_SOUND? sfx2::FileDialogHelper::SW_INSERT_SOUND : sfx2::FileDialogHelper::SW_INSERT_VIDEO ); 257cdf0e10cSrcweir 258cdf0e10cSrcweir if ( ERRCODE_NONE == aDlg.Execute() ) 259cdf0e10cSrcweir { 260cdf0e10cSrcweir // URL ermitteln 261cdf0e10cSrcweir String aStrURL( aDlg.GetPath() ); 262cdf0e10cSrcweir aStrURL = URIHelper::SmartRel2Abs( 263cdf0e10cSrcweir INetURLObject(), aStrURL, URIHelper::GetMaybeFileHdl() ); 264cdf0e10cSrcweir 265cdf0e10cSrcweir INetURLObject* pURL = new INetURLObject(); 266cdf0e10cSrcweir pURL->SetSmartProtocol( INET_PROT_FILE ); 267cdf0e10cSrcweir 268cdf0e10cSrcweir if ( pURL->SetURL( aStrURL, INetURLObject::WAS_ENCODED ) ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir ::rtl::OUString aName; 271cdf0e10cSrcweir comphelper::EmbeddedObjectContainer aCnt; 272cdf0e10cSrcweir svt::EmbeddedObjectRef xObj( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT ); 273cdf0e10cSrcweir if ( xObj.is() ) 274cdf0e10cSrcweir { 275cdf0e10cSrcweir svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() ); 276cdf0e10cSrcweir 277cdf0e10cSrcweir // set properties from dialog 278cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); 279cdf0e10cSrcweir if ( xSet.is() ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"), 282cdf0e10cSrcweir uno::makeAny( ::rtl::OUString( pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) ); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir rSh.InsertObject( xObj, 0, sal_True, nSlot); 287cdf0e10cSrcweir } 288cdf0e10cSrcweir } 289cdf0e10cSrcweir } 290cdf0e10cSrcweir break; 291*69a74367SOliver-Rainer Wittmann 292cdf0e10cSrcweir case SID_INSERT_OBJECT: 293cdf0e10cSrcweir case SID_INSERT_PLUGIN: 294cdf0e10cSrcweir { 295cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNameItem, SfxGlobalNameItem, SID_INSERT_OBJECT, sal_False ); 296cdf0e10cSrcweir SvGlobalName *pName = NULL; 297cdf0e10cSrcweir SvGlobalName aName; 298cdf0e10cSrcweir if ( pNameItem ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir aName = pNameItem->GetValue(); 301cdf0e10cSrcweir pName = &aName; 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pClassLocationItem, SfxStringItem, FN_PARAM_2, sal_False ); 305cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pCommandsItem, SfxStringItem, FN_PARAM_3, sal_False ); 306cdf0e10cSrcweir //TODO/LATER: recording currently not working, need code for Commandlist 307cdf0e10cSrcweir svt::EmbeddedObjectRef xObj; 308cdf0e10cSrcweir if( nSlot == SID_INSERT_PLUGIN && ( pClassLocationItem || pCommandsItem ) ) 309cdf0e10cSrcweir { 310cdf0e10cSrcweir String sClassLocation; 311cdf0e10cSrcweir if(pClassLocationItem) 312cdf0e10cSrcweir sClassLocation = pClassLocationItem->GetValue(); 313cdf0e10cSrcweir 314cdf0e10cSrcweir SvCommandList aCommandList; 315cdf0e10cSrcweir if(pCommandsItem) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir sal_uInt16 nTemp; 318cdf0e10cSrcweir aCommandList.AppendCommands( pCommandsItem->GetValue(), &nTemp ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir { 322cdf0e10cSrcweir comphelper::EmbeddedObjectContainer aCnt; 323cdf0e10cSrcweir ::rtl::OUString sName; 324cdf0e10cSrcweir xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), sName ), 325cdf0e10cSrcweir embed::Aspects::MSOLE_CONTENT ); 326cdf0e10cSrcweir svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() ); 327cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); 328cdf0e10cSrcweir if ( xSet.is() ) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir try 331cdf0e10cSrcweir { 332cdf0e10cSrcweir if ( sClassLocation.Len() ) 333cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"), 334cdf0e10cSrcweir uno::makeAny( 335cdf0e10cSrcweir ::rtl::OUString( 336cdf0e10cSrcweir URIHelper::SmartRel2Abs( 337cdf0e10cSrcweir INetURLObject(), sClassLocation, 338cdf0e10cSrcweir URIHelper::GetMaybeFileHdl()) ) ) ); 339cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aSeq; 340cdf0e10cSrcweir if ( aCommandList.Count() ) 341cdf0e10cSrcweir { 342cdf0e10cSrcweir aCommandList.FillSequence( aSeq ); 343cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands"), uno::makeAny( aSeq ) ); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir } 346cdf0e10cSrcweir catch ( uno::Exception& ) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir } 349cdf0e10cSrcweir } 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir if(xObj.is()) 353cdf0e10cSrcweir rSh.InsertOleObject( xObj ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir else 356cdf0e10cSrcweir { 357cdf0e10cSrcweir DBG_ASSERT( !pNameItem || nSlot == SID_INSERT_OBJECT, "Superfluous argument!" ); 358cdf0e10cSrcweir rSh.InsertObject( xObj, pName, sal_True, nSlot); 359cdf0e10cSrcweir rReq.Done(); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir break; 362cdf0e10cSrcweir } 363cdf0e10cSrcweir case SID_INSERT_FLOATINGFRAME: 364cdf0e10cSrcweir { 365cdf0e10cSrcweir svt::EmbeddedObjectRef xObj; 366cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, FN_PARAM_1, sal_False ); 367cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, FN_PARAM_2, sal_False ); 368cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pMarginItem, SvxSizeItem, FN_PARAM_3, sal_False ); 369cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pScrollingItem, SfxByteItem, FN_PARAM_4, sal_False ); 370cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pBorderItem, SfxBoolItem, FN_PARAM_5, sal_False ); 371cdf0e10cSrcweir 372cdf0e10cSrcweir if(pURLItem) // URL is a _must_ 373cdf0e10cSrcweir { 374cdf0e10cSrcweir comphelper::EmbeddedObjectContainer aCnt; 375cdf0e10cSrcweir ::rtl::OUString aName; 376cdf0e10cSrcweir xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence(), aName ), 377cdf0e10cSrcweir embed::Aspects::MSOLE_CONTENT ); 378cdf0e10cSrcweir svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() ); 379cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); 380cdf0e10cSrcweir if ( xSet.is() ) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir try 383cdf0e10cSrcweir { 384cdf0e10cSrcweir ScrollingMode eScroll = ScrollingAuto; 385cdf0e10cSrcweir if( pScrollingItem && pScrollingItem->GetValue() <= ScrollingAuto ) 386cdf0e10cSrcweir eScroll = (ScrollingMode) pScrollingItem->GetValue(); 387cdf0e10cSrcweir 388cdf0e10cSrcweir Size aMargin; 389cdf0e10cSrcweir if ( pMarginItem ) 390cdf0e10cSrcweir aMargin = pMarginItem->GetSize(); 391cdf0e10cSrcweir 392cdf0e10cSrcweir if ( pURLItem ) 393cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameURL"), uno::makeAny( ::rtl::OUString( pURLItem->GetValue() ) ) ); 394cdf0e10cSrcweir if ( pNameItem ) 395cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameName"), uno::makeAny( ::rtl::OUString( pNameItem->GetValue() ) ) ); 396cdf0e10cSrcweir 397cdf0e10cSrcweir if ( eScroll == ScrollingAuto ) 398cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll"), 399cdf0e10cSrcweir uno::makeAny( sal_True ) ); 400cdf0e10cSrcweir else 401cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode"), 402cdf0e10cSrcweir uno::makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) ); 403cdf0e10cSrcweir 404cdf0e10cSrcweir //if ( aFrmDescr.IsFrameBorderSet() ) 405cdf0e10cSrcweir if ( pBorderItem ) 406cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder"), 407cdf0e10cSrcweir uno::makeAny( (sal_Bool) pBorderItem->GetValue() ) ); 408cdf0e10cSrcweir /*else 409cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder"), 410cdf0e10cSrcweir makeAny( sal_True ) );*/ 411cdf0e10cSrcweir 412cdf0e10cSrcweir if ( pMarginItem ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth"), 415cdf0e10cSrcweir uno::makeAny( sal_Int32( aMargin.Width() ) ) ); 416cdf0e10cSrcweir 417cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight"), 418cdf0e10cSrcweir uno::makeAny( sal_Int32( aMargin.Height() ) ) ); 419cdf0e10cSrcweir } 420cdf0e10cSrcweir } 421cdf0e10cSrcweir catch ( uno::Exception& ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir } 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426cdf0e10cSrcweir rSh.InsertOleObject( xObj ); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir else 429cdf0e10cSrcweir { 430cdf0e10cSrcweir rSh.InsertObject( xObj, 0, sal_True, nSlot); 431cdf0e10cSrcweir rReq.Done(); 432cdf0e10cSrcweir } 433cdf0e10cSrcweir } 434cdf0e10cSrcweir break; 435cdf0e10cSrcweir case SID_INSERT_DIAGRAM: 436cdf0e10cSrcweir { 437cdf0e10cSrcweir SvtModuleOptions aMOpt; 438cdf0e10cSrcweir if ( !aMOpt.IsChart() ) 439cdf0e10cSrcweir break; 440cdf0e10cSrcweir if(!rReq.IsAPI()) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 443cdf0e10cSrcweir SwInsertChart( &GetView().GetEditWin(), &pVFrame->GetBindings() ); 444cdf0e10cSrcweir } 445cdf0e10cSrcweir else 446cdf0e10cSrcweir { 447cdf0e10cSrcweir uno::Reference< chart2::data::XDataProvider > xDataProvider; 448cdf0e10cSrcweir sal_Bool bFillWithData = sal_True; 449cdf0e10cSrcweir OUString aRangeString; 450cdf0e10cSrcweir if (!GetShell().IsTblComplexForChart()) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir SwFrmFmt* pTblFmt = GetShell().GetTableFmt(); 453cdf0e10cSrcweir String aCurrentTblName = pTblFmt->GetName(); 454cdf0e10cSrcweir // String aText( String::CreateFromAscii("<.>") ); // was used for UI 455cdf0e10cSrcweir // aText.Insert( rWrtShell.GetBoxNms(), 2); 456cdf0e10cSrcweir // aText.Insert( aCurrentTblName, 1 ); 457cdf0e10cSrcweir aRangeString = aCurrentTblName; 458cdf0e10cSrcweir aRangeString += OUString::valueOf( sal_Unicode('.') ); 459cdf0e10cSrcweir aRangeString += GetShell().GetBoxNms(); 460cdf0e10cSrcweir 461cdf0e10cSrcweir // get table data provider 462cdf0e10cSrcweir xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider() ); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir else 465cdf0e10cSrcweir bFillWithData = sal_False; // will create chart with only it's default image 466cdf0e10cSrcweir 467cdf0e10cSrcweir SwTableFUNC( &rSh, sal_False ).InsertChart( xDataProvider, bFillWithData, aRangeString ); 468cdf0e10cSrcweir rSh.LaunchOLEObj(); 469cdf0e10cSrcweir 470cdf0e10cSrcweir svt::EmbeddedObjectRef& xObj = rSh.GetOLEObject(); 471cdf0e10cSrcweir if(pItem && xObj.is()) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir Size aSize(((SvxSizeItem*)pItem)->GetSize()); 474cdf0e10cSrcweir aSize = OutputDevice::LogicToLogic 475cdf0e10cSrcweir ( aSize, MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ) ); 476cdf0e10cSrcweir 477cdf0e10cSrcweir if(aSize.Width() > MINLAY&& aSize.Height()> MINLAY) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir awt::Size aSz; 480cdf0e10cSrcweir aSz.Width = aSize.Width(); 481cdf0e10cSrcweir aSz.Height = aSize.Height(); 482cdf0e10cSrcweir xObj->setVisualAreaSize( xObj.GetViewAspect(), aSz ); 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } 485cdf0e10cSrcweir } 486cdf0e10cSrcweir } 487cdf0e10cSrcweir break; 488cdf0e10cSrcweir 489cdf0e10cSrcweir case FN_INSERT_SMA: 490cdf0e10cSrcweir { 491cdf0e10cSrcweir // #i34343# Inserting a math object into an autocompletion crashes 492cdf0e10cSrcweir // the suggestion has to be removed before 493cdf0e10cSrcweir GetView().GetEditWin().StopQuickHelp(); 494cdf0e10cSrcweir SvGlobalName aGlobalName( SO3_SM_CLASSID ); 495cdf0e10cSrcweir rSh.InsertObject( svt::EmbeddedObjectRef(), &aGlobalName, sal_True, 0 ); 496cdf0e10cSrcweir } 497cdf0e10cSrcweir break; 498cdf0e10cSrcweir 499cdf0e10cSrcweir case FN_INSERT_TABLE: 500cdf0e10cSrcweir InsertTable( rReq ); 501cdf0e10cSrcweir break; 502cdf0e10cSrcweir 503cdf0e10cSrcweir case FN_INSERT_FRAME_INTERACT_NOCOL: 504cdf0e10cSrcweir case FN_INSERT_FRAME_INTERACT: 505cdf0e10cSrcweir { 506cdf0e10cSrcweir sal_uInt16 nCols = 1; 507cdf0e10cSrcweir sal_Bool bModifier1 = rReq.GetModifier() == KEY_MOD1; 508cdf0e10cSrcweir if(pArgs) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir if(FN_INSERT_FRAME_INTERACT_NOCOL != nSlot && 511cdf0e10cSrcweir pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem) == SFX_ITEM_SET) 512cdf0e10cSrcweir nCols = ((SfxUInt16Item *)pItem)->GetValue(); 513cdf0e10cSrcweir if(pArgs->GetItemState(SID_MODIFIER, sal_False, &pItem) == SFX_ITEM_SET) 514cdf0e10cSrcweir bModifier1 |= KEY_MOD1 == ((SfxUInt16Item *)pItem)->GetValue(); 515cdf0e10cSrcweir } 516cdf0e10cSrcweir if(bModifier1 ) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir SwEditWin& rEdtWin = GetView().GetEditWin(); 519cdf0e10cSrcweir Size aWinSize = rEdtWin.GetSizePixel(); 520cdf0e10cSrcweir Point aStartPos(aWinSize.Width()/2, aWinSize.Height() / 2); 521cdf0e10cSrcweir aStartPos = rEdtWin.PixelToLogic(aStartPos); 522cdf0e10cSrcweir aStartPos.X() -= 8 * MM50; 523cdf0e10cSrcweir aStartPos.Y() -= 4 * MM50; 524cdf0e10cSrcweir Size aSize(16 * MM50, 8 * MM50); 525cdf0e10cSrcweir GetShell().LockPaint(); 526cdf0e10cSrcweir GetShell().StartAllAction(); 527cdf0e10cSrcweir SwFlyFrmAttrMgr aMgr( sal_True, GetShellPtr(), FRMMGR_TYPE_TEXT ); 528cdf0e10cSrcweir if(nCols > 1) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir SwFmtCol aCol; 531cdf0e10cSrcweir aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() ); 532cdf0e10cSrcweir aMgr.SetCol( aCol ); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir aMgr.InsertFlyFrm(FLY_AT_PARA, aStartPos, aSize); 535cdf0e10cSrcweir GetShell().EndAllAction(); 536cdf0e10cSrcweir GetShell().UnlockPaint(); 537cdf0e10cSrcweir } 538cdf0e10cSrcweir else 539cdf0e10cSrcweir { 540cdf0e10cSrcweir GetView().InsFrmMode(nCols); 541cdf0e10cSrcweir } 542cdf0e10cSrcweir rReq.Ignore(); 543cdf0e10cSrcweir } 544cdf0e10cSrcweir break; 545cdf0e10cSrcweir case FN_INSERT_FRAME: 546cdf0e10cSrcweir { 547cdf0e10cSrcweir sal_Bool bSingleCol = sal_False; 548cdf0e10cSrcweir if( 0!= dynamic_cast< SwWebDocShell*>( GetView().GetDocShell()) ) 549cdf0e10cSrcweir { 550cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 551cdf0e10cSrcweir sal_uInt16 nExport = pHtmlOpt->GetExportMode(); 552cdf0e10cSrcweir if( HTML_CFG_MSIE == nExport || 553cdf0e10cSrcweir HTML_CFG_HTML32 == nExport || 554cdf0e10cSrcweir HTML_CFG_MSIE_40 == nExport || 555cdf0e10cSrcweir HTML_CFG_HTML32 == nExport ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir bSingleCol = sal_True; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir 560cdf0e10cSrcweir } 561cdf0e10cSrcweir // Rahmen neu anlegen 562cdf0e10cSrcweir SwFlyFrmAttrMgr aMgr( sal_True, GetShellPtr(), FRMMGR_TYPE_TEXT ); 563cdf0e10cSrcweir if(pArgs) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir Size aSize(aMgr.GetSize()); 566cdf0e10cSrcweir aSize.Width() = GetShell().GetAnyCurRect(RECT_PAGE_PRT).Width(); 567cdf0e10cSrcweir Point aPos = aMgr.GetPos(); 568cdf0e10cSrcweir RndStdIds eAnchor = FLY_AT_PARA; 569cdf0e10cSrcweir if(pArgs->GetItemState(nSlot, sal_False, &pItem) == SFX_ITEM_SET) 570cdf0e10cSrcweir eAnchor = (RndStdIds)((SfxUInt16Item *)pItem)->GetValue(); 571cdf0e10cSrcweir if(pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem) == SFX_ITEM_SET) 572cdf0e10cSrcweir aPos = ((SfxPointItem *)pItem)->GetValue(); 573cdf0e10cSrcweir if(pArgs->GetItemState(FN_PARAM_2, sal_False, &pItem) == SFX_ITEM_SET) 574cdf0e10cSrcweir aSize = ((SvxSizeItem *)pItem)->GetSize(); 575cdf0e10cSrcweir if(pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem) == SFX_ITEM_SET) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir sal_uInt16 nCols = ((SfxUInt16Item *)pItem)->GetValue(); 578cdf0e10cSrcweir if( !bSingleCol && 1 < nCols ) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir SwFmtCol aFmtCol; 581cdf0e10cSrcweir aFmtCol.Init( nCols , (rReq.IsAPI() ? 0 582cdf0e10cSrcweir : DEF_GUTTER_WIDTH), USHRT_MAX ); 583cdf0e10cSrcweir aMgr.SetCol(aFmtCol); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir GetShell().LockPaint(); 588cdf0e10cSrcweir GetShell().StartAllAction(); 589cdf0e10cSrcweir 590cdf0e10cSrcweir aMgr.InsertFlyFrm(eAnchor, aPos, aSize); 591cdf0e10cSrcweir 592cdf0e10cSrcweir GetShell().EndAllAction(); 593cdf0e10cSrcweir GetShell().UnlockPaint(); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir else 596cdf0e10cSrcweir { 597cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aFrmAttrRange[] = 598cdf0e10cSrcweir { 599cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 600cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 601cdf0e10cSrcweir FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, 602cdf0e10cSrcweir SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, 603cdf0e10cSrcweir FN_SET_FRM_NAME, FN_SET_FRM_NAME, 604cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE, 605cdf0e10cSrcweir 0 606cdf0e10cSrcweir }; 607cdf0e10cSrcweir 608cdf0e10cSrcweir SfxItemSet aSet(GetPool(), aFrmAttrRange ); 609cdf0e10cSrcweir aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); 610cdf0e10cSrcweir const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE); 611cdf0e10cSrcweir SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height()); 612cdf0e10cSrcweir aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE)); 613cdf0e10cSrcweir aSet.Put(aFrmSize); 614cdf0e10cSrcweir 615cdf0e10cSrcweir const SwRect &rPr = GetShell().GetAnyCurRect(RECT_PAGE_PRT); 616cdf0e10cSrcweir SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height()); 617cdf0e10cSrcweir aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA)); 618cdf0e10cSrcweir aSet.Put(aPrtSize); 619cdf0e10cSrcweir 620cdf0e10cSrcweir aSet.Put(aMgr.GetAttrSet()); 621cdf0e10cSrcweir aSet.SetParent( aMgr.GetAttrSet().GetParent() ); 622cdf0e10cSrcweir 623cdf0e10cSrcweir // Minimalgroesse in Spalten loeschen 624cdf0e10cSrcweir SvxBoxInfoItem aBoxInfo((SvxBoxInfoItem &)aSet.Get(SID_ATTR_BORDER_INNER)); 625cdf0e10cSrcweir const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX); 626cdf0e10cSrcweir aBoxInfo.SetMinDist(sal_False); 627cdf0e10cSrcweir aBoxInfo.SetDefDist(rBox.GetDistance(BOX_LINE_LEFT)); 628cdf0e10cSrcweir aSet.Put(aBoxInfo); 629cdf0e10cSrcweir 630cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell())); 631cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); 632cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 633cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 634cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD, 635cdf0e10cSrcweir GetView().GetViewFrame(), &GetView().GetViewFrame()->GetWindow(), aSet, sal_True); 636cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 637cdf0e10cSrcweir if(pDlg->Execute() && pDlg->GetOutputItemSet()) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir //local variable necessary at least after call of .AutoCaption() because this could be deleted at this point 640cdf0e10cSrcweir SwWrtShell& rShell = GetShell(); 641cdf0e10cSrcweir rShell.LockPaint(); 642cdf0e10cSrcweir rShell.StartAllAction(); 643cdf0e10cSrcweir rShell.StartUndo(UNDO_INSERT); 644cdf0e10cSrcweir 645cdf0e10cSrcweir const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); 646cdf0e10cSrcweir aMgr.SetAttrSet(*pOutSet); 647cdf0e10cSrcweir 648cdf0e10cSrcweir // beim ClickToEditFeld erst die Selektion loeschen 649cdf0e10cSrcweir if( rShell.IsInClickToEdit() ) 650cdf0e10cSrcweir rShell.DelRight(); 651cdf0e10cSrcweir 652cdf0e10cSrcweir aMgr.InsertFlyFrm(); 653cdf0e10cSrcweir 654cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 655cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().GetRecorder(); 656cdf0e10cSrcweir if ( xRecorder.is() ) 657cdf0e10cSrcweir { 658cdf0e10cSrcweir //FN_INSERT_FRAME 659cdf0e10cSrcweir sal_uInt16 nAnchor = (sal_uInt16)aMgr.GetAnchor(); 660cdf0e10cSrcweir rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor)); 661cdf0e10cSrcweir rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos())); 662cdf0e10cSrcweir rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize())); 663cdf0e10cSrcweir rReq.Done(); 664cdf0e10cSrcweir } 665cdf0e10cSrcweir 666cdf0e10cSrcweir GetView().AutoCaption(FRAME_CAP); 667cdf0e10cSrcweir 668cdf0e10cSrcweir { 669cdf0e10cSrcweir SwRewriter aRewriter; 670cdf0e10cSrcweir 671cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME)); 672cdf0e10cSrcweir 673cdf0e10cSrcweir rShell.EndUndo(UNDO_INSERT, &aRewriter); 674cdf0e10cSrcweir } 675cdf0e10cSrcweir rShell.EndAllAction(); 676cdf0e10cSrcweir rShell.UnlockPaint(); 677cdf0e10cSrcweir } 678cdf0e10cSrcweir 679cdf0e10cSrcweir DELETEZ(pDlg); 680cdf0e10cSrcweir } 681cdf0e10cSrcweir break; 682cdf0e10cSrcweir } 683cdf0e10cSrcweir case FN_INSERT_HRULER: 684cdf0e10cSrcweir { 685cdf0e10cSrcweir String sPath; 686cdf0e10cSrcweir sal_Bool bSimpleLine = sal_False; 687cdf0e10cSrcweir sal_Bool bRet = sal_False; 688cdf0e10cSrcweir Window* pParent = GetView().GetWindow(); 689cdf0e10cSrcweir if ( pItem ) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir sPath = ((SfxStringItem*)pItem)->GetValue(); 692cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pSimple, SfxBoolItem, FN_PARAM_1 , sal_False ); 693cdf0e10cSrcweir if ( pSimple ) 694cdf0e10cSrcweir bSimpleLine = pSimple->GetValue(); 695cdf0e10cSrcweir } 696cdf0e10cSrcweir else 697cdf0e10cSrcweir { 698cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 699cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 700cdf0e10cSrcweir AbstractInsertGrfRulerDlg* pDlg = pFact->CreateInsertGrfRulerDlg( DLG_INSERT_RULER, 701cdf0e10cSrcweir pParent ); 702cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 703cdf0e10cSrcweir // MessageBox fuer fehlende Grafiken 704cdf0e10cSrcweir if(!pDlg->HasImages()) 705cdf0e10cSrcweir InfoBox( pParent, SW_RES(MSG_NO_RULER)).Execute(); 706cdf0e10cSrcweir if(RET_OK == pDlg->Execute()) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir sPath = pDlg->GetGraphicName(); 709cdf0e10cSrcweir bSimpleLine = pDlg->IsSimpleLine(); 710cdf0e10cSrcweir } 711cdf0e10cSrcweir 712cdf0e10cSrcweir delete pDlg; 713cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_INSERT_HRULER, sPath ) ); 714cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bSimpleLine ) ); 715cdf0e10cSrcweir } 716cdf0e10cSrcweir 717cdf0e10cSrcweir rSh.StartAllAction(); 718cdf0e10cSrcweir rSh.StartUndo(UNDO_UI_INSERT_RULER); 719cdf0e10cSrcweir if(bSimpleLine) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir if(!(rSh.IsSttOfPara() && rSh.IsEndOfPara())) // kein leerer Absatz? 722cdf0e10cSrcweir rSh.SplitNode( sal_False, sal_False ); // dann Platz schaffen 723cdf0e10cSrcweir rSh.SplitNode( sal_False, sal_False ); 724cdf0e10cSrcweir rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 725cdf0e10cSrcweir rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_HTML_HR )); 726cdf0e10cSrcweir rSh.Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 727cdf0e10cSrcweir bRet = sal_True; 728cdf0e10cSrcweir } 729cdf0e10cSrcweir else if(sPath.Len()) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir SwFlyFrmAttrMgr aFrmMgr( sal_True, &rSh, FRMMGR_TYPE_GRF ); 732cdf0e10cSrcweir // am FrmMgr muessen die richtigen Parameter eingestellt werden 733cdf0e10cSrcweir 734cdf0e10cSrcweir aFrmMgr.SetAnchor(FLY_AS_CHAR); 735cdf0e10cSrcweir 736cdf0e10cSrcweir rSh.SplitNode( sal_False, sal_False ); 737cdf0e10cSrcweir rSh.SplitNode( sal_False, sal_False ); 738cdf0e10cSrcweir rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 739*69a74367SOliver-Rainer Wittmann rSh.SetAttrItem(SvxAdjustItem(SVX_ADJUST_CENTER,RES_PARATR_ADJUST )); 740cdf0e10cSrcweir if(GRFILTER_OK == GetView().InsertGraphic(sPath, aEmptyStr, sal_True, 0, 0 )) 741cdf0e10cSrcweir bRet = sal_True; 742cdf0e10cSrcweir rSh.EnterStdMode(); 743cdf0e10cSrcweir rSh.Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 744cdf0e10cSrcweir } 745cdf0e10cSrcweir rSh.EndAllAction(); 746cdf0e10cSrcweir rSh.EndUndo(UNDO_UI_INSERT_RULER); 747cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); 748cdf0e10cSrcweir rReq.Done(); 749cdf0e10cSrcweir } 750cdf0e10cSrcweir break; 751cdf0e10cSrcweir case FN_FORMAT_COLUMN : 752cdf0e10cSrcweir { 753cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 754cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 755cdf0e10cSrcweir VclAbstractDialog* pColDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_COLUMN); 756cdf0e10cSrcweir DBG_ASSERT(pColDlg, "Dialogdiet fail!"); 757cdf0e10cSrcweir pColDlg->Execute(); 758cdf0e10cSrcweir delete pColDlg; 759cdf0e10cSrcweir } 760cdf0e10cSrcweir break; 761cdf0e10cSrcweir 762cdf0e10cSrcweir default: 763cdf0e10cSrcweir ASSERT( !this, "falscher Dispatcher" ); 764cdf0e10cSrcweir return; 765cdf0e10cSrcweir } 766cdf0e10cSrcweir } 767cdf0e10cSrcweir 768cdf0e10cSrcweir bool lcl_IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect ) 769cdf0e10cSrcweir { 770cdf0e10cSrcweir rWrtSh.SwapPam(); 771cdf0e10cSrcweir bool bRet = pSect == rWrtSh.GetCurrSection(); 772cdf0e10cSrcweir rWrtSh.SwapPam(); 773cdf0e10cSrcweir return bRet; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir 777cdf0e10cSrcweir void SwTextShell::StateInsert( SfxItemSet &rSet ) 778cdf0e10cSrcweir { 779cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); 780cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 781cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 782cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 783cdf0e10cSrcweir SvtModuleOptions aMOpt; 784cdf0e10cSrcweir SfxObjectCreateMode eCreateMode = 785cdf0e10cSrcweir GetView().GetDocShell()->GetCreateMode(); 786cdf0e10cSrcweir 787cdf0e10cSrcweir rSh.Push(); 788cdf0e10cSrcweir const sal_Bool bCrsrInHidden = rSh.SelectHiddenRange(); 789cdf0e10cSrcweir rSh.Pop(); 790cdf0e10cSrcweir 791cdf0e10cSrcweir while ( nWhich ) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir switch ( nWhich ) 794cdf0e10cSrcweir { 795*69a74367SOliver-Rainer Wittmann case SID_INSERT_AVMEDIA: 796cdf0e10cSrcweir case SID_INSERT_SOUND: 797cdf0e10cSrcweir case SID_INSERT_VIDEO: 798*69a74367SOliver-Rainer Wittmann if ( GetShell().IsSelFrmMode() 799*69a74367SOliver-Rainer Wittmann || GetShell().CrsrInsideInputFld() 800*69a74367SOliver-Rainer Wittmann || SFX_CREATE_MODE_EMBEDDED == eCreateMode 801*69a74367SOliver-Rainer Wittmann || bCrsrInHidden ) 802cdf0e10cSrcweir { 803cdf0e10cSrcweir rSet.DisableItem( nWhich ); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir break; 806cdf0e10cSrcweir 807cdf0e10cSrcweir case SID_INSERT_DIAGRAM: 808*69a74367SOliver-Rainer Wittmann if( !aMOpt.IsChart() 809*69a74367SOliver-Rainer Wittmann || GetShell().CrsrInsideInputFld() 810*69a74367SOliver-Rainer Wittmann || eCreateMode == SFX_CREATE_MODE_EMBEDDED 811*69a74367SOliver-Rainer Wittmann || bCrsrInHidden ) 812cdf0e10cSrcweir { 813cdf0e10cSrcweir rSet.DisableItem( nWhich ); 814cdf0e10cSrcweir } 815cdf0e10cSrcweir break; 816cdf0e10cSrcweir 817cdf0e10cSrcweir case FN_INSERT_SMA: 818*69a74367SOliver-Rainer Wittmann if( !aMOpt.IsMath() 819*69a74367SOliver-Rainer Wittmann || eCreateMode == SFX_CREATE_MODE_EMBEDDED 820*69a74367SOliver-Rainer Wittmann || bCrsrInHidden 821*69a74367SOliver-Rainer Wittmann || rSh.CrsrInsideInputFld() ) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir rSet.DisableItem( nWhich ); 824cdf0e10cSrcweir } 825cdf0e10cSrcweir break; 826cdf0e10cSrcweir 827cdf0e10cSrcweir case SID_INSERT_FLOATINGFRAME: 828cdf0e10cSrcweir case SID_INSERT_OBJECT: 829cdf0e10cSrcweir case SID_INSERT_PLUGIN: 830cdf0e10cSrcweir { 831cdf0e10cSrcweir if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden ) 832cdf0e10cSrcweir { 833cdf0e10cSrcweir rSet.DisableItem( nWhich ); 834cdf0e10cSrcweir } 835*69a74367SOliver-Rainer Wittmann else if( GetShell().IsSelFrmMode() 836*69a74367SOliver-Rainer Wittmann || GetShell().CrsrInsideInputFld() ) 837*69a74367SOliver-Rainer Wittmann { 838cdf0e10cSrcweir rSet.DisableItem( nWhich ); 839*69a74367SOliver-Rainer Wittmann } 840cdf0e10cSrcweir else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 843cdf0e10cSrcweir sal_uInt16 nExport = pHtmlOpt->GetExportMode(); 844cdf0e10cSrcweir if(HTML_CFG_MSIE_40 != nExport && HTML_CFG_WRITER != nExport ) 845cdf0e10cSrcweir rSet.DisableItem(nWhich); 846cdf0e10cSrcweir } 847cdf0e10cSrcweir } 848cdf0e10cSrcweir break; 849*69a74367SOliver-Rainer Wittmann 850cdf0e10cSrcweir case FN_INSERT_FRAME_INTERACT_NOCOL : 851cdf0e10cSrcweir case FN_INSERT_FRAME_INTERACT: 852cdf0e10cSrcweir { 853*69a74367SOliver-Rainer Wittmann if( GetShell().IsSelFrmMode() 854*69a74367SOliver-Rainer Wittmann || GetShell().CrsrInsideInputFld() 855*69a74367SOliver-Rainer Wittmann || ( 0 != (nHtmlMode & HTMLMODE_ON) 856*69a74367SOliver-Rainer Wittmann && 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS) ) 857*69a74367SOliver-Rainer Wittmann || bCrsrInHidden ) 858cdf0e10cSrcweir rSet.DisableItem(nWhich); 859cdf0e10cSrcweir } 860cdf0e10cSrcweir break; 861*69a74367SOliver-Rainer Wittmann 862cdf0e10cSrcweir case SID_HYPERLINK_GETLINK: 863cdf0e10cSrcweir { 864cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT); 865cdf0e10cSrcweir rSh.GetCurAttr( aSet ); 866cdf0e10cSrcweir 867cdf0e10cSrcweir SvxHyperlinkItem aHLinkItem; 868cdf0e10cSrcweir const SfxPoolItem* pItem; 869cdf0e10cSrcweir if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem)) 870cdf0e10cSrcweir { 871cdf0e10cSrcweir const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem; 872cdf0e10cSrcweir aHLinkItem.SetURL(pINetFmt->GetValue()); 873cdf0e10cSrcweir aHLinkItem.SetTargetFrame(pINetFmt->GetTargetFrame()); 874cdf0e10cSrcweir aHLinkItem.SetIntName(pINetFmt->GetName()); 875cdf0e10cSrcweir const SvxMacro *pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOVER_OBJECT ); 876cdf0e10cSrcweir if( pMacro ) 877cdf0e10cSrcweir aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOVER_OBJECT, *pMacro); 878cdf0e10cSrcweir 879cdf0e10cSrcweir pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSECLICK_OBJECT ); 880cdf0e10cSrcweir if( pMacro ) 881cdf0e10cSrcweir aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSECLICK_OBJECT, *pMacro); 882cdf0e10cSrcweir 883cdf0e10cSrcweir pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOUT_OBJECT ); 884cdf0e10cSrcweir if( pMacro ) 885cdf0e10cSrcweir aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOUT_OBJECT, *pMacro); 886cdf0e10cSrcweir 887cdf0e10cSrcweir // Text des Links besorgen 888cdf0e10cSrcweir rSh.StartAction(); 889cdf0e10cSrcweir rSh.CreateCrsr(); 890cdf0e10cSrcweir rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT,sal_True); 891cdf0e10cSrcweir String sLinkName = rSh.GetSelTxt(); 892cdf0e10cSrcweir aHLinkItem.SetName(sLinkName); 893cdf0e10cSrcweir aHLinkItem.SetInsertMode(HLINK_FIELD); 894cdf0e10cSrcweir rSh.DestroyCrsr(); 895cdf0e10cSrcweir rSh.EndAction(); 896cdf0e10cSrcweir } 897cdf0e10cSrcweir else 898cdf0e10cSrcweir { 899cdf0e10cSrcweir String sReturn = rSh.GetSelTxt(); 900cdf0e10cSrcweir sReturn.Erase(255); 901cdf0e10cSrcweir sReturn.EraseTrailingChars(); 902cdf0e10cSrcweir aHLinkItem.SetName(sReturn); 903cdf0e10cSrcweir } 904cdf0e10cSrcweir 905cdf0e10cSrcweir aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | 906cdf0e10cSrcweir ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0))); 907cdf0e10cSrcweir aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT| 908cdf0e10cSrcweir HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT ); 909cdf0e10cSrcweir 910cdf0e10cSrcweir rSet.Put(aHLinkItem); 911cdf0e10cSrcweir } 912cdf0e10cSrcweir break; 913cdf0e10cSrcweir 914cdf0e10cSrcweir case FN_INSERT_FRAME: 915cdf0e10cSrcweir if (rSh.IsSelFrmMode() ) 916cdf0e10cSrcweir { 917cdf0e10cSrcweir const int nSel = rSh.GetSelectionType(); 918cdf0e10cSrcweir if( ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE ) & nSel ) || bCrsrInHidden ) 919cdf0e10cSrcweir rSet.DisableItem(nWhich); 920cdf0e10cSrcweir } 921*69a74367SOliver-Rainer Wittmann else if ( rSh.CrsrInsideInputFld() ) 922*69a74367SOliver-Rainer Wittmann { 923cdf0e10cSrcweir rSet.DisableItem(nWhich); 924*69a74367SOliver-Rainer Wittmann } 925cdf0e10cSrcweir break; 926*69a74367SOliver-Rainer Wittmann 927*69a74367SOliver-Rainer Wittmann case FN_INSERT_HRULER : 928*69a74367SOliver-Rainer Wittmann if( (rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel()) 929*69a74367SOliver-Rainer Wittmann || bCrsrInHidden 930*69a74367SOliver-Rainer Wittmann || rSh.CrsrInsideInputFld() ) 931*69a74367SOliver-Rainer Wittmann { 932*69a74367SOliver-Rainer Wittmann rSet.DisableItem(nWhich); 933*69a74367SOliver-Rainer Wittmann } 934*69a74367SOliver-Rainer Wittmann break; 935*69a74367SOliver-Rainer Wittmann 936cdf0e10cSrcweir case FN_FORMAT_COLUMN : 937cdf0e10cSrcweir { 938cdf0e10cSrcweir //#i80458# column dialog cannot work if the selection contains different page styles and different sections 939cdf0e10cSrcweir bool bDisable = true; 940cdf0e10cSrcweir if( rSh.GetFlyFrmFmt() || rSh.GetSelectedPageDescs() ) 941cdf0e10cSrcweir bDisable = false; 942cdf0e10cSrcweir if( bDisable ) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir const SwSection* pCurrSection = rSh.GetCurrSection(); 945cdf0e10cSrcweir sal_uInt16 nFullSectCnt = rSh.GetFullSelectedSectionCount(); 946cdf0e10cSrcweir if( pCurrSection && ( !rSh.HasSelection() || 0 != nFullSectCnt )) 947cdf0e10cSrcweir bDisable = false; 948cdf0e10cSrcweir else if( 949cdf0e10cSrcweir rSh.HasSelection() && rSh.IsInsRegionAvailable() && 950cdf0e10cSrcweir ( !pCurrSection || ( 1 != nFullSectCnt && 951cdf0e10cSrcweir lcl_IsMarkInSameSection( rSh, pCurrSection ) ))) 952cdf0e10cSrcweir bDisable = false; 953cdf0e10cSrcweir } 954cdf0e10cSrcweir if(bDisable) 955cdf0e10cSrcweir rSet.DisableItem(nWhich); 956cdf0e10cSrcweir } 957cdf0e10cSrcweir break; 958cdf0e10cSrcweir } 959cdf0e10cSrcweir nWhich = aIter.NextWhich(); 960cdf0e10cSrcweir } 961cdf0e10cSrcweir } 962cdf0e10cSrcweir 963cdf0e10cSrcweir /*-------------------------------------------------------------------- 964cdf0e10cSrcweir Beschreibung: 965cdf0e10cSrcweir --------------------------------------------------------------------*/ 966cdf0e10cSrcweir 967cdf0e10cSrcweir void SwTextShell::ExecDelete(SfxRequest &rReq) 968cdf0e10cSrcweir { 969cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 970cdf0e10cSrcweir switch( rReq.GetSlot() ) 971cdf0e10cSrcweir { 972cdf0e10cSrcweir case FN_DELETE_SENT: 973cdf0e10cSrcweir if( rSh.IsTableMode() ) 974cdf0e10cSrcweir { 975cdf0e10cSrcweir rSh.DeleteRow(); 976cdf0e10cSrcweir rSh.EnterStdMode(); 977cdf0e10cSrcweir } 978cdf0e10cSrcweir else 979cdf0e10cSrcweir rSh.DelToEndOfSentence(); 980cdf0e10cSrcweir break; 981cdf0e10cSrcweir case FN_DELETE_BACK_SENT: 982cdf0e10cSrcweir rSh.DelToStartOfSentence(); 983cdf0e10cSrcweir break; 984cdf0e10cSrcweir case FN_DELETE_WORD: 985cdf0e10cSrcweir rSh.DelNxtWord(); 986cdf0e10cSrcweir break; 987cdf0e10cSrcweir case FN_DELETE_BACK_WORD: 988cdf0e10cSrcweir rSh.DelPrvWord(); 989cdf0e10cSrcweir break; 990cdf0e10cSrcweir case FN_DELETE_LINE: 991cdf0e10cSrcweir rSh.DelToEndOfLine(); 992cdf0e10cSrcweir break; 993cdf0e10cSrcweir case FN_DELETE_BACK_LINE: 994cdf0e10cSrcweir rSh.DelToStartOfLine(); 995cdf0e10cSrcweir break; 996cdf0e10cSrcweir case FN_DELETE_PARA: 997cdf0e10cSrcweir rSh.DelToEndOfPara(); 998cdf0e10cSrcweir break; 999cdf0e10cSrcweir case FN_DELETE_BACK_PARA: 1000cdf0e10cSrcweir rSh.DelToStartOfPara(); 1001cdf0e10cSrcweir break; 1002cdf0e10cSrcweir case FN_DELETE_WHOLE_LINE: 1003cdf0e10cSrcweir rSh.DelLine(); 1004cdf0e10cSrcweir break; 1005cdf0e10cSrcweir default: 1006cdf0e10cSrcweir ASSERT(!this, "falscher Dispatcher"); 1007cdf0e10cSrcweir return; 1008cdf0e10cSrcweir } 1009cdf0e10cSrcweir rReq.Done(); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir void SwTextShell::ExecTransliteration( SfxRequest & rReq ) 1013cdf0e10cSrcweir { 1014cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir sal_uInt32 nMode = 0; 1017cdf0e10cSrcweir 1018cdf0e10cSrcweir switch( rReq.GetSlot() ) 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir case SID_TRANSLITERATE_SENTENCE_CASE: 1021cdf0e10cSrcweir nMode = TransliterationModulesExtra::SENTENCE_CASE; 1022cdf0e10cSrcweir break; 1023cdf0e10cSrcweir case SID_TRANSLITERATE_TITLE_CASE: 1024cdf0e10cSrcweir nMode = TransliterationModulesExtra::TITLE_CASE; 1025cdf0e10cSrcweir break; 1026cdf0e10cSrcweir case SID_TRANSLITERATE_TOGGLE_CASE: 1027cdf0e10cSrcweir nMode = TransliterationModulesExtra::TOGGLE_CASE; 1028cdf0e10cSrcweir break; 1029cdf0e10cSrcweir case SID_TRANSLITERATE_UPPER: 1030cdf0e10cSrcweir nMode = TransliterationModules_LOWERCASE_UPPERCASE; 1031cdf0e10cSrcweir break; 1032cdf0e10cSrcweir case SID_TRANSLITERATE_LOWER: 1033cdf0e10cSrcweir nMode = TransliterationModules_UPPERCASE_LOWERCASE; 1034cdf0e10cSrcweir break; 1035cdf0e10cSrcweir 1036cdf0e10cSrcweir case SID_TRANSLITERATE_HALFWIDTH: 1037cdf0e10cSrcweir nMode = TransliterationModules_FULLWIDTH_HALFWIDTH; 1038cdf0e10cSrcweir break; 1039cdf0e10cSrcweir case SID_TRANSLITERATE_FULLWIDTH: 1040cdf0e10cSrcweir nMode = TransliterationModules_HALFWIDTH_FULLWIDTH; 1041cdf0e10cSrcweir break; 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir case SID_TRANSLITERATE_HIRAGANA: 1044cdf0e10cSrcweir nMode = TransliterationModules_KATAKANA_HIRAGANA; 1045cdf0e10cSrcweir break; 1046cdf0e10cSrcweir case SID_TRANSLITERATE_KATAGANA: 1047cdf0e10cSrcweir nMode = TransliterationModules_HIRAGANA_KATAKANA; 1048cdf0e10cSrcweir break; 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir default: 1051cdf0e10cSrcweir ASSERT(!this, "falscher Dispatcher"); 1052cdf0e10cSrcweir } 1053cdf0e10cSrcweir 1054cdf0e10cSrcweir if( nMode ) 1055cdf0e10cSrcweir GetShell().TransliterateText( nMode ); 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir /*-------------------------------------------------------------------- 1061cdf0e10cSrcweir Beschreibung: 1062cdf0e10cSrcweir --------------------------------------------------------------------*/ 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir 1066cdf0e10cSrcweir SwTextShell::SwTextShell(SwView &_rView) : 1067cdf0e10cSrcweir SwBaseShell(_rView), pPostItFldMgr( 0 ) 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir SetName(String::CreateFromAscii("Text")); 1070cdf0e10cSrcweir SetHelpId(SW_TEXTSHELL); 1071f120fe41SAndre Fischer SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Text)); 1072cdf0e10cSrcweir } 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir /*-------------------------------------------------------------------- 1075cdf0e10cSrcweir Beschreibung: 1076cdf0e10cSrcweir --------------------------------------------------------------------*/ 1077cdf0e10cSrcweir 1078cdf0e10cSrcweir SwTextShell::~SwTextShell() 1079cdf0e10cSrcweir { 1080cdf0e10cSrcweir } 1081cdf0e10cSrcweir 1082cdf0e10cSrcweir /*-------------------------------------------------------------------- 1083cdf0e10cSrcweir Beschreibung: 1084cdf0e10cSrcweir --------------------------------------------------------------------*/ 1085cdf0e10cSrcweir 1086cdf0e10cSrcweir void SwTextShell::InsertSymbol( SfxRequest& rReq ) 1087cdf0e10cSrcweir { 1088cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 1089cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 1090cdf0e10cSrcweir if( pArgs ) 1091cdf0e10cSrcweir pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); 1092cdf0e10cSrcweir 1093cdf0e10cSrcweir String aChars, aFontName; 1094cdf0e10cSrcweir if ( pItem ) 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir aChars = ((const SfxStringItem*)pItem)->GetValue(); 1097cdf0e10cSrcweir const SfxPoolItem* pFtItem = NULL; 1098cdf0e10cSrcweir pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem); 1099cdf0e10cSrcweir const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); 1100cdf0e10cSrcweir if ( pFontItem ) 1101cdf0e10cSrcweir aFontName = pFontItem->GetValue(); 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 1105cdf0e10cSrcweir SfxItemSet aSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT, 1106cdf0e10cSrcweir RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT, 1107cdf0e10cSrcweir RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 1108cdf0e10cSrcweir 0 ); 1109cdf0e10cSrcweir rSh.GetCurAttr( aSet ); 1110cdf0e10cSrcweir sal_uInt16 nScript = rSh.GetScriptType(); 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir SvxFontItem aFont( RES_CHRATR_FONT ); 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); 1115cdf0e10cSrcweir aSetItem.GetItemSet().Put( aSet, sal_False ); 1116cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); 1117cdf0e10cSrcweir if( pI ) 1118cdf0e10cSrcweir aFont = *(SvxFontItem*)pI; 1119cdf0e10cSrcweir else 1120cdf0e10cSrcweir aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( 1121cdf0e10cSrcweir RES_CHRATR_FONT, 1122cdf0e10cSrcweir GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); 1123cdf0e10cSrcweir if (!aFontName.Len()) 1124cdf0e10cSrcweir aFontName = aFont.GetFamilyName(); 1125cdf0e10cSrcweir } 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir Font aNewFont(aFontName, Size(1,1)); // Size nur wg. CTOR 1128cdf0e10cSrcweir if( !aChars.Len() ) 1129cdf0e10cSrcweir { 1130cdf0e10cSrcweir // Eingestellten Font als Default 1131cdf0e10cSrcweir SfxAllItemSet aAllSet( rSh.GetAttrPool() ); 1132cdf0e10cSrcweir aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); 1133cdf0e10cSrcweir 1134cdf0e10cSrcweir SwViewOption aOpt(*GetShell().GetViewOptions()); 1135cdf0e10cSrcweir String sSymbolFont = aOpt.GetSymbolFont(); 1136cdf0e10cSrcweir if( !aFontName.Len() && sSymbolFont.Len() ) 1137cdf0e10cSrcweir aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); 1138cdf0e10cSrcweir else 1139cdf0e10cSrcweir aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) ); 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1142cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet, 1143cdf0e10cSrcweir GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); 1144cdf0e10cSrcweir if( RET_OK == pDlg->Execute() ) 1145cdf0e10cSrcweir { 1146cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False ); 1147cdf0e10cSrcweir SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); 1148cdf0e10cSrcweir if ( pFontItem ) 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir aNewFont.SetName( pFontItem->GetFamilyName() ); 1151cdf0e10cSrcweir aNewFont.SetStyleName( pFontItem->GetStyleName() ); 1152cdf0e10cSrcweir aNewFont.SetCharSet( pFontItem->GetCharSet() ); 1153cdf0e10cSrcweir aNewFont.SetPitch( pFontItem->GetPitch() ); 1154cdf0e10cSrcweir } 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir if ( pCItem ) 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir aChars = pCItem->GetValue(); 1159cdf0e10cSrcweir aOpt.SetSymbolFont(aNewFont.GetName()); 1160cdf0e10cSrcweir SW_MOD()->ApplyUsrPref(aOpt, &GetView()); 1161cdf0e10cSrcweir } 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir 1164cdf0e10cSrcweir delete pDlg; 1165cdf0e10cSrcweir } 1166cdf0e10cSrcweir 1167cdf0e10cSrcweir sal_Bool bFontChanged = sal_False; 1168cdf0e10cSrcweir if( aChars.Len() ) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir rSh.StartAllAction(); 1171cdf0e10cSrcweir 1172cdf0e10cSrcweir // Selektierten Inhalt loeschen 1173cdf0e10cSrcweir SwRewriter aRewriter; 1174cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_SPECIALCHAR)); 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir rSh.StartUndo( UNDO_INSERT, &aRewriter ); 1177cdf0e10cSrcweir if ( rSh.HasSelection() ) 1178cdf0e10cSrcweir { 1179cdf0e10cSrcweir rSh.DelRight(); 1180cdf0e10cSrcweir aSet.ClearItem(); 1181cdf0e10cSrcweir rSh.GetCurAttr( aSet ); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); 1184cdf0e10cSrcweir aSetItem.GetItemSet().Put( aSet, sal_False ); 1185cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); 1186cdf0e10cSrcweir if( pI ) 1187cdf0e10cSrcweir aFont = *(SvxFontItem*)pI; 1188cdf0e10cSrcweir else 1189cdf0e10cSrcweir aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( 1190cdf0e10cSrcweir RES_CHRATR_FONT, 1191cdf0e10cSrcweir GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); 1192cdf0e10cSrcweir } 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir // Zeichen einfuegen 1195cdf0e10cSrcweir rSh.Insert( aChars ); 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir // #108876# a font attribute has to be set always due to a guessed script type 1198cdf0e10cSrcweir if( aNewFont.GetName().Len() ) 1199cdf0e10cSrcweir { 1200cdf0e10cSrcweir bFontChanged = sal_True; 1201cdf0e10cSrcweir SvxFontItem aNewFontItem( aFont ); 1202cdf0e10cSrcweir aNewFontItem.SetFamilyName( aNewFont.GetName()); 1203cdf0e10cSrcweir aNewFontItem.SetFamily( aNewFont.GetFamily()); 1204cdf0e10cSrcweir aNewFontItem.SetPitch( aNewFont.GetPitch()); 1205cdf0e10cSrcweir aNewFontItem.SetCharSet( aNewFont.GetCharSet() ); 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir SfxItemSet aRestoreSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT, 1208cdf0e10cSrcweir RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT, 1209cdf0e10cSrcweir RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 0 ); 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir nScript = pBreakIt->GetAllScriptsOfText( aChars ); 1212cdf0e10cSrcweir if( SCRIPTTYPE_LATIN & nScript ) 1213cdf0e10cSrcweir { 1214cdf0e10cSrcweir aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT, sal_True ) ); 1215cdf0e10cSrcweir aSet.Put( aNewFontItem, RES_CHRATR_FONT); 1216cdf0e10cSrcweir } 1217cdf0e10cSrcweir if( SCRIPTTYPE_ASIAN & nScript ) 1218cdf0e10cSrcweir { 1219cdf0e10cSrcweir aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT, sal_True ) ); 1220cdf0e10cSrcweir aSet.Put( aNewFontItem, RES_CHRATR_CJK_FONT ); 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir if( SCRIPTTYPE_COMPLEX & nScript ) 1223cdf0e10cSrcweir { 1224cdf0e10cSrcweir aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT, sal_True ) ); 1225cdf0e10cSrcweir aSet.Put( aNewFontItem, RES_CHRATR_CTL_FONT ); 1226cdf0e10cSrcweir } 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir rSh.SetMark(); 1229cdf0e10cSrcweir rSh.ExtendSelection( sal_False, aChars.Len() ); 1230*69a74367SOliver-Rainer Wittmann rSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR ); 1231cdf0e10cSrcweir if( !rSh.IsCrsrPtAtEnd() ) 1232cdf0e10cSrcweir rSh.SwapPam(); 1233cdf0e10cSrcweir 1234cdf0e10cSrcweir rSh.ClearMark(); 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir // --> FME 2007-07-09 #i75891# 1237cdf0e10cSrcweir // SETATTR_DONTEXPAND does not work if there are already hard attributes. 1238cdf0e10cSrcweir // Therefore we have to restore the font attributes. 1239cdf0e10cSrcweir rSh.SetMark(); 1240*69a74367SOliver-Rainer Wittmann rSh.SetAttrSet( aRestoreSet ); 1241cdf0e10cSrcweir rSh.ClearMark(); 1242cdf0e10cSrcweir // <-- 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir rSh.UpdateAttr(); 1245cdf0e10cSrcweir aFont = aNewFontItem; 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir rSh.EndAllAction(); 1249cdf0e10cSrcweir rSh.EndUndo(); 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir if ( aChars.Len() ) 1252cdf0e10cSrcweir { 1253cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) ); 1254cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) ); 1255cdf0e10cSrcweir rReq.Done(); 1256cdf0e10cSrcweir } 1257cdf0e10cSrcweir } 1258cdf0e10cSrcweir } 1259