1efeef26fSAndrew Rist /************************************************************** 2efeef26fSAndrew Rist * 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 <com/sun/star/util/SearchOptions.hpp> 28cdf0e10cSrcweir #include <com/sun/star/util/SearchFlags.hpp> 29cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp> 30cdf0e10cSrcweir #include <svtools/filter.hxx> 31cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> 32cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> 33cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORTDTOR 36cdf0e10cSrcweir #include <svl/svstdarr.hxx> 37cdf0e10cSrcweir #include <svl/aeitem.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 40cdf0e10cSrcweir #include <docary.hxx> 41cdf0e10cSrcweir #include <hintids.hxx> 42cdf0e10cSrcweir #include <SwRewriter.hxx> 43cdf0e10cSrcweir #include <numrule.hxx> 44cdf0e10cSrcweir #include <swundo.hxx> 45cdf0e10cSrcweir #include <caption.hxx> 46cdf0e10cSrcweir #include <svl/PasswordHelper.hxx> 47cdf0e10cSrcweir #include <svl/urihelper.hxx> 48cdf0e10cSrcweir #include <sfx2/passwd.hxx> 49cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx> 50cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 51cdf0e10cSrcweir #include <sfx2/sfxhelp.hxx> 52cdf0e10cSrcweir #include <editeng/langitem.hxx> 53cdf0e10cSrcweir #include <svx/viewlayoutitem.hxx> 54cdf0e10cSrcweir #include <svx/zoomslideritem.hxx> 55cdf0e10cSrcweir #include <svtools/xwindowitem.hxx> 56cdf0e10cSrcweir #include <svx/htmlmode.hxx> 57cdf0e10cSrcweir #include <vcl/svapp.hxx> 58cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 59cdf0e10cSrcweir #include <sfx2/app.hxx> 60cdf0e10cSrcweir #include <sfx2/request.hxx> 61cdf0e10cSrcweir #include <sfx2/bindings.hxx> 62cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 63cdf0e10cSrcweir #include <svtools/txtcmp.hxx> 64cdf0e10cSrcweir #include "editeng/unolingu.hxx" 65cdf0e10cSrcweir #include <vcl/msgbox.hxx> 66cdf0e10cSrcweir #include <editeng/tstpitem.hxx> 67cdf0e10cSrcweir #include <sfx2/event.hxx> 68cdf0e10cSrcweir #include <sfx2/docfile.hxx> 69cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 70cdf0e10cSrcweir #include <sfx2/fcontnr.hxx> 71cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 72cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 73cdf0e10cSrcweir #include <svl/whiter.hxx> 74cdf0e10cSrcweir #include <svl/ptitem.hxx> 75cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 76cdf0e10cSrcweir #include <tools/errinf.hxx> 77cdf0e10cSrcweir #include <tools/urlobj.hxx> 78cdf0e10cSrcweir #include <svx/svdview.hxx> 79cdf0e10cSrcweir #include <swtypes.hxx> 80cdf0e10cSrcweir #include <swwait.hxx> 81cdf0e10cSrcweir #include <redlndlg.hxx> 82cdf0e10cSrcweir #include <view.hxx> 83cdf0e10cSrcweir #include <uivwimp.hxx> 84cdf0e10cSrcweir #include <docsh.hxx> 85cdf0e10cSrcweir #include <doc.hxx> 86cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx> 87cdf0e10cSrcweir #include <wrtsh.hxx> 88cdf0e10cSrcweir #include <viewopt.hxx> 89cdf0e10cSrcweir #include <basesh.hxx> 90cdf0e10cSrcweir #include <swmodule.hxx> 91cdf0e10cSrcweir #include <uitool.hxx> 92cdf0e10cSrcweir #include <shellio.hxx> 93cdf0e10cSrcweir #include <fmtinfmt.hxx> 94cdf0e10cSrcweir #include <mdiexp.hxx> 95cdf0e10cSrcweir #include <drawbase.hxx> 96cdf0e10cSrcweir #include <frmmgr.hxx> 97cdf0e10cSrcweir #include <pagedesc.hxx> 98cdf0e10cSrcweir #include <section.hxx> 99cdf0e10cSrcweir #include <usrpref.hxx> 100cdf0e10cSrcweir #include <IMark.hxx> 101cdf0e10cSrcweir #include <navipi.hxx> 102cdf0e10cSrcweir #include <tox.hxx> 103cdf0e10cSrcweir #include <workctrl.hxx> 104cdf0e10cSrcweir #include <scroll.hxx> 105cdf0e10cSrcweir #include <edtwin.hxx> 106cdf0e10cSrcweir #include <wview.hxx> 107cdf0e10cSrcweir #include <textsh.hxx> 108cdf0e10cSrcweir #include <tabsh.hxx> 109cdf0e10cSrcweir #include <listsh.hxx> 110cdf0e10cSrcweir #include <cmdid.h> 111cdf0e10cSrcweir #include <comcore.hrc> 112cdf0e10cSrcweir #include <poolfmt.hrc> 113cdf0e10cSrcweir #include <statstr.hrc> 114cdf0e10cSrcweir #include <swerror.h> 115cdf0e10cSrcweir #include <globals.hrc> 116cdf0e10cSrcweir #include <shells.hrc> 117cdf0e10cSrcweir #include <web.hrc> 118cdf0e10cSrcweir #include <view.hrc> 119cdf0e10cSrcweir #include <app.hrc> 120cdf0e10cSrcweir #include <fmtclds.hxx> 121cdf0e10cSrcweir #include <helpid.h> 122cdf0e10cSrcweir #include <svtools/templdlg.hxx> 123cdf0e10cSrcweir #include <dbconfig.hxx> 124cdf0e10cSrcweir #include <dbmgr.hxx> 125cdf0e10cSrcweir 126cdf0e10cSrcweir #include <PostItMgr.hxx> 127cdf0e10cSrcweir 128cdf0e10cSrcweir #include <ndtxt.hxx> //#outline level,added by zhaojianwei 129cdf0e10cSrcweir 130cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 131cdf0e10cSrcweir 132cdf0e10cSrcweir #include <svx/svxdlg.hxx> 133cdf0e10cSrcweir #include <svx/dialogs.hrc> 134cdf0e10cSrcweir #include "swabstdlg.hxx" 135cdf0e10cSrcweir #include "globals.hrc" 136cdf0e10cSrcweir #include <envelp.hrc> 137cdf0e10cSrcweir #include <fmthdft.hxx> 138cdf0e10cSrcweir #include <svx/ofaitem.hxx> 139cdf0e10cSrcweir #include <unomid.h> 140cdf0e10cSrcweir 141cdf0e10cSrcweir const char __FAR_DATA sStatusDelim[] = " : "; 142cdf0e10cSrcweir const char __FAR_DATA sStatusComma[] = " , ";//#outlinelevel, define a Variable for "," add by zhaojianwei 143cdf0e10cSrcweir 144cdf0e10cSrcweir using ::rtl::OUString; 145cdf0e10cSrcweir using namespace sfx2; 146cdf0e10cSrcweir using namespace ::com::sun::star; 147cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 148cdf0e10cSrcweir using namespace ::com::sun::star::util; 149cdf0e10cSrcweir using namespace ::com::sun::star::uno; 150cdf0e10cSrcweir using namespace ::com::sun::star::lang; 151cdf0e10cSrcweir using namespace ::com::sun::star::scanner; 152cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 153cdf0e10cSrcweir using namespace ::com::sun::star::beans; 154cdf0e10cSrcweir using namespace ::com::sun::star::container; 155cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs; 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158cdf0e10cSrcweir static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId ) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir if (nWhichId == RES_CHRATR_LANGUAGE || 161cdf0e10cSrcweir nWhichId == RES_CHRATR_CJK_LANGUAGE || 162cdf0e10cSrcweir nWhichId == RES_CHRATR_CTL_LANGUAGE) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir rWrtSh.StartAction(); 165cdf0e10cSrcweir rWrtSh.LockView( sal_True ); 166cdf0e10cSrcweir rWrtSh.Push(); 167cdf0e10cSrcweir 168cdf0e10cSrcweir // prepare to apply new language to all text in document 169cdf0e10cSrcweir rWrtSh.SelAll(); 170cdf0e10cSrcweir rWrtSh.ExtendedSelectAll(); 171cdf0e10cSrcweir 172cdf0e10cSrcweir // set language attribute to default for all text 173cdf0e10cSrcweir SvUShortsSort aAttribs; 174cdf0e10cSrcweir aAttribs.Insert( nWhichId ); 175cdf0e10cSrcweir rWrtSh.ResetAttr( &aAttribs ); 176cdf0e10cSrcweir 177cdf0e10cSrcweir rWrtSh.Pop( sal_False ); 178cdf0e10cSrcweir rWrtSh.LockView( sal_False ); 179cdf0e10cSrcweir rWrtSh.EndAction(); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir } 182cdf0e10cSrcweir 183cdf0e10cSrcweir /*--------------------------------------------------------------------------- 184cdf0e10cSrcweir Beschreibung: String fuer die Seitenanzeige in der Statusbar basteln. 185cdf0e10cSrcweir ----------------------------------------------------------------------------*/ 186cdf0e10cSrcweir 187cdf0e10cSrcweir String SwView::GetPageStr( sal_uInt16 nPg, sal_uInt16 nLogPg, 188cdf0e10cSrcweir const String& rDisplay ) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir String aStr( aPageStr ); 191cdf0e10cSrcweir if( rDisplay.Len() ) 192cdf0e10cSrcweir aStr += rDisplay; 193cdf0e10cSrcweir else 194cdf0e10cSrcweir aStr += String::CreateFromInt32(nLogPg); 195cdf0e10cSrcweir 196cdf0e10cSrcweir if( nLogPg && nLogPg != nPg ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" ")); 199cdf0e10cSrcweir aStr += String::CreateFromInt32(nPg); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" / ")); 202cdf0e10cSrcweir aStr += String::CreateFromInt32( GetWrtShell().GetPageCnt() ); 203cdf0e10cSrcweir 204cdf0e10cSrcweir return aStr; 205cdf0e10cSrcweir } 206cdf0e10cSrcweir 207cdf0e10cSrcweir 208cdf0e10cSrcweir int SwView::InsertGraphic( const String &rPath, const String &rFilter, 209cdf0e10cSrcweir sal_Bool bLink, GraphicFilter *pFlt, 210cdf0e10cSrcweir Graphic* pPreviewGrf, sal_Bool bRule ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir SwWait aWait( *GetDocShell(), sal_True ); 213cdf0e10cSrcweir 214cdf0e10cSrcweir Graphic aGrf; 215cdf0e10cSrcweir int nRes = GRFILTER_OK; 216cdf0e10cSrcweir if ( pPreviewGrf ) 217cdf0e10cSrcweir aGrf = *pPreviewGrf; 218cdf0e10cSrcweir else 219cdf0e10cSrcweir { 220cdf0e10cSrcweir if( !pFlt ) 221cdf0e10cSrcweir pFlt = GraphicFilter::GetGraphicFilter(); 222cdf0e10cSrcweir nRes = GraphicFilter::LoadGraphic( rPath, rFilter, aGrf, pFlt /*, nFilter*/ ); 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir if( GRFILTER_OK == nRes ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir SwFlyFrmAttrMgr aFrmMgr( sal_True, GetWrtShellPtr(), FRMMGR_TYPE_GRF ); 228cdf0e10cSrcweir 229cdf0e10cSrcweir SwWrtShell &rSh = GetWrtShell(); 230cdf0e10cSrcweir rSh.StartAction(); 231cdf0e10cSrcweir if( bLink ) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir SwDocShell* pDocSh = GetDocShell(); 234cdf0e10cSrcweir INetURLObject aTemp( 235cdf0e10cSrcweir pDocSh->HasName() ? 236cdf0e10cSrcweir pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) : 237cdf0e10cSrcweir rtl::OUString()); 238cdf0e10cSrcweir 239cdf0e10cSrcweir String sURL = URIHelper::SmartRel2Abs( 240cdf0e10cSrcweir aTemp, rPath, URIHelper::GetMaybeFileHdl() ); 241cdf0e10cSrcweir 242cdf0e10cSrcweir rSh.Insert( sURL, 243cdf0e10cSrcweir rFilter, aGrf, &aFrmMgr, bRule ); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir else 246cdf0e10cSrcweir rSh.Insert( aEmptyStr, aEmptyStr, aGrf, &aFrmMgr ); 247cdf0e10cSrcweir // nach dem EndAction ist es zu spaet, weil die Shell dann schon zerstoert sein kann 248cdf0e10cSrcweir rSh.EndAction(); 249cdf0e10cSrcweir } 250cdf0e10cSrcweir return nRes; 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir 254cdf0e10cSrcweir sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq ) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir #ifndef ENABLE_PROP_WITHOUTLINK 257cdf0e10cSrcweir #define ENABLE_PROP_WITHOUTLINK 0x08 258cdf0e10cSrcweir #endif 259cdf0e10cSrcweir 260cdf0e10cSrcweir sal_Bool bReturn = sal_False; 261cdf0e10cSrcweir SwDocShell* pDocShell = GetDocShell(); 262cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(pDocShell); 263cdf0e10cSrcweir // im HTML-Mode nur verknuepft einfuegen 264cdf0e10cSrcweir FileDialogHelper* pFileDlg = new FileDialogHelper( SFXWB_GRAPHIC | SFXWB_SHOWSTYLES ); 265cdf0e10cSrcweir pFileDlg->SetTitle(SW_RESSTR(STR_INSERT_GRAPHIC )); 266cdf0e10cSrcweir pFileDlg->SetContext( FileDialogHelper::SW_INSERT_GRAPHIC ); 267cdf0e10cSrcweir uno::Reference < XFilePicker > xFP = pFileDlg->GetFilePicker(); 268cdf0e10cSrcweir uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY); 269cdf0e10cSrcweir if(nHtmlMode & HTMLMODE_ON) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir sal_Bool bTrue = sal_True; 272cdf0e10cSrcweir Any aVal(&bTrue, ::getBooleanCppuType()); 273cdf0e10cSrcweir xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal); 274cdf0e10cSrcweir xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False); 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir SvStringsSortDtor aFormats; 278cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 279cdf0e10cSrcweir const sal_uInt16 nArrLen = pDoc->GetFrmFmts()->Count(); 280cdf0e10cSrcweir sal_uInt16 i; 281cdf0e10cSrcweir for( i = 0; i < nArrLen; i++ ) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir SwFrmFmt* pFmt = (*pDoc->GetFrmFmts())[ i ]; 284cdf0e10cSrcweir if(pFmt->IsDefault() || pFmt->IsAuto()) 285cdf0e10cSrcweir continue; 286cdf0e10cSrcweir String *pFormat = new String(pFmt->GetName()); 287cdf0e10cSrcweir aFormats.Insert(pFormat); 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir // pool formats 291cdf0e10cSrcweir // 292cdf0e10cSrcweir const SvStringsDtor& rFrmPoolArr = SwStyleNameMapper::GetFrmFmtUINameArray(); 293cdf0e10cSrcweir for( i = 0; i < rFrmPoolArr.Count(); i++ ) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir String *pFormat = new String(*rFrmPoolArr[i]); 296cdf0e10cSrcweir if (!aFormats.Insert(pFormat)) 297cdf0e10cSrcweir delete pFormat; 298cdf0e10cSrcweir } 299cdf0e10cSrcweir 300cdf0e10cSrcweir Sequence<OUString> aListBoxEntries(aFormats.Count()); 301cdf0e10cSrcweir OUString* pEntries = aListBoxEntries.getArray(); 302cdf0e10cSrcweir sal_Int16 nSelect = 0; 303cdf0e10cSrcweir String sGraphicFormat = SW_RESSTR(STR_POOLFRM_GRAPHIC); 304cdf0e10cSrcweir for(i = 0; i < aFormats.Count(); ++i) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir pEntries[i] = *aFormats[i]; 307cdf0e10cSrcweir if(pEntries[i].equals(sGraphicFormat)) 308cdf0e10cSrcweir nSelect = i; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir try 311cdf0e10cSrcweir { 312cdf0e10cSrcweir Any aTemplates(&aListBoxEntries, ::getCppuType(&aListBoxEntries)); 313cdf0e10cSrcweir 314cdf0e10cSrcweir xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 315cdf0e10cSrcweir ListboxControlActions::ADD_ITEMS , aTemplates ); 316cdf0e10cSrcweir 317cdf0e10cSrcweir Any aSelectPos(&nSelect, ::getCppuType(&nSelect)); 318cdf0e10cSrcweir xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 319cdf0e10cSrcweir ListboxControlActions::SET_SELECT_ITEM, aSelectPos ); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir catch(Exception& ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir DBG_ERROR("control acces failed"); 324cdf0e10cSrcweir } 325cdf0e10cSrcweir 326cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pName, SfxStringItem, SID_INSERT_GRAPHIC , sal_False ); 327cdf0e10cSrcweir sal_Bool bShowError = !pName; 328cdf0e10cSrcweir if( pName || ERRCODE_NONE == pFileDlg->Execute() ) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir 331cdf0e10cSrcweir String aFileName, aFilterName; 332cdf0e10cSrcweir if ( pName ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir aFileName = pName->GetValue(); 335cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFilter, SfxStringItem, FN_PARAM_FILTER , sal_False ); 336cdf0e10cSrcweir if ( pFilter ) 337cdf0e10cSrcweir aFilterName = pFilter->GetValue(); 338cdf0e10cSrcweir } 339cdf0e10cSrcweir else 340cdf0e10cSrcweir { 341cdf0e10cSrcweir aFileName = pFileDlg->GetPath(); 342cdf0e10cSrcweir aFilterName = pFileDlg->GetCurrentFilter(); 343cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) ); 344cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) ); 345cdf0e10cSrcweir 346cdf0e10cSrcweir sal_Bool bAsLink = sal_False; 347cdf0e10cSrcweir if(nHtmlMode & HTMLMODE_ON) 348cdf0e10cSrcweir bAsLink = sal_True; 349cdf0e10cSrcweir else 350cdf0e10cSrcweir { 351cdf0e10cSrcweir try 352cdf0e10cSrcweir { 353cdf0e10cSrcweir Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0); 354cdf0e10cSrcweir DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found"); 355cdf0e10cSrcweir bAsLink = aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_True; 356cdf0e10cSrcweir Any aTemplateValue = xCtrlAcc->getValue( 357cdf0e10cSrcweir ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 358cdf0e10cSrcweir ListboxControlActions::GET_SELECTED_ITEM ); 359cdf0e10cSrcweir OUString sTmpl; 360cdf0e10cSrcweir aTemplateValue >>= sTmpl; 361cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) ); 362cdf0e10cSrcweir } 363cdf0e10cSrcweir catch(Exception& ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir DBG_ERROR("control acces failed"); 366cdf0e10cSrcweir } 367cdf0e10cSrcweir } 368cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) ); 369cdf0e10cSrcweir } 370cdf0e10cSrcweir 371cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pAsLink, SfxBoolItem, FN_PARAM_1 , sal_False ); 372cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pStyle, SfxStringItem, FN_PARAM_2 , sal_False ); 373cdf0e10cSrcweir 374cdf0e10cSrcweir sal_Bool bAsLink = sal_False; 375cdf0e10cSrcweir if( nHtmlMode & HTMLMODE_ON ) 376cdf0e10cSrcweir bAsLink = sal_True; 377cdf0e10cSrcweir else 378cdf0e10cSrcweir { 379cdf0e10cSrcweir if ( rReq.GetArgs() ) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir if ( pAsLink ) 382cdf0e10cSrcweir bAsLink = pAsLink->GetValue(); 383cdf0e10cSrcweir if ( pStyle && pStyle->GetValue().Len() ) 384cdf0e10cSrcweir sGraphicFormat = pStyle->GetValue(); 385cdf0e10cSrcweir } 386cdf0e10cSrcweir else 387cdf0e10cSrcweir { 388cdf0e10cSrcweir Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0); 389cdf0e10cSrcweir DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found"); 390cdf0e10cSrcweir bAsLink = aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_True; 391cdf0e10cSrcweir Any aTemplateValue = xCtrlAcc->getValue( 392cdf0e10cSrcweir ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, 393cdf0e10cSrcweir ListboxControlActions::GET_SELECTED_ITEM ); 394cdf0e10cSrcweir OUString sTmpl; 395cdf0e10cSrcweir aTemplateValue >>= sTmpl; 396cdf0e10cSrcweir if( sTmpl.getLength() ) 397cdf0e10cSrcweir sGraphicFormat = sTmpl; 398cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) ); 399cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) ); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir SwWrtShell& rSh = GetWrtShell(); 404cdf0e10cSrcweir rSh.LockPaint(); 405cdf0e10cSrcweir rSh.StartAction(); 406cdf0e10cSrcweir 407cdf0e10cSrcweir /// #111827# 408cdf0e10cSrcweir SwRewriter aRewriter; 409cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, String(SW_RES(STR_GRAPHIC_DEFNAME))); 410cdf0e10cSrcweir 411cdf0e10cSrcweir rSh.StartUndo(UNDO_INSERT, &aRewriter); 412cdf0e10cSrcweir 413cdf0e10cSrcweir int nError = InsertGraphic( aFileName, aFilterName, bAsLink, GraphicFilter::GetGraphicFilter() ); 414cdf0e10cSrcweir 415cdf0e10cSrcweir // Format ist ungleich Current Filter, jetzt mit auto. detection 416cdf0e10cSrcweir if( nError == GRFILTER_FORMATERROR ) 417cdf0e10cSrcweir nError = InsertGraphic( aFileName, aEmptyStr, bAsLink, GraphicFilter::GetGraphicFilter() ); 418cdf0e10cSrcweir if ( rSh.IsFrmSelected() ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir SwFrmFmt* pFmt = pDoc->FindFrmFmtByName( sGraphicFormat ); 421cdf0e10cSrcweir if(!pFmt) 422cdf0e10cSrcweir pFmt = pDoc->MakeFrmFmt(sGraphicFormat, 423cdf0e10cSrcweir pDocShell->GetDoc()->GetDfltFrmFmt(), 424cdf0e10cSrcweir sal_True, sal_False); 425cdf0e10cSrcweir rSh.SetFrmFmt( pFmt ); 426cdf0e10cSrcweir } 427cdf0e10cSrcweir 428cdf0e10cSrcweir RESOURCE_TYPE nResId = 0; 429cdf0e10cSrcweir switch( nError ) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir case GRFILTER_OPENERROR: 432cdf0e10cSrcweir nResId = STR_GRFILTER_OPENERROR; 433cdf0e10cSrcweir break; 434cdf0e10cSrcweir case GRFILTER_IOERROR: 435cdf0e10cSrcweir nResId = STR_GRFILTER_IOERROR; 436cdf0e10cSrcweir break; 437cdf0e10cSrcweir case GRFILTER_FORMATERROR: 438cdf0e10cSrcweir nResId = STR_GRFILTER_FORMATERROR; 439cdf0e10cSrcweir break; 440cdf0e10cSrcweir case GRFILTER_VERSIONERROR: 441cdf0e10cSrcweir nResId = STR_GRFILTER_VERSIONERROR; 442cdf0e10cSrcweir break; 443cdf0e10cSrcweir case GRFILTER_FILTERERROR: 444cdf0e10cSrcweir nResId = STR_GRFILTER_FILTERERROR; 445cdf0e10cSrcweir break; 446cdf0e10cSrcweir case GRFILTER_TOOBIG: 447cdf0e10cSrcweir nResId = STR_GRFILTER_TOOBIG; 448cdf0e10cSrcweir break; 449cdf0e10cSrcweir } 450cdf0e10cSrcweir 451cdf0e10cSrcweir rSh.EndAction(); 452cdf0e10cSrcweir rSh.UnlockPaint(); 453cdf0e10cSrcweir if( nResId ) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir if( bShowError ) 456cdf0e10cSrcweir { 457cdf0e10cSrcweir InfoBox aInfoBox( GetWindow(), SW_RESSTR( nResId )); 458cdf0e10cSrcweir aInfoBox.Execute(); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir rReq.Ignore(); 461cdf0e10cSrcweir } 462cdf0e10cSrcweir else 463cdf0e10cSrcweir { 464cdf0e10cSrcweir // set the specific graphic attrbutes to the graphic 465cdf0e10cSrcweir bReturn = sal_True; 466cdf0e10cSrcweir AutoCaption( GRAPHIC_CAP ); 467cdf0e10cSrcweir rReq.Done(); 468cdf0e10cSrcweir } 469cdf0e10cSrcweir 470cdf0e10cSrcweir rSh.EndUndo(); // due to possible change of Shell 471cdf0e10cSrcweir } 472cdf0e10cSrcweir 473cdf0e10cSrcweir delete pFileDlg; 474cdf0e10cSrcweir 475cdf0e10cSrcweir return bReturn; 476cdf0e10cSrcweir } 477cdf0e10cSrcweir 478cdf0e10cSrcweir 479cdf0e10cSrcweir void __EXPORT SwView::Execute(SfxRequest &rReq) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 482cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 483cdf0e10cSrcweir const SfxPoolItem* pItem; 484cdf0e10cSrcweir sal_Bool bIgnore = sal_False; 485cdf0e10cSrcweir switch( nSlot ) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir case SID_CREATE_SW_DRAWVIEW: 488cdf0e10cSrcweir // --> OD 2005-08-08 #i52858# - method name changed 489cdf0e10cSrcweir pWrtShell->getIDocumentDrawModelAccess()->GetOrCreateDrawModel(); 490cdf0e10cSrcweir // <-- 491cdf0e10cSrcweir break; 492cdf0e10cSrcweir 493cdf0e10cSrcweir case FN_LINE_NUMBERING_DLG: 494cdf0e10cSrcweir { 495cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 496cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 497cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclSwViewDialog( DLG_LINE_NUMBERING, *this); 498cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 499cdf0e10cSrcweir pDlg->Execute(); 500cdf0e10cSrcweir delete pDlg; 501cdf0e10cSrcweir break; 502cdf0e10cSrcweir } 503cdf0e10cSrcweir case FN_EDIT_LINK_DLG: 504cdf0e10cSrcweir EditLinkDlg(); 505cdf0e10cSrcweir break; 506cdf0e10cSrcweir case FN_REFRESH_VIEW: 507cdf0e10cSrcweir GetEditWin().Invalidate(); 508cdf0e10cSrcweir break; 509cdf0e10cSrcweir case FN_PAGEUP: 510cdf0e10cSrcweir case FN_PAGEUP_SEL: 511cdf0e10cSrcweir case FN_PAGEDOWN: 512cdf0e10cSrcweir case FN_PAGEDOWN_SEL: 513cdf0e10cSrcweir { 514cdf0e10cSrcweir Rectangle aVis( GetVisArea() ); 515cdf0e10cSrcweir SwEditWin& rTmpWin = GetEditWin(); 516cdf0e10cSrcweir if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot ) 517cdf0e10cSrcweir PageUpCrsr(FN_PAGEUP_SEL == nSlot); 518cdf0e10cSrcweir else 519cdf0e10cSrcweir PageDownCrsr(FN_PAGEDOWN_SEL == nSlot); 520cdf0e10cSrcweir 521cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem(nSlot, 522cdf0e10cSrcweir aVis != GetVisArea())); 523cdf0e10cSrcweir //#i42732# - notify the edit window that from now on we do not use the input language 524cdf0e10cSrcweir rTmpWin.SetUseInputLanguage( sal_False ); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir break; 527cdf0e10cSrcweir case FN_REDLINE_ON: 528cdf0e10cSrcweir { 529cdf0e10cSrcweir if( pArgs && 530cdf0e10cSrcweir SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem )) 531cdf0e10cSrcweir { 532cdf0e10cSrcweir IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); 533cdf0e10cSrcweir Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); 534cdf0e10cSrcweir if( aPasswd.getLength() ) 535cdf0e10cSrcweir { 536cdf0e10cSrcweir DBG_ASSERT( !((const SfxBoolItem*)pItem)->GetValue(), "SwView::Execute(): password set an redlining off doesn't match!" ); 537cdf0e10cSrcweir // xmlsec05: new password dialog 538cdf0e10cSrcweir Window* pParent; 539cdf0e10cSrcweir const SfxPoolItem* pParentItem; 540cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, sal_False, &pParentItem ) ) 541cdf0e10cSrcweir pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr(); 542cdf0e10cSrcweir else 543cdf0e10cSrcweir pParent = &GetViewFrame()->GetWindow(); 544cdf0e10cSrcweir SfxPasswordDialog aPasswdDlg( pParent ); 545cdf0e10cSrcweir aPasswdDlg.SetMinLen( 1 ); 546cdf0e10cSrcweir //#i69751# the result of Execute() can be ignored 547cdf0e10cSrcweir aPasswdDlg.Execute(); 548cdf0e10cSrcweir String sNewPasswd( aPasswdDlg.GetPassword() ); 549cdf0e10cSrcweir Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); 550cdf0e10cSrcweir SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); 551cdf0e10cSrcweir if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) 552cdf0e10cSrcweir pIDRA->SetRedlinePassword(Sequence <sal_Int8> ()); 553cdf0e10cSrcweir else 554cdf0e10cSrcweir { // xmlsec05: message box for wrong password 555cdf0e10cSrcweir break; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir sal_uInt16 nOn = ((const SfxBoolItem*)pItem)->GetValue() ? nsRedlineMode_t::REDLINE_ON : 0; 560cdf0e10cSrcweir sal_uInt16 nMode = pWrtShell->GetRedlineMode(); 561cdf0e10cSrcweir pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); 562cdf0e10cSrcweir } 563cdf0e10cSrcweir } 564cdf0e10cSrcweir break; 565cdf0e10cSrcweir case FN_REDLINE_PROTECT : 566cdf0e10cSrcweir { 567cdf0e10cSrcweir IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); 568cdf0e10cSrcweir Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); 569cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem ) 570cdf0e10cSrcweir && ((SfxBoolItem*)pItem)->GetValue() == ( aPasswd.getLength() != 0 ) ) 571cdf0e10cSrcweir break; 572cdf0e10cSrcweir 573cdf0e10cSrcweir // xmlsec05: new password dialog 574cdf0e10cSrcweir // message box for wrong password 575cdf0e10cSrcweir Window* pParent; 576cdf0e10cSrcweir const SfxPoolItem* pParentItem; 577cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, sal_False, &pParentItem ) ) 578cdf0e10cSrcweir pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr(); 579cdf0e10cSrcweir else 580cdf0e10cSrcweir pParent = &GetViewFrame()->GetWindow(); 581cdf0e10cSrcweir SfxPasswordDialog aPasswdDlg( pParent ); 582cdf0e10cSrcweir aPasswdDlg.SetMinLen( 1 ); 583cdf0e10cSrcweir if(!aPasswd.getLength()) 584cdf0e10cSrcweir aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); 585cdf0e10cSrcweir if (aPasswdDlg.Execute()) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON; 588cdf0e10cSrcweir String sNewPasswd( aPasswdDlg.GetPassword() ); 589cdf0e10cSrcweir Sequence <sal_Int8> aNewPasswd = 590cdf0e10cSrcweir pIDRA->GetRedlinePassword(); 591cdf0e10cSrcweir SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); 592cdf0e10cSrcweir if(!aPasswd.getLength()) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir pIDRA->SetRedlinePassword(aNewPasswd); 595cdf0e10cSrcweir } 596cdf0e10cSrcweir else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir pIDRA->SetRedlinePassword(Sequence <sal_Int8> ()); 599cdf0e10cSrcweir nOn = 0; 600cdf0e10cSrcweir } 601cdf0e10cSrcweir sal_uInt16 nMode = pIDRA->GetRedlineMode(); 602cdf0e10cSrcweir pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); 603cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) ); 604cdf0e10cSrcweir } 605cdf0e10cSrcweir else 606cdf0e10cSrcweir bIgnore = sal_True; 607cdf0e10cSrcweir } 608cdf0e10cSrcweir break; 609cdf0e10cSrcweir case FN_REDLINE_SHOW: 610cdf0e10cSrcweir 611cdf0e10cSrcweir if( pArgs && 612cdf0e10cSrcweir SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem)) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir sal_uInt16 nMode = ( ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) 615cdf0e10cSrcweir & pWrtShell->GetRedlineMode() ) | nsRedlineMode_t::REDLINE_SHOW_INSERT; 616cdf0e10cSrcweir if( ((const SfxBoolItem*)pItem)->GetValue() ) 617cdf0e10cSrcweir nMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE; 618cdf0e10cSrcweir 619cdf0e10cSrcweir pWrtShell->SetRedlineModeAndCheckInsMode( nMode ); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir break; 622cdf0e10cSrcweir case FN_MAILMERGE_SENDMAIL_CHILDWINDOW: 623cdf0e10cSrcweir case FN_REDLINE_ACCEPT: 624cdf0e10cSrcweir GetViewFrame()->ToggleChildWindow(nSlot); 625cdf0e10cSrcweir break; 626cdf0e10cSrcweir case FN_REDLINE_ACCEPT_DIRECT: 627cdf0e10cSrcweir case FN_REDLINE_REJECT_DIRECT: 628cdf0e10cSrcweir { 629cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); 630cdf0e10cSrcweir Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True ); 631cdf0e10cSrcweir if( pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) ) 632cdf0e10cSrcweir { 633cdf0e10cSrcweir sal_uInt16 nCount = pWrtShell->GetRedlineCount(); 634cdf0e10cSrcweir for( sal_uInt16 nRedline = 0; nRedline < nCount; ++nRedline ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir const SwRedline& rRedline = pWrtShell->GetRedline( nRedline ); 637cdf0e10cSrcweir if( *aCntntAtPos.aFnd.pRedl == rRedline ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir if( FN_REDLINE_ACCEPT_DIRECT == nSlot ) 640cdf0e10cSrcweir pWrtShell->AcceptRedline( nRedline ); 641cdf0e10cSrcweir else 642cdf0e10cSrcweir pWrtShell->RejectRedline( nRedline ); 643cdf0e10cSrcweir break; 644cdf0e10cSrcweir } 645cdf0e10cSrcweir } 646cdf0e10cSrcweir } 647cdf0e10cSrcweir } 648cdf0e10cSrcweir break; 649cdf0e10cSrcweir case SID_DOCUMENT_COMPARE: 650cdf0e10cSrcweir case SID_DOCUMENT_MERGE: 651cdf0e10cSrcweir { 652cdf0e10cSrcweir String sFileName, sFilterName; 653cdf0e10cSrcweir sal_Int16 nVersion = 0; 654cdf0e10cSrcweir bool bHasFileName = false; 655cdf0e10cSrcweir pViewImpl->SetParam( 0 ); 656cdf0e10cSrcweir 657cdf0e10cSrcweir if( pArgs ) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( SID_FILE_NAME, sal_False, &pItem )) 660cdf0e10cSrcweir sFileName = ((const SfxStringItem*)pItem)->GetValue(); 661cdf0e10cSrcweir bHasFileName = ( sFileName.Len() > 0 ); 662cdf0e10cSrcweir 663cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( SID_FILTER_NAME, sal_False, &pItem )) 664cdf0e10cSrcweir sFilterName = ((const SfxStringItem*)pItem)->GetValue(); 665cdf0e10cSrcweir 666cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( SID_VERSION, sal_False, &pItem )) 667cdf0e10cSrcweir { 668cdf0e10cSrcweir nVersion = ((const SfxInt16Item *)pItem)->GetValue(); 669cdf0e10cSrcweir pViewImpl->SetParam( nVersion ); 670cdf0e10cSrcweir } 671cdf0e10cSrcweir } 672cdf0e10cSrcweir 673cdf0e10cSrcweir pViewImpl->InitRequest( rReq ); 674cdf0e10cSrcweir long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion ); 675cdf0e10cSrcweir 676cdf0e10cSrcweir if ( bHasFileName ) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir rReq.SetReturnValue( SfxInt32Item( nSlot, nFound )); 679cdf0e10cSrcweir 680cdf0e10cSrcweir if (nFound > 0) // Redline-Browser anzeigen 681cdf0e10cSrcweir { 682cdf0e10cSrcweir SfxViewFrame* pVFrame = GetViewFrame(); 683cdf0e10cSrcweir pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT); 684cdf0e10cSrcweir 685cdf0e10cSrcweir // RedlineDlg neu initialisieren 686cdf0e10cSrcweir sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId(); 687cdf0e10cSrcweir SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*) 688cdf0e10cSrcweir pVFrame->GetChildWindow(nId); 689cdf0e10cSrcweir if (pRed) 690cdf0e10cSrcweir pRed->ReInitDlg(GetDocShell()); 691cdf0e10cSrcweir } 692cdf0e10cSrcweir } 693cdf0e10cSrcweir else 694cdf0e10cSrcweir bIgnore = sal_True; 695cdf0e10cSrcweir } 696cdf0e10cSrcweir break; 697cdf0e10cSrcweir case FN_SYNC_LABELS: 698cdf0e10cSrcweir case FN_MAILMERGE_CHILDWINDOW: 699cdf0e10cSrcweir GetViewFrame()->ShowChildWindow(nSlot, sal_True); 700cdf0e10cSrcweir break; 701cdf0e10cSrcweir case FN_ESCAPE: 702cdf0e10cSrcweir { 703cdf0e10cSrcweir if ( pWrtShell->HasDrawView() && pWrtShell->GetDrawView()->IsDragObj() ) 704cdf0e10cSrcweir { 705cdf0e10cSrcweir pWrtShell->BreakDrag(); 706cdf0e10cSrcweir pWrtShell->EnterSelFrmMode(); 707cdf0e10cSrcweir } 708cdf0e10cSrcweir else if ( pWrtShell->IsDrawCreate() ) 709cdf0e10cSrcweir { 710cdf0e10cSrcweir GetDrawFuncPtr()->BreakCreate(); 711cdf0e10cSrcweir AttrChangedNotify(pWrtShell); // ggf Shellwechsel... 712cdf0e10cSrcweir } 713cdf0e10cSrcweir else if ( pWrtShell->HasSelection() || IsDrawMode() ) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir SdrView *pSdrView = pWrtShell->HasDrawView() ? pWrtShell->GetDrawView() : 0; 716cdf0e10cSrcweir if(pSdrView && pSdrView->AreObjectsMarked() && 717cdf0e10cSrcweir pSdrView->GetHdlList().GetFocusHdl()) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl(); 720cdf0e10cSrcweir } 721cdf0e10cSrcweir else 722cdf0e10cSrcweir { 723cdf0e10cSrcweir if(pSdrView) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir LeaveDrawCreate(); 726cdf0e10cSrcweir Point aPt(LONG_MIN, LONG_MIN); 727cdf0e10cSrcweir //go out of the frame 728cdf0e10cSrcweir pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME); 729cdf0e10cSrcweir SfxBindings& rBind = GetViewFrame()->GetBindings(); 730cdf0e10cSrcweir rBind.Invalidate( SID_ATTR_SIZE ); 731cdf0e10cSrcweir } 732cdf0e10cSrcweir pWrtShell->EnterStdMode(); 733cdf0e10cSrcweir AttrChangedNotify(pWrtShell); // ggf Shellwechsel... 734cdf0e10cSrcweir } 735cdf0e10cSrcweir } 736cdf0e10cSrcweir else if ( GetEditWin().GetApplyTemplate() ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir GetEditWin().SetApplyTemplate(SwApplyTemplate()); 739cdf0e10cSrcweir } 740cdf0e10cSrcweir else if( ((SfxObjectShell*)GetDocShell())->IsInPlaceActive() ) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir Escape(); 743cdf0e10cSrcweir } 744cdf0e10cSrcweir else if ( GetEditWin().IsChainMode() ) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir GetEditWin().SetChainMode( sal_False ); 747cdf0e10cSrcweir } 748cdf0e10cSrcweir else if( pWrtShell->GetFlyFrmFmt() ) 749cdf0e10cSrcweir { 750cdf0e10cSrcweir const SwFrmFmt* pFmt = pWrtShell->GetFlyFrmFmt(); 751cdf0e10cSrcweir if(pWrtShell->GotoFly( pFmt->GetName(), FLYCNTTYPE_FRM )) 752cdf0e10cSrcweir { 753cdf0e10cSrcweir pWrtShell->HideCrsr(); 754cdf0e10cSrcweir pWrtShell->EnterSelFrmMode(); 755cdf0e10cSrcweir } 756cdf0e10cSrcweir } 757cdf0e10cSrcweir else 758cdf0e10cSrcweir { 759cdf0e10cSrcweir SfxBoolItem aItem( SID_WIN_FULLSCREEN, sal_False ); 760cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L ); 761cdf0e10cSrcweir bIgnore = sal_True; 762cdf0e10cSrcweir } 763cdf0e10cSrcweir } 764cdf0e10cSrcweir break; 765cdf0e10cSrcweir case SID_ATTR_BORDER_INNER: 766cdf0e10cSrcweir case SID_ATTR_BORDER_OUTER: 767cdf0e10cSrcweir case SID_ATTR_BORDER_SHADOW: 768cdf0e10cSrcweir if(pArgs) 76969a74367SOliver-Rainer Wittmann pWrtShell->SetAttrSet(*pArgs); 770cdf0e10cSrcweir break; 771cdf0e10cSrcweir 772cdf0e10cSrcweir case SID_ATTR_PAGE: 773cdf0e10cSrcweir case SID_ATTR_PAGE_SIZE: 774cdf0e10cSrcweir case SID_ATTR_PAGE_MAXSIZE: 775cdf0e10cSrcweir case SID_ATTR_PAGE_PAPERBIN: 776cdf0e10cSrcweir case SID_ATTR_PAGE_EXT1: 777cdf0e10cSrcweir case FN_PARAM_FTN_INFO: 778cdf0e10cSrcweir { 779cdf0e10cSrcweir if(pArgs) 780cdf0e10cSrcweir { 781cdf0e10cSrcweir const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc(); 782cdf0e10cSrcweir SwPageDesc aPageDesc( pWrtShell->GetPageDesc( nCurIdx ) ); 783cdf0e10cSrcweir ::ItemSetToPageDesc( *pArgs, aPageDesc ); 784cdf0e10cSrcweir // Den Descriptor der Core veraendern. 785cdf0e10cSrcweir pWrtShell->ChgPageDesc( nCurIdx, aPageDesc ); 786cdf0e10cSrcweir } 787cdf0e10cSrcweir } 788cdf0e10cSrcweir break; 789cdf0e10cSrcweir case FN_NAVIGATION_PI_GOTO_PAGE: 790cdf0e10cSrcweir { 791cdf0e10cSrcweir SfxViewFrame* pVFrame = GetViewFrame(); 792cdf0e10cSrcweir SfxChildWindow* pCh = pVFrame->GetChildWindow( SID_NAVIGATOR ); 793cdf0e10cSrcweir if(!pCh) 794cdf0e10cSrcweir { 795cdf0e10cSrcweir pVFrame->ToggleChildWindow( SID_NAVIGATOR ); 796cdf0e10cSrcweir pCh = pVFrame->GetChildWindow( SID_NAVIGATOR ); 797cdf0e10cSrcweir 798cdf0e10cSrcweir } 799cdf0e10cSrcweir ((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->GotoPage(); 800cdf0e10cSrcweir } 801cdf0e10cSrcweir break; 802cdf0e10cSrcweir case FN_EDIT_CURRENT_TOX: 803cdf0e10cSrcweir { 804cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 805cdf0e10cSrcweir FN_INSERT_MULTI_TOX, SFX_CALLMODE_ASYNCHRON); 806cdf0e10cSrcweir } 807cdf0e10cSrcweir break; 808cdf0e10cSrcweir case FN_UPDATE_CUR_TOX: 809cdf0e10cSrcweir { 810cdf0e10cSrcweir const SwTOXBase* pBase = pWrtShell->GetCurTOX(); 811cdf0e10cSrcweir if(pBase) 812cdf0e10cSrcweir { 813cdf0e10cSrcweir pWrtShell->StartAction(); 814cdf0e10cSrcweir if(TOX_INDEX == pBase->GetType()) 815cdf0e10cSrcweir pWrtShell->ApplyAutoMark(); 816cdf0e10cSrcweir pWrtShell->UpdateTableOf( *pBase ); 817cdf0e10cSrcweir pWrtShell->EndAction(); 818cdf0e10cSrcweir } 819cdf0e10cSrcweir } 820cdf0e10cSrcweir break; 821cdf0e10cSrcweir case FN_UPDATE_TOX: 822cdf0e10cSrcweir { 823cdf0e10cSrcweir pWrtShell->StartAction(); 824cdf0e10cSrcweir pWrtShell->EnterStdMode(); 825cdf0e10cSrcweir sal_Bool bOldCrsrInReadOnly = pWrtShell->IsReadOnlyAvailable(); 826cdf0e10cSrcweir pWrtShell->SetReadOnlyAvailable( sal_True ); 827cdf0e10cSrcweir 828cdf0e10cSrcweir for( sal_uInt16 i = 0; i < 2; ++i ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir sal_uInt16 nCount = pWrtShell->GetTOXCount(); 831cdf0e10cSrcweir if( 1 == nCount ) 832cdf0e10cSrcweir ++i; 833cdf0e10cSrcweir 834cdf0e10cSrcweir while( pWrtShell->GotoPrevTOXBase() ) 835cdf0e10cSrcweir ; // aufs erste Verzeichnis springen 836cdf0e10cSrcweir 837cdf0e10cSrcweir // falls wir nicht mehr in einem stehen, dann zum naechsten 838cdf0e10cSrcweir // springen. 839cdf0e10cSrcweir const SwTOXBase* pBase = pWrtShell->GetCurTOX(); 840cdf0e10cSrcweir if( !pBase ) 841cdf0e10cSrcweir { 842cdf0e10cSrcweir pWrtShell->GotoNextTOXBase(); 843cdf0e10cSrcweir pBase = pWrtShell->GetCurTOX(); 844cdf0e10cSrcweir } 845cdf0e10cSrcweir 846cdf0e10cSrcweir sal_Bool bAutoMarkApplied = sal_False; 847cdf0e10cSrcweir while( pBase ) 848cdf0e10cSrcweir { 849cdf0e10cSrcweir if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir pWrtShell->ApplyAutoMark(); 852cdf0e10cSrcweir bAutoMarkApplied = sal_True; 853cdf0e10cSrcweir } 854cdf0e10cSrcweir // JP 15.07.96: das pBase wird nur fuer die Schnittstelle 855cdf0e10cSrcweir // benoetigt. Muss mal umgetstellt werden!!! 856cdf0e10cSrcweir pWrtShell->UpdateTableOf( *pBase ); 857cdf0e10cSrcweir 858cdf0e10cSrcweir if( pWrtShell->GotoNextTOXBase() ) 859cdf0e10cSrcweir pBase = pWrtShell->GetCurTOX(); 860cdf0e10cSrcweir else 861cdf0e10cSrcweir pBase = 0; 862cdf0e10cSrcweir } 863cdf0e10cSrcweir } 864cdf0e10cSrcweir pWrtShell->SetReadOnlyAvailable( bOldCrsrInReadOnly ); 865cdf0e10cSrcweir pWrtShell->EndAction(); 866cdf0e10cSrcweir } 867cdf0e10cSrcweir break; 868cdf0e10cSrcweir case SID_ATTR_BRUSH: 869cdf0e10cSrcweir { 870cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_BACKGROUND, sal_False, &pItem)) 871cdf0e10cSrcweir { 872cdf0e10cSrcweir const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc(); 873cdf0e10cSrcweir SwPageDesc aDesc( pWrtShell->GetPageDesc( nCurIdx )); 874cdf0e10cSrcweir SwFrmFmt& rMaster = aDesc.GetMaster(); 875cdf0e10cSrcweir rMaster.SetFmtAttr(*pItem); 876cdf0e10cSrcweir pWrtShell->ChgPageDesc( nCurIdx, aDesc); 877cdf0e10cSrcweir } 878cdf0e10cSrcweir } 879cdf0e10cSrcweir break; 880cdf0e10cSrcweir case SID_CLEARHISTORY: 881cdf0e10cSrcweir { 882cdf0e10cSrcweir pWrtShell->DelAllUndoObj(); 883cdf0e10cSrcweir } 884cdf0e10cSrcweir break; 885cdf0e10cSrcweir case SID_UNDO: 886cdf0e10cSrcweir { 887cdf0e10cSrcweir pShell->ExecuteSlot(rReq); 888cdf0e10cSrcweir } 889cdf0e10cSrcweir break; 890cdf0e10cSrcweir case FN_INSERT_CTRL: 891cdf0e10cSrcweir case FN_INSERT_OBJ_CTRL: 892cdf0e10cSrcweir { 893cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem)) 894cdf0e10cSrcweir { 895cdf0e10cSrcweir sal_uInt16 nValue = ((SfxUInt16Item*)pItem)->GetValue(); 896cdf0e10cSrcweir switch ( nSlot ) 897cdf0e10cSrcweir { 898cdf0e10cSrcweir case FN_INSERT_CTRL: 899cdf0e10cSrcweir { 900cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this); 901cdf0e10cSrcweir if(bWeb) 902cdf0e10cSrcweir SwView::nWebInsertCtrlState = nValue; 903cdf0e10cSrcweir else 904cdf0e10cSrcweir SwView::nInsertCtrlState = nValue; 905cdf0e10cSrcweir } 906cdf0e10cSrcweir break; 907cdf0e10cSrcweir case FN_INSERT_OBJ_CTRL: SwView::nInsertObjectCtrlState = nValue ;break; 908cdf0e10cSrcweir } 909cdf0e10cSrcweir 910cdf0e10cSrcweir } 911cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( nSlot ); 912cdf0e10cSrcweir } 913cdf0e10cSrcweir break; 914cdf0e10cSrcweir #if defined WNT || defined UNX 915cdf0e10cSrcweir case SID_TWAIN_SELECT: 916cdf0e10cSrcweir case SID_TWAIN_TRANSFER: 917cdf0e10cSrcweir GetViewImpl()->ExecuteScan( rReq ); 918cdf0e10cSrcweir break; 919cdf0e10cSrcweir #endif 920cdf0e10cSrcweir 921cdf0e10cSrcweir case SID_ATTR_DEFTABSTOP: 922cdf0e10cSrcweir { 923cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_DEFTABSTOP, sal_False, &pItem)) 924cdf0e10cSrcweir { 925cdf0e10cSrcweir SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); 926cdf0e10cSrcweir sal_uInt16 nTab = ((const SfxUInt16Item*)pItem)->GetValue(); 927cdf0e10cSrcweir MakeDefTabs( nTab, aDefTabs ); 928cdf0e10cSrcweir pWrtShell->SetDefault( aDefTabs ); 929cdf0e10cSrcweir } 930cdf0e10cSrcweir } 931cdf0e10cSrcweir break; 932cdf0e10cSrcweir case SID_ATTR_LANGUAGE : 933cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, sal_False, &pItem)) 934cdf0e10cSrcweir { 935cdf0e10cSrcweir SvxLanguageItem aLang(((SvxLanguageItem*)pItem)->GetLanguage(), RES_CHRATR_LANGUAGE); 936cdf0e10cSrcweir pWrtShell->SetDefault( aLang ); 937cdf0e10cSrcweir lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_LANGUAGE ); 938cdf0e10cSrcweir } 939cdf0e10cSrcweir break; 940cdf0e10cSrcweir case SID_ATTR_CHAR_CTL_LANGUAGE: 941cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, sal_False, &pItem)) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir pWrtShell->SetDefault( *pItem ); 944cdf0e10cSrcweir lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_CTL_LANGUAGE ); 945cdf0e10cSrcweir } 946cdf0e10cSrcweir break; 947cdf0e10cSrcweir case SID_ATTR_CHAR_CJK_LANGUAGE: 948cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, sal_False, &pItem)) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir pWrtShell->SetDefault( *pItem ); 951cdf0e10cSrcweir lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_CJK_LANGUAGE ); 952cdf0e10cSrcweir } 953cdf0e10cSrcweir break; 954cdf0e10cSrcweir case FN_SCROLL_NEXT_PREV: 955cdf0e10cSrcweir if(pArgs && pArgs->GetItemState(FN_SCROLL_NEXT_PREV, sal_False, &pItem)) 956cdf0e10cSrcweir { 957cdf0e10cSrcweir // call the handlers of PageUp/DownButtons, only 958cdf0e10cSrcweir bool* pbNext = new bool ( ((const SfxBoolItem*)pItem)->GetValue() ); 959cdf0e10cSrcweir // #i75416# move the execution of the search to an asynchronously called static link 960cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK(this, SwView, MoveNavigationHdl), pbNext ); 961cdf0e10cSrcweir } 962cdf0e10cSrcweir break; 963cdf0e10cSrcweir case SID_JUMPTOMARK: 964cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_JUMPTOMARK, sal_False, &pItem)) 965cdf0e10cSrcweir JumpToSwMark( (( const SfxStringItem*)pItem)->GetValue() ); 966cdf0e10cSrcweir break; 967cdf0e10cSrcweir case SID_GALLERY : 968cdf0e10cSrcweir GetViewFrame()->ChildWindowExecute(rReq);//ToggleChildWindow(SID_GALLERY); 969cdf0e10cSrcweir break; 970cdf0e10cSrcweir case SID_AVMEDIA_PLAYER : 971cdf0e10cSrcweir GetViewFrame()->ChildWindowExecute(rReq);//ToggleChildWindow(SID_AVMEDIA_PLAYER); 972cdf0e10cSrcweir break; 973cdf0e10cSrcweir case SID_VIEW_DATA_SOURCE_BROWSER: 974cdf0e10cSrcweir { 975cdf0e10cSrcweir SfxViewFrame* pVFrame = GetViewFrame(); 976cdf0e10cSrcweir pVFrame->ChildWindowExecute(rReq); 977cdf0e10cSrcweir if(pVFrame->HasChildWindow(SID_BROWSER)) 978cdf0e10cSrcweir { 979cdf0e10cSrcweir const SwDBData& rData = GetWrtShell().GetDBDesc(); 980cdf0e10cSrcweir SW_MOD()->ShowDBObj(*this, rData, sal_False); 981cdf0e10cSrcweir } 982cdf0e10cSrcweir } 983cdf0e10cSrcweir break; 984cdf0e10cSrcweir case FN_INSERT_FIELD_DATA_ONLY : 985cdf0e10cSrcweir { 986cdf0e10cSrcweir sal_Bool bShow = sal_False; 987cdf0e10cSrcweir if( pArgs && 988cdf0e10cSrcweir SFX_ITEM_SET == pArgs->GetItemState(nSlot, sal_False, &pItem )) 989cdf0e10cSrcweir bShow = ((const SfxBoolItem*)pItem)->GetValue(); 990cdf0e10cSrcweir //GetViewFrame()->ShowChildWindow(nSlot, bShow && bInMailMerge); 991cdf0e10cSrcweir if((bShow && bInMailMerge) != GetViewFrame()->HasChildWindow(nSlot)) 992cdf0e10cSrcweir GetViewFrame()->ToggleChildWindow(nSlot); 993cdf0e10cSrcweir //if fields have been succesfully inserted call the "real" 994cdf0e10cSrcweir //mail merge dialog 995cdf0e10cSrcweir SwWrtShell &rSh = GetWrtShell(); 996cdf0e10cSrcweir if(bInMailMerge && rSh.IsAnyDatabaseFieldInDoc()) 997cdf0e10cSrcweir { 998cdf0e10cSrcweir SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr(); 999cdf0e10cSrcweir if (pNewDBMgr) 1000cdf0e10cSrcweir { 1001cdf0e10cSrcweir SwDBData aData; 1002cdf0e10cSrcweir aData = rSh.GetDBData(); 1003cdf0e10cSrcweir rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer 1004cdf0e10cSrcweir // das Mischen von DB-Feldern notwendig. 1005cdf0e10cSrcweir AttrChangedNotify( &rSh ); 1006cdf0e10cSrcweir pNewDBMgr->SetMergeType( DBMGR_MERGE ); 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir Sequence<PropertyValue> aProperties(3); 1009cdf0e10cSrcweir PropertyValue* pValues = aProperties.getArray(); 1010cdf0e10cSrcweir pValues[0].Name = C2U("DataSourceName"); 1011cdf0e10cSrcweir pValues[1].Name = C2U("Command"); 1012cdf0e10cSrcweir pValues[2].Name = C2U("CommandType"); 1013cdf0e10cSrcweir pValues[0].Value <<= aData.sDataSource; 1014cdf0e10cSrcweir pValues[1].Value <<= aData.sCommand; 1015cdf0e10cSrcweir pValues[2].Value <<= aData.nCommandType; 1016cdf0e10cSrcweir pNewDBMgr->ExecuteFormLetter(rSh, aProperties, sal_True); 1017cdf0e10cSrcweir } 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir bInMailMerge &= bShow; 1020cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(FN_INSERT_FIELD); 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir break; 1023cdf0e10cSrcweir case FN_QRY_MERGE: 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir sal_Bool bUseCurrentDocument = sal_True; 1026cdf0e10cSrcweir sal_Bool bQuery = !pArgs||SFX_ITEM_SET != pArgs->GetItemState(nSlot); 1027cdf0e10cSrcweir if(bQuery) 1028cdf0e10cSrcweir { 1029cdf0e10cSrcweir SfxViewFrame* pTmpFrame = GetViewFrame(); 1030cdf0e10cSrcweir SfxHelp::OpenHelpAgent( &pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT ); 1031cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 1032cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 1033cdf0e10cSrcweir AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg( DLG_MERGE_CREATE, 1034cdf0e10cSrcweir &pTmpFrame->GetWindow()); 1035cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 1036cdf0e10cSrcweir if(RET_OK == pDlg->Execute()) 1037cdf0e10cSrcweir bUseCurrentDocument = pDlg->IsThisDocument(); 1038cdf0e10cSrcweir else 1039cdf0e10cSrcweir break; 1040cdf0e10cSrcweir } 1041cdf0e10cSrcweir GenerateFormLetter(bUseCurrentDocument); 1042cdf0e10cSrcweir } 1043cdf0e10cSrcweir break; 1044cdf0e10cSrcweir case SID_RECHECK_DOCUMENT: 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir SwDocShell* pDocShell = GetDocShell(); 1047cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 1048cdf0e10cSrcweir uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() ); 1049cdf0e10cSrcweir if( xGCIterator.is() ) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir xGCIterator->resetIgnoreRules(); 1052cdf0e10cSrcweir } 1053cdf0e10cSrcweir // reset ignore lists 1054cdf0e10cSrcweir pDoc->SpellItAgainSam( sal_True, sal_False, sal_False ); 1055cdf0e10cSrcweir // clear ignore dictionary 1056cdf0e10cSrcweir uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); 1057cdf0e10cSrcweir if( xDictionary.is() ) 1058cdf0e10cSrcweir xDictionary->clear(); 1059cdf0e10cSrcweir // put cursor to the start of the document 1060cdf0e10cSrcweir pWrtShell->SttDoc(); 1061cdf0e10cSrcweir } 1062cdf0e10cSrcweir // no break; - but call spell/grammar dialog 1063cdf0e10cSrcweir case FN_SPELL_GRAMMAR_DIALOG: 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir SfxViewFrame* pViewFrame = GetViewFrame(); 1066cdf0e10cSrcweir if (rReq.GetArgs() != NULL) 1067cdf0e10cSrcweir pViewFrame->SetChildWindow (FN_SPELL_GRAMMAR_DIALOG, 1068cdf0e10cSrcweir ((const SfxBoolItem&) (rReq.GetArgs()-> 1069cdf0e10cSrcweir Get(FN_SPELL_GRAMMAR_DIALOG))).GetValue()); 1070cdf0e10cSrcweir else 1071cdf0e10cSrcweir pViewFrame->ToggleChildWindow(FN_SPELL_GRAMMAR_DIALOG); 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir pViewFrame->GetBindings().Invalidate(FN_SPELL_GRAMMAR_DIALOG); 1074cdf0e10cSrcweir rReq.Ignore (); 1075cdf0e10cSrcweir } 1076cdf0e10cSrcweir break; 1077cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT : 1078cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER : 1079cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT : 1080cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: 1081cdf0e10cSrcweir case SID_ALIGN_ANY_TOP : 1082cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER : 1083cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM : 1084cdf0e10cSrcweir case SID_ALIGN_ANY_HDEFAULT : 1085cdf0e10cSrcweir case SID_ALIGN_ANY_VDEFAULT : 1086cdf0e10cSrcweir { 1087cdf0e10cSrcweir sal_uInt16 nAlias = 0; 1088cdf0e10cSrcweir if( nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) ) 1089cdf0e10cSrcweir { 1090cdf0e10cSrcweir switch( nSlot ) 1091cdf0e10cSrcweir { 1092cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break; 1093cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; 1094cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; 1095cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; 109623257455SOliver-Rainer Wittmann case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; 109723257455SOliver-Rainer Wittmann case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; 109823257455SOliver-Rainer Wittmann case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; 1099cdf0e10cSrcweir } 1100cdf0e10cSrcweir } 1101cdf0e10cSrcweir else 1102cdf0e10cSrcweir { 1103cdf0e10cSrcweir switch( nSlot ) 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break; 1106cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break; 1107cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break; 1108cdf0e10cSrcweir case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break; 1109cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break; 1110cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break; 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir } 1113cdf0e10cSrcweir //special handling for the draw shell 1114cdf0e10cSrcweir if(nAlias && (nSelectionType & (nsSelectionType::SEL_DRW))) 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir SfxAllEnumItem aEnumItem(SID_OBJECT_ALIGN, nAlias - SID_OBJECT_ALIGN_LEFT); 1117cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 1118cdf0e10cSrcweir SID_OBJECT_ALIGN, SFX_CALLMODE_ASYNCHRON, &aEnumItem, 0L); 1119cdf0e10cSrcweir } 1120cdf0e10cSrcweir else if(nAlias) 1121cdf0e10cSrcweir //these slots are either re-mapped to text or object alignment 1122cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 1123cdf0e10cSrcweir nAlias, SFX_CALLMODE_ASYNCHRON); 1124cdf0e10cSrcweir } 1125cdf0e10cSrcweir break; 1126cdf0e10cSrcweir case SID_RESTORE_EDITING_VIEW: 1127cdf0e10cSrcweir { 1128cdf0e10cSrcweir //#i33307# restore editing position 1129cdf0e10cSrcweir Point aCrsrPos; 1130cdf0e10cSrcweir bool bSelectObj; 1131cdf0e10cSrcweir if(pViewImpl->GetRestorePosition(aCrsrPos, bSelectObj)) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj ); 1134cdf0e10cSrcweir if( bSelectObj ) 1135cdf0e10cSrcweir { 1136cdf0e10cSrcweir pWrtShell->SelectObj( aCrsrPos ); 1137cdf0e10cSrcweir pWrtShell->EnterSelFrmMode( &aCrsrPos ); 1138cdf0e10cSrcweir } 1139cdf0e10cSrcweir } 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir break; 1142cdf0e10cSrcweir case SID_INSERT_GRAPHIC: 1143cdf0e10cSrcweir { 1144cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq ))); 1145cdf0e10cSrcweir } 1146cdf0e10cSrcweir break; 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir default: 1150cdf0e10cSrcweir ASSERT(!this, falscher Dispatcher); 1151cdf0e10cSrcweir return; 1152cdf0e10cSrcweir } 1153cdf0e10cSrcweir if(!bIgnore) 1154cdf0e10cSrcweir rReq.Done(); 1155cdf0e10cSrcweir } 1156cdf0e10cSrcweir 1157cdf0e10cSrcweir /*-------------------------------------------------------------------- 1158cdf0e10cSrcweir Beschreibung: SeitenNr-Feld invalidieren 1159cdf0e10cSrcweir --------------------------------------------------------------------*/ 1160cdf0e10cSrcweir 1161cdf0e10cSrcweir void SwView::UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const String& rPgStr) 1162cdf0e10cSrcweir { 1163cdf0e10cSrcweir String sTemp(GetPageStr( nPhyNum, nVirtNum, rPgStr )); 1164cdf0e10cSrcweir const SfxStringItem aTmp( FN_STAT_PAGE, sTemp ); 1165cdf0e10cSrcweir SfxBindings &rBnd = GetViewFrame()->GetBindings(); 1166cdf0e10cSrcweir rBnd.SetState( aTmp ); 1167cdf0e10cSrcweir rBnd.Update( FN_STAT_PAGE ); 1168cdf0e10cSrcweir } 1169cdf0e10cSrcweir 1170cdf0e10cSrcweir /*-------------------------------------------------------------------- 1171cdf0e10cSrcweir Beschreibung: Status der Stauszeile 1172cdf0e10cSrcweir --------------------------------------------------------------------*/ 1173cdf0e10cSrcweir 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir void SwView::StateStatusLine(SfxItemSet &rSet) 1176cdf0e10cSrcweir { 1177cdf0e10cSrcweir SwWrtShell& rShell = GetWrtShell(); 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 1180cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1181cdf0e10cSrcweir ASSERT( nWhich, "leeres Set"); 1182ca62e2c2SSteve Yin if (Application::IsAccessibilityEnabled()) 1183ca62e2c2SSteve Yin { 1184ca62e2c2SSteve Yin //get section chang event 1185ca62e2c2SSteve Yin const SwSection* CurrSect = rShell.GetCurrSection(); 1186ca62e2c2SSteve Yin if( CurrSect ) 1187ca62e2c2SSteve Yin { 1188ca62e2c2SSteve Yin String sCurrentSectionName = CurrSect->GetSectionName(); 1189ca62e2c2SSteve Yin if(sCurrentSectionName != nOldSectionName) 1190ca62e2c2SSteve Yin { 1191ca62e2c2SSteve Yin rShell.FireSectionChangeEvent(2, 1); 1192ca62e2c2SSteve Yin } 1193ca62e2c2SSteve Yin nOldSectionName = sCurrentSectionName; 1194ca62e2c2SSteve Yin } 1195ca62e2c2SSteve Yin else if ( !(nOldSectionName.Equals(String())) ) 1196ca62e2c2SSteve Yin { 1197ca62e2c2SSteve Yin rShell.FireSectionChangeEvent(2, 1); 1198ca62e2c2SSteve Yin nOldSectionName = String(); 1199ca62e2c2SSteve Yin } 1200ca62e2c2SSteve Yin //get column change event 1201ca62e2c2SSteve Yin if(rShell.bColumnChange()) 1202ca62e2c2SSteve Yin { 1203ca62e2c2SSteve Yin rShell.FireColumnChangeEvent(2, 1); 1204ca62e2c2SSteve Yin } 1205ca62e2c2SSteve Yin } 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir while( nWhich ) 1208cdf0e10cSrcweir { 1209cdf0e10cSrcweir switch( nWhich ) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir case FN_STAT_PAGE: 1212cdf0e10cSrcweir /* 1213cdf0e10cSrcweir //JP 07.01.00: is a nice feature - show the selektion of DrawObjects 1214cdf0e10cSrcweir if( rShell.IsObjSelected() 1215cdf0e10cSrcweir //??? || rShell.IsFrmSelected() 1216cdf0e10cSrcweir ) 1217cdf0e10cSrcweir { 1218cdf0e10cSrcweir String sDisplay( rShell.GetDrawView()->GetMarkedObjectList(). 1219cdf0e10cSrcweir GetDescriptionOfMarkedObjects() ); 1220cdf0e10cSrcweir rSet.Put( SfxStringItem( FN_STAT_PAGE, sDisplay )); 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir else 1223cdf0e10cSrcweir */ { 1224cdf0e10cSrcweir // Anzahl der Seiten, log. SeitenNr. SeitenNr ermitteln 1225cdf0e10cSrcweir sal_uInt16 nPage, nLogPage; 1226cdf0e10cSrcweir String sDisplay; 1227cdf0e10cSrcweir rShell.GetPageNumber( -1, rShell.IsCrsrVisible(), nPage, nLogPage, sDisplay ); 1228cdf0e10cSrcweir rSet.Put( SfxStringItem( FN_STAT_PAGE, 1229cdf0e10cSrcweir GetPageStr( nPage, nLogPage, sDisplay) )); 1230ca62e2c2SSteve Yin //if existing page number is not equal to old page number, send out this event. 1231ca62e2c2SSteve Yin if (nOldPageNum != nLogPage ) 1232ca62e2c2SSteve Yin { 1233ca62e2c2SSteve Yin if (nOldPageNum != 0) 1234ca62e2c2SSteve Yin rShell.FirePageChangeEvent(nOldPageNum, nLogPage); 1235ca62e2c2SSteve Yin nOldPageNum = nLogPage; 1236ca62e2c2SSteve Yin } 1237cdf0e10cSrcweir sal_uInt16 nCnt = GetWrtShell().GetPageCnt(); 1238cdf0e10cSrcweir if (nPageCnt != nCnt) // Basic benachrichtigen 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir nPageCnt = nCnt; 1241cdf0e10cSrcweir SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), sal_False); 1242cdf0e10cSrcweir } 1243cdf0e10cSrcweir } 1244cdf0e10cSrcweir break; 1245cdf0e10cSrcweir case FN_STAT_TEMPLATE: 1246cdf0e10cSrcweir { 1247cdf0e10cSrcweir rSet.Put(SfxStringItem( FN_STAT_TEMPLATE, 1248cdf0e10cSrcweir rShell.GetCurPageStyle(sal_False))); 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir } 1251cdf0e10cSrcweir break; 1252cdf0e10cSrcweir case SID_ATTR_ZOOM: 1253cdf0e10cSrcweir { 1254cdf0e10cSrcweir if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir const SwViewOption* pVOpt = rShell.GetViewOptions(); 1257cdf0e10cSrcweir SvxZoomType eZoom = (SvxZoomType) pVOpt->GetZoomType(); 1258cdf0e10cSrcweir SvxZoomItem aZoom(eZoom, 1259cdf0e10cSrcweir pVOpt->GetZoom()); 1260cdf0e10cSrcweir if( pVOpt->getBrowseMode() ) 1261cdf0e10cSrcweir { 1262cdf0e10cSrcweir aZoom.SetValueSet( 1263cdf0e10cSrcweir SVX_ZOOM_ENABLE_50| 1264cdf0e10cSrcweir SVX_ZOOM_ENABLE_75| 1265cdf0e10cSrcweir SVX_ZOOM_ENABLE_100| 1266cdf0e10cSrcweir SVX_ZOOM_ENABLE_150| 1267cdf0e10cSrcweir SVX_ZOOM_ENABLE_200); 1268cdf0e10cSrcweir } 1269cdf0e10cSrcweir rSet.Put( aZoom ); 1270cdf0e10cSrcweir } 1271cdf0e10cSrcweir else 1272cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_ZOOM ); 1273cdf0e10cSrcweir } 1274cdf0e10cSrcweir break; 1275cdf0e10cSrcweir case SID_ATTR_VIEWLAYOUT: 1276cdf0e10cSrcweir { 1277cdf0e10cSrcweir if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir const SwViewOption* pVOpt = rShell.GetViewOptions(); 1280cdf0e10cSrcweir const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns(); 1281cdf0e10cSrcweir const bool bBookMode = pVOpt->IsViewLayoutBookMode(); 1282cdf0e10cSrcweir SvxViewLayoutItem aViewLayout(nColumns, bBookMode); 1283cdf0e10cSrcweir rSet.Put( aViewLayout ); 1284cdf0e10cSrcweir } 1285cdf0e10cSrcweir else 1286cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_VIEWLAYOUT ); 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir break; 1289cdf0e10cSrcweir case SID_ATTR_ZOOMSLIDER: 1290cdf0e10cSrcweir { 1291cdf0e10cSrcweir if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1292cdf0e10cSrcweir { 1293cdf0e10cSrcweir const SwViewOption* pVOpt = rShell.GetViewOptions(); 1294cdf0e10cSrcweir const sal_uInt16 nCurrentZoom = pVOpt->GetZoom(); 1295cdf0e10cSrcweir SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM ); 1296cdf0e10cSrcweir aZoomSliderItem.AddSnappingPoint( 100 ); 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir if ( !pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) 1299cdf0e10cSrcweir { 1300cdf0e10cSrcweir const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns(); 1301cdf0e10cSrcweir const bool bAutomaticViewLayout = 0 == nColumns; 1302cdf0e10cSrcweir const SwPostItMgr* pMgr = GetPostItMgr(); 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir // snapping points: 1305cdf0e10cSrcweir // automatic mode: 1 Page, 2 Pages, 100% 1306cdf0e10cSrcweir // n Columns mode: n Pages, 100% 1307cdf0e10cSrcweir // n Columns book mode: nPages without gaps, 100% 1308cdf0e10cSrcweir const SwRect aPageRect( pWrtShell->GetAnyCurRect( RECT_PAGE_CALC ) ); 1309cdf0e10cSrcweir const SwRect aRootRect( pWrtShell->GetAnyCurRect( RECT_PAGES_AREA ) ); // width of columns 1310cdf0e10cSrcweir Size aPageSize( aPageRect.SSize() ); 1311cdf0e10cSrcweir aPageSize.Width() += pMgr->HasNotes() && pMgr->ShowNotes() ? 1312cdf0e10cSrcweir pMgr->GetSidebarWidth() + pMgr->GetSidebarBorderWidth() : 1313cdf0e10cSrcweir 0; 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir Size aRootSize( aRootRect.SSize() ); 1316cdf0e10cSrcweir 1317cdf0e10cSrcweir const MapMode aTmpMap( MAP_TWIP ); 1318cdf0e10cSrcweir const Size& rEditSize = GetEditWin().GetOutputSizePixel(); 1319cdf0e10cSrcweir const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) ); 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir const long nOf = DOCUMENTBORDER * 2L; 1322cdf0e10cSrcweir long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width(); 1323cdf0e10cSrcweir nTmpWidth += nOf; 1324cdf0e10cSrcweir aPageSize.Height() += nOf; 1325cdf0e10cSrcweir long nFac = aWindowSize.Width() * 100 / nTmpWidth; 1326cdf0e10cSrcweir 1327cdf0e10cSrcweir long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height(); 1328cdf0e10cSrcweir nFac = Min( nFac, nVisPercent ); 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir aZoomSliderItem.AddSnappingPoint( nFac ); 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir if ( bAutomaticViewLayout ) 1333cdf0e10cSrcweir { 1334cdf0e10cSrcweir nTmpWidth += aPageSize.Width() + GAPBETWEENPAGES; 1335cdf0e10cSrcweir nFac = aWindowSize.Width() * 100 / nTmpWidth; 1336cdf0e10cSrcweir nFac = Min( nFac, nVisPercent ); 1337cdf0e10cSrcweir aZoomSliderItem.AddSnappingPoint( nFac ); 1338cdf0e10cSrcweir } 1339cdf0e10cSrcweir } 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir rSet.Put( aZoomSliderItem ); 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir else 1344cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_ZOOMSLIDER ); 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir break; 1347cdf0e10cSrcweir case SID_ATTR_POSITION: 1348cdf0e10cSrcweir case SID_ATTR_SIZE: 1349cdf0e10cSrcweir { 1350cdf0e10cSrcweir if( !rShell.IsFrmSelected() && !rShell.IsObjSelected() ) 1351cdf0e10cSrcweir SwBaseShell::_SetFrmMode( FLY_DRAG_END ); 1352cdf0e10cSrcweir else 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir FlyMode eFrameMode = SwBaseShell::GetFrmMode(); 1355cdf0e10cSrcweir if ( eFrameMode == FLY_DRAG_START || eFrameMode == FLY_DRAG ) 1356cdf0e10cSrcweir { 1357cdf0e10cSrcweir if ( nWhich == SID_ATTR_POSITION ) 1358cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, 1359cdf0e10cSrcweir rShell.GetAnchorObjDiff())); 1360cdf0e10cSrcweir else 1361cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, 1362cdf0e10cSrcweir rShell.GetObjSize())); 1363cdf0e10cSrcweir } 1364cdf0e10cSrcweir } 1365cdf0e10cSrcweir } 1366cdf0e10cSrcweir break; 1367cdf0e10cSrcweir case SID_TABLE_CELL: 1368cdf0e10cSrcweir 1369cdf0e10cSrcweir if( rShell.IsFrmSelected() || rShell.IsObjSelected() ) 1370cdf0e10cSrcweir { 1371cdf0e10cSrcweir // #i39171# Don't put a SvxSizeItem into a slot which is defined as SfxStringItem. 1372cdf0e10cSrcweir // SvxPosSizeStatusBarControl no longer resets to empty display if only one slot 1373cdf0e10cSrcweir // has no item, so SID_TABLE_CELL can remain empty (the SvxSizeItem is supplied 1374cdf0e10cSrcweir // in SID_ATTR_SIZE). 1375cdf0e10cSrcweir } 1376cdf0e10cSrcweir else 1377cdf0e10cSrcweir { 1378cdf0e10cSrcweir String sStr; 1379cdf0e10cSrcweir if( rShell.IsCrsrInTbl() ) 1380cdf0e10cSrcweir { 1381cdf0e10cSrcweir // table name + cell coordinate 1382cdf0e10cSrcweir sStr = rShell.GetTableFmt()->GetName(); 1383cdf0e10cSrcweir sStr += ':'; 1384cdf0e10cSrcweir sStr += rShell.GetBoxNms(); 1385cdf0e10cSrcweir } 1386cdf0e10cSrcweir else 1387cdf0e10cSrcweir { 1388cdf0e10cSrcweir const SwSection* pCurrSect = rShell.GetCurrSection(); 1389cdf0e10cSrcweir if( pCurrSect ) 1390cdf0e10cSrcweir { 1391cdf0e10cSrcweir switch( pCurrSect->GetType() ) 1392cdf0e10cSrcweir { 1393cdf0e10cSrcweir case TOX_HEADER_SECTION: 1394cdf0e10cSrcweir case TOX_CONTENT_SECTION: 1395cdf0e10cSrcweir { 1396cdf0e10cSrcweir const SwTOXBase* pTOX = pWrtShell->GetCurTOX(); 1397cdf0e10cSrcweir if( pTOX ) 1398cdf0e10cSrcweir sStr = pTOX->GetTOXName(); 1399cdf0e10cSrcweir else 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir ASSERT( !this, 1402cdf0e10cSrcweir "was ist das fuer ein Verzeichnis?" ); 1403cdf0e10cSrcweir sStr = pCurrSect->GetSectionName(); 1404cdf0e10cSrcweir } 1405cdf0e10cSrcweir } 1406cdf0e10cSrcweir break; 1407cdf0e10cSrcweir default: 1408cdf0e10cSrcweir sStr = pCurrSect->GetSectionName(); 1409cdf0e10cSrcweir break; 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir } 1412cdf0e10cSrcweir } 1413cdf0e10cSrcweir 1414cdf0e10cSrcweir //#outline level, removed by zhaojianwei 1415cdf0e10cSrcweir //const SwNumRule* pNumRule = rShell.GetCurNumRule(); 1416cdf0e10cSrcweir //if (pNumRule) // Cursor in Numerierung 1417cdf0e10cSrcweir //{ 1418cdf0e10cSrcweir // sal_uInt8 nNumLevel = rShell.GetNumLevel(); 1419cdf0e10cSrcweir // if( IsShowNum(nNumLevel) && MAXLEVEL > 1420cdf0e10cSrcweir // ( nNumLevel = GetRealLevel( nNumLevel )) ) 1421cdf0e10cSrcweir // { 1422cdf0e10cSrcweir // if( sStr.Len() ) 1423cdf0e10cSrcweir // sStr.AppendAscii(sStatusDelim); 1424cdf0e10cSrcweir // sStr += SW_RESSTR(STR_NUM_LEVEL); 1425cdf0e10cSrcweir // sStr += String::CreateFromInt32( nNumLevel + 1 ); 1426cdf0e10cSrcweir // if(!pNumRule->IsAutoRule()) 1427cdf0e10cSrcweir // { 1428cdf0e10cSrcweir // SfxItemSet aSet(GetPool(), 1429cdf0e10cSrcweir // RES_PARATR_NUMRULE, RES_PARATR_NUMRULE); 1430cdf0e10cSrcweir // rShell.GetCurAttr(aSet); 1431cdf0e10cSrcweir // /* const SfxPoolItem* pItem; */ 1432cdf0e10cSrcweir // if(SFX_ITEM_AVAILABLE <= 1433cdf0e10cSrcweir // aSet.GetItemState(RES_PARATR_NUMRULE, sal_True 1434cdf0e10cSrcweir // /*, &pItem */ )) 1435cdf0e10cSrcweir // { 1436cdf0e10cSrcweir // const String& rNumStyle = 1437cdf0e10cSrcweir // ((const SfxStringItem &) 1438cdf0e10cSrcweir // aSet.Get(RES_PARATR_NUMRULE)).GetValue(); 1439cdf0e10cSrcweir // /* #i5116# GetItemState does not necessarily 1440cdf0e10cSrcweir // change pItem */ 1441cdf0e10cSrcweir // // ((const SfxStringItem*)pItem)->GetValue(); 1442cdf0e10cSrcweir // if(rNumStyle.Len()) 1443cdf0e10cSrcweir // { 1444cdf0e10cSrcweir // sStr.AppendAscii(sStatusDelim); 1445cdf0e10cSrcweir // sStr += rNumStyle; 1446cdf0e10cSrcweir // } 1447cdf0e10cSrcweir // } 1448cdf0e10cSrcweir // } 1449cdf0e10cSrcweir // } 1450cdf0e10cSrcweir //}//<-removed end ,zhaojianwei 1451cdf0e10cSrcweir 1452cdf0e10cSrcweir //-->#outline level,added by zhaojianwei 1453cdf0e10cSrcweir const SwNumRule* pNumRule = rShell.GetCurNumRule(); 1454cdf0e10cSrcweir const bool bOutlineNum = pNumRule ? pNumRule->IsOutlineRule() : 0; 1455cdf0e10cSrcweir //((SwTxtFmtColl*)rShell.GetCrsr()->GetNode()->GetTxtNode()->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle(); 1456cdf0e10cSrcweir 1457cdf0e10cSrcweir if (pNumRule && !bOutlineNum ) // Cursor in Numerierung 1458cdf0e10cSrcweir { 1459cdf0e10cSrcweir sal_uInt8 nNumLevel = rShell.GetNumLevel(); 1460cdf0e10cSrcweir // --> OD 2008-04-02 #refactorlists# 1461cdf0e10cSrcweir // if( IsShowNum(nNumLevel) && MAXLEVEL > 1462cdf0e10cSrcweir // ( nNumLevel = GetRealLevel( nNumLevel )) ) 1463cdf0e10cSrcweir if ( nNumLevel < MAXLEVEL ) 1464cdf0e10cSrcweir // <-- 1465cdf0e10cSrcweir { 1466cdf0e10cSrcweir if(!pNumRule->IsAutoRule()) 1467cdf0e10cSrcweir { 1468cdf0e10cSrcweir SfxItemSet aSet(GetPool(), 1469cdf0e10cSrcweir RES_PARATR_NUMRULE, RES_PARATR_NUMRULE); 1470cdf0e10cSrcweir rShell.GetCurAttr(aSet); 1471cdf0e10cSrcweir /* const SfxPoolItem* pItem; */ 1472cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= 1473cdf0e10cSrcweir aSet.GetItemState(RES_PARATR_NUMRULE, sal_True 1474cdf0e10cSrcweir /*, &pItem */ )) 1475cdf0e10cSrcweir { 1476cdf0e10cSrcweir const String& rNumStyle = 1477cdf0e10cSrcweir ((const SfxStringItem &) 1478cdf0e10cSrcweir aSet.Get(RES_PARATR_NUMRULE)).GetValue(); 1479cdf0e10cSrcweir /* #i5116# GetItemState does not necessarily 1480cdf0e10cSrcweir change pItem */ 1481cdf0e10cSrcweir // ((const SfxStringItem*)pItem)->GetValue(); 1482cdf0e10cSrcweir if(rNumStyle.Len()) 1483cdf0e10cSrcweir { 1484cdf0e10cSrcweir if( sStr.Len() ) 1485cdf0e10cSrcweir sStr.AppendAscii(sStatusDelim); 1486cdf0e10cSrcweir sStr += rNumStyle; 1487cdf0e10cSrcweir } 1488cdf0e10cSrcweir } 1489cdf0e10cSrcweir } 1490cdf0e10cSrcweir if( sStr.Len() ) 1491cdf0e10cSrcweir sStr.AppendAscii(sStatusDelim); 1492cdf0e10cSrcweir sStr += SW_RESSTR(STR_NUM_LEVEL); 1493cdf0e10cSrcweir sStr += String::CreateFromInt32( nNumLevel + 1 ); 1494cdf0e10cSrcweir 1495cdf0e10cSrcweir } 1496cdf0e10cSrcweir } 1497cdf0e10cSrcweir const int nOutlineLevel = rShell.GetCurrentParaOutlineLevel(); 1498cdf0e10cSrcweir if( nOutlineLevel != 0 ) 1499cdf0e10cSrcweir { 1500cdf0e10cSrcweir if( sStr.Len() ) 1501cdf0e10cSrcweir sStr.AppendAscii(sStatusComma); 1502cdf0e10cSrcweir if( bOutlineNum ) 1503cdf0e10cSrcweir { 1504cdf0e10cSrcweir sStr += SW_RESSTR(STR_OUTLINE_NUMBERING); 1505cdf0e10cSrcweir sStr.AppendAscii(sStatusDelim); 1506cdf0e10cSrcweir sStr += SW_RESSTR(STR_NUM_LEVEL); 1507cdf0e10cSrcweir } 1508cdf0e10cSrcweir else 1509cdf0e10cSrcweir sStr += SW_RESSTR(STR_NUM_OUTLINE); 1510cdf0e10cSrcweir sStr += String::CreateFromInt32( nOutlineLevel); 1511cdf0e10cSrcweir } 1512cdf0e10cSrcweir //<-end ,zhaojianwei 1513cdf0e10cSrcweir 1514cdf0e10cSrcweir if( rShell.HasReadonlySel() ) 1515cdf0e10cSrcweir { 1516cdf0e10cSrcweir if( sStr.Len() ) 1517cdf0e10cSrcweir sStr.InsertAscii( sStatusDelim, 0 ); 1518cdf0e10cSrcweir sStr.Insert( SW_RESSTR( STR_READONLY_SEL ), 0 ); 1519cdf0e10cSrcweir } 1520cdf0e10cSrcweir if( sStr.Len() ) 1521cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_TABLE_CELL, sStr )); 1522cdf0e10cSrcweir } 1523cdf0e10cSrcweir break; 1524cdf0e10cSrcweir case FN_STAT_SELMODE: 1525cdf0e10cSrcweir { 1526cdf0e10cSrcweir if(rShell.IsStdMode()) 1527cdf0e10cSrcweir rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0)); 1528cdf0e10cSrcweir else if(rShell.IsAddMode()) 1529cdf0e10cSrcweir rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 2)); 1530cdf0e10cSrcweir else if(rShell.IsBlockMode()) 1531cdf0e10cSrcweir rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 3)); 1532cdf0e10cSrcweir else 1533cdf0e10cSrcweir rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 1)); 1534cdf0e10cSrcweir break; 1535cdf0e10cSrcweir } 1536cdf0e10cSrcweir case SID_ATTR_INSERT: 1537cdf0e10cSrcweir if( rShell.IsRedlineOn() ) 1538cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1539cdf0e10cSrcweir else 1540cdf0e10cSrcweir { 1541cdf0e10cSrcweir rSet.Put(SfxBoolItem(SID_ATTR_INSERT,rShell.IsInsMode())); 1542cdf0e10cSrcweir } 1543cdf0e10cSrcweir break; 1544cdf0e10cSrcweir } 1545cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1546cdf0e10cSrcweir } 1547cdf0e10cSrcweir } 1548cdf0e10cSrcweir 1549cdf0e10cSrcweir /*-------------------------------------------------------------------- 1550cdf0e10cSrcweir Beschreibung: Execute fuer die Stauszeile 1551cdf0e10cSrcweir --------------------------------------------------------------------*/ 1552cdf0e10cSrcweir 1553cdf0e10cSrcweir 1554cdf0e10cSrcweir void SwView::ExecuteStatusLine(SfxRequest &rReq) 1555cdf0e10cSrcweir { 1556cdf0e10cSrcweir SwWrtShell &rSh = GetWrtShell(); 1557cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 1558cdf0e10cSrcweir const SfxPoolItem* pItem=NULL; 1559cdf0e10cSrcweir sal_Bool bUp = sal_False; 1560cdf0e10cSrcweir sal_uInt16 nWhich = rReq.GetSlot(); 1561cdf0e10cSrcweir switch( nWhich ) 1562cdf0e10cSrcweir { 1563cdf0e10cSrcweir case FN_STAT_PAGE: 1564cdf0e10cSrcweir { 1565cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR, 1566cdf0e10cSrcweir SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD ); 1567cdf0e10cSrcweir } 1568cdf0e10cSrcweir break; 1569cdf0e10cSrcweir 1570cdf0e10cSrcweir case FN_STAT_BOOKMARK: 1571cdf0e10cSrcweir if ( pArgs ) 1572cdf0e10cSrcweir { 1573cdf0e10cSrcweir if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_True, &pItem)) 1574cdf0e10cSrcweir { 1575cdf0e10cSrcweir const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess(); 1576cdf0e10cSrcweir const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); 1577cdf0e10cSrcweir if(nIdx < pMarkAccess->getBookmarksCount()) 1578cdf0e10cSrcweir { 1579cdf0e10cSrcweir const IDocumentMarkAccess::const_iterator_t ppBookmark = rSh.getIDocumentMarkAccess()->getBookmarksBegin() + nIdx; 1580cdf0e10cSrcweir rSh.EnterStdMode(); 1581cdf0e10cSrcweir rSh.GotoMark( ppBookmark->get() ); 1582cdf0e10cSrcweir } 1583cdf0e10cSrcweir else 1584cdf0e10cSrcweir OSL_ENSURE(false, 1585cdf0e10cSrcweir "SwView::ExecuteStatusLine(..)" 1586cdf0e10cSrcweir " - Ignoring out of range bookmark index"); 1587cdf0e10cSrcweir } 1588cdf0e10cSrcweir } 1589cdf0e10cSrcweir break; 1590cdf0e10cSrcweir 1591cdf0e10cSrcweir case FN_STAT_TEMPLATE: 1592cdf0e10cSrcweir { 1593cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_DLG, 1594cdf0e10cSrcweir SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD ); 1595cdf0e10cSrcweir } 1596cdf0e10cSrcweir break; 1597cdf0e10cSrcweir case SID_ATTR_ZOOM: 1598cdf0e10cSrcweir { 1599cdf0e10cSrcweir if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) 1600cdf0e10cSrcweir { 1601cdf0e10cSrcweir const SfxItemSet *pSet = 0; 1602cdf0e10cSrcweir AbstractSvxZoomDialog *pDlg = 0; 1603cdf0e10cSrcweir if ( pArgs ) 1604cdf0e10cSrcweir pSet = pArgs; 1605cdf0e10cSrcweir else 1606cdf0e10cSrcweir { 1607cdf0e10cSrcweir const SwViewOption& rViewOptions = *rSh.GetViewOptions(); 1608cdf0e10cSrcweir SfxItemSet aCoreSet(pShell->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT, 0 ); 1609cdf0e10cSrcweir SvxZoomItem aZoom( (SvxZoomType)rViewOptions.GetZoomType(), rViewOptions.GetZoom() ); 1610cdf0e10cSrcweir 1611cdf0e10cSrcweir const bool bBrowseMode = rSh.GetViewOptions()->getBrowseMode(); 1612cdf0e10cSrcweir if( bBrowseMode ) 1613cdf0e10cSrcweir { 1614cdf0e10cSrcweir aZoom.SetValueSet( 1615cdf0e10cSrcweir SVX_ZOOM_ENABLE_50| 1616cdf0e10cSrcweir SVX_ZOOM_ENABLE_75| 1617cdf0e10cSrcweir SVX_ZOOM_ENABLE_100| 1618cdf0e10cSrcweir SVX_ZOOM_ENABLE_150| 1619cdf0e10cSrcweir SVX_ZOOM_ENABLE_200); 1620cdf0e10cSrcweir } 1621cdf0e10cSrcweir aCoreSet.Put( aZoom ); 1622cdf0e10cSrcweir 1623cdf0e10cSrcweir // PAGES01 1624cdf0e10cSrcweir if ( !bBrowseMode ) 1625cdf0e10cSrcweir { 1626cdf0e10cSrcweir const SvxViewLayoutItem aViewLayout( rViewOptions.GetViewLayoutColumns(), rViewOptions.IsViewLayoutBookMode() ); 1627cdf0e10cSrcweir aCoreSet.Put( aViewLayout ); 1628cdf0e10cSrcweir } 1629cdf0e10cSrcweir 1630cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1631cdf0e10cSrcweir if(pFact) 1632cdf0e10cSrcweir { 1633cdf0e10cSrcweir pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet); 1634cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 1635cdf0e10cSrcweir } 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir pDlg->SetLimits( MINZOOM, MAXZOOM ); 1638cdf0e10cSrcweir 1639cdf0e10cSrcweir if( pDlg->Execute() != RET_CANCEL ) 1640cdf0e10cSrcweir pSet = pDlg->GetOutputItemSet(); 1641cdf0e10cSrcweir } 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir // PAGES01 1644cdf0e10cSrcweir const SfxPoolItem* pViewLayoutItem = 0; 1645cdf0e10cSrcweir if ( pSet && SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_VIEWLAYOUT, sal_True, &pViewLayoutItem)) 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir const sal_uInt16 nColumns = ((const SvxViewLayoutItem *)pViewLayoutItem)->GetValue(); 1648cdf0e10cSrcweir const bool bBookMode = ((const SvxViewLayoutItem *)pViewLayoutItem)->IsBookMode(); 1649cdf0e10cSrcweir SetViewLayout( nColumns, bBookMode ); 1650cdf0e10cSrcweir } 1651cdf0e10cSrcweir 1652cdf0e10cSrcweir if ( pSet && SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_ZOOM, sal_True, &pItem)) 1653cdf0e10cSrcweir { 1654cdf0e10cSrcweir enum SvxZoomType eType = ((const SvxZoomItem *)pItem)->GetType(); 1655cdf0e10cSrcweir SetZoom( eType, ((const SvxZoomItem *)pItem)->GetValue() ); 1656cdf0e10cSrcweir } 1657cdf0e10cSrcweir bUp = sal_True; 1658cdf0e10cSrcweir if ( pItem ) 1659cdf0e10cSrcweir rReq.AppendItem( *pItem ); 1660cdf0e10cSrcweir rReq.Done(); 1661cdf0e10cSrcweir 1662cdf0e10cSrcweir delete pDlg; 1663cdf0e10cSrcweir } 1664cdf0e10cSrcweir } 1665cdf0e10cSrcweir break; 1666cdf0e10cSrcweir 1667cdf0e10cSrcweir case SID_ATTR_VIEWLAYOUT: 1668cdf0e10cSrcweir { 1669cdf0e10cSrcweir if ( pArgs && !rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && 1670cdf0e10cSrcweir ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) 1671cdf0e10cSrcweir { 1672cdf0e10cSrcweir // PAGES01 1673cdf0e10cSrcweir if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, sal_True, &pItem )) 1674cdf0e10cSrcweir { 1675cdf0e10cSrcweir const sal_uInt16 nColumns = ((const SvxViewLayoutItem *)pItem)->GetValue(); 1676cdf0e10cSrcweir const bool bBookMode = (0 == nColumns || 0 != (nColumns % 2)) ? 1677cdf0e10cSrcweir false : 1678cdf0e10cSrcweir ((const SvxViewLayoutItem *)pItem)->IsBookMode(); 1679cdf0e10cSrcweir 1680cdf0e10cSrcweir SetViewLayout( nColumns, bBookMode ); 1681cdf0e10cSrcweir } 1682cdf0e10cSrcweir 1683cdf0e10cSrcweir bUp = sal_True; 1684cdf0e10cSrcweir rReq.Done(); 1685cdf0e10cSrcweir 1686cdf0e10cSrcweir InvalidateRulerPos(); 1687cdf0e10cSrcweir } 1688cdf0e10cSrcweir } 1689cdf0e10cSrcweir break; 1690cdf0e10cSrcweir 1691cdf0e10cSrcweir case SID_ATTR_ZOOMSLIDER: 1692cdf0e10cSrcweir { 1693cdf0e10cSrcweir if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir // PAGES01 1696cdf0e10cSrcweir if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, sal_True, &pItem )) 1697cdf0e10cSrcweir { 1698cdf0e10cSrcweir const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue(); 1699cdf0e10cSrcweir SetZoom( SVX_ZOOM_PERCENT, nCurrentZoom ); 1700cdf0e10cSrcweir } 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir bUp = sal_True; 1703cdf0e10cSrcweir rReq.Done(); 1704cdf0e10cSrcweir } 1705cdf0e10cSrcweir } 1706cdf0e10cSrcweir break; 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir case SID_ATTR_SIZE: 1709cdf0e10cSrcweir { 1710cdf0e10cSrcweir sal_uLong nId = FN_INSERT_FIELD; 1711cdf0e10cSrcweir if( rSh.IsCrsrInTbl() ) 1712cdf0e10cSrcweir nId = FN_FORMAT_TABLE_DLG; 1713cdf0e10cSrcweir else if( rSh.GetCurTOX() ) 1714cdf0e10cSrcweir nId = FN_INSERT_MULTI_TOX; 1715cdf0e10cSrcweir else if( rSh.GetCurrSection() ) 1716cdf0e10cSrcweir nId = FN_EDIT_REGION; 1717cdf0e10cSrcweir else 1718cdf0e10cSrcweir { 1719cdf0e10cSrcweir const SwNumRule* pNumRule = rSh.GetCurNumRule(); 1720cdf0e10cSrcweir if( pNumRule ) // Cursor in Numerierung 1721cdf0e10cSrcweir { 1722cdf0e10cSrcweir if( pNumRule->IsAutoRule() ) 1723cdf0e10cSrcweir nId = FN_NUMBER_BULLETS; 1724cdf0e10cSrcweir else 1725cdf0e10cSrcweir { 1726cdf0e10cSrcweir // Dialog vom Gestalter starten ;-) 1727cdf0e10cSrcweir nId = 0; 1728cdf0e10cSrcweir } 1729cdf0e10cSrcweir } 1730cdf0e10cSrcweir else if( rSh.IsFrmSelected() ) 1731cdf0e10cSrcweir nId = FN_FORMAT_FRAME_DLG; 1732cdf0e10cSrcweir else if( rSh.IsObjSelected() ) 1733cdf0e10cSrcweir nId = SID_ATTR_TRANSFORM; 1734cdf0e10cSrcweir } 1735cdf0e10cSrcweir if( nId ) 1736cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 1737cdf0e10cSrcweir static_cast< sal_uInt16 >( nId ), SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD ); 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir break; 1740cdf0e10cSrcweir 1741cdf0e10cSrcweir case FN_STAT_SELMODE: 1742cdf0e10cSrcweir { 1743cdf0e10cSrcweir if ( pArgs ) 1744cdf0e10cSrcweir { 1745cdf0e10cSrcweir if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_True, &pItem)) 1746cdf0e10cSrcweir { 1747cdf0e10cSrcweir switch ( ((const SfxUInt16Item *)pItem)->GetValue() ) 1748cdf0e10cSrcweir { 1749cdf0e10cSrcweir case 0: rSh.EnterStdMode(); break; 1750cdf0e10cSrcweir case 1: rSh.EnterExtMode(); break; 1751cdf0e10cSrcweir case 2: rSh.EnterAddMode(); break; 1752cdf0e10cSrcweir case 3: rSh.EnterBlockMode(); break; 1753cdf0e10cSrcweir } 1754cdf0e10cSrcweir } 1755cdf0e10cSrcweir } 1756cdf0e10cSrcweir else 1757cdf0e10cSrcweir { 1758cdf0e10cSrcweir 1759cdf0e10cSrcweir if( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() ) 1760cdf0e10cSrcweir rSh.ToggleExtMode(); 1761cdf0e10cSrcweir else if ( rSh.IsExtMode() ) 1762cdf0e10cSrcweir { 1763cdf0e10cSrcweir rSh.ToggleExtMode(); 1764cdf0e10cSrcweir rSh.ToggleAddMode(); 1765cdf0e10cSrcweir } 1766cdf0e10cSrcweir else if ( rSh.IsAddMode() ) 1767cdf0e10cSrcweir { 1768cdf0e10cSrcweir rSh.ToggleAddMode(); 1769cdf0e10cSrcweir rSh.ToggleBlockMode(); 1770cdf0e10cSrcweir } 1771cdf0e10cSrcweir else 1772cdf0e10cSrcweir rSh.ToggleBlockMode(); 1773cdf0e10cSrcweir } 1774cdf0e10cSrcweir bUp = sal_True; 1775cdf0e10cSrcweir break; 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir case FN_SET_ADD_MODE: 1778cdf0e10cSrcweir rSh.ToggleAddMode(); 1779cdf0e10cSrcweir nWhich = FN_STAT_SELMODE; 1780cdf0e10cSrcweir bUp = sal_True; 1781cdf0e10cSrcweir break; 1782cdf0e10cSrcweir case FN_SET_BLOCK_MODE: 1783cdf0e10cSrcweir rSh.ToggleBlockMode(); 1784cdf0e10cSrcweir nWhich = FN_STAT_SELMODE; 1785cdf0e10cSrcweir bUp = sal_True; 1786cdf0e10cSrcweir break; 1787cdf0e10cSrcweir case FN_SET_EXT_MODE: 1788cdf0e10cSrcweir rSh.ToggleExtMode(); 1789cdf0e10cSrcweir nWhich = FN_STAT_SELMODE; 1790cdf0e10cSrcweir bUp = sal_True; 1791cdf0e10cSrcweir break; 1792cdf0e10cSrcweir case SID_ATTR_INSERT: 1793cdf0e10cSrcweir SwPostItMgr* pMgr = GetPostItMgr(); 1794cdf0e10cSrcweir if ( pMgr && pMgr->HasActiveSidebarWin() ) 1795cdf0e10cSrcweir { 1796cdf0e10cSrcweir pMgr->ToggleInsModeOnActiveSidebarWin(); 1797cdf0e10cSrcweir } 1798cdf0e10cSrcweir else 1799cdf0e10cSrcweir rSh.ToggleInsMode(); 1800cdf0e10cSrcweir bUp = sal_True; 1801cdf0e10cSrcweir break; 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir } 1804cdf0e10cSrcweir if ( bUp ) 1805cdf0e10cSrcweir { 1806cdf0e10cSrcweir SfxBindings &rBnd = GetViewFrame()->GetBindings(); 1807cdf0e10cSrcweir rBnd.Invalidate(nWhich); 1808cdf0e10cSrcweir rBnd.Update(nWhich); 1809cdf0e10cSrcweir } 1810cdf0e10cSrcweir } 1811cdf0e10cSrcweir 1812cdf0e10cSrcweir void SwView::InsFrmMode(sal_uInt16 nCols) 1813cdf0e10cSrcweir { 1814cdf0e10cSrcweir if ( pWrtShell->HasWholeTabSelection() ) 1815cdf0e10cSrcweir { 1816cdf0e10cSrcweir SwFlyFrmAttrMgr aMgr( sal_True, pWrtShell, FRMMGR_TYPE_TEXT ); 1817cdf0e10cSrcweir 1818cdf0e10cSrcweir const SwFrmFmt &rPageFmt = 1819cdf0e10cSrcweir pWrtShell->GetPageDesc(pWrtShell->GetCurPageDesc()).GetMaster(); 1820cdf0e10cSrcweir SwTwips lWidth = rPageFmt.GetFrmSize().GetWidth(); 1821cdf0e10cSrcweir const SvxLRSpaceItem &rLR = rPageFmt.GetLRSpace(); 1822cdf0e10cSrcweir lWidth -= rLR.GetLeft() + rLR.GetRight(); 1823cdf0e10cSrcweir aMgr.SetSize(Size(lWidth, aMgr.GetSize().Height())); 1824cdf0e10cSrcweir if(nCols > 1) 1825cdf0e10cSrcweir { 1826cdf0e10cSrcweir SwFmtCol aCol; 1827cdf0e10cSrcweir aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() ); 1828cdf0e10cSrcweir aMgr.SetCol( aCol ); 1829cdf0e10cSrcweir } 1830cdf0e10cSrcweir aMgr.InsertFlyFrm(); 1831cdf0e10cSrcweir } 1832cdf0e10cSrcweir else 1833cdf0e10cSrcweir GetEditWin().InsFrm(nCols); 1834cdf0e10cSrcweir } 1835cdf0e10cSrcweir 1836cdf0e10cSrcweir /*-------------------------------------------------------------------- 1837cdf0e10cSrcweir Beschreibung: Links bearbeiten 1838cdf0e10cSrcweir --------------------------------------------------------------------*/ 1839cdf0e10cSrcweir 1840cdf0e10cSrcweir void SwView::EditLinkDlg() 1841cdf0e10cSrcweir { 1842cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this); 1843cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1844cdf0e10cSrcweir SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( &GetViewFrame()->GetWindow(), &GetWrtShell().GetLinkManager(), bWeb ); 1845cdf0e10cSrcweir if ( pDlg ) 1846cdf0e10cSrcweir { 1847cdf0e10cSrcweir pDlg->Execute(); 1848cdf0e10cSrcweir delete pDlg; 1849cdf0e10cSrcweir } 1850cdf0e10cSrcweir /* 1851cdf0e10cSrcweir SwLinkDlg* pDlg = new SwLinkDlg(GetFrameWindow()); 1852cdf0e10cSrcweir pDlg->SetShell(&GetWrtShell()); 1853cdf0e10cSrcweir pDlg->Execute(); 1854cdf0e10cSrcweir 1855cdf0e10cSrcweir DELETEZ(pDlg); 1856cdf0e10cSrcweir */ 1857cdf0e10cSrcweir } 1858cdf0e10cSrcweir 1859cdf0e10cSrcweir sal_Bool SwView::JumpToSwMark( const String& rMark ) 1860cdf0e10cSrcweir { 1861cdf0e10cSrcweir sal_Bool bRet = sal_False; 1862cdf0e10cSrcweir if( rMark.Len() ) 1863cdf0e10cSrcweir { 1864cdf0e10cSrcweir // wir wollen den Bookmark aber am oberen Rand haben 1865cdf0e10cSrcweir sal_Bool bSaveCC = IsCrsrAtCenter(); 1866cdf0e10cSrcweir sal_Bool bSaveCT = IsCrsrAtTop(); 1867cdf0e10cSrcweir SetCrsrAtTop( sal_True ); 1868cdf0e10cSrcweir 1869cdf0e10cSrcweir //JP 27.04.98: Bug 49786 1870cdf0e10cSrcweir // Damit in FrameSet auch gescrollt werden kann, muss die 1871cdf0e10cSrcweir // entsprechende Shell auch das Focus-Flag gesetzt haben! 1872cdf0e10cSrcweir sal_Bool bHasShFocus = pWrtShell->HasShFcs(); 1873cdf0e10cSrcweir if( !bHasShFocus ) 1874cdf0e10cSrcweir pWrtShell->ShGetFcs( sal_False ); 1875cdf0e10cSrcweir 1876cdf0e10cSrcweir const SwFmtINetFmt* pINet; 1877cdf0e10cSrcweir String sCmp, sMark( INetURLObject::decode( rMark, INET_HEX_ESCAPE, 1878cdf0e10cSrcweir INetURLObject::DECODE_WITH_CHARSET, 1879cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 )); 1880cdf0e10cSrcweir 1881cdf0e10cSrcweir xub_StrLen nLastPos, nPos = sMark.Search( cMarkSeperator ); 1882cdf0e10cSrcweir if( STRING_NOTFOUND != nPos ) 1883cdf0e10cSrcweir while( STRING_NOTFOUND != ( nLastPos = 1884cdf0e10cSrcweir sMark.Search( cMarkSeperator, nPos + 1 )) ) 1885cdf0e10cSrcweir nPos = nLastPos; 1886cdf0e10cSrcweir 1887cdf0e10cSrcweir IDocumentMarkAccess::const_iterator_t ppMark; 1888cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); 1889cdf0e10cSrcweir if( STRING_NOTFOUND != nPos && 1890cdf0e10cSrcweir ( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() ) 1891cdf0e10cSrcweir { 1892cdf0e10cSrcweir String sName( sMark.Copy( 0, nPos ) ); 1893cdf0e10cSrcweir sCmp.ToLowerAscii(); 1894cdf0e10cSrcweir FlyCntType eFlyType = FLYCNTTYPE_ALL; 1895cdf0e10cSrcweir 1896cdf0e10cSrcweir if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToRegion ) ) 1897cdf0e10cSrcweir { 1898cdf0e10cSrcweir pWrtShell->EnterStdMode(); 1899cdf0e10cSrcweir bRet = pWrtShell->GotoRegion( sName ); 1900cdf0e10cSrcweir } 1901cdf0e10cSrcweir else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOutline ) ) 1902cdf0e10cSrcweir { 1903cdf0e10cSrcweir pWrtShell->EnterStdMode(); 1904cdf0e10cSrcweir bRet = pWrtShell->GotoOutline( sName ); 1905cdf0e10cSrcweir } 1906cdf0e10cSrcweir else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToFrame ) ) 1907cdf0e10cSrcweir eFlyType = FLYCNTTYPE_FRM; 1908cdf0e10cSrcweir else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToGraphic ) ) 1909cdf0e10cSrcweir eFlyType = FLYCNTTYPE_GRF; 1910cdf0e10cSrcweir else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOLE ) ) 1911cdf0e10cSrcweir eFlyType = FLYCNTTYPE_OLE; 1912cdf0e10cSrcweir else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToTable ) ) 1913cdf0e10cSrcweir { 1914cdf0e10cSrcweir pWrtShell->EnterStdMode(); 1915cdf0e10cSrcweir bRet = pWrtShell->GotoTable( sName ); 1916cdf0e10cSrcweir } 1917cdf0e10cSrcweir else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToText ) ) 1918cdf0e10cSrcweir { 1919cdf0e10cSrcweir // Normale Textsuche 1920cdf0e10cSrcweir pWrtShell->EnterStdMode(); 1921cdf0e10cSrcweir 1922cdf0e10cSrcweir SearchOptions aSearchOpt( 1923cdf0e10cSrcweir SearchAlgorithms_ABSOLUTE, 0, 1924cdf0e10cSrcweir sName, rtl::OUString(), 1925cdf0e10cSrcweir SvxCreateLocale( LANGUAGE_SYSTEM ), 1926cdf0e10cSrcweir 0,0,0, 1927cdf0e10cSrcweir TransliterationModules_IGNORE_CASE ); 1928cdf0e10cSrcweir 1929cdf0e10cSrcweir //todo/mba: assuming that notes shouldn't be searched 1930cdf0e10cSrcweir sal_Bool bSearchInNotes = sal_False; 1931cdf0e10cSrcweir if( pWrtShell->SearchPattern( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END )) 1932cdf0e10cSrcweir { 1933cdf0e10cSrcweir pWrtShell->EnterStdMode(); // Selektion wieder aufheben 1934cdf0e10cSrcweir bRet = sal_True; 1935cdf0e10cSrcweir } 1936cdf0e10cSrcweir } 1937*dec99bbdSOliver-Rainer Wittmann else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) ) 1938cdf0e10cSrcweir pWrtShell->GotoMark( ppMark->get(), sal_False, sal_True ), bRet = sal_True; 1939cdf0e10cSrcweir else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) )) 1940cdf0e10cSrcweir bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() ); 1941cdf0e10cSrcweir 1942cdf0e10cSrcweir // fuer alle Arten von Flys 1943cdf0e10cSrcweir if( FLYCNTTYPE_ALL != eFlyType && pWrtShell->GotoFly( sName, eFlyType )) 1944cdf0e10cSrcweir { 1945cdf0e10cSrcweir bRet = sal_True; 1946cdf0e10cSrcweir if( FLYCNTTYPE_FRM == eFlyType ) 1947cdf0e10cSrcweir { 1948cdf0e10cSrcweir // TextFrames: Cursor in den Frame setzen 1949cdf0e10cSrcweir pWrtShell->UnSelectFrm(); 1950cdf0e10cSrcweir pWrtShell->LeaveSelFrmMode(); 1951cdf0e10cSrcweir } 1952cdf0e10cSrcweir else 1953cdf0e10cSrcweir { 1954cdf0e10cSrcweir pWrtShell->HideCrsr(); 1955cdf0e10cSrcweir pWrtShell->EnterSelFrmMode(); 1956cdf0e10cSrcweir } 1957cdf0e10cSrcweir } 1958cdf0e10cSrcweir } 1959*dec99bbdSOliver-Rainer Wittmann else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark))) 1960cdf0e10cSrcweir pWrtShell->GotoMark( ppMark->get(), sal_False, sal_True ), bRet = sal_True; 1961cdf0e10cSrcweir else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) )) 1962cdf0e10cSrcweir bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() ); 1963cdf0e10cSrcweir 1964cdf0e10cSrcweir // #b6330459# make selection visible later 1965cdf0e10cSrcweir if ( aVisArea.IsEmpty() ) 1966cdf0e10cSrcweir bMakeSelectionVisible = sal_True; 1967cdf0e10cSrcweir 1968cdf0e10cSrcweir // ViewStatus wieder zurueck setzen 1969cdf0e10cSrcweir SetCrsrAtTop( bSaveCT, bSaveCC ); 1970cdf0e10cSrcweir 1971cdf0e10cSrcweir if( !bHasShFocus ) 1972cdf0e10cSrcweir pWrtShell->ShLooseFcs(); 1973cdf0e10cSrcweir } 1974cdf0e10cSrcweir return bRet; 1975cdf0e10cSrcweir } 1976cdf0e10cSrcweir 1977cdf0e10cSrcweir // #i67305, #1367991: Undo after insert from file: 1978cdf0e10cSrcweir // Undo "Insert form file" crashes with documents imported from binary filter (.sdw) => disabled 1979cdf0e10cSrcweir // Undo "Insert form file" crashes with (.odt) documents crashes if these documents contains 1980cdf0e10cSrcweir // page styles with active header/footer => disabled for those documents 1981cdf0e10cSrcweir 1982cdf0e10cSrcweir sal_uInt16 lcl_PageDescWithHeader( const SwDoc& rDoc ) 1983cdf0e10cSrcweir { 1984cdf0e10cSrcweir sal_uInt16 nRet = 0; 1985cdf0e10cSrcweir sal_uInt16 nCnt = rDoc.GetPageDescCnt(); 1986cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCnt; ++i ) 1987cdf0e10cSrcweir { 1988cdf0e10cSrcweir const SwPageDesc& rPageDesc = rDoc.GetPageDesc( i ); 1989cdf0e10cSrcweir const SwFrmFmt& rMaster = rPageDesc.GetMaster(); 1990cdf0e10cSrcweir const SfxPoolItem* pItem; 1991cdf0e10cSrcweir if( ( SFX_ITEM_SET == rMaster.GetAttrSet().GetItemState( RES_HEADER, sal_False, &pItem ) && 1992cdf0e10cSrcweir ((SwFmtHeader*)pItem)->IsActive() ) || 1993cdf0e10cSrcweir ( SFX_ITEM_SET == rMaster.GetAttrSet().GetItemState( RES_FOOTER, sal_False, &pItem ) && 1994cdf0e10cSrcweir ((SwFmtFooter*)pItem)->IsActive()) ) 1995cdf0e10cSrcweir ++nRet; 1996cdf0e10cSrcweir } 1997cdf0e10cSrcweir return nRet; // number of page styles with active header/footer 1998cdf0e10cSrcweir } 1999cdf0e10cSrcweir 2000cdf0e10cSrcweir /*-------------------------------------------------------------------- 2001cdf0e10cSrcweir Beschreibung: Links bearbeiten 2002cdf0e10cSrcweir --------------------------------------------------------------------*/ 2003cdf0e10cSrcweir 2004cdf0e10cSrcweir void SwView::ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem ) 2005cdf0e10cSrcweir { 2006cdf0e10cSrcweir pViewImpl->InitRequest( rRequest ); 2007cdf0e10cSrcweir pViewImpl->SetParam( pItem ? 1 : 0 ); 2008cdf0e10cSrcweir sal_uInt16 nSlot = rRequest.GetSlot(); 2009cdf0e10cSrcweir 2010cdf0e10cSrcweir if ( !pItem ) 2011cdf0e10cSrcweir { 2012cdf0e10cSrcweir String sEmpty; 2013cdf0e10cSrcweir InsertDoc( nSlot, sEmpty, sEmpty ); 2014cdf0e10cSrcweir } 2015cdf0e10cSrcweir else 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir String sFile, sFilter; 2018cdf0e10cSrcweir sFile = ( (const SfxStringItem *)pItem )->GetValue(); 2019cdf0e10cSrcweir if ( SFX_ITEM_SET == rRequest.GetArgs()->GetItemState( FN_PARAM_1, sal_True, &pItem ) ) 2020cdf0e10cSrcweir sFilter = ( (const SfxStringItem *)pItem )->GetValue(); 2021cdf0e10cSrcweir 2022cdf0e10cSrcweir bool bHasFileName = ( sFile.Len() > 0 ); 2023cdf0e10cSrcweir long nFound = InsertDoc( nSlot, sFile, sFilter ); 2024cdf0e10cSrcweir 2025cdf0e10cSrcweir if ( bHasFileName ) 2026cdf0e10cSrcweir { 2027cdf0e10cSrcweir rRequest.SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) ); 2028cdf0e10cSrcweir rRequest.Done(); 2029cdf0e10cSrcweir } 2030cdf0e10cSrcweir } 2031cdf0e10cSrcweir } 2032cdf0e10cSrcweir 2033cdf0e10cSrcweir long SwView::InsertDoc( sal_uInt16 nSlotId, const String& rFileName, const String& rFilterName, sal_Int16 nVersion ) 2034cdf0e10cSrcweir { 2035cdf0e10cSrcweir SfxMedium* pMed = 0; 2036cdf0e10cSrcweir SwDocShell* pDocSh = GetDocShell(); 2037cdf0e10cSrcweir 2038cdf0e10cSrcweir if( rFileName.Len() ) 2039cdf0e10cSrcweir { 2040cdf0e10cSrcweir SfxObjectFactory& rFact = pDocSh->GetFactory(); 2041cdf0e10cSrcweir const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName ); 2042cdf0e10cSrcweir if ( !pFilter ) 2043cdf0e10cSrcweir { 2044cdf0e10cSrcweir pMed = new SfxMedium(rFileName, STREAM_READ, sal_True, 0, 0 ); 2045cdf0e10cSrcweir SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() ); 2046cdf0e10cSrcweir pMed->UseInteractionHandler( sal_True ); 2047cdf0e10cSrcweir ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, sal_False ); 2048cdf0e10cSrcweir if ( nErr ) 2049cdf0e10cSrcweir DELETEZ(pMed); 2050cdf0e10cSrcweir else 2051cdf0e10cSrcweir pMed->SetFilter( pFilter ); 2052cdf0e10cSrcweir } 2053cdf0e10cSrcweir else 2054cdf0e10cSrcweir pMed = new SfxMedium(rFileName, STREAM_READ, sal_True, pFilter, 0); 2055cdf0e10cSrcweir } 2056cdf0e10cSrcweir else 2057cdf0e10cSrcweir { 2058cdf0e10cSrcweir String sFactory = String::CreateFromAscii( pDocSh->GetFactory().GetShortName() ); 2059cdf0e10cSrcweir pViewImpl->StartDocumentInserter( sFactory, LINK( this, SwView, DialogClosedHdl ) ); 2060cdf0e10cSrcweir return -1; 2061cdf0e10cSrcweir } 2062cdf0e10cSrcweir 2063cdf0e10cSrcweir if( !pMed ) 2064cdf0e10cSrcweir return -1; 2065cdf0e10cSrcweir 2066cdf0e10cSrcweir return InsertMedium( nSlotId, pMed, nVersion ); 2067cdf0e10cSrcweir } 2068cdf0e10cSrcweir 2069cdf0e10cSrcweir long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVersion ) 2070cdf0e10cSrcweir { 2071cdf0e10cSrcweir sal_Bool bInsert = sal_False, bCompare = sal_False, bMerge = sal_False; 2072cdf0e10cSrcweir long nFound = 0; 2073cdf0e10cSrcweir SwDocShell* pDocSh = GetDocShell(); 2074cdf0e10cSrcweir 2075cdf0e10cSrcweir switch( nSlotId ) 2076cdf0e10cSrcweir { 2077cdf0e10cSrcweir case SID_DOCUMENT_MERGE: bMerge = sal_True; break; 2078cdf0e10cSrcweir case SID_DOCUMENT_COMPARE: bCompare = sal_True; break; 2079cdf0e10cSrcweir case SID_INSERTDOC: bInsert = sal_True; break; 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir default: 2082cdf0e10cSrcweir ASSERT( !this, "Unbekannte SlotId!" ); 2083cdf0e10cSrcweir bInsert = sal_True; 2084cdf0e10cSrcweir nSlotId = SID_INSERTDOC; 2085cdf0e10cSrcweir break; 2086cdf0e10cSrcweir } 2087cdf0e10cSrcweir 2088cdf0e10cSrcweir if( bInsert ) 2089cdf0e10cSrcweir { 2090cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 2091cdf0e10cSrcweir GetViewFrame()->GetBindings().GetRecorder(); 2092cdf0e10cSrcweir if ( xRecorder.is() ) 2093cdf0e10cSrcweir { 2094cdf0e10cSrcweir SfxRequest aRequest(GetViewFrame(), SID_INSERTDOC); 2095cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem(SID_INSERTDOC, pMedium->GetOrigURL())); 2096cdf0e10cSrcweir if(pMedium->GetFilter()) 2097cdf0e10cSrcweir aRequest.AppendItem(SfxStringItem(FN_PARAM_1, pMedium->GetFilter()->GetName())); 2098cdf0e10cSrcweir aRequest.Done(); 2099cdf0e10cSrcweir } 2100cdf0e10cSrcweir 2101cdf0e10cSrcweir SfxObjectShellRef aRef( pDocSh ); 2102cdf0e10cSrcweir 2103cdf0e10cSrcweir sal_uInt32 nError = SfxObjectShell::HandleFilter( pMedium, pDocSh ); 2104cdf0e10cSrcweir // #i16722# aborted? 2105cdf0e10cSrcweir if(nError != ERRCODE_NONE) 2106cdf0e10cSrcweir { 2107cdf0e10cSrcweir delete pMedium; 2108cdf0e10cSrcweir return -1; 2109cdf0e10cSrcweir } 2110cdf0e10cSrcweir pDocSh->RegisterTransfer( *pMedium ); 2111cdf0e10cSrcweir pMedium->DownLoad(); // ggfs. den DownLoad anstossen 2112cdf0e10cSrcweir if( aRef.Is() && 1 < aRef->GetRefCount() ) // noch gueltige Ref? 2113cdf0e10cSrcweir { 2114cdf0e10cSrcweir SwReader* pRdr; 2115cdf0e10cSrcweir Reader *pRead = pDocSh->StartConvertFrom( *pMedium, &pRdr, pWrtShell ); 2116cdf0e10cSrcweir if( pRead || 2117cdf0e10cSrcweir (pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER) != 0 ) 2118cdf0e10cSrcweir { 2119cdf0e10cSrcweir sal_uInt16 nUndoCheck = 0; 2120cdf0e10cSrcweir SwDoc *pDoc = pDocSh->GetDoc(); 2121cdf0e10cSrcweir if( pRead && pDocSh->GetDoc() ) 2122cdf0e10cSrcweir nUndoCheck = lcl_PageDescWithHeader( *pDoc ); 2123cdf0e10cSrcweir sal_uLong nErrno; 2124cdf0e10cSrcweir { //Scope for SwWait-Object, to be able to execute slots 2125cdf0e10cSrcweir //outside this scope. 2126cdf0e10cSrcweir SwWait aWait( *GetDocShell(), sal_True ); 2127cdf0e10cSrcweir pWrtShell->StartAllAction(); 2128cdf0e10cSrcweir if ( pWrtShell->HasSelection() ) 2129cdf0e10cSrcweir pWrtShell->DelRight(); // Selektionen loeschen 2130cdf0e10cSrcweir if( pRead ) 2131cdf0e10cSrcweir { 2132cdf0e10cSrcweir nErrno = pRdr->Read( *pRead ); // und Dokument einfuegen 2133cdf0e10cSrcweir delete pRdr; 2134cdf0e10cSrcweir } 2135cdf0e10cSrcweir else 2136cdf0e10cSrcweir { 2137cdf0e10cSrcweir ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); 2138cdf0e10cSrcweir nErrno = pDocSh->InsertFrom( *pMedium ) ? 0 : ERR_SWG_READ_ERROR; 2139cdf0e10cSrcweir } 2140cdf0e10cSrcweir 2141cdf0e10cSrcweir } 2142cdf0e10cSrcweir 2143cdf0e10cSrcweir // ggfs. alle Verzeichnisse updaten: 2144cdf0e10cSrcweir if( pWrtShell->IsUpdateTOX() ) 2145cdf0e10cSrcweir { 2146cdf0e10cSrcweir SfxRequest aReq( FN_UPDATE_TOX, SFX_CALLMODE_SLOT, GetPool() ); 2147cdf0e10cSrcweir Execute( aReq ); 2148cdf0e10cSrcweir pWrtShell->SetUpdateTOX( sal_False ); // wieder zurueck setzen 2149cdf0e10cSrcweir } 2150cdf0e10cSrcweir 2151cdf0e10cSrcweir if( pDoc ) 2152cdf0e10cSrcweir { // Disable Undo for .sdw (136991) or 2153cdf0e10cSrcweir // if the number of page styles with header/footer has changed (#i67305) 2154cdf0e10cSrcweir if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) ) 2155cdf0e10cSrcweir { 2156cdf0e10cSrcweir pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); 2157cdf0e10cSrcweir } 2158cdf0e10cSrcweir } 2159cdf0e10cSrcweir 2160cdf0e10cSrcweir pWrtShell->EndAllAction(); 2161cdf0e10cSrcweir if( nErrno ) 2162cdf0e10cSrcweir { 2163cdf0e10cSrcweir ErrorHandler::HandleError( nErrno ); 2164cdf0e10cSrcweir nFound = IsError( nErrno ) ? -1 : 0; 2165cdf0e10cSrcweir } 2166cdf0e10cSrcweir else 2167cdf0e10cSrcweir nFound = 0; 2168cdf0e10cSrcweir } 2169cdf0e10cSrcweir } 2170cdf0e10cSrcweir } 2171cdf0e10cSrcweir else 2172cdf0e10cSrcweir { 2173cdf0e10cSrcweir SfxObjectShellRef xDocSh; 2174cdf0e10cSrcweir SfxObjectShellLock xLockRef; 2175cdf0e10cSrcweir 2176cdf0e10cSrcweir extern int lcl_FindDocShell( SfxObjectShellRef& xDocSh, SfxObjectShellLock& xLockRef, 2177cdf0e10cSrcweir const String& rFileName, const String& rPasswd, 2178cdf0e10cSrcweir String& rFilter, sal_Int16 nVersion, 2179cdf0e10cSrcweir SwDocShell* pDestSh ); 2180cdf0e10cSrcweir 2181cdf0e10cSrcweir String sFltNm; 2182cdf0e10cSrcweir int nRet = lcl_FindDocShell( xDocSh, xLockRef, pMedium->GetName(), aEmptyStr, 2183cdf0e10cSrcweir sFltNm, nVersion, pDocSh ); 2184cdf0e10cSrcweir if( nRet ) 2185cdf0e10cSrcweir { 2186cdf0e10cSrcweir SwWait aWait( *GetDocShell(), sal_True ); 2187cdf0e10cSrcweir pWrtShell->StartAllAction(); 2188cdf0e10cSrcweir 2189cdf0e10cSrcweir pWrtShell->EnterStdMode(); // Selektionen loeschen 2190cdf0e10cSrcweir 2191cdf0e10cSrcweir if( bCompare ) 2192cdf0e10cSrcweir nFound = pWrtShell->CompareDoc( *((SwDocShell*)&xDocSh)->GetDoc() ); 2193cdf0e10cSrcweir else 2194cdf0e10cSrcweir nFound = pWrtShell->MergeDoc( *((SwDocShell*)&xDocSh)->GetDoc() ); 2195cdf0e10cSrcweir 2196cdf0e10cSrcweir pWrtShell->EndAllAction(); 2197cdf0e10cSrcweir 2198cdf0e10cSrcweir if (!bCompare && !nFound) 2199cdf0e10cSrcweir { 2200cdf0e10cSrcweir Window* pWin = &GetEditWin(); 2201cdf0e10cSrcweir InfoBox(pWin, SW_RES(MSG_NO_MERGE_ENTRY)).Execute(); 2202cdf0e10cSrcweir } 2203cdf0e10cSrcweir } 2204cdf0e10cSrcweir if( 2 == nRet && xDocSh.Is() ) 2205cdf0e10cSrcweir xDocSh->DoClose(); 2206cdf0e10cSrcweir } 2207cdf0e10cSrcweir 2208cdf0e10cSrcweir delete pMedium; 2209cdf0e10cSrcweir return nFound; 2210cdf0e10cSrcweir } 2211cdf0e10cSrcweir /* -----------------05.02.2003 12:06----------------- 2212cdf0e10cSrcweir * 2213cdf0e10cSrcweir * --------------------------------------------------*/ 2214cdf0e10cSrcweir void SwView::EnableMailMerge(sal_Bool bEnable ) 2215cdf0e10cSrcweir { 2216cdf0e10cSrcweir bInMailMerge = bEnable; 2217cdf0e10cSrcweir SfxBindings& rBind = GetViewFrame()->GetBindings(); 2218cdf0e10cSrcweir rBind.Invalidate(FN_INSERT_FIELD_DATA_ONLY); 2219cdf0e10cSrcweir rBind.Update(FN_INSERT_FIELD_DATA_ONLY); 2220cdf0e10cSrcweir } 2221cdf0e10cSrcweir /* 2222cdf0e10cSrcweir */ 2223cdf0e10cSrcweir namespace 2224cdf0e10cSrcweir { 2225cdf0e10cSrcweir sal_Bool lcl_NeedAdditionalDataSource( const uno::Reference< XNameAccess >& _rDatasourceContext ) 2226cdf0e10cSrcweir { 2227cdf0e10cSrcweir Sequence < OUString > aNames = _rDatasourceContext->getElementNames(); 2228cdf0e10cSrcweir 2229cdf0e10cSrcweir return ( !aNames.getLength() 2230cdf0e10cSrcweir || ( ( 1 == aNames.getLength() ) 2231cdf0e10cSrcweir && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource 2232cdf0e10cSrcweir ) 2233cdf0e10cSrcweir ); 2234cdf0e10cSrcweir } 2235cdf0e10cSrcweir } 2236cdf0e10cSrcweir 2237cdf0e10cSrcweir /* -----------------27.11.2002 12:12----------------- 2238cdf0e10cSrcweir * 2239cdf0e10cSrcweir * --------------------------------------------------*/ 2240cdf0e10cSrcweir 2241cdf0e10cSrcweir class SwMergeSourceWarningBox_Impl : public ModalDialog 2242cdf0e10cSrcweir { 2243cdf0e10cSrcweir FixedInfo aMessageFI; 2244cdf0e10cSrcweir OKButton aOK; 2245cdf0e10cSrcweir CancelButton aCancel; 2246cdf0e10cSrcweir 2247cdf0e10cSrcweir FixedImage aWarnImage; 2248cdf0e10cSrcweir public: 2249cdf0e10cSrcweir SwMergeSourceWarningBox_Impl( Window* pParent ) : 2250cdf0e10cSrcweir ModalDialog( pParent, SW_RES( DLG_MERGE_SOURCE_UNAVAILABLE ) ), 2251cdf0e10cSrcweir aMessageFI( this, SW_RES( ST_MERGE_SOURCE_UNAVAILABLE ) ), 2252cdf0e10cSrcweir aOK( this, SW_RES( PB_MERGE_OK ) ), 2253cdf0e10cSrcweir aCancel( this, SW_RES( PB_MERGE_CANCEL ) ), 2254cdf0e10cSrcweir aWarnImage( this, SW_RES( IMG_MERGE ) ) 2255cdf0e10cSrcweir { 2256cdf0e10cSrcweir FreeResource(); 2257cdf0e10cSrcweir SetText( Application::GetDisplayName() ); 2258cdf0e10cSrcweir const Image& rImg = WarningBox::GetStandardImage(); 2259cdf0e10cSrcweir aWarnImage.SetImage( rImg ); 2260cdf0e10cSrcweir Size aImageSize( rImg.GetSizePixel() ); 2261cdf0e10cSrcweir aImageSize.Width() += 4; 2262cdf0e10cSrcweir aImageSize.Height() += 4; 2263cdf0e10cSrcweir aWarnImage.SetSizePixel( aImageSize ); 2264cdf0e10cSrcweir 2265cdf0e10cSrcweir aImageSize.Width() += aWarnImage.GetPosPixel().X(); 2266cdf0e10cSrcweir Size aSz(GetSizePixel()); 2267cdf0e10cSrcweir aSz.Width() += aImageSize.Width(); 2268cdf0e10cSrcweir SetSizePixel(aSz); 2269cdf0e10cSrcweir 2270cdf0e10cSrcweir Point aPos(aMessageFI.GetPosPixel()); 2271cdf0e10cSrcweir aPos.X() += aImageSize.Width(); 2272cdf0e10cSrcweir aMessageFI.SetPosPixel( aPos ); 2273cdf0e10cSrcweir 2274cdf0e10cSrcweir aPos = aOK.GetPosPixel(); 2275cdf0e10cSrcweir aPos.X() += aImageSize.Width(); 2276cdf0e10cSrcweir aOK.SetPosPixel( aPos ); 2277cdf0e10cSrcweir aPos = aCancel.GetPosPixel(); 2278cdf0e10cSrcweir aPos.X() += aImageSize.Width(); 2279cdf0e10cSrcweir aCancel.SetPosPixel( aPos ); 2280cdf0e10cSrcweir 2281cdf0e10cSrcweir } 2282cdf0e10cSrcweir 2283cdf0e10cSrcweir String GetMessText() const { return aMessageFI.GetText(); } 2284cdf0e10cSrcweir void SetMessText( const String& rText ) { aMessageFI.SetText( rText ); } 2285cdf0e10cSrcweir }; 2286cdf0e10cSrcweir 2287cdf0e10cSrcweir 2288cdf0e10cSrcweir 2289cdf0e10cSrcweir 2290cdf0e10cSrcweir void SwView::GenerateFormLetter(sal_Bool bUseCurrentDocument) 2291cdf0e10cSrcweir { 2292cdf0e10cSrcweir if(bUseCurrentDocument) 2293cdf0e10cSrcweir { 2294cdf0e10cSrcweir if(!GetWrtShell().IsAnyDatabaseFieldInDoc()) 2295cdf0e10cSrcweir { 2296cdf0e10cSrcweir //check availability of data sources (except biblio source) 2297cdf0e10cSrcweir uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); 2298cdf0e10cSrcweir uno::Reference<XNameAccess> xDBContext; 2299cdf0e10cSrcweir if( xMgr.is() ) 2300cdf0e10cSrcweir { 2301cdf0e10cSrcweir uno::Reference<XInterface> xInstance = xMgr->createInstance( 2302cdf0e10cSrcweir OUString::createFromAscii( "com.sun.star.sdb.DatabaseContext" )); 2303cdf0e10cSrcweir xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ; 2304cdf0e10cSrcweir } 2305cdf0e10cSrcweir if(!xDBContext.is()) 2306cdf0e10cSrcweir return ; 2307cdf0e10cSrcweir sal_Bool bCallAddressPilot = sal_False; 2308cdf0e10cSrcweir if ( lcl_NeedAdditionalDataSource( xDBContext ) ) 2309cdf0e10cSrcweir { 2310cdf0e10cSrcweir // no data sources are available - create a new one 2311cdf0e10cSrcweir WarningBox aWarning( 2312cdf0e10cSrcweir &GetViewFrame()->GetWindow(), 2313cdf0e10cSrcweir SW_RES(MSG_DATA_SOURCES_UNAVAILABLE)); 2314cdf0e10cSrcweir // no cancel allowed 2315cdf0e10cSrcweir if ( RET_OK != aWarning.Execute() ) 2316cdf0e10cSrcweir return; 2317cdf0e10cSrcweir bCallAddressPilot = sal_True; 2318cdf0e10cSrcweir } 2319cdf0e10cSrcweir else 2320cdf0e10cSrcweir { 2321cdf0e10cSrcweir //take an existing data source or create a new one? 2322cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2323cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 2324cdf0e10cSrcweir AbstractMailMergeFieldConnectionsDlg* pConnectionsDlg = pFact->CreateMailMergeFieldConnectionsDlg( 2325cdf0e10cSrcweir DLG_MERGE_FIELD_CONNECTIONS, 2326cdf0e10cSrcweir &GetViewFrame()->GetWindow()); 2327cdf0e10cSrcweir DBG_ASSERT(pConnectionsDlg, "Dialogdiet fail!"); 2328cdf0e10cSrcweir if(RET_OK == pConnectionsDlg->Execute()) 2329cdf0e10cSrcweir bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections(); 2330cdf0e10cSrcweir else 2331cdf0e10cSrcweir return; 2332cdf0e10cSrcweir 2333cdf0e10cSrcweir } 2334cdf0e10cSrcweir if(bCallAddressPilot) 2335cdf0e10cSrcweir { 2336cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 2337cdf0e10cSrcweir SID_ADDRESS_DATA_SOURCE, SFX_CALLMODE_SYNCHRON); 2338cdf0e10cSrcweir if ( lcl_NeedAdditionalDataSource( xDBContext ) ) 2339cdf0e10cSrcweir // no additional data source has been created 2340cdf0e10cSrcweir // -> assume that the user has cancelled the pilot 2341cdf0e10cSrcweir return; 2342cdf0e10cSrcweir } 2343cdf0e10cSrcweir 2344cdf0e10cSrcweir //call insert fields with database field page available, only 2345cdf0e10cSrcweir SfxViewFrame* pVFrame = GetViewFrame(); 2346cdf0e10cSrcweir //at first hide the default field dialog if currently visible 2347cdf0e10cSrcweir pVFrame->SetChildWindow(FN_INSERT_FIELD, sal_False); 2348cdf0e10cSrcweir //enable the status of the db field dialog - it is disabled in the status method 2349cdf0e10cSrcweir //to prevent creation of the dialog without mail merge active 2350cdf0e10cSrcweir EnableMailMerge(); 2351cdf0e10cSrcweir //then show the "Data base only" field dialog 2352cdf0e10cSrcweir SfxBoolItem aOn(FN_INSERT_FIELD_DATA_ONLY, sal_True); 2353cdf0e10cSrcweir pVFrame->GetDispatcher()->Execute(FN_INSERT_FIELD_DATA_ONLY, 2354cdf0e10cSrcweir SFX_CALLMODE_SYNCHRON, &aOn, 0L); 2355cdf0e10cSrcweir return; 2356cdf0e10cSrcweir } 2357cdf0e10cSrcweir else 2358cdf0e10cSrcweir { 2359cdf0e10cSrcweir // check whether the 2360cdf0e10cSrcweir String sSource; 2361cdf0e10cSrcweir if(!GetWrtShell().IsFieldDataSourceAvailable(sSource)) 2362cdf0e10cSrcweir { 2363cdf0e10cSrcweir SwMergeSourceWarningBox_Impl aWarning( &GetViewFrame()->GetWindow()); 2364cdf0e10cSrcweir String sTmp(aWarning.GetMessText()); 2365cdf0e10cSrcweir sTmp.SearchAndReplaceAscii("%1", sSource); 2366cdf0e10cSrcweir aWarning.SetMessText(sTmp); 2367cdf0e10cSrcweir if(RET_OK == aWarning.Execute()) 2368cdf0e10cSrcweir { 2369cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 2370cdf0e10cSrcweir if ( pFact ) 2371cdf0e10cSrcweir { 2372cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateVclDialog( NULL, SID_OPTIONS_DATABASES ); 2373cdf0e10cSrcweir pDlg->Execute(); 2374cdf0e10cSrcweir delete pDlg; 2375cdf0e10cSrcweir } 2376cdf0e10cSrcweir } 2377cdf0e10cSrcweir return ; 2378cdf0e10cSrcweir } 2379cdf0e10cSrcweir } 2380cdf0e10cSrcweir SwNewDBMgr* pNewDBMgr = GetWrtShell().GetNewDBMgr(); 2381cdf0e10cSrcweir 2382cdf0e10cSrcweir SwDBData aData; 2383cdf0e10cSrcweir SwWrtShell &rSh = GetWrtShell(); 2384cdf0e10cSrcweir aData = rSh.GetDBData(); 2385cdf0e10cSrcweir rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer 2386cdf0e10cSrcweir // das Mischen von DB-Feldern notwendig. 2387cdf0e10cSrcweir AttrChangedNotify( &rSh ); 2388cdf0e10cSrcweir pNewDBMgr->SetMergeType( DBMGR_MERGE ); 2389cdf0e10cSrcweir 2390cdf0e10cSrcweir if (pNewDBMgr) 2391cdf0e10cSrcweir { 2392cdf0e10cSrcweir Sequence<PropertyValue> aProperties(3); 2393cdf0e10cSrcweir PropertyValue* pValues = aProperties.getArray(); 2394cdf0e10cSrcweir pValues[0].Name = C2U("DataSourceName"); 2395cdf0e10cSrcweir pValues[1].Name = C2U("Command"); 2396cdf0e10cSrcweir pValues[2].Name = C2U("CommandType"); 2397cdf0e10cSrcweir pValues[0].Value <<= aData.sDataSource; 2398cdf0e10cSrcweir pValues[1].Value <<= aData.sCommand; 2399cdf0e10cSrcweir pValues[2].Value <<= aData.nCommandType; 2400cdf0e10cSrcweir pNewDBMgr->ExecuteFormLetter(GetWrtShell(), aProperties, sal_True); 2401cdf0e10cSrcweir } 2402cdf0e10cSrcweir } 2403cdf0e10cSrcweir else 2404cdf0e10cSrcweir { 2405cdf0e10cSrcweir //call documents and template dialog 2406cdf0e10cSrcweir SfxApplication* pSfxApp = SFX_APP(); 2407cdf0e10cSrcweir Window* pTopWin = pSfxApp->GetTopWindow(); 2408cdf0e10cSrcweir SvtDocumentTemplateDialog* pDocTemplDlg = new SvtDocumentTemplateDialog( pTopWin ); 2409cdf0e10cSrcweir pDocTemplDlg->SelectTemplateFolder(); 2410cdf0e10cSrcweir 2411cdf0e10cSrcweir int nRet = pDocTemplDlg->Execute(); 2412cdf0e10cSrcweir sal_Bool bNewWin = sal_False; 2413cdf0e10cSrcweir if ( nRet == RET_OK ) 2414cdf0e10cSrcweir { 2415cdf0e10cSrcweir if ( pTopWin != pSfxApp->GetTopWindow() ) 2416cdf0e10cSrcweir { 2417cdf0e10cSrcweir // the dialogue opens a document -> a new TopWindow appears 2418cdf0e10cSrcweir pTopWin = pSfxApp->GetTopWindow(); 2419cdf0e10cSrcweir bNewWin = sal_True; 2420cdf0e10cSrcweir } 2421cdf0e10cSrcweir } 2422cdf0e10cSrcweir 2423cdf0e10cSrcweir delete pDocTemplDlg; 2424cdf0e10cSrcweir if ( bNewWin ) 2425cdf0e10cSrcweir // after the destruction of the dialogue its parent comes to top, 2426cdf0e10cSrcweir // but we want that the new document is on top 2427cdf0e10cSrcweir pTopWin->ToTop(); 2428cdf0e10cSrcweir 2429cdf0e10cSrcweir // return; 2430cdf0e10cSrcweir } 2431cdf0e10cSrcweir } 2432cdf0e10cSrcweir 2433cdf0e10cSrcweir IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg ) 2434cdf0e10cSrcweir { 2435cdf0e10cSrcweir if ( ERRCODE_NONE == _pFileDlg->GetError() ) 2436cdf0e10cSrcweir { 2437cdf0e10cSrcweir SfxMedium* pMed = pViewImpl->CreateMedium(); 2438cdf0e10cSrcweir if ( pMed ) 2439cdf0e10cSrcweir { 2440cdf0e10cSrcweir sal_uInt16 nSlot = pViewImpl->GetRequest()->GetSlot(); 2441cdf0e10cSrcweir long nFound = InsertMedium( nSlot, pMed, pViewImpl->GetParam() ); 2442cdf0e10cSrcweir 2443cdf0e10cSrcweir if ( SID_INSERTDOC == nSlot ) 2444cdf0e10cSrcweir { 2445cdf0e10cSrcweir if ( pViewImpl->GetParam() == 0 ) 2446cdf0e10cSrcweir { 2447cdf0e10cSrcweir pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) ); 2448cdf0e10cSrcweir pViewImpl->GetRequest()->Ignore(); 2449cdf0e10cSrcweir } 2450cdf0e10cSrcweir else 2451cdf0e10cSrcweir { 2452cdf0e10cSrcweir pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) ); 2453cdf0e10cSrcweir pViewImpl->GetRequest()->Done(); 2454cdf0e10cSrcweir } 2455cdf0e10cSrcweir } 2456cdf0e10cSrcweir else if ( SID_DOCUMENT_COMPARE == nSlot || SID_DOCUMENT_MERGE == nSlot ) 2457cdf0e10cSrcweir { 2458cdf0e10cSrcweir pViewImpl->GetRequest()->SetReturnValue( SfxInt32Item( nSlot, nFound ) ); 2459cdf0e10cSrcweir 2460cdf0e10cSrcweir if ( nFound > 0 ) // Redline-Browser anzeigen 2461cdf0e10cSrcweir { 2462cdf0e10cSrcweir SfxViewFrame* pVFrame = GetViewFrame(); 2463cdf0e10cSrcweir pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT); 2464cdf0e10cSrcweir 2465cdf0e10cSrcweir // RedlineDlg neu initialisieren 2466cdf0e10cSrcweir sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId(); 2467cdf0e10cSrcweir SwRedlineAcceptChild* pRed = (SwRedlineAcceptChild*)pVFrame->GetChildWindow( nId ); 2468cdf0e10cSrcweir if ( pRed ) 2469cdf0e10cSrcweir pRed->ReInitDlg( GetDocShell() ); 2470cdf0e10cSrcweir } 2471cdf0e10cSrcweir } 2472cdf0e10cSrcweir } 2473cdf0e10cSrcweir } 2474cdf0e10cSrcweir return 0; 2475cdf0e10cSrcweir } 2476cdf0e10cSrcweir 2477cdf0e10cSrcweir void SwView::ExecuteScan( SfxRequest& rReq ) 2478cdf0e10cSrcweir { 2479cdf0e10cSrcweir if (pViewImpl) 2480cdf0e10cSrcweir pViewImpl->ExecuteScan(rReq) ; 2481cdf0e10cSrcweir } 2482cdf0e10cSrcweir 2483