summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-08 17:13:54 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-08 17:13:54 +0100
commitaa16ebadc706825e9884378ba41b311eaad069b9 (patch)
tree2007d0997a173fa60c20e0642ec1975e5987027f /sw/source/core/unocore
parent2245100b4ac33d68ba6033871e22c3573bc10047 (diff)
swunolocking1: #i105557#: SwXTextCursor:
move enum SwGetPropertyStatesCaller to unocrsrhelper.hxx. move static methods of SwXTextCursor to namespace SwUnoCursorHelper. move various not-actually-local functions with declarations in multiple cxx files to namespace SwUnoCursorHelper. clean up the implementation a little.
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/SwXTextDefaults.cxx11
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx12
-rw-r--r--sw/source/core/unocore/unoobj.cxx991
-rw-r--r--sw/source/core/unocore/unoobj2.cxx168
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx17
-rw-r--r--sw/source/core/unocore/unoport.cxx23
-rw-r--r--sw/source/core/unocore/unoportenum.cxx4
-rw-r--r--sw/source/core/unocore/unosect.cxx2
-rw-r--r--sw/source/core/unocore/unotbl.cxx59
-rw-r--r--sw/source/core/unocore/unotext.cxx22
10 files changed, 729 insertions, 580 deletions
diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx
index 43c1743023d7..81a2cf34e93a 100644
--- a/sw/source/core/unocore/SwXTextDefaults.cxx
+++ b/sw/source/core/unocore/SwXTextDefaults.cxx
@@ -30,9 +30,12 @@
// 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 <com/sun/star/beans/PropertyAttribute.hpp>
+
#include <SwXTextDefaults.hxx>
#include <SwStyleNameMapper.hxx>
#include <fchrfmt.hxx>
@@ -44,6 +47,7 @@
#include <unomid.h>
#include <paratr.hxx>
#include <unoprnms.hxx>
+#include <unocrsrhelper.hxx>
#include <hintids.hxx>
#include <unomid.h>
@@ -56,9 +60,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
-// declarations
-void lcl_setPageDesc(SwDoc*, const uno::Any&, SfxItemSet& ); // from unoobj.cxx
-
SwXTextDefaults::SwXTextDefaults ( SwDoc * pNewDoc ) :
m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_DEFAULT ) ),
@@ -97,7 +98,7 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName,
{
SfxItemSet aSet( m_pDoc->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC );
aSet.Put(rItem);
- lcl_setPageDesc( m_pDoc, aValue, aSet );
+ 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) ||
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 1138f5ee273e..4d179f133446 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -32,12 +32,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <map>
+
#include <com/sun/star/text/XTextSection.hpp>
#include <cmdid.h>
#include <unocrsrhelper.hxx>
#include <unofootnote.hxx>
-#include <unotextcursor.hxx>
#include <unorefmark.hxx>
#include <unostyle.hxx>
#include <unoidx.hxx>
@@ -45,6 +46,7 @@
#include <unotbl.hxx>
#include <unosett.hxx>
#include <unoframe.hxx>
+#include <unocrsr.hxx>
#include <doc.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <fmtftn.hxx>
@@ -103,8 +105,9 @@ using ::rtl::OUString;
namespace SwUnoCursorHelper
{
+
/* -----------------16.09.98 12:27-------------------
- * Lesen spezieller Properties am Cursor
+* Lesen spezieller Properties am Cursor
* --------------------------------------------------*/
sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
, SwPaM& rPam
@@ -196,7 +199,10 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
? pNode->GetFmtColl() : &pNode->GetAnyFmtColl();
else
- pFmt = SwXTextCursor::GetCurTxtFmtColl(rPam, FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID);
+ {
+ pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(rPam,
+ FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID);
+ }
if(pFmt)
{
if( pAny )
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index a0b08fffc879..837caa62634b 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -46,6 +46,7 @@
#include <istyleaccess.hxx>
#include <ndtxt.hxx>
#include <ndnotxt.hxx>
+#include <unocrsr.hxx>
#include <unocrsrhelper.hxx>
#include <swundo.hxx>
#include <rootfrm.hxx>
@@ -195,25 +196,30 @@ SwUnoInternalPaM& SwUnoInternalPaM::operator=(const SwPaM& rPaM)
/*-----------------09.03.98 08:29-------------------
--------------------------------------------------*/
-void SwXTextCursor::SelectPam(SwPaM& rCrsr, sal_Bool bExpand)
+void SwUnoCursorHelper::SelectPam(SwPaM & rPam, const bool bExpand)
{
- if(bExpand)
+ if (bExpand)
{
- if(!rCrsr.HasMark())
- rCrsr.SetMark();
+ if (!rPam.HasMark())
+ {
+ rPam.SetMark();
+ }
+ }
+ else if (rPam.HasMark())
+ {
+ rPam.DeleteMark();
}
- else if(rCrsr.HasMark())
- rCrsr.DeleteMark();
-
}
/* -----------------20.05.98 14:59-------------------
*
* --------------------------------------------------*/
-void SwXTextCursor::getTextFromPam(SwPaM& aCrsr, OUString& rBuffer)
+void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer)
{
- if(!aCrsr.HasMark())
+ if (!rPam.HasMark())
+ {
return;
+ }
SvCacheStream aStream( 20480 );
#ifdef OSL_BIGENDIAN
aStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
@@ -225,7 +231,7 @@ void SwXTextCursor::getTextFromPam(SwPaM& aCrsr, OUString& rBuffer)
SwReaderWriter::GetWriter( C2S(FILTER_TEXT_DLG), String(), xWrt );
if( xWrt.Is() )
{
- SwWriter aWriter( aStream, aCrsr );
+ SwWriter aWriter( aStream, rPam );
xWrt->bASCII_NoLastLineEnd = sal_True;
xWrt->bExportPargraphNumbering = sal_False;
SwAsciiOptions aOpt = xWrt->GetAsciiOptions();
@@ -253,10 +259,15 @@ void SwXTextCursor::getTextFromPam(SwPaM& aCrsr, OUString& rBuffer)
String sBuf;
sal_Int32 nLocalLen = 0;
if( lUniLen >= STRING_MAXLEN )
+ {
nLocalLen = STRING_MAXLEN - 1;
+ }
else
+ {
nLocalLen = lUniLen;
- sal_Unicode* pStrBuf = sBuf.AllocBuffer( xub_StrLen( nLocalLen + 1));
+ }
+ sal_Unicode *const pStrBuf =
+ sBuf.AllocBuffer( xub_StrLen( nLocalLen + 1));
aStream.Read( pStrBuf, 2 * nLocalLen );
pStrBuf[ nLocalLen ] = '\0';
aStrBuffer.append( pStrBuf, nLocalLen );
@@ -271,46 +282,52 @@ void SwXTextCursor::getTextFromPam(SwPaM& aCrsr, OUString& rBuffer)
/* -----------------06.07.98 07:33-------------------
*
* --------------------------------------------------*/
-void lcl_setCharStyle(SwDoc* pDoc, const uno::Any aValue, SfxItemSet& rSet)
- throw (lang::IllegalArgumentException)
+static void
+lcl_setCharStyle(SwDoc *const pDoc, const uno::Any & rValue, SfxItemSet & rSet)
+throw (lang::IllegalArgumentException)
{
- SwDocShell* pDocSh = pDoc->GetDocShell();
+ SwDocShell *const pDocSh = pDoc->GetDocShell();
if(pDocSh)
{
OUString uStyle;
- aValue >>= uStyle;
- String sStyle;
- SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
- SwDocStyleSheet* pStyle =
- (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
- if(pStyle)
+ if (!(rValue >>= uStyle))
{
- SwFmtCharFmt aFmt(pStyle->GetCharFmt());
- rSet.Put(aFmt);
+ throw lang::IllegalArgumentException();
}
- else
+ 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();
+ throw lang::IllegalArgumentException();
}
-
+ const SwFmtCharFmt aFmt(pStyle->GetCharFmt());
+ rSet.Put(aFmt);
}
};
/* -----------------08.06.06 10:43-------------------
*
* --------------------------------------------------*/
-void lcl_setAutoStyle(IStyleAccess& rStyleAccess, const uno::Any aValue, SfxItemSet& rSet, bool bPara )
- throw (lang::IllegalArgumentException)
+static void
+lcl_setAutoStyle(IStyleAccess & rStyleAccess, const uno::Any & rValue,
+ SfxItemSet & rSet, const bool bPara)
+throw (lang::IllegalArgumentException)
{
OUString uStyle;
- aValue >>= uStyle;
- String sStyle;
+ 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) );
+ 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);
}
@@ -322,71 +339,77 @@ void lcl_setAutoStyle(IStyleAccess& rStyleAccess, const uno::Any aValue, SfxItem
/* -----------------30.06.98 08:46-------------------
*
* --------------------------------------------------*/
-void lcl_SetTxtFmtColl(const uno::Any& rAny, SwPaM& rPaM)
- throw (lang::IllegalArgumentException)
+void
+SwUnoCursorHelper::SetTxtFmtColl(const uno::Any & rAny, SwPaM & rPaM)
+throw (lang::IllegalArgumentException)
{
- SwDoc* pDoc = rPaM.GetDoc();
- SwDocShell* pDocSh = pDoc->GetDocShell();
+ 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* pStyle =
- (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_PARA);
- if(pStyle)
- {
- SwTxtFmtColl *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 );
- }
- else
+ 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-------------------
*
* --------------------------------------------------*/
- void lcl_setPageDesc(SwDoc* pDoc, const uno::Any& aValue, SfxItemSet& rSet)
- {
- if(aValue.getValueType() != ::getCppuType((const OUString*)0))
- return;
- SwFmtPageDesc *pNewDesc = 0 ;
+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 = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem));
+ pNewDesc.reset(new SwFmtPageDesc(
+ *static_cast<const SwFmtPageDesc*>(pItem)));
+ }
+ if (!pNewDesc.get())
+ {
+ pNewDesc.reset(new SwFmtPageDesc());
}
- if(!pNewDesc)
- pNewDesc = new SwFmtPageDesc();
- OUString uDescName;
- aValue >>= uDescName;
String sDescName;
- SwStyleNameMapper::FillUIName(uDescName, sDescName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
- if(!pNewDesc->GetPageDesc() || pNewDesc->GetPageDesc()->GetName() != 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* pPageDesc = ::GetPageDescByName_Impl(*pDoc, sDescName);
- if(pPageDesc)
- {
- pPageDesc->Add( pNewDesc );
- bPut = sal_True;
- }
- else
+ SwPageDesc *const pPageDesc =
+ ::GetPageDescByName_Impl(rDoc, sDescName);
+ if (!pPageDesc)
{
throw lang::IllegalArgumentException();
}
+ pPageDesc->Add( pNewDesc.get() );
+ bPut = sal_True;
}
if(!bPut)
{
@@ -394,17 +417,21 @@ void lcl_SetTxtFmtColl(const uno::Any& rAny, SwPaM& rPaM)
rSet.Put(SwFmtPageDesc());
}
else
+ {
rSet.Put(*pNewDesc);
+ }
}
- delete pNewDesc;
+ return true;
}
+
/* -----------------30.06.98 10:29-------------------
*
* --------------------------------------------------*/
-void lcl_SetNodeNumStart( SwPaM& rCrsr, uno::Any aValue )
+static void
+lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue)
{
sal_Int16 nTmp = 1;
- aValue >>= nTmp;
+ rValue >>= nTmp;
sal_uInt16 nStt = (nTmp < 0 ? USHRT_MAX : (sal_uInt16)nTmp);
SwDoc* pDoc = rCrsr.GetDoc();
UnoActionContext aAction(pDoc);
@@ -429,215 +456,264 @@ void lcl_SetNodeNumStart( SwPaM& rCrsr, uno::Any aValue )
}
}
+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-------------------
*
* --------------------------------------------------*/
-sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertySimpleEntry* pEntry,
- SwPaM& rPam,
- SfxItemSet& rItemSet,
- const uno::Any& aValue ) throw (lang::IllegalArgumentException)
-{
- sal_Bool bRet = sal_True;
- if(0 == ( pEntry->nFlags&PropertyAttribute::MAYBEVOID ) &&
- aValue.getValueType() == ::getCppuVoidType())
- bRet = sal_False;
- else
- {
- switch(pEntry->nWID)
+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:
{
- case RES_TXTATR_CHARFMT:
- lcl_setCharStyle(rPam.GetDoc(), aValue, rItemSet );
- break;
- case RES_TXTATR_AUTOFMT:
- lcl_setAutoStyle(rPam.GetDoc()->GetIStyleAccess(), aValue, rItemSet, false );
- break;
- case FN_UNO_CHARFMT_SEQUENCE:
+ // 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)
+ // <--
{
- Sequence<OUString> aCharStyles;
- if(aValue >>= aCharStyles)
+ sal_Int16 nLevel = 0;
+ if (rValue >>= nLevel)
{
- for(sal_Int32 nStyle = 0; nStyle < aCharStyles.getLength(); nStyle++)
- {
- 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
- SwXTextCursor::SetCrsrAttr(rPam, aSet, nStyle ? CRSR_ATTR_MODE_DONTREPLACE : 0);
- rPam.GetDoc()->EndUndo( UNDO_START, NULL );
- }
+ pTxtNd->SetAttrListLevel(nLevel);
}
- else
- bRet = sal_False;
}
- break;
- case FN_UNO_PARA_STYLE :
- lcl_SetTxtFmtColl(aValue, rPam);
- break;
- case RES_AUTO_STYLE:
- lcl_setAutoStyle(rPam.GetDoc()->GetIStyleAccess(), aValue, rItemSet, true );
- break;
- case FN_UNO_PAGE_STYLE :
- break;
- case FN_UNO_NUM_START_VALUE :
- lcl_SetNodeNumStart( rPam, aValue );
- break;
- case FN_UNO_NUM_LEVEL :
// --> OD 2008-07-14 #i91601#
- case FN_UNO_LIST_ID:
- // <--
- case FN_UNO_IS_NUMBER :
+ else if (FN_UNO_LIST_ID == rEntry.nWID)
{
- // multi selection is not considered
- SwTxtNode* 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 == pEntry->nWID && pRule != NULL )
- if ( FN_UNO_NUM_LEVEL == pEntry->nWID )
- // <--
- {
- sal_Int16 nLevel = 0;
- aValue >>= nLevel;
-
- pTxtNd->SetAttrListLevel(nLevel);
-
- }
- // --> OD 2008-07-14 #i91601#
- else if( FN_UNO_LIST_ID == pEntry->nWID )
+ ::rtl::OUString sListId;
+ if (rValue >>= sListId)
{
- ::rtl::OUString sListId;
- aValue >>= sListId;
pTxtNd->SetListId( sListId );
}
- // <--
- else if( FN_UNO_IS_NUMBER == pEntry->nWID )
+ }
+ // <--
+ else if (FN_UNO_IS_NUMBER == rEntry.nWID)
+ {
+ sal_Bool bIsNumber(sal_False);
+ if (rValue >>= bIsNumber)
{
- BOOL bIsNumber = *(sal_Bool*) aValue.getValue();
- if(!bIsNumber)
+ if (!bIsNumber)
+ {
pTxtNd->SetCountedInList( false );
+ }
}
- //PROPERTY_MAYBEVOID!
}
- break;
- case FN_NUMBER_NEWSTART :
+ //PROPERTY_MAYBEVOID!
+ }
+ break;
+ case FN_NUMBER_NEWSTART:
+ {
+ sal_Bool bVal = sal_False;
+ if (!(rValue >>= bVal))
{
- sal_Bool bVal = sal_False;
- if (aValue >>= bVal)
- rPam.GetDoc()->SetNumRuleStart(*rPam.GetPoint(), bVal);
- else
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException();
}
- break;
- case FN_UNO_NUM_RULES:
- SwUnoCursorHelper::setNumberingProperty(aValue, rPam);
- break;
- case RES_PARATR_DROP:
+ 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)
{
- if( MID_DROPCAP_CHAR_STYLE_NAME == pEntry->nMemberId)
- {
- OUString uStyle;
- if(aValue >>= uStyle)
- {
- String sStyle;
- SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
- SwDoc* pDoc = rPam.GetDoc();
- //default character style mustn't be set as default format
- SwDocStyleSheet* pStyle =
- (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
- SwFmtDrop* pDrop = 0;
- if(pStyle &&
- ((SwDocStyleSheet*)pStyle)->GetCharFmt() != pDoc->GetDfltCharFmt())
- {
- const SfxPoolItem* pItem;
- if(SFX_ITEM_SET == rItemSet.GetItemState( RES_PARATR_DROP, sal_True, &pItem ) )
- pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem));
- if(!pDrop)
- pDrop = new SwFmtDrop();
- rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
- pDrop->SetCharFmt(xStyle->GetCharFmt());
- }
- else
- throw lang::IllegalArgumentException();
- rItemSet.Put(*pDrop);
- delete pDrop;
- }
- else
- throw lang::IllegalArgumentException();
- }
- else
- bRet = sal_False;
+ lcl_setDropcapCharStyle(rPam, rItemSet, rValue);
}
- break;
- case RES_TXTATR_CJK_RUBY:
- if(MID_RUBY_CHARSTYLE == pEntry->nMemberId )
- {
- OUString sTmp;
- if(aValue >>= sTmp)
- {
- SwFmtRuby* pRuby = 0;
- const SfxPoolItem* pItem;
- if(SFX_ITEM_SET == rItemSet.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( sStyle );
- pRuby->SetCharFmtId( 0 );
- if(sStyle.Len() > 0)
- {
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
- pRuby->SetCharFmtId(nId);
- }
- rItemSet.Put(*pRuby);
- delete pRuby;
- }
- else
- throw lang::IllegalArgumentException();
- bRet = sal_True;
- }
- else
- bRet = sal_False;
- break;
- case RES_PAGEDESC :
- if(MID_PAGEDESC_PAGEDESCNAME == pEntry->nMemberId )
+ else
{
- lcl_setPageDesc(rPam.GetDoc(), aValue, rItemSet);
- break;
+ bRet = false;
}
- //hier kein break
- default: bRet = sal_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;
+ return bRet;
}
/* -----------------30.06.98 08:39-------------------
*
* --------------------------------------------------*/
-SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPaM, BOOL bConditional)
+SwFmtColl *
+SwUnoCursorHelper::GetCurTxtFmtColl(SwPaM & rPaM, const bool bConditional)
{
static const sal_uInt16 nMaxLookup = 1000;
SwFmtColl *pFmt = 0;
// if ( GetCrsrCnt() > nMaxLookup )
// return 0;
- sal_Bool bError = sal_False;
+ bool bError = false;
SwPaM *pTmpCrsr = &rPaM;
- do {
-
- ULONG nSttNd = pTmpCrsr->GetMark()->nNode.GetIndex();
- ULONG nEndNd = pTmpCrsr->GetPoint()->nNode.GetIndex();
- xub_StrLen nSttCnt = pTmpCrsr->GetMark()->nContent.GetIndex();
- xub_StrLen nEndCnt = pTmpCrsr->GetPoint()->nContent.GetIndex();
-
- if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
- {
- sal_uInt32 nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
- nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp;
- }
+ do
+ {
+ const ULONG nSttNd = pTmpCrsr->Start()->nNode.GetIndex();
+ const ULONG nEndNd = pTmpCrsr->End()->nNode.GetIndex();
if( nEndNd - nSttNd >= nMaxLookup )
{
@@ -648,33 +724,33 @@ SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPaM, BOOL bConditional)
const SwNodes& rNds = rPaM.GetDoc()->GetNodes();
for( ULONG n = nSttNd; n <= nEndNd; ++n )
{
- const SwTxtNode* pNd = rNds[ n ]->GetTxtNode();
+ SwTxtNode const*const pNd = rNds[ n ]->GetTxtNode();
if( pNd )
{
- SwFmtColl* pNdFmt = bConditional ? pNd->GetFmtColl()
- : &pNd->GetAnyFmtColl();
+ SwFmtColl *const pNdFmt = (bConditional)
+ ? pNd->GetFmtColl() : &pNd->GetAnyFmtColl();
if( !pFmt )
+ {
pFmt = pNdFmt;
+ }
else if( pFmt != pNdFmt )
{
- bError = sal_True;
+ bError = true;
break;
}
}
}
- if(bError)
- break;
pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
} while ( pTmpCrsr != &rPaM );
- return bError ? 0 : pFmt;
+ return (bError) ? 0 : pFmt;
}
/* -----------------26.06.98 16:20-------------------
* Hilfsfunktion fuer PageDesc
* --------------------------------------------------*/
- SwPageDesc* GetPageDescByName_Impl(SwDoc& rDoc, const String& rName)
- {
+SwPageDesc* GetPageDescByName_Impl(SwDoc& rDoc, const String& rName)
+{
SwPageDesc* pRet = 0;
sal_uInt16 nDCount = rDoc.GetPageDescCnt();
sal_uInt16 i;
@@ -695,7 +771,8 @@ SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPaM, BOOL bConditional)
const String aFmtName(SW_RES(i));
if(aFmtName == rName)
{
- pRet = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
+ pRet = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(
+ RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
break;
}
}
@@ -934,7 +1011,7 @@ void SwXTextCursor::DeleteAndInsert(const String& rText,
DBG_ASSERT( bSuccess, "Doc->Insert(Str) failed." );
(void) bSuccess;
- SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, true);
_pStartCrsr->Left(rText.Len(), CRSR_SKIP_CHARS, FALSE, FALSE);
}
} while( (_pStartCrsr=(SwCursor*)_pStartCrsr->GetNext()) != pUnoCrsr );
@@ -945,7 +1022,8 @@ void SwXTextCursor::DeleteAndInsert(const String& rText,
enum ForceIntoMetaMode { META_CHECK_BOTH, META_INIT_START, META_INIT_END };
-sal_Bool lcl_ForceIntoMeta(SwPaM & rCursor,
+static sal_Bool
+lcl_ForceIntoMeta(SwPaM & rCursor,
uno::Reference<text::XText> const & xParentText,
const enum ForceIntoMetaMode eMode)
{
@@ -1106,7 +1184,7 @@ sal_Bool SwXTextCursor::goLeft(sal_Int16 nCount, sal_Bool Expand) throw( uno::Ru
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->Left( nCount, CRSR_SKIP_CHARS, FALSE, FALSE);
if (CURSOR_META == eType)
{
@@ -1130,7 +1208,7 @@ sal_Bool SwXTextCursor::goRight(sal_Int16 nCount, sal_Bool Expand) throw( uno::R
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->Right(nCount, CRSR_SKIP_CHARS, FALSE, FALSE);
if (CURSOR_META == eType)
{
@@ -1153,7 +1231,7 @@ void SwXTextCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException )
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
if(eType == CURSOR_BODY)
{
pUnoCrsr->Move( fnMoveBackward, fnGoDoc );
@@ -1209,7 +1287,7 @@ void SwXTextCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
if(eType == CURSOR_BODY)
{
pUnoCrsr->Move( fnMoveForward, fnGoDoc );
@@ -1424,7 +1502,7 @@ sal_Bool SwXTextCursor::gotoNextWord(sal_Bool Expand) throw( uno::RuntimeExcepti
SwNode *pOldNode = &pPoint->nNode.GetNode();
xub_StrLen nOldIndex = pPoint->nContent.GetIndex();
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
//Absatzende?
if(pUnoCrsr->GetCntntNode() &&
pPoint->nContent == pUnoCrsr->GetCntntNode()->Len())
@@ -1470,7 +1548,7 @@ sal_Bool SwXTextCursor::gotoPreviousWord(sal_Bool Expand) throw( uno::RuntimeExc
SwNode *pOldNode = &pPoint->nNode.GetNode();
xub_StrLen nOldIndex = pPoint->nContent.GetIndex();
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
//Absatzanfang ?
if(pPoint->nContent == 0)
{
@@ -1514,7 +1592,7 @@ sal_Bool SwXTextCursor::gotoEndOfWord(sal_Bool Expand) throw( uno::RuntimeExcept
xub_StrLen nOldIndex = pPoint->nContent.GetIndex();
sal_Int16 nWordType = i18n::WordType::DICTIONARY_WORD;
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
if(!pUnoCrsr->IsEndWordWT( nWordType ))
pUnoCrsr->GoEndWordWT( nWordType );
@@ -1554,7 +1632,7 @@ sal_Bool SwXTextCursor::gotoStartOfWord(sal_Bool Expand) throw( uno::RuntimeExce
xub_StrLen nOldIndex = pPoint->nContent.GetIndex();
sal_Int16 nWordType = i18n::WordType::DICTIONARY_WORD;
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
if(!pUnoCrsr->IsStartWordWT( nWordType ))
pUnoCrsr->GoStartWordWT( nWordType );
@@ -1646,7 +1724,7 @@ sal_Bool SwXTextCursor::gotoNextSentence(sal_Bool Expand) throw( uno::RuntimeExc
if(pUnoCrsr)
{
BOOL bWasEOS = isEndOfSentence();
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->GoSentence(SwCursor::NEXT_SENT);
if(!bRet)
bRet = pUnoCrsr->MovePara(fnParaNext, fnParaStart);
@@ -1680,7 +1758,7 @@ sal_Bool SwXTextCursor::gotoPreviousSentence(sal_Bool Expand) throw( uno::Runtim
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->GoSentence(SwCursor::PREV_SENT);
if(!bRet)
{
@@ -1712,7 +1790,7 @@ sal_Bool SwXTextCursor::gotoStartOfSentence(sal_Bool Expand) throw( uno::Runtime
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, 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
@@ -1739,7 +1817,7 @@ sal_Bool SwXTextCursor::gotoEndOfSentence(sal_Bool Expand) throw( uno::RuntimeEx
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
// bRet is true if GoSentence() succeeded or if the
// MovePara() succeeded while the end of the para is
// not reached already
@@ -1798,7 +1876,7 @@ sal_Bool SwXTextCursor::gotoStartOfParagraph(sal_Bool Expand) throw( uno::Runtim
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr )
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr);
if(!bRet)
bRet = pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
@@ -1824,7 +1902,7 @@ sal_Bool SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand) throw( uno::RuntimeE
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr);
if(!bRet)
bRet = pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
@@ -1850,7 +1928,7 @@ sal_Bool SwXTextCursor::gotoNextParagraph(sal_Bool Expand) throw( uno::RuntimeEx
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->MovePara(fnParaNext, fnParaStart);
}
else
@@ -1869,7 +1947,7 @@ sal_Bool SwXTextCursor::gotoPreviousParagraph(sal_Bool Expand) throw( uno::Runti
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, Expand);
bRet = pUnoCrsr->MovePara(fnParaPrev, fnParaStart);
}
else
@@ -1967,7 +2045,7 @@ OUString SwXTextCursor::getString(void) throw( uno::RuntimeException )
else
*/ {
//Text ueber mehrere Absaetze
- SwXTextCursor::getTextFromPam(*pUnoCrsr, aTxt);
+ SwUnoCursorHelper::GetTextFromPam(*pUnoCrsr, aTxt);
}
}
else
@@ -1993,242 +2071,307 @@ void SwXTextCursor::setString(const OUString& aString) throw( uno::RuntimeExcept
/* -----------------------------03.05.00 12:56--------------------------------
---------------------------------------------------------------------------*/
-Any SwXTextCursor::GetPropertyValue(
+uno::Any SwUnoCursorHelper::GetPropertyValue(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
const OUString& rPropertyName)
- throw( UnknownPropertyException, WrappedTargetException, RuntimeException)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- Any aAny;
- const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName(
- rPropertyName);
- if(pEntry)
+ uno::Any aAny;
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.getPropertyMap()->getByName(rPropertyName);
+
+ if (!pEntry)
{
- PropertyState eTemp;
- 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);
- SwXTextCursor::GetCrsrAttr(rPaM, aSet);
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+ }
- rPropSet.getPropertyValue(*pEntry, aSet, aAny);
- }
+ 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);
}
- else
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
return aAny;
}
/* -----------------------------03.05.00 12:57--------------------------------
---------------------------------------------------------------------------*/
-void SwXTextCursor::SetPropertyValue(
- SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const OUString& rPropertyName,
- const Any& aValue, USHORT nAttrMode)
- throw (UnknownPropertyException, PropertyVetoException,
- IllegalArgumentException, WrappedTargetException, RuntimeException)
+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* pDoc = rPaM.GetDoc();
- const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName(rPropertyName);
- if(pEntry)
+ SwDoc *const pDoc = rPaM.GetDoc();
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.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 * > ( 0 ) );
+ throw beans::UnknownPropertyException(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + rPropertyName,
+ static_cast<cppu::OWeakObject *>(0));
+ }
- SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
- SwXTextCursor::GetCrsrAttr( rPaM, aItemSet );
+ 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(!lcl_setCrsrPropertyValue( pEntry, rPaM, aItemSet, aValue ))
- rPropSet.setPropertyValue(*pEntry, aValue, aItemSet );
- SwXTextCursor::SetCrsrAttr(rPaM, aItemSet, nAttrMode );
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, rValue, rPaM, aItemSet))
+ {
+ rPropSet.setPropertyValue(*pEntry, rValue, aItemSet );
}
- else
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+ SwUnoCursorHelper::SetCrsrAttr(rPaM, aItemSet, nAttrMode, bTableMode);
}
+
/* -----------------------------03.05.00 13:16--------------------------------
---------------------------------------------------------------------------*/
-Sequence< PropertyState > SwXTextCursor::GetPropertyStates(
+uno::Sequence< beans::PropertyState >
+SwUnoCursorHelper::GetPropertyStates(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
- const Sequence< OUString >& PropertyNames,
- SwGetPropertyStatesCaller eCaller )
- throw(UnknownPropertyException, RuntimeException)
+ const uno::Sequence< OUString >& rPropertyNames,
+ const SwGetPropertyStatesCaller eCaller)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
{
- const OUString* pNames = PropertyNames.getConstArray();
- Sequence< PropertyState > aRet ( PropertyNames.getLength() );
- PropertyState* pStates = aRet.getArray();
+ 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;
- SfxItemSet *pSet = 0, *pSetParent = 0;
- const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap();
- for( INT32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++ )
+ for (sal_Int32 i = 0, nEnd = rPropertyNames.getLength(); i < nEnd; i++)
{
- const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[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)))
+ 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 )
+ 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 UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) );
+ {
+ throw beans::UnknownPropertyException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
+ + pNames[i],
+ static_cast<cppu::OWeakObject *>(0));
+ }
}
- if ((eCaller == SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION || eCaller == SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT) &&
+ 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] );
+ {
+ SwUnoCursorHelper::getCrsrPropertyValue(
+ *pEntry, rPaM, 0, pStates[i] );
+ }
else
{
- if( !pSet )
+ if (!pSet.get())
{
switch ( eCaller )
{
case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT:
case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION:
- pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
- RES_CHRATR_BEGIN, RES_TXTATR_END );
+ pSet.reset(
+ new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_TXTATR_END ));
break;
case SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY:
- pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
- pEntry->nWID, pEntry->nWID );
+ pSet.reset(
+ new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ pEntry->nWID, pEntry->nWID ));
break;
default:
- pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ 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 );
+ 0L ));
}
// --> OD 2006-07-12 #i63870#
- SwXTextCursor::GetCrsrAttr( rPaM, *pSet );
+ SwUnoCursorHelper::GetCrsrAttr( rPaM, *pSet );
// <--
}
- if( pSet->Count() )
- pStates[i] = rPropSet.getPropertyState( *pEntry, *pSet );
- else
- pStates[i] = PropertyState_DEFAULT_VALUE;
+ 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 )
+ if (!pSetParent.get())
{
- pSetParent = pSet->Clone( FALSE );
+ pSetParent.reset( pSet->Clone( FALSE ) );
// --> OD 2006-07-12 #i63870#
- SwXTextCursor::GetCrsrAttr( rPaM, *pSetParent, TRUE, FALSE );
+ SwUnoCursorHelper::GetCrsrAttr(
+ rPaM, *pSetParent, TRUE, FALSE );
// <--
}
- if( (pSetParent)->Count() )
- pStates[i] = rPropSet.getPropertyState( *pEntry, *pSetParent );
- else
- pStates[i] = PropertyState_DEFAULT_VALUE;
+ pStates[i] = ( (pSetParent)->Count() )
+ ? rPropSet.getPropertyState( *pEntry, *pSetParent )
+ : beans::PropertyState_DEFAULT_VALUE;
}
}
}
}
- delete pSet;
- delete pSetParent;
return aRet;
}
/* -----------------------------03.05.00 13:17--------------------------------
---------------------------------------------------------------------------*/
-PropertyState SwXTextCursor::GetPropertyState(
- SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const OUString& rPropertyName)
- throw(UnknownPropertyException, RuntimeException)
+beans::PropertyState SwUnoCursorHelper::GetPropertyState(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
{
- Sequence < OUString > aStrings ( 1 );
+ uno::Sequence< OUString > aStrings ( 1 );
aStrings[0] = rPropertyName;
- Sequence < PropertyState > aSeq = GetPropertyStates( rPaM, rPropSet, aStrings, SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY );
+ uno::Sequence< beans::PropertyState > aSeq =
+ GetPropertyStates(rPaM, rPropSet, aStrings,
+ SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY );
return aSeq[0];
}
/* -----------------------------03.05.00 13:20--------------------------------
---------------------------------------------------------------------------*/
-void lcl_SelectParaAndReset ( SwPaM &rPaM, SwDoc* pDoc, const SvUShortsSort* pWhichIds = 0 )
+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();
- auto_ptr < SwUnoCrsr > pTemp ( pDoc->CreateUnoCrsr(aStart, FALSE) );
+ ::std::auto_ptr< SwUnoCrsr > pTemp ( rDoc.CreateUnoCrsr(aStart, FALSE) );
if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
+ {
pTemp->MovePara(fnParaCurr, fnParaStart);
+ }
pTemp->SetMark();
*pTemp->GetPoint() = aEnd;
- SwXTextCursor::SelectPam(*pTemp, sal_True);
+ SwUnoCursorHelper::SelectPam(*pTemp, true);
if(!SwUnoCursorHelper::IsEndOfPara(*pTemp))
+ {
pTemp->MovePara(fnParaCurr, fnParaEnd);
- pDoc->ResetAttrs(*pTemp, sal_True, pWhichIds);
+ }
+ rDoc.ResetAttrs(*pTemp, sal_True, pWhichIds);
}
-void SwXTextCursor::SetPropertyToDefault(
+void SwUnoCursorHelper::SetPropertyToDefault(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
const OUString& rPropertyName)
- throw(UnknownPropertyException, RuntimeException)
+throw (beans::UnknownPropertyException, uno::RuntimeException)
{
- NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
- SwDoc* pDoc = rPaM.GetDoc();
- const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName( rPropertyName);
- if(pEntry)
+ 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)
{
- if ( pEntry->nFlags & PropertyAttribute::READONLY)
- throw 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)
{
- SvUShortsSort aWhichIds;
- aWhichIds.Insert(pEntry->nWID);
- if(pEntry->nWID < RES_PARATR_BEGIN)
- pDoc->ResetAttrs(rPaM, sal_True, &aWhichIds);
- else
- lcl_SelectParaAndReset ( rPaM, pDoc, &aWhichIds );
+ rDoc.ResetAttrs(rPaM, sal_True, &aWhichIds);
}
else
- SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, rPaM);
+ {
+ lcl_SelectParaAndReset ( rPaM, rDoc, &aWhichIds );
+ }
}
else
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+ {
+ SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, rPaM);
+ }
}
+
/* -----------------------------03.05.00 13:19--------------------------------
---------------------------------------------------------------------------*/
-Any SwXTextCursor::GetPropertyDefault(
+uno::Any SwUnoCursorHelper::GetPropertyDefault(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
const OUString& rPropertyName)
- throw( UnknownPropertyException, WrappedTargetException, RuntimeException)
+throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
{
- Any aRet;
- SwDoc* pDoc = rPaM.GetDoc();
- const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName( rPropertyName);
- if(pEntry)
+ SfxItemPropertySimpleEntry const*const pEntry =
+ rPropSet.getPropertyMap()->getByName(rPropertyName);
+ if (!pEntry)
{
- if(pEntry->nWID < RES_FRMATR_END)
- {
- const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID);
- rDefItem.QueryValue(aRet, pEntry->nMemberId);
- }
+ 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);
}
- else
- throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
return aRet;
}
/*-- 09.12.98 14:18:54---------------------------------------------------
@@ -2276,7 +2419,10 @@ void SwXTextCursor::setPropertyValue(const OUString& rPropertyName, const uno::A
pUnoCrsr->SetSkipOverProtectSections(bSet);
}
else
- SetPropertyValue(*pUnoCrsr, *m_pPropSet, rPropertyName, aValue);
+ {
+ SwUnoCursorHelper::SetPropertyValue(*pUnoCrsr,
+ *m_pPropSet, rPropertyName, aValue);
+ }
}
else
throw uno::RuntimeException();
@@ -2304,7 +2450,10 @@ Any SwXTextCursor::getPropertyValue(const OUString& rPropertyName)
aAny.setValue(&bSet, ::getBooleanCppuType());
}
else
- aAny = GetPropertyValue(*pUnoCrsr, *m_pPropSet, rPropertyName);
+ {
+ aAny = SwUnoCursorHelper::GetPropertyValue(*pUnoCrsr,
+ *m_pPropSet, rPropertyName);
+ }
}
else
throw uno::RuntimeException();
@@ -2350,7 +2499,8 @@ beans::PropertyState SwXTextCursor::getPropertyState(const OUString& rPropertyNa
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(pUnoCrsr)
{
- eRet = GetPropertyState(*pUnoCrsr, *m_pPropSet, rPropertyName);
+ eRet = SwUnoCursorHelper::GetPropertyState(
+ *pUnoCrsr, *m_pPropSet, rPropertyName);
}
else
throw RuntimeException();
@@ -2367,7 +2517,8 @@ uno::Sequence< beans::PropertyState > SwXTextCursor::getPropertyStates(
SwUnoCrsr* pUnoCrsr = GetCrsr();
if(!pUnoCrsr)
throw RuntimeException();
- return GetPropertyStates(*pUnoCrsr, *m_pPropSet, PropertyNames);
+ return SwUnoCursorHelper::GetPropertyStates(
+ *pUnoCrsr, *m_pPropSet, PropertyNames);
}
/*-- 05.03.99 11:36:12---------------------------------------------------
@@ -2430,7 +2581,7 @@ void SAL_CALL SwXTextCursor::setAllPropertiesToDefault()
}
}
if (aParaWhichIds.Count())
- lcl_SelectParaAndReset( *pUnoCrsr, pUnoCrsr->GetDoc(), &aParaWhichIds );
+ lcl_SelectParaAndReset( *pUnoCrsr, *pUnoCrsr->GetDoc(), &aParaWhichIds );
if (aWhichIds.Count() )
pUnoCrsr->GetDoc()->ResetAttrs( *pUnoCrsr, sal_True, &aWhichIds );
}
@@ -2479,7 +2630,7 @@ void SAL_CALL SwXTextCursor::setPropertiesToDefault( const Sequence< OUString >&
}
if ( aParaWhichIds.Count() )
- lcl_SelectParaAndReset ( *pUnoCrsr, pDoc, &aParaWhichIds );
+ lcl_SelectParaAndReset ( *pUnoCrsr, *pDoc, &aParaWhichIds );
if (aWhichIds.Count() )
pDoc->ResetAttrs(*pUnoCrsr, sal_True, &aWhichIds);
}
@@ -2565,7 +2716,7 @@ throw (lang::IllegalArgumentException, io::IOException,
---------------------------------------------------------------------------*/
uno::Sequence< beans::PropertyValue >
-SwXTextCursor::createSortDescriptor(sal_Bool bFromTable)
+SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable)
{
uno::Sequence< beans::PropertyValue > aRet(5);
beans::PropertyValue* pArray = aRet.getArray();
@@ -2575,10 +2726,7 @@ SwXTextCursor::createSortDescriptor(sal_Bool bFromTable)
pArray[0] = beans::PropertyValue(C2U("IsSortInTable"), -1, aVal,
beans::PropertyState_DIRECT_VALUE);
- String sSpace(String::CreateFromAscii(" "));
- sal_Unicode uSpace = sSpace.GetChar(0);
-
- aVal <<= uSpace;
+ aVal <<= sal_Unicode(' ');
pArray[1] = beans::PropertyValue(C2U("Delimiter"), -1, aVal,
beans::PropertyState_DIRECT_VALUE);
@@ -2593,15 +2741,17 @@ SwXTextCursor::createSortDescriptor(sal_Bool bFromTable)
uno::Sequence< table::TableSortField > aFields(3);
table::TableSortField* pFields = aFields.getArray();
- Locale aLang( SvxCreateLocale( LANGUAGE_SYSTEM ) );
+ lang::Locale aLang( SvxCreateLocale( LANGUAGE_SYSTEM ) );
// get collator algorithm to be used for the locale
uno::Sequence< OUString > aSeq(
GetAppCollator().listCollatorAlgorithms( aLang ) );
- INT32 nLen = aSeq.getLength();
+ 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();
@@ -2643,13 +2793,14 @@ uno::Sequence< beans::PropertyValue > SAL_CALL
SwXTextCursor::createSortDescriptor() throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- return SwXTextCursor::createSortDescriptor(sal_False);
+
+ return SwUnoCursorHelper::CreateSortDescriptor(false);
}
/* -----------------------------15.12.00 14:06--------------------------------
---------------------------------------------------------------------------*/
-sal_Bool SwXTextCursor::convertSortProperties(
+sal_Bool SwUnoCursorHelper::ConvertSortProperties(
const uno::Sequence< beans::PropertyValue >& rDescriptor,
SwSortOptions& rSortOpt)
{
@@ -2679,14 +2830,14 @@ sal_Bool SwXTextCursor::convertSortProperties(
sal_Bool bOldSortdescriptor(sal_False);
sal_Bool bNewSortdescriptor(sal_False);
- for (int n = 0; n < rDescriptor.getLength(); ++n)
+ 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 (COMPARE_EQUAL == rPropName.compareToAscii("IsSortInTable"))
+ if (rPropName.equalsAscii("IsSortInTable"))
{
if (aValue.getValueType() == ::getBooleanCppuType())
{
@@ -2697,7 +2848,7 @@ sal_Bool SwXTextCursor::convertSortProperties(
bRet = sal_False;
}
}
- else if (COMPARE_EQUAL == rPropName.compareToAscii("Delimiter"))
+ else if (rPropName.equalsAscii("Delimiter"))
{
sal_Unicode uChar = sal_Unicode();
if (aValue >>= uChar)
@@ -2710,12 +2861,12 @@ sal_Bool SwXTextCursor::convertSortProperties(
}
}
// old sortdescriptor
- else if (COMPARE_EQUAL == rPropName.compareToAscii("SortColumns"))
+ else if (rPropName.equalsAscii("SortColumns"))
{
bOldSortdescriptor = sal_True;
- if (aValue.getValueType() == ::getBooleanCppuType())
+ sal_Bool bTemp(sal_False);
+ if (aValue >>= bTemp)
{
- sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
}
else
@@ -2723,12 +2874,12 @@ sal_Bool SwXTextCursor::convertSortProperties(
bRet = sal_False;
}
}
- else if (COMPARE_EQUAL == rPropName.compareToAscii("IsCaseSensitive"))
+ else if ( rPropName.equalsAscii("IsCaseSensitive"))
{
bOldSortdescriptor = sal_True;
- if (aValue.getValueType() == ::getBooleanCppuType())
+ sal_Bool bTemp(sal_False);
+ if (aValue >>= bTemp)
{
- sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
rSortOpt.bIgnoreCase = !bTemp;
}
else
@@ -2736,10 +2887,10 @@ sal_Bool SwXTextCursor::convertSortProperties(
bRet = sal_False;
}
}
- else if (COMPARE_EQUAL == rPropName.compareToAscii("CollatorLocale"))
+ else if (rPropName.equalsAscii("CollatorLocale"))
{
bOldSortdescriptor = sal_True;
- Locale aLocale;
+ lang::Locale aLocale;
if (aValue >>= aLocale)
{
rSortOpt.nLanguage = SvxLocaleToLanguage( aLocale );
@@ -2749,8 +2900,7 @@ sal_Bool SwXTextCursor::convertSortProperties(
bRet = sal_False;
}
}
- else if (COMPARE_EQUAL == rPropName.compareToAscii("CollatorAlgorithm",
- 17) &&
+ else if (rPropName.matchAsciiL("CollatorAlgorithm", 17) &&
rPropName.getLength() == 18 &&
(rPropName.getStr()[17] >= '0' && rPropName.getStr()[17] <= '9'))
{
@@ -2767,8 +2917,7 @@ sal_Bool SwXTextCursor::convertSortProperties(
bRet = sal_False;
}
}
- else if (COMPARE_EQUAL == rPropName.compareToAscii("SortRowOrColumnNo",
- 17) &&
+ else if (rPropName.matchAsciiL("SortRowOrColumnNo", 17) &&
rPropName.getLength() == 18 &&
(rPropName.getStr()[17] >= '0' && rPropName.getStr()[17] <= '9'))
{
@@ -2826,7 +2975,7 @@ sal_Bool SwXTextCursor::convertSortProperties(
}
}
// new sortdescriptor
- else if (COMPARE_EQUAL == rPropName.compareToAscii("IsSortColumns"))
+ else if (rPropName.equalsAscii("IsSortColumns"))
{
bNewSortdescriptor = sal_True;
if (aValue.getValueType() == ::getBooleanCppuType())
@@ -2839,7 +2988,7 @@ sal_Bool SwXTextCursor::convertSortProperties(
bRet = sal_False;
}
}
- else if (COMPARE_EQUAL == rPropName.compareToAscii("SortFields"))
+ else if (rPropName.equalsAscii("SortFields"))
{
bNewSortdescriptor = sal_True;
uno::Sequence < table::TableSortField > aFields;
@@ -2917,7 +3066,7 @@ throw (uno::RuntimeException)
if (pUnoCrsr->HasMark())
{
- if (!SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
+ if (!SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
{
throw uno::RuntimeException();
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index a71fe16f7024..84d276e6618e 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -80,7 +80,6 @@
#include <unofootnote.hxx>
#include <unotextbodyhf.hxx>
#include <unotextrange.hxx>
-#include <unotextcursor.hxx>
#include <unoparagraph.hxx>
#include <unomap.hxx>
#include <unoport.hxx>
@@ -132,14 +131,6 @@
using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-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 namespace ::com::sun::star::drawing;
-
using ::rtl::OUString;
@@ -359,28 +350,29 @@ void ClientModify(SwClient* pClient, SfxPoolItem *pOld, SfxPoolItem *pNew)
/*-- 09.12.98 14:19:03---------------------------------------------------
-----------------------------------------------------------------------*/
-void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAttrMode)
+void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam,
+ const SfxItemSet& rSet,
+ const SetAttrMode nAttrMode, const bool bTableMode)
{
- sal_uInt16 nFlags = nsSetAttrMode::SETATTR_APICALL | (nAttrMode & nsSetAttrMode::SETATTR_NOFORMATATTR);
- if(nAttrMode & CRSR_ATTR_MODE_DONTREPLACE)
- nFlags |= nsSetAttrMode::SETATTR_DONTREPLACE;
+ const SetAttrMode nFlags = nAttrMode | nsSetAttrMode::SETATTR_APICALL;
SwDoc* pDoc = rPam.GetDoc();
//StartEndAction
UnoActionContext aAction(pDoc);
- SwPaM* pCrsr = &rPam;
- if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn
+ if (rPam.GetNext() != &rPam) // Ring of Cursors
{
pDoc->StartUndo(UNDO_INSATTR, NULL);
- SwPaM *_pStartCrsr = &rPam;
+ SwPaM *pCurrent = &rPam;
do
{
- if( _pStartCrsr->HasMark() && ( (CRSR_ATTR_MODE_TABLE & nAttrMode) ||
- *_pStartCrsr->GetPoint() != *_pStartCrsr->GetMark() ))
+ if (pCurrent->HasMark() &&
+ ( (bTableMode) ||
+ (*pCurrent->GetPoint() != *pCurrent->GetMark()) ))
{
- pDoc->InsertItemSet(*_pStartCrsr, rSet, nFlags);
+ pDoc->InsertItemSet(*pCurrent, rSet, nFlags);
}
- } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rPam );
+ pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
+ } while (pCurrent != &rPam);
pDoc->EndUndo(UNDO_INSATTR, NULL);
}
@@ -388,7 +380,7 @@ void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAtt
{
// if( !HasSelection() )
// UpdateAttr();
- pDoc->InsertItemSet( *pCrsr, rSet, nFlags );
+ pDoc->InsertItemSet( rPam, rSet, nFlags );
}
//#outline level,add by zhaojianwei
if( rSet.GetItemState( RES_PARATR_OUTLINELEVEL, false ) >= SFX_ITEM_AVAILABLE )
@@ -398,7 +390,6 @@ void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAtt
{
rPam.GetDoc()->GetNodes().UpdateOutlineNode( *pTmpNode );
}
-
}
//<-end,zhaojianwei
}
@@ -408,72 +399,72 @@ void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAtt
// --> OD 2006-07-12 #i63870#
// split third parameter <bCurrentAttrOnly> into new parameters <bOnlyTxtAttr>
// and <bGetFromChrFmt> to get better control about resulting <SfxItemSet>
-void SwXTextCursor::GetCrsrAttr( SwPaM& rPam,
- SfxItemSet& rSet,
- BOOL bOnlyTxtAttr,
- BOOL bGetFromChrFmt )
+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 *_pStartCrsr = &rPam;
+ SwPaM *pCurrent = & rPam;
do
{
- ULONG nSttNd = _pStartCrsr->GetMark()->nNode.GetIndex(),
- nEndNd = _pStartCrsr->GetPoint()->nNode.GetIndex();
- xub_StrLen nSttCnt = _pStartCrsr->GetMark()->nContent.GetIndex(),
- nEndCnt = _pStartCrsr->GetPoint()->nContent.GetIndex();
-
- if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
- {
- sal_uInt32 nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
- nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp;
- }
+ 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();
- }
+ if (nEndNd - nSttNd >= nMaxLookup)
+ {
+ rSet.ClearItem();
+ rSet.InvalidateAllItems();
+ return;// uno::Any();
+ }
- // beim 1.Node traegt der Node die Werte in den GetSet ein (Initial)
- // alle weiteren Nodes werden zum GetSet zu gemergt
- for( ULONG n = nSttNd; n <= nEndNd; ++n )
+ // 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())
{
- SwNode* pNd = rPam.GetDoc()->GetNodes()[ n ];
- switch( pNd->GetNodeType() )
- {
case ND_TEXTNODE:
- {
- xub_StrLen nStt = n == nSttNd ? nSttCnt : 0,
- nEnd = n == nEndNd ? nEndCnt
- : ((SwTxtNode*)pNd)->GetTxt().Len();
- ((SwTxtNode*)pNd)->GetAttr( *pSet, nStt, nEnd, bOnlyTxtAttr, bGetFromChrFmt );
- }
- break;
+ {
+ 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:
- ((SwCntntNode*)pNd)->GetAttr( *pSet );
- break;
+ static_cast<SwCntntNode*>(pNd)->GetAttr( *pSet );
+ break;
default:
- pNd = 0;
- }
-
- if( pNd )
- {
- if( pSet != &rSet )
- rSet.MergeValues( aSet );
-
- if( aSet.Count() )
- aSet.ClearItem();
+ continue; // skip this node
+ }
- }
+ if (pSet != &rSet)
+ {
+ rSet.MergeValues( aSet );
+ }
+ else
+ {
pSet = &aSet;
}
- } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rPam );
+
+ if (aSet.Count())
+ {
+ aSet.ClearItem();
+ }
+ }
+ pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
+ } while ( pCurrent != &rPam );
}
+
/******************************************************************
* SwXParagraphEnumeration
******************************************************************/
@@ -967,7 +958,7 @@ throw (uno::RuntimeException)
SwUnoCursorHelper::DocInsertStringSplitCR(
m_pImpl->m_rDoc, aCursor, rText, bForceExpandHints);
- SwXTextCursor::SelectPam(aCursor, sal_True);
+ SwUnoCursorHelper::SelectPam(aCursor, true);
aCursor.Left(rText.getLength(), CRSR_SKIP_CHARS, FALSE, FALSE);
}
SetPositions(aCursor);
@@ -1111,7 +1102,7 @@ OUString SAL_CALL SwXTextRange::getString() throw (uno::RuntimeException)
SwPaM aPaM(GetDoc()->GetNodes());
if (GetPositions(aPaM) && aPaM.HasMark())
{
- SwXTextCursor::getTextFromPam(aPaM, sRet);
+ SwUnoCursorHelper::GetTextFromPam(aPaM, sRet);
}
return sRet;
}
@@ -1488,7 +1479,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
SwPaM aPaM(GetDoc()->GetNodes());
GetPositions(aPaM);
- SwXTextCursor::SetPropertyValue(aPaM, m_pImpl->m_rPropSet,
+ SwUnoCursorHelper::SetPropertyValue(aPaM, m_pImpl->m_rPropSet,
rPropertyName, rValue);
}
@@ -1505,7 +1496,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
}
SwPaM aPaM(GetDoc()->GetNodes());
GetPositions(aPaM);
- return SwXTextCursor::GetPropertyValue(aPaM, m_pImpl->m_rPropSet,
+ return SwUnoCursorHelper::GetPropertyValue(aPaM, m_pImpl->m_rPropSet,
rPropertyName);
}
@@ -1565,7 +1556,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
SwPaM aPaM(GetDoc()->GetNodes());
GetPositions(aPaM);
- return SwXTextCursor::GetPropertyState(aPaM, m_pImpl->m_rPropSet,
+ return SwUnoCursorHelper::GetPropertyState(aPaM, m_pImpl->m_rPropSet,
rPropertyName);
}
@@ -1581,7 +1572,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
SwPaM aPaM(GetDoc()->GetNodes());
GetPositions(aPaM);
- return SwXTextCursor::GetPropertyStates(aPaM, m_pImpl->m_rPropSet,
+ return SwUnoCursorHelper::GetPropertyStates(aPaM, m_pImpl->m_rPropSet,
rPropertyName);
}
@@ -1596,7 +1587,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
SwPaM aPaM(GetDoc()->GetNodes());
GetPositions(aPaM);
- SwXTextCursor::SetPropertyToDefault(aPaM, m_pImpl->m_rPropSet,
+ SwUnoCursorHelper::SetPropertyToDefault(aPaM, m_pImpl->m_rPropSet,
rPropertyName);
}
@@ -1613,7 +1604,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
}
SwPaM aPaM(GetDoc()->GetNodes());
GetPositions(aPaM);
- return SwXTextCursor::GetPropertyDefault(aPaM, m_pImpl->m_rPropSet,
+ return SwUnoCursorHelper::GetPropertyDefault(aPaM, m_pImpl->m_rPropSet,
rPropertyName);
}
@@ -1834,24 +1825,25 @@ sal_Bool SAL_CALL SwXTextRanges::hasElements() throw (uno::RuntimeException)
/* -----------------11.12.98 10:07-------------------
*
* --------------------------------------------------*/
-void SwXTextCursor::SetString(SwCursor& rCrsr, const OUString& rString)
+void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
{
// Start/EndAction
- SwDoc* pDoc = rCrsr.GetDoc();
+ SwDoc *const pDoc = rCursor.GetDoc();
UnoActionContext aAction(pDoc);
- String aText(rString);
- xub_StrLen nTxtLen = aText.Len();
pDoc->StartUndo(UNDO_INSERT, NULL);
- if(rCrsr.HasMark())
- pDoc->DeleteAndJoin(rCrsr);
- if(nTxtLen)
+ if (rCursor.HasMark())
+ {
+ pDoc->DeleteAndJoin(rCursor);
+ }
+ if (rString.getLength())
{
+ String aText(rString);
const bool bSuccess( SwUnoCursorHelper::DocInsertStringSplitCR(
- *pDoc, rCrsr, aText, false ) );
+ *pDoc, rCursor, aText, false ) );
DBG_ASSERT( bSuccess, "DocInsertStringSplitCR" );
(void) bSuccess;
- SwXTextCursor::SelectPam(rCrsr, sal_True);
- rCrsr.Left(nTxtLen, CRSR_SKIP_CHARS, FALSE, FALSE);
+ SwUnoCursorHelper::SelectPam(rCursor, true);
+ rCursor.Left(rString.getLength(), CRSR_SKIP_CHARS, FALSE, FALSE);
}
pDoc->EndUndo(UNDO_INSERT, NULL);
}
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 17336d80f64c..8d6ee3f3a65d 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -37,7 +37,6 @@
#include <unoparaframeenum.hxx>
#include <unotext.hxx>
#include <unotextrange.hxx>
-#include <unotextcursor.hxx>
#include <unoport.hxx>
#include <unomap.hxx>
#include <unocrsr.hxx>
@@ -457,7 +456,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ pPropertyNames[nProp],
static_cast< cppu::OWeakObject * >(&m_rThis));
}
- SwXTextCursor::SetPropertyValue(aCursor, m_rPropSet,
+ SwUnoCursorHelper::SetPropertyValue(aCursor, m_rPropSet,
pPropertyNames[nProp], pValues[nProp]);
}
}
@@ -659,7 +658,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
else
{
- SwXTextCursor::SetPropertyValue(
+ SwUnoCursorHelper::SetPropertyValue(
aCursor, m_pImpl->m_rPropSet, pProp[i], pValue[i]);
}
}
@@ -973,7 +972,7 @@ throw (beans::UnknownPropertyException)
case FN_UNO_PARA_STYLE:
case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
{
- SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl(
+ SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(
aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
eRet = pFmt ? beans::PropertyState_DIRECT_VALUE
: beans::PropertyState_AMBIGUOUS_VALUE;
@@ -1132,7 +1131,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
pTemp->SetMark();
*pTemp->GetPoint() = aEnd;
//pTemp->Exchange();
- SwXTextCursor::SelectPam(*pTemp, sal_True);
+ SwUnoCursorHelper::SelectPam(*pTemp, true);
if (!SwUnoCursorHelper::IsEndOfPara(*pTemp))
{
pTemp->MovePara(fnParaCurr, fnParaEnd);
@@ -1365,7 +1364,7 @@ OUString SAL_CALL SwXParagraph::getString() throw (uno::RuntimeException)
SwPosition aPos( *pTxtNode );
SwCursor aCursor( aPos, 0, false );
SwParaSelection aParaSel( aCursor );
- SwXTextCursor::getTextFromPam(aCursor, aRet);
+ SwUnoCursorHelper::GetTextFromPam(aCursor, aRet);
}
else if (m_pImpl->IsDescriptor())
{
@@ -1393,12 +1392,12 @@ throw (uno::RuntimeException)
if (!SwUnoCursorHelper::IsStartOfPara(aCursor)) {
aCursor.MovePara(fnParaCurr, fnParaStart);
}
- SwXTextCursor::SelectPam(aCursor, sal_True);
+ SwUnoCursorHelper::SelectPam(aCursor, true);
if (pTxtNode->GetTxt().Len()) {
aCursor.MovePara(fnParaCurr, fnParaEnd);
}
- SwXTextCursor::SetString(aCursor, aString);
- SwXTextCursor::SelectPam(aCursor, sal_False);
+ SwUnoCursorHelper::SetString(aCursor, aString);
+ SwUnoCursorHelper::SelectPam(aCursor, false);
}
else if (m_pImpl->IsDescriptor())
{
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 909c7bc7a450..55f8754d34b1 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -41,7 +41,6 @@
#include <unoport.hxx>
#include <unoparaframeenum.hxx>
#include <unotextrange.hxx>
-#include <unotextcursor.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
#include <unomid.h>
@@ -241,7 +240,7 @@ void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeExcep
if (!pUnoCrsr)
throw uno::RuntimeException();
- SwXTextCursor::SetString(*pUnoCrsr, aString);
+ SwUnoCursorHelper::SetString(*pUnoCrsr, aString);
}
/*-- 11.12.98 09:56:57---------------------------------------------------
@@ -275,7 +274,7 @@ void SwXTextPortion::setPropertyValue(const OUString& rPropertyName,
if (!pUnoCrsr)
throw uno::RuntimeException();
- SwXTextCursor::SetPropertyValue(*pUnoCrsr, *m_pPropSet,
+ SwUnoCursorHelper::SetPropertyValue(*pUnoCrsr, *m_pPropSet,
rPropertyName, aValue);
}
/*-- 04.11.03 09:56:58---------------------------------------------------
@@ -426,7 +425,7 @@ void SwXTextPortion::GetPropertyValue(
RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
0L);
- SwXTextCursor::GetCrsrAttr(*pUnoCrsr, *pSet);
+ SwUnoCursorHelper::GetCrsrAttr(*pUnoCrsr, *pSet);
}
m_pPropSet->getPropertyValue(rEntry, *pSet, rVal);
}
@@ -503,7 +502,7 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
- SwXTextCursor::SetPropertyValue( *pUnoCrsr, *m_pPropSet,
+ SwUnoCursorHelper::SetPropertyValue( *pUnoCrsr, *m_pPropSet,
pPropertyNames[nProp], pValues[nProp]);
}
}
@@ -606,7 +605,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPr
pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
else
{
- SwXTextCursor::SetPropertyValue(
+ SwUnoCursorHelper::SetPropertyValue(
*pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] );
}
}
@@ -683,7 +682,8 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion:
const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap();
- uno::Sequence< beans::PropertyState > aPropertyStates = SwXTextCursor::GetPropertyStates(
+ uno::Sequence< beans::PropertyState > aPropertyStates =
+ SwUnoCursorHelper::GetPropertyStates(
*pUnoCrsr, *m_pPropSet,
rPropertyNames,
SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT );
@@ -832,7 +832,7 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN
}
else
{
- eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, *m_pPropSet,
+ eRet = SwUnoCursorHelper::GetPropertyState(*pUnoCrsr, *m_pPropSet,
rPropertyName);
}
return eRet;
@@ -850,7 +850,7 @@ uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates(
throw uno::RuntimeException();
uno::Sequence< beans::PropertyState > aRet =
- SwXTextCursor::GetPropertyStates(*pUnoCrsr, *m_pPropSet,
+ SwUnoCursorHelper::GetPropertyStates(*pUnoCrsr, *m_pPropSet,
rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION);
if(GetTextPortionType() == PORTION_RUBY_START)
@@ -876,7 +876,8 @@ void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName)
if (!pUnoCrsr)
throw uno::RuntimeException();
- SwXTextCursor::SetPropertyToDefault(*pUnoCrsr, *m_pPropSet, rPropertyName);
+ SwUnoCursorHelper::SetPropertyToDefault(
+ *pUnoCrsr, *m_pPropSet, rPropertyName);
}
/*-- 08.03.99 09:41:48---------------------------------------------------
@@ -890,7 +891,7 @@ uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName)
if (!pUnoCrsr)
throw uno::RuntimeException();
- aRet = SwXTextCursor::GetPropertyDefault(*pUnoCrsr, *m_pPropSet,
+ aRet = SwUnoCursorHelper::GetPropertyDefault(*pUnoCrsr, *m_pPropSet,
rPropertyName);
return aRet;
}
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 605554253bf8..e780e95c361e 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -48,7 +48,7 @@
#include <unoclbck.hxx>
#include <unomid.h>
#include <unoparaframeenum.hxx>
-#include <unotextcursor.hxx>
+#include <unocrsrhelper.hxx>
#include <unorefmark.hxx>
#include <unobookmark.hxx>
#include <unoredline.hxx>
@@ -1150,7 +1150,7 @@ lcl_CreatePortions(
// text at nCurrentIndex; i.e. it must be set _once_ per iteration
uno::Reference< XTextRange > xRef;
- SwXTextCursor::SelectPam(*pUnoCrsr, sal_True); // set mark
+ SwUnoCursorHelper::SelectPam(*pUnoCrsr, true); // set mark
const sal_Int32 nFirstFrameIndex =
lcl_ExportFrames( *PortionStack.top().first,
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index d9d6bafa31a1..fbe7e6e7eb5d 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -48,7 +48,7 @@
#include <unotextrange.hxx>
#include <unosection.hxx>
#include <unoparagraph.hxx>
-#include <unotextcursor.hxx>
+#include <TextCursorHelper.hxx>
#include <unoredline.hxx>
#include <redline.hxx>
#include <unomap.hxx>
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 6143e7ed2661..2806a5984d24 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -109,10 +109,6 @@ using ::rtl::OUString;
//-----------------------------------------------------------------------------
-// from unoobj.cxx
-extern void lcl_SetTxtFmtColl(const uno::Any& rAny, SwPaM& rPaM) throw (lang::IllegalArgumentException);
-extern void lcl_setCharStyle(SwDoc* pDoc, const uno::Any aValue, SfxItemSet& rSet) throw (lang::IllegalArgumentException);
-
// from swtable.cxx
extern void lcl_GetTblBoxColStr( sal_uInt16 nCol, String& rNm );
@@ -1854,12 +1850,6 @@ uno::Reference< beans::XPropertySetInfo > SwXTextTableCursor::getPropertySetInf
/*-- 11.12.98 12:16:17---------------------------------------------------
-----------------------------------------------------------------------*/
-extern sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertySimpleEntry* pEntry,
- SwPaM& rPam,
- SfxItemSet& rSet,
- const uno::Any& aValue ) throw (lang::IllegalArgumentException);
-
-
void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName,
const uno::Any& aValue)
throw( beans::UnknownPropertyException,
@@ -1903,16 +1893,21 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName,
}
break;
case FN_UNO_PARA_STYLE:
- lcl_SetTxtFmtColl(aValue, *pUnoCrsr);
+ SwUnoCursorHelper::SetTxtFmtColl(aValue, *pUnoCrsr);
break;
default:
{
SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
- SwXTextCursor::GetCrsrAttr( pTblCrsr->GetSelRing(), aItemSet );
+ SwUnoCursorHelper::GetCrsrAttr(pTblCrsr->GetSelRing(),
+ aItemSet);
- if(!lcl_setCrsrPropertyValue( pEntry, pTblCrsr->GetSelRing(), aItemSet, aValue ))
- m_pPropSet->setPropertyValue( *pEntry, aValue, aItemSet );
- SwXTextCursor::SetCrsrAttr( pTblCrsr->GetSelRing(), aItemSet, CRSR_ATTR_MODE_TABLE );
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, aValue, pTblCrsr->GetSelRing(), aItemSet))
+ {
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
+ }
+ SwUnoCursorHelper::SetCrsrAttr(pTblCrsr->GetSelRing(),
+ aItemSet, nsSetAttrMode::SETATTR_DEFAULT, true);
}
}
}
@@ -1956,7 +1951,8 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
break;
case FN_UNO_PARA_STYLE:
{
- SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl(*pUnoCrsr, FALSE);
+ SwFmtColl *const pFmt =
+ SwUnoCursorHelper::GetCurTxtFmtColl(*pUnoCrsr, FALSE);
OUString sRet;
if(pFmt)
sRet = pFmt->GetName();
@@ -1970,7 +1966,8 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
0L);
// erstmal die Attribute des Cursors
- SwXTextCursor::GetCrsrAttr(pTblCrsr->GetSelRing(), aSet);
+ SwUnoCursorHelper::GetCrsrAttr(pTblCrsr->GetSelRing(),
+ aSet);
m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
}
}
@@ -3162,7 +3159,8 @@ uno::Sequence< beans::PropertyValue > SwXTextTable::createSortDescriptor(void)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- return SwXTextCursor::createSortDescriptor(sal_True);
+
+ return SwUnoCursorHelper::CreateSortDescriptor(true);
}
/*-- 11.12.98 12:42:49---------------------------------------------------
@@ -3174,7 +3172,7 @@ void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor
SwSortOptions aSortOpt;
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt &&
- SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
+ SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
{
SwTable* pTable = SwTable::FindTable( pFmt );
SwSelBoxes aBoxes;
@@ -4157,11 +4155,16 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
default:
{
SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
- SwXTextCursor::GetCrsrAttr( pCrsr->GetSelRing(), aItemSet );
+ SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(),
+ aItemSet);
- if(!lcl_setCrsrPropertyValue( pEntry, pCrsr->GetSelRing(), aItemSet, aValue ))
- m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet );
- SwXTextCursor::SetCrsrAttr(pCrsr->GetSelRing(), aItemSet, CRSR_ATTR_MODE_TABLE );
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, aValue, pCrsr->GetSelRing(), aItemSet))
+ {
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
+ }
+ SwUnoCursorHelper::SetCrsrAttr(pCrsr->GetSelRing(),
+ aItemSet, nsSetAttrMode::SETATTR_DEFAULT, true);
}
}
}
@@ -4214,7 +4217,8 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be
break;
case FN_UNO_PARA_STYLE:
{
- SwFmtColl* pTmpFmt = SwXTextCursor::GetCurTxtFmtColl(*pTblCrsr, FALSE);
+ SwFmtColl *const pTmpFmt =
+ SwUnoCursorHelper::GetCurTxtFmtColl(*pTblCrsr, FALSE);
OUString sRet;
if(pFmt)
sRet = pTmpFmt->GetName();
@@ -4242,7 +4246,7 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be
0L);
// erstmal die Attribute des Cursors
SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
- SwXTextCursor::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
+ SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
}
}
@@ -4875,7 +4879,8 @@ double SwXCellRange::getNotANumber(void) throw( uno::RuntimeException )
uno::Sequence< beans::PropertyValue > SwXCellRange::createSortDescriptor(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- return SwXTextCursor::createSortDescriptor(sal_True);
+
+ return SwUnoCursorHelper::CreateSortDescriptor(true);
}
/*-- 11.12.98 14:27:39---------------------------------------------------
@@ -4887,7 +4892,7 @@ void SAL_CALL SwXCellRange::sort(const uno::Sequence< beans::PropertyValue >& rD
SwSortOptions aSortOpt;
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt &&
- SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
+ SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
{
SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
pTableCrsr->MakeBoxSels();
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 415a3aaf6933..d3eebeae8af5 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -459,7 +459,7 @@ void SwXText::insertControlCharacter(const uno::Reference< text::XTextRange > &
}
SwCursor aCrsr(*aTmp.GetPoint(),0,false);
- SwXTextCursor::SelectPam(aCrsr, sal_True);
+ SwUnoCursorHelper::SelectPam(aCrsr, true);
aCrsr.Left(1, CRSR_SKIP_CHARS, FALSE, FALSE);
//hier muss der uebergebene PaM umgesetzt werden:
if(pRange)
@@ -1359,11 +1359,9 @@ uno::Reference< text::XTextRange > SwXText::finishOrAppendParagraph(
{
try
{
- SwXTextCursor::SetPropertyValue(
- aPam,
- *pParaPropSet,
- pValues[nProp].Name,
- pValues[nProp].Value);
+ SwUnoCursorHelper::SetPropertyValue(
+ aPam, *pParaPropSet,
+ pValues[nProp].Name, pValues[nProp].Value);
}
catch( lang::IllegalArgumentException& rIllegal )
{
@@ -1448,7 +1446,7 @@ uno::Reference< text::XTextRange > SwXText::appendTextPortion(
xub_StrLen nContentPos = pCursor->GetPoint()->nContent.GetIndex();
SwUnoCursorHelper::DocInsertStringSplitCR( *pDoc, *pCursor, rText,
false );
- SwXTextCursor::SelectPam(*pCursor, sal_True);
+ SwUnoCursorHelper::SelectPam(*pCursor, true);
pCursor->GetPoint()->nContent = nContentPos;
}
@@ -1463,12 +1461,10 @@ uno::Reference< text::XTextRange > SwXText::appendTextPortion(
{
try
{
- SwXTextCursor::SetPropertyValue(
- *pCursor,
- *pCursorPropSet,
- pValues[nProp].Name,
- pValues[nProp].Value,
- nsSetAttrMode::SETATTR_NOFORMATATTR);
+ SwUnoCursorHelper::SetPropertyValue(
+ *pCursor, *pCursorPropSet,
+ pValues[nProp].Name, pValues[nProp].Value,
+ nsSetAttrMode::SETATTR_NOFORMATATTR);
}
catch( lang::IllegalArgumentException& rIllegal )
{