2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 12:32:22 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 12:32:22 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 12:32:22 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 12:32:22 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 12:32:22 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 12:32:22 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <node.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <pam.hxx>
|
|
|
|
#include <ndtxt.hxx>
|
|
|
|
#include <fldbas.hxx> // UpdateFlds der KapitelNummerierung
|
2005-02-21 15:04:41 +00:00
|
|
|
#include <docary.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-07-19 13:12:17 +02:00
|
|
|
bool CompareSwOutlineNodes::operator()( SwNode* const& lhs, SwNode* const& rhs) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-07-19 13:12:17 +02:00
|
|
|
return lhs->GetIndex() < rhs->GetIndex();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-07-19 13:12:17 +02:00
|
|
|
bool SwOutlineNodes::Seek_Entry(SwNode* const &rP, sal_uInt16* pnPos) const
|
|
|
|
{
|
|
|
|
const_iterator it = lower_bound(rP);
|
|
|
|
*pnPos = it - begin();
|
|
|
|
return it != end() && rP->GetIndex() == (*it)->GetIndex();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2005-07-18 12:34:41 +00:00
|
|
|
void SwNodes::UpdateOutlineNode(SwNode & rNd)
|
|
|
|
{
|
|
|
|
SwTxtNode * pTxtNd = rNd.GetTxtNode();
|
|
|
|
|
|
|
|
if (pTxtNd && pTxtNd->IsOutlineStateChanged())
|
|
|
|
{
|
2012-11-21 07:34:08 +09:00
|
|
|
bool bFound = pOutlineNds->find(pTxtNd) != pOutlineNds->end();
|
2005-07-18 12:34:41 +00:00
|
|
|
|
|
|
|
if (pTxtNd->IsOutline())
|
|
|
|
{
|
|
|
|
if (! bFound)
|
2005-11-09 09:07:13 +00:00
|
|
|
{
|
|
|
|
// assure that text is in the correct nodes array
|
|
|
|
if ( &(pTxtNd->GetNodes()) == this )
|
|
|
|
{
|
2012-07-19 13:12:17 +02:00
|
|
|
pOutlineNds->insert(pTxtNd);
|
2005-11-09 09:07:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "<SwNodes::UpdateOutlineNode(..)> - given text node isn't in the correct nodes array. This is a serious defect -> inform OD" );
|
2005-11-09 09:07:13 +00:00
|
|
|
}
|
|
|
|
}
|
2005-07-18 12:34:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bFound)
|
2012-07-19 13:12:17 +02:00
|
|
|
pOutlineNds->erase(pTxtNd);
|
2005-07-18 12:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pTxtNd->UpdateOutlineState();
|
|
|
|
|
|
|
|
// die Gliederungs-Felder Updaten
|
|
|
|
GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
|
|
|
|
{
|
2012-07-19 13:12:17 +02:00
|
|
|
if( pOutlineNds->empty() ) // keine OutlineNodes vorhanden ?
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
const SwNodePtr pSrch = (SwNodePtr)&rNd;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nPos;
|
2000-09-18 23:08:29 +00:00
|
|
|
pOutlineNds->Seek_Entry( pSrch, &nPos );
|
2012-07-19 13:12:17 +02:00
|
|
|
if( nPos == pOutlineNds->size() ) // keine zum Updaten vorhanden ?
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if( nPos )
|
|
|
|
--nPos;
|
|
|
|
|
|
|
|
if( !GetDoc()->IsInDtor() && IsDocNodes() )
|
2005-11-08 16:18:27 +00:00
|
|
|
UpdateOutlineNode( *(*pOutlineNds)[ nPos ]);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2005-02-21 15:04:41 +00:00
|
|
|
|
|
|
|
const SwOutlineNodes & SwNodes::GetOutLineNds() const
|
|
|
|
{
|
|
|
|
return *pOutlineNds;
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|