configure.ac | 2 dbaccess/source/core/api/KeySet.cxx | 2 external/curl/ExternalProject_curl.mk | 1 icon-themes/galaxy/svx/res/markers.png |binary lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp |binary lotuswordpro/source/filter/xfilter/xfcell.cxx | 5 sc/source/core/data/column2.cxx | 7 + sc/source/core/data/document.cxx | 18 +++ sc/source/core/data/formulacell.cxx | 48 +++++++- sfx2/sdi/sfx.sdi | 6 - sw/inc/IDocumentSettingAccess.hxx | 1 sw/inc/textboxhelper.hxx | 2 sw/qa/extras/ooxmlimport/data/tdf98882.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 + sw/qa/extras/rtfimport/data/libreoffice.png |binary sw/qa/extras/rtfimport/data/tdf59699.rtf | 10 + sw/qa/extras/rtfimport/data/tdf96326.rtf | 27 ++++ sw/qa/extras/rtfimport/rtfimport.cxx | 24 ++++ sw/qa/extras/uiwriter/data/tdf88453-table.odt |binary sw/qa/extras/uiwriter/data/tdf88453.odt |binary sw/qa/extras/uiwriter/data/tdf98987.docx |binary sw/qa/extras/uiwriter/data/tdf99004.docx |binary sw/qa/extras/uiwriter/uiwriter.cxx | 60 +++++++++- sw/source/core/crsr/findtxt.cxx | 8 - sw/source/core/doc/DocumentSettingManager.cxx | 5 sw/source/core/doc/textboxhelper.cxx | 10 + sw/source/core/inc/DocumentSettingManager.hxx | 1 sw/source/core/inc/anchoredobjectposition.hxx | 4 sw/source/core/inc/txtfrm.hxx | 4 sw/source/core/layout/flycnt.cxx | 2 sw/source/core/layout/tabfrm.cxx | 39 ++++++ sw/source/core/objectpositioning/anchoredobjectposition.cxx | 24 +++- sw/source/core/text/txtfrm.cxx | 13 ++ sw/source/core/text/xmldump.cxx | 12 ++ sw/source/uibase/uno/SwXDocumentSettings.cxx | 13 ++ vcl/inc/win/salgdi.h | 2 vcl/win/source/gdi/salgdi3.cxx | 17 ++ vcl/win/source/gdi/winlayout.cxx | 6 + writerfilter/Library_writerfilter.mk | 1 writerfilter/inc/rtftok/RTFDocument.hxx | 3 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 writerfilter/source/dmapper/FieldTypes.hxx | 1 writerfilter/source/dmapper/StyleSheetTable.cxx | 72 +++++++----- writerfilter/source/filter/RtfFilter.cxx | 2 writerfilter/source/filter/WriterFilter.cxx | 1 writerfilter/source/rtftok/rtfdocumentfactory.cxx | 4 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 70 +++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.hxx | 6 - 48 files changed, 484 insertions(+), 60 deletions(-)
New commits: commit b91cc954d8ecb87dd3f5b5789bdac5d8e71d737f Author: Andras Timar <[email protected]> Date: Mon Apr 4 23:58:01 2016 +0200 Bump version to 5.0-29 Change-Id: I1602403dbd0a636b46ae696342204ccdeea0d9e4 diff --git a/configure.ac b/configure.ac index fe509e9..1aa0cf0 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([Collabora Office],[5.0.10.28],[],[],[https://CollaboraOffice.com/]) +AC_INIT([Collabora Office],[5.0.10.29],[],[],[https://CollaboraOffice.com/]) AC_PREREQ([2.59]) commit 9258df33160d9e0867e5fc558b7aad34eda20471 Author: Miklos Vajna <[email protected]> Date: Thu Mar 31 15:05:48 2016 +0200 tdf#98987 sw: add AddVerticalFrameOffsets compat mode The situation is the following: we have a text frame, with at least two anchored objects: one is wrapped not-wrap-through, the other is. In case the non-wrap-though one shifts the text content of the text frame right or down, then layout may or may not want to re-consider what is the top left corner of the text frame for anchoring purposes. Regarding the x position, sw layout repositioned the anchor point depending on the AddFrameOffsets compat mode: it's enabled for documents imported from Word, disabled otherwise. Regarding the y position, no repositioning was done, however the bugdoc shows that Word does the same repositioning on the vertical axis as well. Add a new AddVerticalFrameOffsets compat mode that enables vertical repositioning as well, and enable that mode for documents imported from DOCX. Also (squashed in, as the second commit partly undoes what the first one did): tdf#99004 SwAnchoredObjectPosition: handle textboxes when determining surround Writer TextBoxes are always wrapped "through", so that they can appear inside their shapes. However, the surround of the shape may influence its position. So when surround is asked for anchor position purposes, take the surround of the TextBox's "parent" shape instead of the one of the TextBox directly. With this, the textbox in the bugdoc is properly positioned inside its parent shape as expected. (The problem only happens when at least two shapes are anchored to the same paragraph.) (cherry picked from commits 911261a3a581b9f2f4262f1d5403d9be3bbecf63, f5e0236566b913aebb1376d97c7d37a23c69bd84, 50223ea6e212b60b7d33839c2753c5601fb50f95 and cd1b2f923e0b0be89a5d1c8cbc647133aac09ed5) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx sw/source/core/inc/anchoredobjectposition.hxx sw/source/core/objectpositioning/anchoredobjectposition.cxx sw/source/core/text/txtfrm.cxx sw/source/uibase/uno/SwXDocumentSettings.cxx Change-Id: Idc5cad7d86662008a92ff3bf5fbb3806aa2c7b07 Reviewed-on: https://gerrit.libreoffice.org/23739 Tested-by: Jenkins <[email protected]> Reviewed-by: Andras Timar <[email protected]> (cherry picked from commit 3e242e732e0aba170870098e4ce51d49f979eab9) diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 73a5d54..96a4d36 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -37,6 +37,7 @@ enum class DocumentSettingId TAB_COMPAT, ADD_FLY_OFFSETS, + ADD_VERTICAL_FLY_OFFSETS, OLD_NUMBERING, diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx index f4fb97a..6f59786 100644 --- a/sw/inc/textboxhelper.hxx +++ b/sw/inc/textboxhelper.hxx @@ -87,6 +87,8 @@ public: static css::uno::Any getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::set<const SwFrameFormat*>& rTextBoxes) throw(css::lang::IndexOutOfBoundsException); /// Get the order of the shape, excluding TextBoxes. static sal_Int32 getOrdNum(const SdrObject* pObject, std::set<const SwFrameFormat*>& rTextBoxes); + /// If pTextBox is a textbox, then set rWrapThrough to the surround of its shape. + static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough); /// Saves the current shape -> textbox links in a map, so they can be restored later. static void saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks); diff --git a/sw/qa/extras/uiwriter/data/tdf98987.docx b/sw/qa/extras/uiwriter/data/tdf98987.docx new file mode 100644 index 0000000..3b24e34 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf98987.docx differ diff --git a/sw/qa/extras/uiwriter/data/tdf99004.docx b/sw/qa/extras/uiwriter/data/tdf99004.docx new file mode 100644 index 0000000..ef86440 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf99004.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 15d359b..c864d17 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -112,6 +112,8 @@ public: void testTdf96479(); void testTdf88453(); void testTdf88453Table(); + void testTdf98987(); + void testTdf99004(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -161,6 +163,8 @@ public: CPPUNIT_TEST(testTdf96479); CPPUNIT_TEST(testTdf88453); CPPUNIT_TEST(testTdf88453Table); + CPPUNIT_TEST(testTdf98987); + CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST_SUITE_END(); private: @@ -1362,6 +1366,38 @@ void SwUiWriterTest::testTdf88453Table() CPPUNIT_ASSERT_EQUAL(3, getPages()); } +void SwUiWriterTest::testTdf98987() +{ + createDoc("tdf98987.docx"); + calcLayout(); + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/sdrObject", "name", "Rectangle 1"); + sal_Int32 nRectangle1 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); + assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/sdrObject", "name", "Rectangle 2"); + sal_Int32 nRectangle2 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32(); + CPPUNIT_ASSERT(nRectangle1 < nRectangle2); + + assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[3]/sdrObject", "name", "Rectangle 3"); + sal_Int32 nRectangle3 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); + // This failed: the 3rd rectangle had a smaller "top" value than the 2nd one, it even overlapped with the 1st one. + CPPUNIT_ASSERT(nRectangle2 < nRectangle3); +} + +void SwUiWriterTest::testTdf99004() +{ + createDoc("tdf99004.docx"); + calcLayout(); + xmlDocPtr pXmlDoc = parseLayoutDump(); + sal_Int32 nTextbox1Top = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "top").toInt32(); + sal_Int32 nTextBox1Height = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height").toInt32(); + sal_Int32 nTextBox1Bottom = nTextbox1Top + nTextBox1Height; + + assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/sdrObject", "name", "Rectangle 2"); + sal_Int32 nRectangle2Top = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32(); + // This was 3291 and 2531, should be now around 2472 and 2531, i.e. the two rectangles should not overlap anymore. + CPPUNIT_ASSERT(nTextBox1Bottom < nRectangle2Top); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 6970d1f..02b927a 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -53,6 +53,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) // COMPATIBILITY FLAGS START mbAddFlyOffsets(false), + mbAddVerticalFlyOffsets(false), mbUseHiResolutionVirtualDevice(true), mbMathBaselineAlignment(false), // default for *old* documents is 'off' mbStylesNoDefault(false), @@ -125,6 +126,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES); case DocumentSettingId::TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT); case DocumentSettingId::ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS); + case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: return mbAddVerticalFlyOffsets; case DocumentSettingId::ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING); case DocumentSettingId::USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE); case DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV); @@ -196,6 +198,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::ADD_FLY_OFFSETS: mbAddFlyOffsets = value; break; + case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: + mbAddVerticalFlyOffsets = value; + break; case DocumentSettingId::ADD_EXT_LEADING: mbAddExternalLeading = value; break; diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 57c64f1..e50c238 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -27,6 +27,7 @@ #include <mvsave.hxx> #include <sortedobjs.hxx> #include <cntfrm.hxx> +#include <fmtsrnd.hxx> #include <editeng/unoprnms.hxx> #include <editeng/charrotateitem.hxx> @@ -264,6 +265,15 @@ sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const Sw return pObject->GetOrdNum(); } +void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough) +{ + std::map<SwFrameFormat*, SwFrameFormat*> aMap = findShapes(pTextBox->GetDoc()); + std::map<SwFrameFormat*, SwFrameFormat*>::iterator it = aMap.find(const_cast<SwFrameFormat*>(pTextBox)); + if (it != aMap.end()) + // pTextBox is indeed a TextBox, it->second is its shape. + rWrapThrough = it->second->GetSurround().GetSurround() == SURROUND_THROUGHT; +} + SwFrameFormat* SwTextBoxHelper::findTextBox(uno::Reference<drawing::XShape> xShape) { SwXShape* pShape = dynamic_cast<SwXShape*>(xShape.get()); diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 9ff978c..c83d6d8 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -108,6 +108,7 @@ class DocumentSettingManager : bool mbTabCompat : 1; bool mbUseVirtualDevice : 1; bool mbAddFlyOffsets : 1; + bool mbAddVerticalFlyOffsets : 1; bool mbAddExternalLeading : 1; bool mbUseHiResolutionVirtualDevice : 1; bool mbOldLineSpacing : 1; // #i11859# diff --git a/sw/source/core/inc/anchoredobjectposition.hxx b/sw/source/core/inc/anchoredobjectposition.hxx index ec9617a..0be1fac 100644 --- a/sw/source/core/inc/anchoredobjectposition.hxx +++ b/sw/source/core/inc/anchoredobjectposition.hxx @@ -126,9 +126,9 @@ namespace objectpositioning #i11860# */ - static SwTwips _GetTopForObjPos( const SwFrm& _rFrm, + SwTwips _GetTopForObjPos( const SwFrm& _rFrm, const SwRectFn& _fnRect, - const bool _bVert ); + const bool _bVert ) const; void _GetVertAlignmentValues( const SwFrm& _rVertOrientFrm, const SwFrm& _rPageAlignLayFrm, diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 824480a..690d924 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -68,6 +68,8 @@ class SwTextFrm: public SwContentFrm SwTwips mnFlyAnchorOfst; // The x position for wrap-through flys anchored at this paragraph. SwTwips mnFlyAnchorOfstNoWrap; + /// The y position for wrap-through flys anchored at this paragraph. + SwTwips mnFlyAnchorVertOfstNoWrap; SwTwips mnFootnoteLine; // OD 2004-03-17 #i11860# - re-factoring of #i11859# // member for height of last line (value needed for proportional line spacing) @@ -642,6 +644,8 @@ public: mnFlyAnchorOfstNoWrap ); } + SwTwips GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const; + inline SwTwips GetHeightOfLastLine() const { return mnHeightOfLastLine; diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index ee354ce..aed0003 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -37,6 +37,7 @@ #include <ndtxt.hxx> #include <IDocumentSettingAccess.hxx> #include <textboxhelper.hxx> +#include <fmtsrnd.hxx> using namespace ::com::sun::star; using namespace objectpositioning; @@ -156,7 +157,7 @@ SwTwips SwAnchoredObjectPosition::ToCharTopOfLine() const */ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm, const SwRectFn& _fnRect, - const bool _bVert ) + const bool _bVert ) const { SwTwips nTopOfFrmForObjPos = (_rFrm.Frm().*_fnRect->fnGetTop)(); @@ -172,6 +173,17 @@ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm, { nTopOfFrmForObjPos += rTextFrm.GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid(); + + const SwFormatSurround& rSurround = mpFrameFormat->GetSurround(); + bool bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT; + // If the frame format is a TextBox of a draw shape, then use the + // surround of the original shape. + SwTextBoxHelper::getShapeWrapThrough(mpFrameFormat, bWrapThrough); + + // Get the offset between the top of the text frame and the top of + // the first line inside the frame that has more than just fly + // portions. + nTopOfFrmForObjPos += rTextFrm.GetBaseVertOffsetForFly(!bWrapThrough); } } @@ -685,10 +697,12 @@ void SwAnchoredObjectPosition::_GetHoriAlignmentValues( const SwFrm& _rHoriOrie { nWidth = (_rHoriOrientFrm.Frm().*fnRect->fnGetWidth)(); - // When positioning TextBoxes, always ignore flys anchored at the - // text frame, as we do want to have the textbox overlap with its - // draw shape. - bool bIgnoreFlysAnchoredAtFrame = !_bObjWrapThrough || SwTextBoxHelper::isTextBox(&GetObject()); + bool bWrapThrough = _bObjWrapThrough; + // If the frame format is a TextBox of a draw shape, then use the + // surround of the original shape. + SwTextBoxHelper::getShapeWrapThrough(mpFrameFormat, bWrapThrough); + + bool bIgnoreFlysAnchoredAtFrame = !bWrapThrough; nOffset = _rHoriOrientFrm.IsTextFrm() ? static_cast<const SwTextFrm&>(_rHoriOrientFrm).GetBaseOfstForFly( bIgnoreFlysAnchoredAtFrame ) : 0; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index a4a707f..8705945 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -355,6 +355,7 @@ SwTextFrm::SwTextFrm(SwTextNode * const pNode, SwFrm* pSib ) , nThisLines( 0 ) , mnFlyAnchorOfst( 0 ) , mnFlyAnchorOfstNoWrap( 0 ) + , mnFlyAnchorVertOfstNoWrap( 0 ) , mnFootnoteLine( 0 ) , mnHeightOfLastLine( 0 ) // OD 2004-03-17 #i11860# , mnAdditionalFirstLineOffset( 0 ) @@ -2657,6 +2658,7 @@ void SwTextFrm::CalcBaseOfstForFly() // Get first 'real' line and adjust position and height of line rectangle // OD 08.09.2003 #110978#, #108749#, #110354# - correct behaviour, // if no 'real' line exists (empty paragraph with and without a dummy portion) + SwTwips nFlyAnchorVertOfstNoWrap = 0; { SwTwips nTop = (aFlyRect.*fnRect->fnGetTop)(); const SwLineLayout* pLay = GetPara(); @@ -2664,6 +2666,7 @@ void SwTextFrm::CalcBaseOfstForFly() while( pLay && pLay->IsDummy() && pLay->GetNext() ) { nTop += pLay->Height(); + nFlyAnchorVertOfstNoWrap += pLay->Height(); pLay = pLay->GetNext(); } if ( pLay ) @@ -2690,6 +2693,16 @@ void SwTextFrm::CalcBaseOfstForFly() mnFlyAnchorOfst = nRet1 - nLeft; mnFlyAnchorOfstNoWrap = nRet2 - nLeft; + + if (!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS)) + return; + + mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap; +} + +SwTwips SwTextFrm::GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const +{ + return bIgnoreFlysAnchoredAtThisFrame ? 0 : mnFlyAnchorVertOfstNoWrap; } /** diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 2a0ddf8..4b6fbe9 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -22,6 +22,7 @@ #include <anchoredobject.hxx> #include <libxml/xmlwriter.h> #include <SwPortionHandler.hxx> +#include <svx/svdobj.hxx> class XmlPortionDumper:public SwPortionHandler { @@ -358,6 +359,14 @@ void SwFrm::dumpInfosAsXml( xmlTextWriterPtr writer ) const xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Frm().Width() ); xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Frm().Height() ); xmlTextWriterEndElement( writer ); + + // output the Prt + xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", Prt().Left() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", Prt().Top() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Prt().Width() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Prt().Height() ); + xmlTextWriterEndElement( writer ); } // Hack: somehow conversion from "..." to va_list does @@ -417,6 +426,9 @@ void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", GetObjBoundRect().Height() ); xmlTextWriterEndElement( writer ); + if (const SdrObject* pObject = GetDrawObj()) + pObject->dumpAsXml(writer); + xmlTextWriterEndElement( writer ); if ( bCreateWriter ) diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 7d513d4..a6e454e 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -85,6 +85,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_PRINTER_INDEPENDENT_LAYOUT, HANDLE_IS_LABEL_DOC, HANDLE_IS_ADD_FLY_OFFSET, + HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, HANDLE_IS_ADD_EXTERNAL_LEADING, HANDLE_OLD_NUMBERING, // #111955# HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, @@ -159,6 +160,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0, 0}, { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0, 0}, { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0, 0}, + { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0, 0}, { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0, 0}, { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0, 0}, // #111955# { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0, 0}, @@ -554,6 +556,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, bTmp); } break; + case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET: + { + bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue()); + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, bTmp); + } + break; case HANDLE_IS_ADD_EXTERNAL_LEADING: { bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue()); @@ -1024,6 +1032,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS); } break; + case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS); + } + break; case HANDLE_IS_ADD_EXTERNAL_LEADING: { rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING); diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 546b852..4dffb4c 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -288,6 +288,7 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); xSettings->setPropertyValue("AddFrameOffsets", uno::makeAny(sal_True)); + xSettings->setPropertyValue("AddVerticalFrameOffsets", uno::makeAny(sal_True)); xSettings->setPropertyValue("UseOldNumbering", uno::makeAny(sal_False)); xSettings->setPropertyValue("IgnoreFirstLineIndentInNumbering", uno::makeAny(sal_False)); xSettings->setPropertyValue("DoNotResetParaAttrsForNumFont", uno::makeAny(sal_False)); commit b0b14c6825b415828990ddd78fafacf838b098b3 Author: Caolán McNamara <[email protected]> Date: Sun Apr 3 21:35:26 2016 +0100 subtable corruption is possible Change-Id: Ifbf4312df583724a22328491bea3b6e05b82418f (cherry picked from commit 9814cf713c57b211f5632733a853150d1d1e8da9) Reviewed-on: https://gerrit.libreoffice.org/23767 Tested-by: Jenkins <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit f25eca3f230c170b46d7ce9f40842161a50b1883) diff --git a/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp new file mode 100644 index 0000000..3d906ee Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp differ diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx index 7dde717..523bb1a 100644 --- a/lotuswordpro/source/filter/xfilter/xfcell.cxx +++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx @@ -89,10 +89,9 @@ void XFCell::Add(XFContent *pContent) Reset(); m_eValueType = enumXFValueTypeNone; } - if( m_pSubTable ) + if (m_pSubTable) { - assert(false); - return; + throw std::runtime_error("subtable already set"); } if (!pContent) { commit b97a2d4ac6325ffb53d494d6ac3b3d3f9155ed9d Author: Arul Michael <[email protected]> Date: Thu Mar 31 17:17:58 2016 +0530 tdf#92963 Pasting a whole row with data crashes all open LibO apps In ScColumn::GetNeededSize the memory pointed by rOptions.pPattern is freed and new value is set again in ScFormulaCell::InterpretTail function in pDocument->SetNumberFormat when pDocument->GetCondResult is called in column2.cxx:130.For fix setting the newly calculated ScPatternAttr* value after the GetCondResult call. Change-Id: I045404465b6dfa561b0821bb3b1875463aa7887a Reviewed-on: https://gerrit.libreoffice.org/23688 Tested-by: Jenkins <[email protected]> Reviewed-by: Eike Rathke <[email protected]> Tested-by: Eike Rathke <[email protected]> (cherry picked from commit 99bf0b931401f556033f67297aa9783c4cf19b00) Reviewed-on: https://gerrit.libreoffice.org/23709 (cherry picked from commit 527f2cd0b75f901efc683efd92a51af771b860b5) diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 8929ecd..0d4b869 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -127,6 +127,13 @@ long ScColumn::GetNeededSize( // conditional formatting const SfxItemSet* pCondSet = pDocument->GetCondResult( nCol, nRow, nTab ); + //The pPattern may change in GetCondResult + if (aCell.meType == CELLTYPE_FORMULA) + { + pPattern = pAttrArray->GetPattern( nRow ); + if (ppPatternChange) + *ppPatternChange = pPattern; + } // line break? const SfxPoolItem* pCondItem; commit aa4821df136838f57cd4821a0d9b64caf82e112d Author: Michael Stahl <[email protected]> Date: Thu Mar 24 22:20:06 2016 +0100 vcl: tdf#98812: acquire reference count of WinFontInstances ... when they are inserted in WinSalGraphics::mpWinFontEntry. Not sure why one of these drops to 0 but is not removed from the WinSalGraphics when formatting this particular bugdoc. Acquiring the instances when retaining pointers to them should make the life cycle a little less insane. (cherry picked from commit 99207a26df0083851ba8e23be72d5c6974f98a3b) Reviewed-on: https://gerrit.libreoffice.org/23504 Tested-by: Jenkins <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 4ae7ec8c8d22e751b868459e1f51fcecc37dd6b1) tdf#98812: follow-up pFont->mpFontInstance can be NULL. Reviewed-on: https://gerrit.libreoffice.org/23654 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 9fa87bb1a42c45446f78b4d8c8096d7ce90a8022) Signed-off-by: Michael Stahl <[email protected]> (cherry picked from commit 4ab36bbd1816d6f297892a638e6826f28ca87150) Change-Id: If1404f46a13736b2a226e198bdf0c3ca8e09bb38 Reviewed-on: https://gerrit.libreoffice.org/23651 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> (cherry picked from commit 988847aae823c7ea47a9925f1a40cdd61cc59f5c) diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 18b7ecf..790c3f9 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -216,6 +216,8 @@ private: ImplFontAttrCache* mpFontAttrCache; // Cache font attributes from files in so/share/fonts int mnPenWidth; // Linienbreite + ImplFontEntry* GetWinFontEntry(int nFallbackLevel); + public: HDC getHDC() const { return mhLocalDC; } void setHDC(HDC aNew) { mhLocalDC = aNew; } diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 419fa26a..2b78abc 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1522,12 +1522,28 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel if( mhFonts[i] ) ::DeleteFont( mhFonts[i] ); mhFonts[ i ] = 0; + if (mpWinFontEntry[i]) + { + GetWinFontEntry(i)->m_pFontCache->Release(GetWinFontEntry(i)); + } + mpWinFontEntry[i] = nullptr; + mpWinFontData[i] = nullptr; } mhDefFont = 0; return 0; } DBG_ASSERT( pFont->mpFontData, "WinSalGraphics mpFontData==NULL"); + if (mpWinFontEntry[nFallbackLevel]) + { + GetWinFontEntry(nFallbackLevel)->m_pFontCache->Release(GetWinFontEntry(nFallbackLevel)); + } + // WinSalGraphics::GetEmbedFontData does not set mpFontInstance/mpFontEntry + // since it is interested in font file data only. + if (pFont->mpFontEntry) + { + pFont->mpFontEntry->m_pFontCache->Acquire(pFont->mpFontEntry); + } mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast<ImplWinFontEntry*>( pFont->mpFontEntry ); mpWinFontData[ nFallbackLevel ] = static_cast<const ImplWinFontData*>( pFont->mpFontData ); @@ -1550,6 +1566,7 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel ::DeleteFont( mhFonts[i] ); mhFonts[i] = 0; } + // note: removing mpWinFontEntry[i] here has obviously bad effects } } diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 261e1b0..b28fa67 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -475,6 +475,7 @@ WinLayout::WinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWF mrWinFontEntry(rWFE), mbUseOpenGL(bUseOpenGL) { + assert(mrWinFontEntry.mnRefCount > 0); // keep mrWinFontEntry alive mrWinFontEntry.m_pFontCache->Acquire(&mrWinFontEntry); } @@ -2527,6 +2528,11 @@ int WinSalGraphics::GetMinKashidaWidth() return nMinKashida; } +ImplFontEntry * WinSalGraphics::GetWinFontEntry(int const nFallbackLevel) +{ + return mpWinFontEntry[nFallbackLevel]; +} + ImplWinFontEntry::ImplWinFontEntry( FontSelectPattern& rFSD ) : ImplFontEntry( rFSD ) , maWidthMap( 512 ) commit f2fda745d6f11ea599bcb36eb33fef305e07110e Author: Miklos Vajna <[email protected]> Date: Tue Mar 1 09:19:41 2016 +0100 tdf#96326 RTF import: handle checkbox form field undefined result The RTF spec is quite terse on how the form filed result should be interpreted, but the binary equivalent documents properly that checkboxes have 3 valid states: 0, 1 and 25, the later meaning undefined. Use the default value in that case. (cherry picked from commit 829596eb36de32bd87b426d9ad11901eabeae7be) Change-Id: I672bf8d1f63d7880227b7fa7b5c81f91e1877b2a Reviewed-on: https://gerrit.libreoffice.org/23511 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 8de829c25511add434373e58e69df997d25e1e5c) diff --git a/sw/qa/extras/rtfimport/data/tdf96326.rtf b/sw/qa/extras/rtfimport/data/tdf96326.rtf new file mode 100644 index 0000000..a19303f --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf96326.rtf @@ -0,0 +1,27 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1035\themelangfe0\themelangcs0 +\pard\plain +This is not checked: +{\field\flddirty\fldpriv +{\*\fldinst + FORMCHECKBOX +{\*\formfield +{\fftype1\ffres25\fftypetxt0\ffhps20 +\ffdefres0} +} +} +{\fldrslt } +} +\par +This is checked: +{\field\fldpriv +{\*\fldinst + FORMCHECKBOX +{\*\formfield +{\fftype1\ffres25\fftypetxt0\ffhps20 +\ffdefres1} +} +} +{\fldrslt } +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 1c4b457..7c9c098 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/text/XFormField.hpp> #include <rtl/ustring.hxx> #include <vcl/outdev.hxx> @@ -1278,6 +1279,20 @@ DECLARE_RTFIMPORT_TEST(testPoshPosv, "posh-posv.rtf") CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "FrameIsAutomaticHeight")); } +DECLARE_RTFIMPORT_TEST(testTdf96326, "tdf96326.rtf") +{ + // Make sure this is not checked. + auto xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(1), 2), "Bookmark"); + uno::Reference<container::XNameContainer> xParameters = xFormField->getParameters(); + // This was true, ffres=25 was interpreted as checked. + CPPUNIT_ASSERT_EQUAL(false, bool(xParameters->hasElements())); + + // And this is checked. + xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(2), 2), "Bookmark"); + xParameters = xFormField->getParameters(); + CPPUNIT_ASSERT_EQUAL(true, xParameters->getByName("Checkbox_Checked").get<bool>()); +} + DECLARE_RTFIMPORT_TEST(testN825305, "n825305.rtf") { // The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0. diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index f9cf146..db18c5b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -4438,7 +4438,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_default, pIntValue); break; case RTF_FFRES: - if (m_nFormFieldType == RTFFormFieldType::CHECKBOX) + // 25 means undefined, see [MS-DOC] 2.9.79, FFDataBits. + if (m_nFormFieldType == RTFFormFieldType::CHECKBOX && nParam != 25) m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_checked, pIntValue); else if (m_nFormFieldType == RTFFormFieldType::LIST) m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_result, pIntValue); commit 6fdbedf117ed1929adb52e566174cdeaf44616db Author: Miklos Vajna <[email protected]> Date: Tue Mar 29 14:03:00 2016 +0200 tdf#98882 DOCX import: set default para properties on the Standard para style That's what the DOC import does, and that's the reason e.g. the strange unwanted crop of the as-char anchored picture doesn't happen there. This also needs the "reset all existing style properties back to default" logic to be adapted: the Standard style has to be reset before the default are set, and later it should be left alone, otherwise the defaults are lost. (cherry picked from commit eae2331f83bd58bacccd898d60f6c5f54856c036) Change-Id: Ie422a0b64b80a826fa4f469145a26283fb32d734 Reviewed-on: https://gerrit.libreoffice.org/23598 Tested-by: Jenkins <[email protected]> Reviewed-by: Andras Timar <[email protected]> (cherry picked from commit 490ce780fa876ec14055d95339933ea0081ce0e7) diff --git a/sw/qa/extras/ooxmlimport/data/tdf98882.docx b/sw/qa/extras/ooxmlimport/data/tdf98882.docx new file mode 100644 index 0000000..53c1098 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf98882.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index c280b54..a5b5cac 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2909,6 +2909,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf95213, "tdf95213.docx") CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xStyle, "CharWeight")); } +DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx") +{ + sal_Int32 nFlyHeight = parseDump("//fly/infos/bounds", "height").toInt32(); + sal_Int32 nContentHeight = parseDump("//notxt/infos/bounds", "height").toInt32(); + // The content height was 600, not 360, so the frame and the content height did not match. + CPPUNIT_ASSERT_EQUAL(nFlyHeight, nContentHeight); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index f7e632d..017f114 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -304,6 +304,8 @@ struct StyleSheetTable_Impl /// Appends the given key-value pair to the list of latent style properties of the current entry. void AppendLatentStyleProperty(const OUString& aName, Value& rValue); + /// Sets all properties of xStyle back to default. + void SetPropertiesToDefault(const uno::Reference<style::XStyle>& xStyle); }; @@ -378,6 +380,35 @@ void StyleSheetTable_Impl::AppendLatentStyleProperty(const OUString& aName, Valu m_pCurrentEntry->aLatentStyles.push_back(aValue); } +void StyleSheetTable_Impl::SetPropertiesToDefault(const uno::Reference<style::XStyle>& xStyle) +{ + // See if the existing style has any non-default properties. If so, reset them back to default. + uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY); + uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); + uno::Sequence<beans::Property> aProperties = xPropertySetInfo->getProperties(); + std::vector<OUString> aPropertyNames; + for (sal_Int32 i = 0; i < aProperties.getLength(); ++i) + { + aPropertyNames.push_back(aProperties[i].Name); + } + + uno::Reference<beans::XPropertyState> xPropertyState(xStyle, uno::UNO_QUERY); + uno::Sequence<beans::PropertyState> aStates = xPropertyState->getPropertyStates(comphelper::containerToSequence(aPropertyNames)); + for (sal_Int32 i = 0; i < aStates.getLength(); ++i) + { + if (aStates[i] == beans::PropertyState_DIRECT_VALUE) + { + try + { + xPropertyState->setPropertyToDefault(aPropertyNames[i]); + } + catch(const uno::Exception& rException) + { + SAL_INFO("writerfilter", "setPropertyToDefault(" << aPropertyNames[i] << ") failed: " << rException.Message); + } + } + } +} StyleSheetTable::StyleSheetTable(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> const& xTextDocument, @@ -961,32 +992,9 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable ) } xStyles->getByName( sConvertedStyleName ) >>= xStyle; - // See if the existing style has any non-default properties. If so, reset them back to default. - uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY); - uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); - uno::Sequence<beans::Property> aProperties = xPropertySetInfo->getProperties(); - std::vector<OUString> aPropertyNames; - for (sal_Int32 i = 0; i < aProperties.getLength(); ++i) - { - aPropertyNames.push_back(aProperties[i].Name); - } - - uno::Reference<beans::XPropertyState> xPropertyState(xStyle, uno::UNO_QUERY); - uno::Sequence<beans::PropertyState> aStates = xPropertyState->getPropertyStates(comphelper::containerToSequence(aPropertyNames)); - for (sal_Int32 i = 0; i < aStates.getLength(); ++i) - { - if (aStates[i] == beans::PropertyState_DIRECT_VALUE) - { - try - { - xPropertyState->setPropertyToDefault(aPropertyNames[i]); - } - catch(const uno::Exception& rException) - { - SAL_INFO("writerfilter", "setPropertyToDefault(" << aPropertyNames[i] << ") failed: " << rException.Message); - } - } - } + // Standard is handled already in applyDefaults(). + if (sConvertedStyleName != "Standard") + m_pImpl->SetPropertiesToDefault(xStyle); } else { @@ -1514,12 +1522,22 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) } if( bParaProperties && m_pImpl->m_pDefaultParaProps.get()) { + uno::Reference<style::XStyleFamiliesSupplier> xStylesSupplier(m_pImpl->m_xTextDocument, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStylesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xParagraphStyles; + xStyleFamilies->getByName("ParagraphStyles") >>= xParagraphStyles; + uno::Reference<beans::XPropertySet> xStandard; + xParagraphStyles->getByName("Standard") >>= xStandard; + + uno::Reference<style::XStyle> xStyle(xStandard, uno::UNO_QUERY); + m_pImpl->SetPropertiesToDefault(xStyle); + uno::Sequence< beans::PropertyValue > aPropValues = m_pImpl->m_pDefaultParaProps->GetPropertyValues(); for( sal_Int32 i = 0; i < aPropValues.getLength(); ++i ) { try { - m_pImpl->m_xTextDefaults->setPropertyValue( aPropValues[i].Name, aPropValues[i].Value ); + xStandard->setPropertyValue(aPropValues[i].Name, aPropValues[i].Value); } catch( const uno::Exception& ) { commit aafd797aeee0333c446d69b9d1625aa9fb6e5019 Author: Eike Rathke <[email protected]> Date: Tue Mar 22 17:16:07 2016 +0100 Resolves: tdf#98642 comparing RPN insufficient in shared formula detection (cherry picked from commit d6b32653ad34f0879ad1ada421a3a2655dd766e1) Backported. Change-Id: I78812c2d6fdb3464ccc2ebeee901a76f675effa4 Reviewed-on: https://gerrit.libreoffice.org/23437 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Markus Mohrhard <[email protected]> (cherry picked from commit a84d144cc8ea2cf797583d0b9b4154690c5eeee9) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 1f9ffec..f9c92e6 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3762,7 +3762,7 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r break; case formula::svIndex: { - if(pThisTok->GetIndex() != pOtherTok->GetIndex()) + if(pThisTok->GetIndex() != pOtherTok->GetIndex() || pThisTok->IsGlobal() != pOtherTok->IsGlobal()) return NotEqual; } break; @@ -3786,6 +3786,51 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r } } + // If still the same, check lexical names as different names may result in + // identical RPN code. + + pThis = pCode->GetArray(); + nThisLen = pCode->GetLen(); + pOther = rOther.pCode->GetArray(); + nOtherLen = rOther.pCode->GetLen(); + + if ( !pThis || !pOther ) + { + // Error: no code for cells !" + return NotEqual; + } + + if ( nThisLen != nOtherLen ) + return NotEqual; + + for ( sal_uInt16 i = 0; i < nThisLen; i++ ) + { + formula::FormulaToken *pThisTok = pThis[i]; + formula::FormulaToken *pOtherTok = pOther[i]; + + if ( pThisTok->GetType() != pOtherTok->GetType() || + pThisTok->GetOpCode() != pOtherTok->GetOpCode() || + pThisTok->GetParamCount() != pOtherTok->GetParamCount() ) + { + // Incompatible type, op-code or param counts. + return NotEqual; + } + + switch (pThisTok->GetType()) + { + // All index tokens are names. Different categories already had + // different OpCode values. + case formula::svIndex: + { + if (pThisTok->GetIndex() != pOtherTok->GetIndex() || pThisTok->IsGlobal() != pOtherTok->IsGlobal()) + return NotEqual; + } + break; + default: + ; + } + } + return bInvariant ? EqualInvariant : EqualRelativeRef; } commit 976eb7d8933a9ee1b0ea7dacf463f37b158314c4 Author: Miklos Vajna <[email protected]> Date: Wed Mar 23 16:44:43 2016 +0100 tdf#88453 sw layout: fix split of nested tables with large amount of rows This does not fix the original bugdoc, just the case described in comment 2. The bugdoc has an outer table of a single cell, and that cell has a nested table with a single column and many rows. When we split the table, we set the height of the last row frame to zero, then the height of the last but one, and so on, till the reduced table fits the page, then move the 0-height frames to the next page, and so on. All this recursively, to support nested tables. The problem is that 0-height is set only for the contents of the cell frames, but not for the cell or row frames themselves, so in case e.g. the default ~0.10cm inner margin of the cell frames, even a 0-height text frame results in a cell frame height of 111 twips. And this error can accumlate if there are enough rows, e.g. with the default fonts 123 rows are enough to trigger the situation when even a completely reduced table doesn't fit the first page frame, and the layout throws up its hands. Fix the problem by setting the height of the cell and row frames to 0 as well in case their content is 0-sized anyway (so a re-format will later restore their correct height). (cherry picked from commits b4b5dbee1ec7770ed64d7270de46d5cfc06b87b6 and f4eb82cf9fea5c1df49fad6ee2d91fc51854cd29) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx sw/source/core/layout/tabfrm.cxx Change-Id: Iefbbb7bd6ef97a9a81929eb2599adb961e52fd38 Reviewed-on: https://gerrit.libreoffice.org/23513 Tested-by: Jenkins <[email protected]> Reviewed-by: Andras Timar <[email protected]> (cherry picked from commit 37b98c7d9a2598143e3c6454aced6a8ee9d2f704) diff --git a/sw/qa/extras/uiwriter/data/tdf88453-table.odt b/sw/qa/extras/uiwriter/data/tdf88453-table.odt new file mode 100644 index 0000000..2c20561 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf88453-table.odt differ diff --git a/sw/qa/extras/uiwriter/data/tdf88453.odt b/sw/qa/extras/uiwriter/data/tdf88453.odt new file mode 100644 index 0000000..de8491b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf88453.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f9d4a70b..15d359b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -110,6 +110,8 @@ public: void testTdf96536(); void testTdf96961(); void testTdf96479(); + void testTdf88453(); + void testTdf88453Table(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -157,7 +159,8 @@ public: CPPUNIT_TEST(testTdf96536); CPPUNIT_TEST(testTdf96961); CPPUNIT_TEST(testTdf96479); - + CPPUNIT_TEST(testTdf88453); + CPPUNIT_TEST(testTdf88453Table); CPPUNIT_TEST_SUITE_END(); private: @@ -1340,6 +1343,25 @@ void SwUiWriterTest::testTdf96479() } } +void SwUiWriterTest::testTdf88453() +{ + createDoc("tdf88453.odt"); + calcLayout(); + xmlDocPtr pXmlDoc = parseLayoutDump(); + // This was 0: the table does not fit the first page, but it wasn't split + // to continue on the second page. + assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1); +} + +void SwUiWriterTest::testTdf88453Table() +{ + createDoc("tdf88453-table.odt"); + calcLayout(); + // This was 2: layout could not split the large outer table in the document + // into 3 pages. + CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 4f80e08..e6c25fd 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -330,6 +330,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrm& rRow ) SwCellFrm* pCurrMasterCell = static_cast<SwCellFrm*>(rRow.Lower()); SWRECTFN( pCurrMasterCell ) + bool bAllCellsCollapsed = true; while ( pCurrMasterCell ) { // NEW TABLES @@ -346,6 +347,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrm& rRow ) // we have to start with the last lower frame, otherwise // the shrink will not shrink the current cell SwFrm* pTmp = rToAdjust.GetLastLower(); + bool bAllLowersCollapsed = true; if ( pTmp && pTmp->IsRowFrm() ) { @@ -361,17 +363,36 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrm& rRow ) if ( pTmp->IsTabFrm() ) { SwRowFrm* pTmpRow = static_cast<SwRowFrm*>(static_cast<SwTabFrm*>(pTmp)->Lower()); + bool bAllRowsCollapsed = true; + while ( pTmpRow ) { lcl_ShrinkCellsAndAllContent( *pTmpRow ); + + if ((pTmpRow->Frm().*fnRect->fnGetHeight)() > 0) + bAllRowsCollapsed = false; + pTmpRow = static_cast<SwRowFrm*>(pTmpRow->GetNext()); } + + if (bAllRowsCollapsed) + { + // All rows of this table have 0 height -> set height of the table itself as well. + (pTmp->Frm().*fnRect->fnSetHeight)(0); + (pTmp->Prt().*fnRect->fnSetTop)(0); + (pTmp->Prt().*fnRect->fnSetHeight)(0); + } + else + bAllLowersCollapsed = false; } else { pTmp->Shrink( (pTmp->Frm().*fnRect->fnGetHeight)() ); (pTmp->Prt().*fnRect->fnSetTop)( 0 ); (pTmp->Prt().*fnRect->fnSetHeight)( 0 ); + + if ((pTmp->Frm().*fnRect->fnGetHeight)() > 0) + bAllLowersCollapsed = false; } pTmp = pTmp->GetPrev(); @@ -383,8 +404,26 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrm& rRow ) false ); } + if (bAllLowersCollapsed) + { + // All lower frame of this cell have 0 height -> set height of the cell itself as well. + (pCurrMasterCell->Frm().*fnRect->fnSetHeight)(0); + (pCurrMasterCell->Prt().*fnRect->fnSetTop)(0); + (pCurrMasterCell->Prt().*fnRect->fnSetHeight)(0); + } + else + bAllCellsCollapsed = false; + pCurrMasterCell = static_cast<SwCellFrm*>(pCurrMasterCell->GetNext()); } + + if (bAllCellsCollapsed) + { + // All cells have 0 height -> set height of row as well. + (rRow.Frm().*fnRect->fnSetHeight)(0); + (rRow.Prt().*fnRect->fnSetTop)(0); + (rRow.Prt().*fnRect->fnSetHeight)(0); + } } // Local helper function to move the content from rSourceLine to rDestLine commit cbed174f94dd2b262e97d09f40cd5e9fd6f34852 Author: Miklos Vajna <[email protected]> Date: Tue Feb 23 09:13:40 2016 +0100 tdf#59699 RTF import: handle INCLUDEPICTURE field On one hand, don't handle a fieldmark for it in dmapper. On the other hand, handle the field in the RTF tokenizer as it would be {\pict ...hexdump... }, that will result in an inline picture, as wanted. (cherry picked from commit 6f94cab9c43f88624b58a47ad03ad5f87032595d) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/rtftok/rtfdocumentimpl.hxx Change-Id: I554fdf017920350144300fd86617bf74eed8995b Reviewed-on: https://gerrit.libreoffice.org/23298 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit b5464c15078b57e852100a76f03fadef3186c93d) diff --git a/sw/qa/extras/rtfimport/data/libreoffice.png b/sw/qa/extras/rtfimport/data/libreoffice.png new file mode 100644 index 0000000..437f613 Binary files /dev/null and b/sw/qa/extras/rtfimport/data/libreoffice.png differ diff --git a/sw/qa/extras/rtfimport/data/tdf59699.rtf b/sw/qa/extras/rtfimport/data/tdf59699.rtf new file mode 100644 index 0000000..94331cc --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf59699.rtf @@ -0,0 +1,10 @@ +{\rtf1 +\pard\plain +{\field +{\*\fldinst +{ INCLUDEPICTURE "libreoffice.png" \\* MERGEFORMAT \\d } +} +{\fldrslt} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f1d0927..1c4b457 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> #include <rtl/ustring.hxx> #include <vcl/outdev.hxx> @@ -628,6 +629,14 @@ DECLARE_RTFIMPORT_TEST(testFdo49659, "fdo49659.rtf") CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType")); } +DECLARE_OOXMLIMPORT_TEST(testTdf59699, "tdf59699.rtf") +{ + // This resulted in a lang.IndexOutOfBoundsException: the referenced graphic data wasn't imported. + uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY); + auto xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic"); + CPPUNIT_ASSERT(xGraphic.is()); +} + DECLARE_RTFIMPORT_TEST(testFdo46966, "fdo46966.rtf") { /* diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index 6149401..c81ff56 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Library_set_include,writerfilter,\ $$(INCLUDE) \ -I$(SRCDIR)/writerfilter/inc \ -I$(SRCDIR)/writerfilter/source \ + -I$(SRCDIR)/writerfilter/source/dmapper \ )) $(eval $(call gb_Library_use_sdk_api,writerfilter)) diff --git a/writerfilter/inc/rtftok/RTFDocument.hxx b/writerfilter/inc/rtftok/RTFDocument.hxx index 01a9880..1d96bec 100644 --- a/writerfilter/inc/rtftok/RTFDocument.hxx +++ b/writerfilter/inc/rtftok/RTFDocument.hxx @@ -15,6 +15,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <unotools/mediadescriptor.hxx> namespace writerfilter { @@ -44,7 +45,7 @@ public: css::uno::Reference<css::lang::XComponent> const& xDstDoc, css::uno::Reference<css::frame::XFrame> const& xFrame, css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator, - bool bIsNewDoc); + const utl::MediaDescriptor& rMediaDescriptor); }; } // namespace rtftok } // namespace writerfilter diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 02a965a..2906e24 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2816,7 +2816,7 @@ if(!bFilled) {OUString("HYPERLINK"), "", "", FIELD_HYPERLINK }, {OUString("IF"), "ConditionalText", "", FIELD_IF }, // {OUString("INFO"), "","", FIELD_INFO }, -// {OUString("INCLUDEPICTURE"), "", "", FIELD_INCLUDEPICTURE}, + {OUString("INCLUDEPICTURE"), "", "", FIELD_INCLUDEPICTURE}, {OUString("KEYWORDS"), "DocInfo.KeyWords", "", FIELD_KEYWORDS }, {OUString("LASTSAVEDBY"), "DocInfo.ChangeAuthor", "", FIELD_LASTSAVEDBY }, {OUString("MACROBUTTON"), "Macro", "", FIELD_MACROBUTTON }, @@ -3516,6 +3516,7 @@ void DomainMapper_Impl::CloseFieldCommand() case FIELD_CITATION: case FIELD_TC: case FIELD_EQ: + case FIELD_INCLUDEPICTURE: bCreateField = false; break; case FIELD_FORMCHECKBOX : diff --git a/writerfilter/source/dmapper/FieldTypes.hxx b/writerfilter/source/dmapper/FieldTypes.hxx index 0ce6e1f..a9b8a2e 100644 --- a/writerfilter/source/dmapper/FieldTypes.hxx +++ b/writerfilter/source/dmapper/FieldTypes.hxx @@ -120,7 +120,6 @@ enum FieldId ,FIELD_INFO /* INCLUDEPICTURE path \* MERGEFORMAT-> old filter imports an embedded picture - todo: not yet supported */ ,FIELD_INCLUDEPICTURE /* KEYWORDS keyword \* defaultswitch \* Numberingswitch \* MERGEFORMAT -> diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index 7bf88b2..96f8d15 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -148,7 +148,7 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescrip writerfilter::Stream::Pointer_t pStream( writerfilter::dmapper::DomainMapperFactory::createMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, eType, xInsertTextRange, aMediaDesc)); writerfilter::rtftok::RTFDocument::Pointer_t pDocument( - writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator, bIsNewDoc)); + writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator, aMediaDesc)); pDocument->resolve(*pStream); bResult = true; sal_uInt32 nEndTime = osl_getGlobalTimer(); diff --git a/writerfilter/source/rtftok/rtfdocumentfactory.cxx b/writerfilter/source/rtftok/rtfdocumentfactory.cxx index 0722bff..aadfc38 100644 --- a/writerfilter/source/rtftok/rtfdocumentfactory.cxx +++ b/writerfilter/source/rtftok/rtfdocumentfactory.cxx @@ -19,9 +19,9 @@ RTFDocument::Pointer_t RTFDocumentFactory::createDocument(css::uno::Reference< c css::uno::Reference< css::lang::XComponent > const& xDstDoc, css::uno::Reference< css::frame::XFrame > const& xFrame, css::uno::Reference< css::task::XStatusIndicator > const& xStatusIndicator, - bool bIsNewDoc) + const utl::MediaDescriptor& rMediaDescriptor) { - return std::make_shared<RTFDocumentImpl>(xContext, xInputStream, xDstDoc, xFrame, xStatusIndicator, bIsNewDoc); + return std::make_shared<RTFDocumentImpl>(xContext, xInputStream, xDstDoc, xFrame, xStatusIndicator, rMediaDescriptor); } } // namespace rtftok diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index c6f3d32..f9cf146 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -35,6 +35,8 @@ #include <ooxml/resourceids.hxx> #include <oox/token/namespaces.hxx> #include <oox/drawingml/drawingmltypes.hxx> +#include <rtl/uri.hxx> +#include <dmapper/DomainMapper_Impl.hxx> #include <rtfsdrimport.hxx> #include <rtflookahead.hxx> #include <rtfcharsets.hxx> @@ -212,7 +214,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x uno::Reference<lang::XComponent> const& xDstDoc, uno::Reference<frame::XFrame> const& xFrame, uno::Reference<task::XStatusIndicator> const& xStatusIndicator, - bool bIsNewDoc) + const utl::MediaDescriptor& rMediaDescriptor) : m_xContext(xContext), m_xInputStream(xInputStream), m_xDstDoc(xDstDoc), @@ -272,7 +274,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x m_bHadSect(false), m_nCellxMax(0), m_nListPictureId(0), - m_bIsNewDoc(bIsNewDoc) + m_bIsNewDoc(!rMediaDescriptor.getUnpackedValueOrDefault("InsertMode", false)), + m_rMediaDescriptor(rMediaDescriptor) { OSL_ASSERT(xInputStream.is()); m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, true)); @@ -343,7 +346,7 @@ void RTFDocumentImpl::resolveSubstream(sal_Size nPos, Id nId, OUString& rIgnoreF { sal_Size nCurrent = Strm().Tell(); // Seek to header position, parse, then seek back. - auto pImpl = std::make_shared<RTFDocumentImpl>(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, m_xStatusIndicator, m_bIsNewDoc); + auto pImpl = std::make_shared<RTFDocumentImpl>(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, m_xStatusIndicator, m_rMediaDescriptor); pImpl->setSuperstream(this); pImpl->setStreamType(nId); pImpl->setIgnoreFirst(rIgnoreFirst); @@ -1544,6 +1547,24 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) if (!aBuf.isEmpty() && !isalnum(ch)) bFoundCode = true; } + + if (aBuf.toString() == "INCLUDEPICTURE") + { + // Extract the field argument of INCLUDEPICTURE: we handle that + // at a tokenizer level, as DOCX has no such field. + aBuf.append(ch); + while (true) + { + Strm().ReadChar(ch); + if (ch == '}') + break; + aBuf.append(ch); + } + OUString aFieldCommand = OStringToOUString(aBuf.toString(), RTL_TEXTENCODING_UTF8); + boost::tuple<OUString, std::vector<OUString>, std::vector<OUString> > aResult = writerfilter::dmapper::lcl_SplitFieldCommand(aFieldCommand); + m_aPicturePath = boost::get<1>(aResult).empty() ? OUString() : boost::get<1>(aResult).front(); + } + Strm().Seek(nPos); // Form data should be handled only for form fields if any @@ -5124,6 +5145,46 @@ RTFError RTFDocumentImpl::popState() break; case Destination::FIELDRESULT: singleChar(cFieldEnd); + + if (!m_aPicturePath.isEmpty()) + { + // Read the picture into m_aStates.top().aDestinationText. + pushState(); + dispatchDestination(RTF_PICT); + if (m_aPicturePath.endsWith(".png")) + dispatchFlag(RTF_PNGBLIP); + OUString aFileURL = m_rMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL(), OUString()); + OUString aPictureURL; + try + { + aPictureURL = rtl::Uri::convertRelToAbs(aFileURL, m_aPicturePath); + } + catch(const rtl::MalformedUriException& rException) + { + SAL_WARN("writerfilter", "rtl::Uri::convertRelToAbs() failed: " << rException.getMessage()); + } + + if (!aPictureURL.isEmpty()) + { + SvFileStream aStream(aPictureURL, StreamMode::READ); + if (aStream.IsOpen()) + { + OUStringBuffer aBuf; + while (aStream.good()) + { + unsigned char ch = 0; + aStream.ReadUChar(ch); + if (ch < 16) + aBuf.append("0"); + aBuf.append(OUString::number(ch, 16)); + } + m_aStates.top().aDestinationText = aBuf; + } + } + popState(); + m_aPicturePath.clear(); + } + break; case Destination::LEVELTEXT: { diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 863b952..823ccc2 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -332,7 +332,7 @@ public: css::uno::Reference<css::lang::XComponent> const& xDstDoc, css::uno::Reference<css::frame::XFrame> const& xFrame, css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator, - bool bIsNewDoc); + const utl::MediaDescriptor& rMediaDescriptor); virtual ~RTFDocumentImpl(); // RTFDocument @@ -565,6 +565,8 @@ private: bool m_bFormField; /// If a frame start token is already sent to dmapper (nesting them is not OK). bool m_bIsInFrame; + /// For the INCLUDEPICTURE field's argument. + OUString m_aPicturePath; // Unicode characters are collected here so we don't have to send them one by one. OUStringBuffer m_aUnicodeBuffer; /// Same for hex characters. @@ -593,6 +595,8 @@ private: /// New document means not pasting into an existing one. bool m_bIsNewDoc; + /// The media descriptor contains e.g. the base URL of the document. + const utl::MediaDescriptor& m_rMediaDescriptor; }; } // namespace rtftok } // namespace writerfilter commit 0d1e9f68b962ed3e86fc7b6e06abb29cca83196a Author: Eike Rathke <[email protected]> Date: Mon Feb 29 17:54:50 2016 +0100 fix the "group not recalculated after delete" second part of tdf#97897 If a formula cell group was split during deletion and the group also listened into the range where a cell was deleted, the group wasn't notified of the deletion. Change-Id: I858f5d4c0b647636611133fc32f3df7fbdaf7288 (cherry picked from commit 164419bfe6270015ccf94183c0b6273da7730391) Reviewed-on: https://gerrit.libreoffice.org/22784 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Markus Mohrhard <[email protected]> (cherry picked from commit 1bfc042ea7af6f7b3b0410cb03cef41a358582d4) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index dd56015..88ffed8 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1833,6 +1833,24 @@ void ScDocument::DeleteArea( // Re-start listeners on those top bottom groups that have been split. SetNeedsListeningGroups(aGroupPos); StartNeededListeners(); + + // If formula groups were split their listeners were destroyed and may + // need to be notified now that they're restored, ScTable::DeleteArea() + // couldn't do that. + if (!aGroupPos.empty()) + { + ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0); + for (SCTAB i = 0; i < static_cast<SCTAB>(maTabs.size()); i++) + { + if (rMark.GetTableSelect(i)) + { + aRange.aStart.SetTab(i); + aRange.aEnd.SetTab(i); + + SetDirty( aRange, true); + } + } + } } } commit 0808f3c18f48446ed86397f2b75638011070e9c2 Author: Lionel Elie Mamane <[email protected]> Date: Mon Mar 21 16:11:45 2016 +0100 off-by-one error: columns are numbered from one, but the array from 0 Change-Id: I14ef451999fa1f9d57757a9e231fc66be4e53f3a Reviewed-on: https://gerrit.libreoffice.org/23406 Tested-by: Jenkins <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 1f7af80f020a9114d7b6b4014a4ebb71cb81d8a1) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 6b2400e..58be2f2 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -944,7 +944,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa for(sal_Int32 i = 1;aParaIter != aParaEnd;++aParaIter,++aParaValuesIter,++i) { ORowSetValue aValue(*aParaValuesIter); - aValue.setSigned(m_aSignedFlags[aParaIter->second.nPosition]); + aValue.setSigned(m_aSignedFlags[aParaIter->second.nPosition-1]); if ( (_rInsertRow->get())[aParaIter->second.nPosition] != aValue ) { ORowSetValueVector aCopy(m_aParameterValueForCache); commit 0b4c612c5100eb8300f434b8d5d7ad5cec8bcbee Author: Bjoern Michaelsen <[email protected]> Date: Tue Mar 22 15:41:04 2016 +0100 tdf#95977: fix fly positioning regression from 0c5cbcd7 Change-Id: I7e11c7072ba0ec82237985da79f8572fdda05778 Reviewed-on: https://gerrit.libreoffice.org/23430 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Michael Stahl <[email protected]> (cherry picked from commit 01ba19094272cb661f781c091fd11f3a01dc1ea0) diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index a500fe3..0423ea7 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1221,7 +1221,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) nY -= pCnt->GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid(); } else - nY = rNew.Y() - pCnt->Frm().Top() + pCnt->GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid(); + nY = rNew.Y() - pCnt->Frm().Top() - pCnt->GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid(); } else { commit 8987a2351031d5dc9d3c89b25723e26b4db4ed91 Author: Giuseppe Castagno <[email protected]> Date: Thu Mar 10 14:54:28 2016 +0100 tdf#98416: Explicitly disable curl hardcoded CA certificate store Add --without-ca-bundle --without-ca-path options to curl configure in Linux, to explicitly disable the hardcoded curl CA certificate store. If the store is not disabled, curl configure will try to find one suitable for the Linux distro on which it's being built, leading to possible problems when building on a Linux distro type while targeting another Linux distro type (e.g. building on Red Hat derivative targeting Debian derivative). Change-Id: Id1ddf1d74e33bc66e4f7187e376d7379f5c4f36a Reviewed-on: https://gerrit.libreoffice.org/23141 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 30b9c6a457de61f3c94431ecc75716f866c3379e) Reviewed-on: https://gerrit.libreoffice.org/23245 Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 0f567d9316941f0fcca4c260ad1e92fbe1a0df2d) diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index 4222419..dc12c4b 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -52,6 +52,7 @@ $(call gb_ExternalProject_get_state_target,curl,build): --without-librtmp --disable-ldaps --disable-tftp --disable-pop3 \ --disable-imap --disable-smtp --disable-manual --without-metalink \ --without-nghttp2 \ + $(if $(filter LINUX,$(OS)),--without-ca-bundle --without-ca-path) \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \ $(if $(ENABLE_DEBUG),--enable-debug) \ commit 5f7e5b74a474811cc23a1cfde304a985b20d77a0 Author: Samuel Mehrbrodt <[email protected]> Date: Fri Mar 18 11:25:59 2016 +0100 tdf#98740 Infobar should not be in the customization options Change-Id: Ib6675d621ad9c6ee5c4576ff95bb6eac39ef4b5f Reviewed-on: https://gerrit.libreoffice.org/23357 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> Tested-by: Adolfo Jayme Barrientos <[email protected]> (cherry picked from commit 97887e5bae7179e1ea03320422c14b23e5e6013d) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index fbb8f60..944ca41 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3539,10 +3539,10 @@ SfxBoolItem InfoBar SID_INFOBAR Readonly = FALSE, /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, + AccelConfig = FALSE, + MenuConfig = FALSE, StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, + ToolBoxConfig = FALSE, GroupId = GID_DOCUMENT; ] commit 0685e53b9f8172d05b444322c3a24752252a96c7 Author: Eike Rathke <[email protected]> Date: Wed Mar 16 23:03:58 2016 +0100 ensure a correct index is assigned to a duplicated ScRangeData instance ScRangeName::insert() assigns an index only if the passed ScRangeData instance's index was 0. Duplicating an ScRangeData object duplicates also the index, so effectively two instances with the same index could be inserted to the named expressions collection, a following ScRangeName::findByIndex() retrieved one of them by chance. Change-Id: Ic141ffb1a683bda5907f4359167da84faf1649e1 (cherry picked from commit 336d816176650726f6d14539464d9fd28ddd032d) Reviewed-on: https://gerrit.libreoffice.org/23324 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> (cherry picked from commit d277c677ba430ee682c291da1a178f85ac98c424) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index b34261b..1f9ffec 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -331,6 +331,7 @@ void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const S { bNewGlobal = bOldGlobal; pRangeData = new ScRangeData(*pOldRangeData, &rNewDoc); + pRangeData->SetIndex(0); // needed for insert to assign a new index ScTokenArray* pRangeNameToken = pRangeData->GetCode(); if (rNewDoc.GetPool() != const_cast<ScDocument*>(pOldDoc)->GetPool()) { commit 475681f2b22d6c222c6e1e0fa02adbf9d9995050 Author: Regina Henschel <[email protected]> Date: Thu Mar 17 20:00:08 2016 +0100 tdf#95421 Galaxy anchor markers can be dragged again The anchor markers in Writer could not be dragged, in case the Galaxy icon-theme is used. The reason is, that in their corner color is missing. The altered file adds some very transparent gray in the corners. The change is hardly visible. Change-Id: I6e0befcbf16826d4331bf0b9771b58c02a73e37f Reviewed-on: https://gerrit.libreoffice.org/23342 Tested-by: Jenkins <[email protected]> Reviewed-by: Adolfo Jayme Barrientos <[email protected]> (cherry picked from commit 243f8abf829323877733612c311019ec63956d82) Signed-off-by: Adolfo Jayme Barrientos <[email protected]> (cherry picked from commit e7e1720e5751e5ff8b6af4e1324f01a74b28a4a8) diff --git a/icon-themes/galaxy/svx/res/markers.png b/icon-themes/galaxy/svx/res/markers.png index 9627d5a..cd475bc 100644 Binary files a/icon-themes/galaxy/svx/res/markers.png and b/icon-themes/galaxy/svx/res/markers.png differ commit 00778b8a5db5d20b66ed7d0534ffae8181c8b610 Author: Jan Holesovsky <[email protected]> Date: Thu Mar 17 15:51:42 2016 +0100 tdf#98458 sw: Fix performance problem when searching in large documents. Change-Id: I0056a411d7a3bb018401d87bdd4a0112fed31df6 Reviewed-on: https://gerrit.libreoffice.org/23340 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 80d1589229926122adad60ff4ca1b045a54a5efa) diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 243a57d..7668942 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -242,6 +242,10 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te rSearchOpt.searchString == "$^" ); const bool bChkParaEnd = bRegSearch && rSearchOpt.searchString == "$"; + SvxSearchItem aSearchItem(SID_SEARCH_ITEM); // this is a very expensive operation (calling configmgr etc.) + aSearchItem.SetSearchOptions(rSearchOpt); + aSearchItem.SetBackward(!bSrchForward); + // LanguageType eLastLang = 0; while( 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly ) )) { @@ -299,10 +303,6 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te SwWrtShell *const pWrtShell = (pDocShell) ? pDocShell->GetWrtShell() : 0; SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : 0; - SvxSearchItem aSearchItem(SID_SEARCH_ITEM); - aSearchItem.SetSearchOptions(rSearchOpt); - aSearchItem.SetBackward(!bSrchForward); - // If there is an active text edit, then search there. bool bEndedTextEdit = false; SdrView* pSdrView = pWrtShell->GetDrawView();
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
