1efeef26fSAndrew Rist /************************************************************** 2efeef26fSAndrew Rist * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10efeef26fSAndrew Rist * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12efeef26fSAndrew Rist * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19efeef26fSAndrew Rist * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _SVSTDARR_HXX 28cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR 29cdf0e10cSrcweir #include <svl/svstdarr.hxx> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #include <svl/urlbmk.hxx> 32cdf0e10cSrcweir #include <tools/urlobj.hxx> 33cdf0e10cSrcweir #include <sfx2/docfile.hxx> 34cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 35cdf0e10cSrcweir #include <vcl/help.hxx> 36cdf0e10cSrcweir #include <sot/formats.hxx> 37cdf0e10cSrcweir #include <vcl/sound.hxx> 38cdf0e10cSrcweir #include <uiitems.hxx> 39cdf0e10cSrcweir #include <fmtinfmt.hxx> 40cdf0e10cSrcweir #include <txtinet.hxx> 41cdf0e10cSrcweir #include <fmtfld.hxx> 42cdf0e10cSrcweir #include <swmodule.hxx> 43cdf0e10cSrcweir #include <wrtsh.hxx> 44cdf0e10cSrcweir #include <view.hxx> 45cdf0e10cSrcweir #include <errhdl.hxx> 46cdf0e10cSrcweir #include <docsh.hxx> 47cdf0e10cSrcweir #include <content.hxx> 48cdf0e10cSrcweir #include <frmfmt.hxx> 49cdf0e10cSrcweir #include <fldbas.hxx> 50cdf0e10cSrcweir #include <txtatr.hxx> 51cdf0e10cSrcweir #include <IMark.hxx> 52cdf0e10cSrcweir #include <section.hxx> 53cdf0e10cSrcweir #include <tox.hxx> 54cdf0e10cSrcweir #define NAVIPI_CXX 55cdf0e10cSrcweir #include <navipi.hxx> 56cdf0e10cSrcweir #include <navicont.hxx> 57cdf0e10cSrcweir #include <navicfg.hxx> 58cdf0e10cSrcweir #include <edtwin.hxx> 59cdf0e10cSrcweir #include <doc.hxx> 60cdf0e10cSrcweir #include <unotools.hxx> 61cdf0e10cSrcweir #include <crsskip.hxx> 62cdf0e10cSrcweir #include <cmdid.h> 63cdf0e10cSrcweir #include <helpid.h> 64cdf0e10cSrcweir #include <navipi.hrc> 65cdf0e10cSrcweir #include <utlui.hrc> 66cdf0e10cSrcweir #include <misc.hrc> 67cdf0e10cSrcweir #include <comcore.hrc> 68cdf0e10cSrcweir #include <com/sun/star/text/XTextSectionsSupplier.hpp> 69cdf0e10cSrcweir #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> 70cdf0e10cSrcweir #include <com/sun/star/text/XTextTablesSupplier.hpp> 71cdf0e10cSrcweir #include <com/sun/star/text/XDocumentIndexesSupplier.hpp> 72cdf0e10cSrcweir #include <com/sun/star/text/XDocumentIndex.hpp> 73cdf0e10cSrcweir #include <com/sun/star/text/XBookmarksSupplier.hpp> 74cdf0e10cSrcweir #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> 75cdf0e10cSrcweir #include <com/sun/star/text/XTextFramesSupplier.hpp> 76cdf0e10cSrcweir #include <dcontact.hxx> 77cdf0e10cSrcweir #include <svx/svdogrp.hxx> 78cdf0e10cSrcweir #include <svx/svdmodel.hxx> 79cdf0e10cSrcweir #include <svx/svdpage.hxx> 80cdf0e10cSrcweir #include <svx/svdview.hxx> 81cdf0e10cSrcweir #include <vcl/scrbar.hxx> 82cdf0e10cSrcweir #include <comcore.hrc> 83cdf0e10cSrcweir #include <SwRewriter.hxx> 84cdf0e10cSrcweir #include <hints.hxx> 85cdf0e10cSrcweir #include <numrule.hxx> 86cdf0e10cSrcweir #include <swundo.hxx> 87cdf0e10cSrcweir #include <ndtxt.hxx> 88cdf0e10cSrcweir #include <PostItMgr.hxx> 89cdf0e10cSrcweir #include <postithelper.hxx> 90cdf0e10cSrcweir #include <redline.hxx> 91cdf0e10cSrcweir #include <docary.hxx> 92cdf0e10cSrcweir 93cdf0e10cSrcweir #include "swabstdlg.hxx" 94cdf0e10cSrcweir #include "globals.hrc" 95cdf0e10cSrcweir #include <unomid.h> 96cdf0e10cSrcweir 97cdf0e10cSrcweir 98cdf0e10cSrcweir #define CTYPE_CNT 0 99cdf0e10cSrcweir #define CTYPE_CTT 1 100cdf0e10cSrcweir 101cdf0e10cSrcweir using namespace ::std; 102cdf0e10cSrcweir using namespace ::com::sun::star; 103cdf0e10cSrcweir using namespace ::com::sun::star::text; 104cdf0e10cSrcweir using namespace ::com::sun::star::uno; 105cdf0e10cSrcweir using namespace ::com::sun::star::container; 106cdf0e10cSrcweir 107cdf0e10cSrcweir 108cdf0e10cSrcweir #define NAVI_BOOKMARK_DELIM (sal_Unicode)1 109cdf0e10cSrcweir 110cdf0e10cSrcweir /*************************************************************************** 111cdf0e10cSrcweir 112cdf0e10cSrcweir ***************************************************************************/ 113cdf0e10cSrcweir 114cdf0e10cSrcweir typedef SwContent* SwContentPtr; 115cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL( SwContentArr, SwContentPtr, 0,4) 116cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT(SwContentArr, SwContentPtr) 117cdf0e10cSrcweir 118cdf0e10cSrcweir sal_Bool SwContentTree::bIsInDrag = sal_False; 119cdf0e10cSrcweir 120cdf0e10cSrcweir 121cdf0e10cSrcweir namespace 122cdf0e10cSrcweir { 123cdf0e10cSrcweir static sal_Bool lcl_IsContent(SvLBoxEntry* pEntry) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CNT; 126cdf0e10cSrcweir } 127cdf0e10cSrcweir 128cdf0e10cSrcweir 129cdf0e10cSrcweir static sal_Bool lcl_IsContentType(SvLBoxEntry* pEntry) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CTT; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir 135cdf0e10cSrcweir static sal_Bool lcl_FindShell(SwWrtShell* pShell) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir sal_Bool bFound = sal_False; 138cdf0e10cSrcweir SwView *pView = SwModule::GetFirstView(); 139cdf0e10cSrcweir while (pView) 140cdf0e10cSrcweir { 141cdf0e10cSrcweir if(pShell == &pView->GetWrtShell()) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir bFound = sal_True; 144cdf0e10cSrcweir break; 145cdf0e10cSrcweir } 146cdf0e10cSrcweir pView = SwModule::GetNextView(pView); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir return bFound; 149cdf0e10cSrcweir } 150cdf0e10cSrcweir 151cdf0e10cSrcweir static bool lcl_IsUiVisibleBookmark(const IDocumentMarkAccess::pMark_t& rpMark) 152cdf0e10cSrcweir { 153cdf0e10cSrcweir return IDocumentMarkAccess::GetType(*rpMark) == IDocumentMarkAccess::BOOKMARK; 154cdf0e10cSrcweir } 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir /*************************************************************************** 158cdf0e10cSrcweir Beschreibung: Inhalt, enthaelt Namen und Verweis auf den Inhalstyp 159cdf0e10cSrcweir ***************************************************************************/ 160cdf0e10cSrcweir 161cdf0e10cSrcweir 162cdf0e10cSrcweir SwContent::SwContent(const SwContentType* pCnt, const String& rName, long nYPos) : 163cdf0e10cSrcweir SwTypeNumber(CTYPE_CNT), 164cdf0e10cSrcweir pParent(pCnt), 165cdf0e10cSrcweir sContentName(rName), 166cdf0e10cSrcweir nYPosition(nYPos), 167cdf0e10cSrcweir bInvisible(sal_False) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir 172cdf0e10cSrcweir sal_uInt8 SwTypeNumber::GetTypeId() 173cdf0e10cSrcweir { 174cdf0e10cSrcweir return nTypeId; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir SwTypeNumber::~SwTypeNumber() 178cdf0e10cSrcweir { 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir sal_Bool SwContent::IsProtect() const 182cdf0e10cSrcweir { 183cdf0e10cSrcweir return sal_False; 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir sal_Bool SwPostItContent::IsProtect() const 187cdf0e10cSrcweir { 188cdf0e10cSrcweir if (mbPostIt) 189cdf0e10cSrcweir return pFld->IsProtect(); 190cdf0e10cSrcweir else 191cdf0e10cSrcweir return false; 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir sal_Bool SwURLFieldContent::IsProtect() const 195cdf0e10cSrcweir { 196cdf0e10cSrcweir return pINetAttr->IsProtect(); 197cdf0e10cSrcweir } 198cdf0e10cSrcweir 199cdf0e10cSrcweir SwGraphicContent::~SwGraphicContent() 200cdf0e10cSrcweir { 201cdf0e10cSrcweir } 202cdf0e10cSrcweir SwTOXBaseContent::~SwTOXBaseContent() 203cdf0e10cSrcweir { 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir /*************************************************************************** 207cdf0e10cSrcweir Beschreibung: Inhaltstyp, kennt seine Inhalte und die WrtShell 208cdf0e10cSrcweir ***************************************************************************/ 209cdf0e10cSrcweir 210cdf0e10cSrcweir 211cdf0e10cSrcweir SwContentType::SwContentType(SwWrtShell* pShell, sal_uInt16 nType, sal_uInt8 nLevel) : 212cdf0e10cSrcweir SwTypeNumber(CTYPE_CTT), 213cdf0e10cSrcweir pWrtShell(pShell), 214cdf0e10cSrcweir pMember(0), 215cdf0e10cSrcweir sContentTypeName(SW_RES(STR_CONTENT_TYPE_FIRST + nType)), 216cdf0e10cSrcweir sSingleContentTypeName(SW_RES(STR_CONTENT_TYPE_SINGLE_FIRST + nType)), 217cdf0e10cSrcweir nMemberCount(0), 218cdf0e10cSrcweir nContentType(nType), 219cdf0e10cSrcweir nOutlineLevel(nLevel), 220cdf0e10cSrcweir bMemberFilled(sal_False), 221cdf0e10cSrcweir bDataValid(sal_False), 222cdf0e10cSrcweir bEdit(sal_False), 223cdf0e10cSrcweir bDelete(sal_True) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir Init(); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir 228cdf0e10cSrcweir /*************************************************************************** 229cdf0e10cSrcweir Beschreibung: Initialisierung 230cdf0e10cSrcweir ***************************************************************************/ 231cdf0e10cSrcweir 232cdf0e10cSrcweir 233cdf0e10cSrcweir void SwContentType::Init(sal_Bool* pbInvalidateWindow) 234cdf0e10cSrcweir { 235cdf0e10cSrcweir // wenn sich der MemberCount aendert ... 236cdf0e10cSrcweir sal_uInt16 nOldMemberCount = nMemberCount; 237cdf0e10cSrcweir nMemberCount = 0; 238cdf0e10cSrcweir switch(nContentType) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir case CONTENT_TYPE_OUTLINE : 241cdf0e10cSrcweir { 242cdf0e10cSrcweir sTypeToken = C2S(pMarkToOutline); 243cdf0e10cSrcweir sal_uInt16 nOutlineCount = nMemberCount = 244cdf0e10cSrcweir static_cast<sal_uInt16>(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount()); 245cdf0e10cSrcweir if(nOutlineLevel < MAXLEVEL) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir for(sal_uInt16 j = 0; j < nOutlineCount; j++) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir if(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(j) > nOutlineLevel ) 250cdf0e10cSrcweir nMemberCount --; 251cdf0e10cSrcweir } 252cdf0e10cSrcweir } 253cdf0e10cSrcweir bDelete = sal_False; 254cdf0e10cSrcweir } 255cdf0e10cSrcweir break; 256cdf0e10cSrcweir 257cdf0e10cSrcweir case CONTENT_TYPE_TABLE : 258cdf0e10cSrcweir sTypeToken = C2S(pMarkToTable); 259cdf0e10cSrcweir nMemberCount = pWrtShell->GetTblFrmFmtCount(sal_True); 260cdf0e10cSrcweir bEdit = sal_True; 261cdf0e10cSrcweir break; 262cdf0e10cSrcweir 263cdf0e10cSrcweir case CONTENT_TYPE_FRAME : 264cdf0e10cSrcweir case CONTENT_TYPE_GRAPHIC : 265cdf0e10cSrcweir case CONTENT_TYPE_OLE : 266cdf0e10cSrcweir { 267cdf0e10cSrcweir FlyCntType eType = FLYCNTTYPE_FRM; 268cdf0e10cSrcweir sTypeToken = C2S(pMarkToFrame); 269cdf0e10cSrcweir if(nContentType == CONTENT_TYPE_OLE) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir eType = FLYCNTTYPE_OLE; 272cdf0e10cSrcweir sTypeToken = C2S(pMarkToOLE); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir else if(nContentType == CONTENT_TYPE_GRAPHIC) 275cdf0e10cSrcweir { 276cdf0e10cSrcweir eType = FLYCNTTYPE_GRF; 277cdf0e10cSrcweir sTypeToken = C2S(pMarkToGraphic); 278cdf0e10cSrcweir } 279cdf0e10cSrcweir nMemberCount = pWrtShell->GetFlyCount(eType); 280cdf0e10cSrcweir bEdit = sal_True; 281cdf0e10cSrcweir } 282cdf0e10cSrcweir break; 283cdf0e10cSrcweir case CONTENT_TYPE_BOOKMARK: 284cdf0e10cSrcweir { 285cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); 286cdf0e10cSrcweir nMemberCount = static_cast<sal_uInt16>(count_if( 287cdf0e10cSrcweir pMarkAccess->getBookmarksBegin(), 288cdf0e10cSrcweir pMarkAccess->getBookmarksEnd(), 289cdf0e10cSrcweir &lcl_IsUiVisibleBookmark)); 290cdf0e10cSrcweir sTypeToken = aEmptyStr; 291cdf0e10cSrcweir bEdit = sal_True; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir break; 294cdf0e10cSrcweir case CONTENT_TYPE_REGION : 295cdf0e10cSrcweir { 296cdf0e10cSrcweir SwContentArr* pOldMember = 0; 297cdf0e10cSrcweir sal_uInt16 nOldRegionCount = 0; 298cdf0e10cSrcweir sal_Bool bInvalidate = sal_False; 299cdf0e10cSrcweir if(!pMember) 300cdf0e10cSrcweir pMember = new SwContentArr; 301cdf0e10cSrcweir else if(pMember->Count()) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir pOldMember = pMember; 304cdf0e10cSrcweir nOldRegionCount = pOldMember->Count(); 305cdf0e10cSrcweir pMember = new SwContentArr; 306cdf0e10cSrcweir } 307cdf0e10cSrcweir const Point aNullPt; 308cdf0e10cSrcweir nMemberCount = pWrtShell->GetSectionFmtCount(); 309cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nMemberCount; i++) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir const SwSectionFmt* pFmt; 312cdf0e10cSrcweir SectionType eTmpType; 313cdf0e10cSrcweir if( (pFmt = &pWrtShell->GetSectionFmt(i))->IsInNodesArr() && 314cdf0e10cSrcweir (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION 315cdf0e10cSrcweir && TOX_HEADER_SECTION != eTmpType ) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir const String& rSectionName = 318cdf0e10cSrcweir pFmt->GetSection()->GetSectionName(); 319cdf0e10cSrcweir sal_uInt8 nLevel = 0; 320cdf0e10cSrcweir SwSectionFmt* pParentFmt = pFmt->GetParent(); 321cdf0e10cSrcweir while(pParentFmt) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir nLevel++; 324cdf0e10cSrcweir pParentFmt = pParentFmt->GetParent(); 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir SwContent* pCnt = new SwRegionContent(this, rSectionName, 328cdf0e10cSrcweir nLevel, 329cdf0e10cSrcweir pFmt->FindLayoutRect( sal_False, &aNullPt ).Top()); 330cdf0e10cSrcweir 331cdf0e10cSrcweir SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, 0 ); 332cdf0e10cSrcweir if( !pFmt->GetInfo( aAskItem ) && 333cdf0e10cSrcweir !aAskItem.pObject ) // not visible 334cdf0e10cSrcweir pCnt->SetInvisible(); 335cdf0e10cSrcweir pMember->Insert(pCnt);//, pMember->Count()); 336cdf0e10cSrcweir 337cdf0e10cSrcweir sal_uInt16 nPos = pMember->Count() - 1; 338cdf0e10cSrcweir if(nOldRegionCount > nPos && 339cdf0e10cSrcweir (pOldMember->GetObject(nPos))->IsInvisible() 340cdf0e10cSrcweir != pCnt->IsInvisible()) 341cdf0e10cSrcweir bInvalidate = sal_True; 342cdf0e10cSrcweir } 343cdf0e10cSrcweir } 344cdf0e10cSrcweir nMemberCount = pMember->Count(); 345cdf0e10cSrcweir sTypeToken = C2S(pMarkToRegion); 346cdf0e10cSrcweir bEdit = sal_True; 347cdf0e10cSrcweir bDelete = sal_False; 348cdf0e10cSrcweir if(pOldMember) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir pOldMember->DeleteAndDestroy(0, pOldMember->Count()); 351cdf0e10cSrcweir delete pOldMember; 352cdf0e10cSrcweir if(pbInvalidateWindow && bInvalidate) 353cdf0e10cSrcweir *pbInvalidateWindow = sal_True; 354cdf0e10cSrcweir } 355cdf0e10cSrcweir } 356cdf0e10cSrcweir break; 357cdf0e10cSrcweir case CONTENT_TYPE_INDEX: 358cdf0e10cSrcweir { 359cdf0e10cSrcweir nMemberCount = pWrtShell->GetTOXCount(); 360cdf0e10cSrcweir bEdit = sal_True; 361cdf0e10cSrcweir bDelete = sal_False; 362cdf0e10cSrcweir } 363cdf0e10cSrcweir break; 364cdf0e10cSrcweir case CONTENT_TYPE_REFERENCE: 365cdf0e10cSrcweir { 366cdf0e10cSrcweir nMemberCount = pWrtShell->GetRefMarks( 0 ); 367cdf0e10cSrcweir bDelete = sal_False; 368cdf0e10cSrcweir } 369cdf0e10cSrcweir break; 370cdf0e10cSrcweir case CONTENT_TYPE_URLFIELD: 371cdf0e10cSrcweir { 372cdf0e10cSrcweir nMemberCount = 0; 373cdf0e10cSrcweir if(!pMember) 374cdf0e10cSrcweir pMember = new SwContentArr; 375cdf0e10cSrcweir else if(pMember->Count()) 376cdf0e10cSrcweir pMember->DeleteAndDestroy(0, pMember->Count()); 377cdf0e10cSrcweir 378cdf0e10cSrcweir SwGetINetAttrs aArr; 379cdf0e10cSrcweir nMemberCount = pWrtShell->GetINetAttrs( aArr ); 380cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nMemberCount; ++n ) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir SwGetINetAttr* p = aArr[ n ]; 383cdf0e10cSrcweir SwURLFieldContent* pCnt = new SwURLFieldContent( 384cdf0e10cSrcweir this, 385cdf0e10cSrcweir p->sText, 386cdf0e10cSrcweir INetURLObject::decode( 387cdf0e10cSrcweir p->rINetAttr.GetINetFmt().GetValue(), 388cdf0e10cSrcweir INET_HEX_ESCAPE, 389cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS, 390cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 ), 391cdf0e10cSrcweir &p->rINetAttr, 392cdf0e10cSrcweir n ); 393cdf0e10cSrcweir pMember->Insert( pCnt );//, n ); 394cdf0e10cSrcweir } 395cdf0e10cSrcweir bEdit = sal_True; 396cdf0e10cSrcweir nOldMemberCount = nMemberCount; 397cdf0e10cSrcweir bDelete = sal_False; 398cdf0e10cSrcweir } 399cdf0e10cSrcweir break; 400cdf0e10cSrcweir case CONTENT_TYPE_POSTIT: 401cdf0e10cSrcweir { 402cdf0e10cSrcweir nMemberCount = 0; 403cdf0e10cSrcweir if(!pMember) 404cdf0e10cSrcweir pMember = new SwContentArr; 405cdf0e10cSrcweir else if(pMember->Count()) 406cdf0e10cSrcweir pMember->DeleteAndDestroy(0, pMember->Count()); 407cdf0e10cSrcweir 408cdf0e10cSrcweir SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr(); 409cdf0e10cSrcweir if (aMgr) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit 414cdf0e10cSrcweir { 415cdf0e10cSrcweir SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster()); 416cdf0e10cSrcweir if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() && 417cdf0e10cSrcweir (*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE ) 418cdf0e10cSrcweir { 419*c0286415SOliver-Rainer Wittmann String sEntry = aFmtFld->GetField()->GetPar2(); 420cdf0e10cSrcweir RemoveNewline(sEntry); 421cdf0e10cSrcweir SwPostItContent* pCnt = new SwPostItContent( 422cdf0e10cSrcweir this, 423cdf0e10cSrcweir sEntry, 424cdf0e10cSrcweir (const SwFmtFld*)aFmtFld, 425cdf0e10cSrcweir nMemberCount); 426cdf0e10cSrcweir pMember->Insert(pCnt); 427cdf0e10cSrcweir nMemberCount++; 428cdf0e10cSrcweir } 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir } 432cdf0e10cSrcweir // 433cdf0e10cSrcweir sTypeToken = aEmptyStr; 434cdf0e10cSrcweir bEdit = sal_True; 435cdf0e10cSrcweir nOldMemberCount = nMemberCount; 436cdf0e10cSrcweir } 437cdf0e10cSrcweir break; 438cdf0e10cSrcweir case CONTENT_TYPE_DRAWOBJECT: 439cdf0e10cSrcweir { 440cdf0e10cSrcweir sTypeToken = aEmptyStr; 441cdf0e10cSrcweir nMemberCount = 0; 442cdf0e10cSrcweir SdrModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel(); 443cdf0e10cSrcweir if(pModel) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir SdrPage* pPage = pModel->GetPage(0); 446cdf0e10cSrcweir sal_uInt32 nCount = pPage->GetObjCount(); 447cdf0e10cSrcweir for( sal_uInt32 i=0; i< nCount; i++ ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir SdrObject* pTemp = pPage->GetObj(i); 450cdf0e10cSrcweir // --> OD 2006-03-09 #i51726# - all drawing objects can be named now 451cdf0e10cSrcweir // if(pTemp->ISA(SdrObjGroup) && pTemp->GetName().Len()) 452cdf0e10cSrcweir if ( pTemp->GetName().Len() ) 453cdf0e10cSrcweir // <-- 454cdf0e10cSrcweir nMemberCount++; 455cdf0e10cSrcweir } 456cdf0e10cSrcweir } 457cdf0e10cSrcweir } 458cdf0e10cSrcweir break; 459cdf0e10cSrcweir } 460cdf0e10cSrcweir // ... dann koennen die Daten auch nicht mehr gueltig sein 461cdf0e10cSrcweir // abgesehen von denen, die schon korrigiert wurden, dann ist 462cdf0e10cSrcweir // nOldMemberCount doch nicht so old 463cdf0e10cSrcweir if( nOldMemberCount != nMemberCount ) 464cdf0e10cSrcweir bDataValid = sal_False; 465cdf0e10cSrcweir } 466cdf0e10cSrcweir 467cdf0e10cSrcweir /*************************************************************************** 468cdf0e10cSrcweir Beschreibung: 469cdf0e10cSrcweir ***************************************************************************/ 470cdf0e10cSrcweir 471cdf0e10cSrcweir 472cdf0e10cSrcweir SwContentType::~SwContentType() 473cdf0e10cSrcweir { 474cdf0e10cSrcweir delete pMember; 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir /*************************************************************************** 478cdf0e10cSrcweir Beschreibung: Inhalt liefern, dazu gfs. die Liste fuellen 479cdf0e10cSrcweir ***************************************************************************/ 480cdf0e10cSrcweir 481cdf0e10cSrcweir 482cdf0e10cSrcweir const SwContent* SwContentType::GetMember(sal_uInt16 nIndex) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir if(!bDataValid || !pMember) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir FillMemberList(); 487cdf0e10cSrcweir } 488cdf0e10cSrcweir if(nIndex < pMember->Count()) 489cdf0e10cSrcweir return pMember->GetObject(nIndex); 490cdf0e10cSrcweir else 491cdf0e10cSrcweir return 0; 492cdf0e10cSrcweir 493cdf0e10cSrcweir } 494cdf0e10cSrcweir 495cdf0e10cSrcweir 496cdf0e10cSrcweir /*************************************************************************** 497cdf0e10cSrcweir Beschreibung: 498cdf0e10cSrcweir ***************************************************************************/ 499cdf0e10cSrcweir 500cdf0e10cSrcweir 501cdf0e10cSrcweir void SwContentType::Invalidate() 502cdf0e10cSrcweir { 503cdf0e10cSrcweir bDataValid = sal_False; 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir /*************************************************************************** 507cdf0e10cSrcweir Beschreibung: Liste der Inhalte fuellen 508cdf0e10cSrcweir ***************************************************************************/ 509cdf0e10cSrcweir 510cdf0e10cSrcweir 511cdf0e10cSrcweir void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir SwContentArr* pOldMember = 0; 514cdf0e10cSrcweir int nOldMemberCount = -1; 515cdf0e10cSrcweir SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, 0 ); 516cdf0e10cSrcweir if(pMember && pbLevelOrVisibiblityChanged) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir pOldMember = pMember; 519cdf0e10cSrcweir nOldMemberCount = pOldMember->Count(); 520cdf0e10cSrcweir pMember = new SwContentArr; 521cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_False; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir else if(!pMember) 524cdf0e10cSrcweir pMember = new SwContentArr; 525cdf0e10cSrcweir else if(pMember->Count()) 526cdf0e10cSrcweir pMember->DeleteAndDestroy(0, pMember->Count()); 527cdf0e10cSrcweir switch(nContentType) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir case CONTENT_TYPE_OUTLINE : 530cdf0e10cSrcweir { 531cdf0e10cSrcweir sal_uInt16 nOutlineCount = nMemberCount = 532cdf0e10cSrcweir static_cast<sal_uInt16>(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount()); 533cdf0e10cSrcweir 534cdf0e10cSrcweir sal_uInt16 nPos = 0; 535cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nOutlineCount; ++i) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir const sal_Int8 nLevel = (sal_Int8)pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(i); 538cdf0e10cSrcweir if(nLevel >= nOutlineLevel ) 539cdf0e10cSrcweir nMemberCount--; 540cdf0e10cSrcweir else 541cdf0e10cSrcweir { 542cdf0e10cSrcweir String aEntry(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i)); 543cdf0e10cSrcweir aEntry.EraseLeadingChars(); 544cdf0e10cSrcweir SwNavigationPI::CleanEntry( aEntry ); 545cdf0e10cSrcweir SwOutlineContent* pCnt = new SwOutlineContent(this, aEntry, i, nLevel, 546cdf0e10cSrcweir pWrtShell->IsOutlineMovable( i ), nPos ); 547cdf0e10cSrcweir pMember->Insert(pCnt);//, nPos); 548cdf0e10cSrcweir // bei gleicher Anzahl und vorhandenem pOldMember wird die 549cdf0e10cSrcweir // alte mit der neuen OutlinePos verglichen 550cdf0e10cSrcweir // cast fuer Win16 551cdf0e10cSrcweir if(nOldMemberCount > (int)nPos && 552cdf0e10cSrcweir ((SwOutlineContent*)pOldMember->GetObject(nPos))->GetOutlineLevel() != nLevel) 553cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_True; 554cdf0e10cSrcweir 555cdf0e10cSrcweir nPos++; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir } 560cdf0e10cSrcweir break; 561cdf0e10cSrcweir 562cdf0e10cSrcweir case CONTENT_TYPE_TABLE : 563cdf0e10cSrcweir { 564cdf0e10cSrcweir DBG_ASSERT(nMemberCount == 565cdf0e10cSrcweir pWrtShell->GetTblFrmFmtCount(sal_True), 566cdf0e10cSrcweir "MemberCount differiert"); 567cdf0e10cSrcweir Point aNullPt; 568cdf0e10cSrcweir nMemberCount = pWrtShell->GetTblFrmFmtCount(sal_True); 569cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nMemberCount; i++) 570cdf0e10cSrcweir { 571cdf0e10cSrcweir const SwFrmFmt& rTblFmt = pWrtShell->GetTblFrmFmt(i, sal_True); 572cdf0e10cSrcweir String sTblName( rTblFmt.GetName() ); 573cdf0e10cSrcweir 574cdf0e10cSrcweir SwContent* pCnt = new SwContent(this, sTblName, 575cdf0e10cSrcweir rTblFmt.FindLayoutRect(sal_False, &aNullPt).Top() ); 576cdf0e10cSrcweir if( !rTblFmt.GetInfo( aAskItem ) && 577cdf0e10cSrcweir !aAskItem.pObject ) // not visible 578cdf0e10cSrcweir pCnt->SetInvisible(); 579cdf0e10cSrcweir 580cdf0e10cSrcweir pMember->Insert(pCnt);//, i); 581cdf0e10cSrcweir 582cdf0e10cSrcweir if(nOldMemberCount > (int)i && 583cdf0e10cSrcweir (pOldMember->GetObject(i))->IsInvisible() != pCnt->IsInvisible()) 584cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_True; 585cdf0e10cSrcweir } 586cdf0e10cSrcweir } 587cdf0e10cSrcweir break; 588cdf0e10cSrcweir case CONTENT_TYPE_OLE : 589cdf0e10cSrcweir case CONTENT_TYPE_FRAME : 590cdf0e10cSrcweir case CONTENT_TYPE_GRAPHIC : 591cdf0e10cSrcweir { 592cdf0e10cSrcweir FlyCntType eType = FLYCNTTYPE_FRM; 593cdf0e10cSrcweir if(nContentType == CONTENT_TYPE_OLE) 594cdf0e10cSrcweir eType = FLYCNTTYPE_OLE; 595cdf0e10cSrcweir else if(nContentType == CONTENT_TYPE_GRAPHIC) 596cdf0e10cSrcweir eType = FLYCNTTYPE_GRF; 597cdf0e10cSrcweir DBG_ASSERT(nMemberCount == pWrtShell->GetFlyCount(eType), 598cdf0e10cSrcweir "MemberCount differiert"); 599cdf0e10cSrcweir Point aNullPt; 600cdf0e10cSrcweir nMemberCount = pWrtShell->GetFlyCount(eType); 601cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nMemberCount; i++) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir const SwFrmFmt* pFrmFmt = pWrtShell->GetFlyNum(i,eType); 604cdf0e10cSrcweir String sFrmName = pFrmFmt->GetName(); 605cdf0e10cSrcweir 606cdf0e10cSrcweir SwContent* pCnt; 607cdf0e10cSrcweir if(CONTENT_TYPE_GRAPHIC == nContentType) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir String sLink; 610cdf0e10cSrcweir pWrtShell->GetGrfNms( &sLink, 0, (SwFlyFrmFmt*) pFrmFmt); 611cdf0e10cSrcweir pCnt = new SwGraphicContent(this, sFrmName, 612cdf0e10cSrcweir INetURLObject::decode( sLink, INET_HEX_ESCAPE, 613cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS, 614cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 ), 615cdf0e10cSrcweir pFrmFmt->FindLayoutRect(sal_False, &aNullPt).Top()); 616cdf0e10cSrcweir } 617cdf0e10cSrcweir else 618cdf0e10cSrcweir { 619cdf0e10cSrcweir pCnt = new SwContent(this, sFrmName, 620cdf0e10cSrcweir pFrmFmt->FindLayoutRect(sal_False, &aNullPt).Top() ); 621cdf0e10cSrcweir } 622cdf0e10cSrcweir if( !pFrmFmt->GetInfo( aAskItem ) && 623cdf0e10cSrcweir !aAskItem.pObject ) // not visible 624cdf0e10cSrcweir pCnt->SetInvisible(); 625cdf0e10cSrcweir pMember->Insert(pCnt);//, i); 626cdf0e10cSrcweir if(nOldMemberCount > (int)i && 627cdf0e10cSrcweir (pOldMember->GetObject(i))->IsInvisible() != pCnt->IsInvisible()) 628cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_True; 629cdf0e10cSrcweir } 630cdf0e10cSrcweir } 631cdf0e10cSrcweir break; 632cdf0e10cSrcweir case CONTENT_TYPE_BOOKMARK: 633cdf0e10cSrcweir { 634cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); 635cdf0e10cSrcweir for(IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); 636cdf0e10cSrcweir ppBookmark != pMarkAccess->getBookmarksEnd(); 637cdf0e10cSrcweir ppBookmark++) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir if(lcl_IsUiVisibleBookmark(*ppBookmark)) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir const String& rBkmName = ppBookmark->get()->GetName(); 642cdf0e10cSrcweir //nYPos von 0 -> text::Bookmarks werden nach Alphabet sortiert 643cdf0e10cSrcweir SwContent* pCnt = new SwContent(this, rBkmName, 0); 644cdf0e10cSrcweir pMember->Insert(pCnt);//, pMember->Count()); 645cdf0e10cSrcweir } 646cdf0e10cSrcweir } 647cdf0e10cSrcweir } 648cdf0e10cSrcweir break; 649cdf0e10cSrcweir case CONTENT_TYPE_REGION : 650cdf0e10cSrcweir { 651cdf0e10cSrcweir const Point aNullPt; 652cdf0e10cSrcweir nMemberCount = pWrtShell->GetSectionFmtCount(); 653cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nMemberCount; i++) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir const SwSectionFmt* pFmt; 656cdf0e10cSrcweir SectionType eTmpType; 657cdf0e10cSrcweir if( (pFmt = &pWrtShell->GetSectionFmt(i))->IsInNodesArr() && 658cdf0e10cSrcweir (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION 659cdf0e10cSrcweir && TOX_HEADER_SECTION != eTmpType ) 660cdf0e10cSrcweir { 661cdf0e10cSrcweir String sSectionName = pFmt->GetSection()->GetSectionName(); 662cdf0e10cSrcweir 663cdf0e10cSrcweir sal_uInt8 nLevel = 0; 664cdf0e10cSrcweir SwSectionFmt* pParentFmt = pFmt->GetParent(); 665cdf0e10cSrcweir while(pParentFmt) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir nLevel++; 668cdf0e10cSrcweir pParentFmt = pParentFmt->GetParent(); 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir SwContent* pCnt = new SwRegionContent(this, sSectionName, 672cdf0e10cSrcweir nLevel, 673cdf0e10cSrcweir pFmt->FindLayoutRect( sal_False, &aNullPt ).Top()); 674cdf0e10cSrcweir if( !pFmt->GetInfo( aAskItem ) && 675cdf0e10cSrcweir !aAskItem.pObject ) // not visible 676cdf0e10cSrcweir pCnt->SetInvisible(); 677cdf0e10cSrcweir pMember->Insert(pCnt);//, pMember->Count()); 678cdf0e10cSrcweir 679cdf0e10cSrcweir sal_uInt16 nPos = pMember->Count() - 1; 680cdf0e10cSrcweir if(nOldMemberCount > nPos && 681cdf0e10cSrcweir (pOldMember->GetObject(nPos))->IsInvisible() 682cdf0e10cSrcweir != pCnt->IsInvisible()) 683cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_True; 684cdf0e10cSrcweir } 685cdf0e10cSrcweir } 686cdf0e10cSrcweir nMemberCount = pMember->Count(); 687cdf0e10cSrcweir } 688cdf0e10cSrcweir break; 689cdf0e10cSrcweir case CONTENT_TYPE_REFERENCE: 690cdf0e10cSrcweir { 691cdf0e10cSrcweir SvStringsDtor aRefMarks; 692cdf0e10cSrcweir nMemberCount = pWrtShell->GetRefMarks( &aRefMarks ); 693cdf0e10cSrcweir 694cdf0e10cSrcweir for(sal_uInt16 i=0; i<nMemberCount; i++) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir //Referenzen nach Alphabet sortiert 697cdf0e10cSrcweir SwContent* pCnt = new SwContent( 698cdf0e10cSrcweir this, *aRefMarks.GetObject(i), 0); 699cdf0e10cSrcweir pMember->Insert(pCnt);//, i); 700cdf0e10cSrcweir } 701cdf0e10cSrcweir } 702cdf0e10cSrcweir break; 703cdf0e10cSrcweir case CONTENT_TYPE_URLFIELD: 704cdf0e10cSrcweir { 705cdf0e10cSrcweir SwGetINetAttrs aArr; 706cdf0e10cSrcweir nMemberCount = pWrtShell->GetINetAttrs( aArr ); 707cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nMemberCount; ++n ) 708cdf0e10cSrcweir { 709cdf0e10cSrcweir SwGetINetAttr* p = aArr[ n ]; 710cdf0e10cSrcweir SwURLFieldContent* pCnt = new SwURLFieldContent( 711cdf0e10cSrcweir this, 712cdf0e10cSrcweir p->sText, 713cdf0e10cSrcweir INetURLObject::decode( 714cdf0e10cSrcweir p->rINetAttr.GetINetFmt().GetValue(), 715cdf0e10cSrcweir INET_HEX_ESCAPE, 716cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS, 717cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 ), 718cdf0e10cSrcweir &p->rINetAttr, 719cdf0e10cSrcweir n ); 720cdf0e10cSrcweir pMember->Insert( pCnt );//, n ); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir } 723cdf0e10cSrcweir break; 724cdf0e10cSrcweir case CONTENT_TYPE_INDEX: 725cdf0e10cSrcweir { 726cdf0e10cSrcweir 727cdf0e10cSrcweir sal_uInt16 nCount = nMemberCount = pWrtShell->GetTOXCount(); 728cdf0e10cSrcweir for ( sal_uInt16 nTox = 0; nTox < nCount; nTox++ ) 729cdf0e10cSrcweir { 730cdf0e10cSrcweir const SwTOXBase* pBase = pWrtShell->GetTOX( nTox ); 731cdf0e10cSrcweir String sTOXNm( pBase->GetTOXName() ); 732cdf0e10cSrcweir 733cdf0e10cSrcweir SwContent* pCnt = new SwTOXBaseContent( 734cdf0e10cSrcweir this, sTOXNm, nTox, *pBase); 735cdf0e10cSrcweir 736cdf0e10cSrcweir if( !pBase->GetInfo( aAskItem ) && 737cdf0e10cSrcweir !aAskItem.pObject ) // not visible 738cdf0e10cSrcweir pCnt->SetInvisible(); 739cdf0e10cSrcweir 740cdf0e10cSrcweir pMember->Insert( pCnt );//, nTox ); 741cdf0e10cSrcweir sal_uInt16 nPos = pMember->Count() - 1; 742cdf0e10cSrcweir if(nOldMemberCount > nPos && 743cdf0e10cSrcweir (pOldMember->GetObject(nPos))->IsInvisible() 744cdf0e10cSrcweir != pCnt->IsInvisible()) 745cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_True; 746cdf0e10cSrcweir } 747cdf0e10cSrcweir } 748cdf0e10cSrcweir break; 749cdf0e10cSrcweir case CONTENT_TYPE_POSTIT: 750cdf0e10cSrcweir { 751cdf0e10cSrcweir nMemberCount = 0; 752cdf0e10cSrcweir if(!pMember) 753cdf0e10cSrcweir pMember = new SwContentArr; 754cdf0e10cSrcweir else if(pMember->Count()) 755cdf0e10cSrcweir pMember->DeleteAndDestroy(0, pMember->Count()); 756cdf0e10cSrcweir SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr(); 757cdf0e10cSrcweir if (aMgr) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i) 760cdf0e10cSrcweir { 761cdf0e10cSrcweir if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit 762cdf0e10cSrcweir { 763cdf0e10cSrcweir SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster()); 764cdf0e10cSrcweir if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() && 765cdf0e10cSrcweir (*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE ) 766cdf0e10cSrcweir { 767*c0286415SOliver-Rainer Wittmann String sEntry = aFmtFld->GetField()->GetPar2(); 768cdf0e10cSrcweir RemoveNewline(sEntry); 769cdf0e10cSrcweir SwPostItContent* pCnt = new SwPostItContent( 770cdf0e10cSrcweir this, 771cdf0e10cSrcweir sEntry, 772cdf0e10cSrcweir (const SwFmtFld*)aFmtFld, 773cdf0e10cSrcweir nMemberCount); 774cdf0e10cSrcweir pMember->Insert(pCnt); 775cdf0e10cSrcweir nMemberCount++; 776cdf0e10cSrcweir } 777cdf0e10cSrcweir } 778cdf0e10cSrcweir /* this code can be used once we want redline comments in the margin 779cdf0e10cSrcweir else // redcomment 780cdf0e10cSrcweir { 781cdf0e10cSrcweir SwRedline* pRedline = static_cast<SwRedline*>((*i)->GetBroadCaster()); 782cdf0e10cSrcweir if ( pRedline->GetComment() != String(::rtl::OUString::createFromAscii("")) ) 783cdf0e10cSrcweir { 784cdf0e10cSrcweir String sEntry = pRedline->GetComment(); 785cdf0e10cSrcweir RemoveNewline(sEntry); 786cdf0e10cSrcweir SwPostItContent* pCnt = new SwPostItContent( 787cdf0e10cSrcweir this, 788cdf0e10cSrcweir sEntry, 789cdf0e10cSrcweir pRedline, 790cdf0e10cSrcweir nMemberCount); 791cdf0e10cSrcweir pMember->Insert(pCnt); 792cdf0e10cSrcweir nMemberCount++; 793cdf0e10cSrcweir } 794cdf0e10cSrcweir } 795cdf0e10cSrcweir */ 796cdf0e10cSrcweir } 797cdf0e10cSrcweir } 798cdf0e10cSrcweir // 799cdf0e10cSrcweir } 800cdf0e10cSrcweir break; 801cdf0e10cSrcweir case CONTENT_TYPE_DRAWOBJECT: 802cdf0e10cSrcweir { 803cdf0e10cSrcweir nMemberCount = 0; 804cdf0e10cSrcweir if(!pMember) 805cdf0e10cSrcweir pMember = new SwContentArr; 806cdf0e10cSrcweir else if(pMember->Count()) 807cdf0e10cSrcweir pMember->DeleteAndDestroy(0, pMember->Count()); 808cdf0e10cSrcweir 809cdf0e10cSrcweir IDocumentDrawModelAccess* pIDDMA = pWrtShell->getIDocumentDrawModelAccess(); 810cdf0e10cSrcweir SdrModel* pModel = pIDDMA->GetDrawModel(); 811cdf0e10cSrcweir if(pModel) 812cdf0e10cSrcweir { 813cdf0e10cSrcweir SdrPage* pPage = pModel->GetPage(0); 814cdf0e10cSrcweir sal_uInt32 nCount = pPage->GetObjCount(); 815cdf0e10cSrcweir for( sal_uInt32 i=0; i< nCount; i++ ) 816cdf0e10cSrcweir { 817cdf0e10cSrcweir SdrObject* pTemp = pPage->GetObj(i); 818cdf0e10cSrcweir // --> OD 2006-03-09 #i51726# - all drawing objects can be named now 819cdf0e10cSrcweir // if(pTemp->ISA(SdrObjGroup) && pTemp->GetName().Len()) 820cdf0e10cSrcweir if ( pTemp->GetName().Len() ) 821cdf0e10cSrcweir // <-- 822cdf0e10cSrcweir { 823cdf0e10cSrcweir SwContact* pContact = (SwContact*)pTemp->GetUserCall(); 824cdf0e10cSrcweir long nYPos = 0; 825cdf0e10cSrcweir const Point aNullPt; 826cdf0e10cSrcweir if(pContact && pContact->GetFmt()) 827cdf0e10cSrcweir nYPos = pContact->GetFmt()->FindLayoutRect(sal_False, &aNullPt).Top(); 828cdf0e10cSrcweir SwContent* pCnt = new SwContent( 829cdf0e10cSrcweir this, 830cdf0e10cSrcweir pTemp->GetName(), 831cdf0e10cSrcweir nYPos); 832cdf0e10cSrcweir if(!pIDDMA->IsVisibleLayerId(pTemp->GetLayer())) 833cdf0e10cSrcweir pCnt->SetInvisible(); 834cdf0e10cSrcweir pMember->Insert(pCnt); 835cdf0e10cSrcweir nMemberCount++; 836cdf0e10cSrcweir if(nOldMemberCount > (int)i && 837cdf0e10cSrcweir (pOldMember->GetObject((sal_uInt16)i))->IsInvisible() != pCnt->IsInvisible()) 838cdf0e10cSrcweir *pbLevelOrVisibiblityChanged = sal_True; 839cdf0e10cSrcweir } 840cdf0e10cSrcweir } 841cdf0e10cSrcweir } 842cdf0e10cSrcweir } 843cdf0e10cSrcweir break; 844cdf0e10cSrcweir } 845cdf0e10cSrcweir bDataValid = sal_True; 846cdf0e10cSrcweir if(pOldMember) 847cdf0e10cSrcweir pOldMember->DeleteAndDestroy(0, pOldMember->Count()); 848cdf0e10cSrcweir 849cdf0e10cSrcweir } 850cdf0e10cSrcweir 851cdf0e10cSrcweir /*************************************************************************** 852cdf0e10cSrcweir Beschreibung: TreeListBox fuer Inhaltsanzeige 853cdf0e10cSrcweir ***************************************************************************/ 854cdf0e10cSrcweir 855cdf0e10cSrcweir 856cdf0e10cSrcweir SwContentTree::SwContentTree(Window* pParent, const ResId& rResId) : 857cdf0e10cSrcweir SvTreeListBox( pParent, rResId ), 858cdf0e10cSrcweir 859cdf0e10cSrcweir sSpace(C2S(" ")), 860cdf0e10cSrcweir 861cdf0e10cSrcweir sRemoveIdx(SW_RES(ST_REMOVE_INDEX)), 862cdf0e10cSrcweir sUpdateIdx(SW_RES(ST_UPDATE)), 863cdf0e10cSrcweir sUnprotTbl(SW_RES(ST_REMOVE_TBL_PROTECTION)), 864cdf0e10cSrcweir sRename(SW_RES(ST_RENAME)), 865cdf0e10cSrcweir sReadonlyIdx(SW_RES(ST_READONLY_IDX)), 866cdf0e10cSrcweir sInvisible(SW_RES(ST_INVISIBLE)), 867cdf0e10cSrcweir 868cdf0e10cSrcweir sPostItShow(SW_RES(ST_POSTIT_SHOW)), 869cdf0e10cSrcweir sPostItHide(SW_RES(ST_POSTIT_HIDE)), 870cdf0e10cSrcweir sPostItDelete(SW_RES(ST_POSTIT_DELETE)), 871cdf0e10cSrcweir 872cdf0e10cSrcweir pHiddenShell(0), 873cdf0e10cSrcweir pActiveShell(0), 874cdf0e10cSrcweir pConfig(SW_MOD()->GetNavigationConfig()), 875cdf0e10cSrcweir 876cdf0e10cSrcweir nActiveBlock(0), 877cdf0e10cSrcweir nHiddenBlock(0), 878cdf0e10cSrcweir 879cdf0e10cSrcweir nRootType(USHRT_MAX), 880cdf0e10cSrcweir nLastSelType(USHRT_MAX), 881cdf0e10cSrcweir nOutlineLevel(MAXLEVEL), 882cdf0e10cSrcweir 883cdf0e10cSrcweir bIsActive(sal_True), 884cdf0e10cSrcweir bIsConstant(sal_False), 885cdf0e10cSrcweir bIsHidden(sal_False), 886cdf0e10cSrcweir bDocChgdInDragging(sal_False), 887cdf0e10cSrcweir bIsInternalDrag(sal_False), 888cdf0e10cSrcweir bIsRoot(sal_False), 889cdf0e10cSrcweir bIsIdleClear(sal_False), 890cdf0e10cSrcweir bIsLastReadOnly(sal_False), 891cdf0e10cSrcweir bIsOutlineMoveable(sal_True), 892cdf0e10cSrcweir bViewHasChanged(sal_False), 893cdf0e10cSrcweir bIsImageListInitialized(sal_False) 894cdf0e10cSrcweir { 895cdf0e10cSrcweir sal_uInt16 i; 896cdf0e10cSrcweir 897cdf0e10cSrcweir SetHelpId(HID_NAVIGATOR_TREELIST); 898cdf0e10cSrcweir 899cdf0e10cSrcweir SetNodeDefaultImages(); 900cdf0e10cSrcweir SetDoubleClickHdl(LINK(this, SwContentTree, ContentDoubleClickHdl)); 901cdf0e10cSrcweir SetDragDropMode(SV_DRAGDROP_APP_COPY); 902cdf0e10cSrcweir for( i = 0; i < CONTENT_TYPE_MAX; i++) 903cdf0e10cSrcweir { 904cdf0e10cSrcweir aActiveContentArr[i] = 0; 905cdf0e10cSrcweir aHiddenContentArr[i] = 0; 906cdf0e10cSrcweir } 907cdf0e10cSrcweir for( i = 0; i < CONTEXT_COUNT; i++ ) 908cdf0e10cSrcweir { 909cdf0e10cSrcweir aContextStrings[i] = SW_RESSTR(i+ST_CONTEXT_FIRST); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir nActiveBlock = pConfig->GetActiveBlock(); 912cdf0e10cSrcweir aUpdTimer.SetTimeoutHdl(LINK(this, SwContentTree, TimerUpdate)); 913cdf0e10cSrcweir aUpdTimer.SetTimeout(1000); 914cdf0e10cSrcweir Clear(); 915cdf0e10cSrcweir EnableContextMenuHandling(); 916cdf0e10cSrcweir SetStyle( GetStyle() | WB_QUICK_SEARCH ); 917cdf0e10cSrcweir } 918cdf0e10cSrcweir 919cdf0e10cSrcweir /*************************************************************************** 920cdf0e10cSrcweir Beschreibung: 921cdf0e10cSrcweir ***************************************************************************/ 922cdf0e10cSrcweir 923cdf0e10cSrcweir 924cdf0e10cSrcweir SwContentTree::~SwContentTree() 925cdf0e10cSrcweir { 926cdf0e10cSrcweir Clear(); // vorher gfs. Inhaltstypen loeschen 927cdf0e10cSrcweir bIsInDrag = sal_False; 928cdf0e10cSrcweir } 929cdf0e10cSrcweir 930cdf0e10cSrcweir /*************************************************************************** 931cdf0e10cSrcweir Drag&Drop methods 932cdf0e10cSrcweir ***************************************************************************/ 933cdf0e10cSrcweir 934cdf0e10cSrcweir void SwContentTree::StartDrag( sal_Int8 nAction, const Point& rPosPixel ) 935cdf0e10cSrcweir { 936cdf0e10cSrcweir if( !bIsRoot || nRootType != CONTENT_TYPE_OUTLINE ) 937cdf0e10cSrcweir { 938cdf0e10cSrcweir ReleaseMouse(); 939cdf0e10cSrcweir 940cdf0e10cSrcweir TransferDataContainer* pContainer = new TransferDataContainer; 941cdf0e10cSrcweir uno::Reference< 942cdf0e10cSrcweir datatransfer::XTransferable > xRef( pContainer ); 943cdf0e10cSrcweir 944cdf0e10cSrcweir sal_Int8 nDragMode = DND_ACTION_COPYMOVE | DND_ACTION_LINK; 945cdf0e10cSrcweir if( FillTransferData( *pContainer, nDragMode )) 946cdf0e10cSrcweir { 947cdf0e10cSrcweir SwContentTree::SetInDrag(sal_True); 948cdf0e10cSrcweir pContainer->StartDrag( this, nDragMode, GetDragFinishedHdl() ); 949cdf0e10cSrcweir } 950cdf0e10cSrcweir } 951cdf0e10cSrcweir else 952cdf0e10cSrcweir SvTreeListBox::StartDrag( nAction, rPosPixel ); 953cdf0e10cSrcweir } 954cdf0e10cSrcweir 955cdf0e10cSrcweir void SwContentTree::DragFinished( sal_Int8 nAction ) 956cdf0e10cSrcweir { 957cdf0e10cSrcweir //to prevent the removing of the selected entry in external drag and drop 958cdf0e10cSrcweir // the drag action mustn't be MOVE 959cdf0e10cSrcweir SvTreeListBox::DragFinished( bIsInternalDrag ? nAction : DND_ACTION_COPY ); 960cdf0e10cSrcweir SwContentTree::SetInDrag(sal_False); 961cdf0e10cSrcweir bIsInternalDrag = sal_False; 962cdf0e10cSrcweir } 963cdf0e10cSrcweir 964cdf0e10cSrcweir /*************************************************************************** 965cdf0e10cSrcweir Beschreibung: QueryDrop wird im Navigator ausgefuehrt 966cdf0e10cSrcweir ***************************************************************************/ 967cdf0e10cSrcweir sal_Int8 SwContentTree::AcceptDrop( const AcceptDropEvent& rEvt ) 968cdf0e10cSrcweir { 969cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE; 970cdf0e10cSrcweir if( bIsRoot ) 971cdf0e10cSrcweir { 972cdf0e10cSrcweir if( bIsOutlineMoveable ) 973cdf0e10cSrcweir nRet = SvTreeListBox::AcceptDrop( rEvt ); 974cdf0e10cSrcweir } 975cdf0e10cSrcweir else if( !bIsInDrag ) 976cdf0e10cSrcweir nRet = GetParentWindow()->AcceptDrop( rEvt ); 977cdf0e10cSrcweir return nRet; 978cdf0e10cSrcweir } 979cdf0e10cSrcweir 980cdf0e10cSrcweir /*************************************************************************** 981cdf0e10cSrcweir Beschreibung: Drop wird im Navigator ausgefuehrt 982cdf0e10cSrcweir ***************************************************************************/ 983cdf0e10cSrcweir sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt ) 984cdf0e10cSrcweir { 985cdf0e10cSrcweir if( bIsRoot ) 986cdf0e10cSrcweir return SvTreeListBox::ExecuteDrop( rEvt ); 987cdf0e10cSrcweir return bIsInDrag ? DND_ACTION_NONE : GetParentWindow()->ExecuteDrop(rEvt); 988cdf0e10cSrcweir } 989cdf0e10cSrcweir 990cdf0e10cSrcweir 991cdf0e10cSrcweir /*************************************************************************** 992cdf0e10cSrcweir Beschreibung: Handler fuer Dragging und ContextMenu 993cdf0e10cSrcweir ***************************************************************************/ 994cdf0e10cSrcweir PopupMenu* SwContentTree::CreateContextMenu( void ) 995cdf0e10cSrcweir { 996cdf0e10cSrcweir PopupMenu* pPop = new PopupMenu; 997cdf0e10cSrcweir PopupMenu* pSubPop1 = new PopupMenu; 998cdf0e10cSrcweir PopupMenu* pSubPop2 = new PopupMenu; 999cdf0e10cSrcweir PopupMenu* pSubPop3 = new PopupMenu; 1000cdf0e10cSrcweir PopupMenu* pSubPop4 = new PopupMenu; // Edit 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir sal_uInt16 i; 1003cdf0e10cSrcweir for(i = 1; i <= MAXLEVEL; i++ ) 1004cdf0e10cSrcweir { 1005cdf0e10cSrcweir pSubPop1->InsertItem( i + 100, String::CreateFromInt32(i)); 1006cdf0e10cSrcweir } 1007cdf0e10cSrcweir pSubPop1->CheckItem(100 + nOutlineLevel); 1008cdf0e10cSrcweir for(i=0; i < 3; i++ ) 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir pSubPop2->InsertItem( i + 201, aContextStrings[ 1011cdf0e10cSrcweir ST_HYPERLINK - ST_CONTEXT_FIRST + i]); 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir pSubPop2->CheckItem( 201 + 1014cdf0e10cSrcweir GetParentWindow()->GetRegionDropMode()); 1015cdf0e10cSrcweir //Liste der offenen Dateien einfuegen 1016cdf0e10cSrcweir sal_uInt16 nId = 301; 1017cdf0e10cSrcweir const SwView* pActiveView = ::GetActiveView(); 1018cdf0e10cSrcweir SwView *pView = SwModule::GetFirstView(); 1019cdf0e10cSrcweir while (pView) 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir String sInsert = pView->GetDocShell()->GetTitle(); 1022cdf0e10cSrcweir if(pView == pActiveView) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir sInsert += '('; 1025cdf0e10cSrcweir sInsert += aContextStrings[ ST_ACTIVE - ST_CONTEXT_FIRST]; 1026cdf0e10cSrcweir sInsert += ')'; 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir pSubPop3->InsertItem(nId, sInsert); 1029cdf0e10cSrcweir if(bIsConstant && pActiveShell == &pView->GetWrtShell()) 1030cdf0e10cSrcweir pSubPop3->CheckItem(nId); 1031cdf0e10cSrcweir pView = SwModule::GetNextView(pView); 1032cdf0e10cSrcweir nId++; 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir pSubPop3->InsertItem(nId++, aContextStrings[ST_ACTIVE_VIEW - ST_CONTEXT_FIRST]); 1035cdf0e10cSrcweir if(pHiddenShell) 1036cdf0e10cSrcweir { 1037cdf0e10cSrcweir String sHiddenEntry = pHiddenShell->GetView().GetDocShell()->GetTitle(); 1038cdf0e10cSrcweir sHiddenEntry += C2S(" ( "); 1039cdf0e10cSrcweir sHiddenEntry += aContextStrings[ ST_HIDDEN - ST_CONTEXT_FIRST]; 1040cdf0e10cSrcweir sHiddenEntry += C2S(" )"); 1041cdf0e10cSrcweir pSubPop3->InsertItem(nId, sHiddenEntry); 1042cdf0e10cSrcweir } 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir if(bIsActive) 1045cdf0e10cSrcweir pSubPop3->CheckItem( --nId ); 1046cdf0e10cSrcweir else if(bIsHidden) 1047cdf0e10cSrcweir pSubPop3->CheckItem( nId ); 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir pPop->InsertItem( 1, aContextStrings[ST_OUTLINE_LEVEL - ST_CONTEXT_FIRST]); 1050cdf0e10cSrcweir pPop->InsertItem(2, aContextStrings[ST_DRAGMODE - ST_CONTEXT_FIRST]); 1051cdf0e10cSrcweir pPop->InsertItem(3, aContextStrings[ST_DISPLAY - ST_CONTEXT_FIRST]); 1052cdf0e10cSrcweir //jetzt noch bearbeiten 1053cdf0e10cSrcweir SvLBoxEntry* pEntry = 0; 1054cdf0e10cSrcweir //Bearbeiten nur, wenn die angezeigten Inhalte aus der aktiven View kommen 1055cdf0e10cSrcweir if((bIsActive || pActiveShell == pActiveView->GetWrtShellPtr()) 1056cdf0e10cSrcweir && 0 != (pEntry = FirstSelected()) && lcl_IsContent(pEntry)) 1057cdf0e10cSrcweir { 1058cdf0e10cSrcweir const SwContentType* pContType = ((SwContent*)pEntry->GetUserData())->GetParent(); 1059cdf0e10cSrcweir const sal_uInt16 nContentType = pContType->GetType(); 1060cdf0e10cSrcweir sal_Bool bReadonly = pActiveShell->GetView().GetDocShell()->IsReadOnly(); 1061cdf0e10cSrcweir sal_Bool bVisible = !((SwContent*)pEntry->GetUserData())->IsInvisible(); 1062cdf0e10cSrcweir sal_Bool bProtected = ((SwContent*)pEntry->GetUserData())->IsProtect(); 1063cdf0e10cSrcweir sal_Bool bEditable = pContType->IsEditable() && 1064cdf0e10cSrcweir ((bVisible && !bProtected) ||CONTENT_TYPE_REGION == nContentType); 1065cdf0e10cSrcweir sal_Bool bDeletable = pContType->IsDeletable() && 1066cdf0e10cSrcweir ((bVisible && !bProtected) ||CONTENT_TYPE_REGION == nContentType); 1067cdf0e10cSrcweir sal_Bool bRenamable = bEditable && !bReadonly && 1068cdf0e10cSrcweir (CONTENT_TYPE_TABLE == nContentType || 1069cdf0e10cSrcweir CONTENT_TYPE_FRAME == nContentType || 1070cdf0e10cSrcweir CONTENT_TYPE_GRAPHIC == nContentType || 1071cdf0e10cSrcweir CONTENT_TYPE_OLE == nContentType || 1072cdf0e10cSrcweir CONTENT_TYPE_BOOKMARK == nContentType || 1073cdf0e10cSrcweir CONTENT_TYPE_REGION == nContentType|| 1074cdf0e10cSrcweir CONTENT_TYPE_INDEX == nContentType); 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir if(!bReadonly && (bEditable || bDeletable)) 1077cdf0e10cSrcweir { 1078cdf0e10cSrcweir sal_Bool bSubPop4 = sal_False; 1079cdf0e10cSrcweir if(CONTENT_TYPE_INDEX == nContentType) 1080cdf0e10cSrcweir { 1081cdf0e10cSrcweir bSubPop4 = sal_True; 1082cdf0e10cSrcweir pSubPop4->InsertItem(401, sRemoveIdx); 1083cdf0e10cSrcweir pSubPop4->InsertItem(402, sUpdateIdx); 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir const SwTOXBase* pBase = ((SwTOXBaseContent*)pEntry->GetUserData())->GetTOXBase(); 1086cdf0e10cSrcweir if(!pBase->IsTOXBaseInReadonly()) 1087cdf0e10cSrcweir pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]); 1088cdf0e10cSrcweir pSubPop4->InsertItem(405, sReadonlyIdx); 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir pSubPop4->CheckItem( 405, pActiveShell->IsTOXBaseReadonly(*pBase)); 1091cdf0e10cSrcweir pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]); 1092cdf0e10cSrcweir } 1093cdf0e10cSrcweir else if(CONTENT_TYPE_TABLE == nContentType && !bReadonly) 1094cdf0e10cSrcweir { 1095cdf0e10cSrcweir bSubPop4 = sal_True; 1096cdf0e10cSrcweir pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]); 1097cdf0e10cSrcweir pSubPop4->InsertItem(404, sUnprotTbl); 1098cdf0e10cSrcweir sal_Bool bFull = sal_False; 1099cdf0e10cSrcweir String sTblName = ((SwContent*)pEntry->GetUserData())->GetName(); 1100cdf0e10cSrcweir sal_Bool bProt =pActiveShell->HasTblAnyProtection( &sTblName, &bFull ); 1101cdf0e10cSrcweir pSubPop4->EnableItem(403, !bFull ); 1102cdf0e10cSrcweir pSubPop4->EnableItem(404, bProt ); 1103cdf0e10cSrcweir pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]); 1104cdf0e10cSrcweir } 1105cdf0e10cSrcweir else if(bEditable || bDeletable) 1106cdf0e10cSrcweir { 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir if(bEditable && bDeletable) 1109cdf0e10cSrcweir { 1110cdf0e10cSrcweir pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]); 1111cdf0e10cSrcweir pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]); 1112cdf0e10cSrcweir bSubPop4 = sal_True; 1113cdf0e10cSrcweir } 1114cdf0e10cSrcweir else if(bEditable) 1115cdf0e10cSrcweir pPop->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]); 1116cdf0e10cSrcweir else if(bDeletable) 1117cdf0e10cSrcweir { 1118cdf0e10cSrcweir pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]); 1119cdf0e10cSrcweir } 1120cdf0e10cSrcweir } 1121cdf0e10cSrcweir //Rename object 1122cdf0e10cSrcweir if(bRenamable) 1123cdf0e10cSrcweir { 1124cdf0e10cSrcweir if(bSubPop4) 1125cdf0e10cSrcweir pSubPop4->InsertItem(502, sRename); 1126cdf0e10cSrcweir else 1127cdf0e10cSrcweir pPop->InsertItem(502, sRename); 1128cdf0e10cSrcweir } 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir if(bSubPop4) 1131cdf0e10cSrcweir { 1132cdf0e10cSrcweir pPop->InsertItem(4, pContType->GetSingleName()); 1133cdf0e10cSrcweir pPop->SetPopupMenu(4, pSubPop4); 1134cdf0e10cSrcweir } 1135cdf0e10cSrcweir } 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir else if( pEntry ) 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir SwContentType* pType = (SwContentType*)pEntry->GetUserData(); 1140cdf0e10cSrcweir if ( (pType->GetType() == CONTENT_TYPE_POSTIT) && (!pActiveShell->GetView().GetDocShell()->IsReadOnly()) && ( pType->GetMemberCount() > 0) ) 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir pSubPop4->InsertItem(600, sPostItShow ); 1143cdf0e10cSrcweir pSubPop4->InsertItem(601, sPostItHide ); 1144cdf0e10cSrcweir pSubPop4->InsertItem(602, sPostItDelete ); 1145cdf0e10cSrcweir /* 1146cdf0e10cSrcweir pSubPop4->InsertItem(603,rtl::OUString::createFromAscii("Sort")); 1147cdf0e10cSrcweir PopupMenu* pMenuSort = new PopupMenu; 1148cdf0e10cSrcweir pMenuSort->InsertItem(604,rtl::OUString::createFromAscii("By Position")); 1149cdf0e10cSrcweir pMenuSort->InsertItem(605,rtl::OUString::createFromAscii("By Author")); 1150cdf0e10cSrcweir pMenuSort->InsertItem(606,rtl::OUString::createFromAscii("By Date")); 1151cdf0e10cSrcweir pSubPop4->SetPopupMenu(603, pMenuSort); 1152cdf0e10cSrcweir */ 1153cdf0e10cSrcweir pPop->InsertItem(4, pType->GetSingleName()); 1154cdf0e10cSrcweir pPop->SetPopupMenu(4, pSubPop4); 1155cdf0e10cSrcweir } 1156cdf0e10cSrcweir } 1157cdf0e10cSrcweir 1158cdf0e10cSrcweir pPop->SetPopupMenu( 1, pSubPop1 ); 1159cdf0e10cSrcweir pPop->SetPopupMenu( 2, pSubPop2 ); 1160cdf0e10cSrcweir pPop->SetPopupMenu( 3, pSubPop3 ); 1161cdf0e10cSrcweir return pPop; 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir } 1164cdf0e10cSrcweir /*************************************************************************** 1165cdf0e10cSrcweir Beschreibung: Einrueckung fuer outlines (und sections) 1166cdf0e10cSrcweir ***************************************************************************/ 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir long SwContentTree::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab) 1170cdf0e10cSrcweir { 1171cdf0e10cSrcweir sal_uInt16 nLevel = 0; 1172cdf0e10cSrcweir if(lcl_IsContent(pEntry)) 1173cdf0e10cSrcweir { 1174cdf0e10cSrcweir nLevel++; 1175cdf0e10cSrcweir SwContent* pCnt = (SwContent *) pEntry->GetUserData(); 1176cdf0e10cSrcweir const SwContentType* pParent; 1177cdf0e10cSrcweir if(pCnt && 0 != (pParent = pCnt->GetParent())) 1178cdf0e10cSrcweir { 1179cdf0e10cSrcweir if(pParent->GetType() == CONTENT_TYPE_OUTLINE) 1180cdf0e10cSrcweir nLevel = nLevel + ((SwOutlineContent*)pCnt)->GetOutlineLevel(); 1181cdf0e10cSrcweir else if(pParent->GetType() == CONTENT_TYPE_REGION) 1182cdf0e10cSrcweir nLevel = nLevel + ((SwRegionContent*)pCnt)->GetRegionLevel(); 1183cdf0e10cSrcweir } 1184cdf0e10cSrcweir } 1185cdf0e10cSrcweir sal_uInt16 nBasis = bIsRoot ? 0 : 5; 1186cdf0e10cSrcweir return nLevel * 10 + nBasis + pTab->GetPos(); //empirisch ermittelt 1187cdf0e10cSrcweir } 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir /*************************************************************************** 1190cdf0e10cSrcweir Beschreibung: Inhalte werden erst auf Anforderung in die Box eingefuegt 1191cdf0e10cSrcweir ***************************************************************************/ 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir void SwContentTree::RequestingChilds( SvLBoxEntry* pParent ) 1195cdf0e10cSrcweir { 1196cdf0e10cSrcweir // ist es ein Inhaltstyp? 1197cdf0e10cSrcweir if(lcl_IsContentType(pParent)) 1198cdf0e10cSrcweir { 1199cdf0e10cSrcweir if(!pParent->HasChilds()) 1200cdf0e10cSrcweir { 1201cdf0e10cSrcweir DBG_ASSERT(pParent->GetUserData(), "keine UserData?"); 1202cdf0e10cSrcweir SwContentType* pCntType = (SwContentType*)pParent->GetUserData(); 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir sal_uInt16 nCount = pCntType->GetMemberCount(); 1205cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nCount; i++) 1206cdf0e10cSrcweir { 1207cdf0e10cSrcweir const SwContent* pCnt = pCntType->GetMember(i); 1208cdf0e10cSrcweir if(pCnt) 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir String sEntry = pCnt->GetName(); 1211cdf0e10cSrcweir if(!sEntry.Len()) 1212cdf0e10cSrcweir sEntry = sSpace; 1213cdf0e10cSrcweir InsertEntry(sEntry, pParent, 1214cdf0e10cSrcweir sal_False, LIST_APPEND, (void*)pCnt); 1215cdf0e10cSrcweir } 1216cdf0e10cSrcweir 1217cdf0e10cSrcweir } 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir } 1220cdf0e10cSrcweir } 1221cdf0e10cSrcweir /*************************************************************************** 1222cdf0e10cSrcweir Beschreibung: Expand - Zustand fuer Inhaltstypen merken 1223cdf0e10cSrcweir ***************************************************************************/ 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir 1226cdf0e10cSrcweir sal_Bool SwContentTree::Expand( SvLBoxEntry* pParent ) 1227cdf0e10cSrcweir { 1228cdf0e10cSrcweir if(!bIsRoot) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir if(lcl_IsContentType(pParent)) 1231cdf0e10cSrcweir { 1232cdf0e10cSrcweir SwContentType* pCntType = (SwContentType*)pParent->GetUserData(); 1233cdf0e10cSrcweir sal_uInt16 nOr = 1 << pCntType->GetType(); //linear -> Bitposition 1234cdf0e10cSrcweir if(bIsActive || bIsConstant) 1235cdf0e10cSrcweir { 1236cdf0e10cSrcweir nActiveBlock |= nOr; 1237cdf0e10cSrcweir pConfig->SetActiveBlock(nActiveBlock); 1238cdf0e10cSrcweir } 1239cdf0e10cSrcweir else 1240cdf0e10cSrcweir nHiddenBlock |= nOr; 1241cdf0e10cSrcweir } 1242cdf0e10cSrcweir } 1243cdf0e10cSrcweir return SvTreeListBox::Expand(pParent); 1244cdf0e10cSrcweir } 1245cdf0e10cSrcweir /*************************************************************************** 1246cdf0e10cSrcweir Beschreibung: Collapse - Zustand fuer Inhaltstypen merken 1247cdf0e10cSrcweir ***************************************************************************/ 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir sal_Bool SwContentTree::Collapse( SvLBoxEntry* pParent ) 1251cdf0e10cSrcweir { 1252cdf0e10cSrcweir sal_Bool bRet; 1253cdf0e10cSrcweir if(!bIsRoot) 1254cdf0e10cSrcweir { 1255cdf0e10cSrcweir if(lcl_IsContentType(pParent)) 1256cdf0e10cSrcweir { 1257cdf0e10cSrcweir SwContentType* pCntType = (SwContentType*)pParent->GetUserData(); 1258cdf0e10cSrcweir sal_uInt16 nAnd = 1 << pCntType->GetType(); 1259cdf0e10cSrcweir nAnd = ~nAnd; 1260cdf0e10cSrcweir if(bIsActive || bIsConstant) 1261cdf0e10cSrcweir { 1262cdf0e10cSrcweir nActiveBlock &= nAnd; 1263cdf0e10cSrcweir pConfig->SetActiveBlock(nActiveBlock); 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir else 1266cdf0e10cSrcweir nHiddenBlock &= nAnd; 1267cdf0e10cSrcweir } 1268cdf0e10cSrcweir bRet = SvTreeListBox::Collapse(pParent); 1269cdf0e10cSrcweir } 1270cdf0e10cSrcweir else 1271cdf0e10cSrcweir bRet = sal_False; 1272cdf0e10cSrcweir return bRet; 1273cdf0e10cSrcweir } 1274cdf0e10cSrcweir 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir /*************************************************************************** 1277cdf0e10cSrcweir Beschreibung: Auch auf Doppelclick wird zunaechst nur aufgeklappt 1278cdf0e10cSrcweir ***************************************************************************/ 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir 1281cdf0e10cSrcweir IMPL_LINK( SwContentTree, ContentDoubleClickHdl, SwContentTree *, EMPTYARG ) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 1284cdf0e10cSrcweir // ist es ein Inhaltstyp? 1285cdf0e10cSrcweir DBG_ASSERT(pEntry, "kein aktueller Eintrag!"); 1286cdf0e10cSrcweir if(pEntry) 1287cdf0e10cSrcweir { 1288cdf0e10cSrcweir if(lcl_IsContentType(pEntry)) 1289cdf0e10cSrcweir RequestingChilds(pEntry); 1290cdf0e10cSrcweir else if(bIsActive || bIsConstant) 1291cdf0e10cSrcweir { 1292cdf0e10cSrcweir if(bIsConstant) 1293cdf0e10cSrcweir { 1294cdf0e10cSrcweir pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop(); 1295cdf0e10cSrcweir } 1296cdf0e10cSrcweir //Inhaltstyp anspringen: 1297cdf0e10cSrcweir SwContent* pCnt = (SwContent*)pEntry->GetUserData(); 1298cdf0e10cSrcweir DBG_ASSERT( pCnt, "keine UserData"); 1299cdf0e10cSrcweir GotoContent(pCnt); 1300cdf0e10cSrcweir if(pCnt->GetParent()->GetType() == CONTENT_TYPE_FRAME) 1301cdf0e10cSrcweir pActiveShell->EnterStdMode(); 1302cdf0e10cSrcweir } 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir return 0; 1305cdf0e10cSrcweir } 1306cdf0e10cSrcweir 1307cdf0e10cSrcweir /*************************************************************************** 1308cdf0e10cSrcweir Beschreibung: Anzeigen der Datei 1309cdf0e10cSrcweir ***************************************************************************/ 1310cdf0e10cSrcweir 1311cdf0e10cSrcweir 1312cdf0e10cSrcweir void SwContentTree::Display( sal_Bool bActive ) 1313cdf0e10cSrcweir { 1314cdf0e10cSrcweir if(!bIsImageListInitialized) 1315cdf0e10cSrcweir { 1316cdf0e10cSrcweir sal_uInt16 nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; 1317cdf0e10cSrcweir aEntryImages = ImageList(SW_RES(nResId)); 1318cdf0e10cSrcweir bIsImageListInitialized = sal_True; 1319cdf0e10cSrcweir } 1320cdf0e10cSrcweir // erst den selektierten Eintrag auslesen, um ihn spaeter evtl. wieder 1321cdf0e10cSrcweir // zu selektieren -> die UserDaten sind hier nicht mehr gueltig! 1322cdf0e10cSrcweir SvLBoxEntry* pOldSelEntry = FirstSelected(); 1323cdf0e10cSrcweir String sEntryName; // Name des Eintrags 1324cdf0e10cSrcweir sal_uInt16 nEntryRelPos = 0; // rel. Pos zu seinem Parent 1325cdf0e10cSrcweir sal_uInt32 nOldEntryCount = GetEntryCount(); 1326cdf0e10cSrcweir sal_Int32 nOldScrollPos = 0; 1327cdf0e10cSrcweir if(pOldSelEntry) 1328cdf0e10cSrcweir { 1329cdf0e10cSrcweir ScrollBar* pVScroll = GetVScroll(); 1330cdf0e10cSrcweir if(pVScroll && pVScroll->IsVisible()) 1331cdf0e10cSrcweir nOldScrollPos = pVScroll->GetThumbPos(); 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir sEntryName = GetEntryText(pOldSelEntry); 1334cdf0e10cSrcweir if(GetParent(pOldSelEntry)) 1335cdf0e10cSrcweir { 1336cdf0e10cSrcweir nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(GetParent(pOldSelEntry))); 1337cdf0e10cSrcweir } 1338cdf0e10cSrcweir } 1339cdf0e10cSrcweir Clear(); 1340cdf0e10cSrcweir SetUpdateMode( sal_False ); 1341cdf0e10cSrcweir if(bActive && !bIsConstant && !bIsActive) 1342cdf0e10cSrcweir bIsActive = bActive; 1343cdf0e10cSrcweir bIsHidden = !bActive; 1344cdf0e10cSrcweir SwWrtShell* pShell = GetWrtShell(); 1345cdf0e10cSrcweir sal_Bool bReadOnly = pShell ? pShell->GetView().GetDocShell()->IsReadOnly() : sal_True; 1346cdf0e10cSrcweir if(bReadOnly != bIsLastReadOnly) 1347cdf0e10cSrcweir { 1348cdf0e10cSrcweir bIsLastReadOnly = bReadOnly; 1349cdf0e10cSrcweir sal_Bool bDisable = pShell == 0 || bReadOnly; 1350cdf0e10cSrcweir SwNavigationPI* pNavi = GetParentWindow(); 1351cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , !bDisable); 1352cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, !bDisable); 1353cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, !bDisable); 1354cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT, !bDisable); 1355cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable); 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir if(pShell) 1358cdf0e10cSrcweir { 1359cdf0e10cSrcweir SvLBoxEntry* pSelEntry = 0; 1360cdf0e10cSrcweir if(nRootType == USHRT_MAX) 1361cdf0e10cSrcweir { 1362cdf0e10cSrcweir for(sal_uInt16 nCntType = CONTENT_TYPE_OUTLINE; 1363cdf0e10cSrcweir nCntType <= CONTENT_TYPE_DRAWOBJECT; nCntType++ ) 1364cdf0e10cSrcweir { 1365cdf0e10cSrcweir SwContentType** ppContentT = bActive ? 1366cdf0e10cSrcweir &aActiveContentArr[nCntType] : 1367cdf0e10cSrcweir &aHiddenContentArr[nCntType]; 1368cdf0e10cSrcweir if(!*ppContentT) 1369cdf0e10cSrcweir (*ppContentT) = new SwContentType(pShell, nCntType, nOutlineLevel ); 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir 1372cdf0e10cSrcweir String sEntry = (*ppContentT)->GetName(); 1373cdf0e10cSrcweir SvLBoxEntry* pEntry; 1374cdf0e10cSrcweir const Image& rImage = aEntryImages.GetImage(SID_SW_START + nCntType); 1375cdf0e10cSrcweir sal_Bool bChOnDemand = 0 != (*ppContentT)->GetMemberCount(); 1376cdf0e10cSrcweir pEntry = InsertEntry(sEntry, rImage, rImage, 1377cdf0e10cSrcweir 0, bChOnDemand, LIST_APPEND, (*ppContentT)); 1378cdf0e10cSrcweir if(nCntType == nLastSelType) 1379cdf0e10cSrcweir pSelEntry = pEntry; 1380cdf0e10cSrcweir sal_Int32 nExpandOptions = bIsActive || bIsConstant ? 1381cdf0e10cSrcweir nActiveBlock : 1382cdf0e10cSrcweir nHiddenBlock; 1383cdf0e10cSrcweir if(nExpandOptions & (1 << nCntType)) 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir Expand(pEntry); 1386cdf0e10cSrcweir if(nEntryRelPos && nCntType == nLastSelType) 1387cdf0e10cSrcweir { 1388cdf0e10cSrcweir // jetzt vielleicht noch ein Child selektieren 1389cdf0e10cSrcweir SvLBoxEntry* pChild = pEntry; 1390cdf0e10cSrcweir SvLBoxEntry* pTemp = 0; 1391cdf0e10cSrcweir sal_uInt16 nPos = 1; 1392cdf0e10cSrcweir while(0 != (pChild = Next(pChild))) 1393cdf0e10cSrcweir { 1394cdf0e10cSrcweir // der alte Text wird leicht bevorzugt 1395cdf0e10cSrcweir if(sEntryName == GetEntryText(pChild) || 1396cdf0e10cSrcweir nPos == nEntryRelPos ) 1397cdf0e10cSrcweir { 1398cdf0e10cSrcweir pSelEntry = pChild; 1399cdf0e10cSrcweir break; 1400cdf0e10cSrcweir } 1401cdf0e10cSrcweir pTemp = pChild; 1402cdf0e10cSrcweir nPos++; 1403cdf0e10cSrcweir } 1404cdf0e10cSrcweir if(!pSelEntry || lcl_IsContentType(pSelEntry)) 1405cdf0e10cSrcweir pSelEntry = pTemp; 1406cdf0e10cSrcweir } 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir } 1409cdf0e10cSrcweir } 1410cdf0e10cSrcweir if(pSelEntry) 1411cdf0e10cSrcweir { 1412cdf0e10cSrcweir MakeVisible(pSelEntry); 1413cdf0e10cSrcweir Select(pSelEntry); 1414cdf0e10cSrcweir } 1415cdf0e10cSrcweir else 1416cdf0e10cSrcweir nOldScrollPos = 0; 1417cdf0e10cSrcweir } 1418cdf0e10cSrcweir else 1419cdf0e10cSrcweir { 1420cdf0e10cSrcweir SwContentType** ppRootContentT = bActive ? 1421cdf0e10cSrcweir &aActiveContentArr[nRootType] : 1422cdf0e10cSrcweir &aHiddenContentArr[nRootType]; 1423cdf0e10cSrcweir if(!(*ppRootContentT)) 1424cdf0e10cSrcweir (*ppRootContentT) = new SwContentType(pShell, nRootType, nOutlineLevel ); 1425cdf0e10cSrcweir const Image& rImage = aEntryImages.GetImage(20000 + nRootType); 1426cdf0e10cSrcweir SvLBoxEntry* pParent = InsertEntry( 1427cdf0e10cSrcweir (*ppRootContentT)->GetName(), rImage, rImage, 1428cdf0e10cSrcweir 0, sal_False, LIST_APPEND, *ppRootContentT); 1429cdf0e10cSrcweir 1430cdf0e10cSrcweir for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ ) 1431cdf0e10cSrcweir { 1432cdf0e10cSrcweir const SwContent* pCnt = (*ppRootContentT)->GetMember(i); 1433cdf0e10cSrcweir if(pCnt) 1434cdf0e10cSrcweir { 1435cdf0e10cSrcweir String sEntry = pCnt->GetName(); 1436cdf0e10cSrcweir if(!sEntry.Len()) 1437cdf0e10cSrcweir sEntry = sSpace; 1438cdf0e10cSrcweir InsertEntry( sEntry, pParent, 1439cdf0e10cSrcweir sal_False, LIST_APPEND, (void*)pCnt); 1440cdf0e10cSrcweir } 1441cdf0e10cSrcweir } 1442cdf0e10cSrcweir Expand(pParent); 1443cdf0e10cSrcweir if( nRootType == CONTENT_TYPE_OUTLINE && bIsActive ) 1444cdf0e10cSrcweir { 1445cdf0e10cSrcweir //feststellen, wo der Cursor steht 1446cdf0e10cSrcweir const sal_uInt16 nActPos = pShell->GetOutlinePos(MAXLEVEL); 1447cdf0e10cSrcweir SvLBoxEntry* pEntry = First(); 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir while( 0 != (pEntry = Next(pEntry)) ) 1450cdf0e10cSrcweir { 1451cdf0e10cSrcweir if(((SwOutlineContent*)pEntry->GetUserData())->GetPos() == nActPos) 1452cdf0e10cSrcweir { 1453cdf0e10cSrcweir MakeVisible(pEntry); 1454cdf0e10cSrcweir Select(pEntry); 1455cdf0e10cSrcweir } 1456cdf0e10cSrcweir } 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir } 1459cdf0e10cSrcweir else 1460cdf0e10cSrcweir { 1461cdf0e10cSrcweir // jetzt vielleicht noch ein Child selektieren 1462cdf0e10cSrcweir SvLBoxEntry* pChild = pParent; 1463cdf0e10cSrcweir SvLBoxEntry* pTemp = 0; 1464cdf0e10cSrcweir sal_uInt16 nPos = 1; 1465cdf0e10cSrcweir while(0 != (pChild = Next(pChild))) 1466cdf0e10cSrcweir { 1467cdf0e10cSrcweir // der alte Text wird leicht bevorzugt 1468cdf0e10cSrcweir if(sEntryName == GetEntryText(pChild) || 1469cdf0e10cSrcweir nPos == nEntryRelPos ) 1470cdf0e10cSrcweir { 1471cdf0e10cSrcweir pSelEntry = pChild; 1472cdf0e10cSrcweir break; 1473cdf0e10cSrcweir } 1474cdf0e10cSrcweir pTemp = pChild; 1475cdf0e10cSrcweir nPos++; 1476cdf0e10cSrcweir } 1477cdf0e10cSrcweir if(!pSelEntry) 1478cdf0e10cSrcweir pSelEntry = pTemp; 1479cdf0e10cSrcweir if(pSelEntry) 1480cdf0e10cSrcweir { 1481cdf0e10cSrcweir MakeVisible(pSelEntry); 1482cdf0e10cSrcweir Select(pSelEntry); 1483cdf0e10cSrcweir } 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir } 1486cdf0e10cSrcweir } 1487cdf0e10cSrcweir SetUpdateMode( sal_True ); 1488cdf0e10cSrcweir ScrollBar* pVScroll = GetVScroll(); 1489cdf0e10cSrcweir if(GetEntryCount() == nOldEntryCount && 1490cdf0e10cSrcweir nOldScrollPos && pVScroll && pVScroll->IsVisible() 1491cdf0e10cSrcweir && pVScroll->GetThumbPos() != nOldScrollPos) 1492cdf0e10cSrcweir { 1493cdf0e10cSrcweir sal_Int32 nDelta = pVScroll->GetThumbPos() - nOldScrollPos; 1494cdf0e10cSrcweir ScrollOutputArea( (short)nDelta ); 1495cdf0e10cSrcweir } 1496cdf0e10cSrcweir 1497cdf0e10cSrcweir } 1498cdf0e10cSrcweir 1499cdf0e10cSrcweir /*************************************************************************** 1500cdf0e10cSrcweir Beschreibung: Im Clear muessen auch die ContentTypes geloescht werden 1501cdf0e10cSrcweir ***************************************************************************/ 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir void SwContentTree::Clear() 1505cdf0e10cSrcweir { 1506cdf0e10cSrcweir SetUpdateMode(sal_False); 1507cdf0e10cSrcweir SvTreeListBox::Clear(); 1508cdf0e10cSrcweir SetUpdateMode(sal_True); 1509cdf0e10cSrcweir } 1510cdf0e10cSrcweir 1511cdf0e10cSrcweir /*************************************************************************** 1512cdf0e10cSrcweir Beschreibung: 1513cdf0e10cSrcweir ***************************************************************************/ 1514cdf0e10cSrcweir 1515cdf0e10cSrcweir sal_Bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer, 1516cdf0e10cSrcweir sal_Int8& rDragMode ) 1517cdf0e10cSrcweir { 1518cdf0e10cSrcweir SwWrtShell* pWrtShell = GetWrtShell(); 1519cdf0e10cSrcweir DBG_ASSERT(pWrtShell, "keine Shell!"); 1520cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 1521cdf0e10cSrcweir if(!pEntry || lcl_IsContentType(pEntry) || !pWrtShell) 1522cdf0e10cSrcweir return sal_False; 1523cdf0e10cSrcweir String sEntry; 1524cdf0e10cSrcweir SwContent* pCnt = ((SwContent*)pEntry->GetUserData()); 1525cdf0e10cSrcweir 1526cdf0e10cSrcweir sal_uInt16 nActType = pCnt->GetParent()->GetType(); 1527cdf0e10cSrcweir String sUrl; 1528cdf0e10cSrcweir sal_Bool bOutline = sal_False; 1529cdf0e10cSrcweir String sOutlineText; 1530cdf0e10cSrcweir switch( nActType ) 1531cdf0e10cSrcweir { 1532cdf0e10cSrcweir case CONTENT_TYPE_OUTLINE: 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir sal_uInt16 nPos = ((SwOutlineContent*)pCnt)->GetPos(); 1535cdf0e10cSrcweir DBG_ASSERT(nPos < pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount(), 1536cdf0e10cSrcweir "outlinecnt veraendert"); 1537cdf0e10cSrcweir 1538cdf0e10cSrcweir // #100738# make sure outline may actually be copied 1539cdf0e10cSrcweir if( pWrtShell->IsOutlineCopyable( nPos ) ) 1540cdf0e10cSrcweir { 1541cdf0e10cSrcweir const SwNumRule* pOutlRule = pWrtShell->GetOutlineNumRule(); 1542cdf0e10cSrcweir const SwTxtNode* pTxtNd = 1543cdf0e10cSrcweir pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNode(nPos); 1544cdf0e10cSrcweir if( pTxtNd && pOutlRule && pTxtNd->IsNumbered()) 1545cdf0e10cSrcweir { 1546cdf0e10cSrcweir SwNumberTree::tNumberVector aNumVector = 1547cdf0e10cSrcweir pTxtNd->GetNumberVector(); 1548cdf0e10cSrcweir for( sal_Int8 nLevel = 0; 1549cdf0e10cSrcweir nLevel <= pTxtNd->GetActualListLevel(); 1550cdf0e10cSrcweir nLevel++ ) 1551cdf0e10cSrcweir { 1552cdf0e10cSrcweir sal_uInt16 nVal = (sal_uInt16)aNumVector[nLevel]; 1553cdf0e10cSrcweir nVal ++; 1554cdf0e10cSrcweir nVal = nVal - pOutlRule->Get(nLevel).GetStart(); 1555cdf0e10cSrcweir sEntry += String::CreateFromInt32( nVal ); 1556cdf0e10cSrcweir sEntry += '.'; 1557cdf0e10cSrcweir } 1558cdf0e10cSrcweir } 1559cdf0e10cSrcweir sEntry += pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, false); 1560cdf0e10cSrcweir sOutlineText = pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, true); 1561cdf0e10cSrcweir bIsOutlineMoveable = ((SwOutlineContent*)pCnt)->IsMoveable(); 1562cdf0e10cSrcweir bOutline = sal_True; 1563cdf0e10cSrcweir } 1564cdf0e10cSrcweir } 1565cdf0e10cSrcweir break; 1566cdf0e10cSrcweir case CONTENT_TYPE_POSTIT: 1567cdf0e10cSrcweir case CONTENT_TYPE_INDEX: 1568cdf0e10cSrcweir case CONTENT_TYPE_REFERENCE : 1569cdf0e10cSrcweir // koennen weder als URL noch als Bereich eingefuegt werden 1570cdf0e10cSrcweir break; 1571cdf0e10cSrcweir case CONTENT_TYPE_URLFIELD: 1572cdf0e10cSrcweir sUrl = ((SwURLFieldContent*)pCnt)->GetURL(); 1573cdf0e10cSrcweir // kein break; 1574cdf0e10cSrcweir case CONTENT_TYPE_OLE: 1575cdf0e10cSrcweir case CONTENT_TYPE_GRAPHIC: 1576cdf0e10cSrcweir if(GetParentWindow()->GetRegionDropMode() != REGION_MODE_NONE) 1577cdf0e10cSrcweir break; 1578cdf0e10cSrcweir else 1579cdf0e10cSrcweir rDragMode &= ~( DND_ACTION_MOVE | DND_ACTION_LINK ); 1580cdf0e10cSrcweir default: 1581cdf0e10cSrcweir sEntry = GetEntryText(pEntry); 1582cdf0e10cSrcweir } 1583cdf0e10cSrcweir 1584cdf0e10cSrcweir sal_Bool bRet = sal_False; 1585cdf0e10cSrcweir if(sEntry.Len()) 1586cdf0e10cSrcweir { 1587cdf0e10cSrcweir const SwDocShell* pDocShell = pWrtShell->GetView().GetDocShell(); 1588cdf0e10cSrcweir if(!sUrl.Len()) 1589cdf0e10cSrcweir { 1590cdf0e10cSrcweir if(pDocShell->HasName()) 1591cdf0e10cSrcweir { 1592cdf0e10cSrcweir SfxMedium* pMedium = pDocShell->GetMedium(); 1593cdf0e10cSrcweir sUrl = pMedium->GetURLObject().GetURLNoMark(); 1594cdf0e10cSrcweir // nur, wenn primaer ein Link eingefuegt werden soll 1595cdf0e10cSrcweir bRet = sal_True; 1596cdf0e10cSrcweir } 1597cdf0e10cSrcweir else if( nActType == CONTENT_TYPE_REGION || 1598cdf0e10cSrcweir nActType == CONTENT_TYPE_BOOKMARK ) 1599cdf0e10cSrcweir { 1600cdf0e10cSrcweir // fuer Bereich und Textmarken ist ein Link auch ohne 1601cdf0e10cSrcweir // Dateiname ins eigene Dokument erlaubt 1602cdf0e10cSrcweir bRet = sal_True; 1603cdf0e10cSrcweir } 1604cdf0e10cSrcweir else if(bIsConstant && 1605cdf0e10cSrcweir ( !::GetActiveView() || 1606cdf0e10cSrcweir pActiveShell != ::GetActiveView()->GetWrtShellPtr())) 1607cdf0e10cSrcweir { 1608cdf0e10cSrcweir // Urls von inaktiven Views ohne Dateinamen koennen auch nicht 1609cdf0e10cSrcweir // gedraggt werden 1610cdf0e10cSrcweir bRet = sal_False; 1611cdf0e10cSrcweir } 1612cdf0e10cSrcweir else 1613cdf0e10cSrcweir { 1614cdf0e10cSrcweir bRet = GetParentWindow()->GetRegionDropMode() == REGION_MODE_NONE; 1615cdf0e10cSrcweir rDragMode = DND_ACTION_MOVE; 1616cdf0e10cSrcweir } 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir const String& rToken = pCnt->GetParent()->GetTypeToken(); 1619cdf0e10cSrcweir sUrl += '#'; 1620cdf0e10cSrcweir sUrl += sEntry; 1621cdf0e10cSrcweir if(rToken.Len()) 1622cdf0e10cSrcweir { 1623cdf0e10cSrcweir sUrl += cMarkSeperator; 1624cdf0e10cSrcweir sUrl += rToken; 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir } 1627cdf0e10cSrcweir else 1628cdf0e10cSrcweir bRet = sal_True; 1629cdf0e10cSrcweir 1630cdf0e10cSrcweir if( bRet ) 1631cdf0e10cSrcweir { 1632cdf0e10cSrcweir //fuer Outlines muss in die Description der Ueberschrifttext mit der echten Nummer 1633cdf0e10cSrcweir if(bOutline) 1634cdf0e10cSrcweir sEntry = sOutlineText; 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir { 1637cdf0e10cSrcweir NaviContentBookmark aBmk( sUrl, sEntry, 1638cdf0e10cSrcweir GetParentWindow()->GetRegionDropMode(), 1639cdf0e10cSrcweir pDocShell); 1640cdf0e10cSrcweir aBmk.Copy( rTransfer ); 1641cdf0e10cSrcweir } 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir // fuer fremde DocShells muss eine INetBookmark 1644cdf0e10cSrcweir // dazugeliefert werden 1645cdf0e10cSrcweir if( pDocShell->HasName() ) 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir INetBookmark aBkmk( sUrl, sEntry ); 1648cdf0e10cSrcweir rTransfer.CopyINetBookmark( aBkmk ); 1649cdf0e10cSrcweir } 1650cdf0e10cSrcweir } 1651cdf0e10cSrcweir } 1652cdf0e10cSrcweir return bRet; 1653cdf0e10cSrcweir } 1654cdf0e10cSrcweir /*************************************************************************** 1655cdf0e10cSrcweir Beschreibung: Umschalten der Anzeige auf Root 1656cdf0e10cSrcweir ***************************************************************************/ 1657cdf0e10cSrcweir 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir sal_Bool SwContentTree::ToggleToRoot() 1660cdf0e10cSrcweir { 1661cdf0e10cSrcweir if(!bIsRoot) 1662cdf0e10cSrcweir { 1663cdf0e10cSrcweir SvLBoxEntry* pEntry = GetCurEntry(); 1664cdf0e10cSrcweir const SwContentType* pCntType; 1665cdf0e10cSrcweir if(pEntry) 1666cdf0e10cSrcweir { 1667cdf0e10cSrcweir if(lcl_IsContentType(pEntry)) 1668cdf0e10cSrcweir pCntType = (SwContentType*)pEntry->GetUserData(); 1669cdf0e10cSrcweir else 1670cdf0e10cSrcweir pCntType = ((SwContent*)pEntry->GetUserData())->GetParent(); 1671cdf0e10cSrcweir nRootType = pCntType->GetType(); 1672cdf0e10cSrcweir bIsRoot = sal_True; 1673cdf0e10cSrcweir Display(bIsActive || bIsConstant); 1674cdf0e10cSrcweir } 1675cdf0e10cSrcweir } 1676cdf0e10cSrcweir else 1677cdf0e10cSrcweir { 1678cdf0e10cSrcweir nRootType = USHRT_MAX; 1679cdf0e10cSrcweir bIsRoot = sal_False; 1680cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 1681cdf0e10cSrcweir Display(bIsActive || bIsConstant); 1682cdf0e10cSrcweir } 1683cdf0e10cSrcweir pConfig->SetRootType( nRootType ); 1684cdf0e10cSrcweir GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot); 1685cdf0e10cSrcweir return bIsRoot; 1686cdf0e10cSrcweir } 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir /*************************************************************************** 1689cdf0e10cSrcweir Beschreibung: Angezeigten Inhalt auf Gueltigkeit pruefen 1690cdf0e10cSrcweir ***************************************************************************/ 1691cdf0e10cSrcweir 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir sal_Bool SwContentTree::HasContentChanged() 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir /* 1696cdf0e10cSrcweir -Parallel durch das lokale Array und die Treelistbox laufen. 1697cdf0e10cSrcweir -Sind die Eintraege nicht expandiert, werden sie nur im Array verworfen 1698cdf0e10cSrcweir und der Contenttype wird als UserData neu gesetzt. 1699cdf0e10cSrcweir - ist der Root-Modus aktiv, wird nur dieser aktualisiert, 1700cdf0e10cSrcweir fuer die nicht angezeigten Inhaltstypen gilt: 1701cdf0e10cSrcweir die Memberliste wird geloescht und der Membercount aktualisiert 1702cdf0e10cSrcweir Wenn Inhalte ueberprueft werden, werden gleichzeitig die vorhanden 1703cdf0e10cSrcweir Memberlisten aufgefuellt. Sobald ein Unterschied auftritt wird nur noch 1704cdf0e10cSrcweir gefuellt und nicht mehr ueberprueft. Abschliessend wird die Box neu gefuellt. 1705cdf0e10cSrcweir 1706cdf0e10cSrcweir */ 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir sal_Bool bRepaint = sal_False; 1709cdf0e10cSrcweir sal_Bool bInvalidate = sal_False; 1710cdf0e10cSrcweir 1711cdf0e10cSrcweir if(!bIsActive && ! bIsConstant) 1712cdf0e10cSrcweir { 1713cdf0e10cSrcweir for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) 1714cdf0e10cSrcweir { 1715cdf0e10cSrcweir if(aActiveContentArr[i]) 1716cdf0e10cSrcweir aActiveContentArr[i]->Invalidate(); 1717cdf0e10cSrcweir } 1718cdf0e10cSrcweir } 1719cdf0e10cSrcweir else if(bIsRoot) 1720cdf0e10cSrcweir { 1721cdf0e10cSrcweir sal_Bool bOutline = sal_False; 1722cdf0e10cSrcweir SvLBoxEntry* pEntry = First(); 1723cdf0e10cSrcweir if(!pEntry) 1724cdf0e10cSrcweir bRepaint = sal_True; 1725cdf0e10cSrcweir else 1726cdf0e10cSrcweir { 1727cdf0e10cSrcweir sal_uInt16 nType = ((SwContentType*)pEntry->GetUserData())->GetType(); 1728cdf0e10cSrcweir bOutline = nRootType == CONTENT_TYPE_OUTLINE; 1729cdf0e10cSrcweir SwContentType* pArrType = aActiveContentArr[nType]; 1730cdf0e10cSrcweir if(!pArrType) 1731cdf0e10cSrcweir bRepaint = sal_True; 1732cdf0e10cSrcweir else 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir sal_uInt16 nSelLevel = USHRT_MAX; 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir SvLBoxEntry* pFirstSel; 1737cdf0e10cSrcweir if(bOutline && 1738cdf0e10cSrcweir 0 != ( pFirstSel = FirstSelected()) && 1739cdf0e10cSrcweir lcl_IsContent(pFirstSel)) 1740cdf0e10cSrcweir { 1741cdf0e10cSrcweir nSelLevel = ((SwOutlineContent*)pFirstSel->GetUserData())->GetOutlineLevel(); 1742cdf0e10cSrcweir SwWrtShell* pSh = GetWrtShell(); 1743cdf0e10cSrcweir sal_uInt16 nOutlinePos = pSh->GetOutlinePos(MAXLEVEL); 1744cdf0e10cSrcweir bRepaint |= nOutlinePos != USHRT_MAX && 1745cdf0e10cSrcweir pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos) != nSelLevel; 1746cdf0e10cSrcweir } 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir pArrType->Init(&bInvalidate); 1749cdf0e10cSrcweir pArrType->FillMemberList(); 1750cdf0e10cSrcweir pEntry->SetUserData((void*)pArrType); 1751cdf0e10cSrcweir if(!bRepaint) 1752cdf0e10cSrcweir { 1753cdf0e10cSrcweir if(GetChildCount(pEntry) != pArrType->GetMemberCount()) 1754cdf0e10cSrcweir bRepaint = sal_True; 1755cdf0e10cSrcweir else 1756cdf0e10cSrcweir { 1757cdf0e10cSrcweir sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry); 1758cdf0e10cSrcweir for(sal_uInt16 j = 0; j < nChildCount; j++) 1759cdf0e10cSrcweir { 1760cdf0e10cSrcweir pEntry = Next(pEntry); 1761cdf0e10cSrcweir const SwContent* pCnt = pArrType->GetMember(j); 1762cdf0e10cSrcweir pEntry->SetUserData((void*)pCnt); 1763cdf0e10cSrcweir String sEntryText = GetEntryText(pEntry); 1764cdf0e10cSrcweir if( sEntryText != pCnt->GetName() && 1765cdf0e10cSrcweir !(sEntryText == sSpace && !pCnt->GetName().Len())) 1766cdf0e10cSrcweir bRepaint = sal_True; 1767cdf0e10cSrcweir } 1768cdf0e10cSrcweir } 1769cdf0e10cSrcweir } 1770cdf0e10cSrcweir } 1771cdf0e10cSrcweir } 1772cdf0e10cSrcweir if( !bRepaint && bOutline ) 1773cdf0e10cSrcweir { 1774cdf0e10cSrcweir //feststellen, wo der Cursor steht 1775cdf0e10cSrcweir const sal_uInt16 nActPos = GetWrtShell()->GetOutlinePos(MAXLEVEL); 1776cdf0e10cSrcweir SvLBoxEntry* pFirstEntry = First(); 1777cdf0e10cSrcweir 1778cdf0e10cSrcweir while( 0 != (pFirstEntry = Next(pFirstEntry)) ) 1779cdf0e10cSrcweir { 1780cdf0e10cSrcweir if(((SwOutlineContent*)pFirstEntry->GetUserData())->GetPos() == nActPos) 1781cdf0e10cSrcweir { 1782cdf0e10cSrcweir if(FirstSelected() != pFirstEntry) 1783cdf0e10cSrcweir { 1784cdf0e10cSrcweir Select(pFirstEntry); 1785cdf0e10cSrcweir MakeVisible(pFirstEntry); 1786cdf0e10cSrcweir } 1787cdf0e10cSrcweir } 1788cdf0e10cSrcweir } 1789cdf0e10cSrcweir 1790cdf0e10cSrcweir } 1791cdf0e10cSrcweir 1792cdf0e10cSrcweir } 1793cdf0e10cSrcweir else 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir SvLBoxEntry* pEntry = First(); 1796cdf0e10cSrcweir while ( pEntry ) 1797cdf0e10cSrcweir { 1798cdf0e10cSrcweir sal_Bool bNext = sal_True; // mindestens ein Next muss sein 1799cdf0e10cSrcweir SwContentType* pTreeType = (SwContentType*)pEntry->GetUserData(); 1800cdf0e10cSrcweir sal_uInt16 nType = pTreeType->GetType(); 1801cdf0e10cSrcweir sal_uInt16 nTreeCount = pTreeType->GetMemberCount(); 1802cdf0e10cSrcweir SwContentType* pArrType = aActiveContentArr[nType]; 1803cdf0e10cSrcweir if(!pArrType) 1804cdf0e10cSrcweir bRepaint = sal_True; 1805cdf0e10cSrcweir else 1806cdf0e10cSrcweir { 1807cdf0e10cSrcweir pArrType->Init(&bInvalidate); 1808cdf0e10cSrcweir pEntry->SetUserData((void*)pArrType); 1809cdf0e10cSrcweir if(IsExpanded(pEntry)) 1810cdf0e10cSrcweir { 1811cdf0e10cSrcweir sal_Bool bLevelOrVisibiblityChanged = sal_False; 1812cdf0e10cSrcweir // bLevelOrVisibiblityChanged is set if outlines have changed their level 1813cdf0e10cSrcweir // or if the visibility of objects (frames, sections, tables) has changed 1814cdf0e10cSrcweir // i.e. in header/footer 1815cdf0e10cSrcweir pArrType->FillMemberList(&bLevelOrVisibiblityChanged); 1816cdf0e10cSrcweir if(bLevelOrVisibiblityChanged) 1817cdf0e10cSrcweir bInvalidate = sal_True; 1818cdf0e10cSrcweir sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry); 1819cdf0e10cSrcweir if(bLevelOrVisibiblityChanged) 1820cdf0e10cSrcweir bInvalidate = sal_True; 1821cdf0e10cSrcweir 1822cdf0e10cSrcweir if(nChildCount != pArrType->GetMemberCount()) 1823cdf0e10cSrcweir bRepaint = sal_True; 1824cdf0e10cSrcweir else 1825cdf0e10cSrcweir { 1826cdf0e10cSrcweir for(sal_uInt16 j = 0; j < nChildCount; j++) 1827cdf0e10cSrcweir { 1828cdf0e10cSrcweir pEntry = Next(pEntry); 1829cdf0e10cSrcweir bNext = sal_False; 1830cdf0e10cSrcweir const SwContent* pCnt = pArrType->GetMember(j); 1831cdf0e10cSrcweir pEntry->SetUserData((void*)pCnt); 1832cdf0e10cSrcweir String sEntryText = GetEntryText(pEntry); 1833cdf0e10cSrcweir if( sEntryText != pCnt->GetName() && 1834cdf0e10cSrcweir !(sEntryText == sSpace && !pCnt->GetName().Len())) 1835cdf0e10cSrcweir bRepaint = sal_True; 1836cdf0e10cSrcweir } 1837cdf0e10cSrcweir } 1838cdf0e10cSrcweir 1839cdf0e10cSrcweir } 1840cdf0e10cSrcweir else if(pEntry->HasChilds()) 1841cdf0e10cSrcweir { 1842cdf0e10cSrcweir //war der Eintrag einmal aufgeklappt, dann muessen auch 1843cdf0e10cSrcweir // die unsichtbaren Eintraege geprueft werden. 1844cdf0e10cSrcweir // zumindest muessen die Userdaten aktualisiert werden 1845cdf0e10cSrcweir sal_Bool bLevelOrVisibiblityChanged = sal_False; 1846cdf0e10cSrcweir // bLevelOrVisibiblityChanged is set if outlines have changed their level 1847cdf0e10cSrcweir // or if the visibility of objects (frames, sections, tables) has changed 1848cdf0e10cSrcweir // i.e. in header/footer 1849cdf0e10cSrcweir pArrType->FillMemberList(&bLevelOrVisibiblityChanged); 1850cdf0e10cSrcweir sal_Bool bRemoveChildren = sal_False; 1851cdf0e10cSrcweir sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry); 1852cdf0e10cSrcweir if( nChildCount != pArrType->GetMemberCount() ) 1853cdf0e10cSrcweir { 1854cdf0e10cSrcweir bRemoveChildren = sal_True; 1855cdf0e10cSrcweir } 1856cdf0e10cSrcweir else 1857cdf0e10cSrcweir { 1858cdf0e10cSrcweir SvLBoxEntry* pChild = FirstChild(pEntry); 1859cdf0e10cSrcweir for(sal_uInt16 j = 0; j < nChildCount; j++) 1860cdf0e10cSrcweir { 1861cdf0e10cSrcweir const SwContent* pCnt = pArrType->GetMember(j); 1862cdf0e10cSrcweir pChild->SetUserData((void*)pCnt); 1863cdf0e10cSrcweir String sEntryText = GetEntryText(pChild); 1864cdf0e10cSrcweir if( sEntryText != pCnt->GetName() && 1865cdf0e10cSrcweir !(sEntryText == sSpace && !pCnt->GetName().Len())) 1866cdf0e10cSrcweir bRemoveChildren = sal_True; 1867cdf0e10cSrcweir pChild = Next(pChild); 1868cdf0e10cSrcweir } 1869cdf0e10cSrcweir } 1870cdf0e10cSrcweir if(bRemoveChildren) 1871cdf0e10cSrcweir { 1872cdf0e10cSrcweir SvLBoxEntry* pChild = FirstChild(pEntry); 1873cdf0e10cSrcweir SvLBoxEntry* pRemove = pChild; 1874cdf0e10cSrcweir for(sal_uInt16 j = 0; j < nChildCount; j++) 1875cdf0e10cSrcweir { 1876cdf0e10cSrcweir pChild = Next(pRemove); 1877cdf0e10cSrcweir GetModel()->Remove(pRemove); 1878cdf0e10cSrcweir pRemove = pChild; 1879cdf0e10cSrcweir } 1880cdf0e10cSrcweir } 1881cdf0e10cSrcweir if(!nChildCount) 1882cdf0e10cSrcweir { 1883cdf0e10cSrcweir pEntry->EnableChildsOnDemand(sal_False); 1884cdf0e10cSrcweir InvalidateEntry(pEntry); 1885cdf0e10cSrcweir } 1886cdf0e10cSrcweir 1887cdf0e10cSrcweir } 1888cdf0e10cSrcweir else if((nTreeCount != 0) 1889cdf0e10cSrcweir != (pArrType->GetMemberCount()!=0)) 1890cdf0e10cSrcweir { 1891cdf0e10cSrcweir bRepaint = sal_True; 1892cdf0e10cSrcweir } 1893cdf0e10cSrcweir } 1894cdf0e10cSrcweir //hier muss noch der naechste Root-Entry gefunden werden 1895cdf0e10cSrcweir while( pEntry && (bNext || GetParent(pEntry ) )) 1896cdf0e10cSrcweir { 1897cdf0e10cSrcweir pEntry = Next(pEntry); 1898cdf0e10cSrcweir bNext = sal_False; 1899cdf0e10cSrcweir } 1900cdf0e10cSrcweir } 1901cdf0e10cSrcweir } 1902cdf0e10cSrcweir if(!bRepaint && bInvalidate) 1903cdf0e10cSrcweir Invalidate(); 1904cdf0e10cSrcweir return bRepaint; 1905cdf0e10cSrcweir } 1906cdf0e10cSrcweir 1907cdf0e10cSrcweir /*************************************************************************** 1908cdf0e10cSrcweir Beschreibung: Bevor alle Daten geloescht werden, soll noch der letzte 1909cdf0e10cSrcweir * aktive Eintrag festgestellt werden. Dann werden die 1910cdf0e10cSrcweir * UserData geloescht 1911cdf0e10cSrcweir ***************************************************************************/ 1912cdf0e10cSrcweir void SwContentTree::FindActiveTypeAndRemoveUserData() 1913cdf0e10cSrcweir { 1914cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected(); 1915cdf0e10cSrcweir if(pEntry) 1916cdf0e10cSrcweir { 1917cdf0e10cSrcweir // wird Clear ueber TimerUpdate gerufen, kann nur fuer die Root 1918cdf0e10cSrcweir // die Gueltigkeit der UserData garantiert werden 1919cdf0e10cSrcweir SvLBoxEntry* pParent; 1920cdf0e10cSrcweir while(0 != (pParent = GetParent(pEntry))) 1921cdf0e10cSrcweir pEntry = pParent; 1922cdf0e10cSrcweir if(pEntry->GetUserData() && lcl_IsContentType(pEntry)) 1923cdf0e10cSrcweir nLastSelType = ((SwContentType*)pEntry->GetUserData())->GetType(); 1924cdf0e10cSrcweir } 1925cdf0e10cSrcweir // else 1926cdf0e10cSrcweir // nLastSelType = USHRT_MAX; 1927cdf0e10cSrcweir pEntry = First(); 1928cdf0e10cSrcweir while(pEntry) 1929cdf0e10cSrcweir { 1930cdf0e10cSrcweir pEntry->SetUserData(0); 1931cdf0e10cSrcweir pEntry = Next(pEntry); 1932cdf0e10cSrcweir } 1933cdf0e10cSrcweir } 1934cdf0e10cSrcweir 1935cdf0e10cSrcweir /*************************************************************************** 1936cdf0e10cSrcweir Beschreibung: Nachdem ein File auf den Navigator gedroppt wurde, 1937cdf0e10cSrcweir wird die neue Shell gesetzt 1938cdf0e10cSrcweir ***************************************************************************/ 1939cdf0e10cSrcweir 1940cdf0e10cSrcweir 1941cdf0e10cSrcweir void SwContentTree::SetHiddenShell(SwWrtShell* pSh) 1942cdf0e10cSrcweir { 1943cdf0e10cSrcweir pHiddenShell = pSh; 1944cdf0e10cSrcweir bIsHidden = sal_True; 1945cdf0e10cSrcweir bIsActive = bIsConstant = sal_False; 1946cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 1947cdf0e10cSrcweir for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) 1948cdf0e10cSrcweir { 1949cdf0e10cSrcweir DELETEZ(aHiddenContentArr[i]); 1950cdf0e10cSrcweir } 1951cdf0e10cSrcweir Display(bIsActive); 1952cdf0e10cSrcweir 1953cdf0e10cSrcweir GetParentWindow()->UpdateListBox(); 1954cdf0e10cSrcweir } 1955cdf0e10cSrcweir /*************************************************************************** 1956cdf0e10cSrcweir Beschreibung: Dokumentwechsel - neue Shell setzen 1957cdf0e10cSrcweir ***************************************************************************/ 1958cdf0e10cSrcweir 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir void SwContentTree::SetActiveShell(SwWrtShell* pSh) 1961cdf0e10cSrcweir { 1962cdf0e10cSrcweir if(bIsInternalDrag) 1963cdf0e10cSrcweir bDocChgdInDragging = sal_True; 1964cdf0e10cSrcweir sal_Bool bClear = pActiveShell != pSh; 1965cdf0e10cSrcweir if(bIsActive && bClear) 1966cdf0e10cSrcweir { 1967cdf0e10cSrcweir pActiveShell = pSh; 1968cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 1969cdf0e10cSrcweir Clear(); 1970cdf0e10cSrcweir } 1971cdf0e10cSrcweir else if(bIsConstant) 1972cdf0e10cSrcweir { 1973cdf0e10cSrcweir if(!lcl_FindShell(pActiveShell)) 1974cdf0e10cSrcweir { 1975cdf0e10cSrcweir pActiveShell = pSh; 1976cdf0e10cSrcweir bIsActive = sal_True; 1977cdf0e10cSrcweir bIsConstant = sal_False; 1978cdf0e10cSrcweir bClear = sal_True; 1979cdf0e10cSrcweir } 1980cdf0e10cSrcweir } 1981cdf0e10cSrcweir // nur wenn es die aktive View ist, wird das Array geloescht und 1982cdf0e10cSrcweir // die Anzeige neu gefuellt 1983cdf0e10cSrcweir if(bIsActive && bClear) 1984cdf0e10cSrcweir { 1985cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 1986cdf0e10cSrcweir for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) 1987cdf0e10cSrcweir { 1988cdf0e10cSrcweir DELETEZ(aActiveContentArr[i]); 1989cdf0e10cSrcweir } 1990cdf0e10cSrcweir Display(sal_True); 1991cdf0e10cSrcweir } 1992cdf0e10cSrcweir } 1993cdf0e10cSrcweir 1994cdf0e10cSrcweir /*************************************************************************** 1995cdf0e10cSrcweir Beschreibung: Eine offene View als aktiv festlegen 1996cdf0e10cSrcweir ***************************************************************************/ 1997cdf0e10cSrcweir 1998cdf0e10cSrcweir 1999cdf0e10cSrcweir void SwContentTree::SetConstantShell(SwWrtShell* pSh) 2000cdf0e10cSrcweir { 2001cdf0e10cSrcweir pActiveShell = pSh; 2002cdf0e10cSrcweir bIsActive = sal_False; 2003cdf0e10cSrcweir bIsConstant = sal_True; 2004cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 2005cdf0e10cSrcweir for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) 2006cdf0e10cSrcweir { 2007cdf0e10cSrcweir DELETEZ(aActiveContentArr[i]); 2008cdf0e10cSrcweir } 2009cdf0e10cSrcweir Display(sal_True); 2010cdf0e10cSrcweir } 2011cdf0e10cSrcweir /*************************************************************************** 2012cdf0e10cSrcweir Beschreibung: Kommandos des Navigators ausfuehren 2013cdf0e10cSrcweir ***************************************************************************/ 2014cdf0e10cSrcweir 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) 2017cdf0e10cSrcweir { 2018cdf0e10cSrcweir sal_Bool nMove = sal_False; 2019cdf0e10cSrcweir switch( nCmd ) 2020cdf0e10cSrcweir { 2021cdf0e10cSrcweir case FN_ITEM_DOWN: 2022cdf0e10cSrcweir case FN_ITEM_UP: nMove = sal_True; 2023cdf0e10cSrcweir case FN_ITEM_LEFT: 2024cdf0e10cSrcweir case FN_ITEM_RIGHT: 2025cdf0e10cSrcweir if( !GetWrtShell()->GetView().GetDocShell()->IsReadOnly() && 2026cdf0e10cSrcweir (bIsActive || 2027cdf0e10cSrcweir (bIsConstant && pActiveShell == GetParentWindow()->GetCreateView()->GetWrtShellPtr()))) 2028cdf0e10cSrcweir { 2029cdf0e10cSrcweir SwWrtShell* pShell = GetWrtShell(); 2030cdf0e10cSrcweir sal_Int8 nActOutlineLevel = nOutlineLevel; 2031cdf0e10cSrcweir sal_uInt16 nActPos = pShell->GetOutlinePos(nActOutlineLevel); 2032cdf0e10cSrcweir SvLBoxEntry* pFirstEntry = FirstSelected(); 2033cdf0e10cSrcweir if (pFirstEntry && lcl_IsContent(pFirstEntry)) 2034cdf0e10cSrcweir { 2035cdf0e10cSrcweir if((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE) || 2036cdf0e10cSrcweir ((SwContent*)pFirstEntry->GetUserData())->GetParent()->GetType() 2037cdf0e10cSrcweir == CONTENT_TYPE_OUTLINE) 2038cdf0e10cSrcweir { 2039cdf0e10cSrcweir nActPos = ((SwOutlineContent*)pFirstEntry->GetUserData())->GetPos(); 2040cdf0e10cSrcweir } 2041cdf0e10cSrcweir } 2042cdf0e10cSrcweir if ( nActPos < USHRT_MAX && 2043cdf0e10cSrcweir ( !nMove || pShell->IsOutlineMovable( nActPos )) ) 2044cdf0e10cSrcweir { 2045cdf0e10cSrcweir pShell->StartAllAction(); 2046cdf0e10cSrcweir pShell->GotoOutline( nActPos); // Falls Textselektion != BoxSelektion 2047cdf0e10cSrcweir pShell->Push(); 2048cdf0e10cSrcweir pShell->MakeOutlineSel( nActPos, nActPos, 2049cdf0e10cSrcweir bModifier); 2050cdf0e10cSrcweir if( nMove ) 2051cdf0e10cSrcweir { 2052cdf0e10cSrcweir short nDir = nCmd == FN_ITEM_UP ? -1 : 1; 2053cdf0e10cSrcweir if( !bModifier && ((nDir == -1 && nActPos > 0) || 2054cdf0e10cSrcweir (nDir == 1 && nActPos < GetEntryCount() - 2 )) ) 2055cdf0e10cSrcweir { 2056cdf0e10cSrcweir pShell->MoveOutlinePara( nDir ); 2057cdf0e10cSrcweir //Cursor wieder an die aktuelle Position setzen 2058cdf0e10cSrcweir pShell->GotoOutline( nActPos + nDir); 2059cdf0e10cSrcweir } 2060cdf0e10cSrcweir else if(bModifier) 2061cdf0e10cSrcweir { 2062cdf0e10cSrcweir sal_uInt16 nActEndPos = nActPos; 2063cdf0e10cSrcweir SvLBoxEntry* pEntry = pFirstEntry; 2064cdf0e10cSrcweir sal_uInt16 nActLevel = ((SwOutlineContent*) 2065cdf0e10cSrcweir pFirstEntry->GetUserData())->GetOutlineLevel(); 2066cdf0e10cSrcweir pEntry = Next(pEntry); 2067cdf0e10cSrcweir while( pEntry && CONTENT_TYPE_OUTLINE == 2068cdf0e10cSrcweir ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() ) 2069cdf0e10cSrcweir { 2070cdf0e10cSrcweir if(nActLevel >= ((SwOutlineContent*) 2071cdf0e10cSrcweir pEntry->GetUserData())->GetOutlineLevel()) 2072cdf0e10cSrcweir break; 2073cdf0e10cSrcweir pEntry = Next(pEntry); 2074cdf0e10cSrcweir nActEndPos++; 2075cdf0e10cSrcweir } 2076cdf0e10cSrcweir sal_uInt16 nDest; 2077cdf0e10cSrcweir if(nDir == 1) 2078cdf0e10cSrcweir { 2079cdf0e10cSrcweir //Wenn der letzte Eintrag bewegt werden soll 2080cdf0e10cSrcweir //ist Schluss 2081cdf0e10cSrcweir if(pEntry && CONTENT_TYPE_OUTLINE == 2082cdf0e10cSrcweir ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId()) 2083cdf0e10cSrcweir { 2084cdf0e10cSrcweir // pEntry zeigt jetzt auf den 2085cdf0e10cSrcweir // dem letzten sel. Eintrag folgenden E. 2086cdf0e10cSrcweir nDest = nActEndPos; 2087cdf0e10cSrcweir nDest++; 2088cdf0e10cSrcweir //hier muss der uebernaechste Eintrag 2089cdf0e10cSrcweir //gefunden werden. Die Selektion muss davor eingefuegt 2090cdf0e10cSrcweir //werden 2091cdf0e10cSrcweir while(pEntry ) 2092cdf0e10cSrcweir { 2093cdf0e10cSrcweir pEntry = Next(pEntry); 2094cdf0e10cSrcweir // nDest++ darf nur ausgefuehrt werden, 2095cdf0e10cSrcweir // wenn pEntry != 0 2096cdf0e10cSrcweir if(pEntry && nDest++ && 2097cdf0e10cSrcweir ( nActLevel >= ((SwOutlineContent*)pEntry->GetUserData())->GetOutlineLevel()|| 2098cdf0e10cSrcweir CONTENT_TYPE_OUTLINE != ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId())) 2099cdf0e10cSrcweir { 2100cdf0e10cSrcweir nDest--; 2101cdf0e10cSrcweir break; 2102cdf0e10cSrcweir } 2103cdf0e10cSrcweir } 2104cdf0e10cSrcweir nDir = nDest - nActEndPos; 2105cdf0e10cSrcweir //wenn kein Eintrag gefunden wurde, der der Bedingung 2106cdf0e10cSrcweir //fuer das zuvor Einfuegen entspricht, muss etwas weniger 2107cdf0e10cSrcweir //geschoben werden 2108cdf0e10cSrcweir } 2109cdf0e10cSrcweir else 2110cdf0e10cSrcweir nDir = 0; 2111cdf0e10cSrcweir } 2112cdf0e10cSrcweir else 2113cdf0e10cSrcweir { 2114cdf0e10cSrcweir nDest = nActPos; 2115cdf0e10cSrcweir pEntry = pFirstEntry; 2116cdf0e10cSrcweir while(pEntry && nDest ) 2117cdf0e10cSrcweir { 2118cdf0e10cSrcweir nDest--; 2119cdf0e10cSrcweir pEntry = Prev(pEntry); 2120cdf0e10cSrcweir if(pEntry && 2121cdf0e10cSrcweir (nActLevel >= ((SwOutlineContent*)pEntry->GetUserData())->GetOutlineLevel()|| 2122cdf0e10cSrcweir CONTENT_TYPE_OUTLINE != 2123cdf0e10cSrcweir ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId())) 2124cdf0e10cSrcweir { 2125cdf0e10cSrcweir break; 2126cdf0e10cSrcweir } 2127cdf0e10cSrcweir } 2128cdf0e10cSrcweir nDir = nDest - nActPos; 2129cdf0e10cSrcweir } 2130cdf0e10cSrcweir if(nDir) 2131cdf0e10cSrcweir { 2132cdf0e10cSrcweir pShell->MoveOutlinePara( nDir ); 2133cdf0e10cSrcweir //Cursor wieder an die aktuelle Position setzen 2134cdf0e10cSrcweir pShell->GotoOutline( nActPos + nDir); 2135cdf0e10cSrcweir } 2136cdf0e10cSrcweir } 2137cdf0e10cSrcweir } 2138cdf0e10cSrcweir else 2139cdf0e10cSrcweir { 2140cdf0e10cSrcweir if( pShell->IsProtectedOutlinePara() ) 2141cdf0e10cSrcweir Sound::Beep(); //konnte nicht umgestuft werden 2142cdf0e10cSrcweir else 2143cdf0e10cSrcweir pShell->OutlineUpDown( nCmd == FN_ITEM_LEFT ? -1 : 1 ); 2144cdf0e10cSrcweir } 2145cdf0e10cSrcweir 2146cdf0e10cSrcweir pShell->ClearMark(); 2147cdf0e10cSrcweir pShell->Pop(sal_False); //Cursor steht jetzt wieder an der akt. Ueberschrift 2148cdf0e10cSrcweir pShell->EndAllAction(); 2149cdf0e10cSrcweir if(aActiveContentArr[CONTENT_TYPE_OUTLINE]) 2150cdf0e10cSrcweir aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate(); 2151cdf0e10cSrcweir Display(sal_True); 2152cdf0e10cSrcweir if(!bIsRoot) 2153cdf0e10cSrcweir { 2154cdf0e10cSrcweir const sal_uInt16 nCurrPos = pShell->GetOutlinePos(MAXLEVEL); 2155cdf0e10cSrcweir SvLBoxEntry* pFirst = First(); 2156cdf0e10cSrcweir 2157cdf0e10cSrcweir while( 0 != (pFirst = Next(pFirst)) && lcl_IsContent(pFirst)) 2158cdf0e10cSrcweir { 2159cdf0e10cSrcweir if(((SwOutlineContent*)pFirst->GetUserData())->GetPos() == nCurrPos) 2160cdf0e10cSrcweir { 2161cdf0e10cSrcweir Select(pFirst); 2162cdf0e10cSrcweir MakeVisible(pFirst); 2163cdf0e10cSrcweir } 2164cdf0e10cSrcweir } 2165cdf0e10cSrcweir } 2166cdf0e10cSrcweir } 2167cdf0e10cSrcweir else 2168cdf0e10cSrcweir Sound::Beep(); //konnte nicht verschoben werden 2169cdf0e10cSrcweir } 2170cdf0e10cSrcweir } 2171cdf0e10cSrcweir } 2172cdf0e10cSrcweir /*************************************************************************** 2173cdf0e10cSrcweir Beschreibung: 2174cdf0e10cSrcweir ***************************************************************************/ 2175cdf0e10cSrcweir 2176cdf0e10cSrcweir 2177cdf0e10cSrcweir void SwContentTree::ShowTree() 2178cdf0e10cSrcweir { 2179cdf0e10cSrcweir aUpdTimer.Start(); 2180cdf0e10cSrcweir SvTreeListBox::Show(); 2181cdf0e10cSrcweir } 2182cdf0e10cSrcweir 2183cdf0e10cSrcweir /*************************************************************************** 2184cdf0e10cSrcweir Beschreibung: zusammengefaltet wird nicht geidlet 2185cdf0e10cSrcweir ***************************************************************************/ 2186cdf0e10cSrcweir 2187cdf0e10cSrcweir 2188cdf0e10cSrcweir void SwContentTree::HideTree() 2189cdf0e10cSrcweir { 2190cdf0e10cSrcweir aUpdTimer.Stop(); 2191cdf0e10cSrcweir SvTreeListBox::Hide(); 2192cdf0e10cSrcweir } 2193cdf0e10cSrcweir 2194cdf0e10cSrcweir /*************************************************************************** 2195cdf0e10cSrcweir Beschreibung: Kein Idle mit Focus oder waehrend des Dragging 2196cdf0e10cSrcweir ***************************************************************************/ 2197cdf0e10cSrcweir 2198cdf0e10cSrcweir 2199cdf0e10cSrcweir IMPL_LINK( SwContentTree, TimerUpdate, Timer*, EMPTYARG) 2200cdf0e10cSrcweir { 2201cdf0e10cSrcweir // kein Update waehrend D&D 2202cdf0e10cSrcweir // Viewabfrage, da der Navigator zu spaet abgeraeumt wird 2203cdf0e10cSrcweir SwView* pView = GetParentWindow()->GetCreateView(); 2204cdf0e10cSrcweir if( (!HasFocus() || bViewHasChanged) && 2205cdf0e10cSrcweir !bIsInDrag && !bIsInternalDrag && pView && 2206cdf0e10cSrcweir pView->GetWrtShellPtr() && !pView->GetWrtShellPtr()->ActionPend() ) 2207cdf0e10cSrcweir { 2208cdf0e10cSrcweir bViewHasChanged = sal_False; 2209cdf0e10cSrcweir bIsIdleClear = sal_False; 2210cdf0e10cSrcweir SwWrtShell* pActShell = pView->GetWrtShellPtr(); 2211cdf0e10cSrcweir if( bIsConstant && !lcl_FindShell( pActiveShell ) ) 2212cdf0e10cSrcweir { 2213cdf0e10cSrcweir SetActiveShell(pActShell); 2214cdf0e10cSrcweir GetParentWindow()->UpdateListBox(); 2215cdf0e10cSrcweir } 2216cdf0e10cSrcweir 2217cdf0e10cSrcweir if(bIsActive && pActShell != GetWrtShell()) 2218cdf0e10cSrcweir SetActiveShell(pActShell); 2219cdf0e10cSrcweir else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) && 2220cdf0e10cSrcweir HasContentChanged()) 2221cdf0e10cSrcweir { 2222cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 2223cdf0e10cSrcweir Display(sal_True); 2224cdf0e10cSrcweir } 2225cdf0e10cSrcweir } 2226cdf0e10cSrcweir else if(!pView && bIsActive && !bIsIdleClear) 2227cdf0e10cSrcweir { 2228cdf0e10cSrcweir if(pActiveShell) 2229cdf0e10cSrcweir SetActiveShell(0); 2230cdf0e10cSrcweir Clear(); 2231cdf0e10cSrcweir bIsIdleClear = sal_True; 2232cdf0e10cSrcweir } 2233cdf0e10cSrcweir return 0; 2234cdf0e10cSrcweir } 2235cdf0e10cSrcweir 2236cdf0e10cSrcweir /*************************************************************************** 2237cdf0e10cSrcweir Beschreibung: 2238cdf0e10cSrcweir ***************************************************************************/ 2239cdf0e10cSrcweir 2240cdf0e10cSrcweir 2241cdf0e10cSrcweir DragDropMode SwContentTree::NotifyStartDrag( 2242cdf0e10cSrcweir TransferDataContainer& rContainer, 2243cdf0e10cSrcweir SvLBoxEntry* pEntry ) 2244cdf0e10cSrcweir { 2245cdf0e10cSrcweir DragDropMode eMode = (DragDropMode)0; 2246cdf0e10cSrcweir if( bIsActive && nRootType == CONTENT_TYPE_OUTLINE && 2247cdf0e10cSrcweir GetModel()->GetAbsPos( pEntry ) > 0 2248cdf0e10cSrcweir && !GetWrtShell()->GetView().GetDocShell()->IsReadOnly()) 2249cdf0e10cSrcweir eMode = GetDragDropMode(); 2250cdf0e10cSrcweir else if(!bIsActive && GetWrtShell()->GetView().GetDocShell()->HasName()) 2251cdf0e10cSrcweir eMode = SV_DRAGDROP_APP_COPY; 2252cdf0e10cSrcweir 2253cdf0e10cSrcweir sal_Int8 nDragMode; 2254cdf0e10cSrcweir FillTransferData( rContainer, nDragMode ); 2255cdf0e10cSrcweir bDocChgdInDragging = sal_False; 2256cdf0e10cSrcweir bIsInternalDrag = sal_True; 2257cdf0e10cSrcweir return eMode; 2258cdf0e10cSrcweir } 2259cdf0e10cSrcweir 2260cdf0e10cSrcweir 2261cdf0e10cSrcweir /*************************************************************************** 2262cdf0e10cSrcweir Beschreibung : Nach dem Drag wird der aktuelle Absatz m i t 2263cdf0e10cSrcweir Childs verschoben 2264cdf0e10cSrcweir ***************************************************************************/ 2265cdf0e10cSrcweir 2266cdf0e10cSrcweir 2267cdf0e10cSrcweir sal_Bool SwContentTree::NotifyMoving( SvLBoxEntry* pTarget, 2268cdf0e10cSrcweir SvLBoxEntry* pEntry, SvLBoxEntry*& , sal_uLong& ) 2269cdf0e10cSrcweir { 2270cdf0e10cSrcweir if(!bDocChgdInDragging) 2271cdf0e10cSrcweir { 2272cdf0e10cSrcweir sal_uInt16 nTargetPos = 0; 2273cdf0e10cSrcweir sal_uInt16 nSourcePos = (( SwOutlineContent* )pEntry->GetUserData())->GetPos(); 2274cdf0e10cSrcweir if(!lcl_IsContent(pTarget)) 2275cdf0e10cSrcweir nTargetPos = USHRT_MAX; 2276cdf0e10cSrcweir else 2277cdf0e10cSrcweir nTargetPos = (( SwOutlineContent* )pTarget->GetUserData())->GetPos(); 2278cdf0e10cSrcweir if( MAXLEVEL > nOutlineLevel && // werden nicht alle Ebenen angezeigt 2279cdf0e10cSrcweir nTargetPos != USHRT_MAX) 2280cdf0e10cSrcweir { 2281cdf0e10cSrcweir SvLBoxEntry* pNext = Next(pTarget); 2282cdf0e10cSrcweir if(pNext) 2283cdf0e10cSrcweir nTargetPos = (( SwOutlineContent* )pNext->GetUserData())->GetPos() -1; 2284cdf0e10cSrcweir else 2285cdf0e10cSrcweir nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount())- 1; 2286cdf0e10cSrcweir 2287cdf0e10cSrcweir } 2288cdf0e10cSrcweir 2289cdf0e10cSrcweir DBG_ASSERT( pEntry && 2290cdf0e10cSrcweir lcl_IsContent(pEntry),"Source == 0 oder Source hat keinen Content" ); 2291cdf0e10cSrcweir GetParentWindow()->MoveOutline( nSourcePos, 2292cdf0e10cSrcweir nTargetPos, 2293cdf0e10cSrcweir sal_True); 2294cdf0e10cSrcweir 2295cdf0e10cSrcweir aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate(); 2296cdf0e10cSrcweir Display(sal_True); 2297cdf0e10cSrcweir } 2298cdf0e10cSrcweir //TreeListBox wird aus dem Dokument neu geladen 2299cdf0e10cSrcweir return sal_False; 2300cdf0e10cSrcweir } 2301cdf0e10cSrcweir /*************************************************************************** 2302cdf0e10cSrcweir Beschreibung : Nach dem Drag wird der aktuelle Absatz o h n e 2303cdf0e10cSrcweir Childs verschoben 2304cdf0e10cSrcweir ***************************************************************************/ 2305cdf0e10cSrcweir 2306cdf0e10cSrcweir 2307cdf0e10cSrcweir sal_Bool SwContentTree::NotifyCopying( SvLBoxEntry* pTarget, 2308cdf0e10cSrcweir SvLBoxEntry* pEntry, SvLBoxEntry*& , sal_uLong& ) 2309cdf0e10cSrcweir { 2310cdf0e10cSrcweir if(!bDocChgdInDragging) 2311cdf0e10cSrcweir { 2312cdf0e10cSrcweir sal_uInt16 nTargetPos = 0; 2313cdf0e10cSrcweir sal_uInt16 nSourcePos = (( SwOutlineContent* )pEntry->GetUserData())->GetPos(); 2314cdf0e10cSrcweir if(!lcl_IsContent(pTarget)) 2315cdf0e10cSrcweir nTargetPos = USHRT_MAX; 2316cdf0e10cSrcweir else 2317cdf0e10cSrcweir nTargetPos = (( SwOutlineContent* )pTarget->GetUserData())->GetPos(); 2318cdf0e10cSrcweir 2319cdf0e10cSrcweir if( MAXLEVEL > nOutlineLevel && // werden nicht alle Ebenen angezeigt 2320cdf0e10cSrcweir nTargetPos != USHRT_MAX) 2321cdf0e10cSrcweir { 2322cdf0e10cSrcweir SvLBoxEntry* pNext = Next(pTarget); 2323cdf0e10cSrcweir if(pNext) 2324cdf0e10cSrcweir nTargetPos = (( SwOutlineContent* )pNext->GetUserData())->GetPos() - 1; 2325cdf0e10cSrcweir else 2326cdf0e10cSrcweir nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount()) - 1; 2327cdf0e10cSrcweir 2328cdf0e10cSrcweir } 2329cdf0e10cSrcweir 2330cdf0e10cSrcweir 2331cdf0e10cSrcweir DBG_ASSERT( pEntry && 2332cdf0e10cSrcweir lcl_IsContent(pEntry),"Source == 0 oder Source hat keinen Content" ); 2333cdf0e10cSrcweir GetParentWindow()->MoveOutline( nSourcePos, nTargetPos, sal_False); 2334cdf0e10cSrcweir 2335cdf0e10cSrcweir //TreeListBox wird aus dem Dokument neu geladen 2336cdf0e10cSrcweir aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate(); 2337cdf0e10cSrcweir Display(sal_True); 2338cdf0e10cSrcweir } 2339cdf0e10cSrcweir return sal_False; 2340cdf0e10cSrcweir } 2341cdf0e10cSrcweir 2342cdf0e10cSrcweir /*************************************************************************** 2343cdf0e10cSrcweir Beschreibung: Kein Drop vor den ersten Eintrag - es ist ein SwContentType 2344cdf0e10cSrcweir ***************************************************************************/ 2345cdf0e10cSrcweir 2346cdf0e10cSrcweir sal_Bool SwContentTree::NotifyAcceptDrop( SvLBoxEntry* pEntry) 2347cdf0e10cSrcweir { 2348cdf0e10cSrcweir return pEntry != 0; 2349cdf0e10cSrcweir } 2350cdf0e10cSrcweir 2351cdf0e10cSrcweir 2352cdf0e10cSrcweir /*************************************************************************** 2353cdf0e10cSrcweir Beschreibung: Wird ein Ctrl+DoubleClick in einen freien Bereich ausgefuehrt, 2354cdf0e10cSrcweir * dann soll die Basisfunktion des Controls gerufen werden 2355cdf0e10cSrcweir ***************************************************************************/ 2356cdf0e10cSrcweir void SwContentTree::MouseButtonDown( const MouseEvent& rMEvt ) 2357cdf0e10cSrcweir { 2358cdf0e10cSrcweir Point aPos( rMEvt.GetPosPixel()); 2359cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( aPos, sal_True ); 2360cdf0e10cSrcweir if( !pEntry && rMEvt.IsLeft() && rMEvt.IsMod1() && (rMEvt.GetClicks() % 2) == 0) 2361cdf0e10cSrcweir Control::MouseButtonDown( rMEvt ); 2362cdf0e10cSrcweir else 2363cdf0e10cSrcweir SvTreeListBox::MouseButtonDown( rMEvt ); 2364cdf0e10cSrcweir } 2365cdf0e10cSrcweir 2366cdf0e10cSrcweir /*************************************************************************** 2367cdf0e10cSrcweir Beschreibung: sofort aktualisieren 2368cdf0e10cSrcweir ***************************************************************************/ 2369cdf0e10cSrcweir 2370cdf0e10cSrcweir 2371cdf0e10cSrcweir void SwContentTree::GetFocus() 2372cdf0e10cSrcweir { 2373cdf0e10cSrcweir SwView* pActView = GetParentWindow()->GetCreateView(); 2374cdf0e10cSrcweir if(pActView) 2375cdf0e10cSrcweir { 2376cdf0e10cSrcweir SwWrtShell* pActShell = pActView->GetWrtShellPtr(); 2377cdf0e10cSrcweir if(bIsConstant && !lcl_FindShell(pActiveShell)) 2378cdf0e10cSrcweir { 2379cdf0e10cSrcweir SetActiveShell(pActShell); 2380cdf0e10cSrcweir } 2381cdf0e10cSrcweir 2382cdf0e10cSrcweir if(bIsActive && pActShell != GetWrtShell()) 2383cdf0e10cSrcweir SetActiveShell(pActShell); 2384cdf0e10cSrcweir else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) && 2385cdf0e10cSrcweir HasContentChanged()) 2386cdf0e10cSrcweir { 2387cdf0e10cSrcweir Display(sal_True); 2388cdf0e10cSrcweir } 2389cdf0e10cSrcweir } 2390cdf0e10cSrcweir else if(bIsActive) 2391cdf0e10cSrcweir Clear(); 2392cdf0e10cSrcweir SvTreeListBox::GetFocus(); 2393cdf0e10cSrcweir } 2394cdf0e10cSrcweir 2395cdf0e10cSrcweir /*************************************************************************** 2396cdf0e10cSrcweir Beschreibung: 2397cdf0e10cSrcweir ***************************************************************************/ 2398cdf0e10cSrcweir 2399cdf0e10cSrcweir 2400cdf0e10cSrcweir void SwContentTree::KeyInput(const KeyEvent& rEvent) 2401cdf0e10cSrcweir { 2402cdf0e10cSrcweir const KeyCode aCode = rEvent.GetKeyCode(); 2403cdf0e10cSrcweir if(aCode.GetCode() == KEY_RETURN) 2404cdf0e10cSrcweir { 2405cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected(); 2406cdf0e10cSrcweir if ( pEntry ) 2407cdf0e10cSrcweir { 2408cdf0e10cSrcweir switch(aCode.GetModifier()) 2409cdf0e10cSrcweir { 2410cdf0e10cSrcweir case KEY_MOD2: 2411cdf0e10cSrcweir // Boxen umschalten 2412cdf0e10cSrcweir GetParentWindow()->ToggleTree(); 2413cdf0e10cSrcweir break; 2414cdf0e10cSrcweir case KEY_MOD1: 2415cdf0e10cSrcweir // RootModus umschalten 2416cdf0e10cSrcweir ToggleToRoot(); 2417cdf0e10cSrcweir break; 2418cdf0e10cSrcweir case 0: 2419cdf0e10cSrcweir if(lcl_IsContentType(pEntry)) 2420cdf0e10cSrcweir { 2421cdf0e10cSrcweir IsExpanded(pEntry) ? 2422cdf0e10cSrcweir Collapse(pEntry) : 2423cdf0e10cSrcweir Expand(pEntry); 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir else 2426cdf0e10cSrcweir ContentDoubleClickHdl(0); 2427cdf0e10cSrcweir break; 2428cdf0e10cSrcweir } 2429cdf0e10cSrcweir } 2430cdf0e10cSrcweir } 2431cdf0e10cSrcweir else if(aCode.GetCode() == KEY_DELETE && 0 == aCode.GetModifier()) 2432cdf0e10cSrcweir { 2433cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected(); 2434cdf0e10cSrcweir if(pEntry && 2435cdf0e10cSrcweir lcl_IsContent(pEntry) && 2436cdf0e10cSrcweir ((SwContent*)pEntry->GetUserData())->GetParent()->IsDeletable() && 2437cdf0e10cSrcweir !pActiveShell->GetView().GetDocShell()->IsReadOnly()) 2438cdf0e10cSrcweir { 2439cdf0e10cSrcweir EditEntry(pEntry, EDIT_MODE_DELETE); 2440cdf0e10cSrcweir bViewHasChanged = sal_True; 2441cdf0e10cSrcweir GetParentWindow()->UpdateListBox(); 2442cdf0e10cSrcweir TimerUpdate(&aUpdTimer); 2443cdf0e10cSrcweir GrabFocus(); 2444cdf0e10cSrcweir } 2445cdf0e10cSrcweir } 2446cdf0e10cSrcweir else 2447cdf0e10cSrcweir SvTreeListBox::KeyInput(rEvent); 2448cdf0e10cSrcweir 2449cdf0e10cSrcweir } 2450cdf0e10cSrcweir 2451cdf0e10cSrcweir /*************************************************************************** 2452cdf0e10cSrcweir Beschreibung: 2453cdf0e10cSrcweir ***************************************************************************/ 2454cdf0e10cSrcweir 2455cdf0e10cSrcweir 2456cdf0e10cSrcweir void SwContentTree::RequestHelp( const HelpEvent& rHEvt ) 2457cdf0e10cSrcweir { 2458cdf0e10cSrcweir sal_Bool bCallBase = sal_True; 2459cdf0e10cSrcweir if( rHEvt.GetMode() & HELPMODE_QUICK ) 2460cdf0e10cSrcweir { 2461cdf0e10cSrcweir Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() )); 2462cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry( aPos ); 2463cdf0e10cSrcweir if( pEntry ) 2464cdf0e10cSrcweir { 2465cdf0e10cSrcweir sal_uInt16 nType; 2466cdf0e10cSrcweir sal_Bool bBalloon = sal_False; 2467cdf0e10cSrcweir sal_Bool bContent = sal_False; 2468cdf0e10cSrcweir void* pUserData = pEntry->GetUserData(); 2469cdf0e10cSrcweir if(lcl_IsContentType(pEntry)) 2470cdf0e10cSrcweir nType = ((SwContentType*)pUserData)->GetType(); 2471cdf0e10cSrcweir else 2472cdf0e10cSrcweir { 2473cdf0e10cSrcweir nType = ((SwContent*)pUserData)->GetParent()->GetType(); 2474cdf0e10cSrcweir bContent = sal_True; 2475cdf0e10cSrcweir } 2476cdf0e10cSrcweir String sEntry; 2477cdf0e10cSrcweir sal_Bool bRet = sal_False; 2478cdf0e10cSrcweir if(bContent) 2479cdf0e10cSrcweir { 2480cdf0e10cSrcweir switch( nType ) 2481cdf0e10cSrcweir { 2482cdf0e10cSrcweir case CONTENT_TYPE_URLFIELD: 2483cdf0e10cSrcweir sEntry = ((SwURLFieldContent*)pUserData)->GetURL(); 2484cdf0e10cSrcweir bRet = sal_True; 2485cdf0e10cSrcweir break; 2486cdf0e10cSrcweir 2487cdf0e10cSrcweir case CONTENT_TYPE_POSTIT: 2488cdf0e10cSrcweir sEntry = ((SwPostItContent*)pUserData)->GetName(); 2489cdf0e10cSrcweir bRet = sal_True; 2490cdf0e10cSrcweir if(Help::IsBalloonHelpEnabled()) 2491cdf0e10cSrcweir bBalloon = sal_True; 2492cdf0e10cSrcweir break; 2493cdf0e10cSrcweir case CONTENT_TYPE_OUTLINE: 2494cdf0e10cSrcweir sEntry = ((SwOutlineContent*)pUserData)->GetName(); 2495cdf0e10cSrcweir bRet = sal_True; 2496cdf0e10cSrcweir break; 2497cdf0e10cSrcweir case CONTENT_TYPE_GRAPHIC: 2498cdf0e10cSrcweir sEntry = ((SwGraphicContent*)pUserData)->GetLink(); 2499cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 2500cdf0e10cSrcweir sEntry += ' '; 2501cdf0e10cSrcweir sEntry += String::CreateFromInt32( 2502cdf0e10cSrcweir ((SwGraphicContent*)pUserData)->GetYPos()); 2503cdf0e10cSrcweir #endif 2504cdf0e10cSrcweir bRet = sal_True; 2505cdf0e10cSrcweir break; 2506cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 2507cdf0e10cSrcweir case CONTENT_TYPE_TABLE: 2508cdf0e10cSrcweir case CONTENT_TYPE_FRAME: 2509cdf0e10cSrcweir sEntry = String::CreateFromInt32( 2510cdf0e10cSrcweir ((SwContent*)pUserData)->GetYPos() ); 2511cdf0e10cSrcweir bRet = sal_True; 2512cdf0e10cSrcweir break; 2513cdf0e10cSrcweir #endif 2514cdf0e10cSrcweir } 2515cdf0e10cSrcweir if(((SwContent*)pUserData)->IsInvisible()) 2516cdf0e10cSrcweir { 2517cdf0e10cSrcweir if(sEntry.Len()) 2518cdf0e10cSrcweir sEntry += C2S(", "); 2519cdf0e10cSrcweir sEntry += sInvisible; 2520cdf0e10cSrcweir bRet = sal_True; 2521cdf0e10cSrcweir } 2522cdf0e10cSrcweir } 2523cdf0e10cSrcweir else 2524cdf0e10cSrcweir { 2525cdf0e10cSrcweir sal_uInt16 nMemberCount = ((SwContentType*)pUserData)->GetMemberCount(); 2526cdf0e10cSrcweir sEntry = String::CreateFromInt32(nMemberCount); 2527cdf0e10cSrcweir sEntry += ' '; 2528cdf0e10cSrcweir sEntry += nMemberCount == 1 2529cdf0e10cSrcweir ? ((SwContentType*)pUserData)->GetSingleName() 2530cdf0e10cSrcweir : ((SwContentType*)pUserData)->GetName(); 2531cdf0e10cSrcweir bRet = sal_True; 2532cdf0e10cSrcweir } 2533cdf0e10cSrcweir if(bRet) 2534cdf0e10cSrcweir { 2535cdf0e10cSrcweir SvLBoxTab* pTab; 2536cdf0e10cSrcweir SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab ); 2537cdf0e10cSrcweir if( pItem && SV_ITEM_ID_LBOXSTRING == pItem->IsA()) 2538cdf0e10cSrcweir { 2539cdf0e10cSrcweir aPos = GetEntryPosition( pEntry ); 2540cdf0e10cSrcweir 2541cdf0e10cSrcweir aPos.X() = GetTabPos( pEntry, pTab ); 2542cdf0e10cSrcweir Size aSize( pItem->GetSize( this, pEntry ) ); 2543cdf0e10cSrcweir 2544cdf0e10cSrcweir if((aPos.X() + aSize.Width()) > GetSizePixel().Width()) 2545cdf0e10cSrcweir aSize.Width() = GetSizePixel().Width() - aPos.X(); 2546cdf0e10cSrcweir 2547cdf0e10cSrcweir aPos = OutputToScreenPixel(aPos); 2548cdf0e10cSrcweir Rectangle aItemRect( aPos, aSize ); 2549cdf0e10cSrcweir if(bBalloon) 2550cdf0e10cSrcweir { 2551cdf0e10cSrcweir aPos.X() += aSize.Width(); 2552cdf0e10cSrcweir Help::ShowBalloon( this, aPos, aItemRect, sEntry ); 2553cdf0e10cSrcweir } 2554cdf0e10cSrcweir else 2555cdf0e10cSrcweir Help::ShowQuickHelp( this, aItemRect, sEntry, 2556cdf0e10cSrcweir QUICKHELP_LEFT|QUICKHELP_VCENTER ); 2557cdf0e10cSrcweir bCallBase = sal_False; 2558cdf0e10cSrcweir } 2559cdf0e10cSrcweir } 2560cdf0e10cSrcweir else 2561cdf0e10cSrcweir { 2562cdf0e10cSrcweir Help::ShowQuickHelp( this, Rectangle(), aEmptyStr, 0 ); 2563cdf0e10cSrcweir bCallBase = sal_False; 2564cdf0e10cSrcweir } 2565cdf0e10cSrcweir } 2566cdf0e10cSrcweir } 2567cdf0e10cSrcweir if( bCallBase ) 2568cdf0e10cSrcweir Window::RequestHelp( rHEvt ); 2569cdf0e10cSrcweir } 2570cdf0e10cSrcweir 2571cdf0e10cSrcweir /*************************************************************************** 2572cdf0e10cSrcweir Beschreibung: 2573cdf0e10cSrcweir ***************************************************************************/ 2574cdf0e10cSrcweir 2575cdf0e10cSrcweir 2576cdf0e10cSrcweir void SwContentTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) 2577cdf0e10cSrcweir { 2578cdf0e10cSrcweir SvLBoxEntry* pFirst = FirstSelected(); 2579cdf0e10cSrcweir switch( nSelectedPopupEntry ) 2580cdf0e10cSrcweir { 2581cdf0e10cSrcweir //Outlinelevel 2582cdf0e10cSrcweir case 101: 2583cdf0e10cSrcweir case 102: 2584cdf0e10cSrcweir case 103: 2585cdf0e10cSrcweir case 104: 2586cdf0e10cSrcweir case 105: 2587cdf0e10cSrcweir case 106: 2588cdf0e10cSrcweir case 107: 2589cdf0e10cSrcweir case 108: 2590cdf0e10cSrcweir case 109: 2591cdf0e10cSrcweir case 110: 2592cdf0e10cSrcweir nSelectedPopupEntry -= 100; 2593cdf0e10cSrcweir if(nOutlineLevel != nSelectedPopupEntry ) 2594cdf0e10cSrcweir SetOutlineLevel((sal_Int8)nSelectedPopupEntry); 2595cdf0e10cSrcweir break; 2596cdf0e10cSrcweir case 201: 2597cdf0e10cSrcweir case 202: 2598cdf0e10cSrcweir case 203: 2599cdf0e10cSrcweir GetParentWindow()->SetRegionDropMode(nSelectedPopupEntry - 201); 2600cdf0e10cSrcweir break; 2601cdf0e10cSrcweir case 401: 2602cdf0e10cSrcweir case 402: 2603cdf0e10cSrcweir EditEntry(pFirst, nSelectedPopupEntry == 401 ? EDIT_MODE_RMV_IDX : EDIT_MODE_UPD_IDX); 2604cdf0e10cSrcweir break; 2605cdf0e10cSrcweir // Eintrag bearbeiten 2606cdf0e10cSrcweir case 403: 2607cdf0e10cSrcweir EditEntry(pFirst, EDIT_MODE_EDIT); 2608cdf0e10cSrcweir break; 2609cdf0e10cSrcweir case 404: 2610cdf0e10cSrcweir EditEntry(pFirst, EDIT_UNPROTECT_TABLE); 2611cdf0e10cSrcweir break; 2612cdf0e10cSrcweir case 405 : 2613cdf0e10cSrcweir { 2614cdf0e10cSrcweir const SwTOXBase* pBase = ((SwTOXBaseContent*)pFirst->GetUserData()) 2615cdf0e10cSrcweir ->GetTOXBase(); 2616cdf0e10cSrcweir pActiveShell->SetTOXBaseReadonly(*pBase, !pActiveShell->IsTOXBaseReadonly(*pBase)); 2617cdf0e10cSrcweir } 2618cdf0e10cSrcweir break; 2619cdf0e10cSrcweir case 4: 2620cdf0e10cSrcweir break; 2621cdf0e10cSrcweir case 501: 2622cdf0e10cSrcweir EditEntry(pFirst, EDIT_MODE_DELETE); 2623cdf0e10cSrcweir break; 2624cdf0e10cSrcweir case 502 : 2625cdf0e10cSrcweir EditEntry(pFirst, EDIT_MODE_RENAME); 2626cdf0e10cSrcweir break; 2627cdf0e10cSrcweir case 600: 2628cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->Show(); 2629cdf0e10cSrcweir break; 2630cdf0e10cSrcweir case 601: 2631cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->Hide(); 2632cdf0e10cSrcweir break; 2633cdf0e10cSrcweir case 602: 2634cdf0e10cSrcweir { 2635cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0); 2636cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->Delete(); 2637cdf0e10cSrcweir break; 2638cdf0e10cSrcweir } 2639cdf0e10cSrcweir //Anzeige 2640cdf0e10cSrcweir default: // nSelectedPopupEntry > 300 2641cdf0e10cSrcweir if(nSelectedPopupEntry > 300 && nSelectedPopupEntry < 400) 2642cdf0e10cSrcweir { 2643cdf0e10cSrcweir nSelectedPopupEntry -= 300; 2644cdf0e10cSrcweir SwView *pView = SwModule::GetFirstView(); 2645cdf0e10cSrcweir while (pView) 2646cdf0e10cSrcweir { 2647cdf0e10cSrcweir nSelectedPopupEntry --; 2648cdf0e10cSrcweir if(nSelectedPopupEntry == 0) 2649cdf0e10cSrcweir { 2650cdf0e10cSrcweir SetConstantShell(&pView->GetWrtShell()); 2651cdf0e10cSrcweir break; 2652cdf0e10cSrcweir } 2653cdf0e10cSrcweir pView = SwModule::GetNextView(pView); 2654cdf0e10cSrcweir } 2655cdf0e10cSrcweir if(nSelectedPopupEntry) 2656cdf0e10cSrcweir { 2657cdf0e10cSrcweir bViewHasChanged = bIsActive = nSelectedPopupEntry == 1; 2658cdf0e10cSrcweir bIsConstant = sal_False; 2659cdf0e10cSrcweir Display(nSelectedPopupEntry == 1); 2660cdf0e10cSrcweir } 2661cdf0e10cSrcweir } 2662cdf0e10cSrcweir } 2663cdf0e10cSrcweir GetParentWindow()->UpdateListBox(); 2664cdf0e10cSrcweir } 2665cdf0e10cSrcweir 2666cdf0e10cSrcweir /*************************************************************************** 2667cdf0e10cSrcweir Beschreibung: 2668cdf0e10cSrcweir ***************************************************************************/ 2669cdf0e10cSrcweir 2670cdf0e10cSrcweir 2671cdf0e10cSrcweir void SwContentTree::SetOutlineLevel(sal_uInt8 nSet) 2672cdf0e10cSrcweir { 2673cdf0e10cSrcweir nOutlineLevel = nSet; 2674cdf0e10cSrcweir pConfig->SetOutlineLevel( nOutlineLevel ); 2675cdf0e10cSrcweir SwContentType** ppContentT = bIsActive ? 2676cdf0e10cSrcweir &aActiveContentArr[CONTENT_TYPE_OUTLINE] : 2677cdf0e10cSrcweir &aHiddenContentArr[CONTENT_TYPE_OUTLINE]; 2678cdf0e10cSrcweir if(*ppContentT) 2679cdf0e10cSrcweir { 2680cdf0e10cSrcweir (*ppContentT)->SetOutlineLevel(nOutlineLevel); 2681cdf0e10cSrcweir (*ppContentT)->Init(); 2682cdf0e10cSrcweir } 2683cdf0e10cSrcweir Display(bIsActive); 2684cdf0e10cSrcweir } 2685cdf0e10cSrcweir 2686cdf0e10cSrcweir /*************************************************************************** 2687cdf0e10cSrcweir Beschreibung: Moduswechsel: gedropptes Doc anzeigen 2688cdf0e10cSrcweir ***************************************************************************/ 2689cdf0e10cSrcweir 2690cdf0e10cSrcweir 2691cdf0e10cSrcweir void SwContentTree::ShowHiddenShell() 2692cdf0e10cSrcweir { 2693cdf0e10cSrcweir if(pHiddenShell) 2694cdf0e10cSrcweir { 2695cdf0e10cSrcweir bIsConstant = sal_False; 2696cdf0e10cSrcweir bIsActive = sal_False; 2697cdf0e10cSrcweir Display(sal_False); 2698cdf0e10cSrcweir } 2699cdf0e10cSrcweir } 2700cdf0e10cSrcweir 2701cdf0e10cSrcweir /*************************************************************************** 2702cdf0e10cSrcweir Beschreibung: Moduswechsel: aktive Sicht anzeigen 2703cdf0e10cSrcweir ***************************************************************************/ 2704cdf0e10cSrcweir 2705cdf0e10cSrcweir 2706cdf0e10cSrcweir void SwContentTree::ShowActualView() 2707cdf0e10cSrcweir { 2708cdf0e10cSrcweir bIsActive = sal_True; 2709cdf0e10cSrcweir bIsConstant = sal_False; 2710cdf0e10cSrcweir Display(sal_True); 2711cdf0e10cSrcweir GetParentWindow()->UpdateListBox(); 2712cdf0e10cSrcweir } 2713cdf0e10cSrcweir 2714cdf0e10cSrcweir /*-----------------20.11.96 13.34------------------- 2715cdf0e10cSrcweir Beschreibung: Hier sollen die Buttons zum Verschieben von 2716cdf0e10cSrcweir Outlines en-/disabled werden 2717cdf0e10cSrcweir --------------------------------------------------*/ 2718cdf0e10cSrcweir 2719cdf0e10cSrcweir sal_Bool SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) 2720cdf0e10cSrcweir { 2721cdf0e10cSrcweir if(!pEntry) 2722cdf0e10cSrcweir return sal_False; 2723cdf0e10cSrcweir sal_Bool bEnable = sal_False; 2724cdf0e10cSrcweir SvLBoxEntry* pParentEntry = GetParent(pEntry); 2725cdf0e10cSrcweir if(!bIsLastReadOnly && (!IsVisible() || 2726cdf0e10cSrcweir ((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry) || 2727cdf0e10cSrcweir (lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)))) 2728cdf0e10cSrcweir bEnable = sal_True; 2729cdf0e10cSrcweir SwNavigationPI* pNavi = GetParentWindow(); 2730cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable); 2731cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable); 2732cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable); 2733cdf0e10cSrcweir pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable); 2734cdf0e10cSrcweir 2735cdf0e10cSrcweir return SvTreeListBox::Select(pEntry, bSelect); 2736cdf0e10cSrcweir } 2737cdf0e10cSrcweir 2738cdf0e10cSrcweir /*-----------------27.11.96 12.56------------------- 2739cdf0e10cSrcweir 2740cdf0e10cSrcweir --------------------------------------------------*/ 2741cdf0e10cSrcweir 2742cdf0e10cSrcweir void SwContentTree::SetRootType(sal_uInt16 nType) 2743cdf0e10cSrcweir { 2744cdf0e10cSrcweir nRootType = nType; 2745cdf0e10cSrcweir bIsRoot = sal_True; 2746cdf0e10cSrcweir pConfig->SetRootType( nRootType ); 2747cdf0e10cSrcweir } 2748cdf0e10cSrcweir 2749cdf0e10cSrcweir /*-----------------10.01.97 12.19------------------- 2750cdf0e10cSrcweir 2751cdf0e10cSrcweir --------------------------------------------------*/ 2752cdf0e10cSrcweir 2753cdf0e10cSrcweir void SwContentType::RemoveNewline(String& rEntry) 2754cdf0e10cSrcweir { 2755cdf0e10cSrcweir sal_Unicode* pStr = rEntry.GetBufferAccess(); 2756cdf0e10cSrcweir for(xub_StrLen i = rEntry.Len(); i; --i, ++pStr ) 2757cdf0e10cSrcweir { 2758cdf0e10cSrcweir if( *pStr == 10 || *pStr == 13 ) 2759cdf0e10cSrcweir *pStr = 0x20; 2760cdf0e10cSrcweir } 2761cdf0e10cSrcweir } 2762cdf0e10cSrcweir 2763cdf0e10cSrcweir /*-----------------14.01.97 16.38------------------- 2764cdf0e10cSrcweir 2765cdf0e10cSrcweir --------------------------------------------------*/ 2766cdf0e10cSrcweir 2767cdf0e10cSrcweir void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode) 2768cdf0e10cSrcweir { 2769cdf0e10cSrcweir SwContent* pCnt = (SwContent*)pEntry->GetUserData(); 2770cdf0e10cSrcweir GotoContent(pCnt); 2771cdf0e10cSrcweir sal_uInt16 nType = pCnt->GetParent()->GetType(); 2772cdf0e10cSrcweir sal_uInt16 nSlot = 0; 2773cdf0e10cSrcweir 2774cdf0e10cSrcweir uno::Reference< container::XNameAccess > xNameAccess, xSecond, xThird; 2775cdf0e10cSrcweir switch(nType) 2776cdf0e10cSrcweir { 2777cdf0e10cSrcweir case CONTENT_TYPE_TABLE : 2778cdf0e10cSrcweir if(nMode == EDIT_UNPROTECT_TABLE) 2779cdf0e10cSrcweir { 2780cdf0e10cSrcweir pActiveShell->GetView().GetDocShell()-> 2781cdf0e10cSrcweir GetDoc()->UnProtectCells( pCnt->GetName()); 2782cdf0e10cSrcweir } 2783cdf0e10cSrcweir else if(nMode == EDIT_MODE_DELETE) 2784cdf0e10cSrcweir { 2785cdf0e10cSrcweir pActiveShell->StartAction(); 2786cdf0e10cSrcweir String sTable = SW_RES(STR_TABLE_NAME); 2787cdf0e10cSrcweir SwRewriter aRewriterTableName; 2788cdf0e10cSrcweir aRewriterTableName.AddRule(UNDO_ARG1, SW_RES(STR_START_QUOTE)); 2789cdf0e10cSrcweir aRewriterTableName.AddRule(UNDO_ARG2, pCnt->GetName()); 2790cdf0e10cSrcweir aRewriterTableName.AddRule(UNDO_ARG3, SW_RES(STR_END_QUOTE)); 2791cdf0e10cSrcweir sTable = aRewriterTableName.Apply(sTable); 2792cdf0e10cSrcweir 2793cdf0e10cSrcweir SwRewriter aRewriter; 2794cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, sTable); 2795cdf0e10cSrcweir pActiveShell->StartUndo(UNDO_DELETE, &aRewriter); 2796cdf0e10cSrcweir pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL); 2797cdf0e10cSrcweir pActiveShell->DeleteRow(); 2798cdf0e10cSrcweir pActiveShell->EndUndo(); 2799cdf0e10cSrcweir pActiveShell->EndAction(); 2800cdf0e10cSrcweir } 2801cdf0e10cSrcweir else if(nMode == EDIT_MODE_RENAME) 2802cdf0e10cSrcweir { 2803cdf0e10cSrcweir uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel(); 2804cdf0e10cSrcweir uno::Reference< text::XTextTablesSupplier > xTables(xModel, uno::UNO_QUERY); 2805cdf0e10cSrcweir xNameAccess = xTables->getTextTables(); 2806cdf0e10cSrcweir } 2807cdf0e10cSrcweir else 2808cdf0e10cSrcweir nSlot = FN_FORMAT_TABLE_DLG; 2809cdf0e10cSrcweir break; 2810cdf0e10cSrcweir 2811cdf0e10cSrcweir case CONTENT_TYPE_GRAPHIC : 2812cdf0e10cSrcweir if(nMode == EDIT_MODE_DELETE) 2813cdf0e10cSrcweir { 2814cdf0e10cSrcweir pActiveShell->DelRight(); 2815cdf0e10cSrcweir } 2816cdf0e10cSrcweir else if(nMode == EDIT_MODE_RENAME) 2817cdf0e10cSrcweir { 2818cdf0e10cSrcweir uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel(); 2819cdf0e10cSrcweir uno::Reference< text::XTextGraphicObjectsSupplier > xGraphics(xModel, uno::UNO_QUERY); 2820cdf0e10cSrcweir xNameAccess = xGraphics->getGraphicObjects(); 2821cdf0e10cSrcweir uno::Reference< text::XTextFramesSupplier > xFrms(xModel, uno::UNO_QUERY); 2822cdf0e10cSrcweir xSecond = xFrms->getTextFrames(); 2823cdf0e10cSrcweir uno::Reference< text::XTextEmbeddedObjectsSupplier > xObjs(xModel, uno::UNO_QUERY); 2824cdf0e10cSrcweir xThird = xObjs->getEmbeddedObjects(); 2825cdf0e10cSrcweir } 2826cdf0e10cSrcweir else 2827cdf0e10cSrcweir nSlot = FN_FORMAT_GRAFIC_DLG; 2828cdf0e10cSrcweir break; 2829cdf0e10cSrcweir 2830cdf0e10cSrcweir case CONTENT_TYPE_FRAME : 2831cdf0e10cSrcweir case CONTENT_TYPE_OLE : 2832cdf0e10cSrcweir if(nMode == EDIT_MODE_DELETE) 2833cdf0e10cSrcweir { 2834cdf0e10cSrcweir pActiveShell->DelRight(); 2835cdf0e10cSrcweir } 2836cdf0e10cSrcweir else if(nMode == EDIT_MODE_RENAME) 2837cdf0e10cSrcweir { 2838cdf0e10cSrcweir uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel(); 2839cdf0e10cSrcweir uno::Reference< text::XTextFramesSupplier > xFrms(xModel, uno::UNO_QUERY); 2840cdf0e10cSrcweir uno::Reference< text::XTextEmbeddedObjectsSupplier > xObjs(xModel, uno::UNO_QUERY); 2841cdf0e10cSrcweir if(CONTENT_TYPE_FRAME == nType) 2842cdf0e10cSrcweir { 2843cdf0e10cSrcweir xNameAccess = xFrms->getTextFrames(); 2844cdf0e10cSrcweir xSecond = xObjs->getEmbeddedObjects(); 2845cdf0e10cSrcweir } 2846cdf0e10cSrcweir else 2847cdf0e10cSrcweir { 2848cdf0e10cSrcweir xNameAccess = xObjs->getEmbeddedObjects(); 2849cdf0e10cSrcweir xSecond = xFrms->getTextFrames(); 2850cdf0e10cSrcweir } 2851cdf0e10cSrcweir uno::Reference< text::XTextGraphicObjectsSupplier > xGraphics(xModel, uno::UNO_QUERY); 2852cdf0e10cSrcweir xThird = xGraphics->getGraphicObjects(); 2853cdf0e10cSrcweir } 2854cdf0e10cSrcweir else 2855cdf0e10cSrcweir nSlot = FN_FORMAT_FRAME_DLG; 2856cdf0e10cSrcweir break; 2857cdf0e10cSrcweir case CONTENT_TYPE_BOOKMARK : 2858cdf0e10cSrcweir if(nMode == EDIT_MODE_DELETE) 2859cdf0e10cSrcweir { 2860cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = pActiveShell->getIDocumentMarkAccess(); 2861cdf0e10cSrcweir pMarkAccess->deleteMark( pMarkAccess->findMark(pCnt->GetName()) ); 2862cdf0e10cSrcweir } 2863cdf0e10cSrcweir else if(nMode == EDIT_MODE_RENAME) 2864cdf0e10cSrcweir { 2865cdf0e10cSrcweir uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel(); 2866cdf0e10cSrcweir uno::Reference< text::XBookmarksSupplier > xBkms(xModel, uno::UNO_QUERY); 2867cdf0e10cSrcweir xNameAccess = xBkms->getBookmarks(); 2868cdf0e10cSrcweir } 2869cdf0e10cSrcweir else 2870cdf0e10cSrcweir nSlot = FN_INSERT_BOOKMARK; 2871cdf0e10cSrcweir break; 2872cdf0e10cSrcweir 2873cdf0e10cSrcweir case CONTENT_TYPE_REGION : 2874cdf0e10cSrcweir if(nMode == EDIT_MODE_RENAME) 2875cdf0e10cSrcweir { 2876cdf0e10cSrcweir uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel(); 2877cdf0e10cSrcweir uno::Reference< text::XTextSectionsSupplier > xSects(xModel, uno::UNO_QUERY); 2878cdf0e10cSrcweir xNameAccess = xSects->getTextSections(); 2879cdf0e10cSrcweir } 2880cdf0e10cSrcweir else 2881cdf0e10cSrcweir nSlot = FN_EDIT_REGION; 2882cdf0e10cSrcweir break; 2883cdf0e10cSrcweir 2884cdf0e10cSrcweir case CONTENT_TYPE_URLFIELD: 2885cdf0e10cSrcweir nSlot = FN_EDIT_HYPERLINK; 2886cdf0e10cSrcweir break; 2887cdf0e10cSrcweir case CONTENT_TYPE_REFERENCE: 2888cdf0e10cSrcweir nSlot = FN_EDIT_FIELD; 2889cdf0e10cSrcweir break; 2890cdf0e10cSrcweir 2891cdf0e10cSrcweir case CONTENT_TYPE_POSTIT: 2892cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell(); 2893cdf0e10cSrcweir if(nMode == EDIT_MODE_DELETE) 2894cdf0e10cSrcweir { 2895cdf0e10cSrcweir if (((SwPostItContent*)pCnt)->IsPostIt()) 2896cdf0e10cSrcweir { 2897cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0); 2898cdf0e10cSrcweir pActiveShell->DelRight(); 2899cdf0e10cSrcweir } 2900cdf0e10cSrcweir /* 2901cdf0e10cSrcweir // this code can be used once we want redline comments in the margin 2902cdf0e10cSrcweir else 2903cdf0e10cSrcweir { 2904cdf0e10cSrcweir SwMarginWin* pComment = pActiveShell->GetView().GetPostItMgr()->GetPostIt(((SwPostItContent*)pCnt)->GetRedline()); 2905cdf0e10cSrcweir if (pComment) 2906cdf0e10cSrcweir pComment->Delete(); 2907cdf0e10cSrcweir } 2908cdf0e10cSrcweir */ 2909cdf0e10cSrcweir } 2910cdf0e10cSrcweir else 2911cdf0e10cSrcweir { 2912cdf0e10cSrcweir if (((SwPostItContent*)pCnt)->IsPostIt()) 2913cdf0e10cSrcweir nSlot = FN_POSTIT; 2914cdf0e10cSrcweir else 2915cdf0e10cSrcweir nSlot = FN_REDLINE_COMMENT; 2916cdf0e10cSrcweir } 2917cdf0e10cSrcweir break; 2918cdf0e10cSrcweir case CONTENT_TYPE_INDEX: 2919cdf0e10cSrcweir { 2920cdf0e10cSrcweir const SwTOXBase* pBase = ((SwTOXBaseContent*)pCnt)->GetTOXBase(); 2921cdf0e10cSrcweir switch(nMode) 2922cdf0e10cSrcweir { 2923cdf0e10cSrcweir case EDIT_MODE_EDIT: 2924cdf0e10cSrcweir if(pBase) 2925cdf0e10cSrcweir { 2926cdf0e10cSrcweir SwPtrItem aPtrItem( FN_INSERT_MULTI_TOX, (void*)pBase); 2927cdf0e10cSrcweir pActiveShell->GetView().GetViewFrame()-> 2928cdf0e10cSrcweir GetDispatcher()->Execute(FN_INSERT_MULTI_TOX, 2929cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON, &aPtrItem, 0L); 2930cdf0e10cSrcweir 2931cdf0e10cSrcweir } 2932cdf0e10cSrcweir break; 2933cdf0e10cSrcweir case EDIT_MODE_RMV_IDX: 2934cdf0e10cSrcweir case EDIT_MODE_DELETE: 2935cdf0e10cSrcweir { 2936cdf0e10cSrcweir if( pBase ) 2937cdf0e10cSrcweir pActiveShell->DeleteTOX(*pBase, EDIT_MODE_DELETE == nMode); 2938cdf0e10cSrcweir } 2939cdf0e10cSrcweir break; 2940cdf0e10cSrcweir case EDIT_MODE_UPD_IDX: 2941cdf0e10cSrcweir case EDIT_MODE_RENAME: 2942cdf0e10cSrcweir { 2943cdf0e10cSrcweir Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel(); 2944cdf0e10cSrcweir Reference< XDocumentIndexesSupplier > xIndexes(xModel, UNO_QUERY); 2945cdf0e10cSrcweir Reference< XIndexAccess> xIdxAcc(xIndexes->getDocumentIndexes()); 2946cdf0e10cSrcweir Reference< XNameAccess >xLocalNameAccess(xIdxAcc, UNO_QUERY); 2947cdf0e10cSrcweir if(EDIT_MODE_RENAME == nMode) 2948cdf0e10cSrcweir xNameAccess = xLocalNameAccess; 2949cdf0e10cSrcweir else if(xLocalNameAccess.is() && xLocalNameAccess->hasByName(pBase->GetTOXName())) 2950cdf0e10cSrcweir { 2951cdf0e10cSrcweir Any aIdx = xLocalNameAccess->getByName(pBase->GetTOXName()); 2952cdf0e10cSrcweir Reference< XDocumentIndex> xIdx; 2953cdf0e10cSrcweir if(aIdx >>= xIdx) 2954cdf0e10cSrcweir xIdx->update(); 2955cdf0e10cSrcweir } 2956cdf0e10cSrcweir } 2957cdf0e10cSrcweir break; 2958cdf0e10cSrcweir } 2959cdf0e10cSrcweir } 2960cdf0e10cSrcweir break; 2961cdf0e10cSrcweir case CONTENT_TYPE_DRAWOBJECT : 2962cdf0e10cSrcweir if(EDIT_MODE_DELETE == nMode) 2963cdf0e10cSrcweir nSlot = SID_DELETE; 2964cdf0e10cSrcweir break; 2965cdf0e10cSrcweir } 2966cdf0e10cSrcweir if(nSlot) 2967cdf0e10cSrcweir pActiveShell->GetView().GetViewFrame()-> 2968cdf0e10cSrcweir GetDispatcher()->Execute(nSlot, SFX_CALLMODE_ASYNCHRON); 2969cdf0e10cSrcweir else if(xNameAccess.is()) 2970cdf0e10cSrcweir { 2971cdf0e10cSrcweir uno::Any aObj = xNameAccess->getByName(pCnt->GetName()); 2972cdf0e10cSrcweir uno::Reference< uno::XInterface > xTmp; 2973cdf0e10cSrcweir aObj >>= xTmp; 2974cdf0e10cSrcweir uno::Reference< container::XNamed > xNamed(xTmp, uno::UNO_QUERY); 2975cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 2976cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 2977cdf0e10cSrcweir 2978cdf0e10cSrcweir AbstractSwRenameXNamedDlg* pDlg = pFact->CreateSwRenameXNamedDlg( this, xNamed, xNameAccess, DLG_RENAME_XNAMED ); 2979cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 2980cdf0e10cSrcweir if(xSecond.is()) 2981cdf0e10cSrcweir pDlg->SetAlternativeAccess( xSecond, xThird); 2982cdf0e10cSrcweir 2983cdf0e10cSrcweir String sForbiddenChars; 2984cdf0e10cSrcweir if(CONTENT_TYPE_BOOKMARK == nType) 2985cdf0e10cSrcweir { 2986cdf0e10cSrcweir sForbiddenChars = C2S("/\\@:*?\";,.#"); 2987cdf0e10cSrcweir } 2988cdf0e10cSrcweir else if(CONTENT_TYPE_TABLE == nType) 2989cdf0e10cSrcweir { 2990cdf0e10cSrcweir sForbiddenChars = C2S(" .<>"); 2991cdf0e10cSrcweir } 2992cdf0e10cSrcweir pDlg->SetForbiddenChars(sForbiddenChars); 2993cdf0e10cSrcweir pDlg->Execute(); 2994cdf0e10cSrcweir delete pDlg; 2995cdf0e10cSrcweir } 2996cdf0e10cSrcweir } 2997cdf0e10cSrcweir 2998cdf0e10cSrcweir /*-----------------14.01.97 16.53------------------- 2999cdf0e10cSrcweir 3000cdf0e10cSrcweir --------------------------------------------------*/ 3001cdf0e10cSrcweir 3002cdf0e10cSrcweir void SwContentTree::GotoContent(SwContent* pCnt) 3003cdf0e10cSrcweir { 3004cdf0e10cSrcweir pActiveShell->EnterStdMode(); 3005cdf0e10cSrcweir 3006cdf0e10cSrcweir sal_Bool bSel = sal_False; 3007cdf0e10cSrcweir sal_uInt16 nJumpType = pCnt->GetParent()->GetType(); 3008cdf0e10cSrcweir switch(nJumpType) 3009cdf0e10cSrcweir { 3010cdf0e10cSrcweir case CONTENT_TYPE_OUTLINE : 3011cdf0e10cSrcweir { 3012cdf0e10cSrcweir pActiveShell->GotoOutline(((SwOutlineContent*)pCnt)->GetPos()); 3013cdf0e10cSrcweir } 3014cdf0e10cSrcweir break; 3015cdf0e10cSrcweir case CONTENT_TYPE_TABLE : 3016cdf0e10cSrcweir { 3017cdf0e10cSrcweir pActiveShell->GotoTable(pCnt->GetName()); 3018cdf0e10cSrcweir } 3019cdf0e10cSrcweir break; 3020cdf0e10cSrcweir case CONTENT_TYPE_FRAME : 3021cdf0e10cSrcweir case CONTENT_TYPE_GRAPHIC : 3022cdf0e10cSrcweir case CONTENT_TYPE_OLE : 3023cdf0e10cSrcweir { 3024cdf0e10cSrcweir if(pActiveShell->GotoFly(pCnt->GetName())) 3025cdf0e10cSrcweir bSel = sal_True; 3026cdf0e10cSrcweir } 3027cdf0e10cSrcweir break; 3028cdf0e10cSrcweir case CONTENT_TYPE_BOOKMARK: 3029cdf0e10cSrcweir { 3030cdf0e10cSrcweir pActiveShell->GotoMark(pCnt->GetName()); 3031cdf0e10cSrcweir } 3032cdf0e10cSrcweir break; 3033cdf0e10cSrcweir case CONTENT_TYPE_REGION : 3034cdf0e10cSrcweir { 3035cdf0e10cSrcweir pActiveShell->GotoRegion(pCnt->GetName()); 3036cdf0e10cSrcweir } 3037cdf0e10cSrcweir break; 3038cdf0e10cSrcweir case CONTENT_TYPE_URLFIELD: 3039cdf0e10cSrcweir { 3040cdf0e10cSrcweir if(pActiveShell->GotoINetAttr( 3041cdf0e10cSrcweir *((SwURLFieldContent*)pCnt)->GetINetAttr() )) 3042cdf0e10cSrcweir { 3043cdf0e10cSrcweir pActiveShell->Right( CRSR_SKIP_CHARS, sal_True, 1, sal_False); 3044cdf0e10cSrcweir pActiveShell->SwCrsrShell::SelectTxtAttr( RES_TXTATR_INETFMT, sal_True ); 3045cdf0e10cSrcweir } 3046cdf0e10cSrcweir 3047cdf0e10cSrcweir } 3048cdf0e10cSrcweir break; 3049cdf0e10cSrcweir case CONTENT_TYPE_REFERENCE: 3050cdf0e10cSrcweir { 3051cdf0e10cSrcweir pActiveShell->GotoRefMark(pCnt->GetName()); 3052cdf0e10cSrcweir } 3053cdf0e10cSrcweir break; 3054cdf0e10cSrcweir case CONTENT_TYPE_INDEX: 3055cdf0e10cSrcweir { 3056cdf0e10cSrcweir if (!pActiveShell->GotoNextTOXBase(&pCnt->GetName())) 3057cdf0e10cSrcweir pActiveShell->GotoPrevTOXBase(&pCnt->GetName()); 3058cdf0e10cSrcweir } 3059cdf0e10cSrcweir break; 3060cdf0e10cSrcweir case CONTENT_TYPE_POSTIT: 3061cdf0e10cSrcweir pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell(); 3062cdf0e10cSrcweir if (((SwPostItContent*)pCnt)->IsPostIt()) 3063cdf0e10cSrcweir pActiveShell->GotoFld(*((SwPostItContent*)pCnt)->GetPostIt()); 3064cdf0e10cSrcweir else 3065cdf0e10cSrcweir pActiveShell->GetView().GetDocShell()->GetWrtShell()->GotoRedline( 3066cdf0e10cSrcweir pActiveShell->GetView().GetDocShell()->GetWrtShell()->FindRedlineOfData(((SwPostItContent*)pCnt)->GetRedline()->GetRedlineData())); 3067cdf0e10cSrcweir 3068cdf0e10cSrcweir break; 3069cdf0e10cSrcweir case CONTENT_TYPE_DRAWOBJECT: 3070cdf0e10cSrcweir { 3071cdf0e10cSrcweir SdrView* pDrawView = pActiveShell->GetDrawView(); 3072cdf0e10cSrcweir if (pDrawView) 3073cdf0e10cSrcweir { 3074cdf0e10cSrcweir pDrawView->SdrEndTextEdit(); 3075cdf0e10cSrcweir pDrawView->UnmarkAll(); 3076cdf0e10cSrcweir SdrModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel(); 3077cdf0e10cSrcweir SdrPage* pPage = _pModel->GetPage(0); 3078cdf0e10cSrcweir sal_uInt32 nCount = pPage->GetObjCount(); 3079cdf0e10cSrcweir for( sal_uInt32 i=0; i< nCount; i++ ) 3080cdf0e10cSrcweir { 3081cdf0e10cSrcweir SdrObject* pTemp = pPage->GetObj(i); 3082cdf0e10cSrcweir // --> OD 2006-03-09 #i51726# - all drawing objects can be named now 3083cdf0e10cSrcweir // if(pTemp->ISA(SdrObjGroup) && pTemp->GetName() == pCnt->GetName()) 3084cdf0e10cSrcweir if ( pTemp->GetName() == pCnt->GetName() ) 3085cdf0e10cSrcweir // <-- 3086cdf0e10cSrcweir { 3087cdf0e10cSrcweir SdrPageView* pPV = pDrawView->GetSdrPageView(); 3088cdf0e10cSrcweir if( pPV ) 3089cdf0e10cSrcweir { 3090cdf0e10cSrcweir pDrawView->MarkObj( pTemp, pPV ); 3091cdf0e10cSrcweir } 3092cdf0e10cSrcweir } 3093cdf0e10cSrcweir } 3094cdf0e10cSrcweir } 3095cdf0e10cSrcweir } 3096cdf0e10cSrcweir break; 3097cdf0e10cSrcweir } 3098cdf0e10cSrcweir if(bSel) 3099cdf0e10cSrcweir { 3100cdf0e10cSrcweir pActiveShell->HideCrsr(); 3101cdf0e10cSrcweir pActiveShell->EnterSelFrmMode(); 3102cdf0e10cSrcweir } 3103cdf0e10cSrcweir SwView& rView = pActiveShell->GetView(); 3104cdf0e10cSrcweir rView.StopShellTimer(); 3105cdf0e10cSrcweir rView.GetPostItMgr()->SetActiveSidebarWin(0); 3106cdf0e10cSrcweir rView.GetEditWin().GrabFocus(); 3107cdf0e10cSrcweir } 3108cdf0e10cSrcweir /*-----------------06.02.97 19.14------------------- 3109cdf0e10cSrcweir Jetzt nochtdie passende text::Bookmark 3110cdf0e10cSrcweir --------------------------------------------------*/ 3111cdf0e10cSrcweir 3112cdf0e10cSrcweir NaviContentBookmark::NaviContentBookmark() 3113cdf0e10cSrcweir : 3114cdf0e10cSrcweir nDocSh(0), 3115cdf0e10cSrcweir nDefDrag( REGION_MODE_NONE ) 3116cdf0e10cSrcweir { 3117cdf0e10cSrcweir } 3118cdf0e10cSrcweir 3119cdf0e10cSrcweir /*-----------------06.02.97 20.12------------------- 3120cdf0e10cSrcweir 3121cdf0e10cSrcweir --------------------------------------------------*/ 3122cdf0e10cSrcweir 3123cdf0e10cSrcweir NaviContentBookmark::NaviContentBookmark( const String &rUrl, 3124cdf0e10cSrcweir const String& rDesc, 3125cdf0e10cSrcweir sal_uInt16 nDragType, 3126cdf0e10cSrcweir const SwDocShell* pDocSh ) : 3127cdf0e10cSrcweir aUrl( rUrl ), 3128cdf0e10cSrcweir aDescr(rDesc), 3129cdf0e10cSrcweir nDocSh((long)pDocSh), 3130cdf0e10cSrcweir nDefDrag( nDragType ) 3131cdf0e10cSrcweir { 3132cdf0e10cSrcweir } 3133cdf0e10cSrcweir 3134cdf0e10cSrcweir void NaviContentBookmark::Copy( TransferDataContainer& rData ) const 3135cdf0e10cSrcweir { 3136cdf0e10cSrcweir rtl_TextEncoding eSysCSet = gsl_getSystemTextEncoding(); 3137cdf0e10cSrcweir 3138cdf0e10cSrcweir ByteString sStr( aUrl, eSysCSet ); 3139cdf0e10cSrcweir sStr += static_cast< char >(NAVI_BOOKMARK_DELIM); 3140cdf0e10cSrcweir sStr += ByteString( aDescr, eSysCSet ); 3141cdf0e10cSrcweir sStr += static_cast< char >(NAVI_BOOKMARK_DELIM); 3142cdf0e10cSrcweir sStr += ByteString::CreateFromInt32( nDefDrag ); 3143cdf0e10cSrcweir sStr += static_cast< char >(NAVI_BOOKMARK_DELIM); 3144cdf0e10cSrcweir sStr += ByteString::CreateFromInt32( nDocSh ); 3145cdf0e10cSrcweir rData.CopyByteString( SOT_FORMATSTR_ID_SONLK, sStr ); 3146cdf0e10cSrcweir } 3147cdf0e10cSrcweir 3148cdf0e10cSrcweir sal_Bool NaviContentBookmark::Paste( TransferableDataHelper& rData ) 3149cdf0e10cSrcweir { 3150cdf0e10cSrcweir String sStr; 3151cdf0e10cSrcweir sal_Bool bRet = rData.GetString( SOT_FORMATSTR_ID_SONLK, sStr ); 3152cdf0e10cSrcweir if( bRet ) 3153cdf0e10cSrcweir { 3154cdf0e10cSrcweir xub_StrLen nPos = 0; 3155cdf0e10cSrcweir aUrl = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ); 3156cdf0e10cSrcweir aDescr = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ); 3157cdf0e10cSrcweir nDefDrag= (sal_uInt16)sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32(); 3158cdf0e10cSrcweir nDocSh = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32(); 3159cdf0e10cSrcweir } 3160cdf0e10cSrcweir return bRet; 3161cdf0e10cSrcweir } 3162cdf0e10cSrcweir 3163cdf0e10cSrcweir 3164cdf0e10cSrcweir /* -----------------------------09.12.99 13:50-------------------------------- 3165cdf0e10cSrcweir 3166cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3167cdf0e10cSrcweir class SwContentLBoxString : public SvLBoxString 3168cdf0e10cSrcweir { 3169cdf0e10cSrcweir public: 3170cdf0e10cSrcweir SwContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, 3171cdf0e10cSrcweir const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {} 3172cdf0e10cSrcweir 3173cdf0e10cSrcweir virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, 3174cdf0e10cSrcweir SvLBoxEntry* pEntry); 3175cdf0e10cSrcweir }; 3176cdf0e10cSrcweir 3177cdf0e10cSrcweir /* -----------------------------09.12.99 13:49-------------------------------- 3178cdf0e10cSrcweir 3179cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3180cdf0e10cSrcweir void SwContentTree::InitEntry(SvLBoxEntry* pEntry, 3181cdf0e10cSrcweir const XubString& rStr ,const Image& rImg1,const Image& rImg2, 3182cdf0e10cSrcweir SvLBoxButtonKind eButtonKind) 3183cdf0e10cSrcweir { 3184cdf0e10cSrcweir sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" 3185cdf0e10cSrcweir SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); 3186cdf0e10cSrcweir SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); 3187cdf0e10cSrcweir SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, pCol->GetText() ); 3188cdf0e10cSrcweir pEntry->ReplaceItem( pStr, nColToHilite ); 3189cdf0e10cSrcweir } 3190cdf0e10cSrcweir /* -----------------------------09.12.99 13:49-------------------------------- 3191cdf0e10cSrcweir 3192cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3193cdf0e10cSrcweir void SwContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, 3194cdf0e10cSrcweir SvLBoxEntry* pEntry ) 3195cdf0e10cSrcweir { 3196cdf0e10cSrcweir if(lcl_IsContent(pEntry) && 3197cdf0e10cSrcweir ((SwContent *)pEntry->GetUserData())->IsInvisible()) 3198cdf0e10cSrcweir { 3199cdf0e10cSrcweir //* pCont = (SwContent*)pEntry->GetUserData(); 3200cdf0e10cSrcweir Font aOldFont( rDev.GetFont()); 3201cdf0e10cSrcweir Font aFont(aOldFont); 3202cdf0e10cSrcweir Color aCol( COL_LIGHTGRAY ); 3203cdf0e10cSrcweir aFont.SetColor( aCol ); 3204cdf0e10cSrcweir rDev.SetFont( aFont ); 3205cdf0e10cSrcweir rDev.DrawText( rPos, GetText() ); 3206cdf0e10cSrcweir rDev.SetFont( aOldFont ); 3207cdf0e10cSrcweir } 3208cdf0e10cSrcweir else 3209cdf0e10cSrcweir SvLBoxString::Paint( rPos, rDev, nFlags, pEntry); 3210cdf0e10cSrcweir } 3211cdf0e10cSrcweir /* -----------------------------06.05.2002 10:20------------------------------ 3212cdf0e10cSrcweir 3213cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3214cdf0e10cSrcweir void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt ) 3215cdf0e10cSrcweir { 3216cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 3217cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 3218cdf0e10cSrcweir { 3219cdf0e10cSrcweir sal_uInt16 nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; 3220cdf0e10cSrcweir aEntryImages = ImageList(SW_RES(nResId)); 3221cdf0e10cSrcweir FindActiveTypeAndRemoveUserData(); 3222cdf0e10cSrcweir Display(sal_True); 3223cdf0e10cSrcweir } 3224cdf0e10cSrcweir SvTreeListBox::DataChanged( rDCEvt ); 3225cdf0e10cSrcweir } 3226cdf0e10cSrcweir 3227cdf0e10cSrcweir 3228