Files
libreoffice/sw/source/core/docnode/section.cxx

1875 lines
60 KiB
C++
Raw Normal View History

2000-09-18 23:08:29 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:08:29 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:08:29 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 23:08:29 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 23:08:29 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
2000-09-18 23:08:29 +00:00
#include <stdlib.h>
<<<<<<< local
=======
>>>>>>> other
2000-09-18 23:08:29 +00:00
#include <hintids.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
2000-09-18 23:08:29 +00:00
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
#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>
#include <sfx2/sfxsids.hrc>
#include <sfx2/fcontnr.hxx>
2000-09-18 23:08:29 +00:00
#include <docary.hxx>
#include <fmtcntnt.hxx>
#include <fmtpdsc.hxx>
#include <errhdl.hxx>
#include <doc.hxx>
#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>
#include <fmteiro.hxx>
2000-09-18 23:08:29 +00:00
#include <swerror.h>
#include <unosection.hxx>
#include <switerator.hxx>
#include <svl/smplhint.hxx>
2000-09-18 23:08:29 +00:00
using namespace ::com::sun::star;
SV_IMPL_REF( SwServerObject )
2000-09-18 23:08:29 +00:00
//static const char __FAR_DATA sSectionFmtNm[] = "Section";
#define sSectionFmtNm aEmptyStr
class SwIntrnlSectRefLink : public SwBaseLink
{
SwSectionFmt& rSectFmt;
public:
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();
virtual void DataChanged( const String& rMimeType,
const uno::Any & rValue );
2000-09-18 23:08:29 +00:00
virtual const SwNode* GetAnchor() const;
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;
// --> OD 2007-02-14 #b6521322#
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 );
typedef SwSection* SwSectionPtr;
SV_IMPL_PTRARR( SwSections, SwSection*)
SV_IMPL_PTRARR(SwSectionFmts,SwSectionFmt*)
SwSectionData::SwSectionData(SectionType const eType, String const& rName)
: m_eType(eType)
, m_sSectionName(rName)
, m_bHiddenFlag(false)
, m_bProtectFlag(false)
// --> FME 2004-06-22 #114856# edit in readonly sections
, m_bEditInReadonlyFlag(false)
// <--
, m_bHidden(false)
, m_bCondHiddenFlag(true)
, m_bConnectFlag(true)
{
}
2000-09-18 23:08:29 +00:00
// this must have the same semantics as operator=()
SwSectionData::SwSectionData(SwSection const& rSection)
: m_eType(rSection.GetType())
, m_sSectionName(rSection.GetSectionName())
, m_sCondition(rSection.GetCondition())
, m_sLinkFileName(rSection.GetLinkFileName())
, m_sLinkFilePassword(rSection.GetLinkFilePassword())
, m_Password(rSection.GetPassword())
, m_bHiddenFlag(rSection.IsHiddenFlag())
, m_bProtectFlag(rSection.IsProtect())
// --> FME 2004-06-22 #114856# edit in readonly sections
, m_bEditInReadonlyFlag(rSection.IsEditInReadonly())
// <--
, m_bHidden(rSection.IsHidden())
, m_bCondHiddenFlag(true)
, m_bConnectFlag(rSection.IsConnectFlag())
2000-09-18 23:08:29 +00: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)
// --> FME 2004-06-22 #114856# edit in readonly sections
, 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
// 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() )
{
SetHidden( true );
}
2000-09-18 23:08:29 +00:00
m_Data.SetProtectFlag( pParentSect->IsProtectFlag() );
// --> FME 2004-06-22 #114856# edit in readonly sections
m_Data.SetEditInReadonlyFlag( pParentSect->IsEditInReadonlyFlag() );
// <--
2000-09-18 23:08:29 +00:00
}
if (!m_Data.IsProtectFlag())
{
m_Data.SetProtectFlag( rFormat.GetProtect().IsCntntProtected() );
}
// --> FME 2004-06-22 #114856# edit in readonly sections
if (!m_Data.IsEditInReadonlyFlag())
{
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() )
{
// dann melden wir noch schnell unser Format um ans dflt FrameFmt,
// damit es keine Abhaengigkeiten gibt
if( pFmt->DerivedFrom() != pDoc->GetDfltFrmFmt() )
pFmt->RegisterToFormat( *pDoc->GetDfltFrmFmt() );
2000-09-18 23:08:29 +00:00
}
else
{
pFmt->Remove( this ); // austragen,
if (CONTENT_SECTION != m_Data.GetType())
{
pDoc->GetLinkManager().Remove( m_RefLink );
}
2000-09-18 23:08:29 +00:00
if (m_RefObj.Is())
{
pDoc->GetLinkManager().RemoveServer( &m_RefObj );
}
2000-09-18 23:08:29 +00:00
// ist die Section der letzte Client im Format, kann dieses
// geloescht werden
SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
pFmt->ModifyNotification( &aMsgHint, &aMsgHint );
2000-09-18 23:08:29 +00:00
if( !pFmt->GetDepends() )
{
// Bug: 28191 - nicht ins Undo aufnehmen, sollte schon vorher
// geschehen sein!!
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
2000-09-18 23:08:29 +00:00
pDoc->DelSectionFmt( pFmt ); // und loeschen
}
}
if (m_RefObj.Is())
{
m_RefObj->Closed();
}
2000-09-18 23:08:29 +00:00
}
void SwSection::SetSectionData(SwSectionData const& rData)
2000-09-18 23:08:29 +00:00
{
bool const bOldHidden( m_Data.IsHidden() );
m_Data = rData;
// now update format and reflink with new data
// SetLinkFileName(m_Data.GetLinkFileName()); // old code did not do this?
// next 2 may actually overwrite m_Data.m_b{Protect,EditInReadonly}Flag
// 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...
{
ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden());
}
2000-09-18 23:08:29 +00:00
}
bool SwSection::DataEquals(SwSectionData const& rCmp) const
2000-09-18 23:08:29 +00: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());
const_cast<SwSection*>(this)->m_Data.SetProtectFlag(IsProtect());
const_cast<SwSection*>(this)->m_Data
.SetEditInReadonlyFlag(IsEditInReadonly());
bool const bResult( m_Data == rCmp );
const_cast<SwSection*>(this)->m_Data.SetProtectFlag(bProtect);
const_cast<SwSection*>(this)->m_Data.SetEditInReadonlyFlag(bEditInReadonly);
return bResult;
2000-09-18 23:08:29 +00:00
}
void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition)
2000-09-18 23:08:29 +00:00
{
SwSectionFmt* pFmt = GetFmt();
ASSERT(pFmt, "ImplSetHiddenFlag: no format?");
2000-09-18 23:08:29 +00:00
if( pFmt )
{
const bool bHide = bTmpHidden && bCondition;
2000-09-18 23:08:29 +00:00
if (bHide) // should be hidden
2000-09-18 23:08:29 +00:00
{
if (!m_Data.IsHiddenFlag()) // is not hidden
2000-09-18 23:08:29 +00:00
{
// wie sieht es mit dem Parent aus, ist der versteckt ?
// (eigentlich muesste das vom bHiddenFlag angezeigt werden!)
// erstmal allen Childs sagen, das sie versteckt sind
SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
pFmt->ModifyNotification( &aMsgItem, &aMsgItem );
2000-09-18 23:08:29 +00:00
// alle Frames loeschen
pFmt->DelFrms();
}
}
else if (m_Data.IsHiddenFlag()) // show Nodes again
2000-09-18 23:08:29 +00:00
{
// alle Frames sichtbar machen ( Childs Sections werden vom
// MakeFrms beruecksichtigt). Aber nur wenn die ParentSection
// nichts dagegen hat !
SwSection* pParentSect = pFmt->GetParentSection();
if( !pParentSect || !pParentSect->IsHiddenFlag() )
{
// erstmal allen Childs sagen, das der Parent nicht mehr
// versteckt ist
SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
pFmt->ModifyNotification( &aMsgItem, &aMsgItem );
2000-09-18 23:08:29 +00:00
pFmt->MakeFrms();
}
}
}
}
sal_Bool SwSection::CalcHiddenFlag() const
2000-09-18 23:08:29 +00:00
{
const SwSection* pSect = this;
do {
if( pSect->IsHidden() && pSect->IsCondHidden() )
return sal_True;
2000-09-18 23:08:29 +00:00
} while( 0 != ( pSect = pSect->GetParent()) );
return sal_False;
2000-09-18 23:08:29 +00:00
}
bool SwSection::IsProtect() const
2000-09-18 23:08:29 +00:00
{
SwSectionFmt *const pFmt( GetFmt() );
ASSERT(pFmt, "SwSection::IsProtect: no format?");
return (pFmt)
? pFmt->GetProtect().IsCntntProtected()
: IsProtectFlag();
2000-09-18 23:08:29 +00:00
}
// --> FME 2004-06-22 #114856# edit in readonly sections
bool SwSection::IsEditInReadonly() const
{
SwSectionFmt *const pFmt( GetFmt() );
ASSERT(pFmt, "SwSection::IsEditInReadonly: no format?");
return (pFmt)
? pFmt->GetEditInReadonly().GetValue()
: IsEditInReadonlyFlag();
}
// <--
2000-09-18 23:08:29 +00:00
void SwSection::SetHidden(bool const bFlag)
2000-09-18 23:08:29 +00:00
{
if (!m_Data.IsHidden() == !bFlag)
2000-09-18 23:08:29 +00:00
return;
m_Data.SetHidden(bFlag);
ImplSetHiddenFlag(bFlag, m_Data.IsCondHidden());
2000-09-18 23:08:29 +00:00
}
void SwSection::SetProtect(bool const bFlag)
2000-09-18 23:08:29 +00:00
{
SwSectionFmt *const pFormat( GetFmt() );
ASSERT(pFormat, "SwSection::SetProtect: no format?");
if (pFormat)
2000-09-18 23:08:29 +00:00
{
SvxProtectItem aItem( RES_PROTECT );
aItem.SetCntntProtect( (sal_Bool)bFlag );
pFormat->SetFmtAttr( aItem );
// note: this will call m_Data.SetProtectFlag via Modify!
2000-09-18 23:08:29 +00:00
}
else
{
m_Data.SetProtectFlag(bFlag);
}
2000-09-18 23:08:29 +00:00
}
// --> FME 2004-06-22 #114856# edit in readonly sections
void SwSection::SetEditInReadonly(bool const bFlag)
{
SwSectionFmt *const pFormat( GetFmt() );
ASSERT(pFormat, "SwSection::SetEditInReadonly: no format?");
if (pFormat)
{
SwFmtEditInReadonly aItem;
aItem.SetValue( (sal_Bool)bFlag );
pFormat->SetFmtAttr( aItem );
// note: this will call m_Data.SetEditInReadonlyFlag via Modify!
}
else
{
m_Data.SetEditInReadonlyFlag(bFlag);
}
}
// <--
2000-09-18 23:08:29 +00:00
void SwSection::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
2000-09-18 23:08:29 +00: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(
RES_PROTECT, sal_False, &pItem ) )
2000-09-18 23:08:29 +00: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 );
}
// --> FME 2004-06-22 #114856# edit in readonly sections
if( SFX_ITEM_SET == pNewSet->GetItemState(
RES_EDIT_IN_READONLY, sal_False, &pItem ) )
{
m_Data.SetEditInReadonlyFlag(
static_cast<SwFmtEditInReadonly const*>(pItem)->GetValue());
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(
RES_FTN_AT_TXTEND, sal_False, &pItem ) ||
2000-09-18 23:08:29 +00:00
SFX_ITEM_SET == pNewSet->GetItemState(
RES_END_AT_TXTEND, sal_False, &pItem ))
{
bUpdateFtn = true;
}
2000-09-18 23:08:29 +00:00
if( !pNewSet->Count() )
return;
}
break;
case RES_PROTECT:
if( pNew )
{
bool bNewFlag =
static_cast<const SvxProtectItem*>(pNew)->IsCntntProtected();
2000-09-18 23:08:29 +00:00
if( !bNewFlag )
{
// Abschalten: teste ob nicht vielleich ueber die Parents
// doch ein Schutzt besteht!
const SwSection* pSect = this;
do {
if( pSect->IsProtect() )
{
bNewFlag = true;
2000-09-18 23:08:29 +00:00
break;
}
pSect = pSect->GetParent();
} while (pSect);
2000-09-18 23:08:29 +00:00
}
m_Data.SetProtectFlag( bNewFlag );
2000-09-18 23:08:29 +00:00
}
return;
// --> FME 2004-06-22 #114856# edit in readonly sections
case RES_EDIT_IN_READONLY:
if( pNew )
{
const bool bNewFlag =
static_cast<const SwFmtEditInReadonly*>(pNew)->GetValue();
m_Data.SetEditInReadonlyFlag( bNewFlag );
}
return;
// <--
2000-09-18 23:08:29 +00:00
case RES_SECTION_HIDDEN:
m_Data.SetHiddenFlag(true);
2000-09-18 23:08:29 +00:00
return;
case RES_SECTION_NOT_HIDDEN:
case RES_SECTION_RESETHIDDENFLAG:
m_Data.SetHiddenFlag( m_Data.IsHidden() && m_Data.IsCondHidden() );
2000-09-18 23:08:29 +00:00
return;
case RES_COL:
/* wird ggf. vom Layout erledigt */
break;
case RES_FTN_AT_TXTEND:
if( pNew && pOld )
{
bUpdateFtn = true;
}
2000-09-18 23:08:29 +00:00
break;
case RES_END_AT_TXTEND:
if( pNew && pOld )
{
bUpdateFtn = true;
}
2000-09-18 23:08:29 +00:00
break;
default:
CheckRegistration( pOld, pNew );
break;
2000-09-18 23:08:29 +00:00
}
if( bRemake )
{
GetFmt()->DelFrms();
GetFmt()->MakeFrms();
}
if( bUpdateFtn )
{
SwSectionNode* pSectNd = GetFmt()->GetSectionNode( sal_False );
2000-09-18 23:08:29 +00:00
if( pSectNd )
pSectNd->GetDoc()->GetFtnIdxs().UpdateFtn(SwNodeIndex( *pSectNd ));
}
}
void SwSection::SetRefObject( SwServerObject* pObj )
2000-09-18 23:08:29 +00:00
{
m_RefObj = pObj;
2000-09-18 23:08:29 +00:00
}
void SwSection::SetCondHidden(bool const bFlag)
2000-09-18 23:08:29 +00:00
{
if (!m_Data.IsCondHidden() == !bFlag)
2000-09-18 23:08:29 +00:00
return;
m_Data.SetCondHidden(bFlag);
ImplSetHiddenFlag(m_Data.IsHidden(), bFlag);
2000-09-18 23:08:29 +00:00
}
// setze/erfrage den gelinkten FileNamen
const String& SwSection::GetLinkFileName() const
{
if (m_RefLink.Is())
2000-09-18 23:08:29 +00:00
{
String sTmp;
switch (m_Data.GetType())
2000-09-18 23:08:29 +00:00
{
case DDE_LINK_SECTION:
sTmp = m_RefLink->GetLinkSourceName();
2000-09-18 23:08:29 +00:00
break;
case FILE_LINK_SECTION:
{
String sRange, sFilter;
if (m_RefLink->GetLinkManager() &&
m_RefLink->GetLinkManager()->GetDisplayNames(
m_RefLink, 0, &sTmp, &sRange, &sFilter ))
2000-09-18 23:08:29 +00:00
{
( sTmp += sfx2::cTokenSeperator ) += sFilter;
( sTmp += sfx2::cTokenSeperator ) += sRange;
2000-09-18 23:08:29 +00:00
}
else if( GetFmt() && !GetFmt()->GetSectionNode() )
{
// ist die Section im UndoNodesArray, dann steht
// der Link nicht im LinkManager, kann also auch nicht
// erfragt werden. Dann returne den akt. Namen
return m_Data.GetLinkFileName();
2000-09-18 23:08:29 +00:00
}
}
break;
default: break;
2000-09-18 23:08:29 +00:00
}
const_cast<SwSection*>(this)->m_Data.SetLinkFileName(sTmp);
2000-09-18 23:08:29 +00:00
}
return m_Data.GetLinkFileName();
2000-09-18 23:08:29 +00:00
}
void SwSection::SetLinkFileName(const String& rNew, String const*const pPassWd)
2000-09-18 23:08:29 +00:00
{
if (m_RefLink.Is())
{
m_RefLink->SetLinkSourceName( rNew );
}
m_Data.SetLinkFileName(rNew);
2000-09-18 23:08:29 +00:00
if( pPassWd )
{
SetLinkFilePassword( *pPassWd );
}
2000-09-18 23:08:29 +00:00
}
// falls es ein gelinkter Bereich war, dann muessen alle
// Child-Verknuepfungen sichtbar bemacht werden.
void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd )
{
const SwNode* pNd;
const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks();
for( sal_uInt16 n = rLnks.Count(); n; )
2000-09-18 23:08:29 +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() ) )
{
pNd = pNd->StartOfSectionNode(); // falls SectionNode ist!
2000-09-18 23:08:29 +00:00
const SwSectionNode* pParent;
while( 0 != ( pParent = pNd->FindSectionNode() ) &&
( CONTENT_SECTION == pParent->GetSection().GetType()
|| pNd == &rSectNd ))
pNd = pParent->StartOfSectionNode();
2000-09-18 23:08:29 +00:00
// steht nur noch in einer normalen Section, also
// wieder anzeigen
if( !pParent )
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;
}
// SwSectionFmt ========================================================
2000-09-18 23:08:29 +00:00
SwSectionFmt::SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc )
: SwFrmFmt( pDoc->GetAttrPool(), sSectionFmtNm, pDrvdFrm )
{
LockModify();
SetFmtAttr( *GetDfltAttr( RES_COL ) );
2000-09-18 23:08:29 +00:00
UnlockModify();
}
SwSectionFmt::~SwSectionFmt()
{
if( !GetDoc()->IsInDtor() )
{
SwSectionNode* pSectNd;
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();
// falls es ein gelinkter Bereich war, dann muessen alle
// Child-Verknuepfungen sichtbar bemacht werden.
if( rSect.IsConnected() )
rSect.MakeChildLinksVisible( *pSectNd );
// vorm loeschen der Nodes pruefe, ob wir uns nicht
// noch anzeigen muessen!
if( rSect.IsHiddenFlag() )
{
SwSectionPtr pParentSect = rSect.GetParent();
if( !pParentSect || !pParentSect->IsHiddenFlag() )
{
// Nodes wieder anzeigen
rSect.SetHidden(false);
2000-09-18 23:08:29 +00:00
}
}
<<<<<<< local
// mba: test iteration; objects are removed while iterating
CallSwClientNotify( SfxSimpleHint(SFX_HINT_DYING) );
=======
2000-09-18 23:08:29 +00:00
SwClientIter aIter( *this );
SwClient *pLast = aIter.GoStart();
while ( pLast )
{
if ( pLast->IsA( TYPE(SwFrm) ) )
{
SwSectionFrm *pFrm = (SwSectionFrm*)pLast;
SwSectionFrm::MoveCntntAndDelete( pFrm, sal_True );
2000-09-18 23:08:29 +00:00
pLast = aIter.GoStart();
}
else
pLast = aIter++;
}
>>>>>>> other
2000-09-18 23:08:29 +00:00
// hebe die Section doch mal auf
SwNodeRange aRg( *pSectNd, 0, *pSectNd->EndOfSectionNode() );
GetDoc()->GetNodes().SectionUp( &aRg );
}
LockModify();
ResetFmtAttr( RES_CNTNT );
2000-09-18 23:08:29 +00:00
UnlockModify();
}
}
SwSection * SwSectionFmt::GetSection() const
2000-09-18 23:08:29 +00:00
{
<<<<<<< local
return SwIterator<SwSection,SwSectionFmt>::FirstElement( *this );
=======
2000-09-18 23:08:29 +00:00
if( GetDepends() )
{
SwClientIter aIter( *(SwSectionFmt*)this );
return (SwSectionPtr)aIter.First( TYPE(SwSection) );
}
ASSERT( sal_False, "keine Section als Client." )
2000-09-18 23:08:29 +00:00
return 0;
>>>>>>> other
2000-09-18 23:08:29 +00:00
}
extern void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd );
2000-09-18 23:08:29 +00:00
//Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
void SwSectionFmt::DelFrms()
{
SwSectionNode* pSectNd;
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() ))
{
// #147431# : First delete the <SwSectionFrm> of the <SwSectionFmt> instance
// mba: test iteration as objects are removed in iteration
CallSwClientNotify( SfxSimpleHint(SFX_HINT_DYING) );
// Then delete frames of the nested <SwSectionFmt> instances
SwIterator<SwSectionFmt,SwSectionFmt> aIter( *this );
SwSectionFmt *pLast = aIter.First();
while ( pLast )
{
<<<<<<< local
pLast->DelFrms();
pLast = aIter.Next();
=======
2000-09-18 23:08:29 +00:00
if ( pLast->IsA( TYPE(SwFrm) ) )
{
SwSectionFrm *pFrm = (SwSectionFrm*)pLast;
SwSectionFrm::MoveCntntAndDelete( pFrm, sal_False );
2000-09-18 23:08:29 +00:00
pLast = aIter.GoStart();
}
else
{
pLast = aIter++;
}
>>>>>>> other
}
<<<<<<< local
2000-09-18 23:08:29 +00:00
ULONG nEnde = pSectNd->EndOfSectionIndex();
ULONG nStart = pSectNd->GetIndex()+1;
=======
// Then delete frames of the nested <SwSectionFmt> instances
pLast = aIter.GoStart();
while ( pLast )
{
if ( pLast->IsA( TYPE(SwSectionFmt) ) )
{
((SwSectionFmt*)pLast)->DelFrms();
}
pLast = aIter++;
}
// <--
sal_uLong nEnde = pSectNd->EndOfSectionIndex();
sal_uLong nStart = pSectNd->GetIndex()+1;
>>>>>>> other
2000-09-18 23:08:29 +00:00
lcl_DeleteFtn( pSectNd, nStart, nEnde );
}
if( pIdx )
{
//JP 22.09.98:
//Hint fuer Pagedesc versenden. Das mueste eigntlich das Layout im
//Paste der Frames selbst erledigen, aber das fuehrt dann wiederum
//zu weiteren Folgefehlern, die mit Laufzeitkosten geloest werden
//muesten. #56977# #55001# #56135#
SwNodeIndex aNextNd( *pIdx );
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 );
pCNd->ModifyNotification( (SfxPoolItem*)&rItem, (SfxPoolItem*)&rItem );
2000-09-18 23:08:29 +00:00
}
}
}
//Erzeugt die Ansichten
void SwSectionFmt::MakeFrms()
{
SwSectionNode* pSectNd;
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 );
}
}
void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
2000-09-18 23:08:29 +00:00
{
sal_Bool bClients = sal_False;
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(
RES_PROTECT, sal_False, &pItem ))
2000-09-18 23:08:29 +00:00
{
ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
2000-09-18 23:08:29 +00:00
pNewSet->ClearItem( RES_PROTECT );
pOldSet->ClearItem( RES_PROTECT );
}
// --> FME 2004-06-22 #114856# edit in readonly sections
if( SFX_ITEM_SET == pNewSet->GetItemState(
RES_EDIT_IN_READONLY, sal_False, &pItem ) )
{
ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
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(
RES_FTN_AT_TXTEND, sal_False, &pItem ))
2000-09-18 23:08:29 +00: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(
RES_END_AT_TXTEND, sal_False, &pItem ))
2000-09-18 23:08:29 +00: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:
case RES_END_AT_TXTEND : bClients = sal_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() ) ) )
{
ModifyBroadcast( pOld, pNew );
2000-09-18 23:08:29 +00:00
}
}
return ;
case RES_PROTECT:
// --> FME 2004-06-22 #114856# edit in readonly sections
case RES_EDIT_IN_READONLY:
// <--
2000-09-18 23:08:29 +00:00
// diese Messages bis zum Ende des Baums durchreichen !
if( GetDepends() )
{
ModifyBroadcast( pOld, pNew );
2000-09-18 23:08:29 +00:00
}
return; // das wars
case RES_OBJECTDYING:
if( !GetDoc()->IsInDtor() &&
((SwPtrMsgPoolItem *)pOld)->pObject == (void*)GetRegisteredIn() )
{
// mein Parent wird vernichtet, dann an den Parent vom Parent
// umhaengen und wieder aktualisieren
SwFrmFmt::Modify( pOld, pNew ); // erst umhaengen !!!
UpdateParent();
return;
}
break;
case RES_FMT_CHG:
if( !GetDoc()->IsInDtor() &&
((SwFmtChg*)pNew)->pChangedFmt == (void*)GetRegisteredIn() &&
((SwFmtChg*)pNew)->pChangedFmt->IsA( TYPE( SwSectionFmt )) )
{
// mein Parent wird veraendert, muss mich aktualisieren
SwFrmFmt::Modify( pOld, pNew ); // erst umhaengen !!!
UpdateParent();
return;
}
break;
}
SwFrmFmt::Modify( pOld, pNew );
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
}
// erfrage vom Format Informationen
sal_Bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const
2000-09-18 23:08:29 +00:00
{
switch( rInfo.Which() )
{
case RES_FINDNEARESTNODE:
if( ((SwFmtPageDesc&)GetFmtAttr( RES_PAGEDESC )).GetPageDesc() )
2000-09-18 23:08:29 +00:00
{
const SwSectionNode* pNd = GetSectionNode();
if( pNd )
((SwFindNearestNode&)rInfo).CheckNode( *pNd );
}
return sal_True;
2000-09-18 23:08:29 +00:00
case RES_CONTENT_VISIBLE:
{
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)
{
SwIterator<SwSectionFmt,SwSectionFmt> aFormatIter(*this);
SwSectionFmt* pChild = aFormatIter.First();
2000-09-18 23:08:29 +00:00
while(pChild && !pFrm)
{
pFrm = SwIterator<SwFrm,SwFmt>::FirstElement(*pChild);
pChild = aFormatIter.Next();
2000-09-18 23:08:29 +00:00
}
}
((SwPtrMsgPoolItem&)rInfo).pObject = pFrm;
}
return sal_False;
2000-09-18 23:08:29 +00:00
}
return SwModify::GetInfo( rInfo );
}
extern "C" {
int
#if defined( WNT )
__cdecl
#endif
#if defined( ICC )
_Optlink
#endif
lcl_SectionCmpPos( const void *pFirst, const void *pSecond)
{
const SwSectionFmt* pFSectFmt = (*(SwSectionPtr*)pFirst)->GetFmt();
const SwSectionFmt* pSSectFmt = (*(SwSectionPtr*)pSecond)->GetFmt();
ASSERT( pFSectFmt && pSSectFmt &&
pFSectFmt->GetCntnt(sal_False).GetCntntIdx() &&
pSSectFmt->GetCntnt(sal_False).GetCntntIdx(),
2000-09-18 23:08:29 +00:00
"ungueltige Sections" );
return (int)((long)pFSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex()) -
pSSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex();
2000-09-18 23:08:29 +00:00
}
int
#if defined( WNT )
__cdecl
#endif
#if defined( ICC )
_Optlink
#endif
lcl_SectionCmpNm( const void *pFirst, const void *pSecond)
{
const SwSectionPtr pFSect = *(SwSectionPtr*)pFirst;
const SwSectionPtr pSSect = *(SwSectionPtr*)pSecond;
ASSERT( pFSect && pSSect, "ungueltige Sections" );
StringCompare const eCmp =
pFSect->GetSectionName().CompareTo( pSSect->GetSectionName() );
2000-09-18 23:08:29 +00:00
return eCmp == COMPARE_EQUAL ? 0
: eCmp == COMPARE_LESS ? 1 : -1;
}
}
// alle Sections, die von dieser abgeleitet sind
sal_uInt16 SwSectionFmt::GetChildSections( SwSections& rArr,
2000-09-18 23:08:29 +00:00
SectionSort eSort,
sal_Bool bAllSections ) const
2000-09-18 23:08:29 +00:00
{
rArr.Remove( 0, rArr.Count() );
if( GetDepends() )
{
SwIterator<SwSectionFmt,SwSectionFmt> aIter(*this);
2000-09-18 23:08:29 +00:00
const SwNodeIndex* pIdx;
for( SwSectionFmt* pLast = aIter.First(); pLast; pLast = aIter.Next() )
2000-09-18 23:08:29 +00:00
if( bAllSections ||
<<<<<<< local
( 0 != ( pIdx = pLast->GetCntnt(FALSE).
=======
( 0 != ( pIdx = ((SwSectionFmt*)pLast)->GetCntnt(sal_False).
>>>>>>> other
2000-09-18 23:08:29 +00:00
GetCntntIdx()) && &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
{
const SwSection* Dummy = pLast->GetSection();
2000-09-18 23:08:29 +00:00
rArr.C40_INSERT( SwSection,
Dummy,
rArr.Count() );
}
// noch eine Sortierung erwuenscht ?
if( 1 < rArr.Count() )
switch( eSort )
{
case SORTSECT_NAME:
qsort( (void*)rArr.GetData(),
rArr.Count(),
sizeof( SwSectionPtr ),
lcl_SectionCmpNm );
break;
case SORTSECT_POS:
qsort( (void*)rArr.GetData(),
rArr.Count(),
sizeof( SwSectionPtr ),
lcl_SectionCmpPos );
break;
case SORTSECT_NOT: break;
2000-09-18 23:08:29 +00:00
}
}
return rArr.Count();
}
// erfrage, ob sich die Section im Nodes-Array oder UndoNodes-Array
// befindet.
sal_Bool SwSectionFmt::IsInNodesArr() const
2000-09-18 23:08:29 +00:00
{
const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx();
2000-09-18 23:08:29 +00:00
return pIdx && &pIdx->GetNodes() == &GetDoc()->GetNodes();
}
void SwSectionFmt::UpdateParent() // Parent wurde veraendert
{
if( !GetDepends() )
return;
SwSectionPtr pSection = 0;
const SvxProtectItem* pProtect(0);
// --> FME 2004-06-22 #114856# edit in readonly sections
const SwFmtEditInReadonly* pEditInReadonly = 0;
// <--
bool bIsHidden = false;
2000-09-18 23:08:29 +00:00
SwClientIter aIter( *this ); // TODO
::SwClient * pLast = aIter.GoStart();
2000-09-18 23:08:29 +00:00
if( pLast ) // konnte zum Anfang gesprungen werden ??
do {
if( pLast->IsA( TYPE(SwSectionFmt) ) )
{
if( !pSection )
{
pSection = GetSection();
if( GetRegisteredIn() )
{
const SwSectionPtr pPS = GetParentSection();
pProtect = &pPS->GetFmt()->GetProtect();
// --> FME 2004-06-22 #114856# edit in readonly sections
pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
// <--
2000-09-18 23:08:29 +00:00
bIsHidden = pPS->IsHiddenFlag();
}
else
{
pProtect = &GetProtect();
// --> FME 2004-06-22 #114856# edit in readonly sections
pEditInReadonly = &GetEditInReadonly();
// <--
2000-09-18 23:08:29 +00:00
bIsHidden = pSection->IsHidden();
}
}
if (!pProtect->IsCntntProtected() !=
!pSection->IsProtectFlag())
{
pLast->ModifyNotification( (SfxPoolItem*)pProtect,
2000-09-18 23:08:29 +00:00
(SfxPoolItem*)pProtect );
}
2000-09-18 23:08:29 +00:00
// --> FME 2004-06-22 #114856# edit in readonly sections
if (!pEditInReadonly->GetValue() !=
!pSection->IsEditInReadonlyFlag())
{
pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly,
(SfxPoolItem*)pEditInReadonly );
}
// <--
2000-09-18 23:08:29 +00:00
if( bIsHidden == pSection->IsHiddenFlag() )
{
SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden
2000-09-18 23:08:29 +00:00
? RES_SECTION_HIDDEN
: RES_SECTION_NOT_HIDDEN ) );
pLast->ModifyNotification( &aMsgItem, &aMsgItem );
2000-09-18 23:08:29 +00:00
}
}
else if( !pSection &&
pLast->IsA( TYPE(SwSection) ) )
{
pSection = (SwSectionPtr)pLast;
if( GetRegisteredIn() )
{
const SwSectionPtr pPS = GetParentSection();
pProtect = &pPS->GetFmt()->GetProtect();
// --> FME 2004-06-22 #114856# edit in readonly sections
pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
// <--
2000-09-18 23:08:29 +00:00
bIsHidden = pPS->IsHiddenFlag();
}
else
{
pProtect = &GetProtect();
// --> FME 2004-06-22 #114856# edit in readonly sections
pEditInReadonly = &GetEditInReadonly();
// <--
2000-09-18 23:08:29 +00:00
bIsHidden = pSection->IsHidden();
}
}
} while( 0 != ( pLast = aIter++ ));
}
SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways)
2000-09-18 23:08:29 +00: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;
}
// ist die Section eine gueltige fuers GlobalDocument?
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() &&
!pNd->StartOfSectionNode()->IsSectionNode() &&
!pNd->StartOfSectionNode()->FindSectionNode() )
2000-09-18 23:08:29 +00:00
return &pNd->GetSection();
return 0;
}
// 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
{
SwNodeIndex const*const pIdx = GetCntnt(sal_False).GetCntntIdx();
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;
}
// --> OD 2007-02-14 #b6521322#
// Method to break section links inside a linked section
void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
{
if ( !rSectNd.GetDoc() )
{
ASSERT( false,
"method <lcl_RemoveSectionLinksInSect(..)> - no Doc at SectionNode" );
return;
}
if ( !rSectNd.GetSection().IsConnected() )
{
ASSERT( false,
"method <lcl_RemoveSectionLinksInSect(..)> - no Link at Section of SectionNode" );
return;
}
const ::sfx2::SvBaseLink* pOwnLink( &(rSectNd.GetSection().GetBaseLink() ) );
const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks();
for ( sal_uInt16 n = rLnks.Count(); n > 0; )
{
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
if ( n > rLnks.Count() )
{
n = rLnks.Count();
}
}
}
}
// <--
2000-09-18 23:08:29 +00:00
void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
{
SwDoc* pDoc = rSectNd.GetDoc();
SwDocShell* pDShell = pDoc->GetDocShell();
if( !pDShell || !pDShell->GetMedium() )
return ;
String sName( pDShell->GetMedium()->GetName() );
SwBaseLink* pBLink;
String sMimeType( SotExchange::GetFormatMimeType( FORMAT_FILE ));
uno::Any aValue;
aValue <<= ::rtl::OUString( sName ); // beliebiger Name
2000-09-18 23:08:29 +00:00
const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
for( sal_uInt16 n = rLnks.Count(); n; )
2000-09-18 23:08:29 +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() ) )
{
// liegt in dem Bereich: also updaten. Aber nur wenns nicht
// im gleichen File liegt
String sFName;
pDoc->GetLinkManager().GetDisplayNames( pBLink, 0, &sFName, 0, 0 );
2000-09-18 23:08:29 +00:00
if( sFName != sName )
{
pBLink->DataChanged( sMimeType, aValue );
2000-09-18 23:08:29 +00:00
// ggfs. neu den Link-Pointer wieder suchen, damit nicht einer
// ausgelassen oder doppelt gerufen wird.
if( n >= rLnks.Count() && 0 != ( n = rLnks.Count() ))
--n;
if( n && pLnk != &(*rLnks[ n ]) )
{
// suchen - kann nur davor liegen!!
while( n )
if( pLnk == &(*rLnks[ --n ] ) )
break;
}
}
}
}
}
// sucht sich die richtige DocShell raus oder erzeugt eine neue:
// Der Return-Wert gibt an, was mit der Shell zu geschehen hat:
// 0 - Fehler, konnte DocShell nicht finden
// 1 - DocShell ist ein existieren Document
// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden ( will be assigned to xLockRef additionaly )
2000-09-18 23:08:29 +00:00
int lcl_FindDocShell( SfxObjectShellRef& xDocSh,
SfxObjectShellLock& xLockRef,
2000-09-18 23:08:29 +00:00
const String& rFileName,
const String& rPasswd,
String& rFilter,
sal_Int16 nVersion,
2000-09-18 23:08:29 +00:00
SwDocShell* pDestSh )
{
if( !rFileName.Len() )
return 0;
// 1. existiert die Datei schon in der Liste aller Dokumente?
INetURLObject aTmpObj( rFileName );
aTmpObj.SetMark( aEmptyStr );
// erstmal nur ueber die DocumentShells laufen und die mit dem
// Namen heraussuchen:
TypeId aType( TYPE(SwDocShell) );
SfxObjectShell* pShell = pDestSh;
sal_Bool bFirst = 0 != pShell;
2000-09-18 23:08:29 +00:00
if( !bFirst )
// keine DocShell uebergeben, also beginne mit der ersten aus der
// DocShell Liste
pShell = SfxObjectShell::GetFirst( &aType );
while( pShell )
{
// die wollen wir haben
SfxMedium* pMed = pShell->GetMedium();
if( pMed && pMed->GetURLObject() == aTmpObj )
{
const SfxPoolItem* pItem;
if( ( SFX_ITEM_SET == pMed->GetItemSet()->GetItemState(
SID_VERSION, sal_False, &pItem ) )
2000-09-18 23:08:29 +00:00
? (nVersion == ((SfxInt16Item*)pItem)->GetValue())
: !nVersion )
{
// gefunden also returnen
xDocSh = pShell;
return 1;
}
}
if( bFirst )
{
bFirst = sal_False;
2000-09-18 23:08:29 +00:00
pShell = SfxObjectShell::GetFirst( &aType );
}
else
pShell = SfxObjectShell::GetNext( *pShell, &aType );
}
// 2. selbst die Date oeffnen
SfxMedium* pMed = new SfxMedium( aTmpObj.GetMainURL(
INetURLObject::NO_DECODE ), STREAM_READ, sal_True );
2000-09-18 23:08:29 +00:00
if( INET_PROT_FILE == aTmpObj.GetProtocol() )
pMed->DownLoad(); // nur mal das Medium anfassen (DownLoaden)
const SfxFilter* pSfxFlt = 0;
if( !pMed->GetError() )
2000-09-18 23:08:29 +00:00
{
String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
SfxFilterMatcher aMatcher( sFactory );
// kein Filter, dann suche ihn. Ansonsten teste, ob der angegebene
// ein gueltiger ist
if( rFilter.Len() )
{
pSfxFlt = aMatcher.GetFilter4FilterName( rFilter );
}
2000-09-18 23:08:29 +00:00
if( nVersion )
pMed->GetItemSet()->Put( SfxInt16Item( SID_VERSION, nVersion ));
if( rPasswd.Len() )
pMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd ));
if( !pSfxFlt )
aMatcher.DetectFilter( *pMed, &pSfxFlt, sal_False, sal_False );
2000-09-18 23:08:29 +00:00
if( pSfxFlt )
{
// ohne Filter geht gar nichts
pMed->SetFilter( pSfxFlt );
2000-09-18 23:08:29 +00:00
// if the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure
xLockRef = new SwDocShell( SFX_CREATE_MODE_INTERNAL );
xDocSh = (SfxObjectShell*)xLockRef;
if( xDocSh->DoLoad( pMed ) )
return 2;
}
2000-09-18 23:08:29 +00:00
}
if( !xDocSh.Is() ) // Medium muss noch geloescht werden
delete pMed;
return 0; // das war wohl nichts
}
void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
const uno::Any & rValue )
2000-09-18 23:08:29 +00:00
{
SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False );
2000-09-18 23:08:29 +00:00
SwDoc* pDoc = rSectFmt.GetDoc();
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
{
// sollten wir schon wieder im Undo stehen?
return ;
}
// --> OD 2005-02-11 #i38810# - Due to possible existing signatures, the
// 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 );
// <--
2000-09-18 23:08:29 +00:00
// Undo immer abschalten
bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
pDoc->GetIDocumentUndoRedo().DoUndo(false);
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();
{
// am Anfang des Bereichs einen leeren TextNode einfuegen
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--;
pDoc->CorrAbs( aIdx, aEndIdx, aPos, sal_True );
2000-09-18 23:08:29 +00:00
pPam = new SwPaM( aPos );
//und alles dahinter liegende loeschen
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);
2000-09-18 23:08:29 +00:00
aIdx++;
pDoc->GetNodes().Delete( aIdx, aEndIdx.GetIndex() - aIdx.GetIndex() );
}
SwSection& rSection = pSectNd->GetSection();
rSection.SetConnectFlag(false);
2000-09-18 23:08:29 +00:00
::rtl::OUString sNewFileName;
2000-09-18 23:08:29 +00:00
Reader* pRead = 0;
switch( nDataFormat )
{
case FORMAT_STRING:
pRead = ReadAscii;
break;
case FORMAT_RTF:
CWS-TOOLING: integrate CWS libmsword 2008-12-18 12:33:19 +0100 kendy r265681 : Export less symbols. 2008-12-17 19:26:56 +0100 kendy r265655 : Move libmsword to the -writer package. 2008-12-15 17:46:16 +0100 kendy r265516 : Enable exceptions for iodetect.cxx. 2008-12-15 15:17:53 +0100 kendy r265504 : Deliver the msword.dll. 2008-12-09 19:38:17 +0100 kendy r265138 : Remove accidentally added method. 2008-12-09 19:33:57 +0100 kendy r265137 : Fix linking on Win32. 2008-12-09 18:37:16 +0100 kendy r265135 : Move SwFltControlStack::Delete() to ww1/fltshell.cxx to fix linking. 2008-12-09 18:01:56 +0100 kendy r265127 : Visibility fixes. 2008-12-09 15:51:52 +0100 kendy r265109 : Fix ambiguous usage of class Color. 2008-12-09 14:54:27 +0100 kendy r265091 : Add #include "precompiled_sw.hxx" to fix --enable-pch build. 2008-12-09 14:44:59 +0100 kendy r265088 : Add #include "precompiled_sw.hxx" to fix --enable-pch build. 2008-12-08 19:14:49 +0100 kendy r265015 : #i96313# Get rid of inc/iodetect.cxx, it's a really bad idea to share code by #ifdefing parts of it, and #including a .cxx file ;-) This change moves it to iodetect.cxx, which is compiled to a .o/.obj that is used where needed. 2008-11-20 17:45:08 +0100 kendy r264083 : #i96313# Make the destruction of Readers consistent. 2008-11-20 17:18:11 +0100 kendy r264070 : #i96313# Added missing SW_DLLPUBLIC for (Import|Export)(DOC|RTF). 2008-11-18 19:21:07 +0100 kendy r263797 : #i96313# Remove accidentally added file. 2008-11-18 17:14:31 +0100 kendy r263790 : #i96313# Split doc and rtf filters into a separate library From: Radek Doulik <rodo@novell.com> fix SwFieldBookmark class visibility (suggested by kendy) 2008-11-18 17:14:01 +0100 kendy r263789 : #i96313# Split doc and rtf filters into a separate library From: Fridrich Strba <fstrba@novell.com> add visibility markup to allow linking 2008-11-18 17:13:29 +0100 kendy r263788 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky <kendy@suse.cz> Visibility markup for libmsword. This is the most trivial approach, every class that had a symbol that needed to be visible was marked with SW_DLLPUBLIC; the correct (but more time consuming) way would be to mark just the exact methods that were needed. To be done later if generally shows that the separate libmsword makes sense; and also now we have the upper limit of symbols that needed to be added, and we can only make it better [decrease the number] ;-) 2008-11-18 17:12:58 +0100 kendy r263787 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky <kendy@suse.cz> Added the missing msword.map. 2008-11-18 17:12:25 +0100 kendy r263786 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky <kendy@suse.cz> scp2 change for libmsword. 2008-11-18 17:11:55 +0100 kendy r263785 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky <kendy@suse.cz> Convert the binary .doc and .rtf filters into a separate library. It is called 'libmsword' and loaded on demand when either of the formats (.doc, .rtf) is loaded or saved.
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:
if( rValue.hasValue() && ( rValue >>= sNewFileName ) )
2000-09-18 23:08:29 +00:00
{
String sFilter, sRange, sFileName( sNewFileName );
pDoc->GetLinkManager().GetDisplayNames( this, 0, &sFileName,
2000-09-18 23:08:29 +00:00
&sRange, &sFilter );
RedlineMode_t eOldRedlineMode = nsRedlineMode_t::REDLINE_NONE;
2000-09-18 23:08:29 +00:00
SfxObjectShellRef xDocSh;
SfxObjectShellLock xLockRef;
2000-09-18 23:08:29 +00:00
int nRet;
if( !sFileName.Len() )
{
xDocSh = pDoc->GetDocShell();
nRet = 1;
}
else
{
nRet = lcl_FindDocShell( xDocSh, xLockRef, sFileName,
rSection.GetLinkFilePassword(),
2000-09-18 23:08:29 +00:00
sFilter, 0, pDoc->GetDocShell() );
if( nRet )
{
SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
eOldRedlineMode = pSrcDoc->GetRedlineMode();
pSrcDoc->SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
2000-09-18 23:08:29 +00:00
}
}
if( nRet )
{
rSection.SetConnectFlag(true);
2000-09-18 23:08:29 +00:00
SwNodeIndex aSave( pPam->GetPoint()->nNode, -1 );
SwNodeRange* pCpyRg = 0;
if( xDocSh->GetMedium() &&
!rSection.GetLinkFilePassword().Len() )
2000-09-18 23:08:29 +00:00
{
const SfxPoolItem* pItem;
if( SFX_ITEM_SET == xDocSh->GetMedium()->GetItemSet()->
GetItemState( SID_PASSWORD, sal_False, &pItem ) )
rSection.SetLinkFilePassword(
2000-09-18 23:08:29 +00:00
((SfxStringItem*)pItem)->GetValue() );
}
SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
if( sRange.Len() )
{
// Rekursionen abfangen
sal_Bool bRecursion = sal_False;
2000-09-18 23:08:29 +00:00
if( pSrcDoc == pDoc )
{
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() );
// --> OD 2007-11-30 #i81653#
// Update links of extern linked document or extern linked
// document section, if section is protected.
if ( pSrcDoc != pDoc &&
rSection.IsProtectFlag() )
{
pSrcDoc->GetLinkManager().UpdateAllLinks( sal_False, sal_True, sal_False, 0 );
}
// <--
2000-09-18 23:08:29 +00:00
if( pCpyRg )
{
SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
sal_Bool bCreateFrm = rInsPos.GetIndex() <=
2000-09-18 23:08:29 +00:00
pDoc->GetNodes().GetEndOfExtras().GetIndex() ||
rInsPos.GetNode().FindTableNode();
SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm );
2000-09-18 23:08:29 +00:00
aSave++;
if( !bCreateFrm )
::MakeFrms( pDoc, aSave, rInsPos );
// den letzten Node noch loeschen, aber nur wenn
// erfolgreich kopiert werden konnte, also der Bereich
// mehr als 1 Node enthaelt
if( 2 < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() )
{
aSave = rInsPos;
pPam->Move( fnMoveBackward, fnGoNode );
pPam->SetMark(); // beide SwPositions ummelden!
pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, sal_True );
2000-09-18 23:08:29 +00:00
pDoc->GetNodes().Delete( aSave, 1 );
}
delete pCpyRg;
}
// --> OD 2007-02-14 #b6521322#
lcl_BreakSectionLinksInSect( *pSectNd );
// <--
2000-09-18 23:08:29 +00:00
// update alle Links in diesem Bereich
lcl_UpdateLinksInSect( *this, *pSectNd );
}
if( xDocSh.Is() )
{
if( 2 == nRet )
xDocSh->DoClose();
else if( ((SwDocShell*)&xDocSh)->GetDoc() )
2000-09-18 23:08:29 +00:00
((SwDocShell*)&xDocSh)->GetDoc()->SetRedlineMode(
eOldRedlineMode );
}
}
break;
}
// !!!! DDE nur updaten wenn Shell vorhanden ist??
uno::Sequence< sal_Int8 > aSeq;
if( pRead && rValue.hasValue() && ( rValue >>= aSeq ) )
2000-09-18 23:08:29 +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
SvMemoryStream aStrm( (void*)aSeq.getConstArray(), aSeq.getLength(),
STREAM_READ );
aStrm.Seek( 0 );
#if OSL_DEBUG_LEVEL > 1
2000-09-18 23:08:29 +00:00
{
SvFileStream aDeb( String::CreateFromAscii(
"file:///d|/temp/update.txt" ), STREAM_WRITE );
aDeb << aStrm;
2000-09-18 23:08:29 +00:00
}
aStrm.Seek( 0 );
#endif
// TODO/MBA: it's impossible to set a BaseURL here!
SwReader aTmpReader( aStrm, aEmptyStr, pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam );
if( !IsError( aTmpReader.Read( *pRead ) ))
{
rSection.SetConnectFlag(true);
}
2000-09-18 23:08:29 +00:00
if( pESh )
{
pESh->Pop( sal_False );
pPam = 0; // pam is deleted before
}
2000-09-18 23:08:29 +00: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() )
pDoc->UpdateExpFlds(NULL, true);
2000-09-18 23:08:29 +00:00
if( pESh )
pESh->EndAllAction();
else if( pVSh )
pVSh->EndAction();
delete pPam; // wurde am Anfang angelegt
}
void SwIntrnlSectRefLink::Closed()
{
SwDoc* pDoc = rSectFmt.GetDoc();
if( pDoc && !pDoc->IsInDtor() )
{
// Advise verabschiedet sich, den Bereich als nicht geschuetzt
// kennzeichnen und das Flag umsetzen
const SwSectionFmts& rFmts = pDoc->GetSections();
for( sal_uInt16 n = rFmts.Count(); 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();
SwSectionData aSectionData(*rSectFmt.GetSection());
aSectionData.SetType( CONTENT_SECTION );
aSectionData.SetLinkFileName( aEmptyStr );
aSectionData.SetHidden( false );
aSectionData.SetProtectFlag( false );
// --> FME 2004-06-22 #114856# edit in readonly sections
aSectionData.SetEditInReadonlyFlag( false );
// <--
aSectionData.SetConnectFlag( false );
2000-09-18 23:08:29 +00:00
pDoc->UpdateSection( n, aSectionData );
2000-09-18 23:08:29 +00:00
// alle in der Section liegenden Links werden sichtbar
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();
ASSERT(pFmt, "SwSection::CreateLink: no format?");
if (!pFmt || (CONTENT_SECTION == m_Data.GetType()))
2000-09-18 23:08:29 +00:00
return ;
sal_uInt16 nUpdateType = sfx2::LINKUPDATE_ALWAYS;
2000-09-18 23:08:29 +00:00
if (!m_RefLink.Is())
{
// create BaseLink
m_RefLink = new SwIntrnlSectRefLink( *pFmt, nUpdateType, FORMAT_RTF );
}
2000-09-18 23:08:29 +00:00
else
{
pFmt->GetDoc()->GetLinkManager().Remove( m_RefLink );
}
2000-09-18 23:08:29 +00:00
SwIntrnlSectRefLink *const pLnk =
static_cast<SwIntrnlSectRefLink*>(& m_RefLink);
2000-09-18 23:08:29 +00: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() );
switch (m_Data.GetType())
2000-09-18 23:08:29 +00:00
{
case DDE_LINK_SECTION:
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 );
String sFltr( sCmd.GetToken( 1, sfx2::cTokenSeperator ) );
String sRange( sCmd.GetToken( 2, sfx2::cTokenSeperator ) );
pFmt->GetDoc()->GetLinkManager().InsertFileLink( *pLnk,
static_cast<sal_uInt16>(m_Data.GetType()),
sCmd.GetToken( 0, sfx2::cTokenSeperator ),
2000-09-18 23:08:29 +00:00
( sFltr.Len() ? &sFltr : 0 ),
( sRange.Len() ? &sRange : 0 ) );
}
break;
default:
ASSERT( !this, "Was ist das fuer ein Link?" )
}
switch( eCreateType )
{
case CREATE_CONNECT: // Link gleich connecten
pLnk->Connect();
break;
case CREATE_UPDATE: // Link connecten und updaten
pLnk->Update();
break;
case CREATE_NONE: break;
2000-09-18 23:08:29 +00:00
}
}
// --> OD 2007-02-14 #b6521322#
void SwSection::BreakLink()
{
const SectionType eCurrentType( GetType() );
if ( eCurrentType == CONTENT_SECTION ||
eCurrentType == TOX_HEADER_SECTION ||
eCurrentType == TOX_CONTENT_SECTION )
{
// nothing to do
return;
}
// release link, if it exists
if (m_RefLink.Is())
{
SwSectionFmt *const pFormat( GetFmt() );
ASSERT(pFormat, "SwSection::BreakLink: no format?");
if (pFormat)
{
pFormat->GetDoc()->GetLinkManager().Remove( m_RefLink );
}
m_RefLink.Clear();
}
// change type
SetType( CONTENT_SECTION );
// reset linked file data
SetLinkFileName( aEmptyStr );
SetLinkFilePassword( aEmptyStr );
}
// <--
2000-09-18 23:08:29 +00:00
const SwNode* SwIntrnlSectRefLink::GetAnchor() const
{
return rSectFmt.GetSectionNode( sal_False );
2000-09-18 23:08:29 +00:00
}
sal_Bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
xub_StrLen , xub_StrLen ) const
2000-09-18 23:08:29 +00:00
{
SwStartNode* pSttNd = rSectFmt.GetSectionNode( sal_False );
2000-09-18 23:08:29 +00:00
return pSttNd &&
nSttNd < pSttNd->GetIndex() &&
pSttNd->EndOfSectionIndex() < nEndNd;
}