summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/SwXTextDefaults.cxx292
-rw-r--r--sw/source/core/unocore/TextCursorHelper.cxx61
-rw-r--r--sw/source/core/unocore/XMLRangeHelper.cxx412
-rw-r--r--sw/source/core/unocore/XMLRangeHelper.hxx78
-rw-r--r--sw/source/core/unocore/makefile.mk124
-rw-r--r--sw/source/core/unocore/swunohelper.cxx291
-rw-r--r--sw/source/core/unocore/unobkm.cxx651
-rw-r--r--sw/source/core/unocore/unochart.cxx3092
-rw-r--r--sw/source/core/unocore/unocoll.cxx1930
-rw-r--r--sw/source/core/unocore/unocore.src64
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx1150
-rw-r--r--sw/source/core/unocore/unodraw.cxx3105
-rw-r--r--sw/source/core/unocore/unoevent.cxx333
-rw-r--r--sw/source/core/unocore/unoevtlstnr.cxx118
-rw-r--r--sw/source/core/unocore/unofield.cxx3007
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx531
-rw-r--r--sw/source/core/unocore/unoframe.cxx3433
-rw-r--r--sw/source/core/unocore/unoftn.cxx732
-rw-r--r--sw/source/core/unocore/unoidx.cxx3451
-rw-r--r--sw/source/core/unocore/unomap.cxx3123
-rw-r--r--sw/source/core/unocore/unoobj.cxx3209
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2097
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx1462
-rw-r--r--sw/source/core/unocore/unoport.cxx1072
-rw-r--r--sw/source/core/unocore/unoportenum.cxx1226
-rw-r--r--sw/source/core/unocore/unoprnms.cxx793
-rw-r--r--sw/source/core/unocore/unoredline.cxx794
-rw-r--r--sw/source/core/unocore/unoredlines.cxx235
-rw-r--r--sw/source/core/unocore/unorefmk.cxx1708
-rw-r--r--sw/source/core/unocore/unosect.cxx1916
-rw-r--r--sw/source/core/unocore/unosett.cxx2828
-rw-r--r--sw/source/core/unocore/unosrch.cxx762
-rw-r--r--sw/source/core/unocore/unostyle.cxx4536
-rw-r--r--sw/source/core/unocore/unotbl.cxx5469
-rw-r--r--sw/source/core/unocore/unotext.cxx2967
-rw-r--r--sw/source/core/unocore/unotextmarkup.cxx486
36 files changed, 57538 insertions, 0 deletions
diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx
new file mode 100644
index 000000000000..915609cdd2ca
--- /dev/null
+++ b/sw/source/core/unocore/SwXTextDefaults.cxx
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <SwXTextDefaults.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <fchrfmt.hxx>
+#include <charfmt.hxx>
+#include <docstyle.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <unomap.hxx>
+#include <unomid.h>
+#include <paratr.hxx>
+#include <unoprnms.hxx>
+#include <unocrsrhelper.hxx>
+#include <hintids.hxx>
+
+#include <unomid.h>
+
+
+using rtl::OUString;
+using namespace rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+
+SwXTextDefaults::SwXTextDefaults ( SwDoc * pNewDoc ) :
+ m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_DEFAULT ) ),
+ m_pDoc ( pNewDoc )
+{
+}
+
+
+SwXTextDefaults::~SwXTextDefaults ()
+{
+}
+
+
+uno::Reference< XPropertySetInfo > SAL_CALL SwXTextDefaults::getPropertySetInfo( )
+ throw(RuntimeException)
+{
+ static uno::Reference < XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+
+
+void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex());
+ if (!m_pDoc)
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID);
+ if (RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId)
+ {
+ SfxItemSet aSet( m_pDoc->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC );
+ aSet.Put(rItem);
+ SwUnoCursorHelper::SetPageDesc( aValue, *m_pDoc, aSet );
+ m_pDoc->SetDefault(aSet.Get(RES_PAGEDESC));
+ }
+ else if ((RES_PARATR_DROP == pMap->nWID && MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId) ||
+ (RES_TXTATR_CHARFMT == pMap->nWID))
+ {
+ OUString uStyle;
+ if(aValue >>= uStyle)
+ {
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)m_pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
+ SwFmtDrop* pDrop = 0;
+ SwFmtCharFmt *pCharFmt = 0;
+ if(pStyle)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
+ if (RES_PARATR_DROP == pMap->nWID)
+ {
+ pDrop = (SwFmtDrop*)rItem.Clone(); // because rItem ist const...
+ pDrop->SetCharFmt(xStyle->GetCharFmt());
+ m_pDoc->SetDefault(*pDrop);
+ }
+ else // RES_TXTATR_CHARFMT == pMap->nWID
+ {
+ pCharFmt = (SwFmtCharFmt*)rItem.Clone(); // because rItem ist const...
+ pCharFmt->SetCharFmt(xStyle->GetCharFmt());
+ m_pDoc->SetDefault(*pCharFmt);
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ delete pDrop;
+ delete pCharFmt;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ SfxPoolItem * pNewItem = rItem.Clone();
+ pNewItem->PutValue( aValue, pMap->nMemberId);
+ m_pDoc->SetDefault(*pNewItem);
+ delete pNewItem;
+ }
+}
+
+
+Any SAL_CALL SwXTextDefaults::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex());
+ if (!m_pDoc)
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ Any aRet;
+ const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID);
+ rItem.QueryValue( aRet, pMap->nMemberId );
+ return aRet;
+}
+
+
+void SAL_CALL SwXTextDefaults::addPropertyChangeListener( const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+void SAL_CALL SwXTextDefaults::removePropertyChangeListener( const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+void SAL_CALL SwXTextDefaults::addVetoableChangeListener( const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+void SAL_CALL SwXTextDefaults::removeVetoableChangeListener( const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+// XPropertyState
+PropertyState SAL_CALL SwXTextDefaults::getPropertyState( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex());
+ PropertyState eRet = PropertyState_DIRECT_VALUE;
+ if (!m_pDoc)
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID);
+ if (IsStaticDefaultItem ( &rItem ) )
+ eRet = PropertyState_DEFAULT_VALUE;
+ return eRet;
+}
+
+
+Sequence< PropertyState > SAL_CALL SwXTextDefaults::getPropertyStates( const Sequence< OUString >& rPropertyNames )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ const sal_Int32 nCount = rPropertyNames.getLength();
+ const OUString * pNames = rPropertyNames.getConstArray();
+ Sequence < PropertyState > aRet ( nCount );
+ PropertyState *pState = aRet.getArray();
+
+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++)
+ pState[nIndex] = getPropertyState( pNames[nIndex] );
+
+ return aRet;
+}
+
+
+void SAL_CALL SwXTextDefaults::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ if (!m_pDoc)
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SfxItemPool& rSet (m_pDoc->GetAttrPool());
+ rSet.ResetPoolDefaultItem ( pMap->nWID );
+}
+
+
+Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if (!m_pDoc)
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ Any aRet;
+ SfxItemPool& rSet (m_pDoc->GetAttrPool());
+ const SfxPoolItem *pItem = rSet.GetPoolDefaultItem ( pMap->nWID );
+ pItem->QueryValue( aRet, pMap->nMemberId );
+ return aRet;
+}
+
+
+rtl::OUString SAL_CALL SwXTextDefaults::getImplementationName( )
+ throw (RuntimeException)
+{
+ return C2U("SwXTextDefaults");
+}
+
+
+sal_Bool SAL_CALL SwXTextDefaults::supportsService( const ::rtl::OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return rServiceName == C2U("com.sun.star.text.Defaults") ||
+ rServiceName == C2U("com.sun.star.style.CharacterProperties") ||
+ rServiceName == C2U("com.sun.star.style.CharacterPropertiesAsian") ||
+ rServiceName == C2U("com.sun.star.style.CharacterPropertiesComplex") ||
+ rServiceName == C2U("com.sun.star.style.ParagraphProperties") ||
+ rServiceName == C2U("com.sun.star.style.ParagraphPropertiesAsian") ||
+ rServiceName == C2U("com.sun.star.style.ParagraphPropertiesComplex");
+}
+
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwXTextDefaults::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ uno::Sequence< OUString > aRet(7);
+ OUString* pArr = aRet.getArray();
+ *pArr++ = C2U("com.sun.star.text.Defaults");
+ *pArr++ = C2U("com.sun.star.style.CharacterProperties");
+ *pArr++ = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ *pArr++ = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ *pArr++ = C2U("com.sun.star.style.ParagraphProperties");
+ *pArr++ = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ *pArr++ = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+
+
+
diff --git a/sw/source/core/unocore/TextCursorHelper.cxx b/sw/source/core/unocore/TextCursorHelper.cxx
new file mode 100644
index 000000000000..5616d51d1d9f
--- /dev/null
+++ b/sw/source/core/unocore/TextCursorHelper.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include "TextCursorHelper.hxx"
+#include "unobaseclass.hxx"
+
+
+using namespace ::com::sun::star;
+/* -----------------------------03.03.03 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & OTextCursorHelper::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------03.03.03 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+//XUnoTunnel
+sal_Int64 SAL_CALL OTextCursorHelper::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx b/sw/source/core/unocore/XMLRangeHelper.cxx
new file mode 100644
index 000000000000..8695de0eef9b
--- /dev/null
+++ b/sw/source/core/unocore/XMLRangeHelper.cxx
@@ -0,0 +1,412 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include "XMLRangeHelper.hxx"
+#include <unotools/charclass.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <algorithm>
+#include <functional>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ================================================================================
+
+namespace
+{
+/** unary function that escapes backslashes and single quotes in a sal_Unicode
+ array (which you can get from an OUString with getStr()) and puts the result
+ into the OUStringBuffer given in the CTOR
+ */
+class lcl_Escape : public ::std::unary_function< sal_Unicode, void >
+{
+public:
+ lcl_Escape( ::rtl::OUStringBuffer & aResultBuffer ) : m_aResultBuffer( aResultBuffer ) {}
+ void operator() ( sal_Unicode aChar )
+ {
+ static const sal_Unicode m_aQuote( '\'' );
+ static const sal_Unicode m_aBackslash( '\\' );
+
+ if( aChar == m_aQuote ||
+ aChar == m_aBackslash )
+ m_aResultBuffer.append( m_aBackslash );
+ m_aResultBuffer.append( aChar );
+ }
+
+private:
+ ::rtl::OUStringBuffer & m_aResultBuffer;
+};
+
+// ----------------------------------------
+
+/** unary function that removes backslash escapes in a sal_Unicode array (which
+ you can get from an OUString with getStr()) and puts the result into the
+ OUStringBuffer given in the CTOR
+ */
+class lcl_UnEscape : public ::std::unary_function< sal_Unicode, void >
+{
+public:
+ lcl_UnEscape( ::rtl::OUStringBuffer & aResultBuffer ) : m_aResultBuffer( aResultBuffer ) {}
+ void operator() ( sal_Unicode aChar )
+ {
+ static const sal_Unicode m_aBackslash( '\\' );
+
+ if( aChar != m_aBackslash )
+ m_aResultBuffer.append( aChar );
+ }
+
+private:
+ ::rtl::OUStringBuffer & m_aResultBuffer;
+};
+
+// ----------------------------------------
+
+OUStringBuffer lcl_getXMLStringForCell( const /*::chart::*/XMLRangeHelper::Cell & rCell )
+{
+ ::rtl::OUStringBuffer aBuffer;
+ if( rCell.empty())
+ return aBuffer;
+
+ sal_Int32 nCol = rCell.nColumn;
+ aBuffer.append( (sal_Unicode)'.' );
+ if( ! rCell.bRelativeColumn )
+ aBuffer.append( (sal_Unicode)'$' );
+
+ // get A, B, C, ..., AA, AB, ... representation of column number
+ if( nCol < 26 )
+ aBuffer.append( (sal_Unicode)('A' + nCol) );
+ else if( nCol < 702 )
+ {
+ aBuffer.append( (sal_Unicode)('A' + nCol / 26 - 1 ));
+ aBuffer.append( (sal_Unicode)('A' + nCol % 26) );
+ }
+ else // works for nCol <= 18,278
+ {
+ aBuffer.append( (sal_Unicode)('A' + nCol / 702 - 1 ));
+ aBuffer.append( (sal_Unicode)('A' + (nCol % 702) / 26 ));
+ aBuffer.append( (sal_Unicode)('A' + nCol % 26) );
+ }
+
+ // write row number as number
+ if( ! rCell.bRelativeRow )
+ aBuffer.append( (sal_Unicode)'$' );
+ aBuffer.append( rCell.nRow + (sal_Int32)1 );
+
+ return aBuffer;
+}
+
+void lcl_getSingleCellAddressFromXMLString(
+ const ::rtl::OUString& rXMLString,
+ sal_Int32 nStartPos, sal_Int32 nEndPos,
+ /*::chart::*/XMLRangeHelper::Cell & rOutCell )
+{
+ // expect "\$?[a-zA-Z]+\$?[1-9][0-9]*"
+ static const sal_Unicode aDollar( '$' );
+ static const sal_Unicode aLetterA( 'A' );
+
+ ::rtl::OUString aCellStr = rXMLString.copy( nStartPos, nEndPos - nStartPos + 1 ).toAsciiUpperCase();
+ const sal_Unicode* pStrArray = aCellStr.getStr();
+ sal_Int32 nLength = aCellStr.getLength();
+ sal_Int32 i = nLength - 1, nColumn = 0;
+
+ // parse number for row
+ while( CharClass::isAsciiDigit( pStrArray[ i ] ) && i >= 0 )
+ i--;
+ rOutCell.nRow = (aCellStr.copy( i + 1 )).toInt32() - 1;
+ // a dollar in XML means absolute (whereas in UI it means relative)
+ if( pStrArray[ i ] == aDollar )
+ {
+ i--;
+ rOutCell.bRelativeRow = false;
+ }
+ else
+ rOutCell.bRelativeRow = true;
+
+ // parse rest for column
+ sal_Int32 nPower = 1;
+ while( CharClass::isAsciiAlpha( pStrArray[ i ] ))
+ {
+ nColumn += (pStrArray[ i ] - aLetterA + 1) * nPower;
+ i--;
+ nPower *= 26;
+ }
+ rOutCell.nColumn = nColumn - 1;
+
+ rOutCell.bRelativeColumn = true;
+ if( i >= 0 &&
+ pStrArray[ i ] == aDollar )
+ rOutCell.bRelativeColumn = false;
+ rOutCell.bIsEmpty = false;
+}
+
+bool lcl_getCellAddressFromXMLString(
+ const ::rtl::OUString& rXMLString,
+ sal_Int32 nStartPos, sal_Int32 nEndPos,
+ /*::chart::*/XMLRangeHelper::Cell & rOutCell,
+ ::rtl::OUString& rOutTableName )
+{
+ static const sal_Unicode aDot( '.' );
+ static const sal_Unicode aQuote( '\'' );
+ static const sal_Unicode aBackslash( '\\' );
+
+ sal_Int32 nNextDelimiterPos = nStartPos;
+
+ sal_Int32 nDelimiterPos = nStartPos;
+ bool bInQuotation = false;
+ // parse table name
+ while( nDelimiterPos < nEndPos &&
+ ( bInQuotation || rXMLString[ nDelimiterPos ] != aDot ))
+ {
+ // skip escaped characters (with backslash)
+ if( rXMLString[ nDelimiterPos ] == aBackslash )
+ ++nDelimiterPos;
+ // toggle quotation mode when finding single quotes
+ else if( rXMLString[ nDelimiterPos ] == aQuote )
+ bInQuotation = ! bInQuotation;
+
+ ++nDelimiterPos;
+ }
+
+ if( nDelimiterPos == -1 ||
+ nDelimiterPos >= nEndPos )
+ {
+ return false;
+ }
+ if( nDelimiterPos > nStartPos )
+ {
+ // there is a table name before the address
+
+ ::rtl::OUStringBuffer aTableNameBuffer;
+ const sal_Unicode * pTableName = rXMLString.getStr();
+
+ // remove escapes from table name
+ ::std::for_each( pTableName + nStartPos,
+ pTableName + nDelimiterPos,
+ lcl_UnEscape( aTableNameBuffer ));
+
+ // unquote quoted table name
+ const sal_Unicode * pBuf = aTableNameBuffer.getStr();
+ if( pBuf[ 0 ] == aQuote &&
+ pBuf[ aTableNameBuffer.getLength() - 1 ] == aQuote )
+ {
+ ::rtl::OUString aName = aTableNameBuffer.makeStringAndClear();
+ rOutTableName = aName.copy( 1, aName.getLength() - 2 );
+ }
+ else
+ rOutTableName = aTableNameBuffer.makeStringAndClear();
+ }
+
+ for( sal_Int32 i = 0;
+ nNextDelimiterPos < nEndPos;
+ nDelimiterPos = nNextDelimiterPos, i++ )
+ {
+ nNextDelimiterPos = rXMLString.indexOf( aDot, nDelimiterPos + 1 );
+ if( nNextDelimiterPos == -1 ||
+ nNextDelimiterPos > nEndPos )
+ nNextDelimiterPos = nEndPos + 1;
+
+ if( i==0 )
+ // only take first cell
+ lcl_getSingleCellAddressFromXMLString(
+ rXMLString, nDelimiterPos + 1, nNextDelimiterPos - 1, rOutCell );
+ }
+
+ return true;
+}
+
+bool lcl_getCellRangeAddressFromXMLString(
+ const ::rtl::OUString& rXMLString,
+ sal_Int32 nStartPos, sal_Int32 nEndPos,
+ /*::chart::*/XMLRangeHelper::CellRange & rOutRange )
+{
+ bool bResult = true;
+ static const sal_Unicode aColon( ':' );
+ static const sal_Unicode aQuote( '\'' );
+ static const sal_Unicode aBackslash( '\\' );
+
+ sal_Int32 nDelimiterPos = nStartPos;
+ bool bInQuotation = false;
+ // parse table name
+ while( nDelimiterPos < nEndPos &&
+ ( bInQuotation || rXMLString[ nDelimiterPos ] != aColon ))
+ {
+ // skip escaped characters (with backslash)
+ if( rXMLString[ nDelimiterPos ] == aBackslash )
+ ++nDelimiterPos;
+ // toggle quotation mode when finding single quotes
+ else if( rXMLString[ nDelimiterPos ] == aQuote )
+ bInQuotation = ! bInQuotation;
+
+ ++nDelimiterPos;
+ }
+
+ if( nDelimiterPos == nEndPos )
+ {
+ // only one cell
+ bResult = lcl_getCellAddressFromXMLString( rXMLString, nStartPos, nEndPos,
+ rOutRange.aUpperLeft,
+ rOutRange.aTableName );
+ }
+ else
+ {
+ // range (separated by a colon)
+ bResult = lcl_getCellAddressFromXMLString( rXMLString, nStartPos, nDelimiterPos - 1,
+ rOutRange.aUpperLeft,
+ rOutRange.aTableName );
+ ::rtl::OUString sTableSecondName;
+ if( bResult )
+ {
+ bResult = lcl_getCellAddressFromXMLString( rXMLString, nDelimiterPos + 1, nEndPos,
+ rOutRange.aLowerRight,
+ sTableSecondName );
+ }
+ if( bResult &&
+ sTableSecondName.getLength() &&
+ ! sTableSecondName.equals( rOutRange.aTableName ))
+ bResult = false;
+ }
+
+ return bResult;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+//namespace chart
+//{
+namespace XMLRangeHelper
+{
+
+CellRange getCellRangeFromXMLString( const OUString & rXMLString )
+{
+ static const sal_Unicode aSpace( ' ' );
+ static const sal_Unicode aQuote( '\'' );
+ static const sal_Unicode aDollar( '$' );
+ static const sal_Unicode aBackslash( '\\' );
+
+ sal_Int32 nStartPos = 0;
+ sal_Int32 nEndPos = nStartPos;
+ const sal_Int32 nLength = rXMLString.getLength();
+
+ // reset
+ CellRange aResult;
+
+ // iterate over different ranges
+ for( sal_Int32 i = 0;
+ nEndPos < nLength;
+ nStartPos = ++nEndPos, i++ )
+ {
+ // find start point of next range
+
+ // ignore leading '$'
+ if( rXMLString[ nEndPos ] == aDollar)
+ nEndPos++;
+
+ bool bInQuotation = false;
+ // parse range
+ while( nEndPos < nLength &&
+ ( bInQuotation || rXMLString[ nEndPos ] != aSpace ))
+ {
+ // skip escaped characters (with backslash)
+ if( rXMLString[ nEndPos ] == aBackslash )
+ ++nEndPos;
+ // toggle quotation mode when finding single quotes
+ else if( rXMLString[ nEndPos ] == aQuote )
+ bInQuotation = ! bInQuotation;
+
+ ++nEndPos;
+ }
+
+ if( ! lcl_getCellRangeAddressFromXMLString(
+ rXMLString,
+ nStartPos, nEndPos - 1,
+ aResult ))
+ {
+ // if an error occured, bail out
+ return CellRange();
+ }
+ }
+
+ return aResult;
+}
+
+OUString getXMLStringFromCellRange( const CellRange & rRange )
+{
+ static const sal_Unicode aSpace( ' ' );
+ static const sal_Unicode aQuote( '\'' );
+
+ ::rtl::OUStringBuffer aBuffer;
+
+ if( (rRange.aTableName).getLength())
+ {
+ bool bNeedsEscaping = ( rRange.aTableName.indexOf( aQuote ) > -1 );
+ bool bNeedsQuoting = bNeedsEscaping || ( rRange.aTableName.indexOf( aSpace ) > -1 );
+
+ // quote table name if it contains spaces or quotes
+ if( bNeedsQuoting )
+ {
+ // leading quote
+ aBuffer.append( aQuote );
+
+ // escape existing quotes
+ if( bNeedsEscaping )
+ {
+ const sal_Unicode * pTableNameBeg = rRange.aTableName.getStr();
+
+ // append the quoted string at the buffer
+ ::std::for_each( pTableNameBeg,
+ pTableNameBeg + rRange.aTableName.getLength(),
+ lcl_Escape( aBuffer ) );
+ }
+ else
+ aBuffer.append( rRange.aTableName );
+
+ // final quote
+ aBuffer.append( aQuote );
+ }
+ else
+ aBuffer.append( rRange.aTableName );
+ }
+ aBuffer.append( lcl_getXMLStringForCell( rRange.aUpperLeft ));
+
+ if( ! rRange.aLowerRight.empty())
+ {
+ // we have a range (not a single cell)
+ aBuffer.append( sal_Unicode( ':' ));
+ aBuffer.append( lcl_getXMLStringForCell( rRange.aLowerRight ));
+ }
+
+ return aBuffer.makeStringAndClear();
+}
+
+} // namespace XMLRangeHelper
+//} // namespace chart
diff --git a/sw/source/core/unocore/XMLRangeHelper.hxx b/sw/source/core/unocore/XMLRangeHelper.hxx
new file mode 100644
index 000000000000..c170662745ae
--- /dev/null
+++ b/sw/source/core/unocore/XMLRangeHelper.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 file is an exact copy of the same file in chart2 project
+//!!
+
+#ifndef XMLRANGEHELPER_HXX
+#define XMLRANGEHELPER_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+//namespace chart
+//{
+namespace XMLRangeHelper
+{
+
+struct Cell
+{
+ sal_Int32 nColumn;
+ sal_Int32 nRow;
+ bool bRelativeColumn;
+ bool bRelativeRow;
+ bool bIsEmpty;
+
+ Cell() :
+ nColumn(0),
+ nRow(0),
+ bRelativeColumn(false),
+ bRelativeRow(false),
+ bIsEmpty(true)
+ {}
+
+ inline bool empty() const { return bIsEmpty; }
+};
+
+struct CellRange
+{
+ Cell aUpperLeft;
+ Cell aLowerRight;
+ ::rtl::OUString aTableName;
+};
+
+CellRange getCellRangeFromXMLString( const ::rtl::OUString & rXMLString );
+
+::rtl::OUString getXMLStringFromCellRange( const CellRange & rRange );
+
+
+} // namespace XMLRangeHelper
+//} // namespace chart
+
+// XMLRANGEHELPER_HXX
+#endif
diff --git a/sw/source/core/unocore/makefile.mk b/sw/source/core/unocore/makefile.mk
new file mode 100644
index 000000000000..09e6371ada80
--- /dev/null
+++ b/sw/source/core/unocore/makefile.mk
@@ -0,0 +1,124 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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=sw
+TARGET=unocore
+
+# --- Settings -----------------------------------------------------
+#ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+EXCEPTIONSFILES= \
+ $(SLO)$/swunohelper.obj\
+ $(SLO)$/SwXTextDefaults.obj\
+ $(SLO)$/unobkm.obj\
+ $(SLO)$/unochart.obj\
+ $(SLO)$/unoevent.obj\
+ $(SLO)$/unocrsrhelper.obj\
+ $(SLO)$/unoevtlstnr.obj\
+ $(SLO)$/unoftn.obj\
+ $(SLO)$/unorefmk.obj\
+ $(SLO)$/unosect.obj\
+ $(SLO)$/unosett.obj\
+ $(SLO)$/unocoll.obj\
+ $(SLO)$/unodraw.obj\
+ $(SLO)$/unofield.obj\
+ $(SLO)$/unoframe.obj\
+ $(SLO)$/unoidx.obj\
+ $(SLO)$/unoobj.obj\
+ $(SLO)$/unoobj2.obj\
+ $(SLO)$/unoparagraph.obj\
+ $(SLO)$/unoport.obj\
+ $(SLO)$/unoredline.obj\
+ $(SLO)$/unoredlines.obj\
+ $(SLO)$/unosrch.obj\
+ $(SLO)$/unostyle.obj\
+ $(SLO)$/unotbl.obj \
+ $(SLO)$/unoflatpara.obj\
+ $(SLO)$/unotextmarkup.obj\
+ $(SLO)$/TextCursorHelper.obj \
+ $(SLO)$/unotext.obj
+
+.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
+EXCEPTIONSNOOPTFILES =$(SLO)$/unoportenum.obj
+.ELSE
+EXCEPTIONSFILES +=$(SLO)$/unoportenum.obj
+.ENDIF
+
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ unocore.src
+
+SLOFILES = \
+ $(SLO)$/swunohelper.obj\
+ $(SLO)$/SwXTextDefaults.obj\
+ $(SLO)$/unoportenum.obj\
+ $(SLO)$/unobkm.obj\
+ $(SLO)$/unochart.obj\
+ $(SLO)$/unoevent.obj\
+ $(SLO)$/unocrsrhelper.obj\
+ $(SLO)$/unoevtlstnr.obj\
+ $(SLO)$/unoftn.obj\
+ $(SLO)$/unorefmk.obj\
+ $(SLO)$/unosect.obj\
+ $(SLO)$/unosett.obj\
+ $(SLO)$/unocoll.obj\
+ $(SLO)$/unodraw.obj\
+ $(SLO)$/unofield.obj\
+ $(SLO)$/unoframe.obj\
+ $(SLO)$/unoidx.obj\
+ $(SLO)$/unoobj.obj\
+ $(SLO)$/unoobj2.obj\
+ $(SLO)$/unoparagraph.obj\
+ $(SLO)$/unoport.obj\
+ $(SLO)$/unoredline.obj\
+ $(SLO)$/unoredlines.obj\
+ $(SLO)$/unosrch.obj\
+ $(SLO)$/unostyle.obj\
+ $(SLO)$/unotbl.obj \
+ $(SLO)$/unoflatpara.obj\
+ $(SLO)$/unotextmarkup.obj\
+ $(SLO)$/TextCursorHelper.obj \
+ $(SLO)$/unotext.obj\
+ $(SLO)$/unomap.obj\
+ $(SLO)$/unoprnms.obj\
+ $(SLO)$/XMLRangeHelper.obj
+
+
+
+# --- Targets -------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
new file mode 100644
index 000000000000..b0d0f9623e71
--- /dev/null
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#define _SVSTDARR_STRINGS
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/TransferInfo.hpp>
+#ifndef _COM_SUN_STAR_UCB_NAMECLASH_HDL_
+#include <com/sun/star/ucb/NameClash.hdl>
+#endif
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/types.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/datetime.hxx>
+#include <tools/debug.hxx>
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/content.hxx>
+#include <svl/svstdarr.hxx>
+#include <swunohelper.hxx>
+#include <swunodef.hxx>
+#include <errhdl.hxx>
+
+namespace SWUnoHelper {
+
+sal_Int32 GetEnumAsInt32( const UNO_NMSPC::Any& rVal )
+{
+ sal_Int32 eVal;
+ try
+ {
+ eVal = comphelper::getEnumAsINT32( rVal );
+ }
+ catch( UNO_NMSPC::Exception & )
+ {
+ eVal = 0;
+ ASSERT( FALSE, "can't get EnumAsInt32" );
+ }
+ return eVal;
+}
+
+
+// methods for UCB actions
+BOOL UCB_DeleteFile( const String& rURL )
+{
+ BOOL bRemoved;
+ try
+ {
+ ucbhelper::Content aTempContent( rURL,
+ STAR_REFERENCE( ucb::XCommandEnvironment )());
+ aTempContent.executeCommand(
+ rtl::OUString::createFromAscii( "delete" ),
+ UNO_NMSPC::makeAny( sal_Bool( sal_True ) ) );
+ bRemoved = TRUE;
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ bRemoved = FALSE;
+ ASSERT( FALSE, "Exeception from executeCommand( delete )" );
+ }
+ return bRemoved;
+}
+
+BOOL UCB_CopyFile( const String& rURL, const String& rNewURL, BOOL bCopyIsMove )
+{
+ BOOL bCopyCompleted = TRUE;
+ try
+ {
+ INetURLObject aURL( rNewURL );
+ String sName( aURL.GetName() );
+ aURL.removeSegment();
+ String sMainURL( aURL.GetMainURL(INetURLObject::NO_DECODE) );
+
+ ucbhelper::Content aTempContent( sMainURL,
+ STAR_REFERENCE( ucb::XCommandEnvironment )());
+
+ UNO_NMSPC::Any aAny;
+ STAR_NMSPC::ucb::TransferInfo aInfo;
+ aInfo.NameClash = STAR_NMSPC::ucb::NameClash::ERROR;
+ aInfo.NewTitle = sName;
+ aInfo.SourceURL = rURL;
+ aInfo.MoveData = bCopyIsMove;
+ aAny <<= aInfo;
+ aTempContent.executeCommand(
+ rtl::OUString::createFromAscii( "transfer" ),
+ aAny );
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ ASSERT( FALSE, "Exeception from executeCommand( transfer )" );
+ bCopyCompleted = FALSE;
+ }
+ return bCopyCompleted;
+}
+
+BOOL UCB_IsCaseSensitiveFileName( const String& rURL )
+{
+ BOOL bCaseSensitive;
+ try
+ {
+ STAR_REFERENCE( lang::XMultiServiceFactory ) xMSF =
+ comphelper::getProcessServiceFactory();
+
+ INetURLObject aTempObj( rURL );
+ aTempObj.SetBase( aTempObj.GetBase().toAsciiLowerCase() );
+ STAR_REFERENCE( ucb::XContentIdentifier ) xRef1 = new
+ ucbhelper::ContentIdentifier( xMSF,
+ aTempObj.GetMainURL( INetURLObject::NO_DECODE ));
+
+ aTempObj.SetBase(aTempObj.GetBase().toAsciiUpperCase());
+ STAR_REFERENCE( ucb::XContentIdentifier ) xRef2 = new
+ ucbhelper::ContentIdentifier( xMSF,
+ aTempObj.GetMainURL( INetURLObject::NO_DECODE ));
+
+ STAR_REFERENCE( ucb::XContentProvider ) xProv =
+ ucbhelper::ContentBroker::get()->getContentProviderInterface();
+
+ sal_Int32 nCompare = xProv->compareContentIds( xRef1, xRef2 );
+ bCaseSensitive = 0 != nCompare;
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ bCaseSensitive = FALSE;
+ ASSERT( FALSE, "Exeception from compareContentIds()" );
+ }
+ return bCaseSensitive;
+}
+
+BOOL UCB_IsReadOnlyFileName( const String& rURL )
+{
+ BOOL bIsReadOnly = FALSE;
+ try
+ {
+ ucbhelper::Content aCnt( rURL, STAR_REFERENCE( ucb::XCommandEnvironment )());
+ UNO_NMSPC::Any aAny = aCnt.getPropertyValue(
+ rtl::OUString::createFromAscii( "IsReadOnly" ));
+ if(aAny.hasValue())
+ bIsReadOnly = *(sal_Bool*)aAny.getValue();
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ bIsReadOnly = FALSE;
+ }
+ return bIsReadOnly;
+}
+
+BOOL UCB_IsFile( const String& rURL )
+{
+ BOOL bExists = FALSE;
+ try
+ {
+ ::ucbhelper::Content aContent( rURL, STAR_REFERENCE( ucb::XCommandEnvironment )() );
+ bExists = aContent.isDocument();
+ }
+ catch (UNO_NMSPC::Exception &)
+ {
+ }
+ return bExists;
+}
+
+BOOL UCB_IsDirectory( const String& rURL )
+{
+ BOOL bExists = FALSE;
+ try
+ {
+ ::ucbhelper::Content aContent( rURL, STAR_REFERENCE( ucb::XCommandEnvironment )() );
+ bExists = aContent.isFolder();
+ }
+ catch (UNO_NMSPC::Exception &)
+ {
+ }
+ return bExists;
+}
+
+ // get a list of files from the folder of the URL
+ // options: pExtension = 0 -> all, else this specific extension
+ // pDateTime != 0 -> returns also the modified date/time of
+ // the files in a SvPtrarr -->
+ // !! objects must be deleted from the caller!!
+BOOL UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList,
+ const String* pExtension,
+ SvPtrarr* pDateTimeList )
+{
+ BOOL bOk = FALSE;
+ try
+ {
+ ucbhelper::Content aCnt( rURL, STAR_REFERENCE( ucb::XCommandEnvironment )());
+ STAR_REFERENCE( sdbc::XResultSet ) xResultSet;
+
+ USHORT nSeqSize = pDateTimeList ? 2 : 1;
+ UNO_NMSPC::Sequence < rtl::OUString > aProps( nSeqSize );
+ rtl::OUString* pProps = aProps.getArray();
+ pProps[ 0 ] = rtl::OUString::createFromAscii( "Title" );
+ if( pDateTimeList )
+ pProps[ 1 ] = rtl::OUString::createFromAscii( "DateModified" );
+
+ try
+ {
+ xResultSet = aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ DBG_ERRORFILE( "create cursor failed!" );
+ }
+
+ if( xResultSet.is() )
+ {
+ STAR_REFERENCE( sdbc::XRow ) xRow( xResultSet, UNO_NMSPC::UNO_QUERY );
+ xub_StrLen nExtLen = pExtension ? pExtension->Len() : 0;
+ try
+ {
+ if( xResultSet->first() )
+ {
+ do {
+ String sTitle( xRow->getString( 1 ) );
+ if( !nExtLen ||
+ ( sTitle.Len() > nExtLen &&
+ sTitle.Equals( *pExtension,
+ sTitle.Len() - nExtLen, nExtLen )) )
+ {
+ String* pStr = new String( sTitle );
+ rList.Insert( pStr, rList.Count() );
+
+ if( pDateTimeList )
+ {
+ STAR_NMSPC::util::DateTime aStamp = xRow->getTimestamp(2);
+ ::DateTime* pDateTime = new ::DateTime(
+ ::Date( aStamp.Day,
+ aStamp.Month,
+ aStamp.Year ),
+ ::Time( aStamp.Hours,
+ aStamp.Minutes,
+ aStamp.Seconds,
+ aStamp.HundredthSeconds ));
+ void* p = pDateTime;
+ pDateTimeList->Insert( p,
+ pDateTimeList->Count() );
+ }
+ }
+
+ } while( xResultSet->next() );
+ }
+ bOk = TRUE;
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ DBG_ERRORFILE( "Exception caught!" );
+ }
+ }
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ DBG_ERRORFILE( "Exception caught!" );
+ bOk = FALSE;
+ }
+ return bOk;
+}
+
+}
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
new file mode 100644
index 000000000000..590ddb6e803e
--- /dev/null
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -0,0 +1,651 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <unobookmark.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <TextCursorHelper.hxx>
+#include <unotextrange.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unoevtlstnr.hxx>
+#include <IMark.hxx>
+#include <crossrefbookmark.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <swundo.hxx>
+#ifndef _COMCORE_HRC
+#include <comcore.hrc>
+#endif
+#include <undobj.hxx>
+#include <docsh.hxx>
+
+
+using namespace ::sw::mark;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+namespace
+{
+ static OUString lcl_QuoteName(const OUString& rName)
+ {
+ static const OUString sStart = OUString(String(SW_RES(STR_START_QUOTE)));
+ static const OUString sEnd = OUString(String(SW_RES(STR_END_QUOTE)));
+ ::rtl::OUStringBuffer sBuf(64);
+ return sBuf.append(sStart).append(rName).append(sEnd).makeStringAndClear();
+ }
+}
+
+/******************************************************************
+ * SwXBookmark
+ ******************************************************************/
+
+class SwXBookmark::Impl
+ : public SwClient
+{
+
+public:
+ SwEventListenerContainer m_ListenerContainer;
+ SwDoc * m_pDoc;
+ ::sw::mark::IMark * m_pRegisteredBookmark;
+ ::rtl::OUString m_sMarkName;
+
+
+ Impl( SwXBookmark & rThis,
+ SwDoc *const pDoc, ::sw::mark::IMark *const /*pBookmark*/)
+ : SwClient()
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_pDoc(pDoc)
+ , m_pRegisteredBookmark(0)
+ {
+ // DO NOT regiserInMark here! (because SetXBookmark would delete rThis)
+ }
+
+ void registerInMark(SwXBookmark & rThis, ::sw::mark::IMark *const pBkmk);
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+void SwXBookmark::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if (!GetRegisteredIn())
+ {
+ m_pRegisteredBookmark = NULL;
+ m_pDoc = NULL;
+ m_ListenerContainer.Disposing();
+ }
+}
+
+void SwXBookmark::Impl::registerInMark(SwXBookmark & rThis,
+ ::sw::mark::IMark *const pBkmk)
+{
+ if (pBkmk)
+ {
+ pBkmk->Add(this);
+ ::sw::mark::MarkBase *const pMarkBase(
+ dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
+ OSL_ENSURE(pMarkBase, "registerInMark: no MarkBase?");
+ if (pMarkBase)
+ {
+ const uno::Reference<text::XTextContent> xBookmark(& rThis);
+ pMarkBase->SetXBookmark(xBookmark);
+ }
+ }
+ else if (m_pRegisteredBookmark)
+ {
+ m_sMarkName = m_pRegisteredBookmark->GetName();
+ m_pRegisteredBookmark->Remove(this);
+ }
+ m_pRegisteredBookmark = pBkmk;
+}
+
+
+const ::sw::mark::IMark* SwXBookmark::GetBookmark() const
+{
+ return m_pImpl->m_pRegisteredBookmark;
+}
+
+SwXBookmark::SwXBookmark(::sw::mark::IMark *const pBkmk, SwDoc *const pDoc)
+ : m_pImpl( new SwXBookmark::Impl(*this, pDoc, pBkmk) )
+{
+}
+
+SwXBookmark::SwXBookmark()
+ : m_pImpl( new SwXBookmark::Impl(*this, 0, 0) )
+{
+}
+
+SwXBookmark::~SwXBookmark()
+{
+}
+
+uno::Reference<text::XTextContent>
+SwXBookmark::CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark)
+{
+ // #i105557#: do not iterate over the registered clients: race condition
+ ::sw::mark::MarkBase *const pMarkBase(
+ dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
+ OSL_ENSURE(pMarkBase, "CreateXBookmark: no MarkBase?");
+ if (!pMarkBase) { return 0; }
+ uno::Reference<text::XTextContent> xBookmark(pMarkBase->GetXBookmark());
+ if (!xBookmark.is())
+ {
+ // FIXME: These belong in XTextFieldsSupplier
+ //if (dynamic_cast< ::sw::mark::TextFieldmark* >(&rBkmk))
+ // pXBkmk = new SwXFieldmark(false, &rBkmk, pDoc);
+ //else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBkmk))
+ // pXBkmk = new SwXFieldmark(true, &rBkmk, pDoc);
+ //else
+ OSL_ENSURE(
+ dynamic_cast< ::sw::mark::IBookmark* >(&rBookmark),
+ "<SwXBookmark::GetObject(..)>"
+ "SwXBookmark requested for non-bookmark mark.");
+ SwXBookmark *const pXBookmark = new SwXBookmark(&rBookmark, &rDoc);
+ xBookmark.set(pXBookmark);
+ pXBookmark->m_pImpl->registerInMark(*pXBookmark, pMarkBase);
+ }
+ return xBookmark;
+}
+
+::sw::mark::IMark const* SwXBookmark::GetBookmarkInDoc(SwDoc const*const pDoc,
+ const uno::Reference< lang::XUnoTunnel> & xUT)
+{
+ SwXBookmark *const pXBkm(
+ ::sw::UnoTunnelGetImplementation<SwXBookmark>(xUT));
+ if (pXBkm && (pDoc == pXBkm->m_pImpl->m_pDoc))
+ {
+ return pXBkm->m_pImpl->m_pRegisteredBookmark;
+ }
+ return 0;
+}
+
+const uno::Sequence< sal_Int8 > & SwXBookmark::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL
+SwXBookmark::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXBookmark>(rId, this);
+}
+
+void SwXBookmark::attachToRangeEx(
+ const uno::Reference< text::XTextRange > & xTextRange,
+ IDocumentMarkAccess::MarkType eType)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ if (m_pImpl->m_pRegisteredBookmark)
+ {
+ throw uno::RuntimeException();
+ }
+
+ const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
+ xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ }
+
+ SwDoc *const pDoc =
+ (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
+ if (!pDoc)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ m_pImpl->m_pDoc = pDoc;
+ SwUnoInternalPaM aPam(*m_pImpl->m_pDoc);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+ UnoActionContext aCont(m_pImpl->m_pDoc);
+ if (!m_pImpl->m_sMarkName.getLength())
+ {
+ m_pImpl->m_sMarkName = OUString::createFromAscii("Bookmark");
+ }
+ if ((eType == IDocumentMarkAccess::BOOKMARK) &&
+ ::sw::mark::CrossRefNumItemBookmark::IsLegalName(m_pImpl->m_sMarkName))
+ {
+ eType = IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK;
+ }
+ else if ((eType == IDocumentMarkAccess::BOOKMARK) &&
+ ::sw::mark::CrossRefHeadingBookmark::IsLegalName(m_pImpl->m_sMarkName))
+ {
+ eType = IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK;
+ }
+ m_pImpl->registerInMark(*this,
+ m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark(
+ aPam, m_pImpl->m_sMarkName, eType));
+ // --> OD 2007-10-23 #i81002#
+ // Check, if bookmark has been created.
+ // E.g., the creation of a cross-reference bookmark is suppress,
+ // if the PaM isn't a valid one for cross-reference bookmarks.
+ if (!m_pImpl->m_pRegisteredBookmark)
+ {
+ OSL_ENSURE(false,
+ "<SwXBookmark::attachToRange(..)>"
+ " - could not create Mark.");
+ throw lang::IllegalArgumentException();
+ }
+ // <--
+}
+
+void SwXBookmark::attachToRange(
+ const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ attachToRangeEx(xTextRange, IDocumentMarkAccess::BOOKMARK);
+}
+
+void SAL_CALL
+SwXBookmark::attach(const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ attachToRange( xTextRange );
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXBookmark::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_pRegisteredBookmark)
+ {
+ throw uno::RuntimeException();
+ }
+ return SwXTextRange::CreateXTextRange(
+ *m_pImpl->m_pDoc,
+ m_pImpl->m_pRegisteredBookmark->GetMarkPos(),
+ (m_pImpl->m_pRegisteredBookmark->IsExpanded())
+ ? &m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos() : NULL);
+}
+
+void SAL_CALL SwXBookmark::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (m_pImpl->m_pRegisteredBookmark)
+ {
+ m_pImpl->m_pDoc->getIDocumentMarkAccess()->deleteMark(
+ m_pImpl->m_pRegisteredBookmark);
+ }
+}
+
+void SAL_CALL SwXBookmark::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_pRegisteredBookmark)
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+
+void SAL_CALL SwXBookmark::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_pRegisteredBookmark ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+OUString SAL_CALL SwXBookmark::getName()
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return (m_pImpl->m_pRegisteredBookmark)
+ ? m_pImpl->m_pRegisteredBookmark->GetName()
+ : m_pImpl->m_sMarkName;
+}
+
+void SAL_CALL SwXBookmark::setName(const OUString& rName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_pRegisteredBookmark)
+ {
+ m_pImpl->m_sMarkName = rName;
+ }
+ if (!m_pImpl->m_pRegisteredBookmark || (getName() == rName))
+ {
+ return;
+ }
+ IDocumentMarkAccess *const pMarkAccess =
+ m_pImpl->m_pDoc->getIDocumentMarkAccess();
+ if(pMarkAccess->findMark(rName) != pMarkAccess->getMarksEnd())
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwPaM aPam(m_pImpl->m_pRegisteredBookmark->GetMarkPos());
+ if (m_pImpl->m_pRegisteredBookmark->IsExpanded())
+ {
+ aPam.SetMark();
+ *aPam.GetMark() = m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos();
+ }
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, lcl_QuoteName(getName()));
+ aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
+ aRewriter.AddRule(UNDO_ARG3, lcl_QuoteName(rName));
+
+ m_pImpl->m_pDoc->StartUndo(UNDO_BOOKMARK_RENAME, &aRewriter);
+ pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName);
+ m_pImpl->m_pDoc->EndUndo(UNDO_BOOKMARK_RENAME, NULL);
+}
+
+OUString SAL_CALL
+SwXBookmark::getImplementationName() throw (uno::RuntimeException)
+{
+ return OUString::createFromAscii("SwXBookmark");
+}
+
+static char const*const g_ServicesBookmark[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.Bookmark",
+ "com.sun.star.document.LinkTarget",
+};
+static const size_t g_nServicesBookmark(
+ sizeof(g_ServicesBookmark)/sizeof(g_ServicesBookmark[0]));
+
+sal_Bool SAL_CALL SwXBookmark::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesBookmark, g_ServicesBookmark, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXBookmark::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesBookmark, g_ServicesBookmark);
+}
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXBookmark::GetCoreObject()
+{
+ return dynamic_cast< ::sfx2::Metadatable* >(m_pImpl->m_pRegisteredBookmark);
+}
+
+uno::Reference<frame::XModel> SwXBookmark::GetModel()
+{
+ if (m_pImpl->m_pDoc)
+ {
+ SwDocShell const * const pShell( m_pImpl->m_pDoc->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXBookmark::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef(
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_BOOKMARK)
+ ->getPropertySetInfo() );
+ return xRef;
+}
+
+void SAL_CALL
+SwXBookmark::setPropertyValue(const OUString& PropertyName,
+ const uno::Any& /*rValue*/)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // nothing to set here
+ throw lang::IllegalArgumentException( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
+ + PropertyName, static_cast< cppu::OWeakObject * >(this), 0 );
+}
+
+uno::Any SAL_CALL SwXBookmark::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_NAME)))
+ {
+ aRet <<= getName();
+ }
+ }
+ return aRet;
+}
+
+void SAL_CALL
+SwXBookmark::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXBookmark::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXBookmark::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXBookmark::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXBookmark::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXBookmark::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXBookmark::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXBookmark::removeVetoableChangeListener(): not implemented");
+}
+
+/******************************************************************
+ * SwXFieldmark
+ ******************************************************************/
+
+SwXFieldmark::SwXFieldmark(bool _isReplacementObject, ::sw::mark::IMark* pBkm, SwDoc* pDc)
+ : SwXFieldmark_Base(pBkm, pDc)
+ , isReplacementObject(_isReplacementObject)
+{ }
+
+void SwXFieldmarkParameters::insertByName(const OUString& aName, const uno::Any& aElement)
+ throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark::parameter_map_t* pParameters = getCoreParameters();
+ if(pParameters->find(aName) != pParameters->end())
+ throw container::ElementExistException();
+ (*pParameters)[aName] = aElement;
+}
+
+void SwXFieldmarkParameters::removeByName(const OUString& aName)
+ throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!getCoreParameters()->erase(aName))
+ throw container::NoSuchElementException();
+}
+
+void SwXFieldmarkParameters::replaceByName(const OUString& aName, const uno::Any& aElement)
+ throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark::parameter_map_t* pParameters = getCoreParameters();
+ IFieldmark::parameter_map_t::iterator pEntry = pParameters->find(aName);
+ if(pEntry == pParameters->end())
+ throw container::NoSuchElementException();
+ pEntry->second = aElement;
+}
+
+uno::Any SwXFieldmarkParameters::getByName(const OUString& aName)
+ throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark::parameter_map_t* pParameters = getCoreParameters();
+ IFieldmark::parameter_map_t::iterator pEntry = pParameters->find(aName);
+ if(pEntry == pParameters->end())
+ throw container::NoSuchElementException();
+ return pEntry->second;
+}
+
+uno::Sequence<OUString> SwXFieldmarkParameters::getElementNames()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark::parameter_map_t* pParameters = getCoreParameters();
+ uno::Sequence<OUString> vResult(pParameters->size());
+ OUString* pOutEntry = vResult.getArray();
+ for(IFieldmark::parameter_map_t::iterator pEntry = pParameters->begin(); pEntry!=pParameters->end(); ++pEntry, ++pOutEntry)
+ *pOutEntry = pEntry->first;
+ return vResult;
+}
+
+::sal_Bool SwXFieldmarkParameters::hasByName(const OUString& aName)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark::parameter_map_t* pParameters = getCoreParameters();
+ return (pParameters->find(aName) != pParameters->end());
+}
+
+uno::Type SwXFieldmarkParameters::getElementType()
+ throw (uno::RuntimeException)
+{
+ return ::cppu::UnoType< ::cppu::UnoVoidType>::get();
+}
+
+::sal_Bool SwXFieldmarkParameters::hasElements()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return !getCoreParameters()->empty();
+}
+
+void SwXFieldmarkParameters::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+
+IFieldmark::parameter_map_t* SwXFieldmarkParameters::getCoreParameters()
+ throw (uno::RuntimeException)
+{
+ const IFieldmark* pFieldmark = dynamic_cast< const IFieldmark* >(GetRegisteredIn());
+ if(!pFieldmark)
+ throw uno::RuntimeException();
+ return const_cast< IFieldmark* >(pFieldmark)->GetParameters();
+}
+
+
+void SwXFieldmark::attachToRange( const uno::Reference < text::XTextRange >& xTextRange )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ attachToRangeEx( xTextRange,
+ ( isReplacementObject ? IDocumentMarkAccess::CHECKBOX_FIELDMARK : IDocumentMarkAccess::TEXT_FIELDMARK ) );
+}
+
+::rtl::OUString SwXFieldmark::getFieldType(void)
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const IFieldmark *pBkm = dynamic_cast<const IFieldmark*>(GetBookmark());
+ if(!pBkm)
+ throw uno::RuntimeException();
+ return pBkm->GetFieldname();
+}
+
+void SwXFieldmark::setFieldType(const::rtl::OUString & fieldType)
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark *pBkm = const_cast<IFieldmark*>(
+ dynamic_cast<const IFieldmark*>(GetBookmark()));
+ if(!pBkm)
+ throw uno::RuntimeException();
+ pBkm->SetFieldname(fieldType);
+}
+
+uno::Reference<container::XNameContainer> SwXFieldmark::getParameters()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IFieldmark *pBkm = const_cast<IFieldmark*>(
+ dynamic_cast<const IFieldmark*>(GetBookmark()));
+ if(!pBkm)
+ throw uno::RuntimeException();
+ return uno::Reference<container::XNameContainer>(new SwXFieldmarkParameters(pBkm));
+}
+
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
new file mode 100644
index 000000000000..703389a58f7e
--- /dev/null
+++ b/sw/source/core/unocore/unochart.cxx
@@ -0,0 +1,3092 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <memory>
+#include <algorithm>
+
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/data/LabelOrigin.hpp>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/zforlist.hxx> // SvNumberFormatter
+#include <svtools/chartprettypainter.hxx>
+
+#include <tools/link.hxx>
+
+#include <XMLRangeHelper.hxx>
+#include <unochart.hxx>
+#include <swtable.hxx>
+#include <unoprnms.hxx>
+#include <unomap.hxx>
+#include <unomid.h>
+#include <unocrsr.hxx>
+#include <unotbl.hxx>
+#include <doc.hxx>
+#include <frmfmt.hxx>
+#include <docsh.hxx>
+#include <ndole.hxx>
+#include <swtable.hxx>
+#include <swtypes.hxx>
+#ifndef _UNOCORE_HRC
+#include <unocore.hrc>
+#endif
+
+#include <docary.hxx>
+
+#define SN_DATA_PROVIDER "com.sun.star.chart2.data.DataProvider"
+#define SN_DATA_SOURCE "com.sun.star.chart2.data.DataSource"
+#define SN_DATA_SEQUENCE "com.sun.star.chart2.data.DataSequence"
+#define SN_LABELED_DATA_SEQUENCE "com.sun.star.chart2.data.LabeledDataSequence"
+
+#define DIRECTION_DONT_KNOW -1
+#define DIRECTION_HAS_ERROR -2
+#define DIRECTION_COLS 0
+#define DIRECTION_ROWS 1
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+// from unotbl.cxx
+extern void lcl_GetCellPosition( const String &rCellName, sal_Int32 &rColumn, sal_Int32 &rRow);
+extern String lcl_GetCellName( sal_Int32 nColumn, sal_Int32 nRow );
+extern int lcl_CompareCellsByColFirst( const String &rCellName1, const String &rCellName2 );
+extern int lcl_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName2 );
+extern int lcl_CompareCellRanges(
+ const String &rRange1StartCell, const String &rRange1EndCell,
+ const String &rRange2StartCell, const String &rRange2EndCell,
+ sal_Bool bCmpColsFirst );
+extern void lcl_NormalizeRange( String &rCell1, String &rCell2 );
+
+//////////////////////////////////////////////////////////////////////
+
+//static
+void SwChartHelper::DoUpdateAllCharts( SwDoc* pDoc )
+{
+ if (!pDoc)
+ return;
+
+ uno::Reference< frame::XModel > xRes;
+
+ SwOLENode *pONd;
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *pDoc->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ if (0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+ ChartPrettyPainter::IsChart( pONd->GetOLEObj().GetObject() ) )
+ {
+ // Load the object and set modified
+
+ uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+ {
+ try
+ {
+ uno::Reference< util::XModifiable > xModif( xIP->getComponent(), uno::UNO_QUERY_THROW );
+ xModif->setModified( sal_True );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ }
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+SwChartLockController_Helper::SwChartLockController_Helper( SwDoc *pDocument ) :
+ pDoc( pDocument )
+{
+ aUnlockTimer.SetTimeout( 1500 );
+ aUnlockTimer.SetTimeoutHdl( LINK( this, SwChartLockController_Helper, DoUnlockAllCharts ));
+}
+
+
+SwChartLockController_Helper::~SwChartLockController_Helper()
+{
+ if (pDoc) // still connected?
+ Disconnect();
+}
+
+
+void SwChartLockController_Helper::StartOrContinueLocking()
+{
+ if (!bIsLocked)
+ LockAllCharts();
+ aUnlockTimer.Start(); // start or continue time of locking
+}
+
+
+void SwChartLockController_Helper::Disconnect()
+{
+ aUnlockTimer.Stop();
+ UnlockAllCharts();
+ pDoc = 0;
+}
+
+
+void SwChartLockController_Helper::LockUnlockAllCharts( sal_Bool bLock )
+{
+ if (!pDoc)
+ return;
+
+ const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
+ for( USHORT n = 0; n < rTblFmts.Count(); ++n )
+ {
+ SwTable* pTmpTbl;
+ const SwTableNode* pTblNd;
+ SwFrmFmt* pFmt = rTblFmts[ n ];
+
+ if( 0 != ( pTmpTbl = SwTable::FindTable( pFmt ) ) &&
+ 0 != ( pTblNd = pTmpTbl->GetTableNode() ) &&
+ pTblNd->GetNodes().IsDocNodes() )
+ {
+ uno::Reference< frame::XModel > xRes;
+
+ String aName( pTmpTbl->GetFrmFmt()->GetName() );
+ SwOLENode *pONd;
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *pDoc->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ if (0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+ pONd->GetChartTblName().Len() > 0 /* is chart object? */)
+ {
+ uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+ {
+ xRes = uno::Reference < frame::XModel >( xIP->getComponent(), uno::UNO_QUERY );
+ if (xRes.is())
+ {
+ if (bLock)
+ xRes->lockControllers();
+ else
+ xRes->unlockControllers();
+ }
+ }
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+ }
+ }
+
+ bIsLocked = bLock;
+}
+
+
+IMPL_LINK( SwChartLockController_Helper, DoUnlockAllCharts, Timer *, /*pTimer*/ )
+{
+ UnlockAllCharts();
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+static osl::Mutex & GetChartMutex()
+{
+ static osl::Mutex aMutex;
+ return aMutex;
+}
+
+
+static void LaunchModifiedEvent(
+ ::cppu::OInterfaceContainerHelper &rICH,
+ const uno::Reference< uno::XInterface > &rxI )
+{
+ lang::EventObject aEvtObj( rxI );
+ cppu::OInterfaceIteratorHelper aIt( rICH );
+ while (aIt.hasMoreElements())
+ {
+ uno::Reference< util::XModifyListener > xRef( aIt.next(), uno::UNO_QUERY );
+ if (xRef.is())
+ xRef->modified( aEvtObj );
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+// rCellRangeName needs to be of one of the following formats:
+// - e.g. "A2:E5" or
+// - e.g. "Table1.A2:E5"
+sal_Bool FillRangeDescriptor(
+ SwRangeDescriptor &rDesc,
+ const String &rCellRangeName )
+{
+ xub_StrLen nToken = STRING_NOTFOUND == rCellRangeName.Search('.') ? 0 : 1;
+ String aCellRangeNoTableName( rCellRangeName.GetToken( nToken, '.' ) );
+ String aTLName( aCellRangeNoTableName.GetToken(0, ':') ); // name of top left cell
+ String aBRName( aCellRangeNoTableName.GetToken(1, ':') ); // name of bottom right cell
+ if(!aTLName.Len() || !aBRName.Len())
+ return sal_False;
+
+ rDesc.nTop = rDesc.nLeft = rDesc.nBottom = rDesc.nRight = -1;
+ lcl_GetCellPosition( aTLName, rDesc.nLeft, rDesc.nTop );
+ lcl_GetCellPosition( aBRName, rDesc.nRight, rDesc.nBottom );
+ rDesc.Normalize();
+ DBG_ASSERT( rDesc.nTop != -1 &&
+ rDesc.nLeft != -1 &&
+ rDesc.nBottom != -1 &&
+ rDesc.nRight != -1,
+ "failed to get range descriptor" );
+ DBG_ASSERT( rDesc.nTop <= rDesc.nBottom && rDesc.nLeft <= rDesc.nRight,
+ "invalid range descriptor");
+ return sal_True;
+}
+
+
+static String GetCellRangeName( SwFrmFmt &rTblFmt, SwUnoCrsr &rTblCrsr )
+{
+ String aRes;
+
+ //!! see also SwXTextTableCursor::getRangeName
+
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(&rTblCrsr);
+ if (!pUnoTblCrsr)
+ return String();
+ pUnoTblCrsr->MakeBoxSels();
+
+ const SwStartNode* pStart;
+ const SwTableBox* pStartBox = 0;
+ const SwTableBox* pEndBox = 0;
+
+ pStart = pUnoTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ if (pStart)
+ {
+ const SwTable* pTable = SwTable::FindTable( &rTblFmt );
+ pEndBox = pTable->GetTblBox( pStart->GetIndex());
+ aRes = pEndBox->GetName();
+
+ if(pUnoTblCrsr->HasMark())
+ {
+ pStart = pUnoTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
+ pStartBox = pTable->GetTblBox( pStart->GetIndex());
+ }
+ DBG_ASSERT( pStartBox, "start box not found" );
+ DBG_ASSERT( pEndBox, "end box not found" );
+ // need to switch start and end?
+ if (*pUnoTblCrsr->GetPoint() < *pUnoTblCrsr->GetMark())
+ {
+ const SwTableBox* pTmpBox = pStartBox;
+ pStartBox = pEndBox;
+ pEndBox = pTmpBox;
+ }
+
+ aRes = pStartBox->GetName();
+ aRes += (sal_Unicode)':';
+ if (pEndBox)
+ aRes += pEndBox->GetName();
+ else
+ aRes += pStartBox->GetName();
+ }
+
+ return aRes;
+}
+
+
+static String GetRangeRepFromTableAndCells( const String &rTableName,
+ const String &rStartCell, const String &rEndCell,
+ sal_Bool bForceEndCellName )
+{
+ DBG_ASSERT( rTableName.Len(), "table name missing" );
+ DBG_ASSERT( rStartCell.Len(), "cell name missing" );
+ String aRes( rTableName );
+ aRes += (sal_Unicode) '.';
+ aRes += rStartCell;
+
+ if (rEndCell.Len())
+ {
+ aRes += (sal_Unicode) ':';
+ aRes += rEndCell;
+ }
+ else if (bForceEndCellName)
+ {
+ aRes += (sal_Unicode) ':';
+ aRes += rStartCell;
+ }
+
+ return aRes;
+}
+
+
+static sal_Bool GetTableAndCellsFromRangeRep(
+ const OUString &rRangeRepresentation,
+ String &rTblName,
+ String &rStartCell,
+ String &rEndCell,
+ sal_Bool bSortStartEndCells = sal_True )
+{
+ // parse range representation for table name and cell/range names
+ // accepted format sth like: "Table1.A2:C5" , "Table2.A2.1:B3.2"
+ String aTblName; // table name
+ OUString aRange; // cell range
+ String aStartCell; // name of top left cell
+ String aEndCell; // name of bottom right cell
+ sal_Int32 nIdx = rRangeRepresentation.indexOf( '.' );
+ if (nIdx >= 0)
+ {
+ aTblName = rRangeRepresentation.copy( 0, nIdx );
+ aRange = rRangeRepresentation.copy( nIdx + 1 );
+ sal_Int32 nPos = aRange.indexOf( ':' );
+ if (nPos >= 0) // a cell-range like "Table1.A2:D4"
+ {
+ aStartCell = aRange.copy( 0, nPos );
+ aEndCell = aRange.copy( nPos + 1 );
+
+ // need to switch start and end cell ?
+ // (does not check for normalization here)
+ if (bSortStartEndCells && 1 == lcl_CompareCellsByColFirst( aStartCell, aEndCell ))
+ {
+ String aTmp( aStartCell );
+ aStartCell = aEndCell;
+ aEndCell = aTmp;
+ }
+ }
+ else // a single cell like in "Table1.B3"
+ {
+ aStartCell = aEndCell = aRange;
+ }
+ }
+
+ sal_Bool bSuccess = aTblName.Len() != 0 &&
+ aStartCell.Len() != 0 && aEndCell.Len() != 0;
+ if (bSuccess)
+ {
+ rTblName = aTblName;
+ rStartCell = aStartCell;
+ rEndCell = aEndCell;
+ }
+ return bSuccess;
+}
+
+
+static void GetTableByName( const SwDoc &rDoc, const String &rTableName,
+ SwFrmFmt **ppTblFmt, SwTable **ppTable)
+{
+ SwFrmFmt *pTblFmt = NULL;
+
+ // find frame format of table
+ //! see SwXTextTables::getByName
+ sal_uInt16 nCount = rDoc.GetTblFrmFmtCount(sal_True);
+ for (sal_uInt16 i = 0; i < nCount && !pTblFmt; ++i)
+ {
+ SwFrmFmt& rTblFmt = rDoc.GetTblFrmFmt(i, sal_True);
+ if(rTableName == rTblFmt.GetName())
+ pTblFmt = &rTblFmt;
+ }
+
+ if (ppTblFmt)
+ *ppTblFmt = pTblFmt;
+
+ if (ppTable)
+ *ppTable = pTblFmt ? SwTable::FindTable( pTblFmt ) : 0;
+}
+
+
+static void GetFormatAndCreateCursorFromRangeRep(
+ const SwDoc *pDoc,
+ const OUString &rRangeRepresentation, // must be a single range (i.e. so called sub-range)
+ SwFrmFmt **ppTblFmt, // will be set to the table format of the table used in the range representation
+ SwUnoCrsr **ppUnoCrsr ) // will be set to cursor spanning the cell range
+ // (cursor will be created!)
+{
+ String aTblName; // table name
+ String aStartCell; // name of top left cell
+ String aEndCell; // name of bottom right cell
+ sal_Bool bNamesFound = GetTableAndCellsFromRangeRep( rRangeRepresentation,
+ aTblName, aStartCell, aEndCell );
+
+ if (!bNamesFound)
+ {
+ if (ppTblFmt)
+ *ppTblFmt = NULL;
+ if (ppUnoCrsr)
+ *ppUnoCrsr = NULL;
+ }
+ else
+ {
+ SwFrmFmt *pTblFmt = NULL;
+
+ // is the correct table format already provided?
+ if (*ppTblFmt != NULL && (*ppTblFmt)->GetName() == aTblName)
+ pTblFmt = *ppTblFmt;
+ else if (ppTblFmt)
+ GetTableByName( *pDoc, aTblName, &pTblFmt, NULL );
+
+ if (ppTblFmt)
+ *ppTblFmt = pTblFmt;
+
+ if (ppUnoCrsr != NULL)
+ {
+ *ppUnoCrsr = NULL; // default result in case of failure
+
+ SwTable *pTable = pTblFmt ? SwTable::FindTable( pTblFmt ) : 0;
+ // create new SwUnoCrsr spanning the specified range
+ //! see also SwXTextTable::GetRangeByName
+ // --> OD 2007-08-03 #i80314#
+ // perform validation check. Thus, pass <true> as 2nd parameter to <SwTable::GetTblBox(..)>
+ const SwTableBox* pTLBox =
+ pTable ? pTable->GetTblBox( aStartCell, true ) : 0;
+ // <--
+ if(pTLBox)
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pTblFmt->GetDoc());
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // set cursor to top left box of range
+ SwUnoCrsr* pUnoCrsr = pTblFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ // --> OD 2007-08-03 #i80314#
+ // perform validation check. Thus, pass <true> as 2nd parameter to <SwTable::GetTblBox(..)>
+ const SwTableBox* pBRBox = pTable->GetTblBox( aEndCell, true );
+ // <--
+ if(pBRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+
+ if (ppUnoCrsr)
+ *ppUnoCrsr = pCrsr;
+ }
+ else
+ {
+ delete pUnoCrsr;
+ }
+ }
+ }
+ }
+}
+
+
+static sal_Bool GetSubranges( const OUString &rRangeRepresentation,
+ uno::Sequence< OUString > &rSubRanges, sal_Bool bNormalize )
+{
+ sal_Bool bRes = sal_True;
+ String aRangesStr( rRangeRepresentation );
+ xub_StrLen nLen = aRangesStr.GetTokenCount( ';' );
+ uno::Sequence< OUString > aRanges( nLen );
+
+ sal_Int32 nCnt = 0;
+ if (nLen != 0)
+ {
+ OUString *pRanges = aRanges.getArray();
+ String aFirstTable;
+ for ( xub_StrLen i = 0; i < nLen && bRes; ++i)
+ {
+ String aRange( aRangesStr.GetToken( i, ';' ) );
+ if (aRange.Len())
+ {
+ pRanges[nCnt] = aRange;
+
+ String aTableName, aStartCell, aEndCell;
+ bRes &= GetTableAndCellsFromRangeRep( aRange,
+ aTableName, aStartCell, aEndCell );
+
+ if (bNormalize)
+ {
+ lcl_NormalizeRange( aStartCell, aEndCell );
+ pRanges[nCnt] = GetRangeRepFromTableAndCells( aTableName,
+ aStartCell, aEndCell, sal_True );
+ }
+
+ // make sure to use only a single table
+ if (nCnt == 0)
+ aFirstTable = aTableName;
+ else
+ bRes &= aFirstTable == aTableName;
+
+ ++nCnt;
+ }
+ }
+ }
+ aRanges.realloc( nCnt );
+
+ rSubRanges = aRanges;
+ return bRes;
+}
+
+
+static void SortSubranges( uno::Sequence< OUString > &rSubRanges, sal_Bool bCmpByColumn )
+{
+ sal_Int32 nLen = rSubRanges.getLength();
+ OUString *pSubRanges = rSubRanges.getArray();
+
+ String aSmallestTblName;
+ String aSmallestStartCell;
+ String aSmallestEndCell;
+
+ for (sal_Int32 i = 0; i < nLen; ++i)
+ {
+ sal_Int32 nIdxOfSmallest = i;
+ GetTableAndCellsFromRangeRep( pSubRanges[nIdxOfSmallest],
+ aSmallestTblName, aSmallestStartCell, aSmallestEndCell );
+ if (aSmallestEndCell.Len() == 0)
+ aSmallestEndCell = aSmallestStartCell;
+
+ for (sal_Int32 k = i+1; k < nLen; ++k)
+ {
+ // get cell names for sub range
+ String aTblName;
+ String aStartCell;
+ String aEndCell;
+ GetTableAndCellsFromRangeRep( pSubRanges[k],
+ aTblName, aStartCell, aEndCell );
+ if (aEndCell.Len() == 0)
+ aEndCell = aStartCell;
+
+ // compare cell ranges ( is the new one smaller? )
+ if (-1 == lcl_CompareCellRanges( aStartCell, aEndCell,
+ aSmallestStartCell, aSmallestEndCell, bCmpByColumn ))
+ {
+ nIdxOfSmallest = k;
+ aSmallestTblName = aTblName;
+ aSmallestStartCell = aStartCell;
+ aSmallestEndCell = aEndCell;
+ }
+ }
+
+ // move smallest element to the start of the not sorted area
+ OUString aTmp( pSubRanges[ nIdxOfSmallest ] );
+ pSubRanges[ nIdxOfSmallest ] = pSubRanges[ i ];
+ pSubRanges[ i ] = aTmp;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+SwChartDataProvider::SwChartDataProvider( const SwDoc* pSwDoc ) :
+ aEvtListeners( GetChartMutex() ),
+ pDoc( pSwDoc )
+{
+ bDisposed = sal_False;
+}
+
+
+SwChartDataProvider::~SwChartDataProvider()
+{
+}
+
+uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createDataSource(
+ const uno::Sequence< beans::PropertyValue >& rArguments, sal_Bool bTestOnly )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Reference< chart2::data::XDataSource > xRes;
+
+ if (!pDoc)
+ throw uno::RuntimeException();
+
+ // get arguments
+ OUString aRangeRepresentation;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+ sal_Bool bFirstIsLabel = sal_False;
+ sal_Bool bDtaSrcIsColumns = sal_True; // true : DataSource will be sequence of columns
+ // false: DataSource will be sequence of rows
+ OUString aChartOleObjectName;//work around wrong writer ranges ( see Issue 58464 )
+ sal_Int32 nArgs = rArguments.getLength();
+ DBG_ASSERT( nArgs != 0, "no properties provided" );
+ if (nArgs == 0)
+ return xRes;
+ const beans::PropertyValue *pArg = rArguments.getConstArray();
+ for (sal_Int32 i = 0; i < nArgs; ++i)
+ {
+ if (pArg[i].Name.equalsAscii( "DataRowSource" ))
+ {
+ chart::ChartDataRowSource eSource;
+ if (!(pArg[i].Value >>= eSource))
+ {
+ sal_Int32 nTmp = 0;
+ if (!(pArg[i].Value >>= nTmp))
+ throw lang::IllegalArgumentException();
+ eSource = static_cast< chart::ChartDataRowSource >( nTmp );
+ }
+ bDtaSrcIsColumns = eSource == chart::ChartDataRowSource_COLUMNS;
+ }
+ else if (pArg[i].Name.equalsAscii( "FirstCellAsLabel" ))
+ {
+ if (!(pArg[i].Value >>= bFirstIsLabel))
+ throw lang::IllegalArgumentException();
+ }
+ else if (pArg[i].Name.equalsAscii( "CellRangeRepresentation" ))
+ {
+ if (!(pArg[i].Value >>= aRangeRepresentation))
+ throw lang::IllegalArgumentException();
+ }
+ else if (pArg[i].Name.equalsAscii( "SequenceMapping" ))
+ {
+ if (!(pArg[i].Value >>= aSequenceMapping))
+ throw lang::IllegalArgumentException();
+ }
+ else if (pArg[i].Name.equalsAscii( "ChartOleObjectName" ))
+ {
+ if (!(pArg[i].Value >>= aChartOleObjectName))
+ throw lang::IllegalArgumentException();
+ }
+ }
+
+ uno::Sequence< OUString > aSubRanges;
+ // get sub-ranges and check that they all are from the very same table
+ sal_Bool bOk = GetSubranges( aRangeRepresentation, aSubRanges, sal_True );
+
+ if (!bOk && pDoc && aChartOleObjectName.getLength() )
+ {
+ //try to correct the range here
+ //work around wrong writer ranges ( see Issue 58464 )
+ String aChartTableName;
+
+ const SwNodes& rNodes = pDoc->GetNodes();
+ for( ULONG nN = rNodes.Count(); nN--; )
+ {
+ SwNodePtr pNode = rNodes[nN];
+ if( !pNode )
+ continue;
+ const SwOLENode* pOleNode = pNode->GetOLENode();
+ if( !pOleNode )
+ continue;
+ const SwOLEObj& rOObj = pOleNode->GetOLEObj();
+ if( aChartOleObjectName.equals( rOObj.GetCurrentPersistName() ) )
+ {
+ aChartTableName = pOleNode->GetChartTblName();
+ break;
+ }
+ }
+
+ if( aChartTableName.Len() )
+ {
+ //the wrong range is still shifted one row down
+ //thus the first row is missing and an invalid row at the end is added.
+ //Therefore we need to shift the range one row up
+ SwRangeDescriptor aDesc;
+ if (aRangeRepresentation.getLength() == 0)
+ return xRes; // we cant handle this thus returning an empty references
+ aRangeRepresentation = aRangeRepresentation.copy( 1 ); // get rid of '.' to have only the cell range left
+ FillRangeDescriptor( aDesc, aRangeRepresentation );
+ aDesc.Normalize();
+ if (aDesc.nTop <= 0) // no chance to shift the range one row up?
+ return xRes; // we cant handle this thus returning an empty references
+ aDesc.nTop -= 1;
+ aDesc.nBottom -= 1;
+
+ String aNewStartCell( lcl_GetCellName( aDesc.nLeft, aDesc.nTop ) );
+ String aNewEndCell( lcl_GetCellName( aDesc.nRight, aDesc.nBottom ) );
+ aRangeRepresentation = GetRangeRepFromTableAndCells(
+ aChartTableName, aNewStartCell, aNewEndCell, sal_True );
+ bOk = GetSubranges( aRangeRepresentation, aSubRanges, sal_True );
+ }
+ }
+ if (!bOk) // different tables used, or incorrect range specifiers
+ throw lang::IllegalArgumentException();
+
+ SortSubranges( aSubRanges, bDtaSrcIsColumns );
+ const OUString *pSubRanges = aSubRanges.getConstArray();
+#if OSL_DEBUG_LEVEL > 1
+ {
+ sal_Int32 nSR = aSubRanges.getLength();
+ OUString *pSR = aSubRanges.getArray();
+ OUString aRg;
+ for (sal_Int32 i = 0; i < nSR; ++i)
+ {
+ aRg = pSR[i];
+ }
+ }
+#endif
+
+ // get table format for that single table from above
+ SwFrmFmt *pTblFmt = 0; // pointer to table format
+ SwUnoCrsr *pUnoCrsr = 0; // here required to check if the cells in the range do actually exist
+ std::auto_ptr< SwUnoCrsr > pAuto( pUnoCrsr ); // to end lifetime of object pointed to by pUnoCrsr
+ if (aSubRanges.getLength() > 0)
+ GetFormatAndCreateCursorFromRangeRep( pDoc, pSubRanges[0], &pTblFmt, &pUnoCrsr );
+ if (!pTblFmt || !pUnoCrsr)
+ throw lang::IllegalArgumentException();
+
+ if(pTblFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ if(pTable->IsTblComplex())
+ return xRes; // we cant handle this thus returning an empty references
+ else
+ {
+ // get a character map in the size of the table to mark
+ // all the ranges to use in
+ sal_Int32 nRows = pTable->GetTabLines().Count();
+ sal_Int32 nCols = pTable->GetTabLines().GetObject(0)->GetTabBoxes().Count();
+ std::vector< std::vector< sal_Char > > aMap( nRows );
+ for (sal_Int32 i = 0; i < nRows; ++i)
+ aMap[i].resize( nCols );
+
+ // iterate over subranges and mark used cells in above map
+ //!! by proceeding this way we automatically get rid of
+ //!! multiple listed or overlapping cell ranges which should
+ //!! just be ignored silently
+ sal_Int32 nSubRanges = aSubRanges.getLength();
+ for (sal_Int32 i = 0; i < nSubRanges; ++i)
+ {
+ String aTblName, aStartCell, aEndCell;
+ sal_Bool bOk2 = GetTableAndCellsFromRangeRep(
+ pSubRanges[i], aTblName, aStartCell, aEndCell );
+ (void) bOk2;
+ DBG_ASSERT( bOk2, "failed to get table and start/end cells" );
+
+ sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
+ lcl_GetCellPosition( aStartCell, nStartCol, nStartRow );
+ lcl_GetCellPosition( aEndCell, nEndCol, nEndRow );
+ DBG_ASSERT( nStartRow <= nEndRow && nStartCol <= nEndCol,
+ "cell range not normalized");
+
+ // test if the ranges span more than the available cells
+ if( nStartRow < 0 || nEndRow >= nRows ||
+ nStartCol < 0 || nEndCol >= nCols )
+ {
+ throw lang::IllegalArgumentException();
+ }
+ for (sal_Int32 k1 = nStartRow; k1 <= nEndRow; ++k1)
+ {
+ for (sal_Int32 k2 = nStartCol; k2 <= nEndCol; ++k2)
+ aMap[k1][k2] = 'x';
+ }
+ }
+
+ //
+ // find label and data sequences to use
+ //
+ sal_Int32 oi; // outer index (slower changing index)
+ sal_Int32 ii; // inner index (faster changing index)
+ sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
+ sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
+ std::vector< sal_Int32 > aLabelIdx( oiEnd );
+ std::vector< sal_Int32 > aDataStartIdx( oiEnd );
+ std::vector< sal_Int32 > aDataLen( oiEnd );
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ aLabelIdx[oi] = -1;
+ aDataStartIdx[oi] = -1;
+ aDataLen[oi] = 0;
+ }
+ //
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ ii = 0;
+ while (ii < iiEnd)
+ {
+ sal_Char &rChar = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii];
+
+ // label should be used but is not yet found?
+ if (rChar == 'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
+ {
+ aLabelIdx[oi] = ii;
+ rChar = 'L'; // setting a different char for labels here
+ // makes the test for the data sequence below
+ // easier
+ }
+
+ // find data sequence
+ if (rChar == 'x' && aDataStartIdx[oi] == -1)
+ {
+ aDataStartIdx[oi] = ii;
+
+ // get length of data sequence
+ sal_Int32 nL = 0;
+ sal_Char c;
+ while (ii< iiEnd && 'x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
+ {
+ ++nL; ++ii;
+ }
+ aDataLen[oi] = nL;
+
+ // check that there is no other seperate sequence of data
+ // to be found because that is not supported
+ while (ii < iiEnd)
+ {
+ if ('x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
+ throw lang::IllegalArgumentException();
+ ++ii;
+ }
+ }
+ else
+ ++ii;
+ }
+ }
+
+ // make some other consistency checks while calculating
+ // the number of XLabeledDataSequence to build:
+ // - labels should always be used or not at all
+ // - the data sequences should have equal non-zero length
+ sal_Int32 nNumLDS = 0;
+ if (oiEnd > 0)
+ {
+ sal_Int32 nFirstSeqLen = 0;
+ sal_Int32 nFirstSeqLabelIdx = -1;
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ sal_Bool bFirstFound = sal_False;
+ // row/col used at all?
+ if (aDataStartIdx[oi] != -1 &&
+ (!bFirstIsLabel || aLabelIdx[oi] != -1))
+ {
+ ++nNumLDS;
+ if (!bFirstFound)
+ {
+ nFirstSeqLen = aDataLen[oi];
+ nFirstSeqLabelIdx = aLabelIdx[oi];
+ bFirstFound = sal_True;
+ }
+ else
+ {
+ if (nFirstSeqLen != aDataLen[oi] ||
+ nFirstSeqLabelIdx != aLabelIdx[oi])
+ throw lang::IllegalArgumentException();
+ }
+ }
+ }
+ }
+ if (nNumLDS == 0)
+ throw lang::IllegalArgumentException();
+
+ // now we should have all necessary data to build a proper DataSource
+ // thus if we came this far there should be no further problem
+ if (bTestOnly)
+ return xRes; // have createDataSourcePossible return true
+
+ // create data source from found label and data sequences
+ uno::Sequence< uno::Reference< chart2::data::XDataSequence > > aLabelSeqs( nNumLDS );
+ uno::Reference< chart2::data::XDataSequence > *pLabelSeqs = aLabelSeqs.getArray();
+ uno::Sequence< uno::Reference< chart2::data::XDataSequence > > aDataSeqs( nNumLDS );
+ uno::Reference< chart2::data::XDataSequence > *pDataSeqs = aDataSeqs.getArray();
+ sal_Int32 nSeqsIdx = 0;
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ // row/col not used? (see if-statement above where nNumLDS was counted)
+ if (!(aDataStartIdx[oi] != -1 &&
+ (!bFirstIsLabel || aLabelIdx[oi] != -1)))
+ continue;
+
+ // get cell ranges for label and data
+ //
+ SwRangeDescriptor aLabelDesc;
+ SwRangeDescriptor aDataDesc;
+ if (bDtaSrcIsColumns) // use columns
+ {
+ aLabelDesc.nTop = aLabelIdx[oi];
+ aLabelDesc.nLeft = oi;
+ aLabelDesc.nBottom = aLabelDesc.nTop;
+ aLabelDesc.nRight = oi;
+
+ aDataDesc.nTop = aDataStartIdx[oi];
+ aDataDesc.nLeft = oi;
+ aDataDesc.nBottom = aDataDesc.nTop + aDataLen[oi] - 1;
+ aDataDesc.nRight = oi;
+ }
+ else // use rows
+ {
+ aLabelDesc.nTop = oi;
+ aLabelDesc.nLeft = aLabelIdx[oi];
+ aLabelDesc.nBottom = oi;
+ aLabelDesc.nRight = aLabelDesc.nLeft;
+
+ aDataDesc.nTop = oi;
+ aDataDesc.nLeft = aDataStartIdx[oi];
+ aDataDesc.nBottom = oi;
+ aDataDesc.nRight = aDataDesc.nLeft + aDataLen[oi] - 1;
+ }
+ String aBaseName( pTblFmt->GetName() );
+ aBaseName += '.';
+ //
+ String aLabelRange;
+ if (aLabelIdx[oi] != -1)
+ {
+ aLabelRange += aBaseName;
+ aLabelRange += lcl_GetCellName( aLabelDesc.nLeft, aLabelDesc.nTop );
+ aLabelRange += ':';
+ aLabelRange += lcl_GetCellName( aLabelDesc.nRight, aLabelDesc.nBottom );
+ }
+ //
+ String aDataRange;
+ if (aDataStartIdx[oi] != -1)
+ {
+ aDataRange += aBaseName;
+ aDataRange += lcl_GetCellName( aDataDesc.nLeft, aDataDesc.nTop );
+ aDataRange += ':';
+ aDataRange += lcl_GetCellName( aDataDesc.nRight, aDataDesc.nBottom );
+ }
+
+ // get cursors spanning the cell ranges for label and data
+ SwUnoCrsr *pLabelUnoCrsr = 0;
+ SwUnoCrsr *pDataUnoCrsr = 0;
+ GetFormatAndCreateCursorFromRangeRep( pDoc, aLabelRange, &pTblFmt, &pLabelUnoCrsr);
+ GetFormatAndCreateCursorFromRangeRep( pDoc, aDataRange, &pTblFmt, &pDataUnoCrsr);
+
+ // create XDataSequence's from cursors
+ if (pLabelUnoCrsr)
+ pLabelSeqs[ nSeqsIdx ] = new SwChartDataSequence( *this, *pTblFmt, pLabelUnoCrsr );
+ DBG_ASSERT( pDataUnoCrsr, "pointer to data sequence missing" );
+ if (pDataUnoCrsr)
+ pDataSeqs [ nSeqsIdx ] = new SwChartDataSequence( *this, *pTblFmt, pDataUnoCrsr );
+ if (pLabelUnoCrsr || pDataUnoCrsr)
+ ++nSeqsIdx;
+ }
+ DBG_ASSERT( nSeqsIdx == nNumLDS,
+ "mismatch between sequence size and num,ber of entries" );
+
+ // build data source from data and label sequences
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLDS( nNumLDS );
+ uno::Reference< chart2::data::XLabeledDataSequence > *pLDS = aLDS.getArray();
+ for (sal_Int32 i = 0; i < nNumLDS; ++i)
+ {
+ SwChartLabeledDataSequence *pLabeledDtaSeq = new SwChartLabeledDataSequence;
+ pLabeledDtaSeq->setLabel( pLabelSeqs[i] );
+ pLabeledDtaSeq->setValues( pDataSeqs[i] );
+ pLDS[i] = pLabeledDtaSeq;
+ }
+
+ // apply 'SequenceMapping' if it was provided
+ sal_Int32 nSequenceMappingLen = aSequenceMapping.getLength();
+ if (nSequenceMappingLen)
+ {
+ sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aOld_LDS( aLDS );
+ uno::Reference< chart2::data::XLabeledDataSequence > *pOld_LDS = aOld_LDS.getArray();
+
+ sal_Int32 nNewCnt = 0;
+ for (sal_Int32 i = 0; i < nSequenceMappingLen; ++i)
+ {
+ // check that index to be used is valid
+ // and has not yet been used
+ sal_Int32 nIdx = pSequenceMapping[i];
+ if (0 <= nIdx && nIdx < nNumLDS && pOld_LDS[nIdx].is())
+ {
+ pLDS[nNewCnt++] = pOld_LDS[nIdx];
+
+ // mark index as being used already (avoids duplicate entries)
+ pOld_LDS[nIdx].clear();
+ }
+ }
+ // add not yet used 'old' sequences to new one
+ for (sal_Int32 i = 0; i < nNumLDS; ++i)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ if (!pOld_LDS[i].is())
+ i = i;
+#endif
+ if (pOld_LDS[i].is())
+ pLDS[nNewCnt++] = pOld_LDS[i];
+ }
+ DBG_ASSERT( nNewCnt == nNumLDS, "unexpected size of resulting sequence" );
+ }
+
+ xRes = new SwChartDataSource( aLDS );
+ }
+ }
+
+ return xRes;
+}
+
+sal_Bool SAL_CALL SwChartDataProvider::createDataSourcePossible(
+ const uno::Sequence< beans::PropertyValue >& rArguments )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Bool bPossible = sal_True;
+ try
+ {
+ Impl_createDataSource( rArguments, sal_True );
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ bPossible = sal_False;
+ }
+
+ return bPossible;
+}
+
+uno::Reference< chart2::data::XDataSource > SAL_CALL SwChartDataProvider::createDataSource(
+ const uno::Sequence< beans::PropertyValue >& rArguments )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return Impl_createDataSource( rArguments );
+}
+
+////////////////////////////////////////////////////////////
+// SwChartDataProvider::GetBrokenCellRangeForExport
+//
+// fix for #i79009
+// we need to return a property that has the same value as the property
+// 'CellRangeRepresentation' but for all rows which are increased by one.
+// E.g. Table1:A1:D5 -> Table1:A2:D6
+// Since the problem is only for old charts which did not support multiple
+// we do not need to provide that property/string if the 'CellRangeRepresentation'
+// contains multiple ranges.
+OUString SwChartDataProvider::GetBrokenCellRangeForExport(
+ const OUString &rCellRangeRepresentation )
+{
+ OUString aRes;
+
+ // check that we do not have multiple ranges
+ if (-1 == rCellRangeRepresentation.indexOf( ';' ))
+ {
+ // get current cell and table names
+ String aTblName, aStartCell, aEndCell;
+ GetTableAndCellsFromRangeRep( rCellRangeRepresentation,
+ aTblName, aStartCell, aEndCell, sal_False );
+ sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
+ lcl_GetCellPosition( aStartCell, nStartCol, nStartRow );
+ lcl_GetCellPosition( aEndCell, nEndCol, nEndRow );
+
+ // get new cell names
+ ++nStartRow;
+ ++nEndRow;
+ aStartCell = lcl_GetCellName( nStartCol, nStartRow );
+ aEndCell = lcl_GetCellName( nEndCol, nEndRow );
+
+ aRes = GetRangeRepFromTableAndCells( aTblName,
+ aStartCell, aEndCell, sal_False );
+ }
+
+ return aRes;
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArguments(
+ const uno::Reference< chart2::data::XDataSource >& xDataSource )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Sequence< beans::PropertyValue > aResult;
+ if (!xDataSource.is())
+ return aResult;
+
+ const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDS_LDS( xDataSource->getDataSequences() );
+ const uno::Reference< chart2::data::XLabeledDataSequence > *pDS_LDS = aDS_LDS.getConstArray();
+ sal_Int32 nNumDS_LDS = aDS_LDS.getLength();
+
+ if (nNumDS_LDS == 0)
+ {
+ DBG_WARNING( "XLabeledDataSequence in data source contains 0 entries" );
+ return aResult;
+ }
+
+ SwFrmFmt *pTableFmt = 0;
+ SwTable *pTable = 0;
+ String aTableName;
+ sal_Int32 nTableRows = 0;
+ sal_Int32 nTableCols = 0;
+
+ // data used to build 'CellRangeRepresentation' from later on
+ std::vector< std::vector< sal_Char > > aMap;
+
+ uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS );
+ sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
+
+ String aCellRanges;
+ sal_Int16 nDtaSrcIsColumns = -1;// -1: don't know yet, 0: false, 1: true -2: neither
+ sal_Int32 nLabelSeqLen = -1; // used to see if labels are always used or not and have
+ // the expected size of 1 (i.e. if FirstCellAsLabel can
+ // be determined)
+ // -1: don't know yet, 0: not used, 1: always a single labe cell, ...
+ // -2: neither/failed
+// sal_Int32 nValuesSeqLen = -1; // used to see if all value sequences have the same size
+ for (sal_Int32 nDS1 = 0; nDS1 < nNumDS_LDS; ++nDS1)
+ {
+ uno::Reference< chart2::data::XLabeledDataSequence > xLabeledDataSequence( pDS_LDS[nDS1] );
+ if( !xLabeledDataSequence.is() )
+ {
+ DBG_ERROR("got NULL for XLabeledDataSequence from Data source");
+ continue;
+ }
+ const uno::Reference< chart2::data::XDataSequence > xCurLabel( xLabeledDataSequence->getLabel(), uno::UNO_QUERY );
+ const uno::Reference< chart2::data::XDataSequence > xCurValues( xLabeledDataSequence->getValues(), uno::UNO_QUERY );
+
+ // get sequence lengths for label and values.
+ // (0 length is Ok)
+ sal_Int32 nCurLabelSeqLen = -1;
+ sal_Int32 nCurValuesSeqLen = -1;
+ if (xCurLabel.is())
+ nCurLabelSeqLen = xCurLabel->getData().getLength();
+ if (xCurValues.is())
+ nCurValuesSeqLen = xCurValues->getData().getLength();
+
+ // check for consistent use of 'first cell as label'
+ if (nLabelSeqLen == -1) // set initial value to compare with below further on
+ nLabelSeqLen = nCurLabelSeqLen;
+ if (nLabelSeqLen != nCurLabelSeqLen)
+ nLabelSeqLen = -2; // failed / no consistent use of label cells
+
+ // get table and cell names for label and values data sequences
+ // (start and end cell will be sorted, i.e. start cell <= end cell)
+ String aLabelTblName, aLabelStartCell, aLabelEndCell;
+ String aValuesTblName, aValuesStartCell, aValuesEndCell;
+ String aLabelRange, aValuesRange;
+ if (xCurLabel.is())
+ aLabelRange = xCurLabel->getSourceRangeRepresentation();
+ if (xCurValues.is())
+ aValuesRange = xCurValues->getSourceRangeRepresentation();
+ if ((aLabelRange.Len() && !GetTableAndCellsFromRangeRep( aLabelRange,
+ aLabelTblName, aLabelStartCell, aLabelEndCell )) ||
+ !GetTableAndCellsFromRangeRep( aValuesRange,
+ aValuesTblName, aValuesStartCell, aValuesEndCell ))
+ {
+ return aResult; // failed -> return empty property sequence
+ }
+
+ // make sure all sequences use the same table
+ if (!aTableName.Len())
+ aTableName = aValuesTblName; // get initial value to compare with
+ if (!aTableName.Len() ||
+ aTableName != aValuesTblName ||
+ (aLabelTblName.Len() && aTableName != aLabelTblName))
+ {
+ return aResult; // failed -> return empty property sequence
+ }
+
+
+ // try to get 'DataRowSource' value (ROWS or COLUMNS) from inspecting
+ // first and last cell used in both sequences
+ //
+ sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
+ String aCell( aLabelStartCell.Len() ? aLabelStartCell : aValuesStartCell );
+ DBG_ASSERT( aCell.Len() , "start cell missing?" );
+ lcl_GetCellPosition( aCell, nFirstCol, nFirstRow);
+ lcl_GetCellPosition( aValuesEndCell, nLastCol, nLastRow);
+ //
+ sal_Int16 nDirection = -1; // -1: not yet set, 0: columns, 1: rows, -2: failed
+ if (nFirstCol == nLastCol && nFirstRow == nLastRow) // a single cell...
+ {
+ DBG_ASSERT( nCurLabelSeqLen == 0 && nCurValuesSeqLen == 1,
+ "trying to determine 'DataRowSource': something's fishy... should have been a single cell");
+ nDirection = 0; // default direction for a single cell should be 'columns'
+ }
+ else // more than one cell is availabale (in values and label together!)
+ {
+ if (nFirstCol == nLastCol && nFirstRow != nLastRow)
+ nDirection = 1;
+ else if (nFirstCol != nLastCol && nFirstRow == nLastRow)
+ nDirection = 0;
+ else
+ {
+ DBG_ERROR( "trying to determine 'DataRowSource': unexpected case found" );
+ nDirection = -2;
+ }
+ }
+ // check for consistent direction of data source
+ if (nDtaSrcIsColumns == -1) // set initial value to compare with below
+ nDtaSrcIsColumns = nDirection;
+ if (nDtaSrcIsColumns != nDirection)
+ {
+ nDtaSrcIsColumns = -2; // failed
+ }
+
+
+ if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
+ {
+ // build data to obtain 'SequenceMapping' later on
+ //
+ DBG_ASSERT( nDtaSrcIsColumns == 0 || /* rows */
+ nDtaSrcIsColumns == 1, /* columns */
+ "unexpected value for 'nDtaSrcIsColumns'" );
+ pSequenceMapping[nDS1] = nDtaSrcIsColumns ? nFirstCol : nFirstRow;
+
+
+ // build data used to determine 'CellRangeRepresentation' later on
+ //
+ GetTableByName( *pDoc, aTableName, &pTableFmt, &pTable );
+ if (!pTable || pTable->IsTblComplex())
+ return aResult; // failed -> return empty property sequence
+ nTableRows = pTable->GetTabLines().Count();
+ nTableCols = pTable->GetTabLines().GetObject(0)->GetTabBoxes().Count();
+ aMap.resize( nTableRows );
+ for (sal_Int32 i = 0; i < nTableRows; ++i)
+ aMap[i].resize( nTableCols );
+ //
+ if (aLabelStartCell.Len() && aLabelEndCell.Len())
+ {
+ sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
+ lcl_GetCellPosition( aLabelStartCell, nStartCol, nStartRow );
+ lcl_GetCellPosition( aLabelEndCell, nEndCol, nEndRow );
+ if (nStartRow < 0 || nEndRow >= nTableRows ||
+ nStartCol < 0 || nEndCol >= nTableCols)
+ {
+ return aResult; // failed -> return empty property sequence
+ }
+ for (sal_Int32 i = nStartRow; i <= nEndRow; ++i)
+ {
+ for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
+ {
+ sal_Char &rChar = aMap[i][k];
+ if (rChar == '\0') // check for overlapping values and/or labels
+ rChar = 'L';
+ else
+ return aResult; // failed -> return empty property sequence
+ }
+ }
+ }
+ if (aValuesStartCell.Len() && aValuesEndCell.Len())
+ {
+ sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
+ lcl_GetCellPosition( aValuesStartCell, nStartCol, nStartRow );
+ lcl_GetCellPosition( aValuesEndCell, nEndCol, nEndRow );
+ if (nStartRow < 0 || nEndRow >= nTableRows ||
+ nStartCol < 0 || nEndCol >= nTableCols)
+ {
+ return aResult; // failed -> return empty property sequence
+ }
+ for (sal_Int32 i = nStartRow; i <= nEndRow; ++i)
+ {
+ for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
+ {
+ sal_Char &rChar = aMap[i][k];
+ if (rChar == '\0') // check for overlapping values and/or labels
+ rChar = 'x';
+ else
+ return aResult; // failed -> return empty property sequence
+ }
+ }
+ }
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ // do some extra sanity checking that the length of the sequences
+ // matches their range representation
+ {
+ sal_Int32 nStartRow = -1, nStartCol = -1, nEndRow = -1, nEndCol = -1;
+ if (xCurLabel.is())
+ {
+ lcl_GetCellPosition( aLabelStartCell, nStartCol, nStartRow);
+ lcl_GetCellPosition( aLabelEndCell, nEndCol, nEndRow);
+ DBG_ASSERT( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurLabel->getData().getLength()) ||
+ (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurLabel->getData().getLength()),
+ "label sequence length does not match range representation!" );
+ }
+ if (xCurValues.is())
+ {
+ lcl_GetCellPosition( aValuesStartCell, nStartCol, nStartRow);
+ lcl_GetCellPosition( aValuesEndCell, nEndCol, nEndRow);
+ DBG_ASSERT( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurValues->getData().getLength()) ||
+ (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurValues->getData().getLength()),
+ "value sequence length does not match range representation!" );
+ }
+ }
+#endif
+ } // for
+
+
+ // build value for 'CellRangeRepresentation'
+ //
+ String aCellRangeBase( aTableName );
+ aCellRangeBase += '.';
+ String aCurRange;
+ for (sal_Int32 i = 0; i < nTableRows; ++i)
+ {
+ for (sal_Int32 k = 0; k < nTableCols; ++k)
+ {
+ if (aMap[i][k] != '\0') // top-left cell of a sub-range found
+ {
+ // find rectangular sub-range to use
+ sal_Int32 nRowIndex1 = i; // row index
+ sal_Int32 nColIndex1 = k; // column index
+ sal_Int32 nRowSubLen = 0;
+ sal_Int32 nColSubLen = 0;
+ while (nRowIndex1 < nTableRows && aMap[nRowIndex1++][k] != '\0')
+ ++nRowSubLen;
+ // be aware of shifted sequences!
+ // (according to the checks done prior the length should be ok)
+ while (nColIndex1 < nTableCols && aMap[i][nColIndex1] != '\0'
+ && aMap[i + nRowSubLen-1][nColIndex1] != '\0')
+ {
+ ++nColIndex1;
+ ++nColSubLen;
+ }
+ String aStartCell( lcl_GetCellName( k, i ) );
+ String aEndCell( lcl_GetCellName( k + nColSubLen - 1, i + nRowSubLen - 1) );
+ aCurRange = aCellRangeBase;
+ aCurRange += aStartCell;
+ aCurRange += ':';
+ aCurRange += aEndCell;
+ if (aCellRanges.Len())
+ aCellRanges += ';';
+ aCellRanges += aCurRange;
+
+ // clear already found sub-range from map
+ for (sal_Int32 nRowIndex2 = 0; nRowIndex2 < nRowSubLen; ++nRowIndex2)
+ for (sal_Int32 nColumnIndex2 = 0; nColumnIndex2 < nColSubLen; ++nColumnIndex2)
+ aMap[i + nRowIndex2][k + nColumnIndex2] = '\0';
+ }
+ }
+ }
+ // to be nice to the user we now sort the cell ranges according to
+ // rows or columns depending on the direction used in the data source
+ uno::Sequence< OUString > aSortedRanges;
+ GetSubranges( aCellRanges, aSortedRanges, sal_False /*sub ranges should already be normalized*/ );
+ SortSubranges( aSortedRanges, (nDtaSrcIsColumns == 1) );
+ sal_Int32 nSortedRanges = aSortedRanges.getLength();
+ const OUString *pSortedRanges = aSortedRanges.getConstArray();
+ OUString aSortedCellRanges;
+ for (sal_Int32 i = 0; i < nSortedRanges; ++i)
+ {
+ if (aSortedCellRanges.getLength())
+ aSortedCellRanges += OUString::valueOf( (sal_Unicode) ';');
+ aSortedCellRanges += pSortedRanges[i];
+ }
+
+
+ // build value for 'SequenceMapping'
+ //
+ uno::Sequence< sal_Int32 > aSortedMapping( aSequenceMapping );
+ sal_Int32 *pSortedMapping = aSortedMapping.getArray();
+ std::sort( pSortedMapping, pSortedMapping + aSortedMapping.getLength() );
+ DBG_ASSERT( aSortedMapping.getLength() == nNumDS_LDS, "unexpected size of sequence" );
+ sal_Bool bNeedSequenceMapping = sal_False;
+ for (sal_Int32 i = 0; i < nNumDS_LDS; ++i)
+ {
+ sal_Int32 *pIt = std::find( pSortedMapping, pSortedMapping + nNumDS_LDS,
+ pSequenceMapping[i] );
+ DBG_ASSERT( pIt, "index not found" );
+ if (!pIt)
+ return aResult; // failed -> return empty property sequence
+ pSequenceMapping[i] = pIt - pSortedMapping;
+
+ if (i != pSequenceMapping[i])
+ bNeedSequenceMapping = sal_True;
+ }
+
+ // check if 'SequenceMapping' is actually not required...
+ // (don't write unnecessary properties to the XML file)
+ if (!bNeedSequenceMapping)
+ aSequenceMapping.realloc(0);
+
+
+#ifdef TL_NOT_USED // in the end chart2 did not want to have the sequence minimized
+ // try to shorten the 'SequenceMapping' as much as possible
+ sal_Int32 k;
+ for (k = nNumDS_LDS - 1; k >= 0; --k)
+ {
+ if (pSequenceMapping[k] != k)
+ break;
+ }
+ aSequenceMapping.realloc( k + 1 );
+#endif
+
+
+ //
+ // build resulting properties
+ //
+ DBG_ASSERT(nLabelSeqLen >= 0 || nLabelSeqLen == -2 /*not used*/,
+ "unexpected value for 'nLabelSeqLen'" );
+ sal_Bool bFirstCellIsLabel = sal_False; // default value if 'nLabelSeqLen' could not properly determined
+ if (nLabelSeqLen > 0) // == 0 means no label sequence in use
+ bFirstCellIsLabel = sal_True;
+ //
+ DBG_ASSERT( aSortedCellRanges.getLength(), "CellRangeRepresentation missing" );
+ OUString aBrokenCellRangeForExport( GetBrokenCellRangeForExport( aSortedCellRanges ) );
+ //
+ aResult.realloc(5);
+ sal_Int32 nProps = 0;
+ aResult[nProps ].Name = C2U("FirstCellAsLabel");
+ aResult[nProps++].Value <<= bFirstCellIsLabel;
+ aResult[nProps ].Name = C2U("CellRangeRepresentation");
+ aResult[nProps++].Value <<= aSortedCellRanges;
+ if (0 != aBrokenCellRangeForExport.getLength())
+ {
+ aResult[nProps ].Name = C2U("BrokenCellRangeForExport");
+ aResult[nProps++].Value <<= aBrokenCellRangeForExport;
+ }
+ if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
+ {
+ chart::ChartDataRowSource eDataRowSource = (nDtaSrcIsColumns == 1) ?
+ chart::ChartDataRowSource_COLUMNS : chart::ChartDataRowSource_ROWS;
+ aResult[nProps ].Name = C2U("DataRowSource");
+ aResult[nProps++].Value <<= eDataRowSource;
+
+ if (aSequenceMapping.getLength() != 0)
+ {
+ aResult[nProps ].Name = C2U("SequenceMapping");
+ aResult[nProps++].Value <<= aSequenceMapping;
+ }
+ }
+ aResult.realloc( nProps );
+
+ return aResult;
+}
+
+uno::Reference< chart2::data::XDataSequence > SwChartDataProvider::Impl_createDataSequenceByRangeRepresentation(
+ const OUString& rRangeRepresentation, sal_Bool bTestOnly )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ SwFrmFmt *pTblFmt = 0; // pointer to table format
+ SwUnoCrsr *pUnoCrsr = 0; // pointer to new created cursor spanning the cell range
+ GetFormatAndCreateCursorFromRangeRep( pDoc, rRangeRepresentation,
+ &pTblFmt, &pUnoCrsr );
+ if (!pTblFmt || !pUnoCrsr)
+ throw lang::IllegalArgumentException();
+
+ // check that cursors point and mark are in a single row or column.
+ String aCellRange( GetCellRangeName( *pTblFmt, *pUnoCrsr ) );
+ SwRangeDescriptor aDesc;
+ FillRangeDescriptor( aDesc, aCellRange );
+ if (aDesc.nTop != aDesc.nBottom && aDesc.nLeft != aDesc.nRight)
+ throw lang::IllegalArgumentException();
+
+ DBG_ASSERT( pTblFmt && pUnoCrsr, "table format or cursor missing" );
+ uno::Reference< chart2::data::XDataSequence > xDataSeq;
+ if (!bTestOnly)
+ xDataSeq = new SwChartDataSequence( *this, *pTblFmt, pUnoCrsr );
+
+ return xDataSeq;
+}
+
+sal_Bool SAL_CALL SwChartDataProvider::createDataSequenceByRangeRepresentationPossible(
+ const OUString& rRangeRepresentation )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Bool bPossible = sal_True;
+ try
+ {
+ Impl_createDataSequenceByRangeRepresentation( rRangeRepresentation, sal_True );
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ bPossible = sal_False;
+ }
+
+ return bPossible;
+}
+
+uno::Reference< chart2::data::XDataSequence > SAL_CALL SwChartDataProvider::createDataSequenceByRangeRepresentation(
+ const OUString& rRangeRepresentation )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return Impl_createDataSequenceByRangeRepresentation( rRangeRepresentation );
+}
+
+
+uno::Reference< sheet::XRangeSelection > SAL_CALL SwChartDataProvider::getRangeSelection( )
+ throw (uno::RuntimeException)
+{
+ // note: it is no error to return nothing here
+ return uno::Reference< sheet::XRangeSelection >();
+}
+
+
+void SAL_CALL SwChartDataProvider::dispose( )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bMustDispose( sal_False );
+ {
+ osl::MutexGuard aGuard( GetChartMutex() );
+ bMustDispose = !bDisposed;
+ if (!bDisposed)
+ bDisposed = sal_True;
+ }
+ if (bMustDispose)
+ {
+ // dispose all data-sequences
+ Map_Set_DataSequenceRef_t::iterator aIt( aDataSequences.begin() );
+ while (aIt != aDataSequences.end())
+ {
+ DisposeAllDataSequences( (*aIt).first );
+ ++aIt;
+ }
+ // release all references to data-sequences
+ aDataSequences.clear();
+
+ // require listeners to release references to this object
+ lang::EventObject aEvtObj( dynamic_cast< chart2::data::XDataSequence * >(this) );
+ aEvtListeners.disposeAndClear( aEvtObj );
+ }
+}
+
+
+void SAL_CALL SwChartDataProvider::addEventListener(
+ const uno::Reference< lang::XEventListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aEvtListeners.addInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartDataProvider::removeEventListener(
+ const uno::Reference< lang::XEventListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aEvtListeners.removeInterface( rxListener );
+}
+
+
+
+OUString SAL_CALL SwChartDataProvider::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return C2U("SwChartDataProvider");
+}
+
+
+sal_Bool SAL_CALL SwChartDataProvider::supportsService(
+ const OUString& rServiceName )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return rServiceName.equalsAscii( SN_DATA_PROVIDER );
+}
+
+
+uno::Sequence< OUString > SAL_CALL SwChartDataProvider::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Sequence< OUString > aRes(1);
+ aRes.getArray()[0] = C2U( SN_DATA_PROVIDER );
+ return aRes;
+}
+
+
+void SwChartDataProvider::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ // actually this function should be superfluous (need to check later)
+ ClientModify(this, pOld, pNew );
+}
+
+
+void SwChartDataProvider::AddDataSequence( const SwTable &rTable, uno::Reference< chart2::data::XDataSequence > &rxDataSequence )
+{
+ aDataSequences[ &rTable ].insert( rxDataSequence );
+}
+
+
+void SwChartDataProvider::RemoveDataSequence( const SwTable &rTable, uno::Reference< chart2::data::XDataSequence > &rxDataSequence )
+{
+ aDataSequences[ &rTable ].erase( rxDataSequence );
+}
+
+
+void SwChartDataProvider::InvalidateTable( const SwTable *pTable )
+{
+ DBG_ASSERT( pTable, "table pointer is NULL" );
+ if (pTable)
+ {
+ if (!bDisposed)
+ pTable->GetFrmFmt()->GetDoc()->GetChartControllerHelper().StartOrContinueLocking();
+
+ const Set_DataSequenceRef_t &rSet = aDataSequences[ pTable ];
+ Set_DataSequenceRef_t::iterator aIt( rSet.begin() );
+ while (aIt != rSet.end())
+ {
+// uno::Reference< util::XModifiable > xRef( uno::Reference< chart2::data::XDataSequence >(*aIt), uno::UNO_QUERY );
+ uno::Reference< chart2::data::XDataSequence > xTemp(*aIt); // temporary needed for g++ 3.3.5
+ uno::Reference< util::XModifiable > xRef( xTemp, uno::UNO_QUERY );
+ if (xRef.is())
+ {
+ // mark the sequence as 'dirty' and notify listeners
+ xRef->setModified( sal_True );
+ }
+ ++aIt;
+ }
+ }
+}
+
+
+sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox &rBox )
+{
+ sal_Bool bRes = sal_False;
+ DBG_ASSERT( pTable, "table pointer is NULL" );
+ if (pTable)
+ {
+ if (!bDisposed)
+ pTable->GetFrmFmt()->GetDoc()->GetChartControllerHelper().StartOrContinueLocking();
+
+ Set_DataSequenceRef_t &rSet = aDataSequences[ pTable ];
+
+ // iterate over all data-sequences for that table...
+ Set_DataSequenceRef_t::iterator aIt( rSet.begin() );
+ Set_DataSequenceRef_t::iterator aEndIt( rSet.end() );
+ Set_DataSequenceRef_t::iterator aDelIt; // iterator used for deletion when appropriate
+ while (aIt != aEndIt)
+ {
+ SwChartDataSequence *pDataSeq = 0;
+ sal_Bool bNowEmpty = sal_False;
+
+ // check if weak reference is still valid...
+// uno::Reference< chart2::data::XDataSequence > xRef( uno::Reference< chart2::data::XDataSequence>(*aIt), uno::UNO_QUERY );
+ uno::Reference< chart2::data::XDataSequence > xTemp(*aIt); // temporary needed for g++ 3.3.5
+ uno::Reference< chart2::data::XDataSequence > xRef( xTemp, uno::UNO_QUERY );
+ if (xRef.is())
+ {
+ // then delete that table box (check if implementation cursor needs to be adjusted)
+ pDataSeq = static_cast< SwChartDataSequence * >( xRef.get() );
+ if (pDataSeq)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ OUString aRangeStr( pDataSeq->getSourceRangeRepresentation() );
+#endif
+ bNowEmpty = pDataSeq->DeleteBox( rBox );
+ if (bNowEmpty)
+ aDelIt = aIt;
+ }
+ }
+ ++aIt;
+
+ if (bNowEmpty)
+ {
+ rSet.erase( aDelIt );
+ if (pDataSeq)
+ pDataSeq->dispose(); // the current way to tell chart that sth. got removed
+ }
+ }
+ }
+ return bRes;
+}
+
+
+void SwChartDataProvider::DisposeAllDataSequences( const SwTable *pTable )
+{
+ DBG_ASSERT( pTable, "table pointer is NULL" );
+ if (pTable)
+ {
+ if (!bDisposed)
+ pTable->GetFrmFmt()->GetDoc()->GetChartControllerHelper().StartOrContinueLocking();
+
+ //! make a copy of the STL container!
+ //! This is necessary since calling 'dispose' will implicitly remove an element
+ //! of the original container, and thus any iterator in the original container
+ //! would become invalid.
+ const Set_DataSequenceRef_t aSet( aDataSequences[ pTable ] );
+
+ Set_DataSequenceRef_t::iterator aIt( aSet.begin() );
+ Set_DataSequenceRef_t::iterator aEndIt( aSet.end() );
+ while (aIt != aEndIt)
+ {
+// uno::Reference< lang::XComponent > xRef( uno::Reference< chart2::data::XDataSequence >(*aIt), uno::UNO_QUERY );
+ uno::Reference< chart2::data::XDataSequence > xTemp(*aIt); // temporary needed for g++ 3.3.5
+ uno::Reference< lang::XComponent > xRef( xTemp, uno::UNO_QUERY );
+ if (xRef.is())
+ {
+ xRef->dispose();
+ }
+ ++aIt;
+ }
+ }
+}
+
+
+////////////////////////////////////////
+// SwChartDataProvider::AddRowCols tries to notify charts of added columns
+// or rows and extends the value sequence respectively (if possible).
+// If those can be added to the end of existing value data-sequences those
+// sequences get mofdified accordingly and will send a modification
+// notification (calling 'setModified').
+//
+// Since this function is a work-around for non existent Writer core functionality
+// (no arbitrary multi-selection in tables that can be used to define a
+// data-sequence) this function will be somewhat unreliable.
+// For example we will only try to adapt value sequences. For this we assume
+// that a sequence of length 1 is a label sequence and those with length >= 2
+// we presume to be value sequences. Also new cells can only be added in the
+// direction the value sequence is already pointing (rows / cols) and at the
+// start or end of the values data-sequence.
+// Nothing needs to be done if the new cells are in between the table cursors
+// point and mark since data-sequence are considered to consist of all cells
+// between those.
+// New rows/cols need to be added already to the table before calling
+// this function.
+//
+void SwChartDataProvider::AddRowCols(
+ const SwTable &rTable,
+ const SwSelBoxes& rBoxes,
+ USHORT nLines, BOOL bBehind )
+{
+ if (rTable.IsTblComplex())
+ return;
+
+ const USHORT nBoxes = rBoxes.Count();
+ if (nBoxes < 1 || nLines < 1)
+ return;
+
+ SwTableBox* pFirstBox = *( rBoxes.GetData() + 0 );
+ SwTableBox* pLastBox = *( rBoxes.GetData() + nBoxes - 1 );
+
+ sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
+ if (pFirstBox && pLastBox)
+ {
+ lcl_GetCellPosition( pFirstBox->GetName(), nFirstCol, nFirstRow );
+ lcl_GetCellPosition( pLastBox->GetName(), nLastCol, nLastRow );
+
+ bool bAddCols = false; // default; also to be used if nBoxes == 1 :-/
+ if (nFirstCol == nLastCol && nFirstRow != nLastRow)
+ bAddCols = true;
+ if (nFirstCol == nLastCol || nFirstRow == nLastRow)
+ {
+ //get range of indices in col/rows for new cells
+ sal_Int32 nFirstNewCol = nFirstCol;
+ sal_Int32 nLastNewCol = nLastCol;
+ sal_Int32 nFirstNewRow = bBehind ? nFirstRow + 1 : nFirstRow - nLines;
+ sal_Int32 nLastNewRow = nFirstNewRow - 1 + nLines;
+ if (bAddCols)
+ {
+ DBG_ASSERT( nFirstCol == nLastCol, "column indices seem broken" );
+ nFirstNewCol = bBehind ? nFirstCol + 1 : nFirstCol - nLines;
+ nLastNewCol = nFirstNewCol - 1 + nLines;
+ nFirstNewRow = nFirstRow;
+ nLastNewRow = nLastRow;
+ }
+
+ // iterate over all data-sequences for the table
+ const Set_DataSequenceRef_t &rSet = aDataSequences[ &rTable ];
+ Set_DataSequenceRef_t::iterator aIt( rSet.begin() );
+ while (aIt != rSet.end())
+ {
+// uno::Reference< chart2::data::XTextualDataSequence > xRef( uno::Reference< chart2::data::XDataSequence >(*aIt), uno::UNO_QUERY );
+ uno::Reference< chart2::data::XDataSequence > xTemp(*aIt); // temporary needed for g++ 3.3.5
+ uno::Reference< chart2::data::XTextualDataSequence > xRef( xTemp, uno::UNO_QUERY );
+ if (xRef.is())
+ {
+ const sal_Int32 nLen = xRef->getTextualData().getLength();
+ if (nLen > 1) // value data-sequence ?
+ {
+ SwChartDataSequence *pDataSeq = 0;
+ uno::Reference< lang::XUnoTunnel > xTunnel( xRef, uno::UNO_QUERY );
+ if(xTunnel.is())
+ {
+ pDataSeq = reinterpret_cast< SwChartDataSequence * >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwChartDataSequence::getUnoTunnelId() )));
+
+ if (pDataSeq)
+ {
+ SwRangeDescriptor aDesc;
+ pDataSeq->FillRangeDesc( aDesc );
+
+ chart::ChartDataRowSource eDRSource = chart::ChartDataRowSource_COLUMNS;
+ if (aDesc.nTop == aDesc.nBottom && aDesc.nLeft != aDesc.nRight)
+ eDRSource = chart::ChartDataRowSource_ROWS;
+
+ if (!bAddCols && eDRSource == chart::ChartDataRowSource_COLUMNS)
+ {
+ // add rows: extend affected columns by newly added row cells
+ pDataSeq->ExtendTo( true, nFirstNewRow, nLines );
+ }
+ else if (bAddCols && eDRSource == chart::ChartDataRowSource_ROWS)
+ {
+ // add cols: extend affected rows by newly added column cells
+ pDataSeq->ExtendTo( false, nFirstNewCol, nLines );
+ }
+ }
+ }
+ }
+ }
+ ++aIt;
+ }
+
+ }
+ }
+}
+
+
+// XRangeXMLConversion ---------------------------------------------------
+
+rtl::OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const rtl::OUString& rRangeRepresentation )
+ throw ( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ String aRes;
+ String aRangeRepresentation( rRangeRepresentation );
+
+ // multiple ranges are delimeted by a ';' like in
+ // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges!
+ xub_StrLen nNumRanges = aRangeRepresentation.GetTokenCount( ';' );
+ SwTable* pFirstFoundTable = 0; // to check that only one table will be used
+ for (USHORT i = 0; i < nNumRanges; ++i)
+ {
+ String aRange( aRangeRepresentation.GetToken(i, ';') );
+ SwFrmFmt *pTblFmt = 0; // pointer to table format
+ // BM: For what should the check be necessary? for #i79009# it is required that NO check is done
+// SwUnoCrsr *pUnoCrsr = 0; // here required to check if the cells in the range do actually exist
+// std::auto_ptr< SwUnoCrsr > pAuto( pUnoCrsr ); // to end lifetime of object pointed to by pUnoCrsr
+ GetFormatAndCreateCursorFromRangeRep( pDoc, aRange, &pTblFmt, NULL );
+ if (!pTblFmt)
+ throw lang::IllegalArgumentException();
+// if (!pUnoCrsr)
+// throw uno::RuntimeException();
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ if (pTable->IsTblComplex())
+ throw uno::RuntimeException();
+
+ // check that there is only one table used in all ranges
+ if (!pFirstFoundTable)
+ pFirstFoundTable = pTable;
+ if (pTable != pFirstFoundTable)
+ throw lang::IllegalArgumentException();
+
+ String aTblName;
+ String aStartCell;
+ String aEndCell;
+ if (!GetTableAndCellsFromRangeRep( aRange, aTblName, aStartCell, aEndCell ))
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nCol, nRow;
+ lcl_GetCellPosition( aStartCell, nCol, nRow );
+ if (nCol < 0 || nRow < 0)
+ throw uno::RuntimeException();
+
+ //!! following objects/functions are implemented in XMLRangeHelper.?xx
+ //!! which is a copy of the respective file from chart2 !!
+ XMLRangeHelper::CellRange aCellRange;
+ aCellRange.aTableName = aTblName;
+ aCellRange.aUpperLeft.nColumn = nCol;
+ aCellRange.aUpperLeft.nRow = nRow;
+ aCellRange.aUpperLeft.bIsEmpty = false;
+ if (aStartCell != aEndCell && aEndCell.Len() != 0)
+ {
+ lcl_GetCellPosition( aEndCell, nCol, nRow );
+ if (nCol < 0 || nRow < 0)
+ throw uno::RuntimeException();
+
+ aCellRange.aLowerRight.nColumn = nCol;
+ aCellRange.aLowerRight.nRow = nRow;
+ aCellRange.aLowerRight.bIsEmpty = false;
+ }
+ String aTmp( XMLRangeHelper::getXMLStringFromCellRange( aCellRange ) );
+ if (aRes.Len()) // in case of multiple ranges add delimeter
+ aRes.AppendAscii( " " );
+ aRes += aTmp;
+ }
+
+ return aRes;
+}
+
+rtl::OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const rtl::OUString& rXMLRange )
+ throw ( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ String aRes;
+ String aXMLRange( rXMLRange );
+
+ // multiple ranges are delimeted by a ' ' like in
+ // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges!
+ xub_StrLen nNumRanges = aXMLRange.GetTokenCount( ' ' );
+ rtl::OUString aFirstFoundTable; // to check that only one table will be used
+ for (USHORT i = 0; i < nNumRanges; ++i)
+ {
+ String aRange( aXMLRange.GetToken(i, ' ') );
+
+ //!! following objects and function are implemented in XMLRangeHelper.?xx
+ //!! which is a copy of the respective file from chart2 !!
+ XMLRangeHelper::CellRange aCellRange( XMLRangeHelper::getCellRangeFromXMLString( aRange ));
+
+ // check that there is only one table used in all ranges
+ if (aFirstFoundTable.getLength() == 0)
+ aFirstFoundTable = aCellRange.aTableName;
+ if (aCellRange.aTableName != aFirstFoundTable)
+ throw lang::IllegalArgumentException();
+
+ OUString aTmp( aCellRange.aTableName );
+ aTmp += OUString::valueOf((sal_Unicode) '.');
+ aTmp += lcl_GetCellName( aCellRange.aUpperLeft.nColumn,
+ aCellRange.aUpperLeft.nRow );
+ // does cell range consist of more than a single cell?
+ if (!aCellRange.aLowerRight.bIsEmpty)
+ {
+ aTmp += OUString::valueOf((sal_Unicode) ':');
+ aTmp += lcl_GetCellName( aCellRange.aLowerRight.nColumn,
+ aCellRange.aLowerRight.nRow );
+ }
+
+ if (aRes.Len()) // in case of multiple ranges add delimeter
+ aRes.AppendAscii( ";" );
+ aRes += String(aTmp);
+ }
+
+ return aRes;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+SwChartDataSource::SwChartDataSource(
+ const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > &rLDS ) :
+ aLDS( rLDS )
+{
+}
+
+
+SwChartDataSource::~SwChartDataSource()
+{
+// delete pTblCrsr;
+}
+
+
+uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > SAL_CALL SwChartDataSource::getDataSequences( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return aLDS;
+}
+
+
+OUString SAL_CALL SwChartDataSource::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return C2U("SwChartDataSource");
+}
+
+
+sal_Bool SAL_CALL SwChartDataSource::supportsService(
+ const OUString& rServiceName )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return rServiceName.equalsAscii( SN_DATA_SOURCE );
+}
+
+
+uno::Sequence< OUString > SAL_CALL SwChartDataSource::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Sequence< OUString > aRes(1);
+ aRes.getArray()[0] = C2U( SN_DATA_SOURCE );
+ return aRes;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+SwChartDataSequence::SwChartDataSequence(
+ SwChartDataProvider &rProvider,
+ SwFrmFmt &rTblFmt,
+ SwUnoCrsr *pTableCursor ) :
+ SwClient( &rTblFmt ),
+ aEvtListeners( GetChartMutex() ),
+ aModifyListeners( GetChartMutex() ),
+ aRowLabelText( SW_RES( STR_CHART2_ROW_LABEL_TEXT ) ),
+ aColLabelText( SW_RES( STR_CHART2_COL_LABEL_TEXT ) ),
+ xDataProvider( &rProvider ),
+ pDataProvider( &rProvider ),
+ pTblCrsr( pTableCursor ),
+ aCursorDepend( this, pTableCursor ),
+ _pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_CHART2_DATA_SEQUENCE ) )
+{
+ bDisposed = sal_False;
+
+ acquire();
+ try
+ {
+ const SwTable* pTable = SwTable::FindTable( &rTblFmt );
+ if (pTable)
+ {
+ uno::Reference< chart2::data::XDataSequence > xRef( dynamic_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY );
+ pDataProvider->AddDataSequence( *pTable, xRef );
+ pDataProvider->addEventListener( dynamic_cast< lang::XEventListener * >(this) );
+ }
+ else {
+ DBG_ERROR( "table missing" );
+ }
+ }
+ catch (uno::RuntimeException &)
+ {
+ throw;
+ }
+ catch (uno::Exception &)
+ {
+ }
+ release();
+
+#if OSL_DEBUG_LEVEL > 1
+ OUString aRangeStr( getSourceRangeRepresentation() );
+
+ // check if it can properly convert into a SwUnoTableCrsr
+ // which is required for some functions
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ DBG_ASSERT(pUnoTblCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
+ (void) pUnoTblCrsr;
+#endif
+}
+
+
+SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
+ SwChartDataSequenceBaseClass(),
+ SwClient( rObj.GetFrmFmt() ),
+ aEvtListeners( GetChartMutex() ),
+ aModifyListeners( GetChartMutex() ),
+ aRole( rObj.aRole ),
+ aRowLabelText( SW_RES(STR_CHART2_ROW_LABEL_TEXT) ),
+ aColLabelText( SW_RES(STR_CHART2_COL_LABEL_TEXT) ),
+ xDataProvider( rObj.pDataProvider ),
+ pDataProvider( rObj.pDataProvider ),
+ pTblCrsr( rObj.pTblCrsr->Clone() ),
+ aCursorDepend( this, pTblCrsr ),
+ _pPropSet( rObj._pPropSet )
+{
+ bDisposed = sal_False;
+
+ acquire();
+ try
+ {
+ const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ if (pTable)
+ {
+ uno::Reference< chart2::data::XDataSequence > xRef( dynamic_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY );
+ pDataProvider->AddDataSequence( *pTable, xRef );
+ pDataProvider->addEventListener( dynamic_cast< lang::XEventListener * >(this) );
+ }
+ else {
+ DBG_ERROR( "table missing" );
+ }
+ }
+ catch (uno::RuntimeException &)
+ {
+ throw;
+ }
+ catch (uno::Exception &)
+ {
+ }
+ release();
+
+#if OSL_DEBUG_LEVEL > 1
+ OUString aRangeStr( getSourceRangeRepresentation() );
+
+ // check if it can properly convert into a SwUnoTableCrsr
+ // which is required for some functions
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ DBG_ASSERT(pUnoTblCrsr, "SwChartDataSequence: cursor not SwUnoTableCrsr");
+ (void) pUnoTblCrsr;
+#endif
+}
+
+
+SwChartDataSequence::~SwChartDataSequence()
+{
+ // since the data-provider holds only weak references to the data-sequence
+ // there should be no need here to release them explicitly...
+
+ delete pTblCrsr;
+}
+
+
+const uno::Sequence< sal_Int8 > & SwChartDataSequence::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+
+
+sal_Int64 SAL_CALL SwChartDataSequence::getSomething( const uno::Sequence< sal_Int8 > &rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+
+
+uno::Sequence< uno::Any > SAL_CALL SwChartDataSequence::getData( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Sequence< uno::Any > aRes;
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ if(pTblFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aDesc;
+ if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTblFmt, *pTblCrsr ) ))
+ {
+ //!! make copy of pTblCrsr (SwUnoCrsr )
+ // keep original cursor and make copy of it that gets handed
+ // over to the SwXCellRange object which takes ownership and
+ // thus will destroy the copy later.
+ SwXCellRange aRange( pTblCrsr->Clone(), *pTblFmt, aDesc );
+ aRange.GetDataSequence( &aRes, 0, 0 );
+ }
+ }
+ }
+ return aRes;
+}
+
+
+OUString SAL_CALL SwChartDataSequence::getSourceRangeRepresentation( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ String aRes;
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ if (pTblFmt)
+ {
+ aRes = pTblFmt->GetName();
+ String aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) );
+ DBG_ASSERT( aCellRange.Len() != 0, "failed to get cell range" );
+ aRes += (sal_Unicode) '.';
+ aRes += aCellRange;
+ }
+ return aRes;
+}
+
+uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
+ chart2::data::LabelOrigin eLabelOrigin )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Sequence< OUString > aLabels;
+
+ {
+ SwRangeDescriptor aDesc;
+ sal_Bool bOk sal_False;
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ SwTable* pTable = pTblFmt ? SwTable::FindTable( pTblFmt ) : 0;
+ if (!pTblFmt || !pTable || pTable->IsTblComplex())
+ throw uno::RuntimeException();
+ else
+ {
+ String aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) );
+ DBG_ASSERT( aCellRange.Len() != 0, "failed to get cell range" );
+ bOk = FillRangeDescriptor( aDesc, aCellRange );
+ DBG_ASSERT( bOk, "falied to get SwRangeDescriptor" );
+ }
+ if (bOk)
+ {
+ aDesc.Normalize();
+ sal_Int32 nColSpan = aDesc.nRight - aDesc.nLeft + 1;
+ sal_Int32 nRowSpan = aDesc.nBottom - aDesc.nTop + 1;
+ DBG_ASSERT( nColSpan == 1 || nRowSpan == 1,
+ "unexpected range of selected cells" );
+
+ String aTxt; // label text to be returned
+ sal_Bool bReturnEmptyTxt = sal_False;
+ sal_Bool bUseCol = sal_True;
+ if (eLabelOrigin == chart2::data::LabelOrigin_COLUMN)
+ bUseCol = sal_True;
+ else if (eLabelOrigin == chart2::data::LabelOrigin_ROW)
+ bUseCol = sal_False;
+ else if (eLabelOrigin == chart2::data::LabelOrigin_SHORT_SIDE)
+ {
+ bUseCol = nColSpan < nRowSpan;
+ bReturnEmptyTxt = nColSpan == nRowSpan;
+ }
+ else if (eLabelOrigin == chart2::data::LabelOrigin_LONG_SIDE)
+ {
+ bUseCol = nColSpan > nRowSpan;
+ bReturnEmptyTxt = nColSpan == nRowSpan;
+ }
+ else {
+ DBG_ERROR( "unexpected case" );
+ }
+
+ // build label sequence
+ //
+ sal_Int32 nSeqLen = bUseCol ? nColSpan : nRowSpan;
+ aLabels.realloc( nSeqLen );
+ OUString *pLabels = aLabels.getArray();
+ for (sal_Int32 i = 0; i < nSeqLen; ++i)
+ {
+ if (!bReturnEmptyTxt)
+ {
+ aTxt = bUseCol ? aColLabelText : aRowLabelText;
+ sal_Int32 nCol = aDesc.nLeft;
+ sal_Int32 nRow = aDesc.nTop;
+ if (bUseCol)
+ nCol = nCol + i;
+ else
+ nRow = nRow + i;
+ String aCellName( lcl_GetCellName( nCol, nRow ) );
+
+ xub_StrLen nLen = aCellName.Len();
+ if (nLen)
+ {
+ const sal_Unicode *pBuf = aCellName.GetBuffer();
+ const sal_Unicode *pEnd = pBuf + nLen;
+ while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9'))
+ ++pBuf;
+ // start of number found?
+ if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9'))
+ {
+ String aRplc;
+ String aNew;
+ if (bUseCol)
+ {
+ aRplc = String::CreateFromAscii( "%COLUMNLETTER" );
+ aNew = String( aCellName.GetBuffer(), static_cast<xub_StrLen>(pBuf - aCellName.GetBuffer()) );
+ }
+ else
+ {
+ aRplc = String::CreateFromAscii( "%ROWNUMBER" );
+ aNew = String( pBuf, static_cast<xub_StrLen>((aCellName.GetBuffer() + nLen) - pBuf) );
+ }
+ xub_StrLen nPos = aTxt.Search( aRplc );
+ if (nPos != STRING_NOTFOUND)
+ aTxt = aTxt.Replace( nPos, aRplc.Len(), aNew );
+ }
+ }
+ }
+ pLabels[i] = aTxt;
+ }
+ }
+ }
+
+ return aLabels;
+}
+
+::sal_Int32 SAL_CALL SwChartDataSequence::getNumberFormatKeyByIndex(
+ ::sal_Int32 /*nIndex*/ )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ return 0;
+}
+
+
+
+uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Sequence< OUString > aRes;
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ if(pTblFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aDesc;
+ if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTblFmt, *pTblCrsr ) ))
+ {
+ //!! make copy of pTblCrsr (SwUnoCrsr )
+ // keep original cursor and make copy of it that gets handed
+ // over to the SwXCellRange object which takes ownership and
+ // thus will destroy the copy later.
+ SwXCellRange aRange( pTblCrsr->Clone(), *pTblFmt, aDesc );
+ aRange.GetDataSequence( 0, &aRes, 0 );
+ }
+ }
+ }
+ return aRes;
+}
+
+
+uno::Sequence< double > SAL_CALL SwChartDataSequence::getNumericalData( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Sequence< double > aRes;
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ if(pTblFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aDesc;
+ if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTblFmt, *pTblCrsr ) ))
+ {
+ //!! make copy of pTblCrsr (SwUnoCrsr )
+ // keep original cursor and make copy of it that gets handed
+ // over to the SwXCellRange object which takes ownership and
+ // thus will destroy the copy later.
+ SwXCellRange aRange( pTblCrsr->Clone(), *pTblFmt, aDesc );
+
+ // get numerical values and make an effort to return the
+ // numerical value for text formatted cells
+ aRange.GetDataSequence( 0, 0, &aRes, sal_True );
+ }
+ }
+ }
+ return aRes;
+}
+
+
+uno::Reference< util::XCloneable > SAL_CALL SwChartDataSequence::createClone( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+ return new SwChartDataSequence( *this );
+}
+
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SwChartDataSequence::getPropertySetInfo( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ static uno::Reference< beans::XPropertySetInfo > xRes = _pPropSet->getPropertySetInfo();
+ return xRes;
+}
+
+
+void SAL_CALL SwChartDataSequence::setPropertyValue(
+ const OUString& rPropertyName,
+ const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ if (rPropertyName.equalsAscii( SW_PROP_NAME_STR( UNO_NAME_ROLE )))
+ {
+ if ( !(rValue >>= aRole) )
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw beans::UnknownPropertyException();
+}
+
+
+uno::Any SAL_CALL SwChartDataSequence::getPropertyValue(
+ const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Any aRes;
+ if (rPropertyName.equalsAscii( SW_PROP_NAME_STR( UNO_NAME_ROLE )))
+ aRes <<= aRole;
+ else
+ throw beans::UnknownPropertyException();
+
+ return aRes;
+}
+
+
+void SAL_CALL SwChartDataSequence::addPropertyChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //vos::OGuard aGuard( Application::GetSolarMutex() );
+ DBG_ERROR( "not implemented" );
+}
+
+
+void SAL_CALL SwChartDataSequence::removePropertyChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //vos::OGuard aGuard( Application::GetSolarMutex() );
+ DBG_ERROR( "not implemented" );
+}
+
+
+void SAL_CALL SwChartDataSequence::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //vos::OGuard aGuard( Application::GetSolarMutex() );
+ DBG_ERROR( "not implemented" );
+}
+
+
+void SAL_CALL SwChartDataSequence::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //vos::OGuard aGuard( Application::GetSolarMutex() );
+ DBG_ERROR( "not implemented" );
+}
+
+
+OUString SAL_CALL SwChartDataSequence::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return C2U("SwChartDataSequence");
+}
+
+
+sal_Bool SAL_CALL SwChartDataSequence::supportsService(
+ const OUString& rServiceName )
+ throw (uno::RuntimeException)
+{
+ return rServiceName.equalsAscii( SN_DATA_SEQUENCE );
+}
+
+
+uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Sequence< OUString > aRes(1);
+ aRes.getArray()[0] = C2U( SN_DATA_SEQUENCE );
+ return aRes;
+}
+
+
+void SwChartDataSequence::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew );
+
+ // table was deleted or cursor was deleted
+ if(!GetRegisteredIn() || !aCursorDepend.GetRegisteredIn())
+ {
+ pTblCrsr = 0;
+ dispose();
+ }
+ else
+ {
+ setModified( sal_True );
+ }
+}
+
+
+sal_Bool SAL_CALL SwChartDataSequence::isModified( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ return sal_True;
+}
+
+
+void SAL_CALL SwChartDataSequence::setModified(
+ ::sal_Bool bModified )
+ throw (beans::PropertyVetoException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ if (bModified)
+ LaunchModifiedEvent( aModifyListeners, dynamic_cast< XModifyBroadcaster * >(this) );
+}
+
+
+void SAL_CALL SwChartDataSequence::addModifyListener(
+ const uno::Reference< util::XModifyListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aModifyListeners.addInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartDataSequence::removeModifyListener(
+ const uno::Reference< util::XModifyListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aModifyListeners.removeInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartDataSequence::disposing( const lang::EventObject& rSource )
+ throw (uno::RuntimeException)
+{
+ if (bDisposed)
+ throw lang::DisposedException();
+ if (rSource.Source == xDataProvider)
+ {
+ pDataProvider = 0;
+ xDataProvider.clear();
+ }
+}
+
+
+void SAL_CALL SwChartDataSequence::dispose( )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bMustDispose( sal_False );
+ {
+ osl::MutexGuard aGuard( GetChartMutex() );
+ bMustDispose = !bDisposed;
+ if (!bDisposed)
+ bDisposed = sal_True;
+ }
+ if (bMustDispose)
+ {
+ bDisposed = sal_True;
+ if (pDataProvider)
+ {
+ const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ if (pTable)
+ {
+ uno::Reference< chart2::data::XDataSequence > xRef( dynamic_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY );
+ pDataProvider->RemoveDataSequence( *pTable, xRef );
+ }
+ else {
+ DBG_ERROR( "table missing" );
+ }
+ }
+
+ // require listeners to release references to this object
+ lang::EventObject aEvtObj( dynamic_cast< chart2::data::XDataSequence * >(this) );
+ aModifyListeners.disposeAndClear( aEvtObj );
+ aEvtListeners.disposeAndClear( aEvtObj );
+ }
+}
+
+
+void SAL_CALL SwChartDataSequence::addEventListener(
+ const uno::Reference< lang::XEventListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aEvtListeners.addInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartDataSequence::removeEventListener(
+ const uno::Reference< lang::XEventListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aEvtListeners.removeInterface( rxListener );
+}
+
+
+sal_Bool SwChartDataSequence::DeleteBox( const SwTableBox &rBox )
+{
+#if OSL_DEBUG_LEVEL > 1
+ String aBoxName( rBox.GetName() );
+#endif
+
+ // to be set if the last box of the data-sequence was removed here
+ sal_Bool bNowEmpty = sal_False;
+
+ // if the implementation cursor gets affected (i.e. thew box where it is located
+ // in gets removed) we need to move it before that... (otherwise it does not need to change)
+ //
+ const SwStartNode* pPointStartNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ const SwStartNode* pMarkStartNode = pTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
+ //
+ if (!pTblCrsr->HasMark() || (pPointStartNode == rBox.GetSttNd() && pMarkStartNode == rBox.GetSttNd()))
+ {
+ bNowEmpty = sal_True;
+ }
+ else if (pPointStartNode == rBox.GetSttNd() || pMarkStartNode == rBox.GetSttNd())
+ {
+ sal_Int32 nPointRow = -1, nPointCol = -1;
+ sal_Int32 nMarkRow = -1, nMarkCol = -1;
+ const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ String aPointCellName( pTable->GetTblBox( pPointStartNode->GetIndex() )->GetName() );
+ String aMarkCellName( pTable->GetTblBox( pMarkStartNode->GetIndex() )->GetName() );
+
+ lcl_GetCellPosition( aPointCellName, nPointCol, nPointRow );
+ lcl_GetCellPosition( aMarkCellName, nMarkCol, nMarkRow );
+ DBG_ASSERT( nPointRow >= 0 && nPointCol >= 0, "invalid row and col" );
+ DBG_ASSERT( nMarkRow >= 0 && nMarkCol >= 0, "invalid row and col" );
+
+ // move vertical or horizontal?
+ DBG_ASSERT( nPointRow == nMarkRow || nPointCol == nMarkCol,
+ "row/col indices not matching" );
+ DBG_ASSERT( nPointRow != nMarkRow || nPointCol != nMarkCol,
+ "point and mark are identical" );
+ sal_Bool bMoveVertical = (nPointCol == nMarkCol);
+ sal_Bool bMoveHorizontal = (nPointRow == nMarkRow);
+
+ // get movement direction
+ sal_Bool bMoveLeft = sal_False; // move left or right?
+ sal_Bool bMoveUp = sal_False; // move up or down?
+ if (bMoveVertical)
+ {
+ if (pPointStartNode == rBox.GetSttNd()) // move point?
+ bMoveUp = nPointRow > nMarkRow;
+ else // move mark
+ bMoveUp = nMarkRow > nPointRow;
+ }
+ else if (bMoveHorizontal)
+ {
+ if (pPointStartNode == rBox.GetSttNd()) // move point?
+ bMoveLeft = nPointCol > nMarkCol;
+ else // move mark
+ bMoveLeft = nMarkCol > nPointCol;
+ }
+ else {
+ DBG_ERROR( "neither vertical nor horizontal movement" );
+ }
+
+ // get new box (position) to use...
+ sal_Int32 nRow = (pPointStartNode == rBox.GetSttNd()) ? nPointRow : nMarkRow;
+ sal_Int32 nCol = (pPointStartNode == rBox.GetSttNd()) ? nPointCol : nMarkCol;
+ if (bMoveVertical)
+ nRow += bMoveUp ? -1 : +1;
+ if (bMoveHorizontal)
+ nCol += bMoveLeft ? -1 : +1;
+ String aNewCellName = lcl_GetCellName( nCol, nRow );
+ SwTableBox* pNewBox = (SwTableBox*) pTable->GetTblBox( aNewCellName );
+
+ if (pNewBox) // set new position (cell range) to use
+ {
+ // So erhält man den ersten Inhaltsnode in einer gegebenen Zelle:
+ // Zunächst einen SwNodeIndex auf den Node hinter dem SwStartNode der Box...
+ SwNodeIndex aIdx( *pNewBox->GetSttNd(), +1 );
+ // Dies kann ein SwCntntNode sein, kann aber auch ein Tabellen oder Sectionnode sein,
+ // deshalb das GoNext;
+ SwCntntNode *pCNd = aIdx.GetNode().GetCntntNode();
+ if (!pCNd)
+ pCNd = GetFrmFmt()->GetDoc()->GetNodes().GoNext( &aIdx );
+ //und damit kann man z.B. eine SwPosition erzeugen:
+ SwPosition aNewPos( *pCNd ); // new position to beused with cursor
+
+ // if the mark is to be changed make sure there is one...
+ if (pMarkStartNode == rBox.GetSttNd() && !pTblCrsr->HasMark())
+ pTblCrsr->SetMark();
+
+ // set cursor to new position...
+ SwPosition *pPos = (pPointStartNode == rBox.GetSttNd()) ?
+ pTblCrsr->GetPoint() : pTblCrsr->GetMark();
+ if (pPos)
+ {
+ pPos->nNode = aNewPos.nNode;
+ pPos->nContent = aNewPos.nContent;
+ }
+ else {
+ DBG_ERROR( "neither point nor mark available for change" );
+ }
+ }
+ else {
+ DBG_ERROR( "failed to get position" );
+ }
+ }
+
+ return bNowEmpty;
+}
+
+
+void SwChartDataSequence::FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const
+{
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ if(pTblFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ if(!pTable->IsTblComplex())
+ {
+ FillRangeDescriptor( rRangeDesc, GetCellRangeName( *pTblFmt, *pTblCrsr ) );
+ }
+ }
+}
+
+/**
+SwChartDataSequence::ExtendTo
+
+extends the data-sequence by new cells added at the end of the direction
+the data-sequence points to.
+If the cells are already within the range of the sequence nothing needs
+to be done.
+If the cells are beyond the end of the sequence (are not adjacent to the
+current last cell) nothing can be done. Only if the cells are adjacent to
+the last cell they can be added.
+
+@returns true if the data-sequence was changed.
+@param bExtendCols
+ specifies if columns or rows are to be extended
+@param nFirstNew
+ index of first new row/col to be included in data-sequence
+@param nLastNew
+ index of last new row/col to be included in data-sequence
+*/
+bool SwChartDataSequence::ExtendTo( bool bExtendCol,
+ sal_Int32 nFirstNew, sal_Int32 nCount )
+{
+ bool bChanged = false;
+
+ SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ //pUnoTblCrsr->MakeBoxSels();
+
+ const SwStartNode *pStartNd = 0;
+ const SwTableBox *pStartBox = 0;
+ const SwTableBox *pEndBox = 0;
+
+ const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ DBG_ASSERT( !pTable->IsTblComplex(), "table too complex" );
+ if (nCount < 1 || nFirstNew < 0 || pTable->IsTblComplex())
+ return false;
+
+ //
+ // get range descriptor (cell range) for current data-sequence
+ //
+ pStartNd = pUnoTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ pEndBox = pTable->GetTblBox( pStartNd->GetIndex() );
+ const String aEndBox( pEndBox->GetName() );
+ //
+ pStartNd = pUnoTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
+ pStartBox = pTable->GetTblBox( pStartNd->GetIndex() );
+ const String aStartBox( pStartBox->GetName() );
+ //
+ String aCellRange( aStartBox ); // note that cell range here takes the newly added rows/cols already into account
+ aCellRange.AppendAscii( ":" );
+ aCellRange += aEndBox;
+ SwRangeDescriptor aDesc;
+ FillRangeDescriptor( aDesc, aCellRange );
+
+ String aNewStartCell;
+ String aNewEndCell;
+ if (bExtendCol && aDesc.nBottom + 1 == nFirstNew)
+ {
+ // new column cells adjacent to the bottom of the
+ // current data-sequence to be added...
+ DBG_ASSERT( aDesc.nLeft == aDesc.nRight, "data-sequence is not a column" );
+ aNewStartCell = lcl_GetCellName(aDesc.nLeft, aDesc.nTop);
+ aNewEndCell = lcl_GetCellName(aDesc.nRight, aDesc.nBottom + nCount);
+ bChanged = true;
+ }
+ else if (bExtendCol && aDesc.nTop - nCount == nFirstNew)
+ {
+ // new column cells adjacent to the top of the
+ // current data-sequence to be added...
+ DBG_ASSERT( aDesc.nLeft == aDesc.nRight, "data-sequence is not a column" );
+ aNewStartCell = lcl_GetCellName(aDesc.nLeft, aDesc.nTop - nCount);
+ aNewEndCell = lcl_GetCellName(aDesc.nRight, aDesc.nBottom);
+ bChanged = true;
+ }
+ else if (!bExtendCol && aDesc.nRight + 1 == nFirstNew)
+ {
+ // new row cells adjacent to the right of the
+ // current data-sequence to be added...
+ DBG_ASSERT( aDesc.nTop == aDesc.nBottom, "data-sequence is not a row" );
+ aNewStartCell = lcl_GetCellName(aDesc.nLeft, aDesc.nTop);
+ aNewEndCell = lcl_GetCellName(aDesc.nRight + nCount, aDesc.nBottom);
+ bChanged = true;
+ }
+ else if (!bExtendCol && aDesc.nLeft - nCount == nFirstNew)
+ {
+ // new row cells adjacent to the left of the
+ // current data-sequence to be added...
+ DBG_ASSERT( aDesc.nTop == aDesc.nBottom, "data-sequence is not a row" );
+ aNewStartCell = lcl_GetCellName(aDesc.nLeft - nCount, aDesc.nTop);
+ aNewEndCell = lcl_GetCellName(aDesc.nRight, aDesc.nBottom);
+ bChanged = true;
+ }
+
+ if (bChanged)
+ {
+ // move table cursor to new start and end of data-sequence
+ const SwTableBox *pNewStartBox = pTable->GetTblBox( aNewStartCell );
+ const SwTableBox *pNewEndBox = pTable->GetTblBox( aNewEndCell );
+ pUnoTblCrsr->SetMark();
+ pUnoTblCrsr->GetPoint()->nNode = *pNewEndBox->GetSttNd();
+ pUnoTblCrsr->GetMark()->nNode = *pNewStartBox->GetSttNd();
+ pUnoTblCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoTblCrsr->MakeBoxSels();
+ }
+
+ return bChanged;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+SwChartLabeledDataSequence::SwChartLabeledDataSequence() :
+ aEvtListeners( GetChartMutex() ),
+ aModifyListeners( GetChartMutex() )
+{
+ bDisposed = sal_False;
+}
+
+
+SwChartLabeledDataSequence::~SwChartLabeledDataSequence()
+{
+}
+
+
+uno::Reference< chart2::data::XDataSequence > SAL_CALL SwChartLabeledDataSequence::getValues( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+ return xData;
+}
+
+
+void SwChartLabeledDataSequence::SetDataSequence(
+ uno::Reference< chart2::data::XDataSequence >& rxDest,
+ const uno::Reference< chart2::data::XDataSequence >& rxSource)
+{
+ uno::Reference< util::XModifyListener > xML( dynamic_cast< util::XModifyListener* >(this), uno::UNO_QUERY );
+ uno::Reference< lang::XEventListener > xEL( dynamic_cast< lang::XEventListener* >(this), uno::UNO_QUERY );
+
+ // stop listening to old data-sequence
+ uno::Reference< util::XModifyBroadcaster > xMB( rxDest, uno::UNO_QUERY );
+ if (xMB.is())
+ xMB->removeModifyListener( xML );
+ uno::Reference< lang::XComponent > xC( rxDest, uno::UNO_QUERY );
+ if (xC.is())
+ xC->removeEventListener( xEL );
+
+ rxDest = rxSource;
+
+ // start listening to new data-sequence
+ xC = uno::Reference< lang::XComponent >( rxDest, uno::UNO_QUERY );
+ if (xC.is())
+ xC->addEventListener( xEL );
+ xMB = uno::Reference< util::XModifyBroadcaster >( rxDest, uno::UNO_QUERY );
+ if (xMB.is())
+ xMB->addModifyListener( xML );
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::setValues(
+ const uno::Reference< chart2::data::XDataSequence >& rxSequence )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ if (xData != rxSequence)
+ {
+ SetDataSequence( xData, rxSequence );
+ // inform listeners of changes
+ LaunchModifiedEvent( aModifyListeners, dynamic_cast< XModifyBroadcaster * >(this) );
+ }
+}
+
+
+uno::Reference< chart2::data::XDataSequence > SAL_CALL SwChartLabeledDataSequence::getLabel( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+ return xLabels;
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::setLabel(
+ const uno::Reference< chart2::data::XDataSequence >& rxSequence )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ if (xLabels != rxSequence)
+ {
+ SetDataSequence( xLabels, rxSequence );
+ // inform listeners of changes
+ LaunchModifiedEvent( aModifyListeners, dynamic_cast< XModifyBroadcaster * >(this) );
+ }
+}
+
+
+uno::Reference< util::XCloneable > SAL_CALL SwChartLabeledDataSequence::createClone( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (bDisposed)
+ throw lang::DisposedException();
+
+ uno::Reference< util::XCloneable > xRes;
+
+ uno::Reference< util::XCloneable > xDataCloneable( xData, uno::UNO_QUERY );
+ uno::Reference< util::XCloneable > xLabelsCloneable( xLabels, uno::UNO_QUERY );
+ SwChartLabeledDataSequence *pRes = new SwChartLabeledDataSequence();
+ if (xDataCloneable.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xDataClone( xDataCloneable->createClone(), uno::UNO_QUERY );
+ pRes->setValues( xDataClone );
+ }
+
+ if (xLabelsCloneable.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xLabelsClone( xLabelsCloneable->createClone(), uno::UNO_QUERY );
+ pRes->setLabel( xLabelsClone );
+ }
+ xRes = pRes;
+ return xRes;
+}
+
+
+OUString SAL_CALL SwChartLabeledDataSequence::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return C2U("SwChartLabeledDataSequence");
+}
+
+
+sal_Bool SAL_CALL SwChartLabeledDataSequence::supportsService(
+ const OUString& rServiceName )
+ throw (uno::RuntimeException)
+{
+ return rServiceName.equalsAscii( SN_LABELED_DATA_SEQUENCE );
+}
+
+
+uno::Sequence< OUString > SAL_CALL SwChartLabeledDataSequence::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Sequence< OUString > aRes(1);
+ aRes.getArray()[0] = C2U( SN_LABELED_DATA_SEQUENCE );
+ return aRes;
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::disposing(
+ const lang::EventObject& rSource )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ uno::Reference< uno::XInterface > xRef( rSource.Source );
+ if (xRef == xData)
+ xData.clear();
+ if (xRef == xLabels)
+ xLabels.clear();
+ if (!xData.is() && !xLabels.is())
+ dispose();
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::modified(
+ const lang::EventObject& rEvent )
+ throw (uno::RuntimeException)
+{
+ if (rEvent.Source == xData || rEvent.Source == xLabels)
+ {
+ LaunchModifiedEvent( aModifyListeners, dynamic_cast< XModifyBroadcaster * >(this) );
+ }
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::addModifyListener(
+ const uno::Reference< util::XModifyListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aModifyListeners.addInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::removeModifyListener(
+ const uno::Reference< util::XModifyListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aModifyListeners.removeInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::dispose( )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bMustDispose( sal_False );
+ {
+ osl::MutexGuard aGuard( GetChartMutex() );
+ bMustDispose = !bDisposed;
+ if (!bDisposed)
+ bDisposed = sal_True;
+ }
+ if (bMustDispose)
+ {
+ bDisposed = sal_True;
+
+ // require listeners to release references to this object
+ lang::EventObject aEvtObj( dynamic_cast< chart2::data::XLabeledDataSequence * >(this) );
+ aModifyListeners.disposeAndClear( aEvtObj );
+ aEvtListeners.disposeAndClear( aEvtObj );
+ }
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::addEventListener(
+ const uno::Reference< lang::XEventListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aEvtListeners.addInterface( rxListener );
+}
+
+
+void SAL_CALL SwChartLabeledDataSequence::removeEventListener(
+ const uno::Reference< lang::XEventListener >& rxListener )
+ throw (uno::RuntimeException)
+{
+ osl::MutexGuard aGuard( GetChartMutex() );
+ if (!bDisposed && rxListener.is())
+ aEvtListeners.removeInterface( rxListener );
+}
+
+//////////////////////////////////////////////////////////////////////
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
new file mode 100644
index 000000000000..0b8f938d307d
--- /dev/null
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -0,0 +1,1930 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <hintids.hxx>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <doc.hxx>
+#include <docary.hxx>
+#include <fmtcol.hxx>
+#include <poolfmt.hxx>
+#include <unocoll.hxx>
+#include <unosett.hxx>
+#include <fmtanchr.hxx>
+#include <ndtxt.hxx>
+#include <section.hxx>
+#include <IMark.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <vos/mutex.hxx>
+#include <com/sun/star/text/XTextTableCursor.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <svl/PasswordHelper.hxx>
+#include <svtools/unoimap.hxx>
+#include <svtools/unoevent.hxx>
+#include <unotbl.hxx>
+#include <unostyle.hxx>
+#include <unofield.hxx>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <unofootnote.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtcntnt.hxx>
+#include <authfld.hxx>
+#include <SwXTextDefaults.hxx>
+#include <unochart.hxx>
+#include <comphelper/makesequence.hxx>
+#include <comphelper/sequence.hxx>
+#include <slist>
+#include <iterator>
+
+#include <unosection.hxx>
+#include <unoparagraph.hxx>
+#include <unobookmark.hxx>
+#include <unorefmark.hxx>
+#include <unometa.hxx>
+#include "docsh.hxx"
+
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+struct ProvNamesId_Type
+{
+ const char * pName;
+ sal_uInt16 nType;
+};
+
+// note: this thing is indexed as an array, so do not insert/remove entries!
+const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
+{
+ { "com.sun.star.text.TextTable", SW_SERVICE_TYPE_TEXTTABLE },
+ { "com.sun.star.text.TextFrame", SW_SERVICE_TYPE_TEXTFRAME },
+ { "com.sun.star.text.GraphicObject", SW_SERVICE_TYPE_GRAPHIC },
+ { "com.sun.star.text.TextEmbeddedObject", SW_SERVICE_TYPE_OLE },
+ { "com.sun.star.text.Bookmark", SW_SERVICE_TYPE_BOOKMARK },
+ { "com.sun.star.text.Footnote", SW_SERVICE_TYPE_FOOTNOTE },
+ { "com.sun.star.text.Endnote", SW_SERVICE_TYPE_ENDNOTE },
+ { "com.sun.star.text.DocumentIndexMark", SW_SERVICE_TYPE_INDEXMARK },
+ { "com.sun.star.text.DocumentIndex", SW_SERVICE_TYPE_INDEX },
+ { "com.sun.star.text.ReferenceMark", SW_SERVICE_REFERENCE_MARK },
+ { "com.sun.star.style.CharacterStyle", SW_SERVICE_STYLE_CHARACTER_STYLE },
+ { "com.sun.star.style.ParagraphStyle", SW_SERVICE_STYLE_PARAGRAPH_STYLE },
+ { "com.sun.star.style.FrameStyle", SW_SERVICE_STYLE_FRAME_STYLE },
+ { "com.sun.star.style.PageStyle", SW_SERVICE_STYLE_PAGE_STYLE },
+ { "com.sun.star.style.NumberingStyle", SW_SERVICE_STYLE_NUMBERING_STYLE },
+ { "com.sun.star.text.ContentIndexMark", SW_SERVICE_CONTENT_INDEX_MARK },
+ { "com.sun.star.text.ContentIndex", SW_SERVICE_CONTENT_INDEX },
+ { "com.sun.star.text.UserIndexMark", SW_SERVICE_USER_INDEX_MARK },
+ { "com.sun.star.text.UserIndex", SW_SERVICE_USER_INDEX },
+ { "com.sun.star.text.TextSection", SW_SERVICE_TEXT_SECTION },
+ { "com.sun.star.text.TextField.DateTime", SW_SERVICE_FIELDTYPE_DATETIME },
+ { "com.sun.star.text.TextField.User", SW_SERVICE_FIELDTYPE_USER },
+ { "com.sun.star.text.TextField.SetExpression", SW_SERVICE_FIELDTYPE_SET_EXP },
+ { "com.sun.star.text.TextField.GetExpression", SW_SERVICE_FIELDTYPE_GET_EXP },
+ { "com.sun.star.text.TextField.FileName", SW_SERVICE_FIELDTYPE_FILE_NAME },
+ { "com.sun.star.text.TextField.PageNumber", SW_SERVICE_FIELDTYPE_PAGE_NUM },
+ { "com.sun.star.text.TextField.Author", SW_SERVICE_FIELDTYPE_AUTHOR },
+ { "com.sun.star.text.TextField.Chapter", SW_SERVICE_FIELDTYPE_CHAPTER },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_0 },
+ { "com.sun.star.text.TextField.GetReference", SW_SERVICE_FIELDTYPE_GET_REFERENCE },
+ { "com.sun.star.text.TextField.ConditionalText", SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
+ { "com.sun.star.text.TextField.Annotation", SW_SERVICE_FIELDTYPE_ANNOTATION },
+ { "com.sun.star.text.TextField.Input", SW_SERVICE_FIELDTYPE_INPUT },
+ { "com.sun.star.text.TextField.Macro", SW_SERVICE_FIELDTYPE_MACRO },
+ { "com.sun.star.text.TextField.DDE", SW_SERVICE_FIELDTYPE_DDE },
+ { "com.sun.star.text.TextField.HiddenParagraph", SW_SERVICE_FIELDTYPE_HIDDEN_PARA },
+ { "" /*com.sun.star.text.TextField.DocumentInfo"*/, SW_SERVICE_FIELDTYPE_DOC_INFO },
+ { "com.sun.star.text.TextField.TemplateName", SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
+ { "com.sun.star.text.TextField.ExtendedUser", SW_SERVICE_FIELDTYPE_USER_EXT },
+ { "com.sun.star.text.TextField.ReferencePageSet", SW_SERVICE_FIELDTYPE_REF_PAGE_SET },
+ { "com.sun.star.text.TextField.ReferencePageGet", SW_SERVICE_FIELDTYPE_REF_PAGE_GET },
+ { "com.sun.star.text.TextField.JumpEdit", SW_SERVICE_FIELDTYPE_JUMP_EDIT },
+ { "com.sun.star.text.TextField.Script", SW_SERVICE_FIELDTYPE_SCRIPT },
+ { "com.sun.star.text.TextField.DatabaseNextSet", SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
+ { "com.sun.star.text.TextField.DatabaseNumberOfSet", SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
+ { "com.sun.star.text.TextField.DatabaseSetNumber", SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM },
+ { "com.sun.star.text.TextField.Database", SW_SERVICE_FIELDTYPE_DATABASE },
+ { "com.sun.star.text.TextField.DatabaseName", SW_SERVICE_FIELDTYPE_DATABASE_NAME },
+ { "com.sun.star.text.TextField.TableFormula", SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
+ { "com.sun.star.text.TextField.PageCount", SW_SERVICE_FIELDTYPE_PAGE_COUNT },
+ { "com.sun.star.text.TextField.ParagraphCount", SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
+ { "com.sun.star.text.TextField.WordCount", SW_SERVICE_FIELDTYPE_WORD_COUNT },
+ { "com.sun.star.text.TextField.CharacterCount", SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
+ { "com.sun.star.text.TextField.TableCount", SW_SERVICE_FIELDTYPE_TABLE_COUNT },
+ { "com.sun.star.text.TextField.GraphicObjectCount", SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
+ { "com.sun.star.text.TextField.EmbeddedObjectCount", SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
+ { "com.sun.star.text.TextField.DocInfo.ChangeAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
+ { "com.sun.star.text.TextField.DocInfo.ChangeDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME },
+ { "com.sun.star.text.TextField.DocInfo.EditTime", SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
+ { "com.sun.star.text.TextField.DocInfo.Description", SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
+ { "com.sun.star.text.TextField.DocInfo.CreateAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
+ { "com.sun.star.text.TextField.DocInfo.CreateDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_0 },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_1 },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_2 },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_3 },
+ { "com.sun.star.text.TextField.DocInfo.Custom", SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
+ { "com.sun.star.text.TextField.DocInfo.PrintAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
+ { "com.sun.star.text.TextField.DocInfo.PrintDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
+ { "com.sun.star.text.TextField.DocInfo.KeyWords", SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
+ { "com.sun.star.text.TextField.DocInfo.Subject", SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
+ { "com.sun.star.text.TextField.DocInfo.Title", SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
+ { "com.sun.star.text.TextField.DocInfo.Revision", SW_SERVICE_FIELDTYPE_DOCINFO_REVISION },
+ { "com.sun.star.text.TextField.Bibliography", SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
+ { "com.sun.star.text.TextField.CombinedCharacters", SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
+ { "com.sun.star.text.TextField.DropDown", SW_SERVICE_FIELDTYPE_DROPDOWN },
+ { "com.sun.star.text.textfield.MetadataField", SW_SERVICE_FIELDTYPE_METAFIELD },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_4 },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_5 },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_6 },
+ { "", SW_SERVICE_FIELDTYPE_DUMMY_7 },
+ { "com.sun.star.text.FieldMaster.User", SW_SERVICE_FIELDMASTER_USER },
+ { "com.sun.star.text.FieldMaster.DDE", SW_SERVICE_FIELDMASTER_DDE },
+ { "com.sun.star.text.FieldMaster.SetExpression", SW_SERVICE_FIELDMASTER_SET_EXP },
+ { "com.sun.star.text.FieldMaster.Database", SW_SERVICE_FIELDMASTER_DATABASE },
+ { "com.sun.star.text.FieldMaster.Bibliography", SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY },
+ { "", SW_SERVICE_FIELDMASTER_DUMMY2 },
+ { "", SW_SERVICE_FIELDMASTER_DUMMY3 },
+ { "", SW_SERVICE_FIELDMASTER_DUMMY4 },
+ { "", SW_SERVICE_FIELDMASTER_DUMMY5 },
+ { "com.sun.star.text.IllustrationsIndex", SW_SERVICE_INDEX_ILLUSTRATIONS },
+ { "com.sun.star.text.ObjectIndex", SW_SERVICE_INDEX_OBJECTS },
+ { "com.sun.star.text.TableIndex", SW_SERVICE_INDEX_TABLES },
+ { "com.sun.star.text.Bibliography", SW_SERVICE_INDEX_BIBLIOGRAPHY },
+ { "com.sun.star.text.Paragraph", SW_SERVICE_PARAGRAPH },
+ { "com.sun.star.text.TextField.InputUser", SW_SERVICE_FIELDTYPE_INPUT_USER },
+ { "com.sun.star.text.TextField.HiddenText", SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
+ { "com.sun.star.style.ConditionalParagraphStyle", SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE },
+ { "com.sun.star.text.NumberingRules", SW_SERVICE_NUMBERING_RULES },
+ { "com.sun.star.text.TextColumns", SW_SERVICE_TEXT_COLUMNS },
+ { "com.sun.star.text.IndexHeaderSection", SW_SERVICE_INDEX_HEADER_SECTION },
+ { "com.sun.star.text.Defaults", SW_SERVICE_DEFAULTS },
+ { "com.sun.star.image.ImageMapRectangleObject", SW_SERVICE_IMAP_RECTANGLE },
+ { "com.sun.star.image.ImageMapCircleObject", SW_SERVICE_IMAP_CIRCLE },
+ { "com.sun.star.image.ImageMapPolygonObject", SW_SERVICE_IMAP_POLYGON },
+ { "com.sun.star.text.TextGraphicObject", SW_SERVICE_TYPE_TEXT_GRAPHIC },
+ { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER },
+ { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
+ { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
+ { "com.sun.star.text.InContentMetadata", SW_SERVICE_TYPE_META },
+
+ // case-correct versions of the service names (see #i67811)
+ { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
+ { CSS_TEXT_TEXTFIELD_USER, SW_SERVICE_FIELDTYPE_USER },
+ { CSS_TEXT_TEXTFIELD_SET_EXPRESSION, SW_SERVICE_FIELDTYPE_SET_EXP },
+ { CSS_TEXT_TEXTFIELD_GET_EXPRESSION, SW_SERVICE_FIELDTYPE_GET_EXP },
+ { CSS_TEXT_TEXTFIELD_FILE_NAME, SW_SERVICE_FIELDTYPE_FILE_NAME },
+ { CSS_TEXT_TEXTFIELD_PAGE_NUMBER, SW_SERVICE_FIELDTYPE_PAGE_NUM },
+ { CSS_TEXT_TEXTFIELD_AUTHOR, SW_SERVICE_FIELDTYPE_AUTHOR },
+ { CSS_TEXT_TEXTFIELD_CHAPTER, SW_SERVICE_FIELDTYPE_CHAPTER },
+ { CSS_TEXT_TEXTFIELD_GET_REFERENCE, SW_SERVICE_FIELDTYPE_GET_REFERENCE },
+ { CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT, SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
+ { CSS_TEXT_TEXTFIELD_ANNOTATION, SW_SERVICE_FIELDTYPE_ANNOTATION },
+ { CSS_TEXT_TEXTFIELD_INPUT, SW_SERVICE_FIELDTYPE_INPUT },
+ { CSS_TEXT_TEXTFIELD_MACRO, SW_SERVICE_FIELDTYPE_MACRO },
+ { CSS_TEXT_TEXTFIELD_DDE, SW_SERVICE_FIELDTYPE_DDE },
+ { CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH, SW_SERVICE_FIELDTYPE_HIDDEN_PARA },
+ { CSS_TEXT_TEXTFIELD_TEMPLATE_NAME, SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
+ { CSS_TEXT_TEXTFIELD_EXTENDED_USER, SW_SERVICE_FIELDTYPE_USER_EXT },
+ { CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET, SW_SERVICE_FIELDTYPE_REF_PAGE_SET },
+ { CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET, SW_SERVICE_FIELDTYPE_REF_PAGE_GET },
+ { CSS_TEXT_TEXTFIELD_JUMP_EDIT, SW_SERVICE_FIELDTYPE_JUMP_EDIT },
+ { CSS_TEXT_TEXTFIELD_SCRIPT, SW_SERVICE_FIELDTYPE_SCRIPT },
+ { CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET, SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
+ { CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET, SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
+ { CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER, SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM },
+ { CSS_TEXT_TEXTFIELD_DATABASE, SW_SERVICE_FIELDTYPE_DATABASE },
+ { CSS_TEXT_TEXTFIELD_DATABASE_NAME, SW_SERVICE_FIELDTYPE_DATABASE_NAME },
+ { CSS_TEXT_TEXTFIELD_TABLE_FORMULA, SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
+ { CSS_TEXT_TEXTFIELD_PAGE_COUNT, SW_SERVICE_FIELDTYPE_PAGE_COUNT },
+ { CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT, SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
+ { CSS_TEXT_TEXTFIELD_WORD_COUNT, SW_SERVICE_FIELDTYPE_WORD_COUNT },
+ { CSS_TEXT_TEXTFIELD_CHARACTER_COUNT, SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
+ { CSS_TEXT_TEXTFIELD_TABLE_COUNT, SW_SERVICE_FIELDTYPE_TABLE_COUNT },
+ { CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT, SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
+ { CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT, SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION, SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS, SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT, SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_TITLE, SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_REVISION, SW_SERVICE_FIELDTYPE_DOCINFO_REVISION },
+ { CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM, SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
+ { CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY, SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
+ { CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS, SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
+ { CSS_TEXT_TEXTFIELD_DROP_DOWN, SW_SERVICE_FIELDTYPE_DROPDOWN },
+ { CSS_TEXT_TEXTFIELD_INPUT_USER, SW_SERVICE_FIELDTYPE_INPUT_USER },
+ { CSS_TEXT_TEXTFIELD_HIDDEN_TEXT, SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
+ { CSS_TEXT_FIELDMASTER_USER, SW_SERVICE_FIELDMASTER_USER },
+ { CSS_TEXT_FIELDMASTER_DDE, SW_SERVICE_FIELDMASTER_DDE },
+ { CSS_TEXT_FIELDMASTER_SET_EXPRESSION, SW_SERVICE_FIELDMASTER_SET_EXP },
+ { CSS_TEXT_FIELDMASTER_DATABASE, SW_SERVICE_FIELDMASTER_DATABASE },
+ { CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY, SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY }
+};
+
+/* -----------------------------23.03.01 13:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SvEventDescription* lcl_GetSupportedMacroItems()
+{
+ static const SvEventDescription aMacroDescriptionsImpl[] =
+ {
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+ };
+
+ return aMacroDescriptionsImpl;
+}
+
+/******************************************************************
+ * SwXServiceProvider
+ ******************************************************************/
+/*-- 13.01.99 13:31:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString sRet;
+ sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+ if(nObjectType < nEntries)
+ sRet = C2U(aProvNamesId[nObjectType].pName);
+ return sRet;
+}
+/* -----------------11.03.99 12:05-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
+{
+ sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+ uno::Sequence<OUString> aRet(nEntries);
+ OUString* pArray = aRet.getArray();
+ sal_uInt16 n = 0;
+ for(sal_uInt16 i = 0; i < nEntries; i++)
+ {
+ String sProv(C2U(aProvNamesId[i].pName));
+ if(sProv.Len())
+ {
+ pArray[n] = sProv;
+ n++;
+ }
+ }
+ aRet.realloc(n);
+ return aRet;
+
+}
+
+/*-- 13.01.99 13:31:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt16 SwXServiceProvider::GetProviderType(const OUString& rServiceName)
+{
+ sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+ for(sal_uInt16 i = 0; i < nEntries; i++ )
+ {
+ if( COMPARE_EQUAL == rServiceName.compareToAscii(aProvNamesId[i].pName))
+ return aProvNamesId[i].nType;
+ }
+ return SW_SERVICE_INVALID;
+}
+/* -----------------13.01.99 14:37-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc* pDoc)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< uno::XInterface > xRet;
+ switch(nObjectType)
+ {
+ case SW_SERVICE_TYPE_TEXTTABLE:
+ {
+ SwXTextTable* pTextTable = new SwXTextTable();
+ xRet = (cppu::OWeakObject*)pTextTable;
+ }
+ break;
+ case SW_SERVICE_TYPE_TEXTFRAME:
+ {
+ SwXTextFrame* pTextFrame = new SwXTextFrame( pDoc );
+ xRet = (cppu::OWeakObject*)(SwXFrame*)pTextFrame;
+ }
+ break;
+ case SW_SERVICE_TYPE_GRAPHIC :
+ case SW_SERVICE_TYPE_TEXT_GRAPHIC /* #i47503# */ :
+ {
+ SwXTextGraphicObject* pGraphic = new SwXTextGraphicObject( pDoc );
+ xRet = (cppu::OWeakObject*)(SwXFrame*)pGraphic;
+
+ }
+ break;
+ case SW_SERVICE_TYPE_OLE :
+ {
+ SwXTextEmbeddedObject* pOle = new SwXTextEmbeddedObject( pDoc );
+ xRet = (cppu::OWeakObject*)(SwXFrame*)pOle;
+ }
+ break;
+ case SW_SERVICE_TYPE_BOOKMARK :
+ {
+ SwXBookmark* pBookmark = new SwXBookmark;
+ xRet = (cppu::OWeakObject*)pBookmark;
+ }
+ break;
+ case SW_SERVICE_TYPE_FIELDMARK :
+ {
+ SwXFieldmark* pFieldmark = new SwXFieldmark(false);
+ xRet = (cppu::OWeakObject*)pFieldmark;
+ }
+ break;
+ case SW_SERVICE_TYPE_FORMFIELDMARK :
+ {
+ SwXFieldmark* pFieldmark = new SwXFieldmark(true);
+ xRet = (cppu::OWeakObject*)pFieldmark;
+ }
+ break;
+ case SW_SERVICE_TYPE_FOOTNOTE :
+ xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
+ break;
+ case SW_SERVICE_TYPE_ENDNOTE :
+ xRet = (cppu::OWeakObject*)new SwXFootnote(sal_True);
+ break;
+ case SW_SERVICE_CONTENT_INDEX_MARK :
+ case SW_SERVICE_USER_INDEX_MARK :
+ case SW_SERVICE_TYPE_INDEXMARK:
+ {
+ TOXTypes eType = TOX_INDEX;
+ if(SW_SERVICE_CONTENT_INDEX_MARK== nObjectType)
+ eType = TOX_CONTENT;
+ else if(SW_SERVICE_USER_INDEX_MARK == nObjectType)
+ eType = TOX_USER;
+ xRet = (cppu::OWeakObject*)new SwXDocumentIndexMark(eType);
+ }
+ break;
+ case SW_SERVICE_CONTENT_INDEX :
+ case SW_SERVICE_USER_INDEX :
+ case SW_SERVICE_TYPE_INDEX :
+ case SW_SERVICE_INDEX_ILLUSTRATIONS:
+ case SW_SERVICE_INDEX_OBJECTS :
+ case SW_SERVICE_INDEX_TABLES:
+ case SW_SERVICE_INDEX_BIBLIOGRAPHY :
+ {
+ TOXTypes eType = TOX_INDEX;
+ if(SW_SERVICE_CONTENT_INDEX == nObjectType)
+ eType = TOX_CONTENT;
+ else if(SW_SERVICE_USER_INDEX == nObjectType)
+ eType = TOX_USER;
+ else if(SW_SERVICE_INDEX_ILLUSTRATIONS == nObjectType)
+ {
+ eType = TOX_ILLUSTRATIONS;
+ }
+ else if(SW_SERVICE_INDEX_OBJECTS == nObjectType)
+ {
+ eType = TOX_OBJECTS;
+ }
+ else if(SW_SERVICE_INDEX_BIBLIOGRAPHY == nObjectType)
+ {
+ eType = TOX_AUTHORITIES;
+ }
+ else if(SW_SERVICE_INDEX_TABLES == nObjectType)
+ {
+ eType = TOX_TABLES;
+ }
+ xRet = (cppu::OWeakObject*)new SwXDocumentIndex(eType, *pDoc);
+ }
+ break;
+ case SW_SERVICE_INDEX_HEADER_SECTION :
+ case SW_SERVICE_TEXT_SECTION :
+ xRet = SwXTextSection::CreateXTextSection(0,
+ (SW_SERVICE_INDEX_HEADER_SECTION == nObjectType));
+
+ break;
+ case SW_SERVICE_REFERENCE_MARK :
+ xRet = (cppu::OWeakObject*)new SwXReferenceMark(0, 0);
+ break;
+ case SW_SERVICE_STYLE_CHARACTER_STYLE:
+ case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
+ case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
+ case SW_SERVICE_STYLE_FRAME_STYLE:
+ case SW_SERVICE_STYLE_PAGE_STYLE:
+ case SW_SERVICE_STYLE_NUMBERING_STYLE:
+ {
+ SfxStyleFamily eFamily = SFX_STYLE_FAMILY_CHAR;
+ switch(nObjectType)
+ {
+ case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
+ case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
+ eFamily = SFX_STYLE_FAMILY_PARA;
+ break;
+ case SW_SERVICE_STYLE_FRAME_STYLE:
+ eFamily = SFX_STYLE_FAMILY_FRAME;
+ break;
+ case SW_SERVICE_STYLE_PAGE_STYLE:
+ eFamily = SFX_STYLE_FAMILY_PAGE;
+ break;
+ case SW_SERVICE_STYLE_NUMBERING_STYLE:
+ eFamily = SFX_STYLE_FAMILY_PSEUDO;
+ break;
+ }
+ SwXStyle* pNewStyle = SFX_STYLE_FAMILY_PAGE == eFamily ?
+ new SwXPageStyle(pDoc->GetDocShell()) :
+ eFamily == SFX_STYLE_FAMILY_FRAME ?
+ new SwXFrameStyle ( pDoc ):
+ new SwXStyle( pDoc, eFamily, nObjectType == SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE);
+ xRet = (cppu::OWeakObject*)pNewStyle;
+ }
+ break;
+// SW_SERVICE_DUMMY_5
+// SW_SERVICE_DUMMY_6
+// SW_SERVICE_DUMMY_7
+// SW_SERVICE_DUMMY_8
+// SW_SERVICE_DUMMY_9
+ case SW_SERVICE_FIELDTYPE_DATETIME:
+ case SW_SERVICE_FIELDTYPE_USER:
+ case SW_SERVICE_FIELDTYPE_SET_EXP:
+ case SW_SERVICE_FIELDTYPE_GET_EXP:
+ case SW_SERVICE_FIELDTYPE_FILE_NAME:
+ case SW_SERVICE_FIELDTYPE_PAGE_NUM:
+ case SW_SERVICE_FIELDTYPE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_CHAPTER:
+ case SW_SERVICE_FIELDTYPE_GET_REFERENCE:
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
+ case SW_SERVICE_FIELDTYPE_INPUT:
+ case SW_SERVICE_FIELDTYPE_MACRO:
+ case SW_SERVICE_FIELDTYPE_DDE:
+ case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
+ case SW_SERVICE_FIELDTYPE_DOC_INFO:
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
+ case SW_SERVICE_FIELDTYPE_USER_EXT:
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_SET:
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_GET:
+ case SW_SERVICE_FIELDTYPE_JUMP_EDIT:
+ case SW_SERVICE_FIELDTYPE_SCRIPT:
+ case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET:
+ case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET:
+ case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM:
+ case SW_SERVICE_FIELDTYPE_DATABASE:
+ case SW_SERVICE_FIELDTYPE_DATABASE_NAME:
+ case SW_SERVICE_FIELDTYPE_PAGE_COUNT :
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT :
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT :
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT :
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT :
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT :
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION :
+ case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY:
+ case SW_SERVICE_FIELDTYPE_INPUT_USER :
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT :
+ case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS :
+ case SW_SERVICE_FIELDTYPE_DROPDOWN :
+ case SW_SERVICE_FIELDTYPE_TABLE_FORMULA:
+ xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType);
+ break;
+ case SW_SERVICE_FIELDTYPE_ANNOTATION:
+ xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType, pDoc);
+ break;
+ case SW_SERVICE_FIELDMASTER_USER:
+ case SW_SERVICE_FIELDMASTER_DDE:
+ case SW_SERVICE_FIELDMASTER_SET_EXP :
+ case SW_SERVICE_FIELDMASTER_DATABASE:
+ {
+ sal_uInt16 nResId = USHRT_MAX;
+ switch(nObjectType)
+ {
+ case SW_SERVICE_FIELDMASTER_USER: nResId = RES_USERFLD; break;
+ case SW_SERVICE_FIELDMASTER_DDE: nResId = RES_DDEFLD; break;
+ case SW_SERVICE_FIELDMASTER_SET_EXP : nResId = RES_SETEXPFLD; break;
+ case SW_SERVICE_FIELDMASTER_DATABASE: nResId = RES_DBFLD; break;
+ }
+ xRet = (cppu::OWeakObject*)new SwXFieldMaster(pDoc, nResId);
+ }
+ break;
+ case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY:
+ {
+ SwFieldType* pType = pDoc->GetFldType(RES_AUTHORITY, aEmptyStr, sal_True);
+ if(!pType)
+ {
+ SwAuthorityFieldType aType(pDoc);
+ pType = pDoc->InsertFldType(aType);
+ }
+ else
+ {
+ SwClientIter aIter( *pType );
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)aIter.First( TYPE( SwXFieldMaster ));
+ if(pMaster)
+ xRet = (cppu::OWeakObject*)pMaster;
+ }
+ if(!xRet.is())
+ xRet = (cppu::OWeakObject*)new SwXFieldMaster(*pType, pDoc);
+ }
+ break;
+ case SW_SERVICE_PARAGRAPH :
+ xRet = (cppu::OWeakObject*)new SwXParagraph();
+ break;
+ case SW_SERVICE_NUMBERING_RULES :
+ xRet = (cppu::OWeakObject*)new SwXNumberingRules(*pDoc);
+ break;
+ case SW_SERVICE_TEXT_COLUMNS :
+ xRet = (cppu::OWeakObject*)new SwXTextColumns(0);
+ break;
+ case SW_SERVICE_DEFAULTS:
+ xRet = (cppu::OWeakObject*)new SwXTextDefaults( pDoc );
+ break;
+ case SW_SERVICE_IMAP_RECTANGLE :
+ xRet = SvUnoImageMapRectangleObject_createInstance( lcl_GetSupportedMacroItems() );
+ break;
+ case SW_SERVICE_IMAP_CIRCLE :
+ xRet = SvUnoImageMapCircleObject_createInstance( lcl_GetSupportedMacroItems() );
+ break;
+ case SW_SERVICE_IMAP_POLYGON :
+ xRet = SvUnoImageMapPolygonObject_createInstance( lcl_GetSupportedMacroItems() );
+ break;
+ case SW_SERVICE_CHART2_DATA_PROVIDER :
+ // #i64497# If a chart is in a temporary document during clipoard
+ // paste, there should be no data provider, so that own data is used
+ // This should not happen during copy/paste, as this will unlink
+ // charts using table data.
+ OSL_ASSERT( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED );
+ if( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ xRet = (cppu::OWeakObject*) pDoc->GetChartDataProvider( true /* create - if not yet available */ );
+ break;
+ case SW_SERVICE_TYPE_META:
+ xRet = static_cast< ::cppu::OWeakObject* >( new SwXMeta(pDoc) );
+ break;
+ case SW_SERVICE_FIELDTYPE_METAFIELD:
+ xRet = static_cast< ::cppu::OWeakObject* >(new SwXMetaField(pDoc));
+ break;
+ default:
+ throw uno::RuntimeException();
+ }
+ return xRet;
+}
+/******************************************************************
+ * SwXTextTables
+ ******************************************************************/
+//SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
+
+/*-- 13.01.99 12:56:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTables::SwXTextTables(SwDoc* pDc) :
+ SwUnoCollection(pDc)
+{
+
+}
+/*-- 13.01.99 12:56:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTables::~SwXTextTables()
+{
+
+}
+/*-- 13.01.99 12:56:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTextTables::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nRet = 0;
+ if(IsValid())
+ nRet = GetDoc()->GetTblFrmFmtCount(sal_True);
+ return nRet;
+}
+/*-- 13.01.99 12:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(IsValid())
+ {
+ if(0 <= nIndex && GetDoc()->GetTblFrmFmtCount(sal_True) > nIndex)
+ {
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt( static_cast< xub_StrLen >(nIndex), sal_True);
+ uno::Reference< XTextTable > xTbl = SwXTextTables::GetObject(rFmt);
+ aRet.setValue( &xTbl,
+ ::getCppuType((uno::Reference< XTextTable>*)0));
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 13.01.99 12:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextTables::getByName(const OUString& rItemName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(IsValid())
+ {
+ sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
+ uno::Reference< XTextTable > xTbl;
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ String aName(rItemName);
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
+ if(aName == rFmt.GetName())
+ {
+ xTbl = SwXTextTables::GetObject(rFmt);
+ aRet.setValue(&xTbl,
+ ::getCppuType(( uno::Reference< XTextTable >*)0));
+ break;
+ }
+ }
+ if(!xTbl.is())
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 13.01.99 12:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTables::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
+ uno::Sequence<OUString> aSeq(nCount);
+ if(nCount)
+ {
+ OUString* pArray = aSeq.getArray();
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
+
+ pArray[i] = OUString(rFmt.GetName());
+ }
+ }
+ return aSeq;
+}
+/*-- 13.01.99 12:56:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTables::hasByName(const OUString& rName)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet= sal_False;
+ if(IsValid())
+ {
+ sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ String aName(rName);
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
+ if(aName == rFmt.GetName())
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 13.01.99 12:56:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL
+ SwXTextTables::getElementType( )
+ throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextTable>*)0);
+}
+/*-- 13.01.99 12:56:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTables::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return 0 != GetDoc()->GetTblFrmFmtCount(sal_True);
+}
+/* -----------------25.10.99 16:01-------------------
+
+ --------------------------------------------------*/
+OUString SwXTextTables::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextTables");
+}
+/* -----------------25.10.99 16:01-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextTables::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return rServiceName == C2U("com.sun.star.text.TextTables");
+}
+/* -----------------25.10.99 16:01-------------------
+
+ --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArr = aRet.getArray();
+ pArr[0] = C2U("com.sun.star.text.TextTables");
+ return aRet;
+}
+/*-- 13.01.99 12:56:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+XTextTable* SwXTextTables::GetObject( SwFrmFmt& rFmt )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwXTextTable* pTbl = (SwXTextTable*)SwClientIter( rFmt ).
+ First( TYPE( SwXTextTable ));
+ if( !pTbl )
+ pTbl = new SwXTextTable(rFmt);
+ return pTbl ;
+}
+
+
+/******************************************************************
+ * SwXFrameEnumeration
+ ******************************************************************/
+namespace
+{
+ template<FlyCntType T> struct UnoFrameWrap_traits {};
+
+ template<>
+ struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
+ {
+ typedef SwXTextFrame core_frame_t;
+ typedef XTextFrame uno_frame_t;
+ static inline bool filter(const SwNode* const pNode) { return !pNode->IsNoTxtNode(); };
+ };
+
+ template<>
+ struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
+ {
+ typedef SwXTextGraphicObject core_frame_t;
+ typedef XTextContent uno_frame_t;
+ static inline bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
+ };
+
+ template<>
+ struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
+ {
+ typedef SwXTextEmbeddedObject core_frame_t;
+ typedef XEmbeddedObjectSupplier uno_frame_t;
+ static inline bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
+ };
+
+ template<FlyCntType T>
+ static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt)
+ {
+ SwXFrame* pFrm = static_cast<SwXFrame*>(SwClientIter(*pFmt).First(TYPE(SwXFrame)));
+ if(!pFrm)
+ pFrm = new typename UnoFrameWrap_traits<T>::core_frame_t(*pFmt);
+ Reference< typename UnoFrameWrap_traits<T>::uno_frame_t > xFrm =
+ static_cast< typename UnoFrameWrap_traits<T>::core_frame_t* >(pFrm);
+ return uno::makeAny(xFrm);
+ }
+
+ // runtime adapter for lcl_UnoWrapFrame
+ static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt, FlyCntType eType) throw(uno::RuntimeException())
+ {
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFmt);
+ case FLYCNTTYPE_GRF:
+ return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFmt);
+ case FLYCNTTYPE_OLE:
+ return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFmt);
+ default:
+ throw uno::RuntimeException();
+ }
+ }
+
+ template<FlyCntType T>
+ class SwXFrameEnumeration
+ : public SwSimpleEnumeration_Base
+ {
+ private:
+ typedef ::std::slist< Any > frmcontainer_t;
+ frmcontainer_t m_aFrames;
+ protected:
+ virtual ~SwXFrameEnumeration() {};
+ public:
+ SwXFrameEnumeration(const SwDoc* const pDoc);
+
+ //XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements(void) throw( RuntimeException );
+ virtual Any SAL_CALL nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException );
+
+ //XServiceInfo
+ virtual OUString SAL_CALL getImplementationName(void) throw( RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException );
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( RuntimeException );
+ };
+}
+
+template<FlyCntType T>
+SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
+ : m_aFrames()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const SwSpzFrmFmts* const pFmts = pDoc->GetSpzFrmFmts();
+ if(!pFmts->Count())
+ return;
+ // --> OD 2009-09-10 #i104937#
+// const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
+ const USHORT nSize = pFmts->Count();
+ // <--
+ ::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
+ // --> OD 2009-09-10 #i104937#
+ SwFrmFmt* pFmt( 0 );
+ for( USHORT i = 0; i < nSize; ++i )
+// for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
+ // <--
+ {
+ // --> OD 2009-09-10 #i104937#
+ pFmt = (*pFmts)[i];
+ // <--
+ if(pFmt->Which() != RES_FLYFRMFMT)
+ continue;
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(!pIdx || !pIdx->GetNodes().IsDocNodes())
+ continue;
+ const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
+ if(UnoFrameWrap_traits<T>::filter(pNd))
+ *pInserter++ = lcl_UnoWrapFrame<T>(pFmt);
+ }
+}
+
+template<FlyCntType T>
+sal_Bool SwXFrameEnumeration<T>::hasMoreElements(void) throw( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return !m_aFrames.empty();
+}
+
+template<FlyCntType T>
+Any SwXFrameEnumeration<T>::nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_aFrames.empty())
+ throw NoSuchElementException();
+ Any aResult = *m_aFrames.begin();
+ m_aFrames.pop_front();
+ return aResult;
+}
+
+template<FlyCntType T>
+OUString SwXFrameEnumeration<T>::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFrameEnumeration");
+}
+
+template<FlyCntType T>
+sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.container.XEnumeration") == ServiceName;
+}
+
+template<FlyCntType T>
+Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration"));
+}
+
+/******************************************************************
+ * SwXFrames
+ ******************************************************************/
+OUString SwXFrames::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFrames");
+}
+
+BOOL SwXFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextFrames") == rServiceName;
+}
+
+Sequence<OUString> SwXFrames::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ return ::comphelper::makeSequence(C2U("com.sun.star.text.TextFrames"));
+}
+
+SwXFrames::SwXFrames(SwDoc* _pDoc, FlyCntType eSet) :
+ SwUnoCollection(_pDoc),
+ eType(eSet)
+{}
+
+SwXFrames::~SwXFrames()
+{}
+
+uno::Reference<container::XEnumeration> SwXFrames::createEnumeration(void) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ return uno::Reference< container::XEnumeration >(
+ new SwXFrameEnumeration<FLYCNTTYPE_FRM>(GetDoc()));
+ case FLYCNTTYPE_GRF:
+ return uno::Reference< container::XEnumeration >(
+ new SwXFrameEnumeration<FLYCNTTYPE_GRF>(GetDoc()));
+ case FLYCNTTYPE_OLE:
+ return uno::Reference< container::XEnumeration >(
+ new SwXFrameEnumeration<FLYCNTTYPE_OLE>(GetDoc()));
+ default:
+ throw uno::RuntimeException();
+ }
+}
+
+sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetFlyCount(eType);
+}
+
+uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
+ throw(IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ if(nIndex < 0 || nIndex >= USHRT_MAX)
+ throw IndexOutOfBoundsException();
+ SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType);
+ if(!pFmt)
+ throw IndexOutOfBoundsException();
+ return lcl_UnoWrapFrame(pFmt, eType);
+}
+
+uno::Any SwXFrames::getByName(const OUString& rName)
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwFrmFmt* pFmt;
+ switch(eType)
+ {
+ case FLYCNTTYPE_GRF:
+ pFmt = GetDoc()->FindFlyByName(rName, ND_GRFNODE);
+ break;
+ case FLYCNTTYPE_OLE:
+ pFmt = GetDoc()->FindFlyByName(rName, ND_OLENODE);
+ break;
+ default:
+ pFmt = GetDoc()->FindFlyByName(rName, ND_TEXTNODE);
+ break;
+ }
+ if(!pFmt)
+ throw NoSuchElementException();
+ return lcl_UnoWrapFrame(const_cast<SwFrmFmt*>(pFmt), eType);
+}
+
+uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const Reference<XEnumeration> xEnum = createEnumeration();
+ ::std::vector<OUString> vNames;
+ while(xEnum->hasMoreElements())
+ {
+ Reference<container::XNamed> xNamed;
+ xEnum->nextElement() >>= xNamed;
+ if(xNamed.is())
+ vNames.push_back(xNamed->getName());
+ }
+ return ::comphelper::containerToSequence(vNames);
+}
+
+sal_Bool SwXFrames::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ switch(eType)
+ {
+ case FLYCNTTYPE_GRF:
+ return GetDoc()->FindFlyByName(rName, ND_GRFNODE) != NULL;
+ case FLYCNTTYPE_OLE:
+ return GetDoc()->FindFlyByName(rName, ND_OLENODE) != NULL;
+ default:
+ return GetDoc()->FindFlyByName(rName, ND_TEXTNODE) != NULL;
+ }
+}
+
+uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ return ::getCppuType((uno::Reference<XTextFrame>*)0);
+ case FLYCNTTYPE_GRF:
+ return ::getCppuType((uno::Reference<XTextContent>*)0);
+ case FLYCNTTYPE_OLE:
+ return ::getCppuType((uno::Reference<XEmbeddedObjectSupplier>*)0);
+ default:
+ return uno::Type();
+ }
+}
+
+sal_Bool SwXFrames::hasElements(void) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetFlyCount(eType) > 0;
+}
+
+SwXFrame* SwXFrames::GetObject(SwFrmFmt& rFmt, FlyCntType eType)
+{
+ SwXFrame* pFrm = (SwXFrame*)SwClientIter(rFmt).First(TYPE(SwXFrame));
+ if(pFrm) return pFrm;
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ return new SwXTextFrame(rFmt);
+ case FLYCNTTYPE_GRF:
+ return new SwXTextGraphicObject(rFmt);
+ case FLYCNTTYPE_OLE:
+ return new SwXTextEmbeddedObject(rFmt);
+ default:
+ return NULL;
+ }
+}
+
+/******************************************************************
+ * SwXTextFrames
+ ******************************************************************/
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextFrames::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextFrames");
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextFrames") == rServiceName;
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextFrames::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFrames");
+ return aRet;
+}
+/*-- 14.01.99 08:06:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFrames::SwXTextFrames(SwDoc* _pDoc) :
+ SwXFrames(_pDoc, FLYCNTTYPE_FRM)
+{
+}
+/*-- 14.01.99 08:06:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFrames::~SwXTextFrames()
+{
+}
+
+/******************************************************************
+ * SwXTextGraphicObjects
+ ******************************************************************/
+//SMART_UNO_IMPLEMENTATION( SwXTextGraphicObjects, UsrObject );
+
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextGraphicObjects::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextGraphicObjects");
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextGraphicObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextGraphicObjects") == rServiceName;
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextGraphicObjects::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextGraphicObjects");
+ return aRet;
+}
+/*-- 14.01.99 08:45:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextGraphicObjects::SwXTextGraphicObjects(SwDoc* _pDoc) :
+ SwXFrames(_pDoc, FLYCNTTYPE_GRF)
+{
+}
+/*-- 14.01.99 08:45:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextGraphicObjects::~SwXTextGraphicObjects()
+{
+}
+
+/******************************************************************
+ * SwXTextEmbeddedObjects
+ ******************************************************************/
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextEmbeddedObjects::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextEmbeddedObjects");
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextEmbeddedObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextEmbeddedObjects") == rServiceName;
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextEmbeddedObjects::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextEmbeddedObjects");
+ return aRet;
+}
+/*-- 14.01.99 08:45:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextEmbeddedObjects::SwXTextEmbeddedObjects(SwDoc* _pDoc) :
+ SwXFrames(_pDoc, FLYCNTTYPE_OLE)
+{
+}
+/*-- 14.01.99 08:45:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextEmbeddedObjects::~SwXTextEmbeddedObjects()
+{
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+#define PASSWORD_STD_TIMEOUT 1000
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextSections::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextSections");
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextSections::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextSections") == rServiceName;
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextSections::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextSections");
+ return aRet;
+}
+/*-- 14.01.99 09:06:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSections::SwXTextSections(SwDoc* _pDoc) :
+ SwUnoCollection(_pDoc)
+{
+}
+/*-- 14.01.99 09:06:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSections::~SwXTextSections()
+{
+}
+/*-- 14.01.99 09:06:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTextSections::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
+ sal_uInt16 nCount = rSectFmts.Count();
+ for(sal_uInt16 i = nCount; i; i--)
+ {
+ if( !rSectFmts[i - 1]->IsInNodesArr())
+ nCount--;
+ }
+ return nCount;
+}
+/*-- 14.01.99 09:06:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< XTextSection > xRet;
+ if(IsValid())
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+
+ const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
+ sal_uInt16 nCount = rSectFmts.Count();
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ if( !rSectFmts[i]->IsInNodesArr())
+ nIndex ++;
+ else if(nIndex == i)
+ break;
+ if(nIndex == i)
+ break;
+ }
+ if(nIndex >= 0 && nIndex < rFmts.Count())
+ {
+ SwSectionFmt* pFmt = rFmts[(sal_uInt16)nIndex];
+ xRet = GetObject(*pFmt);
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return makeAny(xRet);
+}
+/*-- 14.01.99 09:06:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextSections::getByName(const OUString& Name)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(IsValid())
+ {
+ String aName(Name);
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ uno::Reference< XTextSection > xSect;
+ for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
+ {
+ SwSectionFmt* pFmt = rFmts[i];
+ if (pFmt->IsInNodesArr()
+ && (aName == pFmt->GetSection()->GetSectionName()))
+ {
+ xSect = GetObject(*pFmt);
+ aRet.setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0));
+ break;
+ }
+ }
+ if(!xSect.is())
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 14.01.99 09:06:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextSections::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_uInt16 nCount = GetDoc()->GetSections().Count();
+ SwSectionFmts& rSectFmts = GetDoc()->GetSections();
+ for(sal_uInt16 i = nCount; i; i--)
+ {
+ if( !rSectFmts[i - 1]->IsInNodesArr())
+ nCount--;
+ }
+
+ uno::Sequence<OUString> aSeq(nCount);
+ if(nCount)
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ OUString* pArray = aSeq.getArray();
+ sal_uInt16 nIndex = 0;
+ for( sal_uInt16 i = 0; i < nCount; i++, nIndex++)
+ {
+ const SwSectionFmt* pFmt = rFmts[nIndex];
+ while(!pFmt->IsInNodesArr())
+ {
+ pFmt = rFmts[++nIndex];
+ }
+ pArray[i] = pFmt->GetSection()->GetSectionName();
+ }
+ }
+ return aSeq;
+}
+/*-- 14.01.99 09:06:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextSections::hasByName(const OUString& Name)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ String aName(Name);
+ if(IsValid())
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
+ {
+ const SwSectionFmt* pFmt = rFmts[i];
+ if (aName == pFmt->GetSection()->GetSectionName())
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ else
+ {
+ //Sonderbehandlung der dbg_ - Methoden
+ if( COMPARE_EQUAL != aName.CompareToAscii("dbg_", 4))
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 14.01.99 09:06:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXTextSections::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextSection>*)0);
+}
+/*-- 14.01.99 09:06:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextSections::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_uInt16 nCount = 0;
+ if(IsValid())
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ nCount = rFmts.Count();
+ }
+ else
+ throw uno::RuntimeException();
+ return nCount > 0;
+}
+/*-- 14.01.99 09:06:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFmt& rFmt )
+{
+ return SwXTextSection::CreateXTextSection(&rFmt);
+}
+
+OUString SwXBookmarks::getImplementationName(void) throw( RuntimeException )
+{
+ return OUString::createFromAscii("SwXBookmarks");
+}
+
+BOOL SwXBookmarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return OUString::createFromAscii("com.sun.star.text.Bookmarks") == rServiceName;
+}
+
+Sequence< OUString > SwXBookmarks::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ aRet[0] = OUString::createFromAscii("com.sun.star.text.Bookmarks");
+ return aRet;
+}
+
+SwXBookmarks::SwXBookmarks(SwDoc* _pDoc) :
+ SwUnoCollection(_pDoc)
+{ }
+
+SwXBookmarks::~SwXBookmarks()
+{ }
+
+sal_Int32 SwXBookmarks::getCount(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount();
+}
+
+uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
+ if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount())
+ throw IndexOutOfBoundsException();
+
+ uno::Any aRet;
+ ::sw::mark::IMark* pBkmk = pMarkAccess->getBookmarksBegin()[nIndex].get();
+ const uno::Reference< text::XTextContent > xRef =
+ SwXBookmark::CreateXBookmark(*GetDoc(), *pBkmk);
+ aRet <<= xRef;
+ return aRet;
+}
+
+uno::Any SwXBookmarks::getByName(const rtl::OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
+ IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName);
+ if(ppBkmk == pMarkAccess->getBookmarksEnd())
+ throw NoSuchElementException();
+
+ uno::Any aRet;
+ const uno::Reference< text::XTextContent > xRef =
+ SwXBookmark::CreateXBookmark(*GetDoc(), *(ppBkmk->get()));
+ aRet <<= xRef;
+ return aRet;
+}
+
+uno::Sequence< OUString > SwXBookmarks::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
+ uno::Sequence<OUString> aSeq(pMarkAccess->getBookmarksCount());
+ sal_Int32 nCnt = 0;
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
+ ppMark != pMarkAccess->getBookmarksEnd();)
+ aSeq[nCnt++] = (*ppMark++)->GetName();
+ return aSeq;
+}
+
+sal_Bool SwXBookmarks::hasByName(const OUString& rName)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
+ return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd();
+}
+
+uno::Type SAL_CALL SwXBookmarks::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextContent>*)0);
+}
+
+sal_Bool SwXBookmarks::hasElements(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount() != 0;
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+
+SwXNumberingRulesCollection::SwXNumberingRulesCollection( SwDoc* _pDoc ) :
+ SwUnoCollection(_pDoc)
+{
+}
+
+SwXNumberingRulesCollection::~SwXNumberingRulesCollection()
+{
+}
+
+sal_Int32 SwXNumberingRulesCollection::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetNumRuleTbl().Count();
+}
+
+uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(IsValid())
+ {
+ uno::Reference< XIndexReplace > xRef;
+ if ( nIndex < GetDoc()->GetNumRuleTbl().Count() )
+ {
+ xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< USHORT >(nIndex) ] );
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XIndexReplace>*)0));
+ }
+
+ if(!xRef.is())
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Type SAL_CALL SwXNumberingRulesCollection::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XIndexReplace>*)0);
+}
+
+sal_Bool SwXNumberingRulesCollection::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetNumRuleTbl().Count() > 0;
+}
+
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFootnotes::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFootnotes");
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFootnotes::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.Footnotes") == rServiceName;
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXFootnotes::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Footnotes");
+ return aRet;
+}
+/*-- 14.01.99 09:03:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnotes::SwXFootnotes(sal_Bool bEnd, SwDoc* _pDoc)
+ : SwUnoCollection(_pDoc)
+ , m_bEndnote(bEnd)
+{
+}
+/*-- 14.01.99 09:03:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnotes::~SwXFootnotes()
+{
+}
+/*-- 14.01.99 09:03:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_Int32 nCount = 0;
+ sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count();
+ SwTxtFtn* pTxtFtn;
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if ( rFtn.IsEndNote() != m_bEndnote )
+ continue;
+ nCount++;
+ }
+ return nCount;
+}
+/*-- 14.01.99 09:03:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ sal_Int32 nCount = 0;
+ if(IsValid())
+ {
+ sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count();
+ SwTxtFtn* pTxtFtn;
+ uno::Reference< XFootnote > xRef;
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if ( rFtn.IsEndNote() != m_bEndnote )
+ continue;
+
+ if(nCount == nIndex)
+ {
+ xRef = SwXFootnote::CreateXFootnote(*GetDoc(), rFtn);
+ aRet <<= xRef;
+ break;
+ }
+ nCount++;
+ }
+ if(!xRef.is())
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 14.01.99 09:03:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXFootnotes::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XFootnote>*)0);
+}
+/*-- 14.01.99 09:03:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXFootnotes::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetFtnIdxs().Count() > 0;
+}
+/* -----------------------------05.09.00 12:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFmtFtn& rFmt )
+{
+ return SwXFootnote::CreateXFootnote(rDoc, rFmt);
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXReferenceMarks::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXReferenceMarks");
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXReferenceMarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.ReferenceMarks") == rServiceName;
+}
+/* -----------------------------06.04.00 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXReferenceMarks::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ReferenceMarks");
+ return aRet;
+}
+/*-- 14.01.99 09:03:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXReferenceMarks::SwXReferenceMarks(SwDoc* _pDoc) :
+ SwUnoCollection(_pDoc)
+{
+}
+/*-- 14.01.99 09:03:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXReferenceMarks::~SwXReferenceMarks()
+{
+}
+/*-- 14.01.99 09:03:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXReferenceMarks::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetRefMarks();
+}
+/*-- 14.01.99 09:03:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ uno::Reference< XTextContent > xRef;
+ if(0 <= nIndex && nIndex < USHRT_MAX)
+ {
+ const SwFmtRefMark* pMark = GetDoc()->GetRefMark( (sal_uInt16) nIndex );
+ if(pMark)
+ {
+ xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ }
+ if(!xRef.is())
+ throw IndexOutOfBoundsException();
+ return aRet;
+}
+/*-- 14.01.99 09:03:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXReferenceMarks::getByName(const OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(IsValid())
+ {
+ const SwFmtRefMark* pMark = GetDoc()->GetRefMark(rName);
+ if(pMark)
+ {
+ uno::Reference< XTextContent > xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ else
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 14.01.99 09:03:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXReferenceMarks::getElementNames(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence<OUString> aRet;
+ if(IsValid())
+ {
+ SvStringsDtor aStrings;
+ sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
+ aRet.realloc(nCount);
+ OUString* pNames = aRet.getArray();
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ pNames[i] = *aStrings.GetObject(i);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 14.01.99 09:03:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXReferenceMarks::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return 0 != GetDoc()->GetRefMark( rName);
+}
+/*-- 14.01.99 09:03:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXReferenceMarks::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextContent>*)0);
+}
+/*-- 14.01.99 09:03:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXReferenceMarks::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return 0 != GetDoc()->GetRefMarks();
+}
+/*-- 14.01.99 09:03:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXReferenceMark* SwXReferenceMarks::GetObject( SwDoc* pDoc, const SwFmtRefMark* pMark )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return SwXReferenceMark::CreateXReferenceMark(*pDoc, *pMark);
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/*-----------------11.03.98 11:18-------------------
+ Gueltigkeitspruefung
+--------------------------------------------------*/
+void SwUnoCollection::Invalidate()
+{
+ bObjectValid = sal_False;
+ pDoc = 0;
+}
+
diff --git a/sw/source/core/unocore/unocore.src b/sw/source/core/unocore/unocore.src
new file mode 100644
index 000000000000..4bab91813490
--- /dev/null
+++ b/sw/source/core/unocore/unocore.src
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <unocore.hrc>
+
+String STR_CHART2_ROW_LABEL_TEXT
+{
+ Text [ en-US ] = "Row %ROWNUMBER" ;
+};
+
+String STR_CHART2_COL_LABEL_TEXT
+{
+ Text [ en-US ] = "Column %COLUMNLETTER" ;
+};
+
+String STR_STYLE_FAMILY_CHARACTER
+{
+ Text [ en-US ] = "Character" ;
+};
+
+String STR_STYLE_FAMILY_PARAGRAPH
+{
+ Text [ en-US ] = "Paragraph" ;
+};
+
+String STR_STYLE_FAMILY_FRAME
+{
+ Text [ en-US ] = "Frame" ;
+};
+
+String STR_STYLE_FAMILY_PAGE
+{
+ Text [ en-US ] = "Pages" ;
+};
+
+String STR_STYLE_FAMILY_NUMBERING
+{
+ Text [ en-US ] = "Numbering" ;
+};
+
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
new file mode 100644
index 000000000000..92a33da130fe
--- /dev/null
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -0,0 +1,1150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <svx/svxids.hrc>
+#include <map>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <cmdid.h>
+#include <unocrsrhelper.hxx>
+#include <unofootnote.hxx>
+#include <unorefmark.hxx>
+#include <unostyle.hxx>
+#include <unoidx.hxx>
+#include <unofield.hxx>
+#include <unotbl.hxx>
+#include <unosett.hxx>
+#include <unoframe.hxx>
+#include <unocrsr.hxx>
+#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <fmtftn.hxx>
+#include <fmtpdsc.hxx>
+#include <charfmt.hxx>
+#include <pagedesc.hxx>
+#include <docstyle.hxx>
+#include <ndtxt.hxx>
+#include <txtrfmrk.hxx>
+#include <fmtfld.hxx>
+#include <docsh.hxx>
+#include <section.hxx>
+#include <shellio.hxx>
+#include <edimp.hxx>
+#include <swundo.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <svl/eitem.hxx>
+#include <tools/urlobj.hxx>
+#include <docary.hxx>
+#include <swtable.hxx>
+#include <tox.hxx>
+#include <doctxm.hxx>
+#include <fchrfmt.hxx>
+#include <editeng/flstitem.hxx>
+#include <vcl/metric.hxx>
+#include <svtools/ctrltool.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#include <svl/svstdarr.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svl/stritem.hxx>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <SwStyleNameMapper.hxx>
+#include <redline.hxx>
+#include <numrule.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+// --> OD 2008-11-26 #158694#
+#include <SwNodeNum.hxx>
+// <--
+#include <fmtmeta.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using ::rtl::OUString;
+
+
+namespace SwUnoCursorHelper
+{
+
+uno::Reference<text::XTextContent>
+GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
+ bool const bParent)
+{
+ // these should be unambiguous because of the dummy character
+ SwTxtNode::GetTxtAttrMode const eMode( (bParent)
+ ? SwTxtNode::PARENT : SwTxtNode::EXPAND );
+ SwTxtAttr *const pMetaTxtAttr =
+ rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_META, eMode);
+ SwTxtAttr *const pMetaFieldTxtAttr =
+ rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode);
+ // which is innermost?
+ SwTxtAttr *const pTxtAttr = (pMetaTxtAttr)
+ ? ((pMetaFieldTxtAttr)
+ ? ((*pMetaFieldTxtAttr->GetStart() >
+ *pMetaTxtAttr->GetStart())
+ ? pMetaFieldTxtAttr : pMetaTxtAttr)
+ : pMetaTxtAttr)
+ : pMetaFieldTxtAttr;
+ uno::Reference<XTextContent> xRet;
+ if (pTxtAttr)
+ {
+ ::sw::Meta *const pMeta(
+ static_cast<SwFmtMeta &>(pTxtAttr->GetAttr()).GetMeta());
+ OSL_ASSERT(pMeta);
+ xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
+ }
+ return xRet;
+}
+
+
+/* -----------------16.09.98 12:27-------------------
+* Lesen spezieller Properties am Cursor
+ * --------------------------------------------------*/
+sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
+ , SwPaM& rPam
+ , Any *pAny
+ , PropertyState& eState
+ , const SwTxtNode* pNode )
+{
+ PropertyState eNewState = PropertyState_DIRECT_VALUE;
+// PropertyState_DEFAULT_VALUE
+// PropertyState_AMBIGUOUS_VALUE
+ sal_Bool bDone = sal_True;
+ switch(rEntry.nWID)
+ {
+ // --> OD 2008-11-26 #158694#
+ case FN_UNO_PARA_CONT_PREV_SUBTREE:
+ if (pAny)
+ {
+ const SwTxtNode * pTmpNode = pNode;
+
+ if (!pTmpNode)
+ pTmpNode = rPam.GetNode()->GetTxtNode();
+
+ bool bRet = false;
+
+ if ( pTmpNode &&
+ pTmpNode->GetNum() &&
+ pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
+ {
+ bRet = true;
+ }
+
+ *pAny <<= bRet;
+ }
+ break;
+ case FN_UNO_PARA_NUM_STRING:
+ if (pAny)
+ {
+ const SwTxtNode * pTmpNode = pNode;
+
+ if (!pTmpNode)
+ pTmpNode = rPam.GetNode()->GetTxtNode();
+
+ String sRet;
+ if ( pTmpNode && pTmpNode->GetNum() )
+ {
+ sRet = pTmpNode->GetNumString();
+ }
+
+ *pAny <<= OUString(sRet);
+ }
+ break;
+ // <--
+ // --> OD 2008-05-20 #outlinelevel# - no longer needed
+// case FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL:
+// if (pAny)
+// {
+// const SwTxtNode * pTmpNode = pNode;
+
+// if (!pTmpNode)
+// pTmpNode = rPam.GetNode()->GetTxtNode();
+
+// sal_Int8 nRet = -1;
+// if (pTmpNode && pTmpNode->GetOutlineLevel() != NO_NUMBERING)
+// nRet = sal::static_int_cast< sal_Int8 >(pTmpNode->GetOutlineLevel());
+// *pAny <<= nRet;
+// }
+// break;
+ // <--
+ case RES_PARATR_OUTLINELEVEL: //#outlinelevel added by zhaojianwei
+ if (pAny)
+ {
+ const SwTxtNode * pTmpNode = pNode;
+
+ if (!pTmpNode)
+ pTmpNode = rPam.GetNode()->GetTxtNode();
+
+ sal_Int16 nRet = -1;
+ if ( pTmpNode )
+ nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
+
+ *pAny <<= nRet;
+ }
+ break; //<-end,zhaojianwei
+ case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
+ case FN_UNO_PARA_STYLE :
+ {
+ SwFmtColl* pFmt = 0;
+ if(pNode)
+ pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
+ ? pNode->GetFmtColl() : &pNode->GetAnyFmtColl();
+ else
+ {
+ pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(rPam,
+ FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID);
+ }
+ if(pFmt)
+ {
+ if( pAny )
+ {
+ String sVal;
+ SwStyleNameMapper::FillProgName(pFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ *pAny <<= OUString(sVal);
+ }
+ }
+ else
+ eNewState = PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ case FN_UNO_PAGE_STYLE :
+ {
+ String sVal;
+ GetCurPageStyle(rPam, sVal);
+ if( pAny )
+ *pAny <<= OUString(sVal);
+ if(!sVal.Len())
+ eNewState = PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ case FN_UNO_NUM_START_VALUE :
+ if( pAny )
+ {
+ sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
+ *pAny <<= nValue;
+ }
+ break;
+ case FN_UNO_NUM_LEVEL :
+ case FN_UNO_IS_NUMBER :
+ // --> OD 2008-07-14 #i91601#
+ case FN_UNO_LIST_ID:
+ // <--
+ case FN_NUMBER_NEWSTART:
+ {
+ // a multi selection is not considered
+ const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
+ // --> OD 2010-01-13 #b6912256#
+ if ( pTxtNd && pTxtNd->IsInList() )
+ // <--
+ {
+ if( pAny )
+ {
+ if(rEntry.nWID == FN_UNO_NUM_LEVEL)
+ *pAny <<= (sal_Int16)(pTxtNd->GetActualListLevel());
+ else if(rEntry.nWID == FN_UNO_IS_NUMBER)
+ {
+ BOOL bIsNumber = pTxtNd->IsCountedInList();
+ pAny->setValue(&bIsNumber, ::getBooleanCppuType());
+ }
+ // --> OD 2008-07-14 #i91601#
+ else if ( rEntry.nWID == FN_UNO_LIST_ID )
+ {
+ const String sListId = pTxtNd->GetListId();
+ *pAny <<= OUString(sListId);
+ }
+ // <--
+ else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
+ {
+ BOOL bIsRestart = pTxtNd->IsListRestart();
+ pAny->setValue(&bIsRestart, ::getBooleanCppuType());
+ }
+ }
+ }
+ else
+ {
+ eNewState = PropertyState_DEFAULT_VALUE;
+
+ if( pAny )
+ {
+ // #i30838# set default values for default properties
+ if(rEntry.nWID == FN_UNO_NUM_LEVEL)
+ *pAny <<= static_cast<sal_Int16>( 0 );
+ else if(rEntry.nWID == FN_UNO_IS_NUMBER)
+ *pAny <<= false;
+ // --> OD 2008-07-14 #i91601#
+ else if ( rEntry.nWID == FN_UNO_LIST_ID )
+ {
+ *pAny <<= OUString();
+ }
+ // <--
+ else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
+ *pAny <<= false;
+ }
+ }
+ //PROPERTY_MAYBEVOID!
+ }
+ break;
+ case FN_UNO_NUM_RULES :
+ if( pAny )
+ getNumberingProperty(rPam, eNewState, pAny);
+ else
+ {
+ if( !rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() ) )
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_DOCUMENT_INDEX_MARK:
+ {
+ ::std::vector<SwTxtAttr *> const marks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
+ if (marks.size())
+ {
+ if( pAny )
+ { // hmm... can only return 1 here
+ SwTOXMark & rMark =
+ static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
+ const uno::Reference< text::XDocumentIndexMark > xRef =
+ SwXDocumentIndexMark::CreateXDocumentIndexMark(
+ *rPam.GetDoc(),
+ *const_cast<SwTOXType*>(rMark.GetTOXType()), rMark);
+ (*pAny) <<= xRef;
+ }
+ }
+ else
+ //auch hier - nicht zu unterscheiden
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_DOCUMENT_INDEX:
+ {
+ const SwTOXBase* pBase = rPam.GetDoc()->GetCurTOX(
+ *rPam.Start() );
+ if( pBase )
+ {
+ if( pAny )
+ {
+ const uno::Reference< text::XDocumentIndex > xRef =
+ SwXDocumentIndex::CreateXDocumentIndex(*rPam.GetDoc(),
+ *static_cast<SwTOXBaseSection const*>(pBase));
+ (*pAny) <<= xRef;
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_TEXT_FIELD:
+ {
+ const SwPosition *pPos = rPam.Start();
+ const SwTxtNode *pTxtNd =
+ rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTxtNode();
+ SwTxtAttr *const pTxtAttr = (pTxtNd)
+ ? pTxtNd->GetTxtAttrForCharAt(
+ pPos->nContent.GetIndex(), RES_TXTATR_FIELD)
+ : 0;
+ if(pTxtAttr)
+ {
+ if( pAny )
+ {
+ SwXTextField* pField = CreateSwXTextField(*rPam.GetDoc(),
+ pTxtAttr->GetFld());
+ *pAny <<= uno::Reference< XTextField >( pField );
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+/* laesst sich nicht feststellen
+* case FN_UNO_BOOKMARK:
+ {
+ if()
+ {
+ uno::Reference< XBookmark > xBkm = SwXBookmarks::GetObject(rBkm);
+ rAny.set(&xBkm, ::getCppuType((const XBookmark*)0)());
+ }
+ }
+ break;*/
+ case FN_UNO_TEXT_TABLE:
+ case FN_UNO_CELL:
+ {
+ SwStartNode* pSttNode = rPam.GetNode()->StartOfSectionNode();
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+ if(SwTableBoxStartNode == eType)
+ {
+ if( pAny )
+ {
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
+ //SwTable& rTable = ((SwTableNode*)pSttNode)->GetTable();
+ if(FN_UNO_TEXT_TABLE == rEntry.nWID)
+ {
+ uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFmt);
+ pAny->setValue(&xTable, ::getCppuType((uno::Reference<XTextTable>*)0));
+ }
+ else
+ {
+ SwTableBox* pBox = pSttNode->GetTblBox();
+ uno::Reference< XCell > xCell = SwXCell::CreateXCell(pTableFmt, pBox);
+ pAny->setValue(&xCell, ::getCppuType((uno::Reference<XCell>*)0));
+ }
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_TEXT_FRAME:
+ {
+ SwStartNode* pSttNode = rPam.GetNode()->StartOfSectionNode();
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+
+ SwFrmFmt* pFmt;
+ if(eType == SwFlyStartNode && 0 != (pFmt = pSttNode->GetFlyFmt()))
+ {
+ if( pAny )
+ {
+ uno::Reference< XTextFrame > xFrm = (SwXTextFrame*) SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM);
+ pAny->setValue(&xFrm, ::getCppuType((uno::Reference<XTextFrame>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_TEXT_SECTION:
+ {
+ SwSection* pSect = rPam.GetDoc()->GetCurrSection(*rPam.GetPoint());
+ if(pSect)
+ {
+ if( pAny )
+ {
+ uno::Reference< XTextSection > xSect = SwXTextSections::GetObject( *pSect->GetFmt() );
+ pAny->setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0) );
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_ENDNOTE:
+ case FN_UNO_FOOTNOTE:
+ {
+ SwTxtAttr *const pTxtAttr =
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN);
+ if(pTxtAttr)
+ {
+ const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
+ if(rFtn.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
+ {
+ if( pAny )
+ {
+ const uno::Reference< text::XFootnote > xFootnote =
+ SwXFootnote::CreateXFootnote(*rPam.GetDoc(), rFtn);
+ *pAny <<= xFootnote;
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_REFERENCE_MARK:
+ {
+ ::std::vector<SwTxtAttr *> const marks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
+ if (marks.size())
+ {
+ if( pAny )
+ { // hmm... can only return 1 here
+ const SwFmtRefMark& rRef = (*marks.begin())->GetRefMark();
+ uno::Reference< XTextContent > xRef = SwXReferenceMarks::GetObject( rPam.GetDoc(), &rRef );
+ pAny->setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_NESTED_TEXT_CONTENT:
+ {
+ uno::Reference<XTextContent> const xRet(
+ GetNestedTextContent(*rPam.GetNode()->GetTxtNode(),
+ rPam.GetPoint()->nContent.GetIndex(), false));
+ if (xRet.is())
+ {
+ if (pAny)
+ {
+ (*pAny) <<= xRet;
+ }
+ }
+ else
+ {
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ break;
+ case FN_UNO_CHARFMT_SEQUENCE:
+ {
+
+ SwTxtNode* pTxtNode;
+ if((pTxtNode = (SwTxtNode*)rPam.GetNode( TRUE )) == rPam.GetNode(FALSE) &&
+ pTxtNode->GetpSwpHints())
+ {
+ USHORT nPaMStart = rPam.GetPoint()->nContent.GetIndex();
+ USHORT nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
+ if(nPaMStart > nPaMEnd)
+ {
+ USHORT nTmp = nPaMStart;
+ nPaMStart = nPaMEnd;
+ nPaMEnd = nTmp;
+ }
+ Sequence< ::rtl::OUString> aCharStyles;
+ SwpHints* pHints = pTxtNode->GetpSwpHints();
+ for(USHORT nAttr = 0; nAttr < pHints->GetStartCount(); nAttr++ )
+ {
+ SwTxtAttr* pAttr = pHints->GetStart( nAttr );
+ if(pAttr->Which() != RES_TXTATR_CHARFMT)
+ continue;
+ USHORT nAttrStart = *pAttr->GetStart();
+ USHORT nAttrEnd = *pAttr->GetEnd();
+ //check if the attribute touches the selection
+ if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
+ ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
+ {
+ //check for overlapping
+ if(nAttrStart > nPaMStart ||
+ nAttrEnd < nPaMEnd)
+ {
+ aCharStyles.realloc(0);
+ eNewState = PropertyState_AMBIGUOUS_VALUE;
+ break;
+ }
+ else
+ {
+ //now the attribute should start before or at the selection
+ //and it should end at the end of the selection or behind
+ DBG_ASSERT(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
+ "attribute overlaps or is outside");
+ //now the name of the style has to be added to the sequence
+ aCharStyles.realloc(aCharStyles.getLength() + 1);
+ DBG_ASSERT(pAttr->GetCharFmt().GetCharFmt(), "no character format set");
+ aCharStyles.getArray()[aCharStyles.getLength() - 1] =
+ SwStyleNameMapper::GetProgName(
+ pAttr->GetCharFmt().GetCharFmt()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ }
+ }
+
+ }
+ eNewState =
+ aCharStyles.getLength() ?
+ PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;;
+ if(pAny)
+ (*pAny) <<= aCharStyles;
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case RES_TXTATR_CHARFMT:
+ // kein break hier!
+ default: bDone = sal_False;
+ }
+ if( bDone )
+ eState = eNewState;
+ return bDone;
+};
+/* -----------------30.06.98 10:30-------------------
+ *
+ * --------------------------------------------------*/
+sal_Int16 IsNodeNumStart(SwPaM& rPam, PropertyState& eState)
+{
+ const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
+ // --> OD 2008-02-28 #refactorlists#
+ // correction: check, if restart value is set at the text node and use
+ // new method <SwTxtNode::GetAttrListRestartValue()> to retrieve the value
+ if ( pTxtNd && pTxtNd->GetNumRule() && pTxtNd->IsListRestart() &&
+ pTxtNd->HasAttrListRestartValue() )
+ {
+ eState = PropertyState_DIRECT_VALUE;
+ sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTxtNd->GetAttrListRestartValue());
+ return nTmp;
+ }
+ // <--
+ eState = PropertyState_DEFAULT_VALUE;
+ return -1;
+}
+
+/* -----------------25.05.98 11:41-------------------
+ *
+ * --------------------------------------------------*/
+void setNumberingProperty(const Any& rValue, SwPaM& rPam)
+{
+ uno::Reference<XIndexReplace> xIndexReplace;
+ if(rValue >>= xIndexReplace)
+ {
+ SwXNumberingRules* pSwNum = 0;
+
+ uno::Reference<XUnoTunnel> xNumTunnel(xIndexReplace, UNO_QUERY);
+ if(xNumTunnel.is())
+ {
+ pSwNum = reinterpret_cast< SwXNumberingRules * >(
+ sal::static_int_cast< sal_IntPtr >( xNumTunnel->getSomething( SwXNumberingRules::getUnoTunnelId() )));
+ }
+
+ if(pSwNum)
+ {
+ SwDoc* pDoc = rPam.GetDoc();
+ if(pSwNum->GetNumRule())
+ {
+ SwNumRule aRule(*pSwNum->GetNumRule());
+ const String* pNewCharStyles = pSwNum->GetNewCharStyleNames();
+ const String* pBulletFontNames = pSwNum->GetBulletFontNames();
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+ SwNumFmt aFmt(aRule.Get( i ));
+ if( pNewCharStyles[i].Len() &&
+ pNewCharStyles[i] != SwXNumberingRules::GetInvalidStyle() &&
+ (!aFmt.GetCharFmt() || pNewCharStyles[i] != aFmt.GetCharFmt()->GetName()))
+ {
+ if(!pNewCharStyles[i].Len())
+ aFmt.SetCharFmt(0);
+ else
+ {
+
+ // CharStyle besorgen und an der Rule setzen
+ sal_uInt16 nChCount = pDoc->GetCharFmts()->Count();
+ SwCharFmt* pCharFmt = 0;
+ for(sal_uInt16 nCharFmt = 0; nCharFmt < nChCount; nCharFmt++)
+ {
+ SwCharFmt& rChFmt = *((*(pDoc->GetCharFmts()))[nCharFmt]);;
+ if(rChFmt.GetName() == pNewCharStyles[i])
+ {
+ pCharFmt = &rChFmt;
+ break;
+ }
+ }
+
+ if(!pCharFmt)
+ {
+ SfxStyleSheetBasePool* pPool = pDoc->GetDocShell()->GetStyleSheetPool();
+ SfxStyleSheetBase* pBase;
+ pBase = pPool->Find(pNewCharStyles[i], SFX_STYLE_FAMILY_CHAR);
+ // soll das wirklich erzeugt werden?
+ if(!pBase)
+ pBase = &pPool->Make(pNewCharStyles[i], SFX_STYLE_FAMILY_PAGE);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+ }
+ if(pCharFmt)
+ aFmt.SetCharFmt(pCharFmt);
+ }
+ }
+ //jetzt nochmal fuer Fonts
+ if(
+ pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() &&
+ (
+ (pBulletFontNames[i].Len() && !aFmt.GetBulletFont()) ||
+ (pBulletFontNames[i].Len() &&
+ aFmt.GetBulletFont()->GetName() != pBulletFontNames[i])
+ )
+ )
+ {
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pDoc->GetDocShell()
+ ->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFontListItem->GetFontList();
+
+ FontInfo aInfo = pList->Get(
+ pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
+ Font aFont(aInfo);
+ aFmt.SetBulletFont(&aFont);
+ }
+ aRule.Set( i, aFmt );
+ }
+ UnoActionContext aAction(pDoc);
+
+ if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
+ {
+ pDoc->StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( rPam );
+ SwPaM aPam( *rPam.GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ {
+ // --> OD 2008-03-17 #refactorlists#
+ // no start of a new list
+ pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
+ // <--
+ }
+ pDoc->EndUndo( UNDO_END, NULL );
+ }
+ else
+ {
+ // --> OD 2008-03-17 #refactorlists#
+ // no start of a new list
+ pDoc->SetNumRule( rPam, aRule, false );
+ // <--
+ }
+
+
+ }
+ else if(pSwNum->GetCreatedNumRuleName().Len())
+ {
+ UnoActionContext aAction(pDoc);
+ SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
+ if(!pRule)
+ throw RuntimeException();
+ // --> OD 2008-03-17 #refactorlists#
+ // no start of a new list
+ pDoc->SetNumRule( rPam, *pRule, false );
+ // <--
+ }
+ // --> OD 2009-08-18 #i103817#
+ // outline numbering
+ else
+ {
+ UnoActionContext aAction(pDoc);
+ SwNumRule* pRule = pDoc->GetOutlineNumRule();
+ if(!pRule)
+ throw RuntimeException();
+ pDoc->SetNumRule( rPam, *pRule, false );
+ }
+ // <--
+ }
+ }
+ else if(rValue.getValueType() == ::getVoidCppuType())
+ {
+ rPam.GetDoc()->DelNumRules(rPam);
+ }
+}
+
+
+/* -----------------25.05.98 11:40-------------------
+ *
+ * --------------------------------------------------*/
+void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
+{
+ const SwNumRule* pNumRule = rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() );
+ if(pNumRule)
+ {
+ uno::Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
+ if ( pAny )
+ pAny->setValue(&xNum, ::getCppuType((const uno::Reference<XIndexReplace>*)0));
+ eState = PropertyState_DIRECT_VALUE;
+ }
+ else
+ eState = PropertyState_DEFAULT_VALUE;
+}
+/* -----------------04.07.98 15:15-------------------
+ *
+ * --------------------------------------------------*/
+void GetCurPageStyle(SwPaM& rPaM, String &rString)
+{
+ const SwPageFrm* pPage = rPaM.GetCntntNode()->GetFrm()->FindPageFrm();
+ if(pPage)
+ SwStyleNameMapper::FillProgName( pPage->GetPageDesc()->GetName(), rString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
+}
+/* -----------------30.03.99 10:52-------------------
+ * spezielle Properties am Cursor zuruecksetzen
+ * --------------------------------------------------*/
+void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam)
+{
+ SwDoc* pDoc = rPam.GetDoc();
+ switch(rEntry.nWID)
+ {
+ case FN_UNO_PARA_STYLE :
+// lcl_SetTxtFmtColl(aValue, pUnoCrsr);
+ break;
+ case FN_UNO_PAGE_STYLE :
+ break;
+ case FN_UNO_NUM_START_VALUE :
+ {
+ UnoActionContext aAction(pDoc);
+
+ if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
+ {
+ pDoc->StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( rPam );
+ SwPaM aPam( *rPam.GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
+ pDoc->EndUndo( UNDO_END, NULL );
+ }
+ else
+ pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 );
+ }
+
+ break;
+ case FN_UNO_NUM_LEVEL :
+ break;
+ case FN_UNO_NUM_RULES:
+// lcl_setNumberingProperty(aValue, pUnoCrsr);
+ break;
+ case FN_UNO_CHARFMT_SEQUENCE:
+ {
+ SvUShortsSort aWhichIds;
+ aWhichIds.Insert(RES_TXTATR_CHARFMT);
+ pDoc->ResetAttrs(rPam, sal_True, &aWhichIds);
+ }
+ break;
+ }
+}
+/* -----------------21.07.98 11:36-------------------
+ *
+ * --------------------------------------------------*/
+void InsertFile(SwUnoCrsr* pUnoCrsr,
+ const String& rURL,
+ const uno::Sequence< beans::PropertyValue >& rOptions
+ ) throw( lang::IllegalArgumentException, io::IOException, uno::RuntimeException )
+{
+ SfxMedium* pMed = 0;
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ comphelper::MediaDescriptor aMediaDescriptor( rOptions );
+ ::rtl::OUString sFileName = rURL;
+ ::rtl::OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
+ uno::Reference < io::XStream > xStream;
+ uno::Reference < io::XInputStream > xInputStream;
+
+ if( !sFileName.getLength() )
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_URL()] >>= sFileName;
+ if( !sFileName.getLength() )
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_FILENAME()] >>= sFileName;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_STREAM()] >>= xStream;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_FILTERNAME()] >>= sFilterName;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_FILTEROPTIONS()] >>= sFilterOptions;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_PASSWORD()] >>= sPassword;
+ aMediaDescriptor[comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL() ] >>= sBaseURL;
+ if ( !xInputStream.is() && xStream.is() )
+ xInputStream = xStream->getInputStream();
+
+ if(!pDocSh || (!sFileName.getLength() && !xInputStream.is()))
+ return;
+
+ SfxObjectFactory& rFact = pDocSh->GetFactory();
+ const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
+ uno::Reference < embed::XStorage > xReadStorage;
+ if( xInputStream.is() )
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[0] <<= xInputStream;
+ aArgs[1] <<= embed::ElementModes::READ;
+ try
+ {
+ xReadStorage = uno::Reference< embed::XStorage >(
+ ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
+ uno::UNO_QUERY );
+ }
+ catch( const io::IOException& rEx)
+ {
+ (void)rEx;
+ }
+ }
+ if ( !pFilter )
+ {
+ if( xInputStream.is() && !xReadStorage.is())
+ {
+ pMed = new SfxMedium;
+ pMed->setStreamToLoadFrom(xInputStream, sal_True );
+ }
+ else
+ pMed = xReadStorage.is() ?
+ new SfxMedium(xReadStorage, sBaseURL, 0 ) :
+ new SfxMedium(sFileName, STREAM_READ, sal_True, 0, 0 );
+ if( sBaseURL.getLength() )
+ pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
+
+ SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
+ ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, sal_False );
+ if ( nErr || !pFilter)
+ DELETEZ(pMed);
+ else
+ pMed->SetFilter( pFilter );
+ }
+ else
+ {
+ if(!pMed)
+ {
+ if( xInputStream.is() && !xReadStorage.is())
+ {
+ pMed = new SfxMedium;
+ pMed->setStreamToLoadFrom(xInputStream, sal_True );
+ pMed->SetFilter( pFilter );
+ }
+ else
+ {
+ if( xReadStorage.is() )
+ {
+ pMed = new SfxMedium(xReadStorage, sBaseURL, 0 );
+ pMed->SetFilter( pFilter );
+ }
+ else
+ pMed = new SfxMedium(sFileName, STREAM_READ, sal_True, pFilter, 0);
+ }
+ }
+ if(sFilterOptions.getLength())
+ pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) );
+ if( sBaseURL.getLength())
+ pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
+ }
+
+ if( !pMed )
+ return;
+
+ SfxObjectShellRef aRef( pDocSh );
+
+ pDocSh->RegisterTransfer( *pMed );
+ pMed->DownLoad(); // ggfs. den DownLoad anstossen
+ if( aRef.Is() && 1 < aRef->GetRefCount() ) // noch gueltige Ref?
+ {
+ SwReader* pRdr;
+ SfxItemSet* pSet = pMed->GetItemSet();
+ pSet->Put(SfxBoolItem(FN_API_CALL, sal_True));
+ if(sPassword.getLength())
+ pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
+ Reader *pRead = pDocSh->StartConvertFrom( *pMed, &pRdr, 0, pUnoCrsr);
+ if( pRead )
+ {
+
+ UnoActionContext aContext(pDoc);
+
+ if(pUnoCrsr->HasMark())
+ pDoc->DeleteAndJoin(*pUnoCrsr);
+
+ SwNodeIndex aSave( pUnoCrsr->GetPoint()->nNode, -1 );
+ xub_StrLen nCntnt = pUnoCrsr->GetPoint()->nContent.GetIndex();
+
+ sal_uInt32 nErrno = pRdr->Read( *pRead ); // und Dokument einfuegen
+
+ if(!nErrno)
+ {
+ aSave++;
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetMark()->nNode = aSave;
+
+ SwCntntNode* pCntNode = aSave.GetNode().GetCntntNode();
+ if( !pCntNode )
+ nCntnt = 0;
+ pUnoCrsr->GetMark()->nContent.Assign( pCntNode, nCntnt );
+ }
+
+ delete pRdr;
+
+ // ggfs. alle Verzeichnisse updaten:
+/* if( pWrtShell->IsUpdateTOX() )
+ {
+ SfxRequest aReq( *this, FN_UPDATE_TOX );
+ Execute( aReq );
+ pWrtShell->SetUpdateTOX( sal_False ); // wieder zurueck setzen
+ }*/
+
+ }
+ }
+ delete pMed;
+}
+
+/* -----------------14.07.04 ------------------------
+ *
+ * --------------------------------------------------*/
+
+// insert text and scan for CR characters in order to insert
+// paragraph breaks at those positions by calling SplitNode
+sal_Bool DocInsertStringSplitCR(
+ SwDoc &rDoc,
+ const SwPaM &rNewCursor, const String &rText,
+ const bool bForceExpandHints )
+{
+ sal_Bool bOK = sal_True;
+
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (bForceExpandHints)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
+ OUString aTxt;
+ xub_StrLen nStartIdx = 0;
+ SwTxtNode* const pTxtNd =
+ rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
+ const xub_StrLen nMaxLength = ( pTxtNd )
+ ? STRING_LEN - pTxtNd->GetTxt().Len()
+ : STRING_LEN;
+ xub_StrLen nIdx = rText.Search( '\r', nStartIdx );
+ if( ( nIdx == STRING_NOTFOUND && nMaxLength < rText.Len() ) ||
+ ( nIdx != STRING_NOTFOUND && nMaxLength < nIdx ) )
+ {
+ nIdx = nMaxLength;
+ }
+ while (nIdx != STRING_NOTFOUND )
+ {
+ DBG_ASSERT( nIdx - nStartIdx >= 0, "index negative!" );
+ aTxt = rText.Copy( nStartIdx, nIdx - nStartIdx );
+ if (aTxt.getLength() &&
+ !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
+ {
+ DBG_ERROR( "Doc->Insert(Str) failed." );
+ bOK = sal_False;
+ }
+ if (!rDoc.SplitNode( *rNewCursor.GetPoint(), false ) )
+ {
+ DBG_ERROR( "SplitNode failed" );
+ bOK = sal_False;
+ }
+ nStartIdx = nIdx + 1;
+ nIdx = rText.Search( '\r', nStartIdx );
+ }
+ aTxt = rText.Copy( nStartIdx );
+ if (aTxt.getLength() &&
+ !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
+ {
+ DBG_ERROR( "Doc->Insert(Str) failed." );
+ bOK = sal_False;
+ }
+
+ return bOK;
+}
+/*-- 10.03.2008 09:58:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void makeRedline( SwPaM& rPaM,
+ const ::rtl::OUString& rRedlineType,
+ const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ IDocumentRedlineAccess* pRedlineAccess = rPaM.GetDoc();
+
+ RedlineType_t eType = nsRedlineType_t::REDLINE_INSERT;
+ if( rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Delete" ) ))
+ eType = nsRedlineType_t::REDLINE_DELETE;
+ else if( rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Format" ) ))
+ eType = nsRedlineType_t::REDLINE_FORMAT;
+ else if( rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "TextTable" ) ))
+ eType = nsRedlineType_t::REDLINE_TABLE;
+ else if( !rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Insert" ) ))
+ throw lang::IllegalArgumentException();
+
+ //todo: what about REDLINE_FMTCOLL?
+ comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
+ uno::Any aAuthorValue;
+ aAuthorValue = aPropMap.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("RedlineAuthor"), aAuthorValue);
+ USHORT nAuthor = 0;
+ ::rtl::OUString sAuthor;
+ if( aAuthorValue >>= sAuthor )
+ nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
+
+ ::rtl::OUString sComment;
+ uno::Any aCommentValue;
+ aCommentValue = aPropMap.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("RedlineComment"), aCommentValue);
+
+ SwRedlineData aRedlineData( eType, nAuthor );
+ if( aCommentValue >>= sComment )
+ aRedlineData.SetComment( sComment );
+
+ ::util::DateTime aStamp;
+ uno::Any aDateTimeValue;
+ aDateTimeValue = aPropMap.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("RedlineDateTime"), aDateTimeValue);
+ if( aDateTimeValue >>= aStamp )
+ {
+ aRedlineData.SetTimeStamp(
+ DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
+ }
+
+ SwRedline* pRedline = new SwRedline( aRedlineData, rPaM );
+ RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
+
+ pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
+ bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
+ pRedlineAccess->SetRedlineMode_intern( nPrevMode );
+ if( !bRet )
+ throw lang::IllegalArgumentException();
+}
+
+/*-- 19.02.2009 09:27:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAnyMapHelper::~SwAnyMapHelper()
+{
+ AnyMapHelper_t::iterator aIt = begin();
+ while( aIt != end() )
+ {
+ delete ( aIt->second );
+ ++aIt;
+ }
+}
+/*-- 19.02.2009 09:27:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAnyMapHelper::SetValue( USHORT nWhichId, USHORT nMemberId, const uno::Any& rAny )
+{
+ sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
+ AnyMapHelper_t::iterator aIt = find( nKey );
+ if( aIt != end() )
+ {
+ *(aIt->second) = rAny;
+ }
+ else
+ insert( value_type(nKey, new uno::Any( rAny )) );
+}
+/*-- 19.02.2009 09:27:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwAnyMapHelper::FillValue( USHORT nWhichId, USHORT nMemberId, const uno::Any*& pAny )
+{
+ bool bRet = false;
+ sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
+ AnyMapHelper_t::iterator aIt = find( nKey );
+ if( aIt != end() )
+ {
+ pAny = aIt->second;
+ bRet = true;
+ }
+ return bRet;
+}
+
+}//namespace SwUnoCursorHelper
+
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
new file mode 100644
index 000000000000..ab5d68910769
--- /dev/null
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -0,0 +1,3105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+
+#include <unomid.h>
+#include <unodraw.hxx>
+#include <unocoll.hxx>
+#include <unoframe.hxx>
+#include <unoparagraph.hxx>
+#include <unotextrange.hxx>
+#include <unoprnms.hxx>
+#include <editeng/unoprnms.hxx>
+#include <svx/svditer.hxx>
+#include <swunohelper.hxx>
+#include <doc.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtflcnt.hxx>
+#include <txtatr.hxx>
+#include <docsh.hxx>
+#include <unomap.hxx>
+#include <unoport.hxx>
+#include <unocrsr.hxx>
+#include <TextCursorHelper.hxx>
+#include <swundo.hxx>
+#include <dflyobj.hxx>
+#include <ndtxt.hxx>
+#include <svx/svdview.hxx>
+#include <svx/unoshape.hxx>
+#include <dcontact.hxx>
+#include <svx/fmglob.hxx>
+#include <fmtornt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtsrnd.hxx>
+// OD 2004-04-21 #i26791#
+#include <fmtfollowtextflow.hxx>
+#include <rootfrm.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <svx/shapepropertynotifier.hxx>
+#include <crstate.hxx>
+#include <vos/mutex.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/makesequence.hxx>
+#include <svx/scene3d.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <basegfx/numeric/ftools.hxx>
+#include <algorithm>
+#include <fmtwrapinfluenceonobjpos.hxx>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <vcl/svapp.hxx>
+#include <slist>
+#include <iterator>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+DECLARE_STL_USTRINGACCESS_MAP( uno::Sequence< sal_Int8 > *, SwShapeImplementationIdMap );
+
+static SwShapeImplementationIdMap aImplementationIdMap;
+
+/* -----------------22.01.99 13:19-------------------
+ *
+ * --------------------------------------------------*/
+class SwShapeDescriptor_Impl
+{
+ SwFmtHoriOrient* pHOrient;
+ SwFmtVertOrient* pVOrient;
+ SwFmtAnchor* pAnchor;
+ SwFmtSurround* pSurround;
+ SvxULSpaceItem* pULSpace;
+ SvxLRSpaceItem* pLRSpace;
+ sal_Bool bOpaque;
+ uno::Reference< text::XTextRange > xTextRange;
+ // OD 2004-04-21 #i26791#
+ SwFmtFollowTextFlow* mpFollowTextFlow;
+ // OD 2004-05-05 #i28701# - add property 'WrapInfluenceOnObjPos'
+ SwFmtWrapInfluenceOnObjPos* pWrapInfluenceOnObjPos;
+ // --> OD 2004-08-06 #i28749#
+ sal_Int16 mnPositionLayoutDir;
+ // <--
+
+public:
+ bool bInitializedPropertyNotifier;
+
+public:
+ SwShapeDescriptor_Impl() :
+ // --> OD 2004-08-18 #i32349# - no defaults, in order to determine on
+ // adding a shape, if positioning attributes are set or not.
+ pHOrient( 0L ),
+ pVOrient( 0L ),
+ // <--
+ pAnchor(0),
+ pSurround(0),
+ pULSpace(0),
+ pLRSpace(0),
+ bOpaque(sal_False),
+ // OD 2004-04-21 #i26791#
+ mpFollowTextFlow( new SwFmtFollowTextFlow( FALSE ) ),
+ // OD 2004-05-05 #i28701#
+ // --> OD 2004-10-18 #i35017# - constant name has changed
+ pWrapInfluenceOnObjPos( new SwFmtWrapInfluenceOnObjPos(
+ text::WrapInfluenceOnPosition::ONCE_CONCURRENT ) ),
+ // <--
+ // --> OD 2004-08-06 #i28749#
+ mnPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
+ bInitializedPropertyNotifier(false)
+ {}
+
+ ~SwShapeDescriptor_Impl()
+ {
+ delete pHOrient;
+ delete pVOrient;
+ delete pAnchor;
+ delete pSurround;
+ delete pULSpace;
+ delete pLRSpace;
+ // OD 2004-04-22 #i26791#
+ delete mpFollowTextFlow;
+ // OD 2004-05-05 #i28701#
+ delete pWrapInfluenceOnObjPos;
+ }
+ SwFmtAnchor* GetAnchor(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pAnchor)
+ {
+ pAnchor = new SwFmtAnchor(FLY_AS_CHAR);
+ }
+ return pAnchor;
+ }
+ SwFmtHoriOrient* GetHOrient(sal_Bool bCreate = sal_False)
+ {
+ if (bCreate && !pHOrient)
+ {
+ // OD 2004-06-03 #i26791# - change default
+ pHOrient = new SwFmtHoriOrient( 0, text::HoriOrientation::NONE, text::RelOrientation::FRAME );
+ }
+ return pHOrient;
+ }
+ SwFmtVertOrient* GetVOrient(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pVOrient)
+ {
+ // OD 2004-04-21 #i26791# - change default
+ pVOrient = new SwFmtVertOrient( 0, text::VertOrientation::NONE, text::RelOrientation::FRAME );
+ }
+ return pVOrient;
+ }
+
+ SwFmtSurround* GetSurround(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pSurround)
+ pSurround = new SwFmtSurround();
+ return pSurround;
+ }
+ SvxLRSpaceItem* GetLRSpace(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pLRSpace)
+ pLRSpace = new SvxLRSpaceItem(RES_LR_SPACE);
+ return pLRSpace;
+ }
+ SvxULSpaceItem* GetULSpace(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pULSpace)
+ pULSpace = new SvxULSpaceItem(RES_UL_SPACE);
+ return pULSpace;
+ }
+ uno::Reference< text::XTextRange > & GetTextRange()
+ {
+ return xTextRange;
+ }
+ sal_Bool IsOpaque()
+ {
+ return bOpaque;
+ }
+ const sal_Bool& GetOpaque()
+ {
+ return bOpaque;
+ }
+ void RemoveHOrient(){DELETEZ(pHOrient);}
+ void RemoveVOrient(){DELETEZ(pVOrient);}
+ void RemoveAnchor(){DELETEZ(pAnchor);}
+ void RemoveSurround(){DELETEZ(pSurround);}
+ void RemoveULSpace(){DELETEZ(pULSpace);}
+ void RemoveLRSpace(){DELETEZ(pLRSpace);}
+ void SetOpaque(sal_Bool bSet){bOpaque = bSet;}
+
+ // OD 2004-04-21 #i26791#
+ SwFmtFollowTextFlow* GetFollowTextFlow( sal_Bool _bCreate = sal_False )
+ {
+ if ( _bCreate && !mpFollowTextFlow )
+ mpFollowTextFlow = new SwFmtFollowTextFlow( FALSE );
+ return mpFollowTextFlow;
+ }
+ void RemoveFollowTextFlow()
+ {
+ DELETEZ(mpFollowTextFlow);
+ }
+
+ // --> OD 2004-08-06 #i28749#
+ sal_Int16 GetPositionLayoutDir() const
+ {
+ return mnPositionLayoutDir;
+ }
+ void SetPositionLayoutDir( sal_Int16 _nPositionLayoutDir )
+ {
+ switch ( _nPositionLayoutDir )
+ {
+ case text::PositionLayoutDir::PositionInHoriL2R:
+ case text::PositionLayoutDir::PositionInLayoutDirOfAnchor:
+ {
+ mnPositionLayoutDir = _nPositionLayoutDir;
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwShapeDescriptor_Impl::SetPositionLayoutDir(..)> - invalid attribute value." );
+ }
+ }
+ }
+ void RemovePositionLayoutDir()
+ {
+ mnPositionLayoutDir = text::PositionLayoutDir::PositionInLayoutDirOfAnchor;
+ }
+ // <--
+
+ // OD 2004-05-05 #i28701#
+ inline SwFmtWrapInfluenceOnObjPos* GetWrapInfluenceOnObjPos(
+ const sal_Bool _bCreate = sal_False )
+ {
+ if ( _bCreate && !pWrapInfluenceOnObjPos )
+ {
+ pWrapInfluenceOnObjPos = new SwFmtWrapInfluenceOnObjPos(
+ // --> OD 2004-10-18 #i35017# - constant name has changed
+ text::WrapInfluenceOnPosition::ONCE_CONCURRENT );
+ // <--
+ }
+ return pWrapInfluenceOnObjPos;
+ }
+ inline void RemoveWrapInfluenceOnObjPos()
+ {
+ DELETEZ(pWrapInfluenceOnObjPos);
+ }
+};
+/****************************************************************************
+ class SwFmDrawPage
+****************************************************************************/
+
+/* -----------------28.01.99 12:03-------------------
+ *
+ * --------------------------------------------------*/
+SwFmDrawPage::SwFmDrawPage( SdrPage* pPage ) :
+ SvxFmDrawPage( pPage ), pPageView(0)
+{
+}
+
+/*-- 22.01.99 11:13:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFmDrawPage::~SwFmDrawPage() throw ()
+{
+ RemovePageView();
+}
+/*-- 22.01.99 11:13:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SdrMarkList& SwFmDrawPage::PreGroup(const uno::Reference< drawing::XShapes > & xShapes)
+{
+ _SelectObjectsInView( xShapes, GetPageView() );
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ return rMarkList;
+}
+/*-- 22.01.99 11:13:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFmDrawPage::PreUnGroup(const uno::Reference< drawing::XShapeGroup > xShapeGroup)
+{
+ uno::Reference< drawing::XShape > xShape( xShapeGroup, uno::UNO_QUERY);
+ _SelectObjectInView( xShape, GetPageView() );
+}
+/*-- 22.01.99 11:13:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SdrPageView* SwFmDrawPage::GetPageView()
+{
+ if(!pPageView)
+ pPageView = mpView->ShowSdrPage( mpPage );
+ return pPageView;
+}
+/*-- 22.01.99 11:13:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFmDrawPage::RemovePageView()
+{
+ if(pPageView && mpView)
+ mpView->HideSdrPage();
+ pPageView = 0;
+}
+/*-- 22.01.99 11:13:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< uno::XInterface > SwFmDrawPage::GetInterface( SdrObject* pObj )
+{
+ uno::Reference< XInterface > xShape;
+ if( pObj )
+ {
+ SwFrmFmt* pFmt = ::FindFrmFmt( pObj );
+ SwXShape* pxShape = (SwXShape*)SwClientIter( *pFmt ).
+ First( TYPE( SwXShape ));
+ if(pxShape)
+ {
+ xShape = *(cppu::OWeakObject*)pxShape;
+ }
+ else
+ xShape = pObj->getUnoShape();
+ }
+ return xShape;
+}
+/*-- 22.01.99 11:13:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SdrObject* SwFmDrawPage::_CreateSdrObject( const uno::Reference< drawing::XShape > & xShape ) throw ()
+{
+ //TODO: stimmt das so - kann die Methode weg?
+ return SvxFmDrawPage::_CreateSdrObject( xShape );
+}
+/*-- 22.01.99 11:13:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
+{
+ uno::Reference< drawing::XShape > xRet;
+ if(pObj->ISA(SwVirtFlyDrawObj) || pObj->GetObjInventor() == SWGInventor)
+ {
+ SwFlyDrawContact* pFlyContact = (SwFlyDrawContact*)pObj->GetUserCall();
+ if(pFlyContact)
+ {
+ FlyCntType eType = FLYCNTTYPE_ALL;
+ SwFrmFmt* pFlyFmt = pFlyContact->GetFmt();
+ SwDoc* pDoc = pFlyFmt->GetDoc();
+ const SwNodeIndex* pIdx;
+ if( RES_FLYFRMFMT == pFlyFmt->Which()
+ && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
+ && pIdx->GetNodes().IsDocNodes()
+ )
+ {
+ const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
+ if(!pNd->IsNoTxtNode())
+ eType = FLYCNTTYPE_FRM;
+ else if( pNd->IsGrfNode() )
+ eType = FLYCNTTYPE_GRF;
+ else if( pNd->IsOLENode() )
+ eType = FLYCNTTYPE_OLE;
+ }
+ else
+ {
+ ASSERT( false,
+ "<SwFmDrawPage::_CreateShape(..)> - could not retrieve type. Thus, no shape created." );
+ return xRet;
+ }
+ DBG_ASSERT( eType != FLYCNTTYPE_ALL, "unexpected FlyCntType value for eType" );
+ xRet = SwXFrames::GetObject( *pFlyFmt, eType );
+ }
+ }
+ else
+ {
+ // own block - temporary object has to be destroyed before
+ // the delegator is set #81670#
+ {
+ xRet = SvxFmDrawPage::_CreateShape( pObj );
+ }
+ uno::Reference< XUnoTunnel > xShapeTunnel(xRet, uno::UNO_QUERY);
+ //don't create an SwXShape if it already exists
+ SwXShape* pShape = 0;
+ if(xShapeTunnel.is())
+ pShape = reinterpret_cast< SwXShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
+ if(!pShape)
+ {
+ xShapeTunnel = 0;
+ uno::Reference< uno::XInterface > xCreate(xRet, uno::UNO_QUERY);
+ xRet = 0;
+ uno::Reference< beans::XPropertySet > xPrSet;
+ if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || ( PTR_CAST(E3dScene,pObj ) != NULL ) ) )
+ xPrSet = new SwXGroupShape( xCreate );
+ else
+ xPrSet = new SwXShape( xCreate );
+ xRet = uno::Reference< drawing::XShape >(xPrSet, uno::UNO_QUERY);
+ }
+ }
+ return xRet;
+}
+
+/****************************************************************************
+ class SwXShapesEnumeration
+****************************************************************************/
+namespace
+{
+ class SwXShapesEnumeration
+ : public SwSimpleEnumeration_Base
+ {
+ private:
+ typedef ::std::slist< ::com::sun::star::uno::Any > shapescontainer_t;
+ shapescontainer_t m_aShapes;
+ protected:
+ virtual ~SwXShapesEnumeration() {};
+ public:
+ SwXShapesEnumeration(SwXDrawPage* const pDrawPage);
+
+ //XEnumeration
+ virtual BOOL SAL_CALL hasMoreElements(void) throw(uno::RuntimeException);
+ virtual uno::Any SAL_CALL nextElement(void) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ //XServiceInfo
+ virtual OUString SAL_CALL getImplementationName(void) throw(uno::RuntimeException);
+ virtual BOOL SAL_CALL supportsService(const OUString& ServiceName) throw(uno::RuntimeException);
+ virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames(void) throw(uno::RuntimeException);
+ };
+}
+
+SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage* const pDrawPage)
+ : m_aShapes()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ ::std::insert_iterator<shapescontainer_t> pInserter = ::std::insert_iterator<shapescontainer_t>(m_aShapes, m_aShapes.begin());
+ sal_Int32 nCount = pDrawPage->getCount();
+ for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++)
+ {
+ uno::Reference<drawing::XShape> xShape = uno::Reference<drawing::XShape>(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY);
+ *pInserter++ = uno::makeAny(xShape);
+ }
+}
+
+BOOL SwXShapesEnumeration::hasMoreElements(void) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return !m_aShapes.empty();
+}
+
+uno::Any SwXShapesEnumeration::nextElement(void) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_aShapes.empty())
+ throw container::NoSuchElementException();
+ uno::Any aResult = *m_aShapes.begin();
+ m_aShapes.pop_front();
+ return aResult;
+}
+
+OUString SwXShapesEnumeration::getImplementationName(void) throw(uno::RuntimeException)
+{
+ return C2U("SwXShapeEnumeration");
+}
+
+BOOL SwXShapesEnumeration::supportsService(const OUString& ServiceName) throw(uno::RuntimeException)
+{
+ return C2U("com.sun.star.container.XEnumeration") == ServiceName;
+}
+
+uno::Sequence< OUString > SwXShapesEnumeration::getSupportedServiceNames(void) throw(uno::RuntimeException)
+{
+ return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration"));
+}
+/****************************************************************************
+ class SwXDrawPage
+****************************************************************************/
+uno::Reference< container::XEnumeration > SwXDrawPage::createEnumeration(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return uno::Reference< container::XEnumeration >(
+ new SwXShapesEnumeration(this));
+}
+/* -----------------------------06.04.00 13:14--------------------------------
+
+ ---------------------------------------------------------------------------*/
+rtl::OUString SwXDrawPage::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXDrawPage");
+}
+/* -----------------------------06.04.00 13:14--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXDrawPage::supportsService(const rtl::OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.drawing.GenericDrawPage") == rServiceName;
+}
+/* -----------------------------06.04.00 13:14--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< rtl::OUString > SwXDrawPage::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aRet(1);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.drawing.GenericDrawPage");
+ return aRet;
+}
+/*-- 22.01.99 11:22:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDrawPage::SwXDrawPage(SwDoc* pDc) :
+ pDoc(pDc),
+ pDrawPage(0)
+{
+}
+/*-- 22.01.99 11:22:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDrawPage::~SwXDrawPage()
+{
+ if(xPageAgg.is())
+ {
+ uno::Reference< uno::XInterface > xInt;
+ xPageAgg->setDelegator(xInt);
+ }
+}
+/* -----------------------------15.06.00 15:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXDrawPage::queryInterface( const uno::Type& aType )
+ throw( uno::RuntimeException )
+{
+ uno::Any aRet = SwXDrawPageBaseClass::queryInterface(aType);
+ if(!aRet.hasValue())
+ {
+ // secure with checking if page exists. This may not be the case
+ // either for new SW docs with no yet graphics usage or when
+ // the doc is closed and someone else still holds a UNO reference
+ // to the XDrawPage (in that case, pDoc is set to 0)
+ SwFmDrawPage* pPage = GetSvxPage();
+
+ if(pPage)
+ {
+ aRet = pPage->queryAggregation(aType);
+ }
+ }
+ return aRet;
+}
+/* -----------------------------15.06.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SwXDrawPage::getTypes() throw( uno::RuntimeException )
+{
+ uno::Sequence< uno::Type > aPageTypes = SwXDrawPageBaseClass::getTypes();
+ uno::Sequence< uno::Type > aSvxTypes = GetSvxPage()->getTypes();
+
+ long nIndex = aPageTypes.getLength();
+ aPageTypes.realloc(aPageTypes.getLength() + aSvxTypes.getLength() + 1);
+
+ uno::Type* pPageTypes = aPageTypes.getArray();
+ const uno::Type* pSvxTypes = aSvxTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos < aSvxTypes.getLength(); nPos++)
+ {
+ pPageTypes[nIndex++] = pSvxTypes[nPos];
+ }
+ pPageTypes[nIndex] = ::getCppuType((uno::Reference<form::XFormsSupplier2>*)0);
+ return aPageTypes;
+}
+/*-- 22.01.99 11:33:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXDrawPage::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(!pDoc->GetDrawModel())
+ return 0;
+ else
+ {
+ ((SwXDrawPage*)this)->GetSvxPage();
+ return pDrawPage->getCount();
+ }
+}
+/*-- 22.01.99 11:33:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(!pDoc->GetDrawModel())
+ throw lang::IndexOutOfBoundsException();
+
+ ((SwXDrawPage*)this)->GetSvxPage();
+ return pDrawPage->getByIndex( nIndex );
+}
+/* -----------------22.01.99 13:13-------------------
+ *
+ * --------------------------------------------------*/
+uno::Type SwXDrawPage::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<drawing::XShape>*)0);
+}
+/* -----------------22.01.99 13:13-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXDrawPage::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(!pDoc->GetDrawModel())
+ return sal_False;
+ else
+ return ((SwXDrawPage*)this)->GetSvxPage()->hasElements();
+}
+
+/* -----------------22.01.99 12:42-------------------
+ *
+ * --------------------------------------------------*/
+void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShape, uno::UNO_QUERY);
+ SwXShape* pShape = 0;
+ SvxShape* pSvxShape = 0;
+ if(xShapeTunnel.is())
+ {
+ pShape = reinterpret_cast< SwXShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
+ pSvxShape = reinterpret_cast< SvxShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ }
+
+ if(!pShape || pShape->GetRegisteredIn() || !pShape->m_bDescriptor )
+ {
+ uno::RuntimeException aExcept;
+ if(pShape)
+ aExcept.Message = C2U("object already inserted");
+ else
+ aExcept.Message = C2U("illegal object");
+ throw aExcept;
+ }
+
+ // --> OD, HB
+ if ( pSvxShape->GetSdrObject() )
+ {
+ if ( pSvxShape->GetSdrObject()->IsInserted() )
+ {
+ return;
+ }
+ }
+ // <--
+ GetSvxPage()->add(xShape);
+
+ uno::Reference< uno::XAggregation > xAgg = pShape->GetAggregationInterface();
+
+ DBG_ASSERT(pSvxShape, "warum gibt es hier kein SvxShape?");
+ //diese Position ist auf jeden Fall in 1/100 mm
+ awt::Point aMM100Pos(pSvxShape->getPosition());
+
+ //jetzt noch die Properties aus dem SwShapeDescriptor_Impl auswerten
+ SwShapeDescriptor_Impl* pDesc = pShape->GetDescImpl();
+
+ SfxItemSet aSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN,
+ RES_FRMATR_END-1 );
+ SwFmtAnchor aAnchor( FLY_AS_CHAR );
+ sal_Bool bOpaque = sal_False;
+ if( pDesc )
+ {
+ if(pDesc->GetSurround())
+ aSet.Put( *pDesc->GetSurround());
+ //die Items sind schon in Twip gesetzt
+ if(pDesc->GetLRSpace())
+ {
+ aSet.Put(*pDesc->GetLRSpace());
+ }
+ if(pDesc->GetULSpace())
+ {
+ aSet.Put(*pDesc->GetULSpace());
+ }
+ if(pDesc->GetAnchor())
+ aAnchor = *pDesc->GetAnchor();
+
+ // --> OD 2004-08-18 #i32349# - if no horizontal position exists, create one
+ if ( !pDesc->GetHOrient() )
+ {
+ SwFmtHoriOrient* pHori = pDesc->GetHOrient( sal_True );
+ SwTwips nHoriPos = MM100_TO_TWIP(aMM100Pos.X);
+ pHori->SetPos( nHoriPos );
+ }
+ // <--
+ {
+ if(pDesc->GetHOrient()->GetHoriOrient() == text::HoriOrientation::NONE)
+ aMM100Pos.X = TWIP_TO_MM100(pDesc->GetHOrient()->GetPos());
+ aSet.Put( *pDesc->GetHOrient() );
+ }
+ // --> OD 2004-08-18 #i32349# - if no vertical position exists, create one
+ if ( !pDesc->GetVOrient() )
+ {
+ SwFmtVertOrient* pVert = pDesc->GetVOrient( sal_True );
+ SwTwips nVertPos = MM100_TO_TWIP(aMM100Pos.Y);
+ pVert->SetPos( nVertPos );
+ }
+ // <--
+ {
+ if(pDesc->GetVOrient()->GetVertOrient() == text::VertOrientation::NONE)
+ aMM100Pos.Y = TWIP_TO_MM100(pDesc->GetVOrient()->GetPos());
+ aSet.Put( *pDesc->GetVOrient() );
+ }
+
+ if(pDesc->GetSurround())
+ aSet.Put( *pDesc->GetSurround());
+ bOpaque = pDesc->IsOpaque();
+
+ // OD 2004-04-22 #i26791#
+ if ( pDesc->GetFollowTextFlow() )
+ {
+ aSet.Put( *pDesc->GetFollowTextFlow() );
+ }
+
+ // OD 2004-05-05 #i28701#
+ if ( pDesc->GetWrapInfluenceOnObjPos() )
+ {
+ aSet.Put( *pDesc->GetWrapInfluenceOnObjPos() );
+ }
+ }
+
+ pSvxShape->setPosition(aMM100Pos);
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ // OD 25.06.2003 #108784# - set layer of new drawing object to corresponding
+ // invisible layer.
+ if(FmFormInventor != pObj->GetObjInventor())
+ pObj->SetLayer( bOpaque ? pDoc->GetInvisibleHeavenId() : pDoc->GetInvisibleHellId() );
+ else
+ pObj->SetLayer(pDoc->GetInvisibleControlsId());
+
+ SwPaM* pPam = new SwPaM(pDoc->GetNodes().GetEndOfContent());
+ SwUnoInternalPaM* pInternalPam = 0;
+ uno::Reference< text::XTextRange > xRg;
+ if( pDesc && (xRg = pDesc->GetTextRange()).is() )
+ {
+ pInternalPam = new SwUnoInternalPaM(*pDoc);
+ if (::sw::XTextRangeToSwPaM(*pInternalPam, xRg))
+ {
+ if(FLY_AT_FLY == aAnchor.GetAnchorId() &&
+ !pInternalPam->GetNode()->FindFlyStartNode())
+ {
+ aAnchor.SetType(FLY_AS_CHAR);
+ }
+ else if (FLY_AT_PAGE == aAnchor.GetAnchorId())
+ {
+ aAnchor.SetAnchor(pInternalPam->Start());
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) && pDoc->GetRootFrm())
+ {
+ SwCrsrMoveState aState( MV_SETONLYTEXT );
+ Point aTmp(MM100_TO_TWIP(aMM100Pos.X), MM100_TO_TWIP(aMM100Pos.Y));
+ pDoc->GetRootFrm()->GetCrsrOfst( pPam->GetPoint(), aTmp, &aState );
+ aAnchor.SetAnchor( pPam->GetPoint() );
+
+ // --> OD 2004-08-18 #i32349# - adjustment of vertical positioning
+ // attributes no longer needed, because its already got a default.
+ }
+ else
+ {
+ aAnchor.SetType(FLY_AT_PAGE);
+
+ // --> OD 2004-08-18 #i32349# - adjustment of vertical positioning
+ // attributes no longer needed, because its already got a default.
+ }
+ aSet.Put(aAnchor);
+ SwPaM* pTemp = pInternalPam;
+ if ( !pTemp )
+ pTemp = pPam;
+ UnoActionContext aAction(pDoc);
+ pDoc->Insert( *pTemp, *pObj, &aSet, NULL );
+ SwFrmFmt* pFmt = ::FindFrmFmt( pObj );
+ if(pFmt)
+ pFmt->Add(pShape);
+ pShape->m_bDescriptor = sal_False;
+
+ delete pPam;
+ delete pInternalPam;
+}
+/* -----------------22.01.99 12:42-------------------
+ *
+ * --------------------------------------------------*/
+void SwXDrawPage::remove(const uno::Reference< drawing::XShape > & xShape) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ uno::Reference<lang::XComponent> xComp(xShape, uno::UNO_QUERY);
+ xComp->dispose();
+}
+/* -----------------17.02.99 10:38-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference< drawing::XShapes > & xShapes) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc || !xShapes.is())
+ throw uno::RuntimeException();
+ uno::Reference< drawing::XShapeGroup > xRet;
+ if(xPageAgg.is())
+ {
+
+ SwFmDrawPage* pPage = GetSvxPage();
+ if(pPage)//kann das auch Null sein?
+ {
+ //markieren und MarkList zurueckgeben
+ const SdrMarkList& rMarkList = pPage->PreGroup(xShapes);
+ if ( rMarkList.GetMarkCount() > 1 )
+ {
+ sal_Bool bFlyInCnt = sal_False;
+ for ( sal_uInt16 i = 0; !bFlyInCnt && i < rMarkList.GetMarkCount(); ++i )
+ {
+ const SdrObject *pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if (FLY_AS_CHAR == ::FindFrmFmt(const_cast<SdrObject*>(
+ pObj))->GetAnchor().GetAnchorId())
+ {
+ bFlyInCnt = sal_True;
+ }
+ }
+ if( bFlyInCnt )
+ throw uno::RuntimeException();
+ if( !bFlyInCnt )
+ {
+ UnoActionContext aContext(pDoc);
+ pDoc->StartUndo( UNDO_START, NULL );
+
+ SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() );
+ pDoc->ChgAnchor(
+ pPage->GetDrawView()->GetMarkedObjectList(),
+ FLY_AT_PARA/*int eAnchorId*/,
+ sal_True, sal_False );
+
+ pPage->GetDrawView()->UnmarkAll();
+ if(pContact)
+ {
+ uno::Reference< uno::XInterface > xInt = pPage->GetInterface( pContact->GetMaster() );
+ xRet = uno::Reference< drawing::XShapeGroup >(xInt, uno::UNO_QUERY);
+ }
+ pDoc->EndUndo( UNDO_END, NULL );
+ }
+ }
+ pPage->RemovePageView();
+ }
+ }
+ return xRet;
+}
+/* -----------------17.02.99 10:38-------------------
+ *
+ * --------------------------------------------------*/
+void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & xShapeGroup) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(xPageAgg.is())
+ {
+ SwFmDrawPage* pPage = GetSvxPage();
+ if(pPage)//kann das auch Null sein?
+ {
+ pPage->PreUnGroup(xShapeGroup);
+ UnoActionContext aContext(pDoc);
+ pDoc->StartUndo( UNDO_START, NULL );
+
+ pDoc->UnGroupSelection( *pPage->GetDrawView() );
+ pDoc->ChgAnchor( pPage->GetDrawView()->GetMarkedObjectList(),
+ FLY_AT_PARA/*int eAnchorId*/,
+ sal_True, sal_False );
+ pDoc->EndUndo( UNDO_END, NULL );
+ }
+ pPage->RemovePageView();
+ }
+}
+/* -----------------05.05.98 17:05-------------------
+ *
+ * --------------------------------------------------*/
+SwFmDrawPage* SwXDrawPage::GetSvxPage()
+{
+ if(!xPageAgg.is() && pDoc)
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ // --> OD 2005-08-08 #i52858# - method name changed
+ SdrModel* pModel = pDoc->GetOrCreateDrawModel();
+ // <--
+ SdrPage* pPage = pModel->GetPage( 0 );
+
+ {
+ // waehrend des queryInterface braucht man ein Ref auf das
+ // Objekt, sonst wird es geloescht.
+ pDrawPage = new SwFmDrawPage(pPage);
+ uno::Reference< drawing::XDrawPage > xPage = pDrawPage;
+ uno::Any aAgg = xPage->queryInterface(::getCppuType((uno::Reference< uno::XAggregation >*)0));
+ if(aAgg.getValueType() == ::getCppuType((uno::Reference< uno::XAggregation >*)0))
+ xPageAgg = *(uno::Reference< uno::XAggregation >*)aAgg.getValue();
+ }
+ if( xPageAgg.is() )
+ xPageAgg->setDelegator( (cppu::OWeakObject*)this );
+ }
+ return pDrawPage;
+}
+
+// renamed and outlined to detect where it's called
+void SwXDrawPage::InvalidateSwDoc()
+{
+ pDoc = 0;
+}
+
+/****************************************************************************
+
+****************************************************************************/
+TYPEINIT1(SwXShape, SwClient);
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXShape::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rTunnelType = ::getCppuType((uno::Reference<lang::XUnoTunnel>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rTunnelType );
+ if(aAgg.getValueType() == rTunnelType)
+ {
+ uno::Reference<lang::XUnoTunnel> xAggTunnel =
+ *(uno::Reference<lang::XUnoTunnel>*)aAgg.getValue();
+ if(xAggTunnel.is())
+ return xAggTunnel->getSomething(rId);
+ }
+ }
+ return 0;
+}
+namespace
+{
+ static void lcl_addShapePropertyEventFactories( SdrObject& _rObj, SwXShape& _rShape )
+ {
+ ::svx::PPropertyValueProvider pProvider( new ::svx::PropertyValueProvider( _rShape, "AnchorType" ) );
+ _rObj.getShapePropertyChangeNotifier().registerProvider( ::svx::eTextShapeAnchorType, pProvider );
+ }
+}
+
+/* -----------------01.02.99 11:38-------------------
+ *
+ * --------------------------------------------------*/
+SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) :
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE)),
+ m_pPropertyMapEntries(aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE)),
+ pImplementationId(0),
+ pImpl(new SwShapeDescriptor_Impl()),
+ m_bDescriptor(sal_True)
+{
+ if(xShape.is()) // default Ctor
+ {
+ const uno::Type& rAggType = ::getCppuType((const uno::Reference< uno::XAggregation >*)0);
+ //aAgg contains a reference of the SvxShape!
+ {
+ uno::Any aAgg = xShape->queryInterface(rAggType);
+ if(aAgg.getValueType() == rAggType)
+ xShapeAgg = *(uno::Reference< uno::XAggregation >*)aAgg.getValue();
+ // --> OD 2004-07-23 #i31698#
+ if ( xShapeAgg.is() )
+ {
+ xShapeAgg->queryAggregation( ::getCppuType((uno::Reference< drawing::XShape >*)0) ) >>= mxShape;
+ ASSERT( mxShape.is(),
+ "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" );
+ }
+ // <--
+ }
+ xShape = 0;
+ m_refCount++;
+ if( xShapeAgg.is() )
+ xShapeAgg->setDelegator( (cppu::OWeakObject*)this );
+ m_refCount--;
+
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ SvxShape* pShape = 0;
+ if(xShapeTunnel.is())
+ pShape = reinterpret_cast< SvxShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+
+ SdrObject* pObj = pShape ? pShape->GetSdrObject() : 0;
+ if(pObj)
+ {
+ SwFrmFmt* pFmt = ::FindFrmFmt( pObj );
+ if(pFmt)
+ pFmt->Add(this);
+
+ lcl_addShapePropertyEventFactories( *pObj, *this );
+ pImpl->bInitializedPropertyNotifier = true;
+ }
+ }
+}
+
+/*-- 09.04.09 15:06:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::AddExistingShapeToFmt( SdrObject& _rObj )
+{
+ SdrObjListIter aIter( _rObj, IM_DEEPNOGROUPS );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pCurrent = aIter.Next();
+ OSL_ENSURE( pCurrent, "SwXShape::AddExistingShapeToFmt: invalid object list element!" );
+ if ( !pCurrent )
+ continue;
+
+ SwXShape* pSwShape = NULL;
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel( pCurrent->getWeakUnoShape(), uno::UNO_QUERY );
+ if ( xShapeTunnel.is() )
+ pSwShape = reinterpret_cast< SwXShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
+ if ( pSwShape )
+ {
+ if ( pSwShape->m_bDescriptor )
+ {
+ SwFrmFmt* pFmt = ::FindFrmFmt( const_cast< SdrObject* >( pCurrent ) );
+ if ( pFmt )
+ pFmt->Add( pSwShape );
+ pSwShape->m_bDescriptor = sal_False;
+ }
+
+ if ( !pSwShape->pImpl->bInitializedPropertyNotifier )
+ {
+ lcl_addShapePropertyEventFactories( *pCurrent, *pSwShape );
+ pSwShape->pImpl->bInitializedPropertyNotifier = true;
+ }
+ }
+ }
+}
+
+/*-- 22.01.99 11:42:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXShape::~SwXShape()
+{
+ if (xShapeAgg.is())
+ {
+ uno::Reference< uno::XInterface > xRef;
+ xShapeAgg->setDelegator(xRef);
+ }
+ delete pImpl;
+}
+/* -----------------------------16.06.00 12:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXShape::queryInterface( const uno::Type& aType ) throw( uno::RuntimeException )
+{
+ uno::Any aRet = SwXShapeBaseClass::queryInterface(aType);
+ // --> OD 2005-08-15 #i53320# - follow-up of #i31698#
+ // interface drawing::XShape is overloaded. Thus, provide
+ // correct object instance.
+ if(!aRet.hasValue() && xShapeAgg.is())
+ {
+ if(aType == ::getCppuType((uno::Reference<XShape>*)0))
+ aRet <<= uno::Reference<XShape>(this);
+ else
+ aRet = xShapeAgg->queryAggregation(aType);
+ }
+ // <--
+ return aRet;
+}
+/* -----------------------------16.06.00 12:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SwXShape::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aRet = SwXShapeBaseClass::getTypes();
+ if(xShapeAgg.is())
+ {
+ uno::Any aProv = xShapeAgg->queryAggregation(::getCppuType((uno::Reference< XTypeProvider >*)0));
+ if(aProv.hasValue())
+ {
+ uno::Reference< XTypeProvider > xAggProv;
+ aProv >>= xAggProv;
+ uno::Sequence< uno::Type > aAggTypes = xAggProv->getTypes();
+ const uno::Type* pAggTypes = aAggTypes.getConstArray();
+ long nIndex = aRet.getLength();
+
+ aRet.realloc(nIndex + aAggTypes.getLength());
+ uno::Type* pBaseTypes = aRet.getArray();
+
+ for(long i = 0; i < aAggTypes.getLength(); i++)
+ pBaseTypes[nIndex++] = pAggTypes[i];
+ }
+ }
+ return aRet;
+}
+/* -----------------------------04.04.01 07:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SwXShape::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ // do we need to compute the implementation id for this instance?
+ if( !pImplementationId && xShapeAgg.is())
+ {
+ uno::Reference< XShape > xAggShape;
+ xShapeAgg->queryAggregation( ::getCppuType((uno::Reference< XShape >*)0) ) >>= xAggShape;
+
+ if( xAggShape.is() )
+ {
+ const rtl::OUString aShapeType( xAggShape->getShapeType() );
+ // did we already compute an implementation id for the agregated shape type?
+ SwShapeImplementationIdMap::iterator aIter( aImplementationIdMap.find(aShapeType ) );
+ if( aIter == aImplementationIdMap.end() )
+ {
+ // we need to create a new implementation id for this
+ // note: this memory is not free'd until application exists
+ // but since we have a fixed set of shapetypes and the
+ // memory will be reused this is ok.
+ pImplementationId = new uno::Sequence< sal_Int8 >( 16 );
+ rtl_createUuid( (sal_uInt8 *) pImplementationId->getArray(), 0, sal_True );
+ aImplementationIdMap[ aShapeType ] = pImplementationId;
+ }
+ else
+ {
+ // use the already computed implementation id
+ pImplementationId = (*aIter).second;
+ }
+ }
+ }
+ if( NULL == pImplementationId )
+ {
+ DBG_ERROR( "Could not create an implementation id for a SwXShape!" );
+ return uno::Sequence< sal_Int8 > ();
+ }
+ else
+ {
+ return *pImplementationId;
+ }
+}
+/*-- 22.01.99 11:42:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXShape::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< beans::XPropertySetInfo > aRet;
+ if(xShapeAgg.is())
+ {
+ const uno::Type& rPropSetType = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ uno::Any aPSet = xShapeAgg->queryAggregation( rPropSetType );
+ if(aPSet.getValueType() == rPropSetType && aPSet.getValue())
+ {
+ uno::Reference< beans::XPropertySet > xPrSet =
+ *(uno::Reference< beans::XPropertySet >*)aPSet.getValue();
+ uno::Reference< beans::XPropertySetInfo > xInfo = xPrSet->getPropertySetInfo();
+ // PropertySetInfo verlaengern!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ aRet = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq );
+ }
+ }
+ if(!aRet.is())
+ aRet = m_pPropSet->getPropertySetInfo();
+ return aRet;
+}
+/*-- 22.01.99 11:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if(xShapeAgg.is())
+ {
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException ( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ //mit Layout kann der Anker umgesetzt werden, ohne dass sich die Position aendert
+ if(pFmt)
+ {
+ SwAttrSet aSet(pFmt->GetAttrSet());
+ SwDoc* pDoc = pFmt->GetDoc();
+ if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId)
+ {
+ sal_Bool bDone = sal_True;
+ uno::Reference<text::XTextFrame> xFrame;
+ if(aValue >>= xFrame)
+ {
+ uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
+ SwXFrame* pFrame = xTunnel.is() ?
+ reinterpret_cast< SwXFrame * >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
+ : 0;
+ if(pFrame && pFrame->GetFrmFmt() &&
+ pFrame->GetFrmFmt()->GetDoc() == pDoc)
+ {
+ UnoActionContext aCtx(pDoc);
+ SfxItemSet aItemSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+ aItemSet.SetParent(&pFmt->GetAttrSet());
+ SwFmtAnchor aAnchor = (const SwFmtAnchor&)aItemSet.Get(pEntry->nWID);
+ SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
+ aAnchor.SetAnchor(&aPos);
+ aAnchor.SetType(FLY_AT_FLY);
+ aItemSet.Put(aAnchor);
+ pFmt->SetFmtAttr(aItemSet);
+ bDone = sal_True;
+ }
+ }
+ if(!bDone)
+ throw lang::IllegalArgumentException();
+ }
+ else if(RES_OPAQUE == pEntry->nWID)
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ DBG_ASSERT(pSvxShape, "No SvxShape found!");
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ // OD 25.06.2003 #108784# - set layer of new drawing
+ // object to corresponding invisible layer.
+ bool bIsVisible = pDoc->IsVisibleLayerId( pObj->GetLayer() );
+ if(FmFormInventor != pObj->GetObjInventor())
+ {
+ pObj->SetLayer( *(sal_Bool*)aValue.getValue()
+ ? ( bIsVisible ? pDoc->GetHeavenId() : pDoc->GetInvisibleHeavenId() )
+ : ( bIsVisible ? pDoc->GetHellId() : pDoc->GetInvisibleHellId() ));
+ }
+ else
+ {
+ pObj->SetLayer( bIsVisible ? pDoc->GetControlsId() : pDoc->GetInvisibleControlsId());
+ }
+
+ }
+
+ }
+ // OD 2004-04-22 #i26791# - special handling for property FN_TEXT_RANGE
+ else if ( FN_TEXT_RANGE == pEntry->nWID )
+ {
+ SwFmtAnchor aAnchor( static_cast<const SwFmtAnchor&>(aSet.Get( RES_ANCHOR )) );
+ if (aAnchor.GetAnchorId() == FLY_AT_PAGE)
+ {
+ // set property <TextRange> not valid for to-page anchored shapes
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ SwUnoInternalPaM* pInternalPam =
+ new SwUnoInternalPaM( *(pFmt->GetDoc()) );
+ uno::Reference< text::XTextRange > xRg;
+ aValue >>= xRg;
+ if (::sw::XTextRangeToSwPaM(*pInternalPam, xRg) )
+ {
+ if (aAnchor.GetAnchorId() == FLY_AS_CHAR)
+ {
+ //delete old SwFmtFlyCnt
+ //With AnchorAsCharacter the current TxtAttribute has to be deleted.
+ //Tbis removes the frame format too.
+ //To prevent this the connection between format and attribute has to be broken before.
+ const SwPosition *pPos = aAnchor.GetCntntAnchor();
+ SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+ const xub_StrLen nIdx = pPos->nContent.GetIndex();
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt(
+ nIdx, RES_TXTATR_FLYCNT );
+ DBG_ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ "Missing FlyInCnt-Hint." );
+ DBG_ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFmt,
+ "Wrong TxtFlyCnt-Hint." );
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt())
+ .SetFlyFmt();
+
+ //The connection is removed now the attribute can be deleted.
+ pTxtNode->DeleteAttributes(
+ RES_TXTATR_FLYCNT, nIdx );
+ //create a new one
+ SwTxtNode *pNd = pInternalPam->GetNode()->GetTxtNode();
+ DBG_ASSERT( pNd, "Cursor not at TxtNode." );
+ SwFmtFlyCnt aFmt( pFmt );
+ pNd->InsertItem(aFmt, pInternalPam->GetPoint()
+ ->nContent.GetIndex(), 0 );
+ }
+ else
+ {
+ aAnchor.SetAnchor( pInternalPam->GetPoint() );
+ aSet.Put(aAnchor);
+ pFmt->SetFmtAttr(aSet);
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ delete pInternalPam;
+ }
+ }
+ // --> OD 2004-08-06 #i28749#
+ else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
+ {
+ sal_Int16 nPositionLayoutDir = 0;
+ aValue >>= nPositionLayoutDir;
+ pFmt->SetPositionLayoutDir( nPositionLayoutDir );
+ }
+ // <--
+ else if( pDoc->GetRootFrm() )
+ {
+ UnoActionContext aCtx(pDoc);
+ if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
+ {
+ SdrObject* pObj = pFmt->FindSdrObject();
+ SdrMarkList aList;
+ SdrMark aMark(pObj);
+ aList.InsertEntry(aMark);
+ sal_Int32 nAnchor = 0;
+ cppu::enum2int( nAnchor, aValue );
+ pDoc->ChgAnchor( aList, (RndStdIds)nAnchor,
+ sal_False, sal_True );
+ }
+ else
+ {
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
+ pFmt->SetFmtAttr(aSet);
+ }
+ }
+ else
+ {
+ m_pPropSet->setPropertyValue( *pEntry, aValue, aSet );
+
+ if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
+ {
+ bool bSetAttr = true;
+ sal_Int32 eNewAnchor = SWUnoHelper::GetEnumAsInt32( aValue );
+
+ //if old anchor was in_cntnt the related text attribute has to be removed
+ const SwFmtAnchor& rOldAnchor = pFmt->GetAnchor();
+ RndStdIds eOldAnchorId = rOldAnchor.GetAnchorId();
+ SdrObject* pObj = pFmt->FindSdrObject();
+ SwFrmFmt *pFlyFmt = FindFrmFmt( pObj );
+ pFlyFmt->DelFrms();
+ if( text::TextContentAnchorType_AS_CHARACTER != eNewAnchor &&
+ (FLY_AS_CHAR == eOldAnchorId))
+ {
+ //With AnchorAsCharacter the current TxtAttribute has to be deleted.
+ //Tbis removes the frame format too.
+ //To prevent this the connection between format and attribute has to be broken before.
+ const SwPosition *pPos = rOldAnchor.GetCntntAnchor();
+ SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+ const xub_StrLen nIdx = pPos->nContent.GetIndex();
+ SwTxtAttr * const pHnt =
+ pTxtNode->GetTxtAttrForCharAt(
+ nIdx, RES_TXTATR_FLYCNT );
+ DBG_ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ "Missing FlyInCnt-Hint." );
+ DBG_ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFlyFmt,
+ "Wrong TxtFlyCnt-Hint." );
+ const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt())
+ .SetFlyFmt();
+
+ //The connection is removed now the attribute can be deleted.
+ pTxtNode->DeleteAttributes(RES_TXTATR_FLYCNT, nIdx);
+ }
+ else if( text::TextContentAnchorType_AT_PAGE != eNewAnchor &&
+ (FLY_AT_PAGE == eOldAnchorId))
+ {
+ SwFmtAnchor aNewAnchor( dynamic_cast< const SwFmtAnchor& >( aSet.Get( RES_ANCHOR ) ) );
+ //if the fly has been anchored at page then it needs to be connected
+ //to the content position
+ SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
+ if( pDoc->GetRootFrm() )
+ {
+ SwCrsrMoveState aState( MV_SETONLYTEXT );
+ Point aTmp( pObj->GetSnapRect().TopLeft() );
+ pDoc->GetRootFrm()->GetCrsrOfst( aPam.GetPoint(), aTmp, &aState );
+ }
+ else
+ {
+ //without access to the layout the last node of the body will be used as anchor position
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ }
+ //anchor position has to be inserted after the text attribute has been inserted
+ aNewAnchor.SetAnchor( aPam.GetPoint() );
+ aSet.Put( aNewAnchor );
+ pFmt->SetFmtAttr(aSet);
+ bSetAttr = false;
+ if( text::TextContentAnchorType_AS_CHARACTER == eNewAnchor &&
+ (FLY_AS_CHAR != eOldAnchorId))
+ {
+ //the RES_TXTATR_FLYCNT needs to be added now
+ SwTxtNode *pNd = aPam.GetNode()->GetTxtNode();
+ DBG_ASSERT( pNd, "Crsr is not in a TxtNode." );
+ SwFmtFlyCnt aFmt( pFlyFmt );
+ pNd->InsertItem(aFmt,
+ aPam.GetPoint()->nContent.GetIndex(), 0 );
+ //aPam.GetPoint()->nContent--;
+
+ }
+ }
+ if( bSetAttr )
+ pFmt->SetFmtAttr(aSet);
+ }
+ else
+ pFmt->SetFmtAttr(aSet);
+ }
+ }
+ else
+ {
+ SfxPoolItem* pItem = 0;
+ switch(pEntry->nWID)
+ {
+ case RES_ANCHOR:
+ pItem = pImpl->GetAnchor(sal_True);
+ break;
+ case RES_HORI_ORIENT:
+ pItem = pImpl->GetHOrient(sal_True);
+ break;
+ case RES_VERT_ORIENT:
+ pItem = pImpl->GetVOrient(sal_True);
+ break;
+ case RES_LR_SPACE:
+ pItem = pImpl->GetLRSpace(sal_True);
+ break;
+ case RES_UL_SPACE:
+ pItem = pImpl->GetULSpace(sal_True);
+ break;
+ case RES_SURROUND:
+ pItem = pImpl->GetSurround(sal_True);
+ break;
+ case FN_TEXT_RANGE:
+ {
+ const uno::Type rTextRangeType =
+ ::getCppuType((uno::Reference< text::XTextRange>*)0);
+ if(aValue.getValueType() == rTextRangeType)
+ {
+ uno::Reference< text::XTextRange > & rRange = pImpl->GetTextRange();
+ rRange = *(uno::Reference< text::XTextRange > *)aValue.getValue();
+ }
+ }
+ break;
+ case RES_OPAQUE :
+ pImpl->SetOpaque(*(sal_Bool*)aValue.getValue());
+ break;
+ // OD 2004-04-22 #i26791#
+ case RES_FOLLOW_TEXT_FLOW:
+ {
+ pItem = pImpl->GetFollowTextFlow( sal_True );
+ }
+ break;
+ // OD 2004-05-05 #i28701#
+ case RES_WRAP_INFLUENCE_ON_OBJPOS:
+ {
+ pItem = pImpl->GetWrapInfluenceOnObjPos( sal_True );
+ }
+ break;
+ // --> OD 2004-08-06 #i28749#
+ case FN_SHAPE_POSITION_LAYOUT_DIR :
+ {
+ sal_Int16 nPositionLayoutDir = 0;
+ aValue >>= nPositionLayoutDir;
+ pImpl->SetPositionLayoutDir( nPositionLayoutDir );
+ }
+ break;
+ // <--
+ }
+ if(pItem)
+ ((SfxPoolItem*)pItem)->PutValue(aValue, pEntry->nMemberId);
+ }
+ }
+ else
+ {
+ uno::Reference< beans::XPropertySet > xPrSet;
+ const uno::Type& rPSetType =
+ ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
+ if(aPSet.getValueType() != rPSetType || !aPSet.getValue())
+ throw uno::RuntimeException();
+ xPrSet = *(uno::Reference< beans::XPropertySet >*)aPSet.getValue();
+ // --> OD 2004-08-05 #i31698# - setting the caption point of a
+ // caption object doesn't have to change the object position.
+ // Thus, keep the position, before the caption point is set and
+ // restore it afterwards.
+ awt::Point aKeepedPosition( 0, 0 );
+ if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint"))) &&
+ getShapeType().equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CaptionShape"))) )
+ {
+ aKeepedPosition = getPosition();
+ }
+ // <--
+ if( pFmt && pFmt->GetDoc()->GetRootFrm() )
+ {
+ UnoActionContext aCtx(pFmt->GetDoc());
+ xPrSet->setPropertyValue(rPropertyName, aValue);
+ }
+ else
+ xPrSet->setPropertyValue(rPropertyName, aValue);
+ // --> OD 2004-11-11 #i35007# - adjustment of the position
+ // attributes, if the transformation is set, causes wrong alignments
+ // and is no longer needed.
+ // The position attributes are set, if the drawing object is added
+ // to the draw page - see <SwXDrawPage::add(..)> - and on its first
+ // positioning - see <SwAnchoredDrawObject::MakeObjPos().
+// // --> OD 2004-07-28 #i31698# - additionally adjust the position
+// // properties of the shape, if the transformation is set and
+// // the shape isn't a group member.
+// if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))) &&
+// !_GetTopGroupObj() )
+// {
+// drawing::HomogenMatrix3 aMatrix;
+// aValue >>= aMatrix;
+// awt::Point aNewPos( basegfx::fround( aMatrix.Line1.Column3 ),
+// basegfx::fround( aMatrix.Line2.Column3 ) );
+// _AdjustPositionProperties( aNewPos );
+// }
+ // --> OD 2004-08-05 #i31698# - restore object position, if caption
+ // point is set.
+ if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint"))) &&
+ getShapeType().equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CaptionShape"))) )
+ {
+ setPosition( aKeepedPosition );
+ }
+ }
+ }
+}
+/*-- 22.01.99 11:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(xShapeAgg.is())
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ if(pFmt)
+ {
+ if(RES_OPAQUE == pEntry->nWID)
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ DBG_ASSERT(pSvxShape, "No SvxShape found!");
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ // OD 02.07.2003 #108784# - consider invisible layers
+ sal_Bool bOpaque =
+ ( pObj->GetLayer() != pFmt->GetDoc()->GetHellId() &&
+ pObj->GetLayer() != pFmt->GetDoc()->GetInvisibleHellId() );
+ aRet.setValue(&bOpaque, ::getBooleanCppuType());
+ }
+ }
+ else if(FN_ANCHOR_POSITION == pEntry->nWID)
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ DBG_ASSERT(pSvxShape, "No SvxShape found!");
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ Point aPt = pObj->GetAnchorPos();
+ awt::Point aPoint( TWIP_TO_MM100( aPt.X() ),
+ TWIP_TO_MM100( aPt.Y() ) );
+ aRet.setValue(&aPoint, ::getCppuType( (awt::Point*)0 ));
+ }
+ }
+ // OD 2004-04-22 #i26791# - special handling for FN_TEXT_RANGE
+ else if ( FN_TEXT_RANGE == pEntry->nWID )
+ {
+ const SwFmtAnchor aAnchor = pFmt->GetAnchor();
+ if (aAnchor.GetAnchorId() == FLY_AT_PAGE)
+ {
+ // return nothing, because property <TextRange> isn't
+ // valid for to-page anchored shapes
+ uno::Any aAny;
+ aRet = aAny;
+ }
+ else
+ {
+ if ( aAnchor.GetCntntAnchor() )
+ {
+ const uno::Reference< text::XTextRange > xTextRange
+ = SwXTextRange::CreateXTextRange(
+ *pFmt->GetDoc(),
+ *aAnchor.GetCntntAnchor(),
+ 0L );
+ aRet.setValue(&xTextRange, ::getCppuType((uno::Reference<text::XTextRange>*)0));
+ }
+ else
+ {
+ // return nothing
+ uno::Any aAny;
+ aRet = aAny;
+ }
+ }
+ }
+ // --> OD 2004-08-06 #i28749#
+ else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pEntry->nWID )
+ {
+ // get property <::drawing::Shape::Transformation>
+ // without conversion to layout direction as below
+ aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")) );
+ }
+ else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
+ {
+ aRet <<= pFmt->GetPositionLayoutDir();
+ }
+ // <--
+ // --> OD 2004-10-28 #i36248#
+ else if ( FN_SHAPE_STARTPOSITION_IN_HORI_L2R == pEntry->nWID )
+ {
+ // get property <::drawing::Shape::StartPosition>
+ // without conversion to layout direction as below
+ aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")) );
+ }
+ else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R == pEntry->nWID )
+ {
+ // get property <::drawing::Shape::EndPosition>
+ // without conversion to layout direction as below
+ aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")) );
+ }
+ // <--
+ else
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
+ }
+ }
+ else
+ {
+ SfxPoolItem* pItem = 0;
+ switch(pEntry->nWID)
+ {
+ case RES_ANCHOR:
+ pItem = pImpl->GetAnchor();
+ break;
+ case RES_HORI_ORIENT:
+ pItem = pImpl->GetHOrient();
+ break;
+ case RES_VERT_ORIENT:
+ pItem = pImpl->GetVOrient();
+ break;
+ case RES_LR_SPACE:
+ pItem = pImpl->GetLRSpace();
+ break;
+ case RES_UL_SPACE:
+ pItem = pImpl->GetULSpace();
+ break;
+ case RES_SURROUND:
+ pItem = pImpl->GetSurround();
+ break;
+ case FN_TEXT_RANGE :
+ aRet.setValue(&pImpl->GetTextRange(), ::getCppuType((uno::Reference<text::XTextRange>*)0));
+ break;
+ case RES_OPAQUE :
+ aRet.setValue(&pImpl->GetOpaque(), ::getBooleanCppuType());
+ break;
+ case FN_ANCHOR_POSITION :
+ {
+ awt::Point aPoint;
+ aRet.setValue(&aPoint, ::getCppuType( (awt::Point*)0 ));
+ }
+ break;
+ // OD 2004-04-22 #i26791#
+ case RES_FOLLOW_TEXT_FLOW :
+ {
+ pItem = pImpl->GetFollowTextFlow();
+ }
+ break;
+ // OD 2004-05-05 #i28701#
+ case RES_WRAP_INFLUENCE_ON_OBJPOS:
+ {
+ pItem = pImpl->GetWrapInfluenceOnObjPos();
+ }
+ break;
+ // --> OD 2004-08-06 #i28749#
+ case FN_SHAPE_TRANSFORMATION_IN_HORI_L2R:
+ {
+ // get property <::drawing::Shape::Transformation>
+ // without conversion to layout direction as below
+ aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")) );
+ }
+ break;
+ case FN_SHAPE_POSITION_LAYOUT_DIR:
+ {
+ aRet <<= pImpl->GetPositionLayoutDir();
+ }
+ break;
+ // <--
+ // --> OD 2004-08-06 #i36248#
+ case FN_SHAPE_STARTPOSITION_IN_HORI_L2R:
+ {
+ // get property <::drawing::Shape::StartPosition>
+ // without conversion to layout direction as below
+ aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")) );
+ }
+ break;
+ case FN_SHAPE_ENDPOSITION_IN_HORI_L2R:
+ {
+ // get property <::drawing::Shape::StartPosition>
+ // without conversion to layout direction as below
+ aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")) );
+ }
+ break;
+ // <--
+ }
+ if(pItem)
+ pItem->QueryValue(aRet, pEntry->nMemberId);
+ }
+ }
+ else
+ {
+ aRet = _getPropAtAggrObj( rPropertyName );
+
+ // --> OD 2004-07-28 #i31698# - convert the position (translation)
+ // of the drawing object in the transformation
+ if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))) )
+ {
+ drawing::HomogenMatrix3 aMatrix;
+ aRet >>= aMatrix;
+ aRet <<= _ConvertTransformationToLayoutDir( aMatrix );
+ }
+ // <--
+ // --> OD 2004-10-28 #i36248#
+ else if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) )
+ {
+ awt::Point aStartPos;
+ aRet >>= aStartPos;
+ // --> OD 2009-01-12 #i59051#
+ aRet <<= _ConvertStartOrEndPosToLayoutDir( aStartPos );
+ // <--
+ }
+ else if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) )
+ {
+ awt::Point aEndPos;
+ aRet >>= aEndPos;
+ // --> OD 2009-01-12 #i59051#
+ aRet <<= _ConvertStartOrEndPosToLayoutDir( aEndPos );
+ // <--
+ }
+ // --> OD 2009-01-16 #i59051#
+ else if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier"))) )
+ {
+ drawing::PolyPolygonBezierCoords aPath;
+ aRet >>= aPath;
+ aRet <<= _ConvertPolyPolygonBezierToLayoutDir( aPath );
+ // <--
+ }
+ // <--
+ }
+ }
+ return aRet;
+}
+
+/** method to get property from aggregation object
+
+ OD 2004-10-28 #i36248#
+
+ @author OD
+*/
+uno::Any SwXShape::_getPropAtAggrObj( const ::rtl::OUString& _rPropertyName )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ uno::Any aRet;
+
+ uno::Reference< beans::XPropertySet > xPrSet;
+ const uno::Type& rPSetType =
+ ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
+ if ( aPSet.getValueType() != rPSetType || !aPSet.getValue() )
+ {
+ throw uno::RuntimeException();
+ }
+ xPrSet = *(uno::Reference< beans::XPropertySet >*)aPSet.getValue();
+ aRet = xPrSet->getPropertyValue( _rPropertyName );
+
+ return aRet;
+}
+
+
+/* -----------------------------02.11.00 09:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+beans::PropertyState SwXShape::getPropertyState( const rtl::OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< rtl::OUString > aNames(1);
+ rtl::OUString* pStrings = aNames.getArray();
+ pStrings[0] = rPropertyName;
+ uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
+ return aStates.getConstArray()[0];
+}
+/* -----------------------------02.11.00 09:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates(
+ const uno::Sequence< rtl::OUString >& aPropertyNames )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::Sequence< beans::PropertyState > aRet(aPropertyNames.getLength());
+ if(xShapeAgg.is())
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ sal_Bool bGroupMember = sal_False;
+ sal_Bool bFormControl = sal_False;
+ SdrObject* pObject = pSvxShape->GetSdrObject();
+ if(pObject)
+ {
+ bGroupMember = pObject->GetUpGroup() != 0;
+ bFormControl = pObject->GetObjInventor() == FmFormInventor;
+ }
+ const rtl::OUString* pNames = aPropertyNames.getConstArray();
+ beans::PropertyState* pRet = aRet.getArray();
+ uno::Reference< XPropertyState > xShapePrState;
+ for(sal_Int32 nProperty = 0; nProperty < aPropertyNames.getLength(); nProperty++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( pNames[nProperty] );
+ if(pEntry)
+ {
+ if(RES_OPAQUE == pEntry->nWID)
+ pRet[nProperty] = bFormControl ?
+ beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
+ else if(FN_ANCHOR_POSITION == pEntry->nWID)
+ pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
+ else if(FN_TEXT_RANGE == pEntry->nWID)
+ pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
+ else if(bGroupMember)
+ pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
+ else if(pFmt)
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ SfxItemState eItemState = rSet.GetItemState(pEntry->nWID, FALSE);
+
+ if(SFX_ITEM_SET == eItemState)
+ pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
+ else if(SFX_ITEM_DEFAULT == eItemState)
+ pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
+ else
+ pRet[nProperty] = beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ else
+ {
+ SfxPoolItem* pItem = 0;
+ switch(pEntry->nWID)
+ {
+ case RES_ANCHOR:
+ pItem = pImpl->GetAnchor();
+ break;
+ case RES_HORI_ORIENT:
+ pItem = pImpl->GetHOrient();
+ break;
+ case RES_VERT_ORIENT:
+ pItem = pImpl->GetVOrient();
+ break;
+ case RES_LR_SPACE:
+ pItem = pImpl->GetLRSpace();
+ break;
+ case RES_UL_SPACE:
+ pItem = pImpl->GetULSpace();
+ break;
+ case RES_SURROUND:
+ pItem = pImpl->GetSurround();
+ break;
+ // OD 2004-05-05 #i28701#
+ case RES_WRAP_INFLUENCE_ON_OBJPOS:
+ {
+ pItem = pImpl->GetWrapInfluenceOnObjPos();
+ }
+ break;
+ }
+ if(pItem)
+ pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
+ else
+ pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ else
+ {
+ if(!xShapePrState.is())
+ {
+ const uno::Type& rPStateType = ::getCppuType((uno::Reference< XPropertyState >*)0);
+ uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
+ if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ throw uno::RuntimeException();
+ xShapePrState = *(uno::Reference< XPropertyState >*)aPState.getValue();
+ }
+ pRet[nProperty] = xShapePrState->getPropertyState(pNames[nProperty]);
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/* -----------------------------02.11.00 09:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXShape::setPropertyToDefault( const rtl::OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(xShapeAgg.is())
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if(pFmt)
+ {
+ const SfxItemSet& rSet = pFmt->GetAttrSet();
+ SfxItemSet aSet(pFmt->GetDoc()->GetAttrPool(), pEntry->nWID, pEntry->nWID);
+ aSet.SetParent(&rSet);
+ aSet.ClearItem(pEntry->nWID);
+ pFmt->GetDoc()->SetAttr(aSet, *pFmt);
+ }
+ else
+ {
+ switch(pEntry->nWID)
+ {
+ case RES_ANCHOR: pImpl->RemoveAnchor(); break;
+ case RES_HORI_ORIENT: pImpl->RemoveHOrient(); break;
+ case RES_VERT_ORIENT: pImpl->RemoveVOrient(); break;
+ case RES_LR_SPACE: pImpl->RemoveLRSpace(); break;
+ case RES_UL_SPACE: pImpl->RemoveULSpace(); break;
+ case RES_SURROUND: pImpl->RemoveSurround();break;
+ case RES_OPAQUE : pImpl->SetOpaque(sal_False); break;
+ case FN_TEXT_RANGE :
+ break;
+ // OD 2004-04-22 #i26791#
+ case RES_FOLLOW_TEXT_FLOW:
+ {
+ pImpl->RemoveFollowTextFlow();
+ }
+ break;
+ // OD 2004-05-05 #i28701#
+ case RES_WRAP_INFLUENCE_ON_OBJPOS:
+ {
+ pImpl->RemoveWrapInfluenceOnObjPos();
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ const uno::Type& rPStateType = ::getCppuType((uno::Reference< XPropertyState >*)0);
+ uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
+ if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ throw uno::RuntimeException();
+ uno::Reference< XPropertyState > xShapePrState = *(uno::Reference< XPropertyState >*)aPState.getValue();
+ xShapePrState->setPropertyToDefault( rPropertyName );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/* -----------------------------02.11.00 09:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXShape::getPropertyDefault( const rtl::OUString& rPropertyName )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::Any aRet;
+ if(xShapeAgg.is())
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ if(pEntry->nWID < RES_FRMATR_END && pFmt)
+ {
+ const SfxPoolItem& rDefItem =
+ pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
+ rDefItem.QueryValue(aRet, pEntry->nMemberId);
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ const uno::Type& rPStateType = ::getCppuType((uno::Reference< XPropertyState >*)0);
+ uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
+ if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ throw uno::RuntimeException();
+ uno::Reference< XPropertyState > xShapePrState = *(uno::Reference< XPropertyState >*)aPState.getValue();
+ xShapePrState->getPropertyDefault( rPropertyName );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 22.01.99 11:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::addPropertyChangeListener(
+ const rtl::OUString& _propertyName,
+ const uno::Reference< beans::XPropertyChangeListener > & _listener )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ if ( !xShapeAgg.is() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this );
+
+ // must be handled by the aggregate
+ uno::Reference< beans::XPropertySet > xShapeProps;
+ if ( xShapeAgg->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps )
+ xShapeProps->addPropertyChangeListener( _propertyName, _listener );
+}
+/*-- 22.01.99 11:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::removePropertyChangeListener(
+ const rtl::OUString& _propertyName,
+ const uno::Reference< beans::XPropertyChangeListener > & _listener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ if ( !xShapeAgg.is() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this );
+
+ // must be handled by the aggregate
+ uno::Reference< beans::XPropertySet > xShapeProps;
+ if ( xShapeAgg->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps )
+ xShapeProps->removePropertyChangeListener( _propertyName, _listener );
+}
+/*-- 22.01.99 11:42:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::addVetoableChangeListener(
+ const rtl::OUString& /*PropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/ )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 22.01.99 11:42:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::removeVetoableChangeListener(
+ const rtl::OUString& /*PropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 22.01.99 11:42:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXShape::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+/* -----------------14.04.99 13:02-------------------
+ *
+ * --------------------------------------------------*/
+void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // get access to SwDoc
+ // (see also SwXTextRange::XTextRangeToSwPaM)
+ SwDoc* pDoc = 0;
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ if(xRangeTunnel.is())
+ {
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ SwXTextPortion* pPortion = 0;
+ SwXText* pText = 0;
+ SwXParagraph* pParagraph = 0;
+
+ pRange = reinterpret_cast< SwXTextRange * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
+ pText = reinterpret_cast< SwXText * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXText::getUnoTunnelId()) ));
+ pCursor = reinterpret_cast< OTextCursorHelper * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ pPortion = reinterpret_cast< SwXTextPortion * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
+ pParagraph = reinterpret_cast< SwXParagraph * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
+
+ if (pRange)
+ pDoc = pRange->GetDoc();
+ else if (!pDoc && pText)
+ pDoc = pText->GetDoc();
+ else if (!pDoc && pCursor)
+ pDoc = pCursor->GetDoc();
+ else if ( !pDoc && pPortion && pPortion->GetCursor() )
+ {
+ pDoc = pPortion->GetCursor()->GetDoc();
+ }
+ else if ( !pDoc && pParagraph && pParagraph->GetTxtNode( ) )
+ {
+ pDoc = const_cast<SwDoc*>(pParagraph->GetTxtNode()->GetDoc());
+ }
+
+ }
+
+ if(!pDoc)
+ throw uno::RuntimeException();
+ SwDocShell *pDocSh = pDoc->GetDocShell();
+ if (pDocSh)
+ {
+ uno::Reference< frame::XModel > xModel;
+ xModel = pDocSh->GetModel();
+ uno::Reference< drawing::XDrawPageSupplier > xDPS(xModel, uno::UNO_QUERY);
+ if (xDPS.is())
+ {
+ uno::Reference< drawing::XDrawPage > xDP( xDPS->getDrawPage() );
+ if (xDP.is())
+ {
+ uno::Any aPos;
+ aPos <<= xTextRange;
+ setPropertyValue(S2U("TextRange"), aPos);
+ uno::Reference< drawing::XShape > xTemp( (cppu::OWeakObject*) this, uno::UNO_QUERY );
+ xDP->add( xTemp );
+ }
+ }
+ }
+}
+/* -----------------14.04.99 13:02-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXShape::getAnchor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ // return an anchor for non-page bound frames
+ // and for page bound frames that have a page no == NULL and a content position
+ if ((rAnchor.GetAnchorId() != FLY_AT_PAGE) ||
+ (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
+ {
+ const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
+ aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
+ }
+ }
+ else
+ aRef = pImpl->GetTextRange();
+ return aRef;
+}
+/* -----------------14.04.99 13:02-------------------
+ *
+ * --------------------------------------------------*/
+void SwXShape::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ // OD 10.07.2003 #110742# - determine correct <SdrObject>
+ //SdrObject* pObj = pFmt->FindSdrObject();
+ SdrObject* pObj = GetSvxShape()->GetSdrObject();
+ // OD 10.07.2003 #110742# - safety assertion:
+ // <pObj> must be the same as <pFmt->FindSdrObject()>, if <pObj> isn't
+ // a 'virtual' drawing object.
+ // OD 25.08.2003 #111713# - refine assertion for safety reason.
+ // --> OD 2005-02-02 #119236# - correct assertion and refine it.
+ ASSERT( !pObj ||
+ pObj->ISA(SwDrawVirtObj) ||
+ pObj->GetUpGroup() ||
+ pObj == pFmt->FindSdrObject(),
+ "<SwXShape::dispose(..) - different 'master' drawing objects!!" );
+ // <--
+ // OD 10.07.2003 #110742# - perform delete of draw frame format *not*
+ // for 'virtual' drawing objects.
+ // --> OD 2005-02-02 #119236# - no delete of draw format for members
+ // of a group
+ if ( pObj &&
+ !pObj->ISA(SwDrawVirtObj) &&
+ !pObj->GetUpGroup() &&
+ pObj->IsInserted() )
+ // <--
+ {
+ if (pFmt->GetAnchor().GetAnchorId() == FLY_AS_CHAR)
+ {
+ const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
+ SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ const xub_StrLen nIdx = rPos.nContent.GetIndex();
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
+ }
+ else
+ pFmt->GetDoc()->DelLayoutFmt( pFmt );
+ }
+ }
+ if(xShapeAgg.is())
+ {
+ uno::Any aAgg(xShapeAgg->queryAggregation( ::getCppuType((uno::Reference<XComponent>*)0)));
+ uno::Reference<XComponent> xComp;
+ aAgg >>= xComp;
+ if(xComp.is())
+ xComp->dispose();
+ }
+}
+/* -----------------14.04.99 13:02-------------------
+ *
+ * --------------------------------------------------*/
+void SwXShape::addEventListener(
+ const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ SvxShape* pSvxShape = GetSvxShape();
+ if(pSvxShape)
+ pSvxShape->addEventListener(aListener);
+}
+/* -----------------14.04.99 13:02-------------------
+ *
+ * --------------------------------------------------*/
+void SwXShape::removeEventListener(
+ const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ SvxShape* pSvxShape = GetSvxShape();
+ if(pSvxShape)
+ pSvxShape->removeEventListener(aListener);
+}
+/* -----------------03.06.99 08:53-------------------
+ *
+ * --------------------------------------------------*/
+rtl::OUString SwXShape::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXShape");
+}
+/* -----------------03.06.99 08:53-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXShape::supportsService(const rtl::OUString& rServiceName) throw( uno::RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ if(COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.drawing.Shape"))
+ bRet = sal_True;
+ else if(xShapeAgg.is())
+ {
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ SvxShape* pSvxShape = GetSvxShape();
+ bRet = pSvxShape->supportsService(rServiceName);
+ }
+ return bRet;
+}
+/* -----------------03.06.99 08:53-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< rtl::OUString > SwXShape::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq;
+ if(xShapeAgg.is())
+ {
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ SvxShape* pSvxShape = GetSvxShape();
+ if(pSvxShape)
+ aSeq = pSvxShape->getSupportedServiceNames();
+ }
+ else
+ {
+ aSeq.realloc(1);
+ aSeq.getArray()[0] = C2U("com.sun.star.drawing.Shape");
+ }
+ return aSeq;
+}
+/* -----------------------------15.03.00 14:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxShape* SwXShape::GetSvxShape()
+{
+ SvxShape* pSvxShape = 0;
+ if(xShapeAgg.is())
+ {
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ if(xShapeTunnel.is())
+ pSvxShape = reinterpret_cast< SvxShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ }
+ return pSvxShape;
+}
+
+// --> OD 2004-07-22 #i31698# -
+// implementation of virtual methods from drawing::XShape
+awt::Point SAL_CALL SwXShape::getPosition() throw ( uno::RuntimeException )
+{
+ awt::Point aPos( _GetAttrPosition() );
+
+ // handle group members
+ SvxShape* pSvxShape = GetSvxShape();
+ if ( pSvxShape )
+ {
+ SdrObject* pTopGroupObj = _GetTopGroupObj( pSvxShape );
+ if ( pTopGroupObj )
+ {
+ // --> OD 2004-10-01 #i34750# - get attribute position of top group
+ // shape and add offset between top group object and group member
+ uno::Reference< drawing::XShape > xGroupShape =
+ uno::Reference< drawing::XShape >( pTopGroupObj->getUnoShape(),
+ uno::UNO_QUERY );
+ aPos = xGroupShape->getPosition();
+ // add offset between top group object and group member
+ // to the determined attribute position
+ // --> OD 2004-10-01 #i34750# - correction:
+ // consider the layout direction
+ const Rectangle aMemberObjRect = GetSvxShape()->GetSdrObject()->GetSnapRect();
+ const Rectangle aGroupObjRect = pTopGroupObj->GetSnapRect();
+ // --> OD 2005-08-16 #i53320# - relative position of group member and
+ // top group object is always given in horizontal left-to-right layout.
+// const SwFrmFmt::tLayoutDir eLayoutDir = GetFrmFmt()
+// ? GetFrmFmt()->GetLayoutDir()
+// : SwFrmFmt::HORI_L2R;
+ awt::Point aOffset( 0, 0 );
+// switch ( eLayoutDir )
+// {
+// case SwFrmFmt::HORI_L2R:
+ {
+ aOffset.X = ( aMemberObjRect.Left() - aGroupObjRect.Left() );
+ aOffset.Y = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
+ }
+// break;
+// case SwFrmFmt::HORI_R2L:
+// {
+// aOffset.X = ( aGroupObjRect.Right() - aMemberObjRect.Right() );
+// aOffset.Y = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
+// }
+// break;
+// case SwFrmFmt::VERT_R2L:
+// {
+// aOffset.X = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
+// aOffset.Y = ( aGroupObjRect.Right() - aMemberObjRect.Right() );
+// }
+// break;
+// default:
+// {
+// ASSERT( false,
+// "<SwXShape::getPosition()> - unsupported layout direction" );
+// }
+// }
+ // <--
+ aOffset.X = TWIP_TO_MM100(aOffset.X);
+ aOffset.Y = TWIP_TO_MM100(aOffset.Y);
+ aPos.X += aOffset.X;
+ aPos.Y += aOffset.Y;
+ // <--
+ }
+ }
+
+ return aPos;
+}
+void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition )
+ throw ( uno::RuntimeException )
+{
+ SdrObject* pTopGroupObj = _GetTopGroupObj();
+ if ( !pTopGroupObj )
+ {
+ // --> OD 2005-02-10 #i37877# - no adjustment of position attributes,
+ // if the position also has to be applied at the drawing object and
+ // a contact object is already registered at the drawing object.
+ bool bApplyPosAtDrawObj(false);
+ bool bNoAdjustOfPosProp(false);
+ // --> OD 2004-10-19 #i35798# - apply position also to drawing object,
+ // if drawing object has no anchor position set.
+ if ( mxShape.is() )
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ if ( pSvxShape )
+ {
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ if ( pObj &&
+ pObj->GetAnchorPos().X() == 0 &&
+ pObj->GetAnchorPos().Y() == 0 )
+ {
+ bApplyPosAtDrawObj = true;
+ if ( pObj->GetUserCall() &&
+ pObj->GetUserCall()->ISA(SwDrawContact) )
+ {
+ bNoAdjustOfPosProp = true;
+ }
+ }
+ }
+ }
+ // <--
+ // shape isn't a group member. Thus, set positioning attributes
+ if ( !bNoAdjustOfPosProp )
+ {
+ _AdjustPositionProperties( aPosition );
+ }
+ if ( bApplyPosAtDrawObj )
+ {
+ mxShape->setPosition( aPosition );
+ }
+ // <--
+ }
+ else if ( mxShape.is() )
+ {
+ // shape is a member of a group. Thus, set its position.
+ awt::Point aNewPos( aPosition );
+ // The given position is given in the according layout direction. Thus,
+ // it has to be converted to a position in horizontal left-to-right
+ // layout.
+ // convert given absolute attribute position in layout direction into
+ // position in horizontal left-to-right layout.
+ {
+ aNewPos = _ConvertPositionToHoriL2R( aNewPos, getSize() );
+ }
+ // Convert given absolute position in horizontal left-to-right
+ // layout into relative position in horizontal left-to-right layout.
+ uno::Reference< drawing::XShape > xGroupShape =
+ uno::Reference< drawing::XShape >( pTopGroupObj->getUnoShape(),
+ uno::UNO_QUERY );
+ {
+ // --> OD 2004-09-29 #i34750# - correction:
+ // use method <xGroupShape->getPosition()> to get the correct
+ // position of the top group object.
+ awt::Point aAttrPosInHoriL2R(
+ _ConvertPositionToHoriL2R( xGroupShape->getPosition(),
+ xGroupShape->getSize() ) );
+ // <--
+ aNewPos.X -= aAttrPosInHoriL2R.X;
+ aNewPos.Y -= aAttrPosInHoriL2R.Y;
+ }
+ // convert relative position in horizontal left-to-right layout into
+ // absolute position in horizontal left-to-right layout
+ {
+ // --> OD 2004-10-01 #i34750# - correction:
+ // use method <SvxShape->getPosition()> to get the correct
+ // 'Drawing layer' position of the top group shape.
+ uno::Reference< lang::XUnoTunnel > xGrpShapeTunnel(
+ pTopGroupObj->getUnoShape(),
+ uno::UNO_QUERY );
+ SvxShape* pSvxGroupShape = reinterpret_cast< SvxShape * >(
+ sal::static_int_cast< sal_IntPtr >( xGrpShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ const awt::Point aGroupPos = pSvxGroupShape->getPosition();
+ aNewPos.X += aGroupPos.X;
+ aNewPos.Y += aGroupPos.Y;
+ // <--
+ }
+ // set position
+ mxShape->setPosition( aNewPos );
+ }
+}
+awt::Size SAL_CALL SwXShape::getSize() throw ( uno::RuntimeException )
+{
+ awt::Size aSize;
+ if ( mxShape.is() )
+ {
+ aSize = mxShape->getSize();
+ }
+ return aSize;
+}
+void SAL_CALL SwXShape::setSize( const awt::Size& aSize )
+ throw ( beans::PropertyVetoException,
+ uno::RuntimeException )
+{
+ if ( mxShape.is() )
+ {
+ mxShape->setSize( aSize );
+ }
+}
+// <--
+// --> OD 2004-07-22 #i31698# -
+// implementation of virtual methods from drawing::XShapeDescriptor
+::rtl::OUString SAL_CALL SwXShape::getShapeType() throw ( uno::RuntimeException )
+{
+ ::rtl::OUString aType;
+ if ( mxShape.is() )
+ {
+ aType = mxShape->getShapeType();
+ }
+ return aType;
+}
+// <--
+/** method to determine top group object
+
+ OD 2004-08-03 #i31698#
+
+ @author OD
+*/
+SdrObject* SwXShape::_GetTopGroupObj( SvxShape* _pSvxShape )
+{
+ SdrObject* pTopGroupObj( 0L );
+
+ SvxShape* pSvxShape = _pSvxShape ? _pSvxShape : GetSvxShape();
+ if ( pSvxShape )
+ {
+ SdrObject* pSdrObj = pSvxShape->GetSdrObject();
+ if ( pSdrObj && pSdrObj->GetUpGroup() )
+ {
+ pTopGroupObj = pSdrObj->GetUpGroup();
+ while ( pTopGroupObj->GetUpGroup() )
+ {
+ pTopGroupObj = pTopGroupObj->GetUpGroup();
+ }
+ }
+ }
+
+ return pTopGroupObj;
+}
+
+/** method to determine position according to the positioning attributes
+
+ OD 2004-08-03 #i31698#
+
+ @author OD
+*/
+awt::Point SwXShape::_GetAttrPosition()
+{
+ awt::Point aAttrPos;
+
+ uno::Any aHoriPos( getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")) ) );
+ aHoriPos >>= aAttrPos.X;
+ uno::Any aVertPos( getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")) ) );
+ aVertPos >>= aAttrPos.Y;
+ // --> OD 2004-10-19 #i35798# - fallback, if attribute position is (0,0)
+ // and no anchor position is applied to the drawing object
+ SvxShape* pSvxShape = GetSvxShape();
+ if ( pSvxShape )
+ {
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ if ( pObj &&
+ pObj->GetAnchorPos().X() == 0 &&
+ pObj->GetAnchorPos().Y() == 0 &&
+ aAttrPos.X == 0 && aAttrPos.Y == 0 )
+ {
+ const Rectangle aObjRect = pObj->GetSnapRect();
+ aAttrPos.X = TWIP_TO_MM100(aObjRect.Left());
+ aAttrPos.Y = TWIP_TO_MM100(aObjRect.Top());
+ }
+ }
+ // <--
+ // --> OD 2004-11-10 #i35007# - If drawing object is anchored as-character,
+ // it's x-position isn't sensible. Thus, return the x-position as zero in this case.
+ text::TextContentAnchorType eTextAnchorType =
+ text::TextContentAnchorType_AT_PARAGRAPH;
+ {
+ rtl::OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ uno::Any aAny = getPropertyValue( sAnchorType );
+ aAny >>= eTextAnchorType;
+ }
+ if ( eTextAnchorType == text::TextContentAnchorType_AS_CHARACTER )
+ {
+ aAttrPos.X = 0;
+ }
+ // <--
+
+ return aAttrPos;
+}
+
+/** method to convert the position (translation) of the drawing object to
+ the layout direction horizontal left-to-right.
+
+ OD 2004-07-27 #i31698#
+
+ @author OD
+*/
+awt::Point SwXShape::_ConvertPositionToHoriL2R( const awt::Point _aObjPos,
+ const awt::Size _aObjSize )
+{
+ awt::Point aObjPosInHoriL2R( _aObjPos );
+
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if ( pFrmFmt )
+ {
+ SwFrmFmt::tLayoutDir eLayoutDir = pFrmFmt->GetLayoutDir();
+ switch ( eLayoutDir )
+ {
+ case SwFrmFmt::HORI_L2R:
+ {
+ // nothing to do
+ }
+ break;
+ case SwFrmFmt::HORI_R2L:
+ {
+ aObjPosInHoriL2R.X = -_aObjPos.X - _aObjSize.Width;
+ }
+ break;
+ case SwFrmFmt::VERT_R2L:
+ {
+ aObjPosInHoriL2R.X = -_aObjPos.Y - _aObjSize.Width;
+ aObjPosInHoriL2R.Y = _aObjPos.X;
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwXShape::_ConvertPositionToHoriL2R(..)> - unsupported layout direction" );
+ }
+ }
+ }
+
+ return aObjPosInHoriL2R;
+}
+/** method to convert the transformation of the drawing object to the layout
+ direction, the drawing object is in
+
+ OD 2004-07-27 #i31698#
+
+ @author OD
+*/
+drawing::HomogenMatrix3 SwXShape::_ConvertTransformationToLayoutDir(
+ drawing::HomogenMatrix3 _aMatrixInHoriL2R )
+{
+ drawing::HomogenMatrix3 aMatrix( _aMatrixInHoriL2R );
+
+ // --> OD 2005-03-10 #i44334#, #i44681# - direct manipulation of the
+ // tranformation structure isn't valid, if it contains rotation.
+ SvxShape* pSvxShape = GetSvxShape();
+ ASSERT( pSvxShape,
+ "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SvxShape found!")
+ if ( pSvxShape )
+ {
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ ASSERT( pObj,
+ "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SdrObject found!")
+ if ( pObj )
+ {
+ // get position of object in Writer coordinate system.
+ awt::Point aPos( getPosition() );
+ // get position of object in Drawing layer coordinate system
+ const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
+ const awt::Point aObjPos(
+ TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
+ TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
+ // determine difference between these positions according to the
+ // Writer coordinate system
+ const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
+ aPos.Y - aObjPos.Y );
+ // apply translation difference to transformation matrix.
+ if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
+ {
+ // --> OD 2007-01-03 #i73079# - use correct matrix type
+ ::basegfx::B2DHomMatrix aTempMatrix;
+ // <--
+
+ aTempMatrix.set(0, 0, aMatrix.Line1.Column1 );
+ aTempMatrix.set(0, 1, aMatrix.Line1.Column2 );
+ aTempMatrix.set(0, 2, aMatrix.Line1.Column3 );
+ aTempMatrix.set(1, 0, aMatrix.Line2.Column1 );
+ aTempMatrix.set(1, 1, aMatrix.Line2.Column2 );
+ aTempMatrix.set(1, 2, aMatrix.Line2.Column3 );
+ aTempMatrix.set(2, 0, aMatrix.Line3.Column1 );
+ aTempMatrix.set(2, 1, aMatrix.Line3.Column2 );
+ aTempMatrix.set(2, 2, aMatrix.Line3.Column3 );
+
+ // --> OD 2007-01-03 #i73079#
+ aTempMatrix.translate( aTranslateDiff.X, aTranslateDiff.Y );
+ // <--
+
+ aMatrix.Line1.Column1 = aTempMatrix.get(0, 0);
+ aMatrix.Line1.Column2 = aTempMatrix.get(0, 1);
+ aMatrix.Line1.Column3 = aTempMatrix.get(0, 2);
+ aMatrix.Line2.Column1 = aTempMatrix.get(1, 0);
+ aMatrix.Line2.Column2 = aTempMatrix.get(1, 1);
+ aMatrix.Line2.Column3 = aTempMatrix.get(1, 2);
+ aMatrix.Line3.Column1 = aTempMatrix.get(2, 0);
+ aMatrix.Line3.Column2 = aTempMatrix.get(2, 1);
+ aMatrix.Line3.Column3 = aTempMatrix.get(2, 2);
+ }
+ }
+ }
+ // <--
+
+ return aMatrix;
+}
+
+/** method to adjust the positioning properties
+
+ OD 2004-08-02 #i31698#
+
+ @author OD
+*/
+void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition )
+{
+ // handle x-position
+ // --> OD 2004-11-10 #i35007# - no handling of x-position, if drawing
+ // object is anchored as-character, because it doesn't make sense.
+ text::TextContentAnchorType eTextAnchorType =
+ text::TextContentAnchorType_AT_PARAGRAPH;
+ {
+ rtl::OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ uno::Any aAny = getPropertyValue( sAnchorType );
+ aAny >>= eTextAnchorType;
+ }
+ if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER )
+ // <--
+ {
+ // determine current x-postion
+ rtl::OUString aHoriPosPropStr( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") );
+ uno::Any aHoriPos( getPropertyValue( aHoriPosPropStr ) );
+ sal_Int32 dCurrX = 0;
+ aHoriPos >>= dCurrX;
+ // change x-position attribute, if needed
+ if ( dCurrX != _aPosition.X )
+ {
+ // adjust x-position orientation to text::HoriOrientation::NONE, if needed
+ // Note: has to be done before setting x-position attribute
+ rtl::OUString aHoriOrientPropStr( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") );
+ uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) );
+ sal_Int16 eHoriOrient;
+ if (aHoriOrient >>= eHoriOrient) // may be void
+ {
+ if ( eHoriOrient != text::HoriOrientation::NONE )
+ {
+ eHoriOrient = text::HoriOrientation::NONE;
+ aHoriOrient <<= eHoriOrient;
+ setPropertyValue( aHoriOrientPropStr, aHoriOrient );
+ }
+ }
+ // set x-position attribute
+ aHoriPos <<= _aPosition.X;
+ setPropertyValue( aHoriPosPropStr, aHoriPos );
+ }
+ }
+
+ // handle y-position
+ {
+ // determine current y-postion
+ rtl::OUString aVertPosPropStr( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") );
+ uno::Any aVertPos( getPropertyValue( aVertPosPropStr ) );
+ sal_Int32 dCurrY = 0;
+ aVertPos >>= dCurrY;
+ // change y-position attribute, if needed
+ if ( dCurrY != _aPosition.Y )
+ {
+ // adjust y-position orientation to text::VertOrientation::NONE, if needed
+ // Note: has to be done before setting y-position attribute
+ rtl::OUString aVertOrientPropStr( RTL_CONSTASCII_USTRINGPARAM("VertOrient") );
+ uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) );
+ sal_Int16 eVertOrient;
+ if (aVertOrient >>= eVertOrient) // may be void
+ {
+ if ( eVertOrient != text::VertOrientation::NONE )
+ {
+ eVertOrient = text::VertOrientation::NONE;
+ aVertOrient <<= eVertOrient;
+ setPropertyValue( aVertOrientPropStr, aVertOrient );
+ }
+ }
+ // set y-position attribute
+ aVertPos <<= _aPosition.Y;
+ setPropertyValue( aVertPosPropStr, aVertPos );
+ }
+ }
+}
+
+/** method to convert start or end position of the drawing object to the
+ Writer specific position, which is the attribute position in layout direction
+
+ OD 2009-01-12 #i59051#
+
+ @author OD
+*/
+::com::sun::star::awt::Point SwXShape::_ConvertStartOrEndPosToLayoutDir(
+ const ::com::sun::star::awt::Point& aStartOrEndPos )
+{
+ awt::Point aConvertedPos( aStartOrEndPos );
+
+ SvxShape* pSvxShape = GetSvxShape();
+ ASSERT( pSvxShape,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!")
+ if ( pSvxShape )
+ {
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ ASSERT( pObj,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!")
+ if ( pObj )
+ {
+ // get position of object in Writer coordinate system.
+ awt::Point aPos( getPosition() );
+ // get position of object in Drawing layer coordinate system
+ const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
+ const awt::Point aObjPos(
+ TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
+ TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
+ // determine difference between these positions according to the
+ // Writer coordinate system
+ const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
+ aPos.Y - aObjPos.Y );
+ // apply translation difference to transformation matrix.
+ if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
+ {
+ aConvertedPos.X = aConvertedPos.X + aTranslateDiff.X;
+ aConvertedPos.Y = aConvertedPos.Y + aTranslateDiff.Y;
+ }
+ }
+ }
+
+ return aConvertedPos;
+}
+
+::com::sun::star::drawing::PolyPolygonBezierCoords SwXShape::_ConvertPolyPolygonBezierToLayoutDir(
+ const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath )
+{
+ drawing::PolyPolygonBezierCoords aConvertedPath( aPath );
+
+ SvxShape* pSvxShape = GetSvxShape();
+ ASSERT( pSvxShape,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!")
+ if ( pSvxShape )
+ {
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ ASSERT( pObj,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!")
+ if ( pObj )
+ {
+ // get position of object in Writer coordinate system.
+ awt::Point aPos( getPosition() );
+ // get position of object in Drawing layer coordinate system
+ const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
+ const awt::Point aObjPos(
+ TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
+ TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
+ // determine difference between these positions according to the
+ // Writer coordinate system
+ const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
+ aPos.Y - aObjPos.Y );
+ // apply translation difference to PolyPolygonBezier.
+ if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
+ {
+ const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix(
+ aTranslateDiff.X, aTranslateDiff.Y));
+
+ const sal_Int32 nOuterSequenceCount(aConvertedPath.Coordinates.getLength());
+ drawing::PointSequence* pInnerSequence = aConvertedPath.Coordinates.getArray();
+ for(sal_Int32 a(0); a < nOuterSequenceCount; a++)
+ {
+ const sal_Int32 nInnerSequenceCount(pInnerSequence->getLength());
+ awt::Point* pArray = pInnerSequence->getArray();
+
+ for(sal_Int32 b(0); b < nInnerSequenceCount; b++)
+ {
+ basegfx::B2DPoint aNewCoordinatePair(pArray->X, pArray->Y);
+ aNewCoordinatePair *= aMatrix;
+ pArray->X = basegfx::fround(aNewCoordinatePair.getX());
+ pArray->Y = basegfx::fround(aNewCoordinatePair.getY());
+ pArray++;
+ }
+ }
+ }
+ }
+ }
+
+ return aConvertedPath;
+}
+
+/*-- 31.05.01 09:59:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXGroupShape::SwXGroupShape(uno::Reference< XInterface > & xShape) :
+ SwXShape(xShape)
+{
+#ifdef DBG_UTIL
+ uno::Reference<XShapes> xShapes(xShapeAgg, uno::UNO_QUERY);
+ DBG_ASSERT(xShapes.is(), "no SvxShape found or shape is not a group shape");
+#endif
+}
+
+/*-- 31.05.01 09:59:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXGroupShape::~SwXGroupShape()
+{
+}
+/*-- 31.05.01 09:59:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXGroupShape::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet;
+ if(rType == ::getCppuType((uno::Reference<XShapes>*)0))
+ aRet <<= uno::Reference<XShapes>(this);
+ else
+ aRet = SwXShape::queryInterface(rType);
+ return aRet;
+}
+/*-- 31.05.01 09:59:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXGroupShape::acquire( ) throw()
+{
+ SwXShape::acquire();
+}
+/*-- 31.05.01 09:59:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXGroupShape::release( ) throw()
+{
+ SwXShape::release();
+}
+/*-- 31.05.01 09:59:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXGroupShape::add( const uno::Reference< XShape >& xShape ) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SvxShape* pSvxShape = GetSvxShape();
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pSvxShape && pFmt)
+ {
+ uno::Reference<XShapes> xShapes;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((uno::Reference<XShapes>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xShapes;
+ }
+ if(xShapes.is())
+ xShapes->add(xShape);
+ else
+ throw uno::RuntimeException();
+
+ uno::Reference<lang::XUnoTunnel> xTunnel(xShape, uno::UNO_QUERY);
+ SwXShape* pSwShape = 0;
+ if(xShape.is())
+ pSwShape = reinterpret_cast< SwXShape * >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
+ if(pSwShape && pSwShape->m_bDescriptor)
+ {
+ SvxShape* pAddShape = reinterpret_cast< SvxShape * >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ if(pAddShape)
+ {
+ SdrObject* pObj = pAddShape->GetSdrObject();
+ if(pObj)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ // OD 25.06.2003 #108784# - set layer of new drawing
+ // object to corresponding invisible layer.
+ if( FmFormInventor != pObj->GetObjInventor())
+ {
+ pObj->SetLayer( pSwShape->pImpl->GetOpaque()
+ ? pDoc->GetInvisibleHeavenId()
+ : pDoc->GetInvisibleHellId() );
+ }
+ else
+ {
+ pObj->SetLayer(pDoc->GetInvisibleControlsId());
+ }
+ }
+ }
+ pSwShape->m_bDescriptor = sal_False;
+ //add the group member to the format of the group
+ SwFrmFmt* pShapeFmt = ::FindFrmFmt( pSvxShape->GetSdrObject() );
+ if(pShapeFmt)
+ pFmt->Add(pSwShape);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 31.05.01 09:59:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXGroupShape::remove( const uno::Reference< XShape >& xShape ) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference<XShapes> xShapes;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((uno::Reference<XShapes>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xShapes;
+ }
+ if(!xShapes.is())
+ throw uno::RuntimeException();
+ xShapes->remove(xShape);
+}
+/*-- 31.05.01 09:59:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXGroupShape::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((uno::Reference<XIndexAccess>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw uno::RuntimeException();
+ return xAcc->getCount();
+}
+/*-- 31.05.01 09:59:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXGroupShape::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((uno::Reference<XIndexAccess>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw uno::RuntimeException();
+ return xAcc->getByIndex(nIndex);
+}
+/*-- 31.05.01 09:59:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXGroupShape::getElementType( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((uno::Reference<XIndexAccess>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw uno::RuntimeException();
+ return xAcc->getElementType();
+}
+/*-- 31.05.01 09:59:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXGroupShape::hasElements( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((uno::Reference<XIndexAccess>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw uno::RuntimeException();
+ return xAcc->hasElements();
+}
+
+
diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx
new file mode 100644
index 000000000000..79dea2e958c8
--- /dev/null
+++ b/sw/source/core/unocore/unoevent.cxx
@@ -0,0 +1,333 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+// HINTIDs must be on top; it is required for the macitem.hxx header
+#include "hintids.hxx"
+#include "unoevent.hxx"
+#include "unoframe.hxx"
+#include "unostyle.hxx"
+#include "swevent.hxx"
+#include "docstyle.hxx"
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "fmtinfmt.hxx"
+#include <svl/macitem.hxx>
+#include <rtl/ustrbuf.hxx>
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::beans::PropertyValue;
+using ::cppu::WeakImplHelper2;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+const sal_Char sAPI_ServiceName[] = "com.sun.star.container.XNameReplace";
+const sal_Char sAPI_SwFrameEventDescriptor[] = "SwFrameEventDescriptor";
+const sal_Char sAPI_SwFrameStyleEventDescriptor[] =
+ "SwFrameStyleEventDescriptor";
+const sal_Char sAPI_SwDetachedEventDescriptor[] = "SwDetachedEventDescriptor";
+const sal_Char sAPI_SwHyperlinkEventDescriptor[] =
+ "SwHyperlinkEventDescriptor";
+const sal_Char sAPI_SwAutoTextEventDescriptor[] =
+ "SwAutoTextEventDescriptor";
+
+//
+// tables of allowed events for specific objects
+//
+
+const struct SvEventDescription aGraphicEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { SVX_EVENT_IMAGE_LOAD, "OnLoadDone" },
+ { SVX_EVENT_IMAGE_ABORT, "OnLoadCancel" },
+ { SVX_EVENT_IMAGE_ERROR, "OnLoadError" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aFrameEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SW_EVENT_FRM_KEYINPUT_ALPHA, "OnAlphaCharInput" },
+ { SW_EVENT_FRM_KEYINPUT_NOALPHA, "OnNonAlphaCharInput" },
+ { SW_EVENT_FRM_RESIZE, "OnResize" },
+ { SW_EVENT_FRM_MOVE, "OnMove" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aOLEEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aHyperlinkEvents[] =
+{
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aAutotextEvents[] =
+{
+ { SW_EVENT_START_INS_GLOSSARY, "OnInsertStart" },
+ { SW_EVENT_END_INS_GLOSSARY, "OnInsertDone" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aFrameStyleEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SW_EVENT_FRM_KEYINPUT_ALPHA, "OnAlphaCharInput" },
+ { SW_EVENT_FRM_KEYINPUT_NOALPHA, "OnNonAlphaCharInput" },
+ { SW_EVENT_FRM_RESIZE, "OnResize" },
+ { SW_EVENT_FRM_MOVE, "OnMove" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { SVX_EVENT_IMAGE_LOAD, "OnLoadDone" },
+ { SVX_EVENT_IMAGE_ABORT, "OnLoadCancel" },
+ { SVX_EVENT_IMAGE_ERROR, "OnLoadError" },
+ { 0, NULL }
+};
+
+//
+// SwHyperlinkEventDescriptor
+//
+
+SwHyperlinkEventDescriptor::SwHyperlinkEventDescriptor() :
+ SvDetachedEventDescriptor(aHyperlinkEvents),
+ sImplName(RTL_CONSTASCII_USTRINGPARAM(sAPI_SwHyperlinkEventDescriptor))
+{
+}
+
+SwHyperlinkEventDescriptor::~SwHyperlinkEventDescriptor()
+{
+}
+
+OUString SwHyperlinkEventDescriptor::getImplementationName(void)
+ throw( RuntimeException )
+{
+ return sImplName;
+}
+
+void SwHyperlinkEventDescriptor::copyMacrosFromINetFmt(
+ const SwFmtINetFmt& aFmt)
+{
+ for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
+ {
+ USHORT nEvent = mpSupportedMacroItems[i].mnEvent;
+ const SvxMacro* aMacro = aFmt.GetMacro(nEvent);
+ if (NULL != aMacro)
+ replaceByName(nEvent, *aMacro);
+ }
+}
+
+void SwHyperlinkEventDescriptor::copyMacrosIntoINetFmt(
+ SwFmtINetFmt& aFmt)
+{
+ for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
+ {
+ USHORT nEvent = mpSupportedMacroItems[i].mnEvent;
+ if (hasByName(nEvent))
+ {
+ SvxMacro aMacro(sEmpty, sEmpty);
+ getByName(aMacro, nEvent);
+ aFmt.SetMacro(nEvent, aMacro);
+ }
+ }
+}
+
+
+void SwHyperlinkEventDescriptor::copyMacrosFromNameReplace(
+ uno::Reference<
+ container::XNameReplace> & xReplace)
+{
+ // iterate over all names (all names that *we* support)
+ Sequence<OUString> aNames = getElementNames();
+ sal_Int32 nCount = aNames.getLength();
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ // copy element for that name
+ const OUString& rName = aNames[i];
+ if (xReplace->hasByName(rName))
+ {
+ SvBaseEventDescriptor::replaceByName(rName,
+ xReplace->getByName(rName));
+ }
+ }
+}
+
+
+//
+// SwFrameEventDescriptor
+//
+
+// use double cast in superclass constructor to avoid ambigous cast
+SwFrameEventDescriptor::SwFrameEventDescriptor(
+ SwXTextFrame& rFrameRef ) :
+ SvEventDescriptor((text::XTextFrame&)rFrameRef, aFrameEvents),
+ sSwFrameEventDescriptor(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_SwFrameEventDescriptor)),
+ rFrame(rFrameRef)
+{
+}
+
+SwFrameEventDescriptor::SwFrameEventDescriptor(
+ SwXTextGraphicObject& rGraphicRef ) :
+ SvEventDescriptor((text::XTextContent&)rGraphicRef, aGraphicEvents),
+ rFrame((SwXFrame&)rGraphicRef)
+{
+}
+
+SwFrameEventDescriptor::SwFrameEventDescriptor(
+ SwXTextEmbeddedObject& rObjectRef ) :
+ SvEventDescriptor((text::XTextContent&)rObjectRef, aOLEEvents),
+ rFrame((SwXFrame&)rObjectRef)
+{
+}
+
+SwFrameEventDescriptor::~SwFrameEventDescriptor()
+{
+}
+
+void SwFrameEventDescriptor::setMacroItem(const SvxMacroItem& rItem)
+{
+ rFrame.GetFrmFmt()->SetFmtAttr(rItem);
+}
+
+const SvxMacroItem& SwFrameEventDescriptor::getMacroItem()
+{
+ return (const SvxMacroItem&)rFrame.GetFrmFmt()->GetFmtAttr(RES_FRMMACRO);
+}
+
+sal_uInt16 SwFrameEventDescriptor::getMacroItemWhich() const
+{
+ return RES_FRMMACRO;
+}
+
+OUString SwFrameEventDescriptor::getImplementationName()
+ throw( RuntimeException )
+{
+ return sSwFrameEventDescriptor;
+}
+
+
+//
+// SwFrameStyleEventDescriptor
+//
+
+SwFrameStyleEventDescriptor::SwFrameStyleEventDescriptor(
+ SwXFrameStyle& rStyleRef ) :
+ SvEventDescriptor((document::XEventsSupplier&)rStyleRef,
+ aFrameStyleEvents),
+ sSwFrameStyleEventDescriptor(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_SwFrameStyleEventDescriptor)),
+ rStyle(rStyleRef)
+{
+}
+
+SwFrameStyleEventDescriptor::~SwFrameStyleEventDescriptor()
+{
+}
+
+void SwFrameStyleEventDescriptor::setMacroItem(const SvxMacroItem& rItem)
+{
+ // As I was told, for some entirely unobvious reason getting an
+ // item from a style has to look as follows:
+ SfxStyleSheetBasePool* pBasePool = rStyle.GetBasePool();
+ if (pBasePool)
+ {
+ SfxStyleSheetBase* pBase = pBasePool->Find(rStyle.GetStyleName());
+ if (pBase)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ SfxItemSet& rStyleSet = xStyle->GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), RES_FRMMACRO, RES_FRMMACRO);
+ aSet.Put(rItem);
+ xStyle->SetItemSet(aSet);
+ }
+ }
+}
+
+static const SvxMacroItem aEmptyMacroItem(RES_FRMMACRO);
+
+const SvxMacroItem& SwFrameStyleEventDescriptor::getMacroItem()
+{
+ // As I was told, for some entirely unobvious reason getting an
+ // item from a style has to look as follows:
+ SfxStyleSheetBasePool* pBasePool = rStyle.GetBasePool();
+ if (pBasePool)
+ {
+ SfxStyleSheetBase* pBase = pBasePool->Find(rStyle.GetStyleName());
+ if (pBase)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase) );
+ return (const SvxMacroItem&)xStyle->GetItemSet().Get(RES_FRMMACRO);
+ }
+ else
+ return aEmptyMacroItem;
+ }
+ else
+ return aEmptyMacroItem;
+}
+
+OUString SwFrameStyleEventDescriptor::getImplementationName()
+ throw( RuntimeException )
+{
+ return sSwFrameStyleEventDescriptor;
+}
+
+sal_uInt16 SwFrameStyleEventDescriptor::getMacroItemWhich() const
+{
+ return RES_FRMMACRO;
+}
+
diff --git a/sw/source/core/unocore/unoevtlstnr.cxx b/sw/source/core/unocore/unoevtlstnr.cxx
new file mode 100644
index 000000000000..197715bbd7e6
--- /dev/null
+++ b/sw/source/core/unocore/unoevtlstnr.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+#include <unoevtlstnr.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+/* -----------------22.04.99 11:24-------------------
+ *
+ * --------------------------------------------------*/
+SV_IMPL_PTRARR(SwEvtLstnrArray, XEventListenerPtr);
+
+/*-- 22.04.99 11:24:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwEventListenerContainer::SwEventListenerContainer( uno::XInterface* _pxParent) :
+ pListenerArr(0),
+ pxParent(_pxParent)
+{
+}
+/*-- 22.04.99 11:24:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwEventListenerContainer::~SwEventListenerContainer()
+{
+ if(pListenerArr && pListenerArr->Count())
+ {
+ pListenerArr->DeleteAndDestroy(0, pListenerArr->Count());
+ }
+ delete pListenerArr;
+}
+/*-- 22.04.99 11:24:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwEventListenerContainer::AddListener(const uno::Reference< lang::XEventListener > & rxListener)
+{
+ if(!pListenerArr)
+ pListenerArr = new SwEvtLstnrArray;
+ uno::Reference< lang::XEventListener > * pInsert = new uno::Reference< lang::XEventListener > ;
+ *pInsert = rxListener;
+ pListenerArr->Insert(pInsert, pListenerArr->Count());
+}
+/*-- 22.04.99 11:25:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwEventListenerContainer::RemoveListener(const uno::Reference< lang::XEventListener > & rxListener)
+{
+ if(!pListenerArr)
+ return sal_False;
+ else
+ {
+ lang::XEventListener* pLeft = rxListener.get();
+ for(sal_uInt16 i = 0; i < pListenerArr->Count(); i++)
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ lang::XEventListener* pRight = pElem->get();
+ if(pLeft == pRight)
+ {
+ pListenerArr->Remove(i);
+ delete pElem;
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+/*-- 22.04.99 11:25:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwEventListenerContainer::Disposing()
+{
+ if(!pListenerArr)
+ return;
+
+ lang::EventObject aObj(pxParent);
+ for(sal_uInt16 i = 0; i < pListenerArr->Count(); i++)
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ (*pElem)->disposing(aObj);
+ }
+ pListenerArr->DeleteAndDestroy(0, pListenerArr->Count());
+}
+
+
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
new file mode 100644
index 000000000000..bd4a4ce5ef98
--- /dev/null
+++ b/sw/source/core/unocore/unofield.cxx
@@ -0,0 +1,3007 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <doc.hxx>
+#include <hints.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unocoll.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <docstat.hxx>
+#include <editsh.hxx>
+#include <viewsh.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTimeRange.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+
+//undef to prevent error (from sfx2/docfile.cxx)
+#undef SEQUENCE
+#include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/PageNumberType.hpp>
+#include <unofield.hxx>
+#include <unocrsr.hxx>
+#include <authfld.hxx>
+#include <flddat.hxx>
+#include <dbfld.hxx>
+#include <usrfld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <chpfld.hxx>
+#include <flddropdown.hxx>
+#include <poolfmt.hxx>
+#include <poolfmt.hrc>
+#include <pagedesc.hxx>
+#include <docary.hxx>
+#include <reffld.hxx>
+#include <ddefld.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <swunohelper.hxx>
+#include <unofldmid.h>
+#include <scriptinfo.hxx>
+#include <tools/datetime.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#define _SVSTDARR_STRINGS
+#include <svl/svstdarr.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <textapi.hxx>
+#include <editeng/outliner.hxx>
+#include <docsh.hxx>
+#include <fmtmeta.hxx> // MetaFieldManager
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace nsSwDocInfoSubType;
+
+#define COM_TEXT_FLDMASTER "com.sun.star.text.FieldMaster."
+
+// case-corrected version of the first part for the service names (see #i67811)
+#define COM_TEXT_FLDMASTER_CC "com.sun.star.text.fieldmaster."
+
+// note: this thing is indexed as an array, so do not insert/remove entries!
+static const sal_uInt16 aDocInfoSubTypeFromService[] =
+{
+ DI_CHANGE | DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_AUTHOR
+ DI_CHANGE | DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME
+ DI_EDIT | DI_SUB_TIME, //PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME
+ DI_COMMENT, //PROPERTY_MAP_FLDTYP_DOCINFO_DESCRIPTION
+ DI_CREATE | DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_AUTHOR
+ DI_CREATE | DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME
+ 0, //DUMMY
+ 0, //DUMMY
+ 0, //DUMMY
+ 0, //DUMMY
+ DI_CUSTOM, //PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM
+ DI_PRINT | DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_PRINT_AUTHOR
+ DI_PRINT | DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_PRINT_DATE_TIME
+ DI_KEYS, //PROPERTY_MAP_FLDTYP_DOCINFO_KEY_WORDS
+ DI_THEMA, //PROPERTY_MAP_FLDTYP_DOCINFO_SUBJECT
+ DI_TITEL, //PROPERTY_MAP_FLDTYP_DOCINFO_TITLE
+ DI_DOCNO //PROPERTY_MAP_FLDTYP_DOCINFO_REVISION
+};
+struct ServiceIdResId
+{
+ USHORT nResId;
+ USHORT nServiceId;
+};
+static const ServiceIdResId aServiceToRes[] =
+{
+ {RES_DATETIMEFLD, SW_SERVICE_FIELDTYPE_DATETIME },
+ {RES_USERFLD, SW_SERVICE_FIELDTYPE_USER },
+ {RES_SETEXPFLD, SW_SERVICE_FIELDTYPE_SET_EXP } ,
+ {RES_GETEXPFLD, SW_SERVICE_FIELDTYPE_GET_EXP } ,
+ {RES_FILENAMEFLD, SW_SERVICE_FIELDTYPE_FILE_NAME },
+ {RES_PAGENUMBERFLD, SW_SERVICE_FIELDTYPE_PAGE_NUM } ,
+ {RES_AUTHORFLD, SW_SERVICE_FIELDTYPE_AUTHOR } ,
+ {RES_CHAPTERFLD, SW_SERVICE_FIELDTYPE_CHAPTER },
+ {RES_GETREFFLD, SW_SERVICE_FIELDTYPE_GET_REFERENCE } ,
+ {RES_HIDDENTXTFLD, SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
+ {RES_POSTITFLD, SW_SERVICE_FIELDTYPE_ANNOTATION } ,
+ {RES_INPUTFLD, SW_SERVICE_FIELDTYPE_INPUT },
+ {RES_MACROFLD, SW_SERVICE_FIELDTYPE_MACRO },
+ {RES_DDEFLD, SW_SERVICE_FIELDTYPE_DDE },
+ {RES_HIDDENPARAFLD, SW_SERVICE_FIELDTYPE_HIDDEN_PARA } ,
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOC_INFO },
+ {RES_TEMPLNAMEFLD, SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
+ {RES_EXTUSERFLD, SW_SERVICE_FIELDTYPE_USER_EXT },
+ {RES_REFPAGESETFLD, SW_SERVICE_FIELDTYPE_REF_PAGE_SET } ,
+ {RES_REFPAGEGETFLD, SW_SERVICE_FIELDTYPE_REF_PAGE_GET } ,
+ {RES_JUMPEDITFLD, SW_SERVICE_FIELDTYPE_JUMP_EDIT },
+ {RES_SCRIPTFLD, SW_SERVICE_FIELDTYPE_SCRIPT } ,
+ {RES_DBNEXTSETFLD, SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
+ {RES_DBNUMSETFLD, SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
+ {RES_DBSETNUMBERFLD, SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM } ,
+ {RES_DBFLD, SW_SERVICE_FIELDTYPE_DATABASE } ,
+ {RES_DBNAMEFLD, SW_SERVICE_FIELDTYPE_DATABASE_NAME },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_PAGE_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_WORD_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_TABLE_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME},
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME},
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
+ {RES_INPUTFLD, SW_SERVICE_FIELDTYPE_INPUT_USER },
+ {RES_HIDDENTXTFLD, SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
+ {RES_AUTHORITY, SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
+ {RES_COMBINED_CHARS, SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
+ {RES_DROPDOWN, SW_SERVICE_FIELDTYPE_DROPDOWN },
+ {RES_TABLEFLD, SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
+ {USHRT_MAX, USHRT_MAX }
+};
+//-----------------------------------------------------------------
+sal_uInt16 lcl_ServiceIdToResId(sal_uInt16 nServiceId)
+{
+ const ServiceIdResId* pMap = aServiceToRes;
+ while( USHRT_MAX != pMap->nServiceId && nServiceId != pMap->nServiceId )
+ ++pMap;
+#ifdef DBG_UTIL
+ if( USHRT_MAX == pMap->nServiceId )
+ DBG_ERROR("service id not found");
+#endif
+ return pMap->nResId;
+}
+//-----------------------------------------------------------------
+sal_uInt16 lcl_GetServiceForField( const SwField& rFld )
+{
+ sal_uInt16 nWhich = rFld.Which(), nSrvId = USHRT_MAX;
+ //special handling for some fields
+ switch( nWhich )
+ {
+ case RES_INPUTFLD:
+ if( INP_USR == (rFld.GetSubType() & 0x00ff) )
+ nSrvId = SW_SERVICE_FIELDTYPE_INPUT_USER;
+ break;
+
+ case RES_DOCINFOFLD:
+ {
+ USHORT nSubType = rFld.GetSubType();
+ switch( (nSubType & 0xff))
+ {
+ case DI_CHANGE:
+ nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
+ ? SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR
+ : SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME;
+ break;
+ case DI_CREATE:
+ nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
+ ? SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR
+ : SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME;
+ break;
+ case DI_PRINT:
+ nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
+ ? SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR
+ : SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME;
+ break;
+ case DI_EDIT: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME;break;
+ case DI_COMMENT:nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION;break;
+ case DI_KEYS: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS;break;
+ case DI_THEMA: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT; break;
+ case DI_TITEL: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_TITLE; break;
+ case DI_DOCNO: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_REVISION; break;
+ case DI_CUSTOM: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM; break;
+ }
+ }
+ break;
+
+ case RES_HIDDENTXTFLD:
+ nSrvId = TYP_CONDTXTFLD == rFld.GetSubType()
+ ? SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT
+ : SW_SERVICE_FIELDTYPE_HIDDEN_TEXT;
+ break;
+
+ case RES_DOCSTATFLD:
+ {
+ switch( rFld.GetSubType() )
+ {
+ case DS_PAGE: nSrvId = SW_SERVICE_FIELDTYPE_PAGE_COUNT; break;
+ case DS_PARA: nSrvId = SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT; break;
+ case DS_WORD: nSrvId = SW_SERVICE_FIELDTYPE_WORD_COUNT ; break;
+ case DS_CHAR: nSrvId = SW_SERVICE_FIELDTYPE_CHARACTER_COUNT; break;
+ case DS_TBL: nSrvId = SW_SERVICE_FIELDTYPE_TABLE_COUNT ; break;
+ case DS_GRF: nSrvId = SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT; break;
+ case DS_OLE: nSrvId = SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT; break;
+ }
+ }
+ break;
+ }
+ if( USHRT_MAX == nSrvId )
+ {
+ for( const ServiceIdResId* pMap = aServiceToRes;
+ USHRT_MAX != pMap->nResId; ++pMap )
+ if( nWhich == pMap->nResId )
+ {
+ nSrvId = pMap->nServiceId;
+ break;
+ }
+ }
+#ifdef DBG_UTIL
+ if( USHRT_MAX == nSrvId )
+ DBG_ERROR("resid not found");
+#endif
+ return nSrvId;
+}
+
+sal_uInt16 lcl_GetPropMapIdForFieldType( USHORT nWhich )
+{
+ sal_uInt16 nId;
+ switch( nWhich )
+ {
+ case RES_USERFLD: nId = PROPERTY_MAP_FLDMSTR_USER; break;
+ case RES_DBFLD: nId = PROPERTY_MAP_FLDMSTR_DATABASE; break;
+ case RES_SETEXPFLD: nId = PROPERTY_MAP_FLDMSTR_SET_EXP; break;
+ case RES_DDEFLD: nId = PROPERTY_MAP_FLDMSTR_DDE; break;
+ case RES_AUTHORITY: nId = PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; break;
+ default: nId = PROPERTY_MAP_FLDMSTR_DUMMY0;
+ }
+ return nId;
+}
+
+
+USHORT GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp )
+{
+ USHORT nId = lcl_GetPropMapIdForFieldType( rTyp.Which() );
+ const SfxItemPropertySet* pSet = aSwMapProvider.GetPropertySet( nId );
+ if( !pSet )
+ nId = USHRT_MAX;
+ else
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pSet->getPropertyMap()->getByName(rProperty);
+ nId = pEntry ? pEntry->nWID : USHRT_MAX;
+ }
+ return nId;
+}
+
+USHORT lcl_GetPropertyMapOfService( USHORT nServiceId )
+{
+ USHORT nRet;
+ switch ( nServiceId)
+ {
+ case SW_SERVICE_FIELDTYPE_DATETIME: nRet = PROPERTY_MAP_FLDTYP_DATETIME; break;
+ case SW_SERVICE_FIELDTYPE_USER: nRet = PROPERTY_MAP_FLDTYP_USER; break;
+ case SW_SERVICE_FIELDTYPE_SET_EXP: nRet = PROPERTY_MAP_FLDTYP_SET_EXP; break;
+ case SW_SERVICE_FIELDTYPE_GET_EXP: nRet = PROPERTY_MAP_FLDTYP_GET_EXP; break;
+ case SW_SERVICE_FIELDTYPE_FILE_NAME: nRet = PROPERTY_MAP_FLDTYP_FILE_NAME; break;
+ case SW_SERVICE_FIELDTYPE_PAGE_NUM: nRet = PROPERTY_MAP_FLDTYP_PAGE_NUM; break;
+ case SW_SERVICE_FIELDTYPE_AUTHOR: nRet = PROPERTY_MAP_FLDTYP_AUTHOR; break;
+ case SW_SERVICE_FIELDTYPE_CHAPTER: nRet = PROPERTY_MAP_FLDTYP_CHAPTER; break;
+ case SW_SERVICE_FIELDTYPE_GET_REFERENCE: nRet = PROPERTY_MAP_FLDTYP_GET_REFERENCE; break;
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT: nRet = PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT; break;
+ case SW_SERVICE_FIELDTYPE_ANNOTATION: nRet = PROPERTY_MAP_FLDTYP_ANNOTATION; break;
+ case SW_SERVICE_FIELDTYPE_INPUT_USER:
+ case SW_SERVICE_FIELDTYPE_INPUT: nRet = PROPERTY_MAP_FLDTYP_INPUT; break;
+ case SW_SERVICE_FIELDTYPE_MACRO: nRet = PROPERTY_MAP_FLDTYP_MACRO; break;
+ case SW_SERVICE_FIELDTYPE_DDE: nRet = PROPERTY_MAP_FLDTYP_DDE; break;
+ case SW_SERVICE_FIELDTYPE_HIDDEN_PARA: nRet = PROPERTY_MAP_FLDTYP_HIDDEN_PARA; break;
+ case SW_SERVICE_FIELDTYPE_DOC_INFO: nRet = PROPERTY_MAP_FLDTYP_DOC_INFO; break;
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME: nRet = PROPERTY_MAP_FLDTYP_TEMPLATE_NAME; break;
+ case SW_SERVICE_FIELDTYPE_USER_EXT: nRet = PROPERTY_MAP_FLDTYP_USER_EXT; break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_SET: nRet = PROPERTY_MAP_FLDTYP_REF_PAGE_SET; break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_GET: nRet = PROPERTY_MAP_FLDTYP_REF_PAGE_GET; break;
+ case SW_SERVICE_FIELDTYPE_JUMP_EDIT: nRet = PROPERTY_MAP_FLDTYP_JUMP_EDIT; break;
+ case SW_SERVICE_FIELDTYPE_SCRIPT: nRet = PROPERTY_MAP_FLDTYP_SCRIPT; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET: nRet = PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET: nRet = PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM: nRet = PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE: nRet = PROPERTY_MAP_FLDTYP_DATABASE; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NAME: nRet = PROPERTY_MAP_FLDTYP_DATABASE_NAME; break;
+ case SW_SERVICE_FIELDTYPE_TABLE_FORMULA: nRet = PROPERTY_MAP_FLDTYP_TABLE_FORMULA; break;
+ case SW_SERVICE_FIELDTYPE_PAGE_COUNT:
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT:
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT:
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT:
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT:
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT:
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT: nRet = PROPERTY_MAP_FLDTYP_DOCSTAT; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_MISC; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_REVISION; break;
+ case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY: nRet = PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY; break;
+ case SW_SERVICE_FIELDTYPE_DUMMY_0:
+ case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS: nRet = PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS; break;
+ case SW_SERVICE_FIELDTYPE_DROPDOWN: nRet = PROPERTY_MAP_FLDTYP_DROPDOWN; break;
+ case SW_SERVICE_FIELDTYPE_DUMMY_4:
+ case SW_SERVICE_FIELDTYPE_DUMMY_5:
+ case SW_SERVICE_FIELDTYPE_DUMMY_6:
+ case SW_SERVICE_FIELDTYPE_DUMMY_7:
+ nRet = PROPERTY_MAP_FLDTYP_DUMMY_0; break;
+ case SW_SERVICE_FIELDMASTER_USER: nRet = PROPERTY_MAP_FLDMSTR_USER; break;
+ case SW_SERVICE_FIELDMASTER_DDE: nRet = PROPERTY_MAP_FLDMSTR_DDE; break;
+ case SW_SERVICE_FIELDMASTER_SET_EXP: nRet = PROPERTY_MAP_FLDMSTR_SET_EXP; break;
+ case SW_SERVICE_FIELDMASTER_DATABASE: nRet = PROPERTY_MAP_FLDMSTR_DATABASE; break;
+ case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY: nRet = PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; break;
+ case SW_SERVICE_FIELDMASTER_DUMMY2:
+ case SW_SERVICE_FIELDMASTER_DUMMY3:
+ case SW_SERVICE_FIELDMASTER_DUMMY4:
+ case SW_SERVICE_FIELDMASTER_DUMMY5: nRet = PROPERTY_MAP_FLDMSTR_DUMMY0; break;
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT: nRet = PROPERTY_MAP_FLDTYP_HIDDEN_TEXT; break;
+ default:
+ DBG_ERROR( "wrong service id" );
+ nRet = USHRT_MAX;
+ }
+ return nRet;
+}
+
+/******************************************************************
+ * SwXFieldMaster
+ ******************************************************************/
+TYPEINIT1(SwXFieldMaster, SwClient);
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXFieldMaster::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXFieldMaster::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldMaster::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXFieldMaster");
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFieldMaster::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ if(rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextFieldMaster")))
+ bRet = sal_True;
+ else
+ {
+ const sal_Char* pEntry;
+ switch( nResTypeId )
+ {
+ case RES_USERFLD: pEntry = "User"; break;
+ case RES_DBFLD: pEntry = "Database"; break;
+ case RES_SETEXPFLD: pEntry = "SetExpression"; break;
+ case RES_DDEFLD: pEntry = "DDE"; break;
+ case RES_AUTHORITY: pEntry = "Bibliography"; break;
+ default: pEntry = 0;
+ }
+ if( pEntry )
+ {
+ ByteString aTmp( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.fieldmaster."));
+ aTmp.Append( pEntry );
+ bRet = rServiceName.equalsAsciiL(aTmp.GetBuffer(), aTmp.Len());
+ }
+ }
+ return bRet;
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXFieldMaster::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFieldMaster");
+
+ const sal_Char* pEntry1;
+ switch( nResTypeId )
+ {
+ case RES_USERFLD: pEntry1 = "User"; break;
+ case RES_DBFLD: pEntry1 = "Database"; break;
+ case RES_SETEXPFLD: pEntry1 = "SetExpression"; break;
+ case RES_DDEFLD: pEntry1 = "DDE"; break;
+ case RES_AUTHORITY: pEntry1 = "Bibliography"; break;
+ default: pEntry1 = 0;
+ }
+ if( pEntry1 )
+ {
+ String s;
+ s.AppendAscii( "com.sun.star.text.fieldmaster." ).AppendAscii( pEntry1 );
+ pArray[1] = s;
+ }
+ return aRet;
+}
+/*-- 14.12.98 11:08:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldMaster::SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId) :
+ aLstnrCntnr( (XPropertySet*)this),
+ nResTypeId(nResId),
+ m_pDoc(pDoc),
+ m_bIsDescriptor(sal_True),
+ fParam1(0.),
+ nParam1(-1),
+ bParam1(FALSE),
+ nParam2(0)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 14.12.98 11:08:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldMaster::SwXFieldMaster(SwFieldType& rType, SwDoc* pDoc) :
+ SwClient(&rType),
+ aLstnrCntnr( (XPropertySet*)this),
+ nResTypeId(rType.Which()),
+ m_pDoc(pDoc),
+ m_bIsDescriptor(sal_False),
+ fParam1(0.),
+ nParam1(-1),
+ bParam1(FALSE)
+{
+
+}
+/*-- 14.12.98 11:08:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldMaster::~SwXFieldMaster()
+{
+
+}
+/*-- 14.12.98 11:08:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXFieldMaster::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< beans::XPropertySetInfo > aRef =
+ aSwMapProvider.GetPropertySet(
+ lcl_GetPropMapIdForFieldType( nResTypeId ) )->getPropertySetInfo();
+ return aRef;
+}
+/*-- 14.12.98 11:08:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::setPropertyValue( const OUString& rPropertyName,
+ const uno::Any& rValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFieldType* pType = GetFldType(sal_True);
+ if(pType)
+ {
+ sal_Bool bSetValue = sal_True;
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_SUB_TYPE)))
+ {
+ const SvStringsDtor& rExtraArr = SwStyleNameMapper::GetExtraUINameArray();
+ String sTypeName = pType->GetName();
+ static sal_uInt16 nIds[] =
+ {
+ RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
+ 0
+ };
+ for(const sal_uInt16 * pIds = nIds; *pIds; ++pIds)
+ {
+ if(sTypeName == *rExtraArr[ *pIds ] )
+ {
+ bSetValue = sal_False;
+ break;
+ }
+ }
+ }
+ if( bSetValue )
+ {
+ // nothing special to be done here for the properties
+ // UNO_NAME_DATA_BASE_NAME and UNO_NAME_DATA_BASE_URL.
+ // We just call PutValue (empty string is allowed).
+ // Thus the last property set will be used as Data Source.
+
+ USHORT nMId = GetFieldTypeMId( rPropertyName, *pType );
+ if( USHRT_MAX != nMId )
+ pType->PutValue( rValue, nMId );
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+ else if(!pType && m_pDoc &&
+ ( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME))) )
+ {
+ OUString uTmp;
+ rValue >>= uTmp;
+ String sTypeName(uTmp);
+ SwFieldType* pType2 = m_pDoc->GetFldType(nResTypeId, sTypeName, sal_False);
+
+ String sTable(SW_RES(STR_POOLCOLL_LABEL_TABLE));
+ String sDrawing(SW_RES(STR_POOLCOLL_LABEL_DRAWING));
+ String sFrame(SW_RES(STR_POOLCOLL_LABEL_FRAME));
+ String sIllustration(SW_RES(STR_POOLCOLL_LABEL_ABB));
+
+ if(pType2 ||
+ (RES_SETEXPFLD == nResTypeId &&
+ ( sTypeName == sTable || sTypeName == sDrawing ||
+ sTypeName == sFrame || sTypeName == sIllustration )))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ switch(nResTypeId)
+ {
+ case RES_USERFLD :
+ {
+ SwUserFieldType aType(m_pDoc, sTypeName);
+ pType2 = m_pDoc->InsertFldType(aType);
+ ((SwUserFieldType*)pType2)->SetContent(sParam1);
+ ((SwUserFieldType*)pType2)->SetValue(fParam1);
+ ((SwUserFieldType*)pType2)->SetType(bParam1 ? nsSwGetSetExpType::GSE_EXPR : nsSwGetSetExpType::GSE_STRING);
+ }
+ break;
+ case RES_DDEFLD :
+ {
+ SwDDEFieldType aType(sTypeName, sParam1,
+ sal::static_int_cast< USHORT >(bParam1 ? sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL));
+ pType2 = m_pDoc->InsertFldType(aType);
+ }
+ break;
+ case RES_SETEXPFLD :
+ {
+ SwSetExpFieldType aType(m_pDoc, sTypeName);
+ if(sParam1.Len())
+ aType.SetDelimiter( sParam1.GetChar(0));
+ if(nParam1 > -1 && nParam1 < MAXLEVEL)
+ aType.SetOutlineLvl(nParam1);
+ pType2 = m_pDoc->InsertFldType(aType);
+ }
+ break;
+ case RES_DBFLD :
+ {
+ ::GetString( rValue, sParam3 );
+ pType = GetFldType();
+ }
+ break;
+ }
+ if(pType2)
+ {
+ pType2->Add(this);
+ m_bIsDescriptor = sal_False;
+ }
+ else
+ throw uno::RuntimeException();
+ }
+
+ DBG_ASSERT(pType2, "kein FieldType gefunden!" );
+ }
+ else
+ {
+ switch( nResTypeId )
+ {
+ case RES_USERFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CONTENT)))
+ ::GetString( rValue, sParam1 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_VALUE )))
+ {
+ if(rValue.getValueType() != ::getCppuType(static_cast<const double*>(0)))
+ throw lang::IllegalArgumentException();
+ fParam1 = *(double*)rValue.getValue();
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_EXPRESSION )))
+ {
+ if(rValue.getValueType() != ::getBooleanCppuType())
+ throw lang::IllegalArgumentException();
+ bParam1 = *(sal_Bool*)rValue.getValue();
+ }
+
+ break;
+ case RES_DBFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)))
+ ::GetString( rValue, sParam1 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME)))
+ ::GetString( rValue, sParam2 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME)))
+ ::GetString( rValue, sParam3 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)))
+ rValue >>= nParam2;
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
+ ::GetString( rValue, sParam5 );
+
+ if((sParam1.Len() || sParam5.Len())
+ && sParam2.Len() && sParam3.Len())
+ GetFldType();
+ break;
+ case RES_SETEXPFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_SEPARATOR)))
+ ::GetString( rValue, sParam1 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAPTER_NUMBERING_LEVEL)))
+ rValue >>= nParam1;
+ break;
+ case RES_DDEFLD:
+ {
+ USHORT nPart = rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_TYPE)) ? 0 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_FILE)) ? 1 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_ELEMENT)) ? 2 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC_UPDATE)) ? 3 : USHRT_MAX;
+ if(nPart < 3 )
+ {
+ String sTmp;
+ if(!sParam1.Len())
+ (sParam1 = sfx2::cTokenSeperator)
+ += sfx2::cTokenSeperator;
+
+ sParam1.SetToken( nPart, sfx2::cTokenSeperator,
+ ::GetString( rValue, sTmp ));
+ }
+ else if(3 == nPart)
+ bParam1 = *(sal_Bool*)rValue.getValue();
+ }
+ break;
+ default:
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+}
+/* -----------------------------30.03.01 14:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwFieldType* SwXFieldMaster::GetFldType(sal_Bool bDontCreate) const
+{
+ if(!bDontCreate && RES_DBFLD == nResTypeId && m_bIsDescriptor && m_pDoc)
+ {
+ SwDBData aData;
+
+ // set DataSource
+ svx::ODataAccessDescriptor aAcc;
+ if( sParam1.Len() > 0 )
+ aAcc[ svx::daDataSource ] <<= OUString(sParam1); // DataBaseName
+ else if( sParam5.Len() > 0 )
+ aAcc[ svx::daDatabaseLocation] <<= OUString(sParam5); // DataBaseURL
+ aData.sDataSource = aAcc.getDataSource();
+
+ aData.sCommand = sParam2;
+ aData.nCommandType = nParam2;
+ SwDBFieldType aType(m_pDoc, sParam3, aData);
+ SwFieldType* pType = m_pDoc->InsertFldType(aType);
+ SwXFieldMaster* pThis = ((SwXFieldMaster*)this);
+ pType->Add(pThis);
+ pThis->m_bIsDescriptor = sal_False;
+ }
+ if(m_bIsDescriptor)
+ return 0;
+ else
+ return (SwFieldType*)GetRegisteredIn();
+}
+
+/*-- 14.12.98 11:08:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+typedef SwFmtFld* SwFmtFldPtr;
+SV_DECL_PTRARR(SwDependentFields, SwFmtFldPtr, 5, 5)
+SV_IMPL_PTRARR(SwDependentFields, SwFmtFldPtr)
+
+uno::Any SwXFieldMaster::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFieldType* pType = GetFldType(sal_True);
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_INSTANCE_NAME)) )
+ {
+ String sName;
+ if(pType)
+ SwXTextFieldMasters::getInstanceName(*pType, sName);
+ aRet <<= OUString(sName);
+ }
+ else if(pType)
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME) ))
+ {
+ aRet <<= SwXFieldMaster::GetProgrammaticName(*pType, *GetDoc());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEPENDENT_TEXT_FIELDS)) )
+ {
+ //fill all text fields into a sequence
+ SwClientIter aIter( *pType );
+ SwDependentFields aFldArr;
+ SwFmtFldPtr pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+ while(pFld)
+ {
+ if(pFld->IsFldInDoc())
+ aFldArr.Insert(pFld, aFldArr.Count());
+ pFld = (SwFmtFld*)aIter.Next();
+ }
+ uno::Sequence<uno::Reference <text::XDependentTextField> > aRetSeq(aFldArr.Count());
+ uno::Reference<text::XDependentTextField>* pRetSeq = aRetSeq.getArray();
+ for(USHORT i = 0; i < aFldArr.Count(); i++)
+ {
+ pFld = aFldArr.GetObject(i);
+ SwXTextField * pInsert = CreateSwXTextField(*GetDoc(), *pFld);
+
+ pRetSeq[i] = uno::Reference<text::XDependentTextField>(pInsert);
+ }
+ aRet <<= aRetSeq;
+ }
+ else if(pType)
+ {
+ //TODO: Properties fuer die uebrigen Feldtypen einbauen
+ USHORT nMId = GetFieldTypeMId( rPropertyName, *pType );
+ if( USHRT_MAX != nMId )
+ {
+ pType->QueryValue( aRet, nMId );
+
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) ||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
+ {
+ OUString aDataSource;
+ aRet >>= aDataSource;
+ aRet <<= OUString();
+
+ OUString *pStr = 0; // only one of this properties will return
+ // a non-empty string.
+ INetURLObject aObj;
+ aObj.SetURL( aDataSource );
+ BOOL bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ if (bIsURL && rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
+ pStr = &aDataSource; // DataBaseURL
+ else if (!bIsURL && rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)))
+ pStr = &aDataSource; // DataBaseName
+
+ if (pStr)
+ aRet <<= *pStr;
+ }
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)) )
+ aRet <<= nParam2;
+ }
+ }
+ else
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)) )
+ aRet <<= nParam2;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEPENDENT_TEXT_FIELDS)) )
+ {
+ uno::Sequence<uno::Reference <text::XDependentTextField> > aRetSeq(0);
+ aRet <<= aRetSeq;
+ }
+ else
+ {
+ const String* pStr = 0;
+ String sStr;
+ switch ( nResTypeId )
+ {
+ case RES_USERFLD:
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CONTENT)) )
+ pStr = &sParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_VALUE )))
+ aRet <<= fParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_EXPRESSION )))
+ aRet.setValue(&bParam1, ::getBooleanCppuType());
+ break;
+ case RES_DBFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) ||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
+ {
+ pStr = 0; // only one of this properties will return
+ // a non-empty string.
+ INetURLObject aObj;
+ aObj.SetURL( sParam5 ); // SetSmartURL
+ BOOL bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ if (bIsURL && rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
+ pStr = &sParam5; // DataBaseURL
+ else if ( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)))
+ pStr = &sParam1; // DataBaseName
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME)))
+ pStr = &sParam2;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME)))
+ pStr = &sParam3;
+ break;
+ case RES_SETEXPFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_SEPARATOR)))
+ pStr = &sParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAPTER_NUMBERING_LEVEL)))
+ aRet <<= nParam1;
+ break;
+ case RES_DDEFLD:
+ {
+ USHORT nPart = rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_TYPE)) ? 0 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_FILE)) ? 1 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_ELEMENT)) ? 2 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC_UPDATE)) ? 3 : USHRT_MAX;
+ if(nPart < 3 )
+ pStr = &(sStr = sParam1.GetToken(nPart, sfx2::cTokenSeperator));
+ else if(3 == nPart)
+ aRet.setValue(&bParam1, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ if( pStr )
+ aRet <<= OUString( *pStr );
+ }
+ }
+ return aRet;
+}
+/*-- 14.12.98 11:08:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:08:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:08:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:08:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/*-- 25.02.99 11:01:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFieldType* pFldType = GetFldType(sal_True);
+ if(pFldType)
+ {
+ sal_uInt16 nTypeIdx = USHRT_MAX;
+ const SwFldTypes* pTypes = GetDoc()->GetFldTypes();
+ for( sal_uInt16 i = 0; i < pTypes->Count(); i++ )
+ {
+ if((*pTypes)[i] == pFldType)
+ nTypeIdx = i;
+ }
+
+ // zuerst alle Felder loeschen
+ SwClientIter aIter( *pFldType );
+ SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+ while(pFld)
+ {
+ // Feld im Undo?
+ SwTxtFld *pTxtFld = pFld->GetTxtFld();
+ if(pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ {
+ SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode();
+ SwPaM aPam(rTxtNode, *pTxtFld->GetStart());
+ aPam.SetMark();
+ aPam.Move();
+ GetDoc()->DeleteAndJoin(aPam);
+ }
+ pFld = (SwFmtFld*)aIter.Next();
+ }
+ // dann den FieldType loeschen
+ GetDoc()->RemoveFldType(nTypeIdx);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 25.02.99 11:02:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 25.02.99 11:02:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+
+/*-- 14.12.98 11:08:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ aLstnrCntnr.Disposing();
+ m_pDoc = 0;
+ }
+}
+/* -----------------------------06.11.00 09:44--------------------------------
+
+const Programmatic2UIName_Impl* lcl_GetFieldNameTable()
+{
+ static BOOL bInitialized = FALSE;
+ static Programmatic2UIName_Impl aFieldNames[5];
+ if(!bInitialized)
+ {
+ bInitialized = TRUE;
+ int nName = 0;
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_ABB ));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_ABB));
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_TABLE ));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_TABLE));
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_FRAME));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_FRAME));
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_DRAWING ));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_DRAWING));
+ }
+ return &aFieldNames[0];
+}
+ ---------------------------------------------------------------------------*/
+/* -----------------------------06.11.00 10:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc)
+{
+ OUString sRet(rType.GetName());
+ if(RES_SETEXPFLD == rType.Which())
+ {
+ const SwFldTypes* pTypes = rDoc.GetFldTypes();
+ for( sal_uInt16 i = 0; i <= INIT_FLDTYPES; i++ )
+ {
+ if((*pTypes)[i] == &rType)
+ {
+ sRet = SwStyleNameMapper::GetProgName ( sRet, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ break;
+ }
+ }
+ }
+ return sRet;
+}
+/* -----------------------------06.11.00 14:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldMaster::LocalizeFormula(
+ const SwSetExpField& rFld,
+ const OUString& rFormula,
+ sal_Bool bQuery)
+{
+ const OUString sTypeName(rFld.GetTyp()->GetName());
+ OUString sProgName = SwStyleNameMapper::GetProgName(sTypeName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if(sProgName != sTypeName)
+ {
+ OUString sSource = bQuery ? sTypeName : sProgName;
+ OUString sDest = bQuery ? sProgName : sTypeName;
+ if(!rFormula.compareTo(sSource, sSource.getLength()))
+ {
+ OUString sTmpFormula = sDest;
+ sTmpFormula += rFormula.copy(sSource.getLength());
+ return sTmpFormula;
+ }
+ }
+ return rFormula;
+}
+
+
+SwXTextField * CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt)
+{
+ SwClientIter aIter(*rFmt.GetFld()->GetTyp());
+ SwXTextField * pField = 0;
+ SwXTextField * pTemp =
+ static_cast<SwXTextField*>(aIter.First( TYPE(SwXTextField) ));
+ while (pTemp)
+ {
+ if (pTemp->GetFldFmt() == &rFmt)
+ {
+ pField = pTemp;
+ break;
+ }
+ pTemp = static_cast<SwXTextField*>(aIter.Next());
+ }
+ return pField ? pField : new SwXTextField( rFmt, &rDoc );
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+struct SwFieldProperties_Impl
+{
+ String sPar1;
+ String sPar2;
+ String sPar3;
+ String sPar4;
+ String sPar5;
+ String sPar6;
+ Date aDate;
+ double fDouble;
+ uno::Sequence<beans::PropertyValue> aPropSeq;
+ uno::Sequence<OUString> aStrings;
+ util::DateTime* pDateTime;
+
+ sal_Int32 nSubType;
+ sal_Int32 nFormat;
+ sal_uInt16 nUSHORT1;
+ sal_uInt16 nUSHORT2;
+ sal_Int16 nSHORT1;
+ sal_Int8 nByte1;
+ sal_Bool bFormatIsDefault;
+ sal_Bool bBool1;
+ sal_Bool bBool2;
+ sal_Bool bBool3;
+ sal_Bool bBool4;
+
+ SwFieldProperties_Impl():
+ fDouble(0.),
+ pDateTime(0),
+ nSubType(0),
+ nFormat(0),
+ nUSHORT1(0),
+ nUSHORT2(0),
+ nSHORT1(0),
+ nByte1(0),
+ bFormatIsDefault(sal_True),
+ bBool1(sal_False),
+ bBool2(sal_False),
+ bBool3(sal_False),
+ bBool4(sal_True) //Automatic language
+ {}
+ ~SwFieldProperties_Impl()
+ {delete pDateTime;}
+
+};
+
+TYPEINIT1(SwXTextField, SwClient);
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextField::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextField::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/*-- 14.12.98 11:37:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+SwXTextField::SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc) :
+ aLstnrCntnr( (XTextContent*)this),
+ pFmtFld(0),
+ m_pDoc(pDoc),
+ m_pTextObject(0),
+ m_bIsDescriptor(nServiceId != USHRT_MAX),
+ m_bCallUpdate(sal_False),
+ m_nServiceId(nServiceId),
+ m_pProps(new SwFieldProperties_Impl)
+{
+ //Set visible as default!
+ if(SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId ||
+ SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM == nServiceId ||
+ SW_SERVICE_FIELDTYPE_DATABASE == nServiceId ||
+ SW_SERVICE_FIELDTYPE_DATABASE_NAME == nServiceId )
+ m_pProps->bBool2 = sal_True;
+ else if(SW_SERVICE_FIELDTYPE_TABLE_FORMULA == nServiceId)
+ m_pProps->bBool1 = sal_True;
+ if(SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId)
+ m_pProps->nUSHORT2 = USHRT_MAX;
+
+}
+/*-- 14.12.98 11:37:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextField::SwXTextField(const SwFmtFld& rFmt, SwDoc* pDc) :
+ aLstnrCntnr( (XTextContent*)this),
+ pFmtFld(&rFmt),
+ m_pDoc(pDc),
+ m_pTextObject(0),
+ m_bIsDescriptor(sal_False),
+ m_bCallUpdate(sal_False),
+ m_nServiceId( lcl_GetServiceForField( *pFmtFld->GetFld() ) ),
+ m_pProps(0)
+{
+ pDc->GetUnoCallBack()->Add(this);
+}
+/*-- 14.12.98 11:37:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextField::~SwXTextField()
+{
+ if ( m_pTextObject )
+ {
+ m_pTextObject->DisposeEditSource();
+ m_pTextObject->release();
+ }
+
+ delete m_pProps;
+}
+/*-- 14.12.98 11:37:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::attachTextFieldMaster(const uno::Reference< beans::XPropertySet > & xFieldMaster)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+ uno::Reference< lang::XUnoTunnel > xMasterTunnel(xFieldMaster, uno::UNO_QUERY);
+ if (!xMasterTunnel.is())
+ throw lang::IllegalArgumentException();
+ SwXFieldMaster* pMaster = reinterpret_cast< SwXFieldMaster * >(
+ sal::static_int_cast< sal_IntPtr >( xMasterTunnel->getSomething( SwXFieldMaster::getUnoTunnelId()) ));
+
+ SwFieldType* pFieldType = pMaster ? pMaster->GetFldType() : 0;
+ if(pFieldType && pFieldType->Which() == lcl_ServiceIdToResId(m_nServiceId))
+ {
+ m_sTypeName = pFieldType->GetName();
+ pFieldType->Add( &m_aFieldTypeClient );
+ }
+ else
+ throw lang::IllegalArgumentException();
+
+}
+/*-- 14.12.98 11:37:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySet > SwXTextField::getTextFieldMaster(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFieldType* pType = 0;
+ if( m_bIsDescriptor && m_aFieldTypeClient.GetRegisteredIn() )
+ {
+ pType = (SwFieldType*)m_aFieldTypeClient.GetRegisteredIn();
+ }
+ else
+ {
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ pType = pFmtFld->GetFld()->GetTyp();
+ }
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)
+ SwClientIter(*pType).First(TYPE(SwXFieldMaster));
+ if(!pMaster)
+ pMaster = new SwXFieldMaster(*pType, GetDoc());
+
+ return pMaster;
+}
+/*-- 14.12.98 11:37:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextField::getPresentation(sal_Bool bShowCommand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString sRet;
+ const SwField* pField = GetField();
+ if(pField)
+ sRet = pField->GetCntnt(bShowCommand);
+ else
+ throw uno::RuntimeException();
+ return sRet;
+}
+/* -----------------18.02.99 13:39-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextField::attachToRange(
+ const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = reinterpret_cast< SwXTextRange * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
+ pCursor = reinterpret_cast< OTextCursorHelper * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ //wurde ein FieldMaster attached, dann ist das Dokument schon festgelegt!
+ if(pDoc && (!m_pDoc || m_pDoc == pDoc))
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+ SwField* pFld = 0;
+ switch(m_nServiceId)
+ {
+ case SW_SERVICE_FIELDTYPE_ANNOTATION:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_POSTITFLD);
+
+ DateTime aDateTime;
+ if (m_pProps->pDateTime)
+ {
+ aDateTime.SetYear(m_pProps->pDateTime->Year);
+ aDateTime.SetMonth(m_pProps->pDateTime->Month);
+ aDateTime.SetDay(m_pProps->pDateTime->Day);
+ aDateTime.SetHour(m_pProps->pDateTime->Hours);
+ aDateTime.SetMin(m_pProps->pDateTime->Minutes);
+ aDateTime.SetSec(m_pProps->pDateTime->Seconds);
+ }
+ pFld = new SwPostItField((SwPostItFieldType*)pFldType,
+ m_pProps->sPar1, m_pProps->sPar2,aDateTime);
+ if ( m_pTextObject )
+ {
+ ((SwPostItField*)pFld)->SetTextObject( m_pTextObject->CreateText() );
+ ((SwPostItField*)pFld)->SetPar2(m_pTextObject->GetText());
+ }
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_SCRIPT:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_SCRIPTFLD);
+ pFld = new SwScriptField((SwScriptFieldType*)pFldType,
+ m_pProps->sPar1, m_pProps->sPar2,
+ m_pProps->bBool1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATETIME:
+ {
+ sal_uInt16 nSub = 0;
+ if(m_pProps->bBool1)
+ nSub |= FIXEDFLD;
+ if(m_pProps->bBool2)
+ nSub |= DATEFLD;
+ else
+ nSub |= TIMEFLD;
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DATETIMEFLD);
+ pFld = new SwDateTimeField((SwDateTimeFieldType*)pFldType,
+ nSub, m_pProps->nFormat);
+ if(m_pProps->fDouble > 0.)
+ ((SwDateTimeField*)pFld)->SetValue( m_pProps->fDouble );
+ if(m_pProps->pDateTime)
+ {
+ uno::Any aVal; aVal <<= *m_pProps->pDateTime;
+ pFld->PutValue( aVal, FIELD_PROP_DATE_TIME );
+ }
+ ((SwDateTimeField*)pFld)->SetOffset(m_pProps->nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_FILE_NAME:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_FILENAMEFLD);
+ sal_Int32 nFormat = m_pProps->nFormat;
+ if(m_pProps->bBool2)
+ nFormat |= FF_FIXED;
+ pFld = new SwFileNameField((SwFileNameFieldType*)pFldType, nFormat);
+ if(m_pProps->sPar3.Len())
+ ((SwFileNameField*)pFld)->SetExpansion(m_pProps->sPar3);
+ uno::Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
+ pFld->PutValue( aFormat, FIELD_PROP_FORMAT );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_TEMPLNAMEFLD);
+ pFld = new SwTemplNameField((SwTemplNameFieldType*)pFldType,
+ m_pProps->nFormat);
+ uno::Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
+ pFld->PutValue(aFormat, FIELD_PROP_FORMAT);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_CHAPTER:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_CHAPTERFLD);
+ pFld = new SwChapterField((SwChapterFieldType*)pFldType, m_pProps->nUSHORT1);
+ ((SwChapterField*)pFld)->SetLevel(m_pProps->nByte1);
+ uno::Any aVal; aVal <<= (sal_Int16)m_pProps->nUSHORT1;
+ pFld->PutValue(aVal, FIELD_PROP_USHORT1 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_AUTHOR:
+ {
+ long nFormat = m_pProps->bBool1 ? AF_NAME : AF_SHORTCUT;
+ if(m_pProps->bBool2)
+ nFormat |= AF_FIXED;
+
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_AUTHORFLD);
+ pFld = new SwAuthorField((SwAuthorFieldType*)pFldType, nFormat);
+ ((SwAuthorField*)pFld)->SetExpansion(m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENTXTFLD);
+ pFld = new SwHiddenTxtField(((SwHiddenTxtFieldType*)pFldType),
+ m_pProps->sPar1,
+ m_pProps->sPar2, m_pProps->sPar3,
+ static_cast< USHORT >(SW_SERVICE_FIELDTYPE_HIDDEN_TEXT == m_nServiceId ?
+ TYP_HIDDENTXTFLD : TYP_CONDTXTFLD));
+ ((SwHiddenTxtField*)pFld)->SetValue(m_pProps->bBool1);
+ uno::Any aVal; aVal <<= (OUString)m_pProps->sPar4;
+ pFld->PutValue(aVal, FIELD_PROP_PAR4 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENPARAFLD);
+ pFld = new SwHiddenParaField((SwHiddenParaFieldType*)pFldType,
+ m_pProps->sPar1);
+ ((SwHiddenParaField*)pFld)->SetHidden(m_pProps->bBool1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_GET_REFERENCE:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_GETREFFLD);
+ pFld = new SwGetRefField((SwGetRefFieldType*)pFldType,
+ m_pProps->sPar1,
+ 0,
+ 0,
+ 0);
+ if(m_pProps->sPar3.Len())
+ ((SwGetRefField*)pFld)->SetExpand(m_pProps->sPar3);
+ uno::Any aVal; aVal <<=(sal_Int16)m_pProps->nUSHORT1;
+ pFld->PutValue(aVal, FIELD_PROP_USHORT1 );
+ aVal <<=(sal_Int16)m_pProps->nUSHORT2;
+ pFld->PutValue(aVal, FIELD_PROP_USHORT2 );
+ aVal <<=(sal_Int16)m_pProps->nSHORT1;
+ pFld->PutValue(aVal, FIELD_PROP_SHORT1 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_JUMP_EDIT:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_JUMPEDITFLD);
+ pFld = new SwJumpEditField((SwJumpEditFieldType*)pFldType,
+ m_pProps->nUSHORT1, m_pProps->sPar2, m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION :
+ case SW_SERVICE_FIELDTYPE_DOC_INFO:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DOCINFOFLD);
+ sal_uInt16 nSubType = aDocInfoSubTypeFromService[
+ m_nServiceId - SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR];
+ if( SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME == m_nServiceId ||
+ SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME == m_nServiceId ||
+ SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME == m_nServiceId ||
+ SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME == m_nServiceId )
+ {
+ if(m_pProps->bBool2) //IsDate
+ {
+ nSubType &= 0xf0ff;
+ nSubType |= DI_SUB_DATE;
+ }
+ else
+ {
+ nSubType &= 0xf0ff;
+ nSubType |= DI_SUB_TIME;
+ }
+ }
+ if(m_pProps->bBool1)
+ nSubType |= DI_SUB_FIXED;
+ pFld = new SwDocInfoField((SwDocInfoFieldType*)pFldType, nSubType, m_pProps->sPar4, m_pProps->nFormat);
+ if(m_pProps->sPar3.Len())
+ ((SwDocInfoField*)pFld)->SetExpansion(m_pProps->sPar3);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_USER_EXT:
+ {
+ sal_Int32 nFormat = 0;
+ if(m_pProps->bBool1)
+ nFormat = AF_FIXED;
+
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_EXTUSERFLD);
+ pFld = new SwExtUserField((SwExtUserFieldType*)pFldType, m_pProps->nUSHORT1, nFormat);
+ ((SwExtUserField*)pFld)->SetExpansion(m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_USER:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_USERFLD, m_sTypeName, sal_True);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ USHORT nUserSubType = m_pProps->bBool1 ? nsSwExtendedSubType::SUB_INVISIBLE : 0;
+ if(m_pProps->bBool2)
+ nUserSubType |= nsSwExtendedSubType::SUB_CMD;
+ if(m_pProps->bFormatIsDefault &&
+ nsSwGetSetExpType::GSE_STRING == ((SwUserFieldType*)pFldType)->GetType())
+ m_pProps->nFormat = -1;
+ pFld = new SwUserField((SwUserFieldType*)pFldType,
+ nUserSubType,
+ m_pProps->nFormat);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_SET:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_REFPAGESETFLD);
+ pFld = new SwRefPageSetField( (SwRefPageSetFieldType*)pFldType,
+ m_pProps->nUSHORT1,
+ m_pProps->bBool1 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_GET:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_REFPAGEGETFLD);
+ pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)pFldType,
+ m_pProps->nUSHORT1 );
+ ((SwRefPageGetField*)pFld)->SetText(m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_PAGE_NUM:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_PAGENUMBERFLD);
+ pFld = new SwPageNumberField((SwPageNumberFieldType*)pFldType,
+ PG_RANDOM,
+ m_pProps->nFormat,
+ m_pProps->nUSHORT1);
+ ((SwPageNumberField*)pFld)->SetUserString(m_pProps->sPar1);
+ uno::Any aVal; aVal <<= m_pProps->nSubType;
+ pFld->PutValue( aVal, FIELD_PROP_SUBTYPE );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DDE:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_DDEFLD, m_sTypeName, sal_True);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ pFld = new SwDDEField( (SwDDEFieldType*)pFldType );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NAME:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DBNAMEFLD);
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ pFld = new SwDBNameField((SwDBNameFieldType*)pFldType, aData);
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
+ else
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ pFld->SetSubType(nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET:
+ {
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DBNEXTSETFLD);
+ pFld = new SwDBNextSetField((SwDBNextSetFieldType*)pFldType,
+ m_pProps->sPar3, aEmptyStr,
+ aData);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET:
+ {
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ pFld = new SwDBNumSetField( (SwDBNumSetFieldType*)
+ pDoc->GetSysFldType(RES_DBNUMSETFLD),
+ m_pProps->sPar3,
+ String::CreateFromInt32(m_pProps->nFormat),
+ aData );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM:
+ {
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ pFld = new SwDBSetNumberField((SwDBSetNumberFieldType*)
+ pDoc->GetSysFldType(RES_DBSETNUMBERFLD),
+ aData,
+ m_pProps->nUSHORT1);
+ ((SwDBSetNumberField*)pFld)->SetSetNumber(m_pProps->nFormat);
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
+ else
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ pFld->SetSubType(nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_DBFLD, m_sTypeName, sal_False);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ pFld = new SwDBField((SwDBFieldType*)pFldType, m_pProps->nFormat);
+ ((SwDBField*)pFld)->InitContent(m_pProps->sPar1);
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
+ else
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ pFld->SetSubType(nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_SET_EXP:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_SETEXPFLD, m_sTypeName, sal_True);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ //#93192# detect the field type's sub type and set an appropriate number format
+ if(m_pProps->bFormatIsDefault &&
+ nsSwGetSetExpType::GSE_STRING == ((SwSetExpFieldType*)pFldType)->GetType())
+ m_pProps->nFormat = -1;
+ pFld = new SwSetExpField((SwSetExpFieldType*)pFldType,
+ m_pProps->sPar2,
+ m_pProps->nUSHORT2 != USHRT_MAX ? //#i79471# the field can have a number format or a number_ing_ format
+ m_pProps->nUSHORT2 : m_pProps->nFormat);
+
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
+ else
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ if(m_pProps->bBool3)
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ else
+ nSubType &= ~nsSwExtendedSubType::SUB_CMD;
+ pFld->SetSubType(nSubType);
+ ((SwSetExpField*)pFld)->SetSeqNumber( m_pProps->nUSHORT1 );
+ ((SwSetExpField*)pFld)->SetInputFlag(m_pProps->bBool1);
+ ((SwSetExpField*)pFld)->SetPromptText(m_pProps->sPar3);
+ if(m_pProps->sPar4.Len())
+ ((SwSetExpField*)pFld)->ChgExpStr(m_pProps->sPar4);
+
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_GET_EXP:
+ {
+ sal_uInt16 nSubType;
+ switch(m_pProps->nSubType)
+ {
+ case text::SetVariableType::STRING: nSubType = nsSwGetSetExpType::GSE_STRING; break;
+ case text::SetVariableType::VAR: nSubType = nsSwGetSetExpType::GSE_EXPR; break;
+ //case text::SetVariableType::SEQUENCE: nSubType = nsSwGetSetExpType::GSE_SEQ; break;
+ case text::SetVariableType::FORMULA: nSubType = nsSwGetSetExpType::GSE_FORMULA; break;
+ default:
+ DBG_ERROR("wrong value");
+ nSubType = nsSwGetSetExpType::GSE_EXPR;
+ }
+ //make sure the SubType matches the field type
+ SwFieldType* pSetExpFld = pDoc->GetFldType(RES_SETEXPFLD, m_pProps->sPar1, sal_False);
+ bool bSetGetExpFieldUninitialized = false;
+ if( pSetExpFld )
+ {
+ if( nSubType != nsSwGetSetExpType::GSE_STRING &&
+ static_cast< SwSetExpFieldType* >(pSetExpFld)->GetType() == nsSwGetSetExpType::GSE_STRING )
+ nSubType = nsSwGetSetExpType::GSE_STRING;
+ }
+ else
+ bSetGetExpFieldUninitialized = true; // #i82544#
+
+ if(m_pProps->bBool2)
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ else
+ nSubType &= ~nsSwExtendedSubType::SUB_CMD;
+ pFld = new SwGetExpField((SwGetExpFieldType*)
+ pDoc->GetSysFldType(RES_GETEXPFLD),
+ m_pProps->sPar1, nSubType, m_pProps->nFormat);
+ //TODO: SubType auswerten!
+ if(m_pProps->sPar4.Len())
+ ((SwGetExpField*)pFld)->ChgExpStr(m_pProps->sPar4);
+ // #i82544#
+ if( bSetGetExpFieldUninitialized )
+ ((SwGetExpField*)pFld)->SetLateInitialization();
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_INPUT_USER:
+ case SW_SERVICE_FIELDTYPE_INPUT:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_INPUTFLD, m_sTypeName, sal_True);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ USHORT nInpSubType = sal::static_int_cast< USHORT >(SW_SERVICE_FIELDTYPE_INPUT_USER == m_nServiceId ? INP_USR : INP_TXT);
+ SwInputField * pTxtField =
+ new SwInputField((SwInputFieldType*)pFldType,
+ m_pProps->sPar1, m_pProps->sPar2,
+ nInpSubType);
+ pTxtField->SetHelp(m_pProps->sPar3);
+ pTxtField->SetToolTip(m_pProps->sPar4);
+
+ pFld = pTxtField;
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_MACRO:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_MACROFLD);
+ String aName;
+
+ // support for Scripting Framework macros
+ if (m_pProps->sPar4.Len() != 0)
+ {
+ aName = m_pProps->sPar4;
+ }
+ else
+ {
+ SwMacroField::CreateMacroString(
+ aName, m_pProps->sPar1, m_pProps->sPar3 );
+ }
+ pFld = new SwMacroField((SwMacroFieldType*)pFldType, aName,
+ m_pProps->sPar2);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_PAGE_COUNT :
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT :
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT :
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT :
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT :
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT :
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT :
+ {
+ sal_uInt16 nSubType = DS_PAGE;
+ switch(m_nServiceId)
+ {
+// case SW_SERVICE_FIELDTYPE_PAGE_COUNT : break;
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT : nSubType = DS_PARA;break;
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT : nSubType = DS_WORD;break;
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT : nSubType = DS_CHAR;break;
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT : nSubType = DS_TBL;break;
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT : nSubType = DS_GRF;break;
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT : nSubType = DS_OLE;break;
+ }
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DOCSTATFLD);
+ pFld = new SwDocStatField((SwDocStatFieldType*)pFldType, nSubType, m_pProps->nUSHORT2);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY:
+ pFld = new SwAuthorityField( (SwAuthorityFieldType*)
+ pDoc->InsertFldType(SwAuthorityFieldType(pDoc)),
+ aEmptyStr );
+ if(m_pProps->aPropSeq.getLength())
+ {
+ uno::Any aVal; aVal <<= m_pProps->aPropSeq;
+ pFld->PutValue( aVal, FIELD_PROP_PROP_SEQ );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS:
+ // create field
+ pFld = new SwCombinedCharField( (SwCombinedCharFieldType*)
+ pDoc->GetSysFldType(RES_COMBINED_CHARS),
+ m_pProps->sPar1);
+ break;
+ case SW_SERVICE_FIELDTYPE_DROPDOWN:
+ pFld = new SwDropDownField
+ ((SwDropDownFieldType *)
+ pDoc->GetSysFldType(RES_DROPDOWN));
+
+ ((SwDropDownField *) pFld)->SetItems(m_pProps->aStrings);
+ ((SwDropDownField *) pFld)->SetSelectedItem(m_pProps->sPar1);
+ ((SwDropDownField *) pFld)->SetName(m_pProps->sPar2);
+ ((SwDropDownField *) pFld)->SetHelp(m_pProps->sPar3);
+ ((SwDropDownField *) pFld)->SetToolTip(m_pProps->sPar4);
+ break;
+
+ case SW_SERVICE_FIELDTYPE_TABLE_FORMULA :
+ {
+
+ // create field
+ USHORT nType = nsSwGetSetExpType::GSE_FORMULA;
+ if(m_pProps->bBool1)
+ {
+ nType |= nsSwExtendedSubType::SUB_CMD;
+ if(m_pProps->bFormatIsDefault)
+ m_pProps->nFormat = -1;
+ }
+ pFld = new SwTblField( (SwTblFieldType*)
+ pDoc->GetSysFldType(RES_TABLEFLD),
+ m_pProps->sPar2,
+ nType,
+ m_pProps->nFormat);
+ ((SwTblField*)pFld)->ChgExpStr(m_pProps->sPar1);
+ }
+ break;
+ default: DBG_ERROR("was ist das fuer ein Typ?");
+ }
+ if(pFld)
+ {
+ pFld->SetAutomaticLanguage(!m_pProps->bBool4);
+ SwFmtFld aFmt( *pFld );
+
+ UnoActionContext aCont(pDoc);
+ SwTxtAttr* pTxtAttr = 0;
+ if(aPam.HasMark())
+ pDoc->DeleteAndJoin(aPam);
+
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints( (pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ : nsSetAttrMode::SETATTR_DEFAULT;
+
+ pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
+
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FIELD);
+
+ // was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
+ if(pTxtAttr)
+ {
+ const SwFmtFld& rFld = pTxtAttr->GetFld();
+ pFmtFld = &rFld;
+ }
+ }
+ delete pFld;
+
+ m_pDoc = pDoc;
+ m_pDoc->GetUnoCallBack()->Add(this);
+ m_bIsDescriptor = sal_False;
+ if(m_aFieldTypeClient.GetRegisteredIn())
+ const_cast<SwModify*>(m_aFieldTypeClient.GetRegisteredIn())->Remove(&m_aFieldTypeClient);
+ DELETEZ(m_pProps);
+ if(m_bCallUpdate)
+ update();
+ }
+ else
+ throw lang::IllegalArgumentException();
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ attachToRange( xTextRange );
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextField::getAnchor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > aRef;
+ SwField* pField = (SwField*)GetField();
+ if(pField)
+ {
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if(!pTxtFld)
+ throw uno::RuntimeException();
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+
+ SwPaM aPam(rTxtNode, *pTxtFld->GetStart() + 1, rTxtNode, *pTxtFld->GetStart());
+
+ aRef = SwXTextRange::CreateXTextRange(
+ *m_pDoc, *aPam.GetPoint(), aPam.GetMark());
+ }
+ return aRef;
+
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwField* pField = (SwField*)GetField();
+ if(pField)
+ {
+ UnoActionContext aContext(GetDoc());
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode();
+ SwPaM aPam(rTxtNode, *pTxtFld->GetStart());
+ aPam.SetMark();
+ aPam.Move();
+ GetDoc()->DeleteAndJoin(aPam);
+ }
+
+ if ( m_pTextObject )
+ {
+ m_pTextObject->DisposeEditSource();
+ m_pTextObject->release();
+ m_pTextObject = 0;
+ }
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/*-- 14.12.98 11:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextField::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ //kein static
+ uno::Reference< beans::XPropertySetInfo > aRef;
+ if(m_nServiceId != USHRT_MAX)
+ {
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(
+ lcl_GetPropertyMapOfService( m_nServiceId ));
+ uno::Reference< beans::XPropertySetInfo > xInfo = pPropSet->getPropertySetInfo();
+ // extend PropertySetInfo!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ aRef = new SfxExtItemPropertySetInfo(
+ aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
+ aPropSeq );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 14.12.98 11:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwField* pField = (SwField*)GetField();
+ const SfxItemPropertySet* _pPropSet = aSwMapProvider.GetPropertySet(
+ lcl_GetPropertyMapOfService( m_nServiceId));
+ const SfxItemPropertySimpleEntry* pEntry = _pPropSet->getPropertyMap()->getByName(rPropertyName);
+
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pField)
+ {
+ // Sonderbehandlung Serienbrieffeld
+ sal_uInt16 nWhich = pField->Which();
+ if( RES_DBFLD == nWhich &&
+ (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) ||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL))||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME))||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME))))
+ {
+ // hier muss ein neuer Feldtyp angelegt werden und
+ // das Feld an den neuen Typ umgehaengt werden
+ DBG_WARNING("not implemented");
+ }
+ else
+ {
+ // -> #111840#
+ SwDoc * pDoc = GetDoc();
+
+ if (NULL != pDoc)
+ {
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if(!pTxtFld)
+ throw uno::RuntimeException();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ pDoc->PutValueToField( aPosition, rValue, pEntry->nWID);
+ }
+ // <- #111840#
+ }
+ pField->PutValue( rValue, pEntry->nWID );
+
+ //#i100374# notify SwPostIt about new field content
+ if (RES_POSTITFLD== nWhich && pFmtFld)
+ {
+ const_cast<SwFmtFld*>(pFmtFld)->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED ));
+ }
+
+ //#114571# changes of the expanded string have to be notified
+ //#to the SwTxtFld
+ if(RES_DBFLD == nWhich && pFmtFld->GetTxtFld())
+ {
+ pFmtFld->GetTxtFld()->Expand();
+ }
+
+ //#i100374# changing a document field should set the modify flag
+ SwDoc* pDoc = GetDoc();
+ if (pDoc)
+ pDoc->SetModified();
+
+ }
+ else if(m_pProps)
+ {
+ String* pStr = 0;
+ BOOL* pBool = 0;
+ switch(pEntry->nWID)
+ {
+ case FIELD_PROP_PAR1:
+ pStr = &m_pProps->sPar1;
+ break;
+ case FIELD_PROP_PAR2:
+ pStr = &m_pProps->sPar2;
+ break;
+ case FIELD_PROP_PAR3:
+ pStr = &m_pProps->sPar3;
+ break;
+ case FIELD_PROP_PAR4:
+ pStr = &m_pProps->sPar4;
+ break;
+ case FIELD_PROP_FORMAT:
+ rValue >>= m_pProps->nFormat;
+ m_pProps->bFormatIsDefault = sal_False;
+ break;
+ case FIELD_PROP_SUBTYPE:
+ m_pProps->nSubType = SWUnoHelper::GetEnumAsInt32( rValue );
+ break;
+ case FIELD_PROP_BYTE1 :
+ rValue >>= m_pProps->nByte1;
+ break;
+ case FIELD_PROP_BOOL1 :
+ pBool = &m_pProps->bBool1;
+ break;
+ case FIELD_PROP_BOOL2 :
+ pBool = &m_pProps->bBool2;
+ break;
+ case FIELD_PROP_BOOL3 :
+ pBool = &m_pProps->bBool3;
+ break;
+ case FIELD_PROP_BOOL4:
+ pBool = &m_pProps->bBool4;
+ break;
+ case FIELD_PROP_DATE :
+ {
+ if(rValue.getValueType() != ::getCppuType(static_cast<const util::Date*>(0)))
+ throw lang::IllegalArgumentException();
+
+ util::Date aTemp = *(const util::Date*)rValue.getValue();
+ m_pProps->aDate = Date(aTemp.Day, aTemp.Month, aTemp.Year);
+ }
+ break;
+ case FIELD_PROP_USHORT1:
+ case FIELD_PROP_USHORT2:
+ {
+ sal_Int16 nVal = 0;
+ rValue >>= nVal;
+ if( FIELD_PROP_USHORT1 == pEntry->nWID)
+ m_pProps->nUSHORT1 = nVal;
+ else
+ m_pProps->nUSHORT2 = nVal;
+ }
+ break;
+ case FIELD_PROP_SHORT1:
+ rValue >>= m_pProps->nSHORT1;
+ break;
+ case FIELD_PROP_DOUBLE:
+ if(rValue.getValueType() != ::getCppuType(static_cast<const double*>(0)))
+ throw lang::IllegalArgumentException();
+ m_pProps->fDouble = *(double*)rValue.getValue();
+ break;
+
+ case FIELD_PROP_DATE_TIME :
+ if(!m_pProps->pDateTime)
+ m_pProps->pDateTime = new util::DateTime;
+ rValue >>= (*m_pProps->pDateTime);
+ break;
+ case FIELD_PROP_PROP_SEQ:
+ rValue >>= m_pProps->aPropSeq;
+ break;
+ case FIELD_PROP_STRINGS:
+ rValue >>= m_pProps->aStrings;
+ break;
+ }
+ if( pStr )
+ ::GetString( rValue, *pStr );
+ else if( pBool )
+ {
+ if( rValue.getValueType() == getCppuBooleanType() )
+ *pBool = *(sal_Bool*)rValue.getValue();
+ else
+ throw lang::IllegalArgumentException();
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 14.12.98 11:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextField::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ const SwField* pField = GetField();
+ const SfxItemPropertySet* _pPropSet = aSwMapProvider.GetPropertySet(
+ lcl_GetPropertyMapOfService( m_nServiceId));
+ const SfxItemPropertySimpleEntry* pEntry = _pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(!pEntry )
+ {
+ const SfxItemPropertySet* _pParaPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH_EXTENSIONS);
+ pEntry = _pParaPropSet->getPropertyMap()->getByName(rPropertyName);
+ }
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch( pEntry->nWID )
+ {
+ case FN_UNO_TEXT_WRAP:
+ aRet <<= text::WrapTextMode_NONE;
+ break;
+ case FN_UNO_ANCHOR_TYPE:
+ aRet <<= text::TextContentAnchorType_AS_CHARACTER;
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ {
+ uno::Sequence<text::TextContentAnchorType> aTypes(1);
+ text::TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = text::TextContentAnchorType_AS_CHARACTER;
+ aRet.setValue(&aTypes, ::getCppuType(static_cast<uno::Sequence<text::TextContentAnchorType>*>(0)));
+ }
+ break;
+
+ default:
+ if( pField )
+ {
+ if (FIELD_PROP_IS_FIELD_USED == pEntry->nWID ||
+ FIELD_PROP_IS_FIELD_DISPLAYED == pEntry->nWID)
+ {
+ sal_Bool bIsFieldUsed = sal_False;
+ sal_Bool bIsFieldDisplayed = sal_False;
+
+ // in order to have the information about fields
+ // correctly evaluated the document needs a layout
+ // (has to be already formatted)
+ SwDoc *pDoc = GetDoc();
+ ViewShell *pViewShell = 0;
+ SwEditShell *pEditShell = pDoc ? pDoc->GetEditShell( &pViewShell ) : 0;
+ if (pEditShell)
+ pEditShell->CalcLayout();
+ else if (pViewShell) // a page preview has no SwEditShell it should only have a view shell
+ pViewShell->CalcLayout();
+ else
+ throw uno::RuntimeException();
+
+ // get text node for the text field
+ const SwFmtFld *pFldFmt = GetFldFmt();
+ const SwTxtFld* pTxtFld = pFldFmt ? pFmtFld->GetTxtFld() : 0;
+ if(!pTxtFld)
+ throw uno::RuntimeException();
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+
+ // skip fields that are currently not in the document
+ // e.g. fields in undo or redo array
+ if (rTxtNode.GetNodes().IsDocNodes())
+ {
+ sal_Bool bFrame = 0 != rTxtNode.FindLayoutRect().Width(); // oder so
+ sal_Bool bHidden = rTxtNode.IsHidden();
+ if ( !bHidden )
+ {
+ xub_StrLen nHiddenStart;
+ xub_StrLen nHiddenEnd;
+
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+
+ bHidden = SwScriptInfo::GetBoundsOfHiddenRange( pTxtFld->GetTxtNode(),
+ *pTxtFld->GetStart(),
+ nHiddenStart, nHiddenEnd );
+ }
+
+ // !bFrame && !bHidden: aller Wahrscheinlichkeit handelt es
+ // sich um ein Feld in einem unbenutzten Seitenstyle
+ //
+ // bHidden: Feld ist versteckt
+ // FME: Problem: Verstecktes Feld in unbenutzter Seitenvorlage =>
+ // bIsFieldUsed = true
+ // bIsFieldDisplayed = false
+ bIsFieldUsed = bFrame || bHidden;
+ bIsFieldDisplayed = bIsFieldUsed && !bHidden;
+ }
+ sal_Bool bRetVal = (FIELD_PROP_IS_FIELD_USED == pEntry->nWID) ?
+ bIsFieldUsed : bIsFieldDisplayed;
+ aRet.setValue( &bRetVal, ::getCppuBooleanType() );
+ }
+ else
+ pField->QueryValue( aRet, pEntry->nWID );
+ }
+ else if( m_pProps ) // currently just a descriptor...
+ {
+ switch(pEntry->nWID)
+ {
+ case FIELD_PROP_TEXT:
+ {
+ if (!m_pTextObject)
+ {
+ SwTextAPIEditSource* pObj = new SwTextAPIEditSource( m_pDoc );
+ m_pTextObject = new SwTextAPIObject( pObj );
+ m_pTextObject->acquire();
+ }
+
+ uno::Reference < text::XText > xText( m_pTextObject );
+ aRet <<= xText;
+ break;
+ }
+ case FIELD_PROP_PAR1:
+ aRet <<= OUString(m_pProps->sPar1);
+ break;
+ case FIELD_PROP_PAR2:
+ aRet <<= OUString(m_pProps->sPar2);
+ break;
+ case FIELD_PROP_PAR3:
+ aRet <<= OUString(m_pProps->sPar3);
+ break;
+ case FIELD_PROP_PAR4:
+ aRet <<= OUString(m_pProps->sPar4);
+ break;
+ case FIELD_PROP_FORMAT:
+ aRet <<= m_pProps->nFormat;
+ break;
+ case FIELD_PROP_SUBTYPE:
+ aRet <<= m_pProps->nSubType;
+ break;
+ case FIELD_PROP_BYTE1 :
+ aRet <<= m_pProps->nByte1;
+ break;
+ case FIELD_PROP_BOOL1 :
+ aRet.setValue(&m_pProps->bBool1, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_BOOL2 :
+ aRet.setValue(&m_pProps->bBool2, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_BOOL3 :
+ aRet.setValue(&m_pProps->bBool3, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_BOOL4 :
+ aRet.setValue(&m_pProps->bBool4, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_DATE :
+ aRet.setValue(&m_pProps->aDate, ::getCppuType(static_cast<const util::Date*>(0)));
+ break;
+ case FIELD_PROP_USHORT1:
+ aRet <<= (sal_Int16)m_pProps->nUSHORT1;
+ break;
+ case FIELD_PROP_USHORT2:
+ aRet <<= (sal_Int16)m_pProps->nUSHORT2;
+ break;
+ case FIELD_PROP_SHORT1:
+ aRet <<= m_pProps->nSHORT1;
+ break;
+ case FIELD_PROP_DOUBLE:
+ aRet <<= m_pProps->fDouble;
+ break;
+ case FIELD_PROP_DATE_TIME :
+ if(m_pProps->pDateTime)
+ aRet <<= (*m_pProps->pDateTime);
+ break;
+ case FIELD_PROP_PROP_SEQ:
+ aRet <<= m_pProps->aPropSeq;
+ break;
+ case FIELD_PROP_STRINGS:
+ aRet <<= m_pProps->aStrings;
+ break;
+ case FIELD_PROP_IS_FIELD_USED:
+ case FIELD_PROP_IS_FIELD_DISPLAYED:
+ aRet.setValue( sal_False, ::getCppuBooleanType() );
+ break;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/* -----------------------------23.03.01 13:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextField::update( ) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const SwField* pFld = GetField();
+ if(pFld)
+ {
+ switch(pFld->Which())
+ {
+ case RES_DATETIMEFLD:
+ ((SwDateTimeField*)pFld)->SetDateTime( ::DateTime() );
+ break;
+
+ case RES_EXTUSERFLD:
+ {
+ SwExtUserField* pExtUserFld = (SwExtUserField*)pFld;
+ pExtUserFld->SetExpansion( ((SwExtUserFieldType*)pFld->GetTyp())->Expand(
+ pExtUserFld->GetSubType(),
+ pExtUserFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_AUTHORFLD:
+ {
+ SwAuthorField* pAuthorFld = (SwAuthorField*)pFld;
+ pAuthorFld->SetExpansion( ((SwAuthorFieldType*)pFld->GetTyp())->Expand(
+ pAuthorFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_FILENAMEFLD:
+ {
+ SwFileNameField* pFileNameFld = (SwFileNameField*)pFld;
+ pFileNameFld->SetExpansion( ((SwFileNameFieldType*)pFld->GetTyp())->Expand(
+ pFileNameFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_DOCINFOFLD:
+ {
+ SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFld;
+ pDocInfFld->SetExpansion( ((SwDocInfoFieldType*)pFld->GetTyp())->Expand(
+ pDocInfFld->GetSubType(),
+ pDocInfFld->GetFormat(),
+ pDocInfFld->GetLanguage(),
+ pDocInfFld->GetName() ) );
+ }
+ break;
+ }
+ // --> FME 2004-10-06 #116480#
+ // Text formatting has to be triggered.
+ const_cast<SwFmtFld*>(pFmtFld)->Modify( 0, 0 );
+ // <--
+ }
+ else
+ m_bCallUpdate = sal_True;
+}
+/* -----------------19.03.99 14:11-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextField::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextField");
+}
+/* -----------------19.03.99 14:11-------------------
+ *
+ * --------------------------------------------------*/
+
+static OUString OldNameToNewName_Impl( const OUString &rOld )
+{
+ static OUString aOldNamePart1( OUString::createFromAscii(".TextField.DocInfo.") );
+ static OUString aOldNamePart2( OUString::createFromAscii(".TextField.") );
+ static OUString aNewNamePart1( OUString::createFromAscii(".textfield.docinfo.") );
+ static OUString aNewNamePart2( OUString::createFromAscii(".textfield.") );
+ OUString sServiceNameCC( rOld );
+ sal_Int32 nIdx = sServiceNameCC.indexOf( aOldNamePart1 );
+ if (nIdx >= 0)
+ sServiceNameCC = sServiceNameCC.replaceAt( nIdx, aOldNamePart1.getLength(), aNewNamePart1 );
+ nIdx = sServiceNameCC.indexOf( aOldNamePart2 );
+ if (nIdx >= 0)
+ sServiceNameCC = sServiceNameCC.replaceAt( nIdx, aOldNamePart2.getLength(), aNewNamePart2 );
+ return sServiceNameCC;
+}
+
+sal_Bool SwXTextField::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ OUString sServiceName = SwXServiceProvider::GetProviderName(m_nServiceId);
+
+ // case-corected version of service-name (see #i67811)
+ // (need to supply both because of compatibility to older versions)
+ OUString sServiceNameCC( OldNameToNewName_Impl( sServiceName ) );
+
+ return sServiceName == rServiceName || sServiceNameCC == rServiceName ||
+ rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextContent"));
+}
+/* -----------------19.03.99 14:11-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextField::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ OUString sServiceName = SwXServiceProvider::GetProviderName(m_nServiceId);
+
+ // case-corected version of service-name (see #i67811)
+ // (need to supply both because of compatibility to older versions)
+ OUString sServiceNameCC( OldNameToNewName_Impl( sServiceName ) );
+ sal_Int32 nLen = sServiceName == sServiceNameCC ? 2 : 3;
+
+ uno::Sequence< OUString > aRet( nLen );
+ OUString* pArray = aRet.getArray();
+ *pArray++ = sServiceName;
+ if (nLen == 3)
+ *pArray++ = sServiceNameCC;
+ *pArray++ = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+void SwXTextField::Invalidate()
+{
+ if (GetRegisteredIn())
+ {
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ aLstnrCntnr.Disposing();
+ pFmtFld = 0;
+ m_pDoc = 0;
+ }
+}
+
+/* -----------------14.12.98 12:00-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextField::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ Invalidate();
+ break;
+ case RES_FIELD_DELETED:
+ if( (void*)pFmtFld == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ }
+}
+/*-- 14.12.98 11:37:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwField* SwXTextField::GetField() const
+{
+ if(GetRegisteredIn() && pFmtFld)
+ return pFmtFld->GetFld();
+ return 0;
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/******************************************************************
+ * SwXTextFieldMasters
+ ******************************************************************/
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextFieldMasters::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextFieldMasters");
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextFieldMasters::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.TextFieldMasters" ));
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextFieldMasters::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFieldMasters");
+ return aRet;
+}
+/*-- 21.12.98 10:37:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldMasters::SwXTextFieldMasters(SwDoc* _pDoc) :
+ SwUnoCollection(_pDoc)
+{
+}
+/*-- 21.12.98 10:37:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldMasters::~SwXTextFieldMasters()
+{
+
+}
+/*-- 21.12.98 10:37:33---------------------------------------------------
+ Iteration ueber nicht-Standard Feldtypen
+ USER/SETEXP/DDE/DATABASE
+ Der Name ist demnach:
+ "com.sun.star.text.fieldmaster.User" + <Feltypname>
+ "com.sun.star.text.fieldmaster.DDE" + <Feltypname>
+ "com.sun.star.text.fieldmaster.SetExpression" + <Feltypname>
+ "com.sun.star.text.fieldmaster.DataBase" + <Feltypname>
+
+ Falls wir grosszuegig werden wollen, dann koennte man com.sun.star.text
+ auch optional weglassen
+ -----------------------------------------------------------------------*/
+
+sal_uInt16 lcl_GetIdByName( String& rName, String& rTypeName )
+{
+ if( rName.EqualsAscii( COM_TEXT_FLDMASTER, 0, RTL_CONSTASCII_LENGTH(COM_TEXT_FLDMASTER ))
+ || rName.EqualsAscii( COM_TEXT_FLDMASTER_CC, 0, RTL_CONSTASCII_LENGTH(COM_TEXT_FLDMASTER_CC )))
+ rName.Erase(0, 30);
+
+ sal_uInt16 nResId = USHRT_MAX;
+ xub_StrLen nFound = 0;
+ rTypeName = rName.GetToken( 0, '.', nFound );
+ if(rTypeName.EqualsAscii("User"))
+ nResId = RES_USERFLD;
+ else if(rTypeName.EqualsAscii("DDE"))
+ nResId = RES_DDEFLD;
+ else if(rTypeName.EqualsAscii("SetExpression"))
+ {
+ nResId = RES_SETEXPFLD;
+
+ String sFldTypName( rName.GetToken( 1, '.' ));
+ String sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFldTypName ) );
+
+ if( sUIName != sFldTypName )
+ rName.SetToken( 1, '.', sUIName );
+ }
+ else if(rTypeName.EqualsAscii("DataBase"))
+ {
+ rName.Erase( 0, RTL_CONSTASCII_LENGTH( "DataBase." ));
+ USHORT nDotCount = rName.GetTokenCount('.');
+ if( 2 <= nDotCount )
+ {
+ // #i51815#
+ //rName.SearchAndReplace('.', DB_DELIM);
+ //rName.SetChar( rName.SearchBackward( '.' ), DB_DELIM );
+
+ rName.InsertAscii( "DataBase.", 0 );
+ nResId = RES_DBFLD;
+ }
+ }
+ else if( rTypeName.EqualsAscii("Bibliography"))
+ nResId = RES_AUTHORITY;
+ return nResId;
+}
+
+//-----------------------------------------------------------------------------
+uno::Any SwXTextFieldMasters::getByName(const OUString& rName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ String sName(rName), sTypeName;
+ sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
+ if( USHRT_MAX == nResId )
+ throw container::NoSuchElementException();
+
+ sName.Erase(0, sTypeName.Len()+1);
+ SwFieldType* pType = GetDoc()->GetFldType(nResId, sName, sal_True);
+ if(!pType)
+ throw container::NoSuchElementException();
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)
+ SwClientIter(*pType).First(TYPE(SwXFieldMaster));
+ if(!pMaster)
+ pMaster = new SwXFieldMaster(*pType, GetDoc());
+ uno::Reference< beans::XPropertySet > aRef = pMaster;
+ uno::Any aRet(&aRef, ::getCppuType( static_cast<const uno::Reference<beans::XPropertySet>* >(0)));
+ return aRet;
+}
+/*-- 06.03.2001 11:29:34,5-------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldMasters::getInstanceName(
+ const SwFieldType& rFldType, String& rName)
+{
+ sal_Bool bRet = sal_True;
+ switch( rFldType.Which() )
+ {
+ case RES_USERFLD:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER_CC ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "User."));
+ rName += rFldType.GetName();
+ break;
+ case RES_DDEFLD:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER_CC ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "DDE."));
+ rName += rFldType.GetName();
+ break;
+
+ case RES_SETEXPFLD:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER_CC ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "SetExpression."));
+ rName += String( SwStyleNameMapper::GetSpecialExtraProgName( rFldType.GetName() ) );
+ break;
+
+ case RES_DBFLD:
+ {
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER_CC ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "DataBase."));
+ String sDBName(rFldType.GetName());
+ sDBName.SearchAndReplaceAll(DB_DELIM, '.');
+ rName += sDBName;
+ }
+ break;
+
+ case RES_AUTHORITY:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER_CC ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "Bibliography"));
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+
+/*-- 21.12.98 10:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
+ sal_uInt16 nCount = pFldTypes->Count();
+
+ SvStrings aFldNames;
+ String* pString = new String();
+ sal_uInt16 i;
+
+ for( i = 0; i < nCount; i++)
+ {
+ SwFieldType& rFldType = *((*pFldTypes)[i]);
+
+ if (SwXTextFieldMasters::getInstanceName(rFldType, *pString))
+ {
+ aFldNames.Insert(pString, aFldNames.Count());
+ pString = new String();
+ }
+ }
+ delete pString;
+
+ uno::Sequence< OUString > aSeq(aFldNames.Count());
+ OUString* pArray = aSeq.getArray();
+ for(i = 0; i < aFldNames.Count();i++)
+ {
+ pArray[i] = *aFldNames.GetObject(i);
+ }
+ aFldNames.DeleteAndDestroy(0, aFldNames.Count());
+
+ return aSeq;
+
+}
+/*-- 21.12.98 10:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ String sName(rName), sTypeName;
+ sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
+ sal_Bool bRet = sal_False;
+ if( USHRT_MAX != nResId )
+ {
+ sName.Erase(0, sTypeName.Len()+1);
+ bRet = USHRT_MAX != nResId && 0 != GetDoc()->GetFldType(nResId, sName, sal_True);
+ }
+ return bRet;
+}
+/*-- 21.12.98 10:37:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXTextFieldMasters::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType(static_cast<const uno::Reference<beans::XPropertySet>*>(0));
+
+}
+/*-- 21.12.98 10:37:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldMasters::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return sal_True;
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------06.04.00 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextFieldTypes::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextFieldTypes");
+}
+/* -----------------------------06.04.00 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextFieldTypes::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.TextFields" ));
+}
+/* -----------------------------06.04.00 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextFieldTypes::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFields");
+ return aRet;
+}
+/*-- 21.12.98 10:35:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldTypes::SwXTextFieldTypes(SwDoc* _pDoc) :
+ SwUnoCollection (_pDoc),
+ aRefreshCont ( static_cast< XEnumerationAccess * >(this) )
+{
+}
+/*-- 21.12.98 10:35:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldTypes::~SwXTextFieldTypes()
+{
+}
+/*-- 11.07.02 14:25:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextFieldTypes::Invalidate()
+{
+ SwUnoCollection::Invalidate();
+ aRefreshCont.Disposing();
+}
+/*-- 21.12.98 10:35:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXTextFieldTypes::createEnumeration(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return new SwXFieldEnumeration(GetDoc());
+}
+
+/*-- 21.12.98 10:35:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXTextFieldTypes::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType(static_cast<const uno::Reference<text::XDependentTextField>*>(0));
+}
+/*-- 21.12.98 10:35:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldTypes::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ //es gibt sie immer
+ return sal_True;
+}
+/* -----------------24.02.99 16:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextFieldTypes::refresh(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ UnoActionContext aContext(GetDoc());
+ SwDocStat aDocStat;
+ GetDoc()->UpdateDocStat(aDocStat);
+ GetDoc()->UpdateFlds(0, sal_False);
+
+ // call refresh listeners
+ aRefreshCont.Refreshed();
+}
+/* -----------------24.02.99 16:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextFieldTypes::addRefreshListener(const uno::Reference< util::XRefreshListener > & l)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if ( !IsValid() )
+ throw uno::RuntimeException();
+ aRefreshCont.AddListener ( reinterpret_cast < const uno::Reference < lang::XEventListener > &> ( l ));
+}
+/* -----------------24.02.99 16:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextFieldTypes::removeRefreshListener(const uno::Reference< util::XRefreshListener > & l)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if ( !IsValid() || !aRefreshCont.RemoveListener ( reinterpret_cast < const uno::Reference < lang::XEventListener > &> ( l ) ) )
+ throw uno::RuntimeException();
+}
+/******************************************************************
+ * SwXFieldEnumeration
+ ******************************************************************/
+/* -----------------------------06.04.00 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldEnumeration::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXFieldEnumeration");
+}
+/* -----------------------------06.04.00 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFieldEnumeration::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.FieldEnumeration" ));
+}
+/* -----------------------------06.04.00 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXFieldEnumeration::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.FieldEnumeration");
+ return aRet;
+}
+/* -----------------21.12.98 14:57-------------------
+ *
+ * --------------------------------------------------*/
+SwXFieldEnumeration::SwXFieldEnumeration(SwDoc* pDc) :
+ nNextIndex(0),
+ pDoc(pDc)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+
+ // build sequence
+ sal_Int32 nSize = 32;
+ aItems.realloc( nSize );
+ uno::Reference< text::XTextField > *pItems = aItems.getArray();
+ sal_Int32 nFillPos = 0;
+ //
+ const SwFldTypes* pFldTypes = pDoc->GetFldTypes();
+ sal_uInt16 nCount = pFldTypes->Count();
+ for(sal_uInt16 nType = 0; nType < nCount; ++nType)
+ {
+ const SwFieldType *pCurType = pFldTypes->GetObject(nType);
+
+ SwClientIter aIter( *(SwFieldType*)pCurType );
+ const SwFmtFld* pCurFldFmt = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+ while (pCurFldFmt)
+ {
+ const SwTxtFld *pTxtFld = pCurFldFmt->GetTxtFld();
+ // skip fields that are currently not in the document
+ // e.g. fields in undo or redo array
+ BOOL bSkip = !pTxtFld ||
+ !pTxtFld->GetpTxtNode()->GetNodes().IsDocNodes();
+ if (!bSkip)
+ pItems[ nFillPos++ ] = new SwXTextField(*pCurFldFmt, pDoc);
+ pCurFldFmt = (SwFmtFld*)aIter.Next();
+
+ // enlarge sequence if necessary
+ if (aItems.getLength() == nFillPos)
+ {
+ aItems.realloc( 2 * aItems.getLength() );
+ pItems = aItems.getArray();
+ }
+ }
+ }
+ // now handle meta-fields, which are not SwFields
+ const ::std::vector< uno::Reference<text::XTextField> > MetaFields(
+ pDc->GetMetaFieldManager().getMetaFields() );
+ for (size_t i = 0; i < MetaFields.size(); ++i)
+ {
+ pItems[ nFillPos ] = MetaFields[i];
+ nFillPos++;
+
+ //FIXME UGLY
+ // enlarge sequence if necessary
+ if (aItems.getLength() == nFillPos)
+ {
+ aItems.realloc( 2 * aItems.getLength() );
+ pItems = aItems.getArray();
+ }
+ }
+ // resize sequence to actual used size
+ aItems.realloc( nFillPos );
+}
+/*-- 21.12.98 14:57:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldEnumeration::~SwXFieldEnumeration()
+{
+
+}
+/*-- 21.12.98 14:57:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXFieldEnumeration::hasMoreElements(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return nNextIndex < aItems.getLength();
+}
+/*-- 21.12.98 14:57:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXFieldEnumeration::nextElement(void)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!(nNextIndex < aItems.getLength()))
+ throw container::NoSuchElementException();
+
+#if OSL_DEBUG_LEVEL > 1
+ uno::Reference< text::XTextField > *pItems = aItems.getArray();
+ (void)pItems;
+#endif
+ uno::Reference< text::XTextField > &rxFld = aItems.getArray()[ nNextIndex++ ];
+ uno::Any aRet(&rxFld, ::getCppuType(static_cast<const uno::Reference<text::XTextField>*>(0)));
+ rxFld = 0; // free memory for item that is not longer used
+ return aRet;
+}
+/* -----------------21.12.98 15:08-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFieldEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ pDoc = 0;
+}
+
+
+String& GetString( const uno::Any& rAny, String& rStr )
+{
+ OUString aStr;
+ rAny >>= aStr;
+ rStr = String( aStr );
+ return rStr;
+}
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
new file mode 100644
index 000000000000..2923b4e46317
--- /dev/null
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -0,0 +1,531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <editeng/unolingu.hxx>
+
+#include <unobaseclass.hxx>
+#include <unoflatpara.hxx>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+#include <unotextmarkup.hxx>
+#include <ndtxt.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <viewsh.hxx>
+#include <viewimp.hxx>
+#include <breakit.hxx>
+#include <pam.hxx>
+#include <unobaseclass.hxx>
+#include <unotextrange.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <rootfrm.hxx>
+#include <poolfmt.hxx>
+#include <pagedesc.hxx>
+#include <IGrammarContact.hxx>
+#include <viewopt.hxx>
+
+using namespace ::com::sun::star;
+
+/******************************************************************************
+ * SwXFlatParagraph
+ ******************************************************************************/
+
+SwXFlatParagraph::SwXFlatParagraph( SwTxtNode& rTxtNode, rtl::OUString aExpandText, const ModelToViewHelper::ConversionMap* pMap ) :
+ SwXTextMarkup( rTxtNode, pMap ),
+ maExpandText( aExpandText )
+{
+}
+
+SwXFlatParagraph::~SwXFlatParagraph()
+{
+}
+
+uno::Sequence< uno::Type > SwXFlatParagraph::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes = SwXTextMarkup::getTypes();
+ aTypes.realloc( aTypes.getLength() + 1 );
+ aTypes[aTypes.getLength()-1] = ::getCppuType((uno::Reference< text::XFlatParagraph >*)0);
+ return aTypes;
+}
+
+uno::Sequence< sal_Int8 > SwXFlatParagraph::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+uno::Any SAL_CALL SwXFlatParagraph::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
+{
+ if ( rType == ::getCppuType((uno::Reference< text::XFlatParagraph >*)0) )
+ {
+ return uno::makeAny( uno::Reference < text::XFlatParagraph >(this) );
+ }
+ else
+ return SwXTextMarkup::queryInterface( rType );
+}
+
+void SAL_CALL SwXFlatParagraph::acquire() throw()
+{
+ SwXTextMarkup::acquire();
+}
+
+void SAL_CALL SwXFlatParagraph::release() throw()
+{
+ SwXTextMarkup::release();
+}
+
+const SwTxtNode* SwXFlatParagraph::getTxtNode() const
+{
+ return mpTxtNode;
+}
+
+css::uno::Reference< css::container::XStringKeyMap > SAL_CALL SwXFlatParagraph::getMarkupInfoContainer() throw (css::uno::RuntimeException)
+{
+ return SwXTextMarkup::getMarkupInfoContainer();
+}
+
+void SAL_CALL SwXFlatParagraph::commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & rIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & rxMarkupInfoContainer) throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwXTextMarkup::commitTextMarkup( nType, rIdentifier, nStart, nLength, rxMarkupInfoContainer );
+}
+
+// text::XFlatParagraph:
+::rtl::OUString SAL_CALL SwXFlatParagraph::getText() throw (uno::RuntimeException)
+{
+ return maExpandText;
+}
+
+// text::XFlatParagraph:
+void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, ::sal_Bool bVal ) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if ( mpTxtNode )
+ {
+ if ( text::TextMarkupType::SPELLCHECK == nType )
+ mpTxtNode->SetWrongDirty( !bVal );
+ else if ( text::TextMarkupType::SMARTTAG == nType )
+ mpTxtNode->SetSmartTagDirty( !bVal );
+ else if( text::TextMarkupType::PROOFREADING == nType )
+ {
+ mpTxtNode->SetGrammarCheckDirty( !bVal );
+ if( bVal )
+ ::finishGrammarCheck( *mpTxtNode );
+ }
+ }
+}
+
+// text::XFlatParagraph:
+::sal_Bool SAL_CALL SwXFlatParagraph::isChecked( ::sal_Int32 nType ) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if ( mpTxtNode )
+ {
+ if ( text::TextMarkupType::SPELLCHECK == nType )
+ return mpTxtNode->IsWrongDirty();
+ else if ( text::TextMarkupType::PROOFREADING == nType )
+ return mpTxtNode->IsGrammarCheckDirty();
+ else if ( text::TextMarkupType::SMARTTAG == nType )
+ return mpTxtNode->IsSmartTagDirty();
+ }
+
+ return sal_False;
+}
+
+// text::XFlatParagraph:
+::sal_Bool SAL_CALL SwXFlatParagraph::isModified() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return 0 == mpTxtNode;
+}
+
+// text::XFlatParagraph:
+lang::Locale SAL_CALL SwXFlatParagraph::getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen)
+ throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (!mpTxtNode)
+ return SvxCreateLocale( LANGUAGE_NONE );
+
+ const lang::Locale aLocale( SW_BREAKITER()->GetLocale( mpTxtNode->GetLang( static_cast<USHORT>(nPos), static_cast<USHORT>(nLen) ) ) );
+ return aLocale;
+}
+
+// text::XFlatParagraph:
+lang::Locale SAL_CALL SwXFlatParagraph::getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen)
+ throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!mpTxtNode)
+ return SvxCreateLocale( LANGUAGE_NONE );
+
+ const lang::Locale aLocale( SW_BREAKITER()->GetLocale( mpTxtNode->GetLang( static_cast<USHORT>(nPos), static_cast<USHORT>(nLen) ) ) );
+ return aLocale;
+}
+
+// text::XFlatParagraph:
+void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, const ::rtl::OUString & aNewText, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if ( !mpTxtNode )
+ return;
+
+ SwTxtNode* pOldTxtNode = mpTxtNode;
+
+ SwPaM aPaM( *mpTxtNode, static_cast<USHORT>(nPos), *mpTxtNode, static_cast<USHORT>(nPos + nLen) );
+
+ UnoActionContext aAction( mpTxtNode->GetDoc() );
+
+ const uno::Reference< text::XTextRange > xRange =
+ SwXTextRange::CreateXTextRange(
+ *mpTxtNode->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
+ uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ for ( USHORT i = 0; i < aAttributes.getLength(); ++i )
+ xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value );
+ }
+
+ mpTxtNode = pOldTxtNode; // setPropertyValue() modifies this. We restore the old state.
+
+ IDocumentContentOperations* pIDCO = mpTxtNode->getIDocumentContentOperations();
+ pIDCO->ReplaceRange( aPaM, aNewText, false );
+
+ mpTxtNode = 0;
+}
+
+// text::XFlatParagraph:
+void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 nLen, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if ( !mpTxtNode )
+ return;
+
+ SwPaM aPaM( *mpTxtNode, static_cast<USHORT>(nPos), *mpTxtNode, static_cast<USHORT>(nPos + nLen) );
+
+ UnoActionContext aAction( mpTxtNode->GetDoc() );
+
+ const uno::Reference< text::XTextRange > xRange =
+ SwXTextRange::CreateXTextRange(
+ *mpTxtNode->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
+ uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ for ( USHORT i = 0; i < aAttributes.getLength(); ++i )
+ xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value );
+ }
+
+ mpTxtNode = 0;
+}
+
+// text::XFlatParagraph:
+css::uno::Sequence< ::sal_Int32 > SAL_CALL SwXFlatParagraph::getLanguagePortions() throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return css::uno::Sequence< ::sal_Int32>();
+}
+
+
+const uno::Sequence< sal_Int8 >&
+SwXFlatParagraph::getUnoTunnelId()
+{
+ static uno::Sequence<sal_Int8> aSeq(CreateUnoTunnelId());
+ return aSeq;
+}
+
+
+sal_Int64 SAL_CALL
+SwXFlatParagraph::getSomething(
+ const uno::Sequence< sal_Int8 >& rId)
+ throw (uno::RuntimeException)
+{
+ return sw::UnoTunnelImpl(rId, this);
+}
+
+
+/******************************************************************************
+ * SwXFlatParagraphIterator
+ ******************************************************************************/
+
+SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, sal_Bool bAutomatic )
+ : mpDoc( &rDoc ),
+ mnType( nType ),
+ mbAutomatic( bAutomatic ),
+ mnCurrentNode( 0 ),
+ mnStartNode( 0 ),
+ mnEndNode( rDoc.GetNodes().Count() ),
+ mbWrapped( sal_False )
+{
+ //mnStartNode = mnCurrentNode = get node from current cursor TODO!
+
+ // register as listener and get notified when document is closed
+ mpDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD )->Add(this);
+}
+
+SwXFlatParagraphIterator::~SwXFlatParagraphIterator()
+{
+}
+
+
+void SwXFlatParagraphIterator::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+{
+ ClientModify( this, pOld, pNew );
+ // check if document gets closed...
+ if(!GetRegisteredIn())
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ mpDoc = 0;
+ }
+}
+
+
+uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getFirstPara()
+ throw( uno::RuntimeException )
+{
+ return getNextPara(); // TODO
+}
+
+uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara()
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XFlatParagraph > xRet;
+ if (!mpDoc)
+ return xRet;
+
+ SwTxtNode* pRet = 0;
+ if ( mbAutomatic )
+ {
+ ViewShell* pViewShell = 0;
+ mpDoc->GetEditShell( &pViewShell );
+
+ SwPageFrm* pCurrentPage = pViewShell ? pViewShell->Imp()->GetFirstVisPage() : 0;
+ SwPageFrm* pStartPage = pCurrentPage;
+ SwPageFrm* pStopPage = 0;
+
+ while ( pCurrentPage != pStopPage )
+ {
+ if (mnType != text::TextMarkupType::SPELLCHECK || pCurrentPage->IsInvalidSpelling() )
+ {
+ // this method is supposed to return an empty paragraph in case Online Checking is disabled
+ if ( ( mnType == text::TextMarkupType::PROOFREADING || mnType == text::TextMarkupType::SPELLCHECK )
+ && !pViewShell->GetViewOptions()->IsOnlineSpell() )
+ return xRet;
+
+ // search for invalid content:
+ SwCntntFrm* pCnt = pCurrentPage->ContainsCntnt();
+
+ while( pCnt && pCurrentPage->IsAnLower( pCnt ) )
+ {
+ SwTxtNode* pTxtNode = dynamic_cast<SwTxtNode*>( pCnt->GetNode()->GetTxtNode() );
+
+ if ( pTxtNode &&
+ ((mnType == text::TextMarkupType::SPELLCHECK &&
+ pTxtNode->IsWrongDirty()) ||
+ (mnType == text::TextMarkupType::PROOFREADING &&
+ pTxtNode->IsGrammarCheckDirty())) )
+ {
+ pRet = pTxtNode;
+ break;
+ }
+
+ pCnt = pCnt->GetNextCntntFrm();
+ }
+ }
+
+ if ( pRet )
+ break;
+
+ // if there is no invalid text node on the current page,
+ // we validate the page
+ pCurrentPage->ValidateSpelling();
+
+ // proceed with next page, wrap at end of document if required:
+ pCurrentPage = static_cast<SwPageFrm*>(pCurrentPage->GetNext());
+
+ if ( !pCurrentPage && !pStopPage )
+ {
+ pStopPage = pStartPage;
+ pCurrentPage = static_cast<SwPageFrm*>(mpDoc->GetRootFrm()->Lower());
+ }
+ }
+ }
+ else // non-automatic checking
+ {
+ const SwNodes& rNodes = mpDoc->GetNodes();
+ const ULONG nMaxNodes = rNodes.Count();
+
+ while ( mnCurrentNode < mnEndNode && mnCurrentNode < nMaxNodes )
+ {
+ SwNode* pNd = rNodes[ mnCurrentNode ];
+
+ ++mnCurrentNode;
+
+ pRet = dynamic_cast<SwTxtNode*>(pNd);
+ if ( pRet )
+ break;
+
+ if ( mnCurrentNode == mnEndNode && !mbWrapped )
+ {
+ mnCurrentNode = 0;
+ mnEndNode = mnStartNode;
+ }
+ }
+ }
+
+ if ( pRet )
+ {
+ // Expand the string:
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap =
+ pRet->BuildConversionMap( aExpandText );
+
+ xRet = new SwXFlatParagraph( *pRet, aExpandText, pConversionMap );
+ // keep hard references...
+ m_aFlatParaList.insert( xRet );
+ }
+
+ return xRet;
+}
+
+uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getLastPara()
+ throw( uno::RuntimeException )
+{
+ return getNextPara();
+}
+
+uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(const uno::Reference< text::XFlatParagraph > & xPara)
+ throw ( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XFlatParagraph > xRet;
+ if (!mpDoc)
+ return xRet;
+
+ const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
+ OSL_ASSERT(xFPTunnel.is());
+ SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel));
+
+ if ( !pFlatParagraph )
+ return xRet;
+
+ const SwTxtNode* pCurrentNode = pFlatParagraph->getTxtNode();
+
+ if ( !pCurrentNode )
+ return xRet;
+
+ SwTxtNode* pNextTxtNode = 0;
+ const SwNodes& rNodes = pCurrentNode->GetDoc()->GetNodes();
+
+ for( ULONG nCurrentNode = pCurrentNode->GetIndex() + 1; nCurrentNode < rNodes.Count(); ++nCurrentNode )
+ {
+ SwNode* pNd = rNodes[ nCurrentNode ];
+ pNextTxtNode = dynamic_cast<SwTxtNode*>(pNd);
+ if ( pNextTxtNode )
+ break;
+ }
+
+ if ( pNextTxtNode )
+ {
+ // Expand the string:
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap =
+ pNextTxtNode->BuildConversionMap( aExpandText );
+
+ xRet = new SwXFlatParagraph( *pNextTxtNode, aExpandText, pConversionMap );
+ // keep hard references...
+ m_aFlatParaList.insert( xRet );
+ }
+
+ return xRet;
+}
+
+uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(const uno::Reference< text::XFlatParagraph > & xPara )
+ throw ( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XFlatParagraph > xRet;
+ if (!mpDoc)
+ return xRet;
+
+ const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
+ OSL_ASSERT(xFPTunnel.is());
+ SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel));
+
+ if ( !pFlatParagraph )
+ return xRet;
+
+ const SwTxtNode* pCurrentNode = pFlatParagraph->getTxtNode();
+
+ if ( !pCurrentNode )
+ return xRet;
+
+ SwTxtNode* pPrevTxtNode = 0;
+ const SwNodes& rNodes = pCurrentNode->GetDoc()->GetNodes();
+
+ for( ULONG nCurrentNode = pCurrentNode->GetIndex() - 1; nCurrentNode > 0; --nCurrentNode )
+ {
+ SwNode* pNd = rNodes[ nCurrentNode ];
+ pPrevTxtNode = dynamic_cast<SwTxtNode*>(pNd);
+ if ( pPrevTxtNode )
+ break;
+ }
+
+ if ( pPrevTxtNode )
+ {
+ // Expand the string:
+ rtl::OUString aExpandText;
+ const ModelToViewHelper::ConversionMap* pConversionMap =
+ pPrevTxtNode->BuildConversionMap( aExpandText );
+
+ xRet = new SwXFlatParagraph( *pPrevTxtNode, aExpandText, pConversionMap );
+ // keep hard references...
+ m_aFlatParaList.insert( xRet );
+ }
+
+ return xRet;
+}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
new file mode 100644
index 000000000000..3a3df506b457
--- /dev/null
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -0,0 +1,3433 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/embed/XClassifiedObject.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/embed/XComponentSupplier.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <svx/svxids.hrc>
+#include <editeng/memberids.hrc>
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+
+#include <memory>
+#include <hints.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <editsh.hxx>
+#include <swcli.hxx>
+#include <ndindex.hxx>
+#include <pam.hxx>
+#include <ndnotxt.hxx>
+#include <svx/unomid.hxx>
+#include <unocrsr.hxx>
+#include <unocrsrhelper.hxx>
+#include <docstyle.hxx>
+#include <dcontact.hxx>
+#include <fmtcnct.hxx>
+#include <ndole.hxx>
+#include <frmfmt.hxx>
+#include <frame.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unoparagraph.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unoevent.hxx>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
+#include <tools/poly.hxx>
+#include <swundo.hxx>
+#include <unostyle.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/protitem.hxx>
+#include <fmtornt.hxx>
+#include <fmturl.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/prntitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <grfatr.hxx>
+#include <unoframe.hxx>
+#include <fmtanchr.hxx>
+#include <fmtclds.hxx>
+#include <fmtcntnt.hxx>
+#include <frmatr.hxx>
+#include <ndtxt.hxx>
+#include <ndgrf.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/printer.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <xmloff/xmlcnitm.hxx>
+#include <poolfmt.hxx>
+#include <pagedesc.hxx>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <tools/urlobj.hxx>
+#include <editeng/frmdiritem.hxx>
+// DVO, OD 01.10.2003 #i18732#
+#include <fmtfollowtextflow.hxx>
+// OD 2004-05-05 #i28701#
+#include <fmtwrapinfluenceonobjpos.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+// from fefly1.cxx
+extern sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet );
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::style::XStyleFamiliesSupplier;
+
+const sal_Char __FAR_DATA sPackageProtocol[] = "vnd.sun.star.Package:";
+const sal_Char __FAR_DATA sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
+
+/****************************************************************************
+ Rahmenbeschreibung
+****************************************************************************/
+class BaseFrameProperties_Impl
+{
+ SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
+
+public:
+ virtual ~BaseFrameProperties_Impl();
+
+ void SetProperty(USHORT nWID, BYTE nMemberId, const uno::Any& rVal);
+ sal_Bool GetProperty(USHORT nWID, BYTE nMemberId, const uno::Any*& pAny );
+// void GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny );
+
+// const SfxItemPropertyMap* GetMap() const {return _pMap;}
+ sal_Bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, sal_Bool& rSizeFound);
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) = 0;
+
+};
+/* -----------------------------12.06.01 15:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BaseFrameProperties_Impl::~BaseFrameProperties_Impl()
+{
+}
+/* -----------------------------12.06.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BaseFrameProperties_Impl::SetProperty(USHORT nWID, BYTE nMemberId, const uno::Any& rVal)
+{
+ aAnyMap.SetValue( nWID, nMemberId, rVal );
+}
+/* -----------------------------12.06.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool BaseFrameProperties_Impl::GetProperty(USHORT nWID, BYTE nMemberId, const uno::Any*& rpAny)
+{
+ return aAnyMap.FillValue( nWID, nMemberId, rpAny );
+}
+//void BaseFrameProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny )
+//{
+// rAny = rxPropertySet->getPropertyValue( rPropertyName );
+//}
+/* -----------------29.06.98 09:55-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, sal_Bool& rSizeFound)
+{
+ sal_Bool bRet = sal_True;
+ //Anker kommt auf jeden Fall in den Set
+ SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
+ {
+ const ::uno::Any* pAnchorPgNo;
+ if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
+ bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
+ const ::uno::Any* pAnchorType;
+ if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
+ bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
+ }
+ rToSet.Put(aAnchor);
+ {
+ const ::uno::Any* pCol = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol );
+ const ::uno::Any* pRGBCol = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol );
+ const ::uno::Any* pColTrans = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans);
+ const ::uno::Any* pTrans = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans );
+ const ::uno::Any* pGrLoc = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
+ const ::uno::Any* pGrURL = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL );
+ const ::uno::Any* pGrFilter = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter );
+ const ::uno::Any* pGrTranparency = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency );
+
+ if(pCol || pTrans || pGrURL || pGrFilter || pGrLoc ||
+ pGrTranparency || pColTrans || pRGBCol)
+ {
+ SvxBrushItem aBrush ( static_cast < const :: SvxBrushItem & > ( rFromSet.Get ( RES_BACKGROUND ) ) );
+ if(pCol )
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR );
+ if(pColTrans)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
+ if(pRGBCol)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
+ if(pTrans)
+ {
+ // don't overwrite transparency with a non-transparence flag
+ if(!pColTrans || Any2Bool( *pTrans ))
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT);
+ }
+ if(pGrURL)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL);
+ if(pGrFilter)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
+ if(pGrLoc)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
+ if(pGrTranparency)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
+
+ rToSet.Put(aBrush);
+ }
+ }
+ {
+ const ::uno::Any* pCont = 0;
+ GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont );
+ const ::uno::Any* pPos = 0;
+ GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos );
+ const ::uno::Any* pName = 0;
+ GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName );
+ if(pCont||pPos||pName)
+ {
+ SvxProtectItem aProt ( static_cast < const :: SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) );
+ if(pCont)
+ bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT);
+ if(pPos )
+ bRet &= ((SfxPoolItem&)aProt).PutValue(*pPos, MID_PROTECT_POSITION);
+ if(pName)
+ bRet &= ((SfxPoolItem&)aProt).PutValue(*pName, MID_PROTECT_SIZE);
+ rToSet.Put(aProt);
+ }
+ }
+ {
+ const ::uno::Any* pHori = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori );
+ const ::uno::Any* pHoriP = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP );
+ const ::uno::Any* pHoriR = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR );
+ const ::uno::Any* pPageT = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT);
+ if(pHori||pHoriP||pHoriR||pPageT)
+ {
+ SwFmtHoriOrient aOrient ( static_cast < const :: SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) );
+ if(pHori )
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT);
+ if(pHoriP)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS);
+ if(pHoriR)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION);
+ if(pPageT)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE);
+ rToSet.Put(aOrient);
+ }
+ }
+
+ {
+ const ::uno::Any* pVert = 0;
+ GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert);
+ const ::uno::Any* pVertP = 0;
+ GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP );
+ const ::uno::Any* pVertR = 0;
+ GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR );
+ if(pVert||pVertP||pVertR)
+ {
+ SwFmtVertOrient aOrient ( static_cast < const :: SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) );
+ if(pVert )
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT);
+ if(pVertP)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS);
+ if(pVertR)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION);
+ rToSet.Put(aOrient);
+ }
+ }
+ {
+ const ::uno::Any* pURL = 0;
+ GetProperty(RES_URL, MID_URL_URL, pURL );
+ const ::uno::Any* pTarget = 0;
+ GetProperty(RES_URL, MID_URL_TARGET, pTarget );
+ const ::uno::Any* pHyLNm = 0;
+ GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm );
+ const ::uno::Any* pHySMp = 0;
+ GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp );
+ if(pURL||pTarget||pHyLNm||pHySMp)
+ {
+ SwFmtURL aURL ( static_cast < const :: SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) );
+ if(pURL)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL);
+ if(pTarget)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pTarget, MID_URL_TARGET);
+ if(pHyLNm)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME );
+ if(pHySMp)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pHySMp, MID_URL_SERVERMAP);
+ rToSet.Put(aURL);
+ }
+ }
+ const ::uno::Any* pL = 0;
+ GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL );
+ const ::uno::Any* pR = 0;
+ GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR );
+ if(pL||pR)
+ {
+ SvxLRSpaceItem aLR ( static_cast < const :: SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) );
+ if(pL)
+ bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
+ if(pR)
+ bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
+ rToSet.Put(aLR);
+ }
+ const ::uno::Any* pT = 0;
+ GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT );
+ const ::uno::Any* pB = 0;
+ GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB );
+ if(pT||pB)
+ {
+ SvxULSpaceItem aTB ( static_cast < const :: SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) );
+ if(pT)
+ bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS);
+ if(pB)
+ bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS);
+ rToSet.Put(aTB);
+ }
+ const ::uno::Any* pOp;
+ if(GetProperty(RES_OPAQUE, 0, pOp))
+ {
+ SvxOpaqueItem aOp ( static_cast < const :: SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) );
+ bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0);
+ rToSet.Put(aOp);
+ }
+ const ::uno::Any* pPrt;
+ if(GetProperty(RES_PRINT, 0, pPrt))
+ {
+ SvxPrintItem aPrt ( static_cast < const :: SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) );
+ bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0);
+ rToSet.Put(aPrt);
+ }
+ const ::uno::Any* pSh;
+ if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh))
+ {
+ SvxShadowItem aSh ( static_cast < const :: SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) );
+ bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS);
+ rToSet.Put(aSh);
+ }
+ const ::uno::Any* pSur = 0;
+ GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
+ const ::uno::Any* pSurAnch = 0;
+ GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
+ if(pSur || pSurAnch)
+ {
+ SwFmtSurround aSrnd ( static_cast < const :: SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) );
+ if(pSur)
+ bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE );
+ if(pSurAnch)
+ bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
+ rToSet.Put(aSrnd);
+ }
+ const ::uno::Any* pLeft = 0;
+ GetProperty(RES_BOX, LEFT_BORDER |CONVERT_TWIPS, pLeft );
+ const ::uno::Any* pRight = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER , pRight );
+ const ::uno::Any* pTop = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER , pTop );
+ const ::uno::Any* pBottom = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER, pBottom);
+ const ::uno::Any* pDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE, pDistance);
+ const ::uno::Any* pLeftDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance);
+ const ::uno::Any* pRightDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE, pRightDistance);
+ const ::uno::Any* pTopDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE, pTopDistance);
+ const ::uno::Any* pBottomDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE, pBottomDistance);
+ if( pLeft || pRight || pTop || pBottom || pDistance ||
+ pLeftDistance || pRightDistance || pTopDistance || pBottomDistance )
+ {
+ SvxBoxItem aBox ( static_cast < const :: SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) );
+ if( pLeft )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER );
+ if( pRight )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER );
+ if( pTop )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER);
+ if( pBottom )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER);
+ if( pDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE);
+ if( pLeftDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE);
+ if( pRightDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE);
+ if( pTopDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
+ if( pBottomDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
+ rToSet.Put(aBox);
+ }
+ {
+ const ::uno::Any* pRelH = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH);
+ const ::uno::Any* pRelW = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW);
+ const ::uno::Any* pSyncWidth = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth);
+ const ::uno::Any* pSyncHeight = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight);
+ const ::uno::Any* pWidth = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth);
+ const ::uno::Any* pHeight = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight);
+ const ::uno::Any* pSize = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize);
+ const ::uno::Any* pSizeType = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType);
+ const ::uno::Any* pWidthType = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE, pWidthType);
+ if( pWidth || pHeight ||pRelH || pRelW || pSize ||pSizeType ||
+ pWidthType ||pSyncWidth || pSyncHeight )
+ {
+ rSizeFound = sal_True;
+ SwFmtFrmSize aFrmSz ( static_cast < const :: SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) );
+ if(pWidth)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
+ if(pHeight)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS);
+ if(pRelH )
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT);
+ if(pRelW )
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH);
+ if(pSyncWidth)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT);
+ if(pSyncHeight)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH);
+ if(pSize)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
+ if(pSizeType)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE);
+ if(pWidthType)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE);
+ if(!aFrmSz.GetWidth())
+ aFrmSz.SetWidth(MINFLY);
+ if(!aFrmSz.GetHeight())
+ aFrmSz.SetHeight(MINFLY);
+ rToSet.Put(aFrmSz);
+ }
+ else
+ {
+ rSizeFound = sal_False;
+ SwFmtFrmSize aFrmSz;
+ awt::Size aSize;
+ aSize.Width = 2 * MM50;
+ aSize.Height = 2 * MM50;
+ ::uno::Any aSizeVal;
+ aSizeVal <<= aSize;
+ ((SfxPoolItem&)aFrmSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
+ rToSet.Put(aFrmSz);
+ }
+ }
+ const ::uno::Any* pFrameDirection = 0;
+ GetProperty(RES_FRAMEDIR, 0, pFrameDirection);
+ if(pFrameDirection)
+ {
+ SvxFrameDirectionItem aAttr(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR);
+ aAttr.PutValue(*pFrameDirection, 0);
+ rToSet.Put(aAttr);
+ }
+ const ::uno::Any* pUnknown = 0;
+ GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown);
+ if(pUnknown)
+ {
+ SvXMLAttrContainerItem aAttr(RES_UNKNOWNATR_CONTAINER);
+ aAttr.PutValue(*pUnknown, 0);
+ rToSet.Put(aAttr);
+ }
+
+ // DVO, OD 01.10.2003 #i18732#
+ const ::uno::Any* pFollowTextFlow = 0;
+ GetProperty(RES_FOLLOW_TEXT_FLOW, 0, pFollowTextFlow);
+ if ( pFollowTextFlow )
+ {
+ SwFmtFollowTextFlow aFmtFollowTextFlow;
+ aFmtFollowTextFlow.PutValue(*pFollowTextFlow, 0);
+ rToSet.Put(aFmtFollowTextFlow);
+ }
+
+ // OD 2004-05-04 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
+ const ::uno::Any* pWrapInfluenceOnObjPos = 0;
+ GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE, pWrapInfluenceOnObjPos);
+ if ( pWrapInfluenceOnObjPos )
+ {
+ SwFmtWrapInfluenceOnObjPos aFmtWrapInfluenceOnObjPos;
+ aFmtWrapInfluenceOnObjPos.PutValue( *pWrapInfluenceOnObjPos, MID_WRAP_INFLUENCE );
+ rToSet.Put(aFmtWrapInfluenceOnObjPos);
+ }
+
+ return bRet;
+}
+/* -----------------22.06.98 09:17-------------------
+ *
+ * --------------------------------------------------*/
+
+class SwFrameProperties_Impl : public BaseFrameProperties_Impl
+{
+protected:
+// SwFrameProperties_Impl(/*const :: SfxItemPropertyMap* pMap*/) :
+// BaseFrameProperties_Impl(/*pMap*/){}
+public:
+ SwFrameProperties_Impl();
+ virtual ~SwFrameProperties_Impl(){}
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
+};
+/* -----------------22.06.98 09:17-------------------
+ *
+ * --------------------------------------------------*/
+SwFrameProperties_Impl::SwFrameProperties_Impl():
+ BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
+{
+}
+/* -----------------22.06.98 11:27-------------------
+ *
+ * --------------------------------------------------*/
+inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const :: uno::Any *pAny)
+{
+ if ( pAny )
+ {
+ SwFmtCol aCol ( static_cast < const :: SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) );
+ ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS);
+ rToSet.Put(aCol);
+ }
+}
+sal_Bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, sal_Bool& rSizeFound)
+{
+ //Properties fuer alle Frames
+ const ::uno::Any *pStyleName;
+ SwDocStyleSheet* pStyle = NULL;
+ sal_Bool bRet;
+
+ if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
+ {
+ OUString sStyle;
+ *pStyleName >>= sStyle;
+ pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
+ SFX_STYLE_FAMILY_FRAME);
+ }
+
+ const ::uno::Any* pColumns = NULL;
+ GetProperty (RES_COL, MID_COLUMNS, pColumns);
+ if ( pStyle )
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
+ const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
+ bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
+ lcl_FillCol ( rSet, *pItemSet, pColumns );
+ }
+ else
+ {
+ const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
+ bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
+ lcl_FillCol ( rSet, *pItemSet, pColumns );
+ }
+ const ::uno::Any* pEdit;
+ if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit))
+ {
+ SfxBoolItem aBool(RES_EDIT_IN_READONLY);
+ ((SfxPoolItem&)aBool).PutValue(*pEdit, 0);
+ rSet.Put(aBool);
+ }
+ return bRet;
+}
+/****************************************************************************
+ Grafik-Descriptor
+****************************************************************************/
+class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
+{
+public:
+ SwGraphicProperties_Impl();
+ virtual ~SwGraphicProperties_Impl(){}
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
+};
+/* -----------------27.06.98 14:53-------------------
+ *
+ * --------------------------------------------------*/
+SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
+ BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
+{
+}
+
+/* -----------------27.06.98 14:40-------------------
+ *
+ * --------------------------------------------------*/
+inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, sal_Bool &rRet )
+{
+ if(pHEvenMirror || pHOddMirror || pVMirror )
+ {
+ SwMirrorGrf aMirror ( static_cast < const :: SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) );
+ if(pHEvenMirror)
+ rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
+ if(pHOddMirror)
+ rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
+ if(pVMirror)
+ rRet &= ((SfxPoolItem&)aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
+ rToSet.Put(aMirror);
+ }
+}
+
+sal_Bool SwGraphicProperties_Impl::AnyToItemSet(
+ SwDoc* pDoc,
+ SfxItemSet& rFrmSet,
+ SfxItemSet& rGrSet,
+ sal_Bool& rSizeFound)
+{
+ //Properties fuer alle Frames
+ sal_Bool bRet;
+ const ::uno::Any *pStyleName;
+ SwDocStyleSheet* pStyle = NULL;
+
+ if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
+ {
+ OUString sStyle;
+ *pStyleName >>= sStyle;
+ pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
+ SFX_STYLE_FAMILY_FRAME);
+ }
+
+ const ::uno::Any* pHEvenMirror = 0;
+ const ::uno::Any* pHOddMirror = 0;
+ const ::uno::Any* pVMirror = 0;
+ GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror);
+ GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror);
+ GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror);
+
+ if ( pStyle )
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) );
+ const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
+ bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
+ lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
+ }
+ else
+ {
+ const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
+ bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
+ lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
+ }
+
+
+ static const :: USHORT nIDs[] =
+ {
+ RES_GRFATR_CROPGRF,
+ RES_GRFATR_ROTATION,
+ RES_GRFATR_LUMINANCE,
+ RES_GRFATR_CONTRAST,
+ RES_GRFATR_CHANNELR,
+ RES_GRFATR_CHANNELG,
+ RES_GRFATR_CHANNELB,
+ RES_GRFATR_GAMMA,
+ RES_GRFATR_INVERT,
+ RES_GRFATR_TRANSPARENCY,
+ RES_GRFATR_DRAWMODE,
+ 0
+ };
+ const ::uno::Any* pAny;
+ for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++)
+ {
+ BYTE nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
+ if(GetProperty(nIDs[nIndex], nMId, pAny ))
+ {
+ SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone();
+ bRet &= pItem->PutValue(*pAny, nMId );
+ rGrSet.Put(*pItem);
+ delete pItem;
+ }
+ }
+
+ return bRet;
+}
+/* -----------------4/1/2003 13:54-------------------
+
+ --------------------------------------------------*/
+
+class SwOLEProperties_Impl : public SwFrameProperties_Impl
+{
+public:
+ SwOLEProperties_Impl() :
+ SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){}
+ virtual ~SwOLEProperties_Impl(){}
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
+};
+/* -----------------4/1/2003 15:32-------------------
+
+ --------------------------------------------------*/
+
+sal_Bool SwOLEProperties_Impl::AnyToItemSet(
+ SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound)
+{
+ const ::uno::Any* pTemp;
+ if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp) )
+ return FALSE;
+ SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound);
+ //
+ return TRUE;
+}
+
+/******************************************************************
+ * SwXFrame
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const :: uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXFrame::getSomething( const :: uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/*-----------------24.03.98 14:49-------------------
+
+--------------------------------------------------*/
+
+TYPEINIT1(SwXFrame, SwClient);
+/* -----------------------------06.04.00 14:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFrame::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXFrame");
+}
+/* -----------------------------06.04.00 14:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFrame::supportsService(const :: OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.BaseFrame")||
+ !rServiceName.compareToAscii("com.sun.star.text.TextContent") ||
+ !rServiceName.compareToAscii("com.sun.star.document.LinkTarget");
+}
+/* -----------------------------06.04.00 14:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(3);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.BaseFrame");
+ pArray[1] = C2U("com.sun.star.text.TextContent");
+ pArray[2] = C2U("com.sun.star.document.LinkTarget");
+ return aRet;
+}
+
+
+/*-- 14.01.99 11:31:52---------------------------------------------------
+ Dieser CTor legt den Frame als Descriptor an
+ -----------------------------------------------------------------------*/
+SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc) :
+ aLstnrCntnr( (container::XNamed*)this),
+ m_pPropSet(pSet),
+ m_pDoc ( pDoc ),
+ eType(eSet),
+ bIsDescriptor(sal_True),
+ m_pCopySource( 0 )
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ // get the property set for the default style data
+ // First get the model
+ uno::Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
+ // Ask the model for it's family supplier interface
+ uno::Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
+ // Get the style families
+ uno::Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
+ // Get the Frame family (and keep it for later)
+ const ::uno::Any aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) );
+ aAny >>= mxStyleFamily;
+ // In the derived class, we'll ask mxStyleFamily for the relevant default style
+ // mxStyleFamily is initialised in the SwXFrame constructor
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ {
+ uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Frame" ) ) );
+ aAny2 >>= mxStyleData;
+ pProps = new SwFrameProperties_Impl( );
+ }
+ break;
+ case FLYCNTTYPE_GRF:
+ {
+ uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Graphics" ) ) );
+ aAny2 >>= mxStyleData;
+ pProps = new SwGraphicProperties_Impl( );
+ }
+ break;
+ case FLYCNTTYPE_OLE:
+ {
+ uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "OLE" ) ) );
+ aAny2 >>= mxStyleData;
+ pProps = new SwOLEProperties_Impl( );
+ }
+ break;
+
+ default:
+ ;
+ }
+}
+
+/*-- 11.12.98 15:05:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet) :
+ SwClient( &rFrmFmt ),
+ aLstnrCntnr( (container::XNamed*)this),
+ m_pPropSet(pSet),
+ m_pDoc( 0 ),
+ eType(eSet),
+ pProps(0),
+ bIsDescriptor(sal_False),
+ m_pCopySource(0)
+{
+
+}
+/*-- 11.12.98 15:05:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFrame::~SwXFrame()
+{
+ delete m_pCopySource;
+ delete pProps;
+}
+/*-- 11.12.98 15:05:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+/*-- 11.12.98 15:05:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXFrame::getName(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ String sRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ sRet = pFmt->GetName();
+ else if(bIsDescriptor)
+ sRet = sName;
+ else
+ throw uno::RuntimeException();
+ return sRet;
+}
+/*-- 11.12.98 15:05:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::setName(const :: OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ String sTmpName(rName);
+ if(pFmt)
+ {
+ pFmt->GetDoc()->SetFlyName((SwFlyFrmFmt&)*pFmt, sTmpName);
+ if(pFmt->GetName() != sTmpName)
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ else if(bIsDescriptor)
+ sName = sTmpName;
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 15:05:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXFrame::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ uno::Reference< beans::XPropertySetInfo > xRef;
+ static uno::Reference< beans::XPropertySetInfo > xFrmRef;
+ static uno::Reference< beans::XPropertySetInfo > xGrfRef;
+ static uno::Reference< beans::XPropertySetInfo > xOLERef;
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ if( !xFrmRef.is() )
+ xFrmRef = m_pPropSet->getPropertySetInfo();
+ xRef = xFrmRef;
+ break;
+ case FLYCNTTYPE_GRF:
+ if( !xGrfRef.is() )
+ xGrfRef = m_pPropSet->getPropertySetInfo();
+ xRef = xGrfRef;
+ break;
+ case FLYCNTTYPE_OLE:
+ if( !xOLERef.is() )
+ xOLERef = m_pPropSet->getPropertySetInfo();
+ xRef = xOLERef;
+ break;
+ default:
+ ;
+ }
+ return xRef;
+}
+/*-- 15.05.06 12:21:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::SetSelection(SwPaM& rCopySource)
+{
+ if(m_pCopySource)
+ delete m_pCopySource;
+ m_pCopySource = new SwPaM( *rCopySource.Start() );
+ m_pCopySource->SetMark();
+ *m_pCopySource->GetMark() = *rCopySource.End();
+}
+/*-- 11.12.98 15:05:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt )
+{
+ SdrObject* pObject = pFmt->FindSdrObject();
+ if( !pObject )
+ {
+ SwDoc *pDoc = pFmt->GetDoc();
+ // --> OD 2005-08-08 #i52858# - method name changed
+ SdrModel *pDrawModel = pDoc->GetOrCreateDrawModel();
+ // <--
+ SwFlyDrawContact* pContactObject
+ = new SwFlyDrawContact( pFmt, pDrawModel );
+ pObject = pContactObject->GetMaster();
+
+ const :: SwFmtSurround& rSurround = pFmt->GetSurround();
+ pObject->SetLayer(
+ ( SURROUND_THROUGHT == rSurround.GetSurround() &&
+ !pFmt->GetOpaque().GetValue() ) ? pDoc->GetHellId()
+ : pDoc->GetHeavenId() );
+
+ pDrawModel->GetPage(0)->InsertObject( pObject );
+ }
+
+ return pObject;
+}
+
+SwFrmFmt *lcl_GetFrmFmt( const :: uno::Any& rValue, SwDoc *pDoc )
+{
+ SwFrmFmt *pRet = 0;
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ if(pDocSh)
+ {
+ OUString uTemp;
+ rValue >>= uTemp;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(String (uTemp), sStyle, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle,
+ SFX_STYLE_FAMILY_FRAME);
+ if(pStyle)
+ pRet = pStyle->GetFrmFmt();
+ }
+
+ return pRet;
+}
+
+void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const :: SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pFmt)
+ {
+ sal_Bool bNextFrame = sal_False;
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwDoc* pDoc = pFmt->GetDoc();
+ if ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) ||
+ (FN_PARAM_COUNTOUR_PP == pEntry->nWID) ||
+ (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
+ (FN_UNO_IS_PIXEL_CONTOUR == pEntry->nWID) )
+ {
+ const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
+ {
+ drawing::PointSequenceSequence aParam;
+ if(!aValue.hasValue())
+ pNoTxt->SetContour(0);
+ else if(aValue >>= aParam)
+ {
+ PolyPolygon aPoly((USHORT)aParam.getLength());
+ for(sal_Int32 i = 0; i < aParam.getLength(); i++)
+ {
+ const :: drawing::PointSequence* pPointSeq = aParam.getConstArray();
+ sal_Int32 nPoints = pPointSeq[i].getLength();
+ const :: awt::Point* pPoints = pPointSeq[i].getConstArray();
+ Polygon aSet( (USHORT)nPoints );
+ for(sal_Int32 j = 0; j < nPoints; j++)
+ {
+ Point aPoint(pPoints[j].X, pPoints[j].Y);
+ aSet.SetPoint(aPoint, (USHORT)j);
+ }
+ // Close polygon if it isn't closed already.
+ aSet.Optimize( POLY_OPTIMIZE_CLOSE );
+ aPoly.Insert( aSet );
+ }
+ pNoTxt->SetContourAPI( &aPoly );
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
+ {
+ pNoTxt->SetAutomaticContour( *(sal_Bool *)aValue.getValue() );
+ }
+ else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
+ {
+ // The IsPixelContour property can only be set if there
+ // is no contour, or if the contour has been set by the
+ // API itself (or in other words, if the contour isn't
+ // used already).
+ if( !pNoTxt->_HasContour() ||
+ !pNoTxt->IsContourMapModeValid() )
+ pNoTxt->SetPixelContour( *(sal_Bool *)aValue.getValue() );
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
+ pNoTxt->SetAttr(aSet);
+ }
+ }
+ }
+ // --> OD 2009-07-13 #i73249#
+ // Attribute AlternativeText was never published.
+ // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
+// else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM )
+// {
+// const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+// if(pIdx)
+// {
+// SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+// OUString uTemp;
+// aValue >>= uTemp;
+// pNoTxt->SetAlternateText(uTemp);
+// }
+// }
+ // New attribute Title
+ else if( FN_UNO_TITLE == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ OUString uTemp;
+ aValue >>= uTemp;
+ const String sTitle(uTemp);
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), sTitle );
+ }
+ // New attribute Description
+ else if( FN_UNO_DESCRIPTION == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ OUString uTemp;
+ aValue >>= uTemp;
+ const String sDescription(uTemp);
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), sDescription );
+ }
+ // <--
+ else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
+ {
+ SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() );
+ if( pFrmFmt )
+ {
+ UnoActionContext aAction(pFmt->GetDoc());
+
+ SfxItemSet* pSet = 0;
+ // --> OD 2004-08-13 #i31771#, #i25798# - No adjustment of
+ // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
+ // if document is currently in reading mode.
+ if ( !pFmt->GetDoc()->IsInReading() )
+ {
+ // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocPos )
+ SwFlyFrm *pFly = 0;
+ {
+ const :: SwFrmFmt* pFmtXX = pFmt;
+ if (PTR_CAST(SwFlyFrmFmt, pFmtXX))
+ pFly = ((SwFlyFrmFmt*)pFmtXX)->GetFrm();
+ }
+ if ( pFly )
+ {
+ const :: SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_ANCHOR, sal_False, &pItem ))
+ {
+ pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange );
+ pSet->Put( *pItem );
+ if ( !::lcl_ChkAndSetNewAnchor( *pFly, *pSet ) )
+ delete pSet, pSet = 0;
+ }
+ }
+ }
+ // <--
+
+ pFmt->GetDoc()->SetFrmFmtToFly( *pFmt, *pFrmFmt, pSet, FALSE );
+ delete pSet;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID ||
+ FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
+ {
+ String sGrfName, sFltName;
+ GraphicObject *pGrfObj = 0;
+ pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, &sFltName );
+ OUString uTemp;
+ aValue >>= uTemp;
+ String sTmp(uTemp);
+ UnoActionContext aAction(pFmt->GetDoc());
+ if(FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
+ {
+ if( sTmp.EqualsAscii( sPackageProtocol,
+ 0, sizeof( sPackageProtocol )-1 ) )
+ {
+ pGrfObj = new GraphicObject;
+ pGrfObj->SetUserData( sTmp );
+ pGrfObj->SetSwapState();
+ sGrfName.Erase();
+ }
+ else if( sTmp.EqualsAscii( sGraphicObjectProtocol,
+ 0, sizeof(sGraphicObjectProtocol)-1 ) )
+ {
+ ByteString sId( sTmp.Copy(sizeof(sGraphicObjectProtocol)-1),
+ RTL_TEXTENCODING_ASCII_US );
+ pGrfObj = new GraphicObject( sId );
+ sGrfName.Erase();
+ }
+ else
+ {
+ sGrfName = sTmp;
+ }
+ }
+ else
+ {
+ sFltName = sTmp;
+ }
+
+ const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ {
+ delete pGrfObj;
+ throw uno::RuntimeException();
+ }
+ SwPaM aGrfPaM(*pGrfNode);
+ pFmt->GetDoc()->ReRead( aGrfPaM, sGrfName, sFltName, 0,
+ pGrfObj );
+ }
+ delete pGrfObj;
+ }
+ else if( FN_UNO_GRAPHIC == pEntry->nWID )
+ {
+ uno::Reference< graphic::XGraphic > xGraphic;
+ aValue >>= xGraphic;
+ if(xGraphic.is())
+ {
+ const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aGrfPaM(*pGrfNode);
+ Graphic aGraphic( xGraphic );
+ pFmt->GetDoc()->ReRead( aGrfPaM, String(), String(), &aGraphic, 0 );
+ }
+ }
+ }
+ else if( FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID )
+ {
+ bool bURL = FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID;
+ bool bApply = false;
+ Graphic aGraphic;
+ if( bURL )
+ {
+ GraphicObject *pGrfObj = 0;
+ OUString aGrfUrl;
+ aValue >>= aGrfUrl;
+
+ // the package URL based graphics are handled in different way currently
+ // TODO/LATER: actually this is the correct place to handle them
+ ::rtl::OUString aGraphicProtocol( RTL_CONSTASCII_USTRINGPARAM( sGraphicObjectProtocol ) );
+ if( aGrfUrl.compareTo( aGraphicProtocol, aGraphicProtocol.getLength() ) == 0 )
+ {
+ ByteString sId( aGrfUrl.copy(sizeof(sGraphicObjectProtocol)-1).getStr(), RTL_TEXTENCODING_ASCII_US );
+ pGrfObj = new GraphicObject( sId );
+ aGraphic = pGrfObj->GetGraphic();
+ bApply = true;
+ }
+ }
+ else
+ {
+ uno::Reference< graphic::XGraphic > xGraphic;
+ aValue >>= xGraphic;
+ if( xGraphic.is() )
+ {
+ aGraphic = Graphic( xGraphic );
+ bApply = true;
+ }
+ }
+
+ if ( bApply )
+ {
+ const :: SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ if ( pCnt->GetCntntIdx() && pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ] )
+ {
+ SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode();
+
+ if ( pOleNode )
+ {
+ svt::EmbeddedObjectRef xObj = pOleNode->GetOLEObj().GetObject();
+
+ ::rtl::OUString aMediaType;
+ xObj.SetGraphic( aGraphic, aMediaType );
+ }
+ }
+ }
+ }
+ else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
+ || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
+ {
+ OUString uTemp;
+ aValue >>= uTemp;
+ String sChainName(uTemp);
+ if(!sChainName.Len())
+ {
+ if(bNextFrame)
+ pDoc->Unchain(*pFmt);
+ else
+ {
+ SwFmtChain aChain( pFmt->GetChain() );
+ SwFrmFmt *pPrev = aChain.GetPrev();
+ if(pPrev)
+ pDoc->Unchain(*pPrev);
+ }
+ }
+ else
+ {
+ sal_uInt16 nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
+
+ SwFrmFmt* pChain = 0;
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwFrmFmt* pFmt2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
+ if(sChainName == pFmt2->GetName() )
+ {
+ pChain = pFmt2;
+ break;
+ }
+ }
+ if(pChain)
+ {
+ SwFrmFmt* pSource = bNextFrame ? pFmt : pChain;
+ SwFrmFmt* pDest = bNextFrame ? pChain: pFmt;
+ pDoc->Chain(*pSource, *pDest);
+ }
+ }
+ }
+ else if(FN_UNO_Z_ORDER == pEntry->nWID)
+ {
+ sal_Int32 nZOrder = - 1;
+ aValue >>= nZOrder;
+ if( nZOrder >= 0)
+ {
+ SdrObject* pObject =
+ GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
+ SdrModel *pDrawModel = pDoc->GetDrawModel();
+ pDrawModel->GetPage(0)->
+ SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
+ }
+ }
+ else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId)
+ {
+ sal_Bool bDone = sal_False;
+ uno::Reference<text::XTextFrame> xFrame;
+ if(aValue >>= xFrame)
+ {
+ uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
+ SwXFrame* pFrame = xTunnel.is() ?
+ reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
+ : 0;
+ if(pFrame && this != pFrame && pFrame->GetFrmFmt() && pFrame->GetFrmFmt()->GetDoc() == pDoc)
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
+
+
+ SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
+ aAnchor.SetAnchor(&aPos);
+ aAnchor.SetType(FLY_AT_FLY);
+ aSet.Put(aAnchor);
+ pDoc->SetFlyFrmAttr( *pFmt, aSet );
+ bDone = sal_True;
+ }
+ }
+ if(!bDone)
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+
+ aSet.SetParent(&pFmt->GetAttrSet());
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
+ if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
+ {
+ SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
+ if(aAnchor.GetAnchorId() == FLY_AT_FLY)
+ {
+ const :: SwPosition* pPosition = aAnchor.GetCntntAnchor();
+ SwFrmFmt* pFlyFmt = pPosition ? pPosition->nNode.GetNode().GetFlyFmt() : 0;
+ if(!pFlyFmt || pFlyFmt->Which() == RES_DRAWFRMFMT)
+ {
+ lang::IllegalArgumentException aExcept;
+ aExcept.Message = C2U("Anchor to frame: no frame found");
+ throw aExcept;
+ }
+ else
+ {
+ SwPosition aPos = *pPosition;
+ aPos.nNode = *pFlyFmt->GetCntnt().GetCntntIdx();
+ aAnchor.SetAnchor(&aPos);
+ aSet.Put(aAnchor);
+ }
+ }
+ else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) &&
+ !aAnchor.GetCntntAnchor())
+ {
+ SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
+ SwPaM aPam(rNode);
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ aAnchor.SetAnchor( aPam.Start() );
+ aSet.Put(aAnchor);
+ }
+
+ // --> OD 2004-08-13 #i31771#, #i25798# - No adjustment of
+ // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
+ // if document is currently in reading mode.
+ if ( !pFmt->GetDoc()->IsInReading() )
+ {
+ // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
+ SwFlyFrm *pFly = 0;
+ if (PTR_CAST(SwFlyFrmFmt, pFmt))
+ pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm();
+ if (pFly)
+ {
+ const :: SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem ))
+ {
+ aSet.Put( *pItem );
+ ::lcl_ChkAndSetNewAnchor( *pFly, aSet );
+ }
+ }
+ }
+ // <--
+
+ pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
+ }
+ else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ else
+ pFmt->SetFmtAttr(aSet);
+ }
+ }
+ else if(IsDescriptor())
+ {
+ pProps->SetProperty(pEntry->nWID, pEntry->nMemberId, aValue);
+ if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
+ {
+ OUString sStyleName;
+ aValue >>= sStyleName;
+ try
+ {
+ uno::Any aAny = mxStyleFamily->getByName ( sStyleName );
+ aAny >>= mxStyleData;
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 15:05:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aAny;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
+ {
+ uno::Sequence<text::TextContentAnchorType> aTypes(5);
+ text::TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
+ pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
+ pArray[2] = text::TextContentAnchorType_AT_PAGE;
+ pArray[3] = text::TextContentAnchorType_AT_FRAME;
+ pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
+ aAny.setValue(&aTypes, ::getCppuType(static_cast<uno::Sequence<text::TextContentAnchorType>*>(0)));
+ }
+ else if(pFmt)
+ {
+ if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
+ pEntry &&
+ (isGRFATR(pEntry->nWID) ||
+ pEntry->nWID == FN_PARAM_COUNTOUR_PP ||
+ pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
+ pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
+ {
+ PolyPolygon aContour;
+ if( pNoTxt->GetContourAPI( aContour ) )
+ {
+ drawing::PointSequenceSequence aPtSeq(aContour.Count());
+ drawing::PointSequence* pPSeq = aPtSeq.getArray();
+ for(USHORT i = 0; i < aContour.Count(); i++)
+ {
+ const Polygon& rPoly = aContour.GetObject(i);
+ pPSeq[i].realloc(rPoly.GetSize());
+ awt::Point* pPoints = pPSeq[i].getArray();
+ for(USHORT j = 0; j < rPoly.GetSize(); j++)
+ {
+ const Point& rPoint = rPoly.GetPoint(j);
+ pPoints[j].X = rPoint.X();
+ pPoints[j].Y = rPoint.Y();
+ }
+ }
+ aAny <<= aPtSeq;
+ }
+ }
+ else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
+ {
+ BOOL bValue = pNoTxt->HasAutomaticContour();
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ }
+ else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
+ {
+ BOOL bValue = pNoTxt->IsPixelContour();
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ }
+ else
+ {
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
+ }
+ }
+ }
+ else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
+ {
+ String sGrfName;
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ throw uno::RuntimeException();
+ if( pGrfNode->IsGrfLink() )
+ {
+ pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, 0 );
+ }
+ else
+ {
+ String sPrefix( RTL_CONSTASCII_STRINGPARAM(sGraphicObjectProtocol) );
+ String sId( pGrfNode->GetGrfObj().GetUniqueID(),
+ RTL_TEXTENCODING_ASCII_US );
+ (sGrfName = sPrefix) += sId;
+ }
+ }
+ aAny <<= OUString(sGrfName);
+ }
+ else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
+ {
+ String sFltName;
+ pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, 0, &sFltName );
+ aAny <<= OUString(sFltName);
+ }
+ else if( FN_UNO_GRAPHIC == pEntry->nWID )
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ throw uno::RuntimeException();
+ aAny <<= pGrfNode->GetGrf().GetXGraphic();
+ }
+ }
+ else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
+ {
+ aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT ) );
+ }
+ // --> OD 2009-07-13 #i73249#
+ // Attribute AlternativeText was never published.
+ // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
+// else if(eType != FLYCNTTYPE_FRM &&
+// FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
+// {
+// const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+// if(pIdx)
+// {
+// SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+// aAny <<= OUString(pNoTxt->GetAlternateText());
+// }
+// }
+ else if( FN_UNO_TITLE == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ aAny <<= OUString(pFlyFmt->GetObjTitle());
+ }
+ // New attribute Description
+ else if( FN_UNO_DESCRIPTION == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ aAny <<= OUString(pFlyFmt->GetObjDescription());
+ }
+ // <--
+ else if(eType == FLYCNTTYPE_GRF &&
+ (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE))))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize();
+ awt::Size aTmp;
+ aTmp.Width = TWIP_TO_MM100(aActSize.Width());
+ aTmp.Height = TWIP_TO_MM100(aActSize.Height());
+ aAny.setValue(&aTmp, ::getCppuType(static_cast<const awt::Size*>(0)));
+ }
+ }
+ else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
+ {
+ aAny <<= OUString(pFmt->GetName());
+ }
+ else if(FN_UNO_Z_ORDER == pEntry->nWID)
+ {
+ const SdrObject* pObj = pFmt->FindRealSdrObject();
+ if( pObj )
+ {
+ aAny <<= (sal_Int32)pObj->GetOrdNum();
+ }
+ }
+ else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
+ FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
+ ->GetIndex() + 1 ]->GetOLENode();
+ uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
+ OUString aHexCLSID;
+ {
+ SvGlobalName aClassName( xIP->getClassID() );
+ aHexCLSID = aClassName.GetHexName();
+ if(FN_UNO_CLSID != pEntry->nWID)
+ {
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+ {
+ uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
+ uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
+ if ( xModel.is() )
+ aAny <<= xModel;
+ else if ( FN_UNO_COMPONENT == pEntry->nWID )
+ aAny <<= xComp;
+ }
+ }
+ }
+
+ if(FN_UNO_CLSID == pEntry->nWID)
+ aAny <<= aHexCLSID;
+ else if(FN_UNO_STREAM_NAME == pEntry->nWID)
+ {
+ aAny <<= ::rtl::OUString(pOleNode->GetOLEObj().GetCurrentPersistName());
+ }
+ }
+ else if(WID_LAYOUT_SIZE == pEntry->nWID)
+ {
+ // format document completely in order to get correct value
+ pFmt->GetDoc()->GetEditShell()->CalcLayout();
+
+ SwClientIter aIter( *pFmt );
+ SwClient* pC = aIter.First( TYPE( SwFrm ) );
+ if (pC)
+ {
+ SwFrm *pTmpFrm = static_cast< SwFrm * >(pC);
+ DBG_ASSERT( pTmpFrm->IsValid(), "frame not valid" );
+ const SwRect &rRect = pTmpFrm->Frm();
+ Size aMM100Size = OutputDevice::LogicToLogic(
+ Size( rRect.Width(), rRect.Height() ),
+ MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ));
+ aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() );
+ }
+ }
+ else
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ m_pPropSet->getPropertyValue(*pEntry, rSet, aAny);
+ }
+ }
+ else if(IsDescriptor())
+ {
+ if ( ! m_pDoc )
+ throw uno::RuntimeException();
+ if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor
+ {
+ const uno::Any* pAny = 0;
+ if( !pProps->GetProperty( pEntry->nWID, pEntry->nMemberId, pAny ) )
+ aAny = mxStyleData->getPropertyValue( rPropertyName );
+ else if ( pAny )
+ aAny = *pAny;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aAny;
+}
+/*-- 11.12.98 15:05:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::addPropertyChangeListener(const OUString& /*PropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 15:05:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::removePropertyChangeListener(const OUString& /*PropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 15:05:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::addVetoableChangeListener(const OUString& /*PropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 15:05:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::removeVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 12.09.00 14:04:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< OUString > aPropertyNames(1);
+ OUString* pNames = aPropertyNames.getArray();
+ pNames[0] = rPropertyName;
+ uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aPropertyNames);
+ return aStates.getConstArray()[0];
+}
+/*-- 12.09.00 14:04:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
+ const uno::Sequence< OUString >& aPropertyNames )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength());
+ beans::PropertyState* pStates = aStates.getArray();
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const OUString* pNames = aPropertyNames.getConstArray();
+ const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
+ for(int i = 0; i < aPropertyNames.getLength(); i++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(pNames[i]);
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
+ pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
+ FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
+ FN_UNO_GRAPHIC_U_R_L == pEntry->nWID||
+ FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
+ FN_UNO_ACTUAL_SIZE == pEntry->nWID||
+ FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
+ {
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ if ((eType == FLYCNTTYPE_GRF) &&
+ pEntry && isGRFATR(pEntry->nWID))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ aSet.GetItemState(pEntry->nWID);
+ if(SFX_ITEM_SET == aSet.GetItemState( pEntry->nWID, FALSE ))
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ if(SFX_ITEM_SET == rFmtSet.GetItemState( pEntry->nWID, FALSE ))
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ else
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+ }
+ else if(IsDescriptor())
+ {
+ for(int i = 0; i < aPropertyNames.getLength(); i++)
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ throw uno::RuntimeException();
+ return aStates;
+}
+/*-- 12.09.00 14:04:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ BOOL bNextFrame;
+ if( pEntry->nWID &&
+ pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
+ pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
+ {
+ if ( (eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ {
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ aSet.ClearItem(pEntry->nWID);
+ pNoTxt->SetAttr(aSet);
+ }
+ }
+ }
+ // --> OD 2009-07-13 #i73249#
+ // Attribute AlternativeText was never published.
+ // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
+// else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
+// {
+// const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+// if(pIdx)
+// {
+// SwNodeIndex aIdx(*pIdx, 1);
+// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+// pNoTxt->SetAlternateText(aEmptyStr);
+// }
+// }
+ // New attribute Title
+ else if( FN_UNO_TITLE == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), aEmptyStr );
+ }
+ // New attribute Description
+ else if( FN_UNO_DESCRIPTION == pEntry->nWID )
+ {
+ SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
+ ASSERT( pFmt,
+ "unexpected type of <pFmt> --> crash" );
+ // assure that <SdrObject> instance exists.
+ GetOrCreateSdrObject( pFlyFmt );
+ pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), aEmptyStr );
+ }
+ // <--
+ else
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ aSet.ClearItem(pEntry->nWID);
+ if(!rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
+ pFmt->SetFmtAttr(aSet);
+ }
+ }
+ else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
+ || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ if(bNextFrame)
+ pDoc->Unchain(*pFmt);
+ else
+ {
+ SwFmtChain aChain( pFmt->GetChain() );
+ SwFrmFmt *pPrev = aChain.GetPrev();
+ if(pPrev)
+ pDoc->Unchain(*pPrev);
+ }
+ }
+ }
+ else if(!IsDescriptor())
+ throw uno::RuntimeException();
+
+}
+/*-- 12.09.00 14:04:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pEntry)
+ {
+ if ( pEntry->nWID < RES_FRMATR_END )
+ {
+ const SfxPoolItem& rDefItem =
+ pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
+ rDefItem.QueryValue(aRet, pEntry->nMemberId);
+ }
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else if(!IsDescriptor())
+ throw uno::RuntimeException();
+ return aRet;
+}
+/* -----------------22.04.99 14:59-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/* -----------------22.04.99 14:59-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 15:05:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+ m_pDoc = 0;
+ aLstnrCntnr.Disposing();
+ }
+}
+
+/*-- 11.12.98 15:23:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if ( pFmt )
+ {
+ SdrObject* pObj = pFmt->FindSdrObject();
+ // OD 11.09.2003 #112039# - add condition to perform delete of
+ // format/anchor sign, not only if the object is inserted, but also
+ // if a contact object is registered, which isn't in the destruction.
+ if ( pObj &&
+ ( pObj->IsInserted() ||
+ ( pObj->GetUserCall() &&
+ !static_cast<SwContact*>(pObj->GetUserCall())->IsInDTOR() ) ) )
+ {
+ if (pFmt->GetAnchor().GetAnchorId() == FLY_AS_CHAR)
+ {
+ const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
+ SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ const xub_StrLen nIdx = rPos.nContent.GetIndex();
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ }
+ else
+ pFmt->GetDoc()->DelLayoutFmt(pFmt);
+ }
+ }
+
+}
+/*-- 11.12.98 16:02:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXFrame::getAnchor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ // return an anchor for non-page bound frames
+ // and for page bound frames that have a page no == NULL and a content position
+ if ((rAnchor.GetAnchorId() != FLY_AT_PAGE) ||
+ (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
+ {
+ const SwPosition &rPos = *(rAnchor.GetCntntAnchor());
+ aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/* -----------------14.01.99 12:02-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFrame::ResetDescriptor()
+{
+ bIsDescriptor = sal_False;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+ DELETEZ(pProps);
+}
+/* -----------------18.02.99 13:34-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsDescriptor())
+ throw uno::RuntimeException();
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = reinterpret_cast< SwXTextRange * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
+ pCursor = reinterpret_cast< OTextCursorHelper * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc)
+ {
+ SwUnoInternalPaM aIntPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
+
+ SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
+ SwPaM aPam(rNode);
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ static sal_uInt16 __READONLY_DATA aFrmAttrRange[] =
+ {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0
+ };
+ static sal_uInt16 __READONLY_DATA aGrAttrRange[] =
+ {
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ 0
+ };
+ SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
+
+ SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );
+ //jetzt muessen die passenden Items in den Set
+ sal_Bool bSizeFound;
+ if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))
+ throw lang::IllegalArgumentException();
+ //der TextRange wird einzeln behandelt
+ *aPam.GetPoint() = *aIntPam.GetPoint();
+ if(aIntPam.HasMark())
+ {
+ aPam.SetMark();
+ *aPam.GetMark() = *aIntPam.GetMark();
+ }
+
+ const SfxPoolItem* pItem;
+ RndStdIds eAnchorId = FLY_AT_PARA;
+ if(SFX_ITEM_SET == aFrmSet.GetItemState(RES_ANCHOR, sal_False, &pItem) )
+ {
+ eAnchorId = ((const SwFmtAnchor*)pItem)->GetAnchorId();
+ if( FLY_AT_FLY == eAnchorId &&
+ !aPam.GetNode()->FindFlyStartNode())
+ {
+ //rahmengebunden geht nur dort, wo ein Rahmen ist!
+ SwFmtAnchor aAnchor(FLY_AT_PARA);
+ aFrmSet.Put(aAnchor);
+ }
+ else if ((FLY_AT_PAGE == eAnchorId) &&
+ 0 == ((const SwFmtAnchor*)pItem)->GetPageNum() )
+ {
+ SwFmtAnchor aAnchor( *((const SwFmtAnchor*)pItem) );
+ aAnchor.SetAnchor( aPam.GetPoint() );
+ aFrmSet.Put(aAnchor);
+ }
+ }
+
+ const ::uno::Any* pStyle;
+ SwFrmFmt *pParentFrmFmt = 0;
+ if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
+ pParentFrmFmt = lcl_GetFrmFmt( *pStyle, pDoc );
+
+ SwFlyFrmFmt* pFmt = 0;
+ if( eType == FLYCNTTYPE_FRM)
+ {
+ UnoActionContext aCont(pDoc);
+ if(m_pCopySource)
+ {
+ SwFmtAnchor* pAnchorItem = 0;
+ // the frame is inserted bound to page
+ // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
+ if (eAnchorId != FLY_AT_PAGE)
+ {
+ pAnchorItem = static_cast<SwFmtAnchor*>(aFrmSet.Get(RES_ANCHOR).Clone());
+ aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 ));
+ }
+
+ pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet,
+ 0,
+ pParentFrmFmt );
+ if(pAnchorItem && pFmt)
+ {
+ pFmt->DelFrms();
+ pAnchorItem->SetAnchor( m_pCopySource->Start() );
+ SfxItemSet aAnchorSet( pDoc->GetAttrPool(), RES_ANCHOR, RES_ANCHOR );
+ aAnchorSet.Put( *pAnchorItem );
+ pDoc->SetFlyFrmAttr( *pFmt, aAnchorSet );
+ delete pAnchorItem;
+ }
+ DELETEZ( m_pCopySource );
+ }
+ else
+ {
+ pFmt = pDoc->MakeFlySection( FLY_AT_PARA, aPam.GetPoint(),
+ &aFrmSet, pParentFrmFmt );
+ }
+ if(pFmt)
+ {
+ pFmt->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
+ }
+ //den SwXText wecken
+ ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrmFmt()->GetDoc() );
+ }
+ else if( eType == FLYCNTTYPE_GRF)
+ {
+ UnoActionContext aCont(pDoc);
+ const ::uno::Any* pGraphicURL;
+ String sGraphicURL;
+ GraphicObject *pGrfObj = 0;
+ if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
+ {
+ OUString uTemp;
+ (*pGraphicURL) >>= uTemp;
+ sGraphicURL = String(uTemp);
+ if( sGraphicURL.EqualsAscii( sPackageProtocol,
+ 0, sizeof( sPackageProtocol )-1 ) )
+ {
+ pGrfObj = new GraphicObject;
+ pGrfObj->SetUserData( sGraphicURL );
+ pGrfObj->SetSwapState();
+ sGraphicURL.Erase();
+ }
+ else if( sGraphicURL.EqualsAscii( sGraphicObjectProtocol,
+ 0, sizeof(sGraphicObjectProtocol)-1 ) )
+ {
+ ByteString sId( sGraphicURL.Copy( sizeof(sGraphicObjectProtocol)-1 ),
+ RTL_TEXTENCODING_ASCII_US );
+ pGrfObj = new GraphicObject( sId );
+ sGraphicURL.Erase();
+ }
+ }
+ Graphic aGraphic;
+ const ::uno::Any* pGraphic;
+ if( pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic ))
+ {
+ uno::Reference< graphic::XGraphic > xGraphic;
+ (*pGraphic) >>= xGraphic;
+ aGraphic = Graphic( xGraphic );
+ }
+
+ String sFltName;
+ const ::uno::Any* pFilter;
+ if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
+ {
+ OUString uTemp;
+ (*pFilter) >>= uTemp;
+ sFltName = String(uTemp);
+ }
+
+ pFmt =
+ pGrfObj ? pDoc->Insert( aPam, *pGrfObj, &aFrmSet, &aGrSet,
+ pParentFrmFmt )
+ : pDoc->Insert( aPam, sGraphicURL, sFltName, &aGraphic,
+ &aFrmSet, &aGrSet, pParentFrmFmt );
+ delete pGrfObj;
+ if(pFmt)
+ {
+ SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()
+ ->GetIndex()+1 ]->GetGrfNode();
+ pGrfNd->SetChgTwipSize( !bSizeFound );
+ pFmt->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
+
+ }
+ const ::uno::Any* pSurroundContour;
+ if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SURROUND_CONTOUR)), *pSurroundContour);
+ const ::uno::Any* pContourOutside;
+ if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_OUTSIDE)), *pContourOutside);
+ const ::uno::Any* pContourPoly;
+ if(pProps->GetProperty(FN_PARAM_COUNTOUR_PP, 0, pContourPoly))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_POLY_POLYGON)), *pContourPoly);
+ const ::uno::Any* pPixelContour;
+ if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_PIXEL_CONTOUR)), *pPixelContour);
+ const ::uno::Any* pAutoContour;
+ if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR)), *pAutoContour);
+// const ::uno::Any* pAltText;
+// if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText))
+// setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText);
+ }
+ else
+ {
+ const ::uno::Any* pCLSID = 0;
+ const ::uno::Any* pStreamName = 0;
+ if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID) && !pProps->GetProperty( FN_UNO_STREAM_NAME, 0, pStreamName ))
+ throw uno::RuntimeException();
+ if(pCLSID)
+ {
+ OUString aCLSID;
+ SvGlobalName aClassName;
+ uno::Reference < embed::XEmbeddedObject > xIPObj;
+ std::auto_ptr < comphelper::EmbeddedObjectContainer > pCnt;
+ if( (*pCLSID) >>= aCLSID )
+ {
+ if( !aClassName.MakeId( aCLSID ) )
+ {
+ lang::IllegalArgumentException aExcept;
+ aExcept.Message = OUString::createFromAscii("CLSID invalid");
+ throw aExcept;
+ }
+
+ pCnt.reset( new comphelper::EmbeddedObjectContainer );
+ ::rtl::OUString aName;
+ xIPObj = pCnt->CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
+ }
+ if ( xIPObj.is() )
+ {
+ //TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
+ //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xIPObj->GetMiscStatus() && pDoc->getPrinter( false ) )
+ // xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) );
+
+ UnoActionContext aAction(pDoc);
+ pDoc->StartUndo(UNDO_INSERT, NULL);
+ if(!bSizeFound)
+ {
+ //TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode?
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+
+ // TODO/LEAN: VisualArea still needs running state
+ svt::EmbeddedObjectRef::TryRunningState( xIPObj );
+
+ // set parent to get correct VisArea(in case of object needing parent printer)
+ uno::Reference < container::XChild > xChild( xIPObj, uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( pDoc->GetDocShell()->GetModel() );
+
+ //The Size should be suggested by the OLE server if not manually set
+ MapUnit aRefMap = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
+ awt::Size aSize;
+ try
+ {
+ aSize = xIPObj->getVisualAreaSize( nAspect );
+ }
+ catch ( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ Size aSz( aSize.Width, aSize.Height );
+ if ( !aSz.Width() || !aSz.Height() )
+ {
+ aSz.Width() = aSz.Height() = 5000;
+ aSz = OutputDevice::LogicToLogic
+ ( aSz, MapMode( MAP_100TH_MM ), aRefMap );
+ }
+ MapMode aMyMap( MAP_TWIP );
+ aSz = OutputDevice::LogicToLogic( aSz, aRefMap, aMyMap );
+ SwFmtFrmSize aFrmSz;
+ aFrmSz.SetSize(aSz);
+ aFrmSet.Put(aFrmSz);
+ }
+ SwFlyFrmFmt* pFmt2 = 0;
+
+ // TODO/LATER: Is it the only possible aspect here?
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+ ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect );
+ pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL );
+ ASSERT( pFmt2, "Doc->Insert(notxt) failed." );
+
+ pDoc->EndUndo(UNDO_INSERT, NULL);
+ pFmt2->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, sName);
+ }
+ }
+ else if( pStreamName )
+ {
+ ::rtl::OUString sStreamName;
+ (*pStreamName) >>= sStreamName;
+ pDoc->StartUndo(UNDO_INSERT, NULL);
+
+ SwFlyFrmFmt* pFrmFmt = 0;
+ pFrmFmt = pDoc->InsertOLE( aPam, sStreamName, embed::Aspects::MSOLE_CONTENT, &aFrmSet, NULL, NULL );
+ pDoc->EndUndo(UNDO_INSERT, NULL);
+ pFrmFmt->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, sName);
+ }
+ }
+ if( pFmt && pDoc->GetDrawModel() )
+ GetOrCreateSdrObject( pFmt );
+ const ::uno::Any* pOrder;
+ if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) )
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_Z_ORDER)), *pOrder);
+ const ::uno::Any* pReplacement;
+ if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) )
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_GRAPHIC)), *pReplacement);
+ // --> OD 2009-07-13 #i73249#
+ // new attribute Title
+ const ::uno::Any* pTitle;
+ if ( pProps->GetProperty(FN_UNO_TITLE, 0, pTitle) )
+ {
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_TITLE)), *pTitle);
+ }
+ // new attribute Description
+ const ::uno::Any* pDescription;
+ if ( pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription) )
+ {
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_DESCRIPTION)), *pDescription);
+ }
+ // <--
+ }
+ else
+ throw lang::IllegalArgumentException();
+ //setzt das Flag zurueck und loescht den Descriptor-Pointer
+ ResetDescriptor();
+}
+/* -----------------------------04.04.01 14:27--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SwFrmFmt* pFmt;
+ if(IsDescriptor())
+ attachToRange(xTextRange);
+ else if(0 != (pFmt = GetFrmFmt()))
+ {
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = reinterpret_cast< SwXTextRange * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
+ pCursor = reinterpret_cast< OTextCursorHelper * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ }
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwUnoInternalPaM aIntPam(*pDoc);
+ if (::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_ANCHOR, RES_ANCHOR );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(RES_ANCHOR);
+ aAnchor.SetAnchor( aIntPam.Start() );
+ aSet.Put(aAnchor);
+ pDoc->SetFlyFrmAttr( *pFmt, aSet );
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+}
+/*-- 22.04.99 08:03:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+awt::Point SwXFrame::getPosition(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("position cannot be determined with this method");
+ throw aRuntime;
+}
+/*-- 22.04.99 08:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::setPosition(const awt::Point& /*aPosition*/) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("position cannot be changed with this method");
+ throw aRuntime;
+}
+/*-- 22.04.99 08:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+awt::Size SwXFrame::getSize(void) throw( uno::RuntimeException )
+{
+ const ::uno::Any aVal = getPropertyValue(C2U("Size"));
+ awt::Size* pRet = (awt::Size*)aVal.getValue();
+ return *pRet;
+}
+/*-- 22.04.99 08:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFrame::setSize(const awt::Size& aSize)
+ throw( beans::PropertyVetoException, uno::RuntimeException )
+{
+ const ::uno::Any aVal(&aSize, ::getCppuType(static_cast<const awt::Size*>(0)));
+ setPropertyValue(C2U("Size"), aVal);
+}
+/*-- 22.04.99 08:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXFrame::getShapeType(void) throw( uno::RuntimeException )
+{
+ return C2U("FrameShape");
+}
+
+
+/******************************************************************
+ * SwXTextFrame
+ ******************************************************************/
+/*-- 14.01.99 11:27:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) :
+ SwXText(0, CURSOR_FRAME),
+ SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME), _pDoc )
+{
+}
+/*-- 11.12.98 15:23:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFrame::SwXTextFrame(SwFrmFmt& rFmt) :
+ SwXText(rFmt.GetDoc(), CURSOR_FRAME),
+ SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME))
+{
+
+}
+/*-- 11.12.98 15:23:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFrame::~SwXTextFrame()
+{
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextFrame::acquire( )throw()
+{
+ SwXFrame::acquire();
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextFrame::release( )throw()
+{
+ SwXFrame::release();
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+::uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ ::uno::Any aRet = SwXFrame::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXText::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXTextFrameBaseClass::queryInterface(aType);
+ return aRet;
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTextFrameTypes = SwXTextFrameBaseClass::getTypes();
+ uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+
+ long nIndex = aTextFrameTypes.getLength();
+ aTextFrameTypes.realloc(
+ aTextFrameTypes.getLength() +
+ aFrameTypes.getLength() +
+ aTextTypes.getLength());
+
+ uno::Type* pTextFrameTypes = aTextFrameTypes.getArray();
+ const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
+ pTextFrameTypes[nIndex++] = pFrameTypes[nPos];
+
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(nPos = 0; nPos <aTextTypes.getLength(); nPos++)
+ pTextFrameTypes[nIndex++] = pTextTypes[nPos];
+
+ return aTextFrameTypes;
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/*-- 11.12.98 15:23:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SwXTextFrame::getText(void) throw( uno::RuntimeException )
+{
+ return this;
+}
+/*-- 11.12.98 15:23:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwStartNode *SwXTextFrame::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pFmt->GetCntnt();
+ if( rFlyCntnt.GetCntntIdx() )
+ pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
+ }
+
+ return pSttNd;
+}
+
+uno::Reference< text::XTextCursor >
+SwXTextFrame::CreateCursor() throw (uno::RuntimeException)
+{
+ return createTextCursor();
+}
+/*-- 11.12.98 15:23:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextCursor > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ //save current start node to be able to check if there is content after the table -
+ //otherwise the cursor would be in the body text!
+ const SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
+ const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
+
+ SwPaM aPam(rNode);
+ aPam.Move(fnMoveForward, fnGoNode);
+ SwTableNode* pTblNode = aPam.GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ aPam.GetPoint()->nContent.Assign(pCont, 0);
+
+ const SwStartNode* pNewStartNode =
+ aPam.GetNode()->FindSttNodeByType(SwFlyStartNode);
+ if(!pNewStartNode || pNewStartNode != pOwnStartNode)
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = S2U("no text available");
+ throw aExcept;
+ }
+
+ SwXTextCursor *const pXCursor = new SwXTextCursor(
+ *pFmt->GetDoc(), this, CURSOR_FRAME, *aPam.GetPoint());
+ aRef = static_cast<text::XWordCursor*>(pXCursor);
+#if OSL_DEBUG_LEVEL > 1
+ SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
+ (void) pUnoCrsr;
+#endif
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 11.12.98 15:23:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextCursor > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ SwUnoInternalPaM aPam(*GetDoc());
+ if (pFmt && ::sw::XTextRangeToSwPaM(aPam, aTextPosition))
+ {
+ SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
+#if OSL_DEBUG_LEVEL > 1
+ const SwStartNode* p1 = aPam.GetNode()->FindFlyStartNode();
+ const SwStartNode* p2 = rNode.FindFlyStartNode();
+ (void)p1;
+ (void)p2;
+#endif
+ if(aPam.GetNode()->FindFlyStartNode() == rNode.FindFlyStartNode())
+ {
+ aRef = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*pFmt->GetDoc(), this, CURSOR_FRAME,
+ *aPam.GetPoint(), aPam.GetMark()));
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 11.12.98 15:23:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< container::XEnumeration > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwPosition aPos(pFmt->GetCntnt().GetCntntIdx()->GetNode());
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(aPos, sal_False));
+ pUnoCursor->Move(fnMoveForward, fnGoNode);
+// // no Cursor in protected sections
+// SwCrsrSaveState aSave( *pUnoCrsr );
+// if(pUnoCrsr->IsInProtectTable( sal_True ) ||
+// pUnoCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ))
+// throw uno::RuntimeException() );
+ aRef = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FRAME);
+ }
+ return aRef;
+}
+/*-- 11.12.98 15:23:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXTextFrame::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType(static_cast<uno::Reference<text::XTextRange>*>(0));
+}
+/*-- 11.12.98 15:23:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFrame::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+/*-- 11.12.98 15:23:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SwXFrame::attach(xTextRange);
+}
+/*-- 11.12.98 15:23:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextFrame::getAnchor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return SwXFrame::getAnchor();
+}
+/*-- 11.12.98 15:23:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextFrame::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwXFrame::dispose();
+}
+/*-- 11.12.98 15:23:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ SwXFrame::addEventListener(aListener);
+}
+/*-- 11.12.98 15:23:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ SwXFrame::removeEventListener(aListener);
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextFrame::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextFrame");
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.Text")||
+ COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextFrame")||
+ SwXFrame::supportsService(rServiceName);
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
+ aRet.realloc(aRet.getLength() + 2);
+ OUString* pArray = aRet.getArray();
+ pArray[aRet.getLength() - 2] = C2U("com.sun.star.text.TextFrame");
+ pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.Text");
+ return aRet;
+}
+/* -----------------------------20.06.00 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void * SAL_CALL SwXTextFrame::operator new( size_t t) throw()
+{
+ return SwXTextFrameBaseClass::operator new( t);
+}
+/* -----------------------------20.06.00 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextFrame::operator delete( void * p) throw()
+{
+ SwXTextFrameBaseClass::operator delete(p);
+}
+
+uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
+ throw(uno::RuntimeException)
+{
+ return new SwFrameEventDescriptor( *this );
+}
+/* -----------------------------10.01.01 13:27--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ sal_Int64 nRet = SwXFrame::getSomething( rId );
+ if( !nRet )
+ nRet = SwXText::getSomething( rId );
+
+ return nRet;
+}
+/* -----------------------------19.03.2002 16:43------------------------------
+
+ ---------------------------------------------------------------------------*/
+::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ ::uno::Any aRet;
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
+ {
+ //redline can only be returned if it's a living object
+ if(!IsDescriptor())
+ aRet = SwXText::getPropertyValue(rPropertyName);
+ }
+ else
+ aRet = SwXFrame::getPropertyValue(rPropertyName);
+ return aRet;
+}
+/******************************************************************
+ * SwXTextGraphicObject
+ ******************************************************************/
+/*-- 14.01.99 11:27:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) :
+ SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
+{
+}
+/*-- 11.12.98 16:02:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt& rFmt) :
+ SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC))
+{
+
+}
+/*-- 11.12.98 16:02:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextGraphicObject::~SwXTextGraphicObject()
+{
+
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextGraphicObject::acquire( )throw()
+{
+ SwXFrame::acquire();
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextGraphicObject::release( )throw()
+{
+ SwXFrame::release();
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+::uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType )
+ throw(uno::RuntimeException)
+{
+ ::uno::Any aRet = SwXFrame::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType);
+ return aRet;
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL
+ SwXTextGraphicObject::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aGraphicTypes = SwXTextGraphicObjectBaseClass::getTypes();
+ uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
+
+ long nIndex = aGraphicTypes.getLength();
+ aGraphicTypes.realloc(
+ aGraphicTypes.getLength() +
+ aFrameTypes.getLength());
+
+ uno::Type* pGraphicTypes = aGraphicTypes.getArray();
+ const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
+ pGraphicTypes[nIndex++] = pFrameTypes[nPos];
+
+ return aGraphicTypes;
+}
+/* -----------------------------15.03.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL SwXTextGraphicObject::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/*-- 11.12.98 16:02:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextGraphicObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SwXFrame::attach(xTextRange);
+}
+/*-- 11.12.98 16:02:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextGraphicObject::getAnchor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return SwXFrame::getAnchor();
+}
+/*-- 11.12.98 16:02:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextGraphicObject::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwXFrame::dispose();
+}
+/*-- 11.12.98 16:02:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextGraphicObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ SwXFrame::addEventListener(aListener);
+}
+/*-- 11.12.98 16:02:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextGraphicObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ SwXFrame::removeEventListener(aListener);
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextGraphicObject::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextGraphicObject");
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextGraphicObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextGraphicObject") ||
+ SwXFrame::supportsService(rServiceName);
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextGraphicObject::getSupportedServiceNames(void)
+ throw( uno::RuntimeException )
+{
+ uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
+ aRet.realloc(aRet.getLength() + 1);
+ OUString* pArray = aRet.getArray();
+ pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextGraphicObject");
+ return aRet;
+}
+/* -----------------------------20.06.00 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void * SAL_CALL SwXTextGraphicObject::operator new( size_t t) throw()
+{
+ return SwXTextGraphicObjectBaseClass::operator new(t);
+}
+/* -----------------------------20.06.00 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextGraphicObject::operator delete( void * p) throw()
+{
+ SwXTextGraphicObjectBaseClass::operator delete(p);
+}
+/* -----------------------------15.12.00 12:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<container::XNameReplace> SAL_CALL
+ SwXTextGraphicObject::getEvents()
+ throw(uno::RuntimeException)
+{
+ return new SwFrameEventDescriptor( *this );
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/*-- 11.12.98 16:16:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) :
+ SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
+{
+}
+/*-- 11.12.98 16:16:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt& rFmt) :
+ SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT))
+{
+
+}
+/*-- 11.12.98 16:16:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextEmbeddedObject::~SwXTextEmbeddedObject()
+{
+
+}
+/*-- 11.12.98 16:16:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+/* -----------------------------15.03.00 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextEmbeddedObject::acquire()throw()
+{
+ SwXFrame::acquire();
+}
+/* -----------------------------15.03.00 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextEmbeddedObject::release()throw()
+{
+ SwXFrame::release();
+}
+/* -----------------------------15.03.00 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+::uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType )
+ throw( uno::RuntimeException)
+{
+ ::uno::Any aRet = SwXFrame::queryInterface(aType);;
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType);
+ return aRet;
+}
+/* -----------------------------15.03.00 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL SwXTextEmbeddedObject::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTextEmbeddedTypes = SwXTextEmbeddedObjectBaseClass::getTypes();
+ uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
+
+ long nIndex = aTextEmbeddedTypes.getLength();
+ aTextEmbeddedTypes.realloc(
+ aTextEmbeddedTypes.getLength() +
+ aFrameTypes.getLength());
+
+ uno::Type* pTextEmbeddedTypes = aTextEmbeddedTypes.getArray();
+
+ const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
+ pTextEmbeddedTypes[nIndex++] = pFrameTypes[nPos];
+
+ return aTextEmbeddedTypes;
+}
+/* -----------------------------15.03.00 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL SwXTextEmbeddedObject::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/*-- 11.12.98 16:16:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextEmbeddedObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SwXFrame::attach(xTextRange);
+}
+/*-- 11.12.98 16:16:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextEmbeddedObject::getAnchor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return SwXFrame::getAnchor();
+}
+/*-- 11.12.98 16:16:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextEmbeddedObject::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwXFrame::dispose();
+}
+/*-- 11.12.98 16:16:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextEmbeddedObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ SwXFrame::addEventListener(aListener);
+}
+/*-- 11.12.98 16:16:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ SwXFrame::removeEventListener(aListener);
+}
+/*-- 11.12.98 16:16:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+uno::Reference< lang::XComponent > SwXTextEmbeddedObject::getEmbeddedObject(void) throw( uno::RuntimeException )
+{
+ uno::Reference< lang::XComponent > xRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
+ ->GetIndex() + 1 ]->GetOLENode();
+ uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+ {
+ // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
+ if ( pDoc->GetDocShell() )
+ pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
+
+ xRet = uno::Reference < lang::XComponent >( xIP->getComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifyBroadcaster > xBrdcst( xRet, uno::UNO_QUERY);
+ uno::Reference< frame::XModel > xModel( xRet, uno::UNO_QUERY);
+ if( xBrdcst.is() && xModel.is() )
+ {
+ SwClientIter aIter( *pFmt );
+ SwXOLEListener* pListener = (SwXOLEListener*)aIter.
+ First( TYPE( SwXOLEListener ));
+ //create a new one if the OLE object doesn't have one already
+ if( !pListener )
+ {
+ uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
+ xBrdcst->addModifyListener( xOLEListener );
+ }
+ }
+ }
+ }
+ return xRet;
+}
+
+/* --18.05.2006 16:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+
+uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
+ throw( uno::RuntimeException )
+{
+ uno::Reference< embed::XEmbeddedObject > xResult;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
+ ->GetIndex() + 1 ]->GetOLENode();
+ xResult = pOleNode->GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xResult ) )
+ {
+ // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
+ if ( pDoc->GetDocShell() )
+ pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult, embed::Aspects::MSOLE_CONTENT ) );
+
+ uno::Reference < lang::XComponent > xComp( xResult->getComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifyBroadcaster > xBrdcst( xComp, uno::UNO_QUERY);
+ uno::Reference< frame::XModel > xModel( xComp, uno::UNO_QUERY);
+ if( xBrdcst.is() && xModel.is() )
+ {
+ SwClientIter aIter( *pFmt );
+ SwXOLEListener* pListener = (SwXOLEListener*)aIter.
+ First( TYPE( SwXOLEListener ));
+ //create a new one if the OLE object doesn't have one already
+ if( !pListener )
+ {
+ uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
+ xBrdcst->addModifyListener( xOLEListener );
+ }
+ }
+ }
+ }
+ return xResult;
+}
+
+sal_Int64 SAL_CALL SwXTextEmbeddedObject::getAspect() throw (uno::RuntimeException)
+{
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ return pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
+ }
+
+ return embed::Aspects::MSOLE_CONTENT; // return the default value
+}
+
+void SAL_CALL SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect ) throw (uno::RuntimeException)
+{
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect );
+ }
+}
+
+uno::Reference< graphic::XGraphic > SAL_CALL SwXTextEmbeddedObject::getReplacementGraphic() throw (uno::RuntimeException)
+{
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ Graphic* pGraphic = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
+ if ( pGraphic )
+ return pGraphic->GetXGraphic();
+ }
+
+ return uno::Reference< graphic::XGraphic >();
+}
+
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextEmbeddedObject::getImplementationName(void) throw( uno::RuntimeException )
+
+{
+ return C2U("SwXTextEmbeddedObject");
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextEmbeddedObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextEmbeddedObject")||
+ SwXFrame::supportsService(rServiceName);
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextEmbeddedObject::getSupportedServiceNames(void)
+ throw( uno::RuntimeException )
+{
+ uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
+ aRet.realloc(aRet.getLength() + 1);
+ OUString* pArray = aRet.getArray();
+ pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextEmbeddedObject");
+ return aRet;
+}
+/* -----------------------------20.06.00 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void * SAL_CALL SwXTextEmbeddedObject::operator new( size_t t) throw()
+{
+ return SwXTextEmbeddedObjectBaseClass::operator new(t);
+}
+/* -----------------------------20.06.00 10:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextEmbeddedObject::operator delete( void * p) throw()
+{
+ SwXTextEmbeddedObjectBaseClass::operator delete(p);
+}
+/* -----------------------------15.12.00 12:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<container::XNameReplace> SAL_CALL
+ SwXTextEmbeddedObject::getEvents()
+ throw(uno::RuntimeException)
+{
+ return new SwFrameEventDescriptor( *this );
+}
+
+
+/******************************************************************
+ *
+ ******************************************************************/
+TYPEINIT1(SwXOLEListener, SwClient);
+/* -----------------------------18.01.2002 09:59------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXOLEListener::SwXOLEListener( SwFmt& rOLEFmt, uno::Reference< XModel > xOLE) :
+ SwClient(&rOLEFmt),
+ xOLEModel(xOLE)
+{
+}
+/* -----------------------------18.01.2002 09:59------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXOLEListener::~SwXOLEListener()
+{}
+
+void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwOLENode* pNd = 0;
+ SwFmt* pFmt = GetFmt();
+ if(pFmt)
+ {const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ pNd = pNoTxt->GetOLENode();
+ }
+ }
+ if(!pNd)
+ throw uno::RuntimeException();
+
+ uno::Reference < embed::XEmbeddedObject > xIP = pNd->GetOLEObj().GetOleRef();
+ if ( xIP.is() )
+ {
+ sal_Int32 nState = xIP->getCurrentState();
+ if ( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE )
+ return;
+ }
+
+ // if the OLE-Node is UI-Active do nothing
+ pNd->SetOLESizeInvalid( sal_True );
+ pNd->GetDoc()->SetOLEObjModified();
+}
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXOLEListener::disposing( const lang::EventObject& rEvent )
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< util::XModifyListener > xListener( this );
+
+
+ uno::Reference< frame::XModel > xModel( rEvent.Source, uno::UNO_QUERY );
+ uno::Reference< util::XModifyBroadcaster > xBrdcst(xModel, uno::UNO_QUERY);
+
+ try
+ {
+ if( xBrdcst.is() )
+ xBrdcst->removeModifyListener( xListener );
+ }
+ catch(uno::Exception const &)
+ {
+ DBG_ERROR("OLE Listener couldn't be removed");
+ }
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXOLEListener::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ xOLEModel = 0;
+}
+
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
new file mode 100644
index 000000000000..d0d74fa023c7
--- /dev/null
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -0,0 +1,732 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <rtl/uuid.h>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <unomid.h>
+#include <unofootnote.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unoparagraph.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unoevtlstnr.hxx>
+#include <doc.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <ndtxt.hxx>
+#include <unocrsr.hxx>
+#include <hints.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/******************************************************************
+ * SwXFootnote
+ ******************************************************************/
+
+class SwXFootnote::Impl
+ : public SwClient
+{
+
+public:
+
+ SwXFootnote & m_rThis;
+ const bool m_bIsEndnote;
+ SwEventListenerContainer m_ListenerContainer;
+ bool m_bIsDescriptor;
+ const SwFmtFtn * m_pFmtFtn;
+ ::rtl::OUString m_sLabel;
+
+ Impl( SwXFootnote & rThis,
+ SwDoc *const pDoc, SwFmtFtn const*const pFootnote,
+ const bool bIsEndnote)
+ : SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0)
+ , m_rThis(rThis)
+ , m_bIsEndnote(bIsEndnote)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+// #i111177#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
+// , m_bIsDescriptor(0 == pFootnote)
+ , m_bIsDescriptor((0 == pFootnote) ? true : false)
+ , m_pFmtFtn(pFootnote)
+ {
+ }
+
+ const SwFmtFtn* GetFootnoteFormat() const {
+ return m_rThis.GetDoc() ? m_pFmtFtn : 0;
+ }
+
+ SwFmtFtn const& GetFootnoteFormatOrThrow() {
+ SwFmtFtn const*const pFootnote( GetFootnoteFormat() );
+ if (!pFootnote) {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXFootnote: disposed or invalid")), 0);
+ }
+ return *pFootnote;
+ }
+
+ void Invalidate();
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/* -----------------------------07.01.00 12:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXFootnote::Impl::Invalidate()
+{
+ if (GetRegisteredIn())
+ {
+ const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ }
+ m_ListenerContainer.Disposing();
+ m_pFmtFtn = 0;
+ m_rThis.SetDoc(0);
+}
+
+/* -----------------18.01.99 09:12-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFootnote::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn()) // removed => dispose
+ {
+ Invalidate();
+ }
+ else if (pOld)
+ {
+ switch (pOld->Which())
+ {
+ case RES_FOOTNOTE_DELETED:
+ if (static_cast<const void*>(m_pFmtFtn) ==
+ static_cast<SwPtrMsgPoolItem *>(pOld)->pObject)
+ {
+ Invalidate();
+ }
+ break;
+ }
+ }
+}
+
+/*-- 10.12.98 15:31:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnote::SwXFootnote(const bool bEndnote)
+ : SwXText(0, CURSOR_FOOTNOTE)
+ , m_pImpl( new SwXFootnote::Impl(*this, 0, 0, bEndnote) )
+{
+}
+/*-- 10.12.98 15:31:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnote::SwXFootnote(SwDoc & rDoc, const SwFmtFtn& rFmt)
+ : SwXText(& rDoc, CURSOR_FOOTNOTE)
+ , m_pImpl( new SwXFootnote::Impl(*this, &rDoc, &rFmt, rFmt.IsEndNote()) )
+{
+}
+/*-- 10.12.98 15:31:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnote::~SwXFootnote()
+{
+}
+
+SwXFootnote *
+SwXFootnote::GetXFootnote(
+ SwModify const& /*rUnoCB*/, SwFmtFtn const& /*rFootnoteFmt*/)
+{
+ // re-use existing SwXFootnote
+ // #i105557#: do not iterate over the registered clients: race condition
+ // to do this properly requires the SwXFootnote to register at the
+ // SwFmtFtn directly, not at the unocallback
+ // also this function must return a uno Reference!
+#if 0
+ SwClientIter aIter( rUnoCB );
+ SwXFootnote::Impl * pXFootnote = static_cast<SwXFootnote::Impl*>(
+ aIter.First( TYPE( SwXFootnote::Impl )));
+ while (pXFootnote)
+ {
+ SwDoc *const pDoc = pXFootnote->m_rThis.GetDoc();
+ if (pDoc)
+ {
+ SwFmtFtn const*const pFtn = pXFootnote->GetFootnoteFormat();
+ if (pFtn == &rFootnoteFmt)
+ {
+ return & pXFootnote->m_rThis;
+ }
+ }
+ pXFootnote = static_cast<SwXFootnote::Impl*>(aIter.Next());
+ }
+#endif
+ return 0;
+}
+
+SwXFootnote *
+SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFmtFtn const& rFootnoteFmt)
+{
+ SwXFootnote *const pXFootnote(
+ GetXFootnote(*rDoc.GetUnoCallBack(), rFootnoteFmt));
+ return (pXFootnote)
+ ? pXFootnote
+ : new SwXFootnote(rDoc, rFootnoteFmt);
+}
+
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXFootnote::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXFootnote::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXFootnote>(rId, this) );
+ return (nRet) ? nRet : SwXText::getSomething(rId);
+}
+
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXFootnote::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXFootnote");
+}
+
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesFootnote[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.Footnote",
+ "com.sun.star.text.Text",
+ "com.sun.star.text.Endnote", // NB: only supported for endnotes!
+};
+static const size_t g_nServicesEndnote(
+ sizeof(g_ServicesFootnote)/sizeof(g_ServicesFootnote[0]));
+static const size_t g_nServicesFootnote( g_nServicesEndnote - 1 ); // NB: omit!
+
+sal_Bool SAL_CALL SwXFootnote::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return ::sw::SupportsServiceImpl(
+ (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
+ g_ServicesFootnote, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXFootnote::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return ::sw::GetSupportedServiceNamesImpl(
+ (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
+ g_ServicesFootnote);
+}
+
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL
+SwXFootnote::getTypes() throw (uno::RuntimeException)
+{
+ const uno::Sequence< uno::Type > aTypes = SwXFootnote_Base::getTypes();
+ const uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+ return ::comphelper::concatSequences(aTypes, aTextTypes);
+}
+
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL
+SwXFootnote::getImplementationId() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------21.03.00 15:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXFootnote::queryInterface(const uno::Type& rType)
+throw (uno::RuntimeException)
+{
+ const uno::Any ret = SwXFootnote_Base::queryInterface(rType);
+ return (ret.getValueType() == ::getCppuVoidType())
+ ? SwXText::queryInterface(rType)
+ : ret;
+}
+
+/*-- 10.12.98 15:31:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXFootnote::getLabel() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ::rtl::OUString sRet;
+ SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
+ if(pFmt)
+ {
+ sRet = pFmt->GetNumStr();
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ sRet = m_pImpl->m_sLabel;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return sRet;
+}
+
+/*-- 10.12.98 15:31:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ DBG_ASSERT(pTxtFtn, "kein TextNode?");
+ SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
+
+ SwPaM aPam(rTxtNode, *pTxtFtn->GetStart());
+ GetDoc()->SetCurFtn(aPam, aLabel, pFmt->GetNumber(), pFmt->IsEndNote());
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_sLabel = String(aLabel);
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/* -----------------18.02.99 13:32-------------------
+ *
+ * --------------------------------------------------*/
+void SAL_CALL
+SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
+ xTextRange, uno::UNO_QUERY);
+ SwXTextRange *const pRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ SwDoc *const pNewDoc =
+ (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
+ if (!pNewDoc)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwUnoInternalPaM aPam(*pNewDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+
+ UnoActionContext aCont(pNewDoc);
+ pNewDoc->DeleteAndJoin(aPam);
+ aPam.DeleteMark();
+ SwFmtFtn aFootNote(m_pImpl->m_bIsEndnote);
+ if (m_pImpl->m_sLabel.getLength())
+ {
+ aFootNote.SetNumStr(m_pImpl->m_sLabel);
+ }
+
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints( (pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ : nsSetAttrMode::SETATTR_DEFAULT;
+
+ pNewDoc->InsertPoolItem(aPam, aFootNote, nInsertFlags);
+
+ SwTxtFtn *const pTxtAttr = static_cast<SwTxtFtn*>(
+ aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN ));
+
+ if (pTxtAttr)
+ {
+ const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
+ m_pImpl->m_pFmtFtn = &rFtn;
+ pNewDoc->GetUnoCallBack()->Add(m_pImpl.get());
+ // force creation of sequence id - is used for references
+ if (pNewDoc->IsInReading())
+ {
+ pTxtAttr->SetSeqNo(pNewDoc->GetFtnIdxs().Count());
+ }
+ else
+ {
+ pTxtAttr->SetSeqRefNo();
+ }
+ }
+ m_pImpl->m_bIsDescriptor = sal_False;
+ SetDoc(pNewDoc);
+}
+
+/*-- 10.12.98 15:31:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXFootnote::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
+
+ SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
+ SwPaM aPam( pTxtFtn->GetTxtNode(), *pTxtFtn->GetStart() );
+ SwPosition aMark( *aPam.Start() );
+ aPam.SetMark();
+ aPam.GetMark()->nContent++;
+ const uno::Reference< text::XTextRange > xRet =
+ SwXTextRange::CreateXTextRange(*GetDoc(), *aPam.Start(), aPam.End());
+ return xRet;
+}
+/*-- 10.12.98 15:31:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXFootnote::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
+
+ SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
+ DBG_ASSERT(pTxtFtn, "no TextNode?");
+ SwTxtNode& rTxtNode = const_cast<SwTxtNode&>(pTxtFtn->GetTxtNode());
+ const xub_StrLen nPos = *pTxtFtn->GetStart();
+ SwPaM aPam(rTxtNode, nPos, rTxtNode, nPos+1);
+ GetDoc()->DeleteAndJoin( aPam );
+}
+
+/*-- 10.12.98 15:31:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXFootnote::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetFootnoteFormat())
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+/*-- 10.12.98 15:31:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXFootnote::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetFootnoteFormat() ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/* -----------------06.05.99 15:31-------------------
+ *
+ * --------------------------------------------------*/
+const SwStartNode *SwXFootnote::GetStartNode() const
+{
+ SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ if( pTxtFtn )
+ {
+ return pTxtFtn->GetStartNode()->GetNode().GetStartNode();
+ }
+ }
+ return 0;
+}
+
+uno::Reference< text::XTextCursor >
+SwXFootnote::CreateCursor() throw (uno::RuntimeException)
+{
+ return createTextCursor();
+}
+
+/*-- 10.12.98 15:31:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXFootnote::createTextCursor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
+
+ SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
+ SwPosition aPos( *pTxtFtn->GetStartNode() );
+ SwXTextCursor *const pXCursor =
+ new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos);
+ SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ const uno::Reference< text::XTextCursor > xRet =
+ static_cast<text::XWordCursor*>(pXCursor);
+ return xRet;
+}
+
+/*-- 10.12.98 15:31:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXFootnote::createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & xTextPosition)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
+
+ SwUnoInternalPaM aPam(*GetDoc());
+ if (!::sw::XTextRangeToSwPaM(aPam, xTextPosition))
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
+ SwNode const*const pFtnStartNode = &pTxtFtn->GetStartNode()->GetNode();
+
+ const SwNode* pStart = aPam.GetNode()->FindFootnoteStartNode();
+ if (pStart != pFtnStartNode)
+ {
+ throw uno::RuntimeException();
+ }
+
+ const uno::Reference< text::XTextCursor > xRet =
+ static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE,
+ *aPam.GetPoint(), aPam.GetMark()));
+ return xRet;
+}
+
+/*-- 13.06.00 14:28:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXFootnote::createEnumeration() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
+
+ SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
+ SwPosition aPos( *pTxtFtn->GetStartNode() );
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(aPos, sal_False));
+ pUnoCursor->Move(fnMoveForward, fnGoNode);
+ const uno::Reference< container::XEnumeration > xRet =
+ new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FOOTNOTE);
+ return xRet;
+}
+
+/*-- 13.06.00 14:28:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXFootnote::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+/*-- 13.06.00 14:28:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXFootnote::hasElements() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+/*-- 11.09.00 13:12:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXFootnote::getPropertySetInfo()
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ static uno::Reference< beans::XPropertySetInfo > xRet =
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_FOOTNOTE)
+ ->getPropertySetInfo();
+ return xRet;
+}
+
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXFootnote::setPropertyValue(const ::rtl::OUString&, const uno::Any&)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ //no values to be set
+ throw lang::IllegalArgumentException();
+}
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXFootnote::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
+ {
+ if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE)) ||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
+ {
+ //redline can only be returned if it's a living object
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ aRet = SwXText::getPropertyValue(rPropertyName);
+ }
+ }
+ else if (rPropertyName.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_REFERENCE_ID)))
+ {
+ SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
+ if (pFmt)
+ {
+ SwTxtFtn const*const pTxtFtn = pFmt->GetTxtFtn();
+ DBG_ASSERT(pTxtFtn, "no TextNode?");
+ aRet <<= static_cast<sal_Int16>(pTxtFtn->GetSeqRefNo());
+ }
+ }
+ else
+ {
+ beans::UnknownPropertyException aExcept;
+ aExcept.Message = rPropertyName;
+ throw aExcept;
+ }
+ }
+ return aRet;
+}
+
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXFootnote::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXFootnote::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXFootnote::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXFootnote::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXFootnote::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXFootnote::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXFootnote::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXFootnote::removeVetoableChangeListener(): not implemented");
+}
+
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
new file mode 100644
index 000000000000..94ee14450f08
--- /dev/null
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -0,0 +1,3451 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/ChapterFormat.hpp>
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+
+#include <tools/debug.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/text/ChapterFormat.hpp>
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <hints.hxx>
+#include <cmdid.h>
+#include <swtypes.hxx>
+#include <shellres.hxx>
+#include <viewsh.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <poolfmt.hxx>
+#include <poolfmt.hrc>
+#include <pagedesc.hxx>
+#include <fmtcntnt.hxx>
+#include <unomap.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unosection.hxx>
+#include <doctxm.hxx>
+#include <txttxmrk.hxx>
+#include <unocrsr.hxx>
+#include <unostyle.hxx>
+#include <ndtxt.hxx>
+#include <unoidx.hxx>
+#include <docsh.hxx>
+#include <chpfld.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <unoevtlstnr.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+//-----------------------------------------------------------------------------
+static OUString
+lcl_AnyToString(uno::Any const& rVal) throw (lang::IllegalArgumentException)
+{
+ OUString sRet;
+ if(!(rVal >>= sRet))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ return sRet;
+}
+//-----------------------------------------------------------------------------
+static sal_Int16
+lcl_AnyToInt16(uno::Any const& rVal) throw (lang::IllegalArgumentException)
+{
+ sal_Int16 nRet = 0;
+ if(!(rVal >>= nRet))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ return nRet;
+}
+//-----------------------------------------------------------------------------
+static sal_Bool
+lcl_AnyToBool(uno::Any const& rVal) throw (lang::IllegalArgumentException)
+{
+ sal_Bool bRet = sal_False;
+ if(!(rVal >>= bRet))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ return bRet;
+}
+
+static void
+lcl_AnyToBitMask(uno::Any const& rValue,
+ sal_uInt16 & rBitMask, const sal_uInt16 nBit)
+throw (lang::IllegalArgumentException)
+{
+ rBitMask = lcl_AnyToBool(rValue)
+ ? (rBitMask | nBit)
+ : (rBitMask & ~nBit);
+}
+static void
+lcl_BitMaskToAny(uno::Any & o_rValue,
+ const sal_uInt16 nBitMask, const sal_uInt16 nBit)
+{
+ const sal_Bool bRet = 0 != (nBitMask & nBit);
+ o_rValue <<= bRet;
+}
+
+//-----------------------------------------------------------------------------
+static void
+lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName)
+{
+ const sal_uInt16 nUserCount = pDoc->GetTOXTypeCount( TOX_USER );
+ const SwTOXType* pNewType = 0;
+ for(sal_uInt16 nUser = 0; nUser < nUserCount; nUser++)
+ {
+ const SwTOXType* pType = pDoc->GetTOXType( TOX_USER, nUser );
+ if(pType->GetTypeName().Equals((String)rNewName))
+ {
+ pNewType = pType;
+ break;
+ }
+ }
+ if(!pNewType)
+ {
+ SwTOXType aNewType(TOX_USER, rNewName);
+ pNewType = pDoc->InsertTOXType( aNewType );
+ }
+ //has to be non-const-casted
+ ((SwTOXType*)pNewType)->Add(&rTOXBase);
+}
+//-----------------------------------------------------------------------------
+static const char cUserDefined[] = "User-Defined";
+static const char cUserSuffix[] = " (user)";
+#define USER_LEN 12
+#define USER_AND_SUFFIXLEN 19
+
+void lcl_ConvertTOUNameToProgrammaticName(OUString& rTmp)
+{
+ ShellResource* pShellRes = ViewShell::GetShellRes();
+
+ if(rTmp.equals(pShellRes->aTOXUserName))
+ {
+ rTmp = OUString(C2U(cUserDefined));
+ }
+ // if the version is not English but the alternative index's name is
+ // "User-Defined" a " (user)" is appended
+ else if(rTmp.equalsAscii(cUserDefined))
+ {
+ rTmp += C2U(cUserSuffix);
+ }
+}
+//-----------------------------------------------------------------------------
+static void
+lcl_ConvertTOUNameToUserName(OUString& rTmp)
+{
+ ShellResource* pShellRes = ViewShell::GetShellRes();
+ if(rTmp.equalsAscii(cUserDefined))
+ {
+ rTmp = pShellRes->aTOXUserName;
+ }
+ else if(!pShellRes->aTOXUserName.EqualsAscii(cUserDefined) &&
+ USER_AND_SUFFIXLEN == rTmp.getLength())
+ {
+ //make sure that in non-English versions the " (user)" suffix is removed
+ if (rTmp.matchAsciiL(cUserDefined, sizeof(cUserDefined)) &&
+ rTmp.matchAsciiL(cUserSuffix, sizeof(cUserSuffix), USER_LEN))
+ {
+ rTmp = C2U(cUserDefined);
+ }
+ }
+}
+
+/* -----------------13.09.99 16:39-------------------
+
+ --------------------------------------------------*/
+typedef ::cppu::WeakImplHelper2
+< lang::XServiceInfo
+, container::XIndexReplace
+> SwXDocumentIndexStyleAccess_Base;
+
+class SwXDocumentIndex::StyleAccess_Impl
+ : public SwXDocumentIndexStyleAccess_Base
+{
+
+private:
+ /// can be destroyed threadsafely, so no UnoImplPtr here
+ ::rtl::Reference<SwXDocumentIndex> m_xParent;
+
+ virtual ~StyleAccess_Impl();
+
+public:
+ StyleAccess_Impl(SwXDocumentIndex& rParentIdx);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ supportsService(const ::rtl::OUString& rServiceName)
+ throw (uno::RuntimeException);
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
+ virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
+ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException);
+
+ // XIndexReplace
+ virtual void SAL_CALL
+ replaceByIndex(sal_Int32 Index, const uno::Any& rElement)
+ throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException);
+
+};
+
+/* -----------------13.09.99 16:39-------------------
+
+ --------------------------------------------------*/
+typedef ::cppu::WeakImplHelper2
+< lang::XServiceInfo
+, container::XIndexReplace
+> SwXDocumentIndexTokenAccess_Base;
+
+class SwXDocumentIndex::TokenAccess_Impl
+ : public SwXDocumentIndexTokenAccess_Base
+{
+
+private:
+ /// can be destroyed threadsafely, so no UnoImplPtr here
+ ::rtl::Reference<SwXDocumentIndex> m_xParent;
+
+ virtual ~TokenAccess_Impl();
+
+public:
+
+ TokenAccess_Impl(SwXDocumentIndex& rParentIdx);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ supportsService(const ::rtl::OUString& rServiceName)
+ throw (uno::RuntimeException);
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
+ virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
+ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException);
+
+ // XIndexReplace
+ virtual void SAL_CALL
+ replaceByIndex(sal_Int32 Index, const uno::Any& rElement)
+ throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException);
+
+};
+
+
+/******************************************************************
+ * SwXDocumentIndex
+ ******************************************************************/
+
+/* -----------------20.06.98 11:06-------------------
+ *
+ * --------------------------------------------------*/
+class SwDocIndexDescriptorProperties_Impl
+{
+private:
+ ::std::auto_ptr<SwTOXBase> m_pTOXBase;
+ OUString m_sUserTOXTypeName;
+
+public:
+ SwDocIndexDescriptorProperties_Impl(SwTOXType const*const pType);
+
+ SwTOXBase & GetTOXBase() { return *m_pTOXBase; }
+ const OUString& GetTypeName() const { return m_sUserTOXTypeName; }
+ void SetTypeName(const OUString& rSet) { m_sUserTOXTypeName = rSet; }
+};
+/* -----------------20.06.98 11:41-------------------
+ *
+ * --------------------------------------------------*/
+SwDocIndexDescriptorProperties_Impl::SwDocIndexDescriptorProperties_Impl(
+ SwTOXType const*const pType)
+{
+ SwForm aForm(pType->GetType());
+ m_pTOXBase.reset(new SwTOXBase(pType, aForm,
+ nsSwTOXElement::TOX_MARK, pType->GetTypeName()));
+ if(pType->GetType() == TOX_CONTENT || pType->GetType() == TOX_USER)
+ {
+ m_pTOXBase->SetLevel(MAXLEVEL);
+ }
+ m_sUserTOXTypeName = pType->GetTypeName();
+}
+
+static sal_uInt16
+lcl_TypeToPropertyMap_Index(const TOXTypes eType)
+{
+ switch (eType)
+ {
+ case TOX_INDEX: return PROPERTY_MAP_INDEX_IDX;
+ case TOX_CONTENT: return PROPERTY_MAP_INDEX_CNTNT;
+ case TOX_TABLES: return PROPERTY_MAP_INDEX_TABLES;
+ case TOX_ILLUSTRATIONS: return PROPERTY_MAP_INDEX_ILLUSTRATIONS;
+ case TOX_OBJECTS: return PROPERTY_MAP_INDEX_OBJECTS;
+ case TOX_AUTHORITIES: return PROPERTY_MAP_BIBLIOGRAPHY;
+ //case TOX_USER:
+ default:
+ return PROPERTY_MAP_INDEX_USER;
+ }
+}
+
+class SwXDocumentIndex::Impl
+ : public SwClient
+{
+
+public:
+
+ SfxItemPropertySet const& m_rPropSet;
+ const TOXTypes m_eTOXType;
+ SwEventListenerContainer m_ListenerContainer;
+ bool m_bIsDescriptor;
+ SwDoc * m_pDoc;
+ ::std::auto_ptr<SwDocIndexDescriptorProperties_Impl> m_pProps;
+ uno::WeakReference<container::XIndexReplace> m_wStyleAccess;
+ uno::WeakReference<container::XIndexReplace> m_wTokenAccess;
+
+ Impl( SwXDocumentIndex & rThis,
+ SwDoc & rDoc,
+ const TOXTypes eType,
+ SwTOXBaseSection const*const pBaseSection)
+ : SwClient((pBaseSection) ? pBaseSection->GetFmt() : 0)
+ , m_rPropSet(
+ *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Index(eType)))
+ , m_eTOXType(eType)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
+ , m_bIsDescriptor((0 == pBaseSection) ? true : false)
+ , m_pDoc(&rDoc)
+ , m_pProps((m_bIsDescriptor)
+ ? new SwDocIndexDescriptorProperties_Impl(rDoc.GetTOXType(eType, 0))
+ : 0)
+ {
+ }
+
+ SwSectionFmt * GetSectionFmt() const {
+ return static_cast<SwSectionFmt *>(
+ const_cast<SwModify *>(GetRegisteredIn()));
+ }
+
+ SwTOXBase & GetTOXSectionOrThrow() const
+ {
+ SwSectionFmt *const pSectionFmt(GetSectionFmt());
+ SwTOXBase *const pTOXSection( (m_bIsDescriptor)
+ ? &m_pProps->GetTOXBase()
+ : ((pSectionFmt)
+ ? static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection())
+ : 0));
+ if (!pTOXSection)
+ {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXDocumentIndex: disposed or invalid")), 0);
+ }
+ return *pTOXSection;
+ }
+
+ sal_Int32 GetFormMax() const
+ {
+ SwTOXBase & rSection( GetTOXSectionOrThrow() );
+ return (m_bIsDescriptor)
+ ? SwForm::GetFormMaxLevel(m_eTOXType)
+ : rSection.GetTOXForm().GetFormMax();
+ }
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/*-- 14.12.98 09:35:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn())
+ {
+ m_ListenerContainer.Disposing();
+ }
+}
+
+/*-- 14.12.98 09:35:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::SwXDocumentIndex(
+ SwTOXBaseSection const& rBaseSection, SwDoc & rDoc)
+ : m_pImpl( new SwXDocumentIndex::Impl( *this,
+ rDoc, rBaseSection.SwTOXBase::GetType(), & rBaseSection) )
+{
+}
+/* -----------------15.01.99 14:59-------------------
+ *
+ * --------------------------------------------------*/
+SwXDocumentIndex::SwXDocumentIndex(const TOXTypes eType, SwDoc& rDoc)
+ : m_pImpl( new SwXDocumentIndex::Impl( *this, rDoc, eType, 0) )
+{
+}
+
+/*-- 14.12.98 09:35:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::~SwXDocumentIndex()
+{
+}
+
+uno::Reference<text::XDocumentIndex>
+SwXDocumentIndex::CreateXDocumentIndex(
+ SwDoc & rDoc, SwTOXBaseSection const& rSection)
+{
+ // re-use existing SwXDocumentIndex
+ // #i105557#: do not iterate over the registered clients: race condition
+ SwSectionFmt *const pFmt = rSection.GetFmt();
+ uno::Reference<text::XDocumentIndex> xIndex(pFmt->GetXObject(),
+ uno::UNO_QUERY);
+ if (!xIndex.is())
+ {
+ SwXDocumentIndex *const pIndex(new SwXDocumentIndex(rSection, rDoc));
+ xIndex.set(pIndex);
+ pFmt->SetXObject(uno::Reference<uno::XInterface>(xIndex));
+ }
+ return xIndex;
+}
+
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXDocumentIndex::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXDocumentIndex::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXDocumentIndex>(rId, this);
+}
+
+/* -----------------------------06.04.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXDocumentIndex::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXDocumentIndex");
+}
+/* -----------------------------06.04.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXDocumentIndex::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return C2U("com.sun.star.text.BaseIndex") == rServiceName
+ || ((TOX_INDEX == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.DocumentIndex"))
+ || ((TOX_CONTENT == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.ContentIndex"))
+ || ((TOX_USER == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.UserDefinedIndex"))
+ || ((TOX_ILLUSTRATIONS == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.IllustrationsIndex"))
+ || ((TOX_TABLES == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.TableIndex"))
+ || ((TOX_OBJECTS == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.ObjectIndex"))
+ || ((TOX_AUTHORITIES == m_pImpl->m_eTOXType) &&
+ rServiceName.equalsAscii("com.sun.star.text.Bibliography"));
+}
+/* -----------------------------06.04.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXDocumentIndex::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.BaseIndex");
+ switch (m_pImpl->m_eTOXType)
+ {
+ case TOX_INDEX:
+ pArray[1] = C2U("com.sun.star.text.DocumentIndex");
+ break;
+ case TOX_CONTENT:
+ pArray[1] = C2U("com.sun.star.text.ContentIndex");
+ break;
+ case TOX_TABLES:
+ pArray[1] = C2U("com.sun.star.text.TableIndex");
+ break;
+ case TOX_ILLUSTRATIONS:
+ pArray[1] = C2U("com.sun.star.text.IllustrationsIndex");
+ break;
+ case TOX_OBJECTS:
+ pArray[1] = C2U("com.sun.star.text.ObjectIndex");
+ break;
+ case TOX_AUTHORITIES:
+ pArray[1] = C2U("com.sun.star.text.Bibliography");
+ break;
+ //case TOX_USER:
+ default:
+ pArray[1] = C2U("com.sun.star.text.UserDefinedIndex");
+ }
+ return aRet;
+}
+
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXDocumentIndex::getServiceName()
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ USHORT nObjectType = SW_SERVICE_TYPE_INDEX;
+ switch (m_pImpl->m_eTOXType)
+ {
+// case TOX_INDEX: break;
+ case TOX_USER: nObjectType = SW_SERVICE_USER_INDEX;
+ break;
+ case TOX_CONTENT: nObjectType = SW_SERVICE_CONTENT_INDEX;
+ break;
+ case TOX_ILLUSTRATIONS: nObjectType = SW_SERVICE_INDEX_ILLUSTRATIONS;
+ break;
+ case TOX_OBJECTS: nObjectType = SW_SERVICE_INDEX_OBJECTS;
+ break;
+ case TOX_TABLES: nObjectType = SW_SERVICE_INDEX_TABLES;
+ break;
+ case TOX_AUTHORITIES: nObjectType = SW_SERVICE_INDEX_BIBLIOGRAPHY;
+ break;
+ default:
+ break;
+ }
+ return SwXServiceProvider::GetProviderName(nObjectType);
+}
+
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXDocumentIndex::update() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ SwTOXBaseSection *const pTOXBase = (pFmt) ?
+ static_cast<SwTOXBaseSection*>(pFmt->GetSection()) : 0;
+ if(!pTOXBase)
+ {
+ throw uno::RuntimeException();
+ }
+ pTOXBase->Update();
+ // page numbers
+ pTOXBase->UpdatePageNum();
+}
+
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXDocumentIndex::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ const uno::Reference< beans::XPropertySetInfo > xRef =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw beans::PropertyVetoException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: " ))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ SwSectionFmt *const pSectionFmt(m_pImpl->GetSectionFmt());
+ SwTOXBase & rTOXBase( m_pImpl->GetTOXSectionOrThrow() );
+
+ sal_uInt16 nCreate = rTOXBase.GetCreateType();
+ sal_uInt16 nTOIOptions = 0;
+ sal_uInt16 nOLEOptions = rTOXBase.GetOLEOptions();
+ const TOXTypes eTxBaseType = rTOXBase.GetTOXType()->GetType();
+ if (eTxBaseType == TOX_INDEX)
+ {
+ nTOIOptions = rTOXBase.GetOptions();
+ }
+ SwForm aForm(rTOXBase.GetTOXForm());
+ sal_Bool bForm = sal_False;
+ switch (pEntry->nWID)
+ {
+ case WID_IDX_TITLE:
+ {
+ OUString sNewName;
+ if (!(rValue >>= sNewName))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rTOXBase.SetTitle(sNewName);
+ }
+ break;
+ case WID_IDX_NAME:
+ {
+ OUString sNewName;
+ if (!(rValue >>= sNewName))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rTOXBase.SetTOXName(sNewName);
+ }
+ break;
+ case WID_USER_IDX_NAME:
+ {
+ OUString sNewName;
+ if (!(rValue >>= sNewName))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ lcl_ConvertTOUNameToUserName(sNewName);
+ DBG_ASSERT(TOX_USER == eTxBaseType,
+ "tox type name can only be changed for user indexes");
+ if (pSectionFmt)
+ {
+ OUString sTmp = rTOXBase.GetTOXType()->GetTypeName();
+ if (sTmp != sNewName)
+ {
+ lcl_ReAssignTOXType(pSectionFmt->GetDoc(),
+ rTOXBase, sNewName);
+ }
+ }
+ else
+ {
+ m_pImpl->m_pProps->SetTypeName(sNewName);
+ }
+ }
+ break;
+ case WID_IDX_LOCALE:
+ {
+ lang::Locale aLocale;
+ if (!(rValue>>= aLocale))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rTOXBase.SetLanguage(SvxLocaleToLanguage(aLocale));
+ }
+ break;
+ case WID_IDX_SORT_ALGORITHM:
+ {
+ OUString sTmp;
+ if (!(rValue >>= sTmp))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rTOXBase.SetSortAlgorithm(sTmp);
+ }
+ break;
+ case WID_LEVEL:
+ {
+ rTOXBase.SetLevel(lcl_AnyToInt16(rValue));
+ }
+ break;
+ case WID_CREATE_FROM_MARKS:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_MARK);
+ break;
+ case WID_CREATE_FROM_OUTLINE:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_OUTLINELEVEL);
+ break;
+// case WID_PARAGRAPH_STYLE_NAMES :DBG_ERROR("not implemented")
+// break;
+ case WID_CREATE_FROM_CHAPTER:
+ rTOXBase.SetFromChapter(lcl_AnyToBool(rValue));
+ break;
+ case WID_CREATE_FROM_LABELS:
+ rTOXBase.SetFromObjectNames(! lcl_AnyToBool(rValue));
+ break;
+ case WID_PROTECTED:
+ {
+ sal_Bool bSet = lcl_AnyToBool(rValue);
+ rTOXBase.SetProtected(bSet);
+ if (pSectionFmt)
+ {
+ static_cast<SwTOXBaseSection &>(rTOXBase).SetProtect(bSet);
+ }
+ }
+ break;
+ case WID_USE_ALPHABETICAL_SEPARATORS:
+ lcl_AnyToBitMask(rValue, nTOIOptions,
+ nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
+ break;
+ case WID_USE_KEY_AS_ENTRY:
+ lcl_AnyToBitMask(rValue, nTOIOptions,
+ nsSwTOIOptions::TOI_KEY_AS_ENTRY);
+ break;
+ case WID_USE_COMBINED_ENTRIES:
+ lcl_AnyToBitMask(rValue, nTOIOptions,
+ nsSwTOIOptions::TOI_SAME_ENTRY);
+ break;
+ case WID_IS_CASE_SENSITIVE:
+ lcl_AnyToBitMask(rValue, nTOIOptions,
+ nsSwTOIOptions::TOI_CASE_SENSITIVE);
+ break;
+ case WID_USE_P_P:
+ lcl_AnyToBitMask(rValue, nTOIOptions, nsSwTOIOptions::TOI_FF);
+ break;
+ case WID_USE_DASH:
+ lcl_AnyToBitMask(rValue, nTOIOptions, nsSwTOIOptions::TOI_DASH);
+ break;
+ case WID_USE_UPPER_CASE:
+ lcl_AnyToBitMask(rValue, nTOIOptions,
+ nsSwTOIOptions::TOI_INITIAL_CAPS);
+ break;
+ case WID_IS_COMMA_SEPARATED:
+ bForm = sal_True;
+ aForm.SetCommaSeparated(lcl_AnyToBool(rValue));
+ break;
+ case WID_LABEL_CATEGORY:
+ {
+ // convert file-format/API/external programmatic english name
+ // to internal UI name before usage
+ String aName( SwStyleNameMapper::GetSpecialExtraUIName(
+ lcl_AnyToString(rValue) ) );
+ rTOXBase.SetSequenceName( aName );
+ }
+ break;
+ case WID_LABEL_DISPLAY_TYPE:
+ {
+ const sal_Int16 nVal = lcl_AnyToInt16(rValue);
+ sal_uInt16 nSet = CAPTION_COMPLETE;
+ switch (nVal)
+ {
+ case text::ReferenceFieldPart::TEXT:
+ nSet = CAPTION_COMPLETE;
+ break;
+ case text::ReferenceFieldPart::CATEGORY_AND_NUMBER:
+ nSet = CAPTION_NUMBER;
+ break;
+ case text::ReferenceFieldPart::ONLY_CAPTION:
+ nSet = CAPTION_TEXT;
+ break;
+ default:
+ throw lang::IllegalArgumentException();
+ }
+ rTOXBase.SetCaptionDisplay(static_cast<SwCaptionDisplay>(nSet));
+ }
+ break;
+ case WID_USE_LEVEL_FROM_SOURCE:
+ rTOXBase.SetLevelFromChapter(lcl_AnyToBool(rValue));
+ break;
+ case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME:
+ {
+ String aString;
+ SwStyleNameMapper::FillUIName(lcl_AnyToString(rValue),
+ aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
+ rTOXBase.SetMainEntryCharStyle( aString );
+ }
+ break;
+ case WID_CREATE_FROM_TABLES:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TABLE);
+ break;
+ case WID_CREATE_FROM_TEXT_FRAMES:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_FRAME);
+ break;
+ case WID_CREATE_FROM_GRAPHIC_OBJECTS:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_GRAPHIC);
+ break;
+ case WID_CREATE_FROM_EMBEDDED_OBJECTS:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_OLE);
+ break;
+ case WID_CREATE_FROM_STAR_MATH:
+ lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_MATH);
+ break;
+ case WID_CREATE_FROM_STAR_CHART:
+ lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_CHART);
+ break;
+ case WID_CREATE_FROM_STAR_CALC:
+ lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_CALC);
+ break;
+ case WID_CREATE_FROM_STAR_DRAW:
+ lcl_AnyToBitMask(rValue, nOLEOptions,
+ nsSwTOOElements::TOO_DRAW_IMPRESS);
+ break;
+ case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
+ lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_OTHER);
+ break;
+ case WID_PARA_HEAD:
+ {
+ String aString;
+ SwStyleNameMapper::FillUIName( lcl_AnyToString(rValue),
+ aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+ bForm = sal_True;
+ // Header is on Pos 0
+ aForm.SetTemplate( 0, aString );
+ }
+ break;
+ case WID_IS_RELATIVE_TABSTOPS:
+ bForm = sal_True;
+ aForm.SetRelTabPos(lcl_AnyToBool(rValue));
+ break;
+ case WID_PARA_SEP:
+ {
+ String aString;
+ bForm = sal_True;
+ SwStyleNameMapper::FillUIName( lcl_AnyToString(rValue),
+ aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+ aForm.SetTemplate( 1, aString );
+ }
+ break;
+ case WID_CREATE_FROM_PARAGRAPH_STYLES:
+ lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TEMPLATE);
+ break;
+
+ case WID_PARA_LEV1:
+ case WID_PARA_LEV2:
+ case WID_PARA_LEV3:
+ case WID_PARA_LEV4:
+ case WID_PARA_LEV5:
+ case WID_PARA_LEV6:
+ case WID_PARA_LEV7:
+ case WID_PARA_LEV8:
+ case WID_PARA_LEV9:
+ case WID_PARA_LEV10:
+ {
+ bForm = sal_True;
+ // in sdbcx::Index Label 1 begins at Pos 2 otherwise at Pos 1
+ const sal_uInt16 nLPos = rTOXBase.GetType() == TOX_INDEX ? 2 : 1;
+ String aString;
+ SwStyleNameMapper::FillUIName( lcl_AnyToString(rValue),
+ aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+ aForm.SetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1, aString );
+ }
+ break;
+ default:
+ //this is for items only
+ if (WID_PRIMARY_KEY > pEntry->nWID)
+ {
+ const SwAttrSet& rSet =
+ m_pImpl->m_pDoc->GetTOXBaseAttrSet(rTOXBase);
+ SfxItemSet aAttrSet(rSet);
+ m_pImpl->m_rPropSet.setPropertyValue(
+ rPropertyName, rValue, aAttrSet);
+
+ const SwSectionFmts& rSects = m_pImpl->m_pDoc->GetSections();
+ for (sal_uInt16 i = 0; i < rSects.Count(); i++)
+ {
+ const SwSectionFmt* pTmpFmt = rSects[ i ];
+ if (pTmpFmt == pSectionFmt)
+ {
+ SwSectionData tmpData(
+ static_cast<SwTOXBaseSection&>(rTOXBase));
+ m_pImpl->m_pDoc->UpdateSection(i, tmpData, & aAttrSet);
+ break;
+ }
+ }
+ }
+ }
+ rTOXBase.SetCreate(nCreate);
+ rTOXBase.SetOLEOptions(nOLEOptions);
+ if (rTOXBase.GetTOXType()->GetType() == TOX_INDEX)
+ {
+ rTOXBase.SetOptions(nTOIOptions);
+ }
+ if (bForm)
+ {
+ rTOXBase.SetTOXForm(aForm);
+ }
+}
+
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast< cppu::OWeakObject * >(this));
+ }
+
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ SwTOXBase* pTOXBase = 0;
+ if (pSectionFmt)
+ {
+ pTOXBase = static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection());
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ pTOXBase = &m_pImpl->m_pProps->GetTOXBase();
+ }
+ if(pTOXBase)
+ {
+ const sal_uInt16 nCreate = pTOXBase->GetCreateType();
+ const sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
+ const sal_uInt16 nTOIOptions =
+ (pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
+ ? pTOXBase->GetOptions()
+ : 0U;
+ const SwForm& rForm = pTOXBase->GetTOXForm();
+ switch(pEntry->nWID)
+ {
+ case WID_IDX_CONTENT_SECTION:
+ case WID_IDX_HEADER_SECTION :
+ if(WID_IDX_CONTENT_SECTION == pEntry->nWID)
+ {
+ const uno::Reference <text::XTextSection> xContentSect =
+ SwXTextSection::CreateXTextSection( pSectionFmt );
+ aRet <<= xContentSect;
+ }
+ else
+ {
+ SwSections aSectArr;
+ pSectionFmt->GetChildSections(aSectArr,
+ SORTSECT_NOT, FALSE);
+ for(USHORT i = 0; i < aSectArr.Count(); i++)
+ {
+ SwSection* pSect = aSectArr[i];
+ if(pSect->GetType() == TOX_HEADER_SECTION)
+ {
+ const uno::Reference <text::XTextSection> xHeader =
+ SwXTextSection::CreateXTextSection(
+ pSect->GetFmt() );
+ aRet <<= xHeader;
+ break;
+ }
+ }
+ }
+ break;
+ case WID_IDX_TITLE :
+ {
+ OUString uRet(pTOXBase->GetTitle());
+ aRet <<= uRet;
+ break;
+ }
+ case WID_IDX_NAME:
+ aRet <<= OUString(pTOXBase->GetTOXName());
+ break;
+ case WID_USER_IDX_NAME:
+ {
+ OUString sTmp;
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ sTmp = pTOXBase->GetTOXType()->GetTypeName();
+ }
+ else
+ {
+ sTmp = m_pImpl->m_pProps->GetTypeName();
+ }
+ //I18N
+ lcl_ConvertTOUNameToProgrammaticName(sTmp);
+ aRet <<= sTmp;
+ }
+ break;
+ case WID_IDX_LOCALE:
+ aRet <<= SvxCreateLocale(pTOXBase->GetLanguage());
+ break;
+ case WID_IDX_SORT_ALGORITHM:
+ aRet <<= OUString(pTOXBase->GetSortAlgorithm());
+ break;
+ case WID_LEVEL :
+ aRet <<= static_cast<sal_Int16>(pTOXBase->GetLevel());
+ break;
+ case WID_CREATE_FROM_MARKS:
+ lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_MARK);
+ break;
+ case WID_CREATE_FROM_OUTLINE:
+ lcl_BitMaskToAny(aRet, nCreate,
+ nsSwTOXElement::TOX_OUTLINELEVEL);
+ break;
+ case WID_CREATE_FROM_CHAPTER:
+ {
+ const sal_Bool bRet = pTOXBase->IsFromChapter();
+ aRet <<= bRet;
+ }
+ break;
+ case WID_CREATE_FROM_LABELS:
+ {
+ const sal_Bool bRet = ! pTOXBase->IsFromObjectNames();
+ aRet <<= bRet;
+ }
+ break;
+ case WID_PROTECTED:
+ {
+ const sal_Bool bRet = pTOXBase->IsProtected();
+ aRet <<= bRet;
+ }
+ break;
+ case WID_USE_ALPHABETICAL_SEPARATORS:
+ lcl_BitMaskToAny(aRet, nTOIOptions,
+ nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
+ break;
+ case WID_USE_KEY_AS_ENTRY:
+ lcl_BitMaskToAny(aRet, nTOIOptions,
+ nsSwTOIOptions::TOI_KEY_AS_ENTRY);
+ break;
+ case WID_USE_COMBINED_ENTRIES:
+ lcl_BitMaskToAny(aRet, nTOIOptions,
+ nsSwTOIOptions::TOI_SAME_ENTRY);
+ break;
+ case WID_IS_CASE_SENSITIVE:
+ lcl_BitMaskToAny(aRet, nTOIOptions,
+ nsSwTOIOptions::TOI_CASE_SENSITIVE);
+ break;
+ case WID_USE_P_P:
+ lcl_BitMaskToAny(aRet, nTOIOptions, nsSwTOIOptions::TOI_FF);
+ break;
+ case WID_USE_DASH:
+ lcl_BitMaskToAny(aRet, nTOIOptions, nsSwTOIOptions::TOI_DASH);
+ break;
+ case WID_USE_UPPER_CASE:
+ lcl_BitMaskToAny(aRet, nTOIOptions,
+ nsSwTOIOptions::TOI_INITIAL_CAPS);
+ break;
+ case WID_IS_COMMA_SEPARATED:
+ {
+ const sal_Bool bRet = rForm.IsCommaSeparated();
+ aRet <<= bRet;
+ }
+ break;
+ case WID_LABEL_CATEGORY:
+ {
+ // convert internal UI name to
+ // file-format/API/external programmatic english name
+ // before usage
+ String aName( SwStyleNameMapper::GetSpecialExtraProgName(
+ pTOXBase->GetSequenceName() ) );
+ aRet <<= OUString( aName );
+ }
+ break;
+ case WID_LABEL_DISPLAY_TYPE:
+ {
+ sal_Int16 nSet = text::ReferenceFieldPart::TEXT;
+ switch (pTOXBase->GetCaptionDisplay())
+ {
+ case CAPTION_COMPLETE:
+ nSet = text::ReferenceFieldPart::TEXT;
+ break;
+ case CAPTION_NUMBER:
+ nSet = text::ReferenceFieldPart::CATEGORY_AND_NUMBER;
+ break;
+ case CAPTION_TEXT:
+ nSet = text::ReferenceFieldPart::ONLY_CAPTION;
+ break;
+ }
+ aRet <<= nSet;
+ }
+ break;
+ case WID_USE_LEVEL_FROM_SOURCE:
+ {
+ const sal_Bool bRet = pTOXBase->IsLevelFromChapter();
+ aRet <<= bRet;
+ }
+ break;
+ case WID_LEVEL_FORMAT:
+ {
+ uno::Reference< container::XIndexReplace > xTokenAccess(
+ m_pImpl->m_wTokenAccess);
+ if (!xTokenAccess.is())
+ {
+ xTokenAccess = new TokenAccess_Impl(*this);
+ m_pImpl->m_wTokenAccess = xTokenAccess;
+ }
+ aRet <<= xTokenAccess;
+ }
+ break;
+ case WID_LEVEL_PARAGRAPH_STYLES:
+ {
+ uno::Reference< container::XIndexReplace > xStyleAccess(
+ m_pImpl->m_wStyleAccess);
+ if (!xStyleAccess.is())
+ {
+ xStyleAccess = new StyleAccess_Impl(*this);
+ m_pImpl->m_wStyleAccess = xStyleAccess;
+ }
+ aRet <<= xStyleAccess;
+ }
+ break;
+ case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME:
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(
+ pTOXBase->GetMainEntryCharStyle(),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
+ sal_True);
+ aRet <<= OUString( aString );
+ }
+ break;
+ case WID_CREATE_FROM_TABLES:
+ lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_TABLE);
+ break;
+ case WID_CREATE_FROM_TEXT_FRAMES:
+ lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_FRAME);
+ break;
+ case WID_CREATE_FROM_GRAPHIC_OBJECTS:
+ lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_GRAPHIC);
+ break;
+ case WID_CREATE_FROM_EMBEDDED_OBJECTS:
+ lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_OLE);
+ break;
+ case WID_CREATE_FROM_STAR_MATH:
+ lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_MATH);
+ break;
+ case WID_CREATE_FROM_STAR_CHART:
+ lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_CHART);
+ break;
+ case WID_CREATE_FROM_STAR_CALC:
+ lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_CALC);
+ break;
+ case WID_CREATE_FROM_STAR_DRAW:
+ lcl_BitMaskToAny(aRet, nOLEOptions,
+ nsSwTOOElements::TOO_DRAW_IMPRESS);
+ break;
+ case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
+ lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_OTHER);
+ break;
+ case WID_CREATE_FROM_PARAGRAPH_STYLES:
+ lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_TEMPLATE);
+ break;
+ case WID_PARA_HEAD:
+ {
+ //Header steht an Pos 0
+ String aString;
+ SwStyleNameMapper::FillProgName(rForm.GetTemplate( 0 ), aString,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ aRet <<= OUString( aString );
+ }
+ break;
+ case WID_PARA_SEP:
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(
+ rForm.GetTemplate( 1 ),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
+ sal_True);
+ aRet <<= OUString( aString );
+ }
+ break;
+ case WID_PARA_LEV1:
+ case WID_PARA_LEV2:
+ case WID_PARA_LEV3:
+ case WID_PARA_LEV4:
+ case WID_PARA_LEV5:
+ case WID_PARA_LEV6:
+ case WID_PARA_LEV7:
+ case WID_PARA_LEV8:
+ case WID_PARA_LEV9:
+ case WID_PARA_LEV10:
+ {
+ // in sdbcx::Index Label 1 begins at Pos 2 otherwise at Pos 1
+ sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
+ String aString;
+ SwStyleNameMapper::FillProgName(
+ rForm.GetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
+ sal_True);
+ aRet <<= OUString( aString );
+ }
+ break;
+ case WID_IS_RELATIVE_TABSTOPS:
+ {
+ const sal_Bool bRet = rForm.IsRelTabPos();
+ aRet <<= bRet;
+ }
+ break;
+ case WID_INDEX_MARKS:
+ {
+ SwTOXMarks aMarks;
+ SwTOXType const*const pType = pTOXBase->GetTOXType();
+ SwClientIter aIter(*pType);
+ SwTOXMark * pMark =
+ static_cast<SwTOXMark*>(aIter.First(TYPE(SwTOXMark)));
+ while( pMark )
+ {
+ if(pMark->GetTxtTOXMark())
+ {
+ aMarks.C40_INSERT(SwTOXMark, pMark, aMarks.Count());
+ }
+ pMark = static_cast<SwTOXMark*>(aIter.Next());
+ }
+ uno::Sequence< uno::Reference<text::XDocumentIndexMark> >
+ aXMarks(aMarks.Count());
+ uno::Reference<text::XDocumentIndexMark>* pxMarks =
+ aXMarks.getArray();
+ for(USHORT i = 0; i < aMarks.Count(); i++)
+ {
+ pMark = aMarks.GetObject(i);
+ pxMarks[i] = SwXDocumentIndexMark::CreateXDocumentIndexMark(
+ *m_pImpl->m_pDoc,
+ *const_cast<SwTOXType*>(pType), *pMark);
+ }
+ aRet <<= aXMarks;
+ }
+ break;
+ default:
+ //this is for items only
+ if(WID_PRIMARY_KEY > pEntry->nWID)
+ {
+ const SwAttrSet& rSet =
+ m_pImpl->m_pDoc->GetTOXBaseAttrSet(*pTOXBase);
+ aRet = m_pImpl->m_rPropSet.getPropertyValue(
+ rPropertyName, rSet);
+ }
+ }
+ }
+ return aRet;
+}
+
+/*-- 14.12.98 09:35:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndex::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXDocumentIndex::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndex::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXDocumentIndex::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndex::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXDocumentIndex::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndex::removeVetoableChangeListener(): not implemented");
+}
+
+/* -----------------18.02.99 13:39-------------------
+ *
+ * --------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::attach(const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange *const pRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+
+ SwDoc *const pDoc =
+ (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
+ if (!pDoc)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+
+ const SwTOXBase* pOld = pDoc->GetCurTOX( *aPam.Start() );
+ if (pOld)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ UnoActionContext aAction(pDoc);
+ if (aPam.HasMark())
+ {
+ pDoc->DeleteAndJoin(aPam);
+ }
+
+ SwTOXBase & rTOXBase = m_pImpl->m_pProps->GetTOXBase();
+ SwTOXType const*const pTOXType = rTOXBase.GetTOXType();
+ if ((TOX_USER == pTOXType->GetType()) &&
+ !m_pImpl->m_pProps->GetTypeName().equals(pTOXType->GetTypeName()))
+ {
+ lcl_ReAssignTOXType(pDoc, rTOXBase, m_pImpl->m_pProps->GetTypeName());
+ }
+ //TODO: apply Section attributes (columns and background)
+ SwTOXBaseSection const*const pTOX =
+ pDoc->InsertTableOf( *aPam.GetPoint(), rTOXBase, 0, sal_False );
+
+ pDoc->SetTOXBaseName(*pTOX, m_pImpl->m_pProps->GetTOXBase().GetTOXName());
+
+ // update page numbers
+ pTOX->GetFmt()->Add(m_pImpl.get());
+ pTOX->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
+ const_cast<SwTOXBaseSection*>(pTOX)->UpdatePageNum();
+
+ m_pImpl->m_pProps.reset();
+ m_pImpl->m_pDoc = pDoc;
+ m_pImpl->m_bIsDescriptor = sal_False;
+}
+
+/*-- 15.01.99 14:23:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXDocumentIndex::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (!pSectionFmt)
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Reference< text::XTextRange > xRet;
+ SwNodeIndex const*const pIdx( pSectionFmt->GetCntnt().GetCntntIdx() );
+ if (pIdx && pIdx->GetNode().GetNodes().IsDocNodes())
+ {
+ SwPaM aPaM(*pIdx);
+ aPaM.Move( fnMoveForward, fnGoCntnt );
+ aPaM.SetMark();
+ aPaM.GetPoint()->nNode = *pIdx->GetNode().EndOfSectionNode();
+ aPaM.Move( fnMoveBackward, fnGoCntnt );
+ xRet = SwXTextRange::CreateXTextRange(*pSectionFmt->GetDoc(),
+ *aPaM.GetMark(), aPaM.GetPoint());
+ }
+ return xRet;
+}
+
+/*-- 15.01.99 15:46:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_RemoveChildSections(SwSectionFmt& rParentFmt)
+{
+ SwSections aTmpArr;
+ SwDoc *const pDoc = rParentFmt.GetDoc();
+ const sal_uInt16 nCnt = rParentFmt.GetChildSections(aTmpArr, SORTSECT_POS);
+ if( nCnt )
+ {
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
+ {
+ if( aTmpArr[n]->GetFmt()->IsInNodesArr() )
+ {
+ SwSectionFmt* pFmt = aTmpArr[n]->GetFmt();
+ lcl_RemoveChildSections(*pFmt);
+ pDoc->DelSectionFmt( pFmt );
+ }
+ }
+ }
+}
+
+void SAL_CALL SwXDocumentIndex::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (pSectionFmt)
+ {
+ pSectionFmt->GetDoc()->DeleteTOX(
+ *static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection()),
+ sal_True);
+ }
+}
+
+/*-- 15.01.99 15:46:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetRegisteredIn())
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+/*-- 15.01.99 15:46:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetRegisteredIn() ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/* -----------------30.07.99 11:28-------------------
+
+ --------------------------------------------------*/
+OUString SAL_CALL SwXDocumentIndex::getName() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ OUString uRet;
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ uRet = OUString(m_pImpl->m_pProps->GetTOXBase().GetTOXName());
+ }
+ else if(pSectionFmt)
+ {
+ uRet = OUString(pSectionFmt->GetSection()->GetSectionName());
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return uRet;
+}
+/* -----------------30.07.99 11:28-------------------
+
+ --------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::setName(const OUString& rName) throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!rName.getLength())
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->GetTOXBase().SetTOXName(rName);
+ }
+ else if (pSectionFmt)
+ {
+ const bool bSuccess = pSectionFmt->GetDoc()->SetTOXBaseName(
+ *static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection()), rName);
+ if (!bSuccess)
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXDocumentIndex::GetCoreObject()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ return pSectionFmt;
+}
+
+uno::Reference<frame::XModel> SwXDocumentIndex::GetModel()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (pSectionFmt)
+ {
+ SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
+
+/******************************************************************
+ * SwXDocumentIndexMark
+ ******************************************************************/
+/* -----------------21.04.99 09:36-------------------
+ *
+ * --------------------------------------------------*/
+static sal_uInt16
+lcl_TypeToPropertyMap_Mark(const TOXTypes eType)
+{
+ switch (eType)
+ {
+ case TOX_INDEX: return PROPERTY_MAP_INDEX_MARK;
+ case TOX_CONTENT: return PROPERTY_MAP_CNTIDX_MARK;
+ //case TOX_USER:
+ default:
+ return PROPERTY_MAP_USER_MARK;
+ }
+}
+
+class SwXDocumentIndexMark::Impl
+ : public SwClient
+{
+private:
+ bool m_bInReplaceMark;
+
+public:
+
+ SfxItemPropertySet const& m_rPropSet;
+ const TOXTypes m_eTOXType;
+ SwEventListenerContainer m_ListenerContainer;
+ bool m_bIsDescriptor;
+ SwDepend m_TypeDepend;
+ const SwTOXMark * m_pTOXMark;
+ SwDoc * m_pDoc;
+
+ sal_Bool m_bMainEntry;
+ sal_uInt16 m_nLevel;
+ OUString m_sAltText;
+ OUString m_sPrimaryKey;
+ OUString m_sSecondaryKey;
+ OUString m_sTextReading;
+ OUString m_sPrimaryKeyReading;
+ OUString m_sSecondaryKeyReading;
+ OUString m_sUserIndexName;
+
+ Impl( SwXDocumentIndexMark & rThis,
+ SwDoc *const pDoc,
+ const enum TOXTypes eType,
+ SwTOXType *const pType, SwTOXMark const*const pMark)
+ : SwClient(const_cast<SwTOXMark*>(pMark))
+ , m_bInReplaceMark(false)
+ , m_rPropSet(
+ *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Mark(eType)))
+ , m_eTOXType(eType)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+// #i112513#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
+// , m_bIsDescriptor(0 == pMark)
+ , m_bIsDescriptor((0 == pMark) ? true : false)
+ , m_TypeDepend(this, pType)
+ , m_pTOXMark(pMark)
+ , m_pDoc(pDoc)
+ , m_bMainEntry(sal_False)
+ , m_nLevel(0)
+ {
+ }
+
+ SwTOXType * GetTOXType() const {
+ return static_cast<SwTOXType*>(
+ const_cast<SwModify *>(m_TypeDepend.GetRegisteredIn()));
+ }
+
+ void DeleteTOXMark()
+ {
+ m_pDoc->DeleteTOXMark(m_pTOXMark); // calls Invalidate() via Modify!
+ m_pTOXMark = 0;
+ }
+
+ void InsertTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
+ SwXTextCursor const*const pTextCursor);
+
+ void ReplaceTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam)
+ {
+ m_bInReplaceMark = true;
+ DeleteTOXMark();
+ m_bInReplaceMark = false;
+ try {
+ InsertTOXMark(rTOXType, rMark, rPam, 0);
+ } catch (...) {
+ OSL_ENSURE(false, "ReplaceTOXMark() failed!");
+ m_ListenerContainer.Disposing();
+ throw;
+ }
+ }
+
+ void Invalidate();
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+};
+
+/* -----------------------------16.10.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXDocumentIndexMark::Impl::Invalidate()
+{
+ if (GetRegisteredIn())
+ {
+ const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ if (m_TypeDepend.GetRegisteredIn())
+ {
+ const_cast<SwModify*>(m_TypeDepend.GetRegisteredIn())->Remove(
+ &m_TypeDepend);
+ }
+ }
+ if (!m_bInReplaceMark) // #i109983# only dispose on delete, not on replace!
+ {
+ m_ListenerContainer.Disposing();
+ }
+ m_pDoc = 0;
+ m_pTOXMark = 0;
+}
+
+/*-- 14.12.98 10:25:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn()) // removed => dispose
+ {
+ Invalidate();
+ }
+}
+
+/*-- 14.12.98 10:25:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark::SwXDocumentIndexMark(const TOXTypes eToxType)
+ : m_pImpl( new SwXDocumentIndexMark::Impl(*this, 0, eToxType, 0, 0) )
+{
+}
+/*-- 14.12.98 10:25:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark::SwXDocumentIndexMark(SwDoc & rDoc,
+ SwTOXType & rType, SwTOXMark & rMark)
+ : m_pImpl( new SwXDocumentIndexMark::Impl(*this, &rDoc, rType.GetType(),
+ &rType, &rMark) )
+{
+}
+/*-- 14.12.98 10:25:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark::~SwXDocumentIndexMark()
+{
+}
+
+uno::Reference<text::XDocumentIndexMark>
+SwXDocumentIndexMark::CreateXDocumentIndexMark(
+ SwDoc & rDoc, SwTOXType & rType, SwTOXMark & rMark)
+{
+ // re-use existing SwXDocumentIndexMark
+ // NB: xmloff depends on this caching to generate ID from the address!
+ // #i105557#: do not iterate over the registered clients: race condition
+ uno::Reference< text::XDocumentIndexMark > xTOXMark(rMark.GetXTOXMark());
+ if (!xTOXMark.is())
+ {
+ SwXDocumentIndexMark *const pNew =
+ new SwXDocumentIndexMark(rDoc, rType, rMark);
+ xTOXMark.set(pNew);
+ rMark.SetXTOXMark(xTOXMark);
+ }
+ return xTOXMark;
+}
+
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXDocumentIndexMark::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXDocumentIndexMark::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXDocumentIndexMark>(rId, this);
+}
+
+static const sal_Char cBaseMark[] = "com.sun.star.text.BaseIndexMark";
+static const sal_Char cContentMark[] = "com.sun.star.text.ContentIndexMark";
+static const sal_Char cIdxMark[] = "com.sun.star.text.DocumentIndexMark";
+static const sal_Char cIdxMarkAsian[] = "com.sun.star.text.DocumentIndexMarkAsian";
+static const sal_Char cUserMark[] = "com.sun.star.text.UserIndexMark";
+static const sal_Char cTextContent[] = "com.sun.star.text.TextContent";
+
+/* -----------------------------06.04.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXDocumentIndexMark::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXDocumentIndexMark");
+}
+/* -----------------------------06.04.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXDocumentIndexMark::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return rServiceName.equalsAscii(cBaseMark)
+ || rServiceName.equalsAscii(cTextContent)
+ || ((m_pImpl->m_eTOXType == TOX_USER)
+ && rServiceName.equalsAscii(cUserMark))
+ || ((m_pImpl->m_eTOXType == TOX_CONTENT)
+ && rServiceName.equalsAscii(cContentMark))
+ || ((m_pImpl->m_eTOXType == TOX_INDEX)
+ && rServiceName.equalsAscii(cIdxMark))
+ || ((m_pImpl->m_eTOXType == TOX_INDEX)
+ && rServiceName.equalsAscii(cIdxMarkAsian));
+}
+/* -----------------------------06.04.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXDocumentIndexMark::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ const sal_Int32 nCnt = (m_pImpl->m_eTOXType == TOX_INDEX) ? 4 : 3;
+ uno::Sequence< OUString > aRet(nCnt);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U(cBaseMark);
+ pArray[1] = C2U(cTextContent);
+ switch (m_pImpl->m_eTOXType)
+ {
+ case TOX_USER:
+ pArray[2] = C2U(cUserMark);
+ break;
+ case TOX_CONTENT:
+ pArray[2] = C2U(cContentMark);
+ break;
+ case TOX_INDEX:
+ pArray[2] = C2U(cIdxMark);
+ pArray[3] = C2U(cIdxMarkAsian);
+ break;
+
+ default:
+ ;
+ }
+ return aRet;
+}
+
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXDocumentIndexMark::getMarkEntry() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ OUString sRet;
+ SwTOXType *const pType = m_pImpl->GetTOXType();
+ if (pType && m_pImpl->m_pTOXMark)
+ {
+ sRet = OUString(m_pImpl->m_pTOXMark->GetAlternativeText());
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ sRet = m_pImpl->m_sAltText;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return sRet;
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTOXType *const pType = m_pImpl->GetTOXType();
+ if (pType && m_pImpl->m_pTOXMark)
+ {
+ SwTOXMark aMark(*m_pImpl->m_pTOXMark);
+ aMark.SetAlternativeText(rIndexEntry);
+ SwTxtTOXMark const*const pTxtMark =
+ m_pImpl->m_pTOXMark->GetTxtTOXMark();
+ SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
+ aPam.SetMark();
+ if(pTxtMark->GetEnd())
+ {
+ aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ }
+ else
+ aPam.GetPoint()->nContent++;
+
+ m_pImpl->ReplaceTOXMark(*pType, aMark, aPam);
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_sAltText = rIndexEntry;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/* -----------------18.02.99 13:40-------------------
+ *
+ * --------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::attach(
+ const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ const uno::Reference<XUnoTunnel> xRangeTunnel(xTextRange, uno::UNO_QUERY);
+ SwXTextRange *const pRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ SwDoc *const pDoc =
+ (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
+ if (!pDoc)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ const SwTOXType* pTOXType = 0;
+ switch (m_pImpl->m_eTOXType)
+ {
+ case TOX_INDEX:
+ case TOX_CONTENT:
+ pTOXType = pDoc->GetTOXType( m_pImpl->m_eTOXType, 0 );
+ break;
+ case TOX_USER:
+ {
+ if (!m_pImpl->m_sUserIndexName.getLength())
+ {
+ pTOXType = pDoc->GetTOXType( m_pImpl->m_eTOXType, 0 );
+ }
+ else
+ {
+ const sal_uInt16 nCount =
+ pDoc->GetTOXTypeCount(m_pImpl->m_eTOXType);
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwTOXType const*const pTemp =
+ pDoc->GetTOXType( m_pImpl->m_eTOXType, i );
+ if (m_pImpl->m_sUserIndexName ==
+ OUString(pTemp->GetTypeName()))
+ {
+ pTOXType = pTemp;
+ break;
+ }
+ }
+ if (!pTOXType)
+ {
+ SwTOXType aUserType(TOX_USER, m_pImpl->m_sUserIndexName);
+ pTOXType = pDoc->InsertTOXType(aUserType);
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ if (!pTOXType)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+ SwTOXMark aMark (pTOXType);
+ if (m_pImpl->m_sAltText.getLength())
+ {
+ aMark.SetAlternativeText(m_pImpl->m_sAltText);
+ }
+ switch (m_pImpl->m_eTOXType)
+ {
+ case TOX_INDEX:
+ if (m_pImpl->m_sPrimaryKey.getLength())
+ {
+ aMark.SetPrimaryKey(m_pImpl->m_sPrimaryKey);
+ }
+ if (m_pImpl->m_sSecondaryKey.getLength())
+ {
+ aMark.SetSecondaryKey(m_pImpl->m_sSecondaryKey);
+ }
+ if (m_pImpl->m_sTextReading.getLength())
+ {
+ aMark.SetTextReading(m_pImpl->m_sTextReading);
+ }
+ if (m_pImpl->m_sPrimaryKeyReading.getLength())
+ {
+ aMark.SetPrimaryKeyReading(m_pImpl->m_sPrimaryKeyReading);
+ }
+ if (m_pImpl->m_sSecondaryKeyReading.getLength())
+ {
+ aMark.SetSecondaryKeyReading(m_pImpl->m_sSecondaryKeyReading);
+ }
+ aMark.SetMainEntry(m_pImpl->m_bMainEntry);
+ break;
+ case TOX_USER:
+ case TOX_CONTENT:
+ if (USHRT_MAX != m_pImpl->m_nLevel)
+ {
+ aMark.SetLevel(m_pImpl->m_nLevel+1);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ m_pImpl->InsertTOXMark(*const_cast<SwTOXType *>(pTOXType), aMark, aPam,
+ dynamic_cast<SwXTextCursor const*>(pCursor));
+
+ m_pImpl->m_bIsDescriptor = sal_False;
+}
+
+template<typename T> struct NotContainedIn
+{
+ ::std::vector<T> const& m_rVector;
+ explicit NotContainedIn(::std::vector<T> const& rVector)
+ : m_rVector(rVector) { }
+ bool operator() (T const& rT) {
+ return ::std::find(m_rVector.begin(), m_rVector.end(), rT)
+ == m_rVector.end();
+ }
+};
+
+void SwXDocumentIndexMark::Impl::InsertTOXMark(
+ SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
+ SwXTextCursor const*const pTextCursor)
+{
+ SwDoc *const pDoc( rPam.GetDoc() );
+ UnoActionContext aAction(pDoc);
+ bool bMark = *rPam.GetPoint() != *rPam.GetMark();
+ // n.b.: toxmarks must have either alternative text or an extent
+ if (bMark && rMark.GetAlternativeText().Len())
+ {
+ rPam.Normalize(TRUE);
+ rPam.DeleteMark();
+ bMark = false;
+ }
+ // Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden,
+ // deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
+ if (!bMark && !rMark.GetAlternativeText().Len())
+ {
+ rMark.SetAlternativeText( String(' ') );
+ }
+
+ const bool bForceExpandHints( (!bMark && pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ | nsSetAttrMode::SETATTR_DONTEXPAND)
+ : nsSetAttrMode::SETATTR_DONTEXPAND;
+
+ ::std::vector<SwTxtAttr *> oldMarks;
+ if (bMark)
+ {
+ oldMarks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK);
+ }
+
+ pDoc->InsertPoolItem(rPam, rMark, nInsertFlags);
+ if (bMark && *rPam.GetPoint() > *rPam.GetMark())
+ {
+ rPam.Exchange();
+ }
+
+ // rMark was copied into the document pool; now retrieve real format...
+ SwTxtAttr * pTxtAttr(0);
+ if (bMark)
+ {
+ // #i107672#
+ // ensure that we do not retrieve a different mark at the same position
+ ::std::vector<SwTxtAttr *> const newMarks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
+ ::std::vector<SwTxtAttr *>::const_iterator const iter(
+ ::std::find_if(newMarks.begin(), newMarks.end(),
+ NotContainedIn<SwTxtAttr *>(oldMarks)));
+ OSL_ASSERT(newMarks.end() != iter);
+ if (newMarks.end() != iter)
+ {
+ pTxtAttr = *iter;
+ }
+ }
+ else
+ {
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
+ }
+
+ if (!pTxtAttr)
+ {
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXDocumentIndexMark::InsertTOXMark(): cannot insert attribute")),
+ 0);
+ }
+
+ m_pDoc = pDoc;
+ m_pTOXMark = & pTxtAttr->GetTOXMark();
+ const_cast<SwTOXMark*>(m_pTOXMark)->Add(this);
+ const_cast<SwTOXType &>(rTOXType).Add(& m_TypeDepend);
+}
+
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXDocumentIndexMark::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTOXType *const pType = m_pImpl->GetTOXType();
+ if (!pType || !m_pImpl->m_pTOXMark)
+ {
+ throw uno::RuntimeException();
+ }
+ if (!m_pImpl->m_pTOXMark->GetTxtTOXMark())
+ {
+ throw uno::RuntimeException();
+ }
+ const SwTxtTOXMark* pTxtMark = m_pImpl->m_pTOXMark->GetTxtTOXMark();
+ SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
+ aPam.SetMark();
+ if(pTxtMark->GetEnd())
+ {
+ aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ }
+ else
+ {
+ aPam.GetPoint()->nContent++;
+ }
+ const uno::Reference< frame::XModel > xModel =
+ m_pImpl->m_pDoc->GetDocShell()->GetBaseModel();
+ const uno::Reference< text::XTextDocument > xTDoc(xModel, uno::UNO_QUERY);
+ const uno::Reference< text::XTextRange > xRet =
+ new SwXTextRange(aPam, xTDoc->getText());
+
+ return xRet;
+}
+
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTOXType *const pType = m_pImpl->GetTOXType();
+ if (pType && m_pImpl->m_pTOXMark)
+ {
+ m_pImpl->DeleteTOXMark(); // call Invalidate() via modify!
+ }
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetRegisteredIn())
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetRegisteredIn() ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXDocumentIndexMark::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xInfos[3];
+ int nPos = 0;
+ switch (m_pImpl->m_eTOXType)
+ {
+ case TOX_INDEX: nPos = 0; break;
+ case TOX_CONTENT: nPos = 1; break;
+ case TOX_USER: nPos = 2; break;
+ default:
+ ;
+ }
+ if(!xInfos[nPos].is())
+ {
+ const uno::Reference< beans::XPropertySetInfo > xInfo =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ // extend PropertySetInfo!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ xInfos[nPos] = new SfxExtItemPropertySetInfo(
+ aSwMapProvider.GetPropertyMapEntries(
+ PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
+ aPropSeq );
+ }
+ return xInfos[nPos];
+}
+
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw beans::PropertyVetoException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ SwTOXType *const pType = m_pImpl->GetTOXType();
+ if (pType && m_pImpl->m_pTOXMark)
+ {
+ SwTOXMark aMark(*m_pImpl->m_pTOXMark);
+ switch(pEntry->nWID)
+ {
+ case WID_ALT_TEXT:
+ aMark.SetAlternativeText(lcl_AnyToString(rValue));
+ break;
+ case WID_LEVEL:
+ aMark.SetLevel(Min( static_cast<sal_Int8>( MAXLEVEL ),
+ static_cast<sal_Int8>(lcl_AnyToInt16(rValue)+1)));
+ break;
+ case WID_PRIMARY_KEY :
+ aMark.SetPrimaryKey(lcl_AnyToString(rValue));
+ break;
+ case WID_SECONDARY_KEY:
+ aMark.SetSecondaryKey(lcl_AnyToString(rValue));
+ break;
+ case WID_MAIN_ENTRY:
+ aMark.SetMainEntry(lcl_AnyToBool(rValue));
+ break;
+ case WID_TEXT_READING:
+ aMark.SetTextReading(lcl_AnyToString(rValue));
+ break;
+ case WID_PRIMARY_KEY_READING:
+ aMark.SetPrimaryKeyReading(lcl_AnyToString(rValue));
+ break;
+ case WID_SECONDARY_KEY_READING:
+ aMark.SetSecondaryKeyReading(lcl_AnyToString(rValue));
+ break;
+ }
+ SwTxtTOXMark const*const pTxtMark =
+ m_pImpl->m_pTOXMark->GetTxtTOXMark();
+ SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
+ aPam.SetMark();
+ if(pTxtMark->GetEnd())
+ {
+ aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ }
+ else
+ {
+ aPam.GetPoint()->nContent++;
+ }
+
+ m_pImpl->ReplaceTOXMark(*pType, aMark, aPam);
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ switch(pEntry->nWID)
+ {
+ case WID_ALT_TEXT:
+ m_pImpl->m_sAltText = lcl_AnyToString(rValue);
+ break;
+ case WID_LEVEL:
+ {
+ const sal_Int16 nVal = lcl_AnyToInt16(rValue);
+ if(nVal >= 0 && nVal < MAXLEVEL)
+ {
+ m_pImpl->m_nLevel = nVal;
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+ break;
+ case WID_PRIMARY_KEY:
+ m_pImpl->m_sPrimaryKey = lcl_AnyToString(rValue);
+ break;
+ case WID_SECONDARY_KEY:
+ m_pImpl->m_sSecondaryKey = lcl_AnyToString(rValue);
+ break;
+ case WID_TEXT_READING:
+ m_pImpl->m_sTextReading = lcl_AnyToString(rValue);
+ break;
+ case WID_PRIMARY_KEY_READING:
+ m_pImpl->m_sPrimaryKeyReading = lcl_AnyToString(rValue);
+ break;
+ case WID_SECONDARY_KEY_READING:
+ m_pImpl->m_sSecondaryKeyReading = lcl_AnyToString(rValue);
+ break;
+ case WID_USER_IDX_NAME:
+ {
+ OUString sTmp(lcl_AnyToString(rValue));
+ lcl_ConvertTOUNameToUserName(sTmp);
+ m_pImpl->m_sUserIndexName = sTmp;
+ }
+ break;
+ case WID_MAIN_ENTRY:
+ m_pImpl->m_bMainEntry = lcl_AnyToBool(rValue);
+ break;
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXDocumentIndexMark::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ if (::sw::GetDefaultTextContentValue(aRet, rPropertyName, pEntry->nWID))
+ {
+ return aRet;
+ }
+
+ SwTOXType *const pType = m_pImpl->GetTOXType();
+ if (pType && m_pImpl->m_pTOXMark)
+ {
+ switch(pEntry->nWID)
+ {
+ case WID_ALT_TEXT:
+ aRet <<= OUString(m_pImpl->m_pTOXMark->GetAlternativeText());
+ break;
+ case WID_LEVEL:
+ aRet <<= static_cast<sal_Int16>(
+ m_pImpl->m_pTOXMark->GetLevel() - 1);
+ break;
+ case WID_PRIMARY_KEY :
+ aRet <<= OUString(m_pImpl->m_pTOXMark->GetPrimaryKey());
+ break;
+ case WID_SECONDARY_KEY:
+ aRet <<= OUString(m_pImpl->m_pTOXMark->GetSecondaryKey());
+ break;
+ case WID_TEXT_READING:
+ aRet <<= OUString(m_pImpl->m_pTOXMark->GetTextReading());
+ break;
+ case WID_PRIMARY_KEY_READING:
+ aRet <<= OUString(m_pImpl->m_pTOXMark->GetPrimaryKeyReading());
+ break;
+ case WID_SECONDARY_KEY_READING:
+ aRet <<= OUString(
+ m_pImpl->m_pTOXMark->GetSecondaryKeyReading());
+ break;
+ case WID_USER_IDX_NAME :
+ {
+ OUString sTmp(pType->GetTypeName());
+ lcl_ConvertTOUNameToProgrammaticName(sTmp);
+ aRet <<= sTmp;
+ }
+ break;
+ case WID_MAIN_ENTRY:
+ {
+ const sal_Bool bTemp = m_pImpl->m_pTOXMark->IsMainEntry();
+ aRet <<= bTemp;
+ }
+ break;
+ }
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ switch(pEntry->nWID)
+ {
+ case WID_ALT_TEXT:
+ aRet <<= m_pImpl->m_sAltText;
+ break;
+ case WID_LEVEL:
+ aRet <<= static_cast<sal_Int16>(m_pImpl->m_nLevel);
+ break;
+ case WID_PRIMARY_KEY:
+ aRet <<= m_pImpl->m_sPrimaryKey;
+ break;
+ case WID_SECONDARY_KEY:
+ aRet <<= m_pImpl->m_sSecondaryKey;
+ break;
+ case WID_TEXT_READING:
+ aRet <<= m_pImpl->m_sTextReading;
+ break;
+ case WID_PRIMARY_KEY_READING:
+ aRet <<= m_pImpl->m_sPrimaryKeyReading;
+ break;
+ case WID_SECONDARY_KEY_READING:
+ aRet <<= m_pImpl->m_sSecondaryKeyReading;
+ break;
+ case WID_USER_IDX_NAME :
+ aRet <<= m_pImpl->m_sUserIndexName;
+ break;
+ case WID_MAIN_ENTRY:
+ {
+ aRet <<= static_cast<sal_Bool>(m_pImpl->m_bMainEntry);
+ }
+ break;
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndexMark::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndexMark::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXDocumentIndexMark::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndexMark::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXDocumentIndexMark::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndexMark::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXDocumentIndexMark::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXDocumentIndexMark::removeVetoableChangeListener(): not implemented");
+}
+
+
+/******************************************************************
+ * SwXDocumentIndexes
+ ******************************************************************/
+/*-- 05.05.99 13:14:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexes::SwXDocumentIndexes(SwDoc *const _pDoc)
+ : SwUnoCollection(_pDoc)
+{
+}
+/*-- 05.05.99 13:15:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexes::~SwXDocumentIndexes()
+{
+}
+
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXDocumentIndexes::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXDocumentIndexes");
+}
+
+static char const*const g_ServicesDocumentIndexes[] =
+{
+ "com.sun.star.text.DocumentIndexes",
+};
+static const size_t g_nServicesDocumentIndexes(
+ sizeof(g_ServicesDocumentIndexes)/sizeof(g_ServicesDocumentIndexes[0]));
+
+sal_Bool SAL_CALL
+SwXDocumentIndexes::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesDocumentIndexes, g_ServicesDocumentIndexes, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXDocumentIndexes::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesDocumentIndexes, g_ServicesDocumentIndexes);
+}
+
+/*-- 05.05.99 13:15:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SAL_CALL
+SwXDocumentIndexes::getCount() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ sal_uInt32 nRet = 0;
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() )
+ {
+ ++nRet;
+ }
+ }
+ return nRet;
+}
+
+/*-- 05.05.99 13:15:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXDocumentIndexes::getByIndex(sal_Int32 nIndex)
+throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ sal_Int32 nIdx = 0;
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() &&
+ nIdx++ == nIndex )
+ {
+ const uno::Reference< text::XDocumentIndex > xTmp =
+ SwXDocumentIndex::CreateXDocumentIndex(
+ *GetDoc(), static_cast<SwTOXBaseSection const&>(*pSect));
+ uno::Any aRet;
+ aRet <<= xTmp;
+ return aRet;
+ }
+ }
+
+ throw lang::IndexOutOfBoundsException();
+}
+
+/*-- 31.01.00 10:12:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXDocumentIndexes::getByName(const OUString& rName)
+throw (container::NoSuchElementException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ String sToFind(rName);
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() &&
+ (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()
+ == sToFind))
+ {
+ const uno::Reference< text::XDocumentIndex > xTmp =
+ SwXDocumentIndex::CreateXDocumentIndex(
+ *GetDoc(), static_cast<SwTOXBaseSection const&>(*pSect));
+ uno::Any aRet;
+ aRet <<= xTmp;
+ return aRet;
+ }
+ }
+ throw container::NoSuchElementException();
+}
+
+/*-- 31.01.00 10:12:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXDocumentIndexes::getElementNames() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ sal_Int32 nCount = 0;
+ sal_uInt16 n;
+ for( n = 0; n < rFmts.Count(); ++n )
+ {
+ SwSection const*const pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() )
+ {
+ ++nCount;
+ }
+ }
+
+ uno::Sequence< OUString > aRet(nCount);
+ OUString* pArray = aRet.getArray();
+ sal_uInt16 nCnt;
+ for( n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+ {
+ SwSection const*const pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode())
+ {
+ pArray[nCnt++] = OUString(
+ static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName());
+ }
+ }
+ return aRet;
+}
+
+/*-- 31.01.00 10:12:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXDocumentIndexes::hasByName(const OUString& rName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ String sToFind(rName);
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ SwSection const*const pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode())
+ {
+ if (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()
+ == sToFind)
+ {
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+/*-- 05.05.99 13:15:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL
+SwXDocumentIndexes::getElementType() throw (uno::RuntimeException)
+{
+ return text::XDocumentIndex::static_type();
+}
+/*-- 05.05.99 13:15:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXDocumentIndexes::hasElements() throw (uno::RuntimeException)
+{
+ return 0 != getCount();
+}
+
+/******************************************************************
+ * SwXDocumentIndex::StyleAccess_Impl
+ ******************************************************************/
+
+/*-- 13.09.99 16:52:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::StyleAccess_Impl::StyleAccess_Impl(
+ SwXDocumentIndex& rParentIdx)
+ : m_xParent(&rParentIdx)
+{
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::StyleAccess_Impl::~StyleAccess_Impl()
+{
+}
+
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::getImplementationName()
+throw (uno::RuntimeException)
+{
+ return C2U("SwXDocumentIndex::StyleAccess_Impl");
+}
+
+static char const*const g_ServicesIndexStyleAccess[] =
+{
+ "com.sun.star.text.DocumentIndexParagraphStyles",
+};
+static const size_t g_nServicesIndexStyleAccess(
+ sizeof(g_ServicesIndexStyleAccess)/sizeof(g_ServicesIndexStyleAccess[0]));
+
+sal_Bool SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::supportsService(
+ const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesIndexStyleAccess, g_ServicesIndexStyleAccess, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::getSupportedServiceNames()
+throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesIndexStyleAccess, g_ServicesIndexStyleAccess);
+}
+
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::replaceByIndex(
+ sal_Int32 nIndex, const uno::Any& rElement)
+throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(nIndex < 0 || nIndex > MAXLEVEL)
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
+
+ uno::Sequence<OUString> aSeq;
+ if(!(rElement >>= aSeq))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ const sal_Int32 nStyles = aSeq.getLength();
+ const OUString* pStyles = aSeq.getConstArray();
+ String sSetStyles;
+ String aString;
+ for(sal_Int32 i = 0; i < nStyles; i++)
+ {
+ if(i)
+ {
+ sSetStyles += TOX_STYLE_DELIMITER;
+ }
+ SwStyleNameMapper::FillUIName(pStyles[i], aString,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+ sSetStyles += aString;
+ }
+ rTOXBase.SetStyleNames(sSetStyles, static_cast<sal_uInt16>(nIndex));
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::getCount() throw (uno::RuntimeException)
+{
+ return MAXLEVEL;
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::getByIndex(sal_Int32 nIndex)
+throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(nIndex < 0 || nIndex > MAXLEVEL)
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
+
+ const String& rStyles =
+ rTOXBase.GetStyleNames(static_cast<sal_uInt16>(nIndex));
+ const sal_uInt16 nStyles = rStyles.GetTokenCount(TOX_STYLE_DELIMITER);
+ uno::Sequence<OUString> aStyles(nStyles);
+ OUString* pStyles = aStyles.getArray();
+ String aString;
+ for(sal_uInt16 i = 0; i < nStyles; i++)
+ {
+ SwStyleNameMapper::FillProgName(
+ rStyles.GetToken(i, TOX_STYLE_DELIMITER),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
+ sal_True);
+ pStyles[i] = OUString( aString );
+ }
+ uno::Any aRet(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
+ return aRet;
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::getElementType()
+throw (uno::RuntimeException)
+{
+ return ::getCppuType((uno::Sequence<OUString>*)0);
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXDocumentIndex::StyleAccess_Impl::hasElements() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+/******************************************************************
+ * SwXDocumentIndex::TokenAccess_Impl
+ ******************************************************************/
+/*-- 13.09.99 16:52:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::TokenAccess_Impl::TokenAccess_Impl(
+ SwXDocumentIndex& rParentIdx)
+ : m_xParent(&rParentIdx)
+{
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::TokenAccess_Impl::~TokenAccess_Impl()
+{
+}
+
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::getImplementationName()
+throw (uno::RuntimeException)
+{
+ return C2U("SwXDocumentIndex::TokenAccess_Impl");
+}
+
+static char const*const g_ServicesIndexTokenAccess[] =
+{
+ "com.sun.star.text.DocumentIndexLevelFormat",
+};
+static const size_t g_nServicesIndexTokenAccess(
+ sizeof(g_ServicesIndexTokenAccess)/sizeof(g_ServicesIndexTokenAccess[0]));
+
+sal_Bool SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::supportsService(
+ const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesIndexTokenAccess, g_ServicesIndexTokenAccess, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames()
+throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesIndexTokenAccess, g_ServicesIndexTokenAccess);
+}
+
+struct TokenType {
+ const char *pName;
+ const enum FormTokenType eTokenType;
+};
+
+static const struct TokenType g_TokenTypes[] =
+{
+ { "TokenEntryNumber", TOKEN_ENTRY_NO },
+ { "TokenEntryText", TOKEN_ENTRY_TEXT },
+ { "TokenTabStop", TOKEN_TAB_STOP },
+ { "TokenText", TOKEN_TEXT },
+ { "TokenPageNumber", TOKEN_PAGE_NUMS },
+ { "TokenChapterInfo", TOKEN_CHAPTER_INFO },
+ { "TokenHyperlinkStart", TOKEN_LINK_START },
+ { "TokenHyperlinkEnd", TOKEN_LINK_END },
+ { "TokenBibliographyDataField", TOKEN_AUTHORITY },
+ { 0, static_cast<enum FormTokenType>(0) }
+};
+
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
+ sal_Int32 nIndex, const uno::Any& rElement)
+throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
+
+ if ((nIndex < 0) || (nIndex > rTOXBase.GetTOXForm().GetFormMax()))
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ uno::Sequence<beans::PropertyValues> aSeq;
+ if(!(rElement >>= aSeq))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ String sPattern;
+ const sal_Int32 nTokens = aSeq.getLength();
+ const beans::PropertyValues* pTokens = aSeq.getConstArray();
+ for(sal_Int32 i = 0; i < nTokens; i++)
+ {
+ const beans::PropertyValue* pProperties = pTokens[i].getConstArray();
+ const sal_Int32 nProperties = pTokens[i].getLength();
+ //create an invalid token
+ SwFormToken aToken(TOKEN_END);
+ for(sal_Int32 j = 0; j < nProperties; j++)
+ {
+ if (pProperties[j].Name.equalsAscii("TokenType"))
+ {
+ const OUString sTokenType =
+ lcl_AnyToString(pProperties[j].Value);
+ for (TokenType const* pTokenType = g_TokenTypes;
+ pTokenType->pName; ++pTokenType)
+ {
+ if (sTokenType.equalsAscii(pTokenType->pName))
+ {
+ aToken.eTokenType = pTokenType->eTokenType;
+ break;
+ }
+ }
+ }
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("CharacterStyleName")))
+ {
+ String sCharStyleName;
+ SwStyleNameMapper::FillUIName(
+ lcl_AnyToString(pProperties[j].Value),
+ sCharStyleName,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
+ sal_True);
+ aToken.sCharStyleName = sCharStyleName;
+ aToken.nPoolId = SwStyleNameMapper::GetPoolIdFromUIName (
+ sCharStyleName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ }
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("TabStopRightAligned")))
+ {
+ const sal_Bool bRight = lcl_AnyToBool(pProperties[j].Value);
+ aToken.eTabAlign = bRight ?
+ SVX_TAB_ADJUST_END : SVX_TAB_ADJUST_LEFT;
+ }
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("TabStopPosition")))
+ {
+ sal_Int32 nPosition = 0;
+ if (!(pProperties[j].Value >>= nPosition))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ nPosition = MM100_TO_TWIP(nPosition);
+ if(nPosition < 0)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ aToken.nTabStopPosition = nPosition;
+ }
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("TabStopFillCharacter")))
+ {
+ const OUString sFillChar =
+ lcl_AnyToString(pProperties[j].Value);
+ if (sFillChar.getLength() > 1)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ aToken.cTabFillChar =
+ (sFillChar.getLength()) ? sFillChar[0] : ' ';
+ }
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("Text")))
+ {
+ const OUString sText = lcl_AnyToString(pProperties[j].Value);
+ aToken.sText = sText;
+ }
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ChapterFormat")))
+ {
+ sal_Int16 nFormat = lcl_AnyToInt16(pProperties[j].Value);
+ switch(nFormat)
+ {
+ case text::ChapterFormat::NUMBER:
+ nFormat = CF_NUMBER;
+ break;
+ case text::ChapterFormat::NAME:
+ nFormat = CF_TITLE;
+ break;
+ case text::ChapterFormat::NAME_NUMBER:
+ nFormat = CF_NUM_TITLE;
+ break;
+ case text::ChapterFormat::NO_PREFIX_SUFFIX:
+ nFormat = CF_NUMBER_NOPREPST;
+ break;
+ case text::ChapterFormat::DIGIT:
+ nFormat = CF_NUM_NOPREPST_TITLE;
+ break;
+ default:
+ throw lang::IllegalArgumentException();
+ }
+ aToken.nChapterFormat = nFormat;
+ }
+//--->i53420
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ChapterLevel")))
+ {
+ const sal_Int16 nLevel = lcl_AnyToInt16(pProperties[j].Value);
+ if( nLevel < 1 || nLevel > MAXLEVEL )
+ {
+ throw lang::IllegalArgumentException();
+ }
+ aToken.nOutlineLevel = nLevel;
+ }
+//<---
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("BibliographyDataField")))
+ {
+ sal_Int16 nType = 0;
+ pProperties[j].Value >>= nType;
+ if(nType < 0 || nType > text::BibliographyDataField::ISBN)
+ {
+ lang::IllegalArgumentException aExcept;
+ aExcept.Message = C2U("BibliographyDataField - wrong value");
+ aExcept.ArgumentPosition = static_cast< sal_Int16 >(j);
+ throw aExcept;
+ }
+ aToken.nAuthorityField = nType;
+ }
+ // #i21237#
+ else if (pProperties[j].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WithTab")))
+ {
+ aToken.bWithTab = lcl_AnyToBool(pProperties[j].Value);
+ }
+
+ }
+ //exception if wrong TokenType
+ if(TOKEN_END <= aToken.eTokenType )
+ {
+ throw lang::IllegalArgumentException();
+ }
+ // set TokenType from TOKEN_ENTRY_TEXT to TOKEN_ENTRY if it is
+ // not a content index
+ if(TOKEN_ENTRY_TEXT == aToken.eTokenType &&
+ (TOX_CONTENT != rTOXBase.GetType()))
+ {
+ aToken.eTokenType = TOKEN_ENTRY;
+ }
+//---> i53420
+// check for chapter format allowed values if it was TOKEN_ENTRY_NO type
+// only allowed value are CF_NUMBER and CF_NUM_NOPREPST_TITLE
+// reading from file
+ if( TOKEN_ENTRY_NO == aToken.eTokenType )
+ {
+ switch(aToken.nChapterFormat)
+ {
+ case CF_NUMBER:
+ case CF_NUM_NOPREPST_TITLE:
+ break;
+ default:
+ throw lang::IllegalArgumentException();
+ }
+ }
+//<---
+ sPattern += aToken.GetString();
+ }
+ SwForm aForm(rTOXBase.GetTOXForm());
+ aForm.SetPattern(static_cast<sal_uInt16>(nIndex), sPattern);
+ rTOXBase.SetTOXForm(aForm);
+}
+
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::getCount() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const sal_Int32 nRet = m_xParent->m_pImpl->GetFormMax();
+ return nRet;
+}
+
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::getByIndex(sal_Int32 nIndex)
+throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
+
+ if ((nIndex < 0) || (nIndex > rTOXBase.GetTOXForm().GetFormMax()))
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ // #i21237#
+ SwFormTokens aPattern = rTOXBase.GetTOXForm().
+ GetPattern(static_cast<sal_uInt16>(nIndex));
+ SwFormTokens::iterator aIt = aPattern.begin();
+
+ sal_uInt16 nTokenCount = 0;
+ uno::Sequence< beans::PropertyValues > aRetSeq;
+ String aString;
+ while(aIt != aPattern.end()) // #i21237#
+ {
+ nTokenCount++;
+ aRetSeq.realloc(nTokenCount);
+ beans::PropertyValues* pTokenProps = aRetSeq.getArray();
+ SwFormToken aToken = *aIt; // #i21237#
+
+ uno::Sequence< beans::PropertyValue >& rCurTokenSeq =
+ pTokenProps[nTokenCount-1];
+ SwStyleNameMapper::FillProgName(
+ aToken.sCharStyleName,
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
+ sal_True );
+ const OUString aProgCharStyle( aString );
+ switch(aToken.eTokenType)
+ {
+ case TOKEN_ENTRY_NO:
+ {
+//--->i53420
+// writing to file (from doc to properties)
+ sal_Int32 nElements = 2;
+ sal_Int32 nCurrentElement = 0;
+
+ // check for default value
+ if (aToken.nChapterFormat != CF_NUMBER)
+ {
+ nElements++;//we need the element
+ }
+ if( aToken.nOutlineLevel != MAXLEVEL )
+ {
+ nElements++;
+ }
+
+ rCurTokenSeq.realloc( nElements );
+
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[nCurrentElement].Name = C2U("TokenType");
+ pArr[nCurrentElement++].Value <<=
+ OUString::createFromAscii("TokenEntryNumber");
+
+ pArr[nCurrentElement].Name = C2U("CharacterStyleName");
+ pArr[nCurrentElement++].Value <<= aProgCharStyle;
+ if( aToken.nChapterFormat != CF_NUMBER )
+ {
+ pArr[nCurrentElement].Name = C2U("ChapterFormat");
+ sal_Int16 nVal;
+// the allowed values for chapter format, when used as entry number,
+// are CF_NUMBER and CF_NUM_NOPREPST_TITLE only, all else forced to
+//CF_NUMBER
+ switch(aToken.nChapterFormat)
+ {
+ default:
+ case CF_NUMBER:
+ nVal = text::ChapterFormat::NUMBER;
+ break;
+ case CF_NUM_NOPREPST_TITLE:
+ nVal = text::ChapterFormat::DIGIT;
+ break;
+ }
+ pArr[nCurrentElement++].Value <<= nVal;
+ }
+
+ // only a ChapterLevel != MAXLEVEL is registered
+ if (aToken.nOutlineLevel != MAXLEVEL)
+ {
+ pArr[nCurrentElement].Name = C2U("ChapterLevel");
+ pArr[nCurrentElement].Value <<= aToken.nOutlineLevel;
+ }
+//<---
+ }
+ break;
+ case TOKEN_ENTRY: // no difference between Entry and Entry Text
+ case TOKEN_ENTRY_TEXT:
+ {
+ rCurTokenSeq.realloc( 2 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenEntryText");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_TAB_STOP:
+ {
+ rCurTokenSeq.realloc(5); // #i21237#
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenTabStop");
+
+ if(SVX_TAB_ADJUST_END == aToken.eTabAlign)
+ {
+ pArr[1].Name = C2U("TabStopRightAligned");
+ BOOL bTemp = sal_True;
+ pArr[1].Value.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ else
+ {
+ pArr[1].Name = C2U("TabStopPosition");
+ sal_Int32 nPos = (TWIP_TO_MM100(aToken.nTabStopPosition));
+ if(nPos < 0)
+ nPos = 0;
+ pArr[1].Value <<= (sal_Int32)nPos;
+ }
+ pArr[2].Name = C2U("TabStopFillCharacter");
+ pArr[2].Value <<= OUString(aToken.cTabFillChar);
+ pArr[3].Name = C2U("CharacterStyleName");
+ pArr[3].Value <<= aProgCharStyle;
+ // #i21237#
+ pArr[4].Name = C2U("WithTab");
+ pArr[4].Value <<= static_cast<sal_Bool>(aToken.bWithTab);
+ }
+ break;
+ case TOKEN_TEXT:
+ {
+ rCurTokenSeq.realloc( 3 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenText");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+
+ pArr[2].Name = C2U("Text");
+ pArr[2].Value <<= OUString(aToken.sText);
+ }
+ break;
+ case TOKEN_PAGE_NUMS:
+ {
+ rCurTokenSeq.realloc( 2 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenPageNumber");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_CHAPTER_INFO:
+ {
+ rCurTokenSeq.realloc( 4 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenChapterInfo");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+
+ pArr[2].Name = C2U("ChapterFormat");
+ sal_Int16 nVal = text::ChapterFormat::NUMBER;
+ switch(aToken.nChapterFormat)
+ {
+ case CF_NUMBER:
+ nVal = text::ChapterFormat::NUMBER;
+ break;
+ case CF_TITLE:
+ nVal = text::ChapterFormat::NAME;
+ break;
+ case CF_NUM_TITLE:
+ nVal = text::ChapterFormat::NAME_NUMBER;
+ break;
+ case CF_NUMBER_NOPREPST:
+ nVal = text::ChapterFormat::NO_PREFIX_SUFFIX;
+ break;
+ case CF_NUM_NOPREPST_TITLE:
+ nVal = text::ChapterFormat::DIGIT;
+ break;
+ }
+ pArr[2].Value <<= nVal;
+//--->i53420
+ pArr[3].Name = C2U("ChapterLevel");
+ //
+ pArr[3].Value <<= aToken.nOutlineLevel;
+//<---
+ }
+ break;
+ case TOKEN_LINK_START:
+ {
+ rCurTokenSeq.realloc( 2 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<=
+ OUString::createFromAscii("TokenHyperlinkStart");
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_LINK_END:
+ {
+ rCurTokenSeq.realloc( 1 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<=
+ OUString::createFromAscii("TokenHyperlinkEnd");
+ }
+ break;
+ case TOKEN_AUTHORITY:
+ {
+ rCurTokenSeq.realloc( 3 );
+ beans::PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<=
+ OUString::createFromAscii("TokenBibliographyDataField");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+
+ pArr[2].Name = C2U("BibliographyDataField");
+ pArr[2].Value <<= sal_Int16(aToken.nAuthorityField);
+ }
+ break;
+
+ default:
+ ;
+ }
+
+ aIt++; // #i21237#
+ }
+
+ uno::Any aRet;
+ aRet <<= aRetSeq;
+ return aRet;
+}
+
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::getElementType()
+throw (uno::RuntimeException)
+{
+ return ::getCppuType((uno::Sequence< beans::PropertyValues >*)0);
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXDocumentIndex::TokenAccess_Impl::hasElements()
+throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
new file mode 100644
index 000000000000..765b1ae37485
--- /dev/null
+++ b/sw/source/core/unocore/unomap.cxx
@@ -0,0 +1,3123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+#include <hintids.hxx>
+
+#include <svx/svxids.hrc>
+#include <comphelper/TypeGeneration.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/text/PageNumberType.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+// --> OD 2004-08-06 #i28749#
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+// <--
+#include <swtypes.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unomid.h>
+#include <cmdid.h>
+#include <unofldmid.h>
+#include <editeng/memberids.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using ::rtl::OUString;
+using namespace ::comphelper;
+
+#define SW_PROP_NMID(id) ((const char*)id), 0
+
+#ifndef MID_TXT_LMARGIN
+#define MID_TXT_LMARGIN 11
+#endif
+
+/******************************************************************************
+ UI-Maps
+******************************************************************************/
+
+SwUnoPropertyMapProvider aSwMapProvider;
+
+/* -----------------24.06.98 18:12-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoPropertyMapProvider::SwUnoPropertyMapProvider()
+{
+ for( sal_uInt16 i = 0; i < PROPERTY_MAP_END; i++ )
+ {
+ aMapEntriesArr[i] = 0;
+ aPropertySetArr[i] = 0;
+ }
+}
+
+/* -----------------19.02.99 08:31-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
+{
+}
+
+#define _STANDARD_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT), RES_CHRATR_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE), RES_CHRATR_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE) , PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+
+#define _CJK_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT_ASIAN), RES_CHRATR_CJK_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE_ASIAN), RES_CHRATR_CJK_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE_ASIAN), RES_CHRATR_CJK_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE) , PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+
+#define _CTL_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT_COMPLEX), RES_CHRATR_CTL_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE_COMPLEX), RES_CHRATR_CTL_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE_COMPLEX), RES_CHRATR_CTL_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE) , PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+
+#define _REDLINE_NODE_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_START_REDLINE), FN_UNO_REDLINE_NODE_START , CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0xff }, \
+ { SW_PROP_NMID(UNO_NAME_END_REDLINE), FN_UNO_REDLINE_NODE_END , CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0xff },
+
+#define _REDLINE_PROPERTIES \
+ {SW_PROP_NMID(UNO_NAME_REDLINE_AUTHOR), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_DATE_TIME), 0, CPPU_E2T(CPPUTYPE_DATETIME), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_COMMENT), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_TYPE), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_SUCCESSOR_DATA), 0, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_IDENTIFIER), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_IS_IN_HEADER_FOOTER), 0, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_TEXT), 0, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_MERGE_LAST_PARA), 0, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+
+/* -----------------24.06.98 18:12-------------------
+ *
+ * --------------------------------------------------*/
+#define COMMON_CRSR_PARA_PROPERTIES_FN_ONLY \
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLE_NAME), FN_UNO_PARA_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_NAME), FN_UNO_PAGE_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_IS_NUMBER), FN_UNO_IS_NUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_LEVEL), FN_UNO_NUM_LEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), FN_UNO_NUM_RULES, CPPU_E2T(CPPUTYPE_REFIDXREPL), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_START_VALUE), FN_UNO_NUM_START_VALUE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX), FN_UNO_DOCUMENT_INDEX, CPPU_E2T(CPPUTYPE_REFDOCINDEX), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_TABLE), FN_UNO_TEXT_TABLE, CPPU_E2T(CPPUTYPE_REFTXTTABLE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_CELL), FN_UNO_CELL, CPPU_E2T(CPPUTYPE_REFCELL), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_FRAME), FN_UNO_TEXT_FRAME, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), FN_UNO_PARA_CONDITIONAL_STYLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_LIST_ID), FN_UNO_LIST_ID, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE), FN_UNO_PARA_CONT_PREV_SUBTREE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LIST_LABEL_STRING), FN_UNO_PARA_NUM_STRING, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, //#outline level, zhaojianwei
+
+#define COMMON_HYPERLINK_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_URL}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_TARGET), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_TARGET}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_NAME), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_HYPERLINKNAME }, \
+ { SW_PROP_NMID(UNO_NAME_UNVISITED_CHAR_STYLE_NAME), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_UNVISITED_FMT }, \
+ { SW_PROP_NMID(UNO_NAME_VISITED_CHAR_STYLE_NAME), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_VISITED_FMT },
+
+// same as COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 but without
+// UNO_NAME_BREAK_TYPE and UNO_NAME_PAGE_DESC_NAME which can not be used
+// by the SwXTextTableCursor
+#define COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_CROSSED_OUT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ESC }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PropertyAttribute::MAYBEVOID, MID_ESC_HEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_AUTO_ESC }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HIDDEN), RES_CHRATR_HIDDEN, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_TL_STYLE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TL_COLOR}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_TL_HASCOLOR}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_TL_STYLE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TL_COLOR}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_HAS_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_TL_HASCOLOR}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FIRST_AUTO}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS}, \
+ _STANDARD_FONT_PROPERTIES \
+ _CJK_FONT_PROPERTIES \
+ _CTL_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_FORMAT), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_DROPCAPFMT) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_FORMAT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_WHOLE_WORD), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_WHOLE_WORD }, \
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_CHAR_STYLE_NAME), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_OUSTRING) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_CHAR_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_SPLIT), RES_PARATR_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_WIDOWS), RES_PARATR_WIDOWS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_ORPHANS), RES_PARATR_ORPHANS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGENUMOFFSET}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_EXPAND_SINGLE_WORD), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_EXPAND_SINGLE }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LAST_LINE_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_LAST_LINE_ADJUST}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_COUNT), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_COUNT }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_START_VALUE), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_STARTVALUE}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UP_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT }, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, LEFT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, RIGHT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, TOP_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, BOTTOM_BORDER|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_USER_DEFINED_ATTRIBUTES), RES_TXTATR_UNKNOWN_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_TWOLINES}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_START_BRACKET}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_END_BRACKET}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_EMPHASIS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HANGING_PUNCTUATION), RES_PARATR_HANGINGPUNCTUATION, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CHARACTER_DISTANCE), RES_PARATR_SCRIPTSPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_FORBIDDEN_RULES), RES_PARATR_FORBIDDEN_RULES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_VERT_ALIGNMENT), RES_PARATR_VERTALIGN,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ROTATE }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FITTOLINE }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_TEXT), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_RUBY_TEXT }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_ADJUST), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RUBY_ADJUST }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_CHAR_STYLE_NAME), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_RUBY_CHARSTYLE }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_IS_ABOVE), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_RUBY_ABOVE }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RELIEF }, \
+ { SW_PROP_NMID(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CONNECT_BORDER), RES_PARATR_CONNECT_BORDER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+
+#define COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN \
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 \
+ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGEDESCNAME },
+
+
+#define TABSTOPS_MAP_ENTRY { SW_PROP_NMID(UNO_NAME_TABSTOPS), RES_PARATR_TABSTOP, CPPU_E2T(CPPUTYPE_SEQTABSTOP), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},
+
+#define COMMON_CRSR_PARA_PROPERTIES \
+ COMMON_CRSR_PARA_PROPERTIES_FN_ONLY \
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN \
+ COMMON_HYPERLINK_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, CPPU_E2T(CPPUTYPE_OUSTRINGS), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_STYLE_NAME), RES_TXTATR_AUTOFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+
+#define COMMON_CRSR_PARA_PROPERTIES_2 \
+ COMMON_CRSR_PARA_PROPERTIES_FN_ONLY \
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN
+
+#define COMPLETE_TEXT_CURSOR_MAP\
+ COMMON_CRSR_PARA_PROPERTIES\
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARK), FN_UNO_DOCUMENT_INDEX_MARK, CPPU_E2T(CPPUTYPE_REFDOCIDXMRK), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_TEXT_FIELD), FN_UNO_TEXT_FIELD, CPPU_E2T(CPPUTYPE_REFTXTFIELD), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_REFERENCE_MARK), FN_UNO_REFERENCE_MARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },\
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE), FN_UNO_FOOTNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE), FN_UNO_ENDNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_EVENTS), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_REFNMREPLACE), PropertyAttribute::MAYBEVOID, MID_URL_HYPERLINKEVENTS},\
+ { SW_PROP_NMID(UNO_NAME_NESTED_TEXT_CONTENT), FN_UNO_NESTED_TEXT_CONTENT, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },\
+ TABSTOPS_MAP_ENTRY
+
+
+
+#define _BASE_INDEX_PROPERTIES_\
+ { SW_PROP_NMID(UNO_NAME_TITLE), WID_IDX_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_NAME), WID_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CONTENT_SECTION), WID_IDX_CONTENT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION) , PropertyAttribute::READONLY, 0},\
+ { SW_PROP_NMID(UNO_NAME_HEADER_SECTION), WID_IDX_HEADER_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION) , PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+
+#define ANCHOR_TYPES_PROPERTY { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPES), FN_UNO_ANCHOR_TYPES, CPPU_E2T(CPPUTYPE_SEQANCHORTYPE),PropertyAttribute::READONLY, 0xff},
+
+// OD 18.09.2003 #i18732# - add property
+// OD 2004-05-05 #i28701# - add property 'WrapInfluenceOnObjPos'
+// OD 2009-07-13 #i73249# - add properties 'Title' and 'Description'
+#define COMMON_FRAME_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_FRAME), RES_ANCHOR, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORFRAME}, \
+ ANCHOR_TYPES_PROPERTY\
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_R_G_B), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR_R_G_B}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_BACK_COLOR_TRANSPARENCY}, \
+ { SW_PROP_NMID(UNO_NAME_CONTENT_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_CONTENT }, \
+ { SW_PROP_NMID(UNO_NAME_FRAME_STYLE_NAME), FN_UNO_FRAME_STYLE_NAME,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENCY}, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_ORIENT }, \
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_POSITION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_HORIORIENT_POSITION|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_RELATION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_RELATION }, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_URL}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_TARGET), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_TARGET}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_NAME), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_HYPERLINKNAME }, \
+ { SW_PROP_NMID(UNO_NAME_OPAQUE), RES_OPAQUE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_TOGGLE), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_HORIORIENT_PAGETOGGLE }, \
+ { SW_PROP_NMID(UNO_NAME_POSITION_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_POSITION}, \
+ { SW_PROP_NMID(UNO_NAME_PRINT), RES_PRINT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT }, \
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH }, \
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_IMAGE_MAP), RES_URL, CPPU_E2T(CPPUTYPE_REFIDXCNTNR), PROPERTY_NONE, MID_URL_CLIENTMAP}, \
+ { SW_PROP_NMID(UNO_NAME_SERVER_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_SERVERMAP }, \
+ { SW_PROP_NMID(UNO_NAME_SIZE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_FRMSIZE_SIZE|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_SIZE_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_SIZE }, \
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_WIDTH_TO_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT }, \
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE }, \
+ { SW_PROP_NMID(UNO_NAME_SURROUND), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE }, \
+ { SW_PROP_NMID(UNO_NAME_SURROUND_ANCHORONLY), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_ANCHORONLY }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, \
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT }, \
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_POSITION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_VERTORIENT_POSITION|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_RELATION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_RELATION }, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff}, \
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },\
+ { SW_PROP_NMID(UNO_NAME_Z_ORDER), FN_UNO_Z_ORDER, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_IS_FOLLOWING_TEXT_FLOW), RES_FOLLOW_TEXT_FLOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE}, \
+ { SW_PROP_NMID(UNO_NAME_TITLE), FN_UNO_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 },
+
+
+
+#define COMMON_TEXT_CONTENT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), FN_UNO_ANCHOR_TYPE, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PropertyAttribute::READONLY, MID_ANCHOR_ANCHORTYPE},\
+ ANCHOR_TYPES_PROPERTY\
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), FN_UNO_TEXT_WRAP, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PropertyAttribute::READONLY, MID_SURROUND_SURROUNDTYPE },
+
+
+#define _PROP_DIFF_FONTHEIGHT \
+ { SW_PROP_NMID(UNO_NAME_CHAR_PROP_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PROPERTY_NONE , MID_FONTHEIGHT_PROP},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_PROP_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PROPERTY_NONE , MID_FONTHEIGHT_PROP},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_PROP_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PROPERTY_NONE , MID_FONTHEIGHT_PROP},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS},
+
+
+//#outline level, zhaojianwei delete { SW_PROP_NMID(UNO_NAME_DEFAULT_OUTLINE_LEVEL), FN_UNO_DEFAULT_OUTLINE_LEVEL, CPPU_E2T(CPPUTYPE_INT8), PropertyAttribute::MAYBEVOID, 0},
+//add { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0},
+#define COMMON_PARA_STYLE_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGEDESCNAME },\
+ { SW_PROP_NMID(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGENUMOFFSET},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },\
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },\
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },\
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },\
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },\
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ESC },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PROPERTY_NONE, MID_ESC_HEIGHT},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_HIDDEN), RES_CHRATR_HIDDEN, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ _STANDARD_FONT_PROPERTIES\
+ _CJK_FONT_PROPERTIES\
+ _CTL_FONT_PROPERTIES\
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_TL_STYLE},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TL_COLOR},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TL_HASCOLOR},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_TL_STYLE},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TL_COLOR},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_HAS_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TL_HASCOLOR},\
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TXT_LMARGIN|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN_RELATIVE), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_L_REL_MARGIN},\
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN_RELATIVE), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_R_REL_MARGIN},\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FIRST_AUTO},\
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FIRST_LINE_INDENT|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT_RELATIVE), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FIRST_LINE_REL_INDENT|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_FORMAT), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_DROPCAPFMT) , PROPERTY_NONE, MID_DROPCAP_FORMAT|CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_WHOLE_WORD), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_DROPCAP_WHOLE_WORD },\
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_CHAR_STYLE_NAME), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_OUSTRING) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_CHAR_STYLE_NAME },\
+ { SW_PROP_NMID(UNO_NAME_PARA_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_SPLIT), RES_PARATR_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_WIDOWS), RES_PARATR_WIDOWS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_ORPHANS), RES_PARATR_ORPHANS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_EXPAND_SINGLE_WORD), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_EXPAND_SINGLE },\
+ { SW_PROP_NMID(UNO_NAME_PARA_LAST_LINE_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_LAST_LINE_ADJUST},\
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_COUNT), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_LINENUMBER_COUNT },\
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_START_VALUE), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_LINENUMBER_STARTVALUE},\
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE),PROPERTY_NONE, CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_PARA_ADJUST},\
+ { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN_RELATIVE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_UP_REL_MARGIN},\
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_LO_REL_MARGIN},\
+ TABSTOPS_MAP_ENTRY\
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN },\
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD },\
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL },\
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS},\
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },\
+ { SW_PROP_NMID(UNO_NAME_PARA_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TWOLINES},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_START_BRACKET},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_END_BRACKET},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_EMPHASIS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HANGING_PUNCTUATION), RES_PARATR_HANGINGPUNCTUATION, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CHARACTER_DISTANCE), RES_PARATR_SCRIPTSPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_FORBIDDEN_RULES), RES_PARATR_FORBIDDEN_RULES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },\
+ { SW_PROP_NMID(UNO_NAME_PARA_VERT_ALIGNMENT), RES_PARATR_VERTALIGN, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , 0 },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ROTATE },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FITTOLINE },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },\
+ _PROP_DIFF_FONTHEIGHT\
+ { SW_PROP_NMID(UNO_NAME_FOLLOW_STYLE), FN_UNO_FOLLOW_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},\
+ { SW_PROP_NMID(UNO_NAME_IS_AUTO_UPDATE), FN_UNO_IS_AUTO_UPDATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},\
+ { SW_PROP_NMID(UNO_NAME_CATEGORY), FN_UNO_CATEGORY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , 0 },\
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CONNECT_BORDER), RES_PARATR_CONNECT_BORDER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0},
+
+
+#define COMMON_FLDTYP_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_IS_FIELD_USED), FIELD_PROP_IS_FIELD_USED, CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::READONLY, 0},\
+ { SW_PROP_NMID(UNO_NAME_IS_FIELD_DISPLAYED), FIELD_PROP_IS_FIELD_DISPLAYED, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0},\
+
+
+const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(sal_uInt16 nPropertyId)
+{
+ DBG_ASSERT(nPropertyId < PROPERTY_MAP_END, "Id ?" );
+ if( !aMapEntriesArr[ nPropertyId ] )
+ {
+ switch(nPropertyId)
+ {
+ case PROPERTY_MAP_TEXT_CURSOR:
+ {
+ static SfxItemPropertyMapEntry aCharAndParaMap_Impl[] =
+ {
+ COMPLETE_TEXT_CURSOR_MAP
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aCharAndParaMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_PARAGRAPH:
+ {
+ static SfxItemPropertyMapEntry aParagraphMap_Impl[] =
+ {
+ COMMON_CRSR_PARA_PROPERTIES_2
+ TABSTOPS_MAP_ENTRY
+ COMMON_TEXT_CONTENT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, CPPU_E2T(CPPUTYPE_OUSTRINGS), PropertyAttribute::MAYBEVOID, 0},\
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aParagraphMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_PARA_AUTO_STYLE :
+ {
+ static SfxItemPropertyMapEntry aAutoParaStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLE_NAME), RES_FRMATR_STYLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_NAME), FN_UNO_PAGE_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_IS_NUMBER), FN_UNO_IS_NUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_LEVEL), FN_UNO_NUM_LEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_START_VALUE), FN_UNO_NUM_START_VALUE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX), FN_UNO_DOCUMENT_INDEX, CPPU_E2T(CPPUTYPE_REFDOCINDEX), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_TABLE), FN_UNO_TEXT_TABLE, CPPU_E2T(CPPUTYPE_REFTXTTABLE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_CELL), FN_UNO_CELL, CPPU_E2T(CPPUTYPE_REFCELL), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_FRAME), FN_UNO_TEXT_FRAME, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), RES_FRMATR_CONDITIONAL_STYLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, //#outline level,zhaojianwei
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN
+ TABSTOPS_MAP_ENTRY
+ COMMON_TEXT_CONTENT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAutoParaStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_CHAR_STYLE :
+ {
+ static SfxItemPropertyMapEntry aCharStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ESC },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PROPERTY_NONE, MID_ESC_HEIGHT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_HIDDEN), RES_CHRATR_HIDDEN, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ _STANDARD_FONT_PROPERTIES
+ _CJK_FONT_PROPERTIES
+ _CTL_FONT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_TL_STYLE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_TL_STYLE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_HAS_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TWOLINES},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_START_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_END_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_EMPHASIS},
+ _PROP_DIFF_FONTHEIGHT
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ROTATE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FITTOLINE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aCharStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_CHAR_AUTO_STYLE :
+ {
+ // same as PROPERTY_MAP_TEXTPORTION_EXTENSIONS
+ static SfxItemPropertyMapEntry aAutoCharStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ESC },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PROPERTY_NONE, MID_ESC_HEIGHT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_HIDDEN), RES_CHRATR_HIDDEN, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ _STANDARD_FONT_PROPERTIES
+ _CJK_FONT_PROPERTIES
+ _CTL_FONT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_TL_STYLE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_TL_STYLE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_OVERLINE_HAS_COLOR), RES_CHRATR_OVERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TEXT_USER_DEFINED_ATTRIBUTES), RES_TXTATR_UNKNOWN_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TWOLINES},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_START_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_END_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_EMPHASIS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ROTATE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FITTOLINE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_STYLE_NAME), RES_TXTATR_AUTOFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAutoCharStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_RUBY_AUTO_STYLE :
+ {
+ static SfxItemPropertyMapEntry aAutoRubyStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_RUBY_ADJUST), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RUBY_ADJUST },
+ { SW_PROP_NMID(UNO_NAME_RUBY_IS_ABOVE), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_RUBY_ABOVE },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAutoRubyStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_PARA_STYLE :
+ {
+ static SfxItemPropertyMapEntry aParaStyleMap [] =
+ {
+ COMMON_PARA_STYLE_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aParaStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_CONDITIONAL_PARA_STYLE :
+ {
+ static SfxItemPropertyMapEntry aParaStyleMap [] =
+ {
+ COMMON_PARA_STYLE_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLE_CONDITIONS), FN_UNO_PARA_STYLE_CONDITIONS, CPPU_E2T(CPPUTYPE_SEQNAMEDVALUE), PropertyAttribute::MAYBEVOID, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aParaStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_FRAME_STYLE:
+ {
+ static SfxItemPropertyMapEntry aFrameStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM },
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_R_G_B), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR_R_G_B},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_BACK_COLOR_TRANSPARENCY}, \
+ // { SW_PROP_NMID(UNO_NAME_CHAIN_NEXT_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_NEXTNAME},
+ // { SW_PROP_NMID(UNO_NAME_CHAIN_PREV_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_PREVNAME},
+ /*not impl*/ { SW_PROP_NMID(UNO_NAME_CLIENT_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_CLIENTMAP },
+ { SW_PROP_NMID(UNO_NAME_CONTENT_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_CONTENT },
+ { SW_PROP_NMID(UNO_NAME_EDIT_IN_READONLY), RES_EDIT_IN_READONLY, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ // --> OD 2005-06-06 #i50322# - add missing map entry for transparency of graphic background
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENCY},
+ // <--
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_POSITION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_HORIORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_RELATION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_URL},
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_TARGET), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_TARGET},
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_NAME), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_HYPERLINKNAME },
+ { SW_PROP_NMID(UNO_NAME_OPAQUE), RES_OPAQUE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PAGE_TOGGLE), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_HORIORIENT_PAGETOGGLE },
+ { SW_PROP_NMID(UNO_NAME_POSITION_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_POSITION},
+ { SW_PROP_NMID(UNO_NAME_PRINT), RES_PRINT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH },
+ { SW_PROP_NMID(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
+ { SW_PROP_NMID(UNO_NAME_WIDTH_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE },
+ { SW_PROP_NMID(UNO_NAME_SIZE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_FRMSIZE_SIZE|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_WIDTH_TO_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH },
+ // { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH },
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_SERVER_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_SERVERMAP },
+ { SW_PROP_NMID(UNO_NAME_SIZE_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_SIZE },
+ //Surround bleibt, weil es mit der 5.1 ausgeliefert wurde, obwohl es mit text::WrapTextMode identisch ist
+ { SW_PROP_NMID(UNO_NAME_SURROUND), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_ANCHORONLY), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_ANCHORONLY },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_POSITION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_VERTORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_RELATION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_AUTO_UPDATE), FN_UNO_IS_AUTO_UPDATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ // OD 18.09.2003 #i18732#
+ { SW_PROP_NMID(UNO_NAME_IS_FOLLOWING_TEXT_FLOW), RES_FOLLOW_TEXT_FLOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // OD 2004-05-05 #i28701#
+ { SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE},
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aFrameStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_PAGE_STYLE :
+ {
+ static SfxItemPropertyMapEntry aPageStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+
+ { SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ // { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_URL), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_FILTER), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_LOCATION), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_MARGIN), FN_UNO_HEADER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_MARGIN), FN_UNO_HEADER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_BACK_TRANSPARENT), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_SHADOW_FORMAT), FN_UNO_HEADER_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_BODY_DISTANCE), FN_UNO_HEADER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), FN_UNO_HEADER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_HEADER_IS_SHARED), FN_UNO_HEADER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_HEADER_HEIGHT), FN_UNO_HEADER_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_IS_ON), FN_UNO_HEADER_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_HEADER_DYNAMIC_SPACING), FN_UNO_HEADER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 },
+
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_COLOR), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ // { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC), FN_UNO_FOOTER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_URL), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_FILTER), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_LOCATION), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_MARGIN), FN_UNO_FOOTER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_MARGIN), FN_UNO_FOOTER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_TRANSPARENT), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_SHADOW_FORMAT), FN_UNO_FOOTER_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BODY_DISTANCE), FN_UNO_FOOTER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_IS_SHARED), FN_UNO_FOOTER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_HEIGHT), FN_UNO_FOOTER_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_IS_ON), FN_UNO_FOOTER_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_DYNAMIC_SPACING), FN_UNO_FOOTER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 },
+
+
+ { SW_PROP_NMID(UNO_NAME_IS_LANDSCAPE), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_PAGE_ORIENTATION },
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_PAGE_NUMTYPE },
+ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_LAYOUT), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_PAGESTYLELAY), PROPERTY_NONE ,MID_PAGE_LAYOUT },
+ { SW_PROP_NMID(UNO_NAME_PRINTER_PAPER_TRAY), RES_PAPER_BIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+// { SW_PROP_NMID(UNO_NAME_REGISTER_MODE_ACTIVE), SID_SWREGISTER_MODE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_REGISTER_PARAGRAPH_STYLE), SID_SWREGISTER_COLLECTION, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_SIZE), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_SIZE_SIZE|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_WIDTH), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_SIZE_WIDTH|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_SIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_TEXT), FN_UNO_HEADER, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_HEADER_TEXT_LEFT), FN_UNO_HEADER_LEFT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_HEADER_TEXT_RIGHT), FN_UNO_HEADER_RIGHT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TEXT), FN_UNO_FOOTER, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TEXT_LEFT), FN_UNO_FOOTER_LEFT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TEXT_RIGHT), FN_UNO_FOOTER_RIGHT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOLLOW_STYLE), FN_UNO_FOLLOW_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_HEIGHT), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_FTN_HEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_WEIGHT), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_LINE_WEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_COLOR), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_COLOR},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE , MID_LINE_RELWIDTH },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_LINE_ADJUST },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_TEXT_DIST |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_FOOTNOTE_DIST|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ // writing grid
+ { SW_PROP_NMID(UNO_NAME_GRID_COLOR), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_COLOR},
+ { SW_PROP_NMID(UNO_NAME_GRID_LINES), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_GRID_LINES},
+ { SW_PROP_NMID(UNO_NAME_GRID_BASE_HEIGHT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEHEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_GRID_RUBY_HEIGHT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_RUBYHEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_GRID_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_GRID_TYPE},
+ { SW_PROP_NMID(UNO_NAME_GRID_RUBY_BELOW), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_RUBY_BELOW},
+ { SW_PROP_NMID(UNO_NAME_GRID_PRINT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_PRINT},
+ { SW_PROP_NMID(UNO_NAME_GRID_DISPLAY), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_DISPLAY},
+ { SW_PROP_NMID(UNO_NAME_GRID_BASE_WIDTH), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEWIDTH|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_GRID_SNAP_TO_CHARS), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_SNAPTOCHARS},
+ { SW_PROP_NMID(UNO_NAME_GRID_STANDARD_PAGE_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_STANDARD_MODE},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aPageStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_NUM_STYLE :
+ {
+ static SfxItemPropertyMapEntry aNumStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), FN_UNO_NUM_RULES, CPPU_E2T(CPPUTYPE_REFIDXREPL), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aNumStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE :
+ {
+ static SfxItemPropertyMapEntry aTablePropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SPLIT), RES_LAYOUT_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGENUMOFFSET},
+ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0xff},
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), FN_TABLE_RELATIVE_WIDTH,CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0xff },
+ { SW_PROP_NMID(UNO_NAME_REPEAT_HEADLINE), FN_TABLE_HEADLINE_REPEAT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_HEADER_ROW_COUNT), FN_TABLE_HEADLINE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_WIDTH), FN_TABLE_WIDTH, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_IS_WIDTH_RELATIVE), FN_TABLE_IS_RELATIVE_WIDTH, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TABLE_BORDER), FN_UNO_TABLE_BORDER, CPPU_E2T(CPPUTYPE_TABLEBORDER), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TABLE_BORDER_DISTANCES), FN_UNO_TABLE_BORDER_DISTANCES, CPPU_E2T(CPPUTYPE_TABLEBORDERDISTANCES), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_SEPARATORS), FN_UNO_TABLE_COLUMN_SEPARATORS, CPPU_E2T(CPPUTYPE_TBLCOLSEP), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_RELATIVE_SUM), FN_UNO_TABLE_COLUMN_RELATIVE_SUM, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0 },
+ COMMON_TEXT_CONTENT_PROPERTIES
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_TABLE_NAME), FN_UNO_TABLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ // --> collapsing borders DVO, FME 2005-05-27 #i29550#
+ { SW_PROP_NMID(UNO_NAME_COLLAPSING_BORDERS), RES_COLLAPSING_BORDERS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // <-- collapsing
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+
+ aMapEntriesArr[nPropertyId] = aTablePropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TABLE_CELL :
+ {
+ static SfxItemPropertyMapEntry aCellMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, MID_PROTECT_CONTENT},
+ { SW_PROP_NMID(UNO_NAME_CELL_NAME), FN_UNO_CELL_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY,0},
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_ROW_SPAN), FN_UNO_CELL_ROW_SPAN, CPPU_E2T(CPPUTYPE_INT32), 0, 0 },
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aCellMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TABLE_RANGE:
+ {
+ static SfxItemPropertyMapEntry aRangePropertyMap_Impl[] =
+ {
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01
+ TABSTOPS_MAP_ENTRY
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,0 },
+ // commented properties already found in
+ // COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01
+// { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aRangePropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_SECTION:
+ {
+ static SfxItemPropertyMapEntry aSectionPropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CONDITION), WID_SECT_CONDITION, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_FILE), WID_SECT_DDE_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_TYPE), WID_SECT_DDE_FILE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_ELEMENT), WID_SECT_DDE_ELEMENT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_UPDATE), WID_SECT_DDE_AUTOUPDATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILE_LINK), WID_SECT_LINK , CPPU_E2T(CPPUTYPE_SECTFILELNK), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_VISIBLE), WID_SECT_VISIBLE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_SECT_PROTECTED, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ { SW_PROP_NMID(UNO_NAME_EDIT_IN_READONLY), WID_SECT_EDIT_IN_READONLY, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // <--
+ { SW_PROP_NMID(UNO_NAME_LINK_REGION), WID_SECT_REGION , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_IS_COLLECT_AT_TEXT_END), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_COLLECT },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_IS_RESTART_NUMBERING), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_RESTART_NUM },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_RESTART_NUMBERING_AT), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_NUM_START_AT},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_IS_OWN_NUMBERING), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_OWN_NUM },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_NUMBERING_TYPE), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_NUM_TYPE },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_NUMBERING_PREFIX), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_PREFIX },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_NUMBERING_SUFFIX), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_SUFFIX },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_IS_COLLECT_AT_TEXT_END), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_COLLECT },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_IS_RESTART_NUMBERING), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_RESTART_NUM },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_RESTART_NUMBERING_AT), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_NUM_START_AT },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_IS_OWN_NUMBERING), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_OWN_NUM },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_NUMBERING_TYPE), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_NUM_TYPE },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_NUMBERING_PREFIX), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_PREFIX },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_NUMBERING_SUFFIX), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_SUFFIX },
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX), WID_SECT_DOCUMENT_INDEX, CPPU_E2T(CPPUTYPE_REFDOCINDEX), PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION), WID_SECT_IS_GLOBAL_DOC_SECTION, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0 },
+ { SW_PROP_NMID(UNO_NAME_PROTECTION_KEY), WID_SECT_PASSWORD, CPPU_E2T(CPPUTYPE_SEQINT8), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_DONT_BALANCE_TEXT_COLUMNS), RES_COLUMNBALANCE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ COMMON_TEXT_CONTENT_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_IS_CURRENTLY_VISIBLE), WID_SECT_CURRENTLY_VISIBLE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ /* -> #109700# */
+ { SW_PROP_NMID(UNO_NAME_SECT_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_L_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_SECT_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS}, \
+ /* <- #1097001# */
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aSectionPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SEARCH:
+ {
+ static SfxItemPropertyMapEntry aSearchPropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_SEARCH_ALL), WID_SEARCH_ALL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_BACKWARDS), WID_BACKWARDS, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_CASE_SENSITIVE), WID_CASE_SENSITIVE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_SEARCH_IN_SELECTION), WID_IN_SELECTION, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_REGULAR_EXPRESSION), WID_REGULAR_EXPRESSION, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY), WID_SIMILARITY, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_ADD), WID_SIMILARITY_ADD, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_EXCHANGE), WID_SIMILARITY_EXCHANGE,CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_RELAX), WID_SIMILARITY_RELAX, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_REMOVE), WID_SIMILARITY_REMOVE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_STYLES), WID_STYLES, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_WORDS), WID_WORDS, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aSearchPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_FRAME:
+ {
+ static SfxItemPropertyMapEntry aFramePropertyMap_Impl[] =
+ {
+ COMMON_FRAME_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAIN_NEXT_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_CHAIN_NEXTNAME},
+ { SW_PROP_NMID(UNO_NAME_CHAIN_PREV_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_CHAIN_PREVNAME},
+ /*not impl*/ { SW_PROP_NMID(UNO_NAME_CLIENT_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_CLIENTMAP },
+ { SW_PROP_NMID(UNO_NAME_EDIT_IN_READONLY), RES_EDIT_IN_READONLY, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ //next elements are part of the service description
+ { SW_PROP_NMID(UNO_NAME_FRAME_HEIGHT_ABSOLUTE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FRAME_HEIGHT_PERCENT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FRMSIZE_IS_AUTO_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_FRAME_WIDTH_ABSOLUTE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FRAME_WIDTH_PERCENT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH },
+ { SW_PROP_NMID(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
+ { SW_PROP_NMID(UNO_NAME_WIDTH_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE },
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aFramePropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_GRAPHIC:
+ {
+ static SfxItemPropertyMapEntry aGraphicPropertyMap_Impl[] =
+ {
+ COMMON_FRAME_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_CROP), RES_GRFATR_CROPGRF, CPPU_E2T(CPPUTYPE_GRFCROP), PROPERTY_NONE, CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HORI_MIRRORED_ON_EVEN_PAGES), RES_GRFATR_MIRRORGRF, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_MIRROR_HORZ_EVEN_PAGES },
+ { SW_PROP_NMID(UNO_NAME_HORI_MIRRORED_ON_ODD_PAGES), RES_GRFATR_MIRRORGRF, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_MIRROR_HORZ_ODD_PAGES },
+ { SW_PROP_NMID(UNO_NAME_VERT_MIRRORED), RES_GRFATR_MIRRORGRF, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_MIRROR_VERT },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_U_R_L, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, CPPU_E2T(CPPUTYPE_REFXGRAPHIC), 0, 0 },
+ { SW_PROP_NMID(UNO_NAME_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::READONLY, CONVERT_TWIPS},
+// { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_COUNTOUR_PP, CPPU_E2T(CPPUTYPE_PNTSEQSEQ), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_CONTOUR), FN_UNO_IS_AUTOMATIC_CONTOUR , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_ROTATION), RES_GRFATR_ROTATION, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_LUMINANCE), RES_GRFATR_LUMINANCE, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_CONTRAST), RES_GRFATR_CONTRAST, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_RED), RES_GRFATR_CHANNELR, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_GREEN), RES_GRFATR_CHANNELG, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_BLUE), RES_GRFATR_CHANNELB, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_GAMMA), RES_GRFATR_GAMMA, CPPU_E2T(CPPUTYPE_DOUBLE), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_IS_INVERTED), RES_GRFATR_INVERT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_TRANSPARENCY), RES_GRFATR_TRANSPARENCY, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_COLOR_MODE), RES_GRFATR_DRAWMODE, CPPU_E2T(CPPUTYPE_COLORMODE), 0, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aGraphicPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_EMBEDDED_OBJECT:
+ {
+ static SfxItemPropertyMapEntry aEmbeddedPropertyMap_Impl[] =
+ {
+ COMMON_FRAME_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE},
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_COUNTOUR_PP, CPPU_E2T(CPPUTYPE_PNTSEQSEQ), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_CONTOUR), FN_UNO_IS_AUTOMATIC_CONTOUR , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_CLSID), FN_UNO_CLSID, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_STREAM_NAME), FN_UNO_STREAM_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_MODEL), FN_UNO_MODEL, CPPU_E2T(CPPUTYPE_REFMODEL), PropertyAttribute::READONLY|PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_URL), FN_UNO_REPLACEMENT_GRAPHIC_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, CPPU_E2T(CPPUTYPE_REFXGRAPHIC), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, CPPU_E2T(CPPUTYPE_REFCOMPONENT), PropertyAttribute::READONLY, 0},
+// { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aEmbeddedPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SHAPE:
+ {
+ static SfxItemPropertyMapEntry aShapeMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_ANCHOR_PAGENUM },
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORTYPE},
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_FRAME), RES_ANCHOR, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORFRAME},
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_POSITION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_HORIORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_RELATION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_HORIORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_SURROUND), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_ANCHORONLY), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_SURROUND_ANCHORONLY },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_VERTORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_POSITION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_VERTORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_RELATION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_VERTORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FN_TEXT_RANGE, CPPU_E2T(CPPUTYPE_REFTXTRANGE), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OPAQUE), RES_OPAQUE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_POSITION), FN_ANCHOR_POSITION, CPPU_E2T(CPPUTYPE_AWTPOINT), PropertyAttribute::READONLY, 0},
+ // OD 2004-05-04 #i26791#
+ { SW_PROP_NMID(UNO_NAME_IS_FOLLOWING_TEXT_FLOW), RES_FOLLOW_TEXT_FLOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // --> OD 2004-06-29 #i28701#
+ { SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE},
+ // --> OD 2004-08-06 #i28749#
+ { SW_PROP_NMID( UNO_NAME_TRANSFORMATION_IN_HORI_L2R),
+ FN_SHAPE_TRANSFORMATION_IN_HORI_L2R,
+ CPPU_E2T(CPPUTYPE_TRANSFORMATIONINHORIL2R),
+ PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID( UNO_NAME_POSITION_LAYOUT_DIR),
+ FN_SHAPE_POSITION_LAYOUT_DIR,
+ CPPU_E2T(CPPUTYPE_INT16),
+ PROPERTY_NONE, 0},
+ // <--
+ // --> OD 2004-10-28 #i36248#
+ { SW_PROP_NMID( UNO_NAME_STARTPOSITION_IN_HORI_L2R),
+ FN_SHAPE_STARTPOSITION_IN_HORI_L2R,
+ CPPU_E2T(CPPUTYPE_AWTPOINT),
+ PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID( UNO_NAME_ENDPOSITION_IN_HORI_L2R),
+ FN_SHAPE_ENDPOSITION_IN_HORI_L2R,
+ CPPU_E2T(CPPUTYPE_AWTPOINT),
+ PropertyAttribute::READONLY, 0},
+ // <--
+ // --> OD 2006-11-09 #i71182#
+ // missing map entry for property <PageToogle>
+ { SW_PROP_NMID(UNO_NAME_PAGE_TOGGLE), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_HORIORIENT_PAGETOGGLE },
+ // <--
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aShapeMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_MARK:
+ {
+ static SfxItemPropertyMapEntry aIdxMarkMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PRIMARY_KEY), WID_PRIMARY_KEY, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SECONDARY_KEY), WID_SECONDARY_KEY, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_READING), WID_TEXT_READING, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PRIMARY_KEY_READING), WID_PRIMARY_KEY_READING, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SECONDARY_KEY_READING), WID_SECONDARY_KEY_READING, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_MAIN_ENTRY), WID_MAIN_ENTRY, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aIdxMarkMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_CNTIDX_MARK:
+ {
+ static SfxItemPropertyMapEntry aCntntMarkMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aCntntMarkMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_USER_MARK:
+ {
+ static SfxItemPropertyMapEntry aUserMarkMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL ), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_INDEX_NAME), WID_USER_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aUserMarkMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_IDX:
+ {
+ static SfxItemPropertyMapEntry aTOXIndexMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_ALPHABETICAL_SEPARATORS), WID_USE_ALPHABETICAL_SEPARATORS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_KEY_AS_ENTRY), WID_USE_KEY_AS_ENTRY , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_COMBINED_ENTRIES), WID_USE_COMBINED_ENTRIES , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_CASE_SENSITIVE), WID_IS_CASE_SENSITIVE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_P_P), WID_USE_P_P , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_DASH), WID_USE_DASH , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_UPPER_CASE), WID_USE_UPPER_CASE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_??? ), WID_??? , &_getReflection , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_MAIN_ENTRY_CHARACTER_STYLE_NAME), WID_MAIN_ENTRY_CHARACTER_STYLE_NAME , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLESEPARATOR), WID_PARA_SEP, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL2), WID_PARA_LEV2, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL3), WID_PARA_LEV3, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_COMMA_SEPARATED), WID_IS_COMMA_SEPARATED, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LOCALE), WID_IDX_LOCALE, CPPU_E2T(CPPUTYPE_LOCALE), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), WID_IDX_SORT_ALGORITHM, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTOXIndexMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_CNTNT:
+ {
+ static SfxItemPropertyMapEntry aTOXContentMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_LEVEL), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_OUTLINE), WID_CREATE_FROM_OUTLINE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_PARAGRAPH_STYLE_NAMES), WID_PARAGRAPH_STYLE_NAMES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_PARAGRAPH_STYLES), WID_LEVEL_PARAGRAPH_STYLES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES), WID_CREATE_FROM_PARAGRAPH_STYLES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_RECALC_TAB_STOPS), WID_RECALC_TAB_STOPS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_??? ), WID_??? , &_getReflection , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL2), WID_PARA_LEV2, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL3), WID_PARA_LEV3, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL4), WID_PARA_LEV4, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL5), WID_PARA_LEV5, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL6), WID_PARA_LEV6, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL7), WID_PARA_LEV7, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL8), WID_PARA_LEV8, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL9), WID_PARA_LEV9, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL10), WID_PARA_LEV10, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTOXContentMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_USER:
+ {
+ static SfxItemPropertyMapEntry aTOXUserMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_PARAGRAPH_STYLE_NAMES), WID_PARAGRAPH_STYLE_NAMES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_LEVEL_FROM_SOURCE), WID_USE_LEVEL_FROM_SOURCE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_PARAGRAPH_STYLES), WID_LEVEL_PARAGRAPH_STYLES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PropertyAttribute::READONLY,0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES), WID_CREATE_FROM_PARAGRAPH_STYLES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_TABLES), WID_CREATE_FROM_TABLES , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_TEXT_FRAMES), WID_CREATE_FROM_TEXT_FRAMES , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS), WID_CREATE_FROM_GRAPHIC_OBJECTS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS), WID_CREATE_FROM_EMBEDDED_OBJECTS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL2), WID_PARA_LEV2, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL3), WID_PARA_LEV3, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL4), WID_PARA_LEV4, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL5), WID_PARA_LEV5, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL6), WID_PARA_LEV6, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL7), WID_PARA_LEV7, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL8), WID_PARA_LEV8, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL9), WID_PARA_LEV9, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL10), WID_PARA_LEV10, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_INDEX_NAME), WID_USER_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTOXUserMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_TABLES:
+ {
+ static SfxItemPropertyMapEntry aTOXTablesMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LABELS), WID_CREATE_FROM_LABELS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_CATEGORY), WID_LABEL_CATEGORY , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_DISPLAY_TYPE), WID_LABEL_DISPLAY_TYPE , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTOXTablesMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_OBJECTS:
+ {
+ static SfxItemPropertyMapEntry aTOXObjectsMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_ALPHABETICAL_SEPARATORS), WID_USE_ALPHABETICAL_SEPARATORS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_MATH), WID_CREATE_FROM_STAR_MATH , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_CHART), WID_CREATE_FROM_STAR_CHART , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_CALC), WID_CREATE_FROM_STAR_CALC , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_DRAW), WID_CREATE_FROM_STAR_DRAW , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS), WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTOXObjectsMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_ILLUSTRATIONS:
+ {
+ static SfxItemPropertyMapEntry aTOXIllustrationsMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LABELS), WID_CREATE_FROM_LABELS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_ALPHABETICAL_SEPARATORS), WID_USE_ALPHABETICAL_SEPARATORS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_CATEGORY), WID_LABEL_CATEGORY , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_DISPLAY_TYPE), WID_LABEL_DISPLAY_TYPE , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTOXIllustrationsMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE_ROW:
+ {
+ static SfxItemPropertyMapEntry aTableRowPropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_SEPARATORS), FN_UNO_TABLE_COLUMN_SEPARATORS, CPPU_E2T(CPPUTYPE_TBLCOLSEP), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), FN_UNO_ROW_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_IS_AUTO_HEIGHT), FN_UNO_ROW_AUTO_HEIGHT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
+ { SW_PROP_NMID(UNO_NAME_WIDTH_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE },
+ { SW_PROP_NMID(UNO_NAME_IS_SPLIT_ALLOWED), RES_ROW_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ // { SW_PROP_NMID(UNO_NAME_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS },
+ // { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ {0,0,0,0,0,0}
+ };
+
+ aMapEntriesArr[nPropertyId] = (SfxItemPropertyMapEntry*)aTableRowPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE_CURSOR:
+ {
+ // das PropertySet entspricht dem Range ohne Chart-Properties
+ static SfxItemPropertyMapEntry aTableCursorPropertyMap_Impl [] =
+ {
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01
+ TABSTOPS_MAP_ENTRY
+
+ // attributes from PROPERTY_MAP_TABLE_CELL:
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_GRAPHIC_TRANSPARENT },
+ // commented ones are already part of
+ // COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01:
+// { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+// { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, MID_PROTECT_CONTENT},
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTableCursorPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_BOOKMARK:
+ {
+ static SfxItemPropertyMapEntry aBookmarkPropertyMap_Impl [] =
+ {
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aBookmarkPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_PARAGRAPH_EXTENSIONS:
+ {
+ static SfxItemPropertyMapEntry aParagraphExtensionsMap_Impl[] =
+ {
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+
+ aMapEntriesArr[nPropertyId] = aParagraphExtensionsMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_BIBLIOGRAPHY :
+ {
+ static SfxItemPropertyMapEntry aBibliographyMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_LOCALE), WID_IDX_LOCALE, CPPU_E2T(CPPUTYPE_LOCALE), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), WID_IDX_SORT_ALGORITHM, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aBibliographyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_DOCUMENT:
+ {
+ static SfxItemPropertyMapEntry aDocMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BASIC_LIBRARIES), WID_DOC_BASIC_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH },
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE), PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+ { SW_PROP_NMID(UNO_NAME_CHARACTER_COUNT), WID_DOC_CHAR_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DIALOG_LIBRARIES), WID_DOC_DIALOG_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L), WID_DOC_AUTO_MARK_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PARAGRAPH_COUNT), WID_DOC_PARA_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SHOW_CHANGES), WID_DOC_CHANGES_SHOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_WORD_COUNT), WID_DOC_WORD_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_WORD_SEPARATOR), WID_DOC_WORD_SEPARATOR, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_HIDE_FIELD_TIPS), WID_DOC_HIDE_TIPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_REDLINE_DISPLAY_TYPE), WID_DOC_REDLINE_DISPLAY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_REDLINE_PROTECTION_KEY), WID_DOC_CHANGES_PASSWORD, CPPU_E2T(CPPUTYPE_SEQINT8), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_FORBIDDEN_CHARACTERS), WID_DOC_FORBIDDEN_CHARS, CPPU_E2T(CPPUTYPE_REFFORBCHARS), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TWO_DIGIT_YEAR), WID_DOC_TWO_DIGIT_YEAR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_AUTOMATIC_CONTROL_FOCUS), WID_DOC_AUTOMATIC_CONTROL_FOCUS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_APPLY_FORM_DESIGN_MODE), WID_DOC_APPLY_FORM_DESIGN_MODE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_RUNTIME_UID), WID_DOC_RUNTIME_UID, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_LOCK_UPDATES), WID_DOC_LOCK_UPDATES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_HAS_VALID_SIGNATURES), WID_DOC_HAS_VALID_SIGNATURES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_BUILDID), WID_DOC_BUILDID, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0},
+ // --> OD 2006-03-21 #b6375613#
+ { SW_PROP_NMID(UNO_NAME_APPLY_WORKAROUND_FOR_B6375613), WID_APPLY_WORKAROUND_FOR_B6375613, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0},
+ // <--
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_LINK_TARGET:
+ {
+ static SfxItemPropertyMapEntry aLinkTargetMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_BITMAP), 0, CPPU_E2T(CPPUTYPE_REFBITMAP), PropertyAttribute::READONLY, 0xff},
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aLinkTargetMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_AUTO_TEXT_GROUP :
+ {
+ static SfxItemPropertyMapEntry aAutoTextGroupMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_FILE_PATH), WID_GROUP_PATH, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, PropertyAttribute::READONLY},
+ { SW_PROP_NMID(UNO_NAME_TITLE), WID_GROUP_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAutoTextGroupMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXTPORTION_EXTENSIONS:
+ {
+ static SfxItemPropertyMapEntry aTextPortionExtensionMap_Impl[] =
+ {
+ COMPLETE_TEXT_CURSOR_MAP
+ {SW_PROP_NMID(UNO_NAME_BOOKMARK), FN_UNO_BOOKMARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ {SW_PROP_NMID(UNO_NAME_CONTROL_CHARACTER), FN_UNO_CONTROL_CHARACTER, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, MID_HYPHEN_MIN_LEAD },
+ {SW_PROP_NMID(UNO_NAME_IS_COLLAPSED), FN_UNO_IS_COLLAPSED, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ {SW_PROP_NMID(UNO_NAME_IS_START), FN_UNO_IS_START, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ //_REDLINE_PROPERTIES
+ {SW_PROP_NMID(UNO_NAME_TEXT_PORTION_TYPE), FN_UNO_TEXT_PORTION_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_META), FN_UNO_META, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTextPortionExtensionMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_FOOTNOTE:
+ {
+ static SfxItemPropertyMapEntry aFootnoteMap_Impl[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_REFERENCE_ID), 0, CPPU_E2T(CPPUTYPE_INT16),PropertyAttribute::READONLY|PropertyAttribute::MAYBEVOID, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aFootnoteMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_COLUMS :
+ {
+ static SfxItemPropertyMapEntry aTextColumns_Impl[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC), WID_TXTCOL_IS_AUTOMATIC, CPPU_E2T(CPPUTYPE_BOOLEAN),PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_AUTOMATIC_DISTANCE), WID_TXTCOL_AUTO_DISTANCE, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_WIDTH), WID_TXTCOL_LINE_WIDTH, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_COLOR), WID_TXTCOL_LINE_COLOR, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT), WID_TXTCOL_LINE_REL_HGT, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT), WID_TXTCOL_LINE_ALIGN, CPPU_E2T(CPPUTYPE_VERTALIGN),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_IS_ON), WID_TXTCOL_LINE_IS_ON, CPPU_E2T(CPPUTYPE_BOOLEAN),PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTextColumns_Impl;
+ }
+ break;
+ case PROPERTY_MAP_REDLINE :
+ {
+ static SfxItemPropertyMapEntry aRedlineMap_Impl[] =
+ {
+ _REDLINE_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ {SW_PROP_NMID(UNO_NAME_REDLINE_START), 0, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_REDLINE_END), 0, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aRedlineMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_DEFAULT :
+ {
+ static SfxItemPropertyMapEntry aTextDefaultMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_TAB_STOP_DISTANCE), RES_PARATR_TABSTOP, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_STD_TAB | CONVERT_TWIPS},
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN
+ COMMON_HYPERLINK_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_SPLIT_ALLOWED), RES_ROW_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ // --> collapsing borders DVO, FME 2005-05-27 #i29550#
+ { SW_PROP_NMID(UNO_NAME_COLLAPSING_BORDERS), RES_COLLAPSING_BORDERS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // <-- collapsing
+
+ //text grid enhancement for better CJK support. 2007-04-01
+ //just export the default page mode property, other properties are not handled in this version
+ { SW_PROP_NMID(UNO_NAME_GRID_STANDARD_PAGE_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_STANDARD_MODE},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTextDefaultMap_Impl;
+ for( SfxItemPropertyMapEntry * pMap = aTextDefaultMap_Impl;
+ pMap->pName; ++pMap )
+ {
+ // UNO_NAME_PAGE_DESC_NAME should keep its MAYBEVOID flag
+ if (!(RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId))
+ pMap->nFlags &= ~PropertyAttribute::MAYBEVOID;
+ }
+ }
+ break;
+ case PROPERTY_MAP_REDLINE_PORTION :
+ {
+ static SfxItemPropertyMapEntry aRedlinePortionMap_Impl[] =
+ {
+ COMPLETE_TEXT_CURSOR_MAP
+ {SW_PROP_NMID(UNO_NAME_BOOKMARK), FN_UNO_BOOKMARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ {SW_PROP_NMID(UNO_NAME_CONTROL_CHARACTER), FN_UNO_CONTROL_CHARACTER, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, MID_HYPHEN_MIN_LEAD },
+ {SW_PROP_NMID(UNO_NAME_IS_COLLAPSED), FN_UNO_IS_COLLAPSED, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ {SW_PROP_NMID(UNO_NAME_IS_START), FN_UNO_IS_START, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ _REDLINE_PROPERTIES
+ {SW_PROP_NMID(UNO_NAME_TEXT_PORTION_TYPE), FN_UNO_TEXT_PORTION_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aRedlinePortionMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATETIME:
+ {
+ static SfxItemPropertyMapEntry aDateTimeFieldPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_ADJUST), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_IS_DATE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDateTimeFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_USER :
+ {
+ static SfxItemPropertyMapEntry aUserFieldPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+
+ aMapEntriesArr[nPropertyId] = aUserFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_SET_EXP :
+ {
+ static SfxItemPropertyMapEntry aSetExpFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_INPUT), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // #i69733# wrong name - UNO_NAME_IS_INPUT expanded to "Input" instead of "IsInput"
+ {SW_PROP_NMID(UNO_NAME_INPUT), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL3, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ //TODO: UNO_NAME_VARIABLE_NAME gibt es das wirklich?
+ {SW_PROP_NMID(UNO_NAME_SEQUENCE_VALUE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_VARIABLE_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aSetExpFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_GET_EXP :
+ {
+ static SfxItemPropertyMapEntry aGetExpFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_VARIABLE_SUBTYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aGetExpFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_FILE_NAME:
+ {
+ static SfxItemPropertyMapEntry aFileNameFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FILE_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aFileNameFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_PAGE_NUM :
+ {
+ static SfxItemPropertyMapEntry aPageNumFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_OFFSET), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_PAGENUMTYPE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_USERTEXT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aPageNumFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_AUTHOR :
+ {
+ static SfxItemPropertyMapEntry aAuthorFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FULL_NAME),FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAuthorFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_CHAPTER :
+ {
+ static SfxItemPropertyMapEntry aChapterFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CHAPTER_FORMAT),FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_LEVEL ),FIELD_PROP_BYTE1, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aChapterFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_GET_REFERENCE :
+ {
+ static SfxItemPropertyMapEntry aGetRefFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_REFERENCE_FIELD_PART),FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_REFERENCE_FIELD_SOURCE),FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEQUENCE_NUMBER), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SOURCE_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aGetRefFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT :
+ {
+ static SfxItemPropertyMapEntry aConditionedTxtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FALSE_CONTENT), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_CONDITION_TRUE) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_TRUE_CONTENT) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aConditionedTxtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_HIDDEN_TEXT :
+ {
+ static SfxItemPropertyMapEntry aHiddenTxtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_HIDDEN) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aHiddenTxtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_ANNOTATION :
+ {
+ static SfxItemPropertyMapEntry aAnnotationFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE), FIELD_PROP_DATE, CPPU_E2T(CPPUTYPE_DATE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::READONLY, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAnnotationFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_INPUT:
+ {
+ static SfxItemPropertyMapEntry aInputFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_HELP), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_TOOLTIP), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aInputFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_MACRO :
+ {
+ static SfxItemPropertyMapEntry aMacroFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_MACRO_NAME),FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_MACRO_LIBRARY),FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SCRIPT_URL),FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING),PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aMacroFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DDE :
+ {
+ static SfxItemPropertyMapEntry aDDEFieldPropMap [] =
+ {
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDDEFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DROPDOWN :
+ {
+ static SfxItemPropertyMapEntry aDropDownMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_ITEMS), FIELD_PROP_STRINGS, CPPU_E2T(CPPUTYPE_OUSTRINGS), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SELITEM), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_HELP), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_TOOLTIP), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDropDownMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_HIDDEN_PARA :
+ {
+ static SfxItemPropertyMapEntry aHiddenParaFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION),FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_HIDDEN) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aHiddenParaFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOC_INFO :
+ {
+ static SfxItemPropertyMapEntry aDocInfoFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INFO_FORMAT), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INFO_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_TEMPLATE_NAME :
+ {
+ static SfxItemPropertyMapEntry aTmplNameFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_FILE_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTmplNameFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_USER_EXT :
+ {
+ static SfxItemPropertyMapEntry aUsrExtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_USER_DATA_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId]= aUsrExtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_REF_PAGE_SET :
+ {
+ static SfxItemPropertyMapEntry aRefPgSetFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_OFFSET), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_ON), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aRefPgSetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_REF_PAGE_GET :
+ {
+ static SfxItemPropertyMapEntry aRefPgGetFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aRefPgGetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_JUMP_EDIT :
+ {
+ static SfxItemPropertyMapEntry aJumpEdtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_PLACEHOLDER), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_PLACEHOLDER_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aJumpEdtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_SCRIPT :
+ {
+ static SfxItemPropertyMapEntry aScriptFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SCRIPT_TYPE), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_URL_CONTENT), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aScriptFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET :
+ {
+ static SfxItemPropertyMapEntry aDBNextSetFieldPropMap [] =
+ {
+ // Note: DATA_BASE_NAME and DATA_BASE_URL
+ // are mapped to the same nMId, because internally we only use
+ // them as DataSource and it does not matter which one it is.
+
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONDITION) , FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_URL ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDBNextSetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET :
+ {
+ static SfxItemPropertyMapEntry aDBNumSetFieldPropMap [] =
+ {
+ // Note: DATA_BASE_NAME and DATA_BASE_URL
+ // are mapped to the same nMId, because internally we only use
+ // them as DataSource and it does not matter which one it is.
+
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_URL ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SET_NUMBER ), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDBNumSetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM :
+ {
+ static SfxItemPropertyMapEntry aDBSetNumFieldPropMap [] =
+ {
+ // Note: DATA_BASE_NAME and DATA_BASE_URL
+ // are mapped to the same nMId, because internally we only use
+ // them as DataSource and it does not matter which one it is.
+
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_URL ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SET_NUMBER ), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDBSetNumFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE :
+ {
+ static SfxItemPropertyMapEntry aDBFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FIELD_CODE), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_DATA_BASE_FORMAT),FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDBFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NAME :
+ {
+ static SfxItemPropertyMapEntry aDBNameFieldPropMap [] =
+ {
+ // Note: DATA_BASE_NAME and DATA_BASE_URL
+ // are mapped to the same nMId, because internally we only use
+ // them as DataSource and it does not matter which one it is.
+
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_URL ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDBNameFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCSTAT:
+ {
+ static SfxItemPropertyMapEntry aDocstatFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ // {UNO_NAME_STATISTIC_TYPE_ID,FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocstatFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR:
+ {
+ static SfxItemPropertyMapEntry aDocInfoAuthorPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoAuthorPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME:
+ {
+ static SfxItemPropertyMapEntry aDocInfoDateTimePropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_DATE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT),FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoDateTimePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME :
+ {
+ static SfxItemPropertyMapEntry aDocInfoEditTimePropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT),FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoEditTimePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_MISC:
+ {
+ static SfxItemPropertyMapEntry aDocInfoStringContentPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoStringContentPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM:
+ {
+ static SfxItemPropertyMapEntry aDocInfoCustomPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoCustomPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_REVISION :
+ {
+ static SfxItemPropertyMapEntry aDocInfoRevisionPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_REVISION), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDocInfoRevisionPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS:
+ {
+ static SfxItemPropertyMapEntry aCombinedCharactersPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aCombinedCharactersPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_TABLE_FORMULA:
+ {
+ static SfxItemPropertyMapEntry aTableFormulaPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTableFormulaPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DUMMY_0:
+ {
+ static SfxItemPropertyMapEntry aEmptyPropMap [] =
+ {
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aEmptyPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_USER :
+ {
+ static SfxItemPropertyMapEntry aUserFieldTypePropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_EXPRESSION), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ {SW_PROP_NMID(UNO_NAME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aUserFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DDE :
+ {
+ static SfxItemPropertyMapEntry aDDEFieldTypePropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_ELEMENT ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_FILE ), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_TYPE ), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_UPDATE), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR5, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDDEFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_SET_EXP :
+ {
+ static SfxItemPropertyMapEntry aSetExpFieldTypePropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CHAPTER_NUMBERING_LEVEL),FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_SEPARATOR), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aSetExpFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DATABASE :
+ {
+ static SfxItemPropertyMapEntry aDBFieldTypePropMap [] =
+ {
+ // Note: DATA_BASE_NAME and DATA_BASE_URL
+ // are mapped to the same nMId, because internally we only use
+ // them as DataSource and it does not matter which one it is.
+
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COLUMN_NAME ), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_URL ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aDBFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DUMMY0 :
+ {
+ static SfxItemPropertyMapEntry aStandardFieldMasterMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), 0, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aStandardFieldMasterMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY:
+ {
+ static SfxItemPropertyMapEntry aBibliographyFieldMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_FIELDS ) , FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_PROPERTYVALUE),PROPERTY_NONE, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aBibliographyFieldMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY:
+ {
+ static SfxItemPropertyMapEntry aBibliographyFieldMasterMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_BRACKET_BEFORE ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_BRACKET_AFTER ) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_NUMBER_ENTRIES ) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SORT_BY_POSITION) , FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_LOCALE), FIELD_PROP_LOCALE, CPPU_E2T(CPPUTYPE_LOCALE) , PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SORT_KEYS ) , FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_PROPERTYVALUES), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aBibliographyFieldMasterMap;
+ }
+ break;
+ case PROPERTY_MAP_TEXT :
+ {
+ static SfxItemPropertyMapEntry aTextMap[] =
+ {
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aTextMap;
+ }
+ break;
+ case PROPERTY_MAP_MAILMERGE :
+ {
+ static SfxItemPropertyMapEntry aMailMergeMap[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_SELECTION), WID_SELECTION, CPPU_E2T(CPPUTYPE_SEQANY), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_RESULT_SET), WID_RESULT_SET, CPPU_E2T(CPPUTYPE_REFRESULTSET), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CONNECTION), WID_CONNECTION, CPPU_E2T(CPPUTYPE_REFCONNECTION), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_MODEL), WID_MODEL, CPPU_E2T(CPPUTYPE_REFMODEL), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DATA_SOURCE_NAME), WID_DATA_SOURCE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DAD_COMMAND), WID_DATA_COMMAND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILTER), WID_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_URL), WID_DOCUMENT_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OUTPUT_URL), WID_OUTPUT_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DAD_COMMAND_TYPE), WID_DATA_COMMAND_TYPE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OUTPUT_TYPE), WID_OUTPUT_TYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ESCAPE_PROCESSING), WID_ESCAPE_PROCESSING, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SINGLE_PRINT_JOBS), WID_SINGLE_PRINT_JOBS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILE_NAME_FROM_COLUMN), WID_FILE_NAME_FROM_COLUMN, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILE_NAME_PREFIX), WID_FILE_NAME_PREFIX, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SUBJECT), WID_MAIL_SUBJECT, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ADDRESS_FROM_COLUMN), WID_ADDRESS_FROM_COLUMN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEND_AS_HTML), WID_SEND_AS_HTML, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEND_AS_ATTACHMENT), WID_SEND_AS_ATTACHMENT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_MAIL_BODY), WID_MAIL_BODY, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ATTACHMENT_NAME), WID_ATTACHMENT_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ATTACHMENT_FILTER), WID_ATTACHMENT_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PRINT_OPTIONS), WID_PRINT_OPTIONS, CPPU_E2T(CPPUTYPE_PROPERTYVALUES), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SAVE_AS_SINGLE_FILE), WID_SAVE_AS_SINGLE_FILE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SAVE_FILTER), WID_SAVE_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SAVE_FILTER_OPTIONS), WID_SAVE_FILTER_OPTIONS, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SAVE_FILTER_DATA), WID_SAVE_FILTER_DATA, CPPU_E2T(CPPUTYPE_PROPERTYVALUES), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_COPIES_TO), WID_COPIES_TO, CPPU_E2T(CPPUTYPE_OUSTRINGS), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_BLIND_COPIES_TO), WID_BLIND_COPIES_TO, CPPU_E2T(CPPUTYPE_OUSTRINGS), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IN_SERVER_PASSWORD), WID_IN_SERVER_PASSWORD, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OUT_SERVER_PASSWORD), WID_OUT_SERVER_PASSWORD, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aMailMergeMap;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_VIEW :
+ {
+ static SfxItemPropertyMapEntry pTextViewMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_PAGE_COUNT), WID_PAGE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_LINE_COUNT), WID_LINE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_CONSTANT_SPELLCHECK), WID_IS_CONSTANT_SPELLCHECK, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_HIDE_SPELL_MARKS), WID_IS_HIDE_SPELL_MARKS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, // deprecated #i91949
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = pTextViewMap;
+ }
+ break;
+ case PROPERTY_MAP_CHART2_DATA_SEQUENCE :
+ {
+ static SfxItemPropertyMapEntry aChart2DataSequenceMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_ROLE), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aChart2DataSequenceMap;
+ }
+ break;
+ case PROPERTY_MAP_METAFIELD:
+ {
+ static SfxItemPropertyMapEntry aMetaFieldMap[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), 0,
+ CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), 0,
+ CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aMetaFieldMap;
+ }
+ break;
+
+ default:
+ DBG_ERROR( "unexpected property map ID" );
+ }
+ //fill the character pointers and types into the arrays
+ SfxItemPropertyMapEntry* p = aMapEntriesArr[nPropertyId];
+ sal_uInt16 i = 0;
+ for( ; p->pName; ++p, ++i )
+ {
+ // set the name
+ const SwPropNameLen& rPropNm = GetPropName( (USHORT)(long)p->pName );
+ p->pName = rPropNm.pName;
+ p->nNameLen = rPropNm.nNameLen;
+ // get the cppu type from the comphelper
+ CppuTypes nTyp = (CppuTypes) (long) p->pType;
+ GenerateCppuType( nTyp, p->pType );
+ DBG_ASSERT( nTyp != (CppuTypes) (long) p->pType, "unknown type" );
+ }
+ }
+ return aMapEntriesArr[nPropertyId];
+}
+/*-- 17.02.2009 15:29:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SfxItemPropertySet* SwUnoPropertyMapProvider::GetPropertySet( sal_uInt16 nPropertyId)
+{
+ if( !aPropertySetArr[nPropertyId] )
+ {
+ const SfxItemPropertyMapEntry* pEntries = GetPropertyMapEntries(nPropertyId);
+ switch( nPropertyId )
+ {
+ case PROPERTY_MAP_TEXT_CURSOR:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_CURSOR(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_CURSOR;
+ }
+ break;
+ case PROPERTY_MAP_CHAR_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_CHAR_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CHAR_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_PARA_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_PARA_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARA_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_FRAME_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FRAME_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FRAME_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_PAGE_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_PAGE_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PAGE_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_NUM_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_NUM_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_NUM_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_SECTION:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_SECTION(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_SECTION;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_TABLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_TABLE;
+ }
+ break;
+ case PROPERTY_MAP_TABLE_CELL:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TABLE_CELL(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TABLE_CELL;
+ }
+ break;
+ case PROPERTY_MAP_TABLE_RANGE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TABLE_RANGE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TABLE_RANGE;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SEARCH:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_SEARCH(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_SEARCH;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_FRAME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_FRAME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_FRAME;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_GRAPHIC:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_GRAPHIC(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_GRAPHIC;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SHAPE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_SHAPE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_SHAPE;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_USER:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_USER(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_USER;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_CNTNT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_CNTNT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_CNTNT;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_IDX:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_IDX(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_IDX;
+ }
+ break;
+ case PROPERTY_MAP_USER_MARK:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_USER_MARK(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_USER_MARK;
+ }
+ break;
+ case PROPERTY_MAP_CNTIDX_MARK:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_CNTIDX_MARK(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CNTIDX_MARK;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_MARK:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_MARK(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_MARK;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE_ROW:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_TABLE_ROW(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_TABLE_ROW;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE_CURSOR:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_TABLE_CURSOR(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_TABLE_CURSOR;
+ }
+ break;
+ case PROPERTY_MAP_BOOKMARK:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_BOOKMARK(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_BOOKMARK;
+ }
+ break;
+ case PROPERTY_MAP_PARAGRAPH_EXTENSIONS:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_PARAGRAPH_EXTENSIONS(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARAGRAPH_EXTENSIONS;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_ILLUSTRATIONS:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_ILLUSTRATIONS(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_ILLUSTRATIONS;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_OBJECTS:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_OBJECTS(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_OBJECTS;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_TABLES:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_INDEX_TABLES(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_TABLES;
+ }
+ break;
+ case PROPERTY_MAP_BIBLIOGRAPHY :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_BIBLIOGRAPHY(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_BIBLIOGRAPHY;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_DOCUMENT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_DOCUMENT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_DOCUMENT;
+ }
+ break;
+ case PROPERTY_MAP_LINK_TARGET :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_LINK_TARGET(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_LINK_TARGET;
+ }
+ break;
+ case PROPERTY_MAP_AUTO_TEXT_GROUP :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_AUTO_TEXT_GROUP(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_AUTO_TEXT_GROUP;
+ }
+ break;
+ case PROPERTY_MAP_TEXTPORTION_EXTENSIONS :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXTPORTION_EXTENSIONS(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXTPORTION_EXTENSIONS;
+ }
+ break;
+ case PROPERTY_MAP_FOOTNOTE :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FOOTNOTE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FOOTNOTE;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_COLUMS :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_COLUMS(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_COLUMS;
+ }
+ break;
+ case PROPERTY_MAP_PARAGRAPH :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_PARAGRAPH(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARAGRAPH;
+ }
+ break;
+ case PROPERTY_MAP_EMBEDDED_OBJECT :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_EMBEDDED_OBJECT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_EMBEDDED_OBJECT;
+ }
+ break;
+ case PROPERTY_MAP_REDLINE :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_REDLINE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_REDLINE;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_DEFAULT :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_DEFAULT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_DEFAULT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATETIME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATETIME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATETIME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_USER:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_USER(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_USER;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_SET_EXP:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_SET_EXP(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_SET_EXP;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_GET_EXP:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_GET_EXP(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_GET_EXP;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_FILE_NAME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_FILE_NAME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_FILE_NAME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_PAGE_NUM:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_PAGE_NUM(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_PAGE_NUM;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_AUTHOR:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_AUTHOR(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_AUTHOR;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_CHAPTER:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_CHAPTER(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_CHAPTER;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_GET_REFERENCE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_GET_REFERENCE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_GET_REFERENCE;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_CONDITIONED_TEXT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_CONDITIONED_TEXT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_HIDDEN_TEXT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_HIDDEN_TEXT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_HIDDEN_TEXT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_ANNOTATION :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_ANNOTATION(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_ANNOTATION;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_INPUT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_INPUT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_INPUT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_MACRO:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_MACRO(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_MACRO;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DDE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DDE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DDE;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_HIDDEN_PARA:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_HIDDEN_PARA(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_HIDDEN_PARA;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOC_INFO :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOC_INFO(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOC_INFO;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_TEMPLATE_NAME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_TEMPLATE_NAME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_TEMPLATE_NAME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_USER_EXT :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_USER_EXT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_USER_EXT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_REF_PAGE_SET:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_REF_PAGE_SET(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_REF_PAGE_SET;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_REF_PAGE_GET:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_REF_PAGE_GET(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_REF_PAGE_GET;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_JUMP_EDIT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_JUMP_EDIT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_JUMP_EDIT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_SCRIPT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_SCRIPT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_SCRIPT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_NUM_SET(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_NUM_SET;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_SET_NUM(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_SET_NUM;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NAME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_NAME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_NAME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCSTAT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCSTAT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCSTAT;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_MISC :
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_MISC(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_MISC;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_REVISION:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_REVISION(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_REVISION;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DUMMY_0:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DUMMY_0(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DUMMY_0;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_TABLE_FORMULA:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_TABLE_FORMULA(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_TABLE_FORMULA;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_USER:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_USER(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_USER;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DDE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_DDE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_DDE;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_SET_EXP:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_SET_EXP(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_SET_EXP;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DATABASE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_DATABASE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_DATABASE;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DUMMY0:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_DUMMY0(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_DUMMY0;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_BIBLIOGRAPHY(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_BIBLIOGRAPHY;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY;
+ }
+ break;
+ case PROPERTY_MAP_TEXT:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT;
+ }
+ break;
+ case PROPERTY_MAP_REDLINE_PORTION:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_REDLINE_PORTION(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_REDLINE_PORTION;
+ }
+ break;
+ case PROPERTY_MAP_MAILMERGE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_MAILMERGE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_MAILMERGE;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DROPDOWN:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DROPDOWN(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DROPDOWN;
+ }
+ break;
+ case PROPERTY_MAP_CHART2_DATA_SEQUENCE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_CHART2_DATA_SEQUENCE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CHART2_DATA_SEQUENCE;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_VIEW:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_TEXT_VIEW(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_VIEW;
+ }
+ break;
+ case PROPERTY_MAP_CONDITIONAL_PARA_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_CONDITIONAL_PARA_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CONDITIONAL_PARA_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_CHAR_AUTO_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_CHAR_AUTO_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CHAR_AUTO_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_RUBY_AUTO_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_RUBY_AUTO_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_RUBY_AUTO_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_PARA_AUTO_STYLE:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_PARA_AUTO_STYLE(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARA_AUTO_STYLE;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM;
+ }
+ break;
+ case PROPERTY_MAP_METAFIELD:
+ {
+ static SfxItemPropertySet aPROPERTY_MAP_METAFIELD(pEntries);
+ aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_METAFIELD;
+ }
+ break;
+ }
+ }
+ return aPropertySetArr[nPropertyId];
+}
+
+/* -----------------04.07.98 11:42-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwItemPropertySet::FillItem(SfxItemSet& /*rSet*/, sal_uInt16 /*nWhich*/, sal_Bool /*bGetProperty*/) const
+{
+ sal_Bool bRet = sal_False;
+/* if(nWhich == SID_ATTR_PAGE_PAPERBIN)
+ {
+ rSet.Put(SvxPaperBinItem(SID_ATTR_PAGE_PAPERBIN, 0));
+ bRet = sal_True;
+ }*/
+ return bRet;
+}
+
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
new file mode 100644
index 000000000000..f572b5f3e91c
--- /dev/null
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -0,0 +1,3209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/table/TableSortField.hpp>
+
+#include <osl/endian.h>
+#include <rtl/ustrbuf.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <swtypes.hxx>
+#include <hintids.hxx>
+#include <cmdid.h>
+#include <hints.hxx>
+#include <IMark.hxx>
+#include <frmfmt.hxx>
+#include <doc.hxx>
+#include <istyleaccess.hxx>
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <unocrsr.hxx>
+#include <unocrsrhelper.hxx>
+#include <swundo.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <ftnidx.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <tools/urlobj.hxx>
+#include <pam.hxx>
+#include <tools/cachestr.hxx>
+#include <shellio.hxx>
+#include <swerror.h>
+#include <swtblfmt.hxx>
+#include <fmtruby.hxx>
+#include <docsh.hxx>
+#include <docstyle.hxx>
+#include <charfmt.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#include <poolfmt.hxx>
+#include <edimp.hxx>
+#include <fchrfmt.hxx>
+#include <fmtautofmt.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <doctxm.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unomap.hxx>
+#include <unosett.hxx>
+#include <unoprnms.hxx>
+#include <unotbl.hxx>
+#include <unodraw.hxx>
+#include <unocoll.hxx>
+#include <unostyle.hxx>
+#include <unofield.hxx>
+#include <unometa.hxx>
+#include <fmtanchr.hxx>
+#include <editeng/flstitem.hxx>
+#include <svtools/ctrltool.hxx>
+#include <flypos.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <fmthdft.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtflcnt.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#include <svl/svstdarr.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <fmtclds.hxx>
+#include <dcontact.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <crsskip.hxx>
+#include <sortopt.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <memory>
+#include <unoparaframeenum.hxx>
+#include <unoparagraph.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+/****************************************************************************
+ static methods
+****************************************************************************/
+uno::Sequence< sal_Int8 > CreateUnoTunnelId()
+{
+ static osl::Mutex aCreateMutex;
+ osl::Guard<osl::Mutex> aGuard( aCreateMutex );
+ uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ return aSeq;
+}
+/****************************************************************************
+ Hilfsklassen
+****************************************************************************/
+
+/* -----------------13.05.98 12:15-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoInternalPaM::SwUnoInternalPaM(SwDoc& rDoc) :
+ SwPaM(rDoc.GetNodes())
+{
+}
+SwUnoInternalPaM::~SwUnoInternalPaM()
+{
+ while( GetNext() != this)
+ {
+ delete GetNext();
+ }
+}
+
+SwUnoInternalPaM& SwUnoInternalPaM::operator=(const SwPaM& rPaM)
+{
+ const SwPaM* pTmp = &rPaM;
+ *GetPoint() = *rPaM.GetPoint();
+ if(rPaM.HasMark())
+ {
+ SetMark();
+ *GetMark() = *rPaM.GetMark();
+ }
+ else
+ DeleteMark();
+ while(&rPaM != (pTmp = (const SwPaM*)pTmp->GetNext()))
+ {
+ if(pTmp->HasMark())
+ new SwPaM(*pTmp->GetMark(), *pTmp->GetPoint(), this);
+ else
+ new SwPaM(*pTmp->GetPoint(), this);
+ }
+ return *this;
+}
+
+/*-----------------09.03.98 08:29-------------------
+
+--------------------------------------------------*/
+void SwUnoCursorHelper::SelectPam(SwPaM & rPam, const bool bExpand)
+{
+ if (bExpand)
+ {
+ if (!rPam.HasMark())
+ {
+ rPam.SetMark();
+ }
+ }
+ else if (rPam.HasMark())
+ {
+ rPam.DeleteMark();
+ }
+}
+
+/* -----------------20.05.98 14:59-------------------
+ *
+ * --------------------------------------------------*/
+void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer)
+{
+ if (!rPam.HasMark())
+ {
+ return;
+ }
+ SvCacheStream aStream( 20480 );
+#ifdef OSL_BIGENDIAN
+ aStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+#else
+ aStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+#endif
+ WriterRef xWrt;
+ // TODO/MBA: looks like a BaseURL doesn't make sense here
+ SwReaderWriter::GetWriter( C2S(FILTER_TEXT_DLG), String(), xWrt );
+ if( xWrt.Is() )
+ {
+ SwWriter aWriter( aStream, rPam );
+ xWrt->bASCII_NoLastLineEnd = sal_True;
+ xWrt->bExportPargraphNumbering = sal_False;
+ SwAsciiOptions aOpt = xWrt->GetAsciiOptions();
+ aOpt.SetCharSet( RTL_TEXTENCODING_UNICODE );
+ xWrt->SetAsciiOptions( aOpt );
+ xWrt->bUCS2_WithStartChar = FALSE;
+ // --> FME #i68522#
+ const BOOL bOldShowProgress = xWrt->bShowProgress;
+ xWrt->bShowProgress = FALSE;
+ // <--
+
+ long lLen;
+ if( !IsError( aWriter.Write( xWrt ) ) &&
+ 0x7ffffff > (( lLen = aStream.GetSize() )
+ / sizeof( sal_Unicode )) + 1 )
+ {
+ aStream << (sal_Unicode)'\0';
+
+ long lUniLen = (lLen / sizeof( sal_Unicode ));
+ ::rtl::OUStringBuffer aStrBuffer( lUniLen );
+ aStream.Seek( 0 );
+ aStream.ResetError();
+ while(lUniLen)
+ {
+ String sBuf;
+ sal_Int32 nLocalLen = 0;
+ if( lUniLen >= STRING_MAXLEN )
+ {
+ nLocalLen = STRING_MAXLEN - 1;
+ }
+ else
+ {
+ nLocalLen = lUniLen;
+ }
+ sal_Unicode *const pStrBuf =
+ sBuf.AllocBuffer( xub_StrLen( nLocalLen + 1));
+ aStream.Read( pStrBuf, 2 * nLocalLen );
+ pStrBuf[ nLocalLen ] = '\0';
+ aStrBuffer.append( pStrBuf, nLocalLen );
+ lUniLen -= nLocalLen;
+ }
+ rBuffer = aStrBuffer.makeStringAndClear();
+ }
+ xWrt->bShowProgress = bOldShowProgress;
+ }
+}
+
+/* -----------------06.07.98 07:33-------------------
+ *
+ * --------------------------------------------------*/
+static void
+lcl_setCharStyle(SwDoc *const pDoc, const uno::Any & rValue, SfxItemSet & rSet)
+throw (lang::IllegalArgumentException)
+{
+ SwDocShell *const pDocSh = pDoc->GetDocShell();
+ if(pDocSh)
+ {
+ OUString uStyle;
+ if (!(rValue >>= uStyle))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
+ SwDocStyleSheet *const pStyle = static_cast<SwDocStyleSheet*>(
+ pDocSh->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR));
+ if (!pStyle)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ const SwFmtCharFmt aFmt(pStyle->GetCharFmt());
+ rSet.Put(aFmt);
+ }
+};
+/* -----------------08.06.06 10:43-------------------
+ *
+ * --------------------------------------------------*/
+static void
+lcl_setAutoStyle(IStyleAccess & rStyleAccess, const uno::Any & rValue,
+ SfxItemSet & rSet, const bool bPara)
+throw (lang::IllegalArgumentException)
+{
+ OUString uStyle;
+ if (!(rValue >>= uStyle))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ StylePool::SfxItemSet_Pointer_t pStyle = bPara ?
+ rStyleAccess.getByName(uStyle, IStyleAccess::AUTO_STYLE_PARA ):
+ rStyleAccess.getByName(uStyle, IStyleAccess::AUTO_STYLE_CHAR );
+ if(pStyle.get())
+ {
+ SwFmtAutoFmt aFmt( (bPara)
+ ? sal::static_int_cast< USHORT >(RES_AUTO_STYLE)
+ : sal::static_int_cast< USHORT >(RES_TXTATR_AUTOFMT) );
+ aFmt.SetStyleHandle( pStyle );
+ rSet.Put(aFmt);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+};
+/* -----------------30.06.98 08:46-------------------
+ *
+ * --------------------------------------------------*/
+void
+SwUnoCursorHelper::SetTxtFmtColl(const uno::Any & rAny, SwPaM & rPaM)
+throw (lang::IllegalArgumentException)
+{
+ SwDoc *const pDoc = rPaM.GetDoc();
+ SwDocShell *const pDocSh = pDoc->GetDocShell();
+ if(!pDocSh)
+ return;
+ OUString uStyle;
+ rAny >>= uStyle;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ SwDocStyleSheet *const pStyle = static_cast<SwDocStyleSheet*>(
+ pDocSh->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_PARA));
+ if (!pStyle)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwTxtFmtColl *const pLocal = pStyle->GetCollection();
+ UnoActionContext aAction(pDoc);
+ pDoc->StartUndo( UNDO_START, NULL );
+ SwPaM *pTmpCrsr = &rPaM;
+ do {
+ pDoc->SetTxtFmtColl(*pTmpCrsr, pLocal);
+ pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
+ } while ( pTmpCrsr != &rPaM );
+ pDoc->EndUndo( UNDO_END, NULL );
+}
+
+/* -----------------06.07.98 07:38-------------------
+ *
+ * --------------------------------------------------*/
+bool
+SwUnoCursorHelper::SetPageDesc(
+ const uno::Any& rValue, SwDoc & rDoc, SfxItemSet & rSet)
+{
+ OUString uDescName;
+ if (!(rValue >>= uDescName))
+ {
+ return false;
+ }
+ ::std::auto_ptr<SwFmtPageDesc> pNewDesc;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
+ {
+ pNewDesc.reset(new SwFmtPageDesc(
+ *static_cast<const SwFmtPageDesc*>(pItem)));
+ }
+ if (!pNewDesc.get())
+ {
+ pNewDesc.reset(new SwFmtPageDesc());
+ }
+ String sDescName;
+ SwStyleNameMapper::FillUIName(uDescName, sDescName,
+ nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True);
+ if (!pNewDesc->GetPageDesc() ||
+ (pNewDesc->GetPageDesc()->GetName() != sDescName))
+ {
+ sal_Bool bPut = sal_False;
+ if(sDescName.Len())
+ {
+ SwPageDesc *const pPageDesc =
+ ::GetPageDescByName_Impl(rDoc, sDescName);
+ if (!pPageDesc)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ pPageDesc->Add( pNewDesc.get() );
+ bPut = sal_True;
+ }
+ if(!bPut)
+ {
+ rSet.ClearItem(RES_BREAK);
+ rSet.Put(SwFmtPageDesc());
+ }
+ else
+ {
+ rSet.Put(*pNewDesc);
+ }
+ }
+ return true;
+}
+
+/* -----------------30.06.98 10:29-------------------
+ *
+ * --------------------------------------------------*/
+static void
+lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue)
+{
+ sal_Int16 nTmp = 1;
+ rValue >>= nTmp;
+ sal_uInt16 nStt = (nTmp < 0 ? USHRT_MAX : (sal_uInt16)nTmp);
+ SwDoc* pDoc = rCrsr.GetDoc();
+ UnoActionContext aAction(pDoc);
+
+ if( rCrsr.GetNext() != &rCrsr ) // Mehrfachselektion ?
+ {
+ pDoc->StartUndo( UNDO_START, NULL );
+ SwPamRanges aRangeArr( rCrsr );
+ SwPaM aPam( *rCrsr.GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ {
+ pDoc->SetNumRuleStart(*aRangeArr.SetPam( n, aPam ).GetPoint());
+ pDoc->SetNodeNumStart(*aRangeArr.SetPam( n, aPam ).GetPoint(),
+ nStt );
+ }
+ pDoc->EndUndo( UNDO_END, NULL);
+ }
+ else
+ {
+ pDoc->SetNumRuleStart( *rCrsr.GetPoint());
+ pDoc->SetNodeNumStart( *rCrsr.GetPoint(), nStt );
+ }
+}
+
+static bool
+lcl_setCharFmtSequence(SwPaM & rPam, uno::Any const& rValue)
+{
+ uno::Sequence<OUString> aCharStyles;
+ if (!(rValue >>= aCharStyles))
+ {
+ return false;
+ }
+
+ for (sal_Int32 nStyle = 0; nStyle < aCharStyles.getLength(); nStyle++)
+ {
+ uno::Any aStyle;
+ rPam.GetDoc()->StartUndo(UNDO_START, NULL);
+ aStyle <<= aCharStyles.getConstArray()[nStyle];
+ // create a local set and apply each format directly
+ SfxItemSet aSet(rPam.GetDoc()->GetAttrPool(),
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT);
+ lcl_setCharStyle(rPam.GetDoc(), aStyle, aSet);
+ // the first style should replace the current attributes,
+ // all other have to be added
+ SwUnoCursorHelper::SetCrsrAttr(rPam, aSet, (nStyle)
+ ? nsSetAttrMode::SETATTR_DONTREPLACE
+ : nsSetAttrMode::SETATTR_DEFAULT);
+ rPam.GetDoc()->EndUndo(UNDO_START, NULL);
+ }
+ return true;
+}
+
+static void
+lcl_setDropcapCharStyle(SwPaM & rPam, SfxItemSet & rItemSet,
+ uno::Any const& rValue)
+{
+ OUString uStyle;
+ if (!(rValue >>= uStyle))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
+ SwDoc *const pDoc = rPam.GetDoc();
+ //default character style must not be set as default format
+ SwDocStyleSheet *const pStyle = static_cast<SwDocStyleSheet*>(
+ pDoc->GetDocShell()
+ ->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR));
+ if (!pStyle ||
+ (static_cast<SwDocStyleSheet*>(pStyle)->GetCharFmt() ==
+ pDoc->GetDfltCharFmt()))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ ::std::auto_ptr<SwFmtDrop> pDrop;
+ SfxPoolItem const* pItem(0);
+ if (SFX_ITEM_SET ==
+ rItemSet.GetItemState(RES_PARATR_DROP, sal_True, &pItem))
+ {
+ pDrop.reset(new SwFmtDrop(*static_cast<const SwFmtDrop*>(pItem)));
+ }
+ if (!pDrop.get())
+ {
+ pDrop.reset(new SwFmtDrop);
+ }
+ const rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*pStyle));
+ pDrop->SetCharFmt(xStyle->GetCharFmt());
+ rItemSet.Put(*pDrop);
+}
+
+static void
+lcl_setRubyCharstyle(SfxItemSet & rItemSet, uno::Any const& rValue)
+{
+ OUString sTmp;
+ if (!(rValue >>= sTmp))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ ::std::auto_ptr<SwFmtRuby> pRuby;
+ const SfxPoolItem* pItem;
+ if (SFX_ITEM_SET ==
+ rItemSet.GetItemState(RES_TXTATR_CJK_RUBY, sal_True, &pItem))
+ {
+ pRuby.reset(new SwFmtRuby(*static_cast<const SwFmtRuby*>(pItem)));
+ }
+ if (!pRuby.get())
+ {
+ pRuby.reset(new SwFmtRuby(aEmptyStr));
+ }
+ String sStyle;
+ SwStyleNameMapper::FillUIName(sTmp, sStyle,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ pRuby->SetCharFmtName(sStyle);
+ pRuby->SetCharFmtId(0);
+ if (sStyle.Len() > 0)
+ {
+ const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(
+ sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ pRuby->SetCharFmtId(nId);
+ }
+ rItemSet.Put(*pRuby);
+}
+
+/* -----------------17.09.98 09:44-------------------
+ *
+ * --------------------------------------------------*/
+bool
+SwUnoCursorHelper::SetCursorPropertyValue(
+ SfxItemPropertySimpleEntry const& rEntry, const uno::Any& rValue,
+ SwPaM & rPam, SfxItemSet & rItemSet)
+throw (lang::IllegalArgumentException)
+{
+ if (!(rEntry.nFlags & beans::PropertyAttribute::MAYBEVOID) &&
+ (rValue.getValueType() == ::getCppuVoidType()))
+ {
+ return false;
+ }
+ bool bRet = true;
+ switch (rEntry.nWID)
+ {
+ case RES_TXTATR_CHARFMT:
+ lcl_setCharStyle(rPam.GetDoc(), rValue, rItemSet);
+ break;
+ case RES_TXTATR_AUTOFMT:
+ lcl_setAutoStyle(rPam.GetDoc()->GetIStyleAccess(),
+ rValue, rItemSet, false);
+ break;
+ case FN_UNO_CHARFMT_SEQUENCE:
+ lcl_setCharFmtSequence(rPam, rValue);
+ break;
+ case FN_UNO_PARA_STYLE :
+ SwUnoCursorHelper::SetTxtFmtColl(rValue, rPam);
+ break;
+ case RES_AUTO_STYLE:
+ lcl_setAutoStyle(rPam.GetDoc()->GetIStyleAccess(),
+ rValue, rItemSet, true);
+ break;
+ case FN_UNO_PAGE_STYLE:
+ //FIXME nothing here?
+ break;
+ case FN_UNO_NUM_START_VALUE:
+ lcl_SetNodeNumStart( rPam, rValue );
+ break;
+ case FN_UNO_NUM_LEVEL:
+ // --> OD 2008-07-14 #i91601#
+ case FN_UNO_LIST_ID:
+ // <--
+ case FN_UNO_IS_NUMBER:
+ {
+ // multi selection is not considered
+ SwTxtNode *const pTxtNd = rPam.GetNode()->GetTxtNode();
+ // --> OD 2008-05-14 #refactorlists# - check on list style not needed
+// const SwNumRule* pRule = pTxtNd->GetNumRule();
+// if( FN_UNO_NUM_LEVEL == rEntry.nWID && pRule != NULL )
+ if (FN_UNO_NUM_LEVEL == rEntry.nWID)
+ // <--
+ {
+ sal_Int16 nLevel = 0;
+ if (rValue >>= nLevel)
+ {
+ pTxtNd->SetAttrListLevel(nLevel);
+ }
+ }
+ // --> OD 2008-07-14 #i91601#
+ else if (FN_UNO_LIST_ID == rEntry.nWID)
+ {
+ ::rtl::OUString sListId;
+ if (rValue >>= sListId)
+ {
+ pTxtNd->SetListId( sListId );
+ }
+ }
+ // <--
+ else if (FN_UNO_IS_NUMBER == rEntry.nWID)
+ {
+ sal_Bool bIsNumber(sal_False);
+ if (rValue >>= bIsNumber)
+ {
+ if (!bIsNumber)
+ {
+ pTxtNd->SetCountedInList( false );
+ }
+ }
+ }
+ //PROPERTY_MAYBEVOID!
+ }
+ break;
+ case FN_NUMBER_NEWSTART:
+ {
+ sal_Bool bVal = sal_False;
+ if (!(rValue >>= bVal))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rPam.GetDoc()->SetNumRuleStart(*rPam.GetPoint(), bVal);
+ }
+ break;
+ case FN_UNO_NUM_RULES:
+ SwUnoCursorHelper::setNumberingProperty(rValue, rPam);
+ break;
+ case RES_PARATR_DROP:
+ {
+ if (MID_DROPCAP_CHAR_STYLE_NAME == rEntry.nMemberId)
+ {
+ lcl_setDropcapCharStyle(rPam, rItemSet, rValue);
+ }
+ else
+ {
+ bRet = false;
+ }
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ {
+ if (MID_RUBY_CHARSTYLE == rEntry.nMemberId)
+ {
+ lcl_setRubyCharstyle(rItemSet, rValue);
+ }
+ else
+ {
+ bRet = false;
+ }
+ }
+ break;
+ case RES_PAGEDESC:
+ {
+ if (MID_PAGEDESC_PAGEDESCNAME == rEntry.nMemberId)
+ {
+ SwUnoCursorHelper::SetPageDesc(
+ rValue, *rPam.GetDoc(), rItemSet);
+ }
+ else
+ {
+ bRet = false;
+ }
+ }
+ break;
+ default:
+ bRet = false;
+ }
+ return bRet;
+}
+
+/* -----------------30.06.98 08:39-------------------
+ *
+ * --------------------------------------------------*/
+SwFmtColl *
+SwUnoCursorHelper::GetCurTxtFmtColl(SwPaM & rPaM, const bool bConditional)
+{
+ static const sal_uInt16 nMaxLookup = 1000;
+ SwFmtColl *pFmt = 0;
+
+// if ( GetCrsrCnt() > nMaxLookup )
+// return 0;
+ bool bError = false;
+ SwPaM *pTmpCrsr = &rPaM;
+ do
+ {
+ const ULONG nSttNd = pTmpCrsr->Start()->nNode.GetIndex();
+ const ULONG nEndNd = pTmpCrsr->End()->nNode.GetIndex();
+
+ if( nEndNd - nSttNd >= nMaxLookup )
+ {
+ pFmt = 0;
+ break;
+ }
+
+ const SwNodes& rNds = rPaM.GetDoc()->GetNodes();
+ for( ULONG n = nSttNd; n <= nEndNd; ++n )
+ {
+ SwTxtNode const*const pNd = rNds[ n ]->GetTxtNode();
+ if( pNd )
+ {
+ SwFmtColl *const pNdFmt = (bConditional)
+ ? pNd->GetFmtColl() : &pNd->GetAnyFmtColl();
+ if( !pFmt )
+ {
+ pFmt = pNdFmt;
+ }
+ else if( pFmt != pNdFmt )
+ {
+ bError = true;
+ break;
+ }
+ }
+ }
+
+ pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
+ } while ( pTmpCrsr != &rPaM );
+ return (bError) ? 0 : pFmt;
+}
+
+/* -----------------26.06.98 16:20-------------------
+ * Hilfsfunktion fuer PageDesc
+ * --------------------------------------------------*/
+SwPageDesc* GetPageDescByName_Impl(SwDoc& rDoc, const String& rName)
+{
+ SwPageDesc* pRet = 0;
+ sal_uInt16 nDCount = rDoc.GetPageDescCnt();
+ sal_uInt16 i;
+
+ for( i = 0; i < nDCount; i++ )
+ {
+ SwPageDesc* pDsc = &rDoc._GetPageDesc( i );
+ if(pDsc->GetName() == rName)
+ {
+ pRet = pDsc;
+ break;
+ }
+ }
+ if(!pRet)
+ {
+ for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i)
+ {
+ const String aFmtName(SW_RES(i));
+ if(aFmtName == rName)
+ {
+ pRet = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(
+ RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
+ break;
+ }
+ }
+ }
+
+ return pRet;
+ }
+
+/******************************************************************
+ * SwXTextCursor
+ ******************************************************************/
+
+class SwXTextCursor::Impl
+ : public SwClient
+{
+
+public:
+
+ const SfxItemPropertySet & m_rPropSet;
+ const enum CursorType m_eType;
+ const uno::Reference< text::XText > m_xParentText;
+ SwEventListenerContainer m_ListenerContainer;
+ bool m_bIsDisposed;
+
+ Impl( SwXTextCursor & rThis,
+ SwDoc & rDoc,
+ const enum CursorType eType,
+ uno::Reference<text::XText> xParent,
+ SwPosition const& rPoint, SwPosition const*const pMark)
+ : SwClient(rDoc.CreateUnoCrsr(rPoint, sal_False))
+ , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
+ , m_eType(eType)
+ , m_xParentText(xParent)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_bIsDisposed(false)
+ {
+ if (pMark)
+ {
+ GetCursor()->SetMark();
+ *GetCursor()->GetMark() = *pMark;
+ }
+ }
+
+ ~Impl() {
+ // Impl owns the cursor; delete it here: SolarMutex is locked
+ delete GetRegisteredIn();
+ }
+
+ SwUnoCrsr * GetCursor() {
+ return (m_bIsDisposed) ? 0 :
+ static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));
+ }
+
+ SwUnoCrsr & GetCursorOrThrow() {
+ SwUnoCrsr *const pUnoCursor( GetCursor() );
+ if (!pUnoCursor) {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXTextCursor: disposed or invalid")), 0);
+ }
+ return *pUnoCursor;
+ }
+
+ void Invalidate() {
+ m_bIsDisposed = true;
+ m_ListenerContainer.Disposing();
+ }
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+void SwXTextCursor::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn() ||
+ // if the cursor leaves its designated section, it becomes invalid
+ ((pOld != NULL) && (pOld->Which() == RES_UNOCURSOR_LEAVES_SECTION)))
+ {
+ Invalidate();
+ }
+}
+
+
+SwUnoCrsr const* SwXTextCursor::GetCursor() const
+{
+ return m_pImpl->GetCursor();
+}
+
+SwUnoCrsr * SwXTextCursor::GetCursor()
+{
+ return m_pImpl->GetCursor();
+}
+
+/*-- 09.12.98 14:19:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwPaM const* SwXTextCursor::GetPaM() const
+{
+ return m_pImpl->GetCursor();
+}
+
+SwPaM * SwXTextCursor::GetPaM()
+{
+ return m_pImpl->GetCursor();
+}
+
+/*-- 09.12.98 14:19:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwDoc const* SwXTextCursor::GetDoc() const
+{
+ return m_pImpl->GetCursor() ? m_pImpl->GetCursor()->GetDoc() : 0;
+}
+/* -----------------22.07.99 13:52-------------------
+
+ --------------------------------------------------*/
+SwDoc * SwXTextCursor::GetDoc()
+{
+ return m_pImpl->GetCursor() ? m_pImpl->GetCursor()->GetDoc() : 0;
+}
+
+
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextCursor::SwXTextCursor(
+ SwDoc & rDoc,
+ uno::Reference< text::XText > const& xParent,
+ const enum CursorType eType,
+ const SwPosition& rPos,
+ SwPosition const*const pMark)
+ : m_pImpl( new SwXTextCursor::Impl(*this, rDoc, eType, xParent,
+ rPos, pMark ) )
+{
+}
+
+/* -----------------04.03.99 09:02-------------------
+ *
+ * --------------------------------------------------*/
+SwXTextCursor::SwXTextCursor(uno::Reference< text::XText > const& xParent,
+ SwPaM const& rSourceCursor, const enum CursorType eType)
+ : m_pImpl( new SwXTextCursor::Impl(*this, *rSourceCursor.GetDoc(), eType,
+ xParent, *rSourceCursor.GetPoint(),
+ rSourceCursor.HasMark() ? rSourceCursor.GetMark() : 0) )
+{
+}
+
+/*-- 09.12.98 14:19:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextCursor::~SwXTextCursor()
+{
+}
+
+/*-- 09.12.98 14:19:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::DeleteAndInsert(const ::rtl::OUString& rText,
+ const bool bForceExpandHints)
+{
+ SwUnoCrsr *const pUnoCrsr = m_pImpl->GetCursor();
+ if(pUnoCrsr)
+ {
+ // Start/EndAction
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ UnoActionContext aAction(pDoc);
+ const xub_StrLen nTxtLen = rText.getLength();
+ pDoc->StartUndo(UNDO_INSERT, NULL);
+ SwCursor * pCurrent = pUnoCrsr;
+ do
+ {
+ if (pCurrent->HasMark())
+ {
+ pDoc->DeleteAndJoin(*pCurrent);
+ }
+ if(nTxtLen)
+ {
+ const bool bSuccess(
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ *pDoc, *pCurrent, rText, bForceExpandHints ) );
+ DBG_ASSERT( bSuccess, "Doc->Insert(Str) failed." );
+ (void) bSuccess;
+
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, true);
+ pCurrent->Left(rText.getLength(),
+ CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ pCurrent = static_cast<SwCursor *>(pCurrent->GetNext());
+ } while (pCurrent != pUnoCrsr);
+ pDoc->EndUndo(UNDO_INSERT, NULL);
+ }
+}
+
+
+enum ForceIntoMetaMode { META_CHECK_BOTH, META_INIT_START, META_INIT_END };
+
+static sal_Bool
+lcl_ForceIntoMeta(SwPaM & rCursor,
+ uno::Reference<text::XText> const & xParentText,
+ const enum ForceIntoMetaMode eMode)
+{
+ sal_Bool bRet( sal_True ); // means not forced in META_CHECK_BOTH
+ SwXMeta const * const pXMeta( dynamic_cast<SwXMeta*>(xParentText.get()) );
+ ASSERT(pXMeta, "no parent?");
+ if (!pXMeta)
+ throw uno::RuntimeException();
+ SwTxtNode * pTxtNode;
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+ const bool bSuccess( pXMeta->SetContentRange(pTxtNode, nStart, nEnd) );
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ throw uno::RuntimeException();
+ // force the cursor back into the meta if it has moved outside
+ SwPosition start(*pTxtNode, nStart);
+ SwPosition end(*pTxtNode, nEnd);
+ switch (eMode)
+ {
+ case META_INIT_START:
+ *rCursor.GetPoint() = start;
+ break;
+ case META_INIT_END:
+ *rCursor.GetPoint() = end;
+ break;
+ case META_CHECK_BOTH:
+ if (*rCursor.Start() < start)
+ {
+ *rCursor.Start() = start;
+ bRet = sal_False;
+ }
+ if (*rCursor.End() > end)
+ {
+ *rCursor.End() = end;
+ bRet = sal_False;
+ }
+ break;
+ }
+ return bRet;
+}
+
+bool SwXTextCursor::IsAtEndOfMeta() const
+{
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ SwUnoCrsr const * const pCursor( m_pImpl->GetCursor() );
+ SwXMeta const*const pXMeta(
+ dynamic_cast<SwXMeta*>(m_pImpl->m_xParentText.get()) );
+ ASSERT(pXMeta, "no meta?");
+ if (pCursor && pXMeta)
+ {
+ SwTxtNode * pTxtNode;
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+ const bool bSuccess(
+ pXMeta->SetContentRange(pTxtNode, nStart, nEnd) );
+ ASSERT(bSuccess, "no pam?");
+ if (bSuccess)
+ {
+ const SwPosition end(*pTxtNode, nEnd);
+ if ( (*pCursor->GetPoint() == end)
+ || (*pCursor->GetMark() == end))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextCursor::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXTextCursor");
+}
+
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+static char const*const g_ServicesTextCursor[] =
+{
+ "com.sun.star.text.TextCursor",
+ "com.sun.star.style.CharacterProperties",
+ "com.sun.star.style.CharacterPropertiesAsian",
+ "com.sun.star.style.CharacterPropertiesComplex",
+ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.style.ParagraphPropertiesComplex",
+ "com.sun.star.text.TextSortable",
+};
+static const size_t g_nServicesTextCursor(
+ sizeof(g_ServicesTextCursor)/sizeof(g_ServicesTextCursor[0]));
+
+sal_Bool SAL_CALL SwXTextCursor::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesTextCursor, g_ServicesTextCursor, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXTextCursor::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesTextCursor, g_ServicesTextCursor);
+}
+
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextCursor::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXTextCursor::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXTextCursor>(rId, this) );
+ return (nRet) ? nRet : OTextCursorHelper::getSomething(rId);
+}
+
+/*-- 09.12.98 14:18:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextCursor::collapseToStart() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (rUnoCursor.HasMark())
+ {
+ if (*rUnoCursor.GetPoint() > *rUnoCursor.GetMark())
+ {
+ rUnoCursor.Exchange();
+ }
+ rUnoCursor.DeleteMark();
+ }
+}
+/*-- 09.12.98 14:18:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextCursor::collapseToEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (rUnoCursor.HasMark())
+ {
+ if (*rUnoCursor.GetPoint() < *rUnoCursor.GetMark())
+ {
+ rUnoCursor.Exchange();
+ }
+ rUnoCursor.DeleteMark();
+ }
+}
+/*-- 09.12.98 14:18:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXTextCursor::isCollapsed() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sal_Bool bRet = sal_True;
+ SwUnoCrsr *const pUnoCrsr = m_pImpl->GetCursor();
+ if(pUnoCrsr && pUnoCrsr->GetMark())
+ {
+ bRet = (*pUnoCrsr->GetPoint() == *pUnoCrsr->GetMark());
+ }
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::goLeft(sal_Int16 nCount, sal_Bool Expand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ sal_Bool bRet = rUnoCursor.Left( nCount, CRSR_SKIP_CHARS, FALSE, FALSE);
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH)
+ && bRet;
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::goRight(sal_Int16 nCount, sal_Bool Expand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ sal_Bool bRet = rUnoCursor.Right(nCount, CRSR_SKIP_CHARS, FALSE, FALSE);
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH)
+ && bRet;
+ }
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::gotoStart(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ if (CURSOR_BODY == m_pImpl->m_eType)
+ {
+ rUnoCursor.Move( fnMoveBackward, fnGoDoc );
+ //check, that the cursor is not in a table
+ SwTableNode * pTblNode = rUnoCursor.GetNode()->FindTableNode();
+ SwCntntNode * pCNode = 0;
+ while (pTblNode)
+ {
+ rUnoCursor.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCNode = GetDoc()->GetNodes().GoNext(&rUnoCursor.GetPoint()->nNode);
+ pTblNode = (pCNode) ? pCNode->FindTableNode() : 0;
+ }
+ if (pCNode)
+ {
+ rUnoCursor.GetPoint()->nContent.Assign(pCNode, 0);
+ }
+ SwStartNode const*const pTmp =
+ rUnoCursor.GetNode()->StartOfSectionNode();
+ if (pTmp->IsSectionNode())
+ {
+ SwSectionNode const*const pSectionStartNode =
+ static_cast<SwSectionNode const*>(pTmp);
+ if (pSectionStartNode->GetSection().IsHiddenFlag())
+ {
+ pCNode = GetDoc()->GetNodes().GoNextSection(
+ &rUnoCursor.GetPoint()->nNode, sal_True, sal_False);
+ if (pCNode)
+ {
+ rUnoCursor.GetPoint()->nContent.Assign(pCNode, 0);
+ }
+ }
+ }
+ }
+ else if ( (CURSOR_FRAME == m_pImpl->m_eType)
+ || (CURSOR_TBLTEXT == m_pImpl->m_eType)
+ || (CURSOR_HEADER == m_pImpl->m_eType)
+ || (CURSOR_FOOTER == m_pImpl->m_eType)
+ || (CURSOR_FOOTNOTE== m_pImpl->m_eType)
+ || (CURSOR_REDLINE == m_pImpl->m_eType))
+ {
+ rUnoCursor.MoveSection(fnSectionCurr, fnSectionStart);
+ }
+ else if (CURSOR_META == m_pImpl->m_eType)
+ {
+ lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText, META_INIT_START);
+ }
+}
+/*-- 09.12.98 14:18:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::gotoEnd(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ if (CURSOR_BODY == m_pImpl->m_eType)
+ {
+ rUnoCursor.Move( fnMoveForward, fnGoDoc );
+ }
+ else if ( (CURSOR_FRAME == m_pImpl->m_eType)
+ || (CURSOR_TBLTEXT == m_pImpl->m_eType)
+ || (CURSOR_HEADER == m_pImpl->m_eType)
+ || (CURSOR_FOOTER == m_pImpl->m_eType)
+ || (CURSOR_FOOTNOTE== m_pImpl->m_eType)
+ || (CURSOR_REDLINE == m_pImpl->m_eType))
+ {
+ rUnoCursor.MoveSection( fnSectionCurr, fnSectionEnd);
+ }
+ else if (CURSOR_META == m_pImpl->m_eType)
+ {
+ lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText, META_INIT_END);
+ }
+}
+
+void SAL_CALL
+SwXTextCursor::gotoRange(
+ const uno::Reference< text::XTextRange > & xRange, sal_Bool bExpand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!xRange.is())
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwUnoCrsr & rOwnCursor( m_pImpl->GetCursorOrThrow() );
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ }
+
+ if (!pRange && !pCursor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ switch (m_pImpl->m_eType)
+ {
+ case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
+ case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
+ case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
+ case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
+ case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ //case CURSOR_INVALID:
+ //case CURSOR_BODY:
+ default:
+ ;
+ }
+ const SwStartNode* pOwnStartNode =
+ rOwnCursor.GetNode()->FindSttNodeByType(eSearchNodeType);
+
+ SwPaM aPam(GetDoc()->GetNodes());
+ const SwPaM * pPam(0);
+ if (pCursor)
+ {
+ pPam = pCursor->GetPaM();
+ }
+ else if (pRange)
+ {
+ if (pRange->GetPositions(aPam))
+ {
+ pPam = & aPam;
+ }
+ }
+
+ if (!pPam)
+ {
+ throw uno::RuntimeException();
+ }
+ const SwStartNode* pTmp =
+ pPam->GetNode()->FindSttNodeByType(eSearchNodeType);
+
+ //SectionNodes ueberspringen
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->StartOfSectionNode();
+ }
+ while(pOwnStartNode && pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->StartOfSectionNode();
+ }
+ if(pOwnStartNode != pTmp)
+ {
+ throw uno::RuntimeException();
+ }
+
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ SwPaM CopyPam(*pPam->GetMark(), *pPam->GetPoint());
+ const bool bNotForced( lcl_ForceIntoMeta(
+ CopyPam, m_pImpl->m_xParentText, META_CHECK_BOTH) );
+ if (!bNotForced)
+ {
+ throw uno::RuntimeException(
+ C2U("gotoRange: parameter range not contained in nesting"
+ " text content for which this cursor was created"),
+ static_cast<text::XWordCursor*>(this));
+ }
+ }
+
+ //jetzt muss die Selektion erweitert werden
+ if(bExpand)
+ {
+ // der Cursor soll alles einschliessen, was bisher von ihm und dem uebergebenen
+ // Range eingeschlossen wurde
+ const SwPosition aOwnLeft(*rOwnCursor.Start());
+ const SwPosition aOwnRight(*rOwnCursor.End());
+ SwPosition const& rParamLeft = *pPam->Start();
+ SwPosition const& rParamRight = *pPam->End();
+
+ // jetzt sind vier SwPositions da, zwei davon werden gebraucht, also welche?
+ *rOwnCursor.GetPoint() = (aOwnRight > rParamRight)
+ ? aOwnRight : *rOwnCursor.GetPoint() = rParamRight;
+ rOwnCursor.SetMark();
+ *rOwnCursor.GetMark() = (aOwnLeft < rParamLeft)
+ ? aOwnLeft : *rOwnCursor.GetMark() = rParamLeft;
+ }
+ else
+ {
+ // cursor should be the given range
+ *rOwnCursor.GetPoint() = *pPam->GetPoint();
+ if (pPam->HasMark())
+ {
+ rOwnCursor.SetMark();
+ *rOwnCursor.GetMark() = *pPam->GetMark();
+ }
+ else
+ {
+ rOwnCursor.DeleteMark();
+ }
+ }
+}
+
+/*-- 09.12.98 14:18:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXTextCursor::isStartOfWord() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const sal_Bool bRet =
+ rUnoCursor.IsStartWordWT( i18n::WordType::DICTIONARY_WORD );
+ return bRet;
+}
+/*-- 09.12.98 14:18:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXTextCursor::isEndOfWord() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const sal_Bool bRet =
+ rUnoCursor.IsEndWordWT( i18n::WordType::DICTIONARY_WORD );
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoNextWord(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ //Probleme gibt's noch mit einem Absatzanfang, an dem kein Wort beginnt.
+ sal_Bool bRet = sal_False;
+ // remember old position to check if cursor has moved
+ // since the called functions are sometimes a bit unreliable
+ // in specific cases...
+ SwPosition *const pPoint = rUnoCursor.GetPoint();
+ SwNode *const pOldNode = &pPoint->nNode.GetNode();
+ xub_StrLen const nOldIndex = pPoint->nContent.GetIndex();
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ // end of paragraph
+ if (rUnoCursor.GetCntntNode() &&
+ (pPoint->nContent == rUnoCursor.GetCntntNode()->Len()))
+ {
+ rUnoCursor.Right(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ else
+ {
+ const bool bTmp =
+ rUnoCursor.GoNextWordWT( i18n::WordType::DICTIONARY_WORD );
+ // if there is no next word within the current paragraph
+ // try to go to the start of the next paragraph
+ if (!bTmp)
+ {
+ rUnoCursor.MovePara(fnParaNext, fnParaStart);
+ }
+ }
+
+ // return true if cursor has moved
+ bRet = (&pPoint->nNode.GetNode() != pOldNode) ||
+ (pPoint->nContent.GetIndex() != nOldIndex);
+ if (bRet && (CURSOR_META == m_pImpl->m_eType))
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH);
+ }
+
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoPreviousWord(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ // hier machen Leerzeichen am Absatzanfang Probleme
+ sal_Bool bRet = sal_False;
+ SwPosition *const pPoint = rUnoCursor.GetPoint();
+ SwNode *const pOldNode = &pPoint->nNode.GetNode();
+ xub_StrLen const nOldIndex = pPoint->nContent.GetIndex();
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ // start of paragraph?
+ if (pPoint->nContent == 0)
+ {
+ rUnoCursor.Left(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ else
+ {
+ rUnoCursor.GoPrevWordWT( i18n::WordType::DICTIONARY_WORD );
+ if (pPoint->nContent == 0)
+ {
+ rUnoCursor.Left(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ }
+
+ // return true if cursor has moved
+ bRet = (&pPoint->nNode.GetNode() != pOldNode) ||
+ (pPoint->nContent.GetIndex() != nOldIndex);
+ if (bRet && (CURSOR_META == m_pImpl->m_eType))
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH);
+ }
+
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoEndOfWord(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ sal_Bool bRet = sal_False;
+ SwPosition *const pPoint = rUnoCursor.GetPoint();
+ SwNode & rOldNode = pPoint->nNode.GetNode();
+ xub_StrLen const nOldIndex = pPoint->nContent.GetIndex();
+
+ const sal_Int16 nWordType = i18n::WordType::DICTIONARY_WORD;
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ if (!rUnoCursor.IsEndWordWT( nWordType ))
+ {
+ rUnoCursor.GoEndWordWT( nWordType );
+ }
+
+ // restore old cursor if we are not at the end of a word by now
+ // otherwise use current one
+ bRet = rUnoCursor.IsEndWordWT( nWordType );
+ if (!bRet)
+ {
+ pPoint->nNode = rOldNode;
+ pPoint->nContent = nOldIndex;
+ }
+ else if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH);
+ }
+
+ return bRet;
+}
+/*-- 09.12.98 14:18:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoStartOfWord(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ sal_Bool bRet = sal_False;
+ SwPosition *const pPoint = rUnoCursor.GetPoint();
+ SwNode & rOldNode = pPoint->nNode.GetNode();
+ xub_StrLen const nOldIndex = pPoint->nContent.GetIndex();
+
+ const sal_Int16 nWordType = i18n::WordType::DICTIONARY_WORD;
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ if (!rUnoCursor.IsStartWordWT( nWordType ))
+ {
+ rUnoCursor.GoStartWordWT( nWordType );
+ }
+
+ // restore old cursor if we are not at the start of a word by now
+ // otherwise use current one
+ bRet = rUnoCursor.IsStartWordWT( nWordType );
+ if (!bRet)
+ {
+ pPoint->nNode = rOldNode;
+ pPoint->nContent = nOldIndex;
+ }
+ else if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH);
+ }
+
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::isStartOfSentence() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ // start of paragraph?
+ sal_Bool bRet = rUnoCursor.GetPoint()->nContent == 0;
+ // with mark ->no sentence start
+ // (check if cursor is no selection, i.e. it does not have
+ // a mark or else point and mark are identical)
+ if (!bRet && (!rUnoCursor.HasMark() ||
+ *rUnoCursor.GetPoint() == *rUnoCursor.GetMark()))
+ {
+ SwCursor aCrsr(*rUnoCursor.GetPoint(),0,false);
+ SwPosition aOrigPos = *aCrsr.GetPoint();
+ aCrsr.GoSentence(SwCursor::START_SENT );
+ bRet = aOrigPos == *aCrsr.GetPoint();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::isEndOfSentence() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ // end of paragraph?
+ sal_Bool bRet = rUnoCursor.GetCntntNode() &&
+ (rUnoCursor.GetPoint()->nContent == rUnoCursor.GetCntntNode()->Len());
+ // with mark->no sentence end
+ // (check if cursor is no selection, i.e. it does not have
+ // a mark or else point and mark are identical)
+ if (!bRet && (!rUnoCursor.HasMark() ||
+ *rUnoCursor.GetPoint() == *rUnoCursor.GetMark()))
+ {
+ SwCursor aCrsr(*rUnoCursor.GetPoint(), 0, false);
+ SwPosition aOrigPos = *aCrsr.GetPoint();
+ aCrsr.GoSentence(SwCursor::END_SENT);
+ bRet = aOrigPos == *aCrsr.GetPoint();
+ }
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoNextSentence(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const bool bWasEOS = isEndOfSentence();
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ sal_Bool bRet = rUnoCursor.GoSentence(SwCursor::NEXT_SENT);
+ if (!bRet)
+ {
+ bRet = rUnoCursor.MovePara(fnParaNext, fnParaStart);
+ }
+
+ // if at the end of the sentence (i.e. at the space after the '.')
+ // advance to next word in order for GoSentence to work properly
+ // next time and have isStartOfSentence return true after this call
+ if (!rUnoCursor.IsStartWord())
+ {
+ const bool bNextWord = rUnoCursor.GoNextWord();
+ if (bWasEOS && !bNextWord)
+ {
+ bRet = sal_False;
+ }
+ }
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH)
+ && bRet;
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoPreviousSentence(sal_Bool Expand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ sal_Bool bRet = rUnoCursor.GoSentence(SwCursor::PREV_SENT);
+ if (!bRet)
+ {
+ bRet = rUnoCursor.MovePara(fnParaPrev, fnParaStart);
+ if (bRet)
+ {
+ rUnoCursor.MovePara(fnParaCurr, fnParaEnd);
+ // at the end of a paragraph move to the sentence end again
+ rUnoCursor.GoSentence(SwCursor::PREV_SENT);
+ }
+ }
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH)
+ && bRet;
+ }
+ return bRet;
+}
+
+/* -----------------15.10.99 08:24-------------------
+
+ --------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoStartOfSentence(sal_Bool Expand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ sal_Bool bRet = sal_False;
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ // if we're at the para start then we wont move
+ // but bRet is also true if GoSentence failed but
+ // the start of the sentence is reached
+ bRet = SwUnoCursorHelper::IsStartOfPara(rUnoCursor)
+ || rUnoCursor.GoSentence(SwCursor::START_SENT)
+ || SwUnoCursorHelper::IsStartOfPara(rUnoCursor);
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH)
+ && bRet;
+ }
+ return bRet;
+}
+/* -----------------15.10.99 08:24-------------------
+
+ --------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoEndOfSentence(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ sal_Bool bRet = sal_False;
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ // bRet is true if GoSentence() succeeded or if the
+ // MovePara() succeeded while the end of the para is
+ // not reached already
+ sal_Bool bAlreadyParaEnd = SwUnoCursorHelper::IsEndOfPara(rUnoCursor);
+ bRet = !bAlreadyParaEnd
+ && (rUnoCursor.GoSentence(SwCursor::END_SENT)
+ || rUnoCursor.MovePara(fnParaCurr, fnParaEnd));
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
+ META_CHECK_BOTH)
+ && bRet;
+ }
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::isStartOfParagraph() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const sal_Bool bRet = SwUnoCursorHelper::IsStartOfPara(rUnoCursor);
+ return bRet;
+}
+/*-- 09.12.98 14:18:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::isEndOfParagraph() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const sal_Bool bRet = SwUnoCursorHelper::IsEndOfPara(rUnoCursor);
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoStartOfParagraph(sal_Bool Expand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ return sal_False;
+ }
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ sal_Bool bRet = SwUnoCursorHelper::IsStartOfPara(rUnoCursor);
+ if (!bRet)
+ {
+ bRet = rUnoCursor.MovePara(fnParaCurr, fnParaStart);
+ }
+
+ // since MovePara(fnParaCurr, fnParaStart) only returns false
+ // if we were already at the start of the paragraph this function
+ // should always complete successfully.
+ DBG_ASSERT( bRet, "gotoStartOfParagraph failed" );
+ return bRet;
+}
+/*-- 09.12.98 14:18:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ return sal_False;
+ }
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ sal_Bool bRet = SwUnoCursorHelper::IsEndOfPara(rUnoCursor);
+ if (!bRet)
+ {
+ bRet = rUnoCursor.MovePara(fnParaCurr, fnParaEnd);
+ }
+
+ // since MovePara(fnParaCurr, fnParaEnd) only returns false
+ // if we were already at the end of the paragraph this function
+ // should always complete successfully.
+ DBG_ASSERT( bRet, "gotoEndOfParagraph failed" );
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoNextParagraph(sal_Bool Expand) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ return sal_False;
+ }
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ const sal_Bool bRet = rUnoCursor.MovePara(fnParaNext, fnParaStart);
+ return bRet;
+}
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXTextCursor::gotoPreviousParagraph(sal_Bool Expand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ return sal_False;
+ }
+ SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
+ const sal_Bool bRet = rUnoCursor.MovePara(fnParaPrev, fnParaStart);
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SAL_CALL
+SwXTextCursor::getText() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return m_pImpl->m_xParentText;
+}
+
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXTextCursor::getStart() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ uno::Reference< text::XTextRange > xRet;
+ SwPaM aPam(*rUnoCursor.Start());
+ const uno::Reference< text::XText > xParent = getText();
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ // return cursor to prevent modifying SwXTextRange for META
+ SwXTextCursor * const pXCursor(
+ new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CURSOR_META,
+ *rUnoCursor.GetPoint()) );
+ pXCursor->gotoStart(sal_False);
+ xRet = static_cast<text::XWordCursor*>(pXCursor);
+ }
+ else
+ {
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ return xRet;
+}
+/*-- 09.12.98 14:18:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXTextCursor::getEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ uno::Reference< text::XTextRange > xRet;
+ SwPaM aPam(*rUnoCursor.End());
+ const uno::Reference< text::XText > xParent = getText();
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ // return cursor to prevent modifying SwXTextRange for META
+ SwXTextCursor * const pXCursor(
+ new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CURSOR_META,
+ *rUnoCursor.GetPoint()) );
+ pXCursor->gotoEnd(sal_False);
+ xRet = static_cast<text::XWordCursor*>(pXCursor);
+ }
+ else
+ {
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ return xRet;
+}
+
+/*-- 09.12.98 14:18:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXTextCursor::getString() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ OUString aTxt;
+ SwUnoCursorHelper::GetTextFromPam(rUnoCursor, aTxt);
+ return aTxt;
+}
+/*-- 09.12.98 14:18:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::setString(const OUString& aString) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+ (void) rUnoCursor; // just to check if valid
+
+ const bool bForceExpandHints( (CURSOR_META != m_pImpl->m_eType)
+ ? false
+ : dynamic_cast<SwXMeta*>(m_pImpl->m_xParentText.get())
+ ->CheckForOwnMemberMeta(*GetPaM(), true) );
+ DeleteAndInsert(aString, bForceExpandHints);
+}
+
+/* -----------------------------03.05.00 12:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwUnoCursorHelper::GetPropertyValue(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ uno::Any aAny;
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.getPropertyMap()->getByName(rPropertyName);
+
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+ }
+
+ beans::PropertyState eTemp;
+ const sal_Bool bDone = SwUnoCursorHelper::getCrsrPropertyValue(
+ *pEntry, rPaM, &aAny, eTemp );
+
+ if (!bDone)
+ {
+ SfxItemSet aSet(rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+ SwUnoCursorHelper::GetCrsrAttr(rPaM, aSet);
+
+ rPropSet.getPropertyValue(*pEntry, aSet, aAny);
+ }
+
+ return aAny;
+}
+/* -----------------------------03.05.00 12:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwUnoCursorHelper::SetPropertyValue(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName,
+ const uno::Any& rValue,
+ const SetAttrMode nAttrMode, const bool bTableMode)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SwDoc *const pDoc = rPaM.GetDoc();
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(0));
+ }
+
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw beans::PropertyVetoException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(0));
+ }
+
+ SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
+ SwUnoCursorHelper::GetCrsrAttr( rPaM, aItemSet );
+
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, rValue, rPaM, aItemSet))
+ {
+ rPropSet.setPropertyValue(*pEntry, rValue, aItemSet );
+ }
+ SwUnoCursorHelper::SetCrsrAttr(rPaM, aItemSet, nAttrMode, bTableMode);
+}
+
+/* -----------------------------03.05.00 13:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState >
+SwUnoCursorHelper::GetPropertyStates(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const uno::Sequence< OUString >& rPropertyNames,
+ const SwGetPropertyStatesCaller eCaller)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ const OUString* pNames = rPropertyNames.getConstArray();
+ uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
+ beans::PropertyState* pStates = aRet.getArray();
+ SfxItemPropertyMap const*const pMap = rPropSet.getPropertyMap();
+ ::std::auto_ptr<SfxItemSet> pSet;
+ ::std::auto_ptr<SfxItemSet> pSetParent;
+
+ for (sal_Int32 i = 0, nEnd = rPropertyNames.getLength(); i < nEnd; i++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ pMap->getByName( pNames[i] );
+ if(!pEntry)
+ {
+ if (pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) ||
+ pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ continue;
+ }
+ else if (SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT ==
+ eCaller)
+ {
+ //this values marks the element as unknown property
+ pStates[i] = beans::PropertyState_MAKE_FIXED_SIZE;
+ continue;
+ }
+ else
+ {
+ throw beans::UnknownPropertyException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pNames[i],
+ static_cast<cppu::OWeakObject *>(0));
+ }
+ }
+ if (((SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION == eCaller) ||
+ (SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT == eCaller)) &&
+ pEntry->nWID < FN_UNO_RANGE_BEGIN &&
+ pEntry->nWID > FN_UNO_RANGE_END &&
+ pEntry->nWID < RES_CHRATR_BEGIN &&
+ pEntry->nWID > RES_TXTATR_END )
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ if ( pEntry->nWID >= FN_UNO_RANGE_BEGIN &&
+ pEntry->nWID <= FN_UNO_RANGE_END )
+ {
+ SwUnoCursorHelper::getCrsrPropertyValue(
+ *pEntry, rPaM, 0, pStates[i] );
+ }
+ else
+ {
+ if (!pSet.get())
+ {
+ switch ( eCaller )
+ {
+ case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT:
+ case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION:
+ pSet.reset(
+ new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_TXTATR_END ));
+ break;
+ case SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY:
+ pSet.reset(
+ new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ pEntry->nWID, pEntry->nWID ));
+ break;
+ default:
+ pSet.reset( new SfxItemSet(
+ rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ 0L ));
+ }
+ // --> OD 2006-07-12 #i63870#
+ SwUnoCursorHelper::GetCrsrAttr( rPaM, *pSet );
+ // <--
+ }
+
+ pStates[i] = ( pSet->Count() )
+ ? rPropSet.getPropertyState( *pEntry, *pSet )
+ : beans::PropertyState_DEFAULT_VALUE;
+
+ //try again to find out if a value has been inherited
+ if( beans::PropertyState_DIRECT_VALUE == pStates[i] )
+ {
+ if (!pSetParent.get())
+ {
+ pSetParent.reset( pSet->Clone( FALSE ) );
+ // --> OD 2006-07-12 #i63870#
+ SwUnoCursorHelper::GetCrsrAttr(
+ rPaM, *pSetParent, TRUE, FALSE );
+ // <--
+ }
+
+ pStates[i] = ( (pSetParent)->Count() )
+ ? rPropSet.getPropertyState( *pEntry, *pSetParent )
+ : beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+ }
+ return aRet;
+}
+/* -----------------------------03.05.00 13:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+beans::PropertyState SwUnoCursorHelper::GetPropertyState(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ uno::Sequence< OUString > aStrings ( 1 );
+ aStrings[0] = rPropertyName;
+ uno::Sequence< beans::PropertyState > aSeq =
+ GetPropertyStates(rPaM, rPropSet, aStrings,
+ SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY );
+ return aSeq[0];
+}
+/* -----------------------------03.05.00 13:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static void
+lcl_SelectParaAndReset( SwPaM &rPaM, SwDoc & rDoc,
+ SvUShortsSort const*const pWhichIds = 0 )
+{
+ // if we are reseting paragraph attributes, we need to select the full paragraph first
+ SwPosition aStart = *rPaM.Start();
+ SwPosition aEnd = *rPaM.End();
+ ::std::auto_ptr< SwUnoCrsr > pTemp ( rDoc.CreateUnoCrsr(aStart, FALSE) );
+ if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
+ {
+ pTemp->MovePara(fnParaCurr, fnParaStart);
+ }
+ pTemp->SetMark();
+ *pTemp->GetPoint() = aEnd;
+ SwUnoCursorHelper::SelectPam(*pTemp, true);
+ if(!SwUnoCursorHelper::IsEndOfPara(*pTemp))
+ {
+ pTemp->MovePara(fnParaCurr, fnParaEnd);
+ }
+ rDoc.ResetAttrs(*pTemp, sal_True, pWhichIds);
+}
+
+
+void SwUnoCursorHelper::SetPropertyToDefault(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ SwDoc & rDoc = *rPaM.GetDoc();
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+ }
+
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "setPropertyToDefault: property is read-only: "))
+ + rPropertyName, 0);
+ }
+
+ if (pEntry->nWID < RES_FRMATR_END)
+ {
+ SvUShortsSort aWhichIds;
+ aWhichIds.Insert(pEntry->nWID);
+ if (pEntry->nWID < RES_PARATR_BEGIN)
+ {
+ rDoc.ResetAttrs(rPaM, sal_True, &aWhichIds);
+ }
+ else
+ {
+ lcl_SelectParaAndReset ( rPaM, rDoc, &aWhichIds );
+ }
+ }
+ else
+ {
+ SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, rPaM);
+ }
+}
+
+/* -----------------------------03.05.00 13:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwUnoCursorHelper::GetPropertyDefault(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+ }
+
+ uno::Any aRet;
+ if (pEntry->nWID < RES_FRMATR_END)
+ {
+ SwDoc & rDoc = *rPaM.GetDoc();
+ const SfxPoolItem& rDefItem =
+ rDoc.GetAttrPool().GetDefaultItem(pEntry->nWID);
+ rDefItem.QueryValue(aRet, pEntry->nMemberId);
+ }
+ return aRet;
+}
+
+/*-- 09.12.98 14:18:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXTextCursor::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef;
+ if(!xRef.is())
+ {
+ static SfxItemPropertyMapEntry aCrsrExtMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT), FN_SKIP_HIDDEN_TEXT, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT), FN_SKIP_PROTECTED_TEXT, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ const uno::Reference< beans::XPropertySetInfo > xInfo =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ // PropertySetInfo verlaengern!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ xRef = new SfxExtItemPropertySetInfo(
+ aCrsrExtMap_Impl,
+ aPropSeq );
+ }
+ return xRef;
+}
+
+/*-- 09.12.98 14:18:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)))
+ {
+ sal_Bool bSet(sal_False);
+ if (!(rValue >>= bSet))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rUnoCursor.SetSkipOverHiddenSections(bSet);
+ }
+ else if (rPropertyName.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ sal_Bool bSet(sal_False);
+ if (!(rValue >>= bSet))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ rUnoCursor.SetSkipOverProtectSections(bSet);
+ }
+ else
+ {
+ SwUnoCursorHelper::SetPropertyValue(rUnoCursor,
+ m_pImpl->m_rPropSet, rPropertyName, rValue);
+ }
+}
+
+/*-- 09.12.98 14:18:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXTextCursor::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ uno::Any aAny;
+ if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)))
+ {
+ const sal_Bool bSet = rUnoCursor.IsSkipOverHiddenSections();
+ aAny <<= bSet;
+ }
+ else if (rPropertyName.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ const sal_Bool bSet = rUnoCursor.IsSkipOverProtectSections();
+ aAny <<= bSet;
+ }
+ else
+ {
+ aAny = SwUnoCursorHelper::GetPropertyValue(rUnoCursor,
+ m_pImpl->m_rPropSet, rPropertyName);
+ }
+ return aAny;
+}
+
+/*-- 09.12.98 14:18:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextCursor::addPropertyChangeListener(): not implemented");
+}
+
+/*-- 09.12.98 14:18:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextCursor::removePropertyChangeListener(): not implemented");
+}
+
+/*-- 09.12.98 14:18:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextCursor::addVetoableChangeListener(): not implemented");
+}
+
+/*-- 09.12.98 14:18:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextCursor::removeVetoableChangeListener(): not implemented");
+}
+
+/*-- 05.03.99 11:36:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SAL_CALL
+SwXTextCursor::getPropertyState(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const beans::PropertyState eRet = SwUnoCursorHelper::GetPropertyState(
+ rUnoCursor, m_pImpl->m_rPropSet, rPropertyName);
+ return eRet;
+}
+/*-- 05.03.99 11:36:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SAL_CALL
+SwXTextCursor::getPropertyStates(
+ const uno::Sequence< OUString >& rPropertyNames)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ return SwUnoCursorHelper::GetPropertyStates(
+ rUnoCursor, m_pImpl->m_rPropSet, rPropertyNames);
+}
+
+/*-- 05.03.99 11:36:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::setPropertyToDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ // forward: need no solar mutex here
+ uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ setPropertiesToDefault ( aSequence );
+}
+/*-- 05.03.99 11:36:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXTextCursor::getPropertyDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // forward: need no solar mutex here
+ const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ return getPropertyDefaults ( aSequence ).getConstArray()[0];
+}
+
+// para specific attribut ranges
+static USHORT g_ParaResetableSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ // --> OD 2008-02-25 #refactorlists#
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ // <--
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// selection specific attribut ranges
+static USHORT g_ResetableSetRange[] = {
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ 0
+};
+
+static void
+lcl_EnumerateIds(USHORT const* pIdRange, SvUShortsSort & rWhichIds)
+{
+ while (*pIdRange)
+ {
+ const USHORT nStart = sal::static_int_cast<USHORT>(*pIdRange++);
+ const USHORT nEnd = sal::static_int_cast<USHORT>(*pIdRange++);
+ for (USHORT nId = nStart + 1; nId <= nEnd; ++nId)
+ {
+ rWhichIds.Insert( nId );
+ }
+ }
+}
+
+void SAL_CALL
+SwXTextCursor::setAllPropertiesToDefault()
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SvUShortsSort aParaWhichIds;
+ SvUShortsSort aWhichIds;
+ lcl_EnumerateIds(g_ParaResetableSetRange, aParaWhichIds);
+ lcl_EnumerateIds(g_ResetableSetRange, aWhichIds);
+ if (aParaWhichIds.Count())
+ {
+ lcl_SelectParaAndReset(rUnoCursor, *rUnoCursor.GetDoc(),
+ &aParaWhichIds);
+ }
+ if (aWhichIds.Count())
+ {
+ rUnoCursor.GetDoc()->ResetAttrs(rUnoCursor, sal_True, &aWhichIds);
+ }
+}
+
+void SAL_CALL
+SwXTextCursor::setPropertiesToDefault(
+ const uno::Sequence< OUString >& rPropertyNames)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const sal_Int32 nCount = rPropertyNames.getLength();
+ if ( nCount )
+ {
+ SwDoc & rDoc = *rUnoCursor.GetDoc();
+ const OUString * pNames = rPropertyNames.getConstArray();
+ SvUShortsSort aWhichIds;
+ SvUShortsSort aParaWhichIds;
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName( pNames[i] );
+ if (!pEntry)
+ {
+ if (pNames[i].equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) ||
+ pNames[i].equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ continue;
+ }
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pNames[i],
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw uno::RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "setPropertiesToDefault: property is read-only: "))
+ + pNames[i],
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ if (pEntry->nWID < RES_FRMATR_END)
+ {
+ if (pEntry->nWID < RES_PARATR_BEGIN)
+ {
+ aWhichIds.Insert(pEntry->nWID);
+ }
+ else
+ {
+ aParaWhichIds.Insert(pEntry->nWID);
+ }
+ }
+ else if (pEntry->nWID == FN_UNO_NUM_START_VALUE)
+ {
+ SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, rUnoCursor);
+ }
+ }
+
+ if (aParaWhichIds.Count())
+ {
+ lcl_SelectParaAndReset(rUnoCursor, rDoc, &aParaWhichIds);
+ }
+ if (aWhichIds.Count())
+ {
+ rDoc.ResetAttrs(rUnoCursor, sal_True, &aWhichIds);
+ }
+ }
+}
+
+uno::Sequence< uno::Any > SAL_CALL
+SwXTextCursor::getPropertyDefaults(
+ const uno::Sequence< OUString >& rPropertyNames)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const sal_Int32 nCount = rPropertyNames.getLength();
+ uno::Sequence< uno::Any > aRet(nCount);
+ if ( nCount )
+ {
+ SwDoc & rDoc = *rUnoCursor.GetDoc();
+ const OUString *pNames = rPropertyNames.getConstArray();
+ uno::Any *pAny = aRet.getArray();
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName( pNames[i] );
+ if (!pEntry)
+ {
+ if (pNames[i].equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) ||
+ pNames[i].equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ continue;
+ }
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pNames[i],
+ static_cast<cppu::OWeakObject *>(0));
+ }
+ if (pEntry->nWID < RES_FRMATR_END)
+ {
+ const SfxPoolItem& rDefItem =
+ rDoc.GetAttrPool().GetDefaultItem(pEntry->nWID);
+ rDefItem.QueryValue(pAny[i], pEntry->nMemberId);
+ }
+ }
+ }
+ return aRet;
+}
+
+/*-- 10.03.2008 09:58:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::makeRedline(
+ const ::rtl::OUString& rRedlineType,
+ const uno::Sequence< beans::PropertyValue >& rRedlineProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::makeRedline(rUnoCursor, rRedlineType, rRedlineProperties);
+}
+
+/*-- 09.12.98 14:18:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextCursor::insertDocumentFromURL(const OUString& rURL,
+ const uno::Sequence< beans::PropertyValue >& rOptions)
+throw (lang::IllegalArgumentException, io::IOException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ SwUnoCursorHelper::InsertFile(&rUnoCursor, rURL, rOptions);
+}
+
+/* -----------------------------15.12.00 14:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue >
+SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable)
+{
+ uno::Sequence< beans::PropertyValue > aRet(5);
+ beans::PropertyValue* pArray = aRet.getArray();
+
+ uno::Any aVal;
+ aVal.setValue( &bFromTable, ::getCppuBooleanType());
+ pArray[0] = beans::PropertyValue(C2U("IsSortInTable"), -1, aVal,
+ beans::PropertyState_DIRECT_VALUE);
+
+ aVal <<= sal_Unicode(' ');
+ pArray[1] = beans::PropertyValue(C2U("Delimiter"), -1, aVal,
+ beans::PropertyState_DIRECT_VALUE);
+
+ aVal <<= (sal_Bool) sal_False;
+ pArray[2] = beans::PropertyValue(C2U("IsSortColumns"), -1, aVal,
+ beans::PropertyState_DIRECT_VALUE);
+
+ aVal <<= (sal_Int32) 3;
+ pArray[3] = beans::PropertyValue(C2U("MaxSortFieldsCount"), -1, aVal,
+ beans::PropertyState_DIRECT_VALUE);
+
+ uno::Sequence< table::TableSortField > aFields(3);
+ table::TableSortField* pFields = aFields.getArray();
+
+ lang::Locale aLang( SvxCreateLocale( LANGUAGE_SYSTEM ) );
+ // get collator algorithm to be used for the locale
+ uno::Sequence< OUString > aSeq(
+ GetAppCollator().listCollatorAlgorithms( aLang ) );
+ const sal_Int32 nLen = aSeq.getLength();
+ DBG_ASSERT( nLen > 0, "list of collator algorithms is empty!");
+ OUString aCollAlg;
+ if (nLen > 0)
+ {
+ aCollAlg = aSeq.getConstArray()[0];
+ }
+
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTxt = aSeq.getConstArray();
+ (void)pTxt;
+#endif
+
+ pFields[0].Field = 1;
+ pFields[0].IsAscending = sal_True;
+ pFields[0].IsCaseSensitive = sal_False;
+ pFields[0].FieldType = table::TableSortFieldType_ALPHANUMERIC;
+ pFields[0].CollatorLocale = aLang;
+ pFields[0].CollatorAlgorithm = aCollAlg;
+
+ pFields[1].Field = 1;
+ pFields[1].IsAscending = sal_True;
+ pFields[1].IsCaseSensitive = sal_False;
+ pFields[1].FieldType = table::TableSortFieldType_ALPHANUMERIC;
+ pFields[1].CollatorLocale = aLang;
+ pFields[1].CollatorAlgorithm = aCollAlg;
+
+ pFields[2].Field = 1;
+ pFields[2].IsAscending = sal_True;
+ pFields[2].IsCaseSensitive = sal_False;
+ pFields[2].FieldType = table::TableSortFieldType_ALPHANUMERIC;
+ pFields[2].CollatorLocale = aLang;
+ pFields[2].CollatorAlgorithm = aCollAlg;
+
+ aVal <<= aFields;
+ pArray[4] = beans::PropertyValue(C2U("SortFields"), -1, aVal,
+ beans::PropertyState_DIRECT_VALUE);
+
+ return aRet;
+}
+
+/*-- 09.12.98 14:18:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SAL_CALL
+SwXTextCursor::createSortDescriptor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return SwUnoCursorHelper::CreateSortDescriptor(false);
+}
+
+/* -----------------------------15.12.00 14:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwUnoCursorHelper::ConvertSortProperties(
+ const uno::Sequence< beans::PropertyValue >& rDescriptor,
+ SwSortOptions& rSortOpt)
+{
+ sal_Bool bRet = sal_True;
+ const beans::PropertyValue* pProperties = rDescriptor.getConstArray();
+
+ rSortOpt.bTable = sal_False;
+ rSortOpt.cDeli = ' ';
+ rSortOpt.eDirection = SRT_COLUMNS; //!! UI text may be contrary though !!
+
+ SwSortKey* pKey1 = new SwSortKey;
+ pKey1->nColumnId = USHRT_MAX;
+ pKey1->bIsNumeric = TRUE;
+ pKey1->eSortOrder = SRT_ASCENDING;
+
+ SwSortKey* pKey2 = new SwSortKey;
+ pKey2->nColumnId = USHRT_MAX;
+ pKey2->bIsNumeric = TRUE;
+ pKey2->eSortOrder = SRT_ASCENDING;
+
+ SwSortKey* pKey3 = new SwSortKey;
+ pKey3->nColumnId = USHRT_MAX;
+ pKey3->bIsNumeric = TRUE;
+ pKey3->eSortOrder = SRT_ASCENDING;
+ SwSortKey* aKeys[3] = {pKey1, pKey2, pKey3};
+
+ sal_Bool bOldSortdescriptor(sal_False);
+ sal_Bool bNewSortdescriptor(sal_False);
+
+ for (sal_Int32 n = 0; n < rDescriptor.getLength(); ++n)
+ {
+ uno::Any aValue( pProperties[n].Value );
+// String sPropName = pProperties[n].Name;
+ const OUString& rPropName = pProperties[n].Name;
+
+ // old and new sortdescriptor
+ if (rPropName.equalsAscii("IsSortInTable"))
+ {
+ if (aValue.getValueType() == ::getBooleanCppuType())
+ {
+ rSortOpt.bTable = *(sal_Bool*)aValue.getValue();
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (rPropName.equalsAscii("Delimiter"))
+ {
+ sal_Unicode uChar = sal_Unicode();
+ if (aValue >>= uChar)
+ {
+ rSortOpt.cDeli = uChar;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ // old sortdescriptor
+ else if (rPropName.equalsAscii("SortColumns"))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_Bool bTemp(sal_False);
+ if (aValue >>= bTemp)
+ {
+ rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if ( rPropName.equalsAscii("IsCaseSensitive"))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_Bool bTemp(sal_False);
+ if (aValue >>= bTemp)
+ {
+ rSortOpt.bIgnoreCase = !bTemp;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (rPropName.equalsAscii("CollatorLocale"))
+ {
+ bOldSortdescriptor = sal_True;
+ lang::Locale aLocale;
+ if (aValue >>= aLocale)
+ {
+ rSortOpt.nLanguage = SvxLocaleToLanguage( aLocale );
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (rPropName.matchAsciiL("CollatorAlgorithm", 17) &&
+ rPropName.getLength() == 18 &&
+ (rPropName.getStr()[17] >= '0' && rPropName.getStr()[17] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[17];
+ nIndex -= '0';
+ OUString aTxt;
+ if ((aValue >>= aTxt) && nIndex < 3)
+ {
+ aKeys[nIndex]->sSortType = aTxt;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (rPropName.matchAsciiL("SortRowOrColumnNo", 17) &&
+ rPropName.getLength() == 18 &&
+ (rPropName.getStr()[17] >= '0' && rPropName.getStr()[17] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[17];
+ nIndex -= '0';
+ sal_Int16 nCol = -1;
+ if (aValue.getValueType() == ::getCppuType((const sal_Int16*)0)
+ && nIndex < 3)
+ {
+ aValue >>= nCol;
+ }
+ if (nCol >= 0)
+ {
+ aKeys[nIndex]->nColumnId = nCol;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (0 == rPropName.indexOf(C2U("IsSortNumeric")) &&
+ rPropName.getLength() == 14 &&
+ (rPropName.getStr()[13] >= '0' && rPropName.getStr()[13] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[13];
+ nIndex = nIndex - '0';
+ if (aValue.getValueType() == ::getBooleanCppuType() && nIndex < 3)
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ aKeys[nIndex]->bIsNumeric = bTemp;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (0 == rPropName.indexOf(C2U("IsSortAscending")) &&
+ rPropName.getLength() == 16 &&
+ (rPropName.getStr()[15] >= '0' && rPropName.getStr()[15] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[15];
+ nIndex -= '0';
+ if (aValue.getValueType() == ::getBooleanCppuType() && nIndex < 3)
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ aKeys[nIndex]->eSortOrder = (bTemp)
+ ? SRT_ASCENDING : SRT_DESCENDING;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ // new sortdescriptor
+ else if (rPropName.equalsAscii("IsSortColumns"))
+ {
+ bNewSortdescriptor = sal_True;
+ if (aValue.getValueType() == ::getBooleanCppuType())
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else if (rPropName.equalsAscii("SortFields"))
+ {
+ bNewSortdescriptor = sal_True;
+ uno::Sequence < table::TableSortField > aFields;
+ if (aValue >>= aFields)
+ {
+ sal_Int32 nCount(aFields.getLength());
+ if (nCount <= 3)
+ {
+ table::TableSortField* pFields = aFields.getArray();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ rSortOpt.bIgnoreCase = !pFields[i].IsCaseSensitive;
+ rSortOpt.nLanguage =
+ SvxLocaleToLanguage( pFields[i].CollatorLocale );
+ aKeys[i]->sSortType = pFields[i].CollatorAlgorithm;
+ aKeys[i]->nColumnId =
+ static_cast<USHORT>(pFields[i].Field);
+ aKeys[i]->bIsNumeric = (pFields[i].FieldType ==
+ table::TableSortFieldType_NUMERIC);
+ aKeys[i]->eSortOrder = (pFields[i].IsAscending)
+ ? SRT_ASCENDING : SRT_DESCENDING;
+ }
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+ }
+
+ if (bNewSortdescriptor && bOldSortdescriptor)
+ {
+ DBG_ERROR("someone tried to set the old deprecated and "
+ "the new sortdescriptor");
+ bRet = sal_False;
+ }
+
+ if (pKey1->nColumnId != USHRT_MAX)
+ {
+ rSortOpt.aKeys.C40_INSERT(SwSortKey, pKey1, rSortOpt.aKeys.Count());
+ }
+ if (pKey2->nColumnId != USHRT_MAX)
+ {
+ rSortOpt.aKeys.C40_INSERT(SwSortKey, pKey2, rSortOpt.aKeys.Count());
+ }
+ if (pKey3->nColumnId != USHRT_MAX)
+ {
+ rSortOpt.aKeys.C40_INSERT(SwSortKey, pKey3, rSortOpt.aKeys.Count());
+ }
+
+ return bRet && rSortOpt.aKeys.Count() > 0;
+}
+
+/*-- 09.12.98 14:19:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextCursor::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ if (rUnoCursor.HasMark())
+ {
+ SwSortOptions aSortOpt;
+ if (!SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
+ {
+ throw uno::RuntimeException();
+ }
+ UnoActionContext aContext( rUnoCursor.GetDoc() );
+
+ SwPosition & rStart = *rUnoCursor.Start();
+ SwPosition & rEnd = *rUnoCursor.End();
+
+ SwNodeIndex aPrevIdx( rStart.nNode, -1 );
+ const ULONG nOffset = rEnd.nNode.GetIndex() - rStart.nNode.GetIndex();
+ const xub_StrLen nCntStt = rStart.nContent.GetIndex();
+
+ rUnoCursor.GetDoc()->SortText(rUnoCursor, aSortOpt);
+
+ // Selektion wieder setzen
+ rUnoCursor.DeleteMark();
+ rUnoCursor.GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
+ SwCntntNode *const pCNd = rUnoCursor.GetCntntNode();
+ xub_StrLen nLen = pCNd->Len();
+ if (nLen > nCntStt)
+ {
+ nLen = nCntStt;
+ }
+ rUnoCursor.GetPoint()->nContent.Assign(pCNd, nLen );
+ rUnoCursor.SetMark();
+
+ rUnoCursor.GetPoint()->nNode += nOffset;
+ SwCntntNode *const pCNd2 = rUnoCursor.GetCntntNode();
+ rUnoCursor.GetPoint()->nContent.Assign( pCNd2, pCNd2->Len() );
+ }
+}
+
+/* -----------------------------03.04.00 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXTextCursor::createContentEnumeration(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!rServiceName.equalsAscii("com.sun.star.text.TextContent"))
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ uno::Reference< container::XEnumeration > xRet =
+ new SwXParaFrameEnumeration(rUnoCursor, PARAFRAME_PORTION_TEXTRANGE);
+ return xRet;
+}
+
+/* -----------------------------07.03.01 14:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXTextCursor::createEnumeration() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ SwUnoCrsr & rUnoCursor( m_pImpl->GetCursorOrThrow() );
+
+ const uno::Reference<lang::XUnoTunnel> xTunnel(
+ m_pImpl->m_xParentText, uno::UNO_QUERY);
+ SwXText* pParentText = 0;
+ if (xTunnel.is())
+ {
+ pParentText = ::sw::UnoTunnelGetImplementation<SwXText>(xTunnel);
+ }
+ DBG_ASSERT(pParentText, "parent is not a SwXText");
+ if (!pParentText)
+ {
+ throw uno::RuntimeException();
+ }
+
+ ::std::auto_ptr<SwUnoCrsr> pNewCrsr(
+ rUnoCursor.GetDoc()->CreateUnoCrsr(*rUnoCursor.GetPoint()) );
+ if (rUnoCursor.HasMark())
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *rUnoCursor.GetMark();
+ }
+ const CursorType eSetType = (CURSOR_TBLTEXT == m_pImpl->m_eType)
+ ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
+ SwTableNode const*const pStartNode( (CURSOR_TBLTEXT == m_pImpl->m_eType)
+ ? rUnoCursor.GetPoint()->nNode.GetNode().FindTableNode()
+ : 0);
+ SwTable const*const pTable(
+ (pStartNode) ? & pStartNode->GetTable() : 0 );
+ const uno::Reference< container::XEnumeration > xRet =
+ new SwXParagraphEnumeration(
+ pParentText, pNewCrsr, eSetType, pStartNode, pTable);
+
+ return xRet;
+}
+
+/* -----------------------------07.03.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Type SAL_CALL
+SwXTextCursor::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+
+/* -----------------------------07.03.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXTextCursor::hasElements() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+/* -----------------------------03.04.00 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXTextCursor::getAvailableServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString::createFromAscii("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+// ---------------------------------------------------------------------------
+IMPLEMENT_FORWARD_REFCOUNT( SwXTextCursor,SwXTextCursor_Base )
+
+uno::Any SAL_CALL
+SwXTextCursor::queryInterface(const uno::Type& rType)
+throw (uno::RuntimeException)
+{
+ return (rType == lang::XUnoTunnel::static_type())
+ ? OTextCursorHelper::queryInterface(rType)
+ : SwXTextCursor_Base::queryInterface(rType);
+}
+
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
new file mode 100644
index 000000000000..d9334e97c841
--- /dev/null
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -0,0 +1,2097 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <rtl/ustrbuf.hxx>
+#include <swtypes.hxx>
+#include <hintids.hxx>
+#include <cmdid.h>
+#include <hints.hxx>
+#include <IMark.hxx>
+#include <bookmrk.hxx>
+#include <frmfmt.hxx>
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <unocrsr.hxx>
+#include <swundo.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <ftnidx.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <tools/urlobj.hxx>
+#include <pam.hxx>
+#include <tools/cachestr.hxx>
+#include <shellio.hxx>
+#include <swerror.h>
+#include <swtblfmt.hxx>
+#include <docsh.hxx>
+#include <docstyle.hxx>
+#include <charfmt.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hrc>
+#include <poolfmt.hxx>
+#include <edimp.hxx>
+#include <fchrfmt.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <doctxm.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <unoparaframeenum.hxx>
+#include <unofootnote.hxx>
+#include <unotextbodyhf.hxx>
+#include <unotextrange.hxx>
+#include <unoparagraph.hxx>
+#include <unomap.hxx>
+#include <unoport.hxx>
+#include <unocrsrhelper.hxx>
+#include <unosett.hxx>
+#include <unoprnms.hxx>
+#include <unotbl.hxx>
+#include <unodraw.hxx>
+#include <unocoll.hxx>
+#include <unostyle.hxx>
+#include <unofield.hxx>
+#include <fmtanchr.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <svtools/ctrltool.hxx>
+#include <flypos.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <fmtcntnt.hxx>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <fmthdft.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtflcnt.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_XUB_STRLEN
+#include <svl/svstdarr.hxx>
+#include <editeng/brshitem.hxx>
+#include <fmtclds.hxx>
+#include <dcontact.hxx>
+#include <dflyobj.hxx>
+#include <crsskip.hxx>
+// OD 2004-05-07 #i28701#
+#include <vector>
+// OD 2004-05-24 #i28701#
+#include <sortedobjs.hxx>
+#include <sortopt.hxx>
+
+#include <algorithm>
+#include <iterator>
+#include <boost/bind.hpp>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+namespace sw {
+
+sal_Bool SupportsServiceImpl(
+ size_t const nServices, char const*const pServices[],
+ ::rtl::OUString const & rServiceName)
+{
+ for (size_t i = 0; i < nServices; ++i)
+ {
+ if (rServiceName.equalsAscii(pServices[i]))
+ {
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString >
+GetSupportedServiceNamesImpl(
+ size_t const nServices, char const*const pServices[])
+{
+ uno::Sequence< ::rtl::OUString > ret(nServices);
+ for (size_t i = 0; i < nServices; ++i)
+ {
+ ret[i] = C2U(pServices[i]);
+ }
+ return ret;
+}
+
+} // namespace sw
+
+
+namespace sw {
+
+void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
+{
+ rTarget = rSource;
+
+ if (rSource.GetNext() != &rSource)
+ {
+ SwPaM *pPam = static_cast<SwPaM *>(rSource.GetNext());
+ do
+ {
+ // create new PaM
+ SwPaM *const pNew = new SwPaM(*pPam);
+ // insert into ring
+ pNew->MoveTo(&rTarget);
+ pPam = static_cast<SwPaM *>(pPam->GetNext());
+ }
+ while (pPam != &rSource);
+ }
+}
+
+} // namespace sw
+
+struct FrameDependSortListLess
+{
+ bool operator() (FrameDependSortListEntry const& r1,
+ FrameDependSortListEntry const& r2)
+ {
+ return (r1.nIndex < r2.nIndex)
+ || ((r1.nIndex == r2.nIndex) && (r1.nOrder < r2.nOrder));
+ }
+};
+
+// OD 2004-05-07 #i28701# - adjust 4th parameter
+void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
+ FrameDependSortList_t & rFrames,
+ const bool _bAtCharAnchoredObjs )
+{
+ // _bAtCharAnchoredObjs:
+ // <TRUE>: at-character anchored objects are collected
+ // <FALSE>: at-paragraph anchored objects are collected
+
+ // alle Rahmen, Grafiken und OLEs suchen, die an diesem Absatz
+ // gebunden sind
+ SwDoc* pDoc = rIdx.GetNode().GetDoc();
+
+ USHORT nChkType = static_cast< USHORT >((_bAtCharAnchoredObjs)
+ ? FLY_AT_CHAR : FLY_AT_PARA);
+ const SwCntntFrm* pCFrm;
+ const SwCntntNode* pCNd;
+ if( pDoc->GetRootFrm() &&
+ 0 != (pCNd = rIdx.GetNode().GetCntntNode()) &&
+ 0 != (pCFrm = pCNd->GetFrm()) )
+ {
+ const SwSortedObjs *pObjs = pCFrm->GetDrawObjs();
+ if( pObjs )
+ for( USHORT i = 0; i < pObjs->Count(); ++i )
+ {
+ SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
+ SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
+ if ( rFmt.GetAnchor().GetAnchorId() == nChkType )
+ {
+ // create SwDepend and insert into array
+ SwDepend* pNewDepend = new SwDepend( &rClnt, &rFmt );
+ xub_StrLen idx =
+ rFmt.GetAnchor().GetCntntAnchor()->nContent.GetIndex();
+ sal_uInt32 nOrder = rFmt.GetAnchor().GetOrder();
+
+ // OD 2004-05-07 #i28701# - sorting no longer needed,
+ // because list <SwSortedObjs> is already sorted.
+ FrameDependSortListEntry entry(idx, nOrder, pNewDepend);
+ rFrames.push_back(entry);
+ }
+ }
+ }
+ else
+ {
+ const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+ USHORT nSize = rFmts.Count();
+ for ( USHORT i = 0; i < nSize; i++)
+ {
+ const SwFrmFmt* pFmt = rFmts[ i ];
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ const SwPosition* pAnchorPos;
+ if( rAnchor.GetAnchorId() == nChkType &&
+ 0 != (pAnchorPos = rAnchor.GetCntntAnchor()) &&
+ pAnchorPos->nNode == rIdx )
+ {
+ //jetzt einen SwDepend anlegen und in das Array einfuegen
+ SwDepend* pNewDepend = new SwDepend( &rClnt, (SwFrmFmt*)pFmt);
+
+ // OD 2004-05-07 #i28701# - determine insert position for
+ // sorted <rFrameArr>
+ xub_StrLen nIndex = pAnchorPos->nContent.GetIndex();
+ sal_uInt32 nOrder = rAnchor.GetOrder();
+
+ FrameDependSortListEntry entry(nIndex, nOrder, pNewDepend);
+ rFrames.push_back(entry);
+ }
+ }
+ ::std::sort(rFrames.begin(), rFrames.end(), FrameDependSortListLess());
+ }
+}
+
+/****************************************************************************
+ ActionContext
+****************************************************************************/
+UnoActionContext::UnoActionContext(SwDoc *const pDoc)
+ : m_pDoc(pDoc)
+{
+ SwRootFrm *const pRootFrm = m_pDoc->GetRootFrm();
+ if (pRootFrm)
+ {
+ pRootFrm->StartAllAction();
+ }
+}
+
+/*-----------------04.03.98 11:56-------------------
+
+--------------------------------------------------*/
+UnoActionContext::~UnoActionContext()
+{
+ // Doc may already have been removed here
+ if (m_pDoc)
+ {
+ SwRootFrm *const pRootFrm = m_pDoc->GetRootFrm();
+ if (pRootFrm)
+ {
+ pRootFrm->EndAllAction();
+ }
+ }
+}
+
+/****************************************************************************
+ ActionRemoveContext
+****************************************************************************/
+UnoActionRemoveContext::UnoActionRemoveContext(SwDoc *const pDoc)
+ : m_pDoc(pDoc)
+{
+ SwRootFrm *const pRootFrm = m_pDoc->GetRootFrm();
+ if (pRootFrm)
+ {
+ pRootFrm->UnoRemoveAllActions();
+ }
+}
+
+/* -----------------07.07.98 12:05-------------------
+ *
+ * --------------------------------------------------*/
+UnoActionRemoveContext::~UnoActionRemoveContext()
+{
+ SwRootFrm *const pRootFrm = m_pDoc->GetRootFrm();
+ if (pRootFrm)
+ {
+ pRootFrm->UnoRestoreAllActions();
+ }
+}
+
+
+/*-- 10.12.98 11:52:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ClientModify(SwClient* pClient, SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)pClient->GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)pClient->GetRegisteredIn())->Remove(pClient);
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == pClient->GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ ((SwModify*)pClient->GetRegisteredIn())->Remove(pClient);
+ break;
+ }
+}
+
+
+/*-- 09.12.98 14:19:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam,
+ const SfxItemSet& rSet,
+ const SetAttrMode nAttrMode, const bool bTableMode)
+{
+ const SetAttrMode nFlags = nAttrMode | nsSetAttrMode::SETATTR_APICALL;
+ SwDoc* pDoc = rPam.GetDoc();
+ //StartEndAction
+ UnoActionContext aAction(pDoc);
+ if (rPam.GetNext() != &rPam) // Ring of Cursors
+ {
+ pDoc->StartUndo(UNDO_INSATTR, NULL);
+
+ SwPaM *pCurrent = &rPam;
+ do
+ {
+ if (pCurrent->HasMark() &&
+ ( (bTableMode) ||
+ (*pCurrent->GetPoint() != *pCurrent->GetMark()) ))
+ {
+ pDoc->InsertItemSet(*pCurrent, rSet, nFlags);
+ }
+ pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
+ } while (pCurrent != &rPam);
+
+ pDoc->EndUndo(UNDO_INSATTR, NULL);
+ }
+ else
+ {
+// if( !HasSelection() )
+// UpdateAttr();
+ pDoc->InsertItemSet( rPam, rSet, nFlags );
+ }
+ //#outline level,add by zhaojianwei
+ if( rSet.GetItemState( RES_PARATR_OUTLINELEVEL, false ) >= SFX_ITEM_AVAILABLE )
+ {
+ SwTxtNode * pTmpNode = rPam.GetNode()->GetTxtNode();
+ if ( pTmpNode )
+ {
+ rPam.GetDoc()->GetNodes().UpdateOutlineNode( *pTmpNode );
+ }
+ }
+ //<-end,zhaojianwei
+}
+/*-- 09.12.98 14:19:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+// --> OD 2006-07-12 #i63870#
+// split third parameter <bCurrentAttrOnly> into new parameters <bOnlyTxtAttr>
+// and <bGetFromChrFmt> to get better control about resulting <SfxItemSet>
+void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam,
+ SfxItemSet & rSet, const bool bOnlyTxtAttr, const bool bGetFromChrFmt)
+{
+ static const sal_uInt16 nMaxLookup = 1000;
+ SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
+ SfxItemSet *pSet = &rSet;
+ SwPaM *pCurrent = & rPam;
+ do
+ {
+ SwPosition const & rStart( *pCurrent->Start() );
+ SwPosition const & rEnd( *pCurrent->End() );
+ const ULONG nSttNd = rStart.nNode.GetIndex();
+ const ULONG nEndNd = rEnd .nNode.GetIndex();
+
+ if (nEndNd - nSttNd >= nMaxLookup)
+ {
+ rSet.ClearItem();
+ rSet.InvalidateAllItems();
+ return;// uno::Any();
+ }
+
+ // the first node inserts the values into the get set
+ // all other nodes merge their values into the get set
+ for (ULONG n = nSttNd; n <= nEndNd; ++n)
+ {
+ SwNode *const pNd = rPam.GetDoc()->GetNodes()[ n ];
+ switch (pNd->GetNodeType())
+ {
+ case ND_TEXTNODE:
+ {
+ const xub_StrLen nStart = (n == nSttNd)
+ ? rStart.nContent.GetIndex() : 0;
+ const xub_StrLen nEnd = (n == nEndNd)
+ ? rEnd.nContent.GetIndex()
+ : static_cast<SwTxtNode*>(pNd)->GetTxt().Len();
+ static_cast<SwTxtNode*>(pNd)->GetAttr(
+ *pSet, nStart, nEnd, bOnlyTxtAttr, bGetFromChrFmt);
+ }
+ break;
+ case ND_GRFNODE:
+ case ND_OLENODE:
+ static_cast<SwCntntNode*>(pNd)->GetAttr( *pSet );
+ break;
+
+ default:
+ continue; // skip this node
+ }
+
+ if (pSet != &rSet)
+ {
+ rSet.MergeValues( aSet );
+ }
+ else
+ {
+ pSet = &aSet;
+ }
+
+ if (aSet.Count())
+ {
+ aSet.ClearItem();
+ }
+ }
+ pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
+ } while ( pCurrent != &rPam );
+}
+
+/******************************************************************
+ * SwXParagraphEnumeration
+ ******************************************************************/
+
+class SwXParagraphEnumeration::Impl
+ : public SwClient
+{
+
+public:
+
+ uno::Reference< text::XText > const m_xParentText;
+ const CursorType m_eCursorType;
+ /// Start node of the cell _or_ table the enumeration belongs to.
+ /// Used to restrict the movement of the UNO cursor to the cell and its
+ /// embedded tables.
+ SwStartNode const*const m_pOwnStartNode;
+ SwTable const*const m_pOwnTable;
+ const ULONG m_nEndIndex;
+ sal_Int32 m_nFirstParaStart;
+ sal_Int32 m_nLastParaEnd;
+ bool m_bFirstParagraph;
+ uno::Reference< text::XTextContent > m_xNextPara;
+
+ Impl( uno::Reference< text::XText > const& xParent,
+ ::std::auto_ptr<SwUnoCrsr> pCursor,
+ const CursorType eType,
+ SwStartNode const*const pStartNode, SwTable const*const pTable)
+ : SwClient( pCursor.release() )
+ , m_xParentText( xParent )
+ , m_eCursorType( eType )
+ // remember table and start node for later travelling
+ // (used in export of tables in tables)
+ , m_pOwnStartNode( pStartNode )
+ // for import of tables in tables we have to remember the actual
+ // table and start node of the current position in the enumeration.
+ , m_pOwnTable( pTable )
+ , m_nEndIndex( GetCursor()->End()->nNode.GetIndex() )
+ , m_nFirstParaStart( -1 )
+ , m_nLastParaEnd( -1 )
+ , m_bFirstParagraph( true )
+ {
+ OSL_ENSURE(m_xParentText.is(), "SwXParagraphEnumeration: no parent?");
+ OSL_ENSURE(GetRegisteredIn(), "SwXParagraphEnumeration: no cursor?");
+ OSL_ENSURE( !((CURSOR_SELECTION_IN_TABLE == eType) ||
+ (CURSOR_TBLTEXT == eType))
+ || (m_pOwnTable && m_pOwnStartNode),
+ "SwXParagraphEnumeration: table type but no start node or table?");
+
+ if ((CURSOR_SELECTION == m_eCursorType) ||
+ (CURSOR_SELECTION_IN_TABLE == m_eCursorType))
+ {
+ SwUnoCrsr & rCursor = *GetCursor();
+ rCursor.Normalize();
+ m_nFirstParaStart = rCursor.GetPoint()->nContent.GetIndex();
+ m_nLastParaEnd = rCursor.GetMark()->nContent.GetIndex();
+ rCursor.DeleteMark();
+ }
+ }
+
+ ~Impl() {
+ // Impl owns the cursor; delete it here: SolarMutex is locked
+ delete GetRegisteredIn();
+ }
+
+ SwUnoCrsr * GetCursor() {
+ return static_cast<SwUnoCrsr*>(
+ const_cast<SwModify*>(GetRegisteredIn()));
+ }
+
+ uno::Reference< text::XTextContent > NextElement_Impl()
+ throw (container::NoSuchElementException, lang::WrappedTargetException,
+ uno::RuntimeException);
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+void SwXParagraphEnumeration::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/*-- 10.12.98 11:52:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraphEnumeration::SwXParagraphEnumeration(
+ uno::Reference< text::XText > const& xParent,
+ ::std::auto_ptr<SwUnoCrsr> pCursor,
+ const CursorType eType,
+ SwStartNode const*const pStartNode, SwTable const*const pTable)
+ : m_pImpl( new SwXParagraphEnumeration::Impl(xParent, pCursor, eType,
+ pStartNode, pTable) )
+{
+}
+/*-- 10.12.98 11:52:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraphEnumeration::~SwXParagraphEnumeration()
+{
+}
+
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXParagraphEnumeration::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXParagraphEnumeration");
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesParagraphEnum[] =
+{
+ "com.sun.star.text.ParagraphEnumeration",
+};
+static const size_t g_nServicesParagraphEnum(
+ sizeof(g_ServicesParagraphEnum)/sizeof(g_ServicesParagraphEnum[0]));
+
+sal_Bool SAL_CALL
+SwXParagraphEnumeration::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesParagraphEnum, g_ServicesParagraphEnum, rServiceName);
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXParagraphEnumeration::getSupportedServiceNames()
+throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesParagraphEnum, g_ServicesParagraphEnum);
+}
+
+/*-- 10.12.98 11:52:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXParagraphEnumeration::hasMoreElements() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return (m_pImpl->m_bFirstParagraph) ? sal_True : m_pImpl->m_xNextPara.is();
+}
+/*-- 14.08.03 13:10:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+//!! compare to SwShellTableCrsr::FillRects() in viscrs.cxx
+static SwTableNode *
+lcl_FindTopLevelTable(
+ SwTableNode *const pTblNode, SwTable const*const pOwnTable)
+{
+ // find top-most table in current context (section) level
+
+ SwTableNode * pLast = pTblNode;
+ for (SwTableNode* pTmp = pLast;
+ pTmp != NULL && &pTmp->GetTable() != pOwnTable; /* we must not go up higher than the own table! */
+ pTmp = pTmp->StartOfSectionNode()->FindTableNode() )
+ {
+ pLast = pTmp;
+ }
+ return pLast;
+}
+
+
+static bool
+lcl_CursorIsInSection(
+ SwUnoCrsr const*const pUnoCrsr, SwStartNode const*const pOwnStartNode)
+{
+ // returns true if the cursor is in the section (or in a sub section!)
+ // represented by pOwnStartNode
+
+ bool bRes = true;
+ if (pUnoCrsr && pOwnStartNode)
+ {
+ const SwEndNode * pOwnEndNode = pOwnStartNode->EndOfSectionNode();
+ bRes = pOwnStartNode->GetIndex() <= pUnoCrsr->Start()->nNode.GetIndex() &&
+ pUnoCrsr->End()->nNode.GetIndex() <= pOwnEndNode->GetIndex();
+ }
+ return bRes;
+}
+
+
+uno::Reference< text::XTextContent >
+SwXParagraphEnumeration::Impl::NextElement_Impl()
+throw (container::NoSuchElementException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SwUnoCrsr *const pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ {
+ throw uno::RuntimeException();
+ }
+
+ // check for exceeding selections
+ if (!m_bFirstParagraph &&
+ ((CURSOR_SELECTION == m_eCursorType) ||
+ (CURSOR_SELECTION_IN_TABLE == m_eCursorType)))
+ {
+ SwPosition* pStart = pUnoCrsr->Start();
+ const ::std::auto_ptr<SwUnoCrsr> aNewCrsr(
+ pUnoCrsr->GetDoc()->CreateUnoCrsr(*pStart, sal_False) );
+ // one may also go into tables here
+ if ((CURSOR_TBLTEXT != m_eCursorType) &&
+ (CURSOR_SELECTION_IN_TABLE != m_eCursorType))
+ {
+ aNewCrsr->SetRemainInSection( sal_False );
+ }
+
+ // os 2005-01-14: This part is only necessary to detect movements out
+ // of a selection; if there is no selection we don't have to care
+ SwTableNode *const pTblNode = aNewCrsr->GetNode()->FindTableNode();
+ if (((CURSOR_TBLTEXT != m_eCursorType) &&
+ (CURSOR_SELECTION_IN_TABLE != m_eCursorType)) && pTblNode)
+ {
+ aNewCrsr->GetPoint()->nNode = pTblNode->EndOfSectionIndex();
+ aNewCrsr->Move(fnMoveForward, fnGoNode);
+ }
+ else
+ {
+ aNewCrsr->MovePara(fnParaNext, fnParaStart);
+ }
+ if (m_nEndIndex < aNewCrsr->Start()->nNode.GetIndex())
+ {
+ return 0;
+ }
+ }
+
+ sal_Bool bInTable = sal_False;
+ if (!m_bFirstParagraph)
+ {
+ pUnoCrsr->SetRemainInSection( sal_False );
+ // what to do if already in a table?
+ SwTableNode * pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ pTblNode = lcl_FindTopLevelTable( pTblNode, m_pOwnTable );
+ if (pTblNode && (&pTblNode->GetTable() != m_pOwnTable))
+ {
+ // this is a foreign table: go to end
+ pUnoCrsr->GetPoint()->nNode = pTblNode->EndOfSectionIndex();
+ if (!pUnoCrsr->Move(fnMoveForward, fnGoNode))
+ {
+ return 0;
+ }
+ bInTable = sal_True;
+ }
+ }
+
+ uno::Reference< text::XTextContent > xRef;
+ // the cursor must remain in the current section or a subsection
+ // before AND after the movement...
+ if (lcl_CursorIsInSection( pUnoCrsr, m_pOwnStartNode ) &&
+ (m_bFirstParagraph || bInTable ||
+ (pUnoCrsr->MovePara(fnParaNext, fnParaStart) &&
+ lcl_CursorIsInSection( pUnoCrsr, m_pOwnStartNode ))))
+ {
+ SwPosition* pStart = pUnoCrsr->Start();
+ const sal_Int32 nFirstContent =
+ (m_bFirstParagraph) ? m_nFirstParaStart : -1;
+ const sal_Int32 nLastContent =
+ (m_nEndIndex == pStart->nNode.GetIndex()) ? m_nLastParaEnd : -1;
+
+ // position in a table, or in a simple paragraph?
+ SwTableNode * pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ pTblNode = lcl_FindTopLevelTable( pTblNode, m_pOwnTable );
+ if (/*CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType && */
+ pTblNode && (&pTblNode->GetTable() != m_pOwnTable))
+ {
+ // this is a foreign table
+ SwFrmFmt* pTableFmt =
+ static_cast<SwFrmFmt*>(pTblNode->GetTable().GetFrmFmt());
+ text::XTextTable *const pTable =
+ SwXTextTables::GetObject( *pTableFmt );
+ xRef = static_cast<text::XTextContent*>(
+ static_cast<SwXTextTable*>(pTable));
+ }
+ else
+ {
+ text::XText *const pText = m_xParentText.get();
+ xRef = SwXParagraph::CreateXParagraph(*pUnoCrsr->GetDoc(),
+ *pStart->nNode.GetNode().GetTxtNode(),
+ static_cast<SwXText*>(pText), nFirstContent, nLastContent);
+ }
+ }
+
+ return xRef;
+}
+/*-- 10.12.98 11:52:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXParagraphEnumeration::nextElement()
+throw (container::NoSuchElementException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bFirstParagraph)
+ {
+ m_pImpl->m_xNextPara = m_pImpl->NextElement_Impl();
+ m_pImpl->m_bFirstParagraph = false;
+ }
+ const uno::Reference< text::XTextContent > xRef = m_pImpl->m_xNextPara;
+ if (!xRef.is())
+ {
+ throw container::NoSuchElementException();
+ }
+ m_pImpl->m_xNextPara = m_pImpl->NextElement_Impl();
+
+ uno::Any aRet;
+ aRet <<= xRef;
+ return aRet;
+}
+
+/******************************************************************
+ * SwXTextRange
+ ******************************************************************/
+
+class SwXTextRange::Impl
+ : public SwClient
+{
+
+public:
+
+ const SfxItemPropertySet & m_rPropSet;
+ const enum RangePosition m_eRangePosition;
+ SwDoc & m_rDoc;
+ uno::Reference<text::XText> m_xParentText;
+ SwDepend m_ObjectDepend; // register at format of table or frame
+ ::sw::mark::IMark * m_pMark;
+
+ Impl( SwDoc & rDoc, const enum RangePosition eRange,
+ SwFrmFmt *const pTblFmt = 0,
+ const uno::Reference< text::XText > & xParent = 0)
+ : SwClient()
+ , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
+ , m_eRangePosition(eRange)
+ , m_rDoc(rDoc)
+ , m_xParentText(xParent)
+ , m_ObjectDepend(this, pTblFmt)
+ , m_pMark(0)
+ {
+ }
+
+ ~Impl()
+ {
+ // Impl owns the bookmark; delete it here: SolarMutex is locked
+ Invalidate();
+ }
+
+ void Invalidate()
+ {
+ if (m_pMark)
+ {
+ m_rDoc.getIDocumentMarkAccess()->deleteMark(m_pMark);
+ m_pMark = 0;
+ }
+ }
+
+ const ::sw::mark::IMark * GetBookmark() const { return m_pMark; }
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+void SwXTextRange::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ const bool bAlreadyRegistered = 0 != GetRegisteredIn();
+ ClientModify(this, pOld, pNew);
+ if (m_ObjectDepend.GetRegisteredIn())
+ {
+ ClientModify(&m_ObjectDepend, pOld, pNew);
+ // if the depend was removed then the range must be removed too
+ if (!m_ObjectDepend.GetRegisteredIn() && GetRegisteredIn())
+ {
+ const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ }
+ // or if the range has been removed but the depend ist still
+ // connected then the depend must be removed
+ else if (bAlreadyRegistered && !GetRegisteredIn() &&
+ m_ObjectDepend.GetRegisteredIn())
+ {
+ const_cast<SwModify*>(m_ObjectDepend.GetRegisteredIn())
+ ->Remove(& m_ObjectDepend);
+ }
+ }
+ if (!GetRegisteredIn())
+ {
+ m_pMark = 0;
+ }
+}
+
+
+SwXTextRange::SwXTextRange(SwPaM& rPam,
+ const uno::Reference< text::XText > & xParent,
+ const enum RangePosition eRange)
+ : m_pImpl( new SwXTextRange::Impl(*rPam.GetDoc(), eRange, 0, xParent) )
+{
+ SetPositions(rPam);
+}
+
+SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt)
+ : m_pImpl(
+ new SwXTextRange::Impl(*rTblFmt.GetDoc(), RANGE_IS_TABLE, &rTblFmt) )
+{
+ SwTable *const pTable = SwTable::FindTable( &rTblFmt );
+ SwTableNode *const pTblNode = pTable->GetTableNode();
+ SwPosition aPosition( *pTblNode );
+ SwPaM aPam( aPosition );
+
+ SetPositions( aPam );
+}
+
+SwXTextRange::~SwXTextRange()
+{
+}
+
+const SwDoc * SwXTextRange::GetDoc() const
+{
+ return & m_pImpl->m_rDoc;
+}
+
+SwDoc * SwXTextRange::GetDoc()
+{
+ return & m_pImpl->m_rDoc;
+}
+
+
+void SwXTextRange::Invalidate()
+{
+ m_pImpl->Invalidate();
+}
+
+void SwXTextRange::SetPositions(const SwPaM& rPam)
+{
+ m_pImpl->Invalidate();
+ IDocumentMarkAccess* const pMA = m_pImpl->m_rDoc.getIDocumentMarkAccess();
+ m_pImpl->m_pMark = pMA->makeMark(rPam, ::rtl::OUString(),
+ IDocumentMarkAccess::UNO_BOOKMARK);
+ m_pImpl->m_pMark->Add(m_pImpl.get());
+}
+
+void SwXTextRange::DeleteAndInsert(
+ const ::rtl::OUString& rText, const bool bForceExpandHints)
+throw (uno::RuntimeException)
+{
+ if (RANGE_IS_TABLE == m_pImpl->m_eRangePosition)
+ {
+ // setString on table not allowed
+ throw uno::RuntimeException();
+ }
+
+ const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent());
+ SwCursor aCursor(aPos, 0, false);
+ if (GetPositions(aCursor))
+ {
+ UnoActionContext aAction(& m_pImpl->m_rDoc);
+ m_pImpl->m_rDoc.StartUndo(UNDO_INSERT, NULL);
+ if (aCursor.HasMark())
+ {
+ m_pImpl->m_rDoc.DeleteAndJoin(aCursor);
+ }
+
+ if (rText.getLength())
+ {
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ m_pImpl->m_rDoc, aCursor, rText, bForceExpandHints);
+
+ SwUnoCursorHelper::SelectPam(aCursor, true);
+ aCursor.Left(rText.getLength(), CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ SetPositions(aCursor);
+ m_pImpl->m_rDoc.EndUndo(UNDO_INSERT, NULL);
+ }
+}
+
+const uno::Sequence< sal_Int8 > & SwXTextRange::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL
+SwXTextRange::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXTextRange>(rId, this);
+}
+
+OUString SAL_CALL
+SwXTextRange::getImplementationName() throw (uno::RuntimeException)
+{
+ return OUString::createFromAscii("SwXTextRange");
+}
+
+static char const*const g_ServicesTextRange[] =
+{
+ "com.sun.star.text.TextRange",
+ "com.sun.star.style.CharacterProperties",
+ "com.sun.star.style.CharacterPropertiesAsian",
+ "com.sun.star.style.CharacterPropertiesComplex",
+ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.style.ParagraphPropertiesComplex",
+};
+static const size_t g_nServicesTextRange(
+ sizeof(g_ServicesTextRange)/sizeof(g_ServicesTextRange[0]));
+
+sal_Bool SAL_CALL SwXTextRange::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesTextRange, g_ServicesTextRange, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXTextRange::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesTextRange, g_ServicesTextRange);
+}
+
+uno::Reference< text::XText > SAL_CALL
+SwXTextRange::getText() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_xParentText.is())
+ {
+ if (m_pImpl->m_eRangePosition == RANGE_IS_TABLE &&
+ m_pImpl->m_ObjectDepend.GetRegisteredIn())
+ {
+ SwFrmFmt const*const pTblFmt = static_cast<SwFrmFmt const*>(
+ m_pImpl->m_ObjectDepend.GetRegisteredIn());
+ SwTable const*const pTable = SwTable::FindTable( pTblFmt );
+ SwTableNode const*const pTblNode = pTable->GetTableNode();
+ const SwPosition aPosition( *pTblNode );
+ m_pImpl->m_xParentText =
+ ::sw::CreateParentXText(m_pImpl->m_rDoc, aPosition);
+ }
+ }
+ OSL_ENSURE(m_pImpl->m_xParentText.is(), "SwXTextRange::getText: no text");
+ return m_pImpl->m_xParentText;
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXTextRange::getStart() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XTextRange > xRet;
+ ::sw::mark::IMark const * const pBkmk = m_pImpl->GetBookmark();
+ if (!m_pImpl->m_xParentText.is())
+ {
+ getText();
+ }
+ if(pBkmk)
+ {
+ SwPaM aPam(pBkmk->GetMarkStart());
+ xRet = new SwXTextRange(aPam, m_pImpl->m_xParentText);
+ }
+ else if (RANGE_IS_TABLE == m_pImpl->m_eRangePosition)
+ {
+ // start and end are this, if its a table
+ xRet = this;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return xRet;
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXTextRange::getEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XTextRange > xRet;
+ ::sw::mark::IMark const * const pBkmk = m_pImpl->GetBookmark();
+ if (!m_pImpl->m_xParentText.is())
+ {
+ getText();
+ }
+ if(pBkmk)
+ {
+ SwPaM aPam(pBkmk->GetMarkEnd());
+ xRet = new SwXTextRange(aPam, m_pImpl->m_xParentText);
+ }
+ else if (RANGE_IS_TABLE == m_pImpl->m_eRangePosition)
+ {
+ // start and end are this, if its a table
+ xRet = this;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return xRet;
+}
+
+OUString SAL_CALL SwXTextRange::getString() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ OUString sRet;
+ // for tables there is no bookmark, thus also no text
+ // one could export the table as ASCII here maybe?
+ SwPaM aPaM(GetDoc()->GetNodes());
+ if (GetPositions(aPaM) && aPaM.HasMark())
+ {
+ SwUnoCursorHelper::GetTextFromPam(aPaM, sRet);
+ }
+ return sRet;
+}
+
+void SAL_CALL SwXTextRange::setString(const OUString& rString)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ DeleteAndInsert(rString, false);
+}
+
+bool SwXTextRange::GetPositions(SwPaM& rToFill) const
+{
+ ::sw::mark::IMark const * const pBkmk = m_pImpl->GetBookmark();
+ if(pBkmk)
+ {
+ *rToFill.GetPoint() = pBkmk->GetMarkPos();
+ if(pBkmk->IsExpanded())
+ {
+ rToFill.SetMark();
+ *rToFill.GetMark() = pBkmk->GetOtherMarkPos();
+ }
+ else
+ {
+ rToFill.DeleteMark();
+ }
+ return true;
+ }
+ return false;
+}
+
+namespace sw {
+
+bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
+ const uno::Reference< text::XTextRange > & xTextRange)
+{
+ bool bRet = false;
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ SwXTextPortion* pPortion = 0;
+ SwXText* pText = 0;
+ SwXParagraph* pPara = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ pPortion=
+ ::sw::UnoTunnelGetImplementation<SwXTextPortion>(xRangeTunnel);
+ pText = ::sw::UnoTunnelGetImplementation<SwXText>(xRangeTunnel);
+ pPara = ::sw::UnoTunnelGetImplementation<SwXParagraph>(xRangeTunnel);
+ }
+
+ // if it's a text then create a temporary cursor there and re-use
+ // the pCursor variable
+ // #i108489#: Reference in outside scope to keep cursor alive
+ uno::Reference< text::XTextCursor > xTextCursor;
+ if (pText)
+ {
+ xTextCursor.set( pText->CreateCursor() );
+ xTextCursor->gotoEnd(sal_True);
+ const uno::Reference<lang::XUnoTunnel> xCrsrTunnel(
+ xTextCursor, uno::UNO_QUERY);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCrsrTunnel);
+ }
+ if(pRange && pRange->GetDoc() == rToFill.GetDoc())
+ {
+ bRet = pRange->GetPositions(rToFill);
+ }
+ else
+ {
+ if (pPara)
+ {
+ bRet = pPara->SelectPaM(rToFill);
+ }
+ else
+ {
+ SwDoc* const pDoc = (pCursor) ? pCursor->GetDoc()
+ : ((pPortion) ? pPortion->GetCursor()->GetDoc() : 0);
+ const SwPaM* const pUnoCrsr = (pCursor) ? pCursor->GetPaM()
+ : ((pPortion) ? pPortion->GetCursor() : 0);
+ if (pUnoCrsr && pDoc == rToFill.GetDoc())
+ {
+ DBG_ASSERT((SwPaM*)pUnoCrsr->GetNext() == pUnoCrsr,
+ "what to do about rings?");
+ bRet = true;
+ *rToFill.GetPoint() = *pUnoCrsr->GetPoint();
+ if (pUnoCrsr->HasMark())
+ {
+ rToFill.SetMark();
+ *rToFill.GetMark() = *pUnoCrsr->GetMark();
+ }
+ else
+ rToFill.DeleteMark();
+ }
+ }
+ }
+ return bRet;
+}
+
+static bool
+lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode *const pSttNode,
+ SwFrmFmt const*const pFrmFmt, SwFrmFmt*& rpFormat)
+{
+ bool bRet = false;
+ const SfxItemSet& rSet = pFrmFmt->GetAttrSet();
+ const SfxPoolItem* pItem;
+ if (SFX_ITEM_SET == rSet.GetItemState(
+ static_cast<USHORT>(bHeader ? RES_HEADER : RES_FOOTER),
+ sal_True, &pItem))
+ {
+ SfxPoolItem *const pItemNonConst(const_cast<SfxPoolItem *>(pItem));
+ SwFrmFmt *const pHeadFootFmt = (bHeader) ?
+ static_cast<SwFmtHeader*>(pItemNonConst)->GetHeaderFmt() :
+ static_cast<SwFmtFooter*>(pItemNonConst)->GetFooterFmt();
+ if (pHeadFootFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ SwStartNode const*const pCurSttNode = rNode.FindSttNodeByType(
+ (bHeader) ? SwHeaderStartNode : SwFooterStartNode);
+ if (pCurSttNode && (pCurSttNode == pSttNode))
+ {
+ rpFormat = pHeadFootFmt;
+ bRet = true;
+ }
+ }
+ }
+ return bRet;
+}
+
+} // namespace sw
+
+uno::Reference< text::XTextRange >
+SwXTextRange::CreateXTextRange(
+ SwDoc & rDoc, const SwPosition& rPos, const SwPosition *const pMark)
+{
+ const uno::Reference<text::XText> xParentText(
+ ::sw::CreateParentXText(rDoc, rPos));
+ const ::std::auto_ptr<SwUnoCrsr> pNewCrsr(
+ rDoc.CreateUnoCrsr(rPos, sal_False));
+ if(pMark)
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *pMark;
+ }
+ const bool isCell( dynamic_cast<SwXCell*>(xParentText.get()) );
+ const uno::Reference< text::XTextRange > xRet(
+ new SwXTextRange(*pNewCrsr, xParentText,
+ isCell ? RANGE_IN_CELL : RANGE_IN_TEXT) );
+ return xRet;
+}
+
+namespace sw {
+
+uno::Reference< text::XText >
+CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
+{
+ uno::Reference< text::XText > xParentText;
+ SwStartNode* pSttNode = rPos.nNode.GetNode().StartOfSectionNode();
+ while(pSttNode && pSttNode->IsSectionNode())
+ {
+ pSttNode = pSttNode->StartOfSectionNode();
+ }
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+ switch(eType)
+ {
+ case SwTableBoxStartNode:
+ {
+ SwTableNode const*const pTblNode = pSttNode->FindTableNode();
+ SwFrmFmt *const pTableFmt =
+ static_cast<SwFrmFmt*>(pTblNode->GetTable().GetFrmFmt());
+ SwTableBox *const pBox = pSttNode->GetTblBox();
+
+ xParentText = (pBox)
+ ? SwXCell::CreateXCell( pTableFmt, pBox )
+ : new SwXCell( pTableFmt, *pSttNode );
+ }
+ break;
+ case SwFlyStartNode:
+ {
+ SwFrmFmt *const pFmt = pSttNode->GetFlyFmt();
+ if (0 != pFmt)
+ {
+ SwXTextFrame* pFrame( static_cast<SwXTextFrame*>(
+ SwClientIter( *pFmt ).First( TYPE( SwXTextFrame ) ) ) );
+ xParentText = pFrame ? pFrame : new SwXTextFrame( *pFmt );
+ }
+ }
+ break;
+ case SwHeaderStartNode:
+ case SwFooterStartNode:
+ {
+ const bool bHeader = (SwHeaderStartNode == eType);
+ const sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
+ for(sal_uInt16 i = 0; i < nPDescCount; i++)
+ {
+ const SwPageDesc& rDesc =
+ // C++ is retarded
+ const_cast<SwDoc const&>(rDoc).GetPageDesc( i );
+ const SwFrmFmt* pFrmFmtMaster = &rDesc.GetMaster();
+ const SwFrmFmt* pFrmFmtLeft = &rDesc.GetLeft();
+
+ SwFrmFmt* pHeadFootFmt = 0;
+ if (!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtMaster,
+ pHeadFootFmt))
+ {
+ lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtLeft,
+ pHeadFootFmt);
+ }
+
+ if (pHeadFootFmt)
+ {
+ xParentText = SwXHeadFootText::CreateXHeadFootText(
+ *pHeadFootFmt, bHeader);
+ }
+ }
+ }
+ break;
+ case SwFootnoteStartNode:
+ {
+ const sal_uInt16 nFtnCnt = rDoc.GetFtnIdxs().Count();
+ uno::Reference< text::XFootnote > xRef;
+ for (sal_uInt16 n = 0; n < nFtnCnt; ++n )
+ {
+ const SwTxtFtn* pTxtFtn = rDoc.GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ pTxtFtn = rFtn.GetTxtFtn();
+#if OSL_DEBUG_LEVEL > 1
+ const SwStartNode* pTmpSttNode =
+ pTxtFtn->GetStartNode()->GetNode().
+ FindSttNodeByType(SwFootnoteStartNode);
+ (void)pTmpSttNode;
+#endif
+
+ if (pSttNode == pTxtFtn->GetStartNode()->GetNode().
+ FindSttNodeByType(SwFootnoteStartNode))
+ {
+ xParentText = SwXFootnote::CreateXFootnote(rDoc, rFtn);
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ {
+ // then it is the body text
+ const uno::Reference<frame::XModel> xModel =
+ rDoc.GetDocShell()->GetBaseModel();
+ const uno::Reference< text::XTextDocument > xDoc(
+ xModel, uno::UNO_QUERY);
+ xParentText = xDoc->getText();
+ }
+ }
+ OSL_ENSURE(xParentText.is(), "no parent text?");
+ return xParentText;
+}
+
+} // namespace sw
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXTextRange::createContentEnumeration(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!rServiceName.equalsAscii("com.sun.star.text.TextContent"))
+ {
+ throw uno::RuntimeException();
+ }
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent());
+ const ::std::auto_ptr<SwUnoCrsr> pNewCrsr(
+ m_pImpl->m_rDoc.CreateUnoCrsr(aPos, FALSE));
+ if (!GetPositions(*pNewCrsr))
+ {
+ throw uno::RuntimeException();
+ }
+
+ const uno::Reference< container::XEnumeration > xRet =
+ new SwXParaFrameEnumeration(*pNewCrsr, PARAFRAME_PORTION_TEXTRANGE);
+ return xRet;
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXTextRange::createEnumeration() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ const SwPosition aPos(GetDoc()->GetNodes().GetEndOfContent());
+ ::std::auto_ptr<SwUnoCrsr> pNewCrsr(
+ m_pImpl->m_rDoc.CreateUnoCrsr(aPos, FALSE));
+ if (!GetPositions(*pNewCrsr))
+ {
+ throw uno::RuntimeException();
+ }
+ if (!m_pImpl->m_xParentText.is())
+ {
+ getText();
+ }
+
+ const CursorType eSetType = (RANGE_IN_CELL == m_pImpl->m_eRangePosition)
+ ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
+ const uno::Reference< container::XEnumeration > xRet =
+ new SwXParagraphEnumeration(m_pImpl->m_xParentText, pNewCrsr, eSetType);
+ return xRet;
+}
+
+uno::Type SAL_CALL SwXTextRange::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+
+sal_Bool SAL_CALL SwXTextRange::hasElements() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXTextRange::getAvailableServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString::createFromAscii("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXTextRange::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+void SAL_CALL
+SwXTextRange::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ GetPositions(aPaM);
+ SwUnoCursorHelper::SetPropertyValue(aPaM, m_pImpl->m_rPropSet,
+ rPropertyName, rValue);
+}
+
+uno::Any SAL_CALL
+SwXTextRange::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ GetPositions(aPaM);
+ return SwUnoCursorHelper::GetPropertyValue(aPaM, m_pImpl->m_rPropSet,
+ rPropertyName);
+}
+
+void SAL_CALL
+SwXTextRange::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextRange::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXTextRange::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextRange::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXTextRange::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextRange::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXTextRange::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextRange::removeVetoableChangeListener(): not implemented");
+}
+
+beans::PropertyState SAL_CALL
+SwXTextRange::getPropertyState(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ GetPositions(aPaM);
+ return SwUnoCursorHelper::GetPropertyState(aPaM, m_pImpl->m_rPropSet,
+ rPropertyName);
+}
+
+uno::Sequence< beans::PropertyState > SAL_CALL
+SwXTextRange::getPropertyStates(const uno::Sequence< OUString >& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ GetPositions(aPaM);
+ return SwUnoCursorHelper::GetPropertyStates(aPaM, m_pImpl->m_rPropSet,
+ rPropertyName);
+}
+
+void SAL_CALL SwXTextRange::setPropertyToDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ GetPositions(aPaM);
+ SwUnoCursorHelper::SetPropertyToDefault(aPaM, m_pImpl->m_rPropSet,
+ rPropertyName);
+}
+
+uno::Any SAL_CALL
+SwXTextRange::getPropertyDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ GetPositions(aPaM);
+ return SwUnoCursorHelper::GetPropertyDefault(aPaM, m_pImpl->m_rPropSet,
+ rPropertyName);
+}
+
+void SAL_CALL
+SwXTextRange::makeRedline(
+ const ::rtl::OUString& rRedlineType,
+ const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc() || !m_pImpl->GetBookmark())
+ {
+ throw uno::RuntimeException();
+ }
+ SwPaM aPaM(GetDoc()->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ SwUnoCursorHelper::makeRedline( aPaM, rRedlineType, rRedlineProperties );
+}
+
+/******************************************************************
+ * SwXTextRanges
+ ******************************************************************/
+
+class SwXTextRanges::Impl
+ : public SwClient
+{
+
+public:
+
+ ::std::vector< uno::Reference< text::XTextRange > > m_Ranges;
+
+ Impl(SwPaM *const pPaM)
+ : SwClient( (pPaM)
+ ? pPaM->GetDoc()->CreateUnoCrsr(*pPaM->GetPoint())
+ : 0 )
+ {
+ if (pPaM)
+ {
+ ::sw::DeepCopyPaM(*pPaM, *GetCursor());
+ }
+ MakeRanges();
+ }
+
+ ~Impl() {
+ // Impl owns the cursor; delete it here: SolarMutex is locked
+ delete GetRegisteredIn();
+ }
+
+ SwUnoCrsr * GetCursor() {
+ return static_cast<SwUnoCrsr*>(
+ const_cast<SwModify*>(GetRegisteredIn()));
+ }
+
+ void MakeRanges();
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/*-- 10.12.98 13:57:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextRanges::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/* -----------------10.12.98 14:25-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextRanges::Impl::MakeRanges()
+{
+ SwUnoCrsr *const pCursor = GetCursor();
+ if (pCursor)
+ {
+ SwPaM *pTmpCursor = pCursor;
+ do {
+ const uno::Reference< text::XTextRange > xRange(
+ SwXTextRange::CreateXTextRange(
+ *pTmpCursor->GetDoc(),
+ *pTmpCursor->GetPoint(), pTmpCursor->GetMark()));
+ if (xRange.is())
+ {
+ m_Ranges.push_back(xRange);
+ }
+ pTmpCursor = static_cast<SwPaM*>(pTmpCursor->GetNext());
+ }
+ while (pTmpCursor != pCursor);
+ }
+}
+
+const SwUnoCrsr* SwXTextRanges::GetCursor() const
+{
+ return m_pImpl->GetCursor();
+}
+
+/*-- 10.12.98 13:57:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRanges::SwXTextRanges(SwPaM *const pPaM)
+ : m_pImpl( new SwXTextRanges::Impl(pPaM) )
+{
+}
+
+/*-- 10.12.98 13:57:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRanges::~SwXTextRanges()
+{
+}
+
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextRanges::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXTextRanges::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXTextRanges>(rId, this);
+}
+
+/****************************************************************************
+ * Text positions
+ * Bis zum ersten Zugriff auf eine TextPosition wird ein SwCursor gehalten,
+ * danach wird ein Array mit uno::Reference< XTextPosition > angelegt
+ *
+****************************************************************************/
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXTextRanges::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXTextRanges");
+}
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesTextRanges[] =
+{
+ "com.sun.star.text.TextRanges",
+};
+static const size_t g_nServicesTextRanges(
+ sizeof(g_ServicesTextRanges)/sizeof(g_ServicesTextRanges[0]));
+
+sal_Bool SAL_CALL SwXTextRanges::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesTextRanges, g_ServicesTextRanges, rServiceName);
+}
+
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXTextRanges::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesTextRanges, g_ServicesTextRanges);
+}
+
+/*-- 10.12.98 13:57:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SAL_CALL SwXTextRanges::getCount() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return static_cast<sal_Int32>(m_pImpl->m_Ranges.size());
+}
+/*-- 10.12.98 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXTextRanges::getByIndex(sal_Int32 nIndex)
+throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if ((nIndex < 0) ||
+ (static_cast<size_t>(nIndex) >= m_pImpl->m_Ranges.size()))
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+ uno::Any ret;
+ ret <<= (m_pImpl->m_Ranges.at(nIndex));
+ return ret;
+}
+
+/*-- 10.12.98 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL
+SwXTextRanges::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+/*-- 10.12.98 13:57:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXTextRanges::hasElements() throw (uno::RuntimeException)
+{
+ // no mutex necessary: getCount() does locking
+ return getCount() > 0;
+}
+
+/* -----------------11.12.98 10:07-------------------
+ *
+ * --------------------------------------------------*/
+void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
+{
+ // Start/EndAction
+ SwDoc *const pDoc = rCursor.GetDoc();
+ UnoActionContext aAction(pDoc);
+ pDoc->StartUndo(UNDO_INSERT, NULL);
+ if (rCursor.HasMark())
+ {
+ pDoc->DeleteAndJoin(rCursor);
+ }
+ if (rString.getLength())
+ {
+ String aText(rString);
+ const bool bSuccess( SwUnoCursorHelper::DocInsertStringSplitCR(
+ *pDoc, rCursor, aText, false ) );
+ DBG_ASSERT( bSuccess, "DocInsertStringSplitCR" );
+ (void) bSuccess;
+ SwUnoCursorHelper::SelectPam(rCursor, true);
+ rCursor.Left(rString.getLength(), CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ pDoc->EndUndo(UNDO_INSERT, NULL);
+}
+
+/******************************************************************
+ * SwXParaFrameEnumeration
+ ******************************************************************/
+
+class SwXParaFrameEnumeration::Impl
+ : public SwClient
+{
+
+public:
+
+ // created by hasMoreElements
+ uno::Reference< text::XTextContent > m_xNextObject;
+ FrameDependList_t m_Frames;
+
+ Impl(SwPaM const & rPaM)
+ : SwClient(rPaM.GetDoc()->CreateUnoCrsr(*rPaM.GetPoint(), sal_False))
+ {
+ if (rPaM.HasMark())
+ {
+ GetCursor()->SetMark();
+ *GetCursor()->GetMark() = *rPaM.GetMark();
+ }
+ }
+
+ ~Impl() {
+ // Impl owns the cursor; delete it here: SolarMutex is locked
+ delete GetRegisteredIn();
+ }
+
+ SwUnoCrsr * GetCursor() {
+ return static_cast<SwUnoCrsr*>(
+ const_cast<SwModify*>(GetRegisteredIn()));
+ }
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/*-- 23.03.99 13:22:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+struct InvalidFrameDepend {
+ bool operator() (::boost::shared_ptr<SwDepend> const & rEntry)
+ { return !rEntry->GetRegisteredIn(); }
+};
+
+void SwXParaFrameEnumeration::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ m_Frames.clear();
+ m_xNextObject = 0;
+ }
+ else
+ {
+ // check if any frame went away...
+ FrameDependList_t::iterator const iter =
+ ::std::remove_if(m_Frames.begin(), m_Frames.end(),
+ InvalidFrameDepend());
+ m_Frames.erase(iter, m_Frames.end());
+ }
+}
+
+/* -----------------23.03.99 13:38-------------------
+ *
+ * --------------------------------------------------*/
+static sal_Bool
+lcl_CreateNextObject(SwUnoCrsr& i_rUnoCrsr,
+ uno::Reference<text::XTextContent> & o_rNextObject,
+ FrameDependList_t & i_rFrames)
+{
+ if (!i_rFrames.size())
+ return sal_False;
+
+ SwFrmFmt *const pFormat = static_cast<SwFrmFmt*>(const_cast<SwModify*>(
+ i_rFrames.front()->GetRegisteredIn()));
+ i_rFrames.pop_front();
+ // the format should be valid here, otherwise the client
+ // would have been removed in ::Modify
+ // check for a shape first
+ SwClientIter aIter(*pFormat);
+ SwDrawContact * const pContact =
+ static_cast<SwDrawContact*>( aIter.First(TYPE(SwDrawContact)) );
+ if (pContact)
+ {
+ SdrObject * const pSdr = pContact->GetMaster();
+ if (pSdr)
+ {
+ o_rNextObject.set(pSdr->getUnoShape(), uno::UNO_QUERY);
+ }
+ }
+ else
+ {
+ const SwNodeIndex* pIdx = pFormat->GetCntnt().GetCntntIdx();
+ DBG_ASSERT(pIdx, "where is the index?");
+ SwNode const*const pNd =
+ i_rUnoCrsr.GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+
+ const FlyCntType eType = (!pNd->IsNoTxtNode()) ? FLYCNTTYPE_FRM
+ : ( (pNd->IsGrfNode()) ? FLYCNTTYPE_GRF : FLYCNTTYPE_OLE );
+
+ const uno::Reference< container::XNamed > xFrame =
+ SwXFrames::GetObject(*pFormat, eType);
+ o_rNextObject.set(xFrame, uno::UNO_QUERY);
+ }
+
+ return o_rNextObject.is();
+}
+
+/* -----------------------------03.04.00 10:15--------------------------------
+ Description: Search for a FLYCNT text attribute at the cursor point
+ and fill the frame into the array
+ ---------------------------------------------------------------------------*/
+static void
+lcl_FillFrame(SwClient & rEnum, SwUnoCrsr& rUnoCrsr,
+ FrameDependList_t & rFrames)
+{
+ // search for objects at the cursor - anchored at/as char
+ SwTxtAttr const*const pTxtAttr =
+ rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rUnoCrsr.GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT);
+ if (pTxtAttr)
+ {
+ const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt();
+ SwFrmFmt * const pFrmFmt = rFlyCnt.GetFrmFmt();
+ SwDepend * const pNewDepend = new SwDepend(&rEnum, pFrmFmt);
+ rFrames.push_back( ::boost::shared_ptr<SwDepend>(pNewDepend) );
+ }
+}
+
+/*-- 23.03.99 13:22:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParaFrameEnumeration::SwXParaFrameEnumeration(
+ const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode,
+ SwFrmFmt *const pFmt)
+ : m_pImpl( new SwXParaFrameEnumeration::Impl(rPaM) )
+{
+ if (PARAFRAME_PORTION_PARAGRAPH == eParaFrameMode)
+ {
+ FrameDependSortList_t frames;
+ ::CollectFrameAtNode(*m_pImpl.get(), rPaM.GetPoint()->nNode,
+ frames, false);
+ ::std::transform(frames.begin(), frames.end(),
+ ::std::back_inserter(m_pImpl->m_Frames),
+ ::boost::bind(&FrameDependSortListEntry::pFrameDepend, _1));
+ }
+ else if (pFmt)
+ {
+ // create SwDepend for frame and insert into array
+ SwDepend *const pNewDepend = new SwDepend(m_pImpl.get(), pFmt);
+ m_pImpl->m_Frames.push_back(::boost::shared_ptr<SwDepend>(pNewDepend));
+ }
+ else if ((PARAFRAME_PORTION_CHAR == eParaFrameMode) ||
+ (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode))
+ {
+ if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode)
+ {
+ SwPosFlyFrms aFlyFrms;
+ //get all frames that are bound at paragraph or at character
+ rPaM.GetDoc()->GetAllFlyFmts(aFlyFrms, m_pImpl->GetCursor());
+ for(USHORT i = 0; i < aFlyFrms.Count(); i++)
+ {
+ SwPosFlyFrm* pPosFly = aFlyFrms[i];
+ SwFrmFmt *const pFrmFmt =
+ const_cast<SwFrmFmt*>(&pPosFly->GetFmt());
+ // create SwDepend for frame and insert into array
+ SwDepend *const pNewDepend =
+ new SwDepend(m_pImpl.get(), pFrmFmt);
+ m_pImpl->m_Frames.push_back(
+ ::boost::shared_ptr<SwDepend>(pNewDepend) );
+ }
+ //created from any text range
+ if (m_pImpl->GetCursor()->HasMark())
+ {
+ m_pImpl->GetCursor()->Normalize();
+ do
+ {
+ lcl_FillFrame(*m_pImpl.get(), *m_pImpl->GetCursor(),
+ m_pImpl->m_Frames);
+ m_pImpl->GetCursor()->Right(
+ 1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ while (*m_pImpl->GetCursor()->GetPoint() <
+ *m_pImpl->GetCursor()->GetMark());
+ }
+ }
+ lcl_FillFrame(*m_pImpl.get(), *m_pImpl->GetCursor(), m_pImpl->m_Frames);
+ }
+}
+/*-- 23.03.99 13:22:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParaFrameEnumeration::~SwXParaFrameEnumeration()
+{
+}
+
+/*-- 23.03.99 13:22:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXParaFrameEnumeration::hasMoreElements() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetCursor())
+ throw uno::RuntimeException();
+
+ return (m_pImpl->m_xNextObject.is())
+ ? sal_True
+ : lcl_CreateNextObject(*m_pImpl->GetCursor(),
+ m_pImpl->m_xNextObject, m_pImpl->m_Frames);
+}
+/*-- 23.03.99 13:22:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXParaFrameEnumeration::nextElement()
+throw (container::NoSuchElementException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetCursor())
+ {
+ throw uno::RuntimeException();
+ }
+
+ if (!m_pImpl->m_xNextObject.is() && m_pImpl->m_Frames.size())
+ {
+ lcl_CreateNextObject(*m_pImpl->GetCursor(),
+ m_pImpl->m_xNextObject, m_pImpl->m_Frames);
+ }
+ if (!m_pImpl->m_xNextObject.is())
+ {
+ throw container::NoSuchElementException();
+ }
+ uno::Any aRet;
+ aRet <<= m_pImpl->m_xNextObject;
+ m_pImpl->m_xNextObject = 0;
+ return aRet;
+}
+
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXParaFrameEnumeration::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXParaFrameEnumeration");
+}
+
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesParaFrameEnum[] =
+{
+ "com.sun.star.util.ContentEnumeration",
+};
+static const size_t g_nServicesParaFrameEnum(
+ sizeof(g_ServicesParaFrameEnum)/sizeof(g_ServicesParaFrameEnum[0]));
+
+sal_Bool SAL_CALL
+SwXParaFrameEnumeration::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesParaFrameEnum, g_ServicesParaFrameEnum, rServiceName);
+}
+
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXParaFrameEnumeration::getSupportedServiceNames()
+throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesParaFrameEnum, g_ServicesParaFrameEnum);
+}
+
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
new file mode 100644
index 000000000000..3b865d49bf09
--- /dev/null
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -0,0 +1,1462 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <unoparagraph.hxx>
+#include <cmdid.h>
+#include <unomid.h>
+#include <unoparaframeenum.hxx>
+#include <unotext.hxx>
+#include <unotextrange.hxx>
+#include <unoport.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <unoprnms.hxx>
+#include <unocrsrhelper.hxx>
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <docsh.hxx>
+
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#include <svl/svstdarr.hxx>
+
+#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
+#include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
+#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+/* -----------------------------01.12.00 18:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwParaSelection
+{
+ SwCursor & m_rCursor;
+public:
+ SwParaSelection(SwCursor & rCursor);
+ ~SwParaSelection();
+};
+
+SwParaSelection::SwParaSelection(SwCursor & rCursor)
+ : m_rCursor(rCursor)
+{
+ if (m_rCursor.HasMark())
+ {
+ m_rCursor.DeleteMark();
+ }
+ // is it at the start?
+ if (m_rCursor.GetPoint()->nContent != 0)
+ {
+ m_rCursor.MovePara(fnParaCurr, fnParaStart);
+ }
+ // or at the end already?
+ if (m_rCursor.GetPoint()->nContent != m_rCursor.GetCntntNode()->Len())
+ {
+ m_rCursor.SetMark();
+ m_rCursor.MovePara(fnParaCurr, fnParaEnd);
+ }
+}
+
+SwParaSelection::~SwParaSelection()
+{
+ if (m_rCursor.GetPoint()->nContent != 0)
+ {
+ m_rCursor.DeleteMark();
+ m_rCursor.MovePara(fnParaCurr, fnParaStart);
+ }
+}
+
+
+/******************************************************************
+ * forward declarations
+ ******************************************************************/
+
+beans::PropertyState lcl_SwXParagraph_getPropertyState(
+ const SwTxtNode& rTxtNode,
+ const SwAttrSet** ppSet,
+ const SfxItemPropertySimpleEntry& rEntry,
+ sal_Bool &rAttrSetFetched )
+ throw (beans::UnknownPropertyException);
+
+/******************************************************************
+ * SwXParagraph
+ ******************************************************************/
+
+class SwXParagraph::Impl
+ : public SwClient
+{
+
+public:
+ SwXParagraph & m_rThis;
+ SwEventListenerContainer m_ListenerContainer;
+ SfxItemPropertySet const& m_rPropSet;
+ bool m_bIsDescriptor;
+ sal_Int32 m_nSelectionStartPos;
+ sal_Int32 m_nSelectionEndPos;
+ ::rtl::OUString m_sText;
+ uno::Reference<text::XText> m_xParentText;
+
+ Impl( SwXParagraph & rThis,
+ SwTxtNode *const pTxtNode = 0,
+ uno::Reference< text::XText > const & xParent = 0,
+ const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1)
+ : SwClient(pTxtNode)
+ , m_rThis(rThis)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH))
+ // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
+ , m_bIsDescriptor((0 == pTxtNode) ? true : false)
+ , m_nSelectionStartPos(nSelStart)
+ , m_nSelectionEndPos(nSelEnd)
+ , m_xParentText(xParent)
+ {
+ }
+
+ const SwTxtNode * GetTxtNode() const {
+ return static_cast<const SwTxtNode*>(GetRegisteredIn());
+ }
+ SwTxtNode * GetTxtNode() {
+ return static_cast<SwTxtNode*>(pRegisteredIn);
+ }
+
+ SwTxtNode & GetTxtNodeOrThrow() {
+ SwTxtNode *const pTxtNode( GetTxtNode() );
+ if (!pTxtNode) {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXParagraph: disposed or invalid")), 0);
+ }
+ return *pTxtNode;
+ }
+
+ bool IsDescriptor() const { return m_bIsDescriptor; }
+
+ void SetPropertyValues_Impl(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues)
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException);
+
+ uno::Sequence< uno::Any >
+ GetPropertyValues_Impl(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames)
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException);
+
+ uno::Sequence< beans::GetDirectPropertyTolerantResult >
+ GetPropertyValuesTolerant_Impl(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames,
+ bool bDirectValuesOnly)
+ throw (uno::RuntimeException);
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/*-- 11.12.98 08:12:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if (!GetRegisteredIn())
+ {
+ m_ListenerContainer.Disposing();
+ }
+}
+
+/*-- 11.12.98 08:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraph::SwXParagraph()
+ : m_pImpl( new SwXParagraph::Impl(*this) )
+{
+}
+
+/*-- 11.12.98 08:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraph::SwXParagraph(
+ uno::Reference< text::XText > const & xParent,
+ SwTxtNode & rTxtNode,
+ const sal_Int32 nSelStart, const sal_Int32 nSelEnd)
+ : m_pImpl(
+ new SwXParagraph::Impl(*this, &rTxtNode, xParent, nSelStart, nSelEnd))
+{
+}
+
+/*-- 11.12.98 08:12:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraph::~SwXParagraph()
+{
+}
+
+const SwTxtNode * SwXParagraph::GetTxtNode() const
+{
+ return m_pImpl->GetTxtNode();
+}
+
+bool SwXParagraph::IsDescriptor() const
+{
+ return m_pImpl->IsDescriptor();
+}
+
+uno::Reference<text::XTextContent>
+SwXParagraph::CreateXParagraph(SwDoc & rDoc, SwTxtNode& rTxtNode,
+ uno::Reference< text::XText> const& i_xParent,
+ const sal_Int32 nSelStart, const sal_Int32 nSelEnd)
+{
+ // re-use existing SwXParagraph
+ // #i105557#: do not iterate over the registered clients: race condition
+ uno::Reference<text::XTextContent> xParagraph;
+ if ((-1 == nSelStart) && (-1 == nSelEnd)) // only use cache if no selection!
+ {
+ xParagraph.set(rTxtNode.GetXParagraph());
+ }
+ if (xParagraph.is())
+ {
+ return xParagraph;
+ }
+
+ // create new SwXParagraph
+ uno::Reference<text::XText> xParentText(i_xParent);
+ if (!xParentText.is())
+ {
+ SwPosition Pos( rTxtNode );
+ xParentText.set(::sw::CreateParentXText( rDoc, Pos ));
+ }
+ SwXParagraph *const pXPara(
+ new SwXParagraph(xParentText, rTxtNode, nSelStart, nSelEnd) );
+ // this is why the constructor is private: need to acquire pXPara here
+ xParagraph.set(pXPara);
+ // in order to initialize the weak pointer cache in the core object
+ if ((-1 == nSelStart) && (-1 == nSelEnd))
+ {
+ rTxtNode.SetXParagraph(xParagraph);
+ }
+ return xParagraph;
+}
+
+bool SwXParagraph::SelectPaM(SwPaM & rPaM)
+{
+ SwTxtNode const*const pTxtNode( GetTxtNode() );
+
+ if (!pTxtNode)
+ {
+ return false;
+ }
+
+ *rPaM.GetPoint() = SwPosition( *pTxtNode );
+ // set selection to the whole paragraph
+ rPaM.SetMark();
+ rPaM.GetMark()->nContent = pTxtNode->GetTxt().Len();
+ return true;
+}
+
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXParagraph::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXParagraph::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXParagraph>(rId, this);
+}
+
+/* -----------------------------06.04.00 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXParagraph::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXParagraph");
+}
+/* -----------------------------06.04.00 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesParagraph[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.Paragraph",
+ "com.sun.star.style.CharacterProperties",
+ "com.sun.star.style.CharacterPropertiesAsian",
+ "com.sun.star.style.CharacterPropertiesComplex",
+ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.style.ParagraphPropertiesComplex",
+};
+static const size_t g_nServicesParagraph(
+ sizeof(g_ServicesParagraph)/sizeof(g_ServicesParagraph[0]));
+
+sal_Bool SAL_CALL
+SwXParagraph::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesParagraph, g_ServicesParagraph, rServiceName);
+}
+/* -----------------------------06.04.00 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXParagraph::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesParagraph, g_ServicesParagraph);
+}
+
+/* -----------------------------11.07.00 14:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void
+SwXParagraph::attachToText(SwXText & rParent, SwTxtNode & rTxtNode)
+{
+ DBG_ASSERT(m_pImpl->m_bIsDescriptor, "Paragraph is not a descriptor");
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_bIsDescriptor = false;
+ rTxtNode.Add(m_pImpl.get());
+ rTxtNode.SetXParagraph(uno::Reference<text::XTextContent>(this));
+ m_pImpl->m_xParentText = &rParent;
+ if (m_pImpl->m_sText.getLength())
+ {
+ try { setString(m_pImpl->m_sText); }
+ catch(...){}
+ m_pImpl->m_sText = OUString();
+ }
+ }
+}
+
+/*-- 11.12.98 08:12:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXParagraph::getPropertySetInfo()
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 08:12:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence<OUString> aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ uno::Sequence<uno::Any> aValues(1);
+ aValues.getArray()[0] = rValue;
+ m_pImpl->SetPropertyValues_Impl( aPropertyNames, aValues );
+}
+
+/*-- 11.12.98 08:12:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any
+SwXParagraph::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence<OUString> aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ const uno::Sequence< uno::Any > aRet =
+ m_pImpl->GetPropertyValues_Impl(aPropertyNames);
+ return aRet.getConstArray()[0];
+}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXParagraph::Impl::SetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SwTxtNode & rTxtNode(GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ const uno::Any* pValues = rValues.getConstArray();
+ SfxItemPropertyMap const*const pMap = m_rPropSet.getPropertyMap();
+ SwParaSelection aParaSel( aCursor );
+ for (sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ pMap->getByName( pPropertyNames[nProp] );
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pPropertyNames[nProp],
+ static_cast< cppu::OWeakObject * >(&m_rThis));
+ }
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw beans::PropertyVetoException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
+ + pPropertyNames[nProp],
+ static_cast< cppu::OWeakObject * >(&m_rThis));
+ }
+ SwUnoCursorHelper::SetPropertyValue(aCursor, m_rPropSet,
+ pPropertyNames[nProp], pValues[nProp]);
+ }
+}
+
+void SAL_CALL SwXParagraph::setPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+throw (beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // workaround for bad designed API
+ try
+ {
+ m_pImpl->SetPropertyValues_Impl( rPropertyNames, rValues );
+ }
+ catch (beans::UnknownPropertyException &rException)
+ {
+ // wrap the original (here not allowed) exception in
+ // a lang::WrappedTargetException that gets thrown instead.
+ lang::WrappedTargetException aWExc;
+ aWExc.TargetException <<= rException;
+ throw aWExc;
+ }
+}
+
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl(
+ const uno::Sequence< OUString > & rPropertyNames )
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SwTxtNode & rTxtNode(GetTxtNodeOrThrow());
+
+ uno::Sequence< uno::Any > aValues(rPropertyNames.getLength());
+ SwPosition aPos( rTxtNode );
+ SwPaM aPam( aPos );
+ uno::Any* pValues = aValues.getArray();
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ SfxItemPropertyMap const*const pMap = m_rPropSet.getPropertyMap();
+ const SwAttrSet& rAttrSet( rTxtNode.GetSwAttrSet() );
+ for (sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ pMap->getByName( pPropertyNames[nProp] );
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pPropertyNames[nProp],
+ static_cast< cppu::OWeakObject * >(&m_rThis));
+ }
+ if (! ::sw::GetDefaultTextContentValue(
+ pValues[nProp], pPropertyNames[nProp], pEntry->nWID))
+ {
+ beans::PropertyState eTemp;
+ const bool bDone = SwUnoCursorHelper::getCrsrPropertyValue(
+ *pEntry, aPam, &(pValues[nProp]), eTemp, &rTxtNode );
+ if (!bDone)
+ {
+ m_rPropSet.getPropertyValue(
+ *pEntry, rAttrSet, pValues[nProp]);
+ }
+ }
+ }
+ return aValues;
+}
+
+/* -----------------------------04.11.03 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SAL_CALL
+SwXParagraph::getPropertyValues(const uno::Sequence< OUString >& rPropertyNames)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< uno::Any > aValues;
+
+ // workaround for bad designed API
+ try
+ {
+ aValues = m_pImpl->GetPropertyValues_Impl( rPropertyNames );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Unknown property exception caught")),
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "WrappedTargetException caught")),
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ return aValues;
+}
+
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::addPropertiesChangeListener(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::addPropertiesChangeListener(): not implemented");
+}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::removePropertiesChangeListener(): not implemented");
+}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::firePropertiesChangeEvent(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::firePropertiesChangeEvent(): not implemented");
+}
+/* -----------------------------25.09.03 11:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+/* disabled for #i46921# */
+
+uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL
+SwXParagraph::setPropertyValuesTolerant(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if (rPropertyNames.getLength() != rValues.getLength())
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ //SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode();
+ //const SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet();
+ //USHORT nAttrCount = rAttrSet.Count();
+
+ const sal_Int32 nProps = rPropertyNames.getLength();
+ const OUString *pProp = rPropertyNames.getConstArray();
+
+ //sal_Int32 nVals = rValues.getLength();
+ const uno::Any *pValue = rValues.getConstArray();
+
+ sal_Int32 nFailed = 0;
+ uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps );
+ beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray();
+
+ // get entry to start with
+ SfxItemPropertyMap const*const pPropMap =
+ m_pImpl->m_rPropSet.getPropertyMap();
+
+ OUString sTmp;
+ SwPosition aPos( rTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( aCursor );
+ for (sal_Int32 i = 0; i < nProps; ++i)
+ {
+ try
+ {
+ pFailed[ nFailed ].Name = pProp[i];
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ pPropMap->getByName( pProp[i] );
+ if (!pEntry)
+ {
+ pFailed[ nFailed++ ].Result =
+ beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ else
+ {
+ // set property value
+ // (compare to SwXParagraph::setPropertyValues)
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ pFailed[ nFailed++ ].Result =
+ beans::TolerantPropertySetResultType::PROPERTY_VETO;
+ }
+ else
+ {
+ SwUnoCursorHelper::SetPropertyValue(
+ aCursor, m_pImpl->m_rPropSet, pProp[i], pValue[i]);
+ }
+ }
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ // should not occur because property was searched for before
+ DBG_ERROR( "unexpected exception catched" );
+ pFailed[ nFailed++ ].Result =
+ beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ pFailed[ nFailed++ ].Result =
+ beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
+ }
+ catch (beans::PropertyVetoException &)
+ {
+ pFailed[ nFailed++ ].Result =
+ beans::TolerantPropertySetResultType::PROPERTY_VETO;
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ pFailed[ nFailed++ ].Result =
+ beans::TolerantPropertySetResultType::WRAPPED_TARGET;
+ }
+ }
+
+ aFailed.realloc( nFailed );
+ return aFailed;
+}
+
+
+uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL
+SwXParagraph::getPropertyValuesTolerant(
+ const uno::Sequence< OUString >& rPropertyNames )
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes(
+ m_pImpl->GetPropertyValuesTolerant_Impl( rPropertyNames, false ) );
+ const beans::GetDirectPropertyTolerantResult *pTmpRes =
+ aTmpRes.getConstArray();
+
+ // copy temporary result to final result type
+ const sal_Int32 nLen = aTmpRes.getLength();
+ uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen );
+ beans::GetPropertyTolerantResult *pRes = aRes.getArray();
+ for (sal_Int32 i = 0; i < nLen; i++)
+ {
+ *pRes++ = *pTmpRes++;
+ }
+ return aRes;
+}
+
+
+uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL
+SwXParagraph::getDirectPropertyValuesTolerant(
+ const uno::Sequence< OUString >& rPropertyNames )
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ return m_pImpl->GetPropertyValuesTolerant_Impl( rPropertyNames, true );
+}
+
+
+uno::Sequence< beans::GetDirectPropertyTolerantResult >
+SwXParagraph::Impl::GetPropertyValuesTolerant_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ bool bDirectValuesOnly )
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SwTxtNode & rTxtNode(GetTxtNodeOrThrow());
+
+ // #i46786# Use SwAttrSet pointer for determining the state.
+ // Use the value SwAttrSet (from the paragraph OR the style)
+ // for determining the actual value(s).
+ const SwAttrSet* pAttrSet = rTxtNode.GetpSwAttrSet();
+ const SwAttrSet& rValueAttrSet = rTxtNode.GetSwAttrSet();
+
+ sal_Int32 nProps = rPropertyNames.getLength();
+ const OUString *pProp = rPropertyNames.getConstArray();
+
+ uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( nProps );
+ beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray();
+ sal_Int32 nIdx = 0;
+
+ // get entry to start with
+ SfxItemPropertyMap const*const pPropMap = m_rPropSet.getPropertyMap();
+
+ for (sal_Int32 i = 0; i < nProps; ++i)
+ {
+ DBG_ASSERT( nIdx < nProps, "index out ouf bounds" );
+ beans::GetDirectPropertyTolerantResult &rResult = pResult[nIdx];
+
+ try
+ {
+ rResult.Name = pProp[i];
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ pPropMap->getByName( pProp[i] );
+ if (!pEntry) // property available?
+ {
+ rResult.Result =
+ beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ else
+ {
+ // get property state
+ // (compare to SwXParagraph::getPropertyState)
+ sal_Bool bAttrSetFetched = sal_True;
+ beans::PropertyState eState = lcl_SwXParagraph_getPropertyState(
+ rTxtNode, &pAttrSet, *pEntry, bAttrSetFetched );
+ rResult.State = eState;
+
+// if (bDirectValuesOnly && PropertyState_DIRECT_VALUE != eState)
+// rResult.Result = beans::TolerantPropertySetResultType::NO_DIRECT_VALUE;
+// else
+ rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
+ if (!bDirectValuesOnly ||
+ (beans::PropertyState_DIRECT_VALUE == eState))
+ {
+ // get property value
+ // (compare to SwXParagraph::getPropertyValue(s))
+ uno::Any aValue;
+ if (! ::sw::GetDefaultTextContentValue(
+ aValue, pProp[i], pEntry->nWID ) )
+ {
+ SwPosition aPos( rTxtNode );
+ SwPaM aPam( aPos );
+ // handle properties that are not part of the attribute
+ // and thus only pretendend to be paragraph attributes
+ beans::PropertyState eTemp;
+ const bool bDone =
+ SwUnoCursorHelper::getCrsrPropertyValue(
+ *pEntry, aPam, &aValue, eTemp, &rTxtNode );
+
+ // if not found try the real paragraph attributes...
+ if (!bDone)
+ {
+ m_rPropSet.getPropertyValue(
+ *pEntry, rValueAttrSet, aValue );
+ }
+ }
+
+ rResult.Value = aValue;
+ rResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
+
+ nIdx++;
+ }
+ // this assertion should never occur!
+ DBG_ASSERT( nIdx < 1 || pResult[nIdx - 1].Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE,
+ "unknown failure while retrieving property" );
+
+ }
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ // should not occur because property was searched for before
+ DBG_ERROR( "unexpected exception caught" );
+ rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ rResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
+ }
+ catch (beans::PropertyVetoException &)
+ {
+ rResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ rResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
+ }
+ }
+
+ // resize to actually used size
+ aResult.realloc( nIdx );
+
+ return aResult;
+}
+
+/* -----------------------------12.09.00 11:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+bool ::sw::GetDefaultTextContentValue(
+ uno::Any& rAny, const OUString& rPropertyName, USHORT nWID)
+{
+ if(!nWID)
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
+ nWID = FN_UNO_ANCHOR_TYPE;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)))
+ nWID = FN_UNO_ANCHOR_TYPES;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
+ nWID = FN_UNO_TEXT_WRAP;
+ else
+ return FALSE;
+ }
+
+ switch(nWID)
+ {
+ case FN_UNO_TEXT_WRAP: rAny <<= text::WrapTextMode_NONE; break;
+ case FN_UNO_ANCHOR_TYPE: rAny <<= text::TextContentAnchorType_AT_PARAGRAPH; break;
+ case FN_UNO_ANCHOR_TYPES:
+ { uno::Sequence<text::TextContentAnchorType> aTypes(1);
+ text::TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
+ rAny.setValue(&aTypes, ::getCppuType((uno::Sequence<text::TextContentAnchorType>*)0));
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+/*-- 11.12.98 08:12:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::addPropertyChangeListener(): not implemented");
+}
+
+/*-- 11.12.98 08:12:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::removePropertyChangeListener(): not implemented");
+}
+
+/*-- 11.12.98 08:12:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::addVetoableChangeListener(): not implemented");
+}
+
+/*-- 11.12.98 08:12:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXParagraph::removeVetoableChangeListener(): not implemented");
+}
+
+//-----------------------------------------------------------------------------
+beans::PropertyState lcl_SwXParagraph_getPropertyState(
+// SwUnoCrsr& rUnoCrsr,
+ const SwTxtNode& rTxtNode,
+ const SwAttrSet** ppSet,
+ const SfxItemPropertySimpleEntry& rEntry,
+ sal_Bool &rAttrSetFetched )
+throw (beans::UnknownPropertyException)
+{
+ beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
+
+ if(!(*ppSet) && !rAttrSetFetched )
+ {
+ (*ppSet) = rTxtNode.GetpSwAttrSet();
+ rAttrSetFetched = sal_True;
+ }
+ SwPosition aPos( rTxtNode );
+ SwPaM aPam( aPos );
+ switch( rEntry.nWID )
+ {
+ case FN_UNO_NUM_RULES:
+ // if numbering is set, return it; else do nothing
+ SwUnoCursorHelper::getNumberingProperty( aPam, eRet, NULL );
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ break;
+ case RES_ANCHOR:
+ if ( MID_SURROUND_SURROUNDTYPE != rEntry.nMemberId )
+ goto lcl_SwXParagraph_getPropertyStateDEFAULT;
+ break;
+ case RES_SURROUND:
+ if ( MID_ANCHOR_ANCHORTYPE != rEntry.nMemberId )
+ goto lcl_SwXParagraph_getPropertyStateDEFAULT;
+ break;
+ case FN_UNO_PARA_STYLE:
+ case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
+ {
+ SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(
+ aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
+ eRet = pFmt ? beans::PropertyState_DIRECT_VALUE
+ : beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ case FN_UNO_PAGE_STYLE:
+ {
+ String sVal;
+ SwUnoCursorHelper::GetCurPageStyle( aPam, sVal );
+ eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE
+ : beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ lcl_SwXParagraph_getPropertyStateDEFAULT:
+ default:
+ if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, FALSE))
+ eRet = beans::PropertyState_DIRECT_VALUE;
+ break;
+ }
+ return eRet;
+}
+
+/*-- 05.03.99 11:37:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SAL_CALL
+SwXParagraph::getPropertyState(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ const SwAttrSet* pSet = 0;
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ sal_Bool bDummy = sal_False;
+ const beans::PropertyState eRet =
+ lcl_SwXParagraph_getPropertyState(rTxtNode, &pSet, *pEntry, bDummy);
+ return eRet;
+}
+/*-- 05.03.99 11:37:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+uno::Sequence< beans::PropertyState > SAL_CALL
+SwXParagraph::getPropertyStates(
+ const uno::Sequence< OUString >& PropertyNames)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ const OUString* pNames = PropertyNames.getConstArray();
+ uno::Sequence< beans::PropertyState > aRet(PropertyNames.getLength());
+ beans::PropertyState* pStates = aRet.getArray();
+ SfxItemPropertyMap const*const pMap = m_pImpl->m_rPropSet.getPropertyMap();
+ const SwAttrSet* pSet = 0;
+ sal_Bool bAttrSetFetched = sal_False;
+
+ for (sal_Int32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd;
+ ++i, ++pStates, ++pNames)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ pMap->getByName( *pNames );
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + *pNames,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ if (bAttrSetFetched && !pSet && isATR(pEntry->nWID))
+ {
+ *pStates = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ *pStates = lcl_SwXParagraph_getPropertyState(
+ rTxtNode, &pSet, *pEntry, bAttrSetFetched );
+ }
+ }
+
+ return aRet;
+}
+
+/*-- 05.03.99 11:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)) ||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)) ||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
+ {
+ return;
+ }
+
+ // select paragraph
+ SwParaSelection aParaSel( aCursor );
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName( rPropertyName );
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw uno::RuntimeException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ if (pEntry->nWID < RES_FRMATR_END)
+ {
+ SvUShortsSort aWhichIds;
+ aWhichIds.Insert(pEntry->nWID);
+ if (pEntry->nWID < RES_PARATR_BEGIN)
+ {
+ aCursor.GetDoc()->ResetAttrs(aCursor, sal_True, &aWhichIds);
+ }
+ else
+ {
+ // for paragraph attributes the selection must be extended
+ // to paragraph boundaries
+ SwPosition aStart( *aCursor.Start() );
+ SwPosition aEnd ( *aCursor.End() );
+ ::std::auto_ptr<SwUnoCrsr> pTemp(
+ aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) );
+ if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
+ {
+ pTemp->MovePara(fnParaCurr, fnParaStart);
+ }
+ pTemp->SetMark();
+ *pTemp->GetPoint() = aEnd;
+ //pTemp->Exchange();
+ SwUnoCursorHelper::SelectPam(*pTemp, true);
+ if (!SwUnoCursorHelper::IsEndOfPara(*pTemp))
+ {
+ pTemp->MovePara(fnParaCurr, fnParaEnd);
+ }
+ pTemp->GetDoc()->ResetAttrs(*pTemp, sal_True, &aWhichIds);
+ }
+ }
+ else
+ {
+ SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, aCursor);
+ }
+}
+
+/*-- 05.03.99 11:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ uno::Any aRet;
+ if (::sw::GetDefaultTextContentValue(aRet, rPropertyName))
+ {
+ return aRet;
+ }
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ if (pEntry->nWID < RES_FRMATR_END)
+ {
+ const SfxPoolItem& rDefItem =
+ rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
+ rDefItem.QueryValue(aRet, pEntry->nMemberId);
+ }
+
+ return aRet;
+}
+
+/*-- 11.12.98 08:12:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXParagraph::attach(const uno::Reference< text::XTextRange > & /*xTextRange*/)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ // SwXParagraph will only created in order to be inserted by
+ // 'insertTextContentBefore' or 'insertTextContentAfter' therefore
+ // they cannot be attached
+ throw uno::RuntimeException();
+}
+
+/*-- 11.12.98 08:12:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXParagraph::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ // select paragraph
+ SwParaSelection aParaSel( aCursor );
+ const uno::Reference< text::XTextRange > xRet =
+ new SwXTextRange(aCursor, m_pImpl->m_xParentText);
+ return xRet;
+}
+
+/*-- 11.12.98 08:12:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode *const pTxtNode( m_pImpl->GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwCursor aCursor( SwPosition( *pTxtNode ), 0, false );
+ // select paragraph
+ {
+ SwParaSelection aParaSel( aCursor );
+ pTxtNode->GetDoc()->DelFullPara(aCursor);
+ }
+ m_pImpl->m_ListenerContainer.Disposing();
+ }
+}
+
+/*-- 11.12.98 08:12:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetTxtNode())
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+/*-- 11.12.98 08:12:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetTxtNode() ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/*-- 11.12.98 08:12:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXParagraph::createEnumeration() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwPaM aPam ( aPos );
+ const uno::Reference< container::XEnumeration > xRef =
+ new SwXTextPortionEnumeration(aPam, m_pImpl->m_xParentText,
+ m_pImpl->m_nSelectionStartPos, m_pImpl->m_nSelectionEndPos);
+ return xRef;
+}
+
+/*-- 11.12.98 08:12:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXParagraph::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+/*-- 11.12.98 08:12:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SAL_CALL SwXParagraph::hasElements() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return (GetTxtNode()) ? sal_True : sal_False;
+}
+
+/*-- 11.12.98 08:12:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SAL_CALL
+SwXParagraph::getText() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return m_pImpl->m_xParentText;
+}
+
+/*-- 11.12.98 08:12:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXParagraph::getStart() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( aCursor );
+ SwPaM aPam( *aCursor.Start() );
+ uno::Reference< text::XText > xParent = getText();
+ const uno::Reference< text::XTextRange > xRet =
+ new SwXTextRange(aPam, xParent);
+ return xRet;
+}
+/*-- 11.12.98 08:12:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXParagraph::getEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( aCursor );
+ SwPaM aPam( *aCursor.End() );
+ uno::Reference< text::XText > xParent = getText();
+ const uno::Reference< text::XTextRange > xRet =
+ new SwXTextRange(aPam, xParent);
+ return xRet;
+}
+
+/*-- 11.12.98 08:12:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXParagraph::getString() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString aRet;
+ SwTxtNode const*const pTxtNode( GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ SwParaSelection aParaSel( aCursor );
+ SwUnoCursorHelper::GetTextFromPam(aCursor, aRet);
+ }
+ else if (m_pImpl->IsDescriptor())
+ {
+ aRet = m_pImpl->m_sText;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+/*-- 11.12.98 08:12:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXParagraph::setString(const OUString& aString)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwTxtNode const*const pTxtNode( GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwPosition aPos( *pTxtNode );
+ SwCursor aCursor( aPos, 0, false );
+ if (!SwUnoCursorHelper::IsStartOfPara(aCursor)) {
+ aCursor.MovePara(fnParaCurr, fnParaStart);
+ }
+ SwUnoCursorHelper::SelectPam(aCursor, true);
+ if (pTxtNode->GetTxt().Len()) {
+ aCursor.MovePara(fnParaCurr, fnParaEnd);
+ }
+ SwUnoCursorHelper::SetString(aCursor, aString);
+ SwUnoCursorHelper::SelectPam(aCursor, false);
+ }
+ else if (m_pImpl->IsDescriptor())
+ {
+ m_pImpl->m_sText = aString;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+
+/* -----------------23.03.99 12:49-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXParagraph::createContentEnumeration(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!rServiceName.equalsAscii("com.sun.star.text.TextContent"))
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
+
+ SwPosition aPos( rTxtNode );
+ SwPaM aPam( aPos );
+ uno::Reference< container::XEnumeration > xRet =
+ new SwXParaFrameEnumeration(aPam, PARAFRAME_PORTION_PARAGRAPH);
+ return xRet;
+}
+/* -----------------23.03.99 12:49-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXParagraph::getAvailableServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXParagraph::GetCoreObject()
+{
+ SwTxtNode *const pTxtNode( m_pImpl->GetTxtNode() );
+ return pTxtNode;
+}
+
+uno::Reference<frame::XModel> SwXParagraph::GetModel()
+{
+ SwTxtNode *const pTxtNode( m_pImpl->GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwDocShell const*const pShell( pTxtNode->GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
new file mode 100644
index 000000000000..5b0eca4a40fa
--- /dev/null
+++ b/sw/source/core/unocore/unoport.cxx
@@ -0,0 +1,1072 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+#include <cmdid.h>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/itemprop.hxx>
+
+#include <unocrsrhelper.hxx>
+#include <unoport.hxx>
+#include <unoparaframeenum.hxx>
+#include <unotextrange.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unomid.h>
+#include <txtatr.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <doc.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtfld.hxx>
+#include <frmfmt.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
+#include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
+#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+/******************************************************************
+ * SwXTextPortion
+ ******************************************************************/
+
+static void init(SwXTextPortion & rPortion, const SwUnoCrsr* pPortionCursor)
+{
+ SwUnoCrsr* pUnoCursor =
+ pPortionCursor->GetDoc()->CreateUnoCrsr(*pPortionCursor->GetPoint());
+ if (pPortionCursor->HasMark())
+ {
+ pUnoCursor->SetMark();
+ *pUnoCursor->GetMark() = *pPortionCursor->GetMark();
+ }
+ pUnoCursor->Add(& rPortion);
+}
+
+/*-- 11.12.98 09:56:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ uno::Reference< text::XText > const& rParent,
+ SwTextPortionType eType)
+ : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ , m_pPropSet(aSwMapProvider.GetPropertySet(
+ (PORTION_REDLINE_START == eType ||
+ PORTION_REDLINE_END == eType)
+ ? PROPERTY_MAP_REDLINE_PORTION
+ : PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
+ , m_xParentText(rParent)
+ , m_pRubyText(0)
+ , m_pRubyStyle(0)
+ , m_pRubyAdjust(0)
+ , m_pRubyIsAbove(0)
+ , m_FrameDepend(this, 0)
+ , m_pFrameFmt(0)
+ , m_ePortionType(eType)
+ , m_bIsCollapsed(false)
+{
+ init(*this, pPortionCrsr);
+}
+
+/* -----------------24.03.99 16:30-------------------
+ *
+ * --------------------------------------------------*/
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ uno::Reference< text::XText > const& rParent,
+ SwFrmFmt& rFmt )
+ : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ , m_pPropSet(aSwMapProvider.GetPropertySet(
+ PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
+ , m_xParentText(rParent)
+ , m_pRubyText(0)
+ , m_pRubyStyle(0)
+ , m_pRubyAdjust(0)
+ , m_pRubyIsAbove(0)
+ , m_FrameDepend(this, &rFmt)
+ , m_pFrameFmt(&rFmt)
+ , m_ePortionType(PORTION_FRAME)
+ , m_bIsCollapsed(false)
+{
+ init(*this, pPortionCrsr);
+}
+
+/* -----------------------------19.02.01 10:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ SwTxtRuby const& rAttr,
+ uno::Reference< text::XText > const& xParent,
+ sal_Bool bIsEnd )
+ : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ , m_pPropSet(aSwMapProvider.GetPropertySet(
+ PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
+ , m_xParentText(xParent)
+ , m_pRubyText ( bIsEnd ? 0 : new uno::Any )
+ , m_pRubyStyle ( bIsEnd ? 0 : new uno::Any )
+ , m_pRubyAdjust ( bIsEnd ? 0 : new uno::Any )
+ , m_pRubyIsAbove( bIsEnd ? 0 : new uno::Any )
+ , m_FrameDepend(this, 0)
+ , m_pFrameFmt(0)
+ , m_ePortionType( bIsEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
+ , m_bIsCollapsed(false)
+{
+ init(*this, pPortionCrsr);
+
+ if (!bIsEnd)
+ {
+ const SfxPoolItem& rItem = rAttr.GetAttr();
+ rItem.QueryValue(*m_pRubyText, MID_RUBY_TEXT);
+ rItem.QueryValue(*m_pRubyStyle, MID_RUBY_CHARSTYLE);
+ rItem.QueryValue(*m_pRubyAdjust, MID_RUBY_ADJUST);
+ rItem.QueryValue(*m_pRubyIsAbove, MID_RUBY_ABOVE);
+ }
+}
+
+/*-- 11.12.98 09:56:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortion::~SwXTextPortion()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ delete pUnoCrsr;
+}
+/*-- 11.12.98 09:56:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SwXTextPortion::getText()
+throw( uno::RuntimeException )
+{
+ return m_xParentText;
+}
+/*-- 11.12.98 09:56:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextPortion::getStart()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ SwPaM aPam(*pUnoCrsr->Start());
+ uno::Reference< text::XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ return xRet;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextPortion::getEnd()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ SwPaM aPam(*pUnoCrsr->End());
+ uno::Reference< text::XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ return xRet;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextPortion::getString()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString aTxt;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ // TextPortions are always within a paragraph
+ SwTxtNode* pTxtNd = pUnoCrsr->GetNode()->GetTxtNode();
+ if ( pTxtNd )
+ {
+ xub_StrLen nStt = pUnoCrsr->Start()->nContent.GetIndex();
+ aTxt = pTxtNd->GetExpandTxt( nStt,
+ pUnoCrsr->End()->nContent.GetIndex() - nStt );
+ }
+ return aTxt;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ SwUnoCursorHelper::SetString(*pUnoCrsr, aString);
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ //! PropertySetInfo for text portion extensions
+ static uno::Reference< beans::XPropertySetInfo >
+ xTxtPorExtRef = aSwMapProvider.GetPropertySet(
+ PROPERTY_MAP_TEXTPORTION_EXTENSIONS)->getPropertySetInfo();
+ //! PropertySetInfo for redline portions
+ static uno::Reference< beans::XPropertySetInfo >
+ xRedlPorRef = aSwMapProvider.GetPropertySet(
+ PROPERTY_MAP_REDLINE_PORTION)->getPropertySetInfo();
+
+ return (PORTION_REDLINE_START == m_ePortionType ||
+ PORTION_REDLINE_END == m_ePortionType) ? xRedlPorRef : xTxtPorExtRef;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ SwUnoCursorHelper::SetPropertyValue(*pUnoCrsr, *m_pPropSet,
+ rPropertyName, aValue);
+}
+/*-- 04.11.03 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::GetPropertyValue(
+ uno::Any &rVal,
+ const SfxItemPropertySimpleEntry& rEntry,
+ SwUnoCrsr *pUnoCrsr,
+ SfxItemSet *&pSet )
+{
+ DBG_ASSERT( pUnoCrsr, "UNO cursor missing" );
+ if (!pUnoCrsr)
+ return;
+ if(pUnoCrsr)
+ {
+ switch(rEntry.nWID)
+ {
+ case FN_UNO_TEXT_PORTION_TYPE:
+ {
+ const char* pRet;
+ switch (m_ePortionType)
+ {
+ case PORTION_TEXT: pRet = "Text";break;
+ case PORTION_FIELD: pRet = "TextField";break;
+ case PORTION_FRAME: pRet = "Frame";break;
+ case PORTION_FOOTNOTE: pRet = "Footnote";break;
+ case PORTION_REFMARK_START:
+ case PORTION_REFMARK_END: pRet = SW_PROP_NAME_STR(UNO_NAME_REFERENCE_MARK);break;
+ case PORTION_TOXMARK_START:
+ case PORTION_TOXMARK_END: pRet = SW_PROP_NAME_STR(UNO_NAME_DOCUMENT_INDEX_MARK);break;
+ case PORTION_BOOKMARK_START :
+ case PORTION_BOOKMARK_END : pRet = SW_PROP_NAME_STR(UNO_NAME_BOOKMARK);break;
+ case PORTION_REDLINE_START:
+ case PORTION_REDLINE_END: pRet = "Redline";break;
+ case PORTION_RUBY_START:
+ case PORTION_RUBY_END: pRet = "Ruby";break;
+ case PORTION_SOFT_PAGEBREAK:pRet = "SoftPageBreak";break;
+ case PORTION_META: pRet = SW_PROP_NAME_STR(UNO_NAME_META); break;
+ case PORTION_FIELD_START:pRet = "TextFieldStart";break;
+ case PORTION_FIELD_END:pRet = "TextFieldEnd";break;
+ case PORTION_FIELD_START_END:pRet = "TextFieldStartEnd";break;
+ default:
+ pRet = 0;
+ }
+
+ OUString sRet;
+ if( pRet )
+ sRet = C2U( pRet );
+ rVal <<= sRet;
+ }
+ break;
+ case FN_UNO_CONTROL_CHARACTER: // obsolete!
+ break;
+ case FN_UNO_DOCUMENT_INDEX_MARK:
+ rVal <<= m_xTOXMark;
+ break;
+ case FN_UNO_REFERENCE_MARK:
+ rVal <<= m_xRefMark;
+ break;
+ case FN_UNO_BOOKMARK:
+ rVal <<= m_xBookmark;
+ break;
+ case FN_UNO_FOOTNOTE:
+ rVal <<= m_xFootnote;
+ break;
+ case FN_UNO_TEXT_FIELD:
+ rVal <<= m_xTextField;
+ break;
+ case FN_UNO_META:
+ rVal <<= m_xMeta;
+ break;
+ case FN_UNO_IS_COLLAPSED:
+ {
+ switch (m_ePortionType)
+ {
+ case PORTION_REFMARK_START:
+ case PORTION_BOOKMARK_START :
+ case PORTION_TOXMARK_START:
+ case PORTION_REFMARK_END:
+ case PORTION_TOXMARK_END:
+ case PORTION_BOOKMARK_END :
+ case PORTION_REDLINE_START :
+ case PORTION_REDLINE_END :
+ case PORTION_RUBY_START:
+ case PORTION_RUBY_END:
+ case PORTION_FIELD_START:
+ case PORTION_FIELD_END:
+ rVal.setValue(&m_bIsCollapsed, ::getBooleanCppuType());
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case FN_UNO_IS_START:
+ {
+ BOOL bStart = TRUE, bPut = TRUE;
+ switch (m_ePortionType)
+ {
+ case PORTION_REFMARK_START:
+ case PORTION_BOOKMARK_START:
+ case PORTION_TOXMARK_START:
+ case PORTION_REDLINE_START:
+ case PORTION_RUBY_START:
+ case PORTION_FIELD_START:
+ break;
+
+ case PORTION_REFMARK_END:
+ case PORTION_TOXMARK_END:
+ case PORTION_BOOKMARK_END:
+ case PORTION_REDLINE_END:
+ case PORTION_RUBY_END:
+ case PORTION_FIELD_END:
+ bStart = FALSE;
+ break;
+ default:
+ bPut = FALSE;
+ }
+ if(bPut)
+ rVal.setValue(&bStart, ::getBooleanCppuType());
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ {
+ const uno::Any* pToSet = 0;
+ switch(rEntry.nMemberId)
+ {
+ case MID_RUBY_TEXT : pToSet = m_pRubyText.get(); break;
+ case MID_RUBY_ADJUST : pToSet = m_pRubyAdjust.get(); break;
+ case MID_RUBY_CHARSTYLE:pToSet = m_pRubyStyle.get(); break;
+ case MID_RUBY_ABOVE : pToSet = m_pRubyIsAbove.get();break;
+ }
+ if(pToSet)
+ rVal = *pToSet;
+ }
+ break;
+ default:
+ beans::PropertyState eTemp;
+ BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue(
+ rEntry, *pUnoCrsr, &(rVal), eTemp );
+ if(!bDone)
+ {
+ if(!pSet)
+ {
+ pSet = new SfxItemSet(pUnoCrsr->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ 0L);
+ SwUnoCursorHelper::GetCrsrAttr(*pUnoCrsr, *pSet);
+ }
+ m_pPropSet->getPropertyValue(rEntry, *pSet, rVal);
+ }
+ }
+ }
+}
+
+
+uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ sal_Int32 nLength = rPropertyNames.getLength();
+ const OUString *pPropertyNames = rPropertyNames.getConstArray();
+ uno::Sequence< uno::Any > aValues(rPropertyNames.getLength());
+ uno::Any *pValues = aValues.getArray();
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ {
+ SfxItemSet *pSet = 0;
+ // get startting pount fo the look-up, either the provided one or else
+ // from the beginning of the map
+ const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
+ for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pPropertyNames[nProp]);
+ if(pEntry)
+ {
+ GetPropertyValue( pValues[nProp], *pEntry, pUnoCrsr, pSet );
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ delete pSet;
+ }
+ return aValues;
+}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextPortion::getPropertyValue(
+ const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< ::rtl::OUString > aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ return GetPropertyValues_Impl(aPropertyNames).getConstArray()[0];
+}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ {
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ const uno::Any* pValues = rValues.getConstArray();
+ const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pPropertyNames[nProp]);
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwUnoCursorHelper::SetPropertyValue( *pUnoCrsr, *m_pPropSet,
+ pPropertyNames[nProp], pValues[nProp]);
+ }
+ }
+}
+
+void SwXTextPortion::setPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw(beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // workaround for bad designed API
+ try
+ {
+ SetPropertyValues_Impl( rPropertyNames, rValues );
+ }
+ catch (beans::UnknownPropertyException &rException)
+ {
+ // wrap the original (here not allowed) exception in
+ // a lang::WrappedTargetException that gets thrown instead.
+ lang::WrappedTargetException aWExc;
+ aWExc.TargetException <<= rException;
+ throw aWExc;
+ }
+}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXTextPortion::getPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames )
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< uno::Any > aValues;
+
+ // workaround for bad designed API
+ try
+ {
+ aValues = GetPropertyValues_Impl( rPropertyNames );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property exception caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "WrappedTargetException caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ return aValues;
+}
+/* -----------------------------29.09.03 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+/* disabled for #i46921# */
+
+uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyValuesTolerant(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (rPropertyNames.getLength() != rValues.getLength())
+ throw lang::IllegalArgumentException();
+ SwUnoCrsr* pUnoCrsr = this->GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ sal_Int32 nProps = rPropertyNames.getLength();
+ const OUString *pProp = rPropertyNames.getConstArray();
+
+ //sal_Int32 nVals = rValues.getLength();
+ const uno::Any *pValue = rValues.getConstArray();
+
+ sal_Int32 nFailed = 0;
+ uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps );
+ beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray();
+
+ const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap();
+
+ OUString sTmp;
+ for (sal_Int32 i = 0; i < nProps; ++i)
+ {
+ try
+ {
+ pFailed[ nFailed ].Name = pProp[i];
+
+ const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] );
+ if (!pEntry)
+ pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ else
+ {
+ // set property value
+ // (compare to SwXTextPortion::setPropertyValues)
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
+ else
+ {
+ SwUnoCursorHelper::SetPropertyValue(
+ *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] );
+ }
+ }
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ // should not occur because property was searched for before
+ DBG_ERROR( "unexpected exception catched" );
+ pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
+ }
+ catch (beans::PropertyVetoException &)
+ {
+ pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
+ }
+ }
+
+ aFailed.realloc( nFailed );
+ return aFailed;
+}
+
+
+uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SwXTextPortion::getPropertyValuesTolerant(
+ const uno::Sequence< OUString >& rPropertyNames )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes(
+ GetPropertyValuesTolerant_Impl( rPropertyNames, sal_False ) );
+ const beans::GetDirectPropertyTolerantResult *pTmpRes = aTmpRes.getConstArray();
+
+ // copy temporary result to final result type
+ sal_Int32 nLen = aTmpRes.getLength();
+ uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen );
+ beans::GetPropertyTolerantResult *pRes = aRes.getArray();
+ for (sal_Int32 i = 0; i < nLen; i++)
+ *pRes++ = *pTmpRes++;
+ return aRes;
+}
+
+
+uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::getDirectPropertyValuesTolerant(
+ const uno::Sequence< OUString >& rPropertyNames )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return GetPropertyValuesTolerant_Impl( rPropertyNames, sal_True );
+}
+
+
+uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::GetPropertyValuesTolerant_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ sal_Bool bDirectValuesOnly )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr* pUnoCrsr = this->GetCursor();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ sal_Int32 nProps = rPropertyNames.getLength();
+ const OUString *pProp = rPropertyNames.getConstArray();
+
+ SfxItemSet *pSet = 0;
+
+ const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap();
+
+ uno::Sequence< beans::PropertyState > aPropertyStates =
+ SwUnoCursorHelper::GetPropertyStates(
+ *pUnoCrsr, *m_pPropSet,
+ rPropertyNames,
+ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT );
+ const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray();
+
+ std::vector< beans::GetDirectPropertyTolerantResult > aResultVector;
+ for (sal_Int32 i = 0; i < nProps; ++i)
+ {
+ beans::GetDirectPropertyTolerantResult aResult;
+ try
+ {
+ aResult.Name = pProp[i];
+ if(pPropertyStates[i] == beans::PropertyState_MAKE_FIXED_SIZE) // property unknown?
+ {
+ if( bDirectValuesOnly )
+ continue;
+ else
+ aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ else
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] );
+ aResult.State = pPropertyStates[i];
+
+ aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
+ //#i104499# ruby portion attributes need special handling:
+ if( pEntry->nWID == RES_TXTATR_CJK_RUBY &&
+ m_ePortionType == PORTION_RUBY_START )
+ {
+ aResult.State = beans::PropertyState_DIRECT_VALUE;
+ }
+ if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == aResult.State)
+ {
+ // get property value
+ // (compare to SwXTextPortion::getPropertyValue(s))
+ GetPropertyValue( aResult.Value, *pEntry, pUnoCrsr, pSet );
+ aResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
+ aResultVector.push_back( aResult );
+ }
+ }
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ // should not occur because property was searched for before
+ DBG_ERROR( "unexpected exception catched" );
+ aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ aResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
+ }
+ catch (beans::PropertyVetoException &)
+ {
+ aResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ aResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
+ }
+ }
+ delete pSet;
+
+ uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( aResultVector.size() );
+ std::vector< beans::GetDirectPropertyTolerantResult >::const_iterator aIt = aResultVector.begin();
+ beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray();
+ for( sal_Int32 nResult = 0; nResult < aResult.getLength(); ++nResult )
+ {
+ pResult[nResult] = *aIt;
+ ++aIt;
+ }
+
+ return aResult;
+}
+
+
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::addPropertiesChangeListener(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::firePropertiesChangeEvent(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::addPropertyChangeListener(
+ const OUString& /*PropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 09:56:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 08.03.99 09:41:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ if (GetTextPortionType() == PORTION_RUBY_START &&
+ !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
+ {
+ eRet = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ eRet = SwUnoCursorHelper::GetPropertyState(*pUnoCrsr, *m_pPropSet,
+ rPropertyName);
+ }
+ return eRet;
+}
+/*-- 08.03.99 09:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates(
+ const uno::Sequence< OUString >& rPropertyNames)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ uno::Sequence< beans::PropertyState > aRet =
+ SwUnoCursorHelper::GetPropertyStates(*pUnoCrsr, *m_pPropSet,
+ rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION);
+
+ if(GetTextPortionType() == PORTION_RUBY_START)
+ {
+ const OUString* pNames = rPropertyNames.getConstArray();
+ beans::PropertyState* pStates = aRet.getArray();
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength();nProp++)
+ {
+ if(!pNames[nProp].compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
+ pStates[nProp] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ return aRet;
+}
+/*-- 08.03.99 09:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ SwUnoCursorHelper::SetPropertyToDefault(
+ *pUnoCrsr, *m_pPropSet, rPropertyName);
+}
+/*-- 08.03.99 09:41:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ aRet = SwUnoCursorHelper::GetPropertyDefault(*pUnoCrsr, *m_pPropSet,
+ rPropertyName);
+ return aRet;
+}
+
+/*-- 11.12.98 09:56:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::attach(const uno::Reference< text::XTextRange > & /*xTextRange*/)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ // SwXTextPortion cannot be created at the factory therefore
+ // they cannot be attached
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 09:57:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextPortion::getAnchor()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > aRet;
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ aRet = new SwXTextRange(*pUnoCrsr, m_xParentText);
+ return aRet;
+}
+/*-- 11.12.98 09:57:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::dispose()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ setString(aEmptyStr);
+ pUnoCrsr->Remove(this);
+}
+/*-- 11.12.98 09:57:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+
+ m_ListenerContainer.AddListener(aListener);
+}
+/*-- 11.12.98 09:57:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (!GetRegisteredIn() || !m_ListenerContainer.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/* -----------------24.03.99 13:30-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXTextPortion::createContentEnumeration(const OUString& /*aServiceName*/)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ uno::Reference< container::XEnumeration > xRet =
+ new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_CHAR,
+ m_pFrameFmt);
+ return xRet;
+
+}
+/* -----------------------------04.07.01 08:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------04.07.01 08:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/* -----------------24.03.99 13:30-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+/* -----------------25.03.99 10:30-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextPortion::getImplementationName()
+throw( uno::RuntimeException )
+{
+ return C2U("SwXTextPortion");
+}
+/* -----------------25.03.99 10:30-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ sal_Bool bRet = sal_False;
+ if(!rServiceName.compareToAscii("com.sun.star.text.TextPortion") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex"))
+ {
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if (!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ uno::Sequence< OUString > aRet(7);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextPortion");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+/*-- 11.12.98 09:57:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if (!m_FrameDepend.GetRegisteredIn())
+ {
+ m_pFrameFmt = 0;
+ }
+}
+
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
new file mode 100644
index 000000000000..bb184fd9b879
--- /dev/null
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -0,0 +1,1226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+#include <unoport.hxx>
+#include <IMark.hxx>
+// --> OD 2007-10-23 #i81002#
+#include <crossrefbookmark.hxx>
+// <--
+#include <doc.hxx>
+#include <txatbase.hxx>
+#include <txtatr.hxx>
+#include <ndhints.hxx>
+#include <ndtxt.hxx>
+#include <unocrsr.hxx>
+#include <docary.hxx>
+#include <tox.hxx>
+#include <unomid.h>
+#include <unoparaframeenum.hxx>
+#include <unocrsrhelper.hxx>
+#include <unorefmark.hxx>
+#include <unobookmark.hxx>
+#include <unoredline.hxx>
+#include <unofield.hxx>
+#include <unometa.hxx>
+#include <fmtmeta.hxx>
+#include <fmtanchr.hxx>
+#include <fmtrfmrk.hxx>
+#include <frmfmt.hxx>
+#include <unoidx.hxx>
+#include <redline.hxx>
+#include <crsskip.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <set>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/bind.hpp>
+#include <algorithm>
+#include <stack>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using ::rtl::OUString;
+using namespace ::std;
+
+typedef ::std::pair< TextRangeList_t * const, SwTxtAttr const * const > PortionList_t;
+typedef ::std::stack< PortionList_t > PortionStack_t;
+
+static void lcl_CreatePortions(
+ TextRangeList_t & i_rPortions,
+ uno::Reference< text::XText > const& i_xParentText,
+ SwUnoCrsr* pUnoCrsr,
+ FrameDependSortList_t & i_rFrames,
+ const sal_Int32 i_nStartPos, const sal_Int32 i_nEndPos );
+
+
+namespace
+{
+ static const BYTE BKM_TYPE_START = 0;
+ static const BYTE BKM_TYPE_END = 1;
+ static const BYTE BKM_TYPE_START_END = 2;
+
+ struct SwXBookmarkPortion_Impl
+ {
+ Reference<XTextContent> xBookmark;
+ BYTE nBkmType;
+ const SwPosition aPosition;
+
+ SwXBookmarkPortion_Impl(uno::Reference<text::XTextContent> const& xMark,
+ const BYTE nType, SwPosition const& rPosition)
+ : xBookmark ( xMark )
+ , nBkmType ( nType )
+ , aPosition ( rPosition )
+ {
+ }
+ ULONG getIndex ()
+ {
+ return aPosition.nContent.GetIndex();
+ }
+ };
+ typedef boost::shared_ptr < SwXBookmarkPortion_Impl > SwXBookmarkPortion_ImplSharedPtr;
+ struct BookmarkCompareStruct
+ {
+ bool operator () ( const SwXBookmarkPortion_ImplSharedPtr &r1,
+ const SwXBookmarkPortion_ImplSharedPtr &r2 )
+ {
+ // #i16896# for bookmark portions at the same position, the start should
+ // always precede the end. Hence compare positions, and use bookmark type
+ // as tie-breaker for same position.
+ // return ( r1->nIndex == r2->nIndex )
+ // ? ( r1->nBkmType < r2->nBkmType )
+ // : ( r1->nIndex < r2->nIndex );
+
+ // MTG: 25/11/05: Note that the above code does not correctly handle
+ // the case when one bookmark ends, and another begins in the same
+ // position. When this occurs, the above code will return the
+ // the start of the 2nd bookmark BEFORE the end of the first bookmark
+ // See bug #i58438# for more details. The below code is correct and
+ // fixes both #i58438 and #i16896#
+ return r1->aPosition < r2->aPosition;
+ }
+ };
+ typedef std::multiset < SwXBookmarkPortion_ImplSharedPtr, BookmarkCompareStruct > SwXBookmarkPortion_ImplList;
+
+
+ static void lcl_FillBookmarkArray(SwDoc& rDoc, SwUnoCrsr& rUnoCrsr, SwXBookmarkPortion_ImplList& rBkmArr)
+ {
+ IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess();
+ if(!pMarkAccess->getBookmarksCount())
+ return;
+
+ // no need to consider marks starting after aEndOfPara
+ SwPosition aEndOfPara(*rUnoCrsr.GetPoint());
+ aEndOfPara.nContent = aEndOfPara.nNode.GetNode().GetTxtNode()->Len();
+ const IDocumentMarkAccess::const_iterator_t pCandidatesEnd = upper_bound(
+ pMarkAccess->getBookmarksBegin(),
+ pMarkAccess->getBookmarksEnd(),
+ aEndOfPara,
+ bind(&::sw::mark::IMark::StartsAfter, _2, _1)); // finds the first that starts after
+
+ // search for all bookmarks that start or end in this paragraph
+ const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode;
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
+ ppMark != pCandidatesEnd;
+ ++ppMark)
+ {
+ ::sw::mark::IMark* const pBkmk = ppMark->get();
+ bool hasOther = pBkmk->IsExpanded();
+
+ const SwPosition& rStartPos = pBkmk->GetMarkStart();
+ if(rStartPos.nNode == nOwnNode)
+ {
+ const BYTE nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END;
+ rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr(
+ new SwXBookmarkPortion_Impl(
+ SwXBookmark::CreateXBookmark(rDoc, *pBkmk),
+ nType, rStartPos)));
+ }
+
+ const SwPosition& rEndPos = pBkmk->GetMarkEnd();
+ if(rEndPos.nNode == nOwnNode)
+ {
+ auto_ptr<SwPosition> pCrossRefEndPos;
+ const SwPosition* pEndPos = NULL;
+ if(hasOther)
+ pEndPos = &rEndPos;
+ else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk))
+ {
+ // Crossrefbookmarks only remember the start position but have to span the whole paragraph
+ pCrossRefEndPos = auto_ptr<SwPosition>(new SwPosition(rEndPos));
+ pCrossRefEndPos->nContent = pCrossRefEndPos->nNode.GetNode().GetTxtNode()->Len();
+ pEndPos = pCrossRefEndPos.get();
+ }
+ if(pEndPos)
+ {
+ rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr(
+ new SwXBookmarkPortion_Impl(
+ SwXBookmark::CreateXBookmark(rDoc, *pBkmk),
+ BKM_TYPE_END, *pEndPos)));
+ }
+ }
+ }
+ }
+}
+
+
+/******************************************************************
+ * SwXTextPortionEnumeration
+ ******************************************************************/
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextPortionEnumeration::getImplementationName()
+throw( RuntimeException )
+{
+ return C2U("SwXTextPortionEnumeration");
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool
+SwXTextPortionEnumeration::supportsService(const OUString& rServiceName)
+throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextPortionEnumeration") == rServiceName;
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextPortionEnumeration::getSupportedServiceNames()
+throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextPortionEnumeration");
+ return aRet;
+}
+
+/*-- 27.01.99 10:44:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortionEnumeration::SwXTextPortionEnumeration(
+ SwPaM& rParaCrsr,
+ uno::Reference< XText > const & xParentText,
+ const sal_Int32 nStart,
+ const sal_Int32 nEnd )
+ : m_Portions()
+{
+ SwUnoCrsr* pUnoCrsr =
+ rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), sal_False);
+ pUnoCrsr->Add(this);
+
+ DBG_ASSERT(nEnd == -1 || (nStart <= nEnd &&
+ nEnd <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().Len()),
+ "start or end value invalid!");
+
+ // find all frames, graphics and OLEs that are bound AT character in para
+ FrameDependSortList_t frames;
+ ::CollectFrameAtNode(*this, pUnoCrsr->GetPoint()->nNode, frames, true);
+ lcl_CreatePortions(m_Portions, xParentText, pUnoCrsr, frames, nStart, nEnd);
+}
+
+SwXTextPortionEnumeration::SwXTextPortionEnumeration(
+ SwPaM& rParaCrsr,
+ TextRangeList_t const & rPortions )
+ : m_Portions( rPortions )
+{
+ SwUnoCrsr* const pUnoCrsr =
+ rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), sal_False);
+ pUnoCrsr->Add(this);
+}
+
+/*-- 27.01.99 10:44:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ delete pUnoCrsr;
+}
+/*-- 27.01.99 10:44:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextPortionEnumeration::hasMoreElements()
+throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return (m_Portions.size() > 0) ? sal_True : sal_False;
+}
+/*-- 27.01.99 10:44:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextPortionEnumeration::nextElement()
+throw( container::NoSuchElementException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_Portions.size())
+ throw container::NoSuchElementException();
+
+ Any any;
+ any <<= m_Portions.front();
+ m_Portions.pop_front();
+ return any;
+}
+
+//======================================================================
+
+typedef ::std::deque< xub_StrLen > FieldMarks_t;
+
+static void
+lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr,
+ const sal_Int32 i_nStartPos)
+{
+ const SwTxtNode * const pTxtNode =
+ rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
+ if (!pTxtNode) return;
+
+ const sal_Unicode fld[] = {
+ CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, CH_TXT_ATR_FORMELEMENT, 0 };
+ xub_StrLen pos = ::std::max(static_cast<const sal_Int32>(0), i_nStartPos);
+ while ((pos = pTxtNode->GetTxt().SearchChar(fld, pos)) != STRING_NOTFOUND)
+ {
+ rFieldMarks.push_back(pos);
+ ++pos;
+ }
+}
+
+static uno::Reference<text::XTextRange>
+lcl_ExportFieldMark(
+ uno::Reference< text::XText > const & i_xParentText,
+ SwUnoCrsr * const pUnoCrsr,
+ const SwTxtNode * const pTxtNode )
+{
+ uno::Reference<text::XTextRange> xRef;
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ //flr: maybe its a good idea to add a special hint to the hints array and rely on the hint segmentation....
+ const xub_StrLen start = pUnoCrsr->Start()->nContent.GetIndex();
+ ASSERT(pUnoCrsr->End()->nContent.GetIndex() == start,
+ "hmm --- why is this different");
+
+ pUnoCrsr->Right(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ if ( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+ {
+ ASSERT(false, "cannot move cursor?");
+ return 0;
+ }
+
+ const sal_Unicode Char = pTxtNode->GetTxt().GetChar(start);
+ if (CH_TXT_ATR_FIELDSTART == Char)
+ {
+ ::sw::mark::IFieldmark* pFieldmark = NULL;
+ if (pDoc)
+ {
+ pFieldmark = pDoc->getIDocumentMarkAccess()->
+ getFieldmarkFor(*pUnoCrsr->GetMark());
+ }
+ SwXTextPortion* pPortion = new SwXTextPortion(
+ pUnoCrsr, i_xParentText, PORTION_FIELD_START);
+ xRef = pPortion;
+ if (pPortion && pFieldmark && pDoc)
+ pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+ }
+ else if (CH_TXT_ATR_FIELDEND == Char)
+ {
+ ::sw::mark::IFieldmark* pFieldmark = NULL;
+ if (pDoc)
+ {
+ pFieldmark = pDoc->getIDocumentMarkAccess()->
+ getFieldmarkFor(*pUnoCrsr->GetMark());
+ }
+ SwXTextPortion* pPortion = new SwXTextPortion(
+ pUnoCrsr, i_xParentText, PORTION_FIELD_END);
+ xRef = pPortion;
+ if (pPortion && pFieldmark && pDoc)
+ pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+ }
+ else if (CH_TXT_ATR_FORMELEMENT == Char)
+ {
+ ::sw::mark::IFieldmark* pFieldmark = NULL;
+ if (pDoc)
+ {
+ pFieldmark = pDoc->getIDocumentMarkAccess()->
+ getFieldmarkFor(*pUnoCrsr->GetMark());
+ }
+ SwXTextPortion* pPortion = new SwXTextPortion(
+ pUnoCrsr, i_xParentText, PORTION_FIELD_START_END);
+ xRef = pPortion;
+ if (pPortion && pFieldmark && pDoc)
+ pPortion->SetBookmark(new SwXFieldmark(true, pFieldmark, pDoc));
+ }
+ else
+ {
+ ASSERT(false, "no fieldmark found?");
+ }
+ return xRef;
+}
+
+/* -----------------------------31.08.00 14:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static Reference<XTextRange>
+lcl_CreateRefMarkPortion(
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ const SwTxtAttr & rAttr, const bool bEnd)
+{
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SwFmtRefMark& rRefMark =
+ static_cast<const SwFmtRefMark&>(rAttr.GetAttr());
+ Reference<XTextContent> xContent;
+ if (!xContent.is())
+ {
+ xContent = new SwXReferenceMark(pDoc, &rRefMark);
+ }
+
+ SwXTextPortion* pPortion = 0;
+ if (!bEnd)
+ {
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_REFMARK_START);
+ pPortion->SetRefMark(xContent);
+ pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
+ }
+ else
+ {
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_REFMARK_END);
+ pPortion->SetRefMark(xContent);
+ }
+ return pPortion;
+}
+
+//-----------------------------------------------------------------------------
+static void
+lcl_InsertRubyPortion(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ const SwTxtAttr & rAttr, const sal_Bool bEnd)
+{
+ SwXTextPortion* pPortion = new SwXTextPortion(pUnoCrsr,
+ static_cast<const SwTxtRuby&>(rAttr), xParent, bEnd);
+ rPortions.push_back(pPortion);
+ pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
+}
+
+//-----------------------------------------------------------------------------
+static Reference<XTextRange>
+lcl_CreateTOXMarkPortion(
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwTxtAttr & rAttr, const bool bEnd)
+{
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ SwTOXMark & rTOXMark = static_cast<SwTOXMark&>(rAttr.GetAttr());
+
+ const Reference<XTextContent> xContent(
+ SwXDocumentIndexMark::CreateXDocumentIndexMark(*pDoc,
+ *const_cast<SwTOXType*>(rTOXMark.GetTOXType()), rTOXMark),
+ uno::UNO_QUERY);
+
+ SwXTextPortion* pPortion = 0;
+ if (!bEnd)
+ {
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_TOXMARK_START);
+ pPortion->SetTOXMark(xContent);
+ pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
+ }
+ else
+ {
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_TOXMARK_END);
+ pPortion->SetTOXMark(xContent);
+ }
+ return pPortion;
+}
+
+//-----------------------------------------------------------------------------
+static uno::Reference<text::XTextRange>
+lcl_CreateMetaPortion(
+ uno::Reference<text::XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwTxtAttr & rAttr, ::std::auto_ptr<TextRangeList_t const> & pPortions)
+{
+ const uno::Reference<rdf::XMetadatable> xMeta( SwXMeta::CreateXMeta(
+ *static_cast<SwFmtMeta &>(rAttr.GetAttr()).GetMeta(),
+ xParent, pPortions));
+ SwXTextPortion * pPortion(0);
+ if (RES_TXTATR_META == rAttr.Which())
+ {
+ const uno::Reference<text::XTextContent> xContent(xMeta,
+ uno::UNO_QUERY);
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_META);
+ pPortion->SetMeta(xContent);
+ }
+ else
+ {
+ const uno::Reference<text::XTextField> xField(xMeta, uno::UNO_QUERY);
+ pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD);
+ pPortion->SetTextField(xField);
+ }
+ return pPortion;
+}
+
+//-----------------------------------------------------------------------------
+static void
+lcl_ExportBookmark(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwXBookmarkPortion_ImplList& rBkmArr, const ULONG nIndex)
+{
+ for ( SwXBookmarkPortion_ImplList::iterator aIter = rBkmArr.begin(), aEnd = rBkmArr.end();
+ aIter != aEnd; )
+ {
+ SwXBookmarkPortion_ImplSharedPtr pPtr = (*aIter);
+ if ( nIndex > pPtr->getIndex() )
+ {
+ rBkmArr.erase( aIter++ );
+ continue;
+ }
+ if ( nIndex < pPtr->getIndex() )
+ break;
+
+ SwXTextPortion* pPortion = 0;
+ if ((BKM_TYPE_START == pPtr->nBkmType) ||
+ (BKM_TYPE_START_END == pPtr->nBkmType))
+ {
+ pPortion =
+ new SwXTextPortion(pUnoCrsr, xParent, PORTION_BOOKMARK_START);
+ rPortions.push_back(pPortion);
+ pPortion->SetBookmark(pPtr->xBookmark);
+ pPortion->SetCollapsed( (BKM_TYPE_START_END == pPtr->nBkmType)
+ ? true : false);
+
+ }
+ if (BKM_TYPE_END == pPtr->nBkmType)
+ {
+ pPortion =
+ new SwXTextPortion(pUnoCrsr, xParent, PORTION_BOOKMARK_END);
+ rPortions.push_back(pPortion);
+ pPortion->SetBookmark(pPtr->xBookmark);
+ }
+ rBkmArr.erase( aIter++ );
+ }
+}
+
+static void
+lcl_ExportSoftPageBreak(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwSoftPageBreakList& rBreakArr, const ULONG nIndex)
+{
+ for ( SwSoftPageBreakList::iterator aIter = rBreakArr.begin(),
+ aEnd = rBreakArr.end();
+ aIter != aEnd; )
+ {
+ if ( nIndex > *aIter )
+ {
+ rBreakArr.erase( aIter++ );
+ continue;
+ }
+ if ( nIndex < *aIter )
+ break;
+
+ rPortions.push_back(
+ new SwXTextPortion(pUnoCrsr, xParent, PORTION_SOFT_PAGEBREAK) );
+ rBreakArr.erase( aIter++ );
+ }
+}
+
+
+/* -----------------------------18.12.00 14:51--------------------------------
+
+ ---------------------------------------------------------------------------*/
+//-----------------------------------------------------------------------------
+#define REDLINE_PORTION_START_REMOVE 0//removed redlines are visible
+#define REDLINE_PORTION_END_REMOVE 1//removed redlines are visible
+#define REDLINE_PORTION_REMOVE 2//removed redlines are NOT visible
+#define REDLINE_PORTION_INSERT_START 3
+#define REDLINE_PORTION_INSERT_END 4
+
+struct SwXRedlinePortion_Impl
+{
+ const SwRedline* m_pRedline;
+ const bool m_bStart;
+
+ SwXRedlinePortion_Impl ( const SwRedline* pRed, const bool bIsStart )
+ : m_pRedline(pRed)
+ , m_bStart(bIsStart)
+ {
+ }
+
+ ULONG getRealIndex ()
+ {
+ return m_bStart ? m_pRedline->Start()->nContent.GetIndex()
+ : m_pRedline->End() ->nContent.GetIndex();
+ }
+};
+
+typedef boost::shared_ptr < SwXRedlinePortion_Impl >
+ SwXRedlinePortion_ImplSharedPtr;
+
+struct RedlineCompareStruct
+{
+ const SwPosition& getPosition ( const SwXRedlinePortion_ImplSharedPtr &r )
+ {
+ return *(r->m_bStart ? r->m_pRedline->Start() : r->m_pRedline->End());
+ }
+
+ bool operator () ( const SwXRedlinePortion_ImplSharedPtr &r1,
+ const SwXRedlinePortion_ImplSharedPtr &r2 )
+ {
+ return getPosition ( r1 ) < getPosition ( r2 );
+ }
+};
+
+typedef std::multiset < SwXRedlinePortion_ImplSharedPtr, RedlineCompareStruct >
+SwXRedlinePortion_ImplList;
+
+//-----------------------------------------------------------------------------
+static Reference<XTextRange>
+lcl_ExportHints(
+ PortionStack_t & rPortionStack,
+ const Reference<XText> & xParent,
+ SwUnoCrsr * const pUnoCrsr,
+ SwpHints * const pHints,
+ const sal_Int32 i_nStartPos,
+ const sal_Int32 i_nEndPos,
+ const xub_StrLen nCurrentIndex,
+ const bool bRightMoveForbidden,
+ bool & o_rbCursorMoved,
+ sal_Int32 & o_rNextAttrPosition )
+{
+ // if the attribute has a dummy character, then xRef is set (except META)
+ // otherwise, the portion for the attribute is inserted into rPortions!
+ Reference<XTextRange> xRef;
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ //search for special text attributes - first some ends
+ sal_uInt16 nEndIndex = 0;
+ sal_uInt16 nNextEnd = 0;
+ while(nEndIndex < pHints->GetEndCount() &&
+ (!pHints->GetEnd(nEndIndex)->GetEnd() ||
+ nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetEnd()))))
+ {
+ if(pHints->GetEnd(nEndIndex)->GetEnd())
+ {
+ SwTxtAttr * const pAttr = pHints->GetEnd(nEndIndex);
+ if (nNextEnd == nCurrentIndex)
+ {
+ const USHORT nWhich( pAttr->Which() );
+ switch (nWhich)
+ {
+ case RES_TXTATR_TOXMARK:
+ {
+ Reference<XTextRange> xTmp = lcl_CreateTOXMarkPortion(
+ xParent, pUnoCrsr, *pAttr, true);
+ rPortionStack.top().first->push_back(xTmp);
+ }
+ break;
+ case RES_TXTATR_REFMARK:
+ {
+ Reference<XTextRange> xTmp = lcl_CreateRefMarkPortion(
+ xParent, pUnoCrsr, *pAttr, true);
+ rPortionStack.top().first->push_back(xTmp);
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ //#i91534# GetEnd() == 0 mixes the order of ruby start/end
+ if( *pAttr->GetEnd() == *pAttr->GetStart())
+ {
+ lcl_InsertRubyPortion( *rPortionStack.top().first,
+ xParent, pUnoCrsr, *pAttr, sal_False);
+ }
+ lcl_InsertRubyPortion( *rPortionStack.top().first,
+ xParent, pUnoCrsr, *pAttr, sal_True);
+ break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ {
+ ASSERT(*pAttr->GetStart() != *pAttr->GetEnd(),
+ "empty meta?");
+ if ((i_nStartPos > 0) &&
+ (*pAttr->GetStart() < i_nStartPos))
+ {
+ // force skip pAttr and rest of attribute ends
+ // at nCurrentIndex
+ // because they are not contained in the meta pAttr
+ // and the meta pAttr itself is outside selection!
+ // (necessary for SwXMeta::createEnumeration)
+ if (*pAttr->GetStart() + 1 == i_nStartPos)
+ {
+ nEndIndex = pHints->GetEndCount() - 1;
+ }
+ break;
+ }
+ PortionList_t Top = rPortionStack.top();
+ if (Top.second != pAttr)
+ {
+ ASSERT(false, "ExportHints: stack error" );
+ }
+ else
+ {
+ ::std::auto_ptr<const TextRangeList_t>
+ pCurrentPortions(Top.first);
+ rPortionStack.pop();
+ const uno::Reference<text::XTextRange> xPortion(
+ lcl_CreateMetaPortion(xParent, pUnoCrsr,
+ *pAttr, pCurrentPortions));
+ rPortionStack.top().first->push_back(xPortion);
+ }
+ }
+ break;
+ }
+ }
+ }
+ nEndIndex++;
+ }
+
+ // then some starts
+ sal_uInt16 nStartIndex = 0;
+ sal_uInt16 nNextStart = 0;
+ while(nStartIndex < pHints->GetStartCount() &&
+ nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart())))
+ {
+ SwTxtAttr * const pAttr = pHints->GetStart(nStartIndex);
+ USHORT nAttrWhich = pAttr->Which();
+ if (nNextStart == nCurrentIndex)
+ {
+ switch( nAttrWhich )
+ {
+ case RES_TXTATR_FIELD:
+ if(!bRightMoveForbidden)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
+ if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+ break;
+ SwXTextPortion* pPortion;
+ xRef = pPortion = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FIELD);
+ Reference<XTextField> xField =
+ CreateSwXTextField(*pDoc, pAttr->GetFld());
+ pPortion->SetTextField(xField);
+ }
+ break;
+ case RES_TXTATR_FLYCNT :
+ if(!bRightMoveForbidden)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
+ if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+ break; // Robust #i81708 content in covered cells
+ pUnoCrsr->Exchange();
+ xRef = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FRAME);
+ }
+ break;
+ case RES_TXTATR_FTN :
+ {
+ if(!bRightMoveForbidden)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
+ if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+ break;
+ SwXTextPortion* pPortion;
+ xRef = pPortion = new SwXTextPortion(
+ pUnoCrsr, xParent, PORTION_FOOTNOTE);
+ Reference<XFootnote> xContent =
+ SwXFootnotes::GetObject(*pDoc, pAttr->GetFtn());
+ pPortion->SetFootnote(xContent);
+ }
+ }
+ break;
+ case RES_TXTATR_TOXMARK:
+ case RES_TXTATR_REFMARK:
+ {
+ bool bIsPoint = !(pAttr->GetEnd());
+ if (!bRightMoveForbidden || !bIsPoint)
+ {
+ if (bIsPoint)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
+ }
+ Reference<XTextRange> xTmp =
+ (RES_TXTATR_REFMARK == nAttrWhich)
+ ? lcl_CreateRefMarkPortion(
+ xParent, pUnoCrsr, *pAttr, false)
+ : lcl_CreateTOXMarkPortion(
+ xParent, pUnoCrsr, *pAttr, false);
+ if (bIsPoint) // consume CH_TXTATR!
+ {
+ pUnoCrsr->Normalize(FALSE);
+ pUnoCrsr->DeleteMark();
+ xRef = xTmp;
+ }
+ else // just insert it
+ {
+ rPortionStack.top().first->push_back(xTmp);
+ }
+ }
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ //#i91534# GetEnd() == 0 mixes the order of ruby start/end
+ if(pAttr->GetEnd() && (*pAttr->GetEnd() != *pAttr->GetStart()))
+ {
+ lcl_InsertRubyPortion( *rPortionStack.top().first,
+ xParent, pUnoCrsr, *pAttr, sal_False);
+ }
+ break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ if (*pAttr->GetStart() != *pAttr->GetEnd())
+ {
+ if (!bRightMoveForbidden)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,FALSE,FALSE);
+ o_rbCursorMoved = true;
+ // only if the end is included in selection!
+ if ((i_nEndPos < 0) ||
+ (*pAttr->GetEnd() <= i_nEndPos))
+ {
+ rPortionStack.push( ::std::make_pair(
+ new TextRangeList_t, pAttr ));
+ }
+ }
+ }
+ break;
+ case RES_TXTATR_AUTOFMT:
+ case RES_TXTATR_INETFMT:
+ case RES_TXTATR_CHARFMT:
+ break; // these are handled as properties of a "Text" portion
+ default:
+ DBG_ERROR("unknown attribute");
+ break;
+ }
+ }
+ nStartIndex++;
+ }
+
+ if (xRef.is()) // implies that we have moved the cursor
+ {
+ o_rbCursorMoved = true;
+ }
+ if (!o_rbCursorMoved)
+ {
+ // search for attribute changes behind the current cursor position
+ // break up at frames, bookmarks, redlines
+
+ nStartIndex = 0;
+ nNextStart = 0;
+ while(nStartIndex < pHints->GetStartCount() &&
+ nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart())))
+ nStartIndex++;
+
+ nEndIndex = 0;
+ nNextEnd = 0;
+ while(nEndIndex < pHints->GetEndCount() &&
+ nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetAnyEnd())))
+ nEndIndex++;
+
+ sal_Int32 nNextPos =
+ ((nNextStart > nCurrentIndex) && (nNextStart < nNextEnd))
+ ? nNextStart : nNextEnd;
+ if (nNextPos > nCurrentIndex)
+ {
+ o_rNextAttrPosition = nNextPos;
+ }
+ }
+ return xRef;
+}
+
+//-----------------------------------------------------------------------------
+void lcl_MoveCursor( SwUnoCrsr * const pUnoCrsr,
+ const xub_StrLen nCurrentIndex,
+ const sal_Int32 nNextFrameIndex, const sal_Int32 nNextPortionIndex,
+ const sal_Int32 nNextAttrIndex, const sal_Int32 nNextFieldMarkIndex,
+ const sal_Int32 nEndPos )
+{
+ sal_Int32 nMovePos = pUnoCrsr->GetCntntNode()->Len();
+
+ if ((nEndPos >= 0) && (nEndPos < nMovePos))
+ {
+ nMovePos = nEndPos;
+ }
+
+ if ((nNextFrameIndex >= 0) && (nNextFrameIndex < nMovePos))
+ {
+ nMovePos = nNextFrameIndex;
+ }
+
+ if ((nNextPortionIndex >= 0) && (nNextPortionIndex < nMovePos))
+ {
+ nMovePos = nNextPortionIndex;
+ }
+
+ if ((nNextAttrIndex >= 0) && (nNextAttrIndex < nMovePos))
+ {
+ nMovePos = nNextAttrIndex;
+ }
+
+ if ((nNextFieldMarkIndex >= 0) && (nNextFieldMarkIndex < nMovePos))
+ {
+ nMovePos = nNextFieldMarkIndex;
+ }
+
+ if (nMovePos > nCurrentIndex)
+ {
+// pUnoCrsr->Right(nMovePos - nCurrentIndex);
+ pUnoCrsr->GetPoint()->nContent = static_cast<USHORT>(nMovePos);
+ }
+}
+
+//-----------------------------------------------------------------------------
+static void
+lcl_FillRedlineArray(SwDoc const & rDoc, SwUnoCrsr const & rUnoCrsr,
+ SwXRedlinePortion_ImplList& rRedArr )
+{
+ const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
+ USHORT nRedTblCount = rRedTbl.Count();
+
+ if ( nRedTblCount > 0 )
+ {
+ const SwPosition* pStart = rUnoCrsr.GetPoint();
+ const SwNodeIndex nOwnNode = pStart->nNode;
+
+ for(USHORT nRed = 0; nRed < nRedTblCount; nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ const SwPosition* pRedStart = pRedline->Start();
+ const SwNodeIndex nRedNode = pRedStart->nNode;
+ if ( nOwnNode == nRedNode )
+ rRedArr.insert( SwXRedlinePortion_ImplSharedPtr (
+ new SwXRedlinePortion_Impl ( pRedline, true ) ) );
+ if( pRedline->HasMark() && pRedline->End()->nNode == nOwnNode )
+ rRedArr.insert( SwXRedlinePortion_ImplSharedPtr (
+ new SwXRedlinePortion_Impl ( pRedline, false) ) );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+static void
+lcl_FillSoftPageBreakArray(
+ SwUnoCrsr const & rUnoCrsr, SwSoftPageBreakList& rBreakArr )
+{
+ const SwTxtNode *pTxtNode =
+ rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
+ if( pTxtNode )
+ pTxtNode->fillSoftPageBreakList( rBreakArr );
+}
+
+/* -----------------------------19.12.00 12:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static void
+lcl_ExportRedline(
+ TextRangeList_t & rPortions,
+ Reference<XText> const& xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwXRedlinePortion_ImplList& rRedlineArr, const ULONG nIndex)
+{
+
+ // MTG: 23/11/05: We want this loop to iterate over all red lines in this
+ // array. We will only insert the ones with index matches
+ for ( SwXRedlinePortion_ImplList::iterator aIter = rRedlineArr.begin(), aEnd = rRedlineArr.end();
+ aIter != aEnd; )
+ {
+ SwXRedlinePortion_ImplSharedPtr pPtr = (*aIter );
+ ULONG nRealIndex = pPtr->getRealIndex();
+ // MTG: 23/11/05: If there are elements before nIndex, remove them
+ if ( nIndex > nRealIndex )
+ rRedlineArr.erase ( aIter++ );
+ // MTG: 23/11/05: If the elements match, and them to the list
+ else if ( nIndex == nRealIndex )
+ {
+ rPortions.push_back( new SwXRedlinePortion(
+ pPtr->m_pRedline, pUnoCrsr, xParent, pPtr->m_bStart) );
+ rRedlineArr.erase ( aIter++ );
+ }
+ // MTG: 23/11/05: If we've iterated past nIndex, exit the loop
+ else
+ break;
+ }
+}
+
+/* -----------------------------19.12.00 13:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static void
+lcl_ExportBkmAndRedline(
+ TextRangeList_t & rPortions,
+ Reference<XText> const & xParent,
+ const SwUnoCrsr * const pUnoCrsr,
+ SwXBookmarkPortion_ImplList& rBkmArr,
+ SwXRedlinePortion_ImplList& rRedlineArr,
+ SwSoftPageBreakList& rBreakArr,
+ const ULONG nIndex)
+{
+ if (rBkmArr.size())
+ lcl_ExportBookmark(rPortions, xParent, pUnoCrsr, rBkmArr, nIndex);
+
+ if (rRedlineArr.size())
+ lcl_ExportRedline(rPortions, xParent, pUnoCrsr, rRedlineArr, nIndex);
+
+ if (rBreakArr.size())
+ lcl_ExportSoftPageBreak(rPortions, xParent, pUnoCrsr, rBreakArr, nIndex);
+}
+
+//-----------------------------------------------------------------------------
+static sal_Int32
+lcl_ExportFrames(
+ TextRangeList_t & rPortions,
+ Reference<XText> const & i_xParent,
+ SwUnoCrsr * const i_pUnoCrsr,
+ FrameDependSortList_t & i_rFrames,
+ xub_StrLen const i_nCurrentIndex)
+{
+ // find first Frame in (sorted) i_rFrames at current position
+ while (i_rFrames.size() && (i_rFrames.front().nIndex == i_nCurrentIndex))
+ // do not check for i_nEnd here; this is done implicity by lcl_MoveCursor
+ {
+ const SwModify * const pFrame =
+ i_rFrames.front().pFrameDepend->GetRegisteredIn();
+ if (pFrame) // Frame could be disposed
+ {
+ SwXTextPortion* pPortion = new SwXTextPortion(i_pUnoCrsr, i_xParent,
+ *static_cast<SwFrmFmt*>( const_cast<SwModify*>( pFrame ) ) );
+ rPortions.push_back(pPortion);
+ }
+ i_rFrames.pop_front();
+ }
+
+ return i_rFrames.size() ? i_rFrames.front().nIndex : -1;
+}
+
+//-----------------------------------------------------------------------------
+static sal_Int32
+lcl_GetNextIndex(
+ SwXBookmarkPortion_ImplList const & rBkmArr,
+ SwXRedlinePortion_ImplList const & rRedlineArr,
+ SwSoftPageBreakList const & rBreakArr )
+{
+ sal_Int32 nRet = -1;
+ if(rBkmArr.size())
+ {
+ SwXBookmarkPortion_ImplSharedPtr pPtr = (*rBkmArr.begin());
+ nRet = pPtr->getIndex();
+ }
+ if(rRedlineArr.size())
+ {
+ SwXRedlinePortion_ImplSharedPtr pPtr = (*rRedlineArr.begin());
+ sal_Int32 nTmp = pPtr->getRealIndex();
+ if(nRet < 0 || nTmp < nRet)
+ nRet = nTmp;
+ }
+ if(rBreakArr.size())
+ {
+ if(nRet < 0 || *rBreakArr.begin() < static_cast<sal_uInt32>(nRet))
+ nRet = *rBreakArr.begin();
+ }
+ return nRet;
+};
+
+//-----------------------------------------------------------------------------
+static void
+lcl_CreatePortions(
+ TextRangeList_t & i_rPortions,
+ uno::Reference< text::XText > const & i_xParentText,
+ SwUnoCrsr * const pUnoCrsr,
+ FrameDependSortList_t & i_rFrames,
+ const sal_Int32 i_nStartPos,
+ const sal_Int32 i_nEndPos )
+{
+ if (!pUnoCrsr)
+ return;
+
+ // set the start if a selection should be exported
+ if ((i_nStartPos > 0) &&
+ (pUnoCrsr->Start()->nContent.GetIndex() != i_nStartPos))
+ {
+ pUnoCrsr->DeleteMark();
+ DBG_ASSERT(pUnoCrsr->Start()->nNode.GetNode().GetTxtNode() &&
+ (i_nStartPos <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->
+ GetTxt().Len()), "Incorrect start position" );
+ // ??? should this be i_nStartPos - current position ?
+ pUnoCrsr->Right(static_cast<xub_StrLen>(i_nStartPos),
+ CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+
+ FieldMarks_t FieldMarks;
+ SwXBookmarkPortion_ImplList Bookmarks;
+ SwXRedlinePortion_ImplList Redlines;
+ SwSoftPageBreakList SoftPageBreaks;
+
+ SwDoc * const pDoc = pUnoCrsr->GetDoc();
+ lcl_FillFieldMarkArray(FieldMarks, *pUnoCrsr, i_nStartPos);
+ lcl_FillBookmarkArray(*pDoc, *pUnoCrsr, Bookmarks);
+ lcl_FillRedlineArray(*pDoc, *pUnoCrsr, Redlines);
+ lcl_FillSoftPageBreakArray(*pUnoCrsr, SoftPageBreaks);
+
+ PortionStack_t PortionStack;
+ PortionStack.push( PortionList_t(&i_rPortions, 0) );
+
+ bool bAtEnd( false );
+ while (!bAtEnd) // every iteration consumes at least current character!
+ {
+ if (pUnoCrsr->HasMark())
+ {
+ pUnoCrsr->Normalize(FALSE);
+ pUnoCrsr->DeleteMark();
+ }
+
+ SwTxtNode * const pTxtNode = pUnoCrsr->GetNode()->GetTxtNode();
+ if (!pTxtNode)
+ {
+ DBG_ERROR("lcl_CreatePortions: no TextNode - what now ?");
+ return;
+ }
+
+ SwpHints * const pHints = pTxtNode->GetpSwpHints();
+ const xub_StrLen nCurrentIndex =
+ pUnoCrsr->GetPoint()->nContent.GetIndex();
+ // this contains the portion which consumes the character in the
+ // text at nCurrentIndex; i.e. it must be set _once_ per iteration
+ uno::Reference< XTextRange > xRef;
+
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, true); // set mark
+
+ const sal_Int32 nFirstFrameIndex =
+ lcl_ExportFrames( *PortionStack.top().first,
+ i_xParentText, pUnoCrsr, i_rFrames, nCurrentIndex);
+
+ lcl_ExportBkmAndRedline( *PortionStack.top().first, i_xParentText,
+ pUnoCrsr, Bookmarks, Redlines, SoftPageBreaks, nCurrentIndex );
+
+ bool bCursorMoved( false );
+ sal_Int32 nNextAttrIndex = -1;
+ // #111716# the cursor must not move right at the
+ // end position of a selection!
+ bAtEnd = ((i_nEndPos >= 0) && (nCurrentIndex >= i_nEndPos))
+ || (nCurrentIndex >= pTxtNode->Len());
+ if (pHints)
+ {
+ // N.B.: side-effects nNextAttrIndex, bCursorMoved; may move cursor
+ xRef = lcl_ExportHints(PortionStack, i_xParentText, pUnoCrsr,
+ pHints, i_nStartPos, i_nEndPos, nCurrentIndex, bAtEnd,
+ bCursorMoved, nNextAttrIndex);
+ if (PortionStack.empty())
+ {
+ ASSERT(false, "CreatePortions: stack underflow");
+ return;
+ }
+ }
+
+ if (!xRef.is() && !bCursorMoved)
+ {
+ if (!bAtEnd &&
+ FieldMarks.size() && (FieldMarks.front() == nCurrentIndex))
+ {
+ // moves cursor
+ xRef = lcl_ExportFieldMark(i_xParentText, pUnoCrsr, pTxtNode);
+ FieldMarks.pop_front();
+ }
+ }
+ else
+ {
+ ASSERT(!FieldMarks.size() ||
+ (FieldMarks.front() != nCurrentIndex),
+ "fieldmark and hint with CH_TXTATR at same pos?");
+ }
+
+ if (!bAtEnd && !xRef.is() && !bCursorMoved)
+ {
+ const sal_Int32 nNextPortionIndex =
+ lcl_GetNextIndex(Bookmarks, Redlines, SoftPageBreaks);
+ const sal_Int32 nNextFieldMarkIndex(
+ FieldMarks.size() ? FieldMarks.front() : -1);
+
+ lcl_MoveCursor(pUnoCrsr, nCurrentIndex,
+ nFirstFrameIndex, nNextPortionIndex, nNextAttrIndex,
+ nNextFieldMarkIndex,
+ i_nEndPos);
+
+ xRef = new SwXTextPortion(pUnoCrsr, i_xParentText, PORTION_TEXT);
+ }
+ else if (bAtEnd && !xRef.is() && !pTxtNode->Len())
+ {
+ // special case: for an empty paragraph, we better put out a
+ // text portion because there may be a hyperlink attribute
+ xRef = new SwXTextPortion(pUnoCrsr, i_xParentText, PORTION_TEXT);
+ }
+
+ if (xRef.is())
+ {
+ PortionStack.top().first->push_back(xRef);
+ }
+ }
+
+ ASSERT((PortionStack.size() == 1) && !PortionStack.top().second,
+ "CreatePortions: stack error" );
+}
+
+/*-- 27.01.99 10:44:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortionEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
new file mode 100644
index 000000000000..049ccfe42ed7
--- /dev/null
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -0,0 +1,793 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+#include <tools/debug.hxx>
+#include <svl/itemprop.hxx>
+#include <unoprnms.hxx>
+
+
+//#define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1
+
+const SwPropNameTab aPropNameTab = {
+
+/* 0001 FOLLOW_STYLE */ {MAP_CHAR_LEN("FollowStyle")},
+/* 0002 IS_PHYSICAL */ {MAP_CHAR_LEN("IsPhysical")},
+/* 0003 IS_AUTO_UPDATE */ {MAP_CHAR_LEN("IsAutoUpdate")},
+/* 0004 DISPLAY_NAME */ {MAP_CHAR_LEN("DisplayName")},
+/* 0005 PARA_GRAPHIC_URL */ {MAP_CHAR_LEN("ParaBackGraphicURL")},
+/* 0006 PARA_GRAPHIC_FILTER */ {MAP_CHAR_LEN("ParaBackGraphicFilter")},
+/* 0007 HEADER_GRAPHIC_URL */ {MAP_CHAR_LEN("HeaderBackGraphicURL")},
+/* 0008 HEADER_GRAPHIC_FILTER */ {MAP_CHAR_LEN("HeaderBackGraphicFilter")},
+/* 0009 FOOTER_GRAPHIC_URL */ {MAP_CHAR_LEN("FooterBackGraphicURL")},
+/* 0010 FOOTER_GRAPHIC_FILTER */ {MAP_CHAR_LEN("FooterBackGraphicFilter")},
+/* 0011 BACK_GRAPHIC_URL */ {MAP_CHAR_LEN("BackGraphicURL")},
+/* 0012 BACK_GRAPHIC_FILTER */ {MAP_CHAR_LEN("BackGraphicFilter")},
+/* 0013 BACK_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("BackGraphicLocation")},
+/* 0014 BACK_GRAPHIC_BITMAP */ {MAP_CHAR_LEN("BackGraphicBitmap")},
+/* 0015 GRAPHIC_URL */ {MAP_CHAR_LEN("GraphicURL")},
+/* 0016 GRAPHIC_FILTER */ {MAP_CHAR_LEN("GraphicFilter")},
+/* 0017 GRAPHIC_LOCATION */ {MAP_CHAR_LEN("GraphicLocation")},
+/* 0018 GRAPHIC_SIZE */ {MAP_CHAR_LEN("GraphicSize")},
+/* 0019 GRAPHIC_BITMAP */ {MAP_CHAR_LEN("GraphicBitmap")},
+/* 0020 BULLET_FONT */ {MAP_CHAR_LEN("BulletFont")},
+/* 0021 PARA_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("ParaBackGraphicLocation")},
+/* 0022 HEADER_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("HeaderBackGraphicLocation")},
+/* 0023 FOOTER_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("FooterBackGraphicLocation")},
+/* 0024 PARA_LEFT_PARA_MARGIN */ {MAP_CHAR_LEN("ParaLeftParaMargin")},
+/* 0025 PARA_RIGHT_PARA_MARGIN */ {MAP_CHAR_LEN("ParaRightParaMargin")},
+/* 0026 PARA_LEFT_MARGIN */ {MAP_CHAR_LEN("ParaLeftMargin")},
+/* 0027 PARA_RIGHT_MARGIN */ {MAP_CHAR_LEN("ParaRightMargin")},
+/* 0028 PARA_LEFT_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaLeftMarginRelative")},
+/* 0029 PARA_RIGHT_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaRightMarginRelative")},
+/* 0030 PARA_IS_AUTO_FIRST_LINE_INDENT */ {MAP_CHAR_LEN("ParaIsAutoFirstLineIndent")},
+/* 0031 PARA_FIRST_LINE_INDENT */ {MAP_CHAR_LEN("ParaFirstLineIndent")},
+/* 0032 PARA_FIRST_LINE_INDENT_RELATIVE */ {MAP_CHAR_LEN("ParaFirstLineIndentRelative")},
+/* 0033 PARA_IS_HYPHENATION */ {MAP_CHAR_LEN("ParaIsHyphenation")},
+/* 0034 PARA_HYPHENATION_MAX_LEADING_CHARS */ {MAP_CHAR_LEN("ParaHyphenationMaxLeadingChars")},
+/* 0035 PARA_HYPHENATION_MAX_TRAILING_CHARS */ {MAP_CHAR_LEN("ParaHyphenationMaxTrailingChars")},
+/* 0036 PARA_HYPHENATION_MAX_HYPHENS */ {MAP_CHAR_LEN("ParaHyphenationMaxHyphens")},
+/* 0037 LEFT_MARGIN */ {MAP_CHAR_LEN("LeftMargin")},
+/* 0038 RIGHT_MARGIN */ {MAP_CHAR_LEN("RightMargin")},
+/* 0039 HEADER_LEFT_MARGIN */ {MAP_CHAR_LEN("HeaderLeftMargin")},
+/* 0040 HEADER_RIGHT_MARGIN */ {MAP_CHAR_LEN("HeaderRightMargin")},
+/* 0041 FOOTER_LEFT_MARGIN */ {MAP_CHAR_LEN("FooterLeftMargin")},
+/* 0042 FOOTER_RIGHT_MARGIN */ {MAP_CHAR_LEN("FooterRightMargin")},
+/* 0043 TEXT_RANGE */ {MAP_CHAR_LEN("TextRange")},
+/* 0044 NAME */ {MAP_CHAR_LEN("Name")},
+/* 0045 NUMBERING_ALIGNMENT */ {MAP_CHAR_LEN("NumberingAlignment")},
+/* 0046 BULLET_FONT_NAME */ {MAP_CHAR_LEN("BulletFontName")},
+/* 0047 BULLET_ID */ {MAP_CHAR_LEN("BulletId")},
+/* 0048 CHAR_STYLE_NAME */ {MAP_CHAR_LEN("CharStyleName")},
+/* 0049 ANCHOR_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("AnchorCharStyleName")},
+/* 0050 SUFFIX */ {MAP_CHAR_LEN("Suffix")},
+/* 0051 PREFIX */ {MAP_CHAR_LEN("Prefix")},
+/* 0052 PARENT_NUMBERING */ {MAP_CHAR_LEN("ParentNumbering")},
+/* 0053 START_WITH */ {MAP_CHAR_LEN("StartWith")},
+/* 0054 CHAR_FONT_NAME */ {MAP_CHAR_LEN("CharFontName")},
+/* 0055 CHAR_FONT_STYLE_NAME */ {MAP_CHAR_LEN("CharFontStyleName")},
+/* 0056 CHAR_FONT_FAMILY */ {MAP_CHAR_LEN("CharFontFamily")},
+/* 0057 CHAR_FONT_CHAR_SET */ {MAP_CHAR_LEN("CharFontCharSet")},
+/* 0058 CHAR_FONT_PITCH */ {MAP_CHAR_LEN("CharFontPitch")},
+/* 0059 CHAR_POSTURE */ {MAP_CHAR_LEN("CharPosture")},
+/* 0060 CHAR_WEIGHT */ {MAP_CHAR_LEN("CharWeight")},
+/* 0061 CHAR_HEIGHT */ {MAP_CHAR_LEN("CharHeight")},
+/* 0062 CHAR_LOCALE */ {MAP_CHAR_LEN("CharLocale")},
+/* 0063 CHAR_FONT_NAME_ASIAN */ {MAP_CHAR_LEN("CharFontNameAsian")},
+/* 0064 CHAR_FONT_STYLE_NAME_ASIAN */ {MAP_CHAR_LEN("CharFontStyleNameAsian")},
+/* 0065 CHAR_FONT_FAMILY_ASIAN */ {MAP_CHAR_LEN("CharFontFamilyAsian")},
+/* 0066 CHAR_FONT_CHAR_SET_ASIAN */ {MAP_CHAR_LEN("CharFontCharSetAsian")},
+/* 0067 CHAR_FONT_PITCH_ASIAN */ {MAP_CHAR_LEN("CharFontPitchAsian")},
+/* 0068 CHAR_POSTURE_ASIAN */ {MAP_CHAR_LEN("CharPostureAsian")},
+/* 0069 CHAR_WEIGHT_ASIAN */ {MAP_CHAR_LEN("CharWeightAsian")},
+/* 0070 CHAR_HEIGHT_ASIAN */ {MAP_CHAR_LEN("CharHeightAsian")},
+/* 0071 CHAR_LOCALE_ASIAN */ {MAP_CHAR_LEN("CharLocaleAsian")},
+/* 0072 CHAR_FONT_NAME_COMPLEX */ {MAP_CHAR_LEN("CharFontNameComplex")},
+/* 0073 CHAR_FONT_STYLE_NAME_COMPLEX */ {MAP_CHAR_LEN("CharFontStyleNameComplex")},
+/* 0074 CHAR_FONT_FAMILY_COMPLEX */ {MAP_CHAR_LEN("CharFontFamilyComplex")},
+/* 0075 CHAR_FONT_CHAR_SET_COMPLEX */ {MAP_CHAR_LEN("CharFontCharSetComplex")},
+/* 0076 CHAR_FONT_PITCH_COMPLEX */ {MAP_CHAR_LEN("CharFontPitchComplex")},
+/* 0077 CHAR_POSTURE_COMPLEX */ {MAP_CHAR_LEN("CharPostureComplex")},
+/* 0078 CHAR_WEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharWeightComplex")},
+/* 0079 CHAR_HEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharHeightComplex")},
+/* 0080 CHAR_LOCALE_COMPLEX */ {MAP_CHAR_LEN("CharLocaleComplex")},
+/* 0081 CHAR_AUTO_KERNING */ {MAP_CHAR_LEN("CharAutoKerning")},
+/* 0082 CHAR_UNDERLINE */ {MAP_CHAR_LEN("CharUnderline")},
+/* 0083 CHAR_UNDERLINE_COLOR */ {MAP_CHAR_LEN("CharUnderlineColor")},
+/* 0084 CHAR_UNDERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharUnderlineHasColor")},
+/* 0085 CHAR_ESCAPEMENT */ {MAP_CHAR_LEN("CharEscapement")},
+/* 0086 CHAR_CASE_MAP */ {MAP_CHAR_LEN("CharCaseMap")},
+/* 0087 CHAR_SHADOWED */ {MAP_CHAR_LEN("CharShadowed")},
+/* 0088 CHAR_STRIKEOUT */ {MAP_CHAR_LEN("CharStrikeout")},
+/* 0089 CHAR_CROSSED_OUT */ {MAP_CHAR_LEN("CharCrossedOut")},
+/* 0090 CHAR_NO_HYPHENATION */ {MAP_CHAR_LEN("CharNoHyphenation")},
+/* 0091 CHAR_AUTO_ESCAPEMENT */ {MAP_CHAR_LEN("CharAutoEscapement")},
+/* 0092 CHAR_PROP_HEIGHT */ {MAP_CHAR_LEN("CharPropHeight")},
+/* 0093 CHAR_DIFF_HEIGHT */ {MAP_CHAR_LEN("CharDiffHeight")},
+/* 0094 CHAR_PROP_HEIGHT_ASIAN */ {MAP_CHAR_LEN("CharPropHeightAsian")},
+/* 0095 CHAR_DIFF_HEIGHT_ASIAN */ {MAP_CHAR_LEN("CharDiffHeightAsian")},
+/* 0096 CHAR_PROP_HEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharPropHeightComplex")},
+/* 0097 CHAR_DIFF_HEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharDiffHeightComplex")},
+/* 0098 CHAR_ESCAPEMENT_HEIGHT */ {MAP_CHAR_LEN("CharEscapementHeight")},
+/* 0099 CHAR_COLOR */ {MAP_CHAR_LEN("CharColor")},
+
+/* 0100 CHAR_FLASH */ {MAP_CHAR_LEN("CharFlash")},
+/* 0101 CHAR_KERNING */ {MAP_CHAR_LEN("CharKerning")},
+/* 0102 CHAR_BACK_COLOR */ {MAP_CHAR_LEN("CharBackColor")},
+/* 0103 CHAR_BACK_TRANSPARENT */ {MAP_CHAR_LEN("CharBackTransparent")},
+/* 0104 CHAR_COMBINE_IS_ON */ {MAP_CHAR_LEN("CharCombineIsOn")},
+/* 0105 CHAR_COMBINE_PREFIX */ {MAP_CHAR_LEN("CharCombinePrefix")},
+/* 0106 CHAR_COMBINE_SUFFIX */ {MAP_CHAR_LEN("CharCombineSuffix")},
+/* 0107 CHAR_EMPHASIS */ {MAP_CHAR_LEN("CharEmphasis")},
+/* 0108 PARA_LINE_SPACING */ {MAP_CHAR_LEN("ParaLineSpacing")},
+/* 0109 PARA_TOP_MARGIN */ {MAP_CHAR_LEN("ParaTopMargin")},
+/* 0110 PARA_BOTTOM_MARGIN */ {MAP_CHAR_LEN("ParaBottomMargin")},
+/* 0111 PARA_TOP_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaTopMarginRelative")},
+/* 0112 PARA_BOTTOM_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaBottomMarginRelative")},
+/* 0113 PARA_EXPAND_SINGLE_WORD */ {MAP_CHAR_LEN("ParaExpandSingleWord")},
+/* 0114 END_NOTICE */ {MAP_CHAR_LEN("EndNotice")},
+/* 0115 EMBEDDED_OBJECTS */ {MAP_CHAR_LEN("EmbeddedObjects")},
+/* 0116 ALPHABETICAL_SEPARATORS */ {MAP_CHAR_LEN("AlphabeticalSeparators")},
+/* 0117 BACKGROUND_COLOR */ {MAP_CHAR_LEN("BackgroundColor")},
+/* 0118 BEGIN_NOTICE */ {MAP_CHAR_LEN("BeginNotice")},
+/* 0119 CASE_SENSITIVE */ {MAP_CHAR_LEN("CaseSensitive")},
+/* 0120 FRAME_STYLE_NAME */ {MAP_CHAR_LEN("FrameStyleName")},
+/* 0121 NUMBERING_STYLE_NAME */ {MAP_CHAR_LEN("NumberingStyleName")},
+/* 0122 NUMBERING_LEVEL */ {MAP_CHAR_LEN("NumberingLevel")},
+/* 0123 NUMBERING_START_VALUE */ {MAP_CHAR_LEN("NumberingStartValue")},
+/* 0124 NUMBERING_IS_NUMBER */ {MAP_CHAR_LEN("NumberingIsNumber")},
+/* 0125 COMBINE_ENTRIES */ {MAP_CHAR_LEN("CombineEntries")},
+/* 0126 COUNT_LINES_IN_FRAMES */ {MAP_CHAR_LEN("CountLinesInFrames")},
+/* 0127 DDE_COMMAND_TYPE */ {MAP_CHAR_LEN("DDECommandType")},
+/* 0128 DDE_COMMAND_FILE */ {MAP_CHAR_LEN("DDECommandFile")},
+/* 0129 DDE_COMMAND_ELEMENT */ {MAP_CHAR_LEN("DDECommandElement")},
+/* 0130 IS_AUTOMATIC_UPDATE */ {MAP_CHAR_LEN("IsAutomaticUpdate")},
+/* 0131 DEFAULT_TABSTOP_DISTANCE */ {MAP_CHAR_LEN("DefaultTabstopDistance")},
+/* 0132 DISTANCE */ {MAP_CHAR_LEN("Distance")},
+/* 0133 DROP_CAP_FORMAT */ {MAP_CHAR_LEN("DropCapFormat")},
+/* 0134 DROP_CAP_WHOLE_WORD */ {MAP_CHAR_LEN("DropCapWholeWord")},
+/* 0135 DROP_CAP_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("DropCapCharStyleName")},
+/* 0136 FILE_LINK */ {MAP_CHAR_LEN("FileLink")},
+/* 0137 GRAPHIC */ {MAP_CHAR_LEN("Graphic")},
+/* 0138 GRAPHICS */ {MAP_CHAR_LEN("Graphics")},
+/* 0139 IS_PROTECTED */ {MAP_CHAR_LEN("IsProtected")},
+/* 0140 KEY_AS_ENTRY */ {MAP_CHAR_LEN("KeyAsEntry")},
+/* 0141 PARA_KEEP_TOGETHER */ {MAP_CHAR_LEN("ParaKeepTogether")},
+/* 0142 KEEP_TOGETHER */ {MAP_CHAR_LEN("KeepTogether")},
+/* 0143 IS_LANDSCAPE */ {MAP_CHAR_LEN("IsLandscape")},
+/* 0144 SEPARATOR_TEXT */ {MAP_CHAR_LEN("SeparatorText")},
+/* 0145 MARKS */ {MAP_CHAR_LEN("Marks")},
+/* 0146 NUMBER_POSITION */ {MAP_CHAR_LEN("NumberPosition")},
+/* 0147 OUTLINES */ {MAP_CHAR_LEN("Outlines")},
+/* 0148 PAGE_STYLE_NAME */ {MAP_CHAR_LEN("PageStyleName")},
+/* 0149 PAGE_STYLE_LAYOUT */ {MAP_CHAR_LEN("PageStyleLayout")},
+/* 0150 PARA_STYLES */ {MAP_CHAR_LEN("ParaStyles")},
+/* 0151 PARA_ADJUST */ {MAP_CHAR_LEN("ParaAdjust")},
+/* 0152 PARA_REGISTER_MODE_ACTIVE */ {MAP_CHAR_LEN("ParaRegisterModeActive")},
+/* 0153 PARA_STYLE_NAME */ {MAP_CHAR_LEN("ParaStyleName")},
+/* 0154 PARA_LAST_LINE_ADJUST */ {MAP_CHAR_LEN("ParaLastLineAdjust")},
+/* 0155 PARA_LINE_NUMBER_COUNT */ {MAP_CHAR_LEN("ParaLineNumberCount")},
+/* 0156 PARA_LINE_NUMBER_START_VALUE */ {MAP_CHAR_LEN("ParaLineNumberStartValue")},
+/* 0157 BACK_COLOR */ {MAP_CHAR_LEN("BackColor")},
+/* 0158 PARA_BACK_COLOR */ {MAP_CHAR_LEN("ParaBackColor")},
+/* 0159 PARA_WIDOWS */ {MAP_CHAR_LEN("ParaWidows")},
+/* 0160 PARA_ORPHANS */ {MAP_CHAR_LEN("ParaOrphans")},
+/* 0161 PARA_BACK_TRANSPARENT */ {MAP_CHAR_LEN("ParaBackTransparent")},
+/* 0162 POSITION_END_OF_DOC */ {MAP_CHAR_LEN("PositionEndOfDoc")},
+/* 0163 POSITION_PROTECTED */ {MAP_CHAR_LEN("PositionProtected")},
+/* 0164 ALTERNATIVE_TEXT */ {MAP_CHAR_LEN("AlternativeText")},
+/* 0165 PRIMARY_KEY */ {MAP_CHAR_LEN("PrimaryKey")},
+/* 0166 PRINT_TABLES */ {MAP_CHAR_LEN("PrintTables")},
+/* 0167 PRINT_GRAPHICS */ {MAP_CHAR_LEN("PrintGraphics")},
+/* 0168 PRINT_REVERSED */ {MAP_CHAR_LEN("PrintReversed")},
+/* 0169 PRINT_PROSPECT */ {MAP_CHAR_LEN("PrintProspect")},
+/* 0170 PRINT_CONTROLS */ {MAP_CHAR_LEN("PrintControls")},
+/* 0171 PRINT_DRAWINGS */ {MAP_CHAR_LEN("PrintDrawings")},
+/* 0172 PRINT_RIGHT_PAGES */ {MAP_CHAR_LEN("PrintRightPages")},
+/* 0173 PRINT_LEFT_PAGES */ {MAP_CHAR_LEN("PrintLeftPages")},
+/* 0174 PRINT_BLACK_FONTS */ {MAP_CHAR_LEN("PrintBlackFonts")},
+/* 0175 PRINTER_PAPER_TRAY */ {MAP_CHAR_LEN("PrinterPaperTray")},
+/* 0176 PRINT_PAGE_BACKGROUND */ {MAP_CHAR_LEN("PrintPageBackground")},
+/* 0177 PRINT_ANNOTATION_MODE */ {MAP_CHAR_LEN("PrintAnnotationMode")},
+/* 0178 PRINT_FAX_NAME */ {MAP_CHAR_LEN("PrintFaxName")},
+/* 0179 PRINT_PAPER_FROM_SETUP */ {MAP_CHAR_LEN("PrintPaperFromSetup")},
+/* 0180 REGISTER_MODE_ACTIVE */ {MAP_CHAR_LEN("RegisterModeActive")},
+/* 0181 RELATIVE_WIDTH */ {MAP_CHAR_LEN("RelativeWidth")},
+/* 0182 RELATIVE_HEIGHT */ {MAP_CHAR_LEN("RelativeHeight")},
+/* 0183 REPEAT_HEADLINE */ {MAP_CHAR_LEN("RepeatHeadline")},
+/* 0184 SEARCH_STYLES */ {MAP_CHAR_LEN("SearchStyles")},
+/* 0185 SEARCH_BACKWARDS */ {MAP_CHAR_LEN("SearchBackwards")},
+/* 0186 SEARCH_SIMILARITY */ {MAP_CHAR_LEN("SearchSimilarity")},
+/* 0187 SEARCH_IN_SELECTION */ {MAP_CHAR_LEN("SearchInSelection")},
+/* 0188 SEARCH_CASE_SENSITIVE */ {MAP_CHAR_LEN("SearchCaseSensitive")},
+/* 0189 SEARCH_SIMILARITY_ADD */ {MAP_CHAR_LEN("SearchSimilarityAdd")},
+/* 0190 SEARCH_SIMILARITY_RELAX */ {MAP_CHAR_LEN("SearchSimilarityRelax")},
+/* 0191 SEARCH_SIMILARITY_REMOVE */ {MAP_CHAR_LEN("SearchSimilarityRemove")},
+/* 0192 SEARCH_REGULAR_EXPRESSION */ {MAP_CHAR_LEN("SearchRegularExpression")},
+/* 0193 SEARCH_SIMILARITY_EXCHANGE */ {MAP_CHAR_LEN("SearchSimilarityExchange")},
+/* 0194 SECONDARY_KEY */ {MAP_CHAR_LEN("SecondaryKey")},
+/* 0195 SEPARATOR_INTERVAL */ {MAP_CHAR_LEN("SeparatorInterval")},
+/* 0196 SHOW_BREAKS */ {MAP_CHAR_LEN("ShowBreaks")},
+/* 0197 SHOW_SPACES */ {MAP_CHAR_LEN("ShowSpaces")},
+/* 0198 SHOW_TABLES */ {MAP_CHAR_LEN("ShowTables")},
+/* 0199 SHOW_GRAPHICS */ {MAP_CHAR_LEN("ShowGraphics")},
+
+/* 0200 SHOW_DRAWINGS */ {MAP_CHAR_LEN("ShowDrawings")},
+/* 0201 SHOW_TABSTOPS */ {MAP_CHAR_LEN("ShowTabstops")},
+/* 0202 SHOW_VERT_RULER */ {MAP_CHAR_LEN("ShowVertRuler")},
+/* 0203 SHOW_PARA_BREAKS */ {MAP_CHAR_LEN("ShowParaBreaks")},
+/* 0204 SHOW_HIDDEN_TEXT */ {MAP_CHAR_LEN("ShowHiddenText")},
+/* 0205 SHOW_ANNOTATIONS */ {MAP_CHAR_LEN("ShowAnnotations")},
+/* 0206 SHOW_SOFT_HYPHENS */ {MAP_CHAR_LEN("ShowSoftHyphens")},
+/* 0207 SHOW_VERT_SCROLL_BAR */ {MAP_CHAR_LEN("ShowVertScrollBar")},
+/* 0208 SHOW_HORI_SCROLL_BAR */ {MAP_CHAR_LEN("ShowHoriScrollBar")},
+/* 0209 SHOW_FIELD_COMMANDS */ {MAP_CHAR_LEN("ShowFieldCommands")},
+/* 0210 SHOW_TEXT_BOUNDARIES */ {MAP_CHAR_LEN("ShowTextBoundaries")},
+/* 0211 SHOW_PROTECTED_SPACES */ {MAP_CHAR_LEN("ShowProtectedSpaces")},
+/* 0212 SHOW_TABLE_BOUNDARIES */ {MAP_CHAR_LEN("ShowTableBoundaries")},
+/* 0213 SHOW_HIDDEN_PARAGRAPHS */ {MAP_CHAR_LEN("ShowHiddenParagraphs")},
+/* 0214 SHOW_INDEX_MARK_BACKGROUND */ {MAP_CHAR_LEN("ShowIndexMarkBackground")},
+/* 0215 SHOW_FOOTNOTE_BACKGROUND */ {MAP_CHAR_LEN("ShowFootnoteBackground")},
+/* 0216 SHOW_TEXT_FIELD_BACKGROUND */ {MAP_CHAR_LEN("ShowTextFieldBackground")},
+/* 0217 IS_SYNC_WIDTH_TO_HEIGHT */ {MAP_CHAR_LEN("IsSyncWidthToHeight")},
+/* 0218 IS_SYNC_HEIGHT_TO_WIDTH */ {MAP_CHAR_LEN("IsSyncHeightToWidth")},
+/* 0219 SIZE_PROTECTED */ {MAP_CHAR_LEN("SizeProtected")},
+/* 0220 SMOOTH_SCROLLING */ {MAP_CHAR_LEN("SmoothScrolling")},
+/* 0221 SOLID_MARK_HANDLES */ {MAP_CHAR_LEN("SolidMarkHandles")},
+/* 0222 TABLES */ {MAP_CHAR_LEN("Tables")},
+/* 0223 TEXT_FRAMES */ {MAP_CHAR_LEN("TextFrames")},
+/* 0224 TEXT_COLUMNS */ {MAP_CHAR_LEN("TextColumns")},
+/* 0225 BACK_TRANSPARENT */ {MAP_CHAR_LEN("BackTransparent")},
+/* 0226 USE_PP */ {MAP_CHAR_LEN("UsePP")},
+/* 0227 USER_METRIC */ {MAP_CHAR_LEN("UserMetric")},
+/* 0228 ANCHOR_TYPE */ {MAP_CHAR_LEN("AnchorType")},
+/* 0229 ANCHOR_TYPES */ {MAP_CHAR_LEN("AnchorTypes")},
+/* 0230 ANCHOR_PAGE_NO */ {MAP_CHAR_LEN("AnchorPageNo")},
+/* 0231 ANCHOR_FRAME */ {MAP_CHAR_LEN("AnchorFrame")},
+/* 0232 AUTHOR */ {MAP_CHAR_LEN("Author")},
+/* 0233 BREAK_TYPE */ {MAP_CHAR_LEN("BreakType")},
+/* 0234 CHAIN_NEXT_NAME */ {MAP_CHAR_LEN("ChainNextName")},
+/* 0235 CHAIN_PREV_NAME */ {MAP_CHAR_LEN("ChainPrevName")},
+/* 0236 CHAPTER_FORMAT */ {MAP_CHAR_LEN("ChapterFormat")},
+/* 0237 CLIENT_MAP */ {MAP_CHAR_LEN("ClientMap")},
+/* 0238 CONDITION */ {MAP_CHAR_LEN("Condition")},
+/* 0239 CONTENT */ {MAP_CHAR_LEN("Content")},
+/* 0240 CHAR_CONTOURED */ {MAP_CHAR_LEN("CharContoured")},
+/* 0241 CONTOUR_OUTSIDE */ {MAP_CHAR_LEN("ContourOutside")},
+/* 0242 CONTENT_PROTECTED */ {MAP_CHAR_LEN("ContentProtected")},
+/* 0243 COUNT_EMPTY_LINES */ {MAP_CHAR_LEN("CountEmptyLines")},
+/* 0244 RESTART_AT_EACH_PAGE */ {MAP_CHAR_LEN("RestartAtEachPage")},
+/* 0245 DATA_BASE_NAME */ {MAP_CHAR_LEN("DataBaseName")},
+/* 0246 DATA_TABLE_NAME */ {MAP_CHAR_LEN("DataTableName")},
+/* 0247 DATA_COMMAND_TYPE */ {MAP_CHAR_LEN("DataCommandType")},
+/* 0248 DATA_COLUMN_NAME */ {MAP_CHAR_LEN("DataColumnName")},
+/* 0249 IS_DATA_BASE_FORMAT */ {MAP_CHAR_LEN("DataBaseFormat")},
+/* 0250 DATE */ {MAP_CHAR_LEN("Date")},
+/* 0251 IS_DATE */ {MAP_CHAR_LEN("IsDate")},
+/* 0252 EDIT_IN_READONLY */ {MAP_CHAR_LEN("EditInReadonly")},
+/* 0253 FALSE_CONTENT */ {MAP_CHAR_LEN("FalseContent")},
+/* 0254 FILE_FORMAT */ {MAP_CHAR_LEN("FileFormat")},
+/* 0255 IS_FIXED */ {MAP_CHAR_LEN("IsFixed")},
+/* 0256 FOOTNOTE_COUNTING */ {MAP_CHAR_LEN("FootnoteCounting")},
+/* 0257 FORMULA */ {MAP_CHAR_LEN("Formula")},
+/* 0258 FRAME_NAME */ {MAP_CHAR_LEN("FrameName")},
+/* 0259 GRAPHIC_NAME */ {MAP_CHAR_LEN("GraphicName")},
+/* 0260 FULL_NAME */ {MAP_CHAR_LEN("FullName")},
+/* 0261 HEIGHT */ {MAP_CHAR_LEN("Height")},
+/* 0262 IS_AUTO_HEIGHT */ {MAP_CHAR_LEN("IsAutoHeight")},
+/* 0263 SIZE_TYPE */ {MAP_CHAR_LEN("SizeType")},
+/* 0264 HINT */ {MAP_CHAR_LEN("Hint")},
+/* 0265 HORI_ORIENT */ {MAP_CHAR_LEN("HoriOrient")},
+/* 0266 HORI_MIRRORED_ON_EVEN_PAGES */ {MAP_CHAR_LEN("HoriMirroredOnEvenPages")},
+/* 0267 HORI_MIRRORED_ON_ODD_PAGES */ {MAP_CHAR_LEN("HoriMirroredOnOddPages")},
+/* 0268 HORI_ORIENT_RELATION */ {MAP_CHAR_LEN("HoriOrientRelation")},
+/* 0269 HORI_ORIENT_POSITION */ {MAP_CHAR_LEN("HoriOrientPosition")},
+/* 0270 HYPER_LINK_U_R_L */ {MAP_CHAR_LEN("HyperLinkURL")},
+/* 0271 HYPER_LINK_TARGET */ {MAP_CHAR_LEN("HyperLinkTarget")},
+/* 0272 HYPER_LINK_NAME */ {MAP_CHAR_LEN("HyperLinkName")},
+/* 0273 HYPER_LINK_EVENTS */ {MAP_CHAR_LEN("HyperLinkEvents")},
+/* 0274 INFO_TYPE */ {MAP_CHAR_LEN("InfoType")},
+/* 0275 INFO_FORMAT */ {MAP_CHAR_LEN("InfoFormat")},
+/* 0276 IS_INPUT */ {MAP_CHAR_LEN("IsInput")},
+/* 0277 LEVEL */ {MAP_CHAR_LEN("Level")},
+/* 0278 INTERVAL */ {MAP_CHAR_LEN("Interval")},
+/* 0279 LINK_REGION */ {MAP_CHAR_LEN("LinkRegion")},
+/* 0280 MACRO_NAME */ {MAP_CHAR_LEN("MacroName")},
+/* 0281 SPLIT */ {MAP_CHAR_LEN("Split")},
+/* 0282 PARA_SPLIT */ {MAP_CHAR_LEN("ParaSplit")},
+/* 0283 NUMBER_FORMAT */ {MAP_CHAR_LEN("NumberFormat")},
+/* 0284 NUMBERING_TYPE */ {MAP_CHAR_LEN("NumberingType")},
+/* 0285 NUMBERING_RULES */ {MAP_CHAR_LEN("NumberingRules")},
+/* 0286 OFFSET */ {MAP_CHAR_LEN("Offset")},
+/* 0287 ON */ {MAP_CHAR_LEN("On")},
+/* 0288 OPAQUE */ {MAP_CHAR_LEN("Opaque")},
+/* 0289 PAGE_TOGGLE */ {MAP_CHAR_LEN("PageToggle")},
+/* 0290 PAGE_DESC_NAME */ {MAP_CHAR_LEN("PageDescName")},
+/* 0291 PAGE_NUMBER_OFFSET */ {MAP_CHAR_LEN("PageNumberOffset")},
+/* 0292 PLACEHOLDER */ {MAP_CHAR_LEN("PlaceHolder")},
+/* 0293 PLACEHOLDER_TYPE */ {MAP_CHAR_LEN("PlaceHolderType")},
+/* 0294 PRINT */ {MAP_CHAR_LEN("Print")},
+/* 0295 REFERENCE_FIELD_PART */ {MAP_CHAR_LEN("ReferenceFieldPart")},
+/* 0296 REFERENCE_FIELD_SOURCE */ {MAP_CHAR_LEN("ReferenceFieldSource")},
+/* 0297 REGISTER_PARAGRAPH_STYLE */ {MAP_CHAR_LEN("RegisterParagraphStyle")},
+/* 0298 SCRIPT_TYPE */ {MAP_CHAR_LEN("ScriptType")},
+/* 0299 SEARCH_ALL */ {MAP_CHAR_LEN("SearchAll")},
+
+/* 0300 SEARCH_WORDS */ {MAP_CHAR_LEN("SearchWords")},
+/* 0301 SEQUENCE_VALUE */ {MAP_CHAR_LEN("SequenceValue")},
+/* 0302 SERVER_MAP */ {MAP_CHAR_LEN("ServerMap")},
+/* 0303 IMAGE_MAP */ {MAP_CHAR_LEN("ImageMap")},
+/* 0304 SET_NUMBER */ {MAP_CHAR_LEN("SetNumber")},
+/* 0305 SHADOW_FORMAT */ {MAP_CHAR_LEN("ShadowFormat")},
+/* 0306 SHOW_HORI_RULER */ {MAP_CHAR_LEN("ShowHoriRuler")},
+/* 0307 SIZE */ {MAP_CHAR_LEN("Size")},
+/* 0308 ACTUAL_SIZE */ {MAP_CHAR_LEN("ActualSize")},
+/* 0309 SOURCE_NAME */ {MAP_CHAR_LEN("SourceName")},
+/* 0310 START_AT */ {MAP_CHAR_LEN("StartAt")},
+/* 0311 STATISTIC_TYPE_ID */ {MAP_CHAR_LEN("StatisticTypeId")},
+/* 0312 SUB_TYPE */ {MAP_CHAR_LEN("SubType")},
+/* 0313 SURROUND */ {MAP_CHAR_LEN("Surround")},
+/* 0314 IS_EXPRESSION */ {MAP_CHAR_LEN("IsExpression")},
+/* 0315 IS_SHOW_FORMULA */ {MAP_CHAR_LEN("IsShowFormula")},
+/* 0316 TEXT_WRAP */ {MAP_CHAR_LEN("TextWrap")},
+/* 0317 SURROUND_CONTOUR */ {MAP_CHAR_LEN("SurroundContour")},
+/* 0318 SURROUND_ANCHORONLY */ {MAP_CHAR_LEN("SurroundAnchorOnly")},
+/* 0319 TABLE_NAME */ {MAP_CHAR_LEN("TableName")},
+/* 0320 TABSTOPS */ {MAP_CHAR_LEN("ParaTabStops")},
+/* 0321 TITLE */ {MAP_CHAR_LEN("Title")},
+/* 0322 TOP_MARGIN */ {MAP_CHAR_LEN("TopMargin")},
+/* 0323 BOTTOM_MARGIN */ {MAP_CHAR_LEN("BottomMargin")},
+/* 0324 TRUE_CONTENT */ {MAP_CHAR_LEN("TrueContent")},
+/* 0325 URL_CONTENT */ {MAP_CHAR_LEN("URLContent")},
+/* 0326 USERTEXT */ {MAP_CHAR_LEN("UserText")},
+/* 0327 USER_DATA_TYPE */ {MAP_CHAR_LEN("UserDataType")},
+/* 0328 VALUE */ {MAP_CHAR_LEN("Value")},
+/* 0329 VARIABLE_NAME */ {MAP_CHAR_LEN("VariableName")},
+/* 0330 VARIABLE_SUBTYPE */ {MAP_CHAR_LEN("VariableSubtype")},
+/* 0331 VERT_ORIENT */ {MAP_CHAR_LEN("VertOrient")},
+/* 0332 VERT_MIRRORED */ {MAP_CHAR_LEN("VertMirrored")},
+/* 0333 VERT_ORIENT_POSITION */ {MAP_CHAR_LEN("VertOrientPosition")},
+/* 0334 VERT_ORIENT_RELATION */ {MAP_CHAR_LEN("VertOrientRelation")},
+/* 0335 IS_VISIBLE */ {MAP_CHAR_LEN("IsVisible")},
+/* 0336 WIDTH */ {MAP_CHAR_LEN("Width")},
+/* 0337 CHAR_WORD_MODE */ {MAP_CHAR_LEN("CharWordMode")},
+/* 0338 GRAPHIC_CROP */ {MAP_CHAR_LEN("GraphicCrop")},
+/* 0339 CHARACTER_FORMAT_NONE */ {MAP_CHAR_LEN("CharacterFormatNone")},
+/* 0340 TEXT_POSITION */ {MAP_CHAR_LEN("TextPosition")},
+/* 0341 DOCUMENT_INDEX_MARK */ {MAP_CHAR_LEN("DocumentIndexMark")},
+/* 0342 DOCUMENT_INDEX */ {MAP_CHAR_LEN("DocumentIndex")},
+/* 0343 IS_GLOBAL_DOCUMENT_SECTION */ {MAP_CHAR_LEN("IsGlobalDocumentSection")},
+/* 0344 TEXT_FIELD */ {MAP_CHAR_LEN("TextField")},
+/* 0345 BOOKMARK */ {MAP_CHAR_LEN("Bookmark")},
+/* 0346 TEXT_TABLE */ {MAP_CHAR_LEN("TextTable")},
+/* 0347 CELL */ {MAP_CHAR_LEN("Cell")},
+/* 0348 TEXT_FRAME */ {MAP_CHAR_LEN("TextFrame")},
+/* 0349 REFERENCE_MARK */ {MAP_CHAR_LEN("ReferenceMark")},
+/* 0350 TEXT_SECTION */ {MAP_CHAR_LEN("TextSection")},
+/* 0351 FOOTNOTE */ {MAP_CHAR_LEN("Footnote")},
+/* 0352 ENDNOTE */ {MAP_CHAR_LEN("Endnote")},
+/* 0353 CHART_ROW_AS_LABEL */ {MAP_CHAR_LEN("ChartRowAsLabel")},
+/* 0354 CHART_COLUMN_AS_LABEL */ {MAP_CHAR_LEN("ChartColumnAsLabel")},
+/* 0355 TABLE_COLUMS */ {MAP_CHAR_LEN("TableColumns")},
+/* 0356 LEFT_BORDER */ {MAP_CHAR_LEN("LeftBorder")},
+/* 0357 RIGHT_BORDER */ {MAP_CHAR_LEN("RightBorder")},
+/* 0358 TOP_BORDER */ {MAP_CHAR_LEN("TopBorder")},
+/* 0359 BOTTOM_BORDER */ {MAP_CHAR_LEN("BottomBorder")},
+/* 0360 BORDER_DISTANCE */ {MAP_CHAR_LEN("BorderDistance")},
+/* 0361 LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("LeftBorderDistance")},
+/* 0362 RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("RightBorderDistance")},
+/* 0363 TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("TopBorderDistance")},
+/* 0364 BOTTOM_BORDER_DISTANCE */ {MAP_CHAR_LEN("BottomBorderDistance")},
+/* 0365 TABLE_BORDER */ {MAP_CHAR_LEN("TableBorder")},
+/* 0366 TABLE_COLUMN_SEPARATORS */ {MAP_CHAR_LEN("TableColumnSeparators")},
+/* 0367 TABLE_COLUMN_RELATIVE_SUM */ {MAP_CHAR_LEN("TableColumnRelativeSum")},
+/* 0368 HEADER_TEXT */ {MAP_CHAR_LEN("HeaderText")},
+/* 0369 HEADER_TEXT_LEFT */ {MAP_CHAR_LEN("HeaderTextLeft")},
+/* 0370 HEADER_TEXT_RIGHT */ {MAP_CHAR_LEN("HeaderTextRight")},
+/* 0371 FOOTER_TEXT */ {MAP_CHAR_LEN("FooterText")},
+/* 0372 FOOTER_TEXT_LEFT */ {MAP_CHAR_LEN("FooterTextLeft")},
+/* 0373 FOOTER_TEXT_RIGHT */ {MAP_CHAR_LEN("FooterTextRight")},
+/* 0374 HEADER_BACK_COLOR */ {MAP_CHAR_LEN("HeaderBackColor")},
+/* 0375 HEADER_GRAPHIC */ {MAP_CHAR_LEN("HeaderBackGraphic")},
+/* 0376 HEADER_BACK_TRANSPARENT */ {MAP_CHAR_LEN("HeaderBackTransparent")},
+/* 0377 HEADER_LEFT_BORDER */ {MAP_CHAR_LEN("HeaderLeftBorder")},
+/* 0378 HEADER_RIGHT_BORDER */ {MAP_CHAR_LEN("HeaderRightBorder")},
+/* 0379 HEADER_TOP_BORDER */ {MAP_CHAR_LEN("HeaderTopBorder")},
+/* 0380 HEADER_BOTTOM_BORDER */ {MAP_CHAR_LEN("HeaderBottomBorder")},
+/* 0381 HEADER_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderBorderDistance")},
+/* 0382 HEADER_SHADOW_FORMAT */ {MAP_CHAR_LEN("HeaderShadowFormat")},
+/* 0383 HEADER_BODY_DISTANCE */ {MAP_CHAR_LEN("HeaderBodyDistance")},
+/* 0384 HEADER_IS_DYNAMIC_HEIGHT */ {MAP_CHAR_LEN("HeaderIsDynamicHeight")},
+/* 0385 HEADER_IS_SHARED */ {MAP_CHAR_LEN("HeaderIsShared")},
+/* 0386 HEADER_HEIGHT */ {MAP_CHAR_LEN("HeaderHeight")},
+/* 0387 HEADER_IS_ON */ {MAP_CHAR_LEN("HeaderIsOn")},
+/* 0388 FOOTER_BACK_COLOR */ {MAP_CHAR_LEN("FooterBackColor")},
+/* 0389 FOOTER_GRAPHIC */ {MAP_CHAR_LEN("FooterBackGraphic")},
+/* 0390 FOOTER_BACK_TRANSPARENT */ {MAP_CHAR_LEN("FooterBackTransparent")},
+/* 0391 FOOTER_LEFT_BORDER */ {MAP_CHAR_LEN("FooterLeftBorder")},
+/* 0392 FOOTER_RIGHT_BORDER */ {MAP_CHAR_LEN("FooterRightBorder")},
+/* 0393 FOOTER_TOP_BORDER */ {MAP_CHAR_LEN("FooterTopBorder")},
+/* 0394 FOOTER_BOTTOM_BORDER */ {MAP_CHAR_LEN("FooterBottomBorder")},
+/* 0395 FOOTER_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterBorderDistance")},
+/* 0396 FOOTER_SHADOW_FORMAT */ {MAP_CHAR_LEN("FooterShadowFormat")},
+/* 0397 FOOTER_BODY_DISTANCE */ {MAP_CHAR_LEN("FooterBodyDistance")},
+/* 0398 FOOTER_IS_DYNAMIC_HEIGHT */ {MAP_CHAR_LEN("FooterIsDynamicHeight")},
+/* 0399 FOOTER_IS_SHARED */ {MAP_CHAR_LEN("FooterIsShared")},
+
+/* 0400 FOOTER_HEIGHT */ {MAP_CHAR_LEN("FooterHeight")},
+/* 0401 FOOTER_IS_ON */ {MAP_CHAR_LEN("FooterIsOn")},
+/* 0402 OVERWRITE_STYLES */ {MAP_CHAR_LEN("OverwriteStyles")},
+/* 0403 LOAD_NUMBERING_STYLES */ {MAP_CHAR_LEN("LoadNumberingStyles")},
+/* 0404 LOAD_PAGE_STYLES */ {MAP_CHAR_LEN("LoadPageStyles")},
+/* 0405 LOAD_FRAME_STYLES */ {MAP_CHAR_LEN("LoadFrameStyles")},
+/* 0406 LOAD_TEXT_STYLES */ {MAP_CHAR_LEN("LoadTextStyles")},
+/* 0407 FILE_NAME */ {MAP_CHAR_LEN("FileName")},
+/* 0408 FILTER_NAME */ {MAP_CHAR_LEN("FilterName")},
+/* 0409 FILTER_OPTION */ {MAP_CHAR_LEN("FilterOption")},
+/* 0410 PASSWORD */ {MAP_CHAR_LEN("Password")},
+/* 0411 COPY_COUNT */ {MAP_CHAR_LEN("CopyCount")},
+/* 0412 COLLATE */ {MAP_CHAR_LEN("Collate")},
+/* 0413 SORT */ {MAP_CHAR_LEN("Sort")},
+/* 0414 PAGES */ {MAP_CHAR_LEN("Pages")},
+/* 0415 FIRST_LINE_OFFSET */ {MAP_CHAR_LEN("FirstLineOffset")},
+/* 0416 SYMBOL_TEXT_DISTANCE */ {MAP_CHAR_LEN("SymbolTextDistance")},
+/* 0417 USER_INDEX_NAME */ {MAP_CHAR_LEN("UserIndexName")},
+/* 0418 REVISION */ {MAP_CHAR_LEN("Revision")},
+/* 0419 UNVISITED_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("UnvisitedCharStyleName")},
+/* 0420 VISITED_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("VisitedCharStyleName")},
+/* 0421 PARAGRAPH_COUNT */ {MAP_CHAR_LEN("ParagraphCount")},
+/* 0422 WORD_COUNT */ {MAP_CHAR_LEN("WordCount")},
+/* 0423 WORD_SEPARATOR */ {MAP_CHAR_LEN("WordSeparator")},
+/* 0424 CHARACTER_COUNT */ {MAP_CHAR_LEN("CharacterCount")},
+/* 0425 ZOOM_VALUE */ {MAP_CHAR_LEN("ZoomValue")},
+/* 0426 ZOOM_TYPE */ {MAP_CHAR_LEN("ZoomType")},
+/* 0427 CREATE_FROM_MARKS */ {MAP_CHAR_LEN("CreateFromMarks")},
+/* 0428 CREATE_FROM_OUTLINE */ {MAP_CHAR_LEN("CreateFromOutline")},
+/* 0429 PARAGRAPH_STYLE_NAMES */ {MAP_CHAR_LEN("ParagraphStyleNames")},
+/* 0430 CREATE_FROM_CHAPTER */ {MAP_CHAR_LEN("CreateFromChapter")},
+/* 0431 CREATE_FROM_LABELS */ {MAP_CHAR_LEN("CreateFromLabels")},
+/* 0432 USE_ALPHABETICAL_SEPARATORS */ {MAP_CHAR_LEN("UseAlphabeticalSeparators")},
+/* 0433 USE_KEY_AS_ENTRY */ {MAP_CHAR_LEN("UseKeyAsEntry")},
+/* 0434 USE_COMBINED_ENTRIES */ {MAP_CHAR_LEN("UseCombinedEntries")},
+/* 0435 IS_CASE_SENSITIVE */ {MAP_CHAR_LEN("IsCaseSensitive")},
+/* 0436 USE_P_P */ {MAP_CHAR_LEN("UsePP")},
+/* 0437 USE_DASH */ {MAP_CHAR_LEN("UseDash")},
+/* 0438 USE_UPPER_CASE */ {MAP_CHAR_LEN("UseUpperCase")},
+/* 0439 LABEL_CATEGORY */ {MAP_CHAR_LEN("LabelCategory")},
+/* 0440 LABEL_DISPLAY_TYPE */ {MAP_CHAR_LEN("LabelDisplayType")},
+/* 0441 USE_LEVEL_FROM_SOURCE */ {MAP_CHAR_LEN("UseLevelFromSource")},
+/* 0442 LEVEL_FORMAT */ {MAP_CHAR_LEN("LevelFormat")},
+/* 0443 LEVEL_PARAGRAPH_STYLES */ {MAP_CHAR_LEN("LevelParagraphStyles")},
+/* 0444 RECALC_TAB_STOPS */ {MAP_CHAR_LEN("RecalcTabStops")},
+/* 0445 MAIN_ENTRY_CHARACTER_STYLE_NAME */ {MAP_CHAR_LEN("MainEntryCharacterStyleName")},
+/* 0446 CREATE_FROM_TABLES */ {MAP_CHAR_LEN("CreateFromTables")},
+/* 0447 CREATE_FROM_TEXT_FRAMES */ {MAP_CHAR_LEN("CreateFromTextFrames")},
+/* 0448 CREATE_FROM_GRAPHIC_OBJECTS */ {MAP_CHAR_LEN("CreateFromGraphicObjects")},
+/* 0449 CREATE_FROM_EMBEDDED_OBJECTS */ {MAP_CHAR_LEN("CreateFromEmbeddedObjects")},
+/* 0450 CREATE_FROM_STAR_MATH */ {MAP_CHAR_LEN("CreateFromStarMath")},
+/* 0451 CREATE_FROM_STAR_CHART */ {MAP_CHAR_LEN("CreateFromStarChart")},
+/* 0452 CREATE_FROM_STAR_CALC */ {MAP_CHAR_LEN("CreateFromStarCalc")},
+/* 0453 CREATE_FROM_STAR_DRAW */ {MAP_CHAR_LEN("CreateFromStarDraw")},
+/* 0454 CREATE_FROM_OTHER_EMBEDDED_OBJECTS */ {MAP_CHAR_LEN("CreateFromOtherEmbeddedObjects")},
+/* 0455 INDEX_AUTO_MARK_FILE_U_R_L */ {MAP_CHAR_LEN("IndexAutoMarkFileURL")},
+/* 0456 IS_COMMA_SEPARATED */ {MAP_CHAR_LEN("IsCommaSeparated")},
+/* 0457 IS_RELATIVE_TABSTOPS */ {MAP_CHAR_LEN("IsRelativeTabstops")},
+/* 0458 CREATE_FROM_LEVEL_PARAGRAPH_STYLES */ {MAP_CHAR_LEN("CreateFromLevelParagraphStyles")},
+/* 0459 SHOW_CHANGES */ {MAP_CHAR_LEN("ShowChanges")},
+/* 0460 RECORD_CHANGES */ {MAP_CHAR_LEN("RecordChanges")},
+/* 0461 DISPLAY_NAME */ {MAP_CHAR_LEN("LinkDisplayName")},
+/* 0462 DISPLAY_BITMAP */ {MAP_CHAR_LEN("LinkDisplayBitmap")},
+/* 0463 HEADING_STYLE_NAME */ {MAP_CHAR_LEN("HeadingStyleName")},
+/* 0464 SHOW_ONLINE_LAYOUT */ {MAP_CHAR_LEN("ShowOnlineLayout")},
+/* 0465 USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("UserDefinedAttributes")},
+/* 0466 TEXT_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("TextUserDefinedAttributes")},
+/* 0467 FILE_PATH */ {MAP_CHAR_LEN("FilePath")},
+/* 0468 PARA_CHAPTER_NUMBERING_LEVEL */ {MAP_CHAR_LEN("ParaChapterNumberingLevel")},
+/* 0469 PARA_CONDITIONAL_STYLE_NAME */ {MAP_CHAR_LEN("ParaConditionalStyleName")},
+/* 0470 CHAPTER_NUMBERING_LEVEL */ {MAP_CHAR_LEN("ChapterNumberingLevel")},
+/* 0471 NUMBERING_SEPARATOR */ {MAP_CHAR_LEN("NumberingSeparator")},
+/* 0472 IS_CONTINUOUS_NUMBERING */ {MAP_CHAR_LEN("IsContinuousNumbering")},
+/* 0473 IS_AUTOMATIC */ {MAP_CHAR_LEN("IsAutomatic")},
+/* 0474 IS_ABSOLUTE_MARGINS */ {MAP_CHAR_LEN("IsAbsoluteMargins")},
+/* 0475 CATEGORY */ {MAP_CHAR_LEN("Category")},
+/* 0476 DEPENDENT_TEXT_FIELDS */ {MAP_CHAR_LEN("DependentTextFields")},
+/* 0477 CURRENT_PRESENTATION */ {MAP_CHAR_LEN("CurrentPresentation")},
+/* 0478 ADJUST */ {MAP_CHAR_LEN("Adjust")},
+/* 0479 INSTANCE_NAME */ {MAP_CHAR_LEN("InstanceName")},
+/* 0480 TEXT_PORTION_TYPE */ {MAP_CHAR_LEN("TextPortionType")},
+/* 0481 CONTROL_CHARACTER */ {MAP_CHAR_LEN("ControlCharacter")},
+/* 0482 IS_COLLAPSED */ {MAP_CHAR_LEN("IsCollapsed")},
+/* 0483 IS_START */ {MAP_CHAR_LEN("IsStart")},
+/* 0484 SEQUENCE_NUMBER */ {MAP_CHAR_LEN("SequenceNumber")},
+/* 0485 REFERENCE_ID */ {MAP_CHAR_LEN("ReferenceId")},
+/* 0486 HEADER_LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderLeftBorderDistance")},
+/* 0487 HEADER_RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderRightBorderDistance")},
+/* 0488 HEADER_TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderTopBorderDistance")},
+/* 0489 HEADER_BOTTOM_BORDER_DISTANCE */{MAP_CHAR_LEN("HeaderBottomBorderDistance")},
+/* 0490 FOOTER_LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterLeftBorderDistance")},
+/* 0491 FOOTER_RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterRightBorderDistance")},
+/* 0492 FOOTER_TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterTopBorderDistance")},
+/* 0493 FOOTER_BOTTOM_BORDER_DISTANCE */{MAP_CHAR_LEN("FooterBottomBorderDistance")},
+/* 0494 PARA_IS_NUMBERING_RESTART */ {MAP_CHAR_LEN("ParaIsNumberingRestart")},
+/* 0495 HIDE_FIELD_TIPS */ {MAP_CHAR_LEN("HideFieldTips")},
+/* 0496 HEADER_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("HeaderUserDefinedAttributes")},
+/* 0497 FOOTER_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("FooterUserDefinedAttributes")},
+/* 0498 PARA_SHADOW_FORMAT */ {MAP_CHAR_LEN("ParaShadowFormat")},
+/* 0499 CONTOUR_POLY_POLYGON */ {MAP_CHAR_LEN("ContourPolyPolygon")},
+
+/* 0500 IS_PIXEL_CONTOUR */ {MAP_CHAR_LEN("IsPixelContour")},
+/* 0501 IS_AUTOMATIC_CONTOUR */ {MAP_CHAR_LEN("IsAutomaticContour")},
+/* 0502 SEPARATOR_LINE_WIDTH */ {MAP_CHAR_LEN("SeparatorLineWidth")},
+/* 0503 SEPARATOR_LINE_COLOR */ {MAP_CHAR_LEN("SeparatorLineColor")},
+/* 0504 SEPARATOR_LINE_RELATIVE_HEIGHT */ {MAP_CHAR_LEN("SeparatorLineRelativeHeight")},
+/* 0505 SEPARATOR_LINE_VERTIVAL_ALIGNMENT */{MAP_CHAR_LEN("SeparatorLineVerticalAlignment")},
+/* 0506 SEPARATOR_LINE_IS_ON */ {MAP_CHAR_LEN("SeparatorLineIsOn")},
+/* 0507 IS_SKIP_HIDDEN_TEXT */ {MAP_CHAR_LEN("IsSkipHiddenText")},
+/* 0508 IS_SKIP_PROTECTED_TEXT */ {MAP_CHAR_LEN("IsSkipProtectedText")},
+/* 0509 DOCUMENT_INDEX_MARKS */ {MAP_CHAR_LEN("DocumentIndexMarks")},
+/* 0510 FOOTNOTE_IS_COLLECT_AT_TEXT_END */ {MAP_CHAR_LEN("FootnoteIsCollectAtTextEnd")},
+/* 0511 FOOTNOTE_IS_RESTART_NUMBERING */ {MAP_CHAR_LEN("FootnoteIsRestartNumbering")},
+/* 0512 FOOTNOTE_RESTART_NUMBERING_AT */{MAP_CHAR_LEN("FootnoteRestartNumberingAt")},
+/* 0513 FOOTNOTE_IS_OWN_NUMBERING */ {MAP_CHAR_LEN("FootnoteIsOwnNumbering")},
+/* 0514 FOOTNOTE_NUMBERING_TYPE */ {MAP_CHAR_LEN("FootnoteNumberingType")},
+/* 0515 FOOTNOTE_NUMBERING_PREFIX */ {MAP_CHAR_LEN("FootnoteNumberingPrefix")},
+/* 0516 FOOTNOTE_NUMBERING_SUFFIX */ {MAP_CHAR_LEN("FootnoteNumberingSuffix")},
+/* 0517 ENDNOTE_IS_COLLECT_AT_TEXT_END */ {MAP_CHAR_LEN("EndnoteIsCollectAtTextEnd")},
+/* 0518 ENDNOTE_IS_RESTART_NUMBERING */ {MAP_CHAR_LEN("EndnoteIsRestartNumbering")},
+/* 0519 ENDNOTE_RESTART_NUMBERING_AT */ {MAP_CHAR_LEN("EndnoteRestartNumberingAt")},
+/* 0520 ENDNOTE_IS_OWN_NUMBERING */ {MAP_CHAR_LEN("EndnoteIsOwnNumbering")},
+/* 0521 ENDNOTE_NUMBERING_TYPE */ {MAP_CHAR_LEN("EndnoteNumberingType")},
+/* 0522 ENDNOTE_NUMBERING_PREFIX */ {MAP_CHAR_LEN("EndnoteNumberingPrefix")},
+/* 0523 ENDNOTE_NUMBERING_SUFFIX */ {MAP_CHAR_LEN("EndnoteNumberingSuffix")},
+/* 0524 BRACKET_BEFORE */ {MAP_CHAR_LEN("BracketBefore")},
+/* 0525 BRACKET_AFTER */ {MAP_CHAR_LEN("BracketAfter")},
+/* 0526 IS_NUMBER_ENTRIES */ {MAP_CHAR_LEN("IsNumberEntries")},
+/* 0527 IS_SORT_BY_POSITION */ {MAP_CHAR_LEN("IsSortByPosition")},
+/* 0528 SORT_KEYS */ {MAP_CHAR_LEN("SortKeys")},
+/* 0529 IS_SORT_ASCENDING */ {MAP_CHAR_LEN("IsSortAscending")},
+/* 0530 SORT_KEY */ {MAP_CHAR_LEN("SortKey")},
+/* 0531 FIELDS */ {MAP_CHAR_LEN("Fields")},
+/* 0532 DATE_TIME_VALUE */ {MAP_CHAR_LEN("DateTimeValue")},
+/* 0533 IS_ON */ {MAP_CHAR_LEN("IsOn")},
+/* 0534 Z_ORDER */ {MAP_CHAR_LEN("ZOrder")},
+/* 0535 CONTENT_SECTION */ {MAP_CHAR_LEN("ContentSection")},
+/* 0536 HEADER_SECTION */ {MAP_CHAR_LEN("HeaderSection")},
+/* 0537 PARA_IS_HANGING_PUNCTUATION */ {MAP_CHAR_LEN("ParaIsHangingPunctuation")},
+/* 0538 PARA_IS_CHARACTER_DISTANCE */ {MAP_CHAR_LEN("ParaIsCharacterDistance")},
+/* 0539 PARA_IS_FORBIDDEN_RULES */ {MAP_CHAR_LEN("ParaIsForbiddenRules")},
+/* 0540 PARA_VERT_ALIGNMENT */ {MAP_CHAR_LEN("ParaVertAlignment")},
+/* 0541 IS_MAIN_ENTRY */ {MAP_CHAR_LEN("IsMainEntry")},
+/* 0542 GRAPHIC_ROTATION */ {MAP_CHAR_LEN("GraphicRotation")},
+/* 0543 ADJUST_LUMINANCE */ {MAP_CHAR_LEN("AdjustLuminance")},
+/* 0544 ADJUST_CONTRAST */ {MAP_CHAR_LEN("AdjustContrast")},
+/* 0545 ADJUST_RED */ {MAP_CHAR_LEN("AdjustRed")},
+/* 0546 ADJUST_GREEN */ {MAP_CHAR_LEN("AdjustGreen")},
+/* 0547 ADJUST_BLUE */ {MAP_CHAR_LEN("AdjustBlue")},
+/* 0548 GAMMA */ {MAP_CHAR_LEN("Gamma")},
+/* 0549 GRAPHIC_IS_INVERTED */ {MAP_CHAR_LEN("GraphicIsInverted")},
+/* 0550 TRANSPARENCY */ {MAP_CHAR_LEN("Transparency")},
+/* 0551 GRAPHIC_COLOR_MODE */ {MAP_CHAR_LEN("GraphicColorMode")},
+/* 0552 REDLINE_AUTHOR */ {MAP_CHAR_LEN("RedlineAuthor")},
+/* 0553 REDLINE_DATE_TIME */ {MAP_CHAR_LEN("RedlineDateTime")},
+/* 0554 REDLINE_COMMENT */ {MAP_CHAR_LEN("RedlineComment")},
+/* 0555 REDLINE_TYPE */ {MAP_CHAR_LEN("RedlineType")},
+/* 0556 REDLINE_SUCCESSOR_DATA */ {MAP_CHAR_LEN("RedlineSuccessorData")},
+/* 0557 REDLINE_IDENTIFIER */ {MAP_CHAR_LEN("RedlineIdentifier")},
+/* 0558 IS_IN_HEADER_FOOTER */ {MAP_CHAR_LEN("IsInHeaderFooter")},
+/* 0559 START_REDLINE */ {MAP_CHAR_LEN("StartRedline")},
+/* 0560 END_REDLINE */ {MAP_CHAR_LEN("EndRedline")},
+/* 0561 REDLINE_START */ {MAP_CHAR_LEN("RedlineStart")},
+/* 0562 REDLINE_END */ {MAP_CHAR_LEN("RedlineEnd")},
+/* 0563 REDLINE_TEXT */ {MAP_CHAR_LEN("RedlineText")},
+/* 0564 REDLINE_DISPLAY_TYPE */ {MAP_CHAR_LEN("RedlineDisplayType")},
+/* 0565 FORBIDDEN_CHARACTERS */ {MAP_CHAR_LEN("ForbiddenCharacters")},
+/* 0566 RUBY_BASE_TEXT */ {MAP_CHAR_LEN("RubyBaseText")},
+/* 0567 RUBY_TEXT */ {MAP_CHAR_LEN("RubyText")},
+/* 0568 RUBY_ADJUST */ {MAP_CHAR_LEN("RubyAdjust")},
+/* 0569 RUBY_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("RubyCharStyleName")},
+/* 0570 RUBY_IS_ABOVE */ {MAP_CHAR_LEN("RubyIsAbove")},
+/* 0571 FOOTNOTE_HEIGHT */ {MAP_CHAR_LEN("FootnoteHeight")},
+/* 0572 FOOTNOTE_LINE_WEIGHT */ {MAP_CHAR_LEN("FootnoteLineWeight")},
+/* 0573 FOOTNOTE_LINE_COLOR */ {MAP_CHAR_LEN("FootnoteLineColor")},
+/* 0574 FOOTNOTE_LINE_RELATIVE_WIDTH */ {MAP_CHAR_LEN("FootnoteLineRelativeWidth")},
+/* 0575 FOOTNOTE_LINE_ADJUST */ {MAP_CHAR_LEN("FootnoteLineAdjust")},
+/* 0576 FOOTNOTE_LINE_TEXT_DISTANCE */ {MAP_CHAR_LEN("FootnoteLineTextDistance")},
+/* 0577 FOOTNOTE_LINE_DISTANCE */ {MAP_CHAR_LEN("FootnoteLineDistance")},
+/* 0578 CHAR_ROTATION */ {MAP_CHAR_LEN("CharRotation")},
+/* 0579 CHAR_ROTATION_IS_FIT_TO_LINE */ {MAP_CHAR_LEN("CharRotationIsFitToLine")},
+/* 0580 CHAR_SCALE_WIDTH */ {MAP_CHAR_LEN("CharScaleWidth")},
+/* 0581 TAB_STOP_DISTANCE */ {MAP_CHAR_LEN("TabStopDistance")},
+/* 0582 IS_WIDTH_RELATIVE */ {MAP_CHAR_LEN("IsWidthRelative")},
+/* 0583 CHAR_RELIEF */ {MAP_CHAR_LEN("CharRelief")},
+/* 0584 IS_HIDDEN */ {MAP_CHAR_LEN("IsHidden")},
+/* 0585 IS_CONDITION_TRUE */ {MAP_CHAR_LEN("IsConditionTrue")},
+/* 0586 TWO_DIGIT_YEAR */ {MAP_CHAR_LEN("TwoDigitYear")},
+/* 0587 PROTECTION_KEY */ {MAP_CHAR_LEN("ProtectionKey")},
+/* 0588 REDLINE_PROTECTION_KEY */ {MAP_CHAR_LEN("RedlineProtectionKey")},
+/* 0589 AUTOMATIC_DISTANCE */ {MAP_CHAR_LEN("AutomaticDistance")},
+/* 0590 AUTOMATIC_CONTROL_FOCUS */ {MAP_CHAR_LEN("AutomaticControlFocus")},
+/* 0591 APPLY_FORM_DESIGN_MODE */ {MAP_CHAR_LEN("ApplyFormDesignMode")},
+/* 0592 LOCALE */ {MAP_CHAR_LEN("Locale")},
+/* 0593 SORT_ALGORITHM */ {MAP_CHAR_LEN("SortAlgorithm")},
+/* 0594 FRAME_HEIGHT_ABSOLUTE */ {MAP_CHAR_LEN("FrameHeightAbsolute")},
+/* 0596 FRAME_HEIGHT_PERCENT */ {MAP_CHAR_LEN("FrameHeightPercent")},
+/* 0597 FRAME_ISAUTOMATIC_HEIGHT */ {MAP_CHAR_LEN("FrameIsAutomaticHeight")},
+/* 0598 FRAME_WIDTH_ABSOLUTE */ {MAP_CHAR_LEN("FrameWidthAbsolute")},
+/* 0599 FRAME_WIDTH_PERCENT */ {MAP_CHAR_LEN("FrameWidthPercent")},
+/* 0600 PARA_STYLEHEADING */ {MAP_CHAR_LEN("ParaStyleHeading")},
+/* 0601 PARA_STYLELEVEL1 */ {MAP_CHAR_LEN("ParaStyleLevel1")},
+/* 0602 PARA_STYLELEVEL10 */ {MAP_CHAR_LEN("ParaStyleLevel10")},
+/* 0603 PARA_STYLELEVEL2 */ {MAP_CHAR_LEN("ParaStyleLevel2")},
+/* 0604 PARA_STYLELEVEL3 */ {MAP_CHAR_LEN("ParaStyleLevel3")},
+/* 0605 PARA_STYLELEVEL4 */ {MAP_CHAR_LEN("ParaStyleLevel4")},
+/* 0606 PARA_STYLELEVEL5 */ {MAP_CHAR_LEN("ParaStyleLevel5")},
+/* 0607 PARA_STYLELEVEL6 */ {MAP_CHAR_LEN("ParaStyleLevel6")},
+/* 0608 PARA_STYLELEVEL7 */ {MAP_CHAR_LEN("ParaStyleLevel7")},
+/* 0609 PARA_STYLELEVEL8 */ {MAP_CHAR_LEN("ParaStyleLevel8")},
+/* 0610 PARA_STYLELEVEL9 */ {MAP_CHAR_LEN("ParaStyleLevel9")},
+/* 0611 PARA_STYLESEPARATOR */ {MAP_CHAR_LEN("ParaStyleSeparator")},
+/* 0612 MACRO_LIBRARY */ {MAP_CHAR_LEN("MacroLibrary")},
+/* 0613 CELL_NAME */ {MAP_CHAR_LEN("CellName")},
+/* 0614 PARA_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("ParaUserDefinedAttributes")},
+/* 0615 UNO_NAME_MERGE_LAST_PARA */ {MAP_CHAR_LEN("MergeLastPara")},
+/* 0616 UNO_NAME_WRITING_MODE */ {MAP_CHAR_LEN("WritingMode")},
+/* 0617 UNO_NAME_GRID_COLOR */ {MAP_CHAR_LEN("GridColor")},
+/* 0618 UNO_NAME_GRID_LINES */ {MAP_CHAR_LEN("GridLines")},
+/* 0619 UNO_NAME_GRID_BASE_HEIGHT */ {MAP_CHAR_LEN("GridBaseHeight")},
+/* 0620 UNO_NAME_GRID_RUBY_HEIGHT */ {MAP_CHAR_LEN("GridRubyHeight")},
+/* 0621 UNO_NAME_GRID_MODE */ {MAP_CHAR_LEN("GridMode")},
+/* 0622 UNO_NAME_GRID_RUBY_BELOW */ {MAP_CHAR_LEN("RubyBelow")},
+/* 0623 UNO_NAME_GRID_PRINT */ {MAP_CHAR_LEN("GridPrint")},
+/* 0624 UNO_NAME_GRID_DISPLAY */ {MAP_CHAR_LEN("GridDisplay")},
+/* 0625 UNO_NAME_SNAP_TO_GRID */ {MAP_CHAR_LEN("SnapToGrid")},
+/* 0626 UNO_NAME_DONT_BALANCE_TEXT_COLUMNS */{MAP_CHAR_LEN("DontBalanceTextColumns")},
+/* 0627 UNO_NAME_IS_CURRENTLY_VISIBLE */{MAP_CHAR_LEN("IsCurrentlyVisible")},
+/* 0628 UNO_NAME_ANCHOR_POSITION */ {MAP_CHAR_LEN("AnchorPosition")},
+/* 0629 UNO_NAME_TEXT_READING */ {MAP_CHAR_LEN("TextReading")},
+/* 0630 UNO_NAME_PRIMARY_KEY_READING */ {MAP_CHAR_LEN("PrimaryKeyReading")},
+/* 0631 UNO_NAME_SECONDARY_KEY_READING */ {MAP_CHAR_LEN("SecondaryKeyReading")},
+/* 0632 UNO_NAME_BACK_GRAPHIC_TRANSPARENCY*/ {MAP_CHAR_LEN("BackGraphicTransparency")},
+/* 0633 UNO_NAME_BACK_COLOR_R_G_B */ {MAP_CHAR_LEN("BackColorRGB")},
+/* 0634 UNO_NAME_BACK_COLOR_TRANSPARENCY */ {MAP_CHAR_LEN("BackColorTransparency")},
+/* 0635 UNO_NAME_HEADER_DYNAMIC_SPACING */ {MAP_CHAR_LEN("HeaderDynamicSpacing")},
+/* 0636 UNO_NAME_FOOTER_DYNAMIC_SPACING */ {MAP_CHAR_LEN("FooterDynamicSpacing")},
+/* 0637 UNO_NAME_BASIC_LIBRARIES */ {MAP_CHAR_LEN("BasicLibraries")},
+/* 0638 UNO_NAME_IS_FIXED_LANGUAGE */ {MAP_CHAR_LEN("IsFixedLanguage")},
+/* 0639 UNO_NAME_SELECTION */ {MAP_CHAR_LEN("Selection")},
+/* 0640 UNO_NAME_RESULT_SET */ {MAP_CHAR_LEN("ResultSet")},
+/* 0641 UNO_NAME_CONNECTION */ {MAP_CHAR_LEN("ActiveConnection")},
+/* 0642 UNO_NAME_MODEL */ {MAP_CHAR_LEN("Model")},
+/* 0643 UNO_NAME_DATA_SOURCE_NAME */ {MAP_CHAR_LEN("DataSourceName")},
+/* 0644 UNO_NAME_DATA_COMMAND */ {MAP_CHAR_LEN("DataCommand")},
+/* 0645 UNO_NAME_FILTER */ {MAP_CHAR_LEN("Filter")},
+/* 0646 UNO_NAME_DOCUMENT_URL */ {MAP_CHAR_LEN("DocumentURL")},
+/* 0647 UNO_NAME_OUTPUT_URL */ {MAP_CHAR_LEN("OutputURL")},
+/* 0648 UNO_NAME_OUTPUT_TYPE */ {MAP_CHAR_LEN("OutputType")},
+/* 0649 UNO_NAME_ESCAPE_PROCESSING */ {MAP_CHAR_LEN("EscapeProcessing")},
+/* 0650 UNO_NAME_SINGLE_PRINT_JOBS */ {MAP_CHAR_LEN("SinglePrintJobs")},
+/* 0651 UNO_NAME_FILE_NAME_FROM_COLUMN */ {MAP_CHAR_LEN("FileNameFromColumn")},
+/* 0652 UNO_NAME_FILE_NAME_PREFIX */ {MAP_CHAR_LEN("FileNamePrefix")},
+/* 0653 UNO_NAME_CHAR_STYLE_NAMES */ {MAP_CHAR_LEN("CharStyleNames")},
+/* 0654 UNO_NAME_DAD_COMMAND */ {MAP_CHAR_LEN("Command")},
+/* 0655 UNO_NAME_DAD_COMMAND_TYPE */ {MAP_CHAR_LEN("CommandType")},
+/* 0656 UNO_NAME_CLSID*/ {MAP_CHAR_LEN("CLSID")},
+/* 0657 UNO_NAME_COMPONENT*/ {MAP_CHAR_LEN("Component")},
+/* 0658 UNO_NAME_SECT_LEFT_MARGIN*/ {MAP_CHAR_LEN("SectionLeftMargin")},
+/* 0659 UNO_NAME_SECT_RIGHT_MARGIN*/ {MAP_CHAR_LEN("SectionRightMargin")},
+/* 0660 UNO_NAME_PARA_IS_CONNECT_BORDER */{MAP_CHAR_LEN("ParaIsConnectBorder")},
+/* 0661 UNO_NAME_ITEMS*/ {MAP_CHAR_LEN("Items")},
+/* 0662 UNO_NAME_SELITEM*/ {MAP_CHAR_LEN("SelectedItem")},
+/* 0663 UNO_NAME_IS_SPLIT_ALLOWED*/ {MAP_CHAR_LEN("IsSplitAllowed")},
+/* 0664 UNO_NAME_CHAR_HIDDEN*/ {MAP_CHAR_LEN("CharHidden")},
+/* 0665 UNO_NAME_IS_FOLLOWING_TEXT_FLOW*/ {MAP_CHAR_LEN("IsFollowingTextFlow")},
+/* 0666 UNO_NAME_WIDTH_TYPE*/ {MAP_CHAR_LEN("WidthType")},
+/* 0667 UNO_NAME_SCRIPT_URL */ {MAP_CHAR_LEN("ScriptURL")},
+/* 0668 UNO_NAME_RUNTIME_UID*/ {MAP_CHAR_LEN("RuntimeUID")},
+/* 0669 UNO_NAME_COLLAPSING_BORDERS*/ {MAP_CHAR_LEN("CollapsingBorders")},
+/* 0670 UNO_NAME_WRAP_INFLUENCE_ON_POSITION*/ {MAP_CHAR_LEN("WrapInfluenceOnPosition")},
+/* 0671 DATA_BASE_URL */ {MAP_CHAR_LEN("DataBaseURL")},
+/* 0672 DATA_BASE_RESOURCE */ {MAP_CHAR_LEN("DataBaseResource")},
+/* 0673 UNO_NAME_TRANSFORMATION_IN_HORI_L2R*/ {MAP_CHAR_LEN("TransformationInHoriL2R")},
+/* 0674 UNO_NAME_POSITION_LAYOUT_DIR*/ {MAP_CHAR_LEN("PositionLayoutDir")},
+/* 0675 UNO_NAME_NUMBERING_IS_OUTLINE*/ {MAP_CHAR_LEN("NumberingIsOutline")},
+///* 0676 UNO_NAME_DEFAULT_OUTLINE_LEVEL*/ {MAP_CHAR_LEN("DefaultOutlineLevel")}, //#outline level,removed by zhaojianwei
+/* 0677 UNO_NAME_STARTPOSITION_IN_HORI_L2R*/ {MAP_CHAR_LEN("StartPositionInHoriL2R")},
+/* 0678 UNO_NAME_ENDPOSITION_IN_HORI_L2R*/ {MAP_CHAR_LEN("EndPositionInHoriL2R")},
+/* 0679 UNO_NAME_SUBJECT */ {MAP_CHAR_LEN("Subject")},
+/* 0680 UNO_NAME_ADDRESS_FROM_COLUMN */ {MAP_CHAR_LEN("AddressFromColumn")},
+/* 0681 UNO_NAME_SEND_AS_HTML */ {MAP_CHAR_LEN("SendAsHTML")},
+/* 0682 UNO_NAME_SEND_AS_ATTACHMENT */ {MAP_CHAR_LEN("SendAsAttachment")},
+/* 0683 UNO_NAME_MAIL_BODY */ {MAP_CHAR_LEN("MailBody")},
+/* 0684 UNO_NAME_ATTACHMENT_NAME */ {MAP_CHAR_LEN("AttachmentName")},
+/* 0685 UNO_NAME_ATTACHMENT_FILTER */ {MAP_CHAR_LEN("AttachmentFilter")},
+/* 0686 UNO_NAME_PRINT_OPTIONS */ {MAP_CHAR_LEN("PrintOptions")},
+/* 0687 UNO_NAME_SAVE_AS_SINGLE_FILE */ {MAP_CHAR_LEN("SaveAsSingleFile")},
+/* 0688 UNO_NAME_SAVE_FILTER */ {MAP_CHAR_LEN("SaveFilter")},
+/* 0689 UNO_NAME_COPIES_TO */ {MAP_CHAR_LEN("CopiesTo")},
+/* 0690 UNO_NAME_BLIND_COPIES_TO */ {MAP_CHAR_LEN("BlindCopiesTo")},
+/* 0691 UNO_NAME_IN_SERVER_PASSWORD */ {MAP_CHAR_LEN("InServerPassword")},
+/* 0692 UNO_NAME_OUT_SERVER_PASSWORD */ {MAP_CHAR_LEN("OutServerPassword")},
+/* 0693 UNO_NAME_SAVE_FILTER_OPTIONS */ {MAP_CHAR_LEN("SaveFilterOptions")},
+/* 0694 UNO_NAME_SAVE_FILTER_DATA */ {MAP_CHAR_LEN("SaveFilterData")},
+/* 0695 UNO_NAME_LOCK_UPDATES */ {MAP_CHAR_LEN("LockUpdates")},
+/* 0696 UNO_NAME_PAGE_COUNT*/ {MAP_CHAR_LEN("PageCount")},
+/* 0697 UNO_NAME_LINE_COUNT*/ {MAP_CHAR_LEN("LineCount")},
+/* 0698 UNO_NAME_IS_CONSTANT_SPELLCHECK*/ {MAP_CHAR_LEN("IsConstantSpellcheck")},
+/* 0699 UNO_NAME_IS_HIDE_SPELL_MARKS*/ {MAP_CHAR_LEN("IsHideSpellMarks")}, /* deprecated #i91949 */
+/* 0700 UNO_NAME_IS_FIELD_USED */ {MAP_CHAR_LEN("IsFieldUsed")},
+/* 0701 UNO_NAME_IS_FIELD_DISPLAYED */ {MAP_CHAR_LEN("IsFieldDisplayed")},
+/* 0702 UNO_NAME_BUILDID */ {MAP_CHAR_LEN("BuildId")},
+/* 0703 UNO_NAME_PARA_STYLE_CONDITIONS*/ {MAP_CHAR_LEN("ParaStyleConditions")},
+/* 0704 UNO_NAME_PRINT_EMPTY_PAGES*/ {MAP_CHAR_LEN("PrintEmptyPages")},
+/* 0705 UNO_NAME_ROLE */ {MAP_CHAR_LEN("Role")},
+/* 0706 UNO_NAME_FIELD_CODE*/ {MAP_CHAR_LEN("FieldCode")},
+/* 0707 UNO_NAME_HAS_VALID_SIGNATURES*/ {MAP_CHAR_LEN("HasValidSignatures")},
+/* 0708 UNO_CHAR_AUTO_STYLE_NAME */ {MAP_CHAR_LEN("CharAutoStyleName")},
+/* 0709 UNO_PARA_AUTO_STYLE_NAME */ {MAP_CHAR_LEN("ParaAutoStyleName")},
+/* 0710 UNO_NAME_APPLY_WORKAROUND_FOR_B6375613*/ {MAP_CHAR_LEN("ApplyWorkaroundForB6375613")},
+/* 0711 UNO_NAME_LAYOUT_SIZE*/ {MAP_CHAR_LEN("LayoutSize")},
+/* 0712 UNO_NAME_HELP */ {MAP_CHAR_LEN("Help")},
+/* 0713 UNO_NAME_TOOLTIP */ {MAP_CHAR_LEN("Tooltip")},
+/* 0714 UNO_NAME_DIALOG_LIBRARIES*/ {MAP_CHAR_LEN("DialogLibraries")},
+/* 0715 UNO_NAME_HEADER_ROW_COUNT*/ {MAP_CHAR_LEN("HeaderRowCount")},
+/* 0716 UNO_NAME_INPUT */ {MAP_CHAR_LEN("Input")},
+/* 0717 UNO_NAME_ROW_SPAN */ {MAP_CHAR_LEN("RowSpan")},
+/* 0718 UNO_NAME_POSITION_AND_SPACE_MODE */ {MAP_CHAR_LEN("PositionAndSpaceMode")},
+/* 0719 UNO_NAME_LABEL_FOLLOWED_BY */ {MAP_CHAR_LEN("LabelFollowedBy")},
+/* 0720 UNO_NAME_LISTTAB_STOP_POSITION */ {MAP_CHAR_LEN("ListtabStopPosition")},
+/* 0721 UNO_NAME_FIRST_LINE_INDENT */ {MAP_CHAR_LEN("FirstLineIndent")},
+/* 0722 UNO_NAME_INDENT_AT */ {MAP_CHAR_LEN("IndentAt")},
+/* 0723 UNO_NAME_CHAPTER_LEVEL */ {MAP_CHAR_LEN("ChapterLevel")},
+/* 0724 UNO_NAME_GRID_BASE_WIDTH*/ {MAP_CHAR_LEN("GridBaseWidth")},
+/* 0725 UNO_NAME_GRID_SNAP_TO_CHARS*/ {MAP_CHAR_LEN("GridSnapToChars")},
+/* 0726 UNO_NAME_GRID_STANDARD_PAGE_MODE*/ {MAP_CHAR_LEN("StandardPageMode")},
+/* 0727 UNO_NAME_TABLE_BORDER_DISTANCES */ {MAP_CHAR_LEN("TableBorderDistances")},
+/* 0728 UNO_NAME_LIST_ID*/ {MAP_CHAR_LEN("ListId")},
+/* 0729 UNO_NAME_DEFAULT_LIST_ID*/ {MAP_CHAR_LEN("DefaultListId")},
+/* 0730 UNO_NAME_STREAM_NAME */ {MAP_CHAR_LEN("StreamName")},
+/* 0731 UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE */ {MAP_CHAR_LEN("ContinueingPreviousSubTree")},
+/* 0732 UNO_NAME_PARA_LIST_LABEL_STRING */ {MAP_CHAR_LEN("ListLabelString")},
+/* 0733 CHAR_OVERLINE */ {MAP_CHAR_LEN("CharOverline")},
+/* 0734 CHAR_OVERLINE_COLOR */ {MAP_CHAR_LEN("CharOverlineColor")},
+/* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")},
+/* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
+/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
+/* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")},
+/* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
+};
+
+const SwPropNameLen& SwGetPropName( USHORT nId )
+{
+ return GetPropName( nId );
+}
+const SwPropNameLen& GetPropName( USHORT nId )
+{
+ DBG_ASSERT( SW_PROPNAME_BEGIN <= nId && nId < SW_PROPNAME_END,
+ "GetPropName(): Wrong index" );
+ return aPropNameTab[ nId - SW_PROPNAME_BEGIN];
+}
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
new file mode 100644
index 000000000000..7f5efadada39
--- /dev/null
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -0,0 +1,794 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+
+#include <rtl/ustrbuf.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <pagedesc.hxx>
+#include "poolfmt.hxx"
+#include <redline.hxx>
+#include <section.hxx>
+#include <unoprnms.hxx>
+#include <unomid.h>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unoparagraph.hxx>
+#include <unocoll.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <unoredline.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXRedlineText::SwXRedlineText(SwDoc* _pDoc, SwNodeIndex aIndex) :
+ SwXText(_pDoc, CURSOR_REDLINE),
+ aNodeIndex(aIndex)
+{
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwStartNode* SwXRedlineText::GetStartNode() const
+{
+ return aNodeIndex.GetNode().GetStartNode();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXRedlineText::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ uno::Any aRet;
+
+ if (::getCppuType((uno::Reference<container::XEnumerationAccess> *)0) == rType)
+ {
+ uno::Reference<container::XEnumerationAccess> aAccess = this;
+ aRet <<= aAccess;
+ }
+ else
+ {
+ // delegate to SwXText and OWeakObject
+ aRet = SwXText::queryInterface(rType);
+ if(!aRet.hasValue())
+ {
+ aRet = OWeakObject::queryInterface(rType);
+ }
+ }
+
+ return aRet;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence<uno::Type> SwXRedlineText::getTypes()
+ throw(uno::RuntimeException)
+{
+ // SwXText::getTypes()
+ uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
+
+ // add container::XEnumerationAccess
+ sal_Int32 nLength = aTypes.getLength();
+ aTypes.realloc(nLength + 1);
+ aTypes[nLength] = ::getCppuType((uno::Reference<container::XEnumerationAccess> *)0);
+
+ return aTypes;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence<sal_Int8> SwXRedlineText::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwPosition aPos(aNodeIndex);
+ SwXTextCursor *const pXCursor =
+ new SwXTextCursor(*GetDoc(), this, CURSOR_REDLINE, aPos);
+ SwUnoCrsr *const pUnoCursor = pXCursor->GetCursor();
+ pUnoCursor->Move(fnMoveForward, fnGoNode);
+
+ // #101929# prevent a newly created text cursor from running inside a table
+ // because table cells have their own XText.
+ // Patterned after SwXTextFrame::createTextCursor(void).
+
+ // skip all tables at the beginning
+ SwTableNode* pTableNode = pUnoCursor->GetNode()->FindTableNode();
+ SwCntntNode* pContentNode = NULL;
+ bool bTable = pTableNode != NULL;
+ while( pTableNode != NULL )
+ {
+ pUnoCursor->GetPoint()->nNode = *(pTableNode->EndOfSectionNode());
+ pContentNode = GetDoc()->GetNodes().GoNext(&pUnoCursor->GetPoint()->nNode);
+ pTableNode = pContentNode->FindTableNode();
+ }
+ if( pContentNode != NULL )
+ pUnoCursor->GetPoint()->nContent.Assign( pContentNode, 0 );
+ if( bTable && pUnoCursor->GetNode()->FindSttNodeByType( SwNormalStartNode )
+ != GetStartNode() )
+ {
+ // We have gone too far and have left our own redline. This means that
+ // no content node outside of a table could be found, and therefore we
+ // except.
+ uno::RuntimeException aExcept;
+ aExcept.Message = OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "No content node found that is inside this change section "
+ "but outside of a table" ) );
+ throw aExcept;
+ }
+
+ return static_cast<text::XWordCursor*>(pXCursor);
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursorByRange(
+ const uno::Reference<text::XTextRange> & aTextRange)
+ throw( uno::RuntimeException )
+{
+ uno::Reference<text::XTextCursor> xCursor = createTextCursor();
+ xCursor->gotoRange(aTextRange->getStart(), sal_False);
+ xCursor->gotoRange(aTextRange->getEnd(), sal_True);
+ return xCursor;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<container::XEnumeration> SwXRedlineText::createEnumeration(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwPaM aPam(aNodeIndex);
+ aPam.Move(fnMoveForward, fnGoNode);
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(*aPam.Start(), sal_False));
+ return new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_REDLINE);
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Type SwXRedlineText::getElementType( ) throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<text::XTextRange>*)0);
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXRedlineText::hasElements( ) throw(uno::RuntimeException)
+{
+ return sal_True; // we always have a content index
+}
+/* -----------------------------19.12.00 11:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXRedlinePortion::SwXRedlinePortion( const SwRedline* pRed,
+ const SwUnoCrsr* pPortionCrsr,
+ uno::Reference< text::XText > xParent, BOOL bStart) :
+ SwXTextPortion(pPortionCrsr, xParent, bStart ? PORTION_REDLINE_START : PORTION_REDLINE_END),
+// SwXText(pPortionCrsr->GetDoc(), CURSOR_REDLINE),
+// SwXRedlineText(pPortionCrsr->GetDoc(), *pRed->GetContentIdx()),
+ pRedline(pRed)
+{
+ SetCollapsed(!pRedline->HasMark());
+}
+/*-- 19.12.00 11:37:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlinePortion::~SwXRedlinePortion()
+{
+}
+/* -----------------------------19.12.00 11:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static util::DateTime lcl_DateTimeToUno(const DateTime& rDT)
+{
+ util::DateTime aRetDT;
+ aRetDT.Year = rDT.GetYear();
+ aRetDT.Month= rDT.GetMonth();
+ aRetDT.Day = rDT.GetDay();
+ aRetDT.Hours = rDT.GetHour();
+ aRetDT.Minutes = rDT.GetMin();
+ aRetDT.Seconds = rDT.GetSec();
+ aRetDT.HundredthSeconds = rDT.Get100Sec();
+ return aRetDT;
+}
+
+// ---------------------------------------------------------------------------
+static OUString lcl_RedlineTypeToOUString(RedlineType_t eType)
+{
+ OUString sRet;
+ switch(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)
+ {
+ case nsRedlineType_t::REDLINE_INSERT: sRet = C2U("Insert"); break;
+ case nsRedlineType_t::REDLINE_DELETE: sRet = C2U("Delete"); break;
+ case nsRedlineType_t::REDLINE_FORMAT: sRet = C2U("Format"); break;
+ case nsRedlineType_t::REDLINE_TABLE: sRet = C2U("TextTable"); break;
+ case nsRedlineType_t::REDLINE_FMTCOLL:sRet = C2U("Style"); break;
+ }
+ return sRet;
+}
+
+// ---------------------------------------------------------------------------
+static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRedline& rRedline)
+{
+ uno::Sequence<beans::PropertyValue> aValues(4);
+
+ const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
+ if(pNext)
+ {
+ beans::PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_AUTHOR));
+ // GetAuthorString(n) walks the SwRedlineData* chain;
+ // here we always need element 1
+ pValues[0].Value <<= OUString(rRedline.GetAuthorString(1));
+ pValues[1].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_DATE_TIME));
+ pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp());
+ pValues[2].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_COMMENT));
+ pValues[2].Value <<= OUString(pNext->GetComment());
+ pValues[3].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TYPE));
+ pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType());
+ }
+ return aValues;
+}
+// ---------------------------------------------------------------------------
+uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ Validate();
+ uno::Any aRet;
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TEXT)))
+ {
+ SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
+ if(pNodeIdx )
+ {
+ if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
+ {
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx);
+ aRet <<= xRet;
+ }
+ else {
+ DBG_ASSERT(0, "Empty section in redline portion! (end node immediately follows start node)");
+ }
+ }
+ }
+ else
+ {
+ aRet = GetPropertyValue( rPropertyName, *pRedline);
+ if(!aRet.hasValue() &&
+ ! rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
+ aRet = SwXTextPortion::getPropertyValue(rPropertyName);
+ }
+ return aRet;
+}
+/* -----------------------------19.12.00 15:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
+{
+ SwUnoCrsr* pUnoCrsr = GetCursor();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+ //search for the redline
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
+ sal_Bool bFound = FALSE;
+ for(USHORT nRed = 0; nRed < rRedTbl.Count() && !bFound; nRed++)
+ bFound = pRedline == rRedTbl[nRed];
+ if(!bFound)
+ throw uno::RuntimeException();
+}
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL SwXRedlinePortion::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------11.01.01 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, const SwRedline& rRedline ) throw()
+{
+ uno::Any aRet;
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_AUTHOR)))
+ aRet <<= OUString(rRedline.GetAuthorString());
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_DATE_TIME)))
+ {
+ aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_COMMENT)))
+ aRet <<= OUString(rRedline.GetComment());
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TYPE)))
+ {
+ aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType());
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
+ {
+ if(rRedline.GetRedlineData().Next())
+ aRet <<= lcl_GetSuccessorProperties(rRedline);
+ }
+ else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_IDENTIFIER)))
+ {
+ OUStringBuffer sBuf;
+ sBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
+ aRet <<= sBuf.makeStringAndClear();
+ }
+ else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_IS_IN_HEADER_FOOTER)))
+ {
+ sal_Bool bRet =
+ rRedline.GetDoc()->IsInHeaderFooter( rRedline.GetPoint()->nNode );
+ aRet.setValue(&bRet, ::getBooleanCppuType());
+ }
+ else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_MERGE_LAST_PARA)))
+ {
+ sal_Bool bRet = !rRedline.IsDelLastPara();
+ aRet.setValue( &bRet, ::getBooleanCppuType() );
+ }
+ return aRet;
+}
+/* -----------------------------11.01.01 11:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties(
+ const SwRedline& rRedline, sal_Bool bIsStart ) throw()
+{
+ uno::Sequence< beans::PropertyValue > aRet(11);
+ const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
+ beans::PropertyValue* pRet = aRet.getArray();
+
+ OUStringBuffer sRedlineIdBuf;
+ sRedlineIdBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
+
+ sal_Int32 nPropIdx = 0;
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_AUTHOR));
+ pRet[nPropIdx++].Value <<= OUString(rRedline.GetAuthorString());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_DATE_TIME));
+ pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_COMMENT));
+ pRet[nPropIdx++].Value <<= OUString(rRedline.GetComment());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TYPE));
+ pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_IDENTIFIER));
+ pRet[nPropIdx++].Value <<= sRedlineIdBuf.makeStringAndClear();
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_IS_COLLAPSED));
+ sal_Bool bTmp = !rRedline.HasMark();
+ pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
+
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_IS_START));
+ pRet[nPropIdx++].Value.setValue(&bIsStart, ::getBooleanCppuType()) ;
+
+ bTmp = !rRedline.IsDelLastPara();
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_MERGE_LAST_PARA));
+ pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
+
+ SwNodeIndex* pNodeIdx = rRedline.GetContentIdx();
+ if(pNodeIdx )
+ {
+ if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
+ {
+ uno::Reference<text::XText> xRet = new SwXRedlineText(rRedline.GetDoc(), *pNodeIdx);
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TEXT));
+ pRet[nPropIdx++].Value <<= xRet;
+ }
+ else {
+ DBG_ASSERT(0, "Empty section in redline portion! (end node immediately follows start node)");
+ }
+ }
+ if(pNext)
+ {
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_SUCCESSOR_DATA));
+ pRet[nPropIdx++].Value <<= lcl_GetSuccessorProperties(rRedline);
+ }
+ aRet.realloc(nPropIdx);
+ return aRet;
+}
+/*-- 11.01.01 17:06:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TYPEINIT1(SwXRedline, SwClient);
+SwXRedline::SwXRedline(SwRedline& rRedline, SwDoc& rDoc) :
+ SwXText(&rDoc, CURSOR_REDLINE),
+ pDoc(&rDoc),
+ pRedline(&rRedline)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 11.01.01 17:06:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedline::~SwXRedline()
+{
+}
+/*-- 11.01.01 17:06:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXRedline::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_REDLINE)->getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.01.01 17:06:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedline::setPropertyValue( const OUString& rPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_AUTHOR)))
+ {
+ DBG_ERROR("currently not available");
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_DATE_TIME)))
+ {
+ DBG_ERROR("currently not available");
+// util::DateTime aDT;
+// if(aValue >>= aDT)
+// pRedline->SetTimeStamp(lcl_DateTimeFromUno(aDT));
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_COMMENT)))
+ {
+ OUString sTmp; aValue >>= sTmp;
+ pRedline->SetComment(sTmp);
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TYPE)))
+ {
+ DBG_ERROR("currently not available");
+ OUString sTmp; aValue >>= sTmp;
+ if(!sTmp.getLength())
+ throw lang::IllegalArgumentException();
+// pRedline->SetType(lcl_OUStringToRedlineType(sTmp));
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
+ {
+ DBG_ERROR("currently not available");
+/* SwRedlineData* pNext = pRedline->GetRedlineData().Next();
+ uno::Sequence<beans::PropertyValue> aValues;
+ if(!(aValue =>> aValues) || !pNext)
+ throw lang::IllegalArgumentException();
+
+ const beans::PropertyValue* pValues = aValues.getConstArray();
+ for(sal_Int32 nValue = 0; nValue < aValues.getLength(); nValue++)
+ {
+ if(pValues[nValue].Name.equalsAscii(UNO_NAME_REDLINE_AUTHOR.pName)
+ {
+ DBG_ERROR("currently not available");
+ }
+ else if(pValues[nValue].Name.equalsAscii(UNO_NAME_REDLINE_DATE_TIME.pName))
+ {
+ util::DateTime aDT;
+ if(pValues[nValue].Value >>= aDT)
+ pNext->SetTimeStamp(lcl_DateTimeFromUno(aDT));
+ }
+ else if(pValues[nValue].Name.equalsAscii(UNO_NAME_REDLINE_COMMENT.pName))
+ {
+ OUString sTmp; pValues[nValue].Value >>= sTmp;
+ pNext->SetComment(sTmp);
+ }
+ else if(pValues[nValue].Name.equalsAscii(UNO_NAME_REDLINE_TYPE.pName))
+ {
+ OUString sTmp; pValues[nValue].Value >>= sTmp;
+ pNext->SetType(lcl_OUStringToRedlineType(sTmp);
+ }
+ }
+*/ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+}
+/*-- 11.01.01 17:06:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+ uno::Any aRet;
+ BOOL bStart = rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_START));
+ if(bStart ||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_END)))
+ {
+ uno::Reference<XInterface> xRet;
+ SwNode* pNode = pRedline->GetNode();
+ if(!bStart && pRedline->HasMark())
+ pNode = pRedline->GetNode(FALSE);
+ switch(pNode->GetNodeType())
+ {
+ case ND_SECTIONNODE:
+ {
+ SwSectionNode* pSectNode = pNode->GetSectionNode();
+ DBG_ASSERT(pSectNode, "No section node!");
+ xRet = SwXTextSections::GetObject( *pSectNode->GetSection().GetFmt() );
+ }
+ break;
+ case ND_TABLENODE :
+ {
+ SwTableNode* pTblNode = pNode->GetTableNode();
+ DBG_ASSERT(pTblNode, "No table node!");
+ SwTable& rTbl = pTblNode->GetTable();
+ SwFrmFmt* pTblFmt = rTbl.GetFrmFmt();
+ xRet = SwXTextTables::GetObject( *pTblFmt );
+ }
+ break;
+ case ND_TEXTNODE :
+ {
+ SwPosition* pPoint = 0;
+ if(bStart || !pRedline->HasMark())
+ pPoint = pRedline->GetPoint();
+ else
+ pPoint = pRedline->GetMark();
+ const uno::Reference<text::XTextRange> xRange =
+ SwXTextRange::CreateXTextRange(*pDoc, *pPoint, 0);
+ xRet = xRange.get();
+ }
+ break;
+ default:
+ DBG_ERROR("illegal node type");
+ }
+ aRet <<= xRet;
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TEXT)))
+ {
+ SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
+ if( pNodeIdx )
+ {
+ if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
+ {
+ uno::Reference<text::XText> xRet = new SwXRedlineText(pDoc, *pNodeIdx);
+ aRet <<= xRet;
+ }
+ else {
+ DBG_ASSERT(0, "Empty section in redline portion! (end node immediately follows start node)");
+ }
+ }
+ }
+ else
+ aRet = SwXRedlinePortion::GetPropertyValue(rPropertyName, *pRedline);
+ return aRet;
+}
+/*-- 11.01.01 17:06:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedline::addPropertyChangeListener(
+ const OUString& /*aPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 11.01.01 17:06:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedline::removePropertyChangeListener(
+ const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 11.01.01 17:06:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedline::addVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 11.01.01 17:06:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedline::removeVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 11.01.01 17:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedline::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ pDoc = 0;
+ pRedline = 0;
+ }
+}
+/*-- 19.12.00 11:37:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXRedline::createEnumeration(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< container::XEnumeration > xRet;
+ if(!pDoc)
+ throw uno::RuntimeException();
+
+ SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
+ if(pNodeIndex)
+ {
+ SwPaM aPam(*pNodeIndex);
+ aPam.Move(fnMoveForward, fnGoNode);
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(*aPam.Start(), sal_False));
+ xRet = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_REDLINE);
+ }
+ return xRet;
+}
+/* -----------------------------19.12.00 12:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Type SwXRedline::getElementType( ) throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<text::XTextRange>*)0);
+}
+/* -----------------------------19.12.00 12:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXRedline::hasElements( ) throw(uno::RuntimeException)
+{
+ if(!pDoc)
+ throw uno::RuntimeException();
+ return 0 != pRedline->GetContentIdx();
+}
+/* -----------------------------19.12.00 15:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXRedline::createTextCursor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pDoc)
+ throw uno::RuntimeException();
+
+ uno::Reference< text::XTextCursor > xRet;
+ SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
+ if(pNodeIndex)
+ {
+ SwPosition aPos(*pNodeIndex);
+ SwXTextCursor *const pXCursor =
+ new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos);
+ SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+
+ //steht hier eine Tabelle?
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
+ xRet = static_cast<text::XWordCursor*>(pXCursor);
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return xRet;
+}
+/* -----------------------------19.12.00 15:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXRedline::createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & /*aTextPosition*/)
+ throw( uno::RuntimeException )
+{
+ throw uno::RuntimeException();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXRedline::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ uno::Any aRet = SwXText::queryInterface(rType);
+ if(!aRet.hasValue())
+ {
+ aRet = SwXRedlineBaseClass::queryInterface(rType);
+ }
+ return aRet;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence<uno::Type> SwXRedline::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
+ uno::Sequence<uno::Type> aBaseTypes = SwXRedlineBaseClass::getTypes();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+ sal_Int32 nCurType = aTypes.getLength();
+ aTypes.realloc(aTypes.getLength() + aBaseTypes.getLength());
+ uno::Type* pTypes = aTypes.getArray();
+ for(sal_Int32 nType = 0; nType < aBaseTypes.getLength(); nType++)
+ pTypes[nCurType++] = pBaseTypes[nType];
+ return aTypes;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence<sal_Int8> SwXRedline::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
diff --git a/sw/source/core/unocore/unoredlines.cxx b/sw/source/core/unocore/unoredlines.cxx
new file mode 100644
index 000000000000..91fbcfa0f5f7
--- /dev/null
+++ b/sw/source/core/unocore/unoredlines.cxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <tools/debug.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <unoredlines.hxx>
+#include <unoredline.hxx>
+#include <unomid.h>
+#include <pagedesc.hxx>
+#include "poolfmt.hxx"
+#include <doc.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/*-- 11.01.01 15:28:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlines::SwXRedlines(SwDoc* _pDoc) :
+ SwUnoCollection(_pDoc)
+{
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlines::~SwXRedlines()
+{
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXRedlines::getCount( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ return rRedTbl.Count();
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXRedlines::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ uno::Any aRet;
+ if(rRedTbl.Count() > nIndex && nIndex >= 0)
+ {
+ uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl.GetObject((USHORT)nIndex), *GetDoc() );
+ aRet <<= xRet;
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+ return aRet;
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXRedlines::createEnumeration(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return uno::Reference< container::XEnumeration >(new SwXRedlineEnumeration(*GetDoc()));
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXRedlines::getElementType( ) throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<beans::XPropertySet>*)0);
+}
+/*-- 11.01.01 15:28:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXRedlines::hasElements( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ return rRedTbl.Count() > 0;
+}
+/*-- 11.01.01 15:28:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXRedlines::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXRedlines");
+}
+/*-- 11.01.01 15:28:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXRedlines::supportsService(const rtl::OUString& /*ServiceName*/)
+ throw( uno::RuntimeException )
+{
+ DBG_ERROR("not implemented");
+ return FALSE;
+}
+/*-- 11.01.01 15:28:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXRedlines::getSupportedServiceNames(void)
+ throw( uno::RuntimeException )
+{
+ DBG_ERROR("not implemented");
+ return uno::Sequence< OUString >();
+}
+/*-- 11.01.01 15:28:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::XPropertySet* SwXRedlines::GetObject( SwRedline& rRedline, SwDoc& rDoc )
+{
+ SwPageDesc* pStdDesc = rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD);
+ SwClientIter aIter(*pStdDesc);
+ SwXRedline* pxRedline = (SwXRedline*)aIter.First( TYPE( SwXRedline ));
+ while(pxRedline)
+ {
+ if(pxRedline->GetRedline() == &rRedline)
+ break;
+ pxRedline = (SwXRedline*)aIter.Next();
+ }
+ if( !pxRedline )
+ pxRedline = new SwXRedline(rRedline, rDoc);
+ return pxRedline;
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlineEnumeration::SwXRedlineEnumeration(SwDoc& rDoc) :
+ pDoc(&rDoc),
+ nCurrentIndex(0)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlineEnumeration::~SwXRedlineEnumeration()
+{
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXRedlineEnumeration::hasMoreElements(void) throw( uno::RuntimeException )
+{
+ if(!pDoc)
+ throw uno::RuntimeException();
+ return pDoc->GetRedlineTbl().Count() > nCurrentIndex;
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXRedlineEnumeration::nextElement(void)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if(!pDoc)
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
+ if(!(rRedTbl.Count() > nCurrentIndex))
+ throw container::NoSuchElementException();
+ uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl.GetObject(nCurrentIndex++), *pDoc );
+ uno::Any aRet;
+ aRet <<= xRet;
+ return aRet;
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+rtl::OUString SwXRedlineEnumeration::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXRedlineEnumeration");
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXRedlineEnumeration::supportsService(const rtl::OUString& /*ServiceName*/) throw( uno::RuntimeException )
+{
+ return FALSE;
+}
+/*-- 12.01.01 15:06:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXRedlineEnumeration::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ return uno::Sequence< OUString >();
+}
+/*-- 12.01.01 15:06:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedlineEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ pDoc = 0;
+}
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
new file mode 100644
index 000000000000..25ce3ec6c441
--- /dev/null
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -0,0 +1,1708 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <unomid.h>
+#include <unotextrange.hxx>
+#include <unorefmark.hxx>
+#include <unotextcursor.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <unoevtlstnr.hxx>
+#include <unocrsrhelper.hxx>
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <hints.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/******************************************************************
+ * SwXReferenceMark
+ ******************************************************************/
+
+class SwXReferenceMark::Impl
+ : public SwClient
+{
+
+public:
+ SwEventListenerContainer m_ListenerContainer;
+ bool m_bIsDescriptor;
+ SwDoc * m_pDoc;
+ const SwFmtRefMark * m_pMarkFmt;
+ ::rtl::OUString m_sMarkName;
+
+ Impl( SwXReferenceMark & rThis,
+ SwDoc *const pDoc, SwFmtRefMark const*const pRefMark)
+ : SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
+ , m_bIsDescriptor((0 == pRefMark) ? true : false)
+ , m_pDoc(pDoc)
+ , m_pMarkFmt(pRefMark)
+ {
+ if (pRefMark)
+ {
+ m_sMarkName = pRefMark->GetRefName();
+ }
+ }
+
+ bool IsValid() const { return 0 != GetRegisteredIn(); }
+ void InsertRefMark( SwPaM & rPam, SwXTextCursor const*const pCursor );
+ void Invalidate();
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/* -----------------------------07.01.00 12:51--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXReferenceMark::Impl::Invalidate()
+{
+ if (IsValid())
+ {
+ const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
+ }
+ m_ListenerContainer.Disposing();
+ m_pDoc = 0;
+ m_pMarkFmt = 0;
+}
+
+/*-- 11.12.98 10:28:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXReferenceMark::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn()) // removed => dispose
+ {
+ Invalidate();
+ }
+ else if (pOld)
+ {
+ switch (pOld->Which())
+ {
+ case RES_REFMARK_DELETED:
+ if (static_cast<const void*>(m_pMarkFmt) ==
+ static_cast<SwPtrMsgPoolItem *>(pOld)->pObject)
+ {
+ Invalidate();
+ }
+ break;
+ }
+ }
+}
+
+
+/*-- 11.12.98 10:28:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXReferenceMark::SwXReferenceMark(
+ SwDoc *const pDoc, SwFmtRefMark const*const pRefMark)
+ : m_pImpl( new SwXReferenceMark::Impl(*this, pDoc, pRefMark) )
+{
+}
+
+/*-- 11.12.98 10:28:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXReferenceMark::~SwXReferenceMark()
+{
+}
+
+SwXReferenceMark *
+SwXReferenceMark::GetReferenceMark(
+ SwModify const& /*rUnoCB*/, SwFmtRefMark const& /*rMarkFmt*/)
+{
+ // #i105557#: do not iterate over the registered clients: race condition
+ // to do this properly requires the SwXReferenceMark to register at the
+ // SwFmtRefMark directly, not at the unocallback
+#if 0
+ SwClientIter aIter( rUnoCB );
+ SwXReferenceMark::Impl * pXMark =
+ static_cast<SwXReferenceMark::Impl*>(
+ aIter.First( TYPE( SwXReferenceMark::Impl ) ));
+ while (pXMark)
+ {
+ if (pXMark->m_pMarkFmt == &rMarkFmt)
+ {
+ return &pXMark->m_rThis;
+ }
+ pXMark = static_cast<SwXReferenceMark::Impl*>(aIter.Next());
+ }
+#endif
+ return 0;
+}
+
+SwXReferenceMark *
+SwXReferenceMark::CreateXReferenceMark(
+ SwDoc & rDoc, SwFmtRefMark const& rMarkFmt)
+{
+ SwXReferenceMark *const pXMark(
+ GetReferenceMark(*rDoc.GetUnoCallBack(), rMarkFmt) );
+ return (pXMark)
+ ? pXMark
+ : new SwXReferenceMark(&rDoc, &rMarkFmt);
+}
+
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXReferenceMark::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXReferenceMark::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXReferenceMark>(rId, this);
+}
+/* -----------------------------06.04.00 16:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL SwXReferenceMark::getImplementationName()
+throw (uno::RuntimeException)
+{
+ return C2U("SwXReferenceMark");
+}
+/* -----------------------------06.04.00 16:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesReferenceMark[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.ReferenceMark",
+};
+static const size_t g_nServicesReferenceMark(
+ sizeof(g_ServicesReferenceMark)/sizeof(g_ServicesReferenceMark[0]));
+
+sal_Bool SAL_CALL
+SwXReferenceMark::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesReferenceMark, g_ServicesReferenceMark, rServiceName);
+}
+/* -----------------------------06.04.00 16:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXReferenceMark::getSupportedServiceNames()
+throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesReferenceMark, g_ServicesReferenceMark);
+}
+
+/* -----------------03.11.99 14:14-------------------
+
+ --------------------------------------------------*/
+template<typename T> struct NotContainedIn
+{
+ ::std::vector<T> const& m_rVector;
+ explicit NotContainedIn(::std::vector<T> const& rVector)
+ : m_rVector(rVector) { }
+ bool operator() (T const& rT) {
+ return ::std::find(m_rVector.begin(), m_rVector.end(), rT)
+ == m_rVector.end();
+ }
+};
+
+void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
+ SwXTextCursor const*const pCursor)
+{
+ //! in some cases when this function is called the pDoc pointer member may have become
+ //! invalid/deleted thus we obtain the document pointer from rPaM where it should always
+ //! be valid.
+ SwDoc *pDoc2 = rPam.GetDoc();
+
+ UnoActionContext aCont(pDoc2);
+ SwFmtRefMark aRefMark(m_sMarkName);
+ sal_Bool bMark = *rPam.GetPoint() != *rPam.GetMark();
+
+ const bool bForceExpandHints( (!bMark && pCursor)
+ ? pCursor->IsAtEndOfMeta() : false );
+ const SetAttrMode nInsertFlags = (bForceExpandHints)
+ ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ | nsSetAttrMode::SETATTR_DONTEXPAND)
+ : nsSetAttrMode::SETATTR_DONTEXPAND;
+
+ ::std::vector<SwTxtAttr *> oldMarks;
+ if (bMark)
+ {
+ oldMarks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK);
+ }
+
+ pDoc2->InsertPoolItem( rPam, aRefMark, nInsertFlags );
+
+ if( bMark && *rPam.GetPoint() > *rPam.GetMark())
+ {
+ rPam.Exchange();
+ }
+
+ // aRefMark was copied into the document pool; now retrieve real format...
+ SwTxtAttr * pTxtAttr(0);
+ if (bMark)
+ {
+ // #i107672#
+ // ensure that we do not retrieve a different mark at the same position
+ ::std::vector<SwTxtAttr *> const newMarks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
+ ::std::vector<SwTxtAttr *>::const_iterator const iter(
+ ::std::find_if(newMarks.begin(), newMarks.end(),
+ NotContainedIn<SwTxtAttr *>(oldMarks)));
+ OSL_ASSERT(newMarks.end() != iter);
+ if (newMarks.end() != iter)
+ {
+ pTxtAttr = *iter;
+ }
+ }
+ else
+ {
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rPam.GetPoint()->nContent.GetIndex() - 1, RES_TXTATR_REFMARK);
+ }
+
+ if (!pTxtAttr)
+ {
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXReferenceMark::InsertRefMark(): cannot insert attribute")), 0);
+ }
+
+ m_pMarkFmt = &pTxtAttr->GetRefMark();
+
+ pDoc2->GetUnoCallBack()->Add(this);
+}
+
+/*-- 11.12.98 10:28:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXReferenceMark::attach(const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ }
+ SwDoc *const pDocument =
+ (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
+ if (!pDocument)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwUnoInternalPaM aPam(*pDocument);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+ m_pImpl->InsertRefMark(aPam, dynamic_cast<SwXTextCursor*>(pCursor));
+ m_pImpl->m_bIsDescriptor = sal_False;
+ m_pImpl->m_pDoc = pDocument;
+}
+
+/*-- 11.12.98 10:28:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXReferenceMark::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (m_pImpl->IsValid())
+ {
+ SwFmtRefMark const*const pNewMark =
+ m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName);
+ if (pNewMark && (pNewMark == m_pImpl->m_pMarkFmt))
+ {
+ SwTxtRefMark const*const pTxtMark =
+ m_pImpl->m_pMarkFmt->GetTxtRefMark();
+ if (pTxtMark &&
+ (&pTxtMark->GetTxtNode().GetNodes() ==
+ &m_pImpl->m_pDoc->GetNodes()))
+ {
+ SwTxtNode const& rTxtNode = pTxtMark->GetTxtNode();
+ const ::std::auto_ptr<SwPaM> pPam( (pTxtMark->GetEnd())
+ ? new SwPaM( rTxtNode, *pTxtMark->GetEnd(),
+ rTxtNode, *pTxtMark->GetStart())
+ : new SwPaM( rTxtNode, *pTxtMark->GetStart()) );
+
+ return SwXTextRange::CreateXTextRange(
+ *m_pImpl->m_pDoc, *pPam->Start(), pPam->End());
+ }
+ }
+ }
+ return 0;
+}
+/*-- 11.12.98 10:28:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (m_pImpl->IsValid())
+ {
+ SwFmtRefMark const*const pNewMark =
+ m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName);
+ if (pNewMark && (pNewMark == m_pImpl->m_pMarkFmt))
+ {
+ SwTxtRefMark const*const pTxtMark =
+ m_pImpl->m_pMarkFmt->GetTxtRefMark();
+ if (pTxtMark &&
+ (&pTxtMark->GetTxtNode().GetNodes() ==
+ &m_pImpl->m_pDoc->GetNodes()))
+ {
+ SwTxtNode const& rTxtNode = pTxtMark->GetTxtNode();
+ xub_StrLen nStt = *pTxtMark->GetStart(),
+ nEnd = pTxtMark->GetEnd() ? *pTxtMark->GetEnd()
+ : nStt + 1;
+
+ SwPaM aPam( rTxtNode, nStt, rTxtNode, nEnd );
+ m_pImpl->m_pDoc->DeleteAndJoin( aPam );
+ }
+ }
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->Invalidate();
+ }
+}
+/*-- 11.12.98 10:28:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->IsValid())
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+/*-- 11.12.98 10:28:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->IsValid() ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+/*-- 11.12.98 10:28:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXReferenceMark::getName()
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (!m_pImpl->IsValid() ||
+ !m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName))
+ {
+ throw uno::RuntimeException();
+ }
+ return m_pImpl->m_sMarkName;
+}
+/*-- 11.12.98 10:28:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::setName(const OUString& rName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_sMarkName = rName;
+ }
+ else
+ {
+ if (!m_pImpl->IsValid()
+ || !m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName)
+ || m_pImpl->m_pDoc->GetRefMark(rName))
+ {
+ throw uno::RuntimeException();
+ }
+ SwFmtRefMark const*const pCurMark =
+ m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName);
+ if ((rName != m_pImpl->m_sMarkName)
+ && pCurMark && (pCurMark == m_pImpl->m_pMarkFmt))
+ {
+ const UnoActionContext aCont(m_pImpl->m_pDoc);
+ SwTxtRefMark const*const pTxtMark =
+ m_pImpl->m_pMarkFmt->GetTxtRefMark();
+ if (pTxtMark &&
+ (&pTxtMark->GetTxtNode().GetNodes() ==
+ &m_pImpl->m_pDoc->GetNodes()))
+ {
+ SwTxtNode const& rTxtNode = pTxtMark->GetTxtNode();
+ xub_StrLen nStt = *pTxtMark->GetStart(),
+ nEnd = pTxtMark->GetEnd() ? *pTxtMark->GetEnd()
+ : nStt + 1;
+
+ SwPaM aPam( rTxtNode, nStt, rTxtNode, nEnd );
+ // deletes the m_pImpl->m_pDoc member in the SwXReferenceMark!
+ m_pImpl->m_pDoc->DeleteAndJoin( aPam );
+ // The aPam will keep the correct and functional doc though
+
+ m_pImpl->m_sMarkName = rName;
+ //create a new one
+ m_pImpl->InsertRefMark( aPam, 0 );
+ m_pImpl->m_pDoc = aPam.GetDoc();
+ }
+ }
+ }
+}
+
+/*-- 12.09.00 12:58:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXReferenceMark::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH_EXTENSIONS)
+ ->getPropertySetInfo();
+ return xRef;
+}
+/*-- 12.09.00 12:58:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::setPropertyValue(
+ const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ )
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw lang::IllegalArgumentException();
+}
+/*-- 12.09.00 12:58:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXReferenceMark::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // does not seem to need SolarMutex
+ uno::Any aRet;
+ if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
+ {
+ throw beans::UnknownPropertyException();
+ }
+ return aRet;
+}
+/*-- 12.09.00 12:58:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::addPropertyChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXReferenceMark::addPropertyChangeListener(): not implemented");
+}
+/*-- 12.09.00 12:58:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::removePropertyChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXReferenceMark::removePropertyChangeListener(): not implemented");
+}
+/*-- 12.09.00 12:58:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXReferenceMark::addVetoableChangeListener(): not implemented");
+}
+/*-- 12.09.00 12:58:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXReferenceMark::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXReferenceMark::removeVetoableChangeListener(): not implemented");
+}
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <unometa.hxx>
+#include <unotext.hxx>
+#include <unoport.hxx>
+#include <txtatr.hxx>
+#include <fmtmeta.hxx>
+#include <docsh.hxx>
+
+//=============================================================================
+
+/******************************************************************
+ * SwXMetaText
+ ******************************************************************/
+
+class SwXMetaText
+ : public SwXText
+{
+private:
+ SwXMeta & m_rMeta;
+
+ virtual void PrepareForAttach(uno::Reference< text::XTextRange > & xRange,
+ const SwPaM & rPam);
+
+ virtual bool CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb)
+ throw (lang::IllegalArgumentException, uno::RuntimeException);
+
+protected:
+ virtual const SwStartNode *GetStartNode() const;
+ virtual uno::Reference< text::XTextCursor >
+ CreateCursor() throw (uno::RuntimeException);
+
+public:
+ SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta);
+
+ /// make available for SwXMeta
+ void Invalidate() { SwXText::Invalidate(); };
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw()
+ { OSL_ENSURE(false, "ERROR: SwXMetaText::acquire"); }
+ virtual void SAL_CALL release() throw()
+ { OSL_ENSURE(false, "ERROR: SwXMetaText::release"); }
+
+ // XTypeProvider
+ virtual uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId() throw (uno::RuntimeException);
+
+ // XText
+ virtual uno::Reference< text::XTextCursor > SAL_CALL
+ createTextCursor() throw (uno::RuntimeException);
+ virtual uno::Reference< text::XTextCursor > SAL_CALL
+ createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & xTextPosition)
+ throw (uno::RuntimeException);
+
+ SwXMeta & GetXMeta() { return m_rMeta; }
+
+};
+
+SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta)
+ : SwXText(&rDoc, CURSOR_META)
+ , m_rMeta(rMeta)
+{
+}
+
+const SwStartNode *SwXMetaText::GetStartNode() const
+{
+ SwXText const * const pParent(
+ dynamic_cast<SwXText*>(m_rMeta.GetParentText().get()));
+ return (pParent) ? pParent->GetStartNode() : 0;
+}
+
+void SwXMetaText::PrepareForAttach( uno::Reference<text::XTextRange> & xRange,
+ const SwPaM & rPam)
+{
+ // create a new cursor to prevent modifying SwXTextRange
+ xRange = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), &m_rMeta, CURSOR_META, *rPam.GetPoint(),
+ (rPam.HasMark()) ? rPam.GetMark() : 0));
+}
+
+bool SwXMetaText::CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb)
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ return m_rMeta.CheckForOwnMemberMeta(rPam, bAbsorb);
+}
+
+uno::Reference< text::XTextCursor > SwXMetaText::CreateCursor()
+throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextCursor > xRet;
+ if (IsValid())
+ {
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(
+ m_rMeta.SetContentRange(pTxtNode, nMetaStart, nMetaEnd) );
+ if (bSuccess)
+ {
+ SwPosition aPos(*pTxtNode, nMetaStart);
+ xRet = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), &m_rMeta, CURSOR_META, aPos));
+ }
+ }
+ return xRet;
+}
+
+uno::Sequence<sal_Int8> SAL_CALL
+SwXMetaText::getImplementationId() throw (uno::RuntimeException)
+{
+ return m_rMeta.getImplementationId();
+}
+
+// XText
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMetaText::createTextCursor() throw (uno::RuntimeException)
+{
+ return CreateCursor();
+}
+
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMetaText::createTextCursorByRange(
+ const uno::Reference<text::XTextRange> & xTextPosition)
+ throw (uno::RuntimeException)
+{
+ const uno::Reference<text::XTextCursor> xCursor( CreateCursor() );
+ xCursor->gotoRange(xTextPosition, sal_False);
+ return xCursor;
+}
+
+/******************************************************************
+ * SwXMeta
+ ******************************************************************/
+
+// the Meta has a cached list of text portions for its contents
+// this list is created by SwXTextPortionEnumeration
+// the Meta listens at the SwTxtNode and throws away the cache when it changes
+
+class SwXMeta::Impl
+ : public SwClient
+{
+
+public:
+
+ SwEventListenerContainer m_ListenerContainer;
+ ::std::auto_ptr<const TextRangeList_t> m_pTextPortions;
+ // 3 possible states: not attached, attached, disposed
+ bool m_bIsDisposed;
+ bool m_bIsDescriptor;
+ uno::Reference<text::XText> m_xParentText;
+ SwXMetaText m_Text;
+
+ Impl( SwXMeta & rThis, SwDoc & rDoc,
+ ::sw::Meta * const pMeta,
+ uno::Reference<text::XText> const& xParentText,
+ TextRangeList_t const * const pPortions)
+ : SwClient(pMeta)
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_pTextPortions( pPortions )
+ , m_bIsDisposed( false )
+ // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
+ , m_bIsDescriptor((0 == pMeta) ? true : false)
+ , m_xParentText(xParentText)
+ , m_Text(rDoc, rThis)
+ {
+ }
+
+ inline const ::sw::Meta * GetMeta() const;
+ // only for SwXMetaField!
+ inline const ::sw::MetaField * GetMetaField() const;
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+inline const ::sw::Meta * SwXMeta::Impl::GetMeta() const
+{
+ return static_cast< const ::sw::Meta * >(GetRegisteredIn());
+}
+
+// SwModify
+void SwXMeta::Impl::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+{
+ m_pTextPortions.reset(); // throw away cache (SwTxtNode changed)
+
+ ClientModify(this, pOld, pNew);
+
+ if (!GetRegisteredIn()) // removed => dispose
+ {
+ m_ListenerContainer.Disposing();
+ m_bIsDisposed = true;
+ m_Text.Invalidate();
+ }
+}
+
+uno::Reference<text::XText> SwXMeta::GetParentText() const
+{
+ return m_pImpl->m_xParentText;
+}
+
+SwXMeta::SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
+ uno::Reference<text::XText> const& xParentText,
+ TextRangeList_t const*const pPortions)
+ : m_pImpl( new SwXMeta::Impl(*this, *pDoc, pMeta, xParentText, pPortions) )
+{
+}
+
+SwXMeta::SwXMeta(SwDoc *const pDoc)
+ : m_pImpl( new SwXMeta::Impl(*this, *pDoc, 0, 0, 0) )
+{
+}
+
+SwXMeta::~SwXMeta()
+{
+}
+
+uno::Reference<rdf::XMetadatable>
+SwXMeta::CreateXMeta(::sw::Meta & rMeta,
+ uno::Reference<text::XText> const& i_xParent,
+ ::std::auto_ptr<TextRangeList_t const> pPortions)
+{
+ // re-use existing SwXMeta
+ // #i105557#: do not iterate over the registered clients: race condition
+ uno::Reference<rdf::XMetadatable> xMeta(rMeta.GetXMeta());
+ if (xMeta.is())
+ {
+ if (pPortions.get()) // set cache in the XMeta to the given portions
+ {
+ const uno::Reference<lang::XUnoTunnel> xUT(xMeta, uno::UNO_QUERY);
+ SwXMeta *const pXMeta(
+ ::sw::UnoTunnelGetImplementation<SwXMeta>(xUT));
+ OSL_ENSURE(pXMeta, "no pXMeta?");
+ // NB: the meta must always be created with the complete content
+ // if SwXTextPortionEnumeration is created for a selection,
+ // it must be checked that the Meta is contained in the selection!
+ pXMeta->m_pImpl->m_pTextPortions = pPortions;
+ // ??? is this necessary?
+ if (pXMeta->m_pImpl->m_xParentText.get() != i_xParent.get())
+ {
+ OSL_ENSURE(false, "SwXMeta with different parent?");
+ pXMeta->m_pImpl->m_xParentText.set(i_xParent);
+ }
+ }
+ return xMeta;
+ }
+
+ // create new SwXMeta
+ SwTxtNode * const pTxtNode( rMeta.GetTxtNode() );
+ OSL_ENSURE(pTxtNode, "CreateXMeta: no text node?");
+ if (!pTxtNode) { return 0; }
+ uno::Reference<text::XText> xParentText(i_xParent);
+ if (!xParentText.is())
+ {
+ SwTxtMeta * const pTxtAttr( rMeta.GetTxtAttr() );
+ OSL_ENSURE(pTxtAttr, "CreateXMeta: no text attr?");
+ if (!pTxtAttr) { return 0; }
+ const SwPosition aPos(*pTxtNode, *pTxtAttr->GetStart());
+ xParentText.set( ::sw::CreateParentXText(*pTxtNode->GetDoc(), aPos) );
+ }
+ if (!xParentText.is()) { return 0; }
+ SwXMeta *const pXMeta( (RES_TXTATR_META == rMeta.GetFmtMeta()->Which())
+ ? new SwXMeta (pTxtNode->GetDoc(), &rMeta, xParentText,
+ pPortions.release()) // temporarily un-auto_ptr :-(
+ : new SwXMetaField(pTxtNode->GetDoc(), &rMeta, xParentText,
+ pPortions.release()));
+ // this is why the constructor is private: need to acquire pXMeta here
+ xMeta.set(pXMeta);
+ // in order to initialize the weak pointer cache in the core object
+ rMeta.SetXMeta(xMeta);
+ return xMeta;
+}
+
+
+bool SwXMeta::SetContentRange(
+ SwTxtNode *& rpNode, xub_StrLen & rStart, xub_StrLen & rEnd ) const
+{
+ ::sw::Meta const * const pMeta( m_pImpl->GetMeta() );
+ if (pMeta)
+ {
+ SwTxtMeta const * const pTxtAttr( pMeta->GetTxtAttr() );
+ if (pTxtAttr)
+ {
+ rpNode = pTxtAttr->GetTxtNode();
+ if (rpNode)
+ {
+ // rStart points at the first position _within_ the meta!
+ rStart = *pTxtAttr->GetStart() + 1;
+ rEnd = *pTxtAttr->GetEnd();
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool SwXMeta::CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb)
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess( SetContentRange(pTxtNode, nMetaStart, nMetaEnd) );
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ throw lang::DisposedException();
+
+ SwPosition const * const pStartPos( rPam.Start() );
+ if (&pStartPos->nNode.GetNode() != pTxtNode)
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but start "
+ "of text range not in same paragraph as text content"),
+ 0, 0);
+ }
+ bool bForceExpandHints(false);
+ const xub_StrLen nStartPos(pStartPos->nContent.GetIndex());
+ // not <= but < because nMetaStart is behind dummy char!
+ // not >= but > because == means insert at end!
+ if ((nStartPos < nMetaStart) || (nStartPos > nMetaEnd))
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but start "
+ "of text range not inside text content"),
+ 0, 0);
+ }
+ else if (nStartPos == nMetaEnd)
+ {
+ bForceExpandHints = true;
+ }
+ if (rPam.HasMark() && bAbsorb)
+ {
+ SwPosition const * const pEndPos( rPam.End() );
+ if (&pEndPos->nNode.GetNode() != pTxtNode)
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but end "
+ "of text range not in same paragraph as text content"),
+ 0, 0);
+ }
+ const xub_StrLen nEndPos(pEndPos->nContent.GetIndex());
+ // not <= but < because nMetaStart is behind dummy char!
+ // not >= but > because == means insert at end!
+ if ((nEndPos < nMetaStart) || (nEndPos > nMetaEnd))
+ {
+ throw lang::IllegalArgumentException(
+ C2U("trying to insert into a nesting text content, but end "
+ "of text range not inside text content"),
+ 0, 0);
+ }
+ else if (nEndPos == nMetaEnd)
+ {
+ bForceExpandHints = true;
+ }
+ }
+ return bForceExpandHints;
+}
+
+const uno::Sequence< sal_Int8 > & SwXMeta::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq( ::CreateUnoTunnelId() );
+ return aSeq;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL
+SwXMeta::getSomething( const uno::Sequence< sal_Int8 > & i_rId )
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXMeta>(i_rId, this);
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL
+SwXMeta::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXMeta");
+}
+
+static char const*const g_ServicesMeta[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.InContentMetadata",
+};
+static const size_t g_nServicesMeta(
+ sizeof(g_ServicesMeta)/sizeof(g_ServicesMeta[0]));
+
+sal_Bool SAL_CALL
+SwXMeta::supportsService(const ::rtl::OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesMeta, g_ServicesMeta, rServiceName);
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
+SwXMeta::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(g_nServicesMeta, g_ServicesMeta);
+}
+
+
+// XComponent
+void SAL_CALL
+SwXMeta::addEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+ if (m_pImpl->m_bIsDisposed)
+ {
+ m_pImpl->m_ListenerContainer.Disposing();
+ }
+}
+
+void SAL_CALL
+SwXMeta::removeEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDisposed)
+ {
+ m_pImpl->m_ListenerContainer.RemoveListener(xListener);
+ }
+}
+
+void SAL_CALL
+SwXMeta::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pTextPortions.reset();
+ m_pImpl->m_ListenerContainer.Disposing();
+ m_pImpl->m_bIsDisposed = true;
+ m_pImpl->m_Text.Invalidate();
+ }
+ else if (!m_pImpl->m_bIsDisposed)
+ {
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd));
+ ASSERT(bSuccess, "no pam?");
+ if (bSuccess)
+ {
+ // -1 because of CH_TXTATR
+ SwPaM aPam( *pTxtNode, nMetaStart - 1, *pTxtNode, nMetaEnd );
+ SwDoc * const pDoc( pTxtNode->GetDoc() );
+ pDoc->DeleteAndJoin( aPam );
+
+ // removal should call Modify and do the dispose
+ OSL_ENSURE(m_pImpl->m_bIsDisposed, "zombie meta");
+ }
+ }
+}
+
+
+void SAL_CALL
+SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
+ const USHORT i_nWhich)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDisposed)
+ {
+ throw lang::DisposedException();
+ }
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException(
+ C2S("SwXMeta::attach(): already attached"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel(i_xTextRange, uno::UNO_QUERY);
+ if (!xRangeTunnel.is())
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): argument is no XUnoTunnel"),
+ static_cast< ::cppu::OWeakObject* >(this), 0);
+ }
+ SwXTextRange *const pRange(
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel));
+ OTextCursorHelper *const pCursor( (pRange) ? 0 :
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel));
+ if (!pRange && !pCursor)
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): argument not supported type"),
+ static_cast< ::cppu::OWeakObject* >(this), 0);
+ }
+
+ SwDoc * const pDoc(
+ pRange ? pRange->GetDoc() : pCursor ? pCursor->GetDoc() : 0 );
+ if (!pDoc)
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): argument has no SwDoc"),
+ static_cast< ::cppu::OWeakObject* >(this), 0);
+ }
+
+ SwUnoInternalPaM aPam(*pDoc);
+ ::sw::XTextRangeToSwPaM(aPam, i_xTextRange);
+
+ UnoActionContext aContext(pDoc);
+
+ SwXTextCursor const*const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints((pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta() : false);
+ const SetAttrMode nInsertFlags( (bForceExpandHints)
+ ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
+ | nsSetAttrMode::SETATTR_DONTEXPAND)
+ : nsSetAttrMode::SETATTR_DONTEXPAND );
+
+ const ::boost::shared_ptr< ::sw::Meta> pMeta( (RES_TXTATR_META == i_nWhich)
+ ? ::boost::shared_ptr< ::sw::Meta>( new ::sw::Meta() )
+ : ::boost::shared_ptr< ::sw::Meta>(
+ pDoc->GetMetaFieldManager().makeMetaField()) );
+ SwFmtMeta meta(pMeta, i_nWhich); // this is cloned by Insert!
+ const bool bSuccess( pDoc->InsertPoolItem( aPam, meta, nInsertFlags ) );
+ SwTxtAttr * const pTxtAttr( pMeta->GetTxtAttr() );
+ if (!bSuccess)
+ {
+ throw lang::IllegalArgumentException(
+ C2S("SwXMeta::attach(): cannot create meta: range invalid?"),
+ static_cast< ::cppu::OWeakObject* >(this), 1);
+ }
+ if (!pTxtAttr)
+ {
+ ASSERT(false, "meta inserted, but has no text attribute?");
+ throw uno::RuntimeException(
+ C2S("SwXMeta::attach(): cannot create meta"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ pMeta->Add(m_pImpl.get());
+ pMeta->SetXMeta(uno::Reference<rdf::XMetadatable>(this));
+
+ m_pImpl->m_xParentText = ::sw::CreateParentXText(*pDoc, *aPam.GetPoint());
+
+ m_pImpl->m_bIsDescriptor = false;
+}
+
+// XTextContent
+void SAL_CALL
+SwXMeta::attach(const uno::Reference< text::XTextRange > & i_xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ return SwXMeta::AttachImpl(i_xTextRange, RES_TXTATR_META);
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMeta::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDisposed)
+ {
+ throw lang::DisposedException();
+ }
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException(
+ C2S("SwXMeta::getAnchor(): not inserted"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd));
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ {
+ throw lang::DisposedException(
+ C2S("SwXMeta::getAnchor(): not attached"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ const SwPosition start(*pTxtNode, nMetaStart - 1); // -1 due to CH_TXTATR
+ const SwPosition end(*pTxtNode, nMetaEnd);
+ return SwXTextRange::CreateXTextRange(*pTxtNode->GetDoc(), start, &end);
+}
+
+// XTextRange
+uno::Reference< text::XText > SAL_CALL
+SwXMeta::getText() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return this;
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMeta::getStart() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.getStart();
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMeta::getEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.getEnd();
+}
+
+rtl::OUString SAL_CALL
+SwXMeta::getString() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.getString();
+}
+
+void SAL_CALL
+SwXMeta::setString(const rtl::OUString& rString) throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.setString(rString);
+}
+
+// XSimpleText
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMeta::createTextCursor() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.createTextCursor();
+}
+
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXMeta::createTextCursorByRange(
+ const uno::Reference<text::XTextRange> & xTextPosition)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.createTextCursorByRange(xTextPosition);
+}
+
+void SAL_CALL
+SwXMeta::insertString(const uno::Reference<text::XTextRange> & xRange,
+ const rtl::OUString& rString, sal_Bool bAbsorb)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.insertString(xRange, rString, bAbsorb);
+}
+
+void SAL_CALL
+SwXMeta::insertControlCharacter(const uno::Reference<text::XTextRange> & xRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.insertControlCharacter(xRange, nControlCharacter,
+ bAbsorb);
+}
+
+// XText
+void SAL_CALL
+SwXMeta::insertTextContent( const uno::Reference<text::XTextRange> & xRange,
+ const uno::Reference<text::XTextContent> & xContent, sal_Bool bAbsorb)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.insertTextContent(xRange, xContent, bAbsorb);
+}
+
+void SAL_CALL
+SwXMeta::removeTextContent(
+ const uno::Reference< text::XTextContent > & xContent)
+ throw (container::NoSuchElementException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ return m_pImpl->m_Text.removeTextContent(xContent);
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL
+SwXMeta::getParent() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ bool const bSuccess( SetContentRange(pTxtNode, nMetaStart, nMetaEnd) );
+ OSL_ENSURE(bSuccess, "no pam?");
+ if (!bSuccess) { throw lang::DisposedException(); }
+ // in order to prevent getting this meta, subtract 1 from nMetaStart;
+ // so we get the index of the dummy character, and we exclude it
+ // by calling GetTxtAttrAt(_, _, PARENT) in GetNestedTextContent
+ uno::Reference<text::XTextContent> const xRet(
+ SwUnoCursorHelper::GetNestedTextContent(*pTxtNode, nMetaStart - 1,
+ true) );
+ return xRet;
+}
+
+void SAL_CALL
+SwXMeta::setParent(uno::Reference< uno::XInterface > const& /*xParent*/)
+ throw (uno::RuntimeException, lang::NoSupportException)
+{
+ throw lang::NoSupportException(C2S("setting parent not supported"), *this);
+}
+
+// XElementAccess
+uno::Type SAL_CALL
+SwXMeta::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+
+sal_Bool SAL_CALL
+SwXMeta::hasElements() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return m_pImpl->GetRegisteredIn() ? sal_True : sal_False;
+}
+
+// XEnumerationAccess
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXMeta::createEnumeration() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (m_pImpl->m_bIsDisposed)
+ {
+ throw lang::DisposedException();
+ }
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException(
+ C2S("createEnumeration(): not inserted"),
+ static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ const bool bSuccess(SetContentRange(pTxtNode, nMetaStart, nMetaEnd));
+ ASSERT(bSuccess, "no pam?");
+ if (!bSuccess)
+ throw lang::DisposedException();
+
+ SwPaM aPam(*pTxtNode, nMetaStart);
+
+ if (!m_pImpl->m_pTextPortions.get())
+ {
+ return new SwXTextPortionEnumeration(
+ aPam, GetParentText(), nMetaStart, nMetaEnd);
+ }
+ else // cached!
+ {
+ return new SwXTextPortionEnumeration(aPam, *m_pImpl->m_pTextPortions);
+ }
+}
+
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXMeta::GetCoreObject()
+{
+ return const_cast< ::sw::Meta * >(m_pImpl->GetMeta());
+}
+
+uno::Reference<frame::XModel> SwXMeta::GetModel()
+{
+ ::sw::Meta const * const pMeta( m_pImpl->GetMeta() );
+ if (pMeta)
+ {
+ SwTxtNode const * const pTxtNode( pMeta->GetTxtNode() );
+ if (pTxtNode)
+ {
+ SwDocShell const * const pShell(pTxtNode->GetDoc()->GetDocShell());
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ }
+ return 0;
+}
+
+
+/******************************************************************
+ * SwXMetaField
+ ******************************************************************/
+
+inline const ::sw::MetaField * SwXMeta::Impl::GetMetaField() const
+{
+ return static_cast< const ::sw::MetaField * >(GetRegisteredIn());
+}
+
+SwXMetaField::SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
+ uno::Reference<text::XText> const& xParentText,
+ TextRangeList_t const*const pPortions)
+ : SwXMetaField_Base(pDoc, pMeta, xParentText, pPortions)
+{
+ ASSERT(pMeta && dynamic_cast< ::sw::MetaField* >(pMeta),
+ "SwXMetaField created for wrong hint!");
+}
+
+SwXMetaField::SwXMetaField(SwDoc *const pDoc)
+ : SwXMetaField_Base(pDoc)
+{
+}
+
+SwXMetaField::~SwXMetaField()
+{
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL
+SwXMetaField::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXMetaField");
+}
+
+static char const*const g_ServicesMetaField[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.TextField",
+ "com.sun.star.text.textfield.MetadataField",
+};
+static const size_t g_nServicesMetaField(
+ sizeof(g_ServicesMetaField)/sizeof(g_ServicesMetaField[0]));
+
+sal_Bool SAL_CALL
+SwXMetaField::supportsService(const ::rtl::OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesMetaField, g_ServicesMetaField, rServiceName);
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
+SwXMetaField::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesMetaField, g_ServicesMetaField);
+}
+
+// XComponent
+void SAL_CALL
+SwXMetaField::addEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ return SwXMeta::addEventListener(xListener);
+}
+
+void SAL_CALL
+SwXMetaField::removeEventListener(
+ uno::Reference< lang::XEventListener> const & xListener )
+throw (uno::RuntimeException)
+{
+ return SwXMeta::removeEventListener(xListener);
+}
+
+void SAL_CALL
+SwXMetaField::dispose() throw (uno::RuntimeException)
+{
+ return SwXMeta::dispose();
+}
+
+// XTextContent
+void SAL_CALL
+SwXMetaField::attach(const uno::Reference< text::XTextRange > & i_xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ return SwXMeta::AttachImpl(i_xTextRange, RES_TXTATR_METAFIELD);
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwXMetaField::getAnchor() throw (uno::RuntimeException)
+{
+ return SwXMeta::getAnchor();
+}
+
+// XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXMetaField::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xRef(
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_METAFIELD)
+ ->getPropertySetInfo() );
+ return xRef;
+}
+
+void SAL_CALL
+SwXMetaField::setPropertyValue(
+ const ::rtl::OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ ::sw::MetaField * const pMeta(
+ const_cast< ::sw::MetaField * >(m_pImpl->GetMetaField()) );
+ if (!pMeta)
+ throw lang::DisposedException();
+
+ if (rPropertyName.equalsAscii("NumberFormat"))
+ {
+ sal_Int32 nNumberFormat(0);
+ if (rValue >>= nNumberFormat)
+ {
+ pMeta->SetNumberFormat(static_cast<sal_uInt32>(nNumberFormat));
+ }
+ }
+ else if (rPropertyName.equalsAscii("IsFixedLanguage"))
+ {
+ bool b(false);
+ if (rValue >>= b)
+ {
+ pMeta->SetIsFixedLanguage(b);
+ }
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+}
+
+uno::Any SAL_CALL
+SwXMetaField::getPropertyValue(const ::rtl::OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ ::sw::MetaField const * const pMeta( m_pImpl->GetMetaField() );
+ if (!pMeta)
+ throw lang::DisposedException();
+
+ uno::Any any;
+
+ if (rPropertyName.equalsAscii("NumberFormat"))
+ {
+ const ::rtl::OUString text( getPresentation(sal_False) );
+ any <<= static_cast<sal_Int32>(pMeta->GetNumberFormat(text));
+ }
+ else if (rPropertyName.equalsAscii("IsFixedLanguage"))
+ {
+ any <<= pMeta->IsFixedLanguage();
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+
+ return any;
+}
+
+void SAL_CALL
+SwXMetaField::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXMetaField::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXMetaField::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXMetaField::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXMetaField::removeVetoableChangeListener(): not implemented");
+}
+
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include <comphelper/processfactory.hxx>
+
+static uno::Reference<rdf::XURI> const&
+lcl_getURI(const bool bPrefix)
+{
+ static uno::Reference< uno::XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext());
+ static uno::Reference< rdf::XURI > xOdfPrefix(
+ rdf::URI::createKnown(xContext, rdf::URIs::ODF_PREFIX),
+ uno::UNO_SET_THROW);
+ static uno::Reference< rdf::XURI > xOdfSuffix(
+ rdf::URI::createKnown(xContext, rdf::URIs::ODF_SUFFIX),
+ uno::UNO_SET_THROW);
+ return (bPrefix) ? xOdfPrefix : xOdfSuffix;
+}
+
+static ::rtl::OUString
+lcl_getPrefixOrSuffix(
+ uno::Reference<rdf::XRepository> const & xRepository,
+ uno::Reference<rdf::XResource> const & xMetaField,
+ uno::Reference<rdf::XURI> const & xPredicate)
+{
+ const uno::Reference<container::XEnumeration> xEnum(
+ xRepository->getStatements(xMetaField, xPredicate, 0),
+ uno::UNO_SET_THROW);
+ while (xEnum->hasMoreElements()) {
+ rdf::Statement stmt;
+ if (!(xEnum->nextElement() >>= stmt)) {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<rdf::XLiteral> xObject(stmt.Object,
+ uno::UNO_QUERY);
+ if (!xObject.is()) continue;
+ if (xEnum->hasMoreElements()) {
+ OSL_TRACE("ignoring other odf:Prefix/odf:Suffix statements");
+ }
+ return xObject->getValue();
+ }
+ return ::rtl::OUString();
+}
+
+void
+getPrefixAndSuffix(
+ const uno::Reference<frame::XModel>& xModel,
+ const uno::Reference<rdf::XMetadatable>& xMetaField,
+ ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix)
+{
+ try {
+ const uno::Reference<rdf::XRepositorySupplier> xRS(
+ xModel, uno::UNO_QUERY_THROW);
+ const uno::Reference<rdf::XRepository> xRepo(
+ xRS->getRDFRepository(), uno::UNO_SET_THROW);
+ const uno::Reference<rdf::XResource> xMeta(
+ xMetaField, uno::UNO_QUERY_THROW);
+ if (o_pPrefix)
+ {
+ *o_pPrefix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(true));
+ }
+ if (o_pSuffix)
+ {
+ *o_pSuffix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(false));
+ }
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (uno::Exception & e) {
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString::createFromAscii("getPrefixAndSuffix: exception"),
+ 0, uno::makeAny(e));
+ }
+}
+
+// XTextField
+::rtl::OUString SAL_CALL
+SwXMetaField::getPresentation(sal_Bool bShowCommand)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (bShowCommand)
+ {
+//FIXME ?
+ return ::rtl::OUString();
+ }
+ else
+ {
+ // getString should check if this is invalid
+ const ::rtl::OUString content( this->getString() );
+ ::rtl::OUString prefix;
+ ::rtl::OUString suffix;
+ getPrefixAndSuffix(GetModel(), this, &prefix, &suffix);
+ return prefix + content + suffix;
+ }
+}
+
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
new file mode 100644
index 000000000000..2810b500ea4b
--- /dev/null
+++ b/sw/source/core/unocore/unosect.cxx
@@ -0,0 +1,1916 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/text/SectionFileLink.hpp>
+
+#include <cmdid.h>
+#include <hintids.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/xmlcnitm.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtclds.hxx>
+#include <unotextrange.hxx>
+#include <unosection.hxx>
+#include <TextCursorHelper.hxx>
+#include <unoredline.hxx>
+#include <redline.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <section.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <docary.hxx>
+#include <swundo.hxx>
+#include <hints.hxx>
+#include <tox.hxx>
+#include <unoidx.hxx>
+#include <doctxm.hxx>
+#include <fmtftntx.hxx>
+#include <fmtclbl.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <editeng/frmdiritem.hxx>
+#include <fmtcntnt.hxx>
+/* #109700# */
+#include <editeng/lrspitem.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+/******************************************************************
+ *
+ ******************************************************************/
+struct SwTextSectionProperties_Impl
+{
+ uno::Sequence<sal_Int8> m_Password;
+ ::rtl::OUString m_sCondition;
+ ::rtl::OUString m_sLinkFileName;
+ ::rtl::OUString m_sSectionFilter;
+ ::rtl::OUString m_sSectionRegion;
+
+ ::std::auto_ptr<SwFmtCol> m_pColItem;
+ ::std::auto_ptr<SvxBrushItem> m_pBrushItem;
+ ::std::auto_ptr<SwFmtFtnAtTxtEnd> m_pFtnItem;
+ ::std::auto_ptr<SwFmtEndAtTxtEnd> m_pEndItem;
+ ::std::auto_ptr<SvXMLAttrContainerItem> m_pXMLAttr;
+ ::std::auto_ptr<SwFmtNoBalancedColumns> m_pNoBalanceItem;
+ ::std::auto_ptr<SvxFrameDirectionItem> m_pFrameDirItem;
+ ::std::auto_ptr<SvxLRSpaceItem> m_pLRSpaceItem; // #109700#
+
+ bool m_bDDE;
+ bool m_bHidden;
+ bool m_bCondHidden;
+ bool m_bProtect;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bool m_bEditInReadonly;
+ // <--
+ bool m_bUpdateType;
+
+ SwTextSectionProperties_Impl()
+ : m_bDDE(false)
+ , m_bHidden(false)
+ , m_bCondHidden(false)
+ , m_bProtect(false)
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ , m_bEditInReadonly(false)
+ // <--
+ , m_bUpdateType(true)
+ {
+ }
+
+};
+
+
+class SwXTextSection::Impl
+ : public SwClient
+{
+
+public:
+
+ SwXTextSection & m_rThis;
+ const SfxItemPropertySet & m_rPropSet;
+ SwEventListenerContainer m_ListenerContainer;
+ const bool m_bIndexHeader;
+ bool m_bIsDescriptor;
+ ::rtl::OUString m_sName;
+ ::std::auto_ptr<SwTextSectionProperties_Impl> m_pProps;
+
+ Impl( SwXTextSection & rThis,
+ SwSectionFmt *const pFmt, const bool bIndexHeader)
+ : SwClient(pFmt)
+ , m_rThis(rThis)
+ , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_SECTION))
+ , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_bIndexHeader(bIndexHeader)
+ // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
+ , m_bIsDescriptor((0 == pFmt) ? true : false)
+ , m_pProps((pFmt) ? 0 : new SwTextSectionProperties_Impl())
+ {
+ }
+
+ SwSectionFmt * GetSectionFmt() const
+ {
+ return static_cast<SwSectionFmt*>(const_cast<SwModify*>(
+ GetRegisteredIn()));
+ }
+
+ SwSectionFmt & GetSectionFmtOrThrow() const {
+ SwSectionFmt *const pFmt( GetSectionFmt() );
+ if (!pFmt) {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXTextSection: disposed or invalid")), 0);
+ }
+ return *pFmt;
+ }
+
+ void SAL_CALL SetPropertyValues_Impl(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& aValues)
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException);
+ uno::Sequence< uno::Any > SAL_CALL
+ GetPropertyValues_Impl(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames)
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException);
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/*-- 10.12.98 14:42:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if (!GetRegisteredIn())
+ {
+ m_ListenerContainer.Disposing();
+ }
+}
+
+/*-- 20.12.2005 10:27:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSectionFmt * SwXTextSection::GetFmt() const
+{
+ return m_pImpl->GetSectionFmt();
+}
+
+/*-- 20.12.2005 09:56:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextSection >
+SwXTextSection::CreateXTextSection(
+ SwSectionFmt *const pFmt, const bool bIndexHeader)
+{
+ // re-use existing SwXTextSection
+ // #i105557#: do not iterate over the registered clients: race condition
+ uno::Reference< text::XTextSection > xSection;
+ if (pFmt)
+ {
+ xSection.set(pFmt->GetXTextSection());
+ }
+ if ( !xSection.is() )
+ {
+ SwXTextSection *const pNew = new SwXTextSection(pFmt, bIndexHeader);
+ xSection.set(pNew);
+ if (pFmt)
+ {
+ pFmt->SetXTextSection(xSection);
+ }
+ }
+ return xSection;
+}
+
+/*-- 10.12.98 14:47:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSection::SwXTextSection(
+ SwSectionFmt *const pFmt, const bool bIndexHeader)
+ : m_pImpl( new SwXTextSection::Impl(*this, pFmt, bIndexHeader) )
+{
+}
+
+/*-- 10.12.98 14:47:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSection::~SwXTextSection()
+{
+}
+
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextSection::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXTextSection::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXTextSection>(rId, this);
+}
+
+/*-- 10.12.98 14:47:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextSection > SAL_CALL
+SwXTextSection::getParentSection() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt & rSectionFmt( m_pImpl->GetSectionFmtOrThrow() );
+
+ SwSectionFmt *const pParentFmt = rSectionFmt.GetParent();
+ const uno::Reference< text::XTextSection > xRet =
+ (pParentFmt) ? CreateXTextSection(pParentFmt) : 0;
+ return xRet;
+}
+
+/*-- 10.12.98 14:47:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Reference< text::XTextSection > > SAL_CALL
+SwXTextSection::getChildSections() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt & rSectionFmt( m_pImpl->GetSectionFmtOrThrow() );
+
+ SwSections aChildren;
+ rSectionFmt.GetChildSections(aChildren, SORTSECT_NOT, sal_False);
+ uno::Sequence<uno::Reference<text::XTextSection> > aSeq(aChildren.Count());
+ uno::Reference< text::XTextSection > * pArray = aSeq.getArray();
+ for (sal_uInt16 i = 0; i < aChildren.Count(); i++)
+ {
+ SwSectionFmt *const pChild = aChildren.GetObject(i)->GetFmt();
+ pArray[i] = CreateXTextSection(pChild);
+ }
+ return aSeq;
+}
+
+/* -----------------18.02.99 13:31-------------------
+ *
+ * --------------------------------------------------*/
+void SAL_CALL
+SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ }
+
+ SwDoc *const pDoc =
+ (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
+ if (!pDoc)
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+ UnoActionContext aCont(pDoc);
+ pDoc->StartUndo( UNDO_INSSECTION, NULL );
+
+ if (!m_pImpl->m_sName.getLength())
+ {
+ m_pImpl->m_sName = C2U("TextSection");
+ }
+ SectionType eType = (m_pImpl->m_pProps->m_bDDE)
+ ? DDE_LINK_SECTION
+ : ((m_pImpl->m_pProps->m_sLinkFileName.getLength() ||
+ m_pImpl->m_pProps->m_sSectionRegion.getLength())
+ ? FILE_LINK_SECTION : CONTENT_SECTION);
+ // index header section?
+ if (m_pImpl->m_bIndexHeader)
+ {
+ // caller wants an index header section, but will only
+ // give him one if a) we are inside an index, and b) said
+ // index doesn't yet have a header section.
+ const SwTOXBase* pBase = aPam.GetDoc()->GetCurTOX(*aPam.Start());
+
+ // are we inside an index?
+ if (pBase)
+ {
+ // get all child sections
+ SwSections aSectionsArr;
+ static_cast<const SwTOXBaseSection*>(pBase)->GetFmt()->
+ GetChildSections(aSectionsArr);
+
+ // and search for current header section
+ const sal_uInt16 nCount = aSectionsArr.Count();
+ sal_Bool bHeaderPresent = sal_False;
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ bHeaderPresent |=
+ (aSectionsArr[i]->GetType() == TOX_HEADER_SECTION);
+ }
+ if (! bHeaderPresent)
+ {
+ eType = TOX_HEADER_SECTION;
+ }
+ }
+ }
+
+ String tmp(m_pImpl->m_sName);
+ SwSectionData aSect(eType, pDoc->GetUniqueSectionName(&tmp));
+ aSect.SetCondition(m_pImpl->m_pProps->m_sCondition);
+ ::rtl::OUStringBuffer sLinkNameBuf(m_pImpl->m_pProps->m_sLinkFileName);
+ sLinkNameBuf.append(sfx2::cTokenSeperator);
+ sLinkNameBuf.append(m_pImpl->m_pProps->m_sSectionFilter);
+ sLinkNameBuf.append(sfx2::cTokenSeperator);
+ sLinkNameBuf.append(m_pImpl->m_pProps->m_sSectionRegion);
+ aSect.SetLinkFileName(sLinkNameBuf.makeStringAndClear());
+
+ aSect.SetHidden(m_pImpl->m_pProps->m_bHidden);
+ aSect.SetProtectFlag(m_pImpl->m_pProps->m_bProtect);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aSect.SetEditInReadonlyFlag(m_pImpl->m_pProps->m_bEditInReadonly);
+ // <--
+
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_COL, RES_COL,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FTN_AT_TXTEND, RES_FRAMEDIR,
+ RES_LR_SPACE, RES_LR_SPACE, // #109700#
+ RES_UNKNOWNATR_CONTAINER,RES_UNKNOWNATR_CONTAINER,
+ 0);
+ if (m_pImpl->m_pProps->m_pBrushItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pBrushItem);
+ }
+ if (m_pImpl->m_pProps->m_pColItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pColItem);
+ }
+ if (m_pImpl->m_pProps->m_pFtnItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pFtnItem);
+ }
+ if (m_pImpl->m_pProps->m_pEndItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pEndItem);
+ }
+ if (m_pImpl->m_pProps->m_pXMLAttr.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pXMLAttr);
+ }
+ if (m_pImpl->m_pProps->m_pNoBalanceItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pNoBalanceItem);
+ }
+ if (m_pImpl->m_pProps->m_pFrameDirItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pFrameDirItem);
+ }
+ /* #109700# */
+ if (m_pImpl->m_pProps->m_pLRSpaceItem.get())
+ {
+ aSet.Put(*m_pImpl->m_pProps->m_pLRSpaceItem);
+ }
+ // section password
+ if (m_pImpl->m_pProps->m_Password.getLength() > 0)
+ {
+ aSect.SetPassword(m_pImpl->m_pProps->m_Password);
+ }
+
+ SwSection *const pRet =
+ pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 );
+ pRet->GetFmt()->Add(m_pImpl.get());
+ pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
+
+ // #97450# XML import must hide sections depending on their old
+ // condition status
+ if (m_pImpl->m_pProps->m_sCondition.getLength() != 0)
+ {
+ pRet->SetCondHidden(m_pImpl->m_pProps->m_bCondHidden);
+ }
+
+ // set update type if DDE link (and connect, if necessary)
+ if (m_pImpl->m_pProps->m_bDDE)
+ {
+ if (! pRet->IsConnected())
+ {
+ pRet->CreateLink(CREATE_CONNECT);
+ }
+ pRet->SetUpdateType( static_cast< USHORT >(
+ (m_pImpl->m_pProps->m_bUpdateType) ?
+ sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
+ }
+
+ // Undo-Klammerung hier beenden
+ pDoc->EndUndo( UNDO_INSSECTION, NULL );
+ m_pImpl->m_pProps.reset();
+ m_pImpl->m_bIsDescriptor = false;
+}
+
+/*-- 10.12.98 14:47:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXTextSection::getAnchor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XTextRange > xRet;
+ SwSectionFmt *const pSectFmt = m_pImpl->GetSectionFmt();
+ if(pSectFmt)
+ {
+ const SwSection* pSect;
+ const SwNodeIndex* pIdx;
+ if( 0 != ( pSect = pSectFmt->GetSection() ) &&
+ 0 != ( pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) &&
+ pIdx->GetNode().GetNodes().IsDocNodes() )
+ {
+ SwPaM aPaM(*pIdx);
+ aPaM.Move( fnMoveForward, fnGoCntnt );
+
+ const SwEndNode* pEndNode = pIdx->GetNode().EndOfSectionNode();
+ SwPaM aEnd(*pEndNode);
+ aEnd.Move( fnMoveBackward, fnGoCntnt );
+ xRet = SwXTextRange::CreateXTextRange(*pSectFmt->GetDoc(),
+ *aPaM.Start(), aEnd.Start());
+ }
+ }
+ return xRet;
+}
+/*-- 10.12.98 14:47:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::dispose() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pSectFmt = m_pImpl->GetSectionFmt();
+ if (pSectFmt)
+ {
+ pSectFmt->GetDoc()->DelSectionFmt( pSectFmt );
+ }
+}
+/*-- 10.12.98 14:47:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetSectionFmt())
+ {
+ throw uno::RuntimeException();
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
+}
+/*-- 10.12.98 14:47:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetSectionFmt() ||
+ !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
+ {
+ throw uno::RuntimeException();
+ }
+}
+/*-- 10.12.98 14:47:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXTextSection::getPropertySetInfo() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static const uno::Reference< beans::XPropertySetInfo > aRef =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ return aRef;
+}
+
+/* -----------------------------12.02.01 10:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static void
+lcl_UpdateLinkType(SwSection & rSection, bool const bLinkUpdateAlways = true)
+{
+ if (rSection.GetType() == DDE_LINK_SECTION)
+ {
+ // set update type; needs an established link
+ if (!rSection.IsConnected())
+ {
+ rSection.CreateLink(CREATE_CONNECT);
+ }
+ rSection.SetUpdateType( static_cast< USHORT >((bLinkUpdateAlways)
+ ? sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
+ }
+}
+
+static void
+lcl_UpdateSection(SwSectionFmt *const pFmt,
+ ::std::auto_ptr<SwSectionData> const& pSectionData,
+ ::std::auto_ptr<SfxItemSet> const& pItemSet,
+ bool const bLinkModeChanged, bool const bLinkUpdateAlways = true)
+{
+ if (pFmt)
+ {
+ SwSection & rSection = *pFmt->GetSection();
+ SwDoc *const pDoc = pFmt->GetDoc();
+ SwSectionFmts const& rFmts = pDoc->GetSections();
+ UnoActionContext aContext(pDoc);
+ for (sal_uInt16 i = 0; i < rFmts.Count(); i++)
+ {
+ if (rFmts[i]->GetSection()->GetSectionName()
+ == rSection.GetSectionName())
+ {
+ pDoc->UpdateSection(i, *pSectionData, pItemSet.get(),
+ pDoc->IsInReading());
+ {
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pDoc );
+ }
+
+ if (bLinkModeChanged)
+ {
+ lcl_UpdateLinkType(rSection, bLinkUpdateAlways);
+ }
+ // section found and processed: break from loop
+ break;
+ }
+ }
+ }
+}
+
+void SwXTextSection::Impl::SetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ if(rPropertyNames.getLength() != rValues.getLength())
+ {
+ throw lang::IllegalArgumentException();
+ }
+ SwSectionFmt *const pFmt = GetSectionFmt();
+ if (!pFmt && !m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ ::std::auto_ptr<SwSectionData> const pSectionData(
+ (pFmt) ? new SwSectionData(*pFmt->GetSection()) : 0);
+
+ OUString const*const pPropertyNames = rPropertyNames.getConstArray();
+ uno::Any const*const pValues = rValues.getConstArray();
+ ::std::auto_ptr<SfxItemSet> pItemSet;
+ sal_Bool bLinkModeChanged = sal_False;
+ sal_Bool bLinkMode = sal_False;
+
+ for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength();
+ nProperty++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_rPropSet.getPropertyMap()->getByName(pPropertyNames[nProperty]);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pPropertyNames[nProperty],
+ static_cast<cppu::OWeakObject *>(& m_rThis));
+ }
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw beans::PropertyVetoException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
+ + pPropertyNames[nProperty],
+ static_cast<cppu::OWeakObject *>(& m_rThis));
+ }
+ switch (pEntry->nWID)
+ {
+ case WID_SECT_CONDITION:
+ {
+ OUString uTmp;
+ pValues[nProperty] >>= uTmp;
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_sCondition = uTmp;
+ }
+ else
+ {
+ pSectionData->SetCondition(uTmp);
+ }
+ }
+ break;
+ case WID_SECT_DDE_TYPE:
+ case WID_SECT_DDE_FILE:
+ case WID_SECT_DDE_ELEMENT:
+ {
+ OUString uTmp;
+ pValues[nProperty] >>= uTmp;
+ String sTmp(uTmp);
+ if (m_bIsDescriptor)
+ {
+ if (!m_pProps->m_bDDE)
+ {
+ ::rtl::OUStringBuffer buf;
+ buf.append(sfx2::cTokenSeperator);
+ buf.append(sfx2::cTokenSeperator);
+ m_pProps->m_sLinkFileName = buf.makeStringAndClear();
+ m_pProps->m_bDDE = true;
+ }
+ String sLinkFileName(m_pProps->m_sLinkFileName);
+ sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,
+ sfx2::cTokenSeperator, sTmp);
+ m_pProps->m_sLinkFileName = sLinkFileName;
+ }
+ else
+ {
+ String sLinkFileName(pSectionData->GetLinkFileName());
+ if (pSectionData->GetType() != DDE_LINK_SECTION)
+ {
+ sLinkFileName = sfx2::cTokenSeperator;
+ sLinkFileName += sfx2::cTokenSeperator;
+ pSectionData->SetType(DDE_LINK_SECTION);
+ }
+ sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,
+ sfx2::cTokenSeperator, sTmp);
+ pSectionData->SetLinkFileName(sLinkFileName);
+ }
+ }
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ {
+ sal_Bool bVal(sal_False);
+ if (!(pValues[nProperty] >>= bVal))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bUpdateType = bVal;
+ }
+ else
+ {
+ bLinkModeChanged = sal_True;
+ bLinkMode = bVal;
+ }
+ }
+ break;
+ case WID_SECT_LINK:
+ {
+ text::SectionFileLink aLink;
+ if (!(pValues[nProperty] >>= aLink))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bDDE = sal_False;
+ m_pProps->m_sLinkFileName = aLink.FileURL;
+ m_pProps->m_sSectionFilter = aLink.FilterName;
+ }
+ else
+ {
+ if (pSectionData->GetType() != FILE_LINK_SECTION &&
+ aLink.FileURL.getLength())
+ {
+ pSectionData->SetType(FILE_LINK_SECTION);
+ }
+ ::rtl::OUStringBuffer sFileNameBuf;
+ if (aLink.FileURL.getLength())
+ {
+ sFileNameBuf.append( URIHelper::SmartRel2Abs(
+ pFmt->GetDoc()->GetDocShell()->GetMedium()
+ ->GetURLObject(),
+ aLink.FileURL, URIHelper::GetMaybeFileHdl()));
+ }
+ sFileNameBuf.append(sfx2::cTokenSeperator);
+ sFileNameBuf.append(aLink.FilterName);
+ sFileNameBuf.append(sfx2::cTokenSeperator);
+ sFileNameBuf.append(
+ pSectionData->GetLinkFileName().GetToken(2,
+ sfx2::cTokenSeperator));
+ const ::rtl::OUString sFileName(
+ sFileNameBuf.makeStringAndClear());
+ pSectionData->SetLinkFileName(sFileName);
+ if (sFileName.getLength() < 3)
+ {
+ pSectionData->SetType(CONTENT_SECTION);
+ }
+ }
+ }
+ break;
+ case WID_SECT_REGION:
+ {
+ OUString sLink;
+ pValues[nProperty] >>= sLink;
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bDDE = sal_False;
+ m_pProps->m_sSectionRegion = sLink;
+ }
+ else
+ {
+ if (pSectionData->GetType() != FILE_LINK_SECTION &&
+ sLink.getLength())
+ {
+ pSectionData->SetType(FILE_LINK_SECTION);
+ }
+ String sSectLink(pSectionData->GetLinkFileName());
+ while (3 < sSectLink.GetTokenCount(sfx2::cTokenSeperator))
+ {
+ sSectLink += sfx2::cTokenSeperator;
+ }
+ sSectLink.SetToken(2, sfx2::cTokenSeperator, sLink);
+ pSectionData->SetLinkFileName(sSectLink);
+ if (sSectLink.Len() < 3)
+ {
+ pSectionData->SetType(CONTENT_SECTION);
+ }
+ }
+ }
+ break;
+ case WID_SECT_VISIBLE:
+ {
+ sal_Bool bVal(sal_False);
+ if (!(pValues[nProperty] >>= bVal))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bHidden = !bVal;
+ }
+ else
+ {
+ pSectionData->SetHidden(!bVal);
+ }
+ }
+ break;
+ case WID_SECT_CURRENTLY_VISIBLE:
+ {
+ sal_Bool bVal(sal_False);
+ if (!(pValues[nProperty] >>= bVal))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bCondHidden = !bVal;
+ }
+ else
+ {
+ if (pSectionData->GetCondition().Len() != 0)
+ {
+ pSectionData->SetCondHidden(!bVal);
+ }
+ }
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ sal_Bool bVal(sal_False);
+ if (!(pValues[nProperty] >>= bVal))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bProtect = bVal;
+ }
+ else
+ {
+ pSectionData->SetProtectFlag(bVal);
+ }
+ }
+ break;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case WID_SECT_EDIT_IN_READONLY:
+ {
+ sal_Bool bVal(sal_False);
+ if (!(pValues[nProperty] >>= bVal))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_bEditInReadonly = bVal;
+ }
+ else
+ {
+ pSectionData->SetEditInReadonlyFlag(bVal);
+ }
+ }
+ // <--
+ break;
+ case WID_SECT_PASSWORD:
+ {
+ uno::Sequence<sal_Int8> aSeq;
+ pValues[nProperty] >>= aSeq;
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_Password = aSeq;
+ }
+ else
+ {
+ pSectionData->SetPassword(aSeq);
+ }
+ }
+ break;
+ default:
+ {
+ if (pFmt)
+ {
+ const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet();
+ pItemSet.reset( new SfxItemSet(*rOldAttrSet.GetPool(),
+ pEntry->nWID, pEntry->nWID, 0));
+ pItemSet->Put(rOldAttrSet);
+ m_rPropSet.setPropertyValue(*pEntry,
+ pValues[nProperty], *pItemSet);
+ }
+ else
+ {
+ SfxPoolItem* pPutItem = 0;
+ if (RES_COL == pEntry->nWID)
+ {
+ if (!m_pProps->m_pColItem.get())
+ {
+ m_pProps->m_pColItem.reset(new SwFmtCol);
+ }
+ pPutItem = m_pProps->m_pColItem.get();
+ }
+ else if (RES_BACKGROUND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pBrushItem.get())
+ {
+ m_pProps->m_pBrushItem.reset(
+ new SvxBrushItem(RES_BACKGROUND));
+ }
+ pPutItem = m_pProps->m_pBrushItem.get();
+ }
+ else if (RES_FTN_AT_TXTEND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pFtnItem.get())
+ {
+ m_pProps->m_pFtnItem.reset(new SwFmtFtnAtTxtEnd);
+ }
+ pPutItem = m_pProps->m_pFtnItem.get();
+ }
+ else if (RES_END_AT_TXTEND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pEndItem.get())
+ {
+ m_pProps->m_pEndItem.reset(new SwFmtEndAtTxtEnd);
+ }
+ pPutItem = m_pProps->m_pEndItem.get();
+ }
+ else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
+ {
+ if (!m_pProps->m_pXMLAttr.get())
+ {
+ m_pProps->m_pXMLAttr.reset(
+ new SvXMLAttrContainerItem(
+ RES_UNKNOWNATR_CONTAINER));
+ }
+ pPutItem = m_pProps->m_pXMLAttr.get();
+ }
+ else if (RES_COLUMNBALANCE== pEntry->nWID)
+ {
+ if (!m_pProps->m_pNoBalanceItem.get())
+ {
+ m_pProps->m_pNoBalanceItem.reset(
+ new SwFmtNoBalancedColumns(RES_COLUMNBALANCE));
+ }
+ pPutItem = m_pProps->m_pNoBalanceItem.get();
+ }
+ else if (RES_FRAMEDIR == pEntry->nWID)
+ {
+ if (!m_pProps->m_pFrameDirItem.get())
+ {
+ m_pProps->m_pFrameDirItem.reset(
+ new SvxFrameDirectionItem(
+ FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
+ }
+ pPutItem = m_pProps->m_pFrameDirItem.get();
+ }
+ else if (RES_LR_SPACE == pEntry->nWID)
+ {
+ // #109700#
+ if (!m_pProps->m_pLRSpaceItem.get())
+ {
+ m_pProps->m_pLRSpaceItem.reset(
+ new SvxLRSpaceItem( RES_LR_SPACE ));
+ }
+ pPutItem = m_pProps->m_pLRSpaceItem.get();
+ }
+ if (pPutItem)
+ {
+ pPutItem->PutValue(pValues[nProperty],
+ pEntry->nMemberId);
+ }
+ }
+ }
+ }
+ }
+
+ lcl_UpdateSection(pFmt, pSectionData, pItemSet, bLinkModeChanged,
+ bLinkMode);
+}
+
+void SAL_CALL
+SwXTextSection::setPropertyValues(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues)
+throw (beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // workaround for bad designed API
+ try
+ {
+ m_pImpl->SetPropertyValues_Impl( rPropertyNames, rValues );
+ }
+ catch (beans::UnknownPropertyException &rException)
+ {
+ // wrap the original (here not allowed) exception in
+ // a WrappedTargetException that gets thrown instead.
+ lang::WrappedTargetException aWExc;
+ aWExc.TargetException <<= rException;
+ throw aWExc;
+ }
+}
+/*-- 10.12.98 14:47:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Sequence< ::rtl::OUString > aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ uno::Sequence< uno::Any > aValues(1);
+ aValues.getArray()[0] = rValue;
+ m_pImpl->SetPropertyValues_Impl( aPropertyNames, aValues );
+}
+
+/* -----------------------------12.02.01 10:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any >
+SwXTextSection::Impl::GetPropertyValues_Impl(
+ const uno::Sequence< OUString > & rPropertyNames )
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SwSectionFmt *const pFmt = GetSectionFmt();
+ if (!pFmt && !m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Sequence< uno::Any > aRet(rPropertyNames.getLength());
+ uno::Any* pRet = aRet.getArray();
+ SwSection *const pSect = (pFmt) ? pFmt->GetSection() : 0;
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+
+ for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength();
+ nProperty++)
+ {
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_rPropSet.getPropertyMap()->getByName(pPropertyNames[nProperty]);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pPropertyNames[nProperty],
+ static_cast<cppu::OWeakObject *>(& m_rThis));
+ }
+ switch(pEntry->nWID)
+ {
+ case WID_SECT_CONDITION:
+ {
+ OUString uTmp( (m_bIsDescriptor)
+ ? m_pProps->m_sCondition
+ : ::rtl::OUString(pSect->GetCondition()));
+ pRet[nProperty] <<= uTmp;
+ }
+ break;
+ case WID_SECT_DDE_TYPE:
+ case WID_SECT_DDE_FILE:
+ case WID_SECT_DDE_ELEMENT:
+ {
+ ::rtl::OUString sRet;
+ if (m_bIsDescriptor)
+ {
+ if (m_pProps->m_bDDE)
+ {
+ sRet = m_pProps->m_sLinkFileName;
+ }
+ }
+ else if (DDE_LINK_SECTION == pSect->GetType())
+ {
+ sRet = pSect->GetLinkFileName();
+ }
+ sal_Int32 nDummy(0);
+ sRet = sRet.getToken(pEntry->nWID - WID_SECT_DDE_TYPE,
+ sfx2::cTokenSeperator, nDummy);
+ pRet[nProperty] <<= sRet;
+ }
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ {
+ // GetUpdateType() returns .._ALWAYS or .._ONCALL
+ if (pSect && pSect->IsLinkType() && pSect->IsConnected()) // lijian i73247
+ {
+ const sal_Bool bTemp =
+ (pSect->GetUpdateType() == sfx2::LINKUPDATE_ALWAYS);
+ pRet[nProperty] <<= bTemp;
+ }
+ }
+ break;
+ case WID_SECT_LINK :
+ {
+ text::SectionFileLink aLink;
+ if (m_bIsDescriptor)
+ {
+ if (!m_pProps->m_bDDE)
+ {
+ aLink.FileURL = m_pProps->m_sLinkFileName;
+ aLink.FilterName = m_pProps->m_sSectionFilter;
+ }
+ }
+ else if (FILE_LINK_SECTION == pSect->GetType())
+ {
+ ::rtl::OUString sRet( pSect->GetLinkFileName() );
+ sal_Int32 nIndex(0);
+ aLink.FileURL =
+ sRet.getToken(0, sfx2::cTokenSeperator, nIndex);
+ aLink.FilterName =
+ sRet.getToken(0, sfx2::cTokenSeperator, nIndex);
+ }
+ pRet[nProperty] <<= aLink;
+ }
+ break;
+ case WID_SECT_REGION :
+ {
+ ::rtl::OUString sRet;
+ if (m_bIsDescriptor)
+ {
+ sRet = m_pProps->m_sSectionRegion;
+ }
+ else if (FILE_LINK_SECTION == pSect->GetType())
+ {
+ sRet = pSect->GetLinkFileName().GetToken(2,
+ sfx2::cTokenSeperator);
+ }
+ pRet[nProperty] <<= sRet;
+ }
+ break;
+ case WID_SECT_VISIBLE :
+ {
+ const sal_Bool bTemp = (m_bIsDescriptor)
+ ? !m_pProps->m_bHidden : !pSect->IsHidden();
+ pRet[nProperty] <<= bTemp;
+ }
+ break;
+ case WID_SECT_CURRENTLY_VISIBLE:
+ {
+ const sal_Bool bTemp = (m_bIsDescriptor)
+ ? !m_pProps->m_bCondHidden : !pSect->IsCondHidden();
+ pRet[nProperty] <<= bTemp;
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ const sal_Bool bTemp = (m_bIsDescriptor)
+ ? m_pProps->m_bProtect : pSect->IsProtect();
+ pRet[nProperty] <<= bTemp;
+ }
+ break;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case WID_SECT_EDIT_IN_READONLY:
+ {
+ const sal_Bool bTemp = (m_bIsDescriptor)
+ ? m_pProps->m_bEditInReadonly : pSect->IsEditInReadonly();
+ pRet[nProperty] <<= bTemp;
+ }
+ break;
+ // <--
+ case FN_PARAM_LINK_DISPLAY_NAME:
+ {
+ if (pFmt)
+ {
+ pRet[nProperty] <<=
+ OUString(pFmt->GetSection()->GetSectionName());
+ }
+ }
+ break;
+ case WID_SECT_DOCUMENT_INDEX:
+ {
+ // search enclosing index
+ SwSection* pEnclosingSection = pSect;
+ while ((pEnclosingSection != NULL) &&
+ (TOX_CONTENT_SECTION != pEnclosingSection->GetType()))
+ {
+ pEnclosingSection = pEnclosingSection->GetParent();
+ }
+ if (pEnclosingSection)
+ {
+ // convert section to TOXBase and get SwXDocumentIndex
+ SwTOXBaseSection *const pTOXBaseSect =
+ PTR_CAST(SwTOXBaseSection, pEnclosingSection);
+ const uno::Reference<text::XDocumentIndex> xIndex =
+ SwXDocumentIndex::CreateXDocumentIndex(
+ *pTOXBaseSect->GetFmt()->GetDoc(), *pTOXBaseSect);
+ pRet[nProperty] <<= xIndex;
+ }
+ // else: no enclosing index found -> empty return value
+ }
+ break;
+ case WID_SECT_IS_GLOBAL_DOC_SECTION:
+ {
+ const sal_Bool bRet = (NULL == pFmt) ? sal_False :
+ static_cast<sal_Bool>(NULL != pFmt->GetGlobalDocSection());
+ pRet[nProperty] <<= bRet;
+ }
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ ::sw::GetDefaultTextContentValue(
+ pRet[nProperty], OUString(), pEntry->nWID);
+ break;
+ case FN_UNO_REDLINE_NODE_START:
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ if (!pFmt)
+ break; // lijian i73247
+ SwNode* pSectNode = pFmt->GetSectionNode();
+ if (FN_UNO_REDLINE_NODE_END == pEntry->nWID)
+ {
+ pSectNode = pSectNode->EndOfSectionNode();
+ }
+ const SwRedlineTbl& rRedTbl =
+ pFmt->GetDoc()->GetRedlineTbl();
+ for (USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ SwNode const*const pRedPointNode = pRedline->GetNode(TRUE);
+ SwNode const*const pRedMarkNode = pRedline->GetNode(FALSE);
+ if ((pRedPointNode == pSectNode) ||
+ (pRedMarkNode == pSectNode))
+ {
+ SwNode const*const pStartOfRedline =
+ (SwNodeIndex(*pRedPointNode) <=
+ SwNodeIndex(*pRedMarkNode))
+ ? pRedPointNode : pRedMarkNode;
+ const bool bIsStart = (pStartOfRedline == pSectNode);
+ pRet[nProperty] <<=
+ SwXRedlinePortion::CreateRedlineProperties(
+ *pRedline, bIsStart);
+ break;
+ }
+ }
+ }
+ break;
+ case WID_SECT_PASSWORD:
+ {
+ pRet[nProperty] <<= (m_bIsDescriptor)
+ ? m_pProps->m_Password : pSect->GetPassword();
+ }
+ break;
+ default:
+ {
+ if (pFmt)
+ {
+ m_rPropSet.getPropertyValue(*pEntry,
+ pFmt->GetAttrSet(), pRet[nProperty]);
+ }
+ else
+ {
+ const SfxPoolItem* pQueryItem = 0;
+ if (RES_COL == pEntry->nWID)
+ {
+ if (!m_pProps->m_pColItem.get())
+ {
+ m_pProps->m_pColItem.reset(new SwFmtCol);
+ }
+ pQueryItem = m_pProps->m_pColItem.get();
+ }
+ else if (RES_BACKGROUND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pBrushItem.get())
+ {
+ m_pProps->m_pBrushItem.reset(
+ new SvxBrushItem(RES_BACKGROUND));
+ }
+ pQueryItem = m_pProps->m_pBrushItem.get();
+ }
+ else if (RES_FTN_AT_TXTEND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pFtnItem.get())
+ {
+ m_pProps->m_pFtnItem.reset(new SwFmtFtnAtTxtEnd);
+ }
+ pQueryItem = m_pProps->m_pFtnItem.get();
+ }
+ else if (RES_END_AT_TXTEND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pEndItem.get())
+ {
+ m_pProps->m_pEndItem.reset(new SwFmtEndAtTxtEnd);
+ }
+ pQueryItem = m_pProps->m_pEndItem.get();
+ }
+ else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
+ {
+ if (!m_pProps->m_pXMLAttr.get())
+ {
+ m_pProps->m_pXMLAttr.reset(
+ new SvXMLAttrContainerItem);
+ }
+ pQueryItem = m_pProps->m_pXMLAttr.get();
+ }
+ else if (RES_COLUMNBALANCE== pEntry->nWID)
+ {
+ if (!m_pProps->m_pNoBalanceItem.get())
+ {
+ m_pProps->m_pNoBalanceItem.reset(
+ new SwFmtNoBalancedColumns);
+ }
+ pQueryItem = m_pProps->m_pNoBalanceItem.get();
+ }
+ else if (RES_FRAMEDIR == pEntry->nWID)
+ {
+ if (!m_pProps->m_pFrameDirItem.get())
+ {
+ m_pProps->m_pFrameDirItem.reset(
+ new SvxFrameDirectionItem(
+ FRMDIR_ENVIRONMENT, RES_FRAMEDIR));
+ }
+ pQueryItem = m_pProps->m_pFrameDirItem.get();
+ }
+ /* -> #109700# */
+ else if (RES_LR_SPACE == pEntry->nWID)
+ {
+ if (!m_pProps->m_pLRSpaceItem.get())
+ {
+ m_pProps->m_pLRSpaceItem.reset(
+ new SvxLRSpaceItem( RES_LR_SPACE ));
+ }
+ pQueryItem = m_pProps->m_pLRSpaceItem.get();
+ }
+ /* <- #109700# */
+ if (pQueryItem)
+ {
+ pQueryItem->QueryValue(pRet[nProperty],
+ pEntry->nMemberId);
+ }
+ }
+ }
+ }
+ }
+ return aRet;
+}
+
+/* -----------------------------04.11.03 10:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SAL_CALL
+SwXTextSection::getPropertyValues(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< uno::Any > aValues;
+
+ // workaround for bad designed API
+ try
+ {
+ aValues = m_pImpl->GetPropertyValues_Impl( rPropertyNames );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ throw uno::RuntimeException(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Unknown property exception caught")),
+ static_cast<cppu::OWeakObject *>(this));
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ throw uno::RuntimeException(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("WrappedTargetException caught")),
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ return aValues;
+}
+/*-- 10.12.98 14:47:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXTextSection::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Sequence< ::rtl::OUString > aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ return m_pImpl->GetPropertyValues_Impl(aPropertyNames).getConstArray()[0];
+}
+/* -----------------------------12.02.01 10:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::addPropertiesChangeListener(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::addPropertiesChangeListener(): not implemented");
+}
+
+/* -----------------------------12.02.01 10:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::removePropertiesChangeListener(): not implemented");
+}
+
+/* -----------------------------12.02.01 10:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::firePropertiesChangeEvent(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::firePropertiesChangeEvent(): not implemented");
+}
+
+/*-- 10.12.98 14:47:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextSection::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::addPropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXTextSection::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::removePropertyChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXTextSection::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::addVetoableChangeListener(): not implemented");
+}
+
+void SAL_CALL
+SwXTextSection::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXTextSection::removeVetoableChangeListener(): not implemented");
+}
+
+/*-- 08.11.00 10:47:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SAL_CALL
+SwXTextSection::getPropertyState(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Sequence< OUString > aNames(1);
+ aNames.getArray()[0] = rPropertyName;
+ return getPropertyStates(aNames).getConstArray()[0];
+}
+/*-- 08.11.00 10:47:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SAL_CALL
+SwXTextSection::getPropertyStates(
+ const uno::Sequence< OUString >& rPropertyNames)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ if (!pFmt && !m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Sequence< beans::PropertyState > aStates(rPropertyNames.getLength());
+ beans::PropertyState *const pStates = aStates.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ for (sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName( pNames[i]);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pNames[i], static_cast< cppu::OWeakObject* >(this));
+ }
+ switch (pEntry->nWID)
+ {
+ case WID_SECT_CONDITION:
+ case WID_SECT_DDE_TYPE:
+ case WID_SECT_DDE_FILE:
+ case WID_SECT_DDE_ELEMENT:
+ case WID_SECT_DDE_AUTOUPDATE:
+ case WID_SECT_LINK:
+ case WID_SECT_REGION :
+ case WID_SECT_VISIBLE:
+ case WID_SECT_PROTECTED:
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case WID_SECT_EDIT_IN_READONLY:
+ // <--
+ case FN_PARAM_LINK_DISPLAY_NAME:
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ break;
+ default:
+ {
+ if (pFmt)
+ {
+ pStates[i] = m_pImpl->m_rPropSet.getPropertyState(
+ pNames[i], pFmt->GetAttrSet());
+ }
+ else
+ {
+ if (RES_COL == pEntry->nWID)
+ {
+ if (!m_pImpl->m_pProps->m_pColItem.get())
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else //if(RES_BACKGROUND == pEntry->nWID)
+ {
+ if (!m_pImpl->m_pProps->m_pBrushItem.get())
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ }
+ }
+ }
+ }
+ return aStates;
+}
+
+/*-- 08.11.00 10:47:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXTextSection::setPropertyToDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ if (!pFmt && !m_pImpl->m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName, static_cast< cppu::OWeakObject* >(this));
+ }
+ if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "setPropertyToDefault: property is read-only: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ ::std::auto_ptr<SwSectionData> const pSectionData(
+ (pFmt) ? new SwSectionData(*pFmt->GetSection()) : 0);
+
+ ::std::auto_ptr<SfxItemSet> pNewAttrSet;
+ bool bLinkModeChanged = false;
+
+ switch (pEntry->nWID)
+ {
+ case WID_SECT_CONDITION:
+ {
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_sCondition = aEmptyStr;
+ }
+ else
+ {
+ pSectionData->SetCondition(aEmptyStr);
+ }
+ }
+ break;
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ case WID_SECT_LINK :
+ case WID_SECT_REGION :
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bDDE = false;
+ m_pImpl->m_pProps->m_sLinkFileName = ::rtl::OUString();
+ m_pImpl->m_pProps->m_sSectionRegion = ::rtl::OUString();
+ m_pImpl->m_pProps->m_sSectionFilter = ::rtl::OUString();
+ }
+ else
+ {
+ pSectionData->SetType(CONTENT_SECTION);
+ }
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bUpdateType = true;
+ }
+ else
+ {
+ bLinkModeChanged = true;
+ }
+ break;
+ case WID_SECT_VISIBLE :
+ {
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bHidden = false;
+ }
+ else
+ {
+ pSectionData->SetHidden(false);
+ }
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bProtect = false;
+ }
+ else
+ {
+ pSectionData->SetProtectFlag(false);
+ }
+ }
+ break;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case WID_SECT_EDIT_IN_READONLY:
+ {
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bEditInReadonly = false;
+ }
+ else
+ {
+ pSectionData->SetEditInReadonlyFlag(false);
+ }
+ }
+ break;
+ // <--
+
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ break;
+ default:
+ {
+ if (pEntry->nWID <= SFX_WHICH_MAX)
+ {
+ if (pFmt)
+ {
+ const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet();
+ pNewAttrSet.reset( new SfxItemSet(*rOldAttrSet.GetPool(),
+ pEntry->nWID, pEntry->nWID, 0));
+ pNewAttrSet->ClearItem(pEntry->nWID);
+ }
+ else
+ {
+ if (RES_COL == pEntry->nWID)
+ {
+ m_pImpl->m_pProps->m_pColItem.reset();
+ }
+ else if (RES_BACKGROUND == pEntry->nWID)
+ {
+ m_pImpl->m_pProps->m_pBrushItem.reset();
+ }
+ }
+ }
+ }
+ }
+
+ lcl_UpdateSection(pFmt, pSectionData, pNewAttrSet, bLinkModeChanged);
+}
+
+/*-- 08.11.00 10:47:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXTextSection::getPropertyDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
+
+ switch(pEntry->nWID)
+ {
+ case WID_SECT_CONDITION:
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ case WID_SECT_REGION :
+ case FN_PARAM_LINK_DISPLAY_NAME:
+ aRet <<= OUString();
+ break;
+ case WID_SECT_LINK :
+ aRet <<= text::SectionFileLink();
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ case WID_SECT_VISIBLE :
+ {
+ sal_Bool bTemp = sal_True;
+ aRet.setValue( &bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ case WID_SECT_EDIT_IN_READONLY:
+ // <--
+ {
+ sal_Bool bTemp = sal_False;
+ aRet.setValue( &bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ ::sw::GetDefaultTextContentValue(aRet, OUString(), pEntry->nWID);
+ break;
+ default:
+ if(pFmt && pEntry->nWID <= SFX_WHICH_MAX)
+ {
+ SwDoc *const pDoc = pFmt->GetDoc();
+ const SfxPoolItem& rDefItem =
+ pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID);
+ rDefItem.QueryValue(aRet, pEntry->nMemberId);
+ }
+ }
+ return aRet;
+}
+
+/*-- 10.12.98 14:47:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXTextSection::getName() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ ::rtl::OUString sRet;
+ SwSectionFmt const*const pFmt = m_pImpl->GetSectionFmt();
+ if(pFmt)
+ {
+ sRet = pFmt->GetSection()->GetSectionName();
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ sRet = m_pImpl->m_sName;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return sRet;
+}
+/*-- 10.12.98 14:47:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextSection::setName(const OUString& rName)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ if(pFmt)
+ {
+ SwSection *const pSect = pFmt->GetSection();
+ SwSectionData aSection(*pSect);
+ String sNewName(rName);
+ aSection.SetSectionName(sNewName);
+
+ const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections();
+ sal_uInt16 nApplyPos = USHRT_MAX;
+ for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
+ {
+ if(rFmts[i]->GetSection() == pSect)
+ {
+ nApplyPos = i;
+ }
+ else if (sNewName == rFmts[i]->GetSection()->GetSectionName())
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ if(nApplyPos != USHRT_MAX)
+ {
+ {
+ UnoActionContext aContext(pFmt->GetDoc());
+ pFmt->GetDoc()->UpdateSection(nApplyPos, aSection);
+ }
+ {
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pFmt->GetDoc() );
+ }
+ }
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_sName = rName;
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+/* -----------------02.11.99 11:30-------------------
+
+ --------------------------------------------------*/
+OUString SAL_CALL
+SwXTextSection::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXTextSection");
+}
+
+/* -----------------02.11.99 11:30-------------------
+
+ --------------------------------------------------*/
+static char const*const g_ServicesTextSection[] =
+{
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.TextSection",
+ "com.sun.star.document.LinkTarget",
+};
+static const size_t g_nServicesTextSection(
+ sizeof(g_ServicesTextSection)/sizeof(g_ServicesTextSection[0]));
+
+sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesTextSection, g_ServicesTextSection, rServiceName);
+}
+
+/* -----------------02.11.99 11:30-------------------
+
+ --------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesTextSection, g_ServicesTextSection);
+}
+
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXTextSection::GetCoreObject()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ return pSectionFmt;
+}
+
+uno::Reference<frame::XModel> SwXTextSection::GetModel()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (pSectionFmt)
+ {
+ SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
new file mode 100644
index 000000000000..ab486b71ed04
--- /dev/null
+++ b/sw/source/core/unocore/unosett.cxx
@@ -0,0 +1,2828 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <svx/svxids.hrc>
+#include <editeng/memberids.hrc>
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <hintids.hxx>
+#include "poolfmt.hrc"
+#include "poolfmt.hxx"
+#include <fmtcol.hxx>
+#include <unomap.hxx>
+#include <unostyle.hxx>
+#include <unosett.hxx>
+#include <unoprnms.hxx>
+#include <ftninfo.hxx>
+#include <doc.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+#include <lineinfo.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+#include <docstyle.hxx>
+#include <fmtclds.hxx>
+#include <editeng/brshitem.hxx>
+#include <com/sun/star/text/XFootnotesSettingsSupplier.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSettingsSupplier.hpp>
+#include <com/sun/star/text/FootnoteNumbering.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/style/LineNumberPosition.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <vcl/font.hxx>
+#include <editeng/flstitem.hxx>
+#include <vcl/metric.hxx>
+#include <svtools/ctrltool.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <editeng/unofdesc.hxx>
+#include <fmtornt.hxx>
+#include <SwStyleNameMapper.hxx>
+// --> OD 2008-01-15 #newlistlevelattrs#
+#include <com/sun/star/text/PositionAndSpaceMode.hpp>
+#include <com/sun/star/text/LabelFollow.hpp>
+// <--
+#include <numrule.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+
+struct PropValData
+{
+ uno::Any aVal;
+ OUString sPropName;
+ PropValData(void* pVal, const char* cPropName, uno::Type aType ) :
+ aVal(pVal, aType),
+ sPropName(OUString::createFromAscii(cPropName))
+ {}
+ PropValData(const uno::Any& rVal, const OUString& rPropName) :
+ aVal(rVal),
+ sPropName(rPropName)
+ {}
+};
+
+typedef PropValData* PropValDataPtr;
+SV_DECL_PTRARR(PropValDataArr, PropValDataPtr, 5, 5 )
+SV_IMPL_PTRARR(PropValDataArr, PropValDataPtr)
+
+
+#define WID_PREFIX 0
+#define WID_SUFFIX 1
+#define WID_NUMBERING_TYPE 2
+#define WID_START_AT 3
+#define WID_FOOTNOTE_COUNTING 4
+#define WID_PARAGRAPH_STYLE 5
+#define WID_PAGE_STYLE 6
+#define WID_CHARACTER_STYLE 7
+#define WID_POSITION_END_OF_DOC 8
+#define WID_END_NOTICE 9
+#define WID_BEGIN_NOTICE 10
+#define WID_ANCHOR_CHARACTER_STYLE 11
+
+const SfxItemPropertySet* GetFootnoteSet()
+{
+ static SfxItemPropertyMapEntry aFootnoteMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_BEGIN_NOTICE), WID_BEGIN_NOTICE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_END_NOTICE), WID_END_NOTICE , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_FOOTNOTE_COUNTING), WID_FOOTNOTE_COUNTING, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_POSITION_END_OF_DOC), WID_POSITION_END_OF_DOC,&::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ static SfxItemPropertySet aFootnoteSet_Impl(aFootnoteMap_Impl);
+ return &aFootnoteSet_Impl;
+}
+const SfxItemPropertySet* GetEndnoteSet()
+{
+ static SfxItemPropertyMapEntry aEndnoteMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ static SfxItemPropertySet aEndnoteSet_Impl(aEndnoteMap_Impl);
+ return &aEndnoteSet_Impl;
+}
+const SfxItemPropertySet* GetNumberingRulesSet()
+{
+ static SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS), WID_IS_ABS_MARGINS, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC), WID_IS_AUTOMATIC, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING), WID_CONTINUOUS, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NAME), WID_RULE_NAME , &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE), WID_IS_OUTLINE, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID), WID_DEFAULT_LIST_ID, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+ static SfxItemPropertySet aNumberingRulesSet_Impl( aNumberingRulesMap_Impl );
+ return &aNumberingRulesSet_Impl;
+}
+#define WID_NUM_ON 0
+#define WID_SEPARATOR_INTERVAL 1
+#define WID_NUMBERING_TYPE 2
+#define WID_NUMBER_POSITION 3
+#define WID_DISTANCE 4
+#define WID_INTERVAL 5
+#define WID_SEPARATOR_TEXT 6
+//#define WID_CHARACTER_STYLE 7
+#define WID_COUNT_EMPTY_LINES 8
+#define WID_COUNT_LINES_IN_FRAMES 9
+#define WID_RESTART_AT_EACH_PAGE 10
+
+const SfxItemPropertySet* GetLineNumberingSet()
+{
+ static SfxItemPropertyMapEntry aLineNumberingMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_COUNT_EMPTY_LINES), WID_COUNT_EMPTY_LINES , &::getBooleanCppuType(),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_COUNT_LINES_IN_FRAMES), WID_COUNT_LINES_IN_FRAMES, &::getBooleanCppuType(),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_DISTANCE ), WID_DISTANCE , &::getCppuType((const sal_Int32*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_ON), WID_NUM_ON, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_INTERVAL ), WID_INTERVAL , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SEPARATOR_TEXT ), WID_SEPARATOR_TEXT, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBER_POSITION), WID_NUMBER_POSITION, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_RESTART_AT_EACH_PAGE), WID_RESTART_AT_EACH_PAGE, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SEPARATOR_INTERVAL), WID_SEPARATOR_INTERVAL, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ {0,0,0,0,0,0}
+ };
+ static SfxItemPropertySet aLineNumberingSet_Impl(aLineNumberingMap_Impl);
+ return &aLineNumberingSet_Impl;
+}
+
+/* -----------------05.05.98 08:30-------------------
+ *
+ * --------------------------------------------------*/
+SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue)
+{
+ SwCharFmt* pRet = 0;
+ String sStandard(SW_RES(STR_POOLCOLL_STANDARD));
+ OUString uTmp;
+ aValue >>= uTmp;
+ String sCharFmt;
+ SwStyleNameMapper::FillUIName(uTmp, sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
+ if(sStandard != sCharFmt)
+ {
+ pRet = pDoc->FindCharFmtByName( sCharFmt );
+ }
+ if(!pRet)
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ if(USHRT_MAX != nId)
+ pRet = pDoc->GetCharFmtFromPool( nId );
+ }
+ return pRet;
+}
+/* -----------------05.05.98 08:30-------------------
+ *
+ * --------------------------------------------------*/
+SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
+{
+ OUString uTmp;
+ aValue >>= uTmp;
+ String sParaStyle;
+ SwStyleNameMapper::FillUIName(uTmp, sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ SwTxtFmtColl* pRet = pDoc->FindTxtFmtCollByName( sParaStyle );
+ if( !pRet )
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId )
+ pRet = pDoc->GetTxtCollFromPool( nId );
+ }
+ return pRet;
+}
+/* -----------------05.05.98 08:30-------------------
+ *
+ * --------------------------------------------------*/
+SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
+{
+ SwPageDesc* pRet = 0;
+ sal_uInt16 nCount = pDoc->GetPageDescCnt();
+ OUString uTmp;
+ aValue >>= uTmp;
+ String sPageDesc;
+ SwStyleNameMapper::FillUIName(uTmp, sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwPageDesc& rDesc = const_cast<const SwDoc *>(pDoc)
+ ->GetPageDesc( i );
+ if(rDesc.GetName() == sPageDesc)
+ {
+ pRet = (SwPageDesc*)&rDesc;
+ break;
+ }
+ }
+ if(!pRet)
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
+ if(USHRT_MAX != nId)
+ pRet = pDoc->GetPageDescFromPool( nId );
+ }
+ return pRet;
+}
+/******************************************************************************
+ *
+ ******************************************************************************/
+// Numerierung
+const unsigned short aSvxToUnoAdjust[] =
+{
+ text::HoriOrientation::LEFT, //3
+ text::HoriOrientation::RIGHT, //1
+ USHRT_MAX,
+ text::HoriOrientation::CENTER, //2
+ USHRT_MAX,
+ USHRT_MAX
+};
+
+const unsigned short aUnoToSvxAdjust[] =
+{
+ USHRT_MAX,
+ SVX_ADJUST_RIGHT, // 1
+ SVX_ADJUST_CENTER, // 3
+ SVX_ADJUST_LEFT, // 0
+ USHRT_MAX,
+ USHRT_MAX
+};
+
+/******************************************************************
+ * SwXFootnoteProperties
+ ******************************************************************/
+/* -----------------------------06.04.00 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFootnoteProperties::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFootnoteProperties");
+}
+/* -----------------------------06.04.00 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFootnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.FootnoteSettings") == rServiceName;
+}
+/* -----------------------------06.04.00 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.FootnoteSettings");
+ return aRet;
+}
+/*-- 14.12.98 14:03:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) :
+ pDoc(pDc),
+ m_pPropertySet(GetFootnoteSet())
+{
+}
+/*-- 14.12.98 14:03:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnoteProperties::~SwXFootnoteProperties()
+{
+
+}
+/*-- 14.12.98 14:03:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXFootnoteProperties::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
+ return aRef;
+}
+/*-- 14.12.98 14:03:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pDoc)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwFtnInfo aFtnInfo(pDoc->GetFtnInfo());
+ switch(pEntry->nWID)
+ {
+ case WID_PREFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.SetPrefix(uTmp);
+ }
+ break;
+ case WID_SUFFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.SetSuffix(uTmp);
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ if(nTmp >= 0 &&
+ (nTmp <= SVX_NUM_ARABIC ||
+ nTmp > SVX_NUM_BITMAP))
+ aFtnInfo.aFmt.SetNumberingType(nTmp);
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case WID_START_AT:
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ aFtnInfo.nFtnOffset = nTmp;
+ }
+ break;
+ case WID_FOOTNOTE_COUNTING :
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ switch(nTmp)
+ {
+ case FootnoteNumbering::PER_PAGE:
+ aFtnInfo.eNum = FTNNUM_PAGE;
+ break;
+ case FootnoteNumbering::PER_CHAPTER:
+ aFtnInfo.eNum = FTNNUM_CHAPTER;
+ break;
+ case FootnoteNumbering::PER_DOCUMENT:
+ aFtnInfo.eNum = FTNNUM_DOC;
+ break;
+ }
+ }
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
+ if(pColl)
+ aFtnInfo.SetFtnTxtColl(*pColl);
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
+ if(pDesc)
+ aFtnInfo.ChgPageDesc( pDesc );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE :
+ {
+ SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
+ if(pFmt)
+ {
+ if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
+ aFtnInfo.SetAnchorCharFmt(pFmt);
+ else
+ aFtnInfo.SetCharFmt(pFmt);
+ }
+ }
+ break;
+ case WID_POSITION_END_OF_DOC:
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aFtnInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE;
+ }
+ break;
+ case WID_END_NOTICE :
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.aQuoVadis = String(uTmp);
+ }
+ break;
+ case WID_BEGIN_NOTICE :
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.aErgoSum = String(uTmp);
+ }
+ break;
+ }
+ pDoc->SetFtnInfo(aFtnInfo);
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 14.12.98 14:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(pDoc)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
+ switch(pEntry->nWID)
+ {
+ case WID_PREFIX:
+ {
+ aRet <<= OUString(rFtnInfo.GetPrefix());
+ }
+ break;
+ case WID_SUFFIX:
+ {
+ aRet <<= OUString(rFtnInfo.GetSuffix());
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ aRet <<= rFtnInfo.aFmt.GetNumberingType();
+ }
+ break;
+ case WID_START_AT:
+ aRet <<= (sal_Int16)rFtnInfo.nFtnOffset;
+ break;
+ case WID_FOOTNOTE_COUNTING :
+ {
+ sal_Int16 nRet = 0;
+ switch(rFtnInfo.eNum)
+ {
+ case FTNNUM_PAGE:
+ nRet = FootnoteNumbering::PER_PAGE;
+ break;
+ case FTNNUM_CHAPTER:
+ nRet = FootnoteNumbering::PER_CHAPTER;
+ break;
+ case FTNNUM_DOC:
+ nRet = FootnoteNumbering::PER_DOCUMENT;
+ break;
+ }
+ aRet <<= nRet;
+ }
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = rFtnInfo.GetFtnTxtColl();
+ String aString;
+ if(pColl)
+ aString = String ( pColl->GetName() );
+ SwStyleNameMapper::FillProgName(aString, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ String aString;
+ if( rFtnInfo.GetPageDescDep()->GetRegisteredIn() )
+ {
+ SwStyleNameMapper::FillProgName(
+ rFtnInfo.GetPageDesc( *pDoc )->GetName(),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
+ sal_True);
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE:
+ {
+ String aString;
+ const SwCharFmt* pCharFmt = 0;
+ if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE )
+ {
+ if( rFtnInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rFtnInfo.GetAnchorCharFmt(*pDoc);
+ }
+ else
+ {
+ if( rFtnInfo.GetCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rFtnInfo.GetCharFmt(*pDoc);
+ }
+ if( pCharFmt )
+ {
+ SwStyleNameMapper::FillProgName(
+ pCharFmt->GetName(),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
+ sal_True);
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_POSITION_END_OF_DOC:
+ {
+ sal_Bool bTemp = FTNPOS_CHAPTER == rFtnInfo.ePos;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_END_NOTICE :
+ aRet <<= OUString(rFtnInfo.aQuoVadis);
+ break;
+ case WID_BEGIN_NOTICE :
+ aRet <<= OUString(rFtnInfo.aErgoSum);
+ break;
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 14.12.98 14:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnoteProperties::addPropertyChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnoteProperties::removePropertyChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:03:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnoteProperties::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:03:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnoteProperties::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/******************************************************************
+ * SwXEndnoteProperties
+ ******************************************************************/
+/* -----------------------------06.04.00 11:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXEndnoteProperties::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXEndnoteProperties");
+}
+/* -----------------------------06.04.00 11:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXEndnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.FootnoteSettings") == rServiceName;
+}
+/* -----------------------------06.04.00 11:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.FootnoteSettings");
+ return aRet;
+}
+/*-- 14.12.98 14:27:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) :
+ pDoc(pDc),
+ m_pPropertySet(GetEndnoteSet())
+{
+
+}
+/*-- 14.12.98 14:27:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXEndnoteProperties::~SwXEndnoteProperties()
+{
+
+}
+/*-- 14.12.98 14:27:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXEndnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
+ return aRef;
+}
+/*-- 14.12.98 14:27:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pDoc)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwEndNoteInfo aEndInfo(pDoc->GetEndNoteInfo());
+ switch(pEntry->nWID)
+ {
+ case WID_PREFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aEndInfo.SetPrefix(uTmp);
+ }
+ break;
+ case WID_SUFFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aEndInfo.SetSuffix(uTmp);
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ aEndInfo.aFmt.SetNumberingType(nTmp);
+ }
+ break;
+ case WID_START_AT:
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ aEndInfo.nFtnOffset = nTmp;
+ }
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
+ if(pColl)
+ aEndInfo.SetFtnTxtColl(*pColl);
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
+ if(pDesc)
+ aEndInfo.ChgPageDesc( pDesc );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE :
+ {
+ SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
+ if(pFmt)
+ {
+ if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
+ aEndInfo.SetAnchorCharFmt(pFmt);
+ else
+ aEndInfo.SetCharFmt(pFmt);
+ }
+ }
+ break;
+ }
+ pDoc->SetEndNoteInfo(aEndInfo);
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+}
+/*-- 14.12.98 14:27:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(pDoc)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
+ switch(pEntry->nWID)
+ {
+ case WID_PREFIX:
+ aRet <<= OUString(rEndInfo.GetPrefix());
+ break;
+ case WID_SUFFIX:
+ aRet <<= OUString(rEndInfo.GetSuffix());
+ break;
+ case WID_NUMBERING_TYPE :
+ aRet <<= rEndInfo.aFmt.GetNumberingType();
+ break;
+ case WID_START_AT:
+ aRet <<= (sal_Int16)rEndInfo.nFtnOffset;
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = rEndInfo.GetFtnTxtColl();
+ String aString;
+ if(pColl)
+ aString = pColl->GetName();
+ SwStyleNameMapper::FillProgName(
+ aString,
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
+ sal_True);
+ aRet <<= OUString ( aString );
+
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ String aString;
+ if( rEndInfo.GetPageDescDep()->GetRegisteredIn() )
+ {
+ SwStyleNameMapper::FillProgName(
+ rEndInfo.GetPageDesc( *pDoc )->GetName(),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
+ sal_True );
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE:
+ {
+ String aString;
+ const SwCharFmt* pCharFmt = 0;
+ if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE )
+ {
+ if( rEndInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rEndInfo.GetAnchorCharFmt(*pDoc);
+ }
+ else
+ {
+ if( rEndInfo.GetCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rEndInfo.GetCharFmt(*pDoc);
+ }
+ if( pCharFmt )
+ {
+ SwStyleNameMapper::FillProgName(
+ pCharFmt->GetName(),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
+ sal_True );
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ return aRet;
+}
+/*-- 14.12.98 14:27:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXEndnoteProperties::addPropertyChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:27:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXEndnoteProperties::removePropertyChangeListener(const OUString& /*PropertyName*/,
+ const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:27:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXEndnoteProperties::addVetoableChangeListener(const OUString& /*PropertyName*/,
+ const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:27:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXEndnoteProperties::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/******************************************************************
+ * SwXLineNumberingProperties
+ ******************************************************************/
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXLineNumberingProperties::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXLineNumberingProperties");
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXLineNumberingProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.LineNumberingProperties") == rServiceName;
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.LineNumberingProperties");
+ return aRet;
+}
+/*-- 14.12.98 14:33:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) :
+ pDoc(pDc),
+ m_pPropertySet(GetLineNumberingSet())
+{
+
+}
+/*-- 14.12.98 14:33:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXLineNumberingProperties::~SwXLineNumberingProperties()
+{
+
+}
+/*-- 14.12.98 14:33:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXLineNumberingProperties::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
+ return aRef;
+}
+/*-- 14.12.98 14:33:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLineNumberingProperties::setPropertyValue(
+ const OUString& rPropertyName, const Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pDoc)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwLineNumberInfo aInfo(pDoc->GetLineNumberInfo());
+ switch(pEntry->nWID)
+ {
+ case WID_NUM_ON:
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetPaintLineNumbers(bVal);
+ }
+ break;
+ case WID_CHARACTER_STYLE :
+ {
+ SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
+ if(pFmt)
+ aInfo.SetCharFmt(pFmt);
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ SvxNumberType aNumType(aInfo.GetNumType());
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ aNumType.SetNumberingType(nTmp);
+ aInfo.SetNumType(aNumType);
+ }
+ break;
+ case WID_NUMBER_POSITION :
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ switch(nTmp)
+ {
+ case style::LineNumberPosition::LEFT:
+ aInfo.SetPos(LINENUMBER_POS_LEFT); ;
+ break;
+ case style::LineNumberPosition::RIGHT :
+ aInfo.SetPos(LINENUMBER_POS_RIGHT); ;
+ break;
+ case style::LineNumberPosition::INSIDE:
+ aInfo.SetPos(LINENUMBER_POS_INSIDE); ;
+ break;
+ case style::LineNumberPosition::OUTSIDE:
+ aInfo.SetPos(LINENUMBER_POS_OUTSIDE);
+ break;
+ }
+ }
+ break;
+ case WID_DISTANCE :
+ {
+ INT32 nVal = 0;
+ aValue >>= nVal;
+ INT32 nTmp = MM100_TO_TWIP(nVal);
+ if (nTmp > USHRT_MAX)
+ nTmp = USHRT_MAX;
+ aInfo.SetPosFromLeft( static_cast< USHORT >(nTmp) );
+ }
+ break;
+ case WID_INTERVAL :
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ if( nTmp > 0)
+ aInfo.SetCountBy(nTmp);
+ }
+ break;
+ case WID_SEPARATOR_TEXT :
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aInfo.SetDivider(uTmp);
+ }
+ break;
+ case WID_SEPARATOR_INTERVAL:
+ {
+ INT16 nTmp = 0;
+ aValue >>= nTmp;
+ if( nTmp >= 0)
+ aInfo.SetDividerCountBy(nTmp);
+ }
+ break;
+ case WID_COUNT_EMPTY_LINES :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetCountBlankLines(bVal);
+ }
+ break;
+ case WID_COUNT_LINES_IN_FRAMES :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetCountInFlys(bVal);
+ }
+ break;
+ case WID_RESTART_AT_EACH_PAGE :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetRestartEachPage(bVal);
+ }
+ break;
+ }
+ pDoc->SetLineNumberInfo(aInfo);
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 14.12.98 14:33:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ Any aRet;
+ if(pDoc)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
+ if(pEntry)
+ {
+ const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo();
+ switch(pEntry->nWID)
+ {
+ case WID_NUM_ON:
+ {
+ sal_Bool bTemp = rInfo.IsPaintLineNumbers();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_CHARACTER_STYLE :
+ {
+ String aString;
+ // return empty string if no char format is set
+ // otherwise it would be created here
+ if(rInfo.GetRegisteredIn())
+ {
+ SwStyleNameMapper::FillProgName(
+ rInfo.GetCharFmt(*pDoc)->GetName(),
+ aString,
+ nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
+ sal_True);
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ aRet <<= rInfo.GetNumType().GetNumberingType();
+ break;
+ case WID_NUMBER_POSITION :
+ {
+ sal_Int16 nRet = 0;
+ switch(rInfo.GetPos())
+ {
+ case LINENUMBER_POS_LEFT:
+ nRet = style::LineNumberPosition::LEFT;
+ break;
+ case LINENUMBER_POS_RIGHT :
+ nRet = style::LineNumberPosition::RIGHT ;
+ break;
+ case LINENUMBER_POS_INSIDE:
+ nRet = style::LineNumberPosition::INSIDE ;
+ break;
+ case LINENUMBER_POS_OUTSIDE :
+ nRet = style::LineNumberPosition::OUTSIDE ;
+ break;
+ }
+ aRet <<= nRet;
+ }
+ break;
+ case WID_DISTANCE :
+ {
+ sal_uInt32 nPos = rInfo.GetPosFromLeft();
+ if(USHRT_MAX == nPos)
+ nPos = 0;
+ aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100_UNSIGNED(nPos));
+ }
+ break;
+ case WID_INTERVAL :
+ aRet <<= (sal_Int16)rInfo.GetCountBy();
+ break;
+ case WID_SEPARATOR_TEXT :
+ aRet <<= OUString(rInfo.GetDivider());
+ break;
+ case WID_SEPARATOR_INTERVAL:
+ aRet <<= (sal_Int16)rInfo.GetDividerCountBy();
+ break;
+ case WID_COUNT_EMPTY_LINES :
+ {
+ sal_Bool bTemp = rInfo.IsCountBlankLines();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_COUNT_LINES_IN_FRAMES :
+ {
+ sal_Bool bTemp = rInfo.IsCountInFlys();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_RESTART_AT_EACH_PAGE :
+ {
+ sal_Bool bTemp = rInfo.IsRestartEachPage();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 14.12.98 14:33:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLineNumberingProperties::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:33:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLineNumberingProperties::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:33:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLineNumberingProperties::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 14:33:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+/******************************************************************
+ * SwXNumberingRules
+ ******************************************************************/
+String SwXNumberingRules::sInvalidStyle(String::CreateFromAscii("__XXX___invalid"));
+
+const String& SwXNumberingRules::GetInvalidStyle()
+{
+ return sInvalidStyle;
+}
+/* -----------------------------10.03.00 17:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 17:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+// return implementation specific data
+sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXNumberingRules::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXNumberingRules");
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXNumberingRules::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.NumberingRules") == rServiceName;
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXNumberingRules::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.NumberingRules");
+ return aRet;
+}
+
+/*-- 14.12.98 14:57:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule) :
+ pDoc(0),
+ pDocShell(0),
+ pNumRule(new SwNumRule(rRule)),
+ m_pPropertySet(GetNumberingRulesSet()),
+ bOwnNumRuleCreated(TRUE)
+{
+ sal_uInt16 i;
+
+ //erstmal das Doc organisieren; es haengt an den gesetzten Zeichenvorlagen - wenn
+ // keine gesetzt sind, muss es auch ohne gehen
+ for( i = 0; i < MAXLEVEL; i++)
+ {
+ SwNumFmt rFmt(pNumRule->Get(i));
+ SwCharFmt* pCharFmt = rFmt.GetCharFmt();
+ if(pCharFmt)
+ {
+ pDoc = pCharFmt->GetDoc();
+ break;
+ }
+ }
+ if(pDoc)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ for(i = 0; i < MAXLEVEL; i++)
+ {
+ sNewCharStyleNames[i] = SwXNumberingRules::GetInvalidStyle();
+ sNewBulletFontNames[i] = SwXNumberingRules::GetInvalidStyle();
+ }
+}
+/* -----------------22.02.99 16:35-------------------
+ *
+ * --------------------------------------------------*/
+SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
+ pDoc(0),
+ pDocShell(&rDocSh),
+ pNumRule(0),
+ m_pPropertySet(GetNumberingRulesSet()),
+ bOwnNumRuleCreated(FALSE)
+{
+ pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/* -----------------------------24.08.00 11:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
+ pDoc(&rDoc),
+ pDocShell(0),
+ pNumRule(0),
+ m_pPropertySet(GetNumberingRulesSet()),
+ bOwnNumRuleCreated(FALSE)
+{
+ rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
+#if OSL_DEBUG_LEVEL > 1
+ sal_uInt16 nIndex =
+#endif
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ rDoc.MakeNumRule( sCreatedNumRuleName, 0, FALSE,
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+#if OSL_DEBUG_LEVEL > 1
+ (void)nIndex;
+#endif
+}
+/*-- 14.12.98 14:57:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXNumberingRules::~SwXNumberingRules()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pDoc && sCreatedNumRuleName.Len())
+ pDoc->DelNumRule( sCreatedNumRuleName );
+ if( pNumRule && bOwnNumRuleCreated )
+ delete pNumRule;
+}
+/*-- 14.12.98 14:57:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
+ throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(nIndex < 0 || MAXLEVEL <= nIndex)
+ throw lang::IndexOutOfBoundsException();
+
+ if(rElement.getValueType().getTypeClass() != uno::TypeClass_SEQUENCE)
+ throw lang::IllegalArgumentException();
+ const uno::Sequence<beans::PropertyValue>& rProperties =
+ *(const uno::Sequence<beans::PropertyValue>*)rElement.getValue();
+ SwNumRule* pRule = 0;
+ if(pNumRule)
+ SwXNumberingRules::SetNumberingRuleByIndex( *pNumRule,
+ rProperties, nIndex);
+ else if(pDocShell)
+ {
+ // --> OD 2008-04-21 #i87650# - correction of cws swwarnings:
+ // Do not set member <pNumRule>
+// pNumRule = pDocShell->GetDoc()->GetOutlineNumRule();
+// SwNumRule aNumRule(*pNumRule);
+ SwNumRule aNumRule( *(pDocShell->GetDoc()->GetOutlineNumRule()) );
+ // <--
+ SwXNumberingRules::SetNumberingRuleByIndex( aNumRule,
+ rProperties, nIndex);
+ //hier noch die Zeichenformate bei Bedarf setzen
+ const SwCharFmts* pFmts = pDocShell->GetDoc()->GetCharFmts();
+ sal_uInt16 nChCount = pFmts->Count();
+ for(sal_uInt16 i = 0; i < MAXLEVEL;i++)
+ {
+ SwNumFmt aFmt(aNumRule.Get( i ));
+ if(sNewCharStyleNames[i].Len() &&
+ !sNewCharStyleNames[i].EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)) &&
+ (!aFmt.GetCharFmt() ||
+ aFmt.GetCharFmt()->GetName()!= sNewCharStyleNames[i] ))
+ {
+ SwCharFmt* pCharFmt = 0;
+ for(sal_uInt16 j = 0; j< nChCount; j++)
+ {
+ SwCharFmt* pTmp = (*pFmts)[j];
+ if(pTmp->GetName() == sNewCharStyleNames[i])
+ {
+ pCharFmt = pTmp;
+ break;
+ }
+ }
+ if(!pCharFmt)
+ {
+ SfxStyleSheetBase* pBase;
+ pBase = pDocShell->GetStyleSheetPool()->Find(sNewCharStyleNames[i],
+ SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pDocShell->GetStyleSheetPool()->Make(sNewCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+
+ }
+ aFmt.SetCharFmt( pCharFmt );
+ aNumRule.Set( i, aFmt );
+ }
+ }
+ pDocShell->GetDoc()->SetOutlineNumRule( aNumRule );
+ }
+ else if(!pNumRule && pDoc && sCreatedNumRuleName.Len() &&
+ 0 != (pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName )))
+ {
+ SwXNumberingRules::SetNumberingRuleByIndex( *pRule,
+ rProperties, nIndex);
+
+ pRule->Validate();
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+/*-- 14.12.98 14:57:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXNumberingRules::getCount(void) throw( uno::RuntimeException )
+{
+ return MAXLEVEL;
+}
+/*-- 14.12.98 14:57:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(nIndex < 0 || MAXLEVEL <= nIndex)
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Any aVal;
+ const SwNumRule* pRule = pNumRule;
+ if(!pRule && pDoc && sCreatedNumRuleName.Len())
+ pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName );
+ if(pRule)
+ {
+ uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
+ *pRule, nIndex);
+ aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
+
+ }
+ else if(pDocShell)
+ {
+ uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
+ *pDocShell->GetDoc()->GetOutlineNumRule(), nIndex);
+ aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
+ }
+ else
+ throw uno::RuntimeException();
+ return aVal;
+}
+/*-- 14.12.98 14:57:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXNumberingRules::getElementType(void)
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Sequence<beans::PropertyValue>*)0);
+}
+/*-- 14.12.98 14:57:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXNumberingRules::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+/*-- 14.12.98 14:57:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
+ const SwNumRule& rNumRule, sal_Int32 nIndex) const
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ DBG_ASSERT( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
+
+ const SwNumFmt& rFmt = rNumRule.Get( (sal_uInt16)nIndex );
+
+ sal_Bool bChapterNum = pDocShell != 0;
+
+ PropValDataArr aPropertyValues;
+ //fill all properties into the array
+
+ //adjust
+ SvxAdjust eAdj = rFmt.GetNumAdjust();
+ sal_Int16 nINT16 = aSvxToUnoAdjust[(sal_uInt16)eAdj];
+ PropValData* pData = new PropValData((void*)&nINT16, "Adjust", ::getCppuType((const sal_Int16*)0) );
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //parentnumbering
+ nINT16 = rFmt.GetIncludeUpperLevels();
+ pData = new PropValData((void*)&nINT16, "ParentNumbering", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //prefix
+ OUString aUString = rFmt.GetPrefix();
+ pData = new PropValData((void*)&aUString, "Prefix", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //suffix
+ aUString = rFmt.GetSuffix();
+ pData = new PropValData((void*)&aUString, "Suffix", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //char style name
+ SwCharFmt* pCharFmt = rFmt.GetCharFmt();
+ String CharStyleName;
+ if(pCharFmt)
+ CharStyleName = pCharFmt->GetName();
+ //egal ob ein Style vorhanden ist oder nicht ueberschreibt der Array-Eintrag diesen String
+ if(sNewCharStyleNames[(sal_uInt16)nIndex].Len() &&
+ SwXNumberingRules::sInvalidStyle != sNewCharStyleNames[(sal_uInt16)nIndex])
+ CharStyleName = sNewCharStyleNames[(sal_uInt16)nIndex];
+
+ String aString;
+ SwStyleNameMapper::FillProgName( CharStyleName, aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ aUString = aString;
+ pData = new PropValData((void*)&aUString, "CharStyleName", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //startvalue
+ nINT16 = rFmt.GetStart();
+ pData = new PropValData((void*)&nINT16, "StartWith", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ // --> OD 2008-01-23 #newlistlevelattrs#
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ //leftmargin
+ sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetAbsLSpace());
+ pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //chartextoffset
+ nINT32 = TWIP_TO_MM100(rFmt.GetCharTextDistance());
+ pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //firstlineoffset
+ nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineOffset());
+ pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ // <--
+
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ // PositionAndSpaceMode
+ nINT16 = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT;
+ }
+ pData = new PropValData( (void*)&nINT16,
+ SW_PROP_NAME_STR(UNO_NAME_POSITION_AND_SPACE_MODE),
+ ::getCppuType((const sal_Int16*)0) );
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ // LabelFollowedBy
+ nINT16 = LabelFollow::LISTTAB;
+ if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
+ {
+ nINT16 = LabelFollow::SPACE;
+ }
+ else if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
+ {
+ nINT16 = LabelFollow::NOTHING;
+ }
+ pData = new PropValData( (void*)&nINT16,
+ SW_PROP_NAME_STR(UNO_NAME_LABEL_FOLLOWED_BY),
+ ::getCppuType((const sal_Int16*)0) );
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ // ListtabStopPosition
+ sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetListtabPos());
+ pData = new PropValData( (void*)&nINT32,
+ SW_PROP_NAME_STR(UNO_NAME_LISTTAB_STOP_POSITION),
+ ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ // FirstLineIndent
+ nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineIndent());
+ pData = new PropValData( (void*)&nINT32,
+ SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_INDENT),
+ ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ // IndentAt
+ nINT32 = TWIP_TO_MM100(rFmt.GetIndentAt());
+ pData = new PropValData( (void*)&nINT32,
+ SW_PROP_NAME_STR(UNO_NAME_INDENT_AT),
+ ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ // <--
+
+ //numberingtype
+ nINT16 = rFmt.GetNumberingType();
+ pData = new PropValData((void*)&nINT16, "NumberingType", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ if(!bChapterNum)
+ {
+ if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
+ {
+ //BulletId
+ nINT16 = rFmt.GetBulletChar();
+ pData = new PropValData((void*)&nINT16, "BulletId", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ const Font* pFont = rFmt.GetBulletFont();
+
+ //BulletChar
+ aUString = OUString(rFmt.GetBulletChar());
+ pData = new PropValData((void*)&aUString, "BulletChar", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //BulletFontName
+ String sBulletFontName;
+ if(pFont)
+ sBulletFontName = pFont->GetStyleName();
+ aUString = sBulletFontName;
+ pData = new PropValData((void*)&aUString, "BulletFontName", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //BulletFont
+ if(pFont)
+ {
+ awt::FontDescriptor aDesc;
+ SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
+ pData = new PropValData((void*)&aDesc, SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), ::getCppuType((const awt::FontDescriptor*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ }
+ if(SVX_NUM_BITMAP == rFmt.GetNumberingType())
+ {
+ //GraphicURL
+ const SvxBrushItem* pBrush = rFmt.GetBrush();
+ if(pBrush)
+ {
+ Any aAny;
+ pBrush->QueryValue( aAny, MID_GRAPHIC_URL );
+ aAny >>= aUString;
+ }
+ else
+ aUString = aEmptyStr;
+ pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //graphicbitmap
+ const Graphic* pGraphic = 0;
+ if(pBrush )
+ pGraphic = pBrush->GetGraphic();
+ if(pGraphic)
+ {
+ uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
+ pData = new PropValData((void*)&xBmp, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP),
+ ::getCppuType((const uno::Reference<awt::XBitmap>*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ Size aSize = rFmt.GetGraphicSize();
+ // --> OD 2010-05-04 #i101131# - applying patch from CMC
+ // adjust conversion due to type mismatch between <Size> and <awt::Size>
+// aSize.Width() = TWIP_TO_MM100( aSize.Width() );
+// aSize.Height() = TWIP_TO_MM100( aSize.Height() );
+// pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0));
+ awt::Size aAwtSize(TWIP_TO_MM100(aSize.Width()), TWIP_TO_MM100(aSize.Height()));
+ pData = new PropValData((void*)&aAwtSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0));
+ // <--
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation();
+ if(pOrient)
+ {
+ pData = new PropValData((void*)0, SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), ::getCppuType((const sal_Int16*)0));
+ ((const SfxPoolItem*)pOrient)->QueryValue(pData->aVal, MID_VERTORIENT_ORIENT);
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ }
+
+ }
+ else
+ {
+ //Vorlagenname
+ String sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
+ const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
+ const sal_uInt16 nCount = pColls->Count();
+ for(sal_uInt16 i = 0; i < nCount;++i)
+ {
+ SwTxtFmtColl &rTxtColl = *pColls->operator[](i);
+ if(rTxtColl.IsDefault())
+ continue;
+
+ //sal_Int8 nOutLevel = rTxtColl.GetOutlineLevel(); //#outline level,zhaojianwei
+ const sal_Int16 nOutLevel = rTxtColl.IsAssignedToListLevelOfOutlineStyle()
+ ? static_cast<sal_Int16>(rTxtColl.GetAssignedOutlineStyleLevel())
+ : MAXLEVEL; //<-end,zhaojianwei
+ if ( nOutLevel == nIndex )
+ {
+ sValue = rTxtColl.GetName();
+ break; // the style for the level in question has been found
+ }
+ else if( sValue==rTxtColl.GetName() )
+ {
+ // if the default for the level is existing, but its
+ // level is different, then it cannot be the default.
+ sValue.Erase();
+ }
+ }
+ String aName;
+ SwStyleNameMapper::FillProgName(sValue, aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+ aUString = aName;
+
+ pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME), ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+
+ uno::Sequence<beans::PropertyValue> aSeq(aPropertyValues.Count());
+ beans::PropertyValue* pArray = aSeq.getArray();
+
+ for(sal_uInt16 i = 0; i < aPropertyValues.Count(); i++)
+ {
+ pData = aPropertyValues.GetObject(i);
+ pArray[i].Value = pData->aVal;
+ pArray[i].Name = pData->sPropName;
+ pArray[i].Handle = -1;
+ }
+ aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count());
+ return aSeq;
+}
+/*-- 14.12.98 14:57:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+PropValData* lcl_FindProperty(const char* cName, PropValDataArr& rPropertyValues)
+{
+ OUString sCmp = C2U(cName);
+ for(sal_uInt16 i = 0; i < rPropertyValues.Count(); i++)
+ {
+ PropValData* pTemp = rPropertyValues.GetObject(i);
+ if(sCmp == pTemp->sPropName)
+ return pTemp;
+ }
+ return 0;
+}
+//-----------------------------------------------------------------------
+
+void SwXNumberingRules::SetNumberingRuleByIndex(
+ SwNumRule& rNumRule,
+ const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 nIndex)
+ throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ DBG_ASSERT( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
+
+ // the order of the names is important!
+ static const char* aNumPropertyNames[] =
+ {
+ "Adjust", //0
+ "ParentNumbering", //1
+ "Prefix", //2
+ "Suffix", //3
+ "CharStyleName", //4
+ "StartWith", //5
+ SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), //6
+ SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), //7
+ SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), //8
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ SW_PROP_NAME_STR(UNO_NAME_POSITION_AND_SPACE_MODE), //9
+ SW_PROP_NAME_STR(UNO_NAME_LABEL_FOLLOWED_BY), //10
+ SW_PROP_NAME_STR(UNO_NAME_LISTTAB_STOP_POSITION), //11
+ SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_INDENT), //12
+ SW_PROP_NAME_STR(UNO_NAME_INDENT_AT), //13
+ // <--
+ "NumberingType", //14
+ "BulletId", //15
+ SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), //16
+ "BulletFontName", //17
+ "BulletChar", //18
+ SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), //19
+ SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP), //20
+ SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), //21
+ SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), //22
+ SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME) //23
+ };
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ const sal_uInt16 nPropNameCount = 24;
+ const sal_uInt16 nNotInChapter = 15;
+ // <--
+
+ const beans::PropertyValue* pPropArray = rProperties.getConstArray();
+ PropValDataArr aPropertyValues;
+ sal_Bool bExcept = sal_False;
+ for(int i = 0; i < rProperties.getLength() && !bExcept; i++)
+ {
+ const beans::PropertyValue& rProp = pPropArray[i];
+ bExcept = sal_True;
+ for(sal_uInt16 j = 0; j < (pDocShell ? nPropNameCount : nPropNameCount - 1); j++)
+ {
+ //some values not in chapter numbering
+ if(pDocShell && j == nNotInChapter)
+ j = nPropNameCount - 1;
+ if(COMPARE_EQUAL == rProp.Name.compareToAscii(aNumPropertyNames[j]))
+ {
+ bExcept = sal_False;
+ break;
+ }
+ }
+ if(bExcept &&
+ (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletRelSize")) ||
+ rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletColor")) ) )
+ {
+ bExcept = sal_False;
+ }
+ PropValData* pData = new PropValData(rProp.Value, rProp.Name );
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+
+ SwNumFmt aFmt(rNumRule.Get( (sal_uInt16)nIndex ));
+ sal_Bool bWrongArg = sal_False;
+ if(!bExcept)
+ {
+ SvxBrushItem* pSetBrush = 0;
+ Size* pSetSize = 0;
+ SwFmtVertOrient* pSetVOrient = 0;
+ BOOL bCharStyleNameSet = FALSE;
+
+ for(sal_uInt16 i = 0; i < nPropNameCount && !bExcept && !bWrongArg; i++)
+ {
+ PropValData* pData = lcl_FindProperty(aNumPropertyNames[i], aPropertyValues);
+ if(!pData)
+ continue;
+ switch(i)
+ {
+ case 0: //"Adjust"
+ {
+ sal_Int16 nValue = 0;
+ pData->aVal >>= nValue;
+ if(nValue > 0 &&
+ nValue <= text::HoriOrientation::LEFT &&
+ USHRT_MAX != aUnoToSvxAdjust[nValue])
+ {
+ aFmt.SetNumAdjust((SvxAdjust)aUnoToSvxAdjust[nValue]);
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 1: //"ParentNumbering",
+ {
+ sal_Int16 nSet = 0;
+ pData->aVal >>= nSet;
+ if(nSet >= 0 && MAXLEVEL >= nSet)
+ aFmt.SetIncludeUpperLevels( static_cast< BYTE >(nSet) );
+ }
+ break;
+ case 2: //"Prefix",
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ aFmt.SetPrefix(uTmp);
+ }
+ break;
+ case 3: //"Suffix",
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ aFmt.SetSuffix(uTmp);
+ }
+ break;
+ case 4: //"CharStyleName",
+ {
+ bCharStyleNameSet = TRUE;
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ String sCharFmtName;
+ SwStyleNameMapper::FillUIName( uTmp, sCharFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ if(sCharFmtName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)))
+ {
+ sNewCharStyleNames[(sal_uInt16)nIndex] = SwXNumberingRules::GetInvalidStyle();
+ aFmt.SetCharFmt(0);
+ }
+ else if(pDocShell || pDoc)
+ {
+ SwDoc* pLocalDoc = pDoc ? pDoc : pDocShell->GetDoc();
+ const SwCharFmts* pFmts = pLocalDoc->GetCharFmts();
+ sal_uInt16 nChCount = pFmts->Count();
+
+ SwCharFmt* pCharFmt = 0;
+ if(sCharFmtName.Len())
+ {
+ for(sal_uInt16 j = 0; j< nChCount; j++)
+ {
+ SwCharFmt* pTmp = (*pFmts)[j];
+ if(pTmp->GetName() == sCharFmtName)
+ {
+ pCharFmt = pTmp;
+ break;
+ }
+ }
+ if(!pCharFmt)
+ {
+
+ SfxStyleSheetBase* pBase;
+ SfxStyleSheetBasePool* pPool = pLocalDoc->GetDocShell()->GetStyleSheetPool();
+ pBase = ((SfxStyleSheetBasePool*)pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+ }
+ }
+ aFmt.SetCharFmt( pCharFmt );
+ // os 2005-08-22 #i51842#
+ // If the character format has been found it's name should not be in the
+ // char style names array
+ //sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
+ sNewCharStyleNames[(sal_uInt16)nIndex].Erase();
+ }
+ else
+ sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
+ }
+ break;
+ case 5: //"StartWith",
+ {
+ INT16 nVal = 0;
+ pData->aVal >>= nVal;
+ aFmt.SetStart(nVal);
+ }
+ break;
+ case 6: //UNO_NAME_LEFT_MARGIN,
+ {
+ sal_Int32 nValue = 0;
+ pData->aVal >>= nValue;
+ // #i23727# nValue can be negative
+ aFmt.SetAbsLSpace((sal_uInt16) MM100_TO_TWIP(nValue));
+ }
+ break;
+ case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE,
+ {
+ sal_Int32 nValue = 0;
+ pData->aVal >>= nValue;
+ if(nValue >= 0)
+ aFmt.SetCharTextDistance((sal_uInt16) MM100_TO_TWIP(nValue));
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 8: //UNO_NAME_FIRST_LINE_OFFSET,
+ {
+ sal_Int32 nValue = 0;
+ pData->aVal >>= nValue;
+ // #i23727# nValue can be positive
+ nValue = MM100_TO_TWIP(nValue);
+ aFmt.SetFirstLineOffset((short)nValue);
+ }
+ break;
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ case 9: // UNO_NAME_POSITION_AND_SPACE_MODE
+ {
+ sal_Int16 nValue = 0;
+ pData->aVal >>= nValue;
+ if ( nValue == 0 )
+ {
+ aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
+ }
+ else if ( nValue == 1 )
+ {
+ aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
+ }
+ else
+ {
+ bWrongArg = sal_True;
+ }
+ }
+ break;
+ case 10: // UNO_NAME_LABEL_FOLLOWED_BY
+ {
+ sal_Int16 nValue = 0;
+ pData->aVal >>= nValue;
+ if ( nValue == 0 )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
+ }
+ else if ( nValue == 1 )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
+ }
+ else if ( nValue == 2 )
+ {
+ aFmt.SetLabelFollowedBy( SvxNumberFormat::NOTHING );
+ }
+ else
+ {
+ bWrongArg = sal_True;
+ }
+ }
+ break;
+ case 11: // UNO_NAME_LISTTAB_STOP_POSITION
+ {
+ sal_Int32 nValue = 0;
+ pData->aVal >>= nValue;
+ nValue = MM100_TO_TWIP(nValue);
+ if ( nValue >= 0 )
+ {
+ aFmt.SetListtabPos( nValue );
+ }
+ else
+ {
+ bWrongArg = sal_True;
+ }
+ }
+ break;
+ case 12: // UNO_NAME_FIRST_LINE_INDENT
+ {
+ sal_Int32 nValue = 0;
+ pData->aVal >>= nValue;
+ nValue = MM100_TO_TWIP(nValue);
+ aFmt.SetFirstLineIndent( nValue );
+ }
+ break;
+ case 13: // UNO_NAME_INDENT_AT
+ {
+ sal_Int32 nValue = 0;
+ pData->aVal >>= nValue;
+ nValue = MM100_TO_TWIP(nValue);
+ aFmt.SetIndentAt( nValue );
+ }
+ break;
+ // <--
+ case 14: //"NumberingType"
+ {
+ sal_Int16 nSet = 0;
+ pData->aVal >>= nSet;
+ if(nSet >= 0)
+ aFmt.SetNumberingType(nSet);
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 15: //"BulletId",
+ {
+ sal_Int16 nSet = 0;
+ if( pData->aVal >>= nSet )
+ aFmt.SetBulletChar(nSet);
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 16: //UNO_NAME_BULLET_FONT,
+ {
+ awt::FontDescriptor* pDesc = (awt::FontDescriptor*)pData->aVal.getValue();
+ if(pDesc)
+ {
+ // --> OD 2008-09-11 #i93725#
+ // do not accept "empty" font
+ if ( pDesc->Name.getLength() > 0 )
+ {
+ Font aFont;
+ SvxUnoFontDescriptor::ConvertToFont( *pDesc, aFont );
+ aFmt.SetBulletFont(&aFont);
+ }
+ // <--
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 17: //"BulletFontName",
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ String sBulletFontName(uTmp);
+ SwDocShell* pLclDocShell = pDocShell ? pDocShell : pDoc ? pDoc->GetDocShell() : 0;
+ if( sBulletFontName.Len() && pLclDocShell )
+ {
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pLclDocShell
+ ->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFontListItem->GetFontList();
+ FontInfo aInfo = pList->Get(
+ sBulletFontName, WEIGHT_NORMAL, ITALIC_NONE);
+ Font aFont(aInfo);
+ aFmt.SetBulletFont(&aFont);
+ }
+ else
+ sNewBulletFontNames[(sal_uInt16)nIndex] = sBulletFontName;
+ }
+ break;
+ case 18: //"BulletChar",
+ {
+ OUString aChar;
+ pData->aVal >>= aChar;
+ if(aChar.getLength() == 1)
+ {
+ aFmt.SetBulletChar(aChar.toChar());
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 19: //UNO_NAME_GRAPHIC_URL,
+ {
+ OUString sBrushURL;
+ pData->aVal >>= sBrushURL;
+ if(!pSetBrush)
+ {
+ const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
+ if(pOrigBrush)
+ {
+ pSetBrush = new SvxBrushItem(*pOrigBrush);
+ }
+ else
+ pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA, RES_BACKGROUND);
+ }
+ pSetBrush->PutValue( pData->aVal, MID_GRAPHIC_URL );
+ }
+ break;
+ case 20: //UNO_NAME_GRAPHIC_BITMAP,
+ {
+ uno::Reference< awt::XBitmap >* pBitmap = (uno::Reference< awt::XBitmap > *)pData->aVal.getValue();
+ if(pBitmap)
+ {
+ if(!pSetBrush)
+ {
+ const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
+ if(pOrigBrush)
+ {
+ pSetBrush = new SvxBrushItem(*pOrigBrush);
+ }
+ else
+ pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA, RES_BACKGROUND);
+ }
+
+ BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap );
+ Graphic aNewGr(aBmp);
+ pSetBrush->SetGraphic( aNewGr );
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 21: //UNO_NAME_GRAPHIC_SIZE,
+ {
+ if(!pSetSize)
+ pSetSize = new Size;
+ if(pData->aVal.getValueType() == ::getCppuType((awt::Size*)0))
+ {
+ awt::Size* pSize = (awt::Size*)pData->aVal.getValue();
+ pSize->Width = MM100_TO_TWIP(pSize->Width);
+ pSize->Height = MM100_TO_TWIP(pSize->Height);
+ pSetSize->Width() = pSize->Width;
+ pSetSize->Height() = pSize->Height;
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 22: //VertOrient
+ {
+ if(!pSetVOrient)
+ {
+ if(aFmt.GetGraphicOrientation())
+ pSetVOrient = (SwFmtVertOrient*)aFmt.GetGraphicOrientation()->Clone();
+ else
+ pSetVOrient = new SwFmtVertOrient;
+ }
+ ((SfxPoolItem*)pSetVOrient)->PutValue(pData->aVal, MID_VERTORIENT_ORIENT);
+ }
+ break;
+ case 23: //"HeadingStyleName"
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
+ const sal_uInt16 nCount = pColls->Count();
+ for(sal_uInt16 k = 0; k < nCount; ++k)
+ {
+ SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
+ if(rTxtColl.IsDefault())
+ continue;
+ //if(rTxtColl.GetOutlineLevel() == nIndex && //#outline level,removed by zhaojianwei
+ // rTxtColl.GetName() != sStyleName)
+ // rTxtColl..SetOutlineLevel(NO_NUMBERING);
+ //else if(rTxtColl.GetName() == sStyleName)
+ // rTxtColl.SetOutlineLevel(sal_Int8(nIndex));
+ if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && //add by zhaojianwei
+ rTxtColl.GetAssignedOutlineStyleLevel() == nIndex &&
+ rTxtColl.GetName() != sStyleName )
+ {
+ rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
+ }
+ else if ( rTxtColl.GetName() == sStyleName )
+ {
+ rTxtColl.AssignToListLevelOfOutlineStyle( nIndex );
+ } //<-end,,zhaojianwei,
+ }
+ }
+ break;
+ case 24: // BulletRelSize - unsupported - only available in Impress
+ break;
+ }
+ }
+ if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient))
+ {
+ if(!pSetBrush && aFmt.GetBrush())
+ pSetBrush = new SvxBrushItem(*aFmt.GetBrush());
+
+ if(pSetBrush)
+ {
+ if(!pSetVOrient && aFmt.GetGraphicOrientation())
+ pSetVOrient = new SwFmtVertOrient(*aFmt.GetGraphicOrientation());
+
+ if(!pSetSize)
+ {
+ pSetSize = new Size(aFmt.GetGraphicSize());
+ if(!pSetSize->Width() || !pSetSize->Height())
+ {
+ const Graphic* pGraphic = pSetBrush->GetGraphic();
+ if(pGraphic)
+ *pSetSize = ::GetGraphicSizeTwip(*pGraphic, 0);
+ }
+ }
+ sal_Int16 eOrient = pSetVOrient ?
+ (sal_Int16)pSetVOrient->GetVertOrient() : text::VertOrientation::NONE;
+ aFmt.SetGraphicBrush( pSetBrush, pSetSize, text::VertOrientation::NONE == eOrient ? 0 : &eOrient );
+ }
+ }
+ if((!bCharStyleNameSet || !sNewCharStyleNames[(sal_uInt16)nIndex].Len()) &&
+ aFmt.GetNumberingType() == NumberingType::BITMAP && !aFmt.GetCharFmt()
+ && SwXNumberingRules::GetInvalidStyle() != sNewCharStyleNames[(sal_uInt16)nIndex])
+ {
+ SwStyleNameMapper::FillProgName ( RES_POOLCHR_BUL_LEVEL, sNewCharStyleNames[(sal_uInt16)nIndex] );
+ }
+ delete pSetBrush;
+ delete pSetSize;
+ delete pSetVOrient;
+ }
+ aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count());
+
+ if(bWrongArg)
+ throw lang::IllegalArgumentException();
+ else if(bExcept)
+ throw uno::RuntimeException();
+ rNumRule.Set( (sal_uInt16)nIndex, aFmt );
+
+}
+/*-- 19.07.00 07:49:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
+ return aRef;
+}
+/*-- 19.07.00 07:49:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
+ throw(UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ SwNumRule* pDocRule = 0;
+ SwNumRule* pCreatedRule = 0;
+ if(!pNumRule)
+ {
+ if(!pNumRule && pDocShell)
+ {
+ pDocRule = new SwNumRule(*pDocShell->GetDoc()->GetOutlineNumRule());
+ }
+ else if(pDoc && sCreatedNumRuleName.Len())
+ {
+ pCreatedRule = pDoc->FindNumRulePtr( sCreatedNumRuleName);
+ }
+
+ }
+ if(!pNumRule && !pDocRule && !pCreatedRule)
+ throw RuntimeException();
+
+
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ if(!pCreatedRule)
+ pDocRule ? pDocRule->SetAutoRule(bVal) : pNumRule->SetAutoRule(bVal);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ pDocRule ? pDocRule->SetContinusNum(bVal) :
+ pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : pNumRule->SetContinusNum(bVal);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME)))
+ {
+ delete pDocRule;
+ throw IllegalArgumentException();
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ pDocRule ? pDocRule->SetAbsSpaces(bVal) :
+ pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : pNumRule->SetAbsSpaces(bVal);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ SwNumRuleType eNumRuleType = bVal ? OUTLINE_RULE : NUM_RULE;
+ pDocRule ? pDocRule->SetRuleType(eNumRuleType) :
+ pCreatedRule ? pCreatedRule->SetRuleType(eNumRuleType) : pNumRule->SetRuleType(eNumRuleType);
+ }
+ // --> OD 2008-04-23 #refactorlists#
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID)))
+ {
+ delete pDocRule;
+ throw IllegalArgumentException();
+ }
+ // <--
+ else
+ throw UnknownPropertyException();
+
+ if(pDocRule)
+ {
+ pDocShell->GetDoc()->SetOutlineNumRule(*pDocRule);
+ delete pDocRule;
+ }
+ else if(pCreatedRule)
+ {
+ pCreatedRule->Validate();
+ }
+}
+/*-- 19.07.00 07:49:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ const SwNumRule* pRule = pNumRule;
+ if(!pRule && pDocShell)
+ pRule = pDocShell->GetDoc()->GetOutlineNumRule();
+ else if(pDoc && sCreatedNumRuleName.Len())
+ pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName );
+ if(!pRule)
+ throw RuntimeException();
+
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC)))
+ {
+ BOOL bVal = pRule->IsAutoRule();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING)))
+ {
+ BOOL bVal = pRule->IsContinusNum();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME)))
+ aRet <<= OUString(pRule->GetName());
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS)))
+ {
+ BOOL bVal = pRule->IsAbsSpaces();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE)))
+ {
+ BOOL bVal = pRule->IsOutlineRule();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ // --> OD 2008-04-23 #refactorlists#
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID)))
+ {
+ ASSERT( pRule->GetDefaultListId().Len() != 0,
+ "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect -> please inform OD." );
+ aRet <<= OUString(pRule->GetDefaultListId());
+ }
+ // <--
+ else
+ throw UnknownPropertyException();
+ return aRet;
+}
+/*-- 19.07.00 07:49:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::addPropertyChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 19.07.00 07:49:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::removePropertyChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 19.07.00 07:49:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 19.07.00 07:49:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/* -----------------------------17.10.00 14:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXNumberingRules::getName() throw( RuntimeException )
+{
+ String aString;
+ if(pNumRule)
+ {
+ SwStyleNameMapper::FillProgName(pNumRule->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, sal_True );
+ return OUString ( aString );
+ }
+ // --> OD 2005-10-25 #126347# - consider chapter numbering <SwXNumberingRules>
+ else if ( pDocShell )
+ {
+ SwStyleNameMapper::FillProgName( pDocShell->GetDoc()->GetOutlineNumRule()->GetName(),
+ aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, sal_True );
+ return OUString ( aString );
+ }
+ // <--
+ else
+ return sCreatedNumRuleName;
+}
+/* -----------------------------17.10.00 14:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXNumberingRules::setName(const OUString& /*rName*/) throw( RuntimeException )
+{
+ RuntimeException aExcept;
+ aExcept.Message = C2U("readonly");
+ throw aExcept;
+}
+/*-- 14.12.98 14:58:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXNumberingRules::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ if(bOwnNumRuleCreated)
+ delete pNumRule;
+ pNumRule = 0;
+ pDoc = 0;
+ }
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXChapterNumbering::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXChapterNumbering");
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXChapterNumbering::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.ChapterNumbering") ||
+ sServiceName.EqualsAscii("com.sun.star.text.NumberingRules");
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ChapterNumbering");
+ pArray[1] = C2U("com.sun.star.text.NumberingRules");
+ return aRet;
+}
+/* -----------------22.02.99 16:33-------------------
+ *
+ * --------------------------------------------------*/
+SwXChapterNumbering::SwXChapterNumbering(SwDocShell& rDocSh) :
+ SwXNumberingRules(rDocSh)
+{
+}
+/* -----------------22.02.99 16:33-------------------
+ *
+ * --------------------------------------------------*/
+SwXChapterNumbering::~SwXChapterNumbering()
+{
+}
+
+/******************************************************************
+ * SwXTextColumns
+ ******************************************************************/
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextColumns::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextColumns");
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextColumns::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextColumns") == rServiceName;
+}
+/* -----------------------------06.04.00 11:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextColumns::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextColumns");
+ return aRet;
+}
+/* -----------------------------24.10.00 16:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount) :
+ nReference(0),
+ bIsAutomaticWidth(sal_True),
+ nAutoDistance(0),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)),
+ nSepLineWidth(0),
+ nSepLineColor(0), //black
+ nSepLineHeightRelative(100),//full height
+ nSepLineVertAlign(style::VerticalAlignment_MIDDLE),
+ bSepLineIsOn(sal_False)
+{
+ if(nColCount)
+ setColumnCount(nColCount);
+}
+/*-- 16.12.98 14:06:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) :
+ nReference(0),
+ aTextColumns(rFmtCol.GetNumCols()),
+ bIsAutomaticWidth(rFmtCol.IsOrtho()),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS))
+{
+ USHORT nItemGutterWidth = rFmtCol.GetGutterWidth();
+ nAutoDistance = bIsAutomaticWidth ?
+ USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth
+ : 0;
+ nAutoDistance = TWIP_TO_MM100(nAutoDistance);
+
+ TextColumn* pColumns = aTextColumns.getArray();
+ const SwColumns& rCols = rFmtCol.GetColumns();
+ for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++)
+ {
+ SwColumn* pCol = rCols[i];
+
+ pColumns[i].Width = pCol->GetWishWidth();
+ nReference += pColumns[i].Width;
+ pColumns[i].LeftMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetLeft ());
+ pColumns[i].RightMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetRight());
+ }
+ if(!aTextColumns.getLength())
+ nReference = USHRT_MAX;
+
+ nSepLineWidth = rFmtCol.GetLineWidth();
+ nSepLineColor = rFmtCol.GetLineColor().GetColor();
+ nSepLineHeightRelative = rFmtCol.GetLineHeight();
+ bSepLineIsOn = rFmtCol.GetLineAdj() != COLADJ_NONE;
+ switch(rFmtCol.GetLineAdj())
+ {
+ case COLADJ_TOP: nSepLineVertAlign = style::VerticalAlignment_TOP; break;
+ case COLADJ_BOTTOM: nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break;
+ case COLADJ_CENTER:
+ case COLADJ_NONE: nSepLineVertAlign = style::VerticalAlignment_MIDDLE;
+ }
+}
+/*-- 16.12.98 14:06:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextColumns::~SwXTextColumns()
+{
+
+}
+/*-- 16.12.98 14:06:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTextColumns::getReferenceValue(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return nReference;
+}
+/*-- 16.12.98 14:06:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SwXTextColumns::getColumnCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return static_cast< sal_Int16>( aTextColumns.getLength() );
+}
+/*-- 16.12.98 14:06:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::setColumnCount(sal_Int16 nColumns) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(nColumns <= 0)
+ throw uno::RuntimeException();
+ bIsAutomaticWidth = sal_True;
+ aTextColumns.realloc(nColumns);
+ TextColumn* pCols = aTextColumns.getArray();
+ nReference = USHRT_MAX;
+ sal_Int32 nWidth = nReference / nColumns;
+ sal_Int32 nDiff = nReference - nWidth * nColumns;
+ sal_Int32 nDist = nAutoDistance / 2;
+ for(sal_Int16 i = 0; i < nColumns; i++)
+ {
+ pCols[i].Width = nWidth;
+ pCols[i].LeftMargin = i == 0 ? 0 : nDist;
+ pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
+ }
+ pCols[nColumns - 1].Width += nDiff;
+}
+/*-- 16.12.98 14:06:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< TextColumn > SwXTextColumns::getColumns(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return aTextColumns;
+}
+/*-- 16.12.98 14:06:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nReferenceTemp = 0;
+ const TextColumn* prCols = rColumns.getConstArray();
+ for(long i = 0; i < rColumns.getLength(); i++)
+ {
+ nReferenceTemp += prCols[i].Width;
+ }
+ bIsAutomaticWidth = sal_False;
+ nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp;
+ aTextColumns = rColumns;
+}
+/*-- 25.10.00 10:15:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
+ return aRef;
+}
+/*-- 25.10.00 10:15:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pEntry)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pEntry->nWID)
+ {
+ case WID_TXTCOL_LINE_WIDTH:
+ {
+ sal_Int32 nTmp = 0;
+ aValue >>= nTmp;
+ if(nTmp < 0)
+ throw IllegalArgumentException();
+ nSepLineWidth = MM100_TO_TWIP(nTmp);
+ }
+ break;
+ case WID_TXTCOL_LINE_COLOR:
+ aValue >>= nSepLineColor;
+ break;
+ case WID_TXTCOL_LINE_REL_HGT:
+ {
+ sal_Int8 nTmp = 0;
+ aValue >>= nTmp;
+ if(nTmp < 0)
+ throw IllegalArgumentException();
+ nSepLineHeightRelative = nTmp;
+ }
+ break;
+ case WID_TXTCOL_LINE_ALIGN:
+ {
+ style::VerticalAlignment eAlign;
+ if(!(aValue >>= eAlign) )
+ {
+ sal_Int8 nTmp = 0;
+ if (! ( aValue >>= nTmp ) )
+ throw IllegalArgumentException();
+ else
+ nSepLineVertAlign = nTmp;
+ }
+ else
+ nSepLineVertAlign = static_cast< sal_Int8 >(eAlign);
+ }
+ break;
+ case WID_TXTCOL_LINE_IS_ON:
+ bSepLineIsOn = *(sal_Bool*)aValue.getValue();
+ break;
+ case WID_TXTCOL_AUTO_DISTANCE:
+ {
+ sal_Int32 nTmp = 0;
+ aValue >>= nTmp;
+ if(nTmp < 0 || nTmp >= nReference)
+ throw IllegalArgumentException();
+ nAutoDistance = nTmp;
+ sal_Int32 nColumns = aTextColumns.getLength();
+ TextColumn* pCols = aTextColumns.getArray();
+ sal_Int32 nDist = nAutoDistance / 2;
+ for(sal_Int32 i = 0; i < nColumns; i++)
+ {
+ pCols[i].LeftMargin = i == 0 ? 0 : nDist;
+ pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
+ }
+ }
+ break;
+ }
+}
+/*-- 25.10.00 10:15:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pEntry)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ Any aRet;
+ switch(pEntry->nWID)
+ {
+ case WID_TXTCOL_LINE_WIDTH:
+ aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nSepLineWidth));
+ break;
+ case WID_TXTCOL_LINE_COLOR:
+ aRet <<= nSepLineColor;
+ break;
+ case WID_TXTCOL_LINE_REL_HGT:
+ aRet <<= nSepLineHeightRelative;
+ break;
+ case WID_TXTCOL_LINE_ALIGN:
+ aRet <<= (style::VerticalAlignment)nSepLineVertAlign;
+ break;
+ case WID_TXTCOL_LINE_IS_ON:
+ aRet.setValue(&bSepLineIsOn, ::getBooleanCppuType());
+ break;
+ case WID_TXTCOL_IS_AUTOMATIC :
+ aRet.setValue(&bIsAutomaticWidth, ::getBooleanCppuType());
+ break;
+ case WID_TXTCOL_AUTO_DISTANCE:
+ aRet <<= nAutoDistance;
+ break;
+ }
+ return aRet;
+}
+/*-- 25.10.00 10:15:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::addPropertyChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 25.10.00 10:15:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::removePropertyChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 25.10.00 10:15:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 25.10.00 10:15:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextColumns::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/* -----------------------------25.10.00 11:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
new file mode 100644
index 000000000000..277eef1693f5
--- /dev/null
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -0,0 +1,762 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include "unosrch.hxx"
+#include <doc.hxx>
+#include <hints.hxx>
+#include <unomap.hxx>
+#include <unobaseclass.hxx>
+#include <unomid.h>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include "editeng/unolingu.hxx"
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+
+/* -----------------23.06.99 12:19-------------------
+
+ --------------------------------------------------*/
+class SwSearchProperties_Impl
+{
+ beans::PropertyValue** pValueArr; //
+ sal_uInt32 nArrLen;
+ const PropertyEntryVector_t aPropertyEntries;
+public:
+ SwSearchProperties_Impl();
+ ~SwSearchProperties_Impl();
+
+ void SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs)
+ throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException );
+ const uno::Sequence< beans::PropertyValue > GetProperties() const;
+
+ void FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const;
+ sal_Bool HasAttributes() const;
+};
+/* -----------------23.06.99 13:08-------------------
+
+ --------------------------------------------------*/
+SwSearchProperties_Impl::SwSearchProperties_Impl() :
+ nArrLen(0),
+ aPropertyEntries( aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)->getPropertyMap()->getPropertyEntries())
+{
+ nArrLen = aPropertyEntries.size();
+ pValueArr = new beans::PropertyValue*[nArrLen];
+ for(sal_uInt32 i = 0; i < nArrLen; i++)
+ pValueArr[i] = 0;
+}
+/* -----------------23.06.99 13:08-------------------
+
+ --------------------------------------------------*/
+SwSearchProperties_Impl::~SwSearchProperties_Impl()
+{
+ for(sal_uInt32 i = 0; i < nArrLen; i++)
+ delete pValueArr[i];
+ delete[] pValueArr;
+}
+/* -----------------23.06.99 13:09-------------------
+
+ --------------------------------------------------*/
+void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs)
+ throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
+{
+ const beans::PropertyValue* pProps = aSearchAttribs.getConstArray();
+ sal_uInt32 i;
+
+ //delete all existing values
+ for( i = 0; i < nArrLen; i++)
+ {
+ delete pValueArr[i];
+ pValueArr[i] = 0;
+ }
+
+ sal_uInt32 nLen = aSearchAttribs.getLength();
+ for(i = 0; i < nLen; i++)
+ {
+ sal_uInt16 nIndex = 0;
+ PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
+ while(pProps[i].Name != aIt->sName)
+ {
+ ++aIt;
+ nIndex++;
+ if( aIt == aPropertyEntries.end() )
+ throw beans::UnknownPropertyException();
+ }
+ pValueArr[nIndex] = new beans::PropertyValue(pProps[i]);
+ }
+}
+/* -----------------23.06.99 13:08-------------------
+
+ --------------------------------------------------*/
+const uno::Sequence< beans::PropertyValue > SwSearchProperties_Impl::GetProperties() const
+{
+ sal_uInt32 nPropCount = 0;
+ sal_uInt32 i;
+ for( i = 0; i < nArrLen; i++)
+ if(pValueArr[i])
+ nPropCount++;
+
+ uno::Sequence< beans::PropertyValue > aRet(nPropCount);
+ beans::PropertyValue* pProps = aRet.getArray();
+ nPropCount = 0;
+ for(i = 0; i < nArrLen; i++)
+ {
+ if(pValueArr[i])
+ {
+ pProps[nPropCount++] = *(pValueArr[i]);
+ }
+ }
+ return aRet;
+}
+/* -----------------23.06.99 13:06-------------------
+
+ --------------------------------------------------*/
+void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const
+{
+ //
+
+ SfxPoolItem* pBoxItem = 0,
+ *pBreakItem = 0,
+ *pAutoKernItem = 0,
+ *pWLineItem = 0,
+ *pTabItem = 0,
+ *pSplitItem = 0,
+ *pRegItem = 0,
+ *pLineSpaceItem = 0,
+ *pLineNumItem = 0,
+ *pKeepItem = 0,
+ *pLRItem = 0,
+ *pULItem = 0,
+ *pBackItem = 0,
+ *pAdjItem = 0,
+ *pDescItem = 0,
+ *pInetItem = 0,
+ *pDropItem = 0,
+ *pWeightItem = 0,
+ *pULineItem = 0,
+ *pOLineItem = 0,
+ *pCharFmtItem = 0,
+ *pShadItem = 0,
+ *pPostItem = 0,
+ *pNHyphItem = 0,
+ *pLangItem = 0,
+ *pKernItem = 0,
+ *pFontSizeItem = 0,
+ *pFontItem = 0,
+ *pBlinkItem = 0,
+ *pEscItem = 0,
+ *pCrossedOutItem = 0,
+ *pContourItem = 0,
+ *pCharColorItem = 0,
+ *pCasemapItem = 0,
+ *pBrushItem = 0;
+
+ PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
+ for(sal_uInt32 i = 0; i < nArrLen; i++, ++aIt)
+ {
+ if(pValueArr[i])
+ {
+ SfxPoolItem* pTempItem = 0;
+ switch(aIt->nWID)
+ {
+ case RES_BOX:
+ if(!pBoxItem)
+ pBoxItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pBoxItem;
+ break;
+ case RES_BREAK:
+ if(!pBreakItem)
+ pBreakItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pBreakItem;
+ break;
+ case RES_CHRATR_AUTOKERN:
+ if(!pAutoKernItem)
+ pAutoKernItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pAutoKernItem;
+ break;
+ case RES_CHRATR_BACKGROUND:
+ if(!pBrushItem)
+ pBrushItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pBrushItem;
+ break;
+ case RES_CHRATR_CASEMAP:
+ if(!pCasemapItem)
+ pCasemapItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pCasemapItem;
+ break;
+ case RES_CHRATR_COLOR:
+ if(!pCharColorItem)
+ pCharColorItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pCharColorItem;
+ break;
+ case RES_CHRATR_CONTOUR:
+ if(!pContourItem)
+ pContourItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pContourItem;
+ break;
+ case RES_CHRATR_CROSSEDOUT:
+ if(!pCrossedOutItem)
+ pCrossedOutItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pCrossedOutItem;
+ break;
+ case RES_CHRATR_ESCAPEMENT:
+ if(!pEscItem)
+ pEscItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pEscItem;
+ break;
+ case RES_CHRATR_BLINK:
+ if(!pBlinkItem)
+ pBlinkItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pBlinkItem;
+ break;
+ case RES_CHRATR_FONT:
+ if(!pFontItem)
+ pFontItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pFontItem;
+ break;
+ case RES_CHRATR_FONTSIZE:
+ if(!pFontSizeItem)
+ pFontSizeItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pFontSizeItem;
+ break;
+ case RES_CHRATR_KERNING:
+ if(!pKernItem)
+ pKernItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pKernItem;
+ break;
+ case RES_CHRATR_LANGUAGE:
+ if(!pLangItem)
+ pLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pLangItem;
+ break;
+ case RES_CHRATR_NOHYPHEN:
+ if(!pNHyphItem)
+ pNHyphItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pNHyphItem;
+ break;
+ case RES_CHRATR_POSTURE:
+ if(!pPostItem)
+ pPostItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pPostItem;
+ break;
+ case RES_CHRATR_SHADOWED:
+ if(!pShadItem)
+ pShadItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pShadItem;
+ break;
+ case RES_TXTATR_CHARFMT:
+ if(!pCharFmtItem)
+ pCharFmtItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pCharFmtItem;
+ break;
+ case RES_CHRATR_UNDERLINE:
+ if(!pULineItem)
+ pULineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pULineItem;
+ break;
+ case RES_CHRATR_OVERLINE:
+ if(!pOLineItem)
+ pOLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pOLineItem;
+ break;
+ case RES_CHRATR_WEIGHT:
+ if(!pWeightItem)
+ pWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pWeightItem;
+ break;
+ case RES_PARATR_DROP:
+ if(!pDropItem)
+ pDropItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pDropItem;
+ break;
+ case RES_TXTATR_INETFMT:
+ if(!pInetItem)
+ pInetItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pInetItem;
+ break;
+ case RES_PAGEDESC:
+ if(!pDescItem)
+ pDescItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pDescItem;
+ break;
+ case RES_PARATR_ADJUST:
+ if(!pAdjItem)
+ pAdjItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pAdjItem;
+ break;
+ case RES_BACKGROUND:
+ if(!pBackItem)
+ pBackItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pBackItem;
+ break;
+ case RES_UL_SPACE:
+ if(!pULItem)
+ pULItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pULItem;
+ break;
+ case RES_LR_SPACE:
+ if(!pLRItem)
+ pLRItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pLRItem;
+ break;
+ case RES_KEEP:
+ if(!pKeepItem)
+ pKeepItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pKeepItem;
+ break;
+ case RES_LINENUMBER:
+ if(!pLineNumItem)
+ pLineNumItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pLineNumItem;
+ break;
+ case RES_PARATR_LINESPACING:
+ if(!pLineSpaceItem)
+ pLineSpaceItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pLineSpaceItem;
+ break;
+ case RES_PARATR_REGISTER:
+ if(!pRegItem)
+ pRegItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pRegItem;
+ break;
+ case RES_PARATR_SPLIT:
+ if(!pSplitItem)
+ pSplitItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pSplitItem;
+ break;
+ case RES_PARATR_TABSTOP:
+ if(!pTabItem)
+ pTabItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pTabItem;
+ break;
+ case RES_CHRATR_WORDLINEMODE:
+ if(!pWLineItem)
+ pWLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pWLineItem;
+ break;
+ }
+ if(pTempItem)
+ {
+ if(bIsValueSearch)
+ {
+ pTempItem->PutValue(pValueArr[i]->Value, aIt->nMemberId);
+ rSet.Put(*pTempItem);
+ }
+ else
+ rSet.InvalidateItem( pTempItem->Which() );
+ }
+ }
+ }
+ delete pBoxItem;
+ delete pBreakItem;
+ delete pBreakItem ;
+ delete pAutoKernItem ;
+ delete pWLineItem;
+ delete pTabItem;
+ delete pSplitItem;
+ delete pRegItem;
+ delete pLineSpaceItem ;
+ delete pLineNumItem ;
+ delete pKeepItem;
+ delete pLRItem ;
+ delete pULItem ;
+ delete pBackItem;
+ delete pAdjItem;
+ delete pDescItem;
+ delete pInetItem;
+ delete pDropItem;
+ delete pWeightItem;
+ delete pULineItem;
+ delete pOLineItem;
+ delete pCharFmtItem ;
+ delete pShadItem;
+ delete pPostItem;
+ delete pNHyphItem;
+ delete pLangItem;
+ delete pKernItem;
+ delete pFontSizeItem ;
+ delete pFontItem;
+ delete pBlinkItem;
+ delete pEscItem;
+ delete pCrossedOutItem;
+ delete pContourItem ;
+ delete pCharColorItem;
+ delete pCasemapItem ;
+ delete pBrushItem ;
+}
+/* -----------------23.06.99 14:18-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwSearchProperties_Impl::HasAttributes() const
+{
+ for(sal_uInt32 i = 0; i < nArrLen; i++)
+ if(pValueArr[i])
+ return sal_True;
+ return sal_False;
+}
+
+/*-- 14.12.98 13:07:10 ---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSearch::SwXTextSearch() :
+ pSearchProperties( new SwSearchProperties_Impl),
+ pReplaceProperties( new SwSearchProperties_Impl),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SEARCH)),
+ bAll(sal_False),
+ bWord(sal_False),
+ bBack(sal_False),
+ bExpr(sal_False),
+ bCase(sal_False),
+ bStyles(sal_False),
+ bSimilarity(sal_False),
+ bLevRelax(sal_False),
+ nLevExchange(2),
+ nLevAdd(2),
+ nLevRemove(2),
+ bIsValueSearch(sal_True)
+{
+}
+/*-- 14.12.98 13:07:12 ---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSearch::~SwXTextSearch()
+{
+ delete pSearchProperties;
+ delete pReplaceProperties;
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextSearch::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextSearch::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextSearch::getSearchString(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return sSearchText;
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setSearchString(const OUString& rString)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sSearchText = String(rString);
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextSearch::getReplaceString(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return sReplaceText;
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setReplaceString(const OUString& rReplaceString) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sReplaceText = String(rReplaceString);
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextSearch::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
+ return aRef;
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ sal_Bool bVal = FALSE;
+ if(aValue.getValueType() == ::getBooleanCppuType())
+ bVal = *(sal_Bool*)aValue.getValue();
+ switch(pEntry->nWID)
+ {
+ case WID_SEARCH_ALL : bAll = bVal; break;
+ case WID_WORDS: bWord = bVal; break;
+ case WID_BACKWARDS : bBack = bVal; break;
+ case WID_REGULAR_EXPRESSION : bExpr = bVal; break;
+ case WID_CASE_SENSITIVE : bCase = bVal; break;
+ //case WID_IN_SELECTION : bInSel = bVal; break;
+ case WID_STYLES : bStyles = bVal; break;
+ case WID_SIMILARITY : bSimilarity = bVal; break;
+ case WID_SIMILARITY_RELAX: bLevRelax = bVal; break;
+ case WID_SIMILARITY_EXCHANGE: aValue >>= nLevExchange; break;
+ case WID_SIMILARITY_ADD: aValue >>= nLevAdd; break;
+ case WID_SIMILARITY_REMOVE : aValue >>= nLevRemove;break;
+ };
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextSearch::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ sal_Bool bSet = sal_False;
+ sal_Int16 nSet = 0;
+ if(pEntry)
+ {
+ switch(pEntry->nWID)
+ {
+ case WID_SEARCH_ALL : bSet = bAll; goto SET_BOOL;
+ case WID_WORDS: bSet = bWord; goto SET_BOOL;
+ case WID_BACKWARDS : bSet = bBack; goto SET_BOOL;
+ case WID_REGULAR_EXPRESSION : bSet = bExpr; goto SET_BOOL;
+ case WID_CASE_SENSITIVE : bSet = bCase; goto SET_BOOL;
+ //case WID_IN_SELECTION : bSet = bInSel; goto SET_BOOL;
+ case WID_STYLES : bSet = bStyles; goto SET_BOOL;
+ case WID_SIMILARITY : bSet = bSimilarity; goto SET_BOOL;
+ case WID_SIMILARITY_RELAX: bSet = bLevRelax;
+SET_BOOL:
+ aRet.setValue(&bSet, ::getBooleanCppuType());
+ break;
+ case WID_SIMILARITY_EXCHANGE: nSet = nLevExchange; goto SET_UINT16;
+ case WID_SIMILARITY_ADD: nSet = nLevAdd; goto SET_UINT16;
+ case WID_SIMILARITY_REMOVE : nSet = nLevRemove;
+SET_UINT16:
+ aRet <<= nSet;
+ break;
+ };
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ return aRet;
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException,uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException,uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException,uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextSearch::getValueSearch(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return bIsValueSearch;
+}
+/*-- 14.12.98 13:07:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setValueSearch(sal_Bool ValueSearch_) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ bIsValueSearch = ValueSearch_;
+}
+/*-- 14.12.98 13:07:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXTextSearch::getSearchAttributes(void) throw( uno::RuntimeException )
+{
+ return pSearchProperties->GetProperties();
+}
+/*-- 14.12.98 13:07:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setSearchAttributes(const uno::Sequence< beans::PropertyValue >& rSearchAttribs)
+ throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
+{
+ pSearchProperties->SetProperties(rSearchAttribs);
+}
+/*-- 14.12.98 13:07:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXTextSearch::getReplaceAttributes(void)
+ throw( uno::RuntimeException )
+{
+ return pReplaceProperties->GetProperties();
+}
+/*-- 14.12.98 13:07:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setReplaceAttributes(const uno::Sequence< beans::PropertyValue >& rReplaceAttribs)
+ throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
+{
+ pReplaceProperties->SetProperties(rReplaceAttribs);
+}
+/* -----------------23.06.99 14:13-------------------
+
+ --------------------------------------------------*/
+void SwXTextSearch::FillSearchItemSet(SfxItemSet& rSet) const
+{
+ pSearchProperties->FillItemSet(rSet, bIsValueSearch);
+}
+/* -----------------23.06.99 14:14-------------------
+
+ --------------------------------------------------*/
+void SwXTextSearch::FillReplaceItemSet(SfxItemSet& rSet) const
+{
+ pReplaceProperties->FillItemSet(rSet, bIsValueSearch);
+}
+/* -----------------23.06.99 14:17-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextSearch::HasSearchAttributes() const
+{
+ return pSearchProperties->HasAttributes();
+}
+/* -----------------23.06.99 14:17-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextSearch::HasReplaceAttributes() const
+{
+ return pReplaceProperties->HasAttributes();
+}
+/* -----------------------------19.04.00 14:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextSearch::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextSearch");
+}
+/* -----------------------------19.04.00 14:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextSearch::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.util.SearchDescriptor") == rServiceName ||
+ C2U("com.sun.star.util.ReplaceDescriptor") == rServiceName;
+}
+/* -----------------------------19.04.00 14:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextSearch::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.util.SearchDescriptor");
+ pArray[1] = C2U("com.sun.star.util.ReplaceDescriptor");
+ return aRet;
+}
+
+void SwXTextSearch::FillSearchOptions( util::SearchOptions& rSearchOpt ) const
+{
+ if( bSimilarity )
+ {
+ rSearchOpt.algorithmType = util::SearchAlgorithms_APPROXIMATE;
+ rSearchOpt.changedChars = nLevExchange;
+ rSearchOpt.deletedChars = nLevRemove;
+ rSearchOpt.insertedChars = nLevAdd;
+ if( bLevRelax )
+ rSearchOpt.searchFlag |= util::SearchFlags::LEV_RELAXED;
+ }
+ else if( bExpr )
+ rSearchOpt.algorithmType = util::SearchAlgorithms_REGEXP;
+ else
+ rSearchOpt.algorithmType = util::SearchAlgorithms_ABSOLUTE;
+
+ rSearchOpt.Locale = SvxCreateLocale( GetAppLanguage() );
+ rSearchOpt.searchString = sSearchText;
+ rSearchOpt.replaceString = sReplaceText;
+
+ if( !bCase )
+ rSearchOpt.transliterateFlags |= i18n::TransliterationModules_IGNORE_CASE;
+ if( bWord )
+ rSearchOpt.searchFlag |= util::SearchFlags::NORM_WORD_ONLY;
+
+// bInSel: 1; // wie geht das?
+// TODO: pSearch->bStyles!
+// inSelection??
+// aSrchParam.SetSrchInSelection(TypeConversion::toBOOL(aVal));
+}
+
+
+
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
new file mode 100644
index 000000000000..4309622c9545
--- /dev/null
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -0,0 +1,4536 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+#include <svx/svxids.hrc>
+#include <hintids.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/smplhint.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svl/style.hxx>
+#include <svl/itemiter.hxx>
+#include <svx/pageitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/paperinf.hxx>
+#include <pagedesc.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <charfmt.hxx>
+#include <cmdid.h>
+#include <unostyle.hxx>
+#include <unosett.hxx>
+#include <docsh.hxx>
+#include <swstyle.h>
+#include <paratr.hxx>
+#include <unoprnms.hxx>
+#include <shellio.hxx>
+#include <docstyle.hxx>
+#include <unotextbodyhf.hxx>
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <tools/urlobj.hxx>
+#include <poolfmt.hrc>
+#include <poolfmt.hxx>
+#include "unoevent.hxx"
+#include <fmtruby.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <sfx2/printer.hxx>
+#include <com/sun/star/style/ParagraphStyleCategory.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <istyleaccess.hxx>
+#include <GetMetricVal.hxx>
+#include <fmtfsize.hxx>
+#include <numrule.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+#include "ccoll.hxx"
+#include "unocore.hrc"
+
+#include <set>
+
+#define STYLE_FAMILY_COUNT 5 // we have 5 style families
+#define TYPE_BOOL 0
+#define TYPE_SIZE 1
+#define TYPE_BRUSH 2
+#define TYPE_ULSPACE 3
+#define TYPE_SHADOW 4
+#define TYPE_LRSPACE 5
+#define TYPE_BOX 6
+
+const unsigned short aStyleByIndex[] =
+{
+ SFX_STYLE_FAMILY_CHAR,
+ SFX_STYLE_FAMILY_PARA,
+ SFX_STYLE_FAMILY_PAGE ,
+ SFX_STYLE_FAMILY_FRAME ,
+ SFX_STYLE_FAMILY_PSEUDO
+};
+
+// Already implemented autostyle families: 3
+#define AUTOSTYLE_FAMILY_COUNT 3
+const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[] =
+{
+ IStyleAccess::AUTO_STYLE_CHAR,
+ IStyleAccess::AUTO_STYLE_RUBY,
+ IStyleAccess::AUTO_STYLE_PARA
+};
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+
+//convert FN_... to RES_ in header and footer itemset
+sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId)
+{
+ sal_uInt16 nRes = USHRT_MAX;
+ switch(nFNId)
+ {
+ case FN_UNO_FOOTER_ON:
+ case FN_UNO_HEADER_ON:
+ break;
+ case FN_UNO_FOOTER_BACKGROUND:
+ case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND;
+ break;
+ case FN_UNO_FOOTER_BOX:
+ case FN_UNO_HEADER_BOX: nRes = RES_BOX;
+ break;
+ case FN_UNO_FOOTER_LR_SPACE:
+ case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;
+ break;
+ case FN_UNO_FOOTER_SHADOW:
+ case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;
+ break;
+ case FN_UNO_FOOTER_BODY_DISTANCE:
+ case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;
+ break;
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
+ break;
+ case FN_UNO_FOOTER_SHARE_CONTENT:
+ case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED;
+ break;
+ case FN_UNO_FOOTER_HEIGHT:
+ case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;
+ break;
+ case FN_UNO_FOOTER_EAT_SPACING:
+ case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;
+ break;
+ }
+ return nRes;
+
+}
+
+SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily )
+{
+ switch ( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ return nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
+ case SFX_STYLE_FAMILY_PARA:
+ return nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL;
+ case SFX_STYLE_FAMILY_FRAME:
+ return nsSwGetPoolIdFromName::GET_POOLID_FRMFMT;
+ case SFX_STYLE_FAMILY_PAGE:
+ return nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ return nsSwGetPoolIdFromName::GET_POOLID_NUMRULE;
+ default:
+ DBG_ASSERT(sal_False, "someone asking for all styles in unostyle.cxx!" );
+ return nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
+ }
+}
+
+class SwAutoStylesEnumImpl
+{
+ std::vector<SfxItemSet_Pointer_t> mAutoStyles;
+ std::vector<SfxItemSet_Pointer_t>::iterator aIter;
+ SwDoc* pDoc;
+ IStyleAccess::SwAutoStyleFamily eFamily;
+public:
+ SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAutoStyleFamily eFam );
+ ::sal_Bool hasMoreElements() { return aIter != mAutoStyles.end(); }
+ SfxItemSet_Pointer_t nextElement() { return *(aIter++); }
+ IStyleAccess::SwAutoStyleFamily getFamily() const { return eFamily; }
+ SwDoc* getDoc() const { return pDoc; }
+};
+
+
+/******************************************************************
+ * SwXStyleFamilies
+ ******************************************************************/
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXStyleFamilies::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXStyleFamilies");
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXStyleFamilies::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.style.StyleFamilies") == rServiceName;
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXStyleFamilies::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.style.StyleFamilies");
+ return aRet;
+}
+/*-- 16.12.98 15:13:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamilies::SwXStyleFamilies(SwDocShell& rDocShell) :
+ SwUnoCollection(rDocShell.GetDoc()),
+ pDocShell(&rDocShell),
+ pxCharStyles(0),
+ pxParaStyles(0),
+ pxFrameStyles(0),
+ pxPageStyles(0),
+ pxNumberingStyles(0)
+{
+
+}
+/*-- 16.12.98 15:13:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamilies::~SwXStyleFamilies()
+{
+ delete pxCharStyles;
+ delete pxParaStyles;
+ delete pxFrameStyles;
+ delete pxPageStyles;
+ delete pxNumberingStyles;
+}
+/*-- 21.12.98 12:05:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
+ throw(
+ container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+// der Index kommt aus const unsigned short aStyleByIndex[] =
+ uno::Any aRet;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ if(Name.compareToAscii("CharacterStyles") == 0 )
+ aRet = getByIndex(0);
+ else if(Name.compareToAscii("ParagraphStyles") == 0)
+ aRet = getByIndex(1);
+ else if(Name.compareToAscii("FrameStyles") == 0 )
+ aRet = getByIndex(3);
+ else if(Name.compareToAscii("PageStyles") == 0 )
+ aRet = getByIndex(2);
+ else if(Name.compareToAscii("NumberingStyles") == 0 )
+ aRet = getByIndex(4);
+ else
+ throw container::NoSuchElementException();
+ return aRet;
+}
+/*-- 21.12.98 12:05:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXStyleFamilies::getElementNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aNames(STYLE_FAMILY_COUNT);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = C2U("CharacterStyles");
+ pNames[1] = C2U("ParagraphStyles");
+ pNames[2] = C2U("FrameStyles");
+ pNames[3] = C2U("PageStyles");
+ pNames[4] = C2U("NumberingStyles");
+ return aNames;
+}
+/*-- 21.12.98 12:05:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamilies::hasByName(const OUString& Name) throw( uno::RuntimeException )
+{
+ if( Name.compareToAscii("CharacterStyles") == 0 ||
+ Name.compareToAscii("ParagraphStyles") == 0 ||
+ Name.compareToAscii("FrameStyles") == 0 ||
+ Name.compareToAscii("PageStyles") == 0 ||
+ Name.compareToAscii("NumberingStyles") == 0 )
+ return sal_True;
+ else
+ return sal_False;
+}
+/*-- 16.12.98 15:13:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXStyleFamilies::getCount(void) throw( uno::RuntimeException )
+{
+ return STYLE_FAMILY_COUNT;
+}
+/*-- 16.12.98 15:13:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(nIndex < 0 || nIndex >= STYLE_FAMILY_COUNT)
+ throw lang::IndexOutOfBoundsException();
+ if(IsValid())
+ {
+ uno::Reference< container::XNameContainer > aRef;
+ sal_uInt16 nType = aStyleByIndex[nIndex];
+ switch( nType )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ if(!pxCharStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxCharStyles = new uno::Reference< container::XNameContainer > ();
+ *pxCharStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxCharStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ if(!pxParaStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxParaStyles = new uno::Reference< container::XNameContainer > ();
+ *pxParaStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxParaStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ if(!pxPageStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxPageStyles = new uno::Reference< container::XNameContainer > ();
+ *pxPageStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxPageStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ if(!pxFrameStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxFrameStyles = new uno::Reference< container::XNameContainer > ();
+ *pxFrameStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxFrameStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ if(!pxNumberingStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxNumberingStyles = new uno::Reference< container::XNameContainer > ();
+ *pxNumberingStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxNumberingStyles;
+ }
+ break;
+ }
+ aRet.setValue(&aRef, ::getCppuType((const uno::Reference<container::XNameContainer>*)0));
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 16.12.98 15:13:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXStyleFamilies::getElementType(void)
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<container::XNameContainer>*)0);
+
+}
+/*-- 16.12.98 15:13:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamilies::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+/*-- 16.12.98 15:13:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL,
+ const uno::Sequence< beans::PropertyValue >& aOptions)
+ throw( io::IOException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bLoadStyleText = sal_True;
+ sal_Bool bLoadStylePage = sal_True;
+ sal_Bool bLoadStyleOverwrite = sal_True;
+ sal_Bool bLoadStyleNumbering = sal_True;
+ sal_Bool bLoadStyleFrame = sal_True;
+ if(IsValid() && rURL.getLength())
+ {
+ const uno::Any* pVal;
+ int nCount = aOptions.getLength();
+ const beans::PropertyValue* pArray = aOptions.getConstArray();
+ for(int i = 0; i < nCount; i++)
+ if( ( pVal = &pArray[i].Value)->getValueType() ==
+ ::getBooleanCppuType() )
+ {
+ String sName = pArray[i].Name;
+ sal_Bool bVal = *(sal_Bool*)pVal->getValue();
+ if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_OVERWRITE_STYLES )))
+ bLoadStyleOverwrite = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_NUMBERING_STYLES )))
+ bLoadStyleNumbering = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_PAGE_STYLES )))
+ bLoadStylePage = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_FRAME_STYLES )))
+ bLoadStyleFrame = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_TEXT_STYLES )))
+ bLoadStyleText = bVal;
+ }
+
+ SwgReaderOption aOpt;
+ aOpt.SetFrmFmts( bLoadStyleFrame );
+ aOpt.SetTxtFmts( bLoadStyleText );
+ aOpt.SetPageDescs( bLoadStylePage );
+ aOpt.SetNumRules( bLoadStyleNumbering );
+ aOpt.SetMerge( !bLoadStyleOverwrite );
+
+ ULONG nErr = pDocShell->LoadStylesFromFile( rURL, aOpt, TRUE );
+ if( nErr )
+ throw io::IOException();
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 16.12.98 15:13:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXStyleFamilies::getStyleLoaderOptions(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< beans::PropertyValue > aSeq(5);
+ beans::PropertyValue* pArray = aSeq.getArray();
+ uno::Any aVal;
+ sal_Bool bTemp = sal_True;
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[0] = beans::PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_TEXT_STYLES)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[1] = beans::PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_FRAME_STYLES)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[2] = beans::PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_PAGE_STYLES)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[3] = beans::PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_NUMBERING_STYLES)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[4] = beans::PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_OVERWRITE_STYLES)), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ return aSeq;
+}
+
+/******************************************************************
+ * SwXStyleFamily
+ ******************************************************************/
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXStyleFamily::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXStyleFamily");
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXStyleFamily::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.style.StyleFamily") == rServiceName;
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXStyleFamily::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.style.StyleFamily");
+ return aRet;
+}
+/*-- 16.12.98 16:03:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamily::SwXStyleFamily(SwDocShell* pDocSh, sal_uInt16 nFamily) :
+ eFamily((SfxStyleFamily)nFamily),
+ pBasePool(pDocSh->GetStyleSheetPool()),
+ pDocShell(pDocSh)
+{
+/* switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_CHAR_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARA_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PAGE_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_FRAME_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_NUM_STYLE);
+ break;
+ }*/
+ StartListening(*pBasePool);
+}
+/*-- 16.12.98 16:03:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamily::~SwXStyleFamily()
+{
+
+}
+sal_Int32 lcl_GetCountOrName ( const SwDoc &rDoc, SfxStyleFamily eFamily, String *pString, sal_uInt16 nIndex = USHRT_MAX )
+{
+ sal_Int32 nCount = 0;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
+ RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN;
+ nIndex = nIndex - nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetCharFmts()->Count();
+ for( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
+ if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
+ continue;
+ if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ // the default character format needs to be set to "Default!"
+ if(rDoc.GetDfltCharFmt() == pFmt)
+ SwStyleNameMapper::FillUIName(
+ RES_POOLCOLL_STANDARD, *pString );
+ else
+ *pString = pFmt->GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ sal_uInt16 nBaseCount = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
+ RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN;
+ nIndex = nIndex - nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->Count();
+ for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i];
+ if ( pColl->IsDefault() )
+ continue;
+ if ( IsPoolUserFmt ( pColl->GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = pColl->GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
+ nIndex = nIndex - nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->Count();
+ for( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
+ if(pFmt->IsDefault() || pFmt->IsAuto())
+ continue;
+ if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = pFmt->GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ sal_uInt16 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN;
+ nIndex = nIndex - nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetPageDescCnt();
+ for(sal_uInt16 i = 0; i < nArrLen; ++i)
+ {
+ const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
+
+ /*if(rDesc.IsDefault() || rDesc.IsAuto())
+ continue;*/
+ if ( IsPoolUserFmt ( rDesc.GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = rDesc.GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
+ nIndex = nIndex - nBaseCount;
+ const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
+ for(USHORT i = 0; i < rNumTbl.Count(); ++i)
+ {
+ const SwNumRule& rRule = *rNumTbl[ i ];
+ if( rRule.IsAutoRule() )
+ continue;
+ if ( IsPoolUserFmt ( rRule.GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = rRule.GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+
+ default:
+ ;
+ }
+ return nCount;
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXStyleFamily::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ return lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, NULL );
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXStyleFamily::getByIndex(sal_Int32 nTempIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if ( nTempIndex >= 0 && nTempIndex < USHRT_MAX )
+ {
+ sal_uInt16 nIndex = static_cast < sal_uInt16 > ( nTempIndex );
+ if(pBasePool)
+ {
+ String sStyleName;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ if ( nIndex < ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCHR_NORMAL_BEGIN + nIndex), sStyleName );
+ else if ( nIndex < ( RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
+ RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCHR_HTML_BEGIN
+ - RES_POOLCHR_NORMAL_END + RES_POOLCHR_NORMAL_BEGIN
+ + nIndex, sStyleName );
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ if ( nIndex < ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_TEXT_BEGIN + nIndex), sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex), sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_REGISTER_BEGIN
+ - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex), sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_DOC_BEGIN
+ - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
+ - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex), sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
+ RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_HTML_BEGIN
+ - RES_POOLCOLL_DOC_END + RES_POOLCOLL_DOC_BEGIN
+ - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
+ - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex), sStyleName );
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ if ( nIndex < ( RES_POOLFRM_END - RES_POOLFRM_BEGIN ) )
+ {
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLFRM_BEGIN + nIndex), sStyleName );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ if ( nIndex < ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ) )
+ {
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + nIndex), sStyleName );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ if ( nIndex < ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ) )
+ {
+ SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLNUMRULE_BEGIN + nIndex), sStyleName );
+ }
+ }
+ break;
+
+ default:
+ ;
+ }
+ if ( !sStyleName.Len() )
+ lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, &sStyleName, nIndex );
+
+ if ( sStyleName.Len() )
+ {
+ SfxStyleSheetBase* pBase = pBasePool->Find( sStyleName, eFamily );
+ if(pBase)
+ {
+ uno::Reference< style::XStyle > xStyle = _FindStyle(sStyleName);
+ if(!xStyle.is())
+ {
+ xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
+ new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
+ eFamily == SFX_STYLE_FAMILY_FRAME ?
+ new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
+ new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
+ }
+ aRet.setValue(&xStyle, ::getCppuType((uno::Reference<style::XStyle>*)0));
+ }
+ else
+ throw container::NoSuchElementException();
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+
+ return aRet;
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXStyleFamily::getByName(const OUString& rName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ {
+ uno::Reference< style::XStyle > xStyle = _FindStyle(sStyleName);
+ if(!xStyle.is())
+ {
+ xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
+ new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
+ eFamily == SFX_STYLE_FAMILY_FRAME ?
+ new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
+ new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
+ }
+ aRet.setValue(&xStyle, ::getCppuType((uno::Reference<style::XStyle>*)0));
+ }
+ else
+ throw container::NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< OUString > aRet;
+ if(pBasePool)
+ {
+ SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
+ sal_uInt16 nCount = pIterator->Count();
+ aRet.realloc(nCount);
+ OUString* pArray = aRet.getArray();
+ String aString;
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ pArray[i] = OUString ( aString );
+ }
+ delete pIterator;
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamily::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(pBasePool)
+ {
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ bRet = 0 != pBase;
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+
+}
+/*-- 16.12.98 16:03:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXStyleFamily::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<style::XStyle>*)0);
+
+}
+/*-- 16.12.98 16:03:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamily::hasElements(void) throw( uno::RuntimeException )
+{
+ if(!pBasePool)
+ throw uno::RuntimeException();
+ return sal_True;
+}
+/*-- 16.12.98 16:03:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pBasePool)
+ {
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ SfxStyleSheetBase* pUINameBase = pBasePool->Find( sStyleName );
+ if(pBase || pUINameBase)
+ throw container::ElementExistException();
+ else
+ {
+ if(rElement.getValueType().getTypeClass() ==
+ uno::TypeClass_INTERFACE)
+ {
+ uno::Reference< uno::XInterface > * pxRef =
+ (uno::Reference< uno::XInterface > *)rElement.getValue();
+
+ uno::Reference<lang::XUnoTunnel> xStyleTunnel( *pxRef, uno::UNO_QUERY);
+
+ SwXStyle* pNewStyle = 0;
+ if(xStyleTunnel.is())
+ {
+ pNewStyle = reinterpret_cast< SwXStyle * >(
+ sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
+ }
+ if(!pNewStyle || !pNewStyle->IsDescriptor() ||
+ pNewStyle->GetFamily() != eFamily)
+ throw lang::IllegalArgumentException();
+ if(pNewStyle)
+ {
+ sal_uInt16 nMask = 0xffff;
+ if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
+ nMask &= ~SWSTYLEBIT_CONDCOLL;
+#if OSL_DEBUG_LEVEL > 1
+ SfxStyleSheetBase& rNewBase =
+#endif
+ pBasePool->Make(sStyleName, eFamily, nMask);
+ pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool);
+ pNewStyle->SetStyleName(sStyleName);
+ String sParentStyleName(pNewStyle->GetParentStyleName());
+ if(sParentStyleName.Len())
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName);
+ if(pParentBase && pParentBase->GetFamily() == eFamily &&
+ &pParentBase->GetPool() == pBasePool)
+ pBasePool->SetParent( eFamily, sStyleName, sParentStyleName );
+
+ }
+#if OSL_DEBUG_LEVEL > 1
+ (void)rNewBase;
+#endif
+ //so, jetzt sollten noch die Properties des Descriptors angewandt werden
+ pNewStyle->ApplyDescriptorProperties();
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(rName);
+ //Ersetzung geht nur fuer benutzerdefinierte Styles
+ if(!pBase)
+ throw container::NoSuchElementException();
+ if(!pBase->IsUserDefined())
+ throw lang::IllegalArgumentException();
+ //if theres an object available to this style then it must be invalidated
+ uno::Reference< style::XStyle > xStyle = _FindStyle(pBase->GetName());
+ if(xStyle.is())
+ {
+ uno::Reference<lang::XUnoTunnel> xTunnel( xStyle, uno::UNO_QUERY);
+ if(xTunnel.is())
+ {
+ SwXStyle* pStyle = reinterpret_cast< SwXStyle * >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
+ pStyle->Invalidate();
+ }
+ }
+
+ pBasePool->Remove(pBase);
+ insertByName(rName, rElement);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::removeByName(const OUString& rName) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ String aString;
+ SwStyleNameMapper::FillUIName(rName, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+
+ SfxStyleSheetBase* pBase = pBasePool->Find( aString );
+ if(pBase)
+ pBasePool->Remove(pBase);
+ else
+ throw container::NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXStyleFamily::getPropertySetInfo( ) throw (uno::RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+ return uno::Reference< beans::XPropertySetInfo >();
+}
+
+void SAL_CALL SwXStyleFamily::setPropertyValue( const ::rtl::OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+uno::Any SAL_CALL SwXStyleFamily::getPropertyValue( const ::rtl::OUString& sPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+
+ if ( sPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DisplayName") ) )
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_uInt32 nResId = 0;
+ switch ( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ nResId = STR_STYLE_FAMILY_CHARACTER; break;
+ case SFX_STYLE_FAMILY_PARA:
+ nResId = STR_STYLE_FAMILY_PARAGRAPH; break;
+ case SFX_STYLE_FAMILY_FRAME:
+ nResId = STR_STYLE_FAMILY_FRAME; break;
+ case SFX_STYLE_FAMILY_PAGE:
+ nResId = STR_STYLE_FAMILY_PAGE; break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ nResId = STR_STYLE_FAMILY_NUMBERING; break;
+ default:
+ OSL_ENSURE( 0, "SwXStyleFamily::getPropertyValue(): invalid family" );
+ }
+ if ( nResId > 0 )
+ {
+ OUString sDisplayName( String( SW_RES( nResId ) ) );
+ aRet = uno::makeAny( sDisplayName );
+ }
+ }
+ else
+ {
+ throw beans::UnknownPropertyException( OUString( RTL_CONSTASCII_USTRINGPARAM("unknown property: ") ) + sPropertyName, static_cast<OWeakObject *>(this) );
+ }
+
+ return aRet;
+}
+
+void SAL_CALL SwXStyleFamily::addPropertyChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+void SAL_CALL SwXStyleFamily::removePropertyChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+void SAL_CALL SwXStyleFamily::addVetoableChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+void SAL_CALL SwXStyleFamily::removeVetoableChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ SfxSimpleHint *pHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if( pHint && ( pHint->GetId() & SFX_HINT_DYING ) )
+ {
+ pBasePool = 0;
+ pDocShell = 0;
+ EndListening(rBC);
+ }
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyle* SwXStyleFamily::_FindStyle(const String& rStyleName)const
+{
+ sal_uInt16 nLCount = pBasePool->GetListenerCount();
+ SfxListener* pListener = 0;
+ for( sal_uInt16 i = 0; i < nLCount; i++)
+ {
+ pListener = pBasePool->GetListener( i );
+ SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>( pListener );
+ if(pTempStyle && pTempStyle->GetFamily() == eFamily && pTempStyle->GetStyleName() == rStyleName)
+ {
+ return pTempStyle;
+ }
+ }
+ return 0;
+}
+/******************************************************************
+ *
+ ******************************************************************/
+class SwStyleProperties_Impl
+{
+ const PropertyEntryVector_t aPropertyEntries;
+ uno::Any** pAnyArr;
+ sal_uInt32 nArrLen;
+
+public:
+ SwStyleProperties_Impl(const SfxItemPropertyMap* _pMap);
+ ~SwStyleProperties_Impl();
+
+ sal_Bool SetProperty(const ::rtl::OUString& rName, uno::Any aVal);
+ sal_Bool GetProperty(const ::rtl::OUString& rName, uno::Any*& rpAny);
+ sal_Bool ClearProperty( const ::rtl::OUString& rPropertyName );
+ void ClearAllProperties( );
+ void GetProperty(const ::rtl::OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny );
+
+ const PropertyEntryVector_t& GetPropertyVector() const {return aPropertyEntries; }
+
+};
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap* pMap) :
+// _pMap(pMap),
+ aPropertyEntries( pMap->getPropertyEntries() ),
+ nArrLen(0)
+{
+ nArrLen = aPropertyEntries.size();
+ //const SfxItemPropertyMap* pTmp = _pMap;
+
+ pAnyArr = new uno::Any* [nArrLen];
+ for ( sal_uInt32 i =0 ; i < nArrLen; i++ )
+ pAnyArr[i] = 0;
+}
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+SwStyleProperties_Impl::~SwStyleProperties_Impl()
+{
+ for ( sal_uInt16 i =0 ; i < nArrLen; i++ )
+ delete pAnyArr[i];
+ delete[] pAnyArr;
+}
+
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+sal_Bool SwStyleProperties_Impl::SetProperty(const ::rtl::OUString& rName, uno::Any aVal)
+{
+ sal_uInt16 nPos = 0;
+ sal_Bool bRet = sal_False;
+ PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
+ while( aIt != aPropertyEntries.end() )
+ {
+ if(rName == aIt->sName)
+ {
+ delete pAnyArr[nPos];
+ pAnyArr[nPos] = new uno::Any ( aVal );
+ bRet = sal_True;
+ break;
+ }
+ ++nPos;
+ ++aIt;
+ }
+ return bRet;
+}
+
+sal_Bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nPos = 0;
+ PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
+ while( aIt != aPropertyEntries.end() )
+ {
+ if( rName == aIt->sName )
+ {
+ delete pAnyArr[nPos];
+ pAnyArr[ nPos ] = 0;
+ bRet = sal_True;
+ break;
+ }
+ ++nPos;
+ ++aIt;
+ }
+ return bRet;
+}
+void SwStyleProperties_Impl::ClearAllProperties( )
+{
+ for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ delete pAnyArr[i];
+ pAnyArr[ i ] = 0;
+ }
+}
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+sal_Bool SwStyleProperties_Impl::GetProperty(const ::rtl::OUString& rName, uno::Any*& rpAny )
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nPos = 0;
+ PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
+ while( aIt != aPropertyEntries.end() )
+ {
+ if( rName == aIt->sName )
+ {
+ rpAny = pAnyArr[nPos];
+ bRet = sal_True;
+ break;
+ }
+ ++nPos;
+ ++aIt;
+ }
+
+ return bRet;
+}
+
+void SwStyleProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny )
+{
+ rAny = rxPropertySet->getPropertyValue( rPropertyName );
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXStyle::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXStyle::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+
+TYPEINIT1(SwXStyle, SfxListener);
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXStyle::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXStyle");
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXStyle::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ BOOL bRet = C2U("com.sun.star.style.Style") == rServiceName;
+ if(!bRet && SFX_STYLE_FAMILY_CHAR == eFamily)
+ bRet = !rServiceName.compareToAscii("com.sun.star.style.CharacterStyle")||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties")||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian")||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex");
+ if(!bRet && SFX_STYLE_FAMILY_PARA == eFamily)
+ bRet = (C2U("com.sun.star.style.ParagraphStyle") == rServiceName)||
+ (C2U("com.sun.star.style.ParagraphProperties") == rServiceName) ||
+ (C2U("com.sun.star.style.ParagraphPropertiesAsian") == rServiceName) ||
+ (C2U("com.sun.star.style.ParagraphPropertiesComplex") == rServiceName);
+ if(!bRet && SFX_STYLE_FAMILY_PAGE == eFamily)
+ bRet = (C2U("com.sun.star.style.PageStyle") == rServiceName)||
+ (C2U("com.sun.star.style.PageProperties") == rServiceName);
+
+ return bRet;
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXStyle::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ long nCount = 1;
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ {
+ nCount = 5;
+ if(bIsConditional)
+ nCount++;
+ }
+ else if(SFX_STYLE_FAMILY_CHAR == eFamily)
+ nCount = 5;
+ else if(SFX_STYLE_FAMILY_PAGE == eFamily)
+ nCount = 3;
+ uno::Sequence< OUString > aRet(nCount);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.style.Style");
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pArray[1] = C2U("com.sun.star.style.CharacterStyle");
+ pArray[2] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[4] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ pArray[1] = C2U("com.sun.star.style.PageStyle");
+ pArray[2] = C2U("com.sun.star.style.PageProperties");
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ pArray[1] = C2U("com.sun.star.style.ParagraphStyle");
+ pArray[2] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[3] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[4] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ if(bIsConditional)
+ pArray[5] = C2U("com.sun.star.style.ConditionalParagraphStyle");
+ break;
+
+ default:
+ ;
+ }
+ return aRet;
+}
+/*-- 17.12.98 08:26:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyle::SwXStyle( SwDoc *pDoc, SfxStyleFamily eFam, BOOL bConditional) :
+ m_pDoc( pDoc ),
+ pBasePool(0),
+ eFamily(eFam),
+ bIsDescriptor(sal_True),
+ bIsConditional(bConditional)
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ // get the property set for the default style data
+ // First get the model
+ uno::Reference < frame::XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
+ // Ask the model for it's family supplier interface
+ uno::Reference < style::XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
+ // Get the style families
+ uno::Reference < container::XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
+
+ uno::Any aAny;
+ sal_uInt16 nMapId = PROPERTY_MAP_NUM_STYLE;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ nMapId = PROPERTY_MAP_CHAR_STYLE;
+ aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "CharacterStyles" ) ) );
+ // Get the Frame family (and keep it for later)
+ aAny >>= mxStyleFamily;
+ //aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Standard" ) ) );
+ //aAny >>= mxStyleData;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ nMapId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE;
+ aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ParagraphStyles" ) ) );
+ // Get the Frame family (and keep it for later)
+ aAny >>= mxStyleFamily;
+ aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Standard" ) ) );
+ aAny >>= mxStyleData;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ nMapId = PROPERTY_MAP_PAGE_STYLE;
+ aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "PageStyles" ) ) );
+ // Get the Frame family (and keep it for later)
+ aAny >>= mxStyleFamily;
+ aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Standard" ) ) );
+ aAny >>= mxStyleData;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ nMapId = PROPERTY_MAP_FRAME_STYLE;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ nMapId = PROPERTY_MAP_NUM_STYLE;
+ }
+ break;
+
+ default:
+ ;
+ }
+ pPropImpl = new SwStyleProperties_Impl(aSwMapProvider.GetPropertySet(nMapId)->getPropertyMap());
+}
+
+
+SwXStyle::SwXStyle(SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam,
+ SwDoc* pDoc, const String& rStyleName) :
+ m_pDoc(pDoc),
+ sStyleName(rStyleName),
+ pBasePool(&rPool),
+ eFamily(eFam),
+ bIsDescriptor(sal_False),
+ bIsConditional(sal_False),
+ pPropImpl(0)
+{
+ StartListening(rPool);
+ if(eFam == SFX_STYLE_FAMILY_PARA)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(pBase)
+ {
+ const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if(nId != USHRT_MAX)
+ bIsConditional = ::IsConditionalByPoolId( nId );
+ else
+ bIsConditional = RES_CONDTXTFMTCOLL == ((SwDocStyleSheet*)pBase)->GetCollection()->Which();
+ }
+ }
+}
+/*-- 17.12.98 08:26:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyle::~SwXStyle()
+{
+ if(pBasePool)
+ EndListening(*pBasePool);
+ delete pPropImpl;
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ m_pDoc = 0;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+ }
+}
+OUString SwXStyle::getName(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ String aString;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(!pBase)
+ throw uno::RuntimeException();
+ SwStyleNameMapper::FillProgName(pBase->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ }
+ else
+ aString = sStyleName;
+ return OUString (aString);
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setName(const OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+ sal_Bool bExcept = sal_True;
+ if(pBase && pBase->IsUserDefined())
+ {
+ rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ bExcept = !xTmp->SetName(rName);
+ if(!bExcept)
+ sStyleName = String(rName);
+ }
+ if(bExcept)
+ throw uno::RuntimeException();
+ }
+ else
+ sStyleName = String(rName);
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyle::isUserDefined(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ //if it is not found it must be non user defined
+ if(pBase)
+ bRet = pBase->IsUserDefined();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyle::isInUse(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_USED);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ bRet = pBase->IsUsed();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 08:26:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXStyle::getParentStyle(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ String aString;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ aString = pBase->GetParent();
+ }
+ else if(bIsDescriptor)
+ aString = sParentStyleName;
+ else
+ throw uno::RuntimeException();
+ SwStyleNameMapper::FillProgName(aString, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ return OUString ( aString );
+}
+/*-- 17.12.98 08:26:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setParentStyle(const OUString& rParentStyle)
+ throw( container::NoSuchElementException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ String sParentStyle;
+ SwStyleNameMapper::FillUIName(rParentStyle, sParentStyle, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ BOOL bExcept = FALSE;
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ {
+ rtl::Reference< SwDocStyleSheet > xBase( new SwDocStyleSheet(*(SwDocStyleSheet*)pBase) );
+ //make it a 'real' style - necessary for pooled styles
+ xBase->GetItemSet();
+ if(xBase->GetParent() != sParentStyle)
+ {
+ bExcept = !xBase->SetParent(sParentStyle);
+ }
+ }
+ else
+ bExcept = TRUE;
+ if(bExcept)
+ throw uno::RuntimeException();
+ }
+ else if(bIsDescriptor)
+ {
+ sParentStyleName = String(sParentStyle);
+ try
+ {
+ uno::Any aAny = mxStyleFamily->getByName ( sParentStyle );
+ aAny >>= mxStyleData;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+ catch ( lang::WrappedTargetException& )
+ {
+ }
+ catch ( uno::RuntimeException& )
+ {
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 17.12.98 08:26:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily eFamily, sal_Bool bIsConditional )
+{
+ uno::Reference< beans::XPropertySetInfo > xRet;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ static uno::Reference< beans::XPropertySetInfo > xCharRef;
+ if(!xCharRef.is())
+ {
+ xCharRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_STYLE)->getPropertySetInfo();
+ }
+ xRet = xCharRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ static uno::Reference< beans::XPropertySetInfo > xParaRef;
+ if(!xParaRef.is())
+ {
+ sal_uInt16 nMapId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE;
+ xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
+ }
+ xRet = xParaRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPageRef;
+ if(!xPageRef.is())
+ {
+ xPageRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE)->getPropertySetInfo();
+ }
+ xRet = xPageRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ static uno::Reference< beans::XPropertySetInfo > xFrameRef;
+ if(!xFrameRef.is())
+ {
+ xFrameRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_FRAME_STYLE)->getPropertySetInfo();
+ }
+ xRet = xFrameRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ static uno::Reference< beans::XPropertySetInfo > xNumRef;
+ if(!xNumRef.is())
+ {
+ xNumRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_NUM_STYLE)->getPropertySetInfo();
+ }
+ xRet = xNumRef;
+ }
+ break;
+
+ default:
+ ;
+ }
+ return xRet;
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXStyle::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ return lcl_getPropertySetInfo( eFamily, bIsConditional );
+}
+/* -----------------23.04.99 13:28-------------------
+ *
+ * --------------------------------------------------*/
+void SwXStyle::ApplyDescriptorProperties()
+{
+ bIsDescriptor = sal_False;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+
+ const PropertyEntryVector_t& rPropertyVector = pPropImpl->GetPropertyVector();
+ PropertyEntryVector_t::const_iterator aIt = rPropertyVector.begin();
+ while(aIt != rPropertyVector.end())
+ {
+ uno::Any* pAny;
+ pPropImpl->GetProperty(aIt->sName, pAny);
+ if(pAny)
+ setPropertyValue(aIt->sName, *pAny);
+ ++aIt;
+ }
+}
+
+/*-- 18.04.01 13:07:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct SwStyleBase_Impl
+{
+ SwDoc& rDoc;
+
+ const SwPageDesc* pOldPageDesc;
+
+ rtl::Reference< SwDocStyleSheet > mxNewBase;
+ SfxItemSet* pItemSet;
+
+ const String& rStyleName;
+ sal_uInt16 nPDescPos;
+
+ SwStyleBase_Impl(SwDoc& rSwDoc, const String& rName) :
+ rDoc(rSwDoc),
+ pOldPageDesc(0),
+ pItemSet(0),
+ rStyleName(rName),
+ nPDescPos(0xffff)
+ {}
+
+ ~SwStyleBase_Impl(){ delete pItemSet; }
+
+ sal_Bool HasItemSet() {return mxNewBase.is();}
+ SfxItemSet& GetItemSet()
+ {
+ DBG_ASSERT(mxNewBase.is(), "no SwDocStyleSheet available");
+ if(!pItemSet)
+ pItemSet = new SfxItemSet(mxNewBase->GetItemSet());
+ return *pItemSet;
+ }
+
+ const SwPageDesc& GetOldPageDesc();
+};
+/* -----------------------------25.04.01 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
+{
+ if(!pOldPageDesc)
+ {
+ sal_uInt16 i;
+ sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
+ for(i = 0; i < nPDescCount; i++)
+ {
+ const SwPageDesc& rDesc =
+ const_cast<const SwDoc &>(rDoc).GetPageDesc( i );
+ if(rDesc.GetName() == rStyleName)
+ {
+ pOldPageDesc = & rDesc;
+ nPDescPos = i;
+ break;
+ }
+ }
+ if(!pOldPageDesc)
+ {
+ for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i)
+ {
+ const String aFmtName(SW_RES(i));
+ if(aFmtName == rStyleName)
+ {
+ pOldPageDesc = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
+ break;
+ }
+ }
+ for(i = 0; i < nPDescCount + 1; i++)
+ {
+ const SwPageDesc& rDesc =
+ const_cast<const SwDoc &>(rDoc).GetPageDesc( i );
+ if(rDesc.GetName() == rStyleName)
+ {
+ nPDescPos = i;
+ break;
+ }
+ }
+ }
+ }
+ return *pOldPageDesc;
+}
+
+/* -----------------------------19.04.01 09:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
+ const SfxItemPropertySet& rPropSet,
+ const uno::Any& rValue,
+ SwStyleBase_Impl& rBase,
+ SfxStyleSheetBasePool* pBasePool,
+ SwDoc* pDoc,
+ SfxStyleFamily eFamily)
+ throw(beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+
+{
+ switch(rEntry.nWID)
+ {
+ case RES_PAPER_BIN:
+ {
+ SfxPrinter *pPrinter = pDoc->getPrinter( true );
+ OUString sTmp;
+ sal_uInt16 nBin = USHRT_MAX;
+ if ( !( rValue >>= sTmp ) )
+ throw lang::IllegalArgumentException();
+ if ( sTmp.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "[From printer settings]" ) ) )
+ nBin = USHRT_MAX-1;
+ else if ( pPrinter )
+ {
+ for (sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; i++ )
+ {
+ if (sTmp == OUString ( pPrinter->GetPaperBinName ( i ) ) )
+ {
+ nBin = i;
+ break;
+ }
+ }
+ }
+ if ( nBin == USHRT_MAX )
+ throw lang::IllegalArgumentException();
+ else
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
+ aSet.SetParent(&rStyleSet);
+ rPropSet.setPropertyValue(rEntry, uno::makeAny ( static_cast < sal_Int8 > ( nBin == USHRT_MAX-1 ? -1 : nBin ) ), aSet);
+ rStyleSet.Put(aSet);
+ }
+ }
+ break;
+ case FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
+ {
+ if(rValue.getValueType() == ::getCppuType((uno::Reference< container::XIndexReplace>*)0) )
+ {
+ uno::Reference< container::XIndexReplace > * pxRulesRef =
+ (uno::Reference< container::XIndexReplace > *)rValue.getValue();
+
+ uno::Reference<lang::XUnoTunnel> xNumberTunnel( *pxRulesRef, uno::UNO_QUERY);
+
+ SwXNumberingRules* pSwXRules = 0;
+ if(xNumberTunnel.is())
+ {
+ pSwXRules = reinterpret_cast< SwXNumberingRules * >(
+ sal::static_int_cast< sal_IntPtr >(xNumberTunnel->getSomething( SwXNumberingRules::getUnoTunnelId()) ));
+ }
+ if(pSwXRules)
+ {
+ const String* pCharStyleNames = pSwXRules->GetNewCharStyleNames();
+ const String* pBulletFontNames = pSwXRules->GetBulletFontNames();
+
+ SwNumRule aSetRule(*pSwXRules->GetNumRule());
+ const SwCharFmts* pFmts = pDoc->GetCharFmts();
+ sal_uInt16 nChCount = pFmts->Count();
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+
+ const SwNumFmt* pFmt = aSetRule.GetNumFmt( i );
+ if(pFmt)
+ {
+ SwNumFmt aFmt(*pFmt);
+ if(
+ pCharStyleNames[i] != SwXNumberingRules::GetInvalidStyle() &&
+ ((pCharStyleNames[i].Len() && !pFmt->GetCharFmt()) ||
+ pCharStyleNames[i].Len() &&
+ pFmt->GetCharFmt()->GetName() != pCharStyleNames[i] ))
+ {
+
+ SwCharFmt* pCharFmt = 0;
+ if(pCharStyleNames[i].Len())
+ {
+ for(sal_uInt16 j = 0; j< nChCount; j++)
+ {
+ SwCharFmt* pTmp = (*pFmts)[j];
+ if(pTmp->GetName() == pCharStyleNames[i])
+ {
+ pCharFmt = pTmp;
+ break;
+ }
+ }
+ if(!pCharFmt)
+ {
+
+ SfxStyleSheetBase* pBase;
+ pBase = ((SfxStyleSheetBasePool*)pBasePool)->Find(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pBasePool->Make(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+
+ }
+
+ aFmt.SetCharFmt( pCharFmt );
+ }
+ }
+ //jetzt nochmal fuer Fonts
+ if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() &&
+ ((pBulletFontNames[i].Len() && !pFmt->GetBulletFont()) ||
+ pBulletFontNames[i].Len() &&
+ pFmt->GetBulletFont()->GetName() != pBulletFontNames[i] ))
+ {
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pDoc->GetDocShell()
+ ->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFontListItem->GetFontList();
+ FontInfo aInfo = pList->Get(
+ pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
+ Font aFont(aInfo);
+ aFmt.SetBulletFont(&aFont);
+ }
+ aSetRule.Set( i, &aFmt );
+ }
+ }
+ rBase.mxNewBase->SetNumRule(aSetRule);
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ // case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei
+ //{
+ // sal_Int8 nLevel = 0;
+ // if( rValue >>= nLevel )
+ // rBase.mxNewBase->GetCollection()->SetOutlineLevel( nLevel );
+ // else
+ // rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING );
+ //}
+ //break;
+ case RES_PARATR_OUTLINELEVEL: //add by zahojianwei
+ {
+ sal_Int16 nLevel = 0;
+ rValue >>= nLevel;
+ if( 0 <= nLevel && nLevel <= MAXLEVEL)
+ rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel );
+ }
+ break; //<-end,zhaojianwei
+ case FN_UNO_FOLLOW_STYLE:
+ {
+ OUString sTmp;
+ rValue >>= sTmp;
+ String aString;
+ SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True ) ;
+ rBase.mxNewBase->SetFollow( aString );
+ }
+ break;
+ case RES_PAGEDESC :
+ if( MID_PAGEDESC_PAGEDESCNAME != rEntry.nMemberId)
+ goto put_itemset;
+ {
+ // Sonderbehandlung RES_PAGEDESC
+ if(rValue.getValueType() != ::getCppuType((const OUString*)0))
+ throw lang::IllegalArgumentException();
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ SwFmtPageDesc* pNewDesc = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
+ {
+ pNewDesc = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem));
+ }
+ if(!pNewDesc)
+ pNewDesc = new SwFmtPageDesc();
+ OUString uDescName;
+ rValue >>= uDescName;
+ String sDescName;
+ SwStyleNameMapper::FillUIName(uDescName, sDescName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
+ if(!pNewDesc->GetPageDesc() || pNewDesc->GetPageDesc()->GetName() != sDescName)
+ {
+ //sal_uInt16 nCount = pDoc->GetPageDescCnt();
+ sal_Bool bPut = sal_False;
+ if(sDescName.Len())
+ {
+ SwPageDesc* pPageDesc = ::GetPageDescByName_Impl(*pDoc, sDescName);
+ if(pPageDesc)
+ {
+ pPageDesc->Add( pNewDesc );
+ bPut = sal_True;
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+ if(!bPut)
+ {
+ rStyleSet.ClearItem(RES_BREAK);
+ rStyleSet.Put(SwFmtPageDesc());
+ }
+ else
+ rStyleSet.Put(*pNewDesc);
+ }
+ delete pNewDesc;
+ }
+ break;
+ case FN_UNO_IS_AUTO_UPDATE:
+ {
+ BOOL bAuto = *(sal_Bool*)rValue.getValue();
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ rBase.mxNewBase->GetCollection()->SetAutoUpdateFmt(bAuto);
+ else if(SFX_STYLE_FAMILY_FRAME == eFamily)
+ rBase.mxNewBase->GetFrmFmt()->SetAutoUpdateFmt(bAuto);
+ }
+ break;
+ case FN_UNO_PARA_STYLE_CONDITIONS:
+ {
+ uno::Sequence< beans::NamedValue > aSeq;
+ if (!(rValue >>= aSeq))
+ throw lang::IllegalArgumentException();
+
+ DBG_ASSERT(COND_COMMAND_COUNT == 28,
+ "invalid size of comman count?");
+ const beans::NamedValue *pSeq = aSeq.getConstArray();
+ sal_Int32 nLen = aSeq.getLength();
+
+ sal_Bool bFailed = sal_False;
+ SwCondCollItem aCondItem;
+ for(USHORT i = 0; i < nLen; i++)
+ {
+ OUString aTmp;
+ if ((pSeq[i].Value >>= aTmp))
+ {
+ // get UI style name from programmatic style name
+ String aStyleName;
+ SwStyleNameMapper::FillUIName( aTmp, aStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+
+ //
+ // check for correct context and style name
+ //
+ sal_Int16 nIdx = GetCommandContextIndex( pSeq[i].Name );
+ //
+ pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
+ sal_Bool bStyleFound = sal_False;
+ const SfxStyleSheetBase* pBase = pBasePool->First();
+ while (pBase && !bStyleFound)
+ {
+ if(pBase->GetName() == aStyleName)
+ bStyleFound = sal_True;
+ pBase = pBasePool->Next();
+ }
+ //
+ if (nIdx == -1 || !bStyleFound)
+ {
+ bFailed = sal_True;
+ break;
+ }
+
+ aCondItem.SetStyle( &aStyleName, nIdx);
+ }
+ else
+ bFailed = sal_True;
+ }
+ if (bFailed)
+ throw lang::IllegalArgumentException();
+ rBase.GetItemSet().Put( aCondItem );
+ }
+ break;
+ case FN_UNO_CATEGORY:
+ {
+ if(!rBase.mxNewBase->IsUserDefined())
+ throw lang::IllegalArgumentException();
+ short nSet = 0;
+ rValue >>= nSet;
+
+ sal_uInt16 nId;
+ switch( nSet )
+ {
+ case style::ParagraphStyleCategory::TEXT:
+ nId = SWSTYLEBIT_TEXT;
+ break;
+ case style::ParagraphStyleCategory::CHAPTER:
+ nId = SWSTYLEBIT_CHAPTER;
+ break;
+ case style::ParagraphStyleCategory::LIST:
+ nId = SWSTYLEBIT_LIST;
+ break;
+ case style::ParagraphStyleCategory::INDEX:
+ nId = SWSTYLEBIT_IDX;
+ break;
+ case style::ParagraphStyleCategory::EXTRA:
+ nId = SWSTYLEBIT_EXTRA;
+ break;
+ case style::ParagraphStyleCategory::HTML:
+ nId = SWSTYLEBIT_HTML;
+ break;
+ default: throw lang::IllegalArgumentException();
+ }
+ rBase.mxNewBase->SetMask( nId|SFXSTYLEBIT_USERDEF );
+ }
+ break;
+ case SID_SWREGISTER_COLLECTION:
+ {
+ OUString sName;
+ rValue >>= sName;
+ SwRegisterItem aReg( sName.getLength() != 0);
+ aReg.SetWhich(SID_SWREGISTER_MODE);
+ rBase.GetItemSet().Put(aReg);
+ String aString;
+ SwStyleNameMapper::FillUIName(sName, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
+
+ rBase.GetItemSet().Put(SfxStringItem(SID_SWREGISTER_COLLECTION, aString ) );
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ if(MID_RUBY_CHARSTYLE == rEntry.nMemberId )
+ {
+ OUString sTmp;
+ if(rValue >>= sTmp)
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SwFmtRuby* pRuby = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_TXTATR_CJK_RUBY, sal_True, &pItem ) )
+ pRuby = new SwFmtRuby(*((SwFmtRuby*)pItem));
+ if(!pRuby)
+ pRuby = new SwFmtRuby(aEmptyStr);
+ String sStyle;
+ SwStyleNameMapper::FillUIName(sTmp, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ pRuby->SetCharFmtName( sTmp );
+ pRuby->SetCharFmtId( 0 );
+ if(sTmp.getLength())
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sTmp, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ pRuby->SetCharFmtId(nId);
+ }
+ rStyleSet.Put(*pRuby);
+ delete pRuby;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ goto put_itemset;
+ //break;
+ case RES_PARATR_DROP:
+ {
+ if( MID_DROPCAP_CHAR_STYLE_NAME == rEntry.nMemberId)
+ {
+ if(rValue.getValueType() == ::getCppuType((const OUString*)0))
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ SwFmtDrop* pDrop = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_PARATR_DROP, sal_True, &pItem ) )
+ pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem));
+ if(!pDrop)
+ pDrop = new SwFmtDrop();
+ OUString uStyle;
+ rValue >>= uStyle;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
+ if(pStyle)
+ pDrop->SetCharFmt(pStyle->GetCharFmt());
+ else
+ throw lang::IllegalArgumentException();
+ rStyleSet.Put(*pDrop);
+ delete pDrop;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ break;
+ }
+ }
+ //no break!
+ default:
+put_itemset:
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
+ aSet.SetParent(&rStyleSet);
+ rPropSet.setPropertyValue(rEntry, rValue, aSet);
+ rStyleSet.Put(aSet);
+ // --> OD 2006-10-18 #i70223#
+ if ( SFX_STYLE_FAMILY_PARA == eFamily &&
+ rEntry.nWID == RES_PARATR_NUMRULE &&
+ rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() &&
+ //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei
+ rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei
+
+ {
+ OUString sNewNumberingRuleName;
+ rValue >>= sNewNumberingRuleName;
+ String sTmp( sNewNumberingRuleName );
+ if ( sNewNumberingRuleName.getLength() == 0 ||
+ sTmp != pDoc->GetOutlineNumRule()->GetName() )
+ {
+ // delete assignment to list level of outline style.
+ //rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei
+ rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,adde by zhaojianwei
+ }
+ }
+ }
+ }
+}
+/* -----------------------------18.04.01 13:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXStyle::SetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if ( !m_pDoc )
+ throw uno::RuntimeException();
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
+ case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break;
+ default:
+ ;
+ }
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+
+ if(rPropertyNames.getLength() != rValues.getLength())
+ throw lang::IllegalArgumentException();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ const uno::Any* pValues = rValues.getConstArray();
+
+ SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName);
+ if(pBasePool)
+ {
+ sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ pBasePool->SetSearchMask(eFamily, nSaveMask );
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(pBase)
+ aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
+ else
+ throw uno::RuntimeException();
+ }
+
+ for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]);
+
+ if(!pEntry ||
+ (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS))))
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if(aBaseImpl.mxNewBase.is())
+ {
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl,
+ pBasePool, m_pDoc, eFamily);
+ }
+ else if(bIsDescriptor)
+ {
+ if(!pPropImpl->SetProperty(pNames[nProp], pValues[nProp]))
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ if(aBaseImpl.HasItemSet())
+ aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());
+}
+
+void SwXStyle::setPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw(beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // workaround for bad designed API
+ try
+ {
+ SetPropertyValues_Impl( rPropertyNames, rValues );
+ }
+ catch (beans::UnknownPropertyException &rException)
+ {
+ // wrap the original (here not allowed) exception in
+ // a lang::WrappedTargetException that gets thrown instead.
+ lang::WrappedTargetException aWExc;
+ aWExc.TargetException <<= rException;
+ throw aWExc;
+ }
+}
+
+
+uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
+ const SfxItemPropertySet& rPropSet,
+ SwStyleBase_Impl& rBase,
+ SfxStyleSheetBase* pBase,
+ SfxStyleFamily eFamily,
+ SwDoc *pDoc) throw(uno::RuntimeException)
+{
+ uno::Any aRet;
+ if(FN_UNO_IS_PHYSICAL == rEntry.nWID)
+ {
+ BOOL bPhys = pBase != 0;
+ if(pBase)
+ {
+ bPhys = ((SwDocStyleSheet*)pBase)->IsPhysical();
+ // The standard character format is not existing physically
+ if( bPhys && SFX_STYLE_FAMILY_CHAR == eFamily &&
+ ((SwDocStyleSheet*)pBase)->GetCharFmt() &&
+ ((SwDocStyleSheet*)pBase)->GetCharFmt()->IsDefault() )
+ bPhys = FALSE;
+ }
+ aRet.setValue(&bPhys, ::getBooleanCppuType());
+ }
+ else if(pBase)
+ {
+ if(!rBase.mxNewBase.is())
+ rBase.mxNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase );
+ switch(rEntry.nWID)
+ {
+ case RES_PAPER_BIN:
+ {
+ SfxItemSet& rSet = rBase.GetItemSet();
+ rPropSet.getPropertyValue(rEntry, rSet, aRet);
+ sal_Int8 nBin = 0;
+ aRet >>= nBin;
+ if ( nBin == -1 )
+ aRet <<= OUString ( RTL_CONSTASCII_USTRINGPARAM ( "[From printer settings]" ) );
+ else
+ {
+ SfxPrinter *pPrinter = pDoc->getPrinter( false );
+ OUString sTmp;
+ if (pPrinter )
+ sTmp = pPrinter->GetPaperBinName ( nBin );
+ aRet <<= sTmp;
+ }
+ }
+ break;
+ case FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
+ {
+ const SwNumRule* pRule = rBase.mxNewBase->GetNumRule();
+ DBG_ASSERT(pRule, "Wo ist die NumRule?");
+ uno::Reference< container::XIndexReplace > xRules = new SwXNumberingRules(*pRule);
+ aRet.setValue(&xRules, ::getCppuType((uno::Reference<container::XIndexReplace>*)0));
+ }
+ break;
+ //case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei
+ //{
+ // DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" );
+ // BYTE nLevel = rBase.mxNewBase->GetCollection()->GetOutlineLevel();
+ // if( nLevel != NO_NUMBERING )
+ // aRet <<= static_cast<sal_Int8>( nLevel );
+ //}
+ //break;
+ case RES_PARATR_OUTLINELEVEL: //add by zahojianwei
+ {
+ DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" );
+ int nLevel = rBase.mxNewBase->GetCollection()->GetAttrOutlineLevel();
+ aRet <<= static_cast<sal_Int16>( nLevel );
+ }
+ break; //<-end,zhaojianwei
+ case FN_UNO_FOLLOW_STYLE:
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(rBase.mxNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ aRet <<= OUString( aString );
+ }
+ break;
+ case RES_PAGEDESC :
+ if( MID_PAGEDESC_PAGEDESCNAME != rEntry.nMemberId)
+ goto query_itemset;
+ {
+ // Sonderbehandlung RES_PAGEDESC
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rBase.GetItemSet().GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
+ {
+ const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
+ if(pDesc)
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(pDesc->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
+ aRet <<= OUString( aString );
+ }
+ }
+ }
+ break;
+ case FN_UNO_IS_AUTO_UPDATE:
+ {
+ BOOL bAuto = FALSE;
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ bAuto = rBase.mxNewBase->GetCollection()->IsAutoUpdateFmt();
+ else if(SFX_STYLE_FAMILY_FRAME == eFamily)
+ bAuto = rBase.mxNewBase->GetFrmFmt()->IsAutoUpdateFmt();
+ aRet.setValue(&bAuto, ::getBooleanCppuType());
+ }
+ break;
+ case FN_UNO_DISPLAY_NAME:
+ {
+ OUString sName(rBase.mxNewBase->GetDisplayName());
+ aRet <<= sName;
+ }
+ break;
+ case FN_UNO_PARA_STYLE_CONDITIONS:
+ {
+ DBG_ASSERT(COND_COMMAND_COUNT == 28,
+ "invalid size of comman count?");
+ //SfxItemSet& rStyleSet = rBase.GetItemSet();
+ uno::Sequence< beans::NamedValue > aSeq(COND_COMMAND_COUNT);
+ beans::NamedValue *pSeq = aSeq.getArray();
+
+ SwFmt *pFmt = ((SwDocStyleSheet*)pBase)->GetCollection();
+ const CommandStruct *pCmds = SwCondCollItem::GetCmds();
+ for (USHORT n = 0; n < COND_COMMAND_COUNT; ++n)
+ {
+ String aStyleName;
+
+ const SwCollCondition* pCond = 0;
+ if( pFmt && RES_CONDTXTFMTCOLL == pFmt->Which() &&
+ 0 != ( pCond = ((SwConditionTxtFmtColl*)pFmt)->
+ HasCondition( SwCollCondition( 0, pCmds[n].nCnd, pCmds[n].nSubCond ) ) )
+ && pCond->GetTxtFmtColl() )
+ {
+ // get programmatic style name from UI style name
+ aStyleName = pCond->GetTxtFmtColl()->GetName();
+ SwStyleNameMapper::FillProgName(aStyleName, aStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ }
+
+ pSeq[n].Name = GetCommandContextByIndex(n);
+ pSeq[n].Value <<= rtl::OUString( aStyleName );
+ }
+ aRet <<= aSeq;
+ }
+ break;
+ case FN_UNO_CATEGORY:
+ {
+ sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId();
+ short nRet = -1;
+ switch ( COLL_GET_RANGE_BITS & nPoolId )
+ {
+ case COLL_TEXT_BITS:
+ nRet = style::ParagraphStyleCategory::TEXT;
+ break;
+ case COLL_DOC_BITS:
+ nRet = style::ParagraphStyleCategory::CHAPTER;
+ break;
+ case COLL_LISTS_BITS:
+ nRet = style::ParagraphStyleCategory::LIST;
+ break;
+ case COLL_REGISTER_BITS:
+ nRet = style::ParagraphStyleCategory::INDEX;
+ break;
+ case COLL_EXTRA_BITS:
+ nRet = style::ParagraphStyleCategory::EXTRA;
+ break;
+ case COLL_HTML_BITS:
+ nRet = style::ParagraphStyleCategory::HTML;
+ break;
+ }
+ aRet <<= nRet;
+ }
+ break;
+ case SID_SWREGISTER_COLLECTION:
+ {
+ const SwPageDesc *pPageDesc = rBase.mxNewBase->GetPageDesc();
+ const SwTxtFmtColl* pCol = 0;
+ String aString;
+ if( pPageDesc )
+ pCol = pPageDesc->GetRegisterFmtColl();
+ if( pCol )
+ SwStyleNameMapper::FillProgName(
+ pCol->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ aRet <<= OUString ( aString );
+ }
+ break;
+ default:
+query_itemset:
+ {
+ SfxItemSet& rSet = rBase.GetItemSet();
+ rPropSet.getPropertyValue(rEntry, rSet, aRet);
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/* -----------------------------19.04.01 09:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
+ const uno::Sequence< OUString > & rPropertyNames )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if ( !m_pDoc )
+ throw uno::RuntimeException();
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
+ case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break;
+ default:
+ ;
+ }
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ uno::Sequence< uno::Any > aRet(rPropertyNames.getLength());
+ uno::Any* pRet = aRet.getArray();
+ SwStyleBase_Impl aBase(*m_pDoc, sStyleName);
+ SfxStyleSheetBase* pBase = 0;
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]);
+ if(!pEntry ||
+ (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS))))
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if(pBasePool)
+ {
+ if(!pBase)
+ {
+ sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ pBase = pBasePool->Find(sStyleName);
+ pBasePool->SetSearchMask(eFamily, nSaveMask );
+ }
+ pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() );
+ }
+ else if(bIsDescriptor)
+ {
+ uno::Any *pAny = 0;
+ pPropImpl->GetProperty ( pNames[nProp], pAny );
+ if( !pAny )
+ {
+ sal_Bool bExcept = sal_False;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_PSEUDO:
+ bExcept = sal_True;
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ case SFX_STYLE_FAMILY_PAGE:
+ pPropImpl->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ if (pEntry->nWID >= POOLATTR_BEGIN && pEntry->nWID < RES_UNKNOWNATR_END )
+ {
+ SwFmt * pFmt;
+ if ( eFamily == SFX_STYLE_FAMILY_CHAR )
+ pFmt = m_pDoc->GetDfltCharFmt();
+ else
+ pFmt = m_pDoc->GetDfltFrmFmt();
+ const SwAttrPool * pPool = pFmt->GetAttrSet().GetPool();
+ const SfxPoolItem & rItem = pPool->GetDefaultItem ( pEntry->nWID );
+ rItem.QueryValue ( pRet[nProp], pEntry->nMemberId );
+ }
+ else
+ bExcept = sal_True;
+ }
+ break;
+
+ default:
+ ;
+ }
+ if (bExcept )
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "No default value for: " ) ) + pNames[nProp];
+ throw aExcept;
+ }
+ }
+ else
+ pRet [ nProp ] = *pAny;
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+/* -----------------------------04.11.03 09:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXStyle::getPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< uno::Any > aValues;
+
+ // workaround for bad designed API
+ try
+ {
+ aValues = GetPropertyValues_Impl( rPropertyNames );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property exception caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "WrappedTargetException caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ return aValues;
+}
+/*-- 18.04.01 13:07:29---------------------------------------------------
+ -----------------------------------------------------------------------*/
+void SwXStyle::addPropertiesChangeListener(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{
+}
+/*-- 18.04.01 13:07:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{
+}
+/*-- 18.04.01 13:07:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::firePropertiesChangeEvent(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw(uno::RuntimeException)
+{
+}
+/*-- 17.12.98 08:26:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
+ const uno::Sequence<uno::Any> aValues(&rValue, 1);
+ SetPropertyValues_Impl( aProperties, aValues );
+}
+/*-- 17.12.98 08:26:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
+ return GetPropertyValues_Impl(aProperties).getConstArray()[0];
+
+}
+/*-- 17.12.98 08:26:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::addPropertyChangeListener(const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 08:26:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::removePropertyChangeListener(const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 08:26:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::addVetoableChangeListener(const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 08:26:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::removeVetoableChangeListener(const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/*-- 08.03.99 10:50:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Sequence< OUString > aNames(1);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = rPropertyName;
+ uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
+ return aStates.getConstArray()[0];
+}
+/*-- 08.03.99 10:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
+ const uno::Sequence< OUString >& rPropertyNames)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
+ beans::PropertyState* pStates = aRet.getArray();
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+
+ if(pBase)
+ {
+ const OUString* pNames = rPropertyNames.getConstArray();
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
+ case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break;
+ default:
+ ;
+ }
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+
+ SfxItemSet aSet = xStyle->GetItemSet();
+ for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
+ {
+ const String& rPropName = pNames[i];
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName);
+ if(!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ if( FN_UNO_NUM_RULES == pEntry->nWID ||
+ FN_UNO_FOLLOW_STYLE == pEntry->nWID )
+ {
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ // else if( FN_UNO_DEFAULT_OUTLINE_LEVEL == pEntry->nWID ) //#outline level,removed by zahojianwei
+ // {
+ // pStates[i] =
+ // ( xStyle->GetCollection()->GetOutlineLevel()
+ // == NO_NUMBERING )
+ // ? beans::PropertyState_DEFAULT_VALUE
+ // : beans::PropertyState_DIRECT_VALUE;
+ // } //<-end,zhaojianwei
+ else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
+ (rPropName.EqualsAscii("Header", 0, 6)
+ || rPropName.EqualsAscii("Footer", 0, 6)))
+ {
+ sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID);
+ BOOL bFooter = rPropName.EqualsAscii("Footer", 0, 6);
+ const SvxSetItem* pSetItem;
+ if(SFX_ITEM_SET == aSet.GetItemState(
+ bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ sal_False, (const SfxPoolItem**)&pSetItem))
+ {
+ const SfxItemSet& rSet = pSetItem->GetItemSet();
+ SfxItemState eState = rSet.GetItemState(nResId, sal_False);
+ if(SFX_ITEM_SET == eState)
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ else
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ else
+ {
+ pStates[i] = pPropSet->getPropertyState(*pEntry, aSet);
+ if( SFX_STYLE_FAMILY_PAGE == eFamily &&
+ SID_ATTR_PAGE_SIZE == pEntry->nWID &&
+ beans::PropertyState_DIRECT_VALUE == pStates[i] )
+ {
+ const SvxSizeItem& rSize =
+ static_cast < const SvxSizeItem& >(
+ aSet.Get(SID_ATTR_PAGE_SIZE) );
+ sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f;
+ if( ( LONG_MAX == rSize.GetSize().Width() &&
+ (MID_SIZE_WIDTH == nMemberId ||
+ MID_SIZE_SIZE == nMemberId ) ) ||
+ ( LONG_MAX == rSize.GetSize().Height() &&
+ MID_SIZE_HEIGHT == nMemberId ) )
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 08.03.99 10:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setPropertyToDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ setPropertiesToDefault ( aSequence );
+}
+
+void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFmt *pTargetFmt = 0;
+
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "Where is the style?");
+
+ if(pBase)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR: pTargetFmt = xStyle->GetCharFmt(); break;
+ case SFX_STYLE_FAMILY_PARA: pTargetFmt = xStyle->GetCollection(); break;
+ case SFX_STYLE_FAMILY_FRAME: pTargetFmt = xStyle->GetFrmFmt(); break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ sal_uInt16 nPgDscPos = USHRT_MAX;
+ SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
+ if( pDesc )
+ pTargetFmt = &pDesc->GetMaster();
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ default:
+ ;
+ }
+ }
+ }
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
+ case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
+ case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break;
+ default:
+ ;
+ }
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+
+ const OUString* pNames = aPropertyNames.getConstArray();
+
+ if ( pTargetFmt )
+ {
+ for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] );
+ if( !pEntry )
+ throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is unknown: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES )
+ throw uno::RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Cannot reset: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY )
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ //if( pEntry->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL ) //#outline level, removed by zhaojianwei
+ // static_cast<SwTxtFmtColl*>(pTargetFmt)->SetOutlineLevel( NO_NUMBERING );
+ //else
+ // pTargetFmt->ResetFmtAttr( pEntry->nWID );
+ if( pEntry->nWID == RES_PARATR_OUTLINELEVEL ) //add by zhaojianwei
+ static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle();
+ else
+ pTargetFmt->ResetFmtAttr( pEntry->nWID ); //<-end,zhaojianwei
+ }
+ }
+ else if ( bIsDescriptor )
+ {
+ for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
+ pPropImpl->ClearProperty ( pNames[ nProp ] );
+ }
+}
+
+void SAL_CALL SwXStyle::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style, you fiend!?");
+
+ if(pBase)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+
+ SwFmt *pTargetFmt = 0;
+ sal_uInt16 nPgDscPos = USHRT_MAX;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ pTargetFmt = xStyle->GetCharFmt();
+ break;
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ pTargetFmt = xStyle->GetCollection();
+ // --> OD 2007-07-25 #132402# - make code robust
+ if ( xStyle->GetCollection() )
+ {
+ // xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei
+ xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,add by zhaojianwei
+ }
+ // <--
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ pTargetFmt = xStyle->GetFrmFmt();
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
+ if( pDesc )
+ {
+ pTargetFmt = &pDesc->GetMaster();
+ pDesc->SetUseOn ( nsUseOnPage::PD_ALL );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+
+ default:
+ ;
+ }
+ if( pTargetFmt )
+ {
+ if( USHRT_MAX != nPgDscPos )
+ {
+ SwPageDesc& rPageDesc = m_pDoc->_GetPageDesc(nPgDscPos);
+ rPageDesc.ResetAllMasterAttr();
+
+ SvxLRSpaceItem aLR(RES_LR_SPACE);
+ sal_Int32 nSize = GetMetricVal ( CM_1) * 2;
+ aLR.SetLeft ( nSize );
+ aLR.SetLeft ( nSize );
+ SvxULSpaceItem aUL( RES_UL_SPACE );
+ aUL.SetUpper ( static_cast < sal_uInt16 > ( nSize ) );
+ aUL.SetLower ( static_cast < sal_uInt16 > ( nSize ) );
+ pTargetFmt->SetFmtAttr( aLR );
+ pTargetFmt->SetFmtAttr( aUL );
+
+ SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+ SwFmtFrmSize aFrmSz( ATT_FIX_SIZE );
+ if( RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId() )
+ {
+ if( m_pDoc->getPrinter( false ) )
+ {
+ const Size aPhysSize( SvxPaperInfo::GetPaperSize(
+ static_cast<Printer*>( m_pDoc->getPrinter( false ) )) );
+ aFrmSz.SetSize( aPhysSize );
+ }
+ else
+ {
+ // --> OD 2008-07-25 #i91928#
+// aFrmSz.SetWidth( LONG_MAX );
+// aFrmSz.SetHeight( LONG_MAX );
+ aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() );
+ // <--
+ }
+
+ }
+ else
+ {
+ aFrmSz = pStdPgDsc->GetMaster().GetFrmSize();
+ }
+ if( pStdPgDsc->GetLandscape() )
+ {
+ SwTwips nTmp = aFrmSz.GetHeight();
+ aFrmSz.SetHeight( aFrmSz.GetWidth() );
+ aFrmSz.SetWidth( nTmp );
+ }
+ pTargetFmt->SetFmtAttr( aFrmSz );
+ }
+ else
+ {
+ // --> OD 2007-01-25 #i73790# - method renamed
+ pTargetFmt->ResetAllFmtAttr();
+ // <--
+ }
+
+ if( USHRT_MAX != nPgDscPos )
+ m_pDoc->ChgPageDesc( nPgDscPos,
+ const_cast<const SwDoc *>(m_pDoc)
+ ->GetPageDesc(nPgDscPos) );
+ }
+
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else if ( bIsDescriptor )
+ pPropImpl->ClearAllProperties();
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nCount = aPropertyNames.getLength();
+ uno::Sequence < uno::Any > aRet ( nCount );
+ if ( nCount )
+ {
+ if( pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "Doesn't seem to be a style!");
+
+ if(pBase)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
+ case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
+ case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break;
+ default:
+ ;
+ }
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();
+
+ const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent();
+ const OUString *pNames = aPropertyNames.getConstArray();
+ uno::Any *pRet = aRet.getArray();
+ for ( sal_Int32 i = 0 ; i < nCount; i++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[i] );
+ if ( !pEntry )
+ throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if( pParentSet )
+ aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]);
+ else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) )
+ {
+ const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID);
+ rItem.QueryValue(pRet[i], pEntry->nMemberId);
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+/*-- 08.03.99 10:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ return getPropertyDefaults ( aSequence ).getConstArray()[0];
+}
+/* -----------------21.01.99 13:08-------------------
+ *
+ * --------------------------------------------------*/
+void SwXStyle::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ SfxSimpleHint *pHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if( pHint )
+ {
+ if(( pHint->GetId() & SFX_HINT_DYING ) || ( pHint->GetId() & SFX_STYLESHEET_ERASED))
+ {
+ pBasePool = 0;
+ EndListening(rBC);
+ }
+ else if( pHint->GetId() &(SFX_STYLESHEET_CHANGED|SFX_STYLESHEET_ERASED) )
+ {
+ ((SfxStyleSheetBasePool&)rBC).SetSearchMask(eFamily);
+ SfxStyleSheetBase* pOwnBase = ((SfxStyleSheetBasePool&)rBC).Find(sStyleName);
+ if(!pOwnBase)
+ {
+ EndListening(rBC);
+ Invalidate();
+ }
+ }
+ }
+}
+/* -----------------------------15.08.00 11:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXStyle::Invalidate()
+{
+ sStyleName.Erase();
+ pBasePool = 0;
+ m_pDoc = 0;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+}
+
+
+/******************************************************************
+ * SwXPageStyle
+ ******************************************************************/
+/*-- 17.12.98 08:43:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXPageStyle::SwXPageStyle(SfxStyleSheetBasePool& rPool,
+ SwDocShell* pDocSh, SfxStyleFamily eFam,
+ const String& rStyleName)://, const SfxItemPropertyMap* _pMap) :
+ SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName),//, _pMap),
+ pDocShell(pDocSh)
+{
+
+}
+/* -----------------23.08.99 15:52-------------------
+
+ --------------------------------------------------*/
+SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh) :
+ SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE),
+ pDocShell(pDocSh)
+{
+}
+
+/*-- 17.12.98 08:43:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXPageStyle::~SwXPageStyle()
+{
+
+}
+/* -----------------------------18.04.01 13:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ if(rPropertyNames.getLength() != rValues.getLength())
+ throw lang::IllegalArgumentException();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ const uno::Any* pValues = rValues.getConstArray();
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE);
+ const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();
+ SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
+ if(GetBasePool())
+ {
+ sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
+ GetBasePool()->SetSearchMask(GetFamily());
+ SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
+ GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(pBase)
+ aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
+ else
+ throw uno::RuntimeException();
+ }
+
+ for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] );
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(GetBasePool())
+ {
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_HEADER_ON:
+ case FN_UNO_HEADER_BACKGROUND:
+ case FN_UNO_HEADER_BOX:
+ case FN_UNO_HEADER_LR_SPACE:
+ case FN_UNO_HEADER_SHADOW:
+ case FN_UNO_HEADER_BODY_DISTANCE:
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_HEADER_SHARE_CONTENT:
+ case FN_UNO_HEADER_HEIGHT:
+ case FN_UNO_HEADER_EAT_SPACING:
+
+ case FN_UNO_FOOTER_ON:
+ case FN_UNO_FOOTER_BACKGROUND:
+ case FN_UNO_FOOTER_BOX:
+ case FN_UNO_FOOTER_LR_SPACE:
+ case FN_UNO_FOOTER_SHADOW:
+ case FN_UNO_FOOTER_BODY_DISTANCE:
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_FOOTER_SHARE_CONTENT:
+ case FN_UNO_FOOTER_HEIGHT:
+ case FN_UNO_FOOTER_EAT_SPACING:
+ {
+ sal_Bool bSetItem = sal_False;
+ sal_Bool bFooter = sal_False;
+ sal_uInt16 nItemType = TYPE_BOOL;
+ sal_uInt16 nRes = 0;
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_FOOTER_ON: bFooter = sal_True;
+ //kein break;
+ case FN_UNO_HEADER_ON: nRes = SID_ATTR_PAGE_ON;
+ break;
+ case FN_UNO_FOOTER_BACKGROUND: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH;
+ break;
+ case FN_UNO_FOOTER_BOX: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BOX: nRes = RES_BOX; nItemType = TYPE_BOX;
+ break;
+ case FN_UNO_FOOTER_LR_SPACE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE;
+ break;
+ case FN_UNO_FOOTER_SHADOW: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;nItemType = TYPE_SHADOW;
+ break;
+ case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE;
+ break;
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
+ break;
+ case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED;
+ break;
+ case FN_UNO_FOOTER_HEIGHT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE;
+ break;
+ case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE;
+ break;
+ }
+ const SvxSetItem* pSetItem;
+ if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(
+ bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ sal_False, (const SfxPoolItem**)&pSetItem))
+ {
+ SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone();
+ SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ SfxPoolItem* pNewItem = 0;
+ rSetSet.GetItemState(nRes, sal_True, &pItem);
+ if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes))
+ pItem = &rSetSet.GetPool()->GetDefaultItem(nRes);
+ if(pItem)
+ {
+ pNewItem = pItem->Clone();
+ }
+ else
+ {
+ switch(nItemType)
+ {
+ case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes); break;
+ case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes); break;
+ case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes); break;
+ case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break;
+ case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes); break;
+ case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break;
+ case TYPE_BOX: pNewItem = new SvxBoxItem(nRes); break;
+ }
+ }
+ bSetItem = pNewItem->PutValue(pValues[nProp], pEntry->nMemberId);
+ rSetSet.Put(*pNewItem);
+ aBaseImpl.GetItemSet().Put(*pNewSetItem);
+ delete pNewItem;
+ delete pNewSetItem;
+ }
+ else if(SID_ATTR_PAGE_ON == nRes )
+ {
+ sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
+ if(bVal)
+ {
+ SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(),
+ RES_BACKGROUND, RES_SHADOW,
+ RES_LR_SPACE, RES_UL_SPACE,
+ nRes, nRes,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
+ SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
+ 0 );
+ aTempSet.Put(SfxBoolItem(nRes, sal_True));
+ aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50)));
+ aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE));
+ aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE));
+ aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, sal_True));
+ aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, sal_True));
+
+ SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ aTempSet);
+ aBaseImpl.GetItemSet().Put(aNewSetItem);
+ }
+ }
+ }
+ break;
+ case FN_PARAM_FTN_INFO :
+ {
+ const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO);
+ SfxPoolItem* pNewFtnItem = rItem.Clone();
+ sal_Bool bPut = pNewFtnItem->PutValue(pValues[nProp], pEntry->nMemberId);
+ aBaseImpl.GetItemSet().Put(*pNewFtnItem);
+ delete pNewFtnItem;
+ if(!bPut)
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case FN_UNO_HEADER :
+ case FN_UNO_HEADER_LEFT :
+ case FN_UNO_HEADER_RIGHT :
+ case FN_UNO_FOOTER :
+ case FN_UNO_FOOTER_LEFT :
+ case FN_UNO_FOOTER_RIGHT :
+ throw lang::IllegalArgumentException();
+ //break;
+ default:
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl,
+ GetBasePool(), GetDoc(), GetFamily());
+ }
+ }
+ else if(IsDescriptor())
+ {
+ if(!GetPropImpl()->SetProperty(pNames[nProp], pValues[nProp]))
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ if(aBaseImpl.HasItemSet())
+ {
+ BOOL bDoesUndo = GetDoc()->DoesUndo();
+ if( bDoesUndo )
+ {
+ // Fix i64460: as long as Undo of page styles with header/footer causes trouble...
+ GetDoc()->DelAllUndoObj();
+ GetDoc()->DoUndo( FALSE );
+ }
+ aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());
+ GetDoc()->DoUndo( bDoesUndo );
+ }
+}
+
+void SwXPageStyle::setPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames,
+ const uno::Sequence< uno::Any >& rValues )
+ throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // workaround for bad designed API
+ try
+ {
+ SetPropertyValues_Impl( rPropertyNames, rValues );
+ }
+ catch (beans::UnknownPropertyException &rException)
+ {
+ // wrap the original (here not allowed) exception in
+ // a lang::WrappedTargetException that gets thrown instead.
+ lang::WrappedTargetException aWExc;
+ aWExc.TargetException <<= rException;
+ throw aWExc;
+ }
+}
+/* -----------------------------04.11.03 13:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static uno::Reference<text::XText>
+lcl_makeHeaderFooter(
+ const sal_uInt16 nRes, const bool bHeader, SwFrmFmt const*const pFrmFmt)
+{
+ if (!pFrmFmt) { return 0; }
+
+ const SfxItemSet& rSet = pFrmFmt->GetAttrSet();
+ const SfxPoolItem* pItem;
+ if (SFX_ITEM_SET == rSet.GetItemState(nRes, sal_True, &pItem))
+ {
+ SwFrmFmt *const pHeadFootFmt = (bHeader)
+ ? static_cast<SwFmtHeader*>(const_cast<SfxPoolItem*>(pItem))->
+ GetHeaderFmt()
+ : static_cast<SwFmtFooter*>(const_cast<SfxPoolItem*>(pItem))->
+ GetFooterFmt();
+ if (pHeadFootFmt)
+ {
+ return SwXHeadFootText::CreateXHeadFootText(*pHeadFootFmt, bHeader);
+ }
+ }
+ return 0;
+}
+
+uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
+ const uno::Sequence< OUString >& rPropertyNames )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ sal_Int32 nLength = rPropertyNames.getLength();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ uno::Sequence< uno::Any > aRet ( nLength );
+
+ uno::Any* pRet = aRet.getArray();
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE);
+ const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();
+ SwStyleBase_Impl aBase(*GetDoc(), GetStyleName());
+ SfxStyleSheetBase* pBase = 0;
+ for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
+ {
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] );
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(GetBasePool())
+ {
+ if(!pBase)
+ {
+ sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
+ GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL );
+ pBase = GetBasePool()->Find(GetStyleName());
+ GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
+ }
+ sal_uInt16 nRes = 0;
+ bool bHeader = false;
+ sal_Bool bAll = sal_False, bLeft = sal_False, bRight = sal_False;
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_HEADER_ON:
+ case FN_UNO_HEADER_BACKGROUND:
+ case FN_UNO_HEADER_BOX:
+ case FN_UNO_HEADER_LR_SPACE:
+ case FN_UNO_HEADER_SHADOW:
+ case FN_UNO_HEADER_BODY_DISTANCE:
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_HEADER_SHARE_CONTENT:
+ case FN_UNO_HEADER_HEIGHT:
+ case FN_UNO_HEADER_EAT_SPACING:
+
+ case FN_UNO_FOOTER_ON:
+ case FN_UNO_FOOTER_BACKGROUND:
+ case FN_UNO_FOOTER_BOX:
+ case FN_UNO_FOOTER_LR_SPACE:
+ case FN_UNO_FOOTER_SHADOW:
+ case FN_UNO_FOOTER_BODY_DISTANCE:
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_FOOTER_SHARE_CONTENT:
+ case FN_UNO_FOOTER_HEIGHT:
+ case FN_UNO_FOOTER_EAT_SPACING:
+ {
+ SfxStyleSheetBasePool* pBasePool2 = ((SwXPageStyle*)this)->GetBasePool();
+ pBasePool2->SetSearchMask(GetFamily());
+ SfxStyleSheetBase* pBase2 = pBasePool2->Find(GetStyleName());
+ if(pBase2)
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ const SfxItemSet& rSet = xStyle->GetItemSet();
+ sal_Bool bFooter = sal_False;
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_FOOTER_ON:
+ bFooter = sal_True;
+ // kein break!
+ case FN_UNO_HEADER_ON:
+ {
+ //falls das SetItem nicht da ist, dann ist der Wert sal_False
+ BOOL bRet = sal_False;
+ pRet[nProp].setValue(&bRet, ::getCppuBooleanType());
+ nRes = SID_ATTR_PAGE_ON;
+ }
+ break;
+ case FN_UNO_FOOTER_BACKGROUND: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND;
+ break;
+ case FN_UNO_FOOTER_BOX: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BOX: nRes = RES_BOX;
+ break;
+ case FN_UNO_FOOTER_LR_SPACE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;
+ break;
+ case FN_UNO_FOOTER_SHADOW: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;
+ break;
+ case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;
+ break;
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
+ break;
+ case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED;
+ break;
+ case FN_UNO_FOOTER_HEIGHT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;
+ break;
+ case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;
+ break;
+ }
+ const SvxSetItem* pSetItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(
+ bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ sal_False, (const SfxPoolItem**)&pSetItem))
+ {
+ const SfxItemSet& rTmpSet = pSetItem->GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ rTmpSet.GetItemState(nRes, sal_True, &pItem);
+ if(!pItem && nRes != rTmpSet.GetPool()->GetSlotId(nRes))
+ pItem = &rTmpSet.GetPool()->GetDefaultItem(nRes);
+ if(pItem)
+ pItem->QueryValue(pRet[nProp], pEntry->nMemberId);
+ }
+ }
+ }
+ break;
+ case FN_UNO_HEADER :
+ bAll = sal_True; goto Header;
+ case FN_UNO_HEADER_LEFT :
+ bLeft = sal_True; goto Header;
+ case FN_UNO_HEADER_RIGHT :
+ bRight = sal_True; goto Header;
+Header:
+ bHeader = true;
+ nRes = RES_HEADER; goto MakeObject;
+ case FN_UNO_FOOTER :
+ bAll = sal_True; goto Footer;
+ case FN_UNO_FOOTER_LEFT :
+ bLeft = sal_True; goto Footer;
+ case FN_UNO_FOOTER_RIGHT :
+ bRight = sal_True;
+Footer:
+ nRes = RES_FOOTER;
+MakeObject:
+ {
+ const SwPageDesc& rDesc = aBase.GetOldPageDesc();
+ const SwFrmFmt* pFrmFmt = 0;
+ sal_Bool bShare = bHeader && rDesc.IsHeaderShared()||
+ !bHeader && rDesc.IsFooterShared();
+ // TextLeft returns the left content if there is one,
+ // Text and TextRight return the master content.
+ // TextRight does the same as Text and is for
+ // comptability only.
+ if( bLeft && !bShare )
+ {
+ pFrmFmt = &rDesc.GetLeft();
+ }
+ else
+ {
+ pFrmFmt = &rDesc.GetMaster();
+ }
+ const uno::Reference< text::XText > xRet =
+ lcl_makeHeaderFooter(nRes, bHeader, pFrmFmt);
+ if (xRet.is())
+ {
+ pRet[nProp] <<= xRet;
+ }
+ }
+ break;
+ case FN_PARAM_FTN_INFO :
+ {
+ rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
+ const SfxItemSet& rSet = xStyle->GetItemSet();
+ const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO);
+ rItem.QueryValue(pRet[nProp], pEntry->nMemberId);
+ }
+ break;
+ default:
+ pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
+ }
+ }
+ else if(IsDescriptor())
+ {
+ uno::Any* pAny = 0;
+ GetPropImpl()->GetProperty(pNames[nProp], pAny);
+ if ( !pAny )
+ GetPropImpl()->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
+ else
+ pRet[nProp] = *pAny;
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+/* -----------------------------18.04.01 13:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXPageStyle::getPropertyValues(
+ const uno::Sequence< OUString >& rPropertyNames )
+ throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< uno::Any > aValues;
+
+ // workaround for bad designed API
+ try
+ {
+ aValues = GetPropertyValues_Impl( rPropertyNames );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property exception caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "WrappedTargetException caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ return aValues;
+}
+/*-- 17.12.98 08:43:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) throw(
+ beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
+ return GetPropertyValues_Impl(aProperties).getConstArray()[0];
+}
+/*-- 17.12.98 08:43:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
+ const uno::Sequence<uno::Any> aValues(&rValue, 1);
+ SetPropertyValues_Impl( aProperties, aValues );
+}
+
+SwXFrameStyle::SwXFrameStyle ( SwDoc *pDoc )
+: SwXStyle ( pDoc, SFX_STYLE_FAMILY_FRAME, FALSE)
+{
+}
+/* -----------------------------15.12.00 15:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXFrameStyle::~SwXFrameStyle()
+{
+}
+/* -----------------------------15.12.00 14:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SwXFrameStyle::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes = SwXStyle::getTypes();
+ sal_Int32 nLen = aTypes.getLength();
+ aTypes.realloc(nLen + 1);
+ aTypes.getArray()[nLen] = ::getCppuType((uno::Reference<XEventsSupplier>*)0);
+ return aTypes;
+}
+/* -----------------------------15.12.00 14:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXFrameStyle::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet;
+ if(rType == ::getCppuType((uno::Reference<XEventsSupplier>*)0))
+ aRet <<= uno::Reference<XEventsSupplier>(this);
+ else
+ aRet = SwXStyle::queryInterface(rType);
+ return aRet;
+}
+/* -----------------------------15.12.00 14:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< container::XNameReplace > SwXFrameStyle::getEvents( ) throw(uno::RuntimeException)
+{
+ return new SwFrameStyleEventDescriptor( *this );
+}
+/*-- 19.05.2006 11:23:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStyles::SwXAutoStyles(SwDocShell& rDocShell) :
+ SwUnoCollection(rDocShell.GetDoc()), pDocShell( &rDocShell )
+{
+}
+/*-- 19.05.2006 11:23:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStyles::~SwXAutoStyles()
+{
+}
+/*-- 19.05.2006 11:23:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXAutoStyles::getCount(void) throw( uno::RuntimeException )
+{
+ return AUTOSTYLE_FAMILY_COUNT;
+}
+/*-- 19.05.2006 11:23:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoStyles::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(nIndex < 0 || nIndex >= AUTOSTYLE_FAMILY_COUNT)
+ throw lang::IndexOutOfBoundsException();
+ if(IsValid())
+ {
+ uno::Reference< style::XAutoStyleFamily > aRef;
+ IStyleAccess::SwAutoStyleFamily nType = aAutoStyleByIndex[nIndex];
+ switch( nType )
+ {
+ case IStyleAccess::AUTO_STYLE_CHAR:
+ {
+ if(!xAutoCharStyles.is())
+ xAutoCharStyles = new SwXAutoStyleFamily(pDocShell, nType);
+ aRef = xAutoCharStyles;
+ }
+ break;
+ case IStyleAccess::AUTO_STYLE_RUBY:
+ {
+ if(!xAutoRubyStyles.is())
+ xAutoRubyStyles = new SwXAutoStyleFamily(pDocShell, nType );
+ aRef = xAutoRubyStyles;
+ }
+ break;
+ case IStyleAccess::AUTO_STYLE_PARA:
+ {
+ if(!xAutoParaStyles.is())
+ xAutoParaStyles = new SwXAutoStyleFamily(pDocShell, nType );
+ aRef = xAutoParaStyles;
+ }
+ break;
+
+ default:
+ ;
+ }
+ aRet.setValue(&aRef, ::getCppuType((const uno::Reference<style::XAutoStyleFamily>*)0));
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 19.05.2006 11:23:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXAutoStyles::getElementType( ) throw(uno::RuntimeException)
+{
+ return ::getCppuType((const uno::Reference<style::XAutoStyleFamily>*)0);
+}
+/*-- 19.05.2006 11:23:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoStyles::hasElements( ) throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+/*-- 19.05.2006 11:23:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoStyles::getByName(const rtl::OUString& Name)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ uno::Any aRet;
+ if(Name.compareToAscii("CharacterStyles") == 0 )
+ aRet = getByIndex(0);
+ else if(Name.compareToAscii("RubyStyles") == 0 )
+ aRet = getByIndex(1);
+ else if(Name.compareToAscii("ParagraphStyles") == 0 )
+ aRet = getByIndex(2);
+ else
+ throw container::NoSuchElementException();
+ return aRet;
+}
+/*-- 19.05.2006 11:23:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< rtl::OUString > SwXAutoStyles::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aNames(AUTOSTYLE_FAMILY_COUNT);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = C2U("CharacterStyles");
+ pNames[1] = C2U("RubyStyles");
+ pNames[2] = C2U("ParagraphStyles");
+ return aNames;
+}
+/*-- 19.05.2006 11:24:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoStyles::hasByName(const rtl::OUString& Name)
+ throw( uno::RuntimeException )
+{
+ if( Name.compareToAscii("CharacterStyles") == 0 ||
+ Name.compareToAscii("RubyStyles") == 0 ||
+ Name.compareToAscii("ParagraphStyles") == 0 )
+ return sal_True;
+ else
+ return sal_False;
+}
+
+/*-- 19.05.2006 11:24:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStyleFamily::SwXAutoStyleFamily(SwDocShell* pDocSh, IStyleAccess::SwAutoStyleFamily nFamily) :
+ pDocShell( pDocSh ), eFamily(nFamily)
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDocSh->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 19.05.2006 11:24:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStyleFamily::~SwXAutoStyleFamily()
+{
+}
+
+void SwXAutoStyleFamily::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ pDocShell = 0;
+}
+
+/*-- 31.05.2006 11:24:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
+ const uno::Sequence< beans::PropertyValue >& Values )
+ throw (uno::RuntimeException)
+{
+ if( !pDocShell )
+ throw uno::RuntimeException();
+ const USHORT* pRange = 0;
+ const SfxItemPropertySet* pPropSet = 0;
+ switch( eFamily )
+ {
+ case IStyleAccess::AUTO_STYLE_CHAR:
+ {
+ pRange = aCharAutoFmtSetRange;
+ pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE);
+ }
+ break;
+ case IStyleAccess::AUTO_STYLE_RUBY:
+ {
+ pRange = 0;//aTxtNodeSetRange;
+ pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE);
+ }
+ break;
+ case IStyleAccess::AUTO_STYLE_PARA:
+ {
+ pRange = aTxtNodeSetRange;
+ pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE);
+ }
+ break;
+
+ default:
+ ;
+ }
+ SwAttrSet aSet( pDocShell->GetDoc()->GetAttrPool(), pRange );
+ const beans::PropertyValue* pSeq = Values.getConstArray();
+ sal_Int32 nLen = Values.getLength();
+ for( sal_Int32 i = 0; i < nLen; ++i )
+ {
+ try
+ {
+ pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ ASSERT( false, "Unknown property" );
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ ASSERT( false, "Illegal argument" );
+ }
+ }
+
+ SfxItemSet_Pointer_t pSet = pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, eFamily );
+ uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(pDocShell->GetDoc(), pSet, eFamily);
+ return xRet;
+}
+/*-- 31.05.2006 11:24:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXAutoStyleFamily::createEnumeration( )
+ throw (uno::RuntimeException)
+{
+ if( !pDocShell )
+ throw uno::RuntimeException();
+ return uno::Reference< container::XEnumeration >
+ (new SwXAutoStylesEnumerator( pDocShell->GetDoc(), eFamily ));
+}
+/*-- 19.05.2006 11:24:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXAutoStyleFamily::getElementType( ) throw(uno::RuntimeException)
+{
+ return ::getCppuType((const uno::Reference<style::XAutoStyle>*)0);
+}
+/*-- 19.05.2006 11:24:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoStyleFamily::hasElements( ) throw(uno::RuntimeException)
+{
+ return sal_False;
+}
+
+/*-- 31.05.2006 11:24:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAutoStylesEnumImpl::SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAutoStyleFamily eFam )
+: pDoc( pInitDoc ), eFamily( eFam )
+{
+ // special case for ruby auto styles:
+ if ( IStyleAccess::AUTO_STYLE_RUBY == eFam )
+ {
+ std::set< std::pair< USHORT, USHORT > > aRubyMap;
+ SwAttrPool& rAttrPool = pDoc->GetAttrPool();
+ USHORT nCount = rAttrPool.GetItemCount( RES_TXTATR_CJK_RUBY );
+
+ for ( USHORT nI = 0; nI < nCount; ++nI )
+ {
+ const SwFmtRuby* pItem = static_cast<const SwFmtRuby*>(rAttrPool.GetItem( RES_TXTATR_CJK_RUBY, nI ));
+ if ( pItem && pItem->GetTxtRuby() )
+ {
+ std::pair< USHORT, USHORT > aPair( pItem->GetPosition(), pItem->GetAdjustment() );
+ if ( aRubyMap.find( aPair ) == aRubyMap.end() )
+ {
+ aRubyMap.insert( aPair );
+ SfxItemSet_Pointer_t pItemSet( new SfxItemSet( rAttrPool, RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY ) );
+ pItemSet->Put( *pItem );
+ mAutoStyles.push_back( pItemSet );
+ }
+ }
+ }
+ }
+ else
+ {
+ pDoc->GetIStyleAccess().getAllStyles( mAutoStyles, eFamily );
+ }
+
+ aIter = mAutoStyles.begin();
+}
+
+/*-- 31.05.2006 11:24:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStylesEnumerator::SwXAutoStylesEnumerator( SwDoc* pDoc, IStyleAccess::SwAutoStyleFamily eFam )
+: pImpl( new SwAutoStylesEnumImpl( pDoc, eFam ) )
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 31.05.2006 11:24:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStylesEnumerator::~SwXAutoStylesEnumerator()
+{
+ delete pImpl;
+}
+
+void SwXAutoStylesEnumerator::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ delete pImpl;
+ pImpl = 0;
+ }
+}
+
+
+/*-- 31.05.2006 11:24:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::sal_Bool SwXAutoStylesEnumerator::hasMoreElements( )
+ throw (uno::RuntimeException)
+{
+ if( !pImpl )
+ throw uno::RuntimeException();
+ return pImpl->hasMoreElements();
+}
+/*-- 31.05.2006 11:24:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoStylesEnumerator::nextElement( )
+ throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !pImpl )
+ throw uno::RuntimeException();
+ uno::Any aRet;
+ if( pImpl->hasMoreElements() )
+ {
+ SfxItemSet_Pointer_t pNextSet = pImpl->nextElement();
+ uno::Reference< style::XAutoStyle > xAutoStyle = new SwXAutoStyle(pImpl->getDoc(),
+ pNextSet, pImpl->getFamily());
+ aRet.setValue(&xAutoStyle, ::getCppuType((uno::Reference<style::XAutoStyle>*)0));
+ }
+ return aRet;
+}
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStyle::SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam )
+: pSet( pInitSet ), eFamily( eFam )
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoStyle::~SwXAutoStyle()
+{
+}
+
+void SwXAutoStyle::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ pSet.reset();
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySetInfo > xRet;
+ switch( eFamily )
+ {
+ case IStyleAccess::AUTO_STYLE_CHAR:
+ {
+ static uno::Reference< beans::XPropertySetInfo > xCharRef;
+ if(!xCharRef.is())
+ {
+ xCharRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE)->getPropertySetInfo();
+ }
+ xRet = xCharRef;
+ }
+ break;
+ case IStyleAccess::AUTO_STYLE_RUBY:
+ {
+ static uno::Reference< beans::XPropertySetInfo > xRubyRef;
+ if(!xRubyRef.is())
+ {
+ sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE;
+ xRubyRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
+ }
+ xRet = xRubyRef;
+ }
+ break;
+ case IStyleAccess::AUTO_STYLE_PARA:
+ {
+ static uno::Reference< beans::XPropertySetInfo > xParaRef;
+ if(!xParaRef.is())
+ {
+ sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE;
+ xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
+ }
+ xRet = xParaRef;
+ }
+ break;
+
+ default:
+ ;
+ }
+
+ return xRet;
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::setPropertyValue( const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ )
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoStyle::getPropertyValue( const OUString& rPropertyName )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
+ return GetPropertyValues_Impl(aProperties).getConstArray()[0];
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::addVetoableChangeListener( const OUString& /*PropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::setPropertyValues(
+ const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
+ const uno::Sequence< uno::Any >& /*aValues*/ )
+ throw (beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
+ const uno::Sequence< OUString > & rPropertyNames )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( !pSet.get() )
+ throw uno::RuntimeException();
+ // query_item
+
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;
+ switch(eFamily)
+ {
+ case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break;
+ case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break;
+ case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break;
+ default:
+ ;
+ }
+
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+ const OUString* pNames = rPropertyNames.getConstArray();
+
+ sal_Int32 nLen = rPropertyNames.getLength();
+ uno::Sequence< uno::Any > aRet( nLen );
+ uno::Any* pValues = aRet.getArray();
+
+ SfxItemSet& rSet = *pSet.get();
+
+ for( sal_Int32 i = 0; i < nLen; ++i )
+ {
+ const String& rPropName = pNames[i];
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName);
+ if(!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ else if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID )
+ {
+ OUString sName(StylePool::nameOf( pSet ));
+ pValues[i] <<= sName;
+ }
+ else
+ pPropSet->getPropertyValue( *pEntry, rSet, pValues[i] );
+ }
+ return aRet;
+}
+
+/*-- 19.05.2006 11:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< uno::Any > aValues;
+
+ // workaround for bad designed API
+ try
+ {
+ aValues = GetPropertyValues_Impl( rPropertyNames );
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property exception caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ catch (lang::WrappedTargetException &)
+ {
+ throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "WrappedTargetException caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ return aValues;
+}
+
+/*-- 19.05.2006 11:24:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::addPropertiesChangeListener(
+ const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::firePropertiesChangeEvent(
+ const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyName )
+ throw( beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Sequence< OUString > aNames(1);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = rPropertyName;
+ uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
+ return aStates.getConstArray()[0];
+}
+
+/*-- 19.05.2006 11:24:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::setPropertyToDefault( const OUString& /*PropertyName*/ )
+ throw( beans::UnknownPropertyException,
+ uno::RuntimeException )
+{
+}
+
+/*-- 19.05.2006 11:24:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoStyle::getPropertyDefault( const OUString& rPropertyName )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ return getPropertyDefaults ( aSequence ).getConstArray()[0];
+}
+
+/*-- 19.05.2006 11:24:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( !pSet.get() )
+ throw uno::RuntimeException();
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
+ beans::PropertyState* pStates = aRet.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+
+ sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;
+ switch(eFamily)
+ {
+ case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break;
+ case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break;
+ case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break;
+ default:
+ ;
+ }
+
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+ SfxItemSet& rSet = *pSet.get();
+ for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
+ {
+ const String& rPropName = pNames[i];
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName);
+ if(!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ pStates[i] = pPropSet->getPropertyState(*pEntry, rSet );
+ }
+ return aRet;
+}
+
+/*-- 19.05.2006 11:24:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoStyle::setPropertiesToDefault(
+ const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+}
+
+/*-- 19.05.2006 11:24:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults(
+ const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ uno::Sequence< uno::Any > aRet(0);
+ return aRet;
+}
+
+/*-- 19.05.2006 11:24:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::RuntimeException)
+{
+ if( !pSet.get() )
+ throw uno::RuntimeException();
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::vector< beans::PropertyValue > aPropertyVector;
+
+ sal_Int8 nPropSetId = 0;
+ switch(eFamily)
+ {
+ case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break;
+ case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break;
+ case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break;
+ default:
+ ;
+ }
+
+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
+ PropertyEntryVector_t aPropVector = pMap->getPropertyEntries();
+// struct compareWhichIds
+// {
+// bool operator()(const USHORT w1, const USHORT w2) const
+// {
+// return w1 < w2;
+// }
+// };
+// typedef std::map<const USHORT, SfxItemPropertyNamedEntry, compareWhichIds> PropertyMap_t;
+// PropertyMap_t aPropMap;
+// aPropMap.reserve( aPropVector.size() );
+// PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
+// while( aIt != aPropertyEntries.end() )
+// {
+// aPropMap[aIt->nWID] = *aIt;
+// ++aIt;
+// }
+
+ SfxItemSet& rSet = *pSet.get();
+ SfxItemIter aIter(rSet);
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ const USHORT nWID = pItem->Which();
+
+// PropertyMap_t::const_iterator aMapIt = aPropMap[nWID];
+// if( aMapIt != aPropMap.getEnd() )
+// {
+// beans::PropertyValue aPropertyValue;
+// aPropertyValue.Name = aIt->sName;
+// pItem->QueryValue( aPropertyValue.Value, aIt->nMemberId );
+// aPropertyVector.push_back( aPropertyValue );
+// }
+ // TODO: Optimize - and fix! the old iteration filled each WhichId
+ // only once but there are more properties than WhichIds
+ PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
+ while( aIt != aPropVector.end() )
+ {
+ if ( aIt->nWID == nWID )
+ {
+ beans::PropertyValue aPropertyValue;
+ aPropertyValue.Name = aIt->sName;
+ pItem->QueryValue( aPropertyValue.Value, aIt->nMemberId );
+ aPropertyVector.push_back( aPropertyValue );
+ }
+ ++aIt;
+ }
+/* int i = 0;
+ while ( pMap[i].nWID != 0 )
+ {
+ if ( pMap[i].nWID == nWID )
+ {
+ beans::PropertyValue aPropertyValue;
+ String sString( OUString::createFromAscii( pMap[i].pName ) );
+ aPropertyValue.Name = sString;
+ pItem->QueryValue( aPropertyValue.Value, pMap[i].nMemberId );
+ aPropertyVector.push_back( aPropertyValue );
+ break;
+ }
+ ++i;
+ }*/
+ pItem = aIter.NextItem();
+ }
+
+ const sal_Int32 nCount = aPropertyVector.size();
+ uno::Sequence< beans::PropertyValue > aRet( nCount );
+ beans::PropertyValue* pProps = aRet.getArray();
+
+ for ( int i = 0; i < nCount; ++i, pProps++ )
+ {
+ *pProps = aPropertyVector[i];
+ }
+
+ return aRet;
+}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
new file mode 100644
index 000000000000..b7098710802b
--- /dev/null
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -0,0 +1,5469 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+// STL includes
+#include <list>
+
+#include <svx/svxids.hrc>
+#include <editeng/memberids.hrc>
+#include <float.h> // for DBL_MIN
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <unotbl.hxx>
+#include <unostyle.hxx>
+#include <section.hxx>
+#include <unocrsr.hxx>
+#include <svx/unomid.hxx>
+#include <hints.hxx>
+#include <swtblfmt.hxx>
+#include <doc.hxx>
+#include <shellres.hxx>
+#include <docary.hxx>
+#include <ndole.hxx>
+#include <frame.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtfsize.hxx>
+#include <tblafmt.hxx>
+#include <tabcol.hxx>
+#include <cellatr.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#define _SVSTDARR_STRINGS
+#include <svl/svstdarr.hxx>
+#include <viewsh.hxx>
+#include <tabfrm.hxx>
+#include <redline.hxx>
+#include <unoredline.hxx>
+#include <unoprnms.hxx>
+#include <unocrsrhelper.hxx>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/TableBorderDistances.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
+#include <com/sun/star/chart/ChartDataChangeEvent.hpp>
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/table/CellContentType.hpp>
+#include <unotbl.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unoparagraph.hxx>
+#include <svl/zforlist.hxx> // SvNumberFormatter
+#include <editeng/brkitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <fmtornt.hxx>
+#include <editeng/keepitem.hxx>
+#include <fmtlsplt.hxx>
+#include <swundo.hxx>
+#include <vos/mutex.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <frmatr.hxx>
+#include <crsskip.hxx>
+#include <unochart.hxx>
+#include <sortopt.hxx>
+#include <rtl/math.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+//-----------------------------------------------------------------------------
+// from swtable.cxx
+extern void lcl_GetTblBoxColStr( sal_uInt16 nCol, String& rNm );
+
+#define UNO_TABLE_COLUMN_SUM 10000
+
+/* -----------------17.07.98 15:47-------------------
+ *
+ * --------------------------------------------------*/
+table::BorderLine lcl_SvxLineToLine(const SvxBorderLine* pLine)
+{
+ table::BorderLine aLine;
+ if(pLine)
+ {
+ aLine.Color = pLine->GetColor().GetColor() ;
+ aLine.InnerLineWidth = TWIP_TO_MM100_UNSIGNED( pLine->GetInWidth() );
+ aLine.OuterLineWidth = TWIP_TO_MM100_UNSIGNED( pLine->GetOutWidth() );
+ aLine.LineDistance = TWIP_TO_MM100_UNSIGNED( pLine->GetDistance() );
+ }
+ else
+ aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0;
+ return aLine;
+}
+/* -----------------17.07.98 15:52-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
+{
+ rSvxLine.SetColor( Color(rLine.Color));
+ rSvxLine.SetInWidth( MM100_TO_TWIP( rLine.InnerLineWidth ) );
+ rSvxLine.SetOutWidth(MM100_TO_TWIP( rLine.OuterLineWidth ) );
+ rSvxLine.SetDistance(MM100_TO_TWIP( rLine.LineDistance ) );
+ sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0;
+ return bRet;
+}
+/* -----------------11.12.98 14:22-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue)
+ throw (lang::IllegalArgumentException)
+{
+ //Sonderbehandlung fuer "Nicht-Items"
+ switch(pEntry->nWID)
+ {
+ case FN_TABLE_HEADLINE_REPEAT:
+ case FN_TABLE_HEADLINE_COUNT:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ {
+ UnoActionContext aAction(pFmt->GetDoc());
+ if( pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ pFmt->GetDoc()->SetRowsToRepeat( *pTable, bVal ? 1 : 0 );
+ }
+ else
+ {
+ sal_Int32 nRepeat = 0;
+ aValue >>= nRepeat;
+ if( nRepeat >= 0 && nRepeat < USHRT_MAX )
+ pFmt->GetDoc()->SetRowsToRepeat( *pTable, (USHORT) nRepeat );
+ }
+ }
+ }
+ break;
+ case FN_TABLE_IS_RELATIVE_WIDTH:
+ case FN_TABLE_WIDTH:
+ case FN_TABLE_RELATIVE_WIDTH:
+ {
+ sal_Int32 nWidth = 0;
+ SwFmtFrmSize aSz( pFmt->GetFrmSize() );
+ if(FN_TABLE_WIDTH == pEntry->nWID)
+ {
+ aValue >>= nWidth;
+ aSz.SetWidthPercent(0);
+ aSz.SetWidth ( MM100_TO_TWIP ( nWidth ) );
+ }
+ else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID)
+ {
+ sal_Int16 nSet = 0;
+ aValue >>= nSet;
+ if(nSet && nSet <=100)
+ aSz.SetWidthPercent( (BYTE)nSet );
+ }
+ else if(FN_TABLE_IS_RELATIVE_WIDTH == pEntry->nWID)
+ {
+ sal_Bool bPercent = *(sal_Bool*)aValue.getValue();
+ if(!bPercent)
+ aSz.SetWidthPercent(0);
+ else
+ {
+ lang::IllegalArgumentException aExcept;
+ aExcept.Message = C2U("relative width cannot be switched on with this property");
+ throw aExcept;
+ }
+ }
+ pFmt->GetDoc()->SetAttr(aSz, *pFmt);
+ }
+ break;
+ case RES_PAGEDESC:
+ {
+ OUString uTemp;
+ aValue >>= uTemp;
+ String sPageStyle = uTemp;
+ const SwPageDesc* pDesc = 0;
+ if(sPageStyle.Len())
+ {
+ SwStyleNameMapper::FillUIName(sPageStyle, sPageStyle, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
+ pDesc = ::GetPageDescByName_Impl(*pFmt->GetDoc(), sPageStyle);
+ }
+ SwFmtPageDesc aDesc( pDesc );
+ pFmt->GetDoc()->SetAttr(aDesc, *pFmt);
+ }
+ break;
+ default:
+ throw lang::IllegalArgumentException();
+ }
+}
+
+/* -----------------27.04.98 08:50-------------------
+ *
+ * --------------------------------------------------*/
+uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry )
+{
+ uno::Any aRet;
+ switch(pEntry->nWID)
+ {
+ case FN_TABLE_HEADLINE_REPEAT:
+ case FN_TABLE_HEADLINE_COUNT:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ USHORT nRepeat = pTable->GetRowsToRepeat();
+ if(pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
+ {
+ BOOL bTemp = nRepeat > 0;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ else
+ aRet <<= (sal_Int32)nRepeat;
+ }
+ break;
+ case FN_TABLE_WIDTH:
+ case FN_TABLE_IS_RELATIVE_WIDTH:
+ case FN_TABLE_RELATIVE_WIDTH:
+ {
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ if(FN_TABLE_WIDTH == pEntry->nWID)
+ rSz.QueryValue(aRet, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
+ else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID)
+ rSz.QueryValue(aRet, MID_FRMSIZE_REL_WIDTH);
+ else
+ {
+ BOOL bTemp = 0 != rSz.GetWidthPercent();
+ aRet.setValue(&bTemp, ::getBooleanCppuType());
+ }
+ }
+ break;
+ case RES_PAGEDESC:
+ {
+ const SfxItemSet& rSet = pFmt->GetAttrSet();
+ const SfxPoolItem* pItem;
+ String sPDesc;
+ if(SFX_ITEM_SET == rSet.GetItemState(RES_PAGEDESC, sal_False, &pItem))
+ {
+ const SwPageDesc* pDsc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
+ if(pDsc)
+ {
+ sPDesc = SwStyleNameMapper::GetProgName(pDsc->GetName(), nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
+ }
+ }
+ aRet <<= OUString(sPDesc);
+ }
+ break;
+ case RES_ANCHOR :
+ aRet <<= text::TextContentAnchorType_AT_PARAGRAPH;
+ break;
+ case FN_UNO_ANCHOR_TYPES :
+ {
+ uno::Sequence<text::TextContentAnchorType> aTypes(1);
+ text::TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
+ aRet <<= aTypes;
+ }
+ break;
+ case FN_UNO_WRAP :
+ {
+ aRet <<= text::WrapTextMode_NONE;
+ }
+ break;
+ case FN_PARAM_LINK_DISPLAY_NAME :
+ aRet <<= OUString(pFmt->GetName());
+ break;
+ case FN_UNO_REDLINE_NODE_START:
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwNode* pTblNode = pTable->GetTableNode();
+ if(FN_UNO_REDLINE_NODE_END == pEntry->nWID)
+ pTblNode = pTblNode->EndOfSectionNode();
+ const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
+ for(USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ const SwNode* pRedPointNode = pRedline->GetNode(TRUE);
+ const SwNode* pRedMarkNode = pRedline->GetNode(FALSE);
+ if(pRedPointNode == pTblNode || pRedMarkNode == pTblNode)
+ {
+ const SwNode* pStartOfRedline = SwNodeIndex(*pRedPointNode) <= SwNodeIndex(*pRedMarkNode) ?
+ pRedPointNode : pRedMarkNode;
+ BOOL bIsStart = pStartOfRedline == pTblNode;
+ aRet <<= SwXRedlinePortion::CreateRedlineProperties(*pRedline, bIsStart);
+ break;
+ }
+ }
+ }
+ break;
+ }
+ return aRet;
+}
+/* -----------------19.10.05 08:32-------------------
+ *
+ * --------------------------------------------------*/
+
+
+// returns the position for the cell with the specified name
+// (note that the indices rColumn and rRow are 0 based here)
+// Also since the implementations of tables does not really have
+// columns using this function is appropriate only for tables
+// that are not complex (i.e. where IsTblComplex() returns false).
+//
+// returns: both indices for column and row (all >= 0) if everything was Ok.
+// At least one value < 0 if sth was wrong.
+//
+// Sample for naming scheme of cell in a single row (in groups a 26):
+// A1..Z1, a1..z1, AA1..AZ1, Aa1..Az1, BA1..BZ1, Ba1..Bz1, ...
+void lcl_GetCellPosition( const String &rCellName,
+ sal_Int32 &rColumn, sal_Int32 &rRow)
+{
+ rColumn = rRow = -1; // default return values indicating failure
+ xub_StrLen nLen = rCellName.Len();
+ if (nLen)
+ {
+ const sal_Unicode *pBuf = rCellName.GetBuffer();
+ const sal_Unicode *pEnd = pBuf + nLen;
+ while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9'))
+ ++pBuf;
+ // start of number found?
+ if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9'))
+ {
+ String aColTxt( rCellName.GetBuffer(), static_cast< xub_StrLen >(pBuf - rCellName.GetBuffer()) );
+ String aRowTxt( pBuf, static_cast< xub_StrLen >(rCellName.GetBuffer() + nLen - pBuf) );
+ if (aColTxt.Len() && aRowTxt.Len())
+ {
+ sal_Int32 nColIdx = 0;
+ sal_Int32 nLength = aColTxt.Len();
+ for (xub_StrLen i = 0; i < nLength; ++i)
+ {
+ nColIdx = 52 * nColIdx;
+ if (i < nLength - 1)
+ ++nColIdx;
+ sal_Unicode cChar = aColTxt.GetBuffer()[i];
+ if ('A' <= cChar && cChar <= 'Z')
+ nColIdx = nColIdx + (cChar - 'A');
+ else if ('a' <= cChar && cChar <= 'z')
+ nColIdx = nColIdx + (26 + cChar - 'a');
+ else
+ {
+ nColIdx = -1; // sth failed
+ break;
+ }
+ }
+
+ rColumn = nColIdx;
+ rRow = aRowTxt.ToInt32() - 1; // - 1 because indices ought to be 0 based
+ }
+ }
+ }
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ASSERT( rColumn != -1 && rRow != -1, "failed to get column or row index" );
+#endif
+}
+
+
+// arguments: must be non-empty strings with valid cell names
+//
+// returns: -1 if first cell < second cell
+// 0 if both cells are equal
+// +1 if the first cell > second cell
+//
+// Note: this function probably also make sense only
+// for cell names of non-complex tables
+int lcl_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName2 )
+{
+ sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
+ lcl_GetCellPosition( rCellName1, nCol1, nRow1 );
+ lcl_GetCellPosition( rCellName2, nCol2, nRow2 );
+
+ if (nRow1 < nRow2 || (nRow1 == nRow2 && nCol1 < nCol2))
+ return -1;
+ else if (nCol1 == nCol2 && nRow1 == nRow2)
+ return 0;
+ else
+ return +1;
+}
+
+
+// arguments: must be non-empty strings with valid cell names
+//
+// returns: -1 if first cell < second cell
+// 0 if both cells are equal
+// +1 if the first cell > second cell
+//
+// Note: this function probably also make sense only
+// for cell names of non-complex tables
+int lcl_CompareCellsByColFirst( const String &rCellName1, const String &rCellName2 )
+{
+ sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
+ lcl_GetCellPosition( rCellName1, nCol1, nRow1 );
+ lcl_GetCellPosition( rCellName2, nCol2, nRow2 );
+
+ if (nCol1 < nCol2 || (nCol1 == nCol2 && nRow1 < nRow2))
+ return -1;
+ else if (nRow1 == nRow2 && nCol1 == nCol2)
+ return 0;
+ else
+ return +1;
+}
+
+
+// arguments: must be non-empty strings with valid cell names
+//
+// returns: -1 if first cell range < second cell range
+// 0 if both cell ranges are identical
+// +1 if the first cell range > second cell range
+//
+// Note: this function probably also make sense only
+// for cell names of non-complex tables
+int lcl_CompareCellRanges(
+ const String &rRange1StartCell, const String &rRange1EndCell,
+ const String &rRange2StartCell, const String &rRange2EndCell,
+ sal_Bool bCmpColsFirst )
+{
+ int (*pCompareCells)( const String &, const String & ) =
+ bCmpColsFirst ? &lcl_CompareCellsByColFirst : &lcl_CompareCellsByRowFirst;
+
+ int nCmpResStartCells = pCompareCells( rRange1StartCell, rRange2StartCell );
+ if ((-1 == nCmpResStartCells ) ||
+ ( 0 == nCmpResStartCells &&
+ -1 == pCompareCells( rRange1EndCell, rRange2EndCell ) ))
+ return -1;
+ else if (0 == nCmpResStartCells &&
+ 0 == pCompareCells( rRange1EndCell, rRange2EndCell ))
+ return 0;
+ else
+ return +1;
+}
+
+
+/* -----------------25.06.98 08:32-------------------
+ *
+ * --------------------------------------------------*/
+
+// returns the cell name for the cell at the specified position
+// (note that the indices nColumn and nRow are 0 based here)
+String lcl_GetCellName( sal_Int32 nColumn, sal_Int32 nRow )
+{
+#if OSL_DEBUG_LEVEL > 1
+ {
+ sal_Int32 nCol, nRow2;
+ lcl_GetCellPosition( String::CreateFromAscii("z1"), nCol, nRow2);
+ DBG_ASSERT( nCol == 51, "lcl_GetCellPosition failed" );
+ lcl_GetCellPosition( String::CreateFromAscii("AA1"), nCol, nRow2);
+ DBG_ASSERT( nCol == 52, "lcl_GetCellPosition failed" );
+ lcl_GetCellPosition( String::CreateFromAscii("AB1"), nCol, nRow2);
+ DBG_ASSERT( nCol == 53, "lcl_GetCellPosition failed" );
+ lcl_GetCellPosition( String::CreateFromAscii("BB1"), nCol, nRow2);
+ DBG_ASSERT( nCol == 105, "lcl_GetCellPosition failed" );
+ }
+#endif
+
+ String sCellName;
+ if (nColumn < 0 || nRow < 0)
+ return sCellName;
+ lcl_GetTblBoxColStr( static_cast< USHORT >(nColumn), sCellName );
+ sCellName += String::CreateFromInt32( nRow + 1 );
+ return sCellName;
+}
+
+/** Find the top left or bottom right corner box in given table.
+ Consider nested lines when finding the box.
+
+ @param i_pTable the table
+
+ @param i_bTopLeft if true, find top left box, otherwise find bottom
+ right box
+ */
+
+const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const bool i_bTopLeft)
+{
+ bool bFirst = true;
+ const SwTableBox* pBox = 0;
+ do
+ {
+ const SwTableLines& rLines(bFirst ? rTableLines : pBox->GetTabLines());
+ bFirst = false;
+ OSL_ASSERT(rLines.Count() != 0);
+ if (rLines.Count() != 0)
+ {
+ const SwTableLine* pLine(rLines[i_bTopLeft ? 0 : rLines.Count() - 1]);
+ OSL_ASSERT(pLine);
+ const SwTableBoxes& rBoxes(pLine->GetTabBoxes());
+ OSL_ASSERT(rBoxes.Count() != 0);
+ pBox = rBoxes[i_bTopLeft ? 0 : rBoxes.Count() - 1];
+ OSL_ASSERT(pBox);
+ }
+ else
+ {
+ pBox = 0;
+ }
+ } while (pBox && !pBox->GetSttNd());
+ return pBox;
+}
+
+/* -----------------21.11.05 14:46-------------------
+
+ --------------------------------------------------*/
+// start cell should be in the upper-left corner of the range and
+// end cell in the lower-right.
+// I.e. from the four possible representation
+// A1:C5, C5:A1, A5:C1, C1:A5
+// only A1:C5 is the one to use
+void lcl_NormalizeRange(
+ String &rCell1, // will hold the upper-left cell of the range upon return
+ String &rCell2 ) // will hold the lower-right cell of the range upon return
+{
+ sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
+ lcl_GetCellPosition( rCell1, nCol1, nRow1 );
+ lcl_GetCellPosition( rCell2, nCol2, nRow2 );
+ if (nCol2 < nCol1 || nRow2 < nRow1)
+ {
+ rCell1 = lcl_GetCellName( Min(nCol1, nCol2), Min(nRow1, nRow2) );
+ rCell2 = lcl_GetCellName( Max(nCol1, nCol2), Max(nRow1, nRow2) );
+ }
+
+}
+
+void SwRangeDescriptor::Normalize()
+{
+ if (nTop > nBottom)
+ {
+ sal_Int32 nTmp = nTop;
+ nTop = nBottom;
+ nBottom = nTmp;
+ }
+ if (nLeft > nRight)
+ {
+ sal_Int32 nTmp = nLeft;
+ nLeft = nRight;
+ nRight = nTmp;
+ }
+}
+
+
+/* -----------------25.06.98 08:32-------------------
+ *
+ * --------------------------------------------------*/
+SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRow)
+{
+ SwXCell* pXCell = 0;
+ String sCellName = lcl_GetCellName(nColumn, nRow);
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ if(pBox)
+ {
+ pXCell = SwXCell::CreateXCell(pFmt, pBox, pTable);
+ }
+ return pXCell;
+}
+/* -----------------20.07.98 12:35-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_InspectLines(SwTableLines& rLines, SvStrings& rAllNames)
+{
+ for( sal_uInt16 i = 0; i < rLines.Count(); i++ )
+ {
+ SwTableLine* pLine = rLines[i];
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for(sal_uInt16 j = 0; j < rBoxes.Count(); j++)
+ {
+ SwTableBox* pBox = rBoxes[j];
+ if(pBox->GetName().Len() && pBox->getRowSpan() > 0 )
+ rAllNames.Insert(new String(pBox->GetName()), rAllNames.Count());
+ SwTableLines& rBoxLines = pBox->GetTabLines();
+ if(rBoxLines.Count())
+ {
+ lcl_InspectLines(rBoxLines, rAllNames);
+ }
+ }
+ }
+}
+/* -----------------02.10.98 15:55-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_FormatTable(SwFrmFmt* pTblFmt)
+{
+ SwClientIter aIter( *pTblFmt );
+ for( SwClient* pC = aIter.First( TYPE( SwFrm ));
+ pC; pC = aIter.Next() )
+ {
+ if( ((SwFrm*)pC)->IsTabFrm() )
+ {
+ if(((SwFrm*)pC)->IsValid())
+ ((SwFrm*)pC)->InvalidatePos();
+ ((SwTabFrm*)pC)->SetONECalcLowers();
+ ((SwTabFrm*)pC)->Calc();
+ }
+ }
+}
+/* -----------------20.07.98 13:15-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_CrsrSelect(SwPaM* pCrsr, sal_Bool bExpand)
+{
+ if(bExpand)
+ {
+ if(!pCrsr->HasMark())
+ pCrsr->SetMark();
+ }
+ else if(pCrsr->HasMark())
+ pCrsr->DeleteMark();
+
+}
+/* -----------------17.07.98 14:36-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_GetTblSeparators(uno::Any& rRet, SwTable* pTable, SwTableBox* pBox, sal_Bool bRow)
+{
+ SwTabCols aCols;
+ aCols.SetLeftMin ( 0 );
+ aCols.SetLeft ( 0 );
+ aCols.SetRight ( UNO_TABLE_COLUMN_SUM );
+ aCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
+
+ pTable->GetTabCols( aCols, pBox, sal_False, bRow );
+
+ sal_uInt16 nSepCount = aCols.Count();
+ uno::Sequence< text::TableColumnSeparator> aColSeq(nSepCount);
+ text::TableColumnSeparator* pArray = aColSeq.getArray();
+ sal_Bool bError = sal_False;
+ for(sal_uInt16 i = 0; i < nSepCount; i++)
+ {
+ pArray[i].Position = static_cast< sal_Int16 >(aCols[i]);
+ pArray[i].IsVisible = !aCols.IsHidden(i);
+ if(!bRow && !pArray[i].IsVisible)
+ {
+ bError = sal_True;
+ break;
+ }
+ }
+ if(!bError)
+ rRet.setValue(&aColSeq, ::getCppuType((uno::Sequence< text::TableColumnSeparator>*)0));
+
+}
+/* -----------------17.07.98 14:36-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_SetTblSeparators(const uno::Any& rVal, SwTable* pTable, SwTableBox* pBox, sal_Bool bRow, SwDoc* pDoc)
+{
+ SwTabCols aOldCols;
+
+ aOldCols.SetLeftMin ( 0 );
+ aOldCols.SetLeft ( 0 );
+ aOldCols.SetRight ( UNO_TABLE_COLUMN_SUM );
+ aOldCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
+
+ pTable->GetTabCols( aOldCols, pBox, sal_False, bRow );
+ sal_uInt16 nOldCount = aOldCols.Count();
+ //there's no use in setting tab cols if there's only one column
+ if( !nOldCount )
+ return;
+
+ const uno::Sequence< text::TableColumnSeparator>* pSepSeq =
+ (uno::Sequence< text::TableColumnSeparator>*) rVal.getValue();
+ if(pSepSeq && pSepSeq->getLength() == nOldCount)
+ {
+ SwTabCols aCols(aOldCols);
+ sal_Bool bError = sal_False;
+ const text::TableColumnSeparator* pArray = pSepSeq->getConstArray();
+ sal_Int32 nLastValue = 0;
+ //sal_Int32 nTblWidth = aCols.GetRight() - aCols.GetLeft();
+ for(sal_uInt16 i = 0; i < nOldCount; i++)
+ {
+ aCols[i] = pArray[i].Position;
+ if(pArray[i].IsVisible == aCols.IsHidden(i) ||
+ !bRow && aCols.IsHidden(i) ||
+ long(aCols[i] - long(nLastValue)) < 0 ||
+ UNO_TABLE_COLUMN_SUM < aCols[i] )
+ {
+ bError = sal_True;
+ break;
+ }
+ nLastValue = aCols[i];
+ }
+ if(!bError)
+ {
+ pDoc->SetTabCols(*pTable, aCols, aOldCols, pBox, bRow );
+ }
+ }
+}
+/* -----------------30.04.02 08:00-------------------
+ *
+ * --------------------------------------------------*/
+inline rtl::OUString lcl_getString( SwXCell &rCell )
+{
+ // getString is a member function of the base class...
+ return rCell.getString();
+}
+/* -----------------30.04.02 08:00-------------------
+ * non UNO function call to set string in SwXCell
+ * --------------------------------------------------*/
+void lcl_setString( SwXCell &rCell, const rtl::OUString &rTxt,
+ BOOL bKeepNumberFmt )
+{
+ if(rCell.IsValid())
+ {
+ SwFrmFmt* pBoxFmt = rCell.pBox->ClaimFrmFmt();
+ pBoxFmt->LockModify();
+ pBoxFmt->ResetFmtAttr( RES_BOXATR_FORMULA );
+ pBoxFmt->ResetFmtAttr( RES_BOXATR_VALUE );
+ if (!bKeepNumberFmt)
+ pBoxFmt->SetFmtAttr( SwTblBoxNumFormat(NUMBERFORMAT_TEXT) );
+ pBoxFmt->UnlockModify();
+ }
+ rCell.SwXText::setString(rTxt);
+}
+/* -----------------30.04.02 08:00-------------------
+ * non UNO function call to get value from SwXCell
+ * --------------------------------------------------*/
+double lcl_getValue( SwXCell &rCell )
+{
+ double fRet;
+ if(rCell.IsValid() && rCell.getString().getLength()!=0)
+ fRet = rCell.pBox->GetFrmFmt()->GetTblBoxValue().GetValue();
+ else
+ ::rtl::math::setNan( &fRet );
+ return fRet;
+}
+/* -----------------30.04.02 08:00-------------------
+ * non UNO function call to set value in SwXCell
+ * --------------------------------------------------*/
+void lcl_setValue( SwXCell &rCell, double nVal )
+{
+ if(rCell.IsValid())
+ {
+ // Der Text mu? zunaechst (vielleicht) geloescht werden
+ ULONG nNdPos = rCell.pBox->IsValidNumTxtNd( sal_True );
+ if(ULONG_MAX != nNdPos)
+ lcl_setString( rCell, OUString(), TRUE ); // TRUE == keep number format
+ SwDoc* pDoc = rCell.GetDoc();
+ UnoActionContext aAction(pDoc);
+ SwFrmFmt* pBoxFmt = rCell.pBox->ClaimFrmFmt();
+ SfxItemSet aSet(pDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE);
+ const SfxPoolItem* pItem;
+
+ //!! do we need to set a new number format? Yes, if
+ // - there is no current number format
+ // - the current number format is not a number format according to the number formatter, but rather a text format
+ // - the current number format is not even a valid number formatter number format, but rather Writer's own 'special' text number format
+ if(SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
+ || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
+ || ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT)
+ {
+ aSet.Put(SwTblBoxNumFormat(0));
+ }
+
+ SwTblBoxValue aVal(nVal);
+ aSet.Put(aVal);
+ pDoc->SetTblBoxFormulaAttrs( *rCell.pBox, aSet );
+ //Tabelle aktualisieren
+ SwTableFmlUpdate aTblUpdate( SwTable::FindTable( rCell.GetFrmFmt() ));
+ pDoc->UpdateTblFlds( &aTblUpdate );
+ }
+}
+/******************************************************************
+ * SwXCell
+ ******************************************************************/
+TYPEINIT1(SwXCell, SwClient);
+/*-- 11.12.98 10:56:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, sal_uInt16 nPos ) :
+ SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT),
+ SwClient(pTblFmt),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
+ pBox(pBx),
+ pStartNode(0),
+ nFndPos(nPos)
+{
+}
+/* -----------------------------09.08.00 15:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXCell::SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode) :
+ SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT),
+ SwClient(pTblFmt),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
+ pBox(0),
+ pStartNode(&rStartNode),
+ nFndPos(USHRT_MAX)
+{
+}
+
+/*-- 11.12.98 10:56:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXCell::~SwXCell()
+{
+
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXCell::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ else
+ return SwXText::getSomething(rId);
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes( ) throw(uno::RuntimeException)
+{
+ static uno::Sequence< uno::Type > aRetTypes;
+ if(!aRetTypes.getLength())
+ {
+ aRetTypes = SwXCellBaseClass::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+
+ long nIndex = aRetTypes.getLength();
+ aRetTypes.realloc(
+ aRetTypes.getLength() +
+ aTextTypes.getLength());
+
+ uno::Type* pRetTypes = aRetTypes.getArray();
+
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(long nPos = 0; nPos <aTextTypes.getLength(); nPos++)
+ pRetTypes[nIndex++] = pTextTypes[nPos];
+ }
+ return aRetTypes;
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL SwXCell::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXCell::acquire( ) throw()
+{
+ SwXCellBaseClass::acquire();
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXCell::release( ) throw()
+{
+ SwXCellBaseClass::release();
+}
+/* -----------------------------18.05.00 10:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXCell::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aRet = SwXCellBaseClass::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXText::queryInterface(aType);
+ return aRet;
+}
+/*-- 11.12.98 10:56:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwStartNode *SwXCell::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+
+ if( pStartNode || ((SwXCell *)this)->IsValid() )
+ pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
+
+ return pSttNd;
+}
+
+uno::Reference< text::XTextCursor >
+SwXCell::CreateCursor() throw (uno::RuntimeException)
+{
+ return createTextCursor();
+}
+/*-- 11.12.98 10:56:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwXCell::IsValid() const
+{
+ // FIXME: this is now a const method, to make SwXText::IsValid invisible
+ // but the const_cast here are still ridiculous. TODO: find a better way.
+ SwFrmFmt* pTblFmt = pBox ? GetFrmFmt() : 0;
+ if(!pTblFmt)
+ {
+ const_cast<SwXCell*>(this)->pBox = 0;
+ }
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ SwTableBox const*const pFoundBox =
+ const_cast<SwXCell*>(this)->FindBox(pTable, pBox);
+ if (!pFoundBox)
+ {
+ const_cast<SwXCell*>(this)->pBox = 0;
+ }
+ }
+ return 0 != pBox;
+}
+/*-- 11.12.98 10:56:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXCell::getFormula(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString sRet;
+ if(IsValid())
+ {
+ SwTblBoxFormula aFormula( pBox->GetFrmFmt()->GetTblBoxFormula() );
+ SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ aFormula.PtrToBoxNm( pTable );
+ sRet = aFormula.GetFormula();
+ }
+ return sRet;
+}
+/*-- 11.12.98 10:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(IsValid())
+ {
+ // Der Text mu? zunaechst (vielleicht) geloescht werden
+ sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True );
+ if(USHRT_MAX == nNdPos)
+ lcl_setString( *this, OUString(), TRUE );
+ String sFml(rFormula);
+ if( sFml.EraseLeadingChars().Len() && '=' == sFml.GetChar( 0 ) )
+ sFml.Erase( 0, 1 );
+ SwTblBoxFormula aFml( sFml );
+ SwDoc* pMyDoc = GetDoc();
+ UnoActionContext aAction(pMyDoc);
+ SfxItemSet aSet(pMyDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMULA);
+ const SfxPoolItem* pItem;
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ if(SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
+ || pMyDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue()))
+ {
+ aSet.Put(SwTblBoxNumFormat(0));
+ }
+ aSet.Put(aFml);
+ GetDoc()->SetTblBoxFormulaAttrs( *pBox, aSet );
+ //Tabelle aktualisieren
+ SwTableFmlUpdate aTblUpdate( SwTable::FindTable( GetFrmFmt() ));
+ pMyDoc->UpdateTblFlds( &aTblUpdate );
+ }
+}
+/*-- 11.12.98 10:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+double SwXCell::getValue(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ double fRet = lcl_getValue( *this );
+ //lcl_getValue was changed thus it can return nan values,
+ //so I make this additional nan check here to not change the behaviour
+ //but maybe it would even be more correct to just return nan here? ... todo?
+ if( ::rtl::math::isNan( fRet ) )
+ fRet = 0.0;
+ return fRet;
+}
+/*-- 11.12.98 10:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::setValue(double rValue) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ lcl_setValue( *this, rValue );
+}
+/*-- 11.12.98 10:56:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+table::CellContentType SwXCell::getType(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ table::CellContentType nRes = table::CellContentType_EMPTY;
+ sal_uInt32 nNdPos = pBox->IsFormulaOrValueBox();
+ switch (nNdPos)
+ {
+ case 0 : nRes = table::CellContentType_TEXT; break;
+ case USHRT_MAX : nRes = table::CellContentType_EMPTY; break;
+ case RES_BOXATR_VALUE : nRes = table::CellContentType_VALUE; break;
+ case RES_BOXATR_FORMULA : nRes = table::CellContentType_FORMULA; break;
+ default :
+ DBG_ERROR( "unexpected case" );
+ }
+ return nRes;
+}
+/* -----------------27.04.99 12:06-------------------
+ *
+ * --------------------------------------------------*/
+void SwXCell::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ lcl_setString( *this, aString );
+}
+
+/*-- 11.12.98 10:56:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXCell::getError(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString sContent = getString();
+ return sContent.equals(ViewShell::GetShellRes()->aCalc_Error);
+}
+/*-- 11.12.98 10:56:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXCell::createTextCursor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextCursor > aRef;
+ if(pStartNode || IsValid())
+ {
+ const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ SwXTextCursor *const pXCursor =
+ new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, aPos);
+ SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ aRef = static_cast<text::XWordCursor*>(pXCursor);
+// // no Cursor in protected sections
+// SwCrsrSaveState aSave( *pUnoCrsr );
+// if(pUnoCrsr->IsInProtectTable( sal_True ) ||
+// pUnoCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
+// throw( uno::RuntimeException() );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 11.12.98 10:56:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXCell::createTextCursorByRange(const uno::Reference< text::XTextRange > & xTextPosition)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextCursor > aRef;
+ SwUnoInternalPaM aPam(*GetDoc());
+ if ((pStartNode || IsValid())
+ && ::sw::XTextRangeToSwPaM(aPam, xTextPosition))
+ {
+ const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
+ //skip sections
+ SwStartNode* p1 = aPam.GetNode()->StartOfSectionNode();
+ while(p1->IsSectionNode())
+ p1 = p1->StartOfSectionNode();
+
+ if( p1 == pSttNd )
+ {
+ aRef = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT,
+ *aPam.GetPoint(), aPam.GetMark()));
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 11.12.98 10:56:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXCell::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 10:56:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if(IsValid())
+ {
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if( !pEntry )
+ {
+ beans::UnknownPropertyException aEx;
+ aEx.Message = rPropertyName;
+ throw( aEx );
+ }
+ if( pEntry->nWID == FN_UNO_CELL_ROW_SPAN )
+ {
+ sal_Int32 nRowSpan = 0;
+ if( aValue >>= nRowSpan )
+ pBox->setRowSpan( nRowSpan );
+ }
+ else
+ {
+ SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt();
+ SwAttrSet aSet(pBoxFmt->GetAttrSet());
+ m_pPropSet->setPropertyValue(rPropertyName, aValue, aSet);
+ pBoxFmt->GetDoc()->SetAttr(aSet, *pBoxFmt);
+ }
+ }
+}
+/*-- 11.12.98 10:56:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ if(IsValid())
+ {
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if( !pEntry )
+ {
+ beans::UnknownPropertyException aEx;
+ aEx.Message = rPropertyName;
+ throw( aEx );
+ }
+ switch( pEntry->nWID )
+ {
+ case FN_UNO_CELL_ROW_SPAN:
+ aRet <<= pBox->getRowSpan();
+ break;
+ case FN_UNO_TEXT_SECTION:
+ {
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+ SwSectionNode* pSectionNode = pTblNode->FindSectionNode();
+ if(pSectionNode)
+ {
+ const SwSection& rSect = pSectionNode->GetSection();
+ uno::Reference< text::XTextSection > xSect =
+ SwXTextSections::GetObject( *rSect.GetFmt() );
+ aRet <<= xSect;
+ }
+ }
+ break;
+ case FN_UNO_CELL_NAME:
+ aRet <<= OUString ( pBox->GetName() );
+ break;
+ case FN_UNO_REDLINE_NODE_START:
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ //redline can only be returned if it's a living object
+ aRet = SwXText::getPropertyValue(rPropertyName);
+ }
+ break;
+ default:
+ {
+ const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ const SwAttrSet& rSet = pBoxFmt->GetAttrSet();
+ m_pPropSet->getPropertyValue(rPropertyName, rSet, aRet);
+ }
+ }
+ }
+ return aRet;
+}
+/*-- 11.12.98 10:56:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 10:56:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 10:56:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 10:56:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 10:56:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXCell::createEnumeration(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< container::XEnumeration > aRef;
+ if(IsValid())
+ {
+ const SwStartNode* pSttNd = pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(aPos, sal_False));
+ pUnoCursor->Move(fnMoveForward, fnGoNode);
+
+ // remember table and start node for later travelling
+ // (used in export of tables in tables)
+ SwTable const*const pTable( & pSttNd->FindTableNode()->GetTable() );
+ SwXParagraphEnumeration *const pEnum =
+ new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_TBLTEXT,
+ pSttNd, pTable);
+
+ aRef = pEnum;
+// // no Cursor in protected sections
+// SwCrsrSaveState aSave( *pUnoCrsr );
+// if(pUnoCrsr->IsInProtectTable( sal_True ) ||
+// pUnoCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
+// throw( uno::RuntimeException() );
+ }
+ return aRef;
+}
+/*-- 11.12.98 10:56:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXCell::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<text::XTextRange>*)0);
+
+}
+/*-- 11.12.98 10:56:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXCell::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+/*-- 11.12.98 10:56:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCell::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+/* -----------------12.06.98 07:54-------------------
+ *
+ * --------------------------------------------------*/
+SwXCell* SwXCell::CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, SwTable *pTable )
+{
+ SwXCell* pRet = 0;
+ if(pTblFmt && pBox)
+ {
+ if( !pTable )
+ pTable = SwTable::FindTable( pTblFmt );
+ sal_uInt16 nPos = USHRT_MAX;
+ SwTableBox* pFoundBox =
+ pTable->GetTabSortBoxes().Seek_Entry( pBox, &nPos ) ? pBox : NULL;
+
+ //wenn es die Box gibt, dann wird auch eine Zelle zurueckgegeben
+ if(pFoundBox)
+ {
+ SwClientIter aIter( *pTblFmt );
+ SwXCell* pXCell = (SwXCell*)aIter.
+ First( TYPE( SwXCell ));
+ while( pXCell )
+ {
+ // gibt es eine passende Zelle bereits?
+ if(pXCell->GetTblBox() == pBox)
+ break;
+ pXCell = (SwXCell*)aIter.Next();
+ }
+ //sonst anlegen
+ if(!pXCell)
+ pXCell = new SwXCell(pTblFmt, pBox, nPos );
+ pRet = pXCell;
+ }
+ }
+ return pRet;
+}
+/* -----------------12.06.98 07:37-------------------
+ * exitstiert die Box in der angegebenen Tabelle?
+ * --------------------------------------------------*/
+SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox2)
+{
+ // check if nFndPos happens to point to the right table box
+ if( nFndPos < pTable->GetTabSortBoxes().Count() &&
+ pBox2 == pTable->GetTabSortBoxes()[ nFndPos ] )
+ return pBox2;
+
+ // if not, seek the entry (and return, if successful)
+ if( pTable->GetTabSortBoxes().Seek_Entry( pBox2, &nFndPos ))
+ return pBox2;
+
+ // box not found: reset nFndPos pointer
+ nFndPos = USHRT_MAX;
+ return 0;
+}
+/* -----------------------------19.04.00 15:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXCell::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXCell");
+}
+/* -----------------------------19.04.00 15:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXCell::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.CellProperties");
+}
+/* -----------------------------19.04.00 15:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXCell::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.CellProperties");
+ return aRet;
+}
+
+/******************************************************************
+ * SwXTextTableRow
+ ******************************************************************/
+/* -----------------------------19.04.00 15:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextTableRow::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextTableRow");
+}
+/* -----------------------------19.04.00 15:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextTableRow::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.text.TextTableRow") == rServiceName;
+}
+/* -----------------------------19.04.00 15:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTableRow::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextTableRow");
+ return aRet;
+}
+TYPEINIT1(SwXTextTableRow, SwClient);
+/*-- 11.12.98 12:04:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTableRow::SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLn) :
+ SwClient(pFmt),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_ROW)),
+ pLine(pLn)
+{
+
+}
+/*-- 11.12.98 12:04:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTableRow::~SwXTextTableRow()
+{
+
+}
+/*-- 11.12.98 12:04:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextTableRow::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 12:04:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine);
+ if(pLn)
+ {
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ SwDoc* pDoc = pFmt->GetDoc();
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_ROW_HEIGHT:
+ case FN_UNO_ROW_AUTO_HEIGHT:
+ {
+ SwFmtFrmSize aFrmSize(pLn->GetFrmFmt()->GetFrmSize());
+ if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID)
+ {
+ sal_Bool bSet = *(sal_Bool*)aValue.getValue();
+ aFrmSize.SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
+ }
+ else
+ {
+ sal_Int32 nHeight = 0;
+ aValue >>= nHeight;
+ Size aSz(aFrmSize.GetSize());
+ aSz.Height() = MM100_TO_TWIP(nHeight);
+ aFrmSize.SetSize(aSz);
+ }
+ pDoc->SetAttr(aFrmSize, *pLn->ClaimFrmFmt());
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ UnoActionContext aContext(pDoc);
+ SwTable* pTable2 = SwTable::FindTable( pFmt );
+ lcl_SetTblSeparators(aValue, pTable2, pLine->GetTabBoxes()[0], sal_True, pDoc);
+ }
+ break;
+ default:
+ {
+ SwFrmFmt* pLnFmt = pLn->ClaimFrmFmt();
+ SwAttrSet aSet(pLnFmt->GetAttrSet());
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
+ pDoc->SetAttr(aSet, *pLnFmt);
+ }
+ }
+ }
+ }
+}
+/*-- 11.12.98 12:04:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine);
+ if(pLn)
+ {
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_ROW_HEIGHT:
+ case FN_UNO_ROW_AUTO_HEIGHT:
+ {
+ const SwFmtFrmSize& rSize = pLn->GetFrmFmt()->GetFrmSize();
+ if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID)
+ {
+ BOOL bTmp = ATT_VAR_SIZE == rSize.GetHeightSizeType();
+ aRet.setValue(&bTmp, ::getCppuBooleanType());
+ }
+ else
+ aRet <<= (sal_Int32)(TWIP_TO_MM100(rSize.GetSize().Height()));
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ lcl_GetTblSeparators(aRet, pTable, pLine->GetTabBoxes()[0], sal_True);
+ }
+ break;
+ default:
+ {
+ const SwAttrSet& rSet = pLn->GetFrmFmt()->GetAttrSet();
+ m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
+ }
+ }
+ }
+ }
+ return aRet;
+}
+/*-- 11.12.98 12:04:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableRow::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:04:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableRow::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:04:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableRow::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:04:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableRow::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:04:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableRow::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+/*-- 11.12.98 12:04:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine* pLine)
+{
+ SwTableLine* pRet = 0;
+ SwTableLines &rLines = pTable->GetTabLines();
+ for(sal_uInt16 i = 0; i < rLines.Count(); i++)
+ if(rLines.GetObject(i) == pLine)
+ {
+ pRet = pLine;
+ break;
+ }
+ return pRet;
+}
+
+/******************************************************************
+ * SwXTextTableCursor
+ ******************************************************************/
+/* -----------------------------19.04.00 15:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextTableCursor::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextTableCursor");
+}
+/* -----------------------------19.04.00 15:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextTableCursor::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.text.TextTableCursor") == rServiceName;
+}
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2(SwXTextTableCursor,SwXTextTableCursor_Base,OTextCursorHelper)
+const SwPaM* SwXTextTableCursor::GetPaM() const { return GetCrsr(); }
+SwPaM* SwXTextTableCursor::GetPaM() { return GetCrsr(); }
+const SwDoc* SwXTextTableCursor::GetDoc() const { return GetFrmFmt()->GetDoc(); }
+SwDoc* SwXTextTableCursor::GetDoc() { return GetFrmFmt()->GetDoc(); }
+const SwUnoCrsr* SwXTextTableCursor::GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
+SwUnoCrsr* SwXTextTableCursor::GetCrsr() { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
+/* -----------------------------19.04.00 15:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTableCursor::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextTableCursor");
+ return aRet;
+}
+
+/*-- 11.12.98 12:16:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox) :
+ SwClient(pFmt),
+ aCrsrDepend(this, 0),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
+{
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwStartNode* pSttNd = pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->Add(&aCrsrDepend);
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pTblCrsr->MakeBoxSels();
+}
+/*-- 11.12.98 12:16:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt& rTableFmt, const SwTableCursor* pTableSelection) :
+ SwClient(&rTableFmt),
+ aCrsrDepend(this, 0),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
+{
+ SwUnoCrsr* pUnoCrsr = pTableSelection->GetDoc()->CreateUnoCrsr(*pTableSelection->GetPoint(), sal_True);
+ if(pTableSelection->HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *pTableSelection->GetMark();
+ }
+ const SwSelBoxes& rBoxes = pTableSelection->GetBoxes();
+ SwTableCursor* pTableCrsr = dynamic_cast<SwTableCursor*>(pUnoCrsr);
+ for(sal_uInt16 i = 0; i < rBoxes.Count(); i++)
+ pTableCrsr->InsertBox( *rBoxes.GetObject(i) );
+
+ pUnoCrsr->Add(&aCrsrDepend);
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pTblCrsr->MakeBoxSels();
+}
+/*-- 11.12.98 12:16:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTableCursor::~SwXTextTableCursor()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ delete pUnoCrsr;
+}
+/*-- 11.12.98 12:16:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextTableCursor::getRangeName(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString aRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+
+ //!! see also SwChartDataSequence::getSourceRangeRepresentation
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pTblCrsr->MakeBoxSels();
+ const SwStartNode* pNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ const SwTableBox* pEndBox = pTable->GetTblBox( pNode->GetIndex());
+ String aTmp( pEndBox->GetName() );
+
+ if(pTblCrsr->HasMark())
+ {
+ pNode = pTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
+ const SwTableBox* pStartBox = pTable->GetTblBox( pNode->GetIndex());
+ if(pEndBox != pStartBox)
+ {
+ // need to switch start and end?
+ if (*pTblCrsr->GetPoint() < *pTblCrsr->GetMark())
+ {
+ const SwTableBox* pTmpBox = pStartBox;
+ pStartBox = pEndBox;
+ pEndBox = pTmpBox;
+ }
+
+ aTmp = pStartBox->GetName();
+ aTmp += ':';
+ aTmp += pEndBox->GetName();
+ }
+ }
+ aRet = aTmp;
+ }
+ return aRet;
+}
+/*-- 11.12.98 12:16:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& CellName, sal_Bool Expand)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ String sCellName(CellName);
+ bRet = pTblCrsr->GotoTblBox(sCellName);
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->Left( Count,CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->Right( Count, CRSR_SKIP_CHARS, FALSE, FALSE);
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->UpDown(sal_True, Count, 0, 0);
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->UpDown(sal_False, Count, 0, 0);
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ pTblCrsr->MoveTable(fnTableCurr, fnTableStart);
+ }
+}
+/*-- 11.12.98 12:16:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ pTblCrsr->MoveTable(fnTableCurr, fnTableEnd);
+ }
+}
+/*-- 11.12.98 12:16:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::mergeRange(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pTblCrsr->MakeBoxSels();
+
+ {
+ UnoActionContext aContext(pUnoCrsr->GetDoc());
+ bRet = TBLMERGE_OK == pTblCrsr->GetDoc()->MergeTbl(*pTblCrsr);
+ if(bRet)
+ {
+ USHORT nCount = pTblCrsr->GetBoxesCount();
+ while(nCount--)
+ pTblCrsr->DeleteBox(nCount);
+ }
+ }
+ pTblCrsr->MakeBoxSels();
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (Count <= 0)
+ throw uno::RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal first argument: needs to be > 0" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pTblCrsr->MakeBoxSels();
+ {
+ UnoActionContext aContext(pUnoCrsr->GetDoc());
+ bRet = pTblCrsr->GetDoc()->SplitTbl( pTblCrsr->GetBoxes(), !Horizontal, Count );
+ }
+ pTblCrsr->MakeBoxSels();
+ }
+ return bRet;
+}
+/*-- 11.12.98 12:16:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextTableCursor::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 12:16:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwStartNode* pSttNode = pUnoCrsr->GetNode()->StartOfSectionNode();
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ pTblCrsr->MakeBoxSels();
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ switch(pEntry->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ pDoc->GetBoxAttr( *pUnoCrsr, aBrush );
+ aBrush.PutValue(aValue, pEntry->nMemberId);
+ pDoc->SetBoxAttr( *pUnoCrsr, aBrush );
+
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ {
+ SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
+ aNumberFormat.PutValue(aValue, 0);
+ pDoc->SetBoxAttr( *pUnoCrsr, aNumberFormat);
+ }
+ break;
+ case FN_UNO_PARA_STYLE:
+ SwUnoCursorHelper::SetTxtFmtColl(aValue, *pUnoCrsr);
+ break;
+ default:
+ {
+ SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
+ SwUnoCursorHelper::GetCrsrAttr(pTblCrsr->GetSelRing(),
+ aItemSet);
+
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, aValue, pTblCrsr->GetSelRing(), aItemSet))
+ {
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
+ }
+ SwUnoCursorHelper::SetCrsrAttr(pTblCrsr->GetSelRing(),
+ aItemSet, nsSetAttrMode::SETATTR_DEFAULT, true);
+ }
+ }
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+}
+/*-- 11.12.98 12:16:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwStartNode* pSttNode = pUnoCrsr->GetNode()->StartOfSectionNode();
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
+ SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pEntry)
+ {
+ pTblCrsr->MakeBoxSels();
+ switch(pEntry->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ if(pTblCrsr->GetDoc()->GetBoxAttr( *pUnoCrsr, aBrush ))
+ aBrush.QueryValue(aRet, pEntry->nMemberId);
+
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ //GetAttr fuer Tabellenselektion am Doc fehlt noch
+ DBG_WARNING("not implemented");
+ break;
+ case FN_UNO_PARA_STYLE:
+ {
+ SwFmtColl *const pFmt =
+ SwUnoCursorHelper::GetCurTxtFmtColl(*pUnoCrsr, FALSE);
+ OUString sRet;
+ if(pFmt)
+ sRet = pFmt->GetName();
+ aRet <<= sRet;
+ }
+ break;
+ default:
+ {
+ SfxItemSet aSet(pTblCrsr->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END -1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+ // erstmal die Attribute des Cursors
+ SwUnoCursorHelper::GetCrsrAttr(pTblCrsr->GetSelRing(),
+ aSet);
+ m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
+ }
+ }
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ return aRet;
+}
+/*-- 11.12.98 12:16:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:16:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:16:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:16:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:16:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTableCursor::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+/******************************************************************
+ * SwXTextTable
+ ******************************************************************/
+/****************************************************************************
+ Tabellenbeschreibung
+****************************************************************************/
+
+class SwTableProperties_Impl
+{
+ SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
+public:
+ SwTableProperties_Impl();
+ ~SwTableProperties_Impl();
+
+ void SetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any& aVal);
+ sal_Bool GetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any*& rpAny);
+
+ void ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc);
+};
+
+/* -----------------22.06.98 09:43-------------------
+ *
+ * --------------------------------------------------*/
+SwTableProperties_Impl::SwTableProperties_Impl()
+{
+}
+/* -----------------22.06.98 09:51-------------------
+ *
+ * --------------------------------------------------*/
+SwTableProperties_Impl::~SwTableProperties_Impl()
+{
+}
+/* -----------------22.06.98 09:51-------------------
+ *
+ * --------------------------------------------------*/
+void SwTableProperties_Impl::SetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any& rVal)
+{
+ aAnyMap.SetValue( nWhichId, nMemberId, rVal );
+}
+/* -----------------22.06.98 09:51-------------------
+ *
+ * --------------------------------------------------*/
+
+sal_Bool SwTableProperties_Impl::GetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any*& rpAny )
+{
+ return aAnyMap.FillValue( nWhichId, nMemberId, rpAny );
+}
+/* -----------------13.01.99 15:42-------------------
+ *
+ * --------------------------------------------------*/
+void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
+{
+ SfxItemSet aSet(rDoc.GetAttrPool(),
+ RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_UL_SPACE,
+ RES_HORI_ORIENT, RES_HORI_ORIENT,
+ RES_BREAK, RES_BREAK,
+ RES_KEEP, RES_KEEP,
+ RES_SHADOW, RES_SHADOW,
+ RES_PAGEDESC, RES_PAGEDESC,
+ 0
+ );
+ const uno::Any* pRepHead;
+ const SwFrmFmt &rFrmFmt = *rTbl.GetFrmFmt();
+ if(GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff, pRepHead ))
+ {
+ sal_Bool bVal = *(sal_Bool*)pRepHead->getValue();
+ ((SwTable&)rTbl).SetRowsToRepeat( bVal ? 1 : 0 ); // TODO MULTIHEADER
+ }
+
+ const uno::Any* pBackColor = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pBackColor );
+ const uno::Any* pBackTrans = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pBackTrans );
+ const uno::Any* pGrLoc = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
+ const uno::Any* pGrURL = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL );
+ const uno::Any* pGrFilter = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter );
+
+ if(pBackColor||pBackTrans||pGrURL||pGrFilter||pGrLoc)
+ {
+ SvxBrushItem aBrush ( rFrmFmt.GetBackground() );
+ if(pBackColor)
+ aBrush.PutValue(*pBackColor, MID_BACK_COLOR);
+ if(pBackTrans)
+ aBrush.PutValue(*pBackTrans, MID_GRAPHIC_TRANSPARENT);
+ if(pGrURL)
+ aBrush.PutValue(*pGrURL, MID_GRAPHIC_URL);
+ if(pGrFilter)
+ aBrush.PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
+ if(pGrLoc)
+ aBrush.PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
+ aSet.Put(aBrush);
+ }
+
+ sal_Bool bPutBreak = sal_True;
+ const uno::Any* pPage;
+ if(GetProperty(FN_UNO_PAGE_STYLE, 0, pPage) || GetProperty(RES_PAGEDESC, 0xff, pPage))
+ {
+ OUString uTmp;
+ (*pPage) >>= uTmp;
+ String sPageStyle = uTmp;
+ if(sPageStyle.Len())
+ {
+ SwStyleNameMapper::FillUIName(sPageStyle, sPageStyle, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
+ const SwPageDesc* pDesc = ::GetPageDescByName_Impl(rDoc, sPageStyle);
+ if(pDesc)
+ {
+ SwFmtPageDesc aDesc( pDesc );
+ const uno::Any* pPgNo;
+ if(GetProperty(RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET, pPgNo ))
+ {
+ INT16 nTmp = 0;
+ (*pPgNo) >>= nTmp;
+ aDesc.SetNumOffset( nTmp );
+ }
+ aSet.Put(aDesc);
+ bPutBreak = sal_False;
+ }
+
+ }
+ }
+ const uno::Any* pBreak;
+ if(bPutBreak && GetProperty(RES_BREAK, 0, pBreak))
+ {
+ SvxFmtBreakItem aBreak ( rFrmFmt.GetBreak() );
+ aBreak.PutValue(*pBreak, 0);
+ aSet.Put(aBreak);
+ }
+ const uno::Any* pShadow;
+ if(GetProperty(RES_SHADOW, 0, pShadow))
+ {
+ SvxShadowItem aShd ( rFrmFmt.GetShadow() );
+ aShd.PutValue(*pShadow, CONVERT_TWIPS);
+ aSet.Put(aShd);
+ }
+ const uno::Any* pKeep;
+ if(GetProperty(RES_KEEP, 0, pKeep))
+ {
+ SvxFmtKeepItem aKeep( rFrmFmt.GetKeep() );
+ aKeep.PutValue(*pKeep, 0);
+ aSet.Put(aKeep);
+ }
+
+ sal_Bool bFullAlign = sal_True;
+ const uno::Any* pHOrient;
+ if(GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHOrient))
+ {
+ SwFmtHoriOrient aOrient ( rFrmFmt.GetHoriOrient() );
+ ((SfxPoolItem&)aOrient).PutValue(*pHOrient, MID_HORIORIENT_ORIENT|CONVERT_TWIPS);
+ bFullAlign = (aOrient.GetHoriOrient() == text::HoriOrientation::FULL);
+ aSet.Put(aOrient);
+ }
+
+
+ const uno::Any* pSzRel = 0;
+ GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel );
+ const uno::Any* pRelWidth = 0;
+ GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff, pRelWidth);
+ const uno::Any* pWidth = 0;
+ GetProperty(FN_TABLE_WIDTH, 0xff, pWidth );
+
+ sal_Bool bPutSize = pWidth != 0;
+ SwFmtFrmSize aSz( ATT_VAR_SIZE);
+ if(pWidth)
+ {
+ ((SfxPoolItem&)aSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH);
+ bPutSize = sal_True;
+ }
+ sal_Bool bTemp = pSzRel ? *(sal_Bool*)pSzRel->getValue() : FALSE;
+ if(pSzRel && bTemp && pRelWidth)
+ {
+ ((SfxPoolItem&)aSz).PutValue(*pRelWidth, MID_FRMSIZE_REL_WIDTH|CONVERT_TWIPS);
+ bPutSize = sal_True;
+ }
+ if(bPutSize)
+ {
+ if(!aSz.GetWidth())
+ aSz.SetWidth(MINLAY);
+ aSet.Put(aSz);
+ }
+ const uno::Any* pL = 0;
+ GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL);
+ const uno::Any* pR = 0;
+ GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR);
+ if(pL||pR)
+ {
+ SvxLRSpaceItem aLR ( rFrmFmt.GetLRSpace() );
+ if(pL)
+ ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
+ if(pR)
+ ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
+ aSet.Put(aLR);
+ }
+ const uno::Any* pU = 0;
+ GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pU);
+ const uno::Any* pLo = 0;
+ GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pLo);
+ if(pU||pLo)
+ {
+ SvxULSpaceItem aUL ( rFrmFmt.GetULSpace() );
+ if(pU)
+ ((SfxPoolItem&)aUL).PutValue(*pU, MID_UP_MARGIN|CONVERT_TWIPS);
+ if(pLo)
+ ((SfxPoolItem&)aUL).PutValue(*pLo, MID_LO_MARGIN|CONVERT_TWIPS);
+ aSet.Put(aUL);
+ }
+ const::uno::Any* pSplit;
+ if(GetProperty(RES_LAYOUT_SPLIT, 0, pSplit ))
+ {
+ sal_Bool bTmp = *(sal_Bool*)pSplit->getValue();
+ SwFmtLayoutSplit aSp(bTmp);
+ aSet.Put(aSp);
+ }
+
+ //TODO: folgende Propertiers noch impl.
+// FN_UNO_RANGE_ROW_LABEL
+// FN_UNO_RANGE_COL_LABEL
+// FN_UNO_TABLE_BORDER
+
+ if(aSet.Count())
+ {
+ rDoc.SetAttr( aSet, *rTbl.GetFrmFmt() );
+ }
+}
+/* -----------------------------11.07.00 12:14--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextTable* SwXTextTable::GetImplementation(uno::Reference< XInterface> xRef )
+{
+ uno::Reference<lang::XUnoTunnel> xTunnel( xRef, uno::UNO_QUERY);
+ if(xTunnel.is())
+ return reinterpret_cast< SwXTextTable * >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXTextTable::getUnoTunnelId()) ));
+ return 0;
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/*-- 11.12.98 12:42:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TYPEINIT1(SwXTextTable, SwClient)
+
+/*-- 11.12.98 12:42:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTable::SwXTextTable() :
+ aLstnrCntnr( (text::XTextTable*)this),
+ aChartLstnrCntnr( (text::XTextTable*)this),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
+ pTableProps(new SwTableProperties_Impl),
+ bIsDescriptor(sal_True),
+ nRows(2),
+ nColumns(2),
+ bFirstRowAsLabel(sal_False),
+ bFirstColumnAsLabel(sal_False)
+{
+
+}
+/*-- 11.12.98 12:42:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt) :
+ SwClient( &rFrmFmt ),
+ aLstnrCntnr( (text::XTextTable*)this),
+ aChartLstnrCntnr( (text::XTextTable*)this),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
+ pTableProps(0),
+ bIsDescriptor(sal_False),
+ nRows(0),
+ nColumns(0),
+ bFirstRowAsLabel(sal_False),
+ bFirstColumnAsLabel(sal_False)
+{
+
+}
+/*-- 11.12.98 12:42:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextTable::~SwXTextTable()
+{
+ delete pTableProps;
+}
+/*-- 11.12.98 12:42:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::initialize(sal_Int32 nR, sal_Int32 nC) throw( uno::RuntimeException )
+{
+ if(!bIsDescriptor || nR <= 0 || nC <= 0 || nR >= USHRT_MAX || nC >= USHRT_MAX )
+ throw uno::RuntimeException();
+ else
+ {
+ nRows = (sal_uInt16)nR;
+ nColumns = (sal_uInt16)nC;
+ }
+}
+/*-- 11.12.98 12:42:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XTableRows > SwXTextTable::getRows(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XTableRows > xRet;
+ if (SwFrmFmt* pFmt = GetFrmFmt())
+ {
+ SwXTableRows* pRows = (SwXTableRows*)SwClientIter(*pFmt).
+ First(TYPE(SwXTableRows));
+ if (!pRows)
+ pRows = new SwXTableRows(*pFmt);
+ xRet = pRows;
+ }
+ if (!xRet.is())
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 12:42:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XTableColumns > SwXTextTable::getColumns(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XTableColumns > xRet;
+ if (SwFrmFmt* pFmt = GetFrmFmt())
+ {
+ SwXTableColumns* pCols = (SwXTableColumns*)SwClientIter(*pFmt).
+ First(TYPE(SwXTableColumns));
+ if (!pCols)
+ pCols = new SwXTableColumns(*pFmt);
+ xRet = pCols;
+ }
+ if (!xRet.is())
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 12:42:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& CellName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCell > xRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ String sCellName(CellName);
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ if(pBox)
+ {
+ xRet = SwXCell::CreateXCell(pFmt, pBox);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 12:42:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ // gibts an der Tabelle und an allen Boxen
+ SwTableLines& rTblLines = pTable->GetTabLines();
+ SvStrings aAllNames;
+ lcl_InspectLines(rTblLines, aAllNames);
+ uno::Sequence< OUString > aRet(aAllNames.Count());
+ OUString* pArray = aRet.getArray();
+ for(sal_uInt16 i = aAllNames.Count(); i; i--)
+ {
+ String* pObject = aAllNames.GetObject(i-1);
+ pArray[i - 1] = *pObject;
+ aAllNames.Remove(i - 1);
+ delete pObject;
+ }
+ return aRet;
+ }
+ return uno::Sequence< OUString >();
+}
+/*-- 11.12.98 12:42:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(const OUString& CellName)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextTableCursor > xRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ String sCellName(CellName);
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ if(pBox && pBox->getRowSpan() > 0 )
+ {
+ xRet = new SwXTextTableCursor(pFmt, pBox);
+ }
+ }
+ if(!xRet.is())
+ throw uno::RuntimeException();
+ return xRet;
+}
+/* -----------------18.02.99 13:36-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ // attachToRange must only be called once
+ if(!bIsDescriptor) /* already attached ? */
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "SwXTextTable: already attached to range." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = reinterpret_cast< SwXTextRange * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
+ pCursor = reinterpret_cast< OTextCursorHelper * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ }
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc && nRows && nColumns)
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
+
+ {
+ UnoActionContext aCont( pDoc );
+
+ pDoc->StartUndo(UNDO_EMPTY, NULL);
+ const SwTable *pTable = 0;
+ if( 0 != aPam.Start()->nContent.GetIndex() )
+ {
+ pDoc->SplitNode(*aPam.Start(), false );
+ }
+ //TODO: wenn es der letzte Absatz ist, dann muss noch ein Absatz angehaengt werden!
+ if( aPam.HasMark() )
+ {
+ pDoc->DeleteAndJoin(aPam);
+ aPam.DeleteMark();
+ }
+ pTable = pDoc->InsertTable( SwInsertTableOptions( tabopts::HEADLINE | tabopts::DEFAULT_BORDER | tabopts::SPLIT_LAYOUT, 0 ),
+ *aPam.GetPoint(),
+ nRows,
+ nColumns,
+ text::HoriOrientation::FULL );
+ if(pTable)
+ {
+ // hier muessen die Properties des Descriptors ausgewertet werden
+ pTableProps->ApplyTblAttr(*pTable, *pDoc);
+ SwFrmFmt* pTblFmt = pTable->GetFrmFmt();
+ SwClientIter aIter( *pTblFmt );
+ for( SwClient* pC = aIter.First( TYPE( SwFrm ));
+ pC; pC = aIter.Next() )
+ {
+ if( ((SwFrm*)pC)->IsTabFrm() )
+ {
+ if(((SwFrm*)pC)->IsValid())
+ ((SwFrm*)pC)->InvalidatePos();
+ ((SwTabFrm*)pC)->SetONECalcLowers();
+ ((SwTabFrm*)pC)->Calc();
+ }
+ }
+
+ pTblFmt->Add(this);
+ if(m_sTableName.Len())
+ {
+ sal_uInt16 nIndex = 1;
+ const String sTmpName(m_sTableName);
+ String sTmpNameIndex(sTmpName);
+ while(pDoc->FindTblFmtByName( sTmpNameIndex, sal_True ) && nIndex < USHRT_MAX)
+ {
+ sTmpNameIndex = sTmpName;
+ sTmpNameIndex += nIndex++;
+ }
+ pDoc->SetTableName( *pTblFmt, sTmpNameIndex);
+ }
+
+ const::uno::Any* pName;
+ if(pTableProps->GetProperty(FN_UNO_TABLE_NAME, 0, pName))
+ {
+ OUString sTmp;
+ (*pName) >>= sTmp;
+ setName(sTmp);
+ }
+ bIsDescriptor = sal_False;
+ DELETEZ(pTableProps);
+ }
+ pDoc->EndUndo( UNDO_END, NULL );
+ }
+
+ }
+ else
+ throw lang::IllegalArgumentException();
+}
+/*-- 11.12.98 12:42:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ attachToRange( xTextRange );
+}
+/*-- 11.12.98 12:42:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextTable::getAnchor(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(!pFmt)
+ throw uno::RuntimeException();
+ uno::Reference< text::XTextRange > xRet = new SwXTextRange(*pFmt);
+ return xRet;
+}
+/*-- 11.12.98 12:42:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::dispose(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableSortBoxes& rBoxes = pTable->GetTabSortBoxes();
+ SwSelBoxes aSelBoxes;
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
+ pFmt->GetDoc()->DeleteRowCol(aSelBoxes);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 12:42:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 11.12.98 12:42:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 12:42:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCell > SwXTextTable::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCell > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ // Sheet interessiert nicht
+ if(nColumn >= 0 && nRow >= 0 && nColumn < USHRT_MAX && nRow < USHRT_MAX && pFmt)
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt, nColumn, nRow);
+ if(pXCell)
+ aRef = pXCell;
+ }
+ if(!aRef.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRef;
+
+}
+/* -----------------11.12.98 13:26-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< table::XCellRange > SwXTextTable::GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
+ const String& rTLName, const String& rBRName,
+ SwRangeDescriptor& rDesc)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCellRange > aRef;
+ String sTLName(rTLName);
+ String sBRName(rBRName);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
+ if(pBRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+ // pUnoCrsr wird uebergeben und nicht geloescht
+ SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, rDesc);
+ aRef = pCellRange;
+ }
+ else
+ delete pUnoCrsr;
+ }
+ return aRef;
+}
+/*-- 11.12.98 12:42:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCellRange > SwXTextTable::getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop,
+ sal_Int32 nRight, sal_Int32 nBottom)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCellRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt && nRight < USHRT_MAX && nBottom < USHRT_MAX &&
+ nLeft <= nRight && nTop <= nBottom &&
+ nLeft >= 0 && nRight >= 0 && nTop >= 0 && nBottom >= 0 )
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aDesc;
+ aDesc.nTop = nTop;
+ aDesc.nBottom = nBottom;
+ aDesc.nLeft = nLeft;
+ aDesc.nRight = nRight;
+ String sTLName = lcl_GetCellName(aDesc.nLeft, aDesc.nTop);
+ String sBRName = lcl_GetCellName(aDesc.nRight, aDesc.nBottom);
+
+ // please note that according to the 'if' statement at the begin
+ // sTLName:sBRName already denotes the normalized range string
+
+ aRef = GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
+ }
+ }
+ if(!aRef.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRef;
+}
+/*-- 11.12.98 12:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCellRange > SwXTextTable::getCellRangeByName(const OUString& aRange)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCellRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sRange(aRange);
+ String sTLName(sRange.GetToken(0, ':'));
+ String sBRName(sRange.GetToken(1, ':'));
+ if(!sTLName.Len() || !sBRName.Len())
+ throw uno::RuntimeException();
+ SwRangeDescriptor aDesc;
+ aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
+ lcl_GetCellPosition(sTLName, aDesc.nLeft, aDesc.nTop );
+ lcl_GetCellPosition(sBRName, aDesc.nRight, aDesc.nBottom );
+
+ // we should normalize the range now (e.g. A5:C1 will become A1:C5)
+ // since (depending on what is done later) it will be troublesome
+ // elsewhere when the cursor in the implementation does not
+ // point to the top-left and bottom-right cells
+ aDesc.Normalize();
+
+ aRef = GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
+ }
+ }
+ if(!aRef.is())
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 29.04.02 11:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray()
+ throw (uno::RuntimeException)
+{
+ // see SwXTextTable::getData(...) also
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
+ if(pFmt)
+ {
+ uno::Sequence< uno::Any > * pRowArray = aRowSeq.getArray();
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< uno::Any > aColSeq(nColCount);
+ uno::Any * pColArray = aColSeq.getArray();
+ uno::Reference< table::XCell > xCellRef;
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ // check if table box value item is set
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ BOOL bIsNum = pBoxFmt->GetItemState( RES_BOXATR_VALUE, FALSE ) == SFX_ITEM_SET;
+ //const SfxPoolItem* pItem;
+ //SwDoc* pDoc = pXCell->GetDoc();
+ //BOOL bIsText = (SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
+ // || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
+ // || ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT);
+
+ if(!bIsNum/*bIsText*/)
+ pColArray[nCol] <<= lcl_getString(*pXCell);
+ else
+ pColArray[nCol] <<= lcl_getValue(*pXCell);
+ }
+ }
+ pRowArray[nRow] = aColSeq;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRowSeq;
+}
+/*-- 29.04.02 11:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextTable::setDataArray(
+ const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
+ throw (uno::RuntimeException)
+{
+ // see SwXTextTable::setData(...) also
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(pTable->IsTblComplex())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+
+ if(rArray.getLength() != nRowCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Sequence< uno::Any >* pRowArray = rArray.getConstArray();
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< uno::Any >& rColSeq = pRowArray[nRow];
+ if(rColSeq.getLength() != nColCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Any * pColArray = rColSeq.getConstArray();
+ uno::Reference< table::XCell > xCellRef;
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ const uno::Any &rAny = pColArray[nCol];
+ if (uno::TypeClass_STRING == rAny.getValueTypeClass())
+ lcl_setString( *pXCell, *(rtl::OUString *) rAny.getValue() );
+ else
+ {
+ double d = 0;
+ // #i20067# don't throw exception just do nothing if
+ // there is no value set
+ if( (rAny >>= d) )
+ lcl_setValue( *pXCell, d );
+ else
+ lcl_setString( *pXCell, OUString(), TRUE );
+
+ }
+ }
+ }
+ }
+ }
+}
+/*-- 11.12.98 12:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ //
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
+ if(pFmt)
+ {
+ uno::Sequence< double >* pArray = aRowSeq.getArray();
+
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< double > aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
+ double* pColArray = aColSeq.getArray();
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ pColArray[nCol - nColStart] = xCell->getValue();
+ }
+ pArray[nRow - nRowStart] = aColSeq;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRowSeq;
+}
+/*-- 11.12.98 12:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ sal_Bool bChanged = sal_False;
+
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt )
+ {
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ if(rData.getLength() < nRowCount - nRowStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Sequence< double >* pRowArray = rData.getConstArray();
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ if(rColSeq.getLength() < nColCount - nColStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const double * pColArray = rColSeq.getConstArray();
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ xCell->setValue(pColArray[nCol - nColStart]);
+ bChanged=sal_True;
+ }
+ }
+ if ( bChanged )
+ aChartLstnrCntnr.ChartDataChanged();
+ }
+}
+/*-- 11.12.98 12:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ //exception ...
+ break;
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 12:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount || rRowDesc.getLength() < (bFirstRowAsLabel ? nRowCount - 1 : nRowCount))
+ {
+ throw uno::RuntimeException();
+ }
+ const OUString* pArray = rRowDesc.getConstArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wohin mit den Labels?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 12:42:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTable::getColumnDescriptions(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nColCount = getColumnCount();
+ if(!nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstRowAsLabel ? nColCount - 1 : nColCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstRowAsLabel)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 12:42:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColumnDesc) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nColCount = getColumnCount();
+ if(!nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const OUString* pArray = rColumnDesc.getConstArray();
+ if(bFirstRowAsLabel && rColumnDesc.getLength() >= nColCount - bFirstColumnAsLabel ? 1 : 0)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 12:42:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::addChartDataChangeEventListener(
+ const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aChartLstnrCntnr.AddListener(aListener.get());
+}
+/*-- 11.12.98 12:42:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::removeChartDataChangeEventListener(
+ const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
+ throw uno::RuntimeException();
+}
+/* -----------------08.03.99 15:33-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextTable::isNotANumber(double nNumber) throw( uno::RuntimeException )
+{
+ // We use DBL_MIN because starcalc does (which uses it because chart
+ // wants it that way!)
+ return ( nNumber == DBL_MIN );
+}
+/* -----------------08.03.99 15:34-------------------
+ *
+ * --------------------------------------------------*/
+double SwXTextTable::getNotANumber(void) throw( uno::RuntimeException )
+{
+ // We use DBL_MIN because starcalc does (which uses it because chart
+ // wants it that way!)
+ return DBL_MIN;
+}
+/*-- 11.12.98 12:42:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXTextTable::createSortDescriptor(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return SwUnoCursorHelper::CreateSortDescriptor(true);
+}
+/*-- 11.12.98 12:42:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwSortOptions aSortOpt;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt &&
+ SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwSelBoxes aBoxes;
+ const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
+ for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
+ }
+ UnoActionContext aContext( pFmt->GetDoc() );
+ pFmt->GetDoc()->SortTbl(aBoxes, aSortOpt);
+ }
+}
+/*-- 11.12.98 12:42:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+
+ String sAutoFmtName(aName);
+ SwTableAutoFmtTbl aAutoFmtTbl;
+ aAutoFmtTbl.Load();
+ for( sal_uInt16 i = aAutoFmtTbl.Count(); i; )
+ if( sAutoFmtName == aAutoFmtTbl[ --i ]->GetName() )
+ {
+ SwSelBoxes aBoxes;
+ const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
+ for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
+ }
+ UnoActionContext aContext( pFmt->GetDoc() );
+ pFmt->GetDoc()->SetTableAutoFmt( aBoxes, *aAutoFmtTbl[i] );
+ break;
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 12:42:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextTable::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 12:42:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(!aValue.hasValue())
+ throw lang::IllegalArgumentException();
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if( !pEntry )
+ throw lang::IllegalArgumentException();
+ if(pFmt)
+ {
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(0xFF == pEntry->nMemberId)
+ {
+ lcl_SetSpecialProperty(pFmt, pEntry, aValue);
+ }
+ else
+ {
+ switch(pEntry->nWID)
+ {
+ case UNO_NAME_TABLE_NAME :
+ {
+ ::rtl::OUString sName;
+ aValue >>= sName;
+ setName( sName );
+ }
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstRowAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstRowAsLabel = bTmp;
+ }
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstColumnAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstColumnAsLabel = bTmp;
+ }
+ }
+ break;
+ case FN_UNO_TABLE_BORDER:
+ {
+ const table::TableBorder* pBorder =
+ (const table::TableBorder* )aValue.getValue();
+ if(aValue.getValueType() == ::getCppuType((const table::TableBorder* )0)
+ && pBorder)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwClientIter aIter( *pFmt );
+ //Tabellen ohne Layout (unsichtbare Header/Footer )
+ if(0 != aIter.First( TYPE( SwFrm )))
+ {
+ lcl_FormatTable(pFmt);
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLines &rLines = pTable->GetTabLines();
+
+
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pDoc);
+ const SwTableBox* pTLBox = lcl_FindCornerTableBox(rLines, true);
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+
+
+
+ const SwTableBox* pBRBox = lcl_FindCornerTableBox(rLines, false);
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+
+ SvxBoxItem aBox( RES_BOX );
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ SvxBorderLine aLine;
+
+ sal_Bool bSet = lcl_LineToSvxLine(pBorder->TopLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP);
+ aBoxInfo.SetValid(VALID_TOP, pBorder->IsTopLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->BottomLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM);
+ aBoxInfo.SetValid(VALID_BOTTOM, pBorder->IsBottomLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->LeftLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT);
+ aBoxInfo.SetValid(VALID_LEFT, pBorder->IsLeftLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->RightLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT);
+ aBoxInfo.SetValid(VALID_RIGHT, pBorder->IsRightLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->HorizontalLine, aLine);
+ aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI);
+ aBoxInfo.SetValid(VALID_HORI, pBorder->IsHorizontalLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->VerticalLine, aLine);
+ aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT);
+ aBoxInfo.SetValid(VALID_VERT, pBorder->IsVerticalLineValid);
+
+ aBox.SetDistance((sal_uInt16)MM100_TO_TWIP(pBorder->Distance));
+ aBoxInfo.SetValid(VALID_DISTANCE, pBorder->IsDistanceValid);
+
+ aSet.Put(aBox);
+ aSet.Put(aBoxInfo);
+
+ pDoc->SetTabBorders(*pCrsr, aSet);
+ delete pUnoCrsr;
+ }
+ }
+ }
+ break;
+ case FN_UNO_TABLE_BORDER_DISTANCES:
+ {
+ table::TableBorderDistances aTableBorderDistances;
+ if( !(aValue >>= aTableBorderDistances) ||
+ (!aTableBorderDistances.IsLeftDistanceValid &&
+ !aTableBorderDistances.IsRightDistanceValid &&
+ !aTableBorderDistances.IsTopDistanceValid &&
+ !aTableBorderDistances.IsBottomDistanceValid ))
+ break;
+
+ USHORT nLeftDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.LeftDistance);
+ USHORT nRightDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.RightDistance);
+ USHORT nTopDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.TopDistance);
+ USHORT nBottomDistance = MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.BottomDistance);
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLines &rLines = pTable->GetTabLines();
+ pDoc->StartUndo(UNDO_START, NULL);
+ for(sal_uInt16 i = 0; i < rLines.Count(); i++)
+ {
+ SwTableLine* pLine = rLines.GetObject(i);
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for(sal_uInt16 k = 0; k < rBoxes.Count(); k++)
+ {
+ SwTableBox* pBox = rBoxes.GetObject(k);
+ const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ const SvxBoxItem& rBox = pBoxFmt->GetBox();
+ if(
+ aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( BOX_LINE_LEFT ) ||
+ aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( BOX_LINE_RIGHT ) ||
+ aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( BOX_LINE_TOP ) ||
+ aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM ))
+ {
+ SvxBoxItem aSetBox( rBox );
+ SwFrmFmt* pSetBoxFmt = pBox->ClaimFrmFmt();
+ if( aTableBorderDistances.IsLeftDistanceValid )
+ aSetBox.SetDistance( nLeftDistance, BOX_LINE_LEFT );
+ if( aTableBorderDistances.IsRightDistanceValid )
+ aSetBox.SetDistance( nRightDistance, BOX_LINE_RIGHT );
+ if( aTableBorderDistances.IsTopDistanceValid )
+ aSetBox.SetDistance( nTopDistance, BOX_LINE_TOP );
+ if( aTableBorderDistances.IsBottomDistanceValid )
+ aSetBox.SetDistance( nBottomDistance, BOX_LINE_BOTTOM );
+ pDoc->SetAttr( aSetBox, *pSetBoxFmt );
+ }
+ }
+ }
+ pDoc->EndUndo(UNDO_END, NULL);
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ UnoActionContext aContext(pFmt->GetDoc());
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ lcl_SetTblSeparators(aValue, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False, pFmt->GetDoc());
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:/*_readonly_*/ break;
+ default:
+ {
+ SwAttrSet aSet(pFmt->GetAttrSet());
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
+ pFmt->GetDoc()->SetAttr(aSet, *pFmt);
+ }
+ }
+ }
+ }
+ else if(bIsDescriptor)
+ {
+ String aPropertyName(rPropertyName);
+ pTableProps->SetProperty( pEntry->nWID, pEntry->nMemberId, aValue);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 12:42:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pFmt)
+ {
+ if (!pEntry)
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(0xFF == pEntry->nMemberId)
+ {
+ aRet = lcl_GetSpecialProperty(pFmt, pEntry );
+ }
+ else
+ {
+ switch(pEntry->nWID)
+ {
+ case UNO_NAME_TABLE_NAME:
+ {
+ aRet <<= getName();
+ }
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ ::sw::GetDefaultTextContentValue(
+ aRet, OUString(), pEntry->nWID);
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTemp = bFirstRowAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTemp = bFirstColumnAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_TABLE_BORDER:
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwClientIter aIter( *pFmt );
+ //Tabellen ohne Layout (unsichtbare Header/Footer )
+ if(0 != aIter.First( TYPE( SwFrm )))
+ {
+ lcl_FormatTable(pFmt);
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLines &rLines = pTable->GetTabLines();
+
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pDoc);
+ const SwTableBox* pTLBox = lcl_FindCornerTableBox(rLines, true);
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+
+ const SwTableBox* pBRBox = lcl_FindCornerTableBox(rLines, false);
+ pUnoCrsr->SetMark();
+ const SwStartNode* pLastNd = pBRBox->GetSttNd();
+ pUnoCrsr->GetPoint()->nNode = *pLastNd;
+
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ aSet.Put(SvxBoxInfoItem( SID_ATTR_BORDER_INNER ));
+ pDoc->GetTabBorders(*pCrsr, aSet);
+ const SvxBoxInfoItem& rBoxInfoItem = (const SvxBoxInfoItem&)aSet.Get(SID_ATTR_BORDER_INNER);
+ const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX);
+
+ table::TableBorder aTableBorder;
+ aTableBorder.TopLine = lcl_SvxLineToLine(rBox.GetTop());
+ aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(VALID_TOP);
+ aTableBorder.BottomLine = lcl_SvxLineToLine(rBox.GetBottom());
+ aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(VALID_BOTTOM);
+ aTableBorder.LeftLine = lcl_SvxLineToLine(rBox.GetLeft());
+ aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(VALID_LEFT);
+ aTableBorder.RightLine = lcl_SvxLineToLine(rBox.GetRight());
+ aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(VALID_RIGHT );
+ aTableBorder.HorizontalLine = lcl_SvxLineToLine(rBoxInfoItem.GetHori());
+ aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI);
+ aTableBorder.VerticalLine = lcl_SvxLineToLine(rBoxInfoItem.GetVert());
+ aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT);
+ aTableBorder.Distance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() );
+ aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE);
+ aRet.setValue(&aTableBorder, ::getCppuType((const table::TableBorder*)0));
+ delete pUnoCrsr;
+ }
+ }
+ break;
+ case FN_UNO_TABLE_BORDER_DISTANCES :
+ {
+ table::TableBorderDistances aTableBorderDistances( 0, sal_True, 0, sal_True, 0, sal_True, 0, sal_True ) ;
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ const SwTableLines &rLines = pTable->GetTabLines();
+ bool bFirst = true;
+ USHORT nLeftDistance = 0;
+ USHORT nRightDistance = 0;
+ USHORT nTopDistance = 0;
+ USHORT nBottomDistance = 0;
+
+ for(sal_uInt16 i = 0; i < rLines.Count(); i++)
+ {
+ const SwTableLine* pLine = rLines.GetObject(i);
+ const SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for(sal_uInt16 k = 0; k < rBoxes.Count(); k++)
+ {
+ const SwTableBox* pBox = rBoxes.GetObject(k);
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ const SvxBoxItem& rBox = pBoxFmt->GetBox();
+ if( bFirst )
+ {
+ nLeftDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_LEFT ));
+ nRightDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_RIGHT ));
+ nTopDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_TOP ));
+ nBottomDistance = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_BOTTOM ));
+ bFirst = false;
+ }
+ else
+ {
+ if( aTableBorderDistances.IsLeftDistanceValid &&
+ nLeftDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_LEFT )))
+ aTableBorderDistances.IsLeftDistanceValid = sal_False;
+ if( aTableBorderDistances.IsRightDistanceValid &&
+ nRightDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_RIGHT )))
+ aTableBorderDistances.IsRightDistanceValid = sal_False;
+ if( aTableBorderDistances.IsTopDistanceValid &&
+ nTopDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_TOP )))
+ aTableBorderDistances.IsTopDistanceValid = sal_False;
+ if( aTableBorderDistances.IsBottomDistanceValid &&
+ nBottomDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_BOTTOM )))
+ aTableBorderDistances.IsBottomDistanceValid = sal_False;
+ }
+
+ }
+ if( !aTableBorderDistances.IsLeftDistanceValid &&
+ !aTableBorderDistances.IsRightDistanceValid &&
+ !aTableBorderDistances.IsTopDistanceValid &&
+ !aTableBorderDistances.IsBottomDistanceValid )
+ break;
+ }
+ if( aTableBorderDistances.IsLeftDistanceValid)
+ aTableBorderDistances.LeftDistance = nLeftDistance;
+ if( aTableBorderDistances.IsRightDistanceValid)
+ aTableBorderDistances.RightDistance = nRightDistance;
+ if( aTableBorderDistances.IsTopDistanceValid)
+ aTableBorderDistances.TopDistance = nTopDistance;
+ if( aTableBorderDistances.IsBottomDistanceValid)
+ aTableBorderDistances.BottomDistance = nBottomDistance;
+
+ aRet <<= aTableBorderDistances;
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ lcl_GetTblSeparators(aRet, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False);
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:
+ aRet <<= (INT16) UNO_TABLE_COLUMN_SUM;
+ break;
+ case RES_ANCHOR:
+ //AnchorType ist readonly und maybevoid und wird nicht geliefert
+ break;
+ case FN_UNO_TEXT_SECTION:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+ SwSectionNode* pSectionNode = pTblNode->FindSectionNode();
+ if(pSectionNode)
+ {
+ const SwSection& rSect = pSectionNode->GetSection();
+ uno::Reference< text::XTextSection > xSect =
+ SwXTextSections::GetObject( *rSect.GetFmt() );
+ aRet <<= xSect;
+ }
+ }
+ break;
+ default:
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
+ }
+ }
+ }
+ }
+ else if(bIsDescriptor)
+ {
+ const uno::Any* pAny = 0;
+ String aPropertyName(rPropertyName);
+ if(!pTableProps->GetProperty(pEntry->nWID, pEntry->nMemberId, pAny))
+ throw lang::IllegalArgumentException();
+ else if(pAny)
+ aRet = *pAny;
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 12:42:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:42:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:42:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:42:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 12:42:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextTable::getName(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ String sRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(!pFmt && !bIsDescriptor)
+ throw uno::RuntimeException();
+ if(pFmt)
+ {
+ sRet = pFmt->GetName();
+ }
+ else
+ sRet = m_sTableName;
+ return sRet;
+}
+/*-- 11.12.98 12:42:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ String sNewTblName(rName);
+ if(!pFmt && !bIsDescriptor ||
+ !sNewTblName.Len() ||
+ STRING_NOTFOUND != sNewTblName.Search('.') ||
+ STRING_NOTFOUND != sNewTblName.Search(' ') )
+ throw uno::RuntimeException();
+
+ if(pFmt)
+ {
+ const String aOldName( pFmt->GetName() );
+ sal_Bool bNameFound = sal_False;
+ SwFrmFmt* pTmpFmt;
+ const SwFrmFmts* pTbl = pFmt->GetDoc()->GetTblFrmFmts();
+ for( sal_uInt16 i = pTbl->Count(); i; )
+ if( !( pTmpFmt = (*pTbl)[ --i ] )->IsDefault() &&
+ pTmpFmt->GetName() == sNewTblName &&
+ pFmt->GetDoc()->IsUsed( *pTmpFmt ))
+ {
+ bNameFound = sal_True;
+ break;
+ }
+
+ if(bNameFound)
+ {
+ throw uno::RuntimeException();
+ }
+ pFmt->SetName( sNewTblName );
+
+
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *pFmt->GetDoc()->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ SwNode *pNd = pFmt->GetDoc()->GetNodes()[aIdx];
+ if ( pNd->IsOLENode() &&
+ aOldName == ((SwOLENode*)pNd)->GetChartTblName() )
+ {
+ ((SwOLENode*)pNd)->SetChartTblName( sNewTblName );
+
+ ((SwOLENode*)pNd)->GetOLEObj();
+
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ //TL_CHART2: chart needs to be notfied about name changes
+ pFmt->GetDoc()->UpdateCharts( pTable->GetFrmFmt()->GetName() );
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+ pFmt->GetDoc()->SetModified();
+ }
+ else
+ m_sTableName = sNewTblName;
+}
+/*-----------------11.02.98 09:58-------------------
+
+--------------------------------------------------*/
+sal_uInt16 SwXTextTable::getRowCount(void)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRet = 0;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ nRet = pTable->GetTabLines().Count();
+ }
+ }
+ return nRet;
+}
+/*-----------------11.02.98 09:58-------------------
+
+--------------------------------------------------*/
+sal_uInt16 SwXTextTable::getColumnCount(void)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ sal_Int16 nRet = 0;
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ nRet = pLine->GetTabBoxes().Count();
+ }
+ }
+ return nRet;
+}
+/*-- 11.12.98 12:42:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextTable::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ if(pOld && pOld->Which() == RES_REMOVE_UNO_OBJECT &&
+ (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ else
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ aLstnrCntnr.Disposing();
+ aChartLstnrCntnr.Disposing();
+ }
+ else
+ aChartLstnrCntnr.ChartDataChanged();
+}
+/* -----------------25.10.99 15:12-------------------
+
+ --------------------------------------------------*/
+OUString SAL_CALL SwXTextTable::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextTable");
+}
+/* -----------------25.10.99 15:12-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextTable::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return (sServiceName.EqualsAscii("com.sun.star.document.LinkTarget") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextTable") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextContent") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextSortable"));
+}
+/* -----------------25.10.99 15:12-------------------
+
+ --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextTable::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(4);
+ OUString* pArr = aRet.getArray();
+ pArr[0] = C2U("com.sun.star.document.LinkTarget");
+ pArr[1] = C2U("com.sun.star.text.TextTable");
+ pArr[2] = C2U("com.sun.star.text.TextContent");
+ pArr[2] = C2U("com.sun.star.text.TextSortable");
+ return aRet;
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
+ }
+ return 0;
+}
+/* -----------------28.04.98 10:29-------------------
+ *
+ * --------------------------------------------------*/
+TYPEINIT1(SwXCellRange, SwClient);
+/* -----------------------------19.04.00 15:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXCellRange::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXCellRange");
+}
+/* -----------------------------19.04.00 15:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXCellRange::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.text.CellRange" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.CharacterProperties" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.CharacterPropertiesAsian" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.CharacterPropertiesComplex") ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.ParagraphProperties" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.ParagraphPropertiesAsian" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.ParagraphPropertiesComplex" ) );
+}
+/* -----------------------------19.04.00 15:21--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXCellRange::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(7);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.CellRange");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+
+/*-- 11.12.98 14:27:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXCellRange::SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt,
+ SwRangeDescriptor& rDesc)
+ :
+ SwClient(&rFrmFmt),
+ aCursorDepend(this, pCrsr),
+ aChartLstnrCntnr((cppu::OWeakObject*)this),
+ aRgDesc(rDesc),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_RANGE)),
+ pTblCrsr(pCrsr),
+ bFirstRowAsLabel(sal_False),
+ bFirstColumnAsLabel(sal_False)
+{
+ aRgDesc.Normalize();
+}
+/*-- 11.12.98 14:27:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXCellRange::~SwXCellRange()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ delete pTblCrsr;
+}
+/*-- 11.12.98 14:27:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCell > SwXCellRange::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCell > aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ if(nColumn >= 0 && nRow >= 0 &&
+ getColumnCount() > nColumn && getRowCount() > nRow )
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt,
+ aRgDesc.nLeft + nColumn, aRgDesc.nTop + nRow);
+ if(pXCell)
+ aRet = pXCell;
+ }
+ }
+ if(!aRet.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRet;
+}
+/*-- 11.12.98 14:27:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByPosition(
+ sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< table::XCellRange > aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt && getColumnCount() > nRight && getRowCount() > nBottom &&
+ nLeft <= nRight && nTop <= nBottom
+ && nLeft >= 0 && nRight >= 0 && nTop >= 0 && nBottom >= 0 )
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aNewDesc;
+ aNewDesc.nTop = nTop + aRgDesc.nTop;
+ aNewDesc.nBottom = nBottom + aRgDesc.nTop;
+ aNewDesc.nLeft = nLeft + aRgDesc.nLeft;
+ aNewDesc.nRight = nRight + aRgDesc.nLeft;
+ aNewDesc.Normalize();
+ String sTLName = lcl_GetCellName(aNewDesc.nLeft, aNewDesc.nTop);
+ String sBRName = lcl_GetCellName(aNewDesc.nRight, aNewDesc.nBottom);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ // hier muessen die Actions aufgehoben
+ UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
+ if(pBRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+ // pUnoCrsr wird uebergeben und nicht geloescht
+ SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, aNewDesc);
+ aRet = pCellRange;
+ }
+ else
+ delete pUnoCrsr;
+ }
+ }
+ }
+ if(!aRet.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRet;
+
+}
+/*-- 11.12.98 14:27:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByName(const OUString& rRange)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ String sRange(rRange);
+ String sTLName(sRange.GetToken(0, ':'));
+ String sBRName(sRange.GetToken(1, ':'));
+ if(!sTLName.Len() || !sBRName.Len())
+ throw uno::RuntimeException();
+ SwRangeDescriptor aDesc;
+ aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
+ lcl_GetCellPosition( sTLName, aDesc.nLeft, aDesc.nTop );
+ lcl_GetCellPosition( sBRName, aDesc.nRight, aDesc.nBottom );
+ aDesc.Normalize();
+ return getCellRangeByPosition(aDesc.nLeft - aRgDesc.nLeft, aDesc.nTop - aRgDesc.nTop,
+ aDesc.nRight - aRgDesc.nLeft, aDesc.nBottom - aRgDesc.nTop);
+}
+/*-- 11.12.98 14:27:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXCellRange::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 14:27:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue) throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ /* ASK OLIVER
+ lcl_FormatTable(pFmt);*/
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pEntry)
+ {
+ if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwDoc* pDoc = pTblCrsr->GetDoc();
+ {
+ // remove actions to enable box selection
+ UnoActionRemoveContext aRemoveContext(pDoc);
+ }
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ pCrsr->MakeBoxSels();
+ switch(pEntry->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ pDoc->GetBoxAttr( *pTblCrsr, aBrush );
+ ((SfxPoolItem&)aBrush).PutValue(aValue, pEntry->nMemberId);
+ pDoc->SetBoxAttr( *pTblCrsr, aBrush );
+
+ }
+ break;
+ case RES_BOX :
+ {
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aBoxInfo.SetValid(0xff, FALSE);
+ BYTE nValid = 0;
+ switch(pEntry->nMemberId & ~CONVERT_TWIPS)
+ {
+ case LEFT_BORDER : nValid = VALID_LEFT; break;
+ case RIGHT_BORDER: nValid = VALID_RIGHT; break;
+ case TOP_BORDER : nValid = VALID_TOP; break;
+ case BOTTOM_BORDER: nValid = VALID_BOTTOM; break;
+ case LEFT_BORDER_DISTANCE :
+ case RIGHT_BORDER_DISTANCE:
+ case TOP_BORDER_DISTANCE :
+ case BOTTOM_BORDER_DISTANCE:
+ nValid = VALID_DISTANCE;
+ break;
+ }
+ aBoxInfo.SetValid(nValid, TRUE);
+
+
+ aSet.Put(aBoxInfo);
+ pDoc->GetTabBorders(*pCrsr, aSet);
+
+ aSet.Put(aBoxInfo);
+ SvxBoxItem aBoxItem((const SvxBoxItem&)aSet.Get(RES_BOX));
+ ((SfxPoolItem&)aBoxItem).PutValue(aValue, pEntry->nMemberId);
+ aSet.Put(aBoxItem);
+ pDoc->SetTabBorders( *pTblCrsr, aSet );
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ {
+ SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
+ ((SfxPoolItem&)aNumberFormat).PutValue(aValue, 0);
+ pDoc->SetBoxAttr( *pCrsr, aNumberFormat);
+ }
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstRowAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstRowAsLabel = bTmp;
+ }
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstColumnAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstColumnAsLabel = bTmp;
+ }
+ }
+ break;
+ default:
+ {
+ SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
+ SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(),
+ aItemSet);
+
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, aValue, pCrsr->GetSelRing(), aItemSet))
+ {
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
+ }
+ SwUnoCursorHelper::SetCrsrAttr(pCrsr->GetSelRing(),
+ aItemSet, nsSetAttrMode::SETATTR_DEFAULT, true);
+ }
+ }
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+}
+/*-- 11.12.98 14:27:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ /* ASK OLIVER
+ lcl_FormatTable(pFmt);*/
+ const SfxItemPropertySimpleEntry* pEntry =
+ m_pPropSet->getPropertyMap()->getByName(rPropertyName);
+ if(pEntry)
+ {
+ switch(pEntry->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ if(pTblCrsr->GetDoc()->GetBoxAttr( *pTblCrsr, aBrush ))
+ aBrush.QueryValue(aRet, pEntry->nMemberId);
+
+ }
+ break;
+ case RES_BOX :
+ {
+ SwDoc* pDoc = pTblCrsr->GetDoc();
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ aSet.Put(SvxBoxInfoItem( SID_ATTR_BORDER_INNER ));
+ pDoc->GetTabBorders(*pTblCrsr, aSet);
+ const SvxBoxItem& rBoxItem = ((const SvxBoxItem&)aSet.Get(RES_BOX));
+ rBoxItem.QueryValue(aRet, pEntry->nMemberId);
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ //GetAttr fuer Tabellenselektion am Doc fehlt noch
+ DBG_WARNING("not implemented");
+ break;
+ case FN_UNO_PARA_STYLE:
+ {
+ SwFmtColl *const pTmpFmt =
+ SwUnoCursorHelper::GetCurTxtFmtColl(*pTblCrsr, FALSE);
+ OUString sRet;
+ if(pFmt)
+ sRet = pTmpFmt->GetName();
+ aRet <<= sRet;
+ }
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTemp = bFirstRowAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTemp = bFirstColumnAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ default:
+ {
+ SfxItemSet aSet(pTblCrsr->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END -1,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+ // erstmal die Attribute des Cursors
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
+ m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
+ }
+ }
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ return aRet;
+}
+/*-- 11.12.98 14:27:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 14:27:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 14:27:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 14:27:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/*-----------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+void SwXCellRange::GetDataSequence(
+ uno::Sequence< uno::Any > *pAnySeq, //-> first pointer != 0 is used
+ uno::Sequence< OUString > *pTxtSeq, //-> as output sequence
+ uno::Sequence< double > *pDblSeq, //-> (previous data gets overwritten)
+ sal_Bool bForceNumberResults ) //-> when 'true' requires to make an
+ // extra effort to return a value different
+ // from 0 even if the cell is formatted to text
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // compare to SwXCellRange::getDataArray (note different return types though)
+
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ //
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+
+ sal_Int32 nSize = nRowCount * nColCount;
+ if (pAnySeq)
+ pAnySeq->realloc( nSize );
+ else if (pTxtSeq)
+ pTxtSeq->realloc( nSize );
+ else if (pDblSeq)
+ pDblSeq->realloc( nSize );
+ else
+ {
+ DBG_ERROR( "argument missing" );
+ return;
+ }
+ uno::Any *pAnyData = pAnySeq ? pAnySeq->getArray() : 0;
+ OUString *pTxtData = pTxtSeq ? pTxtSeq->getArray() : 0;
+ double *pDblData = pDblSeq ? pDblSeq->getArray() : 0;
+
+ sal_Int32 nDtaCnt = 0;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ double fNan;
+ ::rtl::math::setNan( & fNan );
+
+ uno::Reference< table::XCell > xCellRef;
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell * pXCell = lcl_CreateXCell(pFmt,
+ aRgDesc.nLeft + nCol,
+ aRgDesc.nTop + nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ if (pAnyData)
+ {
+ // check if table box value item is set
+ BOOL bIsNum = pBox->GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, FALSE ) == SFX_ITEM_SET;
+ //ULONG nNdPos = pBox->IsValidNumTxtNd( sal_True );
+ if (!bIsNum/* && ULONG_MAX == nNdPos*/)
+ pAnyData[nDtaCnt++] <<= lcl_getString(*pXCell);
+ else
+ pAnyData[nDtaCnt++] <<= lcl_getValue(*pXCell);
+ }
+ else if (pTxtData)
+ pTxtData[nDtaCnt++] = lcl_getString(*pXCell);
+ else if (pDblData)
+ {
+ double fVal = fNan;
+ if (!bForceNumberResults || table::CellContentType_TEXT != pXCell->getType())
+ fVal = lcl_getValue(*pXCell);
+ else
+ {
+ DBG_ASSERT( table::CellContentType_TEXT == pXCell->getType(),
+ "this branch of 'if' is only for text formatted cells" );
+
+ // now we'll try to get a useful numerical value
+ // from the text in the cell...
+
+ sal_uInt32 nFIndex;
+ SvNumberFormatter* pNumFormatter = pTblCrsr->GetDoc()->GetNumberFormatter();
+
+ // look for SwTblBoxNumFormat value in parents as well
+ const SfxPoolItem* pItem;
+ SwFrmFmt *pBoxFmt = pXCell->GetTblBox()->GetFrmFmt();
+ SfxItemState eState = pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem);
+
+ if (eState == SFX_ITEM_SET)
+ {
+ // please note that the language of the numberformat
+ // is implicitly coded into the below value as well
+ nFIndex = ((SwTblBoxNumFormat*)pItem)->GetValue();
+
+ // since the current value indicates a text format but the call
+ // to 'IsNumberFormat' below won't work for text formats
+ // we need to get rid of the part that indicates the text format.
+ // According to ER this can be done like this:
+ nFIndex -= (nFIndex % SV_COUNTRY_LANGUAGE_OFFSET);
+ }
+ else
+ {
+ // system language is probably not the best possible choice
+ // but since we have to guess anyway (because the language of at
+ // the text is NOT the one used for the number format!)
+ // it is at least conform to to what is used in
+ // SwTableShell::Execute when
+ // SID_ATTR_NUMBERFORMAT_VALUE is set...
+ LanguageType eLang = LANGUAGE_SYSTEM;
+ nFIndex = pNumFormatter->GetStandardIndex( eLang );
+ }
+
+ OUString aTxt( lcl_getString(*pXCell) );
+ double fTmp;
+ if (pNumFormatter->IsNumberFormat( aTxt, nFIndex, fTmp ))
+ fVal = fTmp;
+ }
+ pDblData[nDtaCnt++] = fVal;
+ }
+ else {
+ DBG_ERROR( "output sequence missing" );
+ }
+ }
+ }
+ }
+ }
+ DBG_ASSERT( nDtaCnt == nSize, "size mismatch. Invalid cell range?" );
+ if (pAnySeq)
+ pAnySeq->realloc( nDtaCnt );
+ else if (pTxtSeq)
+ pTxtSeq->realloc( nDtaCnt );
+ else if (pDblSeq)
+ pDblSeq->realloc( nDtaCnt );
+}
+
+/*-- 29.04.02 11:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
+ throw (uno::RuntimeException)
+{
+ // see SwXCellRange::getData also
+ // also see SwXCellRange::GetDataSequence
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ //
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ uno::Sequence< uno::Any >* pRowArray = aRowSeq.getArray();
+ uno::Reference< table::XCell > xCellRef;
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< uno::Any > aColSeq(nColCount);
+ uno::Any * pColArray = aColSeq.getArray();
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell * pXCell = lcl_CreateXCell(pFmt,
+ aRgDesc.nLeft + nCol,
+ aRgDesc.nTop + nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ // check if table box value item is set
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ BOOL bIsNum = pBoxFmt->GetItemState( RES_BOXATR_VALUE, FALSE ) == SFX_ITEM_SET;
+ //const SfxPoolItem* pItem;
+ //SwDoc* pDoc = pXCell->GetDoc();
+ //BOOL bIsText = (SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
+ // || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
+ // || ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT);
+
+ if(!bIsNum/*bIsText*/)
+ pColArray[nCol] <<= lcl_getString(*pXCell);
+ else
+ pColArray[nCol] <<= lcl_getValue(*pXCell);
+ }
+ }
+ pRowArray[nRow] = aColSeq;
+ }
+ }
+ return aRowSeq;
+}
+/*-- 29.04.02 11:42:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXCellRange::setDataArray(
+ const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
+ throw (uno::RuntimeException)
+{
+ // see SwXCellRange::setData also
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt )
+ {
+ if(rArray.getLength() != nRowCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Sequence< uno::Any >* pRowArray = rArray.getConstArray();
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< uno::Any >& rColSeq = pRowArray[nRow];
+ if(rColSeq.getLength() != nColCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Any * pColArray = rColSeq.getConstArray();
+ uno::Reference< table::XCell > xCellRef;
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell * pXCell = lcl_CreateXCell(pFmt,
+ aRgDesc.nLeft + nCol,
+ aRgDesc.nTop + nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ const uno::Any &rAny = pColArray[nCol];
+ if (uno::TypeClass_STRING == rAny.getValueTypeClass())
+ lcl_setString( *pXCell, *(rtl::OUString *) rAny.getValue() );
+ else
+ {
+ double d = 0;
+ // #i20067# don't throw exception just do nothing if
+ // there is no value set
+ if( (rAny >>= d) )
+ lcl_setValue( *pXCell, d );
+ else
+ lcl_setString( *pXCell, OUString(), TRUE );
+ }
+ }
+ }
+ }
+ }
+}
+/*-- 11.12.98 14:27:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Sequence< double > > SwXCellRange::getData(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ //
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ uno::Sequence< double >* pRowArray = aRowSeq.getArray();
+
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< double > aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
+ double * pArray = aColSeq.getArray();
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ pArray[nCol - nColStart] = xCell->getValue();
+ }
+ pRowArray[nRow - nRowStart] = aColSeq;
+ }
+ }
+ return aRowSeq;
+}
+/*-- 11.12.98 14:27:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt )
+ {
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ if(rData.getLength() < nRowCount - nRowStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Sequence< double >* pRowArray = rData.getConstArray();
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ if(rColSeq.getLength() < nColCount - nColStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const double * pColArray = rColSeq.getConstArray();
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ xCell->setValue(pColArray[nCol - nColStart]);
+ }
+ }
+ }
+}
+/*-- 11.12.98 14:27:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 14:27:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount || rRowDesc.getLength() < bFirstRowAsLabel ? nRowCount - 1 : nRowCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const OUString* pArray = rRowDesc.getConstArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wohin mit den Labels?");
+ }
+ }
+}
+/*-- 11.12.98 14:27:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nColCount = getColumnCount();
+ if(!nColCount)
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstRowAsLabel ? nColCount - 1 : nColCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstRowAsLabel)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 14:27:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int16 nColCount = getColumnCount();
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const OUString* pArray = ColumnDesc.getConstArray();
+ if(bFirstRowAsLabel && ColumnDesc.getLength() >= nColCount - bFirstColumnAsLabel ? 1 : 0)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY);
+
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+}
+/*-- 11.12.98 14:27:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::addChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aChartLstnrCntnr.AddListener(aListener.get());
+}
+/*-- 11.12.98 14:27:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::removeChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
+ throw uno::RuntimeException();
+}
+/* -----------------08.03.99 15:36-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXCellRange::isNotANumber(double /*fNumber*/) throw( uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+ return sal_False;
+
+}
+/* -----------------08.03.99 15:36-------------------
+ *
+ * --------------------------------------------------*/
+double SwXCellRange::getNotANumber(void) throw( uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+ return 0.;
+}
+/*-- 11.12.98 14:27:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXCellRange::createSortDescriptor(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ return SwUnoCursorHelper::CreateSortDescriptor(true);
+}
+/*-- 11.12.98 14:27:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXCellRange::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+ throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwSortOptions aSortOpt;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt &&
+ SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
+ {
+ SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
+ pTableCrsr->MakeBoxSels();
+ UnoActionContext aContext( pFmt->GetDoc() );
+ pFmt->GetDoc()->SortTbl(pTableCrsr->GetBoxes(), aSortOpt);
+ }
+}
+/* -----------------27.04.98 16:54-------------------
+ *
+ * --------------------------------------------------*/
+sal_uInt16 SwXCellRange::getColumnCount(void)
+{
+ return static_cast< sal_uInt16 >(aRgDesc.nRight - aRgDesc.nLeft + 1);
+}
+/* -----------------27.04.98 16:54-------------------
+ *
+ * --------------------------------------------------*/
+sal_uInt16 SwXCellRange::getRowCount(void)
+{
+ return static_cast< sal_uInt16 >(aRgDesc.nBottom - aRgDesc.nTop + 1);
+}
+/* -----------------------------05.06.01 09:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwUnoCrsr* SwXCellRange::GetTblCrsr() const
+{
+ const SwUnoCrsr* pRet = 0;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ pRet = pTblCrsr;
+ return pRet;
+}
+
+/*-- 11.12.98 14:27:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXCellRange::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew );
+ if(!GetRegisteredIn() || !aCursorDepend.GetRegisteredIn())
+ {
+ /*
+ * Not sure if this will cause a memory leak - this pTblCrsr
+ * is deleted in SwDoc and GPFs here when deleted again
+ * if(!aCursorDepend.GetRegisteredIn())
+ delete pTblCrsr;
+ */
+ pTblCrsr = 0;
+ aChartLstnrCntnr.Disposing();
+ }
+ else
+ aChartLstnrCntnr.ChartDataChanged();
+}
+/******************************************************************
+ * SwXTableRows
+ ******************************************************************/
+/* -----------------------------19.04.00 15:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTableRows::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTableRows");
+}
+/* -----------------------------19.04.00 15:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTableRows::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.text.TableRows") == rServiceName;
+}
+/* -----------------------------19.04.00 15:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTableRows::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TableRows");
+ return aRet;
+}
+TYPEINIT1(SwXTableRows, SwClient);
+/*-- 03.02.99 07:37:41---------------------------------------------------
+ -----------------------------------------------------------------------*/
+SwXTableRows::SwXTableRows(SwFrmFmt& rFrmFmt) :
+ SwClient(&rFrmFmt)
+{
+}
+/*-- 03.02.99 07:37:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTableRows::~SwXTableRows()
+{
+}
+/*-- 03.02.99 07:37:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTableRows::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nRet = 0;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ nRet = pTable->GetTabLines().Count();
+ }
+ return nRet;
+}
+/*-- 03.02.99 07:37:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt || nIndex < 0 )
+ throw lang::IndexOutOfBoundsException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(pTable->GetTabLines().Count() > nIndex)
+ {
+ SwTableLine* pLine = pTable->GetTabLines().GetObject((sal_uInt16)nIndex);
+ SwClientIter aIter( *pFrmFmt );
+ SwXTextTableRow* pXRow = (SwXTextTableRow*)aIter.
+ First( TYPE( SwXTextTableRow ));
+ while( pXRow )
+ {
+ // gibt es eine passende Zelle bereits?
+ if(pXRow->GetTblRow() == pLine)
+ break;
+ pXRow = (SwXTextTableRow*)aIter.Next();
+ }
+ //sonst anlegen
+ if(!pXRow)
+ pXRow = new SwXTextTableRow(pFrmFmt, pLine);
+ uno::Reference< beans::XPropertySet > xRet =
+ (beans::XPropertySet*)pXRow;
+ aRet.setValue(&xRet, ::getCppuType((const uno::Reference<beans::XPropertySet>*)0));
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+ }
+ return aRet;
+}
+/*-- 03.02.99 07:37:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SAL_CALL SwXTableRows::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<beans::XPropertySet>*)0);
+}
+/*-- 03.02.99 07:37:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTableRows::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ //es gibt keine Tabelle ohne Zeilen
+ return sal_True;
+}
+/*-- 03.02.99 07:37:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (nCount == 0)
+ return;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ sal_uInt16 nRowCount = pTable->GetTabLines().Count();
+ if (nCount <= 0 || !(0 <= nIndex && nIndex <= nRowCount))
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = C2U("Illegal arguments");
+ throw aExcept;
+ }
+
+ String sTLName = lcl_GetCellName(0, nIndex);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ sal_Bool bAppend = sal_False;
+ if(!pTLBox)
+ {
+ bAppend = sal_True;
+ // am Ende anfuegen, dazu muss der Cursor in die letzte Zeile!
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(rLines.Count() -1);
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ pTLBox = rBoxes.GetObject(0);
+ }
+ if(pTLBox)
+ {
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+
+ {
+ // remove actions
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+
+ pFrmFmt->GetDoc()->InsertRow(*pUnoCrsr, (sal_uInt16)nCount, bAppend);
+ delete pUnoCrsr;
+ }
+ }
+ }
+}
+/*-- 03.02.99 07:37:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (nCount == 0)
+ return;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt || nIndex < 0 || nCount <=0 )
+ throw uno::RuntimeException();
+ else
+ {
+ BOOL bSuccess = FALSE;
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sTLName = lcl_GetCellName(0, nIndex);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ String sBLName = lcl_GetCellName(0, nIndex + nCount - 1);
+ const SwTableBox* pBLBox = pTable->GetTblBox( sBLName );
+ if(pBLBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBLBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+ { // Die Klammer ist wichtig
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ pFrmFmt->GetDoc()->DeleteRow(*pUnoCrsr);
+ delete pUnoCrsr;
+ bSuccess = TRUE;
+ }
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ }
+ }
+ }
+ if(!bSuccess)
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = C2U("Illegal arguments");
+ throw aExcept;
+ }
+ }
+}
+/*-- 03.02.99 07:37:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTableRows::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/******************************************************************
+ * SwXTableColumns
+ ******************************************************************/
+/* -----------------------------19.04.00 15:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTableColumns::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTableColumns");
+}
+/* -----------------------------19.04.00 15:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTableColumns::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.text.TableColumns") == rServiceName;
+}
+/* -----------------------------19.04.00 15:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTableColumns::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TableColumns");
+ return aRet;
+}
+TYPEINIT1(SwXTableColumns, SwClient);
+/*-- 03.02.99 07:37:41---------------------------------------------------
+ -----------------------------------------------------------------------*/
+SwXTableColumns::SwXTableColumns(SwFrmFmt& rFrmFmt) :
+ SwClient(&rFrmFmt)
+{
+}
+/*-- 03.02.99 07:37:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTableColumns::~SwXTableColumns()
+{
+}
+/*-- 03.02.99 07:37:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTableColumns::getCount(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Int32 nRet = 0;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ nRet = pLine->GetTabBoxes().Count();
+ }
+ }
+ return nRet;
+}
+/*-- 03.02.99 07:37:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< uno::XInterface > xRet;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ USHORT nCount = 0;
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ nCount = pLine->GetTabBoxes().Count();
+ }
+ if(nCount <= nIndex || nIndex < 0)
+ throw lang::IndexOutOfBoundsException();
+ xRet = uno::Reference<uno::XInterface>(); //!! writer tables do not have columns !!
+ }
+ return uno::Any(&xRet, ::getCppuType((const uno::Reference<uno::XInterface>*)0));
+}
+/*-- 03.02.99 07:37:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+uno::Type SAL_CALL SwXTableColumns::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<uno::XInterface>*)0);
+}
+/*-- 03.02.99 07:37:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTableColumns::hasElements(void) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ return sal_True;
+}
+/*-- 03.02.99 07:37:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (nCount == 0)
+ return;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
+ if (nCount <= 0 || !(0 <= nIndex && nIndex <= nColCount))
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = C2U("Illegal arguments");
+ throw aExcept;
+ }
+
+ String sTLName = lcl_GetCellName(nIndex, 0);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ sal_Bool bAppend = sal_False;
+ if(!pTLBox)
+ {
+ bAppend = sal_True;
+ // am Ende anfuegen, dazu muss der Cursor in die letzte Spalte!
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ pTLBox = rBoxes.GetObject(rBoxes.Count() - 1);
+ }
+ if(pTLBox)
+ {
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+
+ {
+ // remove actions
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+
+ pFrmFmt->GetDoc()->InsertCol(*pUnoCrsr, (sal_uInt16)nCount, bAppend);
+ delete pUnoCrsr;
+ }
+ }
+ }
+}
+/*-- 03.02.99 07:37:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ if (nCount == 0)
+ return;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt|| nIndex < 0 || nCount <=0 )
+ throw uno::RuntimeException();
+ else
+ {
+ BOOL bSuccess = FALSE;
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sTLName = lcl_GetCellName(nIndex, 0);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ String sTRName = lcl_GetCellName(nIndex + nCount - 1, 0);
+ const SwTableBox* pTRBox = pTable->GetTblBox( sTRName );
+ if(pTRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pTRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr =
+ dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+ { // Die Klammer ist wichtig
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ pFrmFmt->GetDoc()->DeleteCol(*pUnoCrsr);
+ delete pUnoCrsr;
+ bSuccess = TRUE;
+ }
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ }
+ }
+ }
+ if(!bSuccess)
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = C2U("Illegal arguments");
+ throw aExcept;
+ }
+ }
+}
+/*-- 03.02.99 07:37:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTableColumns::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+/* -----------------------------22.09.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwChartEventListenerContainer::ChartDataChanged()
+{
+ if(pListenerArr)
+ {
+ //TODO: find appropriate settings of the Event
+ lang::EventObject aObj(pxParent);
+ chart::ChartDataChangeEvent aEvent;
+ aEvent.Type = chart::ChartDataChangeType_ALL;
+ aEvent.StartColumn = 0;
+ aEvent.EndColumn = 1;
+ aEvent.StartRow = 0;
+ aEvent.EndRow = 1;
+
+ for(sal_uInt16 i = 0; i < pListenerArr->Count(); i++)
+ {
+ try
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ uno::Reference<lang::XEventListener> xEventListener = *pElem;
+ uno::Reference<chart::XChartDataChangeEventListener> xChartEventListener = (chart::XChartDataChangeEventListener*)(*pElem).get();
+ xChartEventListener->chartDataChanged( aEvent );
+ }
+ catch(uno::Exception const &)
+ {
+ }
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////
+
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
new file mode 100644
index 000000000000..3ddcfc1d2ed7
--- /dev/null
+++ b/sw/source/core/unocore/unotext.cxx
@@ -0,0 +1,2967 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+
+
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
+
+#include <rtl/uuid.h>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <cmdid.h>
+#include <unotextbodyhf.hxx>
+#include <unotext.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unosection.hxx>
+#include <unobookmark.hxx>
+#include <unorefmark.hxx>
+#include <unoport.hxx>
+#include <unotbl.hxx>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <unofield.hxx>
+#include <unometa.hxx>
+#include <unodraw.hxx>
+#include <unoredline.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <undobj.hxx>
+#include <unoparagraph.hxx>
+#include <unocrsrhelper.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+#include <doc.hxx>
+#include <redline.hxx>
+#include <swundo.hxx>
+#include <section.hxx>
+#include <IMark.hxx>
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+#include <crsskip.hxx>
+#include <ndtxt.hxx>
+
+#include <memory>
+#include <stdlib.h>
+
+#include <iostream>
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+const sal_Char cInvalidObject[] = "this object is invalid";
+
+/******************************************************************
+ * SwXText
+ ******************************************************************/
+
+class SwXText::Impl
+{
+
+public:
+ SwXText & m_rThis;
+ SfxItemPropertySet const& m_rPropSet;
+ const enum CursorType m_eType;
+ SwDoc * m_pDoc;
+ bool m_bIsValid;
+
+ Impl( SwXText & rThis,
+ SwDoc *const pDoc, const enum CursorType eType)
+ : m_rThis(rThis)
+ , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT))
+ , m_eType(eType)
+ , m_pDoc(pDoc)
+ , m_bIsValid(0 != pDoc)
+ {
+ }
+
+ uno::Reference< text::XTextRange >
+ finishOrAppendParagraph(
+ const bool bFinish,
+ const uno::Sequence< beans::PropertyValue >&
+ rCharacterAndParagraphProperties)
+ throw (lang::IllegalArgumentException, uno::RuntimeException);
+
+ sal_Int16 ComparePositions(
+ const uno::Reference<text::XTextRange>& xPos1,
+ const uno::Reference<text::XTextRange>& xPos2)
+ throw (lang::IllegalArgumentException, uno::RuntimeException);
+
+ bool CheckForOwnMember(const SwPaM & rPaM)
+ throw (lang::IllegalArgumentException, uno::RuntimeException);
+
+ void ConvertCell(
+ const bool bFirstCell,
+ const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
+ ::std::vector<SwNodeRange> & rRowNodes,
+ ::std::auto_ptr< SwPaM > & rpFirstPaM,
+ SwPaM & rLastPaM,
+ bool & rbExcept);
+
+};
+
+/* -----------------------------15.03.2002 12:39------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXText::SwXText(SwDoc *const pDoc, const enum CursorType eType)
+ : m_pImpl( new SwXText::Impl(*this, pDoc, eType) )
+{
+}
+/*-- 09.12.98 12:43:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXText::~SwXText()
+{
+}
+
+/*-- 09.12.98 12:44:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+const SwDoc * SwXText::GetDoc() const
+{
+ return m_pImpl->m_pDoc;
+}
+ SwDoc * SwXText::GetDoc()
+{
+ return m_pImpl->m_pDoc;
+}
+
+bool SwXText::IsValid() const
+{
+ return m_pImpl->m_bIsValid;
+}
+
+void SwXText::Invalidate()
+{
+ m_pImpl->m_bIsValid = false;
+}
+
+void SwXText::SetDoc(SwDoc *const pDoc)
+{
+ OSL_ENSURE(!m_pImpl->m_pDoc || !pDoc,
+ "SwXText::SetDoc: already have a doc?");
+ m_pImpl->m_pDoc = pDoc;
+ m_pImpl->m_bIsValid = (0 != pDoc);
+}
+
+void
+SwXText::PrepareForAttach(uno::Reference< text::XTextRange > &, const SwPaM &)
+{
+}
+
+bool SwXText::CheckForOwnMemberMeta(const SwPaM &, const bool)
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ ASSERT(CURSOR_META != m_pImpl->m_eType, "should not be called!");
+ return false;
+}
+
+const SwStartNode *SwXText::GetStartNode() const
+{
+ return GetDoc()->GetNodes().GetEndOfContent().StartOfSectionNode();
+}
+
+uno::Reference< text::XTextCursor >
+SwXText::CreateCursor() throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextCursor > xRet;
+ if(IsValid())
+ {
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+ SwPosition aPos(rNode);
+ xRet = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), this, m_pImpl->m_eType, aPos));
+ xRet->gotoStart(sal_False);
+ }
+ return xRet;
+}
+
+/*-- 09.12.98 12:43:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXText::queryInterface(const uno::Type& rType) throw (uno::RuntimeException)
+{
+ uno::Any aRet;
+ if (rType == text::XText::static_type())
+ {
+ aRet <<= uno::Reference< text::XText >(this);
+ }
+ else if (rType == text::XSimpleText::static_type())
+ {
+ aRet <<= uno::Reference< text::XSimpleText >(this);
+ }
+ else if (rType == text::XTextRange::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextRange>(this);
+ }
+ else if (rType == text::XTextRangeCompare::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextRangeCompare >(this);
+ }
+ else if (rType == lang::XTypeProvider::static_type())
+ {
+ aRet <<= uno::Reference< lang::XTypeProvider >(this);
+ }
+ else if (rType == text::XRelativeTextContentInsert::static_type())
+ {
+ aRet <<= uno::Reference< text::XRelativeTextContentInsert >(this);
+ }
+ else if (rType == text::XRelativeTextContentRemove::static_type())
+ {
+ aRet <<= uno::Reference< text::XRelativeTextContentRemove >(this);
+ }
+ else if (rType == beans::XPropertySet::static_type())
+ {
+ aRet <<= uno::Reference< beans::XPropertySet >(this);
+ }
+ else if (rType == lang::XUnoTunnel::static_type())
+ {
+ aRet <<= uno::Reference< lang::XUnoTunnel >(this);
+ }
+ else if (rType == text::XTextAppendAndConvert::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextAppendAndConvert >(this);
+ }
+ else if (rType == text::XTextAppend::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextAppend >(this);
+ }
+ else if (rType == text::XTextPortionAppend::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextPortionAppend >(this);
+ }
+ else if (rType == text::XParagraphAppend::static_type())
+ {
+ aRet <<= uno::Reference< text::XParagraphAppend >(this);
+ }
+ else if (rType == text::XTextConvert::static_type() )
+ {
+ aRet <<= uno::Reference< text::XTextConvert >(this);
+ }
+ else if (rType == text::XTextContentAppend::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextContentAppend >(this);
+ }
+ else if(rType == text::XTextCopy::static_type())
+ {
+ aRet <<= uno::Reference< text::XTextCopy >( this );
+ }
+ return aRet;
+}
+/* -----------------------------15.03.00 17:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL
+SwXText::getTypes() throw (uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aRet(12);
+ uno::Type* pTypes = aRet.getArray();
+ pTypes[0] = text::XText::static_type();
+ pTypes[1] = text::XTextRangeCompare::static_type();
+ pTypes[2] = text::XRelativeTextContentInsert::static_type();
+ pTypes[3] = text::XRelativeTextContentRemove::static_type();
+ pTypes[4] = lang::XUnoTunnel::static_type();
+ pTypes[5] = beans::XPropertySet::static_type();
+ pTypes[6] = text::XTextPortionAppend::static_type();
+ pTypes[7] = text::XParagraphAppend::static_type();
+ pTypes[8] = text::XTextContentAppend::static_type();
+ pTypes[9] = text::XTextConvert::static_type();
+ pTypes[10] = text::XTextAppend::static_type();
+ pTypes[11] = text::XTextAppendAndConvert::static_type();
+
+ return aRet;
+}
+
+// belongs the range in the text ? insert it then.
+void SAL_CALL
+SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange,
+ const OUString& rString, sal_Bool bAbsorb)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!xTextRange.is())
+ {
+ throw uno::RuntimeException();
+ }
+ if (!GetDoc())
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<lang::XUnoTunnel> xRangeTunnel(xTextRange,
+ uno::UNO_QUERY);
+ SwXTextRange *const pRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ if ((!pRange || pRange ->GetDoc() != GetDoc()) &&
+ (!pCursor || pCursor->GetDoc() != GetDoc()))
+ {
+ throw uno::RuntimeException();
+ }
+
+ const SwStartNode *const pOwnStartNode = GetStartNode();
+ SwPaM aPam(GetDoc()->GetNodes());
+ const SwPaM * pPam(0);
+ if (pCursor)
+ {
+ pPam = pCursor->GetPaM();
+ }
+ else // pRange
+ {
+ if (pRange->GetPositions(aPam))
+ {
+ pPam = &aPam;
+ }
+ }
+ if (!pPam)
+ {
+ throw uno::RuntimeException();
+ }
+
+ const SwStartNode* pTmp(pPam->GetNode()->StartOfSectionNode());
+ while (pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->StartOfSectionNode();
+ }
+ if (!pOwnStartNode || (pOwnStartNode != pTmp))
+ {
+ throw uno::RuntimeException();
+ }
+
+ bool bForceExpandHints( false );
+ if (CURSOR_META == m_pImpl->m_eType)
+ {
+ try
+ {
+ bForceExpandHints = CheckForOwnMemberMeta(*pPam, bAbsorb);
+ }
+ catch (lang::IllegalArgumentException & iae)
+ {
+ // stupid method not allowed to throw iae
+ throw uno::RuntimeException(iae.Message, 0);
+ }
+ }
+ if (bAbsorb)
+ {
+ //!! scan for CR characters and inserting the paragraph breaks
+ //!! has to be done in the called function.
+ //!! Implemented in SwXTextRange::DeleteAndInsert
+ if (pCursor)
+ {
+ SwXTextCursor * const pTextCursor(
+ dynamic_cast<SwXTextCursor*>(pCursor) );
+ if (pTextCursor)
+ {
+ pTextCursor->DeleteAndInsert(rString, bForceExpandHints);
+ }
+ else
+ {
+ xTextRange->setString(rString);
+ }
+ }
+ else
+ {
+ pRange->DeleteAndInsert(rString, bForceExpandHints);
+ }
+ }
+ else
+ {
+ // create a PaM positioned before the parameter PaM,
+ // so the text is inserted before
+ UnoActionContext aContext(GetDoc());
+ SwPaM aInsertPam(*pPam->Start());
+ const sal_Bool bGroupUndo = GetDoc()->DoesGroupUndo();
+ GetDoc()->DoGroupUndo(sal_False);
+
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ *GetDoc(), aInsertPam, rString, bForceExpandHints );
+ GetDoc()->DoGroupUndo(bGroupUndo);
+ }
+}
+
+/*-- 09.12.98 12:43:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::insertControlCharacter(
+ const uno::Reference< text::XTextRange > & xTextRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!xTextRange.is())
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (!GetDoc())
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwUnoInternalPaM aPam(*GetDoc());
+ if (!::sw::XTextRangeToSwPaM(aPam, xTextRange))
+ {
+ throw uno::RuntimeException();
+ }
+ const bool bForceExpandHints(CheckForOwnMemberMeta(aPam, bAbsorb));
+
+ const enum IDocumentContentOperations::InsertFlags nInsertFlags =
+ (bForceExpandHints)
+ ? static_cast<IDocumentContentOperations::InsertFlags>(
+ IDocumentContentOperations::INS_FORCEHINTEXPAND |
+ IDocumentContentOperations::INS_EMPTYEXPAND)
+ : IDocumentContentOperations::INS_EMPTYEXPAND;
+
+ SwPaM aTmp(*aPam.Start());
+ if (bAbsorb && aPam.HasMark())
+ {
+ m_pImpl->m_pDoc->DeleteAndJoin(aPam);
+ }
+
+ sal_Unicode cIns = 0;
+ switch (nControlCharacter)
+ {
+ case text::ControlCharacter::PARAGRAPH_BREAK :
+ // a table cell now becomes an ordinary text cell!
+ m_pImpl->m_pDoc->ClearBoxNumAttrs( aTmp.GetPoint()->nNode );
+ m_pImpl->m_pDoc->SplitNode( *aTmp.GetPoint(), sal_False );
+ break;
+ case text::ControlCharacter::APPEND_PARAGRAPH:
+ {
+ m_pImpl->m_pDoc->ClearBoxNumAttrs( aTmp.GetPoint()->nNode );
+ m_pImpl->m_pDoc->AppendTxtNode( *aTmp.GetPoint() );
+
+ const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
+ xTextRange, uno::UNO_QUERY);
+ SwXTextRange *const pRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(
+ xRangeTunnel);
+ if (pRange)
+ {
+ pRange->SetPositions(aTmp);
+ }
+ else if (pCursor)
+ {
+ SwPaM *const pCrsr = pCursor->GetPaM();
+ *pCrsr->GetPoint() = *aTmp.GetPoint();
+ pCrsr->DeleteMark();
+ }
+ }
+ break;
+ case text::ControlCharacter::LINE_BREAK: cIns = 10; break;
+ case text::ControlCharacter::SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
+ case text::ControlCharacter::HARD_HYPHEN: cIns = CHAR_HARDHYPHEN; break;
+ case text::ControlCharacter::HARD_SPACE: cIns = CHAR_HARDBLANK; break;
+ }
+ if (cIns)
+ {
+ m_pImpl->m_pDoc->InsertString( aTmp, cIns, nInsertFlags );
+ }
+
+ if (bAbsorb)
+ {
+ const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
+ xTextRange, uno::UNO_QUERY);
+ SwXTextRange *const pRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+
+ SwCursor aCrsr(*aTmp.GetPoint(),0,false);
+ SwUnoCursorHelper::SelectPam(aCrsr, true);
+ aCrsr.Left(1, CRSR_SKIP_CHARS, FALSE, FALSE);
+ //hier muss der uebergebene PaM umgesetzt werden:
+ if (pRange)
+ {
+ pRange->SetPositions(aCrsr);
+ }
+ else
+ {
+ SwPaM *const pUnoCrsr = pCursor->GetPaM();
+ *pUnoCrsr->GetPoint() = *aCrsr.GetPoint();
+ if (aCrsr.HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *aCrsr.GetMark();
+ }
+ else
+ {
+ pUnoCrsr->DeleteMark();
+ }
+ }
+ }
+}
+
+/*-- 09.12.98 12:43:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::insertTextContent(
+ const uno::Reference< text::XTextRange > & xRange,
+ const uno::Reference< text::XTextContent > & xContent,
+ sal_Bool bAbsorb)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!xRange.is())
+ {
+ lang::IllegalArgumentException aIllegal;
+ aIllegal.Message = C2U("first parameter invalid;");
+ throw aIllegal;
+ }
+ if (!xContent.is())
+ {
+ lang::IllegalArgumentException aIllegal;
+ aIllegal.Message += C2U("second parameter invalid");
+ throw aIllegal;
+ }
+ if(!GetDoc())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ SwUnoInternalPaM aPam(*GetDoc());
+ if (!::sw::XTextRangeToSwPaM(aPam, xRange))
+ {
+ lang::IllegalArgumentException aIllegal;
+ aIllegal.Message = C2U("first parameter invalid");
+ throw aIllegal;
+ }
+ // first test if the range is at the right position, then call
+ // xContent->attach
+ const SwStartNode* pOwnStartNode = GetStartNode();
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ switch (m_pImpl->m_eType)
+ {
+ case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
+ case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
+ case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
+ case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
+ case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ //case CURSOR_INVALID:
+ //case CURSOR_BODY:
+ default:
+ break;
+ }
+
+ const SwStartNode* pTmp =
+ aPam.GetNode()->FindSttNodeByType(eSearchNodeType);
+
+ // ignore SectionNodes
+ while (pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->StartOfSectionNode();
+ }
+ // if the document starts with a section
+ while (pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->StartOfSectionNode();
+ }
+ // this checks if (this) and xRange are in the same text::XText interface
+ if (pOwnStartNode != pTmp)
+ {
+ uno::RuntimeException aRunException;
+ aRunException.Message = C2U("text interface and cursor not related");
+ throw aRunException;
+ }
+
+ const bool bForceExpandHints(CheckForOwnMemberMeta(aPam, bAbsorb));
+
+ // special treatment for Contents that do not replace the range, but
+ // instead are "overlaid"
+ const uno::Reference<lang::XUnoTunnel> xContentTunnel(xContent,
+ uno::UNO_QUERY);
+ if (!xContentTunnel.is())
+ {
+ lang::IllegalArgumentException aArgException;
+ aArgException.Message =
+ C2U("text content does not support lang::XUnoTunnel");
+ throw aArgException;
+ }
+ SwXDocumentIndexMark *const pDocumentIndexMark =
+ ::sw::UnoTunnelGetImplementation<SwXDocumentIndexMark>(xContentTunnel);
+ SwXTextSection *const pSection =
+ ::sw::UnoTunnelGetImplementation<SwXTextSection>(xContentTunnel);
+ SwXBookmark *const pBookmark =
+ ::sw::UnoTunnelGetImplementation<SwXBookmark>(xContentTunnel);
+ SwXReferenceMark *const pReferenceMark =
+ ::sw::UnoTunnelGetImplementation<SwXReferenceMark>(xContentTunnel);
+ SwXMeta *const pMeta =
+ ::sw::UnoTunnelGetImplementation<SwXMeta>(xContentTunnel);
+
+ const bool bAttribute = pBookmark || pDocumentIndexMark
+ || pSection || pReferenceMark || pMeta;
+
+ if (bAbsorb && !bAttribute)
+ {
+ xRange->setString(aEmptyStr);
+ }
+ uno::Reference< text::XTextRange > xTempRange =
+ (bAttribute && bAbsorb) ? xRange : xRange->getStart();
+ if (bForceExpandHints)
+ {
+ // if necessary, replace xTempRange with a new SwXTextCursor
+ PrepareForAttach(xTempRange, aPam);
+ }
+ xContent->attach(xTempRange);
+}
+
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::insertTextContentBefore(
+ const uno::Reference< text::XTextContent>& xNewContent,
+ const uno::Reference< text::XTextContent>& xSuccessor)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!GetDoc())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ const uno::Reference<lang::XUnoTunnel> xParaTunnel(xNewContent,
+ uno::UNO_QUERY);
+ SwXParagraph *const pPara =
+ ::sw::UnoTunnelGetImplementation<SwXParagraph>(xParaTunnel);
+ if (!pPara || !pPara->IsDescriptor() || !xSuccessor.is())
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ sal_Bool bRet = sal_False;
+ const uno::Reference<lang::XUnoTunnel> xSuccTunnel(xSuccessor,
+ uno::UNO_QUERY);
+ SwXTextSection *const pXSection =
+ ::sw::UnoTunnelGetImplementation<SwXTextSection>(xSuccTunnel);
+ SwXTextTable *const pXTable =
+ ::sw::UnoTunnelGetImplementation<SwXTextTable>(xSuccTunnel);
+ SwFrmFmt *const pTableFmt = (pXTable) ? pXTable->GetFrmFmt() : 0;
+ SwTxtNode * pTxtNode = 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable *const pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode *const pTblNode = pTable->GetTableNode();
+
+ const SwNodeIndex aTblIdx( *pTblNode, -1 );
+ SwPosition aBefore(aTblIdx);
+ bRet = GetDoc()->AppendTxtNode( aBefore );
+ pTxtNode = aBefore.nNode.GetNode().GetTxtNode();
+ }
+ else if (pXSection && pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt *const pSectFmt = pXSection->GetFmt();
+ SwSectionNode *const pSectNode = pSectFmt->GetSectionNode();
+
+ const SwNodeIndex aSectIdx( *pSectNode, -1 );
+ SwPosition aBefore(aSectIdx);
+ bRet = GetDoc()->AppendTxtNode( aBefore );
+ pTxtNode = aBefore.nNode.GetNode().GetTxtNode();
+ }
+ if (!bRet || !pTxtNode)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ pPara->attachToText(*this, *pTxtNode);
+}
+
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::insertTextContentAfter(
+ const uno::Reference< text::XTextContent>& xNewContent,
+ const uno::Reference< text::XTextContent>& xPredecessor)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!GetDoc())
+ {
+ throw uno::RuntimeException();
+ }
+
+ const uno::Reference<lang::XUnoTunnel> xParaTunnel(xNewContent,
+ uno::UNO_QUERY);
+ SwXParagraph *const pPara =
+ ::sw::UnoTunnelGetImplementation<SwXParagraph>(xParaTunnel);
+ if(!pPara || !pPara->IsDescriptor() || !xPredecessor.is())
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ const uno::Reference<lang::XUnoTunnel> xPredTunnel(xPredecessor,
+ uno::UNO_QUERY);
+ SwXTextSection *const pXSection =
+ ::sw::UnoTunnelGetImplementation<SwXTextSection>(xPredTunnel);
+ SwXTextTable *const pXTable =
+ ::sw::UnoTunnelGetImplementation<SwXTextTable>(xPredTunnel);
+ SwFrmFmt *const pTableFmt = (pXTable) ? pXTable->GetFrmFmt() : 0;
+ sal_Bool bRet = sal_False;
+ SwTxtNode * pTxtNode = 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable *const pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode *const pTblNode = pTable->GetTableNode();
+
+ SwEndNode *const pTableEnd = pTblNode->EndOfSectionNode();
+ SwPosition aTableEnd(*pTableEnd);
+ bRet = GetDoc()->AppendTxtNode( aTableEnd );
+ pTxtNode = aTableEnd.nNode.GetNode().GetTxtNode();
+ }
+ else if (pXSection && pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt *const pSectFmt = pXSection->GetFmt();
+ SwSectionNode *const pSectNode = pSectFmt->GetSectionNode();
+ SwEndNode *const pEnd = pSectNode->EndOfSectionNode();
+ SwPosition aEnd(*pEnd);
+ bRet = GetDoc()->AppendTxtNode( aEnd );
+ pTxtNode = aEnd.nNode.GetNode().GetTxtNode();
+ }
+ if (!bRet || !pTxtNode)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ pPara->attachToText(*this, *pTxtNode);
+}
+
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::removeTextContentBefore(
+ const uno::Reference< text::XTextContent>& xSuccessor)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!GetDoc())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ sal_Bool bRet = sal_False;
+ const uno::Reference<lang::XUnoTunnel> xSuccTunnel(xSuccessor,
+ uno::UNO_QUERY);
+ SwXTextSection *const pXSection =
+ ::sw::UnoTunnelGetImplementation<SwXTextSection>(xSuccTunnel);
+ SwXTextTable *const pXTable =
+ ::sw::UnoTunnelGetImplementation<SwXTextTable>(xSuccTunnel);
+ SwFrmFmt *const pTableFmt = (pXTable) ? pXTable->GetFrmFmt() : 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable *const pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode *const pTblNode = pTable->GetTableNode();
+
+ const SwNodeIndex aTblIdx( *pTblNode, -1 );
+ if(aTblIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aBefore(aTblIdx);
+ bRet = GetDoc()->DelFullPara( aBefore );
+ }
+ }
+ else if (pXSection && pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt *const pSectFmt = pXSection->GetFmt();
+ SwSectionNode *const pSectNode = pSectFmt->GetSectionNode();
+
+ const SwNodeIndex aSectIdx( *pSectNode, -1 );
+ if(aSectIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aBefore(aSectIdx);
+ bRet = GetDoc()->DelFullPara( aBefore );
+ }
+ }
+ if(!bRet)
+ {
+ throw lang::IllegalArgumentException();
+ }
+}
+
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::removeTextContentAfter(
+ const uno::Reference< text::XTextContent>& xPredecessor)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!GetDoc())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ sal_Bool bRet = sal_False;
+ const uno::Reference<lang::XUnoTunnel> xPredTunnel(xPredecessor,
+ uno::UNO_QUERY);
+ SwXTextSection *const pXSection =
+ ::sw::UnoTunnelGetImplementation<SwXTextSection>(xPredTunnel);
+ SwXTextTable *const pXTable =
+ ::sw::UnoTunnelGetImplementation<SwXTextTable>(xPredTunnel);
+ SwFrmFmt *const pTableFmt = (pXTable) ? pXTable->GetFrmFmt() : 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable *const pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode *const pTblNode = pTable->GetTableNode();
+ SwEndNode *const pTableEnd = pTblNode->EndOfSectionNode();
+
+ const SwNodeIndex aTblIdx( *pTableEnd, 1 );
+ if(aTblIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aPaM(aTblIdx);
+ bRet = GetDoc()->DelFullPara( aPaM );
+ }
+ }
+ else if (pXSection && pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt *const pSectFmt = pXSection->GetFmt();
+ SwSectionNode *const pSectNode = pSectFmt->GetSectionNode();
+ SwEndNode *const pEnd = pSectNode->EndOfSectionNode();
+ const SwNodeIndex aSectIdx( *pEnd, 1 );
+ if(aSectIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aAfter(aSectIdx);
+ bRet = GetDoc()->DelFullPara( aAfter );
+ }
+ }
+ if(!bRet)
+ {
+ throw lang::IllegalArgumentException();
+ }
+}
+
+/*-- 09.12.98 12:43:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::removeTextContent(
+ const uno::Reference< text::XTextContent > & xContent)
+throw (container::NoSuchElementException, uno::RuntimeException)
+{
+ // forward: need no solar mutex here
+ if(!xContent.is())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U("first parameter invalid");
+ throw aRuntime;
+ }
+ xContent->dispose();
+}
+
+/*-- 09.12.98 12:43:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SAL_CALL
+SwXText::getText() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const uno::Reference< text::XText > xRet(this);
+ return xRet;
+}
+
+/*-- 09.12.98 12:43:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXText::getStart() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const uno::Reference< text::XTextCursor > xRef = CreateCursor();
+ if(!xRef.is())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ xRef->gotoStart(sal_False);
+ const uno::Reference< text::XTextRange > xRet(xRef, uno::UNO_QUERY);
+ return xRet;
+}
+/*-- 09.12.98 12:43:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXText::getEnd() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const uno::Reference< text::XTextCursor > xRef = CreateCursor();
+ if(!xRef.is())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ xRef->gotoEnd(sal_False);
+ const uno::Reference< text::XTextRange > xRet(xRef, uno::UNO_QUERY);
+ return xRet;
+}
+
+/*-- 09.12.98 12:43:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SAL_CALL SwXText::getString() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const uno::Reference< text::XTextCursor > xRet = CreateCursor();
+ if(!xRet.is())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ xRet->gotoEnd(sal_True);
+ return xRet->getString();
+}
+/*-- 09.12.98 12:43:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::setString(const OUString& rString) throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!GetDoc())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ const SwStartNode* pStartNode = GetStartNode();
+ if (!pStartNode)
+ {
+ throw uno::RuntimeException();
+ }
+
+ GetDoc()->StartUndo(UNDO_START, NULL);
+ //insert an empty paragraph at the start and at the end to ensure that
+ //all tables and sections can be removed by the selecting text::XTextCursor
+ if (CURSOR_META != m_pImpl->m_eType)
+ {
+ SwPosition aStartPos(*pStartNode);
+ const SwEndNode* pEnd = pStartNode->EndOfSectionNode();
+ SwNodeIndex aEndIdx(*pEnd);
+ aEndIdx--;
+ //the inserting of nodes should only be done if really necessary
+ //to prevent #97924# (removes paragraph attributes when setting the text
+ //e.g. of a table cell
+ BOOL bInsertNodes = FALSE;
+ SwNodeIndex aStartIdx(*pStartNode);
+ do
+ {
+ aStartIdx++;
+ SwNode& rCurrentNode = aStartIdx.GetNode();
+ if(rCurrentNode.GetNodeType() == ND_SECTIONNODE
+ ||rCurrentNode.GetNodeType() == ND_TABLENODE)
+ {
+ bInsertNodes = TRUE;
+ break;
+ }
+ }
+ while(aStartIdx < aEndIdx);
+ if(bInsertNodes)
+ {
+ GetDoc()->AppendTxtNode( aStartPos );
+ SwPosition aEndPos(aEndIdx.GetNode());
+ SwPaM aPam(aEndPos);
+ GetDoc()->AppendTxtNode( *aPam.Start() );
+ }
+ }
+
+ const uno::Reference< text::XTextCursor > xRet = CreateCursor();
+ if(!xRet.is())
+ {
+ GetDoc()->EndUndo(UNDO_END, NULL);
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ xRet->gotoEnd(sal_True);
+ xRet->setString(rString);
+ GetDoc()->EndUndo(UNDO_END, NULL);
+}
+
+//FIXME why is CheckForOwnMember duplicated in some insert methods?
+// Description: Checks if pRange/pCursor are member of the same text interface.
+// Only one of the pointers has to be set!
+bool SwXText::Impl::CheckForOwnMember(
+ const SwPaM & rPaM)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ const uno::Reference<text::XTextCursor> xOwnCursor(m_rThis.CreateCursor());
+
+ const uno::Reference<lang::XUnoTunnel> xTunnel(xOwnCursor, uno::UNO_QUERY);
+ OTextCursorHelper *const pOwnCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel);
+ DBG_ASSERT(pOwnCursor, "OTextCursorHelper::getUnoTunnelId() ??? ");
+ const SwStartNode* pOwnStartNode =
+ pOwnCursor->GetPaM()->GetNode()->StartOfSectionNode();
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ switch (m_eType)
+ {
+ case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
+ case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
+ case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
+ case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
+ case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ //case CURSOR_INVALID:
+ //case CURSOR_BODY:
+ default:
+ ;
+ }
+
+ SwNode const*const pSrcNode(rPaM.GetNode());
+ if (!pSrcNode) { return false; }
+ const SwStartNode* pTmp = pSrcNode->FindSttNodeByType(eSearchNodeType);
+
+ //SectionNodes ueberspringen
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->StartOfSectionNode();
+ }
+
+ //if the document starts with a section
+ while(pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->StartOfSectionNode();
+ }
+
+ //this checks if (this) and xRange are in the same text::XText interface
+ return (pOwnStartNode == pTmp);
+}
+
+sal_Int16
+SwXText::Impl::ComparePositions(
+ const uno::Reference<text::XTextRange>& xPos1,
+ const uno::Reference<text::XTextRange>& xPos2)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ SwUnoInternalPaM aPam1(*m_pDoc);
+ SwUnoInternalPaM aPam2(*m_pDoc);
+
+ if (!::sw::XTextRangeToSwPaM(aPam1, xPos1) ||
+ !::sw::XTextRangeToSwPaM(aPam2, xPos2))
+ {
+ throw lang::IllegalArgumentException();
+ }
+ if (!CheckForOwnMember(aPam1) || !CheckForOwnMember(aPam2))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ sal_Int16 nCompare = 0;
+ SwPosition const*const pStart1 = aPam1.Start();
+ SwPosition const*const pStart2 = aPam2.Start();
+ if (*pStart1 < *pStart2)
+ {
+ nCompare = 1;
+ }
+ else if (*pStart1 > *pStart2)
+ {
+ nCompare = -1;
+ }
+ else
+ {
+ DBG_ASSERT(*pStart1 == *pStart2,
+ "SwPositions should be equal here");
+ nCompare = 0;
+ }
+
+ return nCompare;
+}
+
+/*-- 28.03.00 10:37:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SAL_CALL
+SwXText::compareRegionStarts(
+ const uno::Reference<text::XTextRange>& xRange1,
+ const uno::Reference<text::XTextRange>& xRange2)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!xRange1.is() || !xRange2.is())
+ {
+ throw lang::IllegalArgumentException();
+ }
+ const uno::Reference<text::XTextRange> xStart1 = xRange1->getStart();
+ const uno::Reference<text::XTextRange> xStart2 = xRange2->getStart();
+
+ return m_pImpl->ComparePositions(xStart1, xStart2);
+}
+/*-- 28.03.00 10:37:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SAL_CALL
+SwXText::compareRegionEnds(
+ const uno::Reference<text::XTextRange>& xRange1,
+ const uno::Reference<text::XTextRange>& xRange2)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!xRange1.is() || !xRange2.is())
+ {
+ throw lang::IllegalArgumentException();
+ }
+ uno::Reference<text::XTextRange> xEnd1 = xRange1->getEnd();
+ uno::Reference<text::XTextRange> xEnd2 = xRange2->getEnd();
+
+ return m_pImpl->ComparePositions(xEnd1, xEnd2);
+}
+
+/*-- 15.03.2002 12:30:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXText::getPropertySetInfo() throw(uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static uno::Reference< beans::XPropertySetInfo > xInfo =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
+ return xInfo;
+}
+
+/*-- 15.03.2002 12:30:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::setPropertyValue(const ::rtl::OUString& /*aPropertyName*/,
+ const uno::Any& /*aValue*/)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw lang::IllegalArgumentException();
+}
+/*-- 15.03.2002 12:30:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXText::getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ {
+ throw uno::RuntimeException();
+ }
+
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
+ {
+ beans::UnknownPropertyException aExcept;
+ aExcept.Message = C2U("Unknown property: ");
+ aExcept.Message += rPropertyName;
+ throw aExcept;
+ }
+
+ uno::Any aRet;
+ switch (pEntry->nWID)
+ {
+// no code necessary - the redline is always located at the end node
+// case FN_UNO_REDLINE_NODE_START:
+// break;
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ const USHORT nRedTblCount = rRedTbl.Count();
+ if (nRedTblCount > 0)
+ {
+ SwStartNode const*const pStartNode = GetStartNode();
+ const ULONG nOwnIndex = pStartNode->EndOfSectionIndex();
+ for (USHORT nRed = 0; nRed < nRedTblCount; nRed++)
+ {
+ SwRedline const*const pRedline = rRedTbl[nRed];
+ SwPosition const*const pRedStart = pRedline->Start();
+ const SwNodeIndex nRedNode = pRedStart->nNode;
+ if (nOwnIndex == nRedNode.GetIndex())
+ {
+ aRet <<= SwXRedlinePortion::CreateRedlineProperties(
+ *pRedline, TRUE);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ return aRet;
+}
+
+/*-- 15.03.2002 12:30:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXText::addPropertyChangeListener(): not implemented");
+}
+/*-- 15.03.2002 12:30:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXText::removePropertyChangeListener(): not implemented");
+}
+/*-- 15.03.2002 12:30:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXText::addVetoableChangeListener(): not implemented");
+}
+/*-- 15.03.2002 12:30:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL
+SwXText::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE(false,
+ "SwXText::removeVetoableChangeListener(): not implemented");
+}
+
+/* -----------------------------08.01.01 09:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXText::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------08.01.01 09:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL
+SwXText::getSomething(const uno::Sequence< sal_Int8 >& rId)
+throw (uno::RuntimeException)
+{
+ return ::sw::UnoTunnelImpl<SwXText>(rId, this);
+}
+
+/*-- 23.06.2006 08:56:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXText::appendParagraph(
+ const uno::Sequence< beans::PropertyValue > & rProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return m_pImpl->finishOrAppendParagraph(false, rProperties);
+}
+/*-- 23.06.2006 08:56:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXText::finishParagraph(
+ const uno::Sequence< beans::PropertyValue > & rProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ return m_pImpl->finishOrAppendParagraph(true, rProperties);
+}
+
+/*-- 08.05.2006 13:26:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange >
+SwXText::Impl::finishOrAppendParagraph(
+ const bool bFinish,
+ const uno::Sequence< beans::PropertyValue > & rProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ if (!m_bIsValid)
+ {
+ throw uno::RuntimeException();
+ }
+
+ const SwStartNode* pStartNode = m_rThis.GetStartNode();
+ if(!pStartNode)
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Reference< text::XTextRange > xRet;
+ bool bIllegalException = false;
+ bool bRuntimeException = false;
+ ::rtl::OUString sMessage;
+ m_pDoc->StartUndo(UNDO_START , NULL);
+ // find end node, go backward - don't skip tables because the new
+ // paragraph has to be the last node
+ //aPam.Move( fnMoveBackward, fnGoNode );
+ SwPosition aInsertPosition(
+ SwNodeIndex( *pStartNode->EndOfSectionNode(), -1 ) );
+ SwPaM aPam(aInsertPosition);
+ m_pDoc->AppendTxtNode( *aPam.GetPoint() );
+ // remove attributes from the previous paragraph
+ m_pDoc->ResetAttrs(aPam);
+ // in case of finishParagraph the PaM needs to be moved to the
+ // previous paragraph
+ if (bFinish)
+ {
+ aPam.Move( fnMoveBackward, fnGoNode );
+ }
+ if (rProperties.getLength())
+ {
+ // now set the properties
+ SfxItemPropertySet const*const pParaPropSet =
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH);
+ SfxItemPropertyMap const*const pParagraphMap =
+ pParaPropSet->getPropertyMap();
+
+ const beans::PropertyValue* pValues = rProperties.getConstArray();
+
+ for (sal_Int32 nProp = 0; nProp < rProperties.getLength(); ++nProp)
+ {
+ if (!pParagraphMap->getByName(pValues[nProp].Name))
+ {
+ bIllegalException = true;
+ break;
+ }
+ try
+ {
+ SwUnoCursorHelper::SetPropertyValue(aPam, *pParaPropSet,
+ pValues[nProp].Name, pValues[nProp].Value);
+ }
+ catch (lang::IllegalArgumentException& rIllegal)
+ {
+ sMessage = rIllegal.Message;
+ bIllegalException = true;
+ break;
+ }
+ catch (uno::RuntimeException& rRuntime)
+ {
+ sMessage = rRuntime.Message;
+ bRuntimeException = true;
+ break;
+ }
+ }
+ }
+ m_pDoc->EndUndo(UNDO_END, NULL);
+ if (bIllegalException || bRuntimeException)
+ {
+ SwUndoIter aUndoIter( &aPam, UNDO_EMPTY );
+ m_pDoc->Undo(aUndoIter);
+ if (bIllegalException)
+ {
+ lang::IllegalArgumentException aEx;
+ aEx.Message = sMessage;
+ throw aEx;
+ }
+ else // if(bRuntimeException)
+ {
+ uno::RuntimeException aEx;
+ aEx.Message = sMessage;
+ throw aEx;
+ }
+ }
+ SwTxtNode *const pTxtNode( aPam.Start()->nNode.GetNode().GetTxtNode() );
+ OSL_ENSURE(pTxtNode, "no SwTxtNode?");
+ if (pTxtNode)
+ {
+ xRet.set(SwXParagraph::CreateXParagraph(*m_pDoc, *pTxtNode, &m_rThis),
+ uno::UNO_QUERY);
+ }
+
+ return xRet;
+}
+
+/*-- 08.05.2006 13:28:26---------------------------------------------------
+ Append text portions at the end of the last paragraph of the text
+ interface. Support of import filters.
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXText::appendTextPortion(
+ const ::rtl::OUString& rText,
+ const uno::Sequence< beans::PropertyValue > &
+ rCharacterAndParagraphProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XTextRange > xRet;
+ const uno::Reference< text::XTextCursor > xTextCursor = CreateCursor();
+ xTextCursor->gotoEnd(sal_False);
+
+ const uno::Reference< lang::XUnoTunnel > xRangeTunnel(
+ xTextCursor, uno::UNO_QUERY_THROW );
+ SwXTextCursor *const pTextCursor =
+ ::sw::UnoTunnelGetImplementation<SwXTextCursor>(xRangeTunnel);
+
+ bool bIllegalException = false;
+ bool bRuntimeException = false;
+ ::rtl::OUString sMessage;
+ m_pImpl->m_pDoc->StartUndo(UNDO_INSERT, NULL);
+
+// SwPaM aPam(*pStartNode->EndOfSectionNode());
+ //aPam.Move( fnMoveBackward, fnGoNode );
+ SwUnoCrsr *const pCursor = pTextCursor->GetCursor();
+ pCursor->MovePara( fnParaCurr, fnParaEnd );
+ m_pImpl->m_pDoc->DontExpandFmt( *pCursor->Start() );
+
+ if (rText.getLength())
+ {
+ const xub_StrLen nContentPos = pCursor->GetPoint()->nContent.GetIndex();
+ SwUnoCursorHelper::DocInsertStringSplitCR(
+ *m_pImpl->m_pDoc, *pCursor, rText, false);
+ SwUnoCursorHelper::SelectPam(*pCursor, true);
+ pCursor->GetPoint()->nContent = nContentPos;
+ }
+
+ if (rCharacterAndParagraphProperties.getLength())
+ {
+ SfxItemPropertyMap const*const pCursorMap =
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)
+ ->getPropertyMap();
+ beans::PropertyValue const*const pValues =
+ rCharacterAndParagraphProperties.getConstArray();
+ SfxItemPropertySet const*const pCursorPropSet =
+ aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR);
+ const sal_Int32 nLen(rCharacterAndParagraphProperties.getLength());
+ for (sal_Int32 nProp = 0; nProp < nLen; ++nProp)
+ {
+ if (!pCursorMap->getByName( pValues[nProp].Name ))
+ {
+ bIllegalException = true;
+ break;
+ }
+ try
+ {
+ SwUnoCursorHelper::SetPropertyValue(
+ *pCursor, *pCursorPropSet,
+ pValues[nProp].Name, pValues[nProp].Value,
+ nsSetAttrMode::SETATTR_NOFORMATATTR);
+ }
+ catch( lang::IllegalArgumentException& rIllegal )
+ {
+ sMessage = rIllegal.Message;
+ bIllegalException = true;
+ break;
+ }
+ catch( uno::RuntimeException& rRuntime )
+ {
+ sMessage = rRuntime.Message;
+ bRuntimeException = true;
+ break;
+ }
+ }
+ }
+ m_pImpl->m_pDoc->EndUndo(UNDO_INSERT, NULL);
+ if (bIllegalException || bRuntimeException)
+ {
+ SwUndoIter aUndoIter( pCursor, UNDO_EMPTY );
+ m_pImpl->m_pDoc->Undo(aUndoIter);
+ if (bIllegalException)
+ {
+ lang::IllegalArgumentException aEx;
+ aEx.Message = sMessage;
+ throw aEx;
+ }
+ else //if(bRuntimeException)
+ {
+ uno::RuntimeException aEx;
+ aEx.Message = sMessage;
+ throw aEx;
+ }
+ }
+ xRet = new SwXTextRange(*pCursor, this);
+ return xRet;
+}
+
+/*-- 11.05.2006 15:46:26---------------------------------------------------
+ enable appending text contents like graphic objects, shapes and so on
+ to support import filters
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SAL_CALL
+SwXText::appendTextContent(
+ const uno::Reference< text::XTextContent >& xTextContent,
+ const uno::Sequence< beans::PropertyValue >&
+ rCharacterAndParagraphProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!IsValid())
+ {
+ throw uno::RuntimeException();
+ }
+ SwStartNode const*const pStartNode = GetStartNode();
+ if(!pStartNode)
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Reference< text::XTextRange > xRet;
+ m_pImpl->m_pDoc->StartUndo(UNDO_INSERT, NULL);
+ // find end node, go backward - don't skip tables because the
+ // new paragraph has to be the last node
+ SwPaM aPam(*pStartNode->EndOfSectionNode());
+ aPam.Move( fnMoveBackward, fnGoNode );
+ // set cursor to the end of the last text node
+ SwCursor aCursor( *aPam.Start(), 0, false );
+ xRet = new SwXTextRange(aCursor, this);
+ aCursor.MovePara( fnParaCurr, fnParaEnd );
+ m_pImpl->m_pDoc->DontExpandFmt( *aCursor.Start() );
+ // now attach the text content here
+ insertTextContent( xRet, xTextContent, false );
+ // now apply the properties to the anchor
+ if (rCharacterAndParagraphProperties.getLength())
+ {
+ try
+ {
+ const sal_Int32 nLen(rCharacterAndParagraphProperties.getLength());
+ const uno::Reference< beans::XPropertySet > xAnchor(
+ xTextContent->getAnchor(), uno::UNO_QUERY);
+ if (xAnchor.is())
+ {
+ for (sal_Int32 nElement = 0; nElement < nLen; ++nElement)
+ {
+ xAnchor->setPropertyValue(
+ rCharacterAndParagraphProperties[nElement].Name,
+ rCharacterAndParagraphProperties[nElement].Value);
+ }
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ m_pImpl->m_pDoc->EndUndo(UNDO_INSERT, NULL);
+ return xRet;
+}
+
+// move previously appended paragraphs into a text frames
+// to support import filters
+uno::Reference< text::XTextContent > SAL_CALL
+SwXText::convertToTextFrame(
+ const uno::Reference< text::XTextRange >& xStart,
+ const uno::Reference< text::XTextRange >& xEnd,
+ const uno::Sequence< beans::PropertyValue >& rFrameProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< text::XTextContent > xRet;
+ SwUnoInternalPaM aStartPam(*GetDoc());
+ std::auto_ptr< SwUnoInternalPaM > pEndPam(new SwUnoInternalPaM(*GetDoc()));
+ if (!::sw::XTextRangeToSwPaM(aStartPam, xStart) ||
+ !::sw::XTextRangeToSwPaM(*pEndPam, xEnd))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ const uno::Reference<lang::XUnoTunnel> xStartRangeTunnel(xStart,
+ uno::UNO_QUERY);
+ SwXTextRange *const pStartRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xStartRangeTunnel);
+ const uno::Reference<lang::XUnoTunnel> xEndRangeTunnel(xEnd,
+ uno::UNO_QUERY);
+ SwXTextRange *const pEndRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xEndRangeTunnel);
+ // bookmarks have to be removed before the referenced text node
+ // is deleted in DelFullPara
+ if (pStartRange)
+ {
+ pStartRange->Invalidate();
+ }
+ if (pEndRange)
+ {
+ pEndRange->Invalidate();
+ }
+
+ m_pImpl->m_pDoc->StartUndo( UNDO_START, NULL );
+ bool bIllegalException = false;
+ bool bRuntimeException = false;
+ ::rtl::OUString sMessage;
+ SwStartNode* pStartStartNode = aStartPam.GetNode()->StartOfSectionNode();
+ while (pStartStartNode && pStartStartNode->IsSectionNode())
+ {
+ pStartStartNode = pStartStartNode->StartOfSectionNode();
+ }
+ SwStartNode* pEndStartNode = pEndPam->GetNode()->StartOfSectionNode();
+ while (pEndStartNode && pEndStartNode->IsSectionNode())
+ {
+ pEndStartNode = pEndStartNode->StartOfSectionNode();
+ }
+ bool bParaAfterInserted = false;
+ bool bParaBeforeInserted = false;
+ if (pStartStartNode != pEndStartNode || pStartStartNode != GetStartNode())
+ {
+ // todo: if the start/end is in a table then insert a paragraph
+ // before/after, move the start/end nodes, then convert and
+ // remove the addtional paragraphs in the end
+ if (pStartStartNode->GetStartNodeType() == SwTableBoxStartNode)
+ {
+ SwTableNode *const pSartTableNode(pStartStartNode->FindTableNode());
+ const SwNodeIndex aTblIdx( *pSartTableNode, -1 );
+ SwPosition aBefore(aTblIdx);
+ bParaBeforeInserted = GetDoc()->AppendTxtNode( aBefore );
+ aStartPam.DeleteMark();
+ *aStartPam.GetPoint() = aBefore;
+ pStartStartNode = aStartPam.GetNode()->StartOfSectionNode();
+ }
+ if (pEndStartNode->GetStartNodeType() == SwTableBoxStartNode)
+ {
+ SwTableNode *const pEndTableNode = pEndStartNode->FindTableNode();
+ SwEndNode *const pTableEnd = pEndTableNode->EndOfSectionNode();
+ SwPosition aTableEnd(*pTableEnd);
+ bParaAfterInserted = GetDoc()->AppendTxtNode( aTableEnd );
+ pEndPam->DeleteMark();
+ *pEndPam->GetPoint() = aTableEnd;
+ pEndStartNode = pEndPam->GetNode()->StartOfSectionNode();
+ }
+ // now we should have the positions in the same hierarchy
+ if ((pStartStartNode != pEndStartNode) ||
+ (pStartStartNode != GetStartNode()))
+ {
+ // if not - remove the additional paragraphs and throw
+ if (bParaBeforeInserted)
+ {
+ SwCursor aDelete(*aStartPam.GetPoint(), 0, false);
+ aDelete.MovePara(fnParaCurr, fnParaStart);
+ aDelete.SetMark();
+ aDelete.MovePara(fnParaCurr, fnParaEnd);
+ GetDoc()->DelFullPara(aDelete);
+ }
+ if (bParaAfterInserted)
+ {
+ SwCursor aDelete(*pEndPam->GetPoint(), 0, false);
+ aDelete.MovePara(fnParaCurr, fnParaStart);
+ aDelete.SetMark();
+ aDelete.MovePara(fnParaCurr, fnParaEnd);
+ GetDoc()->DelFullPara(aDelete);
+ }
+ throw lang::IllegalArgumentException();
+ }
+ }
+
+ // make a selection from aStartPam to a EndPam
+ SwSelBoxes aBoxes;
+ SfxItemSet aFrameItemSet(m_pImpl->m_pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ 0 );
+
+ aStartPam.SetMark();
+ *aStartPam.End() = *pEndPam->End();
+ pEndPam.reset(0);
+
+ SwXTextFrame *const pNewFrame = new SwXTextFrame(m_pImpl->m_pDoc);
+ const uno::Reference< text::XTextFrame > xNewFrame = pNewFrame;
+ pNewFrame->SetSelection( aStartPam );
+ try
+ {
+ const beans::PropertyValue* pValues = rFrameProperties.getConstArray();
+ for (sal_Int32 nProp = 0; nProp < rFrameProperties.getLength(); ++nProp)
+ {
+ pNewFrame->SwXFrame::setPropertyValue(
+ pValues[nProp].Name, pValues[nProp].Value);
+ }
+
+ { // has to be in a block to remove the SwIndexes before
+ // DelFullPara is called
+ const uno::Reference< text::XTextRange> xInsertTextRange =
+ new SwXTextRange(aStartPam, this);
+ pNewFrame->attach( xInsertTextRange );
+ pNewFrame->setName(m_pImpl->m_pDoc->GetUniqueFrameName());
+ }
+
+ if (!aStartPam.GetTxt().Len())
+ {
+ bool bMoved = false;
+ { // has to be in a block to remove the SwIndexes before
+ // DelFullPara is called
+ SwPaM aMovePam( *aStartPam.GetNode() );
+ if (aMovePam.Move( fnMoveForward, fnGoCntnt ))
+ {
+ // move the anchor to the next paragraph
+ SwFmtAnchor aNewAnchor(pNewFrame->GetFrmFmt()->GetAnchor());
+ aNewAnchor.SetAnchor( aMovePam.Start() );
+ m_pImpl->m_pDoc->SetAttr(
+ aNewAnchor, *pNewFrame->GetFrmFmt() );
+ }
+ bMoved = true;
+ }
+ if (bMoved)
+ {
+ aStartPam.DeleteMark();
+// SwPaM aDelPam( *aStartPam.GetNode() );
+ m_pImpl->m_pDoc->DelFullPara(aStartPam/*aDelPam*/);
+ }
+ }
+ }
+ catch (lang::IllegalArgumentException& rIllegal)
+ {
+ sMessage = rIllegal.Message;
+ bIllegalException = true;
+ }
+ catch (uno::RuntimeException& rRuntime)
+ {
+ sMessage = rRuntime.Message;
+ bRuntimeException = true;
+ }
+ xRet = pNewFrame;
+ if (bParaBeforeInserted || bParaAfterInserted)
+ {
+ const uno::Reference<text::XTextCursor> xFrameTextCursor =
+ pNewFrame->createTextCursor();
+ const uno::Reference<XUnoTunnel> xTunnel(xFrameTextCursor,
+ uno::UNO_QUERY);
+ SwXTextCursor *const pFrameCursor =
+ ::sw::UnoTunnelGetImplementation<SwXTextCursor>(xTunnel);
+ if (bParaBeforeInserted)
+ {
+ // todo: remove paragraph before frame
+ m_pImpl->m_pDoc->DelFullPara(*pFrameCursor->GetPaM());
+ }
+ if (bParaAfterInserted)
+ {
+ xFrameTextCursor->gotoEnd(sal_False);
+ m_pImpl->m_pDoc->DelFullPara(*pFrameCursor->GetPaM());
+ }
+ }
+
+ m_pImpl->m_pDoc->EndUndo(UNDO_END, NULL);
+ if (bIllegalException || bRuntimeException)
+ {
+ SwUndoIter aUndoIter( &aStartPam, UNDO_EMPTY );
+ m_pImpl->m_pDoc->Undo(aUndoIter);
+ if (bIllegalException)
+ {
+ lang::IllegalArgumentException aEx;
+ aEx.Message = sMessage;
+ throw aEx;
+ }
+ else //if(bRuntimeException)
+ {
+ uno::RuntimeException aEx;
+ aEx.Message = sMessage;
+ throw aEx;
+ }
+ }
+ return xRet;
+}
+
+/*-- 11.05.2006 15:46:26---------------------------------------------------
+ Move previously imported paragraphs into a new text table.
+
+ -----------------------------------------------------------------------*/
+struct VerticallyMergedCell
+{
+ std::vector<uno::Reference< beans::XPropertySet > > aCells;
+ sal_Int32 nLeftPosition;
+ bool bOpen;
+
+ VerticallyMergedCell(uno::Reference< beans::XPropertySet > const& rxCell,
+ const sal_Int32 nLeft)
+ : nLeftPosition( nLeft )
+ , bOpen( true )
+ {
+ aCells.push_back( rxCell );
+ }
+};
+#define COL_POS_FUZZY 2
+static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 )
+{
+ return abs( nPos1 - nPos2 ) < COL_POS_FUZZY;
+}
+
+void SwXText::copyText(
+ const uno::Reference< text::XTextCopy >& xSource )
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< lang::XUnoTunnel > xTTunnel( xSource, uno::UNO_QUERY_THROW );
+ SwXText* pText = 0;
+ pText = reinterpret_cast< SwXText* >(
+ sal::static_int_cast< sal_IntPtr >( xTTunnel->getSomething( SwXText::getUnoTunnelId()) ));
+
+ uno::Reference< text::XText > xText( xSource, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextCursor > xCursor = xText->createTextCursor( );
+ xCursor->gotoEnd( sal_True );
+
+ uno::Reference< lang::XUnoTunnel > xTunnel( xCursor, uno::UNO_QUERY_THROW );
+
+ OTextCursorHelper* pCursor = 0;
+ pCursor = reinterpret_cast< OTextCursorHelper* >(
+ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ if ( pCursor )
+ {
+ SwNodeIndex rNdIndex( *GetStartNode( ), 1 );
+ SwPosition rPos( rNdIndex );
+ m_pImpl->m_pDoc->CopyRange( *pCursor->GetPaM( ), rPos, false );
+ }
+}
+
+void SwXText::Impl::ConvertCell(
+ const bool bFirstCell,
+ const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
+ ::std::vector<SwNodeRange> & rRowNodes,
+ ::std::auto_ptr< SwPaM > & rpFirstPaM,
+ SwPaM & rLastPaM,
+ bool & rbExcept)
+{
+ if (rCell.getLength() != 2)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ const uno::Reference<text::XTextRange> xStartRange = rCell[0];
+ const uno::Reference<text::XTextRange> xEndRange = rCell[1];
+ SwUnoInternalPaM aStartCellPam(*m_pDoc);
+ SwUnoInternalPaM aEndCellPam(*m_pDoc);
+
+ // !!! TODO - PaMs in tables and sections do not work here -
+ // the same applies to PaMs in frames !!!
+
+ if (!::sw::XTextRangeToSwPaM(aStartCellPam, xStartRange) ||
+ !::sw::XTextRangeToSwPaM(aEndCellPam, xEndRange))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SwNodeRange aTmpRange(aStartCellPam.Start()->nNode,
+ aEndCellPam.End()->nNode);
+ SwNodeRange * pCorrectedRange =
+ m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange);
+
+ if (pCorrectedRange != NULL)
+ {
+ SwPaM aNewStartPaM(pCorrectedRange->aStart, 0);
+ aStartCellPam = aNewStartPaM;
+
+ xub_StrLen nEndLen = 0;
+ SwTxtNode * pTxtNode = pCorrectedRange->aEnd.GetNode().GetTxtNode();
+ if (pTxtNode != NULL)
+ nEndLen = pTxtNode->Len();
+
+ SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen);
+ aEndCellPam = aNewEndPaM;
+ }
+
+ /** check the nodes between start and end
+ it is allowed to have pairs of StartNode/EndNodes
+ */
+ if (aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode)
+ {
+ // increment on each StartNode and decrement on each EndNode
+ // we must reach zero at the end and must not go below zero
+ long nOpenNodeBlock = 0;
+ SwNodeIndex aCellIndex = aStartCellPam.Start()->nNode;
+ while (aCellIndex < aEndCellPam.End()->nNode.GetIndex())
+ {
+ if (aCellIndex.GetNode().IsStartNode())
+ {
+ ++nOpenNodeBlock;
+ }
+ else if (aCellIndex.GetNode().IsEndNode())
+ {
+ --nOpenNodeBlock;
+ }
+ if (nOpenNodeBlock < 0)
+ {
+ rbExcept = true;
+ break;
+ }
+ ++aCellIndex;
+ }
+ if (nOpenNodeBlock != 0)
+ {
+ rbExcept = true;
+ return;
+ }
+ }
+
+ /** The vector<vector> NodeRanges has to contain consecutive nodes.
+ In rTableRanges the ranges don't need to be full paragraphs but
+ they have to follow each other. To process the ranges they
+ have to be aligned on paragraph borders by inserting paragraph
+ breaks. Non-consecutive ranges must initiate an exception.
+ */
+ if (bFirstCell)
+ {
+ // align the beginning - if necessary
+ if (aStartCellPam.Start()->nContent.GetIndex())
+ {
+ m_pDoc->SplitNode(*aStartCellPam.Start(), sal_False);
+ }
+ }
+ else
+ {
+ // check the predecessor
+ const ULONG nLastNodeIndex = rLastPaM.End()->nNode.GetIndex();
+ const ULONG nStartCellNodeIndex =
+ aStartCellPam.Start()->nNode.GetIndex();
+ const ULONG nLastNodeEndIndex = rLastPaM.End()->nNode.GetIndex();
+ if (nLastNodeIndex == nStartCellNodeIndex)
+ {
+ // same node as predecessor then equal nContent?
+ if (rLastPaM.End()->nContent != aStartCellPam.Start()->nContent)
+ {
+ rbExcept = true;
+ }
+ else
+ {
+ m_pDoc->SplitNode(*aStartCellPam.Start(), sal_False);
+ }
+ }
+ else if (nStartCellNodeIndex == (nLastNodeEndIndex + 1))
+ {
+ // next paragraph - now the content index of the new should be 0
+ // and of the old one should be equal to the text length
+ // but if it isn't we don't care - the cell is being inserted on
+ // the node border anyway
+ }
+ else
+ {
+ rbExcept = true;
+ }
+ }
+ // now check if there's a need to insert another paragraph break
+ if (aEndCellPam.End()->nContent.GetIndex() <
+ aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len())
+ {
+ m_pDoc->SplitNode(*aEndCellPam.End(), sal_False);
+ // take care that the new start/endcell is moved to the right position
+ // aStartCellPam has to point to the start of the new (previous) node
+ // aEndCellPam has to point to the end of the new (previous) node
+ aStartCellPam.DeleteMark();
+ aStartCellPam.Move(fnMoveBackward, fnGoNode);
+ aStartCellPam.GetPoint()->nContent = 0;
+ aEndCellPam.DeleteMark();
+ aEndCellPam.Move(fnMoveBackward, fnGoNode);
+ aEndCellPam.GetPoint()->nContent =
+ aEndCellPam.GetNode()->GetTxtNode()->Len();
+ }
+
+ *rLastPaM.GetPoint() = *aEndCellPam.Start();
+ if (aStartCellPam.HasMark())
+ {
+ rLastPaM.SetMark();
+ *rLastPaM.GetMark() = *aEndCellPam.End();
+ }
+ else
+ {
+ rLastPaM.DeleteMark();
+ }
+
+ SwNodeRange aCellRange(aStartCellPam.Start()->nNode,
+ aEndCellPam.End()->nNode);
+ rRowNodes.push_back(aCellRange);
+ if (bFirstCell)
+ {
+ rpFirstPaM.reset(new SwPaM(*aStartCellPam.Start()));
+ }
+}
+
+typedef uno::Sequence< text::TableColumnSeparator > TableColumnSeparators;
+
+static void
+lcl_ApplyRowProperties(
+ uno::Sequence<beans::PropertyValue> const& rRowProperties,
+ uno::Any const& rRow,
+ TableColumnSeparators & rRowSeparators)
+{
+ uno::Reference< beans::XPropertySet > xRow;
+ rRow >>= xRow;
+ const beans::PropertyValue* pProperties = rRowProperties.getConstArray();
+ for (sal_Int32 nProperty = 0; nProperty < rRowProperties.getLength();
+ ++nProperty)
+ {
+ if (pProperties[ nProperty ].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("TableColumnSeparators")))
+ {
+ // add the separators to access the cell's positions
+ // for vertical merging later
+ TableColumnSeparators aSeparators;
+ pProperties[ nProperty ].Value >>= aSeparators;
+ rRowSeparators = aSeparators;
+ }
+ xRow->setPropertyValue(
+ pProperties[ nProperty ].Name, pProperties[ nProperty ].Value);
+ }
+}
+
+#ifdef DEBUG
+//-->debug cell properties of all rows
+static void
+lcl_DebugCellProperties(
+ const uno::Sequence< uno::Sequence< uno::Sequence<
+ beans::PropertyValue > > >& rCellProperties)
+{
+ ::rtl::OUString sNames;
+ for (sal_Int32 nDebugRow = 0; nDebugRow < rCellProperties.getLength();
+ ++nDebugRow)
+ {
+ const uno::Sequence< beans::PropertyValues > aDebugCurrentRow =
+ rCellProperties[nDebugRow];
+ sal_Int32 nDebugCells = aDebugCurrentRow.getLength();
+ (void) nDebugCells;
+ for (sal_Int32 nDebugCell = 0; nDebugCell < nDebugCells;
+ ++nDebugCell)
+ {
+ const uno::Sequence< beans::PropertyValue >&
+ rDebugCellProperties = aDebugCurrentRow[nDebugCell];
+ const sal_Int32 nDebugCellProperties =
+ rDebugCellProperties.getLength();
+ for (sal_Int32 nDebugProperty = 0;
+ nDebugProperty < nDebugCellProperties; ++nDebugProperty)
+ {
+ const ::rtl::OUString sName =
+ rDebugCellProperties[nDebugProperty].Name;
+ sNames += sName;
+ sNames += ::rtl::OUString('-');
+ }
+ sNames += ::rtl::OUString('+');
+ }
+ sNames += ::rtl::OUString('|');
+ }
+ (void)sNames;
+}
+//--<
+#endif
+
+
+static void
+lcl_ApplyCellProperties(
+ const sal_Int32 nCell,
+ TableColumnSeparators const& rRowSeparators,
+ const uno::Sequence< beans::PropertyValue >& rCellProperties,
+ uno::Reference< uno::XInterface > xCell,
+ ::std::vector<VerticallyMergedCell> & rMergedCells)
+{
+ const sal_Int32 nCellProperties = rCellProperties.getLength();
+ const uno::Reference< beans::XPropertySet > xCellPS(xCell, uno::UNO_QUERY);
+ for (sal_Int32 nProperty = 0; nProperty < nCellProperties; ++nProperty)
+ {
+ const OUString & rName = rCellProperties[nProperty].Name;
+ const uno::Any & rValue = rCellProperties[nProperty].Value;
+ if (rName.equalsAscii("VerticalMerge"))
+ {
+ // determine left border position
+ // add the cell to a queue of merged cells
+ sal_Bool bMerge = sal_False;
+ rValue >>= bMerge;
+ sal_Int32 nLeftPos = -1;
+ if (!nCell)
+ {
+ nLeftPos = 0;
+ }
+ else if (rRowSeparators.getLength() >= nCell)
+ {
+ const text::TableColumnSeparator* pSeparators =
+ rRowSeparators.getConstArray();
+ nLeftPos = pSeparators[nCell - 1].Position;
+ }
+ if (bMerge)
+ {
+ // 'close' all the cell with the same left position
+ // if separate vertical merges in the same column exist
+ if (rMergedCells.size())
+ {
+ std::vector<VerticallyMergedCell>::iterator aMergedIter =
+ rMergedCells.begin();
+ while (aMergedIter != rMergedCells.end())
+ {
+ if (lcl_SimilarPosition(aMergedIter->nLeftPosition,
+ nLeftPos))
+ {
+ aMergedIter->bOpen = false;
+ }
+ ++aMergedIter;
+ }
+ }
+ // add the new group of merged cells
+ rMergedCells.push_back(VerticallyMergedCell(xCellPS, nLeftPos));
+ }
+ else
+ {
+ // find the cell that
+ DBG_ASSERT(rMergedCells.size(),
+ "the first merged cell is missing");
+ if (rMergedCells.size())
+ {
+ std::vector<VerticallyMergedCell>::iterator aMergedIter =
+ rMergedCells.begin();
+#if OSL_DEBUG_LEVEL > 1
+ bool bDbgFound = false;
+#endif
+ while (aMergedIter != rMergedCells.end())
+ {
+ if (aMergedIter->bOpen &&
+ lcl_SimilarPosition(aMergedIter->nLeftPosition,
+ nLeftPos))
+ {
+ aMergedIter->aCells.push_back( xCellPS );
+#if OSL_DEBUG_LEVEL > 1
+ bDbgFound = true;
+#endif
+ }
+ ++aMergedIter;
+ }
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ASSERT( bDbgFound,
+ "couldn't find first vertically merged cell" );
+#endif
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ xCellPS->setPropertyValue(rName, rValue);
+ }
+ catch (uno::Exception const& e)
+ {
+ // Apply the paragraph and char properties to the cell's content
+ const uno::Reference< text::XText > xCellText(xCell,
+ uno::UNO_QUERY);
+ const uno::Reference< text::XTextCursor > xCellCurs =
+ xCellText->createTextCursor();
+ xCellCurs->gotoStart( sal_False );
+ xCellCurs->gotoEnd( sal_True );
+ const uno::Reference< beans::XPropertySet > xCellTextProps(
+ xCellCurs, uno::UNO_QUERY);
+ xCellTextProps->setPropertyValue(rName, rValue);
+ }
+ }
+ }
+}
+
+static void
+lcl_MergeCells(::std::vector<VerticallyMergedCell> & rMergedCells)
+{
+ if (rMergedCells.size())
+ {
+ std::vector<VerticallyMergedCell>::iterator aMergedIter =
+ rMergedCells.begin();
+ while (aMergedIter != rMergedCells.end())
+ {
+ sal_Int32 nCellCount =
+ static_cast<sal_Int32>(aMergedIter->aCells.size());
+ std::vector<uno::Reference< beans::XPropertySet > >::iterator
+ aCellIter = aMergedIter->aCells.begin();
+ bool bFirstCell = true;
+ // the first of the cells gets the number of cells set as RowSpan
+ // the others get the inverted number of remaining merged cells
+ // (3,-2,-1)
+ while (aCellIter != aMergedIter->aCells.end())
+ {
+ (*aCellIter)->setPropertyValue(
+ C2U(SW_PROP_NAME_STR(UNO_NAME_ROW_SPAN)),
+ uno::makeAny(nCellCount));
+ if (bFirstCell)
+ {
+ nCellCount *= -1;
+ bFirstCell = false;
+ }
+ ++nCellCount;
+ ++aCellIter;
+ }
+ ++aMergedIter;
+ }
+ }
+}
+
+uno::Reference< text::XTextTable > SAL_CALL
+SwXText::convertToTable(
+ const uno::Sequence< uno::Sequence< uno::Sequence<
+ uno::Reference< text::XTextRange > > > >& rTableRanges,
+ const uno::Sequence< uno::Sequence< uno::Sequence<
+ beans::PropertyValue > > >& rCellProperties,
+ const uno::Sequence< uno::Sequence< beans::PropertyValue > >&
+ rRowProperties,
+ const uno::Sequence< beans::PropertyValue >& rTableProperties)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ {
+ throw uno::RuntimeException();
+ }
+
+ //at first collect the text ranges as SwPaMs
+ const uno::Sequence< uno::Sequence< uno::Reference< text::XTextRange > > >*
+ pTableRanges = rTableRanges.getConstArray();
+ std::auto_ptr < SwPaM > pFirstPaM;
+ std::vector< std::vector<SwNodeRange> > aTableNodes;
+ bool bExcept = false;
+ SwPaM aLastPaM(m_pImpl->m_pDoc->GetNodes());
+ for (sal_Int32 nRow = 0; !bExcept && (nRow < rTableRanges.getLength());
+ ++nRow)
+ {
+ std::vector<SwNodeRange> aRowNodes;
+ const uno::Sequence< uno::Reference< text::XTextRange > >* pRow =
+ pTableRanges[nRow].getConstArray();
+ const sal_Int32 nCells(pTableRanges[nRow].getLength());
+
+ for (sal_Int32 nCell = 0; nCell < nCells; ++nCell)
+ {
+ m_pImpl->ConvertCell((nCell == 0) && (nRow == 0), pRow[nCell],
+ aRowNodes, pFirstPaM, aLastPaM, bExcept);
+ }
+ aTableNodes.push_back(aRowNodes);
+ }
+
+ if(bExcept)
+ {
+ SwUndoIter aUndoIter( &aLastPaM, UNDO_EMPTY );
+ m_pImpl->m_pDoc->Undo(aUndoIter);
+ throw lang::IllegalArgumentException();
+ }
+
+ std::vector< TableColumnSeparators >
+ aRowSeparators(rRowProperties.getLength());
+ std::vector<VerticallyMergedCell> aMergedCells;
+
+ SwTable const*const pTable = m_pImpl->m_pDoc->TextToTable( aTableNodes );
+ SwXTextTable *const pTextTable = new SwXTextTable( *pTable->GetFrmFmt() );
+ const uno::Reference< text::XTextTable > xRet = pTextTable;
+ const uno::Reference< beans::XPropertySet > xPrSet = pTextTable;
+ // set properties to the table
+ // catch lang::WrappedTargetException and lang::IndexOutOfBoundsException
+ try
+ {
+ //apply table properties
+ const beans::PropertyValue* pTableProperties =
+ rTableProperties.getConstArray();
+ for (sal_Int32 nProperty = 0; nProperty < rTableProperties.getLength();
+ ++nProperty)
+ {
+ try
+ {
+ xPrSet->setPropertyValue( pTableProperties[nProperty].Name,
+ pTableProperties[nProperty].Value );
+ }
+ catch ( uno::Exception const& e )
+ {
+#if DEBUG
+ std::clog << "Exception when setting property: ";
+ std::clog << rtl::OUStringToOString(
+ pTableProperties[nProperty].Name, RTL_TEXTENCODING_UTF8)
+ .getStr();
+ std::clog << ". Message: ";
+ std::clog << rtl::OUStringToOString( e.Message,
+ RTL_TEXTENCODING_UTF8 ).getStr();
+ std::clog << std::endl;
+#endif
+ }
+ }
+
+ //apply row properties
+ const uno::Reference< table::XTableRows > xRows = xRet->getRows();
+
+ const beans::PropertyValues* pRowProperties =
+ rRowProperties.getConstArray();
+ for (sal_Int32 nRow = 0; nRow < xRows->getCount(); ++nRow)
+ {
+ if( nRow >= rRowProperties.getLength())
+ {
+ break;
+ }
+ lcl_ApplyRowProperties(pRowProperties[nRow],
+ xRows->getByIndex(nRow), aRowSeparators[nRow]);
+ }
+
+#ifdef DEBUG
+ lcl_DebugCellProperties(rCellProperties);
+#endif
+
+ //apply cell properties
+ for (sal_Int32 nRow = 0; nRow < rCellProperties.getLength(); ++nRow)
+ {
+ const uno::Sequence< beans::PropertyValues > aCurrentRow =
+ rCellProperties[nRow];
+ sal_Int32 nCells = aCurrentRow.getLength();
+ for (sal_Int32 nCell = 0; nCell < nCells; ++nCell)
+ {
+ lcl_ApplyCellProperties(nCell,
+ aRowSeparators[nRow], aCurrentRow[nCell],
+ pTextTable->getCellByPosition(nCell, nRow),
+ aMergedCells);
+ }
+ }
+ // now that the cell properties are set the vertical merge values
+ // have to be applied
+ lcl_MergeCells(aMergedCells);
+ }
+ catch( const lang::WrappedTargetException& rWrapped )
+ {
+ (void)rWrapped;
+ }
+ catch ( const lang::IndexOutOfBoundsException& rBounds )
+ {
+ (void)rBounds;
+ }
+
+ return xRet;
+}
+
+/******************************************************************
+ * SwXBodyText
+ ******************************************************************/
+SwXBodyText::SwXBodyText(SwDoc *const pDoc)
+ : SwXText(pDoc, CURSOR_BODY)
+{
+}
+
+/*-- 10.12.98 11:17:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXBodyText::~SwXBodyText()
+{
+
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXBodyText::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXBodyText");
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesBodyText[] =
+{
+ "com.sun.star.text.Text",
+};
+static const size_t g_nServicesBodyText(
+ sizeof(g_ServicesBodyText)/sizeof(g_ServicesBodyText[0]));
+
+sal_Bool SAL_CALL SwXBodyText::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesBodyText, g_ServicesBodyText, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXBodyText::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesBodyText, g_ServicesBodyText);
+}
+
+/*-- 10.12.98 11:17:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXBodyText::queryAggregation(const uno::Type& rType)
+throw (uno::RuntimeException)
+{
+ uno::Any aRet;
+ if (rType == container::XEnumerationAccess::static_type())
+ {
+ aRet <<= uno::Reference< container::XEnumerationAccess >(this);
+ }
+ else if (rType == container::XElementAccess::static_type())
+ {
+ aRet <<= uno::Reference< container::XElementAccess >(this);
+ }
+ else if (rType == lang::XServiceInfo::static_type())
+ {
+ aRet <<= uno::Reference< lang::XServiceInfo >(this);
+ }
+ else
+ {
+ aRet = SwXText::queryInterface( rType );
+ }
+ if(aRet.getValueType() == ::getCppuVoidType())
+ {
+ aRet = OWeakAggObject::queryAggregation( rType );
+ }
+ return aRet;
+}
+
+/*-- 10.12.98 11:17:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL
+SwXBodyText::getTypes() throw (uno::RuntimeException)
+{
+ const uno::Sequence< uno::Type > aTypes = SwXBodyText_Base::getTypes();
+ const uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+ return ::comphelper::concatSequences(aTypes, aTextTypes);
+}
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL
+SwXBodyText::getImplementationId() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/*-- 10.12.98 11:17:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXBodyText::queryInterface(const uno::Type& rType)
+throw (uno::RuntimeException)
+{
+ const uno::Any ret = SwXText::queryInterface(rType);
+ return (ret.getValueType() == ::getCppuVoidType())
+ ? SwXBodyText_Base::queryInterface(rType)
+ : ret;
+}
+/* -----------------------------05.01.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextCursor * SwXBodyText::CreateTextCursor(const bool bIgnoreTables)
+{
+ if(!IsValid())
+ {
+ return 0;
+ }
+
+ // the cursor has to skip tables contained in this text
+ SwPaM aPam(GetDoc()->GetNodes().GetEndOfContent());
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ if (!bIgnoreTables)
+ {
+ SwTableNode * pTblNode = aPam.GetNode()->FindTableNode();
+ SwCntntNode * pCont = 0;
+ while (pTblNode)
+ {
+ aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if (pCont)
+ {
+ aPam.GetPoint()->nContent.Assign(pCont, 0);
+ }
+ }
+ return new SwXTextCursor(*GetDoc(), this, CURSOR_BODY, *aPam.GetPoint());
+}
+
+/*-- 10.12.98 11:17:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXBodyText::createTextCursor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const uno::Reference< text::XTextCursor > xRef(
+ static_cast<text::XWordCursor*>(CreateTextCursor(false)) );
+ if (!xRef.is())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ return xRef;
+}
+/*-- 10.12.98 11:17:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXBodyText::createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & xTextPosition)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!IsValid())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ uno::Reference< text::XTextCursor > aRef;
+ SwUnoInternalPaM aPam(*GetDoc());
+ if (::sw::XTextRangeToSwPaM(aPam, xTextPosition))
+ {
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+
+ SwStartNode* p1 = aPam.GetNode()->StartOfSectionNode();
+ //document starts with a section?
+ while(p1->IsSectionNode())
+ {
+ p1 = p1->StartOfSectionNode();
+ }
+ SwStartNode *const p2 = rNode.StartOfSectionNode();
+
+ if(p1 == p2)
+ {
+ aRef = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), this, CURSOR_BODY,
+ *aPam.GetPoint(), aPam.GetMark()));
+ }
+ }
+ if(!aRef.is())
+ {
+ throw uno::RuntimeException();
+ }
+ return aRef;
+}
+
+/*-- 10.12.98 11:17:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXBodyText::createEnumeration()
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!IsValid())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+ SwPosition aPos(rNode);
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(aPos, sal_False));
+ pUnoCursor->Move(fnMoveBackward, fnGoDoc);
+ const uno::Reference< container::XEnumeration > xRet
+ = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_BODY);
+ return xRet;
+}
+
+/* -----------------18.12.98 13:36-------------------
+ *
+ * --------------------------------------------------*/
+uno::Type SAL_CALL
+SwXBodyText::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+/* -----------------18.12.98 13:36-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SAL_CALL
+SwXBodyText::hasElements() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (!IsValid())
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ return sal_True;
+}
+
+/******************************************************************
+ * SwXHeadFootText
+ ******************************************************************/
+
+class SwXHeadFootText::Impl
+ : public SwClient
+{
+
+public:
+
+ bool m_bIsHeader;
+
+ Impl( SwXHeadFootText & /*rThis*/,
+ SwFrmFmt & rHeadFootFmt, const bool bIsHeader)
+ : SwClient(& rHeadFootFmt)
+ , m_bIsHeader(bIsHeader)
+ {
+ }
+
+ SwFrmFmt * GetHeadFootFmt() const {
+ return static_cast<SwFrmFmt*>(
+ const_cast<SwModify*>(GetRegisteredIn()));
+ }
+
+ SwFrmFmt & GetHeadFootFmtOrThrow() {
+ SwFrmFmt *const pFmt( GetHeadFootFmt() );
+ if (!pFmt) {
+ throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXHeadFootText: disposed or invalid")), 0);
+ }
+ return *pFmt;
+ }
+
+ // SwClient
+ virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
+
+};
+
+/*-- 11.12.98 10:14:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXHeadFootText::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+bool SwXHeadFootText::IsXHeadFootText(SwClient *const pClient)
+{
+ return 0 != dynamic_cast<SwXHeadFootText::Impl*>(pClient);
+}
+
+uno::Reference< text::XText >
+SwXHeadFootText::CreateXHeadFootText(
+ SwFrmFmt & rHeadFootFmt, const bool bIsHeader)
+{
+ // re-use existing SwXHeadFootText
+ // #i105557#: do not iterate over the registered clients: race condition
+ uno::Reference< text::XText > xText(rHeadFootFmt.GetXObject(),
+ uno::UNO_QUERY);
+ if (!xText.is())
+ {
+ SwXHeadFootText *const pXHFT(
+ new SwXHeadFootText(rHeadFootFmt, bIsHeader));
+ xText.set(pXHFT);
+ rHeadFootFmt.SetXObject(xText);
+ }
+ return xText;
+}
+
+/*-- 11.12.98 10:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXHeadFootText::SwXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader)
+ : SwXText(rHeadFootFmt.GetDoc(),
+ (bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER)
+ , m_pImpl( new SwXHeadFootText::Impl(*this, rHeadFootFmt, bIsHeader) )
+{
+}
+
+/*-- 11.12.98 10:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXHeadFootText::~SwXHeadFootText()
+{
+}
+
+/* -----------------------------06.04.00 16:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL
+SwXHeadFootText::getImplementationName() throw (uno::RuntimeException)
+{
+ return C2U("SwXHeadFootText");
+}
+
+/* -----------------------------06.04.00 16:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static char const*const g_ServicesHeadFootText[] =
+{
+ "com.sun.star.text.Text",
+};
+static const size_t g_nServicesHeadFootText(
+ sizeof(g_ServicesHeadFootText)/sizeof(g_ServicesHeadFootText[0]));
+
+sal_Bool SAL_CALL SwXHeadFootText::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
+{
+ return ::sw::SupportsServiceImpl(
+ g_nServicesHeadFootText, g_ServicesHeadFootText, rServiceName);
+}
+
+uno::Sequence< OUString > SAL_CALL
+SwXHeadFootText::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesHeadFootText, g_ServicesHeadFootText);
+}
+
+/*-- 11.12.98 10:14:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwStartNode *SwXHeadFootText::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+ SwFrmFmt *const pHeadFootFmt = m_pImpl->GetHeadFootFmt();
+ if(pHeadFootFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ if( rFlyCntnt.GetCntntIdx() )
+ {
+ pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
+ }
+ }
+ return pSttNd;
+}
+
+uno::Reference< text::XTextCursor >
+SwXHeadFootText::CreateCursor() throw (uno::RuntimeException)
+{
+ return createTextCursor();
+}
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL
+SwXHeadFootText::getTypes() throw (uno::RuntimeException)
+{
+ const uno::Sequence< uno::Type > aTypes = SwXHeadFootText_Base::getTypes();
+ const uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+ return ::comphelper::concatSequences(aTypes, aTextTypes);
+}
+
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL
+SwXHeadFootText::getImplementationId() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static uno::Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------21.03.00 15:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SAL_CALL
+SwXHeadFootText::queryInterface(const uno::Type& rType)
+throw (uno::RuntimeException)
+{
+ const uno::Any ret = SwXHeadFootText_Base::queryInterface(rType);
+ return (ret.getValueType() == ::getCppuVoidType())
+ ? SwXText::queryInterface(rType)
+ : ret;
+}
+
+/*-- 11.12.98 10:14:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXHeadFootText::createTextCursor() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFrmFmt & rHeadFootFmt( m_pImpl->GetHeadFootFmtOrThrow() );
+
+ uno::Reference< text::XTextCursor > xRet;
+ const SwFmtCntnt& rFlyCntnt = rHeadFootFmt.GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ SwPosition aPos(rNode);
+ SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this,
+ (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER, aPos);
+ SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+
+ // save current start node to be able to check if there is content
+ // after the table - otherwise the cursor would be in the body text!
+ SwStartNode const*const pOwnStartNode = rNode.FindSttNodeByType(
+ (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode);
+ // is there a table here?
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while (pTblNode)
+ {
+ pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if (pCont)
+ {
+ pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
+ }
+ SwStartNode const*const pNewStartNode =
+ pUnoCrsr->GetNode()->FindSttNodeByType(
+ (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode);
+ if (!pNewStartNode || (pNewStartNode != pOwnStartNode))
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = S2U("no text available");
+ throw aExcept;
+ }
+ xRet = static_cast<text::XWordCursor*>(pXCursor);
+ return xRet;
+}
+
+/*-- 11.12.98 10:14:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SAL_CALL
+SwXHeadFootText::createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & xTextPosition)
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFrmFmt & rHeadFootFmt( m_pImpl->GetHeadFootFmtOrThrow() );
+
+ SwUnoInternalPaM aPam(*GetDoc());
+ if (!::sw::XTextRangeToSwPaM(aPam, xTextPosition))
+ {
+ uno::RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ uno::Reference< text::XTextCursor > xRet;
+ SwNode& rNode = rHeadFootFmt.GetCntnt().GetCntntIdx()->GetNode();
+ SwPosition aPos(rNode);
+ SwPaM aHFPam(aPos);
+ aHFPam.Move(fnMoveForward, fnGoNode);
+ SwStartNode *const pOwnStartNode = aHFPam.GetNode()->FindSttNodeByType(
+ (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode);
+ SwStartNode *const p1 = aPam.GetNode()->FindSttNodeByType(
+ (m_pImpl->m_bIsHeader) ? SwHeaderStartNode : SwFooterStartNode);
+ if (p1 == pOwnStartNode)
+ {
+ xRet = static_cast<text::XWordCursor*>(
+ new SwXTextCursor(*GetDoc(), this,
+ (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER,
+ *aPam.GetPoint(), aPam.GetMark()));
+ }
+ return xRet;
+}
+
+/* -----------------19.03.99 15:44-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< container::XEnumeration > SAL_CALL
+SwXHeadFootText::createEnumeration()
+throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ SwFrmFmt & rHeadFootFmt( m_pImpl->GetHeadFootFmtOrThrow() );
+
+ uno::Reference< container::XEnumeration > aRef;
+ const SwFmtCntnt& rFlyCntnt = rHeadFootFmt.GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ SwPosition aPos(rNode);
+ ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
+ GetDoc()->CreateUnoCrsr(aPos, sal_False));
+ pUnoCursor->Move(fnMoveForward, fnGoNode);
+ aRef = new SwXParagraphEnumeration(this, pUnoCursor,
+ (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER);
+
+ return aRef;
+}
+
+/* -----------------19.03.99 15:50-------------------
+ *
+ * --------------------------------------------------*/
+uno::Type SAL_CALL
+SwXHeadFootText::getElementType() throw (uno::RuntimeException)
+{
+ return text::XTextRange::static_type();
+}
+/* -----------------19.03.99 15:50-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SAL_CALL SwXHeadFootText::hasElements() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
new file mode 100644
index 000000000000..a02085f261b6
--- /dev/null
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_sw.hxx"
+#include <unotextmarkup.hxx>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <SwSmartTagMgr.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+#include <com/sun/star/text/TextMarkupDescriptor.hpp>
+#include <com/sun/star/container/XStringKeyMap.hpp>
+#include <ndtxt.hxx>
+#include <SwGrammarMarkUp.hxx>
+
+#include <IGrammarContact.hxx>
+
+using namespace ::com::sun::star;
+
+/*
+ * SwXTextMarkup
+ */
+SwXTextMarkup::SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper::ConversionMap* pMap )
+ : mpTxtNode( &rTxtNode ), mpConversionMap( pMap )
+{
+ mpTxtNode->Add(this);
+}
+
+SwXTextMarkup::~SwXTextMarkup()
+{
+ delete mpConversionMap;
+}
+
+uno::Reference< container::XStringKeyMap > SAL_CALL SwXTextMarkup::getMarkupInfoContainer() throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< container::XStringKeyMap > xProp = new SwXStringKeyMap;
+ return xProp;
+}
+
+void SAL_CALL SwXTextMarkup::commitTextMarkup(
+ ::sal_Int32 nType,
+ const ::rtl::OUString & rIdentifier,
+ ::sal_Int32 nStart,
+ ::sal_Int32 nLength,
+ const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // paragraph already dead or modified?
+ if ( !mpTxtNode || nLength <= 0 )
+ return;
+
+ if ( nType == text::TextMarkupType::SMARTTAG &&
+ !SwSmartTagMgr::Get().IsSmartTagTypeEnabled( rIdentifier ) )
+ return;
+
+ // get appropriate list to use...
+ SwWrongList* pWList = 0;
+ bool bRepaint = false;
+ if ( nType == text::TextMarkupType::SPELLCHECK )
+ {
+ pWList = mpTxtNode->GetWrong();
+ if ( !pWList )
+ {
+ pWList = new SwWrongList( WRONGLIST_SPELL );
+ mpTxtNode->SetWrong( pWList );
+ }
+ }
+ else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
+ {
+ IGrammarContact *pGrammarContact = getGrammarContact( *mpTxtNode );
+ if( pGrammarContact )
+ {
+ pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true );
+ ASSERT( pWList, "GrammarContact _has_ to deliver a wrong list" )
+ }
+ else
+ {
+ pWList = mpTxtNode->GetGrammarCheck();
+ if ( !pWList )
+ {
+ mpTxtNode->SetGrammarCheck( new SwGrammarMarkUp() );
+ pWList = mpTxtNode->GetGrammarCheck();
+ }
+ }
+ bRepaint = pWList == mpTxtNode->GetGrammarCheck();
+ if( pWList->GetBeginInv() < STRING_LEN )
+ ((SwGrammarMarkUp*)pWList)->ClearGrammarList();
+ }
+ else if ( nType == text::TextMarkupType::SMARTTAG )
+ {
+ pWList = mpTxtNode->GetSmartTags();
+ if ( !pWList )
+ {
+ pWList = new SwWrongList( WRONGLIST_SMARTTAG );
+ mpTxtNode->SetSmartTags( pWList );
+ }
+ }
+ else
+ {
+ ASSERT( false, "Unknown mark-up type" )
+ return;
+ }
+
+
+ const ModelToViewHelper::ModelPosition aStartPos =
+ ModelToViewHelper::ConvertToModelPosition( mpConversionMap, nStart );
+ const ModelToViewHelper::ModelPosition aEndPos =
+ ModelToViewHelper::ConvertToModelPosition( mpConversionMap, nStart + nLength - 1);
+
+ const bool bStartInField = aStartPos.mbIsField;
+ const bool bEndInField = aEndPos.mbIsField;
+ bool bCommit = false;
+
+ if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
+ {
+ nStart = aStartPos.mnSubPos;
+ const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel );
+
+ SwWrongList* pSubList = pWList->SubList( nInsertPos );
+ if ( !pSubList )
+ {
+ if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
+ pSubList = new SwGrammarMarkUp();
+ else
+ pSubList = new SwWrongList( pWList->GetWrongListType() );
+ pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
+ }
+
+ pWList = pSubList;
+ bCommit = true;
+ }
+ else if ( !bStartInField && !bEndInField )
+ {
+ nStart = aStartPos.mnPos;
+ bCommit = true;
+ nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
+ }
+ else if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
+ {
+ bCommit = true;
+ nStart = aStartPos.mnPos;
+ sal_Int32 nEnd = aEndPos.mnPos;
+ if( bStartInField && nType != text::TextMarkupType::SENTENCE )
+ {
+ const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel );
+ SwWrongList* pSubList = pWList->SubList( nInsertPos );
+ if ( !pSubList )
+ {
+ pSubList = new SwGrammarMarkUp();
+ pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
+ }
+ const sal_uInt32 nTmpStart = ModelToViewHelper::ConvertToViewPosition( mpConversionMap, aStartPos.mnPos );
+ const sal_uInt32 nTmpLen = ModelToViewHelper::ConvertToViewPosition( mpConversionMap, aStartPos.mnPos + 1 )
+ - nTmpStart - aStartPos.mnSubPos;
+ if( nTmpLen > 0 )
+ {
+ if( nType == text::TextMarkupType::SENTENCE )
+ {
+ ((SwGrammarMarkUp*)pSubList)->setSentence( static_cast< xub_StrLen >(aStartPos.mnSubPos) );
+ bCommit = false;
+ }
+ else
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer,
+ static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) );
+ }
+ ++nStart;
+ }
+ if( bEndInField && nType != text::TextMarkupType::SENTENCE )
+ {
+ const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos);
+ const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel );
+ SwWrongList* pSubList = pWList->SubList( nInsertPos );
+ if ( !pSubList )
+ {
+ pSubList = new SwGrammarMarkUp();
+ pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
+ }
+ const sal_uInt32 nTmpLen = aEndPos.mnSubPos + 1;
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) );
+ }
+ else
+ ++nEnd;
+ if( nEnd > nStart )
+ nLength = nEnd - nStart;
+ else
+ bCommit = false;
+ }
+
+ if ( bCommit )
+ {
+ if( nType == text::TextMarkupType::SENTENCE )
+ ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart) );
+ else
+ pWList->Insert( rIdentifier, xMarkupInfoContainer,
+ static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) );
+ }
+
+ if( bRepaint )
+ finishGrammarCheck( *mpTxtNode );
+}
+
+
+void lcl_commitGrammarMarkUp(
+ const ModelToViewHelper::ConversionMap* pConversionMap,
+ SwGrammarMarkUp* pWList,
+ ::sal_Int32 nType,
+ const ::rtl::OUString & rIdentifier,
+ ::sal_Int32 nStart,
+ ::sal_Int32 nLength,
+ const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
+{
+ ASSERT( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" )
+ const ModelToViewHelper::ModelPosition aStartPos =
+ ModelToViewHelper::ConvertToModelPosition( pConversionMap, nStart );
+ const ModelToViewHelper::ModelPosition aEndPos =
+ ModelToViewHelper::ConvertToModelPosition( pConversionMap, nStart + nLength - 1);
+
+ const bool bStartInField = aStartPos.mbIsField;
+ const bool bEndInField = aEndPos.mbIsField;
+ bool bCommit = false;
+
+ if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
+ {
+ nStart = aStartPos.mnSubPos;
+ const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel );
+
+ SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
+ if ( !pSubList )
+ {
+ pSubList = new SwGrammarMarkUp();
+ pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
+ }
+
+ pWList = pSubList;
+ bCommit = true;
+ }
+ else if ( !bStartInField && !bEndInField )
+ {
+ nStart = aStartPos.mnPos;
+ bCommit = true;
+ nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
+ }
+ else
+ {
+ bCommit = true;
+ nStart = aStartPos.mnPos;
+ sal_Int32 nEnd = aEndPos.mnPos;
+ if( bStartInField && nType != text::TextMarkupType::SENTENCE )
+ {
+ const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
+ const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel );
+ SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
+ if ( !pSubList )
+ {
+ pSubList = new SwGrammarMarkUp();
+ pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
+ }
+ const sal_uInt32 nTmpStart = ModelToViewHelper::ConvertToViewPosition( pConversionMap, aStartPos.mnPos );
+ const sal_uInt32 nTmpLen = ModelToViewHelper::ConvertToViewPosition( pConversionMap, aStartPos.mnPos + 1 )
+ - nTmpStart - aStartPos.mnSubPos;
+ if( nTmpLen > 0 )
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer,
+ static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) );
+ ++nStart;
+ }
+ if( bEndInField && nType != text::TextMarkupType::SENTENCE )
+ {
+ const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos);
+ const USHORT nInsertPos = pWList->GetWrongPos( nFieldPosModel );
+ SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
+ if ( !pSubList )
+ {
+ pSubList = new SwGrammarMarkUp();
+ pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
+ }
+ const sal_uInt32 nTmpLen = aEndPos.mnSubPos + 1;
+ pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) );
+ }
+ else
+ ++nEnd;
+ if( nEnd > nStart )
+ nLength = nEnd - nStart;
+ else
+ bCommit = false;
+ }
+
+ if ( bCommit )
+ {
+ if( nType == text::TextMarkupType::SENTENCE )
+ ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart+nLength) );
+ else
+ pWList->Insert( rIdentifier, xMarkupInfoContainer,
+ static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) );
+ }
+}
+
+
+void SAL_CALL SwXTextMarkup::commitMultiTextMarkup(
+ const uno::Sequence< text::TextMarkupDescriptor > &rMarkups )
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // paragraph already dead or modified?
+ if ( !mpTxtNode )
+ return;
+
+ // check for equal length of all sequnces
+ sal_Int32 nLen = rMarkups.getLength();
+
+ // for grammar checking there should be exactly one sentence markup
+ // and 0..n grammar markups.
+ // Different markups are not expected but may be applied anyway since
+ // that should be no problem...
+ // but it has to be implemented, at the moment only this function is for
+ // grammar markups and sentence markup only!
+ sal_Int32 nSentenceMarkUpIndex = -1;
+ const text::TextMarkupDescriptor *pMarkups = rMarkups.getConstArray();
+ sal_Int32 i;
+ for( i = 0; i < nLen; ++i )
+ {
+ if (pMarkups[i].nType == text::TextMarkupType::SENTENCE)
+ {
+ if (nSentenceMarkUpIndex == -1)
+ nSentenceMarkUpIndex = i;
+ else // there is already one sentence markup
+ throw lang::IllegalArgumentException();
+ }
+ else if( pMarkups[i].nType != text::TextMarkupType::PROOFREADING )
+ return;
+ }
+
+ if( nSentenceMarkUpIndex == -1 )
+ return;
+
+ // get appropriate list to use...
+ SwGrammarMarkUp* pWList = 0;
+ bool bRepaint = false;
+ IGrammarContact *pGrammarContact = getGrammarContact( *mpTxtNode );
+ if( pGrammarContact )
+ {
+ pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true );
+ ASSERT( pWList, "GrammarContact _has_ to deliver a wrong list" )
+ }
+ else
+ {
+ pWList = mpTxtNode->GetGrammarCheck();
+ if ( !pWList )
+ {
+ mpTxtNode->SetGrammarCheck( new SwGrammarMarkUp() );
+ pWList = mpTxtNode->GetGrammarCheck();
+ pWList->SetInvalid( 0, STRING_LEN );
+ }
+ }
+ bRepaint = pWList == mpTxtNode->GetGrammarCheck();
+
+ bool bAcceptGrammarError = false;
+ if( pWList->GetBeginInv() < STRING_LEN )
+ {
+ const ModelToViewHelper::ModelPosition aSentenceEnd =
+ ModelToViewHelper::ConvertToModelPosition( mpConversionMap,
+ pMarkups[nSentenceMarkUpIndex].nOffset + pMarkups[nSentenceMarkUpIndex].nLength );
+ bAcceptGrammarError = (xub_StrLen)aSentenceEnd.mnPos > pWList->GetBeginInv();
+ pWList->ClearGrammarList( (xub_StrLen)aSentenceEnd.mnPos );
+ }
+
+ if( bAcceptGrammarError )
+ {
+ for( i = 0; i < nLen; ++i )
+ {
+ const text::TextMarkupDescriptor &rDesc = pMarkups[i];
+ lcl_commitGrammarMarkUp( mpConversionMap, pWList, rDesc.nType,
+ rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
+ }
+ }
+ else
+ {
+ bRepaint = false;
+ i = nSentenceMarkUpIndex;
+ const text::TextMarkupDescriptor &rDesc = pMarkups[i];
+ lcl_commitGrammarMarkUp( mpConversionMap, pWList, rDesc.nType,
+ rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
+ }
+
+ if( bRepaint )
+ finishGrammarCheck( *mpTxtNode );
+
+ return;
+}
+
+
+void SwXTextMarkup::Modify( SfxPoolItem* /*pOld*/, SfxPoolItem* /*pNew*/ )
+{
+ // FME 2007-07-16 #i79641# In my opinion this is perfectly legal,
+ // therefore I remove the assertion in SwModify::_Remove()
+ if ( pRegisteredIn )
+ pRegisteredIn->Remove( this );
+ // <--
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ mpTxtNode = 0;
+}
+
+/*
+ * SwXStringKeyMap
+ */
+SwXStringKeyMap::SwXStringKeyMap()
+{
+}
+
+uno::Any SAL_CALL SwXStringKeyMap::getValue(const ::rtl::OUString & aKey) throw (uno::RuntimeException, container::NoSuchElementException)
+{
+ std::map< rtl::OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
+ if ( aIter == maMap.end() )
+ throw container::NoSuchElementException();
+
+ return (*aIter).second;
+}
+
+::sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const ::rtl::OUString & aKey) throw (uno::RuntimeException)
+{
+ return maMap.find( aKey ) != maMap.end();
+}
+
+void SAL_CALL SwXStringKeyMap::insertValue(const ::rtl::OUString & aKey, const uno::Any & aValue) throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException)
+{
+ std::map< rtl::OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
+ if ( aIter != maMap.end() )
+ throw container::ElementExistException();
+
+ maMap[ aKey ] = aValue;
+}
+
+::sal_Int32 SAL_CALL SwXStringKeyMap::getCount() throw (uno::RuntimeException)
+{
+ return maMap.size();
+}
+
+::rtl::OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ if ( (sal_uInt32)nIndex >= maMap.size() )
+ throw lang::IndexOutOfBoundsException();
+
+ return ::rtl::OUString();
+}
+
+uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ if ( (sal_uInt32)nIndex >= maMap.size() )
+ throw lang::IndexOutOfBoundsException();
+
+ return uno::Any();
+}
+