2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 05:55:59 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-11 05:55:59 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-11 05:55:59 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-11 05:55:59 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-11 05:55:59 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-11 05:55:59 +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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 20:11:11 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2008-02-19 12:42:36 +00:00
|
|
|
#include <textapi.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
#include <tools/pstm.hxx>
|
|
|
|
#include <hintids.hxx>
|
2008-02-19 12:42:36 +00:00
|
|
|
#include <com/sun/star/text/XText.hpp>
|
2007-11-26 14:29:04 +00:00
|
|
|
#include <com/sun/star/script/XTypeConverter.hpp>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <com/sun/star/text/SetVariableType.hpp>
|
|
|
|
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
|
|
|
|
#include <com/sun/star/text/UserDataPart.hpp>
|
|
|
|
#include <com/sun/star/text/ChapterFormat.hpp>
|
|
|
|
#include <com/sun/star/text/XTextField.hpp>
|
|
|
|
#include <com/sun/star/text/PlaceholderType.hpp>
|
|
|
|
#include <com/sun/star/text/TemplateDisplayFormat.hpp>
|
|
|
|
#include <com/sun/star/text/UserFieldFormat.hpp>
|
|
|
|
#include <com/sun/star/text/PageNumberType.hpp>
|
|
|
|
#include <com/sun/star/text/ReferenceFieldPart.hpp>
|
|
|
|
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
|
|
|
|
#include <com/sun/star/text/XDependentTextField.hpp>
|
|
|
|
#include <com/sun/star/text/DocumentStatistic.hpp>
|
2008-02-26 13:10:15 +00:00
|
|
|
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
|
|
|
|
#include <com/sun/star/document/XDocumentProperties.hpp>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <com/sun/star/util/Date.hpp>
|
2009-11-26 12:52:39 +01:00
|
|
|
#include <com/sun/star/util/Duration.hpp>
|
2001-02-14 08:58:47 +00:00
|
|
|
#include <unotools/localedatawrapper.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/unolingu.hxx>
|
2001-02-14 08:58:47 +00:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2001-04-23 12:13:11 +00:00
|
|
|
#include <comphelper/types.hxx>
|
2008-02-26 13:10:15 +00:00
|
|
|
#include <comphelper/string.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
2000-10-06 12:11:18 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2009-12-17 12:17:52 +01:00
|
|
|
#include <svl/urihelper.hxx>
|
|
|
|
#include <unotools/useroptions.hxx>
|
|
|
|
#include <unotools/syslocale.hxx>
|
|
|
|
#include <svl/zforlist.hxx>
|
2001-10-24 17:56:14 +00:00
|
|
|
|
2008-02-26 13:10:15 +00:00
|
|
|
#include <tools/time.hxx>
|
|
|
|
#include <tools/datetime.hxx>
|
2007-07-17 12:07:24 +00:00
|
|
|
|
2008-04-03 15:51:46 +00:00
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
2009-10-08 16:15:40 +02:00
|
|
|
#include <com/sun/star/util/DateTime.hpp>
|
|
|
|
#include <com/sun/star/util/Time.hpp>
|
2008-04-03 15:51:46 +00:00
|
|
|
|
2004-04-29 15:54:32 +00:00
|
|
|
#include <tools/shl.hxx>
|
|
|
|
#include <swmodule.hxx>
|
2000-10-06 12:11:18 +00:00
|
|
|
#include <sfx2/app.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#include <sfx2/doctempl.hxx>
|
|
|
|
#include <fmtfld.hxx>
|
|
|
|
#include <txtfld.hxx>
|
|
|
|
#include <charfmt.hxx>
|
|
|
|
#include <docstat.hxx>
|
|
|
|
#include <pagedesc.hxx>
|
|
|
|
#include <fmtpdsc.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <rootfrm.hxx> // AuthorField
|
|
|
|
#include <pagefrm.hxx> //
|
|
|
|
#include <cntfrm.hxx> //
|
|
|
|
#include <pam.hxx>
|
|
|
|
#include <viewsh.hxx>
|
|
|
|
#include <dbmgr.hxx>
|
|
|
|
#include <shellres.hxx>
|
|
|
|
#include <docufld.hxx>
|
|
|
|
#include <flddat.hxx>
|
|
|
|
#include <docfld.hxx>
|
|
|
|
#include <ndtxt.hxx>
|
|
|
|
#include <expfld.hxx>
|
|
|
|
#include <poolfmt.hxx>
|
|
|
|
#include <docsh.hxx>
|
2001-10-24 17:56:14 +00:00
|
|
|
#include <unofldmid.h>
|
2001-10-18 11:27:55 +00:00
|
|
|
#include <swunohelper.hxx>
|
2004-09-08 13:55:20 +00:00
|
|
|
#include <comcore.hrc>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/outliner.hxx>
|
|
|
|
#include <editeng/outlobj.hxx>
|
2008-02-19 12:42:36 +00:00
|
|
|
|
2000-10-20 12:46:39 +00:00
|
|
|
#define URL_DECODE INetURLObject::DECODE_UNAMBIGUOUS
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2008-03-12 11:19:30 +00:00
|
|
|
using ::rtl::OUString;
|
2000-09-18 23:08:29 +00:00
|
|
|
using namespace ::com::sun::star;
|
2001-04-23 12:13:11 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
2007-09-27 07:48:37 +00:00
|
|
|
using namespace nsSwDocInfoSubType;
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwPageNumberFieldType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwPageNumberFieldType::SwPageNumberFieldType()
|
|
|
|
: SwFieldType( RES_PAGENUMBERFLD ),
|
2001-02-23 11:45:30 +00:00
|
|
|
nNumberingType( SVX_NUM_ARABIC ),
|
2000-09-18 23:08:29 +00:00
|
|
|
nNum( 0 ),
|
|
|
|
nMax( USHRT_MAX ),
|
|
|
|
bVirtuell( sal_False )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String& SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff,
|
|
|
|
const String& rUserStr, String& rRet ) const
|
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
sal_uInt32 nTmpFmt = (SVX_NUM_PAGEDESC == nFmt) ? (sal_uInt32)nNumberingType : nFmt;
|
2000-09-18 23:08:29 +00:00
|
|
|
long nTmp = nNum + nOff;
|
|
|
|
|
|
|
|
if( 0 >= nTmp || SVX_NUM_NUMBER_NONE == nTmpFmt || (!bVirtuell && nTmp > nMax) )
|
|
|
|
rRet = aEmptyStr;
|
|
|
|
else if( SVX_NUM_CHAR_SPECIAL == nTmpFmt )
|
|
|
|
rRet = rUserStr;
|
|
|
|
else
|
|
|
|
rRet = FormatNumber( (sal_uInt16)nTmp, nTmpFmt );
|
|
|
|
return rRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwPageNumberFieldType::Copy() const
|
|
|
|
{
|
|
|
|
SwPageNumberFieldType *pTmp = new SwPageNumberFieldType();
|
|
|
|
|
|
|
|
pTmp->nNum = nNum;
|
|
|
|
pTmp->nMax = nMax;
|
2001-02-23 11:45:30 +00:00
|
|
|
pTmp->nNumberingType = nNumberingType;
|
2000-09-18 23:08:29 +00:00
|
|
|
pTmp->bVirtuell = bVirtuell;
|
|
|
|
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Verschiedene Expandierung
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, sal_uInt16 nPage,
|
|
|
|
sal_uInt16 nNumPages, sal_Bool bVirt,
|
2001-02-23 11:45:30 +00:00
|
|
|
const sal_Int16* pNumFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
nNum = nPage;
|
|
|
|
nMax = nNumPages;
|
|
|
|
if( pNumFmt )
|
2001-02-23 11:45:30 +00:00
|
|
|
nNumberingType = *pNumFmt;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
bVirtuell = sal_False;
|
|
|
|
if( bVirt )
|
|
|
|
{
|
|
|
|
// dann muss das Flag ueberprueft werden, denn das Layout setzt
|
|
|
|
// es NIE zurueck
|
|
|
|
const SfxItemPool &rPool = pDoc->GetAttrPool();
|
|
|
|
const SwFmtPageDesc *pDesc;
|
2010-10-18 22:00:21 +02:00
|
|
|
sal_uInt32 nMaxItems = rPool.GetItemCount2( RES_PAGEDESC );
|
|
|
|
for( sal_uInt32 n = 0; n < nMaxItems; ++n )
|
|
|
|
if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem2( RES_PAGEDESC, n ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
&& pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
|
|
|
|
{
|
|
|
|
if( pDesc->GetDefinedIn()->ISA( SwCntntNode ))
|
|
|
|
{
|
|
|
|
SwClientIter aIter( *(SwModify*)pDesc->GetDefinedIn() );
|
|
|
|
if( aIter.First( TYPE( SwFrm ) ) )
|
|
|
|
{
|
|
|
|
bVirtuell = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( pDesc->GetDefinedIn()->ISA( SwFmt ))
|
|
|
|
{
|
|
|
|
SwAutoFmtGetDocNode aGetHt( &pDoc->GetNodes() );
|
|
|
|
bVirtuell = !pDesc->GetDefinedIn()->GetInfo( aGetHt );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwPageNumberField
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwPageNumberField::SwPageNumberField(SwPageNumberFieldType* pTyp,
|
|
|
|
sal_uInt16 nSub, sal_uInt32 nFmt, short nOff)
|
2007-09-27 07:48:37 +00:00
|
|
|
: SwField(pTyp, nFmt), nSubType(nSub), nOffset(nOff)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwPageNumberField::Expand() const
|
|
|
|
{
|
|
|
|
String sRet;
|
|
|
|
SwPageNumberFieldType* pFldType = (SwPageNumberFieldType*)GetTyp();
|
|
|
|
|
|
|
|
if( PG_NEXT == nSubType && 1 != nOffset )
|
|
|
|
{
|
|
|
|
if( pFldType->Expand( GetFormat(), 1, sUserStr, sRet ).Len() )
|
|
|
|
pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
|
|
|
|
}
|
|
|
|
else if( PG_PREV == nSubType && -1 != nOffset )
|
|
|
|
{
|
|
|
|
if( pFldType->Expand( GetFormat(), -1, sUserStr, sRet ).Len() )
|
|
|
|
pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwPageNumberField::Copy() const
|
|
|
|
{
|
|
|
|
SwPageNumberField *pTmp =
|
|
|
|
new SwPageNumberField((SwPageNumberFieldType*)GetTyp(), nSubType, GetFormat(), nOffset);
|
|
|
|
pTmp->SetLanguage( GetLanguage() );
|
|
|
|
pTmp->SetUserString( sUserStr );
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwPageNumberField::GetPar2() const
|
|
|
|
{
|
|
|
|
return String::CreateFromInt32(nOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwPageNumberField::SetPar2(const String& rStr)
|
|
|
|
{
|
|
|
|
nOffset = (short)rStr.ToInt32();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 SwPageNumberField::GetSubType() const
|
|
|
|
{
|
|
|
|
return nSubType;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwPageNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= (sal_Int16)GetFormat();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= nOffset;
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_SUBTYPE:
|
|
|
|
{
|
|
|
|
text::PageNumberType eType;
|
|
|
|
eType = text::PageNumberType_CURRENT;
|
|
|
|
if(nSubType == PG_PREV)
|
|
|
|
eType = text::PageNumberType_PREV;
|
|
|
|
else if(nSubType == PG_NEXT)
|
|
|
|
eType = text::PageNumberType_NEXT;
|
|
|
|
rAny.setValue(&eType, ::getCppuType((const text::PageNumberType*)0));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(sUserStr);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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 SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-10-04 15:23:52 +01:00
|
|
|
bool bRet = true;
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int16 nSet = 0;
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny >>= nSet;
|
|
|
|
|
|
|
|
// TODO: woher kommen die defines?
|
|
|
|
if(nSet <= SVX_NUM_PAGEDESC )
|
|
|
|
SetFormat(nSet);
|
2008-04-22 13:58:09 +00:00
|
|
|
else {
|
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny >>= nSet;
|
|
|
|
nOffset = nSet;
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_SUBTYPE:
|
2001-10-18 11:27:55 +00:00
|
|
|
switch( SWUnoHelper::GetEnumAsInt32( rAny ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
case text::PageNumberType_CURRENT:
|
|
|
|
nSubType = PG_RANDOM;
|
|
|
|
break;
|
|
|
|
case text::PageNumberType_PREV:
|
|
|
|
nSubType = PG_PREV;
|
|
|
|
break;
|
2001-04-23 12:13:11 +00:00
|
|
|
case text::PageNumberType_NEXT:
|
2000-09-18 23:08:29 +00:00
|
|
|
nSubType = PG_NEXT;
|
2001-04-23 12:13:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-10-04 15:23:52 +01:00
|
|
|
bRet = false;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
::GetString( rAny, sUserStr );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-04-23 12:13:11 +00:00
|
|
|
return bRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwAuthorFieldType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
2001-01-18 13:08:36 +00:00
|
|
|
SwAuthorFieldType::SwAuthorFieldType()
|
2000-09-18 23:08:29 +00:00
|
|
|
: SwFieldType( RES_AUTHORFLD )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
String SwAuthorFieldType::Expand(sal_uLong nFmt) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2000-10-06 12:11:18 +00:00
|
|
|
String sRet;
|
2004-04-29 15:54:32 +00:00
|
|
|
SvtUserOptions& rOpt = SW_MOD()->GetUserOptions();
|
2000-09-18 23:08:29 +00:00
|
|
|
if((nFmt & 0xff) == AF_NAME)
|
2004-04-29 15:54:32 +00:00
|
|
|
sRet = rOpt.GetFullName();
|
2000-10-06 12:11:18 +00:00
|
|
|
else
|
2004-04-29 15:54:32 +00:00
|
|
|
sRet = rOpt.GetID();
|
2000-10-06 12:11:18 +00:00
|
|
|
return sRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwAuthorFieldType::Copy() const
|
|
|
|
{
|
2001-01-18 13:08:36 +00:00
|
|
|
return new SwAuthorFieldType;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwAuthorField
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFmt)
|
|
|
|
: SwField(pTyp, nFmt)
|
|
|
|
{
|
|
|
|
aContent = ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwAuthorField::Expand() const
|
|
|
|
{
|
|
|
|
if (!IsFixed())
|
2001-01-18 13:08:36 +00:00
|
|
|
((SwAuthorField*)this)->aContent =
|
|
|
|
((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
return aContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwAuthorField::Copy() const
|
|
|
|
{
|
2001-01-18 13:08:36 +00:00
|
|
|
SwAuthorField *pTmp = new SwAuthorField( (SwAuthorFieldType*)GetTyp(),
|
|
|
|
GetFormat());
|
2000-09-18 23:08:29 +00:00
|
|
|
pTmp->SetExpansion(aContent);
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-10-04 15:23:52 +01:00
|
|
|
bool bVal;
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_BOOL1:
|
2003-08-19 11:27:34 +00:00
|
|
|
bVal = (GetFormat() & 0xff) == AF_NAME;
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny.setValue(&bVal, ::getBooleanCppuType());
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_BOOL2:
|
|
|
|
bVal = IsFixed();
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny.setValue(&bVal, ::getBooleanCppuType());
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
rAny <<= rtl::OUString(GetContent());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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 SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
SetFormat( *(sal_Bool*)rAny.getValue() ? AF_NAME : AF_SHORTCUT );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_BOOL2:
|
|
|
|
if( *(sal_Bool*)rAny.getValue() )
|
2000-09-18 23:08:29 +00:00
|
|
|
SetFormat( GetFormat() | AF_FIXED);
|
|
|
|
else
|
|
|
|
SetFormat( GetFormat() & ~AF_FIXED);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
::GetString( rAny, aContent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwFileNameFieldType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwFileNameFieldType::SwFileNameFieldType(SwDoc *pDocument)
|
|
|
|
: SwFieldType( RES_FILENAMEFLD )
|
|
|
|
{
|
|
|
|
pDoc = pDocument;
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
String SwFileNameFieldType::Expand(sal_uLong nFmt) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
String aRet;
|
|
|
|
const SwDocShell* pDShell = pDoc->GetDocShell();
|
|
|
|
if( pDShell && pDShell->HasName() )
|
|
|
|
{
|
|
|
|
const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
|
|
|
|
switch( nFmt & ~FF_FIXED )
|
|
|
|
{
|
|
|
|
case FF_PATH:
|
|
|
|
{
|
|
|
|
if( INET_PROT_FILE == rURLObj.GetProtocol() )
|
|
|
|
{
|
|
|
|
INetURLObject aTemp(rURLObj);
|
|
|
|
aTemp.removeSegment();
|
2011-02-08 08:51:51 +01:00
|
|
|
// last slash should belong to the pathname
|
|
|
|
aRet = aTemp.PathToFileName();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-31 10:13:43 +00:00
|
|
|
aRet = URIHelper::removePassword(
|
|
|
|
rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
|
2000-09-18 23:08:29 +00:00
|
|
|
INetURLObject::WAS_ENCODED, URL_DECODE );
|
2004-12-13 11:34:41 +00:00
|
|
|
aRet.Erase( aRet.Search( String(rURLObj.GetLastName(
|
|
|
|
URL_DECODE )) ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FF_NAME:
|
2010-12-30 00:56:21 +02:00
|
|
|
aRet = rURLObj.GetLastName( INetURLObject::DECODE_WITH_CHARSET );
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FF_NAME_NOEXT:
|
|
|
|
aRet = rURLObj.GetBase();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if( INET_PROT_FILE == rURLObj.GetProtocol() )
|
|
|
|
aRet = rURLObj.GetFull();
|
|
|
|
else
|
2001-08-31 10:13:43 +00:00
|
|
|
aRet = URIHelper::removePassword(
|
|
|
|
rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
|
2000-09-18 23:08:29 +00:00
|
|
|
INetURLObject::WAS_ENCODED, URL_DECODE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwFileNameFieldType::Copy() const
|
|
|
|
{
|
|
|
|
SwFieldType *pTmp = new SwFileNameFieldType(pDoc);
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwFileNameField
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwFileNameField::SwFileNameField(SwFileNameFieldType* pTyp, sal_uInt32 nFmt)
|
|
|
|
: SwField(pTyp, nFmt)
|
|
|
|
{
|
|
|
|
aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwFileNameField::Expand() const
|
|
|
|
{
|
|
|
|
if (!IsFixed())
|
|
|
|
((SwFileNameField*)this)->aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
|
|
|
|
|
|
|
|
return aContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwFileNameField::Copy() const
|
|
|
|
{
|
|
|
|
SwFileNameField *pTmp =
|
|
|
|
new SwFileNameField((SwFileNameFieldType*)GetTyp(), GetFormat());
|
|
|
|
pTmp->SetExpansion(aContent);
|
|
|
|
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwFileNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
sal_Int16 nRet;
|
|
|
|
switch( GetFormat() &(~FF_FIXED) )
|
|
|
|
{
|
|
|
|
case FF_PATH:
|
|
|
|
nRet = text::FilenameDisplayFormat::PATH;
|
|
|
|
break;
|
|
|
|
case FF_NAME_NOEXT:
|
|
|
|
nRet = text::FilenameDisplayFormat::NAME;
|
|
|
|
break;
|
|
|
|
case FF_NAME:
|
|
|
|
nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
|
|
|
|
break;
|
|
|
|
default: nRet = text::FilenameDisplayFormat::FULL;
|
|
|
|
}
|
|
|
|
rAny <<= nRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_BOOL2:
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bVal = IsFixed();
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny.setValue(&bVal, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_PAR3:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(GetContent());
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
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 SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
//JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
|
|
|
|
// called with a int32 value! But normally we need
|
|
|
|
// here only a int16
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int32 nType = 0;
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny >>= nType;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bFixed = IsFixed();
|
2001-10-24 17:56:14 +00:00
|
|
|
switch( nType )
|
|
|
|
{
|
|
|
|
case text::FilenameDisplayFormat::PATH:
|
|
|
|
nType = FF_PATH;
|
|
|
|
break;
|
|
|
|
case text::FilenameDisplayFormat::NAME:
|
|
|
|
nType = FF_NAME_NOEXT;
|
|
|
|
break;
|
|
|
|
case text::FilenameDisplayFormat::NAME_AND_EXT:
|
|
|
|
nType = FF_NAME;
|
|
|
|
break;
|
|
|
|
default: nType = FF_PATHNAME;
|
|
|
|
}
|
|
|
|
if(bFixed)
|
|
|
|
nType |= FF_FIXED;
|
|
|
|
SetFormat(nType);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_BOOL2:
|
|
|
|
if( *(sal_Bool*)rAny.getValue() )
|
2000-09-18 23:08:29 +00:00
|
|
|
SetFormat( GetFormat() | FF_FIXED);
|
|
|
|
else
|
|
|
|
SetFormat( GetFormat() & ~FF_FIXED);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_PAR3:
|
|
|
|
::GetString( rAny, aContent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwTemplNameFieldType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument)
|
|
|
|
: SwFieldType( RES_TEMPLNAMEFLD )
|
|
|
|
{
|
|
|
|
pDoc = pDocument;
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
String SwTemplNameFieldType::Expand(sal_uLong nFmt) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( nFmt < FF_END, "Expand: kein guelt. Fmt!" );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
String aRet;
|
2008-02-26 13:10:15 +00:00
|
|
|
SwDocShell *pDocShell(pDoc->GetDocShell());
|
|
|
|
DBG_ASSERT(pDocShell, "no SwDocShell");
|
|
|
|
if (pDocShell) {
|
|
|
|
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
|
|
|
|
pDocShell->GetModel(), uno::UNO_QUERY_THROW);
|
|
|
|
uno::Reference<document::XDocumentProperties> xDocProps(
|
|
|
|
xDPS->getDocumentProperties());
|
|
|
|
DBG_ASSERT(xDocProps.is(), "Doc has no DocumentProperties");
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( FF_UI_NAME == nFmt )
|
2008-02-26 13:10:15 +00:00
|
|
|
aRet = xDocProps->getTemplateName();
|
2011-01-28 15:31:00 +01:00
|
|
|
else if( xDocProps->getTemplateURL().getLength() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( FF_UI_RANGE == nFmt )
|
|
|
|
{
|
|
|
|
// fuers besorgen vom RegionNamen !!
|
|
|
|
SfxDocumentTemplates aFac;
|
|
|
|
aFac.Construct();
|
|
|
|
String sTmp;
|
2008-02-26 13:10:15 +00:00
|
|
|
aFac.GetLogicNames( xDocProps->getTemplateURL(), aRet, sTmp );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-26 13:10:15 +00:00
|
|
|
INetURLObject aPathName( xDocProps->getTemplateURL() );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( FF_NAME == nFmt )
|
|
|
|
aRet = aPathName.GetName(URL_DECODE);
|
|
|
|
else if( FF_NAME_NOEXT == nFmt )
|
|
|
|
aRet = aPathName.GetBase();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( FF_PATH == nFmt )
|
|
|
|
{
|
|
|
|
aPathName.removeSegment();
|
|
|
|
aRet = aPathName.GetFull();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aRet = aPathName.GetFull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwTemplNameFieldType::Copy() const
|
|
|
|
{
|
|
|
|
SwFieldType *pTmp = new SwTemplNameFieldType(pDoc);
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwTemplNameField
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwTemplNameField::SwTemplNameField(SwTemplNameFieldType* pTyp, sal_uInt32 nFmt)
|
|
|
|
: SwField(pTyp, nFmt)
|
|
|
|
{}
|
|
|
|
|
|
|
|
String SwTemplNameField::Expand() const
|
|
|
|
{
|
|
|
|
return((SwTemplNameFieldType*)GetTyp())->Expand(GetFormat());
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwTemplNameField::Copy() const
|
|
|
|
{
|
|
|
|
SwTemplNameField *pTmp =
|
|
|
|
new SwTemplNameField((SwTemplNameFieldType*)GetTyp(), GetFormat());
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwTemplNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch ( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
sal_Int16 nRet;
|
|
|
|
switch( GetFormat() )
|
|
|
|
{
|
|
|
|
case FF_PATH: nRet = text::FilenameDisplayFormat::PATH; break;
|
|
|
|
case FF_NAME_NOEXT: nRet = text::FilenameDisplayFormat::NAME; break;
|
|
|
|
case FF_NAME: nRet = text::FilenameDisplayFormat::NAME_AND_EXT; break;
|
|
|
|
case FF_UI_RANGE: nRet = text::TemplateDisplayFormat::AREA; break;
|
|
|
|
case FF_UI_NAME: nRet = text::TemplateDisplayFormat::TITLE; break;
|
|
|
|
default: nRet = text::FilenameDisplayFormat::FULL;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
|
|
|
rAny <<= nRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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 SwTemplNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch ( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
//JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
|
|
|
|
// called with a int32 value! But normally we need
|
|
|
|
// here only a int16
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int32 nType = 0;
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny >>= nType;
|
|
|
|
switch( nType )
|
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
case text::FilenameDisplayFormat::PATH:
|
|
|
|
SetFormat(FF_PATH);
|
|
|
|
break;
|
|
|
|
case text::FilenameDisplayFormat::NAME:
|
|
|
|
SetFormat(FF_NAME_NOEXT);
|
|
|
|
break;
|
|
|
|
case text::FilenameDisplayFormat::NAME_AND_EXT:
|
|
|
|
SetFormat(FF_NAME);
|
|
|
|
break;
|
|
|
|
case text::TemplateDisplayFormat::AREA :
|
|
|
|
SetFormat(FF_UI_RANGE);
|
|
|
|
break;
|
|
|
|
case text::TemplateDisplayFormat::TITLE :
|
|
|
|
SetFormat(FF_UI_NAME);
|
|
|
|
break;
|
|
|
|
default: SetFormat(FF_PATHNAME);
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwDocStatFieldType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwDocStatFieldType::SwDocStatFieldType(SwDoc* pDocument)
|
2001-02-23 11:45:30 +00:00
|
|
|
: SwFieldType( RES_DOCSTATFLD ), nNumberingType( SVX_NUM_ARABIC )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
pDoc = pDocument;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwDocStatFieldType::Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const
|
|
|
|
{
|
|
|
|
sal_uInt32 nVal = 0;
|
|
|
|
const SwDocStat& rDStat = pDoc->GetDocStat();
|
|
|
|
switch( nSubType )
|
|
|
|
{
|
|
|
|
case DS_TBL: nVal = rDStat.nTbl; break;
|
|
|
|
case DS_GRF: nVal = rDStat.nGrf; break;
|
|
|
|
case DS_OLE: nVal = rDStat.nOLE; break;
|
|
|
|
case DS_PARA: nVal = rDStat.nPara; break;
|
|
|
|
case DS_WORD: nVal = rDStat.nWord; break;
|
|
|
|
case DS_CHAR: nVal = rDStat.nChar; break;
|
|
|
|
case DS_PAGE:
|
|
|
|
if( pDoc->GetRootFrm() )
|
|
|
|
((SwDocStat &)rDStat).nPage = pDoc->GetRootFrm()->GetPageNum();
|
|
|
|
nVal = rDStat.nPage;
|
|
|
|
if( SVX_NUM_PAGEDESC == nFmt )
|
2001-02-23 11:45:30 +00:00
|
|
|
nFmt = (sal_uInt32)nNumberingType;
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( sal_False, "SwDocStatFieldType::Expand: unbekannter SubType" );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2001-01-18 13:08:36 +00:00
|
|
|
String sRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
if( nVal <= SHRT_MAX )
|
2001-01-18 13:08:36 +00:00
|
|
|
sRet = FormatNumber( (sal_uInt16)nVal, nFmt );
|
|
|
|
else
|
|
|
|
sRet = String::CreateFromInt32( nVal );
|
|
|
|
return sRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwDocStatFieldType::Copy() const
|
|
|
|
{
|
|
|
|
SwDocStatFieldType *pTmp = new SwDocStatFieldType(pDoc);
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwDocStatFieldType
|
|
|
|
Aus historischen Gruenden steht in nFormat der
|
|
|
|
SubType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFmt)
|
|
|
|
: SwField(pTyp, nFmt),
|
|
|
|
nSubType(nSub)
|
|
|
|
{}
|
|
|
|
|
|
|
|
String SwDocStatField::Expand() const
|
|
|
|
{
|
|
|
|
return((SwDocStatFieldType*)GetTyp())->Expand(nSubType, GetFormat());
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwDocStatField::Copy() const
|
|
|
|
{
|
|
|
|
SwDocStatField *pTmp = new SwDocStatField(
|
|
|
|
(SwDocStatFieldType*)GetTyp(), nSubType, GetFormat() );
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 SwDocStatField::GetSubType() const
|
|
|
|
{
|
|
|
|
return nSubType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDocStatField::SetSubType(sal_uInt16 nSub)
|
|
|
|
{
|
|
|
|
nSubType = nSub;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDocStatField::ChangeExpansion( const SwFrm* pFrm )
|
|
|
|
{
|
|
|
|
if( DS_PAGE == nSubType && SVX_NUM_PAGEDESC == GetFormat() )
|
|
|
|
((SwDocStatFieldType*)GetTyp())->SetNumFormat(
|
2001-02-23 11:45:30 +00:00
|
|
|
pFrm->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType() );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwDocStatField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch ( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_USHORT2:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= (sal_Int16)GetFormat();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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 SwDocStatField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-10-04 15:23:52 +01:00
|
|
|
bool bRet = false;
|
2007-09-27 07:48:37 +00:00
|
|
|
switch ( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_USHORT2:
|
|
|
|
{
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int16 nSet = 0;
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny >>= nSet;
|
|
|
|
if(nSet <= SVX_NUM_CHARS_LOWER_LETTER_N &&
|
|
|
|
nSet != SVX_NUM_CHAR_SPECIAL &&
|
|
|
|
nSet != SVX_NUM_BITMAP)
|
|
|
|
{
|
|
|
|
SetFormat(nSet);
|
2010-10-04 15:23:52 +01:00
|
|
|
bRet = true;
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
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
|
|
|
return bRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: DokumentinfoFields
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwDocInfoFieldType::SwDocInfoFieldType(SwDoc* pDc)
|
|
|
|
: SwValueFieldType( pDc, RES_DOCINFOFLD )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SwFieldType* SwDocInfoFieldType::Copy() const
|
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
SwDocInfoFieldType* pTyp = new SwDocInfoFieldType(GetDoc());
|
|
|
|
return pTyp;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void lcl_GetLocalDataWrapper( sal_uLong nLang,
|
2009-09-08 04:57:32 +00:00
|
|
|
const LocaleDataWrapper **ppAppLocalData,
|
|
|
|
const LocaleDataWrapper **ppLocalData )
|
2001-02-14 08:58:47 +00:00
|
|
|
{
|
2009-09-08 04:57:32 +00:00
|
|
|
SvtSysLocale aLocale;
|
|
|
|
*ppAppLocalData = &aLocale.GetLocaleData();
|
2001-02-14 08:58:47 +00:00
|
|
|
*ppLocalData = *ppAppLocalData;
|
|
|
|
if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLocale() ) )
|
|
|
|
*ppLocalData = new LocaleDataWrapper(
|
|
|
|
::comphelper::getProcessServiceFactory(),
|
2007-09-27 07:48:37 +00:00
|
|
|
SvxCreateLocale( static_cast<LanguageType>(nLang) ) );
|
2001-02-14 08:58:47 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-14 08:58:47 +00:00
|
|
|
String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
|
2007-11-26 14:29:04 +00:00
|
|
|
sal_uInt16 nLang, const String& rName ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-14 08:58:47 +00:00
|
|
|
String aStr;
|
2009-09-08 04:57:32 +00:00
|
|
|
const LocaleDataWrapper *pAppLocalData = 0, *pLocalData = 0;
|
2008-02-26 13:10:15 +00:00
|
|
|
SwDocShell *pDocShell(GetDoc()->GetDocShell());
|
|
|
|
DBG_ASSERT(pDocShell, "no SwDocShell");
|
|
|
|
if (!pDocShell) { return aStr; }
|
|
|
|
|
|
|
|
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
|
|
|
|
pDocShell->GetModel(), uno::UNO_QUERY_THROW);
|
|
|
|
uno::Reference<document::XDocumentProperties> xDocProps(
|
|
|
|
xDPS->getDocumentProperties());
|
|
|
|
DBG_ASSERT(xDocProps.is(), "Doc has no DocumentProperties");
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
sal_uInt16 nExtSub = nSub & 0xff00;
|
|
|
|
nSub &= 0xff; // ExtendedSubTypes nicht beachten
|
|
|
|
|
|
|
|
switch(nSub)
|
|
|
|
{
|
2008-02-26 13:10:15 +00:00
|
|
|
case DI_TITEL: aStr = xDocProps->getTitle(); break;
|
|
|
|
case DI_THEMA: aStr = xDocProps->getSubject(); break;
|
|
|
|
case DI_KEYS: aStr = ::comphelper::string::convertCommaSeparated(
|
|
|
|
xDocProps->getKeywords());
|
|
|
|
break;
|
|
|
|
case DI_COMMENT:aStr = xDocProps->getDescription(); break;
|
2001-02-14 08:58:47 +00:00
|
|
|
case DI_DOCNO: aStr = String::CreateFromInt32(
|
2008-02-26 13:10:15 +00:00
|
|
|
xDocProps->getEditingCycles() );
|
2001-02-14 08:58:47 +00:00
|
|
|
break;
|
|
|
|
case DI_EDIT:
|
|
|
|
if ( !nFormat )
|
|
|
|
{
|
|
|
|
lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
|
2008-02-26 13:10:15 +00:00
|
|
|
sal_Int32 dur = xDocProps->getEditingDuration();
|
|
|
|
aStr = pLocalData->getTime( Time(dur/3600, (dur%3600)/60, dur%60),
|
|
|
|
sal_False, sal_False);
|
2001-02-14 08:58:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-26 13:10:15 +00:00
|
|
|
sal_Int32 dur = xDocProps->getEditingDuration();
|
|
|
|
double fVal = Time(dur/3600, (dur%3600)/60, dur%60).GetTimeInDays();
|
2001-02-14 08:58:47 +00:00
|
|
|
aStr = ExpandValue(fVal, nFormat, nLang);
|
|
|
|
}
|
|
|
|
break;
|
2007-11-26 14:29:04 +00:00
|
|
|
case DI_CUSTOM:
|
|
|
|
{
|
|
|
|
::rtl::OUString sVal;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
uno::Any aAny;
|
2008-02-26 13:10:15 +00:00
|
|
|
uno::Reference < beans::XPropertySet > xSet(
|
|
|
|
xDocProps->getUserDefinedProperties(),
|
|
|
|
uno::UNO_QUERY_THROW);
|
2007-11-26 14:29:04 +00:00
|
|
|
aAny = xSet->getPropertyValue( rName );
|
|
|
|
|
|
|
|
uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory()
|
2010-10-27 11:38:46 +01:00
|
|
|
->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY );
|
2007-11-26 14:29:04 +00:00
|
|
|
uno::Any aNew;
|
|
|
|
aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
|
|
|
|
aNew >>= sVal;
|
|
|
|
}
|
|
|
|
catch (uno::Exception&) {}
|
|
|
|
return sVal;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-14 08:58:47 +00:00
|
|
|
default:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2008-02-26 13:10:15 +00:00
|
|
|
String aName( xDocProps->getAuthor() );
|
|
|
|
util::DateTime uDT( xDocProps->getCreationDate() );
|
|
|
|
Date aD(uDT.Day, uDT.Month, uDT.Year);
|
|
|
|
Time aT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
|
|
|
|
DateTime aDate(aD,aT);
|
2000-09-18 23:08:29 +00:00
|
|
|
if( nSub == DI_CREATE )
|
|
|
|
; // das wars schon!!
|
2008-02-26 13:10:15 +00:00
|
|
|
else if( nSub == DI_CHANGE )
|
2007-07-17 12:07:24 +00:00
|
|
|
{
|
2008-02-26 13:10:15 +00:00
|
|
|
aName = xDocProps->getModifiedBy();
|
|
|
|
uDT = xDocProps->getModificationDate();
|
|
|
|
Date bD(uDT.Day, uDT.Month, uDT.Year);
|
|
|
|
Time bT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
|
|
|
|
DateTime bDate(bD,bT);
|
|
|
|
aDate = bDate;
|
2007-07-17 12:07:24 +00:00
|
|
|
}
|
2008-02-26 13:10:15 +00:00
|
|
|
else if( nSub == DI_PRINT )
|
2007-07-17 12:07:24 +00:00
|
|
|
{
|
2008-02-26 13:10:15 +00:00
|
|
|
aName = xDocProps->getPrintedBy();
|
|
|
|
uDT = xDocProps->getPrintDate();
|
|
|
|
Date bD(uDT.Day, uDT.Month, uDT.Year);
|
|
|
|
Time bT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
|
|
|
|
DateTime bDate(bD,bT);
|
|
|
|
aDate = bDate;
|
2007-07-17 12:07:24 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2001-02-14 08:58:47 +00:00
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2007-07-17 12:07:24 +00:00
|
|
|
if (aDate.IsValid())
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
switch (nExtSub & ~DI_SUB_FIXED)
|
|
|
|
{
|
2001-02-14 08:58:47 +00:00
|
|
|
case DI_SUB_AUTHOR:
|
2007-07-17 12:07:24 +00:00
|
|
|
aStr = aName;
|
2001-02-14 08:58:47 +00:00
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-14 08:58:47 +00:00
|
|
|
case DI_SUB_TIME:
|
|
|
|
if (!nFormat)
|
|
|
|
{
|
|
|
|
lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
|
|
|
|
&pLocalData );
|
2007-07-17 12:07:24 +00:00
|
|
|
aStr = pLocalData->getTime( aDate,
|
2001-02-14 08:58:47 +00:00
|
|
|
sal_False, sal_False);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Numberformatter anwerfen!
|
|
|
|
double fVal = SwDateTimeField::GetDateTime( GetDoc(),
|
2007-07-17 12:07:24 +00:00
|
|
|
aDate);
|
2001-02-14 08:58:47 +00:00
|
|
|
aStr = ExpandValue(fVal, nFormat, nLang);
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-14 08:58:47 +00:00
|
|
|
case DI_SUB_DATE:
|
|
|
|
if (!nFormat)
|
|
|
|
{
|
|
|
|
lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
|
|
|
|
&pLocalData );
|
2007-07-17 12:07:24 +00:00
|
|
|
aStr = pLocalData->getDate( aDate );
|
2001-02-14 08:58:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Numberformatter anwerfen!
|
|
|
|
double fVal = SwDateTimeField::GetDateTime( GetDoc(),
|
2007-07-17 12:07:24 +00:00
|
|
|
aDate);
|
2001-02-14 08:58:47 +00:00
|
|
|
aStr = ExpandValue(fVal, nFormat, nLang);
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-02-14 08:58:47 +00:00
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-14 08:58:47 +00:00
|
|
|
|
|
|
|
if( pAppLocalData != pLocalData )
|
|
|
|
delete pLocalData;
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
return aStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-26 14:29:04 +00:00
|
|
|
SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const String& rName, sal_uInt32 nFmt) :
|
2007-09-27 07:48:37 +00:00
|
|
|
SwValueField(pTyp, nFmt), nSubType(nSub)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-11-26 14:29:04 +00:00
|
|
|
aName = rName;
|
|
|
|
aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, nFmt, GetLanguage(), aName);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2007-11-26 14:29:04 +00:00
|
|
|
|
2008-04-03 15:51:46 +00:00
|
|
|
SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const String& rName, const String& rValue, sal_uInt32 nFmt) :
|
|
|
|
SwValueField(pTyp, nFmt), nSubType(nSub)
|
|
|
|
{
|
|
|
|
aName = rName;
|
|
|
|
aContent = rValue;
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2009-10-08 16:15:40 +02:00
|
|
|
template<class T>
|
|
|
|
double lcl_TimeToDouble( const T& rTime )
|
|
|
|
{
|
|
|
|
const double fMilliSecondsPerDay = 86400000.0;
|
|
|
|
return ((rTime.Hours*3600000)+(rTime.Minutes*60000)+(rTime.Seconds*1000)+(rTime.HundredthSeconds*10)) / fMilliSecondsPerDay;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class D>
|
|
|
|
double lcl_DateToDouble( const D& rDate, const Date& rNullDate )
|
|
|
|
{
|
|
|
|
long nDate = Date::DateToDays( rDate.Day, rDate.Month, rDate.Year );
|
|
|
|
long nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() );
|
|
|
|
return double( nDate - nNullDate );
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
String SwDocInfoField::Expand() const
|
|
|
|
{
|
2008-04-03 15:51:46 +00:00
|
|
|
if ( ( nSubType & 0xFF ) == DI_CUSTOM )
|
|
|
|
{
|
|
|
|
// custom properties currently need special treatment
|
|
|
|
// we don't have a secure way to detect "real" custom properties in Word Import of text fields
|
|
|
|
// so we treat *every* unknown property as a custom property, even the "built-in" section in Word's document summary information stream
|
|
|
|
// as these properties have not been inserted when the document summary information was imported, we do it here
|
|
|
|
// this approach is still a lot better than the old one to import such fields as "user fields" and simple text
|
2008-07-01 10:25:55 +00:00
|
|
|
SwDocShell* pDocShell = GetDoc()->GetDocShell();
|
|
|
|
if( !pDocShell )
|
|
|
|
return aContent;
|
2008-04-03 15:51:46 +00:00
|
|
|
try
|
|
|
|
{
|
2008-07-01 10:25:55 +00:00
|
|
|
uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW);
|
2008-04-03 15:51:46 +00:00
|
|
|
uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties());
|
|
|
|
uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
|
2008-07-01 10:25:55 +00:00
|
|
|
uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
|
|
|
|
|
|
|
|
uno::Any aAny;
|
|
|
|
if( xSetInfo->hasPropertyByName( aName ) )
|
|
|
|
aAny = xSet->getPropertyValue( aName );
|
2008-04-03 15:51:46 +00:00
|
|
|
if ( aAny.getValueType() != ::getVoidCppuType() )
|
|
|
|
{
|
|
|
|
// "void" type means that the property has not been inserted until now
|
|
|
|
if ( !IsFixed() )
|
|
|
|
{
|
|
|
|
// if the field is "fixed" we don't update it from the property
|
|
|
|
::rtl::OUString sVal;
|
|
|
|
uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory()
|
2010-10-27 11:38:46 +01:00
|
|
|
->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY );
|
2009-10-08 16:15:40 +02:00
|
|
|
util::Date aDate;
|
|
|
|
util::DateTime aDateTime;
|
2009-11-26 12:52:39 +01:00
|
|
|
util::Duration aDuration;
|
2009-10-08 16:15:40 +02:00
|
|
|
if( aAny >>= aDate)
|
|
|
|
{
|
|
|
|
SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
|
|
|
|
Date* pNullDate = pFormatter->GetNullDate();
|
|
|
|
sVal = ExpandValue( lcl_DateToDouble<util::Date>( aDate, *pNullDate ), GetFormat(), GetLanguage());
|
|
|
|
}
|
|
|
|
else if( aAny >>= aDateTime )
|
|
|
|
{
|
|
|
|
double fDateTime = lcl_TimeToDouble<util::DateTime>( aDateTime );
|
|
|
|
SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
|
|
|
|
Date* pNullDate = pFormatter->GetNullDate();
|
|
|
|
fDateTime += lcl_DateToDouble<util::DateTime>( aDateTime, *pNullDate );
|
|
|
|
sVal = ExpandValue( fDateTime, GetFormat(), GetLanguage());
|
|
|
|
}
|
2009-11-26 12:52:39 +01:00
|
|
|
else if( aAny >>= aDuration )
|
2009-10-08 16:15:40 +02:00
|
|
|
{
|
2009-11-26 12:52:39 +01:00
|
|
|
String sText(aDuration.Negative ? '-' : '+');
|
|
|
|
sText += ViewShell::GetShellRes()->sDurationFormat;
|
|
|
|
sText.SearchAndReplace(String::CreateFromAscii( "%1"), String::CreateFromInt32( aDuration.Years ) );
|
|
|
|
sText.SearchAndReplace(String::CreateFromAscii( "%2"), String::CreateFromInt32( aDuration.Months ) );
|
|
|
|
sText.SearchAndReplace(String::CreateFromAscii( "%3"), String::CreateFromInt32( aDuration.Days ) );
|
|
|
|
sText.SearchAndReplace(String::CreateFromAscii( "%4"), String::CreateFromInt32( aDuration.Hours ) );
|
|
|
|
sText.SearchAndReplace(String::CreateFromAscii( "%5"), String::CreateFromInt32( aDuration.Minutes) );
|
|
|
|
sText.SearchAndReplace(String::CreateFromAscii( "%6"), String::CreateFromInt32( aDuration.Seconds) );
|
|
|
|
sVal = sText;
|
2009-10-08 16:15:40 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
|
|
|
|
aNew >>= sVal;
|
|
|
|
}
|
2008-04-03 15:51:46 +00:00
|
|
|
((SwDocInfoField*)this)->aContent = sVal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (uno::Exception&) {}
|
|
|
|
}
|
|
|
|
else if ( !IsFixed() )
|
2007-11-26 14:29:04 +00:00
|
|
|
((SwDocInfoField*)this)->aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, GetFormat(), GetLanguage(), aName);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
return aContent;
|
|
|
|
}
|
|
|
|
|
2010-10-04 17:14:34 +02:00
|
|
|
String SwDocInfoField::GetFieldName() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-10-04 17:14:34 +02:00
|
|
|
String aStr(SwFieldType::GetTypeStr(GetTypeId()));
|
|
|
|
aStr += ':';
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-10-04 17:14:34 +02:00
|
|
|
sal_uInt16 const nSub = nSubType & 0xff;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-10-04 17:14:34 +02:00
|
|
|
switch (nSub)
|
|
|
|
{
|
|
|
|
case DI_CUSTOM:
|
|
|
|
aStr += aName;
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-10-04 17:14:34 +02:00
|
|
|
default:
|
|
|
|
aStr += *ViewShell::GetShellRes()
|
|
|
|
->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ];
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 17:14:34 +02:00
|
|
|
if (IsFixed())
|
|
|
|
{
|
|
|
|
aStr += ' ';
|
|
|
|
aStr += ViewShell::GetShellRes()->aFixedStr;
|
|
|
|
}
|
|
|
|
return aStr;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwDocInfoField::Copy() const
|
|
|
|
{
|
2007-11-26 14:29:04 +00:00
|
|
|
SwDocInfoField* pFld = new SwDocInfoField((SwDocInfoFieldType*)GetTyp(), nSubType, aName, GetFormat());
|
2002-11-15 10:17:38 +00:00
|
|
|
pFld->SetAutomaticLanguage(IsAutomaticLanguage());
|
2000-09-18 23:08:29 +00:00
|
|
|
pFld->aContent = aContent;
|
|
|
|
|
|
|
|
return pFld;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 SwDocInfoField::GetSubType() const
|
|
|
|
{
|
|
|
|
return nSubType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDocInfoField::SetSubType(sal_uInt16 nSub)
|
|
|
|
{
|
|
|
|
nSubType = nSub;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDocInfoField::SetLanguage(sal_uInt16 nLng)
|
|
|
|
{
|
|
|
|
if (!GetFormat())
|
|
|
|
SwField::SetLanguage(nLng);
|
|
|
|
else
|
|
|
|
SwValueField::SetLanguage(nLng);
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwDocInfoField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(aContent);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
2007-11-26 14:29:04 +00:00
|
|
|
case FIELD_PROP_PAR4:
|
|
|
|
rAny <<= OUString(aName);
|
|
|
|
break;
|
|
|
|
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= (sal_Int16)aContent.ToInt32();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
{
|
|
|
|
sal_Bool bVal = 0 != (nSubType & DI_SUB_FIXED);
|
|
|
|
rAny.setValue(&bVal, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_FORMAT:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= (sal_Int32)GetFormat();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_DOUBLE:
|
|
|
|
{
|
|
|
|
double fVal = GetValue();
|
|
|
|
rAny.setValue(&fVal, ::getCppuType(&fVal));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR3:
|
|
|
|
rAny <<= rtl::OUString(Expand());
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL2:
|
|
|
|
{
|
|
|
|
sal_uInt16 nExtSub = (nSubType & 0xff00) & ~DI_SUB_FIXED;
|
|
|
|
sal_Bool bVal = (nExtSub == DI_SUB_DATE);
|
|
|
|
rAny.setValue(&bVal, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2007-09-27 07:48:37 +00:00
|
|
|
return SwField::QueryValue(rAny, nWhichId);
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
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 SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int32 nValue = 0;
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
if( nSubType & DI_SUB_FIXED )
|
|
|
|
::GetString( rAny, aContent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_USHORT1:
|
|
|
|
if( nSubType & DI_SUB_FIXED )
|
|
|
|
{
|
|
|
|
rAny >>= nValue;
|
|
|
|
aContent = String::CreateFromInt32(nValue);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
if(*(sal_Bool*)rAny.getValue())
|
2000-09-18 23:08:29 +00:00
|
|
|
nSubType |= DI_SUB_FIXED;
|
|
|
|
else
|
|
|
|
nSubType &= ~DI_SUB_FIXED;
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_FORMAT:
|
|
|
|
{
|
|
|
|
rAny >>= nValue;
|
|
|
|
if( nValue >= 0)
|
|
|
|
SetFormat(nValue);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_PAR3:
|
|
|
|
::GetString( rAny, aContent );
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL2:
|
2000-11-22 15:49:00 +00:00
|
|
|
nSubType &= 0xf0ff;
|
2000-09-18 23:08:29 +00:00
|
|
|
if(*(sal_Bool*)rAny.getValue())
|
|
|
|
nSubType |= DI_SUB_DATE;
|
|
|
|
else
|
|
|
|
nSubType |= DI_SUB_TIME;
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-09-27 07:48:37 +00:00
|
|
|
return SwField::PutValue(rAny, nWhichId);
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwHiddenTxtFieldType by JP
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwHiddenTxtFieldType::SwHiddenTxtFieldType( sal_Bool bSetHidden )
|
|
|
|
: SwFieldType( RES_HIDDENTXTFLD ), bHidden( bSetHidden )
|
2009-12-03 15:25:10 +01:00
|
|
|
{
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwFieldType* SwHiddenTxtFieldType::Copy() const
|
|
|
|
{
|
|
|
|
return new SwHiddenTxtFieldType( bHidden );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwHiddenTxtFieldType::SetHiddenFlag( sal_Bool bSetHidden )
|
|
|
|
{
|
|
|
|
if( bHidden != bSetHidden )
|
|
|
|
{
|
|
|
|
bHidden = bSetHidden;
|
|
|
|
UpdateFlds(); // alle HiddenText benachrichtigen
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwHiddenTxtField::SwHiddenTxtField( SwHiddenTxtFieldType* pFldType,
|
|
|
|
sal_Bool bConditional,
|
|
|
|
const String& rCond,
|
|
|
|
const String& rStr,
|
|
|
|
sal_Bool bHidden,
|
|
|
|
sal_uInt16 nSub) :
|
2007-09-27 07:48:37 +00:00
|
|
|
SwField( pFldType ), aCond(rCond), nSubType(nSub),
|
|
|
|
bCanToggle(bConditional), bIsHidden(bHidden), bValid(sal_False)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if(nSubType == TYP_CONDTXTFLD)
|
|
|
|
{
|
|
|
|
sal_uInt16 nPos = 0;
|
|
|
|
aTRUETxt = rStr.GetToken(0, '|', nPos);
|
|
|
|
|
|
|
|
if(nPos != STRING_NOTFOUND)
|
|
|
|
{
|
|
|
|
aFALSETxt = rStr.GetToken(0, '|', nPos);
|
|
|
|
if(nPos != STRING_NOTFOUND)
|
|
|
|
{
|
|
|
|
aContent = rStr.GetToken(0, '|', nPos);
|
|
|
|
bValid = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aTRUETxt = rStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwHiddenTxtField::SwHiddenTxtField( SwHiddenTxtFieldType* pFldType,
|
|
|
|
const String& rCond,
|
|
|
|
const String& rTrue,
|
|
|
|
const String& rFalse,
|
|
|
|
sal_uInt16 nSub)
|
2007-09-27 07:48:37 +00:00
|
|
|
: SwField( pFldType ), aTRUETxt(rTrue), aFALSETxt(rFalse), aCond(rCond), nSubType(nSub),
|
|
|
|
bIsHidden(sal_True), bValid(sal_False)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
bCanToggle = aCond.Len() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwHiddenTxtField::Expand() const
|
|
|
|
{
|
|
|
|
// Type: !Hidden -> immer anzeigen
|
|
|
|
// Hide -> Werte die Bedingung aus
|
|
|
|
|
|
|
|
if( TYP_CONDTXTFLD == nSubType )
|
|
|
|
{
|
|
|
|
if( bValid )
|
|
|
|
return aContent;
|
|
|
|
|
|
|
|
if( bCanToggle && !bIsHidden )
|
|
|
|
return aTRUETxt;
|
|
|
|
}
|
|
|
|
else if( !((SwHiddenTxtFieldType*)GetTyp())->GetHiddenFlag() ||
|
|
|
|
( bCanToggle && bIsHidden ))
|
|
|
|
return aTRUETxt;
|
|
|
|
|
|
|
|
return aFALSETxt;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Aktuellen Field-Value holen und cachen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwHiddenTxtField::Evaluate(SwDoc* pDoc)
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE(pDoc, "Wo ist das Dokument Seniore");
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( TYP_CONDTXTFLD == nSubType )
|
|
|
|
{
|
|
|
|
SwNewDBMgr* pMgr = pDoc->GetNewDBMgr();
|
|
|
|
|
|
|
|
bValid = sal_False;
|
|
|
|
String sTmpName;
|
|
|
|
|
|
|
|
if (bCanToggle && !bIsHidden)
|
|
|
|
sTmpName = aTRUETxt;
|
|
|
|
else
|
|
|
|
sTmpName = aFALSETxt;
|
|
|
|
|
2011-02-08 08:51:51 +01:00
|
|
|
// Datenbankausdruecke muessen sich von
|
2000-09-18 23:08:29 +00:00
|
|
|
// einfachem Text unterscheiden. also wird der einfache Text
|
|
|
|
// bevorzugt in Anfuehrungszeichen gesetzt.
|
|
|
|
// Sind diese vorhanden werden umschliessende entfernt.
|
|
|
|
// Wenn nicht, dann wird auf die Tauglichkeit als Datenbankname
|
|
|
|
// geprueft. Nur wenn zwei oder mehr Punkte vorhanden sind und kein
|
|
|
|
// Anfuehrungszeichen enthalten ist, gehen wir von einer DB aus.
|
|
|
|
if(sTmpName.Len() > 1 && sTmpName.GetChar(0) == '\"' &&
|
2003-08-19 10:57:03 +00:00
|
|
|
sTmpName.GetChar((sTmpName.Len() - 1))== '\"')
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
aContent = sTmpName.Copy(1, sTmpName.Len() - 2);
|
|
|
|
bValid = sal_True;
|
|
|
|
}
|
|
|
|
else if(sTmpName.Search('\"') == STRING_NOTFOUND &&
|
|
|
|
sTmpName.GetTokenCount('.') > 2)
|
|
|
|
{
|
|
|
|
::ReplacePoint(sTmpName);
|
|
|
|
if(sTmpName.GetChar(0) == '[' && sTmpName.GetChar(sTmpName.Len()-1) == ']')
|
|
|
|
{ // Eckige Klammern entfernen
|
|
|
|
sTmpName.Erase(0, 1);
|
|
|
|
sTmpName.Erase(sTmpName.Len()-1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pMgr)
|
|
|
|
{
|
2001-08-20 09:21:48 +00:00
|
|
|
String sDBName( GetDBName( sTmpName, pDoc ));
|
|
|
|
String sDataSource(sDBName.GetToken(0, DB_DELIM));
|
|
|
|
String sDataTableOrQuery(sDBName.GetToken(1, DB_DELIM));
|
|
|
|
if( pMgr->IsInMerge() && sDBName.Len() &&
|
|
|
|
pMgr->IsDataSourceOpen( sDataSource,
|
|
|
|
sDataTableOrQuery, sal_False))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-08-20 09:21:48 +00:00
|
|
|
double fNumber;
|
2007-09-27 07:48:37 +00:00
|
|
|
sal_uInt32 nTmpFormat;
|
2001-08-20 09:21:48 +00:00
|
|
|
pMgr->GetMergeColumnCnt(GetColumnName( sTmpName ),
|
2007-09-27 07:48:37 +00:00
|
|
|
GetLanguage(), aContent, &fNumber, &nTmpFormat );
|
2001-08-20 09:21:48 +00:00
|
|
|
bValid = sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-08-20 09:21:48 +00:00
|
|
|
else if( sDBName.Len() && sDataSource.Len() &&
|
|
|
|
sDataTableOrQuery.Len() )
|
2000-09-18 23:08:29 +00:00
|
|
|
bValid = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-04 17:14:34 +02:00
|
|
|
String SwHiddenTxtField::GetFieldName() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2010-10-04 17:14:34 +02:00
|
|
|
String aStr(SwFieldType::GetTypeStr(nSubType));
|
|
|
|
aStr += ' ';
|
|
|
|
aStr += aCond;
|
|
|
|
aStr += ' ';
|
|
|
|
aStr += aTRUETxt;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-10-04 17:14:34 +02:00
|
|
|
if (nSubType == TYP_CONDTXTFLD)
|
|
|
|
{
|
|
|
|
aStr.AppendAscii(" : ");
|
|
|
|
aStr += aFALSETxt;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 17:14:34 +02:00
|
|
|
return aStr;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwHiddenTxtField::Copy() const
|
|
|
|
{
|
|
|
|
SwHiddenTxtField* pFld =
|
|
|
|
new SwHiddenTxtField((SwHiddenTxtFieldType*)GetTyp(), aCond,
|
|
|
|
aTRUETxt, aFALSETxt);
|
|
|
|
pFld->bIsHidden = bIsHidden;
|
|
|
|
pFld->bValid = bValid;
|
|
|
|
pFld->aContent = aContent;
|
|
|
|
pFld->SetFormat(GetFormat());
|
|
|
|
pFld->nSubType = nSubType;
|
|
|
|
return pFld;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Bedingung setzen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwHiddenTxtField::SetPar1(const String& rStr)
|
|
|
|
{
|
|
|
|
aCond = rStr;
|
|
|
|
bCanToggle = aCond.Len() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const String& SwHiddenTxtField::GetPar1() const
|
|
|
|
{
|
|
|
|
return aCond;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: True/False Text
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwHiddenTxtField::SetPar2(const String& rStr)
|
|
|
|
{
|
|
|
|
if(nSubType == TYP_CONDTXTFLD)
|
|
|
|
{
|
|
|
|
sal_uInt16 nPos = rStr.Search('|');
|
|
|
|
aTRUETxt = rStr.Copy(0, nPos);
|
|
|
|
|
|
|
|
if(nPos != STRING_NOTFOUND)
|
|
|
|
aFALSETxt = rStr.Copy(nPos + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aTRUETxt = rStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwHiddenTxtField::GetPar2() const
|
|
|
|
{
|
|
|
|
String aRet(aTRUETxt);
|
|
|
|
if(nSubType == TYP_CONDTXTFLD)
|
|
|
|
{
|
|
|
|
aRet += '|';
|
|
|
|
aRet += aFALSETxt;
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 SwHiddenTxtField::GetSubType() const
|
|
|
|
{
|
|
|
|
return nSubType;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwHiddenTxtField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
const String* pOut = 0;
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
pOut = &aCond;
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR2:
|
|
|
|
pOut = &aTRUETxt;
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR3:
|
|
|
|
pOut = &aFALSETxt;
|
|
|
|
break;
|
2003-08-19 10:57:03 +00:00
|
|
|
case FIELD_PROP_PAR4 :
|
|
|
|
pOut = &aContent;
|
|
|
|
break;
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
{
|
|
|
|
sal_Bool bHidden = bIsHidden;
|
|
|
|
rAny.setValue(&bHidden, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-03-13 09:43:01 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
if( pOut )
|
|
|
|
rAny <<= OUString( *pOut );
|
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 SwHiddenTxtField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2001-10-24 17:56:14 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2001-03-13 09:43:01 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
{
|
|
|
|
String sVal;
|
|
|
|
SetPar1(::GetString( rAny, sVal ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR2:
|
|
|
|
::GetString( rAny, aTRUETxt );
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR3:
|
|
|
|
::GetString( rAny, aFALSETxt );
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
2001-03-13 09:43:01 +00:00
|
|
|
bIsHidden = *(sal_Bool*)rAny.getValue();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2003-08-19 10:57:03 +00:00
|
|
|
case FIELD_PROP_PAR4:
|
|
|
|
::GetString( rAny, aContent);
|
2011-01-17 15:06:54 +01:00
|
|
|
bValid = sal_True;
|
2003-08-19 10:57:03 +00:00
|
|
|
break;
|
2001-10-24 17:56:14 +00:00
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-03-13 09:43:01 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
String SwHiddenTxtField::GetColumnName(const String& rName)
|
|
|
|
{
|
|
|
|
sal_uInt16 nPos = rName.Search(DB_DELIM);
|
|
|
|
if( STRING_NOTFOUND != nPos )
|
|
|
|
{
|
|
|
|
nPos = rName.Search(DB_DELIM, nPos + 1);
|
|
|
|
|
|
|
|
if( STRING_NOTFOUND != nPos )
|
|
|
|
return rName.Copy(nPos + 1);
|
|
|
|
}
|
|
|
|
return rName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
String SwHiddenTxtField::GetDBName(const String& rName, SwDoc *pDoc)
|
|
|
|
{
|
|
|
|
sal_uInt16 nPos = rName.Search(DB_DELIM);
|
|
|
|
if( STRING_NOTFOUND != nPos )
|
|
|
|
{
|
|
|
|
nPos = rName.Search(DB_DELIM, nPos + 1);
|
|
|
|
|
|
|
|
if( STRING_NOTFOUND != nPos )
|
|
|
|
return rName.Copy( 0, nPos );
|
|
|
|
}
|
2001-02-21 11:45:25 +00:00
|
|
|
SwDBData aData = pDoc->GetDBData();
|
|
|
|
String sRet = aData.sDataSource;
|
|
|
|
sRet += DB_DELIM;
|
|
|
|
sRet += String(aData.sCommand);
|
|
|
|
return sRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Der Feldtyp fuer Zeilenhoehe 0
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwHiddenParaFieldType::SwHiddenParaFieldType()
|
|
|
|
: SwFieldType( RES_HIDDENPARAFLD )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwHiddenParaFieldType::Copy() const
|
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
SwHiddenParaFieldType* pTyp = new SwHiddenParaFieldType();
|
|
|
|
return pTyp;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Das Feld Zeilenhoehe 0
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
2007-09-27 07:48:37 +00:00
|
|
|
SwHiddenParaField::SwHiddenParaField(SwHiddenParaFieldType* pTyp, const String& rStr)
|
|
|
|
: SwField(pTyp), aCond(rStr)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
bIsHidden = sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwHiddenParaField::Expand() const
|
|
|
|
{
|
|
|
|
return aEmptyStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwHiddenParaField::Copy() const
|
|
|
|
{
|
|
|
|
SwHiddenParaField* pFld = new SwHiddenParaField((SwHiddenParaFieldType*)GetTyp(), aCond);
|
|
|
|
pFld->bIsHidden = bIsHidden;
|
|
|
|
|
|
|
|
return pFld;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwHiddenParaField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch ( nWhichId )
|
2001-03-13 09:43:01 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
rAny <<= OUString(aCond);
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
{
|
|
|
|
sal_Bool bHidden = bIsHidden;
|
|
|
|
rAny.setValue(&bHidden, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-03-13 09:43:01 +00:00
|
|
|
}
|
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 SwHiddenParaField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch ( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
::GetString( rAny, aCond );
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
2001-03-13 09:43:01 +00:00
|
|
|
bIsHidden = *(sal_Bool*)rAny.getValue();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Bedingung setzen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwHiddenParaField::SetPar1(const String& rStr)
|
|
|
|
{
|
|
|
|
aCond = rStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const String& SwHiddenParaField::GetPar1() const
|
|
|
|
{
|
|
|
|
return aCond;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: PostIt
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
2008-02-19 12:42:36 +00:00
|
|
|
SwPostItFieldType::SwPostItFieldType(SwDoc *pDoc)
|
|
|
|
: SwFieldType( RES_POSTITFLD ),mpDoc(pDoc)
|
2000-09-18 23:08:29 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
SwFieldType* SwPostItFieldType::Copy() const
|
|
|
|
{
|
2008-02-19 12:42:36 +00:00
|
|
|
return new SwPostItFieldType(mpDoc);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 12:42:36 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: SwPostItFieldType
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
2008-02-19 12:42:36 +00:00
|
|
|
SwPostItField::SwPostItField( SwPostItFieldType* pT,
|
|
|
|
const String& rAuthor, const String& rTxt, const DateTime& rDateTime )
|
|
|
|
: SwField( pT ), sTxt( rTxt ), sAuthor( rAuthor ), aDateTime( rDateTime ), mpText(0), m_pTextObject(0)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
2008-02-19 12:42:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
SwPostItField::~SwPostItField()
|
|
|
|
{
|
|
|
|
if ( m_pTextObject )
|
|
|
|
{
|
|
|
|
m_pTextObject->DisposeEditSource();
|
|
|
|
m_pTextObject->release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
String SwPostItField::Expand() const
|
|
|
|
{
|
|
|
|
return aEmptyStr;
|
|
|
|
}
|
2004-09-08 13:55:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
String SwPostItField::GetDescription() const
|
|
|
|
{
|
|
|
|
return SW_RES(STR_NOTE);
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwField* SwPostItField::Copy() const
|
|
|
|
{
|
2008-02-19 12:42:36 +00:00
|
|
|
SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor,
|
|
|
|
sTxt, aDateTime);
|
|
|
|
if (mpText)
|
CWS-TOOLING: integrate CWS aw063
2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects
2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects
2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL
2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction
2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction
2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1
2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round
2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round
2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round
2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round
2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round
2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round
2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round
2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition
2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF
2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable
2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable
2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix
2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix
2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers
2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts
2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules
2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include
2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include
2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much
2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from
2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size
2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances
2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage
2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences
2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange
2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle
2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case
2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
|
|
|
pRet->SetTextObject( new OutlinerParaObject(*mpText) );
|
2008-02-19 12:42:36 +00:00
|
|
|
return pRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Author setzen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwPostItField::SetPar1(const String& rStr)
|
|
|
|
{
|
|
|
|
sAuthor = rStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const String& SwPostItField::GetPar1() const
|
|
|
|
{
|
|
|
|
return sAuthor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Text fuers PostIt setzen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
void SwPostItField::SetPar2(const String& rStr)
|
|
|
|
{
|
|
|
|
sTxt = rStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwPostItField::GetPar2() const
|
|
|
|
{
|
2009-01-02 15:51:45 +00:00
|
|
|
return sTxt;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 12:42:36 +00:00
|
|
|
const OutlinerParaObject* SwPostItField::GetTextObject() const
|
|
|
|
{
|
|
|
|
return mpText;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwPostItField::SetTextObject( OutlinerParaObject* pText )
|
|
|
|
{
|
|
|
|
delete mpText;
|
|
|
|
mpText = pText;
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:25:59 +02:00
|
|
|
sal_uInt32 SwPostItField::GetNumberOfParagraphs() const
|
|
|
|
{
|
|
|
|
return (mpText) ? mpText->Count() : 1;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2001-10-24 17:56:14 +00:00
|
|
|
{
|
|
|
|
case FIELD_PROP_PAR1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(sAuthor);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR2:
|
2008-02-19 12:42:36 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(sTxt);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2008-02-19 12:42:36 +00:00
|
|
|
}
|
|
|
|
case FIELD_PROP_TEXT:
|
|
|
|
{
|
|
|
|
if ( !m_pTextObject )
|
|
|
|
{
|
|
|
|
SwPostItFieldType* pGetType = (SwPostItFieldType*)GetTyp();
|
|
|
|
SwDoc* pDoc = pGetType->GetDoc();
|
2008-07-01 13:33:53 +00:00
|
|
|
SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc );
|
2008-02-19 12:42:36 +00:00
|
|
|
const_cast <SwPostItField*> (this)->m_pTextObject = new SwTextAPIObject( pObj );
|
|
|
|
m_pTextObject->acquire();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mpText )
|
|
|
|
m_pTextObject->SetText( *mpText );
|
2008-07-01 13:33:53 +00:00
|
|
|
else
|
|
|
|
m_pTextObject->SetString( sTxt );
|
2008-02-19 12:42:36 +00:00
|
|
|
|
|
|
|
uno::Reference < text::XText > xText( m_pTextObject );
|
|
|
|
rAny <<= xText;
|
|
|
|
break;
|
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_DATE:
|
|
|
|
{
|
|
|
|
util::Date aSetDate;
|
2008-02-19 12:42:36 +00:00
|
|
|
aSetDate.Day = aDateTime.GetDay();
|
|
|
|
aSetDate.Month = aDateTime.GetMonth();
|
|
|
|
aSetDate.Year = aDateTime.GetYear();
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny.setValue(&aSetDate, ::getCppuType((util::Date*)0));
|
|
|
|
}
|
|
|
|
break;
|
2008-02-19 12:42:36 +00:00
|
|
|
case FIELD_PROP_DATE_TIME:
|
|
|
|
{
|
|
|
|
util::DateTime DateTimeValue;
|
|
|
|
DateTimeValue.HundredthSeconds = aDateTime.Get100Sec();
|
|
|
|
DateTimeValue.Seconds = aDateTime.GetSec();
|
|
|
|
DateTimeValue.Minutes = aDateTime.GetMin();
|
|
|
|
DateTimeValue.Hours = aDateTime.GetHour();
|
|
|
|
DateTimeValue.Day = aDateTime.GetDay();
|
|
|
|
DateTimeValue.Month = aDateTime.GetMonth();
|
|
|
|
DateTimeValue.Year = aDateTime.GetYear();
|
|
|
|
rAny <<= DateTimeValue;
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2008-02-19 12:42:36 +00:00
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
::GetString( rAny, sAuthor );
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR2:
|
|
|
|
::GetString( rAny, sTxt );
|
2009-05-07 13:54:35 +00:00
|
|
|
//#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
|
|
|
|
if (mpText)
|
|
|
|
{
|
|
|
|
delete mpText;
|
|
|
|
mpText = 0;
|
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2008-02-19 12:42:36 +00:00
|
|
|
case FIELD_PROP_TEXT:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("Not implemented!");
|
2008-02-19 12:42:36 +00:00
|
|
|
break;
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_DATE:
|
|
|
|
if( rAny.getValueType() == ::getCppuType((util::Date*)0) )
|
|
|
|
{
|
|
|
|
util::Date aSetDate = *(util::Date*)rAny.getValue();
|
2008-02-19 12:42:36 +00:00
|
|
|
aDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-02-19 12:42:36 +00:00
|
|
|
case FIELD_PROP_DATE_TIME:
|
|
|
|
{
|
|
|
|
util::DateTime aDateTimeValue;
|
|
|
|
if(!(rAny >>= aDateTimeValue))
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2008-02-19 12:42:36 +00:00
|
|
|
aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
|
|
|
|
aDateTime.SetSec(aDateTimeValue.Seconds);
|
|
|
|
aDateTime.SetMin(aDateTimeValue.Minutes);
|
|
|
|
aDateTime.SetHour(aDateTimeValue.Hours);
|
|
|
|
aDateTime.SetDay(aDateTimeValue.Day);
|
|
|
|
aDateTime.SetMonth(aDateTimeValue.Month);
|
|
|
|
aDateTime.SetYear(aDateTimeValue.Year);
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: DokumentinfoFields
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwExtUserFieldType::SwExtUserFieldType()
|
|
|
|
: SwFieldType( RES_EXTUSERFLD )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwExtUserFieldType::Copy() const
|
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
SwExtUserFieldType* pTyp = new SwExtUserFieldType;
|
|
|
|
return pTyp;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 07:48:37 +00:00
|
|
|
String SwExtUserFieldType::Expand(sal_uInt16 nSub, sal_uInt32 ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-04-29 15:54:32 +00:00
|
|
|
String aRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
sal_uInt16 nRet = USHRT_MAX;
|
|
|
|
switch(nSub)
|
|
|
|
{
|
2004-09-20 14:14:22 +00:00
|
|
|
case EU_FIRSTNAME: nRet = USER_OPT_FIRSTNAME; break;
|
|
|
|
case EU_NAME: nRet = USER_OPT_LASTNAME; break;
|
|
|
|
case EU_SHORTCUT: nRet = USER_OPT_ID; break;
|
2004-04-29 15:54:32 +00:00
|
|
|
|
|
|
|
case EU_COMPANY: nRet = USER_OPT_COMPANY; break;
|
|
|
|
case EU_STREET: nRet = USER_OPT_STREET; break;
|
|
|
|
case EU_TITLE: nRet = USER_OPT_TITLE; break;
|
|
|
|
case EU_POSITION: nRet = USER_OPT_POSITION; break;
|
|
|
|
case EU_PHONE_PRIVATE: nRet = USER_OPT_TELEPHONEHOME; break;
|
|
|
|
case EU_PHONE_COMPANY: nRet = USER_OPT_TELEPHONEWORK; break;
|
|
|
|
case EU_FAX: nRet = USER_OPT_FAX; break;
|
|
|
|
case EU_EMAIL: nRet = USER_OPT_EMAIL; break;
|
|
|
|
case EU_COUNTRY: nRet = USER_OPT_COUNTRY; break;
|
|
|
|
case EU_ZIP: nRet = USER_OPT_ZIP; break;
|
|
|
|
case EU_CITY: nRet = USER_OPT_CITY; break;
|
|
|
|
case EU_STATE: nRet = USER_OPT_STATE; break;
|
|
|
|
case EU_FATHERSNAME: nRet = USER_OPT_FATHERSNAME; break;
|
|
|
|
case EU_APARTMENT: nRet = USER_OPT_APARTMENT; break;
|
2010-11-25 17:08:45 +01:00
|
|
|
default: OSL_ENSURE( !this, "Field unknown");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if( USHRT_MAX != nRet )
|
2004-04-29 15:54:32 +00:00
|
|
|
{
|
|
|
|
SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
|
|
|
|
aRet = rUserOpt.GetToken( nRet );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2007-09-27 07:48:37 +00:00
|
|
|
SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, sal_uInt32 nFmt) :
|
|
|
|
SwField(pTyp, nFmt), nType(nSubTyp)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat());
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwExtUserField::Expand() const
|
|
|
|
{
|
|
|
|
if (!IsFixed())
|
|
|
|
((SwExtUserField*)this)->aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat());
|
|
|
|
|
|
|
|
return aContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwExtUserField::Copy() const
|
|
|
|
{
|
|
|
|
SwExtUserField* pFld = new SwExtUserField((SwExtUserFieldType*)GetTyp(), nType, GetFormat());
|
|
|
|
pFld->SetExpansion(aContent);
|
|
|
|
|
|
|
|
return pFld;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 SwExtUserField::GetSubType() const
|
|
|
|
{
|
|
|
|
return nType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwExtUserField::SetSubType(sal_uInt16 nSub)
|
|
|
|
{
|
|
|
|
nType = nSub;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwExtUserField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(aContent);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_USHORT1:
|
|
|
|
{
|
|
|
|
sal_Int16 nTmp = nType;
|
|
|
|
rAny <<= nTmp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
{
|
|
|
|
sal_Bool bTmp = IsFixed();
|
|
|
|
rAny.setValue(&bTmp, ::getBooleanCppuType());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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 SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
::GetString( rAny, aContent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIELD_PROP_USHORT1:
|
|
|
|
{
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int16 nTmp = 0;
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny >>= nTmp;
|
|
|
|
nType = nTmp;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_BOOL1:
|
|
|
|
if( *(sal_Bool*)rAny.getValue() )
|
2000-09-18 23:08:29 +00:00
|
|
|
SetFormat(GetFormat() | AF_FIXED);
|
|
|
|
else
|
|
|
|
SetFormat(GetFormat() & ~AF_FIXED);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Relatives Seitennummern - Feld
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwRefPageSetFieldType::SwRefPageSetFieldType()
|
|
|
|
: SwFieldType( RES_REFPAGESETFLD )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwRefPageSetFieldType::Copy() const
|
|
|
|
{
|
|
|
|
return new SwRefPageSetFieldType;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ueberlagert, weil es nichts zum Updaten gibt!
|
|
|
|
void SwRefPageSetFieldType::Modify( SfxPoolItem *, SfxPoolItem * )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Relative Seitennummerierung
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
2007-09-27 07:48:37 +00:00
|
|
|
SwRefPageSetField::SwRefPageSetField( SwRefPageSetFieldType* pTyp,
|
2000-09-18 23:08:29 +00:00
|
|
|
short nOff, sal_Bool bFlag )
|
2007-09-27 07:48:37 +00:00
|
|
|
: SwField( pTyp ), nOffset( nOff ), bOn( bFlag )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwRefPageSetField::Expand() const
|
|
|
|
{
|
|
|
|
return aEmptyStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwRefPageSetField::Copy() const
|
|
|
|
{
|
|
|
|
return new SwRefPageSetField( (SwRefPageSetFieldType*)GetTyp(), nOffset, bOn );
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwRefPageSetField::GetPar2() const
|
|
|
|
{
|
2001-01-18 13:08:36 +00:00
|
|
|
return String::CreateFromInt32( GetOffset() );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwRefPageSetField::SetPar2(const String& rStr)
|
|
|
|
{
|
2001-01-18 13:08:36 +00:00
|
|
|
SetOffset( (short) rStr.ToInt32() );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwRefPageSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2001-10-24 17:56:14 +00:00
|
|
|
{
|
|
|
|
case FIELD_PROP_BOOL1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny.setValue(&bOn, ::getBooleanCppuType());
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= (sal_Int16)nOffset;
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
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 SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2001-10-24 17:56:14 +00:00
|
|
|
{
|
|
|
|
case FIELD_PROP_BOOL1:
|
2000-09-18 23:08:29 +00:00
|
|
|
bOn = *(sal_Bool*)rAny.getValue();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny >>=nOffset;
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: relatives Seitennummern - Abfrage Feld
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwRefPageGetFieldType::SwRefPageGetFieldType( SwDoc* pDc )
|
2007-09-27 07:48:37 +00:00
|
|
|
: SwFieldType( RES_REFPAGEGETFLD ), pDoc( pDc ), nNumberingType( SVX_NUM_ARABIC )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwRefPageGetFieldType::Copy() const
|
|
|
|
{
|
|
|
|
SwRefPageGetFieldType* pNew = new SwRefPageGetFieldType( pDoc );
|
2001-02-23 11:45:30 +00:00
|
|
|
pNew->nNumberingType = nNumberingType;
|
2000-09-18 23:08:29 +00:00
|
|
|
return pNew;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwRefPageGetFieldType::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
|
|
|
|
{
|
|
|
|
// Update auf alle GetReferenz-Felder
|
|
|
|
if( !pNew && !pOld && GetDepends() )
|
|
|
|
{
|
|
|
|
// sammel erstmal alle SetPageRefFelder ein.
|
|
|
|
_SetGetExpFlds aTmpLst( 10, 5 );
|
|
|
|
if( MakeSetList( aTmpLst ) )
|
|
|
|
{
|
|
|
|
SwClientIter aIter( *this );
|
|
|
|
if( aIter.GoStart() )
|
|
|
|
do {
|
|
|
|
// nur die GetRef-Felder Updaten
|
|
|
|
SwFmtFld* pFmtFld = (SwFmtFld*)aIter();
|
|
|
|
if( pFmtFld->GetTxtFld() )
|
|
|
|
UpdateField( pFmtFld->GetTxtFld(), aTmpLst );
|
|
|
|
} while( aIter++ );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// weiter an die Text-Felder, diese "Expandieren" den Text
|
|
|
|
SwModify::Modify( pOld, pNew );
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst )
|
|
|
|
{
|
|
|
|
SwClientIter aIter( *pDoc->GetSysFldType( RES_REFPAGESETFLD));
|
|
|
|
if( aIter.GoStart() )
|
|
|
|
do {
|
|
|
|
// nur die GetRef-Felder Updaten
|
|
|
|
SwFmtFld* pFmtFld = (SwFmtFld*)aIter();
|
|
|
|
const SwTxtFld* pTFld = pFmtFld->GetTxtFld();
|
|
|
|
if( pTFld )
|
|
|
|
{
|
|
|
|
const SwTxtNode& rTxtNd = pTFld->GetTxtNode();
|
|
|
|
|
|
|
|
// immer den ersten !! (in Tab-Headline, Kopf-/Fuss )
|
|
|
|
Point aPt;
|
|
|
|
const SwCntntFrm* pFrm = rTxtNd.GetFrm( &aPt, 0, sal_False );
|
|
|
|
|
|
|
|
_SetGetExpFld* pNew;
|
|
|
|
|
2004-09-20 14:14:22 +00:00
|
|
|
if( !pFrm ||
|
|
|
|
pFrm->IsInDocBody() ||
|
|
|
|
// --> FME 2004-07-27 #i31868#
|
|
|
|
// Check if pFrm is not yet connected to the layout.
|
|
|
|
!pFrm->FindPageFrm() )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
// einen sdbcx::Index fuers bestimmen vom TextNode anlegen
|
|
|
|
SwNodeIndex aIdx( rTxtNd );
|
|
|
|
pNew = new _SetGetExpFld( aIdx, pTFld );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// einen sdbcx::Index fuers bestimmen vom TextNode anlegen
|
|
|
|
SwPosition aPos( pDoc->GetNodes().GetEndOfPostIts() );
|
2010-11-25 17:08:45 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
OSL_ENSURE( GetBodyTxtNode( *pDoc, aPos, *pFrm ),
|
2000-09-18 23:08:29 +00:00
|
|
|
"wo steht das Feld" );
|
|
|
|
#else
|
|
|
|
GetBodyTxtNode( *pDoc, aPos, *pFrm );
|
|
|
|
#endif
|
|
|
|
pNew = new _SetGetExpFld( aPos.nNode, pTFld,
|
|
|
|
&aPos.nContent );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !rTmpLst.Insert( pNew ))
|
|
|
|
delete pNew;
|
|
|
|
}
|
|
|
|
} while( aIter++ );
|
|
|
|
|
|
|
|
return rTmpLst.Count();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld,
|
|
|
|
_SetGetExpFlds& rSetList )
|
|
|
|
{
|
|
|
|
SwRefPageGetField* pGetFld = (SwRefPageGetField*)pTxtFld->GetFld().GetFld();
|
|
|
|
pGetFld->SetText( aEmptyStr );
|
|
|
|
|
|
|
|
// dann suche mal das richtige RefPageSet-Field
|
|
|
|
SwTxtNode* pTxtNode = (SwTxtNode*)&pTxtFld->GetTxtNode();
|
|
|
|
if( pTxtNode->StartOfSectionIndex() >
|
|
|
|
pDoc->GetNodes().GetEndOfExtras().GetIndex() )
|
|
|
|
{
|
|
|
|
SwNodeIndex aIdx( *pTxtNode );
|
|
|
|
_SetGetExpFld aEndFld( aIdx, pTxtFld );
|
|
|
|
|
|
|
|
sal_uInt16 nLast;
|
|
|
|
rSetList.Seek_Entry( &aEndFld, &nLast );
|
|
|
|
|
|
|
|
if( nLast-- )
|
|
|
|
{
|
|
|
|
const SwTxtFld* pRefTxtFld = rSetList[ nLast ]->GetFld();
|
|
|
|
const SwRefPageSetField* pSetFld =
|
|
|
|
(SwRefPageSetField*)pRefTxtFld->GetFld().GetFld();
|
|
|
|
if( pSetFld->IsOn() )
|
|
|
|
{
|
|
|
|
// dann bestimme mal den entsp. Offset
|
|
|
|
Point aPt;
|
|
|
|
const SwCntntFrm* pFrm = pTxtNode->GetFrm( &aPt, 0, sal_False );
|
|
|
|
const SwCntntFrm* pRefFrm = pRefTxtFld->GetTxtNode().GetFrm( &aPt, 0, sal_False );
|
|
|
|
const SwPageFrm* pPgFrm = 0;
|
|
|
|
sal_uInt16 nDiff = ( pFrm && pRefFrm )
|
|
|
|
? (pPgFrm = pFrm->FindPageFrm())->GetPhyPageNum() -
|
|
|
|
pRefFrm->FindPageFrm()->GetPhyPageNum() + 1
|
|
|
|
: 1;
|
|
|
|
|
|
|
|
sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat()
|
|
|
|
? ( !pPgFrm
|
2007-09-27 07:48:37 +00:00
|
|
|
? (sal_uInt32)SVX_NUM_ARABIC
|
2001-02-23 11:45:30 +00:00
|
|
|
: pPgFrm->GetPageDesc()->GetNumType().GetNumberingType() )
|
2000-09-18 23:08:29 +00:00
|
|
|
: pGetFld->GetFormat();
|
2007-09-27 07:48:37 +00:00
|
|
|
short nPageNum = static_cast<short>(Max(0, pSetFld->GetOffset() + (short)nDiff));
|
2000-09-18 23:08:29 +00:00
|
|
|
pGetFld->SetText( FormatNumber( nPageNum, nTmpFmt ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// dann die Formatierung anstossen
|
|
|
|
((SwFmtFld&)pTxtFld->GetFld()).Modify( 0, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Relative Seitennummerierung Abfragen
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
2007-09-27 07:48:37 +00:00
|
|
|
SwRefPageGetField::SwRefPageGetField( SwRefPageGetFieldType* pTyp,
|
2000-09-18 23:08:29 +00:00
|
|
|
sal_uInt32 nFmt )
|
2007-09-27 07:48:37 +00:00
|
|
|
: SwField( pTyp, nFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwRefPageGetField::Expand() const
|
|
|
|
{
|
|
|
|
return sTxt;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwRefPageGetField::Copy() const
|
|
|
|
{
|
|
|
|
SwRefPageGetField* pCpy = new SwRefPageGetField(
|
|
|
|
(SwRefPageGetFieldType*)GetTyp(), GetFormat() );
|
|
|
|
pCpy->SetText( sTxt );
|
|
|
|
return pCpy;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm,
|
|
|
|
const SwTxtFld* pFld )
|
|
|
|
{
|
|
|
|
// nur Felder in Footer, Header, FootNote, Flys
|
|
|
|
SwTxtNode* pTxtNode = (SwTxtNode*)&pFld->GetTxtNode();
|
|
|
|
SwRefPageGetFieldType* pGetType = (SwRefPageGetFieldType*)GetTyp();
|
|
|
|
SwDoc* pDoc = pGetType->GetDoc();
|
|
|
|
if( pFld->GetTxtNode().StartOfSectionIndex() >
|
|
|
|
pDoc->GetNodes().GetEndOfExtras().GetIndex() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
sTxt.Erase();
|
|
|
|
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !pFrm->IsInDocBody(), "Flag ist nicht richtig, Frame steht im DocBody" );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
// sammel erstmal alle SetPageRefFelder ein.
|
|
|
|
_SetGetExpFlds aTmpLst( 10, 5 );
|
|
|
|
if( !pGetType->MakeSetList( aTmpLst ) )
|
|
|
|
return ;
|
|
|
|
|
|
|
|
// einen sdbcx::Index fuers bestimmen vom TextNode anlegen
|
|
|
|
SwPosition aPos( SwNodeIndex( pDoc->GetNodes() ) );
|
|
|
|
pTxtNode = (SwTxtNode*) GetBodyTxtNode( *pDoc, aPos, *pFrm );
|
|
|
|
|
|
|
|
// Wenn kein Layout vorhanden, kommt es in Kopf und Fusszeilen dazu
|
|
|
|
// das ChangeExpansion uebers Layout-Formatieren aufgerufen wird
|
|
|
|
// aber kein TxtNode vorhanden ist
|
|
|
|
//
|
|
|
|
if(!pTxtNode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_SetGetExpFld aEndFld( aPos.nNode, pFld, &aPos.nContent );
|
|
|
|
|
|
|
|
sal_uInt16 nLast;
|
|
|
|
aTmpLst.Seek_Entry( &aEndFld, &nLast );
|
|
|
|
|
|
|
|
if( !nLast-- )
|
|
|
|
return ; // es gibt kein entsprechendes Set - Feld vor mir
|
|
|
|
|
|
|
|
const SwTxtFld* pRefTxtFld = aTmpLst[ nLast ]->GetFld();
|
|
|
|
const SwRefPageSetField* pSetFld =
|
|
|
|
(SwRefPageSetField*)pRefTxtFld->GetFld().GetFld();
|
2003-04-28 14:17:09 +00:00
|
|
|
Point aPt;
|
|
|
|
const SwCntntFrm* pRefFrm = pRefTxtFld ? pRefTxtFld->GetTxtNode().GetFrm( &aPt, 0, sal_False ) : 0;
|
|
|
|
if( pSetFld->IsOn() && pRefFrm )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
// dann bestimme mal den entsp. Offset
|
|
|
|
const SwPageFrm* pPgFrm = pFrm->FindPageFrm();
|
|
|
|
sal_uInt16 nDiff = pPgFrm->GetPhyPageNum() -
|
|
|
|
pRefFrm->FindPageFrm()->GetPhyPageNum() + 1;
|
|
|
|
|
|
|
|
SwRefPageGetField* pGetFld = (SwRefPageGetField*)pFld->GetFld().GetFld();
|
|
|
|
sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat()
|
2001-02-23 11:45:30 +00:00
|
|
|
? pPgFrm->GetPageDesc()->GetNumType().GetNumberingType()
|
2000-09-18 23:08:29 +00:00
|
|
|
: pGetFld->GetFormat();
|
2007-09-27 07:48:37 +00:00
|
|
|
short nPageNum = static_cast<short>(Max(0, pSetFld->GetOffset() + (short)nDiff ));
|
2000-09-18 23:08:29 +00:00
|
|
|
pGetFld->SetText( FormatNumber( nPageNum, nTmpFmt ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwRefPageGetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2002-01-18 08:45:31 +00:00
|
|
|
case FIELD_PROP_USHORT1:
|
|
|
|
rAny <<= (sal_Int16)GetFormat();
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
2002-01-18 08:45:31 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
rAny <<= OUString(sTxt);
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
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 SwRefPageGetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2002-01-18 08:45:31 +00:00
|
|
|
case FIELD_PROP_USHORT1:
|
2001-10-24 17:56:14 +00:00
|
|
|
{
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int16 nSet = 0;
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny >>= nSet;
|
|
|
|
if(nSet <= SVX_NUM_PAGEDESC )
|
|
|
|
SetFormat(nSet);
|
2008-04-22 13:58:09 +00:00
|
|
|
else {
|
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-01-18 08:45:31 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
{
|
|
|
|
OUString sTmp;
|
|
|
|
rAny >>= sTmp;
|
|
|
|
sTxt = sTmp;
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Feld zum Anspringen und Editieren
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwJumpEditFieldType::SwJumpEditFieldType( SwDoc* pD )
|
|
|
|
: SwFieldType( RES_JUMPEDITFLD ), pDoc( pD ), aDep( this, 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwJumpEditFieldType::Copy() const
|
|
|
|
{
|
|
|
|
return new SwJumpEditFieldType( pDoc );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwCharFmt* SwJumpEditFieldType::GetCharFmt()
|
|
|
|
{
|
|
|
|
SwCharFmt* pFmt = pDoc->GetCharFmtFromPool( RES_POOLCHR_JUMPEDIT );
|
|
|
|
|
|
|
|
// noch nicht registriert ?
|
|
|
|
if( !aDep.GetRegisteredIn() )
|
|
|
|
pFmt->Add( &aDep ); // anmelden
|
|
|
|
|
|
|
|
return pFmt;
|
|
|
|
}
|
|
|
|
|
2007-09-27 07:48:37 +00:00
|
|
|
SwJumpEditField::SwJumpEditField( SwJumpEditFieldType* pTyp, sal_uInt32 nForm,
|
2000-09-18 23:08:29 +00:00
|
|
|
const String& rTxt, const String& rHelp )
|
2007-09-27 07:48:37 +00:00
|
|
|
: SwField( pTyp, nForm ), sTxt( rTxt ), sHelp( rHelp )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwJumpEditField::Expand() const
|
|
|
|
{
|
|
|
|
String sTmp( '<' );
|
|
|
|
sTmp += sTxt;
|
|
|
|
return sTmp += '>';
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwJumpEditField::Copy() const
|
|
|
|
{
|
|
|
|
return new SwJumpEditField( (SwJumpEditFieldType*)GetTyp(), GetFormat(),
|
|
|
|
sTxt, sHelp );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Platzhalter-Text
|
|
|
|
|
|
|
|
const String& SwJumpEditField::GetPar1() const
|
|
|
|
{
|
|
|
|
return sTxt;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwJumpEditField::SetPar1(const String& rStr)
|
|
|
|
{
|
|
|
|
sTxt = rStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// HinweisText
|
|
|
|
|
|
|
|
String SwJumpEditField::GetPar2() const
|
|
|
|
{
|
|
|
|
return sHelp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwJumpEditField::SetPar2(const String& rStr)
|
|
|
|
{
|
|
|
|
sHelp = rStr;
|
|
|
|
}
|
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
bool SwJumpEditField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
sal_Int16 nRet;
|
|
|
|
switch( GetFormat() )
|
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
case JE_FMT_TABLE: nRet = text::PlaceholderType::TABLE; break;
|
|
|
|
case JE_FMT_FRAME: nRet = text::PlaceholderType::TEXTFRAME; break;
|
|
|
|
case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC; break;
|
2001-10-24 17:56:14 +00:00
|
|
|
case JE_FMT_OLE: nRet = text::PlaceholderType::OBJECT; break;
|
|
|
|
default:
|
|
|
|
nRet = text::PlaceholderType::TEXT; break;
|
|
|
|
}
|
|
|
|
rAny <<= nRet;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR1 :
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(sHelp);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR2 :
|
2000-09-18 23:08:29 +00:00
|
|
|
rAny <<= OUString(sTxt);
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
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 SwJumpEditField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_USHORT1:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
//JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
|
|
|
|
// called with a int32 value! But normally we need
|
|
|
|
// here only a int16
|
2007-11-12 15:23:31 +00:00
|
|
|
sal_Int32 nSet = 0;
|
2001-10-24 17:56:14 +00:00
|
|
|
rAny >>= nSet;
|
|
|
|
switch( nSet )
|
|
|
|
{
|
|
|
|
case text::PlaceholderType::TEXT : SetFormat(JE_FMT_TEXT); break;
|
|
|
|
case text::PlaceholderType::TABLE : SetFormat(JE_FMT_TABLE); break;
|
|
|
|
case text::PlaceholderType::TEXTFRAME: SetFormat(JE_FMT_FRAME); break;
|
|
|
|
case text::PlaceholderType::GRAPHIC : SetFormat(JE_FMT_GRAPHIC); break;
|
|
|
|
case text::PlaceholderType::OBJECT : SetFormat(JE_FMT_OLE); break;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR1 :
|
|
|
|
::GetString( rAny, sHelp );
|
|
|
|
break;
|
|
|
|
case FIELD_PROP_PAR2 :
|
|
|
|
::GetString( rAny, sTxt);
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-01-18 13:08:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
Beschreibung: Combined Character Fieldtype / Field
|
|
|
|
--------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwCombinedCharFieldType::SwCombinedCharFieldType()
|
|
|
|
: SwFieldType( RES_COMBINED_CHARS )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFieldType* SwCombinedCharFieldType::Copy() const
|
|
|
|
{
|
|
|
|
return new SwCombinedCharFieldType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
SwCombinedCharField::SwCombinedCharField( SwCombinedCharFieldType* pFTyp,
|
|
|
|
const String& rChars )
|
|
|
|
: SwField( pFTyp, 0 ),
|
|
|
|
sCharacters( rChars.Copy( 0, MAX_COMBINED_CHARACTERS ))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwCombinedCharField::Expand() const
|
|
|
|
{
|
|
|
|
return sCharacters;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwField* SwCombinedCharField::Copy() const
|
|
|
|
{
|
|
|
|
return new SwCombinedCharField( (SwCombinedCharFieldType*)GetTyp(),
|
|
|
|
sCharacters );
|
|
|
|
}
|
|
|
|
|
|
|
|
const String& SwCombinedCharField::GetPar1() const
|
|
|
|
{
|
|
|
|
return sCharacters;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwCombinedCharField::SetPar1(const String& rStr)
|
|
|
|
{
|
|
|
|
sCharacters = rStr.Copy( 0, MAX_COMBINED_CHARACTERS );
|
|
|
|
}
|
|
|
|
|
2010-10-04 15:23:52 +01:00
|
|
|
bool SwCombinedCharField::QueryValue( uno::Any& rAny,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nWhichId ) const
|
2001-01-18 13:08:36 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2001-10-24 17:56:14 +00:00
|
|
|
{
|
|
|
|
case FIELD_PROP_PAR1:
|
2001-01-18 13:08:36 +00:00
|
|
|
rAny <<= rtl::OUString( sCharacters );
|
2001-10-24 17:56:14 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-10-24 17:56:14 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2001-01-18 13:08:36 +00:00
|
|
|
}
|
|
|
|
|
2010-10-04 15:23:52 +01:00
|
|
|
bool SwCombinedCharField::PutValue( const uno::Any& rAny,
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nWhichId )
|
2001-01-18 13:08:36 +00:00
|
|
|
{
|
2007-09-27 07:48:37 +00:00
|
|
|
switch( nWhichId )
|
2001-01-18 13:08:36 +00:00
|
|
|
{
|
2001-10-24 17:56:14 +00:00
|
|
|
case FIELD_PROP_PAR1:
|
|
|
|
::GetString( rAny, sCharacters ).Erase( MAX_COMBINED_CHARACTERS );
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:09:12 +01:00
|
|
|
OSL_FAIL("illegal property");
|
2001-01-18 13:08:36 +00:00
|
|
|
}
|
2010-10-04 15:23:52 +01:00
|
|
|
return true;
|
2001-01-18 13:08:36 +00:00
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|