[Libreoffice-commits] core.git: 3 commits - editeng/source sd/source svtools/source svx/source sw/source toolkit/source vcl/source
Caolán McNamara
caolanm at redhat.com
Mon Jun 30 01:46:47 PDT 2014
editeng/source/editeng/eertfpar.cxx | 4
editeng/source/editeng/impedit2.cxx | 2
editeng/source/editeng/impedit3.cxx | 2
sd/source/ui/app/sdmod1.cxx | 2
sd/source/ui/func/fuinsfil.cxx | 4
svtools/source/contnr/treelistbox.cxx | 2
svx/source/accessibility/ChildrenManager.cxx | 58 +----
svx/source/dialog/charmap.cxx | 2
svx/source/items/numfmtsh.cxx | 6
svx/source/sdr/contact/viewcontactofsdrobj.cxx | 4
svx/source/sdr/contact/viewcontactofsdrpage.cxx | 4
svx/source/svdraw/svdview.cxx | 2
sw/source/core/access/accmap.cxx | 4
sw/source/core/doc/docedt.cxx | 3
sw/source/core/frmedt/feshview.cxx | 2
sw/source/core/layout/layouter.cxx | 2
sw/source/core/layout/tabfrm.cxx | 15 -
sw/source/core/table/swtable.cxx | 2
sw/source/core/undo/untbl.cxx | 2
sw/source/core/unocore/unoframe.cxx | 2
sw/source/filter/html/svxcss1.cxx | 5
sw/source/filter/ww8/ww8par.cxx | 243 ++++++++++--------------
sw/source/filter/ww8/ww8par.hxx | 69 +++++-
sw/source/filter/ww8/ww8par2.cxx | 2
sw/source/filter/ww8/ww8par3.cxx | 46 ++--
sw/source/filter/ww8/ww8par5.cxx | 37 ---
sw/source/filter/ww8/ww8par6.cxx | 27 +-
sw/source/filter/xml/swxml.cxx | 4
sw/source/filter/xml/xmlexpit.cxx | 16 -
sw/source/uibase/app/applab.cxx | 2
sw/source/uibase/config/viewopt.cxx | 2
sw/source/uibase/dialog/wordcountwrapper.cxx | 4
sw/source/uibase/index/toxmgr.cxx | 2
sw/source/uibase/uiview/viewport.cxx | 2
sw/source/uibase/utlui/glbltree.cxx | 4
toolkit/source/awt/vclxaccessiblecomponent.cxx | 2
vcl/source/edit/texteng.cxx | 3
vcl/source/helper/canvasbitmap.cxx | 8
38 files changed, 275 insertions(+), 327 deletions(-)
New commits:
commit 4523dd0544d762961435429167e41a0834b60cea
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 30 09:13:14 2014 +0100
Called C++ object pointer is null
Change-Id: I88efc4be6ff869ef97a2b398d43f7b7914debfc6
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 3662a4c..006131c 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -160,7 +160,7 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r
for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
ContentNode* pNode = mpEditEngine->GetEditDoc().GetObject( nPara );
- DBG_ASSERT( pNode, "AddRTFDefaultValues - No paragraph?!" );
+ assert(pNode && "AddRTFDefaultValues - No paragraph?!");
if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTINFO ) )
pNode->GetContentAttribs().GetItems().Put( aFontItem );
if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTHEIGHT ) )
@@ -280,7 +280,7 @@ void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos,
if ( nCurPara )
nCurPara--;
ContentNode* pPrevNode = mpEditEngine->GetEditDoc().GetObject( nCurPara );
- DBG_ASSERT( pPrevNode, "pPrevNode = 0!" );
+ assert(pPrevNode && "pPrevNode = 0!");
rpNodePos = new EditNodeIdx(mpEditEngine, pPrevNode);
rCntPos = pPrevNode->Len();
}
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 3140c16..ee1ae9f 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -711,7 +711,7 @@ void ImpEditEngine::TextModified()
void ImpEditEngine::ParaAttribsChanged( ContentNode* pNode )
{
- OSL_ENSURE( pNode, "ParaAttribsChanged: Which one?" );
+ assert(pNode && "ParaAttribsChanged: Which one?");
aEditDoc.SetModified( true );
bFormatted = false;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index d717b1a..f519fe8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4112,7 +4112,7 @@ EditPaM ImpEditEngine::InsertParagraph( sal_Int32 nPara )
ContentNode* pNode = GetEditDoc().GetObject( nPara-1 );
if ( !pNode )
pNode = GetEditDoc().GetObject( GetEditDoc().Count() - 1 );
- DBG_ASSERT( pNode, "Not a single paragraph in InsertParagraph ?" );
+ assert(pNode && "Not a single paragraph in InsertParagraph ?");
aPaM = EditPaM( pNode, pNode->Len() );
}
else
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index b4d7256..7ba47c4 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -664,7 +664,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
::sd::ViewShellBase* pBase =
::sd::ViewShellBase::GetViewShellBase (
pViewFrame);
- OSL_ASSERT (pBase!=NULL);
+ assert(pBase!=NULL);
::boost::shared_ptr<sd::ViewShell> pViewSh = pBase->GetMainViewShell();
SdOptions* pOptions = GetSdOptions(pDoc->GetDocumentType());
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 4d172e0..7514812 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -449,7 +449,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
pOutliner->SetPaperSize(pPage->GetSize());
SvStream* pStream = pMedium->GetInStream();
- DBG_ASSERT( pStream, "No InStream!" );
+ assert(pStream && "No InStream!");
pStream->Seek( 0 );
sal_uLong nErr = pOutliner->Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() );
@@ -469,7 +469,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
pPage = (SdPage*)(&(pPage->TRG_GetMasterPage()));
}
- DBG_ASSERT(pPage, "page not found");
+ assert(pPage && "page not found");
// if editing is going on right now, let it flow into this text object
OutlinerView* pOutlinerView = mpView->GetTextEditOutlinerView();
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index f27e419..5d0eadf 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3861,7 +3861,7 @@ void SvTreeListBox::EnableList( bool _bEnable )
void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl::AccessibleStateSetHelper& rStateSet ) const
{
- DBG_ASSERT( pEntry, "SvTreeListBox::FillAccessibleEntryStateSet: invalid entry" );
+ assert(pEntry && "SvTreeListBox::FillAccessibleEntryStateSet: invalid entry");
if ( pEntry->HasChildrenOnDemand() || pEntry->HasChildren() )
{
diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx
index 2a1b854..5795f19 100644
--- a/svx/source/accessibility/ChildrenManager.cxx
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -57,30 +57,24 @@ ChildrenManager::~ChildrenManager (void)
OSL_TRACE ("~ChildrenManager");
}
-
-
-
long ChildrenManager::GetChildCount (void) const throw ()
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
return mpImpl->GetChildCount();
}
-
-
-
::com::sun::star::uno::Reference<XAccessible> ChildrenManager::GetChild (long nIndex)
throw (::com::sun::star::uno::RuntimeException,
::com::sun::star::lang::IndexOutOfBoundsException)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
return mpImpl->GetChild (nIndex);
}
Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
throw (::com::sun::star::uno::RuntimeException)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
return mpImpl->GetChild (xShape);
}
@@ -89,93 +83,67 @@ Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShap
throw (::com::sun::star::uno::RuntimeException,
::com::sun::star::lang::IndexOutOfBoundsException)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
return mpImpl->GetChildShape(nIndex);
}
void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->Update (bCreateNewObjectsOnDemand);
}
-
-
-
void ChildrenManager::SetShapeList (const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes>& xShapeList)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->SetShapeList (xShapeList);
}
-
-
-
void ChildrenManager::AddAccessibleShape (css::uno::Reference<css::accessibility::XAccessible> const & shape)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->AddAccessibleShape (shape);
}
-
-
-
void ChildrenManager::ClearAccessibleShapeList (void)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->ClearAccessibleShapeList ();
}
-
-
-
void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->SetInfo (rShapeTreeInfo);
}
-
-
-
void ChildrenManager::UpdateSelection (void)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->UpdateSelection ();
}
-
-
-
bool ChildrenManager::HasFocus (void)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
return mpImpl->HasFocus ();
}
-
-
-
void ChildrenManager::RemoveFocus (void)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->RemoveFocus ();
}
-
-
-
//===== IAccessibleViewForwarderListener ====================================
void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
const IAccessibleViewForwarder* pViewForwarder)
{
- OSL_ASSERT (mpImpl != NULL);
+ assert(mpImpl != NULL);
mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
}
-
-
} // end of namespace accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index c0d01aa..6f68134 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -629,7 +629,7 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus )
else
m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
- OSL_ENSURE(pItem->m_pItem,"No accessible created!");
+ assert(pItem->m_pItem && "No accessible created!");
Any aOldAny, aNewAny;
aNewAny <<= AccessibleStateType::FOCUSED;
// Don't fire the focus event.
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 3d30b76..80b9255 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -698,7 +698,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<OUString>& r
{
sal_uInt16 nMyType;
- DBG_ASSERT( pCurFmtTable != NULL, "Unknown number format!" );
+ assert(pCurFmtTable && "Unknown number format!");
const SvNumberformat* pNumEntry = pCurFmtTable->empty() ? 0 : pCurFmtTable->begin()->second;
sal_uInt32 nNFEntry;
@@ -707,9 +707,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<OUString>& r
short nMyCat = SELPOS_NONE;
- long nIndex;
-
- for(nIndex=NF_DATETIME_START;nIndex<=NF_DATETIME_END;nIndex++)
+ for (long nIndex = NF_DATETIME_START; nIndex <= NF_DATETIME_END; ++nIndex)
{
nNFEntry=pFormatter->GetFormatIndex((NfIndexTableOffset)nIndex,eCurLanguage);
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index 663e876..946ffac 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -80,10 +80,10 @@ namespace sdr
ViewContact& ViewContactOfSdrObj::GetViewContact(sal_uInt32 nIndex) const
{
- DBG_ASSERT(GetSdrObject().GetSubList(),
+ assert(GetSdrObject().GetSubList() &&
"ViewContactOfSdrObj::GetViewContact: Access to non-existent Sub-List (!)");
SdrObject* pObj = GetSdrObject().GetSubList()->GetObj(nIndex);
- DBG_ASSERT(pObj, "ViewContactOfSdrObj::GetViewContact: Corrupt SdrObjList (!)");
+ assert(pObj && "ViewContactOfSdrObj::GetViewContact: Corrupt SdrObjList (!)");
return pObj->GetViewContact();
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index ce25218..04ac457 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -482,14 +482,12 @@ namespace sdr
ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
{
SdrObject* pObj = getPage().GetObj(nIndex);
- DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
+ assert(pObj && "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
return pObj->GetViewContact();
}
} // end of namespace contact
} // end of namespace sdr
-
-
namespace sdr
{
namespace contact
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 9bb5cfc..9edcaf8 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -1450,7 +1450,7 @@ void SdrView::SetMasterPagePaintCaching(bool bOn)
for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
{
SdrPageWindow* pPageWindow = pPageView->GetPageWindow(b);
- DBG_ASSERT(pPageWindow, "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
+ assert(pPageWindow && "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
// force deletion of ObjectContact, so at re-display all VOCs
// will be re-created with updated flag setting
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index ae46e24..14822d8 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2968,8 +2968,8 @@ void SwAccessibleMap::UpdatePreview( const std::vector<PreviewPage*>& _rPreviewP
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
- OSL_ENSURE( GetShell()->IsPreview(), "no preview?" );
- OSL_ENSURE( mpPreview != NULL, "no preview data?" );
+ assert(GetShell()->IsPreview() && "no preview?");
+ assert(mpPreview != NULL && "no preview data?");
mpPreview->Update( *this, _rPreviewPages, _rScale, _pSelectedPageFrm, _rPreviewWinSize );
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 24c2761..8e357b7 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -682,7 +682,8 @@ void _SaveRedlEndPosForRestore::_Restore()
/// The passed Node is located somewhere in the designated Section.
void SwDoc::DeleteSection( SwNode *pNode )
{
- OSL_ENSURE( pNode, "Didn't pass a Node." );
+ assert(pNode && "Didn't pass a Node.");
+
SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode
: pNode->StartOfSectionNode();
SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() );
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 1d7ac9b..0aca2c6 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1762,7 +1762,7 @@ bool SwFEShell::ImpEndCreate()
SwTxtFrm* pTmp = (SwTxtFrm*)pAnch;
do {
pTmp = pTmp->FindMaster();
- OSL_ENSURE( pTmp, "Where's my Master?" );
+ assert(pTmp && "Where's my Master?");
nYOffset += pTmp->IsVertical() ?
pTmp->Prt().Width() : pTmp->Prt().Height();
} while ( pTmp->IsFollow() );
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index b485c84..6dcbc89 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -280,7 +280,7 @@ void SwLayouter::EndLoopControl()
void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect )
{
- OSL_ENSURE( pDoc, "No doc, no fun" );
+ assert(pDoc && "No doc, no fun");
if( !pDoc->GetLayouter() )
pDoc->SetLayouter( new SwLayouter() );
pDoc->GetLayouter()->_CollectEndnotes( pSect );
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index b89aed3..fdc5f3e 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1686,7 +1686,7 @@ void SwTableBox::RemoveFromTable()
{
// remove from table
const SwTableNode* pTblNd = pSttNd->FindTableNode();
- OSL_ENSURE( pTblNd, "In which table is that box?" );
+ assert(pTblNd && "In which table is that box?");
SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
GetTabSortBoxes();
SwTableBox *p = this; // error: &this
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 47154c9..abb2539 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -2312,7 +2312,7 @@ void SwUndoTblNumFmt::RedoImpl(::sw::UndoRedoContext & rContext)
SwNode * pNd = & pPam->GetPoint()->nNode.GetNode();
SwStartNode* pSttNd = pNd->FindSttNodeByType( SwTableBoxStartNode );
- OSL_ENSURE( pSttNd, "without StartNode no TableBox" );
+ assert(pSttNd && "without StartNode no TableBox");
SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTblBox(
pSttNd->GetIndex() );
OSL_ENSURE( pBox, "found no TableBox" );
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 99ada2c..dc3e781 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2984,7 +2984,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect );
pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL );
- OSL_ENSURE( pFmt2, "Doc->Insert(notxt) failed." );
+ assert(pFmt2 && "Doc->Insert(notxt) failed.");
pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
pFmt2->Add(this);
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 94376a0..1c1e040 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -1266,10 +1266,9 @@ static void ParseCSS1_font_variant( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
// normal | small-caps
-
switch( pExpr->GetType() )
{
case CSS1_IDENT:
@@ -2131,7 +2130,7 @@ static void ParseCSS1_margin_top( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
sal_uInt16 nUpper = 0;
bool bSet = false;
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 64968e4..0ac6d70 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -132,7 +132,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport,
{
OUStringBuffer aOut;
const SfxBoolItem* pSplit = PTR_CAST(SfxBoolItem, &rItem);
- assert(pSplit); //Wrong Which-ID
+ assert(pSplit && "Wrong Which-ID");
const unsigned int eEnum = (pSplit && pSplit->GetValue()) ? 1 : 0;
SvXMLUnitConverter::convertEnum( aOut, eEnum, aXML_KeepTogetherType );
aValue = aOut.makeStringAndClear();
@@ -493,7 +493,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_SHADOW:
{
const SvxShadowItem* pShadow = PTR_CAST(SvxShadowItem, &rItem);
- assert(pShadow); //Wrong Which-ID
+ assert(pShadow && "Wrong Which-ID");
if (pShadow)
{
sal_Int32 nX = 1, nY = 1;
@@ -534,7 +534,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_BOX:
{
SvxBoxItem* pBox = PTR_CAST(SvxBoxItem, &rItem);
- assert(pBox); //Wrong WHich-ID
+ assert(pBox && "Wrong Which-ID");
if (pBox)
{
/**
@@ -872,7 +872,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_KEEP:
{
SvxFmtKeepItem* pFmtKeep = PTR_CAST(SvxFmtKeepItem, &rItem);
- assert(pFmtKeep); //Wrong Which-ID
+ assert(pFmtKeep && "Wrong Which-ID");
if (pFmtKeep)
{
aOut.append( pFmtKeep->GetValue()
@@ -1024,7 +1024,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_ROW_SPLIT:
{
const SfxBoolItem* pSplit = PTR_CAST(SfxBoolItem, &rItem);
- assert(pSplit); //Wrong Which-ID
+ assert(pSplit && "Wrong Which-ID");
if (pSplit)
{
::sax::Converter::convertBool( aOut, pSplit->GetValue() );
@@ -1036,7 +1036,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_HORI_ORIENT:
{
SwFmtHoriOrient* pHoriOrient = PTR_CAST(SwFmtHoriOrient, &rItem);
- assert(pHoriOrient); //Wrong Which-ID
+ assert(pHoriOrient && "Wrong Which-ID");
if (pHoriOrient)
{
SvXMLUnitConverter::convertEnum( aOut, pHoriOrient->GetHoriOrient(),
@@ -1049,7 +1049,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_VERT_ORIENT:
{
SwFmtVertOrient* pVertOrient = PTR_CAST(SwFmtVertOrient, &rItem);
- OSL_ENSURE( pVertOrient != NULL, "Wrong Which-ID" );
+ assert(pVertOrient && "Wrong Which-ID");
SvXMLUnitConverter::convertEnum( aOut, pVertOrient->GetVertOrient(),
aXMLTableVAlignMap );
@@ -1114,7 +1114,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_COLLAPSING_BORDERS:
{
const SfxBoolItem* pBorders = PTR_CAST(SfxBoolItem, &rItem);
- assert(pBorders); //Wrong RES-ID
+ assert(pBorders && "Wrong RES-ID");
if (pBorders)
{
aOut.append( pBorders->GetValue()
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 59015ae..7093574 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -403,7 +403,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
if( rItem.bSynchron )
{
SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
- OSL_ENSURE(pDisp, "No dispatcher in frame?");
+ assert(pDisp && "No dispatcher in frame?");
pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON);
}
rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index 0b4cec5..ea9ab8f 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -127,7 +127,7 @@ void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
{
- OSL_ENSURE( pOut, "no Outdev" );
+ assert(pOut && "no Outdev");
return sal_uInt16(pOut->GetTextWidth( OUString(aPostItStr )));
}
diff --git a/sw/source/uibase/dialog/wordcountwrapper.cxx b/sw/source/uibase/dialog/wordcountwrapper.cxx
index 78cf4ee..ea45d52 100644
--- a/sw/source/uibase/dialog/wordcountwrapper.cxx
+++ b/sw/source/uibase/dialog/wordcountwrapper.cxx
@@ -22,9 +22,9 @@ SwWordCountWrapper::SwWordCountWrapper( Window *pParentWindow,
SfxChildWindow(pParentWindow, nId)
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+ assert(pFact && "SwAbstractDialogFactory fail!");
pAbstDlg = pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo);
- OSL_ENSURE(pAbstDlg, "Dialog construction failed!");
+ assert(pAbstDlg && "Dialog construction failed!");
pWindow = pAbstDlg->GetWindow();
eChildAlignment = SFX_ALIGN_NOALIGNMENT;
diff --git a/sw/source/uibase/index/toxmgr.cxx b/sw/source/uibase/index/toxmgr.cxx
index 4099b3b..e18c466 100644
--- a/sw/source/uibase/index/toxmgr.cxx
+++ b/sw/source/uibase/index/toxmgr.cxx
@@ -156,7 +156,7 @@ void SwTOXMgr::InsertTOXMark(const SwTOXMarkDescription& rDesc)
// Update of TOXMarks
void SwTOXMgr::UpdateTOXMark(const SwTOXMarkDescription& rDesc)
{
- OSL_ENSURE(pCurTOXMark, "no current TOXMark");
+ assert(pCurTOXMark && "no current TOXMark");
pSh->StartAllAction();
if(pCurTOXMark->GetTOXType()->GetType() == TOX_INDEX)
{
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 6e9ab88..9961b99 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -131,7 +131,7 @@ void SwView::InvalidateRulerPos()
GetViewFrame()->GetBindings().Invalidate(aInval);
- OSL_ENSURE(m_pHRuler, "Why is the ruler not there?");
+ assert(m_pHRuler && "Why is the ruler not there?");
m_pHRuler->ForceUpdate();
m_pVRuler->ForceUpdate();
}
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 12bcf3c..c603cc9 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -879,14 +879,14 @@ void SwGlobalTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry
0);
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
+ assert(pFact && "Dialogdiet fail!");
boost::scoped_ptr<AbstractMultiTOXTabDialog> pDlg(pFact->CreateMultiTOXTabDialog(
this, aSet,
*pActiveShell,
0,
USHRT_MAX,
true));
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
+ assert(pDlg && "Dialogdiet fail!");
if(RET_OK == pDlg->Execute())
{
SwTOXDescription& rDesc = pDlg->GetTOXDescription(
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index 907f7b4..0292857 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -186,7 +186,7 @@ void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWind
uno::Any aOldValue, aNewValue;
Window* pAccWindow = rVclWindowEvent.GetWindow();
- DBG_ASSERT( pAccWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" );
+ assert(pAccWindow && "VCLXAccessibleComponent::ProcessWindowEvent - Window?");
switch ( rVclWindowEvent.GetId() )
{
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 660df5a..65feb24 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1092,7 +1092,8 @@ sal_uInt16 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara
break; // correct Y-Position not needed
}
}
- DBG_ASSERT( pLine, "ImpFindIndex: pLine ?" );
+
+ assert(pLine && "ImpFindIndex: pLine ?");
nCurIndex = GetCharPos( nPortion, nLine, rPosInPara.X(), bSmart );
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index 5376204..6cbfd52 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -590,7 +590,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
const long nScanlineLeftOffset( pos.X*m_nBitsPerInputPixel/8 );
if( !m_aBmpEx.IsTransparent() )
{
- OSL_ENSURE(m_pBmpAcc,"Invalid bmp read access");
+ assert(m_pBmpAcc && "Invalid bmp read access");
// can return bitmap data as-is
Scanline pScan = m_pBmpAcc->GetScanline(pos.Y);
@@ -598,12 +598,12 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
}
else
{
- OSL_ENSURE(m_pBmpAcc,"Invalid bmp read access");
- OSL_ENSURE(m_pAlphaAcc,"Invalid alpha read access");
+ assert(m_pBmpAcc && "Invalid bmp read access");
+ assert(m_pAlphaAcc && "Invalid alpha read access");
// interleave alpha with bitmap data - note, bitcount is
// always integer multiple of 8
- OSL_ENSURE((m_nBitsPerOutputPixel & 0x07) == 0,
+ assert((m_nBitsPerOutputPixel & 0x07) == 0 &&
"Transparent bitmap bitcount not integer multiple of 8" );
if( m_nBitsPerInputPixel < 8 )
commit 390ec50cbe3e0b8c15db6504b5bdd36dc3f3fb61
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 30 09:12:04 2014 +0100
Called C++ object pointer is null
Change-Id: Ia0bf5991a5beb363fde5e22a17920fc21fc0eca8
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index d542947..00ac6a2 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3088,12 +3088,15 @@ void SwTabFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
{
rInvFlags |= 0x40;
SwPageFrm *pPage = FindPageFrm();
- if ( !GetPrev() )
- CheckPageDescs( pPage );
- if ( pPage && GetFmt()->GetPageDesc().GetNumOffset() )
- ((SwRootFrm*)pPage->GetUpper())->SetVirtPageNum( true );
- SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
- GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
+ if (pPage)
+ {
+ if ( !GetPrev() )
+ CheckPageDescs( pPage );
+ if (GetFmt()->GetPageDesc().GetNumOffset())
+ ((SwRootFrm*)pPage->GetUpper())->SetVirtPageNum( true );
+ SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
+ GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
+ }
}
break;
commit c99f264be5eaf481f88606e2606c34170675c1b4
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jun 27 12:34:10 2014 +0000
Related: #i78498# improvements/corrections regarding outline level & Co
- import outline level attribute at Paragraph Styles
- import outline level attribute at paragraphs
- refactor code to apply list level properties to Outline Style
-- only consider WW8 list styles applied to WW8 Built-in Heading Styles
-- only assign our counterparts of WW8 Built-in Heading Styles to Outline Style
(cherry picked from commit 9032e17b9989d4fc8faefe7717d2ea14d124e653)
(cherry picked from commit c3a35e3885334cb37b2b569daaf536a8cc26031d)
Conflicts:
sw/source/filter/rtf/swparrtf.cxx
sw/source/filter/ww8/ww8par.cxx
sw/source/filter/ww8/ww8par.hxx
sw/source/filter/ww8/ww8par2.cxx
sw/source/filter/ww8/ww8par2.hxx
sw/source/filter/ww8/ww8par3.cxx
sw/source/filter/ww8/ww8par5.cxx
sw/source/filter/ww8/ww8par6.cxx
sw/source/filter/xml/swxml.cxx
Change-Id: Ia70920f91300fa47236533f59356abb546a94fb3
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 34ca56e..0513c26 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4116,7 +4116,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
, maGrfNameGenerator(bNewDoc, OUString('G'))
, maParaStyleMapper(rD)
, maCharStyleMapper(rD)
- , mpChosenOutlineNumRule(0)
, pFormImpl(0)
, pFlyFmtOfJustInsertedGraphic(0)
, pFmtOfJustInsertedApo(0)
@@ -4983,7 +4982,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
pStyles->PostProcessStyles();
if (!vColl.empty())
- SetOutLineStyles();
+ SetOutlineStyles();
pSBase = new WW8ScannerBase(pStrm,pTableStream,pDataStream,pWwFib);
@@ -5737,178 +5736,148 @@ public:
}
};
-void SwWW8ImplReader::SetOutLineStyles()
+void SwWW8ImplReader::SetOutlineStyles()
{
- /*
- #i3674# - Load new document and insert document cases.
- */
- SwNumRule aOutlineRule(*rDoc.GetOutlineNumRule());
- // #i53044,i53213#
- // <mpChosenOutlineNumRule> has to be set to point to local variable
- // <aOutlineRule>, because its used below to be compared this <&aOutlineRule>.
- // But at the end of the method <mpChosenOutlineNumRule> has to be set to
- // <rDoc.GetOutlineNumRule()>, because <aOutlineRule> will be destroyed.
- mpChosenOutlineNumRule = &aOutlineRule;
-
- sw::ParaStyles aOutLined(sw::util::GetParaStyles(rDoc));
- // #i98791# - sorting algorithm adjusted
- sw::util::SortByAssignedOutlineStyleListLevel(aOutLined);
-
- typedef sw::ParaStyleIter myParaStyleIter;
- /*
- If we are inserted into a document then don't clobber existing existing
- levels.
- */
- sal_uInt16 nFlagsStyleOutlLevel = 0;
+ // If we are inserted into a document then don't clobber existing outline
+ // levels.
+ sal_uInt16 nOutlineStyleListLevelWithAssignment = 0;
if (!mbNewDoc)
{
- // #i70748# - backward iteration needed due to the outline level attribute
+ sw::ParaStyles aOutLined(sw::util::GetParaStyles(rDoc));
+ sw::util::SortByAssignedOutlineStyleListLevel(aOutLined);
sw::ParaStyles::reverse_iterator aEnd = aOutLined.rend();
for ( sw::ParaStyles::reverse_iterator aIter = aOutLined.rbegin(); aIter < aEnd; ++aIter)
{
if ((*aIter)->IsAssignedToListLevelOfOutlineStyle())
- nFlagsStyleOutlLevel |= 1 << (*aIter)->GetAssignedOutlineStyleLevel();
+ nOutlineStyleListLevelWithAssignment |= 1 << (*aIter)->GetAssignedOutlineStyleLevel();
else
break;
}
}
- else
+
+ // Check applied WW8 list styles at WW8 Built-In Heading Styles
+ // - Choose the list style which occurs most often as the one which provides
+ // the list level properties for the Outline Style.
+ // - Populate temporary list of WW8 Built-In Heading Styles for further
+ // iteration
+ std::vector<SwWW8StyInf*> aWW8BuiltInHeadingStyles;
+ const SwNumRule* pChosenWW8ListStyle = NULL;
{
- /*
- Only import *one* of the possible multiple outline numbering rules, so
- pick the one that affects most styles. If we're not importing a new
- document, we got to stick with what is already there.
- */
- // use index in text format collection array <vColl>
- // as key of the outline numbering map <aRuleMap>
- // instead of the memory pointer of the outline numbering rule
- // to assure that, if two outline numbering rule affect the same
- // count of text formats, always the same outline numbering rule is chosen.
- std::map<sal_uInt16, int>aRuleMap;
- typedef std::map<sal_uInt16, int>::iterator myIter;
+ std::map<const SwNumRule*, int> aWW8ListStyleCounts;
for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
{
- SwWW8StyInf& rSI = vColl[ nI ];
- if (
- (MAXLEVEL > rSI.nOutlineLevel) && rSI.pOutlineNumrule &&
- rSI.pFmt
- )
+ SwWW8StyInf& rSI = vColl[nI];
+
+ if (!rSI.IsWW8BuiltInHeadingStyle() || !rSI.HasWW8OutlineLevel())
{
- myIter aIter = aRuleMap.find(nI);
- if (aIter == aRuleMap.end())
- {
- aRuleMap[nI] = 1;
- }
- else
- ++(aIter->second);
+ continue;
}
- }
- int nMax = 0;
- myIter aEnd2 = aRuleMap.end();
- for (myIter aIter = aRuleMap.begin(); aIter != aEnd2; ++aIter)
- {
- if (aIter->second > nMax)
+ aWW8BuiltInHeadingStyles.push_back(&rSI);
+
+ const SwNumRule* pWW8ListStyle = rSI.GetOutlineNumrule();
+ if (pWW8ListStyle != NULL)
{
- nMax = aIter->second;
- if(aIter->first < vColl.size())
- mpChosenOutlineNumRule = vColl[ aIter->first ].pOutlineNumrule;
+ std::map<const SwNumRule*, int>::iterator aCountIter
+ = aWW8ListStyleCounts.find(pWW8ListStyle);
+ if (aCountIter == aWW8ListStyleCounts.end())
+ {
+ aWW8ListStyleCounts[pWW8ListStyle] = 1;
+ }
else
- mpChosenOutlineNumRule = 0; //TODO make sure this is what we want
+ {
+ ++(aCountIter->second);
+ }
}
}
- OSL_ENSURE(mpChosenOutlineNumRule, "Impossible");
- if (mpChosenOutlineNumRule)
- aOutlineRule = *mpChosenOutlineNumRule;
-
- if (mpChosenOutlineNumRule != &aOutlineRule)
+ int nCurrentMaxCount = 0;
+ std::map<const SwNumRule*, int>::iterator aCountIterEnd
+ = aWW8ListStyleCounts.end();
+ for (std::map<const SwNumRule*, int>::iterator aIter
+ = aWW8ListStyleCounts.begin();
+ aIter != aCountIterEnd; ++aIter)
{
- // #i70748# - backward iteration needed due to the outline level attribute
- sw::ParaStyles::reverse_iterator aEnd = aOutLined.rend();
- for ( sw::ParaStyles::reverse_iterator aIter = aOutLined.rbegin(); aIter < aEnd; ++aIter)
+ if (aIter->second > nCurrentMaxCount)
{
- if((*aIter)->IsAssignedToListLevelOfOutlineStyle())
- (*aIter)->DeleteAssignmentToListLevelOfOutlineStyle();
-
- else
- break;
+ nCurrentMaxCount = aIter->second;
+ pChosenWW8ListStyle = aIter->first;
}
}
}
- sal_uInt16 nOldFlags = nFlagsStyleOutlLevel;
+ if (pChosenWW8ListStyle == NULL)
+ {
+ // no WW8 list style for Outline Style found --> nothing to do
+ return;
+ }
- for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
+ // - set list level properties of Outline Style - ODF's list style applied
+ // by default to headings
+ // - assign corresponding Heading Paragraph Styles to the Outline Style
+ // - If a heading Paragraph Styles is not applying the WW8 list style which
+ // had been chosen as
+ // the one which provides the list level properties for the Outline Style,
+ // its assignment to
+ // the Outline Style is removed and a potential applied WW8 list style is
+ // assigned directly.
+ SwNumRule aOutlineRule(*rDoc.GetOutlineNumRule());
+ bool bAppliedChangedOutlineStyle = false;
+ std::vector<SwWW8StyInf*>::iterator aStylesIterEnd
+ = aWW8BuiltInHeadingStyles.end();
+ for (std::vector<SwWW8StyInf*>::iterator aStyleIter
+ = aWW8BuiltInHeadingStyles.begin();
+ aStyleIter != aStylesIterEnd; ++aStyleIter)
{
- SwWW8StyInf& rSI = vColl[nI];
+ SwWW8StyInf* pStyleInf = (*aStyleIter);
- if (rSI.IsOutlineNumbered())
+ const sal_uInt16 nOutlineStyleListLevelOfWW8BuiltInHeadingStyle
+ = 1 << pStyleInf->mnWW8OutlineLevel;
+ if (nOutlineStyleListLevelOfWW8BuiltInHeadingStyle
+ & nOutlineStyleListLevelWithAssignment)
{
- sal_uInt16 nAktFlags = 1 << rSI.nOutlineLevel;
- if (
- (nAktFlags & nFlagsStyleOutlLevel) ||
- (rSI.pOutlineNumrule != mpChosenOutlineNumRule)
- )
- {
- /*
- If our spot is already taken by something we can't replace
- then don't insert and remove our outline level.
- */
- rSI.pFmt->SetFmtAttr(
- SwNumRuleItem( rSI.pOutlineNumrule->GetName() ) );
- ((SwTxtFmtColl*)rSI.pFmt)->DeleteAssignmentToListLevelOfOutlineStyle(); // #outline level
- }
- else
- {
- /*
- If there is a style already set for this outline
- numbering level and its not a style set by us already
- then we can remove it outline numbering.
- (its one of the default headings in a new document
- so we can clobber it)
- Of course if we are being inserted into a document that
- already has some set we can't do this, thats covered by
- the list of level in nFlagsStyleOutlLevel to ignore.
- */
- outlineeq aCmp(rSI.nOutlineLevel);
- myParaStyleIter aResult = std::find_if(aOutLined.begin(),
- aOutLined.end(), aCmp);
-
- myParaStyleIter aEnd = aOutLined.end();
- while (aResult != aEnd && aCmp(*aResult))
- {
- (*aResult)->DeleteAssignmentToListLevelOfOutlineStyle();
- ++aResult;
- }
+ continue;
+ }
- /*
- #i1886#
- I believe that when a list is registered onto a winword
- style which is an outline numbering style (i.e.
- nOutlineLevel is set) that the style of numbering is for
- the level is indexed by the *list* level that was
- registered on that style, and not the outlinenumbering
- level, which is probably a logical sequencing, and not a
- physical mapping into the list style reged on that outline
- style.
- */
- sal_uInt8 nFromLevel = rSI.nListLevel;
- sal_uInt8 nToLevel = rSI.nOutlineLevel;
- const SwNumFmt& rRule=rSI.pOutlineNumrule->Get(nFromLevel);
- aOutlineRule.Set(nToLevel, rRule);
- ((SwTxtFmtColl*)rSI.pFmt)->AssignToListLevelOfOutlineStyle(nToLevel);
- // If there are more styles on this level ignore them
- nFlagsStyleOutlLevel |= nAktFlags;
+#if OSL_DEBUG_LEVEL > 1
+ OSL_ENSURE(pStyleInf->mnWW8OutlineLevel == pStyleInf->nListLevel,
+ "WW8 import - <SwWW8ImplReader::SetOutlineStyles()> - it is not "
+ "expected that WW8 Built-In Heading styles have different "
+ "outline level and list level");
+#endif
+ const SwNumFmt& rRule
+ = pChosenWW8ListStyle->Get(pStyleInf->mnWW8OutlineLevel);
+ aOutlineRule.Set(pStyleInf->mnWW8OutlineLevel, rRule);
+ bAppliedChangedOutlineStyle = true;
+ // in case that there are more styles on this level ignore them
+ nOutlineStyleListLevelWithAssignment
+ |= nOutlineStyleListLevelOfWW8BuiltInHeadingStyle;
+
+ SwTxtFmtColl* pTxtFmtColl = static_cast<SwTxtFmtColl*>(pStyleInf->pFmt);
+ if (pStyleInf->GetOutlineNumrule() != pChosenWW8ListStyle)
+ {
+ // WW8 Built-In Heading Style does not apply the chosen one.
+ // --> delete assignment to OutlineStyle, but keep its current
+ // outline level
+ pTxtFmtColl->DeleteAssignmentToListLevelOfOutlineStyle(false);
+ // Apply existing WW8 list style a normal list style at the
+ // Paragraph Style
+ if (pStyleInf->GetOutlineNumrule() != NULL)
+ {
+ pTxtFmtColl->SetFmtAttr(
+ SwNumRuleItem(pStyleInf->GetOutlineNumrule()->GetName()));
}
}
+ else
+ {
+ pTxtFmtColl->AssignToListLevelOfOutlineStyle(
+ pStyleInf->mnWW8OutlineLevel);
+ }
}
- if (nOldFlags != nFlagsStyleOutlLevel)
- rDoc.SetOutlineNumRule(aOutlineRule);
- // #i53044,i53213#
- if ( mpChosenOutlineNumRule == &aOutlineRule )
+
+ if (bAppliedChangedOutlineStyle)
{
- mpChosenOutlineNumRule = rDoc.GetOutlineNumRule();
+ rDoc.SetOutlineNumRule(aOutlineRule);
}
}
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index a9558a7..372bd9a 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -236,7 +236,15 @@ public:
sal_uInt16 nFollow;
sal_uInt16 nLFOIndex;
sal_uInt8 nListLevel;
- sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
+
+ // WW8 outline level is zero-based:
+ // 0: outline level 1
+ // 1: outline level 2
+ // ...
+ // 8: outline level 9
+ // 9: body text
+ sal_uInt8 mnWW8OutlineLevel;
+
sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
SvxLRSpaceItem maWordLR;
@@ -268,7 +276,7 @@ public:
nFollow( 0 ),
nLFOIndex( USHRT_MAX ),
nListLevel(WW8ListManager::nMaxLevel),
- nOutlineLevel( MAXLEVEL ),
+ mnWW8OutlineLevel( MAXLEVEL ),
n81Flags( 0 ),
n81BiDiFlags(0),
maWordLR( RES_LR_SPACE ),
@@ -294,25 +302,60 @@ public:
sWWStyleName = rName;
nWWStyleId = nId;
}
- sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
const OUString& GetOrgWWName() const
{
return sWWStyleName;
}
- bool IsOutline() const
+
+ bool HasWW8OutlineLevel() const
{
- return (pFmt && (MAXLEVEL > nOutlineLevel));
+ return (pFmt != NULL && (MAXLEVEL > mnWW8OutlineLevel));
}
+
bool IsOutlineNumbered() const
{
- return pOutlineNumrule && IsOutline();
+ return pOutlineNumrule && HasWW8OutlineLevel();
}
+
const SwNumRule* GetOutlineNumrule() const
{
return pOutlineNumrule;
}
rtl_TextEncoding GetCharSet() const;
rtl_TextEncoding GetCJKCharSet() const;
+
+ sal_uInt16 GetWWStyleId() const
+ {
+ return nWWStyleId;
+ }
+
+ bool IsWW8BuiltInHeadingStyle() const
+ {
+ return GetWWStyleId() >= 1 && GetWWStyleId() <= 9;
+ }
+
+ bool IsWW8BuiltInDefaultStyle() const
+ {
+ return GetWWStyleId() == 0;
+ }
+
+ static sal_uInt8
+ WW8OutlineLevelToOutlinelevel(const sal_uInt8 nWW8OutlineLevel)
+ {
+ if (nWW8OutlineLevel < MAXLEVEL)
+ {
+ if (nWW8OutlineLevel == 9)
+ {
+ return 0; // no outline level --> body text
+ }
+ else
+ {
+ return nWW8OutlineLevel + 1; // outline level 1..9
+ }
+ }
+
+ return 0;
+ }
};
// Stack
@@ -1158,14 +1201,6 @@ private:
std::stack<rtl_TextEncoding> maFontSrcCharSets;
std::stack<rtl_TextEncoding> maFontSrcCJKCharSets;
- /*
- Winword numbering gets imported as SwNumRules, there is a problem that
- winword can have multiple outline numberings, only one gets chosen as
- the writer outline numbering rule. The one that gets chosen is set here
- as mpChosenOutlineNumRule
- */
- SwNumRule *mpChosenOutlineNumRule;
-
SwMSConvertControls *pFormImpl; // Control-Implementierung
SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
@@ -1616,7 +1651,8 @@ private:
// Ver8-Listen
void RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, sal_uInt8 nActLevel,
- bool bSetAttr = true);
+ const bool bSetAttr = true);
+
void RegisterNumFmtOnStyle(sal_uInt16 nStyle);
void SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
sal_uInt8 nActLevel);
@@ -1657,7 +1693,7 @@ private:
SwTwips MoveOutsideFly(SwFrmFmt *pFlyFmt, const SwPosition &rPos,
bool bTableJoin = true);
- void SetOutLineStyles();
+ void SetOutlineStyles();
bool SetSpacing(SwPaM &rMyPam, int nSpace, bool bIsUpper);
bool SetUpperSpacing(SwPaM &pMyPam, int nSpace);
@@ -1826,7 +1862,6 @@ public: // eigentlich private, geht aber leider nur public
eF_ResT Read_F_NoteReference( WW8FieldDesc* pF, OUString& rStr );
eF_ResT Read_F_Tox( WW8FieldDesc* pF, OUString& rStr );
- bool AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase);
eF_ResT Read_F_Symbol( WW8FieldDesc*, OUString& rStr );
eF_ResT Read_F_Embedd( WW8FieldDesc*, OUString& rStr );
eF_ResT Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 758c35b..68da537 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3745,7 +3745,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty
rSI.eCJKFontSrcCharSet = pj->eCJKFontSrcCharSet;
rSI.n81Flags = pj->n81Flags;
rSI.n81BiDiFlags = pj->n81BiDiFlags;
- rSI.nOutlineLevel = pj->nOutlineLevel;
+ rSI.mnWW8OutlineLevel = pj->mnWW8OutlineLevel;
rSI.bParaAutoBefore = pj->bParaAutoBefore;
rSI.bParaAutoAfter = pj->bParaAutoAfter;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 77f01c3..c55eeea 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1631,19 +1631,21 @@ bool SwWW8ImplReader::SetTxtFmtCollAndListLevel(const SwPaM& rRg,
bRes = rDoc.SetTxtFmtColl(rRg, (SwTxtFmtColl*)rStyleInfo.pFmt);
SwTxtNode* pTxtNode = pPaM->GetNode().GetTxtNode();
OSL_ENSURE( pTxtNode, "No Text-Node at PaM-Position" );
- // make code robust
if ( !pTxtNode )
{
+ // make code robust
return bRes;
}
- SwNumRule * pNumRule = pTxtNode->GetNumRule(); // #i27610#
+ const SwNumRule * pNumRule = pTxtNode->GetNumRule(); // #i27610#
if( !IsInvalidOrToBeMergedTabCell() &&
! (pNumRule && pNumRule->IsOutlineRule()) ) // #i27610#
+ {
pTxtNode->ResetAttr( RES_PARATR_NUMRULE );
+ }
- if( !rStyleInfo.pOutlineNumrule )
+ if (rStyleInfo.GetOutlineNumrule() == NULL)
{
if (
(USHRT_MAX > rStyleInfo.nLFOIndex) &&
@@ -1654,15 +1656,6 @@ bool SwWW8ImplReader::SetTxtFmtCollAndListLevel(const SwPaM& rRg,
rStyleInfo.nListLevel, false);
}
}
- else
- {
- // Use outline level set at the style info <rStyleInfo> instead of
- // the outline level at the text format, because the WW8 document
- // could contain more than one outline numbering rule and the one
- // of the text format isn't the one, which a chosen as the Writer
- // outline rule.
- pTxtNode->SetAttrListLevel( rStyleInfo.nOutlineLevel );
- }
}
return bRes;
}
@@ -1756,8 +1749,8 @@ void SwWW8ImplReader::RegisterNumFmtOnStyle(sal_uInt16 nStyle)
// Phase 2: aktualisieren der StyleDef nach einlesen aller Listen
SwNumRule* pNmRule = 0;
- sal_uInt16 nLFO = rStyleInf.nLFOIndex;
- sal_uInt8 nLevel = rStyleInf.nListLevel;
+ const sal_uInt16 nLFO = rStyleInf.nLFOIndex;
+ const sal_uInt8 nLevel = rStyleInf.nListLevel;
if (
(USHRT_MAX > nLFO) &&
(WW8ListManager::nMaxLevel > nLevel)
@@ -1767,13 +1760,19 @@ void SwWW8ImplReader::RegisterNumFmtOnStyle(sal_uInt16 nStyle)
pNmRule = pLstManager->GetNumRuleForActivation(nLFO, nLevel,
aParaSprms);
- if (pNmRule)
+ if (pNmRule != NULL)
{
- if( MAXLEVEL > rStyleInf.nOutlineLevel )
+ if (rStyleInf.IsWW8BuiltInHeadingStyle()
+ && rStyleInf.HasWW8OutlineLevel())
+ {
rStyleInf.pOutlineNumrule = pNmRule;
- rStyleInf.pFmt->SetFmtAttr(
- SwNumRuleItem( pNmRule->GetName() ) );
- rStyleInf.bHasStyNumRule = true;
+ }
+ else
+ {
+ rStyleInf.pFmt->SetFmtAttr(
+ SwNumRuleItem(pNmRule->GetName()));
+ rStyleInf.bHasStyNumRule = true;
+ }
}
}
@@ -1783,7 +1782,8 @@ void SwWW8ImplReader::RegisterNumFmtOnStyle(sal_uInt16 nStyle)
}
void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO,
- sal_uInt8 nActLevel, bool bSetAttr)
+ sal_uInt8 nActLevel,
+ const bool bSetAttr)
{
// beachte: die Methode haengt die NumRule an den Text Node, falls
// bSetAttr (dann muessen natuerlich vorher die Listen gelesen sein)
@@ -1802,7 +1802,7 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO,
pLstManager->GetNumRuleForActivation( nActLFO, nActLevel,
aParaSprms, pTxtNd) : 0;
- if (pRule || !bSetAttr)
+ if (pRule != NULL || !bSetAttr)
{
//#i24136# old is the same as new, and its the outline numbering,
//then we don't set the numrule again, and we just take the num node
@@ -1814,9 +1814,7 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO,
is the one that was chosen to be the outline numbering then all
is unchanged
*/
- // correct condition according to the above given comment.
- if ( pTxtNd->GetNumRule() == rDoc.GetOutlineNumRule() &&
- pRule == mpChosenOutlineNumRule )
+ if (pTxtNd->GetNumRule() == rDoc.GetOutlineNumRule())
{
bUnchangedOutlineNumbering = true;
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index d9ca4f2..a2e1eb9 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2666,38 +2666,6 @@ static void lcl_toxMatchACSwitch( SwWW8ImplReader& /*rReader*/,
}
}
-//For all outline styles that are not in the outline numbering add them here as
-//custom extra styles
-bool SwWW8ImplReader::AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase)
-{
- bool bExtras = false;
- //This is the case if the winword outline numbering is set while the
- //writer one is not
- for (sal_uInt16 nI = 0; nI < vColl.size(); ++nI)
- {
- SwWW8StyInf& rSI = vColl[nI];
- if (rSI.IsOutline())
- {
- const SwTxtFmtColl *pFmt = (const SwTxtFmtColl*)(rSI.pFmt);
- sal_uInt16 nStyleLevel = rSI.nOutlineLevel;
- sal_uInt16 nMaxLevel = rBase.GetLevel();
- if (
- nStyleLevel != (pFmt->GetAttrOutlineLevel()-1) &&
- nStyleLevel < nMaxLevel
- )
- {
- OUString sStyles(rBase.GetStyleNames(rSI.nOutlineLevel));
- if ( !sStyles.isEmpty())
- sStyles += OUString(TOX_STYLE_DELIMITER);
- sStyles += pFmt->GetName();
- rBase.SetStyleNames(sStyles, rSI.nOutlineLevel);
- bExtras = true;
- }
- }
- }
- return bExtras;
-}
-
static void EnsureMaxLevelForTemplates(SwTOXBase& rBase)
{
//If the TOC contains Template entries at levels > the evaluation level
@@ -3180,9 +3148,6 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
sal_uInt16 eEffectivelyFrom = eCreateFrom ? eCreateFrom : nsSwTOXElement::TOX_OUTLINELEVEL;
if (eEffectivelyFrom & nsSwTOXElement::TOX_OUTLINELEVEL)
{
- if (AddExtraOutlinesAsExtraStyles(*pBase))
- eCreateFrom |= (nsSwTOXElement::TOX_TEMPLATE | nsSwTOXElement::TOX_OUTLINELEVEL);
-
// #i19683# Insert a text token " " between the number and entry token.
// In an ideal world we could handle the tab stop between the number and
// the entry correctly, but I currently have no clue how to obtain
@@ -3193,7 +3158,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
const SwWW8StyInf& rSI = vColl[nI];
if (rSI.IsOutlineNumbered())
{
- sal_uInt16 nStyleLevel = rSI.nOutlineLevel;
+ sal_uInt16 nStyleLevel = rSI.mnWW8OutlineLevel;
const SwNumFmt& rFmt = rSI.GetOutlineNumrule()->Get( nStyleLevel );
if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() )
{
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 1ee747b..a73df03 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -270,7 +270,7 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
{
if (vColl[nI].bValid && vColl[nI].pFmt &&
- vColl[nI].GetWWStyleId() == 0)
+ vColl[nI].IsWW8BuiltInDefaultStyle())
{
nCharWidth = ItemGet<SvxFontHeightItem>(*(vColl[nI].pFmt),
RES_CHRATR_CJK_FONTSIZE).GetHeight();
@@ -2698,16 +2698,29 @@ void SwWW8ImplReader::Read_PicLoc(sal_uInt16 , const sal_uInt8* pData, short nLe
void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLen )
{
- if (pAktColl && (0 < nLen))
+ if (nLen < 0)
{
- if (SwWW8StyInf* pSI = GetStyle(nAktColl))
+ pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_PARATR_OUTLINELEVEL);
+ return;
+ }
+
+ if (pAktColl != NULL)
+ {
+ SwWW8StyInf* pSI = GetStyle(nAktColl);
+ if (pSI != NULL)
{
- pSI->nOutlineLevel = static_cast< sal_uInt8 >(
- ( (1 <= pSI->GetWWStyleId()) && (9 >= pSI->GetWWStyleId()) )
- ? pSI->GetWWStyleId()-1
- : (pData ? *pData : 0) );
+ pSI->mnWW8OutlineLevel =
+ static_cast< sal_uInt8 >( ( pData ? *pData : 0 ) );
+ NewAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, SwWW8StyInf::WW8OutlineLevelToOutlinelevel( pSI->mnWW8OutlineLevel ) ) );
}
}
+ else if (pPaM != NULL)
+ {
+ const sal_uInt8 nOutlineLevel
+ = SwWW8StyInf::WW8OutlineLevelToOutlinelevel(
+ static_cast<sal_uInt8>((pData ? *pData : 0)));
+ NewAttr(SfxUInt16Item(RES_PARATR_OUTLINELEVEL, nOutlineLevel));
+ }
}
void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen )
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index ff47693..5098659 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -367,7 +367,7 @@ sal_Int32 ReadThroughComponent(
}
// #i44177#
-static void lcl_AdjustOutlineStylesForOOo( SwDoc& _rDoc )
+static void lcl_AdjustOutlineStylesForOOo(SwDoc& _rDoc)
{
// array containing the names of the default outline styles ('Heading 1',
// 'Heading 2', ..., 'Heading 10')
@@ -445,7 +445,7 @@ static void lcl_AdjustOutlineStylesForOOo( SwDoc& _rDoc )
}
}
-static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SwDoc& _rDoc )
+static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc)
{
if ( _rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) )
More information about the Libreoffice-commits
mailing list