summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unosect.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore/unosect.cxx')
-rw-r--r--sw/source/core/unocore/unosect.cxx2381
1 files changed, 1317 insertions, 1064 deletions
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 690118cb81b3..d4ab7f081360 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -31,31 +31,29 @@
// 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 <svx/brshitem.hxx>
-#ifndef _SVX_XMLCNITEM_HXX
#include <svx/xmlcnitm.hxx>
-#endif
#include <sfx2/linkmgr.hxx>
#include <sfx2/lnkbase.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
#include <fmtclds.hxx>
-#include <unoobj.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>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <sfx2/docfile.hxx>
#include <docary.hxx>
#include <swundo.hxx>
@@ -65,189 +63,178 @@
#include <doctxm.hxx>
#include <fmtftntx.hxx>
#include <fmtclbl.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
+#include <fmtcntnt.hxx>
#include <svx/frmdiritem.hxx>
/* #109700# */
#include <svx/lrspitem.hxx>
+
using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
using ::rtl::OUString;
-TYPEINIT1(SwXTextSectionClient, SwClient);
-/*-- 20.12.2005 09:56:33---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SwXTextSectionClient::SwXTextSectionClient(
- SwSectionFmt& rFmt,
- SwXTextSection& rTextSection,
- uno::Reference< text::XTextSection > xSection ) :
- SwClient(&rFmt),
- m_pSection( &rTextSection ),
- m_xReference( xSection )
+/******************************************************************
+ *
+ ******************************************************************/
+struct SwTextSectionProperties_Impl
{
- m_pSection->SetClient( this );
-}
-/*-- 20.12.2005 09:56:33---------------------------------------------------
+ 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;
- -----------------------------------------------------------------------*/
-SwXTextSectionClient::~SwXTextSectionClient()
-{
- uno::Reference< text::XTextSection > xSection( m_xReference );
- if(xSection.is())
+ 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)
{
- m_pSection->SetClient( 0 );
}
-}
-/*-- 20.12.2005 09:56:35---------------------------------------------------
- -----------------------------------------------------------------------*/
-uno::Reference< text::XTextSection > SwXTextSectionClient::GetXTextSection()
-{
- return uno::Reference< text::XTextSection >( m_xReference );
-}
+};
-/*-- 29.12.2005 11:29:30---------------------------------------------------
- -----------------------------------------------------------------------*/
-/*SwXTextSection* SwXTextSectionClient::GetSwTextSection()
+class SwXTextSection::Impl
+ : public SwClient
{
- if( m_xReference.is() )
- return m_pSection;;
-} */
+
+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)
+ , m_bIsDescriptor(0 == pFmt)
+ , 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 SwXTextSectionClient::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+void SwXTextSection::Impl::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())
+ ClientModify(this, pOld, pNew);
+ if (!GetRegisteredIn())
{
- uno::Reference< text::XTextSection > xSection( m_xReference );
- if(xSection.is())
- {
- m_pSection->SetClient( 0 );
- m_pSection->aLstnrCntnr.Disposing();
- m_xReference = uno::Reference< text::XTextSection >();
-
- Application::PostUserEvent(
- STATIC_LINK( this, SwXTextSectionClient, RemoveSectionClient_Impl ), this );
- }
+ m_ListenerContainer.Disposing();
}
}
-/*-- 29.12.2005 13:04:57---------------------------------------------------
+/*-- 20.12.2005 10:27:33---------------------------------------------------
-----------------------------------------------------------------------*/
-IMPL_STATIC_LINK_NOINSTANCE( SwXTextSectionClient, RemoveSectionClient_Impl,
- SwXTextSectionClient*, pClient )
+SwSectionFmt * SwXTextSection::GetFmt() const
{
- delete pClient;
- return 0;
+ return m_pImpl->GetSectionFmt();
}
/*-- 20.12.2005 09:56:36---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< text::XTextSection > SwXTextSectionClient::CreateXTextSection(
- SwSectionFmt* pFmt, BOOL bIndexHeader )
+uno::Reference< text::XTextSection >
+SwXTextSection::CreateXTextSection(
+ SwSectionFmt *const pFmt, const bool bIndexHeader)
{
- SwXTextSection* pNew;
- uno::Reference< text::XTextSection > xSection = pNew = new SwXTextSection( pFmt != 0, bIndexHeader );
- if(pFmt)
- new SwXTextSectionClient( *pFmt, *pNew, xSection );
+ // 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;
}
-/*-- 29.12.2005 10:23:37---------------------------------------------------
+/*-- 10.12.98 14:47:05---------------------------------------------------
-----------------------------------------------------------------------*/
-SwXTextSectionClient* SwXTextSectionClient::Create(SwXTextSection& rSection,
- uno::Reference< text::XTextSection >xSection, SwSectionFmt& rFmt )
+SwXTextSection::SwXTextSection(
+ SwSectionFmt *const pFmt, const bool bIndexHeader)
+ : m_pImpl( new SwXTextSection::Impl(*this, pFmt, bIndexHeader) )
{
- return new SwXTextSectionClient( rFmt, rSection, xSection );
}
-/******************************************************************
- *
- ******************************************************************/
-struct SwTextSectionProperties_Impl
-{
-
- String sCondition;
- String sLinkFileName;
- String sSectionFilter;
- String sSectionRegion;
- uno::Sequence<sal_Int8> aPassword;
-
- SwFmtCol* pColItem;
- SvxBrushItem* pBrushItem;
- SwFmtFtnAtTxtEnd* pFtnItem;
- SwFmtEndAtTxtEnd* pEndItem;
- SvXMLAttrContainerItem *pXMLAttr;
- SwFmtNoBalancedColumns *pNoBalanceItem;
- SvxFrameDirectionItem *pFrameDirItem;
- SvxLRSpaceItem *pLRSpaceItem; // #109700#
- sal_Bool bDDE;
- sal_Bool bHidden;
- sal_Bool bCondHidden;
- sal_Bool bProtect;
- // --> FME 2004-06-22 #114856# edit in readonly sections
- sal_Bool bEditInReadonly;
- // <--
- sal_Bool bUpdateType;
-
- SwTextSectionProperties_Impl() :
- pColItem(0),
- pBrushItem(0),
- pFtnItem(0),
- pEndItem(0),
- pXMLAttr(0),
- pNoBalanceItem(0),
- pFrameDirItem(0),
- pLRSpaceItem(0), // #109700#
- bDDE(0),
- bHidden(0),
- bCondHidden(0),
- bProtect(0),
- // --> FME 2004-06-22 #114856# edit in readonly sections
- bEditInReadonly(0),
- // <--
- bUpdateType(sal_True){}
- ~SwTextSectionProperties_Impl()
- {
- delete pColItem;
- delete pBrushItem;
- delete pFtnItem;
- delete pEndItem;
- delete pXMLAttr;
- delete pNoBalanceItem;
- delete pFrameDirItem;
- delete pLRSpaceItem; // #109700#
- }
-};
-/* -----------------------------11.07.00 12:10--------------------------------
+/*-- 10.12.98 14:47:07---------------------------------------------------
- ---------------------------------------------------------------------------*/
-SwXTextSection* SwXTextSection::GetImplementation(uno::Reference< XInterface> xRef )
+ -----------------------------------------------------------------------*/
+SwXTextSection::~SwXTextSection()
{
- uno::Reference<lang::XUnoTunnel> xTunnel( xRef, uno::UNO_QUERY);
- if(xTunnel.is())
- return reinterpret_cast< SwXTextSection * >(
- sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXTextSection::getUnoTunnelId()) ));
- return 0;
}
/* -----------------------------13.03.00 12:15--------------------------------
@@ -261,258 +248,230 @@ const uno::Sequence< sal_Int8 > & SwXTextSection::getUnoTunnelId()
/* -----------------------------10.03.00 18:04--------------------------------
---------------------------------------------------------------------------*/
-sal_Int64 SAL_CALL SwXTextSection::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;
-}
-/*-- 10.12.98 14:47:05---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SwXTextSection::SwXTextSection(sal_Bool bWithFormat, sal_Bool bIndexHeader) :
-// SwClient(pFmt),
- aLstnrCntnr( (text::XTextContent*)this),
- m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_SECTION)),
- m_bIsDescriptor(!bWithFormat),
- m_bIndexHeader(bIndexHeader),
- pProps(bWithFormat ? 0 : new SwTextSectionProperties_Impl()),
- m_pClient( 0 )
+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:07---------------------------------------------------
- -----------------------------------------------------------------------*/
-SwXTextSection::~SwXTextSection()
-{
- vos::OGuard aGuard(Application::GetSolarMutex());
- delete m_pClient;
- delete pProps;
-}
/*-- 10.12.98 14:47:08---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Reference< text::XTextSection > SwXTextSection::getParentSection(void) throw( uno::RuntimeException )
+uno::Reference< text::XTextSection > SAL_CALL
+SwXTextSection::getParentSection() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- uno::Reference< text::XTextSection > aRef;
- SwSectionFmt* pSectFmt = GetFmt();
- if(pSectFmt)
- {
- SwSectionFmt* pParentFmt = pSectFmt->GetParent();
- if(pParentFmt)
- {
- SwXTextSectionClient* pClient = (SwXTextSectionClient*)SwClientIter(*pParentFmt).
- First(TYPE(SwXTextSectionClient));
- if(pClient)
- aRef = pClient->GetXTextSection();
- else
- aRef = SwXTextSectionClient::CreateXTextSection(pParentFmt);
- }
- }
- else
- throw uno::RuntimeException();
- return aRef;
+
+ 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 > > SwXTextSection::getChildSections(void)
- throw( uno::RuntimeException )
+uno::Sequence< uno::Reference< text::XTextSection > > SAL_CALL
+SwXTextSection::getChildSections() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- uno::Sequence<uno::Reference< text::XTextSection > > aSeq;
- SwSectionFmt* pSectFmt = GetFmt();
- if(pSectFmt)
- {
- SwSections aChildren;
- pSectFmt->GetChildSections(aChildren, SORTSECT_NOT, sal_False);
- aSeq.realloc(aChildren.Count());
- uno::Reference< text::XTextSection > * pArray = aSeq.getArray();
- for(sal_uInt16 i = 0; i < aChildren.Count(); i++)
- {
- SwSectionFmt* pChild = aChildren.GetObject(i)->GetFmt();
- SwXTextSectionClient* pClient = (SwXTextSectionClient*)SwClientIter(*pChild).
- First(TYPE(SwXTextSectionClient));
- if(pClient)
- pArray[i] = pClient->GetXTextSection();
- else
- pArray[i] = SwXTextSectionClient::CreateXTextSection(pChild);
- }
+ 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 SwXTextSection::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
- throw( lang::IllegalArgumentException, uno::RuntimeException )
+void SAL_CALL
+SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
+throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- if(!m_bIsDescriptor)
+ 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 = 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()) ));
+ 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();
}
- SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
- if(pDoc)
+ 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())
{
- SwUnoInternalPaM aPam(*pDoc);
- //das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
- UnoActionContext aCont(pDoc);
- pDoc->StartUndo( UNDO_INSSECTION, NULL );
-
- SwSection* pRet = 0;
- if(!m_sName.Len())
- m_sName = C2S("TextSection");
- SectionType eType = pProps->bDDE ? DDE_LINK_SECTION :
- pProps->sLinkFileName.Len() || pProps->sSectionRegion.Len() ? FILE_LINK_SECTION :
- CONTENT_SECTION;
- // index header section?
- if(m_bIndexHeader)
+ 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)
{
- // 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++)
{
- // get all child sections
- SwSections aSectionsArr;
- ((SwTOXBaseSection*)pBase)->GetFmt()->
- GetChildSections(aSectionsArr);
-
- // and search for current header section
- 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;
- }
+ bHeaderPresent |=
+ (aSectionsArr[i]->GetType() == TOX_HEADER_SECTION);
+ }
+ if (! bHeaderPresent)
+ {
+ eType = TOX_HEADER_SECTION;
}
}
+ }
- SwSection aSect(eType, pDoc->GetUniqueSectionName(&m_sName));
- aSect.SetCondition(pProps->sCondition);
- String sLinkName(pProps->sLinkFileName);
- sLinkName += sfx2::cTokenSeperator;
- sLinkName += pProps->sSectionFilter;
- sLinkName += sfx2::cTokenSeperator;
- sLinkName += pProps->sSectionRegion;
- aSect.SetLinkFileName(sLinkName);
-
- aSect.SetHidden(pProps->bHidden);
- aSect.SetProtect(pProps->bProtect);
- // --> FME 2004-06-22 #114856# edit in readonly sections
- aSect.SetEditInReadonly(pProps->bEditInReadonly);
- // <--
+ String tmp(m_pImpl->m_sName);
+ SwSection 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.SetProtect(m_pImpl->m_pProps->m_bProtect);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aSect.SetEditInReadonly(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(pProps->pBrushItem)
- aSet.Put(*pProps->pBrushItem);
- if(pProps->pColItem)
- aSet.Put(*pProps->pColItem);
- if(pProps->pFtnItem)
- aSet.Put(*pProps->pFtnItem);
- if(pProps->pEndItem)
- aSet.Put(*pProps->pEndItem);
- if(pProps->pXMLAttr)
- aSet.Put(*pProps->pXMLAttr);
- if(pProps->pNoBalanceItem)
- aSet.Put(*pProps->pNoBalanceItem);
- if(pProps->pFrameDirItem)
- aSet.Put(*pProps->pFrameDirItem);
- /* #109700# */
- if(pProps->pLRSpaceItem)
- aSet.Put(*pProps->pLRSpaceItem);
-
- // section password
- if (pProps->aPassword.getLength() > 0)
- aSect.SetPasswd(pProps->aPassword);
-
- pRet = pDoc->InsertSwSection( aPam, aSect, aSet.Count() ? &aSet : 0 );
- // now create the client
- m_refCount++;
- // keep block to remove Reference before the refcount is decremented
- {
- uno::Reference< text::XTextSection> xSection( this );
- m_pClient = SwXTextSectionClient::Create(*this, xSection, *pRet->GetFmt());
- }
- m_refCount--;
+ 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.SetPasswd(m_pImpl->m_pProps->m_Password);
+ }
- // #97450# XML import must hide sections depending on their old
- // condition status
- if( pProps->sCondition.Len() != 0 )
- pRet->SetCondHidden(pProps->bCondHidden);
+ SwSection *const pRet =
+ pDoc->InsertSwSection( aPam, aSect, aSet.Count() ? &aSet : 0 );
+ pRet->GetFmt()->Add(m_pImpl.get());
+ pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
- // set update type if DDE link (and connect, if necessary)
- if (pProps->bDDE)
+ // #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())
{
- if (! pRet->IsConnected())
- {
- pRet->CreateLink(CREATE_CONNECT);
- }
- pRet->SetUpdateType( static_cast< USHORT >(pProps->bUpdateType ?
- sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
+ pRet->CreateLink(CREATE_CONNECT);
}
-
- // Undo-Klammerung hier beenden
- pDoc->EndUndo( UNDO_INSSECTION, NULL );
- DELETEZ(pProps);
- m_bIsDescriptor = sal_False;
+ pRet->SetUpdateType( static_cast< USHORT >(
+ (m_pImpl->m_pProps->m_bUpdateType) ?
+ sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
}
- else
- throw lang::IllegalArgumentException();
-}
-/*-- 10.12.98 14:47:09---------------------------------------------------
- -----------------------------------------------------------------------*/
-void SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
- throw( lang::IllegalArgumentException, uno::RuntimeException )
-{
- vos::OGuard aGuard(Application::GetSolarMutex());
- attachToRange( xTextRange );
+ // 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 > SwXTextSection::getAnchor(void) throw( uno::RuntimeException )
+uno::Reference< text::XTextRange > SAL_CALL
+SwXTextSection::getAnchor() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
+
uno::Reference< text::XTextRange > xRet;
- SwSectionFmt* pSectFmt = GetFmt();
+ SwSectionFmt *const pSectFmt = m_pImpl->GetSectionFmt();
if(pSectFmt)
{
const SwSection* pSect;
@@ -527,7 +486,7 @@ uno::Reference< text::XTextRange > SwXTextSection::getAnchor(void) throw( uno::
const SwEndNode* pEndNode = pIdx->GetNode().EndOfSectionNode();
SwPaM aEnd(*pEndNode);
aEnd.Move( fnMoveBackward, fnGoCntnt );
- xRet = SwXTextRange::CreateTextRangeFromPosition(pSectFmt->GetDoc(),
+ xRet = SwXTextRange::CreateXTextRange(*pSectFmt->GetDoc(),
*aPaM.Start(), aEnd.Start());
}
}
@@ -536,380 +495,491 @@ uno::Reference< text::XTextRange > SwXTextSection::getAnchor(void) throw( uno::
/*-- 10.12.98 14:47:09---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextSection::dispose(void) throw( uno::RuntimeException )
+void SAL_CALL SwXTextSection::dispose() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwSectionFmt* pSectFmt = GetFmt();
- if(pSectFmt)
+
+ SwSectionFmt *const pSectFmt = m_pImpl->GetSectionFmt();
+ if (pSectFmt)
+ {
pSectFmt->GetDoc()->DelSectionFmt( pSectFmt );
- else
- throw uno::RuntimeException();
+ }
}
/*-- 10.12.98 14:47:10---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextSection::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
- throw( uno::RuntimeException )
+void SAL_CALL SwXTextSection::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
{
- if(!GetFmt())
+ vos::OGuard g(Application::GetSolarMutex());
+
+ if (!m_pImpl->GetSectionFmt())
+ {
throw uno::RuntimeException();
- aLstnrCntnr.AddListener(aListener);
+ }
+ m_pImpl->m_ListenerContainer.AddListener(xListener);
}
/*-- 10.12.98 14:47:10---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextSection::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
- throw( uno::RuntimeException )
+void SAL_CALL SwXTextSection::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
{
- if(!GetFmt() || !aLstnrCntnr.RemoveListener(aListener))
+ 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 > SwXTextSection::getPropertySetInfo(void) throw( uno::RuntimeException )
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+SwXTextSection::getPropertySetInfo() throw (uno::RuntimeException)
{
- static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
+ vos::OGuard g(Application::GetSolarMutex());
+
+ static const uno::Reference< beans::XPropertySetInfo > aRef =
+ m_pImpl->m_rPropSet.getPropertySetInfo();
return aRef;
}
-/* -----------------------------12.02.01 10:29--------------------------------
- ---------------------------------------------------------------------------*/
-struct SwSectItemSet_Impl
-{
-
- SfxItemSet* pItemSet;
- SwSectItemSet_Impl() :
- pItemSet(0){}
- ~SwSectItemSet_Impl()
- {delete pItemSet;}
-};
/* -----------------------------12.02.01 10:45--------------------------------
---------------------------------------------------------------------------*/
-void SAL_CALL SwXTextSection::SetPropertyValues_Impl(
+void SwXTextSection::Impl::SetPropertyValues_Impl(
const uno::Sequence< OUString >& rPropertyNames,
- const uno::Sequence< Any >& rValues )
- throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
- WrappedTargetException, RuntimeException)
+ const uno::Sequence< uno::Any >& rValues)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- SwSectionFmt* pFmt = GetFmt();
if(rPropertyNames.getLength() != rValues.getLength())
- throw IllegalArgumentException();
- if(pFmt || m_bIsDescriptor)
{
- SwSection aSection(CONTENT_SECTION, aEmptyStr);
- SwSection* pSect = pFmt ? pFmt->GetSection() : 0;
- if(pFmt)
- aSection = *pSect;
- const OUString* pPropertyNames = rPropertyNames.getConstArray();
- const Any* pValues = rValues.getConstArray();
- SwSectItemSet_Impl aItemSet;
-
- sal_Bool bLinkModeChanged = sal_False;
- sal_Bool bLinkMode = sal_False;
- for(sal_Int16 nProperty = 0; nProperty < rPropertyNames.getLength(); nProperty++)
+ throw lang::IllegalArgumentException();
+ }
+ SwSectionFmt *const pFmt = GetSectionFmt();
+ if (!pFmt && !m_bIsDescriptor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwSection aSection(CONTENT_SECTION, aEmptyStr);
+ SwSection *const pSect = (pFmt) ? pFmt->GetSection() : 0;
+ if (pFmt)
+ {
+ aSection = *pSect;
+ }
+ 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)
{
- const SfxItemPropertySimpleEntry* pEntry =
- m_pPropSet->getPropertyMap()->getByName( pPropertyNames[nProperty] );
- if(!pEntry)
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) );
- else
+ 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
+ {
+ aSection.SetCondition(uTmp);
+ }
+ }
+ break;
+ case WID_SECT_DDE_TYPE:
+ case WID_SECT_DDE_FILE:
+ case WID_SECT_DDE_ELEMENT:
{
- if ( pEntry->nFlags & PropertyAttribute::READONLY)
- throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) );
- switch(pEntry->nWID)
+ OUString uTmp;
+ pValues[nProperty] >>= uTmp;
+ String sTmp(uTmp);
+ if (m_bIsDescriptor)
{
- case WID_SECT_CONDITION:
+ if (!m_pProps->m_bDDE)
{
- OUString uTmp;
- pValues[nProperty] >>= uTmp;
- if(m_bIsDescriptor)
- pProps->sCondition = String(uTmp);
- else
- aSection.SetCondition(uTmp);
+ ::rtl::OUStringBuffer buf;
+ buf.append(sfx2::cTokenSeperator);
+ buf.append(sfx2::cTokenSeperator);
+ m_pProps->m_sLinkFileName = buf.makeStringAndClear();
+ m_pProps->m_bDDE = true;
}
- break;
- case WID_SECT_DDE_TYPE :
- case WID_SECT_DDE_FILE :
- case WID_SECT_DDE_ELEMENT :
+ 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(aSection.GetLinkFileName());
+ if (aSection.GetType() != DDE_LINK_SECTION)
{
- OUString uTmp;
- pValues[nProperty] >>= uTmp;
- String sTmp(uTmp);
- if(m_bIsDescriptor)
- {
- if(!pProps->bDDE)
- {
- pProps->sLinkFileName = sfx2::cTokenSeperator;
- pProps->sLinkFileName += sfx2::cTokenSeperator;
- pProps->bDDE = sal_True;
- }
- pProps->sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,sfx2::cTokenSeperator,sTmp);
- }
- else
- {
- String sLinkFileName(aSection.GetLinkFileName());
- if(aSection.GetType() != DDE_LINK_SECTION)
- {
- sLinkFileName = sfx2::cTokenSeperator;
- sLinkFileName += sfx2::cTokenSeperator;
- aSection.SetType(DDE_LINK_SECTION);
- }
- sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,sfx2::cTokenSeperator, sTmp);
- aSection.SetLinkFileName(sLinkFileName);
- }
+ sLinkFileName = sfx2::cTokenSeperator;
+ sLinkFileName += sfx2::cTokenSeperator;
+ aSection.SetType(DDE_LINK_SECTION);
+ }
+ sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,
+ sfx2::cTokenSeperator, sTmp);
+ aSection.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 (aSection.GetType() != FILE_LINK_SECTION &&
+ aLink.FileURL.getLength())
+ {
+ aSection.SetType(FILE_LINK_SECTION);
}
- break;
- case WID_SECT_DDE_AUTOUPDATE:
+ ::rtl::OUStringBuffer sFileNameBuf;
+ if (aLink.FileURL.getLength())
{
- sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
- if(m_bIsDescriptor)
- {
- pProps->bUpdateType = bVal;
- }
- else
+ 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(
+ aSection.GetLinkFileName().GetToken(2,
+ sfx2::cTokenSeperator));
+ const ::rtl::OUString sFileName(
+ sFileNameBuf.makeStringAndClear());
+ aSection.SetLinkFileName(sFileName);
+ if (sFileName.getLength() < 3)
+ {
+ aSection.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 (aSection.GetType() != FILE_LINK_SECTION &&
+ sLink.getLength())
+ {
+ aSection.SetType(FILE_LINK_SECTION);
+ }
+ String sSectLink(aSection.GetLinkFileName());
+ while (3 < sSectLink.GetTokenCount(sfx2::cTokenSeperator))
+ {
+ sSectLink += sfx2::cTokenSeperator;
+ }
+ sSectLink.SetToken(2, sfx2::cTokenSeperator, sLink);
+ aSection.SetLinkFileName(sSectLink);
+ if (sSectLink.Len() < 3)
+ {
+ aSection.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
+ {
+ aSection.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 (aSection.GetCondition().Len() != 0)
+ {
+ aSection.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
+ {
+ aSection.SetProtect(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
+ {
+ aSection.SetEditInReadonly(bVal);
+ }
+ }
+ // <--
+ break;
+ case WID_SECT_PASSWORD:
+ {
+ uno::Sequence<sal_Int8> aSeq;
+ pValues[nProperty] >>= aSeq;
+ if (m_bIsDescriptor)
+ {
+ m_pProps->m_Password = aSeq;
+ }
+ else
+ {
+ aSection.SetPasswd(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())
{
- bLinkModeChanged = sal_True;
- bLinkMode = bVal;
+ m_pProps->m_pColItem.reset(new SwFmtCol);
}
+ pPutItem = m_pProps->m_pColItem.get();
}
- break;
- case WID_SECT_LINK :
+ else if (RES_BACKGROUND == pEntry->nWID)
{
- text::SectionFileLink aLink;
- if(pValues[nProperty] >>= aLink)
+ if (!m_pProps->m_pBrushItem.get())
{
- if(m_bIsDescriptor)
- {
- pProps->bDDE = sal_False;
- pProps->sLinkFileName = String(aLink.FileURL);
- pProps->sSectionFilter = String(aLink.FilterName);
- }
- else
- {
- if(aSection.GetType() != FILE_LINK_SECTION &&
- aLink.FileURL.getLength())
- aSection.SetType(FILE_LINK_SECTION);
- String sFileName;
- if(aLink.FileURL.getLength())
- {
- sFileName += URIHelper::SmartRel2Abs(
- pFmt->GetDoc()->GetDocShell()->GetMedium()->GetURLObject(),
- aLink.FileURL,
- URIHelper::GetMaybeFileHdl());
- }
- sFileName += sfx2::cTokenSeperator;
- sFileName += String(aLink.FilterName);
- sFileName += sfx2::cTokenSeperator;
- sFileName += aSection.GetLinkFileName().GetToken( 2, sfx2::cTokenSeperator );
- aSection.SetLinkFileName(sFileName);
- if(sFileName.Len() < 3)
- aSection.SetType(CONTENT_SECTION);
- }
+ m_pProps->m_pBrushItem.reset(
+ new SvxBrushItem(RES_BACKGROUND));
}
- else
- throw lang::IllegalArgumentException();
+ pPutItem = m_pProps->m_pBrushItem.get();
}
- break;
- case WID_SECT_REGION :
+ else if (RES_FTN_AT_TXTEND == pEntry->nWID)
{
- OUString uTmp;
- pValues[nProperty] >>= uTmp;
- String sLink(uTmp);
- if(m_bIsDescriptor)
+ if (!m_pProps->m_pFtnItem.get())
{
- pProps->bDDE = sal_False;
- pProps->sSectionRegion = sLink;
+ m_pProps->m_pFtnItem.reset(new SwFmtFtnAtTxtEnd);
}
- else
+ pPutItem = m_pProps->m_pFtnItem.get();
+ }
+ else if (RES_END_AT_TXTEND == pEntry->nWID)
+ {
+ if (!m_pProps->m_pEndItem.get())
{
- if(aSection.GetType() != FILE_LINK_SECTION &&
- sLink.Len())
- aSection.SetType(FILE_LINK_SECTION);
- String sSectLink(aSection.GetLinkFileName());
- while( 3 < sSectLink.GetTokenCount( sfx2::cTokenSeperator ))
- {
- sSectLink += sfx2::cTokenSeperator;
- }
- sSectLink.SetToken(2, sfx2::cTokenSeperator, sLink);
- aSection.SetLinkFileName(sSectLink);
- if(sSectLink.Len() < 3)
- aSection.SetType(CONTENT_SECTION);
+ m_pProps->m_pEndItem.reset(new SwFmtEndAtTxtEnd);
}
+ pPutItem = m_pProps->m_pEndItem.get();
}
- break;
- case WID_SECT_VISIBLE :
+ else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
{
- sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
- if(m_bIsDescriptor)
- pProps->bHidden = !bVal;
- else
- aSection.SetHidden(!bVal);
+ if (!m_pProps->m_pXMLAttr.get())
+ {
+ m_pProps->m_pXMLAttr.reset(
+ new SvXMLAttrContainerItem(
+ RES_UNKNOWNATR_CONTAINER));
+ }
+ pPutItem = m_pProps->m_pXMLAttr.get();
}
- break;
- case WID_SECT_CURRENTLY_VISIBLE:
+ else if (RES_COLUMNBALANCE== pEntry->nWID)
{
- sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
- if(m_bIsDescriptor)
- pProps->bCondHidden = !bVal;
- else
- if( aSection.GetCondition().Len() != 0 )
- aSection.SetCondHidden(!bVal);
+ if (!m_pProps->m_pNoBalanceItem.get())
+ {
+ m_pProps->m_pNoBalanceItem.reset(
+ new SwFmtNoBalancedColumns(RES_COLUMNBALANCE));
+ }
+ pPutItem = m_pProps->m_pNoBalanceItem.get();
}
- break;
- case WID_SECT_PROTECTED:
+ else if (RES_FRAMEDIR == pEntry->nWID)
{
- sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
- if(m_bIsDescriptor)
- pProps->bProtect = bVal;
- else
- aSection.SetProtect(bVal);
+ 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();
}
- break;
- // --> FME 2004-06-22 #114856# edit in readonly sections
- case WID_SECT_EDIT_IN_READONLY:
+ else if (RES_LR_SPACE == pEntry->nWID)
{
- sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
- if(m_bIsDescriptor)
- pProps->bEditInReadonly = bVal;
- else
- aSection.SetEditInReadonly(bVal);
+ // #109700#
+ if (!m_pProps->m_pLRSpaceItem.get())
+ {
+ m_pProps->m_pLRSpaceItem.reset(
+ new SvxLRSpaceItem( RES_LR_SPACE ));
+ }
+ pPutItem = m_pProps->m_pLRSpaceItem.get();
}
- // <--
- break;
- case WID_SECT_PASSWORD:
+ if (pPutItem)
{
- uno::Sequence<sal_Int8> aSeq;
- pValues[nProperty] >>= aSeq;
- if (m_bIsDescriptor)
- pProps->aPassword = aSeq;
- else
- aSection.SetPasswd(aSeq);
+ pPutItem->PutValue(pValues[nProperty],
+ pEntry->nMemberId);
}
- break;
- default:
- if(pFmt)
- {
- const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet();
- aItemSet.pItemSet = new SfxItemSet(*rOldAttrSet.GetPool(),
- pEntry->nWID, pEntry->nWID, 0);
- aItemSet.pItemSet->Put(rOldAttrSet);
- m_pPropSet->setPropertyValue(*pEntry, pValues[nProperty], *aItemSet.pItemSet);
- }
- else
- {
- SfxPoolItem* pPutItem = 0;
- if(RES_COL == pEntry->nWID)
- {
- if(!pProps->pColItem)
- pProps->pColItem = new SwFmtCol;
- pPutItem = pProps->pColItem;
- }
- else if(RES_BACKGROUND == pEntry->nWID)
- {
- if(!pProps->pBrushItem)
- pProps->pBrushItem = new SvxBrushItem(RES_BACKGROUND);
- pPutItem = pProps->pBrushItem;
- }
- else if(RES_FTN_AT_TXTEND == pEntry->nWID)
- {
- if(!pProps->pFtnItem)
- pProps->pFtnItem = new SwFmtFtnAtTxtEnd;
- pPutItem = pProps->pFtnItem;
- }
- else if(RES_END_AT_TXTEND == pEntry->nWID)
- {
- if(!pProps->pEndItem)
- pProps->pEndItem = new SwFmtEndAtTxtEnd;
- pPutItem = pProps->pEndItem;
- }
- else if(RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
- {
- if(!pProps->pXMLAttr)
- pProps->pXMLAttr= new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER );
- pPutItem = pProps->pXMLAttr;
- }
- else if(RES_COLUMNBALANCE== pEntry->nWID)
- {
- if(!pProps->pNoBalanceItem)
- pProps->pNoBalanceItem= new SwFmtNoBalancedColumns( RES_COLUMNBALANCE );
- pPutItem = pProps->pNoBalanceItem;
- }
- else if(RES_FRAMEDIR == pEntry->nWID)
- {
- if(!pProps->pFrameDirItem)
- pProps->pFrameDirItem = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
- pPutItem = pProps->pFrameDirItem;
- }
- else if(RES_LR_SPACE == pEntry->nWID)
- {
- // #109700#
- if(!pProps->pLRSpaceItem)
- pProps->pLRSpaceItem = new SvxLRSpaceItem( RES_LR_SPACE );
- pPutItem = pProps->pLRSpaceItem;
- }
- if(pPutItem)
- pPutItem->PutValue(pValues[nProperty], pEntry->nMemberId);
- }
}
}
}
- if(pFmt)
+ }
+
+ if (pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ UnoActionContext aContext(pDoc);
+ for (sal_uInt16 i = 0; i < rFmts.Count(); i++)
{
- SwDoc* pDoc = pFmt->GetDoc();
- const SwSectionFmts& rFmts = pDoc->GetSections();
- UnoActionContext aContext(pDoc);
- for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
+ if (rFmts[i]->GetSection()->GetName() == pSect->GetName())
{
- if(rFmts[i]->GetSection()->GetName() == pSect->GetName())
+ pDoc->ChgSection(i, aSection, pItemSet.get(),
+ pDoc->IsInReading());
{
- pDoc->ChgSection( i, aSection, aItemSet.pItemSet, pDoc->IsInReading());
-
- {
- // temporarily remove actions to allow cursor update
- UnoActionRemoveContext aRemoveContext( pDoc );
- }
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pDoc );
+ }
- //SwSection* pSect = pFmt->GetSection();
- if( bLinkModeChanged && pSect->GetType() == DDE_LINK_SECTION)
+ //SwSection* pSect = pFmt->GetSection();
+ if (bLinkModeChanged && pSect->GetType() == DDE_LINK_SECTION)
+ {
+ // set update type; needs an established link
+ if (!pSect->IsConnected())
{
- // set update type; needs an established link
- if(!pSect->IsConnected())
- {
- pSect->CreateLink(CREATE_CONNECT);
- }
- pSect->SetUpdateType( static_cast< USHORT >(bLinkMode ?
- sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
+ pSect->CreateLink(CREATE_CONNECT);
}
- // section found and processed: break from loop
- break;
+ pSect->SetUpdateType( static_cast< USHORT >((bLinkMode) ?
+ sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
}
+ // section found and processed: break from loop
+ break;
}
}
}
- else
- throw uno::RuntimeException();
}
-void SwXTextSection::setPropertyValues(
- const Sequence< ::rtl::OUString >& rPropertyNames,
- const Sequence< Any >& rValues )
- throw(PropertyVetoException, lang::IllegalArgumentException,
- lang::WrappedTargetException, RuntimeException)
+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
{
- SetPropertyValues_Impl( rPropertyNames, rValues );
+ m_pImpl->SetPropertyValues_Impl( rPropertyNames, rValues );
}
- catch (UnknownPropertyException &rException)
+ catch (beans::UnknownPropertyException &rException)
{
// wrap the original (here not allowed) exception in
// a WrappedTargetException that gets thrown instead.
- WrappedTargetException aWExc;
+ lang::WrappedTargetException aWExc;
aWExc.TargetException <<= rException;
throw aWExc;
}
@@ -918,295 +988,366 @@ void SwXTextSection::setPropertyValues(
-----------------------------------------------------------------------*/
void SwXTextSection::setPropertyValue(
- const OUString& rPropertyName, const uno::Any& aValue)
- throw( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
+ const OUString& rPropertyName, const uno::Any& rValue)
+throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- Sequence< ::rtl::OUString > aPropertyNames(1);
+
+ uno::Sequence< ::rtl::OUString > aPropertyNames(1);
aPropertyNames.getArray()[0] = rPropertyName;
- Sequence< Any > aValues(1);
- aValues.getArray()[0] = aValue;
- SetPropertyValues_Impl( aPropertyNames, aValues );
+ uno::Sequence< uno::Any > aValues(1);
+ aValues.getArray()[0] = rValue;
+ m_pImpl->SetPropertyValues_Impl( aPropertyNames, aValues );
}
+
/* -----------------------------12.02.01 10:43--------------------------------
---------------------------------------------------------------------------*/
-uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl(
+uno::Sequence< uno::Any >
+SwXTextSection::Impl::GetPropertyValues_Impl(
const uno::Sequence< OUString > & rPropertyNames )
- throw( UnknownPropertyException, WrappedTargetException, RuntimeException)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- Sequence< Any > aRet(rPropertyNames.getLength());
- Any* pRet = aRet.getArray();
- SwSectionFmt* pFmt = GetFmt();
- if(pFmt||m_bIsDescriptor)
+ 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++)
{
- SwSection* 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)
{
- const SfxItemPropertySimpleEntry* pEntry =
- m_pPropSet->getPropertyMap()->getByName( pPropertyNames[nProperty]);
- if(pEntry)
+ 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:
{
- switch(pEntry->nWID)
+ ::rtl::OUString sRet;
+ if (m_bIsDescriptor)
{
- case WID_SECT_CONDITION:
+ if (m_pProps->m_bDDE)
{
- OUString uTmp(
- m_bIsDescriptor ? pProps->sCondition : pSect->GetCondition());
- pRet[nProperty] <<= uTmp;
+ sRet = m_pProps->m_sLinkFileName;
}
- break;
- case WID_SECT_DDE_TYPE :
- case WID_SECT_DDE_FILE :
- case WID_SECT_DDE_ELEMENT :
+ }
+ 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)
{
- String sRet;
- if(m_bIsDescriptor)
- {
- if(pProps->bDDE)
- sRet = pProps->sLinkFileName;
- }
- else if( DDE_LINK_SECTION == pSect->GetType() )
- {
- sRet = pSect->GetLinkFileName();
- }
- sRet = sRet.GetToken(pEntry->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeperator);
- pRet[nProperty] <<= OUString(sRet);
+ 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()->GetName());
+ }
+ }
+ 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_DDE_AUTOUPDATE:
+ }
+ }
+ break;
+ case WID_SECT_PASSWORD:
+ {
+ pRet[nProperty] <<= (m_bIsDescriptor)
+ ? m_pProps->m_Password : pSect->GetPasswd();
+ }
+ break;
+ default:
+ {
+ if (pFmt)
+ {
+ m_rPropSet.getPropertyValue(*pEntry,
+ pFmt->GetAttrSet(), pRet[nProperty]);
+ }
+ else
+ {
+ const SfxPoolItem* pQueryItem = 0;
+ if (RES_COL == pEntry->nWID)
{
- // GetUpdateType() returns .._ALWAYS or .._ONCALL
- if ( pSect && pSect->IsLinkType() && pSect->IsConnected() ) // lijian i73247
+ if (!m_pProps->m_pColItem.get())
{
- sal_Bool bTemp =
- (pSect->GetUpdateType() == sfx2::LINKUPDATE_ALWAYS);
- pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
+ m_pProps->m_pColItem.reset(new SwFmtCol);
}
+ pQueryItem = m_pProps->m_pColItem.get();
}
- break;
- case WID_SECT_LINK :
+ else if (RES_BACKGROUND == pEntry->nWID)
{
- text::SectionFileLink aLink;
- if(m_bIsDescriptor)
- {
- if(!pProps->bDDE)
- {
- aLink.FileURL = pProps->sLinkFileName;
- aLink.FilterName = pProps->sSectionFilter;
- }
- }
- else if( FILE_LINK_SECTION == pSect->GetType() )
+ if (!m_pProps->m_pBrushItem.get())
{
- String sRet( pSect->GetLinkFileName() );
- aLink.FileURL = sRet.GetToken(0, sfx2::cTokenSeperator );
- aLink.FilterName = sRet.GetToken(1, sfx2::cTokenSeperator );
+ m_pProps->m_pBrushItem.reset(
+ new SvxBrushItem(RES_BACKGROUND));
}
- pRet[nProperty].setValue(&aLink, ::getCppuType((text::SectionFileLink*)0));
+ pQueryItem = m_pProps->m_pBrushItem.get();
}
- break;
- case WID_SECT_REGION :
+ else if (RES_FTN_AT_TXTEND == pEntry->nWID)
{
- String sRet;
- if(m_bIsDescriptor)
+ if (!m_pProps->m_pFtnItem.get())
{
- sRet = pProps->sSectionRegion;
+ m_pProps->m_pFtnItem.reset(new SwFmtFtnAtTxtEnd);
}
- else if( FILE_LINK_SECTION == pSect->GetType() )
- sRet = pSect->GetLinkFileName().GetToken(2, sfx2::cTokenSeperator);
- pRet[nProperty] <<= OUString(sRet);
- }
- break;
- case WID_SECT_VISIBLE :
- {
- sal_Bool bTemp = m_bIsDescriptor ? !pProps->bHidden : !pSect->IsHidden();
- pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
- }
- break;
- case WID_SECT_CURRENTLY_VISIBLE:
- {
- sal_Bool bTmp = m_bIsDescriptor ? !pProps->bCondHidden : !pSect->IsCondHidden();
- pRet[nProperty].setValue( &bTmp, ::getCppuBooleanType());
+ pQueryItem = m_pProps->m_pFtnItem.get();
}
- break;
- case WID_SECT_PROTECTED:
+ else if (RES_END_AT_TXTEND == pEntry->nWID)
{
- sal_Bool bTemp = m_bIsDescriptor ? pProps->bProtect : pSect->IsProtect();
- pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
- }
- break;
- // --> FME 2004-06-22 #114856# edit in readonly sections
- case WID_SECT_EDIT_IN_READONLY:
- {
- sal_Bool bTemp = m_bIsDescriptor ? pProps->bEditInReadonly : pSect->IsEditInReadonly();
- pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
- }
- break;
- // <--
- case FN_PARAM_LINK_DISPLAY_NAME:
- {
- if(pFmt)
- pRet[nProperty] <<= OUString(pFmt->GetSection()->GetName());
+ if (!m_pProps->m_pEndItem.get())
+ {
+ m_pProps->m_pEndItem.reset(new SwFmtEndAtTxtEnd);
+ }
+ pQueryItem = m_pProps->m_pEndItem.get();
}
- break;
- case WID_SECT_DOCUMENT_INDEX:
+ else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
{
- // search enclosing index
- SwSection* pEnclosingSection = pSect;
- while ( (pEnclosingSection != NULL) &&
- (TOX_CONTENT_SECTION !=
- pEnclosingSection->GetType()) )
+ if (!m_pProps->m_pXMLAttr.get())
{
- pEnclosingSection = pEnclosingSection->GetParent();
+ m_pProps->m_pXMLAttr.reset(
+ new SvXMLAttrContainerItem);
}
- if (pEnclosingSection)
+ pQueryItem = m_pProps->m_pXMLAttr.get();
+ }
+ else if (RES_COLUMNBALANCE== pEntry->nWID)
+ {
+ if (!m_pProps->m_pNoBalanceItem.get())
{
- // convert section to TOXBase and get SwXDocumentIndex
- SwTOXBaseSection* pTOXBaseSect =
- PTR_CAST(SwTOXBaseSection, pEnclosingSection);
- uno::Reference<XDocumentIndex> xIndex =
- SwXDocumentIndexes::GetObject(pTOXBaseSect);
- pRet[nProperty] <<= xIndex;
+ m_pProps->m_pNoBalanceItem.reset(
+ new SwFmtNoBalancedColumns);
}
- // else: no enclosing index found -> empty return value
+ pQueryItem = m_pProps->m_pNoBalanceItem.get();
}
- break;
- case WID_SECT_IS_GLOBAL_DOC_SECTION:
+ else if (RES_FRAMEDIR == pEntry->nWID)
{
- sal_Bool bRet = (NULL == pFmt) ? sal_False :
- static_cast< sal_Bool >(NULL != pFmt->GetGlobalDocSection());
- pRet[nProperty].setValue( &bRet, ::getCppuBooleanType());
+ if (!m_pProps->m_pFrameDirItem.get())
+ {
+ m_pProps->m_pFrameDirItem.reset(
+ new SvxFrameDirectionItem(
+ FRMDIR_ENVIRONMENT, RES_FRAMEDIR));
+ }
+ pQueryItem = m_pProps->m_pFrameDirItem.get();
}
- break;
- case FN_UNO_ANCHOR_TYPES:
- case FN_UNO_TEXT_WRAP:
- case FN_UNO_ANCHOR_TYPE:
- SwXParagraph::getDefaultTextContentValue(pRet[nProperty], OUString(), pEntry->nWID);
- break;
- case FN_UNO_REDLINE_NODE_START:
- case FN_UNO_REDLINE_NODE_END:
+ /* -> #109700# */
+ else if (RES_LR_SPACE == pEntry->nWID)
{
- 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++)
+ if (!m_pProps->m_pLRSpaceItem.get())
{
- const SwRedline* pRedline = rRedTbl[nRed];
- const SwNode* pRedPointNode = pRedline->GetNode(TRUE);
- const SwNode* pRedMarkNode = pRedline->GetNode(FALSE);
- if(pRedPointNode == pSectNode || pRedMarkNode == pSectNode)
- {
- const SwNode* pStartOfRedline = SwNodeIndex(*pRedPointNode) <= SwNodeIndex(*pRedMarkNode) ?
- pRedPointNode : pRedMarkNode;
- BOOL bIsStart = pStartOfRedline == pSectNode;
- pRet[nProperty] <<= SwXRedlinePortion::CreateRedlineProperties(*pRedline, bIsStart);
- break;
- }
+ m_pProps->m_pLRSpaceItem.reset(
+ new SvxLRSpaceItem( RES_LR_SPACE ));
}
+ pQueryItem = m_pProps->m_pLRSpaceItem.get();
}
- break;
- case WID_SECT_PASSWORD:
+ /* <- #109700# */
+ if (pQueryItem)
{
- pRet[nProperty] <<= m_bIsDescriptor ? pProps->aPassword : pSect->GetPasswd();
+ pQueryItem->QueryValue(pRet[nProperty],
+ pEntry->nMemberId);
}
- break;
- default:
- if(pFmt)
- m_pPropSet->getPropertyValue(*pEntry, pFmt->GetAttrSet(), pRet[nProperty]);
- else
- {
- const SfxPoolItem* pQueryItem = 0;
- if(RES_COL == pEntry->nWID)
- {
- if(!pProps->pColItem)
- pProps->pColItem = new SwFmtCol;
- pQueryItem = pProps->pColItem;
- }
- else if(RES_BACKGROUND == pEntry->nWID)
- {
- if(!pProps->pBrushItem)
- pProps->pBrushItem = new SvxBrushItem(RES_BACKGROUND);
- pQueryItem = pProps->pBrushItem;
- }
- else if(RES_FTN_AT_TXTEND == pEntry->nWID)
- {
- if(!pProps->pFtnItem)
- pProps->pFtnItem = new SwFmtFtnAtTxtEnd;
- pQueryItem = pProps->pFtnItem;
- }
- else if(RES_END_AT_TXTEND == pEntry->nWID)
- {
- if(!pProps->pEndItem)
- pProps->pEndItem = new SwFmtEndAtTxtEnd;
- pQueryItem = pProps->pEndItem;
- }
- else if(RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
- {
- if(!pProps->pXMLAttr)
- pProps->pXMLAttr= new SvXMLAttrContainerItem ;
- pQueryItem = pProps->pXMLAttr;
- }
- else if(RES_COLUMNBALANCE== pEntry->nWID)
- {
- if(!pProps->pNoBalanceItem)
- pProps->pNoBalanceItem= new SwFmtNoBalancedColumns;
- pQueryItem = pProps->pNoBalanceItem;
- }
- else if(RES_FRAMEDIR == pEntry->nWID)
- {
- if(!pProps->pFrameDirItem)
- pProps->pFrameDirItem = new SvxFrameDirectionItem(FRMDIR_ENVIRONMENT, RES_FRAMEDIR);
- pQueryItem = pProps->pFrameDirItem;
- }
- /* -> #109700# */
- else if(RES_LR_SPACE == pEntry->nWID)
- {
- if(!pProps->pLRSpaceItem)
- pProps->pLRSpaceItem = new SvxLRSpaceItem( RES_LR_SPACE );
- pQueryItem = pProps->pLRSpaceItem;
- }
- /* <- #109700# */
- if(pQueryItem)
- pQueryItem->QueryValue(pRet[nProperty], pEntry->nMemberId);
- }
}
}
- else
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) );
}
}
- else
- throw uno::RuntimeException();
return aRet;
}
+
/* -----------------------------04.11.03 10:43--------------------------------
---------------------------------------------------------------------------*/
-Sequence< Any > SwXTextSection::getPropertyValues(
- const Sequence< ::rtl::OUString >& rPropertyNames )
- throw(RuntimeException)
+uno::Sequence< uno::Any > SAL_CALL
+SwXTextSection::getPropertyValues(
+ const uno::Sequence< ::rtl::OUString >& rPropertyNames)
+throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- Sequence< Any > aValues;
+ uno::Sequence< uno::Any > aValues;
// workaround for bad designed API
try
{
- aValues = GetPropertyValues_Impl( rPropertyNames );
+ aValues = m_pImpl->GetPropertyValues_Impl( rPropertyNames );
}
- catch (UnknownPropertyException &)
+ catch (beans::UnknownPropertyException &)
{
- throw RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property exception caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Unknown property exception caught")),
+ static_cast<cppu::OWeakObject *>(this));
}
- catch (WrappedTargetException &)
+ catch (lang::WrappedTargetException &)
{
- throw RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "WrappedTargetException caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("WrappedTargetException caught")),
+ static_cast<cppu::OWeakObject *>(this));
}
return aValues;
@@ -1214,279 +1355,373 @@ Sequence< Any > SwXTextSection::getPropertyValues(
/*-- 10.12.98 14:47:12---------------------------------------------------
-----------------------------------------------------------------------*/
-uno::Any SwXTextSection::getPropertyValue(const OUString& rPropertyName)
- throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+uno::Any SAL_CALL
+SwXTextSection::getPropertyValue(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- Sequence< ::rtl::OUString > aPropertyNames(1);
+
+ uno::Sequence< ::rtl::OUString > aPropertyNames(1);
aPropertyNames.getArray()[0] = rPropertyName;
- return GetPropertyValues_Impl(aPropertyNames).getConstArray()[0];
+ return m_pImpl->GetPropertyValues_Impl(aPropertyNames).getConstArray()[0];
}
/* -----------------------------12.02.01 10:30--------------------------------
---------------------------------------------------------------------------*/
-void SwXTextSection::addPropertiesChangeListener(
- const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
- const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) throw(RuntimeException)
+void SAL_CALL SwXTextSection::addPropertiesChangeListener(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
+ const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
+throw (uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::addPropertiesChangeListener(): not implemented");
}
+
/* -----------------------------12.02.01 10:30--------------------------------
---------------------------------------------------------------------------*/
-void SwXTextSection::removePropertiesChangeListener(
+void SAL_CALL SwXTextSection::removePropertiesChangeListener(
const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
- throw(RuntimeException)
+throw (uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::removePropertiesChangeListener(): not implemented");
}
+
/* -----------------------------12.02.01 10:30--------------------------------
---------------------------------------------------------------------------*/
-void SwXTextSection::firePropertiesChangeEvent(
- const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
+void SAL_CALL SwXTextSection::firePropertiesChangeEvent(
+ const uno::Sequence< OUString >& /*aPropertyNames*/,
const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::firePropertiesChangeEvent(): not implemented");
}
+
/*-- 10.12.98 14:47:13---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextSection::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+void SAL_CALL
+SwXTextSection::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::addPropertyChangeListener(): not implemented");
}
-/*-- 10.12.98 14:47:13---------------------------------------------------
- -----------------------------------------------------------------------*/
-void SwXTextSection::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+void SAL_CALL
+SwXTextSection::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::removePropertyChangeListener(): not implemented");
}
-/*-- 10.12.98 14:47:14---------------------------------------------------
- -----------------------------------------------------------------------*/
-void SwXTextSection::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+void SAL_CALL
+SwXTextSection::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::addVetoableChangeListener(): not implemented");
}
-/*-- 10.12.98 14:47:14---------------------------------------------------
- -----------------------------------------------------------------------*/
-void SwXTextSection::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+void SAL_CALL
+SwXTextSection::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- DBG_WARNING("not implemented");
+ OSL_ENSURE(false,
+ "SwXTextSection::removeVetoableChangeListener(): not implemented");
}
/*-- 08.11.00 10:47:55---------------------------------------------------
-----------------------------------------------------------------------*/
-PropertyState SwXTextSection::getPropertyState( const OUString& rPropertyName )
- throw(UnknownPropertyException, RuntimeException)
+beans::PropertyState SAL_CALL
+SwXTextSection::getPropertyState(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- Sequence< OUString > aNames(1);
+
+ uno::Sequence< OUString > aNames(1);
aNames.getArray()[0] = rPropertyName;
return getPropertyStates(aNames).getConstArray()[0];
}
/*-- 08.11.00 10:47:55---------------------------------------------------
-----------------------------------------------------------------------*/
-Sequence< PropertyState > SwXTextSection::getPropertyStates(
- const Sequence< OUString >& rPropertyNames )
- throw(UnknownPropertyException, RuntimeException)
+uno::Sequence< beans::PropertyState > SAL_CALL
+SwXTextSection::getPropertyStates(
+ const uno::Sequence< OUString >& rPropertyNames)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- Sequence< PropertyState > aStates(rPropertyNames.getLength());
- SwSectionFmt* pFmt = GetFmt();
- if(pFmt||m_bIsDescriptor)
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ if (!pFmt && !m_pImpl->m_bIsDescriptor)
{
- PropertyState* pStates = aStates.getArray();
- const OUString* pNames = rPropertyNames.getConstArray();
- for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
+ 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)
{
- pStates[i] = PropertyState_DEFAULT_VALUE;
- const SfxItemPropertySimpleEntry* pEntry =
- m_pPropSet->getPropertyMap()->getByName( pNames[i]);
- if(!pEntry)
- throw 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:
{
- 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] = PropertyState_DIRECT_VALUE;
- break;
- default:
- if(pFmt)
- pStates[i] = m_pPropSet->getPropertyState(pNames[i], pFmt->GetAttrSet());
- else
+ if (pFmt)
+ {
+ pStates[i] = m_pImpl->m_rPropSet.getPropertyState(
+ pNames[i], pFmt->GetAttrSet());
+ }
+ else
+ {
+ if (RES_COL == pEntry->nWID)
{
- if(RES_COL == pEntry->nWID)
+ if (!m_pImpl->m_pProps->m_pColItem.get())
{
- if(!pProps->pColItem)
- pStates[i] = PropertyState_DEFAULT_VALUE;
- else
- pStates[i] = PropertyState_DIRECT_VALUE;
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
}
- else //if(RES_BACKGROUND == pEntry->nWID)
+ else
+ {
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else //if(RES_BACKGROUND == pEntry->nWID)
+ {
+ if (!m_pImpl->m_pProps->m_pBrushItem.get())
{
- if(!pProps->pBrushItem)
- pStates[i] = PropertyState_DEFAULT_VALUE;
- else
- pStates[i] = PropertyState_DIRECT_VALUE;
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
}
}
+ }
}
}
}
- else
- throw RuntimeException();
return aStates;
}
+
/*-- 08.11.00 10:47:55---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextSection::setPropertyToDefault( const OUString& rPropertyName )
- throw(UnknownPropertyException, RuntimeException)
+void SAL_CALL
+SwXTextSection::setPropertyToDefault(const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwSectionFmt* pFmt = GetFmt();
- if(pFmt||m_bIsDescriptor)
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ if (!pFmt && !m_pImpl->m_bIsDescriptor)
{
- SwSection aSection(CONTENT_SECTION, aEmptyStr);
- SwSection* pSect = pFmt ? pFmt->GetSection() : 0;
- if(pFmt)
- aSection = *pSect;
- 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 RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
- SfxItemSet* pNewAttrSet = 0;
- switch(pEntry->nWID)
+ throw uno::RuntimeException();
+ }
+
+ SwSection aSection(CONTENT_SECTION, aEmptyStr);
+ SwSection *const pSect = (pFmt) ? pFmt->GetSection() : 0;
+ if (pFmt)
+ {
+ aSection = *pSect;
+ }
+ 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<SfxItemSet> pNewAttrSet;
+ switch (pEntry->nWID)
+ {
+ case WID_SECT_CONDITION:
{
- case WID_SECT_CONDITION:
+ if (m_pImpl->m_bIsDescriptor)
{
- if(m_bIsDescriptor)
- pProps->sCondition = aEmptyStr;
- else
- aSection.SetCondition(aEmptyStr);
+ m_pImpl->m_pProps->m_sCondition = 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 :
- aSection.SetType(CONTENT_SECTION);
- break;
- case WID_SECT_DDE_AUTOUPDATE:
- aSection.SetUpdateType(sfx2::LINKUPDATE_ALWAYS);
- break;
- case WID_SECT_VISIBLE :
+ else
{
- if(m_bIsDescriptor)
- pProps->bHidden = FALSE;
- else
- aSection.SetHidden(FALSE);
+ aSection.SetCondition(aEmptyStr);
}
- break;
- case WID_SECT_PROTECTED:
+ }
+ break;
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ case WID_SECT_LINK :
+ case WID_SECT_REGION :
+ aSection.SetType(CONTENT_SECTION);
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ aSection.SetUpdateType(sfx2::LINKUPDATE_ALWAYS);
+ break;
+ case WID_SECT_VISIBLE :
+ {
+ if (m_pImpl->m_bIsDescriptor)
{
- if(m_bIsDescriptor)
- pProps->bProtect = FALSE;
- else
- aSection.SetProtect(FALSE);
+ m_pImpl->m_pProps->m_bHidden = false;
}
- break;
- // --> FME 2004-06-22 #114856# edit in readonly sections
- case WID_SECT_EDIT_IN_READONLY:
+ else
{
- if(m_bIsDescriptor)
- pProps->bEditInReadonly = FALSE;
- else
- aSection.SetEditInReadonly(FALSE);
+ aSection.SetHidden(FALSE);
}
- break;
- // <--
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bProtect = false;
+ }
+ else
+ {
+ aSection.SetProtect(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
+ {
+ aSection.SetEditInReadonly(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)
+ 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)
{
- 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)
{
- const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet();
- pNewAttrSet = new SfxItemSet(*rOldAttrSet.GetPool(),
- pEntry->nWID, pEntry->nWID, 0);
- pNewAttrSet->ClearItem(pEntry->nWID);
+ m_pImpl->m_pProps->m_pColItem.reset();
}
- else
+ else if (RES_BACKGROUND == pEntry->nWID)
{
- if(RES_COL == pEntry->nWID)
- DELETEZ(pProps->pColItem);
- else if(RES_BACKGROUND == pEntry->nWID)
- DELETEZ(pProps->pBrushItem);
+ m_pImpl->m_pProps->m_pBrushItem.reset();
}
}
+ }
}
- if(pFmt)
+ }
+
+ if (pFmt)
+ {
+ SwDoc *const pDoc = pFmt->GetDoc();
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ UnoActionContext aContext(pDoc);
+ for (sal_uInt16 i = 0; i < rFmts.Count(); i++)
{
- SwDoc* pDoc = pFmt->GetDoc();
- const SwSectionFmts& rFmts = pDoc->GetSections();
- UnoActionContext aContext(pDoc);
- for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
+ if (rFmts[i]->GetSection()->GetName() == pSect->GetName())
{
- if(rFmts[i]->GetSection()->GetName() == pSect->GetName())
+ pDoc->ChgSection(i, aSection, pNewAttrSet.get(),
+ pDoc->IsInReading());
{
- pDoc->ChgSection( i, aSection, pNewAttrSet, pDoc->IsInReading());
-
- {
- // temporarily remove actions to allow cursor update
- UnoActionRemoveContext aRemoveContext( pDoc );
- }
-
- break;
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pDoc );
}
+ break;
}
- delete pNewAttrSet;
}
}
- else
- throw RuntimeException();
}
+
/*-- 08.11.00 10:47:56---------------------------------------------------
-----------------------------------------------------------------------*/
-Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+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* pFmt = GetFmt();
- const SfxItemPropertySimpleEntry* pEntry =
- m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
+ SfxItemPropertySimpleEntry const*const pEntry =
+ m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
if (!pEntry)
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ {
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(this));
+ }
switch(pEntry->nWID)
{
@@ -1499,7 +1734,7 @@ Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName )
aRet <<= OUString();
break;
case WID_SECT_LINK :
- aRet <<= SectionFileLink();
+ aRet <<= text::SectionFileLink();
break;
case WID_SECT_DDE_AUTOUPDATE:
case WID_SECT_VISIBLE :
@@ -1520,12 +1755,12 @@ Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName )
case FN_UNO_ANCHOR_TYPES:
case FN_UNO_TEXT_WRAP:
case FN_UNO_ANCHOR_TYPE:
- SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pEntry->nWID);
+ ::sw::GetDefaultTextContentValue(aRet, OUString(), pEntry->nWID);
break;
default:
if(pFmt && pEntry->nWID <= SFX_WHICH_MAX)
{
- SwDoc* pDoc = pFmt->GetDoc();
+ SwDoc *const pDoc = pFmt->GetDoc();
const SfxPoolItem& rDefItem =
pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID);
rDefItem.QueryValue(aRet, pEntry->nMemberId);
@@ -1533,33 +1768,43 @@ Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName )
}
return aRet;
}
+
/*-- 10.12.98 14:47:15---------------------------------------------------
-----------------------------------------------------------------------*/
-OUString SwXTextSection::getName(void) throw( uno::RuntimeException )
+OUString SAL_CALL SwXTextSection::getName() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- String sRet;
- const SwSectionFmt* pFmt = GetFmt();
+
+ ::rtl::OUString sRet;
+ SwSectionFmt const*const pFmt = m_pImpl->GetSectionFmt();
if(pFmt)
+ {
sRet = pFmt->GetSection()->GetName();
- else if(m_bIsDescriptor)
- sRet = m_sName;
+ }
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ sRet = m_pImpl->m_sName;
+ }
else
+ {
throw uno::RuntimeException();
+ }
return sRet;
}
/*-- 10.12.98 14:47:16---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextSection::setName(const OUString& rName) throw( uno::RuntimeException )
+void SAL_CALL SwXTextSection::setName(const OUString& rName)
+throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwSectionFmt* pFmt = GetFmt();
+
+ SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
if(pFmt)
{
SwSection aSection(CONTENT_SECTION, aEmptyStr);
- SwSection* pSect = pFmt->GetSection();
+ SwSection *const pSect = pFmt->GetSection();
aSection = *pSect;
String sNewName(rName);
aSection.SetName(sNewName);
@@ -1569,9 +1814,13 @@ void SwXTextSection::setName(const OUString& rName) throw( uno::RuntimeException
for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
{
if(rFmts[i]->GetSection() == pSect)
+ {
nApplyPos = i;
+ }
else if(sNewName == rFmts[i]->GetSection()->GetName())
+ {
throw uno::RuntimeException();
+ }
}
if(nApplyPos != USHRT_MAX)
{
@@ -1585,46 +1834,50 @@ void SwXTextSection::setName(const OUString& rName) throw( uno::RuntimeException
}
}
}
- else if(m_bIsDescriptor)
- m_sName = String(rName);
+ else if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_sName = rName;
+ }
else
+ {
throw uno::RuntimeException();
+ }
}
/* -----------------02.11.99 11:30-------------------
--------------------------------------------------*/
-OUString SwXTextSection::getImplementationName(void) throw( uno::RuntimeException )
+OUString SAL_CALL
+SwXTextSection::getImplementationName() throw (uno::RuntimeException)
{
return C2U("SwXTextSection");
}
+
/* -----------------02.11.99 11:30-------------------
--------------------------------------------------*/
-sal_Bool SwXTextSection::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+static char const*const g_ServicesTextSection[] =
{
- return !rServiceName.compareToAscii("com.sun.star.text.TextSection") ||
- !rServiceName.compareToAscii("com.sun.star.document.LinkTarget") ||
- !rServiceName.compareToAscii("com.sun.star.text.TextContent");
-}
-/* -----------------02.11.99 11:30-------------------
+ "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]));
- --------------------------------------------------*/
-uno::Sequence< OUString > SwXTextSection::getSupportedServiceNames(void) throw( uno::RuntimeException )
+sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
+throw (uno::RuntimeException)
{
- uno::Sequence< OUString > aRet(3);
- OUString* pArr = aRet.getArray();
- pArr[0] = C2U("com.sun.star.text.TextSection");
- pArr[1] = C2U("com.sun.star.document.LinkTarget");
- pArr[2] = C2U("com.sun.star.text.TextContent");
- return aRet;
+ return ::sw::SupportsServiceImpl(
+ g_nServicesTextSection, g_ServicesTextSection, rServiceName);
}
-/*-- 20.12.2005 10:27:33---------------------------------------------------
+/* -----------------02.11.99 11:30-------------------
- -----------------------------------------------------------------------*/
-SwSectionFmt* SwXTextSection::GetFmt()const
+ --------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL
+SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException)
{
- return m_pClient ?
- const_cast<SwSectionFmt*>(static_cast< const SwSectionFmt* >(m_pClient->GetRegisteredIn()))
- : 0;
+ return ::sw::GetSupportedServiceNamesImpl(
+ g_nServicesTextSection, g_ServicesTextSection);
}
+