diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-04-13 10:20:12 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-04-13 10:20:12 +0000 |
commit | 7e91d25acb12311ba51d8cb5089b4c99249146ee (patch) | |
tree | 9859fe39af074d4204640774b1faf0de19a1ebf3 /svtools | |
parent | b981bad9df169032f034dae74cca61efb72c6b31 (diff) |
INTEGRATION: CWS visibility03 (1.1.2); FILE ADDED
2005/03/24 10:45:57 mhu 1.1.2.1: #i45006# Moved from svtools/source/items/ (for svl/items1.lib).
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/items1/visitem.cxx | 185 | ||||
-rw-r--r-- | svtools/source/items1/whassert.hxx | 92 | ||||
-rw-r--r-- | svtools/source/items1/whiter.cxx | 156 |
3 files changed, 433 insertions, 0 deletions
diff --git a/svtools/source/items1/visitem.cxx b/svtools/source/items1/visitem.cxx new file mode 100644 index 000000000000..8cf1ae27c7a6 --- /dev/null +++ b/svtools/source/items1/visitem.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * $RCSfile: visitem.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2005-04-13 11:19:47 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SFXVISIBILITYITEM_HXX +#include <visitem.hxx> +#endif +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif + +//============================================================================ +// +// class SfxVisibilityItem +// +//============================================================================ + +DBG_NAME(SfxVisibilityItem); + +//============================================================================ +TYPEINIT1_AUTOFACTORY(SfxVisibilityItem, SfxPoolItem); + +//============================================================================ +SfxVisibilityItem::SfxVisibilityItem(USHORT nWhich, SvStream & rStream): + SfxPoolItem(nWhich) +{ + DBG_CTOR(SfxVisibilityItem, 0); + sal_Bool bValue = 0; + rStream >> bValue; + m_nValue.bVisible = bValue; +} + +//============================================================================ +// virtual +int SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type"); + return m_nValue.bVisible == SAL_STATIC_CAST(const SfxVisibilityItem *, &rItem)-> + m_nValue.bVisible; +} + +//============================================================================ +// virtual +int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const +{ + DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type"); + return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ? + 0 : m_nValue.bVisible ? -1 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation SfxVisibilityItem::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) const +{ + rText = GetValueTextByVal(m_nValue.bVisible); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + + +//============================================================================ +// virtual +BOOL SfxVisibilityItem::QueryValue(com::sun::star::uno::Any& rVal, + BYTE nMemberId) const +{ + rVal <<= m_nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL SfxVisibilityItem::PutValue(const com::sun::star::uno::Any& rVal, + BYTE nMemberId) +{ + if (rVal >>= m_nValue) + return TRUE; + + DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + return new SfxVisibilityItem(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & SfxVisibilityItem::Store(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + rStream << m_nValue.bVisible; + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + return new SfxVisibilityItem(*this); +} + +//============================================================================ +// virtual +USHORT SfxVisibilityItem::GetValueCount() const +{ + return 2; +} + +//============================================================================ +// virtual +UniString SfxVisibilityItem::GetValueTextByVal(BOOL bTheValue) const +{ + return + bTheValue ? + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); +} diff --git a/svtools/source/items1/whassert.hxx b/svtools/source/items1/whassert.hxx new file mode 100644 index 000000000000..1444b7783daf --- /dev/null +++ b/svtools/source/items1/whassert.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * $RCSfile: whassert.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2005-04-13 11:19:59 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _SFX_WHASSERT_HXX +#define _SFX_WHASSERT_HXX + +#ifndef _TOOLS_DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +//------------------------------------------------------------------------ + +#ifdef DBG_UTIL +#define SFX_ASSERT( bCondition, nId, sMessage ) \ +{ \ + if ( DbgIsAssert() ) \ + { \ + if ( !(bCondition) ) \ + { \ + ByteString aMsg( sMessage ); \ + aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ + aMsg += ByteString::CreateFromInt32( nId ); \ + DbgOut( aMsg.GetBuffer(), DBG_OUT_ERROR, __FILE__, __LINE__); \ + } \ + } \ +} +#else +#define SFX_ASSERT( bCondition, nId, sMessage ) +#endif + + +#endif diff --git a/svtools/source/items1/whiter.cxx b/svtools/source/items1/whiter.cxx new file mode 100644 index 000000000000..382d84828930 --- /dev/null +++ b/svtools/source/items1/whiter.cxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * $RCSfile: whiter.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2005-04-13 11:20:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +// INCLUDE --------------------------------------------------------------- +#ifndef GCC +#pragma hdrstop +#endif + +#include "whiter.hxx" +#include "itemset.hxx" + +DBG_NAME(SfxWhichIter); + +// ----------------------------------------------------------------------- + +SfxWhichIter::SfxWhichIter( const SfxItemSet& rSet, USHORT nFromWh, USHORT nToWh ): + pRanges(rSet.GetRanges()), + pStart(rSet.GetRanges()), + nOfst(0), nFrom(nFromWh), nTo(nToWh) +{ + DBG_CTOR(SfxWhichIter, 0); + if ( nFrom > 0 ) + FirstWhich(); +} + +// ----------------------------------------------------------------------- + +SfxWhichIter::~SfxWhichIter() +{ + DBG_DTOR(SfxWhichIter, 0); +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::NextWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + while ( 0 != *pRanges ) + { + const USHORT nLastWhich = *pRanges + nOfst; + ++nOfst; + if (*(pRanges+1) == nLastWhich) + { + pRanges += 2; + nOfst = 0; + } + USHORT nWhich = *pRanges + nOfst; + if ( 0 == nWhich || ( nWhich >= nFrom && nWhich <= nTo ) ) + return nWhich; + } + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::PrevWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + while ( pRanges != pStart || 0 != nOfst ) + { + if(nOfst) + --nOfst; + else { + pRanges -= 2; + nOfst = *(pRanges+1) - (*pRanges); + } + USHORT nWhich = *pRanges + nOfst; + if ( nWhich >= nFrom && nWhich <= nTo ) + return nWhich; + } + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::FirstWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + pRanges = pStart; + nOfst = 0; + if ( *pRanges >= nFrom && *pRanges <= nTo ) + return *pRanges; + return NextWhich(); +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::LastWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + while(*pRanges) + ++pRanges; + nOfst = 0; + USHORT nWhich = *(pRanges-1); + if ( nWhich >= nFrom && nWhich <= nTo ) + return nWhich; + return PrevWhich(); +} + |