[Libreoffice-commits] core.git: 6 commits - sw/qa sw/source writerfilter/source
Michael Stahl
mstahl at redhat.com
Fri Jul 18 03:51:08 PDT 2014
sw/qa/extras/rtfimport/data/fdo79319.rtf | 60 +++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 18 ++
sw/source/core/attr/format.cxx | 10 -
sw/source/core/unocore/unotext.cxx | 8
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 -
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 +
writerfilter/source/rtftok/rtfsdrimport.cxx | 184 ++++++++++++++++------
writerfilter/source/rtftok/rtfsdrimport.hxx | 8
8 files changed, 245 insertions(+), 65 deletions(-)
New commits:
commit 9aa80fcb291083dc2a396db3d1be756eb4a0e54b
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 18 11:55:07 2014 +0200
(related: fdo#79319): writerfilter: RTF imoprt: don't lose shapes in header
With a horizontal rule, it's possible that there is no \par following it
in a header, so RemoveLastParagraph() will delete the paragraph where
the shape is anchored (and so the shape as well). Avoid that by adding
an extra \par if there is no \par following a shape.
Change-Id: I4840417880c98203866c9dcde51627516618f2d0
diff --git a/sw/qa/extras/rtfimport/data/fdo79319.rtf b/sw/qa/extras/rtfimport/data/fdo79319.rtf
new file mode 100644
index 0000000..48f022b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo79319.rtf
@@ -0,0 +1,60 @@
+{\rtf1
+{\header
+\par
+{\pict
+{\*\picprop\shplid1025
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn fillColor}
+{\sv 10070188}
+}
+{\sp
+{\sn fFilled}
+{\sv 1}
+}
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\sp
+{\sn alignHR}
+{\sv 1}
+}
+{\sp
+{\sn dxHeightHR}
+{\sv 30}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+{\sp
+{\sn fStandardHR}
+{\sv 1}
+}
+{\sp
+{\sn fHorizRule}
+{\sv 1}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+}
+\picscalex864\picscaley6\piccropl0\piccropr0\piccropt0\piccropb0\picw1764\pich882\picwgoal1000\pichgoal500\wmetafile8\bliptag-1602651790\blipupi1752
+{\*\blipuid a07979727e802d02da96f878ba973054}
+010009000003b700000006001c00000000000400000003010800050000000b0200000000050000000c021a000807040000002e0118001c000000fb02ceff0000000000009001000000000440001254696d6573204e657720526f6d616e0000000000000000000000000000000000040000002d0100000400000002010100050000000902000000020d000000320a2c00000001000400000000000807190020631600030000001e0007000000fc020000aca899000000040000002d01010008000000fa02050000000000ffffff00040000002d0102000e00000024030500ffffffffffff1800080718000807ffffffffffff08000000fa0200000000000000000000040000002d01030007000000fc020000ffffff000000040000002d010400040000002701ffff1c000000fb021000070000000000bc02000000000102022253797374656d000000000000de60e7770806080298030802200408025ae78339040000002d0105000300000000000000}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index a2ff94f..ed4bc8b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -885,6 +885,24 @@ DECLARE_RTFIMPORT_TEST(testDppolyline, "dppolyline.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
}
+DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf")
+{
+ // the thin horizontal rule was imported as a big fat rectangle
+ uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(100),
+ getProperty<sal_Int16>(xShape, "RelativeWidth"));
+ // FIXME the width/height numbers here are bogus; they should be 15238 / 53
+ // (as they are when opening the file in a full soffice)
+#if 0
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(15238), xShape->getSize().Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(53), xShape->getSize().Height);
+ CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER,
+ getProperty<sal_Int16>(xShape, "VertOrient"));
+ CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER,
+ getProperty<sal_Int16>(xShape, "HoriOrient"));
+#endif
+}
+
DECLARE_RTFIMPORT_TEST(testFdo56512, "fdo56512.rtf")
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index fe1f1fdd..e7e3a42 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -5197,8 +5197,10 @@ int RTFDocumentImpl::popState()
{
resolvePict(true, m_pSdrImport->getCurrentShape());
}
+ m_bNeedFinalPar = true;
break;
case DESTINATION_SHAPE:
+ m_bNeedFinalPar = true;
m_bNeedCr = m_bNeedCrOrig;
if (aState.aFrame.inFrame())
{
commit 589ca2a5e88a976bb10e60fcb1e3e75f4aa2504e
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 17 15:09:39 2014 +0200
fdo#79319: writerfilter: RTF import: support horizontal rule
There are special properties to create a "horizontal rule" shape
that apparently set some specific defaults; this prevents the
shape being imported as a big fat rectangle over the document.
Change-Id: I402376d7306e870ad895beaa657750cbf3290d98
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 5f8a391..399c008 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -659,6 +659,54 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
}
}
}
+ else if (i->first == "fHorizRule") // TODO: what does "fStandardHR" do?
+ { // horizontal rule: relative width defaults to 100% of paragraph
+ // TODO: does it have a default height?
+ if (!oRelativeWidth)
+ {
+ oRelativeWidth = 100;
+ }
+ nRelativeWidthRelation = text::RelOrientation::FRAME;
+ sal_Int16 const nVertOrient = text::VertOrientation::CENTER;
+ if (xPropertySet.is())
+ {
+ xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
+ }
+ }
+ else if (i->first == "pctHR")
+ { // horizontal rule relative width in permille
+ oRelativeWidth = i->second.toInt32() / 10;
+ }
+ else if (i->first == "dxHeightHR")
+ { // horizontal rule height
+ sal_uInt32 const nHeight(convertTwipToMm100(i->second.toInt32()));
+ rShape.nBottom = rShape.nTop + nHeight;
+ }
+ else if (i->first == "dxWidthHR")
+ { // horizontal rule width
+ sal_uInt32 const nWidth(convertTwipToMm100(i->second.toInt32()));
+ rShape.nRight = rShape.nLeft + nWidth;
+ }
+ else if (i->first == "alignHR")
+ { // horizontal orientation *for horizontal rule*
+ sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
+ switch (i->second.toInt32())
+ {
+ case 0:
+ nHoriOrient = text::HoriOrientation::LEFT;
+ break;
+ case 1:
+ nHoriOrient = text::HoriOrientation::CENTER;
+ break;
+ case 2:
+ nHoriOrient = text::HoriOrientation::RIGHT;
+ break;
+ }
+ if (xPropertySet.is() && text::HoriOrientation::NONE != nHoriOrient)
+ {
+ xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
+ }
+ }
else
SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'");
}
commit 2b9e782497cb962d9ca74a851a1389b0e29df49c
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 16 18:47:15 2014 +0200
(related: fdo#79319) writerfilter: RTF import: fix crash on "fake" pict
The document has a \pict with {\sp{\sn shapeType}{\sv 1}}, i.e. it's
actually a rectangle shape; Word seems to ignore the picture data in
this case, so try to do the same. Also consolidate the shape creation
in a new function RTFSdrImport::initShape().
(regression from ba9b63d8101197d3fd8612193b1ca188271dfc1a)
Change-Id: Iec94852ddc4c1ca3d8284119e6f1818a8dbb4149
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 6fe2bdc..fe1f1fdd 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4904,9 +4904,6 @@ int RTFDocumentImpl::popState()
case DESTINATION_BOOKMARKEND:
Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().aDestinationText.makeStringAndClear()]));
break;
- case DESTINATION_PICT:
- resolvePict(true, m_pSdrImport->getCurrentShape());
- break;
case DESTINATION_FORMFIELDNAME:
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
@@ -5194,6 +5191,13 @@ int RTFDocumentImpl::popState()
Mapper().endShape();
}
break;
+ case DESTINATION_PICT:
+ // fdo#79319 ignore picture data if it's really a shape
+ if (!m_pSdrImport->isFakePict())
+ {
+ resolvePict(true, m_pSdrImport->getCurrentShape());
+ }
+ break;
case DESTINATION_SHAPE:
m_bNeedCr = m_bNeedCrOrig;
if (aState.aFrame.inFrame())
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 5cec44a..5f8a391 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -50,8 +50,9 @@ namespace rtftok
RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument,
uno::Reference<lang::XComponent> const& xDstDoc)
- : m_rImport(rDocument),
- m_bTextFrame(false)
+ : m_rImport(rDocument)
+ , m_bTextFrame(false)
+ , m_bFakePict(false)
{
uno::Reference<drawing::XDrawPageSupplier> xDrawings(xDstDoc, uno::UNO_QUERY);
if (xDrawings.is())
@@ -216,20 +217,92 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, const O
}
}
-void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shapeOrPict)
+int RTFSdrImport::initShape(
+ uno::Reference<drawing::XShape> & o_xShape,
+ uno::Reference<beans::XPropertySet> & o_xPropSet,
+ bool & o_rIsCustomShape,
+ RTFShape const& rShape, bool const bClose, ShapeOrPict const shapeOrPict)
{
+ assert(!o_xShape.is());
+ assert(!o_xPropSet.is());
+ o_rIsCustomShape = false;
+ m_bFakePict = false;
+
+ // first, find the shape type
int nType = -1;
+ std::vector< std::pair<OUString, OUString> >::const_iterator const iter(
+ std::find_if(rShape.aProperties.begin(),
+ rShape.aProperties.end(),
+ boost::bind(&OUString::equals,
+ boost::bind(&std::pair<OUString, OUString>::first, _1),
+ OUString("shapeType"))));
+
+ if (iter == rShape.aProperties.end())
+ {
+ if (SHAPE == shapeOrPict)
+ {
+ // The spec doesn't state what is the default for shapeType,
+ // Word seems to implement it as a rectangle.
+ nType = ESCHER_ShpInst_Rectangle;
+ }
+ else
+ { // pict is picture by default but can be a rectangle too fdo#79319
+ nType = ESCHER_ShpInst_PictureFrame;
+ }
+ }
+ else
+ {
+ nType = iter->second.toInt32();
+ if (PICT == shapeOrPict && ESCHER_ShpInst_PictureFrame != nType)
+ {
+ m_bFakePict = true;
+ }
+ }
+
+ switch (nType)
+ {
+ case ESCHER_ShpInst_PictureFrame:
+ createShape("com.sun.star.drawing.GraphicObjectShape", o_xShape, o_xPropSet);
+ break;
+ case ESCHER_ShpInst_Line:
+ createShape("com.sun.star.drawing.LineShape", o_xShape, o_xPropSet);
+ break;
+ case ESCHER_ShpInst_Rectangle:
+ case ESCHER_ShpInst_TextBox:
+ // If we're inside a groupshape, can't use text frames.
+ if (!bClose && m_aParents.size() == 1)
+ {
+ createShape("com.sun.star.text.TextFrame", o_xShape, o_xPropSet);
+ m_bTextFrame = true;
+ std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true);
+ for (size_t j = 0; j < aDefaults.size(); ++j)
+ o_xPropSet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value);
+ break;
+ }
+ // fall-through intended
+ default:
+ createShape("com.sun.star.drawing.CustomShape", o_xShape, o_xPropSet);
+ o_rIsCustomShape = true;
+ break;
+ }
+
+ // Defaults
+ if (o_xPropSet.is() && !m_bTextFrame)
+ {
+ o_xPropSet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32(
+ 0xffffff))); // White in Word, kind of blue in Writer.
+ }
+
+ return nType;
+}
+
+void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shapeOrPict)
+{
bool bPib = false;
- bool bCustom = false;
m_bTextFrame = false;
uno::Reference<drawing::XShape> xShape;
uno::Reference<beans::XPropertySet> xPropertySet;
- // Create this early, as custom shapes may have properties before the type arrives.
- if (PICT == shapeOrPict)
- createShape("com.sun.star.drawing.GraphicObjectShape", xShape, xPropertySet);
- else
- createShape("com.sun.star.drawing.CustomShape", xShape, xPropertySet);
uno::Any aAny;
beans::PropertyValue aPropertyValue;
awt::Rectangle aViewBox;
@@ -253,53 +326,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
sal_Int16 nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME;
sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
- if (SHAPE == shapeOrPict)
- {
- // The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle.
- if (std::find_if(rShape.aProperties.begin(),
- rShape.aProperties.end(),
- boost::bind(&OUString::equals, boost::bind(&std::pair<OUString, OUString>::first, _1), OUString("shapeType")))
- == rShape.aProperties.end())
- rShape.aProperties.insert(rShape.aProperties.begin(), std::pair<OUString, OUString>("shapeType", OUString::number(ESCHER_ShpInst_Rectangle)));
- }
+ bool bCustom(false);
+ int const nType =
+ initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict);
for (std::vector< std::pair<OUString, OUString> >::iterator i = rShape.aProperties.begin();
i != rShape.aProperties.end(); ++i)
{
if (i->first == "shapeType")
{
- nType = i->second.toInt32();
- switch (nType)
- {
- case ESCHER_ShpInst_PictureFrame:
- createShape("com.sun.star.drawing.GraphicObjectShape", xShape, xPropertySet);
- break;
- case ESCHER_ShpInst_Line:
- createShape("com.sun.star.drawing.LineShape", xShape, xPropertySet);
- break;
- case ESCHER_ShpInst_Rectangle:
- case ESCHER_ShpInst_TextBox:
- // If we're inside a groupshape, can't use text frames.
- if (!bClose && m_aParents.size() == 1)
- {
- createShape("com.sun.star.text.TextFrame", xShape, xPropertySet);
- m_bTextFrame = true;
- std::vector<beans::PropertyValue> aDefaults = getTextFrameDefaults(true);
- for (size_t j = 0; j < aDefaults.size(); ++j)
- xPropertySet->setPropertyValue(aDefaults[j].Name, aDefaults[j].Value);
- }
- else
- bCustom = true;
- break;
- default:
- bCustom = true;
- break;
- }
-
- // Defaults
- aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer.
- if (xPropertySet.is() && !m_bTextFrame)
- xPropertySet->setPropertyValue("FillColor", aAny);
+ continue; // ignore: already handled by initShape
}
else if (i->first == "wzName")
{
diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx
index 5cf8fa4..1c5ebe7 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.hxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.hxx
@@ -47,15 +47,23 @@ public:
{
return m_xShape;
}
+ bool isFakePict() { return m_bFakePict; }
private:
void createShape(const OUString& aService, css::uno::Reference<css::drawing::XShape>& xShape, css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
void applyProperty(css::uno::Reference<css::drawing::XShape> xShape, const OUString& aKey, const OUString& aValue);
+ int initShape(
+ css::uno::Reference<css::drawing::XShape> & o_xShape,
+ css::uno::Reference<css::beans::XPropertySet> & o_xPropSet,
+ bool & o_rIsCustomShape,
+ RTFShape const& rShape, bool bClose, ShapeOrPict const shapeOrPict);
RTFDocumentImpl& m_rImport;
std::stack< css::uno::Reference<css::drawing::XShapes> > m_aParents;
css::uno::Reference<css::drawing::XShape> m_xShape;
/// If m_xShape is imported as a Writer text frame (instead of a drawinglayer rectangle).
bool m_bTextFrame;
+ /// if inside \pict, but actually it's a shape (not a picture)
+ bool m_bFakePict;
};
} // namespace rtftok
} // namespace writerfilter
commit 27adf3858849721c3c8b173884a3427ffaf69b50
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 17 13:16:58 2014 +0200
typo
Change-Id: Ic820daa58574fb37a737b632ba6c58d31ccb8114
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8279958..c25308d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1801,7 +1801,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
#endif
text::TextContentAnchorType nAnchorType(text::TextContentAnchorType_AT_PARAGRAPH);
xProps->getPropertyValue(rPropNameSupplier.GetName( PROP_ANCHOR_TYPE )) >>= nAnchorType;
- bool checkZOredrStatus = false;
+ bool checkZOrderStatus = false;
if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
{
SetIsTextFrameInserted(true);
@@ -1826,9 +1826,9 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
aGrabBag[i].Value >>= zOrder;
xShapePropertySet->setPropertyValue( "ZOrder", uno::makeAny(pZOrderHelper->findZOrder(zOrder)));
pZOrderHelper->addItem(xShapePropertySet, zOrder);
- checkZOredrStatus = true;
+ checkZOrderStatus = true;
}
- if(checkBtLrStatus && checkZOredrStatus)
+ if(checkBtLrStatus && checkZOrderStatus)
break;
if ( aGrabBag[i].Name == "TxbxHasLink" )
@@ -1873,7 +1873,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
xShapePropertySet->setPropertyValue( "ZOrder", uno::makeAny(pZOrderHelper->findZOrder(zOrder)));
pZOrderHelper->addItem(xShapePropertySet, zOrder);
xShapePropertySet->setPropertyValue(rPropNameSupplier.GetName( PROP_OPAQUE ), uno::makeAny( false ) );
- checkZOredrStatus = true;
+ checkZOrderStatus = true;
}
else if ( aGrabBag[i].Name == "TxbxHasLink" )
{
@@ -1885,7 +1885,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
}
}
}
- if (!m_bInHeaderFooterImport && !checkZOredrStatus)
+ if (!m_bInHeaderFooterImport && !checkZOrderStatus)
xProps->setPropertyValue(
rPropNameSupplier.GetName( PROP_OPAQUE ),
uno::makeAny( true ) );
commit 7a398f6dacbb821cdb1f67db3b8726adf3500015
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 18 12:18:42 2014 +0200
SwXText::insertTextContentWithProperties: call EndUndo on exception
Change-Id: Ia43a4ba643b3a3f5e362204de141eae0f73ad0db
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 602835b..b2cf10c 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -1489,9 +1490,12 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
}
}
}
- catch (const uno::Exception&)
+ catch (const uno::Exception& e)
{
- throw uno::RuntimeException();
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
+ lang::WrappedTargetRuntimeException wrapped;
+ wrapped.TargetException <<= e;
+ throw wrapped;
}
}
m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
commit df3e0c2226085d5034f24e1909180ee8458a5871
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 17 22:28:42 2014 +0200
sw: downgrade assertions about legacy SvxBrushItem to SAL_INFO
These produce a lot of noise, and do not indicate a real bug.
Change-Id: I355f6788af92529804cef2567ee2f8b3e4a1e807
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 7b60fe7..54ececf 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -394,7 +394,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const
if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
- OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
+ SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
// fill the local static SvxBrushItem from the current ItemSet so that
@@ -414,7 +414,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const S
if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
- OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
+ SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper();
// check if the new fill attributes are used
@@ -458,7 +458,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
if(RES_BACKGROUND == rAttr.Which() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
- OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
+ SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
SfxItemSet aTempSet(*aSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
const SvxBrushItem& rSource = static_cast< const SvxBrushItem& >(rAttr);
@@ -564,7 +564,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
if(SFX_ITEM_SET == aTempSet.GetItemState(RES_BACKGROUND, false, &pSource))
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
- OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
+ SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
// copy all items to be set anyways to a local ItemSet with is also prepared for the new
// fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Add the attributes
@@ -794,7 +794,7 @@ const SvxBrushItem& SwFmt::GetBackground(bool bInP) const
if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
- OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
+ SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
// fill the local static SvxBrushItem from the current ItemSet so that
More information about the Libreoffice-commits
mailing list