LCOV - code coverage report
Current view: top level - sw/source/ui/utlui - content.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1644 0.0 %
Date: 2012-08-25 Functions: 0 80 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2862 0.0 %

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

Generated by: LCOV version 1.10