1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #define NAVIPI_CXX 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers 36*cdf0e10cSrcweir #include <tools/list.hxx> 37*cdf0e10cSrcweir #include <svl/urlbmk.hxx> 38*cdf0e10cSrcweir #include <svl/stritem.hxx> 39*cdf0e10cSrcweir #include <svtools/filter.hxx> 40*cdf0e10cSrcweir #include <svl/urihelper.hxx> 41*cdf0e10cSrcweir #include <sot/formats.hxx> 42*cdf0e10cSrcweir #include <sot/filelist.hxx> 43*cdf0e10cSrcweir #include <sfx2/event.hxx> 44*cdf0e10cSrcweir #include <sfx2/imgmgr.hxx> 45*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 46*cdf0e10cSrcweir #include <sfx2/dockwin.hxx> 47*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 48*cdf0e10cSrcweir #include <swtypes.hxx> // fuer Pathfinder 49*cdf0e10cSrcweir #include <errhdl.hxx> 50*cdf0e10cSrcweir #include <swmodule.hxx> 51*cdf0e10cSrcweir #ifndef _VIEW_HXX 52*cdf0e10cSrcweir #include <view.hxx> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #include <navicfg.hxx> 55*cdf0e10cSrcweir #include <wrtsh.hxx> 56*cdf0e10cSrcweir #ifndef _DOCSH_HXX 57*cdf0e10cSrcweir #include <docsh.hxx> 58*cdf0e10cSrcweir #endif 59*cdf0e10cSrcweir #include <actctrl.hxx> 60*cdf0e10cSrcweir #include <IMark.hxx> 61*cdf0e10cSrcweir #include <navipi.hxx> 62*cdf0e10cSrcweir #include <content.hxx> 63*cdf0e10cSrcweir #include <workctrl.hxx> 64*cdf0e10cSrcweir #include <section.hxx> 65*cdf0e10cSrcweir #include <edtwin.hxx> 66*cdf0e10cSrcweir #include <sfx2/app.hxx> 67*cdf0e10cSrcweir #ifndef _CMDID_H 68*cdf0e10cSrcweir #include <cmdid.h> 69*cdf0e10cSrcweir #endif 70*cdf0e10cSrcweir #ifndef _HELPID_H 71*cdf0e10cSrcweir #include <helpid.h> 72*cdf0e10cSrcweir #endif 73*cdf0e10cSrcweir #ifndef _RIBBAR_HRC 74*cdf0e10cSrcweir #include <ribbar.hrc> 75*cdf0e10cSrcweir #endif 76*cdf0e10cSrcweir #ifndef _NAVIPI_HRC 77*cdf0e10cSrcweir #include <navipi.hrc> 78*cdf0e10cSrcweir #endif 79*cdf0e10cSrcweir #ifndef _UTLUI_HRC 80*cdf0e10cSrcweir #include <utlui.hrc> 81*cdf0e10cSrcweir #endif 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir #include "access.hrc" 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #include <unomid.h> 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir #define PAGE_CHANGE_TIMEOUT 1000 //Timeout fuer Seitenwechsel 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir #define JUMP_TYPE_TBL 0 91*cdf0e10cSrcweir #define JUMP_TYPE_FRM 1 92*cdf0e10cSrcweir #define JUMP_TYPE_GRF 2 93*cdf0e10cSrcweir #define JUMP_TYPE_REG 3 94*cdf0e10cSrcweir #define JUMP_TYPE_BKM 4 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir // Version fuer Konfiguration 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir #define NAVI_VERSION0 0 99*cdf0e10cSrcweir #define NAVI_VERSION1 1 100*cdf0e10cSrcweir #define NAVI_VERSION2 2 // bIsGlobalActive 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir #define NAVI_CONFIG_VERSION NAVI_VERSION2 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 105*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW_CONTEXT( SwNavigationChild, SID_NAVIGATOR, SwView ) 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir /*------------------------------------------------------------------------ 110*cdf0e10cSrcweir Bechreibung: Steuerzeichen aus dem Outline-Entry filtern 111*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir void SwNavigationPI::CleanEntry( String& rEntry ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir sal_uInt16 i = rEntry.Len(); 116*cdf0e10cSrcweir if( i ) 117*cdf0e10cSrcweir for( sal_Unicode* pStr = rEntry.GetBufferAccess(); i; --i, ++pStr ) 118*cdf0e10cSrcweir if( *pStr == 10 || *pStr == 9 ) 119*cdf0e10cSrcweir *pStr = 0x20; 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir /*------------------------------------------------------------------------ 122*cdf0e10cSrcweir Beschreibung: Ausfuehrung der Drag-Operation 123*cdf0e10cSrcweir mit und ohne Childs 124*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir void SwNavigationPI::MoveOutline(sal_uInt16 nSource, sal_uInt16 nTarget, 127*cdf0e10cSrcweir sal_Bool bWithChilds) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir SwView *pView = GetCreateView(); 130*cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell(); 131*cdf0e10cSrcweir if(nTarget < nSource || nTarget == USHRT_MAX) 132*cdf0e10cSrcweir nTarget ++; 133*cdf0e10cSrcweir if ( rSh.IsOutlineMovable( nSource )) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir short nMove = nTarget-nSource; //( nDir<0 ) ? 1 : 0 ; 137*cdf0e10cSrcweir rSh.GotoOutline(nSource); 138*cdf0e10cSrcweir if (bWithChilds) 139*cdf0e10cSrcweir rSh.MakeOutlineSel(nSource, nSource, sal_True); 140*cdf0e10cSrcweir // Die selektierten Children zaehlen bei der Bewegung vorwaerts nicht mit 141*cdf0e10cSrcweir sal_uInt16 nLastOutlinePos = rSh.GetOutlinePos(MAXLEVEL); 142*cdf0e10cSrcweir if(bWithChilds && nMove > 1 && 143*cdf0e10cSrcweir nLastOutlinePos < nTarget) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir if(!rSh.IsCrsrPtAtEnd()) 146*cdf0e10cSrcweir rSh.SwapPam(); 147*cdf0e10cSrcweir nMove -= nLastOutlinePos - nSource; 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir if(!bWithChilds || nMove < 1 || nLastOutlinePos < nTarget ) 150*cdf0e10cSrcweir rSh.MoveOutlinePara( nMove ); 151*cdf0e10cSrcweir rSh.ClearMark(); 152*cdf0e10cSrcweir rSh.GotoOutline( nSource + nMove); 153*cdf0e10cSrcweir FillBox(); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir /*------------------------------------------------------------------------ 160*cdf0e10cSrcweir Beschreibung: Nach Goto einen Status Rahmenselektion aufheben 161*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir void lcl_UnSelectFrm(SwWrtShell *pSh) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir if (pSh->IsFrmSelected()) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir pSh->UnSelectFrm(); 169*cdf0e10cSrcweir pSh->LeaveSelFrmMode(); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir /*------------------------------------------------------------------------ 174*cdf0e10cSrcweir Beschreibung: Select der Documentanzeige 175*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox ) 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir int nEntryIdx = pBox->GetSelectEntryPos(); 181*cdf0e10cSrcweir SwView *pView ; 182*cdf0e10cSrcweir pView = SwModule::GetFirstView(); 183*cdf0e10cSrcweir while (nEntryIdx-- && pView) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir pView = SwModule::GetNextView(pView); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir if(!pView) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir nEntryIdx == 0 ? 190*cdf0e10cSrcweir aContentTree.ShowHiddenShell(): 191*cdf0e10cSrcweir aContentTree.ShowActualView(); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir else 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir aContentTree.SetConstantShell(pView->GetWrtShellPtr()); 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir return 0; 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir /*------------------------------------------------------------------------ 203*cdf0e10cSrcweir Beschreibung: Fuellen der ListBox fuer Outline Sicht oder Dokumente 204*cdf0e10cSrcweir Der PI wird auf volle Groesse gesetzt 205*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir void SwNavigationPI::FillBox() 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir if(pContentWrtShell) 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir aContentTree.SetHiddenShell( pContentWrtShell ); 213*cdf0e10cSrcweir aContentTree.Display( sal_False ); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir else 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir SwView *pView = GetCreateView(); 218*cdf0e10cSrcweir if(!pView) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir aContentTree.SetActiveShell(0); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir else if( pView != pActContView) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir SwWrtShell* pWrtShell = pView->GetWrtShellPtr(); 225*cdf0e10cSrcweir aContentTree.SetActiveShell(pWrtShell); 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir else 228*cdf0e10cSrcweir aContentTree.Display( sal_True ); 229*cdf0e10cSrcweir pActContView = pView; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir void SwNavigationPI::UsePage(SwWrtShell *pSh) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir if (!pSh) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir SwView *pView = GetCreateView(); 239*cdf0e10cSrcweir pSh = pView ? &pView->GetWrtShell() : 0; 240*cdf0e10cSrcweir GetPageEdit().SetValue(1); 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir if (pSh) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir const sal_uInt16 nPageCnt = pSh->GetPageCnt(); 245*cdf0e10cSrcweir sal_uInt16 nPhyPage, nVirPage; 246*cdf0e10cSrcweir pSh->GetPageNum(nPhyPage, nVirPage); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir GetPageEdit().SetMax(nPageCnt); 249*cdf0e10cSrcweir GetPageEdit().SetLast(nPageCnt); 250*cdf0e10cSrcweir GetPageEdit().SetValue(nPhyPage); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir /*------------------------------------------------------------------------ 255*cdf0e10cSrcweir Beschreibung: SelectHandler der Toolboxen 256*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir const sal_uInt16 nCurrItemId = pBox->GetCurItemId(); 262*cdf0e10cSrcweir SwView *pView = GetCreateView(); 263*cdf0e10cSrcweir if (!pView) 264*cdf0e10cSrcweir return 1; 265*cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell(); 266*cdf0e10cSrcweir //MouseModifier fuer Outline-Move besorgen 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir //Standard: Unterebenen werden mitgenommen 269*cdf0e10cSrcweir // mit Ctrl Unterebenen nicht mitnehmen 270*cdf0e10cSrcweir sal_Bool bOutlineWithChilds = ( KEY_MOD1 != pBox->GetModifier()); 271*cdf0e10cSrcweir int nFuncId = 0; 272*cdf0e10cSrcweir sal_Bool bFocusToDoc = sal_False; 273*cdf0e10cSrcweir switch (nCurrItemId) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir case FN_UP: 276*cdf0e10cSrcweir case FN_DOWN: 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir // #i75416# move the execution of the search to an asynchronously called static link 279*cdf0e10cSrcweir bool* pbNext = new bool( FN_DOWN == nCurrItemId ); 280*cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK(pView, SwView, MoveNavigationHdl), pbNext ); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir break; 283*cdf0e10cSrcweir case FN_SHOW_ROOT: 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir aContentTree.ToggleToRoot(); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir break; 288*cdf0e10cSrcweir case FN_SHOW_CONTENT_BOX: 289*cdf0e10cSrcweir case FN_SELECT_CONTENT: 290*cdf0e10cSrcweir if(pContextWin->GetFloatingWindow()) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir if(_IsZoomedIn() ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir _ZoomOut(); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir else 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir _ZoomIn(); 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir return sal_True; 302*cdf0e10cSrcweir //break; 303*cdf0e10cSrcweir // Funktionen, die eine direkte Aktion ausloesen 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir case FN_SELECT_FOOTER: 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir rSh.MoveCrsr(); 308*cdf0e10cSrcweir const sal_uInt16 eType = rSh.GetFrmType(0,sal_False); 309*cdf0e10cSrcweir if (eType & FRMTYPE_FOOTER) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir if (rSh.EndPg()) 312*cdf0e10cSrcweir nFuncId = FN_END_OF_PAGE; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir else if (rSh.GotoFooterTxt()) 315*cdf0e10cSrcweir nFuncId = FN_TO_FOOTER; 316*cdf0e10cSrcweir bFocusToDoc = sal_True; 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir break; 319*cdf0e10cSrcweir case FN_SELECT_HEADER: 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir rSh.MoveCrsr(); 322*cdf0e10cSrcweir const sal_uInt16 eType = rSh.GetFrmType(0,sal_False); 323*cdf0e10cSrcweir if (eType & FRMTYPE_HEADER) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir if (rSh.SttPg()) 326*cdf0e10cSrcweir nFuncId = FN_START_OF_PAGE; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir else if (rSh.GotoHeaderTxt()) 329*cdf0e10cSrcweir nFuncId = FN_TO_HEADER; 330*cdf0e10cSrcweir bFocusToDoc = sal_True; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir break; 333*cdf0e10cSrcweir case FN_SELECT_FOOTNOTE: 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir rSh.MoveCrsr(); 336*cdf0e10cSrcweir const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_False); 337*cdf0e10cSrcweir // aus Fussnote zum Anker springen 338*cdf0e10cSrcweir if (eFrmType & FRMTYPE_FOOTNOTE) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir if (rSh.GotoFtnAnchor()) 341*cdf0e10cSrcweir nFuncId = FN_FOOTNOTE_TO_ANCHOR; 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir // andernfalls zuerst zum Fussnotentext springen; geht 344*cdf0e10cSrcweir // dies nicht, zur naechten Fussnote; geht auch dies 345*cdf0e10cSrcweir // nicht, zur vorhergehenden Fussnote 346*cdf0e10cSrcweir else 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir if (rSh.GotoFtnTxt()) 349*cdf0e10cSrcweir nFuncId = FN_FOOTNOTE_TO_ANCHOR; 350*cdf0e10cSrcweir else if (rSh.GotoNextFtnAnchor()) 351*cdf0e10cSrcweir nFuncId = FN_NEXT_FOOTNOTE; 352*cdf0e10cSrcweir else if (rSh.GotoPrevFtnAnchor()) 353*cdf0e10cSrcweir nFuncId = FN_PREV_FOOTNOTE; 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir bFocusToDoc = sal_True; 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir break; 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir case FN_SELECT_SET_AUTO_BOOKMARK: 360*cdf0e10cSrcweir MakeMark(); 361*cdf0e10cSrcweir break; 362*cdf0e10cSrcweir case FN_ITEM_DOWN: 363*cdf0e10cSrcweir case FN_ITEM_UP: 364*cdf0e10cSrcweir case FN_ITEM_LEFT: 365*cdf0e10cSrcweir case FN_ITEM_RIGHT: 366*cdf0e10cSrcweir case FN_GLOBAL_EDIT: 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir if(IsGlobalMode()) 369*cdf0e10cSrcweir aGlobalTree.ExecCommand(nCurrItemId); 370*cdf0e10cSrcweir else 371*cdf0e10cSrcweir aContentTree.ExecCommand(nCurrItemId, bOutlineWithChilds); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir break; 374*cdf0e10cSrcweir case FN_GLOBAL_SWITCH: 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir ToggleTree(); 377*cdf0e10cSrcweir pConfig->SetGlobalActive(IsGlobalMode()); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir break; 380*cdf0e10cSrcweir case FN_GLOBAL_SAVE_CONTENT: 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir sal_Bool bSave = rSh.IsGlblDocSaveLinks(); 383*cdf0e10cSrcweir rSh.SetGlblDocSaveLinks( !bSave ); 384*cdf0e10cSrcweir pBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, !bSave ); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir break; 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir if (nFuncId) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir lcl_UnSelectFrm(&rSh); 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir if(bFocusToDoc) 394*cdf0e10cSrcweir pView->GetEditWin().GrabFocus(); 395*cdf0e10cSrcweir return sal_True; 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir /*------------------------------------------------------------------------ 398*cdf0e10cSrcweir Beschreibung: ClickHandler der Toolboxen 399*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox ) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir const sal_uInt16 nCurrItemId = pBox->GetCurItemId(); 405*cdf0e10cSrcweir switch (nCurrItemId) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir case FN_GLOBAL_UPDATE: 408*cdf0e10cSrcweir case FN_GLOBAL_OPEN: 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir aGlobalTree.TbxMenuHdl(nCurrItemId, pBox); 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir break; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir return sal_True; 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir /*-----------------13.07.04 ------------------- 419*cdf0e10cSrcweir ----------------------------------------------*/ 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox ) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir const sal_uInt16 nCurrItemId = pBox->GetCurItemId(); 424*cdf0e10cSrcweir switch (nCurrItemId) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir case FN_CREATE_NAVIGATION: 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir CreateNavigationTool(pBox->GetItemRect(FN_CREATE_NAVIGATION), sal_True); 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir break; 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir case FN_DROP_REGION: 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir static const char* aHIDs[] = 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir HID_NAVI_DRAG_HYP, 437*cdf0e10cSrcweir HID_NAVI_DRAG_LINK, 438*cdf0e10cSrcweir HID_NAVI_DRAG_COPY, 439*cdf0e10cSrcweir }; 440*cdf0e10cSrcweir PopupMenu *pMenu = new PopupMenu; 441*cdf0e10cSrcweir for (sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir pMenu->InsertItem( i + 1, aContextArr[i] ); 444*cdf0e10cSrcweir pMenu->SetHelpId(i + 1, aHIDs[i]); 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir pMenu->CheckItem( nRegionMode + 1 ); 447*cdf0e10cSrcweir pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl)); 448*cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_True ); 449*cdf0e10cSrcweir pMenu->Execute( pBox, 450*cdf0e10cSrcweir pBox->GetItemRect(FN_DROP_REGION), 451*cdf0e10cSrcweir POPUPMENU_EXECUTE_DOWN ); 452*cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_False ); 453*cdf0e10cSrcweir pBox->EndSelection(); 454*cdf0e10cSrcweir delete pMenu; 455*cdf0e10cSrcweir pBox->Invalidate(); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir break; 458*cdf0e10cSrcweir case FN_OUTLINE_LEVEL: 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir PopupMenu *pMenu = new PopupMenu; 461*cdf0e10cSrcweir for (sal_uInt16 i = 101; i <= 100 + MAXLEVEL; i++) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir pMenu->InsertItem( i, String::CreateFromInt32(i - 100) ); 464*cdf0e10cSrcweir pMenu->SetHelpId( i, HID_NAVI_OUTLINES ); 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 ); 467*cdf0e10cSrcweir pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl)); 468*cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_True ); 469*cdf0e10cSrcweir pMenu->Execute( pBox, 470*cdf0e10cSrcweir pBox->GetItemRect(FN_OUTLINE_LEVEL), 471*cdf0e10cSrcweir POPUPMENU_EXECUTE_DOWN ); 472*cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_False ); 473*cdf0e10cSrcweir delete pMenu; 474*cdf0e10cSrcweir pBox->EndSelection(); 475*cdf0e10cSrcweir pBox->Invalidate(); 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir break; 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir return sal_True; 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir /*-----------------13.07.04 ------------------- 483*cdf0e10cSrcweir --------------------------------------------------*/ 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir SwNavHelpToolBox::SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId) : 486*cdf0e10cSrcweir SwHelpToolBox(pParent, rResId) 487*cdf0e10cSrcweir {} 488*cdf0e10cSrcweir /*-----------------19.06.97 09:09------------------- 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir --------------------------------------------------*/ 491*cdf0e10cSrcweir void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir if(rEvt.GetButtons() == MOUSE_LEFT && 494*cdf0e10cSrcweir FN_CREATE_NAVIGATION == GetItemId(rEvt.GetPosPixel())) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir ((SwNavigationPI*)GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION), sal_False); 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir else 499*cdf0e10cSrcweir SwHelpToolBox::MouseButtonDown(rEvt); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir /* -----------------------------12.03.2002 16:55------------------------------ 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 504*cdf0e10cSrcweir void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, sal_Bool bSetFocus) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir // SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings(); 507*cdf0e10cSrcweir // rBind.ENTERREGISTRATIONS(); 508*cdf0e10cSrcweir Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface(); 509*cdf0e10cSrcweir SwScrollNaviPopup* pPopup = new 510*cdf0e10cSrcweir SwScrollNaviPopup(FN_SCROLL_NAVIGATION, 511*cdf0e10cSrcweir xFrame ); 512*cdf0e10cSrcweir // rBind.LEAVEREGISTRATIONS(); 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir Rectangle aRect(rRect); 515*cdf0e10cSrcweir Point aT1 = aRect.TopLeft(); 516*cdf0e10cSrcweir aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1))); 517*cdf0e10cSrcweir aRect.SetPos(aT1); 518*cdf0e10cSrcweir pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF); 519*cdf0e10cSrcweir SetPopupWindow( pPopup ); 520*cdf0e10cSrcweir if(bSetFocus) 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir pPopup->EndPopupMode(FLOATWIN_POPUPMODEEND_TEAROFF); 523*cdf0e10cSrcweir pPopup->GrabFocus(); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir /*-----------------19.06.97 10:12------------------- 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir --------------------------------------------------*/ 530*cdf0e10cSrcweir void SwNavHelpToolBox::RequestHelp( const HelpEvent& rHEvt ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir sal_uInt16 nItemId = GetItemId(ScreenToOutputPixel(rHEvt.GetMousePosPixel())); 533*cdf0e10cSrcweir if( FN_UP == nItemId || FN_DOWN == nItemId ) 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir SetItemText(nItemId, SwScrollNaviPopup::GetQuickHelpText((FN_DOWN == nItemId))); 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir SwHelpToolBox::RequestHelp(rHEvt); 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir /*------------------------------------------------------------------------ 541*cdf0e10cSrcweir Beschreibung: Action-Handler Edit; wechselt auf die Seite, wenn 542*cdf0e10cSrcweir nicht Gliederungssicht angeschaltet ist. 543*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, EditAction, NumEditAction *, pEdit ) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir SwView *pView = GetCreateView(); 549*cdf0e10cSrcweir if (pView) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir if(aPageChgTimer.IsActive()) 552*cdf0e10cSrcweir aPageChgTimer.Stop(); 553*cdf0e10cSrcweir pCreateView->GetWrtShell().GotoPage((sal_uInt16)pEdit->GetValue(), sal_True); 554*cdf0e10cSrcweir pCreateView->GetEditWin().GrabFocus(); 555*cdf0e10cSrcweir pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE); 556*cdf0e10cSrcweir } 557*cdf0e10cSrcweir return 0; 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir /*------------------------------------------------------------------------ 561*cdf0e10cSrcweir Beschreibung: Falls die Seite eingestellt werden kann, wird hier 562*cdf0e10cSrcweir das Maximum gesetzt. 563*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, EditGetFocus, NumEditAction *, pEdit ) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir SwView *pView = GetCreateView(); 569*cdf0e10cSrcweir if (!pView) 570*cdf0e10cSrcweir return 0; 571*cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell(); 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir const sal_uInt16 nPageCnt = rSh.GetPageCnt(); 574*cdf0e10cSrcweir pEdit->SetMax(nPageCnt); 575*cdf0e10cSrcweir pEdit->SetLast(nPageCnt); 576*cdf0e10cSrcweir return 0; 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir /*------------------------------------------------------------------------ 580*cdf0e10cSrcweir Beschreibung: 581*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir sal_Bool SwNavigationPI::Close() 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir SfxViewFrame* pVFrame = pCreateView->GetViewFrame(); 586*cdf0e10cSrcweir pVFrame->GetBindings().Invalidate(SID_NAVIGATOR); 587*cdf0e10cSrcweir pVFrame->GetDispatcher()->Execute(SID_NAVIGATOR); 588*cdf0e10cSrcweir return sal_True; 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir /*------------------------------------------------------------------------ 592*cdf0e10cSrcweir Beschreibung: Setzen einer automatischen Marke 593*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir void SwNavigationPI::MakeMark() 597*cdf0e10cSrcweir { 598*cdf0e10cSrcweir SwView *pView = GetCreateView(); 599*cdf0e10cSrcweir if (!pView) return; 600*cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell(); 601*cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir // collect and sort navigator reminder names 604*cdf0e10cSrcweir ::std::vector< ::rtl::OUString > vNavMarkNames; 605*cdf0e10cSrcweir for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); 606*cdf0e10cSrcweir ppMark != pMarkAccess->getMarksEnd(); 607*cdf0e10cSrcweir ppMark++) 608*cdf0e10cSrcweir if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER ) 609*cdf0e10cSrcweir vNavMarkNames.push_back(ppMark->get()->GetName()); 610*cdf0e10cSrcweir ::std::sort(vNavMarkNames.begin(), vNavMarkNames.end()); 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir // we are maxed out and delete one 613*cdf0e10cSrcweir // nAutoMarkIdx rotates through the available MarkNames 614*cdf0e10cSrcweir // this assumes that IDocumentMarkAccess generates Names in ascending order 615*cdf0e10cSrcweir if(vNavMarkNames.size() == MAX_MARKS) 616*cdf0e10cSrcweir pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[nAutoMarkIdx])); 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir rSh.SetBookmark(KeyCode(), ::rtl::OUString(), ::rtl::OUString(), IDocumentMarkAccess::NAVIGATOR_REMINDER); 619*cdf0e10cSrcweir SwView::SetActMark( nAutoMarkIdx ); 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir if(++nAutoMarkIdx == MAX_MARKS) 622*cdf0e10cSrcweir nAutoMarkIdx = 0; 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir /*------------------------------------------------------------------------ 626*cdf0e10cSrcweir Beschreibung: 627*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir void SwNavigationPI::GotoPage() 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp()) 632*cdf0e10cSrcweir _ZoomIn(); 633*cdf0e10cSrcweir if(IsGlobalMode()) 634*cdf0e10cSrcweir ToggleTree(); 635*cdf0e10cSrcweir UsePage(0); 636*cdf0e10cSrcweir GetPageEdit().GrabFocus(); 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir /*------------------------------------------------------------------------ 640*cdf0e10cSrcweir Beschreibung: 641*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir void SwNavigationPI::_ZoomOut() 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir if (_IsZoomedIn()) 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); 648*cdf0e10cSrcweir bIsZoomedIn = sal_False; 649*cdf0e10cSrcweir Size aSz(GetOutputSizePixel()); 650*cdf0e10cSrcweir aSz.Height() = nZoomOut; 651*cdf0e10cSrcweir Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); 652*cdf0e10cSrcweir ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( 653*cdf0e10cSrcweir aMinOutSizePixel.Width(),nZoomOutInit)); 654*cdf0e10cSrcweir pFloat->SetOutputSizePixel(aSz); 655*cdf0e10cSrcweir FillBox(); 656*cdf0e10cSrcweir if(IsGlobalMode()) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir aGlobalTree.ShowTree(); 659*cdf0e10cSrcweir } 660*cdf0e10cSrcweir else 661*cdf0e10cSrcweir { 662*cdf0e10cSrcweir aContentTree.ShowTree(); 663*cdf0e10cSrcweir aDocListBox.Show(); 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir SvLBoxEntry* pFirst = aContentTree.FirstSelected(); 666*cdf0e10cSrcweir if(pFirst) 667*cdf0e10cSrcweir aContentTree.Select(pFirst, sal_True); // toolbox enablen 668*cdf0e10cSrcweir pConfig->SetSmall( sal_False ); 669*cdf0e10cSrcweir aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX); 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir /*------------------------------------------------------------------------ 674*cdf0e10cSrcweir Beschreibung: 675*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir void SwNavigationPI::_ZoomIn() 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); 680*cdf0e10cSrcweir if (pFloat && 681*cdf0e10cSrcweir (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) 682*cdf0e10cSrcweir { 683*cdf0e10cSrcweir aContentTree.HideTree(); 684*cdf0e10cSrcweir aDocListBox.Hide(); 685*cdf0e10cSrcweir aGlobalTree.HideTree(); 686*cdf0e10cSrcweir bIsZoomedIn = sal_True; 687*cdf0e10cSrcweir Size aSz(GetOutputSizePixel()); 688*cdf0e10cSrcweir if( aSz.Height() > nZoomIn ) 689*cdf0e10cSrcweir nZoomOut = ( short ) aSz.Height(); 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir aSz.Height() = nZoomIn; 692*cdf0e10cSrcweir Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); 693*cdf0e10cSrcweir ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( 694*cdf0e10cSrcweir aMinOutSizePixel.Width(), aSz.Height())); 695*cdf0e10cSrcweir pFloat->SetOutputSizePixel(aSz); 696*cdf0e10cSrcweir SvLBoxEntry* pFirst = aContentTree.FirstSelected(); 697*cdf0e10cSrcweir if(pFirst) 698*cdf0e10cSrcweir aContentTree.Select(pFirst, sal_True); // toolbox enablen 699*cdf0e10cSrcweir pConfig->SetSmall( sal_True ); 700*cdf0e10cSrcweir aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False); 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir /*------------------------------------------------------------------------ 704*cdf0e10cSrcweir Beschreibung: 705*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir void SwNavigationPI::Resize() 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir Window* pParent = GetParent(); 710*cdf0e10cSrcweir FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow(); 711*cdf0e10cSrcweir Size aNewSize; 712*cdf0e10cSrcweir if( !_IsZoomedIn() ) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir //change the minimum width depending on the dock status 715*cdf0e10cSrcweir Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel(); 716*cdf0e10cSrcweir if( pFloat) 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir aNewSize = pFloat->GetOutputSizePixel(); 719*cdf0e10cSrcweir aMinOutSizePixel.Width() = nWishWidth; 720*cdf0e10cSrcweir aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit; 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir else 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir aNewSize = pParent->GetOutputSizePixel(); 725*cdf0e10cSrcweir aMinOutSizePixel.Width() = 0; 726*cdf0e10cSrcweir aMinOutSizePixel.Height() = 0; 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel); 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir const Point aPos = aContentTree.GetPosPixel(); 731*cdf0e10cSrcweir Point aLBPos = aDocListBox.GetPosPixel(); 732*cdf0e10cSrcweir long nDist = aPos.X(); 733*cdf0e10cSrcweir aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist); 734*cdf0e10cSrcweir aNewSize.Width() -= 2 * nDist; 735*cdf0e10cSrcweir aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist; 736*cdf0e10cSrcweir aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() ); 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir Size aDocLBSz = aDocListBox.GetSizePixel(); 739*cdf0e10cSrcweir aDocLBSz.Width() = aNewSize.Width(); 740*cdf0e10cSrcweir if(aNewSize.Height() < 0) 741*cdf0e10cSrcweir aDocLBSz.Height() = 0; 742*cdf0e10cSrcweir else 743*cdf0e10cSrcweir aDocLBSz.Height() = nDocLBIniHeight; 744*cdf0e10cSrcweir aContentTree.SetSizePixel(aNewSize); 745*cdf0e10cSrcweir // GlobalTree faengt weiter oben an und reicht bis ganz unten 746*cdf0e10cSrcweir aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y()); 747*cdf0e10cSrcweir aGlobalTree.SetSizePixel(aNewSize); 748*cdf0e10cSrcweir aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(), 749*cdf0e10cSrcweir aDocLBSz.Width(), aDocLBSz.Height(), 750*cdf0e10cSrcweir WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir /*------------------------------------------------------------------------ 757*cdf0e10cSrcweir Beschreibung: 758*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, 761*cdf0e10cSrcweir SfxChildWindowContext* pCw, 762*cdf0e10cSrcweir Window* pParent) : 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir Window( pParent, SW_RES(DLG_NAVIGATION_PI)), 765*cdf0e10cSrcweir SfxControllerItem( SID_DOCFULLNAME, *_pBindings ), 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir aContentToolBox(this, SW_RES(TB_CONTENT)), 768*cdf0e10cSrcweir aGlobalToolBox(this, SW_RES(TB_GLOBAL)), 769*cdf0e10cSrcweir aContentImageList(SW_RES(IL_CONTENT)), 770*cdf0e10cSrcweir aContentImageListH(SW_RES(ILH_CONTENT)), 771*cdf0e10cSrcweir aContentTree(this, SW_RES(TL_CONTENT)), 772*cdf0e10cSrcweir aGlobalTree(this, SW_RES(TL_GLOBAL)), 773*cdf0e10cSrcweir aDocListBox(this, SW_RES(LB_DOCS)), 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir pxObjectShell(0), 776*cdf0e10cSrcweir pContentView(0), 777*cdf0e10cSrcweir pContentWrtShell(0), 778*cdf0e10cSrcweir pActContView(0), 779*cdf0e10cSrcweir pCreateView(0), 780*cdf0e10cSrcweir pPopupWindow(0), 781*cdf0e10cSrcweir pFloatingWindow(0), 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir pContextWin(pCw), 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir pConfig(SW_MOD()->GetNavigationConfig()), 786*cdf0e10cSrcweir rBindings(*_pBindings), 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir nWishWidth(0), 789*cdf0e10cSrcweir nAutoMarkIdx(1), 790*cdf0e10cSrcweir nRegionMode(REGION_MODE_NONE), 791*cdf0e10cSrcweir 792*cdf0e10cSrcweir bSmallMode(sal_False), 793*cdf0e10cSrcweir bIsZoomedIn(sal_False), 794*cdf0e10cSrcweir bPageCtrlsVisible(sal_False), 795*cdf0e10cSrcweir bGlobalMode(sal_False) 796*cdf0e10cSrcweir { 797*cdf0e10cSrcweir GetCreateView(); 798*cdf0e10cSrcweir InitImageList(); 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX ); 801*cdf0e10cSrcweir aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX); 802*cdf0e10cSrcweir aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX ); 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir nDocLBIniHeight = aDocListBox.GetSizePixel().Height(); 805*cdf0e10cSrcweir nZoomOutInit = nZoomOut = Resource::ReadShortRes(); 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir //NumericField in die Toolbox einfuegen 808*cdf0e10cSrcweir NumEditAction* pEdit = new NumEditAction( 809*cdf0e10cSrcweir &aContentToolBox, SW_RES(NF_PAGE )); 810*cdf0e10cSrcweir pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction)); 811*cdf0e10cSrcweir pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus)); 812*cdf0e10cSrcweir pEdit->SetAccessibleName(pEdit->GetQuickHelpText()); 813*cdf0e10cSrcweir pEdit->SetUpHdl(LINK(this, SwNavigationPI, PageEditModifyHdl)); 814*cdf0e10cSrcweir pEdit->SetDownHdl(LINK(this, SwNavigationPI, PageEditModifyHdl)); 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir bPageCtrlsVisible = sal_True; 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir // Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SHOW_ROOT); 819*cdf0e10cSrcweir // sal_uInt16 nWidth = 2 * (sal_uInt16)aFirstRect.Left(); 820*cdf0e10cSrcweir //doppelte Separatoren sind nicht erlaubt, also muss 821*cdf0e10cSrcweir //die passende Groesse anders ermittelt werden 822*cdf0e10cSrcweir Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE); 823*cdf0e10cSrcweir Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER); 824*cdf0e10cSrcweir sal_uInt16 nWidth = sal_uInt16(aFirstRect.Left() - aSecondRect.Left()); 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir Size aItemWinSize( nWidth , aFirstRect.Bottom() - aFirstRect.Top() ); 827*cdf0e10cSrcweir pEdit->SetSizePixel(aItemWinSize); 828*cdf0e10cSrcweir aContentToolBox.InsertSeparator(4); 829*cdf0e10cSrcweir aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, 0, 4); 830*cdf0e10cSrcweir aContentToolBox.InsertSeparator(4); 831*cdf0e10cSrcweir aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16); 832*cdf0e10cSrcweir aContentToolBox.ShowItem( FN_PAGENUMBER ); 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++ ) 835*cdf0e10cSrcweir { 836*cdf0e10cSrcweir aContextArr[i] = SW_RESSTR(ST_HYPERLINK + i); 837*cdf0e10cSrcweir aStatusArr[i] = SW_RESSTR(ST_STATUS_FIRST + i); 838*cdf0e10cSrcweir } 839*cdf0e10cSrcweir aStatusArr[3] = SW_RESSTR(ST_ACTIVE_VIEW); 840*cdf0e10cSrcweir FreeResource(); 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir const Size& rOutSize = GetOutputSizePixel(); 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir nZoomIn = (short)rOutSize.Height(); 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir // Make sure the toolbox has a size that fits all its contents 848*cdf0e10cSrcweir Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() ); 849*cdf0e10cSrcweir aContentToolBox.SetOutputSizePixel( aContentToolboxSize ); 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir // position listbox below toolbar and add some space 852*cdf0e10cSrcweir long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4; 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir //Der linke und rechte Rand um die Toolboxen soll gleich sein 855*cdf0e10cSrcweir nWishWidth = aContentToolboxSize.Width(); 856*cdf0e10cSrcweir nWishWidth += 2 * aContentToolBox.GetPosPixel().X(); 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow(); 859*cdf0e10cSrcweir Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0); 860*cdf0e10cSrcweir ((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize); 861*cdf0e10cSrcweir SetOutputSizePixel( Size( nWishWidth, nZoomOutInit)); 862*cdf0e10cSrcweir Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel()); 863*cdf0e10cSrcweir if( 864*cdf0e10cSrcweir ( 865*cdf0e10cSrcweir aTmpParentSize.Width() < aMinSize.Width() || 866*cdf0e10cSrcweir aTmpParentSize.Height() < aMinSize.Height() 867*cdf0e10cSrcweir ) 868*cdf0e10cSrcweir && 869*cdf0e10cSrcweir ((SfxDockingWindow*)pParent)->GetFloatingWindow() && 870*cdf0e10cSrcweir !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp() 871*cdf0e10cSrcweir ) 872*cdf0e10cSrcweir ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize); 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); 875*cdf0e10cSrcweir aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| 876*cdf0e10cSrcweir WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); 877*cdf0e10cSrcweir aContentTree.SetSpaceBetweenEntries(3); 878*cdf0e10cSrcweir aContentTree.SetSelectionMode( SINGLE_SELECTION ); 879*cdf0e10cSrcweir aContentTree.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | 880*cdf0e10cSrcweir SV_DRAGDROP_CTRL_COPY | 881*cdf0e10cSrcweir SV_DRAGDROP_ENABLE_TOP ); 882*cdf0e10cSrcweir aContentTree.EnableAsyncDrag(sal_True); 883*cdf0e10cSrcweir aContentTree.ShowTree(); 884*cdf0e10cSrcweir aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_True); 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir // TreeListBox fuer Globaldokument 887*cdf0e10cSrcweir aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); 888*cdf0e10cSrcweir aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION ); 889*cdf0e10cSrcweir aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| 890*cdf0e10cSrcweir WB_CLIPCHILDREN|WB_HSCROLL ); 891*cdf0e10cSrcweir Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel()); 892*cdf0e10cSrcweir aGlobalToolBox.SetSizePixel(aGlblSize); 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir // Handler 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl); 897*cdf0e10cSrcweir aContentToolBox.SetSelectHdl( aLk ); 898*cdf0e10cSrcweir aGlobalToolBox.SetSelectHdl( aLk ); 899*cdf0e10cSrcweir aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI, 900*cdf0e10cSrcweir DocListBoxSelectHdl)); 901*cdf0e10cSrcweir aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); 902*cdf0e10cSrcweir aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); 903*cdf0e10cSrcweir aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); 904*cdf0e10cSrcweir aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); 905*cdf0e10cSrcweir aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, sal_True); 906*cdf0e10cSrcweir 907*cdf0e10cSrcweir Font aFont(GetFont()); 908*cdf0e10cSrcweir aFont.SetWeight(WEIGHT_NORMAL); 909*cdf0e10cSrcweir GetPageEdit().SetFont(aFont); 910*cdf0e10cSrcweir aFont = aContentTree.GetFont(); 911*cdf0e10cSrcweir aFont.SetWeight(WEIGHT_NORMAL); 912*cdf0e10cSrcweir aContentTree.SetFont(aFont); 913*cdf0e10cSrcweir aGlobalTree.SetFont(aFont); 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir StartListening(*SFX_APP()); 916*cdf0e10cSrcweir if ( pCreateView ) 917*cdf0e10cSrcweir StartListening(*pCreateView); 918*cdf0e10cSrcweir SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() ); 919*cdf0e10cSrcweir pImgMan->RegisterToolBox(&aContentToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE); 920*cdf0e10cSrcweir pImgMan->RegisterToolBox(&aGlobalToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE); 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | TIB_DROPDOWNONLY ); 923*cdf0e10cSrcweir aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | TIB_DROPDOWNONLY ); 924*cdf0e10cSrcweir aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | TIB_DROPDOWNONLY ); 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir if(IsGlobalDoc()) 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir SwView *pActView = GetCreateView(); 929*cdf0e10cSrcweir aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, 930*cdf0e10cSrcweir pActView->GetWrtShellPtr()->IsGlblDocSaveLinks()); 931*cdf0e10cSrcweir if(pConfig->IsGlobalActive()) 932*cdf0e10cSrcweir ToggleTree(); 933*cdf0e10cSrcweir aGlobalTree.GrabFocus(); 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir else 936*cdf0e10cSrcweir aContentTree.GrabFocus(); 937*cdf0e10cSrcweir UsePage(0); 938*cdf0e10cSrcweir aPageChgTimer.SetTimeoutHdl(LINK(this, SwNavigationPI, ChangePageHdl)); 939*cdf0e10cSrcweir aPageChgTimer.SetTimeout(PAGE_CHANGE_TIMEOUT); 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); 942*cdf0e10cSrcweir aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); 943*cdf0e10cSrcweir aDocListBox.SetAccessibleName(aStatusArr[3]); 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir /*------------------------------------------------------------------------ 947*cdf0e10cSrcweir Beschreibung: 948*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir SwNavigationPI::~SwNavigationPI() 951*cdf0e10cSrcweir { 952*cdf0e10cSrcweir if(IsGlobalDoc() && !IsGlobalMode()) 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir SwView *pView = GetCreateView(); 955*cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell(); 956*cdf0e10cSrcweir if( !rSh.IsAllProtect() ) 957*cdf0e10cSrcweir pView->GetDocShell()->SetReadOnlyUI(sal_False); 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir 960*cdf0e10cSrcweir EndListening(*SFX_APP()); 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() ); 963*cdf0e10cSrcweir pImgMan->ReleaseToolBox(&aContentToolBox); 964*cdf0e10cSrcweir pImgMan->ReleaseToolBox(&aGlobalToolBox); 965*cdf0e10cSrcweir delete aContentToolBox.GetItemWindow(FN_PAGENUMBER); 966*cdf0e10cSrcweir aContentToolBox.Clear(); 967*cdf0e10cSrcweir if(pxObjectShell) 968*cdf0e10cSrcweir { 969*cdf0e10cSrcweir if(pxObjectShell->Is()) 970*cdf0e10cSrcweir (*pxObjectShell)->DoClose(); 971*cdf0e10cSrcweir delete pxObjectShell; 972*cdf0e10cSrcweir } 973*cdf0e10cSrcweir delete pPopupWindow; 974*cdf0e10cSrcweir delete pFloatingWindow; 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir if ( IsBound() ) 977*cdf0e10cSrcweir rBindings.Release(*this); 978*cdf0e10cSrcweir } 979*cdf0e10cSrcweir 980*cdf0e10cSrcweir /*------------------------------------------------------------------------ 981*cdf0e10cSrcweir Beschreibung: 982*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 983*cdf0e10cSrcweir 984*cdf0e10cSrcweir void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow ) 985*cdf0e10cSrcweir { 986*cdf0e10cSrcweir pPopupWindow = pWindow; 987*cdf0e10cSrcweir pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNavigationPI, PopupModeEndHdl )); 988*cdf0e10cSrcweir pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNavigationPI, ClosePopupWindow )); 989*cdf0e10cSrcweir } 990*cdf0e10cSrcweir 991*cdf0e10cSrcweir /*------------------------------------------------------------------------ 992*cdf0e10cSrcweir Beschreibung: 993*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 994*cdf0e10cSrcweir 995*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PopupModeEndHdl, void *, EMPTYARG ) 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir if ( pPopupWindow->IsVisible() ) 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir // Replace floating window with popup window and destroy 1000*cdf0e10cSrcweir // floating window instance. 1001*cdf0e10cSrcweir delete pFloatingWindow; 1002*cdf0e10cSrcweir pFloatingWindow = pPopupWindow; 1003*cdf0e10cSrcweir pPopupWindow = 0; 1004*cdf0e10cSrcweir } 1005*cdf0e10cSrcweir else 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir // Popup window has been closed by the user. No replacement, instance 1008*cdf0e10cSrcweir // will destroy itself. 1009*cdf0e10cSrcweir pPopupWindow = 0; 1010*cdf0e10cSrcweir } 1011*cdf0e10cSrcweir 1012*cdf0e10cSrcweir return 1; 1013*cdf0e10cSrcweir } 1014*cdf0e10cSrcweir 1015*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1016*cdf0e10cSrcweir Beschreibung: 1017*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ClosePopupWindow, SfxPopupWindow *, pWindow ) 1020*cdf0e10cSrcweir { 1021*cdf0e10cSrcweir if ( pWindow == pFloatingWindow ) 1022*cdf0e10cSrcweir pFloatingWindow = 0; 1023*cdf0e10cSrcweir else 1024*cdf0e10cSrcweir pPopupWindow = 0; 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir return 1; 1027*cdf0e10cSrcweir } 1028*cdf0e10cSrcweir 1029*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1030*cdf0e10cSrcweir Beschreibung: 1031*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1032*cdf0e10cSrcweir 1033*cdf0e10cSrcweir void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, 1034*cdf0e10cSrcweir const SfxPoolItem* /*pState*/ ) 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir if(nSID == SID_DOCFULLNAME) 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir SwView *pActView = GetCreateView(); 1039*cdf0e10cSrcweir if(pActView) 1040*cdf0e10cSrcweir { 1041*cdf0e10cSrcweir SwWrtShell* pWrtShell = pActView->GetWrtShellPtr(); 1042*cdf0e10cSrcweir aContentTree.SetActiveShell(pWrtShell); 1043*cdf0e10cSrcweir sal_Bool bGlobal = IsGlobalDoc(); 1044*cdf0e10cSrcweir aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal); 1045*cdf0e10cSrcweir if( (!bGlobal && IsGlobalMode()) || 1046*cdf0e10cSrcweir (!IsGlobalMode() && pConfig->IsGlobalActive()) ) 1047*cdf0e10cSrcweir { 1048*cdf0e10cSrcweir ToggleTree(); 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir if(bGlobal) 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks()); 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir else 1056*cdf0e10cSrcweir { 1057*cdf0e10cSrcweir aContentTree.SetActiveShell(0); 1058*cdf0e10cSrcweir } 1059*cdf0e10cSrcweir UpdateListBox(); 1060*cdf0e10cSrcweir } 1061*cdf0e10cSrcweir } 1062*cdf0e10cSrcweir 1063*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1064*cdf0e10cSrcweir Bechreibung: NumericField aus der Toolbox holen 1065*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir NumEditAction& SwNavigationPI::GetPageEdit() 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir return *(NumEditAction*)aContentToolBox.GetItemWindow(FN_PAGENUMBER); 1070*cdf0e10cSrcweir } 1071*cdf0e10cSrcweir 1072*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1073*cdf0e10cSrcweir Beschreibung: 1074*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1075*cdf0e10cSrcweir 1076*cdf0e10cSrcweir SfxChildAlignment SwNavigationPI::CheckAlignment 1077*cdf0e10cSrcweir ( 1078*cdf0e10cSrcweir SfxChildAlignment eActAlign, 1079*cdf0e10cSrcweir SfxChildAlignment eAlign 1080*cdf0e10cSrcweir ) 1081*cdf0e10cSrcweir { 1082*cdf0e10cSrcweir SfxChildAlignment eRetAlign; 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir if(_IsZoomedIn()) 1085*cdf0e10cSrcweir eRetAlign = SFX_ALIGN_NOALIGNMENT; 1086*cdf0e10cSrcweir else 1087*cdf0e10cSrcweir switch (eAlign) 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 1090*cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM: 1091*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM: 1092*cdf0e10cSrcweir eRetAlign = eActAlign; 1093*cdf0e10cSrcweir break; 1094*cdf0e10cSrcweir 1095*cdf0e10cSrcweir case SFX_ALIGN_TOP: 1096*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP: 1097*cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP: 1098*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 1099*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 1100*cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT: 1101*cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT: 1102*cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT: 1103*cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT: 1104*cdf0e10cSrcweir eRetAlign = eAlign; 1105*cdf0e10cSrcweir break; 1106*cdf0e10cSrcweir 1107*cdf0e10cSrcweir default: 1108*cdf0e10cSrcweir eRetAlign = eAlign; 1109*cdf0e10cSrcweir break; 1110*cdf0e10cSrcweir } 1111*cdf0e10cSrcweir return eRetAlign; 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1116*cdf0e10cSrcweir Beschreibung: Benachrichtigung bei geaenderter DocInfo 1117*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1118*cdf0e10cSrcweir 1119*cdf0e10cSrcweir void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) 1120*cdf0e10cSrcweir { 1121*cdf0e10cSrcweir if(&rBrdc == pCreateView) 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir if(rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING) 1124*cdf0e10cSrcweir { 1125*cdf0e10cSrcweir pCreateView = 0; 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir } 1128*cdf0e10cSrcweir else 1129*cdf0e10cSrcweir { 1130*cdf0e10cSrcweir if(rHint.ISA(SfxEventHint)) 1131*cdf0e10cSrcweir { 1132*cdf0e10cSrcweir if( pxObjectShell && 1133*cdf0e10cSrcweir ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP) 1134*cdf0e10cSrcweir { 1135*cdf0e10cSrcweir DELETEZ(pxObjectShell); 1136*cdf0e10cSrcweir } 1137*cdf0e10cSrcweir else if(((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_OPENDOC) 1138*cdf0e10cSrcweir { 1139*cdf0e10cSrcweir 1140*cdf0e10cSrcweir SwView *pActView = GetCreateView(); 1141*cdf0e10cSrcweir if(pActView) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir SwWrtShell* pWrtShell = pActView->GetWrtShellPtr(); 1144*cdf0e10cSrcweir aContentTree.SetActiveShell(pWrtShell); 1145*cdf0e10cSrcweir if(aGlobalTree.IsVisible()) 1146*cdf0e10cSrcweir { 1147*cdf0e10cSrcweir if(aGlobalTree.Update( sal_False )) 1148*cdf0e10cSrcweir aGlobalTree.Display(); 1149*cdf0e10cSrcweir else 1150*cdf0e10cSrcweir // wenn kein Update notwendig, dann zumindest painten 1151*cdf0e10cSrcweir // wg. der roten Eintraege fuer broken links 1152*cdf0e10cSrcweir aGlobalTree.Invalidate(); 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir } 1155*cdf0e10cSrcweir } 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir } 1158*cdf0e10cSrcweir } 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1161*cdf0e10cSrcweir Beschreibung: 1162*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1163*cdf0e10cSrcweir 1164*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu ) 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir sal_uInt16 nMenuId = pMenu->GetCurItemId(); 1167*cdf0e10cSrcweir if(nMenuId != USHRT_MAX) 1168*cdf0e10cSrcweir { 1169*cdf0e10cSrcweir if(nMenuId < 100) 1170*cdf0e10cSrcweir SetRegionDropMode( --nMenuId); 1171*cdf0e10cSrcweir else 1172*cdf0e10cSrcweir aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) ); 1173*cdf0e10cSrcweir } 1174*cdf0e10cSrcweir return 0; 1175*cdf0e10cSrcweir } 1176*cdf0e10cSrcweir 1177*cdf0e10cSrcweir 1178*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1179*cdf0e10cSrcweir Beschreibung: 1180*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir void SwNavigationPI::UpdateListBox() 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir aDocListBox.SetUpdateMode(sal_False); 1185*cdf0e10cSrcweir aDocListBox.Clear(); 1186*cdf0e10cSrcweir SwView *pActView = GetCreateView(); 1187*cdf0e10cSrcweir sal_Bool bDisable = pActView == 0; 1188*cdf0e10cSrcweir SwView *pView = SwModule::GetFirstView(); 1189*cdf0e10cSrcweir sal_uInt16 nCount = 0; 1190*cdf0e10cSrcweir sal_uInt16 nAct = 0; 1191*cdf0e10cSrcweir sal_uInt16 nConstPos = 0; 1192*cdf0e10cSrcweir const SwView* pConstView = aContentTree.IsConstantView() && 1193*cdf0e10cSrcweir aContentTree.GetActiveWrtShell() ? 1194*cdf0e10cSrcweir &aContentTree.GetActiveWrtShell()->GetView(): 1195*cdf0e10cSrcweir 0; 1196*cdf0e10cSrcweir while (pView) 1197*cdf0e10cSrcweir { 1198*cdf0e10cSrcweir SfxObjectShell* pDoc = pView->GetDocShell(); 1199*cdf0e10cSrcweir // pb: #i53333# don't show help pages here 1200*cdf0e10cSrcweir if ( !pDoc->IsHelpDocument() ) 1201*cdf0e10cSrcweir { 1202*cdf0e10cSrcweir String sEntry = pDoc->GetTitle(); 1203*cdf0e10cSrcweir sEntry += C2S(" ("); 1204*cdf0e10cSrcweir if (pView == pActView) 1205*cdf0e10cSrcweir { 1206*cdf0e10cSrcweir nAct = nCount; 1207*cdf0e10cSrcweir sEntry += aStatusArr[ST_ACTIVE - ST_STATUS_FIRST]; 1208*cdf0e10cSrcweir } 1209*cdf0e10cSrcweir else 1210*cdf0e10cSrcweir sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST]; 1211*cdf0e10cSrcweir sEntry += ')'; 1212*cdf0e10cSrcweir aDocListBox.InsertEntry(sEntry); 1213*cdf0e10cSrcweir 1214*cdf0e10cSrcweir 1215*cdf0e10cSrcweir if (pConstView && pView == pConstView) 1216*cdf0e10cSrcweir nConstPos = nCount; 1217*cdf0e10cSrcweir 1218*cdf0e10cSrcweir nCount++; 1219*cdf0e10cSrcweir } 1220*cdf0e10cSrcweir pView = SwModule::GetNextView(pView); 1221*cdf0e10cSrcweir } 1222*cdf0e10cSrcweir aDocListBox.InsertEntry(aStatusArr[3]); //"Aktives Fenster" 1223*cdf0e10cSrcweir nCount++; 1224*cdf0e10cSrcweir 1225*cdf0e10cSrcweir if(aContentTree.GetHiddenWrtShell()) 1226*cdf0e10cSrcweir { 1227*cdf0e10cSrcweir String sEntry = aContentTree.GetHiddenWrtShell()->GetView(). 1228*cdf0e10cSrcweir GetDocShell()->GetTitle(); 1229*cdf0e10cSrcweir sEntry += C2S(" ("); 1230*cdf0e10cSrcweir sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST]; 1231*cdf0e10cSrcweir sEntry += ')'; 1232*cdf0e10cSrcweir aDocListBox.InsertEntry(sEntry); 1233*cdf0e10cSrcweir bDisable = sal_False; 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir if(aContentTree.IsActiveView()) 1236*cdf0e10cSrcweir { 1237*cdf0e10cSrcweir //entweder den Namen des akt. Docs oder "Aktives Dokument" 1238*cdf0e10cSrcweir sal_uInt16 nTmp = pActView ? nAct : --nCount; 1239*cdf0e10cSrcweir aDocListBox.SelectEntryPos( nTmp ); 1240*cdf0e10cSrcweir } 1241*cdf0e10cSrcweir else if(aContentTree.IsHiddenView()) 1242*cdf0e10cSrcweir { 1243*cdf0e10cSrcweir aDocListBox.SelectEntryPos(nCount); 1244*cdf0e10cSrcweir } 1245*cdf0e10cSrcweir else 1246*cdf0e10cSrcweir aDocListBox.SelectEntryPos(nConstPos); 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir aDocListBox.Enable( !bDisable ); 1249*cdf0e10cSrcweir aDocListBox.SetUpdateMode(sal_True); 1250*cdf0e10cSrcweir } 1251*cdf0e10cSrcweir 1252*cdf0e10cSrcweir /*-----------------16.06.97 15:05------------------- 1253*cdf0e10cSrcweir 1254*cdf0e10cSrcweir --------------------------------------------------*/ 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1257*cdf0e10cSrcweir Beschreibung: 1258*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1259*cdf0e10cSrcweir 1260*cdf0e10cSrcweir IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) 1261*cdf0e10cSrcweir { 1262*cdf0e10cSrcweir const SfxViewFrameItem* pFrameItem = PTR_CAST(SfxViewFrameItem, pItem ); 1263*cdf0e10cSrcweir if( pFrameItem ) 1264*cdf0e10cSrcweir { 1265*cdf0e10cSrcweir SfxViewFrame* pFrame = pFrameItem->GetFrame(); 1266*cdf0e10cSrcweir if(pFrame) 1267*cdf0e10cSrcweir { 1268*cdf0e10cSrcweir aContentTree.Clear(); 1269*cdf0e10cSrcweir pContentView = PTR_CAST(SwView, pFrame->GetViewShell()); 1270*cdf0e10cSrcweir DBG_ASSERT(pContentView, "keine SwView"); 1271*cdf0e10cSrcweir if(pContentView) 1272*cdf0e10cSrcweir pContentWrtShell = pContentView->GetWrtShellPtr(); 1273*cdf0e10cSrcweir else 1274*cdf0e10cSrcweir pContentWrtShell = 0; 1275*cdf0e10cSrcweir pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell()); 1276*cdf0e10cSrcweir FillBox(); 1277*cdf0e10cSrcweir aContentTree.Update(); 1278*cdf0e10cSrcweir } 1279*cdf0e10cSrcweir } 1280*cdf0e10cSrcweir return 0; 1281*cdf0e10cSrcweir } 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir String SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData ) 1284*cdf0e10cSrcweir { 1285*cdf0e10cSrcweir String sFileName; 1286*cdf0e10cSrcweir sal_uLong nFmt; 1287*cdf0e10cSrcweir if( rData.HasFormat( nFmt = FORMAT_FILE_LIST )) 1288*cdf0e10cSrcweir { 1289*cdf0e10cSrcweir FileList aFileList; 1290*cdf0e10cSrcweir rData.GetFileList( nFmt, aFileList ); 1291*cdf0e10cSrcweir sFileName = aFileList.GetFile( 0 ); 1292*cdf0e10cSrcweir } 1293*cdf0e10cSrcweir else if( rData.HasFormat( nFmt = FORMAT_STRING ) || 1294*cdf0e10cSrcweir rData.HasFormat( nFmt = FORMAT_FILE ) || 1295*cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME )) 1296*cdf0e10cSrcweir rData.GetString( nFmt, sFileName ); 1297*cdf0e10cSrcweir else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) || 1298*cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )|| 1299*cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) || 1300*cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) || 1301*cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR )) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir INetBookmark aBkmk( aEmptyStr, aEmptyStr ); 1304*cdf0e10cSrcweir rData.GetINetBookmark( nFmt, aBkmk ); 1305*cdf0e10cSrcweir sFileName = aBkmk.GetURL(); 1306*cdf0e10cSrcweir } 1307*cdf0e10cSrcweir if( sFileName.Len() ) 1308*cdf0e10cSrcweir { 1309*cdf0e10cSrcweir sFileName = INetURLObject( sFileName ).GetMainURL( INetURLObject::NO_DECODE ); 1310*cdf0e10cSrcweir } 1311*cdf0e10cSrcweir return sFileName; 1312*cdf0e10cSrcweir } 1313*cdf0e10cSrcweir 1314*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1315*cdf0e10cSrcweir Beschreibung: 1316*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1317*cdf0e10cSrcweir 1318*cdf0e10cSrcweir sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) 1319*cdf0e10cSrcweir { 1320*cdf0e10cSrcweir return ( !aContentTree.IsInDrag() && 1321*cdf0e10cSrcweir ( aContentTree.IsDropFormatSupported( FORMAT_FILE ) || 1322*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( FORMAT_STRING ) || 1323*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK ) || 1324*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )|| 1325*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT ) || 1326*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) || 1327*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) || 1328*cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME ))) 1329*cdf0e10cSrcweir ? DND_ACTION_COPY 1330*cdf0e10cSrcweir : DND_ACTION_NONE; 1331*cdf0e10cSrcweir } 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir TransferableDataHelper aData( rEvt.maDropEvent.Transferable ); 1336*cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE; 1337*cdf0e10cSrcweir String sFileName; 1338*cdf0e10cSrcweir if( !aContentTree.IsInDrag() && 1339*cdf0e10cSrcweir 0 != (sFileName = SwNavigationPI::CreateDropFileName( aData )).Len() ) 1340*cdf0e10cSrcweir { 1341*cdf0e10cSrcweir INetURLObject aTemp( sFileName ); 1342*cdf0e10cSrcweir GraphicDescriptor aDesc( aTemp ); 1343*cdf0e10cSrcweir if( !aDesc.Detect() ) // keine Grafiken annehmen 1344*cdf0e10cSrcweir { 1345*cdf0e10cSrcweir if( STRING_NOTFOUND == sFileName.Search('#') 1346*cdf0e10cSrcweir && (!sContentFileName.Len() || sContentFileName != sFileName )) 1347*cdf0e10cSrcweir { 1348*cdf0e10cSrcweir nRet = rEvt.mnAction; 1349*cdf0e10cSrcweir sFileName.EraseTrailingChars( char(0) ); 1350*cdf0e10cSrcweir sContentFileName = sFileName; 1351*cdf0e10cSrcweir if(pxObjectShell) 1352*cdf0e10cSrcweir { 1353*cdf0e10cSrcweir aContentTree.SetHiddenShell( 0 ); 1354*cdf0e10cSrcweir (*pxObjectShell)->DoClose(); 1355*cdf0e10cSrcweir DELETEZ( pxObjectShell); 1356*cdf0e10cSrcweir } 1357*cdf0e10cSrcweir SfxStringItem aFileItem(SID_FILE_NAME, sFileName ); 1358*cdf0e10cSrcweir String sOptions = C2S("HRC"); 1359*cdf0e10cSrcweir SfxStringItem aOptionsItem( SID_OPTIONS, sOptions ); 1360*cdf0e10cSrcweir SfxLinkItem aLink( SID_DONELINK, 1361*cdf0e10cSrcweir LINK( this, SwNavigationPI, DoneLink ) ); 1362*cdf0e10cSrcweir GetActiveView()->GetViewFrame()->GetDispatcher()->Execute( 1363*cdf0e10cSrcweir SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, 1364*cdf0e10cSrcweir &aFileItem, &aOptionsItem, &aLink, 0L ); 1365*cdf0e10cSrcweir } 1366*cdf0e10cSrcweir } 1367*cdf0e10cSrcweir } 1368*cdf0e10cSrcweir return nRet; 1369*cdf0e10cSrcweir } 1370*cdf0e10cSrcweir 1371*cdf0e10cSrcweir /*-----------------27.11.96 13.00------------------- 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir --------------------------------------------------*/ 1374*cdf0e10cSrcweir 1375*cdf0e10cSrcweir void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode) 1376*cdf0e10cSrcweir { 1377*cdf0e10cSrcweir nRegionMode = nNewMode; 1378*cdf0e10cSrcweir pConfig->SetRegionMode( nRegionMode ); 1379*cdf0e10cSrcweir 1380*cdf0e10cSrcweir sal_uInt16 nDropId = FN_DROP_REGION; 1381*cdf0e10cSrcweir if(nRegionMode == REGION_MODE_LINK) 1382*cdf0e10cSrcweir nDropId = FN_DROP_REGION_LINK; 1383*cdf0e10cSrcweir else if(nRegionMode == REGION_MODE_EMBEDDED) 1384*cdf0e10cSrcweir nDropId = FN_DROP_REGION_COPY; 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() 1387*cdf0e10cSrcweir ? aContentImageListH : aContentImageList; 1388*cdf0e10cSrcweir 1389*cdf0e10cSrcweir aContentToolBox.SetItemImage( FN_DROP_REGION, 1390*cdf0e10cSrcweir rImgLst.GetImage(nDropId)); 1391*cdf0e10cSrcweir } 1392*cdf0e10cSrcweir 1393*cdf0e10cSrcweir 1394*cdf0e10cSrcweir /*-----------------12.06.97 09:47------------------- 1395*cdf0e10cSrcweir 1396*cdf0e10cSrcweir --------------------------------------------------*/ 1397*cdf0e10cSrcweir 1398*cdf0e10cSrcweir sal_Bool SwNavigationPI::ToggleTree() 1399*cdf0e10cSrcweir { 1400*cdf0e10cSrcweir sal_Bool bRet = sal_True; 1401*cdf0e10cSrcweir sal_Bool bGlobalDoc = IsGlobalDoc(); 1402*cdf0e10cSrcweir if(!IsGlobalMode() && bGlobalDoc) 1403*cdf0e10cSrcweir { 1404*cdf0e10cSrcweir SetUpdateMode(sal_False); 1405*cdf0e10cSrcweir if(_IsZoomedIn()) 1406*cdf0e10cSrcweir _ZoomOut(); 1407*cdf0e10cSrcweir aGlobalTree.ShowTree(); 1408*cdf0e10cSrcweir aGlobalToolBox.Show(); 1409*cdf0e10cSrcweir aContentTree.HideTree(); 1410*cdf0e10cSrcweir aContentToolBox.Hide(); 1411*cdf0e10cSrcweir aDocListBox.Hide(); 1412*cdf0e10cSrcweir SetGlobalMode(sal_True); 1413*cdf0e10cSrcweir SetUpdateMode(sal_True); 1414*cdf0e10cSrcweir } 1415*cdf0e10cSrcweir else 1416*cdf0e10cSrcweir { 1417*cdf0e10cSrcweir aGlobalTree.HideTree(); 1418*cdf0e10cSrcweir aGlobalToolBox.Hide(); 1419*cdf0e10cSrcweir if(!_IsZoomedIn()) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir aContentTree.ShowTree(); 1422*cdf0e10cSrcweir aContentToolBox.Show(); 1423*cdf0e10cSrcweir aDocListBox.Show(); 1424*cdf0e10cSrcweir } 1425*cdf0e10cSrcweir bRet = sal_False; 1426*cdf0e10cSrcweir SetGlobalMode(sal_False); 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir return bRet; 1429*cdf0e10cSrcweir } 1430*cdf0e10cSrcweir 1431*cdf0e10cSrcweir /*-----------------13.06.97 09:42------------------- 1432*cdf0e10cSrcweir 1433*cdf0e10cSrcweir --------------------------------------------------*/ 1434*cdf0e10cSrcweir sal_Bool SwNavigationPI::IsGlobalDoc() const 1435*cdf0e10cSrcweir { 1436*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1437*cdf0e10cSrcweir SwView *pView = GetCreateView(); 1438*cdf0e10cSrcweir if(pView) 1439*cdf0e10cSrcweir { 1440*cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell(); 1441*cdf0e10cSrcweir bRet = rSh.IsGlobalDoc(); 1442*cdf0e10cSrcweir } 1443*cdf0e10cSrcweir return bRet; 1444*cdf0e10cSrcweir } 1445*cdf0e10cSrcweir /* -----------------26.10.98 08:10------------------- 1446*cdf0e10cSrcweir * 1447*cdf0e10cSrcweir * --------------------------------------------------*/ 1448*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ChangePageHdl, Timer*, EMPTYARG ) 1449*cdf0e10cSrcweir { 1450*cdf0e10cSrcweir EditAction(&GetPageEdit()); 1451*cdf0e10cSrcweir GetPageEdit().GrabFocus(); 1452*cdf0e10cSrcweir return 0; 1453*cdf0e10cSrcweir } 1454*cdf0e10cSrcweir /* -----------------26.10.98 08:14------------------- 1455*cdf0e10cSrcweir * 1456*cdf0e10cSrcweir * --------------------------------------------------*/ 1457*cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PageEditModifyHdl, Edit*, EMPTYARG ) 1458*cdf0e10cSrcweir { 1459*cdf0e10cSrcweir if(aPageChgTimer.IsActive()) 1460*cdf0e10cSrcweir aPageChgTimer.Stop(); 1461*cdf0e10cSrcweir aPageChgTimer.Start(); 1462*cdf0e10cSrcweir return 0; 1463*cdf0e10cSrcweir } 1464*cdf0e10cSrcweir 1465*cdf0e10cSrcweir /* -----------------------------23.04.01 07:34-------------------------------- 1466*cdf0e10cSrcweir 1467*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1468*cdf0e10cSrcweir SwView* SwNavigationPI::GetCreateView() const 1469*cdf0e10cSrcweir { 1470*cdf0e10cSrcweir if(!pCreateView) 1471*cdf0e10cSrcweir { 1472*cdf0e10cSrcweir SwView* pView = SwModule::GetFirstView(); 1473*cdf0e10cSrcweir while(pView) 1474*cdf0e10cSrcweir { 1475*cdf0e10cSrcweir if(&pView->GetViewFrame()->GetBindings() == &rBindings) 1476*cdf0e10cSrcweir { 1477*cdf0e10cSrcweir ((SwNavigationPI*)this)->pCreateView = pView; 1478*cdf0e10cSrcweir ((SwNavigationPI*)this)->StartListening(*pCreateView); 1479*cdf0e10cSrcweir break; 1480*cdf0e10cSrcweir } 1481*cdf0e10cSrcweir pView = SwModule::GetNextView(pView); 1482*cdf0e10cSrcweir } 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir return pCreateView; 1485*cdf0e10cSrcweir } 1486*cdf0e10cSrcweir 1487*cdf0e10cSrcweir 1488*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1489*cdf0e10cSrcweir Beschreibung: 1490*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1491*cdf0e10cSrcweir 1492*cdf0e10cSrcweir SwNavigationChild::SwNavigationChild( Window* pParent, 1493*cdf0e10cSrcweir sal_uInt16 nId, 1494*cdf0e10cSrcweir SfxBindings* _pBindings, 1495*cdf0e10cSrcweir SfxChildWinInfo* pInfo ) 1496*cdf0e10cSrcweir : SfxChildWindowContext( nId ) 1497*cdf0e10cSrcweir { 1498*cdf0e10cSrcweir SwNavigationPI* pNavi = new SwNavigationPI( _pBindings, this, pParent ); 1499*cdf0e10cSrcweir SetWindow( pNavi ); 1500*cdf0e10cSrcweir _pBindings->Invalidate(SID_NAVIGATOR); 1501*cdf0e10cSrcweir String sExtra = pInfo->aExtraString; 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig(); 1504*cdf0e10cSrcweir 1505*cdf0e10cSrcweir sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() ); 1506*cdf0e10cSrcweir if( nRootType < CONTENT_TYPE_MAX ) 1507*cdf0e10cSrcweir { 1508*cdf0e10cSrcweir pNavi->aContentTree.SetRootType(nRootType); 1509*cdf0e10cSrcweir pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, sal_True); 1510*cdf0e10cSrcweir } 1511*cdf0e10cSrcweir pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); 1512*cdf0e10cSrcweir pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) ); 1513*cdf0e10cSrcweir 1514*cdf0e10cSrcweir if(GetFloatingWindow() && pNaviConfig->IsSmall()) 1515*cdf0e10cSrcweir { 1516*cdf0e10cSrcweir pNavi->_ZoomIn(); 1517*cdf0e10cSrcweir } 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir /* -----------------------------06.05.2002 10:06------------------------------ 1520*cdf0e10cSrcweir 1521*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1522*cdf0e10cSrcweir void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt ) 1523*cdf0e10cSrcweir { 1524*cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 1525*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 1526*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 1527*cdf0e10cSrcweir { 1528*cdf0e10cSrcweir InitImageList(); 1529*cdf0e10cSrcweir const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); 1530*cdf0e10cSrcweir Color aBgColor = rStyleSettings.GetFaceColor(); 1531*cdf0e10cSrcweir Wallpaper aBack( aBgColor ); 1532*cdf0e10cSrcweir SetBackground( aBack ); 1533*cdf0e10cSrcweir } 1534*cdf0e10cSrcweir } 1535*cdf0e10cSrcweir /* -----------------------------06.05.2002 10:07------------------------------ 1536*cdf0e10cSrcweir 1537*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1538*cdf0e10cSrcweir void SwNavigationPI::InitImageList() 1539*cdf0e10cSrcweir { 1540*cdf0e10cSrcweir sal_uInt16 k; 1541*cdf0e10cSrcweir 1542*cdf0e10cSrcweir ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ? 1543*cdf0e10cSrcweir aContentImageListH : aContentImageList; 1544*cdf0e10cSrcweir for( k = 0; k < aContentToolBox.GetItemCount(); k++) 1545*cdf0e10cSrcweir aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k), 1546*cdf0e10cSrcweir rImgLst.GetImage(aContentToolBox.GetItemId(k))); 1547*cdf0e10cSrcweir 1548*cdf0e10cSrcweir for( k = 0; k < aGlobalToolBox.GetItemCount(); k++) 1549*cdf0e10cSrcweir aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k), 1550*cdf0e10cSrcweir rImgLst.GetImage(aGlobalToolBox.GetItemId(k))); 1551*cdf0e10cSrcweir 1552*cdf0e10cSrcweir sal_uInt16 nDropId = FN_DROP_REGION; 1553*cdf0e10cSrcweir if(nRegionMode == REGION_MODE_LINK) 1554*cdf0e10cSrcweir nDropId = FN_DROP_REGION_LINK; 1555*cdf0e10cSrcweir else if(nRegionMode == REGION_MODE_EMBEDDED) 1556*cdf0e10cSrcweir nDropId = FN_DROP_REGION_COPY; 1557*cdf0e10cSrcweir aContentToolBox.SetItemImage( FN_DROP_REGION, 1558*cdf0e10cSrcweir rImgLst.GetImage(nDropId)); 1559*cdf0e10cSrcweir } 1560*cdf0e10cSrcweir 1561