summaryrefslogtreecommitdiff
path: root/svtools/source/items
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/items')
-rw-r--r--svtools/source/items/aeitem.cxx317
-rw-r--r--svtools/source/items/eitem.cxx50
-rw-r--r--svtools/source/items/flagitem.cxx166
-rw-r--r--svtools/source/items/globalnameitem.cxx117
-rw-r--r--svtools/source/items/imageitm.cxx148
-rw-r--r--svtools/source/items/intitem.cxx261
-rw-r--r--svtools/source/items/itemdel.cxx138
-rw-r--r--svtools/source/items/macitem.cxx298
-rw-r--r--svtools/source/items/makefile.mk65
-rw-r--r--svtools/source/items/poolcach.cxx159
-rw-r--r--svtools/source/items/ptitem.cxx208
-rw-r--r--svtools/source/items/rectitem.cxx204
-rw-r--r--svtools/source/items/rngitem.cxx57
-rwxr-xr-xsvtools/source/items/rngitem_inc.cxx243
-rw-r--r--svtools/source/items/stritem.cxx75
-rw-r--r--svtools/source/items/style.cxx1381
-rw-r--r--svtools/source/items/szitem.cxx214
-rw-r--r--svtools/source/items/wallitem.cxx68
18 files changed, 4169 insertions, 0 deletions
diff --git a/svtools/source/items/aeitem.cxx b/svtools/source/items/aeitem.cxx
new file mode 100644
index 000000000000..63fbd1db6227
--- /dev/null
+++ b/svtools/source/items/aeitem.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: aeitem.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#ifndef GCC
+#endif
+
+#include <tools/string.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svtools/svstdarr.hxx>
+#include <svtools/svarray.hxx>
+#include <svtools/aeitem.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxAllEnumItem)
+
+TYPEINIT1_AUTOFACTORY(SfxAllEnumItem, SfxEnumItem)
+
+// -----------------------------------------------------------------------
+
+struct SfxAllEnumValue_Impl
+{
+ USHORT nValue;
+ XubString aText;
+};
+
+SV_DECL_PTRARR_DEL(SfxAllEnumValueArr, SfxAllEnumValue_Impl*, 0, 8)
+SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*)
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem() :
+ SfxEnumItem(),
+ pValues( 0 ),
+ pDisabledValues( 0 )
+{
+}
+
+SfxAllEnumItem::SfxAllEnumItem( USHORT which, USHORT nVal, const XubString &rText ):
+ SfxEnumItem(which, nVal),
+ pValues( 0 ),
+ pDisabledValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( nVal, rText );
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem(USHORT which, USHORT nVal):
+ SfxEnumItem(which, nVal),
+ pValues( 0 ),
+ pDisabledValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( nVal );
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem( USHORT which, SvStream &rStream ):
+ SfxEnumItem(which, rStream),
+ pValues( 0 ),
+ pDisabledValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( GetValue() );
+}
+
+// -----------------------------------------------------------------------
+
+
+SfxAllEnumItem::SfxAllEnumItem(USHORT which):
+ SfxEnumItem(which, 0),
+ pValues( 0 ),
+ pDisabledValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+}
+
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy):
+ SfxEnumItem(rCopy),
+ pValues(0),
+ pDisabledValues( 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 );
+ }
+
+ if( rCopy.pDisabledValues )
+ {
+ pDisabledValues = new SvUShorts;
+ for ( USHORT nPos = 0; nPos < rCopy.pDisabledValues->Count(); ++nPos )
+ {
+ pDisabledValues->Insert( rCopy.pDisabledValues->GetObject(nPos),
+ nPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::~SfxAllEnumItem()
+{
+ DBG_DTOR(SfxAllEnumItem, 0);
+ delete pValues;
+ delete pDisabledValues;
+}
+
+// -----------------------------------------------------------------------
+
+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 ) 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::DisableValue( USHORT nValue )
+{
+ DBG_CHKTHIS(SfxAllEnumItem, 0);
+ if ( !pDisabledValues )
+ pDisabledValues = new SvUShorts;
+
+ pDisabledValues->Insert( nValue, pDisabledValues->Count() );
+}
+
+BOOL SfxAllEnumItem::IsEnabled( USHORT nValue ) const
+{
+ if ( pDisabledValues )
+ {
+ for ( USHORT i=0; i<pDisabledValues->Count(); i++ )
+ if ( (*pDisabledValues)[i] == nValue )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+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..f7b95665391d
--- /dev/null
+++ b/svtools/source/items/eitem.cxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: eitem.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#include <svtools/eitem.hxx>
+//============================================================================
+//
+// 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..e59f981c5afa
--- /dev/null
+++ b/svtools/source/items/flagitem.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: flagitem.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/flagitem.hxx>
+#include <svtools/poolitem.hxx>
+#include <tools/stream.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) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ rStream << nVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxFlagItem::GetPresentation
+(
+ SfxItemPresentation /*ePresentation*/,
+ SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresentationMetric*/,
+ XubString& rText,
+ const IntlWrapper *
+) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ rText.Erase();
+ for ( BYTE nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
+ rText += XubString::CreateFromInt32( GetFlag(nFlag) );
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SfxFlagItem::GetFlagText( BYTE ) 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 &, USHORT) 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/globalnameitem.cxx b/svtools/source/items/globalnameitem.cxx
new file mode 100644
index 000000000000..6a8359fb39b8
--- /dev/null
+++ b/svtools/source/items/globalnameitem.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: globalnameitem.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/script/XTypeConverter.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include <svtools/globalnameitem.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SfxGlobalNameItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+SfxGlobalNameItem::SfxGlobalNameItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxGlobalNameItem::SfxGlobalNameItem( USHORT nW, const SvGlobalName& rName )
+: SfxPoolItem( nW ),
+ m_aName( rName )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxGlobalNameItem::~SfxGlobalNameItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+int SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return ((SfxGlobalNameItem&)rItem).m_aName == m_aName;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const
+{
+ return new SfxGlobalNameItem( *this );
+}
+
+//----------------------------------------------------------------------------
+// virtual
+BOOL SfxGlobalNameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
+{
+ com::sun::star::uno::Reference < com::sun::star::script::XTypeConverter > xConverter
+ ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
+ com::sun::star::uno::UNO_QUERY );
+ com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+ com::sun::star::uno::Any aNew;
+
+ try { aNew = xConverter->convertTo( rVal, ::getCppuType((const com::sun::star::uno::Sequence < sal_Int8 >*)0) ); }
+ catch (com::sun::star::uno::Exception&) {}
+ aNew >>= aSeq;
+ if ( aSeq.getLength() == 16 )
+ {
+ m_aName.MakeFromMemory( (void*) aSeq.getConstArray() );
+ return TRUE;
+ }
+
+ DBG_ERROR( "SfxGlobalNameItem::PutValue - Wrong type!" );
+ return FALSE;
+}
+
+//----------------------------------------------------------------------------
+// virtual
+BOOL SfxGlobalNameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
+{
+ com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ void* pData = ( void* ) &m_aName.GetCLSID();
+ memcpy( aSeq.getArray(), pData, 16 );
+ rVal <<= aSeq;
+ return TRUE;
+}
+
diff --git a/svtools/source/items/imageitm.cxx b/svtools/source/items/imageitm.cxx
new file mode 100644
index 000000000000..cc4a2ebd4f3b
--- /dev/null
+++ b/svtools/source/items/imageitm.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: imageitm.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/imageitm.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+TYPEINIT1( SfxImageItem, SfxInt16Item );
+
+struct SfxImageItem_Impl
+{
+ String aURL;
+ long nAngle;
+ BOOL bMirrored;
+ int operator == ( const SfxImageItem_Impl& rOther ) const
+ { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; }
+};
+
+//---------------------------------------------------------
+
+SfxImageItem::SfxImageItem( USHORT which, UINT16 nImage )
+ : SfxInt16Item( which, nImage )
+{
+ pImp = new SfxImageItem_Impl;
+ pImp->nAngle = 0;
+ pImp->bMirrored = FALSE;
+}
+
+SfxImageItem::SfxImageItem( USHORT which, const String& rURL )
+ : SfxInt16Item( which, 0 )
+{
+ pImp = new SfxImageItem_Impl;
+ pImp->nAngle = 0;
+ pImp->bMirrored = FALSE;
+ pImp->aURL = rURL;
+}
+
+SfxImageItem::SfxImageItem( const SfxImageItem& rItem )
+ : SfxInt16Item( rItem )
+{
+ pImp = new SfxImageItem_Impl( *(rItem.pImp) );
+}
+
+//---------------------------------------------------------
+SfxImageItem::~SfxImageItem()
+{
+ delete pImp;
+}
+
+//---------------------------------------------------------
+
+SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
+{
+ return new SfxImageItem( *this );
+}
+
+//---------------------------------------------------------
+
+int SfxImageItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) );
+}
+
+BOOL SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 );
+ aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() );
+ aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle );
+ aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored );
+ aSeq[3] = ::com::sun::star::uno::makeAny( rtl::OUString( pImp->aURL ));
+
+ rVal = ::com::sun::star::uno::makeAny( aSeq );
+ return TRUE;
+}
+
+BOOL SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
+ if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 ))
+ {
+ sal_Int16 nVal = sal_Int16();
+ rtl::OUString aURL;
+ if ( aSeq[0] >>= nVal )
+ SetValue( nVal );
+ aSeq[1] >>= pImp->nAngle;
+ aSeq[2] >>= pImp->bMirrored;
+ if ( aSeq[3] >>= aURL )
+ pImp->aURL = aURL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void SfxImageItem::SetRotation( long nValue )
+{
+ pImp->nAngle = nValue;
+}
+
+long SfxImageItem::GetRotation() const
+{
+ return pImp->nAngle;
+}
+
+void SfxImageItem::SetMirrored( BOOL bSet )
+{
+ pImp->bMirrored = bSet;
+}
+
+BOOL SfxImageItem::IsMirrored() const
+{
+ return pImp->bMirrored;
+}
+
+String SfxImageItem::GetURL() const
+{
+ return pImp->aURL;
+}
+
diff --git a/svtools/source/items/intitem.cxx b/svtools/source/items/intitem.cxx
new file mode 100644
index 000000000000..b20f245f964b
--- /dev/null
+++ b/svtools/source/items/intitem.cxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: intitem.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/intitem.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <tools/bigint.hxx>
+#include <tools/stream.hxx>
+#include <svtools/metitem.hxx>
+
+//============================================================================
+//
+// 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 which, SvStream & rStream):
+ SfxPoolItem(which)
+{
+ 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 IntlWrapper *) 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) const
+{
+ sal_Int16 nValue = m_nValue;
+ rVal <<= nValue;
+ return TRUE;
+}
+
+//============================================================================
+// virtual
+BOOL SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal, BYTE )
+{
+ sal_Int16 nValue = sal_Int16();
+ 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 which, UINT32 nValue):
+ SfxInt32Item(which, nValue)
+{
+ DBG_CTOR(SfxMetricItem, 0);
+}
+
+//============================================================================
+SfxMetricItem::SfxMetricItem(USHORT which, SvStream & rStream):
+ SfxInt32Item(which, 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..4028aa497c22
--- /dev/null
+++ b/svtools/source/items/itemdel.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: itemdel.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include "itemdel.hxx"
+#include <vcl/svapp.hxx>
+#include <tools/errcode.hxx>
+#include <limits.h>
+
+#include <svtools/svtdata.hxx>
+#include <svtools/svarray.hxx>
+#include <svtools/itempool.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);
+
+ DBG_ASSERT( 0 == pItem->GetRefCount(), "desrupting pooled item" );
+ pItem->SetKind( 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) );
+
+ // reset RefCount (was set to SFX_ITEMS_SPECIAL before!)
+ pItem->SetRefCount( 0 );
+ //DBG_CHKOBJ( pItem, SfxPoolItem, 0 );
+ delete pItem;
+}
+
+// ------------------------------------------------------------------------
+IMPL_LINK( SfxItemDesruptor_Impl, Delete, void *, EMPTYARG )
+{
+ {DBG_CHKTHIS(SfxItemDesruptor_Impl, 0);}
+ delete this;
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem )
+{
+ DBG_ASSERT( 0 == pItem->GetRefCount(), "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..480fb844ccc7
--- /dev/null
+++ b/svtools/source/items/macitem.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: macitem.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#include <tools/stream.hxx>
+
+#ifndef GCC
+#endif
+
+#include <svtools/macitem.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SvxMacroItem);
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxMacroItem, SfxPoolItem, new SvxMacroItem(0));
+
+// -----------------------------------------------------------------------
+
+
+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));
+ }
+ else if(eType==EXTENDED_STYPE)
+ {
+ return UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_SF));
+
+ }
+ 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;
+}
+
+
+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;
+}
+
+
+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;
+}
+
+
+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;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMacroTableDtor::DelDtor()
+{
+ SvxMacro* pTmp = First();
+ while( pTmp )
+ {
+ delete pTmp;
+ pTmp = Next();
+ }
+ Clear();
+}
+
+// -----------------------------------------------------------------------
+
+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;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const
+{
+ return new SvxMacroItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxMacroItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper *
+) 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;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxMacroItem::Store( SvStream& rStrm , USHORT ) const
+{
+ return aMacroTable.Write( rStrm );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, USHORT nVersion ) const
+{
+ SvxMacroItem* pAttr = new SvxMacroItem( Which() );
+ pAttr->aMacroTable.Read( rStrm, nVersion );
+ return pAttr;
+}
+
+// -----------------------------------------------------------------------
+
+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 ) );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SvxMacroItem::GetVersion( USHORT nFileFormatVersion ) const
+{
+ return SOFFICE_FILEFORMAT_31 == nFileFormatVersion
+ ? 0 : aMacroTable.GetVersion();
+}
+
diff --git a/svtools/source/items/makefile.mk b/svtools/source/items/makefile.mk
new file mode 100644
index 000000000000..651e54bb7e23
--- /dev/null
+++ b/svtools/source/items/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.13 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=svtools
+TARGET=items
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/svt.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/aeitem.obj \
+ $(SLO)$/eitem.obj \
+ $(SLO)$/flagitem.obj \
+ $(SLO)$/globalnameitem.obj \
+ $(SLO)$/imageitm.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
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/items/poolcach.cxx b/svtools/source/items/poolcach.cxx
new file mode 100644
index 000000000000..2c758a7e25fa
--- /dev/null
+++ b/svtools/source/items/poolcach.cxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: poolcach.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <limits.h>
+
+#ifndef GCC
+#endif
+
+#include <svtools/itempool.hxx>
+#include <svtools/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),
+ pSetToPut( 0 ),
+ pItemToPut( &pItemPool->Put(*pPutItem) )
+{
+ DBG_CTOR(SfxItemPoolCache, 0);
+ DBG_ASSERT(pItemPool, "kein Pool angegeben");
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
+ const SfxItemSet *pPutSet ):
+ pPool(pItemPool),
+ pCache(new SfxItemModifyArr_Impl),
+ pSetToPut( pPutSet ),
+ pItemToPut( 0 )
+{
+ 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..ac1e94fd1727
--- /dev/null
+++ b/svtools/source/items/ptitem.cxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ptitem.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/ptitem.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <tools/stream.hxx>
+
+#include <svtools/poolitem.hxx>
+#include "memberid.hrc"
+
+using namespace ::com::sun::star;
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxPointItem)
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+
+// -----------------------------------------------------------------------
+
+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 IntlWrapper *
+) 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 ) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ Point aStr;
+ rStream >> aStr;
+ return new SfxPointItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxPointItem::Store(SvStream &rStream, USHORT ) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxPointItem::QueryValue( uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ awt::Point aTmp(aVal.X(), aVal.Y());
+ if( bConvert )
+ {
+ aTmp.X = TWIP_TO_MM100(aTmp.X);
+ aTmp.Y = TWIP_TO_MM100(aTmp.Y);
+ }
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0: rVal <<= aTmp; break;
+ case MID_X: rVal <<= aTmp.X; break;
+ case MID_Y: rVal <<= aTmp.Y; break;
+ default: DBG_ERROR("Wrong MemberId!"); return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxPointItem::PutValue( const uno::Any& rVal,
+ BYTE nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ BOOL bRet = FALSE;
+ awt::Point aValue;
+ sal_Int32 nVal = 0;
+ if ( !nMemberId )
+ {
+ bRet = ( rVal >>= aValue );
+ if( bConvert )
+ {
+ aValue.X = MM100_TO_TWIP(aValue.X);
+ aValue.Y = MM100_TO_TWIP(aValue.Y);
+ }
+ }
+ else
+ {
+ bRet = ( rVal >>= nVal );
+ if( bConvert )
+ nVal = MM100_TO_TWIP( nVal );
+ }
+
+ if ( bRet )
+ {
+ switch ( nMemberId )
+ {
+ case 0: aVal.setX( aValue.X ); aVal.setY( aValue.Y ); break;
+ case MID_X: aVal.setX( nVal ); break;
+ case MID_Y: aVal.setY( nVal ); break;
+ default: DBG_ERROR("Wrong MemberId!"); return FALSE;
+ }
+ }
+
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/rectitem.cxx b/svtools/source/items/rectitem.cxx
new file mode 100644
index 000000000000..f9faeeeaa824
--- /dev/null
+++ b/svtools/source/items/rectitem.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: rectitem.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/rectitem.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <tools/stream.hxx>
+
+#include <svtools/poolitem.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 IntlWrapper *
+) 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 ) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ Rectangle aStr;
+ rStream >> aStr;
+ return new SfxRectangleItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxRectangleItem::Store(SvStream &rStream, USHORT ) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+
+// -----------------------------------------------------------------------
+BOOL SfxRectangleItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ rVal <<= com::sun::star::awt::Rectangle( aVal.getX(),
+ aVal.getY(),
+ aVal.getWidth(),
+ aVal.getHeight() );
+ break;
+ }
+ case MID_RECT_LEFT: rVal <<= aVal.getX(); break;
+ case MID_RECT_RIGHT: rVal <<= aVal.getY(); break;
+ case MID_WIDTH: rVal <<= aVal.getWidth(); break;
+ case MID_HEIGHT: rVal <<= aVal.getHeight(); break;
+ default: DBG_ERROR("Wrong MemberID!"); return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxRectangleItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ nMemberId &= ~CONVERT_TWIPS;
+ com::sun::star::awt::Rectangle aValue;
+ sal_Int32 nVal = 0;
+ if ( !nMemberId )
+ bRet = (rVal >>= aValue);
+ else
+ bRet = (rVal >>= nVal);
+
+ if ( bRet )
+ {
+ switch ( nMemberId )
+ {
+ case 0:
+ aVal.setX( aValue.X );
+ aVal.setY( aValue.Y );
+ aVal.setWidth( aValue.Width );
+ aVal.setHeight( aValue.Height );
+ break;
+ case MID_RECT_LEFT: aVal.setX( nVal ); break;
+ case MID_RECT_RIGHT: aVal.setY( nVal ); break;
+ case MID_WIDTH: aVal.setWidth( nVal ); break;
+ case MID_HEIGHT: aVal.setHeight( nVal ); break;
+ default: DBG_ERROR("Wrong MemberID!"); return FALSE;
+ }
+ }
+
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/rngitem.cxx b/svtools/source/items/rngitem.cxx
new file mode 100644
index 000000000000..0c62de7229f4
--- /dev/null
+++ b/svtools/source/items/rngitem.cxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: rngitem.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#include <tools/stream.hxx>
+
+#ifndef NUMTYPE
+
+#define NUMTYPE USHORT
+#define SfxXRangeItem SfxRangeItem
+#define SfxXRangesItem SfxUShortRangesItem
+#include <svtools/rngitem.hxx>
+#include "rngitem_inc.cxx"
+
+#define NUMTYPE sal_uInt32
+#define SfxXRangeItem SfxULongRangeItem
+#define SfxXRangesItem SfxULongRangesItem
+#include <svtools/rngitem.hxx>
+#include "rngitem_inc.cxx"
+
+#else
+
+// We leave this condition just in case NUMTYPE has been defined externally to this
+// file and we are supposed to define the SfxXRangeItem based on that.
+
+#include "rngitem_inc.cxx"
+
+#endif
+
diff --git a/svtools/source/items/rngitem_inc.cxx b/svtools/source/items/rngitem_inc.cxx
new file mode 100755
index 000000000000..d8cc7ed185ae
--- /dev/null
+++ b/svtools/source/items/rngitem_inc.cxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: rngitem_inc.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// This snippet of code is included by rngitem.cxx but not compiled directly.
+// Ugly hack, probably due to lack of templates in the 20th century.
+
+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 which, NUMTYPE from, NUMTYPE to ):
+ SfxPoolItem( which ),
+ 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 IntlWrapper *
+) 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) const
+{
+ NUMTYPE nVon, nBis;
+ rStream >> nVon;
+ rStream >> nBis;
+ return new SfxXRangeItem( Which(), nVon, nBis );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxXRangeItem::Store(SvStream &rStream, USHORT) 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 IntlWrapper * ) const
+{
+ HACK(n. i.)
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//-------------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangesItem::Clone( SfxItemPool * ) const
+{
+ return new SfxXRangesItem( *this );
+}
+
+//-------------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangesItem::Create( SvStream &rStream, USHORT ) const
+{
+ return new SfxXRangesItem( Which(), rStream );
+}
+
+//-------------------------------------------------------------------------
+
+SvStream& SfxXRangesItem::Store( SvStream &rStream, USHORT ) const
+{
+ NUMTYPE nCount = Count_Impl( _pRanges );
+ rStream >> nCount;
+ for ( NUMTYPE n = 0; _pRanges[n]; ++n )
+ rStream >> _pRanges[n];
+ return rStream;
+}
+
+
+#undef NUMTYPE
+#undef SfxXRangeItem
+#undef SfxXRangesItem
diff --git a/svtools/source/items/stritem.cxx b/svtools/source/items/stritem.cxx
new file mode 100644
index 000000000000..37968dc3ee1d
--- /dev/null
+++ b/svtools/source/items/stritem.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: stritem.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#include <svtools/stritem.hxx>
+
+//============================================================================
+//
+// class SfxStringItem
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxStringItem, CntUnencodedStringItem)
+
+//============================================================================
+// virtual
+SfxStringItem::SfxStringItem(USHORT which, SvStream & rStream):
+ CntUnencodedStringItem(which)
+{
+ 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..ad11f1527ce7
--- /dev/null
+++ b/svtools/source/items/style.cxx
@@ -0,0 +1,1381 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: style.cxx,v $
+ * $Revision: 1.19.60.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#ifndef GCC
+#endif
+
+#define _SVSTDARR_STRINGS
+#define _SVSTDARR_STRINGSSORTDTOR
+#define _SVSTDARR_BYTESTRINGS
+#define _SVSTDARR_BYTESTRINGSSORTDTOR
+
+#include <rtl/uuid.h>
+#include <tools/tenccvt.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <svtools/smplhint.hxx>
+#include <svtools/poolitem.hxx>
+#include <svtools/itemset.hxx>
+#include <svtools/itempool.hxx>
+#include <poolio.hxx>
+#include <svtools/filerec.hxx>
+#include <svtools/itemiter.hxx>
+#include <svtools/style.hxx>
+#include <svtools/svstdarr.hxx>
+#include <vcl/svapp.hxx>
+
+#include <algorithm>
+
+#define STYLESTREAM "SfxStyleSheets"
+#define STYLESTREAM_VERSION USHORT(50)
+
+#ifdef DBG_UTIL
+class DbgStyleSheetReferences
+{
+public:
+ DbgStyleSheetReferences() : mnStyles(0), mnPools(0) {}
+ ~DbgStyleSheetReferences()
+ {
+ OSL_TRACE("DbgStyleSheetReferences\nSfxStyleSheetBase left %ld\nSfxStyleSheetBasePool left %ld\n", mnStyles, mnPools );
+ }
+
+ sal_uInt32 mnStyles;
+ sal_uInt32 mnPools;
+}
+aDbgStyleSheetReferences;
+
+#endif
+
+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
+)
+: SfxStyleSheetHint( nAction ),
+ aName( rOldName )
+{}
+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 )
+{}
+
+SfxStyleSheetHint::SfxStyleSheetHint
+(
+ USHORT nAction // SFX_STYLESHEET_... (s.o.)
+)
+: pStyleSh( NULL ),
+ 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 )
+ : rPool( r )
+ , nFamily( eFam )
+ , aName( rName )
+ , aParent()
+ , aFollow( rName )
+ , pSet( NULL )
+ , nMask(mask)
+ , nHelpId( 0 )
+ , bMySet( FALSE )
+{
+#ifdef DBG_UTIL
+ aDbgStyleSheetReferences.mnStyles++;
+#endif
+}
+
+SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
+ : comphelper::OWeakTypeObject()
+ , rPool( r.rPool )
+ , nFamily( r.nFamily )
+ , aName( r.aName )
+ , aParent( r.aParent )
+ , aFollow( r.aFollow )
+ , aHelpFile( r.aHelpFile )
+ , nMask( r.nMask )
+ , nHelpId( r.nHelpId )
+ , bMySet( r.bMySet )
+{
+#ifdef DBG_UTIL
+ aDbgStyleSheetReferences.mnStyles++;
+#endif
+ if( r.pSet )
+ pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet;
+ else
+ pSet = NULL;
+}
+
+static SfxStyleSheetBasePool& implGetStaticPool()
+{
+ static SfxStyleSheetBasePool* pSheetPool = 0;
+ static SfxItemPool* pBasePool = 0;
+ if( !pSheetPool )
+ {
+ UniString aName;
+ pBasePool = new SfxItemPool( aName, 0, 0, 0 );
+ pSheetPool = new SfxStyleSheetBasePool(*pBasePool);
+ }
+ return *pSheetPool;
+}
+
+SfxStyleSheetBase::SfxStyleSheetBase()
+: comphelper::OWeakTypeObject()
+, rPool( implGetStaticPool() )
+{
+}
+
+SfxStyleSheetBase::~SfxStyleSheetBase()
+{
+#ifdef DBG_UTIL
+ --aDbgStyleSheetReferences.mnStyles;
+#endif
+
+ 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;
+}
+
+rtl::OUString SfxStyleSheetBase::GetDisplayName() const
+{
+ if( maDisplayName.getLength() == 0 )
+ {
+ return aName;
+ }
+ else
+ {
+ return maDisplayName;
+ }
+}
+
+void SfxStyleSheetBase::SetDisplayName( const rtl::OUString& rDisplayName )
+{
+ maDisplayName = rDisplayName;
+}
+
+// Parent aendern
+
+const XubString& SfxStyleSheetBase::GetParent() const
+{
+ return aParent;
+}
+
+BOOL SfxStyleSheetBase::SetParent( const XubString& rName )
+{
+ if ( rName == aName )
+ return FALSE;
+
+ 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()
+{
+ return GetDescription( SFX_MAPUNIT_CM );
+}
+
+// eingestellte Attribute ausgeben
+
+XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric )
+{
+ SfxItemIter aIter( GetItemSet() );
+ XubString aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(),
+ Application::GetSettings().GetLanguage());
+ while ( pItem )
+ {
+ XubString aItemPresentation;
+
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eMetric, aItemPresentation, &aIntlWrapper ) )
+ {
+ 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;
+ 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.size();
+ else
+ for(USHORT i=0; i<pBasePool->aStyles.size(); i++)
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles[i].get();
+ if(DoesStyleMatch(pStyle))
+ n++;
+ }
+ return n;
+}
+
+SfxStyleSheetBase* SfxStyleSheetIterator::operator[](USHORT nIdx)
+{
+ if( IsTrivialSearch())
+ return pBasePool->aStyles[nIdx].get();
+
+ USHORT z = 0;
+ for(USHORT n=0; n<pBasePool->aStyles.size(); n++)
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
+ 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.size() )
+ nIdx = 0;
+ else
+ for( USHORT n = 0; n < pBasePool->aStyles.size(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
+
+ if ( DoesStyleMatch( pStyle ) )
+ {
+ nIdx = n;
+ break;
+ }
+ }
+
+ if ( nIdx != -1 )
+ {
+ nAktPosition = (USHORT)nIdx;
+ return pAktStyle = pBasePool->aStyles[nIdx].get();
+ }
+ return 0;
+}
+
+
+SfxStyleSheetBase* SfxStyleSheetIterator::Next()
+{
+ INT32 nIdx = -1;
+
+ if ( IsTrivialSearch() &&
+ (USHORT)pBasePool->aStyles.size() > nAktPosition + 1 )
+ nIdx = nAktPosition + 1;
+ else
+ for( USHORT n = nAktPosition + 1; n < pBasePool->aStyles.size(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
+
+ if ( DoesStyleMatch( pStyle ) )
+ {
+ nIdx = n;
+ break;
+ }
+ }
+
+ if ( nIdx != -1 )
+ {
+ nAktPosition = (USHORT)nIdx;
+ return pAktStyle = pBasePool->aStyles[nIdx].get();
+ }
+ return 0;
+}
+
+
+SfxStyleSheetBase* SfxStyleSheetIterator::Find(const XubString& rStr)
+{
+ for ( USHORT n = 0; n < pBasePool->aStyles.size(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
+
+ // #98454# performance: in case of bSearchUsed==TRUE it may be
+ // significant to first compare the name and only if it matches to call
+ // the style sheet IsUsed() method in DoesStyleMatch().
+ if ( pStyle->GetName().Equals( rStr ) && DoesStyleMatch( pStyle ) )
+ {
+ 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;
+ rpIter = CreateIterator( nSearchFamily, nMask );
+ }
+ return *rpIter;
+}
+
+
+SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r )
+ : aAppName(r.GetName())
+ , rPool(r)
+ , nSearchFamily(SFX_STYLE_FAMILY_PARA)
+ , nMask(0xFFFF)
+{
+#ifdef DBG_UTIL
+ aDbgStyleSheetReferences.mnPools++;
+#endif
+
+ pImp = new SfxStyleSheetBasePool_Impl;
+}
+
+SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r )
+ : SfxBroadcaster( r )
+ , comphelper::OWeakTypeObject()
+ , aAppName(r.aAppName)
+ , rPool(r.rPool)
+ , nSearchFamily(r.nSearchFamily)
+ , nMask( r.nMask )
+{
+#ifdef DBG_UTIL
+ aDbgStyleSheetReferences.mnPools++;
+#endif
+
+ pImp = new SfxStyleSheetBasePool_Impl;
+ *this += r;
+}
+
+SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
+{
+#ifdef DBG_UTIL
+ aDbgStyleSheetReferences.mnPools--;
+#endif
+
+ 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 ////////////////////////////////
+
+
+
+SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator
+(
+ SfxStyleFamily eFam,
+ USHORT mask
+)
+{
+ return new SfxStyleSheetIterator(this,eFam,mask);
+}
+
+
+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, "svtools::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" );
+
+ SfxStyleSheetIterator aIter(this, eFam, mask);
+ rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) );
+ DBG_ASSERT( !xStyle.is(), "svtools::SfxStyleSheetBasePool::Make(), StyleSheet already exists" );
+ SfxStyleSheetIterator& rIter = GetIterator_Impl();
+
+ if( !xStyle.is() )
+ {
+ xStyle = Create( rName, eFam, mask );
+ if(0xffff == nPos || nPos == aStyles.size() || nPos == rIter.Count())
+ {
+ aStyles.push_back( xStyle );
+ }
+ else
+ {
+ rIter[nPos];
+ aStyles.insert( aStyles.begin() + rIter.GetPos(), xStyle );
+ }
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xStyle.get() ) );
+ }
+ return *xStyle.get();
+}
+
+/////////////////////////////// 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() );
+ Remove( pOld );
+ rtl::Reference< SfxStyleSheetBase > xNew( Create( rSheet ) );
+ aStyles.push_back( xNew );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *xNew.get() ) );
+ return *xNew.get();
+}
+
+SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r )
+{
+ if( &r != this )
+ {
+ Clear();
+ *this += r;
+ }
+ return *this;
+}
+
+SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBasePool& r )
+{
+ if( &r != this )
+ {
+ SfxStyles::const_iterator aIter( r.aStyles.begin() );
+ while( aIter != r.aStyles.end() )
+ {
+ Add(*(*aIter++).get());
+ }
+ }
+ 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);
+}
+
+const SfxStyles& SfxStyleSheetBasePool::GetStyles()
+{
+ return aStyles;
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::First()
+{
+ return GetIterator_Impl().First();
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Next()
+{
+ return GetIterator_Impl().Next();
+}
+
+//////////////////////////////// Loeschen /////////////////////////////////
+
+void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
+{
+ if( p )
+ {
+ SfxStyles::iterator aIter( std::find( aStyles.begin(), aStyles.end(), rtl::Reference< SfxStyleSheetBase >( p ) ) );
+ if( aIter != aStyles.end() )
+ {
+ // Alle Styles umsetzen, deren Parent dieser hier ist
+ ChangeParent( p->GetName(), p->GetParent() );
+ aStyles.erase(aIter);
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
+ }
+ }
+}
+
+void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p )
+{
+ DBG_ASSERT( p, "svtools::SfxStyleSheetBasePool::Insert(), no stylesheet?" );
+
+ SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask());
+ SfxStyleSheetBase* pOld = aIter.Find( p->GetName() );
+ DBG_ASSERT( !pOld, "svtools::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" );
+ if( p->GetParent().Len() )
+ {
+ pOld = aIter.Find( p->GetParent() );
+ DBG_ASSERT( pOld, "svtools::SfxStyleSheetBasePool::Insert(), Parent not found!" );
+ }
+ aStyles.push_back( rtl::Reference< SfxStyleSheetBase >( p ) );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) );
+}
+
+void SfxStyleSheetBasePool::Clear()
+{
+ SfxStyles aClearStyles;
+ aClearStyles.swap( aStyles );
+
+ SfxStyles::iterator aIter( aClearStyles.begin() );
+ while( aIter != aClearStyles.end() )
+ {
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) );
+ }
+}
+
+/////////////////////////// Parents umsetzen ////////////////////////////////
+
+void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld,
+ const XubString& rNew,
+ BOOL bVirtual)
+{
+ 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);
+}
+
+/////////////////////////// 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 = 0;
+ 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;
+
+ rtl_TextEncoding eEnc = GetSOLoadTextEncoding(
+ (rtl_TextEncoding)nCharSet,
+ sal::static_int_cast< USHORT >(rStream.GetVersion()) );
+ rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
+ rStream.SetStreamCharSet( eEnc );
+
+ USHORT nStyles;
+ for ( nStyles = 0; aStylesRec.GetContent(); nStyles++ )
+ {
+ // kann nicht mehr weiterlesen?
+ if ( rStream.GetError() )
+ break;
+
+ // Globale Teile
+ XubString aName, aParent, aFollow;
+ String aHelpFile;
+ USHORT nFamily, nStyleMask,nCount;
+ sal_uInt32 nHelpId;
+ rStream.ReadByteString(aName, eEnc );
+ rStream.ReadByteString(aParent, eEnc );
+ rStream.ReadByteString(aFollow, eEnc );
+ rStream >> nFamily >> nStyleMask;
+ SfxPoolItem::readByteString(rStream, aHelpFile);
+ rStream >> nHelpId;
+
+ SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask);
+ 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
+ ULONG n = aStyles.size();
+
+ //! 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 ( ULONG i = 0; i < n; i++ )
+ {
+ SfxStyleSheetBase* p = aStyles[ i ].get();
+ XubString aText = p->aParent;
+ p->aParent.Erase();
+ p->SetParent( aText );
+ aText = p->aFollow;
+ p->aFollow.Erase();
+ p->SetFollow( aText );
+ }
+
+ rStream.SetStreamCharSet( eOldEnc );
+ }
+
+ // 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;
+
+ rtl_TextEncoding eEnc = GetSOLoadTextEncoding(
+ (rtl_TextEncoding)nCharSet,
+ sal::static_int_cast< USHORT >(rStream.GetVersion()) );
+ rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
+ rStream.SetStreamCharSet( eEnc );
+
+ USHORT nStyles;
+ rStream >> nStyles;
+ USHORT i;
+ for ( i = 0; i < nStyles; i++ )
+ {
+ // kann nicht mehr weiterlesen?
+ if ( rStream.GetError() )
+ {
+ nStyles = i;
+ break;
+ }
+
+ // Globale Teile
+ XubString aName, aParent, aFollow;
+ String aHelpFile;
+ USHORT nFamily, nStyleMask,nCount;
+ sal_uInt32 nHelpId;
+ rStream.ReadByteString(aName, eEnc );
+ rStream.ReadByteString(aParent, eEnc );
+ rStream.ReadByteString(aFollow, eEnc );
+ rStream >> nFamily >> nStyleMask;
+ SfxPoolItem::readByteString(rStream, aHelpFile);
+ if(nVersion!=STYLESTREAM_VERSION)
+ {
+ USHORT nTmpHelpId;
+ rStream >> nTmpHelpId;
+ nHelpId=nTmpHelpId;
+ }
+ else
+ rStream >> nHelpId;
+
+ SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask);
+ 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 < nStyles; i++ )
+ {
+ SfxStyleSheetBase* p = aStyles[ i ].get();
+ XubString aText = p->aParent;
+ p->aParent.Erase();
+ p->SetParent( aText );
+ aText = p->aFollow;
+ p->aFollow.Erase();
+ p->SetFollow( aText );
+ }
+
+ rStream.SetStreamCharSet( eOldEnc );
+
+ 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 eEnc
+ = ::GetSOStoreTextEncoding(
+ rStream.GetStreamCharSet(),
+ sal::static_int_cast< USHORT >(rStream.GetVersion()) );
+ rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
+ rStream.SetStreamCharSet( eEnc );
+
+ {
+ SfxSingleRecordWriter aHeaderRec( &rStream,
+ SFX_STYLES_REC_HEADER,
+ STYLESTREAM_VERSION );
+ rStream << (short) eEnc;
+ }
+
+ // die StyleSheets in einen MultiVarRecord
+ {
+ // Bug 79478:
+ // make a check loop, to be shure, that the converted names are also
+ // unique like the originals! In other cases we get a loop.
+ SvStringsSortDtor aSortOrigNames( 0, 128 );
+ SvStrings aOrigNames( 0, 128 );
+ SvByteStringsSortDtor aSortConvNames( 0, 128 );
+ SvByteStrings aConvNames( 0, 128 );
+
+ {
+
+ for( SfxStyleSheetBase* p = First(); p; p = Next() )
+ {
+ if(!bUsed || p->IsUsed())
+ {
+ USHORT nFamily = (USHORT)p->GetFamily();
+ String* pName = new String( p->GetName() );
+ ByteString* pConvName = new ByteString( *pName, eEnc );
+
+ pName->Insert( (sal_Unicode)nFamily, 0 );
+ pConvName->Insert( " ", 0 );
+ pConvName->SetChar(
+ 0,
+ sal::static_int_cast< char >(0xff & (nFamily >> 8)) );
+ pConvName->SetChar(
+ 1, sal::static_int_cast< char >(0xff & nFamily) );
+
+ USHORT nInsPos, nAdd = aSortConvNames.Count();
+ while( !aSortConvNames.Insert( pConvName, nInsPos ) )
+ (pConvName->Append( '_' )).Append(
+ ByteString::CreateFromInt32( nAdd++ ));
+ aOrigNames.Insert( pName, nInsPos );
+ }
+ }
+
+ // now we have the list of the names, sorted by convertede names
+ // But now we need the sorted list of orignames.
+ {
+ USHORT nInsPos, nEnd = aOrigNames.Count();
+ const ByteStringPtr* ppB = aSortConvNames.GetData();
+ for( USHORT n = 0; n < nEnd; ++n, ++ppB )
+ {
+ String* p = aOrigNames.GetObject( n );
+ aSortOrigNames.Insert( p, nInsPos );
+ aConvNames.Insert( *ppB, nInsPos );
+ }
+
+ }
+ }
+
+
+ ByteString sEmpty;
+ USHORT nFndPos;
+ String sNm;
+ 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;
+ sal_uInt32 nHelpId = p->GetHelpId( aHelpFile );
+ USHORT nFamily = sal::static_int_cast< USHORT >(p->GetFamily());
+ String sFamily( (sal_Unicode)nFamily );
+
+ (sNm = sFamily) += p->GetName();
+ if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
+ rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
+ else
+ rStream.WriteByteString( sEmpty );
+
+ (sNm = sFamily) += p->GetParent();
+ if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
+ rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
+ else
+ rStream.WriteByteString( sEmpty );
+
+ (sNm = sFamily) += p->GetFollow();
+ if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
+ rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
+ else
+ rStream.WriteByteString( sEmpty );
+
+ rStream << nFamily << 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;
+ }
+ }
+ }
+
+ rStream.SetStreamCharSet( eOldEnc );
+
+ return BOOL( rStream.GetError() == SVSTREAM_OK );
+}
+
+SfxItemPool& SfxStyleSheetBasePool::GetPool()
+{
+ return rPool;
+}
+
+const SfxItemPool& SfxStyleSheetBasePool::GetPool() const
+{
+ return rPool;
+}
+
+/////////////////////// SfxStyleSheet /////////////////////////////////
+
+SfxStyleSheet::SfxStyleSheet(const XubString &rName,
+ const SfxStyleSheetBasePool& r_Pool,
+ SfxStyleFamily eFam,
+ USHORT mask ):
+ SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool& >( r_Pool ), eFam, mask)
+{}
+
+SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) :
+ SfxStyleSheetBase(rStyle),
+ SfxListener( rStyle ),
+ SfxBroadcaster( rStyle )
+{}
+
+SfxStyleSheet::SfxStyleSheet()
+{
+}
+
+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::Notify(SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ Forward(rBC, rHint);
+}
+
+//////////////////////// SfxStyleSheetPool ///////////////////////////////
+
+SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet)
+: SfxStyleSheetBasePool( const_cast< SfxItemPool& >( 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;
+}
+*/
+
+// --------------------------------------------------------------------
+// class SfxUnoStyleSheet
+// --------------------------------------------------------------------
+
+SfxUnoStyleSheet::SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske )
+: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rName, _rPool, _eFamily, _nMaske )
+{
+}
+
+// --------------------------------------------------------------------
+SfxUnoStyleSheet::SfxUnoStyleSheet( const SfxStyleSheet& _rSheet )
+: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rSheet )
+{
+}
+
+// --------------------------------------------------------------------
+
+SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle )
+{
+ SfxUnoStyleSheet* pRet = dynamic_cast< SfxUnoStyleSheet* >( xStyle.get() );
+ if( !pRet )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xStyle, ::com::sun::star::uno::UNO_QUERY );
+ if( xUT.is() )
+ pRet = reinterpret_cast<SfxUnoStyleSheet*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SfxUnoStyleSheet::getIdentifier())));
+ }
+ return pRet;
+}
+
+// --------------------------------------------------------------------
+// XUnoTunnel
+// --------------------------------------------------------------------
+
+::sal_Int64 SAL_CALL SfxUnoStyleSheet::getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getIdentifier().getConstArray(), rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+const ::com::sun::star::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getIdentifier()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+// --------------------------------------------------------------------
diff --git a/svtools/source/items/szitem.cxx b/svtools/source/items/szitem.cxx
new file mode 100644
index 000000000000..ec3ff83dd2ec
--- /dev/null
+++ b/svtools/source/items/szitem.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: szitem.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include <svtools/szitem.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <tools/stream.hxx>
+#include <tools/gen.hxx>
+
+#include <svtools/poolitem.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 IntlWrapper *
+) 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 ) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ Size aStr;
+ rStream >> aStr;
+ return new SfxSizeItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxSizeItem::Store(SvStream &rStream, USHORT ) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxSizeItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ Size aTmp(aVal);
+ if( bConvert )
+ {
+ aTmp.Height() = ( aTmp.Height() * 127 + 36) / 72;
+ aTmp.Width() = ( aTmp.Width() * 127 + 36) / 72;
+ }
+
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ rVal <<= com::sun::star::awt::Size( aTmp.getWidth(), aTmp.getHeight() );
+ break;
+ }
+ case MID_WIDTH:
+ rVal <<= aTmp.getWidth(); break;
+ case MID_HEIGHT:
+ rVal <<= aTmp.getHeight(); break;
+ default: DBG_ERROR("Wrong MemberId!"); return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxSizeItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Size aValue;
+ sal_Int32 nVal = 0;
+ if ( !nMemberId )
+ bRet = ( rVal >>= aValue );
+ else
+ {
+ bRet = ( rVal >>= nVal );
+ if ( nMemberId == MID_WIDTH )
+ {
+ aValue.Width = nVal;
+ aValue.Height = aVal.Height();
+ }
+ else
+ {
+ aValue.Height = nVal;
+ aValue.Width = aVal.Width();
+ }
+ }
+
+ if ( bRet )
+ {
+ Size aTmp( aValue.Width, aValue.Height );
+ if( bConvert )
+ {
+ aTmp.Height() = ( aTmp.Height() * 72 + 63) / 127;
+ aTmp.Width() = ( aTmp.Width() * 72 + 63) / 127;
+ }
+
+ aVal = aTmp;
+ }
+
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/wallitem.cxx b/svtools/source/items/wallitem.cxx
new file mode 100644
index 000000000000..32797f69a48c
--- /dev/null
+++ b/svtools/source/items/wallitem.cxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: wallitem.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/stream.hxx>
+#include <tools/color.hxx>
+
+#include <vcl/graph.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/cvtgrf.hxx>
+
+#include "wallitem.hxx"
+#include <svtools/cntwall.hxx>
+
+// -----------------------------------------------------------------------
+
+//static
+void SfxBrushItemLink::Set( SfxBrushItemLink* pLink )
+{
+ SfxBrushItemLink** ppLink = (SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM);
+ if( !*ppLink )
+ *ppLink = pLink;
+ else
+ delete pLink;
+}
+