[Libreoffice-commits] .: 2 commits - sw/source
Philipp Riemer
priemer at kemper.freedesktop.org
Sat Jun 30 13:31:47 PDT 2012
sw/source/core/attr/calbck.cxx | 166 ++++++-------
sw/source/core/attr/cellatr.cxx | 113 +++------
sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx | 60 ++--
sw/source/core/attr/format.cxx | 282 +++++++++--------------
sw/source/core/attr/hints.cxx | 131 ++++------
sw/source/core/attr/swatrset.cxx | 95 +++----
6 files changed, 364 insertions(+), 483 deletions(-)
New commits:
commit 20e08a185c1a7b932668c82539ff69e607f46b5e
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Sat Jun 30 22:24:25 2012 +0200
sorted include declarations in sw/source/core/attr
Change-Id: I3517f642a102f0f060b9c4de7c433da2e04ce63b
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 6b39fed..44373ed 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#include <hintids.hxx> // contains RES_.. IDs
#include <frame.hxx>
+#include <hintids.hxx> // contains RES_.. IDs
#include <hints.hxx>
#include <swcache.hxx> // mba: get rid of that dependency
#include <swfntcch.hxx> // mba: get rid of that dependency
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index a294f6c..71641d3 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -26,18 +26,18 @@
*
************************************************************************/
-#include <float.h>
-#include <rtl/math.hxx>
-#include <hintids.hxx>
-#include <cellatr.hxx>
#include <calc.hxx>
-#include <format.hxx>
+#include <cellatr.hxx>
#include <doc.hxx>
-#include <swtable.hxx>
-#include <node.hxx>
+#include <float.h>
+#include <format.hxx>
+#include <hintids.hxx>
#include <hints.hxx>
+#include <node.hxx>
#include <rolbck.hxx>
+#include <rtl/math.hxx>
#include <switerator.hxx>
+#include <swtable.hxx>
// -----------------
// SwTblBoxNumFormat
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index f8db561..083b923 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -26,15 +26,15 @@
*
************************************************************************/
-#include <hintids.hxx>
+#include <doc.hxx>
+#include <fmtcolfunc.hxx>
#include <frame.hxx>
#include <format.hxx>
+#include <hintids.hxx>
#include <hints.hxx>
-#include <doc.hxx>
#include <paratr.hxx>
-#include <swcache.hxx>
-#include <fmtcolfunc.hxx>
#include <rtl/strbuf.hxx>
+#include <swcache.hxx>
TYPEINIT1( SwFmt, SwClient );
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 7efe5ea..a510b14 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -26,12 +26,12 @@
*
************************************************************************/
-#include <hints.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <editeng/scripttypeitem.hxx>
#include <hintids.hxx>
-#include <swtypes.hxx>
+#include <hints.hxx>
#include <ndtxt.hxx>
+#include <swtypes.hxx>
SwFmtChg::SwFmtChg( SwFmt* pFmt )
: SwMsgPoolItem( RES_FMT_CHG ), pChangedFmt( pFmt )
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index a761aeb..8eb1daf 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -26,24 +26,24 @@
*
************************************************************************/
-#include <hintids.hxx>
-#include <svl/whiter.hxx>
+#include <cellatr.hxx>
+#include <charfmt.hxx>
+#include <cmdid.h>
+#include <doc.hxx>
#include <editeng/colritem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/bolnitem.hxx>
#include <editeng/boxitem.hxx>
-#include <svx/xtable.hxx>
#include <fmtpdsc.hxx>
-#include <pagedesc.hxx>
-#include <charfmt.hxx>
-#include <doc.hxx>
-#include <node.hxx>
-#include <paratr.hxx>
-#include <cellatr.hxx>
-#include <cmdid.h>
+#include <hintids.hxx>
#include <istyleaccess.hxx>
-#include <numrule.hxx>
#include <list.hxx>
+#include <node.hxx>
+#include <numrule.hxx>
+#include <pagedesc.hxx>
+#include <paratr.hxx>
+#include <svl/whiter.hxx>
+#include <svx/xtable.hxx>
// ----------
// SwAttrPool
commit cab1be926902086fe4ffaedc486ab03c3c1f394f
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Sat Jun 30 22:18:03 2012 +0200
Clean up code and translate German comments in sw/source/core/attr
Change-Id: I9139387851b8ccfe265dc16e626a2791302646d6
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 6d63fb0..6b39fed 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-
#include <hintids.hxx> // contains RES_.. IDs
#include <frame.hxx>
#include <hints.hxx>
@@ -35,29 +34,31 @@
static SwClientIter* pClientIters = 0;
-TYPEINIT0(SwClient);
+TYPEINIT0( SwClient );
+
+// ----------
+// SwClient
+// ----------
-/*************************************************************************/
-SwClient::SwClient(SwModify *pToRegisterIn)
- : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 ), mbIsAllowedToBeRemovedInModifyCall(false)
+SwClient::SwClient( SwModify* pToRegisterIn )
+ : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 ), mbIsAllowedToBeRemovedInModifyCall( false )
{
if(pToRegisterIn)
// connect to SwModify
pToRegisterIn->Add(this);
}
-/*************************************************************************/
-void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem * )
+void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem* )
{
// this method only handles notification about dying SwModify objects
if( (!pOld || pOld->Which() != RES_OBJECTDYING) )
return;
- const SwPtrMsgPoolItem *pDead = static_cast<const SwPtrMsgPoolItem*>(pOld);
+ const SwPtrMsgPoolItem* pDead = static_cast<const SwPtrMsgPoolItem*>(pOld);
if(pDead && pDead->pObject == pRegisteredIn)
{
// I've got a notification from the object I know
- SwModify *pAbove = const_cast<SwModify*>(pRegisteredIn->GetRegisteredIn());
+ SwModify* pAbove = const_cast<SwModify*>(pRegisteredIn->GetRegisteredIn());
if(pAbove)
{
// if the dying object itself was listening at an SwModify, I take over
@@ -65,39 +66,37 @@ void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem * )
pAbove->Add(this);
return;
}
-
// destroy connection
pRegisteredIn->Remove(this);
}
}
-void SwClient::Modify( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue )
+void SwClient::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{
CheckRegistration( pOldValue, pNewValue );
}
void SwClient::SwClientNotify( const SwModify&, const SfxHint& )
{
-
}
-//*************************************************************************
SwClient::~SwClient()
{
- OSL_ENSURE( !pRegisteredIn || pRegisteredIn->GetDepends(),"SwModify still known, but Client already disconnected!" );
+ OSL_ENSURE( !pRegisteredIn || pRegisteredIn->GetDepends(), "SwModify still known, but Client already disconnected!" );
if( pRegisteredIn && pRegisteredIn->GetDepends() )
// still connected
pRegisteredIn->Remove( this );
}
-
sal_Bool SwClient::GetInfo( SfxPoolItem& ) const
{
- return sal_True; // und weiter
+ return sal_True;
}
+// ----------
+// SwModify
+// ----------
-/*************************************************************************/
SwModify::SwModify()
: SwClient(0), pRoot(0)
{
@@ -108,8 +107,8 @@ SwModify::SwModify()
bInSwFntCache = sal_False;
}
-SwModify::SwModify( SwModify *pToRegisterIn )
- : SwClient(pToRegisterIn), pRoot( 0 )
+SwModify::SwModify( SwModify* pToRegisterIn )
+ : SwClient( pToRegisterIn ), pRoot( 0 )
{
bModifyLocked = sal_False;
bLockClientList = sal_False;
@@ -118,7 +117,6 @@ SwModify::SwModify( SwModify *pToRegisterIn )
bInSwFntCache = sal_False;
}
-/*************************************************************************/
SwModify::~SwModify()
{
OSL_ENSURE( !IsModifyLocked(), "Modify destroyed but locked." );
@@ -134,8 +132,9 @@ SwModify::~SwModify()
// there are depending objects
if( IsInDocDTOR() )
{
- // if document gets destroyed anyway, just tell clients to forget me
- // so that they don't try to get removed from my list later when they also get destroyed
+ // If the document gets destroyed anyway, just tell clients to
+ // forget me so that they don't try to get removed from my list
+ // later when they also get destroyed
SwClientIter aIter( *this );
SwClient* p = aIter.GoStart();
while ( p )
@@ -153,42 +152,42 @@ SwModify::~SwModify()
// remove all clients that have not done themselves
// mba: possibly a hotfix for forgotten base class calls?!
while( pRoot )
- pRoot->CheckRegistration(&aDyObject, &aDyObject);
+ pRoot->CheckRegistration( &aDyObject, &aDyObject );
}
}
}
-/*************************************************************************/
-void SwModify::Modify( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue )
+void SwModify::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{
NotifyClients( pOldValue, pNewValue );
}
-void SwModify::NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue )
+void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{
- if (IsInCache() || IsInSwFntCache())
+ if ( IsInCache() || IsInSwFntCache() )
{
const sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
pNewValue ? pNewValue->Which() : 0;
CheckCaching( nWhich );
}
- if (!pRoot || IsModifyLocked())
+ if ( !pRoot || IsModifyLocked() )
return;
LockModify();
// mba: WTF?!
if( !pOldValue )
+ {
bLockClientList = sal_True;
+ }
else
{
- // following Modifies shouldn't call an ASSERT
switch( pOldValue->Which() )
{
case RES_OBJECTDYING:
case RES_REMOVE_UNO_OBJECT:
- bLockClientList = ((SwPtrMsgPoolItem *)pOldValue)->pObject != this;
+ bLockClientList = ((SwPtrMsgPoolItem*)pOldValue)->pObject != this;
break;
case RES_FOOTNOTE_DELETED:
@@ -197,6 +196,7 @@ void SwModify::NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *p
case RES_FIELD_DELETED:
bLockClientList = sal_False;
break;
+
default:
bLockClientList = sal_True;
}
@@ -209,7 +209,7 @@ void SwModify::NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *p
sal_Bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
{
- sal_Bool bRet = sal_True; // bedeutet weiter zum naechsten
+ sal_Bool bRet = sal_True; // means: continue with next
if( pRoot )
{
@@ -217,16 +217,17 @@ sal_Bool SwModify::GetInfo( SfxPoolItem& rInfo ) const
SwClient* pLast = aIter.GoStart();
if( pLast )
- while( 0 != ( bRet = pLast->GetInfo( rInfo )) &&
- 0 != ( pLast = aIter++ ) )
+ {
+ while( 0 != ( bRet = pLast->GetInfo( rInfo ) ) &&
+ 0 != ( pLast = aIter++ ) )
;
+ }
}
return bRet;
}
-/*************************************************************************/
-void SwModify::Add(SwClient *pDepend)
+void SwModify::Add( SwClient* pDepend )
{
OSL_ENSURE( !bLockClientList, "Client inserted while in Modify" );
@@ -266,9 +267,7 @@ void SwModify::Add(SwClient *pDepend)
}
}
-/*************************************************************************/
-
-SwClient* SwModify::Remove(SwClient * pDepend)
+SwClient* SwModify::Remove( SwClient* pDepend )
{
if ( bInDocDTOR )
return 0;
@@ -294,8 +293,11 @@ SwClient* SwModify::Remove(SwClient * pDepend)
while( pTmp )
{
if( pTmp->pAct == pDepend || pTmp->pDelNext == pDepend )
- // if object being removed is the current or next object in an iterator, advance this iterator
+ {
+ // if object being removed is the current or next object in an
+ // iterator, advance this iterator
pTmp->pDelNext = pR;
+ }
pTmp = pTmp->pNxtIter;
}
@@ -304,7 +306,7 @@ SwClient* SwModify::Remove(SwClient * pDepend)
}
else
{
- OSL_FAIL( "SwModify::Remove(): pDepend nicht gefunden" );
+ OSL_FAIL( "SwModify::Remove(): could not find pDepend" );
}
// disconnect client from me
@@ -314,12 +316,13 @@ SwClient* SwModify::Remove(SwClient * pDepend)
void SwModify::CheckCaching( const sal_uInt16 nWhich )
{
- if (isCHRATR(nWhich))
+ if( isCHRATR( nWhich ) )
{
SetInSwFntCache( sal_False );
}
else
- switch ( nWhich )
+ {
+ switch( nWhich )
{
case RES_OBJECTDYING:
case RES_FMT_CHG:
@@ -333,31 +336,32 @@ void SwModify::CheckCaching( const sal_uInt16 nWhich )
case RES_FRM_SIZE:
case RES_KEEP:
case RES_BREAK:
- if ( IsInCache() )
+ if( IsInCache() )
{
SwFrm::GetCache().Delete( this );
SetInCache( sal_False );
}
break;
}
+ }
}
void SwModify::CallSwClientNotify( const SfxHint& rHint ) const
{
SwClientIter aIter(*this);
- SwClient * pClient = aIter.GoStart();
- while (pClient)
+ SwClient* pClient = aIter.GoStart();
+ while( pClient )
{
pClient->SwClientNotify( *this, rHint );
pClient = aIter++;
}
}
-void SwModify::ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, TypeId nType )
+void SwModify::ModifyBroadcast( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, TypeId nType )
{
- SwClientIter aIter(*this);
- SwClient * pClient = aIter.First( nType );
- while (pClient)
+ SwClientIter aIter( *this );
+ SwClient* pClient = aIter.First( nType );
+ while( pClient )
{
pClient->Modify( pOldValue, pNewValue );
pClient = aIter.Next();
@@ -368,21 +372,17 @@ void SwModify::ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem
// SwDepend
// ----------
-/*************************************************************************/
-
-SwDepend::SwDepend(SwClient *pTellHim, SwModify *pDepend)
- : SwClient(pDepend)
+SwDepend::SwDepend( SwClient* pTellHim, SwModify* pDepend )
+ : SwClient( pDepend )
{
pToTell = pTellHim;
}
-/*************************************************************************/
-
-void SwDepend::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem *pNewValue )
+void SwDepend::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{
- if(pNewValue && pNewValue->Which() == RES_OBJECTDYING)
+ if( pNewValue && pNewValue->Which() == RES_OBJECTDYING )
CheckRegistration(pOldValue,pNewValue);
- else if(pToTell)
+ else if( pToTell )
pToTell->ModifyNotification(pOldValue, pNewValue);
}
@@ -397,7 +397,9 @@ sal_Bool SwDepend::GetInfo( SfxPoolItem& rInfo ) const
return pToTell ? pToTell->GetInfo( rInfo ) : sal_True;
}
-/********************************************************************/
+// ------------
+// SwClientIter
+// ------------
SwClientIter::SwClientIter( const SwModify& rModify )
: rRoot( rModify )
@@ -433,7 +435,7 @@ SwClientIter::~SwClientIter()
while( pTmp->pNxtIter != this )
if( 0 == ( pTmp = pTmp->pNxtIter ) )
{
- OSL_ENSURE( this, "wo ist mein Pointer" );
+ OSL_ENSURE( this, "Lost my pointer" );
return ;
}
pTmp->pNxtIter = pNxtIter;
@@ -441,7 +443,6 @@ SwClientIter::~SwClientIter()
}
}
-
SwClient* SwClientIter::operator++(int)
{
if( pDelNext == pAct )
@@ -458,8 +459,10 @@ SwClient* SwClientIter::GoStart()
{
pAct = const_cast<SwClient*>(rRoot.GetDepends());
if( pAct )
+ {
while( pAct->pLeft )
pAct = pAct->pLeft;
+ }
pDelNext = pAct;
return pAct;
}
@@ -470,8 +473,10 @@ SwClient* SwClientIter::GoEnd()
if( !pAct )
pAct = const_cast<SwClient*>(rRoot.GetDepends());
if( pAct )
+ {
while( pAct->pRight )
pAct = pAct->pRight;
+ }
pDelNext = pAct;
return pAct;
}
@@ -492,28 +497,10 @@ SwClient* SwClientIter::First( TypeId nType )
}
else
pAct = pDelNext;
-
} while( pAct );
return pAct;
}
-SwClient* SwClientIter::Next()
-{
- do {
- if( pDelNext == pAct )
- {
- pAct = pAct->pRight;
- pDelNext = pAct;
- }
- else
- pAct = pDelNext;
-
- if( pAct && pAct->IsA( aSrchId ) )
- break;
- } while( pAct );
- return pAct;
-}
-
SwClient* SwClientIter::Last( TypeId nType )
{
aSrchId = nType;
@@ -528,11 +515,27 @@ SwClient* SwClientIter::Last( TypeId nType )
else
pAct = pDelNext->pLeft;
pDelNext = pAct;
-
} while( pAct );
return pAct;
}
+SwClient* SwClientIter::Next()
+{
+ do {
+ if( pDelNext == pAct )
+ {
+ pAct = pAct->pRight;
+ pDelNext = pAct;
+ }
+ else
+ pAct = pDelNext;
+
+ if( pAct && pAct->IsA( aSrchId ) )
+ break;
+ } while( pAct );
+ return pAct;
+}
+
SwClient* SwClientIter::Previous()
{
do {
@@ -548,5 +551,4 @@ SwClient* SwClientIter::Previous()
return pAct;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 83ad6e9..a294f6c 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -26,10 +26,9 @@
*
************************************************************************/
-
#include <float.h>
#include <rtl/math.hxx>
-#include <hintids.hxx> // fuer RES_..
+#include <hintids.hxx>
#include <cellatr.hxx>
#include <calc.hxx>
#include <format.hxx>
@@ -40,37 +39,30 @@
#include <rolbck.hxx>
#include <switerator.hxx>
-
-/*************************************************************************
-|*
-*************************************************************************/
-
+// -----------------
+// SwTblBoxNumFormat
+// -----------------
SwTblBoxNumFormat::SwTblBoxNumFormat( sal_uInt32 nFormat, sal_Bool bFlag )
: SfxUInt32Item( RES_BOXATR_FORMAT, nFormat ), bAuto( bFlag )
{
}
-
int SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const
{
- OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
- return GetValue() == ((SwTblBoxNumFormat&)rAttr).GetValue() &&
- bAuto == ((SwTblBoxNumFormat&)rAttr).bAuto;
+ OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "no matching attributes" );
+ return GetValue() == ( (SwTblBoxNumFormat&) rAttr ).GetValue() &&
+ bAuto == ( (SwTblBoxNumFormat&) rAttr ).bAuto;
}
-
SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const
{
return new SwTblBoxNumFormat( GetValue(), bAuto );
}
-
-/*************************************************************************
-|*
-*************************************************************************/
-
-
+// -----------------
+// SwTblBoxFormula
+// -----------------
SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
: SfxPoolItem( RES_BOXATR_FORMULA ),
@@ -79,29 +71,28 @@ SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
{
}
-
int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const
{
OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
- return GetFormula() == ((SwTblBoxFormula&)rAttr).GetFormula() &&
- pDefinedIn == ((SwTblBoxFormula&)rAttr).pDefinedIn;
+ return GetFormula() == ( (SwTblBoxFormula&) rAttr ).GetFormula() &&
+ pDefinedIn == ( (SwTblBoxFormula&) rAttr ).pDefinedIn;
}
-
SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const
{
-// auf externe Darstellung umschalten!!
+ // switch to external rendering
SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula() );
pNew->SwTableFormula::operator=( *this );
return pNew;
}
+/** Get node type of the node containing this formula
+ E.g. TextFeld -> TextNode, or
+ BoxAttribute -> BoxStartNode
- // suche den Node, in dem die Formel steht:
- // TextFeld -> TextNode,
- // BoxAttribut -> BoxStartNode
- // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+ Caution: Has to be overloaded when inheriting.
+*/
const SwNode* SwTblBoxFormula::GetNodeOfFormula() const
{
const SwNode* pRet = 0;
@@ -114,7 +105,6 @@ const SwNode* SwTblBoxFormula::GetNodeOfFormula() const
return pRet;
}
-
SwTableBox* SwTblBoxFormula::GetTableBox()
{
SwTableBox* pBox = 0;
@@ -123,7 +113,6 @@ SwTableBox* SwTblBoxFormula::GetTableBox()
return pBox;
}
-
void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
{
if( !pDefinedIn )
@@ -132,14 +121,14 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
SwTableFmlUpdate* pUpdtFld;
if( !pItem || RES_TABLEFML_UPDATE != pItem->Which() )
{
- // setze bei allen das Value-Flag zurueck
+ // reset value flag
ChgValid( sal_False );
return ;
}
pUpdtFld = (SwTableFmlUpdate*)pItem;
- // bestimme die Tabelle, in der das Attribut steht
+ // detect table that contains this attribute
const SwTableNode* pTblNd;
const SwNode* pNd = GetNodeOfFormula();
if( pNd && &pNd->GetNodes() == &pNd->GetDoc()->GetNodes() &&
@@ -148,27 +137,21 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
switch( pUpdtFld->eFlags )
{
case TBL_CALC:
- // setze das Value-Flag zurueck
- // JP 17.06.96: interne Darstellung auf alle Formeln
- // (Referenzen auf andere Tabellen!!!)
- ChgValid( sal_False );
+ // reset value flag
+ ChgValid( sal_False );
break;
case TBL_BOXNAME:
- // ist es die gesuchte Tabelle ??
if( &pTblNd->GetTable() == pUpdtFld->pTbl )
- // zur externen Darstellung
+ // use external rendering
PtrToBoxNm( pUpdtFld->pTbl );
break;
case TBL_BOXPTR:
- // zur internen Darstellung
- // JP 17.06.96: interne Darstellung auf alle Formeln
- // (Referenzen auf andere Tabellen!!!)
+ // internal rendering
BoxNmToPtr( &pTblNd->GetTable() );
break;
case TBL_RELBOXNAME:
- // ist es die gesuchte Tabelle ??
if( &pTblNd->GetTable() == pUpdtFld->pTbl )
- // zur relativen Darstellung
+ // relative rendering
ToRelBoxNm( pUpdtFld->pTbl );
break;
@@ -182,18 +165,18 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
}
else
pUpdtFld->bBehindSplitLine = sal_False;
- // kein break
+ // no break
case TBL_MERGETBL:
if( pUpdtFld->pHistory )
{
- // fuer die History brauche ich aber die unveraenderte Formel
+ // for a history record the unchanged formula is needed
SwTblBoxFormula aCopy( *this );
pUpdtFld->bModified = sal_False;
ToSplitMergeBoxNm( *pUpdtFld );
if( pUpdtFld->bModified )
{
- // und dann in der externen Darstellung
+ // external rendering
aCopy.PtrToBoxNm( &pTblNd->GetTable() );
pUpdtFld->pHistory->Add( &aCopy, &aCopy,
pNd->FindTableBoxStartNode()->GetIndex() );
@@ -206,56 +189,48 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
}
}
-
void SwTblBoxFormula::Calc( SwTblCalcPara& rCalcPara, double& rValue )
{
- if( !rCalcPara.rCalc.IsCalcError() ) // ist schon Fehler gesetzt ?
+ if( !rCalcPara.rCalc.IsCalcError() )
{
- // erzeuge aus den BoxNamen die Pointer
+ // create pointers from box names
BoxNmToPtr( rCalcPara.pTbl );
String sFml( MakeFormel( rCalcPara ));
if( !rCalcPara.rCalc.IsCalcError() )
rValue = rCalcPara.rCalc.Calculate( sFml ).GetDouble();
else
rValue = DBL_MAX;
- ChgValid( !rCalcPara.IsStackOverFlow() ); // der Wert ist wieder gueltig
+ ChgValid( !rCalcPara.IsStackOverFlow() ); // value is now valid again
}
}
-/*************************************************************************
-|*
-*************************************************************************/
-
+// -------------
+// SwTblBoxValue
+// -------------
SwTblBoxValue::SwTblBoxValue()
: SfxPoolItem( RES_BOXATR_VALUE ), nValue( 0 )
{
}
-
SwTblBoxValue::SwTblBoxValue( const double nVal )
: SfxPoolItem( RES_BOXATR_VALUE ), nValue( nVal )
{
}
-
int SwTblBoxValue::operator==( const SfxPoolItem& rAttr ) const
{
- OSL_ENSURE(SfxPoolItem::operator==(rAttr), "SwTblBoxValue: item not equal");
+ OSL_ENSURE( SfxPoolItem::operator==(rAttr), "SwTblBoxValue: item not equal" );
SwTblBoxValue const& rOther( static_cast<SwTblBoxValue const&>(rAttr) );
// items with NaN should be equal to enable pooling
- return ::rtl::math::isNan(nValue)
- ? ::rtl::math::isNan(rOther.nValue)
- : (nValue == rOther.nValue);
+ return ::rtl::math::isNan( nValue )
+ ? ::rtl::math::isNan( rOther.nValue )
+ : ( nValue == rOther.nValue );
}
-
SfxPoolItem* SwTblBoxValue::Clone( SfxItemPool* ) const
{
return new SwTblBoxValue( nValue );
}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
index a259605..a208290 100644
--- a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
+++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
@@ -27,7 +27,6 @@
************************************************************************/
#include <fmtwrapinfluenceonobjpos.hxx>
-
#include <unomid.h>
using namespace ::com::sun::star;
@@ -35,15 +34,13 @@ using namespace ::com::sun::star::uno;
TYPEINIT1(SwFmtWrapInfluenceOnObjPos, SfxPoolItem);
-SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
- sal_Int16 _nWrapInfluenceOnPosition )
+SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition )
: SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
mnWrapInfluenceOnPosition( _nWrapInfluenceOnPosition )
{
}
-SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
- const SwFmtWrapInfluenceOnObjPos& _rCpy )
+SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos( const SwFmtWrapInfluenceOnObjPos& _rCpy )
: SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
mnWrapInfluenceOnPosition( _rCpy.GetWrapInfluenceOnObjPos() )
{
@@ -53,8 +50,7 @@ SwFmtWrapInfluenceOnObjPos::~SwFmtWrapInfluenceOnObjPos()
{
}
-SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=(
- const SwFmtWrapInfluenceOnObjPos& _rSource )
+SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=( const SwFmtWrapInfluenceOnObjPos& _rSource )
{
mnWrapInfluenceOnPosition = _rSource.GetWrapInfluenceOnObjPos();
@@ -63,7 +59,7 @@ SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=(
int SwFmtWrapInfluenceOnObjPos::operator==( const SfxPoolItem& _rAttr ) const
{
- OSL_ENSURE( SfxPoolItem::operator==( _rAttr ), "keine gleichen Attribute" );
+ OSL_ENSURE( SfxPoolItem::operator==( _rAttr ), "no matching attributes" );
return ( mnWrapInfluenceOnPosition ==
static_cast<const SwFmtWrapInfluenceOnObjPos&>(_rAttr).
GetWrapInfluenceOnObjPos() );
@@ -81,15 +77,14 @@ bool SwFmtWrapInfluenceOnObjPos::QueryValue( Any& rVal, sal_uInt8 nMemberId ) co
switch ( nMemberId )
{
case MID_WRAP_INFLUENCE:
- {
- rVal <<= GetWrapInfluenceOnObjPos();
- }
- break;
+ {
+ rVal <<= GetWrapInfluenceOnObjPos();
+ }
+ break;
default:
OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
bRet = false;
}
-
return bRet;
}
@@ -101,36 +96,33 @@ bool SwFmtWrapInfluenceOnObjPos::PutValue( const Any& rVal, sal_uInt8 nMemberId
switch ( nMemberId )
{
case MID_WRAP_INFLUENCE:
- {
- sal_Int16 nNewWrapInfluence = 0;
- rVal >>= nNewWrapInfluence;
- // #i35017# - constant names have changed and
- // <ITERATIVE> has been added
- if ( nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
- nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
- nNewWrapInfluence == text::WrapInfluenceOnPosition::ITERATIVE )
{
- SetWrapInfluenceOnObjPos( nNewWrapInfluence );
+ sal_Int16 nNewWrapInfluence = 0;
+ rVal >>= nNewWrapInfluence;
+ // #i35017# - constant names have changed and <ITERATIVE> has been added
+ if ( nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
+ nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
+ nNewWrapInfluence == text::WrapInfluenceOnPosition::ITERATIVE )
+ {
+ SetWrapInfluenceOnObjPos( nNewWrapInfluence );
+ }
+ else
+ {
+ OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" );
+ bRet = false;
+ }
}
- else
- {
- OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" );
- bRet = false;
- }
- }
- break;
+ break;
default:
OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - unknown MemberId" );
bRet = false;
}
-
return bRet;
}
void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition )
{
- // #i35017# - constant names have changed and consider
- // new value <ITERATIVE>
+ // #i35017# - constant names have changed and consider new value <ITERATIVE>
if ( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
_nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
_nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ITERATIVE )
@@ -143,8 +135,8 @@ void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInflu
}
}
-// #i35017# - add parameter <_bIterativeAsOnceConcurrent>
-// to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
+// #i35017# - add parameter <_bIterativeAsOnceConcurrent> to control, if
+// value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
sal_Int16 SwFmtWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
const bool _bIterativeAsOnceConcurrent ) const
{
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index dbd5e31..f8db561 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -26,25 +26,21 @@
*
************************************************************************/
-#include <hintids.hxx> // fuer RES_..
-#include <frame.hxx> // fuer AttrCache
+#include <hintids.hxx>
+#include <frame.hxx>
#include <format.hxx>
-#include <hints.hxx> // fuer SwFmtChg
+#include <hints.hxx>
#include <doc.hxx>
-#include <paratr.hxx> // fuer SwParaFmt - SwHyphenBug
+#include <paratr.hxx>
#include <swcache.hxx>
#include <fmtcolfunc.hxx>
#include <rtl/strbuf.hxx>
-TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
-
-/*************************************************************************
-|* SwFmt::SwFmt
-*************************************************************************/
-
+TYPEINIT1( SwFmt, SwClient );
SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
- const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
+ const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm,
+ sal_uInt16 nFmtWhich )
: SwModify( pDrvdFrm ),
aSet( rPool, pWhichRanges ),
nWhichId( nFmtWhich ),
@@ -61,9 +57,9 @@ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
aSet.SetParent( &pDrvdFrm->aSet );
}
-
-SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
- const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
+SwFmt::SwFmt( SwAttrPool& rPool, const String& rFmtNm,
+ const sal_uInt16* pWhichRanges, SwFmt* pDrvdFrm,
+ sal_uInt16 nFmtWhich )
: SwModify( pDrvdFrm ),
aFmtName( rFmtNm ),
aSet( rPool, pWhichRanges ),
@@ -80,7 +76,6 @@ SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
aSet.SetParent( &pDrvdFrm->aSet );
}
-
SwFmt::SwFmt( const SwFmt& rFmt )
: SwModify( rFmt.DerivedFrom() ),
aFmtName( rFmt.aFmtName ),
@@ -97,17 +92,10 @@ SwFmt::SwFmt( const SwFmt& rFmt )
if( rFmt.DerivedFrom() )
aSet.SetParent( &rFmt.DerivedFrom()->aSet );
- // einige Sonderbehandlungen fuer Attribute
+ // a few special treatments for attributes
aSet.SetModifyAtAttr( this );
}
-/*************************************************************************
-|* SwFmt &SwFmt::operator=(const SwFmt& aFmt)
-|*
-|* Beschreibung Dokument 1.14
-*************************************************************************/
-
-
SwFmt &SwFmt::operator=(const SwFmt& rFmt)
{
nWhichId = rFmt.nWhichId;
@@ -122,34 +110,36 @@ SwFmt &SwFmt::operator=(const SwFmt& rFmt)
}
SetInSwFntCache( sal_False );
- // kopiere nur das Attribut-Delta Array
+ // copy only array with attributes delta
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
- aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
- // einige Sonderbehandlungen fuer Attribute
+ // a few special treatments for attributes
aSet.SetModifyAtAttr( this );
- // PoolItem-Attr erzeugen fuers Modify !!!
+ // create PoolItem attribute for Modify
if( aOld.Count() )
{
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
if( GetRegisteredIn() != rFmt.GetRegisteredIn() )
{
if( GetRegisteredIn() )
GetRegisteredInNonConst()->Remove(this);
- if(rFmt.GetRegisteredIn())
+ if( rFmt.GetRegisteredIn() )
{
const_cast<SwFmt&>(rFmt).GetRegisteredInNonConst()->Add(this);
aSet.SetParent( &rFmt.aSet );
}
else
+ {
aSet.SetParent( 0 );
+ }
}
bAutoFmt = rFmt.bAutoFmt;
bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
@@ -158,7 +148,7 @@ SwFmt &SwFmt::operator=(const SwFmt& rFmt)
void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
{
- OSL_ENSURE(!IsDefault(), "SetName: Defaultformat" );
+ OSL_ENSURE( !IsDefault(), "SetName: Defaultformat" );
if( bBroadcast )
{
SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
@@ -172,25 +162,20 @@ void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
}
}
-/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * diese Funktion wird in jedem Copy-Ctor gerufen, damit die
- * Attribute kopiert werden. Diese koennen erst kopiert werden,
- * wenn die abgeleitet Klasse existiert, denn beim Setzen der
- * Attribute wird die Which()-Methode gerufen, die hier in der
- * Basis-Klasse auf 0 defaultet ist.
- *
- * Zusatz: JP 8.4.1994
- * Wird ueber Dokumentgrenzen kopiert, so muss das neue Dokument
- * mit angeben werden, in dem this steht. Z.Z. ist das fuers
- * DropCaps wichtig, dieses haelt Daten, die tief kopiert werden
- * muessen !!
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+/** Copy attributes
+ This function is called in every Copy-Ctor for copying the attributes.
+ The latter can be only copied as soon as the derived class exists since
+ for setting them the Which() function is called and that has the default
+ value of 0 in the base class and is then overridden by the derived class.
+ If we copy over multiple documents then the new document has to be provided
+ in which <this> is defined. Currently this is important for DropCaps
+ because that contains data that needs to be copied deeply.
+*/
void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
{
- // kopiere nur das Attribut-Delta Array
-
+ // copy only array with attributes delta
if ( IsInCache() )
{
SwFrm::GetCache().Delete( this );
@@ -198,17 +183,17 @@ void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
}
SetInSwFntCache( sal_False );
- // Sonderbehandlung fuer einige Attribute
+ // special treatments for some attributes
SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
- if( !bReplace ) // nur die neu, die nicht gesetzt sind ??
+ if( !bReplace ) // refresh only those that are not set?
{
- if( pChgSet == (SwAttrSet*)&rFmt.aSet ) // Set hier kopieren
+ if( pChgSet == (SwAttrSet*)&rFmt.aSet )
pChgSet = new SwAttrSet( rFmt.aSet );
pChgSet->Differentiate( aSet );
}
- // kopiere nur das Attribut-Delta Array
+ // copy only array with attributes delta
if( pChgSet->GetPool() != aSet.GetPool() )
pChgSet->CopyToModify( *this );
else
@@ -218,38 +203,31 @@ void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
{
- // einige Sonderbehandlungen fuer Attribute
+ // a few special treatments for attributes
aSet.SetModifyAtAttr( this );
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
}
- if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // Set hier angelegt ?
+ if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // was a Set created?
delete pChgSet;
}
-/*************************************************************************
-|* SwFmt::~SwFmt()
-|*
-|* Beschreibung Dokument 1.14
-*************************************************************************/
-
-
SwFmt::~SwFmt()
{
- /* das passiert bei der ObjectDying Message */
- /* alle Abhaengigen auf DerivedFrom umhaengen */
+ // This happens at a ObjectDying message. Thus put all dependent
+ // ones on DerivedFrom.
if( GetDepends() )
{
- OSL_ENSURE(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
+ OSL_ENSURE( DerivedFrom(), "SwFmt::~SwFmt: Def dependents!" );
bFmtInDTOR = sal_True;
- SwFmt *pParentFmt = DerivedFrom();
- if (!pParentFmt)
+ SwFmt* pParentFmt = DerivedFrom();
+ if( !pParentFmt )
{
OSL_FAIL(rtl::OStringBuffer(
RTL_CONSTASCII_STRINGPARAM("~SwFmt: parent format missing from: ")).
@@ -259,63 +237,54 @@ SwFmt::~SwFmt()
{
while( GetDepends() )
{
- SwFmtChg aOldFmt(this);
- SwFmtChg aNewFmt(pParentFmt);
- SwClient * pDepend = (SwClient*)GetDepends();
- pParentFmt->Add(pDepend);
- pDepend->ModifyNotification(&aOldFmt, &aNewFmt);
+ SwFmtChg aOldFmt( this );
+ SwFmtChg aNewFmt( pParentFmt );
+ SwClient* pDepend = (SwClient*)GetDepends();
+ pParentFmt->Add( pDepend );
+ pDepend->ModifyNotification( &aOldFmt, &aNewFmt );
}
}
}
}
-
-/*************************************************************************
-|* void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
-|*
-|* Beschreibung Dokument 1.14
-*************************************************************************/
-
-
void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{
- sal_Bool bWeiter = sal_True; // sal_True = Propagierung an die Abhaengigen
+ sal_Bool bContinue = sal_True; // sal_True = pass on to dependent ones
sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
pNewValue ? pNewValue->Which() : 0 ;
switch( nWhich )
{
- case 0: break; // Which-Id von 0 ???
+ case 0: break; // Which-Id of 0?
case RES_OBJECTDYING :
{
- // ist das sterbende Object das "Parent"-Format von diesen Format,
- // dann haengt sich dieses Format an den Parent vom Parent
- SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
+ // If the dying object is the parent format of this format so
+ // attach this to the parent of the parent
+ SwFmt* pFmt = (SwFmt*) ((SwPtrMsgPoolItem*)pNewValue)->pObject;
- // nicht umhaengen wenn dieses das oberste Format ist !!
+ // do not move if this is the topmost format
if( GetRegisteredIn() && GetRegisteredIn() == pFmt )
{
if( pFmt->GetRegisteredIn() )
{
- // wenn Parent, dann im neuen Parent wieder anmelden
+ // if parent so register in new parent
pFmt->DerivedFrom()->Add( this );
aSet.SetParent( &DerivedFrom()->aSet );
}
else
{
- // sonst auf jeden Fall beim sterbenden abmelden
+ // otherwise de-register at least from dying one
DerivedFrom()->Remove( this );
aSet.SetParent( 0 );
}
}
- } // OBJECTDYING
+ }
break;
-
case RES_ATTRSET_CHG:
if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
{
- //nur die weiter geben, die hier nicht gesetzt sind !!
+ // pass only those that are not set
SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
@@ -323,69 +292,58 @@ void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
aNew.GetChgSet()->Differentiate( aSet );
if( aNew.Count() )
- // keine mehr gesetzt, dann Ende !!
- NotifyClients( &aOld, &aNew );
- bWeiter = sal_False;
+ NotifyClients( &aOld, &aNew );
+ bContinue = sal_False;
}
break;
case RES_FMT_CHG:
- // falls mein Format Parent umgesetzt wird, dann melde ich
- // meinen Attrset beim Neuen an.
+ // if the format parent will be moved so register my attribute set at
+ // the new one
- // sein eigenes Modify ueberspringen !!
+ // skip my own Modify
if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
{
- // den Set an den neuen Parent haengen
+ // attach Set to new parent
aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
}
break;
-
case RES_RESET_FMTWRITTEN:
{
- // IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
- // Formate (und keine Frames) propagieren.
- // mba: the code does the opposite from what is written in the comment!
ResetWritten();
+
// mba: here we don't use the additional stuff from NotifyClients().
// should we?!
// mba: move the code that ignores this event to the clients
+
+ // pass Hint only to dependent formats (no Frames)
ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) );
- bWeiter = sal_False;
+ bContinue = sal_False;
}
break;
-
default:
{
- // Ist das Attribut in diesem Format definiert, dann auf
- // NICHT weiter propagieren !!
+ // attribute is defined in this format
if( SFX_ITEM_SET == aSet.GetItemState( nWhich, sal_False ))
{
-// wie finde ich heraus, ob nicht ich die Message versende ??
-// aber wer ruft das hier ????
-// OSL_ENSURE( FALSE, "Modify ohne Absender verschickt" );
-//JP 11.06.96: DropCaps koennen hierher kommen
- OSL_ENSURE( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
- bWeiter = sal_False;
+ // DropCaps might come into this block
+ OSL_ENSURE( RES_PARATR_DROP == nWhich, "Modify was sent without sender" );
+ bContinue = sal_False;
}
+ }
+ }
- } // default
- } // switch
-
- if( bWeiter )
+ if( bContinue )
{
- // laufe durch alle abhaengigen Formate
+ // walk over all dependent formats
NotifyClients( pOldValue, pNewValue );
}
-
}
-
sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
{
if ( pDerFrom )
{
- // Zyklus?
const SwFmt* pFmt = pDerFrom;
while ( pFmt != 0 )
{
@@ -397,7 +355,7 @@ sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
}
else
{
- // Nichts angegeben, Dflt-Format suchen
+ // nothing provided, search for Dflt format
pDerFrom = this;
while ( pDerFrom->DerivedFrom() )
pDerFrom = pDerFrom->DerivedFrom();
@@ -409,7 +367,7 @@ sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
|| ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
|| ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
|| ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
- "SetDerivedFrom: Aepfel von Birnen ableiten?");
+ "SetDerivedFrom: derive apples from oranges?");
if ( IsInCache() )
{
@@ -418,18 +376,17 @@ sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
}
SetInSwFntCache( sal_False );
- pDerFrom->Add(this);
+ pDerFrom->Add( this );
aSet.SetParent( &pDerFrom->aSet );
- SwFmtChg aOldFmt(this);
- SwFmtChg aNewFmt(this);
+ SwFmtChg aOldFmt( this );
+ SwFmtChg aNewFmt( this );
ModifyNotification( &aOldFmt, &aNewFmt );
return sal_True;
}
-
-sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
+sal_Bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
{
if ( IsInCache() || IsInSwFntCache() )
{
@@ -437,13 +394,14 @@ sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
CheckCaching( nWhich );
}
- // wenn Modify gelockt ist, werden keine Modifies verschickt;
- // fuer FrmFmt's immer das Modify verschicken!
+ // if Modify is locked then no modifications will be sent;
+ // but call Modify always for FrmFmts
sal_Bool bRet = sal_False;
const sal_uInt16 nFmtWhich = Which();
- if( IsModifyLocked() || (!GetDepends() &&
- (RES_GRFFMTCOLL == nFmtWhich ||
- RES_TXTFMTCOLL == nFmtWhich ) ) )
+ if( IsModifyLocked() ||
+ ( !GetDepends() &&
+ (RES_GRFFMTCOLL == nFmtWhich ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
{
if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
aSet.SetModifyAtAttr( this );
@@ -455,25 +413,24 @@ sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
}
else
{
- // kopiere nur das Attribut-Delta Array
+ // copy only array with attributes delta
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
- aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
if( bRet )
{
- // einige Sonderbehandlungen fuer Attribute
+ // some special treatments for attributes
aSet.SetModifyAtAttr( this );
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
}
return bRet;
}
-
sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
{
if( !rSet.Count() )
@@ -486,8 +443,8 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
}
SetInSwFntCache( sal_False );
- // wenn Modify gelockt ist, werden keine Modifies verschickt;
- // fuer FrmFmt's immer das Modify verschicken!
+ // if Modify is locked then no modifications will be sent;
+ // but call Modify always for FrmFmts
sal_Bool bRet = sal_False;
const sal_uInt16 nFmtWhich = Which();
if ( IsModifyLocked() ||
@@ -506,30 +463,28 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
else
{
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
- aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
if( bRet )
{
- // einige Sonderbehandlungen fuer Attribute
+ // some special treatments for attributes
aSet.SetModifyAtAttr( this );
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
}
return bRet;
}
-// Nimmt den Hint mit nWhich aus dem Delta-Array
-
-
+// remove Hint using nWhich from array with delta
sal_Bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
{
if( !aSet.Count() )
return sal_False;
if( !nWhich2 || nWhich2 < nWhich1 )
- nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+ nWhich2 = nWhich1; // then set to 1st ID, only this item
if ( IsInCache() || IsInSwFntCache() )
{
@@ -537,29 +492,25 @@ sal_Bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
CheckCaching( n );
}
- // wenn Modify gelockt ist, werden keine Modifies verschickt
+ // if Modify is locked then no modifications will be sent
if( IsModifyLocked() )
return 0 != (( nWhich2 == nWhich1 )
- ? aSet.ClearItem( nWhich1 )
- : aSet.ClearItem_BC( nWhich1, nWhich2 ));
+ ? aSet.ClearItem( nWhich1 )
+ : aSet.ClearItem_BC( nWhich1, nWhich2 ));
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
- aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
sal_Bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
-
if( bRet )
{
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
return bRet;
}
-
-
// #i73790#
-// method renamed
sal_uInt16 SwFmt::ResetAllFmtAttr()
{
if( !aSet.Count() )
@@ -572,36 +523,28 @@ sal_uInt16 SwFmt::ResetAllFmtAttr()
}
SetInSwFntCache( sal_False );
- // wenn Modify gelockt ist, werden keine Modifies verschickt
+ // if Modify is locked then no modifications will be sent
if( IsModifyLocked() )
return aSet.ClearItem( 0 );
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
- aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
sal_Bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
-
if( bRet )
{
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
return aNew.Count();
}
-
-/*************************************************************************
-|* void SwFmt::GetInfo( const SfxPoolItem& ) const
-*************************************************************************/
-
-
sal_Bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
{
sal_Bool bRet = SwModify::GetInfo( rInfo );
return bRet;
}
-
void SwFmt::DelDiffs( const SfxItemSet& rSet )
{
if( !aSet.Count() )
@@ -614,7 +557,7 @@ void SwFmt::DelDiffs( const SfxItemSet& rSet )
}
SetInSwFntCache( sal_False );
- // wenn Modify gelockt ist, werden keine Modifies verschickt
+ // if Modify is locked then no modifications will be sent
if( IsModifyLocked() )
{
aSet.Intersect( rSet );
@@ -622,14 +565,13 @@ void SwFmt::DelDiffs( const SfxItemSet& rSet )
}
SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
- aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
sal_Bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
-
if( bRet )
{
SwAttrSetChg aChgOld( aSet, aOld );
SwAttrSetChg aChgNew( aSet, aNew );
- ModifyNotification( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
}
}
@@ -639,8 +581,6 @@ void SwFmt::DelDiffs( const SfxItemSet& rSet )
Default implementation returns false. Thus, subclasses have to overload
method, if the specific subclass can have a transparent background.
- @author OD
-
@return false, default implementation
*/
sal_Bool SwFmt::IsBackgroundTransparent() const
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 10119f4..7efe5ea 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -27,72 +27,56 @@
************************************************************************/
#include <hints.hxx>
-
#include <com/sun/star/i18n/ScriptType.hpp>
#include <editeng/scripttypeitem.hxx>
#include <hintids.hxx>
#include <swtypes.hxx>
#include <ndtxt.hxx>
-SwFmtChg::SwFmtChg( SwFmt *pFmt )
- : SwMsgPoolItem( RES_FMT_CHG ),
- pChangedFmt( pFmt )
-{}
-
-
+SwFmtChg::SwFmtChg( SwFmt* pFmt )
+ : SwMsgPoolItem( RES_FMT_CHG ), pChangedFmt( pFmt )
+{
+}
SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL )
- : SwMsgPoolItem( RES_INS_TXT ),
- nPos( nP ),
- nLen( nL )
-{}
-
-
+ : SwMsgPoolItem( RES_INS_TXT ), nPos( nP ), nLen( nL )
+{
+}
SwDelChr::SwDelChr( xub_StrLen nP )
- : SwMsgPoolItem( RES_DEL_CHR ),
- nPos( nP )
-{}
-
-
+ : SwMsgPoolItem( RES_DEL_CHR ), nPos( nP )
+{
+}
SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
- : SwMsgPoolItem( RES_DEL_TXT ),
- nStart( nS ),
- nLen( nL )
-{}
-
-
+ : SwMsgPoolItem( RES_DEL_TXT ), nStart( nS ), nLen( nL )
+{
+}
SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW )
- : SwMsgPoolItem( RES_UPDATE_ATTR ),
- nStart( nS ),
- nEnd( nE ),
- nWhichAttr( nW )
-{}
-
+ : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW )
+{
+}
-// SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen
-// Updaten sollen. Um Seiten-/KapitelNummer feststellen zu koennen, muss
-// der akt. Frame befragt werden. Dafuer wird das akt. OutputDevice benoetigt.
+/** Is sent if reference marks should be updated.
+ To get the page/chapter number, the frame has to be asked. For that we need
+ the current OutputDevice.
+*/
SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
: SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
pOut( pOutput )
{
- OSL_ENSURE( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" );
+ OSL_ENSURE( pOut, "No OutputDevice pointer" );
}
-
SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
- : SwMsgPoolItem( RES_DOCPOS_UPDATE ),
- nDocPos(nDcPos)
-{}
-
-
+ : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
+{
+}
-// SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
+/** Is sent if a table should be recalculated */
SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
: SwMsgPoolItem( RES_TABLEFML_UPDATE ),
pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ),
@@ -100,23 +84,21 @@ SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
{
DATA.pDelTbl = 0;
bModified = bBehindSplitLine = sal_False;
- OSL_ENSURE( pTbl, "es muss ein Table-Pointer gesetzt werden!" );
+ OSL_ENSURE( pTbl, "No Table pointer" );
}
-
SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
- : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ),
- pCntntNode( 0 ), pNodes( pNds )
-{}
-
+ : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), pCntntNode( 0 ), pNodes( pNds )
+{
+}
SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
: SwMsgPoolItem( RES_ATTRSET_CHG ),
bDelSet( sal_False ),
pChgSet( &rSet ),
pTheChgdSet( &rTheSet )
-{}
-
+{
+}
SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
: SwMsgPoolItem( RES_ATTRSET_CHG ),
@@ -126,51 +108,44 @@ SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
pChgSet = new SwAttrSet( *rChgSet.pChgSet );
}
-
SwAttrSetChg::~SwAttrSetChg()
{
if( bDelSet )
delete pChgSet;
}
-
#ifdef DBG_UTIL
-
void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
{
OSL_ENSURE( bDelSet, "der Set darf nicht veraendert werden!" );
pChgSet->ClearItem( nWhch );
}
-
#endif
-
SwMsgPoolItem::SwMsgPoolItem( sal_uInt16 nWhch )
: SfxPoolItem( nWhch )
-{}
-
+{
+}
-// "Overhead" vom SfxPoolItem
+// "Overhead" of SfxPoolItem
int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
{
OSL_FAIL( "SwMsgPoolItem kennt kein ==" );
return 0;
}
-
SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
{
OSL_FAIL( "SwMsgPoolItem kennt kein Clone" );
return 0;
}
-/******************************************************************************
- * hole aus der Default-Attribut Tabelle ueber den Which-Wert
- * das entsprechende default Attribut.
- * Ist keines vorhanden, returnt ein 0-Pointer !!!
- * Used to be inlined (hintids.hxx) in PRODUCT.
- ******************************************************************************/
#if OSL_DEBUG_LEVEL > 0
+/** Get the default attribute from corresponding default attribute table.
+
+ @param[in] nWhich Position in table
+ @return Attribute if found, null pointer otherwise
+*/
const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
{
OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
@@ -180,25 +155,23 @@ const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
return pHt;
}
#else
+/** Get the default attribute from corresponding default attribute table.
+
+ @param[in] nWhich Position in table
+*/
const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
{
return aAttrTab[ nWhich - POOLATTR_BEGIN ];
}
#endif
-
-
SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
: SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
{
}
-
SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
- SwMsgPoolItem( RES_VIRTPAGENUM_INFO ),
- pPage( 0 ),
- pOrigPage( pPg ),
- pFrm( 0 )
+ SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), pPage( 0 ), pOrigPage( pPg ), pFrm( 0 )
{
}
@@ -220,8 +193,6 @@ void SwFindNearestNode::CheckNode( const SwNode& rNd )
}
}
-
-
sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
{
static const sal_uInt16 aLangMap[3] =
@@ -261,6 +232,7 @@ sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
case RES_CHRATR_CTL_WEIGHT:
pM = aWeightMap;
break;
+
case RES_CHRATR_POSTURE:
case RES_CHRATR_CJK_POSTURE:
case RES_CHRATR_CTL_POSTURE:
@@ -280,9 +252,12 @@ sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
switch( nScript)
{
- case ScriptType::COMPLEX: ++pM; // no break;
- case ScriptType::ASIAN: ++pM; // no break;
- default: nRet = *pM;
+ case ScriptType::COMPLEX:
+ ++pM; // no break;
+ case ScriptType::ASIAN:
+ ++pM; // no break;
+ default:
+ nRet = *pM;
}
}
}
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index e609817..a761aeb 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -38,13 +38,16 @@
#include <charfmt.hxx>
#include <doc.hxx>
#include <node.hxx>
-#include <paratr.hxx> // fuer SetModifyAtAttr
-#include <cellatr.hxx> // fuer SetModifyAtAttr
+#include <paratr.hxx>
+#include <cellatr.hxx>
#include <cmdid.h>
#include <istyleaccess.hxx>
#include <numrule.hxx>
#include <list.hxx>
+// ----------
+// SwAttrPool
+// ----------
SwAttrPool::SwAttrPool( SwDoc* pD )
: SfxItemPool( rtl::OUString("SWG"),
@@ -65,18 +68,20 @@ SwAttrPool::~SwAttrPool()
{
}
+// ---------
+// SwAttrSet
+// ---------
+
SwAttrSet::SwAttrSet( SwAttrPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2 )
: SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
{
}
-
SwAttrSet::SwAttrSet( SwAttrPool& rPool, const sal_uInt16* nWhichPairTable )
: SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
{
}
-
SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
: SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
{
@@ -115,7 +120,7 @@ SfxItemSet* SwAttrSet::Clone( sal_Bool bItems, SfxItemPool *pToPool ) const
}
int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
- SwAttrSet* pOld, SwAttrSet* pNew )
+ SwAttrSet* pOld, SwAttrSet* pNew )
{
pNewSet = pNew;
pOldSet = pOld;
@@ -126,7 +131,7 @@ int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
int SwAttrSet::Put_BC( const SfxItemSet& rSet,
- SwAttrSet* pOld, SwAttrSet* pNew )
+ SwAttrSet* pOld, SwAttrSet* pNew )
{
pNewSet = pNew;
pOldSet = pOld;
@@ -135,10 +140,8 @@ int SwAttrSet::Put_BC( const SfxItemSet& rSet,
return nRet;
}
-
-
sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich,
- SwAttrSet* pOld, SwAttrSet* pNew )
+ SwAttrSet* pOld, SwAttrSet* pNew )
{
pNewSet = pNew;
pOldSet = pOld;
@@ -147,11 +150,10 @@ sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich,
return nRet;
}
-
sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
- SwAttrSet* pOld, SwAttrSet* pNew )
+ SwAttrSet* pOld, SwAttrSet* pNew )
{
- OSL_ENSURE( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
+ OSL_ENSURE( nWhich1 <= nWhich2, "no valid range" );
pNewSet = pNew;
pOldSet = pOld;
sal_uInt16 nRet = 0;
@@ -161,10 +163,8 @@ sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
return nRet;
}
-
-
int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
- SwAttrSet* pOld, SwAttrSet* pNew )
+ SwAttrSet* pOld, SwAttrSet* pNew )
{
pNewSet = pNew;
pOldSet = pOld;
@@ -173,26 +173,23 @@ int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
}
-// Notification-Callback
-void SwAttrSet::Changed( const SfxPoolItem& rOld,
- const SfxPoolItem& rNew )
+/// Notification callback
+void SwAttrSet::Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew )
{
if( pOldSet )
pOldSet->PutChgd( rOld );
-
if( pNewSet )
pNewSet->PutChgd( rNew );
}
+/** special treatment for some attributes
-// ----------------------------------------------------------------
-// Sonderbehandlung fuer einige Attribute
-// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
-// - SwFmtDropCaps
-// - SwFmtPageDesc
-// (Wird beim Einfuegen in Formate/Nodes gerufen)
-// ----------------------------------------------------------------
+ Set the Modify pointer (old pDefinedIn) for the following attributes:
+ - SwFmtDropCaps
+ - SwFmtPageDesc
+ (Is called at inserts into formats/nodes)
+*/
bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
{
bool bSet = false;
@@ -208,8 +205,8 @@ bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, sal_False, &pItem ) &&
((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
{
- // CharFormat gesetzt und dann noch in unterschiedlichen
- // Attribut Pools, dann muss das CharFormat kopiert werden!
+ // If CharFormat is set and it is set in different attribute pools then
+ // the CharFormat has to be copied.
SwCharFmt* pCharFmt;
if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
&& GetPool() != pCharFmt->GetAttrSet().GetPool() )
@@ -233,7 +230,7 @@ bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
void SwAttrSet::CopyToModify( SwModify& rMod ) const
{
- // kopiere die Attribute ggfs. ueber Dokumentgrenzen
+ // copy attributes across multiple documents if needed
SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
@@ -248,9 +245,9 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
const SwDoc *pSrcDoc = GetDoc();
SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFmt->GetDoc();
- // muss die NumRule kopiert werden?
- if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
- RES_PARATR_NUMRULE, sal_False, &pItem ) )
+ // Does the NumRule has to be copied?
+ if( pSrcDoc != pDstDoc &&
+ SFX_ITEM_SET == GetItemState( RES_PARATR_NUMRULE, sal_False, &pItem ) )
{
const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
if( rNm.Len() )
@@ -259,8 +256,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
if( pDestRule )
pDestRule->SetInvalidRule( sal_True );
else
- pDstDoc->MakeNumRule( rNm,
- pSrcDoc->FindNumRulePtr( rNm ) );
+ pDstDoc->MakeNumRule( rNm, pSrcDoc->FindNumRulePtr( rNm ) );
}
}
@@ -313,8 +309,6 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
}
}
- // Seitenvorlagenwechsel mit kopieren Gegenueber dem alten
- // Verhalten, sie zu entfernen
const SwPageDesc* pPgDesc;
if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
RES_PAGEDESC, sal_False, &pItem ) &&
@@ -326,9 +320,8 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
pPgDesc->GetName() );
if( !pDstPgDesc )
{
- // dann kopieren, ansonsten den benutzen
- pDstPgDesc = &pDstDoc->GetPageDesc( pDstDoc->MakePageDesc(
- pPgDesc->GetName() ));
+ pDstPgDesc = &pDstDoc->GetPageDesc(
+ pDstDoc->MakePageDesc( pPgDesc->GetName() ));
pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
}
SwFmtPageDesc aDesc( pDstPgDesc );
@@ -345,7 +338,9 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
pCNd->SetAttr( aTmpSet );
}
else
+ {
pFmt->SetFmtAttr( aTmpSet );
+ }
}
else if( pCNd )
{
@@ -362,7 +357,9 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
}
}
else
+ {
pFmt->SetFmtAttr( *this );
+ }
// #i92811#
delete pNewListIdItem;
@@ -375,7 +372,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
#endif
}
-// check if ID is InRange of AttrSet-Ids
+/// check if ID is in range of attribute set IDs
sal_Bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId )
{
while( *pRange )
More information about the Libreoffice-commits
mailing list