[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/core/doc/DocumentContentOperationsManager.cxx | 26 +--- sw/source/core/doc/doccorr.cxx |2 - sw/source/filter/xml/XMLRedlineImportHelper.cxx |5 +-- xmloff/source/text/XMLChangedRegionImportContext.cxx| 11 -- xmloff/source/text/txtparai.cxx | 17 -- 5 files changed, 40 insertions(+), 21 deletions(-) New commits: commit e5b5d9c8d33b1dd87e5a50856ad02f21df59dc5b Author: Michael Stahl AuthorDate: Thu Jan 5 18:07:03 2023 +0100 Commit: Michael Stahl CommitDate: Thu Jan 5 18:26:15 2023 + tdf#152710 xmloff: ignore exception in XMLChangedRegionImportContext The xOldCursor must be restored in all cases. Also XMLParaContext triggers an exception which ends up aborting the import. Change-Id: I8f4785e0e9bde4c8c484954a4d66f3b82d6ca28c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145094 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx index 4d43a8de3027..fe00c4a058b9 100644 --- a/xmloff/source/text/XMLChangedRegionImportContext.cxx +++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx @@ -122,9 +122,14 @@ void XMLChangedRegionImportContext::endFastElement(sal_Int32 ) { // delete last paragraph // (one extra paragraph was inserted in the beginning) -rtl::Reference rHelper = -GetImport().GetTextImport(); -rHelper->DeleteParagraph(); +try +{ +GetImport().GetTextImport()->DeleteParagraph(); +} +catch (uno::Exception const&) +{ // cursor may be disposed - must reset to old cursor! +SAL_INFO("xmloff.text", "XMLChangedRegionImportContext: delete paragraph failed"); +} GetImport().GetTextImport()->SetCursor(xOldCursor); xOldCursor = nullptr; diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 9844e2628c89..5fffc202612a 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -1688,10 +1688,19 @@ void XMLParaContext::endFastElement(sal_Int32 ) { rtl::Reference < XMLTextImportHelper > xTxtImport( GetImport().GetTextImport()); -Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() ); -if( !xCrsrRange.is() ) -return; // Robust (defective file) -Reference < XTextRange > xEnd(xCrsrRange->getStart()); +Reference xEnd; +try +{ +Reference const xCrsrRange(xTxtImport->GetCursorAsRange()); +if (!xCrsrRange.is()) +return; // Robust (defective file) +xEnd = xCrsrRange->getStart(); +} +catch (uno::Exception const&) +{ +SAL_INFO("xmloff.text", "XMLParaContext: cursor disposed?"); +return; +} // if we have an id set for this paragraph, get a cursor for this // paragraph and register it with the given identifier commit 475e59d29b7a6cc7f058af8ff863b3bb1a2a84a5 Author: Michael Stahl AuthorDate: Thu Jan 5 13:17:17 2023 +0100 Commit: Michael Stahl CommitDate: Thu Jan 5 18:26:02 2023 + tdf#152710 sw: call and fix DeleteSection() instead Turns out there's a function to delete a complete nodes array section - and it has the same problem? Why does it move indexes only from startnode + 1? Let's try to fix it to be more consistent. Change-Id: Iedacc10e29c1646c4ccc85e53a479b0351f5cfcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145078 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 8f2318a0b1c4..4376278d7dc1 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2070,6 +2070,18 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, return bRet; } +static auto GetCorrPosition(SwPaM const& rPam) -> SwPosition +{ +// tdf#152710 target position must be on node that survives deletion +// so that PaMCorrAbs can invalidate SwUnoCursors properly +return rPam.GetPoint()->GetNode().IsContentNode() +? *rPam.GetPoint() +: rPam.GetMark()->GetNode().IsContentNode() +? *rPam.GetMark() +// this would be the result in SwNodes::RemoveNode() +: SwPosition(rPam.End()->GetNode(), SwNodeOffset(+1)); +} + /// Delete a full Section of the NodeArray. /// The passed Node is located somewhere in the designated Section. void DocumentContentOperationsManager::DeleteSection( SwNode *pNode ) @@ -2087,8 +2099,9 @@ void DocumentContentOperationsManager::DeleteSection( SwNode *pNode ) { // move all Cursor/StackCursor/UnoCursor out
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/filter/ww8/docxattributeoutput.cxx|5 +++-- xmloff/source/transform/ActionMapTypesOASIS.hxx |2 +- 2 files changed, 4 insertions(+), 3 deletions(-) New commits: commit f62d2de95c3553e0615d3485645bf5061b97d520 Author: Caolán McNamara AuthorDate: Wed Jul 7 17:33:06 2021 +0100 Commit: Caolán McNamara CommitDate: Wed Jul 7 22:11:59 2021 +0200 WaE: Wodr type 'ActionMapTypesOOo' violates the C++ ODR Change-Id: If0b83e62e6c9905b1ae391fbed7c43b379dce5db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118586 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/xmloff/source/transform/ActionMapTypesOASIS.hxx b/xmloff/source/transform/ActionMapTypesOASIS.hxx index 1be989b340df..eb9753ab4e9d 100644 --- a/xmloff/source/transform/ActionMapTypesOASIS.hxx +++ b/xmloff/source/transform/ActionMapTypesOASIS.hxx @@ -19,7 +19,7 @@ #pragma once -enum ActionMapTypesOOo +enum ActionMapTypesOasis { PROP_OASIS_GRAPHIC_ATTR_ACTIONS, PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS, commit ed2d309b5ccdaa1a58f37f70a00ad74452e163cd Author: Caolán McNamara AuthorDate: Wed Jul 7 17:12:50 2021 +0100 Commit: Caolán McNamara CommitDate: Wed Jul 7 22:11:44 2021 +0200 make code a little clearer to indicate that pAnchor isn't leaked Change-Id: I656a8c8506d7905ece3ff1b0547c82c42b234ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118585 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bbf4994a1d05..f5978957635c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6450,7 +6450,8 @@ void DocxAttributeOutput::WriteTextBox(uno::Reference xShape) SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(xShape); assert(pTextBox); const SwPosition* pAnchor = nullptr; -if (pTextBox->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE) //tdf135711 +const bool bFlyAtPage = pTextBox->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE; +if (bFlyAtPage) //tdf135711 { auto pNdIdx = pTextBox->GetContent().GetContentIdx(); if (pNdIdx) //Is that possible it is null? @@ -6465,7 +6466,7 @@ void DocxAttributeOutput::WriteTextBox(uno::Reference xShape) { ww8::Frame aFrame(*pTextBox, *pAnchor); m_rExport.SdrExporter().writeDMLTextFrame(, m_anchorId++, /*bTextBoxOnly=*/true); -if (pTextBox->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE) +if (bFlyAtPage) { delete pAnchor; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/filter/xml/xmlfmt.cxx |4 ++-- xmloff/source/draw/ximpstyl.cxx |2 +- xmloff/source/draw/ximpstyl.hxx |2 +- 3 files changed, 4 insertions(+), 4 deletions(-) New commits: commit af068c36c65f8ed482e774fcf5346704ae7a2717 Author: Noel Grandin AuthorDate: Thu Aug 20 21:37:56 2020 +0200 Commit: Noel Grandin CommitDate: Fri Aug 21 08:13:27 2020 +0200 use fastparser in SdXMLStylesContext Change-Id: Idd15d117d71e607691bec9911ff0cc194ca5ce01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101093 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 51058a1f36d1..6aee9df7f8ac 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -1076,7 +1076,7 @@ rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropert // Process all style and object info -void SdXMLStylesContext::EndElement() +void SdXMLStylesContext::endFastElement(sal_Int32 ) { if(mbIsAutoStyle) { diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx index 3885d405141b..d3922a8eb326 100644 --- a/xmloff/source/draw/ximpstyl.hxx +++ b/xmloff/source/draw/ximpstyl.hxx @@ -210,7 +210,7 @@ public: SdXMLImport& rImport, bool bIsAutoStyle); -virtual void EndElement() override; +virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override; void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const; commit 8d3ccf54fe47be0167505afb11159fd2e1fa1d9f Author: Noel Grandin AuthorDate: Thu Aug 20 21:34:54 2020 +0200 Commit: Noel Grandin CommitDate: Fri Aug 21 08:13:16 2020 +0200 use fastparser in SwXMLMasterStylesContext_Impl Change-Id: I420312d8f58a42999c7d6c3048c391ff1f44a039 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101092 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 559984a60ff2..5bd4debc2d27 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -993,7 +993,7 @@ public: SwXMLMasterStylesContext_Impl( SwXMLImport& rImport ); -virtual void EndElement() override; +virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; } @@ -1018,7 +1018,7 @@ bool SwXMLMasterStylesContext_Impl::InsertStyleFamily( XmlStyleFamily nFamily ) return bIns; } -void SwXMLMasterStylesContext_Impl::EndElement() +void SwXMLMasterStylesContext_Impl::endFastElement(sal_Int32 ) { FinishStyles( !GetSwImport().IsInsertMode() ); GetSwImport().FinishStyles(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/core/graphic/ndgrf.cxx |3 ++- xmloff/source/text/txtparae.cxx |8 +++- 2 files changed, 9 insertions(+), 2 deletions(-) New commits: commit 36aa3f4d6f9e9da7289ed760cfb1e87600cb6459 Author: Tomaž Vajngerl AuthorDate: Sun Feb 3 22:30:05 2019 +0100 Commit: Tomaž Vajngerl CommitDate: Mon Feb 4 10:25:04 2019 +0100 tdf#118879 don't embed base64 image data if we have an origin URL If an Graphic has an OriginURL it means it was created from an external source. We want to preserve this so we don't want to add the image base64 data - used in Flat ODF format. Change-Id: I2782ec53cf8dc78b0c360365d3eed3e5c54bf271 Reviewed-on: https://gerrit.libreoffice.org/67338 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 9a7776eec9e3..3b3b52b5f635 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -120,6 +120,7 @@ #include #include #include +#include using namespace ::std; using namespace ::com::sun::star; @@ -3181,7 +3182,12 @@ void XMLTextParagraphExport::_exportTextGraphic( if (xGraphic.is()) { SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, false, true ); -GetExport().AddEmbeddedXGraphicAsBase64(xGraphic); + +Graphic aGraphic(xGraphic); +if (aGraphic.getOriginURL().isEmpty()) // don't add the base64 if the origin URL is set (image is from an external URL) +{ +GetExport().AddEmbeddedXGraphicAsBase64(xGraphic); +} } } commit 6a36bedd0a418ce12543f797ab46f24ee57feb6c Author: Tomaž Vajngerl AuthorDate: Sun Feb 3 21:16:40 2019 +0100 Commit: Tomaž Vajngerl CommitDate: Mon Feb 4 10:24:58 2019 +0100 tdf#119661 remove the original URL when removing a graphic link Change-Id: I8c875202ba8af9cbcd7eb9ce0db78f97d56a07a8 Reviewed-on: https://gerrit.libreoffice.org/67337 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index e439cef7fb11..867e533533e3 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -593,7 +593,7 @@ void SwGrfNode::ReleaseLink() { if( refLink.is() ) { -const Graphic aLocalGraphic(maGrfObj.GetGraphic()); +Graphic aLocalGraphic(maGrfObj.GetGraphic()); const bool bHasOriginalData(aLocalGraphic.IsGfxLink()); { @@ -605,6 +605,7 @@ void SwGrfNode::ReleaseLink() getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); refLink.clear(); +aLocalGraphic.setOriginURL(""); // #i15508# added extra processing after getting rid of the link. Use whatever is // known from the formerly linked graphic to get to a state as close to a directly ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/core/undo/undobj.cxx |3 +-- xmloff/source/text/txtparae.cxx |4 2 files changed, 5 insertions(+), 2 deletions(-) New commits: commit 17d7f2971061a9e0b68da6d433835c64b946169a Author: Michael StahlDate: Fri Jan 26 14:56:37 2018 +0100 sw: remove misleading comment from SwUndoSaveContent::DelContentIndex() "Directories" weren't handled in the initial CVS import already. Change-Id: Ic96921d8e3e8aa5a5e65e07391236f0a7747c867 diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 449479da46e9..bb6e1c50af90 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -837,7 +837,6 @@ void SwUndoSaveContent::MovePtForward( SwPaM& rPam, bool bMvBkwrd ) // - Footnotes // - Flys // - Bookmarks -// - Directories // #i81002# - extending method // delete certain (not all) cross-reference bookmarks at text node of @@ -1210,7 +1209,7 @@ void SwUndoSaveSection::SaveSection( { SwPaM aPam( rRange.aStart, rRange.aEnd ); -// delete all footnotes, fly frames, bookmarks and indexes +// delete all footnotes, fly frames, bookmarks DelContentIndex( *aPam.GetMark(), *aPam.GetPoint() ); { // move certain indexes out of deleted range commit 55650f65de478bcee65fe1e1cf19f106e407f999 Author: Michael Stahl Date: Fri Jan 26 14:24:02 2018 +0100 xmloff: ODF export: don't write LO_EXT attribute unless ODF expended The loext namespace is not defined when exporting standard ODF versions, which triggers an assert() in SvXMLNamespaceMap. (regression from 4469b29faeb8dbf7793a5d81d9c5ddebacf3015f) Change-Id: Ic93fb0ea8fe092463d3fd18a0fbf4429d8652642 diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 656c33a6cbb2..c5baccfe79fc 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3141,7 +3141,11 @@ void XMLTextParagraphExport::_exportTextGraphic( const OString aExt( OUStringToOString( aSourceMimeType, RTL_TEXTENCODING_ASCII_US ) ); aSourceMimeType = comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension( aExt ); } + +if (GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012) +{ GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", aSourceMimeType); +} { SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/filter/xml/xmlimp.cxx | 24 sw/source/ui/utlui/poolfmt.src |1 + xmloff/source/core/xmlexp.cxx |2 +- 3 files changed, 26 insertions(+), 1 deletion(-) New commits: commit 157013219230f251346a5aa662c39d02f15420ec Author: Michael StahlDate: Fri Apr 21 11:41:21 2017 +0200 tdf#107211 sw: ODF import: add a horrible hack to import "Default" ... character style for hyperlinks and index-entry-templates. The problem is that the "Default" character style doesn't actually exist, it is just displayed in the UI so you can remove a character style that is set. So for the most part there is no need to store "Default" in ODF files, except that for hyperlinks the default isn't "Default" but "Internet Link"/"Visited Internet Link". Hence it was not really a good idea to rename "Default" to "Default Style", because when importing existing documents the text:style-name="Default" is not found, and for new documents text:style-name="Default_20_Style" is not found either because there is no style:style element that sets up the mapping between the encoded style-name and the unencoded display-style-name. Add some hack in SwXMLBodyContext_Impl::SwXMLBodyContext_Impl(), when all style:style elements have been read (so we don't override what's in the document) to create the mapping for "Default", "Default_20_Style" and whatever the translation of that is. (regression from 783d13a9276931e274a90b9b53de2c92dc8c055e) Change-Id: I8a80847571f194204c5df267cb48e826a82328b2 diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 1a6c33753775..225850bb13cb 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include "xmlimp.hxx" #include "xmltexti.hxx" #include @@ -133,6 +134,29 @@ SwXMLBodyContext_Impl::SwXMLBodyContext_Impl( SwXMLImport& rImport, const Reference< xml::sax::XAttributeList > & /*xAttrList*/ ) : SvXMLImportContext( rImport, nPrfx, rLName ) { +// tdf#107211: if at this point we don't have a defined char style "Default" +// or "Default Style", add a mapping for it as it is not written +// into the file since it's not really a style but "no style" +// (hence referencing it actually makes no sense except for hyperlinks +// which default to something other than "Default") +OUString const sDefault(SW_RES(STR_POOLCOLL_STANDARD)); +uno::Reference const& xStyles( +rImport.GetTextImport()->GetTextStyles()); +if (!xStyles->hasByName("Default")) +{ // this old name was used before LO 4.0 +rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default", sDefault); +} +if (!xStyles->hasByName("Default_20_Style")) +{ // this new name contains a space which is converted to _20_ on export +rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default_20_Style", sDefault); +} +bool isEncoded(false); +OUString const defaultEncoded( +rImport.GetMM100UnitConverter().encodeStyleName(sDefault, )); +if (isEncoded && !xStyles->hasByName(defaultEncoded)) +{ // new name may contain a space which is converted to _20_ on export +rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, defaultEncoded, sDefault); +} } SvXMLImportContext *SwXMLBodyContext_Impl::CreateChildContext( diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src index c6efa70a35d2..c0a876b64797 100644 --- a/sw/source/ui/utlui/poolfmt.src +++ b/sw/source/ui/utlui/poolfmt.src @@ -155,6 +155,7 @@ String STR_POOLFRM_LABEL // Template names +// tdf#107211 please don't change STANDARD, except back to "Default" String STR_POOLCOLL_STANDARD { Text [ en-US ] = "Default Style" ; commit 4e3d14deb74c57632db57663d2fc2ead9d8aa0f0 Author: Michael Stahl Date: Thu Apr 20 23:50:14 2017 +0200 xmloff: fix typo Change-Id: I0f354b37afa2492894c1d3ee6a83633c04e1c87a diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 6ca60f723a5d..fc4f740bc0be 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1191,7 +1191,7 @@ void SvXMLExport::ImplExportContent() CheckAttrList(); { -SvXMLElementExport aElemrnt( *this, XML_NAMESPACE_OFFICE, XML_BODY, +SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_BODY, true, true ); { XMLTokenEnum eClass = meClass; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/core/unocore/unochart.cxx |4 ++-- xmloff/source/core/nmspmap.cxx | 12 2 files changed, 10 insertions(+), 6 deletions(-) New commits: commit 4cc2fb2db34337880393d692d0e9ea8d6496fcbf Author: Caolán McNamara caol...@redhat.com Date: Thu Jun 4 20:30:21 2015 +0100 coverity#1302607 Logically dead code also coverity#1302606 Logically dead code Change-Id: I510f17e93f7caf5f1c35becdf6b7d626c0160b66 diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx index 6a97160..b355f03 100644 --- a/xmloff/source/core/nmspmap.cxx +++ b/xmloff/source/core/nmspmap.cxx @@ -102,10 +102,12 @@ sal_uInt16 SvXMLNamespaceMap::Add( const OUString rPrefix, const OUString rNam if( XML_NAMESPACE_UNKNOWN == nKey ) nKey = GetKeyByName( rName ); -assert(XML_NAMESPACE_NONE != nKey); - +#ifdef NDEBUG if( XML_NAMESPACE_NONE == nKey ) return USHRT_MAX; +#else +assert(XML_NAMESPACE_NONE != nKey); +#endif if ( aNameHash.find ( rPrefix ) == aNameHash.end() ) nKey = _Add( rPrefix, rName, nKey ); @@ -117,10 +119,12 @@ sal_uInt16 SvXMLNamespaceMap::AddIfKnown( const OUString rPrefix, const OUStrin { sal_uInt16 nKey = GetKeyByName( rName ); -assert(nKey != XML_NAMESPACE_NONE); - +#ifdef NDEBUG if( XML_NAMESPACE_NONE == nKey ) return XML_NAMESPACE_UNKNOWN; +#else +assert(nKey != XML_NAMESPACE_NONE); +#endif if( XML_NAMESPACE_UNKNOWN != nKey ) { commit a6b6bb2aac59db3b390a3155ee4b25ebfef76ce9 Author: Caolán McNamara caol...@redhat.com Date: Thu Jun 4 20:26:45 2015 +0100 coverity#1302656 Unchecked dynamic_cast Change-Id: If84fc54892bbe65799b3bc344c700bb43bedc0cd diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 33a0b27..bf96c15 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1947,7 +1947,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence rObj ) : aColLabelText( SW_RES(STR_CHART2_COL_LABEL_TEXT) ), xDataProvider( rObj.pDataProvider ), pDataProvider( rObj.pDataProvider ), -pTableCrsr( dynamic_castSwUnoTableCrsr*(rObj.pTableCrsr.get())-Clone() ), +pTableCrsr( dynamic_castSwUnoTableCrsr(*rObj.pTableCrsr.get()).Clone() ), aCursorDepend( this, pTableCrsr.get() ), _pPropSet( rObj._pPropSet ) { @@ -2032,7 +2032,7 @@ uno::Sequence uno::Any SAL_CALL SwChartDataSequence::getData() // keep original cursor and make copy of it that gets handed // over to the SwXCellRange object which takes ownership and // thus will destroy the copy later. -SwXCellRange aRange( dynamic_castSwUnoTableCrsr*(pTableCrsr.get())-Clone(), *pTableFormat, aDesc ); +SwXCellRange aRange( dynamic_castSwUnoTableCrsr(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc ); aRange.GetDataSequence( aRes, 0, 0 ); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/core/unocore/unoframe.cxx | 14 +- xmloff/source/style/XMLBackgroundImageContext.cxx |3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) New commits: commit 00eab70295cbce40368d57224c3f51c6e5f2457e Author: Michael Stahl mst...@redhat.com Date: Fri May 22 17:59:55 2015 +0200 tdf#90946: sw: ODF import: ignore invalid gradient-name if style SOLID The bugdoc has a fill-gradient-name that refers to a non-existent gradient and also draw:fill=solid; handle this combination without exception. Change-Id: I2c912b28a6b1550e2e4c6c71ff8889ae1779c618 diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 1f03d7f..54a5b6b 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -394,7 +394,17 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet rToSet, const SfxI throw lang::IllegalArgumentException(); } -bRet = SvxShape::SetFillAttribute(XATTR_FILLGRADIENT, aTempName, rToSet); +bool const bSuccess = SvxShape::SetFillAttribute( +XATTR_FILLGRADIENT, aTempName, rToSet); +if (aXFillStyleItem.GetValue() == drawing::FillStyle_GRADIENT) +{ // tdf#90946 ignore invalid gradient-name if SOLID +bRet = bSuccess; +} +else +{ +SAL_INFO_IF(!bSuccess, sw.uno, + FillBaseProperties: ignoring invalid FillGradientName); +} } } commit 12f907da9535ae9fb28fb7ef1b05240eabf51e82 Author: Michael Stahl mst...@redhat.com Date: Fri May 22 17:58:57 2015 +0200 tdf#91140: tweak fix a bit, turns out xmloff was also passing empty URL Change-Id: Ia6e1fbe18e72c9c06915e1b437076a1f56a6c206 diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 897a987..1f03d7f 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -259,6 +259,8 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet rToSet, const SfxI const bool bFillStyleUsed(pXFillStyleItem pXFillStyleItem-hasValue() (pXFillStyleItem-getdrawing::FillStyle() != drawing::FillStyle_SOLID || !pGrURL)); +SAL_INFO_IF(pXFillStyleItem pXFillStyleItem-hasValue() !bFillStyleUsed, +sw.uno, FillBaseProperties: ignoring invalid FillStyle); const bool bXFillStyleItemUsed( bFillStyleUsed || pXFillColorItem || diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx index 18749d82..5acd951 100644 --- a/xmloff/source/style/XMLBackgroundImageContext.cxx +++ b/xmloff/source/style/XMLBackgroundImageContext.cxx @@ -389,7 +389,8 @@ void XMLBackgroundImageContext::EndElement() else if( GraphicLocation_NONE == ePos ) ePos = GraphicLocation_TILED; -aProp.maValue = sURL; +if (!sURL.isEmpty()) +aProp.maValue = sURL; aPosProp.maValue = ePos; aFilterProp.maValue = sFilter; aTransparencyProp.maValue = nTransparency; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/filter/ascii/ascatr.cxx |8 ++-- xmloff/source/text/txtparae.cxx |9 + 2 files changed, 11 insertions(+), 6 deletions(-) New commits: commit ef3e481be37a387f6549a561daee890da6712cf5 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Jun 19 17:54:27 2014 +0200 Do not call SwASC_AttrIter::NextPos when nAktSwPos is already SAL_MAX_INT32 ...and calculating nAktSwPos + 1 would overflow. Reported by CppunitTest_sw_odfexport under -sanitize=undefined. Change-Id: I78bd540851192a768400ce348b42228f9cb10b72 diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 1fb879f..04a5d89 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -197,7 +197,7 @@ static Writer OutASC_SwTxtNode( Writer rWrt, SwCntntNode rNode ) const bool bExportSoftHyphens = RTL_TEXTENCODING_UCS2 == rWrt.GetAsciiOptions().GetCharSet() || RTL_TEXTENCODING_UTF8 == rWrt.GetAsciiOptions().GetCharSet(); -do { +for (;;) { const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd); if( !aAttrIter.OutAttr( nStrPos )) @@ -209,8 +209,12 @@ static Writer OutASC_SwTxtNode( Writer rWrt, SwCntntNode rNode ) rWrt.Strm().WriteUnicodeOrByteText( aOutStr ); } nStrPos = nNextAttr; +if (nStrPos = nEnd) +{ +break; +} aAttrIter.NextPos(); -} while( nStrPos nEnd ); +} if( !bLastNd || ( ( !rWrt.bWriteClipboardDoc !rWrt.bASCII_NoLastLineEnd ) commit d8e7624c9a874aee3ab782715117b118ddd0c496 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Jun 19 17:51:36 2014 +0200 Do not dereference null pointer ...and XMLTextCharStyleNamesElementExport only requires a non-null rPropSet arg when its bDoSomething arg is true. Reported by CppunitTest_sw_odfexport under -sanitize=undefined. Change-Id: Ia45fa7db250f83d746829c7f411e78bbc50bf721 diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 7c91085..108fe8e 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2843,11 +2843,12 @@ void XMLTextParagraphExport::exportAnyTextFrame( else bIsUICharStyle = false; +bool bDoSomething = bIsUICharStyle + aCharStyleNamesPropInfoCache.hasProperty( *pRangePropSet ); XMLTextCharStyleNamesElementExport aCharStylesExport( -GetExport(), bIsUICharStyle - aCharStyleNamesPropInfoCache.hasProperty( -*pRangePropSet ), bHasAutoStyle, -*pRangePropSet, sCharStyleNames ); +GetExport(), bDoSomething, bHasAutoStyle, +bDoSomething ? *pRangePropSet : ReferenceXPropertySet(), +sCharStyleNames ); if( !sStyle.isEmpty() ) GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/filter/ww8/docxattributeoutput.cxx | 22 +++--- sw/source/filter/ww8/docxhelper.hxx |2 +- xmloff/source/text/txtparae.cxx |2 +- 3 files changed, 13 insertions(+), 13 deletions(-) New commits: commit a13622923af5024398eff324dadb048fd6fd7b04 Author: Jan Holesovsky ke...@collabora.com Date: Mon Feb 24 10:56:11 2014 +0100 Here the line made sense, bring it back. Change-Id: Iba1c798edfe1b0eb5edcba904ceacec9174cacc6 diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 0135f28..95f6f0ce5 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -258,7 +258,7 @@ static int txtparae_bContainsIllegalCharacters = sal_False; // The following map shows which property values are required: // // property auto style pass export - +// --- // ParaStyleNameif style exists always // ParaConditionalStyleName if style exists always // NumberingRules if style exists always commit d39f1358372e6b0994fdd3f82542caeb547a64e7 Author: Jan Holesovsky ke...@collabora.com Date: Mon Feb 24 10:10:33 2014 +0100 OUString - const OUString, Sequence - const Sequence Change-Id: I5d17a04fe0a3051374d75d9c989d95377f18c79d diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9dd8cd5..1322131 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1183,12 +1183,12 @@ const NameToId constNameToIdMapping[] = { OUString(lumMod),FSNS( XML_w14, XML_lumMod ) }, }; -boost::optionalsal_Int32 lclGetElementIdForName(OUString aName) +boost::optionalsal_Int32 lclGetElementIdForName(const OUString rName) { sal_Int32 aLength = sizeof (constNameToIdMapping) / sizeof(NameToId); for (sal_Int32 i=0; i aLength; ++i) { -if(aName == constNameToIdMapping[i].maName) +if (rName == constNameToIdMapping[i].maName) { return constNameToIdMapping[i].maId; } @@ -1196,16 +1196,16 @@ boost::optionalsal_Int32 lclGetElementIdForName(OUString aName) return boost::optionalsal_Int32(); } -void lclProcessRecursiveGrabBag(sal_Int32 aElementId, css::uno::Sequencecss::beans::PropertyValue aElements, sax_fastparser::FSHelperPtr pSerializer) +void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequencecss::beans::PropertyValue rElements, sax_fastparser::FSHelperPtr pSerializer) { css::uno::Sequencecss::beans::PropertyValue aAttributes; FastAttributeList* pAttributes = pSerializer-createAttrList(); -for (sal_Int32 j=0; j aElements.getLength(); ++j) +for (sal_Int32 j=0; j rElements.getLength(); ++j) { -if( aElements[j].Name == attributes) +if (rElements[j].Name == attributes) { -aElements[j].Value = aAttributes; +rElements[j].Value = aAttributes; } } @@ -1232,14 +1232,14 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, css::uno::Sequencecss::be pSerializer-startElement(aElementId, xAttributesList); -for (sal_Int32 j=0; j aElements.getLength(); ++j) +for (sal_Int32 j=0; j rElements.getLength(); ++j) { css::uno::Sequencecss::beans::PropertyValue aSumElements; -boost::optionalsal_Int32 aSubElementId = lclGetElementIdForName(aElements[j].Name); +boost::optionalsal_Int32 aSubElementId = lclGetElementIdForName(rElements[j].Name); if(aSubElementId) { -aElements[j].Value = aSumElements; +rElements[j].Value = aSumElements; lclProcessRecursiveGrabBag(*aSubElementId, aSumElements, pSerializer); } } @@ -2759,9 +2759,9 @@ void DocxAttributeOutput::StartStyles() LatentStyles(); } -sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, OUString aName) +sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, const OUString rName) { -OString sName = OUStringToOString(aName, RTL_TEXTENCODING_UTF8); +OString sName = OUStringToOString(rName, RTL_TEXTENCODING_UTF8); while (pMap-pToken) { if (sName == pMap-pToken) diff --git a/sw/source/filter/ww8/docxhelper.hxx b/sw/source/filter/ww8/docxhelper.hxx index d6d158f..4791aaa 100644 --- a/sw/source/filter/ww8/docxhelper.hxx +++ b/sw/source/filter/ww8/docxhelper.hxx @@ -18,7 +18,7 @@ struct DocxStringTokenMap sal_Int32 nToken; }; -sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, OUString aName); +sal_Int32 DocxStringGetToken(DocxStringTokenMap const * pMap, const OUString rName); #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXHELPER_HXX ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
sw/source/filter/ww8/ww8par.cxx|2 +- xmloff/source/text/XMLTextFrameContext.cxx | 12 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) New commits: commit 8171e713e74e3d09e86592c28abfe05d0400c071 Author: Michael Stahl mst...@redhat.com Date: Mon Dec 2 23:28:20 2013 +0100 fdo#71450 fdo#71698: ODF import: fix frame name corner cases Trying to set a name that is already in use will throw an exception (and set a different, generated name); if there is actually no name in the file then there's no point trying to set anything. (regression from b69d152cfa1da868ba960345d72ba78f9f8e1b35) Change-Id: Ie54d4a830cc23e2853a6efeb81f77dcc788192ea diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 6795dcd..3731221 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1307,12 +1307,20 @@ void XMLTextFrameContext_Impl::SetHyperlink( const OUString rHRef, void XMLTextFrameContext_Impl::SetName() { ReferenceXNamed xNamed(xPropSet, UNO_QUERY); -if (xNamed.is()) +if (!m_sOrigName.isEmpty() xNamed.is()) { OUString const name(xNamed-getName()); if (name != m_sOrigName) { -xNamed-setName(m_sOrigName); +try +{ +xNamed-setName(m_sOrigName); +} +catch (uno::Exception const e) +{ // fdo#71698 document contains 2 frames with same draw:name +SAL_INFO(xmloff.text, SetName(): exception setting \ + m_sOrigName \: e.Message); +} } } } commit 790896d9a557d34ea91d6e5926471de66503be7a Author: Michael Stahl mst...@redhat.com Date: Mon Dec 2 22:20:25 2013 +0100 fdo#71749: sw: WW8: don't loop on tables in footnotes (regression from ee1db992b98378b5e2f5e9aa8af0e36c375e582f) Change-Id: Id10b6fb8e9e3697b10a1df605cb48d94a55ad207 diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 06c1287..651800b 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2707,7 +2707,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool rbReSync, WW8_CP nStartCp) pPlcxMan-GetPap()-Restore( aSave ); } } -} while (nInTable nCellLevel); +} while (!bFtnEdn (nInTable nCellLevel)); return bTableRowEnd; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits