summaryrefslogtreecommitdiff
path: root/svtools/source/items
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/items')
-rw-r--r--svtools/source/items/aeitem.cxx296
-rw-r--r--svtools/source/items/eitem.cxx81
-rw-r--r--svtools/source/items/flagitem.cxx205
-rw-r--r--svtools/source/items/intitem.cxx306
-rw-r--r--svtools/source/items/itemdel.cxx175
-rw-r--r--svtools/source/items/macitem.cxx395
-rw-r--r--svtools/source/items/makefile.mk176
-rw-r--r--svtools/source/items/poolcach.cxx186
-rw-r--r--svtools/source/items/ptitem.cxx204
-rw-r--r--svtools/source/items/rectitem.cxx211
-rw-r--r--svtools/source/items/rngitem.cxx383
-rw-r--r--svtools/source/items/stritem.cxx106
-rw-r--r--svtools/source/items/style.cxx1201
-rw-r--r--svtools/source/items/szitem.cxx214
-rw-r--r--svtools/source/items/wallitem.cxx694
15 files changed, 4833 insertions, 0 deletions
diff --git a/svtools/source/items/aeitem.cxx b/svtools/source/items/aeitem.cxx
new file mode 100644
index 000000000000..aebb93af79a8
--- /dev/null
+++ b/svtools/source/items/aeitem.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * $RCSfile: aeitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <tools/string.hxx>
+
+#include <svarray.hxx>
+#include "aeitem.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxAllEnumItem);
+
+// -----------------------------------------------------------------------
+
+struct SfxAllEnumValue_Impl
+{
+ USHORT nValue;
+ XubString aText;
+};
+
+SV_DECL_PTRARR_DEL(SfxAllEnumValueArr, SfxAllEnumValue_Impl*, 0, 8);
+SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*);
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem( USHORT nWhich, USHORT nVal, const XubString &rText ):
+ SfxEnumItem(nWhich, nVal),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( nVal, rText );
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem(USHORT nWhich, USHORT nVal):
+ SfxEnumItem(nWhich, nVal),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( nVal );
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem( USHORT nWhich, SvStream &rStream ):
+ SfxEnumItem(nWhich, rStream),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( GetValue() );
+}
+
+// -----------------------------------------------------------------------
+
+
+SfxAllEnumItem::SfxAllEnumItem(USHORT nWhich):
+ SfxEnumItem(nWhich, 0),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+}
+
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy):
+ SfxEnumItem(rCopy),
+ pValues(0)
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ if ( !rCopy.pValues )
+ return;
+
+ pValues = new SfxAllEnumValueArr;
+ for ( USHORT nPos = 0; nPos < rCopy.pValues->Count(); ++nPos )
+ {
+ SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl;
+ pVal->nValue = rCopy.pValues->GetObject(nPos)->nValue;
+ pVal->aText = rCopy.pValues->GetObject(nPos)->aText;
+ const SfxAllEnumValue_Impl *pTemp = pVal;
+ pValues->Insert( pTemp, nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::~SfxAllEnumItem()
+{
+ DBG_DTOR(SfxAllEnumItem, 0);
+ delete pValues;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SfxAllEnumItem::GetValueCount() const
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ return pValues ? pValues->Count() : 0;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SfxAllEnumItem::GetValueTextByPos( USHORT nPos ) const
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" );
+ return pValues->GetObject(nPos)->aText;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SfxAllEnumItem::GetValueByPos( USHORT nPos ) const
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" );
+ return pValues->GetObject(nPos)->nValue;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxAllEnumItem::Clone( SfxItemPool * ) const
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ return new SfxAllEnumItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxAllEnumItem::Create( SvStream & rStream, USHORT nVersion ) const
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ return new SfxAllEnumItem( Which(), rStream );
+}
+
+
+// -----------------------------------------------------------------------
+
+USHORT SfxAllEnumItem::_GetPosByValue( USHORT nVal ) const
+
+/* [Beschreibung]
+
+ Im Ggs. zu <SfxEnumItemInterface::GetPosByValue(USHORT)const> liefert
+ diese interne Methode bei nicht vorhandenen Values die Position,
+ an der der Wert liegen w"urde.
+*/
+
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+
+ if ( !pValues )
+ return 0;
+
+ //!O: binaere Suche oder SortArray verwenden
+ USHORT nPos;
+ for ( nPos = 0; nPos < pValues->Count(); ++nPos )
+ if ( pValues->GetObject(nPos)->nValue >= nVal )
+ return nPos;
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SfxAllEnumItem::GetPosByValue( USHORT nValue ) const
+
+/* [Beschreibung]
+
+ Liefert im Gegensatz zu <SfxEnumItemInterface::GetPosByValue(USHORT)const>
+ immer nValue zur"uck, solange nicht mindestens ein Wert mit einer der
+ Methoden <SfxAllEnumItem::InsertValue()> eingef"ugt wurde.
+*/
+
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+
+ if ( !pValues || !pValues->Count() )
+ return nValue;
+
+ return SfxEnumItem::GetPosByValue( nValue );
+}
+
+// -----------------------------------------------------------------------
+
+void SfxAllEnumItem::InsertValue( USHORT nValue, const XubString &rValue )
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl;
+ pVal->nValue = nValue;
+ pVal->aText = rValue;
+ const SfxAllEnumValue_Impl *pTemp = pVal;
+ if ( !pValues )
+ pValues = new SfxAllEnumValueArr;
+ else if ( GetPosByValue( nValue ) != USHRT_MAX )
+ // remove when exists
+ RemoveValue( nValue );
+ // then insert
+ pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?!
+}
+
+// -----------------------------------------------------------------------
+
+void SfxAllEnumItem::InsertValue( USHORT nValue )
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl;
+ pVal->nValue = nValue;
+ pVal->aText = XubString::CreateFromInt32( nValue );
+ const SfxAllEnumValue_Impl *pTemp = pVal;
+ if ( !pValues )
+ pValues = new SfxAllEnumValueArr;
+
+ pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?!
+}
+
+// -----------------------------------------------------------------------
+
+void SfxAllEnumItem::RemoveValue( USHORT nValue )
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ USHORT nPos = GetPosByValue(nValue);
+ DBG_ASSERT( nPos != USHRT_MAX, "removing value not in enum" );
+ pValues->Remove( nPos );
+}
+
+// -----------------------------------------------------------------------
+
+
+void SfxAllEnumItem::RemoveAllValues()
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ if ( pValues )
+ pValues->DeleteAndDestroy( 0, pValues->Count() );
+}
+
+
+
diff --git a/svtools/source/items/eitem.cxx b/svtools/source/items/eitem.cxx
new file mode 100644
index 000000000000..bc3a5f84e9db
--- /dev/null
+++ b/svtools/source/items/eitem.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: eitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * 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 _SFXENUMITEM_HXX
+#include <eitem.hxx>
+#endif
+//============================================================================
+//
+// class SfxEnumItem
+//
+//============================================================================
+
+TYPEINIT1(SfxEnumItem, CntEnumItem);
+
+//============================================================================
+//
+// class SfxBoolItem
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxBoolItem, CntBoolItem);
+
+
diff --git a/svtools/source/items/flagitem.cxx b/svtools/source/items/flagitem.cxx
new file mode 100644
index 000000000000..bfa4a816084a
--- /dev/null
+++ b/svtools/source/items/flagitem.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * $RCSfile: flagitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * 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 _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#pragma hdrstop
+
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "flagitem.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxFlagItem);
+
+USHORT nSfxFlagVal[16] =
+{
+ 0x0001, 0x0002, 0x0004, 0x0008,
+ 0x0010, 0x0020, 0x0040, 0x0080,
+ 0x0100, 0x0200, 0x0400, 0x0800,
+ 0x1000, 0x2000, 0x4000, 0x8000
+};
+
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1(SfxFlagItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+SfxFlagItem::SfxFlagItem( USHORT nW, USHORT nV ) :
+ SfxPoolItem( nW ),
+ nVal(nV)
+{
+ DBG_CTOR(SfxFlagItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxFlagItem::SfxFlagItem( USHORT nW, SvStream &rStream) :
+ SfxPoolItem( nW )
+{
+ DBG_CTOR(SfxFlagItem, 0);
+ rStream >> nVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) :
+ SfxPoolItem( rItem ),
+ nVal( rItem.nVal )
+{
+ DBG_CTOR(SfxFlagItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxFlagItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ rStream << nVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxFlagItem::GetPresentation
+(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString& rText,
+ const International *
+) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ rText.Erase();
+ for ( int nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
+#ifndef ENABLEUNICODE
+ rText += String( GetFlag(nFlag) );
+#else
+ rText += UniString::CreateFromInt32( GetFlag(nFlag) );
+#endif
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SfxFlagItem::GetFlagText( BYTE nV ) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" );
+ return XubString();
+}
+
+// -----------------------------------------------------------------------
+
+
+BYTE SfxFlagItem::GetFlagCount() const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxFlagItem::Create(SvStream &rStream, USHORT nVersion) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+int SfxFlagItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return (((SfxFlagItem&)rItem).nVal == nVal);
+}
+
+// -----------------------------------------------------------------------
+
+void SfxFlagItem::SetFlag( BYTE nFlag, int bVal )
+{
+ if ( bVal )
+ nVal |= nSfxFlagVal[nFlag];
+ else
+ nVal &= ~nSfxFlagVal[nFlag];
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ return new SfxFlagItem( *this );
+}
+
+
+
+
+
diff --git a/svtools/source/items/intitem.cxx b/svtools/source/items/intitem.cxx
new file mode 100644
index 000000000000..a5db1767f543
--- /dev/null
+++ b/svtools/source/items/intitem.cxx
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * $RCSfile: intitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * 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 _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _BIGINT_HXX
+#include <tools/bigint.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _SFXINTITEM_HXX
+#include <intitem.hxx>
+#endif
+#ifndef _SFXMETRICITEM_HXX
+#include <metitem.hxx>
+#endif
+#ifndef _SBXVAR_HXX
+#include <sbxvar.hxx>
+#endif
+
+//============================================================================
+//
+// class SfxByteItem
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxByteItem, CntByteItem);
+
+//============================================================================
+// virtual
+SfxPoolItem * SfxByteItem::Create(SvStream & rStream, USHORT) const
+{
+ short nValue = 0;
+ rStream >> nValue;
+ return new SfxByteItem(Which(), BYTE(nValue));
+}
+
+//============================================================================
+//
+// class SfxInt16Item
+//
+//============================================================================
+
+DBG_NAME(SfxInt16Item);
+
+//============================================================================
+TYPEINIT1_AUTOFACTORY(SfxInt16Item, SfxPoolItem);
+
+//============================================================================
+SfxInt16Item::SfxInt16Item(USHORT nWhich, SvStream & rStream):
+ SfxPoolItem(nWhich)
+{
+ DBG_CTOR(SfxInt16Item, 0);
+ short nTheValue = 0;
+ rStream >> nTheValue;
+ m_nValue = nTheValue;
+}
+
+//============================================================================
+// virtual
+int SfxInt16Item::operator ==(const SfxPoolItem & rItem) const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type");
+ return m_nValue == SAL_STATIC_CAST(const SfxInt16Item *, &rItem)->
+ m_nValue;
+}
+
+//============================================================================
+// virtual
+int SfxInt16Item::Compare(const SfxPoolItem & rWith) const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type");
+ return SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue
+ < m_nValue ?
+ -1 :
+ SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue
+ == m_nValue ?
+ 0 : 1;
+}
+
+//============================================================================
+// virtual
+SfxItemPresentation SfxInt16Item::GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ XubString & rText,
+ const International *) const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ rText = UniString::CreateFromInt32(m_nValue);
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+
+//============================================================================
+// virtual
+BOOL SfxInt16Item::QueryValue(com::sun::star::uno::Any& rVal,
+ BYTE nMemberId) const
+{
+ sal_Int16 nValue = m_nValue;
+ rVal <<= nValue;
+ return TRUE;
+}
+
+//============================================================================
+// virtual
+BOOL SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId)
+{
+ sal_Int16 nValue;
+ if (rVal >>= nValue)
+ {
+ m_nValue = nValue;
+ return TRUE;
+ }
+
+ DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" );
+ return FALSE;
+}
+
+//============================================================================
+// virtual
+SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, USHORT) const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ return new SfxInt16Item(Which(), rStream);
+}
+
+//============================================================================
+// virtual
+SvStream & SfxInt16Item::Store(SvStream & rStream, USHORT) const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ rStream << short(m_nValue);
+ return rStream;
+}
+
+//============================================================================
+SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ return new SfxInt16Item(*this);
+}
+
+//============================================================================
+INT16 SfxInt16Item::GetMin() const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ return -32768;
+}
+
+//============================================================================
+INT16 SfxInt16Item::GetMax() const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ return 32767;
+}
+
+//============================================================================
+SfxFieldUnit SfxInt16Item::GetUnit() const
+{
+ DBG_CHKTHIS(SfxInt16Item, 0);
+ return SFX_FUNIT_NONE;
+}
+
+//============================================================================
+//
+// class SfxUInt16Item
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxUInt16Item, CntUInt16Item);
+
+
+//============================================================================
+//
+// class SfxInt32Item
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxInt32Item, CntInt32Item);
+
+
+//============================================================================
+//
+// class SfxUInt32Item
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxUInt32Item, CntUInt32Item);
+
+
+//============================================================================
+//
+// class SfxMetricItem
+//
+//============================================================================
+
+DBG_NAME(SfxMetricItem);
+
+//============================================================================
+TYPEINIT1_AUTOFACTORY(SfxMetricItem, SfxInt32Item);
+
+//============================================================================
+SfxMetricItem::SfxMetricItem(USHORT nWhich, UINT32 nValue):
+ SfxInt32Item(nWhich, nValue)
+{
+ DBG_CTOR(SfxMetricItem, 0);
+}
+
+//============================================================================
+SfxMetricItem::SfxMetricItem(USHORT nWhich, SvStream & rStream):
+ SfxInt32Item(nWhich, rStream)
+{
+ DBG_CTOR(SfxMetricItem, 0);
+}
+
+//============================================================================
+SfxMetricItem::SfxMetricItem(const SfxMetricItem & rItem):
+ SfxInt32Item(rItem)
+{
+ DBG_CTOR(SfxMetricItem, 0);
+}
+
+//============================================================================
+// virtual
+int SfxMetricItem::ScaleMetrics(long nMult, long nDiv)
+{
+ BigInt aTheValue(GetValue());
+ aTheValue *= nMult;
+ aTheValue += nDiv / 2;
+ aTheValue /= nDiv;
+ SetValue(aTheValue);
+ return 1;
+}
+
+//============================================================================
+// virtual
+int SfxMetricItem::HasMetrics() const
+{
+ return 1;
+}
+
diff --git a/svtools/source/items/itemdel.cxx b/svtools/source/items/itemdel.cxx
new file mode 100644
index 000000000000..d3acda749a45
--- /dev/null
+++ b/svtools/source/items/itemdel.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * $RCSfile: itemdel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * 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 _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _ERRCODE_HXX //autogen
+#include <tools/errcode.hxx>
+#endif
+#include <limits.h>
+
+#include <sbx.hxx>
+
+#include "svtdata.hxx"
+#include "svarray.hxx"
+#include "args.hxx"
+#include "itempool.hxx"
+#include "itemdel.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxItemDesruptor_Impl);
+
+// -----------------------------------------------------------------------
+
+class SfxItemDesruptor_Impl
+{
+ SfxPoolItem *pItem;
+ Link aLink;
+
+private:
+ DECL_LINK( Delete, void * );
+ SfxItemDesruptor_Impl( const SfxItemDesruptor_Impl& ); // n.i.
+
+public:
+ SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt );
+ ~SfxItemDesruptor_Impl();
+};
+
+SV_DECL_PTRARR( SfxItemDesruptorList_Impl, SfxItemDesruptor_Impl*, 4, 4 );
+
+// ------------------------------------------------------------------------
+SfxItemDesruptor_Impl::SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt ):
+ pItem(pItemToDesrupt),
+ aLink( LINK(this, SfxItemDesruptor_Impl, Delete) )
+{
+ DBG_CTOR(SfxItemDesruptor_Impl, 0);
+
+ pItem->SetRef( SFX_ITEMS_DELETEONIDLE );
+
+ // im Idle abarbeiten
+ GetpApp()->InsertIdleHdl( aLink, 1 );
+
+ // und in Liste eintragen (damit geflusht werden kann)
+ SfxItemDesruptorList_Impl* &rpList
+ = ImpSvtData::GetSvtData().pItemDesruptList;
+ if ( !rpList )
+ rpList = new SfxItemDesruptorList_Impl;
+ const SfxItemDesruptor_Impl *pThis = this;
+ rpList->Insert( pThis, rpList->Count() );
+}
+
+// ------------------------------------------------------------------------
+SfxItemDesruptor_Impl::~SfxItemDesruptor_Impl()
+{
+ DBG_DTOR(SfxItemDesruptor_Impl, 0);
+
+ // aus Idle-Handler austragen
+ GetpApp()->RemoveIdleHdl( aLink );
+
+ // und aus Liste austragen
+ SfxItemDesruptorList_Impl* &rpList
+ = ImpSvtData::GetSvtData().pItemDesruptList;
+ DBG_ASSERT( rpList, "no DesruptorList" );
+ const SfxItemDesruptor_Impl *pThis = this;
+ if ( rpList ) HACK(warum?)
+ rpList->Remove( rpList->GetPos(pThis) );
+
+ // Item l"oschen
+ pItem->SetRef( 0 );
+ DBG_CHKOBJ( pItem, SfxPoolItem, 0 );
+ DBG_ASSERT( 0 == pItem->GetRef(), "desrupting pooled item" );
+ delete pItem;
+}
+
+// ------------------------------------------------------------------------
+IMPL_LINK( SfxItemDesruptor_Impl, Delete, void *, pvoid )
+{
+ {DBG_CHKTHIS(SfxItemDesruptor_Impl, 0);}
+ delete this;
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem )
+{
+ DBG_ASSERT( 0 == pItem->GetRef(), "deleting item in use" );
+ new SfxItemDesruptor_Impl( pItem );
+ return pItem;
+}
+
+// ------------------------------------------------------------------------
+void DeleteOnIdleItems()
+{
+ SfxItemDesruptorList_Impl* &rpList
+ = ImpSvtData::GetSvtData().pItemDesruptList;
+ if ( rpList )
+ {
+ USHORT n;
+ while ( 0 != ( n = rpList->Count() ) )
+ // Remove ist implizit im Dtor
+ delete rpList->GetObject( n-1 );
+ DELETEZ(rpList);
+ }
+}
+
+
diff --git a/svtools/source/items/macitem.cxx b/svtools/source/items/macitem.cxx
new file mode 100644
index 000000000000..17c831ad167c
--- /dev/null
+++ b/svtools/source/items/macitem.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ *
+ * $RCSfile: macitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#pragma hdrstop
+#define ITEMID_MACRO 0
+
+#include "macitem.hxx"
+#include <segmentc.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SvxMacroItem);
+
+SEG_EOFGLOBALS()
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SvxMacroItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+
+SjJSbxObjectBase::~SjJSbxObjectBase()
+{
+}
+
+SjJSbxObjectBase* SjJSbxObjectBase::Clone( void )
+{
+ return NULL;
+}
+
+SvxMacro::SvxMacro( const String &rMacName, const String &rLanguage)
+ : aMacName( rMacName ), aLibName( rLanguage),
+ pFunctionObject(NULL), eType( EXTENDED_STYPE)
+{
+ if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_STARBASIC))
+ eType=STARBASIC;
+ else if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT))
+ eType=JAVASCRIPT;
+}
+
+
+SvxMacro::~SvxMacro()
+{
+ delete pFunctionObject;
+}
+
+String SvxMacro::GetLanguage()const
+{
+ if(eType==STARBASIC)
+ {
+ return UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_STARBASIC));
+ }
+ else if(eType==JAVASCRIPT)
+ {
+ return UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_JAVASCRIPT));
+ }
+
+ return aLibName;
+}
+
+
+
+SvxMacro& SvxMacro::operator=( const SvxMacro& rBase )
+{
+ if( this != &rBase )
+ {
+ aMacName = rBase.aMacName;
+ aLibName = rBase.aLibName;
+ delete pFunctionObject;
+ pFunctionObject = rBase.pFunctionObject ? rBase.pFunctionObject->Clone() : NULL;
+ eType = rBase.eType;
+ }
+ return *this;
+}
+
+
+#pragma SEG_FUNCDEF(macitem_02)
+
+SvxMacroTableDtor& SvxMacroTableDtor::operator=( const SvxMacroTableDtor& rTbl )
+{
+ DelDtor();
+ SvxMacro* pTmp = ((SvxMacroTableDtor&)rTbl).First();
+ while( pTmp )
+ {
+ SvxMacro *pNew = new SvxMacro( *pTmp );
+ Insert( rTbl.GetCurKey(), pNew );
+ pTmp = ((SvxMacroTableDtor&)rTbl).Next();
+ }
+ return *this;
+}
+
+#pragma SEG_FUNCDEF(macitem_03)
+
+SvStream& SvxMacroTableDtor::Read( SvStream& rStrm, USHORT nVersion )
+{
+ if( SVX_MACROTBL_VERSION40 <= nVersion )
+ rStrm >> nVersion;
+ short nMacro;
+ rStrm >> nMacro;
+
+ for( short i = 0; i < nMacro; ++i )
+ {
+ USHORT nCurKey, eType = STARBASIC;
+ String aLibName, aMacName;
+ rStrm >> nCurKey;
+ SfxPoolItem::readByteString(rStrm, aLibName);
+ SfxPoolItem::readByteString(rStrm, aMacName);
+
+ if( SVX_MACROTBL_VERSION40 <= nVersion )
+ rStrm >> eType;
+
+ SvxMacro* pNew = new SvxMacro( aMacName, aLibName, (ScriptType)eType );
+
+ SvxMacro *pOld = Get( nCurKey );
+ if( pOld )
+ {
+ delete pOld;
+ Replace( nCurKey, pNew );
+ }
+ else
+ Insert( nCurKey, pNew );
+ }
+ return rStrm;
+}
+
+#pragma SEG_FUNCDEF(macitem_04)
+
+SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const
+{
+ USHORT nVersion = SOFFICE_FILEFORMAT_31 == rStream.GetVersion()
+ ? SVX_MACROTBL_VERSION31
+ : SVX_MACROTBL_AKTVERSION;
+
+ if( SVX_MACROTBL_VERSION40 <= nVersion )
+ rStream << nVersion;
+
+ rStream << (USHORT)Count();
+
+ SvxMacro* pMac = ((SvxMacroTableDtor*)this)->First();
+ while( pMac && rStream.GetError() == SVSTREAM_OK )
+ {
+ rStream << (short)GetCurKey();
+ SfxPoolItem::writeByteString(rStream, pMac->GetLibName());
+ SfxPoolItem::writeByteString(rStream, pMac->GetMacName());
+
+ if( SVX_MACROTBL_VERSION40 <= nVersion )
+ rStream << (USHORT)pMac->GetScriptType();
+ pMac = ((SvxMacroTableDtor*)this)->Next();
+ }
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_05)
+
+void SvxMacroTableDtor::DelDtor()
+{
+ SvxMacro* pTmp = First();
+ while( pTmp )
+ {
+ delete pTmp;
+ pTmp = Next();
+ }
+ Clear();
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_06)
+
+int SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ const SvxMacroTableDtor& rOwn = aMacroTable;
+ const SvxMacroTableDtor& rOther = ( (SvxMacroItem&) rAttr ).aMacroTable;
+
+ // Anzahl unterschiedlich => auf jeden Fall ungleich
+ if ( rOwn.Count() != rOther.Count() )
+ return FALSE;
+
+ // einzeln verleichen; wegen Performance ist die Reihenfolge wichtig
+ for ( USHORT nNo = 0; nNo < rOwn.Count(); ++nNo )
+ {
+ const SvxMacro *pOwnMac = rOwn.GetObject(nNo);
+ const SvxMacro *pOtherMac = rOther.GetObject(nNo);
+ if ( rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac) ||
+ pOwnMac->GetLibName() != pOtherMac->GetLibName() ||
+ pOwnMac->GetMacName() != pOtherMac->GetMacName() )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_07)
+
+SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const
+{
+ return new SvxMacroItem( *this );
+}
+
+//------------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_08)
+
+SfxItemPresentation SvxMacroItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ XubString& rText,
+ const International *
+) const
+{
+/*!!!
+ SvxMacroTableDtor& rTbl = (SvxMacroTableDtor&)GetMacroTable();
+ SvxMacro* pMac = rTbl.First();
+
+ while ( pMac )
+ {
+ rText += pMac->GetLibName();
+ rText += cpDelim;
+ rText += pMac->GetMacName();
+ pMac = rTbl.Next();
+ if ( pMac )
+ rText += cpDelim;
+ }
+*/
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_09)
+
+SvStream& SvxMacroItem::Store( SvStream& rStrm , USHORT nItemVersion ) const
+{
+ return aMacroTable.Write( rStrm );
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_0a)
+
+SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, USHORT nVersion ) const
+{
+ SvxMacroItem* pAttr = new SvxMacroItem( Which() );
+ pAttr->aMacroTable.Read( rStrm, nVersion );
+ return pAttr;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_0b)
+
+void SvxMacroItem::SetMacro( USHORT nEvent, const SvxMacro& rMacro )
+{
+ SvxMacro *pMacro;
+ if ( 0 != (pMacro=aMacroTable.Get(nEvent)) )
+ {
+ delete pMacro;
+ aMacroTable.Replace(nEvent, new SvxMacro( rMacro ) );
+ }
+ else
+ aMacroTable.Insert(nEvent, new SvxMacro( rMacro ) );
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_0c)
+
+USHORT SvxMacroItem::GetVersion( USHORT nFileFormatVersion ) const
+{
+ return SOFFICE_FILEFORMAT_31 == nFileFormatVersion
+ ? 0 : aMacroTable.GetVersion();
+}
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.15 2000/09/18 14:13:34 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.14 2000/08/31 13:41:28 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.13 2000/04/12 08:01:39 sb
+ Adapted to Unicode.
+
+ Revision 1.12 2000/02/09 16:23:32 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.11 1999/09/01 06:52:36 sb
+ #66082# Added International param to SfxPoolItem::GetPresentation().
+
+ Revision 1.10 1998/07/23 11:54:38 ANK
+ #53261# SvxMacro- Konstruktor geaendert setzt jetzt auch eType
+
+
+ Rev 1.9 23 Jul 1998 13:54:38 ANK
+ #53261# SvxMacro- Konstruktor geaendert setzt jetzt auch eType
+
+ Rev 1.8 08 Jul 1998 16:06:16 MIB
+ Get(JavaScript|StarBasic)String
+
+ Rev 1.7 27 May 1998 19:33:56 ANK
+ neuer Konstruktor fuer SvxMacro
+
+ Rev 1.6 15 May 1998 19:42:42 ANK
+ neue Fkt SvxMacro::GetLanguage
+
+ Rev 1.5 19 Jan 1998 19:18:06 MH
+ chg: header
+
+ Rev 1.4 04 Mar 1997 12:36:00 WP
+ WTC Anpassungen verallgemeinert
+
+ Rev 1.3 05 Feb 1997 14:55:24 AB
+ SvxMacro geaendert
+
+ Rev 1.2 06 Dec 1996 14:39:18 TRI
+ WTC Anpassung
+
+ Rev 1.1 05 Dec 1996 10:28:12 JP
+ GetScripType -> GetScriptType
+
+ Rev 1.0 03 Dec 1996 19:39:56 JP
+ Initial revision.
+
+------------------------------------------------------------------------*/
+
+#pragma SEG_EOFMODULE
+
diff --git a/svtools/source/items/makefile.mk b/svtools/source/items/makefile.mk
new file mode 100644
index 000000000000..19c14890907f
--- /dev/null
+++ b/svtools/source/items/makefile.mk
@@ -0,0 +1,176 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PROJECTPCH=items
+PROJECTPCHSOURCE=items
+
+PRJNAME=SVTOOLS
+TARGET=items
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+# Every source directory generates headers in a own output directory to
+# enable parallel building of the source directories within a project!
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+UNOTYPES=\
+ com.sun.star.awt.Point \
+ com.sun.star.awt.Rectangle \
+ com.sun.star.awt.Size \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.PropertyState \
+ com.sun.star.beans.XPropertySetInfo \
+ com.sun.star.chaos.ContentType \
+ com.sun.star.chaos.MenuDescriptor \
+ com.sun.star.chaos.MenuItemDescriptor \
+ com.sun.star.chaos.WallPaper \
+ com.sun.star.container.XNameAccess \
+ com.sun.star.container.XNameContainer \
+ com.sun.star.io.XActiveDataControl \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.lang.IllegalArgumentException \
+ com.sun.star.lang.XMultiServiceFactory\
+ com.sun.star.lang.XTypeProvider\
+ com.sun.star.lang.XServiceInfo\
+ com.sun.star.lang.XUnoTunnel\
+ com.sun.star.ucb.TransferResult \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.XWeak \
+ com.sun.star.util.DateTime \
+ com.sun.star.util.DateTimeRange
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+LIB2TARGET=$(SLB)$/items1.lib
+LIB2OBJFILES=\
+ $(SLO)$/bintitem.obj \
+ $(SLO)$/cenumitm.obj \
+ $(SLO)$/cintitem.obj \
+ $(SLO)$/cntcmpmn.obj \
+ $(SLO)$/cntwall.obj \
+ $(SLO)$/cstitem.obj \
+ $(SLO)$/ctypeitm.obj \
+ $(SLO)$/custritm.obj \
+ $(SLO)$/dateitem.obj \
+ $(SLO)$/dtritem.obj \
+ $(SLO)$/frqitem.obj \
+ $(SLO)$/itemiter.obj \
+ $(SLO)$/itempool.obj \
+ $(SLO)$/itemprop.obj \
+ $(SLO)$/itemset.obj \
+ $(SLO)$/lckbitem.obj \
+ $(SLO)$/poolio.obj \
+ $(SLO)$/poolitem.obj \
+ $(SLO)$/sfontitm.obj \
+ $(SLO)$/sitem.obj \
+ $(SLO)$/slstitm.obj \
+ $(SLO)$/tfrmitem.obj \
+ $(SLO)$/tresitem.obj \
+ $(SLO)$/whiter.obj
+
+LIB3TARGET=$(SLB)$/items2.lib
+LIB3OBJFILES=\
+ $(SLO)$/aeitem.obj \
+ $(SLO)$/args.obj \
+ $(SLO)$/compat.obj \
+ $(SLO)$/eitem.obj \
+ $(SLO)$/flagitem.obj \
+ $(SLO)$/intitem.obj \
+ $(SLO)$/itemdel.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)$/wallitem.obj
+
+SLOFILES=\
+ $(LIB2OBJFILES) \
+ $(LIB3OBJFILES)
+
+.ENDIF
+
+SRCFILES=\
+ cstitem.src
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/items/poolcach.cxx b/svtools/source/items/poolcach.cxx
new file mode 100644
index 000000000000..d50edbf56614
--- /dev/null
+++ b/svtools/source/items/poolcach.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * $RCSfile: poolcach.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 <limits.h>
+
+#pragma hdrstop
+
+#include "itempool.hxx"
+#include "itemset.hxx"
+#include "poolcach.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxItemPoolCache);
+
+
+//------------------------------------------------------------------------
+
+struct SfxItemModifyImpl
+{
+ const SfxSetItem *pOrigItem;
+ SfxSetItem *pPoolItem;
+};
+
+SV_DECL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl, 8, 8 );
+SV_IMPL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl);
+
+//------------------------------------------------------------------------
+
+SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
+ const SfxPoolItem *pPutItem ):
+ pPool(pItemPool),
+ pCache(new SfxItemModifyArr_Impl),
+ pItemToPut( &pItemPool->Put(*pPutItem) ),
+ pSetToPut( 0 )
+{
+ DBG_CTOR(SfxItemPoolCache, 0);
+ DBG_ASSERT(pItemPool, "kein Pool angegeben");
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
+ const SfxItemSet *pPutSet ):
+ pPool(pItemPool),
+ pCache(new SfxItemModifyArr_Impl),
+ pItemToPut( 0 ),
+ pSetToPut( pPutSet )
+{
+ DBG_CTOR(SfxItemPoolCache, 0);
+ DBG_ASSERT(pItemPool, "kein Pool angegeben");
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPoolCache::~SfxItemPoolCache()
+{
+ DBG_DTOR(SfxItemPoolCache, 0);
+ for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) {
+ pPool->Remove( *(*pCache)[nPos].pPoolItem );
+ pPool->Remove( *(*pCache)[nPos].pOrigItem );
+ }
+ delete pCache; pCache = 0;
+
+ if ( pItemToPut )
+ pPool->Remove( *pItemToPut );
+}
+
+//------------------------------------------------------------------------
+
+const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL bNew )
+{
+ DBG_CHKTHIS(SfxItemPoolCache, 0);
+ DBG_ASSERT( pPool == rOrigItem.GetItemSet().GetPool(), "invalid Pool" );
+ DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ),
+ "original not in pool" );
+
+ // Suchen, ob diese Transformations schon einmal vorkam
+ for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos )
+ {
+ SfxItemModifyImpl &rMapEntry = (*pCache)[nPos];
+ if ( rMapEntry.pOrigItem == &rOrigItem )
+ {
+ // aendert sich ueberhaupt etwas?
+ if ( rMapEntry.pPoolItem != &rOrigItem )
+ {
+ rMapEntry.pPoolItem->AddRef(2); // einen davon fuer den Cache
+ if ( bNew )
+ pPool->Put( rOrigItem ); //! AddRef??
+ }
+ return *rMapEntry.pPoolItem;
+ }
+ }
+
+ // die neue Attributierung in einem neuen Set eintragen
+ SfxSetItem *pNewItem = (SfxSetItem *)rOrigItem.Clone();
+ if ( pItemToPut )
+ {
+ pNewItem->GetItemSet().PutDirect( *pItemToPut );
+ DBG_ASSERT( &pNewItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut,
+ "wrong item in temporary set" );
+ }
+ else
+ pNewItem->GetItemSet().Put( *pSetToPut );
+ const SfxSetItem* pNewPoolItem = (const SfxSetItem*) &pPool->Put( *pNewItem );
+ DBG_ASSERT( pNewPoolItem != pNewItem, "Pool: rein == raus?" );
+ delete pNewItem;
+
+ // Refernzzaehler anpassen, je einen davon fuer den Cache
+ pNewPoolItem->AddRef( pNewPoolItem != &rOrigItem ? 2 : 1 );
+ if ( bNew )
+ pPool->Put( rOrigItem ); //! AddRef??
+
+ // die Transformation im Cache eintragen
+ SfxItemModifyImpl aModify;
+ aModify.pOrigItem = &rOrigItem;
+ aModify.pPoolItem = (SfxSetItem*) pNewPoolItem;
+ pCache->Insert( aModify, pCache->Count() );
+
+ DBG_ASSERT( !pItemToPut ||
+ &pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut,
+ "wrong item in resulting set" );
+
+ return *pNewPoolItem;
+}
+
+
+
diff --git a/svtools/source/items/ptitem.cxx b/svtools/source/items/ptitem.cxx
new file mode 100644
index 000000000000..158ac4b6954a
--- /dev/null
+++ b/svtools/source/items/ptitem.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * $RCSfile: ptitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POINT_HPP_
+#include <com/sun/star/awt/Point.hpp>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#include "sbx.hxx"
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "ptitem.hxx"
+#include "memberid.hrc"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxPointItem);
+
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SfxPointItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+SfxPointItem::SfxPointItem()
+{
+ DBG_CTOR(SfxPointItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPointItem::SfxPointItem( USHORT nW, const Point& rVal ) :
+ SfxPoolItem( nW ),
+ aVal( rVal )
+{
+ DBG_CTOR(SfxPointItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPointItem::SfxPointItem( USHORT nW, SvStream &rStream ) :
+ SfxPoolItem( nW )
+{
+ DBG_CTOR(SfxPointItem, 0);
+ rStream >> aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPointItem::SfxPointItem( const SfxPointItem& rItem ) :
+ SfxPoolItem( rItem ),
+ aVal( rItem.aVal )
+{
+ DBG_CTOR(SfxPointItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxPointItem::GetPresentation
+(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString& rText,
+ const International *
+) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ rText = UniString::CreateFromInt32(aVal.X());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ rText += UniString::CreateFromInt32(aVal.Y());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+int SfxPointItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ((SfxPointItem&)rItem).aVal == aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxPointItem::Clone(SfxItemPool *) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ return new SfxPointItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxPointItem::Create(SvStream &rStream, USHORT nVersion ) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ Point aStr;
+ rStream >> aStr;
+ return new SfxPointItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxPointItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxPointItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ rVal <<= com::sun::star::awt::Point( aVal.getX(), aVal.getY() );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxPointItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Point aValue;
+ if ( rVal >>= aValue )
+ {
+ aVal.setX( aValue.X );
+ aVal.setY( aValue.Y );
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/rectitem.cxx b/svtools/source/items/rectitem.cxx
new file mode 100644
index 000000000000..7d143e90ff61
--- /dev/null
+++ b/svtools/source/items/rectitem.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: rectitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_
+#include <com/sun/star/awt/Rectangle.hpp>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#include "sbx.hxx"
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "rectitem.hxx"
+#include "memberid.hrc"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxRectangleItem);
+
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SfxRectangleItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+SfxRectangleItem::SfxRectangleItem()
+{
+ DBG_CTOR(SfxRectangleItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxRectangleItem::SfxRectangleItem( USHORT nW, const Rectangle& rVal ) :
+ SfxPoolItem( nW ),
+ aVal( rVal )
+{
+ DBG_CTOR(SfxRectangleItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxRectangleItem::SfxRectangleItem( USHORT nW, SvStream &rStream ) :
+ SfxPoolItem( nW )
+{
+ DBG_CTOR(SfxRectangleItem, 0);
+ rStream >> aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxRectangleItem::SfxRectangleItem( const SfxRectangleItem& rItem ) :
+ SfxPoolItem( rItem ),
+ aVal( rItem.aVal )
+{
+ DBG_CTOR(SfxRectangleItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxRectangleItem::GetPresentation
+(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString& rText,
+ const International *
+) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ rText = UniString::CreateFromInt32(aVal.Top());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ rText += UniString::CreateFromInt32(aVal.Left());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ rText += UniString::CreateFromInt32(aVal.Bottom());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ rText += UniString::CreateFromInt32(aVal.Right());
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+int SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ((SfxRectangleItem&)rItem).aVal == aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxRectangleItem::Clone(SfxItemPool *) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ return new SfxRectangleItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxRectangleItem::Create(SvStream &rStream, USHORT nVersion ) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ Rectangle aStr;
+ rStream >> aStr;
+ return new SfxRectangleItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxRectangleItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+
+// -----------------------------------------------------------------------
+BOOL SfxRectangleItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId) const
+{
+ rVal <<= com::sun::star::awt::Rectangle( aVal.getX(),
+ aVal.getY(),
+ aVal.getWidth(),
+ aVal.getHeight() );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxRectangleItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Rectangle aValue;
+ if ( rVal >>= aValue )
+ {
+ aVal.setX( aValue.X );
+ aVal.setY( aValue.Y );
+ aVal.setWidth( aValue.Width );
+ aVal.setHeight( aValue.Height );
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/rngitem.cxx b/svtools/source/items/rngitem.cxx
new file mode 100644
index 000000000000..c59640318186
--- /dev/null
+++ b/svtools/source/items/rngitem.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * $RCSfile: rngitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#pragma hdrstop
+
+#ifndef NUMTYPE
+
+#include "rngitem.hxx"
+#include "sbx.hxx"
+#include "args.hxx"
+
+#if SUPD<355
+DBG_NAME(SfxRangeItem);
+#endif
+
+
+#define NUMTYPE USHORT
+#define SfxXRangeItem SfxRangeItem
+#define SfxXRangesItem SfxUShortRangesItem
+#include "rngitem.cxx"
+
+#define NUMTYPE ULONG
+#define SfxXRangeItem SfxULongRangeItem
+#define SfxXRangesItem SfxULongRangesItem
+#include "rngitem.cxx"
+
+#else
+
+static inline NUMTYPE Count_Impl(const NUMTYPE * pRanges)
+{
+ NUMTYPE nCount = 0;
+ for (; *pRanges; pRanges += 2) nCount += 2;
+ return nCount;
+}
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SfxXRangeItem, SfxPoolItem);
+TYPEINIT1_AUTOFACTORY(SfxXRangesItem, SfxPoolItem);
+
+NUMTYPE Count_Impl( const NUMTYPE *pRanges );
+
+// -----------------------------------------------------------------------
+
+SfxXRangeItem::SfxXRangeItem()
+{
+ nFrom = 0;
+ nTo = 0;
+}
+
+// -----------------------------------------------------------------------
+
+SfxXRangeItem::SfxXRangeItem( USHORT nWhich, NUMTYPE from, NUMTYPE to ):
+ SfxPoolItem( nWhich ),
+ nFrom( from ),
+ nTo( to )
+{
+}
+
+
+// -----------------------------------------------------------------------
+
+SfxXRangeItem::SfxXRangeItem( USHORT nW, SvStream &rStream ) :
+ SfxPoolItem( nW )
+{
+ rStream >> nFrom;
+ rStream >> nTo;
+}
+
+// -----------------------------------------------------------------------
+
+SfxXRangeItem::SfxXRangeItem( const SfxXRangeItem& rItem ) :
+ SfxPoolItem( rItem )
+{
+ nFrom = rItem.nFrom;
+ nTo = rItem.nTo;
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxXRangeItem::GetPresentation
+(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString& rText,
+ const International *
+) const
+{
+ rText = UniString::CreateFromInt64(nFrom);
+ rText += ':';
+ rText += UniString::CreateFromInt64(nTo);
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+int SfxXRangeItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ SfxXRangeItem* pT = (SfxXRangeItem*)&rItem;
+ if( nFrom==pT->nFrom && nTo==pT->nTo )
+ return 1;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangeItem::Clone(SfxItemPool *) const
+{
+ return new SfxXRangeItem( Which(), nFrom, nTo );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangeItem::Create(SvStream &rStream, USHORT nVersion ) const
+{
+ NUMTYPE nVon, nBis;
+ rStream >> nVon;
+ rStream >> nBis;
+ return new SfxXRangeItem( Which(), nVon, nBis );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxXRangeItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ rStream << nFrom;
+ rStream << nTo;
+ return rStream;
+}
+
+//=========================================================================
+
+SfxXRangesItem::SfxXRangesItem()
+: _pRanges(0)
+{
+}
+
+//-------------------------------------------------------------------------
+
+SfxXRangesItem::SfxXRangesItem( USHORT nWID, const NUMTYPE *pRanges )
+: SfxPoolItem( nWID )
+{
+ NUMTYPE nCount = Count_Impl(pRanges) + 1;
+ _pRanges = new NUMTYPE[nCount];
+ memcpy( _pRanges, pRanges, sizeof(NUMTYPE) * nCount );
+}
+
+//-------------------------------------------------------------------------
+
+SfxXRangesItem::SfxXRangesItem( USHORT nWID, SvStream &rStream )
+: SfxPoolItem( nWID )
+{
+ NUMTYPE nCount;
+ rStream >> nCount;
+ _pRanges = new NUMTYPE[nCount + 1];
+ for ( NUMTYPE n = 0; n < nCount; ++n )
+ rStream >> _pRanges[n];
+ _pRanges[nCount] = 0;
+}
+
+//-------------------------------------------------------------------------
+
+SfxXRangesItem::SfxXRangesItem( const SfxXRangesItem& rItem )
+: SfxPoolItem( rItem )
+{
+ NUMTYPE nCount = Count_Impl(rItem._pRanges) + 1;
+ _pRanges = new NUMTYPE[nCount];
+ memcpy( _pRanges, rItem._pRanges, sizeof(NUMTYPE) * nCount );
+}
+
+//-------------------------------------------------------------------------
+
+SfxXRangesItem::~SfxXRangesItem()
+{
+ delete _pRanges;
+}
+
+//-------------------------------------------------------------------------
+
+int SfxXRangesItem::operator==( const SfxPoolItem &rItem ) const
+{
+ const SfxXRangesItem &rOther = (const SfxXRangesItem&) rItem;
+ if ( !_pRanges && !rOther._pRanges )
+ return TRUE;
+ if ( _pRanges || rOther._pRanges )
+ return FALSE;
+
+ NUMTYPE n;
+ for ( n = 0; _pRanges[n] && rOther._pRanges[n]; ++n )
+ if ( *_pRanges != rOther._pRanges[n] )
+ return 0;
+
+ return !_pRanges[n] && !rOther._pRanges[n];
+}
+
+//-------------------------------------------------------------------------
+
+SfxItemPresentation SfxXRangesItem::GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ XubString &rText,
+ const International * ) const
+{
+ HACK(n. i.)
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//-------------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangesItem::Clone( SfxItemPool *pPool ) const
+{
+ return new SfxXRangesItem( *this );
+}
+
+//-------------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangesItem::Create( SvStream &rStream, USHORT nVersion ) const
+{
+ return new SfxXRangesItem( Which(), rStream );
+}
+
+//-------------------------------------------------------------------------
+
+SvStream& SfxXRangesItem::Store( SvStream &rStream, USHORT nItemVersion ) const
+{
+ NUMTYPE nCount = Count_Impl( _pRanges );
+ rStream >> nCount;
+ for ( NUMTYPE n = 0; _pRanges[n]; ++n )
+ rStream >> _pRanges[n];
+ return rStream;
+}
+
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.24 2000/09/18 14:13:35 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.23 2000/08/31 13:41:28 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.22 2000/05/26 16:38:31 os
+ Set/FillVariable removed
+
+ Revision 1.21 2000/04/12 08:01:39 sb
+ Adapted to Unicode.
+
+ Revision 1.20 2000/02/09 16:23:50 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.19 1999/09/27 12:16:04 hr
+ for-scope
+
+ Revision 1.18 1999/09/08 15:35:16 sb
+ #66082# Copied Count_Impl from nranges.cxx.
+
+ Revision 1.17 1999/09/01 06:52:36 sb
+ #66082# Added International param to SfxPoolItem::GetPresentation().
+
+ Revision 1.16 1998/01/09 11:17:06 MH
+ chg: header
+
+
+ Rev 1.15 09 Jan 1998 12:17:06 MH
+ chg: header
+
+ Rev 1.14 05 Mar 1997 13:44:56 MI
+ falsche Var verwendet daher op== falsch
+
+ Rev 1.13 03 Feb 1997 10:00:14 MI
+ Typeinfo fuer Ranges
+
+ Rev 1.12 03 Feb 1997 09:13:22 MI
+ NUMTYPE durch USHORT ersetzt
+
+ Rev 1.11 02 Feb 1997 16:46:32 MI
+ compilebar
+
+ Rev 1.10 02 Feb 1997 13:29:24 MI
+ jetzt auch Sfx..RangesItem (mehrere Ranges)
+
+ Rev 1.9 02 Feb 1997 12:23:56 MI
+ jetzt auch LongRange
+
+ Rev 1.8 14 Nov 1996 18:49:12 MI
+ FileFirmat 4.0
+
+ Rev 1.7 14 Mar 1996 17:40:46 MH
+ del: S_VERSION
+
+ Rev 1.6 12 Mar 1996 12:49:42 OV
+ ein fehlendes DBG_CTOR eingefuegt
+
+ Rev 1.5 21 Nov 1995 15:50:52 MI
+ FillVariable fuer strukturierte Items
+
+ Rev 1.4 20 Nov 1995 15:44:20 AB
+ Unicode-Anpassung
+
+ Rev 1.3 15 Nov 1995 20:16:36 MI
+ GetVariable/SetVariable
+
+ Rev 1.2 05 Jul 1995 18:11:38 MI
+ GetValueText raus #pragmas rein
+
+ Rev 1.1 29 Jun 1995 17:16:30 MI
+ GetPresentation impl.
+
+ Rev 1.0 22 Feb 1995 16:26:28 OV
+ Initial revision.
+
+------------------------------------------------------------------------*/
+#undef NUMTYPE
+#undef SfxXRangeItem
+#undef SfxXRangesItem
+
+
+#endif
+
diff --git a/svtools/source/items/stritem.cxx b/svtools/source/items/stritem.cxx
new file mode 100644
index 000000000000..0829221cc1db
--- /dev/null
+++ b/svtools/source/items/stritem.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * $RCSfile: stritem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _SFXSTRITEM_HXX
+#include <stritem.hxx>
+#endif
+
+//============================================================================
+//
+// class SfxStringItem
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxStringItem, CntUnencodedStringItem)
+
+//============================================================================
+// virtual
+SfxStringItem::SfxStringItem(USHORT nWhich, SvStream & rStream):
+ CntUnencodedStringItem(nWhich)
+{
+ UniString aValue;
+ readByteString(rStream, aValue);
+ SetValue(aValue);
+}
+
+
+//============================================================================
+// virtual
+SfxPoolItem * SfxStringItem::Create(SvStream & rStream, USHORT) const
+{
+ return new SfxStringItem(Which(), rStream);
+}
+
+//============================================================================
+// virtual
+SvStream & SfxStringItem::Store(SvStream & rStream, USHORT) const
+{
+ writeByteString(rStream, GetValue());
+ return rStream;
+}
+
+//============================================================================
+// virtual
+SfxPoolItem * SfxStringItem::Clone(SfxItemPool *) const
+{
+ return new SfxStringItem(*this);
+}
+
diff --git a/svtools/source/items/style.cxx b/svtools/source/items/style.cxx
new file mode 100644
index 000000000000..f62020536731
--- /dev/null
+++ b/svtools/source/items/style.cxx
@@ -0,0 +1,1201 @@
+/*************************************************************************
+ *
+ * $RCSfile: style.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#pragma hdrstop
+
+#include <smplhint.hxx>
+#include <poolitem.hxx>
+#include <itemset.hxx>
+#include <itempool.hxx>
+#include <poolio.hxx>
+#include <filerec.hxx>
+#include <itemiter.hxx>
+#include "style.hxx"
+
+#define STYLESTREAM "SfxStyleSheets"
+#define STYLESTREAM_VERSION USHORT(50)
+
+
+
+TYPEINIT0(SfxStyleSheetBase)
+
+TYPEINIT3(SfxStyleSheet, SfxStyleSheetBase, SfxListener, SfxBroadcaster)
+
+
+//=========================================================================
+
+TYPEINIT1(SfxStyleSheetHint, SfxHint);
+TYPEINIT1(SfxStyleSheetHintExtended, SfxStyleSheetHint);
+TYPEINIT1(SfxStyleSheetPoolHint, SfxHint);
+
+SfxStyleSheetHintExtended::SfxStyleSheetHintExtended
+(
+ USHORT nAction, // SFX_STYLESHEET_... (s.o.)
+ const String& rOldName,
+ SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer
+)
+: SfxStyleSheetHint( nAction, rStyleSheet ),
+ aName( rOldName )
+{}
+
+//-------------------------------------------------------------------------
+
+SfxStyleSheetHint::SfxStyleSheetHint
+(
+ USHORT nAction, // SFX_STYLESHEET_... (s.o.)
+ SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer
+)
+: pStyleSh( &rStyleSheet ),
+ nHint( nAction )
+{}
+
+//=========================================================================
+
+class SfxStyleSheetBasePool_Impl
+{
+ public:
+ SfxStyles aStyles;
+ SfxStyleSheetIterator *pIter;
+ SfxStyleSheetBasePool_Impl() : pIter(0){}
+ ~SfxStyleSheetBasePool_Impl(){delete pIter;}
+};
+
+
+//////////////////////////// SfxStyleSheetBase ///////////////////////////////
+
+// Konstruktoren
+
+SfxStyleSheetBase::SfxStyleSheetBase
+ ( const XubString& rName, SfxStyleSheetBasePool& r, SfxStyleFamily eFam, USHORT mask )
+ : aName( rName ), aParent(), aFollow( rName ),
+ nFamily( eFam ), nMask(mask), rPool( r ),
+ nHelpId( 0 ), pSet( NULL ), bMySet( FALSE )
+{
+}
+
+SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
+ : aName( r.aName ), aParent( r.aParent ), aFollow( r.aFollow ),
+ nFamily( r.nFamily ),
+ nMask( r.nMask ),
+ rPool( r.rPool ),
+ nHelpId( r.nHelpId ), aHelpFile( r.aHelpFile ), bMySet( r.bMySet )
+{
+ if( r.pSet )
+ pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet;
+ else
+ pSet = NULL;
+}
+
+SfxStyleSheetBase::~SfxStyleSheetBase()
+{
+ if( bMySet )
+ {
+ delete pSet;
+ pSet = 0;
+ }
+}
+
+USHORT SfxStyleSheetBase::GetVersion() const
+{
+ return 0x0000;
+}
+
+// Namen aendern
+
+const XubString& SfxStyleSheetBase::GetName() const
+{
+ return aName;
+}
+
+BOOL SfxStyleSheetBase::SetName( const XubString& rName )
+{
+ if(rName.Len() == 0)
+ return FALSE;
+ if( aName != rName )
+ {
+ String aOldName = aName;
+ SfxStyleSheetBase *pOther = rPool.Find( rName, nFamily ) ;
+ if ( pOther && pOther != this )
+ return FALSE;
+
+ SfxStyleFamily eTmpFam=rPool.GetSearchFamily();
+ USHORT nTmpMask=rPool.GetSearchMask();
+
+ rPool.SetSearchMask(nFamily);
+
+ if ( aName.Len() )
+ rPool.ChangeParent( aName, rName, FALSE );
+ if ( aFollow.Equals( aName ) )
+ aFollow = rName;
+ aName = rName;
+ rPool.SetSearchMask(eTmpFam, nTmpMask);
+ rPool.Broadcast( SfxStyleSheetHintExtended(
+ SFX_STYLESHEET_MODIFIED, aOldName, *this ) );
+ }
+ return TRUE;
+}
+
+// Parent aendern
+
+const XubString& SfxStyleSheetBase::GetParent() const
+{
+ return aParent;
+}
+
+BOOL SfxStyleSheetBase::SetParent( const XubString& rName )
+{
+ if( aParent != rName )
+ {
+ SfxStyleSheetBase* pIter = rPool.Find(rName, nFamily);
+ if( rName.Len() && !pIter )
+ {
+ DBG_ERROR( "StyleSheet-Parent nicht gefunden" );
+ return FALSE;
+ }
+ // rekursive Verknuepfungen verhindern
+ if( aName.Len() )
+ while(pIter)
+ {
+ if(pIter->GetName() == aName && aName != rName)
+ return FALSE;
+ pIter = rPool.Find(pIter->GetParent(), nFamily);
+ }
+ aParent = rName;
+ }
+ rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ return TRUE;
+}
+
+// Follow aendern
+
+const XubString& SfxStyleSheetBase::GetFollow() const
+{
+ return aFollow;
+}
+
+BOOL SfxStyleSheetBase::SetFollow( const XubString& rName )
+{
+ if( aFollow != rName )
+ {
+ if( !rPool.Find( rName, nFamily ) )
+ {
+ DBG_ERROR( "StyleSheet-Follow nicht gefunden" );
+ return FALSE;
+ }
+ aFollow = rName;
+ }
+ rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ return TRUE;
+}
+
+// Itemset setzen. Die Dflt-Implementation legt ein neues Set an.
+
+SfxItemSet& SfxStyleSheetBase::GetItemSet()
+{
+ if( !pSet )
+ {
+ pSet = new SfxItemSet( rPool.GetPool() );
+ bMySet = TRUE;
+ }
+ return *pSet;
+}
+
+// Hilfe-Datei und -ID setzen und abfragen
+
+ULONG SfxStyleSheetBase::GetHelpId( String& rFile )
+{
+ rFile = aHelpFile;
+ return nHelpId;
+}
+
+void SfxStyleSheetBase::SetHelpId( const String& rFile, ULONG nId )
+{
+ aHelpFile = rFile;
+ nHelpId = nId;
+}
+
+// Folgevorlage m"oglich? Default: Ja
+
+BOOL SfxStyleSheetBase::HasFollowSupport() const
+{
+ return TRUE;
+}
+
+// Basisvorlage m"oglich? Default: Ja
+
+BOOL SfxStyleSheetBase::HasParentSupport() const
+{
+ return TRUE;
+}
+
+// Basisvorlage uf NULL setzen m"oglich? Default: Nein
+
+BOOL SfxStyleSheetBase::HasClearParentSupport() const
+{
+ return FALSE;
+}
+
+// Defaultmaessig sind alle StyleSheets Used
+
+BOOL SfxStyleSheetBase::IsUsed() const
+{
+ return TRUE;
+}
+
+// eingestellte Attribute ausgeben
+
+
+XubString SfxStyleSheetBase::GetDescription()
+{
+#if SUPD >= 368
+ return GetDescription( SFX_MAPUNIT_CM );
+
+/*!!!
+ if ( !pSet )
+ GetItemSet();
+ SfxItemIter aIter( *pSet );
+ XubString aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ XubString aItemPresentation;
+
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aItemPresentation ) )
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+#ifndef ENABLEUNICODE
+ aDesc += " + ";
+#else
+ aDesc += L" + ";
+#endif
+ if ( aItemPresentation.Len() )
+ aDesc += aItemPresentation;
+ }
+ pItem = aIter.NextItem();
+ }
+ return aDesc;
+*/
+}
+
+// eingestellte Attribute ausgeben
+
+XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric )
+{
+#endif
+ SfxItemIter aIter( GetItemSet() );
+ XubString aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ XubString aItemPresentation;
+
+#if SUPD >= 368
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eMetric, aItemPresentation ) )
+#else
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aItemPresentation ) )
+#endif
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+ aDesc.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" + "));
+ if ( aItemPresentation.Len() )
+ aDesc += aItemPresentation;
+ }
+ pItem = aIter.NextItem();
+ }
+ return aDesc;
+}
+
+/////////////////////////// SfxStyleSheetIterator ///////////////////////////////
+
+SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
+{
+ return nSearchFamily;
+}
+
+inline BOOL SfxStyleSheetIterator::IsTrivialSearch()
+{
+ return nMask == 0xFFFF && GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
+}
+
+BOOL SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
+{
+ return ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) ||
+ ( pStyle->GetFamily() == GetSearchFamily() ))
+ && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
+ ( bSearchUsed ? pStyle->IsUsed() : FALSE ) ||
+ GetSearchMask() == SFXSTYLEBIT_ALL );
+}
+
+
+SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
+ SfxStyleFamily eFam, USHORT n)
+{
+ pBasePool=pBase;
+ nSearchFamily=eFam;
+ bSearchUsed=FALSE;
+ int nn=SFXSTYLEBIT_USED;
+ int nnn=SFXSTYLEBIT_ALL;
+ if((n != SFXSTYLEBIT_ALL ) && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED))
+ {
+ bSearchUsed = TRUE;
+ n &= ~SFXSTYLEBIT_USED;
+ }
+ nMask=n;
+}
+
+SfxStyleSheetIterator::~SfxStyleSheetIterator()
+{
+}
+
+
+USHORT SfxStyleSheetIterator::Count()
+{
+ USHORT n = 0;
+ if( IsTrivialSearch())
+ n = (USHORT) pBasePool->aStyles.Count();
+ else
+ for(USHORT i=0; i<pBasePool->aStyles.Count(); i++)
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(i);
+ if(DoesStyleMatch(pStyle))
+ n++;
+ }
+ return n;
+}
+
+SfxStyleSheetBase* SfxStyleSheetIterator::operator[](USHORT nIdx)
+{
+ if( IsTrivialSearch())
+ return pBasePool->aStyles.GetObject(nIdx);
+
+ USHORT z = 0;
+ for(USHORT n=0; n<pBasePool->aStyles.Count(); n++)
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+ if( DoesStyleMatch(pStyle))
+ {
+ if(z == nIdx)
+ {
+ nAktPosition=n;
+ return pAktStyle=pStyle;
+ }
+ ++z;
+ }
+ }
+ DBG_ERROR("falscher Index");
+ return 0;
+}
+
+SfxStyleSheetBase* SfxStyleSheetIterator::First()
+{
+ INT32 nIdx = -1;
+
+ if ( IsTrivialSearch() && pBasePool->aStyles.Count() )
+ nIdx = 0;
+ else
+ for( USHORT n = 0; n < pBasePool->aStyles.Count(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+
+ if ( DoesStyleMatch( pStyle ) )
+ {
+ nIdx = n;
+ break;
+ }
+ }
+
+ if ( nIdx != -1 )
+ {
+ nAktPosition = (USHORT)nIdx;
+ return pAktStyle = pBasePool->aStyles.GetObject(nIdx);
+ }
+ return 0;
+}
+
+
+SfxStyleSheetBase* SfxStyleSheetIterator::Next()
+{
+ INT32 nIdx = -1;
+
+ if ( IsTrivialSearch() &&
+ (USHORT)pBasePool->aStyles.Count() > nAktPosition + 1 )
+ nIdx = nAktPosition + 1;
+ else
+ for( USHORT n = nAktPosition + 1; n < pBasePool->aStyles.Count(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+
+ if ( DoesStyleMatch( pStyle ) )
+ {
+ nIdx = n;
+ break;
+ }
+ }
+
+ if ( nIdx != -1 )
+ {
+ nAktPosition = (USHORT)nIdx;
+ return pAktStyle = pBasePool->aStyles.GetObject(nIdx);
+ }
+ return 0;
+}
+
+
+SfxStyleSheetBase* SfxStyleSheetIterator::Find(const XubString& rStr)
+{
+ for ( USHORT n = 0; n < pBasePool->aStyles.Count(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+
+ if ( DoesStyleMatch( pStyle ) &&
+ pStyle->GetName().Equals( rStr ) )
+ {
+ nAktPosition = n;
+ return pAktStyle = pStyle;
+ }
+ }
+ return 0;
+}
+
+
+USHORT SfxStyleSheetIterator::GetSearchMask() const
+{
+ USHORT mask = nMask;
+
+ if ( bSearchUsed )
+ mask |= SFXSTYLEBIT_USED;
+ return mask;
+}
+
+/////////////////////////// SfxStyleSheetBasePool ///////////////////////////////
+
+
+void SfxStyleSheetBasePool::Replace(
+ SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget )
+{
+ rTarget.SetFollow( rSource.GetFollow() );
+ rTarget.SetParent( rSource.GetParent() );
+ SfxItemSet& rSourceSet = rSource.GetItemSet();
+ SfxItemSet& rTargetSet = rTarget.GetItemSet();
+ rTargetSet.Intersect( rSourceSet );
+ rTargetSet.Put( rSourceSet );
+}
+
+SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl()
+{
+ SfxStyleSheetIterator*& rpIter = pImp->pIter;
+ if( !rpIter || rpIter->GetSearchMask() != nMask ||
+ rpIter->GetSearchFamily() != nSearchFamily )
+ {
+ delete rpIter;
+#if SUPD > 363
+ rpIter = CreateIterator( nSearchFamily, nMask );
+#else
+ rpIter = new SfxStyleSheetIterator( this, nSearchFamily, nMask );
+#endif
+ }
+ return *rpIter;
+}
+
+
+SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r )
+: rPool(r), aAppName(r.GetName()),
+ nMask(0xFFFF), nSearchFamily(SFX_STYLE_FAMILY_PARA)
+{
+ pImp = new SfxStyleSheetBasePool_Impl;
+}
+
+SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r )
+: rPool(r.rPool),
+ nMask( r.nMask ), nSearchFamily(r.nSearchFamily),aAppName(r.aAppName)
+{
+ pImp = new SfxStyleSheetBasePool_Impl;
+ *this += r;
+}
+
+SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
+{
+ Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
+ Clear();
+ delete pImp;
+}
+
+BOOL SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const XubString& rStyle, const XubString& rParent)
+{
+ SfxStyleSheetIterator aIter(this,eFam,SFXSTYLEBIT_ALL);
+ SfxStyleSheetBase *pStyle =
+ aIter.Find(rStyle);
+ DBG_ASSERT(pStyle, "Vorlage nicht gefunden. Writer mit Solar <2541??");
+ if(pStyle)
+ return pStyle->SetParent(rParent);
+ else
+ return FALSE;
+}
+
+
+void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, USHORT n)
+{
+ nSearchFamily = eFam; nMask = n;
+}
+
+USHORT SfxStyleSheetBasePool::GetSearchMask() const
+{
+ return nMask;
+}
+
+
+// Der Name des Streams
+
+String SfxStyleSheetBasePool::GetStreamName()
+{
+ return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(STYLESTREAM));
+}
+
+/////////////////////////////////// Factory ////////////////////////////////
+
+
+#if SUPD > 363
+
+SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator
+(
+ SfxStyleFamily eFam,
+ USHORT mask
+)
+{
+ return new SfxStyleSheetIterator(this,eFam,mask);
+}
+
+#endif
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Create
+(
+ const XubString& rName,
+ SfxStyleFamily eFam,
+ USHORT mask
+)
+{
+ return new SfxStyleSheetBase( rName, *this, eFam, mask );
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r )
+{
+ return new SfxStyleSheetBase( r );
+}
+
+SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const XubString& rName,
+ SfxStyleFamily eFam, USHORT mask, USHORT nPos)
+{
+ DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "FamilyAll als Familie nicht erlaubt" );
+
+ SfxStyleSheetIterator aIter(this, eFam, mask);
+ SfxStyleSheetBase* p = aIter.Find( rName );
+ DBG_ASSERT( !p, "StyleSheet bereits vorhanden" );
+ SfxStyleSheetIterator& rIter = GetIterator_Impl();
+
+ if( !p )
+ {
+ p = Create( rName, eFam, mask );
+ if(0xffff == nPos || nPos == aStyles.Count() ||
+ nPos == rIter.Count())
+ aStyles.Insert( p, aStyles.Count() );
+ else
+ {
+ rIter[nPos];
+ aStyles.Insert(p, rIter.GetPos());
+ }
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) );
+ }
+ return *p;
+}
+
+/////////////////////////////// Kopieren ///////////////////////////////////
+
+// Hilfsroutine: Falls eine Vorlage dieses Namens existiert, wird
+// sie neu erzeugt. Alle Vorlagen, die diese Vorlage zum Parent haben,
+// werden umgehaengt.
+
+SfxStyleSheetBase& SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet )
+{
+ SfxStyleSheetIterator aIter(this, rSheet.GetFamily(), nMask);
+ SfxStyleSheetBase* pOld = aIter.Find( rSheet.GetName() );
+ Erase( pOld );
+ SfxStyleSheetBase* pNew = Create( rSheet );
+ aStyles.Insert( pNew, aStyles.Count() );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *pNew ) );
+ return *pNew;
+}
+
+SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r )
+{
+ if( &r != this )
+ {
+ Clear();
+ *this += r;
+ }
+ return *this;
+}
+
+SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBasePool& rP )
+{
+ if( &rP != this )
+ {
+ // kopieren
+ SfxStyleSheetBasePool& r = (SfxStyleSheetBasePool&) rP;
+ for( SfxStyleSheetBase* p = r.aStyles.First(); p; p = r.aStyles.Next() )
+ Add(*p);
+
+ }
+ return *this;
+}
+
+//////////////////////////////// Suchen ////////////////////////////////////
+
+USHORT SfxStyleSheetBasePool::Count()
+{
+ return GetIterator_Impl().Count();
+}
+
+SfxStyleSheetBase *SfxStyleSheetBasePool::operator[](USHORT nIdx)
+{
+ return GetIterator_Impl()[nIdx];
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const XubString& rName,
+ SfxStyleFamily eFam,
+ USHORT mask)
+{
+ SfxStyleSheetIterator aIter(this,eFam,mask);
+ return aIter.Find(rName);
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::First()
+{
+ return GetIterator_Impl().First();
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Next()
+{
+ return GetIterator_Impl().Next();
+}
+
+//////////////////////////////// Loeschen /////////////////////////////////
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
+{
+ if( p )
+ {
+ // Alle Styles umsetzen, deren Parent dieser hier ist
+ ChangeParent( p->GetName(), p->GetParent() );
+ aStyles.Remove( p );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
+ }
+ return p;
+}
+
+void SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p )
+{
+ if( p )
+ {
+ Remove(p);
+ delete p;
+ }
+}
+
+void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p )
+{
+ DBG_ASSERT( p, "Kein StyleSheet?" );
+ SfxStyleSheetIterator aIter(
+ this, p->GetFamily(), p->GetMask());
+ SfxStyleSheetBase* pOld = aIter.Find( p->GetName() );
+ DBG_ASSERT( !pOld, "StyleSheet bereits vorhanden" );
+ if( p->GetParent().Len() )
+ {
+ pOld = aIter.Find( p->GetParent() );
+ DBG_ASSERT( pOld, "Parent nicht mehr vorhanden" );
+ }
+ aStyles.Insert( p, aStyles.Count() );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) );
+}
+
+void SfxStyleSheetBasePool::Clear()
+{
+ while( aStyles.Count() )
+ {
+ SfxStyleSheetBase* p = aStyles.First();
+ aStyles.Remove( p );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
+ delete p;
+ }
+}
+
+/////////////////////////// Parents umsetzen ////////////////////////////////
+
+void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld,
+ const XubString& rNew,
+ BOOL bVirtual)
+{
+ const ULONG nPos = aStyles.GetCurPos();
+ const USHORT nTmpMask = GetSearchMask();
+ SetSearchMask(GetSearchFamily(), 0xffff);
+ for( SfxStyleSheetBase* p = First(); p; p = Next() )
+ {
+ if( p->GetParent().Equals( rOld ) )
+ {
+ if(bVirtual)
+ p->SetParent( rNew );
+ else
+ p->aParent = rNew;
+ }
+ }
+ SetSearchMask(GetSearchFamily(), nTmpMask);
+ aStyles.Seek(nPos);
+}
+
+/////////////////////////// Laden/Speichern /////////////////////////////////
+
+void SfxStyleSheetBase::Load( SvStream&, USHORT )
+{
+}
+
+void SfxStyleSheetBase::Store( SvStream& )
+{
+}
+
+
+BOOL SfxStyleSheetBasePool::Load( SvStream& rStream )
+{
+ // alte Version?
+ if ( !rPool.IsVer2_Impl() )
+ return Load1_Impl( rStream );
+
+ // gesamten StyleSheetPool in neuer Version aus einem MiniRecord lesen
+ SfxMiniRecordReader aPoolRec( &rStream, SFX_STYLES_REC );
+
+ // Header-Record lesen
+ short nCharSet;
+ if ( !rStream.GetError() )
+ {
+ SfxSingleRecordReader aHeaderRec( &rStream, SFX_STYLES_REC_HEADER );
+ if ( !aHeaderRec.IsValid() )
+ return FALSE;
+
+ aAppName = rPool.GetName();
+ rStream >> nCharSet;
+ }
+
+ // Styles-Record lesen
+ if ( !rStream.GetError() )
+ {
+ SfxMultiRecordReader aStylesRec( &rStream, SFX_STYLES_REC_STYLES );
+ if ( !aStylesRec.IsValid() )
+ return FALSE;
+
+ USHORT nCount;
+ for ( nCount = 0; aStylesRec.GetContent(); nCount++ )
+ {
+ // kann nicht mehr weiterlesen?
+ if ( rStream.GetError() )
+ break;
+
+ // Globale Teile
+ XubString aName, aParent, aFollow;
+ String aHelpFile;
+ USHORT nFamily, nMask,nCount;
+ ULONG nHelpId;
+ rStream.ReadByteString(aName, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aParent, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aFollow, rtl_TextEncoding(nCharSet));
+ rStream >> nFamily >> nMask;
+ SfxPoolItem::readByteString(rStream, aHelpFile);
+ rStream >> nHelpId;
+
+#ifndef ENABLEUNICODE
+ // bei Unicode keine Konvertierung erforderlich
+ aName.Convert( (CharSet) nCharSet );
+ aParent.Convert( (CharSet) nCharSet );
+ aFollow.Convert( (CharSet) nCharSet );
+
+ // #72939# When loading from a different CharSet, several style
+ // names may have been converted to the same string, so the styles
+ // can't be inserted. If a style with this name already exists,
+ // generate an internal name so the information from the styles
+ // isn't lost.
+ if ( nCharSet != ::GetSystemCharSet() &&
+ Find( aName, (SfxStyleFamily)nFamily ) != NULL )
+ {
+ DBG_WARNING("style has to be renamed");
+ USHORT nMax = aStyles.Count() + 1;
+ for ( USHORT nAdd=1; nAdd<=nMax; nAdd++ )
+ {
+ aName = '_';
+ aName += nAdd;
+ if ( Find( aName, (SfxStyleFamily)nFamily ) == NULL )
+ break;
+ }
+ }
+#endif
+ SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nMask);
+ rSheet.SetHelpId( aHelpFile, nHelpId );
+ // Hier erst einmal Parent und Follow zwischenspeichern
+ rSheet.aParent = aParent;
+ rSheet.aFollow = aFollow;
+ UINT32 nPos = rStream.Tell();
+ rStream >> nCount;
+ if(nCount)
+ {
+ rStream.Seek( nPos );
+ // Das Laden des ItemSets bedient sich der Methode GetItemSet(),
+ // damit eigene ItemSets untergeschoben werden koennen
+ SfxItemSet& rSet = rSheet.GetItemSet();
+ rSet.ClearItem();
+ //! SfxItemSet aTmpSet( *pTmpPool );
+ /*!aTmpSet*/ rSet.Load( rStream );
+ //! rSet.Put( aTmpSet );
+ }
+ // Lokale Teile
+ UINT32 nSize;
+ USHORT nVer;
+ rStream >> nVer >> nSize;
+ nPos = rStream.Tell() + nSize;
+ rSheet.Load( rStream, nVer );
+ rStream.Seek( nPos );
+ }
+
+ // #72939# only loop through the styles that were really inserted
+ nCount = aStyles.Count();
+
+ //! delete pTmpPool;
+ // Jetzt Parent und Follow setzen. Alle Sheets sind geladen.
+ // Mit Setxxx() noch einmal den String eintragen, da diese
+ // virtuellen Methoden evtl. ueberlagert sind.
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ SfxStyleSheetBase* p = aStyles.GetObject( i );
+ XubString aText = p->aParent;
+ p->aParent.Erase();
+ p->SetParent( aText );
+ aText = p->aFollow;
+ p->aFollow.Erase();
+ p->SetFollow( aText );
+ }
+ }
+
+ // alles klar?
+ return BOOL( rStream.GetError() == SVSTREAM_OK );
+}
+
+BOOL SfxStyleSheetBasePool::Load1_Impl( SvStream& rStream )
+{
+ aAppName = rPool.GetName();
+ USHORT nVersion;
+ short nCharSet;
+ rStream >> nVersion;
+
+ if(nVersion!=STYLESTREAM_VERSION)
+ nCharSet=nVersion;
+ else
+ rStream >> nCharSet;
+
+ USHORT nCount;
+ rStream >> nCount;
+ USHORT i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ // kann nicht mehr weiterlesen?
+ if ( rStream.GetError() )
+ {
+ nCount = i;
+ break;
+ }
+
+ // Globale Teile
+ XubString aName, aParent, aFollow;
+ String aHelpFile;
+ USHORT nFamily, nMask,nCount;
+ ULONG nHelpId;
+ rStream.ReadByteString(aName, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aParent, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aFollow, rtl_TextEncoding(nCharSet));
+ rStream >> nFamily >> nMask;
+ SfxPoolItem::readByteString(rStream, aHelpFile);
+ if(nVersion!=STYLESTREAM_VERSION)
+ {
+ USHORT nTmpHelpId;
+ rStream >> nTmpHelpId;
+ nHelpId=nTmpHelpId;
+ }
+ else
+ rStream >> nHelpId;
+
+#ifndef ENABLEUNICODE
+ // bei Unicode keine Konvertierung erforderlich
+ aName.Convert( (CharSet) nCharSet );
+ aParent.Convert( (CharSet) nCharSet );
+ aFollow.Convert( (CharSet) nCharSet );
+#endif
+ SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nMask);
+ rSheet.SetHelpId( aHelpFile, nHelpId );
+ // Hier erst einmal Parent und Follow zwischenspeichern
+ rSheet.aParent = aParent;
+ rSheet.aFollow = aFollow;
+ UINT32 nPos = rStream.Tell();
+ rStream >> nCount;
+ if(nCount) {
+ rStream.Seek( nPos );
+ // Das Laden des ItemSets bedient sich der Methode GetItemSet(),
+ // damit eigene ItemSets untergeschoben werden koennen
+ SfxItemSet& rSet = rSheet.GetItemSet();
+ rSet.ClearItem();
+//! SfxItemSet aTmpSet( *pTmpPool );
+ /*!aTmpSet*/ rSet.Load( rStream );
+ //! rSet.Put( aTmpSet );
+ }
+ // Lokale Teile
+ UINT32 nSize;
+ USHORT nVer;
+ rStream >> nVer >> nSize;
+ nPos = rStream.Tell() + nSize;
+ rSheet.Load( rStream, nVer );
+ rStream.Seek( nPos );
+ }
+
+ //! delete pTmpPool;
+ // Jetzt Parent und Follow setzen. Alle Sheets sind geladen.
+ // Mit Setxxx() noch einmal den String eintragen, da diese
+ // virtuellen Methoden evtl. ueberlagert sind.
+ for ( i = 0; i < nCount; i++ )
+ {
+ SfxStyleSheetBase* p = aStyles.GetObject( i );
+ XubString aText = p->aParent;
+ p->aParent.Erase();
+ p->SetParent( aText );
+ aText = p->aFollow;
+ p->aFollow.Erase();
+ p->SetFollow( aText );
+ }
+ return BOOL( rStream.GetError() == SVSTREAM_OK );
+}
+
+BOOL SfxStyleSheetBasePool::Store( SvStream& rStream, BOOL bUsed )
+{
+ // den ganzen StyleSheet-Pool in einen Mini-Record
+ SfxMiniRecordWriter aPoolRec( &rStream, SFX_STYLES_REC );
+
+ // Erst einmal die Dummies rauszaehlen; die werden nicht gespeichert
+ USHORT nCount = 0;
+ for( SfxStyleSheetBase* p = First(); p; p = Next() )
+ {
+ if(!bUsed || p->IsUsed())
+ nCount++;
+ }
+
+ // einen Header-Record vorweg
+ rtl_TextEncoding eCharSet
+ = ::GetStoreCharSet( rStream.GetStreamCharSet() );
+ {
+ SfxSingleRecordWriter aHeaderRec( &rStream,
+ SFX_STYLES_REC_HEADER,
+ STYLESTREAM_VERSION );
+ rStream << (short) eCharSet;
+ }
+
+ // die StyleSheets in einen MultiVarRecord
+ {
+ SfxMultiVarRecordWriter aStylesRec( &rStream, SFX_STYLES_REC_STYLES, 0 );
+ for( SfxStyleSheetBase* p = First(); p; p = Next() )
+ {
+ if(!bUsed || p->IsUsed())
+ {
+ aStylesRec.NewContent();
+
+ // Globale Teile speichern
+ String aHelpFile;
+ ULONG nHelpId = p->GetHelpId( aHelpFile );
+ rStream.WriteByteString(p->GetName(), eCharSet);
+ rStream.WriteByteString(p->GetParent(), eCharSet);
+ rStream.WriteByteString(p->GetFollow(), eCharSet);
+ rStream << (USHORT)p->GetFamily() << p->GetMask();
+ SfxPoolItem::writeByteString(rStream, aHelpFile);
+ rStream << nHelpId;
+ if(p->pSet)
+ p->pSet->Store( rStream );
+ else
+ rStream << (USHORT)0;
+
+ // Lokale Teile speichern
+ // Vor dem lokalen Teil wird die Laenge der lokalen Daten
+ // als UINT32 sowie die Versionsnummer gespeichert.
+ rStream << (USHORT) p->GetVersion();
+ ULONG nPos1 = rStream.Tell();
+ rStream << (UINT32) 0;
+ p->Store( rStream );
+ ULONG nPos2 = rStream.Tell();
+ rStream.Seek( nPos1 );
+ rStream << (UINT32) ( nPos2 - nPos1 - sizeof( UINT32 ) );
+ rStream.Seek( nPos2 );
+ if( rStream.GetError() != SVSTREAM_OK )
+ break;
+ }
+ }
+ }
+
+ return BOOL( rStream.GetError() == SVSTREAM_OK );
+}
+
+SfxItemPool& SfxStyleSheetBasePool::GetPool()
+{
+ return rPool;
+}
+
+const SfxItemPool& SfxStyleSheetBasePool::GetPool() const
+{
+ return rPool;
+}
+
+/////////////////////// SfxStyleSheet /////////////////////////////////
+
+SfxStyleSheet::SfxStyleSheet(const XubString &rName,
+ SfxStyleSheetBasePool& rPool,
+ SfxStyleFamily eFam,
+ USHORT mask ):
+ SfxStyleSheetBase(rName, rPool, eFam, mask)
+{}
+
+SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) :
+ SfxStyleSheetBase(rStyle)
+{}
+
+SfxStyleSheet::~SfxStyleSheet()
+{
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_INDESTRUCTION, *this ) );
+}
+
+
+BOOL SfxStyleSheet::SetParent( const XubString& rName )
+{
+ if(aParent == rName)
+ return TRUE;
+ const XubString aOldParent(aParent);
+ if(SfxStyleSheetBase::SetParent(rName)) {
+ // aus der Benachrichtigungskette des alten
+ // Parents gfs. austragen
+ if(aOldParent.Len()) {
+ SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aOldParent, nFamily, 0xffff);
+ if(pParent)
+ EndListening(*pParent);
+ }
+ // in die Benachrichtigungskette des neuen
+ // Parents eintragen
+ if(aParent.Len()) {
+ SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aParent, nFamily, 0xffff);
+ if(pParent)
+ StartListening(*pParent);
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+// alle Zuhoerer benachtichtigen
+
+void SfxStyleSheet::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType )
+{
+ SFX_FORWARD(rBC, rBCType, rHint, rHintType);
+}
+
+//////////////////////// SfxStyleSheetPool ///////////////////////////////
+
+SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool& rSet):
+ SfxStyleSheetBasePool(rSet)
+{}
+
+/////////////////////////////////// Factory ////////////////////////////////
+
+SfxStyleSheetBase* SfxStyleSheetPool::Create( const XubString& rName,
+ SfxStyleFamily eFam, USHORT mask )
+{
+ return new SfxStyleSheet( rName, *this, eFam, mask );
+}
+
+SfxStyleSheetBase* SfxStyleSheetPool::Create( const SfxStyleSheet& r )
+{
+ return new SfxStyleSheet( r );
+}
+/*
+BOOL SfxStyleSheetPool::CopyTo(SfxStyleSheetPool &, const String &)
+{
+ return FALSE;
+}
+*/
+
diff --git a/svtools/source/items/szitem.cxx b/svtools/source/items/szitem.cxx
new file mode 100644
index 000000000000..c4c8127fcb68
--- /dev/null
+++ b/svtools/source/items/szitem.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: szitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
+#include <com/sun/star/awt/Size.hpp>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _GEN_HXX //autogen
+#include <tools/gen.hxx>
+#endif
+
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "szitem.hxx"
+#include "memberid.hrc"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxSizeItem);
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SfxSizeItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+SfxSizeItem::SfxSizeItem()
+{
+ DBG_CTOR(SfxSizeItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxSizeItem::SfxSizeItem( USHORT nW, const Size& rVal ) :
+ SfxPoolItem( nW ),
+ aVal( rVal )
+{
+ DBG_CTOR(SfxSizeItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxSizeItem::SfxSizeItem( USHORT nW, SvStream &rStream ) :
+ SfxPoolItem( nW )
+{
+ DBG_CTOR(SfxSizeItem, 0);
+ rStream >> aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxSizeItem::SfxSizeItem( const SfxSizeItem& rItem ) :
+ SfxPoolItem( rItem ),
+ aVal( rItem.aVal )
+{
+ DBG_CTOR(SfxSizeItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxSizeItem::GetPresentation
+(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString& rText,
+ const International *
+) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ rText = UniString::CreateFromInt32(aVal.Width());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ rText += UniString::CreateFromInt32(aVal.Height());
+ rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+int SfxSizeItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ((SfxSizeItem&)rItem).aVal == aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxSizeItem::Clone(SfxItemPool *) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ return new SfxSizeItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxSizeItem::Create(SvStream &rStream, USHORT nVersion ) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ Size aStr;
+ rStream >> aStr;
+ return new SfxSizeItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxSizeItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxSizeItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ Size aTmp(aVal);
+ if(CONVERT_TWIPS&nMemberId)
+ {
+ aTmp.Height() = ( aTmp.Height() * 127 + 36) / 72;
+ aTmp.Width() = ( aTmp.Width() * 127 + 36) / 72;
+ }
+ rVal <<= com::sun::star::awt::Size( aTmp.getWidth(), aTmp.getHeight() );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxSizeItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Size aValue;
+ if ( rVal >>= aValue )
+ {
+ Size aTmp( aValue.Width, aValue.Height );
+ if(CONVERT_TWIPS&nMemberId)
+ {
+ aTmp.Height() = ( aTmp.Height() * 72 + 63) / 127;
+ aTmp.Width() = ( aTmp.Width() * 72 + 63) / 127;
+ }
+ aVal = aTmp;
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/wallitem.cxx b/svtools/source/items/wallitem.cxx
new file mode 100644
index 000000000000..d45e9748e950
--- /dev/null
+++ b/svtools/source/items/wallitem.cxx
@@ -0,0 +1,694 @@
+/*************************************************************************
+ *
+ * $RCSfile: wallitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * 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 _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HPP_
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CHAOS_WALLPAPER_HPP_
+#include <com/sun/star/chaos/WallPaper.hpp>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+
+#ifndef _URLOBJ_HXX //autogen wg. INetURLObject
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _STREAM_HXX //autogen wg. SvMemoryStream
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+
+#include <vcl/graph.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#ifndef _SV_GRADIENT_HXX
+#include <vcl/gradient.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX //autogen wg. GraphicConverter
+#include <vcl/cvtgrf.hxx>
+#endif
+
+#include "wallitem.hxx"
+#include "cntwall.hxx"
+
+#define WALLITEMFLAG_ERROR 0x0001
+#define WALLITEMFLAG_DITHERED 0x0002
+
+
+DBG_NAME( SfxWallpaperItem );
+TYPEINIT1( SfxWallpaperItem, SfxPoolItem );
+
+// -----------------------------------------------------------------------
+
+class WallpaperSink_Impl: public cppu::OWeakObject,
+ public com::sun::star::io::XOutputStream
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource > _aSource;
+ SvMemoryStream *_pStream;
+ WallpaperLoader *_pWallpaper;
+
+public:
+
+ WallpaperSink_Impl();
+ virtual ~WallpaperSink_Impl();
+
+ void RequestData( WallpaperLoader *pWallpaper, const String& rURL );
+ void Release();
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type& aType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ acquire()
+ throw(::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ release()
+ throw(::com::sun::star::uno::RuntimeException );
+
+ // XOutputStream
+ virtual void SAL_CALL
+ writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ flush()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ closeOutput()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+};
+
+// -----------------------------------------------------------------------
+
+//static
+void SfxBrushItemLink::Set( SfxBrushItemLink* pLink )
+{
+ SfxBrushItemLink** ppLink = (SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM);
+ if( !*ppLink )
+ *ppLink = pLink;
+ else
+ delete pLink;
+}
+
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::SfxWallpaperItem( USHORT nWhich ) :
+ SfxPoolItem( nWhich ), _nFlags(0)
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+}
+
+SfxWallpaperItem::SfxWallpaperItem( USHORT nWhich, SvStream& rStream, USHORT nVersion )
+ : SfxPoolItem( nWhich )
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+ _nFlags = 0;
+ rStream >> _aWallpaper;
+ readByteString(rStream, _aURL);
+ readByteString(rStream, _aFilter);
+}
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::SfxWallpaperItem( const SfxWallpaperItem& rItem ) :
+ SfxPoolItem( rItem ),
+ _aWallpaper( rItem._aWallpaper ),
+ _aURL( rItem._aURL ),
+ _nFlags( rItem._nFlags )
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::SfxWallpaperItem( USHORT nWhich, const Wallpaper& rPaper ) :
+ SfxPoolItem( nWhich ), _nFlags(0), _aWallpaper( rPaper )
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::~SfxWallpaperItem()
+{
+ DBG_DTOR(SfxWallpaperItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+int SfxWallpaperItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_CHKTHIS( SfxWallpaperItem, 0 );
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ const SfxWallpaperItem& rWallItem = (const SfxWallpaperItem&)rItem;
+ if( rWallItem._aURL != _aURL )
+ return 0;
+ if( !_aURL.Len() )
+ {
+ if( rWallItem._aWallpaper == _aWallpaper )
+ return TRUE;
+ return 0;
+ }
+ else
+ {
+ // Wenn eine URL gesetzt ist, sind die Items auch dann gleich, wenn
+ // das eine Item bereits die Bitmap geladen hat und das andere nicht.
+ // Deshalb kann der Wallpaper-Vergleichsoperator nicht benutzt werden.
+ if( rWallItem._aWallpaper.GetColor() != _aWallpaper.GetColor() )
+ return 0;
+ if( rWallItem._aWallpaper.GetStyle() != _aWallpaper.GetStyle() )
+ return 0;
+ if( rWallItem._aWallpaper.GetGradient() != _aWallpaper.GetGradient() )
+ return 0;
+ if( rWallItem._aWallpaper.GetRect() != _aWallpaper.GetRect() )
+ return 0;
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxWallpaperItem::Create( SvStream& rStream, USHORT nVersion) const
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ return new SfxWallpaperItem( Which(), rStream, nVersion );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxWallpaperItem::Store( SvStream& rStream, USHORT ) const
+{
+ DBG_CHKTHIS( SfxWallpaperItem, 0 );
+ BitmapEx aBmpTemp;
+ if( _aURL.Len() )
+ {
+ // Bei gesetzter URL die Grafik als Link speichern, und deshalb
+ // temporaer in der Wallpaper zuruecksetzen.
+ aBmpTemp = _aWallpaper.GetBitmap();
+ ((SfxWallpaperItem*)this)->_aWallpaper.SetBitmap();
+ }
+ rStream << _aWallpaper;
+ writeByteString(rStream, _aURL);
+ writeByteString(rStream, _aFilter);
+ if( _aURL.Len() )
+ ((SfxWallpaperItem*)this)->_aWallpaper.SetBitmap( aBmpTemp );
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxWallpaperItem::Clone( SfxItemPool* ) const
+{
+ DBG_CHKTHIS( SfxWallpaperItem, 0 );
+ return new SfxWallpaperItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxWallpaperItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ com::sun::star::chaos::WallPaper aVal;
+
+ aVal.Style = (com::sun::star::chaos::WallpaperStyle)_aWallpaper.GetStyle();
+ aVal.Color = (sal_Int32) _aWallpaper.GetColor().GetColor();
+ aVal.ImageURL = GetBitmapURL();
+ rVal <<= aVal;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxWallpaperItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ com::sun::star::chaos::WallPaper aVal;
+ if ( rVal >>= aVal )
+ {
+ if ( aVal.ImageURL.getLength() )
+ SetBitmapURL( aVal.ImageURL, GetBitmapFilter() );
+
+ SetColor( aVal.Color );
+ SetStyle( (WallpaperStyle)aVal.Style );
+
+ return TRUE;
+ }
+
+ DBG_ERROR( "SfxWallpaperItem::PutValue - Wrong type!" );
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SfxWallpaperItem::SetBitmapURL( const XubString& rURL, const String& rFilter )
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ if( rURL != _aURL || rFilter != _aFilter )
+ {
+ _aURL = rURL;
+ _aFilter = rFilter;
+ _nFlags = 0;
+ _aWallpaper.SetBitmap();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const Wallpaper& SfxWallpaperItem::GetWallpaper( BOOL bNeedsBitmap ) const
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ if( bNeedsBitmap && !IsDownloaded() )
+ ((SfxWallpaperItem*)this)->Download();
+ if( !(_nFlags & WALLITEMFLAG_DITHERED ))
+ {
+ if( _aWallpaper.IsBitmap())
+ {
+ BitmapEx aBmp( _aWallpaper.GetBitmap() );
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+
+ if ( pOutDev->GetBitCount() <= 8 && aBmp.GetBitmap().GetBitCount() >= 8 )
+ {
+ aBmp.Dither( BMP_DITHER_MATRIX );
+ aBmp = BitmapEx( aBmp.GetBitmap().CreateDisplayBitmap( pOutDev ), aBmp.GetMask() );
+ ( (SfxWallpaperItem*)this )->_aWallpaper.SetBitmap( aBmp );
+ }
+ }
+ ( (SfxWallpaperItem*)this )->_nFlags |= WALLITEMFLAG_DITHERED;
+ }
+ return _aWallpaper;
+}
+
+void SfxWallpaperItem::SetGraphic( const Graphic& rGraphic, BOOL bKeepLink )
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ BitmapEx aBmp( rGraphic.GetBitmapEx() );
+ _aWallpaper.SetBitmap( aBmp );
+ if( !bKeepLink )
+ {
+ _aURL.Erase();
+ _aFilter.Erase();
+ }
+ _nFlags &= ~( WALLITEMFLAG_ERROR | WALLITEMFLAG_DITHERED );
+}
+
+BOOL SfxWallpaperItem::IsDownloaded() const
+{
+ if( _nFlags & WALLITEMFLAG_ERROR )
+ return TRUE; // Endlos-Downloads verhindern
+ return !_aURL.Len() || _aWallpaper.IsBitmap();
+}
+
+void SfxWallpaperItem::Download()
+{
+ if( _aURL.Len() )
+ {
+ SfxBrushItemLink* pLink = SfxBrushItemLink::Get();
+ if( pLink )
+ {
+ Graphic aGraphic( pLink->GetGraphic( _aURL, _aFilter ) );
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ BitmapEx aBmp( aGraphic.GetBitmapEx() );
+ _aWallpaper.SetBitmap( aBmp );
+ _nFlags &= ~WALLITEMFLAG_ERROR;
+ }
+ else
+ _nFlags |= WALLITEMFLAG_ERROR;
+ }
+ }
+ _nFlags &= ~WALLITEMFLAG_DITHERED;
+}
+
+//============================================================================
+class WallpaperLoader_Impl
+{
+public:
+
+ Link _aDoneLink;
+ SfxWallpaperItem _aWallpaper;
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > _xOutputStream;
+ WallpaperSink_Impl* _pWallpaperSink;
+ BOOL _bDone;
+
+ WallpaperLoader_Impl( const SfxWallpaperItem& rItem );
+};
+
+WallpaperLoader_Impl::WallpaperLoader_Impl( const SfxWallpaperItem& rWallpaper )
+ : _aWallpaper( rWallpaper )
+{
+ _pWallpaperSink = NULL;
+ _bDone = FALSE;
+}
+
+WallpaperLoader::WallpaperLoader( const CntWallpaperItem& rWallpaper )
+{
+ SfxWallpaperItem aSfxWallpaper( rWallpaper.Which() );
+
+ aSfxWallpaper.SetBitmapURL( rWallpaper.GetBitmapURL(), String() );
+ aSfxWallpaper.SetColor( rWallpaper.GetColor() );
+ aSfxWallpaper.SetStyle( (WallpaperStyle) rWallpaper.GetStyle() );
+
+ pImp = new WallpaperLoader_Impl( aSfxWallpaper );
+}
+
+WallpaperLoader::~WallpaperLoader()
+{
+ if ( !pImp->_bDone && pImp->_pWallpaperSink )
+ {
+ pImp->_pWallpaperSink->Release();
+ pImp->_pWallpaperSink = NULL;
+ }
+ delete pImp;
+}
+
+void WallpaperLoader::RequestData( const Link& rDoneLink )
+{
+ WallpaperLoaderRef aRef( this );
+
+ pImp->_aDoneLink = rDoneLink;
+
+ if ( pImp->_aWallpaper.GetBitmapURL().Len() )
+ {
+ WallpaperSink_Impl *pStream = new WallpaperSink_Impl();
+ pImp->_xOutputStream = pStream;
+ pImp->_pWallpaperSink = pStream;
+ pStream->RequestData( this, pImp->_aWallpaper.GetBitmapURL() );
+ }
+ else
+ Done();
+}
+
+const Wallpaper& WallpaperLoader::GetWallpaper() const
+{
+ return pImp->_aWallpaper.GetWallpaper();
+}
+
+void WallpaperLoader::Done()
+{
+ WallpaperLoaderRef aRef( this );
+
+ pImp->_bDone = TRUE;
+
+ if ( pImp->_aDoneLink.IsSet() )
+ pImp->_aDoneLink.Call( this );
+}
+
+void WallpaperLoader::SetBitmap( SvStream *pStream )
+{
+ WallpaperLoaderRef aRef( this );
+
+ if( pStream && ! pStream->GetError() )
+ {
+ pStream->Seek( STREAM_SEEK_TO_BEGIN );
+ Graphic aGraphic;
+ GraphicConverter::Import( *pStream, aGraphic );
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ pImp->_aWallpaper.SetGraphic( aGraphic, TRUE );
+ }
+ }
+
+ Done();
+}
+
+
+//============================================================================
+
+WallpaperSink_Impl::WallpaperSink_Impl()
+{
+ _pStream = NULL;
+ _pWallpaper = NULL;
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+WallpaperSink_Impl::~WallpaperSink_Impl()
+{
+ delete _pStream;
+}
+
+//--------------------------------------------------------------------------------------------------
+void WallpaperSink_Impl::RequestData( WallpaperLoader *pWallpaper,
+ const String& rURL )
+{
+ _pWallpaper = pWallpaper;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > xMgr(
+ utl::getProcessServiceFactory() );
+ if ( !xMgr.is() )
+ return;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > xFact(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.frame.DataSourceFactory" ) ),
+ com::sun::star::uno::UNO_QUERY );
+ if ( xFact.is() )
+ {
+ INetURLObject aURL( rURL );
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs( 1 );
+ aArgs.getArray()[ 0 ] <<= rtl::OUString( aURL.GetMainURL() );
+
+ String aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
+ _aSource = com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource >(
+ xFact->createInstanceWithArguments(
+ aProt, aArgs ),
+ com::sun::star::uno::UNO_QUERY );
+ if ( _aSource.is() )
+ {
+ _aSource->setOutputStream( this );
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataControl > aControl(
+ _aSource, com::sun::star::uno::UNO_QUERY );
+ if ( aControl.is() )
+ aControl->start();
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+void WallpaperSink_Impl::Release()
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > aRef( this );
+
+ _pWallpaper = NULL;
+
+ if ( _aSource.is() )
+ {
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataControl > aControl(
+ _aSource, com::sun::star::uno::UNO_QUERY );
+ if ( aControl.is() )
+ aControl->terminate();
+
+ _aSource = com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource >();
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+com::sun::star::uno::Any SAL_CALL WallpaperSink_Impl::
+ queryInterface( const com::sun::star::uno::Type& aType )
+ throw( com::sun::star::uno::RuntimeException )
+{
+ com::sun::star::uno::Any aRet
+ = cppu::queryInterface( aType,
+ static_cast< com::sun::star::io::XOutputStream * >( this ) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( aType );
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::acquire()
+ throw(::com::sun::star::uno::RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::release()
+ throw(::com::sun::star::uno::RuntimeException )
+{
+ OWeakObject::release();
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::writeBytes(
+ const com::sun::star::uno::Sequence< sal_Int8 >& aData )
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ if ( !_pStream )
+ _pStream = new SvMemoryStream( aData.getLength(), 4096 );
+
+ _pStream->Seek( STREAM_SEEK_TO_END );
+ _pStream->Write( aData.getConstArray(), aData.getLength() );
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::flush()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::closeOutput()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ if ( _pWallpaper )
+ _pWallpaper->SetBitmap( _pStream );
+
+ _aSource = com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource >();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/*
+ $Log: not supported by cvs2svn $
+ Revision 1.23 2000/09/18 14:13:36 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.22 2000/08/31 13:41:29 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.21 2000/06/30 11:35:56 pb
+ chg: GetAppWindow() replaced
+
+ Revision 1.20 2000/04/12 08:01:40 sb
+ Adapted to Unicode.
+
+ Revision 1.19 2000/03/22 11:49:38 kso
+ Removed: SmartUno leftovers.
+
+ Revision 1.18 2000/03/21 11:37:55 kso
+ Added: [Put|QueryValue( ... com::sun::star::uno::Any ... )
+
+ Revision 1.17 2000/02/09 16:24:16 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.16 2000/01/28 11:23:43 dv
+ #70466# Changed service name
+
+ Revision 1.15 1999/11/19 17:12:36 sb
+ Module structure transposition.
+
+ Revision 1.14 1999/10/26 12:46:30 dv
+ Don't use GetGlobalServiceMgr() any longer
+
+ Revision 1.13 1999/08/23 13:30:58 dv
+ The CntWallpaperItem now uses the class Color
+
+ Revision 1.12 1999/08/18 14:14:21 dv
+ added: include cntwall.hxx
+
+ Revision 1.11 1999/08/18 09:12:51 dv
+ #66082# The WallpaperLoader is now constructed with a CntWallpaperItem
+
+*/
+