summaryrefslogtreecommitdiff
path: root/sw/source/core/attr
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/attr')
-rw-r--r--sw/source/core/attr/calbck.cxx634
-rw-r--r--sw/source/core/attr/cellatr.cxx264
-rw-r--r--sw/source/core/attr/fmtfollowtextflow.cxx37
-rw-r--r--sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx166
-rw-r--r--sw/source/core/attr/format.cxx694
-rw-r--r--sw/source/core/attr/hints.cxx308
-rw-r--r--sw/source/core/attr/makefile.mk55
-rw-r--r--sw/source/core/attr/swatrset.cxx404
8 files changed, 2562 insertions, 0 deletions
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
new file mode 100644
index 000000000000..65b11401b1da
--- /dev/null
+++ b/sw/source/core/attr/calbck.cxx
@@ -0,0 +1,634 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx> // fuer RES_..
+#include <frame.hxx>
+#include <hints.hxx>
+#include <swcache.hxx>
+#include <swfntcch.hxx>
+
+#ifdef DBG_UTIL
+#include <unotextmarkup.hxx>
+#endif
+
+static SwClientIter* pClientIters = 0;
+
+TYPEINIT0(SwClient); //rtti
+
+/*************************************************************************
+|* SwClient::SwClient(SwModify *)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung MA 20. Mar. 95
+*************************************************************************/
+
+
+SwClient::SwClient(SwModify *pToRegisterIn)
+ : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 )
+{
+ bModifyLocked =
+ bInModify =
+ bInDocDTOR =
+ bInCache = FALSE;
+ bInSwFntCache = FALSE;
+
+ if(pToRegisterIn)
+ pToRegisterIn->Add(this);
+}
+
+/*************************************************************************
+|* SwClient::Modify()
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+void SwClient::Modify( SfxPoolItem *pOld, SfxPoolItem * )
+{
+ if( (!pOld || pOld->Which() != RES_OBJECTDYING) )
+ return;
+
+ SwPtrMsgPoolItem *pDead = (SwPtrMsgPoolItem *)pOld;
+ if(pDead->pObject == pRegisteredIn)
+ {
+ SwModify *pAbove = (SwModify*)pRegisteredIn->GetRegisteredIn();
+ if(pAbove)
+ {
+ pAbove->Add(this);
+ return;
+ }
+ pRegisteredIn->Remove(this);
+ }
+}
+
+/*************************************************************************
+|* SwClient::~SwClient()
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung MA 25. Jan. 94
+*************************************************************************/
+
+
+SwClient::~SwClient()
+{
+ if( pRegisteredIn && pRegisteredIn->GetDepends() )
+ pRegisteredIn->Remove( this );
+
+ ASSERT( !IsModifyLocked(), "Modify destroyed but locked." );
+}
+
+
+ // erfrage vom Client Informationen
+BOOL SwClient::GetInfo( SfxPoolItem& ) const
+{
+ return TRUE; // und weiter
+}
+
+/*************************************************************************
+|* SwModify::SwModify( SwModify * )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+SwModify::SwModify( SwModify *pToRegisterIn )
+ : SwClient(pToRegisterIn), pRoot( 0 )
+{
+}
+
+// @@@ forbidden and not implemented, but needs to be accessible (protected).
+SwModify::SwModify( const SwModify & )
+ : SwClient( 0 )
+{
+ OSL_PRECOND(0, "SwModify(const SwModify&): not implemented.");
+}
+
+/*************************************************************************
+|* SwModify::~SwModify()
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 15.04.94
+*************************************************************************/
+
+
+
+SwModify::~SwModify()
+{
+ if ( IsInCache() )
+ SwFrm::GetCache().Delete( this );
+
+ if ( IsInSwFntCache() )
+ pSwFontCache->Delete( this );
+
+ if( pRoot )
+ {
+ if( IsInDocDTOR() )
+ {
+ // alle Clients "logisch" austragen
+ SwClientIter aIter( *this );
+ SwClient* p;
+ while( 0 != ( p = aIter++ ) )
+ p->pRegisteredIn = 0;
+
+ p = aIter.GoRoot(); // wieder ab Root (==Start) anfangen
+ do {
+ p->pRegisteredIn = 0;
+ } while( 0 != ( p = aIter-- ) );
+ }
+ else
+ {
+ // verschicke die Nachricht an die abgeleiteten Objekte.
+ SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
+ Modify( &aDyObject, &aDyObject );
+
+ // Zwangsummeldung aller derjenigen, die sich nicht ausgetragen
+ // haben, durch Aufruf von SwClient::Modify()
+ while( pRoot )
+ pRoot->SwClient::Modify(&aDyObject, &aDyObject);
+ }
+ }
+}
+
+/*************************************************************************
+|* SwModify::Modify( SwHint * pOldValue, SwHint * pNewValue )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung MA 20. Mar. 95
+*************************************************************************/
+
+
+
+void SwModify::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+{
+ if (IsInCache() || IsInSwFntCache())
+ {
+ const USHORT nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0;
+ CheckCaching( nWhich );
+ }
+
+ if (!pRoot || IsModifyLocked())
+ return;
+
+ LockModify();
+
+#ifndef DBG_UTIL
+ bInModify = TRUE;
+#else
+ if( !pOldValue )
+ bInModify = TRUE;
+ else
+ // following Modifies don't calls an ASSRT
+ switch( pOldValue->Which() )
+ {
+ case RES_OBJECTDYING:
+ case RES_REMOVE_UNO_OBJECT:
+ bInModify = ((SwPtrMsgPoolItem *)pOldValue)->pObject != this;
+ break;
+
+ case RES_FOOTNOTE_DELETED:
+ case RES_REFMARK_DELETED:
+ case RES_TOXMARK_DELETED:
+ case RES_FIELD_DELETED:
+ bInModify = FALSE;
+ break;
+ default:
+ bInModify = TRUE;
+ }
+#endif
+
+ SwClientIter aIter( *this );
+ SwClient * pLast = aIter.GoStart();
+ if( pLast ) // konnte zum Anfang gesprungen werden ??
+ do
+ {
+ pLast->Modify( pOldValue, pNewValue );
+ if( !pRoot ) // Baum schon Weg ??
+ break;
+ } while( 0 != ( pLast = aIter++ ));
+
+ bInModify = FALSE;
+ UnlockModify();
+}
+
+// erfrage vom Modify Informationen
+
+BOOL SwModify::GetInfo( SfxPoolItem& rInfo ) const
+{
+ BOOL bRet = TRUE; // bedeutet weiter zum naechsten
+
+ if( pRoot )
+ {
+ SwClientIter aIter( *(SwModify*)this );
+
+ SwClient* pLast = aIter.GoStart();
+ if( pLast )
+ while( 0 != ( bRet = pLast->GetInfo( rInfo )) &&
+ 0 != ( pLast = aIter++ ) )
+ ;
+ }
+
+ return bRet; // und weiter
+}
+
+/*************************************************************************
+|* SwModify::Add( SwClient *pDepend )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 14.09.94
+*************************************************************************/
+
+
+
+void SwModify::Add(SwClient *pDepend)
+{
+ ASSERT( !bInModify, "Client innerhalb des eigenen Modifies einfuegen?" );
+
+ // nur wenn das hier noch nicht eingetragen ist einfuegen
+ if(pDepend->pRegisteredIn != this )
+ {
+#ifdef DBG_UTIL
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp )
+ {
+ ASSERT( &pTmp->rRoot != pRoot,
+ "Client beim angemeldeten ClientIter einfuegen?" );
+ pTmp = pTmp->pNxtIter;
+ }
+#endif
+ // wenn schon wanders angemeldet, dann dort abmelden
+ if( pDepend->pRegisteredIn != 0 )
+ pDepend->pRegisteredIn->Remove( pDepend );
+
+ if( !pRoot )
+ {
+ pRoot = pDepend;
+ pRoot->pLeft = 0;
+ pRoot->pRight = 0;
+ }
+ else
+ {
+ // immer hinter die Root haengen
+ pDepend->pRight = pRoot->pRight;
+ pRoot->pRight = pDepend;
+ pDepend->pLeft = pRoot;
+ if( pDepend->pRight )
+ pDepend->pRight->pLeft = pDepend;
+ }
+
+ pDepend->pRegisteredIn = this;
+ }
+}
+
+/*************************************************************************
+|* SwModify::_Remove( SwClient *pDepend )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 14.09.94
+*************************************************************************/
+
+
+
+SwClient *SwModify::_Remove(SwClient * pDepend)
+{
+ // FME 2007-07-16 #i79641# SwXTextMarkup is allowed to be removed ...
+ ASSERT( !bInModify || 0 != dynamic_cast<SwXTextMarkup*>(pDepend), "Client innerhalb des eigenen Modifies loeschen?" );
+
+ // loesche das Object aus der Liste und setze den
+ // Registrierungs-Pointer zurueck
+ if( pDepend->pRegisteredIn == this )
+ {
+ SwClient* pR = pDepend->pRight;
+ SwClient* pL = pDepend->pLeft;
+ if( pRoot == pDepend )
+ pRoot = pL ? pL : pR;
+
+ if( pL )
+ pL->pRight = pR;
+ if( pR )
+ pR->pLeft = pL;
+
+ // alle Client-Iters updaten
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp )
+ {
+ if( pTmp->pAkt == pDepend || pTmp->pDelNext == pDepend )
+ pTmp->pDelNext = pR;
+
+ // --> FME 2006-02-03 #127369# Notify SwClientIter if mpWatchClient is removed
+ if ( pTmp->mpWatchClient == pDepend )
+ pTmp->mpWatchClient = 0;
+ // <--
+
+ pTmp = pTmp->pNxtIter;
+ }
+
+ pDepend->pLeft = 0;
+ pDepend->pRight = 0;
+ }
+ else {
+ ASSERT( FALSE, "SwModify::Remove(): pDepend nicht gefunden");
+ }
+ pDepend->pRegisteredIn = 0;
+ return pDepend;
+}
+
+
+/*************************************************************************
+|* SwModify::CheckCaching( const USHORT nWhich )
+|*
+|* Ersterstellung JP 25.06.95
+|* Letzte Aenderung JP 25.06.95
+*************************************************************************/
+
+
+
+void SwModify::CheckCaching( const USHORT nWhich )
+{
+ if (isCHRATR(nWhich))
+ {
+ SetInSwFntCache( FALSE );
+ }
+ else
+ switch ( nWhich )
+ {
+ case RES_OBJECTDYING:
+ case RES_FMT_CHG:
+ case RES_ATTRSET_CHG:
+ SetInSwFntCache( FALSE );
+
+ case RES_UL_SPACE:
+ case RES_LR_SPACE:
+ case RES_BOX:
+ case RES_SHADOW:
+ case RES_FRM_SIZE:
+ case RES_KEEP:
+ case RES_BREAK:
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ break;
+ }
+}
+
+
+// ----------
+// SwDepend
+// ----------
+
+/*************************************************************************
+|* SwDepend::SwDepend(SwClient *pTellHim,SwModify *pDepend)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+SwDepend::SwDepend(SwClient *pTellHim, SwModify *pDepend)
+ : SwClient(pDepend)
+{
+ pToTell = pTellHim;
+}
+
+/*************************************************************************
+|*
+|* SwDepend::Modify(SwHint *, SwHint *)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+|*
+*************************************************************************/
+
+
+void SwDepend::Modify( SfxPoolItem *pOldValue, SfxPoolItem *pNewValue )
+{
+ if(pNewValue && pNewValue->Which() == RES_OBJECTDYING)
+ SwClient::Modify(pOldValue,pNewValue);
+ else if(pToTell)
+ pToTell->Modify(pOldValue, pNewValue);
+}
+
+
+ // erfrage vom Modify Informationen
+BOOL SwDepend::GetInfo( SfxPoolItem& rInfo ) const
+{
+ return pToTell ? pToTell->GetInfo( rInfo ) : TRUE;
+}
+
+/********************************************************************/
+
+
+SwClientIter::SwClientIter( SwModify const& rModify )
+ : rRoot( rModify )
+{
+ // hinten einketten!
+ pNxtIter = 0;
+ if( pClientIters )
+ {
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp->pNxtIter )
+ pTmp = pTmp->pNxtIter;
+ pTmp->pNxtIter = this;
+ }
+ else
+ pClientIters = this;
+
+ pAkt = rRoot.pRoot;
+ pDelNext = pAkt;
+ mpWatchClient = 0;
+}
+
+
+
+SwClientIter::~SwClientIter()
+{
+ if( pClientIters )
+ {
+ if( pClientIters == this )
+ pClientIters = pNxtIter;
+ else
+ {
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp->pNxtIter != this )
+ if( 0 == ( pTmp = pTmp->pNxtIter ) )
+ {
+ ASSERT( this, "wo ist mein Pointer" );
+ return ;
+ }
+ pTmp->pNxtIter = pNxtIter;
+ }
+ }
+}
+
+
+#ifndef CFRONT
+ // Postfix Operator
+SwClient* SwClientIter::operator++(int)
+{
+// solange der CFRONT Prefix und PostFix nicht unterscheiden kann, immer
+// als Prefix-Operator arbeiten. Wenn der CFRONT es kann, muss auch der
+// Code entsprechen umgestellt werden !!!
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+ return pAkt;
+}
+#endif
+
+
+ // Prefix Operator
+SwClient* SwClientIter::operator++()
+{
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+ return pAkt;
+}
+
+
+#ifndef CFRONT
+ // Postfix Operator
+SwClient* SwClientIter::operator--(int)
+{
+// solange der CFRONT Prefix und PostFix nicht unterscheiden kann, immer
+// als Prefix-Operator arbeiten. Wenn der CFRONT es kann, muss auch der
+// Code entsprechen umgestellt werden !!!
+ if( pDelNext == pAkt )
+ pAkt = pAkt->pLeft;
+ else
+ pAkt = pDelNext->pLeft;
+ pDelNext = pAkt;
+ return pAkt;
+}
+#endif
+
+
+ // Prefix Operator
+SwClient* SwClientIter::operator--()
+{
+ if( pDelNext == pAkt )
+ pAkt = pAkt->pLeft;
+ else
+ pAkt = pDelNext->pLeft;
+ pDelNext = pAkt;
+ return pAkt;
+}
+
+
+SwClient* SwClientIter::GoStart() // zum Anfang des Baums
+{
+ pAkt = rRoot.pRoot;
+ if( pAkt )
+ while( pAkt->pLeft )
+ pAkt = pAkt->pLeft;
+ pDelNext = pAkt;
+ return pAkt;
+}
+
+
+SwClient* SwClientIter::GoEnd() // zum End des Baums
+{
+ pAkt = pDelNext;
+ if( !pAkt )
+ pAkt = rRoot.pRoot;
+ if( pAkt )
+ while( pAkt->pRight )
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ return pAkt;
+}
+
+
+
+SwClient* SwClientIter::First( TypeId nType )
+{
+ aSrchId = nType;
+ GoStart();
+ if( pAkt )
+ do {
+ if( pAkt->IsA( aSrchId ) )
+ break;
+
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+
+ } while( pAkt );
+ return pAkt;
+}
+
+
+SwClient* SwClientIter::Next()
+{
+ do {
+ // erstmal zum naechsten
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+
+ if( pAkt && pAkt->IsA( aSrchId ) )
+ break;
+ } while( pAkt );
+ return pAkt;
+}
+
+
+
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
new file mode 100644
index 000000000000..8032d3506a27
--- /dev/null
+++ b/sw/source/core/attr/cellatr.cxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <float.h>
+#include <hintids.hxx> // fuer RES_..
+#include <cellatr.hxx>
+#include <calc.hxx>
+#include <format.hxx>
+#include <doc.hxx>
+#include <swtable.hxx>
+#include <node.hxx>
+#include <hints.hxx>
+#include <rolbck.hxx>
+
+
+
+//TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+SwTblBoxNumFormat::SwTblBoxNumFormat( UINT32 nFormat, BOOL bFlag )
+ : SfxUInt32Item( RES_BOXATR_FORMAT, nFormat ), bAuto( bFlag )
+{
+}
+
+
+int SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return GetValue() == ((SwTblBoxNumFormat&)rAttr).GetValue() &&
+ bAuto == ((SwTblBoxNumFormat&)rAttr).bAuto;
+}
+
+
+SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const
+{
+ return new SwTblBoxNumFormat( GetValue(), bAuto );
+}
+
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+
+SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
+ : SfxPoolItem( RES_BOXATR_FORMULA ),
+ SwTableFormula( rFormula ),
+ pDefinedIn( 0 )
+{
+}
+
+
+int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return GetFormula() == ((SwTblBoxFormula&)rAttr).GetFormula() &&
+ pDefinedIn == ((SwTblBoxFormula&)rAttr).pDefinedIn;
+}
+
+
+SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const
+{
+// auf externe Darstellung umschalten!!
+ SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula() );
+ pNew->SwTableFormula::operator=( *this );
+ return pNew;
+}
+
+
+
+ // suche den Node, in dem die Formel steht:
+ // TextFeld -> TextNode,
+ // BoxAttribut -> BoxStartNode
+ // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+const SwNode* SwTblBoxFormula::GetNodeOfFormula() const
+{
+ const SwNode* pRet = 0;
+ if( pDefinedIn )
+ {
+ SwClient* pBox = SwClientIter( *pDefinedIn ).First( TYPE( SwTableBox ));
+ if( pBox )
+ pRet = ((SwTableBox*)pBox)->GetSttNd();
+ }
+ return pRet;
+}
+
+
+SwTableBox* SwTblBoxFormula::GetTableBox()
+{
+ SwTableBox* pBox = 0;
+ if( pDefinedIn )
+ pBox = (SwTableBox*)SwClientIter( *pDefinedIn ).
+ First( TYPE( SwTableBox ));
+ return pBox;
+}
+
+
+void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
+{
+ if( !pDefinedIn )
+ return ;
+
+ SwTableFmlUpdate* pUpdtFld;
+ if( !pItem || RES_TABLEFML_UPDATE != pItem->Which() )
+ {
+ // setze bei allen das Value-Flag zurueck
+ ChgValid( FALSE );
+ return ;
+ }
+
+ pUpdtFld = (SwTableFmlUpdate*)pItem;
+
+ // bestimme die Tabelle, in der das Attribut steht
+ const SwTableNode* pTblNd;
+ const SwNode* pNd = GetNodeOfFormula();
+ if( pNd && &pNd->GetNodes() == &pNd->GetDoc()->GetNodes() &&
+ 0 != ( pTblNd = pNd->FindTableNode() ))
+ {
+ switch( pUpdtFld->eFlags )
+ {
+ case TBL_CALC:
+ // setze das Value-Flag zurueck
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+// if( VF_CMD & pFld->GetFormat() )
+// pFld->PtrToBoxNm( pUpdtFld->pTbl );
+// else
+ ChgValid( FALSE );
+ break;
+ case TBL_BOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur externen Darstellung
+ PtrToBoxNm( pUpdtFld->pTbl );
+ break;
+ case TBL_BOXPTR:
+ // zur internen Darstellung
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+ BoxNmToPtr( &pTblNd->GetTable() );
+ break;
+ case TBL_RELBOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur relativen Darstellung
+ ToRelBoxNm( pUpdtFld->pTbl );
+ break;
+
+ case TBL_SPLITTBL:
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ {
+ USHORT nLnPos = SwTableFormula::GetLnPosInTbl(
+ pTblNd->GetTable(), GetTableBox() );
+ pUpdtFld->bBehindSplitLine = USHRT_MAX != nLnPos &&
+ pUpdtFld->nSplitLine <= nLnPos;
+ }
+ else
+ pUpdtFld->bBehindSplitLine = FALSE;
+ // kein break
+ case TBL_MERGETBL:
+ if( pUpdtFld->pHistory )
+ {
+ // fuer die History brauche ich aber die unveraenderte Formel
+ SwTblBoxFormula aCopy( *this );
+ pUpdtFld->bModified = FALSE;
+ ToSplitMergeBoxNm( *pUpdtFld );
+
+ if( pUpdtFld->bModified )
+ {
+ // und dann in der externen Darstellung
+ aCopy.PtrToBoxNm( &pTblNd->GetTable() );
+ pUpdtFld->pHistory->Add( &aCopy, &aCopy,
+ pNd->FindTableBoxStartNode()->GetIndex() );
+ }
+ }
+ else
+ ToSplitMergeBoxNm( *pUpdtFld );
+ break;
+ }
+ }
+}
+
+
+void SwTblBoxFormula::Calc( SwTblCalcPara& rCalcPara, double& rValue )
+{
+ if( !rCalcPara.rCalc.IsCalcError() ) // ist schon Fehler gesetzt ?
+ {
+ // erzeuge aus den BoxNamen die Pointer
+ 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
+ }
+}
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+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
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return nValue == ((SwTblBoxValue&)rAttr).nValue;
+}
+
+
+SfxPoolItem* SwTblBoxValue::Clone( SfxItemPool* ) const
+{
+ return new SwTblBoxValue( nValue );
+}
+
+
+
+
diff --git a/sw/source/core/attr/fmtfollowtextflow.cxx b/sw/source/core/attr/fmtfollowtextflow.cxx
new file mode 100644
index 000000000000..8bcd5b682116
--- /dev/null
+++ b/sw/source/core/attr/fmtfollowtextflow.cxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <fmtfollowtextflow.hxx>
+
+TYPEINIT1(SwFmtFollowTextFlow, SfxBoolItem);
+
+SfxPoolItem* SwFmtFollowTextFlow::Clone( SfxItemPool * ) const
+{
+ return new SwFmtFollowTextFlow(*this);
+}
diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
new file mode 100644
index 000000000000..48b9ad321e0e
--- /dev/null
+++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <fmtwrapinfluenceonobjpos.hxx>
+
+#ifndef _UNOMID_H
+#include <unomid.h>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+TYPEINIT1(SwFmtWrapInfluenceOnObjPos, SfxPoolItem);
+
+SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
+ sal_Int16 _nWrapInfluenceOnPosition )
+ : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
+ mnWrapInfluenceOnPosition( _nWrapInfluenceOnPosition )
+{
+}
+
+SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
+ const SwFmtWrapInfluenceOnObjPos& _rCpy )
+ : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
+ mnWrapInfluenceOnPosition( _rCpy.GetWrapInfluenceOnObjPos() )
+{
+}
+
+SwFmtWrapInfluenceOnObjPos::~SwFmtWrapInfluenceOnObjPos()
+{
+}
+
+SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=(
+ const SwFmtWrapInfluenceOnObjPos& _rSource )
+{
+ mnWrapInfluenceOnPosition = _rSource.GetWrapInfluenceOnObjPos();
+
+ return *this;
+}
+
+int SwFmtWrapInfluenceOnObjPos::operator==( const SfxPoolItem& _rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( _rAttr ), "keine gleichen Attribute" );
+ return ( mnWrapInfluenceOnPosition ==
+ static_cast<const SwFmtWrapInfluenceOnObjPos&>(_rAttr).
+ GetWrapInfluenceOnObjPos() );
+}
+
+SfxPoolItem* SwFmtWrapInfluenceOnObjPos::Clone( SfxItemPool * ) const
+{
+ return new SwFmtWrapInfluenceOnObjPos(*this);
+}
+
+BOOL SwFmtWrapInfluenceOnObjPos::QueryValue( Any& rVal, BYTE nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet = sal_True;
+ switch ( nMemberId )
+ {
+ case MID_WRAP_INFLUENCE:
+ {
+ rVal <<= GetWrapInfluenceOnObjPos();
+ }
+ break;
+ default:
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+BOOL SwFmtWrapInfluenceOnObjPos::PutValue( const Any& rVal, BYTE nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet = sal_True;
+
+ switch ( nMemberId )
+ {
+ case MID_WRAP_INFLUENCE:
+ {
+ sal_Int16 nNewWrapInfluence = 0;
+ rVal >>= nNewWrapInfluence;
+ // --> OD 2004-10-18 #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
+ {
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" );
+ bRet = sal_False;
+ }
+ }
+ break;
+ default:
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition )
+{
+ // --> OD 2004-10-18 #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 )
+ // <--
+ {
+ mnWrapInfluenceOnPosition = _nWrapInfluenceOnPosition;
+ }
+ else
+ {
+ ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos(..)> - invalid attribute value" );
+ }
+}
+
+// --> OD 2004-10-18 #i35017# - add parameter <_bIterativeAsOnceConcurrent>
+// to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
+sal_Int16 SwFmtWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
+ const bool _bIterativeAsOnceConcurrent ) const
+{
+ sal_Int16 nWrapInfluenceOnPosition( mnWrapInfluenceOnPosition );
+
+ if ( _bIterativeAsOnceConcurrent &&
+ nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ITERATIVE )
+ {
+ nWrapInfluenceOnPosition = text::WrapInfluenceOnPosition::ONCE_CONCURRENT;
+ }
+
+ return nWrapInfluenceOnPosition;
+}
+// <--
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
new file mode 100644
index 000000000000..6a296782ce6c
--- /dev/null
+++ b/sw/source/core/attr/format.cxx
@@ -0,0 +1,694 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx> // fuer RES_..
+#include <frame.hxx> // fuer AttrCache
+#include <format.hxx>
+#include <hints.hxx> // fuer SwFmtChg
+#include <doc.hxx>
+#include <paratr.hxx> // fuer SwParaFmt - SwHyphenBug
+#include <swcache.hxx>
+// --> OD 2006-11-22 #i71574#
+#include <fmtcolfunc.hxx>
+// <--
+
+TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|* SwFmt::SwFmt
+*************************************************************************/
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aSet( rPool, pWhichRanges ),
+ nWhichId( nFmtWhich ),
+ nFmtId( 0 ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX )
+{
+ aFmtName.AssignAscii( pFmtNm );
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = FALSE; // LAYER_IMPL
+ bAutoFmt = TRUE;
+
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
+ const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aFmtName( rFmtNm ),
+ aSet( rPool, pWhichRanges ),
+ nWhichId( nFmtWhich ),
+ nFmtId( 0 ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX )
+{
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = FALSE; // LAYER_IMPL
+ bAutoFmt = TRUE;
+
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( const SwFmt& rFmt )
+ : SwModify( rFmt.DerivedFrom() ),
+ aFmtName( rFmt.aFmtName ),
+ aSet( rFmt.aSet ),
+ nWhichId( rFmt.nWhichId ),
+ nFmtId( 0 ),
+ nPoolFmtId( rFmt.GetPoolFmtId() ),
+ nPoolHelpId( rFmt.GetPoolHelpId() ),
+ nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
+{
+ bWritten = bFmtInDTOR = FALSE; // LAYER_IMPL
+ bAutoFmt = rFmt.bAutoFmt;
+ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+
+ if( rFmt.DerivedFrom() )
+ aSet.SetParent( &rFmt.DerivedFrom()->aSet );
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+}
+
+/*************************************************************************
+|* SwFmt &SwFmt::operator=(const SwFmt& aFmt)
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+SwFmt &SwFmt::operator=(const SwFmt& rFmt)
+{
+ nWhichId = rFmt.nWhichId;
+ nPoolFmtId = rFmt.GetPoolFmtId();
+ nPoolHelpId = rFmt.GetPoolHelpId();
+ nPoolHlpFileId = rFmt.GetPoolHlpFileId();
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // kopiere nur das Attribut-Delta Array
+ SwAttrSet aOld( *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
+ aSet.SetModifyAtAttr( this );
+
+ // PoolItem-Attr erzeugen fuers Modify !!!
+ if( aOld.Count() )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+
+ if( pRegisteredIn != rFmt.pRegisteredIn )
+ {
+ if( pRegisteredIn )
+ pRegisteredIn->Remove(this);
+ if(rFmt.pRegisteredIn)
+ {
+ rFmt.pRegisteredIn->Add(this);
+ aSet.SetParent( &rFmt.aSet );
+ }
+ else
+ aSet.SetParent( 0 );
+ }
+ bAutoFmt = rFmt.bAutoFmt;
+ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+ return *this;
+}
+
+void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
+{
+ ASSERT(!IsDefault(), "SetName: Defaultformat" );
+ if( bBroadcast )
+ {
+ SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
+ SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
+ aFmtName = rNewName;
+ Modify( &aOld, &aNew );
+ }
+ else
+ {
+ aFmtName = rNewName;
+ }
+}
+
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * 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 !!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
+void SwFmt::CopyAttrs( const SwFmt& rFmt, BOOL bReplace )
+{
+ // kopiere nur das Attribut-Delta Array
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // Sonderbehandlung fuer einige Attribute
+ SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
+
+ if( !bReplace ) // nur die neu, die nicht gesetzt sind ??
+ {
+ if( pChgSet == (SwAttrSet*)&rFmt.aSet ) // Set hier kopieren
+ pChgSet = new SwAttrSet( rFmt.aSet );
+ pChgSet->Differentiate( aSet );
+ }
+
+ // kopiere nur das Attribut-Delta Array
+ if( pChgSet->GetPool() != aSet.GetPool() )
+ pChgSet->CopyToModify( *this );
+ else
+ {
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+
+ if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+
+ if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // Set hier angelegt ?
+ delete pChgSet;
+}
+
+/*************************************************************************
+|* SwFmt::~SwFmt()
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 14.02.91
+*************************************************************************/
+
+
+SwFmt::~SwFmt()
+{
+ /* das passiert bei der ObjectDying Message */
+ /* alle Abhaengigen auf DerivedFrom umhaengen */
+ if( GetDepends() )
+ {
+ ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
+
+ bFmtInDTOR = TRUE;
+
+ SwFmt *pParentFmt = DerivedFrom();
+ if (!pParentFmt) // see #112405#
+ {
+ DBG_ERROR( "~SwFmt: parent format missing" );
+ }
+ else
+ {
+ while( GetDepends() )
+ {
+ SwFmtChg aOldFmt(this);
+ SwFmtChg aNewFmt(pParentFmt);
+ SwClient * pDepend = (SwClient*)GetDepends();
+ pParentFmt->Add(pDepend);
+ pDepend->Modify(&aOldFmt, &aNewFmt);
+ }
+ }
+ }
+}
+
+
+/*************************************************************************
+|* void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+{
+ BOOL bWeiter = TRUE; // TRUE = Propagierung an die Abhaengigen
+
+ USHORT nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0 ;
+ switch( nWhich )
+ {
+ case 0: break; // Which-Id von 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;
+
+ // nicht umhaengen wenn dieses das oberste Format ist !!
+ if( pRegisteredIn && pRegisteredIn == pFmt )
+ {
+ if( pFmt->pRegisteredIn )
+ {
+ // wenn Parent, dann im neuen Parent wieder anmelden
+ pFmt->DerivedFrom()->Add( this );
+ aSet.SetParent( &DerivedFrom()->aSet );
+ }
+ else
+ {
+ // sonst auf jeden Fall beim sterbenden abmelden
+ 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 !!
+ SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
+ SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
+
+ aOld.GetChgSet()->Differentiate( aSet );
+ aNew.GetChgSet()->Differentiate( aSet );
+
+ if( aNew.Count() )
+ // keine mehr gesetzt, dann Ende !!
+ SwModify::Modify( &aOld, &aNew );
+ bWeiter = FALSE;
+ }
+ break;
+ case RES_FMT_CHG:
+ // falls mein Format Parent umgesetzt wird, dann melde ich
+ // meinen Attrset beim Neuen an.
+
+ // sein eigenes Modify ueberspringen !!
+ if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
+ ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
+ {
+ // den Set an den neuen Parent haengen
+ aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
+ }
+ break;
+
+ case RES_RESET_FMTWRITTEN:
+ {
+ // IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
+ // Formate (und keine Frames) propagieren.
+ ResetWritten();
+ SwClientIter aIter( *this );
+ for( SwClient *pClient = aIter.First( TYPE(SwFmt) ); pClient;
+ pClient = aIter.Next() )
+ pClient->Modify( pOldValue, pNewValue );
+
+ bWeiter = FALSE;
+ }
+ break;
+
+ default:
+ {
+ // Ist das Attribut in diesem Format definiert, dann auf
+ // NICHT weiter propagieren !!
+ if( SFX_ITEM_SET == aSet.GetItemState( nWhich, FALSE ))
+ {
+// wie finde ich heraus, ob nicht ich die Message versende ??
+// aber wer ruft das hier ????
+//ASSERT( FALSE, "Modify ohne Absender verschickt" );
+//JP 11.06.96: DropCaps koennen hierher kommen
+ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
+ bWeiter = FALSE;
+ }
+
+ } // default
+ } // switch
+
+ if( bWeiter )
+ {
+ // laufe durch alle abhaengigen Formate
+ SwModify::Modify( pOldValue, pNewValue );
+ }
+
+}
+
+
+BOOL SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
+{
+ if ( pDerFrom )
+ {
+ // Zyklus?
+ const SwFmt* pFmt = pDerFrom;
+ while ( pFmt != 0 )
+ {
+ if ( pFmt == this )
+ return FALSE;
+
+ pFmt=pFmt->DerivedFrom();
+ }
+ }
+ else
+ {
+ // Nichts angegeben, Dflt-Format suchen
+ pDerFrom = this;
+ while ( pDerFrom->DerivedFrom() )
+ pDerFrom = pDerFrom->DerivedFrom();
+ }
+ if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
+ return FALSE;
+
+ ASSERT( Which()==pDerFrom->Which()
+ || ( 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?");
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ pDerFrom->Add(this);
+ aSet.SetParent( &pDerFrom->aSet );
+
+ SwFmtChg aOldFmt(this);
+ SwFmtChg aNewFmt(this);
+ Modify( &aOldFmt, &aNewFmt );
+
+ return TRUE;
+}
+
+
+BOOL SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
+{
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ const USHORT nWhich = rAttr.Which();
+ CheckCaching( nWhich );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+ // fuer FrmFmt's immer das Modify verschicken!
+ BOOL bRet = FALSE;
+ const USHORT nFmtWhich = Which();
+ if( IsModifyLocked() || (!GetDepends() &&
+ (RES_GRFFMTCOLL == nFmtWhich ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
+ {
+ if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
+ aSet.SetModifyAtAttr( this );
+ // --> OD 2006-11-22 #i71574#
+ if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
+ {
+ TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
+ }
+ // <--
+ }
+ else
+ {
+ // kopiere nur das Attribut-Delta Array
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+
+ bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
+ if( bRet )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+
+BOOL SwFmt::SetFmtAttr( const SfxItemSet& rSet )
+{
+ if( !rSet.Count() )
+ return FALSE;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+ // fuer FrmFmt's immer das Modify verschicken!
+ BOOL bRet = FALSE;
+ const USHORT nFmtWhich = Which();
+ if ( IsModifyLocked() ||
+ ( !GetDepends() &&
+ ( RES_GRFFMTCOLL == nFmtWhich ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
+ {
+ if( 0 != ( bRet = (0 != aSet.Put( rSet ))) )
+ aSet.SetModifyAtAttr( this );
+ // --> OD 2006-11-22 #i71574#
+ if ( nFmtWhich == RES_TXTFMTCOLL )
+ {
+ TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
+ }
+ // <--
+ }
+ else
+ {
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
+ if( bRet )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+// Nimmt den Hint mit nWhich aus dem Delta-Array
+
+
+BOOL SwFmt::ResetFmtAttr( USHORT nWhich1, USHORT nWhich2 )
+{
+ if( !aSet.Count() )
+ return FALSE;
+
+ if( !nWhich2 || nWhich2 < nWhich1 )
+ nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ for( USHORT n = nWhich1; n < nWhich2; ++n )
+ CheckCaching( n );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ return 0 != (( nWhich2 == nWhich1 )
+ ? aSet.ClearItem( nWhich1 )
+ : aSet.ClearItem_BC( nWhich1, nWhich2 ));
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ BOOL bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ return bRet;
+}
+
+
+
+// --> OD 2007-01-24 #i73790#
+// method renamed
+USHORT SwFmt::ResetAllFmtAttr()
+// <--
+{
+ if( !aSet.Count() )
+ return 0;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ return aSet.ClearItem( 0 );
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ BOOL bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ return aNew.Count();
+}
+
+
+/*************************************************************************
+|* void SwFmt::GetInfo( const SfxPoolItem& ) const
+|*
+|* Beschreibung
+|* Ersterstellung JP 18.04.94
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+BOOL SwFmt::GetInfo( SfxPoolItem& rInfo ) const
+{
+ BOOL bRet = SwModify::GetInfo( rInfo );
+ return bRet;
+}
+
+
+void SwFmt::DelDiffs( const SfxItemSet& rSet )
+{
+ if( !aSet.Count() )
+ return;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ {
+ aSet.Intersect( rSet );
+ return;
+ }
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ BOOL bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+}
+
+/** SwFmt::IsBackgroundTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if background of format is transparent.
+ 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
+{
+ return sal_False;
+}
+
+/** SwFmt::IsShadowTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if shadow of format is transparent.
+ Default implementation returns false. Thus, subclasses have to overload
+ method, if the specific subclass can have a transparent shadow.
+
+ @author OD
+
+ @return false, default implementation
+*/
+sal_Bool SwFmt::IsShadowTransparent() const
+{
+ return sal_False;
+}
+
+/*
+ * Document Interface Access
+ */
+const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
+const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
+IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
+const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
+IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
+IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
+IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
+IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); }
+
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
new file mode 100644
index 000000000000..0ded6c326320
--- /dev/null
+++ b/sw/source/core/attr/hints.cxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hints.hxx>
+
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+#include <editeng/scripttypeitem.hxx>
+#include <hintids.hxx>
+#include <swtypes.hxx>
+#include <ndtxt.hxx>
+#include <errhdl.hxx>
+
+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 )
+{}
+
+
+
+SwDelChr::SwDelChr( xub_StrLen nP )
+ : SwMsgPoolItem( RES_DEL_CHR ),
+ nPos( nP )
+{}
+
+
+
+SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
+ : SwMsgPoolItem( RES_DEL_TXT ),
+ nStart( nS ),
+ nLen( nL )
+{}
+
+
+
+SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, USHORT 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.
+
+
+SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
+ : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
+ pOut( pOutput )
+{
+ ASSERT( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" );
+}
+
+
+SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
+ : SwMsgPoolItem( RES_DOCPOS_UPDATE ),
+ nDocPos(nDcPos)
+{}
+
+
+
+// SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
+SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
+ : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
+ pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ),
+ eFlags( TBL_CALC )
+{
+ DATA.pDelTbl = 0;
+ bModified = bBehindSplitLine = FALSE;
+ ASSERT( pTbl, "es muss ein Table-Pointer gesetzt werden!" );
+}
+
+
+SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
+ : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ),
+ pCntntNode( 0 ), pNodes( pNds )
+{}
+
+
+SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
+ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+ bDelSet( FALSE ),
+ pChgSet( &rSet ),
+ pTheChgdSet( &rTheSet )
+{}
+
+
+SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
+ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+ bDelSet( TRUE ),
+ pTheChgdSet( rChgSet.pTheChgdSet )
+{
+ pChgSet = new SwAttrSet( *rChgSet.pChgSet );
+}
+
+
+SwAttrSetChg::~SwAttrSetChg()
+{
+ if( bDelSet )
+ delete pChgSet;
+}
+
+
+#ifdef DBG_UTIL
+
+void SwAttrSetChg::ClearItem( USHORT nWhch )
+{
+ ASSERT( bDelSet, "der Set darf nicht veraendert werden!" );
+ pChgSet->ClearItem( nWhch );
+}
+
+#endif
+
+
+SwMsgPoolItem::SwMsgPoolItem( USHORT nWhch )
+ : SfxPoolItem( nWhch )
+{}
+
+
+// "Overhead" vom SfxPoolItem
+int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
+{
+ ASSERT( FALSE, "SwMsgPoolItem kennt kein ==" );
+ return 0;
+}
+
+
+SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
+{
+ ASSERT( FALSE, "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.
+ ******************************************************************************/
+#ifndef DBG_UTIL
+const SfxPoolItem* GetDfltAttr( USHORT nWhich )
+{
+ return aAttrTab[ nWhich - POOLATTR_BEGIN ];
+}
+#else
+const SfxPoolItem* GetDfltAttr( USHORT nWhich )
+{
+ ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN,
+ ERR_OUTOFSCOPE );
+
+ SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
+ ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" );
+ return pHt;
+}
+#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 )
+{
+}
+
+// --> OD 2008-02-19 #refactorlists#
+//SwNumRuleInfo::SwNumRuleInfo( const String& rRuleName )
+// : SwMsgPoolItem( RES_GETNUMNODES ), rName( rRuleName )
+//{
+//}
+
+//void SwNumRuleInfo::AddNode( SwTxtNode& rNd )
+//{
+// aList.Insert(rNd.GetIndex(), &rNd);
+//}
+
+
+SwFindNearestNode::SwFindNearestNode( const SwNode& rNd )
+ : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 )
+{
+}
+
+void SwFindNearestNode::CheckNode( const SwNode& rNd )
+{
+ if( &pNd->GetNodes() == &rNd.GetNodes() )
+ {
+ ULONG nIdx = rNd.GetIndex();
+ if( nIdx < pNd->GetIndex() &&
+ ( !pFnd || nIdx > pFnd->GetIndex() ) &&
+ nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
+ pFnd = &rNd;
+ }
+}
+
+
+
+USHORT GetWhichOfScript( USHORT nWhich, USHORT nScript )
+{
+ static const USHORT aLangMap[3] =
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
+ static const USHORT aFontMap[3] =
+ { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT};
+ static const USHORT aFontSizeMap[3] =
+ { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE };
+ static const USHORT aWeightMap[3] =
+ { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT};
+ static const USHORT aPostureMap[3] =
+ { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE};
+
+ const USHORT* pM;
+ switch( nWhich )
+ {
+ case RES_CHRATR_LANGUAGE:
+ case RES_CHRATR_CJK_LANGUAGE:
+ case RES_CHRATR_CTL_LANGUAGE:
+ pM = aLangMap;
+ break;
+
+ case RES_CHRATR_FONT:
+ case RES_CHRATR_CJK_FONT:
+ case RES_CHRATR_CTL_FONT:
+ pM = aFontMap;
+ break;
+
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_CJK_FONTSIZE:
+ case RES_CHRATR_CTL_FONTSIZE:
+ pM = aFontSizeMap;
+ break;
+
+ case RES_CHRATR_WEIGHT:
+ case RES_CHRATR_CJK_WEIGHT:
+ case RES_CHRATR_CTL_WEIGHT:
+ pM = aWeightMap;
+ break;
+ case RES_CHRATR_POSTURE:
+ case RES_CHRATR_CJK_POSTURE:
+ case RES_CHRATR_CTL_POSTURE:
+ pM = aPostureMap;
+ break;
+
+ default:
+ pM = 0;
+ }
+
+ USHORT nRet;
+ if( pM )
+ {
+ using namespace ::com::sun::star::i18n;
+ {
+ if( ScriptType::WEAK == nScript )
+ nScript = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+ switch( nScript)
+ {
+ case ScriptType::COMPLEX: ++pM; // no break;
+ case ScriptType::ASIAN: ++pM; // no break;
+ default: nRet = *pM;
+ }
+ }
+ }
+ else
+ nRet = nWhich;
+ return nRet;
+}
diff --git a/sw/source/core/attr/makefile.mk b/sw/source/core/attr/makefile.mk
new file mode 100644
index 000000000000..a3827d4776e0
--- /dev/null
+++ b/sw/source/core/attr/makefile.mk
@@ -0,0 +1,55 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sw
+TARGET=attr
+
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/calbck.obj \
+ $(SLO)$/cellatr.obj \
+ $(SLO)$/fmtfollowtextflow.obj \
+ $(SLO)$/fmtwrapinfluenceonobjpos.obj \
+ $(SLO)$/format.obj \
+ $(SLO)$/hints.obj \
+ $(SLO)$/swatrset.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
new file mode 100644
index 000000000000..cdfa6a5f6d3f
--- /dev/null
+++ b/sw/source/core/attr/swatrset.cxx
@@ -0,0 +1,404 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <svl/whiter.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> // fuer SetModifyAtAttr
+#include <cellatr.hxx> // fuer SetModifyAtAttr
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <istyleaccess.hxx>
+#include <numrule.hxx>
+// --> OD 2008-03-19 #refactorlists#
+#include <list.hxx>
+// <--
+
+
+SwAttrPool::SwAttrPool( SwDoc* pD )
+ : SfxItemPool( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "SWG" )),
+ POOLATTR_BEGIN, POOLATTR_END-1,
+ aSlotTab, aAttrTab ),
+ pDoc( pD )
+{
+ SetVersionMap( 1, 1, 60, pVersionMap1 );
+ SetVersionMap( 2, 1, 75, pVersionMap2 );
+ SetVersionMap( 3, 1, 86, pVersionMap3 );
+ SetVersionMap( 4, 1,121, pVersionMap4 );
+ // OD 2004-01-21 #i18732# - apply new version map
+ SetVersionMap( 5, 1,130, pVersionMap5 );
+ SetVersionMap( 6, 1,136, pVersionMap6 );
+}
+
+SwAttrPool::~SwAttrPool()
+{
+}
+
+SwAttrSet::SwAttrSet( SwAttrPool& rPool, USHORT nWh1, USHORT nWh2 )
+ : SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+SwAttrSet::SwAttrSet( SwAttrPool& rPool, const USHORT* nWhichPairTable )
+ : SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
+ : SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+SfxItemSet* SwAttrSet::Clone( BOOL bItems, SfxItemPool *pToPool ) const
+{
+ if ( pToPool && pToPool != GetPool() )
+ {
+ SwAttrPool* pAttrPool = dynamic_cast< SwAttrPool* >(pToPool);
+ SfxItemSet* pTmpSet = 0;
+ if ( !pAttrPool )
+ pTmpSet = SfxItemSet::Clone( bItems, pToPool );
+ else
+ {
+ pTmpSet = new SwAttrSet( *pAttrPool, GetRanges() );
+ if ( bItems )
+ {
+ SfxWhichIter aIter(*pTmpSet);
+ USHORT nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == GetItemState( nWhich, FALSE, &pItem ) )
+ pTmpSet->Put( *pItem, pItem->Which() );
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+ return pTmpSet;
+ }
+ else
+ return bItems
+ ? new SwAttrSet( *this )
+ : new SwAttrSet( *GetPool(), GetRanges() );
+}
+
+int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ int nRet = 0 != SfxItemSet::Put( rAttr );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+int SwAttrSet::Put_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ int nRet = 0 != SfxItemSet::Put( rSet );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+
+USHORT SwAttrSet::ClearItem_BC( USHORT nWhich,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ USHORT nRet = SfxItemSet::ClearItem( nWhich );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+USHORT SwAttrSet::ClearItem_BC( USHORT nWhich1, USHORT nWhich2,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ ASSERT( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
+ pNewSet = pNew;
+ pOldSet = pOld;
+ USHORT nRet = 0;
+ for( ; nWhich1 <= nWhich2; ++nWhich1 )
+ nRet = nRet + SfxItemSet::ClearItem( nWhich1 );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+
+int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ SfxItemSet::Intersect( rSet );
+ pOldSet = pNewSet = 0;
+ return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
+}
+
+// Notification-Callback
+void SwAttrSet::Changed( const SfxPoolItem& rOld,
+ const SfxPoolItem& rNew )
+{
+ if( pOldSet )
+ pOldSet->PutChgd( rOld );
+
+ if( pNewSet )
+ pNewSet->PutChgd( rNew );
+}
+
+
+// ----------------------------------------------------------------
+// Sonderbehandlung fuer einige Attribute
+// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
+// - SwFmtDropCaps
+// - SwFmtPageDesc
+// (Wird beim Einfuegen in Formate/Nodes gerufen)
+// ----------------------------------------------------------------
+
+bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
+{
+ bool bSet = false;
+
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == GetItemState( RES_PAGEDESC, FALSE, &pItem ) &&
+ ((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify );
+ bSet = true;
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, FALSE, &pItem ) &&
+ ((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
+ {
+ // CharFormat gesetzt und dann noch in unterschiedlichen
+ // Attribut Pools, dann muss das CharFormat kopiert werden!
+ SwCharFmt* pCharFmt;
+ if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
+ && GetPool() != pCharFmt->GetAttrSet().GetPool() )
+ {
+ pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt );
+ ((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt );
+ }
+ ((SwFmtDrop*)pItem)->ChgDefinedIn( pModify );
+ bSet = true;
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, FALSE, &pItem ) &&
+ ((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify );
+ bSet = true;
+ }
+
+ return bSet;
+}
+
+void SwAttrSet::CopyToModify( SwModify& rMod ) const
+{
+ // kopiere die Attribute ggfs. ueber Dokumentgrenzen
+ SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
+ SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
+
+ if( pCNd || pFmt )
+ {
+ if( Count() )
+ {
+ // --> OD 2008-08-15 #i92811#
+ SfxStringItem* pNewListIdItem( 0 );
+ // <--
+
+ const SfxPoolItem* pItem;
+ 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, FALSE, &pItem ) )
+ {
+ const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
+ if( rNm.Len() )
+ {
+ SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
+ if( pDestRule )
+ pDestRule->SetInvalidRule( TRUE );
+ else
+ pDstDoc->MakeNumRule( rNm,
+ pSrcDoc->FindNumRulePtr( rNm ) );
+ }
+ }
+
+ // --> OD 2008-03-19 #refactorlists#
+ // copy list and if needed also the corresponding list style
+ // for text nodes
+ if ( pSrcDoc != pDstDoc &&
+ pCNd && pCNd->IsTxtNode() &&
+ GetItemState( RES_PARATR_LIST_ID, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ const String& sListId =
+ dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
+ if ( sListId.Len() > 0 &&
+ !pDstDoc->getListByName( sListId ) )
+ {
+ const SwList* pList = pSrcDoc->getListByName( sListId );
+ // copy list style, if needed
+ const String sDefaultListStyleName =
+ pList->GetDefaultListStyleName();
+ // --> OD 2008-08-15 #i92811#
+ const SwNumRule* pDstDocNumRule =
+ pDstDoc->FindNumRulePtr( sDefaultListStyleName );
+ if ( !pDstDocNumRule )
+ {
+ pDstDoc->MakeNumRule( sDefaultListStyleName,
+ pSrcDoc->FindNumRulePtr( sDefaultListStyleName ) );
+ }
+ else
+ {
+ const SwNumRule* pSrcDocNumRule =
+ pSrcDoc->FindNumRulePtr( sDefaultListStyleName );
+ // If list id of text node equals the list style's
+ // default list id in the source document, the same
+ // should be hold in the destination document.
+ // Thus, create new list id item.
+ if ( sListId == pSrcDocNumRule->GetDefaultListId() )
+ {
+ pNewListIdItem = new SfxStringItem (
+ RES_PARATR_LIST_ID,
+ pDstDocNumRule->GetDefaultListId() );
+ }
+ }
+ // check again, if list exist, because <SwDoc::MakeNumRule(..)>
+ // could have also created it.
+ if ( pNewListIdItem == 0 &&
+ !pDstDoc->getListByName( sListId ) )
+ {
+ // copy list
+ pDstDoc->createList( sListId, sDefaultListStyleName );
+ }
+ // <--
+ }
+ }
+ // <--
+
+ // JP 04.02.99: Task #61467# Seitenvorlagenwechsel mit kopieren
+ // Gegenueber dem alten Verhalten, sie zu entfernen
+ const SwPageDesc* pPgDesc;
+ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+ RES_PAGEDESC, FALSE, &pItem ) &&
+ 0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) )
+ {
+ SfxItemSet aTmpSet( *this );
+
+ SwPageDesc* pDstPgDesc = pDstDoc->FindPageDescByName(
+ pPgDesc->GetName() );
+ if( !pDstPgDesc )
+ {
+ // dann kopieren, ansonsten den benutzen
+ pDstPgDesc = &pDstDoc->_GetPageDesc( pDstDoc->MakePageDesc(
+ pPgDesc->GetName() ));
+ pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
+ }
+ SwFmtPageDesc aDesc( pDstPgDesc );
+ aDesc.SetNumOffset( ((SwFmtPageDesc*)pItem)->GetNumOffset() );
+ aTmpSet.Put( aDesc );
+
+ if( pCNd )
+ {
+ // --> OD 2008-08-15 #i92811#
+ if ( pNewListIdItem != 0 )
+ {
+ aTmpSet.Put( *pNewListIdItem );
+ }
+ // <--
+ pCNd->SetAttr( aTmpSet );
+ }
+ else
+ pFmt->SetFmtAttr( aTmpSet );
+ }
+ else if( pCNd )
+ {
+ // --> OD 2008-08-15 #i92811#
+ if ( pNewListIdItem != 0 )
+ {
+ SfxItemSet aTmpSet( *this );
+ aTmpSet.Put( *pNewListIdItem );
+ pCNd->SetAttr( aTmpSet );
+ }
+ else
+ {
+ pCNd->SetAttr( *this );
+ }
+ // <--
+ }
+ else
+ pFmt->SetFmtAttr( *this );
+
+ // --> OD 2008-08-15 #i92811#
+ delete pNewListIdItem;
+ pNewListIdItem = 0;
+ // <--
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert");
+#endif
+}
+
+// check if ID is InRange of AttrSet-Ids
+BOOL IsInRange( const USHORT* pRange, const USHORT nId )
+{
+ while( *pRange )
+ {
+ if( *pRange <= nId && nId <= *(pRange+1) )
+ return TRUE;
+ pRange += 2;
+ }
+ return FALSE;
+}
+