LCOV - code coverage report
Current view: top level - sw/source/core/doc - docdde.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 58 188 30.9 %
Date: 2012-08-25 Functions: 6 9 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 143 808 17.7 %

           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 <stdlib.h>
      30                 :            : 
      31                 :            : #include <vcl/svapp.hxx>
      32                 :            : #include <tools/urlobj.hxx>
      33                 :            : 
      34                 :            : #include <sfx2/linkmgr.hxx>         // LinkManager
      35                 :            : #include <unotools/charclass.hxx>
      36                 :            : #include <fmtcntnt.hxx>
      37                 :            : #include <doc.hxx>
      38                 :            : #include <swserv.hxx>           // for server functionality
      39                 :            : #include <IMark.hxx>
      40                 :            : #include <bookmrk.hxx>
      41                 :            : #include <section.hxx>          // for SwSectionFmt
      42                 :            : #include <swtable.hxx>          // for SwTable
      43                 :            : #include <node.hxx>
      44                 :            : #include <ndtxt.hxx>
      45                 :            : #include <pam.hxx>
      46                 :            : #include <docary.hxx>
      47                 :            : #include <MarkManager.hxx>
      48                 :            : #include <boost/foreach.hpp>
      49                 :            : 
      50                 :            : using namespace ::com::sun::star;
      51                 :            : 
      52                 :            : namespace
      53                 :            : {
      54                 :            : 
      55                 :         48 :     static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const rtl::OUString& rName, bool bCaseSensitive)
      56                 :            :     {
      57                 :            :         //Iterating over all bookmarks, checking DdeBookmarks
      58 [ +  + ][ +  - ]:         48 :         const ::rtl::OUString sNameLc = bCaseSensitive ? rName : GetAppCharClass().lowercase(rName);
                 [ +  - ]
      59 [ +  - ][ #  # ]:         96 :         for(IDocumentMarkAccess::const_iterator_t ppMark = rMarkAccess.getMarksBegin();
         [ +  - ][ -  + ]
      60         [ +  - ]:         48 :             ppMark != rMarkAccess.getMarksEnd();
      61                 :            :             ppMark++)
      62                 :            :         {
      63 [ #  # ][ #  # ]:          0 :             if (::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get()))
      64                 :            :             {
      65   [ #  #  #  # ]:          0 :                 if (
           [ #  #  #  # ]
                 [ #  # ]
      66         [ #  # ]:          0 :                     (bCaseSensitive && (pBkmk->GetName() == sNameLc)) ||
      67 [ #  # ][ #  # ]:          0 :                     (!bCaseSensitive && GetAppCharClass().lowercase(pBkmk->GetName()) == sNameLc)
         [ #  # ][ #  # ]
                 [ #  # ]
      68                 :            :                    )
      69                 :            :                 {
      70                 :          0 :                     return pBkmk;
      71                 :            :                 }
      72                 :            :             }
      73                 :            :         }
      74                 :         48 :         return NULL;
      75                 :            :     }
      76                 :            : }
      77                 :            : 
      78                 :         60 : struct _FindItem
      79                 :            : {
      80                 :            :     const String m_Item;
      81                 :            :     SwTableNode* pTblNd;
      82                 :            :     SwSectionNode* pSectNd;
      83                 :            : 
      84                 :         60 :     _FindItem(const String& rS)
      85                 :         60 :         : m_Item(rS), pTblNd(0), pSectNd(0)
      86                 :         60 :     {}
      87                 :            : };
      88                 :            : 
      89                 :         48 : static bool lcl_FindSection( const SwSectionFmt* pSectFmt, _FindItem * const pItem, bool bCaseSensitive )
      90                 :            : {
      91                 :         48 :     SwSection* pSect = pSectFmt->GetSection();
      92         [ +  - ]:         48 :     if( pSect )
      93                 :            :     {
      94                 :            :         String sNm( (bCaseSensitive)
      95                 :         24 :                 ? pSect->GetSectionName()
      96   [ +  +  +  - ]:         72 :                 : String(GetAppCharClass().lowercase( pSect->GetSectionName() )));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
           [ #  #  #  # ]
      97                 :            :         String sCompare( (bCaseSensitive)
      98                 :            :                 ? pItem->m_Item
      99 [ +  + ][ +  - ]:         48 :                 : String(GetAppCharClass().lowercase( pItem->m_Item ) ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
           [ #  #  #  # ]
     100 [ +  - ][ -  + ]:         48 :         if( sNm == sCompare )
     101                 :            :         {
     102                 :            :             // found, so get the data
     103                 :            :             const SwNodeIndex* pIdx;
     104         [ #  # ]:          0 :             if( 0 != (pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) &&
           [ #  #  #  # ]
                 [ #  # ]
     105         [ #  # ]:          0 :                 &pSectFmt->GetDoc()->GetNodes() == &pIdx->GetNodes() )
     106                 :            :             {
     107                 :            :                 // a table in the normal NodesArr
     108                 :          0 :                 pItem->pSectNd = pIdx->GetNode().GetSectionNode();
     109                 :         48 :                 return false;
     110                 :            :             }
     111                 :            :             // If the name is already correct, but not the rest then we don't have them.
     112                 :            :             // The names are always unique.
     113 [ +  - ][ -  + ]:         48 :         }
         [ +  - ][ +  - ]
     114                 :            :     }
     115                 :         48 :     return true;
     116                 :            : }
     117                 :            : 
     118                 :            : 
     119                 :            : 
     120                 :          0 : static bool lcl_FindTable( const SwFrmFmt* pTableFmt, _FindItem * const pItem )
     121                 :            : {
     122 [ #  # ][ #  # ]:          0 :     String sNm( GetAppCharClass().lowercase( pTableFmt->GetName() ));
         [ #  # ][ #  # ]
     123 [ #  # ][ #  # ]:          0 :     if (sNm.Equals( pItem->m_Item ))
     124                 :            :     {
     125                 :            :         SwTable* pTmpTbl;
     126                 :            :         SwTableBox* pFBox;
     127 [ #  # ][ #  # ]:          0 :         if( 0 != ( pTmpTbl = SwTable::FindTable( pTableFmt ) ) &&
           [ #  #  #  #  
           #  # ][ #  # ]
     128         [ #  # ]:          0 :             0 != ( pFBox = pTmpTbl->GetTabSortBoxes()[0] ) &&
     129                 :          0 :             pFBox->GetSttNd() &&
     130         [ #  # ]:          0 :             &pTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
     131                 :            :         {
     132                 :            :             // a table in the normal NodesArr
     133                 :            :             pItem->pTblNd = (SwTableNode*)
     134         [ #  # ]:          0 :                                         pFBox->GetSttNd()->FindTableNode();
     135                 :          0 :             return false;
     136                 :            :         }
     137                 :            :         // If the name is already correct, but not the rest then we don't have them.
     138                 :            :         // The names are always unique.
     139                 :            :     }
     140         [ #  # ]:          0 :     return true;
     141                 :            : }
     142                 :            : 
     143                 :            : 
     144                 :            : 
     145                 :          0 : bool SwDoc::GetData( const rtl::OUString& rItem, const String& rMimeType,
     146                 :            :                      uno::Any & rValue ) const
     147                 :            : {
     148                 :            :     // search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
     149                 :          0 :     bool bCaseSensitive = true;
     150                 :          0 :     while( true )
     151                 :            :     {
     152         [ #  # ]:          0 :         ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
     153         [ #  # ]:          0 :         if(pBkmk)
     154 [ #  # ][ #  # ]:          0 :             return SwServerObject(*pBkmk).GetData(rValue, rMimeType);
                 [ #  # ]
     155                 :            : 
     156                 :            :         // Do we already have the Item?
     157 [ #  # ][ #  # ]:          0 :         String sItem( bCaseSensitive ? rItem : GetAppCharClass().lowercase(rItem));
         [ #  # ][ #  # ]
     158         [ #  # ]:          0 :         _FindItem aPara( sItem );
     159 [ #  # ][ #  # ]:          0 :         BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     160                 :            :         {
     161 [ #  # ][ #  # ]:          0 :             if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
     162                 :          0 :                 break;
     163                 :            :         }
     164         [ #  # ]:          0 :         if( aPara.pSectNd )
     165                 :            :         {
     166                 :            :             // found, so get the data
     167 [ #  # ][ #  # ]:          0 :             return SwServerObject( *aPara.pSectNd ).GetData( rValue, rMimeType );
                 [ #  # ]
     168                 :            :         }
     169         [ #  # ]:          0 :         if( !bCaseSensitive )
     170                 :            :             break;
     171      [ #  #  # ]:          0 :         bCaseSensitive = false;
     172 [ #  # ][ #  # ]:          0 :     }
              [ #  #  # ]
     173                 :            : 
     174 [ #  # ][ #  # ]:          0 :     _FindItem aPara( GetAppCharClass().lowercase( rItem ));
         [ #  # ][ #  # ]
                 [ #  # ]
     175 [ #  # ][ #  # ]:          0 :     BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     176                 :            :     {
     177 [ #  # ][ #  # ]:          0 :         if (!(lcl_FindTable(pFmt, &aPara)))
     178                 :          0 :             break;
     179                 :            :     }
     180         [ #  # ]:          0 :     if( aPara.pTblNd )
     181                 :            :     {
     182 [ #  # ][ #  # ]:          0 :         return SwServerObject( *aPara.pTblNd ).GetData( rValue, rMimeType );
                 [ #  # ]
     183                 :            :     }
     184                 :            : 
     185         [ #  # ]:          0 :     return sal_False;
     186                 :            : }
     187                 :            : 
     188                 :            : 
     189                 :            : 
     190                 :          0 : bool SwDoc::SetData( const rtl::OUString& rItem, const String& rMimeType,
     191                 :            :                      const uno::Any & rValue )
     192                 :            : {
     193                 :            :     // search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
     194                 :          0 :     bool bCaseSensitive = true;
     195                 :          0 :     while( true )
     196                 :            :     {
     197         [ #  # ]:          0 :         ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
     198         [ #  # ]:          0 :         if(pBkmk)
     199 [ #  # ][ #  # ]:          0 :             return SwServerObject(*pBkmk).SetData(rMimeType, rValue);
                 [ #  # ]
     200                 :            : 
     201                 :            :         // Do we already have the Item?
     202 [ #  # ][ #  # ]:          0 :         String sItem( bCaseSensitive ? rItem : GetAppCharClass().lowercase(rItem));
         [ #  # ][ #  # ]
     203         [ #  # ]:          0 :         _FindItem aPara( sItem );
     204 [ #  # ][ #  # ]:          0 :         BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     205                 :            :         {
     206 [ #  # ][ #  # ]:          0 :             if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
     207                 :          0 :                 break;
     208                 :            :         }
     209         [ #  # ]:          0 :         if( aPara.pSectNd )
     210                 :            :         {
     211                 :            :             // found, so get the data
     212 [ #  # ][ #  # ]:          0 :             return SwServerObject( *aPara.pSectNd ).SetData( rMimeType, rValue );
                 [ #  # ]
     213                 :            :         }
     214         [ #  # ]:          0 :         if( !bCaseSensitive )
     215                 :            :             break;
     216      [ #  #  # ]:          0 :         bCaseSensitive = false;
     217 [ #  # ][ #  # ]:          0 :     }
              [ #  #  # ]
     218                 :            : 
     219 [ #  # ][ #  # ]:          0 :     String sItem(GetAppCharClass().lowercase(rItem));
                 [ #  # ]
     220         [ #  # ]:          0 :     _FindItem aPara( sItem );
     221 [ #  # ][ #  # ]:          0 :     BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     222                 :            :     {
     223 [ #  # ][ #  # ]:          0 :         if (!(lcl_FindTable(pFmt, &aPara)))
     224                 :          0 :             break;
     225                 :            :     }
     226         [ #  # ]:          0 :     if( aPara.pTblNd )
     227                 :            :     {
     228 [ #  # ][ #  # ]:          0 :         return SwServerObject( *aPara.pTblNd ).SetData( rMimeType, rValue );
                 [ #  # ]
     229                 :            :     }
     230                 :            : 
     231 [ #  # ][ #  # ]:          0 :     return sal_False;
     232                 :            : }
     233                 :            : 
     234                 :            : 
     235                 :            : 
     236                 :         12 : ::sfx2::SvLinkSource* SwDoc::CreateLinkSource(const rtl::OUString& rItem)
     237                 :            : {
     238                 :         12 :     SwServerObject* pObj = NULL;
     239                 :            : 
     240                 :            :     // search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
     241                 :         12 :     bool bCaseSensitive = true;
     242                 :         12 :     while( true )
     243                 :            :     {
     244                 :            :         // bookmarks
     245         [ +  - ]:         24 :         ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem, bCaseSensitive);
     246 [ -  + ][ #  # ]:         24 :         if(pBkmk && pBkmk->IsExpanded()
         [ #  # ][ #  # ]
                 [ -  + ]
     247                 :            :             && (0 == (pObj = pBkmk->GetRefObject())))
     248                 :            :         {
     249                 :            :             // mark found, but no link yet -> create hotlink
     250 [ #  # ][ #  # ]:          0 :             pObj = new SwServerObject(*pBkmk);
     251         [ #  # ]:          0 :             pBkmk->SetRefObject(pObj);
     252 [ #  # ][ #  # ]:          0 :             GetLinkManager().InsertServer(pObj);
     253                 :            :         }
     254         [ -  + ]:         24 :         if(pObj)
     255                 :          0 :             return pObj;
     256                 :            : 
     257 [ +  + ][ +  - ]:         24 :         _FindItem aPara(bCaseSensitive ? rItem : GetAppCharClass().lowercase(rItem));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     258                 :            :         // sections
     259 [ +  - ][ +  - ]:         72 :         BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
                 [ +  - ]
     260                 :            :         {
     261 [ +  - ][ -  + ]:         24 :             if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
     262                 :          0 :                 break;
     263                 :            :         }
     264                 :            : 
     265   [ -  +  #  # ]:         24 :         if(aPara.pSectNd
                 [ -  + ]
     266                 :          0 :             && (0 == (pObj = aPara.pSectNd->GetSection().GetObject())))
     267                 :            :         {
     268                 :            :             // section found, but no link yet -> create hotlink
     269 [ #  # ][ #  # ]:          0 :             pObj = new SwServerObject( *aPara.pSectNd );
     270         [ #  # ]:          0 :             aPara.pSectNd->GetSection().SetRefObject( pObj );
     271 [ #  # ][ #  # ]:          0 :             GetLinkManager().InsertServer(pObj);
     272                 :            :         }
     273         [ -  + ]:         24 :         if(pObj)
     274                 :          0 :             return pObj;
     275         [ +  + ]:         24 :         if( !bCaseSensitive )
     276                 :            :             break;
     277      [ +  -  + ]:         36 :         bCaseSensitive = false;
     278         [ +  - ]:         24 :     }
     279                 :            : 
     280 [ +  - ][ +  - ]:         12 :     _FindItem aPara( GetAppCharClass().lowercase(rItem) );
         [ +  - ][ +  - ]
                 [ +  - ]
     281                 :            :     // tables
     282 [ +  - ][ +  - ]:         12 :     BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ +  - ][ +  - ]
         [ -  + ][ -  + ]
                 [ +  - ]
     283                 :            :     {
     284 [ #  # ][ #  # ]:          0 :         if (!(lcl_FindTable(pFmt, &aPara)))
     285                 :          0 :             break;
     286                 :            :     }
     287   [ -  +  #  # ]:         12 :     if(aPara.pTblNd
                 [ -  + ]
     288                 :          0 :         && (0 == (pObj = aPara.pTblNd->GetTable().GetObject())))
     289                 :            :     {
     290                 :            :         // table found, but no link yet -> create hotlink
     291 [ #  # ][ #  # ]:          0 :         pObj = new SwServerObject(*aPara.pTblNd);
     292         [ #  # ]:          0 :         aPara.pTblNd->GetTable().SetRefObject(pObj);
     293 [ #  # ][ #  # ]:          0 :         GetLinkManager().InsertServer(pObj);
     294                 :            :     }
     295         [ +  - ]:         12 :     return pObj;
     296                 :            : }
     297                 :            : 
     298                 :         12 : sal_Bool SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
     299                 :            :                             SwNodeRange*& rpRange ) const
     300                 :            : {
     301                 :            :     // Do we actually have the Item?
     302                 :         12 :     rpPam = 0;
     303                 :         12 :     rpRange = 0;
     304                 :            : 
     305                 :            :     String sItem( INetURLObject::decode( rStr, INET_HEX_ESCAPE,
     306                 :            :                                          INetURLObject::DECODE_WITH_CHARSET,
     307 [ +  - ][ +  - ]:         12 :                                         RTL_TEXTENCODING_UTF8 ));
                 [ +  - ]
     308                 :            : 
     309         [ +  - ]:         12 :     xub_StrLen nPos = sItem.Search( cMarkSeperator );
     310                 :            : 
     311         [ +  - ]:         12 :     const CharClass& rCC = GetAppCharClass();
     312                 :            : 
     313                 :            :     // Extension for sections: not only link bookmarks/sections
     314                 :            :     // but also frames (text!), tables, outlines:
     315         [ -  + ]:         12 :     if( STRING_NOTFOUND != nPos )
     316                 :            :     {
     317                 :          0 :         sal_Bool bWeiter = sal_False;
     318         [ #  # ]:          0 :         String sName( sItem.Copy( 0, nPos ) );
     319         [ #  # ]:          0 :         String sCmp( sItem.Copy( nPos + 1 ));
     320 [ #  # ][ #  # ]:          0 :         sItem = rCC.lowercase( sItem );
                 [ #  # ]
     321                 :            : 
     322         [ #  # ]:          0 :         _FindItem aPara( sName );
     323                 :            : 
     324 [ #  # ][ #  # ]:          0 :         if( sCmp.EqualsAscii( pMarkToTable ) )
     325                 :            :         {
     326 [ #  # ][ #  # ]:          0 :             sName = rCC.lowercase( sName );
                 [ #  # ]
     327 [ #  # ][ #  # ]:          0 :             BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     328                 :            :             {
     329 [ #  # ][ #  # ]:          0 :                 if (!(lcl_FindTable(pFmt, &aPara)))
     330                 :          0 :                     break;
     331                 :            :             }
     332         [ #  # ]:          0 :             if( aPara.pTblNd )
     333                 :            :             {
     334                 :            :                 rpRange = new SwNodeRange( *aPara.pTblNd, 0,
     335 [ #  # ][ #  # ]:          0 :                                 *aPara.pTblNd->EndOfSectionNode(), 1 );
     336                 :          0 :                 return sal_True;
     337                 :            :             }
     338                 :            :         }
     339 [ #  # ][ #  # ]:          0 :         else if( sCmp.EqualsAscii( pMarkToFrame ) )
     340                 :            :         {
     341                 :            :             SwNodeIndex* pIdx;
     342                 :            :             SwNode* pNd;
     343         [ #  # ]:          0 :             const SwFlyFrmFmt* pFlyFmt = FindFlyByName( sName );
     344 [ #  # ][ #  # ]:          0 :             if( pFlyFmt &&
         [ #  # ][ #  # ]
     345         [ #  # ]:          0 :                 0 != ( pIdx = (SwNodeIndex*)pFlyFmt->GetCntnt().GetCntntIdx() ) &&
     346                 :          0 :                 !( pNd = &pIdx->GetNode())->IsNoTxtNode() )
     347                 :            :             {
     348 [ #  # ][ #  # ]:          0 :                 rpRange = new SwNodeRange( *pNd, 1, *pNd->EndOfSectionNode() );
     349                 :          0 :                 return sal_True;
     350                 :            :             }
     351                 :            :         }
     352 [ #  # ][ #  # ]:          0 :         else if( sCmp.EqualsAscii( pMarkToRegion ) )
     353                 :            :         {
     354         [ #  # ]:          0 :             sItem = sName;              // Is being dealt with further down!
     355                 :          0 :             bWeiter = sal_True;
     356                 :            :         }
     357 [ #  # ][ #  # ]:          0 :         else if( sCmp.EqualsAscii( pMarkToOutline ) )
     358                 :            :         {
     359 [ #  # ][ #  # ]:          0 :             SwPosition aPos( SwNodeIndex( (SwNodes&)GetNodes() ));
         [ #  # ][ #  # ]
     360 [ #  # ][ #  # ]:          0 :             if( GotoOutline( aPos, sName ))
     361                 :            :             {
     362                 :          0 :                 SwNode* pNd = &aPos.nNode.GetNode();
     363                 :            :                 //sal_uInt8 nLvl = pNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
     364         [ #  # ]:          0 :                 const int nLvl = pNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei
     365                 :            : 
     366 [ #  # ][ #  # ]:          0 :                 const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds();
     367                 :            :                 sal_uInt16 nTmpPos;
     368         [ #  # ]:          0 :                 rOutlNds.Seek_Entry( pNd, &nTmpPos );
     369 [ #  # ][ #  # ]:          0 :                 rpRange = new SwNodeRange( aPos.nNode, 0, aPos.nNode );
     370                 :            : 
     371                 :            :                 // look for the section's end, now
     372 [ #  # ][ #  # ]:          0 :                 for( ++nTmpPos;
                 [ #  # ]
     373                 :          0 :                         nTmpPos < rOutlNds.size() &&
     374         [ #  # ]:          0 :                         nLvl < rOutlNds[ nTmpPos ]->GetTxtNode()->
     375                 :            :                                 //GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
     376         [ #  # ]:          0 :                                 GetAttrOutlineLevel()-1;//<-end,zhaojianwei
     377                 :            :                     ++nTmpPos )
     378                 :            :                     ;       // there is no block
     379                 :            : 
     380         [ #  # ]:          0 :                 if( nTmpPos < rOutlNds.size() )
     381 [ #  # ][ #  # ]:          0 :                     rpRange->aEnd = *rOutlNds[ nTmpPos ];
     382                 :            :                 else
     383 [ #  # ][ #  # ]:          0 :                     rpRange->aEnd = GetNodes().GetEndOfContent();
     384                 :          0 :                 return sal_True;
     385 [ #  # ][ #  # ]:          0 :             }
     386                 :            :         }
     387                 :            : 
     388         [ #  # ]:          0 :         if( !bWeiter )
     389 [ #  # ][ #  # ]:          0 :             return sal_False;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     390                 :            :     }
     391                 :            : 
     392                 :            :     // search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive
     393                 :         12 :     bool bCaseSensitive = true;
     394                 :         12 :     while( true )
     395                 :            :     {
     396 [ +  - ][ +  - ]:         24 :         ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, sItem, bCaseSensitive);
     397         [ -  + ]:         24 :         if(pBkmk)
     398                 :            :         {
     399 [ #  # ][ #  # ]:          0 :             if(pBkmk->IsExpanded())
     400                 :            :                 rpPam = new SwPaM(
     401                 :          0 :                     pBkmk->GetMarkPos(),
     402 [ #  # ][ #  # ]:          0 :                     pBkmk->GetOtherMarkPos());
         [ #  # ][ #  # ]
     403                 :          0 :             return static_cast<bool>(rpPam);
     404                 :            :         }
     405                 :            : 
     406                 :            :         //
     407 [ +  + ][ +  - ]:         24 :         _FindItem aPara( bCaseSensitive ? sItem : String(rCC.lowercase( sItem )) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
           [ #  #  #  # ]
     408                 :            : 
     409         [ +  - ]:         24 :         if( !pSectionFmtTbl->empty() )
     410                 :            :         {
     411 [ +  - ][ +  - ]:         72 :             BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
     412                 :            :             {
     413 [ +  - ][ -  + ]:         24 :                 if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
     414                 :          0 :                     break;
     415                 :            :             }
     416         [ -  + ]:         24 :             if( aPara.pSectNd )
     417                 :            :             {
     418                 :            :                 rpRange = new SwNodeRange( *aPara.pSectNd, 1,
     419 [ #  # ][ #  # ]:          0 :                                         *aPara.pSectNd->EndOfSectionNode() );
     420                 :          0 :                 return sal_True;
     421                 :            : 
     422                 :            :             }
     423                 :            :         }
     424         [ +  + ]:         24 :         if( !bCaseSensitive )
     425                 :            :             break;
     426      [ +  -  + ]:         36 :         bCaseSensitive = false;
     427         [ +  - ]:         24 :     }
     428         [ +  - ]:         12 :     return sal_False;
     429                 :            : }
     430                 :            : 
     431                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10