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_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <svx/svditer.hxx> 34*cdf0e10cSrcweir #include <svx/svdobj.hxx> 35*cdf0e10cSrcweir #include <svx/svdpage.hxx> 36*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 37*cdf0e10cSrcweir #include <svx/svdview.hxx> 38*cdf0e10cSrcweir #include <svx/svdxcgv.hxx> 39*cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 40*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 41*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 42*cdf0e10cSrcweir #include <vcl/help.hxx> 43*cdf0e10cSrcweir #include <vcl/sound.hxx> 44*cdf0e10cSrcweir #include <vcl/svapp.hxx> 45*cdf0e10cSrcweir #include <tools/urlobj.hxx> 46*cdf0e10cSrcweir #include <svl/urlbmk.hxx> 47*cdf0e10cSrcweir #include <stdlib.h> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include "content.hxx" 50*cdf0e10cSrcweir #include "navipi.hxx" 51*cdf0e10cSrcweir #include "global.hxx" 52*cdf0e10cSrcweir #include "docsh.hxx" 53*cdf0e10cSrcweir #include "scmod.hxx" 54*cdf0e10cSrcweir #include "rangenam.hxx" 55*cdf0e10cSrcweir #include "dbcolect.hxx" 56*cdf0e10cSrcweir #include "tablink.hxx" // fuer Loader 57*cdf0e10cSrcweir #include "popmenu.hxx" 58*cdf0e10cSrcweir #include "drwlayer.hxx" 59*cdf0e10cSrcweir #include "transobj.hxx" 60*cdf0e10cSrcweir #include "drwtrans.hxx" 61*cdf0e10cSrcweir #include "lnktrans.hxx" 62*cdf0e10cSrcweir #include "cell.hxx" 63*cdf0e10cSrcweir #include "dociter.hxx" 64*cdf0e10cSrcweir #include "scresid.hxx" 65*cdf0e10cSrcweir #include "globstr.hrc" 66*cdf0e10cSrcweir #include "navipi.hrc" 67*cdf0e10cSrcweir #include "arealink.hxx" 68*cdf0e10cSrcweir #include "navicfg.hxx" 69*cdf0e10cSrcweir #include "navsett.hxx" 70*cdf0e10cSrcweir #include "postit.hxx" 71*cdf0e10cSrcweir #include "clipparam.hxx" 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir using namespace com::sun::star; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir // Reihenfolge der Kategorien im Navigator ------------------------------------- 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir static sal_uInt16 pTypeList[SC_CONTENT_COUNT] = 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir SC_CONTENT_ROOT, // ROOT (0) muss vorne stehen 80*cdf0e10cSrcweir SC_CONTENT_TABLE, 81*cdf0e10cSrcweir SC_CONTENT_RANGENAME, 82*cdf0e10cSrcweir SC_CONTENT_DBAREA, 83*cdf0e10cSrcweir SC_CONTENT_AREALINK, 84*cdf0e10cSrcweir SC_CONTENT_GRAPHIC, 85*cdf0e10cSrcweir SC_CONTENT_OLEOBJECT, 86*cdf0e10cSrcweir SC_CONTENT_NOTE, 87*cdf0e10cSrcweir SC_CONTENT_DRAWING 88*cdf0e10cSrcweir }; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir sal_Bool ScContentTree::bIsInDrag = sal_False; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir ScDocShell* ScContentTree::GetManualOrCurrent() 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir ScDocShell* pSh = NULL; 96*cdf0e10cSrcweir if ( aManualDoc.Len() ) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir TypeId aScType = TYPE(ScDocShell); 99*cdf0e10cSrcweir SfxObjectShell* pObjSh = SfxObjectShell::GetFirst( &aScType ); 100*cdf0e10cSrcweir while ( pObjSh && !pSh ) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir if ( pObjSh->GetTitle() == aManualDoc ) 103*cdf0e10cSrcweir pSh = PTR_CAST( ScDocShell, pObjSh ); 104*cdf0e10cSrcweir pObjSh = SfxObjectShell::GetNext( *pObjSh, &aScType ); 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir else 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir // Current nur, wenn keine manuell eingestellt ist 110*cdf0e10cSrcweir // (damit erkannt wird, wenn das Dokument nicht mehr existiert) 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir SfxViewShell* pViewSh = SfxViewShell::Current(); 113*cdf0e10cSrcweir if ( pViewSh ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir SfxObjectShell* pObjSh = pViewSh->GetViewFrame()->GetObjectShell(); 116*cdf0e10cSrcweir pSh = PTR_CAST( ScDocShell, pObjSh ); 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir return pSh; 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // 124*cdf0e10cSrcweir // ScContentTree 125*cdf0e10cSrcweir // 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) : 128*cdf0e10cSrcweir SvTreeListBox ( pParent, rResId ), 129*cdf0e10cSrcweir aEntryImages ( ScResId( RID_IMAGELIST_NAVCONT ) ), 130*cdf0e10cSrcweir aHCEntryImages ( ScResId( RID_IMAGELIST_H_NAVCONT ) ), 131*cdf0e10cSrcweir nRootType ( SC_CONTENT_ROOT ), 132*cdf0e10cSrcweir bHiddenDoc ( sal_False ), 133*cdf0e10cSrcweir pHiddenDocument ( NULL ) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir sal_uInt16 i; 136*cdf0e10cSrcweir for (i=0; i<SC_CONTENT_COUNT; i++) 137*cdf0e10cSrcweir pPosList[pTypeList[i]] = i; // invers zum suchen 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir pParentWindow = (ScNavigatorDlg*)pParent; 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir pRootNodes[0] = NULL; 142*cdf0e10cSrcweir for (i=1; i<SC_CONTENT_COUNT; i++) 143*cdf0e10cSrcweir InitRoot(i); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir SetNodeDefaultImages(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) ); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir SetStyle( GetStyle() | WB_QUICK_SEARCH ); 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir ScContentTree::~ScContentTree() 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void ScContentTree::InitRoot( sal_uInt16 nType ) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir if ( !nType ) 159*cdf0e10cSrcweir return; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir if ( nRootType && nRootType != nType ) // ausgeblendet ? 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir pRootNodes[nType] = NULL; 164*cdf0e10cSrcweir return; 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir const Image& rImage = aEntryImages.GetImage( nType ); 168*cdf0e10cSrcweir String aName( ScResId( SCSTR_CONTENT_ROOT + nType ) ); 169*cdf0e10cSrcweir // wieder an die richtige Position: 170*cdf0e10cSrcweir sal_uInt16 nPos = nRootType ? 0 : pPosList[nType]-1; 171*cdf0e10cSrcweir SvLBoxEntry* pNew = InsertEntry( aName, rImage, rImage, NULL, sal_False, nPos ); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir const Image& rHCImage = aHCEntryImages.GetImage( nType ); 174*cdf0e10cSrcweir SetExpandedEntryBmp( pNew, rHCImage, BMP_COLOR_HIGHCONTRAST ); 175*cdf0e10cSrcweir SetCollapsedEntryBmp( pNew, rHCImage, BMP_COLOR_HIGHCONTRAST ); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir pRootNodes[nType] = pNew; 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir void ScContentTree::ClearAll() 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir Clear(); 183*cdf0e10cSrcweir for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++) 184*cdf0e10cSrcweir InitRoot(i); 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void ScContentTree::ClearType(sal_uInt16 nType) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir if (!nType) 190*cdf0e10cSrcweir ClearAll(); 191*cdf0e10cSrcweir else 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir SvLBoxEntry* pParent = pRootNodes[nType]; 194*cdf0e10cSrcweir if ( !pParent || GetChildCount(pParent) ) // nicht, wenn ohne Children schon da 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir if (pParent) 197*cdf0e10cSrcweir GetModel()->Remove( pParent ); // mit allen Children 198*cdf0e10cSrcweir InitRoot( nType ); // ggf. neu eintragen 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir void ScContentTree::InsertContent( sal_uInt16 nType, const String& rValue ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir if (nType >= SC_CONTENT_COUNT) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir DBG_ERROR("ScContentTree::InsertContent mit falschem Typ"); 208*cdf0e10cSrcweir return; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir SvLBoxEntry* pParent = pRootNodes[nType]; 212*cdf0e10cSrcweir if (pParent) 213*cdf0e10cSrcweir InsertEntry( rValue, pParent ); 214*cdf0e10cSrcweir else 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir DBG_ERROR("InsertContent ohne Parent"); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir rnRootIndex = SC_CONTENT_ROOT; 223*cdf0e10cSrcweir rnChildIndex = SC_CONTENT_NOCHILD; 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir if( !pEntry ) 226*cdf0e10cSrcweir return; 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir SvLBoxEntry* pParent = GetParent( pEntry ); 229*cdf0e10cSrcweir bool bFound = false; 230*cdf0e10cSrcweir for( sal_uInt16 nRoot = 1; !bFound && (nRoot < SC_CONTENT_COUNT); ++nRoot ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir if( pEntry == pRootNodes[ nRoot ] ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir rnRootIndex = nRoot; 235*cdf0e10cSrcweir rnChildIndex = ~0UL; 236*cdf0e10cSrcweir bFound = true; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir else if( pParent && (pParent == pRootNodes[ nRoot ]) ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir rnRootIndex = nRoot; 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir // search the entry in all child entries of the parent 243*cdf0e10cSrcweir sal_uLong nEntry = 0; 244*cdf0e10cSrcweir SvLBoxEntry* pIterEntry = FirstChild( pParent ); 245*cdf0e10cSrcweir while( !bFound && pIterEntry ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir if ( pEntry == pIterEntry ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir rnChildIndex = nEntry; 250*cdf0e10cSrcweir bFound = true; // exit the while loop 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir pIterEntry = NextSibling( pIterEntry ); 253*cdf0e10cSrcweir ++nEntry; 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir bFound = true; // exit the for loop 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir sal_uLong ScContentTree::GetChildIndex( SvLBoxEntry* pEntry ) const 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir sal_uInt16 nRoot; 264*cdf0e10cSrcweir sal_uLong nChild; 265*cdf0e10cSrcweir GetEntryIndexes( nRoot, nChild, pEntry ); 266*cdf0e10cSrcweir return nChild; 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir String lcl_GetDBAreaRange( ScDocument* pDoc, const String& rDBName ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir String aRet; 272*cdf0e10cSrcweir if (pDoc) 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir ScDBCollection* pDbNames = pDoc->GetDBCollection(); 275*cdf0e10cSrcweir sal_uInt16 nCount = pDbNames->GetCount(); 276*cdf0e10cSrcweir for ( sal_uInt16 i=0; i<nCount; i++ ) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir ScDBData* pData = (*pDbNames)[i]; 279*cdf0e10cSrcweir if ( pData->GetName() == rDBName ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir ScRange aRange; 282*cdf0e10cSrcweir pData->GetArea(aRange); 283*cdf0e10cSrcweir aRange.Format( aRet, SCR_ABS_3D, pDoc ); 284*cdf0e10cSrcweir break; 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir return aRet; 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir IMPL_LINK( ScContentTree, ContentDoubleClickHdl, ScContentTree *, EMPTYARG ) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir sal_uInt16 nType; 294*cdf0e10cSrcweir sal_uLong nChild; 295*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 296*cdf0e10cSrcweir GetEntryIndexes( nType, nChild, pEntry ); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir if ( bHiddenDoc ) 301*cdf0e10cSrcweir return 0; //! spaeter... 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir String aText( GetEntryText( pEntry ) ); 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir if ( aManualDoc.Len() ) 306*cdf0e10cSrcweir pParentWindow->SetCurrentDoc( aManualDoc ); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir switch( nType ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir case SC_CONTENT_TABLE: 311*cdf0e10cSrcweir pParentWindow->SetCurrentTableStr( aText ); 312*cdf0e10cSrcweir break; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir case SC_CONTENT_RANGENAME: 315*cdf0e10cSrcweir pParentWindow->SetCurrentCellStr( aText ); 316*cdf0e10cSrcweir break; 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir case SC_CONTENT_DBAREA: 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir // #47905# Wenn gleiche Bereichs- und DB-Namen existieren, wird 321*cdf0e10cSrcweir // bei SID_CURRENTCELL der Bereichsname genommen. 322*cdf0e10cSrcweir // DB-Bereiche darum direkt ueber die Adresse anspringen. 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir String aRangeStr = lcl_GetDBAreaRange( GetSourceDocument(), aText ); 325*cdf0e10cSrcweir if (aRangeStr.Len()) 326*cdf0e10cSrcweir pParentWindow->SetCurrentCellStr( aRangeStr ); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir break; 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir case SC_CONTENT_OLEOBJECT: 331*cdf0e10cSrcweir case SC_CONTENT_GRAPHIC: 332*cdf0e10cSrcweir case SC_CONTENT_DRAWING: 333*cdf0e10cSrcweir pParentWindow->SetCurrentObject( aText ); 334*cdf0e10cSrcweir break; 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir case SC_CONTENT_NOTE: 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir ScAddress aPos = GetNotePos( nChild ); 339*cdf0e10cSrcweir pParentWindow->SetCurrentTable( aPos.Tab() ); 340*cdf0e10cSrcweir pParentWindow->SetCurrentCell( aPos.Col(), aPos.Row() ); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir break; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir case SC_CONTENT_AREALINK: 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir const ScAreaLink* pLink = GetLink( nChild ); 347*cdf0e10cSrcweir if( pLink ) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir ScRange aRange = pLink->GetDestArea(); 350*cdf0e10cSrcweir String aRangeStr; 351*cdf0e10cSrcweir ScDocument* pSrcDoc = GetSourceDocument(); 352*cdf0e10cSrcweir aRange.Format( aRangeStr, SCR_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention() ); 353*cdf0e10cSrcweir pParentWindow->SetCurrentCellStr( aRangeStr ); 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir break; 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir ScNavigatorDlg::ReleaseFocus(); // set focus into document 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir return 0; 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir void ScContentTree::MouseButtonDown( const MouseEvent& rMEvt ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir SvTreeListBox::MouseButtonDown( rMEvt ); 368*cdf0e10cSrcweir StoreSettings(); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir void ScContentTree::KeyInput( const KeyEvent& rKEvt ) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir sal_Bool bUsed = sal_False; 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir const KeyCode aCode = rKEvt.GetKeyCode(); 376*cdf0e10cSrcweir if (aCode.GetCode() == KEY_RETURN) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir switch (aCode.GetModifier()) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir case KEY_MOD1: 381*cdf0e10cSrcweir ToggleRoot(); // toggle root mode (as in Writer) 382*cdf0e10cSrcweir bUsed = sal_True; 383*cdf0e10cSrcweir break; 384*cdf0e10cSrcweir case 0: 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 387*cdf0e10cSrcweir if( pEntry ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir sal_uInt16 nType; 390*cdf0e10cSrcweir sal_uLong nChild; 391*cdf0e10cSrcweir GetEntryIndexes( nType, nChild, pEntry ); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir if( (nType != SC_CONTENT_ROOT) && (nChild == SC_CONTENT_NOCHILD) ) 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir String aText( GetEntryText( pEntry ) ); 396*cdf0e10cSrcweir if ( IsExpanded( pEntry ) ) 397*cdf0e10cSrcweir Collapse( pEntry ); 398*cdf0e10cSrcweir else 399*cdf0e10cSrcweir Expand( pEntry ); 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir else 402*cdf0e10cSrcweir ContentDoubleClickHdl(0); // select content as if double clicked 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir bUsed = sal_True; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir break; 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir StoreSettings(); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir if( !bUsed ) 413*cdf0e10cSrcweir SvTreeListBox::KeyInput(rKEvt); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir //sal_Bool __EXPORT ScContentTree::Drop( const DropEvent& rEvt ) 417*cdf0e10cSrcweir //{ 418*cdf0e10cSrcweir // return pParentWindow->Drop(rEvt); // Drop auf Navigator 419*cdf0e10cSrcweir //} 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir //sal_Bool __EXPORT ScContentTree::QueryDrop( DropEvent& rEvt ) 422*cdf0e10cSrcweir //{ 423*cdf0e10cSrcweir // return pParentWindow->QueryDrop(rEvt); // Drop auf Navigator 424*cdf0e10cSrcweir //} 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir sal_Int8 ScContentTree::AcceptDrop( const AcceptDropEvent& /* rEvt */ ) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir return DND_ACTION_NONE; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir sal_Int8 ScContentTree::ExecuteDrop( const ExecuteDropEvent& /* rEvt */ ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir return DND_ACTION_NONE; 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir void ScContentTree::StartDrag( sal_Int8 /* nAction */, const Point& /* rPosPixel */ ) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir DoDrag(); 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir void ScContentTree::DragFinished( sal_Int8 /* nAction */ ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir void __EXPORT ScContentTree::Command( const CommandEvent& rCEvt ) 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir sal_Bool bDone = sal_False; 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir switch ( rCEvt.GetCommand() ) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir case COMMAND_STARTDRAG: 452*cdf0e10cSrcweir // Aus dem ExecuteDrag heraus kann der Navigator geloescht werden 453*cdf0e10cSrcweir // (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber 454*cdf0e10cSrcweir // den StarView MouseMove-Handler, der Command() aufruft, umbringen. 455*cdf0e10cSrcweir // Deshalb Drag&Drop asynchron: 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir // DoDrag(); 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK( this, ScContentTree, ExecDragHdl ) ); 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir bDone = sal_True; 462*cdf0e10cSrcweir break; 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir case COMMAND_CONTEXTMENU: 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir // Drag-Drop Modus 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir PopupMenu aPop; 469*cdf0e10cSrcweir ScPopupMenu aDropMenu( ScResId( RID_POPUP_DROPMODE ) ); 470*cdf0e10cSrcweir aDropMenu.CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() ); 471*cdf0e10cSrcweir aPop.InsertItem( 1, pParentWindow->GetStrDragMode() ); 472*cdf0e10cSrcweir aPop.SetPopupMenu( 1, &aDropMenu ); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir // angezeigtes Dokument 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir ScPopupMenu aDocMenu; 477*cdf0e10cSrcweir aDocMenu.SetMenuFlags( aDocMenu.GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS ); 478*cdf0e10cSrcweir sal_uInt16 i=0; 479*cdf0e10cSrcweir sal_uInt16 nPos=0; 480*cdf0e10cSrcweir // geladene Dokumente 481*cdf0e10cSrcweir ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); 482*cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::GetFirst(); 483*cdf0e10cSrcweir while ( pSh ) 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir if ( pSh->ISA(ScDocShell) ) 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir String aName = pSh->GetTitle(); 488*cdf0e10cSrcweir String aEntry = aName; 489*cdf0e10cSrcweir if ( pSh == pCurrentSh ) 490*cdf0e10cSrcweir aEntry += pParentWindow->aStrActive; 491*cdf0e10cSrcweir else 492*cdf0e10cSrcweir aEntry += pParentWindow->aStrNotActive; 493*cdf0e10cSrcweir aDocMenu.InsertItem( ++i, aEntry ); 494*cdf0e10cSrcweir if ( !bHiddenDoc && aName == aManualDoc ) 495*cdf0e10cSrcweir nPos = i; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir pSh = SfxObjectShell::GetNext( *pSh ); 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir // "aktives Fenster" 500*cdf0e10cSrcweir aDocMenu.InsertItem( ++i, pParentWindow->aStrActiveWin ); 501*cdf0e10cSrcweir if (!bHiddenDoc && !aManualDoc.Len()) 502*cdf0e10cSrcweir nPos = i; 503*cdf0e10cSrcweir // verstecktes Dokument 504*cdf0e10cSrcweir if ( aHiddenTitle.Len() ) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir String aEntry = aHiddenTitle; 507*cdf0e10cSrcweir aEntry += pParentWindow->aStrHidden; 508*cdf0e10cSrcweir aDocMenu.InsertItem( ++i, aEntry ); 509*cdf0e10cSrcweir if (bHiddenDoc) 510*cdf0e10cSrcweir nPos = i; 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir aDocMenu.CheckItem( nPos ); 513*cdf0e10cSrcweir aPop.InsertItem( 2, pParentWindow->GetStrDisplay() ); 514*cdf0e10cSrcweir aPop.SetPopupMenu( 2, &aDocMenu ); 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir // ausfuehren 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir aPop.Execute( this, rCEvt.GetMousePosPixel() ); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir if ( aDropMenu.WasHit() ) // Drag-Drop Modus 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir sal_uInt16 nId = aDropMenu.GetSelected(); 523*cdf0e10cSrcweir if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY ) 524*cdf0e10cSrcweir pParentWindow->SetDropMode( nId - RID_DROPMODE_URL ); 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir else if ( aDocMenu.WasHit() ) // angezeigtes Dokument 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir sal_uInt16 nId = aDocMenu.GetSelected(); 529*cdf0e10cSrcweir String aName = aDocMenu.GetItemText(nId); 530*cdf0e10cSrcweir SelectDoc( aName ); 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir break; 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir if (!bDone) 537*cdf0e10cSrcweir SvTreeListBox::Command(rCEvt); 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir void __EXPORT ScContentTree::RequestHelp( const HelpEvent& rHEvt ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir sal_Bool bDone = sal_False; 543*cdf0e10cSrcweir if( rHEvt.GetMode() & HELPMODE_QUICK ) 544*cdf0e10cSrcweir { 545*cdf0e10cSrcweir Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() )); 546*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( aPos ); 547*cdf0e10cSrcweir if ( pEntry ) 548*cdf0e10cSrcweir { 549*cdf0e10cSrcweir sal_Bool bRet = sal_False; 550*cdf0e10cSrcweir String aHelpText; 551*cdf0e10cSrcweir SvLBoxEntry* pParent = GetParent(pEntry); 552*cdf0e10cSrcweir if ( !pParent ) // Top-Level ? 553*cdf0e10cSrcweir { 554*cdf0e10cSrcweir aHelpText = String::CreateFromInt32( GetChildCount(pEntry) ); 555*cdf0e10cSrcweir aHelpText += ' '; 556*cdf0e10cSrcweir aHelpText += GetEntryText(pEntry); 557*cdf0e10cSrcweir bRet = sal_True; 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir else if ( pParent == pRootNodes[SC_CONTENT_NOTE] ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir aHelpText = GetEntryText(pEntry); // Notizen als Help-Text 562*cdf0e10cSrcweir bRet = sal_True; 563*cdf0e10cSrcweir } 564*cdf0e10cSrcweir else if ( pParent == pRootNodes[SC_CONTENT_AREALINK] ) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir sal_uLong nIndex = GetChildIndex(pEntry); 567*cdf0e10cSrcweir if( nIndex != SC_CONTENT_NOCHILD ) 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir const ScAreaLink* pLink = GetLink(nIndex); 570*cdf0e10cSrcweir if (pLink) 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir aHelpText = pLink->GetFile(); // Source-Datei als Help-Text 573*cdf0e10cSrcweir bRet = sal_True; 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir if (bRet) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir SvLBoxTab* pTab; 581*cdf0e10cSrcweir SvLBoxString* pItem = (SvLBoxString*)(GetItem( pEntry, aPos.X(), &pTab )); 582*cdf0e10cSrcweir if( pItem ) 583*cdf0e10cSrcweir { 584*cdf0e10cSrcweir aPos = GetEntryPosition( pEntry ); 585*cdf0e10cSrcweir aPos.X() = GetTabPos( pEntry, pTab ); 586*cdf0e10cSrcweir aPos = OutputToScreenPixel(aPos); 587*cdf0e10cSrcweir Size aSize( pItem->GetSize( this, pEntry ) ); 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir Rectangle aItemRect( aPos, aSize ); 590*cdf0e10cSrcweir Help::ShowQuickHelp( this, aItemRect, aHelpText ); 591*cdf0e10cSrcweir bDone = sal_True; 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir } 596*cdf0e10cSrcweir if (!bDone) 597*cdf0e10cSrcweir Window::RequestHelp( rHEvt ); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir ScDocument* ScContentTree::GetSourceDocument() 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir if (bHiddenDoc) 603*cdf0e10cSrcweir return pHiddenDocument; 604*cdf0e10cSrcweir else 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir ScDocShell* pSh = GetManualOrCurrent(); 607*cdf0e10cSrcweir if (pSh) 608*cdf0e10cSrcweir return pSh->GetDocument(); 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir return NULL; 612*cdf0e10cSrcweir } 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir void ScContentTree::Refresh( sal_uInt16 nType ) 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir if ( bHiddenDoc && !pHiddenDocument ) 617*cdf0e10cSrcweir return; // anderes Dokument angezeigt 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir // wenn sich nichts geaendert hat, gleich abbrechen (gegen Geflacker) 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir if ( nType == SC_CONTENT_NOTE ) 622*cdf0e10cSrcweir if (!NoteStringsChanged()) 623*cdf0e10cSrcweir return; 624*cdf0e10cSrcweir if ( nType == SC_CONTENT_GRAPHIC ) 625*cdf0e10cSrcweir if (!DrawNamesChanged(SC_CONTENT_GRAPHIC)) 626*cdf0e10cSrcweir return; 627*cdf0e10cSrcweir if ( nType == SC_CONTENT_OLEOBJECT ) 628*cdf0e10cSrcweir if (!DrawNamesChanged(SC_CONTENT_OLEOBJECT)) 629*cdf0e10cSrcweir return; 630*cdf0e10cSrcweir if ( nType == SC_CONTENT_DRAWING ) 631*cdf0e10cSrcweir if (!DrawNamesChanged(SC_CONTENT_DRAWING)) 632*cdf0e10cSrcweir return; 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir SetUpdateMode(sal_False); 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir ClearType( nType ); 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_TABLE ) 639*cdf0e10cSrcweir GetTableNames(); 640*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_RANGENAME ) 641*cdf0e10cSrcweir GetAreaNames(); 642*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_DBAREA ) 643*cdf0e10cSrcweir GetDbNames(); 644*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_GRAPHIC ) 645*cdf0e10cSrcweir GetGraphicNames(); 646*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_OLEOBJECT ) 647*cdf0e10cSrcweir GetOleNames(); 648*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_DRAWING ) 649*cdf0e10cSrcweir GetDrawingNames(); 650*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_NOTE ) 651*cdf0e10cSrcweir GetNoteStrings(); 652*cdf0e10cSrcweir if ( !nType || nType == SC_CONTENT_AREALINK ) 653*cdf0e10cSrcweir GetLinkNames(); 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir ApplySettings(); 656*cdf0e10cSrcweir SetUpdateMode(sal_True); 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir void ScContentTree::GetTableNames() 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir if ( nRootType && nRootType != SC_CONTENT_TABLE ) // ausgeblendet ? 662*cdf0e10cSrcweir return; 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 665*cdf0e10cSrcweir if (!pDoc) 666*cdf0e10cSrcweir return; 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir String aName; 669*cdf0e10cSrcweir SCTAB nCount = pDoc->GetTableCount(); 670*cdf0e10cSrcweir for ( SCTAB i=0; i<nCount; i++ ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir pDoc->GetName( i, aName ); 673*cdf0e10cSrcweir InsertContent( SC_CONTENT_TABLE, aName ); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir } 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir void ScContentTree::GetAreaNames() 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir if ( nRootType && nRootType != SC_CONTENT_RANGENAME ) // ausgeblendet ? 680*cdf0e10cSrcweir return; 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 683*cdf0e10cSrcweir if (!pDoc) 684*cdf0e10cSrcweir return; 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir ScRangeName* pRangeNames = pDoc->GetRangeName(); 687*cdf0e10cSrcweir sal_uInt16 nCount = pRangeNames->GetCount(); 688*cdf0e10cSrcweir if ( nCount > 0 ) 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir sal_uInt16 nValidCount = 0; 691*cdf0e10cSrcweir ScRange aDummy; 692*cdf0e10cSrcweir sal_uInt16 i; 693*cdf0e10cSrcweir for ( i=0; i<nCount; i++ ) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir ScRangeData* pData = (*pRangeNames)[i]; 696*cdf0e10cSrcweir if (pData->IsValidReference(aDummy)) 697*cdf0e10cSrcweir nValidCount++; 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir if ( nValidCount ) 700*cdf0e10cSrcweir { 701*cdf0e10cSrcweir ScRangeData** ppSortArray = new ScRangeData* [ nValidCount ]; 702*cdf0e10cSrcweir sal_uInt16 j; 703*cdf0e10cSrcweir for ( i=0, j=0; i<nCount; i++ ) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir ScRangeData* pData = (*pRangeNames)[i]; 706*cdf0e10cSrcweir if (pData->IsValidReference(aDummy)) 707*cdf0e10cSrcweir ppSortArray[j++] = pData; 708*cdf0e10cSrcweir } 709*cdf0e10cSrcweir #ifndef ICC 710*cdf0e10cSrcweir qsort( (void*)ppSortArray, nValidCount, sizeof(ScRangeData*), 711*cdf0e10cSrcweir &ScRangeData_QsortNameCompare ); 712*cdf0e10cSrcweir #else 713*cdf0e10cSrcweir qsort( (void*)ppSortArray, nValidCount, sizeof(ScRangeData*), 714*cdf0e10cSrcweir ICCQsortNameCompare ); 715*cdf0e10cSrcweir #endif 716*cdf0e10cSrcweir for ( j=0; j<nValidCount; j++ ) 717*cdf0e10cSrcweir InsertContent( SC_CONTENT_RANGENAME, ppSortArray[j]->GetName() ); 718*cdf0e10cSrcweir delete [] ppSortArray; 719*cdf0e10cSrcweir } 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir void ScContentTree::GetDbNames() 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir if ( nRootType && nRootType != SC_CONTENT_DBAREA ) // ausgeblendet ? 726*cdf0e10cSrcweir return; 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 729*cdf0e10cSrcweir if (!pDoc) 730*cdf0e10cSrcweir return; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir ScDBCollection* pDbNames = pDoc->GetDBCollection(); 733*cdf0e10cSrcweir sal_uInt16 nCount = pDbNames->GetCount(); 734*cdf0e10cSrcweir if ( nCount > 0 ) 735*cdf0e10cSrcweir { 736*cdf0e10cSrcweir String aStrNoName( ScGlobal::GetRscString(STR_DB_NONAME) ); 737*cdf0e10cSrcweir for ( sal_uInt16 i=0; i<nCount; i++ ) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir ScDBData* pData = (*pDbNames)[i]; 740*cdf0e10cSrcweir String aStrName = pData->GetName(); 741*cdf0e10cSrcweir if ( aStrName != aStrNoName ) 742*cdf0e10cSrcweir InsertContent( SC_CONTENT_DBAREA, aStrName ); 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir bool ScContentTree::IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier ) // static 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir bool bRet = false; 750*cdf0e10cSrcweir switch ( nContentType ) 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir case SC_CONTENT_GRAPHIC: 753*cdf0e10cSrcweir bRet = ( nObjIdentifier == OBJ_GRAF ); 754*cdf0e10cSrcweir break; 755*cdf0e10cSrcweir case SC_CONTENT_OLEOBJECT: 756*cdf0e10cSrcweir bRet = ( nObjIdentifier == OBJ_OLE2 ); 757*cdf0e10cSrcweir break; 758*cdf0e10cSrcweir case SC_CONTENT_DRAWING: 759*cdf0e10cSrcweir bRet = ( nObjIdentifier != OBJ_GRAF && nObjIdentifier != OBJ_OLE2 ); // everything else 760*cdf0e10cSrcweir break; 761*cdf0e10cSrcweir default: 762*cdf0e10cSrcweir DBG_ERROR("unknown content type"); 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir return bRet; 765*cdf0e10cSrcweir } 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir void ScContentTree::GetDrawNames( sal_uInt16 nType ) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir if ( nRootType && nRootType != nType ) // ausgeblendet ? 770*cdf0e10cSrcweir return; 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 773*cdf0e10cSrcweir if (!pDoc) 774*cdf0e10cSrcweir return; 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir // iterate in flat mode for groups 777*cdf0e10cSrcweir SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS; 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); 780*cdf0e10cSrcweir SfxObjectShell* pShell = pDoc->GetDocumentShell(); 781*cdf0e10cSrcweir if (pDrawLayer && pShell) 782*cdf0e10cSrcweir { 783*cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 784*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++) 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); 787*cdf0e10cSrcweir DBG_ASSERT(pPage,"Page ?"); 788*cdf0e10cSrcweir if (pPage) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir SdrObjListIter aIter( *pPage, eIter ); 791*cdf0e10cSrcweir SdrObject* pObject = aIter.Next(); 792*cdf0e10cSrcweir while (pObject) 793*cdf0e10cSrcweir { 794*cdf0e10cSrcweir if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) ) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir String aName = ScDrawLayer::GetVisibleName( pObject ); 797*cdf0e10cSrcweir if (aName.Len()) 798*cdf0e10cSrcweir InsertContent( nType, aName ); 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir 801*cdf0e10cSrcweir pObject = aIter.Next(); 802*cdf0e10cSrcweir } 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir void ScContentTree::GetGraphicNames() 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir GetDrawNames( SC_CONTENT_GRAPHIC ); 811*cdf0e10cSrcweir } 812*cdf0e10cSrcweir 813*cdf0e10cSrcweir void ScContentTree::GetOleNames() 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir GetDrawNames( SC_CONTENT_OLEOBJECT ); 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir void ScContentTree::GetDrawingNames() 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir GetDrawNames( SC_CONTENT_DRAWING ); 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir void ScContentTree::GetLinkNames() 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir if ( nRootType && nRootType != SC_CONTENT_AREALINK ) // ausgeblendet ? 826*cdf0e10cSrcweir return; 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 829*cdf0e10cSrcweir if (!pDoc) 830*cdf0e10cSrcweir return; 831*cdf0e10cSrcweir 832*cdf0e10cSrcweir sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); 833*cdf0e10cSrcweir DBG_ASSERT(pLinkManager, "kein LinkManager am Dokument?"); 834*cdf0e10cSrcweir const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); 835*cdf0e10cSrcweir sal_uInt16 nCount = rLinks.Count(); 836*cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++) 837*cdf0e10cSrcweir { 838*cdf0e10cSrcweir ::sfx2::SvBaseLink* pBase = *rLinks[i]; 839*cdf0e10cSrcweir if (pBase->ISA(ScAreaLink)) 840*cdf0e10cSrcweir InsertContent( SC_CONTENT_AREALINK, ((ScAreaLink*)pBase)->GetSource() ); 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir // in der Liste die Namen der Quellbereiche 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir } 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir const ScAreaLink* ScContentTree::GetLink( sal_uLong nIndex ) 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 849*cdf0e10cSrcweir if (!pDoc) 850*cdf0e10cSrcweir return NULL; 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir sal_uLong nFound = 0; 853*cdf0e10cSrcweir sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); 854*cdf0e10cSrcweir DBG_ASSERT(pLinkManager, "kein LinkManager am Dokument?"); 855*cdf0e10cSrcweir const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); 856*cdf0e10cSrcweir sal_uInt16 nCount = rLinks.Count(); 857*cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++) 858*cdf0e10cSrcweir { 859*cdf0e10cSrcweir ::sfx2::SvBaseLink* pBase = *rLinks[i]; 860*cdf0e10cSrcweir if (pBase->ISA(ScAreaLink)) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir if (nFound == nIndex) 863*cdf0e10cSrcweir return (const ScAreaLink*) pBase; 864*cdf0e10cSrcweir ++nFound; 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir DBG_ERROR("Link nicht gefunden"); 869*cdf0e10cSrcweir return NULL; 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir String lcl_NoteString( const ScPostIt& rNote ) 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir String aText = rNote.GetText(); 875*cdf0e10cSrcweir xub_StrLen nAt; 876*cdf0e10cSrcweir while ( (nAt = aText.Search( '\n' )) != STRING_NOTFOUND ) 877*cdf0e10cSrcweir aText.SetChar( nAt, ' ' ); 878*cdf0e10cSrcweir return aText; 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir void ScContentTree::GetNoteStrings() 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir if ( nRootType && nRootType != SC_CONTENT_NOTE ) // ausgeblendet ? 884*cdf0e10cSrcweir return; 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 887*cdf0e10cSrcweir if (!pDoc) 888*cdf0e10cSrcweir return; 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 891*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab ); 894*cdf0e10cSrcweir for( ScBaseCell* pCell = aIter.GetFirst(); pCell; pCell = aIter.GetNext() ) 895*cdf0e10cSrcweir if( const ScPostIt* pNote = pCell->GetNote() ) 896*cdf0e10cSrcweir InsertContent( SC_CONTENT_NOTE, lcl_NoteString( *pNote ) ); 897*cdf0e10cSrcweir } 898*cdf0e10cSrcweir } 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir ScAddress ScContentTree::GetNotePos( sal_uLong nIndex ) 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 903*cdf0e10cSrcweir if (!pDoc) 904*cdf0e10cSrcweir return ScAddress(); 905*cdf0e10cSrcweir 906*cdf0e10cSrcweir sal_uLong nFound = 0; 907*cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 908*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++) 909*cdf0e10cSrcweir { 910*cdf0e10cSrcweir ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab ); 911*cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst(); 912*cdf0e10cSrcweir while (pCell) 913*cdf0e10cSrcweir { 914*cdf0e10cSrcweir if( pCell->HasNote() ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir if (nFound == nIndex) 917*cdf0e10cSrcweir return ScAddress( aIter.GetCol(), aIter.GetRow(), nTab ); // gefunden 918*cdf0e10cSrcweir ++nFound; 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir pCell = aIter.GetNext(); 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir DBG_ERROR("Notiz nicht gefunden"); 925*cdf0e10cSrcweir return ScAddress(); 926*cdf0e10cSrcweir } 927*cdf0e10cSrcweir 928*cdf0e10cSrcweir sal_Bool ScContentTree::NoteStringsChanged() 929*cdf0e10cSrcweir { 930*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 931*cdf0e10cSrcweir if (!pDoc) 932*cdf0e10cSrcweir return sal_False; 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir SvLBoxEntry* pParent = pRootNodes[SC_CONTENT_NOTE]; 935*cdf0e10cSrcweir if (!pParent) 936*cdf0e10cSrcweir return sal_False; 937*cdf0e10cSrcweir 938*cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstChild( pParent ); 939*cdf0e10cSrcweir 940*cdf0e10cSrcweir sal_Bool bEqual = sal_True; 941*cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 942*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++) 943*cdf0e10cSrcweir { 944*cdf0e10cSrcweir ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab ); 945*cdf0e10cSrcweir ScBaseCell* pCell = aIter.GetFirst(); 946*cdf0e10cSrcweir while (pCell && bEqual) 947*cdf0e10cSrcweir { 948*cdf0e10cSrcweir if( const ScPostIt* pNote = pCell->GetNote() ) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir if ( !pEntry ) 951*cdf0e10cSrcweir bEqual = sal_False; 952*cdf0e10cSrcweir else 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir if ( lcl_NoteString( *pNote ) != GetEntryText(pEntry) ) 955*cdf0e10cSrcweir bEqual = sal_False; 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir pEntry = NextSibling( pEntry ); 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir } 960*cdf0e10cSrcweir pCell = aIter.GetNext(); 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir } 963*cdf0e10cSrcweir 964*cdf0e10cSrcweir if ( pEntry ) 965*cdf0e10cSrcweir bEqual = sal_False; // kommt noch was 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir return !bEqual; 968*cdf0e10cSrcweir } 969*cdf0e10cSrcweir 970*cdf0e10cSrcweir sal_Bool ScContentTree::DrawNamesChanged( sal_uInt16 nType ) 971*cdf0e10cSrcweir { 972*cdf0e10cSrcweir ScDocument* pDoc = GetSourceDocument(); 973*cdf0e10cSrcweir if (!pDoc) 974*cdf0e10cSrcweir return sal_False; 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir SvLBoxEntry* pParent = pRootNodes[nType]; 977*cdf0e10cSrcweir if (!pParent) 978*cdf0e10cSrcweir return sal_False; 979*cdf0e10cSrcweir 980*cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstChild( pParent ); 981*cdf0e10cSrcweir 982*cdf0e10cSrcweir // iterate in flat mode for groups 983*cdf0e10cSrcweir SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS; 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir sal_Bool bEqual = sal_True; 986*cdf0e10cSrcweir ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); 987*cdf0e10cSrcweir SfxObjectShell* pShell = pDoc->GetDocumentShell(); 988*cdf0e10cSrcweir if (pDrawLayer && pShell) 989*cdf0e10cSrcweir { 990*cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 991*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++) 992*cdf0e10cSrcweir { 993*cdf0e10cSrcweir SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); 994*cdf0e10cSrcweir DBG_ASSERT(pPage,"Page ?"); 995*cdf0e10cSrcweir if (pPage) 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir SdrObjListIter aIter( *pPage, eIter ); 998*cdf0e10cSrcweir SdrObject* pObject = aIter.Next(); 999*cdf0e10cSrcweir while (pObject && bEqual) 1000*cdf0e10cSrcweir { 1001*cdf0e10cSrcweir if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) ) 1002*cdf0e10cSrcweir { 1003*cdf0e10cSrcweir if ( !pEntry ) 1004*cdf0e10cSrcweir bEqual = sal_False; 1005*cdf0e10cSrcweir else 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir if ( ScDrawLayer::GetVisibleName( pObject ) != GetEntryText(pEntry) ) 1008*cdf0e10cSrcweir bEqual = sal_False; 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir pEntry = NextSibling( pEntry ); 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir } 1013*cdf0e10cSrcweir pObject = aIter.Next(); 1014*cdf0e10cSrcweir } 1015*cdf0e10cSrcweir } 1016*cdf0e10cSrcweir } 1017*cdf0e10cSrcweir } 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir if ( pEntry ) 1020*cdf0e10cSrcweir bEqual = sal_False; // kommt noch was 1021*cdf0e10cSrcweir 1022*cdf0e10cSrcweir return !bEqual; 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir sal_Bool lcl_GetRange( ScDocument* pDoc, sal_uInt16 nType, const String& rName, ScRange& rRange ) 1026*cdf0e10cSrcweir { 1027*cdf0e10cSrcweir sal_Bool bFound = sal_False; 1028*cdf0e10cSrcweir sal_uInt16 nPos; 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir if ( nType == SC_CONTENT_RANGENAME ) 1031*cdf0e10cSrcweir { 1032*cdf0e10cSrcweir ScRangeName* pList = pDoc->GetRangeName(); 1033*cdf0e10cSrcweir if (pList) 1034*cdf0e10cSrcweir if (pList->SearchName( rName, nPos )) 1035*cdf0e10cSrcweir if ( (*pList)[nPos]->IsValidReference( rRange ) ) 1036*cdf0e10cSrcweir bFound = sal_True; 1037*cdf0e10cSrcweir } 1038*cdf0e10cSrcweir else if ( nType == SC_CONTENT_DBAREA ) 1039*cdf0e10cSrcweir { 1040*cdf0e10cSrcweir ScDBCollection* pList = pDoc->GetDBCollection(); 1041*cdf0e10cSrcweir if (pList) 1042*cdf0e10cSrcweir if (pList->SearchName( rName, nPos )) 1043*cdf0e10cSrcweir { 1044*cdf0e10cSrcweir SCTAB nTab; 1045*cdf0e10cSrcweir SCCOL nCol1, nCol2; 1046*cdf0e10cSrcweir SCROW nRow1, nRow2; 1047*cdf0e10cSrcweir (*pList)[nPos]->GetArea(nTab,nCol1,nRow1,nCol2,nRow2); 1048*cdf0e10cSrcweir rRange = ScRange( nCol1,nRow1,nTab, nCol2,nRow2,nTab ); 1049*cdf0e10cSrcweir bFound = sal_True; 1050*cdf0e10cSrcweir } 1051*cdf0e10cSrcweir } 1052*cdf0e10cSrcweir 1053*cdf0e10cSrcweir return bFound; 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir void lcl_DoDragObject( ScDocShell* pSrcShell, const String& rName, sal_uInt16 nType, Window* pWin ) 1057*cdf0e10cSrcweir { 1058*cdf0e10cSrcweir ScDocument* pSrcDoc = pSrcShell->GetDocument(); 1059*cdf0e10cSrcweir ScDrawLayer* pModel = pSrcDoc->GetDrawLayer(); 1060*cdf0e10cSrcweir if (pModel) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir sal_Bool bOle = ( nType == SC_CONTENT_OLEOBJECT ); 1063*cdf0e10cSrcweir sal_Bool bGraf = ( nType == SC_CONTENT_GRAPHIC ); 1064*cdf0e10cSrcweir sal_uInt16 nDrawId = sal::static_int_cast<sal_uInt16>( bOle ? OBJ_OLE2 : ( bGraf ? OBJ_GRAF : OBJ_GRUP ) ); 1065*cdf0e10cSrcweir SCTAB nTab = 0; 1066*cdf0e10cSrcweir SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab ); 1067*cdf0e10cSrcweir if (pObject) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir SdrView aEditView( pModel ); 1070*cdf0e10cSrcweir aEditView.ShowSdrPage(aEditView.GetModel()->GetPage(nTab)); 1071*cdf0e10cSrcweir SdrPageView* pPV = aEditView.GetSdrPageView(); 1072*cdf0e10cSrcweir aEditView.MarkObj(pObject, pPV); 1073*cdf0e10cSrcweir 1074*cdf0e10cSrcweir SdrModel* pDragModel = aEditView.GetAllMarkedModel(); 1075*cdf0e10cSrcweir 1076*cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 1077*cdf0e10cSrcweir pSrcShell->FillTransferableObjectDescriptor( aObjDesc ); 1078*cdf0e10cSrcweir aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass(); 1079*cdf0e10cSrcweir // maSize is set in ScDrawTransferObj ctor 1080*cdf0e10cSrcweir 1081*cdf0e10cSrcweir ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pDragModel, pSrcShell, aObjDesc ); 1082*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir pTransferObj->SetDragSourceObj( pObject, nTab ); 1085*cdf0e10cSrcweir pTransferObj->SetDragSourceFlags( SC_DROP_NAVIGATOR ); 1086*cdf0e10cSrcweir 1087*cdf0e10cSrcweir SC_MOD()->SetDragObject( NULL, pTransferObj ); 1088*cdf0e10cSrcweir pWin->ReleaseMouse(); 1089*cdf0e10cSrcweir pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir } 1092*cdf0e10cSrcweir } 1093*cdf0e10cSrcweir 1094*cdf0e10cSrcweir void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, sal_uInt16 nFlags, Window* pWin ) 1095*cdf0e10cSrcweir { 1096*cdf0e10cSrcweir ScMarkData aMark; 1097*cdf0e10cSrcweir aMark.SelectTable( rRange.aStart.Tab(), sal_True ); 1098*cdf0e10cSrcweir aMark.SetMarkArea( rRange ); 1099*cdf0e10cSrcweir 1100*cdf0e10cSrcweir ScDocument* pSrcDoc = pSrcShell->GetDocument(); 1101*cdf0e10cSrcweir if ( !pSrcDoc->HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(), 1102*cdf0e10cSrcweir rRange.aEnd.Col(), rRange.aEnd.Row(), 1103*cdf0e10cSrcweir aMark ) ) 1104*cdf0e10cSrcweir { 1105*cdf0e10cSrcweir ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP ); 1106*cdf0e10cSrcweir ScClipParam aClipParam(rRange, false); 1107*cdf0e10cSrcweir pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark); 1108*cdf0e10cSrcweir // pClipDoc->ExtendMerge( rRange, sal_True ); 1109*cdf0e10cSrcweir 1110*cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 1111*cdf0e10cSrcweir pSrcShell->FillTransferableObjectDescriptor( aObjDesc ); 1112*cdf0e10cSrcweir aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass(); 1113*cdf0e10cSrcweir // maSize is set in ScTransferObj ctor 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc ); 1116*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir pTransferObj->SetDragSource( pSrcShell, aMark ); 1119*cdf0e10cSrcweir pTransferObj->SetDragSourceFlags( nFlags ); 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir SC_MOD()->SetDragObject( pTransferObj, NULL ); // for internal D&D 1122*cdf0e10cSrcweir pWin->ReleaseMouse(); 1123*cdf0e10cSrcweir pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); 1124*cdf0e10cSrcweir } 1125*cdf0e10cSrcweir } 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir void ScContentTree::DoDrag() 1128*cdf0e10cSrcweir { 1129*cdf0e10cSrcweir ScDocumentLoader* pDocLoader = NULL; 1130*cdf0e10cSrcweir bIsInDrag = sal_True; 1131*cdf0e10cSrcweir 1132*cdf0e10cSrcweir ScModule* pScMod = SC_MOD(); 1133*cdf0e10cSrcweir 1134*cdf0e10cSrcweir sal_uInt16 nType; 1135*cdf0e10cSrcweir sal_uLong nChild; 1136*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 1137*cdf0e10cSrcweir GetEntryIndexes( nType, nChild, pEntry ); 1138*cdf0e10cSrcweir 1139*cdf0e10cSrcweir if( pEntry && 1140*cdf0e10cSrcweir (nChild != SC_CONTENT_NOCHILD) && 1141*cdf0e10cSrcweir (nType != SC_CONTENT_ROOT) && 1142*cdf0e10cSrcweir (nType != SC_CONTENT_NOTE) && 1143*cdf0e10cSrcweir (nType != SC_CONTENT_AREALINK) ) 1144*cdf0e10cSrcweir { 1145*cdf0e10cSrcweir String aText( GetEntryText( pEntry ) ); 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir ScDocument* pLocalDoc = NULL; // fuer URL-Drop 1148*cdf0e10cSrcweir String aDocName; 1149*cdf0e10cSrcweir if (bHiddenDoc) 1150*cdf0e10cSrcweir aDocName = aHiddenName; 1151*cdf0e10cSrcweir else 1152*cdf0e10cSrcweir { 1153*cdf0e10cSrcweir ScDocShell* pDocSh = GetManualOrCurrent(); 1154*cdf0e10cSrcweir if (pDocSh) 1155*cdf0e10cSrcweir { 1156*cdf0e10cSrcweir if (pDocSh->HasName()) 1157*cdf0e10cSrcweir aDocName = pDocSh->GetMedium()->GetName(); 1158*cdf0e10cSrcweir else 1159*cdf0e10cSrcweir pLocalDoc = pDocSh->GetDocument(); // Drop nur in dieses Dokument 1160*cdf0e10cSrcweir } 1161*cdf0e10cSrcweir } 1162*cdf0e10cSrcweir 1163*cdf0e10cSrcweir sal_Bool bDoLinkTrans = sal_False; // use ScLinkTransferObj 1164*cdf0e10cSrcweir String aLinkURL; // for ScLinkTransferObj 1165*cdf0e10cSrcweir String aLinkText; 1166*cdf0e10cSrcweir 1167*cdf0e10cSrcweir sal_uInt16 nDropMode = pParentWindow->GetDropMode(); 1168*cdf0e10cSrcweir switch ( nDropMode ) 1169*cdf0e10cSrcweir { 1170*cdf0e10cSrcweir case SC_DROPMODE_URL: 1171*cdf0e10cSrcweir { 1172*cdf0e10cSrcweir String aUrl = aDocName; 1173*cdf0e10cSrcweir aUrl += '#'; 1174*cdf0e10cSrcweir aUrl += aText; 1175*cdf0e10cSrcweir 1176*cdf0e10cSrcweir pScMod->SetDragJump( pLocalDoc, aUrl, aText ); 1177*cdf0e10cSrcweir 1178*cdf0e10cSrcweir if (aDocName.Len()) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir // provide URL to outside only if the document has a name 1181*cdf0e10cSrcweir // (without name, only internal D&D via SetDragJump) 1182*cdf0e10cSrcweir 1183*cdf0e10cSrcweir aLinkURL = aUrl; 1184*cdf0e10cSrcweir aLinkText = aText; 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir bDoLinkTrans = sal_True; 1187*cdf0e10cSrcweir } 1188*cdf0e10cSrcweir break; 1189*cdf0e10cSrcweir case SC_DROPMODE_LINK: 1190*cdf0e10cSrcweir { 1191*cdf0e10cSrcweir if ( aDocName.Len() ) // link only to named documents 1192*cdf0e10cSrcweir { 1193*cdf0e10cSrcweir // for internal D&D, set flag to insert a link 1194*cdf0e10cSrcweir 1195*cdf0e10cSrcweir switch ( nType ) 1196*cdf0e10cSrcweir { 1197*cdf0e10cSrcweir case SC_CONTENT_TABLE: 1198*cdf0e10cSrcweir pScMod->SetDragLink( aDocName, aText, EMPTY_STRING ); 1199*cdf0e10cSrcweir bDoLinkTrans = sal_True; 1200*cdf0e10cSrcweir break; 1201*cdf0e10cSrcweir case SC_CONTENT_RANGENAME: 1202*cdf0e10cSrcweir case SC_CONTENT_DBAREA: 1203*cdf0e10cSrcweir pScMod->SetDragLink( aDocName, EMPTY_STRING, aText ); 1204*cdf0e10cSrcweir bDoLinkTrans = sal_True; 1205*cdf0e10cSrcweir break; 1206*cdf0e10cSrcweir 1207*cdf0e10cSrcweir // other types cannot be linked 1208*cdf0e10cSrcweir } 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir } 1211*cdf0e10cSrcweir break; 1212*cdf0e10cSrcweir case SC_DROPMODE_COPY: 1213*cdf0e10cSrcweir { 1214*cdf0e10cSrcweir ScDocShell* pSrcShell = NULL; 1215*cdf0e10cSrcweir if ( bHiddenDoc ) 1216*cdf0e10cSrcweir { 1217*cdf0e10cSrcweir String aFilter, aOptions; 1218*cdf0e10cSrcweir pDocLoader = new ScDocumentLoader( aHiddenName, aFilter, aOptions ); 1219*cdf0e10cSrcweir if (!pDocLoader->IsError()) 1220*cdf0e10cSrcweir pSrcShell = pDocLoader->GetDocShell(); 1221*cdf0e10cSrcweir } 1222*cdf0e10cSrcweir else 1223*cdf0e10cSrcweir pSrcShell = GetManualOrCurrent(); 1224*cdf0e10cSrcweir 1225*cdf0e10cSrcweir if ( pSrcShell ) 1226*cdf0e10cSrcweir { 1227*cdf0e10cSrcweir ScDocument* pSrcDoc = pSrcShell->GetDocument(); 1228*cdf0e10cSrcweir if ( nType == SC_CONTENT_RANGENAME || nType == SC_CONTENT_DBAREA ) 1229*cdf0e10cSrcweir { 1230*cdf0e10cSrcweir ScRange aRange; 1231*cdf0e10cSrcweir if ( lcl_GetRange( pSrcDoc, nType, aText, aRange ) ) 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir lcl_DoDragCells( pSrcShell, aRange, SC_DROP_NAVIGATOR, this ); 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir } 1236*cdf0e10cSrcweir else if ( nType == SC_CONTENT_TABLE ) 1237*cdf0e10cSrcweir { 1238*cdf0e10cSrcweir SCTAB nTab; 1239*cdf0e10cSrcweir if ( pSrcDoc->GetTable( aText, nTab ) ) 1240*cdf0e10cSrcweir { 1241*cdf0e10cSrcweir ScRange aRange( 0,0,nTab, MAXCOL,MAXROW,nTab ); 1242*cdf0e10cSrcweir lcl_DoDragCells( pSrcShell, aRange, SC_DROP_NAVIGATOR | SC_DROP_TABLE, this ); 1243*cdf0e10cSrcweir } 1244*cdf0e10cSrcweir } 1245*cdf0e10cSrcweir else if ( nType == SC_CONTENT_GRAPHIC || nType == SC_CONTENT_OLEOBJECT || 1246*cdf0e10cSrcweir nType == SC_CONTENT_DRAWING ) 1247*cdf0e10cSrcweir { 1248*cdf0e10cSrcweir lcl_DoDragObject( pSrcShell, aText, nType, this ); 1249*cdf0e10cSrcweir 1250*cdf0e10cSrcweir // in ExecuteDrag kann der Navigator geloescht worden sein 1251*cdf0e10cSrcweir // -> nicht mehr auf Member zugreifen !!! 1252*cdf0e10cSrcweir } 1253*cdf0e10cSrcweir } 1254*cdf0e10cSrcweir } 1255*cdf0e10cSrcweir break; 1256*cdf0e10cSrcweir } 1257*cdf0e10cSrcweir 1258*cdf0e10cSrcweir if (bDoLinkTrans) 1259*cdf0e10cSrcweir { 1260*cdf0e10cSrcweir ScLinkTransferObj* pTransferObj = new ScLinkTransferObj; 1261*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); 1262*cdf0e10cSrcweir 1263*cdf0e10cSrcweir if ( aLinkURL.Len() ) 1264*cdf0e10cSrcweir pTransferObj->SetLinkURL( aLinkURL, aLinkText ); 1265*cdf0e10cSrcweir 1266*cdf0e10cSrcweir // SetDragJump / SetDragLink has been done above 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir ReleaseMouse(); 1269*cdf0e10cSrcweir pTransferObj->StartDrag( this, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); 1270*cdf0e10cSrcweir } 1271*cdf0e10cSrcweir } 1272*cdf0e10cSrcweir 1273*cdf0e10cSrcweir bIsInDrag = sal_False; // static Member 1274*cdf0e10cSrcweir 1275*cdf0e10cSrcweir delete pDocLoader; // falls Dokument zum Draggen geladen wurde 1276*cdf0e10cSrcweir } 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir IMPL_STATIC_LINK(ScContentTree, ExecDragHdl, void*, EMPTYARG) 1279*cdf0e10cSrcweir { 1280*cdf0e10cSrcweir // als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der 1281*cdf0e10cSrcweir // Navigator geloescht werden darf 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir pThis->DoDrag(); 1284*cdf0e10cSrcweir return 0; 1285*cdf0e10cSrcweir } 1286*cdf0e10cSrcweir 1287*cdf0e10cSrcweir //UNUSED2008-05 void ScContentTree::AdjustTitle() 1288*cdf0e10cSrcweir //UNUSED2008-05 { 1289*cdf0e10cSrcweir //UNUSED2008-05 String aTitle = pParentWindow->aTitleBase; 1290*cdf0e10cSrcweir //UNUSED2008-05 if (bHiddenDoc) 1291*cdf0e10cSrcweir //UNUSED2008-05 { 1292*cdf0e10cSrcweir //UNUSED2008-05 aTitle.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " - " )); 1293*cdf0e10cSrcweir //UNUSED2008-05 aTitle += aHiddenTitle; 1294*cdf0e10cSrcweir //UNUSED2008-05 } 1295*cdf0e10cSrcweir //UNUSED2008-05 pParentWindow->SetText(aTitle); 1296*cdf0e10cSrcweir //UNUSED2008-05 } 1297*cdf0e10cSrcweir 1298*cdf0e10cSrcweir sal_Bool ScContentTree::LoadFile( const String& rUrl ) 1299*cdf0e10cSrcweir { 1300*cdf0e10cSrcweir String aDocName = rUrl; 1301*cdf0e10cSrcweir xub_StrLen nPos = aDocName.Search('#'); 1302*cdf0e10cSrcweir if ( nPos != STRING_NOTFOUND ) 1303*cdf0e10cSrcweir aDocName.Erase(nPos); // nur der Name, ohne #... 1304*cdf0e10cSrcweir 1305*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 1306*cdf0e10cSrcweir String aFilter, aOptions; 1307*cdf0e10cSrcweir ScDocumentLoader aLoader( aDocName, aFilter, aOptions ); 1308*cdf0e10cSrcweir if ( !aLoader.IsError() ) 1309*cdf0e10cSrcweir { 1310*cdf0e10cSrcweir bHiddenDoc = sal_True; 1311*cdf0e10cSrcweir aHiddenName = aDocName; 1312*cdf0e10cSrcweir aHiddenTitle = aLoader.GetTitle(); 1313*cdf0e10cSrcweir pHiddenDocument = aLoader.GetDocument(); 1314*cdf0e10cSrcweir 1315*cdf0e10cSrcweir Refresh(); // Inhalte aus geladenem Dokument holen 1316*cdf0e10cSrcweir 1317*cdf0e10cSrcweir pHiddenDocument = NULL; 1318*cdf0e10cSrcweir // AdjustTitle(); 1319*cdf0e10cSrcweir 1320*cdf0e10cSrcweir pParentWindow->GetDocNames( &aHiddenTitle ); // Liste fuellen 1321*cdf0e10cSrcweir } 1322*cdf0e10cSrcweir else 1323*cdf0e10cSrcweir Sound::Beep(); // Fehler beim Laden 1324*cdf0e10cSrcweir 1325*cdf0e10cSrcweir // Dokument wird im dtor von ScDocumentLoader wieder geschlossen 1326*cdf0e10cSrcweir 1327*cdf0e10cSrcweir return bReturn; 1328*cdf0e10cSrcweir } 1329*cdf0e10cSrcweir 1330*cdf0e10cSrcweir void ScContentTree::InitWindowBits( sal_Bool bButtons ) 1331*cdf0e10cSrcweir { 1332*cdf0e10cSrcweir WinBits nFlags = GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL; 1333*cdf0e10cSrcweir if (bButtons) 1334*cdf0e10cSrcweir nFlags |= WB_HASBUTTONS|WB_HASBUTTONSATROOT; 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir SetStyle( nFlags ); 1337*cdf0e10cSrcweir } 1338*cdf0e10cSrcweir 1339*cdf0e10cSrcweir void ScContentTree::SetRootType( sal_uInt16 nNew ) 1340*cdf0e10cSrcweir { 1341*cdf0e10cSrcweir if ( nNew != nRootType ) 1342*cdf0e10cSrcweir { 1343*cdf0e10cSrcweir nRootType = nNew; 1344*cdf0e10cSrcweir InitWindowBits( nNew == 0 ); 1345*cdf0e10cSrcweir Refresh(); 1346*cdf0e10cSrcweir 1347*cdf0e10cSrcweir ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); 1348*cdf0e10cSrcweir rCfg.SetRootType( nRootType ); 1349*cdf0e10cSrcweir } 1350*cdf0e10cSrcweir } 1351*cdf0e10cSrcweir 1352*cdf0e10cSrcweir void ScContentTree::ToggleRoot() // nach Selektion 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir sal_uInt16 nNew = SC_CONTENT_ROOT; 1355*cdf0e10cSrcweir if ( nRootType == SC_CONTENT_ROOT ) 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 1358*cdf0e10cSrcweir if (pEntry) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir SvLBoxEntry* pParent = GetParent(pEntry); 1361*cdf0e10cSrcweir for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++) 1362*cdf0e10cSrcweir if ( pEntry == pRootNodes[i] || pParent == pRootNodes[i] ) 1363*cdf0e10cSrcweir nNew = i; 1364*cdf0e10cSrcweir } 1365*cdf0e10cSrcweir } 1366*cdf0e10cSrcweir 1367*cdf0e10cSrcweir SetRootType( nNew ); 1368*cdf0e10cSrcweir } 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir void ScContentTree::ResetManualDoc() 1371*cdf0e10cSrcweir { 1372*cdf0e10cSrcweir aManualDoc.Erase(); 1373*cdf0e10cSrcweir bHiddenDoc = sal_False; 1374*cdf0e10cSrcweir 1375*cdf0e10cSrcweir ActiveDocChanged(); 1376*cdf0e10cSrcweir } 1377*cdf0e10cSrcweir 1378*cdf0e10cSrcweir void ScContentTree::ActiveDocChanged() 1379*cdf0e10cSrcweir { 1380*cdf0e10cSrcweir if ( !bHiddenDoc && !aManualDoc.Len() ) 1381*cdf0e10cSrcweir Refresh(); // Inhalte nur wenn automatisch 1382*cdf0e10cSrcweir 1383*cdf0e10cSrcweir // Listbox muss immer geupdated werden, wegen aktiv-Flag 1384*cdf0e10cSrcweir 1385*cdf0e10cSrcweir String aCurrent; 1386*cdf0e10cSrcweir if ( bHiddenDoc ) 1387*cdf0e10cSrcweir aCurrent = aHiddenTitle; 1388*cdf0e10cSrcweir else 1389*cdf0e10cSrcweir { 1390*cdf0e10cSrcweir ScDocShell* pSh = GetManualOrCurrent(); 1391*cdf0e10cSrcweir if (pSh) 1392*cdf0e10cSrcweir aCurrent = pSh->GetTitle(); 1393*cdf0e10cSrcweir else 1394*cdf0e10cSrcweir { 1395*cdf0e10cSrcweir // eingestelltes Dokument existiert nicht mehr 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir aManualDoc.Erase(); // wieder automatisch 1398*cdf0e10cSrcweir Refresh(); 1399*cdf0e10cSrcweir pSh = GetManualOrCurrent(); // sollte jetzt aktives sein 1400*cdf0e10cSrcweir if (pSh) 1401*cdf0e10cSrcweir aCurrent = pSh->GetTitle(); 1402*cdf0e10cSrcweir } 1403*cdf0e10cSrcweir } 1404*cdf0e10cSrcweir pParentWindow->GetDocNames( &aCurrent ); // selektieren 1405*cdf0e10cSrcweir } 1406*cdf0e10cSrcweir 1407*cdf0e10cSrcweir void ScContentTree::SetManualDoc(const String& rName) 1408*cdf0e10cSrcweir { 1409*cdf0e10cSrcweir aManualDoc = rName; 1410*cdf0e10cSrcweir if (!bHiddenDoc) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir Refresh(); 1413*cdf0e10cSrcweir pParentWindow->GetDocNames( &aManualDoc ); // selektieren 1414*cdf0e10cSrcweir } 1415*cdf0e10cSrcweir } 1416*cdf0e10cSrcweir 1417*cdf0e10cSrcweir void ScContentTree::SelectDoc(const String& rName) // rName wie im Menue/Listbox angezeigt 1418*cdf0e10cSrcweir { 1419*cdf0e10cSrcweir if ( rName == pParentWindow->aStrActiveWin ) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir ResetManualDoc(); 1422*cdf0e10cSrcweir return; 1423*cdf0e10cSrcweir } 1424*cdf0e10cSrcweir 1425*cdf0e10cSrcweir // "aktiv" oder "inaktiv" weglassen 1426*cdf0e10cSrcweir 1427*cdf0e10cSrcweir String aRealName = rName; 1428*cdf0e10cSrcweir xub_StrLen nLen = rName.Len(); 1429*cdf0e10cSrcweir xub_StrLen nActiveStart = nLen - pParentWindow->aStrActive.Len(); 1430*cdf0e10cSrcweir if ( rName.Copy( nActiveStart ) == pParentWindow->aStrActive ) 1431*cdf0e10cSrcweir aRealName = rName.Copy( 0, nActiveStart ); 1432*cdf0e10cSrcweir xub_StrLen nNotActiveStart = nLen - pParentWindow->aStrNotActive.Len(); 1433*cdf0e10cSrcweir if ( rName.Copy( nNotActiveStart ) == pParentWindow->aStrNotActive ) 1434*cdf0e10cSrcweir aRealName = rName.Copy( 0, nNotActiveStart ); 1435*cdf0e10cSrcweir 1436*cdf0e10cSrcweir // 1437*cdf0e10cSrcweir 1438*cdf0e10cSrcweir sal_Bool bLoaded = sal_False; 1439*cdf0e10cSrcweir 1440*cdf0e10cSrcweir // ist es ein normal geladenes Doc ? 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::GetFirst(); 1443*cdf0e10cSrcweir while ( pSh && !bLoaded ) 1444*cdf0e10cSrcweir { 1445*cdf0e10cSrcweir if ( pSh->ISA(ScDocShell) ) 1446*cdf0e10cSrcweir if ( pSh->GetTitle() == aRealName ) 1447*cdf0e10cSrcweir bLoaded = sal_True; 1448*cdf0e10cSrcweir pSh = SfxObjectShell::GetNext( *pSh ); 1449*cdf0e10cSrcweir } 1450*cdf0e10cSrcweir 1451*cdf0e10cSrcweir if (bLoaded) 1452*cdf0e10cSrcweir { 1453*cdf0e10cSrcweir bHiddenDoc = sal_False; 1454*cdf0e10cSrcweir SetManualDoc(aRealName); 1455*cdf0e10cSrcweir } 1456*cdf0e10cSrcweir else if (aHiddenTitle.Len()) // verstecktes ausgewaehlt 1457*cdf0e10cSrcweir { 1458*cdf0e10cSrcweir if (!bHiddenDoc) 1459*cdf0e10cSrcweir LoadFile(aHiddenName); 1460*cdf0e10cSrcweir } 1461*cdf0e10cSrcweir else 1462*cdf0e10cSrcweir { 1463*cdf0e10cSrcweir DBG_ERROR("SelectDoc: nicht gefunden"); 1464*cdf0e10cSrcweir } 1465*cdf0e10cSrcweir } 1466*cdf0e10cSrcweir 1467*cdf0e10cSrcweir void ScContentTree::ApplySettings() 1468*cdf0e10cSrcweir { 1469*cdf0e10cSrcweir const ScNavigatorSettings* pSettings = pParentWindow->GetNavigatorSettings(); 1470*cdf0e10cSrcweir if( pSettings ) 1471*cdf0e10cSrcweir { 1472*cdf0e10cSrcweir sal_uInt16 nRootSel = pSettings->GetRootSelected(); 1473*cdf0e10cSrcweir sal_uLong nChildSel = pSettings->GetChildSelected(); 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir for( sal_uInt16 nEntry = 1; nEntry < SC_CONTENT_COUNT; ++nEntry ) 1476*cdf0e10cSrcweir { 1477*cdf0e10cSrcweir if( pRootNodes[ nEntry ] ) 1478*cdf0e10cSrcweir { 1479*cdf0e10cSrcweir // expand 1480*cdf0e10cSrcweir sal_Bool bExp = pSettings->IsExpanded( nEntry ); 1481*cdf0e10cSrcweir if( bExp != IsExpanded( pRootNodes[ nEntry ] ) ) 1482*cdf0e10cSrcweir { 1483*cdf0e10cSrcweir if( bExp ) 1484*cdf0e10cSrcweir Expand( pRootNodes[ nEntry ] ); 1485*cdf0e10cSrcweir else 1486*cdf0e10cSrcweir Collapse( pRootNodes[ nEntry ] ); 1487*cdf0e10cSrcweir } 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir // select 1490*cdf0e10cSrcweir if( nRootSel == nEntry ) 1491*cdf0e10cSrcweir { 1492*cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL; 1493*cdf0e10cSrcweir if( bExp && (nChildSel != SC_CONTENT_NOCHILD) ) 1494*cdf0e10cSrcweir pEntry = GetEntry( pRootNodes[ nEntry ], nChildSel ); 1495*cdf0e10cSrcweir Select( pEntry ? pEntry : pRootNodes[ nEntry ] ); 1496*cdf0e10cSrcweir } 1497*cdf0e10cSrcweir } 1498*cdf0e10cSrcweir } 1499*cdf0e10cSrcweir } 1500*cdf0e10cSrcweir } 1501*cdf0e10cSrcweir 1502*cdf0e10cSrcweir void ScContentTree::StoreSettings() const 1503*cdf0e10cSrcweir { 1504*cdf0e10cSrcweir ScNavigatorSettings* pSettings = pParentWindow->GetNavigatorSettings(); 1505*cdf0e10cSrcweir if( pSettings ) 1506*cdf0e10cSrcweir { 1507*cdf0e10cSrcweir for( sal_uInt16 nEntry = 1; nEntry < SC_CONTENT_COUNT; ++nEntry ) 1508*cdf0e10cSrcweir { 1509*cdf0e10cSrcweir sal_Bool bExp = pRootNodes[ nEntry ] && IsExpanded( pRootNodes[ nEntry ] ); 1510*cdf0e10cSrcweir pSettings->SetExpanded( nEntry, bExp ); 1511*cdf0e10cSrcweir } 1512*cdf0e10cSrcweir sal_uInt16 nRoot; 1513*cdf0e10cSrcweir sal_uLong nChild; 1514*cdf0e10cSrcweir GetEntryIndexes( nRoot, nChild, GetCurEntry() ); 1515*cdf0e10cSrcweir pSettings->SetRootSelected( nRoot ); 1516*cdf0e10cSrcweir pSettings->SetChildSelected( nChild ); 1517*cdf0e10cSrcweir } 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir 1521*cdf0e10cSrcweir // 1522*cdf0e10cSrcweir //------------------------------------------------------------------------ 1523*cdf0e10cSrcweir // 1524*cdf0e10cSrcweir 1525*cdf0e10cSrcweir 1526*cdf0e10cSrcweir 1527*cdf0e10cSrcweir 1528*cdf0e10cSrcweir 1529