basctl/source/basicide/baside2.hxx | 3 basctl/source/basicide/baside2b.cxx | 19 + chart2/qa/extras/chart2export.cxx | 11 chart2/qa/extras/data/xlsx/chart_pie2007.xlsx |binary compilerplugins/clang/referencecasting.cxx | 3 cui/source/customize/cfg.cxx | 12 dev/null |binary editeng/source/editeng/impedit2.cxx | 13 extras/source/shellnew/soffice.odg |binary extras/source/shellnew/soffice.ods |binary extras/source/shellnew/soffice.odt |binary filter/source/msfilter/svdfppt.cxx | 77 +--- icon-themes/colibre/cmd/32/grafblue.png |binary icon-themes/colibre/cmd/32/grafgreen.png |binary icon-themes/colibre/cmd/32/grafred.png |binary icon-themes/colibre/cmd/lc_circlepie.png |binary icon-themes/colibre/cmd/lc_grafblue.png |binary icon-themes/colibre/cmd/lc_grafgreen.png |binary icon-themes/colibre/cmd/lc_grafred.png |binary icon-themes/colibre_svg/cmd/32/grafblue.svg | 2 icon-themes/colibre_svg/cmd/32/grafgreen.svg | 2 icon-themes/colibre_svg/cmd/32/grafred.svg | 2 icon-themes/colibre_svg/cmd/lc_circlepie.png |binary icon-themes/colibre_svg/cmd/lc_grafblue.svg | 2 icon-themes/colibre_svg/cmd/lc_grafgreen.svg | 2 icon-themes/colibre_svg/cmd/lc_grafred.svg | 2 include/filter/msfilter/svdfppt.hxx | 3 include/svx/itemwin.hxx | 4 include/svx/linectrl.hxx | 2 include/svx/srchdlg.hxx | 5 include/tools/UnitConversion.hxx | 19 + include/vcl/weld.hxx | 5 include/vcl/window.hxx | 4 include/xmloff/PageMasterStyleMap.hxx | 1 include/xmloff/XMLDrawingPageStyleContext.hxx | 28 + include/xmloff/XMLTextMasterPageContext.hxx | 6 include/xmloff/prstylei.hxx | 4 include/xmloff/txtimp.hxx | 2 include/xmloff/xmlimppr.hxx | 2 include/xmloff/xmltoken.hxx | 3 oox/inc/drawingml/colorchoicecontext.hxx | 15 oox/source/drawingml/chart/typegroupmodel.cxx | 2 oox/source/drawingml/colorchoicecontext.cxx | 25 + oox/source/drawingml/diagram/diagram.cxx | 17 - oox/source/drawingml/diagram/diagram.hxx | 16 oox/source/drawingml/diagram/diagramfragmenthandler.cxx | 15 oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 162 ++++++++- oox/source/drawingml/diagram/diagramlayoutatoms.hxx | 3 oox/source/drawingml/diagram/layoutatomvisitors.cxx | 4 package/source/manifest/ManifestImport.cxx | 31 + sc/qa/uitest/autofilter/data/tdf130770.ods |binary sc/qa/uitest/autofilter/tdf130070.py | 73 ++++ sc/source/core/data/dpshttab.cxx | 28 - sc/source/ui/Accessibility/AccessibleDocument.cxx | 155 --------- sc/source/ui/inc/AccessibleDocument.hxx | 7 sc/source/ui/view/cellsh1.cxx | 30 - sc/source/ui/view/gridwin.cxx | 37 -- sc/source/ui/view/tabvwshe.cxx | 40 -- sd/IwyuFilter_sd.yaml | 1 sd/qa/unit/data/ppt/tdf79082.ppt |binary sd/qa/unit/data/pptx/fill-color-list.pptx |binary sd/qa/unit/export-tests.cxx | 42 ++ sd/qa/unit/import-tests-smartart.cxx | 37 ++ sd/source/filter/eppt/epptso.cxx | 8 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx | 9 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx | 151 --------- sd/source/ui/inc/AccessibleDocumentViewBase.hxx | 7 sd/source/ui/inc/AccessibleDrawDocumentView.hxx | 6 sd/source/ui/view/Outliner.cxx | 11 solenv/clang-format/blacklist | 1 svx/source/dialog/srchdlg.cxx | 57 --- svx/source/sdr/properties/groupproperties.cxx | 17 - svx/source/tbxctrls/itemwin.cxx | 14 svx/source/tbxctrls/linectrl.cxx | 12 sw/CppunitTest_sw_ooxmlexport15.mk | 14 sw/Module_sw.mk | 1 sw/qa/extras/odfexport/data/sw_hatch.odt |binary sw/qa/extras/odfexport/odfexport.cxx | 10 sw/qa/extras/ooxmlexport/data/tdf133334_followPgStyle.odt |binary sw/qa/extras/ooxmlexport/data/tdf78352.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 9 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 38 ++ sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 4 sw/qa/extras/ooxmlimport/data/tdf127778.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 12 sw/qa/extras/uiwriter/data2/tdf131684.docx |binary sw/qa/extras/uiwriter/data2/tdf132236.odt |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 64 +++ sw/qa/extras/ww8export/ww8export3.cxx | 9 sw/qa/uitest/writer_dialogs/openDialogs.py | 3 sw/source/core/access/accdoc.cxx | 121 ------- sw/source/core/access/accdoc.hxx | 8 sw/source/core/doc/DocumentSettingManager.cxx | 1 sw/source/core/layout/frmtool.cxx | 53 +++ sw/source/core/layout/layhelp.hxx | 3 sw/source/core/undo/undel.cxx | 1 sw/source/filter/ww8/docxattributeoutput.cxx | 11 sw/source/filter/ww8/wrtw8sty.cxx | 12 sw/source/filter/ww8/wrtww8.hxx | 1 sw/source/filter/ww8/ww8atr.cxx | 2 sw/source/filter/xml/xmlfmt.cxx | 11 sw/source/ui/dbui/addresslistdialog.cxx | 7 sw/source/uibase/docvw/PostItMgr.cxx | 6 sw/source/uibase/uiview/viewsrch.cxx | 38 -- sw/uiconfig/swriter/ui/mmcreatingdialog.ui | 1 toolkit/source/awt/vclxaccessiblecomponent.cxx | 3 toolkit/source/controls/stdtabcontroller.cxx | 16 vcl/inc/window.h | 1 vcl/source/app/salvtables.cxx | 10 vcl/source/window/window2.cxx | 15 vcl/unx/generic/dtrans/X11_selection.cxx | 1 vcl/unx/gtk3/gtk3gtkinst.cxx | 35 -- winaccessibility/source/UAccCOM/MAccessible.cxx | 4 writerfilter/source/dmapper/DomainMapper.cxx | 2 writerfilter/source/dmapper/PropertyMap.cxx | 9 xmloff/CppunitTest_xmloff_style.mk | 44 ++ xmloff/Module_xmloff.mk | 1 xmloff/inc/PageMasterImportContext.hxx | 4 xmloff/inc/PageMasterPropHdlFactory.hxx | 7 xmloff/inc/PageMasterPropMapper.hxx | 7 xmloff/qa/unit/data/fill-image-base64.fodg | 230 ++++++++++++++ xmloff/qa/unit/style.cxx | 77 ++++ xmloff/source/core/xmltoken.cxx | 3 xmloff/source/draw/ximpstyl.cxx | 87 +++-- xmloff/source/style/FillStyleContext.cxx | 10 xmloff/source/style/PageMasterImportContext.cxx | 40 ++ xmloff/source/style/PageMasterPropHdlFactory.cxx | 2 xmloff/source/style/PageMasterPropMapper.cxx | 4 xmloff/source/style/PageMasterStyleMap.cxx | 30 + xmloff/source/style/XMLPageExport.cxx | 4 xmloff/source/style/prstylei.cxx | 3 xmloff/source/style/xmlstyle.cxx | 2 xmloff/source/text/XMLTextMasterPageContext.cxx | 28 + xmloff/source/text/txtimp.cxx | 24 + xmloff/source/token/tokens.txt | 3 xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt |binary 136 files changed, 1407 insertions(+), 1010 deletions(-)
New commits: commit 4ada77ac455ba99085838c380c9e275956405342 Merge: a91f20addcfa bf5e0dc9bd54 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Jun 4 10:56:27 2020 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Jun 4 10:56:27 2020 +0200 Merge branch 'libreoffice-6-4' into distro/lhm/libreoffice-6-4+backports Change-Id: I6c4e4dc74df1a1ce0455526a067c5286534922be commit bf5e0dc9bd54069f57f41de8746dc29d0ec41061 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jun 3 14:07:39 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Thu Jun 4 09:41:05 2020 +0200 tdf#133633 winaccessibility: Add null check The call to 'AccObjectManagerAgent::GetIAccessibleFromResID' may set 'pImAcc' to nullptr here (s. 'AccObjectWinManager::GetIAccessibleFromResID', which is called from there), so handle that case gracefully. Change-Id: I0dbd48974fd012ff086835b147cd9b9cfc8a052b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95430 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit f5f9cac0c5f04246718c438b4673b36e803fda29) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95420 Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index d681c38a793c..6a844f8d7ce6 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -786,6 +786,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accFocus(VARIANT *pvarChild) { IMAccessible* pIMAcc = nullptr; g_pAgent->GetIAccessibleFromResID(m_dFocusChildID,&pIMAcc); + if (pIMAcc == nullptr) + { + return E_FAIL; + } pIMAcc->AddRef(); pvarChild->vt = VT_DISPATCH; pvarChild->pdispVal = pIMAcc; commit 6865a25e2c6bdeff21be8368127adaed1992b3a1 Author: Rene Engelhard <r...@debian.org> AuthorDate: Mon Jun 1 09:24:40 2020 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 3 21:02:20 2020 +0200 deb#961473 set A4 in extras/source/shellnew templates it's far more used in the world than "US Letter" Change-Id: I7dbbefc9bde543967e1f3039890bbff91fc1459c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95422 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/extras/source/shellnew/soffice.odg b/extras/source/shellnew/soffice.odg index 0df6408db875..ac06d224ec84 100644 Binary files a/extras/source/shellnew/soffice.odg and b/extras/source/shellnew/soffice.odg differ diff --git a/extras/source/shellnew/soffice.ods b/extras/source/shellnew/soffice.ods index 2f3bcbc60319..33782b08fedf 100644 Binary files a/extras/source/shellnew/soffice.ods and b/extras/source/shellnew/soffice.ods differ diff --git a/extras/source/shellnew/soffice.odt b/extras/source/shellnew/soffice.odt index 679cc6493cc6..be6efc69f714 100644 Binary files a/extras/source/shellnew/soffice.odt and b/extras/source/shellnew/soffice.odt differ commit d152baf041b0c7fb826b34ba01ce5846f5945f82 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jun 1 13:51:51 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jun 3 09:35:22 2020 +0200 Revert "tdf#125609 toolkit: don't use XTabController::getControls" This reverts LO6.4 commit 5cf057c3365a0feafc8f2e4f4a9e24d69a581999, in order to fix tdf#133158. This commit is obsolete, but was left in place since it seemed to have fixed a problem (in =gtk3 anyway). But now SAL_USE_VCLPLUGIN=gen behaves differently, so obviously a fix in one place must have broken another. Better the problems you have always known than a new problem, especially since this patch isn't used to fix anything specific in gtk3 anymore (since those changes were also reverted). An earlier gerrit version of this revert (which didn't just have an ignore-this-clang-rule exception) half-worked, but failed if multiple documents were opened. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95282 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit d5e222cd86b82a429c28cb19583521d581efaf2b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95311 Reviewed-by: Justin Luth <justin_l...@sil.org> (cherry picked from commit a1c7ccc84ff596c5977644a67802e65b51919d49) Change-Id: Ie8ddb7b9669fa46067d04c35e157ea08701df0da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95326 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/compilerplugins/clang/referencecasting.cxx b/compilerplugins/clang/referencecasting.cxx index 45b65d3e7f26..ea69efbd0f83 100644 --- a/compilerplugins/clang/referencecasting.cxx +++ b/compilerplugins/clang/referencecasting.cxx @@ -43,6 +43,9 @@ public: // macros if (fn == SRCDIR "/dbaccess/source/ui/browser/formadapter.cxx") return false; + // UNO aggregation + if (fn == SRCDIR "/toolkit/source/controls/stdtabcontroller.cxx") + return false; return true; } diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx index b989f3f5a8e5..858047012a7a 100644 --- a/toolkit/source/controls/stdtabcontroller.cxx +++ b/toolkit/source/controls/stdtabcontroller.cxx @@ -303,17 +303,19 @@ void StdTabController::activateTabOrder( ) if ( !xC.is() || !xVclContainerPeer.is() ) return; + // This may return a TabController, which returns desired list of controls faster + // (the dreaded UNO aggregration, retrieve the thing that we are part of) + Reference<XTabController> xTabController( static_cast<XTabController*>(this), UNO_QUERY ); + // Get a flattened list of controls sequences Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels(); Sequence< Reference< XWindow > > aCompSeq; Sequence< Any> aTabSeq; - // Previously used aControls = xTabController->getControls() "for the sake of optimization", - // but that list isn't valid during the creation phase (missing last created control) because - // listenermultiplexer.cxx handles fmvwimp::elementinserted before formcontroller::elementInserted - // Perhaps other places using the same optimization need to be reviewed? (tdf#125609) - Sequence< Reference< XControl > > aCachedControls = getControls(); - Sequence< Reference< XControl > > aControls = aCachedControls; + // DG: For the sake of optimization, retrieve Controls from getControls(), + // this may sound counterproductive, but leads to performance improvements + // in practical scenarios (Forms) + Sequence< Reference< XControl > > aControls = xTabController->getControls(); // #58317# Some Models may be missing from the Container. Plus there is a // autoTabOrder call later on. @@ -331,7 +333,7 @@ void StdTabController::activateTabOrder( ) { mxModel->getGroup( nG, aThisGroupModels, aName ); - aControls = aCachedControls; + aControls = xTabController->getControls(); // ImplCreateComponentSequence has a really strange semantics regarding it's first parameter: // upon method entry, it expects a super set of the controls which it returns // this means we need to completely fill this sequence with all available controls before commit c72db4fada4afe7769666528b5bc6954f468d258 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Apr 22 21:06:58 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jun 2 10:30:50 2020 +0200 tdf#124790: sw: handle SubtractFlys when replacing compat options This was added in commit c5cf8824a619401627f18abc7b3049551c71ac2a (tdf#86578: sw: fix rendering of legacy documents with fly achored at fly), it's off by default and on for legacy ODT files. Change-Id: I8a08106bed8b12c173d47ed66efe54fd71953c99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92731 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95298 diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index fe13a6b569f6..0d2a8fb99808 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -592,6 +592,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti mbUnixForceZeroExtLeading = rSource.mbUnixForceZeroExtLeading; mbTabRelativeToIndent = rSource.mbTabRelativeToIndent; mbTabAtLeftIndentForParagraphsInList = rSource.mbTabAtLeftIndentForParagraphsInList; + mbSubtractFlys = rSource.mbSubtractFlys; mbMsWordCompTrailingBlanks = rSource.mbMsWordCompTrailingBlanks; mbEmptyDbFieldHidesPara = rSource.mbEmptyDbFieldHidesPara; } commit 59a896d80feee9f4c25b931c77aee281da189868 Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Tue May 26 13:34:32 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jun 1 18:25:05 2020 +0200 tdf#132594 Chart XLSX import: fix legend entries in pie charts Legend entry text of pie chart wasn't imported correctly in XLSX documents created with Excel 2007. Regression from commit: e0b0502516a10181bbd1737b93b38b2bba4c98e8 (tdf#128016 Chart OOXML Import: fix duplicated category labels) Change-Id: I4567437a41fe66e124dccbd148c0c49196d5c007 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94864 Tested-by: Jenkins Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95294 diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 6826c3f53569..cb9e4aa32df3 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -152,6 +152,7 @@ public: void testTdf123206_customLabelText(); void testCustomLabelText(); void testTdf131979(); + void testTdf132594(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -267,6 +268,7 @@ public: CPPUNIT_TEST(testTdf123206_customLabelText); CPPUNIT_TEST(testCustomLabelText); CPPUNIT_TEST(testTdf131979); + CPPUNIT_TEST(testTdf132594); CPPUNIT_TEST_SUITE_END(); @@ -2467,6 +2469,15 @@ void Chart2ExportTest::testTdf131979() } } +void Chart2ExportTest::testTdf132594() +{ + load("/chart2/qa/extras/data/xlsx/", "chart_pie2007.xlsx"); + xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:cat", 1); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/chart_pie2007.xlsx b/chart2/qa/extras/data/xlsx/chart_pie2007.xlsx new file mode 100644 index 000000000000..b122680257c0 Binary files /dev/null and b/chart2/qa/extras/data/xlsx/chart_pie2007.xlsx differ diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx b/oox/source/drawingml/chart/typegroupmodel.cxx index aae01ed0f58e..7353bafbecc7 100644 --- a/oox/source/drawingml/chart/typegroupmodel.cxx +++ b/oox/source/drawingml/chart/typegroupmodel.cxx @@ -57,7 +57,7 @@ TypeGroupModel::TypeGroupModel( sal_Int32 nTypeId, bool bMSO2007Doc ) : mbSmooth( !bMSO2007Doc ), mbVaryColors( !bMSO2007Doc ), mbWireframe( !bMSO2007Doc ), - mbCatAxisVisible( !bMSO2007Doc ) + mbCatAxisVisible( true ) { } commit 4c75fe312fd15dfe0556c6342586edae4ca5015d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed May 27 10:15:23 2020 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Mon Jun 1 17:46:34 2020 +0200 tdf#133426 Make mail merge progress dialog modal This prevents doing things like trying to start another mail merge for the same doc in parallel, thus crashing LibreOffice. Change-Id: I5df2e804d97e82cccca4f0e297cb6d3396652882 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94933 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit 77140de3fe925f75620e94dbd848b1c925935fb5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95247 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/uiconfig/swriter/ui/mmcreatingdialog.ui b/sw/uiconfig/swriter/ui/mmcreatingdialog.ui index c7c787c37c13..3af13d32de04 100644 --- a/sw/uiconfig/swriter/ui/mmcreatingdialog.ui +++ b/sw/uiconfig/swriter/ui/mmcreatingdialog.ui @@ -5,6 +5,7 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="mmcreatingdialog|MMCreatingDialog">Mail Merge</property> + <property name="modal">True</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> commit f753baddc057a3bf4881ac78a15cd11fa847ee28 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed May 27 17:11:34 2020 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jun 1 15:46:33 2020 +0200 Resolves: tdf#133411 drop CONTENT_FLOWS_TO from dialog to search results in the document, looks like only the calc one actually works, and when it works on large quantities of results calc grinds to a complete halt This was introduced with: commit b41332475783c31136673fb44cf4c411bb0148f8 Date: Mon Dec 2 15:54:29 2013 +0000 Integrate branch of IAccessible2 and has been a problem on and off with calc's potentially ~infinite grid There is the on-by-default search results dialog in calc (which has a limit on how many it shows) which provides an alternative route to iterate through the results Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95006 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 0b94169d820482434dc98a37c3c1633ca46fd0dc) Change-Id: I2685e480d2d15220be0bddbc83baad3992e7d5d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95014 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/include/comphelper/accflowenum.hxx b/include/comphelper/accflowenum.hxx deleted file mode 100644 index fc6b7ea2d8ec..000000000000 --- a/include/comphelper/accflowenum.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_COMPHELPER_ACCFLOWENUM_HXX -#define INCLUDED_COMPHELPER_ACCFLOWENUM_HXX - -#include <sal/types.h> - -enum AccessibilityFlowTo : sal_Int32 -{ - FORSPELLCHECKFLOWTO = 1, - FORFINDREPLACEFLOWTO_ITEM = 2, - FORFINDREPLACEFLOWTO_RANGE = 3 -}; - -#endif // INCLUDED_COMPHELPER_ACCFLOWENUM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx index 9a0bf9ea381d..34419ef28a5a 100644 --- a/include/svx/srchdlg.hxx +++ b/include/svx/srchdlg.hxx @@ -126,16 +126,11 @@ public: TransliterationFlags GetTransliterationFlags() const; - void SetDocWin(vcl::Window* pDocWin, SvxSearchCmd eCommand); - void SetSrchFlag( bool bSuccess ) { mbSuccess = bSuccess; } - bool GetSrchFlag() const { return mbSuccess; } void SetSaveToModule(bool b); void SetSearchLabel(const OUString& rStr); private: - bool mbSuccess; - SfxBindings& rBindings; bool bWriter; bool bSearch; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 940b2b0fb7c5..5a9ee5a92f39 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -156,11 +156,6 @@ public: virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) = 0; virtual void set_accessible_relation_label_for(weld::Widget* pLabeled) = 0; - virtual void - add_extra_accessible_relation(const css::accessibility::AccessibleRelation& rRelation) - = 0; - virtual void clear_extra_accessible_relations() = 0; - virtual void set_tooltip_text(const OUString& rTip) = 0; virtual OUString get_tooltip_text() const = 0; diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index c0381b8c75c9..d23b34e397dd 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1250,10 +1250,6 @@ public: void SetAccessibleRelationMemberOf( vcl::Window* pMemberOf ); vcl::Window* GetAccessibleRelationMemberOf() const; - void AddExtraAccessibleRelation(const css::accessibility::AccessibleRelation &rRelation); - const std::vector<css::accessibility::AccessibleRelation>& GetExtraAccessibleRelations() const; - void ClearExtraAccessibleRelations(); - // to avoid sending accessibility events in cases like closing dialogs // by default checks complete parent path bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true ); diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index e10636b5e678..7ff928fded57 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -52,7 +52,6 @@ #include <svx/AccessibleShapeTreeInfo.hxx> #include <svx/AccessibleShapeInfo.hxx> #include <svx/IAccessibleParent.hxx> -#include <comphelper/accflowenum.hxx> #include <comphelper/sequence.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/docfile.hxx> @@ -1609,13 +1608,6 @@ void SAL_CALL ScAccessibleDocument::selectionChanged( const lang::EventObject& / uno::Any SAL_CALL ScAccessibleDocument::queryInterface( uno::Type const & rType ) { - uno::Any aAnyTmp; - if(rType == cppu::UnoType<XAccessibleGetAccFlowTo>::get()) - { - css::uno::Reference<XAccessibleGetAccFlowTo> AccFromXShape = this; - aAnyTmp <<= AccFromXShape; - return aAnyTmp; - } uno::Any aAny (ScAccessibleDocumentImpl::queryInterface(rType)); return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType); } @@ -2227,153 +2219,6 @@ uno::Any SAL_CALL ScAccessibleDocument::getExtendedAttributes() return anyAtrribute; } -css::uno::Sequence< css::uno::Any > ScAccessibleDocument::GetScAccFlowToSequence() -{ - if ( getAccessibleChildCount() ) - { - uno::Reference < XAccessible > xSCTableAcc = getAccessibleChild( 0 ); // table - if ( xSCTableAcc.is() ) - { - uno::Reference < XAccessibleSelection > xAccSelection( xSCTableAcc, uno::UNO_QUERY ); - sal_Int32 nSelCount = xAccSelection->getSelectedAccessibleChildCount(); - if( nSelCount ) - { - uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); // selected cell - if ( xSel.is() ) - { - uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); - if ( xSelContext.is() ) - { - if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL ) - { - sal_Int32 nParaCount = 0; - uno::Sequence <uno::Any> aSequence(nSelCount); - for ( sal_Int32 i = 0; i < nSelCount; i++ ) - { - xSel = xAccSelection->getSelectedAccessibleChild( i ) ; - if ( xSel.is() ) - { - xSelContext = xSel->getAccessibleContext(); - if ( xSelContext.is() ) - { - if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL ) - { - aSequence[nParaCount] <<= xSel; - nParaCount++; - } - } - } - } - aSequence.realloc(nParaCount); - return aSequence; - } - } - } - } - } - } - uno::Sequence <uno::Any> aEmpty; - return aEmpty; -} - -css::uno::Sequence< css::uno::Any > - SAL_CALL ScAccessibleDocument::getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) -{ - SolarMutexGuard g; - - if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO) - { - uno::Reference< css::drawing::XShape > xShape; - rAny >>= xShape; - if ( xShape.is() ) - { - uno::Reference < XAccessible > xAcc = mpChildrenShapes->GetAccessibleCaption(xShape); - uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); - if ( xAccSelection.is() ) - { - if ( xAccSelection->getSelectedAccessibleChildCount() ) - { - uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); - if ( xSel.is() ) - { - uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); - if ( xSelContext.is() ) - { - //if in sw we find the selected paragraph here - if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xSel; - return aRet; - } - } - } - } - } - } - else - { - if ( getSelectedAccessibleChildCount() ) - { - uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 ); - if ( xSel.is() ) - { - uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); - if ( xSelContext.is() ) - { - uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY ); - if ( xAccChildSelection.is() ) - { - if ( xAccChildSelection->getSelectedAccessibleChildCount() ) - { - uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 ); - if ( xChildSel.is() ) - { - uno::Reference < css::accessibility::XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() ); - if ( xChildSelContext.is() && - xChildSelContext->getAccessibleRole() == css::accessibility::AccessibleRole::PARAGRAPH ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xChildSel; - return aRet; - } - } - } - } - } - } - } - } - } - else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE) - { - bool bSuccess(false); - rAny >>= bSuccess; - if ( bSuccess ) - { - if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE) - { - uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence(); - if ( aSeq.hasElements() ) - { - return aSeq; - } - } - - if( mpAccessibleSpreadsheet.is() ) - { - uno::Reference < XAccessible > xFindCellAcc = mpAccessibleSpreadsheet->GetActiveCell(); - // add xFindCellAcc to the return the Sequence - uno::Sequence< uno::Any> aSeq2(1); - aSeq2[0] <<= xFindCellAcc; - return aSeq2; - } - } - } - uno::Sequence< uno::Any> aEmpty; - return aEmpty; -} - sal_Int32 SAL_CALL ScAccessibleDocument::getForeground( ) { return sal_Int32(COL_BLACK); diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx index 2cf9db6a5c89..be3875c195d1 100644 --- a/sc/source/ui/inc/AccessibleDocument.hxx +++ b/sc/source/ui/inc/AccessibleDocument.hxx @@ -26,7 +26,6 @@ #include <com/sun/star/view/XSelectionChangeListener.hpp> #include <cppuhelper/implbase3.hxx> #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> -#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> #include <svx/IAccessibleViewForwarder.hxx> class ScTabViewShell; @@ -52,7 +51,6 @@ typedef cppu::ImplHelper3< css::accessibility::XAccessibleSelection, class ScAccessibleDocument : public ScAccessibleDocumentBase, public ScAccessibleDocumentImpl, - public css::accessibility::XAccessibleGetAccFlowTo, public accessibility::IAccessibleViewForwarder { public: @@ -257,11 +255,8 @@ private: public: ScDocument *GetDocument() const ; ScAddress GetCurCellAddress() const; - //===== XAccessibleGetAccFromXShape ============================================ - css::uno::Sequence< css::uno::Any > - SAL_CALL getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) override; - virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; virtual sal_Int32 SAL_CALL getBackground( ) override; }; diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index fece06e7d8ec..fac15994f2ba 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -230,26 +230,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) const SvxSearchItem* pSearchItem = static_cast<const SvxSearchItem*>(pItem); ScGlobal::SetSearchItem( *pSearchItem ); - bool bSuccess = SearchAndReplace( pSearchItem, true, rReq.IsAPI() ); - SfxChildWindow* pChildWindow = SfxViewFrame::Current()->GetChildWindow( - SvxSearchDialogWrapper::GetChildWindowId()); - if (pChildWindow) - { - SvxSearchDialog* pSearchDlg = static_cast<SvxSearchDialog*>(pChildWindow->GetController().get()); - if( pSearchDlg ) - { - ScTabView* pTabView = GetViewData().GetView(); - if( pTabView ) - { - vcl::Window* pWin = pTabView->GetActiveWin(); - if( pWin ) - { - pSearchDlg->SetDocWin( pWin, pSearchItem->GetCommand() ); - pSearchDlg->SetSrchFlag( bSuccess ); - } - } - } - } + SearchAndReplace( pSearchItem, true, rReq.IsAPI() ); rReq.Done(); } } @@ -301,25 +282,6 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) rReq.IsAPI() ? SfxCallMode::API|SfxCallMode::SYNCHRON : SfxCallMode::RECORD, { &aSearchItem }); - SfxChildWindow* pChildWindow = SfxViewFrame::Current()->GetChildWindow( - SvxSearchDialogWrapper::GetChildWindowId()); - if (pChildWindow) - { - SvxSearchDialog* pSearchDlg = static_cast<SvxSearchDialog*>(pChildWindow->GetController().get()); - if( pSearchDlg ) - { - ScTabView* pTabView = GetViewData().GetView(); - if( pTabView ) - { - vcl::Window* pWin = pTabView->GetActiveWin(); - if( pWin ) - { - pSearchDlg->SetDocWin( pWin, aSearchItem.GetCommand() ); - pSearchDlg->SetSrchFlag(false); - } - } - } - } } else { diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml index d69c951a8bbd..4681b29a8259 100644 --- a/sd/IwyuFilter_sd.yaml +++ b/sd/IwyuFilter_sd.yaml @@ -146,7 +146,6 @@ blacklist: sd/source/ui/inc/AccessibleDocumentViewBase.hxx: # base class has to be a complete type - com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp - - com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp - com/sun/star/awt/XFocusListener.hpp - com/sun/star/awt/XWindowListener.hpp - com/sun/star/beans/XPropertyChangeListener.hpp diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index d0fc351dee60..77d88ffb1831 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -381,7 +381,6 @@ uno::Any SAL_CALL static_cast<awt::XWindowListener*>(this), static_cast<awt::XFocusListener*>(this) ,static_cast<XAccessibleExtendedAttributes*>(this) - ,static_cast<XAccessibleGetAccFlowTo*>(this) ); return aReturn; } @@ -764,14 +763,6 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() return anyAtrribute; } -css::uno::Sequence< css::uno::Any > - SAL_CALL AccessibleDocumentViewBase::getAccFlowTo(const css::uno::Any&, sal_Int32 ) -{ - css::uno::Sequence< uno::Any> aRet; - - return aRet; -} - sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( ) { return sal_Int32(COL_BLACK); diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index 2e295a0eaf56..258aa4cc0bfa 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -30,7 +30,6 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <cppuhelper/queryinterface.hxx> -#include <comphelper/accflowenum.hxx> #include <comphelper/processfactory.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> @@ -737,156 +736,6 @@ void SAL_CALL AccessibleDrawDocumentView::disposing() AccessibleDocumentViewBase::disposing (); } -css::uno::Sequence< css::uno::Any > - SAL_CALL AccessibleDrawDocumentView::getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) -{ - SolarMutexGuard g; - - if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO) - { - uno::Reference< css::drawing::XShape > xShape; - rAny >>= xShape; - if ( mpChildrenManager && xShape.is() ) - { - uno::Reference < XAccessible > xAcc = mpChildrenManager->GetChild(xShape); - uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); - if ( xAccSelection.is() ) - { - if ( xAccSelection->getSelectedAccessibleChildCount() ) - { - uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); - if ( xSel.is() ) - { - uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); - if ( xSelContext.is() ) - { - //if in sw we find the selected paragraph here - if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xSel; - return aRet; - } - } - } - } - } - uno::Reference<XAccessible> xPara = GetSelAccContextInTable(); - if ( xPara.is() ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xPara; - return aRet; - } - } - else - { - goto Rt; - } - } - else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE) - { - sal_Int32 nChildCount = getSelectedAccessibleChildCount(); - if ( nChildCount ) - { - uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 ); - if ( xSel.is() ) - { - uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY ); - if ( xAccChildSelection.is() ) - { - if ( xAccChildSelection->getSelectedAccessibleChildCount() ) - { - uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 ); - if ( xChildSel.is() ) - { - uno::Reference < XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() ); - if ( xChildSelContext.is() && - xChildSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xChildSel; - return aRet; - } - } - } - } - } - } - else - { - uno::Reference<XAccessible> xPara = GetSelAccContextInTable(); - if ( xPara.is() ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xPara; - return aRet; - } - } - } - -Rt: - css::uno::Sequence< uno::Any> aRet; - return aRet; -} -uno::Reference<XAccessible> AccessibleDrawDocumentView::GetSelAccContextInTable() -{ - uno::Reference<XAccessible> xRet; - sal_Int32 nCount = mpChildrenManager ? mpChildrenManager->GetChildCount() : 0; - if ( nCount ) - { - for ( sal_Int32 i = 0; i < nCount; i++ ) - { - try - { - uno::Reference<XAccessible> xObj = mpChildrenManager->GetChild(i); - if ( xObj.is() ) - { - uno::Reference<XAccessibleContext> xObjContext( xObj, uno::UNO_QUERY ); - if ( xObjContext.is() && xObjContext->getAccessibleRole() == AccessibleRole::TABLE ) - { - uno::Reference<XAccessibleSelection> xObjSelection( xObj, uno::UNO_QUERY ); - if ( xObjSelection.is() && xObjSelection->getSelectedAccessibleChildCount() ) - { - uno::Reference<XAccessible> xCell = xObjSelection->getSelectedAccessibleChild(0); - if ( xCell.is() ) - { - uno::Reference<XAccessibleSelection> xCellSel( xCell, uno::UNO_QUERY ); - if ( xCellSel.is() && xCellSel->getSelectedAccessibleChildCount() ) - { - uno::Reference<XAccessible> xPara = xCellSel->getSelectedAccessibleChild( 0 ); - if ( xPara.is() ) - { - uno::Reference<XAccessibleContext> xParaContext( xPara, uno::UNO_QUERY ); - if ( xParaContext.is() && - xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - xRet = xPara; - return xRet; - } - } - } - } - } - } - } - } - catch (const lang::IndexOutOfBoundsException&) - { - uno::Reference<XAccessible> xEmpty; - return xEmpty; - } - catch (const uno::RuntimeException&) - { - uno::Reference<XAccessible> xEmpty; - return xEmpty; - } - } - } - - return xRet; -} - void AccessibleDrawDocumentView::UpdateAccessibleName() { OUString sNewName (CreateAccessibleName() + ": "); diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx index ee2acf119ce4..b29cc9533757 100644 --- a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx +++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx @@ -33,7 +33,6 @@ #include <tools/link.hxx> #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> -#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> #include "Window.hxx" @@ -87,8 +86,7 @@ class AccessibleDocumentViewBase public css::beans::XPropertyChangeListener, public css::awt::XWindowListener, public css::awt::XFocusListener, - public css::accessibility::XAccessibleExtendedAttributes, - public css::accessibility::XAccessibleGetAccFlowTo + public css::accessibility::XAccessibleExtendedAttributes { public: //===== internal ======================================================== @@ -313,9 +311,6 @@ protected: */ void SetAccessibleOLEObject ( const css::uno::Reference<css::accessibility::XAccessible>& xOLEObject); - //===== XAccessibleGetAccFromXShape ============================================ - css::uno::Sequence< css::uno::Any > - SAL_CALL getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) override; public: void SwitchViewActivated() { Activated(); } diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx index fd8b42f7161f..15097459bf76 100644 --- a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx +++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx @@ -158,12 +158,6 @@ private: virtual void impl_dispose() override; - //===== XAccessibleGetAccFromXShape ============================================ - css::uno::Sequence< css::uno::Any > - SAL_CALL getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) override; - css::uno::Reference< css::accessibility::XAccessible > - GetSelAccContextInTable(); - void UpdateAccessibleName(); }; diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index d3bd66724c7b..2652c14879c1 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -483,17 +483,6 @@ bool SdOutliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) } mnStartPageIndex = sal_uInt16(-1); } - - SfxChildWindow *pChildWin = - SfxViewFrame::Current()->GetChildWindow( - SvxSearchDialogWrapper::GetChildWindowId()); - if (pChildWin) - { - SvxSearchDialog* pSearchDlg = - static_cast<SvxSearchDialog*>(pChildWin->GetController().get()); - pSearchDlg->SetDocWin( pViewShell->GetActiveWindow(), nCommand ); - pSearchDlg->SetSrchFlag(false); - } } mpDrawDocument->GetDocSh()->SetWaitCursor( false ); diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 5f2b426e759d..6d98fd4ad8df 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -35,9 +35,6 @@ #include <svl/cjkoptions.hxx> #include <svl/ctloptions.hxx> #include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/accessibility/AccessibleRelation.hpp> -#include <com/sun/star/accessibility/AccessibleRelationType.hpp> -#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -47,7 +44,6 @@ #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/XUIElement.hpp> -#include <comphelper/accflowenum.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/scopeguard.hxx> #include <svl/itempool.hxx> @@ -260,7 +256,6 @@ void SearchAttrItemList::Remove(size_t nPos) SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind) : SfxModelessDialogController(&rBind, pChildWin, pParent, "svx/ui/findreplacedialog.ui", "FindReplaceDialog") - , mbSuccess(false) , rBindings(rBind) , bWriter(false) , bSearch(true) @@ -2289,58 +2284,6 @@ void SvxSearchDialog::SaveToModule_Impl() rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SfxCallMode::SLOT, ppArgs ); } -void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin, SvxSearchCmd eCommand) -{ - m_xDialog->clear_extra_accessible_relations(); - - if (!pDocWin) - return; - - Reference<css::accessibility::XAccessible> xDocAcc = pDocWin->GetAccessible(); - if (!xDocAcc.is()) - { - return; - } - Reference<css::accessibility::XAccessibleGetAccFlowTo> xGetAccFlowTo(xDocAcc, UNO_QUERY); - if (!xGetAccFlowTo.is()) - { - return; - } - - /* tdf#128313 FlowTo tries to set an a11y relation between the search dialog - and its results. But for "find/replace" within a calc column we don't - want to return the entire column as the result, we want the current cell. - - But with search/all we do want the new multi-cellselection as the result. - */ - AccessibilityFlowTo eFlowTo(AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM); - switch (eCommand) - { - case SvxSearchCmd::FIND: - case SvxSearchCmd::REPLACE: - eFlowTo = AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM; - break; - case SvxSearchCmd::FIND_ALL: - case SvxSearchCmd::REPLACE_ALL: - eFlowTo = AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE; - break; - } - uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo(Any(GetSrchFlag()), eFlowTo); - - sal_Int32 nLen = aAnySeq.getLength(); - if (nLen) - { - uno::Sequence<uno::Reference<uno::XInterface>> aSequence(nLen); - std::transform(aAnySeq.begin(), aAnySeq.end(), aSequence.begin(), - [](const uno::Any& rAny) -> uno::Reference < css::accessibility::XAccessible > { - uno::Reference < css::accessibility::XAccessible > xAcc; - rAny >>= xAcc; - return xAcc; - }); - m_xDialog->add_extra_accessible_relation(css::accessibility::AccessibleRelation(css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence)); - } -} - short SvxSearchDialog::executeSubDialog(VclAbstractDialog * dialog) { assert(!m_executingSubDialog); comphelper::ScopeGuard g([this] { m_executingSubDialog = false; }); diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index d62e1878582b..94989d2fae0a 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -24,7 +24,6 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -#include <comphelper/accflowenum.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <cppuhelper/typeprovider.hxx> #include <vcl/svapp.hxx> @@ -450,11 +449,6 @@ uno::Any SwAccessibleDocument::queryInterface( uno::Reference<XAccessibleExtendedAttributes> aAttribute = this; aRet <<= aAttribute; } - else if(rType == cppu::UnoType<XAccessibleGetAccFlowTo>::get()) - { - uno::Reference<XAccessibleGetAccFlowTo> AccFlowTo = this; - aRet <<= AccFlowTo; - } else aRet = SwAccessibleContext::queryInterface( rType ); return aRet; @@ -722,119 +716,4 @@ sal_Int32 SAL_CALL SwAccessibleDocument::getBackground() return sal_Int32(SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); } -css::uno::Sequence< css::uno::Any > - SAL_CALL SwAccessibleDocument::getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) -{ - SolarMutexGuard g; - - SwAccessibleMap* pAccMap = GetMap(); - if ( !pAccMap ) - { - return uno::Sequence< uno::Any >(); - } - - if (nType == AccessibilityFlowTo::FORSPELLCHECKFLOWTO) - { - uno::Reference< css::drawing::XShape > xShape; - rAny >>= xShape; - if( xShape.is() ) - { - SdrObject* pObj = GetSdrObjectFromXShape(xShape); - if( pObj ) - { - uno::Reference<XAccessible> xAcc = pAccMap->GetContext(pObj, this, false); - uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); - if ( xAccSelection.is() ) - { - try - { - if ( xAccSelection->getSelectedAccessibleChildCount() ) - { - uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); - if ( xSel.is() ) - { - uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); - if ( xSelContext.is() ) - { - //if in sw we find the selected paragraph here - if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - uno::Sequence<uno::Any> aRet( 1 ); - aRet[0] <<= xSel; - return aRet; - } - } - } - } - } - catch ( const css::lang::IndexOutOfBoundsException& ) - { - return uno::Sequence< uno::Any >(); - } - //end of try...catch - } - } - } - else - { - uno::Reference< XAccessible > xAcc = pAccMap->GetCursorContext(); - SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); - if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - uno::Sequence< uno::Any > aRet(1); - aRet[0] <<= xAcc; - return aRet; - } - } - } - else if (nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_ITEM || nType == AccessibilityFlowTo::FORFINDREPLACEFLOWTO_RANGE) - { - SwCursorShell* pCursorShell = GetCursorShell(); - if ( pCursorShell ) - { - SwPaM *_pStartCursor = pCursorShell->GetCursor(), *_pStartCursor2 = _pStartCursor; - std::set<SwFrame*> vFrameList; - do - { - if ( _pStartCursor && _pStartCursor->HasMark() ) - { - SwContentNode* pContentNode = _pStartCursor->GetContentNode(); - SwFrame *const pFrame = pContentNode - ? pContentNode->getLayoutFrame(pCursorShell->GetLayout(), _pStartCursor->GetPoint()) - : nullptr; - if ( pFrame ) - { - vFrameList.insert( pFrame ); - } - } - } - - while( _pStartCursor && ( (_pStartCursor = _pStartCursor->GetNext()) != _pStartCursor2) ); - - if ( !vFrameList.empty() ) - { - uno::Sequence< uno::Any > aRet(vFrameList.size()); - sal_Int32 nIndex = 0; - for ( const auto& rpFrame : vFrameList ) - { - uno::Reference< XAccessible > xAcc = pAccMap->GetContext(rpFrame, false); - if ( xAcc.is() ) - { - SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); - if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH ) - { - aRet[nIndex] <<= xAcc; - } - } - nIndex++; - } - aRet.realloc(nIndex); - return aRet; - } - } - } - - return uno::Sequence< uno::Any >(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx index 6f117c825b7e..e3c903e9da93 100644 --- a/sw/source/core/access/accdoc.hxx +++ b/sw/source/core/access/accdoc.hxx @@ -23,7 +23,6 @@ #include "acccontext.hxx" #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> -#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> #include "accselectionhelper.hxx" // base class for SwAccessibleDocument (in this same header file) and @@ -92,8 +91,7 @@ public: */ class SwAccessibleDocument : public SwAccessibleDocumentBase, public css::accessibility::XAccessibleSelection, - public css::accessibility::XAccessibleExtendedAttributes, - public css::accessibility::XAccessibleGetAccFlowTo + public css::accessibility::XAccessibleExtendedAttributes { // Implementation for XAccessibleSelection interface SwAccessibleSelectionHelper maSelectionHelper; @@ -170,10 +168,6 @@ public: // XAccessibleComponent sal_Int32 SAL_CALL getBackground() override; - - // XAccessibleGetAccFlowTo - css::uno::Sequence< css::uno::Any > - SAL_CALL getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) override; }; #endif diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 615c1288052b..029ed7774a90 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -247,16 +247,6 @@ void SwView::ExecSearch(SfxRequest& rReq) lcl_emitSearchResultCallbacks(s_pSrchItem, m_pWrtShell.get(), /* bHighlightAll = */ false); } rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); -#if HAVE_FEATURE_DESKTOP - { - pSrchDlg = GetSearchDialog(); - if (pSrchDlg) - { - pSrchDlg->SetDocWin(m_pEditWin, eCommand); - pSrchDlg->SetSrchFlag(false); - } - } -#endif } break; case SvxSearchCmd::FIND_ALL: @@ -280,16 +270,6 @@ void SwView::ExecSearch(SfxRequest& rReq) else if (comphelper::LibreOfficeKit::isActive()) lcl_emitSearchResultCallbacks(s_pSrchItem, m_pWrtShell.get(), /* bHighlightAll = */ true); rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); -#if HAVE_FEATURE_DESKTOP - { - pSrchDlg = GetSearchDialog(); - if (pSrchDlg) - { - pSrchDlg->SetDocWin(m_pEditWin, eCommand); - pSrchDlg->SetSrchFlag(false); - } - } -#endif } break; case SvxSearchCmd::REPLACE: @@ -338,16 +318,6 @@ void SwView::ExecSearch(SfxRequest& rReq) s_pSrchItem->SetCommand( nOldCmd ); rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); } -#if HAVE_FEATURE_DESKTOP - { - pSrchDlg = GetSearchDialog(); - if (pSrchDlg) - { - pSrchDlg->SetDocWin(m_pEditWin, eCommand); - pSrchDlg->SetSrchFlag(false); - } - } -#endif break; case SvxSearchCmd::REPLACE_ALL: @@ -407,14 +377,6 @@ void SwView::ExecSearch(SfxRequest& rReq) SvxSearchDialogWrapper::SetSearchLabel(sText); } } -#if HAVE_FEATURE_DESKTOP - pSrchDlg = GetSearchDialog(); - if (pSrchDlg) - { - pSrchDlg->SetDocWin(m_pEditWin, eCommand); - pSrchDlg->SetSrchFlag(false); - } -#endif break; } diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index eeb01bf62dac..675aa9c3ba31 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -374,9 +374,6 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pMemberOf->GetAccessible() }; rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); } - - for (const auto& rExtraRelation : pWindow->GetExtraAccessibleRelations()) - rRelationSet.AddRelation(rExtraRelation); } } diff --git a/vcl/inc/window.h b/vcl/inc/window.h index a328abf75c0e..89c0ff8cf3b9 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -280,7 +280,6 @@ public: css::uno::Reference< css::accessibility::XAccessible > mxAccessible; std::shared_ptr< VclSizeGroup > m_xSizeGroup; std::vector<VclPtr<FixedText>> m_aMnemonicLabels; - std::vector<css::accessibility::AccessibleRelation> m_aExtraAccessibleRelations; std::unique_ptr<ImplAccessibleInfos> mpAccessibleInfos; VCLXWindow* mpVCLXWindow; vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 042008200709..4231a572d81c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -546,16 +546,6 @@ public: m_xWidget->SetAccessibleRelationLabelFor(pAtkLabeled); } - virtual void add_extra_accessible_relation(const css::accessibility::AccessibleRelation &rRelation) override - { - m_xWidget->AddExtraAccessibleRelation(rRelation); - } - - virtual void clear_extra_accessible_relations() override - { - m_xWidget->ClearExtraAccessibleRelations(); - } - virtual void set_tooltip_text(const OUString& rTip) override { m_xWidget->SetQuickHelpText(rTip); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 9183ded20184..aa791975e765 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1959,21 +1959,6 @@ const std::vector<VclPtr<FixedText> >& Window::list_mnemonic_labels() const return mpWindowImpl->m_aMnemonicLabels; } -void Window::AddExtraAccessibleRelation(const css::accessibility::AccessibleRelation &rRelation) -{ - mpWindowImpl->m_aExtraAccessibleRelations.push_back(rRelation); -} - -const std::vector<css::accessibility::AccessibleRelation>& Window::GetExtraAccessibleRelations() const -{ - return mpWindowImpl->m_aExtraAccessibleRelations; -} - -void Window::ClearExtraAccessibleRelations() -{ - mpWindowImpl->m_aExtraAccessibleRelations.clear(); -} - } /* namespace vcl */ void DrawFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 14be34515a50..6faad1ddf9c3 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1920,7 +1920,7 @@ private: gulong m_nDragLeaveSignalId; rtl::Reference<GtkDropTarget> m_xDropTarget; - std::vector<AtkRelation*> m_aExtraAtkRelations; + rtl::Reference<GtkDragSource> m_xDragSource; static void signalSizeAllocate(GtkWidget*, GdkRectangle* allocation, gpointer widget) { @@ -2510,33 +2510,6 @@ public: g_object_unref(pRelationSet); } - virtual void add_extra_accessible_relation(const css::accessibility::AccessibleRelation &rRelation) override - { - AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget); - if (!pAtkObject) - return; - - AtkRelationSet *pRelationSet = atk_object_ref_relation_set(pAtkObject); - AtkRelation *pRel = atk_object_wrapper_relation_new(rRelation); - m_aExtraAtkRelations.push_back(pRel); - atk_relation_set_add(pRelationSet, pRel); - g_object_unref(pRel); - g_object_unref(pRelationSet); - } - - virtual void clear_extra_accessible_relations() override - { - AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget); - if (!pAtkObject) - return; - - AtkRelationSet *pRelationSet = atk_object_ref_relation_set(pAtkObject); - for (AtkRelation* pRel : m_aExtraAtkRelations) - atk_relation_set_remove(pRelationSet, pRel); - m_aExtraAtkRelations.clear(); - g_object_unref(pRelationSet); - } - virtual bool get_extents_relative_to(weld::Widget& rRelative, int& x, int &y, int& width, int &height) override { //for toplevel windows this is sadly futile under wayland, so we can't tell where a dialog is in order to allow commit 8871f81f218dd49de27d528e54a515d1648d3554 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue May 26 16:43:27 2020 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri May 29 18:05:00 2020 +0200 tdf#131684 tdf#132236 sw_redlinehide: fix upper of frame moved... ... in SwUndoDelete::UndoImpl; this wasn't fixed properly in commit 6c7245e789f973cf6dad03f7008ab3f9d12d350c - the SwTextFrame was moved into the SwSectionFrame but its upper was whatever it was previously. This is rather ugly because with the constraint from the very special case of tdf#131684 the MakeFrames() requires one node with pre-existing frames, and it's not possible to move the pre-existing frame after MakeFrames() because then the tdf#132236 case will have an empty SwSectionFrame and InsertCnt_() will just delete it. So try to detect the situation with some hack in InsertCnt_() to move it into the SwSectionFrame. (regression from 723728cd358693b8f4bc9d913541aa4479f2bd48) Change-Id: Ic0199c85d7523a49676ad3df1d2c4d8fe135c2ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94881 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 55576842ec72a748d0bad123d41fa03c89fc136d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95023 Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index a035cef8b3e3..e8f1f47dcf86 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -171,6 +171,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131684) // without the fix, it crashes lcl_dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + // check that the text frame has the correct upper + xmlDocPtr pXmlDoc = parseLayoutDump(); + OUString const sectionId = getXPath(pXmlDoc, "/root/page[1]/body/section[7]", "id"); + OUString const sectionLower = getXPath(pXmlDoc, "/root/page[1]/body/section[7]", "lower"); + OUString const textId = getXPath(pXmlDoc, "/root/page[1]/body/section[7]/txt[1]", "id"); + OUString const textUpper = getXPath(pXmlDoc, "/root/page[1]/body/section[7]/txt[1]", "upper"); + CPPUNIT_ASSERT_EQUAL(textId, sectionLower); + CPPUNIT_ASSERT_EQUAL(sectionId, textUpper); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 32447b47bb45..2a2a59377636 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1694,6 +1694,36 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, static_cast<SwTextFrame*>(pPrv)->Prepare( PREP_QUOVADIS, nullptr, false ); } } + if (nIndex + 1 == nEndIndex) + { // tdf#131684 tdf#132236 fix upper of frame moved in + // SwUndoDelete; can't be done there unfortunately + // because empty section frames are deleted here + SwFrame *const pNext( + // if there's a parent section, it has been split + // into 2 SwSectionFrame already :( + ( pFrame->GetNext()->IsSctFrame() + && pActualSection->GetUpper() + && pActualSection->GetUpper()->GetSectionNode() == + static_cast<SwSectionFrame const*>(pFrame->GetNext())->GetSection()->GetFormat()->GetSectionNode()) + ? static_cast<SwSectionFrame *>(pFrame->GetNext())->ContainsContent() + : pFrame->GetNext()); + if (pNext + && pNext->IsTextFrame() + && static_cast<SwTextFrame*>(pNext)->GetTextNodeFirst() == pDoc->GetNodes()[nEndIndex] + && (pNext->GetUpper() == pFrame->GetUpper() + || pFrame->GetNext()->IsSctFrame())) // checked above + { + pNext->Cut(); + pNext->InvalidateInfFlags(); // mbInfSct changed + // could have columns + SwSectionFrame *const pSection(static_cast<SwSectionFrame*>(pFrame)); + assert(!pSection->Lower() || pSection->Lower()->IsLayoutFrame()); + SwLayoutFrame *const pParent(pSection->Lower() ? pSection->GetNextLayoutLeaf() : pSection); + assert(!pParent->Lower()); + // paste invalidates, section could have indent... + pNext->Paste(pParent, nullptr); + } + } // #i27138# // notify accessibility paragraphs objects about changed // CONTENT_FLOWS_FROM/_TO relation. commit 9c84242dcee576147e520624641b208e874e908c Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue May 26 16:46:57 2020 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri May 29 18:04:06 2020 +0200 tdf#132236 sw_redlinehide: fix SwUndoDelete with sections even more SwUndoDelete::UndoImpl may want to move something like this into the nodes-array: [ 9] 0x6356fe0 TextNode "", [ 10] 0x31cba00 ~DeletedNode , [ 11] 0x64d8840 TextNode "Introduction - xzn Overview Of KmneqxziTY\t3", [ 12] 0x64e9750 TextNode "shell\t20", [ 13] 0x7a0f0a0 ~DeletedNode , The ~DeletedNode become end nodes of section nodes; in this case m_nSectDiff != 0. Don't skip these end nodes because in the above "Untitled 1.odt" example, they are not necessarily consecutive. Between the 1st and 2nd one a new SwSectionFrame must be created via the outer section, so adapt InsertCnt_() to check for extra end nodes in the range and do this. (regression from 723728cd358693b8f4bc9d913541aa4479f2bd48) Change-Id: I7bfba9efca1789392495ebec37eb3e5b6138bd07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94883 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit ca8e04f1ab739e14288ab5e0be44723536b9ca4e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94963 Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/uiwriter/data2/tdf132236.odt b/sw/qa/extras/uiwriter/data2/tdf132236.odt new file mode 100644 index 000000000000..f37c9befc095 Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf132236.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 3eb6f25d9d14..a035cef8b3e3 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -337,6 +337,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) CPPUNIT_ASSERT(pNode->GetNodes()[pNode->GetIndex() + 4]->IsEndNode()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236) +{ + load(DATA_DIRECTORY, "tdf132236.odt"); + + SwXTextDocument* const pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + // select everything and delete + SwWrtShell* const pWrtShell(pTextDoc->GetDocShell()->GetWrtShell()); + pWrtShell->Down(true); + pWrtShell->Down(true); + pWrtShell->Down(true); + pWrtShell->Delete(); + SwDoc* const pDoc(pWrtShell->GetDoc()); + sw::UndoManager& rUndoManager(pDoc->GetUndoManager()); + rUndoManager.Undo(); + + // check that the text frames exist inside their sections + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 1); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819) { load(DATA_DIRECTORY, "tdf54819.fodt"); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 5c6e6cc4dd44..32447b47bb45 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1478,7 +1478,23 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) && ( !pLay->IsInTab() || pSct->IsInTab() ) ) { - pActualSection.reset(new SwActualSection( nullptr, pSct, nullptr )); + pActualSection.reset(new SwActualSection(nullptr, pSct, pSct->GetSection()->GetFormat()->GetSectionNode())); + // tdf#132236 for SwUndoDelete: find outer sections whose start + // nodes aren't contained in the range but whose end nodes are, + // because section frames may need to be created for them + SwActualSection * pUpperSection(pActualSection.get()); + while (pUpperSection->GetSectionNode()->EndOfSectionIndex() < nEndIndex) + { + SwStartNode *const pStart(pUpperSection->GetSectionNode()->StartOfSectionNode()); + if (!pStart->IsSectionNode()) + { + break; + } + // note: these don't have a section frame, check it in EndNode case! + auto const pTmp(new SwActualSection(nullptr, nullptr, static_cast<SwSectionNode*>(pStart))); + pUpperSection->SetUpper(pTmp); + pUpperSection = pTmp; + } OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(), "InsertCnt_: Wrong Call" ); } @@ -1770,7 +1786,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, SwSectionFrame* pOuterSectionFrame = pActualSection->GetSectionFrame(); // a follow has to be appended to the new section frame - SwSectionFrame* pFollow = pOuterSectionFrame->GetFollow(); + SwSectionFrame* pFollow = pOuterSectionFrame ? pOuterSectionFrame->GetFollow() : nullptr; if ( pFollow ) { pOuterSectionFrame->SetFollow( nullptr ); @@ -1779,7 +1795,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, } // We don't want to leave empty parts back. - if( ! pOuterSectionFrame->IsColLocked() && + if (pOuterSectionFrame && + ! pOuterSectionFrame->IsColLocked() && ! pOuterSectionFrame->ContainsContent() ) { pOuterSectionFrame->DelEmpty( true ); diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx index 0f39b1b0cd00..9dc5a916b25f 100644 --- a/sw/source/core/layout/layhelp.hxx +++ b/sw/source/core/layout/layhelp.hxx @@ -83,7 +83,7 @@ public: // by controlling nested sections. class SwActualSection { - SwActualSection * const pUpper; + SwActualSection *pUpper; SwSectionFrame *pSectFrame; SwSectionNode *pSectNode; public: @@ -94,6 +94,7 @@ public: SwSectionFrame *GetSectionFrame() { return pSectFrame; } void SetSectionFrame( SwSectionFrame *p ) { pSectFrame = p; } SwSectionNode *GetSectionNode() { return pSectNode;} + void SetUpper(SwActualSection *p) { pUpper = p; } SwActualSection *GetUpper() { return pUpper; } }; diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 63d7c786ae95..c9dc7fdae063 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -1095,6 +1095,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) // tdf#121031 if the start node is a text node, it already has a frame; // if it's a table, it does not // tdf#109376 exception: end on non-text-node -> start node was inserted + assert(!m_bDelFullPara || (m_nSectDiff == 0)); SwNodeIndex const start(rDoc.GetNodes(), m_nSttNode + ((m_bDelFullPara || !rDoc.GetNodes()[m_nSttNode]->IsTextNode() || pInsNd) ? 0 : 1)); commit d2cb2ecff3cce10f47a9ae1b1ba80e0eff23745c Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed May 27 14:04:58 2020 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri May 29 17:23:59 2020 +0200 oox smartart import, composite alg: implement vertical centering The bugdoc's case was that the total height would be used by 2 shapes, but then a constraint decreases the height of one shape, so not all vertical space is used. We used to just count from the top, need to center vertically, as PowerPoint does it. (cherry picked from commit acdde3c643fde015214c546b1567727272ea799e) Change-Id: I436019e9e837b73130e387c9bcd309e20045b0f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95017 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 33f858386999..19b1d10679f4 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -479,6 +479,11 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, LayoutProperty& rParent = aProperties[""]; sal_Int32 nParentXOffset = 0; + + // Track min/max vertical positions, so we can center everything at the end, if needed. + sal_Int32 nVertMin = std::numeric_limits<sal_Int32>::max(); + sal_Int32 nVertMax = 0; + if (mfAspectRatio != 1.0) { rParent[XML_w] = rShape->getSize().Width; @@ -614,6 +619,24 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, aCurrShape->setSize(aSize); aCurrShape->setChildSize(aSize); aCurrShape->setPosition(aPos); + + nVertMin = std::min(aPos.Y, nVertMin); + nVertMax = std::max(aPos.Y + aSize.Height, nVertMax); + } + + // See if all vertical space is used or we have to center the content. + if (nVertMin >= 0 && nVertMax <= rParent[XML_h]) + { + sal_Int32 nDiff = rParent[XML_h] - (nVertMax - nVertMin); + if (nDiff > 0) + { + for (auto& aCurrShape : rShape->getChildren()) + { + awt::Point aPosition = aCurrShape->getPosition(); + aPosition.Y += nDiff / 2; + aCurrShape->setPosition(aPosition); + } + } } break; } diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 327645fddc3f..4b110f740e11 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1480,6 +1480,14 @@ void SdImportTestSmartArt::testFillColorList() awt::Size aActualSize = xShape->getSize(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2239), aActualSize.Height); + // Without the accompanying fix in place, this test would have failed with: + // - Expected greater than: 1738 (2766) + // - Actual : 1738 + // i.e. the columns were not centered vertically. + sal_Int32 nGroupTop = xGroup->getPosition().Y; + sal_Int32 nShapeTop = xShape->getPosition().Y; + CPPUNIT_ASSERT_GREATER(nGroupTop, nShapeTop); + xDocShRef->DoClose(); } commit 80493ba382647b51e56fc3a5aa3445b0bd17fc0c Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue May 26 16:16:27 2020 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri May 29 17:20:14 2020 +0200 oox smartart import: fix aspect ratio of shape with composite algo The layout node has alg=composite, then a parTx and a desTx child layout nodes. No matter what order is used (parent first, child first), the result will be wrong, as the constraints refer to each other. I did not spot any description in ISO 29500-1 that would describe what is the expected behavior. Researching this, found "One other consideration when specifying composite constraints is that the constraints must be specified in the same order as the nested layout nodes." at <http://web.archive.org/web/20111015151600/http://msdn.microsoft.com/en-us/magazine/cc163470.aspx>, which suggests to handle constraints for each shape in a parent -> child order, but keep a shared state when iterating over the children which gives us: - parent node, all direct constraints - for each child node: - child's constraints from parent - child's own constraints This way the desTx top value can depend on the parTx's height, and it's supported to define parTx's height only in the parTx layout node, not in the composite parent. And after all, it matches what PowerPoint does, so the column headings in the bugdoc have a 4:10 height:width aspect ratio. (cherry picked from commit 414586649582e182b2603702f4f586f4beeed8a9) Change-Id: Ideb76c1ddd1ffff8d2a217cddf81106d1bb97eb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95016 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 0832bb1bfe7b..33f858386999 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -430,6 +430,42 @@ sal_Int32 AlgAtom::getVerticalShapesCount(const ShapePtr& rShape) return nCount; } +namespace +{ +/** + * Apply rConstraint to the rProperties shared layout state. + * + * Note that the order in which constraints are applied matters, given that constraints can refer to + * each other, and in case A depends on B and A is applied before B, the effect of A won't be + * updated when B is applied. + */ +void ApplyConstraintToLayout(const Constraint& rConstraint, LayoutPropertyMap& rProperties) +{ + const LayoutPropertyMap::const_iterator aRef = rProperties.find(rConstraint.msRefForName); + if (aRef != rProperties.end()) + { + const LayoutProperty::const_iterator aRefType = aRef->second.find(rConstraint.mnRefType); + if (aRefType != aRef->second.end()) + rProperties[rConstraint.msForName][rConstraint.mnType] + = aRefType->second * rConstraint.mfFactor; + else + { + // Values are never in EMU, while oox::drawingml::Shape position and size are always in + // EMU. + double fUnitFactor = 0; + if (isFontUnit(rConstraint.mnRefType)) + // Points -> EMU. + fUnitFactor = EMU_PER_PT; + else + // Millimeters -> EMU. + fUnitFactor = EMU_PER_HMM * 100; + rProperties[rConstraint.msForName][rConstraint.mnType] + = rConstraint.mfValue * fUnitFactor; + } + } +} +} + void AlgAtom::layoutShape( const ShapePtr& rShape, const std::vector<Constraint>& rConstraints ) { @@ -467,31 +503,74 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, for (const auto & rConstr : rConstraints) { - const LayoutPropertyMap::const_iterator aRef = aProperties.find(rConstr.msRefForName); - if (aRef != aProperties.end()) + // Apply direct constraints for all layout nodes. + ApplyConstraintToLayout(rConstr, aProperties); + } + + for (auto& aCurrShape : rShape->getChildren()) + { + // Apply constraints from the current layout node for this child shape. + // Previous child shapes may have changed aProperties. + for (const auto& rConstr : rConstraints) { - const LayoutProperty::const_iterator aRefType = aRef->second.find(rConstr.mnRefType); - if (aRefType != aRef->second.end()) - aProperties[rConstr.msForName][rConstr.mnType] = aRefType->second * rConstr.mfFactor; - else + if (rConstr.msForName != aCurrShape->getInternalName()) { - // Values are never in EMU, while oox::drawingml::Shape - // position and size are always in EMU. - double fUnitFactor = 0; - if (isFontUnit(rConstr.mnRefType)) - // Points -> EMU. - fUnitFactor = EMU_PER_PT; - else - // Millimeters -> EMU. - fUnitFactor = EMU_PER_HMM * 100; - aProperties[rConstr.msForName][rConstr.mnType] - = rConstr.mfValue * fUnitFactor; + continue; + } + + ApplyConstraintToLayout(rConstr, aProperties); + } + + // Apply constraints from the child layout node for this child shape. + // This builds on top of the own parent state + the state of previous shapes in the + // same composite algorithm. + const LayoutNode& rLayoutNode = getLayoutNode(); + for (const auto& pDirectChild : rLayoutNode.getChildren()) + { + auto pLayoutNode = dynamic_cast<LayoutNode*>(pDirectChild.get()); + if (!pLayoutNode) + { + continue; + } + + if (pLayoutNode->getName() != aCurrShape->getInternalName()) + { + continue; + } + + for (const auto& pChild : pLayoutNode->getChildren()) + { + auto pConstraintAtom = dynamic_cast<ConstraintAtom*>(pChild.get()); + if (!pConstraintAtom) + { + continue; + } + + const Constraint& rConstraint = pConstraintAtom->getConstraint(); + if (!rConstraint.msForName.isEmpty()) + { + continue; + } + + if (!rConstraint.msRefForName.isEmpty()) + { + continue; + } + + // Either an absolute value or a factor of a property. + if (rConstraint.mfValue == 0.0 && rConstraint.mnRefType == XML_none) + { + continue; + } + + Constraint aConstraint(rConstraint); + aConstraint.msForName = pLayoutNode->getName(); + aConstraint.msRefForName = pLayoutNode->getName(); + + ApplyConstraintToLayout(aConstraint, aProperties); } } - } - for (auto & aCurrShape : rShape->getChildren()) - { awt::Size aSize = rShape->getSize(); awt::Point aPos(0, 0); diff --git a/sd/qa/unit/data/pptx/fill-color-list.pptx b/sd/qa/unit/data/pptx/fill-color-list.pptx index 341233ad5f78..c88434952631 100644 Binary files a/sd/qa/unit/data/pptx/fill-color-list.pptx and b/sd/qa/unit/data/pptx/fill-color-list.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 273056c868d7..327645fddc3f 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -1470,6 +1470,16 @@ void SdImportTestSmartArt::testFillColorList() // - Actual : 16225862 (0xf79646) // i.e. the background of the "A" shape was orange-ish, rather than red-ish. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xC0504D), nFillColor); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 2239 + // - Actual : 5199 + // i.e. the "A" shape's height/width aspect ratio was not 0.4 but rather close to 1.0, even if + // ppt/diagrams/layout1.xml's <dgm:constr type="h" refType="w" op="lte" fact="0.4"/> requested + // 0.4. + awt::Size aActualSize = xShape->getSize(); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2239), aActualSize.Height); + xDocShRef->DoClose(); } commit 50d004fc8fe2c44516c52d22b40a221e8e3b587d Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri May 22 17:58:22 2020 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri May 29 16:33:44 2020 +0200 smartart import: handle multiple <a:schemeClr> in <dgm:fillClrLst> The TODO in the ColorFragmentHandler ctor was right: we only handled the last <a:schemeClr> child, but there can be multiple one. Use them based on the index of a shape in a <dgm:forEach> loop. Move the TODO to the only place which still assumes a single color in the color list. (cherry picked from commit 12bea6c897822964ad4705418da54411cb15749e) Conflicts: oox/source/drawingml/colorchoicecontext.cxx oox/source/drawingml/diagram/diagram.cxx sd/qa/unit/import-tests-smartart.cxx Change-Id: I1c5c4f82e621f1110ef06b0490ff79f82f60f214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95015 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/oox/inc/drawingml/colorchoicecontext.hxx b/oox/inc/drawingml/colorchoicecontext.hxx index 29889f494e3d..dae8d7fb8e25 100644 --- a/oox/inc/drawingml/colorchoicecontext.hxx +++ b/oox/inc/drawingml/colorchoicecontext.hxx @@ -22,6 +22,8 @@ #include <oox/core/contexthandler2.hxx> +#include <vector> + namespace oox { namespace drawingml { @@ -65,6 +67,19 @@ private: Color& mrColor; }; +/// Same as ColorContext, but handles multiple colors. +class ColorsContext : public ::oox::core::ContextHandler2 +{ +public: + explicit ColorsContext(::oox::core::ContextHandler2Helper const& rParent, + std::vector<Color>& rColors); + + virtual ::oox::core::ContextHandlerRef + onCreateContext(sal_Int32 nElement, const ::oox::AttributeList& rAttribs) override; + +private: + std::vector<Color>& mrColors; +}; } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx index cf6c17ecd3b4..a9e0d91ef32e 100644 --- a/oox/source/drawingml/colorchoicecontext.cxx +++ b/oox/source/drawingml/colorchoicecontext.cxx @@ -149,6 +149,31 @@ ColorContext::ColorContext( ContextHandler2Helper const & rParent, Color& rColor return nullptr; } +ColorsContext::ColorsContext(ContextHandler2Helper const& rParent, std::vector<Color>& rColors) + : ContextHandler2(rParent) + , mrColors(rColors) +{ +} + +::oox::core::ContextHandlerRef ColorsContext::onCreateContext(sal_Int32 nElement, + const AttributeList&) +{ + switch (nElement) + { + case A_TOKEN(scrgbClr): + case A_TOKEN(srgbClr): + case A_TOKEN(hslClr): + case A_TOKEN(sysClr): + case A_TOKEN(schemeClr): + case A_TOKEN(prstClr): + { + mrColors.emplace_back(); + return new ColorValueContext(*this, mrColors.back()); + } + } + return nullptr; +} + } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index b2f3373ad113..a03a06c39125 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -321,9 +321,11 @@ void loadDiagram( ShapePtr const & pShape, if( !pData->getExtDrawings().empty() ) { const DiagramColorMap::const_iterator aColor = pDiagram->getColors().find("node0"); - if( aColor != pDiagram->getColors().end() ) + if( aColor != pDiagram->getColors().end() && !aColor->second.maTextFillColors.empty()) { - pShape->setFontRefColorForNodes(aColor->second.maTextFillColor); + // TODO(F1): well, actually, there might be *several* color + // definitions in it, after all it's called list. + pShape->setFontRefColorForNodes(DiagramColor::getColorByIndex(aColor->second.maTextFillColors, -1)); } } @@ -425,6 +427,17 @@ void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter) child->addShape(rFilter, rFilter.getCurrentTheme(), xShapes, aTransformation, pShape->getFillProperties()); } +const oox::drawingml::Color& +DiagramColor::getColorByIndex(const std::vector<oox::drawingml::Color>& rColors, sal_Int32 nIndex) +{ + assert(!rColors.empty()); + if (nIndex == -1) + { + return rColors[rColors.size() - 1]; + } + + return rColors[nIndex % rColors.size()]; +} } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx index 576c4007e29f..a674e248961e 100644 --- a/oox/source/drawingml/diagram/diagram.hxx +++ b/oox/source/drawingml/diagram/diagram.hxx @@ -22,6 +22,7 @@ #include <map> #include <memory> +#include <vector> #include <rtl/ustring.hxx> @@ -111,12 +112,15 @@ typedef std::map<OUString,DiagramStyle> DiagramQStyleMap; struct DiagramColor { - oox::drawingml::Color maFillColor; - oox::drawingml::Color maLineColor; - oox::drawingml::Color maEffectColor; - oox::drawingml::Color maTextFillColor; - oox::drawingml::Color maTextLineColor; - oox::drawingml::Color maTextEffectColor; + std::vector<oox::drawingml::Color> maFillColors; + std::vector<oox::drawingml::Color> maLineColors; + std::vector<oox::drawingml::Color> maEffectColors; + std::vector<oox::drawingml::Color> maTextFillColors; + std::vector<oox::drawingml::Color> maTextLineColors; + std::vector<oox::drawingml::Color> maTextEffectColors; + + static const oox::drawingml::Color& + getColorByIndex(const std::vector<oox::drawingml::Color>& rColors, sal_Int32 nIndex); }; typedef std::map<OUString,DiagramColor> DiagramColorMap; diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx index 6e1000af3627..7eae543dc6f9 100644 --- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx +++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx @@ -196,21 +196,18 @@ ColorFragmentHandler::ColorFragmentHandler( ::oox::core::XmlFilterBase& rFilter, { // the actual colors - defer to color fragment handlers. - // TODO(F1): well, actually, there might be *several* color - // definitions in it, after all it's called list. But - // apparently ColorContext doesn't handle that anyway... case DGM_TOKEN(fillClrLst): - return new ColorContext( *this, maColorEntry.maFillColor ); + return new ColorsContext( *this, maColorEntry.maFillColors ); case DGM_TOKEN(linClrLst): - return new ColorContext( *this, maColorEntry.maLineColor ); + return new ColorsContext( *this, maColorEntry.maLineColors ); case DGM_TOKEN(effectClrLst): - return new ColorContext( *this, maColorEntry.maEffectColor ); + return new ColorsContext( *this, maColorEntry.maEffectColors ); case DGM_TOKEN(txFillClrLst): - return new ColorContext( *this, maColorEntry.maTextFillColor ); + return new ColorsContext( *this, maColorEntry.maTextFillColors ); case DGM_TOKEN(txLinClrLst): - return new ColorContext( *this, maColorEntry.maTextLineColor ); + return new ColorsContext( *this, maColorEntry.maTextLineColors ); case DGM_TOKEN(txEffectClrLst): - return new ColorContext( *this, maColorEntry.maTextEffectColor ); + return new ColorsContext( *this, maColorEntry.maTextEffectColors ); } break; } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index ff83dde63fa3..0832bb1bfe7b 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1275,7 +1275,7 @@ void LayoutNode::accept( LayoutAtomVisitor& rVisitor ) rVisitor.visit(*this); } -bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode ) const +bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode, sal_Int32 nCurrIdx ) const { SAL_INFO( "oox.drawingml", @@ -1413,15 +1413,17 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode const DiagramColorMap::const_iterator aColor = mrDgm.getColors().find(aStyleLabel); if( aColor != mrDgm.getColors().end() ) { + // Take the nth color from the color list in case we are the nth shape in a + // <dgm:forEach> loop. const DiagramColor& rColor=aColor->second; - if( rColor.maFillColor.isUsed() ) - rShape->getShapeStyleRefs()[XML_fillRef].maPhClr = rColor.maFillColor; - if( rColor.maLineColor.isUsed() ) - rShape->getShapeStyleRefs()[XML_lnRef].maPhClr = rColor.maLineColor; - if( rColor.maEffectColor.isUsed() ) - rShape->getShapeStyleRefs()[XML_effectRef].maPhClr = rColor.maEffectColor; - if( rColor.maTextFillColor.isUsed() ) - rShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rColor.maTextFillColor; + if( !rColor.maFillColors.empty() ) + rShape->getShapeStyleRefs()[XML_fillRef].maPhClr = DiagramColor::getColorByIndex(rColor.maFillColors, nCurrIdx); + if( !rColor.maLineColors.empty() ) + rShape->getShapeStyleRefs()[XML_lnRef].maPhClr = DiagramColor::getColorByIndex(rColor.maLineColors, nCurrIdx); + if( !rColor.maEffectColors.empty() ) + rShape->getShapeStyleRefs()[XML_effectRef].maPhClr = DiagramColor::getColorByIndex(rColor.maEffectColors, nCurrIdx); + if( !rColor.maTextFillColors.empty() ) + rShape->getShapeStyleRefs()[XML_fontRef].maPhClr = DiagramColor::getColorByIndex(rColor.maTextFillColors, nCurrIdx); } } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx index 91028971473e..2e4551642389 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx @@ -260,7 +260,8 @@ public: { mpNodeShapes.push_back(pShape); } bool setupShape( const ShapePtr& rShape, - const dgm::Point* pPresNode ) const; + const dgm::Point* pPresNode, + sal_Int32 nCurrIdx ) const; const LayoutNode* getParentLayoutNode() const; diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx index 4bfadc3affe8..c616ca3a9010 100644 --- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx @@ -73,7 +73,7 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) { // reuse existing shape ShapePtr pShape = rAtom.getExistingShape(); - if (rAtom.setupShape(pShape, pNewNode)) + if (rAtom.setupShape(pShape, pNewNode, mnCurrIdx)) { pShape->setInternalName(rAtom.getName()); rAtom.addNodeShape(pShape); @@ -92,7 +92,7 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) "oox.drawingml", "processing shape type " << (pShape->getCustomShapeProperties()->getShapePresetType())); - if (rAtom.setupShape(pShape, pNewNode)) + if (rAtom.setupShape(pShape, pNewNode, mnCurrIdx)) { pShape->setInternalName(rAtom.getName()); pCurrParent->addChild(pShape); diff --git a/sd/qa/unit/data/pptx/fill-color-list.pptx b/sd/qa/unit/data/pptx/fill-color-list.pptx new file mode 100644 index 000000000000..341233ad5f78 Binary files /dev/null and b/sd/qa/unit/data/pptx/fill-color-list.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index d14c4bc6950a..273056c868d7 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -105,6 +105,7 @@ public: void testRecursion(); void testDataFollow(); void testOrgChart2(); + void testFillColorList(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -149,6 +150,7 @@ public: CPPUNIT_TEST(testRecursion); CPPUNIT_TEST(testDataFollow); CPPUNIT_TEST(testOrgChart2); + CPPUNIT_TEST(testFillColorList); CPPUNIT_TEST_SUITE_END(); }; @@ -1454,6 +1456,23 @@ void SdImportTestSmartArt::testOrgChart2() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testFillColorList() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/fill-color-list.pptx"), PPTX); + uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape = getChildShape(getChildShape(xGroup, 1), 0); + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY_THROW); + sal_Int32 nFillColor = 0; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits