1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <hintids.hxx> 29cdf0e10cSrcweir #include <sfx2/request.hxx> 30cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 31cdf0e10cSrcweir #include <sfx2/childwin.hxx> 32cdf0e10cSrcweir #include <unotools/useroptions.hxx> 33cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 34cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp> 35cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp> 36cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations 37cdf0e10cSrcweir #include <svx/dataaccessdescriptor.hxx> 38cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 39cdf0e10cSrcweir #include <editeng/postitem.hxx> 40cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 41cdf0e10cSrcweir #include <editeng/crsditem.hxx> 42cdf0e10cSrcweir #include <editeng/cmapitem.hxx> 43cdf0e10cSrcweir #include <editeng/colritem.hxx> 44cdf0e10cSrcweir #include <editeng/brshitem.hxx> 45cdf0e10cSrcweir #include <vcl/msgbox.hxx> 46cdf0e10cSrcweir #include <swmodule.hxx> 47cdf0e10cSrcweir #include <swtypes.hxx> 48cdf0e10cSrcweir #include <usrpref.hxx> 49cdf0e10cSrcweir #include <modcfg.hxx> 50cdf0e10cSrcweir #include <view.hxx> 51cdf0e10cSrcweir #include <pview.hxx> 52cdf0e10cSrcweir #include <wview.hxx> 53cdf0e10cSrcweir #include <wrtsh.hxx> 54cdf0e10cSrcweir #include <docsh.hxx> 55cdf0e10cSrcweir #include <dbmgr.hxx> 56cdf0e10cSrcweir #include <uinums.hxx> 57cdf0e10cSrcweir #include <prtopt.hxx> // fuer PrintOptions 58cdf0e10cSrcweir #include <navicfg.hxx> 59cdf0e10cSrcweir #include <doc.hxx> 60cdf0e10cSrcweir #include <cmdid.h> 61cdf0e10cSrcweir #include <app.hrc> 62cdf0e10cSrcweir #include "helpid.h" 63cdf0e10cSrcweir 64cdf0e10cSrcweir #include <unomid.h> 65cdf0e10cSrcweir #include <tools/color.hxx> 66cdf0e10cSrcweir #include "PostItMgr.hxx" 67cdf0e10cSrcweir 68cdf0e10cSrcweir using ::rtl::OUString; 69cdf0e10cSrcweir using namespace ::svx; 70cdf0e10cSrcweir using namespace ::com::sun::star; 71cdf0e10cSrcweir using namespace ::com::sun::star::uno; 72cdf0e10cSrcweir using namespace ::com::sun::star::beans; 73cdf0e10cSrcweir using namespace ::com::sun::star::frame; 74cdf0e10cSrcweir using namespace ::com::sun::star::view; 75cdf0e10cSrcweir using namespace ::com::sun::star::lang; 76cdf0e10cSrcweir 77cdf0e10cSrcweir 78cdf0e10cSrcweir /*-----------------08/28/97 08:41pm----------------- 79cdf0e10cSrcweir 80cdf0e10cSrcweir --------------------------------------------------*/ 81cdf0e10cSrcweir void lcl_SetUIPrefs(const SwViewOption* pPref, SwView* pView, ViewShell* pSh ) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir // in FrameSets kann die tatsaechliche Sichtbarkeit von der Einstellung der ViewOptions abweichen 84cdf0e10cSrcweir sal_Bool bVScrollChanged = pPref->IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar(); 85cdf0e10cSrcweir sal_Bool bHScrollChanged = pPref->IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar(); 86cdf0e10cSrcweir sal_Bool bVAlignChanged = pPref->IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir pSh->SetUIOptions(*pPref); 89cdf0e10cSrcweir const SwViewOption* pNewPref = pSh->GetViewOptions(); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // Scrollbars an / aus 92cdf0e10cSrcweir if(bVScrollChanged) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir pView->ShowVScrollbar(pNewPref->IsViewVScrollBar()); 95cdf0e10cSrcweir } 96cdf0e10cSrcweir if(bHScrollChanged) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pNewPref->getBrowseMode() ); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir //if only the position of the vertical ruler has been changed initiate an update 101cdf0e10cSrcweir if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged) 102cdf0e10cSrcweir pView->InvalidateBorder(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir // Lineale an / aus 105cdf0e10cSrcweir if(pNewPref->IsViewVRuler()) 106cdf0e10cSrcweir pView->CreateVLineal(); 107cdf0e10cSrcweir else 108cdf0e10cSrcweir pView->KillVLineal(); 109cdf0e10cSrcweir 110cdf0e10cSrcweir // TabWindow an/aus 111cdf0e10cSrcweir if(pNewPref->IsViewHRuler()) 112cdf0e10cSrcweir pView->CreateTab(); 113cdf0e10cSrcweir else 114cdf0e10cSrcweir pView->KillTab(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir pView->GetPostItMgr()->PrepareView(true); 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir /*-------------------------------------------------------------------- 120cdf0e10cSrcweir Beschreibung: Aktuelle SwWrtShell 121cdf0e10cSrcweir --------------------------------------------------------------------*/ 122cdf0e10cSrcweir 123cdf0e10cSrcweir 124cdf0e10cSrcweir SwWrtShell* GetActiveWrtShell() 125cdf0e10cSrcweir { 126cdf0e10cSrcweir SwView *pActive = ::GetActiveView(); 127cdf0e10cSrcweir if( pActive ) 128cdf0e10cSrcweir return &pActive->GetWrtShell(); 129cdf0e10cSrcweir return 0; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir /*-------------------------------------------------------------------- 133cdf0e10cSrcweir Beschreibung: Pointer auf die aktuelle Sicht 134cdf0e10cSrcweir --------------------------------------------------------------------*/ 135cdf0e10cSrcweir 136cdf0e10cSrcweir 137cdf0e10cSrcweir SwView* GetActiveView() 138cdf0e10cSrcweir { 139cdf0e10cSrcweir SfxViewShell* pView = SfxViewShell::Current(); 140cdf0e10cSrcweir return PTR_CAST( SwView, pView ); 141cdf0e10cSrcweir } 142cdf0e10cSrcweir /*-------------------------------------------------------------------- 143cdf0e10cSrcweir Beschreibung: Ueber Views iterieren - static 144cdf0e10cSrcweir --------------------------------------------------------------------*/ 145cdf0e10cSrcweir 146cdf0e10cSrcweir SwView* SwModule::GetFirstView() 147cdf0e10cSrcweir { 148cdf0e10cSrcweir // liefert nur sichtbare SwViews 149cdf0e10cSrcweir const TypeId aTypeId = TYPE(SwView); 150cdf0e10cSrcweir SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId); 151cdf0e10cSrcweir return pView; 152cdf0e10cSrcweir } 153cdf0e10cSrcweir 154cdf0e10cSrcweir 155cdf0e10cSrcweir SwView* SwModule::GetNextView(SwView* pView) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir DBG_ASSERT(PTR_CAST(SwView, pView),"keine SwView uebergeben"); 158cdf0e10cSrcweir const TypeId aTypeId = TYPE(SwView); 159cdf0e10cSrcweir SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, sal_True); 160cdf0e10cSrcweir return pNView; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir /*------------------------------------------------------------------------ 164cdf0e10cSrcweir Beschreibung: Neuer Master fuer die Einstellungen wird gesetzt; 165cdf0e10cSrcweir dieser wirkt sich auf die aktuelle Sicht und alle 166cdf0e10cSrcweir folgenden aus. 167cdf0e10cSrcweir ------------------------------------------------------------------------*/ 168cdf0e10cSrcweir 169cdf0e10cSrcweir void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView, 170cdf0e10cSrcweir sal_uInt16 nDest ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir SwView* pCurrView = pActView; 173cdf0e10cSrcweir ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0; 174cdf0e10cSrcweir 175cdf0e10cSrcweir SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >( 176cdf0e10cSrcweir VIEWOPT_DEST_WEB == nDest ? sal_True : 177cdf0e10cSrcweir VIEWOPT_DEST_TEXT== nDest ? sal_False : 178cdf0e10cSrcweir pCurrView && pCurrView->ISA(SwWebView) )); 179cdf0e10cSrcweir 180cdf0e10cSrcweir //per Uno soll nur die sdbcx::View, aber nicht das Module veraendert werden 181cdf0e10cSrcweir sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest; 182cdf0e10cSrcweir //PreView abfruehstuecken 183cdf0e10cSrcweir SwPagePreView* pPPView; 184cdf0e10cSrcweir if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir if(!bViewOnly) 187cdf0e10cSrcweir pPref->SetUIOptions( rUsrPref ); 188cdf0e10cSrcweir pPPView->ShowVScrollbar(pPref->IsViewVScrollBar()); 189cdf0e10cSrcweir pPPView->ShowHScrollbar(pPref->IsViewHScrollBar()); 190cdf0e10cSrcweir if(!bViewOnly) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow()); 193cdf0e10cSrcweir pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol()); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir return; 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir if(!bViewOnly) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir pPref->SetUsrPref( rUsrPref ); 201cdf0e10cSrcweir pPref->SetModified(); 202cdf0e10cSrcweir } 203cdf0e10cSrcweir 204cdf0e10cSrcweir if( !pCurrView ) 205cdf0e10cSrcweir return; 206cdf0e10cSrcweir 207cdf0e10cSrcweir // Weitergabe an die CORE 208cdf0e10cSrcweir sal_Bool bReadonly; 209cdf0e10cSrcweir const SwDocShell* pDocSh = pCurrView->GetDocShell(); 210cdf0e10cSrcweir if (pDocSh) 211cdf0e10cSrcweir bReadonly = pDocSh->IsReadOnly(); 212cdf0e10cSrcweir else //Use existing option if DocShell missing 213cdf0e10cSrcweir bReadonly = pSh->GetViewOptions()->IsReadonly(); 214cdf0e10cSrcweir SwViewOption* pViewOpt; 215cdf0e10cSrcweir if(!bViewOnly) 216cdf0e10cSrcweir pViewOpt = new SwViewOption( *pPref ); 217cdf0e10cSrcweir else 218cdf0e10cSrcweir pViewOpt = new SwViewOption( rUsrPref ); 219cdf0e10cSrcweir pViewOpt->SetReadonly( bReadonly ); 220cdf0e10cSrcweir if( !(*pSh->GetViewOptions() == *pViewOpt) ) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir //Ist evtl. nur eine ViewShell 223cdf0e10cSrcweir pSh->StartAction(); 224cdf0e10cSrcweir pSh->ApplyViewOptions( *pViewOpt ); 225cdf0e10cSrcweir ((SwWrtShell*)pSh)->SetReadOnlyAvailable(pViewOpt->IsCursorInProtectedArea()); 226cdf0e10cSrcweir pSh->EndAction(); 227cdf0e10cSrcweir } 228cdf0e10cSrcweir if ( pSh->GetViewOptions()->IsReadonly() != bReadonly ) 229cdf0e10cSrcweir pSh->SetReadonlyOption(bReadonly); 230cdf0e10cSrcweir 231cdf0e10cSrcweir lcl_SetUIPrefs(pViewOpt, pCurrView, pSh); 232cdf0e10cSrcweir 233cdf0e10cSrcweir // zum Schluss wird das Idle-Flag wieder gesetzt 234cdf0e10cSrcweir // #42510# 235cdf0e10cSrcweir pPref->SetIdle(sal_True); 236cdf0e10cSrcweir } 237cdf0e10cSrcweir /* -----------------------------28.09.00 12:36-------------------------------- 238cdf0e10cSrcweir 239cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 240cdf0e10cSrcweir void SwModule::ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb ) 241cdf0e10cSrcweir { 242cdf0e10cSrcweir SwMasterUsrPref* pPref; 243cdf0e10cSrcweir if(bWeb) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir if(!pWebUsrPref) 246cdf0e10cSrcweir GetUsrPref(sal_True); 247cdf0e10cSrcweir pPref = pWebUsrPref; 248cdf0e10cSrcweir } 249cdf0e10cSrcweir else 250cdf0e10cSrcweir { 251cdf0e10cSrcweir if(!pUsrPref) 252cdf0e10cSrcweir GetUsrPref(sal_False); 253cdf0e10cSrcweir pPref = pUsrPref; 254cdf0e10cSrcweir } 255cdf0e10cSrcweir FieldUnit eOldMetric = pPref->GetMetric(); 256cdf0e10cSrcweir if(eOldMetric != eMetric) 257cdf0e10cSrcweir pPref->SetMetric(eMetric); 258cdf0e10cSrcweir 259cdf0e10cSrcweir FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric; 260cdf0e10cSrcweir FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric; 261cdf0e10cSrcweir 262cdf0e10cSrcweir SwView* pTmpView = SwModule::GetFirstView(); 263cdf0e10cSrcweir // fuer alle MDI-Fenster das Lineal umschalten 264cdf0e10cSrcweir while(pTmpView) 265cdf0e10cSrcweir { 266cdf0e10cSrcweir if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView))) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir pTmpView->ChangeVLinealMetric(eVScrollMetric); 269cdf0e10cSrcweir pTmpView->ChangeTabMetric(eHScrollMetric); 270cdf0e10cSrcweir } 271cdf0e10cSrcweir 272cdf0e10cSrcweir pTmpView = SwModule::GetNextView(pTmpView); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir } 275cdf0e10cSrcweir /*-- 12.11.2008 14:47:58--------------------------------------------------- 276cdf0e10cSrcweir 277cdf0e10cSrcweir -----------------------------------------------------------------------*/ 278cdf0e10cSrcweir void SwModule::ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb ) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir SwMasterUsrPref* pPref; 281cdf0e10cSrcweir if(bWeb) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir if(!pWebUsrPref) 284cdf0e10cSrcweir GetUsrPref(sal_True); 285cdf0e10cSrcweir pPref = pWebUsrPref; 286cdf0e10cSrcweir } 287cdf0e10cSrcweir else 288cdf0e10cSrcweir { 289cdf0e10cSrcweir if(!pUsrPref) 290cdf0e10cSrcweir GetUsrPref(sal_False); 291cdf0e10cSrcweir pPref = pUsrPref; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir if( bHorizontal ) 294cdf0e10cSrcweir pPref->SetHScrollMetric(eMetric); 295cdf0e10cSrcweir else 296cdf0e10cSrcweir pPref->SetVScrollMetric(eMetric); 297cdf0e10cSrcweir 298cdf0e10cSrcweir SwView* pTmpView = SwModule::GetFirstView(); 299cdf0e10cSrcweir // switch metric at the appropriate rulers 300cdf0e10cSrcweir while(pTmpView) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView ))) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir if( bHorizontal ) 305cdf0e10cSrcweir pTmpView->ChangeTabMetric(eMetric); 306cdf0e10cSrcweir else 307cdf0e10cSrcweir pTmpView->ChangeVLinealMetric(eMetric); 308cdf0e10cSrcweir } 309cdf0e10cSrcweir pTmpView = SwModule::GetNextView(pTmpView); 310cdf0e10cSrcweir } 311cdf0e10cSrcweir } 312cdf0e10cSrcweir /*-----------------13.11.96 11.57------------------- 313cdf0e10cSrcweir 314cdf0e10cSrcweir --------------------------------------------------*/ 315cdf0e10cSrcweir 316cdf0e10cSrcweir SwNavigationConfig* SwModule::GetNavigationConfig() 317cdf0e10cSrcweir { 318cdf0e10cSrcweir if(!pNavigationConfig) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir pNavigationConfig = new SwNavigationConfig; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir return pNavigationConfig; 323cdf0e10cSrcweir } 324cdf0e10cSrcweir 325cdf0e10cSrcweir /*-----------------05.02.97 08.03------------------- 326cdf0e10cSrcweir 327cdf0e10cSrcweir --------------------------------------------------*/ 328cdf0e10cSrcweir 329cdf0e10cSrcweir SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir if(bWeb && !pWebPrtOpt) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir pWebPrtOpt = new SwPrintOptions(sal_True); 334cdf0e10cSrcweir } 335cdf0e10cSrcweir else if(!bWeb && !pPrtOpt) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir pPrtOpt = new SwPrintOptions(sal_False); 338cdf0e10cSrcweir } 339cdf0e10cSrcweir 340cdf0e10cSrcweir return bWeb ? pWebPrtOpt : pPrtOpt; 341cdf0e10cSrcweir } 342cdf0e10cSrcweir 343cdf0e10cSrcweir /*-----------------26.06.97 07.52------------------- 344cdf0e10cSrcweir 345cdf0e10cSrcweir --------------------------------------------------*/ 346cdf0e10cSrcweir SwChapterNumRules* SwModule::GetChapterNumRules() 347cdf0e10cSrcweir { 348cdf0e10cSrcweir if(!pChapterNumRules) 349cdf0e10cSrcweir pChapterNumRules = new SwChapterNumRules; 350cdf0e10cSrcweir return pChapterNumRules; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir /*-------------------------------------------------------------------- 354cdf0e10cSrcweir Beschreibung: 355cdf0e10cSrcweir --------------------------------------------------------------------*/ 356cdf0e10cSrcweir 357cdf0e10cSrcweir void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, sal_Bool /*bOnlyIfAvailable*/) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface(); 360cdf0e10cSrcweir Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY); 361cdf0e10cSrcweir 362cdf0e10cSrcweir uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame( 363cdf0e10cSrcweir rtl::OUString::createFromAscii("_beamer"), 364cdf0e10cSrcweir FrameSearchFlag::CHILDREN); 365cdf0e10cSrcweir if (xBeamerFrame.is()) 366cdf0e10cSrcweir { // the beamer has been opened by the SfxViewFrame 367cdf0e10cSrcweir Reference<XController> xController = xBeamerFrame->getController(); 368cdf0e10cSrcweir Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY); 369cdf0e10cSrcweir if (xControllerSelection.is()) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir 372cdf0e10cSrcweir ODataAccessDescriptor aSelection; 373cdf0e10cSrcweir aSelection.setDataSource(rData.sDataSource); 374cdf0e10cSrcweir aSelection[daCommand] <<= rData.sCommand; 375cdf0e10cSrcweir aSelection[daCommandType] <<= rData.nCommandType; 376cdf0e10cSrcweir xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence())); 377cdf0e10cSrcweir } 378cdf0e10cSrcweir else { 379cdf0e10cSrcweir DBG_ERROR("no selection supplier in the beamer!"); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir } 382cdf0e10cSrcweir } 383cdf0e10cSrcweir /*-------------------------------------------------------------------- 384cdf0e10cSrcweir Beschreibung: Redlining 385cdf0e10cSrcweir --------------------------------------------------------------------*/ 386cdf0e10cSrcweir 387cdf0e10cSrcweir sal_uInt16 SwModule::GetRedlineAuthor() 388cdf0e10cSrcweir { 389cdf0e10cSrcweir if (!bAuthorInitialised) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir const SvtUserOptions& rOpt = GetUserOptions(); 392cdf0e10cSrcweir if( !(sActAuthor = rOpt.GetFullName()).Len() ) 393cdf0e10cSrcweir if( !(sActAuthor = rOpt.GetID()).Len() ) 394cdf0e10cSrcweir sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR )); 395cdf0e10cSrcweir bAuthorInitialised = sal_True; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir return InsertRedlineAuthor( sActAuthor ); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir /*-------------------------------------------------------------------- 401cdf0e10cSrcweir Beschreibung: 402cdf0e10cSrcweir --------------------------------------------------------------------*/ 403cdf0e10cSrcweir 404cdf0e10cSrcweir const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos) 405cdf0e10cSrcweir { 406cdf0e10cSrcweir DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash 407cdf0e10cSrcweir while (!(nPos<pAuthorNames->Count())) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn"))); 410cdf0e10cSrcweir }; 411cdf0e10cSrcweir return *pAuthorNames->GetObject(nPos); 412cdf0e10cSrcweir } 413cdf0e10cSrcweir 414cdf0e10cSrcweir /*-------------------------------------------------------------------- 415cdf0e10cSrcweir Beschreibung: 416cdf0e10cSrcweir --------------------------------------------------------------------*/ 417cdf0e10cSrcweir 418cdf0e10cSrcweir sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir sal_uInt16 nPos = 0; 421cdf0e10cSrcweir 422cdf0e10cSrcweir while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor) 423cdf0e10cSrcweir nPos++; 424cdf0e10cSrcweir 425cdf0e10cSrcweir if (nPos == pAuthorNames->Count()) 426cdf0e10cSrcweir pAuthorNames->Insert(new String(rAuthor), nPos); 427cdf0e10cSrcweir 428cdf0e10cSrcweir return nPos; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir /*-------------------------------------------------------------------- 432cdf0e10cSrcweir Beschreibung: 433cdf0e10cSrcweir --------------------------------------------------------------------*/ 434cdf0e10cSrcweir 435cdf0e10cSrcweir void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet, 436cdf0e10cSrcweir const AuthorCharAttr &rAttr ) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir Color aCol( rAttr.nColor ); 439cdf0e10cSrcweir 440cdf0e10cSrcweir if( COL_TRANSPARENT == rAttr.nColor ) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir static const ColorData aColArr[] = { 443cdf0e10cSrcweir COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK, 444cdf0e10cSrcweir COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK, 445cdf0e10cSrcweir COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK }; 446cdf0e10cSrcweir 447cdf0e10cSrcweir aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) / 448cdf0e10cSrcweir sizeof( aColArr[0] )) ] ); 449cdf0e10cSrcweir } 450cdf0e10cSrcweir 451cdf0e10cSrcweir sal_Bool bBackGr = COL_NONE == rAttr.nColor; 452cdf0e10cSrcweir 453cdf0e10cSrcweir switch (rAttr.nItemId) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 456cdf0e10cSrcweir { 457cdf0e10cSrcweir SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT ); 458cdf0e10cSrcweir rSet.Put( aW ); 459cdf0e10cSrcweir aW.SetWhich( RES_CHRATR_CJK_WEIGHT ); 460cdf0e10cSrcweir rSet.Put( aW ); 461cdf0e10cSrcweir aW.SetWhich( RES_CHRATR_CTL_WEIGHT ); 462cdf0e10cSrcweir rSet.Put( aW ); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir break; 465cdf0e10cSrcweir 466cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 467cdf0e10cSrcweir { 468cdf0e10cSrcweir SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE ); 469cdf0e10cSrcweir rSet.Put( aP ); 470cdf0e10cSrcweir aP.SetWhich( RES_CHRATR_CJK_POSTURE ); 471cdf0e10cSrcweir rSet.Put( aP ); 472cdf0e10cSrcweir aP.SetWhich( RES_CHRATR_CTL_POSTURE ); 473cdf0e10cSrcweir rSet.Put( aP ); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir break; 476cdf0e10cSrcweir 477cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: 478cdf0e10cSrcweir rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr, 479cdf0e10cSrcweir RES_CHRATR_UNDERLINE)); 480cdf0e10cSrcweir break; 481cdf0e10cSrcweir 482cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: 483cdf0e10cSrcweir rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr, 484cdf0e10cSrcweir RES_CHRATR_CROSSEDOUT)); 485cdf0e10cSrcweir break; 486cdf0e10cSrcweir 487cdf0e10cSrcweir case SID_ATTR_CHAR_CASEMAP: 488cdf0e10cSrcweir rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr, 489cdf0e10cSrcweir RES_CHRATR_CASEMAP)); 490cdf0e10cSrcweir break; 491cdf0e10cSrcweir 492cdf0e10cSrcweir case SID_ATTR_BRUSH: 493cdf0e10cSrcweir rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND )); 494cdf0e10cSrcweir bBackGr = sal_True; 495cdf0e10cSrcweir break; 496cdf0e10cSrcweir } 497cdf0e10cSrcweir 498cdf0e10cSrcweir if( !bBackGr ) 499cdf0e10cSrcweir rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) ); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir /*-------------------------------------------------------------------- 503cdf0e10cSrcweir Beschreibung: 504cdf0e10cSrcweir --------------------------------------------------------------------*/ 505cdf0e10cSrcweir 506cdf0e10cSrcweir void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet) 507cdf0e10cSrcweir { 508cdf0e10cSrcweir lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr()); 509cdf0e10cSrcweir } 510cdf0e10cSrcweir 511cdf0e10cSrcweir /*-------------------------------------------------------------------- 512cdf0e10cSrcweir Beschreibung: 513cdf0e10cSrcweir --------------------------------------------------------------------*/ 514cdf0e10cSrcweir 515cdf0e10cSrcweir void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr()); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir 520cdf0e10cSrcweir /*-------------------------------------------------------------------- 521cdf0e10cSrcweir Beschreibung: Fuer zukuenftige Erweiterung: 522cdf0e10cSrcweir --------------------------------------------------------------------*/ 523cdf0e10cSrcweir 524cdf0e10cSrcweir void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet ) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() ); 527cdf0e10cSrcweir } 528cdf0e10cSrcweir 529cdf0e10cSrcweir /*-------------------------------------------------------------------- 530cdf0e10cSrcweir Beschreibung: 531cdf0e10cSrcweir --------------------------------------------------------------------*/ 532cdf0e10cSrcweir 533cdf0e10cSrcweir sal_uInt16 SwModule::GetRedlineMarkPos() 534cdf0e10cSrcweir { 535cdf0e10cSrcweir return pModuleConfig->GetMarkAlignMode(); 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir /*-------------------------------------------------------------------- 539cdf0e10cSrcweir Beschreibung: 540cdf0e10cSrcweir --------------------------------------------------------------------*/ 541cdf0e10cSrcweir 542cdf0e10cSrcweir sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const 543cdf0e10cSrcweir { 544cdf0e10cSrcweir return pModuleConfig->IsInsTblFormatNum(bHTML); 545cdf0e10cSrcweir } 546cdf0e10cSrcweir 547cdf0e10cSrcweir sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const 548cdf0e10cSrcweir { 549cdf0e10cSrcweir return pModuleConfig->IsInsTblChangeNumFormat(bHTML); 550cdf0e10cSrcweir } 551cdf0e10cSrcweir 552cdf0e10cSrcweir /*-------------------------------------------------------------------- 553cdf0e10cSrcweir Beschreibung: 554cdf0e10cSrcweir --------------------------------------------------------------------*/ 555cdf0e10cSrcweir 556cdf0e10cSrcweir sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const 557cdf0e10cSrcweir { 558cdf0e10cSrcweir return pModuleConfig->IsInsTblAlignNum(bHTML); 559cdf0e10cSrcweir } 560cdf0e10cSrcweir 561cdf0e10cSrcweir /*-------------------------------------------------------------------- 562cdf0e10cSrcweir Beschreibung: 563cdf0e10cSrcweir --------------------------------------------------------------------*/ 564cdf0e10cSrcweir 565cdf0e10cSrcweir const Color &SwModule::GetRedlineMarkColor() 566cdf0e10cSrcweir { 567cdf0e10cSrcweir return pModuleConfig->GetMarkAlignColor(); 568cdf0e10cSrcweir } 569cdf0e10cSrcweir 570cdf0e10cSrcweir /*-----------------03.03.98 16:47------------------- 571cdf0e10cSrcweir 572cdf0e10cSrcweir --------------------------------------------------*/ 573cdf0e10cSrcweir const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir return GetUsrPref( bWeb ); 576cdf0e10cSrcweir } 577cdf0e10cSrcweir 578cdf0e10cSrcweir // returne den definierten DocStat - WordDelimiter 579cdf0e10cSrcweir const String& SwModule::GetDocStatWordDelim() const 580cdf0e10cSrcweir { 581cdf0e10cSrcweir return pModuleConfig->GetWordDelimiter(); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir /* --------------------------------------------------------------------------- 584cdf0e10cSrcweir 585cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 586cdf0e10cSrcweir // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export) 587cdf0e10cSrcweir sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const 588cdf0e10cSrcweir { 589cdf0e10cSrcweir SwMasterUsrPref* pPref; 590cdf0e10cSrcweir if(bWeb) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir if(!pWebUsrPref) 593cdf0e10cSrcweir GetUsrPref(sal_True); 594cdf0e10cSrcweir pPref = pWebUsrPref; 595cdf0e10cSrcweir } 596cdf0e10cSrcweir else 597cdf0e10cSrcweir { 598cdf0e10cSrcweir if(!pUsrPref) 599cdf0e10cSrcweir GetUsrPref(sal_False); 600cdf0e10cSrcweir pPref = pUsrPref; 601cdf0e10cSrcweir } 602cdf0e10cSrcweir return static_cast< sal_uInt16 >(pPref->GetMetric()); 603cdf0e10cSrcweir } 604cdf0e10cSrcweir /* --------------------------------------------------------------------------- 605cdf0e10cSrcweir 606cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 607cdf0e10cSrcweir // Update-Stati durchreichen 608cdf0e10cSrcweir sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const 609cdf0e10cSrcweir { 610cdf0e10cSrcweir if(!pUsrPref) 611cdf0e10cSrcweir GetUsrPref(sal_False); 612cdf0e10cSrcweir return (sal_uInt16)pUsrPref->GetUpdateLinkMode(); 613cdf0e10cSrcweir } 614cdf0e10cSrcweir /* --------------------------------------------------------------------------- 615cdf0e10cSrcweir 616cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 617cdf0e10cSrcweir SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const 618cdf0e10cSrcweir { 619cdf0e10cSrcweir if(!pUsrPref) 620cdf0e10cSrcweir GetUsrPref(sal_False); 621cdf0e10cSrcweir return pUsrPref->GetFldUpdateFlags(); 622cdf0e10cSrcweir } 623cdf0e10cSrcweir /* -----------------------------28.09.00 14:18-------------------------------- 624cdf0e10cSrcweir 625cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 626cdf0e10cSrcweir void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir if(!pUsrPref) 629cdf0e10cSrcweir GetUsrPref(sal_False); 630cdf0e10cSrcweir pUsrPref->SetFldUpdateFlags(eFldFlags); 631cdf0e10cSrcweir } 632cdf0e10cSrcweir /* -----------------------------28.09.00 14:18-------------------------------- 633cdf0e10cSrcweir 634cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 635cdf0e10cSrcweir void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode) 636cdf0e10cSrcweir { 637cdf0e10cSrcweir if(!pUsrPref) 638cdf0e10cSrcweir GetUsrPref(sal_False); 639cdf0e10cSrcweir pUsrPref->SetUpdateLinkMode(nNewLinkMode); 640cdf0e10cSrcweir } 641cdf0e10cSrcweir /* --------------------------------------------------------------------------- 642cdf0e10cSrcweir 643cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 644cdf0e10cSrcweir void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling, 645cdf0e10cSrcweir sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags ) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain; 648cdf0e10cSrcweir sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain; 649cdf0e10cSrcweir if( bOnlineSpelling || bInvalid ) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir TypeId aType = TYPE(SwDocShell); 652cdf0e10cSrcweir for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType); 653cdf0e10cSrcweir pDocSh; 654cdf0e10cSrcweir pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) ) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir SwDoc* pTmp = pDocSh->GetDoc(); 657cdf0e10cSrcweir if ( pTmp->GetCurrentViewShell() ) //swmod 071108//swmod 071225 658cdf0e10cSrcweir { 659cdf0e10cSrcweir pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags ); 660cdf0e10cSrcweir ViewShell* pViewShell = 0; 661cdf0e10cSrcweir pTmp->GetEditShell( &pViewShell ); 662cdf0e10cSrcweir if ( bSmartTags && pViewShell && pViewShell->GetWin() ) 663cdf0e10cSrcweir pViewShell->GetWin()->Invalidate(); 664cdf0e10cSrcweir } 665cdf0e10cSrcweir } 666cdf0e10cSrcweir // pSpell->SetSpellWrongAgain( sal_False ); 667cdf0e10cSrcweir // pSpell->SetSpellAllAgain( sal_False ); 668cdf0e10cSrcweir } 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode) 672cdf0e10cSrcweir { 673cdf0e10cSrcweir if(!pUsrPref) 674cdf0e10cSrcweir GetUsrPref(sal_False); 675cdf0e10cSrcweir pUsrPref->SetDefaultPageMode(bIsSquaredPageMode); 676cdf0e10cSrcweir } 677