summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 10:38:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 20:19:15 +0200
commitc0a4af22ed3cac188274fe51cbf3bcfe47d6acf8 (patch)
treed47c3167f7357e932a77c678a883d95638afbcdc /sw
parent4209d94b46cdd96898c02344b11700369ae88784 (diff)
loplugin:flatten in sw/filter/xml
Change-Id: If018f8b03816d8110bd3ba9eec3f26373e6c5a6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99803 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx114
-rw-r--r--sw/source/filter/xml/swxml.cxx68
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx74
-rw-r--r--sw/source/filter/xml/xmlfmte.cxx56
-rw-r--r--sw/source/filter/xml/xmlitemi.cxx68
-rw-r--r--sw/source/filter/xml/xmltble.cxx104
-rw-r--r--sw/source/filter/xml/xmltbli.cxx52
-rw-r--r--sw/source/filter/xml/xmltexte.cxx20
-rw-r--r--sw/source/filter/xml/xmltexti.cxx98
9 files changed, 327 insertions, 327 deletions
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 481b9760ffed..2dc47282f00c 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -420,21 +420,21 @@ void XMLRedlineImportHelper::Add(
// ad 3)
auto itPair = m_aRedlineMap.emplace(rId, pInfo);
- if (!itPair.second)
- {
- // 3b) we already have a redline with this name: hierarchical redlines
- // insert pInfo as last element in the chain.
- // (hierarchy sanity checking happens on inserting into the document)
-
- // find last element
- RedlineInfo* pInfoChain;
- for( pInfoChain = itPair.first->second;
- nullptr != pInfoChain->pNextRedline;
- pInfoChain = pInfoChain->pNextRedline) ; // empty loop
-
- // insert as last element
- pInfoChain->pNextRedline = pInfo;
- }
+ if (itPair.second)
+ return;
+
+ // 3b) we already have a redline with this name: hierarchical redlines
+ // insert pInfo as last element in the chain.
+ // (hierarchy sanity checking happens on inserting into the document)
+
+ // find last element
+ RedlineInfo* pInfoChain;
+ for( pInfoChain = itPair.first->second;
+ nullptr != pInfoChain->pNextRedline;
+ pInfoChain = pInfoChain->pNextRedline) ; // empty loop
+
+ // insert as last element
+ pInfoChain->pNextRedline = pInfo;
}
Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection(
@@ -494,43 +494,43 @@ void XMLRedlineImportHelper::SetCursor(
bool bIsOutsideOfParagraph)
{
RedlineMapType::iterator aFind = m_aRedlineMap.find(rId);
- if (m_aRedlineMap.end() != aFind)
+ if (m_aRedlineMap.end() == aFind)
+ return;
+
+ // RedlineInfo found; now set Cursor
+ RedlineInfo* pInfo = aFind->second;
+ if (bIsOutsideOfParagraph)
{
- // RedlineInfo found; now set Cursor
- RedlineInfo* pInfo = aFind->second;
- if (bIsOutsideOfParagraph)
+ // outside of paragraph: remember SwNodeIndex
+ if (bStart)
{
- // outside of paragraph: remember SwNodeIndex
- if (bStart)
- {
- pInfo->aAnchorStart.SetAsNodeIndex(rRange);
- }
- else
- {
- pInfo->aAnchorEnd.SetAsNodeIndex(rRange);
- }
-
- // also remember that we expect an adjustment for this redline
- pInfo->bNeedsAdjustment = true;
+ pInfo->aAnchorStart.SetAsNodeIndex(rRange);
}
else
{
- // inside of a paragraph: use regular XTextRanges (bookmarks)
- if (bStart)
- pInfo->aAnchorStart.Set(rRange);
- else
- pInfo->aAnchorEnd.Set(rRange);
+ pInfo->aAnchorEnd.SetAsNodeIndex(rRange);
}
- // if this Cursor was the last missing info, we insert the
- // node into the document
- // then we can remove the entry from the map and destroy the object
- if (IsReady(pInfo))
- {
- InsertIntoDocument(pInfo);
- m_aRedlineMap.erase(rId);
- delete pInfo;
- }
+ // also remember that we expect an adjustment for this redline
+ pInfo->bNeedsAdjustment = true;
+ }
+ else
+ {
+ // inside of a paragraph: use regular XTextRanges (bookmarks)
+ if (bStart)
+ pInfo->aAnchorStart.Set(rRange);
+ else
+ pInfo->aAnchorEnd.Set(rRange);
+ }
+
+ // if this Cursor was the last missing info, we insert the
+ // node into the document
+ // then we can remove the entry from the map and destroy the object
+ if (IsReady(pInfo))
+ {
+ InsertIntoDocument(pInfo);
+ m_aRedlineMap.erase(rId);
+ delete pInfo;
}
// else: unknown Id -> ignore
}
@@ -545,20 +545,20 @@ void XMLRedlineImportHelper::AdjustStartNodeCursor(
// necessary that the target node already exists.
RedlineMapType::iterator aFind = m_aRedlineMap.find(rId);
- if (m_aRedlineMap.end() != aFind)
- {
- // RedlineInfo found; now set Cursor
- RedlineInfo* pInfo = aFind->second;
+ if (m_aRedlineMap.end() == aFind)
+ return;
- pInfo->bNeedsAdjustment = false;
+ // RedlineInfo found; now set Cursor
+ RedlineInfo* pInfo = aFind->second;
- // if now ready, insert into document
- if( IsReady(pInfo) )
- {
- InsertIntoDocument(pInfo);
- m_aRedlineMap.erase(rId);
- delete pInfo;
- }
+ pInfo->bNeedsAdjustment = false;
+
+ // if now ready, insert into document
+ if( IsReady(pInfo) )
+ {
+ InsertIntoDocument(pInfo);
+ m_aRedlineMap.erase(rId);
+ delete pInfo;
}
// else: can't find redline -> ignore
}
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index d36e206e167f..dd8078fd4b50 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -417,42 +417,42 @@ static void lcl_AdjustOutlineStylesForOOo(SwDoc& _rDoc)
static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc)
{
- if ( _rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
- _rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) )
- {
- const SdrPage& rSdrPage( *(_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );
+ if ( !(_rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
+ _rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) )
+ return;
+
+ const SdrPage& rSdrPage( *(_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );
- // iterate recursive with group objects over all shapes on the draw page
- SdrObjListIter aIter( &rSdrPage );
- while( aIter.IsMore() )
+ // iterate recursive with group objects over all shapes on the draw page
+ SdrObjListIter aIter( &rSdrPage );
+ while( aIter.IsMore() )
+ {
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( aIter.Next() );
+ if( pOle2Obj )
{
- SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( aIter.Next() );
- if( pOle2Obj )
- {
- // found an ole2 shape
- SdrObjList* pObjList = pOle2Obj->getParentSdrObjListFromSdrObject();
-
- // get its graphic
- Graphic aGraphic;
- pOle2Obj->Connect();
- const Graphic* pGraphic = pOle2Obj->GetGraphic();
- if( pGraphic )
- aGraphic = *pGraphic;
- pOle2Obj->Disconnect();
-
- // create new graphic shape with the ole graphic and shape size
- SdrGrafObj* pGraphicObj = new SdrGrafObj(
- pOle2Obj->getSdrModelFromSdrObject(),
- aGraphic,
- pOle2Obj->GetCurrentBoundRect());
-
- // apply layer of ole2 shape at graphic shape
- pGraphicObj->SetLayer( pOle2Obj->GetLayer() );
-
- // replace ole2 shape with the new graphic object and delete the ol2 shape
- SdrObject* pReplaced = pObjList->ReplaceObject( pGraphicObj, pOle2Obj->GetOrdNum() );
- SdrObject::Free( pReplaced );
- }
+ // found an ole2 shape
+ SdrObjList* pObjList = pOle2Obj->getParentSdrObjListFromSdrObject();
+
+ // get its graphic
+ Graphic aGraphic;
+ pOle2Obj->Connect();
+ const Graphic* pGraphic = pOle2Obj->GetGraphic();
+ if( pGraphic )
+ aGraphic = *pGraphic;
+ pOle2Obj->Disconnect();
+
+ // create new graphic shape with the ole graphic and shape size
+ SdrGrafObj* pGraphicObj = new SdrGrafObj(
+ pOle2Obj->getSdrModelFromSdrObject(),
+ aGraphic,
+ pOle2Obj->GetCurrentBoundRect());
+
+ // apply layer of ole2 shape at graphic shape
+ pGraphicObj->SetLayer( pOle2Obj->GetLayer() );
+
+ // replace ole2 shape with the new graphic object and delete the ol2 shape
+ SdrObject* pReplaced = pObjList->ReplaceObject( pGraphicObj, pOle2Obj->GetOrdNum() );
+ SdrObject::Free( pReplaced );
}
}
}
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 8bf022141423..75af22b8e3f8 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -156,44 +156,44 @@ SwXMLConditionParser_Impl::SwXMLConditionParser_Impl( const OUString& rInp ) :
bOK &= nPos == nLength;
- if( bOK )
+ if( !bOK )
+ return;
+
+ if( IsXMLToken( sFunc, XML_ENDNOTE ) && !bHasSub )
+ nCondition = Master_CollCondition::PARA_IN_ENDNOTE;
+ else if( IsXMLToken( sFunc, XML_FOOTER ) && !bHasSub )
+ nCondition = Master_CollCondition::PARA_IN_FOOTER;
+ else if( IsXMLToken( sFunc, XML_FOOTNOTE ) && !bHasSub )
+ nCondition = Master_CollCondition::PARA_IN_FOOTNOTE;
+ else if( IsXMLToken( sFunc, XML_HEADER ) && !bHasSub )
+ nCondition = Master_CollCondition::PARA_IN_HEADER;
+ else if( IsXMLToken( sFunc, XML_LIST_LEVEL) &&
+ nSub >=1 && nSub <= MAXLEVEL )
{
- if( IsXMLToken( sFunc, XML_ENDNOTE ) && !bHasSub )
- nCondition = Master_CollCondition::PARA_IN_ENDNOTE;
- else if( IsXMLToken( sFunc, XML_FOOTER ) && !bHasSub )
- nCondition = Master_CollCondition::PARA_IN_FOOTER;
- else if( IsXMLToken( sFunc, XML_FOOTNOTE ) && !bHasSub )
- nCondition = Master_CollCondition::PARA_IN_FOOTNOTE;
- else if( IsXMLToken( sFunc, XML_HEADER ) && !bHasSub )
- nCondition = Master_CollCondition::PARA_IN_HEADER;
- else if( IsXMLToken( sFunc, XML_LIST_LEVEL) &&
- nSub >=1 && nSub <= MAXLEVEL )
- {
- nCondition = Master_CollCondition::PARA_IN_LIST;
- nSubCondition = nSub-1;
- }
- else if( IsXMLToken( sFunc, XML_OUTLINE_LEVEL) &&
- nSub >=1 && nSub <= MAXLEVEL )
- {
- nCondition = Master_CollCondition::PARA_IN_OUTLINE;
- nSubCondition = nSub-1;
- }
- else if( IsXMLToken( sFunc, XML_SECTION ) && !bHasSub )
- {
- nCondition = Master_CollCondition::PARA_IN_SECTION;
- }
- else if( IsXMLToken( sFunc, XML_TABLE ) && !bHasSub )
- {
- nCondition = Master_CollCondition::PARA_IN_TABLEBODY;
- }
- else if( IsXMLToken( sFunc, XML_TABLE_HEADER ) && !bHasSub )
- {
- nCondition = Master_CollCondition::PARA_IN_TABLEHEAD;
- }
- else if( IsXMLToken( sFunc, XML_TEXT_BOX ) && !bHasSub )
- {
- nCondition = Master_CollCondition::PARA_IN_FRAME;
- }
+ nCondition = Master_CollCondition::PARA_IN_LIST;
+ nSubCondition = nSub-1;
+ }
+ else if( IsXMLToken( sFunc, XML_OUTLINE_LEVEL) &&
+ nSub >=1 && nSub <= MAXLEVEL )
+ {
+ nCondition = Master_CollCondition::PARA_IN_OUTLINE;
+ nSubCondition = nSub-1;
+ }
+ else if( IsXMLToken( sFunc, XML_SECTION ) && !bHasSub )
+ {
+ nCondition = Master_CollCondition::PARA_IN_SECTION;
+ }
+ else if( IsXMLToken( sFunc, XML_TABLE ) && !bHasSub )
+ {
+ nCondition = Master_CollCondition::PARA_IN_TABLEBODY;
+ }
+ else if( IsXMLToken( sFunc, XML_TABLE_HEADER ) && !bHasSub )
+ {
+ nCondition = Master_CollCondition::PARA_IN_TABLEHEAD;
+ }
+ else if( IsXMLToken( sFunc, XML_TEXT_BOX ) && !bHasSub )
+ {
+ nCondition = Master_CollCondition::PARA_IN_FRAME;
}
}
diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx
index eb38216546d5..ff9b22ab3472 100644
--- a/sw/source/filter/xml/xmlfmte.cxx
+++ b/sw/source/filter/xml/xmlfmte.cxx
@@ -295,41 +295,41 @@ void SwXMLAutoStylePoolP::exportStyleAttributes(
{
SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap);
- if( XmlStyleFamily::TEXT_PARAGRAPH == nFamily )
+ if( XmlStyleFamily::TEXT_PARAGRAPH != nFamily )
+ return;
+
+ for( const auto& rProperty : rProperties )
{
- for( const auto& rProperty : rProperties )
+ if (rProperty.mnIndex != -1) // #i26762#
{
- if (rProperty.mnIndex != -1) // #i26762#
+ switch( rPropExp.getPropertySetMapper()->
+ GetEntryContextId( rProperty.mnIndex ) )
{
- switch( rPropExp.getPropertySetMapper()->
- GetEntryContextId( rProperty.mnIndex ) )
+ case CTF_NUMBERINGSTYLENAME:
{
- case CTF_NUMBERINGSTYLENAME:
- {
- OUString sStyleName;
- rProperty.maValue >>= sStyleName;
- // #i70748# - export also empty list styles
- if( !sStyleName.isEmpty() )
- {
- OUString sTmp = rExport.GetTextParagraphExport()->GetListAutoStylePool().Find( sStyleName );
- if( !sTmp.isEmpty() )
- sStyleName = sTmp;
- }
- GetExport().AddAttribute( XML_NAMESPACE_STYLE,
- sListStyleName,
- GetExport().EncodeStyleName( sStyleName ) );
- }
- break;
- case CTF_PAGEDESCNAME:
+ OUString sStyleName;
+ rProperty.maValue >>= sStyleName;
+ // #i70748# - export also empty list styles
+ if( !sStyleName.isEmpty() )
{
- OUString sStyleName;
- rProperty.maValue >>= sStyleName;
- GetExport().AddAttribute( XML_NAMESPACE_STYLE,
- sMasterPageName,
- GetExport().EncodeStyleName( sStyleName ) );
+ OUString sTmp = rExport.GetTextParagraphExport()->GetListAutoStylePool().Find( sStyleName );
+ if( !sTmp.isEmpty() )
+ sStyleName = sTmp;
}
- break;
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ sListStyleName,
+ GetExport().EncodeStyleName( sStyleName ) );
+ }
+ break;
+ case CTF_PAGEDESCNAME:
+ {
+ OUString sStyleName;
+ rProperty.maValue >>= sStyleName;
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ sMasterPageName,
+ GetExport().EncodeStyleName( sStyleName ) );
}
+ break;
}
}
}
diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx
index 9c1c8abb0885..c4e977e8bd11 100644
--- a/sw/source/filter/xml/xmlitemi.cxx
+++ b/sw/source/filter/xml/xmlitemi.cxx
@@ -180,47 +180,47 @@ bool SwXMLImportTableItemMapper_Impl::handleNoItem(
void SwXMLImportTableItemMapper_Impl::finished(
SfxItemSet & rSet, SvXMLUnitConverter const& rUnitConverter) const
{
- if (!m_FoMarginValue.isEmpty())
+ if (m_FoMarginValue.isEmpty())
+ return;
+
+ sal_uInt16 const Ids[4][2] = {
+ { RES_LR_SPACE, MID_L_MARGIN },
+ { RES_LR_SPACE, MID_R_MARGIN },
+ { RES_UL_SPACE, MID_UP_MARGIN },
+ { RES_UL_SPACE, MID_LO_MARGIN },
+ };
+ for (int i = 0; i < 4; ++i)
{
- sal_uInt16 const Ids[4][2] = {
- { RES_LR_SPACE, MID_L_MARGIN },
- { RES_LR_SPACE, MID_R_MARGIN },
- { RES_UL_SPACE, MID_UP_MARGIN },
- { RES_UL_SPACE, MID_LO_MARGIN },
- };
- for (int i = 0; i < 4; ++i)
+ if (m_bHaveMargin[i])
{
- if (m_bHaveMargin[i])
- {
- continue; // already read fo:margin-top etc.
- }
- // first get item from itemset
- SfxPoolItem const* pItem = nullptr;
- SfxItemState eState =
- rSet.GetItemState(Ids[i][0], true, &pItem);
+ continue; // already read fo:margin-top etc.
+ }
+ // first get item from itemset
+ SfxPoolItem const* pItem = nullptr;
+ SfxItemState eState =
+ rSet.GetItemState(Ids[i][0], true, &pItem);
- // if not set, try the pool
- if ((SfxItemState::SET != eState) && SfxItemPool::IsWhich(Ids[i][0]))
- {
- pItem = &rSet.GetPool()->GetDefaultItem(Ids[i][0]);
- }
+ // if not set, try the pool
+ if ((SfxItemState::SET != eState) && SfxItemPool::IsWhich(Ids[i][0]))
+ {
+ pItem = &rSet.GetPool()->GetDefaultItem(Ids[i][0]);
+ }
- // do we have an item?
- if (eState >= SfxItemState::DEFAULT && pItem)
- {
- std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
- bool const bPut = PutXMLValue(
- *pNewItem, m_FoMarginValue, Ids[i][1], rUnitConverter);
- if (bPut)
- {
- rSet.Put(std::move(pNewItem));
- }
- }
- else
+ // do we have an item?
+ if (eState >= SfxItemState::DEFAULT && pItem)
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
+ bool const bPut = PutXMLValue(
+ *pNewItem, m_FoMarginValue, Ids[i][1], rUnitConverter);
+ if (bPut)
{
- OSL_ENSURE(false, "could not get item");
+ rSet.Put(std::move(pNewItem));
}
}
+ else
+ {
+ OSL_ENSURE(false, "could not get item");
+ }
}
}
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 3febc00ae82e..00b0b79bae5b 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -1094,66 +1094,66 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd )
}
}
- if (oPrefix)
+ if (!oPrefix)
+ return;
+
+ const SwTable& rTable = rTableNd.GetTable();
+ const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
+ if (pTableFormat && !pTableFormat->GetName().isEmpty())
{
- const SwTable& rTable = rTableNd.GetTable();
- const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
- if (pTableFormat && !pTableFormat->GetName().isEmpty())
- {
- AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, pTableFormat->GetName());
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME,
- EncodeStyleName(pTableFormat->GetName()));
- }
+ AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, pTableFormat->GetName());
+ AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME,
+ EncodeStyleName(pTableFormat->GetName()));
+ }
- // table:template-name=
- if (!rTable.GetTableStyleName().isEmpty())
- {
- OUString sStyleName;
- SwStyleNameMapper::FillProgName(rTable.GetTableStyleName(), sStyleName, SwGetPoolIdFromName::TabStyle);
- AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sStyleName);
- }
+ // table:template-name=
+ if (!rTable.GetTableStyleName().isEmpty())
+ {
+ OUString sStyleName;
+ SwStyleNameMapper::FillProgName(rTable.GetTableStyleName(), sStyleName, SwGetPoolIdFromName::TabStyle);
+ AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sStyleName);
+ }
- SvXMLElementExport aElem(*this, *oPrefix, XML_TABLE, true, true);
+ SvXMLElementExport aElem(*this, *oPrefix, XML_TABLE, true, true);
- // export DDE source (if this is a DDE table)
- if ( dynamic_cast<const SwDDETable*>( &rTable) != nullptr )
+ // export DDE source (if this is a DDE table)
+ if ( dynamic_cast<const SwDDETable*>( &rTable) != nullptr )
+ {
+ // get DDE Field Type (contains the DDE connection)
+ const SwDDEFieldType* pDDEFieldType =
+ static_cast<const SwDDETable&>(rTable).GetDDEFieldType();
+
+ // connection name
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME,
+ pDDEFieldType->GetName() );
+
+ // DDE command
+ const OUString& sCmd = pDDEFieldType->GetCmd();
+ sal_Int32 nIdx{ 0 };
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
+ sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_ITEM,
+ sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_TOPIC,
+ sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
+
+ // auto update
+ if (pDDEFieldType->GetType() == SfxLinkUpdateMode::ALWAYS)
{
- // get DDE Field Type (contains the DDE connection)
- const SwDDEFieldType* pDDEFieldType =
- static_cast<const SwDDETable&>(rTable).GetDDEFieldType();
-
- // connection name
- AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME,
- pDDEFieldType->GetName() );
-
- // DDE command
- const OUString& sCmd = pDDEFieldType->GetCmd();
- sal_Int32 nIdx{ 0 };
- AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
- sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
- AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_ITEM,
- sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
- AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_TOPIC,
- sCmd.getToken(0, sfx2::cTokenSeparator, nIdx) );
-
- // auto update
- if (pDDEFieldType->GetType() == SfxLinkUpdateMode::ALWAYS)
- {
- AddAttribute( XML_NAMESPACE_OFFICE,
- XML_AUTOMATIC_UPDATE, XML_TRUE );
- }
-
- // DDE source element (always empty)
- SvXMLElementExport aSource(*this, XML_NAMESPACE_OFFICE,
- XML_DDE_SOURCE, true, false);
+ AddAttribute( XML_NAMESPACE_OFFICE,
+ XML_AUTOMATIC_UPDATE, XML_TRUE );
}
- SwXMLTableInfo_Impl aTableInfo(&rTable, *oPrefix);
- ExportTableLines( rTable.GetTabLines(), aTableInfo, rTable.GetRowsToRepeat() );
-
- for( SwTableLine *pLine : const_cast<SwTable &>(rTable).GetTabLines() )
- lcl_xmltble_ClearName_Line( pLine );
+ // DDE source element (always empty)
+ SvXMLElementExport aSource(*this, XML_NAMESPACE_OFFICE,
+ XML_DDE_SOURCE, true, false);
}
+
+ SwXMLTableInfo_Impl aTableInfo(&rTable, *oPrefix);
+ ExportTableLines( rTable.GetTabLines(), aTableInfo, rTable.GetRowsToRepeat() );
+
+ for( SwTableLine *pLine : const_cast<SwTable &>(rTable).GetTabLines() )
+ lcl_xmltble_ClearName_Line( pLine );
}
void SwXMLTextParagraphExport::exportTable(
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 543c0aa7d42b..d4928cdf7fd8 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1352,21 +1352,21 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
// take care of open redlines for tables
GetImport().GetTextImport()->RedlineAdjustStartNodeCursor();
}
- if( pXTable )
- {
- SwFrameFormat *const pTableFrameFormat = pXTable->GetFrameFormat();
- OSL_ENSURE( pTableFrameFormat, "table format missing" );
- SwTable *pTable = SwTable::FindTable( pTableFrameFormat );
- OSL_ENSURE( pTable, "table missing" );
- m_pTableNode = pTable->GetTableNode();
- OSL_ENSURE( m_pTableNode, "table node missing" );
+ if( !pXTable )
+ return;
- pTableFrameFormat->SetName( sTableName );
+ SwFrameFormat *const pTableFrameFormat = pXTable->GetFrameFormat();
+ OSL_ENSURE( pTableFrameFormat, "table format missing" );
+ SwTable *pTable = SwTable::FindTable( pTableFrameFormat );
+ OSL_ENSURE( pTable, "table missing" );
+ m_pTableNode = pTable->GetTableNode();
+ OSL_ENSURE( m_pTableNode, "table node missing" );
- SwTableLine *pLine1 = m_pTableNode->GetTable().GetTabLines()[0U];
- m_pBox1 = pLine1->GetTabBoxes()[0U];
- m_pSttNd1 = m_pBox1->GetSttNd();
- }
+ pTableFrameFormat->SetName( sTableName );
+
+ SwTableLine *pLine1 = m_pTableNode->GetTable().GetTabLines()[0U];
+ m_pBox1 = pLine1->GetTabBoxes()[0U];
+ m_pSttNd1 = m_pBox1->GetSttNd();
}
SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
@@ -1468,22 +1468,22 @@ void SwXMLTableContext::InsertColumn( sal_Int32 nWidth2, bool bRelWidth2,
else if( nWidth2 > MAX_WIDTH )
nWidth2 = MAX_WIDTH;
m_aColumnWidths.emplace_back(nWidth2, bRelWidth2 );
- if( (pDfltCellStyleName && !pDfltCellStyleName->isEmpty()) ||
- m_pColumnDefaultCellStyleNames )
- {
- if( !m_pColumnDefaultCellStyleNames )
- {
- m_pColumnDefaultCellStyleNames.reset(new std::vector<OUString>);
- sal_uLong nCount = m_aColumnWidths.size() - 1;
- while( nCount-- )
- m_pColumnDefaultCellStyleNames->push_back(OUString());
- }
+ if( !((pDfltCellStyleName && !pDfltCellStyleName->isEmpty()) ||
+ m_pColumnDefaultCellStyleNames) )
+ return;
- if(pDfltCellStyleName)
- m_pColumnDefaultCellStyleNames->push_back(*pDfltCellStyleName);
- else
+ if( !m_pColumnDefaultCellStyleNames )
+ {
+ m_pColumnDefaultCellStyleNames.reset(new std::vector<OUString>);
+ sal_uLong nCount = m_aColumnWidths.size() - 1;
+ while( nCount-- )
m_pColumnDefaultCellStyleNames->push_back(OUString());
}
+
+ if(pDfltCellStyleName)
+ m_pColumnDefaultCellStyleNames->push_back(*pDfltCellStyleName);
+ else
+ m_pColumnDefaultCellStyleNames->push_back(OUString());
}
sal_Int32 SwXMLTableContext::GetColumnWidth( sal_uInt32 nCol,
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index e7e5118e2f16..cfef654e59e6 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -132,19 +132,19 @@ static void lcl_addOutplaceProperties(
MapMode aMode( MapUnit::Map100thMM ); // the API expects this map mode for the embedded objects
Size aSize = rObj.GetSize( &aMode ); // get the size in the requested map mode
- if( aSize.Width() && aSize.Height() )
- {
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), Any(sal_Int32(0)) );
- pStates++;
+ if( !(aSize.Width() && aSize.Height()) )
+ return;
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), Any(sal_Int32(0)) );
- pStates++;
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), Any(sal_Int32(0)) );
+ pStates++;
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any(static_cast<sal_Int32>(aSize.Width())) );
- pStates++;
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), Any(sal_Int32(0)) );
+ pStates++;
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any(static_cast<sal_Int32>(aSize.Height())) );
- }
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any(static_cast<sal_Int32>(aSize.Width())) );
+ pStates++;
+
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any(static_cast<sal_Int32>(aSize.Height())) );
}
static void lcl_addFrameProperties(
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index 9f9995868809..8b5bcdc8f707 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -127,23 +127,23 @@ static void lcl_setObjectVisualArea( const uno::Reference< embed::XEmbeddedObjec
const Size& aVisSize,
const MapUnit& aUnit )
{
- if( xObj.is() && nAspect != embed::Aspects::MSOLE_ICON )
- {
- // convert the visual area to the objects units
- MapUnit aObjUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
- Size aObjVisSize = OutputDevice::LogicToLogic(aVisSize, MapMode(aUnit), MapMode(aObjUnit));
- awt::Size aSz;
- aSz.Width = aObjVisSize.Width();
- aSz.Height = aObjVisSize.Height();
+ if( !(xObj.is() && nAspect != embed::Aspects::MSOLE_ICON) )
+ return;
- try
- {
- xObj->setVisualAreaSize( nAspect, aSz );
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( "Couldn't set visual area of the object!" );
- }
+ // convert the visual area to the objects units
+ MapUnit aObjUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ Size aObjVisSize = OutputDevice::LogicToLogic(aVisSize, MapMode(aUnit), MapMode(aObjUnit));
+ awt::Size aSz;
+ aSz.Width = aObjVisSize.Width();
+ aSz.Height = aObjVisSize.Height();
+
+ try
+ {
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "Couldn't set visual area of the object!" );
}
}
@@ -925,41 +925,41 @@ void SwXMLTextImportHelper::endAppletOrPlugin(
SwOLEObj& rOLEObj = pOLENd->GetOLEObj();
uno::Reference < embed::XEmbeddedObject > xEmbObj( rOLEObj.GetOleRef() );
- if ( svt::EmbeddedObjectRef::TryRunningState( xEmbObj ) )
- {
- uno::Reference < beans::XPropertySet > xSet( xEmbObj->getComponent(), uno::UNO_QUERY );
- if ( xSet.is() )
- {
- const sal_Int32 nCount = rParamMap.size();
- uno::Sequence< beans::PropertyValue > aCommandSequence( nCount );
+ if ( !svt::EmbeddedObjectRef::TryRunningState( xEmbObj ) )
+ return;
- sal_Int32 nIndex=0;
- for (const auto& rParam : rParamMap )
- {
- aCommandSequence[nIndex].Name = rParam.first;
- aCommandSequence[nIndex].Handle = -1;
- aCommandSequence[nIndex].Value <<= rParam.second;
- aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
- ++nIndex;
- }
+ uno::Reference < beans::XPropertySet > xSet( xEmbObj->getComponent(), uno::UNO_QUERY );
+ if ( !xSet.is() )
+ return;
- // unfortunately the names of the properties are depending on the object
- OUString aParaName("AppletCommands");
- try
- {
- xSet->setPropertyValue( aParaName, makeAny( aCommandSequence ) );
- }
- catch ( uno::Exception& )
- {
- aParaName = "PluginCommands";
- try
- {
- xSet->setPropertyValue( aParaName, makeAny( aCommandSequence ) );
- }
- catch ( uno::Exception& )
- {
- }
- }
+ const sal_Int32 nCount = rParamMap.size();
+ uno::Sequence< beans::PropertyValue > aCommandSequence( nCount );
+
+ sal_Int32 nIndex=0;
+ for (const auto& rParam : rParamMap )
+ {
+ aCommandSequence[nIndex].Name = rParam.first;
+ aCommandSequence[nIndex].Handle = -1;
+ aCommandSequence[nIndex].Value <<= rParam.second;
+ aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
+ ++nIndex;
+ }
+
+ // unfortunately the names of the properties are depending on the object
+ OUString aParaName("AppletCommands");
+ try
+ {
+ xSet->setPropertyValue( aParaName, makeAny( aCommandSequence ) );
+ }
+ catch ( uno::Exception& )
+ {
+ aParaName = "PluginCommands";
+ try
+ {
+ xSet->setPropertyValue( aParaName, makeAny( aCommandSequence ) );
+ }
+ catch ( uno::Exception& )
+ {
}
}
}