2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2006-09-16 20:02:07 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <hintids.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/intitem.hxx>
|
|
|
|
#include <svl/stritem.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#include <sfx2/docfilt.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/protitem.hxx>
|
2010-01-13 22:25:07 +01:00
|
|
|
#include <sfx2/linkmgr.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
2004-10-04 18:04:58 +00:00
|
|
|
#include <sfx2/sfxsids.hrc>
|
2006-03-29 07:04:55 +00:00
|
|
|
#include <sfx2/fcontnr.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <docary.hxx>
|
|
|
|
#include <fmtcntnt.hxx>
|
|
|
|
#include <fmtpdsc.hxx>
|
|
|
|
#include <doc.hxx>
|
2010-11-25 14:31:08 +01:00
|
|
|
#include <IDocumentUndoRedo.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <node.hxx>
|
|
|
|
#include <pam.hxx>
|
|
|
|
#include <frmtool.hxx>
|
|
|
|
#include <editsh.hxx>
|
|
|
|
#include <hints.hxx>
|
|
|
|
#include <docsh.hxx>
|
|
|
|
#include <ndtxt.hxx>
|
|
|
|
#include <section.hxx>
|
|
|
|
#include <swserv.hxx>
|
|
|
|
#include <shellio.hxx>
|
|
|
|
#include <poolfmt.hxx>
|
|
|
|
#include <expfld.hxx>
|
|
|
|
#include <swbaslnk.hxx>
|
|
|
|
#include <mvsave.hxx>
|
|
|
|
#include <sectfrm.hxx>
|
|
|
|
#include <fmtftntx.hxx>
|
|
|
|
#include <ftnidx.hxx>
|
|
|
|
#include <doctxm.hxx>
|
2004-11-16 09:22:48 +00:00
|
|
|
#include <fmteiro.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <swerror.h>
|
2010-03-16 11:28:35 +01:00
|
|
|
#include <unosection.hxx>
|
2010-12-17 09:02:23 +01:00
|
|
|
#include <switerator.hxx>
|
2010-12-21 19:33:34 +01:00
|
|
|
#include <svl/smplhint.hxx>
|
2012-05-16 10:18:27 +02:00
|
|
|
#include <algorithm>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2007-09-27 07:42:28 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
|
2001-03-08 20:28:23 +00:00
|
|
|
SV_IMPL_REF( SwServerObject )
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#define sSectionFmtNm aEmptyStr
|
|
|
|
|
|
|
|
class SwIntrnlSectRefLink : public SwBaseLink
|
|
|
|
{
|
|
|
|
SwSectionFmt& rSectFmt;
|
|
|
|
public:
|
2011-01-17 15:06:54 +01:00
|
|
|
SwIntrnlSectRefLink( SwSectionFmt& rFmt, sal_uInt16 nUpdateType, sal_uInt16 nFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
: SwBaseLink( nUpdateType, nFmt ),
|
|
|
|
rSectFmt( rFmt )
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual void Closed();
|
2011-05-25 14:58:03 -04:00
|
|
|
virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
|
|
|
|
const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
virtual const SwNode* GetAnchor() const;
|
2011-01-17 15:06:54 +01:00
|
|
|
virtual sal_Bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen nStt = 0,
|
2000-09-18 23:08:29 +00:00
|
|
|
xub_StrLen nEnd = STRING_NOTFOUND ) const;
|
2007-05-10 08:14:55 +00:00
|
|
|
|
|
|
|
inline SwSectionNode* GetSectNode()
|
|
|
|
{
|
|
|
|
const SwNode* pSectNd( const_cast<SwIntrnlSectRefLink*>(this)->GetAnchor() );
|
|
|
|
return const_cast<SwSectionNode*>( dynamic_cast<const SwSectionNode*>( pSectNd ) );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
TYPEINIT1(SwSectionFmt,SwFrmFmt );
|
|
|
|
TYPEINIT1(SwSection,SwClient );
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionData::SwSectionData(SectionType const eType, String const& rName)
|
|
|
|
: m_eType(eType)
|
|
|
|
, m_sSectionName(rName)
|
|
|
|
, m_bHiddenFlag(false)
|
|
|
|
, m_bProtectFlag(false)
|
2011-02-07 20:21:18 +01:00
|
|
|
, m_bEditInReadonlyFlag(false) // edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
, m_bHidden(false)
|
|
|
|
, m_bCondHiddenFlag(true)
|
|
|
|
, m_bConnectFlag(true)
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
// this must have the same semantics as operator=()
|
|
|
|
SwSectionData::SwSectionData(SwSection const& rSection)
|
|
|
|
: m_eType(rSection.GetType())
|
2010-03-16 11:28:31 +01:00
|
|
|
, m_sSectionName(rSection.GetSectionName())
|
2010-03-16 11:28:30 +01:00
|
|
|
, m_sCondition(rSection.GetCondition())
|
|
|
|
, m_sLinkFileName(rSection.GetLinkFileName())
|
|
|
|
, m_sLinkFilePassword(rSection.GetLinkFilePassword())
|
|
|
|
, m_Password(rSection.GetPassword())
|
|
|
|
, m_bHiddenFlag(rSection.IsHiddenFlag())
|
|
|
|
, m_bProtectFlag(rSection.IsProtect())
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
, m_bEditInReadonlyFlag(rSection.IsEditInReadonly())
|
|
|
|
, m_bHidden(rSection.IsHidden())
|
|
|
|
, m_bCondHiddenFlag(true)
|
|
|
|
, m_bConnectFlag(rSection.IsConnectFlag())
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// this must have the same semantics as operator=()
|
|
|
|
SwSectionData::SwSectionData(SwSectionData const& rOther)
|
|
|
|
: m_eType(rOther.m_eType)
|
|
|
|
, m_sSectionName(rOther.m_sSectionName)
|
|
|
|
, m_sCondition(rOther.m_sCondition)
|
|
|
|
, m_sLinkFileName(rOther.m_sLinkFileName)
|
|
|
|
, m_sLinkFilePassword(rOther.m_sLinkFilePassword)
|
|
|
|
, m_Password(rOther.m_Password)
|
|
|
|
, m_bHiddenFlag(rOther.m_bHiddenFlag)
|
|
|
|
, m_bProtectFlag(rOther.m_bProtectFlag)
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
, m_bEditInReadonlyFlag(rOther.m_bEditInReadonlyFlag)
|
|
|
|
, m_bHidden(rOther.m_bHidden)
|
|
|
|
, m_bCondHiddenFlag(true)
|
|
|
|
, m_bConnectFlag(rOther.m_bConnectFlag)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// the semantics here are weird for reasons of backward compatibility
|
|
|
|
SwSectionData & SwSectionData::operator= (SwSectionData const& rOther)
|
|
|
|
{
|
|
|
|
m_eType = rOther.m_eType;
|
|
|
|
m_sSectionName = rOther.m_sSectionName;
|
|
|
|
m_sCondition = rOther.m_sCondition;
|
|
|
|
m_sLinkFileName = rOther.m_sLinkFileName;
|
|
|
|
m_sLinkFilePassword = rOther.m_sLinkFilePassword;
|
|
|
|
m_bConnectFlag = rOther.m_bConnectFlag;
|
|
|
|
m_Password = rOther.m_Password;
|
|
|
|
|
|
|
|
m_bEditInReadonlyFlag = rOther.m_bEditInReadonlyFlag;
|
|
|
|
m_bProtectFlag = rOther.m_bProtectFlag;
|
|
|
|
|
|
|
|
m_bHidden = rOther.m_bHidden;
|
|
|
|
// FIXME: old code did not assign m_bHiddenFlag ?
|
|
|
|
// FIXME: why should m_bCondHiddenFlag always default to true?
|
|
|
|
m_bCondHiddenFlag = true;
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// the semantics here are weird for reasons of backward compatibility
|
|
|
|
bool SwSectionData::operator==(SwSectionData const& rOther) const
|
|
|
|
{
|
|
|
|
return (m_eType == rOther.m_eType)
|
|
|
|
&& (m_sSectionName == rOther.m_sSectionName)
|
|
|
|
&& (m_sCondition == rOther.m_sCondition)
|
|
|
|
&& (m_bHidden == rOther.m_bHidden)
|
|
|
|
&& (m_bProtectFlag == rOther.m_bProtectFlag)
|
|
|
|
&& (m_bEditInReadonlyFlag == rOther.m_bEditInReadonlyFlag)
|
|
|
|
&& (m_sLinkFileName == rOther.m_sLinkFileName)
|
|
|
|
&& (m_sLinkFilePassword == rOther.m_sLinkFilePassword)
|
|
|
|
&& (m_Password == rOther.m_Password);
|
|
|
|
// FIXME: old code ignored m_bCondHiddenFlag m_bHiddenFlag m_bConnectFlag
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
// SwSection ===========================================================
|
|
|
|
|
|
|
|
SwSection::SwSection(
|
|
|
|
SectionType const eType, String const& rName, SwSectionFmt & rFormat)
|
|
|
|
: SwClient(& rFormat)
|
|
|
|
, m_Data(eType, rName)
|
|
|
|
{
|
|
|
|
SwSection *const pParentSect = GetParent();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pParentSect )
|
|
|
|
{
|
|
|
|
if( pParentSect->IsHiddenFlag() )
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
SetHidden( true );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetProtectFlag( pParentSect->IsProtectFlag() );
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetEditInReadonlyFlag( pParentSect->IsEditInReadonlyFlag() );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!m_Data.IsProtectFlag())
|
|
|
|
{
|
|
|
|
m_Data.SetProtectFlag( rFormat.GetProtect().IsCntntProtected() );
|
|
|
|
}
|
2004-11-16 09:22:48 +00:00
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
if (!m_Data.IsEditInReadonlyFlag()) // edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
m_Data.SetEditInReadonlyFlag( rFormat.GetEditInReadonly().GetValue() );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SwSection::~SwSection()
|
|
|
|
{
|
|
|
|
SwSectionFmt* pFmt = GetFmt();
|
|
|
|
if( !pFmt )
|
|
|
|
return;
|
|
|
|
|
|
|
|
SwDoc* pDoc = pFmt->GetDoc();
|
|
|
|
if( pDoc->IsInDtor() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// We reattach our Format to the default FrameFmt
|
|
|
|
// to not get any dependencies
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pFmt->DerivedFrom() != pDoc->GetDfltFrmFmt() )
|
2010-12-17 09:02:23 +01:00
|
|
|
pFmt->RegisterToFormat( *pDoc->GetDfltFrmFmt() );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
pFmt->Remove( this ); // remove
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
if (CONTENT_SECTION != m_Data.GetType())
|
|
|
|
{
|
2010-03-16 11:28:31 +01:00
|
|
|
pDoc->GetLinkManager().Remove( m_RefLink );
|
2010-03-16 11:28:30 +01:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:31 +01:00
|
|
|
if (m_RefObj.Is())
|
|
|
|
{
|
|
|
|
pDoc->GetLinkManager().RemoveServer( &m_RefObj );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// If the Section is the last Client in the Format we can delete it
|
2000-09-27 14:58:09 +00:00
|
|
|
SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
|
2010-12-17 09:02:23 +01:00
|
|
|
pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pFmt->GetDepends() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Do not add to the Undo. This should've happened earlier.
|
2010-11-25 14:31:10 +01:00
|
|
|
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
|
2012-10-23 03:13:47 +02:00
|
|
|
pDoc->DelSectionFmt( pFmt );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-16 11:28:31 +01:00
|
|
|
if (m_RefObj.Is())
|
|
|
|
{
|
|
|
|
m_RefObj->Closed();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::SetSectionData(SwSectionData const& rData)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
bool const bOldHidden( m_Data.IsHidden() );
|
|
|
|
m_Data = rData;
|
2012-10-23 03:13:47 +02:00
|
|
|
// The next two may actually overwrite the m_Data.m_bProtect or EditInReadonly Flag
|
2010-03-16 11:28:30 +01:00
|
|
|
// in Modify, which should result in same flag value as the old code!
|
|
|
|
SetProtect(m_Data.IsProtectFlag());
|
|
|
|
SetEditInReadonly(m_Data.IsEditInReadonlyFlag());
|
|
|
|
if (bOldHidden != m_Data.IsHidden()) // check if changed...
|
2004-11-16 09:22:48 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden());
|
2004-11-16 09:22:48 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
bool SwSection::DataEquals(SwSectionData const& rCmp) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
// note that the old code compared the flags of the parameter with the
|
|
|
|
// format attributes of this; the following mess should do the same...
|
|
|
|
(void) GetLinkFileName(); // updates m_sLinkFileName
|
|
|
|
bool const bProtect(m_Data.IsProtectFlag());
|
|
|
|
bool const bEditInReadonly(m_Data.IsEditInReadonlyFlag());
|
2013-08-15 16:24:25 +02:00
|
|
|
m_Data.SetProtectFlag(IsProtect());
|
|
|
|
m_Data.SetEditInReadonlyFlag(IsEditInReadonly());
|
2010-03-16 11:28:30 +01:00
|
|
|
bool const bResult( m_Data == rCmp );
|
2013-08-15 16:24:25 +02:00
|
|
|
m_Data.SetProtectFlag(bProtect);
|
|
|
|
m_Data.SetEditInReadonlyFlag(bEditInReadonly);
|
2010-03-16 11:28:30 +01:00
|
|
|
return bResult;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SwSectionFmt* pFmt = GetFmt();
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFmt, "ImplSetHiddenFlag: no format?");
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pFmt )
|
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
const bool bHide = bTmpHidden && bCondition;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
if (bHide) // should be hidden
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!m_Data.IsHiddenFlag()) // is not hidden
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Is the Parent hidden?
|
|
|
|
// This should be shown by the bHiddenFlag.
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Tell all Children that they are hidden
|
2000-09-18 23:08:29 +00:00
|
|
|
SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
|
2010-12-17 09:02:23 +01:00
|
|
|
pFmt->ModifyNotification( &aMsgItem, &aMsgItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Delete all Frames
|
2000-09-18 23:08:29 +00:00
|
|
|
pFmt->DelFrms();
|
|
|
|
}
|
|
|
|
}
|
2010-03-16 11:28:30 +01:00
|
|
|
else if (m_Data.IsHiddenFlag()) // show Nodes again
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Show all Frames (Child Sections are accounted for by MakeFrms)
|
|
|
|
// Only if the Parent Section is not restricting us!
|
2000-09-18 23:08:29 +00:00
|
|
|
SwSection* pParentSect = pFmt->GetParentSection();
|
|
|
|
if( !pParentSect || !pParentSect->IsHiddenFlag() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Tell all Children that the Parent is not hidden anymore
|
2000-09-18 23:08:29 +00:00
|
|
|
SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
|
2010-12-17 09:02:23 +01:00
|
|
|
pFmt->ModifyNotification( &aMsgItem, &aMsgItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
pFmt->MakeFrms();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwSection::CalcHiddenFlag() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwSection* pSect = this;
|
|
|
|
do {
|
|
|
|
if( pSect->IsHidden() && pSect->IsCondHidden() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
} while( 0 != ( pSect = pSect->GetParent()) );
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
bool SwSection::IsProtect() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionFmt *const pFmt( GetFmt() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFmt, "SwSection::IsProtect: no format?");
|
2010-03-16 11:28:30 +01:00
|
|
|
return (pFmt)
|
|
|
|
? pFmt->GetProtect().IsCntntProtected()
|
|
|
|
: IsProtectFlag();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
bool SwSection::IsEditInReadonly() const
|
2004-11-16 09:22:48 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionFmt *const pFmt( GetFmt() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFmt, "SwSection::IsEditInReadonly: no format?");
|
2010-03-16 11:28:30 +01:00
|
|
|
return (pFmt)
|
|
|
|
? pFmt->GetEditInReadonly().GetValue()
|
|
|
|
: IsEditInReadonlyFlag();
|
2004-11-16 09:22:48 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::SetHidden(bool const bFlag)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!m_Data.IsHidden() == !bFlag)
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetHidden(bFlag);
|
|
|
|
ImplSetHiddenFlag(bFlag, m_Data.IsCondHidden());
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::SetProtect(bool const bFlag)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionFmt *const pFormat( GetFmt() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFormat, "SwSection::SetProtect: no format?");
|
2010-03-16 11:28:30 +01:00
|
|
|
if (pFormat)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-05-10 14:57:44 +00:00
|
|
|
SvxProtectItem aItem( RES_PROTECT );
|
2011-01-17 15:06:54 +01:00
|
|
|
aItem.SetCntntProtect( (sal_Bool)bFlag );
|
2010-03-16 11:28:30 +01:00
|
|
|
pFormat->SetFmtAttr( aItem );
|
|
|
|
// note: this will call m_Data.SetProtectFlag via Modify!
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
m_Data.SetProtectFlag(bFlag);
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::SetEditInReadonly(bool const bFlag)
|
2004-11-16 09:22:48 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionFmt *const pFormat( GetFmt() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFormat, "SwSection::SetEditInReadonly: no format?");
|
2010-03-16 11:28:30 +01:00
|
|
|
if (pFormat)
|
2004-11-16 09:22:48 +00:00
|
|
|
{
|
|
|
|
SwFmtEditInReadonly aItem;
|
2011-01-17 15:06:54 +01:00
|
|
|
aItem.SetValue( (sal_Bool)bFlag );
|
2010-03-16 11:28:30 +01:00
|
|
|
pFormat->SetFmtAttr( aItem );
|
|
|
|
// note: this will call m_Data.SetEditInReadonlyFlag via Modify!
|
2004-11-16 09:22:48 +00:00
|
|
|
}
|
|
|
|
else
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
m_Data.SetEditInReadonlyFlag(bFlag);
|
|
|
|
}
|
2004-11-16 09:22:48 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
void SwSection::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
bool bRemake = false;
|
|
|
|
bool bUpdateFtn = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
|
|
|
|
{
|
|
|
|
case RES_ATTRSET_CHG:
|
|
|
|
{
|
|
|
|
SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet();
|
|
|
|
SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet();
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
|
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_PROTECT, sal_False, &pItem ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetProtectFlag( static_cast<SvxProtectItem const*>(pItem)
|
|
|
|
->IsCntntProtected() );
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewSet->ClearItem( RES_PROTECT );
|
|
|
|
pOldSet->ClearItem( RES_PROTECT );
|
|
|
|
}
|
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
// --> edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_EDIT_IN_READONLY, sal_False, &pItem ) )
|
2004-11-16 09:22:48 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetEditInReadonlyFlag(
|
|
|
|
static_cast<SwFmtEditInReadonly const*>(pItem)->GetValue());
|
2004-11-16 09:22:48 +00:00
|
|
|
pNewSet->ClearItem( RES_EDIT_IN_READONLY );
|
|
|
|
pOldSet->ClearItem( RES_EDIT_IN_READONLY );
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_FTN_AT_TXTEND, sal_False, &pItem ) ||
|
2000-09-18 23:08:29 +00:00
|
|
|
SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_END_AT_TXTEND, sal_False, &pItem ))
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
bUpdateFtn = true;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( !pNewSet->Count() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RES_PROTECT:
|
|
|
|
if( pNew )
|
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
bool bNewFlag =
|
2010-12-17 09:02:23 +01:00
|
|
|
static_cast<const SvxProtectItem*>(pNew)->IsCntntProtected();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !bNewFlag )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Switching off: See if there is protection transferred
|
|
|
|
// by the Parents
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwSection* pSect = this;
|
|
|
|
do {
|
|
|
|
if( pSect->IsProtect() )
|
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
bNewFlag = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-03-16 11:28:30 +01:00
|
|
|
pSect = pSect->GetParent();
|
|
|
|
} while (pSect);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetProtectFlag( bNewFlag );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
return;
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
case RES_EDIT_IN_READONLY:
|
|
|
|
if( pNew )
|
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
const bool bNewFlag =
|
2010-12-17 09:02:23 +01:00
|
|
|
static_cast<const SwFmtEditInReadonly*>(pNew)->GetValue();
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetEditInReadonlyFlag( bNewFlag );
|
2004-11-16 09:22:48 +00:00
|
|
|
}
|
|
|
|
return;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
case RES_SECTION_HIDDEN:
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetHiddenFlag(true);
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case RES_SECTION_NOT_HIDDEN:
|
|
|
|
case RES_SECTION_RESETHIDDENFLAG:
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetHiddenFlag( m_Data.IsHidden() && m_Data.IsCondHidden() );
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case RES_COL:
|
2012-10-23 03:13:47 +02:00
|
|
|
// Is handeled by the Layout, if appropriate
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RES_FTN_AT_TXTEND:
|
|
|
|
if( pNew && pOld )
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
bUpdateFtn = true;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RES_END_AT_TXTEND:
|
|
|
|
if( pNew && pOld )
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
bUpdateFtn = true;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
2010-12-17 09:02:23 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
CheckRegistration( pOld, pNew );
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bRemake )
|
|
|
|
{
|
|
|
|
GetFmt()->DelFrms();
|
|
|
|
GetFmt()->MakeFrms();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bUpdateFtn )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwSectionNode* pSectNd = GetFmt()->GetSectionNode( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSectNd )
|
|
|
|
pSectNd->GetDoc()->GetFtnIdxs().UpdateFtn(SwNodeIndex( *pSectNd ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-08 20:28:23 +00:00
|
|
|
void SwSection::SetRefObject( SwServerObject* pObj )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:31 +01:00
|
|
|
m_RefObj = pObj;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::SetCondHidden(bool const bFlag)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!m_Data.IsCondHidden() == !bFlag)
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
m_Data.SetCondHidden(bFlag);
|
|
|
|
ImplSetHiddenFlag(m_Data.IsHidden(), bFlag);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Set/remove the linked FileName
|
2000-09-18 23:08:29 +00:00
|
|
|
const String& SwSection::GetLinkFileName() const
|
|
|
|
{
|
2010-03-16 11:28:31 +01:00
|
|
|
if (m_RefLink.Is())
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
String sTmp;
|
2010-03-16 11:28:30 +01:00
|
|
|
switch (m_Data.GetType())
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
case DDE_LINK_SECTION:
|
2010-03-16 11:28:31 +01:00
|
|
|
sTmp = m_RefLink->GetLinkSourceName();
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FILE_LINK_SECTION:
|
|
|
|
{
|
|
|
|
String sRange, sFilter;
|
2010-03-16 11:28:31 +01:00
|
|
|
if (m_RefLink->GetLinkManager() &&
|
|
|
|
m_RefLink->GetLinkManager()->GetDisplayNames(
|
|
|
|
m_RefLink, 0, &sTmp, &sRange, &sFilter ))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2013-05-15 10:42:04 +03:00
|
|
|
( sTmp += sfx2::cTokenSeparator ) += sFilter;
|
|
|
|
( sTmp += sfx2::cTokenSeparator ) += sRange;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if( GetFmt() && !GetFmt()->GetSectionNode() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// If the Section is in the UndoNodesArray, the LinkManager
|
|
|
|
// does not contain the Link, thus it cannot be queried for it.
|
|
|
|
// Thus return the current Name.
|
2010-03-16 11:28:30 +01:00
|
|
|
return m_Data.GetLinkFileName();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2007-09-27 07:42:28 +00:00
|
|
|
default: break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2013-08-15 16:24:25 +02:00
|
|
|
m_Data.SetLinkFileName(sTmp);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-03-16 11:28:30 +01:00
|
|
|
return m_Data.GetLinkFileName();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
void SwSection::SetLinkFileName(const String& rNew, String const*const pPassWd)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-03-16 11:28:31 +01:00
|
|
|
if (m_RefLink.Is())
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
2010-03-16 11:28:31 +01:00
|
|
|
m_RefLink->SetLinkSourceName( rNew );
|
2010-03-16 11:28:30 +01:00
|
|
|
}
|
|
|
|
m_Data.SetLinkFileName(rNew);
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pPassWd )
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
SetLinkFilePassword( *pPassWd );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// If it was a Linked Section, we need to make all Child Links visible
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd )
|
|
|
|
{
|
|
|
|
const SwNode* pNd;
|
2004-10-04 18:04:58 +00:00
|
|
|
const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks();
|
2012-06-12 15:41:27 +02:00
|
|
|
for( sal_uInt16 n = rLnks.size(); n; )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-10-04 18:04:58 +00:00
|
|
|
::sfx2::SvBaseLink* pBLnk = &(*rLnks[ --n ]);
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pBLnk && !pBLnk->IsVisible() &&
|
|
|
|
pBLnk->ISA( SwBaseLink ) &&
|
|
|
|
0 != ( pNd = ((SwBaseLink*)pBLnk)->GetAnchor() ) )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
pNd = pNd->StartOfSectionNode(); // If it's a SectionNode
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwSectionNode* pParent;
|
|
|
|
while( 0 != ( pParent = pNd->FindSectionNode() ) &&
|
|
|
|
( CONTENT_SECTION == pParent->GetSection().GetType()
|
|
|
|
|| pNd == &rSectNd ))
|
2006-08-14 15:05:32 +00:00
|
|
|
pNd = pParent->StartOfSectionNode();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// It's within a normal Section, so show again
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pParent )
|
2011-01-17 15:06:54 +01:00
|
|
|
pBLnk->SetVisible( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwTOXBase* SwSection::GetTOXBase() const
|
|
|
|
{
|
|
|
|
const SwTOXBase* pRet = 0;
|
|
|
|
if( TOX_CONTENT_SECTION == GetType() )
|
|
|
|
pRet = PTR_CAST( SwTOXBaseSection, this );
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
// SwSectionFmt ========================================================
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
SwSectionFmt::SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc )
|
|
|
|
: SwFrmFmt( pDoc->GetAttrPool(), sSectionFmtNm, pDrvdFrm )
|
|
|
|
{
|
|
|
|
LockModify();
|
2008-06-13 08:42:59 +00:00
|
|
|
SetFmtAttr( *GetDfltAttr( RES_COL ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
UnlockModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwSectionFmt::~SwSectionFmt()
|
|
|
|
{
|
|
|
|
if( !GetDoc()->IsInDtor() )
|
|
|
|
{
|
|
|
|
SwSectionNode* pSectNd;
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwNodeIndex* pIdx = GetCntnt( sal_False ).GetCntntIdx();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
|
|
|
|
0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
|
|
|
|
{
|
|
|
|
SwSection& rSect = pSectNd->GetSection();
|
2012-10-23 03:13:47 +02:00
|
|
|
// If it was a linked Section, we need to make all Child Links
|
|
|
|
// visible again
|
2000-09-18 23:08:29 +00:00
|
|
|
if( rSect.IsConnected() )
|
|
|
|
rSect.MakeChildLinksVisible( *pSectNd );
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Check whether we need to be visible, before deleting the Nodes
|
2000-09-18 23:08:29 +00:00
|
|
|
if( rSect.IsHiddenFlag() )
|
|
|
|
{
|
2012-06-20 16:36:51 +02:00
|
|
|
SwSection* pParentSect = rSect.GetParent();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pParentSect || !pParentSect->IsHiddenFlag() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Make Nodes visible again
|
2010-03-16 11:28:30 +01:00
|
|
|
rSect.SetHidden(false);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2010-12-17 09:02:23 +01:00
|
|
|
// mba: test iteration; objects are removed while iterating
|
2011-05-13 15:44:49 +02:00
|
|
|
// use hint which allows to specify, if the content shall be saved or not
|
|
|
|
CallSwClientNotify( SwSectionFrmMoveAndDeleteHint( sal_True ) );
|
2010-12-17 09:02:23 +01:00
|
|
|
|
2011-03-31 10:05:04 +02:00
|
|
|
// Raise the Section up
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNodeRange aRg( *pSectNd, 0, *pSectNd->EndOfSectionNode() );
|
|
|
|
GetDoc()->GetNodes().SectionUp( &aRg );
|
|
|
|
}
|
|
|
|
LockModify();
|
2008-06-13 08:42:59 +00:00
|
|
|
ResetFmtAttr( RES_CNTNT );
|
2000-09-18 23:08:29 +00:00
|
|
|
UnlockModify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:35 +01:00
|
|
|
SwSection * SwSectionFmt::GetSection() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
return SwIterator<SwSection,SwSectionFmt>::FirstElement( *this );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-12 16:49:40 +02:00
|
|
|
extern void sw_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Do not destroy all Frms in aDepend (Frms are recognized with a PTR_CAST).
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwSectionFmt::DelFrms()
|
|
|
|
{
|
|
|
|
SwSectionNode* pSectNd;
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
|
|
|
|
0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
|
|
|
|
{
|
2011-04-05 09:45:35 +02:00
|
|
|
// First delete the <SwSectionFrm> of the <SwSectionFmt> instance
|
2010-12-17 09:02:23 +01:00
|
|
|
// mba: test iteration as objects are removed in iteration
|
2011-05-13 15:44:49 +02:00
|
|
|
// use hint which allows to specify, if the content shall be saved or not
|
|
|
|
CallSwClientNotify( SwSectionFrmMoveAndDeleteHint( sal_False ) );
|
2010-12-17 09:02:23 +01:00
|
|
|
|
2007-11-07 11:18:23 +00:00
|
|
|
// Then delete frames of the nested <SwSectionFmt> instances
|
2010-12-17 09:02:23 +01:00
|
|
|
SwIterator<SwSectionFmt,SwSectionFmt> aIter( *this );
|
|
|
|
SwSectionFmt *pLast = aIter.First();
|
2007-11-07 11:18:23 +00:00
|
|
|
while ( pLast )
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
pLast->DelFrms();
|
|
|
|
pLast = aIter.Next();
|
2007-11-07 11:18:23 +00:00
|
|
|
}
|
2011-02-02 20:41:40 +09:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nEnde = pSectNd->EndOfSectionIndex();
|
|
|
|
sal_uLong nStart = pSectNd->GetIndex()+1;
|
2012-10-12 16:49:40 +02:00
|
|
|
sw_DeleteFtn( pSectNd, nStart, nEnde );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if( pIdx )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Send Hint for PageDesc. Actually the Layout contained in the
|
|
|
|
// Paste of the Framei tself would need to do this. But that leads
|
|
|
|
// to subsequent errors, which we'd need to solve at run-time.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNodeIndex aNextNd( *pIdx );
|
2011-01-17 15:06:54 +01:00
|
|
|
SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection( &aNextNd, sal_True, sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pCNd )
|
|
|
|
{
|
|
|
|
const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get( RES_PAGEDESC );
|
2010-12-17 09:02:23 +01:00
|
|
|
pCNd->ModifyNotification( (SfxPoolItem*)&rItem, (SfxPoolItem*)&rItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Create the Views
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwSectionFmt::MakeFrms()
|
|
|
|
{
|
|
|
|
SwSectionNode* pSectNd;
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
|
|
|
|
0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
|
|
|
|
{
|
|
|
|
SwNodeIndex aIdx( *pIdx );
|
|
|
|
pSectNd->MakeFrms( &aIdx );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-11-21 23:17:48 +09:00
|
|
|
bool bClients = false;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
switch( nWhich )
|
|
|
|
{
|
|
|
|
case RES_ATTRSET_CHG:
|
|
|
|
if( GetDepends() )
|
|
|
|
{
|
|
|
|
SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet();
|
|
|
|
SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet();
|
|
|
|
const SfxPoolItem *pItem;
|
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_PROTECT, sal_False, &pItem ))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewSet->ClearItem( RES_PROTECT );
|
|
|
|
pOldSet->ClearItem( RES_PROTECT );
|
|
|
|
}
|
2004-11-16 09:22:48 +00:00
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
// --> edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_EDIT_IN_READONLY, sal_False, &pItem ) )
|
2004-11-16 09:22:48 +00:00
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
|
2004-11-16 09:22:48 +00:00
|
|
|
pNewSet->ClearItem( RES_EDIT_IN_READONLY );
|
|
|
|
pOldSet->ClearItem( RES_EDIT_IN_READONLY );
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_FTN_AT_TXTEND, sal_False, &pItem ))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
ModifyBroadcast( (SfxPoolItem*)&pOldSet->Get( RES_FTN_AT_TXTEND ), (SfxPoolItem*)pItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewSet->ClearItem( RES_FTN_AT_TXTEND );
|
|
|
|
pOldSet->ClearItem( RES_FTN_AT_TXTEND );
|
|
|
|
}
|
|
|
|
if( SFX_ITEM_SET == pNewSet->GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_END_AT_TXTEND, sal_False, &pItem ))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
ModifyBroadcast( (SfxPoolItem*)&pOldSet->Get( RES_END_AT_TXTEND ), (SfxPoolItem*)pItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewSet->ClearItem( RES_END_AT_TXTEND );
|
|
|
|
pOldSet->ClearItem( RES_END_AT_TXTEND );
|
|
|
|
}
|
|
|
|
if( !((SwAttrSetChg*)pOld)->GetChgSet()->Count() )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RES_SECTION_RESETHIDDENFLAG:
|
|
|
|
case RES_FTN_AT_TXTEND:
|
2012-11-21 23:17:48 +09:00
|
|
|
case RES_END_AT_TXTEND : bClients = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
// no break !!
|
|
|
|
case RES_SECTION_HIDDEN:
|
|
|
|
case RES_SECTION_NOT_HIDDEN:
|
|
|
|
{
|
|
|
|
SwSection* pSect = GetSection();
|
|
|
|
if( pSect && ( bClients || ( RES_SECTION_HIDDEN == nWhich ?
|
|
|
|
!pSect->IsHiddenFlag() : pSect->IsHiddenFlag() ) ) )
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
ModifyBroadcast( pOld, pNew );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ;
|
|
|
|
|
|
|
|
|
|
|
|
case RES_PROTECT:
|
2011-02-08 08:51:51 +01:00
|
|
|
case RES_EDIT_IN_READONLY: // edit in readonly sections
|
2012-10-23 03:13:47 +02:00
|
|
|
// Pass through these Messages until the End of the tree!
|
2000-09-18 23:08:29 +00:00
|
|
|
if( GetDepends() )
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
ModifyBroadcast( pOld, pNew );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2012-10-23 03:13:47 +02:00
|
|
|
return; // That's it!
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
case RES_OBJECTDYING:
|
|
|
|
if( !GetDoc()->IsInDtor() &&
|
|
|
|
((SwPtrMsgPoolItem *)pOld)->pObject == (void*)GetRegisteredIn() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// My Parents will be destroyed, so get the Parent's Parent
|
|
|
|
// and update
|
|
|
|
SwFrmFmt::Modify( pOld, pNew ); // Rewire first!
|
2000-09-18 23:08:29 +00:00
|
|
|
UpdateParent();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RES_FMT_CHG:
|
|
|
|
if( !GetDoc()->IsInDtor() &&
|
|
|
|
((SwFmtChg*)pNew)->pChangedFmt == (void*)GetRegisteredIn() &&
|
|
|
|
((SwFmtChg*)pNew)->pChangedFmt->IsA( TYPE( SwSectionFmt )) )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// My Parent will be changed, thus I need to update
|
|
|
|
SwFrmFmt::Modify( pOld, pNew ); // Rewire first!
|
2000-09-18 23:08:29 +00:00
|
|
|
UpdateParent();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SwFrmFmt::Modify( pOld, pNew );
|
2010-01-08 17:13:51 +01:00
|
|
|
|
|
|
|
if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
|
|
|
|
{ // invalidate cached uno object
|
|
|
|
SetXTextSection(uno::Reference<text::XTextSection>(0));
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Get info from the Format
|
2012-11-07 10:56:27 +09:00
|
|
|
bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
switch( rInfo.Which() )
|
|
|
|
{
|
|
|
|
case RES_FINDNEARESTNODE:
|
2008-06-13 08:42:59 +00:00
|
|
|
if( ((SwFmtPageDesc&)GetFmtAttr( RES_PAGEDESC )).GetPageDesc() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwSectionNode* pNd = GetSectionNode();
|
|
|
|
if( pNd )
|
|
|
|
((SwFindNearestNode&)rInfo).CheckNode( *pNd );
|
|
|
|
}
|
2012-11-07 10:56:27 +09:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
case RES_CONTENT_VISIBLE:
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
SwFrm* pFrm = SwIterator<SwFrm,SwFmt>::FirstElement(*this);
|
2000-09-18 23:08:29 +00:00
|
|
|
// if the current section has no own frame search for the children
|
|
|
|
if(!pFrm)
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
SwIterator<SwSectionFmt,SwSectionFmt> aFormatIter(*this);
|
|
|
|
SwSectionFmt* pChild = aFormatIter.First();
|
2000-09-18 23:08:29 +00:00
|
|
|
while(pChild && !pFrm)
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
pFrm = SwIterator<SwFrm,SwFmt>::FirstElement(*pChild);
|
|
|
|
pChild = aFormatIter.Next();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
((SwPtrMsgPoolItem&)rInfo).pObject = pFrm;
|
|
|
|
}
|
2012-11-07 10:56:27 +09:00
|
|
|
return false;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
return SwModify::GetInfo( rInfo );
|
|
|
|
}
|
|
|
|
|
2012-05-16 10:18:27 +02:00
|
|
|
static bool lcl_SectionCmpPos( const SwSection *pFirst, const SwSection *pSecond)
|
|
|
|
{
|
|
|
|
const SwSectionFmt* pFSectFmt = pFirst->GetFmt();
|
|
|
|
const SwSectionFmt* pSSectFmt = pSecond->GetFmt();
|
|
|
|
OSL_ENSURE( pFSectFmt && pSSectFmt &&
|
|
|
|
pFSectFmt->GetCntnt(sal_False).GetCntntIdx() &&
|
|
|
|
pSSectFmt->GetCntnt(sal_False).GetCntntIdx(),
|
|
|
|
"ungueltige Sections" );
|
|
|
|
return pFSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex() <
|
|
|
|
pSSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-05-16 10:18:27 +02:00
|
|
|
static bool lcl_SectionCmpNm( const SwSection *pFSect, const SwSection *pSSect)
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
OSL_ENSURE( pFSect && pSSect, "Invalid Sections" );
|
2012-05-16 10:18:27 +02:00
|
|
|
StringCompare const eCmp =
|
|
|
|
pFSect->GetSectionName().CompareTo( pSSect->GetSectionName() );
|
|
|
|
return eCmp == COMPARE_LESS;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Alle Sections which have been derived from this one
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 SwSectionFmt::GetChildSections( SwSections& rArr,
|
2000-09-18 23:08:29 +00:00
|
|
|
SectionSort eSort,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bAllSections ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-05-16 10:18:27 +02:00
|
|
|
rArr.clear();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( GetDepends() )
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
SwIterator<SwSectionFmt,SwSectionFmt> aIter(*this);
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwNodeIndex* pIdx;
|
2010-12-17 09:02:23 +01:00
|
|
|
for( SwSectionFmt* pLast = aIter.First(); pLast; pLast = aIter.Next() )
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bAllSections ||
|
2011-02-09 15:55:27 +01:00
|
|
|
( 0 != ( pIdx = pLast->GetCntnt(sal_False).
|
2000-09-18 23:08:29 +00:00
|
|
|
GetCntntIdx()) && &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
|
|
|
|
{
|
2012-05-16 10:18:27 +02:00
|
|
|
SwSection* pDummy = pLast->GetSection();
|
|
|
|
rArr.push_back( pDummy );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Do we need any sorting?
|
2012-05-16 10:18:27 +02:00
|
|
|
if( 1 < rArr.size() )
|
2000-09-18 23:08:29 +00:00
|
|
|
switch( eSort )
|
|
|
|
{
|
|
|
|
case SORTSECT_NAME:
|
2012-05-16 10:18:27 +02:00
|
|
|
std::sort( rArr.begin(), rArr.end(), lcl_SectionCmpNm );
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SORTSECT_POS:
|
2012-05-16 10:18:27 +02:00
|
|
|
std::sort( rArr.begin(), rArr.end(), lcl_SectionCmpPos );
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
2007-09-27 07:42:28 +00:00
|
|
|
case SORTSECT_NOT: break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-16 10:18:27 +02:00
|
|
|
return rArr.size();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// See whether the Section is within the Nodes or the UndoNodes array
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwSectionFmt::IsInNodesArr() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
|
2000-09-18 23:08:29 +00:00
|
|
|
return pIdx && &pIdx->GetNodes() == &GetDoc()->GetNodes();
|
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Parent was changed
|
|
|
|
void SwSectionFmt::UpdateParent()
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( !GetDepends() )
|
|
|
|
return;
|
|
|
|
|
2012-06-20 16:36:51 +02:00
|
|
|
SwSection* pSection = 0;
|
2004-08-12 11:21:16 +00:00
|
|
|
const SvxProtectItem* pProtect(0);
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2007-09-27 07:42:28 +00:00
|
|
|
const SwFmtEditInReadonly* pEditInReadonly = 0;
|
2010-03-16 11:28:30 +01:00
|
|
|
bool bIsHidden = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
SwClientIter aIter( *this ); // TODO
|
|
|
|
::SwClient * pLast = aIter.GoStart();
|
2012-10-23 03:13:47 +02:00
|
|
|
if( pLast ) // Could we jump to the beginning?
|
2000-09-18 23:08:29 +00:00
|
|
|
do {
|
|
|
|
if( pLast->IsA( TYPE(SwSectionFmt) ) )
|
|
|
|
{
|
|
|
|
if( !pSection )
|
|
|
|
{
|
|
|
|
pSection = GetSection();
|
|
|
|
if( GetRegisteredIn() )
|
|
|
|
{
|
2012-06-20 16:36:51 +02:00
|
|
|
const SwSection* pPS = GetParentSection();
|
2000-09-18 23:08:29 +00:00
|
|
|
pProtect = &pPS->GetFmt()->GetProtect();
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
|
2000-09-18 23:08:29 +00:00
|
|
|
bIsHidden = pPS->IsHiddenFlag();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pProtect = &GetProtect();
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
pEditInReadonly = &GetEditInReadonly();
|
2000-09-18 23:08:29 +00:00
|
|
|
bIsHidden = pSection->IsHidden();
|
|
|
|
}
|
|
|
|
}
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!pProtect->IsCntntProtected() !=
|
|
|
|
!pSection->IsProtectFlag())
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
pLast->ModifyNotification( (SfxPoolItem*)pProtect,
|
2000-09-18 23:08:29 +00:00
|
|
|
(SfxPoolItem*)pProtect );
|
2010-03-16 11:28:30 +01:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!pEditInReadonly->GetValue() !=
|
|
|
|
!pSection->IsEditInReadonlyFlag())
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly,
|
2004-11-16 09:22:48 +00:00
|
|
|
(SfxPoolItem*)pEditInReadonly );
|
2010-03-16 11:28:30 +01:00
|
|
|
}
|
2004-11-16 09:22:48 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bIsHidden == pSection->IsHiddenFlag() )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden
|
2000-09-18 23:08:29 +00:00
|
|
|
? RES_SECTION_HIDDEN
|
2007-09-27 07:42:28 +00:00
|
|
|
: RES_SECTION_NOT_HIDDEN ) );
|
2010-12-17 09:02:23 +01:00
|
|
|
pLast->ModifyNotification( &aMsgItem, &aMsgItem );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( !pSection &&
|
|
|
|
pLast->IsA( TYPE(SwSection) ) )
|
|
|
|
{
|
2012-06-20 16:36:51 +02:00
|
|
|
pSection = (SwSection*)pLast;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( GetRegisteredIn() )
|
|
|
|
{
|
2012-06-20 16:36:51 +02:00
|
|
|
const SwSection* pPS = GetParentSection();
|
2000-09-18 23:08:29 +00:00
|
|
|
pProtect = &pPS->GetFmt()->GetProtect();
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
|
2000-09-18 23:08:29 +00:00
|
|
|
bIsHidden = pPS->IsHiddenFlag();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pProtect = &GetProtect();
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2004-11-16 09:22:48 +00:00
|
|
|
pEditInReadonly = &GetEditInReadonly();
|
2000-09-18 23:08:29 +00:00
|
|
|
bIsHidden = pSection->IsHidden();
|
|
|
|
}
|
|
|
|
}
|
2011-03-31 10:05:04 +02:00
|
|
|
} while( 0 != ( pLast = ++aIter ));
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 11:28:35 +01:00
|
|
|
SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pIdx && ( bAlways || &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
|
|
|
|
return pIdx->GetNode().GetSectionNode();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Is this Section valid for the GlobalDocument?
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwSection* SwSectionFmt::GetGlobalDocSection() const
|
|
|
|
{
|
|
|
|
const SwSectionNode* pNd = GetSectionNode();
|
|
|
|
if( pNd &&
|
|
|
|
( FILE_LINK_SECTION == pNd->GetSection().GetType() ||
|
|
|
|
TOX_CONTENT_SECTION == pNd->GetSection().GetType() ) &&
|
|
|
|
pNd->GetIndex() > pNd->GetNodes().GetEndOfExtras().GetIndex() &&
|
2006-08-14 15:05:32 +00:00
|
|
|
!pNd->StartOfSectionNode()->IsSectionNode() &&
|
|
|
|
!pNd->StartOfSectionNode()->FindSectionNode() )
|
2000-09-18 23:08:29 +00:00
|
|
|
return &pNd->GetSection();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-16 11:28:35 +01:00
|
|
|
// sw::Metadatable
|
|
|
|
::sfx2::IXmlIdRegistry& SwSectionFmt::GetRegistry()
|
|
|
|
{
|
|
|
|
return GetDoc()->GetXmlIdRegistry();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SwSectionFmt::IsInClipboard() const
|
|
|
|
{
|
|
|
|
return GetDoc()->IsClipBoard();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SwSectionFmt::IsInUndo() const
|
|
|
|
{
|
|
|
|
return !IsInNodesArr();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SwSectionFmt::IsInContent() const
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwNodeIndex const*const pIdx = GetCntnt(sal_False).GetCntntIdx();
|
2010-03-16 11:28:35 +01:00
|
|
|
OSL_ENSURE(pIdx, "SwSectionFmt::IsInContent: no index?");
|
|
|
|
return (pIdx) ? !GetDoc()->IsInHeaderFooter(*pIdx) : true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// n.b.: if the section format represents an index, then there is both a
|
|
|
|
// SwXDocumentIndex and a SwXTextSection instance for this single core object.
|
|
|
|
// these two can both implement XMetadatable and forward to the same core
|
|
|
|
// section format. but here only one UNO object can be returned,
|
|
|
|
// so always return the text section.
|
|
|
|
uno::Reference< rdf::XMetadatable >
|
|
|
|
SwSectionFmt::MakeUnoObject()
|
|
|
|
{
|
|
|
|
uno::Reference<rdf::XMetadatable> xMeta;
|
|
|
|
SwSection *const pSection( GetSection() );
|
|
|
|
if (pSection)
|
|
|
|
{
|
|
|
|
xMeta.set( SwXTextSection::CreateXTextSection(this,
|
|
|
|
TOX_HEADER_SECTION == pSection->GetType()),
|
|
|
|
uno::UNO_QUERY );
|
|
|
|
}
|
|
|
|
return xMeta;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-10 08:14:55 +00:00
|
|
|
// Method to break section links inside a linked section
|
2012-10-12 16:49:40 +02:00
|
|
|
static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
|
2007-05-10 08:14:55 +00:00
|
|
|
{
|
|
|
|
if ( !rSectNd.GetDoc() )
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "method <lcl_RemoveSectionLinksInSect(..)> - no Doc at SectionNode" );
|
2007-05-10 08:14:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !rSectNd.GetSection().IsConnected() )
|
|
|
|
{
|
2011-03-12 11:51:35 +01:00
|
|
|
OSL_FAIL( "method <lcl_RemoveSectionLinksInSect(..)> - no Link at Section of SectionNode" );
|
2007-05-10 08:14:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
const ::sfx2::SvBaseLink* pOwnLink( &(rSectNd.GetSection().GetBaseLink() ) );
|
|
|
|
const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks();
|
2012-06-12 15:41:27 +02:00
|
|
|
for ( sal_uInt16 n = rLnks.size(); n > 0; )
|
2007-05-10 08:14:55 +00:00
|
|
|
{
|
|
|
|
SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(&(*rLnks[ --n ]));
|
|
|
|
if ( pSectLnk && pSectLnk != pOwnLink &&
|
|
|
|
pSectLnk->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) )
|
|
|
|
{
|
|
|
|
// break the link of the corresponding section.
|
|
|
|
// the link is also removed from the link manager
|
|
|
|
pSectLnk->GetSectNode()->GetSection().BreakLink();
|
|
|
|
|
|
|
|
// for robustness, because link is removed from the link manager
|
2012-06-12 15:41:27 +02:00
|
|
|
if ( n > rLnks.size() )
|
2007-05-10 08:14:55 +00:00
|
|
|
{
|
2012-06-12 15:41:27 +02:00
|
|
|
n = rLnks.size();
|
2007-05-10 08:14:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-12 16:49:40 +02:00
|
|
|
static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SwDoc* pDoc = rSectNd.GetDoc();
|
|
|
|
SwDocShell* pDShell = pDoc->GetDocShell();
|
|
|
|
if( !pDShell || !pDShell->GetMedium() )
|
|
|
|
return ;
|
|
|
|
|
|
|
|
String sName( pDShell->GetMedium()->GetName() );
|
|
|
|
SwBaseLink* pBLink;
|
2001-03-08 20:28:23 +00:00
|
|
|
String sMimeType( SotExchange::GetFormatMimeType( FORMAT_FILE ));
|
2007-09-27 07:42:28 +00:00
|
|
|
uno::Any aValue;
|
2013-04-07 12:06:47 +02:00
|
|
|
aValue <<= OUString( sName ); // Arbitrary name
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-10-04 18:04:58 +00:00
|
|
|
const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
|
2012-06-12 15:41:27 +02:00
|
|
|
for( sal_uInt16 n = rLnks.size(); n; )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-10-04 18:04:58 +00:00
|
|
|
::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pLnk && pLnk != &rUpdLnk &&
|
|
|
|
OBJECT_CLIENT_FILE == pLnk->GetObjType() &&
|
|
|
|
pLnk->ISA( SwBaseLink ) &&
|
|
|
|
( pBLink = (SwBaseLink*)pLnk )->IsInRange( rSectNd.GetIndex(),
|
|
|
|
rSectNd.EndOfSectionIndex() ) )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// It's in the Section, so update. But only if it's not in the same File!
|
2000-09-18 23:08:29 +00:00
|
|
|
String sFName;
|
2001-03-08 20:28:23 +00:00
|
|
|
pDoc->GetLinkManager().GetDisplayNames( pBLink, 0, &sFName, 0, 0 );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( sFName != sName )
|
|
|
|
{
|
2001-03-08 20:28:23 +00:00
|
|
|
pBLink->DataChanged( sMimeType, aValue );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// If needed find the Link pointer to avoid skipping one or calling one twice
|
2012-06-12 15:41:27 +02:00
|
|
|
if( n >= rLnks.size() && 0 != ( n = rLnks.size() ))
|
2000-09-18 23:08:29 +00:00
|
|
|
--n;
|
|
|
|
|
|
|
|
if( n && pLnk != &(*rLnks[ n ]) )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Find - it can only precede it!
|
2000-09-18 23:08:29 +00:00
|
|
|
while( n )
|
|
|
|
if( pLnk == &(*rLnks[ --n ] ) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-25 14:58:03 -04:00
|
|
|
::sfx2::SvBaseLink::UpdateResult SwIntrnlSectRefLink::DataChanged(
|
|
|
|
const String& rMimeType, const uno::Any & rValue )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwDoc* pDoc = rSectFmt.GetDoc();
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nDataFormat = SotExchange::GetFormatIdFromMimeType( rMimeType );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( !pSectNd || !pDoc || pDoc->IsInDtor() || ChkNoDataFlag() ||
|
2010-01-13 22:25:07 +01:00
|
|
|
sfx2::LinkManager::RegisterStatusInfoId() == nDataFormat )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Should we be in the Undo already?
|
2011-05-25 14:58:03 -04:00
|
|
|
return SUCCESS;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 20:41:40 +09:00
|
|
|
// #i38810# - Due to possible existing signatures, the
|
2005-03-10 16:46:30 +00:00
|
|
|
// document has to be modified after updating a link.
|
|
|
|
pDoc->SetModified();
|
|
|
|
// set additional flag that links have been updated, in order to check this
|
|
|
|
// during load.
|
|
|
|
pDoc->SetLinksUpdated( sal_True );
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Always switch off Undo
|
2010-11-25 14:31:08 +01:00
|
|
|
bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
|
|
|
|
pDoc->GetIDocumentUndoRedo().DoUndo(false);
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bWasVisibleLinks = pDoc->IsVisibleLinks();
|
|
|
|
pDoc->SetVisibleLinks( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwPaM* pPam;
|
|
|
|
ViewShell* pVSh = 0;
|
|
|
|
SwEditShell* pESh = pDoc->GetEditShell( &pVSh );
|
|
|
|
pDoc->LockExpFlds();
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Insert an empty TextNode at the Section's start
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNodeIndex aIdx( *pSectNd, +1 );
|
|
|
|
SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
|
|
|
|
SwTxtNode* pNewNd = pDoc->GetNodes().MakeTxtNode( aIdx,
|
|
|
|
pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ) );
|
|
|
|
|
|
|
|
if( pESh )
|
|
|
|
pESh->StartAllAction();
|
|
|
|
else if( pVSh )
|
|
|
|
pVSh->StartAction();
|
|
|
|
|
|
|
|
SwPosition aPos( aIdx, SwIndex( pNewNd, 0 ));
|
|
|
|
aPos.nNode--;
|
2011-01-17 15:06:54 +01:00
|
|
|
pDoc->CorrAbs( aIdx, aEndIdx, aPos, sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
pPam = new SwPaM( aPos );
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Delete everything succeeding it
|
2000-09-18 23:08:29 +00:00
|
|
|
aIdx--;
|
|
|
|
DelFlyInRange( aIdx, aEndIdx );
|
CWS-TOOLING: integrate CWS swrefactormarks2
2009-04-09 12:51:41 +0200 b_michaelsen r270689 : #i94949# cleaned up assertions after rebasing
2009-04-08 17:37:08 +0200 b_michaelsen r270658 : fixing sw/source/ui/utlui/makefile.mk
2009-04-07 17:56:54 +0200 b_michaelsen r270606 : added bookctrl.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4
2009-04-07 17:05:20 +0200 b_michaelsen r270603 : added crbm.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4
2009-04-02 23:44:38 +0200 b_michaelsen r270436 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@270033 (milestone: DEV300:m45)
2009-02-27 16:25:31 +0100 b_michaelsen r268606 : #i94949# fixed Windows buildbreaker
2009-02-25 18:01:13 +0100 b_michaelsen r268464 : #i94949# Bookmarktest document filter roundtrips
2009-02-24 18:23:55 +0100 b_michaelsen r268404 : #i94949# Bookmark unittests
2009-02-23 19:47:44 +0100 b_michaelsen r268370 : #i94949# added unittest for bookmarks
2009-02-23 12:22:07 +0100 b_michaelsen r268348 : #i94949# fixing CheckCrossReferences testcase
2009-02-20 18:12:50 +0100 b_michaelsen r268335 : #i94949# fixing SwXTextRange
2009-02-18 18:32:57 +0100 b_michaelsen r268252 : #i94949# deregistering DdeBookmarks on delete
2009-02-18 18:29:08 +0100 b_michaelsen r268251 : fixing dbgoutsw.cxx for debug builds
2009-02-16 18:42:43 +0100 b_michaelsen r267834 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@267171 (milestone: DEV300:m41)
2009-02-12 15:32:02 +0100 b_michaelsen r267667 : #i94949 fixed crossrefbookmark naming
2009-02-11 18:30:08 +0100 b_michaelsen r267624 : #94949# fixing bookmark navigation
2009-02-11 13:55:26 +0100 b_michaelsen r267599 : #i94949# fixed bookmark naming
2009-02-10 17:53:05 +0100 b_michaelsen r267571 : #i94949# renamed HasOtherMarkPos to IsExpanded
2009-02-10 17:23:01 +0100 b_michaelsen r267564 : #i94949# renamed ::sw::bookmark namespace to more fitting ::sw::mark
2009-02-10 16:16:32 +0100 b_michaelsen r267553 : #i94949# creating only CrossRefBookmark per Txtnode
2009-02-10 12:14:05 +0100 b_michaelsen r267547 : #i94949# fixed bookmark count in navigator
2009-02-09 19:12:18 +0100 b_michaelsen r267532 : #i94949# lcl_CopyBookmarks(..) - handle marks on boundaries correctly
2009-02-09 17:32:45 +0100 b_michaelsen r267524 : #i94949# setting the refobject of the DdeBookmark in Sin SwServerObject::SetDdeBookmark(..)
2009-02-09 17:22:15 +0100 b_michaelsen r267523 : #i94949# trying to harden SwServerObject
2009-02-09 16:47:32 +0100 b_michaelsen r267521 : #i94949# lcl_CopyBookmarks(..): try to get the source mark name, if possible
2009-02-09 16:05:42 +0100 b_michaelsen r267519 : #i94949# clearing the OtherMarkPos if PaM has no mark in repositionMark(..), swapping inverted bookmarks without hissing an assertion
2009-02-09 15:55:38 +0100 b_michaelsen r267518 : #i94949# checking for out-of-bounds in SwView::ExecuteStatusLine(..)
2009-02-09 15:23:47 +0100 b_michaelsen r267517 : #i94949# using an UNO_BOOKMARK in ui/dbui/dbinsdlg.cxx
2009-02-09 14:14:47 +0100 b_michaelsen r267514 : #i94949# IDocumentMarkAccess::GetType(..) asserts on unknown type
2009-02-09 14:04:25 +0100 b_michaelsen r267513 : #i94949# using rtl strings instead of tools-strings in CrossRefBookmarks
2009-02-09 13:55:01 +0100 b_michaelsen r267510 : #i94949# using empty string for UnoMark construction
2009-02-09 13:46:46 +0100 b_michaelsen r267509 : #i94949# removed superfluous #includes, removed superfluous member DdeBookmark::bGenerateName, initialized DdeBookmark::m_aRefObj removed superfluous local _FindItem::ClearObj
2009-02-06 14:38:37 +0100 b_michaelsen r267462 : #i94949# fixing FN_STAT_BOOKMARK dispatches
2009-02-05 18:05:07 +0100 b_michaelsen r267436 : #i94949# removing superfluous #includes
2009-02-04 15:51:31 +0100 b_michaelsen r267391 : fixing resync merge error
2009-02-02 19:39:55 +0100 b_michaelsen r267294 : #i94949# bookmark performance
2009-01-30 19:30:51 +0100 b_michaelsen r267229 : #i94949# throwing IllegalArgumentException, if appropriate
2009-01-30 19:29:56 +0100 b_michaelsen r267228 : #i94949# refactored lcl_FillBookmarkArray, comments, constness
2009-01-30 19:23:49 +0100 b_michaelsen r267227 : #i94949# refactored lcl_FillBookmarkArray, comments, constness
2009-01-30 19:16:06 +0100 b_michaelsen r267226 : #i94949# refactored lcl_FillBookmarkArray
2009-01-30 17:59:27 +0100 b_michaelsen r267222 : #i94949# removed superficial #include
2009-01-30 17:50:02 +0100 b_michaelsen r267220 : #i94949# SwXTextRange remembers its UNO bookmark
2009-01-29 20:19:58 +0100 b_michaelsen r267168 : #i94949# implemented IDocumentMarkAccess::findBookmark
2009-01-29 17:22:17 +0100 b_michaelsen r267162 : #i94949# implemented renameMark in Markmanager
2009-01-29 14:17:10 +0100 b_michaelsen r267134 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 13:21:54 +0100 b_michaelsen r267125 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 13:06:10 +0100 b_michaelsen r267120 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 13:00:09 +0100 b_michaelsen r267118 : #i94949# cleanup in SwXBookmark, whitespace
2009-01-29 10:35:10 +0100 b_michaelsen r267101 : #i94949# renamed SetCrsrToBkmk to SetCrsrToMark, moving to start/end of doc if no more bookmarks can be found
2009-01-28 17:05:36 +0100 b_michaelsen r267070 : #i94949# fixed order in aProvNamesId in unocoll.cxx
2009-01-28 15:46:13 +0100 b_michaelsen r267063 : #i94949# documentation
2009-01-28 15:36:59 +0100 b_michaelsen r267062 : #i94949# removing superficial #include
2009-01-28 15:30:36 +0100 b_michaelsen r267061 : #i94949# basic code conventions
2009-01-28 11:14:30 +0100 b_michaelsen r267039 : #i94949# comparing to the actual name of the new mark
2009-01-26 15:22:25 +0100 b_michaelsen r266927 : #i94949# performance fixes
2009-01-14 21:16:56 +0100 b_michaelsen r266332 : #i94949# fixing linux x86-64 compiler warnings
2009-01-14 19:52:06 +0100 b_michaelsen r266331 : #i94949# fixing some compiler warnings
2008-12-15 13:04:49 +0100 b_michaelsen r265474 : #i94949# fixed microsoft compiler warnings
2008-12-12 18:26:02 +0100 b_michaelsen r265434 : #i94949# fixed pro platform buildbreakers
2008-12-11 17:51:24 +0100 b_michaelsen r265342 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@264807 (milestone: DEV300:m37)
2008-12-09 18:30:59 +0100 b_michaelsen r265134 : #i94949# fixed IDocumentMarkAccess::GetType for new mark inheritance tree
2008-12-09 16:56:26 +0100 b_michaelsen r265118 : #i94949# fixed deleteMark optimization
2008-12-09 14:55:58 +0100 b_michaelsen r265092 : #i94949# DdeLink and DdeBookmark
2008-12-05 18:28:05 +0100 b_michaelsen r264914 : #i94949# fixed InitDoc in bookmarks
2008-12-02 02:23:51 +0100 b_michaelsen r264649 : #i94949# removed obsolete naming proposal code in SwXTextRange, fixed navigator reminders to forget the oldest reminder when the pool is empty
2008-12-02 02:05:19 +0100 b_michaelsen r264648 : #i94949# using bisect search for delete
2008-12-02 01:58:16 +0100 b_michaelsen r264647 : #i94949# using bisect search for delete
2008-12-02 01:37:33 +0100 b_michaelsen r264646 : #i94949# using bisect search for delete
2008-12-02 01:03:29 +0100 b_michaelsen r264645 : #i94949# fixed deleteMark crash
2008-12-01 20:55:00 +0100 b_michaelsen r264638 : #i94949# removed crossrefs from ui enumerations
2008-12-01 15:48:12 +0100 b_michaelsen r264613 : #i94949# removed superfluous local functions
2008-12-01 15:01:19 +0100 b_michaelsen r264608 : #i94949# optimized insertion of new marks
2008-12-01 14:33:21 +0100 b_michaelsen r264603 : #i94949# simplified code finding Fieldmark for a position
2008-12-01 14:05:55 +0100 b_michaelsen r264598 : #i94949# fixed reverse travelling through marks, removed obsolete getUniqueMarkName()
2008-11-27 18:48:15 +0100 b_michaelsen r264515 : #i94949# fixed _SaveCntntIdx and friends
2008-11-27 15:59:49 +0100 b_michaelsen r264500 : #i94949# fix Mark position only in ctor
2008-11-27 15:52:28 +0100 b_michaelsen r264497 : #i94949# fixed Bug in SwXBookmark, was using pDoc too early
2008-11-26 14:54:22 +0100 b_michaelsen r264396 : #i94949# fixed documentation, simplified navigator reminder code
2008-11-24 20:45:51 +0100 b_michaelsen r264266 : #i94949# removed last obsolete getUniqueMarkName calls
2008-11-24 20:21:35 +0100 b_michaelsen r264265 : #i94949# fixed typo in IDocumentMarkAccess, removed obsolete getUniqueMarkName calls
2008-11-24 18:34:32 +0100 b_michaelsen r264264 : #i94949# repositioning of Marks, removed possibility to delete marks by name in the core, refactoring of navigator reminder generation
2008-11-21 14:08:49 +0100 b_michaelsen r264137 : #i94949# simplified makeMark
2008-11-21 12:07:09 +0100 b_michaelsen r264120 : #i94949# moved ShortName and KeyCode from IMark to IBookmark
2008-11-19 12:50:49 +0100 b_michaelsen r263981 : #i94949# starting refactoring of bookmark naming
2008-11-19 11:31:08 +0100 b_michaelsen r263972 : #i94949# getting rid of obsolete dynamic casts
2008-11-18 19:06:09 +0100 b_michaelsen r263795 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators
2008-11-18 17:50:18 +0100 b_michaelsen r263792 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators
2008-11-18 16:48:20 +0100 b_michaelsen r263783 : #i94949# removed methods from crsrsh which are already available directly via IDocumentMarkAccess
2008-11-18 11:31:35 +0100 b_michaelsen r263753 : #i94949# cleaning up mark code in crsrsh
2008-11-17 10:15:25 +0100 b_michaelsen r263705 : #i94949# removed possible integer overflow
2008-11-14 18:48:45 +0100 b_michaelsen r263695 : #i94949# management of mark names in MarkManager
2008-11-14 18:23:40 +0100 b_michaelsen r263693 : #i94949# using polymorphism to do mark-specific setup in SwDoc
2008-11-14 16:27:09 +0100 b_michaelsen r263684 : #i94949# got rid of makeCrossRefBookmark
2008-11-14 13:03:32 +0100 b_michaelsen r263674 : #i94949# refactored Correction methods
2008-11-13 12:27:55 +0100 b_michaelsen r263631 : #i94949# got rid of old-style tools assertions in new code
2008-11-12 16:58:16 +0100 b_michaelsen r263608 : #i94949# added assertion for unique names
2008-11-12 16:55:18 +0100 b_michaelsen r263607 : #i94949# maked XFormField deprecated
2008-11-12 13:04:29 +0100 b_michaelsen r263587 : #i94949# replaced IDocumentMarkAccess::GetType with simple dynamic_cast where possible
2008-11-11 18:45:53 +0100 b_michaelsen r263572 : #i94949# cleaned up SwHstryBookmark
2008-11-11 13:48:18 +0100 b_michaelsen r263557 : #i94949# removed dynamic_casts to SwModify by inheriting IMark from it
2008-11-11 11:26:28 +0100 b_michaelsen r263548 : #i94949# fixed SwXBookmark
2008-11-10 17:01:19 +0100 b_michaelsen r263529 : #i94949# fixed DdeBookmarks in clipboard
2008-11-10 16:44:52 +0100 b_michaelsen r263527 : #i94949# formatting
2008-11-10 16:29:16 +0100 b_michaelsen r263526 : #i94949# fixing unoobj.cxx
2008-11-10 16:23:50 +0100 b_michaelsen r263525 : #i94949# cleaning up crossrefbookmark.cxx/.hxx
2008-11-10 16:02:08 +0100 b_michaelsen r263524 : #i94949# Pdf Export should only generate 'real' bookmarks
2008-11-10 15:33:58 +0100 b_michaelsen r263521 : #i94949# removed const_casts
2008-11-10 15:12:06 +0100 b_michaelsen r263520 : #i94949# moved _DelBookmarks into MarksManager
2008-11-07 18:48:38 +0100 b_michaelsen r263480 : #i94949# using iterator interface
2008-11-07 18:41:46 +0100 b_michaelsen r263478 : #i94949# using iterator interface
2008-11-07 18:07:41 +0100 b_michaelsen r263477 : #i94949# using iterator interface
2008-11-07 17:54:41 +0100 b_michaelsen r263476 : #i94949# using iterator interface
2008-11-07 17:44:41 +0100 b_michaelsen r263475 : #i94949# moved correction methods into MarkManager
2008-11-06 18:47:28 +0100 b_michaelsen r263404 : #i94949# getting rid of superfluous const_casts
2008-11-06 17:58:01 +0100 b_michaelsen r263403 : #i94949# no more setting of mark positions outside of the core
2008-11-06 17:08:37 +0100 b_michaelsen r263401 : #i94949# removed setters from IMark
2008-11-06 13:55:25 +0100 b_michaelsen r263383 : #i94949 SwDoc does not implement IDocumentMarkAccess anymore
2008-11-04 18:17:03 +0100 b_michaelsen r263333 : #i94949# began removing IDocumentMarkAccess from SwDoc
2008-11-04 16:48:34 +0100 b_michaelsen r263330 : removing dead code (SwBitArray) found by mst
2008-11-04 16:29:32 +0100 b_michaelsen r263329 : removing dead code (SwBitArray) found by mst
2008-11-04 14:57:48 +0100 b_michaelsen r263326 : removing dead code (SwBitArray) found by mst
2008-11-04 14:50:18 +0100 b_michaelsen r263325 : #i94949# stricter typing in IDocumentMarkAccess
2008-10-24 15:16:27 +0200 b_michaelsen r262647 : #i94949# renamed ::sw::bookmark::SimpleMark to NavigatorReminder to fit the IDocumentMarkAccess enum
2008-10-24 15:10:10 +0200 b_michaelsen r262646 : #i94949# only 'real' bookmark implement IBookmark, Marks also get removed from m_vFieldmarks on delete/clear
2008-10-24 13:06:23 +0200 b_michaelsen r262636 : #i94949# Fieldmark tabnavigation
2008-10-23 12:16:36 +0200 b_michaelsen r262619 : #i94949# Fieldmark classes and filters
2008-10-22 13:17:18 +0200 b_michaelsen r262597 : #i94949# writer import fixes
2008-10-21 11:30:38 +0200 b_michaelsen r262565 : #i94949# renamed methods containing Bookmark in the generic IMark interface
2008-10-20 14:09:02 +0200 b_michaelsen r262318 : #i94949# fixed SwDoc::CorrRel
2008-10-16 22:45:13 +0200 b_michaelsen r262273 : #i94949 simplified Before/After methods
2008-10-16 21:40:57 +0200 b_michaelsen r262271 : #i94949 renamed SimpleMark to NavigatorReminder
2008-10-16 21:15:23 +0200 b_michaelsen r262270 : #i94949 using shared_ptr only in MarkManager
2008-10-16 17:46:37 +0200 b_michaelsen r262269 : #i94949# getFieldmarkBefore and getFieldmarkAfter
2008-10-16 17:12:13 +0200 b_michaelsen r262265 : #i94949# cleanup in crbm.cxx
2008-10-16 12:49:01 +0200 b_michaelsen r262257 : #i94949# fixed usage of invalid iterator, fixed invalid cast
2008-10-15 15:34:20 +0200 b_michaelsen r262239 : #i94949# added moved files
2008-10-15 15:26:45 +0200 b_michaelsen r262237 : #i94949# initial reimplementation of Bookmarks
2009-04-21 15:40:02 +00:00
|
|
|
_DelBookmarks(aIdx, aEndIdx);
|
2012-10-15 23:31:02 +02:00
|
|
|
++aIdx;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
pDoc->GetNodes().Delete( aIdx, aEndIdx.GetIndex() - aIdx.GetIndex() );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwSection& rSection = pSectNd->GetSection();
|
2010-03-16 11:28:30 +01:00
|
|
|
rSection.SetConnectFlag(false);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sNewFileName;
|
2000-09-18 23:08:29 +00:00
|
|
|
Reader* pRead = 0;
|
|
|
|
switch( nDataFormat )
|
|
|
|
{
|
|
|
|
case FORMAT_STRING:
|
|
|
|
pRead = ReadAscii;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FORMAT_RTF:
|
2009-01-05 14:06:42 +00:00
|
|
|
pRead = SwReaderWriter::GetReader( READER_WRITER_RTF );
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FORMAT_FILE:
|
2001-03-08 20:28:23 +00:00
|
|
|
if( rValue.hasValue() && ( rValue >>= sNewFileName ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-03-08 20:28:23 +00:00
|
|
|
String sFilter, sRange, sFileName( sNewFileName );
|
|
|
|
pDoc->GetLinkManager().GetDisplayNames( this, 0, &sFileName,
|
2000-09-18 23:08:29 +00:00
|
|
|
&sRange, &sFilter );
|
|
|
|
|
2007-09-27 07:42:28 +00:00
|
|
|
RedlineMode_t eOldRedlineMode = nsRedlineMode_t::REDLINE_NONE;
|
2000-09-18 23:08:29 +00:00
|
|
|
SfxObjectShellRef xDocSh;
|
2011-01-03 13:40:23 +01:00
|
|
|
SfxObjectShellLock xLockRef;
|
2000-09-18 23:08:29 +00:00
|
|
|
int nRet;
|
|
|
|
if( !sFileName.Len() )
|
|
|
|
{
|
|
|
|
xDocSh = pDoc->GetDocShell();
|
|
|
|
nRet = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-08-15 13:39:11 +02:00
|
|
|
nRet = SwFindDocShell( xDocSh, xLockRef, sFileName,
|
2010-03-16 11:28:30 +01:00
|
|
|
rSection.GetLinkFilePassword(),
|
2000-09-18 23:08:29 +00:00
|
|
|
sFilter, 0, pDoc->GetDocShell() );
|
|
|
|
if( nRet )
|
|
|
|
{
|
|
|
|
SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
|
|
|
|
eOldRedlineMode = pSrcDoc->GetRedlineMode();
|
2007-09-27 07:42:28 +00:00
|
|
|
pSrcDoc->SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nRet )
|
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
rSection.SetConnectFlag(true);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwNodeIndex aSave( pPam->GetPoint()->nNode, -1 );
|
|
|
|
SwNodeRange* pCpyRg = 0;
|
|
|
|
|
|
|
|
if( xDocSh->GetMedium() &&
|
2010-03-16 11:28:30 +01:00
|
|
|
!rSection.GetLinkFilePassword().Len() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
if( SFX_ITEM_SET == xDocSh->GetMedium()->GetItemSet()->
|
2011-01-17 15:06:54 +01:00
|
|
|
GetItemState( SID_PASSWORD, sal_False, &pItem ) )
|
2010-03-16 11:28:30 +01:00
|
|
|
rSection.SetLinkFilePassword(
|
2000-09-18 23:08:29 +00:00
|
|
|
((SfxStringItem*)pItem)->GetValue() );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
|
|
|
|
|
|
|
|
if( sRange.Len() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Catch recursion
|
2012-11-21 23:17:48 +09:00
|
|
|
bool bRecursion = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSrcDoc == pDoc )
|
|
|
|
{
|
2001-03-08 20:28:23 +00:00
|
|
|
SwServerObjectRef refObj( (SwServerObject*)
|
|
|
|
pDoc->CreateLinkSource( sRange ));
|
2000-09-18 23:08:29 +00:00
|
|
|
if( refObj.Is() )
|
|
|
|
{
|
|
|
|
bRecursion = refObj->IsLinkInServer( this ) ||
|
|
|
|
ChkNoDataFlag();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
|
|
|
|
|
|
|
|
SwPaM* pCpyPam = 0;
|
|
|
|
if( !bRecursion &&
|
|
|
|
pSrcDoc->SelectServerObj( sRange, pCpyPam, pCpyRg )
|
|
|
|
&& pCpyPam )
|
|
|
|
{
|
|
|
|
if( pSrcDoc != pDoc ||
|
|
|
|
pCpyPam->Start()->nNode > rInsPos ||
|
|
|
|
rInsPos >= pCpyPam->End()->nNode )
|
CWS-TOOLING: integrate CWS odfmetadata3
2009-09-11 Michael Stahl merge DEV300_m58
2009-09-07 Michael Stahl SwFmtFld::Modify(): do nothing on RES_OBJECTDYING
2009-08-27 Michael Stahl #i91565#, #i91566#: TextPortionEnumerationTest.java: add test document
2009-08-27 Michael Stahl #i91565#, #i91566#: add complex test: TextPortionEnumerationTest.java
2009-08-27 Michael Stahl CLiteral::initialize(): zero-length literals probably not an error
2009-08-27 Michael Stahl #i91565#, #i91566#: offapi: new InContentMetadata and MetadataField services
adapt TextPortion for InContentMetadata
2009-08-27 Michael Stahl #i91564#: xmloff: load/store xml:id and RDFa for text:bookmark(-start).
2009-08-27 Michael Stahl #i91564#: sw core: add support for xml:id at bookmarks:
sw::mark::Bookmark: derive from Metadatable.
SwHistoryBookmark, SaveBookmark: store a MetadatableUndo.
ndcopy.cxx: lcl_CopyBookmarks(): copy the xml:id.
SwXBookmark: derive from MetadatableMixin.
2009-08-27 Michael Stahl #i91565#, #i91566#: xmloff: refactor ruby import so nested meta(-field) works:
remove XMLRubyHint_Impl.
XMLImpRubyContext_Impl::~XMLImpRubyContext_Impl(): insert ruby directly.
2009-08-27 Michael Stahl #i91565#, #i91566#: xmloff: fix text:meta(-field) import/export:
new XMLTextParagraphExport::exportTextField() overload for XTextField.
CreateAndInsertMark(): set xml:id after insertion.
fix meta(-field) service names, bugs etc.
2009-08-27 Michael Stahl #i91565#, #i91566#: sw text formatting: paint background of meta(-field) body:
SwFont: add member m_nMetaCount.
txttypes.hxx: add POR_META.
atrstck.cxx: handle RES_TXTATR_META(FIELD).
itrform2.cxx: SwTxtFormatter::WhichTxtPor(): create new class SwMetaPortion.
2009-08-27 Michael Stahl #i91566#: sw text formatting: display meta-field prefix and suffix:
SwAttrIter::GetAttr(): replace with call to GetTxtAttrForCharAt().
SwTxtFormatter::NewExtraPortion(): handle meta-field prefix.
SwTxtFormatter: new member m_nHintEndIndex.
SwTxtFormatter::WhichFirstPortion(): call TryNewNoLengthPortion().
SwTxtFormatter::TryNewNoLengthPortion(): new; handle suffix of meta-field.
SwTxtFormatter::UnderFlow(): UGLY HACK: decrement m_nHintEndIndex.
SwFldPortion: add flag m_bNoLength: portion has zero length (for suffix).
2009-08-27 Michael Stahl #i91565#, #i91566#: extend text:meta(-field) uno wrapper with XText interface:
unoobj.hxx: new CursorType CURSOR_META.
unoobj2.cxx: refactor SwXText implementation to ensure that when the SwXText
belongs to a SwXMeta, content is always inserted inside the meta(-field).
unoobj.cxx: new SwXTextCursor::ForceIntoMeta(): cursor stays in meta(-field).
unometa.hxx: SwXMeta implements XText, forwarding to a member SwXMetaText.
DocInsertStringSplitCR(), SwX*::attachToRange(), SwX*::DeleteAndInsert():
use FORCEHINTEXPAND hack to ensure insert into the meta(-field) at the end.
2009-08-27 Michael Stahl #i91565#, #i91566#: add text:meta(-field) uno wrapper to sw:
fmtmeta.hxx, fmtatr2.cxx: new class sw::MetaField, new sw::MetaFieldManager.
doc.hxx, docnew.cxx: new SwDoc::GetMetaFieldManager().
unocoll.hxx,.cxx: new SW_SERVICE_FIELDTYPE_METAFIELD, SW_SERVICE_TYPE_META.
unomap.hxx,.cxx: new PROPERTY_MAP_METAFIELD.
unoprnms.hxx: new UNO_NAME_META.
unoport.hxx: new PORTION_META; add "InContentMetadata" prop to SwXTextPortion.
new unometa.hxx: new class SwXMeta and SwXMetaField.
unofield.cxx: SwXFieldEnumeration: include meta-fields.
unoportenum.cxx: handle RES_TXTATR_META(FIELD) by using a portion list stack.
unotext.cxx: SwXText::insertTextContent(): handle meta(-field) as attribute.
2009-08-27 Michael Stahl #i91565#, #i91566#: ndhints.cxx: remove sort number from SwTxtAttrNesting
2009-08-27 Michael Stahl #i91565#, #i91566#: add support for hints with end and CH_TXTATR to sw core:
doc.hxx, docedt.cxx: replace SwDoc::Delete(), DeleteAndJoin(), ReplaceRange()
with wrappers that split at left-overlapped end+CH_TXTATR hints.
txatbase.hxx: new member SwTxtAttr::m_bHasDummyChar.
ndtxt.hxx: rename SwTxtNode::GetTxtAttr() to GetTxtAttrForCharAt().
ndtxt.cxx: SwTxtNode::CopyText(): copy end+CH_TXTATR hints iff copy CH_TXTATR.
txtatr2.cxx, thints.cxx: SwTxtMeta gets a CH_TXTATR.
2009-08-27 Michael Stahl #i91565#, #i91566#: add text:meta(-field) to sw core:
txatbase.hxx: new member SwTxtAttr::m_bNesting.
hintids.hxx: new ids RES_TXTATR_META, RES_TXTATR_METAFIELD.
txtatr.hxx: new base class SwTxtAttrNesting.
new hint SwTxtMeta.
SwTxtRuby derives from SwTxtAttrNesting.
txtinet.hxx: SwTxtINetFmt derives from SwTxtAttrNesting.
new header fmtmeta.hxx: new pool item SwFmtMeta. new class sw::Meta.
ndhints.hxx, thints.cxx: new method SwpHints::TryInsertNesting().
thints.cxx: refactoring: BuildPortions() no longer handles Ruby/Hyperlink,
but TryInsertNesting(), which also handles meta(-field).
SwTxtNode::InsertItem(): check if the hint is actually inserted.
ndhints.cxx: sort nesting hints based on sort number.
ndtxt.cxx: lcl_CopyHint(): handle copy of meta/meta-field.
2009-08-27 Michael Stahl enable expanding hints with m_bLockExpandFlag set:
add new InsertFlag: INS_FORCEHINTEXPAND.
add new SetAttrMode: SETATTR_FORCEHINTEXPAND.
rename SwEditShell::Insert() to Insert2() because changed signature fails
to compile when SwWrtShell tries to overwrite these non-virtual members...
SwWrtShell::Insert() sets FOCEHINTEXPAND if range was selected/deleted.
adapt SwUndoInsert to store flags.
2009-08-27 Michael Stahl change formal parameters of item insertion methods to type SetAttrMode
2009-08-27 Michael Stahl fix incorrect resetting of text attributes in SwUndoInsSection, SwUndoInserts
2009-08-27 Michael Stahl clean up SwTxtNode::CutImpl() and lcl_CopyHint()
2009-08-27 Michael Stahl rename SwDoc::Copy() to CopyRange(), and _Copy() to CopyImpl()
2009-08-27 Michael Stahl rename SwNodes::Move() to MoveRange(), and remove unused parameter
2009-08-27 Michael Stahl rename SwDoc::Move() to MoveRange()/MoveNodeRange()
2009-08-27 Michael Stahl rename SwDoc::Insert() to InsertString(), and remove sal_Unicode variant
2009-08-27 Michael Stahl rename SwDoc::Insert() to InsertPoolItem()/InsertItemSet()/InsertSwSection()
2009-08-27 Michael Stahl rename SwDoc::Replace() to ReplaceRange()
2009-08-27 Michael Stahl remove SwDoc::Overwrite() sal_Unicode variant
2009-08-27 Michael Stahl split up SwDoc::DeleteAndJoin(): factor out DeleteAndJoinWithRedline()
2009-08-27 Michael Stahl rename overloaded SwDoc::Delete() to DeleteRange()/DeleteTOXMark()
2009-08-27 Michael Stahl rename SwTxtNode::Copy() to CopyText()
2009-08-27 Michael Stahl rename SwTxtNode::Cut() to CutText(), and _Cut() to CutImpl()
2009-08-27 Michael Stahl rename SwTxtNode::Delete() to DeleteAttribute()/DeleteAttributes()
2009-08-27 Michael Stahl rename SwTxtNode::Replace() to ReplaceText(), and remove the xub_Unicode variant
2009-08-27 Michael Stahl rename SwTxtNode::Erase() to EraseText()
2009-08-27 Michael Stahl rename SwTxtNode::Insert() to InsertText(), and remove the xub_Unicode variant
2009-08-27 Michael Stahl clean up SwTxtNode::Update()
2009-08-27 Michael Stahl remove SwTxtAttr::RemoveFromPool() and make destructor non-public,
to be invoked by new method SwTxtAttr::Destroy()
2009-08-27 Michael Stahl ensure that SwDoc::Insert() for item (set) returns success indicator:
replace SwRegHistory constructor with method InsertItems(), returning bool.
refactor InsAttr() so that it checks if InsertItems() succeeds.
2009-08-27 Michael Stahl move SwXTextPortionEnumeration from unoobj.hxx to unoport.hxx
2009-08-27 Michael Stahl add missing SolarMutex in SwXTextPortion methods
2009-08-27 Michael Stahl SwXTextPortion: new member m_xTextField (so the TextField property need not
be returned indirectly via SwUnoCursorHelper).
factor out function CreateSwXTextField().
2009-08-27 Michael Stahl SwXTextPortion: remove PORTION_CONTROL_CHAR and implementation of XTextField
2009-08-27 Michael Stahl remove obsolete hint SwTxtHardBlank and formats SwFmtHardBlank/SwFmtSoftHyph
2009-08-27 Michael Stahl clean up SwTxtAttr and friends:
remove many accessor methods for obsolete (due to autofmt) char format items.
remove unused flag SwTxtAttr::m_bDontMergeAttr.
MakeRedlineTxtAttr() now dedicated function, no longer calls MakeTxtAttr().
2009-08-27 Michael Stahl remove obsolete attribute SwTxt2Lines
2009-08-27 Michael Stahl SwXTextPortionEnumeration: finish refactoring CreatePortions
change ExportHints so it always returns a text portion for hint w/ CH_TXTATR.
remove special case for handling end of paragraph.
unfortunately had to refactor the fieldmarks export as well (got in the way).
2009-08-27 Michael Stahl SwXTextPortionEnumeration: refactor CreatePortions: frames export
extract function ExportFrames() from CreatePortions().
remove (un)dead code that calls evil MovePara(fnParaCurr, fnParaEnd)
2009-08-27 Michael Stahl clean up SwXParaFrameEnumeration
2009-08-27 Michael Stahl CollectFrameAtNode: replace SwDependArr with STL based FrameDependList_t
2009-08-27 Michael Stahl SwXTextPortionEnumeration: tweak refmark/toxmark export
so ExportHints returns the portion for point marks
2009-08-27 Michael Stahl clean up SwXTextPortionEnumeration:
prefix members, remove casts, replace SvWeirdArray with STL, etc.
make CreatePortions() method a function, and remove lots of members.
extract fieldmarks function from CreatePortions.
2009-08-27 Michael Stahl remove FOREACHUNOPAM_START/END macros
2009-08-27 Michael Stahl clean up SwXTextPortion:
prefix members, remove casts, etc.
remove SwXRubyPortion: replace it with another SwXTextPortion constructor
2009-08-27 Michael Stahl #i102541# SwXReferenceMark::InsertRefMark(): use flag SETATTR_DONTEXPAND
2009-08-27 Michael Stahl rename SwTxtNode::Insert to SwTxtNode::InsertHint, and
fix constness in SwTxtNode::InsertItem
2009-08-27 Michael Stahl turn SwTxtNode::MakeTxtAttr() methods into global functions in ndhints.hxx
2009-08-27 Michael Stahl remove obsolete sw/inc/bookmrk.hxx
2009-08-27 Michael Stahl pam.cxx: fix ComparePosition functions (returned wrong result in one case)
2009-08-27 Michael Stahl #i103613# only import RDF metadata on normal open of a document
2009-09-11 kz CWS-TOOLING: integrate CWS impress176
2009-09-08 20:18:24 +0200 sj r275957 : fixed warning (shadowed variable)
2009-09-08 18:02:05 +0200 cl r275948 : #i104315# added missing tab pages
2009-09-08 17:35:18 +0200 cl r275947 : #i104866# fixed angle import
2009-09-08 17:32:53 +0200 cl r275946 : #i104841# fixed angle import
2009-09-08 17:01:25 +0200 cl r275943 : #i103935# fixed the SID_EVENTCONFIG mess
2009-09-08 14:32:57 +0200 sj r275928 : #i104685# only comments
2009-09-07 12:37:36 +0200 sj r275886 : #i104683# fixed import of bold/italic attributes for normal text shapes
2009-09-04 15:07:46 +0200 sj r275808 : #104689# fixed bullet color problem
2009-09-03 15:25:07 +0200 sj r275753 : #160200# added vertical alignment of table cells
2009-09-11 kz CWS-TOOLING: integrate CWS dv14
2009-09-10 15:16:32 +0200 sg r276035 : #160513# updated wfs scheme to accept ports
2009-09-10 07:41:47 +0200 dv r276019 : #i104942# Better renaming algorithmen
2009-08-31 13:41:11 +0200 dv r275604 : #160505# Setting APP1PRODUCTNAME must not overwrite APP1PRODUCTDEF
2009-09-11 kz CWS-TOOLING: integrate CWS jl131
2009-09-02 16:42:40 +0200 jl r275720 : #i97896#
2009-08-31 13:01:53 +0200 jl r275599 : CWS-TOOLING: rebase CWS jl131 to trunk@275331 (milestone: DEV300:m56)
2009-07-31 14:35:30 +0200 jl r274531 : CWS-TOOLING: rebase CWS jl131 to trunk@274203 (milestone: DEV300:m53)
2009-07-23 14:20:32 +0200 jl r274272 : #i79839# better error text when trying to modify shared layer without having write permission, eg. unopkg add --shared, unopkg remove --shared, unopkg reinstall --shared
2009-07-22 16:38:02 +0200 jl r274252 : #i97896# localize error message for lock file
2009-07-22 16:37:22 +0200 jl r274251 : #i80462# unprecise wording in updatedialog
2009-07-22 16:36:06 +0200 jl r274250 : #i97896# localize error message for lock file
2009-07-22 16:35:20 +0200 jl r274249 : #i97896# localize error message for lock file
2009-07-22 15:07:30 +0200 jl r274242 : #i98873# minimum java version is 1.5 since OOo 3.0
2009-09-11 kz CWS-TOOLING: integrate CWS changehc
2009-08-31 19:38:50 +0200 pl r275633 : remove dbug printf
2009-08-31 17:41:50 +0200 pl r275623 : CWS-TOOLING: rebase CWS changehc to trunk@275331 (milestone: DEV300:m56)
2009-07-15 19:45:46 +0200 pl r274028 : #i35482# use HC flag to decide high contrast mode
2009-07-15 17:40:52 +0200 pl r274020 : #i35482# use HC flag to decide high contrast mode
2009-07-15 17:39:50 +0200 pl r274019 : #i35482# update autohc correctly in MergeSystemSettings
2009-07-15 17:38:57 +0200 pl r274018 : #i35482# update autohc correctly in MergeSystemSettings
2009-09-11 kz CWS-TOOLING: integrate CWS notes10
2009-08-24 07:25:57 +0200 mod r275287 : 2009-07-26 02:38:32 +0200 mod r274343 : #i#i103645#
2009-07-26 02:01:53 +0200 mod r274342 : #i103645#
2009-07-26 01:52:42 +0200 mod r274341 : #i103490#
2009-07-22 08:31:48 +0200 mod r274215 : #i103373#
2009-07-15 00:55:11 +0200 mod r273987 : #i101419#
2009-07-14 07:07:55 +0200 mod r273956 : #i101419#
2009-07-14 07:07:43 +0200 mod r273955 : #i101419#
2009-07-14 07:02:10 +0200 mod r273954 : changes from notes9
2009-07-14 06:14:25 +0200 mod r273953 : #i103476#
2009-09-11 kz CWS-TOOLING: integrate CWS ab70
2009-09-10 15:12:54 +0200 jsk r276034 : #i85434# - mandatory automatic update test
2009-09-10 15:11:06 +0200 jsk r276033 : #i85434# - mandatory automatic update test
2009-09-02 09:49:24 +0200 ab r275698 : #i85434# Dialog Import
2009-09-11 kz CWS-TOOLING: integrate CWS hb32bugs02
2009-09-02 Henning Brinkmann #i102420# revert changes
2009-08-26 Henning Brinkmann merged DEV300_m56
2009-08-19 Henning Brinkmann merged DEV300_m55
2009-08-14 Henning Brinkmann merged changes from wntmsci12
2009-08-12 Henning Brinkmann Implemented NoSpaceEdit constructor and destructor in .cxx to allow compile with debug on wntmsci12.
2009-08-12 Henning Brinkmann Added some SW_DLLPUBLIC to make compilable on wntmsci12.
2009-08-11 Henning Brinkmann #i102420# dbg_out: surround output for SwNodes with <nodes-array>.
2009-08-10 Henning Brinkmann #i102420# rewritten debug output for SwNodes.
2009-08-07 Henning Brinkmann #i102420# debug _MoveNodes: output the destination, too. Break after two iterations.
2009-08-07 Henning Brinkmann #i102420# _MoveNodes: Additionally check if destination index is inside source => false
Check if current range was already handled => loop
Debug output current range
2009-08-06 Henning Brinkmann merged DEV300_m54
2009-08-06 Henning Brinkmann added master fix
2009-08-06 Henning Brinkmann debug output for SwNodeRange
2009-08-04 Henning Brinkmann #i102844# robustness: check for NULL pointer to prevent crash
2009-08-03 Henning Brinkmann #i103475# applied patch and verified
2009-08-03 Henning Brinkmann Removed code preventing build of sw with DEBUG.
2009-09-11 convert-repo update tags
2009-09-10 kz CWS-TOOLING: integrate CWS os2port06dev300
2009-09-05 22:49:00 +0200 ydario r275858 : #i99588# applied os2port06 diff to DEV300 tree.
2009-09-10 kz CWS-TOOLING: integrate CWS mingwport23
2009-08-29 07:07:53 +0200 tono r275555 : i#104522: mingw port graphite
2009-08-29 07:07:26 +0200 tono r275554 : i#104522: mingw port printf format fix
2009-09-10 kz CWS-TOOLING: integrate CWS mh232
2009-08-26 03:52:57 +0200 mh r275385 : #i102182# FreeBSD patch
2009-08-26 03:43:20 +0200 mh r275384 : #i101333# patch for FreeBSD
2009-08-26 03:11:20 +0200 mh r275383 : #i39230
2009-08-26 03:07:51 +0200 mh r275382 : #i39230# more space for initials field
2009-08-26 02:41:19 +0200 mh r275380 : #i39230# use vos::osecurity for reading the user name
2009-08-18 22:06:00 +0200 mh r275130 : #i104243#, line ending problem with newer perl
2009-08-18 21:53:21 +0200 mh r275129 : #i39230# read initials via getpwnam
2009-08-18 21:34:05 +0200 mh r275128 : enable CAIROCANVAS for Linux and Mac, #i88613#
2009-08-17 18:02:59 +0200 mh r275067 : #i95498# make compile with gcc3
2009-09-10 kz CWS-TOOLING: integrate CWS tkr24
2009-09-07 14:31:06 +0200 is r275898 : #160081# adding NO_LICENSE_INTO_COPYRIGHT
2009-09-10 releng #i10000# change KeyMapping to SingletonRef<framework::KeyMapping>
2009-09-11 convert-repo update tags
2009-09-10 kz CWS-TOOLING: integrate CWS os2port06dev300
2009-09-05 22:49:00 +0200 ydario r275858 : #i99588# applied os2port06 diff to DEV300 tree.
2009-09-10 kz CWS-TOOLING: integrate CWS mingwport23
2009-08-29 07:07:53 +0200 tono r275555 : i#104522: mingw port graphite
2009-08-29 07:07:26 +0200 tono r275554 : i#104522: mingw port printf format fix
2009-09-10 kz CWS-TOOLING: integrate CWS mh232
2009-08-26 03:52:57 +0200 mh r275385 : #i102182# FreeBSD patch
2009-08-26 03:43:20 +0200 mh r275384 : #i101333# patch for FreeBSD
2009-08-26 03:11:20 +0200 mh r275383 : #i39230
2009-08-26 03:07:51 +0200 mh r275382 : #i39230# more space for initials field
2009-08-26 02:41:19 +0200 mh r275380 : #i39230# use vos::osecurity for reading the user name
2009-08-18 22:06:00 +0200 mh r275130 : #i104243#, line ending problem with newer perl
2009-08-18 21:53:21 +0200 mh r275129 : #i39230# read initials via getpwnam
2009-08-18 21:34:05 +0200 mh r275128 : enable CAIROCANVAS for Linux and Mac, #i88613#
2009-08-17 18:02:59 +0200 mh r275067 : #i95498# make compile with gcc3
2009-09-10 kz CWS-TOOLING: integrate CWS tkr24
2009-09-07 14:31:06 +0200 is r275898 : #160081# adding NO_LICENSE_INTO_COPYRIGHT
2009-09-10 releng #i10000# change KeyMapping to SingletonRef<framework::KeyMapping>
2009-09-11 14:29:45 +00:00
|
|
|
{
|
|
|
|
pSrcDoc->CopyRange( *pCpyPam, *pPam->GetPoint(),
|
|
|
|
false );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
delete pCpyPam;
|
|
|
|
}
|
|
|
|
if( pCpyRg && pSrcDoc == pDoc &&
|
|
|
|
pCpyRg->aStart < rInsPos && rInsPos < pCpyRg->aEnd )
|
|
|
|
delete pCpyRg, pCpyRg = 0;
|
|
|
|
}
|
|
|
|
else if( pSrcDoc != pDoc )
|
|
|
|
pCpyRg = new SwNodeRange( pSrcDoc->GetNodes().GetEndOfExtras(), 2,
|
|
|
|
pSrcDoc->GetNodes().GetEndOfContent() );
|
|
|
|
|
2011-02-02 20:41:40 +09:00
|
|
|
// #i81653#
|
2008-01-04 12:20:40 +00:00
|
|
|
// Update links of extern linked document or extern linked
|
|
|
|
// document section, if section is protected.
|
|
|
|
if ( pSrcDoc != pDoc &&
|
|
|
|
rSection.IsProtectFlag() )
|
|
|
|
{
|
2012-10-30 11:27:06 +09:00
|
|
|
pSrcDoc->GetLinkManager().UpdateAllLinks( false, true, false, 0 );
|
2008-01-04 12:20:40 +00:00
|
|
|
}
|
2011-04-05 09:45:35 +02:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pCpyRg )
|
|
|
|
{
|
|
|
|
SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bCreateFrm = rInsPos.GetIndex() <=
|
2000-09-18 23:08:29 +00:00
|
|
|
pDoc->GetNodes().GetEndOfExtras().GetIndex() ||
|
|
|
|
rInsPos.GetNode().FindTableNode();
|
|
|
|
|
|
|
|
SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
|
|
|
|
|
2009-07-28 13:59:44 +00:00
|
|
|
pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm );
|
2012-10-15 23:31:02 +02:00
|
|
|
++aSave;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( !bCreateFrm )
|
|
|
|
::MakeFrms( pDoc, aSave, rInsPos );
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Delete last Node, only if it was copied successfully
|
|
|
|
// (the Section contains more than one Node)
|
2000-09-18 23:08:29 +00:00
|
|
|
if( 2 < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() )
|
|
|
|
{
|
|
|
|
aSave = rInsPos;
|
|
|
|
pPam->Move( fnMoveBackward, fnGoNode );
|
2012-10-23 03:13:47 +02:00
|
|
|
pPam->SetMark(); // Rewire both SwPositions
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
pDoc->GetNodes().Delete( aSave, 1 );
|
|
|
|
}
|
|
|
|
delete pCpyRg;
|
|
|
|
}
|
|
|
|
|
2007-05-10 08:14:55 +00:00
|
|
|
lcl_BreakSectionLinksInSect( *pSectNd );
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Update all Links in this Section
|
2000-09-18 23:08:29 +00:00
|
|
|
lcl_UpdateLinksInSect( *this, *pSectNd );
|
|
|
|
}
|
|
|
|
if( xDocSh.Is() )
|
|
|
|
{
|
|
|
|
if( 2 == nRet )
|
|
|
|
xDocSh->DoClose();
|
2002-07-01 10:22:11 +00:00
|
|
|
else if( ((SwDocShell*)&xDocSh)->GetDoc() )
|
2000-09-18 23:08:29 +00:00
|
|
|
((SwDocShell*)&xDocSh)->GetDoc()->SetRedlineMode(
|
|
|
|
eOldRedlineMode );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Only create DDE if Shell is available!
|
2007-09-27 07:42:28 +00:00
|
|
|
uno::Sequence< sal_Int8 > aSeq;
|
2001-03-13 18:43:46 +00:00
|
|
|
if( pRead && rValue.hasValue() && ( rValue >>= aSeq ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-03-13 18:43:46 +00:00
|
|
|
if( pESh )
|
|
|
|
{
|
|
|
|
pESh->Push();
|
|
|
|
SwPaM* pCrsr = pESh->GetCrsr();
|
|
|
|
*pCrsr->GetPoint() = *pPam->GetPoint();
|
|
|
|
delete pPam;
|
|
|
|
pPam = pCrsr;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-03-08 20:28:23 +00:00
|
|
|
SvMemoryStream aStrm( (void*)aSeq.getConstArray(), aSeq.getLength(),
|
|
|
|
STREAM_READ );
|
|
|
|
aStrm.Seek( 0 );
|
|
|
|
|
2005-01-11 11:18:56 +00:00
|
|
|
// TODO/MBA: it's impossible to set a BaseURL here!
|
|
|
|
SwReader aTmpReader( aStrm, aEmptyStr, pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam );
|
2001-03-13 18:43:46 +00:00
|
|
|
|
|
|
|
if( !IsError( aTmpReader.Read( *pRead ) ))
|
2010-03-16 11:28:30 +01:00
|
|
|
{
|
|
|
|
rSection.SetConnectFlag(true);
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-03-13 18:43:46 +00:00
|
|
|
if( pESh )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
pESh->Pop( sal_False );
|
2012-10-23 03:13:47 +02:00
|
|
|
pPam = 0; // pam was deleted earlier
|
2001-03-13 18:43:46 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 14:31:08 +01:00
|
|
|
// remove all undo actions and turn undo on again
|
|
|
|
pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
|
|
|
|
pDoc->GetIDocumentUndoRedo().DoUndo(bWasUndo);
|
2000-09-18 23:08:29 +00:00
|
|
|
pDoc->SetVisibleLinks( bWasVisibleLinks );
|
|
|
|
|
|
|
|
pDoc->UnlockExpFlds();
|
|
|
|
if( !pDoc->IsExpFldsLocked() )
|
2006-08-14 15:05:32 +00:00
|
|
|
pDoc->UpdateExpFlds(NULL, true);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( pESh )
|
|
|
|
pESh->EndAllAction();
|
|
|
|
else if( pVSh )
|
|
|
|
pVSh->EndAction();
|
2012-10-23 03:13:47 +02:00
|
|
|
delete pPam; // Was created at the start
|
2011-05-25 14:58:03 -04:00
|
|
|
|
|
|
|
return SUCCESS;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SwIntrnlSectRefLink::Closed()
|
|
|
|
{
|
|
|
|
SwDoc* pDoc = rSectFmt.GetDoc();
|
|
|
|
if( pDoc && !pDoc->IsInDtor() )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
// Advise says goodbye: mark the Section as not protected
|
|
|
|
// and change the Flag
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwSectionFmts& rFmts = pDoc->GetSections();
|
2012-06-20 16:36:51 +02:00
|
|
|
for( sal_uInt16 n = rFmts.size(); n; )
|
2000-09-18 23:08:29 +00:00
|
|
|
if( rFmts[ --n ] == &rSectFmt )
|
|
|
|
{
|
|
|
|
ViewShell* pSh;
|
|
|
|
SwEditShell* pESh = pDoc->GetEditShell( &pSh );
|
|
|
|
|
|
|
|
if( pESh )
|
|
|
|
pESh->StartAllAction();
|
|
|
|
else
|
|
|
|
pSh->StartAction();
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionData aSectionData(*rSectFmt.GetSection());
|
|
|
|
aSectionData.SetType( CONTENT_SECTION );
|
|
|
|
aSectionData.SetLinkFileName( aEmptyStr );
|
|
|
|
aSectionData.SetHidden( false );
|
|
|
|
aSectionData.SetProtectFlag( false );
|
2011-02-08 08:51:51 +01:00
|
|
|
// edit in readonly sections
|
2010-03-16 11:28:30 +01:00
|
|
|
aSectionData.SetEditInReadonlyFlag( false );
|
2004-11-16 09:22:48 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
aSectionData.SetConnectFlag( false );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
pDoc->UpdateSection( n, aSectionData );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Make all Links within the Section visible again
|
2011-01-17 15:06:54 +01:00
|
|
|
SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( pSectNd )
|
|
|
|
pSectNd->GetSection().MakeChildLinksVisible( *pSectNd );
|
|
|
|
|
|
|
|
if( pESh )
|
|
|
|
pESh->EndAllAction();
|
|
|
|
else
|
|
|
|
pSh->EndAction();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SvBaseLink::Closed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SwSection::CreateLink( LinkCreateType eCreateType )
|
|
|
|
{
|
|
|
|
SwSectionFmt* pFmt = GetFmt();
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFmt, "SwSection::CreateLink: no format?");
|
2010-03-16 11:28:30 +01:00
|
|
|
if (!pFmt || (CONTENT_SECTION == m_Data.GetType()))
|
2000-09-18 23:08:29 +00:00
|
|
|
return ;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nUpdateType = sfx2::LINKUPDATE_ALWAYS;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:31 +01:00
|
|
|
if (!m_RefLink.Is())
|
|
|
|
{
|
|
|
|
// create BaseLink
|
|
|
|
m_RefLink = new SwIntrnlSectRefLink( *pFmt, nUpdateType, FORMAT_RTF );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2010-03-16 11:28:31 +01:00
|
|
|
{
|
|
|
|
pFmt->GetDoc()->GetLinkManager().Remove( m_RefLink );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:31 +01:00
|
|
|
SwIntrnlSectRefLink *const pLnk =
|
|
|
|
static_cast<SwIntrnlSectRefLink*>(& m_RefLink);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
String sCmd( m_Data.GetLinkFileName() );
|
2000-09-18 23:08:29 +00:00
|
|
|
xub_StrLen nPos;
|
|
|
|
while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( " " )) )
|
|
|
|
sCmd.Erase( nPos, 1 );
|
|
|
|
|
|
|
|
pLnk->SetUpdateMode( nUpdateType );
|
|
|
|
pLnk->SetVisible( pFmt->GetDoc()->IsVisibleLinks() );
|
|
|
|
|
2010-03-16 11:28:30 +01:00
|
|
|
switch (m_Data.GetType())
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
case DDE_LINK_SECTION:
|
2001-03-08 20:28:23 +00:00
|
|
|
pLnk->SetLinkSourceName( sCmd );
|
|
|
|
pFmt->GetDoc()->GetLinkManager().InsertDDELink( pLnk );
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
case FILE_LINK_SECTION:
|
|
|
|
{
|
|
|
|
pLnk->SetContentType( FORMAT_FILE );
|
2013-05-15 10:42:04 +03:00
|
|
|
String sFltr( sCmd.GetToken( 1, sfx2::cTokenSeparator ) );
|
|
|
|
String sRange( sCmd.GetToken( 2, sfx2::cTokenSeparator ) );
|
2007-09-27 07:42:28 +00:00
|
|
|
pFmt->GetDoc()->GetLinkManager().InsertFileLink( *pLnk,
|
2011-01-17 15:06:54 +01:00
|
|
|
static_cast<sal_uInt16>(m_Data.GetType()),
|
2013-05-15 10:42:04 +03:00
|
|
|
sCmd.GetToken( 0, sfx2::cTokenSeparator ),
|
2000-09-18 23:08:29 +00:00
|
|
|
( sFltr.Len() ? &sFltr : 0 ),
|
|
|
|
( sRange.Len() ? &sRange : 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2012-10-23 03:13:47 +02:00
|
|
|
OSL_ENSURE( !this, "What kind of Link is this?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( eCreateType )
|
|
|
|
{
|
2012-10-23 03:13:47 +02:00
|
|
|
case CREATE_CONNECT: // Connect Link right away
|
2000-09-18 23:08:29 +00:00
|
|
|
pLnk->Connect();
|
|
|
|
break;
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
case CREATE_UPDATE: // Connect Link and update
|
2000-09-18 23:08:29 +00:00
|
|
|
pLnk->Update();
|
|
|
|
break;
|
2007-09-27 07:42:28 +00:00
|
|
|
case CREATE_NONE: break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-10 08:14:55 +00:00
|
|
|
void SwSection::BreakLink()
|
|
|
|
{
|
|
|
|
const SectionType eCurrentType( GetType() );
|
|
|
|
if ( eCurrentType == CONTENT_SECTION ||
|
|
|
|
eCurrentType == TOX_HEADER_SECTION ||
|
|
|
|
eCurrentType == TOX_CONTENT_SECTION )
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-23 03:13:47 +02:00
|
|
|
// Release link, if it exists
|
2010-03-16 11:28:31 +01:00
|
|
|
if (m_RefLink.Is())
|
2007-05-10 08:14:55 +00:00
|
|
|
{
|
2010-03-16 11:28:30 +01:00
|
|
|
SwSectionFmt *const pFormat( GetFmt() );
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pFormat, "SwSection::BreakLink: no format?");
|
2010-03-16 11:28:30 +01:00
|
|
|
if (pFormat)
|
2007-05-10 08:14:55 +00:00
|
|
|
{
|
2010-03-16 11:28:31 +01:00
|
|
|
pFormat->GetDoc()->GetLinkManager().Remove( m_RefLink );
|
2007-05-10 08:14:55 +00:00
|
|
|
}
|
2010-03-16 11:28:31 +01:00
|
|
|
m_RefLink.Clear();
|
2007-05-10 08:14:55 +00:00
|
|
|
}
|
|
|
|
// change type
|
|
|
|
SetType( CONTENT_SECTION );
|
|
|
|
// reset linked file data
|
|
|
|
SetLinkFileName( aEmptyStr );
|
2010-03-16 11:28:30 +01:00
|
|
|
SetLinkFilePassword( aEmptyStr );
|
2007-05-10 08:14:55 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwNode* SwIntrnlSectRefLink::GetAnchor() const
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
return rSectFmt.GetSectionNode( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
|
2007-09-27 07:42:28 +00:00
|
|
|
xub_StrLen , xub_StrLen ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
SwStartNode* pSttNd = rSectFmt.GetSectionNode( sal_False );
|
2000-09-18 23:08:29 +00:00
|
|
|
return pSttNd &&
|
|
|
|
nSttNd < pSttNd->GetIndex() &&
|
|
|
|
pSttNd->EndOfSectionIndex() < nEndNd;
|
|
|
|
}
|
|
|
|
|
2012-06-20 16:36:51 +02:00
|
|
|
sal_uInt16 SwSectionFmts::GetPos(const SwSectionFmt* p) const
|
|
|
|
{
|
|
|
|
const_iterator it = std::find(begin(), end(), p);
|
|
|
|
return it == end() ? USHRT_MAX : it - begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SwSectionFmts::Contains(const SwSectionFmt* p) const
|
|
|
|
{
|
|
|
|
return std::find(begin(), end(), p) != end();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwSectionFmts::~SwSectionFmts()
|
|
|
|
{
|
|
|
|
for(const_iterator it = begin(); it != end(); ++it)
|
|
|
|
delete *it;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|