diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-10-16 00:05:16 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-10-16 00:05:16 +0200 |
commit | ad482351a6c12cddb06575f6a9a00ec1b72d92fb (patch) | |
tree | e97f35e966aef21423e70f325a66943664ed62a9 /svl/source/items | |
parent | 9a4d0581c72653e60562d1b8e2121772d21f8a9e (diff) |
#i103496#: split svtools; improve ConfitItems
Diffstat (limited to 'svl/source/items')
-rw-r--r-- | svl/source/items/bintitem.cxx | 169 | ||||
-rw-r--r-- | svl/source/items/cstitem.src | 72 | ||||
-rw-r--r-- | svl/source/items/dateitem.cxx | 286 | ||||
-rw-r--r-- | svl/source/items/dtritem.cxx | 241 | ||||
-rw-r--r-- | svl/source/items/frqitem.cxx | 580 | ||||
-rw-r--r-- | svl/source/items/makefile.mk | 42 | ||||
-rw-r--r-- | svl/source/items/tfrmitem.cxx | 184 | ||||
-rw-r--r-- | svl/source/items/tresitem.cxx | 78 |
8 files changed, 379 insertions, 1273 deletions
diff --git a/svl/source/items/bintitem.cxx b/svl/source/items/bintitem.cxx deleted file mode 100644 index 5236f36504f8..000000000000 --- a/svl/source/items/bintitem.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: bintitem.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include <com/sun/star/uno/Any.hxx> -#include <tools/stream.hxx> -#include <tools/bigint.hxx> -#include <svl/bintitem.hxx> - -// STATIC DATA - -DBG_NAME(SfxBigIntItem) - -// RTTI -TYPEINIT1_AUTOFACTORY(SfxBigIntItem, SfxPoolItem); - -// SfxBigIntItem - -//============================================================================ -SfxBigIntItem::SfxBigIntItem() - : SfxPoolItem(0), - aVal(0) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, const BigInt& rValue) - : SfxPoolItem(which), - aVal(rValue) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, SvStream &rStream) - : SfxPoolItem(which) -{ - DBG_CTOR(SfxBigIntItem, 0); - ByteString sTmp; - rStream.ReadByteString(sTmp); - BigInt aTmp(sTmp); - aVal = aTmp; -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem& rItem) - : SfxPoolItem(rItem), - aVal(rItem.aVal) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxItemPresentation SfxBigIntItem::GetPresentation( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rText = aVal.GetString(); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -int SfxBigIntItem::operator==(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - return ((SfxBigIntItem&)rItem).aVal == aVal; -} - -//============================================================================ -int SfxBigIntItem::Compare(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - - if (((const SfxBigIntItem&)rItem ).aVal < aVal ) - return -1; - else if (((const SfxBigIntItem&)rItem ).aVal == aVal) - return 0; - else - return 1; -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(*this); -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Create(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(Which(), rStream); -} - -//============================================================================ -SvStream& SfxBigIntItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rStream.WriteByteString( aVal.GetByteString() ); - return rStream; -} - -//============================================================================ -SfxFieldUnit SfxBigIntItem::GetUnit() const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - double aValue = 0.0; - if ( rVal >>= aValue ) - { - SetValue( aValue ); - return TRUE; - } - - DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - double aValue = GetValue(); - rVal <<= aValue; - return TRUE; -} - diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src new file mode 100644 index 000000000000..54951dd3761e --- /dev/null +++ b/svl/source/items/cstitem.src @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cstitem.src,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <svl/svtools.hrc> +String STR_COLUM_DT_AUTO +{ + Text [ en-US ] = "automatic" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx new file mode 100644 index 000000000000..d5989d4b7a2b --- /dev/null +++ b/svl/source/items/dateitem.cxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dateitem.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svl.hxx" + +// include --------------------------------------------------------------- + +#define _DATETIMEITEM_CXX +#include <svl/dateitem.hxx> + +#include <svl/svtools.hrc> + +#include <unotools/intlwrapper.hxx> +#include <comphelper/processfactory.hxx> + +#include <tools/stream.hxx> +#include <tools/debug.hxx> +#include <tools/datetime.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/lang/Locale.hpp> + + +#include <vcl/svapp.hxx> + +#include <svl/svldata.hxx> + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxDateTimeItem) + + +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxDateTimeItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( USHORT which ) : + SfxPoolItem( which ) +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( USHORT which, const DateTime& rDT ) : + SfxPoolItem( which ), + aDateTime( rDT ) + +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( const SfxDateTimeItem& rItem ) : + SfxPoolItem( rItem ), + aDateTime( rItem.aDateTime ) +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return ( ( (SfxDateTimeItem&)rItem ).aDateTime == aDateTime ); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeItem::Compare( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + // da X.Compare( Y ) am String einem Compare( Y, X ) entspricht, + // vergleichen wir hier Y mit X + if ( ( (const SfxDateTimeItem&)rItem ).aDateTime < aDateTime ) + return -1; + else if ( ( (const SfxDateTimeItem&)rItem ).aDateTime == aDateTime ) + return 0; + else + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + sal_uInt32 nDate = 0; + sal_Int32 nTime = 0; + rStream >> nDate; + rStream >> nTime; + DateTime aDT(nDate, nTime); + return new SfxDateTimeItem( Which(), aDT ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxDateTimeItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + rStream << aDateTime.GetDate(); + rStream << aDateTime.GetTime(); + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + return new SfxDateTimeItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxDateTimeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + if (aDateTime.IsValid()) + if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(aDateTime); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(aDateTime); + } + else + { + DBG_WARNING("SfxDateTimeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(aDateTime); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(aDateTime); + } + else + rText.Erase(); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeItem::PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId ) +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTime aValue; + if ( rVal >>= aValue ) + { + aDateTime = DateTime( Date( aValue.Day, + aValue.Month, + aValue.Year ), + Time( aValue.Hours, + aValue.Minutes, + aValue.Seconds, + aValue.HundredthSeconds ) ); + return TRUE; + } + + DBG_ERROR( "SfxDateTimeItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId ) const +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTime aValue( aDateTime.Get100Sec(), + aDateTime.GetSec(), + aDateTime.GetMin(), + aDateTime.GetHour(), + aDateTime.GetDay(), + aDateTime.GetMonth(), + aDateTime.GetYear() ); + rVal <<= aValue; + return TRUE; +} + +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxColumnDateTimeItem, SfxDateTimeItem); + + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which ) : + SfxDateTimeItem( which ) +{} + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which, const DateTime& rDT ) : + SfxDateTimeItem( which, rDT ) +{} + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ) : + SfxDateTimeItem( rCpy ) +{} + +SfxPoolItem* SfxColumnDateTimeItem::Clone( SfxItemPool* ) const +{ + return new SfxColumnDateTimeItem( *this ); +} + +SfxItemPresentation SfxColumnDateTimeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_ASSERT(pIntlWrapper, + "SfxColumnDateTimeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + + ::com::sun::star::lang::Locale aLocale; + if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) + { + rText = String(SvtSimpleResId(STR_COLUM_DT_AUTO, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + } + else if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(GetDateTime()); + } + else + { + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(GetDateTime()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(GetDateTime()); + } + return SFX_ITEM_PRESENTATION_NAMELESS; +} + + + diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx deleted file mode 100644 index 12d7828350bb..000000000000 --- a/svl/source/items/dtritem.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: dtritem.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/util/DateTimeRange.hpp> - -#include <unotools/intlwrapper.hxx> -#include <comphelper/processfactory.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/datetime.hxx> -#include <rtl/math.hxx> -#include <svl/dtritem.hxx> - - -DBG_NAME( SfxDateTimeRangeItem ) -TYPEINIT1( SfxDateTimeRangeItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which, const DateTime& rStartDT, - const DateTime& rEndDT ) : - SfxPoolItem( which ), - aStartDateTime( rStartDT ), - aEndDateTime( rEndDT ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rItem ) : - SfxPoolItem( rItem ), - aStartDateTime( rItem.aStartDateTime ), - aEndDateTime( rItem.aEndDateTime ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxDateTimeRangeItem&)rItem ).aStartDateTime == aStartDateTime && - ((SfxDateTimeRangeItem&)rItem ).aEndDateTime == aEndDateTime; -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - double fThisRange = aEndDateTime - aStartDateTime; - double fRange = ((const SfxDateTimeRangeItem&)rItem).aEndDateTime - - ((const SfxDateTimeRangeItem&)rItem).aStartDateTime; - - if ( ::rtl::math::approxEqual( fRange, fThisRange ) ) - return 0; - else if ( fRange < fThisRange ) - return -1; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - - sal_uInt32 nStartDate, nEndDate; - sal_Int32 nStartTime, nEndTime; - - rStream >> nStartDate; - rStream >> nStartTime; - - rStream >> nEndDate; - rStream >> nEndTime; - - DateTime aStartDT, aEndDT; - - aStartDT.SetDate( nStartDate ); - aStartDT.SetTime( nStartTime ); - - aEndDT.SetDate( nEndDate ); - aEndDT.SetTime( nEndTime ); - - return new SfxDateTimeRangeItem( Which(), aStartDT, aEndDT ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxDateTimeRangeItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - rStream << aStartDateTime.GetDate(); - rStream << aStartDateTime.GetTime(); - - rStream << aEndDateTime.GetDate(); - rStream << aEndDateTime.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - return new SfxDateTimeRangeItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxDateTimeRangeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - DateTime aRange(aEndDateTime - (const Time&)aStartDateTime); - if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(aRange); - } - else - { - DBG_WARNING("SfxDateTimeRangeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(aRange); - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - com::sun::star::util::DateTimeRange aValue; - if ( rVal >>= aValue ) - { - aStartDateTime = DateTime( Date( aValue.StartDay, - aValue.StartMonth, - aValue.StartYear ), - Time( aValue.StartHours, - aValue.StartMinutes, - aValue.StartSeconds, - aValue.StartHundredthSeconds ) ); - aEndDateTime = DateTime( Date( aValue.EndDay, - aValue.EndMonth, - aValue.EndYear ), - Time( aValue.EndHours, - aValue.EndMinutes, - aValue.EndSeconds, - aValue.EndHundredthSeconds ) ); - return TRUE; - } - - DBG_ERROR( "SfxDateTimeRangeItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTimeRange aValue( aStartDateTime.Get100Sec(), - aStartDateTime.GetSec(), - aStartDateTime.GetMin(), - aStartDateTime.GetHour(), - aStartDateTime.GetDay(), - aStartDateTime.GetMonth(), - aStartDateTime.GetYear(), - aEndDateTime.Get100Sec(), - aEndDateTime.GetSec(), - aEndDateTime.GetMin(), - aEndDateTime.GetHour(), - aEndDateTime.GetDay(), - aEndDateTime.GetMonth(), - aEndDateTime.GetYear() ); - rVal <<= aValue; - return TRUE; -} - - diff --git a/svl/source/items/frqitem.cxx b/svl/source/items/frqitem.cxx deleted file mode 100644 index cfa1db17ef65..000000000000 --- a/svl/source/items/frqitem.cxx +++ /dev/null @@ -1,580 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: frqitem.cxx,v $ - * $Revision: 1.8.136.1 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#ifndef GCC -#endif - -#include <unotools/intlwrapper.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/datetime.hxx> - -#include <svl/frqitem.hxx> - -DBG_NAME( SfxFrequencyItem ) - -TYPEINIT1( SfxFrequencyItem, SfxPoolItem ); - -#define MAX_GOTO 32000 - -#define DECL_SAVE_GOTO() \ - ULONG nSafetyMeasures = 0; - -#define SAVE_GOTO(tag) \ - if(nSafetyMeasures < MAX_GOTO) \ - { nSafetyMeasures++; goto tag; } - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which ) : - SfxPoolItem ( which ), - eFrqMode ( FRQ_DAILY ), - eFrqTimeMode ( FRQ_TIME_AT ), - nDInterval1 ( 1 ), - nDInterval2 ( 0 ), - nDInterval3 ( 0 ), - nTInterval1 ( 1 ), - aTime1 ( Time( 12, 0, 0 ) ), - aTime2 ( Time( 12, 0, 0 ) ), - bMissingDate ( FALSE ), - aMissingDate ( DateTime(0, 0) ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ) : - SfxPoolItem ( which ), - eFrqMode ( eMode ), - eFrqTimeMode ( eTMode ), - nDInterval1 ( nDI1 ), - nDInterval2 ( nDI2 ), - nDInterval3 ( nDI3 ), - nTInterval1 ( nTI1 ), - aTime1 ( rT1 ), - aTime2 ( rT2 ), - bMissingDate ( FALSE ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( const SfxFrequencyItem& rItem ) : - SfxPoolItem ( rItem ), - eFrqMode ( rItem.eFrqMode ), - eFrqTimeMode ( rItem.eFrqTimeMode ), - nDInterval1 ( rItem.nDInterval1 ), - nDInterval2 ( rItem.nDInterval2 ), - nDInterval3 ( rItem.nDInterval3 ), - nTInterval1 ( rItem.nTInterval1 ), - aTime1 ( rItem.aTime1 ), - aTime2 ( rItem.aTime2 ), - bMissingDate ( rItem.bMissingDate ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxFrequencyItem&)rItem ).eFrqMode == eFrqMode && - ((SfxFrequencyItem&)rItem ).eFrqTimeMode == eFrqTimeMode && - ((SfxFrequencyItem&)rItem ).nDInterval1 == nDInterval1 && - ((SfxFrequencyItem&)rItem ).nDInterval2 == nDInterval2 && - ((SfxFrequencyItem&)rItem ).nDInterval3 == nDInterval3 && - ((SfxFrequencyItem&)rItem ).nTInterval1 == nTInterval1 && - ((SfxFrequencyItem&)rItem ).aTime1 == aTime1 && - ((SfxFrequencyItem&)rItem ).aTime2 == aTime2; -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::Compare( const SfxPoolItem& -#ifdef DBG_UTIL -rItem -#endif -) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - -/* DateTime aThisRange( aEndDateTime - aStartDateTime ); - DateTime aRange(((const SfxFrequencyItem&)rItem).aEndDateTime - - ((const SfxFrequencyItem&)rItem).aStartDateTime ); - if( aRange < aThisRange ) - return -1; - else if( aRange == aThisRange ) - return 0; - else -*/ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - - USHORT _eFrqMode; - USHORT _eFrqTimeMode; - USHORT _nDInterval1; - USHORT _nDInterval2; - USHORT _nDInterval3; - USHORT _nTInterval1; - long _nTime1; - long _nTime2; - - rStream >> _eFrqMode; - rStream >> _eFrqTimeMode; - rStream >> _nDInterval1; - rStream >> _nDInterval2; - rStream >> _nDInterval3; - rStream >> _nTInterval1; - rStream >> _nTime1; - rStream >> _nTime2; - - return new SfxFrequencyItem( Which(), (FrequencyMode)_eFrqMode, - (FrequencyTimeMode) _eFrqTimeMode, _nDInterval1, _nDInterval2, _nDInterval3, - _nTInterval1, Time(_nTime1), Time(_nTime2) ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxFrequencyItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - - USHORT nEMode = (USHORT)eFrqMode; - USHORT nETimeMode = (USHORT)eFrqTimeMode; - - rStream << (USHORT) nEMode; - rStream << (USHORT) nETimeMode; - - rStream << nDInterval1; - rStream << nDInterval2; - rStream << nDInterval3; - - rStream << nTInterval1; - rStream << aTime1.GetTime(); - rStream << aTime2.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - return new SfxFrequencyItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxFrequencyItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("SNIY")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -Time SfxFrequencyItem::_CalcTime( BOOL bForToday ) const -{ - Time aNow; - Time aTime; - - DECL_SAVE_GOTO(); - - switch( eFrqTimeMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_TIME_AT - // - // Update um Uhrzeit - // nTime1 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_AT : - aTime = aTime1; - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT - // - // Wiederhole alle X Stunden - // nTInterval1 = 1 .. 8 - // - case FRQ_TIME_REPEAT : - aTime = Time( 0, 0 ); - if( bForToday ) - { - - RECALC_TIME_REPEAT: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - SAVE_GOTO( RECALC_TIME_REPEAT ); - } - break; - } - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT_RANGE - // - // FRQ_TIME_REPEAT zwischen Uhrzeit 1 und 2 - // nTime1 = 00:00:00 - 24:00:00 - // nTime2 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_REPEAT_RANGE : - aTime = aTime1; - if( bForToday ) - { - if( aNow > aTime2 ) - return aTime1; - - RECALC_TIME_REPEAT_RANGE: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - if( aTime > aTime2 ) - return aTime1; - SAVE_GOTO( RECALC_TIME_REPEAT_RANGE ); - } - break; - } - break; - } - return aTime; -} - -DateTime SfxFrequencyItem::CalcNextTick( const DateTime& rBase, BOOL bFirst ) -{ - Date aDateToday; - Time aTimeToday; - Date aDateBase; - Time aTimeBase; - - if( bFirst ) - { - aDateBase = Date( 17, 2, 1969 ); - aTimeBase = Time( 8, 0, 0 ); - } - else - { - aDateBase = rBase.GetDate(); - aTimeBase = rBase.GetTime(); - } - - Time aNextTime( _CalcTime(FALSE) ); - Date aNextDate( aDateBase ); - bMissingDate = FALSE; - - DECL_SAVE_GOTO(); - - switch( eFrqMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_DAILY - // - // jeden X'ten Tag - // nInterval1 = 1 .. 999 - // - // jeden Wochentag - // nInterval1 = USHRT_MAX - // - case FRQ_DAILY : - { - if( bFirst ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - aNextTime = _CalcTime( FALSE ); - aNextDate = aDateToday + (USHORT) - ((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - } - else - aNextDate = aDateToday; - break; - } - - RECALC_FRQ_DAILY: - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - SAVE_GOTO( RECALC_FRQ_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - aNextTime = _CalcTime( FALSE ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_WEEKLY - // wiederhole jede X'te Woche - // nInterval1 = 1 .. 99 - // - // an SU, MO, TU, WE, TH, FR, SA - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // - case FRQ_WEEKLY : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_WEEKLY: - if( !bFirst || bInRecalc ) - aNextDate += (nDInterval1 - 1) * 7; - - aNextDate -= (USHORT) ((aNextDate.GetDayOfWeek() != SUNDAY) ? - aNextDate.GetDayOfWeek() + 1 : 0); - - if( nDInterval2 & WD_SUNDAY && (aNextDate >= aDateToday) ) - aNextDate += 0; - else if( nDInterval2 & WD_MONDAY && (aNextDate + 1 >= aDateToday) ) - aNextDate += 1; - else if( nDInterval2 & WD_TUESDAY && (aNextDate + 2 >= aDateToday) ) - aNextDate += 2; - else if( nDInterval2 & WD_WEDNESDAY && (aNextDate + 3 >= aDateToday) ) - aNextDate += 3; - else if( nDInterval2 & WD_THURSDAY && (aNextDate + 4 >= aDateToday) ) - aNextDate += 4; - else if( nDInterval2 & WD_FRIDAY && (aNextDate + 5 >= aDateToday) ) - aNextDate += 5; - else if( nDInterval2 & WD_SATURDAY && (aNextDate + 6 >= aDateToday) ) - aNextDate += 6; - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_DAILY - // - // jeden X'ten Tag von jedem X'ten Monat - // nInterval1 = 1 .. 31 - // nInterval2 = 1 .. 6 - // - case FRQ_MONTHLY_DAILY : - { - BOOL bInRecalc = FALSE; - aNextDate.SetDay( nDInterval1 ); - - RECALC_FRQ_MONTHLY_DAILY: - if( nDInterval2 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval2; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_LOGIC - // - // jeden ersten, zweiten, dritten, vierten oder letzten - // Wochentag jeden X'ten Monats - // nInterval1 = 0 .. 4 - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // nInterval3 = 1 .. 6 - // - case FRQ_MONTHLY_LOGIC : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_MONTHLY_LOGIC: - if( nDInterval3 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval3; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - USHORT nDay; - if( nDInterval2 & WD_SUNDAY ) - nDay = 6; - else if( nDInterval2 & WD_MONDAY ) - nDay = 0; - else if( nDInterval2 & WD_TUESDAY ) - nDay = 1; - else if( nDInterval2 & WD_WEDNESDAY ) - nDay = 2; - else if( nDInterval2 & WD_THURSDAY ) - nDay = 3; - else if( nDInterval2 & WD_FRIDAY ) - nDay = 4; - else nDay = 5; - - if( nDInterval1 == 4 ) - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(aNextDate.GetDaysInMonth() - 1); - if( aDT.GetDayOfWeek() != nDay ) - for( aDT--; aDT.GetDayOfWeek() != nDay; aDT-- ) ; - aNextDate = aDT; - } - else - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(nDay - USHORT(aDT.GetDayOfWeek())); - if( aDT.GetMonth() != aNextDate.GetMonth() ) - aDT += 7L; - aDT += (long)(nDInterval1 * 7); - aNextDate = aDT; - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - } - - return DateTime( aNextDate, aNextTime ); -} - diff --git a/svl/source/items/makefile.mk b/svl/source/items/makefile.mk index 525fff0bc90a..d779e16e24d1 100644 --- a/svl/source/items/makefile.mk +++ b/svl/source/items/makefile.mk @@ -43,43 +43,43 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES=\ $(SLO)$/aeitem.obj \ - $(SLO)$/eitem.obj \ - $(SLO)$/flagitem.obj \ - $(SLO)$/globalnameitem.obj \ - $(SLO)$/imageitm.obj \ - $(SLO)$/intitem.obj \ - $(SLO)$/macitem.obj \ - $(SLO)$/poolcach.obj \ - $(SLO)$/ptitem.obj \ - $(SLO)$/rectitem.obj \ - $(SLO)$/rngitem.obj \ - $(SLO)$/stritem.obj \ - $(SLO)$/style.obj \ - $(SLO)$/szitem.obj \ - $(SLO)$/bintitem.obj \ $(SLO)$/cenumitm.obj \ $(SLO)$/cintitem.obj \ $(SLO)$/cntwall.obj \ $(SLO)$/ctypeitm.obj \ $(SLO)$/custritm.obj \ - $(SLO)$/dtritem.obj \ - $(SLO)$/frqitem.obj \ + $(SLO)$/dateitem.obj \ + $(SLO)$/eitem.obj \ + $(SLO)$/flagitem.obj \ + $(SLO)$/globalnameitem.obj \ $(SLO)$/ilstitem.obj \ + $(SLO)$/imageitm.obj \ + $(SLO)$/intitem.obj \ $(SLO)$/itemiter.obj \ $(SLO)$/itempool.obj \ $(SLO)$/itemprop.obj \ $(SLO)$/itemset.obj \ $(SLO)$/lckbitem.obj \ + $(SLO)$/macitem.obj \ + $(SLO)$/poolcach.obj \ $(SLO)$/poolio.obj \ - $(SLO)$/stylepool.obj \ $(SLO)$/poolitem.obj \ + $(SLO)$/ptitem.obj \ + $(SLO)$/rectitem.obj \ + $(SLO)$/rngitem.obj \ $(SLO)$/sfontitm.obj \ $(SLO)$/sitem.obj \ $(SLO)$/slstitm.obj \ - $(SLO)$/tfrmitem.obj \ - $(SLO)$/tresitem.obj \ - $(SLO)$/whiter.obj \ - $(SLO)$/visitem.obj + $(SLO)$/stritem.obj \ + $(SLO)$/style.obj \ + $(SLO)$/stylepool.obj \ + $(SLO)$/szitem.obj \ + $(SLO)$/visitem.obj \ + $(SLO)$/whiter.obj + +SRS1NAME=$(TARGET) +SRC1FILES=\ + cstitem.src # --- Targets ------------------------------------------------------- diff --git a/svl/source/items/tfrmitem.cxx b/svl/source/items/tfrmitem.cxx deleted file mode 100644 index 636b3e9eb0a1..000000000000 --- a/svl/source/items/tfrmitem.cxx +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: tfrmitem.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include <com/sun/star/uno/Any.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/string.hxx> - -#include <svl/tfrmitem.hxx> - -DBG_NAME( SfxTargetFrameItem ) -TYPEINIT1( SfxTargetFrameItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( const SfxTargetFrameItem& rItem ) : - SfxPoolItem( rItem ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - _aFrames[nCur] = rItem._aFrames[nCur]; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which, - const String& rOpenSelectFrame, const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ) : SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - _aFrames[ (USHORT)SfxOpenSelect ] = rOpenSelectFrame; - _aFrames[ (USHORT)SfxOpenOpen ] = rOpenOpenFrame; - _aFrames[ (USHORT)SfxOpenAddTask ] = rOpenAddTaskFrame; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::~SfxTargetFrameItem() -{ - DBG_DTOR(SfxTargetFrameItem, 0); -} - -// ----------------------------------------------------------------------- - -String SfxTargetFrameItem::GetTargetFrame( SfxOpenMode eMode ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - if( eMode <= SfxOpenModeLast ) - return _aFrames[ (USHORT)eMode ]; - String aResult; - return aResult; -} - -// ----------------------------------------------------------------------- - -int SfxTargetFrameItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - if( _aFrames[nCur] != ((const SfxTargetFrameItem&)rItem)._aFrames[nCur] ) - return 0; - } - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxTargetFrameItem, 0); - SfxTargetFrameItem* pItem = new SfxTargetFrameItem( Which() ); - USHORT nCount = 0; - rStream >> nCount; - for(USHORT nCur=0; nCur<= (USHORT)SfxOpenModeLast && nCount; nCur++,nCount--) - { - readByteString(rStream, pItem->_aFrames[ nCur ]); - } - // die uebriggebliebenen ueberspringen - String aTemp; - while( nCount ) - { - readByteString(rStream, aTemp); - nCount--; - } - return pItem; -} - -// ----------------------------------------------------------------------- - -SvStream& SfxTargetFrameItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - USHORT nCount = (USHORT)(SfxOpenModeLast+1); - rStream << nCount; - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - writeByteString(rStream, _aFrames[ nCur ]); - } - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - return new SfxTargetFrameItem( *this ); -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - String aVal; - for ( int i = 0; i <= SfxOpenModeLast; i++ ) - { - aVal += _aFrames[ i ]; - aVal += ';' ; - } - - rVal <<= rtl::OUString( aVal ); - return TRUE; -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - rtl::OUString aValue; - if ( rVal >>= aValue ) - { - const String aVal( aValue ); - - for ( USHORT i = 0; i <= SfxOpenModeLast; i++ ) - _aFrames[ i ] = aVal.GetToken( i ); - - return TRUE; - } - - DBG_ERROR( "SfxTargetFrameItem::PutValue - Wrong type!" ); - return FALSE; -} - diff --git a/svl/source/items/tresitem.cxx b/svl/source/items/tresitem.cxx deleted file mode 100644 index 3fdf3f750180..000000000000 --- a/svl/source/items/tresitem.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: tresitem.cxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include <svl/tresitem.hxx> - -using namespace com::sun::star; - -//============================================================================ -// -// CntTransferResultItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(CntTransferResultItem, SfxPoolItem) - -//============================================================================ -// virtual -int CntTransferResultItem::operator ==(SfxPoolItem const & rItem) const -{ - if (CntTransferResultItem * pResultItem = PTR_CAST(CntTransferResultItem, - &rItem)) - return m_aResult.Source == pResultItem->m_aResult.Source - && m_aResult.Target == pResultItem->m_aResult.Target - && m_aResult.Result == pResultItem->m_aResult.Result; - return false; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::QueryValue(uno::Any & rVal, BYTE) const -{ - rVal <<= m_aResult; - return true; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::PutValue(uno::Any const & rVal, BYTE) -{ - return rVal >>= m_aResult; -} - -//============================================================================ -// virtual -SfxPoolItem * CntTransferResultItem::Clone(SfxItemPool *) const -{ - return new CntTransferResultItem(*this); -} - |