summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorThomas Benisch <tbe@openoffice.org>2009-12-07 17:05:58 +0100
committerThomas Benisch <tbe@openoffice.org>2009-12-07 17:05:58 +0100
commitf45a3f6155442cea2b5d7ba185ffaef586e0fc76 (patch)
tree58b6259f1e1f492a3d5493cbecaa4d52cdac2a26 /sw/source/core
parenta58c0b022b3fcddcfa033f15dd7588e7ab5a0bd4 (diff)
parentb4528e495f967184f1eae0420a6e4f64ceefe976 (diff)
chartshapes: merge with DEV300_m66
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/bastyp/swrect.cxx119
-rw-r--r--sw/source/core/bastyp/swregion.cxx2
-rw-r--r--sw/source/core/doc/doc.cxx50
-rw-r--r--sw/source/core/doc/doccomp.cxx4
-rw-r--r--sw/source/core/doc/docfmt.cxx71
-rw-r--r--sw/source/core/doc/docredln.cxx11
-rw-r--r--sw/source/core/doc/docsort.cxx26
-rw-r--r--sw/source/core/doc/docstat.cxx6
-rw-r--r--sw/source/core/docnode/ndtbl.cxx4
-rw-r--r--sw/source/core/docnode/swthreadmanager.cxx18
-rw-r--r--sw/source/core/fields/docufld.cxx16
-rw-r--r--sw/source/core/inc/swthreadmanager.hxx15
-rw-r--r--sw/source/core/layout/sectfrm.cxx4
-rw-r--r--sw/source/core/text/atrstck.cxx19
-rw-r--r--sw/source/core/text/itrcrsr.cxx25
-rw-r--r--sw/source/core/txtnode/fntcache.cxx10
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx17
-rw-r--r--sw/source/core/txtnode/thints.cxx80
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx8
-rw-r--r--sw/source/core/txtnode/txtedt.cxx1
-rw-r--r--sw/source/core/undo/rolbck.cxx2
-rw-r--r--sw/source/core/undo/undobj.cxx26
-rw-r--r--sw/source/core/undo/unredln.cxx51
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx4
-rw-r--r--sw/source/core/unocore/unodraw.cxx5
-rw-r--r--sw/source/core/unocore/unoobj2.cxx6
-rw-r--r--sw/source/core/unocore/unoport.cxx4
-rw-r--r--sw/source/core/unocore/unoportenum.cxx1
-rw-r--r--sw/source/core/unocore/unotext.cxx56
-rw-r--r--sw/source/core/view/viewsh.cxx2
30 files changed, 413 insertions, 250 deletions
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index d241982182..bbf03673f0 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -53,13 +53,12 @@
SwRect::SwRect( const Rectangle &rRect ) :
- nX( rRect.Left() ),
- nY( rRect.Top() )
+ m_Point( rRect.Left(), rRect.Top() )
{
- nWidth = rRect.Right() == RECT_EMPTY ? 0 :
- rRect.Right() - rRect.Left() +1;
- nHeight = rRect.Bottom() == RECT_EMPTY ? 0 :
- rRect.Bottom() - rRect.Top() + 1;
+ m_Size.setWidth(rRect.Right() == RECT_EMPTY ? 0 :
+ rRect.Right() - rRect.Left() +1);
+ m_Size.setHeight(rRect.Bottom() == RECT_EMPTY ? 0 :
+ rRect.Bottom() - rRect.Top() + 1);
}
/*************************************************************************
@@ -139,7 +138,7 @@ SwRect& SwRect::Intersection( const SwRect& rRect )
}
else
//Def.: Bei einer leeren Intersection wird nur die SSize genullt.
- nHeight = nWidth = 0;
+ SSize(0, 0);
return *this;
}
@@ -239,76 +238,88 @@ BOOL SwRect::IsOver( const SwRect& rRect ) const
void SwRect::Justify()
{
- if ( nHeight < 0 )
+ if ( m_Size.getHeight() < 0 )
{
- nY = nY + nHeight + 1;
- nHeight = -nHeight;
+ m_Point.Y() += m_Size.getHeight() + 1;
+ m_Size.setHeight(-m_Size.getHeight());
}
- if ( nWidth < 0 )
+ if ( m_Size.getWidth() < 0 )
{
- nX = nX + nWidth + 1;
- nWidth = -nWidth;
+ m_Point.Y() += m_Size.getWidth() + 1;
+ m_Size.setWidth(-m_Size.getWidth());
}
}
// Similiar to the inline methods, but we need the function pointers
-void SwRect::_Width( const long nNew ) { nWidth = nNew; }
-void SwRect::_Height( const long nNew ) { nHeight = nNew; }
-void SwRect::_Left( const long nLeft ){ nWidth += nX - nLeft; nX = nLeft; }
-void SwRect::_Right( const long nRight ){ nWidth = nRight - nX; }
-void SwRect::_Top( const long nTop ){ nHeight += nY - nTop; nY = nTop; }
-void SwRect::_Bottom( const long nBottom ){ nHeight = nBottom - nY; }
-
-long SwRect::_Width() const{ return nWidth; }
-long SwRect::_Height() const{ return nHeight; }
-long SwRect::_Left() const{ return nX; }
-long SwRect::_Right() const{ return nX + nWidth; }
-long SwRect::_Top() const{ return nY; }
-long SwRect::_Bottom() const{ return nY + nHeight; }
-
-void SwRect::AddWidth( const long nAdd ) { nWidth += nAdd; }
-void SwRect::AddHeight( const long nAdd ) { nHeight += nAdd; }
-void SwRect::SubLeft( const long nSub ){ nWidth += nSub; nX -= nSub; }
-void SwRect::AddRight( const long nAdd ){ nWidth += nAdd; }
-void SwRect::SubTop( const long nSub ){ nHeight += nSub; nY -= nSub; }
-void SwRect::AddBottom( const long nAdd ){ nHeight += nAdd; }
-void SwRect::SetPosX( const long nNew ){ nX = nNew; }
-void SwRect::SetPosY( const long nNew ){ nY = nNew; }
+void SwRect::_Width( const long nNew ) { m_Size.setWidth(nNew); }
+void SwRect::_Height( const long nNew ) { m_Size.setHeight(nNew); }
+void SwRect::_Left( const long nLeft ){ m_Size.Width() += m_Point.getX() - nLeft; m_Point.setX(nLeft); }
+void SwRect::_Right( const long nRight ){ m_Size.setWidth(nRight - m_Point.getX()); }
+void SwRect::_Top( const long nTop ){ m_Size.Height() += m_Point.getY() - nTop; m_Point.setY(nTop); }
+void SwRect::_Bottom( const long nBottom ){ m_Size.setHeight(nBottom - m_Point.getY()); }
+
+long SwRect::_Width() const{ return m_Size.getWidth(); }
+long SwRect::_Height() const{ return m_Size.getHeight(); }
+long SwRect::_Left() const{ return m_Point.getX(); }
+long SwRect::_Right() const{ return m_Point.getX() + m_Size.getWidth(); }
+long SwRect::_Top() const{ return m_Point.getY(); }
+long SwRect::_Bottom() const{ return m_Point.getY() + m_Size.getHeight(); }
+
+void SwRect::AddWidth( const long nAdd ) { m_Size.Width() += nAdd; }
+void SwRect::AddHeight( const long nAdd ) { m_Size.Height() += nAdd; }
+void SwRect::SubLeft( const long nSub ){ m_Size.Width() += nSub; m_Point.X() -= nSub; }
+void SwRect::AddRight( const long nAdd ){ m_Size.Width() += nAdd; }
+void SwRect::SubTop( const long nSub ){ m_Size.Height() += nSub; m_Point.Y() -= nSub; }
+void SwRect::AddBottom( const long nAdd ){ m_Size.Height() += nAdd; }
+void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); }
+void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); }
const Size SwRect::_Size() const { return SSize(); }
-const Size SwRect::SwappedSize() const { return Size( nHeight, nWidth ); }
+const Size SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); }
const Point SwRect::TopLeft() const { return Pos(); }
-const Point SwRect::TopRight() const { return Point( nX + nWidth, nY ); }
-const Point SwRect::BottomLeft() const { return Point( nX, nY + nHeight ); }
+const Point SwRect::TopRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() ); }
+const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.getY() + m_Size.getHeight() ); }
const Point SwRect::BottomRight() const
- { return Point( nX + nWidth, nY + nHeight ); }
-long SwRect::GetLeftDistance( long nLimit ) const { return nX - nLimit; }
-long SwRect::GetBottomDistance( long nLim ) const { return nLim - nY - nHeight;}
-long SwRect::GetTopDistance( long nLimit ) const { return nY - nLimit; }
-long SwRect::GetRightDistance( long nLim ) const { return nLim - nX - nWidth; }
+ { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() + m_Size.getHeight() ); }
+long SwRect::GetLeftDistance( long nLimit ) const { return m_Point.getX() - nLimit; }
+long SwRect::GetBottomDistance( long nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();}
+long SwRect::GetTopDistance( long nLimit ) const { return m_Point.getY() - nLimit; }
+long SwRect::GetRightDistance( long nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); }
BOOL SwRect::OverStepLeft( long nLimit ) const
- { return nLimit > nX && nX + nWidth > nLimit; }
+ { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; }
BOOL SwRect::OverStepBottom( long nLimit ) const
- { return nLimit > nY && nY + nHeight > nLimit; }
+ { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; }
BOOL SwRect::OverStepTop( long nLimit ) const
- { return nLimit > nY && nY + nHeight > nLimit; }
+ { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; }
BOOL SwRect::OverStepRight( long nLimit ) const
- { return nLimit > nX && nX + nWidth > nLimit; }
+ { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; }
void SwRect::SetLeftAndWidth( long nLeft, long nNew )
- { nX = nLeft; nWidth = nNew; }
+{
+ m_Point.setX(nLeft);
+ m_Size.setWidth(nNew);
+}
void SwRect::SetTopAndHeight( long nTop, long nNew )
- { nY = nTop; nHeight = nNew; }
+{
+ m_Point.setY(nTop);
+ m_Size.setHeight(nNew);
+}
void SwRect::SetRightAndWidth( long nRight, long nNew )
- { nX = nRight - nNew; nWidth = nNew; }
+{
+ m_Point.setX(nRight - nNew);
+ m_Size.setWidth(nNew);
+}
void SwRect::SetBottomAndHeight( long nBottom, long nNew )
- { nY = nBottom - nNew; nHeight = nNew; }
+{
+ m_Point.setY(nBottom - nNew);
+ m_Size.setHeight(nNew);
+}
void SwRect::SetUpperLeftCorner( const Point& rNew )
- { nX = rNew.nA; nY = rNew.nB; }
+ { m_Point = rNew; }
void SwRect::SetUpperRightCorner( const Point& rNew )
- { nX = rNew.nA - nWidth; nY = rNew.nB; }
+ { m_Point = Point(rNew.nA - m_Size.getWidth(), rNew.nB); }
void SwRect::SetLowerLeftCorner( const Point& rNew )
- { nX = rNew.nA; nY = rNew.nB - nHeight; }
+ { m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); }
#ifndef PRODUCT
/*************************************************************************
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx
index f0ee36b12a..d2926f6d7e 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -117,7 +117,7 @@ void SwRegionRects::operator-=( const SwRect &rRect )
if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) )
{
const long nOldVal = aTmp.Height();
- aTmp.SSize().Height() = nTmp;
+ aTmp.Height(nTmp);
InsertRect( aTmp, i, bDel );
aTmp.Height( nOldVal );
}
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index d5fc2798c6..252ab069c1 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -106,6 +106,8 @@
#include <SwUndoFmt.hxx>
#include <unocrsr.hxx>
#include <docsh.hxx>
+#include <docufld.hxx>
+
#include <vector>
#include <osl/diagnose.h>
@@ -465,6 +467,9 @@ void SwDoc::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/
if ( bDeleteOld )
delete pPrt;
pPrt = pP;
+
+ if ( pDrawModel && !get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
+ pDrawModel->SetRefDevice( pPrt );
}
if ( bCallPrtDataChanged &&
@@ -493,6 +498,9 @@ void SwDoc::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOl
if ( bDeleteOld )
delete pVirDev;
pVirDev = pVd;
+
+ if ( pDrawModel && get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
+ pDrawModel->SetRefDevice( pVirDev );
}
}
@@ -528,6 +536,9 @@ void SwDoc::setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewH
pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE06 );
else
pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
+
+ if( pDrawModel )
+ pDrawModel->SetRefDevice( pMyVirDev );
}
else
{
@@ -537,8 +548,10 @@ void SwDoc::setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewH
// triggers this funny situation:
// getReferenceDevice()->getPrinter()->CreatePrinter_()
// ->setPrinter()-> PrtDataChanged()
- getPrinter( true );
+ SfxPrinter* pPrinter = getPrinter( true );
// <--
+ if( pDrawModel )
+ pDrawModel->SetRefDevice( pPrinter );
}
set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, bNewVirtual );
@@ -1066,6 +1079,24 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat )
}
}
+ // #i93174#: notes contain paragraphs that are not nodes
+ {
+ SwFieldType * const pPostits( GetSysFldType(RES_POSTITFLD) );
+ SwClientIter aIter(*pPostits);
+ SwFmtFld const * pFmtFld =
+ static_cast<SwFmtFld const*>(aIter.First( TYPE(SwFmtFld) ));
+ while (pFmtFld)
+ {
+ if (pFmtFld->IsFldInDoc())
+ {
+ SwPostItField const * const pField(
+ static_cast<SwPostItField const*>(pFmtFld->GetFld()));
+ rStat.nAllPara += pField->GetNumberOfParagraphs();
+ }
+ pFmtFld = static_cast<SwFmtFld const*>(aIter.Next());
+ }
+ }
+
rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0;
rStat.bModified = FALSE;
SetDocStat( rStat );
@@ -1091,12 +1122,21 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat )
aStat[n++].Value <<= (sal_Int32)rStat.nChar;
// For e.g. autotext documents there is no pSwgInfo (#i79945)
- if (GetDocShell()) {
- uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
- GetDocShell()->GetModel(), uno::UNO_QUERY_THROW);
- uno::Reference<document::XDocumentProperties> xDocProps(
+ SfxObjectShell * const pObjShell( GetDocShell() );
+ if (pObjShell)
+ {
+ const uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pObjShell->GetModel(), uno::UNO_QUERY_THROW);
+ const uno::Reference<document::XDocumentProperties> xDocProps(
xDPS->getDocumentProperties());
+ // #i96786#: do not set modified flag when updating statistics
+ const bool bDocWasModified( IsModified() );
+ const ModifyBlocker_Impl b(pObjShell);
xDocProps->setDocumentStatistics(aStat);
+ if (!bDocWasModified)
+ {
+ ResetModified();
+ }
}
// event. Stat. Felder Updaten
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 5fa7731fcb..58e3cccc6f 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -428,7 +428,7 @@ Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 )
SetDiscard( rData2, pDiscard2, pCount1 );
// die Arrays koennen wir wieder vergessen
- delete pCount1; delete pCount2;
+ delete [] pCount1; delete [] pCount2;
CheckDiscard( rData1.GetLineCount(), pDiscard1 );
CheckDiscard( rData2.GetLineCount(), pDiscard2 );
@@ -437,7 +437,7 @@ Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 )
pMD2 = new MovedData( rData2, pDiscard2 );
// die Arrays koennen wir wieder vergessen
- delete pDiscard1; delete pDiscard2;
+ delete [] pDiscard1; delete [] pDiscard2;
}
{
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index fff14d4ed3..3151e2f291 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -625,7 +625,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
(RES_TXTATR_CHARFMT == nWhich) ||
(RES_TXTATR_INETFMT == nWhich) ||
(RES_TXTATR_AUTOFMT == nWhich) ||
- isUNKNOWNATR(nWhich) )
+ (RES_TXTATR_UNKNOWN_CONTAINER == nWhich) )
{
pCharSet = &rChgSet;
bCharAttr = true;
@@ -636,7 +636,8 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
|| isPARATR_LIST(nWhich)
// <--
|| isFRMATR(nWhich)
- || isGRFATR(nWhich) )
+ || isGRFATR(nWhich)
+ || isUNKNOWNATR(nWhich) )
{
pOtherSet = &rChgSet;
bOtherAttr = true;
@@ -653,7 +654,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
RES_TXTATR_AUTOFMT, RES_TXTATR_AUTOFMT,
RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
0 );
SfxItemSet* pTmpOtherItemSet = new SfxItemSet( pDoc->GetAttrPool(),
@@ -663,6 +664,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
// <--
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0 );
pTmpCharItemSet->Put( rChgSet );
@@ -755,7 +757,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
SfxItemSet aTxtSet( pDoc->GetAttrPool(),
RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK,
RES_TXTATR_META, RES_TXTATR_METAFIELD,
- RES_TXTATR_CJK_RUBY, RES_TXTATR_WITHEND_END-1,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
0 );
aTxtSet.Put( rChgSet );
@@ -1744,36 +1746,45 @@ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
pFmt != pCNd->GetFmtColl() &&
pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET )
{
- // --> OD 2008-04-08 #refactorlists#
-// if ( pPara->pHistory )
-// {
-// SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
-// ASSERT( pTNd,
-// "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
-// SwRegHistory aRegH( pTNd, *pTNd, pPara->pHistory );
-// pCNd->ResetAttr( RES_PARATR_NUMRULE );
-// }
-// else
-// {
-// pCNd->ResetAttr( RES_PARATR_NUMRULE );
-// }
- std::auto_ptr< SwRegHistory > pRegH;
- if ( pPara->pHistory )
+ // --> OD 2009-09-07 #b6876367#
+ // Check, if the list style of the paragraph will change.
+ bool bChangeOfListStyleAtParagraph( true );
+ SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
+ ASSERT( pTNd,
+ "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
{
- SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
- ASSERT( pTNd,
- "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
- pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) );
+ SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() );
+ if ( pNumRuleAtParagraph )
+ {
+ const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
+ pFmt->GetNumRule();
+ if ( rNumRuleItemAtParagraphStyle.GetValue() ==
+ pNumRuleAtParagraph->GetName() )
+ {
+ bChangeOfListStyleAtParagraph = false;
+ }
+ }
}
- pCNd->ResetAttr( RES_PARATR_NUMRULE );
+ if ( bChangeOfListStyleAtParagraph )
+ {
+ // --> OD 2008-04-08 #refactorlists#
+ std::auto_ptr< SwRegHistory > pRegH;
+ if ( pPara->pHistory )
+ {
+ pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) );
+ }
+
+ pCNd->ResetAttr( RES_PARATR_NUMRULE );
- // reset all list attributes
- pCNd->ResetAttr( RES_PARATR_LIST_LEVEL );
- pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
- pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
- pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
- pCNd->ResetAttr( RES_PARATR_LIST_ID );
+ // reset all list attributes
+ pCNd->ResetAttr( RES_PARATR_LIST_LEVEL );
+ pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
+ pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
+ pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
+ pCNd->ResetAttr( RES_PARATR_LIST_ID );
+ }
+ // <--
}
// <--
}
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 75d0dd1faa..e5a5e35f81 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -309,9 +309,11 @@ Verhalten von Delete-Redline:
bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
{
-#ifndef PRODUCT
+#if 0
+// #i93179# disabled: ASSERT in ~SwIndexReg #ifndef PRODUCT
SwRedline aCopy( *pNewRedl );
#endif
+ bool bError = true;
_CHECK_REDLINE( this )
if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) &&
@@ -431,6 +433,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
pRedlineTbl->Insert( pRedl );
}
+ bError = false;
bDelete = true;
}
else if( (( POS_BEFORE == eCmpPos &&
@@ -446,6 +449,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
pRedlineTbl->Remove( n );
pRedlineTbl->Insert( pRedl );
+ bError = false;
bDelete = true;
}
else if ( POS_OUTSIDE == eCmpPos )
@@ -1108,7 +1112,8 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
case POS_EQUAL:
case POS_INSIDE:
- delete pNewRedl, pNewRedl = 0;
+ // TODO Check if there is any side effect
+ //delete pNewRedl, pNewRedl = 0;
break;
case POS_OUTSIDE:
@@ -1271,7 +1276,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
}
_CHECK_REDLINE( this )
- return 0 != pNewRedl;
+ return ( 0 != pNewRedl ) || !bError;
}
void SwDoc::CompressRedlines()
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 5414b72869..752b146b9f 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -386,7 +386,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
{
if( bUndo )
{
- pRedlUndo = new SwUndoRedlineSort( rPaM, rOpt );
+ pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt );
DoUndo( FALSE );
}
// erst den Bereich kopieren, dann
@@ -471,20 +471,36 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
AppendUndo( pRedlUndo );
}
- // nBeg ist der Start vom sortierten Bereich
+ // nBeg is start of sorted range
SwNodeIndex aSttIdx( GetNodes(), nBeg );
- // der Kopierte Bereich ist das Geloeschte
- AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam ), true);
+ // the copied range is deleted
+ SwRedline *const pDeleteRedline(
+ new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam ));
- // das sortierte ist das Eingefuegte
+ // pRedlPam points to nodes that may be deleted (hidden) by
+ // AppendRedline, so adjust it beforehand to prevent ASSERT
pRedlPam->GetPoint()->nNode = aSttIdx;
SwCntntNode* pCNd = aSttIdx.GetNode().GetCntntNode();
pRedlPam->GetPoint()->nContent.Assign( pCNd, 0 );
+ AppendRedline(pDeleteRedline, true);
+
+ // the sorted range is inserted
AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true);
if( pRedlUndo )
+ {
+ SwNodeIndex aInsEndIdx( pRedlPam->GetMark()->nNode, -1 );
+ pRedlPam->GetMark()->nNode = aInsEndIdx;
+ SwCntntNode *const pPrevNode =
+ pRedlPam->GetMark()->nNode.GetNode().GetCntntNode();
+ pRedlPam->GetMark()->nContent.Assign( pPrevNode, pPrevNode->Len() );
+
+ pRedlUndo->SetValues( *pRedlPam );
+ }
+
+ if( pRedlUndo )
pRedlUndo->SetOffset( aSttIdx );
delete pRedlPam, pRedlPam = 0;
diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx
index 6ebc2d9a8f..8455adb859 100644
--- a/sw/source/core/doc/docstat.cxx
+++ b/sw/source/core/doc/docstat.cxx
@@ -45,10 +45,10 @@ SwDocStat::SwDocStat() :
nOLE(0),
nPage(1),
nPara(1),
+ nAllPara(1),
nWord(0),
nChar(0),
- bModified(TRUE),
- pInternStat(0)
+ bModified(TRUE)
{}
/************************************************************************
@@ -62,9 +62,9 @@ void SwDocStat::Reset()
nOLE = 0;
nPage = 1;
nPara = 1;
+ nAllPara= 1;
nWord = 0;
nChar = 0;
bModified = TRUE;
- pInternStat = 0;
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 8f01680de5..afab878b2f 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1322,7 +1322,8 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
SwTxtNode& rTxtNode = static_cast<SwTxtNode&>(rNode);
// setze den bei allen TextNode in der Tabelle den TableNode
// als StartNode
- rTxtNode.pStartOfSection = pTblNd;
+// FIXME: this is setting wrong node StartOfSections in nested tables.
+// rTxtNode.pStartOfSection = pTblNd;
// remove PageBreaks/PageDesc/ColBreak
const SwAttrSet* pSet = rTxtNode.GetpSwAttrSet();
if( pSet )
@@ -1401,7 +1402,6 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
aCellNodeIdx = SwNodeIndex( *aCellNodeIdx.GetNode().EndOfSectionNode() );
}
-
// Section der Box zuweisen
pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx
index fea0cd217c..8b173a1221 100644
--- a/sw/source/core/docnode/swthreadmanager.cxx
+++ b/sw/source/core/docnode/swthreadmanager.cxx
@@ -39,35 +39,29 @@
@author OD
*/
-SwThreadManager* SwThreadManager::mpThreadManager = 0;
-osl::Mutex* SwThreadManager::mpGetManagerMutex = new osl::Mutex();
+bool SwThreadManager::mbThreadManagerInstantiated = false;
SwThreadManager::SwThreadManager()
: mpThreadManagerImpl( new ThreadManager( SwThreadJoiner::GetThreadJoiner() ) )
{
mpThreadManagerImpl->Init();
+ mbThreadManagerInstantiated = true;
}
SwThreadManager::~SwThreadManager()
{
- delete mpThreadManagerImpl;
}
+struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {};
+
SwThreadManager& SwThreadManager::GetThreadManager()
{
- osl::MutexGuard aGuard(*mpGetManagerMutex);
-
- if ( mpThreadManager == 0 )
- {
- mpThreadManager = new SwThreadManager();
- }
-
- return *mpThreadManager;
+ return InitInstance::get();
}
bool SwThreadManager::ExistsThreadManager()
{
- return (mpThreadManager != 0);
+ return mbThreadManagerInstantiated;
}
oslInterlockedCount SwThreadManager::AddThread( const rtl::Reference< ObservableThread >& rThread )
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index d5204f1c1d..3d54971e41 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1132,7 +1132,7 @@ String SwDocInfoField::Expand() const
uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties());
uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
-
+
uno::Any aAny;
if( xSetInfo->hasPropertyByName( aName ) )
aAny = xSet->getPropertyValue( aName );
@@ -1147,16 +1147,9 @@ String SwDocInfoField::Expand() const
->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), uno::UNO_QUERY );
uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
aNew >>= sVal;
- ((SwDocInfoField*)this)->aContent = sVal;
+ const_cast<SwDocInfoField*>(this)->aContent = sVal;
}
}
- else
- {
- // property is "void" - means it has not been added until now - do it!
- aAny <<= ::rtl::OUString(aContent);
- uno::Reference < beans::XPropertyContainer > xCont( xSet, uno::UNO_QUERY );
- xCont->addProperty( aName, ::com::sun::star::beans::PropertyAttribute::REMOVEABLE, aAny );
- }
}
catch (uno::Exception&) {}
}
@@ -1877,6 +1870,11 @@ void SwPostItField::SetTextObject( OutlinerParaObject* pText )
mpText = pText;
}
+sal_uInt32 SwPostItField::GetNumberOfParagraphs() const
+{
+ return (mpText) ? mpText->Count() : 1;
+}
+
/*-----------------05.03.98 13:42-------------------
--------------------------------------------------*/
diff --git a/sw/source/core/inc/swthreadmanager.hxx b/sw/source/core/inc/swthreadmanager.hxx
index 7ec4df7585..1029efb217 100644
--- a/sw/source/core/inc/swthreadmanager.hxx
+++ b/sw/source/core/inc/swthreadmanager.hxx
@@ -34,6 +34,10 @@
#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
+#include <boost/utility.hpp>
+#include <memory>
+
+
class ObservableThread;
class ThreadManager;
@@ -45,6 +49,7 @@ class ThreadManager;
@author OD
*/
class SwThreadManager
+ : private ::boost::noncopyable
{
public:
@@ -52,6 +57,9 @@ class SwThreadManager
static bool ExistsThreadManager();
+ // private: don't call!
+ SwThreadManager();
+ // private: don't call!
~SwThreadManager();
oslInterlockedCount AddThread( const rtl::Reference< ObservableThread >& rThread );
@@ -76,12 +84,9 @@ class SwThreadManager
bool StartingOfThreadsSuspended();
private:
- static SwThreadManager* mpThreadManager;
- static osl::Mutex* mpGetManagerMutex;
+ static bool mbThreadManagerInstantiated;
- ThreadManager* mpThreadManagerImpl;
-
- SwThreadManager();
+ ::std::auto_ptr<ThreadManager> mpThreadManagerImpl;
};
#endif
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 5dcb6040d7..1c53fea46d 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1160,6 +1160,10 @@ void SwSectionFrm::SimpleFormat()
SWRECTFN( this )
if( GetPrev() || GetUpper() )
{
+ // --> OD 2009-09-28 #b6882166#
+ // assure notifications on position changes.
+ const SwLayNotify aNotify( this );
+ // <--
(this->*fnRect->fnMakePos)( GetUpper(), GetPrev(), FALSE );
bValidPos = TRUE;
}
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 4ac576d66a..4e89d45a19 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -523,13 +523,11 @@ void SwAttrHandler::PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem )
{
- ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END ||
- RES_UNKNOWNATR_CONTAINER == rItem.Which() ,
+ ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END,
"I do not want this attribute, nWhich >= RES_TXTATR_WITHEND_END" );
// robust
- if ( RES_TXTATR_WITHEND_END <= rItem.Which() ||
- RES_UNKNOWNATR_CONTAINER == rItem.Which() )
+ if ( RES_TXTATR_WITHEND_END <= rItem.Which() )
return sal_False;
USHORT nStack = StackPos[ rItem.Which() ];
@@ -557,6 +555,9 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem )
void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
{
+ if ( RES_TXTATR_WITHEND_END <= rAttr.Which() )
+ return; // robust
+
// these special attributes in fact represent a collection of attributes
// they have to be removed from each stack they belong to
if ( RES_TXTATR_INETFMT == rAttr.Which() ||
@@ -583,7 +584,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
}
// this is the usual case, we have a basic attribute, remove it from the
// stack and reset the font
- else if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() )
+ else
{
aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr );
// reset font according to attribute on top of stack
@@ -600,13 +601,13 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
void SwAttrHandler::Pop( const SwTxtAttr& rAttr )
{
- ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END ||
- RES_UNKNOWNATR_CONTAINER == rAttr.Which() ,
+ ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END,
"I do not have this attribute, nWhich >= RES_TXTATR_WITHEND_END" );
- if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() &&
- rAttr.Which() < RES_TXTATR_WITHEND_END )
+ if ( rAttr.Which() < RES_TXTATR_WITHEND_END )
+ {
aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr );
+ }
}
/*************************************************************************
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 7fbb6bae55..b40398463f 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -158,7 +158,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
const SwTxtNode *pNode = pFrm->GetTxtNode();
const SvxLRSpaceItem &rSpace = pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace();
- // --> OD 2009-09-02 #i95907#
+ // --> OD 2009-09-08 #i95907#, #b6879723#
const bool bListLevelIndentsApplicable = pFrm->GetTxtNode()->AreListLevelIndentsApplicable();
// <--
@@ -183,7 +183,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
pFrm->Prt().Left() +
nLMWithNum -
pNode->GetLeftMarginWithNum( sal_False ) -
- // --> OD 2009-09-02 #i95907#
+ // --> OD 2009-09-08 #i95907#, #b6879723#
// rSpace.GetLeft() +
// rSpace.GetTxtLeft();
( bListLevelIndentsApplicable
@@ -193,14 +193,18 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
}
else
{
- if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
+ // --> OD 2009-09-08 #i95907#, #b6879723#
+// if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
+ if ( bListLevelIndentsApplicable ||
+ !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
+ // <--
{
// this calculation is identical this the calculation for R2L layout - see above
nLeft = pFrm->Frm().Left() +
pFrm->Prt().Left() +
nLMWithNum -
pNode->GetLeftMarginWithNum( sal_False ) -
- // --> OD 2009-09-02 #i95907#
+ // --> OD 2009-09-08 #i95907#, #b6879723#
// rSpace.GetLeft() +
// rSpace.GetTxtLeft();
( bListLevelIndentsApplicable
@@ -223,7 +227,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
// paras inside cells inside new documents:
( pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ||
!pFrm->IsInTab() ||
- !nLMWithNum) )
+ !nLMWithNum ) )
// <--
{
nLeft = pFrm->Prt().Left() + pFrm->Frm().Left();
@@ -235,8 +239,8 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
nFirst = nLeft;
else
{
- short nFLOfst;
- long nFirstLineOfs;
+ short nFLOfst = 0;
+ long nFirstLineOfs = 0;
if( !pNode->GetFirstLineOfsWithNum( nFLOfst ) &&
rSpace.IsAutoFirst() )
{
@@ -290,8 +294,13 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
else
nFirstLineOfs = nFLOfst;
+ // --> OD 2009-09-08 #i95907#, #b6879723#
+// if ( pFrm->IsRightToLeft() ||
+// !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
if ( pFrm->IsRightToLeft() ||
- !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
+ bListLevelIndentsApplicable ||
+ !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) )
+ // <--
{
nFirst = nLeft + nFirstLineOfs;
}
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 6b8d098618..114c5b4e92 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -386,7 +386,9 @@ USHORT SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rOut )
const FontMetric aOutMet( rRefDev.GetFontMetric() );
long nTmpPrtHeight = (USHORT)aOutMet.GetAscent() + aOutMet.GetDescent();
(void) nTmpPrtHeight;
- ASSERT( nTmpPrtHeight == nPrtHeight, "GetTextHeight != Ascent + Descent" )
+ // #i106098#: do not compare with == here due to rounding error
+ ASSERT( abs(nTmpPrtHeight - nPrtHeight) < 3,
+ "GetTextHeight != Ascent + Descent" );
#endif
((OutputDevice&)rRefDev).SetFont( aOldFnt );
@@ -2424,8 +2426,12 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
const xub_StrLen nEnd = rInf.GetIdx() + rInf.GetLen();
// skip character cells for complex scripts
- if ( rInf.GetFont() && SW_CTL == rInf.GetFont()->GetActual() &&
+ // --> OD 2009-10-14 #i105571# - skip also character cells for CJK
+ if ( rInf.GetFont() &&
+ ( SW_CTL == rInf.GetFont()->GetActual() ||
+ SW_CJK == rInf.GetFont()->GetActual() ) &&
pBreakIt->GetBreakIter().is() )
+ // <--
{
aLang = rInf.GetFont()->GetLanguage();
bSkipCell = sal_True;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 7930190ffa..3df01632b8 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -943,9 +943,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
bool bNoExp = false;
bool bResort = false;
const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
- static_cast<USHORT>(RES_CHRATR_BEGIN) +
- static_cast<USHORT>(RES_UNKNOWNATR_END) -
- static_cast<USHORT>(RES_UNKNOWNATR_BEGIN);
+ static_cast<USHORT>(RES_CHRATR_BEGIN);
BOOL aDontExp[ coArrSz ];
memset( &aDontExp, 0, coArrSz * sizeof(BOOL) );
@@ -980,14 +978,6 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
nWhPos = static_cast<USHORT>(nWhich -
RES_CHRATR_BEGIN);
}
- else if (isUNKNOWNATR(nWhich))
- {
- nWhPos = static_cast<USHORT>(
- nWhich -
- static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) +
- static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
- static_cast<USHORT>(RES_CHRATR_BEGIN) );
- }
else
continue;
@@ -2852,6 +2842,9 @@ long SwTxtNode::GetLeftMarginWithNum( BOOL bTxtLeft ) const
BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const
{
BOOL bRet( FALSE );
+ // --> OD 2009-09-08 #i95907#, #b6879723#
+ rFLOffset = 0;
+ // <--
// --> OD 2005-11-02 #i51089 - TUNING#
const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L;
@@ -2885,8 +2878,6 @@ BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const
}
// <--
}
- else
- rFLOffset = 0;
bRet = TRUE;
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 7bd02bf4e4..8aa1e690dd 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1065,11 +1065,6 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
case RES_TXTATR_TOXMARK:
pNew = new SwTxtTOXMark( (SwTOXMark&)rNew, nStt, &nEnd );
break;
- case RES_UNKNOWNATR_CONTAINER:
- case RES_TXTATR_UNKNOWN_CONTAINER:
- pNew = new SwTxtXMLAttrContainer( (SvXMLAttrContainerItem&)rNew,
- nStt, nEnd );
- break;
case RES_TXTATR_CJK_RUBY:
pNew = new SwTxtRuby( (SwFmtRuby&)rNew, nStt, nEnd );
break;
@@ -1669,8 +1664,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
SfxItemSet aCharSet( *rSet.GetPool(), aCharAutoFmtSetRange );
- USHORT nWhich, nCount = 0;
- SwTxtAttr* pNew;
+ USHORT nCount = 0;
SfxItemIter aIter( *pSet );
const SfxPoolItem* pItem = aIter.GetCurItem();
@@ -1678,8 +1672,10 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
{
if ( pItem && (reinterpret_cast<SfxPoolItem*>(-1) != pItem))
{
- nWhich = pItem->Which();
- if ( isCHRATR(nWhich) || isTXTATR(nWhich) || isUNKNOWNATR(nWhich) )
+ const USHORT nWhich = pItem->Which();
+ ASSERT( isCHRATR(nWhich) || isTXTATR(nWhich),
+ "SwTxtNode::SetAttr(): unknown attribute" );
+ if ( isCHRATR(nWhich) || isTXTATR(nWhich) )
{
if ((RES_TXTATR_CHARFMT == nWhich) &&
(GetDoc()->GetDfltCharFmt() ==
@@ -1698,7 +1694,8 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
}
else
{
- pNew = MakeTxtAttr( *GetDoc(),
+
+ SwTxtAttr *const pNew = MakeTxtAttr( *GetDoc(),
const_cast<SfxPoolItem&>(*pItem), nStt, nEnd );
if ( pNew )
{
@@ -1862,20 +1859,18 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
}
const USHORT nSize = m_pSwpHints->Count();
- USHORT n;
- xub_StrLen nAttrStart;
- const xub_StrLen* pAttrEnd;
if( nStt == nEnd ) // kein Bereich:
{
- for( n = 0; n < nSize; ++n ) //
+ for (USHORT n = 0; n < nSize; ++n)
{
const SwTxtAttr* pHt = (*m_pSwpHints)[n];
- nAttrStart = *pHt->GetStart();
+ const xub_StrLen nAttrStart = *pHt->GetStart();
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
- if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende
+ const xub_StrLen* pAttrEnd = pHt->GetEnd();
+ if ( ! pAttrEnd ) // no attributes without end
continue;
if( ( nAttrStart < nStt &&
@@ -1889,22 +1884,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
else // es ist ein Bereich definiert
{
// --> FME 2007-03-13 #i75299#
- std::vector< SwPoolItemEndPair >* pAttrArr = 0;
+ ::std::auto_ptr< std::vector< SwPoolItemEndPair > > pAttrArr;
// <--
const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
- static_cast<USHORT>(RES_CHRATR_BEGIN) +
- static_cast<USHORT>(RES_UNKNOWNATR_END) -
- static_cast<USHORT>(RES_UNKNOWNATR_BEGIN);
+ static_cast<USHORT>(RES_CHRATR_BEGIN);
- for( n = 0; n < nSize; ++n )
+ for (USHORT n = 0; n < nSize; ++n)
{
const SwTxtAttr* pHt = (*m_pSwpHints)[n];
- nAttrStart = *pHt->GetStart();
+ const xub_StrLen nAttrStart = *pHt->GetStart();
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
- if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende
+ const xub_StrLen* pAttrEnd = pHt->GetEnd();
+ if ( ! pAttrEnd ) // no attributes without end
continue;
BOOL bChkInvalid = FALSE;
@@ -1927,7 +1921,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
if( bChkInvalid )
{
// uneindeutig ?
- SfxItemIter* pItemIter = 0;
+ ::std::auto_ptr< SfxItemIter > pItemIter;
const SfxPoolItem* pItem = 0;
if ( RES_TXTATR_AUTOFMT == pHt->Which() )
@@ -1935,7 +1929,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
const SfxItemSet* pAutoSet = CharFmt::GetItemSet( pHt->GetAttr() );
if ( pAutoSet )
{
- pItemIter = new SfxItemIter( *pAutoSet );
+ pItemIter.reset( new SfxItemIter( *pAutoSet ) );
pItem = pItemIter->GetCurItem();
}
}
@@ -1947,9 +1941,14 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
while ( pItem )
{
const USHORT nHintWhich = pItem->Which();
+ ASSERT(!isUNKNOWNATR(nHintWhich),
+ "SwTxtNode::GetAttr(): unkonwn attribute?");
- if( !pAttrArr )
- pAttrArr = new std::vector< SwPoolItemEndPair >( coArrSz );
+ if ( !pAttrArr.get() )
+ {
+ pAttrArr.reset(
+ new std::vector< SwPoolItemEndPair >(coArrSz));
+ }
std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
if (isCHRATR(nHintWhich) ||
@@ -1957,12 +1956,6 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
{
pPrev += nHintWhich - RES_CHRATR_BEGIN;
}
- else if (isUNKNOWNATR(nHintWhich))
- {
- pPrev += nHintWhich - RES_UNKNOWNATR_BEGIN + (
- static_cast< USHORT >(RES_TXTATR_WITHEND_END) -
- static_cast< USHORT >(RES_CHRATR_BEGIN) );
- }
else
{
pPrev = pAttrArr->end();
@@ -2006,28 +1999,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
}
}
- pItem = ( pItemIter && !pItemIter->IsAtEnd() ) ? pItemIter->NextItem() : 0;
+ pItem = ( pItemIter.get() && !pItemIter->IsAtEnd() )
+ ? pItemIter->NextItem() : 0;
} // end while
-
- delete pItemIter;
}
}
- if( pAttrArr )
+ if ( pAttrArr.get() )
{
- for( n = 0; n < coArrSz; ++n )
+ for (USHORT n = 0; n < coArrSz; ++n)
{
const SwPoolItemEndPair& rItemPair = (*pAttrArr)[ n ];
if( (0 != rItemPair.mpItem) && ((SfxPoolItem*)-1 != rItemPair.mpItem) )
{
- USHORT nWh;
- if( n < static_cast<USHORT>( static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
- static_cast<USHORT>(RES_CHRATR_BEGIN) ) )
- nWh = static_cast<USHORT>(n + RES_CHRATR_BEGIN);
- else
- nWh = n - static_cast<USHORT>( static_cast<USHORT>(RES_TXTATR_WITHEND_END) -
- static_cast<USHORT>(RES_CHRATR_BEGIN) +
- static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) );
+ const USHORT nWh =
+ static_cast<USHORT>(n + RES_CHRATR_BEGIN);
if( nEnd <= rItemPair.mnEndPos ) // hinter oder genau Ende
{
@@ -2039,8 +2025,6 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
rSet.InvalidateItem( nWh );
}
}
-
- delete pAttrArr;
}
}
if( aFmtSet.Count() )
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index f500d28596..d9d94b05b2 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -31,7 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <hintids.hxx>
#include <hints.hxx>
#include <sfx2/objsh.hxx>
@@ -52,13 +51,6 @@
TYPEINIT1(SwTxtINetFmt,SwClient);
TYPEINIT1(SwTxtRuby,SwClient);
-// ATT_XMLCONTAINERITEM ******************************
-
-SwTxtXMLAttrContainer::SwTxtXMLAttrContainer(
- SvXMLAttrContainerItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnde )
- : SwTxtAttrEnd( rAttr, nStt, nEnde )
-{}
/*************************************************************************
* class SwTxtCharFmt
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index db2743218f..15f98f4d1f 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1676,6 +1676,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
void SwTxtNode::CountWords( SwDocStat& rStat,
xub_StrLen nStt, xub_StrLen nEnd ) const
{
+ ++rStat.nAllPara; // #i93174#: count _all_ paragraphs
if( nStt < nEnd )
{
if ( !IsHidden() )
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 44ac5f49c4..72da13fe5a 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -833,7 +833,7 @@ SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet,
, m_Array( (BYTE)rSet.Count() )
{
SfxItemIter aIter( rSet );
- bool bAutoStyle = true;
+ bool bAutoStyle = false;
while( TRUE )
{
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 38a83445c5..9338e5fbc5 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -666,14 +666,9 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
{
if( !pHistory )
pHistory = new SwHistory;
- if( pAPos->nNode < pEnd->nNode &&
- ( ( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType ) ||
- ( pStt->nNode < pAPos->nNode || !pStt->nContent.GetIndex() ) ) )
+ if (IsDestroyFrameAnchoredAtChar(
+ *pAPos, *pStt, *pEnd, nDelCntntType))
{
- // Here we identified the objects to destroy:
- // - anchored between start and end of the selection
- // - anchored in start of the selection with "CheckNoContent"
- // - anchored in start of sel. and the selection start at pos 0
pHistory->Add( *pFmt, nChainInsPos );
n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1;
}
@@ -1388,3 +1383,20 @@ String DenoteSpecialCharacters(const String & rStr)
return aResult;
}
+
+bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
+ SwPosition const & rStart, SwPosition const & rEnd,
+ DelCntntType const nDelCntntType)
+{
+
+ // Here we identified the objects to destroy:
+ // - anchored between start and end of the selection
+ // - anchored in start of the selection with "CheckNoContent"
+ // - anchored in start of sel. and the selection start at pos 0
+ return (rAnchorPos.nNode < rEnd.nNode)
+ && ( (nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType)
+ || (rStart.nNode < rAnchorPos.nNode)
+ || !rStart.nContent.GetIndex()
+ );
+}
+
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index 944e239daf..8ce47d86dc 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -247,6 +247,12 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter )
// im aSaveRange steht der kopierte, sprich der originale.
SwDoc& rDoc = rIter.GetDoc();
+ SwPosition* pStart = rIter.pAktPam->Start();
+ SwPosition* pEnd = rIter.pAktPam->End();
+
+ SwNodeIndex aPrevIdx( pStart->nNode, -1 );
+ ULONG nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
+
if( 0 == ( nsRedlineMode_t::REDLINE_SHOW_DELETE & rDoc.GetRedlineMode()) )
{
// die beiden Redline Objecte suchen und diese dann anzeigen lassen,
@@ -254,17 +260,17 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter )
// das Geloeschte ist versteckt, also suche das INSERT
// Redline Object. Dahinter steht das Geloeschte
USHORT nFnd = rDoc.GetRedlinePos(
- *rDoc.GetNodes()[ nSttNode + nOffset + 1 ],
+ *rDoc.GetNodes()[ nSttNode + 1 ],
nsRedlineType_t::REDLINE_INSERT );
ASSERT( USHRT_MAX != nFnd && nFnd+1 < rDoc.GetRedlineTbl().Count(),
"kein Insert Object gefunden" );
++nFnd;
- rDoc.GetRedlineTbl()[nFnd]->Show();
- SetPaM( *rIter.pAktPam );
+ rDoc.GetRedlineTbl()[nFnd]->Show( 1 );
}
{
SwPaM aTmp( *rIter.pAktPam->GetMark() );
+ aTmp.GetMark()->nContent = 0;
aTmp.SetMark();
aTmp.GetPoint()->nNode = nSaveEndNode;
aTmp.GetPoint()->nContent.Assign( aTmp.GetCntntNode(), nSaveEndCntnt );
@@ -272,13 +278,52 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter )
}
rDoc.DelFullPara( *rIter.pAktPam );
+
+ SwPaM* pPam = rIter.pAktPam;
+ pPam->DeleteMark();
+ pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
+ SwCntntNode* pCNd = pPam->GetCntntNode();
+ pPam->GetPoint()->nContent.Assign(pCNd, 0 );
+ pPam->SetMark();
+
+ pPam->GetPoint()->nNode += nOffsetTemp;
+ pCNd = pPam->GetCntntNode();
+ pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+
+ SetValues( *pPam );
+
SetPaM( *rIter.pAktPam );
}
void SwUndoRedlineSort::_Redo( SwUndoIter& rIter )
{
SwPaM& rPam = *rIter.pAktPam;
+
+ SwPaM* pPam = &rPam;
+ SwPosition* pStart = pPam->Start();
+ SwPosition* pEnd = pPam->End();
+
+ SwNodeIndex aPrevIdx( pStart->nNode, -1 );
+ ULONG nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
+ xub_StrLen nCntStt = pStart->nContent.GetIndex();
+
rIter.GetDoc().SortText( rPam, *pOpt );
+
+ pPam->DeleteMark();
+ pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
+ SwCntntNode* pCNd = pPam->GetCntntNode();
+ xub_StrLen nLen = pCNd->Len();
+ if( nLen > nCntStt )
+ nLen = nCntStt;
+ pPam->GetPoint()->nContent.Assign(pCNd, nLen );
+ pPam->SetMark();
+
+ pPam->GetPoint()->nNode += nOffsetTemp;
+ pCNd = pPam->GetCntntNode();
+ pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+
+ SetValues( rPam );
+
SetPaM( rPam );
rPam.GetPoint()->nNode = nSaveEndNode;
rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), nSaveEndCntnt );
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index b3d17e83a4..08c22ac8e6 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1032,9 +1032,11 @@ void makeRedline( SwPaM& rPaM,
}
SwRedline* pRedline = new SwRedline( aRedlineData, rPaM );
+ RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
+
pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
- pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE);
+ pRedlineAccess->SetRedlineMode_intern( nPrevMode );
if( !bRet )
throw lang::IllegalArgumentException();
}
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 0abfc6844e..a88f0a26c0 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -2117,6 +2117,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
OTextCursorHelper* pCursor = 0;
SwXTextPortion* pPortion = 0;
SwXText* pText = 0;
+ SwXParagraph* pParagraph = 0;
pRange = reinterpret_cast< SwXTextRange * >(
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
@@ -2126,6 +2127,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
pPortion = reinterpret_cast< SwXTextPortion * >(
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
+ pParagraph = reinterpret_cast< SwXParagraph * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
if (pRange)
pDoc = pRange->GetDoc();
@@ -2137,6 +2140,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
{
pDoc = pPortion->GetCursor()->GetDoc();
}
+ else if ( !pDoc && pParagraph && pParagraph->GetTxtNode( ) )
+ pDoc = pParagraph->GetTxtNode( )->GetDoc( );
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 36dd9cc160..0cf7fe86d7 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1192,6 +1192,12 @@ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) :
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)),
pMark(NULL)
{
+ SwTable* pTable = SwTable::FindTable( &rTblFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode( );
+ SwPosition aPosition( *pTblNode );
+ SwPaM aPam( aPosition );
+
+ _CreateNewBookmark( aPam );
}
SwXTextRange::~SwXTextRange()
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 8671230214..d59d33988b 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -719,10 +719,6 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion:
aResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
aResultVector.push_back( aResult );
}
- // this assertion should never occur!
- DBG_ASSERT( !aResultVector.size() || aResult.Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE,
- "unknown failure while retrieving property" );
-
}
}
catch (beans::UnknownPropertyException &)
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 327bfd7c68..6809c389d1 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -831,7 +831,6 @@ lcl_ExportHints(
case RES_TXTATR_AUTOFMT:
case RES_TXTATR_INETFMT:
case RES_TXTATR_CHARFMT:
- case RES_TXTATR_UNKNOWN_CONTAINER:
break; // these are handled as properties of a "Text" portion
default:
DBG_ERROR("unknown attribute");
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 73d08d7cf5..0373d8877a 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -66,6 +66,8 @@
#include <memory>
#include <stdlib.h>
+#include <iostream>
+
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -1827,19 +1829,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
*/
if(aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode)
{
- const SwNode& rStartNode = aStartCellPam.Start()->nNode.GetNode();
- if(!rStartNode.IsTxtNode() ||
- !aEndCellPam.End()->nNode.GetNode().IsTxtNode())
- {
- //start and end of the cell must be on a SwTxtNode
- bExcept = true;
- break;
- }
// increment on each StartNode and decrement on each EndNode
// we must reach zero at the end and must not go below zero
long nOpenNodeBlock = 0;
SwNodeIndex aCellIndex = aStartCellPam.Start()->nNode;
- while( ++aCellIndex < aEndCellPam.End()->nNode.GetIndex())
+ while( aCellIndex < aEndCellPam.End()->nNode.GetIndex())
{
if( aCellIndex.GetNode().IsStartNode() )
++nOpenNodeBlock;
@@ -1850,6 +1844,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
bExcept = true;
break;
}
+ ++aCellIndex;
}
if( nOpenNodeBlock != 0)
{
@@ -1895,7 +1890,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
//node border anyway
}
else
+ {
bExcept = true;
+ }
}
//now check if there's a need to insert another paragraph break
if( aEndCellPam.End()->nContent.GetIndex() < aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len())
@@ -1952,7 +1949,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
const beans::PropertyValue* pTableProperties = rTableProperties.getConstArray();
sal_Int32 nProperty = 0;
for( ; nProperty < rTableProperties.getLength(); ++nProperty)
- xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
+ {
+ try
+ {
+ xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
+ }
+ catch ( const uno::Exception e )
+ {
+#if DEBUG
+ std::clog << "Exception when setting property: ";
+ std::clog << rtl::OUStringToOString( pTableProperties[nProperty].Name, RTL_TEXTENCODING_UTF8 ).getStr( );
+ std::clog << ". Message: ";
+ std::clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
+ std::clog << std::endl;
+#endif
+ }
+ }
//apply row properties
uno::Reference< table::XTableRows > xRows = xRet->getRows();
@@ -2009,6 +2021,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
//--<
#endif
+
//apply cell properties
for( nRow = 0; nRow < rCellProperties.getLength(); ++nRow)
{
@@ -2021,7 +2034,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
uno::Reference< beans::XPropertySet > xCell( pTextTable->getCellByPosition(nCell, nRow), uno::UNO_QUERY );
for( nProperty = 0; nProperty < nCellProperties; ++nProperty)
{
- if(aCellProperties[nProperty].Name.equalsAsciiL(
+ const OUString& rName = aCellProperties[nProperty].Name;
+ if( rName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM ( "VerticalMerge")))
{
//determine left border position
@@ -2084,8 +2098,24 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
}
}
}
- else
- xCell->setPropertyValue(aCellProperties[nProperty].Name, aCellProperties[nProperty].Value);
+ else
+ {
+ try
+ {
+ xCell->setPropertyValue(rName, aCellProperties[nProperty].Value);
+ }
+ catch ( const uno::Exception e )
+ {
+ // Apply the paragraph and char properties to the cell's content
+ uno::Reference< text::XText > xCellText( xCell, uno::UNO_QUERY );
+ uno::Reference< text::XTextCursor > xCellCurs = xCellText->createTextCursor( );
+ xCellCurs->gotoStart( false );
+ xCellCurs->gotoEnd( true );
+
+ uno::Reference< beans::XPropertySet > xCellTextProps( xCellCurs, uno::UNO_QUERY );
+ xCellTextProps->setPropertyValue( rName, aCellProperties[nProperty].Value );
+ }
+ }
}
}
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index fa038871c0..c0a45fbb4e 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2685,7 +2685,7 @@ const BitmapEx& ViewShell::GetReplacementBitmap( bool bIsErrorState )
if( !*ppRet )
{
USHORT nBmpResId =
- Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark()
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode()
? nHCResId : nResId;
*ppRet = new BitmapEx( SW_RES( nBmpResId ) );
}