core.git: svx/source sw/qa
svx/source/xoutdev/_xoutbmp.cxx|9 +++-- sw/qa/extras/htmlexport/data/tdf162282.odt |binary sw/qa/extras/htmlexport/htmlexport.cxx | 44 + 3 files changed, 49 insertions(+), 4 deletions(-) New commits: commit 7a1a0607501e47ff03b1b66e1189a221d327bad4 Author: Mike Kaganski AuthorDate: Thu Aug 1 18:21:00 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Aug 1 20:33:52 2024 +0200 tdf#162282: restore correct handling of EMF Commit 166a16594eb4e7e78f3f5b00a1432637d109bf8d (Simplify logic in XOutBitmap::WriteGraphic a bit, 2023-04-01) changed the logic, so that when the graphic's data reported VectorGraphicDataType::Wmf type, it wasn't further checked if its link's IsEMF returns true. That made isKnownVectorFormat return false for such EMFs, and so the graphic was exported to a new EMF, instead of using its data. This restores the original behavior. Change-Id: I68b807e735e501de6bf37172390623938e401e6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171377 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index f3923e378a1e..1c7ecadb34cf 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -127,6 +127,10 @@ static OUString isKnownVectorFormat(const Graphic& rGraphic, std::u16string_view if (!pData || pData->getBinaryDataContainer().getSize() == 0) return {}; +if (FORMAT_EMF.equalsIgnoreAsciiCase(rFilter) +&& (pData->getType() == VectorGraphicDataType::Emf || rGraphic.GetGfxLink().IsEMF())) +return FORMAT_EMF; + // Does the filter name match the original format? switch (pData->getType()) { @@ -135,14 +139,11 @@ static OUString isKnownVectorFormat(const Graphic& rGraphic, std::u16string_view case VectorGraphicDataType::Wmf: return match(rFilter, FORMAT_WMF, false); case VectorGraphicDataType::Emf: -return match(rFilter, FORMAT_EMF, false); +break; case VectorGraphicDataType::Pdf: return match(rFilter, FORMAT_PDF, false); } -if (rGraphic.GetGfxLink().IsEMF()) -return match(rFilter, FORMAT_EMF, false); - return {}; } diff --git a/sw/qa/extras/htmlexport/data/tdf162282.odt b/sw/qa/extras/htmlexport/data/tdf162282.odt new file mode 100644 index ..b67fd119bc28 Binary files /dev/null and b/sw/qa/extras/htmlexport/data/tdf162282.odt differ diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index e510d7d2e7ab..5de5ef5f155f 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3388,6 +3388,50 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_exportRelativeURLs) CPPUNIT_ASSERT(url.endsWith(".gif")); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_162282) +{ +// Given a document with an embedded metafile: +createSwDoc("tdf162282.odt"); +ExportToReqif(); +xmlDocUniquePtr pDoc = WrapReqifFromTempFile(); + +// Check that the exported EMF is exactly the same as in the ODF package +assertXPath(pDoc, "//reqif-xhtml:p/reqif-xhtml:object"_ostr, "type"_ostr, u"image/x-emf"_ustr); +OUString imgName = getXPath(pDoc, "//reqif-xhtml:p/reqif-xhtml:object"_ostr, "data"_ostr); +CPPUNIT_ASSERT(imgName.endsWith(".emf")); +INetURLObject aUrl(maTempFile.GetURL()); +aUrl.setName(imgName); +SvFileStream aEmfStream(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), +StreamMode::READ); + +// without the fix, this would fail with +// - Expected: 220 +// - Actual : 111260 +CPPUNIT_ASSERT_EQUAL(sal_uInt64(220), aEmfStream.TellEnd()); + +css::uno::Sequence emfData(220); +aEmfStream.ReadBytes(emfData.getArray(), emfData.getLength()); + +const css::uno::Sequence correctData{ +0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x20, 0x45, 0x4D, 0x46, 0x00, +0x00, 0x01, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, +0x00, 0x38, 0x04, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0xF4, +0x01, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, +0x2D, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, +0x00, 0xFA, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
core.git: svx/source sw/qa
svx/source/inc/UnoGraphicExporter.hxx|9 svx/source/unodraw/UnoGraphicExporter.cxx| 69 +++--- svx/source/unodraw/tableshape.cxx|2 svx/source/xoutdev/_xoutbmp.cxx | 85 sw/qa/extras/htmlexport/data/tdf161979_metafile.fodt | 200 +++ sw/qa/extras/htmlexport/htmlexport.cxx | 48 6 files changed, 334 insertions(+), 79 deletions(-) New commits: commit 37217909f2e7c042eab9a8b5eb1ab0a88cdda513 Author: Mike Kaganski AuthorDate: Wed Jul 10 12:26:37 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Jul 10 22:20:00 2024 +0200 tdf#161979: Render GDI metafile using drawinglayer in XOutBitmap After the changes related to EMF+ reworking, much of the code was removed from VCL, e.g. commit 217ad59a412ebab07a106b14c8976d20bddb9356 (tdf#111486 Removed not used EMF+ code, 2018-12-07). EMF+ code is now in drawinglayer (see EmfPlusHelperData::processEmfPlusData). Unfortunately, we can't make ImpGraphic::draw in VCL to use drawinglayer for rendering, because VCL is lower in dependency tree (it only can use drawinglayercore). Change-Id: I08f8c8ec66baf3dde1f35481144d5e1819bb5fc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170311 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/svx/source/unodraw/UnoGraphicExporter.hxx b/svx/source/inc/UnoGraphicExporter.hxx similarity index 87% rename from svx/source/unodraw/UnoGraphicExporter.hxx rename to svx/source/inc/UnoGraphicExporter.hxx index ace0db252919..65014c4d7290 100644 --- a/svx/source/unodraw/UnoGraphicExporter.hxx +++ b/svx/source/inc/UnoGraphicExporter.hxx @@ -17,17 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SVX_SOURCE_UNODRAW_UNOGRAPHICEXPORTER_HXX -#define INCLUDED_SVX_SOURCE_UNODRAW_UNOGRAPHICEXPORTER_HXX +#pragma once #include +#include #include +class Size; +class GDIMetaFile; class SdrObject; +BitmapEx GetBitmapFromMetaFile(const GDIMetaFile& rMtf, const Size* pSize); Graphic SvxGetGraphicForShape(SdrObject& rShape); -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 451b95b0e58b..72ae293ee4e2 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -66,7 +66,7 @@ #include #include #include -#include "UnoGraphicExporter.hxx" +#include #include // #i102251# #include @@ -171,37 +171,6 @@ namespace { SdrModel* mpDoc; }; -/** creates a bitmap that is optionally transparent from a metafile -*/ -BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, const Size* pSize ) -{ -// use new primitive conversion tooling -basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0)); -sal_uInt32 nMaximumQuadraticPixels(50); - -if(pSize) -{ -// use 100th mm for primitive bitmap converter tool, input is pixel -// use a real OutDev to get the correct DPI, the static LogicToLogic assumes 72dpi which is wrong (!) -const Size aSize100th(Application::GetDefaultDevice()->PixelToLogic(*pSize, MapMode(MapUnit::Map100thMM))); - -aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height())); - -// when explicitly pixels are requested from the GraphicExporter, use a *very* high limit -// of 16gb (4096x4096 pixels), else use the default for the converters -nMaximumQuadraticPixels = std::min(sal_uInt32(4096 * 4096), sal_uInt32(pSize->Width() * pSize->Height())); -} -else -{ -// use 100th mm for primitive bitmap converter tool -const Size aSize100th(OutputDevice::LogicToLogic(rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MapMode(MapUnit::Map100thMM))); - -aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height())); -} - -return convertMetafileToBitmapEx(rMtf, aRange, nMaximumQuadraticPixels); -} - Size* CalcSize( sal_Int32 nWidth, sal_Int32 nHeight, const Size& aBoundSize, Size& aOutSize ) { if( (nWidth == 0) && (nHeight == 0) ) @@ -1289,6 +1258,42 @@ Sequence< OUString > SAL_CALL GraphicExporter::getSupportedMimeTypeNames( ) } +/** creates a bitmap that is optionally transparent from a metafile +*/ +BitmapEx GetBitmapFromMetaFile(const GDIMetaFile& rMtf, const Size* pSize) +{ +// use new primitive conversion tooling +basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0)); +sal_uInt32 nMaximumQuadraticPixels; + +if (pSize) +{ +// use 100th mm for primitive bitmap converter tool, input is pixel +// use a real OutDev to get the correct DPI, the static LogicToLogic assumes 72dpi which is wrong (!) +
core.git: svx/source sw/qa
svx/source/svdraw/svdopath.cxx | 11 +++ sw/qa/extras/ooxmlexport/data/cloud.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |8 3 files changed, 15 insertions(+), 4 deletions(-) New commits: commit 08da27fc377f443d1d6698f4a061fa462849062d Author: Mike Kaganski AuthorDate: Wed May 22 20:22:08 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 22 20:53:05 2024 +0200 Handle empty range correctly Otherwise, the translation gets MAX_DBL value, and scaling becomes 0. After commit 690526f95e3ee4fd25bb2c987e093543e4bc435b (Generalize basegfx::fround for templated return type, 2024-04-15) this made some documents (e.g., bugdoc in tdf#85132) fail an assertion in debug builds, which allowed to find and fix this problem. Change-Id: I14cb0afd0c8d884f505efb921907cc8e86418da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167965 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 322b7444960f..935397d1ea61 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2850,11 +2850,14 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP // itself, else this method will no longer return the full polygon information (curve will // be lost) const basegfx::B2DRange aPolyRangeNoCurve(basegfx::utils::getRange(rPolyPolygon)); -aScale = aPolyRangeNoCurve.getRange(); -aTranslate = aPolyRangeNoCurve.getMinimum(); +if (!aPolyRangeNoCurve.isEmpty()) +{ +aScale = aPolyRangeNoCurve.getRange(); +aTranslate = aPolyRangeNoCurve.getMinimum(); -// define matrix for move polygon to zero point -aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY()); +// define matrix for move polygon to zero point +aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY()); +} } } diff --git a/sw/qa/extras/ooxmlexport/data/cloud.docx b/sw/qa/extras/ooxmlexport/data/cloud.docx new file mode 100644 index ..74c4ac91031c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cloud.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 6cfbe8d783fc..1c55be3df2cf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -553,6 +553,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154369, "tdf154369.docx") "color"_ostr, "00527d55"); } +CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange) +{ +// Before the fix, this failed an assertion like this: +// Assertion failed: isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m), +// file C:\lo+loadAndSave("cloud.docx"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/inc/findtextfield.hxx |2 svx/source/tbxctrls/tbunosearchcontrollers.cxx | 26 +++--- sw/qa/uitest/findBar/tdf154818.py | 65 + sw/qa/uitest/findReplace/findReplace.py| 22 4 files changed, 98 insertions(+), 17 deletions(-) New commits: commit 4cae4a11642f0d8f0c8005141893e34e1c216fde Author: Andreas Heinisch AuthorDate: Wed May 3 18:02:30 2023 +0200 Commit: Andreas Heinisch CommitDate: Thu May 4 12:08:55 2023 +0200 tdf#154818 - Find bar: remember and reuse last search string Changed remembered search string in the find bar from user configuration to session and added UI test. Change-Id: Idf211f1fadd87ba935fe3948c20c4e511aa8afdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151335 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx index 8cfa98f03242..2c79a529b3f4 100644 --- a/svx/source/inc/findtextfield.hxx +++ b/svx/source/inc/findtextfield.hxx @@ -67,6 +67,8 @@ private: // tdf#154269 - respect FindReplaceRememberedSearches expert option sal_uInt16 m_nRememberSize; +// tdf#154818 - remember last search string +static OUString m_sRememberedSearchString; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 1ae8a0b5c738..e2c76a9800de 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -60,7 +60,6 @@ #include #include #include -#include #include @@ -192,6 +191,9 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext } +// tdf#154818 - remember last search string +OUString FindTextFieldControl::m_sRememberedSearchString; + FindTextFieldControl::FindTextFieldControl( vcl::Window* pParent, css::uno::Reference< css::frame::XFrame > xFrame, css::uno::Reference< css::uno::XComponentContext > xContext) : @@ -260,20 +262,12 @@ void FindTextFieldControl::SetTextToSelected_Impl() m_xWidget->set_entry_text(aString); m_aChangeHdl.Call(*m_xWidget); } -else +// tdf#154818 - reuse last search string +else if (!m_sRememberedSearchString.isEmpty() || get_count() > 0) { -// tdf#154818 - reuse last search string -SvtViewOptions aDlgOpt(EViewType::Dialog, m_xWidget->get_help_id()); -if (aDlgOpt.Exists()) -{ -css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem"); -aUserItem >>= aString; -} -else if (get_count() > 0) -aString = m_xWidget->get_text(0); - // prepopulate with last search word (fdo#84256) -m_xWidget->set_entry_text(aString); +m_xWidget->set_entry_text(m_sRememberedSearchString.isEmpty() ? m_xWidget->get_text(0) + : m_sRememberedSearchString); } } @@ -340,10 +334,8 @@ IMPL_LINK(FindTextFieldControl, KeyInputHdl, const KeyEvent&, rKeyEvent, bool) void FindTextFieldControl::ActivateFind(bool bShift) { // tdf#154818 - remember last search string -const OUString aLastSearchString = m_xWidget->get_active_text(); -SvtViewOptions aDlgOpt(EViewType::Dialog, m_xWidget->get_help_id()); -aDlgOpt.SetUserItem("UserItem", css::uno::Any(aLastSearchString)); -Remember_Impl(aLastSearchString); +m_sRememberedSearchString = m_xWidget->get_active_text(); +Remember_Impl(m_sRememberedSearchString); vcl::Window* pWindow = GetParent(); ToolBox* pToolBox = static_cast(pWindow); diff --git a/sw/qa/uitest/findBar/tdf154818.py b/sw/qa/uitest/findBar/tdf154818.py new file mode 100644 index ..e0470206faf8 --- /dev/null +++ b/sw/qa/uitest/findBar/tdf154818.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf154818(UITestCase): + +def test_tdf154818_remember_search_item(self): +with self.ui_test.create_doc_in_start_center("writer"): +xWriterDoc = self.xUITest.getTopFocusWindow() +xWriterEdit = xWriterDoc.getChild("writer_edit") + +# Search for an entry and check again if it is preselected (A -> B -> A) +searchTerms = ["A", "B", "A"] +for searchTerm in searchTerms: +xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE"
[Libreoffice-commits] core.git: svx/source sw/qa vcl/source
svx/source/inc/findtextfield.hxx |3 ++ svx/source/tbxctrls/tbunosearchcontrollers.cxx | 12 +--- sw/qa/uitest/findBar/tdf154269.py | 36 + vcl/source/uitest/uiobject.cxx |1 4 files changed, 48 insertions(+), 4 deletions(-) New commits: commit b8349ca053753bb0dc713933628a1575a70677d3 Author: Andreas Heinisch AuthorDate: Wed Apr 12 12:13:17 2023 +0200 Commit: Andreas Heinisch CommitDate: Sat Apr 15 11:33:08 2023 +0200 tdf#154269 - Respect FindReplaceRememberedSearches expert option in quick find Change-Id: I88c1bed647bf6f77953ccd9921e515c1246fa96f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150273 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx index eb1b6cc11ee5..8cfa98f03242 100644 --- a/svx/source/inc/findtextfield.hxx +++ b/svx/source/inc/findtextfield.hxx @@ -64,6 +64,9 @@ private: void FocusIn(); void ActivateFind(bool bShift); + +// tdf#154269 - respect FindReplaceRememberedSearches expert option +sal_uInt16 m_nRememberSize; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 304eb8123c56..9611f4d686c0 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -73,8 +74,6 @@ constexpr OUStringLiteral COMMAND_FINDALL = u".uno:FindAll"; constexpr OUStringLiteral COMMAND_MATCHCASE = u".uno:MatchCase"; constexpr OUStringLiteral COMMAND_SEARCHFORMATTED = u".uno:SearchFormattedDisplayString"; -const sal_Int32 REMEMBER_SIZE = 10; - class CheckButtonItemWindow final : public InterimItemWindow { public: @@ -214,6 +213,11 @@ FindTextFieldControl::FindTextFieldControl( vcl::Window* pParent, m_xWidget->set_size_request(250, -1); SetSizePixel(m_xWidget->get_preferred_size()); + +// tdf#154269 - respect FindReplaceRememberedSearches expert option +m_nRememberSize = officecfg::Office::Common::Misc::FindReplaceRememberedSearches::get(); +if (m_nRememberSize < 1) +m_nRememberSize = 1; } void FindTextFieldControl::Remember_Impl(const OUString& rStr) @@ -226,8 +230,8 @@ void FindTextFieldControl::Remember_Impl(const OUString& rStr) return; } -if (nCount == REMEMBER_SIZE) -m_xWidget->remove(REMEMBER_SIZE-1); +if (nCount == m_nRememberSize) +m_xWidget->remove(m_nRememberSize - 1); m_xWidget->insert_text(0, rStr); } diff --git a/sw/qa/uitest/findBar/tdf154269.py b/sw/qa/uitest/findBar/tdf154269.py new file mode 100755 index ..d5752093b2b6 --- /dev/null +++ b/sw/qa/uitest/findBar/tdf154269.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf154269(UITestCase): + +def test_tdf154269(self): + +with self.ui_test.create_doc_in_start_center("writer"): +# Open quick search +self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") +xWriterDoc = self.xUITest.getTopFocusWindow() +xFind = xWriterDoc.getChild("find") + +# Generate a search history with more than 10 entries (A to Z) +for searchTerm in map(chr, range(65, 91)): +# Search twice to generate a search history +xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) +xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) +xFind.executeAction("TYPE", mkPropertyValues({"TEXT": searchTerm})) +xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + +# The default value of FindReplaceRememberedSearches has been respected +self.assertEqual("10", get_state_as_dict(xFind)["EntryCount"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 38079425a41d..623591e7e218 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -1224,6 +1224,7 @@ StringMap ComboBoxUIObject::get_state() { StringMap aMap = WindowUIO
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/svdraw/svdobj.cxx|8 +++ sw/qa/extras/uiwriter/uiwriter6.cxx | 37 2 files changed, 41 insertions(+), 4 deletions(-) New commits: commit fd0f6a4e83cb4a99839c73d7f545b4b80ef4657a Author: Jim Raykowski AuthorDate: Sat Nov 19 17:57:43 2022 -0900 Commit: Jim Raykowski CommitDate: Mon Nov 21 18:54:30 2022 +0100 tdf#151828 related: Make cut shape have the same name after paste when possible Fixes shape names without a number at the end of the name, having the number 1 appended to the end of the name after cut and paste in the same document. When possible - because it might happen that a shape is inserted after the cut operation and is given the same name as the cut shape name. If so, when the shape is pasted into the same document it will not have the same name as before it was cut. Change-Id: I1d1ebc76d07d81da0286d1f0bb7d34ad973a43b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142983 Tested-by: Jenkins Reviewed-by: Xisco Fauli Reviewed-by: Jim Raykowski diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 877744f4e273..34688e501eae 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -3094,6 +3094,7 @@ void SdrObject::MakeNameUnique() { if (GetName().isEmpty()) { +OUString aName; if (const E3dScene* pE3dObj = DynCastE3dScene(this)) { SdrObjList* pObjList = pE3dObj->GetSubList(); @@ -3101,11 +3102,12 @@ void SdrObject::MakeNameUnique() { SdrObject* pObj0 = pObjList->GetObj(0); if (pObj0) -SetName(pObj0->TakeObjNameSingul()); +aName = pObj0->TakeObjNameSingul(); } } else -SetName(TakeObjNameSingul()); +aName = TakeObjNameSingul(); +SetName(aName + " 1"); } std::unordered_set aNameSet; @@ -3143,8 +3145,6 @@ void SdrObject::MakeNameUnique(std::unordered_set& rNameSet) while (nPos > 0 && rtl::isAsciiDigit(sName[--nPos])); sRootName = o3tl::trim(sName.subView(0, nPos + 1)); } -else -sName += " 1"; for (sal_uInt32 n = 1; rNameSet.find(sName) != rNameSet.end(); n++) sName = sRootName + " " + OUString::number(n); diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index eac32ec1b233..2c0900fe0797 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -,6 +,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCaptionShape) CPPUNIT_ASSERT_EQUAL(1, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf151828_Comment2) +{ +createSwDoc(); + +// Add a basic shape to the document. +uno::Sequence aArgs( +comphelper::InitPropertySequence({ { "KeyModifier", uno::Any(KEY_MOD1) } })); +dispatchCommand(mxComponent, ".uno:BasicShapes", aArgs); +Scheduler::ProcessEventsToIdle(); + +auto xBasicShape = getShape(1); +auto pObject = SdrObject::getSdrObjectFromXShape(xBasicShape); + +CPPUNIT_ASSERT_EQUAL(1, getShapes()); + +// rename the shape name +pObject->SetName("Shape"); + +// cut and paste it +dispatchCommand(mxComponent, ".uno:Cut", {}); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(0, getShapes()); + +dispatchCommand(mxComponent, ".uno:Paste", {}); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(1, getShapes()); + +// it is required to get the shape objet again after paste +xBasicShape = getShape(1); +pObject = SdrObject::getSdrObjectFromXShape(xBasicShape); + +// Without fix in place, the shape name was 'Shape 1' after paste. +CPPUNIT_ASSERT_EQUAL(OUString("Shape"), pObject->GetName()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/dialog/signaturelinehelper.cxx |3 ++- sw/qa/core/unocore/unocore.cxx|1 - 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit c1128c74ad6a9efdb18db897271c7f3202a8a829 Author: Miklos Vajna AuthorDate: Wed Dec 8 19:42:31 2021 +0100 Commit: Miklos Vajna CommitDate: Thu Dec 9 08:25:30 2021 +0100 sw: remove an unused include Change-Id: Ib7be7fac788e06ee885d0eca9c082b145c889ef9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126552 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/svx/source/dialog/signaturelinehelper.cxx b/svx/source/dialog/signaturelinehelper.cxx index 560b5effd732..2b1bb9555440 100644 --- a/svx/source/dialog/signaturelinehelper.cxx +++ b/svx/source/dialog/signaturelinehelper.cxx @@ -142,7 +142,8 @@ void setShapeCertificate(const SdrView* pView, } // Remember the selected certificate. -uno::Reference xShapeProps(pSignatureLine->getUnoShape(), uno::UNO_QUERY); +uno::Reference xShape = pSignatureLine->getUnoShape(); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); comphelper::SequenceAsHashMap aMap(xShapeProps->getPropertyValue("InteropGrabBag")); aMap["SignatureCertificate"] <<= xCertificate; xShapeProps->setPropertyValue("InteropGrabBag", diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index a480a082f975..55bfa1425528 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -22,7 +22,6 @@ #include #include #include -#include using namespace ::com::sun::star;
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/xoutdev/_xoutbmp.cxx|3 ++- sw/qa/extras/htmlexport/data/ole2.odt |binary sw/qa/extras/htmlexport/htmlexport.cxx | 21 + 3 files changed, 23 insertions(+), 1 deletion(-) New commits: commit 82a444eabc38b74d762debb6f1af50e93e5b74f1 Author: Miklos Vajna AuthorDate: Mon Aug 9 16:16:35 2021 +0200 Commit: Miklos Vajna CommitDate: Mon Aug 9 20:10:41 2021 +0200 sw HTML export: avoid writing EMF data with JPG extension Regression from commit f3b2fc2276ee8a7f64e73d9975d0143d1696362c (sw XHTML import, improved handling for images: support more formats, 2021-07-20), the problem was that now an EMF image was written with the JPG extension in the HTML export. Solve the problem by making the "use emf as-is" check more strict in XOutBitmap::WriteGraphic(): that will be still true in the XHTML case when the source image is EMF, but the filter name will be JPG in the HTML case, so that will avoid the unwanted EMF data in the HTML case. Change-Id: I7bced482d677cf121be1ed494a3aaeb319e1c5b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120209 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index a2a672ede2b5..8eaec8e5a5fc 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -132,12 +132,13 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, if (rVectorGraphicDataPtr && rVectorGraphicDataPtr->getBinaryDataContainer().getSize()) { +// Does the filter name match the original format? const bool bIsSvg(rFilterName.equalsIgnoreAsciiCase("svg") && VectorGraphicDataType::Svg == rVectorGraphicDataPtr->getType()); const bool bIsWmf(rFilterName.equalsIgnoreAsciiCase("wmf") && VectorGraphicDataType::Wmf == rVectorGraphicDataPtr->getType()); bool bIsEmf(rFilterName.equalsIgnoreAsciiCase("emf") && VectorGraphicDataType::Emf == rVectorGraphicDataPtr->getType()); if (!bIsEmf) { -bIsEmf = rGraphic.GetGfxLink().IsEMF(); +bIsEmf = rFilterName.equalsIgnoreAsciiCase("emf") && rGraphic.GetGfxLink().IsEMF(); } const bool bIsPdf(rFilterName.equalsIgnoreAsciiCase("pdf") && VectorGraphicDataType::Pdf == rVectorGraphicDataPtr->getType()); diff --git a/sw/qa/extras/htmlexport/data/ole2.odt b/sw/qa/extras/htmlexport/data/ole2.odt new file mode 100644 index ..a10cfbb5b542 Binary files /dev/null and b/sw/qa/extras/htmlexport/data/ole2.odt differ diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 76f27831ec10..e58641ac6f8a 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1960,6 +1960,27 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) "list 1, header 1"); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testOleEmfPreviewToHtml) +{ +// Given a document containing an embedded object, with EMF preview: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole2.odt"; +mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + +// When exporting to HTML: +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +uno::Sequence aStoreProperties = { +comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), +}; +xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); + +// Then make sure the tag has matching file extension and data: +htmlDocUniquePtr pDoc = parseHtml(maTempFile); +OUString aPath = getXPath(pDoc, "/html/body/p/img", "src"); +// Without the accompanying fix in place, this test would have failed, as aPath was +// ole_html_3978e5f373402b43.JPG, with EMF data. +CPPUNIT_ASSERT(aPath.endsWith("gif")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: svx/source sw/qa sw/source
svx/source/xoutdev/_xoutbmp.cxx|6 +- sw/qa/extras/htmlimport/data/ole-img-svg.xhtml |7 +++ sw/qa/extras/htmlimport/data/ole2.svg |3 +++ sw/qa/extras/htmlimport/htmlimport.cxx | 24 sw/source/filter/html/htmlflywriter.cxx| 24 sw/source/filter/html/htmlplug.cxx |6 ++ 6 files changed, 69 insertions(+), 1 deletion(-) New commits: commit f3b2fc2276ee8a7f64e73d9975d0143d1696362c Author: Miklos Vajna AuthorDate: Tue Jul 20 17:13:36 2021 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 20 19:06:20 2021 +0200 sw XHTML import, improved handling for images: support more formats This was working for only png and gif in the past, handle more formats: - bmp - jpg - emf - svg - wmf - tif Change-Id: I2af42157428550977f0abab88f2ed728636d2a02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119287 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index ef2b31716a2f..a3505202310e 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -134,7 +134,11 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, { const bool bIsSvg(rFilterName.equalsIgnoreAsciiCase("svg") && VectorGraphicDataType::Svg == rVectorGraphicDataPtr->getType()); const bool bIsWmf(rFilterName.equalsIgnoreAsciiCase("wmf") && VectorGraphicDataType::Wmf == rVectorGraphicDataPtr->getType()); -const bool bIsEmf(rFilterName.equalsIgnoreAsciiCase("emf") && VectorGraphicDataType::Emf == rVectorGraphicDataPtr->getType()); +bool bIsEmf(rFilterName.equalsIgnoreAsciiCase("emf") && VectorGraphicDataType::Emf == rVectorGraphicDataPtr->getType()); +if (!bIsEmf) +{ +bIsEmf = rGraphic.GetGfxLink().IsEMF(); +} const bool bIsPdf(rFilterName.equalsIgnoreAsciiCase("pdf") && VectorGraphicDataType::Pdf == rVectorGraphicDataPtr->getType()); if (bIsSvg || bIsWmf || bIsEmf || bIsPdf) diff --git a/sw/qa/extras/htmlimport/data/ole-img-svg.xhtml b/sw/qa/extras/htmlimport/data/ole-img-svg.xhtml new file mode 100644 index ..2e063937ff20 --- /dev/null +++ b/sw/qa/extras/htmlimport/data/ole-img-svg.xhtml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/sw/qa/extras/htmlimport/data/ole2.svg b/sw/qa/extras/htmlimport/data/ole2.svg new file mode 100644 index ..552a1cf5afaf --- /dev/null +++ b/sw/qa/extras/htmlimport/data/ole2.svg @@ -0,0 +1,3 @@ + + + diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 033d53e8629b..5490f5178319 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -485,6 +485,30 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testOleImg) CPPUNIT_ASSERT_EQUAL(static_cast(1), xObjects->getCount()); } +CPPUNIT_TEST_FIXTURE(SwModelTestBase, testOleImgSvg) +{ +// Given an XHTML with an (containing SVG) and an inner (containing PNG, to be +// ignored): +uno::Sequence aLoadProperties = { +comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), +comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")), +}; +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole-img-svg.xhtml"; + +// When loading the document: +mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties); + +// Then make sure the result is a single Writer image: +uno::Reference xSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xObjects(xSupplier->getGraphicObjects(), + uno::UNO_QUERY); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 +// - Actual : 1 +// i.e. the image was not imported as a Writer image (but as an OLE object). +CPPUNIT_ASSERT_EQUAL(static_cast(1), xObjects->getCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 593a8689a83a..f528c061c9a6 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1962,6 +1962,30 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF if (!rGraphic.isAvailable()) const_cast(rGraphic).makeAvailable(); +if (rHTMLWrt.mbReqIF && bWritePNGFallback) +{ +// ReqIF: force native data if possible. +const std::shared_ptr& pVectorGraphicData = rGraphic.getVectorGraphicData(); +if (pVectorGraphicData && pVectorGraphicData->getType(
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/svdraw/svdoashp.cxx| 18 ++ sw/qa/core/layout/data/textbox-autogrow-vertical.docx |binary sw/qa/core/layout/layout.cxx | 22 ++ 3 files changed, 35 insertions(+), 5 deletions(-) New commits: commit 712d7a5df188bb20527f1a7533b2e2c1d4377247 Author: Miklos Vajna AuthorDate: Mon Nov 16 21:07:48 2020 +0100 Commit: Miklos Vajna CommitDate: Tue Nov 17 09:03:37 2020 +0100 tdf#137980 sw textbox: fix automatic size of shapes with rotated text If a shape+fly pair has automatic size for the fly frame, then only the sw layout knows the necessary size, this is then sent to the shape and SdrObjCustomShape::AdjustTextFrameWidthAndHeight() is meant to respect those "suggestion", instead of sizing the shape based on the contained editeng text, which is always empty for shape+fly pairs. Improve this mechanism so it works better when the writing direction of the fly frame is tbrl ("rotate to the right"): make sure we always grow to the left and to the bottom, so the shape and the fly geometry matches. Also improve the testTextBoxSizeAtBottomOfPage "change detector" test which had a hardcoded height, but which did not clearly derive from any in-bugdoc value. Rather just test that the shape wider than taller, which was probably the intention. Change-Id: Ic6a77a1125bbf31b198aaf9048dc4812c87b4d9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105960 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 09976fa5b7b0..29461df169a5 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2325,12 +2325,16 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bWdtGrow = false; if ( nHgtGrow == 0 ) bHgtGrow=false; -if ( bWdtGrow || bHgtGrow ) +if ( bWdtGrow || bHgtGrow || !m_aSuggestedTextFrameSize.IsEmpty()) { -if ( bWdtGrow ) +if ( bWdtGrow || m_aSuggestedTextFrameSize.Width() ) { SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust(); -if ( eHAdj == SDRTEXTHORZADJUST_LEFT ) +if (m_aSuggestedTextFrameSize.Width()) +{ +rR.SetRight(rR.Left() + m_aSuggestedTextFrameSize.Width()); +} +else if ( eHAdj == SDRTEXTHORZADJUST_LEFT ) rR.AdjustRight(nWdtGrow ); else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT ) rR.AdjustLeft( -nWdtGrow ); @@ -2341,10 +2345,14 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool rR.SetRight(rR.Left()+nWdt ); } } -if ( bHgtGrow ) +if ( bHgtGrow || m_aSuggestedTextFrameSize.Height() ) { SdrTextVertAdjust eVAdj=GetTextVerticalAdjust(); -if ( eVAdj == SDRTEXTVERTADJUST_TOP ) +if (m_aSuggestedTextFrameSize.Height()) +{ +rR.SetBottom(rR.Top() + m_aSuggestedTextFrameSize.Height()); +} +else if ( eVAdj == SDRTEXTVERTADJUST_TOP ) rR.AdjustBottom(nHgtGrow ); else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM ) rR.AdjustTop( -nHgtGrow ); diff --git a/sw/qa/core/layout/data/textbox-autogrow-vertical.docx b/sw/qa/core/layout/data/textbox-autogrow-vertical.docx new file mode 100644 index ..0cc45a781cb3 Binary files /dev/null and b/sw/qa/core/layout/data/textbox-autogrow-vertical.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index b66a4f5bbad9..15f2c4edb846 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -180,6 +180,28 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) assertXPath(pXmlDoc, "//fly/infos/bounds", "bottom", "7184"); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) +{ +load(DATA_DIRECTORY, "textbox-autogrow-vertical.docx"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); +SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); +SdrObject* pShape = pPage->GetObj(0); +tools::Rectangle aShapeRect = pShape->GetCurrentBoundRect(); + +discardDumpedLayout(); +xmlDocUniquePtr pLayout = parseLayoutDump(); +CPPUNIT_ASSERT(pLayout); +sal_Int32 nFlyLeft = getXPath(pLayout, "//fly/infos/bounds", "left").toInt32(); +sal_Int32 nFlyTop = getXPath(pLay
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/sidebar/inspector/InspectorTextPanel.cxx |4 +- sw/qa/uitest/styleInspector/styleInspector.py | 36 2 files changed, 24 insertions(+), 16 deletions(-) New commits: commit 73e0b664881d95510be9605b98a2671926f4697a Author: Tomoyuki Kubota AuthorDate: Sun Nov 1 16:24:59 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Nov 3 16:02:33 2020 +0100 tdf#137886 condition for asian and ctl property seems wrong Change-Id: Ifc11f3bbcc499143904ac7c206674cc692cf5239 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105054 Reviewed-by: Xisco Fauli Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx b/svx/source/sidebar/inspector/InspectorTextPanel.cxx index 9ebcf24f9e14..13714e22bfde 100644 --- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx +++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx @@ -62,9 +62,9 @@ InspectorTextPanel::InspectorTextPanel(vcl::Window* pParent, static bool GetPropertyValues(const OUString& rPropName, const uno::Any& rAny, OUString& rString) { // Hide Asian and Complex properties -if (SvtLanguageOptions().IsCJKFontEnabled() && rPropName.indexOf("Asian") != -1) +if (!SvtLanguageOptions().IsCJKFontEnabled() && rPropName.indexOf("Asian") != -1) return false; -if (SvtLanguageOptions().IsCTLFontEnabled() && rPropName.indexOf("Complex") != -1) +if (!SvtLanguageOptions().IsCTLFontEnabled() && rPropName.indexOf("Complex") != -1) return false; if (bool bValue; rAny >>= bValue) diff --git a/sw/qa/uitest/styleInspector/styleInspector.py b/sw/qa/uitest/styleInspector/styleInspector.py index 5eb9f8438e3e..8469d274ee3c 100644 --- a/sw/qa/uitest/styleInspector/styleInspector.py +++ b/sw/qa/uitest/styleInspector/styleInspector.py @@ -28,7 +28,7 @@ class styleNavigator(UITestCase): # The cursor is on text without formatting and default style self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) -self.assertEqual(118, len(xListBox.getChild('0').getChild('0').getChildren())) +self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) self.assertEqual(0, len(xListBox.getChild('3').getChildren())) @@ -38,7 +38,7 @@ class styleNavigator(UITestCase): # The cursor is on text with direct formatting self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) -self.assertEqual(118, len(xListBox.getChild('0').getChild('0').getChildren())) +self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) @@ -56,7 +56,7 @@ class styleNavigator(UITestCase): # The cursor is on text with paragraph direct formatting self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) -self.assertEqual(118, len(xListBox.getChild('0').getChild('0').getChildren())) +self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren())) xParDirFormatting = xListBox.getChild('1') self.assertEqual(7, len(xParDirFormatting.getChildren())) @@ -77,21 +77,29 @@ class styleNavigator(UITestCase): xParStyle = xListBox.getChild('0') self.assertEqual(3, len(xParStyle.getChildren())) self.assertEqual("Default Paragraph Style", get_state_as_dict(xParStyle.getChild('0'))['Text']) -self.assertEqual(118, len(xParStyle.getChild('0').getChildren())) +self.assertEqual(136, len(xParStyle.getChild('0').getChildren())) self.assertEqual("Heading", get_state_as_dict(xParStyle.getChild('1'))['Text']) -self.assertEqual(14, len(xParStyle.getChild('1').getChildren())) +self.assertEqual(28, len(xParStyle.getChild('1').getChildren())) xTitleStyle = xParStyle.getChild('2') self.assertEqual("Title", get_state_as_dict(xTitleStyle)['Text']) -self.assertEqual(8, len(xTitleStyle.getChildren())) +self.assertEqual(16, len(xTitleStyle.getChildren())) self.assertEqual("Char Difference Height\t0", get_state_as_dict(xTitleStyle.getChild('0'))['Text']) -self.assertEqual("Char Height\t28", get_state_as_dict(xTitleStyle.getChild('1'))['Text']) -self.assertEqual("Char Property Height\t100", get_state_as_dict(xTitleStyle.g
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/unodraw/unoshape.cxx | 59 --- sw/qa/extras/ooxmlimport/ooxmlimport.cxx |3 + 2 files changed, 56 insertions(+), 6 deletions(-) New commits: commit df57d50e00820d59b2b7104b6e59883405d0f183 Author: Armin Le Grand AuthorDate: Thu Dec 20 16:24:33 2018 +0100 Commit: Armin Le Grand CommitDate: Thu Dec 20 20:25:28 2018 +0100 tdf#119180 Use 100th_mm in UNO API implementation Since SvxShape::GetBitmap is UNO API implementation the results have to be in 100th_mm, that is how UNO API is defined. Adapted Bitmap creation common case to do so using primitve embedding if source is not 100_th_mm. Also added a shortcut if object in question already is a SdrGrafObj and contains a Bitmap. Needed to update the checksum of a graphic for testN777345. Change-Id: I995100406a262e2872597dc64e943271e92eb4cb Reviewed-on: https://gerrit.libreoffice.org/65505 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 09ec87f7ab54..27c6ab6d0f86 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -87,6 +87,7 @@ #include #include #include +#include #include @@ -685,14 +686,35 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const return aAny; } +// tdf#119180 If we do not ask for Metafile and we access a SdrGrafObj, +// and content exists and is a Bitmap, take the shortcut. +// Do *not* do this for Metafile - as can be seen, requested in that case +// is a byte-sequence of a saved WMF format file (see below) +if(!bMetaFile) +{ +const SdrGrafObj* pSdrGrafObj(dynamic_cast(GetSdrObject())); + +if(nullptr != pSdrGrafObj) +{ + const Graphic& rGraphic(pSdrGrafObj->GetGraphic()); + +if(GraphicType::Bitmap == rGraphic.GetType()) +{ +Reference< awt::XBitmap > xBmp( rGraphic.GetXGraphic(), UNO_QUERY ); +aAny <<= xBmp; + +return aAny; +} +} +} + // tdf#118662 instead of creating an E3dView instance every time to paint // a single SdrObject, use the existing SdrObject::SingleObjectPainter to // use less resources and runtime -ScopedVclPtrInstance< VirtualDevice > pVDev; -const tools::Rectangle aBoundRect(GetSdrObject()->GetCurrentBoundRect()); - if(bMetaFile) { +ScopedVclPtrInstance< VirtualDevice > pVDev; +const tools::Rectangle aBoundRect(GetSdrObject()->GetCurrentBoundRect()); GDIMetaFile aMtf; pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); @@ -721,17 +743,44 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const } else { -const drawinglayer::primitive2d::Primitive2DContainer xPrimitives( +drawinglayer::primitive2d::Primitive2DContainer xPrimitives( GetSdrObject()->GetViewContact().getViewIndependentPrimitive2DContainer()); if(!xPrimitives.empty()) { const drawinglayer::geometry::ViewInformation2D aViewInformation2D; -const basegfx::B2DRange aRange( +basegfx::B2DRange aRange( xPrimitives.getB2DRange(aViewInformation2D)); if(!aRange.isEmpty()) { +const MapUnit aSourceMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetScaleUnit()); + +if(MapUnit::Map100thMM != aSourceMapUnit) +{ +// tdf#119180 This is UNO API and thus works in 100th_mm, +// so if the MapMode from the used SdrModel is *not* equal +// to Map100thMM we need to embed the primitives to an adapting +// homogen transformation for correct values +const basegfx::B2DHomMatrix aMapTransform( +OutputDevice::LogicToLogic( +MapMode(aSourceMapUnit), +MapMode(MapUnit::Map100thMM))); + +// Embed primitives to get them in 100th mm +const drawinglayer::primitive2d::Primitive2DReference xEmbedRef( +new drawinglayer::primitive2d::TransformPrimitive2D( +aMapTransform, +xPrimitives)); + +xPrimitives = drawinglayer::primitive2d::Primitive2DContainer { xEmbedRef }; + +// Update basegfx::B2DRange aRange, too. Here we have the +// choice of transforming the existing value or get newly by +// again using 'xPrimitives.getB2DRange(aViewInformation2D)' +aRange.transform(aMapTransform); +} + const BitmapEx aBmp( convertPrimitive2DSequenceToBitmapE
[Libreoffice-commits] core.git: svx/source sw/qa sw/source
svx/source/sdr/properties/attributeproperties.cxx |4 ++-- svx/source/unodraw/unoshap2.cxx |2 +- sw/qa/extras/uiwriter/uiwriter.cxx|2 +- sw/source/core/crsr/crsrsh.cxx|2 +- sw/source/core/layout/laycache.cxx|2 +- sw/source/core/layout/tabfrm.cxx | 10 +- 6 files changed, 11 insertions(+), 11 deletions(-) New commits: commit 73ed7a5179df6543fd3b34d82b5feb9b7277b688 Author: Andrea Gelmini AuthorDate: Tue Jul 17 23:18:09 2018 +0200 Commit: Julien Nabet CommitDate: Mon Jul 23 23:39:34 2018 +0200 Fix typos Change-Id: Ia11646ac8f2f57225a1cf37725c5e0742a8489d9 Reviewed-on: https://gerrit.libreoffice.org/57605 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index ebd3f8c14780..ae498d03803c 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -187,11 +187,11 @@ namespace sdr // be the case already (SdrModel::Merge and SdDrawDocument::InsertBookmarkAsPage // have already cloned the StyleSheets to the target-SdrModel when used in Draw/impress). // If none is found, ImpGetDefaultStyleSheet will be used to set a 'default' -// StyleSheet as StyleSheet implicitely later (that's what happened in the task, +// StyleSheet as StyleSheet implicitly later (that's what happened in the task, // thus the FillStyle changed to the 'default' Blue). // Note: It *may* be necessary to do more for StyleSheets, e.g. clone/copy the // StyleSheet Hierarchy from the source SdrModel and/or add the Items from there -// as hard attibutes. If needed, have a look at the older AttributeProperties::SetModel +// as hard attributes. If needed, have a look at the older AttributeProperties::SetModel // implementation from e.g. libreoffice-6-0. SfxStyleSheetBasePool* pTargetStyleSheetPool(rObj.getSdrModelFromSdrObject().GetStyleSheetPool()); diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 4aad6e1ec6ee..20040a4ec4f4 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -208,7 +208,7 @@ void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape // pSdrShape->SetModel(GetSdrObject()->GetModel()); // #85922# It makes no sense to set the layer asked -// from the group object since these is an iteration +// from the group object since this is an iteration // over the contained objects. In consequence, this // statement erases all layer information from the draw // objects. Layers need to be set at draw objects directly diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index c4a67c96fce4..dbbacfa82639 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -6393,7 +6393,7 @@ void SwUiWriterTest::testFontEmbedding() // CASE 2 - font embedding enabled, but embed used fonts disabled -// Enable font embedding, diable embedding used font only +// Enable font embedding, disable embedding used font only xProps->setPropertyValue("EmbedFonts", uno::makeAny(true)); xProps->setPropertyValue("EmbedOnlyUsedFonts", uno::makeAny(false)); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 6c64ad10a0d1..ccb5ffc84ccf 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -293,7 +293,7 @@ void SwCursorShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) void SwCursorShell::SttCursorMove() { #ifdef DBG_UTIL -OSL_ENSURE( m_nCursorMove < USHRT_MAX, "To many nested CursorMoves." ); +OSL_ENSURE( m_nCursorMove < USHRT_MAX, "Too many nested CursorMoves." ); #endif ++m_nCursorMove; StartAction(); diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 73c38c19f4eb..675d103b3acd 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -1192,7 +1192,7 @@ void SwLayCacheIoImpl::CloseFlagRec() } else { -OSL_ENSURE( pStream->Tell() <= nFlagRecEnd, "To many data read" ); +OSL_ENSURE( pStream->Tell() <= nFlagRecEnd, "Too many data read" ); if( pStream->Tell() != nFlagRecEnd ) pStream->Seek( nFlagRecEnd ); } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 7c62601414f0..73ca3241d909 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2861,7 +2861,7 @@ void SwTabFrame::Format( vcl::Render
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/xoutdev/_xoutbmp.cxx| 20 +--- sw/qa/extras/htmlexport/htmlexport.cxx |2 +- 2 files changed, 2 insertions(+), 20 deletions(-) New commits: commit 57cc8b2e4f93b3a93ce9ac46a2a98eb2a799faa3 Author: Samuel Mehrbrodt Date: Fri May 18 16:26:37 2018 +0200 Fix svg to base64 conversion This reverts part of ab14a9708d2937bc767c14542610ce91b56dda1e which had a questionable fix by unconditionally removing the first 8 bytes of the svg which led to svgs starting with rsion="1.0" encoding="utf-8"?> instead of Change-Id: I8c4d78db1794473d20ddd77019ae81b88be0bb03 Reviewed-on: https://gerrit.libreoffice.org/54550 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 1e57b09bfe3c..3fc0110ed9e7 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -393,25 +393,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString) css::uno::Sequence aOStmSeq( static_cast(aOStm.GetData()),aOStm.Tell() ); OUStringBuffer aStrBuffer; ::comphelper::Base64::encode(aStrBuffer,aOStmSeq); -OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear(); -if( aLink.GetType() == GfxLinkType::NativeSvg ) -{ - sal_Int32 ite(8); - sal_Int32 nBufferLength(aOStmSeq.getLength()); - const sal_Int8* pBuffer = aOStmSeq.getConstArray(); - css::uno::Sequence newTempSeq = aOStmSeq;// creates new Sequence to remove front 8 bits of garbage and encodes in base64 - sal_Int8 *pOutBuffer = newTempSeq.getArray(); - while(ite < nBufferLength) - { -*pOutBuffer++ = pBuffer[ite]; -ite++; - } - ::comphelper::Base64::encode(aStrBuffer, newTempSeq); - aEncodedBase64Image = aStrBuffer.makeStringAndClear(); - sal_Int32 SVGFixLength = aEncodedBase64Image.getLength(); - aEncodedBase64Image = aEncodedBase64Image.replaceAt(SVGFixLength - 12, SVGFixLength, "") + "PC9zdmc+Cg=="; // removes rear 12 bits of garbage and adds svg closing tag in base64 -} -rOUString = aMimeType + ";base64," + aEncodedBase64Image; +rOUString = aMimeType + ";base64," + aStrBuffer.makeStringAndClear(); return true; } diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index f7aaec10a79b..4199ffeb4092 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -280,7 +280,7 @@ DECLARE_HTMLEXPORT_TEST(testExportImageBulletList, "tdf66822.odt") // Encoded base64 SVG bullet should match and render on browser assertXPath(pDoc, "/html/body/ul", 1); -assertXPath(pDoc, "/html/body/ul", "style", "list-style-image: url(data:image/svg+xml;base64,cnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8+DQo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTIuMC4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCA1MTQ0OCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIiBbDQoJPCFFTlRJVFkgbnNfc3ZnICJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQoJPCFFTlRJVFkgbnNfeGxpbmsgImh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KXT4NCjxzdmcgIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSImbnNfc3ZnOyIgeG1sbnM6eGxpbms9IiZuc194bGluazsiIHdpZHRoPSIxNC4wMDgiIGhlaWdodD0iMTQuMDEiDQoJIHZpZXdCb3g9IjAgMCAxNC4wMDggMTQuMDEiIG92ZXJmbG93PSJ2aXNpYmxlIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxNC4wMDggMTQuMDEiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHJhZGlhbEdyYWRpZW50IGlkPSJYTUxJRF80XyIgY3g9IjcuMDA0NCIgY3k9IjcuMDA0OSIgcj0iNy4wMDQ0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQoJCTxzdG9wICBvZmZzZXQ9 IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiMzNURCMzUiLz4NCgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6IzAwQTAwMCIvPg0KCTwvcmFkaWFsR3JhZGllbnQ+DQoJPGNpcmNsZSBmaWxsPSJ1cmwoI1hNTElEXzRfKSIgY3g9IjcuMDA0IiBjeT0iNy4wMDUiIHI9IjcuMDA0Ii8+DQoJPGRlZnM+DQoJCTxmaWx0ZXIgaWQ9IkFkb2JlX09wYWNpdHlNYXNrRmlsdGVyIiBmaWx0ZXJVbml0cz0idXNlclNwYWNlT25Vc2UiIHg9IjMuNDgxIiB5PSIwLjY5MyIgd2lkdGg9IjYuOTg4IiBoZWlnaHQ9IjMuODkzIj4NCgkJCTxmZUNvbG9yTWF0cml4ICB0eXBlPSJtYXRyaXgiIHZhbHVlcz0iMSAwIDAgMCAwICAwIDEgMCAwIDAgIDAgMCAxIDAgMCAgMCAwIDAgMSAwIi8+DQoJCTwvZmlsdGVyPg0KCTwvZGVmcz4NCgk8bWFzayBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4PSIzLjQ4MSIgeT0iMC42OTMiIHdpZHRoPSI2Ljk4OCIgaGVpZ2h0PSIzLjg5MyIgaWQ9IlhNTElEXzVfIj4NCgkJPGcgZmlsdGVyPSJ1cmwoI0Fkb2JlX09wYWNpdHlNYXNrRmlsdGVyKSI+DQoJCQk8bGluZWFyR3JhZGllbnQgaWQ9IlhNTElEXzZfIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjcuMTIyMSIgeTE9IjAuMTAzIiB4Mj0iNy4xMjIxIiB5Mj0iNS4yMzQ0Ij4NCgkJCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRkZGRkZGIi8+DQoJCQkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9I nN0b3AtY29sb3I6IzAwMDAwMCIvPg0KCQkJPC9saW5lYXJHcmFkaWVudD4NCgkJCTxyZWN0IHg9IjMuMTk5IiB5PSIwLjMzOSIgb3BhY2l0eT0iMC43IiBmaWxsPSJ1cmwoI1hNTElEXzZfKSIgd2lkdGg9IjcuODQ2IiBoZWlnaHQ9IjQuNjAxIi8+DQoJCTwvZz4NCgk8L21hc2s+DQoJPGVsbGlwc2Ugb
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/unodraw/unoshape.cxx|3 ++- sw/qa/core/data/odt/pass/tdf112017.odt |binary 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit 79cfd48dae2b986b691bb00a8400c7e9cc2cdda7 Author: Caolán McNamara Date: Tue Aug 29 11:43:42 2017 +0100 Resolves: tdf#112017 crash on particular odt Change-Id: I6ba2e73562a16afecb6abdfe4f1a40b1e316379e Reviewed-on: https://gerrit.libreoffice.org/41685 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 161bf34b1d8a..3c5b88860df4 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -3034,7 +3034,8 @@ void SvxShape::setAllPropertiesToDefault() mpObj->SetMergedItem(Svx3DCharacterModeItem(true)); } -mpModel->SetChanged(); +if (mpModel) +mpModel->SetChanged(); } void SvxShape::setPropertiesToDefault( diff --git a/sw/qa/core/data/odt/pass/tdf112017.odt b/sw/qa/core/data/odt/pass/tdf112017.odt new file mode 100644 index ..02a24d9db146 Binary files /dev/null and b/sw/qa/core/data/odt/pass/tdf112017.odt differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/customshapes/EnhancedCustomShape2d.cxx | 17 +++- sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |9 sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 45 ++ 3 files changed, 60 insertions(+), 11 deletions(-) New commits: commit 5477f7274e4df1210298c0f503a54eabc0f06bfc Author: Vasily Melenchuk Date: Mon May 15 13:41:14 2017 +0300 tdf#100072 zero height of shape's path was causing geometry errors DOCX custom geometry shape's path width and height are now used independently for scaling calculations. Change-Id: I368dd4dc065b8f122c4eb2911261e45047f03c70 Reviewed-on: https://gerrit.libreoffice.org/37639 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index c3c2d4c33099..c4de12bbcfc3 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -651,10 +651,23 @@ void EnhancedCustomShape2d::SetPathSize( sal_Int32 nIndex ) "svx", "ooxml shape, path width: " << nCoordWidth << " height: " << nCoordHeight); + +// Try to set up scale separately, if given only width or height +// This is possible case in OOXML when only width or height is non-zero if ( nCoordWidth == 0 ) -fXScale = 1.0; +{ +if ( nWidth ) +fXScale = (double)aLogicRect.GetWidth() / (double)nWidth; +else +fXScale = 1.0; +} if ( nCoordHeight == 0 ) -fYScale = 1.0; +{ +if ( nHeight ) +fYScale = (double)aLogicRect.GetHeight() / (double)nHeight; +else +fYScale = 1.0; +} } if ( (sal_uInt32)nXRef != 0x8000 && aLogicRect.GetHeight() ) { diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index ce8a77a02c8c..2aff1fb23ed1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -490,15 +490,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107033, "tdf107033.docx") CPPUNIT_ASSERT_EQUAL(static_cast(25), getProperty(xPageStyle, "FootnoteLineRelativeWidth")); } -DECLARE_OOXMLEXPORT_TEST(testTdf100072, "tdf100072.docx") -{ -// Ensure that shape has non-zero height -CPPUNIT_ASSERT(getShape(1)->getSize().Height > 0); - -// Ensure that shape left corner is within page (positive) -CPPUNIT_ASSERT(getShape(1)->getPosition().X > 0); -} - DECLARE_OOXMLEXPORT_TEST(testTdf107889, "tdf107889.docx") { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/data/tdf100072.docx b/sw/qa/extras/ooxmlimport/data/tdf100072.docx similarity index 100% rename from sw/qa/extras/ooxmlexport/data/tdf100072.docx rename to sw/qa/extras/ooxmlimport/data/tdf100072.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 87ccce61d9b5..90e36f1ef593 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ #include #include #include +#include class Test : public SwModelTestBase { @@ -1306,6 +1308,49 @@ DECLARE_OOXMLIMPORT_TEST(testTdf101627, "tdf101627.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(466), getProperty(xFrame, "Height")); } +DECLARE_OOXMLIMPORT_TEST(testTdf100072, "tdf100072.docx") +{ +uno::Reference xShape = getShape(1); + +// Ensure that shape has non-zero height +CPPUNIT_ASSERT(xShape->getSize().Height > 0); + +// Ensure that shape left corner is within page (positive) +CPPUNIT_ASSERT(xShape->getPosition().X > 0); + +// Save the first shape to a metafile. +uno::Reference xGraphicExporter = drawing::GraphicExportFilter::create(comphelper::getProcessComponentContext()); +uno::Reference xSourceDoc(xShape, uno::UNO_QUERY); +xGraphicExporter->setSourceDocument(xSourceDoc); + +SvMemoryStream aStream; +uno::Reference xOutputStream(new utl::OStreamWrapper(aStream)); +uno::Sequence aDescriptor = +{ +beans::PropertyValue("OutputStream", sal_Int32(0), uno::makeAny(xOutputStream), beans::PropertyState_DIRECT_VALUE), +beans::PropertyValue("FilterName", sal_Int32(0), uno::makeAny(OUString("SVM")), beans::PropertyState_DIRECT_VALUE) +}; +xGraphicExporter->filter(aDescriptor); +aStream.Seek(STREAM_SEEK_TO_BEGIN); + +// Read it back and dump it as an XML file. +Graphic aGraphic; +ReadGraphic(aStream, aGraphic); +const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile(); +MetafileXmlDump dumper; +xmlDocPtr pXmlDoc = dumper.dumpAndParse(rMetaFile); + +// Get first polyline rightside x
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/items/pageitem.cxx |2 +- sw/qa/extras/uiwriter/uiwriter.cxx | 22 ++ 2 files changed, 23 insertions(+), 1 deletion(-) New commits: commit a30f969432a451ade87b93e3077836a849b8f11b Author: Miklos Vajna Date: Thu Nov 3 12:32:03 2016 +0100 svx: add missing ~CONVERT_TWIPS mask in SvxPageItem::PutValue() With this, it's possible to use AttributePage.* keys in macros. Change-Id: I3f0b1ea8fb6274e7c18511c2e80774205206a2ba diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index 7371ef1..53c01c1 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -180,7 +180,7 @@ bool SvxPageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { -switch( nMemberId ) +switch( nMemberId & ~CONVERT_TWIPS ) { case MID_PAGE_NUMTYPE: { diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index b37a6c4..e58093f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -94,6 +94,7 @@ #include #include #include +#include #include static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/"; @@ -211,6 +212,7 @@ public: void testTdf78727(); void testRedlineTimestamp(); void testCursorWindows(); +void testLandscape(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -320,6 +322,7 @@ public: CPPUNIT_TEST(testTdf78727); CPPUNIT_TEST(testRedlineTimestamp); CPPUNIT_TEST(testCursorWindows); +CPPUNIT_TEST(testLandscape); CPPUNIT_TEST_SUITE_END(); private: @@ -4027,6 +4030,25 @@ void SwUiWriterTest::testCursorWindows() CPPUNIT_ASSERT_EQUAL(aText.getLength(), pShellCursor2->Start()->nContent.GetIndex()); } +void SwUiWriterTest::testLandscape() +{ +// Set page orientation to landscape. +SwDoc* pDoc = createDoc(); +uno::Sequence aPropertyValues = +{ +comphelper::makePropertyValue("AttributePage.Landscape", true), +}; +lcl_dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues); +Scheduler::ProcessEventsToIdle(); + +// Assert that the document model was modified. +SwDocShell* pDocShell = pDoc->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); +size_t nPageDesc = pWrtShell->GetCurPageDesc(); +// This failed, page was still portrait. +CPPUNIT_ASSERT(pWrtShell->GetPageDesc(nPageDesc).GetLandscape()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source sw/qa sw/source
svx/source/svdraw/svdmrkv.cxx |5 - sw/qa/extras/tiledrendering/tiledrendering.cxx |4 sw/source/core/crsr/crsrsh.cxx |9 ++--- 3 files changed, 14 insertions(+), 4 deletions(-) New commits: commit 786cc8a5a3cd34329c72b867e5fd7896b10a7351 Author: Miklos Vajna Date: Tue Sep 13 10:06:52 2016 +0200 sw: emit LOK_CALLBACK_GRAPHIC_VIEW_SELECTION as part of registerCallback() Have a Writer shape selection in the first view, create a new view, the second view doesn't see the selection. But the same works if the shape selection is created when the second view was created earlier. Emit the svx selection state as part of SwCursorShell::NotifyCursor() to fix the problem, but take care of not sending the status to the new view itself. Change-Id: Iff3979235e1c12cc64867c3184354967f451370b Reviewed-on: https://gerrit.libreoffice.org/28857 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index eb14f29..402c61e 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -767,9 +767,12 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) if(SfxViewShell* pViewShell = GetSfxViewShell()) { if (pOtherShell) +{ // An other shell wants to know about our existing // selection. -SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection); +if (pViewShell != pOtherShell) +SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection); +} else { // We have a new selection, so both pViewShell and the diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index e61f23f..a2a88e1 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1303,10 +1303,14 @@ void SwTiledRenderingTest::testCreateViewGraphicSelection() // Make sure that the hidden text cursor isn't visible in the second view, either. ViewCallback aView2; aView2.m_bViewCursorVisible = true; +aView2.m_bGraphicViewSelection = false; SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); // This was true, the second view didn't get the visibility of the text // cursor of the first view. CPPUNIT_ASSERT(!aView2.m_bViewCursorVisible); +// This was false, the second view didn't get the graphic selection of the +// first view. +CPPUNIT_ASSERT(aView2.m_bGraphicViewSelection); mxComponent->dispose(); mxComponent.clear(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index bfa0bc0..241d8d4 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1192,12 +1192,15 @@ OUString SwCursorShell::getPageRectangles() return OUString::fromUtf8(comphelper::string::join("; ", v).getStr()); } -void SwCursorShell::NotifyCursor(SfxViewShell* pViewShell) const +void SwCursorShell::NotifyCursor(SfxViewShell* pOtherShell) const { // Cursor position and visibility. -m_pVisibleCursor->SetPosAndShow(pViewShell); +m_pVisibleCursor->SetPosAndShow(pOtherShell); // Text selection. -m_pCurrentCursor->Show(pViewShell); +m_pCurrentCursor->Show(pOtherShell); +// Graphic selection. +auto pView = const_cast(GetDrawView()); +pView->AdjustMarkHdl(pOtherShell); } /// go to the next SSelection ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/svdraw/svdedxv.cxx | 26 ++ svx/source/svdraw/svdpntv.cxx | 21 +++ sw/qa/extras/tiledrendering/tiledrendering.cxx | 35 + 3 files changed, 82 insertions(+) New commits: commit 9d91d371e92548c7f75a7d0155eecaf3769fdee6 Author: Miklos Vajna Date: Tue Jul 26 11:02:38 2016 +0200 svx lok: draw text edits in all views Use case: a document has a shape with text, and two views. If one view starts to edit the shape text, the model text is hidden (via TextHierarchyEditPrimitive2D), and the in-progress text was painted directly only in the view that edits it. The remaining views presented the shape as if it had no text. This commit addresses the subset of this use case when the views are already created and they already show the same draw page. Fix the problem by looking for other views showing the same draw page, create a view of the text edit for them, and paint them in all views after the own text edit is painted. There is not much LOK-specific in this code, except that some extra code would be needed to not paint the blinking cursor of the text edit in other views, and then it could be enabled in the non-LOK case as well. Change-Id: Ib3096a3369fa56663ee209794e102090d362de66 Reviewed-on: https://gerrit.libreoffice.org/27535 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index ab5416f..9a458806 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include @@ -813,6 +814,31 @@ bool SdrObjEditView::SdrBeginTextEdit( pTextEditOutliner->InsertView(pOutlView, (sal_uInt16)i); } } + +if (comphelper::LibreOfficeKit::isActive()) +{ +// Register an outliner view for all other sdr views that +// show the same page, so that when the text edit changes, +// all interested windows get an invalidation. +SdrViewIter aIter(pObj->GetPage()); +for (SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView()) +{ +if (pView == this) +continue; + +for(sal_uInt32 nViewPaintWindow = 0; nViewPaintWindow < pView->PaintWindowCount(); ++nViewPaintWindow) +{ +SdrPaintWindow* pPaintWindow = pView->GetPaintWindow(nViewPaintWindow); +OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); + +if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType()) +{ +OutlinerView* pOutlView = ImpMakeOutlinerView(static_cast(&rOutDev), !bEmpty, nullptr); +pTextEditOutliner->InsertView(pOutlView); +} +} +} +} } pTextEditOutlinerView->ShowCursor(); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 1b5a20a..8b6dbdb 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -60,6 +60,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -740,6 +741,26 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFo static_cast< SdrView* >(this)->TextEditDrawing(rPaintWindow); } +if (comphelper::LibreOfficeKit::isActive()) +{ +// Look for active text edits in other views showing the same page, +// and show them as well. +if (SdrPageView* pPageView = GetSdrPageView()) +{ +SdrViewIter aIter(pPageView->GetPage()); +for (SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView()) +{ +if (pView == this) +continue; + +if (pView->IsTextEdit() && pView->GetSdrPageView()) +{ + static_cast(pView)->TextEditDrawing(rPaintWindow); +} +} +} +} + // draw Overlay, also to PreRender device if exists rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion()); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 6c68549..82d87f4 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -57,6 +57,7 @@ public: void testViewCursorVisibility(); void
[Libreoffice-commits] core.git: svx/source sw/qa sw/source
svx/source/xoutdev/_xoutbmp.cxx | 20 +++- sw/qa/extras/htmlexport/data/tdf66822.odt |binary sw/qa/extras/htmlexport/htmlexport.cxx| 10 ++ sw/source/filter/html/htmlnumwriter.cxx |2 +- 4 files changed, 30 insertions(+), 2 deletions(-) New commits: commit ab14a9708d2937bc767c14542610ce91b56dda1e Author: susobhang70 Date: Thu Jan 7 22:08:33 2016 +0530 tdf#66822 - refactor HTML export of image bullet list removed garbage in svg-base64, added svg close tag, fixed ul tag. Added test case for the added code. Change-Id: I4f07036300031e1e97b118466ebf75d8b9c46e01 Reviewed-on: https://gerrit.libreoffice.org/21218 Tested-by: jan iversen Tested-by: Jenkins Reviewed-by: jan iversen diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 1c4c012..22a5b62 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -364,7 +364,25 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString) css::uno::Sequence aOStmSeq( static_cast(aOStm.GetData()),aOStm.Tell() ); OUStringBuffer aStrBuffer; ::sax::Converter::encodeBase64(aStrBuffer,aOStmSeq); -rOUString = aMimeType + ";base64," + aStrBuffer.makeStringAndClear(); +OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear(); +if( aLink.GetType() == GFX_LINK_TYPE_NATIVE_SVG ) +{ + sal_Int32 ite(8); + sal_Int32 nBufferLength(aOStmSeq.getLength()); + const sal_Int8* pBuffer = aOStmSeq.getConstArray(); + css::uno::Sequence newTempSeq = aOStmSeq;// creates new Sequence to remove front 8 bits of garbage and encodes in base64 + sal_Int8 *pOutBuffer = newTempSeq.getArray(); + while(ite < nBufferLength) + { +*pOutBuffer++ = pBuffer[ite]; +ite++; + } + ::sax::Converter::encodeBase64(aStrBuffer, newTempSeq); + aEncodedBase64Image = aStrBuffer.makeStringAndClear(); + sal_Int32 SVGFixLength = aEncodedBase64Image.getLength(); + aEncodedBase64Image = aEncodedBase64Image.replaceAt(SVGFixLength - 12, SVGFixLength, "") + "PC9zdmc+Cg=="; // removes rear 12 bits of garbage and adds svg closing tag in base64 +} +rOUString = aMimeType + ";base64," + aEncodedBase64Image; return true; } diff --git a/sw/qa/extras/htmlexport/data/tdf66822.odt b/sw/qa/extras/htmlexport/data/tdf66822.odt new file mode 100644 index 000..88cc750 Binary files /dev/null and b/sw/qa/extras/htmlexport/data/tdf66822.odt differ diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 74d6bd1..2d8bde8 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -254,6 +254,16 @@ DECLARE_HTMLEXPORT_TEST(testExportInternalUrl, "tdf90905.odt") assertXPath(pDoc, "/html/body/p[2]/a", "href", "#bookmark"); } +DECLARE_HTMLEXPORT_TEST(testExportImageBulletList, "tdf66822.odt") +{ +htmlDocPtr pDoc = parseHtml(maTempFile); +CPPUNIT_ASSERT(pDoc); + +// Encoded base64 SVG bullet should match and render on browser +assertXPath(pDoc, "/html/body/ul", 1); +assertXPath(pDoc, "/html/body/ul", "style", "list-style-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDUxNDQ4KSAgLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiIFsNCgk8IUVOVElUWSBuc19zdmcgImh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCgk8IUVOVElUWSBuc194bGluayAiaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQpdPg0KPHN2ZyAgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9IiZuc19zdmc7IiB4bWxuczp4bGluaz0iJm5zX3hsaW5rOyIgd2lkdGg9IjE0LjAwOCIgaGVpZ2h0PSIxNC4wMSINCgkgdmlld0JveD0iMCAwIDE0LjAwOCAxNC4wMSIgb3ZlcmZsb3c9InZpc2libGUiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDE0LjAwOCAxNC4wMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cmFkaWFsR3JhZGllbnQgaWQ9IlhNTElEXzRfIiBjeD0iNy4wMDQ0IiBjeT0iNy4wMDQ5IiByPSI3LjAwNDQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4NCgkJPHN0b3Ag IG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6IzM1REIzNSIvPg0KCQk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojMDBBMDAwIi8+DQoJPC9yYWRpYWxHcmFkaWVudD4NCgk8Y2lyY2xlIGZpbGw9InVybCgjWE1MSURfNF8pIiBjeD0iNy4wMDQiIGN5PSI3LjAwNSIgcj0iNy4wMDQiLz4NCgk8ZGVmcz4NCgkJPGZpbHRlciBpZD0iQWRvYmVfT3BhY2l0eU1hc2tGaWx0ZXIiIGZpbHRlclVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeD0iMy40ODEiIHk9IjAuNjkzIiB3aWR0aD0iNi45ODgiIGhlaWdodD0iMy44OTMiPg0KCQkJPGZlQ29sb3JNYXRyaXggIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIxIDAgMCAwIDAgIDAgMSAwIDAgMCAgMCAwIDEgMCAwICAwIDAgMCAxIDAiLz4NCgkJPC9maWx0ZXI+DQoJPC9kZWZzPg0KCTxtYXNrIG1hc2tVbml0cz0idXNlclNwYWNlT25Vc2UiIHg9IjMuNDgxIiB5PSIwLjY5MyIgd2lkdGg9IjYuOTg4IiBoZWlnaHQ9IjMuODkzIiBpZD0iWE1MSURfNV8iPg0KCQk8ZyBmaWx0ZXI9InVybCgjQWRvYmVfT3BhY2l0eU1hc2tGaWx0ZXIpIj4NCgkJCTxsaW5lYXJHcmFkaWVudCBpZD0iWE1MSURfNl8iIGdyYWRp
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/svdraw/svdotext.cxx | 13 + sw/qa/extras/ooxmlimport/data/tdf95970.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 28 3 files changed, 41 insertions(+) New commits: commit ae0e830f9ace78b889713e7e74ce46f88fa21470 Author: Mike Kaganski Date: Sun Nov 22 16:04:36 2015 +1000 tdf#95970: Don't loose mirroring in SdrTextObj::TRSetBaseGeometry Currently, negative scaling (mirroring) is lost in SdrTextObj::NbcSetSnapRect, when rect is justified. This patch cares for this. Possibly it's better to make these changes directly in SdrTextObj::NbcSetSnapRect? Change-Id: I353ff01626e15b398de95e28eae78572991dfdc3 Reviewed-on: https://gerrit.libreoffice.org/20109 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 6de9734..0159d38 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1722,6 +1722,9 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aScale.setY(fabs(aScale.getY())); fRotate = fmod(fRotate + F_PI, F_2PI); } +// flip? +bool bFlipX = basegfx::fTools::less(aScale.getX(), 0.0), + bFlipY = basegfx::fTools::less(aScale.getY(), 0.0); // reset object shear and rotations aGeo.nRotationAngle = 0; @@ -1769,6 +1772,16 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b Rectangle aBaseRect(aPoint, aSize); SetSnapRect(aBaseRect); +// flip? +if (bFlipX) +{ +Mirror(Point(), Point(0, 1)); +} +if (bFlipY) +{ +Mirror(Point(), Point(1, 0)); +} + // shear? if(!basegfx::fTools::equalZero(fShearX)) { diff --git a/sw/qa/extras/ooxmlimport/data/tdf95970.docx b/sw/qa/extras/ooxmlimport/data/tdf95970.docx new file mode 100644 index 000..501ef36 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf95970.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 8c28ff9..53b55b9 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -78,6 +78,7 @@ #include #include #include +#include #include @@ -2961,6 +2962,33 @@ DECLARE_OOXMLIMPORT_TEST(testTdf60351, "tdf60351.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[5].Y); } +DECLARE_OOXMLIMPORT_TEST(testTdf95970, "tdf95970.docx") +{ +// First shape: the rotation should be -12.94 deg, it should be mirrored. +// Proper color order of image on test doc (left->right): +// top row: green->red +// bottom row: yellow->blue +uno::Reference xShape(getShape(1), uno::UNO_QUERY_THROW); +uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY_THROW); +sal_Int32 aRotate = 0; +xPropertySet->getPropertyValue("RotateAngle") >>= aRotate; +CPPUNIT_ASSERT_EQUAL(sal_Int32(34706), aRotate); +bool bIsMirrored = false; +xPropertySet->getPropertyValue("IsMirrored") >>= bIsMirrored; +CPPUNIT_ASSERT(bIsMirrored); +drawing::HomogenMatrix3 aTransform; +xPropertySet->getPropertyValue("Transformation") >>= aTransform; +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column1, 4767.0507250872988)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column2, -1269.0985325236848)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column3, 696.736109)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column1, 1095.3035265135941)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column2, 5523.4525711162969)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column3, 672.041663)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column1, 0.0)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column2, 0.0)); +CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column3, 1.0)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source sw/qa
svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx |2 +- sw/qa/core/data/ooxml/pass/fdo79131.docx |binary 2 files changed, 1 insertion(+), 1 deletion(-) New commits: commit 65277f994ae25d930c15aebba0ed19f8de0abba1 Author: Caolán McNamara Date: Mon Sep 29 20:38:18 2014 +0100 Resolves: fdo#79131 crash in EnhancedCustomShapeTypeNames::Get Change-Id: Ib21a4a1574119120f09d4ecac73b93a0f2f6739f diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 6dda34e..68bdd32 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -301,7 +301,7 @@ MSO_SPT EnhancedCustomShapeTypeNames::Get( const OUString& rShapeType ) OUString EnhancedCustomShapeTypeNames::Get( const MSO_SPT eShapeType ) { -return eShapeType <= mso_sptTextBox +return (eShapeType <= mso_sptTextBox && eShapeType >= mso_sptMin) ? OUString::createFromAscii( pNameTypeTableArray[ eShapeType ].pS ) : OUString(); } diff --git a/sw/qa/core/data/ooxml/pass/fdo79131.docx b/sw/qa/core/data/ooxml/pass/fdo79131.docx new file mode 100644 index 000..5f10d9c Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fdo79131.docx differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: svx/source sw/qa vcl/source
svx/source/svdraw/svdfmtf.cxx| 174 +++ svx/source/svdraw/svdfmtf.hxx| 20 ++- svx/source/svdraw/svdxcgv.cxx| 32 ++--- sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 vcl/source/gdi/metaact.cxx |3 vcl/source/gdi/outdev6.cxx |3 vcl/source/gdi/outmap.cxx| 11 + 7 files changed, 180 insertions(+), 65 deletions(-) New commits: commit 684c502ed0a6782fe1b9c7d7cd1911a4a88b543a Author: Armin Le Grand Date: Tue May 8 08:27:10 2012 + Related: #119125# Added usage of the ClipRegion for dismantling Metafiles to SdrObjects (ImpSdrGDIMetaFileImport) as good as possible with Metafile usage Conflicts: svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdfmtf.hxx Change-Id: I41422696e97f919e618f7e385c68d4ac737a52c1 diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 7e38fc6..1d9b948 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -61,6 +61,8 @@ #include #include #include +#include +#include @@ -74,7 +76,11 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): maDash(XDASH_RECT, 0, 0, 0, 0, 0), fScaleX(0.0),fScaleY(0.0), bFntDirty(sal_True), - bLastObjWasPolyWithoutLine(sal_False),bNoLine(sal_False),bNoFill(sal_False),bLastObjWasLine(sal_False) +bLastObjWasPolyWithoutLine(sal_False), +bNoLine(sal_False), +bNoFill(sal_False), +bLastObjWasLine(sal_False), +maClip() { aVD.EnableOutput(sal_False); @@ -87,6 +93,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END); pModel=&rModel; +checkClip(); } ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport() @@ -371,7 +378,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr } } -void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale ) +void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, sal_Bool bScale) { if ( bScale && !aScaleRect.IsEmpty() ) { @@ -381,60 +388,123 @@ void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale ) pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) ); } -// #i111954# check object for visibility -// used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj -bool bVisible(false); - -if(pObj->HasLineStyle()) +if(isClip()) { -bVisible = true; -} +const basegfx::B2DPolyPolygon aPoly(pObj->TakeXorPoly()); +const basegfx::B2DRange aOldRange(aPoly.getB2DRange()); +const SdrLayerID aOldLayer(pObj->GetLayer()); +const SfxItemSet aOldItemSet(pObj->GetMergedItemSet()); +const SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj); +BitmapEx aBitmapEx; + +if(pSdrGrafObj) +{ +aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx(); +} -if(!bVisible && pObj->HasFillStyle()) -{ -bVisible = true; +SdrObject::Free(pObj); + +if(!aOldRange.isEmpty()) +{ +// clip against ClipRegion +const basegfx::B2DPolyPolygon aNewPoly( +basegfx::tools::clipPolyPolygonOnPolyPolygon( +aPoly, +maClip, +true, +aPoly.isClosed() ? false : true)); +const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange()); + +if(!aNewRange.isEmpty()) +{ +pObj = new SdrPathObj( +aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN, +aNewPoly); + +pObj->SetLayer(aOldLayer); +pObj->SetMergedItemSet(aOldItemSet); + +if(!!aBitmapEx) +{ +// aNewRange is inside of aOldRange and defines which part of aBitmapEx is used +const double fLclScaleX(aBitmapEx.GetSizePixel().Width() / (aOldRange.getWidth() ? aOldRange.getWidth() : 1.0)); +const double fLclScaleY(aBitmapEx.GetSizePixel().Height() / (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0)); +basegfx::B2DRange aPixel(aNewRange); +basegfx::B2DHomMatrix aTrans; + +aTrans.translate(-aOldRange.getMinX(), -aOldRange.getMinY()); +aTrans.scale(fLclScaleX, fLclScaleY); +aPixel.transform(aTrans); + +const BitmapEx aClippedBitmap( +aBitmapEx, +Point(floor(std::max(0.0, aPixel.getMinX())), floor(std::max(0.0, aPixel