Rebased ref, commits from common ancestor: commit 6c0a51299c66998bffb1dcc9526f6dd7ceef2d65 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Apr 14 17:42:06 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Jun 5 14:38:00 2020 +0200
sw: DOCX export: export AddExternalLeading as w:noLeading For 11pt Arial, can fit 59 paragraphs on a page vs. 57... This is annoyingly complicated by the fact that Word 2013 ignores w:noLeading element if compatibilityMode is 15. Change-Id: Ie3093eabba45cdf6e7903ed860f5bad24dcc0323 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92208 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 968a7e3247169489d29cc7de0079eea12a663870) For the backport, don't care about compatibilityMode, it won't be in grab-bag on ODF import so rely on the default of 12. Change-Id: Ia41d6a4c99ebcc364997d0bb565addf7dc546ced diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 478179cf8d0a..d76bed03c2af 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3695,6 +3695,7 @@ sal_Int32 lcl_getWordCompatibilityMode( const SwDoc& rDoc ) uno::Reference< beans::XPropertySet > xPropSet( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + sal_Int32 nWordCompatibilityMode = -1; if ( xPropSetInfo->hasPropertyByName( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) ) { uno::Sequence< beans::PropertyValue > propList; @@ -3725,14 +3726,14 @@ sal_Int32 lcl_getWordCompatibilityMode( const SwDoc& rDoc ) if ( sName == "compatibilityMode" && sUri == "http://schemas.microsoft.com/office/word" ) { - return sVal.toInt32(); + nWordCompatibilityMode = sVal.toInt32(); } } } } } - return -1; // Word compatibility mode not found + return nWordCompatibilityMode; } } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 7fed578100d1..a212f4e5c9b8 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -895,6 +895,21 @@ void DocxExport::WriteProperties( ) m_pFilter->exportDocumentProperties( xDocProps, bSecurityOptOpenReadOnly ); } +static auto +WriteCompat(SwDoc const& rDoc, ::sax_fastparser::FSHelperPtr const& rpFS + ) -> void +{ + if (!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING)) + { + rpFS->singleElementNS(XML_w, XML_noLeading); + } + // Do not justify lines with manual break + if (rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK)) + { + rpFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn); + } +} + void DocxExport::WriteSettings() { SwViewShell *pViewShell(m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); @@ -978,14 +993,6 @@ void DocxExport::WriteSettings() pFS->singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val ), OString::number(m_aSettings.defaultTabStop) ); - // Do not justify lines with manual break - if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK )) - { - pFS->startElementNS(XML_w, XML_compat); - pFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn); - pFS->endElementNS( XML_w, XML_compat ); - } - // export current mail merge database and table names SwDBData aData = m_pDoc->GetDBData(); if ( !aData.sDataSource.isEmpty() && aData.nCommandType == css::sdb::CommandType::TABLE && !aData.sCommand.isEmpty() ) @@ -1046,6 +1053,7 @@ void DocxExport::WriteSettings() bHasDummyRedlineProtectionKey = aKey.getLength() == 1 && aKey[0] == 1; } const OUString aGrabBagName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; + bool bHasCompat = false; if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) ) { uno::Sequence< beans::PropertyValue > propList; @@ -1076,6 +1084,10 @@ void DocxExport::WriteSettings() { pFS->startElementNS(XML_w, XML_compat); + WriteCompat(*m_pDoc, pFS); + + bHasCompat = true; + uno::Sequence< beans::PropertyValue > aCompatSettingsSequence; rProp.Value >>= aCompatSettingsSequence; @@ -1161,6 +1173,14 @@ void DocxExport::WriteSettings() } } } + if (!bHasCompat) + { + pFS->startElementNS(XML_w, XML_compat); + + WriteCompat(*m_pDoc, pFS); + + pFS->endElementNS( XML_w, XML_compat ); + } if (! hasProtectionProperties) { commit 3e80f9076d5c67a09a77cc081ced1336a78ad415 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Apr 14 18:10:53 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Jun 5 14:37:59 2020 +0200 writerfilter: DOCX import: import w:noLeading as AddExternalLeading Change-Id: I3d7fa2984975205d284575c60c6c47284b00c4a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92209 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 3cd3ae30217a80449799d7d9426c3756c572712e) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1130007df6f7..2603f778a0a8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6498,6 +6498,10 @@ void DomainMapper_Impl::ApplySettingsTable() if( m_pSettingsTable->GetEmbedSystemFonts()) xSettings->setPropertyValue( getPropertyName( PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) ); xSettings->setPropertyValue("AddParaTableSpacing", uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing())); + if (m_pSettingsTable->GetNoLeading()) + { + xSettings->setPropertyValue("AddExternalLeading", uno::makeAny(!m_pSettingsTable->GetNoLeading())); + } if( m_pSettingsTable->GetProtectForm() ) xSettings->setPropertyValue("ProtectForm", uno::makeAny( true )); } diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 58399cf0a151..02c3944cc415 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -255,6 +255,7 @@ struct SettingsTable_Impl bool m_bRedlineProtection; OUString m_sRedlineProtectionKey; bool m_bDisplayBackgroundShape; + bool m_bNoLeading = false; uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps; @@ -570,6 +571,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_displayBackgroundShape: m_pImpl->m_bDisplayBackgroundShape = nIntValue; break; + case NS_ooxml::LN_CT_Compat_noLeading: + m_pImpl->m_bNoLeading = nIntValue != 0; + break; default: { #ifdef DBG_UTIL @@ -787,6 +791,11 @@ bool SettingsTable::GetLongerSpaceSequence() const return m_pImpl->m_bLongerSpaceSequence; } +bool SettingsTable::GetNoLeading() const +{ + return m_pImpl->m_bNoLeading; +} + }//namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index 26c69d907b35..7f8cc8ba9bc4 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -78,6 +78,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable bool GetNoColumnBalance() const; bool GetProtectForm() const; bool GetLongerSpaceSequence() const; + bool GetNoLeading() const; bool GetNoHyphenateCaps() const; sal_Int16 GetHypenationZone() const; commit 69d99ea0a10cb54e67d20f155c81346064f26631 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Jun 2 09:07:48 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Jun 5 11:31:26 2020 +0200 tdf#133271 sw textbox: handle TextRotateAngle shape property Shape with btlr text direction is imported as TextPreRotateAngle=-270 from DOCX. Saving this to ODT turns the property name into TextRotateAngle and its type into double. Handle that as well to survive the ODF roundtrip of a shape+textbox where the textbox has a btlr text direction. (Also add a way to make multiple tests in a suite to be more independent from each other: depending on ordering, the new test made the old test fail. Calling ErrorRegistry::Reset() makes that go away.) Change-Id: Iea9212f3bbb01059caf3b0f2d809e48debf52953 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95340 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins (cherry picked from commit 413791a65597a1808d9b98e4887864f3624b70cc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95318 (cherry picked from commit e05a39f75cd304bfc1bd59aa2eebe4889cae109f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95411 Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/include/vcl/errinf.hxx b/include/vcl/errinf.hxx index 37805b7f710c..76ee7aca37aa 100644 --- a/include/vcl/errinf.hxx +++ b/include/vcl/errinf.hxx @@ -59,6 +59,7 @@ public: static void RegisterDisplay(BasicDisplayErrorFunc*); static void RegisterDisplay(WindowDisplayErrorFunc*); + static void Reset(); private: DisplayFnPtr pDsp; diff --git a/sw/CppunitTest_sw_core_doc.mk b/sw/CppunitTest_sw_core_doc.mk index 487e02322ef4..856f007cb9b1 100644 --- a/sw/CppunitTest_sw_core_doc.mk +++ b/sw/CppunitTest_sw_core_doc.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_doc, \ comphelper \ cppu \ cppuhelper \ + editeng \ sal \ sfx \ sw \ diff --git a/sw/qa/core/doc/data/textbox-textrotateangle.odt b/sw/qa/core/doc/data/textbox-textrotateangle.odt new file mode 100644 index 000000000000..2ce4c3e0b7ec Binary files /dev/null and b/sw/qa/core/doc/data/textbox-textrotateangle.odt differ diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 3141c12011cc..72895861f713 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -13,6 +13,8 @@ #include <comphelper/classids.hxx> #include <tools/globname.hxx> #include <svtools/embedhlp.hxx> +#include <editeng/frmdiritem.hxx> +#include <vcl/errinf.hxx> #include <wrtsh.hxx> #include <fmtanchr.hxx> @@ -58,6 +60,26 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) // - Actual : 4 // i.e. the anchor type was at-char, not as-char. CPPUNIT_ASSERT_EQUAL(RndStdIds::FLY_AS_CHAR, rAnchor.GetAnchorId()); + ErrorRegistry::Reset(); +} + +CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) +{ + // Check the writing direction of the only TextFrame in the document. + SwDoc* pDoc = createDoc("textbox-textrotateangle.odt"); + SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFrameFormats.size()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_DRAWFRMFMT), rFrameFormats[0]->Which()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_FLYFRMFMT), rFrameFormats[1]->Which()); + SvxFrameDirection eActual = rFrameFormats[1]->GetAttrSet().GetItem(RES_FRAMEDIR)->GetValue(); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 5 (btlr) + // - Actual : 0 (lrtb) + // i.e. the writing direction was in the ODT file, but it was lost on import in the textbox + // case. + CPPUNIT_ASSERT_EQUAL(SvxFrameDirection::Vertical_LR_BT, eActual); + ErrorRegistry::Reset(); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 37939224daf6..4656e3bec14c 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -358,11 +358,21 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue); auto it = aCustomShapeGeometry.find("TextPreRotateAngle"); + if (it == aCustomShapeGeometry.end()) + { + it = aCustomShapeGeometry.find("TextRotateAngle"); + } + if (it != aCustomShapeGeometry.end()) { - auto nTextPreRotateAngle = it->second.get<sal_Int32>(); + auto nAngle = it->second.has<sal_Int32>() ? it->second.get<sal_Int32>() : 0; + if (nAngle == 0) + { + nAngle = it->second.has<double>() ? it->second.get<double>() : 0; + } + sal_Int16 nDirection = 0; - switch (nTextPreRotateAngle) + switch (nAngle) { case -90: nDirection = text::WritingMode2::TB_RL; diff --git a/vcl/source/window/errinf.cxx b/vcl/source/window/errinf.cxx index f1e9109f5afb..31bec6e085a0 100644 --- a/vcl/source/window/errinf.cxx +++ b/vcl/source/window/errinf.cxx @@ -69,6 +69,12 @@ void ErrorRegistry::RegisterDisplay(WindowDisplayErrorFunc *aDsp) rData.pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); } +void ErrorRegistry::Reset() +{ + ErrorRegistry &rData = TheErrorRegistry::get(); + rData = ErrorRegistry(); +} + static void aDspFunc(const OUString &rErr, const OUString &rAction) { SAL_WARN("vcl", "Action: " << rAction << " Error: " << rErr); commit ede39fd49c03f2f604507bb1b79ac32fe52da493 Author: Lionel Elie Mamane <lio...@mamane.lu> AuthorDate: Fri May 8 07:51:53 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Jun 5 11:19:51 2020 +0200 tdf#122461 SQL identifiers (names) can contain newlines Change-Id: Ic58e6b65e146b2e0d9cb656aa5fa06cfe955d11d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93690 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane <lio...@mamane.lu> (cherry picked from commit b6ab865a371f5c46f96d931721f03afde82b7ec1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93787 Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 1002ecef7970..2269d1c6e52c 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -526,6 +526,8 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) int ch; OStringBuffer sBuffer(256); + assert(nTyp == 0 || nTyp == 1 || nTyp == 2); + while (!checkeof(ch = yyinput())) { if (ch == delim) @@ -554,7 +556,7 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) } } - else if (nTyp != 1 && (ch == '\r' || ch == '\n') ) + else if (nTyp == 2 && (ch == '\r' || ch == '\n') ) break; else { commit cdcbf109c47d366539b98c6e379874ae08de08e1 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Fri May 15 18:17:34 2020 +0300 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri Jun 5 01:12:37 2020 +0200 tdf#120394: list format string can be empty We need to distunguish when we have list format string, but it is empty (no level text will be diplayed) or it does not exist at all, so we need to fallback to old prefix-suffix syntax. Change-Id: Ifd4ccd5a676db86c39d2ef48e91d191d92b9b2a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94322 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit d8329149394e4e5758a9e293b0162db050379a4e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95413 diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx index 52cb14858c1f..b1fa7c66b039 100644 --- a/include/editeng/numitem.hxx +++ b/include/editeng/numitem.hxx @@ -31,6 +31,7 @@ #include <editeng/editengdllapi.h> #include <o3tl/typed_flags_set.hxx> #include <memory> +#include <optional> #include <algorithm> class SvxBrushItem; @@ -102,7 +103,9 @@ public: private: OUString sPrefix; OUString sSuffix; - OUString sListFormat; // Format string ">%1.%2<" can be used instead of prefix/suffix + std::optional<OUString> sListFormat; // Format string ">%1.%2<" can be used instead of prefix/suffix + // Right now it is optional value to dostinguish empty list format + // and not set list format when we need to fallback to prefix/suffix. SvxAdjust eNumAdjust; @@ -168,7 +171,8 @@ public: void SetSuffix(const OUString& rSet) { sSuffix = rSet;} const OUString& GetSuffix() const { return sSuffix;} void SetListFormat(const OUString& rSet) { sListFormat = rSet; } - const OUString& GetListFormat() const { return sListFormat; } + bool HasListFormat() const { return sListFormat.has_value(); } + const OUString& GetListFormat() const { return *sListFormat; } void SetCharFormatName(const OUString& rSet){ sCharStyleName = rSet; } virtual OUString GetCharFormatName()const; diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index df3dcf76bfff..481ebfada8eb 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -641,9 +641,9 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto { css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang)); - OUString sLevelFormat = rMyNFormat.GetListFormat(); - if (!sLevelFormat.isEmpty()) + if (rMyNFormat.HasListFormat()) { + OUString sLevelFormat = rMyNFormat.GetListFormat(); // In this case we are ignoring GetIncludeUpperLevels: we put all // level nubers requested by level format for (SwNumberTree::tNumberVector::size_type i=0; i <= nLevel; ++i) diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 8f0d95005a2a..1f68135f7a4a 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1343,11 +1343,12 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat aPropertyValues.push_back(comphelper::makePropertyValue("Suffix", aUString)); //listformat - aUString = rFormat.GetListFormat(); - aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", aUString)); + if (rFormat.HasListFormat()) + { + aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", rFormat.GetListFormat())); + } //char style name - aUString.clear(); SwStyleNameMapper::FillProgName( rCharFormatName, aUString, SwGetPoolIdFromName::ChrFmt); aPropertyValues.push_back(comphelper::makePropertyValue("CharStyleName", aUString)); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index ffd793d6db79..d08a7703ce50 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -493,7 +493,7 @@ void MSWordExportBase::NumberingLevel( const vcl::Font* pBulletFont=nullptr; rtl_TextEncoding eChrSet=0; FontFamily eFamily=FAMILY_DECORATIVE; - if (!rRule.Get(nLvl).GetListFormat().isEmpty()) + if (rRule.Get(nLvl).HasListFormat()) { // Nothing to construct: we have it already sNumStr = rRule.Get(nLvl).GetListFormat(); commit b52d304969a15e00d82745f4d2f96c04f188eb97 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Jun 2 16:45:44 2020 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> CommitDate: Thu Jun 4 12:46:12 2020 +0200 tdf#130354 sfx2: make PDF signing UI work again Regression from commit 9112c18524c9f5e67d6cbb282586a439e3020cdb (Don't create unnecessary tempfiles for opened doc, 2019-10-18), restore the temporary file creation for the PDF case, as it's needed for PDF signing to work. (cherry picked from commit 058caeef45f9abf12e4e243aafbbb1c2ebcbc057) Change-Id: I945f04f6ab90d0e04fb14a7634ec877fb0af1a0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95410 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 51276917bd5e..5c5b7826e075 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1594,6 +1594,10 @@ uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::GetDocum else { // Not ZIP-based, e.g. PDF. + + // Create temp file if needed. + GetMedium()->CreateTempFile(/*bReplace=*/false); + std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(GetMedium()->GetName(), StreamMode::READ)); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); uno::Reference<io::XInputStream> xInputStream(xStream, uno::UNO_QUERY); 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 ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits