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:10:42 +00:00
|
|
|
|
2011-11-18 21:03:31 +00:00
|
|
|
#include <comphelper/string.hxx>
|
2010-01-13 22:25:07 +01:00
|
|
|
#include <sfx2/linkmgr.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <doc.hxx>
|
|
|
|
#include <editsh.hxx>
|
|
|
|
#include <ndtxt.hxx>
|
|
|
|
#include <fmtfld.hxx>
|
|
|
|
#include <txtfld.hxx>
|
|
|
|
#include <ddefld.hxx>
|
|
|
|
#include <swtable.hxx>
|
|
|
|
#include <swbaslnk.hxx>
|
|
|
|
#include <swddetbl.hxx>
|
2001-10-24 17:56:14 +00:00
|
|
|
#include <unofldmid.h>
|
2008-03-05 16:01:49 +00:00
|
|
|
#include <hints.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2007-09-27 07:48:25 +00:00
|
|
|
using namespace ::com::sun::star;
|
2001-03-08 20:28:23 +00:00
|
|
|
|
2011-11-24 12:06:54 +01:00
|
|
|
#define DDE_TXT_ENCODING osl_getThreadTextEncoding()
|
2001-03-08 20:28:23 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Globale Variablen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
class SwIntrnlRefLink : public SwBaseLink
|
|
|
|
{
|
|
|
|
SwDDEFieldType& rFldType;
|
|
|
|
public:
|
2011-01-17 15:06:54 +01:00
|
|
|
SwIntrnlRefLink( SwDDEFieldType& rType, sal_uInt16 nUpdateType, sal_uInt16 nFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
: SwBaseLink( nUpdateType, nFmt ),
|
|
|
|
rFldType( rType )
|
|
|
|
{}
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-05-25 14:58:03 -04:00
|
|
|
::sfx2::SvBaseLink::UpdateResult SwIntrnlRefLink::DataChanged( const String& rMimeType,
|
2007-09-27 07:48:25 +00:00
|
|
|
const uno::Any & rValue )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-03-08 20:28:23 +00:00
|
|
|
switch( SotExchange::GetFormatIdFromMimeType( rMimeType ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
case FORMAT_STRING:
|
|
|
|
if( !IsNoDataFlag() )
|
|
|
|
{
|
2007-09-27 07:48:25 +00:00
|
|
|
uno::Sequence< sal_Int8 > aSeq;
|
2001-03-08 20:28:23 +00:00
|
|
|
rValue >>= aSeq;
|
2007-09-27 07:48:25 +00:00
|
|
|
String sStr( (sal_Char*)aSeq.getConstArray(), static_cast<xub_StrLen>(aSeq.getLength()),
|
2001-03-08 20:28:23 +00:00
|
|
|
DDE_TXT_ENCODING );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
// CR-LF am Ende entfernen, ist ueberfluessig!
|
2001-03-08 20:28:23 +00:00
|
|
|
xub_StrLen n = sStr.Len();
|
2001-04-12 16:50:46 +00:00
|
|
|
while( n && 0 == sStr.GetChar( n-1 ) )
|
|
|
|
--n;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( n && 0x0a == sStr.GetChar( n-1 ) )
|
|
|
|
--n;
|
|
|
|
if( n && 0x0d == sStr.GetChar( n-1 ) )
|
|
|
|
--n;
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bDel = n != sStr.Len();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bDel )
|
|
|
|
sStr.Erase( n );
|
|
|
|
|
|
|
|
rFldType.SetExpansion( sStr );
|
|
|
|
// erst Expansion setzen! (sonst wird das Flag geloescht!)
|
|
|
|
rFldType.SetCRLFDelFlag( bDel );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// weitere Formate ...
|
|
|
|
default:
|
2011-05-25 14:58:03 -04:00
|
|
|
return SUCCESS;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( rFldType.GetDoc(), "Kein pDoc" );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
// keine Abhaengigen mehr?
|
|
|
|
if( rFldType.GetDepends() && !rFldType.IsModifyLocked() && !ChkNoDataFlag() )
|
|
|
|
{
|
|
|
|
ViewShell* pSh;
|
|
|
|
SwEditShell* pESh = rFldType.GetDoc()->GetEditShell( &pSh );
|
|
|
|
|
|
|
|
// dann suchen wir uns mal alle Felder. Wird kein gueltiges
|
|
|
|
// gefunden, dann Disconnecten wir uns!
|
|
|
|
SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL );
|
2011-01-17 15:06:54 +01:00
|
|
|
int bCallModify = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
rFldType.LockModify();
|
|
|
|
|
2010-12-17 09:02:23 +01:00
|
|
|
SwClientIter aIter( rFldType ); // TODO
|
2000-09-18 23:08:29 +00:00
|
|
|
SwClient * pLast = aIter.GoStart();
|
|
|
|
if( pLast ) // konnte zum Anfang gesprungen werden ??
|
|
|
|
do {
|
|
|
|
// eine DDE-Tabelle oder ein DDE-FeldAttribut im Text
|
|
|
|
if( !pLast->IsA( TYPE( SwFmtFld ) ) ||
|
|
|
|
((SwFmtFld*)pLast)->GetTxtFld() )
|
|
|
|
{
|
|
|
|
if( !bCallModify )
|
|
|
|
{
|
|
|
|
if( pESh )
|
|
|
|
pESh->StartAllAction();
|
|
|
|
else if( pSh )
|
|
|
|
pSh->StartAction();
|
|
|
|
}
|
2010-12-17 09:02:23 +01:00
|
|
|
pLast->ModifyNotification( 0, &aUpdateDDE );
|
2011-01-17 15:06:54 +01:00
|
|
|
bCallModify = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2011-03-31 10:05:04 +02:00
|
|
|
} while( 0 != ( pLast = ++aIter ));
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
rFldType.UnlockModify();
|
|
|
|
|
|
|
|
if( bCallModify )
|
|
|
|
{
|
|
|
|
if( pESh )
|
|
|
|
pESh->EndAllAction();
|
|
|
|
else if( pSh )
|
|
|
|
pSh->EndAction();
|
|
|
|
|
|
|
|
if( pSh )
|
|
|
|
pSh->GetDoc()->SetModified();
|
|
|
|
}
|
|
|
|
}
|
2011-05-25 14:58:03 -04:00
|
|
|
|
|
|
|
return SUCCESS;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwIntrnlRefLink::Closed()
|
|
|
|
{
|
|
|
|
if( rFldType.GetDoc() && !rFldType.GetDoc()->IsInDtor() )
|
|
|
|
{
|
|
|
|
// Advise verabschiedet sich, alle Felder in Text umwandeln ?
|
|
|
|
ViewShell* pSh;
|
|
|
|
SwEditShell* pESh = rFldType.GetDoc()->GetEditShell( &pSh );
|
|
|
|
if( pESh )
|
|
|
|
{
|
|
|
|
pESh->StartAllAction();
|
|
|
|
pESh->FieldToText( &rFldType );
|
|
|
|
pESh->EndAllAction();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pSh->StartAction();
|
|
|
|
// am Doc aufrufen ??
|
|
|
|
pSh->EndAction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SvBaseLink::Closed();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwNode* SwIntrnlRefLink::GetAnchor() const
|
|
|
|
{
|
|
|
|
// hier sollte irgend ein Anchor aus dem normalen Nodes-Array reichen
|
|
|
|
const SwNode* pNd = 0;
|
2010-12-17 09:02:23 +01:00
|
|
|
SwClientIter aIter( rFldType ); // TODO
|
2000-09-18 23:08:29 +00:00
|
|
|
SwClient * pLast = aIter.GoStart();
|
|
|
|
if( pLast ) // konnte zum Anfang gesprungen werden ??
|
|
|
|
do {
|
|
|
|
// eine DDE-Tabelle oder ein DDE-FeldAttribut im Text
|
|
|
|
if( !pLast->IsA( TYPE( SwFmtFld ) ))
|
|
|
|
{
|
|
|
|
SwDepend* pDep = (SwDepend*)pLast;
|
|
|
|
SwDDETable* pDDETbl = (SwDDETable*)pDep->GetToTell();
|
|
|
|
pNd = pDDETbl->GetTabSortBoxes()[0]->GetSttNd();
|
|
|
|
}
|
|
|
|
else if( ((SwFmtFld*)pLast)->GetTxtFld() )
|
|
|
|
pNd = ((SwFmtFld*)pLast)->GetTxtFld()->GetpTxtNode();
|
|
|
|
|
|
|
|
if( pNd && &rFldType.GetDoc()->GetNodes() == &pNd->GetNodes() )
|
|
|
|
break;
|
|
|
|
pNd = 0;
|
2011-03-31 10:05:04 +02:00
|
|
|
} while( 0 != ( pLast = ++aIter ));
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
return pNd;
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
|
2000-09-18 23:08:29 +00:00
|
|
|
xub_StrLen nStt, xub_StrLen nEnd ) const
|
|
|
|
{
|
|
|
|
// hier sollte irgend ein Anchor aus dem normalen Nodes-Array reichen
|
|
|
|
SwNodes* pNds = &rFldType.GetDoc()->GetNodes();
|
2010-12-17 09:02:23 +01:00
|
|
|
SwClientIter aIter( rFldType ); // TODO
|
2000-09-18 23:08:29 +00:00
|
|
|
SwClient * pLast = aIter.GoStart();
|
|
|
|
if( pLast ) // konnte zum Anfang gesprungen werden ??
|
|
|
|
do {
|
|
|
|
// eine DDE-Tabelle oder ein DDE-FeldAttribut im Text
|
|
|
|
if( !pLast->IsA( TYPE( SwFmtFld ) ))
|
|
|
|
{
|
|
|
|
SwDepend* pDep = (SwDepend*)pLast;
|
|
|
|
SwDDETable* pDDETbl = (SwDDETable*)pDep->GetToTell();
|
|
|
|
const SwTableNode* pTblNd = pDDETbl->GetTabSortBoxes()[0]->
|
|
|
|
GetSttNd()->FindTableNode();
|
|
|
|
if( pTblNd->GetNodes().IsDocNodes() &&
|
|
|
|
nSttNd < pTblNd->EndOfSectionIndex() &&
|
|
|
|
nEndNd > pTblNd->GetIndex() )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if( ((SwFmtFld*)pLast)->GetTxtFld() )
|
|
|
|
{
|
|
|
|
const SwTxtFld* pTFld = ((SwFmtFld*)pLast)->GetTxtFld();
|
|
|
|
const SwTxtNode* pNd = pTFld->GetpTxtNode();
|
|
|
|
if( pNd && pNds == &pNd->GetNodes() )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uLong nNdPos = pNd->GetIndex();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( nSttNd <= nNdPos && nNdPos <= nEndNd &&
|
|
|
|
( nNdPos != nSttNd || *pTFld->GetStart() >= nStt ) &&
|
|
|
|
( nNdPos != nEndNd || *pTFld->GetStart() < nEnd ))
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-31 10:05:04 +02:00
|
|
|
} while( 0 != ( pLast = ++aIter ));
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwDDEFieldType::SwDDEFieldType(const String& rName,
|
2011-01-17 15:06:54 +01:00
|
|
|
const String& rCmd, sal_uInt16 nUpdateType )
|
2000-09-18 23:08:29 +00:00
|
|
|
: SwFieldType( RES_DDEFLD ),
|
|
|
|
aName( rName ), pDoc( 0 ), nRefCnt( 0 )
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
bCRLFFlag = bDeleted = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
refLink = new SwIntrnlRefLink( *this, nUpdateType, FORMAT_STRING );
|
|
|
|
SetCmd( rCmd );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwDDEFieldType::~SwDDEFieldType()
|
|
|
|
{
|
|
|
|
if( pDoc && !pDoc->IsInDtor() )
|
2001-03-08 20:28:23 +00:00
|
|
|
pDoc->GetLinkManager().Remove( refLink );
|
2000-09-18 23:08:29 +00:00
|
|
|
refLink->Disconnect();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwDDEFieldType::Copy() const
|
|
|
|
{
|
|
|
|
SwDDEFieldType* pType = new SwDDEFieldType( aName, GetCmd(), GetType() );
|
|
|
|
pType->aExpansion = aExpansion;
|
|
|
|
pType->bCRLFFlag = bCRLFFlag;
|
|
|
|
pType->bDeleted = bDeleted;
|
|
|
|
pType->SetDoc( pDoc );
|
|
|
|
return pType;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& SwDDEFieldType::GetName() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
return aName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDDEFieldType::SetCmd( const String& rStr )
|
|
|
|
{
|
|
|
|
String sCmd( rStr );
|
|
|
|
xub_StrLen nPos;
|
|
|
|
while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( " " )) )
|
|
|
|
sCmd.Erase( nPos, 1 );
|
2001-03-08 20:28:23 +00:00
|
|
|
refLink->SetLinkSourceName( sCmd );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String SwDDEFieldType::GetCmd() const
|
|
|
|
{
|
2001-03-08 20:28:23 +00:00
|
|
|
return refLink->GetLinkSourceName();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDDEFieldType::SetDoc( SwDoc* pNewDoc )
|
|
|
|
{
|
|
|
|
if( pNewDoc == pDoc )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( pDoc && refLink.Is() )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !nRefCnt, "wie kommen die Referenzen rueber?" );
|
2001-03-08 20:28:23 +00:00
|
|
|
pDoc->GetLinkManager().Remove( refLink );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pDoc = pNewDoc;
|
|
|
|
if( pDoc && nRefCnt )
|
|
|
|
{
|
|
|
|
refLink->SetVisible( pDoc->IsVisibleLinks() );
|
2001-03-08 20:28:23 +00:00
|
|
|
pDoc->GetLinkManager().InsertDDELink( refLink );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SwDDEFieldType::_RefCntChgd()
|
|
|
|
{
|
|
|
|
if( nRefCnt )
|
|
|
|
{
|
|
|
|
refLink->SetVisible( pDoc->IsVisibleLinks() );
|
2001-03-08 20:28:23 +00:00
|
|
|
pDoc->GetLinkManager().InsertDDELink( refLink );
|
2010-06-13 15:22:56 +02:00
|
|
|
if( pDoc->GetCurrentViewShell() ) //swmod 071108//swmod 071225
|
2000-09-18 23:08:29 +00:00
|
|
|
UpdateNow();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Disconnect();
|
2001-03-08 20:28:23 +00:00
|
|
|
pDoc->GetLinkManager().Remove( refLink );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwDDEFieldType::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nPart = 0;
|
2007-09-27 07:48:25 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR2: nPart = 3; break;
|
|
|
|
case FIELD_PROP_PAR4: nPart = 2; break;
|
|
|
|
case FIELD_PROP_SUBTYPE: nPart = 1; break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bSet = GetType() == sfx2::LINKUPDATE_ALWAYS ? sal_True : sal_False;
|
2001-10-24 17:56:14 +00:00
|
|
|
rVal.setValue(&bSet, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
2007-05-09 12:23:55 +00:00
|
|
|
case FIELD_PROP_PAR5:
|
2013-04-07 12:06:47 +02:00
|
|
|
rVal <<= OUString(aExpansion);
|
2007-05-09 12:23:55 +00:00
|
|
|
break;
|
2001-10-24 17:56:14 +00:00
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
if( nPart )
|
2013-05-15 10:42:04 +03:00
|
|
|
rVal <<= OUString(GetCmd().GetToken(nPart-1, sfx2::cTokenSeparator));
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt8 nPart = 0;
|
2007-09-27 07:48:25 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR2: nPart = 3; break;
|
|
|
|
case FIELD_PROP_PAR4: nPart = 2; break;
|
|
|
|
case FIELD_PROP_SUBTYPE: nPart = 1; break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
2011-01-17 15:06:54 +01:00
|
|
|
SetType( static_cast<sal_uInt16>(*(sal_Bool*)rVal.getValue() ?
|
2007-09-27 07:48:25 +00:00
|
|
|
sfx2::LINKUPDATE_ALWAYS :
|
|
|
|
sfx2::LINKUPDATE_ONCALL ) );
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2007-05-09 12:23:55 +00:00
|
|
|
case FIELD_PROP_PAR5:
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sTemp;
|
2007-05-09 12:23:55 +00:00
|
|
|
rVal >>= sTemp;
|
|
|
|
aExpansion = sTemp;
|
|
|
|
}
|
|
|
|
break;
|
2001-10-24 17:56:14 +00:00
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
|
|
|
if( nPart )
|
|
|
|
{
|
|
|
|
String sTmp, sCmd( GetCmd() );
|
2013-05-15 10:42:04 +03:00
|
|
|
while(3 > comphelper::string::getTokenCount(sCmd, sfx2::cTokenSeparator))
|
|
|
|
sCmd += sfx2::cTokenSeparator;
|
|
|
|
sCmd.SetToken( nPart-1, sfx2::cTokenSeparator, ::GetString( rVal, sTmp ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
SetCmd( sCmd );
|
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 07:48:25 +00:00
|
|
|
SwDDEField::SwDDEField( SwDDEFieldType* pInitType )
|
|
|
|
: SwField(pInitType)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwDDEField::~SwDDEField()
|
|
|
|
{
|
2010-12-17 09:02:23 +01:00
|
|
|
if( GetTyp()->IsLastDepend() )
|
|
|
|
((SwDDEFieldType*)GetTyp())->Disconnect();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String SwDDEField::Expand() const
|
|
|
|
{
|
|
|
|
xub_StrLen nPos;
|
2011-11-18 21:03:31 +00:00
|
|
|
String aStr(comphelper::string::remove(((SwDDEFieldType*)GetTyp())->GetExpansion(), '\r'));
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
while( (nPos = aStr.Search( '\t' )) != STRING_NOTFOUND )
|
2000-12-08 12:31:08 +00:00
|
|
|
aStr.SetChar( nPos, ' ' );
|
2000-09-18 23:08:29 +00:00
|
|
|
while( (nPos = aStr.Search( '\n' )) != STRING_NOTFOUND )
|
2000-12-08 12:31:08 +00:00
|
|
|
aStr.SetChar( nPos, '|' );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( aStr.Len() && ( aStr.GetChar( aStr.Len()-1 ) == '|') )
|
|
|
|
aStr.Erase( aStr.Len()-1, 1 );
|
|
|
|
return aStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwDDEField::Copy() const
|
|
|
|
{
|
|
|
|
return new SwDDEField((SwDDEFieldType*)GetTyp());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Parameter des Typen erfragen
|
|
|
|
Name
|
|
|
|
--------------------------------------------------------------------*/
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& SwDDEField::GetPar1() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-03-07 16:52:06 +00:00
|
|
|
return ((const SwDDEFieldType*)GetTyp())->GetName();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Parameter des Typen erfragen
|
|
|
|
Commando
|
|
|
|
--------------------------------------------------------------------*/
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString SwDDEField::GetPar2() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-03-07 16:52:06 +00:00
|
|
|
return ((const SwDDEFieldType*)GetTyp())->GetCmd();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void SwDDEField::SetPar2(const OUString& rStr)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
((SwDDEFieldType*)GetTyp())->SetCmd(rStr);
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|